@netless/appliance-plugin 1.1.7-beta.0 → 1.1.7-beta.2

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.
@@ -1,4 +1,4 @@
1
- var _excluded=["toolsType"],_excluded2=["callback"],_excluded3=["rect","willUpdateNodes","scenePath"],_excluded4=["render"],_excluded5=["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 _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 _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 _toArray(r){return _arrayWithHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableRest();}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 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 _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 _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 _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 _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 _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 _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 _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 Di=Object.defineProperty;var Ni=function Ni(h,r,t){return r in h?Di(h,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[r]=t;};var et=function et(h,r,t){return Ni(h,_typeof(r)!="symbol"?r+"":r,t);};var Lt=/* @__PURE__ */function(h){return h.Normal="Normal",h.Stroke="Stroke",h.Dotted="Dotted",h.LongDotted="LongDotted",h;}(Lt||{}),bt=/* @__PURE__ */function(h){return h.None="None",h.ShowFloatBar="ShowFloatBar",h.ZIndexFloatBar="ZIndexFloatBar",h.DeleteNode="DeleteNode",h.CopyNode="CopyNode",h.ZIndexActive="ZIndexActive",h.ZIndexNode="ZIndexNode",h.RotateNode="RotateNode",h.SetColorNode="SetColorNode",h.TranslateNode="TranslateNode",h.ScaleNode="ScaleNode",h.OriginalEvent="OriginalEvent",h.CreateScene="CreateScene",h.ActiveCursor="ActiveCursor",h.MoveCursor="MoveCursor",h.CommandEditor="CommandEditor",h.SetEditorData="SetEditorData",h.SetFontStyle="SetFontStyle",h.SetPoint="SetPoint",h.SetLock="SetLock",h.SetShapeOpt="SetShapeOpt",h.CameraChange="CameraChange",h.ActiveMethod="ActiveMethod",h;}(bt||{}),ut=/* @__PURE__ */function(h){return h[h.Pencil=1]="Pencil",h[h.Eraser=2]="Eraser",h[h.PencilEraser=3]="PencilEraser",h[h.BitMapEraser=4]="BitMapEraser",h[h.Selector=5]="Selector",h[h.Clicker=6]="Clicker",h[h.Arrow=7]="Arrow",h[h.Hand=8]="Hand",h[h.LaserPen=9]="LaserPen",h[h.Text=10]="Text",h[h.Straight=11]="Straight",h[h.Rectangle=12]="Rectangle",h[h.Ellipse=13]="Ellipse",h[h.Star=14]="Star",h[h.Triangle=15]="Triangle",h[h.Rhombus=16]="Rhombus",h[h.Polygon=17]="Polygon",h[h.SpeechBalloon=18]="SpeechBalloon",h[h.Image=19]="Image",h;}(ut||{}),Mt=/* @__PURE__ */function(h){return h[h.Local=1]="Local",h[h.Service=2]="Service",h[h.Worker=3]="Worker",h;}(Mt||{}),It=/* @__PURE__ */function(h){return h[h.Pending=0]="Pending",h[h.Start=1]="Start",h[h.Doing=2]="Doing",h[h.Done=3]="Done",h[h.Unwritable=4]="Unwritable",h;}(It||{}),at=/* @__PURE__ */function(h){return h[h.None=0]="None",h[h.Init=1]="Init",h[h.UpdateCamera=2]="UpdateCamera",h[h.UpdateTools=3]="UpdateTools",h[h.CreateWork=4]="CreateWork",h[h.DrawWork=5]="DrawWork",h[h.FullWork=6]="FullWork",h[h.UpdateNode=7]="UpdateNode",h[h.RemoveNode=8]="RemoveNode",h[h.Clear=9]="Clear",h[h.Select=10]="Select",h[h.Destroy=11]="Destroy",h[h.Snapshot=12]="Snapshot",h[h.BoundingBox=13]="BoundingBox",h[h.Cursor=14]="Cursor",h[h.TextUpdate=15]="TextUpdate",h[h.GetTextActive=16]="GetTextActive",h[h.TasksQueue=17]="TasksQueue",h[h.CursorHover=18]="CursorHover",h[h.CursorBlur=19]="CursorBlur",h[h.Console=20]="Console",h[h.PriorityWorker=21]="PriorityWorker",h[h.PriorityMainThreadWorker=22]="PriorityMainThreadWorker",h[h.GetImageBitMap=23]="GetImageBitMap",h[h.AuthWriter=24]="AuthWriter",h[h.AuthReader=25]="AuthReader",h[h.AuthClear=26]="AuthClear",h[h.AuthPage=27]="AuthPage",h[h.GetVNodeInfo=28]="GetVNodeInfo",h;}(at||{}),St=/* @__PURE__ */function(h){return h[h.None=0]="None",h[h.Bg=1]="Bg",h[h.ServiceFloat=2]="ServiceFloat",h[h.Float=3]="Float",h[h.TopFloat=4]="TopFloat",h;}(St||{}),jt=/* @__PURE__ */function(h){return h[h.none=1]="none",h[h.all=2]="all",h[h.both=3]="both",h[h.proportional=4]="proportional",h;}(jt||{}),Te=/* @__PURE__ */function(h){return h[h.inside=0]="inside",h[h.outside=1]="outside",h[h.intersect=2]="intersect",h;}(Te||{}),xr=/* @__PURE__ */function(h){return h.Image="image",h.Iconify="iconify",h;}(xr||{});var te=/*#__PURE__*/function(){function te(){_classCallCheck(this,te);et(this,"localWork");et(this,"serviceWork");et(this,"threadEngine");}return _createClass(te,[{key:"registerForWorker",value:function registerForWorker(r){return this.threadEngine=r,this.localWork=r.localWork,this.serviceWork=r.serviceWork,this;}}]);}();var Wi=/*#__PURE__*/function(_te){function Wi(){var _this;_classCallCheck(this,Wi);_this=_callSuper(this,Wi,arguments);et(_this,"emitEventType",bt.CopyNode);return _this;}_inherits(Wi,_te);return _createClass(Wi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.FullWork&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var n,e;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:e=t.workId;_context.t0=e;if(!_context.t0){_context.next=5;break;}_context.next=5;return(n=this.localWork)==null?void 0:n.consumeFull(t);case 5:case"end":return _context.stop();}},_callee,this);}));function consumeForLocalWorker(_x){return _consumeForLocalWorker.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(te);var De="++",Nt="selector",Bi="all";var Fi=/*#__PURE__*/function(_te2){function Fi(){var _this2;_classCallCheck(this,Fi);_this2=_callSuper(this,Fi,arguments);et(_this2,"emitEventType",bt.SetColorNode);return _this2;}_inherits(Fi,_te2);return _createClass(Fi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context2.t0=e===Nt&&n;if(!_context2.t0){_context2.next=5;break;}_context2.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context2.stop();}},_callee2,this);}));function consumeForLocalWorker(_x2){return _consumeForLocalWorker2.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=e.textUpdateForWoker,l=n.render||[],d=n.sp||[];if(a){var _iterator2=_createForOfIteratorHelper(i.entries()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _step2$value=_slicedToArray(_step2.value,2),c=_step2$value[0],p=_step2$value[1];s&&p.toolsType===ut.Text?d.push(_objectSpread(_objectSpread({},p),{},{workId:c,type:at.TextUpdate,dataType:Mt.Local,willSyncService:!0})):d.push(_objectSpread(_objectSpread({},p),{},{workId:c,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}return{render:l,sp:d};}}]);}(te);var Ui=/*#__PURE__*/function(_te3){function Ui(){var _this3;_classCallCheck(this,Ui);_this3=_callSuper(this,Ui,arguments);et(_this3,"emitEventType",bt.ZIndexNode);return _this3;}_inherits(Ui,_te3);return _createClass(Ui,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context3.t0=e===Nt&&n;if(!_context3.t0){_context3.next=5;break;}_context3.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context3.stop();}},_callee3,this);}));function consumeForLocalWorker(_x3){return _consumeForLocalWorker3.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=n.render||[],l=n.sp||[];if(a&&l){var _iterator3=_createForOfIteratorHelper(i.entries()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),d=_step3$value[0],c=_step3$value[1];l.push(_objectSpread(_objectSpread({},c),{},{workId:d,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}return{render:s,sp:l};}}]);}(te);var ji=/*#__PURE__*/function(_te4){function ji(){var _this4;_classCallCheck(this,ji);_this4=_callSuper(this,ji,arguments);et(_this4,"emitEventType",bt.TranslateNode);return _this4;}_inherits(ji,_te4);return _createClass(ji,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(t){var d,c,e,n,i,a,o,s,l;return _regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker,l=t.emitEventType;_context4.t0=e===Nt&&n;if(!_context4.t0){_context4.next=9;break;}if(!(n.workState===It.Done&&n!=null&&n.translate&&(n.translate[0]||n.translate[1])||n.workState!==It.Done)){_context4.next=8;break;}_context4.next=6;return(d=this.localWork)==null?void 0:d.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,isSync:!0,textUpdateForWoker:s,emitEventType:l,callback:this.updateSelectorCallback});case 6:_context4.next=9;break;case 8:n.workState===It.Done&&((c=this.localWork)==null||c.vNodes.deleteLastTarget());case 9:case"end":return _context4.stop();}},_callee4,this);}));function consumeForLocalWorker(_x4){return _consumeForLocalWorker4.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=e.textUpdateForWoker,p=d.workState,y=n.render||[],P=n.sp||[];if(p===It.Start)return{sp:[],render:[]};var x=o==null?void 0:o.selectRect;if(s){P.push({type:at.Select,selectIds:a.selectIds,selectRect:x,willSyncService:!0,isSync:!0,points:p===It.Done&&a.getChildrenPoints()||void 0,textOpt:a.textOpt});var _iterator4=_createForOfIteratorHelper(i.entries()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _step4$value=_slicedToArray(_step4.value,2),v=_step4$value[0],T=_step4$value[1];c&&T.toolsType===ut.Text?P.push(_objectSpread(_objectSpread({},T),{},{workId:v,type:at.TextUpdate,dataType:Mt.Local,willSyncService:!0})):P.push(_objectSpread(_objectSpread({},T),{},{workId:v,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}return{render:y,sp:P};}}]);}(te);var $i=/*#__PURE__*/function(_te5){function $i(){var _this5;_classCallCheck(this,$i);_this5=_callSuper(this,$i,arguments);et(_this5,"emitEventType",bt.DeleteNode);return _this5;}_inherits($i,_te5);return _createClass($i,[{key:"consume",value:function consume(){return!1;}}]);}(te);var zi=/*#__PURE__*/function(_te6){function zi(){var _this6;_classCallCheck(this,zi);_this6=_callSuper(this,zi,arguments);et(_this6,"emitEventType",bt.ScaleNode);return _this6;}_inherits(zi,_te6);return _createClass(zi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(t){var o,e,n,i,a;return _regeneratorRuntime().wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willSyncService,a=t.willSerializeData;_context5.t0=e===Nt&&n;if(!_context5.t0){_context5.next=5;break;}_context5.next=5;return(o=this.localWork)==null?void 0:o.updateSelector({updateSelectorOpt:n,willSyncService:i,willSerializeData:a,isSync:!0,callback:this.updateSelectorCallback.bind(this)});case 5:case"end":return _context5.stop();}},_callee5,this);}));function consumeForLocalWorker(_x5){return _consumeForLocalWorker5.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.workShapeNode,a=t.res,o=t.newServiceStore,s=e.updateSelectorOpt,l=e.willSyncService,d=s.workState,c=n.render||[],p=n.sp||[],y=a==null?void 0:a.selectRect;if(d===It.Start)return{sp:[],render:[]};if(l){p.push({type:at.Select,selectIds:i.selectIds,selectRect:y,willSyncService:!0,isSync:!0,points:d===It.Done&&i.getChildrenPoints()||void 0,textOpt:i.textOpt});var _iterator5=_createForOfIteratorHelper(o.entries()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_slicedToArray(_step5.value,2),P=_step5$value[0],x=_step5$value[1];x.toolsType===ut.Text?p.push(_objectSpread(_objectSpread({},x),{},{workId:P,type:at.TextUpdate,dataType:Mt.Local,willSyncService:!0})):p.push(_objectSpread(_objectSpread({},x),{},{workId:P,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:!0}));}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}return{render:c,sp:p};}}]);}(te);var Gi=/*#__PURE__*/function(_te7){function Gi(){var _this7;_classCallCheck(this,Gi);_this7=_callSuper(this,Gi,arguments);et(_this7,"emitEventType",bt.RotateNode);return _this7;}_inherits(Gi,_te7);return _createClass(Gi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.emitEventType;_context6.t0=e===Nt&&n;if(!_context6.t0){_context6.next=5;break;}_context6.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,emitEventType:s,isSync:!0,callback:this.updateSelectorCallback});case 5:case"end":return _context6.stop();}},_callee6,this);}));function consumeForLocalWorker(_x6){return _consumeForLocalWorker6.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.workShapeNode,a=t.res,o=t.newServiceStore,s=e.updateSelectorOpt,l=e.willSyncService,d=e.willSerializeData,c=e.isSync,p=s.workState,y=n.render||[],P=n.sp||[],x=a==null?void 0:a.selectRect;if(l){d&&p===It.Done&&P.push({type:at.Select,selectIds:i.selectIds,selectRect:x,willSyncService:!0,isSync:c,points:i.getChildrenPoints(),textOpt:i.textOpt,selectorColor:i.selectorColor,strokeColor:i.strokeColor,fillColor:i.fillColor,canTextEdit:i.canTextEdit,canRotate:i.canRotate,scaleType:i.scaleType,opt:i.getWorkOptions()||void 0,canLock:i.canLock,isLocked:i.isLocked,toolsTypes:i.toolsTypes,shapeOpt:i.shapeOpt,thickness:i.thickness,useStroke:i.useStroke,strokeType:i.strokeType});var _iterator6=_createForOfIteratorHelper(o.entries()),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _step6$value=_slicedToArray(_step6.value,2),v=_step6$value[0],T=_step6$value[1];P.push(_objectSpread(_objectSpread({},T),{},{workId:v,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:c}));}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}return{render:y,sp:P};}}]);}(te);var Hi=/*#__PURE__*/function(_te8){function Hi(){var _this8;_classCallCheck(this,Hi);_this8=_callSuper(this,Hi,arguments);et(_this8,"emitEventType",bt.SetFontStyle);return _this8;}_inherits(Hi,_te8);return _createClass(Hi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee7$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context7.t0=e===Nt&&n;if(!_context7.t0){_context7.next=5;break;}_context7.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context7.stop();}},_callee7,this);}));function consumeForLocalWorker(_x7){return _consumeForLocalWorker7.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=e.textUpdateForWoker,p=n.render||[],y=n.sp||[],P=o==null?void 0:o.selectRect;if(s&&y){d.fontSize&&y.push({type:at.Select,selectIds:a.selectIds,selectRect:P,willSyncService:s,isSync:l,points:a.getChildrenPoints()});var _iterator7=_createForOfIteratorHelper(i.entries()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _step7$value=_slicedToArray(_step7.value,2),x=_step7$value[0],v=_step7$value[1];c&&v.toolsType===ut.Text?y.push(_objectSpread(_objectSpread({},v),{},{workId:x,type:at.TextUpdate,dataType:Mt.Local,willSyncService:!0})):y.push(_objectSpread(_objectSpread({},v),{},{workId:x,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}return{render:p,sp:y};}}]);}(te);var Ki=/*#__PURE__*/function(_te9){function Ki(){var _this9;_classCallCheck(this,Ki);_this9=_callSuper(this,Ki,arguments);et(_this9,"emitEventType",bt.SetPoint);return _this9;}_inherits(Ki,_te9);return _createClass(Ki,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context8.t0=e===Nt&&n;if(!_context8.t0){_context8.next=5;break;}_context8.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,emitEventType:this.emitEventType,willSerializeData:o,isSync:!0,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context8.stop();}},_callee8,this);}));function consumeForLocalWorker(_x8){return _consumeForLocalWorker8.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=n.render||[],c=n.sp||[],p=o==null?void 0:o.selectRect;if(s&&c){var _iterator8=_createForOfIteratorHelper(i.entries()),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _step8$value=_slicedToArray(_step8.value,2),y=_step8$value[0],P=_step8$value[1];c.push(_objectSpread(_objectSpread({},P),{},{workId:y,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}c.push({type:at.Select,selectIds:a.selectIds,selectRect:p,willSyncService:s,isSync:l,points:a.getChildrenPoints()});}return{render:d,sp:c};}}]);}(te);var Yi=/*#__PURE__*/function(_te10){function Yi(){var _this10;_classCallCheck(this,Yi);_this10=_callSuper(this,Yi,arguments);et(_this10,"emitEventType",bt.SetLock);return _this10;}_inherits(Yi,_te10);return _createClass(Yi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee9$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context9.t0=e===Nt&&n;if(!_context9.t0){_context9.next=5;break;}_context9.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context9.stop();}},_callee9,this);}));function consumeForLocalWorker(_x9){return _consumeForLocalWorker9.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=n.render||[],p=n.sp||[],y=o==null?void 0:o.selectRect;if(s&&p){var _iterator9=_createForOfIteratorHelper(i.entries()),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _step9$value=_slicedToArray(_step9.value,2),P=_step9$value[0],x=_step9$value[1];p.push(_objectSpread(_objectSpread({},x),{},{workId:P,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}p.push({isLocked:d.isLocked,selectorColor:a.selectorColor,scaleType:a.scaleType,canRotate:a.canRotate,type:at.Select,selectIds:a.selectIds,selectRect:y,willSyncService:s,isSync:l});}return{render:c,sp:p};}}]);}(te);var Vi=/*#__PURE__*/function(_te11){function Vi(){var _this11;_classCallCheck(this,Vi);_this11=_callSuper(this,Vi,arguments);et(_this11,"emitEventType",bt.SetShapeOpt);return _this11;}_inherits(Vi,_te11);return _createClass(Vi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker10=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee10$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context10.t0=e===Nt&&n;if(!_context10.t0){_context10.next=5;break;}_context10.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context10.stop();}},_callee10,this);}));function consumeForLocalWorker(_x10){return _consumeForLocalWorker10.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=n.render||[],l=n.sp||[];if(a&&l){var _iterator10=_createForOfIteratorHelper(i.entries()),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _step10$value=_slicedToArray(_step10.value,2),d=_step10$value[0],c=_step10$value[1];l.push(_objectSpread(_objectSpread({},c),{},{workId:d,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}return{render:s,sp:l};}}]);}(te);var Xi=/*#__PURE__*/function(){function Xi(r){var _this12=this;_classCallCheck(this,Xi);et(this,"builders",/* @__PURE__ */new Map());this.builders=new Map(r.map(function(t){return[t,_this12.build(t)];}));}return _createClass(Xi,[{key:"build",value:function build(r){switch(r){case bt.TranslateNode:return new ji();case bt.ZIndexNode:return new Ui();case bt.CopyNode:return new Wi();case bt.SetColorNode:return new Fi();case bt.DeleteNode:return new $i();case bt.ScaleNode:return new zi();case bt.RotateNode:return new Gi();case bt.SetFontStyle:return new Hi();case bt.SetPoint:return new Ki();case bt.SetLock:return new Yi();case bt.SetShapeOpt:return new Vi();}}},{key:"registerForWorker",value:function registerForWorker(r){return this.builders.forEach(function(t){t&&t.registerForWorker(r);}),this;}},{key:"consumeForWorker",value:function consumeForWorker(r){var _iterator11=_createForOfIteratorHelper(this.builders.values()),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var t=_step11.value;if(t!=null&&t.consume(r))return!0;}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}return!1;}}]);}();var ki={linear:function linear(h){return h;},easeInQuad:function easeInQuad(h){return h*h;},easeOutQuad:function easeOutQuad(h){return h*(2-h);},easeInOutQuad:function easeInOutQuad(h){return h<0.5?2*h*h:-1+(4-2*h)*h;},easeInCubic:function easeInCubic(h){return h*h*h;},easeOutCubic:function easeOutCubic(h){return--h*h*h+1;},easeInOutCubic:function easeInOutCubic(h){return h<0.5?4*h*h*h:(h-1)*(2*h-2)*(2*h-2)+1;},easeInQuart:function easeInQuart(h){return h*h*h*h;},easeOutQuart:function easeOutQuart(h){return 1- --h*h*h*h;},easeInOutQuart:function easeInOutQuart(h){return h<0.5?8*h*h*h*h:1-8*--h*h*h*h;},easeInQuint:function easeInQuint(h){return h*h*h*h*h;},easeOutQuint:function easeOutQuint(h){return 1+--h*h*h*h*h;},easeInOutQuint:function easeInOutQuint(h){return h<0.5?16*h*h*h*h*h:1+16*--h*h*h*h*h;},easeInSine:function easeInSine(h){return 1-Math.cos(h*Math.PI/2);},easeOutSine:function easeOutSine(h){return Math.sin(h*Math.PI/2);},easeInOutSine:function easeInOutSine(h){return-(Math.cos(Math.PI*h)-1)/2;},easeInExpo:function easeInExpo(h){return h<=0?0:Math.pow(2,10*h-10);},easeOutExpo:function easeOutExpo(h){return h>=1?1:1-Math.pow(2,-10*h);},easeInOutExpo:function easeInOutExpo(h){return h<=0?0:h>=1?1:h<0.5?Math.pow(2,20*h-10)/2:(2-Math.pow(2,-20*h+10))/2;}};var _=/*#__PURE__*/function(){function _(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;_classCallCheck(this,_);this.x=r,this.y=t,this.z=e;}return _createClass(_,[{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setz",value:function setz(r){return this.z=r,this;}},{key:"setXY",value:function setXY(){var r=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=r,this.y=t,this;}},{key:"set",value:function set(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;return this.x=r,this.y=t,this.z=e,this;}},{key:"setTo",value:function setTo(_ref){var _ref$x=_ref.x,r=_ref$x===void 0?0:_ref$x,_ref$y=_ref.y,t=_ref$y===void 0?0:_ref$y,_ref$z=_ref.z,e=_ref$z===void 0?1:_ref$z;return this.x=r,this.y=t,this.z=e,this;}},{key:"rot",value:function rot(r){if(r===0)return this;var t=this.x,e=this.y,n=Math.sin(r),i=Math.cos(r);return this.x=t*i-e*n,this.y=t*n+e*i,this;}},{key:"rotWith",value:function rotWith(r,t){if(t===0)return this;var e=this.x-r.x,n=this.y-r.y,i=Math.sin(t),a=Math.cos(t);return this.x=r.x+(e*a-n*i),this.y=r.y+(e*i+n*a),this;}},{key:"clone",value:function clone(){var r=this.x,t=this.y,e=this.z;return new _(r,t,e);}},{key:"sub",value:function sub(r){return this.x-=r.x,this.y-=r.y,this;}},{key:"subXY",value:function subXY(r,t){return this.x-=r,this.y-=t,this;}},{key:"subScalar",value:function subScalar(r){return this.x-=r,this.y-=r,this;}},{key:"add",value:function add(r){return this.x+=r.x,this.y+=r.y,this;}},{key:"addXY",value:function addXY(r,t){return this.x+=r,this.y+=t,this;}},{key:"addScalar",value:function addScalar(r){return this.x+=r,this.y+=r,this;}},{key:"clamp",value:function clamp(r,t){return this.x=Math.max(this.x,r),this.y=Math.max(this.y,r),t!==void 0&&(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)),this;}},{key:"div",value:function div(r){return this.x/=r,this.y/=r,this;}},{key:"divV",value:function divV(r){return this.x/=r.x,this.y/=r.y,this;}},{key:"mul",value:function mul(r){return this.x*=r,this.y*=r,this;}},{key:"mulV",value:function mulV(r){return this.x*=r.x,this.y*=r.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(r,t){var e=_.Tan(r,this);return this.add(e.mul(t));}},{key:"neg",value:function neg(){return this.x*=-1,this.y*=-1,this;}},{key:"cross",value:function cross(r){return this.x=this.y*r.z-this.z*r.y,this.y=this.z*r.x-this.x*r.z,this;}},{key:"dpr",value:function dpr(r){return _.Dpr(this,r);}},{key:"cpr",value:function cpr(r){return _.Cpr(this,r);}},{key:"len2",value:function len2(){return _.Len2(this);}},{key:"len",value:function len(){return _.Len(this);}},{key:"pry",value:function pry(r){return _.Pry(this,r);}},{key:"per",value:function per(){var r=this.x,t=this.y;return this.x=t,this.y=-r,this;}},{key:"uni",value:function uni(){return _.Uni(this);}},{key:"tan",value:function tan(r){return _.Tan(this,r);}},{key:"dist",value:function dist(r){return _.Dist(this,r);}},{key:"distanceToLineSegment",value:function distanceToLineSegment(r,t){return _.DistanceToLineSegment(r,t,this);}},{key:"slope",value:function slope(r){return _.Slope(this,r);}},{key:"snapToGrid",value:function snapToGrid(r){return this.x=Math.round(this.x/r)*r,this.y=Math.round(this.y/r)*r,this;}},{key:"angle",value:function angle(r){return _.Angle(this,r);}},{key:"toAngle",value:function toAngle(){return _.ToAngle(this);}},{key:"lrp",value:function lrp(r,t){return this.x=this.x+(r.x-this.x)*t,this.y=this.y+(r.y-this.y)*t,this;}},{key:"equals",value:function equals(r,t){return _.Equals(this,r,t);}},{key:"equalsXY",value:function equalsXY(r,t){return _.EqualsXY(this,r,t);}},{key:"norm",value:function norm(){var r=this.len();return this.x=r===0?0:this.x/r,this.y=r===0?0:this.y/r,this;}},{key:"toFixed",value:function toFixed(){return _.ToFixed(this);}},{key:"toString",value:function toString(){return _.ToString(_.ToFixed(this));}},{key:"toJson",value:function toJson(){return _.ToJson(this);}},{key:"toArray",value:function toArray(){return _.ToArray(this);}}],[{key:"Add",value:function Add(r,t){return new _(r.x+t.x,r.y+t.y);}},{key:"AddXY",value:function AddXY(r,t,e){return new _(r.x+t,r.y+e);}},{key:"Sub",value:function Sub(r,t){return new _(r.x-t.x,r.y-t.y);}},{key:"SubXY",value:function SubXY(r,t,e){return new _(r.x-t,r.y-e);}},{key:"AddScalar",value:function AddScalar(r,t){return new _(r.x+t,r.y+t);}},{key:"SubScalar",value:function SubScalar(r,t){return new _(r.x-t,r.y-t);}},{key:"Div",value:function Div(r,t){return new _(r.x/t,r.y/t);}},{key:"Mul",value:function Mul(r,t){return new _(r.x*t,r.y*t);}},{key:"DivV",value:function DivV(r,t){return new _(r.x/t.x,r.y/t.y);}},{key:"MulV",value:function MulV(r,t){return new _(r.x*t.x,r.y*t.y);}},{key:"Neg",value:function Neg(r){return new _(-r.x,-r.y);}},{key:"Per",value:function Per(r){return new _(r.y,-r.x);}},{key:"Dist2",value:function Dist2(r,t){return _.Sub(r,t).len2();}},{key:"Abs",value:function Abs(r){return new _(Math.abs(r.x),Math.abs(r.y));}},{key:"Dist",value:function Dist(r,t){return Math.hypot(r.y-t.y,r.x-t.x);}},{key:"Dpr",value:function Dpr(r,t){return r.x*t.x+r.y*t.y;}},{key:"Cross",value:function Cross(r,t){return new _(r.y*t.z-r.z*t.y,r.z*t.x-r.x*t.z// A.z = A.x * V.y - A.y * V.x
1
+ var _excluded=["toolsType"],_excluded2=["callback"],_excluded3=["rect","willUpdateNodes","scenePath"],_excluded4=["render"],_excluded5=["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 _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 _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 _toArray(r){return _arrayWithHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableRest();}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 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 _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 _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 _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 _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 _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 _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 _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 Ni=Object.defineProperty;var Wi=function Wi(h,r,t){return r in h?Ni(h,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[r]=t;};var et=function et(h,r,t){return Wi(h,_typeof(r)!="symbol"?r+"":r,t);};var Lt=/* @__PURE__ */function(h){return h.Normal="Normal",h.Stroke="Stroke",h.Dotted="Dotted",h.LongDotted="LongDotted",h;}(Lt||{}),bt=/* @__PURE__ */function(h){return h.None="None",h.ShowFloatBar="ShowFloatBar",h.ZIndexFloatBar="ZIndexFloatBar",h.DeleteNode="DeleteNode",h.CopyNode="CopyNode",h.ZIndexActive="ZIndexActive",h.ZIndexNode="ZIndexNode",h.RotateNode="RotateNode",h.SetColorNode="SetColorNode",h.TranslateNode="TranslateNode",h.ScaleNode="ScaleNode",h.OriginalEvent="OriginalEvent",h.CreateScene="CreateScene",h.ActiveCursor="ActiveCursor",h.MoveCursor="MoveCursor",h.CommandEditor="CommandEditor",h.SetEditorData="SetEditorData",h.SetFontStyle="SetFontStyle",h.SetPoint="SetPoint",h.SetLock="SetLock",h.SetShapeOpt="SetShapeOpt",h.CameraChange="CameraChange",h.ActiveMethod="ActiveMethod",h;}(bt||{}),ut=/* @__PURE__ */function(h){return h[h.Pencil=1]="Pencil",h[h.Eraser=2]="Eraser",h[h.PencilEraser=3]="PencilEraser",h[h.BitMapEraser=4]="BitMapEraser",h[h.Selector=5]="Selector",h[h.Clicker=6]="Clicker",h[h.Arrow=7]="Arrow",h[h.Hand=8]="Hand",h[h.LaserPen=9]="LaserPen",h[h.Text=10]="Text",h[h.Straight=11]="Straight",h[h.Rectangle=12]="Rectangle",h[h.Ellipse=13]="Ellipse",h[h.Star=14]="Star",h[h.Triangle=15]="Triangle",h[h.Rhombus=16]="Rhombus",h[h.Polygon=17]="Polygon",h[h.SpeechBalloon=18]="SpeechBalloon",h[h.Image=19]="Image",h;}(ut||{}),Mt=/* @__PURE__ */function(h){return h[h.Local=1]="Local",h[h.Service=2]="Service",h[h.Worker=3]="Worker",h;}(Mt||{}),It=/* @__PURE__ */function(h){return h[h.Pending=0]="Pending",h[h.Start=1]="Start",h[h.Doing=2]="Doing",h[h.Done=3]="Done",h[h.Unwritable=4]="Unwritable",h;}(It||{}),at=/* @__PURE__ */function(h){return h[h.None=0]="None",h[h.Init=1]="Init",h[h.UpdateCamera=2]="UpdateCamera",h[h.UpdateTools=3]="UpdateTools",h[h.CreateWork=4]="CreateWork",h[h.DrawWork=5]="DrawWork",h[h.FullWork=6]="FullWork",h[h.UpdateNode=7]="UpdateNode",h[h.RemoveNode=8]="RemoveNode",h[h.Clear=9]="Clear",h[h.Select=10]="Select",h[h.Destroy=11]="Destroy",h[h.Snapshot=12]="Snapshot",h[h.BoundingBox=13]="BoundingBox",h[h.Cursor=14]="Cursor",h[h.TextUpdate=15]="TextUpdate",h[h.GetTextActive=16]="GetTextActive",h[h.TasksQueue=17]="TasksQueue",h[h.CursorHover=18]="CursorHover",h[h.CursorBlur=19]="CursorBlur",h[h.Console=20]="Console",h[h.PriorityWorker=21]="PriorityWorker",h[h.PriorityMainThreadWorker=22]="PriorityMainThreadWorker",h[h.GetImageBitMap=23]="GetImageBitMap",h[h.AuthWriter=24]="AuthWriter",h[h.AuthReader=25]="AuthReader",h[h.AuthClear=26]="AuthClear",h[h.AuthPage=27]="AuthPage",h[h.GetVNodeInfo=28]="GetVNodeInfo",h;}(at||{}),St=/* @__PURE__ */function(h){return h[h.None=0]="None",h[h.Bg=1]="Bg",h[h.ServiceFloat=2]="ServiceFloat",h[h.Float=3]="Float",h[h.TopFloat=4]="TopFloat",h;}(St||{}),jt=/* @__PURE__ */function(h){return h[h.none=1]="none",h[h.all=2]="all",h[h.both=3]="both",h[h.proportional=4]="proportional",h;}(jt||{}),Te=/* @__PURE__ */function(h){return h[h.inside=0]="inside",h[h.outside=1]="outside",h[h.intersect=2]="intersect",h;}(Te||{}),xr=/* @__PURE__ */function(h){return h.Image="image",h.Iconify="iconify",h;}(xr||{});var te=/*#__PURE__*/function(){function te(){_classCallCheck(this,te);et(this,"localWork");et(this,"serviceWork");et(this,"threadEngine");}return _createClass(te,[{key:"registerForWorker",value:function registerForWorker(r){return this.threadEngine=r,this.localWork=r.localWork,this.serviceWork=r.serviceWork,this;}}]);}();var Bi=/*#__PURE__*/function(_te){function Bi(){var _this;_classCallCheck(this,Bi);_this=_callSuper(this,Bi,arguments);et(_this,"emitEventType",bt.CopyNode);return _this;}_inherits(Bi,_te);return _createClass(Bi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.FullWork&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(t){var n,e;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:e=t.workId;_context.t0=e;if(!_context.t0){_context.next=5;break;}_context.next=5;return(n=this.localWork)==null?void 0:n.consumeFull(t);case 5:case"end":return _context.stop();}},_callee,this);}));function consumeForLocalWorker(_x){return _consumeForLocalWorker.apply(this,arguments);}return consumeForLocalWorker;}()}]);}(te);var De="++",Nt="selector",Fi="all";var Ui=/*#__PURE__*/function(_te2){function Ui(){var _this2;_classCallCheck(this,Ui);_this2=_callSuper(this,Ui,arguments);et(_this2,"emitEventType",bt.SetColorNode);return _this2;}_inherits(Ui,_te2);return _createClass(Ui,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context2.t0=e===Nt&&n;if(!_context2.t0){_context2.next=5;break;}_context2.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context2.stop();}},_callee2,this);}));function consumeForLocalWorker(_x2){return _consumeForLocalWorker2.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=e.textUpdateForWoker,l=n.render||[],d=n.sp||[];if(a){var _iterator2=_createForOfIteratorHelper(i.entries()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _step2$value=_slicedToArray(_step2.value,2),c=_step2$value[0],p=_step2$value[1];s&&p.toolsType===ut.Text?d.push(_objectSpread(_objectSpread({},p),{},{workId:c,type:at.TextUpdate,dataType:Mt.Local,willSyncService:!0})):d.push(_objectSpread(_objectSpread({},p),{},{workId:c,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}return{render:l,sp:d};}}]);}(te);var ji=/*#__PURE__*/function(_te3){function ji(){var _this3;_classCallCheck(this,ji);_this3=_callSuper(this,ji,arguments);et(_this3,"emitEventType",bt.ZIndexNode);return _this3;}_inherits(ji,_te3);return _createClass(ji,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context3.t0=e===Nt&&n;if(!_context3.t0){_context3.next=5;break;}_context3.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context3.stop();}},_callee3,this);}));function consumeForLocalWorker(_x3){return _consumeForLocalWorker3.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=n.render||[],l=n.sp||[];if(a&&l){var _iterator3=_createForOfIteratorHelper(i.entries()),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _step3$value=_slicedToArray(_step3.value,2),d=_step3$value[0],c=_step3$value[1];l.push(_objectSpread(_objectSpread({},c),{},{workId:d,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}return{render:s,sp:l};}}]);}(te);var $i=/*#__PURE__*/function(_te4){function $i(){var _this4;_classCallCheck(this,$i);_this4=_callSuper(this,$i,arguments);et(_this4,"emitEventType",bt.TranslateNode);return _this4;}_inherits($i,_te4);return _createClass($i,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(t){var d,c,e,n,i,a,o,s,l;return _regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker,l=t.emitEventType;_context4.t0=e===Nt&&n;if(!_context4.t0){_context4.next=9;break;}if(!(n.workState===It.Done&&n!=null&&n.translate&&(n.translate[0]||n.translate[1])||n.workState!==It.Done)){_context4.next=8;break;}_context4.next=6;return(d=this.localWork)==null?void 0:d.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,isSync:!0,textUpdateForWoker:s,emitEventType:l,callback:this.updateSelectorCallback});case 6:_context4.next=9;break;case 8:n.workState===It.Done&&((c=this.localWork)==null||c.vNodes.deleteLastTarget());case 9:case"end":return _context4.stop();}},_callee4,this);}));function consumeForLocalWorker(_x4){return _consumeForLocalWorker4.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=e.textUpdateForWoker,p=d.workState,y=n.render||[],P=n.sp||[];if(p===It.Start)return{sp:[],render:[]};var x=o==null?void 0:o.selectRect;if(s){P.push({type:at.Select,selectIds:a.selectIds,selectRect:x,willSyncService:!0,isSync:!0,points:p===It.Done&&a.getChildrenPoints()||void 0,textOpt:a.textOpt});var _iterator4=_createForOfIteratorHelper(i.entries()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _step4$value=_slicedToArray(_step4.value,2),v=_step4$value[0],T=_step4$value[1];c&&T.toolsType===ut.Text?P.push(_objectSpread(_objectSpread({},T),{},{workId:v,type:at.TextUpdate,dataType:Mt.Local,willSyncService:!0})):P.push(_objectSpread(_objectSpread({},T),{},{workId:v,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}return{render:y,sp:P};}}]);}(te);var zi=/*#__PURE__*/function(_te5){function zi(){var _this5;_classCallCheck(this,zi);_this5=_callSuper(this,zi,arguments);et(_this5,"emitEventType",bt.DeleteNode);return _this5;}_inherits(zi,_te5);return _createClass(zi,[{key:"consume",value:function consume(){return!1;}}]);}(te);var Gi=/*#__PURE__*/function(_te6){function Gi(){var _this6;_classCallCheck(this,Gi);_this6=_callSuper(this,Gi,arguments);et(_this6,"emitEventType",bt.ScaleNode);return _this6;}_inherits(Gi,_te6);return _createClass(Gi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(t){var o,e,n,i,a;return _regeneratorRuntime().wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willSyncService,a=t.willSerializeData;_context5.t0=e===Nt&&n;if(!_context5.t0){_context5.next=5;break;}_context5.next=5;return(o=this.localWork)==null?void 0:o.updateSelector({updateSelectorOpt:n,willSyncService:i,willSerializeData:a,isSync:!0,callback:this.updateSelectorCallback.bind(this)});case 5:case"end":return _context5.stop();}},_callee5,this);}));function consumeForLocalWorker(_x5){return _consumeForLocalWorker5.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.workShapeNode,a=t.res,o=t.newServiceStore,s=e.updateSelectorOpt,l=e.willSyncService,d=s.workState,c=n.render||[],p=n.sp||[],y=a==null?void 0:a.selectRect;if(d===It.Start)return{sp:[],render:[]};if(l){p.push({type:at.Select,selectIds:i.selectIds,selectRect:y,willSyncService:!0,isSync:!0,points:d===It.Done&&i.getChildrenPoints()||void 0,textOpt:i.textOpt});var _iterator5=_createForOfIteratorHelper(o.entries()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _step5$value=_slicedToArray(_step5.value,2),P=_step5$value[0],x=_step5$value[1];x.toolsType===ut.Text?p.push(_objectSpread(_objectSpread({},x),{},{workId:P,type:at.TextUpdate,dataType:Mt.Local,willSyncService:!0})):p.push(_objectSpread(_objectSpread({},x),{},{workId:P,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:!0}));}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}return{render:c,sp:p};}}]);}(te);var Hi=/*#__PURE__*/function(_te7){function Hi(){var _this7;_classCallCheck(this,Hi);_this7=_callSuper(this,Hi,arguments);et(_this7,"emitEventType",bt.RotateNode);return _this7;}_inherits(Hi,_te7);return _createClass(Hi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.emitEventType;_context6.t0=e===Nt&&n;if(!_context6.t0){_context6.next=5;break;}_context6.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,emitEventType:s,isSync:!0,callback:this.updateSelectorCallback});case 5:case"end":return _context6.stop();}},_callee6,this);}));function consumeForLocalWorker(_x6){return _consumeForLocalWorker6.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.workShapeNode,a=t.res,o=t.newServiceStore,s=e.updateSelectorOpt,l=e.willSyncService,d=e.willSerializeData,c=e.isSync,p=s.workState,y=n.render||[],P=n.sp||[],x=a==null?void 0:a.selectRect;if(l){d&&p===It.Done&&P.push({type:at.Select,selectIds:i.selectIds,selectRect:x,willSyncService:!0,isSync:c,points:i.getChildrenPoints(),textOpt:i.textOpt,selectorColor:i.selectorColor,strokeColor:i.strokeColor,fillColor:i.fillColor,canTextEdit:i.canTextEdit,canRotate:i.canRotate,scaleType:i.scaleType,opt:i.getWorkOptions()||void 0,canLock:i.canLock,isLocked:i.isLocked,toolsTypes:i.toolsTypes,shapeOpt:i.shapeOpt,thickness:i.thickness,useStroke:i.useStroke,strokeType:i.strokeType});var _iterator6=_createForOfIteratorHelper(o.entries()),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _step6$value=_slicedToArray(_step6.value,2),v=_step6$value[0],T=_step6$value[1];P.push(_objectSpread(_objectSpread({},T),{},{workId:v,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:c}));}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}}return{render:y,sp:P};}}]);}(te);var Ki=/*#__PURE__*/function(_te8){function Ki(){var _this8;_classCallCheck(this,Ki);_this8=_callSuper(this,Ki,arguments);et(_this8,"emitEventType",bt.SetFontStyle);return _this8;}_inherits(Ki,_te8);return _createClass(Ki,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee7$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context7.t0=e===Nt&&n;if(!_context7.t0){_context7.next=5;break;}_context7.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context7.stop();}},_callee7,this);}));function consumeForLocalWorker(_x7){return _consumeForLocalWorker7.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=e.textUpdateForWoker,p=n.render||[],y=n.sp||[],P=o==null?void 0:o.selectRect;if(s&&y){d.fontSize&&y.push({type:at.Select,selectIds:a.selectIds,selectRect:P,willSyncService:s,isSync:l,points:a.getChildrenPoints()});var _iterator7=_createForOfIteratorHelper(i.entries()),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _step7$value=_slicedToArray(_step7.value,2),x=_step7$value[0],v=_step7$value[1];c&&v.toolsType===ut.Text?y.push(_objectSpread(_objectSpread({},v),{},{workId:x,type:at.TextUpdate,dataType:Mt.Local,willSyncService:!0})):y.push(_objectSpread(_objectSpread({},v),{},{workId:x,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}return{render:p,sp:y};}}]);}(te);var Yi=/*#__PURE__*/function(_te9){function Yi(){var _this9;_classCallCheck(this,Yi);_this9=_callSuper(this,Yi,arguments);et(_this9,"emitEventType",bt.SetPoint);return _this9;}_inherits(Yi,_te9);return _createClass(Yi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(t){var l,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData,s=t.textUpdateForWoker;_context8.t0=e===Nt&&n;if(!_context8.t0){_context8.next=5;break;}_context8.next=5;return(l=this.localWork)==null?void 0:l.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,emitEventType:this.emitEventType,willSerializeData:o,isSync:!0,textUpdateForWoker:s,callback:this.updateSelectorCallback});case 5:case"end":return _context8.stop();}},_callee8,this);}));function consumeForLocalWorker(_x8){return _consumeForLocalWorker8.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=n.render||[],c=n.sp||[],p=o==null?void 0:o.selectRect;if(s&&c){var _iterator8=_createForOfIteratorHelper(i.entries()),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _step8$value=_slicedToArray(_step8.value,2),y=_step8$value[0],P=_step8$value[1];c.push(_objectSpread(_objectSpread({},P),{},{workId:y,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}c.push({type:at.Select,selectIds:a.selectIds,selectRect:p,willSyncService:s,isSync:l,points:a.getChildrenPoints()});}return{render:d,sp:c};}}]);}(te);var Vi=/*#__PURE__*/function(_te10){function Vi(){var _this10;_classCallCheck(this,Vi);_this10=_callSuper(this,Vi,arguments);et(_this10,"emitEventType",bt.SetLock);return _this10;}_inherits(Vi,_te10);return _createClass(Vi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee9$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context9.t0=e===Nt&&n;if(!_context9.t0){_context9.next=5;break;}_context9.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context9.stop();}},_callee9,this);}));function consumeForLocalWorker(_x9){return _consumeForLocalWorker9.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=t.workShapeNode,o=t.res,s=e.willSyncService,l=e.isSync,d=e.updateSelectorOpt,c=n.render||[],p=n.sp||[],y=o==null?void 0:o.selectRect;if(s&&p){var _iterator9=_createForOfIteratorHelper(i.entries()),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _step9$value=_slicedToArray(_step9.value,2),P=_step9$value[0],x=_step9$value[1];p.push(_objectSpread(_objectSpread({},x),{},{workId:P,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:l}));}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}p.push({isLocked:d.isLocked,selectorColor:a.selectorColor,scaleType:a.scaleType,canRotate:a.canRotate,type:at.Select,selectIds:a.selectIds,selectRect:y,willSyncService:s,isSync:l});}return{render:c,sp:p};}}]);}(te);var Xi=/*#__PURE__*/function(_te11){function Xi(){var _this11;_classCallCheck(this,Xi);_this11=_callSuper(this,Xi,arguments);et(_this11,"emitEventType",bt.SetShapeOpt);return _this11;}_inherits(Xi,_te11);return _createClass(Xi,[{key:"consume",value:function consume(t){var e=t.msgType,n=t.dataType,i=t.emitEventType;if(e===at.UpdateNode&&n===Mt.Local&&i===this.emitEventType)return this.consumeForLocalWorker(t),!0;}},{key:"consumeForLocalWorker",value:function(){var _consumeForLocalWorker10=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(t){var s,e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee10$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:e=t.workId,n=t.updateNodeOpt,i=t.willRefreshSelector,a=t.willSyncService,o=t.willSerializeData;_context10.t0=e===Nt&&n;if(!_context10.t0){_context10.next=5;break;}_context10.next=5;return(s=this.localWork)==null?void 0:s.updateSelector({updateSelectorOpt:n,willRefreshSelector:i,willSyncService:a,willSerializeData:o,callback:this.updateSelectorCallback});case 5:case"end":return _context10.stop();}},_callee10,this);}));function consumeForLocalWorker(_x10){return _consumeForLocalWorker10.apply(this,arguments);}return consumeForLocalWorker;}()},{key:"updateSelectorCallback",value:function updateSelectorCallback(t){var e=t.param,n=t.postData,i=t.newServiceStore,a=e.willSyncService,o=e.isSync,s=n.render||[],l=n.sp||[];if(a&&l){var _iterator10=_createForOfIteratorHelper(i.entries()),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _step10$value=_slicedToArray(_step10.value,2),d=_step10$value[0],c=_step10$value[1];l.push(_objectSpread(_objectSpread({},c),{},{workId:d,type:at.UpdateNode,updateNodeOpt:{useAnimation:!1},isSync:o}));}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}return{render:s,sp:l};}}]);}(te);var ki=/*#__PURE__*/function(){function ki(r){var _this12=this;_classCallCheck(this,ki);et(this,"builders",/* @__PURE__ */new Map());this.builders=new Map(r.map(function(t){return[t,_this12.build(t)];}));}return _createClass(ki,[{key:"build",value:function build(r){switch(r){case bt.TranslateNode:return new $i();case bt.ZIndexNode:return new ji();case bt.CopyNode:return new Bi();case bt.SetColorNode:return new Ui();case bt.DeleteNode:return new zi();case bt.ScaleNode:return new Gi();case bt.RotateNode:return new Hi();case bt.SetFontStyle:return new Ki();case bt.SetPoint:return new Yi();case bt.SetLock:return new Vi();case bt.SetShapeOpt:return new Xi();}}},{key:"registerForWorker",value:function registerForWorker(r){return this.builders.forEach(function(t){t&&t.registerForWorker(r);}),this;}},{key:"consumeForWorker",value:function consumeForWorker(r){var _iterator11=_createForOfIteratorHelper(this.builders.values()),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var t=_step11.value;if(t!=null&&t.consume(r))return!0;}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}return!1;}}]);}();var Ji={linear:function linear(h){return h;},easeInQuad:function easeInQuad(h){return h*h;},easeOutQuad:function easeOutQuad(h){return h*(2-h);},easeInOutQuad:function easeInOutQuad(h){return h<0.5?2*h*h:-1+(4-2*h)*h;},easeInCubic:function easeInCubic(h){return h*h*h;},easeOutCubic:function easeOutCubic(h){return--h*h*h+1;},easeInOutCubic:function easeInOutCubic(h){return h<0.5?4*h*h*h:(h-1)*(2*h-2)*(2*h-2)+1;},easeInQuart:function easeInQuart(h){return h*h*h*h;},easeOutQuart:function easeOutQuart(h){return 1- --h*h*h*h;},easeInOutQuart:function easeInOutQuart(h){return h<0.5?8*h*h*h*h:1-8*--h*h*h*h;},easeInQuint:function easeInQuint(h){return h*h*h*h*h;},easeOutQuint:function easeOutQuint(h){return 1+--h*h*h*h*h;},easeInOutQuint:function easeInOutQuint(h){return h<0.5?16*h*h*h*h*h:1+16*--h*h*h*h*h;},easeInSine:function easeInSine(h){return 1-Math.cos(h*Math.PI/2);},easeOutSine:function easeOutSine(h){return Math.sin(h*Math.PI/2);},easeInOutSine:function easeInOutSine(h){return-(Math.cos(Math.PI*h)-1)/2;},easeInExpo:function easeInExpo(h){return h<=0?0:Math.pow(2,10*h-10);},easeOutExpo:function easeOutExpo(h){return h>=1?1:1-Math.pow(2,-10*h);},easeInOutExpo:function easeInOutExpo(h){return h<=0?0:h>=1?1:h<0.5?Math.pow(2,20*h-10)/2:(2-Math.pow(2,-20*h+10))/2;}};var _=/*#__PURE__*/function(){function _(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;_classCallCheck(this,_);this.x=r,this.y=t,this.z=e;}return _createClass(_,[{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setz",value:function setz(r){return this.z=r,this;}},{key:"setXY",value:function setXY(){var r=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=r,this.y=t,this;}},{key:"set",value:function set(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;return this.x=r,this.y=t,this.z=e,this;}},{key:"setTo",value:function setTo(_ref){var _ref$x=_ref.x,r=_ref$x===void 0?0:_ref$x,_ref$y=_ref.y,t=_ref$y===void 0?0:_ref$y,_ref$z=_ref.z,e=_ref$z===void 0?1:_ref$z;return this.x=r,this.y=t,this.z=e,this;}},{key:"rot",value:function rot(r){if(r===0)return this;var t=this.x,e=this.y,n=Math.sin(r),i=Math.cos(r);return this.x=t*i-e*n,this.y=t*n+e*i,this;}},{key:"rotWith",value:function rotWith(r,t){if(t===0)return this;var e=this.x-r.x,n=this.y-r.y,i=Math.sin(t),a=Math.cos(t);return this.x=r.x+(e*a-n*i),this.y=r.y+(e*i+n*a),this;}},{key:"clone",value:function clone(){var r=this.x,t=this.y,e=this.z;return new _(r,t,e);}},{key:"sub",value:function sub(r){return this.x-=r.x,this.y-=r.y,this;}},{key:"subXY",value:function subXY(r,t){return this.x-=r,this.y-=t,this;}},{key:"subScalar",value:function subScalar(r){return this.x-=r,this.y-=r,this;}},{key:"add",value:function add(r){return this.x+=r.x,this.y+=r.y,this;}},{key:"addXY",value:function addXY(r,t){return this.x+=r,this.y+=t,this;}},{key:"addScalar",value:function addScalar(r){return this.x+=r,this.y+=r,this;}},{key:"clamp",value:function clamp(r,t){return this.x=Math.max(this.x,r),this.y=Math.max(this.y,r),t!==void 0&&(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)),this;}},{key:"div",value:function div(r){return this.x/=r,this.y/=r,this;}},{key:"divV",value:function divV(r){return this.x/=r.x,this.y/=r.y,this;}},{key:"mul",value:function mul(r){return this.x*=r,this.y*=r,this;}},{key:"mulV",value:function mulV(r){return this.x*=r.x,this.y*=r.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(r,t){var e=_.Tan(r,this);return this.add(e.mul(t));}},{key:"neg",value:function neg(){return this.x*=-1,this.y*=-1,this;}},{key:"cross",value:function cross(r){return this.x=this.y*r.z-this.z*r.y,this.y=this.z*r.x-this.x*r.z,this;}},{key:"dpr",value:function dpr(r){return _.Dpr(this,r);}},{key:"cpr",value:function cpr(r){return _.Cpr(this,r);}},{key:"len2",value:function len2(){return _.Len2(this);}},{key:"len",value:function len(){return _.Len(this);}},{key:"pry",value:function pry(r){return _.Pry(this,r);}},{key:"per",value:function per(){var r=this.x,t=this.y;return this.x=t,this.y=-r,this;}},{key:"uni",value:function uni(){return _.Uni(this);}},{key:"tan",value:function tan(r){return _.Tan(this,r);}},{key:"dist",value:function dist(r){return _.Dist(this,r);}},{key:"distanceToLineSegment",value:function distanceToLineSegment(r,t){return _.DistanceToLineSegment(r,t,this);}},{key:"slope",value:function slope(r){return _.Slope(this,r);}},{key:"snapToGrid",value:function snapToGrid(r){return this.x=Math.round(this.x/r)*r,this.y=Math.round(this.y/r)*r,this;}},{key:"angle",value:function angle(r){return _.Angle(this,r);}},{key:"toAngle",value:function toAngle(){return _.ToAngle(this);}},{key:"lrp",value:function lrp(r,t){return this.x=this.x+(r.x-this.x)*t,this.y=this.y+(r.y-this.y)*t,this;}},{key:"equals",value:function equals(r,t){return _.Equals(this,r,t);}},{key:"equalsXY",value:function equalsXY(r,t){return _.EqualsXY(this,r,t);}},{key:"norm",value:function norm(){var r=this.len();return this.x=r===0?0:this.x/r,this.y=r===0?0:this.y/r,this;}},{key:"toFixed",value:function toFixed(){return _.ToFixed(this);}},{key:"toString",value:function toString(){return _.ToString(_.ToFixed(this));}},{key:"toJson",value:function toJson(){return _.ToJson(this);}},{key:"toArray",value:function toArray(){return _.ToArray(this);}}],[{key:"Add",value:function Add(r,t){return new _(r.x+t.x,r.y+t.y);}},{key:"AddXY",value:function AddXY(r,t,e){return new _(r.x+t,r.y+e);}},{key:"Sub",value:function Sub(r,t){return new _(r.x-t.x,r.y-t.y);}},{key:"SubXY",value:function SubXY(r,t,e){return new _(r.x-t,r.y-e);}},{key:"AddScalar",value:function AddScalar(r,t){return new _(r.x+t,r.y+t);}},{key:"SubScalar",value:function SubScalar(r,t){return new _(r.x-t,r.y-t);}},{key:"Div",value:function Div(r,t){return new _(r.x/t,r.y/t);}},{key:"Mul",value:function Mul(r,t){return new _(r.x*t,r.y*t);}},{key:"DivV",value:function DivV(r,t){return new _(r.x/t.x,r.y/t.y);}},{key:"MulV",value:function MulV(r,t){return new _(r.x*t.x,r.y*t.y);}},{key:"Neg",value:function Neg(r){return new _(-r.x,-r.y);}},{key:"Per",value:function Per(r){return new _(r.y,-r.x);}},{key:"Dist2",value:function Dist2(r,t){return _.Sub(r,t).len2();}},{key:"Abs",value:function Abs(r){return new _(Math.abs(r.x),Math.abs(r.y));}},{key:"Dist",value:function Dist(r,t){return Math.hypot(r.y-t.y,r.x-t.x);}},{key:"Dpr",value:function Dpr(r,t){return r.x*t.x+r.y*t.y;}},{key:"Cross",value:function Cross(r,t){return new _(r.y*t.z-r.z*t.y,r.z*t.x-r.x*t.z// A.z = A.x * V.y - A.y * V.x
2
2
  );}},{key:"Cpr",value:function Cpr(r,t){return r.x*t.y-t.x*r.y;}},{key:"Len2",value:function Len2(r){return r.x*r.x+r.y*r.y;}},{key:"Len",value:function Len(r){return Math.hypot(r.x,r.y);}},{key:"Pry",value:function Pry(r,t){return _.Dpr(r,t)/_.Len(t);}},{key:"Uni",value:function Uni(r){return _.Div(r,_.Len(r));}},{key:"Tan",value:function Tan(r,t){return _.Uni(_.Sub(r,t));}},{key:"Min",value:function Min(r,t){return new _(Math.min(r.x,t.x),Math.min(r.y,t.y));}},{key:"Max",value:function Max(r,t){return new _(Math.max(r.x,t.x),Math.max(r.y,t.y));}},{key:"From",value:function From(r){return new _().add(r);}},{key:"FromArray",value:function FromArray(r){return new _(r[0],r[1]);}},{key:"Rot",value:function Rot(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=Math.sin(t),n=Math.cos(t);return new _(r.x*n-r.y*e,r.x*e+r.y*n);}},{key:"RotWith",value:function RotWith(r,t,e){var n=r.x-t.x,i=r.y-t.y,a=Math.sin(e),o=Math.cos(e);return new _(t.x+(n*o-i*a),t.y+(n*a+i*o));}/**
3
3
  * Get the nearest point on a line with a known unit vector that passes through point A
4
4
  *
@@ -15,7 +15,7 @@ var _excluded=["toolsType"],_excluded2=["callback"],_excluded3=["rect","willUpda
15
15
  * @param A - The first point.
16
16
  * @param B - The second point.
17
17
  * @param steps - The number of points to return.
18
- */},{key:"PointsBetween",value:function PointsBetween(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:6;var n=[];for(var i=0;i<e;i++){var a=ki.easeInQuad(i/(e-1)),o=_.Lrp(r,t,a);o.z=Math.min(1,0.5+Math.abs(0.5-Ji(a))*0.65),n.push(o);}return n;}},{key:"SnapToGrid",value:function SnapToGrid(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;return new _(Math.round(r.x/t)*t,Math.round(r.y/t)*t);}}]);}();var Ji=function Ji(h){return h<0.5?2*h*h:-1+(4-2*h)*h;};var xt=/*#__PURE__*/function(_ref2){function xt(){var _this13;var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{x:0,y:0};var i=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var a=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;_classCallCheck(this,xt);_this13=_callSuper(this,xt,[r,t,e]),_this13.x=r,_this13.y=t,_this13.z=e,_this13.v=n,_this13.t=i,_this13.a=a;return _this13;}_inherits(xt,_ref2);return _createClass(xt,[{key:"timestamp",get:function get(){return this.t;}},{key:"pressure",get:function get(){return this.z;}},{key:"angleNum",get:function get(){return this.a;}},{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setA",value:function setA(r){this.a=r;}},{key:"setT",value:function setT(r){this.t=r;}},{key:"setv",value:function setv(r){return this.v={x:r.x,y:r.y},this;}},{key:"set",value:function set(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this.v;var i=arguments.length>4&&arguments[4]!==undefined?arguments[4]:this.t;var a=arguments.length>5&&arguments[5]!==undefined?arguments[5]:this.a;return this.x=r,this.y=t,this.z=e,this.v=n,this.t=i,this.a=a,this;}},{key:"clone",value:function clone(){var r=this.x,t=this.y,e=this.z,n=this.v,i=this.t,a=this.a,o={x:n.x,y:n.y};return new xt(r,t,e,o,i,a);}},{key:"distance",value:function distance(r){return xt.GetDistance(this,r);}},{key:"isNear",value:function isNear(r,t){return xt.IsNear(this,r,t);}},{key:"getAngleByPoints",value:function getAngleByPoints(r,t){return xt.GetAngleByPoints(r,this,t);}}],[{key:"Sub",value:function Sub(r,t){return new xt(r.x-t.x,r.y-t.y);}},{key:"Add",value:function Add(r,t){return new xt(r.x+t.x,r.y+t.y);}},{key:"GetDistance",value:function GetDistance(r,t){return xt.Len(r.clone().sub(t));}},{key:"GetAngleByPoints",value:function GetAngleByPoints(r,t,e){var n=t.x-r.x,i=e.x-t.x,a=t.y-r.y,o=e.y-t.y;var s=0;var l=Math.sqrt(n*n+a*a),d=Math.sqrt(i*i+o*o);if(l&&d){var c=n*i+a*o;s=Math.acos(c/(l*d)),s=s/Math.PI*180;var p=n*o-a*i;p=p>0?1:-1,s=180+p*s;}return s;}},{key:"IsNear",value:function IsNear(r,t,e){return xt.Len(r.clone().sub(t))<e;}},{key:"RotWith",value:function RotWith(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:2;var i=r.x-t.x,a=r.y-t.y,o=Math.sin(e),s=Math.cos(e),l=Math.pow(10,n),d=Math.floor((t.x+(i*s-a*o))*l)/l,c=Math.floor((t.y+(i*o+a*s))*l)/l;return new xt(d,c);}/**
18
+ */},{key:"PointsBetween",value:function PointsBetween(r,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:6;var n=[];for(var i=0;i<e;i++){var a=Ji.easeInQuad(i/(e-1)),o=_.Lrp(r,t,a);o.z=Math.min(1,0.5+Math.abs(0.5-Zi(a))*0.65),n.push(o);}return n;}},{key:"SnapToGrid",value:function SnapToGrid(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;return new _(Math.round(r.x/t)*t,Math.round(r.y/t)*t);}}]);}();var Zi=function Zi(h){return h<0.5?2*h*h:-1+(4-2*h)*h;};var xt=/*#__PURE__*/function(_ref2){function xt(){var _this13;var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{x:0,y:0};var i=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var a=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;_classCallCheck(this,xt);_this13=_callSuper(this,xt,[r,t,e]),_this13.x=r,_this13.y=t,_this13.z=e,_this13.v=n,_this13.t=i,_this13.a=a;return _this13;}_inherits(xt,_ref2);return _createClass(xt,[{key:"timestamp",get:function get(){return this.t;}},{key:"pressure",get:function get(){return this.z;}},{key:"angleNum",get:function get(){return this.a;}},{key:"XY",get:function get(){return[this.x,this.y];}},{key:"setA",value:function setA(r){this.a=r;}},{key:"setT",value:function setT(r){this.t=r;}},{key:"setv",value:function setv(r){return this.v={x:r.x,y:r.y},this;}},{key:"set",value:function set(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.x;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.y;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.z;var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this.v;var i=arguments.length>4&&arguments[4]!==undefined?arguments[4]:this.t;var a=arguments.length>5&&arguments[5]!==undefined?arguments[5]:this.a;return this.x=r,this.y=t,this.z=e,this.v=n,this.t=i,this.a=a,this;}},{key:"clone",value:function clone(){var r=this.x,t=this.y,e=this.z,n=this.v,i=this.t,a=this.a,o={x:n.x,y:n.y};return new xt(r,t,e,o,i,a);}},{key:"distance",value:function distance(r){return xt.GetDistance(this,r);}},{key:"isNear",value:function isNear(r,t){return xt.IsNear(this,r,t);}},{key:"getAngleByPoints",value:function getAngleByPoints(r,t){return xt.GetAngleByPoints(r,this,t);}}],[{key:"Sub",value:function Sub(r,t){return new xt(r.x-t.x,r.y-t.y);}},{key:"Add",value:function Add(r,t){return new xt(r.x+t.x,r.y+t.y);}},{key:"GetDistance",value:function GetDistance(r,t){return xt.Len(r.clone().sub(t));}},{key:"GetAngleByPoints",value:function GetAngleByPoints(r,t,e){var n=t.x-r.x,i=e.x-t.x,a=t.y-r.y,o=e.y-t.y;var s=0;var l=Math.sqrt(n*n+a*a),d=Math.sqrt(i*i+o*o);if(l&&d){var c=n*i+a*o;s=Math.acos(c/(l*d)),s=s/Math.PI*180;var p=n*o-a*i;p=p>0?1:-1,s=180+p*s;}return s;}},{key:"IsNear",value:function IsNear(r,t,e){return xt.Len(r.clone().sub(t))<e;}},{key:"RotWith",value:function RotWith(r,t,e){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:2;var i=r.x-t.x,a=r.y-t.y,o=Math.sin(e),s=Math.cos(e),l=Math.pow(10,n),d=Math.floor((t.x+(i*s-a*o))*l)/l,c=Math.floor((t.y+(i*o+a*s))*l)/l;return new xt(d,c);}/**
19
19
  * 根据圆心和半径,获取圆上的等份点
20
20
  * @param o 圆心
21
21
  * @param radius 半径
@@ -392,20 +392,20 @@ _inherits(o,_e$default22);return _createClass(o,[{key:"texture",get:function get
392
392
  height
393
393
  mode: 'static', 'scale', 'stickyWidth', 'stickyHeight', 'stickyTop', 'stickyBottom', 'stickyLeft', 'stickyRight'
394
394
  */function M(){var _this57;var A=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,M);if(_this57=_callSuper(this,M),!A.container)if(typeof n.ENV.Container=="function")A.container=new n.ENV.Container(A.width||300,A.height||150);else throw new Error("No container specified.");if(_this57.container=A.container,_this57.container.style&&(_this57.container.style.overflow||(_this57.container.style.overflow="hidden"),_this57.container.style.position||(_this57.container.style.position="relative")),_this57.options=A,A.displayRatio=A.displayRatio||1,A.mode=A.mode||"scale",A.left=0,A.top=0,A.autoResize=A.autoResize!==!1,A.autoResize){var b;if((typeof globalThis==="undefined"?"undefined":_typeof(globalThis))<"u"?b=globalThis:b=(typeof window==="undefined"?"undefined":_typeof(window))<"u"?window:e,b.addEventListener){var O=_this57;b.addEventListener("resize",function L(){(typeof document==="undefined"?"undefined":_typeof(document))<"u"&&document.contains(O.container)?O.resize():b.removeEventListener("resize",L);});}}_this57[P]=/* @__PURE__ */new Set(),_this57.setResolution(A),g(_this57),_this57[m]=0;return _this57;}_inherits(M,_l$default);return _createClass(M,[{key:"hasOffscreenCanvas",get:function get(){return this[m]>0;}},{key:"displayRatio",get:function get(){return this.options.displayRatio;},set:function set(A){this.options.displayRatio!==A&&(this.options.displayRatio=A,this.resize());}},{key:"height",get:function get(){return this.options.height;},set:function set(A){this.options.height!==A&&(this.options.height=A,this.resize());}},{key:"mode",get:function get(){return this.options.mode;},set:function set(A){this.options.mode!==A&&(this.options.mode=A,this.resize());}},{key:"width",get:function get(){return this.options.width;}/* override */,set:function set(A){this.options.width!==A&&(this.options.width=A,this.resize());}},{key:"appendChild",value:function appendChild(A){!(A instanceof o["default"])&&!(A instanceof s["default"])&&x(A);var b=_superPropGet(M,"appendChild",this,3)([A]),O=A.canvas;return A.offscreen?this[m]++:this.container.appendChild(O),u(this.options,O),A.setResolution(this.getResolution()),b;}/* override */},{key:"forceUpdate",value:function forceUpdate(){var _this58=this;this.hasOffscreenCanvas&&!this._requestID&&(this._requestID=Object(i.requestAnimationFrame)(function(){delete _this58._requestID,_this58.render();}));}/* override */},{key:"insertBefore",value:function insertBefore(A,b){!(A instanceof o["default"])&&!(A instanceof s["default"])&&x(A);var O=_superPropGet(M,"insertBefore",this,3)([A,b]),L=A.canvas;if(!A.offscreen){var w=v(this,A);this.container.insertBefore(L,w);}return u(this.options,L),A.setResolution(this.getResolution()),O;}},{key:"layer",value:function layer(){var A=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"default";var b=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};b=Object.assign({},this.options,b),b.id=A;var O=this.orderedChildren;for(var I=0;I<O.length;I++)if(O[I].id===A)return O[I];var L=b.worker;var w;return L?w=new s["default"](b):w=new o["default"](b),this.appendChild(w),w;}},{key:"preload",value:function(){var _preload=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(){var _this59=this;var _len13,A,_key13,b,O,L,_loop2,w,_args21=arguments;return _regeneratorRuntime().wrap(function _callee20$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:for(_len13=_args21.length,A=new Array(_len13),_key13=0;_key13<_len13;_key13++){A[_key13]=_args21[_key13];}b=[],O=[],L=[];_loop2=/*#__PURE__*/_regeneratorRuntime().mark(function _loop2(w){var I,R,W,z;return _regeneratorRuntime().wrap(function _loop2$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:I=A[w];if(typeof I=="string")R=Object(p.loadTexture)(I);else if(Array.isArray(I))R=Object(p.loadFrames).apply(void 0,_toConsumableArray(I));else{W=I.id,z=I.src;R=Object(p.loadTexture)(z,W);}R instanceof Promise||(R=Promise.resolve(R)),O.push(R.then(function(W){b.push(W),L[w]=W;var z=new c["default"]({type:"preload",detail:{current:W,loaded:b,resources:A}});_this59.dispatchEvent(z);}));case 3:case"end":return _context20.stop();}},_loop2);});w=0;case 4:if(!(w<A.length)){_context21.next=9;break;}return _context21.delegateYield(_loop2(w),"t0",6);case 6:w++;_context21.next=4;break;case 9:_context21.next=11;return Promise.all(O);case 11:return _context21.abrupt("return",L);case 12:case"end":return _context21.stop();}},_callee20);}));function preload(){return _preload.apply(this,arguments);}return preload;}()/* override */},{key:"removeChild",value:function removeChild(A){var b=_superPropGet(M,"removeChild",this,3)([A]);if(b){A._prepareRenderFinished&&A._prepareRenderFinished();var O=A.canvas;O&&O.remove&&O.remove(),A.offscreen&&this[m]--;}return b;}// for offscreen mode rendering
395
- },{key:"render",value:function render(){var A=this.orderedChildren;var b=null;var O=[];for(var L=0;L<A.length;L++){var w=A[L],I=O.length>0;if(w instanceof o["default"]&&!w.offscreen){if(!w.autoRender)I&&(console.warn("Some offscreen canvas will not be rendered."),O.length=0);else if(b=w,I){w.renderer.clear();for(var R=0;R<O.length;R++){var W=O[R];W.render(),T(w,W);}O.length=0,w.render({clear:!1});}else w.prepareRender&&w.render();}else w.offscreen?b?(w.prepareRender&&w.render(),T(b,w)):O.push(w):w instanceof s["default"]&&I&&(console.warn("Some offscreen canvas will not be rendered."),O.length=0);}}/* override */},{key:"replaceChild",value:function replaceChild(A,b){var O=_superPropGet(M,"replaceChild",this,3)([A,b]);b.canvas.remove&&b.canvas.remove(),b.offscreen&&this[m]--;var L=A.canvas;if(!A.offscreen){var w=v(this,A);this.container.insertBefore(L,w);}return u(this.options,L),A.setResolution(this.getResolution()),O;}},{key:"resize",value:function resize(){var A=this.options;this.children.forEach(function(b){u(A,b.canvas);}),this.setResolution(A),this.dispatchEvent({type:"resize"});}/* override */},{key:"setResolution",value:function setResolution(){var _A4,_b10;var _ref162=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},A=_ref162.width,b=_ref162.height;var O=this.container,L=O.clientWidth,w=O.clientHeight;(A==null||b==null)&&(A=(_A4=A)!==null&&_A4!==void 0?_A4:L,b=(_b10=b)!==null&&_b10!==void 0?_b10:w);var _this$options=this.options,I=_this$options.mode,R=_this$options.displayRatio;if(A*=R,b*=R,this.options.left=0,this.options.top=0,I==="stickyHeight"||I==="stickyLeft"||I==="stickyRight"){var W=A;A=L*b/w,I==="stickyHeight"&&(this.options.left=0.5*(A-W)),I==="stickyRight"&&(this.options.left=A-W);}else if(I==="stickyWidth"||I==="stickyTop"||I==="stickyBottom"){var _W4=b;b=w*A/L,I==="stickyWidth"&&(this.options.top=0.5*(b-_W4)),I==="stickyBottom"&&(this.options.top=b-_W4);}_superPropGet(M,"setResolution",this,3)([{width:A,height:b}]);}},{key:"snapshot",value:function snapshot(){var _ref163=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref163$offscreen=_ref163.offscreen,A=_ref163$offscreen===void 0?!1:_ref163$offscreen,b=_ref163.layers;var O=A?"snapshotOffScreenCanvas":"snapshotCanvas",_this$getResolution9=this.getResolution(),L=_this$getResolution9.width,w=_this$getResolution9.height;this[O]=this[O]||n.ENV.createCanvas(L,w,{offscreen:A});var I=this[O].getContext("2d");b=b||this.orderedChildren,this[O].width=L,this[O].height=w;for(var R=0;R<b.length;R++){var W=b[R];if(!W.options.ignoreSnapshot){W.render&&W.render();var z=W.canvas;z&&z!==W&&I.drawImage(z,0,0,L,w);}}return this[O];}}]);}(l["default"]);(typeof document==="undefined"?"undefined":_typeof(document))<"u"&&(M.prototype.layer3d=function(E){var _this60=this;var A=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var b=A.url||"https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.min.js";return new Promise(function(O,L){var w=document.createElement("script");w.async=!1,w.src=b,w.onload=function(){try{O(_this60.layer3d(E,A));}catch(I){L(I);}},document.documentElement.appendChild(w);});}),y["default"].registerNode(M,"scene");}.call(this,t(22));},/* 291 *//***/function(h,r,t){t.r(r),t.d(r,"default",function(){return n;});var e=t(214);t(1).glMatrix.setMatrixArrayType(Array);function n(i){var _ref164=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref164$offsetTop=_ref164.offsetTop,a=_ref164$offsetTop===void 0?0:_ref164$offsetTop,_ref164$offsetLeft=_ref164.offsetLeft,o=_ref164$offsetLeft===void 0?0:_ref164$offsetLeft,_ref164$displayRatio=_ref164.displayRatio,s=_ref164$displayRatio===void 0?1:_ref164$displayRatio;var l,d;var c=[],_i$target$getBounding=i.target.getBoundingClientRect(),p=_i$target$getBounding.left,y=_i$target$getBounding.top,P=_i$target$getBounding.width,x=_i$target$getBounding.height,v=i.target.width,T=i.target.height,f=i.changedTouches||[i];for(var u=0;u<f.length;u++){var m=f[u],M=m.identifier,E=m.clientX,A=m.clientY;E!=null&&A!=null&&c.push({x:Math.round((E|0)-p),y:Math.round((A|0)-y),identifier:M});}c.length<=0&&c.push({x:l,y:d});var g=[];return c.forEach(function(u){u.x!=null&&u.y!=null&&(l=(u.x*v/P-o)/s,d=(u.y*T/x-a)/s);var m=new e["default"](i);Object.defineProperties(m,{layerX:{value:l,configurable:!0},layerY:{value:d,configurable:!0},originalX:{value:u.x},originalY:{value:u.y},x:{value:l,configurable:!0},y:{value:d,configurable:!0},identifier:{value:u.identifier}}),g.push(m);}),g;}}/******/]);Wt.version;Wt.Arc;Wt.Block;Wt.Cloud;Wt.Color;var Zi=Wt.Ellipse;Wt.Gradient;var kt=Wt.Group,Qi=Wt.Label,qi=Wt.Layer;Wt.LayerWorker;Wt.Node;Wt.Parallel;var ce=Wt.Path,le=Wt.Polyline,Gr=Wt.Rect;Wt.Regular;Wt.Ring;var _i=Wt.Scene,ts=Wt.Sprite;Wt.SpriteSvg;Wt.Star;Wt.Triangle;Wt.helpers;Wt.createElement;Wt.isSpriteNode;Wt.registerNode;Wt.requestAnimationFrame;Wt.cancelAnimationFrame;Wt.ENV;var Ue=(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 fe(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h["default"]:h;}var es=_typeof(Ue)=="object"&&Ue&&Ue.Object===Object&&Ue,Bn=es,rs=Bn,ns=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self,is=rs||ns||Function("return this")(),ee=is,ss=ee,os=ss.Symbol,Be=os,Hr=Be,Fn=Object.prototype,as=Fn.hasOwnProperty,ls=Fn.toString,Le=Hr?Hr.toStringTag:void 0;function cs(h){var r=as.call(h,Le),t=h[Le];try{h[Le]=void 0;var e=!0;}catch(_unused18){}var n=ls.call(h);return e&&(r?h[Le]=t:delete h[Le]),n;}var fs=cs,hs=Object.prototype,us=hs.toString;function ds(h){return us.call(h);}var gs=ds,Kr=Be,ps=fs,ms=gs,vs="[object Null]",ys="[object Undefined]",Yr=Kr?Kr.toStringTag:void 0;function Ss(h){return h==null?h===void 0?ys:vs:Yr&&Yr in Object(h)?ps(h):ms(h);}var de=Ss;function xs(h){return h!=null&&_typeof(h)=="object";}var ne=xs,Ts=de,Ms=ne,Ps="[object Number]";function Os(h){return typeof h=="number"||Ms(h)&&Ts(h)==Ps;}var Es=Os,_t=/* @__PURE__ */fe(Es);function Cs(){this.__data__=[],this.size=0;}var As=Cs;function Rs(h,r){return h===r||h!==h&&r!==r;}var Tr=Rs,Is=Tr;function Ls(h,r){for(var t=h.length;t--;)if(Is(h[t][0],r))return t;return-1;}var tr=Ls,bs=tr,ws=Array.prototype,Ds=ws.splice;function Ns(h){var r=this.__data__,t=bs(r,h);if(t<0)return!1;var e=r.length-1;return t==e?r.pop():Ds.call(r,t,1),--this.size,!0;}var Ws=Ns,Bs=tr;function Fs(h){var r=this.__data__,t=Bs(r,h);return t<0?void 0:r[t][1];}var Us=Fs,js=tr;function $s(h){return js(this.__data__,h)>-1;}var zs=$s,Gs=tr;function Hs(h,r){var t=this.__data__,e=Gs(t,h);return e<0?(++this.size,t.push([h,r])):t[e][1]=r,this;}var Ks=Hs,Ys=As,Vs=Ws,Xs=Us,ks=zs,Js=Ks;function Pe(h){var r=-1,t=h==null?0:h.length;for(this.clear();++r<t;){var e=h[r];this.set(e[0],e[1]);}}Pe.prototype.clear=Ys;Pe.prototype["delete"]=Vs;Pe.prototype.get=Xs;Pe.prototype.has=ks;Pe.prototype.set=Js;var er=Pe,Zs=er;function Qs(){this.__data__=new Zs(),this.size=0;}var qs=Qs;function _s(h){var r=this.__data__,t=r["delete"](h);return this.size=r.size,t;}var to=_s;function eo(h){return this.__data__.get(h);}var ro=eo;function no(h){return this.__data__.has(h);}var io=no;function so(h){var r=_typeof(h);return h!=null&&(r=="object"||r=="function");}var he=so,oo=de,ao=he,lo="[object AsyncFunction]",co="[object Function]",fo="[object GeneratorFunction]",ho="[object Proxy]";function uo(h){if(!ao(h))return!1;var r=oo(h);return r==co||r==fo||r==lo||r==ho;}var Un=uo,go=ee,po=go["__core-js_shared__"],mo=po,ar=mo,Vr=function(){var h=/[^.]+$/.exec(ar&&ar.keys&&ar.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:"";}();function vo(h){return!!Vr&&Vr in h;}var yo=vo,So=Function.prototype,xo=So.toString;function To(h){if(h!=null){try{return xo.call(h);}catch(_unused19){}try{return h+"";}catch(_unused20){}}return"";}var jn=To,Mo=Un,Po=yo,Oo=he,Eo=jn,Co=/[\\^$.*+?()[\]{}|]/g,Ao=/^\[object .+?Constructor\]$/,Ro=Function.prototype,Io=Object.prototype,Lo=Ro.toString,bo=Io.hasOwnProperty,wo=RegExp("^"+Lo.call(bo).replace(Co,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Do(h){if(!Oo(h)||Po(h))return!1;var r=Mo(h)?wo:Ao;return r.test(Eo(h));}var No=Do;function Wo(h,r){return h==null?void 0:h[r];}var Bo=Wo,Fo=No,Uo=Bo;function jo(h,r){var t=Uo(h,r);return Fo(t)?t:void 0;}var ge=jo,$o=ge,zo=ee,Go=$o(zo,"Map"),Mr=Go,Ho=ge,Ko=Ho(Object,"create"),rr=Ko,Xr=rr;function Yo(){this.__data__=Xr?Xr(null):{},this.size=0;}var Vo=Yo;function Xo(h){var r=this.has(h)&&delete this.__data__[h];return this.size-=r?1:0,r;}var ko=Xo,Jo=rr,Zo="__lodash_hash_undefined__",Qo=Object.prototype,qo=Qo.hasOwnProperty;function _o(h){var r=this.__data__;if(Jo){var t=r[h];return t===Zo?void 0:t;}return qo.call(r,h)?r[h]:void 0;}var ta=_o,ea=rr,ra=Object.prototype,na=ra.hasOwnProperty;function ia(h){var r=this.__data__;return ea?r[h]!==void 0:na.call(r,h);}var sa=ia,oa=rr,aa="__lodash_hash_undefined__";function la(h,r){var t=this.__data__;return this.size+=this.has(h)?0:1,t[h]=oa&&r===void 0?aa:r,this;}var ca=la,fa=Vo,ha=ko,ua=ta,da=sa,ga=ca;function Oe(h){var r=-1,t=h==null?0:h.length;for(this.clear();++r<t;){var e=h[r];this.set(e[0],e[1]);}}Oe.prototype.clear=fa;Oe.prototype["delete"]=ha;Oe.prototype.get=ua;Oe.prototype.has=da;Oe.prototype.set=ga;var pa=Oe,kr=pa,ma=er,va=Mr;function ya(){this.size=0,this.__data__={hash:new kr(),map:new(va||ma)(),string:new kr()};}var Sa=ya;function xa(h){var r=_typeof(h);return r=="string"||r=="number"||r=="symbol"||r=="boolean"?h!=="__proto__":h===null;}var Ta=xa,Ma=Ta;function Pa(h,r){var t=h.__data__;return Ma(r)?t[typeof r=="string"?"string":"hash"]:t.map;}var nr=Pa,Oa=nr;function Ea(h){var r=Oa(this,h)["delete"](h);return this.size-=r?1:0,r;}var Ca=Ea,Aa=nr;function Ra(h){return Aa(this,h).get(h);}var Ia=Ra,La=nr;function ba(h){return La(this,h).has(h);}var wa=ba,Da=nr;function Na(h,r){var t=Da(this,h),e=t.size;return t.set(h,r),this.size+=t.size==e?0:1,this;}var Wa=Na,Ba=Sa,Fa=Ca,Ua=Ia,ja=wa,$a=Wa;function Ee(h){var r=-1,t=h==null?0:h.length;for(this.clear();++r<t;){var e=h[r];this.set(e[0],e[1]);}}Ee.prototype.clear=Ba;Ee.prototype["delete"]=Fa;Ee.prototype.get=Ua;Ee.prototype.has=ja;Ee.prototype.set=$a;var $n=Ee,za=er,Ga=Mr,Ha=$n,Ka=200;function Ya(h,r){var t=this.__data__;if(t instanceof za){var e=t.__data__;if(!Ga||e.length<Ka-1)return e.push([h,r]),this.size=++t.size,this;t=this.__data__=new Ha(e);}return t.set(h,r),this.size=t.size,this;}var Va=Ya,Xa=er,ka=qs,Ja=to,Za=ro,Qa=io,qa=Va;function Ce(h){var r=this.__data__=new Xa(h);this.size=r.size;}Ce.prototype.clear=ka;Ce.prototype["delete"]=Ja;Ce.prototype.get=Za;Ce.prototype.has=Qa;Ce.prototype.set=qa;var zn=Ce;function _a(h,r){for(var t=-1,e=h==null?0:h.length;++t<e&&r(h[t],t,h)!==!1;);return h;}var tl=_a,el=ge,rl=function(){try{var h=el(Object,"defineProperty");return h({},"",{}),h;}catch(_unused21){}}(),Gn=rl,Jr=Gn;function nl(h,r,t){r=="__proto__"&&Jr?Jr(h,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):h[r]=t;}var Hn=nl,il=Hn,sl=Tr,ol=Object.prototype,al=ol.hasOwnProperty;function ll(h,r,t){var e=h[r];(!(al.call(h,r)&&sl(e,t))||t===void 0&&!(r in h))&&il(h,r,t);}var Kn=ll,cl=Kn,fl=Hn;function hl(h,r,t,e){var n=!t;t||(t={});for(var i=-1,a=r.length;++i<a;){var o=r[i],s=e?e(t[o],h[o],o,t,h):void 0;s===void 0&&(s=h[o]),n?fl(t,o,s):cl(t,o,s);}return t;}var ir=hl;function ul(h,r){for(var t=-1,e=Array(h);++t<h;)e[t]=r(t);return e;}var dl=ul,gl=de,pl=ne,ml="[object Arguments]";function vl(h){return pl(h)&&gl(h)==ml;}var yl=vl,Zr=yl,Sl=ne,Yn=Object.prototype,xl=Yn.hasOwnProperty,Tl=Yn.propertyIsEnumerable,Ml=Zr(/* @__PURE__ */function(){return arguments;}())?Zr:function(h){return Sl(h)&&xl.call(h,"callee")&&!Tl.call(h,"callee");},Vn=Ml,Pl=Array.isArray,Fe=Pl,ze={exports:{}};function Ol(){return!1;}var El=Ol;ze.exports;(function(h,r){var t=ee,e=El,n=r&&!r.nodeType&&r,i=n&&!0&&h&&!h.nodeType&&h,a=i&&i.exports===n,o=a?t.Buffer:void 0,s=o?o.isBuffer:void 0,l=s||e;h.exports=l;})(ze,ze.exports);var Pr=ze.exports,Cl=9007199254740991,Al=/^(?:0|[1-9]\d*)$/;function Rl(h,r){var _r2;var t=_typeof(h);return r=(_r2=r)!==null&&_r2!==void 0?_r2:Cl,!!r&&(t=="number"||t!="symbol"&&Al.test(h))&&h>-1&&h%1==0&&h<r;}var Il=Rl,Ll=9007199254740991;function bl(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=Ll;}var Xn=bl,wl=de,Dl=Xn,Nl=ne,Wl="[object Arguments]",Bl="[object Array]",Fl="[object Boolean]",Ul="[object Date]",jl="[object Error]",$l="[object Function]",zl="[object Map]",Gl="[object Number]",Hl="[object Object]",Kl="[object RegExp]",Yl="[object Set]",Vl="[object String]",Xl="[object WeakMap]",kl="[object ArrayBuffer]",Jl="[object DataView]",Zl="[object Float32Array]",Ql="[object Float64Array]",ql="[object Int8Array]",_l="[object Int16Array]",tc="[object Int32Array]",ec="[object Uint8Array]",rc="[object Uint8ClampedArray]",nc="[object Uint16Array]",ic="[object Uint32Array]",Ut={};Ut[Zl]=Ut[Ql]=Ut[ql]=Ut[_l]=Ut[tc]=Ut[ec]=Ut[rc]=Ut[nc]=Ut[ic]=!0;Ut[Wl]=Ut[Bl]=Ut[kl]=Ut[Fl]=Ut[Jl]=Ut[Ul]=Ut[jl]=Ut[$l]=Ut[zl]=Ut[Gl]=Ut[Hl]=Ut[Kl]=Ut[Yl]=Ut[Vl]=Ut[Xl]=!1;function sc(h){return Nl(h)&&Dl(h.length)&&!!Ut[wl(h)];}var oc=sc;function ac(h){return function(r){return h(r);};}var sr=ac,Ge={exports:{}};Ge.exports;(function(h,r){var t=Bn,e=r&&!r.nodeType&&r,n=e&&!0&&h&&!h.nodeType&&h,i=n&&n.exports===e,a=i&&t.process,o=function(){try{var s=n&&n.require&&n.require("util").types;return s||a&&a.binding&&a.binding("util");}catch(_unused22){}}();h.exports=o;})(Ge,Ge.exports);var Or=Ge.exports,lc=oc,cc=sr,Qr=Or,qr=Qr&&Qr.isTypedArray,fc=qr?cc(qr):lc,kn=fc,hc=dl,uc=Vn,dc=Fe,gc=Pr,pc=Il,mc=kn,vc=Object.prototype,yc=vc.hasOwnProperty;function Sc(h,r){var t=dc(h),e=!t&&uc(h),n=!t&&!e&&gc(h),i=!t&&!e&&!n&&mc(h),a=t||e||n||i,o=a?hc(h.length,String):[],s=o.length;for(var l in h)(r||yc.call(h,l))&&!(a&&(// Safari 9 has enumerable `arguments.length` in strict mode.
395
+ },{key:"render",value:function render(){var A=this.orderedChildren;var b=null;var O=[];for(var L=0;L<A.length;L++){var w=A[L],I=O.length>0;if(w instanceof o["default"]&&!w.offscreen){if(!w.autoRender)I&&(console.warn("Some offscreen canvas will not be rendered."),O.length=0);else if(b=w,I){w.renderer.clear();for(var R=0;R<O.length;R++){var W=O[R];W.render(),T(w,W);}O.length=0,w.render({clear:!1});}else w.prepareRender&&w.render();}else w.offscreen?b?(w.prepareRender&&w.render(),T(b,w)):O.push(w):w instanceof s["default"]&&I&&(console.warn("Some offscreen canvas will not be rendered."),O.length=0);}}/* override */},{key:"replaceChild",value:function replaceChild(A,b){var O=_superPropGet(M,"replaceChild",this,3)([A,b]);b.canvas.remove&&b.canvas.remove(),b.offscreen&&this[m]--;var L=A.canvas;if(!A.offscreen){var w=v(this,A);this.container.insertBefore(L,w);}return u(this.options,L),A.setResolution(this.getResolution()),O;}},{key:"resize",value:function resize(){var A=this.options;this.children.forEach(function(b){u(A,b.canvas);}),this.setResolution(A),this.dispatchEvent({type:"resize"});}/* override */},{key:"setResolution",value:function setResolution(){var _A4,_b10;var _ref162=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},A=_ref162.width,b=_ref162.height;var O=this.container,L=O.clientWidth,w=O.clientHeight;(A==null||b==null)&&(A=(_A4=A)!==null&&_A4!==void 0?_A4:L,b=(_b10=b)!==null&&_b10!==void 0?_b10:w);var _this$options=this.options,I=_this$options.mode,R=_this$options.displayRatio;if(A*=R,b*=R,this.options.left=0,this.options.top=0,I==="stickyHeight"||I==="stickyLeft"||I==="stickyRight"){var W=A;A=L*b/w,I==="stickyHeight"&&(this.options.left=0.5*(A-W)),I==="stickyRight"&&(this.options.left=A-W);}else if(I==="stickyWidth"||I==="stickyTop"||I==="stickyBottom"){var _W4=b;b=w*A/L,I==="stickyWidth"&&(this.options.top=0.5*(b-_W4)),I==="stickyBottom"&&(this.options.top=b-_W4);}_superPropGet(M,"setResolution",this,3)([{width:A,height:b}]);}},{key:"snapshot",value:function snapshot(){var _ref163=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref163$offscreen=_ref163.offscreen,A=_ref163$offscreen===void 0?!1:_ref163$offscreen,b=_ref163.layers;var O=A?"snapshotOffScreenCanvas":"snapshotCanvas",_this$getResolution9=this.getResolution(),L=_this$getResolution9.width,w=_this$getResolution9.height;this[O]=this[O]||n.ENV.createCanvas(L,w,{offscreen:A});var I=this[O].getContext("2d");b=b||this.orderedChildren,this[O].width=L,this[O].height=w;for(var R=0;R<b.length;R++){var W=b[R];if(!W.options.ignoreSnapshot){W.render&&W.render();var z=W.canvas;z&&z!==W&&I.drawImage(z,0,0,L,w);}}return this[O];}}]);}(l["default"]);(typeof document==="undefined"?"undefined":_typeof(document))<"u"&&(M.prototype.layer3d=function(E){var _this60=this;var A=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var b=A.url||"https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.min.js";return new Promise(function(O,L){var w=document.createElement("script");w.async=!1,w.src=b,w.onload=function(){try{O(_this60.layer3d(E,A));}catch(I){L(I);}},document.documentElement.appendChild(w);});}),y["default"].registerNode(M,"scene");}.call(this,t(22));},/* 291 *//***/function(h,r,t){t.r(r),t.d(r,"default",function(){return n;});var e=t(214);t(1).glMatrix.setMatrixArrayType(Array);function n(i){var _ref164=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref164$offsetTop=_ref164.offsetTop,a=_ref164$offsetTop===void 0?0:_ref164$offsetTop,_ref164$offsetLeft=_ref164.offsetLeft,o=_ref164$offsetLeft===void 0?0:_ref164$offsetLeft,_ref164$displayRatio=_ref164.displayRatio,s=_ref164$displayRatio===void 0?1:_ref164$displayRatio;var l,d;var c=[],_i$target$getBounding=i.target.getBoundingClientRect(),p=_i$target$getBounding.left,y=_i$target$getBounding.top,P=_i$target$getBounding.width,x=_i$target$getBounding.height,v=i.target.width,T=i.target.height,f=i.changedTouches||[i];for(var u=0;u<f.length;u++){var m=f[u],M=m.identifier,E=m.clientX,A=m.clientY;E!=null&&A!=null&&c.push({x:Math.round((E|0)-p),y:Math.round((A|0)-y),identifier:M});}c.length<=0&&c.push({x:l,y:d});var g=[];return c.forEach(function(u){u.x!=null&&u.y!=null&&(l=(u.x*v/P-o)/s,d=(u.y*T/x-a)/s);var m=new e["default"](i);Object.defineProperties(m,{layerX:{value:l,configurable:!0},layerY:{value:d,configurable:!0},originalX:{value:u.x},originalY:{value:u.y},x:{value:l,configurable:!0},y:{value:d,configurable:!0},identifier:{value:u.identifier}}),g.push(m);}),g;}}/******/]);Wt.version;Wt.Arc;Wt.Block;Wt.Cloud;Wt.Color;var Qi=Wt.Ellipse;Wt.Gradient;var kt=Wt.Group,qi=Wt.Label,_i=Wt.Layer;Wt.LayerWorker;Wt.Node;Wt.Parallel;var ce=Wt.Path,le=Wt.Polyline,Gr=Wt.Rect;Wt.Regular;Wt.Ring;var ts=Wt.Scene,es=Wt.Sprite;Wt.SpriteSvg;Wt.Star;Wt.Triangle;Wt.helpers;Wt.createElement;Wt.isSpriteNode;Wt.registerNode;Wt.requestAnimationFrame;Wt.cancelAnimationFrame;Wt.ENV;var Ue=(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 fe(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h["default"]:h;}var rs=_typeof(Ue)=="object"&&Ue&&Ue.Object===Object&&Ue,Bn=rs,ns=Bn,is=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self,ss=ns||is||Function("return this")(),ee=ss,os=ee,as=os.Symbol,Be=as,Hr=Be,Fn=Object.prototype,ls=Fn.hasOwnProperty,cs=Fn.toString,Le=Hr?Hr.toStringTag:void 0;function fs(h){var r=ls.call(h,Le),t=h[Le];try{h[Le]=void 0;var e=!0;}catch(_unused18){}var n=cs.call(h);return e&&(r?h[Le]=t:delete h[Le]),n;}var hs=fs,us=Object.prototype,ds=us.toString;function gs(h){return ds.call(h);}var ps=gs,Kr=Be,ms=hs,vs=ps,ys="[object Null]",Ss="[object Undefined]",Yr=Kr?Kr.toStringTag:void 0;function xs(h){return h==null?h===void 0?Ss:ys:Yr&&Yr in Object(h)?ms(h):vs(h);}var de=xs;function Ts(h){return h!=null&&_typeof(h)=="object";}var ne=Ts,Ms=de,Ps=ne,Os="[object Number]";function Es(h){return typeof h=="number"||Ps(h)&&Ms(h)==Os;}var Cs=Es,_t=/* @__PURE__ */fe(Cs);function As(){this.__data__=[],this.size=0;}var Rs=As;function Is(h,r){return h===r||h!==h&&r!==r;}var Tr=Is,Ls=Tr;function bs(h,r){for(var t=h.length;t--;)if(Ls(h[t][0],r))return t;return-1;}var tr=bs,ws=tr,Ds=Array.prototype,Ns=Ds.splice;function Ws(h){var r=this.__data__,t=ws(r,h);if(t<0)return!1;var e=r.length-1;return t==e?r.pop():Ns.call(r,t,1),--this.size,!0;}var Bs=Ws,Fs=tr;function Us(h){var r=this.__data__,t=Fs(r,h);return t<0?void 0:r[t][1];}var js=Us,$s=tr;function zs(h){return $s(this.__data__,h)>-1;}var Gs=zs,Hs=tr;function Ks(h,r){var t=this.__data__,e=Hs(t,h);return e<0?(++this.size,t.push([h,r])):t[e][1]=r,this;}var Ys=Ks,Vs=Rs,Xs=Bs,ks=js,Js=Gs,Zs=Ys;function Pe(h){var r=-1,t=h==null?0:h.length;for(this.clear();++r<t;){var e=h[r];this.set(e[0],e[1]);}}Pe.prototype.clear=Vs;Pe.prototype["delete"]=Xs;Pe.prototype.get=ks;Pe.prototype.has=Js;Pe.prototype.set=Zs;var er=Pe,Qs=er;function qs(){this.__data__=new Qs(),this.size=0;}var _s=qs;function to(h){var r=this.__data__,t=r["delete"](h);return this.size=r.size,t;}var eo=to;function ro(h){return this.__data__.get(h);}var no=ro;function io(h){return this.__data__.has(h);}var so=io;function oo(h){var r=_typeof(h);return h!=null&&(r=="object"||r=="function");}var he=oo,ao=de,lo=he,co="[object AsyncFunction]",fo="[object Function]",ho="[object GeneratorFunction]",uo="[object Proxy]";function go(h){if(!lo(h))return!1;var r=ao(h);return r==fo||r==ho||r==co||r==uo;}var Un=go,po=ee,mo=po["__core-js_shared__"],vo=mo,ar=vo,Vr=function(){var h=/[^.]+$/.exec(ar&&ar.keys&&ar.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:"";}();function yo(h){return!!Vr&&Vr in h;}var So=yo,xo=Function.prototype,To=xo.toString;function Mo(h){if(h!=null){try{return To.call(h);}catch(_unused19){}try{return h+"";}catch(_unused20){}}return"";}var jn=Mo,Po=Un,Oo=So,Eo=he,Co=jn,Ao=/[\\^$.*+?()[\]{}|]/g,Ro=/^\[object .+?Constructor\]$/,Io=Function.prototype,Lo=Object.prototype,bo=Io.toString,wo=Lo.hasOwnProperty,Do=RegExp("^"+bo.call(wo).replace(Ao,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function No(h){if(!Eo(h)||Oo(h))return!1;var r=Po(h)?Do:Ro;return r.test(Co(h));}var Wo=No;function Bo(h,r){return h==null?void 0:h[r];}var Fo=Bo,Uo=Wo,jo=Fo;function $o(h,r){var t=jo(h,r);return Uo(t)?t:void 0;}var ge=$o,zo=ge,Go=ee,Ho=zo(Go,"Map"),Mr=Ho,Ko=ge,Yo=Ko(Object,"create"),rr=Yo,Xr=rr;function Vo(){this.__data__=Xr?Xr(null):{},this.size=0;}var Xo=Vo;function ko(h){var r=this.has(h)&&delete this.__data__[h];return this.size-=r?1:0,r;}var Jo=ko,Zo=rr,Qo="__lodash_hash_undefined__",qo=Object.prototype,_o=qo.hasOwnProperty;function ta(h){var r=this.__data__;if(Zo){var t=r[h];return t===Qo?void 0:t;}return _o.call(r,h)?r[h]:void 0;}var ea=ta,ra=rr,na=Object.prototype,ia=na.hasOwnProperty;function sa(h){var r=this.__data__;return ra?r[h]!==void 0:ia.call(r,h);}var oa=sa,aa=rr,la="__lodash_hash_undefined__";function ca(h,r){var t=this.__data__;return this.size+=this.has(h)?0:1,t[h]=aa&&r===void 0?la:r,this;}var fa=ca,ha=Xo,ua=Jo,da=ea,ga=oa,pa=fa;function Oe(h){var r=-1,t=h==null?0:h.length;for(this.clear();++r<t;){var e=h[r];this.set(e[0],e[1]);}}Oe.prototype.clear=ha;Oe.prototype["delete"]=ua;Oe.prototype.get=da;Oe.prototype.has=ga;Oe.prototype.set=pa;var ma=Oe,kr=ma,va=er,ya=Mr;function Sa(){this.size=0,this.__data__={hash:new kr(),map:new(ya||va)(),string:new kr()};}var xa=Sa;function Ta(h){var r=_typeof(h);return r=="string"||r=="number"||r=="symbol"||r=="boolean"?h!=="__proto__":h===null;}var Ma=Ta,Pa=Ma;function Oa(h,r){var t=h.__data__;return Pa(r)?t[typeof r=="string"?"string":"hash"]:t.map;}var nr=Oa,Ea=nr;function Ca(h){var r=Ea(this,h)["delete"](h);return this.size-=r?1:0,r;}var Aa=Ca,Ra=nr;function Ia(h){return Ra(this,h).get(h);}var La=Ia,ba=nr;function wa(h){return ba(this,h).has(h);}var Da=wa,Na=nr;function Wa(h,r){var t=Na(this,h),e=t.size;return t.set(h,r),this.size+=t.size==e?0:1,this;}var Ba=Wa,Fa=xa,Ua=Aa,ja=La,$a=Da,za=Ba;function Ee(h){var r=-1,t=h==null?0:h.length;for(this.clear();++r<t;){var e=h[r];this.set(e[0],e[1]);}}Ee.prototype.clear=Fa;Ee.prototype["delete"]=Ua;Ee.prototype.get=ja;Ee.prototype.has=$a;Ee.prototype.set=za;var $n=Ee,Ga=er,Ha=Mr,Ka=$n,Ya=200;function Va(h,r){var t=this.__data__;if(t instanceof Ga){var e=t.__data__;if(!Ha||e.length<Ya-1)return e.push([h,r]),this.size=++t.size,this;t=this.__data__=new Ka(e);}return t.set(h,r),this.size=t.size,this;}var Xa=Va,ka=er,Ja=_s,Za=eo,Qa=no,qa=so,_a=Xa;function Ce(h){var r=this.__data__=new ka(h);this.size=r.size;}Ce.prototype.clear=Ja;Ce.prototype["delete"]=Za;Ce.prototype.get=Qa;Ce.prototype.has=qa;Ce.prototype.set=_a;var zn=Ce;function tl(h,r){for(var t=-1,e=h==null?0:h.length;++t<e&&r(h[t],t,h)!==!1;);return h;}var el=tl,rl=ge,nl=function(){try{var h=rl(Object,"defineProperty");return h({},"",{}),h;}catch(_unused21){}}(),Gn=nl,Jr=Gn;function il(h,r,t){r=="__proto__"&&Jr?Jr(h,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):h[r]=t;}var Hn=il,sl=Hn,ol=Tr,al=Object.prototype,ll=al.hasOwnProperty;function cl(h,r,t){var e=h[r];(!(ll.call(h,r)&&ol(e,t))||t===void 0&&!(r in h))&&sl(h,r,t);}var Kn=cl,fl=Kn,hl=Hn;function ul(h,r,t,e){var n=!t;t||(t={});for(var i=-1,a=r.length;++i<a;){var o=r[i],s=e?e(t[o],h[o],o,t,h):void 0;s===void 0&&(s=h[o]),n?hl(t,o,s):fl(t,o,s);}return t;}var ir=ul;function dl(h,r){for(var t=-1,e=Array(h);++t<h;)e[t]=r(t);return e;}var gl=dl,pl=de,ml=ne,vl="[object Arguments]";function yl(h){return ml(h)&&pl(h)==vl;}var Sl=yl,Zr=Sl,xl=ne,Yn=Object.prototype,Tl=Yn.hasOwnProperty,Ml=Yn.propertyIsEnumerable,Pl=Zr(/* @__PURE__ */function(){return arguments;}())?Zr:function(h){return xl(h)&&Tl.call(h,"callee")&&!Ml.call(h,"callee");},Vn=Pl,Ol=Array.isArray,Fe=Ol,ze={exports:{}};function El(){return!1;}var Cl=El;ze.exports;(function(h,r){var t=ee,e=Cl,n=r&&!r.nodeType&&r,i=n&&!0&&h&&!h.nodeType&&h,a=i&&i.exports===n,o=a?t.Buffer:void 0,s=o?o.isBuffer:void 0,l=s||e;h.exports=l;})(ze,ze.exports);var Pr=ze.exports,Al=9007199254740991,Rl=/^(?:0|[1-9]\d*)$/;function Il(h,r){var _r2;var t=_typeof(h);return r=(_r2=r)!==null&&_r2!==void 0?_r2:Al,!!r&&(t=="number"||t!="symbol"&&Rl.test(h))&&h>-1&&h%1==0&&h<r;}var Ll=Il,bl=9007199254740991;function wl(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=bl;}var Xn=wl,Dl=de,Nl=Xn,Wl=ne,Bl="[object Arguments]",Fl="[object Array]",Ul="[object Boolean]",jl="[object Date]",$l="[object Error]",zl="[object Function]",Gl="[object Map]",Hl="[object Number]",Kl="[object Object]",Yl="[object RegExp]",Vl="[object Set]",Xl="[object String]",kl="[object WeakMap]",Jl="[object ArrayBuffer]",Zl="[object DataView]",Ql="[object Float32Array]",ql="[object Float64Array]",_l="[object Int8Array]",tc="[object Int16Array]",ec="[object Int32Array]",rc="[object Uint8Array]",nc="[object Uint8ClampedArray]",ic="[object Uint16Array]",sc="[object Uint32Array]",Ut={};Ut[Ql]=Ut[ql]=Ut[_l]=Ut[tc]=Ut[ec]=Ut[rc]=Ut[nc]=Ut[ic]=Ut[sc]=!0;Ut[Bl]=Ut[Fl]=Ut[Jl]=Ut[Ul]=Ut[Zl]=Ut[jl]=Ut[$l]=Ut[zl]=Ut[Gl]=Ut[Hl]=Ut[Kl]=Ut[Yl]=Ut[Vl]=Ut[Xl]=Ut[kl]=!1;function oc(h){return Wl(h)&&Nl(h.length)&&!!Ut[Dl(h)];}var ac=oc;function lc(h){return function(r){return h(r);};}var sr=lc,Ge={exports:{}};Ge.exports;(function(h,r){var t=Bn,e=r&&!r.nodeType&&r,n=e&&!0&&h&&!h.nodeType&&h,i=n&&n.exports===e,a=i&&t.process,o=function(){try{var s=n&&n.require&&n.require("util").types;return s||a&&a.binding&&a.binding("util");}catch(_unused22){}}();h.exports=o;})(Ge,Ge.exports);var Or=Ge.exports,cc=ac,fc=sr,Qr=Or,qr=Qr&&Qr.isTypedArray,hc=qr?fc(qr):cc,kn=hc,uc=gl,dc=Vn,gc=Fe,pc=Pr,mc=Ll,vc=kn,yc=Object.prototype,Sc=yc.hasOwnProperty;function xc(h,r){var t=gc(h),e=!t&&dc(h),n=!t&&!e&&pc(h),i=!t&&!e&&!n&&vc(h),a=t||e||n||i,o=a?uc(h.length,String):[],s=o.length;for(var l in h)(r||Sc.call(h,l))&&!(a&&(// Safari 9 has enumerable `arguments.length` in strict mode.
396
396
  l=="length"||// Node.js 0.10 has enumerable non-index properties on buffers.
397
397
  n&&(l=="offset"||l=="parent")||// PhantomJS 2 has enumerable non-index properties on typed arrays.
398
398
  i&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||// Skip index properties.
399
- pc(l,s)))&&o.push(l);return o;}var Jn=Sc,xc=Object.prototype;function Tc(h){var r=h&&h.constructor,t=typeof r=="function"&&r.prototype||xc;return h===t;}var Er=Tc;function Mc(h,r){return function(t){return h(r(t));};}var Zn=Mc,Pc=Zn,Oc=Pc(Object.keys,Object),Ec=Oc,Cc=Er,Ac=Ec,Rc=Object.prototype,Ic=Rc.hasOwnProperty;function Lc(h){if(!Cc(h))return Ac(h);var r=[];for(var t in Object(h))Ic.call(h,t)&&t!="constructor"&&r.push(t);return r;}var bc=Lc,wc=Un,Dc=Xn;function Nc(h){return h!=null&&Dc(h.length)&&!wc(h);}var Cr=Nc,Wc=Jn,Bc=bc,Fc=Cr;function Uc(h){return Fc(h)?Wc(h):Bc(h);}var Ar=Uc,jc=ir,$c=Ar;function zc(h,r){return h&&jc(r,$c(r),h);}var Gc=zc;function Hc(h){var r=[];if(h!=null)for(var t in Object(h))r.push(t);return r;}var Kc=Hc,Yc=he,Vc=Er,Xc=Kc,kc=Object.prototype,Jc=kc.hasOwnProperty;function Zc(h){if(!Yc(h))return Xc(h);var r=Vc(h),t=[];for(var e in h)e=="constructor"&&(r||!Jc.call(h,e))||t.push(e);return t;}var Qc=Zc,qc=Jn,_c=Qc,tf=Cr;function ef(h){return tf(h)?qc(h,!0):_c(h);}var Rr=ef,rf=ir,nf=Rr;function sf(h,r){return h&&rf(r,nf(r),h);}var of=sf,He={exports:{}};He.exports;(function(h,r){var t=ee,e=r&&!r.nodeType&&r,n=e&&!0&&h&&!h.nodeType&&h,i=n&&n.exports===e,a=i?t.Buffer:void 0,o=a?a.allocUnsafe:void 0;function s(l,d){if(d)return l.slice();var c=l.length,p=o?o(c):new l.constructor(c);return l.copy(p),p;}h.exports=s;})(He,He.exports);var af=He.exports;function lf(h,r){var t=-1,e=h.length;for(r||(r=Array(e));++t<e;)r[t]=h[t];return r;}var cf=lf;function ff(h,r){for(var t=-1,e=h==null?0:h.length,n=0,i=[];++t<e;){var a=h[t];r(a,t,h)&&(i[n++]=a);}return i;}var Qn=ff;function hf(){return[];}var qn=hf,uf=Qn,df=qn,gf=Object.prototype,pf=gf.propertyIsEnumerable,_r=Object.getOwnPropertySymbols,mf=_r?function(h){return h==null?[]:(h=Object(h),uf(_r(h),function(r){return pf.call(h,r);}));}:df,Ir=mf,vf=ir,yf=Ir;function Sf(h,r){return vf(h,yf(h),r);}var xf=Sf;function Tf(h,r){for(var t=-1,e=r.length,n=h.length;++t<e;)h[n+t]=r[t];return h;}var Lr=Tf,Mf=Zn,Pf=Mf(Object.getPrototypeOf,Object),_n=Pf,Of=Lr,Ef=_n,Cf=Ir,Af=qn,Rf=Object.getOwnPropertySymbols,If=Rf?function(h){for(var r=[];h;)Of(r,Cf(h)),h=Ef(h);return r;}:Af,ti=If,Lf=ir,bf=ti;function wf(h,r){return Lf(h,bf(h),r);}var Df=wf,Nf=Lr,Wf=Fe;function Bf(h,r,t){var e=r(h);return Wf(h)?e:Nf(e,t(h));}var ei=Bf,Ff=ei,Uf=Ir,jf=Ar;function $f(h){return Ff(h,jf,Uf);}var ri=$f,zf=ei,Gf=ti,Hf=Rr;function Kf(h){return zf(h,Hf,Gf);}var Yf=Kf,Vf=ge,Xf=ee,kf=Vf(Xf,"DataView"),Jf=kf,Zf=ge,Qf=ee,qf=Zf(Qf,"Promise"),_f=qf,th=ge,eh=ee,rh=th(eh,"Set"),ni=rh,nh=ge,ih=ee,sh=nh(ih,"WeakMap"),oh=sh,dr=Jf,gr=Mr,pr=_f,mr=ni,vr=oh,ii=de,Ae=jn,tn="[object Map]",ah="[object Object]",en="[object Promise]",rn="[object Set]",nn="[object WeakMap]",sn="[object DataView]",lh=Ae(dr),ch=Ae(gr),fh=Ae(pr),hh=Ae(mr),uh=Ae(vr),ue=ii;(dr&&ue(new dr(new ArrayBuffer(1)))!=sn||gr&&ue(new gr())!=tn||pr&&ue(pr.resolve())!=en||mr&&ue(new mr())!=rn||vr&&ue(new vr())!=nn)&&(ue=function ue(h){var r=ii(h),t=r==ah?h.constructor:void 0,e=t?Ae(t):"";if(e)switch(e){case lh:return sn;case ch:return tn;case fh:return en;case hh:return rn;case uh:return nn;}return r;});var or=ue,dh=Object.prototype,gh=dh.hasOwnProperty;function ph(h){var r=h.length,t=new h.constructor(r);return r&&typeof h[0]=="string"&&gh.call(h,"index")&&(t.index=h.index,t.input=h.input),t;}var mh=ph,vh=ee,yh=vh.Uint8Array,si=yh,on=si;function Sh(h){var r=new h.constructor(h.byteLength);return new on(r).set(new on(h)),r;}var br=Sh,xh=br;function Th(h,r){var t=r?xh(h.buffer):h.buffer;return new h.constructor(t,h.byteOffset,h.byteLength);}var Mh=Th,Ph=/\w*$/;function Oh(h){var r=new h.constructor(h.source,Ph.exec(h));return r.lastIndex=h.lastIndex,r;}var Eh=Oh,an=Be,ln=an?an.prototype:void 0,cn=ln?ln.valueOf:void 0;function Ch(h){return cn?Object(cn.call(h)):{};}var Ah=Ch,Rh=br;function Ih(h,r){var t=r?Rh(h.buffer):h.buffer;return new h.constructor(t,h.byteOffset,h.length);}var Lh=Ih,bh=br,wh=Mh,Dh=Eh,Nh=Ah,Wh=Lh,Bh="[object Boolean]",Fh="[object Date]",Uh="[object Map]",jh="[object Number]",$h="[object RegExp]",zh="[object Set]",Gh="[object String]",Hh="[object Symbol]",Kh="[object ArrayBuffer]",Yh="[object DataView]",Vh="[object Float32Array]",Xh="[object Float64Array]",kh="[object Int8Array]",Jh="[object Int16Array]",Zh="[object Int32Array]",Qh="[object Uint8Array]",qh="[object Uint8ClampedArray]",_h="[object Uint16Array]",tu="[object Uint32Array]";function eu(h,r,t){var e=h.constructor;switch(r){case Kh:return bh(h);case Bh:case Fh:return new e(+h);case Yh:return wh(h,t);case Vh:case Xh:case kh:case Jh:case Zh:case Qh:case qh:case _h:case tu:return Wh(h,t);case Uh:return new e();case jh:case Gh:return new e(h);case $h:return Dh(h);case zh:return new e();case Hh:return Nh(h);}}var ru=eu,nu=he,fn=Object.create,iu=/* @__PURE__ */function(){function h(){}return function(r){if(!nu(r))return{};if(fn)return fn(r);h.prototype=r;var t=new h();return h.prototype=void 0,t;};}(),su=iu,ou=su,au=_n,lu=Er;function cu(h){return typeof h.constructor=="function"&&!lu(h)?ou(au(h)):{};}var fu=cu,hu=or,uu=ne,du="[object Map]";function gu(h){return uu(h)&&hu(h)==du;}var pu=gu,mu=pu,vu=sr,hn=Or,un=hn&&hn.isMap,yu=un?vu(un):mu,Su=yu,xu=or,Tu=ne,Mu="[object Set]";function Pu(h){return Tu(h)&&xu(h)==Mu;}var Ou=Pu,Eu=Ou,Cu=sr,dn=Or,gn=dn&&dn.isSet,Au=gn?Cu(gn):Eu,oi=Au,Ru=/* @__PURE__ */fe(oi),Iu=zn,Lu=tl,bu=Kn,wu=Gc,Du=of,Nu=af,Wu=cf,Bu=xf,Fu=Df,Uu=ri,ju=Yf,$u=or,zu=mh,Gu=ru,Hu=fu,Ku=Fe,Yu=Pr,Vu=Su,Xu=he,ku=oi,Ju=Ar,Zu=Rr,Qu=1,qu=2,_u=4,ai="[object Arguments]",td="[object Array]",ed="[object Boolean]",rd="[object Date]",nd="[object Error]",li="[object Function]",id="[object GeneratorFunction]",sd="[object Map]",od="[object Number]",ci="[object Object]",ad="[object RegExp]",ld="[object Set]",cd="[object String]",fd="[object Symbol]",hd="[object WeakMap]",ud="[object ArrayBuffer]",dd="[object DataView]",gd="[object Float32Array]",pd="[object Float64Array]",md="[object Int8Array]",vd="[object Int16Array]",yd="[object Int32Array]",Sd="[object Uint8Array]",xd="[object Uint8ClampedArray]",Td="[object Uint16Array]",Md="[object Uint32Array]",Ft={};Ft[ai]=Ft[td]=Ft[ud]=Ft[dd]=Ft[ed]=Ft[rd]=Ft[gd]=Ft[pd]=Ft[md]=Ft[vd]=Ft[yd]=Ft[sd]=Ft[od]=Ft[ci]=Ft[ad]=Ft[ld]=Ft[cd]=Ft[fd]=Ft[Sd]=Ft[xd]=Ft[Td]=Ft[Md]=!0;Ft[nd]=Ft[li]=Ft[hd]=!1;function $e(h,r,t,e,n,i){var a,o=r&Qu,s=r&qu,l=r&_u;if(t&&(a=n?t(h,e,n,i):t(h)),a!==void 0)return a;if(!Xu(h))return h;var d=Ku(h);if(d){if(a=zu(h),!o)return Wu(h,a);}else{var c=$u(h),p=c==li||c==id;if(Yu(h))return Nu(h,o);if(c==ci||c==ai||p&&!n){if(a=s||p?{}:Hu(h),!o)return s?Fu(h,Du(a,h)):Bu(h,wu(a,h));}else{if(!Ft[c])return n?h:{};a=Gu(h,c,o);}}i||(i=new Iu());var y=i.get(h);if(y)return y;i.set(h,a),ku(h)?h.forEach(function(v){a.add($e(v,r,t,v,h,i));}):Vu(h)&&h.forEach(function(v,T){a.set(T,$e(v,r,t,T,h,i));});var P=l?s?ju:Uu:s?Zu:Ju,x=d?void 0:P(h);return Lu(x||h,function(v,T){x&&(T=v,v=h[T]),bu(a,T,$e(v,r,t,T,h,i));}),a;}var Pd=$e,Od=Pd,Ed=1,Cd=4;function Ad(h){return Od(h,Ed|Cd);}var Rd=Ad,Xt=/* @__PURE__ */fe(Rd);var fi="1.1.7-beta.0",Id="@netless/appliance-plugin",Ld=typeof OffscreenCanvas=="function"?"worker":"mainThread";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var h=window.__netlessUA||"";h+=" ".concat(Id,"@").concat(fi,"_").concat(Ld),window.__netlessUA=h;}var re={syncOpt:{interval:500},cdn:{subWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@latest/dist/subWorker.js",fullWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@latest/dist/fullWorker.js"},cursor:{expirationTime:5e3},bufferSize:{full:2e4,sub:1e3},bezier:{combineUnitTime:100},pencilEraser:{useBitMap:!0}};function ae(h){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=h.length;if(t<2)return"";var e=h[0],n=h[1];if(t===2)return"M".concat(pe(e),"L").concat(pe(n));var i="";for(var a=2,o=t-1;a<o;a++)e=h[a],n=h[a+1],i+=me(e,n);return r?"M".concat(me(h[0],h[1]),"Q").concat(pe(h[1])).concat(me(h[1],h[2]),"T").concat(i).concat(me(h[t-1],h[0])).concat(me(h[0],h[1]),"Z"):"M".concat(pe(h[0]),"Q").concat(pe(h[1])).concat(me(h[1],h[2])).concat(h.length>3?"T":"").concat(i,"L").concat(pe(h[t-1]));}var Jt=/*#__PURE__*/function(){function Jt(r){_classCallCheck(this,Jt);et(this,"syncUnitTime",re.syncOpt.interval);et(this,"vNodes");et(this,"drawLayer");et(this,"fullLayer");et(this,"workId");var t=r.vNodes,e=r.fullLayer,n=r.drawLayer,i=r.workId,a=r.toolsOpt;this.vNodes=t,this.fullLayer=e,this.drawLayer=n,this.workId=i,this.syncUnitTime=a.syncUnitTime||this.syncUnitTime;}return _createClass(Jt,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return r.reduce(function(e,n){var i=e[e.length-1];return(n&&!i||n&&i&&!n.isNear(i,t))&&e.push(n),e;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(r){this.workId=r;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(r){var n,i,a;this.workOptions=r,this.syncUnitTime=r.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),e=t&&((i=this.vNodes)==null?void 0:i.get(t))||void 0;t&&e&&(e.opt=r,(a=this.vNodes)==null||a.setInfo(t,e));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(r){var n,i;var t;var e=(n=this.workId)==null?void 0:n.toString();if(e&&r){var a=this.fullLayer.getElementsByName(e)||this.drawLayer&&this.drawLayer.getElementsByName(e)||[];if(a.length!==1)return;var o=a[0],s=r.pos,l=r.zIndex,d=r.scale,c=r.angle,p=r.translate,y={};_t(l)&&(y.zIndex=l),s&&(y.pos=[s[0],s[1]]),d&&(y.scale=d),c&&(y.rotate=c),p&&(y.translate=p),o.attr(y);var P=o==null?void 0:o.getBoundingClientRect();return P&&(t=Pt(t,{x:Math.floor(P.x-Jt.SafeBorderPadding),y:Math.floor(P.y-Jt.SafeBorderPadding),w:Math.floor(P.width+Jt.SafeBorderPadding*2),h:Math.floor(P.height+Jt.SafeBorderPadding*2)})),(i=this.vNodes)==null||i.setInfo(e,{rect:t,centerPos:s}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(r){var t=r.group,e=r.eraserlines,n=r.pos,i=r.layer,_r$isClear=r.isClear,a=_r$isClear===void 0?!0:_r$isClear,o=!!i.parent.gl;var _iterator13=_createForOfIteratorHelper(e),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var l=s.thickness,d=s.op;var _iterator14=_createForOfIteratorHelper(d),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var c=_step14.value;var p=c.map(function(T,f){return f%2?T-n[1]:T-n[0];}),y=this.computEraserPoints(p,l),P=ae(y,!0),x={pos:[0,0],d:P,fillColor:"rgba(0,0,0,1)"},v=new ce(x);a&&(v.addEventListener("beforerender",function(_ref165){var T=_ref165.detail;var f=T.context;o?f.blendFuncSeparate(f.ZERO,f.ZERO,f.ZERO,f.ZERO):f.globalCompositeOperation="destination-out";}),v.addEventListener("afterrender",function(_ref166){var T=_ref166.detail;var f=T.context;o?f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA):f.globalCompositeOperation="source-over";})),t.append(v);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"computEraserPoints",value:function computEraserPoints(r,t){var e=Math.ceil(t/2);return r.length===2?this.computDot(r,e):this.computLine(r,e);}},{key:"computDot",value:function computDot(r,t){var e=new xt(r[0],r[1]);return xt.GetDotStroke(e,t,8);}},{key:"computLine",value:function computLine(r,t){var e=[],n=[];var i,a;for(var o=0;o<r.length;o+=2){var s=new xt(r[o],r[o+1]);var l=void 0;if(o==r.length-2){var d=new xt(r[o-2],r[o-1]);l=_.Sub(s,d).uni(),i=s;}else{o===0&&(a=s);var _d4=new xt(r[o+2],r[o+3]);l=_.Sub(_d4,s).uni();}if(l){var _d5=_.Per(l).mul(t);e.push(xt.Sub(s,_d5)),n.push(xt.Add(s,_d5));}}if(i&&a){var _o3=xt.GetSemicircleStroke(i,e[e.length-1],-1,8),_s4=xt.GetSemicircleStroke(a,n[0],-1,8);return e.concat(_o3,n.reverse(),_s4);}return[];}},{key:"replace",value:function replace(r,t,e){var _this61=this;var o;var n=r.getElementsByName(t),i=n.length;if(i){if(i>1)for(var s=1;s<n.length;s++)r.removeChild(n[s]),n[s].disconnect();e?r.replaceChild(e,n[0]):r.removeChild(n[0]),n[0].disconnect();}else e&&r.append(e);this.fullLayer===r?(o=this.drawLayer)==null||o.getElementsByName(t).forEach(function(s){var l;(l=_this61.drawLayer)==null||l.removeChild(s),s.disconnect();}):this.fullLayer.getElementsByName(t).forEach(function(s){_this61.fullLayer.removeChild(s),s.disconnect();});}}],[{key:"updateNodeOpt",value:function updateNodeOpt(r){var f;var t=r.node,e=r.opt,n=r.vNodes,i=r.willSerializeData,a=r.targetNode,o=e.zIndex,s=e.translate,l=e.angle,d=e.originPoint,c=e.scenePoint,p=e.scale,y=e.pointMap,P=e.thickness;var x;var v=a&&Xt(a)||n.get(t.name);if(!v)return;_t(o)&&(t.setAttribute("zIndex",o),v.opt.zIndex=o);var T=t.parent;if(T){if(d&&p&&a){var g=[v.op[0],v.op[1]];Ur(v.op,c,p,s);var u=[v.op[0],v.op[1]],m=[u[0]-g[0],u[1]-g[1]];if(v.centerPos=[v.centerPos[0]+m[0],v.centerPos[1]+m[1]],v.opt.translate=void 0,v.opt.scale=void 0,v.opt.eraserlines)for(var _i2=0,_Object$values=Object.values(v.opt.eraserlines);_i2<_Object$values.length;_i2++){var M=_Object$values[_i2];var E=M.op,A=M.thickness;M.thickness=A*Math.max(p[0],p[1]);for(var b=0;b<E.length;b++)jr(E[b],c,p,s);}}else if(s){if(t.setAttribute("translate",s),v.opt.translate=s,a){var _g6=[s[0]*T.worldScaling[0],s[1]*T.worldScaling[1]];x=Sr(v.rect,_g6),v.rect=x;}else{var _g7=Jt.getRectFromLayer(T,t.name);v.rect=_g7||v.rect;}}else if(_t(l))if(t.setAttribute("rotate",l),v.opt.rotate=l,a)x=Ei(v.rect,l),v.rect=x;else{var _g8=Jt.getRectFromLayer(T,t.name);v.rect=_g8||v.rect;}if(y){var _g9=y.get(t.name);if(_g9)for(var _u10=0,_m9=0;_u10<v.op.length;_u10+=3,_m9++)v.op[_u10]=_g9[_m9][0],v.op[_u10+1]=_g9[_m9][1];}if(P&&(f=v==null?void 0:v.opt)!=null&&f.thickness&&(v.opt.thickness=P),i&&!(d&&p&&a)){if(s){var _g10=v.op.map(function(u,m){var M=m%3;return M===0?u+s[0]:M===1?u+s[1]:u;});if(v.op=_g10,v.centerPos=[v.centerPos[0]+s[0],v.centerPos[1]+s[1]],v!=null&&v.opt&&(v.opt.translate=void 0),v.opt.eraserlines)for(var _i3=0,_Object$values2=Object.values(v.opt.eraserlines);_i3<_Object$values2.length;_i3++){var _u11=_Object$values2[_i3];var _m10=_u11.op;for(var _M6=0;_M6<_m10.length;_M6++){var _E3=_m10[_M6].map(function(A,b){return b%2?A+s[1]:A+s[0];});_u11.op[_M6]=_E3;}}}else if(_t(l)){var _g11=v.op;if(H0(_g11,v.centerPos,l),v.op=_g11,v!=null&&v.opt&&(v.opt.rotate=void 0),v.opt.eraserlines)for(var _i4=0,_Object$values3=Object.values(v.opt.eraserlines);_i4<_Object$values3.length;_i4++){var _u12=_Object$values3[_i4];var _m11=_u12.op;for(var _M7=0;_M7<_m11.length;_M7++)K0(_m11[_M7],v.centerPos,l);}}}v&&n.setInfo(t.name,v);}}},{key:"getCenterPos",value:function getCenterPos(r,t){var e=t.worldPosition,n=t.worldScaling;return[(r.x+r.w/2-e[0])/n[0],(r.y+r.h/2-e[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(r,t){var e=r.getElementsByName(t)[0];if(e){var n=e.getBoundingClientRect();return{x:Math.floor(n.x-Jt.SafeBorderPadding),y:Math.floor(n.y-Jt.SafeBorderPadding),w:Math.floor(n.width+Jt.SafeBorderPadding*2),h:Math.floor(n.height+Jt.SafeBorderPadding*2)};}}}]);}();et(Jt,"SafeBorderPadding",10);var vt=Jt;var wr={exports:{}};wr.exports;(function(h){var r=function(){var t=String.fromCharCode,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",i={};function a(s,l){if(!i[s]){i[s]={};for(var d=0;d<s.length;d++)i[s][s.charAt(d)]=d;}return i[s][l];}var o={compressToBase64:function compressToBase64(s){if(s==null)return"";var l=o._compress(s,6,function(d){return e.charAt(d);});switch(l.length%4){default:case 0:return l;case 1:return l+"===";case 2:return l+"==";case 3:return l+"=";}},decompressFromBase64:function decompressFromBase64(s){return s==null?"":s==""?null:o._decompress(s.length,32,function(l){return a(e,s.charAt(l));});},compressToUTF16:function compressToUTF16(s){return s==null?"":o._compress(s,15,function(l){return t(l+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(s){return s==null?"":s==""?null:o._decompress(s.length,16384,function(l){return s.charCodeAt(l)-32;});},//compress into uint8array (UCS-2 big endian format)
399
+ mc(l,s)))&&o.push(l);return o;}var Jn=xc,Tc=Object.prototype;function Mc(h){var r=h&&h.constructor,t=typeof r=="function"&&r.prototype||Tc;return h===t;}var Er=Mc;function Pc(h,r){return function(t){return h(r(t));};}var Zn=Pc,Oc=Zn,Ec=Oc(Object.keys,Object),Cc=Ec,Ac=Er,Rc=Cc,Ic=Object.prototype,Lc=Ic.hasOwnProperty;function bc(h){if(!Ac(h))return Rc(h);var r=[];for(var t in Object(h))Lc.call(h,t)&&t!="constructor"&&r.push(t);return r;}var wc=bc,Dc=Un,Nc=Xn;function Wc(h){return h!=null&&Nc(h.length)&&!Dc(h);}var Cr=Wc,Bc=Jn,Fc=wc,Uc=Cr;function jc(h){return Uc(h)?Bc(h):Fc(h);}var Ar=jc,$c=ir,zc=Ar;function Gc(h,r){return h&&$c(r,zc(r),h);}var Hc=Gc;function Kc(h){var r=[];if(h!=null)for(var t in Object(h))r.push(t);return r;}var Yc=Kc,Vc=he,Xc=Er,kc=Yc,Jc=Object.prototype,Zc=Jc.hasOwnProperty;function Qc(h){if(!Vc(h))return kc(h);var r=Xc(h),t=[];for(var e in h)e=="constructor"&&(r||!Zc.call(h,e))||t.push(e);return t;}var qc=Qc,_c=Jn,tf=qc,ef=Cr;function rf(h){return ef(h)?_c(h,!0):tf(h);}var Rr=rf,nf=ir,sf=Rr;function of(h,r){return h&&nf(r,sf(r),h);}var af=of,He={exports:{}};He.exports;(function(h,r){var t=ee,e=r&&!r.nodeType&&r,n=e&&!0&&h&&!h.nodeType&&h,i=n&&n.exports===e,a=i?t.Buffer:void 0,o=a?a.allocUnsafe:void 0;function s(l,d){if(d)return l.slice();var c=l.length,p=o?o(c):new l.constructor(c);return l.copy(p),p;}h.exports=s;})(He,He.exports);var lf=He.exports;function cf(h,r){var t=-1,e=h.length;for(r||(r=Array(e));++t<e;)r[t]=h[t];return r;}var ff=cf;function hf(h,r){for(var t=-1,e=h==null?0:h.length,n=0,i=[];++t<e;){var a=h[t];r(a,t,h)&&(i[n++]=a);}return i;}var Qn=hf;function uf(){return[];}var qn=uf,df=Qn,gf=qn,pf=Object.prototype,mf=pf.propertyIsEnumerable,_r=Object.getOwnPropertySymbols,vf=_r?function(h){return h==null?[]:(h=Object(h),df(_r(h),function(r){return mf.call(h,r);}));}:gf,Ir=vf,yf=ir,Sf=Ir;function xf(h,r){return yf(h,Sf(h),r);}var Tf=xf;function Mf(h,r){for(var t=-1,e=r.length,n=h.length;++t<e;)h[n+t]=r[t];return h;}var Lr=Mf,Pf=Zn,Of=Pf(Object.getPrototypeOf,Object),_n=Of,Ef=Lr,Cf=_n,Af=Ir,Rf=qn,If=Object.getOwnPropertySymbols,Lf=If?function(h){for(var r=[];h;)Ef(r,Af(h)),h=Cf(h);return r;}:Rf,ti=Lf,bf=ir,wf=ti;function Df(h,r){return bf(h,wf(h),r);}var Nf=Df,Wf=Lr,Bf=Fe;function Ff(h,r,t){var e=r(h);return Bf(h)?e:Wf(e,t(h));}var ei=Ff,Uf=ei,jf=Ir,$f=Ar;function zf(h){return Uf(h,$f,jf);}var ri=zf,Gf=ei,Hf=ti,Kf=Rr;function Yf(h){return Gf(h,Kf,Hf);}var Vf=Yf,Xf=ge,kf=ee,Jf=Xf(kf,"DataView"),Zf=Jf,Qf=ge,qf=ee,_f=Qf(qf,"Promise"),th=_f,eh=ge,rh=ee,nh=eh(rh,"Set"),ni=nh,ih=ge,sh=ee,oh=ih(sh,"WeakMap"),ah=oh,dr=Zf,gr=Mr,pr=th,mr=ni,vr=ah,ii=de,Ae=jn,tn="[object Map]",lh="[object Object]",en="[object Promise]",rn="[object Set]",nn="[object WeakMap]",sn="[object DataView]",ch=Ae(dr),fh=Ae(gr),hh=Ae(pr),uh=Ae(mr),dh=Ae(vr),ue=ii;(dr&&ue(new dr(new ArrayBuffer(1)))!=sn||gr&&ue(new gr())!=tn||pr&&ue(pr.resolve())!=en||mr&&ue(new mr())!=rn||vr&&ue(new vr())!=nn)&&(ue=function ue(h){var r=ii(h),t=r==lh?h.constructor:void 0,e=t?Ae(t):"";if(e)switch(e){case ch:return sn;case fh:return tn;case hh:return en;case uh:return rn;case dh:return nn;}return r;});var or=ue,gh=Object.prototype,ph=gh.hasOwnProperty;function mh(h){var r=h.length,t=new h.constructor(r);return r&&typeof h[0]=="string"&&ph.call(h,"index")&&(t.index=h.index,t.input=h.input),t;}var vh=mh,yh=ee,Sh=yh.Uint8Array,si=Sh,on=si;function xh(h){var r=new h.constructor(h.byteLength);return new on(r).set(new on(h)),r;}var br=xh,Th=br;function Mh(h,r){var t=r?Th(h.buffer):h.buffer;return new h.constructor(t,h.byteOffset,h.byteLength);}var Ph=Mh,Oh=/\w*$/;function Eh(h){var r=new h.constructor(h.source,Oh.exec(h));return r.lastIndex=h.lastIndex,r;}var Ch=Eh,an=Be,ln=an?an.prototype:void 0,cn=ln?ln.valueOf:void 0;function Ah(h){return cn?Object(cn.call(h)):{};}var Rh=Ah,Ih=br;function Lh(h,r){var t=r?Ih(h.buffer):h.buffer;return new h.constructor(t,h.byteOffset,h.length);}var bh=Lh,wh=br,Dh=Ph,Nh=Ch,Wh=Rh,Bh=bh,Fh="[object Boolean]",Uh="[object Date]",jh="[object Map]",$h="[object Number]",zh="[object RegExp]",Gh="[object Set]",Hh="[object String]",Kh="[object Symbol]",Yh="[object ArrayBuffer]",Vh="[object DataView]",Xh="[object Float32Array]",kh="[object Float64Array]",Jh="[object Int8Array]",Zh="[object Int16Array]",Qh="[object Int32Array]",qh="[object Uint8Array]",_h="[object Uint8ClampedArray]",tu="[object Uint16Array]",eu="[object Uint32Array]";function ru(h,r,t){var e=h.constructor;switch(r){case Yh:return wh(h);case Fh:case Uh:return new e(+h);case Vh:return Dh(h,t);case Xh:case kh:case Jh:case Zh:case Qh:case qh:case _h:case tu:case eu:return Bh(h,t);case jh:return new e();case $h:case Hh:return new e(h);case zh:return Nh(h);case Gh:return new e();case Kh:return Wh(h);}}var nu=ru,iu=he,fn=Object.create,su=/* @__PURE__ */function(){function h(){}return function(r){if(!iu(r))return{};if(fn)return fn(r);h.prototype=r;var t=new h();return h.prototype=void 0,t;};}(),ou=su,au=ou,lu=_n,cu=Er;function fu(h){return typeof h.constructor=="function"&&!cu(h)?au(lu(h)):{};}var hu=fu,uu=or,du=ne,gu="[object Map]";function pu(h){return du(h)&&uu(h)==gu;}var mu=pu,vu=mu,yu=sr,hn=Or,un=hn&&hn.isMap,Su=un?yu(un):vu,xu=Su,Tu=or,Mu=ne,Pu="[object Set]";function Ou(h){return Mu(h)&&Tu(h)==Pu;}var Eu=Ou,Cu=Eu,Au=sr,dn=Or,gn=dn&&dn.isSet,Ru=gn?Au(gn):Cu,oi=Ru,Iu=/* @__PURE__ */fe(oi),Lu=zn,bu=el,wu=Kn,Du=Hc,Nu=af,Wu=lf,Bu=ff,Fu=Tf,Uu=Nf,ju=ri,$u=Vf,zu=or,Gu=vh,Hu=nu,Ku=hu,Yu=Fe,Vu=Pr,Xu=xu,ku=he,Ju=oi,Zu=Ar,Qu=Rr,qu=1,_u=2,td=4,ai="[object Arguments]",ed="[object Array]",rd="[object Boolean]",nd="[object Date]",id="[object Error]",li="[object Function]",sd="[object GeneratorFunction]",od="[object Map]",ad="[object Number]",ci="[object Object]",ld="[object RegExp]",cd="[object Set]",fd="[object String]",hd="[object Symbol]",ud="[object WeakMap]",dd="[object ArrayBuffer]",gd="[object DataView]",pd="[object Float32Array]",md="[object Float64Array]",vd="[object Int8Array]",yd="[object Int16Array]",Sd="[object Int32Array]",xd="[object Uint8Array]",Td="[object Uint8ClampedArray]",Md="[object Uint16Array]",Pd="[object Uint32Array]",Ft={};Ft[ai]=Ft[ed]=Ft[dd]=Ft[gd]=Ft[rd]=Ft[nd]=Ft[pd]=Ft[md]=Ft[vd]=Ft[yd]=Ft[Sd]=Ft[od]=Ft[ad]=Ft[ci]=Ft[ld]=Ft[cd]=Ft[fd]=Ft[hd]=Ft[xd]=Ft[Td]=Ft[Md]=Ft[Pd]=!0;Ft[id]=Ft[li]=Ft[ud]=!1;function $e(h,r,t,e,n,i){var a,o=r&qu,s=r&_u,l=r&td;if(t&&(a=n?t(h,e,n,i):t(h)),a!==void 0)return a;if(!ku(h))return h;var d=Yu(h);if(d){if(a=Gu(h),!o)return Bu(h,a);}else{var c=zu(h),p=c==li||c==sd;if(Vu(h))return Wu(h,o);if(c==ci||c==ai||p&&!n){if(a=s||p?{}:Ku(h),!o)return s?Uu(h,Nu(a,h)):Fu(h,Du(a,h));}else{if(!Ft[c])return n?h:{};a=Hu(h,c,o);}}i||(i=new Lu());var y=i.get(h);if(y)return y;i.set(h,a),Ju(h)?h.forEach(function(v){a.add($e(v,r,t,v,h,i));}):Xu(h)&&h.forEach(function(v,T){a.set(T,$e(v,r,t,T,h,i));});var P=l?s?$u:ju:s?Qu:Zu,x=d?void 0:P(h);return bu(x||h,function(v,T){x&&(T=v,v=h[T]),wu(a,T,$e(v,r,t,T,h,i));}),a;}var Od=$e,Ed=Od,Cd=1,Ad=4;function Rd(h){return Ed(h,Cd|Ad);}var Id=Rd,Xt=/* @__PURE__ */fe(Id);var fi="1.1.7-beta.2",Ld="@netless/appliance-plugin",bd=typeof OffscreenCanvas=="function"?"worker":"mainThread";if((typeof window==="undefined"?"undefined":_typeof(window))<"u"){var h=window.__netlessUA||"";h+=" ".concat(Ld,"@").concat(fi,"_").concat(bd),window.__netlessUA=h;}var re={syncOpt:{interval:500},cdn:{subWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@latest/dist/subWorker.js",fullWorkerUrl:"https://cdn.jsdelivr.net/npm/@netless/appliance-plugin@latest/dist/fullWorker.js"},cursor:{expirationTime:5e3},bufferSize:{full:2e4,sub:1e3},bezier:{combineUnitTime:100},pencilEraser:{useBitMap:!0}};function ae(h){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var t=h.length;if(t<2)return"";var e=h[0],n=h[1];if(t===2)return"M".concat(pe(e),"L").concat(pe(n));var i="";for(var a=2,o=t-1;a<o;a++)e=h[a],n=h[a+1],i+=me(e,n);return r?"M".concat(me(h[0],h[1]),"Q").concat(pe(h[1])).concat(me(h[1],h[2]),"T").concat(i).concat(me(h[t-1],h[0])).concat(me(h[0],h[1]),"Z"):"M".concat(pe(h[0]),"Q").concat(pe(h[1])).concat(me(h[1],h[2])).concat(h.length>3?"T":"").concat(i,"L").concat(pe(h[t-1]));}var Jt=/*#__PURE__*/function(){function Jt(r){_classCallCheck(this,Jt);et(this,"syncUnitTime",re.syncOpt.interval);et(this,"vNodes");et(this,"drawLayer");et(this,"fullLayer");et(this,"workId");var t=r.vNodes,e=r.fullLayer,n=r.drawLayer,i=r.workId,a=r.toolsOpt;this.vNodes=t,this.fullLayer=e,this.drawLayer=n,this.workId=i,this.syncUnitTime=a.syncUnitTime||this.syncUnitTime;}return _createClass(Jt,[{key:"baseConsumeResult",get:function get(){return{workId:this.workId,toolsType:this.toolsType,opt:this.workOptions};}},{key:"filterSamePoints",value:function filterSamePoints(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0.01;return r.reduce(function(e,n){var i=e[e.length-1];return(n&&!i||n&&i&&!n.isNear(i,t))&&e.push(n),e;},[]);}/** 设置工作id */},{key:"setWorkId",value:function setWorkId(r){this.workId=r;}},{key:"getWorkId",value:function getWorkId(){return this.workId;}/** 获取工作选项配置 */},{key:"getWorkOptions",value:function getWorkOptions(){return this.workOptions;}/** 设置工作选项配置 */},{key:"setWorkOptions",value:function setWorkOptions(r){var n,i,a;this.workOptions=r,this.syncUnitTime=r.syncUnitTime||this.syncUnitTime;var t=(n=this.workId)==null?void 0:n.toString(),e=t&&((i=this.vNodes)==null?void 0:i.get(t))||void 0;t&&e&&(e.opt=r,(a=this.vNodes)==null||a.setInfo(t,e));}/** 更新服务端同步配置,返回绘制结果 */},{key:"updataOptService",value:function updataOptService(r){var n,i;var t;var e=(n=this.workId)==null?void 0:n.toString();if(e&&r){var a=this.fullLayer.getElementsByName(e)||this.drawLayer&&this.drawLayer.getElementsByName(e)||[];if(a.length!==1)return;var o=a[0],s=r.pos,l=r.zIndex,d=r.scale,c=r.angle,p=r.translate,y={};_t(l)&&(y.zIndex=l),s&&(y.pos=[s[0],s[1]]),d&&(y.scale=d),c&&(y.rotate=c),p&&(y.translate=p),o.attr(y);var P=o==null?void 0:o.getBoundingClientRect();return P&&(t=Pt(t,{x:Math.floor(P.x-Jt.SafeBorderPadding),y:Math.floor(P.y-Jt.SafeBorderPadding),w:Math.floor(P.width+Jt.SafeBorderPadding*2),h:Math.floor(P.height+Jt.SafeBorderPadding*2)})),(i=this.vNodes)==null||i.setInfo(e,{rect:t,centerPos:s}),t;}}},{key:"drawEraserlines",value:function drawEraserlines(r){var t=r.group,e=r.eraserlines,n=r.pos,i=r.layer,_r$isClear=r.isClear,a=_r$isClear===void 0?!0:_r$isClear,o=!!i.parent.gl;var _iterator13=_createForOfIteratorHelper(e),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var s=_step13.value;var l=s.thickness,d=s.op;var _iterator14=_createForOfIteratorHelper(d),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var c=_step14.value;var p=c.map(function(T,f){return f%2?T-n[1]:T-n[0];}),y=this.computEraserPoints(p,l),P=ae(y,!0),x={pos:[0,0],d:P,fillColor:"rgba(0,0,0,1)"},v=new ce(x);a&&(v.addEventListener("beforerender",function(_ref165){var T=_ref165.detail;var f=T.context;o?f.blendFuncSeparate(f.ZERO,f.ZERO,f.ZERO,f.ZERO):f.globalCompositeOperation="destination-out";}),v.addEventListener("afterrender",function(_ref166){var T=_ref166.detail;var f=T.context;o?f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA):f.globalCompositeOperation="source-over";})),t.append(v);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}}},{key:"computEraserPoints",value:function computEraserPoints(r,t){var e=Math.ceil(t/2);return r.length===2?this.computDot(r,e):this.computLine(r,e);}},{key:"computDot",value:function computDot(r,t){var e=new xt(r[0],r[1]);return xt.GetDotStroke(e,t,8);}},{key:"computLine",value:function computLine(r,t){var e=[],n=[];var i,a;for(var o=0;o<r.length;o+=2){var s=new xt(r[o],r[o+1]);var l=void 0;if(o==r.length-2){var d=new xt(r[o-2],r[o-1]);l=_.Sub(s,d).uni(),i=s;}else{o===0&&(a=s);var _d4=new xt(r[o+2],r[o+3]);l=_.Sub(_d4,s).uni();}if(l){var _d5=_.Per(l).mul(t);e.push(xt.Sub(s,_d5)),n.push(xt.Add(s,_d5));}}if(i&&a){var _o3=xt.GetSemicircleStroke(i,e[e.length-1],-1,8),_s4=xt.GetSemicircleStroke(a,n[0],-1,8);return e.concat(_o3,n.reverse(),_s4);}return[];}},{key:"replace",value:function replace(r,t,e){var _this61=this;var o;var n=r.getElementsByName(t),i=n.length;if(i){if(i>1)for(var s=1;s<n.length;s++)r.removeChild(n[s]),n[s].disconnect();e?r.replaceChild(e,n[0]):r.removeChild(n[0]),n[0].disconnect();}else e&&r.append(e);this.fullLayer===r?(o=this.drawLayer)==null||o.getElementsByName(t).forEach(function(s){var l;(l=_this61.drawLayer)==null||l.removeChild(s),s.disconnect();}):this.fullLayer.getElementsByName(t).forEach(function(s){_this61.fullLayer.removeChild(s),s.disconnect();});}}],[{key:"updateNodeOpt",value:function updateNodeOpt(r){var f;var t=r.node,e=r.opt,n=r.vNodes,i=r.willSerializeData,a=r.targetNode,o=e.zIndex,s=e.translate,l=e.angle,d=e.originPoint,c=e.scenePoint,p=e.scale,y=e.pointMap,P=e.thickness;var x;var v=a&&Xt(a)||n.get(t.name);if(!v)return;_t(o)&&(t.setAttribute("zIndex",o),v.opt.zIndex=o);var T=t.parent;if(T){if(d&&p&&a){var g=[v.op[0],v.op[1]];Ur(v.op,c,p,s);var u=[v.op[0],v.op[1]],m=[u[0]-g[0],u[1]-g[1]];if(v.centerPos=[v.centerPos[0]+m[0],v.centerPos[1]+m[1]],v.opt.translate=void 0,v.opt.scale=void 0,v.opt.eraserlines)for(var _i2=0,_Object$values=Object.values(v.opt.eraserlines);_i2<_Object$values.length;_i2++){var M=_Object$values[_i2];var E=M.op,A=M.thickness;M.thickness=A*Math.max(p[0],p[1]);for(var b=0;b<E.length;b++)jr(E[b],c,p,s);}}else if(s){if(t.setAttribute("translate",s),v.opt.translate=s,a){var _g6=[s[0]*T.worldScaling[0],s[1]*T.worldScaling[1]];x=Sr(v.rect,_g6),v.rect=x;}else{var _g7=Jt.getRectFromLayer(T,t.name);v.rect=_g7||v.rect;}}else if(_t(l))if(t.setAttribute("rotate",l),v.opt.rotate=l,a)x=Ei(v.rect,l),v.rect=x;else{var _g8=Jt.getRectFromLayer(T,t.name);v.rect=_g8||v.rect;}if(y){var _g9=y.get(t.name);if(_g9)for(var _u10=0,_m9=0;_u10<v.op.length;_u10+=3,_m9++)v.op[_u10]=_g9[_m9][0],v.op[_u10+1]=_g9[_m9][1];}if(P&&(f=v==null?void 0:v.opt)!=null&&f.thickness&&(v.opt.thickness=P),i&&!(d&&p&&a)){if(s){var _g10=v.op.map(function(u,m){var M=m%3;return M===0?u+s[0]:M===1?u+s[1]:u;});if(v.op=_g10,v.centerPos=[v.centerPos[0]+s[0],v.centerPos[1]+s[1]],v!=null&&v.opt&&(v.opt.translate=void 0),v.opt.eraserlines)for(var _i3=0,_Object$values2=Object.values(v.opt.eraserlines);_i3<_Object$values2.length;_i3++){var _u11=_Object$values2[_i3];var _m10=_u11.op;for(var _M6=0;_M6<_m10.length;_M6++){var _E3=_m10[_M6].map(function(A,b){return b%2?A+s[1]:A+s[0];});_u11.op[_M6]=_E3;}}}else if(_t(l)){var _g11=v.op;if(Kg(_g11,v.centerPos,l),v.op=_g11,v!=null&&v.opt&&(v.opt.rotate=void 0),v.opt.eraserlines)for(var _i4=0,_Object$values3=Object.values(v.opt.eraserlines);_i4<_Object$values3.length;_i4++){var _u12=_Object$values3[_i4];var _m11=_u12.op;for(var _M7=0;_M7<_m11.length;_M7++)Yg(_m11[_M7],v.centerPos,l);}}}v&&n.setInfo(t.name,v);}}},{key:"getCenterPos",value:function getCenterPos(r,t){var e=t.worldPosition,n=t.worldScaling;return[(r.x+r.w/2-e[0])/n[0],(r.y+r.h/2-e[1])/n[1]];}},{key:"getRectFromLayer",value:function getRectFromLayer(r,t){var e=r.getElementsByName(t)[0];if(e){var n=e.getBoundingClientRect();return{x:Math.floor(n.x-Jt.SafeBorderPadding),y:Math.floor(n.y-Jt.SafeBorderPadding),w:Math.floor(n.width+Jt.SafeBorderPadding*2),h:Math.floor(n.height+Jt.SafeBorderPadding*2)};}}}]);}();et(Jt,"SafeBorderPadding",10);var vt=Jt;var wr={exports:{}};wr.exports;(function(h){var r=function(){var t=String.fromCharCode,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",i={};function a(s,l){if(!i[s]){i[s]={};for(var d=0;d<s.length;d++)i[s][s.charAt(d)]=d;}return i[s][l];}var o={compressToBase64:function compressToBase64(s){if(s==null)return"";var l=o._compress(s,6,function(d){return e.charAt(d);});switch(l.length%4){default:case 0:return l;case 1:return l+"===";case 2:return l+"==";case 3:return l+"=";}},decompressFromBase64:function decompressFromBase64(s){return s==null?"":s==""?null:o._decompress(s.length,32,function(l){return a(e,s.charAt(l));});},compressToUTF16:function compressToUTF16(s){return s==null?"":o._compress(s,15,function(l){return t(l+32);})+" ";},decompressFromUTF16:function decompressFromUTF16(s){return s==null?"":s==""?null:o._decompress(s.length,16384,function(l){return s.charCodeAt(l)-32;});},//compress into uint8array (UCS-2 big endian format)
400
400
  compressToUint8Array:function compressToUint8Array(s){for(var l=o.compress(s),d=new Uint8Array(l.length*2),c=0,p=l.length;c<p;c++){var y=l.charCodeAt(c);d[c*2]=y>>>8,d[c*2+1]=y%256;}return d;},//decompress from uint8array (UCS-2 big endian format)
401
401
  decompressFromUint8Array:function decompressFromUint8Array(s){if(s==null)return o.decompress(s);for(var l=new Array(s.length/2),d=0,c=l.length;d<c;d++)l[d]=s[d*2]*256+s[d*2+1];var p=[];return l.forEach(function(y){p.push(t(y));}),o.decompress(p.join(""));},//compress into a string that is already URI encoded
402
402
  compressToEncodedURIComponent:function compressToEncodedURIComponent(s){return s==null?"":o._compress(s,6,function(l){return n.charAt(l);});},//decompress from an output of compressToEncodedURIComponent
403
- decompressFromEncodedURIComponent:function decompressFromEncodedURIComponent(s){return s==null?"":s==""?null:(s=s.replace(/ /g,"+"),o._decompress(s.length,32,function(l){return a(n,s.charAt(l));}));},compress:function compress(s){return o._compress(s,16,function(l){return t(l);});},_compress:function _compress(s,l,d){if(s==null)return"";var c,p,y={},P={},x="",v="",T="",f=2,g=3,u=2,m=[],M=0,E=0,A;for(A=0;A<s.length;A+=1)if(x=s.charAt(A),Object.prototype.hasOwnProperty.call(y,x)||(y[x]=g++,P[x]=!0),v=T+x,Object.prototype.hasOwnProperty.call(y,v))T=v;else{if(Object.prototype.hasOwnProperty.call(P,T)){if(T.charCodeAt(0)<256){for(c=0;c<u;c++)M=M<<1,E==l-1?(E=0,m.push(d(M)),M=0):E++;for(p=T.charCodeAt(0),c=0;c<8;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;}else{for(p=1,c=0;c<u;c++)M=M<<1|p,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=0;for(p=T.charCodeAt(0),c=0;c<16;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;}f--,f==0&&(f=Math.pow(2,u),u++),delete P[T];}else for(p=y[T],c=0;c<u;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;f--,f==0&&(f=Math.pow(2,u),u++),y[v]=g++,T=String(x);}if(T!==""){if(Object.prototype.hasOwnProperty.call(P,T)){if(T.charCodeAt(0)<256){for(c=0;c<u;c++)M=M<<1,E==l-1?(E=0,m.push(d(M)),M=0):E++;for(p=T.charCodeAt(0),c=0;c<8;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;}else{for(p=1,c=0;c<u;c++)M=M<<1|p,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=0;for(p=T.charCodeAt(0),c=0;c<16;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;}f--,f==0&&(f=Math.pow(2,u),u++),delete P[T];}else for(p=y[T],c=0;c<u;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;f--,f==0&&(f=Math.pow(2,u),u++);}for(p=2,c=0;c<u;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;for(;;)if(M=M<<1,E==l-1){m.push(d(M));break;}else E++;return m.join("");},decompress:function decompress(s){return s==null?"":s==""?null:o._decompress(s.length,32768,function(l){return s.charCodeAt(l);});},_decompress:function _decompress(s,l,d){var c=[],p=4,y=4,P=3,x="",v=[],T,f,g,u,m,M,E,A={val:d(0),position:l,index:1};for(T=0;T<3;T+=1)c[T]=T;for(g=0,m=Math.pow(2,2),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;switch(g){case 0:for(g=0,m=Math.pow(2,8),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;E=t(g);break;case 1:for(g=0,m=Math.pow(2,16),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;E=t(g);break;case 2:return"";}for(c[3]=E,f=E,v.push(E);;){if(A.index>s)return"";for(g=0,m=Math.pow(2,P),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;switch(E=g){case 0:for(g=0,m=Math.pow(2,8),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;c[y++]=t(g),E=y-1,p--;break;case 1:for(g=0,m=Math.pow(2,16),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;c[y++]=t(g),E=y-1,p--;break;case 2:return v.join("");}if(p==0&&(p=Math.pow(2,P),P++),c[E])x=c[E];else if(E===y)x=f+f.charAt(0);else return null;v.push(x),c[y++]=f+x.charAt(0),p--,f=x,p==0&&(p=Math.pow(2,P),P++);}}};return o;}();h!=null?h.exports=r:(typeof angular==="undefined"?"undefined":_typeof(angular))<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return r;});})(wr);var hi=wr.exports;function Me(h){return JSON.parse(hi.decompress(h));}function Zt(h){return hi.compress(JSON.stringify(h));}var ui=/*#__PURE__*/function(_vt){function ui(t){var _this62;_classCallCheck(this,ui);_this62=_callSuper(this,ui,[t]);et(_this62,"canRotate",!0);et(_this62,"scaleType",jt.all);et(_this62,"toolsType",ut.Pencil);et(_this62,"syncTimestamp");et(_this62,"syncIndex",0);et(_this62,"tmpPoints",[]);et(_this62,"MAX_REPEAR",10);/** 合并原始点的灵敏度 */et(_this62,"uniThickness");et(_this62,"workOptions");et(_this62,"centerPos",[0,0]);_this62.workOptions=t.toolsOpt,_this62.uniThickness=_this62.MAX_REPEAR/_this62.workOptions.thickness/10,_this62.syncTimestamp=0;return _this62;}/** 批量合并消费本地数据,返回绘制结果 */_inherits(ui,_vt);return _createClass(ui,[{key:"combineConsume",value:function combineConsume(){var o;var t=(o=this.workId)==null?void 0:o.toString();if(this.tmpPoints.length<2)return{type:at.None};var e=this.transformDataAll(!0),n={name:t};var i;var a=this.drawLayer||this.fullLayer;return e.length&&(i=this.draw({attrs:n,tasks:e,replaceId:t,layer:a})),{rect:i,type:at.DrawWork,dataType:Mt.Local};}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(ui,"setWorkOptions",this,3)([t]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(t){var _this63=this;var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=t.drawCount,s=t.replaceId,l=e.workId,_this$transformData=this.transformData(e,!1),d=_this$transformData.tasks,c=_this$transformData.effects,p=_this$transformData.consumeIndex;this.syncIndex=Math.min(this.syncIndex,p,Math.max(0,this.tmpPoints.length-2));var y={name:l,id:o==null?void 0:o.toString()};var P,x=!1;var v=this.syncIndex;if(this.syncTimestamp===0&&(this.syncTimestamp=Date.now()),d.length&&(d[0].taskId-this.syncTimestamp>this.syncUnitTime&&(x=!0,this.syncTimestamp=d[0].taskId,this.syncIndex=this.tmpPoints.length),i||a)){var _f26=n?this.fullLayer:this.drawLayer||this.fullLayer;P=this.draw({attrs:y,tasks:d,effects:c,layer:_f26,replaceId:s});}if(i)return p>10&&this.tmpPoints.splice(0,p-10),{rect:P,type:at.DrawWork,dataType:Mt.Local};var T=[];return this.tmpPoints.slice(v).forEach(function(f){T.push(f.x,f.y,_this63.computRadius(f.z,_this63.workOptions.thickness));}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:at.DrawWork,dataType:Mt.Local,rect:P,op:x?T:void 0,index:x?v*3:void 0,updateNodeOpt:{useAnimation:!0}});}},{key:"consumeAll",value:function consumeAll(t){var d;var e=this.workId;if(t.data){var _t$data=t.data,c=_t$data.op,p=_t$data.workState;c!=null&&c.length&&p===It.Done&&this.workOptions.strokeType===Lt.Stroke&&this.updateTempPointsWithPressureWhenDone(c);}var n=this.transformDataAll(!0),i={name:e};var a;var o=this.fullLayer;if(n.length&&(a=this.draw({attrs:i,tasks:n,replaceId:e,layer:o})),this.tmpPoints.length<2)return this.replace(o,e),{type:at.RemoveNode,removeIds:[e],rect:a};var s=[];this.tmpPoints.map(function(c){s.push(c.x,c.y,c.z);}),this.syncTimestamp=0,delete this.workOptions.syncUnitTime;var l=Zt(s);return(d=this.vNodes)==null||d.setInfo(e,{rect:a,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:a&&vt.getCenterPos(a,o)}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{rect:a,type:at.FullWork,dataType:Mt.Local,ops:l,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 d,c;var e=t.op,n=t.isFullWork,i=t.replaceId;this.tmpPoints.length=0;for(var p=0;p<e.length;p+=3){var y=new xt(e[p],e[p+1],e[p+2]);if(this.tmpPoints.length>0){var P=this.tmpPoints[this.tmpPoints.length-1],x=_.Sub(y,P).uni();y.setv(x);}this.tmpPoints.push(y);}if(this.tmpPoints.length<2)return;var a=this.transformDataAll(!0),o=(d=this.workId)==null?void 0:d.toString(),s={name:o};var l;if(o&&a.length){var _p3=n?this.fullLayer:this.drawLayer||this.fullLayer;l=this.draw({attrs:s,tasks:a,replaceId:i,layer:_p3}),(c=this.vNodes)==null||c.setInfo(o,{rect:l,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:l&&vt.getCenterPos(l,_p3)});}return l;}},{key:"transformDataAll",value:function transformDataAll(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var e=this.filterSamePoints(this.tmpPoints,this.workOptions.thickness);return this.getTaskPoints(e,t&&this.workOptions.thickness||void 0);}},{key:"draw",value:function draw(t){var _this64=this;var e=t.attrs,n=t.tasks,i=t.replaceId,a=t.effects,o=t.layer,_this$workOptions=this.workOptions,s=_this$workOptions.strokeColor,l=_this$workOptions.strokeType,d=_this$workOptions.thickness,c=_this$workOptions.zIndex,p=_this$workOptions.scale,y=_this$workOptions.rotate,P=_this$workOptions.translate,x=_this$workOptions.eraserlines;a!=null&&a.size&&(a.forEach(function(m){var M;(M=o.getElementById(m+""))==null||M.remove();}),a.clear());var v;var T=[],f=o.worldPosition,g=o.worldScaling;for(var m=0;m<n.length;m++){var _n$m=n[m],M=_n$m.pos,E=_n$m.points,_this$computDrawPoint=this.computDrawPoints(E),A=_this$computDrawPoint.ps,b=_this$computDrawPoint.rect;var O=void 0;var L=E.length===1;l===Lt.Stroke||L?O=ae(A,!0):O=ae(A,!1);var w={pos:M,d:O,fillColor:l===Lt.Stroke||L?s:void 0,lineDash:l===Lt.Dotted&&!L?[1,d*2]:l===Lt.LongDotted&&!L?[d,d*2]:void 0,strokeColor:s,lineCap:l===Lt.Stroke||L?void 0:"round",lineWidth:l===Lt.Stroke||L?0:d};v=Pt(v,{x:Math.floor((b.x+M[0])*g[0]+f[0]-vt.SafeBorderPadding),y:Math.floor((b.y+M[1])*g[1]+f[1]-vt.SafeBorderPadding),w:Math.floor(b.w*g[0]+2*vt.SafeBorderPadding),h:Math.floor(b.h*g[1]+2*vt.SafeBorderPadding)}),T.push(w);}p&&(e.scale=p),y&&(e.rotate=y),P&&(e.translate=P);var u=new kt();if(v){this.centerPos=vt.getCenterPos(v,o);var _m12=l===Lt.Stroke&&!x;u.attr(_objectSpread(_objectSpread({},e),{},{normalize:!0,anchor:[0.5,0.5],bgcolor:_m12?s:void 0,pos:this.centerPos,size:[(v.w-2*vt.SafeBorderPadding)/g[0],(v.h-2*vt.SafeBorderPadding)/g[1]],zIndex:c}));var _M8=T.map(function(E){return E.pos=[E.pos[0]-_this64.centerPos[0],E.pos[1]-_this64.centerPos[1]],new ce(E);});u.append.apply(u,_toConsumableArray(_M8)),_m12&&u.seal(),x&&this.drawEraserlines({group:u,eraserlines:x,pos:this.centerPos,layer:o}),this.replace(o,i||e.workId,u);}if(p||y||P){var _m13=u==null?void 0:u.getBoundingClientRect();if(_m13)return{x:Math.floor(_m13.x-vt.SafeBorderPadding),y:Math.floor(_m13.y-vt.SafeBorderPadding),w:Math.floor(_m13.width+vt.SafeBorderPadding*2),h:Math.floor(_m13.height+vt.SafeBorderPadding*2)};}return v;}},{key:"computDrawPoints",value:function computDrawPoints(t){return this.workOptions.strokeType===Lt.Stroke||t.length===1?this.computStroke(t):this.computNomal(t);}},{key:"computNomal",value:function computNomal(t){var e=this.workOptions.thickness;var n=t.map(function(i){return e=Math.max(e,i.radius),i.point;});return{ps:n,rect:Bt(n,e)};}},{key:"computStroke",value:function computStroke(t){return t.length===1?this.computDotStroke(t[0]):this.computLineStroke(t);}},{key:"computLineStroke",value:function computLineStroke(t){var e=[],n=[];for(var l=0;l<t.length;l++){var _t$l=t[l],d=_t$l.point,c=_t$l.radius;var p=d.v;l===0&&t.length>1&&(p=t[l+1].point.v);var y=_.Per(p).mul(c);e.push(xt.Sub(d,y)),n.push(xt.Add(d,y));}var i=t[t.length-1],a=xt.GetSemicircleStroke(i.point,e[e.length-1],-1,8),o=xt.GetSemicircleStroke(t[0].point,n[0],-1,8),s=e.concat(a,n.reverse(),o);return{ps:s,rect:Bt(s)};}},{key:"computDotStroke",value:function computDotStroke(t){var e=t.point,n=t.radius,i={x:e.x-n,y:e.y-n,w:n*2,h:n*2};return{ps:xt.GetDotStroke(e,n,8),rect:i};}},{key:"transformData",value:function transformData(t,e){var n=t.op,i=t.workState;var a=this.tmpPoints.length-1,o=[];if(n!=null&&n.length&&i){var _this$workOptions2=this.workOptions,s=_this$workOptions2.strokeType,l=_this$workOptions2.thickness,d=/* @__PURE__ */new Set();a=s===Lt.Stroke?this.updateTempPointsWithPressure(n,l,d):this.updateTempPoints(n,l,d);var c=e?this.tmpPoints:this.tmpPoints.slice(a);return o=this.getTaskPoints(c,l),{tasks:o,effects:d,consumeIndex:a};}return{tasks:o,consumeIndex:a};}/** 压力渐变公式 */},{key:"computRadius",value:function computRadius(t,e){return t*0.03*e+e*0.5;}},{key:"getMinZ",value:function getMinZ(t,e){return((e||Math.max(1,Math.floor(t*0.3)))-t*0.5)*100/t/3;}},{key:"getTaskPoints",value:function getTaskPoints(t,e){var c;var n=[];if(t.length===0)return[];var i=0,a=t[0].x,o=t[0].y,s=[a,o],l=[],d=t[0].t;for(;i<t.length;){var p=t[i],y=p.x-a,P=p.y-o,x=p.z,v=e?this.computRadius(x,e):x;if(l.push({point:new xt(y,P,x,t[i].v),radius:v}),i>0&&i<t.length-1){var _T28=t[i].getAngleByPoints(t[i-1],t[i+1]);if(_T28<90||_T28>270){var _f27=(c=l.pop())==null?void 0:c.point.clone();_f27&&n.push({taskId:d,pos:s,points:[].concat(_toConsumableArray(l),[{point:_f27,radius:v}])}),a=t[i].x,o=t[i].y,s=[a,o];var g=p.x-a,u=p.y-o;l=[{point:new xt(g,u,x),radius:v}],d=Date.now();}}i++;}return n.push({taskId:d,pos:s,points:l}),n;}},{key:"updateTempPointsWithPressure",value:function updateTempPointsWithPressure(t,e,n){var i=Date.now(),a=this.tmpPoints.length;var o=a;for(var l=0;l<t.length;l+=2){o=Math.min(o,a);var d=this.tmpPoints.length,c=new xt(t[l],t[l+1]);if(d===0){this.tmpPoints.push(c);continue;}var p=d-1,y=this.tmpPoints[p],P=_.Sub(c,y).uni();if(c.isNear(y,e)){if(y.z<this.MAX_REPEAR){if(y.setz(Math.min(y.z+1,this.MAX_REPEAR)),o=Math.min(o,p),d>1){var _T29=d-1;for(;_T29>0;){var _f28=this.tmpPoints[_T29].distance(this.tmpPoints[_T29-1]),g=Math.max(this.tmpPoints[_T29].z-this.uniThickness*_f28,0);if(this.tmpPoints[_T29-1].z>=g)break;this.tmpPoints[_T29-1].setz(g),o=Math.min(o,_T29-1),_T29--;}}}else o=1/0;continue;}c.setv(P);var x=c.distance(y),v=Math.max(y.z-this.uniThickness*x,0);d>1&&_.Equals(P,y.v,0.02)&&(v>0||y.z<=0)&&(n&&y.t&&n.add(y.t),this.tmpPoints.pop(),o=Math.min(p,o)),c.setz(v),this.tmpPoints.push(c);}if(o===1/0)return this.tmpPoints.length;var s=a;if(o===a){s=Math.max(s-1,0);var _l4=this.tmpPoints[s].t;_l4&&(n==null||n.add(_l4));}else{var _l5=a-1;for(s=o;_l5>=0;){var _d6=this.tmpPoints[_l5].t;if(_d6&&(n==null||n.add(_d6),_l5<=o)){s=_l5,_l5=-1;break;}_l5--;}}return this.tmpPoints[s].setT(i),s;}},{key:"updateTempPoints",value:function updateTempPoints(t,e,n){var l;var i=Date.now(),a=this.tmpPoints.length;var o=a;for(var d=0;d<t.length;d+=2){var c=this.tmpPoints.length,p=new xt(t[d],t[d+1]);if(c===0){this.tmpPoints.push(p);continue;}var y=c-1,P=this.tmpPoints[y],x=_.Sub(p,P).uni();if(p.isNear(P,e/2)){o=Math.min(y,o);continue;}_.Equals(x,P.v,0.02)&&(n&&P.t&&n.add(P.t),this.tmpPoints.pop(),o=Math.min(y,o)),p.setv(x),this.tmpPoints.push(p);}var s=a;if(o===a){s=Math.max(s-1,0);var _d7=this.tmpPoints[s].t;_d7&&(n==null||n.add(_d7));}else{var _d8=Math.min(a-1,o);for(s=o;_d8>=0;){var _c4=(l=this.tmpPoints[_d8])==null?void 0:l.t;if(_c4&&(n==null||n.add(_c4),_d8<=o)){s=_d8,_d8=-1;break;}_d8--;}}return this.tmpPoints[s].setT(i),s;}},{key:"updateTempPointsWithPressureWhenDone",value:function updateTempPointsWithPressureWhenDone(t){var e=this.workOptions.thickness,n=t.length,i=this.getMinZ(e);for(var a=0;a<n;a+=2){var o=this.tmpPoints.length,s=new xt(t[a],t[a+1]);if(o===0){this.tmpPoints.push(s);continue;}var l=o-1,d=this.tmpPoints[l],c=_.Sub(s,d).uni(),p=s.distance(d);if(o>1&&d.z===i)break;if(s.isNear(d,e/2)){if(n<3&&d.z<this.MAX_REPEAR&&(d.setz(Math.min(d.z+1,this.MAX_REPEAR)),o>1)){var P=o-1;for(;P>0;){var x=this.tmpPoints[P].distance(this.tmpPoints[P-1]),v=Math.max(this.tmpPoints[P].z-this.uniThickness*x,-e/4);if(this.tmpPoints[P-1].z>=v)break;this.tmpPoints[P-1].setz(v),P--;}}continue;}s.setv(c);var y=Math.max(d.z-this.uniThickness*p,i);o>1&&_.Equals(c,d.v,0.02)&&d.z<=0&&this.tmpPoints.pop(),s.setz(y),this.tmpPoints.push(s);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var l,d;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.strokeType,s=i.get(e.name);return a&&(e.tagName==="GROUP"?Z0(e)?e.setAttribute("bgcolor",a):e.children.forEach(function(c){c.setAttribute("strokeColor",a),c.getAttribute("fillColor")&&c.setAttribute("fillColor",a);}):(e.setAttribute("strokeColor",a),e.setAttribute("fillColor",a)),(l=s==null?void 0:s.opt)!=null&&l.strokeColor&&(s.opt.strokeColor=a)),o&&s!=null&&s.opt&&(d=s.opt)!=null&&d.strokeType&&(s.opt.strokeType=o),s&&i.setInfo(e.name,s),vt.updateNodeOpt(t);}}]);}(vt);var di=/*#__PURE__*/function(_vt2){function di(t){var _this65;_classCallCheck(this,di);_this65=_callSuper(this,di,[t]);et(_this65,"toolsType",ut.LaserPen);et(_this65,"canRotate",!1);et(_this65,"scaleType",jt.none);et(_this65,"syncTimestamp");et(_this65,"syncIndex",0);et(_this65,"tmpPoints",[]);et(_this65,"workOptions");et(_this65,"consumeIndex",0);_this65.workOptions=t.toolsOpt,_this65.syncTimestamp=0;return _this65;}_inherits(di,_vt2);return _createClass(di,[{key:"combineConsume",value:function combineConsume(){}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(di,"setWorkOptions",this,3)([t]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(t){var e=t.data,n=t.isSubWorker,i=e.workId,a=e.op;if((a==null?void 0:a.length)===0)return{type:at.None};if(this.updateTempPoints(a||[]),this.consumeIndex>this.tmpPoints.length-4)return{type:at.None};var _this$workOptions3=this.workOptions,o=_this$workOptions3.strokeColor,s=_this$workOptions3.thickness,l=_this$workOptions3.strokeType,d=Bt(this.tmpPoints,s);var c=!1;var p=this.syncIndex,y=this.tmpPoints.slice(this.consumeIndex);this.consumeIndex=this.tmpPoints.length-1,this.syncTimestamp===0&&(this.syncTimestamp=Date.now());var P={name:i==null?void 0:i.toString(),opacity:1,lineDash:l===Lt.Dotted?[1,s*2]:l===Lt.LongDotted?[s,s*2]:void 0,strokeColor:o,lineCap:"round",lineWidth:s,anchor:[0.5,0.5]},x=this.getTaskPoints(y);if(x.length){var _T30=Date.now();_T30-this.syncTimestamp>this.syncUnitTime&&(c=!0,this.syncTimestamp=_T30,this.syncIndex=this.tmpPoints.length),n&&this.draw({attrs:P,tasks:x,isDot:!1,layer:this.drawLayer||this.fullLayer});}var v=[];return this.tmpPoints.slice(p).forEach(function(T){v.push(T.x,T.y);}),_objectSpread({rect:{x:d.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:d.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:d.w*this.fullLayer.worldScaling[0],h:d.h*this.fullLayer.worldScaling[1]},type:at.DrawWork,dataType:Mt.Local,op:c?v:void 0,index:c?p*2:void 0},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var t=(a=this.workId)==null?void 0:a.toString();var e;if(this.tmpPoints.length-1>this.consumeIndex){var o=this.tmpPoints.slice(this.consumeIndex);var s=o.length===1,_this$workOptions4=this.workOptions,l=_this$workOptions4.strokeColor,d=_this$workOptions4.thickness,c=_this$workOptions4.strokeType;if(s){var P=this.computDotStroke({point:o[0],radius:d/2});o=P.ps,e=P.rect;}else e=Bt(this.tmpPoints,d);var p={name:t==null?void 0:t.toString(),fillColor:s?l:void 0,opacity:1,lineDash:c===Lt.Dotted&&!s?[1,d*2]:c===Lt.LongDotted&&!s?[d,d*2]:void 0,strokeColor:l,lineCap:s?void 0:"round",lineWidth:s?0:d,anchor:[0.5,0.5]},y=this.getTaskPoints(o);y.length&&this.draw({attrs:p,tasks:y,isDot:s,layer:this.drawLayer||this.fullLayer});}var n=[];this.tmpPoints.forEach(function(o){n.push(o.x,o.y);});var i=Zt(n);return _objectSpread({rect:e&&{x:e.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:e.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:e.w*this.fullLayer.worldScaling[0],h:e.h*this.fullLayer.worldScaling[1]},type:at.FullWork,dataType:Mt.Local,ops:i,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 x;var e=t.op,n=t.replaceId,i=t.isFullWork,_this$workOptions5=this.workOptions,a=_this$workOptions5.strokeColor,o=_this$workOptions5.thickness,s=_this$workOptions5.strokeType;if(!e.length){var v=Bt(this.tmpPoints,o);return{x:v.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:v.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:v.w*this.fullLayer.worldScaling[0],h:v.h*this.fullLayer.worldScaling[1]};}var l=Math.max(0,this.tmpPoints.length-1);this.updateTempPoints(e||[]);var d,c=this.tmpPoints.slice(l);var p=c.length===1;if(p){var _v6=this.computDotStroke({point:c[0],radius:o/2});c=_v6.ps,d=_v6.rect;}else d=Bt(this.tmpPoints,o);var y={name:(x=this.workId)==null?void 0:x.toString(),fillColor:p?a:void 0,opacity:1,lineDash:s===Lt.Dotted&&!p?[1,o*2]:s===Lt.LongDotted&&!p?[o,o*2]:void 0,strokeColor:a,lineCap:p?void 0:"round",lineWidth:p?0:o,anchor:[0.5,0.5]},P=this.getTaskPoints(c);if(P.length){var _v7=i?this.fullLayer:this.drawLayer||this.fullLayer;this.draw({attrs:y,tasks:P,isDot:p,replaceId:n,layer:_v7});}return{x:d.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:d.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:d.w*this.fullLayer.worldScaling[0],h:d.h*this.fullLayer.worldScaling[1]};}},{key:"computDotStroke",value:function computDotStroke(t){var e=t.point,n=t.radius,i={x:e.x-n,y:e.y-n,w:n*2,h:n*2};return{ps:xt.GetDotStroke(e,n,8),rect:i};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=this.tmpPoints.length;for(var n=0;n<t.length;n+=2){if(e){var i=this.tmpPoints.slice(-1)[0];i&&i.x===t[n]&&i.y===t[n+1]&&this.tmpPoints.pop();}this.tmpPoints.push(new xt(t[n],t[n+1]));}}},{key:"draw",value:function(){var _draw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(t){var _this66=this;var e,n,i,a,o,_iterator15,_step15,_loop3;return _regeneratorRuntime().wrap(function _callee21$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:e=t.attrs,n=t.tasks,i=t.isDot,a=t.layer,o=this.workOptions.duration;_iterator15=_createForOfIteratorHelper(n);_context23.prev=2;_loop3=/*#__PURE__*/_regeneratorRuntime().mark(function _loop3(){var s,l,d,c,p,_this66$workOptions,y,P,x,_a$getResolution,v,_T31;return _regeneratorRuntime().wrap(function _loop3$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:s=_step15.value;l=new ce(),d=s.pos,c=s.points;i?p=ae(c,!0):p=ae(c,!1),l.attr(_objectSpread(_objectSpread({},e),{},{pos:d,d:p}));_this66$workOptions=_this66.workOptions,y=_this66$workOptions.vertex,P=_this66$workOptions.fragment;if(y&&P){x=a.renderer.createProgram({vertex:y,fragment:P}),_a$getResolution=a.getResolution(),v=_a$getResolution.width,_T31=_a$getResolution.height;l.setUniforms({u_time:0,u_resolution:[v,_T31]}),l.setProgram(x);}a.appendChild(l),l.transition(o).attr({scale:i?[0.1,0.1]:[1,1],lineWidth:i?0:1}).then(function(){l.remove();});case 6:case"end":return _context22.stop();}},_loop3);});_iterator15.s();case 5:if((_step15=_iterator15.n()).done){_context23.next=9;break;}return _context23.delegateYield(_loop3(),"t0",7);case 7:_context23.next=5;break;case 9:_context23.next=14;break;case 11:_context23.prev=11;_context23.t1=_context23["catch"](2);_iterator15.e(_context23.t1);case 14:_context23.prev=14;_iterator15.f();return _context23.finish(14);case 17:case"end":return _context23.stop();}},_callee21,this,[[2,11,14,17]]);}));function draw(_x25){return _draw2.apply(this,arguments);}return draw;}()},{key:"getTaskPoints",value:function getTaskPoints(t){var l;var e=[];if(t.length===0)return[];var n=0,i=t[0].x,a=t[0].y,o=[i,a],s=[];for(;n<t.length;){var d=t[n],c=d.x-i,p=d.y-a;if(s.push(new xt(c,p)),n>0&&n<t.length-1){var y=t[n].getAngleByPoints(t[n-1],t[n+1]);if(y<90||y>270){var P=(l=s.pop())==null?void 0:l.clone();P&&e.push({pos:o,points:[].concat(_toConsumableArray(s),[P])}),i=t[n].x,a=t[n].y,o=[i,a];var x=d.x-i,v=d.y-a;s=[new xt(x,v)];}}n++;}return e.push({pos:o,points:s}),e;}},{key:"removeLocal",value:function removeLocal(){}},{key:"removeService",value:function removeService(t){var e;var n=[];return this.fullLayer.getElementsByName(t).forEach(function(i){if(i.name===t){var a=i.getBoundingClientRect();e=Pt(e,{x:a.x,y:a.y,w:a.width,h:a.height}),n.push(i);}}),n.length&&n.forEach(function(i){return i.remove();}),e;}}]);}(vt);var bd=Ke;Ke.polyline=Ke;Ke.polygon=wd;function Ke(h,r,t){var e=h.length,n=ve(h[0],r),i=[],a,o,s,l,d;for(t||(t=[]),a=1;a<e;a++){for(o=h[a-1],s=h[a],l=d=ve(s,r);;)if(n|l){if(n&l)break;n?(o=yr(o,s,n,r),n=ve(o,r)):(s=yr(o,s,l,r),l=ve(s,r));}else{i.push(o),l!==d?(i.push(s),a<e-1&&(t.push(i),i=[])):a===e-1&&i.push(s);break;}n=d;}return i.length&&t.push(i),t;}function wd(h,r){var t,e,n,i,a,o,s;for(e=1;e<=8;e*=2){for(t=[],n=h[h.length-1],i=!(ve(n,r)&e),a=0;a<h.length;a++)o=h[a],s=!(ve(o,r)&e),s!==i&&t.push(yr(n,o,e,r)),s&&t.push(o),n=o,i=s;if(h=t,!h.length)break;}return t;}function yr(h,r,t,e){return t&8?[h[0]+(r[0]-h[0])*(e[3]-h[1])/(r[1]-h[1]),e[3]]:// top
403
+ decompressFromEncodedURIComponent:function decompressFromEncodedURIComponent(s){return s==null?"":s==""?null:(s=s.replace(/ /g,"+"),o._decompress(s.length,32,function(l){return a(n,s.charAt(l));}));},compress:function compress(s){return o._compress(s,16,function(l){return t(l);});},_compress:function _compress(s,l,d){if(s==null)return"";var c,p,y={},P={},x="",v="",T="",f=2,g=3,u=2,m=[],M=0,E=0,A;for(A=0;A<s.length;A+=1)if(x=s.charAt(A),Object.prototype.hasOwnProperty.call(y,x)||(y[x]=g++,P[x]=!0),v=T+x,Object.prototype.hasOwnProperty.call(y,v))T=v;else{if(Object.prototype.hasOwnProperty.call(P,T)){if(T.charCodeAt(0)<256){for(c=0;c<u;c++)M=M<<1,E==l-1?(E=0,m.push(d(M)),M=0):E++;for(p=T.charCodeAt(0),c=0;c<8;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;}else{for(p=1,c=0;c<u;c++)M=M<<1|p,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=0;for(p=T.charCodeAt(0),c=0;c<16;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;}f--,f==0&&(f=Math.pow(2,u),u++),delete P[T];}else for(p=y[T],c=0;c<u;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;f--,f==0&&(f=Math.pow(2,u),u++),y[v]=g++,T=String(x);}if(T!==""){if(Object.prototype.hasOwnProperty.call(P,T)){if(T.charCodeAt(0)<256){for(c=0;c<u;c++)M=M<<1,E==l-1?(E=0,m.push(d(M)),M=0):E++;for(p=T.charCodeAt(0),c=0;c<8;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;}else{for(p=1,c=0;c<u;c++)M=M<<1|p,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=0;for(p=T.charCodeAt(0),c=0;c<16;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;}f--,f==0&&(f=Math.pow(2,u),u++),delete P[T];}else for(p=y[T],c=0;c<u;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;f--,f==0&&(f=Math.pow(2,u),u++);}for(p=2,c=0;c<u;c++)M=M<<1|p&1,E==l-1?(E=0,m.push(d(M)),M=0):E++,p=p>>1;for(;;)if(M=M<<1,E==l-1){m.push(d(M));break;}else E++;return m.join("");},decompress:function decompress(s){return s==null?"":s==""?null:o._decompress(s.length,32768,function(l){return s.charCodeAt(l);});},_decompress:function _decompress(s,l,d){var c=[],p=4,y=4,P=3,x="",v=[],T,f,g,u,m,M,E,A={val:d(0),position:l,index:1};for(T=0;T<3;T+=1)c[T]=T;for(g=0,m=Math.pow(2,2),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;switch(g){case 0:for(g=0,m=Math.pow(2,8),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;E=t(g);break;case 1:for(g=0,m=Math.pow(2,16),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;E=t(g);break;case 2:return"";}for(c[3]=E,f=E,v.push(E);;){if(A.index>s)return"";for(g=0,m=Math.pow(2,P),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;switch(E=g){case 0:for(g=0,m=Math.pow(2,8),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;c[y++]=t(g),E=y-1,p--;break;case 1:for(g=0,m=Math.pow(2,16),M=1;M!=m;)u=A.val&A.position,A.position>>=1,A.position==0&&(A.position=l,A.val=d(A.index++)),g|=(u>0?1:0)*M,M<<=1;c[y++]=t(g),E=y-1,p--;break;case 2:return v.join("");}if(p==0&&(p=Math.pow(2,P),P++),c[E])x=c[E];else if(E===y)x=f+f.charAt(0);else return null;v.push(x),c[y++]=f+x.charAt(0),p--,f=x,p==0&&(p=Math.pow(2,P),P++);}}};return o;}();h!=null?h.exports=r:(typeof angular==="undefined"?"undefined":_typeof(angular))<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return r;});})(wr);var hi=wr.exports;function Me(h){return JSON.parse(hi.decompress(h));}function Zt(h){return hi.compress(JSON.stringify(h));}var ui=/*#__PURE__*/function(_vt){function ui(t){var _this62;_classCallCheck(this,ui);_this62=_callSuper(this,ui,[t]);et(_this62,"canRotate",!0);et(_this62,"scaleType",jt.all);et(_this62,"toolsType",ut.Pencil);et(_this62,"syncTimestamp");et(_this62,"syncIndex",0);et(_this62,"tmpPoints",[]);et(_this62,"MAX_REPEAR",10);/** 合并原始点的灵敏度 */et(_this62,"uniThickness");et(_this62,"workOptions");et(_this62,"centerPos",[0,0]);_this62.workOptions=t.toolsOpt,_this62.uniThickness=_this62.MAX_REPEAR/_this62.workOptions.thickness/10,_this62.syncTimestamp=0;return _this62;}/** 批量合并消费本地数据,返回绘制结果 */_inherits(ui,_vt);return _createClass(ui,[{key:"combineConsume",value:function combineConsume(){var o;var t=(o=this.workId)==null?void 0:o.toString();if(this.tmpPoints.length<2)return{type:at.None};var e=this.transformDataAll(!0),n={name:t};var i;var a=this.drawLayer||this.fullLayer;return e.length&&(i=this.draw({attrs:n,tasks:e,replaceId:t,layer:a})),{rect:i,type:at.DrawWork,dataType:Mt.Local};}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(ui,"setWorkOptions",this,3)([t]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(t){var _this63=this;var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=t.drawCount,s=t.replaceId,l=e.workId,_this$transformData=this.transformData(e,!1),d=_this$transformData.tasks,c=_this$transformData.effects,p=_this$transformData.consumeIndex;this.syncIndex=Math.min(this.syncIndex,p,Math.max(0,this.tmpPoints.length-2));var y={name:l,id:o==null?void 0:o.toString()};var P,x=!1;var v=this.syncIndex;if(this.syncTimestamp===0&&(this.syncTimestamp=Date.now()),d.length&&(d[0].taskId-this.syncTimestamp>this.syncUnitTime&&(x=!0,this.syncTimestamp=d[0].taskId,this.syncIndex=this.tmpPoints.length),i||a)){var _f26=n?this.fullLayer:this.drawLayer||this.fullLayer;P=this.draw({attrs:y,tasks:d,effects:c,layer:_f26,replaceId:s});}if(i)return p>10&&this.tmpPoints.splice(0,p-10),{rect:P,type:at.DrawWork,dataType:Mt.Local};var T=[];return this.tmpPoints.slice(v).forEach(function(f){T.push(f.x,f.y,_this63.computRadius(f.z,_this63.workOptions.thickness));}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:at.DrawWork,dataType:Mt.Local,rect:P,op:x?T:void 0,index:x?v*3:void 0,updateNodeOpt:{useAnimation:!0}});}},{key:"consumeAll",value:function consumeAll(t){var d;var e=this.workId;if(t.data){var _t$data=t.data,c=_t$data.op,p=_t$data.workState;c!=null&&c.length&&p===It.Done&&this.workOptions.strokeType===Lt.Stroke&&this.updateTempPointsWithPressureWhenDone(c);}var n=this.transformDataAll(!0),i={name:e};var a;var o=this.fullLayer;if(n.length&&(a=this.draw({attrs:i,tasks:n,replaceId:e,layer:o})),this.tmpPoints.length<2)return this.replace(o,e),{type:at.RemoveNode,removeIds:[e],rect:a};var s=[];this.tmpPoints.map(function(c){s.push(c.x,c.y,c.z);}),this.syncTimestamp=0,delete this.workOptions.syncUnitTime;var l=Zt(s);return(d=this.vNodes)==null||d.setInfo(e,{rect:a,op:s,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:a&&vt.getCenterPos(a,o)}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{rect:a,type:at.FullWork,dataType:Mt.Local,ops:l,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 d,c;var e=t.op,n=t.isFullWork,i=t.replaceId;this.tmpPoints.length=0;for(var p=0;p<e.length;p+=3){var y=new xt(e[p],e[p+1],e[p+2]);if(this.tmpPoints.length>0){var P=this.tmpPoints[this.tmpPoints.length-1],x=_.Sub(y,P).uni();y.setv(x);}this.tmpPoints.push(y);}if(this.tmpPoints.length<2)return;var a=this.transformDataAll(!0),o=(d=this.workId)==null?void 0:d.toString(),s={name:o};var l;if(o&&a.length){var _p3=n?this.fullLayer:this.drawLayer||this.fullLayer;l=this.draw({attrs:s,tasks:a,replaceId:i,layer:_p3}),(c=this.vNodes)==null||c.setInfo(o,{rect:l,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:l&&vt.getCenterPos(l,_p3)});}return l;}},{key:"transformDataAll",value:function transformDataAll(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var e=this.filterSamePoints(this.tmpPoints,this.workOptions.thickness);return this.getTaskPoints(e,t&&this.workOptions.thickness||void 0);}},{key:"draw",value:function draw(t){var _this64=this;var e=t.attrs,n=t.tasks,i=t.replaceId,a=t.effects,o=t.layer,_this$workOptions=this.workOptions,s=_this$workOptions.strokeColor,l=_this$workOptions.strokeType,d=_this$workOptions.thickness,c=_this$workOptions.zIndex,p=_this$workOptions.scale,y=_this$workOptions.rotate,P=_this$workOptions.translate,x=_this$workOptions.eraserlines;a!=null&&a.size&&(a.forEach(function(m){var M;(M=o.getElementById(m+""))==null||M.remove();}),a.clear());var v;var T=[],f=o.worldPosition,g=o.worldScaling;for(var m=0;m<n.length;m++){var _n$m=n[m],M=_n$m.pos,E=_n$m.points,_this$computDrawPoint=this.computDrawPoints(E),A=_this$computDrawPoint.ps,b=_this$computDrawPoint.rect;var O=void 0;var L=E.length===1;l===Lt.Stroke||L?O=ae(A,!0):O=ae(A,!1);var w={pos:M,d:O,fillColor:l===Lt.Stroke||L?s:void 0,lineDash:l===Lt.Dotted&&!L?[1,d*2]:l===Lt.LongDotted&&!L?[d,d*2]:void 0,strokeColor:s,lineCap:l===Lt.Stroke||L?void 0:"round",lineWidth:l===Lt.Stroke||L?0:d};v=Pt(v,{x:Math.floor((b.x+M[0])*g[0]+f[0]-vt.SafeBorderPadding),y:Math.floor((b.y+M[1])*g[1]+f[1]-vt.SafeBorderPadding),w:Math.floor(b.w*g[0]+2*vt.SafeBorderPadding),h:Math.floor(b.h*g[1]+2*vt.SafeBorderPadding)}),T.push(w);}p&&(e.scale=p),y&&(e.rotate=y),P&&(e.translate=P);var u=new kt();if(v){this.centerPos=vt.getCenterPos(v,o);var _m12=l===Lt.Stroke&&!x;u.attr(_objectSpread(_objectSpread({},e),{},{normalize:!0,anchor:[0.5,0.5],bgcolor:_m12?s:void 0,pos:this.centerPos,size:[(v.w-2*vt.SafeBorderPadding)/g[0],(v.h-2*vt.SafeBorderPadding)/g[1]],zIndex:c}));var _M8=T.map(function(E){return E.pos=[E.pos[0]-_this64.centerPos[0],E.pos[1]-_this64.centerPos[1]],new ce(E);});u.append.apply(u,_toConsumableArray(_M8)),_m12&&u.seal(),x&&this.drawEraserlines({group:u,eraserlines:x,pos:this.centerPos,layer:o}),this.replace(o,i||e.workId,u);}if(p||y||P){var _m13=u==null?void 0:u.getBoundingClientRect();if(_m13)return{x:Math.floor(_m13.x-vt.SafeBorderPadding),y:Math.floor(_m13.y-vt.SafeBorderPadding),w:Math.floor(_m13.width+vt.SafeBorderPadding*2),h:Math.floor(_m13.height+vt.SafeBorderPadding*2)};}return v;}},{key:"computDrawPoints",value:function computDrawPoints(t){return this.workOptions.strokeType===Lt.Stroke||t.length===1?this.computStroke(t):this.computNomal(t);}},{key:"computNomal",value:function computNomal(t){var e=this.workOptions.thickness;var n=t.map(function(i){return e=Math.max(e,i.radius),i.point;});return{ps:n,rect:Bt(n,e)};}},{key:"computStroke",value:function computStroke(t){return t.length===1?this.computDotStroke(t[0]):this.computLineStroke(t);}},{key:"computLineStroke",value:function computLineStroke(t){var e=[],n=[];for(var l=0;l<t.length;l++){var _t$l=t[l],d=_t$l.point,c=_t$l.radius;var p=d.v;l===0&&t.length>1&&(p=t[l+1].point.v);var y=_.Per(p).mul(c);e.push(xt.Sub(d,y)),n.push(xt.Add(d,y));}var i=t[t.length-1],a=xt.GetSemicircleStroke(i.point,e[e.length-1],-1,8),o=xt.GetSemicircleStroke(t[0].point,n[0],-1,8),s=e.concat(a,n.reverse(),o);return{ps:s,rect:Bt(s)};}},{key:"computDotStroke",value:function computDotStroke(t){var e=t.point,n=t.radius,i={x:e.x-n,y:e.y-n,w:n*2,h:n*2};return{ps:xt.GetDotStroke(e,n,8),rect:i};}},{key:"transformData",value:function transformData(t,e){var n=t.op,i=t.workState;var a=this.tmpPoints.length-1,o=[];if(n!=null&&n.length&&i){var _this$workOptions2=this.workOptions,s=_this$workOptions2.strokeType,l=_this$workOptions2.thickness,d=/* @__PURE__ */new Set();a=s===Lt.Stroke?this.updateTempPointsWithPressure(n,l,d):this.updateTempPoints(n,l,d);var c=e?this.tmpPoints:this.tmpPoints.slice(a);return o=this.getTaskPoints(c,l),{tasks:o,effects:d,consumeIndex:a};}return{tasks:o,consumeIndex:a};}/** 压力渐变公式 */},{key:"computRadius",value:function computRadius(t,e){return t*0.03*e+e*0.5;}},{key:"getMinZ",value:function getMinZ(t,e){return((e||Math.max(1,Math.floor(t*0.3)))-t*0.5)*100/t/3;}},{key:"getTaskPoints",value:function getTaskPoints(t,e){var c;var n=[];if(t.length===0)return[];var i=0,a=t[0].x,o=t[0].y,s=[a,o],l=[],d=t[0].t;for(;i<t.length;){var p=t[i],y=p.x-a,P=p.y-o,x=p.z,v=e?this.computRadius(x,e):x;if(l.push({point:new xt(y,P,x,t[i].v),radius:v}),i>0&&i<t.length-1){var _T28=t[i].getAngleByPoints(t[i-1],t[i+1]);if(_T28<90||_T28>270){var _f27=(c=l.pop())==null?void 0:c.point.clone();_f27&&n.push({taskId:d,pos:s,points:[].concat(_toConsumableArray(l),[{point:_f27,radius:v}])}),a=t[i].x,o=t[i].y,s=[a,o];var g=p.x-a,u=p.y-o;l=[{point:new xt(g,u,x),radius:v}],d=Date.now();}}i++;}return n.push({taskId:d,pos:s,points:l}),n;}},{key:"updateTempPointsWithPressure",value:function updateTempPointsWithPressure(t,e,n){var i=Date.now(),a=this.tmpPoints.length;var o=a;for(var l=0;l<t.length;l+=2){o=Math.min(o,a);var d=this.tmpPoints.length,c=new xt(t[l],t[l+1]);if(d===0){this.tmpPoints.push(c);continue;}var p=d-1,y=this.tmpPoints[p],P=_.Sub(c,y).uni();if(c.isNear(y,e)){if(y.z<this.MAX_REPEAR){if(y.setz(Math.min(y.z+1,this.MAX_REPEAR)),o=Math.min(o,p),d>1){var _T29=d-1;for(;_T29>0;){var _f28=this.tmpPoints[_T29].distance(this.tmpPoints[_T29-1]),g=Math.max(this.tmpPoints[_T29].z-this.uniThickness*_f28,0);if(this.tmpPoints[_T29-1].z>=g)break;this.tmpPoints[_T29-1].setz(g),o=Math.min(o,_T29-1),_T29--;}}}else o=1/0;continue;}c.setv(P);var x=c.distance(y),v=Math.max(y.z-this.uniThickness*x,0);d>1&&_.Equals(P,y.v,0.02)&&(v>0||y.z<=0)&&(n&&y.t&&n.add(y.t),this.tmpPoints.pop(),o=Math.min(p,o)),c.setz(v),this.tmpPoints.push(c);}if(o===1/0)return this.tmpPoints.length;var s=a;if(o===a){s=Math.max(s-1,0);var _l4=this.tmpPoints[s].t;_l4&&(n==null||n.add(_l4));}else{var _l5=a-1;for(s=o;_l5>=0;){var _d6=this.tmpPoints[_l5].t;if(_d6&&(n==null||n.add(_d6),_l5<=o)){s=_l5,_l5=-1;break;}_l5--;}}return this.tmpPoints[s].setT(i),s;}},{key:"updateTempPoints",value:function updateTempPoints(t,e,n){var l;var i=Date.now(),a=this.tmpPoints.length;var o=a;for(var d=0;d<t.length;d+=2){var c=this.tmpPoints.length,p=new xt(t[d],t[d+1]);if(c===0){this.tmpPoints.push(p);continue;}var y=c-1,P=this.tmpPoints[y],x=_.Sub(p,P).uni();if(p.isNear(P,e/2)){o=Math.min(y,o);continue;}_.Equals(x,P.v,0.02)&&(n&&P.t&&n.add(P.t),this.tmpPoints.pop(),o=Math.min(y,o)),p.setv(x),this.tmpPoints.push(p);}var s=a;if(o===a){s=Math.max(s-1,0);var _d7=this.tmpPoints[s].t;_d7&&(n==null||n.add(_d7));}else{var _d8=Math.min(a-1,o);for(s=o;_d8>=0;){var _c4=(l=this.tmpPoints[_d8])==null?void 0:l.t;if(_c4&&(n==null||n.add(_c4),_d8<=o)){s=_d8,_d8=-1;break;}_d8--;}}return this.tmpPoints[s].setT(i),s;}},{key:"updateTempPointsWithPressureWhenDone",value:function updateTempPointsWithPressureWhenDone(t){var e=this.workOptions.thickness,n=t.length,i=this.getMinZ(e);for(var a=0;a<n;a+=2){var o=this.tmpPoints.length,s=new xt(t[a],t[a+1]);if(o===0){this.tmpPoints.push(s);continue;}var l=o-1,d=this.tmpPoints[l],c=_.Sub(s,d).uni(),p=s.distance(d);if(o>1&&d.z===i)break;if(s.isNear(d,e/2)){if(n<3&&d.z<this.MAX_REPEAR&&(d.setz(Math.min(d.z+1,this.MAX_REPEAR)),o>1)){var P=o-1;for(;P>0;){var x=this.tmpPoints[P].distance(this.tmpPoints[P-1]),v=Math.max(this.tmpPoints[P].z-this.uniThickness*x,-e/4);if(this.tmpPoints[P-1].z>=v)break;this.tmpPoints[P-1].setz(v),P--;}}continue;}s.setv(c);var y=Math.max(d.z-this.uniThickness*p,i);o>1&&_.Equals(c,d.v,0.02)&&d.z<=0&&this.tmpPoints.pop(),s.setz(y),this.tmpPoints.push(s);}}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var l,d;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.strokeType,s=i.get(e.name);return a&&(e.tagName==="GROUP"?Qg(e)?e.setAttribute("bgcolor",a):e.children.forEach(function(c){c.setAttribute("strokeColor",a),c.getAttribute("fillColor")&&c.setAttribute("fillColor",a);}):(e.setAttribute("strokeColor",a),e.setAttribute("fillColor",a)),(l=s==null?void 0:s.opt)!=null&&l.strokeColor&&(s.opt.strokeColor=a)),o&&s!=null&&s.opt&&(d=s.opt)!=null&&d.strokeType&&(s.opt.strokeType=o),s&&i.setInfo(e.name,s),vt.updateNodeOpt(t);}}]);}(vt);var di=/*#__PURE__*/function(_vt2){function di(t){var _this65;_classCallCheck(this,di);_this65=_callSuper(this,di,[t]);et(_this65,"toolsType",ut.LaserPen);et(_this65,"canRotate",!1);et(_this65,"scaleType",jt.none);et(_this65,"syncTimestamp");et(_this65,"syncIndex",0);et(_this65,"tmpPoints",[]);et(_this65,"workOptions");et(_this65,"consumeIndex",0);_this65.workOptions=t.toolsOpt,_this65.syncTimestamp=0;return _this65;}_inherits(di,_vt2);return _createClass(di,[{key:"combineConsume",value:function combineConsume(){}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(di,"setWorkOptions",this,3)([t]),this.syncTimestamp=Date.now();}},{key:"consume",value:function consume(t){var e=t.data,n=t.isSubWorker,i=e.workId,a=e.op;if((a==null?void 0:a.length)===0)return{type:at.None};if(this.updateTempPoints(a||[]),this.consumeIndex>this.tmpPoints.length-4)return{type:at.None};var _this$workOptions3=this.workOptions,o=_this$workOptions3.strokeColor,s=_this$workOptions3.thickness,l=_this$workOptions3.strokeType,d=Bt(this.tmpPoints,s);var c=!1;var p=this.syncIndex,y=this.tmpPoints.slice(this.consumeIndex);this.consumeIndex=this.tmpPoints.length-1,this.syncTimestamp===0&&(this.syncTimestamp=Date.now());var P={name:i==null?void 0:i.toString(),opacity:1,lineDash:l===Lt.Dotted?[1,s*2]:l===Lt.LongDotted?[s,s*2]:void 0,strokeColor:o,lineCap:"round",lineWidth:s,anchor:[0.5,0.5]},x=this.getTaskPoints(y);if(x.length){var _T30=Date.now();_T30-this.syncTimestamp>this.syncUnitTime&&(c=!0,this.syncTimestamp=_T30,this.syncIndex=this.tmpPoints.length),n&&this.draw({attrs:P,tasks:x,isDot:!1,layer:this.drawLayer||this.fullLayer});}var v=[];return this.tmpPoints.slice(p).forEach(function(T){v.push(T.x,T.y);}),_objectSpread({rect:{x:d.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:d.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:d.w*this.fullLayer.worldScaling[0],h:d.h*this.fullLayer.worldScaling[1]},type:at.DrawWork,dataType:Mt.Local,op:c?v:void 0,index:c?p*2:void 0},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var a;var t=(a=this.workId)==null?void 0:a.toString();var e;if(this.tmpPoints.length-1>this.consumeIndex){var o=this.tmpPoints.slice(this.consumeIndex);var s=o.length===1,_this$workOptions4=this.workOptions,l=_this$workOptions4.strokeColor,d=_this$workOptions4.thickness,c=_this$workOptions4.strokeType;if(s){var P=this.computDotStroke({point:o[0],radius:d/2});o=P.ps,e=P.rect;}else e=Bt(this.tmpPoints,d);var p={name:t==null?void 0:t.toString(),fillColor:s?l:void 0,opacity:1,lineDash:c===Lt.Dotted&&!s?[1,d*2]:c===Lt.LongDotted&&!s?[d,d*2]:void 0,strokeColor:l,lineCap:s?void 0:"round",lineWidth:s?0:d,anchor:[0.5,0.5]},y=this.getTaskPoints(o);y.length&&this.draw({attrs:p,tasks:y,isDot:s,layer:this.drawLayer||this.fullLayer});}var n=[];this.tmpPoints.forEach(function(o){n.push(o.x,o.y);});var i=Zt(n);return _objectSpread({rect:e&&{x:e.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:e.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:e.w*this.fullLayer.worldScaling[0],h:e.h*this.fullLayer.worldScaling[1]},type:at.FullWork,dataType:Mt.Local,ops:i,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 x;var e=t.op,n=t.replaceId,i=t.isFullWork,_this$workOptions5=this.workOptions,a=_this$workOptions5.strokeColor,o=_this$workOptions5.thickness,s=_this$workOptions5.strokeType;if(!e.length){var v=Bt(this.tmpPoints,o);return{x:v.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:v.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:v.w*this.fullLayer.worldScaling[0],h:v.h*this.fullLayer.worldScaling[1]};}var l=Math.max(0,this.tmpPoints.length-1);this.updateTempPoints(e||[]);var d,c=this.tmpPoints.slice(l);var p=c.length===1;if(p){var _v6=this.computDotStroke({point:c[0],radius:o/2});c=_v6.ps,d=_v6.rect;}else d=Bt(this.tmpPoints,o);var y={name:(x=this.workId)==null?void 0:x.toString(),fillColor:p?a:void 0,opacity:1,lineDash:s===Lt.Dotted&&!p?[1,o*2]:s===Lt.LongDotted&&!p?[o,o*2]:void 0,strokeColor:a,lineCap:p?void 0:"round",lineWidth:p?0:o,anchor:[0.5,0.5]},P=this.getTaskPoints(c);if(P.length){var _v7=i?this.fullLayer:this.drawLayer||this.fullLayer;this.draw({attrs:y,tasks:P,isDot:p,replaceId:n,layer:_v7});}return{x:d.x*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],y:d.y*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1],w:d.w*this.fullLayer.worldScaling[0],h:d.h*this.fullLayer.worldScaling[1]};}},{key:"computDotStroke",value:function computDotStroke(t){var e=t.point,n=t.radius,i={x:e.x-n,y:e.y-n,w:n*2,h:n*2};return{ps:xt.GetDotStroke(e,n,8),rect:i};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=this.tmpPoints.length;for(var n=0;n<t.length;n+=2){if(e){var i=this.tmpPoints.slice(-1)[0];i&&i.x===t[n]&&i.y===t[n+1]&&this.tmpPoints.pop();}this.tmpPoints.push(new xt(t[n],t[n+1]));}}},{key:"draw",value:function(){var _draw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(t){var _this66=this;var e,n,i,a,o,_iterator15,_step15,_loop3;return _regeneratorRuntime().wrap(function _callee21$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:e=t.attrs,n=t.tasks,i=t.isDot,a=t.layer,o=this.workOptions.duration;_iterator15=_createForOfIteratorHelper(n);_context23.prev=2;_loop3=/*#__PURE__*/_regeneratorRuntime().mark(function _loop3(){var s,l,d,c,p,_this66$workOptions,y,P,x,_a$getResolution,v,_T31;return _regeneratorRuntime().wrap(function _loop3$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:s=_step15.value;l=new ce(),d=s.pos,c=s.points;i?p=ae(c,!0):p=ae(c,!1),l.attr(_objectSpread(_objectSpread({},e),{},{pos:d,d:p}));_this66$workOptions=_this66.workOptions,y=_this66$workOptions.vertex,P=_this66$workOptions.fragment;if(y&&P){x=a.renderer.createProgram({vertex:y,fragment:P}),_a$getResolution=a.getResolution(),v=_a$getResolution.width,_T31=_a$getResolution.height;l.setUniforms({u_time:0,u_resolution:[v,_T31]}),l.setProgram(x);}a.appendChild(l),l.transition(o).attr({scale:i?[0.1,0.1]:[1,1],lineWidth:i?0:1}).then(function(){l.remove();});case 6:case"end":return _context22.stop();}},_loop3);});_iterator15.s();case 5:if((_step15=_iterator15.n()).done){_context23.next=9;break;}return _context23.delegateYield(_loop3(),"t0",7);case 7:_context23.next=5;break;case 9:_context23.next=14;break;case 11:_context23.prev=11;_context23.t1=_context23["catch"](2);_iterator15.e(_context23.t1);case 14:_context23.prev=14;_iterator15.f();return _context23.finish(14);case 17:case"end":return _context23.stop();}},_callee21,this,[[2,11,14,17]]);}));function draw(_x25){return _draw2.apply(this,arguments);}return draw;}()},{key:"getTaskPoints",value:function getTaskPoints(t){var l;var e=[];if(t.length===0)return[];var n=0,i=t[0].x,a=t[0].y,o=[i,a],s=[];for(;n<t.length;){var d=t[n],c=d.x-i,p=d.y-a;if(s.push(new xt(c,p)),n>0&&n<t.length-1){var y=t[n].getAngleByPoints(t[n-1],t[n+1]);if(y<90||y>270){var P=(l=s.pop())==null?void 0:l.clone();P&&e.push({pos:o,points:[].concat(_toConsumableArray(s),[P])}),i=t[n].x,a=t[n].y,o=[i,a];var x=d.x-i,v=d.y-a;s=[new xt(x,v)];}}n++;}return e.push({pos:o,points:s}),e;}},{key:"removeLocal",value:function removeLocal(){}},{key:"removeService",value:function removeService(t){var e;var n=[];return this.fullLayer.getElementsByName(t).forEach(function(i){if(i.name===t){var a=i.getBoundingClientRect();e=Pt(e,{x:a.x,y:a.y,w:a.width,h:a.height}),n.push(i);}}),n.length&&n.forEach(function(i){return i.remove();}),e;}}]);}(vt);var wd=Ke;Ke.polyline=Ke;Ke.polygon=Dd;function Ke(h,r,t){var e=h.length,n=ve(h[0],r),i=[],a,o,s,l,d;for(t||(t=[]),a=1;a<e;a++){for(o=h[a-1],s=h[a],l=d=ve(s,r);;)if(n|l){if(n&l)break;n?(o=yr(o,s,n,r),n=ve(o,r)):(s=yr(o,s,l,r),l=ve(s,r));}else{i.push(o),l!==d?(i.push(s),a<e-1&&(t.push(i),i=[])):a===e-1&&i.push(s);break;}n=d;}return i.length&&t.push(i),t;}function Dd(h,r){var t,e,n,i,a,o,s;for(e=1;e<=8;e*=2){for(t=[],n=h[h.length-1],i=!(ve(n,r)&e),a=0;a<h.length;a++)o=h[a],s=!(ve(o,r)&e),s!==i&&t.push(yr(n,o,e,r)),s&&t.push(o),n=o,i=s;if(h=t,!h.length)break;}return t;}function yr(h,r,t,e){return t&8?[h[0]+(r[0]-h[0])*(e[3]-h[1])/(r[1]-h[1]),e[3]]:// top
404
404
  t&4?[h[0]+(r[0]-h[0])*(e[1]-h[1])/(r[1]-h[1]),e[1]]:// bottom
405
405
  t&2?[e[2],h[1]+(r[1]-h[1])*(e[2]-h[0])/(r[0]-h[0])]:// right
406
406
  t&1?[e[0],h[1]+(r[1]-h[1])*(e[0]-h[0])/(r[0]-h[0])]:// left
407
- null;}function ve(h,r){var t=0;return h[0]<r[0]?t|=1:h[0]>r[2]&&(t|=2),h[1]<r[1]?t|=4:h[1]>r[3]&&(t|=8),t;}var Dr=/* @__PURE__ */fe(bd);var Se=/*#__PURE__*/function(_vt3){function Se(t,e){var _this67;_classCallCheck(this,Se);_this67=_callSuper(this,Se,[t]);et(_this67,"canRotate",!1);et(_this67,"scaleType",jt.none);et(_this67,"toolsType",ut.Eraser);et(_this67,"serviceWork");et(_this67,"tmpPoints",[]);et(_this67,"workOptions");et(_this67,"worldPosition");et(_this67,"worldScaling");et(_this67,"eraserRect");et(_this67,"eraserPolyline");_this67.serviceWork=e,_this67.workOptions=t.toolsOpt,_this67.worldPosition=_this67.fullLayer.worldPosition,_this67.worldScaling=_this67.fullLayer.worldScaling;return _this67;}_inherits(Se,_vt3);return _createClass(Se,[{key:"combineConsume",value:function combineConsume(){}},{key:"consumeService",value:function consumeService(){}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(Se,"setWorkOptions",this,3)([t]);}},{key:"createEraserRect",value:function createEraserRect(t){var e=t[0]*this.worldScaling[0]+this.worldPosition[0],n=t[1]*this.worldScaling[1]+this.worldPosition[1],_Se$eraserSizes$this$=Se.eraserSizes[this.workOptions.thickness],i=_Se$eraserSizes$this$.width,a=_Se$eraserSizes$this$.height;this.eraserRect={x:e-i*0.5,y:n-a*0.5,w:i,h:a},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 _e3=new _(this.tmpPoints[0],this.tmpPoints[1]),n=new _(this.tmpPoints[2],this.tmpPoints[3]),i=_.Sub(n,_e3).uni(),a=_.Dist(_e3,n),_Se$eraserSizes$this$2=Se.eraserSizes[this.workOptions.thickness],o=_Se$eraserSizes$this$2.width,s=_Se$eraserSizes$this$2.height,l=Math.min(o,s),d=Math.round(a/l);if(d>1){var c=[];for(var p=0;p<d;p++){var y=_.Mul(i,p*l);c.push(this.tmpPoints[0]+y.x,this.tmpPoints[1]+y.y);}return c.concat(t);}}return t;}},{key:"isNear",value:function isNear(t,e){var n=new _(t[0],t[1]),i=new _(e[0],e[1]),_Se$eraserSizes$this$3=Se.eraserSizes[this.workOptions.thickness],a=_Se$eraserSizes$this$3.width,o=_Se$eraserSizes$this$3.height;return _.Dist(n,i)<Math.hypot(a,o)*0.5;}},{key:"remove",value:function remove(t){var _this68=this;var e=t.curNodeMap,n=t.removeIds;var i;var _iterator16=_createForOfIteratorHelper(e.values()),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var a=_step16.value;if(a.rect&&this.eraserRect&&this.eraserPolyline&&We(this.eraserRect,a.rect)){var o=a.op,s=[],l=[];for(var c=0;c<o.length;c+=3){var p=new _(o[c]*this.worldScaling[0]+this.worldPosition[0],o[c+1]*this.worldScaling[1]+this.worldPosition[1],o[c+2]);l.push(p),s.push(new xt(p.x,p.y));}var d=s.length&&Bt(s)||a.rect;We(d,this.eraserRect)&&(l.length>1?Dr.polyline(l.map(function(p){return p.XY;}),this.eraserPolyline).length&&n.add(a.name):n.add(a.name),i=Pt(i,d));}}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}return n.forEach(function(a){var s;var o=_this68.fullLayer.getElementsByName(a);_this68.fullLayer.removeChild(o[0]),(s=_this68.vNodes)==null||s["delete"](a);}),i&&(i.x-=vt.SafeBorderPadding,i.y-=vt.SafeBorderPadding,i.w+=vt.SafeBorderPadding*2,i.h+=vt.SafeBorderPadding*2),i;}},{key:"consume",value:function consume(t){var e=t.data.op;if(!e||e.length===0)return _objectSpread({type:at.None},this.baseConsumeResult);var n=this.tmpPoints.length;if(n>1&&this.isNear([e[0],e[1]],[this.tmpPoints[n-2],this.tmpPoints[n-1]]))return _objectSpread({type:at.None},this.baseConsumeResult);n<3?this.tmpPoints.push(e[0],e[1]):this.tmpPoints.splice(2,2,e[0],e[1]);var i=this.computRectCenterPoints();var a;var o=/* @__PURE__ */new Set();if(!this.vNodes)return _objectSpread({type:at.None},this.baseConsumeResult);var s=this.getCanEraserNodeMap(this.vNodes.getCanEraserNodes(this.vNodes.curNodeMap));for(var l=0;l<i.length-1;l+=2){this.createEraserRect(i.slice(l,l+2));var d=this.remove({curNodeMap:s,removeIds:o});a=Pt(a,d);}return a&&o.size?{type:at.RemoveNode,rect:a,removeIds:_toConsumableArray(o)}:_objectSpread({type:at.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 e;if(this.serviceWork){var n=new Map(t),i=this.serviceWork.selectorWorkShapes,a=this.serviceWork.workShapes;var _iterator17=_createForOfIteratorHelper(i.values()),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var o=_step17.value;if((e=o.selectIds)!=null&&e.length){var _iterator19=_createForOfIteratorHelper(o.selectIds),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var s=_step19.value;n["delete"](s);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}}}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}var _iterator18=_createForOfIteratorHelper(a.keys()),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var _o4=_step18.value;n["delete"](_o4);}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}return n;}return t;}}]);}(vt);// 来源于white-sdk
408
- et(Se,"eraserSizes",Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50})]));var se=Se;var Dd="__lodash_hash_undefined__";function Nd(h){return this.__data__.set(h,Dd),this;}var Wd=Nd;function Bd(h){return this.__data__.has(h);}var Fd=Bd,Ud=$n,jd=Wd,$d=Fd;function Ye(h){var r=-1,t=h==null?0:h.length;for(this.__data__=new Ud();++r<t;)this.add(h[r]);}Ye.prototype.add=Ye.prototype.push=jd;Ye.prototype.has=$d;var Nr=Ye;function zd(h,r){for(var t=-1,e=h==null?0:h.length;++t<e;)if(r(h[t],t,h))return!0;return!1;}var Gd=zd;function Hd(h,r){return h.has(r);}var Wr=Hd,Kd=Nr,Yd=Gd,Vd=Wr,Xd=1,kd=2;function Jd(h,r,t,e,n,i){var a=t&Xd,o=h.length,s=r.length;if(o!=s&&!(a&&s>o))return!1;var l=i.get(h),d=i.get(r);if(l&&d)return l==r&&d==h;var c=-1,p=!0,y=t&kd?new Kd():void 0;for(i.set(h,r),i.set(r,h);++c<o;){var P=h[c],x=r[c];if(e)var v=a?e(x,P,c,r,h,i):e(P,x,c,h,r,i);if(v!==void 0){if(v)continue;p=!1;break;}if(y){if(!Yd(r,function(T,f){if(!Vd(y,f)&&(P===T||n(P,T,t,e,i)))return y.push(f);})){p=!1;break;}}else if(!(P===x||n(P,x,t,e,i))){p=!1;break;}}return i["delete"](h),i["delete"](r),p;}var gi=Jd;function Zd(h){var r=-1,t=Array(h.size);return h.forEach(function(e,n){t[++r]=[n,e];}),t;}var Qd=Zd;function qd(h){var r=-1,t=Array(h.size);return h.forEach(function(e){t[++r]=e;}),t;}var Br=qd,pn=Be,mn=si,_d=Tr,t0=gi,e0=Qd,r0=Br,n0=1,i0=2,s0="[object Boolean]",o0="[object Date]",a0="[object Error]",l0="[object Map]",c0="[object Number]",f0="[object RegExp]",h0="[object Set]",u0="[object String]",d0="[object Symbol]",g0="[object ArrayBuffer]",p0="[object DataView]",vn=pn?pn.prototype:void 0,lr=vn?vn.valueOf:void 0;function m0(h,r,t,e,n,i,a){switch(t){case p0:if(h.byteLength!=r.byteLength||h.byteOffset!=r.byteOffset)return!1;h=h.buffer,r=r.buffer;case g0:return!(h.byteLength!=r.byteLength||!i(new mn(h),new mn(r)));case s0:case o0:case c0:return _d(+h,+r);case a0:return h.name==r.name&&h.message==r.message;case f0:case u0:return h==r+"";case l0:var o=e0;case h0:var s=e&n0;if(o||(o=r0),h.size!=r.size&&!s)return!1;var l=a.get(h);if(l)return l==r;e|=i0,a.set(h,r);var d=t0(o(h),o(r),e,n,i,a);return a["delete"](h),d;case d0:if(lr)return lr.call(h)==lr.call(r);}return!1;}var v0=m0,yn=ri,y0=1,S0=Object.prototype,x0=S0.hasOwnProperty;function T0(h,r,t,e,n,i){var a=t&y0,o=yn(h),s=o.length,l=yn(r),d=l.length;if(s!=d&&!a)return!1;for(var c=s;c--;){var p=o[c];if(!(a?p in r:x0.call(r,p)))return!1;}var y=i.get(h),P=i.get(r);if(y&&P)return y==r&&P==h;var x=!0;i.set(h,r),i.set(r,h);for(var v=a;++c<s;){p=o[c];var T=h[p],f=r[p];if(e)var g=a?e(f,T,p,r,h,i):e(T,f,p,h,r,i);if(!(g===void 0?T===f||n(T,f,t,e,i):g)){x=!1;break;}v||(v=p=="constructor");}if(x&&!v){var u=h.constructor,m=r.constructor;u!=m&&"constructor"in h&&"constructor"in r&&!(typeof u=="function"&&u instanceof u&&typeof m=="function"&&m instanceof m)&&(x=!1);}return i["delete"](h),i["delete"](r),x;}var M0=T0,cr=zn,P0=gi,O0=v0,E0=M0,Sn=or,xn=Fe,Tn=Pr,C0=kn,A0=1,Mn="[object Arguments]",Pn="[object Array]",je="[object Object]",R0=Object.prototype,On=R0.hasOwnProperty;function I0(h,r,t,e,n,i){var a=xn(h),o=xn(r),s=a?Pn:Sn(h),l=o?Pn:Sn(r);s=s==Mn?je:s,l=l==Mn?je:l;var d=s==je,c=l==je,p=s==l;if(p&&Tn(h)){if(!Tn(r))return!1;a=!0,d=!1;}if(p&&!d)return i||(i=new cr()),a||C0(h)?P0(h,r,t,e,n,i):O0(h,r,s,t,e,n,i);if(!(t&A0)){var y=d&&On.call(h,"__wrapped__"),P=c&&On.call(r,"__wrapped__");if(y||P){var x=y?h.value():h,v=P?r.value():r;return i||(i=new cr()),n(x,v,t,e,i);}}return p?(i||(i=new cr()),E0(h,r,t,e,n,i)):!1;}var L0=I0,b0=L0,En=ne;function pi(h,r,t,e,n){return h===r?!0:h==null||r==null||!En(h)&&!En(r)?h!==h&&r!==r:b0(h,r,t,e,pi,n);}var w0=pi,D0=w0;function N0(h,r){return D0(h,r);}var W0=N0,oe=/* @__PURE__ */fe(W0);var _e=/*#__PURE__*/function(_vt4){function _e(t){var _this69;_classCallCheck(this,_e);_this69=_callSuper(this,_e,[t]);et(_this69,"toolsType",ut.Selector);et(_this69,"tmpPoints",[]);et(_this69,"workOptions");et(_this69,"vNodes");et(_this69,"selectIds");et(_this69,"selectorColor");et(_this69,"strokeColor");et(_this69,"fillColor");et(_this69,"oldSelectRect");et(_this69,"canRotate",!1);et(_this69,"canTextEdit",!1);et(_this69,"canLock",!1);et(_this69,"scaleType",jt.all);et(_this69,"toolsTypes");et(_this69,"shapeOpt");et(_this69,"textOpt");et(_this69,"isLocked");et(_this69,"thickness");et(_this69,"strokeType");et(_this69,"useStroke");_this69.workOptions=t.toolsOpt,_this69.vNodes=t.vNodes;return _this69;}_inherits(_e,_vt4);return _createClass(_e,[{key:"computSelector",value:function computSelector(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var e=Bt(this.tmpPoints);if(e.w===0||e.h===0)return{selectIds:[],intersectRect:void 0,subNodeMap:/* @__PURE__ */new Map()};var _this$vNodes$getRectI=this.vNodes.getRectIntersectRange(e,t),n=_this$vNodes$getRectI.rectRange,i=_this$vNodes$getRectI.nodeRange;return{selectIds:_toConsumableArray(i.keys()),intersectRect:n,subNodeMap:i};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=this.tmpPoints.length,n=t.length;if(n>1){var i=new xt(t[n-2]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[n-1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]);e===2?this.tmpPoints.splice(1,1,i):this.tmpPoints.push(i);}}},{key:"drawSelector",value:function drawSelector(t){var _this70=this;var e=t.drawRect,n=t.subNodeMap,i=t.selectorId,a=t.layer,o=t.isService,s=new kt({pos:[e.x,e.y],anchor:[0,0],size:[e.w,e.h],id:i,name:i,zIndex:9999}),l=[];if(o){var d=new Gr({normalize:!0,pos:[e.w/2,e.h/2],lineWidth:1,strokeColor:this.selectorColor||this.workOptions.strokeColor,width:e.w,height:e.h,name:_e.selectorBorderId});l.push(d);}n.forEach(function(d,c){var p=[d.rect.x+d.rect.w/2-e.x,d.rect.y+d.rect.h/2-e.y],y=new Gr({normalize:!0,pos:p,lineWidth:1,strokeColor:n.size>1?_this70.selectorColor||_this70.workOptions.strokeColor:void 0,width:d.rect.w,height:d.rect.h,id:"selector-".concat(c),name:"selector-".concat(c)});l.push(y);}),l&&s.append.apply(s,l),(a==null?void 0:a.parent).appendChild(s);}},{key:"draw",value:function draw(t,e,n){var i=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var s,l;var a=n.intersectRect,o=n.subNodeMap;(l=(s=e.parent)==null?void 0:s.getElementById(t))==null||l.remove(),a&&this.drawSelector({drawRect:a,subNodeMap:o,selectorId:t,layer:e,isService:i});}},{key:"getSelecteorInfo",value:function getSelecteorInfo(t){this.scaleType=jt.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 e=/* @__PURE__ */new Set();var n,i=!0;var _iterator20=_createForOfIteratorHelper(t.values()),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var a=_step20.value;var o=a.opt,s=a.canRotate,l=a.scaleType,d=a.toolsType;this.selectorColor=this.workOptions.strokeColor,o.strokeColor&&(this.strokeColor=o.strokeColor),o.fillColor&&(this.fillColor=o.fillColor),o.textOpt&&(this.textOpt=o.textOpt),o.thickness&&(this.thickness=o.thickness),d!==ut.Pencil&&(i=!1),o.strokeType&&(this.strokeType=o.strokeType),d===ut.SpeechBalloon&&(e.add(d),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.placement=o.placement),d===ut.Polygon&&(e.add(d),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=o.vertices),d===ut.Star&&(e.add(d),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=o.vertices,this.shapeOpt.innerRatio=o.innerRatio,this.shapeOpt.innerVerticeStep=o.innerVerticeStep),d===ut.Text&&(this.textOpt=o),t.size===1&&(this.textOpt&&(this.canTextEdit=!0),this.canRotate=s,this.scaleType=l),l===jt.none&&(this.scaleType=l),d===ut.Image&&(n=a);}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}i&&(this.useStroke=!0),e.size&&(this.toolsTypes=_toConsumableArray(e)),n&&(t.size===1?(this.canLock=!0,n.opt.locked&&(this.isLocked=!0,this.scaleType=jt.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,e;if(this.scaleType===jt.both&&((t=this.selectIds)==null?void 0:t.length)===1){var n=this.selectIds[0],i=(e=this.vNodes.get(n))==null?void 0:e.op;if(i){var a=[];for(var o=0;o<i.length;o+=3)a.push([i[o],i[o+1]]);return a;}}}},{key:"consume",value:function consume(t){var _t$data2=t.data,e=_t$data2.op,n=_t$data2.workState;var i=this.oldSelectRect;if(n===It.Start&&(i=this.unSelectedAllIds()),!(e!=null&&e.length)||!this.vNodes.curNodeMap.size)return{type:at.None};this.updateTempPoints(e);var a=this.computSelector();if(this.selectIds&&oe(this.selectIds,a.selectIds))return{type:at.None};this.selectIds=a.selectIds;var o=a.intersectRect;this.getSelecteorInfo(a.subNodeMap),this.draw(Nt,this.fullLayer,a),this.oldSelectRect=o;var s=this.getChildrenPoints();return _objectSpread({type:at.Select,dataType:Mt.Local,rect:Pt(o,i),selectIds:a.selectIds,selectRect:o,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:s,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var e,n;var t=this.oldSelectRect;if(!((e=this.selectIds)!=null&&e.length)&&this.tmpPoints[0]&&this.selectSingleTool(this.tmpPoints[0].XY,Nt,!1),(n=this.selectIds)!=null&&n.length&&(t=this.selectedByIds(this.selectIds)),t){var i=this.getChildrenPoints();return _objectSpread({type:at.Select,dataType:Mt.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:i,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},this.baseConsumeResult);}return{type:at.None};}},{key:"consumeService",value:function consumeService(){}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}},{key:"clearSelectData",value:function clearSelectData(){this.selectIds=void 0,this.oldSelectRect=void 0;}},{key:"selectSingleTool",value:function selectSingleTool(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Nt;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;if(t.length===2){var i=t[0],a=t[1];var o;var _this$vNodes$getRectI2=this.vNodes.getRectIntersectRange({x:i,y:a,w:0,h:0},!1),s=_this$vNodes$getRectI2.nodeRange,l=_toConsumableArray(s.values()).sort(function(d,c){return(c.opt.zIndex||0)-(d.opt.zIndex||0);});var _iterator21=_createForOfIteratorHelper(l),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _d9=_step21.value;var _c5=this.fullLayer.getElementsByName(_d9.name);if(Oi(_c5).find(function(y){return y.isPointCollision(i,a);})){o=_d9;break;}}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}if(o){var d=o.name;if(!oe(this.oldSelectRect,o.rect)){var c=/* @__PURE__ */new Map([[d,o]]);this.getSelecteorInfo(c),this.draw(e,this.fullLayer,{intersectRect:o.rect,subNodeMap:c,selectIds:this.selectIds||[]},n);}this.selectIds=[d],this.oldSelectRect=o.rect;}}}},{key:"unSelectedAllIds",value:function unSelectedAllIds(){var t;var _iterator22=_createForOfIteratorHelper(this.vNodes.curNodeMap.entries()),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _step22$value=_slicedToArray(_step22.value,2),_e4=_step22$value[0],n=_step22$value[1];n.isSelected&&(t=Pt(t,n.rect),this.vNodes.unSelected(_e4));}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}return t;}},{key:"unSelectedByIds",value:function unSelectedByIds(t){var e;var _iterator23=_createForOfIteratorHelper(t),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var n=_step23.value;var i=this.vNodes.get(n);i&&i.isSelected&&(e=Pt(e,i.rect),this.vNodes.unSelected(n));}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}return e;}},{key:"selectedByIds",value:function selectedByIds(t){var e;var _iterator24=_createForOfIteratorHelper(t),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var n=_step24.value;var i=this.vNodes.get(n);i&&(e=Pt(e,i.rect),this.vNodes.selected(n));}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}return e;}},{key:"getSelectorRect",value:function getSelectorRect(t,e){var o;var n;var i=(o=t.parent)==null?void 0:o.getElementById(e),a=i==null?void 0:i.getBoundingClientRect();return a&&(n=Pt(n,{x:Math.floor(a.x),y:Math.floor(a.y),w:Math.floor(a.width+1),h:Math.floor(a.height+1)})),n;}},{key:"isCanFillColor",value:function isCanFillColor(t){return t===ut.Ellipse||t===ut.Triangle||t===ut.Rectangle||t===ut.Polygon||t===ut.Star||t===ut.SpeechBalloon;}},{key:"updateSelector",value:function(){var _updateSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(t){var m,e,n,i,a,o,s,l,d,c,p,y,P,x,v,T,f,_iterator25,_step25,M,E,A,b,O,L,w,I,R,W,z,K,g,_M9,_E4,_A5,u;return _regeneratorRuntime().wrap(function _callee22$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:e=t.updateSelectorOpt,n=t.selectIds,i=t.vNodes,a=t.willSerializeData,o=t.worker,s=t.offset,l=this.fullLayer;if(l){_context24.next=3;break;}return _context24.abrupt("return");case 3:c=/* @__PURE__ */new Map(),p=e.originPoint,y=e.workState,P=e.angle,x=e.translate,v=e.dir,T=e.scale;s&&(x?e.translate=[x[0]+s[0],x[1]+s[1]]:e.translate=s);if(!(p||x||_t(P))){_context24.next=9;break;}if(!(y===It.Start&&n)){_context24.next=8;break;}return _context24.abrupt("return",(i.setTargetAssignKeys(n),{type:at.Select,dataType:Mt.Local,selectRect:this.oldSelectRect,rect:this.oldSelectRect}));case 8:f=i.getLastTarget();case 9:if(!n){_context24.next=60;break;}_iterator25=_createForOfIteratorHelper(n);_context24.prev=11;_iterator25.s();case 13:if((_step25=_iterator25.n()).done){_context24.next=52;break;}M=_step25.value;E=i.get(M);if(!E){_context24.next=50;break;}A=E.toolsType,b=E.opt,O=(l==null?void 0:l.getElementsByName(M))[0];if(!O){_context24.next=50;break;}L=!1,w=!1;I=_objectSpread({},e);R=void 0;if(!A){_context24.next=50;break;}I.thickness&&E.opt.thickness&&(L=E.opt.thickness!==I.thickness),I.strokeType&&(m=E.opt)!=null&&m.strokeType&&(w=E.opt.strokeType!==I.strokeType),R=f==null?void 0:f.get(M);W=Pi(A);if(!(W==null||W.updateNodeOpt({node:O,opt:I,vNodes:i,willSerializeData:a,targetNode:R}),E&&o&&(a&&(I.angle||I.translate)||I.originPoint&&I.scenePoint&&I.scale||I.pointMap&&I.pointMap.has(M)||A===ut.Text&&(I.fontSize||I.translate||I.textInfos&&I.textInfos.get(M))||A===ut.Image&&(I.angle||I.translate||I.scale||I.strokeColor&&b.type===xr.Iconify)||A===I.toolsType&&I.willRefresh||L||w))){_context24.next=49;break;}z=o.createWorkShapeNode({workId:M,toolsType:A,toolsOpt:E.opt});z==null||z.setWorkId(M);K=void 0;if(!(A===ut.Image)){_context24.next=35;break;}_context24.next=32;return z.consumeServiceAsync({isFullWork:!0,replaceId:M,worker:o});case 32:K=_context24.sent;_context24.next=48;break;case 35:if(!(A===ut.Text)){_context24.next=41;break;}_context24.next=38;return z.consumeServiceAsync({isFullWork:!0,replaceId:M});case 38:K=_context24.sent;_context24.next=48;break;case 41:_context24.prev=41;K=z==null?void 0:z.consumeService({op:E.op,isFullWork:!0,replaceId:M});_context24.next=48;break;case 45:_context24.prev=45;_context24.t0=_context24["catch"](41);return _context24.abrupt("continue",50);case 48:K&&(E.rect=K);case 49:E&&(c.set(M,E),d=Pt(d,E.rect));case 50:_context24.next=13;break;case 52:_context24.next=57;break;case 54:_context24.prev=54;_context24.t1=_context24["catch"](11);_iterator25.e(_context24.t1);case 57:_context24.prev=57;_iterator25.f();return _context24.finish(57);case 60:f&&y===It.Done&&(i.deleteLastTarget(),f=void 0);g=d;if(!(p&&x&&T&&v&&g&&!s)){_context24.next=80;break;}_M9=[[g.x,g.y],[g.x+g.w,g.y],[g.x+g.w,g.y+g.h],[g.x,g.y+g.h]];_context24.t2=v;_context24.next=_context24.t2==="top"?67:_context24.t2==="topLeft"?67:_context24.t2==="left"?67:_context24.t2==="topRight"?69:_context24.t2==="right"?71:_context24.t2==="bottomRight"?71:_context24.t2==="bottom"?71:_context24.t2==="bottomLeft"?73:75;break;case 67:x[0]>0&&x[1]>0?_E4=_M9[0]:x[0]>0?_E4=_M9[3]:x[1]>0?_E4=_M9[1]:_E4=_M9[2];return _context24.abrupt("break",75);case 69:x[0]<0&&x[1]>0?_E4=_M9[1]:x[0]<0?_E4=_M9[2]:x[1]>0?_E4=_M9[0]:_E4=_M9[3];return _context24.abrupt("break",75);case 71:x[0]<0&&x[1]<0?_E4=_M9[2]:x[0]<0?_E4=_M9[1]:x[1]<0?_E4=_M9[3]:_E4=_M9[0];return _context24.abrupt("break",75);case 73:x[0]>0&&x[1]<0?_E4=_M9[3]:x[0]>0?_E4=_M9[0]:x[1]<0?_E4=_M9[2]:_E4=_M9[1];return _context24.abrupt("break",75);case 75:_A5=_E4&&[p[0]-_E4[0],p[1]-_E4[1]]||[0,0];if(oe(_A5,[0,0])){_context24.next=80;break;}_context24.next=79;return this.updateSelector(_objectSpread(_objectSpread({},t),{},{updateSelectorOpt:{},offset:_A5}));case 79:return _context24.abrupt("return",_context24.sent);case 80:this.getSelecteorInfo(c),this.draw(Nt,l,{selectIds:n||[],subNodeMap:c,intersectRect:g});u=Pt(this.oldSelectRect,g);return _context24.abrupt("return",(this.oldSelectRect=g,{type:at.Select,dataType:Mt.Local,selectRect:g,renderRect:d,rect:Pt(u,g),selectIds:n}));case 83:case"end":return _context24.stop();}},_callee22,this,[[11,54,57,60],[41,45]]);}));function updateSelector(_x26){return _updateSelector.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function blurSelector(){var t=this.unSelectedAllIds();return{type:at.Select,dataType:Mt.Local,rect:t,selectIds:[],willSyncService:!0};}},{key:"getRightServiceId",value:function getRightServiceId(t){return t.replace(De,"-");}},{key:"selectServiceNode",value:function selectServiceNode(t,e,n){var _this71=this;var i=e.selectIds,a=this.getRightServiceId(t),o=this.getSelectorRect(this.fullLayer,a);var s;var l=/* @__PURE__ */new Map();return i==null||i.forEach(function(d){var c=_this71.vNodes.get(d);c&&(s=Pt(s,c.rect),l.set(d,c));}),this.getSelecteorInfo(l),this.draw(a,this.fullLayer,{intersectRect:s,selectIds:i||[],subNodeMap:l},n),Pt(s,o);}},{key:"reRenderSelector",value:function reRenderSelector(){var _this72=this;var n;var t;var e=/* @__PURE__ */new Map();return(n=this.selectIds)==null||n.forEach(function(i){var a=_this72.vNodes.get(i);a&&(t=Pt(t,a.rect),e.set(i,a));},this),this.getSelecteorInfo(e),this.draw(Nt,this.fullLayer,{intersectRect:t,subNodeMap:e,selectIds:this.selectIds||[]}),this.oldSelectRect=t,t;}},{key:"updateSelectIds",value:function updateSelectIds(t){var a;var e;var n=(a=this.selectIds)==null?void 0:a.filter(function(o){return!t.includes(o);});if(n!=null&&n.length&&(e=this.unSelectedByIds(n)),t.length){var o=this.selectedByIds(t);e=Pt(e,o);}this.selectIds=t;var i=this.reRenderSelector();return{bgRect:e,selectRect:i};}},{key:"cursorHover",value:function cursorHover(t){var a,o;var e=this.oldSelectRect;this.selectIds=[];var n=(a=this.workId)==null?void 0:a.toString(),i=[t[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]];if(this.selectSingleTool(i,n,!0),this.oldSelectRect&&!oe(e,this.oldSelectRect))return{type:at.CursorHover,dataType:Mt.Local,rect:Pt(e,this.oldSelectRect),selectorColor:this.selectorColor,willSyncService:!1};if((o=this.selectIds)!=null&&o.length||(this.oldSelectRect=void 0),e&&!this.oldSelectRect)return this.cursorBlur(),{type:at.CursorHover,dataType:Mt.Local,rect:e,selectorColor:this.selectorColor,willSyncService:!1};}},{key:"cursorBlur",value:function cursorBlur(){var e,n;this.selectIds=[];var t=(e=this.workId)==null?void 0:e.toString();((n=this.fullLayer)==null?void 0:n.parent).children.forEach(function(i){i.name===t&&i.remove();});}}]);}(vt);et(_e,"selectorBorderId","selector-border");var Ve=_e;var mi=/*#__PURE__*/function(_vt5){function mi(t){var _this73;_classCallCheck(this,mi);_this73=_callSuper(this,mi,[t]);et(_this73,"canRotate",!1);et(_this73,"scaleType",jt.both);et(_this73,"toolsType",ut.Arrow);et(_this73,"tmpPoints",[]);et(_this73,"workOptions");et(_this73,"oldRect");et(_this73,"arrowTipWidth");et(_this73,"syncTimestamp");_this73.workOptions=t.toolsOpt,_this73.arrowTipWidth=_this73.workOptions.thickness*4,_this73.syncTimestamp=0,_this73.syncUnitTime=50;return _this73;}_inherits(mi,_vt5);return _createClass(mi,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:y});}if(!i){var _y8=Date.now();return _y8-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y8,_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread(_objectSpread({rect:p},this.baseConsumeResult),{},{type:at.DrawWork,dataType:Mt.Local});}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:vt.getCenterPos(n,e)}),_objectSpread(_objectSpread({rect:n},this.baseConsumeResult),{},{type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0});}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,_this$workOptions6=this.workOptions,i=_this$workOptions6.strokeColor,a=_this$workOptions6.thickness,o=_this$workOptions6.zIndex,s=_this$workOptions6.scale,l=_this$workOptions6.rotate,d=_this$workOptions6.translate,c=_this$workOptions6.strokeType,p=_this$workOptions6.eraserlines,y=n.worldPosition,P=n.worldScaling,_this$computDrawPoint2=this.computDrawPoints(a),x=_this$computDrawPoint2.points,v=_this$computDrawPoint2.pos,T=_this$computDrawPoint2.rect,f=_this$computDrawPoint2.isTriangle,g=_this$computDrawPoint2.trianglePoints,u=_this$computDrawPoint2.trianglePos,m=[T.x+T.w/2,T.y+T.h/2],M={pos:m,name:e,id:e,zIndex:o,anchor:[0.5,0.5],size:[T.w,T.h]};s&&(M.scale=s),l&&(M.rotate=l),d&&(M.translate=d);var E=new kt(M),A={points:g,pos:[u[0]-m[0],u[1]-m[1]],fillColor:i,strokeColor:i,lineWidth:0,normalize:!1},b=new le(A);if(E.append(b),!f&&x&&v){var O={points:x,pos:[v[0]-m[0],v[1]-m[1]],fillColor:i,strokeColor:i,lineDash:c===Lt.Dotted&&!f?[1,a*2]:c===Lt.LongDotted&&!f?[a,a*2]:void 0,lineCap:c===Lt.Normal?void 0:"round",lineWidth:a,normalize:!1},L=new le(O);E.append(L);}if(p&&this.drawEraserlines({group:E,eraserlines:p,pos:m,layer:n}),this.replace(n,e,E),s||l||d){var _O9=E.getBoundingClientRect();return{x:Math.floor(_O9.x-vt.SafeBorderPadding),y:Math.floor(_O9.y-vt.SafeBorderPadding),w:Math.floor(_O9.width+vt.SafeBorderPadding*2),h:Math.floor(_O9.height+vt.SafeBorderPadding*2)};}return{x:Math.floor(T.x*P[0]+y[0]-vt.SafeBorderPadding),y:Math.floor(T.y*P[1]+y[1]-vt.SafeBorderPadding),w:Math.floor(T.w*P[0]+2*vt.SafeBorderPadding),h:Math.floor(T.h*P[1]+2*vt.SafeBorderPadding)};}},{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 _this74=this;var e=_.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),n=_.Per(e).mul(t/2),i=xt.Sub(this.tmpPoints[0],n),a=xt.Add(this.tmpPoints[0],n),o=_.Mul(e,this.arrowTipWidth),s=_.Sub(this.tmpPoints[1],o),l=xt.Sub(s,n),d=xt.Add(s,n),c=_.Per(e).mul(t*1.5),p=xt.Sub(s,c),y=xt.Add(s,c),P=[this.tmpPoints[0],s],x=[p,this.tmpPoints[1],y],v=[i,a].concat(x,[l,d]);return{trianglePoints:x.map(function(T){return xt.Sub(T,_this74.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,points:P.map(function(T){return xt.Sub(T,_this74.tmpPoints[0]).XY;}).flat(1),rect:Bt(v),isTriangle:!1,pos:this.tmpPoints[0].XY};}},{key:"computTrianglePoints",value:function computTrianglePoints(){var _this75=this;var t=_.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),e=this.tmpPoints[1].distance(this.tmpPoints[0]),n=_.Per(t).mul(Math.floor(e*3/8)),i=xt.Sub(this.tmpPoints[0],n),a=xt.Add(this.tmpPoints[0],n),o=[i,this.tmpPoints[1],a];return{trianglePoints:o.map(function(s){return xt.Sub(s,_this75.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,rect:Bt(o),isTriangle:!0};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a))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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var l,d;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.strokeType,s=i.get(e.name);return a&&(e.tagName==="GROUP"?e.children.forEach(function(c){c.setAttribute("strokeColor",a),c.getAttribute("fillColor")&&c.setAttribute("fillColor",a);}):(e.setAttribute("strokeColor",a),e.setAttribute("fillColor",a)),(l=s==null?void 0:s.opt)!=null&&l.strokeColor&&(s.opt.strokeColor=a)),o&&s!=null&&s.opt&&(d=s.opt)!=null&&d.strokeType&&(s.opt.strokeType=o),s&&i.setInfo(e.name,s),vt.updateNodeOpt(t);}}]);}(vt);var vi=/*#__PURE__*/function(_vt6){function vi(t){var _this76;_classCallCheck(this,vi);_this76=_callSuper(this,vi,[t]);et(_this76,"canRotate",!1);et(_this76,"scaleType",jt.all);et(_this76,"toolsType",ut.Ellipse);et(_this76,"tmpPoints",[]);et(_this76,"workOptions");et(_this76,"oldRect");et(_this76,"syncTimestamp");_this76.workOptions=t.toolsOpt,_this76.syncTimestamp=0,_this76.syncUnitTime=50;return _this76;}_inherits(vi,_vt6);return _createClass(vi,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:y,isDrawing:!0});}if(!i){var _y9=Date.now();return _y9-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y9,_objectSpread(_objectSpread({type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult),{},{op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e,isDrawing:!1});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread(_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local},this.baseConsumeResult),{},{ops:a,isSync:!0});}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,i=t.isDrawing,_this$workOptions7=this.workOptions,a=_this$workOptions7.strokeColor,o=_this$workOptions7.fillColor,s=_this$workOptions7.thickness,l=_this$workOptions7.zIndex,d=_this$workOptions7.scale,c=_this$workOptions7.rotate,p=_this$workOptions7.translate,y=_this$workOptions7.strokeType,P=_this$workOptions7.eraserlines,x=n.worldScaling,_this$computDrawPoint3=this.computDrawPoints(s),v=_this$computDrawPoint3.radius,T=_this$computDrawPoint3.rect,f=_this$computDrawPoint3.pos,g={pos:f,name:e,id:e,radius:v,lineWidth:s,fillColor:o!=="transparent"&&o||void 0,strokeColor:a,normalize:!0,lineJoin:"round",lineCap:"round",lineDash:y===Lt.Dotted?[1,s*2]:y===Lt.LongDotted?[s,s*2]:void 0},u={name:e,id:e,zIndex:l,pos:f,anchor:[0.5,0.5],size:[T.w,T.h]};d&&(u.scale=d),c&&(u.rotate=c),p&&(u.translate=p);var m=new kt(u);if(i){var A=new ce({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/x[0],1/x[1]]});m.append(A);}var M=new Zi(_objectSpread(_objectSpread({},g),{},{pos:[0,0]}));m.append(M),P&&this.drawEraserlines({group:m,eraserlines:P,pos:f,layer:n}),this.replace(n,e,m);var E=m.getBoundingClientRect();return{x:Math.floor(E.x-vt.SafeBorderPadding),y:Math.floor(E.y-vt.SafeBorderPadding),w:Math.floor(E.width+vt.SafeBorderPadding*2),h:Math.floor(E.height+vt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t){var e=Bt(this.tmpPoints),n=Bt(this.tmpPoints,t),i=[Math.floor(e.x+e.w/2),Math.floor(e.y+e.h/2)];return{rect:n,pos:i,radius:[Math.floor(e.w/2),Math.floor(e.h/2)]};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a))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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a,isDrawing:!1});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var c,p,y;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.strokeType,l=i.get(e.name);var d=e;return e.tagName==="GROUP"&&(d=e.children[0]),a&&(d.setAttribute("strokeColor",a),(c=l==null?void 0:l.opt)!=null&&c.strokeColor&&(l.opt.strokeColor=a)),o&&(o==="transparent"?d.setAttribute("fillColor","rgba(0,0,0,0)"):d.setAttribute("fillColor",o),(p=l==null?void 0:l.opt)!=null&&p.fillColor&&(l.opt.fillColor=o)),s&&l!=null&&l.opt&&(y=l.opt)!=null&&y.strokeType&&(l.opt.strokeType=s),l&&i.setInfo(e.name,l),vt.updateNodeOpt(t);}}]);}(vt);var yi=/*#__PURE__*/function(_vt7){function yi(t){var _this77;_classCallCheck(this,yi);_this77=_callSuper(this,yi,[t]);et(_this77,"canRotate",!0);et(_this77,"scaleType",jt.all);et(_this77,"toolsType",ut.Rectangle);et(_this77,"tmpPoints",[]);et(_this77,"workOptions");et(_this77,"oldRect");et(_this77,"syncTimestamp");_this77.workOptions=t.toolsOpt,_this77.syncTimestamp=0,_this77.syncUnitTime=50;return _this77;}_inherits(yi,_vt7);return _createClass(yi,[{key:"transformData",value:function transformData(){var t=Bt(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 e=this.workOptions.thickness,n=[];var _iterator26=_createForOfIteratorHelper(t),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var o=_step26.value;n.push(_construct(_,_toConsumableArray(o)));}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}var i=Bt(n,e),a=[i.x+i.w/2,i.y+i.h/2];return{rect:i,pos:a,points:n.map(function(o){return o.XY;}).flat(1)};}},{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c=this.transformData();var p;if(i||a){var P=n?this.fullLayer:this.drawLayer||this.fullLayer;p=this.draw({ps:c,workId:o,layer:P,isDrawing:!0});}if(!i){var _P2=Date.now();return _P2-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_P2,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:c.flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var y=Pt(p,this.oldRect);return this.oldRect=p,_objectSpread({rect:y,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var s;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.transformData(),n=this.fullLayer,i=this.draw({ps:e,workId:t,layer:n,isDrawing:!1});this.oldRect=i;var a=e.flat(1),o=Zt(a);return(s=this.vNodes)==null||s.setInfo(t,{rect:i,op:a,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&vt.getCenterPos(i,n)}),_objectSpread({rect:i,type:at.FullWork,dataType:Mt.Local,ops:o,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,i=t.isDrawing,a=t.ps,o=t.replaceId,_this$workOptions8=this.workOptions,s=_this$workOptions8.strokeColor,l=_this$workOptions8.fillColor,d=_this$workOptions8.thickness,c=_this$workOptions8.zIndex,p=_this$workOptions8.scale,y=_this$workOptions8.rotate,P=_this$workOptions8.translate,x=_this$workOptions8.strokeType,v=_this$workOptions8.eraserlines,T=n.worldPosition,f=n.worldScaling,_this$computDrawPoint4=this.computDrawPoints(a),g=_this$computDrawPoint4.points,u=_this$computDrawPoint4.rect,m=_this$computDrawPoint4.pos,M={close:!0,normalize:!0,points:g,lineWidth:d,fillColor:l!=="transparent"&&l||void 0,strokeColor:s,lineJoin:"round",lineCap:"round",lineDash:x===Lt.Dotted?[1,d*2]:x===Lt.LongDotted?[d,d*2]:void 0},E={x:Math.floor(u.x*f[0]+T[0]-vt.SafeBorderPadding),y:Math.floor(u.y*f[1]+T[1]-vt.SafeBorderPadding),w:Math.floor(u.w*f[0]+2*vt.SafeBorderPadding),h:Math.floor(u.h*f[0]+2*vt.SafeBorderPadding)},A=new kt({name:e,id:e,zIndex:c,pos:m,anchor:[0.5,0.5],size:[u.w,u.h],scale:p,rotate:y,translate:P}),b=new le(_objectSpread(_objectSpread({},M),{},{pos:[0,0]}));if(A.appendChild(b),i){var O=new ce({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:s,lineWidth:1,scale:[1/f[0],1/f[1]]});A.appendChild(O);}if(v&&this.drawEraserlines({group:A,eraserlines:v,pos:m,layer:n}),this.replace(n,o||e,A),p||y||P){var _O10=A.getBoundingClientRect();return{x:Math.floor(_O10.x-vt.SafeBorderPadding),y:Math.floor(_O10.y-vt.SafeBorderPadding),w:Math.floor(_O10.width+2*vt.SafeBorderPadding),h:Math.floor(_O10.height+2*vt.SafeBorderPadding)};}return E;}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a))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 d,c;var e=t.op,n=t.isFullWork,i=t.replaceId,a=(d=this.workId)==null?void 0:d.toString();if(!a)return;var o=[];for(var p=0;p<e.length;p+=3)o.push([e[p],e[p+1],e[p+2]]);var s=n?this.fullLayer:this.drawLayer||this.fullLayer,l=this.draw({ps:o,workId:a,layer:s,isDrawing:!1,replaceId:i});return this.oldRect=l,(c=this.vNodes)==null||c.setInfo(a,{rect:l,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:l&&vt.getCenterPos(l,s)}),l;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var c,p,y;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.strokeType,l=i.get(e.name);var d=e;return e.tagName==="GROUP"&&(d=e.children[0]),a&&(d.setAttribute("strokeColor",a),(c=l==null?void 0:l.opt)!=null&&c.strokeColor&&(l.opt.strokeColor=a)),o&&(o==="transparent"?d.setAttribute("fillColor","rgba(0,0,0,0)"):d.setAttribute("fillColor",o),(p=l==null?void 0:l.opt)!=null&&p.fillColor&&(l.opt.fillColor=o)),s&&l!=null&&l.opt&&(y=l.opt)!=null&&y.strokeType&&(l.opt.strokeType=s),l&&i.setInfo(e.name,l),vt.updateNodeOpt(t);}}]);}(vt);var Si=/*#__PURE__*/function(_vt8){function Si(t){var _this78;_classCallCheck(this,Si);_this78=_callSuper(this,Si,[t]);et(_this78,"canRotate",!1);et(_this78,"scaleType",jt.all);et(_this78,"toolsType",ut.Star);et(_this78,"tmpPoints",[]);et(_this78,"workOptions");et(_this78,"oldRect");et(_this78,"syncTimestamp");_this78.workOptions=t.toolsOpt,_this78.syncTimestamp=0,_this78.syncUnitTime=50;return _this78;}_inherits(Si,_vt8);return _createClass(Si,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:y,isDrawing:!0});}if(!i){var _y10=Date.now();return _y10-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y10,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e,isDrawing:!1});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,i=t.isDrawing,_this$workOptions9=this.workOptions,a=_this$workOptions9.strokeColor,o=_this$workOptions9.fillColor,s=_this$workOptions9.thickness,l=_this$workOptions9.zIndex,d=_this$workOptions9.vertices,c=_this$workOptions9.innerVerticeStep,p=_this$workOptions9.innerRatio,y=_this$workOptions9.scale,P=_this$workOptions9.rotate,x=_this$workOptions9.translate,v=_this$workOptions9.strokeType,T=_this$workOptions9.eraserlines,f=n.worldScaling,_this$computDrawPoint5=this.computDrawPoints(s,d,c,p),g=_this$computDrawPoint5.rect,u=_this$computDrawPoint5.pos,m=_this$computDrawPoint5.points,M={close:!0,points:m,lineWidth:s,fillColor:o!=="transparent"&&o||void 0,strokeColor:a,normalize:!0,lineJoin:"round",lineCap:"round",lineDash:v===Lt.Dotted?[1,s*2]:v===Lt.LongDotted?[s,s*2]:void 0},E={name:e,id:e,zIndex:l,pos:u,anchor:[0.5,0.5],size:[g.w,g.h]};y&&(E.scale=y),P&&(E.rotate=P),x&&(E.translate=x);var A=new kt(E);if(i){var L=new ce({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/f[0],1/f[1]]});A.append(L);}var b=new le(_objectSpread(_objectSpread({},M),{},{pos:[0,0]}));A.append(b),T&&this.drawEraserlines({group:A,eraserlines:T,pos:u,layer:n}),this.replace(n,e,A);var O=A.getBoundingClientRect();return{x:Math.floor(O.x-vt.SafeBorderPadding),y:Math.floor(O.y-vt.SafeBorderPadding),w:Math.floor(O.width+vt.SafeBorderPadding*2),h:Math.floor(O.height+vt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t,e,n,i){var a=Bt(this.tmpPoints),o=[Math.floor(a.x+a.w/2),Math.floor(a.y+a.h/2)],s=Ci(a.w,a.h),l=Math.floor(Math.min(a.w,a.h)/2),d=i*l,c=[],p=2*Math.PI/e;for(var P=0;P<e;P++){var x=P*p-0.5*Math.PI;var v=void 0,_T32=void 0;P%n===1?(v=d*s[0]*Math.cos(x),_T32=d*s[1]*Math.sin(x)):(v=l*s[0]*Math.cos(x),_T32=l*s[1]*Math.sin(x),c.push(v,_T32)),c.push(v,_T32);}return{rect:Bt(this.tmpPoints,t),pos:o,points:c};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a)||xt.Sub(i,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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a,isDrawing:!1});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:o&&vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var v;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.toolsType,l=n.vertices,d=n.innerVerticeStep,c=n.innerRatio,p=n.strokeType,y=i.get(e.name),P=y==null?void 0:y.opt;var x=e;return e.tagName==="GROUP"&&(x=e.children[0]),a&&(x.setAttribute("strokeColor",a),P!=null&&P.strokeColor&&(P.strokeColor=a)),o&&(o==="transparent"?x.setAttribute("fillColor","rgba(0,0,0,0)"):x.setAttribute("fillColor",o),P!=null&&P.fillColor&&(P.fillColor=o)),s===ut.Star&&(l&&(P.vertices=l),d&&(P.innerVerticeStep=d),c&&(P.innerRatio=c)),p&&y!=null&&y.opt&&(v=y.opt)!=null&&v.strokeType&&(y.opt.strokeType=p),y&&i.setInfo(e.name,_objectSpread(_objectSpread({},y),{},{opt:P})),vt.updateNodeOpt(t);}}]);}(vt);var xi=/*#__PURE__*/function(_vt9){function xi(t){var _this79;_classCallCheck(this,xi);_this79=_callSuper(this,xi,[t]);et(_this79,"canRotate",!1);et(_this79,"scaleType",jt.all);et(_this79,"toolsType",ut.Polygon);et(_this79,"tmpPoints",[]);et(_this79,"workOptions");et(_this79,"oldRect");et(_this79,"syncTimestamp");_this79.workOptions=t.toolsOpt,_this79.syncTimestamp=0,_this79.syncUnitTime=50;return _this79;}_inherits(xi,_vt9);return _createClass(xi,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=e.op,s=this.workId,l=o==null?void 0:o.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(o[0],o[1])],d=!1):d=this.updateTempPoints(o),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:s,layer:y,isDrawing:!0});}if(!i){var _y11=Date.now();return _y11-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y11,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e,isDrawing:!1});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,i=t.isDrawing,_this$workOptions10=this.workOptions,a=_this$workOptions10.strokeColor,o=_this$workOptions10.fillColor,s=_this$workOptions10.thickness,l=_this$workOptions10.zIndex,d=_this$workOptions10.vertices,c=_this$workOptions10.scale,p=_this$workOptions10.rotate,y=_this$workOptions10.translate,P=_this$workOptions10.strokeType,x=_this$workOptions10.eraserlines,v=n.worldScaling,_this$computDrawPoint6=this.computDrawPoints(s,d),T=_this$computDrawPoint6.rect,f=_this$computDrawPoint6.pos,g=_this$computDrawPoint6.points,u={close:!0,points:g,lineWidth:s,fillColor:o!=="transparent"&&o||void 0,strokeColor:a,normalize:!0,lineJoin:"round",lineCap:"round",lineDash:P===Lt.Dotted?[1,s*2]:P===Lt.LongDotted?[s,s*2]:void 0},m={name:e,id:e,zIndex:l,pos:f,anchor:[0.5,0.5],size:[T.w,T.h]};c&&(m.scale=c),p&&(m.rotate=p),y&&(m.translate=y);var M=new kt(m);if(i){var b=new ce({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/v[0],1/v[1]]});M.append(b);}var E=new le(_objectSpread(_objectSpread({},u),{},{pos:[0,0]}));M.append(E),x&&this.drawEraserlines({group:M,eraserlines:x,pos:f,layer:n}),this.replace(n,e,M);var A=M.getBoundingClientRect();return{x:Math.floor(A.x-vt.SafeBorderPadding),y:Math.floor(A.y-vt.SafeBorderPadding),w:Math.floor(A.width+vt.SafeBorderPadding*2),h:Math.floor(A.height+vt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t,e){var n=Bt(this.tmpPoints),i=[Math.floor(n.x+n.w/2),Math.floor(n.y+n.h/2)],a=Ci(n.w,n.h),o=Math.floor(Math.min(n.w,n.h)/2),s=[],l=2*Math.PI/e;for(var c=0;c<e;c++){var p=c*l-0.5*Math.PI,y=o*a[0]*Math.cos(p),P=o*a[1]*Math.sin(p);s.push(y,P);}return{rect:Bt(this.tmpPoints,t),pos:i,points:s};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a)||xt.Sub(i,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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a,isDrawing:!1});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:o&&vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var P;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.toolsType,l=n.vertices,d=n.strokeType,c=i.get(e.name),p=c==null?void 0:c.opt;var y=e;return e.tagName==="GROUP"&&(y=e.children[0]),a&&(y.setAttribute("strokeColor",a),p!=null&&p.strokeColor&&(p.strokeColor=a)),o&&(o==="transparent"?y.setAttribute("fillColor","rgba(0,0,0,0)"):y.setAttribute("fillColor",o),p!=null&&p.fillColor&&(p.fillColor=o)),s===ut.Polygon&&l&&(p.vertices=l),d&&c!=null&&c.opt&&(P=c.opt)!=null&&P.strokeType&&(c.opt.strokeType=d),c&&i.setInfo(e.name,_objectSpread(_objectSpread({},c),{},{opt:p})),vt.updateNodeOpt(t);}}]);}(vt);var qt=/*#__PURE__*/function(){function qt(){_classCallCheck(this,qt);}return _createClass(qt,null,[{key:"bezier",value:function bezier(r,t){var e=[];for(var n=0;n<t.length;n+=4){var i=t[n],a=t[n+1],o=t[n+2],s=t[n+3];i&&a&&o&&s?e.push.apply(e,_toConsumableArray(qt.getBezierPoints(r,i,a,o,s))):i&&a&&o?e.push.apply(e,_toConsumableArray(qt.getBezierPoints(r,i,a,o))):i&&a?e.push.apply(e,_toConsumableArray(qt.getBezierPoints(r,i,a))):i&&e.push(i);}return e;}/**
407
+ null;}function ve(h,r){var t=0;return h[0]<r[0]?t|=1:h[0]>r[2]&&(t|=2),h[1]<r[1]?t|=4:h[1]>r[3]&&(t|=8),t;}var Dr=/* @__PURE__ */fe(wd);var Se=/*#__PURE__*/function(_vt3){function Se(t,e){var _this67;_classCallCheck(this,Se);_this67=_callSuper(this,Se,[t]);et(_this67,"canRotate",!1);et(_this67,"scaleType",jt.none);et(_this67,"toolsType",ut.Eraser);et(_this67,"serviceWork");et(_this67,"tmpPoints",[]);et(_this67,"workOptions");et(_this67,"worldPosition");et(_this67,"worldScaling");et(_this67,"eraserRect");et(_this67,"eraserPolyline");_this67.serviceWork=e,_this67.workOptions=t.toolsOpt,_this67.worldPosition=_this67.fullLayer.worldPosition,_this67.worldScaling=_this67.fullLayer.worldScaling;return _this67;}_inherits(Se,_vt3);return _createClass(Se,[{key:"combineConsume",value:function combineConsume(){}},{key:"consumeService",value:function consumeService(){}},{key:"setWorkOptions",value:function setWorkOptions(t){_superPropGet(Se,"setWorkOptions",this,3)([t]);}},{key:"createEraserRect",value:function createEraserRect(t){var e=t[0]*this.worldScaling[0]+this.worldPosition[0],n=t[1]*this.worldScaling[1]+this.worldPosition[1],_Se$eraserSizes$this$=Se.eraserSizes[this.workOptions.thickness],i=_Se$eraserSizes$this$.width,a=_Se$eraserSizes$this$.height;this.eraserRect={x:e-i*0.5,y:n-a*0.5,w:i,h:a},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 _e3=new _(this.tmpPoints[0],this.tmpPoints[1]),n=new _(this.tmpPoints[2],this.tmpPoints[3]),i=_.Sub(n,_e3).uni(),a=_.Dist(_e3,n),_Se$eraserSizes$this$2=Se.eraserSizes[this.workOptions.thickness],o=_Se$eraserSizes$this$2.width,s=_Se$eraserSizes$this$2.height,l=Math.min(o,s),d=Math.round(a/l);if(d>1){var c=[];for(var p=0;p<d;p++){var y=_.Mul(i,p*l);c.push(this.tmpPoints[0]+y.x,this.tmpPoints[1]+y.y);}return c.concat(t);}}return t;}},{key:"isNear",value:function isNear(t,e){var n=new _(t[0],t[1]),i=new _(e[0],e[1]),_Se$eraserSizes$this$3=Se.eraserSizes[this.workOptions.thickness],a=_Se$eraserSizes$this$3.width,o=_Se$eraserSizes$this$3.height;return _.Dist(n,i)<Math.hypot(a,o)*0.5;}},{key:"remove",value:function remove(t){var _this68=this;var e=t.curNodeMap,n=t.removeIds;var i;var _iterator16=_createForOfIteratorHelper(e.values()),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var a=_step16.value;if(a.rect&&this.eraserRect&&this.eraserPolyline&&We(this.eraserRect,a.rect)){var o=a.op,s=[],l=[];for(var c=0;c<o.length;c+=3){var p=new _(o[c]*this.worldScaling[0]+this.worldPosition[0],o[c+1]*this.worldScaling[1]+this.worldPosition[1],o[c+2]);l.push(p),s.push(new xt(p.x,p.y));}var d=s.length&&Bt(s)||a.rect;We(d,this.eraserRect)&&(l.length>1?Dr.polyline(l.map(function(p){return p.XY;}),this.eraserPolyline).length&&n.add(a.name):n.add(a.name),i=Pt(i,d));}}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}return n.forEach(function(a){var s;var o=_this68.fullLayer.getElementsByName(a);_this68.fullLayer.removeChild(o[0]),(s=_this68.vNodes)==null||s["delete"](a);}),i&&(i.x-=vt.SafeBorderPadding,i.y-=vt.SafeBorderPadding,i.w+=vt.SafeBorderPadding*2,i.h+=vt.SafeBorderPadding*2),i;}},{key:"consume",value:function consume(t){var e=t.data.op;if(!e||e.length===0)return _objectSpread({type:at.None},this.baseConsumeResult);var n=this.tmpPoints.length;if(n>1&&this.isNear([e[0],e[1]],[this.tmpPoints[n-2],this.tmpPoints[n-1]]))return _objectSpread({type:at.None},this.baseConsumeResult);n<3?this.tmpPoints.push(e[0],e[1]):this.tmpPoints.splice(2,2,e[0],e[1]);var i=this.computRectCenterPoints();var a;var o=/* @__PURE__ */new Set();if(!this.vNodes)return _objectSpread({type:at.None},this.baseConsumeResult);var s=this.getCanEraserNodeMap(this.vNodes.getCanEraserNodes(this.vNodes.curNodeMap));for(var l=0;l<i.length-1;l+=2){this.createEraserRect(i.slice(l,l+2));var d=this.remove({curNodeMap:s,removeIds:o});a=Pt(a,d);}return a&&o.size?{type:at.RemoveNode,rect:a,removeIds:_toConsumableArray(o)}:_objectSpread({type:at.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 e;if(this.serviceWork){var n=new Map(t),i=this.serviceWork.selectorWorkShapes,a=this.serviceWork.workShapes;var _iterator17=_createForOfIteratorHelper(i.values()),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var o=_step17.value;if((e=o.selectIds)!=null&&e.length){var _iterator19=_createForOfIteratorHelper(o.selectIds),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var s=_step19.value;n["delete"](s);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}}}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}var _iterator18=_createForOfIteratorHelper(a.keys()),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var _o4=_step18.value;n["delete"](_o4);}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}return n;}return t;}}]);}(vt);// 来源于white-sdk
408
+ et(Se,"eraserSizes",Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50})]));var se=Se;var Nd="__lodash_hash_undefined__";function Wd(h){return this.__data__.set(h,Nd),this;}var Bd=Wd;function Fd(h){return this.__data__.has(h);}var Ud=Fd,jd=$n,$d=Bd,zd=Ud;function Ye(h){var r=-1,t=h==null?0:h.length;for(this.__data__=new jd();++r<t;)this.add(h[r]);}Ye.prototype.add=Ye.prototype.push=$d;Ye.prototype.has=zd;var Nr=Ye;function Gd(h,r){for(var t=-1,e=h==null?0:h.length;++t<e;)if(r(h[t],t,h))return!0;return!1;}var Hd=Gd;function Kd(h,r){return h.has(r);}var Wr=Kd,Yd=Nr,Vd=Hd,Xd=Wr,kd=1,Jd=2;function Zd(h,r,t,e,n,i){var a=t&kd,o=h.length,s=r.length;if(o!=s&&!(a&&s>o))return!1;var l=i.get(h),d=i.get(r);if(l&&d)return l==r&&d==h;var c=-1,p=!0,y=t&Jd?new Yd():void 0;for(i.set(h,r),i.set(r,h);++c<o;){var P=h[c],x=r[c];if(e)var v=a?e(x,P,c,r,h,i):e(P,x,c,h,r,i);if(v!==void 0){if(v)continue;p=!1;break;}if(y){if(!Vd(r,function(T,f){if(!Xd(y,f)&&(P===T||n(P,T,t,e,i)))return y.push(f);})){p=!1;break;}}else if(!(P===x||n(P,x,t,e,i))){p=!1;break;}}return i["delete"](h),i["delete"](r),p;}var gi=Zd;function Qd(h){var r=-1,t=Array(h.size);return h.forEach(function(e,n){t[++r]=[n,e];}),t;}var qd=Qd;function _d(h){var r=-1,t=Array(h.size);return h.forEach(function(e){t[++r]=e;}),t;}var Br=_d,pn=Be,mn=si,tg=Tr,eg=gi,rg=qd,ng=Br,ig=1,sg=2,og="[object Boolean]",ag="[object Date]",lg="[object Error]",cg="[object Map]",fg="[object Number]",hg="[object RegExp]",ug="[object Set]",dg="[object String]",gg="[object Symbol]",pg="[object ArrayBuffer]",mg="[object DataView]",vn=pn?pn.prototype:void 0,lr=vn?vn.valueOf:void 0;function vg(h,r,t,e,n,i,a){switch(t){case mg:if(h.byteLength!=r.byteLength||h.byteOffset!=r.byteOffset)return!1;h=h.buffer,r=r.buffer;case pg:return!(h.byteLength!=r.byteLength||!i(new mn(h),new mn(r)));case og:case ag:case fg:return tg(+h,+r);case lg:return h.name==r.name&&h.message==r.message;case hg:case dg:return h==r+"";case cg:var o=rg;case ug:var s=e&ig;if(o||(o=ng),h.size!=r.size&&!s)return!1;var l=a.get(h);if(l)return l==r;e|=sg,a.set(h,r);var d=eg(o(h),o(r),e,n,i,a);return a["delete"](h),d;case gg:if(lr)return lr.call(h)==lr.call(r);}return!1;}var yg=vg,yn=ri,Sg=1,xg=Object.prototype,Tg=xg.hasOwnProperty;function Mg(h,r,t,e,n,i){var a=t&Sg,o=yn(h),s=o.length,l=yn(r),d=l.length;if(s!=d&&!a)return!1;for(var c=s;c--;){var p=o[c];if(!(a?p in r:Tg.call(r,p)))return!1;}var y=i.get(h),P=i.get(r);if(y&&P)return y==r&&P==h;var x=!0;i.set(h,r),i.set(r,h);for(var v=a;++c<s;){p=o[c];var T=h[p],f=r[p];if(e)var g=a?e(f,T,p,r,h,i):e(T,f,p,h,r,i);if(!(g===void 0?T===f||n(T,f,t,e,i):g)){x=!1;break;}v||(v=p=="constructor");}if(x&&!v){var u=h.constructor,m=r.constructor;u!=m&&"constructor"in h&&"constructor"in r&&!(typeof u=="function"&&u instanceof u&&typeof m=="function"&&m instanceof m)&&(x=!1);}return i["delete"](h),i["delete"](r),x;}var Pg=Mg,cr=zn,Og=gi,Eg=yg,Cg=Pg,Sn=or,xn=Fe,Tn=Pr,Ag=kn,Rg=1,Mn="[object Arguments]",Pn="[object Array]",je="[object Object]",Ig=Object.prototype,On=Ig.hasOwnProperty;function Lg(h,r,t,e,n,i){var a=xn(h),o=xn(r),s=a?Pn:Sn(h),l=o?Pn:Sn(r);s=s==Mn?je:s,l=l==Mn?je:l;var d=s==je,c=l==je,p=s==l;if(p&&Tn(h)){if(!Tn(r))return!1;a=!0,d=!1;}if(p&&!d)return i||(i=new cr()),a||Ag(h)?Og(h,r,t,e,n,i):Eg(h,r,s,t,e,n,i);if(!(t&Rg)){var y=d&&On.call(h,"__wrapped__"),P=c&&On.call(r,"__wrapped__");if(y||P){var x=y?h.value():h,v=P?r.value():r;return i||(i=new cr()),n(x,v,t,e,i);}}return p?(i||(i=new cr()),Cg(h,r,t,e,n,i)):!1;}var bg=Lg,wg=bg,En=ne;function pi(h,r,t,e,n){return h===r?!0:h==null||r==null||!En(h)&&!En(r)?h!==h&&r!==r:wg(h,r,t,e,pi,n);}var Dg=pi,Ng=Dg;function Wg(h,r){return Ng(h,r);}var Bg=Wg,oe=/* @__PURE__ */fe(Bg);var _e=/*#__PURE__*/function(_vt4){function _e(t){var _this69;_classCallCheck(this,_e);_this69=_callSuper(this,_e,[t]);et(_this69,"toolsType",ut.Selector);et(_this69,"tmpPoints",[]);et(_this69,"workOptions");et(_this69,"vNodes");et(_this69,"selectIds");et(_this69,"selectorColor");et(_this69,"strokeColor");et(_this69,"fillColor");et(_this69,"oldSelectRect");et(_this69,"canRotate",!1);et(_this69,"canTextEdit",!1);et(_this69,"canLock",!1);et(_this69,"scaleType",jt.all);et(_this69,"toolsTypes");et(_this69,"shapeOpt");et(_this69,"textOpt");et(_this69,"isLocked");et(_this69,"thickness");et(_this69,"strokeType");et(_this69,"useStroke");_this69.workOptions=t.toolsOpt,_this69.vNodes=t.vNodes;return _this69;}_inherits(_e,_vt4);return _createClass(_e,[{key:"computSelector",value:function computSelector(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;var e=Bt(this.tmpPoints);if(e.w===0||e.h===0)return{selectIds:[],intersectRect:void 0,subNodeMap:/* @__PURE__ */new Map()};var _this$vNodes$getRectI=this.vNodes.getRectIntersectRange(e,t),n=_this$vNodes$getRectI.rectRange,i=_this$vNodes$getRectI.nodeRange;return{selectIds:_toConsumableArray(i.keys()),intersectRect:n,subNodeMap:i};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=this.tmpPoints.length,n=t.length;if(n>1){var i=new xt(t[n-2]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[n-1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]);e===2?this.tmpPoints.splice(1,1,i):this.tmpPoints.push(i);}}},{key:"drawSelector",value:function drawSelector(t){var _this70=this;var e=t.drawRect,n=t.subNodeMap,i=t.selectorId,a=t.layer,o=t.isService,s=new kt({pos:[e.x,e.y],anchor:[0,0],size:[e.w,e.h],id:i,name:i,zIndex:9999}),l=[];if(o){var d=new Gr({normalize:!0,pos:[e.w/2,e.h/2],lineWidth:1,strokeColor:this.selectorColor||this.workOptions.strokeColor,width:e.w,height:e.h,name:_e.selectorBorderId});l.push(d);}n.forEach(function(d,c){var p=[d.rect.x+d.rect.w/2-e.x,d.rect.y+d.rect.h/2-e.y],y=new Gr({normalize:!0,pos:p,lineWidth:1,strokeColor:n.size>1?_this70.selectorColor||_this70.workOptions.strokeColor:void 0,width:d.rect.w,height:d.rect.h,id:"selector-".concat(c),name:"selector-".concat(c)});l.push(y);}),l&&s.append.apply(s,l),(a==null?void 0:a.parent).appendChild(s);}},{key:"draw",value:function draw(t,e,n){var i=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var s,l;var a=n.intersectRect,o=n.subNodeMap;(l=(s=e.parent)==null?void 0:s.getElementById(t))==null||l.remove(),a&&this.drawSelector({drawRect:a,subNodeMap:o,selectorId:t,layer:e,isService:i});}},{key:"getSelecteorInfo",value:function getSelecteorInfo(t){this.scaleType=jt.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 e=/* @__PURE__ */new Set();var n,i=!0;var _iterator20=_createForOfIteratorHelper(t.values()),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var a=_step20.value;var o=a.opt,s=a.canRotate,l=a.scaleType,d=a.toolsType;this.selectorColor=this.workOptions.strokeColor,o.strokeColor&&(this.strokeColor=o.strokeColor),o.fillColor&&(this.fillColor=o.fillColor),o.textOpt&&(this.textOpt=o.textOpt),o.thickness&&(this.thickness=o.thickness),d!==ut.Pencil&&(i=!1),o.strokeType&&(this.strokeType=o.strokeType),d===ut.SpeechBalloon&&(e.add(d),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.placement=o.placement),d===ut.Polygon&&(e.add(d),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=o.vertices),d===ut.Star&&(e.add(d),this.shapeOpt||(this.shapeOpt={}),this.shapeOpt.vertices=o.vertices,this.shapeOpt.innerRatio=o.innerRatio,this.shapeOpt.innerVerticeStep=o.innerVerticeStep),d===ut.Text&&(this.textOpt=o),t.size===1&&(this.textOpt&&(this.canTextEdit=!0),this.canRotate=s,this.scaleType=l),l===jt.none&&(this.scaleType=l),d===ut.Image&&(n=a);}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}i&&(this.useStroke=!0),e.size&&(this.toolsTypes=_toConsumableArray(e)),n&&(t.size===1?(this.canLock=!0,n.opt.locked&&(this.isLocked=!0,this.scaleType=jt.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,e;if(this.scaleType===jt.both&&((t=this.selectIds)==null?void 0:t.length)===1){var n=this.selectIds[0],i=(e=this.vNodes.get(n))==null?void 0:e.op;if(i){var a=[];for(var o=0;o<i.length;o+=3)a.push([i[o],i[o+1]]);return a;}}}},{key:"consume",value:function consume(t){var _t$data2=t.data,e=_t$data2.op,n=_t$data2.workState;var i=this.oldSelectRect;if(n===It.Start&&(i=this.unSelectedAllIds()),!(e!=null&&e.length)||!this.vNodes.curNodeMap.size)return{type:at.None};this.updateTempPoints(e);var a=this.computSelector();if(this.selectIds&&oe(this.selectIds,a.selectIds))return{type:at.None};this.selectIds=a.selectIds;var o=a.intersectRect;this.getSelecteorInfo(a.subNodeMap),this.draw(Nt,this.fullLayer,a),this.oldSelectRect=o;var s=this.getChildrenPoints();return _objectSpread({type:at.Select,dataType:Mt.Local,rect:Pt(o,i),selectIds:a.selectIds,selectRect:o,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:s,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var e,n;var t=this.oldSelectRect;if(!((e=this.selectIds)!=null&&e.length)&&this.tmpPoints[0]&&this.selectSingleTool(this.tmpPoints[0].XY,Nt,!1),(n=this.selectIds)!=null&&n.length&&(t=this.selectedByIds(this.selectIds)),t){var i=this.getChildrenPoints();return _objectSpread({type:at.Select,dataType:Mt.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:i,isLocked:this.isLocked,toolsTypes:this.toolsTypes,shapeOpt:this.shapeOpt,thickness:this.thickness,useStroke:this.useStroke,strokeType:this.strokeType},this.baseConsumeResult);}return{type:at.None};}},{key:"consumeService",value:function consumeService(){}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}},{key:"clearSelectData",value:function clearSelectData(){this.selectIds=void 0,this.oldSelectRect=void 0;}},{key:"selectSingleTool",value:function selectSingleTool(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Nt;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;if(t.length===2){var i=t[0],a=t[1];var o;var _this$vNodes$getRectI2=this.vNodes.getRectIntersectRange({x:i,y:a,w:0,h:0},!1),s=_this$vNodes$getRectI2.nodeRange,l=_toConsumableArray(s.values()).sort(function(d,c){return(c.opt.zIndex||0)-(d.opt.zIndex||0);});var _iterator21=_createForOfIteratorHelper(l),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _d9=_step21.value;var _c5=this.fullLayer.getElementsByName(_d9.name);if(Oi(_c5).find(function(y){return y.isPointCollision(i,a);})){o=_d9;break;}}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}if(o){var d=o.name;if(!oe(this.oldSelectRect,o.rect)){var c=/* @__PURE__ */new Map([[d,o]]);this.getSelecteorInfo(c),this.draw(e,this.fullLayer,{intersectRect:o.rect,subNodeMap:c,selectIds:this.selectIds||[]},n);}this.selectIds=[d],this.oldSelectRect=o.rect;}}}},{key:"unSelectedAllIds",value:function unSelectedAllIds(){var t;var _iterator22=_createForOfIteratorHelper(this.vNodes.curNodeMap.entries()),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _step22$value=_slicedToArray(_step22.value,2),_e4=_step22$value[0],n=_step22$value[1];n.isSelected&&(t=Pt(t,n.rect),this.vNodes.unSelected(_e4));}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}return t;}},{key:"unSelectedByIds",value:function unSelectedByIds(t){var e;var _iterator23=_createForOfIteratorHelper(t),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var n=_step23.value;var i=this.vNodes.get(n);i&&i.isSelected&&(e=Pt(e,i.rect),this.vNodes.unSelected(n));}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}return e;}},{key:"selectedByIds",value:function selectedByIds(t){var e;var _iterator24=_createForOfIteratorHelper(t),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var n=_step24.value;var i=this.vNodes.get(n);i&&(e=Pt(e,i.rect),this.vNodes.selected(n));}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}return e;}},{key:"getSelectorRect",value:function getSelectorRect(t,e){var o;var n;var i=(o=t.parent)==null?void 0:o.getElementById(e),a=i==null?void 0:i.getBoundingClientRect();return a&&(n=Pt(n,{x:Math.floor(a.x),y:Math.floor(a.y),w:Math.floor(a.width+1),h:Math.floor(a.height+1)})),n;}},{key:"isCanFillColor",value:function isCanFillColor(t){return t===ut.Ellipse||t===ut.Triangle||t===ut.Rectangle||t===ut.Polygon||t===ut.Star||t===ut.SpeechBalloon;}},{key:"updateSelector",value:function(){var _updateSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(t){var m,e,n,i,a,o,s,l,d,c,p,y,P,x,v,T,f,_iterator25,_step25,M,E,A,b,O,L,w,I,R,W,z,K,g,_M9,_E4,_A5,u;return _regeneratorRuntime().wrap(function _callee22$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:e=t.updateSelectorOpt,n=t.selectIds,i=t.vNodes,a=t.willSerializeData,o=t.worker,s=t.offset,l=this.fullLayer;if(l){_context24.next=3;break;}return _context24.abrupt("return");case 3:c=/* @__PURE__ */new Map(),p=e.originPoint,y=e.workState,P=e.angle,x=e.translate,v=e.dir,T=e.scale;s&&(x?e.translate=[x[0]+s[0],x[1]+s[1]]:e.translate=s);if(!(p||x||_t(P))){_context24.next=9;break;}if(!(y===It.Start&&n)){_context24.next=8;break;}return _context24.abrupt("return",(i.setTargetAssignKeys(n),{type:at.Select,dataType:Mt.Local,selectRect:this.oldSelectRect,rect:this.oldSelectRect}));case 8:f=i.getLastTarget();case 9:if(!n){_context24.next=60;break;}_iterator25=_createForOfIteratorHelper(n);_context24.prev=11;_iterator25.s();case 13:if((_step25=_iterator25.n()).done){_context24.next=52;break;}M=_step25.value;E=i.get(M);if(!E){_context24.next=50;break;}A=E.toolsType,b=E.opt,O=(l==null?void 0:l.getElementsByName(M))[0];if(!O){_context24.next=50;break;}L=!1,w=!1;I=_objectSpread({},e);R=void 0;if(!A){_context24.next=50;break;}I.thickness&&E.opt.thickness&&(L=E.opt.thickness!==I.thickness),I.strokeType&&(m=E.opt)!=null&&m.strokeType&&(w=E.opt.strokeType!==I.strokeType),R=f==null?void 0:f.get(M);W=Pi(A);if(!(W==null||W.updateNodeOpt({node:O,opt:I,vNodes:i,willSerializeData:a,targetNode:R}),E&&o&&(a&&(I.angle||I.translate)||I.originPoint&&I.scenePoint&&I.scale||I.pointMap&&I.pointMap.has(M)||A===ut.Text&&(I.fontSize||I.translate||I.textInfos&&I.textInfos.get(M))||A===ut.Image&&(I.angle||I.translate||I.scale||I.strokeColor&&b.type===xr.Iconify)||A===I.toolsType&&I.willRefresh||L||w))){_context24.next=49;break;}z=o.createWorkShapeNode({workId:M,toolsType:A,toolsOpt:E.opt});z==null||z.setWorkId(M);K=void 0;if(!(A===ut.Image)){_context24.next=35;break;}_context24.next=32;return z.consumeServiceAsync({isFullWork:!0,replaceId:M,worker:o});case 32:K=_context24.sent;_context24.next=48;break;case 35:if(!(A===ut.Text)){_context24.next=41;break;}_context24.next=38;return z.consumeServiceAsync({isFullWork:!0,replaceId:M});case 38:K=_context24.sent;_context24.next=48;break;case 41:_context24.prev=41;K=z==null?void 0:z.consumeService({op:E.op,isFullWork:!0,replaceId:M});_context24.next=48;break;case 45:_context24.prev=45;_context24.t0=_context24["catch"](41);return _context24.abrupt("continue",50);case 48:K&&(E.rect=K);case 49:E&&(c.set(M,E),d=Pt(d,E.rect));case 50:_context24.next=13;break;case 52:_context24.next=57;break;case 54:_context24.prev=54;_context24.t1=_context24["catch"](11);_iterator25.e(_context24.t1);case 57:_context24.prev=57;_iterator25.f();return _context24.finish(57);case 60:f&&y===It.Done&&(i.deleteLastTarget(),f=void 0);g=d;if(!(p&&x&&T&&v&&g&&!s)){_context24.next=80;break;}_M9=[[g.x,g.y],[g.x+g.w,g.y],[g.x+g.w,g.y+g.h],[g.x,g.y+g.h]];_context24.t2=v;_context24.next=_context24.t2==="top"?67:_context24.t2==="topLeft"?67:_context24.t2==="left"?67:_context24.t2==="topRight"?69:_context24.t2==="right"?71:_context24.t2==="bottomRight"?71:_context24.t2==="bottom"?71:_context24.t2==="bottomLeft"?73:75;break;case 67:x[0]>0&&x[1]>0?_E4=_M9[0]:x[0]>0?_E4=_M9[3]:x[1]>0?_E4=_M9[1]:_E4=_M9[2];return _context24.abrupt("break",75);case 69:x[0]<0&&x[1]>0?_E4=_M9[1]:x[0]<0?_E4=_M9[2]:x[1]>0?_E4=_M9[0]:_E4=_M9[3];return _context24.abrupt("break",75);case 71:x[0]<0&&x[1]<0?_E4=_M9[2]:x[0]<0?_E4=_M9[1]:x[1]<0?_E4=_M9[3]:_E4=_M9[0];return _context24.abrupt("break",75);case 73:x[0]>0&&x[1]<0?_E4=_M9[3]:x[0]>0?_E4=_M9[0]:x[1]<0?_E4=_M9[2]:_E4=_M9[1];return _context24.abrupt("break",75);case 75:_A5=_E4&&[p[0]-_E4[0],p[1]-_E4[1]]||[0,0];if(oe(_A5,[0,0])){_context24.next=80;break;}_context24.next=79;return this.updateSelector(_objectSpread(_objectSpread({},t),{},{updateSelectorOpt:{},offset:_A5}));case 79:return _context24.abrupt("return",_context24.sent);case 80:this.getSelecteorInfo(c),this.draw(Nt,l,{selectIds:n||[],subNodeMap:c,intersectRect:g});u=Pt(this.oldSelectRect,g);return _context24.abrupt("return",(this.oldSelectRect=g,{type:at.Select,dataType:Mt.Local,selectRect:g,renderRect:d,rect:Pt(u,g),selectIds:n}));case 83:case"end":return _context24.stop();}},_callee22,this,[[11,54,57,60],[41,45]]);}));function updateSelector(_x26){return _updateSelector.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function blurSelector(){var t=this.unSelectedAllIds();return{type:at.Select,dataType:Mt.Local,rect:t,selectIds:[],willSyncService:!0};}},{key:"getRightServiceId",value:function getRightServiceId(t){return t.replace(De,"-");}},{key:"selectServiceNode",value:function selectServiceNode(t,e,n){var _this71=this;var i=e.selectIds,a=this.getRightServiceId(t),o=this.getSelectorRect(this.fullLayer,a);var s;var l=/* @__PURE__ */new Map();return i==null||i.forEach(function(d){var c=_this71.vNodes.get(d);c&&(s=Pt(s,c.rect),l.set(d,c));}),this.getSelecteorInfo(l),this.draw(a,this.fullLayer,{intersectRect:s,selectIds:i||[],subNodeMap:l},n),Pt(s,o);}},{key:"reRenderSelector",value:function reRenderSelector(){var _this72=this;var n;var t;var e=/* @__PURE__ */new Map();return(n=this.selectIds)==null||n.forEach(function(i){var a=_this72.vNodes.get(i);a&&(t=Pt(t,a.rect),e.set(i,a));},this),this.getSelecteorInfo(e),this.draw(Nt,this.fullLayer,{intersectRect:t,subNodeMap:e,selectIds:this.selectIds||[]}),this.oldSelectRect=t,t;}},{key:"updateSelectIds",value:function updateSelectIds(t){var a;var e;var n=(a=this.selectIds)==null?void 0:a.filter(function(o){return!t.includes(o);});if(n!=null&&n.length&&(e=this.unSelectedByIds(n)),t.length){var o=this.selectedByIds(t);e=Pt(e,o);}this.selectIds=t;var i=this.reRenderSelector();return{bgRect:e,selectRect:i};}},{key:"cursorHover",value:function cursorHover(t){var a,o;var e=this.oldSelectRect;this.selectIds=[];var n=(a=this.workId)==null?void 0:a.toString(),i=[t[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],t[1]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[1]];if(this.selectSingleTool(i,n,!0),this.oldSelectRect&&!oe(e,this.oldSelectRect))return{type:at.CursorHover,dataType:Mt.Local,rect:Pt(e,this.oldSelectRect),selectorColor:this.selectorColor,willSyncService:!1};if((o=this.selectIds)!=null&&o.length||(this.oldSelectRect=void 0),e&&!this.oldSelectRect)return this.cursorBlur(),{type:at.CursorHover,dataType:Mt.Local,rect:e,selectorColor:this.selectorColor,willSyncService:!1};}},{key:"cursorBlur",value:function cursorBlur(){var e,n;this.selectIds=[];var t=(e=this.workId)==null?void 0:e.toString();((n=this.fullLayer)==null?void 0:n.parent).children.forEach(function(i){i.name===t&&i.remove();});}}]);}(vt);et(_e,"selectorBorderId","selector-border");var Ve=_e;var mi=/*#__PURE__*/function(_vt5){function mi(t){var _this73;_classCallCheck(this,mi);_this73=_callSuper(this,mi,[t]);et(_this73,"canRotate",!1);et(_this73,"scaleType",jt.both);et(_this73,"toolsType",ut.Arrow);et(_this73,"tmpPoints",[]);et(_this73,"workOptions");et(_this73,"oldRect");et(_this73,"arrowTipWidth");et(_this73,"syncTimestamp");_this73.workOptions=t.toolsOpt,_this73.arrowTipWidth=_this73.workOptions.thickness*4,_this73.syncTimestamp=0,_this73.syncUnitTime=50;return _this73;}_inherits(mi,_vt5);return _createClass(mi,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:y});}if(!i){var _y8=Date.now();return _y8-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y8,_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread(_objectSpread({rect:p},this.baseConsumeResult),{},{type:at.DrawWork,dataType:Mt.Local});}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:vt.getCenterPos(n,e)}),_objectSpread(_objectSpread({rect:n},this.baseConsumeResult),{},{type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0});}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,_this$workOptions6=this.workOptions,i=_this$workOptions6.strokeColor,a=_this$workOptions6.thickness,o=_this$workOptions6.zIndex,s=_this$workOptions6.scale,l=_this$workOptions6.rotate,d=_this$workOptions6.translate,c=_this$workOptions6.strokeType,p=_this$workOptions6.eraserlines,y=n.worldPosition,P=n.worldScaling,_this$computDrawPoint2=this.computDrawPoints(a),x=_this$computDrawPoint2.points,v=_this$computDrawPoint2.pos,T=_this$computDrawPoint2.rect,f=_this$computDrawPoint2.isTriangle,g=_this$computDrawPoint2.trianglePoints,u=_this$computDrawPoint2.trianglePos,m=[T.x+T.w/2,T.y+T.h/2],M={pos:m,name:e,id:e,zIndex:o,anchor:[0.5,0.5],size:[T.w,T.h]};s&&(M.scale=s),l&&(M.rotate=l),d&&(M.translate=d);var E=new kt(M),A={points:g,pos:[u[0]-m[0],u[1]-m[1]],fillColor:i,strokeColor:i,lineWidth:0,normalize:!1},b=new le(A);if(E.append(b),!f&&x&&v){var O={points:x,pos:[v[0]-m[0],v[1]-m[1]],fillColor:i,strokeColor:i,lineDash:c===Lt.Dotted&&!f?[1,a*2]:c===Lt.LongDotted&&!f?[a,a*2]:void 0,lineCap:c===Lt.Normal?void 0:"round",lineWidth:a,normalize:!1},L=new le(O);E.append(L);}if(p&&this.drawEraserlines({group:E,eraserlines:p,pos:m,layer:n}),this.replace(n,e,E),s||l||d){var _O9=E.getBoundingClientRect();return{x:Math.floor(_O9.x-vt.SafeBorderPadding),y:Math.floor(_O9.y-vt.SafeBorderPadding),w:Math.floor(_O9.width+vt.SafeBorderPadding*2),h:Math.floor(_O9.height+vt.SafeBorderPadding*2)};}return{x:Math.floor(T.x*P[0]+y[0]-vt.SafeBorderPadding),y:Math.floor(T.y*P[1]+y[1]-vt.SafeBorderPadding),w:Math.floor(T.w*P[0]+2*vt.SafeBorderPadding),h:Math.floor(T.h*P[1]+2*vt.SafeBorderPadding)};}},{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 _this74=this;var e=_.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),n=_.Per(e).mul(t/2),i=xt.Sub(this.tmpPoints[0],n),a=xt.Add(this.tmpPoints[0],n),o=_.Mul(e,this.arrowTipWidth),s=_.Sub(this.tmpPoints[1],o),l=xt.Sub(s,n),d=xt.Add(s,n),c=_.Per(e).mul(t*1.5),p=xt.Sub(s,c),y=xt.Add(s,c),P=[this.tmpPoints[0],s],x=[p,this.tmpPoints[1],y],v=[i,a].concat(x,[l,d]);return{trianglePoints:x.map(function(T){return xt.Sub(T,_this74.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,points:P.map(function(T){return xt.Sub(T,_this74.tmpPoints[0]).XY;}).flat(1),rect:Bt(v),isTriangle:!1,pos:this.tmpPoints[0].XY};}},{key:"computTrianglePoints",value:function computTrianglePoints(){var _this75=this;var t=_.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),e=this.tmpPoints[1].distance(this.tmpPoints[0]),n=_.Per(t).mul(Math.floor(e*3/8)),i=xt.Sub(this.tmpPoints[0],n),a=xt.Add(this.tmpPoints[0],n),o=[i,this.tmpPoints[1],a];return{trianglePoints:o.map(function(s){return xt.Sub(s,_this75.tmpPoints[1]).XY;}).flat(1),trianglePos:this.tmpPoints[1].XY,rect:Bt(o),isTriangle:!0};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a))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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var l,d;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.strokeType,s=i.get(e.name);return a&&(e.tagName==="GROUP"?e.children.forEach(function(c){c.setAttribute("strokeColor",a),c.getAttribute("fillColor")&&c.setAttribute("fillColor",a);}):(e.setAttribute("strokeColor",a),e.setAttribute("fillColor",a)),(l=s==null?void 0:s.opt)!=null&&l.strokeColor&&(s.opt.strokeColor=a)),o&&s!=null&&s.opt&&(d=s.opt)!=null&&d.strokeType&&(s.opt.strokeType=o),s&&i.setInfo(e.name,s),vt.updateNodeOpt(t);}}]);}(vt);var vi=/*#__PURE__*/function(_vt6){function vi(t){var _this76;_classCallCheck(this,vi);_this76=_callSuper(this,vi,[t]);et(_this76,"canRotate",!1);et(_this76,"scaleType",jt.all);et(_this76,"toolsType",ut.Ellipse);et(_this76,"tmpPoints",[]);et(_this76,"workOptions");et(_this76,"oldRect");et(_this76,"syncTimestamp");_this76.workOptions=t.toolsOpt,_this76.syncTimestamp=0,_this76.syncUnitTime=50;return _this76;}_inherits(vi,_vt6);return _createClass(vi,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:y,isDrawing:!0});}if(!i){var _y9=Date.now();return _y9-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y9,_objectSpread(_objectSpread({type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult),{},{op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0})):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e,isDrawing:!1});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread(_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local},this.baseConsumeResult),{},{ops:a,isSync:!0});}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,i=t.isDrawing,_this$workOptions7=this.workOptions,a=_this$workOptions7.strokeColor,o=_this$workOptions7.fillColor,s=_this$workOptions7.thickness,l=_this$workOptions7.zIndex,d=_this$workOptions7.scale,c=_this$workOptions7.rotate,p=_this$workOptions7.translate,y=_this$workOptions7.strokeType,P=_this$workOptions7.eraserlines,x=n.worldScaling,_this$computDrawPoint3=this.computDrawPoints(s),v=_this$computDrawPoint3.radius,T=_this$computDrawPoint3.rect,f=_this$computDrawPoint3.pos,g={pos:f,name:e,id:e,radius:v,lineWidth:s,fillColor:o!=="transparent"&&o||void 0,strokeColor:a,normalize:!0,lineJoin:"round",lineCap:"round",lineDash:y===Lt.Dotted?[1,s*2]:y===Lt.LongDotted?[s,s*2]:void 0},u={name:e,id:e,zIndex:l,pos:f,anchor:[0.5,0.5],size:[T.w,T.h]};d&&(u.scale=d),c&&(u.rotate=c),p&&(u.translate=p);var m=new kt(u);if(i){var A=new ce({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/x[0],1/x[1]]});m.append(A);}var M=new Qi(_objectSpread(_objectSpread({},g),{},{pos:[0,0]}));m.append(M),P&&this.drawEraserlines({group:m,eraserlines:P,pos:f,layer:n}),this.replace(n,e,m);var E=m.getBoundingClientRect();return{x:Math.floor(E.x-vt.SafeBorderPadding),y:Math.floor(E.y-vt.SafeBorderPadding),w:Math.floor(E.width+vt.SafeBorderPadding*2),h:Math.floor(E.height+vt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t){var e=Bt(this.tmpPoints),n=Bt(this.tmpPoints,t),i=[Math.floor(e.x+e.w/2),Math.floor(e.y+e.h/2)];return{rect:n,pos:i,radius:[Math.floor(e.w/2),Math.floor(e.h/2)]};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a))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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a,isDrawing:!1});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,canRotate:this.canRotate,scaleType:this.scaleType,centerPos:vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var c,p,y;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.strokeType,l=i.get(e.name);var d=e;return e.tagName==="GROUP"&&(d=e.children[0]),a&&(d.setAttribute("strokeColor",a),(c=l==null?void 0:l.opt)!=null&&c.strokeColor&&(l.opt.strokeColor=a)),o&&(o==="transparent"?d.setAttribute("fillColor","rgba(0,0,0,0)"):d.setAttribute("fillColor",o),(p=l==null?void 0:l.opt)!=null&&p.fillColor&&(l.opt.fillColor=o)),s&&l!=null&&l.opt&&(y=l.opt)!=null&&y.strokeType&&(l.opt.strokeType=s),l&&i.setInfo(e.name,l),vt.updateNodeOpt(t);}}]);}(vt);var yi=/*#__PURE__*/function(_vt7){function yi(t){var _this77;_classCallCheck(this,yi);_this77=_callSuper(this,yi,[t]);et(_this77,"canRotate",!0);et(_this77,"scaleType",jt.all);et(_this77,"toolsType",ut.Rectangle);et(_this77,"tmpPoints",[]);et(_this77,"workOptions");et(_this77,"oldRect");et(_this77,"syncTimestamp");_this77.workOptions=t.toolsOpt,_this77.syncTimestamp=0,_this77.syncUnitTime=50;return _this77;}_inherits(yi,_vt7);return _createClass(yi,[{key:"transformData",value:function transformData(){var t=Bt(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 e=this.workOptions.thickness,n=[];var _iterator26=_createForOfIteratorHelper(t),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var o=_step26.value;n.push(_construct(_,_toConsumableArray(o)));}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}var i=Bt(n,e),a=[i.x+i.w/2,i.y+i.h/2];return{rect:i,pos:a,points:n.map(function(o){return o.XY;}).flat(1)};}},{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c=this.transformData();var p;if(i||a){var P=n?this.fullLayer:this.drawLayer||this.fullLayer;p=this.draw({ps:c,workId:o,layer:P,isDrawing:!0});}if(!i){var _P2=Date.now();return _P2-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_P2,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:c.flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var y=Pt(p,this.oldRect);return this.oldRect=p,_objectSpread({rect:y,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var s;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.transformData(),n=this.fullLayer,i=this.draw({ps:e,workId:t,layer:n,isDrawing:!1});this.oldRect=i;var a=e.flat(1),o=Zt(a);return(s=this.vNodes)==null||s.setInfo(t,{rect:i,op:a,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:i&&vt.getCenterPos(i,n)}),_objectSpread({rect:i,type:at.FullWork,dataType:Mt.Local,ops:o,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,i=t.isDrawing,a=t.ps,o=t.replaceId,_this$workOptions8=this.workOptions,s=_this$workOptions8.strokeColor,l=_this$workOptions8.fillColor,d=_this$workOptions8.thickness,c=_this$workOptions8.zIndex,p=_this$workOptions8.scale,y=_this$workOptions8.rotate,P=_this$workOptions8.translate,x=_this$workOptions8.strokeType,v=_this$workOptions8.eraserlines,T=n.worldPosition,f=n.worldScaling,_this$computDrawPoint4=this.computDrawPoints(a),g=_this$computDrawPoint4.points,u=_this$computDrawPoint4.rect,m=_this$computDrawPoint4.pos,M={close:!0,normalize:!0,points:g,lineWidth:d,fillColor:l!=="transparent"&&l||void 0,strokeColor:s,lineJoin:"round",lineCap:"round",lineDash:x===Lt.Dotted?[1,d*2]:x===Lt.LongDotted?[d,d*2]:void 0},E={x:Math.floor(u.x*f[0]+T[0]-vt.SafeBorderPadding),y:Math.floor(u.y*f[1]+T[1]-vt.SafeBorderPadding),w:Math.floor(u.w*f[0]+2*vt.SafeBorderPadding),h:Math.floor(u.h*f[0]+2*vt.SafeBorderPadding)},A=new kt({name:e,id:e,zIndex:c,pos:m,anchor:[0.5,0.5],size:[u.w,u.h],scale:p,rotate:y,translate:P}),b=new le(_objectSpread(_objectSpread({},M),{},{pos:[0,0]}));if(A.appendChild(b),i){var O=new ce({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:s,lineWidth:1,scale:[1/f[0],1/f[1]]});A.appendChild(O);}if(v&&this.drawEraserlines({group:A,eraserlines:v,pos:m,layer:n}),this.replace(n,o||e,A),p||y||P){var _O10=A.getBoundingClientRect();return{x:Math.floor(_O10.x-vt.SafeBorderPadding),y:Math.floor(_O10.y-vt.SafeBorderPadding),w:Math.floor(_O10.width+2*vt.SafeBorderPadding),h:Math.floor(_O10.height+2*vt.SafeBorderPadding)};}return E;}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a))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 d,c;var e=t.op,n=t.isFullWork,i=t.replaceId,a=(d=this.workId)==null?void 0:d.toString();if(!a)return;var o=[];for(var p=0;p<e.length;p+=3)o.push([e[p],e[p+1],e[p+2]]);var s=n?this.fullLayer:this.drawLayer||this.fullLayer,l=this.draw({ps:o,workId:a,layer:s,isDrawing:!1,replaceId:i});return this.oldRect=l,(c=this.vNodes)==null||c.setInfo(a,{rect:l,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:l&&vt.getCenterPos(l,s)}),l;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var c,p,y;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.strokeType,l=i.get(e.name);var d=e;return e.tagName==="GROUP"&&(d=e.children[0]),a&&(d.setAttribute("strokeColor",a),(c=l==null?void 0:l.opt)!=null&&c.strokeColor&&(l.opt.strokeColor=a)),o&&(o==="transparent"?d.setAttribute("fillColor","rgba(0,0,0,0)"):d.setAttribute("fillColor",o),(p=l==null?void 0:l.opt)!=null&&p.fillColor&&(l.opt.fillColor=o)),s&&l!=null&&l.opt&&(y=l.opt)!=null&&y.strokeType&&(l.opt.strokeType=s),l&&i.setInfo(e.name,l),vt.updateNodeOpt(t);}}]);}(vt);var Si=/*#__PURE__*/function(_vt8){function Si(t){var _this78;_classCallCheck(this,Si);_this78=_callSuper(this,Si,[t]);et(_this78,"canRotate",!1);et(_this78,"scaleType",jt.all);et(_this78,"toolsType",ut.Star);et(_this78,"tmpPoints",[]);et(_this78,"workOptions");et(_this78,"oldRect");et(_this78,"syncTimestamp");_this78.workOptions=t.toolsOpt,_this78.syncTimestamp=0,_this78.syncUnitTime=50;return _this78;}_inherits(Si,_vt8);return _createClass(Si,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:y,isDrawing:!0});}if(!i){var _y10=Date.now();return _y10-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y10,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e,isDrawing:!1});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,i=t.isDrawing,_this$workOptions9=this.workOptions,a=_this$workOptions9.strokeColor,o=_this$workOptions9.fillColor,s=_this$workOptions9.thickness,l=_this$workOptions9.zIndex,d=_this$workOptions9.vertices,c=_this$workOptions9.innerVerticeStep,p=_this$workOptions9.innerRatio,y=_this$workOptions9.scale,P=_this$workOptions9.rotate,x=_this$workOptions9.translate,v=_this$workOptions9.strokeType,T=_this$workOptions9.eraserlines,f=n.worldScaling,_this$computDrawPoint5=this.computDrawPoints(s,d,c,p),g=_this$computDrawPoint5.rect,u=_this$computDrawPoint5.pos,m=_this$computDrawPoint5.points,M={close:!0,points:m,lineWidth:s,fillColor:o!=="transparent"&&o||void 0,strokeColor:a,normalize:!0,lineJoin:"round",lineCap:"round",lineDash:v===Lt.Dotted?[1,s*2]:v===Lt.LongDotted?[s,s*2]:void 0},E={name:e,id:e,zIndex:l,pos:u,anchor:[0.5,0.5],size:[g.w,g.h]};y&&(E.scale=y),P&&(E.rotate=P),x&&(E.translate=x);var A=new kt(E);if(i){var L=new ce({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/f[0],1/f[1]]});A.append(L);}var b=new le(_objectSpread(_objectSpread({},M),{},{pos:[0,0]}));A.append(b),T&&this.drawEraserlines({group:A,eraserlines:T,pos:u,layer:n}),this.replace(n,e,A);var O=A.getBoundingClientRect();return{x:Math.floor(O.x-vt.SafeBorderPadding),y:Math.floor(O.y-vt.SafeBorderPadding),w:Math.floor(O.width+vt.SafeBorderPadding*2),h:Math.floor(O.height+vt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t,e,n,i){var a=Bt(this.tmpPoints),o=[Math.floor(a.x+a.w/2),Math.floor(a.y+a.h/2)],s=Ci(a.w,a.h),l=Math.floor(Math.min(a.w,a.h)/2),d=i*l,c=[],p=2*Math.PI/e;for(var P=0;P<e;P++){var x=P*p-0.5*Math.PI;var v=void 0,_T32=void 0;P%n===1?(v=d*s[0]*Math.cos(x),_T32=d*s[1]*Math.sin(x)):(v=l*s[0]*Math.cos(x),_T32=l*s[1]*Math.sin(x),c.push(v,_T32)),c.push(v,_T32);}return{rect:Bt(this.tmpPoints,t),pos:o,points:c};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a)||xt.Sub(i,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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a,isDrawing:!1});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:o&&vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var v;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.toolsType,l=n.vertices,d=n.innerVerticeStep,c=n.innerRatio,p=n.strokeType,y=i.get(e.name),P=y==null?void 0:y.opt;var x=e;return e.tagName==="GROUP"&&(x=e.children[0]),a&&(x.setAttribute("strokeColor",a),P!=null&&P.strokeColor&&(P.strokeColor=a)),o&&(o==="transparent"?x.setAttribute("fillColor","rgba(0,0,0,0)"):x.setAttribute("fillColor",o),P!=null&&P.fillColor&&(P.fillColor=o)),s===ut.Star&&(l&&(P.vertices=l),d&&(P.innerVerticeStep=d),c&&(P.innerRatio=c)),p&&y!=null&&y.opt&&(v=y.opt)!=null&&v.strokeType&&(y.opt.strokeType=p),y&&i.setInfo(e.name,_objectSpread(_objectSpread({},y),{},{opt:P})),vt.updateNodeOpt(t);}}]);}(vt);var xi=/*#__PURE__*/function(_vt9){function xi(t){var _this79;_classCallCheck(this,xi);_this79=_callSuper(this,xi,[t]);et(_this79,"canRotate",!1);et(_this79,"scaleType",jt.all);et(_this79,"toolsType",ut.Polygon);et(_this79,"tmpPoints",[]);et(_this79,"workOptions");et(_this79,"oldRect");et(_this79,"syncTimestamp");_this79.workOptions=t.toolsOpt,_this79.syncTimestamp=0,_this79.syncUnitTime=50;return _this79;}_inherits(xi,_vt9);return _createClass(xi,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=e.op,s=this.workId,l=o==null?void 0:o.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(o[0],o[1])],d=!1):d=this.updateTempPoints(o),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:s,layer:y,isDrawing:!0});}if(!i){var _y11=Date.now();return _y11-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y11,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e,isDrawing:!1});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,i=t.isDrawing,_this$workOptions10=this.workOptions,a=_this$workOptions10.strokeColor,o=_this$workOptions10.fillColor,s=_this$workOptions10.thickness,l=_this$workOptions10.zIndex,d=_this$workOptions10.vertices,c=_this$workOptions10.scale,p=_this$workOptions10.rotate,y=_this$workOptions10.translate,P=_this$workOptions10.strokeType,x=_this$workOptions10.eraserlines,v=n.worldScaling,_this$computDrawPoint6=this.computDrawPoints(s,d),T=_this$computDrawPoint6.rect,f=_this$computDrawPoint6.pos,g=_this$computDrawPoint6.points,u={close:!0,points:g,lineWidth:s,fillColor:o!=="transparent"&&o||void 0,strokeColor:a,normalize:!0,lineJoin:"round",lineCap:"round",lineDash:P===Lt.Dotted?[1,s*2]:P===Lt.LongDotted?[s,s*2]:void 0},m={name:e,id:e,zIndex:l,pos:f,anchor:[0.5,0.5],size:[T.w,T.h]};c&&(m.scale=c),p&&(m.rotate=p),y&&(m.translate=y);var M=new kt(m);if(i){var b=new ce({d:"M-4,0H4M0,-4V4",normalize:!0,pos:[0,0],strokeColor:a,lineWidth:1,scale:[1/v[0],1/v[1]]});M.append(b);}var E=new le(_objectSpread(_objectSpread({},u),{},{pos:[0,0]}));M.append(E),x&&this.drawEraserlines({group:M,eraserlines:x,pos:f,layer:n}),this.replace(n,e,M);var A=M.getBoundingClientRect();return{x:Math.floor(A.x-vt.SafeBorderPadding),y:Math.floor(A.y-vt.SafeBorderPadding),w:Math.floor(A.width+vt.SafeBorderPadding*2),h:Math.floor(A.height+vt.SafeBorderPadding*2)};}},{key:"computDrawPoints",value:function computDrawPoints(t,e){var n=Bt(this.tmpPoints),i=[Math.floor(n.x+n.w/2),Math.floor(n.y+n.h/2)],a=Ci(n.w,n.h),o=Math.floor(Math.min(n.w,n.h)/2),s=[],l=2*Math.PI/e;for(var c=0;c<e;c++){var p=c*l-0.5*Math.PI,y=o*a[0]*Math.cos(p),P=o*a[1]*Math.sin(p);s.push(y,P);}return{rect:Bt(this.tmpPoints,t),pos:i,points:s};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a)||xt.Sub(i,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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a,isDrawing:!1});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:o&&vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var P;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.toolsType,l=n.vertices,d=n.strokeType,c=i.get(e.name),p=c==null?void 0:c.opt;var y=e;return e.tagName==="GROUP"&&(y=e.children[0]),a&&(y.setAttribute("strokeColor",a),p!=null&&p.strokeColor&&(p.strokeColor=a)),o&&(o==="transparent"?y.setAttribute("fillColor","rgba(0,0,0,0)"):y.setAttribute("fillColor",o),p!=null&&p.fillColor&&(p.fillColor=o)),s===ut.Polygon&&l&&(p.vertices=l),d&&c!=null&&c.opt&&(P=c.opt)!=null&&P.strokeType&&(c.opt.strokeType=d),c&&i.setInfo(e.name,_objectSpread(_objectSpread({},c),{},{opt:p})),vt.updateNodeOpt(t);}}]);}(vt);var qt=/*#__PURE__*/function(){function qt(){_classCallCheck(this,qt);}return _createClass(qt,null,[{key:"bezier",value:function bezier(r,t){var e=[];for(var n=0;n<t.length;n+=4){var i=t[n],a=t[n+1],o=t[n+2],s=t[n+3];i&&a&&o&&s?e.push.apply(e,_toConsumableArray(qt.getBezierPoints(r,i,a,o,s))):i&&a&&o?e.push.apply(e,_toConsumableArray(qt.getBezierPoints(r,i,a,o))):i&&a?e.push.apply(e,_toConsumableArray(qt.getBezierPoints(r,i,a))):i&&e.push(i);}return e;}/**
409
409
  * @desc 获取点,这里可以设置点的个数
410
410
  * @param {number} num 点个数
411
411
  * @param {Vec2d} p1 点坐标
@@ -433,7 +433,7 @@ et(Se,"eraserSizes",Object.freeze([Object.freeze({width:18,height:26}),Object.fr
433
433
  * @param {Array} p2 终点坐标
434
434
  * @param {Array} cp1 控制点1
435
435
  * @param {Array} cp2 控制点2
436
- */},{key:"threeBezier",value:function threeBezier(r,t,e,n,i){var a=t.x*(1-r)*(1-r)*(1-r)+3*e.x*r*(1-r)*(1-r)+3*n.x*r*r*(1-r)+i.x*r*r*r,o=t.y*(1-r)*(1-r)*(1-r)+3*e.y*r*(1-r)*(1-r)+3*n.y*r*r*(1-r)+i.y*r*r*r;return new _(a,o);}}]);}();var Ti=/*#__PURE__*/function(_vt10){function Ti(t){var _this80;_classCallCheck(this,Ti);_this80=_callSuper(this,Ti,[t]);et(_this80,"canRotate",!1);et(_this80,"scaleType",jt.all);et(_this80,"toolsType",ut.SpeechBalloon);et(_this80,"ratio",0.8);et(_this80,"tmpPoints",[]);et(_this80,"workOptions");et(_this80,"oldRect");et(_this80,"syncTimestamp");_this80.workOptions=t.toolsOpt,_this80.syncTimestamp=0,_this80.syncUnitTime=50;return _this80;}_inherits(Ti,_vt10);return _createClass(Ti,[{key:"consume",value:function consume(t){var y;var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=(y=e==null?void 0:e.workId)==null?void 0:y.toString();if(!o)return{type:at.None};var s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var P=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:P,isDrawing:!0});}if(!i){var _P3=Date.now();return _P3-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_P3,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(x){return[].concat(_toConsumableArray(x.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e,isDrawing:!1});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,_this$workOptions11=this.workOptions,i=_this$workOptions11.strokeColor,a=_this$workOptions11.fillColor,o=_this$workOptions11.thickness,s=_this$workOptions11.zIndex,l=_this$workOptions11.placement,d=_this$workOptions11.scale,c=_this$workOptions11.rotate,p=_this$workOptions11.translate,y=_this$workOptions11.strokeType,P=_this$workOptions11.eraserlines,_this$computDrawPoint7=this.computDrawPoints(o,l),x=_this$computDrawPoint7.rect,v=_this$computDrawPoint7.pos,T=_this$computDrawPoint7.points,f={points:T.map(function(E){return E.XY;}),lineWidth:o,fillColor:a!=="transparent"&&a||void 0,strokeColor:i,normalize:!0,className:"".concat(v[0],",").concat(v[1]),close:!0,lineJoin:"round",lineCap:"round",lineDash:y===Lt.Dotted?[1,o*2]:y===Lt.LongDotted?[o,o*2]:void 0},g={name:e,id:e,zIndex:s,pos:v,anchor:[0.5,0.5],size:[x.w,x.h]};d&&(g.scale=d),c&&(g.rotate=c),p&&(g.translate=p);var u=new kt(g),m=new le(_objectSpread(_objectSpread({},f),{},{pos:[0,0]}));u.append(m),P&&this.drawEraserlines({group:u,eraserlines:P,pos:v,layer:n}),this.replace(n,e,u);var M=u.getBoundingClientRect();return{x:Math.floor(M.x-vt.SafeBorderPadding),y:Math.floor(M.y-vt.SafeBorderPadding),w:Math.floor(M.width+vt.SafeBorderPadding*2),h:Math.floor(M.height+vt.SafeBorderPadding*2)};}},{key:"transformControlPoints",value:function transformControlPoints(t){var e=Bt(this.tmpPoints);switch(t){case"bottom":case"bottomLeft":case"bottomRight":{var n=e.y+e.h*this.ratio;return[new _(e.x,e.y,0),new _(e.x+e.w,e.y,0),new _(e.x+e.w,n,0),new _(e.x,n,0)];}case"top":case"topLeft":case"topRight":{var _n4=e.y+e.h*(1-this.ratio);return[new _(e.x,_n4,0),new _(e.x+e.w,_n4,0),new _(e.x+e.w,e.y+e.h,0),new _(e.x,e.y+e.h,0)];}case"left":case"leftBottom":case"leftTop":{var _n5=e.x+e.w*(1-this.ratio);return[new _(_n5,e.y,0),new _(e.x+e.w,e.y,0),new _(e.x+e.w,e.y+e.h,0),new _(_n5,e.y+e.h,0)];}case"right":case"rightBottom":case"rightTop":{var _n6=e.x+e.w*this.ratio;return[new _(e.x,e.y,0),new _(_n6,e.y,0),new _(_n6,e.y+e.h,0),new _(e.x,e.y+e.h,0)];}}}},{key:"computDrawPoints",value:function computDrawPoints(t,e){var n=Bt(this.tmpPoints),i=this.transformControlPoints(e),a=Math.floor(n.w*0.1),o=Math.floor(n.h*0.1),s=[],l=_.Add(i[0],new _(0,o,0)),d=_.Add(i[0],new _(a,0,0)),c=qt.getBezierPoints(10,l,i[0],d),p=_.Sub(i[1],new _(a,0,0)),y=_.Add(i[1],new _(0,o,0)),P=qt.getBezierPoints(10,p,i[1],y),x=_.Sub(i[2],new _(0,o,0)),v=_.Sub(i[2],new _(a,0,0)),T=qt.getBezierPoints(10,x,i[2],v),f=_.Add(i[3],new _(a,0,0)),g=_.Sub(i[3],new _(0,o,0)),u=qt.getBezierPoints(10,f,i[3],g),m=a*(1-this.ratio)*10,M=o*(1-this.ratio)*10;switch(e){case"bottom":{var b=_.Sub(i[2],new _(a*5-m/2,0,0)),O=_.Sub(i[2],new _(a*5,-M,0)),L=_.Sub(i[2],new _(a*5+m/2,0,0));s.push.apply(s,[O,L].concat(_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),[b]));break;}case"bottomRight":{var _b11=_.Sub(i[2],new _(a*1.1,0,0)),_O11=_.Sub(i[2],new _(a*1.1+m/2,-M,0)),_L8=_.Sub(i[2],new _(a*1.1+m,0,0));s.push.apply(s,[_O11,_L8].concat(_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),[_b11]));break;}case"bottomLeft":{var _b12=_.Add(i[3],new _(a*1.1+m,0,0)),_O12=_.Add(i[3],new _(a*1.1+m/2,M,0)),_L9=_.Add(i[3],new _(a*1.1,0,0));s.push.apply(s,[_O12,_L9].concat(_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),[_b12]));break;}case"top":{var _b13=_.Sub(i[1],new _(a*5-m/2,0,0)),_O13=_.Sub(i[1],new _(a*5,M,0)),_L10=_.Sub(i[1],new _(a*5+m/2,0,0));s.push.apply(s,[_O13,_b13].concat(_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),[_L10]));break;}case"topRight":{var _b14=_.Sub(i[1],new _(a*1.1,0,0)),_O14=_.Sub(i[1],new _(a*1.1+m/2,M,0)),_L11=_.Sub(i[1],new _(a*1.1+m,0,0));s.push.apply(s,[_O14,_b14].concat(_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),[_L11]));break;}case"topLeft":{var _b15=_.Add(i[0],new _(a*1.1+m,0,0)),_O15=_.Add(i[0],new _(a*1.1+m/2,-M,0)),_L12=_.Add(i[0],new _(a*1.1,0,0));s.push.apply(s,[_O15,_b15].concat(_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),[_L12]));break;}case"left":{var _b16=_.Add(i[0],new _(0,o*5-M/2,0)),_O16=_.Add(i[0],new _(-m,o*5,0)),_L13=_.Add(i[0],new _(0,o*5+M/2,0));s.push.apply(s,[_O16,_b16].concat(_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),[_L13]));break;}case"leftTop":{var _b17=_.Add(i[0],new _(0,o*1.1,0)),_O17=_.Add(i[0],new _(-m,o*1.1+M/2,0)),_L14=_.Add(i[0],new _(0,o*1.1+M,0));s.push.apply(s,[_O17,_b17].concat(_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),[_L14]));break;}case"leftBottom":{var _b18=_.Sub(i[3],new _(0,o*1.1+M,0)),_O18=_.Sub(i[3],new _(m,o*1.1+M/2,0)),_L15=_.Sub(i[3],new _(0,o*1.1,0));s.push.apply(s,[_O18,_b18].concat(_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),[_L15]));break;}case"right":{var _b19=_.Add(i[1],new _(0,o*5-M/2,0)),_O19=_.Add(i[1],new _(m,o*5,0)),_L16=_.Add(i[1],new _(0,o*5+M/2,0));s.push.apply(s,[_O19,_L16].concat(_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),[_b19]));break;}case"rightTop":{var _b20=_.Add(i[1],new _(0,o*1.1,0)),_O20=_.Add(i[1],new _(m,o*1.1+M/2,0)),_L17=_.Add(i[1],new _(0,o*1.1+M,0));s.push.apply(s,[_O20,_L17].concat(_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),[_b20]));break;}case"rightBottom":{var _b21=_.Sub(i[2],new _(0,o*1.1+M,0)),_O21=_.Sub(i[2],new _(-m,o*1.1+M/2,0)),_L18=_.Sub(i[2],new _(0,o*1.1,0));s.push.apply(s,[_O21,_L18].concat(_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),[_b21]));break;}}var E=Bt(this.tmpPoints,t),A=[Math.floor(E.x+E.w/2),Math.floor(E.y+E.h/2)];return{rect:E,pos:A,points:s};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a)||xt.Sub(i,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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a,isDrawing:!1});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:o&&vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var P;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.toolsType,l=n.placement,d=n.strokeType,c=i.get(e.name),p=c==null?void 0:c.opt;var y=e;return e.tagName==="GROUP"&&(y=e.children[0]),a&&(y.setAttribute("strokeColor",a),p!=null&&p.strokeColor&&(p.strokeColor=a)),o&&(o==="transparent"?y.setAttribute("fillColor","rgba(0,0,0,0)"):y.setAttribute("fillColor",o),p!=null&&p.fillColor&&(p.fillColor=o)),s===ut.SpeechBalloon&&l&&(p.placement=l),d&&c!=null&&c.opt&&(P=c.opt)!=null&&P.strokeType&&(c.opt.strokeType=d),c&&i.setInfo(e.name,_objectSpread(_objectSpread({},c),{},{opt:p})),vt.updateNodeOpt(t);}}]);}(vt);var B0=de,F0=ne,U0="[object Boolean]";function j0(h){return h===!0||h===!1||F0(h)&&B0(h)==U0;}var $0=j0,ye=/* @__PURE__ */fe($0);var Ne=/*#__PURE__*/function(_vt11){function Ne(t){var _this81;_classCallCheck(this,Ne);_this81=_callSuper(this,Ne,[t]);et(_this81,"canRotate",!0);et(_this81,"scaleType",jt.all);et(_this81,"toolsType",ut.Image);et(_this81,"tmpPoints",[]);et(_this81,"workOptions");et(_this81,"oldRect");_this81.workOptions=t.toolsOpt,_this81.scaleType=Ne.getScaleType(_this81.workOptions);return _this81;}_inherits(Ne,_vt11);return _createClass(Ne,[{key:"consume",value:function consume(){return{type:at.None};}},{key:"consumeAll",value:function consumeAll(){return{type:at.None};}},{key:"draw",value:function draw(t){var e=t.layer,n=t.workId,i=t.replaceId,a=t.imageBitmap,_this$workOptions12=this.workOptions,o=_this$workOptions12.centerX,s=_this$workOptions12.centerY,l=_this$workOptions12.width,d=_this$workOptions12.height,c=_this$workOptions12.rotate,p=_this$workOptions12.zIndex,y=_this$workOptions12.eraserlines,P=new kt({anchor:[0.5,0.5],pos:[o,s],name:n,size:[l,d],zIndex:p,rotate:c}),x={anchor:[0.5,0.5],pos:[0,0],size:[l,d],texture:a};a||(x.bgcolor="rgba(0,0,0,0.3)");var v=new ts(x);P.append(v),y&&this.drawEraserlines({group:P,eraserlines:y,pos:[o,s],layer:e}),this.replace(e,i||n,P);var T=P.getBoundingClientRect();if(T)return{x:Math.floor(T.x-vt.SafeBorderPadding),y:Math.floor(T.y-vt.SafeBorderPadding),w:Math.floor(T.width+vt.SafeBorderPadding*2),h:Math.floor(T.height+vt.SafeBorderPadding*2)};}},{key:"consumeService",value:function consumeService(){}},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(t){var d,c,p,y,e,n,i,_this$workOptions13,a,o,s,l,P,x;return _regeneratorRuntime().wrap(function _callee23$(_context25){while(1)switch(_context25.prev=_context25.next){case 0:e=t.isFullWork,n=t.replaceId,i=t.worker,_this$workOptions13=this.workOptions,a=_this$workOptions13.src,o=_this$workOptions13.uuid,s=((d=this.workId)==null?void 0:d.toString())||o,l=e?this.fullLayer:this.drawLayer||this.fullLayer;if(!a){_context25.next=8;break;}_context25.next=4;return i.loadImageBitMap({toolsType:this.toolsType,opt:this.workOptions,workId:s});case 4:P=_context25.sent;if(!P){_context25.next=8;break;}x=this.draw({workId:s,layer:l,replaceId:n,imageBitmap:P});return _context25.abrupt("return",(this.oldRect=s&&((p=(c=this.vNodes)==null?void 0:c.get(s))==null?void 0:p.rect)||void 0,(y=this.vNodes)==null||y.setInfo(s,{rect:x,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:x&&vt.getCenterPos(x,l)}),x));case 8:case"end":return _context25.stop();}},_callee23,this);}));function consumeServiceAsync(_x27){return _consumeServiceAsync.apply(this,arguments);}return consumeServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"getScaleType",value:function getScaleType(t){var e=t.uniformScale,n=t.rotate;return e!==!1||n&&Math.abs(n)%90>0?jt.proportional:jt.all;}},{key:"updateNodeOpt",value:function updateNodeOpt(t){var e=t.node,n=t.opt,i=t.vNodes,a=t.targetNode,o=n.translate,s=n.originPoint,l=n.scenePoint,d=n.scale,c=n.angle,p=n.isLocked,y=n.zIndex,P=n.strokeColor,x=a&&Xt(a)||i.get(e.name);if(!x)return;var v=e.parent;if(v){if(P&&(x.opt.strokeColor=P),_t(y)&&(e.setAttribute("zIndex",y),x.opt.zIndex=y),ye(p)&&(x.opt.locked=p),s&&l&&d&&o){var _x$opt=x.opt,_T33=_x$opt.centerX,_f29=_x$opt.centerY,g=_x$opt.width,u=_x$opt.height,m=_x$opt.uniformScale,M=m!==!1?[d[0],d[0]]:d,E=[_T33,_f29],A=[_T33,_f29];Ur(A,l,M,o);var b=[A[0]-E[0],A[1]-E[1]];if(x.centerPos=[x.centerPos[0]+b[0],x.centerPos[1]+b[1]],x.opt.width=Math.round(g*M[0]),x.opt.height=Math.round(u*M[1]),x.opt.centerX=A[0],x.opt.centerY=A[1],x.opt.eraserlines)for(var _i5=0,_Object$values4=Object.values(x.opt.eraserlines);_i5<_Object$values4.length;_i5++){var O=_Object$values4[_i5];var L=O.op,w=O.thickness;O.thickness=w*Math.max(d[0],d[1]);for(var I=0;I<L.length;I++)jr(L[I],l,d,o);}}else if(o){if(x.opt.centerX=x.opt.centerX+o[0],x.opt.centerY=x.opt.centerY+o[1],x.centerPos=[x.centerPos[0]+o[0],x.centerPos[1]+o[1]],x.opt.eraserlines)for(var _i6=0,_Object$values5=Object.values(x.opt.eraserlines);_i6<_Object$values5.length;_i6++){var _T34=_Object$values5[_i6];var _f30=_T34.op;for(var _g12=0;_g12<_f30.length;_g12++){var _u13=_f30[_g12].map(function(m,M){return M%2?m+o[1]:m+o[0];});_T34.op[_g12]=_u13;}}}else if(_t(c))if(x.opt.rotate=c,x.scaleType=Ne.getScaleType(x.opt),a){var _T35=Ei(x.rect,c);x.rect=_T35;}else{var _T36=vt.getRectFromLayer(v,e.name);x.rect=_T36||x.rect;}return x&&i.setInfo(e.name,x),x==null?void 0:x.rect;}}}]);}(vt);var Mi=/*#__PURE__*/function(_vt12){function Mi(t){var _this82;_classCallCheck(this,Mi);_this82=_callSuper(this,Mi,[t]);et(_this82,"canRotate",!1);et(_this82,"scaleType",jt.both);et(_this82,"toolsType",ut.Straight);et(_this82,"tmpPoints",[]);et(_this82,"workOptions");et(_this82,"oldRect");et(_this82,"straightTipWidth");et(_this82,"syncTimestamp");_this82.workOptions=t.toolsOpt,_this82.straightTipWidth=_this82.workOptions.thickness/2,_this82.syncTimestamp=0,_this82.syncUnitTime=50;return _this82;}_inherits(Mi,_vt12);return _createClass(Mi,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:y});}if(!i){var _y12=Date.now();return _y12-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y12,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,_this$workOptions14=this.workOptions,i=_this$workOptions14.strokeColor,a=_this$workOptions14.thickness,o=_this$workOptions14.zIndex,s=_this$workOptions14.scale,l=_this$workOptions14.rotate,d=_this$workOptions14.translate,c=_this$workOptions14.strokeType,p=_this$workOptions14.eraserlines,y=n.worldPosition,P=n.worldScaling,_this$computDrawPoint8=this.computDrawPoints(a,c),x=_this$computDrawPoint8.d,v=_this$computDrawPoint8.rect,T=_this$computDrawPoint8.isDot,f=[v.x+v.w/2,v.y+v.h/2],g=new kt({pos:f,anchor:[0.5,0.5],size:[v.w,v.h],name:e,id:e,normalize:!0,zIndex:o}),u={pos:[0,0],normalize:!0,d:x,fillColor:i,strokeColor:i,lineDash:c===Lt.Dotted&&!T?[1,a*2]:c===Lt.LongDotted&&!T?[a,a*2]:void 0,lineCap:c===Lt.Normal||T?void 0:"round",lineWidth:c===Lt.Normal||T?0:a};s&&(u.scale=s),l&&(u.rotate=l),d&&(u.translate=d);var m=new ce(u);if(g.append(m),p&&this.drawEraserlines({group:g,eraserlines:p,pos:f,layer:n}),this.replace(n,e,g),l||s||d){var E=m.getBoundingClientRect();return{x:Math.floor(E.x-vt.SafeBorderPadding),y:Math.floor(E.y-vt.SafeBorderPadding),w:Math.floor(E.width+vt.SafeBorderPadding*2),h:Math.floor(E.height+vt.SafeBorderPadding*2)};}return{x:Math.floor(v.x*P[0]+y[0]-vt.SafeBorderPadding),y:Math.floor(v.y*P[1]+y[1]-vt.SafeBorderPadding),w:Math.floor(v.w*P[0]+2*vt.SafeBorderPadding),h:Math.floor(v.h*P[1]+2*vt.SafeBorderPadding)};}},{key:"computDrawPoints",value:function computDrawPoints(t,e){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.straightTipWidth?this.computFullPoints(t,e):this.computDotPoints(t);}},{key:"computFullPoints",value:function computFullPoints(t,e){var n=_.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),i=_.Per(n).mul(t/2),a=xt.Sub(this.tmpPoints[0],i),o=xt.Add(this.tmpPoints[0],i),s=xt.Sub(this.tmpPoints[1],i),l=xt.Add(this.tmpPoints[1],i),d=xt.GetSemicircleStroke(this.tmpPoints[1],s,-1,8),c=xt.GetSemicircleStroke(this.tmpPoints[0],o,-1,8),p=[a,s].concat(_toConsumableArray(d),[l,o],_toConsumableArray(c));var y;return e!==Lt.Normal?y=ae(this.tmpPoints,!1):y=ae(p,!0),{d:y,rect:Bt(p),isDot:!1,pos:this.tmpPoints[0].XY};}},{key:"computDotPoints",value:function computDotPoints(t){var e=xt.GetDotStroke(this.tmpPoints[0],t/2,8);return{d:ae(e,!0),rect:Bt(e),isDot:!0,pos:this.tmpPoints[0].XY};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a))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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:o&&vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var l,d;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.strokeType,s=i.get(e.name);return a&&(e.tagName==="GROUP"?e.children.forEach(function(c){c.setAttribute("strokeColor",a),c.getAttribute("fillColor")&&c.setAttribute("fillColor",a);}):(e.setAttribute("strokeColor",a),e.setAttribute("fillColor",a)),(l=s==null?void 0:s.opt)!=null&&l.strokeColor&&(s.opt.strokeColor=a)),o&&s!=null&&s.opt&&(d=s.opt)!=null&&d.strokeType&&(s.opt.strokeType=o),s&&i.setInfo(e.name,s),vt.updateNodeOpt(t);}}]);}(vt);var ie=/*#__PURE__*/function(_vt13){function ie(t){var _this83;_classCallCheck(this,ie);_this83=_callSuper(this,ie,[t]);et(_this83,"canRotate",!1);et(_this83,"scaleType",jt.proportional);et(_this83,"toolsType",ut.Text);et(_this83,"tmpPoints",[]);et(_this83,"workOptions");et(_this83,"oldRect");_this83.workOptions=t.toolsOpt;return _this83;}_inherits(ie,_vt13);return _createClass(ie,[{key:"consume",value:function consume(){return{type:at.None};}},{key:"consumeAll",value:function consumeAll(){return{type:at.None};}},{key:"consumeService",value:function consumeService(){}},{key:"draw",value:function(){var _draw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(t){var e,n,i,_this$workOptions15,a,o,s,l,d,c,p,y,P,x,v,_T37,_f31;return _regeneratorRuntime().wrap(function _callee24$(_context26){while(1)switch(_context26.prev=_context26.next){case 0:e=t.workId,n=t.layer,i=t.isDrawLabel,_this$workOptions15=this.workOptions,a=_this$workOptions15.boxSize,o=_this$workOptions15.boxPoint,s=_this$workOptions15.zIndex,l=_this$workOptions15.eraserlines,d=n.worldPosition,c=n.worldScaling;if(!(!o||!a)){_context26.next=3;break;}return _context26.abrupt("return");case 3:p={name:e,id:e,pos:[o[0],o[1]],anchor:[0,0],size:a,zIndex:s},y=new kt(p),P={x:o[0],y:o[1],w:a[0],h:a[1]},x={x:Math.floor(P.x*c[0]+d[0]),y:Math.floor(P.y*c[1]+d[1]),w:Math.floor(P.w*c[0])+2,h:Math.floor(P.h*c[1])+2};if(!(this.replace(n,e,y),i&&n&&this.workOptions.text)){_context26.next=11;break;}_context26.next=7;return ie.createLabels(this.workOptions,n,x);case 7:v=_context26.sent;_T37=v.labels;_f31=v.maxWidth;y.append.apply(y,_toConsumableArray(_T37)),x.w=Math.ceil(Math.max(_f31*n.worldScaling[0],x.w));case 11:return _context26.abrupt("return",(l&&this.drawEraserlines({group:y,eraserlines:l,pos:[o[0],o[1]],layer:n}),x));case 12:case"end":return _context26.stop();}},_callee24,this);}));function draw(_x28){return _draw3.apply(this,arguments);}return draw;}()},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(t){var l,d,c,p,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee25$(_context27){while(1)switch(_context27.prev=_context27.next){case 0:e=(l=this.workId)==null?void 0:l.toString();if(e){_context27.next=3;break;}return _context27.abrupt("return");case 3:n=t.isFullWork,i=t.replaceId,a=t.isDrawLabel;this.oldRect=i&&((c=(d=this.vNodes)==null?void 0:d.get(i))==null?void 0:c.rect)||void 0;o=n?this.fullLayer:this.drawLayer||this.fullLayer;_context27.next=8;return this.draw({workId:e,layer:o,isDrawLabel:_typeof(a)>"u"&&this.workOptions.workState===It.Done||a});case 8:s=_context27.sent;return _context27.abrupt("return",((p=this.vNodes)==null||p.setInfo(e,{rect:s,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&vt.getCenterPos(s,o)}),s));case 10:case"end":return _context27.stop();}},_callee25,this);}));function consumeServiceAsync(_x29){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,e){var P,x,n,i,a,o,s,l,d,c,p,y;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:n=this.workId.toString(),i=t.fontColor,a=t.fontBgColor,o=t.bold,s=t.italic,l=t.lineThrough,d=t.underline,c=t.zIndex,p=(P=this.vNodes)==null?void 0:P.get(n);if(p){_context28.next=5;break;}return _context28.abrupt("return");case 5:i&&(p.opt.fontColor=i),a&&(p.opt.fontBgColor=a),o&&(p.opt.bold=o),s&&(p.opt.italic=s),ye(l)&&(p.opt.lineThrough=l),ye(d)&&(p.opt.underline=d),_t(c)&&(p.opt.zIndex=c),this.oldRect=p.rect;_context28.next=8;return this.draw({workId:n,layer:this.fullLayer,isDrawLabel:_typeof(e)>"u"&&this.workOptions.workState===It.Done||e});case 8:y=_context28.sent;return _context28.abrupt("return",((x=this.vNodes)==null||x.setInfo(n,{rect:y,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:y&&vt.getCenterPos(y,this.fullLayer)}),y));case 10:case"end":return _context28.stop();}},_callee26,this);}));function updataOptServiceAsync(_x30,_x31){return _updataOptServiceAsync.apply(this,arguments);}return updataOptServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"getSafetySnippetRatio",value:function getSafetySnippetRatio(t){var e=(t==null?void 0:t.parent).displayRatio||1,n=Math.ceil(t.worldScaling[0]*10)/10;var i=n;return n>=0.2&&n<1?i=n*e:n<=2&&n>=1?i=n*e*1.6:n>2&&n<=3?i=n*e*1.4:n>3&&n<=4?i=n*e*0.8:n>4&&(i=n*e*0.6),Math.floor(i*1e3)/1e3;}},{key:"getSafetySnippetFontLength",value:function getSafetySnippetFontLength(t){return Math.floor(ie.textImageSnippetSize*3/4/t)||1;}},{key:"createLabels",value:function(){var _createLabels=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(t,e,n){var L,i,a,o,_ref167,s,l,d,c,p,y,P,x,v,T,f,g,u,m,M,E,A,b,O,w,I,R,W,z,K,k,q,U,G,Z,rt,tt,J,ht,dt,B,F,Y,X,nt,_J2,_ht,_dt,_J3,_ht2,_rt3,_tt2;return _regeneratorRuntime().wrap(function _callee27$(_context29){while(1)switch(_context29.prev=_context29.next){case 0:i=[],a=n.x,o=n.y,_ref167=(L=e.parent)==null?void 0:L.parent,s=_ref167.width,l=_ref167.height,d=Me(t.text),c=d.length,p=t.fontSize,y=t.lineHeight,P=t.bold,x=t.textAlign,v=t.italic,T=t.fontFamily,f=t.verticalAlign,g=t.fontColor,u=t.fontBgColor,m=t.underline,M=t.lineThrough,E=ie.getSafetySnippetRatio(e)||1,A=Math.floor(p*E),b=ie.getSafetySnippetFontLength(A);O=0;w=0;case 3:if(!(w<c)){_context29.next=33;break;}I=d[w],R=y||A*1.5;if(!I){_context29.next=30;break;}W=Q0(I),z=[0,0],K=[0,p*1.2];f==="middle"&&(z[1]=w*p*1.2+5);k=[0,-p*0.15];z[0]=5;q=Math.sin(Math.PI/180*20);U=0;G=[];Z=0;case 14:if(!(Z<W)){_context29.next=27;break;}x==="left"&&(k[0]=U),Z===0&&v==="italic"&&(k[0]=k[0]-q/2*p);rt=I.slice(Z,Z+b);tt={anchor:[0,0],pos:k,text:rt,fontFamily:T,fontSize:A,lineHeight:R,strokeColor:g,fontWeight:P,fillColor:g,textAlign:x,fontStyle:v,scale:[1/E,1/E]};J=new Qi(tt);_context29.next=21;return J.textImageReady;case 21:ht=_context29.sent;dt=!0;if(ht){B=ht.rect&&ht.rect[2],F=ht.rect&&ht.rect[3];if(B&&F){Y=B/E,X=F/E;U=Y+U,v==="italic"&&(P==="bold"?U=U-q*p*1.2:U=U-q*p),((k[0]+z[0]+Y)*e.worldScaling[0]+a<=0||(k[0]+z[0])*e.worldScaling[0]+a>=s||(k[1]+z[1]+X)*e.worldScaling[1]+o<=0||(k[1]+z[1])*e.worldScaling[1]+o>=l)&&(J.disconnect(),dt=!1),dt&&G.push(J);}}Z+=b;case 25:_context29.next=14;break;case 27:K[0]=U,v==="italic"&&(K[0]=K[0]+q*p),O=Math.max(O,K[0]);nt=!0;if(((z[0]+K[0])*e.worldScaling[0]+a<=0||z[0]*e.worldScaling[0]+a>=s||(z[1]+K[1])*e.worldScaling[0]+o<=0||z[1]*e.worldScaling[1]+o>=l)&&(nt=!1),nt){if(m){_J2=Math.floor(p/10),_ht={normalize:!1,pos:[0,p*1.1+_J2/2],lineWidth:_J2,points:[0,0,Math.ceil(K[0]),0],strokeColor:g,className:"underline"},_dt=new le(_ht);G.push(_dt);}if(M){_J3={normalize:!1,pos:[0,p*1.2/2],lineWidth:Math.floor(p/10),points:[0,0,Math.ceil(K[0]),0],strokeColor:g,className:"lineThrough"},_ht2=new le(_J3);G.push(_ht2);}_rt3={pos:z,anchor:[0,0],size:K,bgcolor:u},_tt2=new kt(_rt3);_tt2.append.apply(_tt2,G),i.push(_tt2);}case 30:w++;_context29.next=3;break;case 33:return _context29.abrupt("return",{labels:i,maxWidth:O});case 34:case"end":return _context29.stop();}},_callee27);}));function createLabels(_x32,_x33,_x34){return _createLabels.apply(this,arguments);}return createLabels;}()},{key:"updateNodeOpt",value:function updateNodeOpt(t){var e=t.node,n=t.opt,i=t.vNodes,a=t.targetNode,o=n.fontBgColor,s=n.fontColor,l=n.translate,d=n.originPoint,c=n.scenePoint,p=n.scale,y=n.bold,P=n.italic,x=n.lineThrough,v=n.underline,T=n.fontSize,f=n.textInfos,g=n.zIndex,u=a&&Xt(a)||i.get(e.name);if(!u||!e.parent)return;var M=u.opt;if(_t(g)&&(e.setAttribute("zIndex",g),u.opt.zIndex=g),s&&M.fontColor&&(M.fontColor=s,e.children.forEach(function(E){E.tagName==="GROUP"&&E.children.forEach(function(A){A.tagName==="LABEL"?(A.setAttribute("fillColor",s),A.setAttribute("strokeColor",s)):A.tagName==="POLYLINE"&&A.setAttribute("strokeColor",s);});})),o&&M.fontBgColor&&(M.fontBgColor=o,e.children.forEach(function(E){E.tagName==="GROUP"&&E.setAttribute("bgcolor",o);})),y&&(M.bold=y),P&&(M.italic=P),ye(x)&&(M.lineThrough=x),ye(v)&&(M.underline=v),T&&(M.fontSize=T),d&&c&&p&&a&&M.boxPoint){var E=f==null?void 0:f.get(e.name);if(E){var L=E.fontSize,w=E.boxSize;M.boxSize=w||M.boxSize,M.fontSize=L||M.fontSize;}var A=[M.boxPoint[0],M.boxPoint[1]];Ur(M.boxPoint,c,p,l);var b=[u.op[0],u.op[1]],O=[b[0]-A[0],b[1]-A[1]];if(u.centerPos=[u.centerPos[0]+O[0],u.centerPos[1]+O[1]],u.opt.eraserlines)for(var _i7=0,_Object$values6=Object.values(u.opt.eraserlines);_i7<_Object$values6.length;_i7++){var _L19=_Object$values6[_i7];var _w9=_L19.op,I=_L19.thickness;_L19.thickness=I*Math.max(p[0],p[1]);for(var R=0;R<_w9.length;R++)jr(_w9[R],c,p,l);}}else if(l&&M.boxPoint&&(M.boxPoint=[M.boxPoint[0]+l[0],M.boxPoint[1]+l[1]],u.centerPos=[u.centerPos[0]+l[0],u.centerPos[1]+l[1]],u.opt.eraserlines))for(var _i8=0,_Object$values7=Object.values(u.opt.eraserlines);_i8<_Object$values7.length;_i8++){var _E5=_Object$values7[_i8];var _A6=_E5.op;for(var _b22=0;_b22<_A6.length;_b22++){var _O22=_A6[_b22].map(function(L,w){return w%2?L+l[1]:L+l[0];});_E5.op[_b22]=_O22;}}return u&&i.setInfo(e.name,u),u==null?void 0:u.rect;}},{key:"getRectFromLayer",value:function getRectFromLayer(t,e){var n=t.getElementsByName(e)[0];if(n){var i=n.getBoundingClientRect();var a={x:Math.floor(i.x),y:Math.floor(i.y),w:Math.floor(i.width+2),h:Math.floor(i.height+2)};return n.children.forEach(function(o){if(o.tagName==="GROUP"){var s=n.getBoundingClientRect();a=Pt(a,{x:Math.floor(s.x),y:Math.floor(s.y),w:Math.floor(s.width+2),h:Math.floor(s.height+2)});}}),a;}}}]);}(vt);// 4k
436
+ */},{key:"threeBezier",value:function threeBezier(r,t,e,n,i){var a=t.x*(1-r)*(1-r)*(1-r)+3*e.x*r*(1-r)*(1-r)+3*n.x*r*r*(1-r)+i.x*r*r*r,o=t.y*(1-r)*(1-r)*(1-r)+3*e.y*r*(1-r)*(1-r)+3*n.y*r*r*(1-r)+i.y*r*r*r;return new _(a,o);}}]);}();var Ti=/*#__PURE__*/function(_vt10){function Ti(t){var _this80;_classCallCheck(this,Ti);_this80=_callSuper(this,Ti,[t]);et(_this80,"canRotate",!1);et(_this80,"scaleType",jt.all);et(_this80,"toolsType",ut.SpeechBalloon);et(_this80,"ratio",0.8);et(_this80,"tmpPoints",[]);et(_this80,"workOptions");et(_this80,"oldRect");et(_this80,"syncTimestamp");_this80.workOptions=t.toolsOpt,_this80.syncTimestamp=0,_this80.syncUnitTime=50;return _this80;}_inherits(Ti,_vt10);return _createClass(Ti,[{key:"consume",value:function consume(t){var y;var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=(y=e==null?void 0:e.workId)==null?void 0:y.toString();if(!o)return{type:at.None};var s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var P=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:P,isDrawing:!0});}if(!i){var _P3=Date.now();return _P3-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_P3,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(x){return[].concat(_toConsumableArray(x.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e,isDrawing:!1});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,_this$workOptions11=this.workOptions,i=_this$workOptions11.strokeColor,a=_this$workOptions11.fillColor,o=_this$workOptions11.thickness,s=_this$workOptions11.zIndex,l=_this$workOptions11.placement,d=_this$workOptions11.scale,c=_this$workOptions11.rotate,p=_this$workOptions11.translate,y=_this$workOptions11.strokeType,P=_this$workOptions11.eraserlines,_this$computDrawPoint7=this.computDrawPoints(o,l),x=_this$computDrawPoint7.rect,v=_this$computDrawPoint7.pos,T=_this$computDrawPoint7.points,f={points:T.map(function(E){return E.XY;}),lineWidth:o,fillColor:a!=="transparent"&&a||void 0,strokeColor:i,normalize:!0,className:"".concat(v[0],",").concat(v[1]),close:!0,lineJoin:"round",lineCap:"round",lineDash:y===Lt.Dotted?[1,o*2]:y===Lt.LongDotted?[o,o*2]:void 0},g={name:e,id:e,zIndex:s,pos:v,anchor:[0.5,0.5],size:[x.w,x.h]};d&&(g.scale=d),c&&(g.rotate=c),p&&(g.translate=p);var u=new kt(g),m=new le(_objectSpread(_objectSpread({},f),{},{pos:[0,0]}));u.append(m),P&&this.drawEraserlines({group:u,eraserlines:P,pos:v,layer:n}),this.replace(n,e,u);var M=u.getBoundingClientRect();return{x:Math.floor(M.x-vt.SafeBorderPadding),y:Math.floor(M.y-vt.SafeBorderPadding),w:Math.floor(M.width+vt.SafeBorderPadding*2),h:Math.floor(M.height+vt.SafeBorderPadding*2)};}},{key:"transformControlPoints",value:function transformControlPoints(t){var e=Bt(this.tmpPoints);switch(t){case"bottom":case"bottomLeft":case"bottomRight":{var n=e.y+e.h*this.ratio;return[new _(e.x,e.y,0),new _(e.x+e.w,e.y,0),new _(e.x+e.w,n,0),new _(e.x,n,0)];}case"top":case"topLeft":case"topRight":{var _n4=e.y+e.h*(1-this.ratio);return[new _(e.x,_n4,0),new _(e.x+e.w,_n4,0),new _(e.x+e.w,e.y+e.h,0),new _(e.x,e.y+e.h,0)];}case"left":case"leftBottom":case"leftTop":{var _n5=e.x+e.w*(1-this.ratio);return[new _(_n5,e.y,0),new _(e.x+e.w,e.y,0),new _(e.x+e.w,e.y+e.h,0),new _(_n5,e.y+e.h,0)];}case"right":case"rightBottom":case"rightTop":{var _n6=e.x+e.w*this.ratio;return[new _(e.x,e.y,0),new _(_n6,e.y,0),new _(_n6,e.y+e.h,0),new _(e.x,e.y+e.h,0)];}}}},{key:"computDrawPoints",value:function computDrawPoints(t,e){var n=Bt(this.tmpPoints),i=this.transformControlPoints(e),a=Math.floor(n.w*0.1),o=Math.floor(n.h*0.1),s=[],l=_.Add(i[0],new _(0,o,0)),d=_.Add(i[0],new _(a,0,0)),c=qt.getBezierPoints(10,l,i[0],d),p=_.Sub(i[1],new _(a,0,0)),y=_.Add(i[1],new _(0,o,0)),P=qt.getBezierPoints(10,p,i[1],y),x=_.Sub(i[2],new _(0,o,0)),v=_.Sub(i[2],new _(a,0,0)),T=qt.getBezierPoints(10,x,i[2],v),f=_.Add(i[3],new _(a,0,0)),g=_.Sub(i[3],new _(0,o,0)),u=qt.getBezierPoints(10,f,i[3],g),m=a*(1-this.ratio)*10,M=o*(1-this.ratio)*10;switch(e){case"bottom":{var b=_.Sub(i[2],new _(a*5-m/2,0,0)),O=_.Sub(i[2],new _(a*5,-M,0)),L=_.Sub(i[2],new _(a*5+m/2,0,0));s.push.apply(s,[O,L].concat(_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),[b]));break;}case"bottomRight":{var _b11=_.Sub(i[2],new _(a*1.1,0,0)),_O11=_.Sub(i[2],new _(a*1.1+m/2,-M,0)),_L8=_.Sub(i[2],new _(a*1.1+m,0,0));s.push.apply(s,[_O11,_L8].concat(_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),[_b11]));break;}case"bottomLeft":{var _b12=_.Add(i[3],new _(a*1.1+m,0,0)),_O12=_.Add(i[3],new _(a*1.1+m/2,M,0)),_L9=_.Add(i[3],new _(a*1.1,0,0));s.push.apply(s,[_O12,_L9].concat(_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),[_b12]));break;}case"top":{var _b13=_.Sub(i[1],new _(a*5-m/2,0,0)),_O13=_.Sub(i[1],new _(a*5,M,0)),_L10=_.Sub(i[1],new _(a*5+m/2,0,0));s.push.apply(s,[_O13,_b13].concat(_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),[_L10]));break;}case"topRight":{var _b14=_.Sub(i[1],new _(a*1.1,0,0)),_O14=_.Sub(i[1],new _(a*1.1+m/2,M,0)),_L11=_.Sub(i[1],new _(a*1.1+m,0,0));s.push.apply(s,[_O14,_b14].concat(_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),[_L11]));break;}case"topLeft":{var _b15=_.Add(i[0],new _(a*1.1+m,0,0)),_O15=_.Add(i[0],new _(a*1.1+m/2,-M,0)),_L12=_.Add(i[0],new _(a*1.1,0,0));s.push.apply(s,[_O15,_b15].concat(_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),[_L12]));break;}case"left":{var _b16=_.Add(i[0],new _(0,o*5-M/2,0)),_O16=_.Add(i[0],new _(-m,o*5,0)),_L13=_.Add(i[0],new _(0,o*5+M/2,0));s.push.apply(s,[_O16,_b16].concat(_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),[_L13]));break;}case"leftTop":{var _b17=_.Add(i[0],new _(0,o*1.1,0)),_O17=_.Add(i[0],new _(-m,o*1.1+M/2,0)),_L14=_.Add(i[0],new _(0,o*1.1+M,0));s.push.apply(s,[_O17,_b17].concat(_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),[_L14]));break;}case"leftBottom":{var _b18=_.Sub(i[3],new _(0,o*1.1+M,0)),_O18=_.Sub(i[3],new _(m,o*1.1+M/2,0)),_L15=_.Sub(i[3],new _(0,o*1.1,0));s.push.apply(s,[_O18,_b18].concat(_toConsumableArray(c),_toConsumableArray(P),_toConsumableArray(T),_toConsumableArray(u),[_L15]));break;}case"right":{var _b19=_.Add(i[1],new _(0,o*5-M/2,0)),_O19=_.Add(i[1],new _(m,o*5,0)),_L16=_.Add(i[1],new _(0,o*5+M/2,0));s.push.apply(s,[_O19,_L16].concat(_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),[_b19]));break;}case"rightTop":{var _b20=_.Add(i[1],new _(0,o*1.1,0)),_O20=_.Add(i[1],new _(m,o*1.1+M/2,0)),_L17=_.Add(i[1],new _(0,o*1.1+M,0));s.push.apply(s,[_O20,_L17].concat(_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),[_b20]));break;}case"rightBottom":{var _b21=_.Sub(i[2],new _(0,o*1.1+M,0)),_O21=_.Sub(i[2],new _(-m,o*1.1+M/2,0)),_L18=_.Sub(i[2],new _(0,o*1.1,0));s.push.apply(s,[_O21,_L18].concat(_toConsumableArray(T),_toConsumableArray(u),_toConsumableArray(c),_toConsumableArray(P),[_b21]));break;}}var E=Bt(this.tmpPoints,t),A=[Math.floor(E.x+E.w/2),Math.floor(E.y+E.h/2)];return{rect:E,pos:A,points:s};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a)||xt.Sub(i,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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a,isDrawing:!1});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:o&&vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var P;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.fillColor,s=n.toolsType,l=n.placement,d=n.strokeType,c=i.get(e.name),p=c==null?void 0:c.opt;var y=e;return e.tagName==="GROUP"&&(y=e.children[0]),a&&(y.setAttribute("strokeColor",a),p!=null&&p.strokeColor&&(p.strokeColor=a)),o&&(o==="transparent"?y.setAttribute("fillColor","rgba(0,0,0,0)"):y.setAttribute("fillColor",o),p!=null&&p.fillColor&&(p.fillColor=o)),s===ut.SpeechBalloon&&l&&(p.placement=l),d&&c!=null&&c.opt&&(P=c.opt)!=null&&P.strokeType&&(c.opt.strokeType=d),c&&i.setInfo(e.name,_objectSpread(_objectSpread({},c),{},{opt:p})),vt.updateNodeOpt(t);}}]);}(vt);var Fg=de,Ug=ne,jg="[object Boolean]";function $g(h){return h===!0||h===!1||Ug(h)&&Fg(h)==jg;}var zg=$g,ye=/* @__PURE__ */fe(zg);var Ne=/*#__PURE__*/function(_vt11){function Ne(t){var _this81;_classCallCheck(this,Ne);_this81=_callSuper(this,Ne,[t]);et(_this81,"canRotate",!0);et(_this81,"scaleType",jt.all);et(_this81,"toolsType",ut.Image);et(_this81,"tmpPoints",[]);et(_this81,"workOptions");et(_this81,"oldRect");_this81.workOptions=t.toolsOpt,_this81.scaleType=Ne.getScaleType(_this81.workOptions);return _this81;}_inherits(Ne,_vt11);return _createClass(Ne,[{key:"consume",value:function consume(){return{type:at.None};}},{key:"consumeAll",value:function consumeAll(){return{type:at.None};}},{key:"draw",value:function draw(t){var e=t.layer,n=t.workId,i=t.replaceId,a=t.imageBitmap,_this$workOptions12=this.workOptions,o=_this$workOptions12.centerX,s=_this$workOptions12.centerY,l=_this$workOptions12.width,d=_this$workOptions12.height,c=_this$workOptions12.rotate,p=_this$workOptions12.zIndex,y=_this$workOptions12.eraserlines,P=new kt({anchor:[0.5,0.5],pos:[o,s],name:n,size:[l,d],zIndex:p,rotate:c}),x={anchor:[0.5,0.5],pos:[0,0],size:[l,d],texture:a};a||(x.bgcolor="rgba(0,0,0,0.3)");var v=new es(x);P.append(v),y&&this.drawEraserlines({group:P,eraserlines:y,pos:[o,s],layer:e}),this.replace(e,i||n,P);var T=P.getBoundingClientRect();if(T)return{x:Math.floor(T.x-vt.SafeBorderPadding),y:Math.floor(T.y-vt.SafeBorderPadding),w:Math.floor(T.width+vt.SafeBorderPadding*2),h:Math.floor(T.height+vt.SafeBorderPadding*2)};}},{key:"consumeService",value:function consumeService(){}},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(t){var d,c,p,y,e,n,i,_this$workOptions13,a,o,s,l,P,x;return _regeneratorRuntime().wrap(function _callee23$(_context25){while(1)switch(_context25.prev=_context25.next){case 0:e=t.isFullWork,n=t.replaceId,i=t.worker,_this$workOptions13=this.workOptions,a=_this$workOptions13.src,o=_this$workOptions13.uuid,s=((d=this.workId)==null?void 0:d.toString())||o,l=e?this.fullLayer:this.drawLayer||this.fullLayer;if(!a){_context25.next=8;break;}_context25.next=4;return i.loadImageBitMap({toolsType:this.toolsType,opt:this.workOptions,workId:s,isSubWorker:i instanceof Di});case 4:P=_context25.sent;if(!P){_context25.next=8;break;}x=this.draw({workId:s,layer:l,replaceId:n,imageBitmap:P});return _context25.abrupt("return",(this.oldRect=s&&((p=(c=this.vNodes)==null?void 0:c.get(s))==null?void 0:p.rect)||void 0,(y=this.vNodes)==null||y.setInfo(s,{rect:x,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:x&&vt.getCenterPos(x,l)}),x));case 8:case"end":return _context25.stop();}},_callee23,this);}));function consumeServiceAsync(_x27){return _consumeServiceAsync.apply(this,arguments);}return consumeServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"getScaleType",value:function getScaleType(t){var e=t.uniformScale,n=t.rotate;return e!==!1||n&&Math.abs(n)%90>0?jt.proportional:jt.all;}},{key:"updateNodeOpt",value:function updateNodeOpt(t){var e=t.node,n=t.opt,i=t.vNodes,a=t.targetNode,o=n.translate,s=n.originPoint,l=n.scenePoint,d=n.scale,c=n.angle,p=n.isLocked,y=n.zIndex,P=n.strokeColor,x=a&&Xt(a)||i.get(e.name);if(!x)return;var v=e.parent;if(v){if(P&&(x.opt.strokeColor=P),_t(y)&&(e.setAttribute("zIndex",y),x.opt.zIndex=y),ye(p)&&(x.opt.locked=p),s&&l&&d&&o){var _x$opt=x.opt,_T33=_x$opt.centerX,_f29=_x$opt.centerY,g=_x$opt.width,u=_x$opt.height,m=_x$opt.uniformScale,M=m!==!1?[d[0],d[0]]:d,E=[_T33,_f29],A=[_T33,_f29];Ur(A,l,M,o);var b=[A[0]-E[0],A[1]-E[1]];if(x.centerPos=[x.centerPos[0]+b[0],x.centerPos[1]+b[1]],x.opt.width=Math.round(g*M[0]),x.opt.height=Math.round(u*M[1]),x.opt.centerX=A[0],x.opt.centerY=A[1],x.opt.eraserlines)for(var _i5=0,_Object$values4=Object.values(x.opt.eraserlines);_i5<_Object$values4.length;_i5++){var O=_Object$values4[_i5];var L=O.op,w=O.thickness;O.thickness=w*Math.max(d[0],d[1]);for(var I=0;I<L.length;I++)jr(L[I],l,d,o);}}else if(o){if(x.opt.centerX=x.opt.centerX+o[0],x.opt.centerY=x.opt.centerY+o[1],x.centerPos=[x.centerPos[0]+o[0],x.centerPos[1]+o[1]],x.opt.eraserlines)for(var _i6=0,_Object$values5=Object.values(x.opt.eraserlines);_i6<_Object$values5.length;_i6++){var _T34=_Object$values5[_i6];var _f30=_T34.op;for(var _g12=0;_g12<_f30.length;_g12++){var _u13=_f30[_g12].map(function(m,M){return M%2?m+o[1]:m+o[0];});_T34.op[_g12]=_u13;}}}else if(_t(c))if(x.opt.rotate=c,x.scaleType=Ne.getScaleType(x.opt),a){var _T35=Ei(x.rect,c);x.rect=_T35;}else{var _T36=vt.getRectFromLayer(v,e.name);x.rect=_T36||x.rect;}return x&&i.setInfo(e.name,x),x==null?void 0:x.rect;}}}]);}(vt);var Mi=/*#__PURE__*/function(_vt12){function Mi(t){var _this82;_classCallCheck(this,Mi);_this82=_callSuper(this,Mi,[t]);et(_this82,"canRotate",!1);et(_this82,"scaleType",jt.both);et(_this82,"toolsType",ut.Straight);et(_this82,"tmpPoints",[]);et(_this82,"workOptions");et(_this82,"oldRect");et(_this82,"straightTipWidth");et(_this82,"syncTimestamp");_this82.workOptions=t.toolsOpt,_this82.straightTipWidth=_this82.workOptions.thickness/2,_this82.syncTimestamp=0,_this82.syncUnitTime=50;return _this82;}_inherits(Mi,_vt12);return _createClass(Mi,[{key:"consume",value:function consume(t){var e=t.data,n=t.isFullWork,i=t.isSubWorker,a=t.isMainThread,o=this.workId,s=e.op,l=s==null?void 0:s.length;if(!l||l<2)return{type:at.None};var d;if(this.tmpPoints.length===0?(this.tmpPoints=[new xt(s[0],s[1])],d=!1):d=this.updateTempPoints(s),!d)return{type:at.None};var c;if(i||a){var y=n?this.fullLayer:this.drawLayer||this.fullLayer;c=this.draw({workId:o,layer:y});}if(!i){var _y12=Date.now();return _y12-this.syncTimestamp>this.syncUnitTime?(this.syncTimestamp=_y12,_objectSpread({type:at.DrawWork,dataType:Mt.Local,op:this.tmpPoints.map(function(P){return[].concat(_toConsumableArray(P.XY),[0]);}).flat(1),isSync:!0,index:0},this.baseConsumeResult)):{type:at.None};}var p=Pt(c,this.oldRect);return this.oldRect=c,_objectSpread({rect:p,type:at.DrawWork,dataType:Mt.Local},this.baseConsumeResult);}},{key:"consumeAll",value:function consumeAll(){var o;var t=this.workId;if(this.tmpPoints.length<2)return{type:at.RemoveNode,removeIds:[t]};var e=this.fullLayer,n=this.draw({workId:t,layer:e});this.oldRect=n;var i=this.tmpPoints.map(function(s){return[].concat(_toConsumableArray(s.XY),[0]);}).flat(1),a=Zt(i);return(o=this.vNodes)==null||o.setInfo(t,{rect:n,op:i,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:n&&vt.getCenterPos(n,e)}),_objectSpread({rect:n,type:at.FullWork,dataType:Mt.Local,ops:a,isSync:!0},this.baseConsumeResult);}},{key:"draw",value:function draw(t){var e=t.workId,n=t.layer,_this$workOptions14=this.workOptions,i=_this$workOptions14.strokeColor,a=_this$workOptions14.thickness,o=_this$workOptions14.zIndex,s=_this$workOptions14.scale,l=_this$workOptions14.rotate,d=_this$workOptions14.translate,c=_this$workOptions14.strokeType,p=_this$workOptions14.eraserlines,y=n.worldPosition,P=n.worldScaling,_this$computDrawPoint8=this.computDrawPoints(a,c),x=_this$computDrawPoint8.d,v=_this$computDrawPoint8.rect,T=_this$computDrawPoint8.isDot,f=[v.x+v.w/2,v.y+v.h/2],g=new kt({pos:f,anchor:[0.5,0.5],size:[v.w,v.h],name:e,id:e,normalize:!0,zIndex:o}),u={pos:[0,0],normalize:!0,d:x,fillColor:i,strokeColor:i,lineDash:c===Lt.Dotted&&!T?[1,a*2]:c===Lt.LongDotted&&!T?[a,a*2]:void 0,lineCap:c===Lt.Normal||T?void 0:"round",lineWidth:c===Lt.Normal||T?0:a};s&&(u.scale=s),l&&(u.rotate=l),d&&(u.translate=d);var m=new ce(u);if(g.append(m),p&&this.drawEraserlines({group:g,eraserlines:p,pos:f,layer:n}),this.replace(n,e,g),l||s||d){var E=m.getBoundingClientRect();return{x:Math.floor(E.x-vt.SafeBorderPadding),y:Math.floor(E.y-vt.SafeBorderPadding),w:Math.floor(E.width+vt.SafeBorderPadding*2),h:Math.floor(E.height+vt.SafeBorderPadding*2)};}return{x:Math.floor(v.x*P[0]+y[0]-vt.SafeBorderPadding),y:Math.floor(v.y*P[1]+y[1]-vt.SafeBorderPadding),w:Math.floor(v.w*P[0]+2*vt.SafeBorderPadding),h:Math.floor(v.h*P[1]+2*vt.SafeBorderPadding)};}},{key:"computDrawPoints",value:function computDrawPoints(t,e){return this.tmpPoints[1].distance(this.tmpPoints[0])>this.straightTipWidth?this.computFullPoints(t,e):this.computDotPoints(t);}},{key:"computFullPoints",value:function computFullPoints(t,e){var n=_.Sub(this.tmpPoints[1],this.tmpPoints[0]).uni(),i=_.Per(n).mul(t/2),a=xt.Sub(this.tmpPoints[0],i),o=xt.Add(this.tmpPoints[0],i),s=xt.Sub(this.tmpPoints[1],i),l=xt.Add(this.tmpPoints[1],i),d=xt.GetSemicircleStroke(this.tmpPoints[1],s,-1,8),c=xt.GetSemicircleStroke(this.tmpPoints[0],o,-1,8),p=[a,s].concat(_toConsumableArray(d),[l,o],_toConsumableArray(c));var y;return e!==Lt.Normal?y=ae(this.tmpPoints,!1):y=ae(p,!0),{d:y,rect:Bt(p),isDot:!1,pos:this.tmpPoints[0].XY};}},{key:"computDotPoints",value:function computDotPoints(t){var e=xt.GetDotStroke(this.tmpPoints[0],t/2,8);return{d:ae(e,!0),rect:Bt(e),isDot:!0,pos:this.tmpPoints[0].XY};}},{key:"updateTempPoints",value:function updateTempPoints(t){var e=t.slice(-2),n=new xt(e[0],e[1]),i=this.tmpPoints[0],a=this.workOptions.thickness;if(i.isNear(n,a))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 s,l;var e=t.op,n=t.isFullWork,i=(s=this.workId)==null?void 0:s.toString();if(!i)return;this.tmpPoints.length=0;for(var d=0;d<e.length;d+=3)this.tmpPoints.push(new xt(e[d],e[d+1],e[d+2]));var a=n?this.fullLayer:this.drawLayer||this.fullLayer,o=this.draw({workId:i,layer:a});return this.oldRect=o,(l=this.vNodes)==null||l.setInfo(i,{rect:o,op:e,opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:o&&vt.getCenterPos(o,a)}),o;}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"updateNodeOpt",value:function updateNodeOpt(t){var l,d;var e=t.node,n=t.opt,i=t.vNodes,a=n.strokeColor,o=n.strokeType,s=i.get(e.name);return a&&(e.tagName==="GROUP"?e.children.forEach(function(c){c.setAttribute("strokeColor",a),c.getAttribute("fillColor")&&c.setAttribute("fillColor",a);}):(e.setAttribute("strokeColor",a),e.setAttribute("fillColor",a)),(l=s==null?void 0:s.opt)!=null&&l.strokeColor&&(s.opt.strokeColor=a)),o&&s!=null&&s.opt&&(d=s.opt)!=null&&d.strokeType&&(s.opt.strokeType=o),s&&i.setInfo(e.name,s),vt.updateNodeOpt(t);}}]);}(vt);var ie=/*#__PURE__*/function(_vt13){function ie(t){var _this83;_classCallCheck(this,ie);_this83=_callSuper(this,ie,[t]);et(_this83,"canRotate",!1);et(_this83,"scaleType",jt.proportional);et(_this83,"toolsType",ut.Text);et(_this83,"tmpPoints",[]);et(_this83,"workOptions");et(_this83,"oldRect");_this83.workOptions=t.toolsOpt;return _this83;}_inherits(ie,_vt13);return _createClass(ie,[{key:"consume",value:function consume(){return{type:at.None};}},{key:"consumeAll",value:function consumeAll(){return{type:at.None};}},{key:"consumeService",value:function consumeService(){}},{key:"draw",value:function(){var _draw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(t){var e,n,i,_this$workOptions15,a,o,s,l,d,c,p,y,P,x,v,_T37,_f31;return _regeneratorRuntime().wrap(function _callee24$(_context26){while(1)switch(_context26.prev=_context26.next){case 0:e=t.workId,n=t.layer,i=t.isDrawLabel,_this$workOptions15=this.workOptions,a=_this$workOptions15.boxSize,o=_this$workOptions15.boxPoint,s=_this$workOptions15.zIndex,l=_this$workOptions15.eraserlines,d=n.worldPosition,c=n.worldScaling;if(!(!o||!a)){_context26.next=3;break;}return _context26.abrupt("return");case 3:p={name:e,id:e,pos:[o[0],o[1]],anchor:[0,0],size:a,zIndex:s},y=new kt(p),P={x:o[0],y:o[1],w:a[0],h:a[1]},x={x:Math.floor(P.x*c[0]+d[0]),y:Math.floor(P.y*c[1]+d[1]),w:Math.floor(P.w*c[0])+2,h:Math.floor(P.h*c[1])+2};if(!(this.replace(n,e,y),i&&n&&this.workOptions.text)){_context26.next=11;break;}_context26.next=7;return ie.createLabels(this.workOptions,n,x);case 7:v=_context26.sent;_T37=v.labels;_f31=v.maxWidth;y.append.apply(y,_toConsumableArray(_T37)),x.w=Math.ceil(Math.max(_f31*n.worldScaling[0],x.w));case 11:return _context26.abrupt("return",(l&&this.drawEraserlines({group:y,eraserlines:l,pos:[o[0],o[1]],layer:n}),x));case 12:case"end":return _context26.stop();}},_callee24,this);}));function draw(_x28){return _draw3.apply(this,arguments);}return draw;}()},{key:"consumeServiceAsync",value:function(){var _consumeServiceAsync2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(t){var l,d,c,p,e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee25$(_context27){while(1)switch(_context27.prev=_context27.next){case 0:e=(l=this.workId)==null?void 0:l.toString();if(e){_context27.next=3;break;}return _context27.abrupt("return");case 3:n=t.isFullWork,i=t.replaceId,a=t.isDrawLabel;this.oldRect=i&&((c=(d=this.vNodes)==null?void 0:d.get(i))==null?void 0:c.rect)||void 0;o=n?this.fullLayer:this.drawLayer||this.fullLayer;_context27.next=8;return this.draw({workId:e,layer:o,isDrawLabel:_typeof(a)>"u"&&this.workOptions.workState===It.Done||a});case 8:s=_context27.sent;return _context27.abrupt("return",((p=this.vNodes)==null||p.setInfo(e,{rect:s,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:s&&vt.getCenterPos(s,o)}),s));case 10:case"end":return _context27.stop();}},_callee25,this);}));function consumeServiceAsync(_x29){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,e){var P,x,n,i,a,o,s,l,d,c,p,y;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:n=this.workId.toString(),i=t.fontColor,a=t.fontBgColor,o=t.bold,s=t.italic,l=t.lineThrough,d=t.underline,c=t.zIndex,p=(P=this.vNodes)==null?void 0:P.get(n);if(p){_context28.next=5;break;}return _context28.abrupt("return");case 5:i&&(p.opt.fontColor=i),a&&(p.opt.fontBgColor=a),o&&(p.opt.bold=o),s&&(p.opt.italic=s),ye(l)&&(p.opt.lineThrough=l),ye(d)&&(p.opt.underline=d),_t(c)&&(p.opt.zIndex=c),this.oldRect=p.rect;_context28.next=8;return this.draw({workId:n,layer:this.fullLayer,isDrawLabel:_typeof(e)>"u"&&this.workOptions.workState===It.Done||e});case 8:y=_context28.sent;return _context28.abrupt("return",((x=this.vNodes)==null||x.setInfo(n,{rect:y,op:[],opt:this.workOptions,toolsType:this.toolsType,scaleType:this.scaleType,canRotate:this.canRotate,centerPos:y&&vt.getCenterPos(y,this.fullLayer)}),y));case 10:case"end":return _context28.stop();}},_callee26,this);}));function updataOptServiceAsync(_x30,_x31){return _updataOptServiceAsync.apply(this,arguments);}return updataOptServiceAsync;}()},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}],[{key:"getSafetySnippetRatio",value:function getSafetySnippetRatio(t){var e=(t==null?void 0:t.parent).displayRatio||1,n=Math.ceil(t.worldScaling[0]*10)/10;var i=n;return n>=0.2&&n<1?i=n*e:n<=2&&n>=1?i=n*e*1.6:n>2&&n<=3?i=n*e*1.4:n>3&&n<=4?i=n*e*0.8:n>4&&(i=n*e*0.6),Math.floor(i*1e3)/1e3;}},{key:"getSafetySnippetFontLength",value:function getSafetySnippetFontLength(t){return Math.floor(ie.textImageSnippetSize*3/4/t)||1;}},{key:"createLabels",value:function(){var _createLabels=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(t,e,n){var L,i,a,o,_ref167,s,l,d,c,p,y,P,x,v,T,f,g,u,m,M,E,A,b,O,w,I,R,W,z,K,k,q,U,G,Z,rt,tt,J,ht,dt,B,F,Y,X,nt,_J2,_ht,_dt,_J3,_ht2,_rt3,_tt2;return _regeneratorRuntime().wrap(function _callee27$(_context29){while(1)switch(_context29.prev=_context29.next){case 0:i=[],a=n.x,o=n.y,_ref167=(L=e.parent)==null?void 0:L.parent,s=_ref167.width,l=_ref167.height,d=Me(t.text),c=d.length,p=t.fontSize,y=t.lineHeight,P=t.bold,x=t.textAlign,v=t.italic,T=t.fontFamily,f=t.verticalAlign,g=t.fontColor,u=t.fontBgColor,m=t.underline,M=t.lineThrough,E=ie.getSafetySnippetRatio(e)||1,A=Math.floor(p*E),b=ie.getSafetySnippetFontLength(A);O=0;w=0;case 3:if(!(w<c)){_context29.next=33;break;}I=d[w],R=y||A*1.5;if(!I){_context29.next=30;break;}W=qg(I),z=[0,0],K=[0,p*1.2];f==="middle"&&(z[1]=w*p*1.2+5);k=[0,-p*0.15];z[0]=5;q=Math.sin(Math.PI/180*20);U=0;G=[];Z=0;case 14:if(!(Z<W)){_context29.next=27;break;}x==="left"&&(k[0]=U),Z===0&&v==="italic"&&(k[0]=k[0]-q/2*p);rt=I.slice(Z,Z+b);tt={anchor:[0,0],pos:k,text:rt,fontFamily:T,fontSize:A,lineHeight:R,strokeColor:g,fontWeight:P,fillColor:g,textAlign:x,fontStyle:v,scale:[1/E,1/E]};J=new qi(tt);_context29.next=21;return J.textImageReady;case 21:ht=_context29.sent;dt=!0;if(ht){B=ht.rect&&ht.rect[2],F=ht.rect&&ht.rect[3];if(B&&F){Y=B/E,X=F/E;U=Y+U,v==="italic"&&(P==="bold"?U=U-q*p*1.2:U=U-q*p),((k[0]+z[0]+Y)*e.worldScaling[0]+a<=0||(k[0]+z[0])*e.worldScaling[0]+a>=s||(k[1]+z[1]+X)*e.worldScaling[1]+o<=0||(k[1]+z[1])*e.worldScaling[1]+o>=l)&&(J.disconnect(),dt=!1),dt&&G.push(J);}}Z+=b;case 25:_context29.next=14;break;case 27:K[0]=U,v==="italic"&&(K[0]=K[0]+q*p),O=Math.max(O,K[0]);nt=!0;if(((z[0]+K[0])*e.worldScaling[0]+a<=0||z[0]*e.worldScaling[0]+a>=s||(z[1]+K[1])*e.worldScaling[0]+o<=0||z[1]*e.worldScaling[1]+o>=l)&&(nt=!1),nt){if(m){_J2=Math.floor(p/10),_ht={normalize:!1,pos:[0,p*1.1+_J2/2],lineWidth:_J2,points:[0,0,Math.ceil(K[0]),0],strokeColor:g,className:"underline"},_dt=new le(_ht);G.push(_dt);}if(M){_J3={normalize:!1,pos:[0,p*1.2/2],lineWidth:Math.floor(p/10),points:[0,0,Math.ceil(K[0]),0],strokeColor:g,className:"lineThrough"},_ht2=new le(_J3);G.push(_ht2);}_rt3={pos:z,anchor:[0,0],size:K,bgcolor:u},_tt2=new kt(_rt3);_tt2.append.apply(_tt2,G),i.push(_tt2);}case 30:w++;_context29.next=3;break;case 33:return _context29.abrupt("return",{labels:i,maxWidth:O});case 34:case"end":return _context29.stop();}},_callee27);}));function createLabels(_x32,_x33,_x34){return _createLabels.apply(this,arguments);}return createLabels;}()},{key:"updateNodeOpt",value:function updateNodeOpt(t){var e=t.node,n=t.opt,i=t.vNodes,a=t.targetNode,o=n.fontBgColor,s=n.fontColor,l=n.translate,d=n.originPoint,c=n.scenePoint,p=n.scale,y=n.bold,P=n.italic,x=n.lineThrough,v=n.underline,T=n.fontSize,f=n.textInfos,g=n.zIndex,u=a&&Xt(a)||i.get(e.name);if(!u||!e.parent)return;var M=u.opt;if(_t(g)&&(e.setAttribute("zIndex",g),u.opt.zIndex=g),s&&M.fontColor&&(M.fontColor=s,e.children.forEach(function(E){E.tagName==="GROUP"&&E.children.forEach(function(A){A.tagName==="LABEL"?(A.setAttribute("fillColor",s),A.setAttribute("strokeColor",s)):A.tagName==="POLYLINE"&&A.setAttribute("strokeColor",s);});})),o&&M.fontBgColor&&(M.fontBgColor=o,e.children.forEach(function(E){E.tagName==="GROUP"&&E.setAttribute("bgcolor",o);})),y&&(M.bold=y),P&&(M.italic=P),ye(x)&&(M.lineThrough=x),ye(v)&&(M.underline=v),T&&(M.fontSize=T),d&&c&&p&&a&&M.boxPoint){var E=f==null?void 0:f.get(e.name);if(E){var L=E.fontSize,w=E.boxSize;M.boxSize=w||M.boxSize,M.fontSize=L||M.fontSize;}var A=[M.boxPoint[0],M.boxPoint[1]];Ur(M.boxPoint,c,p,l);var b=[u.op[0],u.op[1]],O=[b[0]-A[0],b[1]-A[1]];if(u.centerPos=[u.centerPos[0]+O[0],u.centerPos[1]+O[1]],u.opt.eraserlines)for(var _i7=0,_Object$values6=Object.values(u.opt.eraserlines);_i7<_Object$values6.length;_i7++){var _L19=_Object$values6[_i7];var _w9=_L19.op,I=_L19.thickness;_L19.thickness=I*Math.max(p[0],p[1]);for(var R=0;R<_w9.length;R++)jr(_w9[R],c,p,l);}}else if(l&&M.boxPoint&&(M.boxPoint=[M.boxPoint[0]+l[0],M.boxPoint[1]+l[1]],u.centerPos=[u.centerPos[0]+l[0],u.centerPos[1]+l[1]],u.opt.eraserlines))for(var _i8=0,_Object$values7=Object.values(u.opt.eraserlines);_i8<_Object$values7.length;_i8++){var _E5=_Object$values7[_i8];var _A6=_E5.op;for(var _b22=0;_b22<_A6.length;_b22++){var _O22=_A6[_b22].map(function(L,w){return w%2?L+l[1]:L+l[0];});_E5.op[_b22]=_O22;}}return u&&i.setInfo(e.name,u),u==null?void 0:u.rect;}},{key:"getRectFromLayer",value:function getRectFromLayer(t,e){var n=t.getElementsByName(e)[0];if(n){var i=n.getBoundingClientRect();var a={x:Math.floor(i.x),y:Math.floor(i.y),w:Math.floor(i.width+2),h:Math.floor(i.height+2)};return n.children.forEach(function(o){if(o.tagName==="GROUP"){var s=n.getBoundingClientRect();a=Pt(a,{x:Math.floor(s.x),y:Math.floor(s.y),w:Math.floor(s.width+2),h:Math.floor(s.height+2)});}}),a;}}}]);}(vt);// 4k
437
437
  et(ie,"textImageSnippetSize",1024*4),et(ie,"SafeBorderPadding",30);var Xe=ie;var xe=/*#__PURE__*/function(_vt14){function xe(t,e){var _this84;_classCallCheck(this,xe);_this84=_callSuper(this,xe,[t]);et(_this84,"canRotate",!1);et(_this84,"scaleType",jt.none);et(_this84,"toolsType",ut.PencilEraser);et(_this84,"serviceWork");et(_this84,"tmpPoints",[]);et(_this84,"workOptions");et(_this84,"worldPosition");et(_this84,"worldScaling");et(_this84,"eraserRect");et(_this84,"eraserPolyline");_this84.serviceWork=e,_this84.workOptions=t.toolsOpt,_this84.worldPosition=_this84.fullLayer.worldPosition,_this84.worldScaling=_this84.fullLayer.worldScaling;return _this84;}_inherits(xe,_vt14);return _createClass(xe,[{key:"consumeService",value:function consumeService(){}},{key:"createEraserRect",value:function createEraserRect(t){var e=t[0]*this.worldScaling[0]+this.worldPosition[0],n=t[1]*this.worldScaling[1]+this.worldPosition[1],_xe$eraserSizes$this$=xe.eraserSizes[this.workOptions.thickness],i=_xe$eraserSizes$this$.width,a=_xe$eraserSizes$this$.height;this.eraserRect={x:e-i*0.5,y:n-a*0.5,w:i,h:a},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 _e5=new _(this.tmpPoints[0],this.tmpPoints[1]),n=new _(this.tmpPoints[2],this.tmpPoints[3]),i=_.Sub(n,_e5).uni(),a=_.Dist(_e5,n),_xe$eraserSizes$this$2=xe.eraserSizes[this.workOptions.thickness],o=_xe$eraserSizes$this$2.width,s=_xe$eraserSizes$this$2.height,l=Math.min(o,s),d=Math.round(a/l);if(d>1){var c=[];for(var p=0;p<d;p++){var y=_.Mul(i,p*l);c.push(this.tmpPoints[0]+y.x,this.tmpPoints[1]+y.y);}return c.concat(t);}}return t;}},{key:"isNear",value:function isNear(t,e){var n=new _(t[0],t[1]),i=new _(e[0],e[1]),_xe$eraserSizes$this$3=xe.eraserSizes[this.workOptions.thickness],a=_xe$eraserSizes$this$3.width,o=_xe$eraserSizes$this$3.height;return _.Dist(n,i)<Math.hypot(a,o)*0.5;}},{key:"cutPolyline",value:function cutPolyline(t,e){var n=[e],i=0;for(;i<t.length;){var s=t[i];if(s.length<2)break;n=a(n,s),i++;}return n;function a(s,l){var d=s;var _loop4=function _loop4(){var p=s[c],y=p.findIndex(function(P,x){return x<p.length-1?o([P,p[x+1]],[l[0],l[1]]):!1;});if(y!==-1&&y>-1){var P=[],x=p.slice(0,y+1);if(_.Equals(p[y],l[0])||x.push(l[0].clone().setz(p[y].z)),x.length>1&&P.push(x),y+l.length-1<p.length-1){var v=y+l.length-1,_T38=p.slice(v),_f32=l[l.length-1];_.Equals(p[v],_f32)||_T38.unshift(_f32.clone().setz(p[v].z)),_T38.length>1&&P.push(_T38);}return{v:(d.splice.apply(d,[c,1].concat(P)),d)};}},_ret;for(var c=0;c<s.length;c++){_ret=_loop4();if(_ret)return _ret.v;}return d;}function o(s,l){var d=_.Sub(s[1],s[0]),c=_.Sub(l[1],l[0]),p=_.Sub(l[0],s[0]);return Math.abs(_.Cpr(d,c))<0.1&&Math.abs(_.Cpr(d,p))<0.1;}}},{key:"isSamePoint",value:function isSamePoint(t,e){return t[0]===e[0]&&t[1]===e[1];}},{key:"translateIntersect",value:function translateIntersect(t){var _this85=this;var e=[];for(var n=0;n<t.length;n++){var i=t[n].filter(function(s,l,d){return!(l>0&&_this85.isSamePoint(s,d[l-1]));}),a=[];var o=0;for(;o<i.length;){var s=i[o],l=new _(s[0],s[1]);a.push(l),o++;}e.push(a);}return e;}},{key:"isLineEraser",value:function isLineEraser(t,e){return!(t===ut.Pencil&&!e);}},{key:"remove",value:function remove(t){var _this86=this;var e=t.curNodeMap,n=t.removeIds,i=t.newWorkDatas;var a;var _iterator27=_createForOfIteratorHelper(e.entries()),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var _step27$value=_slicedToArray(_step27.value,2),o=_step27$value[0],s=_step27$value[1];if(s.rect&&this.eraserRect&&this.eraserPolyline&&We(this.eraserRect,s.rect)){var l=s.op,d=s.toolsType,c=this.isLineEraser(d,!1),p=[],y=[];for(var x=0;x<l.length;x+=3){var v=new _(l[x]*this.worldScaling[0]+this.worldPosition[0],l[x+1]*this.worldScaling[1]+this.worldPosition[1],l[x+2]);y.push(v),p.push(new xt(v.x,v.y));}var P=p.length&&Bt(p)||s.rect;if(We(P,this.eraserRect)){if(y.length>1){var _x35=Dr.polyline(y.map(function(v){return v.XY;}),this.eraserPolyline);if(_x35.length&&(n.add(s.name),!c)){var _v8=this.translateIntersect(_x35),_T39=this.cutPolyline(_v8,y);var _loop5=function _loop5(){var g="".concat(o,"_s_").concat(_f33),u=[];_T39[_f33].forEach(function(m){u.push((m.x-_this86.worldPosition[0])/_this86.worldScaling[0],(m.y-_this86.worldPosition[1])/_this86.worldScaling[1],m.z);}),s.opt&&s.toolsType&&_this86.vNodes&&(_this86.vNodes.setInfo(g,{rect:P,op:u,opt:s.opt,canRotate:s.canRotate,scaleType:s.scaleType,toolsType:s.toolsType}),i.set(g,{workId:g,op:u,opt:s.opt,toolsType:s.toolsType}));};for(var _f33=0;_f33<_T39.length;_f33++){_loop5();}}}else n.add(s.name);a=Pt(a,P);}}}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}return n.forEach(function(o){var s;return(s=_this86.vNodes)==null?void 0:s["delete"](o);}),a&&(a.x-=vt.SafeBorderPadding,a.y-=vt.SafeBorderPadding,a.w+=vt.SafeBorderPadding*2,a.h+=vt.SafeBorderPadding*2),a;}},{key:"consume",value:function consume(t){var e=t.data.op;if(!e||e.length===0)return _objectSpread({type:at.None},this.baseConsumeResult);var n=this.tmpPoints.length;if(n>1&&this.isNear([e[0],e[1]],[this.tmpPoints[n-2],this.tmpPoints[n-1]]))return _objectSpread({type:at.None},this.baseConsumeResult);n<3?this.tmpPoints.push(e[0],e[1]):this.tmpPoints.splice(2,2,e[0],e[1]);var i=this.computRectCenterPoints();var a;var o=/* @__PURE__ */new Set(),s=/* @__PURE__ */new Map();if(!this.vNodes)return _objectSpread({type:at.None},this.baseConsumeResult);this.vNodes.setTarget();var l=this.getCanEraserNodeMap(this.vNodes.getCanEraserNodes(this.vNodes.getLastTarget()));for(var d=0;d<i.length-1;d+=2){this.createEraserRect(i.slice(d,d+2));var c=this.remove({curNodeMap:l,removeIds:o,newWorkDatas:s});a=Pt(a,c);}if(this.vNodes.deleteLastTarget(),a&&o.size){var _iterator28=_createForOfIteratorHelper(s.keys()),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _d10=_step28.value;o.has(_d10)&&s["delete"](_d10);}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}return{type:at.RemoveNode,rect:a,removeIds:_toConsumableArray(o),newWorkDatas:s};}return _objectSpread({type:at.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 e;if(this.serviceWork){var n=Xt(t),i=this.serviceWork.selectorWorkShapes,a=this.serviceWork.workShapes;var _iterator29=_createForOfIteratorHelper(i.values()),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var o=_step29.value;if((e=o.selectIds)!=null&&e.length){var _iterator31=_createForOfIteratorHelper(o.selectIds),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var s=_step31.value;n["delete"](s);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}var _iterator30=_createForOfIteratorHelper(a.keys()),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var _o5=_step30.value;n["delete"](_o5);}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}return n;}return t;}}]);}(vt);// 来源于white-sdk
438
- et(xe,"eraserSizes",Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50})]));var ke=xe;var we=/*#__PURE__*/function(_vt15){function we(t){var _this87;_classCallCheck(this,we);_this87=_callSuper(this,we,[t]);et(_this87,"canRotate",!1);et(_this87,"scaleType",jt.none);et(_this87,"toolsType",ut.BitMapEraser);et(_this87,"tmpPoints",[]);et(_this87,"workOptions");et(_this87,"worldPosition");et(_this87,"worldScaling");et(_this87,"eraserRect");et(_this87,"eraserPolyline");et(_this87,"syncUnitTime",re.syncOpt.interval);et(_this87,"syncIndex",0);et(_this87,"syncTimestamp");_this87.workOptions=t.toolsOpt,_this87.worldPosition=_this87.fullLayer.worldPosition,_this87.worldScaling=_this87.fullLayer.worldScaling,_this87.syncTimestamp=0;return _this87;}_inherits(we,_vt15);return _createClass(we,[{key:"consumeService",value:function consumeService(t){var e=t.op,n=t.isFullWork;this.tmpPoints.length=0;for(var s=0;s<e.length;s+=3){var l=new xt(e[s],e[s+1],e[s+2]);if(this.tmpPoints.length>0){var d=this.tmpPoints[this.tmpPoints.length-1],c=_.Sub(l,d).uni();l.setv(c);}this.tmpPoints.push(l);}if(this.tmpPoints.length<2)return;var i=this.tmpPoints[0].z*2,a=n?this.fullLayer:this.drawLayer||this.fullLayer;return this.draw({consumePoints:this.tmpPoints,layer:a,thickness:i});}},{key:"updateTempPoints",value:function updateTempPoints(t,e){var n=this.tmpPoints.length-1;var i=Date.now();for(var a=0;a<t.length;a+=2){var o=this.tmpPoints.length,s=new xt(t[a],t[a+1]);if(o===0){this.tmpPoints.push(s);continue;}var l=o-1,d=this.tmpPoints[l],c=_.Sub(s,d).uni();s.isNear(d,e/2)||(_.Equals(c,d.v,0.02)&&(this.tmpPoints.pop(),n--),s.setv(c),s.setT(i),this.tmpPoints.push(s));}return Math.max(n,0);}},{key:"getChangeNodes",value:function getChangeNodes(t){if(!this.vNodes)return;var e=this.worldPosition;var n=Bt(this.tmpPoints,t);n=Sr(n,e),n=G0(n,this.worldScaling,e);var _this$vNodes$getRectI3=this.vNodes.getRectIntersectRange(n),i=_this$vNodes$getRectI3.nodeRange;if(!i.size)return;var a=[];var o=0;for(var l=1;l<this.tmpPoints.length;l++){var d=this.tmpPoints[l-1],c=this.tmpPoints[l];if(l===1&&o===0&&(a[o]=[d.XY]),a[o].push(c.XY),l<this.tmpPoints.length-1){var p=c.getAngleByPoints(d,this.tmpPoints[l+1]);(p<90||p>270)&&(o++,a[o]=[c.XY]);}}this.tmpPoints.length===1&&a.length===0&&a.push([this.tmpPoints[0].XY,this.tmpPoints[0].XY]);var s=/* @__PURE__ */new Map();var _iterator32=_createForOfIteratorHelper(i.entries()),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _step32$value=_slicedToArray(_step32.value,2),_l6=_step32$value[0],_d11=_step32$value[1];var _c6=Sr(_d11.rect,[-e[0],-e[1]]);_c6={x:_c6.x/this.worldScaling[0],y:_c6.y/this.worldScaling[1],w:_c6.w/this.worldScaling[0],h:_c6.h/this.worldScaling[1]};var _p4=[_c6.x,_c6.y,_c6.x+_c6.w,_c6.y+_c6.h],y=[],P=[];var _iterator33=_createForOfIteratorHelper(a),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _v9=_step33.value;Dr.polyline(_v9,_p4,y);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}if(y.length&&_d11.opt){var _iterator34=_createForOfIteratorHelper(y),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var v=_step34.value;var _T40=[];for(var _f34=0;_f34<v.length;_f34++)_f34!==0&&oe(v[_f34],v[_f34-1])||_T40.push.apply(_T40,_toConsumableArray(v[_f34]));P.push(_T40);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}}_d11.opt.eraserlines||(_d11.opt.eraserlines=[]),_d11.opt.eraserlines&&(_d11.opt.eraserlines.push({op:P,thickness:t}),s.set(_l6,_d11));}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}return s;}},{key:"reRenderEffectNodes",value:function(){var _reRenderEffectNodes=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(t){var e,n,i,_iterator35,_step35,_step35$value,a,o,s,l,d;return _regeneratorRuntime().wrap(function _callee28$(_context30){while(1)switch(_context30.prev=_context30.next){case 0:n=t.willUpdateNodes,i=t.worker;_iterator35=_createForOfIteratorHelper(n.entries());_context30.prev=2;_iterator35.s();case 4:if((_step35=_iterator35.n()).done){_context30.next=31;break;}_step35$value=_slicedToArray(_step35.value,2),a=_step35$value[0],o=_step35$value[1];s=o.toolsType,l=i.createWorkShapeNode({workId:a,toolsType:s,toolsOpt:o.opt});l==null||l.setWorkId(a);d=void 0;if(!(s===ut.Image)){_context30.next=15;break;}_context30.next=12;return l.consumeServiceAsync({isFullWork:!0,replaceId:a,worker:i});case 12:d=_context30.sent;_context30.next=28;break;case 15:if(!(s===ut.Text)){_context30.next=21;break;}_context30.next=18;return l.consumeServiceAsync({isFullWork:!0,replaceId:a});case 18:d=_context30.sent;_context30.next=28;break;case 21:_context30.prev=21;d=l==null?void 0:l.consumeService({op:o.op,isFullWork:!0,replaceId:a});_context30.next=28;break;case 25:_context30.prev=25;_context30.t0=_context30["catch"](21);return _context30.abrupt("continue",29);case 28:d&&(e=Pt(e,d));case 29:_context30.next=4;break;case 31:_context30.next=36;break;case 33:_context30.prev=33;_context30.t1=_context30["catch"](2);_iterator35.e(_context30.t1);case 36:_context30.prev=36;_iterator35.f();return _context30.finish(36);case 39:return _context30.abrupt("return",e);case 40:case"end":return _context30.stop();}},_callee28,null,[[2,33,36,39],[21,25]]);}));function reRenderEffectNodes(_x36){return _reRenderEffectNodes.apply(this,arguments);}return reRenderEffectNodes;}()},{key:"consume",value:function consume(t){var e=t.data.op;if(!e||e.length===0)return _objectSpread({type:at.None},this.baseConsumeResult);var n=this.workOptions.thickness,_we$eraserSizes$n=we.eraserSizes[n],i=_we$eraserSizes$n.width,a=_we$eraserSizes$n.height,o=Math.max(i,a)/this.worldScaling[0],s=this.tmpPoints.length,l=this.tmpPoints[this.tmpPoints.length-1],d=this.updateTempPoints(e,o),c=this.tmpPoints[this.tmpPoints.length-1];if(s===this.tmpPoints.length&&c.equalsXY(l.x,l.y))return _objectSpread({type:at.None},this.baseConsumeResult);this.syncIndex=Math.min(this.syncIndex,d,Math.max(0,this.tmpPoints.length-2));var p=this.syncIndex;this.syncTimestamp===0&&(this.syncTimestamp=Date.now());var y=!1;var P=this.tmpPoints.slice(d),x=this.draw({consumePoints:P,layer:this.fullLayer,thickness:o});P[0].t-this.syncTimestamp>this.syncUnitTime&&(y=!0,this.syncTimestamp=P[0].t,this.syncIndex=this.tmpPoints.length);var v=[];return this.tmpPoints.slice(p).forEach(function(T){v.push(T.x,T.y,o/2);}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:at.DrawWork,dataType:Mt.Local,rect:x,op:y?v:void 0,index:y?p*3:void 0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var e=t.consumePoints,n=t.layer,i=t.thickness,a=this.workId;var o=n.getElementsByName(this.workId)[0],s=Bt(e,i);var d=[{op:[e.map(function(c){return[c.x,c.y];}).flat(1)],thickness:i}];return o||(o=new kt({normalize:!0,name:a,pos:[0,0],anchor:[0.5,0.5],bgcolor:"rgba(0,0,0,0.3)",zIndex:9999}),n.appendChild(o)),this.drawEraserlines({group:o,eraserlines:d,pos:[0,0],layer:n,isClear:!0}),s={x:Math.floor(s.x*this.worldScaling[0]+this.worldPosition[0]-vt.SafeBorderPadding),y:Math.floor(s.y*this.worldScaling[1]+this.worldPosition[1]-vt.SafeBorderPadding),w:Math.floor(s.w*this.worldScaling[0]+2*vt.SafeBorderPadding),h:Math.floor(s.h*this.worldScaling[1]+2*vt.SafeBorderPadding)},s;}},{key:"consumeAll",value:function consumeAll(){var t=this.fullLayer.getElementsByName(this.workId);var e;if(t.length&&(e=vt.getRectFromLayer(this.fullLayer,this.workId)),t.forEach(function(c){c.remove(),c.disconnect();}),!this.tmpPoints.length)return _objectSpread({type:at.None},this.baseConsumeResult);var n=this.workOptions.thickness,_we$eraserSizes$n2=we.eraserSizes[n],i=_we$eraserSizes$n2.width,a=_we$eraserSizes$n2.height,o=Math.max(i,a)/this.worldScaling[0],s=this.getChangeNodes(o);if(!(s!=null&&s.size))return _objectSpread(_objectSpread({type:at.FullWork},this.baseConsumeResult),{},{rect:e});var l=[];this.tmpPoints.map(function(c){l.push(c.x,c.y,o/2);});var d=Zt(l);return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:at.FullWork,dataType:Mt.Local,rect:e,ops:d,willUpdateNodes:s});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}]);}(vt);// 来源于white-sdk
439
- et(we,"eraserSizes",Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50})]));var Je=we;function Pi(h){switch(h){case ut.Arrow:return mi;case ut.Pencil:return ui;case ut.Straight:return Mi;case ut.Ellipse:return vi;case ut.Polygon:case ut.Triangle:return xi;case ut.Star:case ut.Rhombus:return Si;case ut.Rectangle:return yi;case ut.SpeechBalloon:return Ti;case ut.Text:return Xe;case ut.LaserPen:return di;case ut.Eraser:return se;case ut.PencilEraser:return ke;case ut.BitMapEraser:return Je;case ut.Selector:return Ve;case ut.Image:return Ne;}}function Fr(h,r){var t=h.toolsType,e=_objectWithoutProperties(h,_excluded);switch(t){case ut.Arrow:return new mi(e);case ut.Pencil:return new ui(e);case ut.Straight:return new Mi(e);case ut.Ellipse:return new vi(e);case ut.Polygon:case ut.Triangle:return new xi(e);case ut.Star:case ut.Rhombus:return new Si(e);case ut.Rectangle:return new yi(e);case ut.SpeechBalloon:return new Ti(e);case ut.Text:return new Xe(e);case ut.LaserPen:return new di(e);case ut.Eraser:return new se(e,r);case ut.BitMapEraser:return new Je(e);case ut.PencilEraser:return new ke(e,r);case ut.Selector:return e.vNodes?new Ve(_objectSpread(_objectSpread({},e),{},{vNodes:e.vNodes,drawLayer:e.fullLayer})):void 0;case ut.Image:return new Ne(e);default:return;}}function Oi(h){var r=[],t=["PATH","SPRITE","POLYLINE","RECT","ELLIPSE","LABEL"];var _iterator36=_createForOfIteratorHelper(h),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _e6=_step36.value;if(_e6.tagName==="GROUP"&&_e6.children.length)return Oi(_e6.children);_e6.tagName&&t.includes(_e6.tagName)&&r.push(_e6);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}return r;}function Pt(h,r){if(h&&r){var t=Math.min(h.x,r.x),_e7=Math.min(h.y,r.y),n=Math.max(h.x+h.w,r.x+r.w),i=Math.max(h.y+h.h,r.y+r.h),a=n-t,o=i-_e7;return{x:t,y:_e7,w:a,h:o};}return r||h;}function Bt(h){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var t={x:0,y:0,w:0,h:0};var e=1/0,n=1/0,i=-1/0,a=-1/0;return h.forEach(function(o){var _o$XY=_slicedToArray(o.XY,2),s=_o$XY[0],l=_o$XY[1];e=Math.min(e,s-r),n=Math.min(n,l-r),i=Math.max(i,s+r),a=Math.max(a,l+r);}),t.x=e,t.y=n,t.w=i-e,t.h=a-n,t;}function We(h,r){return!(h.x+h.w<r.x||h.x>r.x+r.w||h.y+h.h<r.y||h.y>r.y+r.h);}function wt(h){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:10;return{x:Math.floor(h.x-r),y:Math.floor(h.y-r),w:Math.ceil(h.w+r*2),h:Math.ceil(h.h+r*2)};}function Sr(h,r){return{x:h.x+r[0],y:h.y+r[1],w:h.w,h:h.h};}function z0(h,r){var t=new _(h.x,h.y),e=new _(h.x+h.w,h.y),n=new _(h.x+h.w,h.y+h.h),i=new _(h.x,h.y+h.h),a=new _(h.x+h.w/2,h.y+h.h/2),o=Math.PI*r/180,s=_.RotWith(t,a,o),l=_.RotWith(e,a,o),d=_.RotWith(n,a,o),c=_.RotWith(i,a,o);return[s,l,d,c];}function Ei(h,r){var t=z0(h,r);return Bt(t);}function G0(h,r,t){var e=new _(h.x,h.y),n=new _(h.x+h.w,h.y),i=new _(h.x+h.w,h.y+h.h),a=new _(h.x,h.y+h.h),o=new _(t[0],t[1]),s=new _(r[0],r[1]),l=_.ScaleWOrigin(e,s,o),d=_.ScaleWOrigin(n,s,o),c=_.ScaleWOrigin(i,s,o),p=_.ScaleWOrigin(a,s,o);return Bt([l,d,c,p]);}function H0(h,r,t){var e=new _(r[0],r[1]);for(var n=0;n<h.length;n+=3){var i=new _(h[n],h[n+1]),a=Math.PI*t/180,o=_.RotWith(i,e,a);h[n]=o.x,h[n+1]=o.y;}}function K0(h,r,t){var e=new _(r[0],r[1]);for(var n=0;n<h.length;n+=2){var i=new _(h[n],h[n+1]),a=Math.PI*t/180,o=_.RotWith(i,e,a);h[n]=o.x,h[n+1]=o.y;}}function Ur(h,r,t){var e=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var n=new _(r[0],r[1]);for(var i=0;i<h.length;i+=3){var a=new _(h[i],h[i+1]),o=new _(t[0],t[1]),s=_.ScaleWOrigin(a,o,n);h[i]=s.x+e[0],h[i+1]=s.y+e[1];}}function jr(h,r,t){var e=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var n=new _(r[0],r[1]);for(var i=0;i<h.length;i+=2){var a=new _(h[i],h[i+1]),o=new _(t[0],t[1]),s=_.ScaleWOrigin(a,o,n);h[i]=s.x+e[0],h[i+1]=s.y+e[1];}}function Y0(h,r){return h[0]>=r.x&&h[0]<=r.x+r.w&&h[1]>=r.y&&h[1]<=r.y+r.h;}function Ci(h,r){var t=h<=r?1:h/r,e=r<=h?1:r/h;return[t,e];}function V0(h){var _iterator37=_createForOfIteratorHelper(h),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var r=_step37.value;if(isNaN(r)||r===1/0||r===-1/0)return!1;}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}return!0;}function X0(h){return h!==Math.floor(h);}function k0(h){var r=h.toString();return r.indexOf(".")!==-1?r.split(".")[1].length:0;}function J0(h,r){for(;r!==0;){var _ref168=[r,h%r];h=_ref168[0];r=_ref168[1];}return h;}var Z0=function Z0(h){if(h.tagName==="GROUP"){var r=Object.getOwnPropertySymbols(h).find(function(t){return t.toString()==="Symbol(sealed)";});if(r&&h[r])return!0;}return!1;};function pe(h){return"".concat(Ze(h.x),",").concat(Ze(h.y)," ");}function me(h,r){return"".concat(Ze((h.x+r.x)/2),",").concat(Ze((h.y+r.y)/2)," ");}function Ze(h){return+h.toFixed(4);}var fr=function fr(h,r){return h.x+h.w<r.x||h.x>r.x+r.w||h.y+h.h<r.y||h.y>r.y+r.h?Te.outside:h.x>=r.x&&h.y>=r.y&&h.x+h.w<=r.x+r.w&&h.y+h.h<=r.y+r.h?Te.inside:Te.intersect;};function Q0(h){var r=0;for(var t=0;t<h.length;t++){var _e8=h.charCodeAt(t);_e8>=1&&_e8<=126||65376<=_e8&&_e8<=65439?r++:r+=2;}return r;}var be="cursorhover",Cn=20,Qe="mainView";var q0=/*#__PURE__*/function(){function q0(r,t){_classCallCheck(this,q0);et(this,"viewId");et(this,"scene");et(this,"fullLayer");et(this,"curNodeMap",/* @__PURE__ */new Map());et(this,"targetNodeMap",[]);et(this,"highLevelIds");et(this,"canClearUids");et(this,"localUid");this.viewId=r,this.scene=t;}return _createClass(q0,[{key:"init",value:function init(r){this.fullLayer=r;}},{key:"get",value:function get(r){return this.curNodeMap.get(r);}},{key:"setLocalUid",value:function setLocalUid(r){this.localUid=r;}},{key:"getLocalUid",value:function getLocalUid(){return this.localUid;}},{key:"setCanClearUids",value:function setCanClearUids(r){this.canClearUids=r;}},{key:"getCanClearUids",value:function getCanClearUids(){return this.canClearUids;}},{key:"getCanEraserNodes",value:function getCanEraserNodes(r){var t=/* @__PURE__ */new Map();var _iterator38=_createForOfIteratorHelper(r.entries()),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _step38$value=_slicedToArray(_step38.value,2),_e9=_step38$value[0],n=_step38$value[1];n.toolsType===ut.Image&&n.opt.locked||n.toolsType===ut.Text&&(n.opt.workState===It.Doing||n.opt.workState===It.Start)||this.isCanClearWorkId(_e9)&&t.set(_e9,n);}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return t;}},{key:"getNodesByType",value:function getNodesByType(r){var t=/* @__PURE__ */new Map();return this.curNodeMap.forEach(function(e,n){e.toolsType===r&&t.set(n,e);}),t;}},{key:"hasRenderNodes",value:function hasRenderNodes(){return!0;}},{key:"has",value:function has(r){return this.curNodeMap.has(r);}},{key:"setInfo",value:function setInfo(r,t){var e=this.curNodeMap.get(r)||{name:r,rect:t.rect};t.rect&&(e.rect=Xt(t.rect)),t.op&&V0(t.op)&&(e.op=Xt(t.op)),t.canRotate&&(e.canRotate=t.canRotate),t.scaleType&&(e.scaleType=t.scaleType),t.opt&&(e.opt=Xt(t.opt)),t.toolsType&&(e.toolsType=t.toolsType),t.centerPos&&(e.centerPos=Xt(t.centerPos)),ye(t.isSelected)&&(e.isSelected=t.isSelected),e.rect?this.curNodeMap.set(r,e):this.curNodeMap["delete"](r);}},{key:"selected",value:function selected(r){this.setInfo(r,{isSelected:!0});}},{key:"unSelected",value:function unSelected(r){this.setInfo(r,{isSelected:!1});}},{key:"delete",value:function _delete(r){this.curNodeMap["delete"](r);}},{key:"clear",value:function clear(){this.curNodeMap.clear(),this.targetNodeMap.length=0;}},{key:"getRectIntersectRange",value:function getRectIntersectRange(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var n;var i=/* @__PURE__ */new Map();var _iterator39=_createForOfIteratorHelper(this.curNodeMap.entries()),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _step39$value=_slicedToArray(_step39.value,2),a=_step39$value[0],o=_step39$value[1];if(We(r,o.rect)){if(t&&o.toolsType===ut.Image&&o.opt.locked||e&&o.toolsType===ut.Text&&(o.opt.workState===It.Doing||o.opt.workState===It.Start))continue;n=Pt(n,o.rect),i.set(a,o);}}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}return{rectRange:n,nodeRange:i};}},{key:"getNodeRectFormShape",value:function getNodeRectFormShape(r,t){var e=Pi(t.toolsType);return this.fullLayer&&(e==null?void 0:e.getRectFromLayer(this.fullLayer,r));}},{key:"updateNodeRect",value:function updateNodeRect(r){var t=this.curNodeMap.get(r);if(t){var _e10=this.getNodeRectFormShape(r,t);if(!_e10){this.curNodeMap["delete"](r);return;}t.rect=_e10,this.curNodeMap.set(r,t);}}},{key:"updateHighLevelNodesRect",value:function updateHighLevelNodesRect(r){this.highLevelIds=r;var _iterator40=_createForOfIteratorHelper(this.highLevelIds.keys()),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var t=_step40.value;this.updateNodeRect(t);}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}},{key:"updateLowLevelNodesRect",value:function updateLowLevelNodesRect(){var r;var _iterator41=_createForOfIteratorHelper(this.curNodeMap.keys()),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var t=_step41.value;(r=this.highLevelIds)!=null&&r.has(t)||this.updateNodeRect(t);}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}}},{key:"clearHighLevelIds",value:function clearHighLevelIds(){this.highLevelIds=void 0;}},{key:"setTargetAssignKeys",value:function setTargetAssignKeys(r){var t=/* @__PURE__ */new Map();var _iterator42=_createForOfIteratorHelper(r),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _e11=_step42.value;var n=this.curNodeMap.get(_e11);n&&t.set(_e11,Xt(n));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return this.targetNodeMap.push(Xt(t)),this.targetNodeMap.length-1;}},{key:"setTarget",value:function setTarget(){return this.targetNodeMap.push(Xt(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(r){return this.targetNodeMap[r];}},{key:"deleteTarget",value:function deleteTarget(r){this.targetNodeMap.length=r;}},{key:"clearTarget",value:function clearTarget(){this.targetNodeMap.length=0;}},{key:"isLocalWorkId",value:function isLocalWorkId(r){return r.split(De).length===1;}},{key:"isCanClearWorkId",value:function isCanClearWorkId(r){if(this.canClearUids===void 0||this.canClearUids===!0)return!0;if(Ru(this.canClearUids)){var t=r.split(De);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 Ai=/*#__PURE__*/function(){function Ai(r,t,e){_classCallCheck(this,Ai);et(this,"viewId");et(this,"scene");et(this,"fullLayer");et(this,"vNodes");et(this,"dpr");et(this,"contextType");et(this,"opt");et(this,"cameraOpt");et(this,"isSafari",!1);et(this,"combinePostMsg",/* @__PURE__ */new Set());et(this,"workerTaskId");et(this,"protectedTask");et(this,"hasPriorityDraw",!0);et(this,"delayPostDoneResolve");et(this,"cacheImages",/* @__PURE__ */new Map());et(this,"imageResolveMap",/* @__PURE__ */new Map());var n,i;if(this.viewId=r,this.opt=t,this.dpr=t.dpr,this.contextType=this.getSupportContextType(e,(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.createRenderLayer(t);}catch(_unused25){if(this.contextType!=="2d")this.contextType="2d",(i=this.scene)==null||i.disconnect(),this.createRenderLayer(t);else throw new Error("Sorry, your browser doesn't support canvas context type ".concat(this.contextType));}this.vNodes=new q0(r,this.scene);}return _createClass(Ai,[{key:"createRenderLayer",value:function createRenderLayer(r){this.scene=this.createScene(r.offscreenCanvasOpt);var t=re.bufferSize.full,e=re.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",this.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:this.viewId===Qe?t:e}));}},{key:"getCachedImages",value:function getCachedImages(r){var t;return(t=this.cacheImages.get(r))==null?void 0:t.imageBitmap;}},{key:"getCachedImagesByWorkId",value:function getCachedImagesByWorkId(r){var _iterator43=_createForOfIteratorHelper(this.cacheImages.entries()),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _step43$value=_slicedToArray(_step43.value,2),t=_step43$value[0],_e12=_step43$value[1];if(t===r&&_e12.imageBitmap)return _e12.imageBitmap;}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}}},{key:"deleteCachedImagesByWorkId",value:function deleteCachedImagesByWorkId(r,t){var _iterator44=_createForOfIteratorHelper(this.cacheImages.entries()),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var _step44$value=_slicedToArray(_step44.value,2),_e13=_step44$value[0],n=_step44$value[1];t&&_e13===t||n.workId===r&&(n.imageBitmap.close(),this.cacheImages["delete"](_e13));}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}},{key:"clearCacheImages",value:function clearCacheImages(){this.cacheImages.forEach(function(r){return r.imageBitmap.close();}),this.cacheImages.clear();}},{key:"clearImageResolveMap",value:function clearImageResolveMap(){this.imageResolveMap.forEach(function(_ref169){var r=_ref169.timer;r&&clearTimeout(r);}),this.imageResolveMap.clear();}},{key:"setHasPriorityDraw",value:function setHasPriorityDraw(r){this.hasPriorityDraw=r;}},{key:"getPriorityDraw",value:function getPriorityDraw(){return this.hasPriorityDraw;}},{key:"setIsSafari",value:function setIsSafari(r){this.isSafari=r;}},{key:"on",value:function(){var _on=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(r){var t,e,n,i,a,o,s,_s5,l,d,c;return _regeneratorRuntime().wrap(function _callee29$(_context31){while(1)switch(_context31.prev=_context31.next){case 0:t=r.msgType,e=r.toolsType,n=r.opt,i=r.imageSrc,a=r.imageBitmap,o=r.workId;_context31.t0=t;_context31.next=_context31.t0===at.UpdateCamera?4:_context31.t0===at.Destroy?7:_context31.t0===at.Clear?9:_context31.t0===at.UpdateTools?12:_context31.t0===at.GetImageBitMap?14:16;break;case 4:_context31.next=6;return this.updateCamera(r);case 6:return _context31.abrupt("break",16);case 7:this.destroy();return _context31.abrupt("break",16);case 9:_context31.next=11;return this.clearAll();case 11:return _context31.abrupt("break",16);case 12:if(e&&n){s={toolsType:e,toolsOpt:n};this.localWork.setToolsOpt(s);}return _context31.abrupt("break",16);case 14:if(i&&a&&o){_s5=o.toString();this.cacheImages.set(i,{imageBitmap:a,workId:_s5});l=this.imageResolveMap.get(i);if(l){d=l.resolve,c=l.timer;c&&clearTimeout(c),d&&d(i);}this.deleteCachedImagesByWorkId(_s5,i);}return _context31.abrupt("break",16);case 16:case"end":return _context31.stop();}},_callee29,this);}));function on(_x37){return _on.apply(this,arguments);}return on;}()},{key:"getIconSize",value:function getIconSize(r,t){var e=r*3,n=t*3;return e<=50||n<=50?[50,50]:e<=100||n<=100?[100,100]:e<=400||n<=400?[400,400]:e<=800||n<=800?[800,800]:e<=1600||n<=1600?[1600,1600]:[2e3,2e3];}},{key:"loadImageBitMap",value:function(){var _loadImageBitMap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(r){var _this88=this;var t,e,n,i,a,o,s,l,d,c,_this$getIconSize,_this$getIconSize2,x,v,_x39,_x40,P;return _regeneratorRuntime().wrap(function _callee30$(_context32){while(1)switch(_context32.prev=_context32.next){case 0:t=r.toolsType,e=r.opt,n=r.workId;if(!(t===ut.Image&&e&&n)){_context32.next=19;break;}i=n.toString(),a=e.src,o=e.type,s=e.width,l=e.height,d=e.strokeColor;if(!(!a||!o||!s||!l)){_context32.next=5;break;}return _context32.abrupt("return");case 5:c=a;if(o===xr.Iconify){_this$getIconSize=this.getIconSize(s,l),_this$getIconSize2=_slicedToArray(_this$getIconSize,2),x=_this$getIconSize2[0],v=_this$getIconSize2[1];c="".concat(a,"?width=").concat(x,"&height=").concat(v,"&color=").concat(d);}if(!this.cacheImages.has(c)){_context32.next=11;break;}_x39=this.getCachedImages(c);if(!_x39){_context32.next=11;break;}return _context32.abrupt("return",_x39);case 11:if(!this.imageResolveMap.has(c)){_context32.next=15;break;}_x40=this.getCachedImagesByWorkId(i);if(!_x40){_context32.next=15;break;}return _context32.abrupt("return",_x40);case 15:_context32.next=17;return new Promise(function(x){var v=_this88.imageResolveMap.get(c)||{resolve:void 0,timer:void 0};v.timer&&clearTimeout(v.timer),v.resolve=x,v.timer=setTimeout(function(){var T=_this88.imageResolveMap.get(c);T!=null&&T.resolve&&T.resolve(c);},5e3),_this88.imageResolveMap.set(c,v),_this88._post({sp:[{imageSrc:c,workId:i,viewId:_this88.viewId,isgl:!!_this88.fullLayer.parent.gl,isSubWorker:!1,type:at.GetImageBitMap}]});});case 17:P=_context32.sent;return _context32.abrupt("return",(this.imageResolveMap["delete"](P),this.getCachedImages(c)));case 19:case"end":return _context32.stop();}},_callee30,this);}));function loadImageBitMap(_x38){return _loadImageBitMap.apply(this,arguments);}return loadImageBitMap;}()},{key:"createLocalWork",value:function createLocalWork(r){var t=r.workId,e=r.opt,n=r.toolsType;t&&e&&(!this.localWork.getToolsOpt()&&n&&this.setToolsOpt({toolsType:n,toolsOpt:e}),this.setWorkOpt({workId:t,toolsOpt:e}));}},{key:"updateScene",value:function updateScene(r){this.scene.attr(_objectSpread({},r));var t=r.width,e=r.height;this.scene.container.width=t,this.scene.container.height=e,this.scene.width=t,this.scene.height=e,this.updateLayer({width:t,height:e});}},{key:"updateLayer",value:function updateLayer(r){var t=r.width,e=r.height;this.fullLayer&&(this.fullLayer.parent.setAttribute("width",t),this.fullLayer.parent.setAttribute("height",e),this.fullLayer.setAttribute("size",[t,e]),this.fullLayer.setAttribute("pos",[t*0.5,e*0.5]));}},{key:"getSupportContextType",value:function getSupportContextType(r,t){var e=new OffscreenCanvas(100,100);var n=["2d"];r===qe.Full&&this.viewId===Qe&&(n=["webgl2","webgl","2d"],t&&n.unshift(t));for(var _i9=0,_n7=n;_i9<_n7.length;_i9++){var i=_n7[_i9];try{if(e.getContext(i))return i;}catch(_unused26){continue;}}}},{key:"createScene",value:function createScene(r){var t=r.width,e=r.height,n=new OffscreenCanvas(t,e);r.contextType&&delete r.contextType;var i=new _i(_objectSpread(_objectSpread({container:n,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},r),{},{contextType:this.contextType,id:this.viewId}));return i.setAttribute("id",this.viewId),i;}},{key:"createLayer",value:function createLayer(r,t,e){var n=e.width,i=e.height,a="offscreen-".concat(r),o=t.layer(a,e),s=new kt({anchor:[0.5,0.5],pos:[n*0.5,i*0.5],size:[n,i],name:"viewport",id:r});return o.append(s),s;}},{key:"clearAll",value:function(){var _clearAll=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(){var r;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();}),this.fullLayer.removeAllChildren()),this.clearCacheImages(),this.clearImageResolveMap(),this.localWork.destroy(),(r=this.serviceWork)==null||r.destroy();case 1:case"end":return _context33.stop();}},_callee31,this);}));function clearAll(){return _clearAll.apply(this,arguments);}return clearAll;}()},{key:"setToolsOpt",value:function setToolsOpt(r){this.localWork.setToolsOpt(r);}},{key:"setWorkOpt",value:function setWorkOpt(r){var t=r.workId,e=r.toolsOpt;t&&e&&this.localWork.setWorkOptions(t.toString(),e);}},{key:"destroy",value:function destroy(){var r;this.vNodes.clear(),this.fullLayer.remove(),this.clearCacheImages(),this.clearImageResolveMap(),this.scene.remove(),this.localWork.destroy(),(r=this.serviceWork)==null||r.destroy();}},{key:"post",value:function(){var _post=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(r){return _regeneratorRuntime().wrap(function _callee32$(_context34){while(1)switch(_context34.prev=_context34.next){case 0:this.combinePostMsg.add(r);_context34.next=3;return this.runBatchPostData();case 3:case"end":return _context34.stop();}},_callee32,this);}));function post(_x41){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===qe.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 i,a;this.workerTaskId=void 0;var r=[],t=[];var e;var n=/* @__PURE__ */new Set();var _iterator45=_createForOfIteratorHelper(this.combinePostMsg.values()),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var o=_step45.value;if((i=o.render)!=null&&i.length){var _iterator46=_createForOfIteratorHelper(o.render),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var s=_step46.value;var l=!1;if(s.workId&&n.add(s.workId),s.isClearAll&&(s.rect=this.getSceneRect(),s.isClear=!0,delete s.isClearAll),s.drawCanvas){var d=this.getLayer(s.drawCanvas);if(!d||!(d.parent instanceof qi))continue;if(d.parent.render(),s.isDrawAll){var c=this.getSceneRect();s.rect=c,delete s.isDrawAll;}}var _iterator47=_createForOfIteratorHelper(r),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _d12=_step47.value;if(s.viewId===_d12.viewId){s.isClear&&_d12.clearCanvas&&_d12.isClear&&_d12.clearCanvas===s.clearCanvas&&(_d12.rect=Pt(_d12.rect,s.rect),l=!0),_d12.drawCanvas&&_d12.drawCanvas===s.drawCanvas&&(_d12.rect=Pt(_d12.rect,s.rect),l=!0);continue;}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}l||(s.isClear&&!s.drawCanvas?r.unshift(s):r.push(s));}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}}if((a=o.sp)!=null&&a.length){var _iterator48=_createForOfIteratorHelper(o.sp),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var _s6=_step48.value;var _l7=!1;var _iterator49=_createForOfIteratorHelper(t),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _d13=_step49.value;if(oe(_s6,_d13)){_l7=!0;break;}}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}_l7||t.push(_s6);}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}_t(o.drawCount)&&(e=o.drawCount);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}return this.combinePostMsg.clear(),{render:r,sp:t,drawCount:e,workIds:n,viewId:this.viewId};}},{key:"safariFixRect",value:function safariFixRect(r,t){if(r.w+r.x<=0||r.h+r.y<=0||r.w<=0||r.h<=0)return;var e=this.scene.width,n=this.scene.height,i={x:Math.floor(Math.max(0,r.x)),y:Math.floor(Math.max(0,r.y)),w:Math.floor(Math.min(e,r.w)),h:Math.floor(Math.min(n,r.h))};if(i.x+i.w>e&&(i.w=Math.floor(e-i.x)),i.y+i.h>n&&(i.h=Math.floor(n-i.y)),X0(t)){var a=k0(t),o=Math.pow(10,a),s=J0(o,t*o),l=i.x%s,d=i.x-l;d>=0?(i.x=d,i.w=i.w+l):(i.x=0,i.w=i.w+l-d);var c=i.y%s,p=i.y-c;p>=0?(i.y=p,i.h=i.h+c):(i.y=0,i.h=i.h+c-p);}return i;}},{key:"getSceneRect",value:function getSceneRect(){var _this$scene=this.scene,r=_this$scene.width,t=_this$scene.height;return{x:0,y:0,w:Math.floor(r),h:Math.floor(t)};}}]);}();var Ri=/*#__PURE__*/function(){function Ri(r){_classCallCheck(this,Ri);et(this,"viewId");et(this,"vNodes");et(this,"thread");et(this,"fullLayer");et(this,"drawLayer");et(this,"_post");et(this,"tmpOpt");et(this,"workShapes",/* @__PURE__ */new Map());et(this,"drawCount",0);et(this,"syncUnitTime",re.syncOpt.interval);this.thread=r.thread,this.viewId=r.viewId,this.vNodes=r.vNodes,this.fullLayer=r.fullLayer,this.drawLayer=r.drawLayer,this._post=this.thread.post.bind(r.thread);}return _createClass(Ri,[{key:"destroy",value:function destroy(){this.workShapes.clear();}},{key:"getWorkShapes",value:function getWorkShapes(){return this.workShapes;}},{key:"getWorkShape",value:function getWorkShape(r){return this.workShapes.get(r);}},{key:"createWorkShape",value:function createWorkShape(r,t){if(r&&this.tmpOpt){var _e14={toolsType:this.tmpOpt.toolsType,toolsOpt:t||this.tmpOpt.toolsOpt},n=this.createWorkShapeNode(_objectSpread(_objectSpread({},_e14),{},{workId:r}));n&&this.workShapes.set(r,n);}}},{key:"setWorkOptions",value:function setWorkOptions(r,t){var e=this.getWorkShape(r);e||this.createWorkShape(r,t),e==null||e.setWorkOptions(t);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(r){var t;return Fr(_objectSpread(_objectSpread({},r),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(t=this.thread)==null?void 0:t.serviceWork);}},{key:"setToolsOpt",value:function setToolsOpt(r){var t,e,n;((t=this.tmpOpt)==null?void 0:t.toolsType)!==r.toolsType&&(e=this.tmpOpt)!=null&&e.toolsType&&this.clearAllWorkShapesCache(),this.tmpOpt=r,(n=r.toolsOpt)!=null&&n.syncUnitTime&&(this.syncUnitTime=r.toolsOpt.syncUnitTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"clearWorkShapeNodeCache",value:function clearWorkShapeNodeCache(r){var t;(t=this.getWorkShape(r))==null||t.clearTmpPoints(),this.workShapes["delete"](r);}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.workShapes.forEach(function(r){return r.clearTmpPoints();}),this.workShapes.clear();}},{key:"setFullWork",value:function setFullWork(r){var t=r.workId,e=r.opt,n=r.toolsType;if(t&&e&&n){var i=t.toString();var a;return t&&this.workShapes.has(i)?(a=this.workShapes.get(i),a==null||a.setWorkOptions(e)):a=this.createWorkShapeNode({toolsOpt:e,toolsType:n,workId:i}),a?(this.workShapes.set(i,a),a):void 0;}}}]);}();var _0=ee,tg=function tg(){return _0.Date.now();},eg=tg,rg=/\s/;function ng(h){for(var r=h.length;r--&&rg.test(h.charAt(r)););return r;}var ig=ng,sg=ig,og=/^\s+/;function ag(h){return h&&h.slice(0,sg(h)+1).replace(og,"");}var lg=ag,cg=de,fg=ne,hg="[object Symbol]";function ug(h){return _typeof(h)=="symbol"||fg(h)&&cg(h)==hg;}var dg=ug,gg=lg,An=he,pg=dg,Rn=NaN,mg=/^[-+]0x[0-9a-f]+$/i,vg=/^0b[01]+$/i,yg=/^0o[0-7]+$/i,Sg=parseInt;function xg(h){if(typeof h=="number")return h;if(pg(h))return Rn;if(An(h)){var r=typeof h.valueOf=="function"?h.valueOf():h;h=An(r)?r+"":r;}if(typeof h!="string")return h===0?h:+h;h=gg(h);var t=vg.test(h);return t||yg.test(h)?Sg(h.slice(2),t?2:8):mg.test(h)?Rn:+h;}var Tg=xg,Mg=he,hr=eg,In=Tg,Pg="Expected a function",Og=Math.max,Eg=Math.min;function Cg(h,r,t){var e,n,i,a,o,s,l=0,d=!1,c=!1,p=!0;if(typeof h!="function")throw new TypeError(Pg);r=In(r)||0,Mg(t)&&(d=!!t.leading,c="maxWait"in t,i=c?Og(In(t.maxWait)||0,r):i,p="trailing"in t?!!t.trailing:p);function y(M){var E=e,A=n;return e=n=void 0,l=M,a=h.apply(A,E),a;}function P(M){return l=M,o=setTimeout(T,r),d?y(M):a;}function x(M){var E=M-s,A=M-l,b=r-E;return c?Eg(b,i-A):b;}function v(M){var E=M-s,A=M-l;return s===void 0||E>=r||E<0||c&&A>=i;}function T(){var M=hr();if(v(M))return f(M);o=setTimeout(T,x(M));}function f(M){return o=void 0,p&&e?y(M):(e=n=void 0,a);}function g(){o!==void 0&&clearTimeout(o),l=0,e=s=n=o=void 0;}function u(){return o===void 0?a:f(hr());}function m(){var M=hr(),E=v(M);if(e=arguments,n=this,s=M,E){if(o===void 0)return P(s);if(c)return clearTimeout(o),o=setTimeout(T,r),y(s);}return o===void 0&&(o=setTimeout(T,r)),a;}return m.cancel=g,m.flush=u,m;}var Ag=Cg,Rg=Ag,Ig=he,Lg="Expected a function";function bg(h,r,t){var e=!0,n=!0;if(typeof h!="function")throw new TypeError(Lg);return Ig(t)&&(e="leading"in t?!!t.leading:e,n="trailing"in t?!!t.trailing:n),Rg(h,r,{leading:e,maxWait:r,trailing:n});}var wg=bg,Dg=/* @__PURE__ */fe(wg);function Ng(h){return h;}var Ii=Ng;function Wg(h,r,t){switch(t.length){case 0:return h.call(r);case 1:return h.call(r,t[0]);case 2:return h.call(r,t[0],t[1]);case 3:return h.call(r,t[0],t[1],t[2]);}return h.apply(r,t);}var Bg=Wg,Fg=Bg,Ln=Math.max;function Ug(h,r,t){return r=Ln(r===void 0?h.length-1:r,0),function(){for(var e=arguments,n=-1,i=Ln(e.length-r,0),a=Array(i);++n<i;)a[n]=e[r+n];n=-1;for(var o=Array(r+1);++n<r;)o[n]=e[n];return o[r]=t(a),Fg(h,this,o);};}var jg=Ug;function $g(h){return function(){return h;};}var zg=$g,Gg=zg,bn=Gn,Hg=Ii,Kg=bn?function(h,r){return bn(h,"toString",{configurable:!0,enumerable:!1,value:Gg(r),writable:!0});}:Hg,Yg=Kg,Vg=800,Xg=16,kg=Date.now;function Jg(h){var r=0,t=0;return function(){var e=kg(),n=Xg-(e-t);if(t=e,n>0){if(++r>=Vg)return arguments[0];}else r=0;return h.apply(void 0,arguments);};}var Zg=Jg,Qg=Yg,qg=Zg,_g=qg(Qg),tp=_g,ep=Ii,rp=jg,np=tp;function ip(h,r){return np(rp(h,r,ep),h+"");}var sp=ip;function op(h,r,t,e){for(var n=h.length,i=t+(e?1:-1);e?i--:++i<n;)if(r(h[i],i,h))return i;return-1;}var ap=op;function lp(h){return h!==h;}var cp=lp;function fp(h,r,t){for(var e=t-1,n=h.length;++e<n;)if(h[e]===r)return e;return-1;}var hp=fp,up=ap,dp=cp,gp=hp;function pp(h,r,t){return r===r?gp(h,r,t):up(h,dp,t);}var mp=pp,vp=mp;function yp(h,r){var t=h==null?0:h.length;return!!t&&vp(h,r,0)>-1;}var Li=yp;function Sp(h,r,t){for(var e=-1,n=h==null?0:h.length;++e<n;)if(t(r,h[e]))return!0;return!1;}var bi=Sp;function xp(h,r){for(var t=-1,e=h==null?0:h.length,n=Array(e);++t<e;)n[t]=r(h[t],t,h);return n;}var Tp=xp,Mp=Nr,Pp=Li,Op=bi,Ep=Tp,Cp=sr,Ap=Wr,Rp=200;function Ip(h,r,t,e){var n=-1,i=Pp,a=!0,o=h.length,s=[],l=r.length;if(!o)return s;t&&(r=Ep(r,Cp(t))),e?(i=Op,a=!1):r.length>=Rp&&(i=Ap,a=!1,r=new Mp(r));t:for(;++n<o;){var d=h[n],c=t==null?d:t(d);if(d=e||d!==0?d:0,a&&c===c){for(var p=l;p--;)if(r[p]===c)continue t;s.push(d);}else i(r,c,e)||s.push(d);}return s;}var Lp=Ip,wn=Be,bp=Vn,wp=Fe,Dn=wn?wn.isConcatSpreadable:void 0;function Dp(h){return wp(h)||bp(h)||!!(Dn&&h&&h[Dn]);}var Np=Dp,Wp=Lr,Bp=Np;function wi(h,r,t,e,n){var i=-1,a=h.length;for(t||(t=Bp),n||(n=[]);++i<a;){var o=h[i];r>0&&t(o)?r>1?wi(o,r-1,t,e,n):Wp(n,o):e||(n[n.length]=o);}return n;}var Fp=wi;function Up(){}var jp=Up,ur=ni,$p=jp,zp=Br,Gp=1/0,Hp=ur&&1/zp(new ur([,-0]))[1]==Gp?function(h){return new ur(h);}:$p,Kp=Hp,Yp=Nr,Vp=Li,Xp=bi,kp=Wr,Jp=Kp,Zp=Br,Qp=200;function qp(h,r,t){var e=-1,n=Vp,i=h.length,a=!0,o=[],s=o;if(t)a=!1,n=Xp;else if(i>=Qp){var l=r?null:Jp(h);if(l)return Zp(l);a=!1,n=kp,s=new Yp();}else s=r?[]:o;t:for(;++e<i;){var d=h[e],c=r?r(d):d;if(d=t||d!==0?d:0,a&&c===c){for(var p=s.length;p--;)if(s[p]===c)continue t;r&&s.push(c),o.push(d);}else n(s,c,t)||(s!==o&&s.push(c),o.push(d));}return o;}var _p=qp,tm=Lp,em=Fp,Nn=_p;function rm(h,r,t){var e=h.length;if(e<2)return e?Nn(h[0]):[];for(var n=-1,i=Array(e);++n<e;)for(var a=h[n],o=-1;++o<e;)o!=n&&(i[n]=tm(i[n]||a,h[o],r,t));return Nn(em(i,1),r,t);}var nm=rm,im=Cr,sm=ne;function om(h){return sm(h)&&im(h);}var am=om,lm=Qn,cm=sp,fm=nm,hm=am,um=cm(function(h){return fm(lm(h,hm));}),dm=um,gm=/* @__PURE__ */fe(dm);var pm=/*#__PURE__*/function(_Ri){function pm(t){var _this90;_classCallCheck(this,pm);_this90=_callSuper(this,pm,[t]);et(_this90,"combineUnitTime",re.bezier.combineUnitTime);et(_this90,"combineTimerId");et(_this90,"combineDrawResolve");et(_this90,"combineDrawActiveId");et(_this90,"drawWorkActiveId");et(_this90,"effectSelectNodeData",/* @__PURE__ */new Set());et(_this90,"batchEraserWorks",/* @__PURE__ */new Set());et(_this90,"batchEraserRemoveNodes",/* @__PURE__ */new Set());et(_this90,"batchEraserCombine",Dg(function(){var t=_this90.updateBatchEraserCombineNode(_this90.batchEraserWorks,_this90.batchEraserRemoveNodes);_this90.batchEraserWorks.clear(),_this90.batchEraserRemoveNodes.clear(),t.length&&_this90._post({render:t});},200,{leading:!1}));return _this90;}_inherits(pm,_Ri);return _createClass(pm,[{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(_x42){return _loadImageBitMap2.apply(this,arguments);}return loadImageBitMap;}()},{key:"consumeDraw",value:function(){var _consumeDraw=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(t,e){var _this91=this;var n,i,a,o,s,l,d;return _regeneratorRuntime().wrap(function _callee35$(_context37){while(1)switch(_context37.prev=_context37.next){case 0:n=t.op,i=t.workId,a=t.scenePath;if(!(n!=null&&n.length&&i)){_context37.next=57;break;}o=i.toString(),s=this.getWorkShape(o);if(s){_context37.next=5;break;}return _context37.abrupt("return");case 5:l=s.toolsType;if(!(l===ut.LaserPen)){_context37.next=8;break;}return _context37.abrupt("return");case 8:_context37.t0=this.combineDrawActiveId&&this.combineDrawActiveId!==o;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:a,viewId:this.viewId,msgType:at.DrawWork,dataType:Mt.Local},e);case 13:_context37.t1=this.drawWorkActiveId&&this.drawWorkActiveId!==o;if(!_context37.t1){_context37.next=18;break;}_context37.next=17;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:a,viewId:this.viewId,msgType:at.DrawWork,dataType:Mt.Local},e);case 17:this.drawWorkActiveId=void 0;case 18:!this.drawWorkActiveId&&o!==Nt&&(this.drawWorkActiveId=o);d=s.consume({data:t,isFullWork:!0});_context37.t2=l;_context37.next=_context37.t2===ut.Selector?23:_context37.t2===ut.PencilEraser?29:_context37.t2===ut.BitMapEraser?34:_context37.t2===ut.Eraser?39:_context37.t2===ut.Arrow?44:_context37.t2===ut.Straight?44:_context37.t2===ut.Ellipse?44:_context37.t2===ut.Rectangle?44:_context37.t2===ut.Star?44:_context37.t2===ut.Polygon?44:_context37.t2===ut.SpeechBalloon?44:_context37.t2===ut.Pencil?50:57;break;case 23:_context37.t3=d.type===at.Select;if(!_context37.t3){_context37.next=28;break;}d.selectIds&&e.runReverseSelectWork(d.selectIds);_context37.next=28;return this.drawSelector(d);case 28:return _context37.abrupt("break",57);case 29:_context37.t4=d!=null&&d.rect;if(!_context37.t4){_context37.next=33;break;}_context37.next=33;return this.drawPencilEraser(d);case 33:return _context37.abrupt("break",57);case 34:_context37.t5=d!=null&&d.rect;if(!_context37.t5){_context37.next=38;break;}_context37.next=38;return this.drawBitMapEraser(d);case 38:return _context37.abrupt("break",57);case 39:_context37.t6=d!=null&&d.rect;if(!_context37.t6){_context37.next=43;break;}_context37.next=43;return this.drawEraser(d);case 43:return _context37.abrupt("break",57);case 44:_context37.t7=d;if(!_context37.t7){_context37.next=49;break;}this.drawCount++;_context37.next=49;return this.drawShape(d);case 49:return _context37.abrupt("break",57);case 50:this.drawCount++;this.combineTimerId||new Promise(function(c){_this91.combineDrawActiveId=o,_this91.combineDrawResolve=c,_this91.combineTimerId=setTimeout(function(){_this91.combineTimerId=void 0,_this91.combineDrawResolve&&_this91.combineDrawResolve(!0);},_this91.combineUnitTime);}).then(function(c){c&&_this91.drawPencilCombine(o,_this91.drawCount),_this91.combineDrawResolve=void 0;});_context37.t8=d;if(!_context37.t8){_context37.next=56;break;}_context37.next=56;return this.drawPencil(d);case 56:return _context37.abrupt("break",57);case 57:case"end":return _context37.stop();}},_callee35,this);}));function consumeDraw(_x43,_x44){return _consumeDraw.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(t,e){var o,s,l,d,n,i,a,c,p,y,P,x,v;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,i=t.scenePath,a=t.isLockSentEventCursor;if(!n){_context38.next=42;break;}c=n.toString();this.drawWorkActiveId===c&&(this.drawWorkActiveId=void 0);p=this.workShapes.get(c);if(p){_context38.next=8;break;}return _context38.abrupt("return");case 8:y=p.toolsType;if(!(y===ut.LaserPen)){_context38.next=11;break;}return _context38.abrupt("return");case 11:P=this.workShapes.get(be),x=(o=P==null?void 0:P.selectIds)==null?void 0:o[0],v=p.consumeAll({data:t});_context38.t0=y;_context38.next=_context38.t0===ut.Selector?15:_context38.t0===ut.PencilEraser?21:_context38.t0===ut.BitMapEraser?23:_context38.t0===ut.Eraser?28:_context38.t0===ut.Arrow?30:_context38.t0===ut.Straight?30:_context38.t0===ut.Ellipse?30:_context38.t0===ut.Rectangle?30:_context38.t0===ut.Star?30:_context38.t0===ut.Polygon?30:_context38.t0===ut.SpeechBalloon?30:_context38.t0===ut.Pencil?35:42;break;case 15:v.selectIds&&x&&(s=v.selectIds)!=null&&s.includes(x)&&P.cursorBlur();v.selectIds&&e.runReverseSelectWork(v.selectIds);_context38.next=19;return this.drawSelector(_objectSpread(_objectSpread({},v),{},{scenePath:i}));case 19:(l=p.selectIds)!=null&&l.length?p.clearTmpPoints():this.clearWorkShapeNodeCache(c);return _context38.abrupt("break",42);case 21:this.drawPencilEraser(_objectSpread(_objectSpread({},v),{},{scenePath:i}),a),p.clearTmpPoints();return _context38.abrupt("break",42);case 23:_context38.t1=v.rect||(d=v.newWorkDatas)!=null&&d.size;if(!_context38.t1){_context38.next=27;break;}_context38.next=27;return this.drawBitMapEraserFull(p,v,a);case 27:return _context38.abrupt("break",42);case 28:this.drawEraser(_objectSpread(_objectSpread({},v),{},{scenePath:i}),a),p.clearTmpPoints();return _context38.abrupt("break",42);case 30:_context38.next=32;return this.drawPencilFull(_objectSpread(_objectSpread({},v),{},{scenePath:i}),a);case 32:this.drawCount=0;this.clearWorkShapeNodeCache(c);return _context38.abrupt("break",42);case 35:_context38.t2=v!=null&&v.rect;if(!_context38.t2){_context38.next=40;break;}_context38.next=39;return this.drawPencilFull(_objectSpread(_objectSpread({},v),{},{scenePath:i}),a);case 39:this.drawCount=0;case 40:this.clearWorkShapeNodeCache(c);return _context38.abrupt("break",42);case 42:case"end":return _context38.stop();}},_callee36,this);}));function consumeDrawAll(_x45,_x46){return _consumeDrawAll.apply(this,arguments);}return consumeDrawAll;}()},{key:"workShapesDone",value:function(){var _workShapesDone=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(t,e){var _iterator50,_step50,n;return _regeneratorRuntime().wrap(function _callee37$(_context39){while(1)switch(_context39.prev=_context39.next){case 0:_iterator50=_createForOfIteratorHelper(this.workShapes.keys());_context39.prev=1;_iterator50.s();case 3:if((_step50=_iterator50.n()).done){_context39.next=9;break;}n=_step50.value;_context39.next=7;return this.consumeDrawAll({workId:n,scenePath:t,viewId:this.viewId,msgType:at.DrawWork,dataType:Mt.Local},e);case 7:_context39.next=3;break;case 9:_context39.next=14;break;case 11:_context39.prev=11;_context39.t0=_context39["catch"](1);_iterator50.e(_context39.t0);case 14:_context39.prev=14;_iterator50.f();return _context39.finish(14);case 17:case"end":return _context39.stop();}},_callee37,this,[[1,11,14,17]]);}));function workShapesDone(_x47,_x48){return _workShapesDone.apply(this,arguments);}return workShapesDone;}()},{key:"consumeFull",value:function(){var _consumeFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(t){var i,a,e,n,o,s,l,d,c,p,y;return _regeneratorRuntime().wrap(function _callee38$(_context40){while(1)switch(_context40.prev=_context40.next){case 0:e=this.setFullWork(t),n=t.ops&&Me(t.ops)||t.op;if(!e){_context40.next=26;break;}o=(i=t.workId)==null?void 0:i.toString();if(o){_context40.next=5;break;}return _context40.abrupt("return");case 5:s=(a=this.vNodes.get(o))==null?void 0:a.rect;if(!(e.toolsType===ut.Image)){_context40.next=13;break;}_context40.next=9;return e.consumeServiceAsync({isFullWork:!0,replaceId:o,worker:this});case 9:l=_context40.sent;d=(t==null?void 0:t.updateNodeOpt)&&e.updataOptService(t.updateNodeOpt);_context40.next=20;break;case 13:if(!(e.toolsType===ut.Text)){_context40.next=19;break;}_context40.next=16;return e.consumeServiceAsync({isFullWork:!0,replaceId:o});case 16:l=_context40.sent;_context40.next=20;break;case 19:l=e.consumeService({op:n,isFullWork:!0,replaceId:o}),d=(t==null?void 0:t.updateNodeOpt)&&e.updataOptService(t.updateNodeOpt);case 20:l=Pt(l,d);c=[],p=[];if(!(t.workId&&this.workShapes["delete"](t.workId.toString()),l&&t.willRefresh&&(s&&c.push({rect:wt(s),isClear:!0,clearCanvas:St.Bg,viewId:this.viewId}),c.push({rect:wt(l),drawCanvas:St.Bg,viewId:this.viewId})),t.willSyncService&&p.push({opt:t.opt,toolsType:t.toolsType,type:at.FullWork,workId:t.workId,ops:t.ops,updateNodeOpt:t.updateNodeOpt,viewId:this.viewId}),c.length||p.length)){_context40.next=26;break;}y={render:c,sp:p};_context40.next=26;return this._post(y);case 26:case"end":return _context40.stop();}},_callee38,this);}));function consumeFull(_x49){return _consumeFull.apply(this,arguments);}return consumeFull;}()},{key:"commandDeleteText",value:function commandDeleteText(t){var e=this.vNodes.get(t);if(e&&e.toolsType===ut.Text)return{type:at.TextUpdate,toolsType:ut.Text,workId:t,dataType:Mt.Local};}},{key:"removeSelector",value:function(){var _removeSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(t,e){var n,i,a,o,s,l,_iterator51,_step51,d,y,p;return _regeneratorRuntime().wrap(function _callee39$(_context41){while(1)switch(_context41.prev=_context41.next){case 0:n=t.willSyncService,i=[],a=[],o=[],s=this.workShapes.get(Nt);if(s){_context41.next=3;break;}return _context41.abrupt("return");case 3:l=s.selectIds&&_toConsumableArray(s.selectIds)||[];_iterator51=_createForOfIteratorHelper(l);try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){d=_step51.value;if(this.vNodes.get(d)){y=this.commandDeleteText(d);y&&i.push(y);}p=this._removeWork(d);p.length&&a.push.apply(a,_toConsumableArray(p)),e==null||e.deleteCachedImagesByWorkId(d),o.push(d);}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}o.length&&i.push({type:at.RemoveNode,removeIds:o});i.push({type:at.Select,selectIds:[],willSyncService:n});_context41.next=10;return this.blurSelector();case 10:_context41.t0=a.length||i.length;if(!_context41.t0){_context41.next=14;break;}_context41.next=14;return this._post({render:a,sp:i});case 14:case"end":return _context41.stop();}},_callee39,this);}));function removeSelector(_x50,_x51){return _removeSelector.apply(this,arguments);}return removeSelector;}()},{key:"removeWork",value:function(){var _removeWork2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(t){var e,n,i;return _regeneratorRuntime().wrap(function _callee40$(_context42){while(1)switch(_context42.prev=_context42.next){case 0:e=t.workId,n=e==null?void 0:e.toString();if(!n){_context42.next=7;break;}i=this._removeWork(n);_context42.t0=i.length;if(!_context42.t0){_context42.next=7;break;}_context42.next=7;return this._post({render:i});case 7:case"end":return _context42.stop();}},_callee40,this);}));function removeWork(_x52){return _removeWork2.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(t){var i,a,o;var e=this.vNodes.get(t);e&&((i=this.fullLayer)==null||i.getElementsByName(t).forEach(function(s){s.remove();}),this.vNodes["delete"](t));var n=this.drawLayer&&vt.getRectFromLayer(this.drawLayer,t);if(n){var s=(a=this.drawLayer)==null?void 0:a.getElementsByName(t)[0];(o=this.drawLayer)==null||o.removeChild(s);}return this.getWorkShape(t)&&this.clearWorkShapeNodeCache(t),{fullRect:e==null?void 0:e.rect,drawRect:n};}},{key:"_removeWork",value:function _removeWork(t){var _this$removeNode=this.removeNode(t),e=_this$removeNode.fullRect,n=_this$removeNode.drawRect,i=[];return e&&i.push({rect:wt(e),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(e),drawCanvas:St.Bg,viewId:this.viewId}),n&&i.push({rect:wt(n),clearCanvas:St.Float,isClear:!0,viewId:this.viewId},{rect:wt(n),drawCanvas:St.Float,viewId:this.viewId}),i;}},{key:"checkTextActive",value:function(){var _checkTextActive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(t){var e,n,i,a,o,s,l,_iterator52,_step52,d,c,p,y,P;return _regeneratorRuntime().wrap(function _callee41$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:e=t.op,n=t.viewId,i=t.dataType;if(!(e!=null&&e.length)){_context43.next=32;break;}s=e[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],l=e[1]*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1];_iterator52=_createForOfIteratorHelper(this.vNodes.curNodeMap.values());_context43.prev=4;_iterator52.s();case 6:if((_step52=_iterator52.n()).done){_context43.next=14;break;}d=_step52.value;c=d.rect,p=d.name,y=d.toolsType,P=d.opt;if(!(y===ut.Text&&P.workState===It.Done&&Y0([s,l],c))){_context43.next=12;break;}a=p,o=this.setFullWork({workId:p,toolsType:y,opt:P});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);_iterator52.e(_context43.t0);case 19:_context43.prev=19;_iterator52.f();return _context43.finish(19);case 22:_context43.t1=a;if(!_context43.t1){_context43.next=32;break;}_context43.t2=o;if(!_context43.t2){_context43.next=28;break;}_context43.next=28;return o.consumeServiceAsync({isFullWork:!0,replaceId:o.getWorkId(),isDrawLabel:!1});case 28:_context43.next=30;return this.blurSelector({viewId:n,msgType:at.Select,dataType:i,isSync:!0});case 30:_context43.next=32;return this._post({sp:[{type:at.GetTextActive,toolsType:ut.Text,workId:a}]});case 32:case"end":return _context43.stop();}},_callee41,this,[[4,16,19,22]]);}));function checkTextActive(_x53){return _checkTextActive.apply(this,arguments);}return checkTextActive;}()},{key:"colloctEffectSelectWork",value:function(){var _colloctEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(t){var _this92=this;var e,n,i;return _regeneratorRuntime().wrap(function _callee42$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:e=this.workShapes.get(Nt),n=t.workId,i=t.msgType;if(!(e&&n&&e.selectIds&&e.selectIds.includes(n.toString()))){_context44.next=6;break;}i===at.RemoveNode?e.selectIds=e.selectIds.filter(function(a){return a!==n.toString();}):this.effectSelectNodeData.add(t);_context44.next=5;return this.runEffectSelectWork(!0).then(function(){var a;(a=_this92.effectSelectNodeData)==null||a.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(_x54){return _colloctEffectSelectWork.apply(this,arguments);}return colloctEffectSelectWork;}()},{key:"updateSelector",value:function(){var _updateSelector2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(t){var _this93=this;var P,e,n,i,a,o,s,l,d,c,p,y;return _regeneratorRuntime().wrap(function _callee43$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:e=this.workShapes.get(Nt);if((P=e==null?void 0:e.selectIds)!=null&&P.length){_context45.next=3;break;}return _context45.abrupt("return");case 3:n=t.callback;i=_objectWithoutProperties(t,_excluded2);a=i.updateSelectorOpt;o=i.willSerializeData;_context45.next=9;return e==null?void 0:e.updateSelector({updateSelectorOpt:a,selectIds:Xt(e.selectIds),vNodes:this.vNodes,willSerializeData:o,worker:this});case 9:s=_context45.sent;l=/* @__PURE__ */new Map();s!=null&&s.selectIds&&(d=gm(e.selectIds,s.selectIds),s.selectIds.forEach(function(x){var v=_this93.vNodes.get(x);if(v){var _T41=v.toolsType,_f35=v.op,g=v.opt;l.set(x,{opt:g,toolsType:_T41,ops:(_f35==null?void 0:_f35.length)&&Zt(_f35)||void 0});}}),e.selectIds=s.selectIds);c=[],p=[];s!=null&&s.rect&&c.push({rect:wt(s.rect),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(s.rect),drawCanvas:St.Bg,viewId:this.viewId});y=n&&n({res:s,workShapeNode:e,param:i,postData:{render:c,sp:p},newServiceStore:l})||{render:c,sp:p};d&&y.sp.push({type:at.RemoveNode,removeIds:d,viewId:this.viewId});_context45.t0=y.render.length||y.sp.length;if(!_context45.t0){_context45.next=20;break;}_context45.next=20;return this._post(y);case 20:case"end":return _context45.stop();}},_callee43,this);}));function updateSelector(_x55){return _updateSelector2.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function(){var _blurSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(t){var i,e,n,a;return _regeneratorRuntime().wrap(function _callee44$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:e=this.workShapes.get(Nt),n=e==null?void 0:e.blurSelector();if(!(this.clearWorkShapeNodeCache(Nt),((i=this.fullLayer)==null?void 0:i.parent).children.forEach(function(a){a.name===Nt&&a.remove();}),n)){_context46.next=6;break;}a=[];a.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:wt(n.rect),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(n.rect),drawCanvas:St.Bg,viewId:this.viewId}],sp:a});case 6:case"end":return _context46.stop();}},_callee44,this);}));function blurSelector(_x56){return _blurSelector.apply(this,arguments);}return blurSelector;}()},{key:"hasSelector",value:function hasSelector(){return this.workShapes.has(Nt);}},{key:"getSelector",value:function getSelector(){return this.workShapes.get(Nt);}},{key:"reRenderSelector",value:function(){var _reRenderSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(){var t,a,e,n,i,o,_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;e=this.workShapes.get(Nt);if(e){_context47.next=4;break;}return _context47.abrupt("return");case 4:if(!(e&&!((a=e.selectIds)!=null&&a.length))){_context47.next=8;break;}_context47.next=7;return this.blurSelector();case 7:return _context47.abrupt("return");case 8:n=e.oldSelectRect,i=e.reRenderSelector();if(!i){_context47.next=13;break;}o=Pt(n,i)||i;_context47.next=13;return this._post({render:[{rect:wt(o),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(o),drawCanvas:St.Bg,viewId:this.viewId}],sp:[{type:at.Select,selectIds:e.selectIds,selectRect:i,willSyncService:t,viewId:this.viewId,points:e.getChildrenPoints(),textOpt:e.textOpt,selectorColor:e.selectorColor,strokeColor:e.strokeColor,fillColor:e.fillColor,canTextEdit:e.canTextEdit,canRotate:e.canRotate,scaleType:e.scaleType,opt:e.getWorkOptions()||void 0,canLock:e.canLock,isLocked:e.isLocked,toolsTypes:e.toolsTypes,shapeOpt:e.shapeOpt,thickness:e.thickness,useStroke:e.useStroke,strokeType:e.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 i,a,o,s,l,d,c,e,n,_e$updateSelectIds,p,y,P;return _regeneratorRuntime().wrap(function _callee46$(_context48){while(1)switch(_context48.prev=_context48.next){case 0:e=this.workShapes.get(Nt),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(e){_context48.next=10;break;}!this.setFullWork(t)&&t.workId&&((i=this.tmpOpt)==null?void 0:i.toolsType)===ut.Selector&&this.createWorkShape(t.workId.toString());_context48.next=9;return this.updateFullSelectWork(t);case 9:return _context48.abrupt("return");case 10:if(!(e&&n!=null&&n.length)){_context48.next=16;break;}_e$updateSelectIds=e.updateSelectIds(n),p=_e$updateSelectIds.bgRect,y=_e$updateSelectIds.selectRect,P={render:[],sp:[]};p&&((a=P.render)==null||a.push({rect:wt(p),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(p),drawCanvas:St.Bg,viewId:this.viewId}));(c=P.sp)==null||c.push(_objectSpread(_objectSpread({},t),{},{selectorColor:((o=t.opt)==null?void 0:o.strokeColor)||e.selectorColor,strokeColor:((s=t.opt)==null?void 0:s.strokeColor)||e.strokeColor,fillColor:((l=t.opt)==null?void 0:l.fillColor)||e.fillColor,textOpt:((d=t.opt)==null?void 0:d.textOpt)||e.textOpt,canTextEdit:e.canTextEdit,canRotate:e.canRotate,scaleType:e.scaleType,type:at.Select,selectRect:y,points:e.getChildrenPoints(),willSyncService:(t==null?void 0:t.willSyncService)||!1,opt:(t==null?void 0:t.willSyncService)&&e.getWorkOptions()||void 0,canLock:e.canLock,isLocked:e.isLocked,toolsTypes:e.toolsTypes,shapeOpt:e.shapeOpt,thickness:e.thickness,useStroke:e.useStroke,strokeType:e.strokeType}));_context48.next=16;return this._post(P);case 16:case"end":return _context48.stop();}},_callee46,this);}));function updateFullSelectWork(_x57){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(pm,"destroy",this,3)([]),this.effectSelectNodeData.clear(),this.batchEraserWorks.clear(),this.batchEraserRemoveNodes.clear();}},{key:"drawBitMapEraser",value:function(){var _drawBitMapEraser=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(t){var e,n,i;return _regeneratorRuntime().wrap(function _callee47$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:e=[];t.op&&e.push(t);n=[];if(t.rect){i=wt(t.rect);n.push({rect:i,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:i,drawCanvas:St.Bg,viewId:this.viewId});}_context49.t0=e.length||n.length;if(!_context49.t0){_context49.next=8;break;}_context49.next=8;return this._post({sp:e,render:n});case 8:case"end":return _context49.stop();}},_callee47,this);}));function drawBitMapEraser(_x58){return _drawBitMapEraser.apply(this,arguments);}return drawBitMapEraser;}()},{key:"drawBitMapEraserFull",value:function(){var _drawBitMapEraserFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(t,e,n){var i,a,o,s,l,d,c,y,_iterator53,_step53,_step53$value,P,x,p,_y13;return _regeneratorRuntime().wrap(function _callee48$(_context50){while(1)switch(_context50.prev=_context50.next){case 0:i=e.rect,a=e.willUpdateNodes,o=e.scenePath,s=_objectWithoutProperties(e,_excluded3);l=i;d=t.getWorkId(),c=[_objectSpread(_objectSpread({},s),{},{workId:d,scenePath:o,updateNodeOpt:{useAnimation:!1},isSync:!0,nextTasks:[{type:at.RemoveNode,removeIds:[d],viewId:this.viewId}]})];if(!(n&&c.push({type:at.None,isLockSentEventCursor:n}),a!=null&&a.size)){_context50.next=10;break;}_context50.next=6;return t==null?void 0:t.reRenderEffectNodes({willUpdateNodes:a,worker:this});case 6:y=_context50.sent;l=Pt(l,y);_iterator53=_createForOfIteratorHelper(a);try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){_step53$value=_slicedToArray(_step53.value,2),P=_step53$value[0],x=_step53$value[1];c.push({type:at.UpdateNode,dataType:Mt.Local,opt:x.opt,workId:P,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}case 10:p=[];if(l){_y13=wt(l);p.push({rect:_y13,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:_y13,drawCanvas:St.Bg,viewId:this.viewId});}_context50.t0=c.length||p.length;if(!_context50.t0){_context50.next=16;break;}_context50.next=16;return this._post({sp:c,render:p});case 16:case"end":return _context50.stop();}},_callee48,this);}));function drawBitMapEraserFull(_x59,_x60,_x61){return _drawBitMapEraserFull.apply(this,arguments);}return drawBitMapEraserFull;}()},{key:"drawPencilCombine",value:function(){var _drawPencilCombine=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(t,e){var i,a,o,n,s,l;return _regeneratorRuntime().wrap(function _callee49$(_context51){while(1)switch(_context51.prev=_context51.next){case 0:n=(i=this.workShapes.get(t))==null?void 0:i.combineConsume();if(!n){_context51.next=6;break;}s={render:[],drawCount:e};if(n!=null&&n.rect){l=wt(n.rect);(a=s.render)==null||a.push({rect:l,isClear:!0,clearCanvas:St.Float,viewId:this.viewId}),(o=s.render)==null||o.push({rect:l,drawCanvas:St.Float,viewId:this.viewId});}_context51.next=6;return this._post(s);case 6:case"end":return _context51.stop();}},_callee49,this);}));function drawPencilCombine(_x62,_x63){return _drawPencilCombine.apply(this,arguments);}return drawPencilCombine;}()},{key:"drawSelector",value:function(){var _drawSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(t){var n,e;return _regeneratorRuntime().wrap(function _callee50$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:e={render:[],sp:[t]};t.rect&&((n=e.render)==null||n.push({rect:wt(t.rect),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(t.rect),drawCanvas:St.Bg,viewId:this.viewId}));_context52.next=4;return this._post(e);case 4:case"end":return _context52.stop();}},_callee50,this);}));function drawSelector(_x64){return _drawSelector.apply(this,arguments);}return drawSelector;}()},{key:"drawPencilEraser",value:function(){var _drawPencilEraser=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(t,e){var _this94=this;var i,a,n,_iterator54,_step54,o,s;return _regeneratorRuntime().wrap(function _callee51$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:n=[];if((i=t.newWorkDatas)!=null&&i.size){_iterator54=_createForOfIteratorHelper(t.newWorkDatas.values());try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){o=_step54.value;s=o.workId.toString();this.batchEraserWorks.add(s),n.push({type:at.FullWork,workId:s,ops:Zt(o.op),opt:o.opt,toolsType:o.toolsType,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}delete t.newWorkDatas;}(a=t.removeIds)==null||a.forEach(function(o){_this94.batchEraserRemoveNodes.add(o);});e&&n.push({type:at.None,isLockSentEventCursor:e});t.rect&&n.push(t);_context53.next=7;return this._post({sp:n});case 7:this.batchEraserCombine();case 8:case"end":return _context53.stop();}},_callee51,this);}));function drawPencilEraser(_x65,_x66){return _drawPencilEraser.apply(this,arguments);}return drawPencilEraser;}()},{key:"drawEraser",value:function(){var _drawEraser=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(t,e){var n,i;return _regeneratorRuntime().wrap(function _callee52$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:n=[],i=[];e&&n.push({type:at.None,isLockSentEventCursor:e});t.removeIds&&n.push(t);t.rect&&i.push({rect:t.rect,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:t.rect,drawCanvas:St.Bg,viewId:this.viewId});_context54.next=6;return this._post({sp:n,render:i});case 6:case"end":return _context54.stop();}},_callee52,this);}));function drawEraser(_x67,_x68){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({drawCount:this.drawCount,sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context55.stop();}},_callee53,this);}));function drawShape(_x69){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(_x70){return _drawPencil.apply(this,arguments);}return drawPencil;}()},{key:"drawPencilFull",value:function(){var _drawPencilFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(t,e){var i,a,n;return _regeneratorRuntime().wrap(function _callee55$(_context57){while(1)switch(_context57.prev=_context57.next){case 0:n={drawCount:1/0,render:[],sp:[t]};e&&((i=n.sp)==null||i.push({type:at.None,isLockSentEventCursor:e}));(a=n.render)==null||a.push({isClearAll:!0,clearCanvas:St.Float,viewId:this.viewId},{rect:t.rect,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:t.rect,drawCanvas:St.Bg,viewId:this.viewId});_context57.next=5;return this._post(n);case 5:case"end":return _context57.stop();}},_callee55,this);}));function drawPencilFull(_x71,_x72){return _drawPencilFull.apply(this,arguments);}return drawPencilFull;}()},{key:"updateBatchEraserCombineNode",value:function updateBatchEraserCombineNode(t,e){var _this95=this;var n=[];var i;var _iterator55=_createForOfIteratorHelper(e.keys()),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var a=_step55.value;this.fullLayer.getElementsByName(a).forEach(function(o){var s=o.getBoundingClientRect();i=Pt(i,{x:s.x-se.SafeBorderPadding,y:s.y-se.SafeBorderPadding,w:s.width+se.SafeBorderPadding*2,h:s.height+se.SafeBorderPadding*2}),o.remove();});}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}return t.forEach(function(a){var o=_this95.vNodes.get(a);if(o)if(_this95.fullLayer.getElementsByName(a)[0])i=Pt(i,o.rect);else{var l=_this95.setFullWork(_objectSpread(_objectSpread({},o),{},{workId:a})),d=l&&l.consumeService({op:o.op,isFullWork:!0});d&&(o.rect=d,i=Pt(i,d));}}),i&&n.push({rect:i,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:i,drawCanvas:St.Bg,viewId:this.viewId}),n;}},{key:"runEffectSelectWork",value:function(){var _runEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(t){var e,_iterator56,_step56,n,i,a,o;return _regeneratorRuntime().wrap(function _callee56$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:_iterator56=_createForOfIteratorHelper(this.effectSelectNodeData.values());_context58.prev=1;_iterator56.s();case 3:if((_step56=_iterator56.n()).done){_context58.next=23;break;}n=_step56.value;i=this.setFullWork(n);if(!i){_context58.next=21;break;}a=(e=i.getWorkId())==null?void 0:e.toString();if(!(i.toolsType===ut.Image)){_context58.next=13;break;}_context58.next=11;return i.consumeServiceAsync({isFullWork:!0,replaceId:a,worker:this});case 11:_context58.next=20;break;case 13:if(!(i.toolsType===ut.Text)){_context58.next=18;break;}_context58.next=16;return i.consumeServiceAsync({isFullWork:!0,replaceId:a});case 16:_context58.next=20;break;case 18:o=n.ops&&Me(n.ops);i.consumeService({op:o,isFullWork:!0,replaceId:a}),n!=null&&n.updateNodeOpt&&i.updataOptService(n.updateNodeOpt);case 20:n.workId&&this.workShapes["delete"](n.workId.toString());case 21:_context58.next=3;break;case 23:_context58.next=28;break;case 25:_context58.prev=25;_context58.t0=_context58["catch"](1);_iterator56.e(_context58.t0);case 28:_context58.prev=28;_iterator56.f();return _context58.finish(28);case 31:_context58.next=33;return this.reRenderSelector(t);case 33:case"end":return _context58.stop();}},_callee56,this,[[1,25,28,31]]);}));function runEffectSelectWork(_x73){return _runEffectSelectWork.apply(this,arguments);}return runEffectSelectWork;}()},{key:"cursorHover",value:function(){var _cursorHover=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(t){var o,e,n,i,a,s,l;return _regeneratorRuntime().wrap(function _callee57$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:e=t.opt,n=t.toolsType,i=t.point,a=this.setFullWork({workId:be,toolsType:n,opt:e});if(!(a&&i)){_context59.next=8;break;}s=a.cursorHover(i),l={render:[]};_context59.t0=s&&s.type===at.CursorHover&&s.rect;if(!_context59.t0){_context59.next=8;break;}(o=l.render)==null||o.push({rect:wt(s.rect),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(s.rect),drawCanvas:St.Bg,viewId:this.viewId});_context59.next=8;return this._post(l);case 8:case"end":return _context59.stop();}},_callee57,this);}));function cursorHover(_x74){return _cursorHover.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(){var n,t,e;return _regeneratorRuntime().wrap(function _callee58$(_context60){while(1)switch(_context60.prev=_context60.next){case 0:t=this.getWorkShape(be);_context60.t0=t&&(n=t.selectIds)!=null&&n.length;if(!_context60.t0){_context60.next=10;break;}e=t.oldSelectRect;t.cursorBlur();this.clearWorkShapeNodeCache(be);_context60.t1=e;if(!_context60.t1){_context60.next=10;break;}_context60.next=10;return this._post({render:[{rect:wt(e),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(e),drawCanvas:St.Bg,viewId:this.viewId}]});case 10:this.fullLayer.parent.children.forEach(function(i){i.name==="Cursor_Hover_Id"&&i.remove();});case 11:case"end":return _context60.stop();}},_callee58,this);}));function cursorBlur(){return _cursorBlur.apply(this,arguments);}return cursorBlur;}()}]);}(Ri);var mm=/*#__PURE__*/function(){function mm(r){_classCallCheck(this,mm);et(this,"viewId");et(this,"vNodes");et(this,"fullLayer");et(this,"drawLayer");et(this,"workShapes",/* @__PURE__ */new Map());et(this,"selectorWorkShapes",/* @__PURE__ */new Map());et(this,"thread");et(this,"animationId");et(this,"willRunEffectSelectorIds",/* @__PURE__ */new Set());et(this,"runEffectId");et(this,"noAnimationRect");et(this,"syncUnitTime",re.syncOpt.interval);et(this,"post");this.viewId=r.viewId,this.vNodes=r.vNodes,this.fullLayer=r.fullLayer,this.drawLayer=r.drawLayer,this.thread=r.thread,this.post=r.thread.post.bind(r.thread);}return _createClass(mm,[{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 _callee59(r){return _regeneratorRuntime().wrap(function _callee59$(_context61){while(1)switch(_context61.prev=_context61.next){case 0:this.activeWorkShape(r),this.runAnimation();case 1:case"end":return _context61.stop();}},_callee59,this);}));function consumeDraw(_x75){return _consumeDraw2.apply(this,arguments);}return consumeDraw;}()},{key:"consumeFull",value:function consumeFull(r){this.activeWorkShape(r),this.runAnimation();}},{key:"runSelectWork",value:function runSelectWork(r){this.activeSelectorShape(r);var t=r.workId,e=t==null?void 0:t.toString();e&&this.willRunEffectSelectorIds.add(e),this.runEffect();}},{key:"setNodeKey",value:function setNodeKey(r,t,e,n){return t.toolsType=e,t.node=Fr({workId:r,toolsType:e,toolsOpt:n,vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer},this),t;}},{key:"runReverseSelectWork",value:function runReverseSelectWork(r){var _this96=this;r.forEach(function(t){_this96.selectorWorkShapes.forEach(function(e,n){var i;if((i=e.selectIds)!=null&&i.length){var a=e.selectIds.indexOf(t);a>-1&&(e.selectIds.splice(a,1),_this96.willRunEffectSelectorIds.add(n));}});}),this.willRunEffectSelectorIds.size&&this.runEffect();}},{key:"removeWork",value:function(){var _removeWork3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(r){var t,e,n;return _regeneratorRuntime().wrap(function _callee60$(_context62){while(1)switch(_context62.prev=_context62.next){case 0:t=r.workId,e=t==null?void 0:t.toString();if(!e){_context62.next=10;break;}n=this.workShapes.get(e);if(!n){_context62.next=8;break;}this.workShapes["delete"](e);_context62.next=7;return this.removeNode(e,r,n==null?void 0:n.totalRect,!1);case 7:return _context62.abrupt("return");case 8:_context62.next=10;return this.removeNode(e,r);case 10:case"end":return _context62.stop();}},_callee60,this);}));function removeWork(_x76){return _removeWork3.apply(this,arguments);}return removeWork;}()},{key:"removeSelectWork",value:function removeSelectWork(r){var t=r.workId,e=t==null?void 0:t.toString();e&&(this.activeSelectorShape(r),this.willRunEffectSelectorIds.add(e)),this.runEffect();}},{key:"removeNode",value:function(){var _removeNode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(r,t,e){var n,o,i,a,_args63=arguments;return _regeneratorRuntime().wrap(function _callee61$(_context63){while(1)switch(_context63.prev=_context63.next){case 0:n=_args63.length>3&&_args63[3]!==undefined?_args63[3]:!0;r.indexOf(Nt)>-1&&this.removeSelectWork(t);i=e;a=(o=this.vNodes.get(r))==null?void 0:o.rect;a&&(i=Pt(a,i));this.fullLayer.getElementsByName(r).forEach(function(s){s.remove();});this.drawLayer.getElementsByName(r).forEach(function(s){s.remove();});this.vNodes["delete"](r);_context63.t0=i;if(!_context63.t0){_context63.next=12;break;}_context63.next=12;return this.post({render:[{rect:wt(i),isClear:!0,clearCanvas:n?St.Bg:St.ServiceFloat,workerType:n?void 0:Mt.Service,viewId:this.viewId},{rect:wt(i),drawCanvas:n?St.Bg:St.ServiceFloat,workerType:n?void 0:Mt.Service,viewId:this.viewId}]});case 12:case"end":return _context63.stop();}},_callee61,this);}));function removeNode(_x77,_x78,_x79){return _removeNode.apply(this,arguments);}return removeNode;}()},{key:"activeWorkShape",value:function activeWorkShape(r){var y,P,x,v;var t=r.workId,e=r.opt,n=r.toolsType,i=r.type,a=r.updateNodeOpt,o=r.ops,s=r.op,l=r.useAnimation;if(!t)return;var d=t.toString(),c=(y=this.vNodes.get(d))==null?void 0:y.rect;if(!((P=this.workShapes)!=null&&P.has(d))){var _T42={toolsType:n,animationWorkData:s||[],animationIndex:0,type:i,updateNodeOpt:a,ops:o,useAnimation:_typeof(l)<"u"?l:_typeof(a==null?void 0:a.useAnimation)<"u"?a==null?void 0:a.useAnimation:!0,oldRect:c,isDiff:!1};n&&e&&(_T42=this.setNodeKey(d,_T42,n,e)),(x=this.workShapes)==null||x.set(d,_T42);}var p=(v=this.workShapes)==null?void 0:v.get(d);i&&(p.type=i),o&&(p.animationWorkData=Me(o),p.ops=o),a&&(p.updateNodeOpt=a),s&&(p.isDiff=this.hasDiffData(p.animationWorkData||[],s,p.toolsType),p.animationWorkData=s),p.node&&p.node.getWorkId()!==d&&p.node.setWorkId(d),c&&(p.oldRect=c),n&&e&&(e.syncUnitTime&&(this.syncUnitTime=e.syncUnitTime),p.toolsType!==n&&n&&e&&this.setNodeKey(d,p,n,e),p.node&&p.node.setWorkOptions(e));}},{key:"hasDiffData",value:function hasDiffData(r,t,e){var n=r.length;if(t.length<n)return!0;switch(e){case ut.Pencil:{for(var i=0;i<n;i+=3)if(t[i]!==r[i]||t[i+1]!==r[i+1])return!0;break;}case ut.LaserPen:{for(var _i10=0;_i10<n;_i10+=2)if(t[_i10]!==r[_i10]||t[_i10+1]!==r[_i10+1])return!0;break;}}return!1;}},{key:"animationDraw",value:function(){var _animationDraw=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(){var _this97=this;var n,i,a,o,s,l,d,c,p,y,P,x,v,T,f,g,u,m,M,E,A,b,O,L,w,I,R,W,z,K,k,q,U,G,Z,nt,r,t,e,_iterator57,_step57,_loop6;return _regeneratorRuntime().wrap(function _callee62$(_context65){while(1)switch(_context65.prev=_context65.next){case 0:this.animationId=void 0;r=!1;t={render:[]},e=/* @__PURE__ */new Map();_iterator57=_createForOfIteratorHelper(this.workShapes.entries());_context65.prev=4;_loop6=/*#__PURE__*/_regeneratorRuntime().mark(function _loop6(){var _step57$value,rt,tt,J,ht,_J4,_ht3,_J5,_ht4,dt,B,_J6,_ht5,_J7,_ht6,_dt2,_B,F,Y,X,_Y,_J8,_ht7,_dt3,_B2,_F,_Y2;return _regeneratorRuntime().wrap(function _loop6$(_context64){while(1)switch(_context64.prev=_context64.next){case 0:_step57$value=_slicedToArray(_step57.value,2),rt=_step57$value[0],tt=_step57$value[1];_context64.t0=tt.toolsType;_context64.next=_context64.t0===ut.Image?4:_context64.t0===ut.Text?11:_context64.t0===ut.Arrow?19:_context64.t0===ut.Straight?19:_context64.t0===ut.Rectangle?19:_context64.t0===ut.Ellipse?19:_context64.t0===ut.Star?19:_context64.t0===ut.Polygon?19:_context64.t0===ut.SpeechBalloon?19:_context64.t0===ut.Pencil?22:_context64.t0===ut.BitMapEraser?37:_context64.t0===ut.PencilEraser?37:50;break;case 4:J=tt.oldRect;J&&((n=t.render)==null||n.push({rect:J,isClear:!0,clearCanvas:St.Bg,viewId:_this97.viewId}),(i=t.render)==null||i.push({rect:J,drawCanvas:St.Bg,viewId:_this97.viewId}));_context64.next=8;return(a=tt.node)==null?void 0:a.consumeServiceAsync({isFullWork:!0,worker:_this97.thread});case 8:ht=_context64.sent;_this97.selectorWorkShapes.forEach(function(dt,B){var F;(F=dt.selectIds)!=null&&F.includes(rt)&&(_this97.willRunEffectSelectorIds.add(B),_this97.noAnimationRect=Pt(_this97.noAnimationRect,J),_this97.noAnimationRect=Pt(_this97.noAnimationRect,ht),_this97.runEffect());}),_this97.workShapes["delete"](rt),(o=t.render)==null||o.push({rect:ht,drawCanvas:St.Bg,viewId:_this97.viewId});return _context64.abrupt("break",50);case 11:if(!tt.node){_context64.next=18;break;}_J4=tt.oldRect;_J4&&((s=t.render)==null||s.push({rect:_J4,isClear:!0,clearCanvas:St.Bg,viewId:_this97.viewId}),(l=t.render)==null||l.push({rect:_J4,drawCanvas:St.Bg,viewId:_this97.viewId}));_context64.next=16;return tt.node.consumeServiceAsync({isFullWork:!0,replaceId:rt});case 16:_ht3=_context64.sent;_this97.selectorWorkShapes.forEach(function(dt,B){var F;(F=dt.selectIds)!=null&&F.includes(rt)&&(_this97.willRunEffectSelectorIds.add(B),_this97.noAnimationRect=Pt(_this97.noAnimationRect,_J4),_this97.noAnimationRect=Pt(_this97.noAnimationRect,_ht3),_this97.runEffect());}),(d=tt.node)==null||d.clearTmpPoints(),_this97.workShapes["delete"](rt),(c=t.render)==null||c.push({rect:_ht3,drawCanvas:St.Bg,viewId:_this97.viewId});case 18:return _context64.abrupt("break",50);case 19:_J5=!!tt.ops;if((p=tt.animationWorkData)!=null&&p.length){_ht4=tt.oldRect,dt=tt.node.oldRect;_ht4&&((y=t.render)==null||y.push({rect:_ht4,isClear:!0,clearCanvas:St.Bg,viewId:_this97.viewId}),(P=t.render)==null||P.push({rect:_ht4,drawCanvas:St.Bg,viewId:_this97.viewId})),dt&&((x=t.render)==null||x.push({rect:dt,isClear:!0,clearCanvas:St.ServiceFloat,viewId:_this97.viewId}));B=(v=tt.node)==null?void 0:v.consumeService({op:tt.animationWorkData,isFullWork:_J5});e.set(rt,{workState:_ht4?tt.ops?It.Done:It.Doing:It.Start,op:tt.animationWorkData.filter(function(F,Y){if(Y%3!==2)return!0;}).slice(-2)}),_J5?(_this97.selectorWorkShapes.forEach(function(F,Y){var X;(X=F.selectIds)!=null&&X.includes(rt)&&(_this97.willRunEffectSelectorIds.add(Y),_this97.noAnimationRect=Pt(_this97.noAnimationRect,_ht4),_this97.noAnimationRect=Pt(_this97.noAnimationRect,dt),_this97.noAnimationRect=Pt(_this97.noAnimationRect,B),_this97.runEffect());}),(T=tt.node)==null||T.clearTmpPoints(),_this97.workShapes["delete"](rt),(f=t.render)==null||f.push({rect:B,drawCanvas:St.Bg,viewId:_this97.viewId})):(g=t.render)==null||g.push({rect:B,drawCanvas:St.ServiceFloat,workerType:_J5?void 0:Mt.Service,viewId:_this97.viewId}),tt.animationWorkData.length=0;}return _context64.abrupt("break",50);case 22:if(!(!tt.useAnimation&&tt.ops)){_context64.next=28;break;}_J6=(u=tt.node)==null?void 0:u.consumeService({op:tt.animationWorkData||[],isFullWork:!0,replaceId:rt});_ht5=(m=tt.node)==null?void 0:m.updataOptService(tt.updateNodeOpt);_J6=Pt(_J6,_ht5),(M=t.render)==null||M.push({isClear:!0,rect:Pt(tt.oldRect,_J6),clearCanvas:St.Bg,viewId:_this97.viewId}),(E=t.render)==null||E.push({rect:Pt(tt.oldRect,_J6),drawCanvas:St.Bg,viewId:_this97.viewId}),_this97.selectorWorkShapes.forEach(function(dt,B){var F;(F=dt.selectIds)!=null&&F.includes(rt)&&(_this97.willRunEffectSelectorIds.add(B),_this97.noAnimationRect=Pt(_this97.noAnimationRect,_J6),_this97.runEffect());}),(A=tt.node)==null||A.clearTmpPoints(),_this97.workShapes["delete"](rt);_context64.next=36;break;case 28:if(!tt.useAnimation){_context64.next=36;break;}if(!tt.isDel){_context64.next=32;break;}(b=tt.node)==null||b.clearTmpPoints(),_this97.workShapes["delete"](rt);return _context64.abrupt("break",50);case 32:_J7=3,_ht6=_this97.computNextAnimationIndex(tt,_J7),_dt2=tt.isDiff?0:Math.max(0,(tt.animationIndex||0)-_J7),_B=(tt.animationWorkData||[]).slice(_dt2,_ht6),F=(L=(O=tt.node)==null?void 0:O.getWorkId())==null?void 0:L.toString();if((tt.animationIndex||0)<_ht6||tt.isDiff){Y=(w=tt.node)==null?void 0:w.consumeService({op:_B,isFullWork:!1});if((I=t.render)==null||I.push({rect:Y,drawCanvas:St.ServiceFloat,viewId:_this97.viewId}),tt.animationIndex=_ht6,tt.isDiff&&(tt.isDiff=!1),_B.length){X=_B.filter(function(N,$){if($%_J7!==_J7-1)return!0;}).slice(-2);e.set(rt,{workState:_dt2===0?It.Start:_ht6===((R=tt.animationWorkData)==null?void 0:R.length)?It.Done:It.Doing,op:X});}}else if(tt.ops){_Y=(W=tt.node)==null?void 0:W.consumeService({op:tt.animationWorkData||[],isFullWork:!0,replaceId:F});tt.isDel=!0,(z=t.render)==null||z.push({isClear:!0,rect:_Y,clearCanvas:St.ServiceFloat,viewId:_this97.viewId},{rect:_Y,drawCanvas:St.ServiceFloat,viewId:_this97.viewId},{isClear:!0,rect:_Y,clearCanvas:St.Bg,viewId:_this97.viewId},{rect:_Y,drawCanvas:St.Bg,viewId:_this97.viewId}),e.set(rt,{workState:It.Done,op:_B.filter(function(X,N){if(N%_J7!==_J7-1)return!0;}).slice(-2)});}r=!0;return _context64.abrupt("break",50);case 36:return _context64.abrupt("break",50);case 37:if(!tt.isDel){_context64.next=40;break;}(K=tt.node)==null||K.clearTmpPoints(),_this97.workShapes["delete"](rt);return _context64.abrupt("break",50);case 40:if(!(tt.ops&&(k=tt.animationWorkData)!=null&&k.length)){_context64.next=44;break;}_J8=tt.animationWorkData.slice(-3,-1);e.set(rt,{workState:It.Done,op:_J8}),tt.isDel=!0;return _context64.abrupt("break",50);case 44:if(!tt.useAnimation){_context64.next=49;break;}_ht7=_this97.computNextAnimationIndex(tt,3),_dt3=tt.isDiff?0:Math.max(0,(tt.animationIndex||0)-3),_B2=(tt.animationWorkData||[]).slice(_dt3,_ht7);if((tt.animationIndex||0)<_ht7||tt.isDiff){_F=(q=tt.node)==null?void 0:q.consumeService({op:_B2,isFullWork:!0});if((U=t.render)==null||U.push({isClear:!0,rect:Pt(tt.oldRect,_F),clearCanvas:St.Bg,viewId:_this97.viewId}),(G=t.render)==null||G.push({rect:Pt(tt.oldRect,_F),drawCanvas:St.Bg,viewId:_this97.viewId}),tt.animationIndex=_ht7,tt.isDiff&&(tt.isDiff=!1),_B2.length){_Y2=_B2.filter(function(X,N){if(N%3!==2)return!0;}).slice(-2);e.set(rt,{workState:_dt3===0?It.Start:_ht7===((Z=tt.animationWorkData)==null?void 0:Z.length)?It.Done:It.Doing,op:_Y2});}}r=!0;return _context64.abrupt("break",50);case 49:return _context64.abrupt("break",50);case 50:case"end":return _context64.stop();}},_loop6);});_iterator57.s();case 7:if((_step57=_iterator57.n()).done){_context65.next=11;break;}return _context65.delegateYield(_loop6(),"t0",9);case 9:_context65.next=7;break;case 11:_context65.next=16;break;case 13:_context65.prev=13;_context65.t1=_context65["catch"](4);_iterator57.e(_context65.t1);case 16:_context65.prev=16;_iterator57.f();return _context65.finish(16);case 19:r&&this.runAnimation();e.size&&(t.sp=[],e.forEach(function(rt,tt){var J;(J=t.sp)==null||J.push({type:at.Cursor,uid:tt.split(De)[0],op:rt.op,workState:rt.workState,viewId:_this97.viewId});}));_context65.t2=(nt=t.render)!=null&&nt.length;if(!_context65.t2){_context65.next=25;break;}_context65.next=25;return this.post(t);case 25:case"end":return _context65.stop();}},_callee62,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(r,t){var e=Math.floor((r.animationWorkData||[]).slice(r.animationIndex).length*32/t/this.syncUnitTime)*t;return Math.min((r.animationIndex||0)+(e||t),(r.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 _callee63(){var _this99=this;var r;return _regeneratorRuntime().wrap(function _callee63$(_context66){while(1)switch(_context66.prev=_context66.next){case 0:this.runEffectId=void 0;r=this.noAnimationRect;this.willRunEffectSelectorIds.forEach(function(t){var i,a;var e=_this99.selectorWorkShapes.get(t),n=e&&e.selectIds&&((i=e.node)==null?void 0:i.selectServiceNode(t,e,!0));r=Pt(r,n),(a=e==null?void 0:e.selectIds)!=null&&a.length||_this99.selectorWorkShapes["delete"](t);});_context66.t0=r;if(!_context66.t0){_context66.next=7;break;}_context66.next=7;return this.post({render:[{rect:wt(r),isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:wt(r),drawCanvas:St.Bg,viewId:this.viewId}]});case 7:this.willRunEffectSelectorIds.clear();this.noAnimationRect=void 0;case 9:case"end":return _context66.stop();}},_callee63,this);}));function effectRunSelector(){return _effectRunSelector.apply(this,arguments);}return effectRunSelector;}()},{key:"activeSelectorShape",value:function activeSelectorShape(r){var d,c,p;var t=r.workId,e=r.opt,n=r.toolsType,i=r.type,a=r.selectIds,o=r.imageBitmap;if(!t)return;var s=t.toString();if(!((d=this.selectorWorkShapes)!=null&&d.has(s))){var y={toolsType:n,selectIds:a,type:i,opt:e,imageBitmap:o};n&&e&&(y=this.setNodeKey(s,y,n,e)),(c=this.selectorWorkShapes)==null||c.set(s,y);}var l=(p=this.selectorWorkShapes)==null?void 0:p.get(s);i&&(l.type=i),l.node&&l.node.getWorkId()!==s&&l.node.setWorkId(s),o&&(l.imageBitmap=o),l.selectIds=a||[];}}]);}();var vm=/*#__PURE__*/function(_Ri2){function vm(t){var _this100;_classCallCheck(this,vm);_this100=_callSuper(this,vm,[t]);et(_this100,"drawWorkActiveId");return _this100;}_inherits(vm,_Ri2);return _createClass(vm,[{key:"runFullWork",value:function(){var _runFullWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee64(t){var i,e,n,a,o,s;return _regeneratorRuntime().wrap(function _callee64$(_context67){while(1)switch(_context67.prev=_context67.next){case 0:e=this.setFullWork(t),n=t.ops&&Me(t.ops);if(!e){_context67.next=18;break;}s=(i=e.getWorkId())==null?void 0:i.toString();if(!(e.toolsType===ut.Image)){_context67.next=9;break;}_context67.next=6;return e.consumeServiceAsync({isFullWork:!0,worker:this.thread});case 6:a=_context67.sent;_context67.next=16;break;case 9:if(!(e.toolsType===ut.Text)){_context67.next=15;break;}_context67.next=12;return e.consumeServiceAsync({isFullWork:!0,replaceId:s,isDrawLabel:!0});case 12:a=_context67.sent;_context67.next=16;break;case 15:a=e.consumeService({op:n,isFullWork:!0,replaceId:s}),o=(t==null?void 0:t.updateNodeOpt)&&e.updataOptService(t.updateNodeOpt);case 16:t.workId&&this.workShapes["delete"](t.workId.toString());return _context67.abrupt("return",Pt(a,o));case 18:case"end":return _context67.stop();}},_callee64,this);}));function runFullWork(_x80){return _runFullWork.apply(this,arguments);}return runFullWork;}()},{key:"runSelectWork",value:function runSelectWork(t){var n;var e=this.setFullWork(t);e&&(n=t.selectIds)!=null&&n.length&&t.workId&&e.selectServiceNode(t.workId.toString(),{selectIds:t.selectIds},!1);}},{key:"workShapesDone",value:function workShapesDone(){var _iterator58=_createForOfIteratorHelper(this.workShapes.keys()),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var t=_step58.value;this.clearWorkShapeNodeCache(t);}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}this.fullLayer.removeAllChildren();}},{key:"canUseSubWorker",value:function canUseSubWorker(t){var e=this.thread.getPriorityDraw();return e||!e&&t!==ut.Pencil;}},{key:"consumeDraw",value:function(){var _consumeDraw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee65(t){var e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee65$(_context68){while(1)switch(_context68.prev=_context68.next){case 0:e=t.workId,n=e==null?void 0:e.toString(),i=n&&this.workShapes.get(n);if(i){_context68.next=3;break;}return _context68.abrupt("return");case 3:_context68.t0=this.drawWorkActiveId&&this.drawWorkActiveId!==n;if(!_context68.t0){_context68.next=8;break;}_context68.next=7;return this.consumeDrawAll({workId:this.drawWorkActiveId,viewId:this.viewId,msgType:at.DrawWork,dataType:Mt.Local});case 7:this.drawWorkActiveId=void 0;case 8:!this.drawWorkActiveId&&n!==Nt&&(this.drawWorkActiveId=n);a=i.toolsType,o=i.consume({data:t,drawCount:this.drawCount,isFullWork:!0,isSubWorker:!0});_context68.t1=a;_context68.next=_context68.t1===ut.Arrow?13:_context68.t1===ut.Straight?13:_context68.t1===ut.Ellipse?13:_context68.t1===ut.Rectangle?13:_context68.t1===ut.Star?13:_context68.t1===ut.Polygon?13:_context68.t1===ut.SpeechBalloon?13:_context68.t1===ut.Pencil?19:25;break;case 13:_context68.t2=o;if(!_context68.t2){_context68.next=18;break;}this.drawCount++;_context68.next=18;return this.drawShape(o);case 18:return _context68.abrupt("break",25);case 19:_context68.t3=o;if(!_context68.t3){_context68.next=24;break;}this.drawCount++;_context68.next=24;return this.drawPencil(o,e==null?void 0:e.toString());case 24:return _context68.abrupt("break",25);case 25:case"end":return _context68.stop();}},_callee65,this);}));function consumeDraw(_x81){return _consumeDraw3.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(t){var e,n,i;return _regeneratorRuntime().wrap(function _callee66$(_context69){while(1)switch(_context69.prev=_context69.next){case 0:e=t.workId;if(!e){_context69.next=12;break;}n=e.toString();this.drawWorkActiveId===n&&(this.drawWorkActiveId=void 0);i=this.workShapes.get(n);if(i){_context69.next=7;break;}return _context69.abrupt("return");case 7:_context69.t0=i.toolsType;_context69.next=_context69.t0===ut.Arrow?10:_context69.t0===ut.Straight?10:_context69.t0===ut.Ellipse?10:_context69.t0===ut.Pencil?10:_context69.t0===ut.Rectangle?10:_context69.t0===ut.Star?10:_context69.t0===ut.Polygon?10:_context69.t0===ut.SpeechBalloon?10:12;break;case 10:this.drawCount=0,this.fullLayer.removeAllChildren(),this.clearWorkShapeNodeCache(n);return _context69.abrupt("break",12);case 12:case"end":return _context69.stop();}},_callee66,this);}));function consumeDrawAll(_x82){return _consumeDrawAll2.apply(this,arguments);}return consumeDrawAll;}()},{key:"removeWork",value:function(){var _removeWork4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(t){var e,n,i,a;return _regeneratorRuntime().wrap(function _callee67$(_context70){while(1)switch(_context70.prev=_context70.next){case 0:e=t.workId,n=e==null?void 0:e.toString();if(!n){_context70.next=8;break;}i=this.removeNode(n);if(!i){_context70.next=8;break;}a=[];a.push({rect:wt(i),clearCanvas:St.Float,isClear:!0,viewId:this.viewId},{rect:wt(i),drawCanvas:St.Float,viewId:this.viewId});_context70.next=8;return this._post({render:a});case 8:case"end":return _context70.stop();}},_callee67,this);}));function removeWork(_x83){return _removeWork4.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(t){var e=this.workShapes.has(t);var n;return e&&(this.fullLayer.getElementsByName(t).forEach(function(i){var a=i.getBoundingClientRect();n=Pt(n,{x:a.x-vt.SafeBorderPadding,y:a.y-vt.SafeBorderPadding,w:a.width+vt.SafeBorderPadding*2,h:a.height+vt.SafeBorderPadding*2}),i.remove();}),n&&this.clearWorkShapeNodeCache(t)),n;}},{key:"drawPencil",value:function(){var _drawPencil2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee68(t,e){return _regeneratorRuntime().wrap(function _callee68$(_context71){while(1)switch(_context71.prev=_context71.next){case 0:_context71.next=2;return this._post({drawCount:this.drawCount,render:[{rect:t==null?void 0:t.rect,workId:e,drawCanvas:St.Float,viewId:this.viewId}],sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context71.stop();}},_callee68,this);}));function drawPencil(_x84,_x85){return _drawPencil2.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee69(t){return _regeneratorRuntime().wrap(function _callee69$(_context72){while(1)switch(_context72.prev=_context72.next){case 0:_context72.next=2;return this._post({drawCount:this.drawCount,render:[{rect:(t==null?void 0:t.rect)&&wt(t.rect),isClear:!0,clearCanvas:St.Float,viewId:this.viewId},{rect:(t==null?void 0:t.rect)&&wt(t.rect),drawCanvas:St.Float,viewId:this.viewId}]});case 2:case"end":return _context72.stop();}},_callee69,this);}));function drawShape(_x86){return _drawShape2.apply(this,arguments);}return drawShape;}()}]);}(Ri);var ym=/*#__PURE__*/function(){function ym(r){_classCallCheck(this,ym);et(this,"viewId");et(this,"vNodes");et(this,"topLayer");et(this,"thread");et(this,"post");et(this,"serviceWorkShapes",/* @__PURE__ */new Map());et(this,"localWorkShapes",/* @__PURE__ */new Map());et(this,"tmpOpt");et(this,"syncUnitTime",re.syncOpt.interval);et(this,"animationId");this.viewId=r.viewId,this.vNodes=r.vNodes,this.topLayer=r.topLayer,this.thread=r.thread,this.post=r.thread.post.bind(r.thread);}return _createClass(ym,[{key:"canUseTopLayer",value:function canUseTopLayer(r){return r===ut.LaserPen;}},{key:"getWorkShape",value:function getWorkShape(r){return this.localWorkShapes.get(r);}},{key:"createWorkShape",value:function createWorkShape(r,t){if(r&&this.tmpOpt){var _e15={toolsType:this.tmpOpt.toolsType,toolsOpt:t||this.tmpOpt.toolsOpt},n=this.createWorkShapeNode(_objectSpread(_objectSpread({},_e15),{},{workId:r}));return n&&this.localWorkShapes.set(r,{node:n,toolsType:n.toolsType,workState:It.Start}),n;}}},{key:"setWorkOptions",value:function setWorkOptions(r,t){var n;var e=(n=this.localWorkShapes.get(r))==null?void 0:n.node;e||this.createWorkShape(r,t),e==null||e.setWorkOptions(t);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(r){var t=r.toolsType;if(t===ut.LaserPen)return Fr(_objectSpread(_objectSpread({},r),{},{vNodes:this.vNodes,fullLayer:this.topLayer,drawLayer:this.topLayer}));}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.localWorkShapes.forEach(function(r){var t;return(t=r.node)==null?void 0:t.clearTmpPoints();}),this.localWorkShapes.clear();}},{key:"setToolsOpt",value:function setToolsOpt(r){var t;this.tmpOpt=r,(t=r.toolsOpt)!=null&&t.syncUnitTime&&(this.syncUnitTime=r.toolsOpt.syncUnitTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"consumeDraw",value:function consumeDraw(r){var t=r.workId,e=r.dataType;if(e===Mt.Service)this.activeServiceWorkShape(r);else{var n=t==null?void 0:t.toString(),i=n&&this.localWorkShapes.get(n);if(!i)return;var a=i.node.consume({data:r,isFullWork:!1,isSubWorker:!0});a.rect&&(i.totalRect=Pt(a.rect,i.totalRect),i.result=a,i.workState=It.Doing,n&&this.localWorkShapes.set(n,i));}this.runAnimation();}},{key:"consumeDrawAll",value:function consumeDrawAll(r){var t=r.workId,e=r.dataType;if(e===Mt.Service)this.activeServiceWorkShape(r);else{var n=t==null?void 0:t.toString(),i=n&&this.localWorkShapes.get(n);if(!i)return;var a=i.node.consumeAll({data:r});i.totalRect=Pt(a.rect,i.totalRect),i.result=a,i.workState=It.Done,n&&this.localWorkShapes.set(n,i);}this.runAnimation();}},{key:"destroy",value:function destroy(){this.serviceWorkShapes.clear(),this.localWorkShapes.clear();}},{key:"setNodeKey",value:function setNodeKey(r,t,e,n){return t.toolsType=e,t.node=this.createWorkShapeNode({workId:r,toolsType:e,toolsOpt:n}),t;}},{key:"activeServiceWorkShape",value:function activeServiceWorkShape(r){var p,y;var t=r.workId,e=r.opt,n=r.toolsType,i=r.type,a=r.updateNodeOpt,o=r.ops,s=r.op;if(!t)return;var l=t.toString(),d=(p=this.vNodes.get(l))==null?void 0:p.rect;if(!((y=this.serviceWorkShapes)!=null&&y.has(l))){var P={toolsType:n,animationWorkData:s||[],animationIndex:0,type:i,updateNodeOpt:a,ops:o,oldRect:d};n&&e&&(P=this.setNodeKey(l,P,n,e)),this.serviceWorkShapes.set(l,P);}var c=this.serviceWorkShapes.get(l);i&&(c.type=i),o&&(c.animationWorkData=Me(o),c.ops=o),a&&(c.updateNodeOpt=a),s&&(c.animationWorkData=s),c.node&&c.node.getWorkId()!==l&&c.node.setWorkId(l),d&&(c.oldRect=d),n&&e&&(c.toolsType!==n&&n&&e&&this.setNodeKey(l,c,n,e),c.node&&c.node.setWorkOptions(e));}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(r,t){var e=Math.floor((r.animationWorkData||[]).slice(r.animationIndex).length*32/t/this.syncUnitTime)*t;return Math.min((r.animationIndex||0)+(e||t),(r.animationWorkData||[]).length);}},{key:"animationDraw",value:function(){var _animationDraw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70(){var _this101=this;var a,o,s,l,r,t,e,n,i,_iterator59,_step59,_step59$value,d,c,y,P,x,v,_iterator60,_step60,_step60$value,_d14,_c7,p,_y14,_P4,_x87,_v10;return _regeneratorRuntime().wrap(function _callee70$(_context73){while(1)switch(_context73.prev=_context73.next){case 0:this.animationId=void 0;r=!1;t=/* @__PURE__ */new Map(),e=[],n=[],i=[];_iterator59=_createForOfIteratorHelper(this.serviceWorkShapes.entries());_context73.prev=4;_iterator59.s();case 6:if((_step59=_iterator59.n()).done){_context73.next=20;break;}_step59$value=_slicedToArray(_step59.value,2),d=_step59$value[0],c=_step59$value[1];_context73.t0=c.toolsType;_context73.next=_context73.t0===ut.LaserPen?11:18;break;case 11:y=this.computNextAnimationIndex(c,8),P=Math.max(0,c.animationIndex||0),x=(c.animationWorkData||[]).slice(P,y);if((c.animationIndex||0)<y){v=(a=c.node)==null?void 0:a.consumeService({op:x,isFullWork:!1});c.totalRect=Pt(c.totalRect,v),c.animationIndex=y,x.length&&t.set(d,{workState:P===0?It.Start:y===((o=c.animationWorkData)==null?void 0:o.length)?It.Done:It.Doing,op:x.slice(-2)});}if(!(n.push({isClear:!0,rect:c.totalRect,clearCanvas:St.TopFloat,viewId:this.viewId}),e.push({rect:c.totalRect,drawCanvas:St.TopFloat,viewId:this.viewId}),c.isDel)){_context73.next=16;break;}(s=c.node)==null||s.clearTmpPoints(),this.serviceWorkShapes["delete"](d);return _context73.abrupt("break",18);case 16:c.ops&&c.animationIndex===((l=c.animationWorkData)==null?void 0:l.length)&&!c.isDel&&(this.topLayer.getElementsByName(d.toString())[0]||(c.isDel=!0,this.serviceWorkShapes.set(d,c))),r=!0;return _context73.abrupt("break",18);case 18:_context73.next=6;break;case 20:_context73.next=25;break;case 22:_context73.prev=22;_context73.t1=_context73["catch"](4);_iterator59.e(_context73.t1);case 25:_context73.prev=25;_iterator59.f();return _context73.finish(25);case 28:_iterator60=_createForOfIteratorHelper(this.localWorkShapes.entries());_context73.prev=29;_iterator60.s();case 31:if((_step60=_iterator60.n()).done){_context73.next=44;break;}_step60$value=_slicedToArray(_step60.value,2),_d14=_step60$value[0],_c7=_step60$value[1];p=_c7.result,_y14=_c7.toolsType,_P4=_c7.totalRect,_x87=_c7.isDel,_v10=_c7.workState;_context73.t2=_y14;_context73.next=_context73.t2===ut.LaserPen?37:42;break;case 37:if(!(_P4&&(n.push({isClear:!0,rect:_P4,clearCanvas:St.TopFloat,viewId:this.viewId}),e.push({rect:_P4,drawCanvas:St.TopFloat,viewId:this.viewId})),_x87)){_context73.next=40;break;}_c7.node.clearTmpPoints(),this.localWorkShapes["delete"](_d14),i.push({removeIds:[_d14.toString()],viewId:this.viewId,type:at.RemoveNode});return _context73.abrupt("break",42);case 40:p&&((p.op||p.ops)&&i.push(p),_c7.result=void 0),!this.topLayer.getElementsByName(_d14.toString())[0]&&_v10===It.Done&&(_c7.isDel=!0,this.localWorkShapes.set(_d14,_c7)),r=!0;return _context73.abrupt("break",42);case 42:_context73.next=31;break;case 44:_context73.next=49;break;case 46:_context73.prev=46;_context73.t3=_context73["catch"](29);_iterator60.e(_context73.t3);case 49:_context73.prev=49;_iterator60.f();return _context73.finish(49);case 52:r&&this.runAnimation(),t.size&&t.forEach(function(d,c){i.push({type:at.Cursor,uid:c.split(De)[0],op:d.op,workState:d.workState,viewId:_this101.viewId});}),(e.length||n.length||i.length)&&this.post({render:[].concat(n,e),sp:i});case 53:case"end":return _context73.stop();}},_callee70,this,[[4,22,25,28],[29,46,49,52]]);}));function animationDraw(){return _animationDraw2.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var _this102=this;this.animationId||(this.animationId=setTimeout(function(){_this102.animationId=void 0,_this102.animationDraw();},16));}}]);}();var qe=/* @__PURE__ */function(h){return h.Full="full",h.Sub="sub",h;}(qe||{});var Sm=/*#__PURE__*/function(){function Sm(r,t){_classCallCheck(this,Sm);et(this,"_self");et(this,"version",fi);et(this,"type");et(this,"hasPriorityDraw",!0);et(this,"workThreadMap",/* @__PURE__ */new Map());this._self=r,this.type=t,this.register();}return _createClass(Sm,[{key:"init",value:function init(r){var t=r.viewId,e=r.dpr,n=r.offscreenCanvasOpt,i=r.layerOpt,a=r.isSafari;if(!e||!n||!i)return;var o;this.type==="full"&&(o=new xm(t,{dpr:e,offscreenCanvasOpt:n,layerOpt:i},this.post.bind(this))),this.type==="sub"&&(o=new Tm(t,{dpr:e,offscreenCanvasOpt:n,layerOpt:i},this.post.bind(this)),o.setHasPriorityDraw(this.hasPriorityDraw)),o&&a&&o.setIsSafari(a),o&&r.cameraOpt&&o.setCameraOpt(r.cameraOpt),o&&this.workThreadMap.set(t,o);}},{key:"register",value:function register(){var _this103=this;onmessage=/*#__PURE__*/function(){var _ref170=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee71(r){var t,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,_e16,n,i,a,o,_iterator61,_step61,l,_iterator62,_step62,_step62$value,_l8,d,c,_iterator63,_step63,_l9,s;return _regeneratorRuntime().wrap(function _callee71$(_context74){while(1)switch(_context74.prev=_context74.next){case 0:t=r.data;if(!t){_context74.next=56;break;}_iteratorAbruptCompletion=false;_didIteratorError=false;_context74.prev=4;_iterator=_asyncIterator(t.values());case 6:_context74.next=8;return _iterator.next();case 8:if(!(_iteratorAbruptCompletion=!(_step=_context74.sent).done)){_context74.next=40;break;}_e16=_step.value;n=_e16.msgType,i=_e16.viewId,a=_e16.tasksqueue,o=_e16.mainTasksqueueCount;if(!(n===at.Console)){_context74.next=14;break;}console.log(_this103);return _context74.abrupt("continue",37);case 14:if(!(n===at.Init)){_context74.next=17;break;}_this103.init(_e16);return _context74.abrupt("continue",37);case 17:if(!(_this103.type==="sub"&&(n===at.PriorityWorker||n===at.PriorityMainThreadWorker))){_context74.next=22;break;}n===at.PriorityWorker?_this103.hasPriorityDraw=!0:n===at.PriorityMainThreadWorker&&(_this103.hasPriorityDraw=!1);_iterator61=_createForOfIteratorHelper(_this103.workThreadMap.values());try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){l=_step61.value;l.setHasPriorityDraw(_this103.hasPriorityDraw);}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}return _context74.abrupt("continue",37);case 22:if(!(n===at.TasksQueue&&a!=null&&a.size)){_context74.next=27;break;}_iterator62=_createForOfIteratorHelper(_this103.workThreadMap.entries());try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){_step62$value=_slicedToArray(_step62.value,2),_l8=_step62$value[0],d=_step62$value[1];c=a.get(_l8);c&&d.on(c);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}_this103.type==="full"&&_t(o)&&_this103.post({workerTasksqueueCount:o});return _context74.abrupt("continue",37);case 27:if(!(i===Bi)){_context74.next=31;break;}_iterator63=_createForOfIteratorHelper(_this103.workThreadMap.values());try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){_l9=_step63.value;_l9.on(_e16),n===at.Destroy&&_this103.workThreadMap["delete"](i);}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}return _context74.abrupt("continue",37);case 31:s=_this103.workThreadMap.get(i);_context74.t0=s;if(!_context74.t0){_context74.next=37;break;}_context74.next=36;return s.on(_e16);case 36:n===at.Destroy&&_this103.workThreadMap["delete"](i);case 37:_iteratorAbruptCompletion=false;_context74.next=6;break;case 40:_context74.next=46;break;case 42:_context74.prev=42;_context74.t1=_context74["catch"](4);_didIteratorError=true;_iteratorError=_context74.t1;case 46:_context74.prev=46;_context74.prev=47;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context74.next=51;break;}_context74.next=51;return _iterator["return"]();case 51:_context74.prev=51;if(!_didIteratorError){_context74.next=54;break;}throw _iteratorError;case 54:return _context74.finish(51);case 55:return _context74.finish(46);case 56:case"end":return _context74.stop();}},_callee71,null,[[4,42,46,56],[47,,51,55]]);}));return function onmessage(_x88){return _ref170.apply(this,arguments);};}();}},{key:"post",value:function post(r,t){t?this._self.postMessage(r,t):this._self.postMessage(r);}}]);}();var xm=/*#__PURE__*/function(_Ai){function xm(t,e,n){var _this104;_classCallCheck(this,xm);_this104=_callSuper(this,xm,[t,e,"full"/* Full */]);et(_this104,"type","full");et(_this104,"serviceDrawLayer");et(_this104,"localDrawLayer");et(_this104,"snapshotFullLayer");et(_this104,"methodBuilder");et(_this104,"localWork");et(_this104,"serviceWork");et(_this104,"_post");et(_this104,"taskUpdateCameraId");et(_this104,"debounceUpdateCameraId");et(_this104,"debounceUpdateCache",/* @__PURE__ */new Set());_this104._post=n;var i=re.bufferSize.sub;_this104.serviceDrawLayer=_this104.createLayer("serviceDrawLayer",_this104.scene,_objectSpread(_objectSpread({},e.layerOpt),{},{bufferSize:i})),_this104.localDrawLayer=_this104.createLayer("localDrawLayer",_this104.scene,_objectSpread(_objectSpread({},e.layerOpt),{},{bufferSize:i}));var a={thread:_this104,viewId:_this104.viewId,vNodes:_this104.vNodes,fullLayer:_this104.fullLayer};_this104.localWork=new pm(_objectSpread(_objectSpread({},a),{},{drawLayer:_this104.localDrawLayer})),_this104.serviceWork=new mm(_objectSpread(_objectSpread({},a),{},{drawLayer:_this104.serviceDrawLayer})),_this104.methodBuilder=new Xi([bt.CopyNode,bt.SetColorNode,bt.DeleteNode,bt.RotateNode,bt.ScaleNode,bt.TranslateNode,bt.ZIndexNode,bt.SetFontStyle,bt.SetPoint,bt.SetLock,bt.SetShapeOpt]).registerForWorker(_this104),_this104.vNodes.init(_this104.fullLayer);return _this104;}_inherits(xm,_Ai);return _createClass(xm,[{key:"combinePost",value:function(){var _combinePost=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee72(){var _this105=this;var a,o,_this$combinePostData,t,e,n,s,_iterator64,_step64,l,d,i;return _regeneratorRuntime().wrap(function _callee72$(_context75){while(1)switch(_context75.prev=_context75.next){case 0:_this$combinePostData=this.combinePostData(),t=_this$combinePostData.render,e=_objectWithoutProperties(_this$combinePostData,_excluded4);if(!(t!=null&&t.length)){_context75.next=28;break;}s=[];_iterator64=_createForOfIteratorHelper(t);_context75.prev=4;_iterator64.s();case 6:if((_step64=_iterator64.n()).done){_context75.next=19;break;}l=_step64.value;if(!l.rect){_context75.next=17;break;}if(!(l.rect=this.safariFixRect(Xt(l.rect),this.dpr),!l.rect)){_context75.next=11;break;}return _context75.abrupt("continue",17);case 11:if(!(l.drawCanvas&&l.rect&&l.rect.w>0&&l.rect.h>0)){_context75.next=16;break;}_context75.next=14;return this.getRectImageBitmap(l);case 14:d=_context75.sent;l.imageBitmap=d,n||(n=[]),n.push(d);case 16:s.push(l);case 17:_context75.next=6;break;case 19:_context75.next=24;break;case 21:_context75.prev=21;_context75.t0=_context75["catch"](4);_iterator64.e(_context75.t0);case 24:_context75.prev=24;_iterator64.f();return _context75.finish(24);case 27:e.render=s;case 28:i=(a=e.sp)==null?void 0:a.filter(function(s){return s.type!==at.None||s.isLockSentEventCursor;});i!=null&&i.length?e.sp=i.map(function(s){return _objectSpread(_objectSpread({},s),{},{viewId:_this105.viewId});}):delete e.sp,e.drawCount===void 0&&delete e.drawCount,(e!=null&&e.drawCount||i!=null&&i.length||(o=e.render)!=null&&o.length)&&this._post(e,n),this.delayPostDoneResolve&&this.delayPostDoneResolve(!0);case 30:case"end":return _context75.stop();}},_callee72,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 _callee73(t){var _this106=this;var e,n,i,a,o,s,l,d,_l10;return _regeneratorRuntime().wrap(function _callee73$(_context76){while(1)switch(_context76.prev=_context76.next){case 0:if(!this.methodBuilder.consumeForWorker(t)){_context76.next=2;break;}return _context76.abrupt("return");case 2:e=t.msgType,n=t.dataType,i=t.workId,a=t.toolsType,o=t.workState,s=t.workIds;_context76.t0=e;_context76.next=_context76.t0===at.AuthClear?6:_context76.t0===at.CreateWork?9:_context76.t0===at.DrawWork?11:_context76.t0===at.Select?20:_context76.t0===at.UpdateNode?27:_context76.t0===at.FullWork?27:_context76.t0===at.RemoveNode?29:_context76.t0===at.GetTextActive?32:_context76.t0===at.CursorHover?35:_context76.t0===at.CursorBlur?38:_context76.t0===at.GetVNodeInfo?41:43;break;case 6:l=t.clearUids,d=t.localUid;this.vNodes.setCanClearUids(l),this.vNodes.setLocalUid(d);return _context76.abrupt("break",43);case 9:a!==ut.LaserPen&&this.createLocalWork(t);return _context76.abrupt("break",43);case 11:_context76.t1=a!==ut.LaserPen;if(!_context76.t1){_context76.next=19;break;}if(!(o===It.Done&&n===Mt.Local)){_context76.next=18;break;}_context76.next=16;return this.consumeDrawAll(n,t);case 16:_context76.next=19;break;case 18:this.consumeDraw(n,t);case 19:return _context76.abrupt("break",43);case 20:if(!(i===Nt)){_context76.next=25;break;}_context76.next=23;return this.localWork.updateFullSelectWork(t);case 23:_context76.next=26;break;case 25:this.serviceWork.runSelectWork(t);case 26:return _context76.abrupt("return");case 27:this.consumeFull(n,t);return _context76.abrupt("return");case 29:_context76.next=31;return this.removeNode(t);case 31:return _context76.abrupt("return");case 32:_context76.next=34;return this.checkTextActive(t);case 34:return _context76.abrupt("return");case 35:_context76.next=37;return this.cursorHover(t);case 37:return _context76.abrupt("return");case 38:_context76.next=40;return this.cursorBlur();case 40:return _context76.abrupt("return");case 41:if(i&&s){_l10=s.map(function(d){return _this106.vNodes.get(d);});this.post({sp:[{type:at.GetVNodeInfo,dataType:Mt.Worker,workId:i,vInfo:_l10}]});}return _context76.abrupt("break",43);case 43:_context76.next=45;return _superPropGet(xm,"on",this,3)([t]);case 45:case"end":return _context76.stop();}},_callee73,this);}));function on(_x89){return _on2.apply(this,arguments);}return on;}()},{key:"removeNode",value:function(){var _removeNode2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee74(t){var _this107=this;var e,n,i,a,o,_iterator65,_step65,_loop7;return _regeneratorRuntime().wrap(function _callee74$(_context78){while(1)switch(_context78.prev=_context78.next){case 0:e=t.dataType,n=t.workId,i=t.removeIds,a=[],o=i||[];if(!(n&&o.push(n.toString()),o.length)){_context78.next=20;break;}_iterator65=_createForOfIteratorHelper(o);_context78.prev=3;_loop7=/*#__PURE__*/_regeneratorRuntime().mark(function _loop7(){var s;return _regeneratorRuntime().wrap(function _loop7$(_context77){while(1)switch(_context77.prev=_context77.next){case 0:s=_step65.value;s===Nt?a.push(_this107.localWork.removeSelector(t,_this107)):e===Mt.Local?a.push(_this107.localWork.removeWork(t).then(function(){_this107.localWork.colloctEffectSelectWork(t),_this107.deleteCachedImagesByWorkId(s);})):e===Mt.Service&&a.push(_this107.serviceWork.removeWork(t).then(function(){_this107.localWork.colloctEffectSelectWork(t),_this107.deleteCachedImagesByWorkId(s);}));case 2:case"end":return _context77.stop();}},_loop7);});_iterator65.s();case 6:if((_step65=_iterator65.n()).done){_context78.next=10;break;}return _context78.delegateYield(_loop7(),"t0",8);case 8:_context78.next=6;break;case 10:_context78.next=15;break;case 12:_context78.prev=12;_context78.t1=_context78["catch"](3);_iterator65.e(_context78.t1);case 15:_context78.prev=15;_iterator65.f();return _context78.finish(15);case 18:_context78.next=20;return Promise.all(a);case 20:case"end":return _context78.stop();}},_callee74,null,[[3,12,15,18]]);}));function removeNode(_x90){return _removeNode2.apply(this,arguments);}return removeNode;}()},{key:"checkTextActive",value:function(){var _checkTextActive2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee75(t){var e;return _regeneratorRuntime().wrap(function _callee75$(_context79){while(1)switch(_context79.prev=_context79.next){case 0:e=t.dataType;_context79.t0=e===Mt.Local;if(!_context79.t0){_context79.next=5;break;}_context79.next=5;return this.localWork.checkTextActive(t);case 5:case"end":return _context79.stop();}},_callee75,this);}));function checkTextActive(_x91){return _checkTextActive2.apply(this,arguments);}return checkTextActive;}()},{key:"clearAll",value:function(){var _clearAll2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee76(){return _regeneratorRuntime().wrap(function _callee76$(_context80){while(1)switch(_context80.prev=_context80.next){case 0:this.vNodes.clear();_superPropGet(xm,"clearAll",this,3)([]);this.localDrawLayer&&(this.localDrawLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),this.localDrawLayer.removeAllChildren());this.serviceDrawLayer&&(this.serviceDrawLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),this.serviceDrawLayer.removeAllChildren());_context80.next=6;return this.post({render:[{isClearAll:!0,clearCanvas:St.Bg,viewId:this.viewId},{isClearAll:!0,clearCanvas:St.ServiceFloat,viewId:this.viewId},{isClearAll:!0,clearCanvas:St.Float,viewId:this.viewId}],sp:[{type:at.Clear}]});case 6:case"end":return _context80.stop();}},_callee76,this);}));function clearAll(){return _clearAll2.apply(this,arguments);}return clearAll;}()},{key:"updateLayer",value:function updateLayer(t){var e=t.width,n=t.height;_superPropGet(xm,"updateLayer",this,3)([t]),this.localDrawLayer&&(this.localDrawLayer.parent.setAttribute("width",e),this.localDrawLayer.parent.setAttribute("height",n),this.localDrawLayer.setAttribute("size",[e,n]),this.localDrawLayer.setAttribute("pos",[e*0.5,n*0.5])),this.serviceDrawLayer&&(this.serviceDrawLayer.parent.setAttribute("width",e),this.serviceDrawLayer.parent.setAttribute("height",n),this.serviceDrawLayer.setAttribute("size",[e,n]),this.serviceDrawLayer.setAttribute("pos",[e*0.5,n*0.5]));}},{key:"setCameraOpt",value:function setCameraOpt(t){this.cameraOpt=t;var e=t.scale,n=t.centerX,i=t.centerY,a=t.width,o=t.height;(a!==this.scene.width||o!==this.scene.height)&&this.updateScene({width:a,height:o}),this.fullLayer&&(this.fullLayer.setAttribute("scale",[e,e]),this.fullLayer.setAttribute("translate",[-n,-i])),this.localDrawLayer&&(this.localDrawLayer.setAttribute("scale",[e,e]),this.localDrawLayer.setAttribute("translate",[-n,-i])),this.serviceDrawLayer&&(this.serviceDrawLayer.setAttribute("scale",[e,e]),this.serviceDrawLayer.setAttribute("translate",[-n,-i]));}},{key:"getLayer",value:function getLayer(t){switch(t){case St.Bg:return this.fullLayer;case St.ServiceFloat:return this.serviceDrawLayer;case St.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 _callee77(t,e){var n;return _regeneratorRuntime().wrap(function _callee77$(_context81){while(1)switch(_context81.prev=_context81.next){case 0:_context81.next=2;return this.localWork.colloctEffectSelectWork(e);case 2:n=_context81.sent;_context81.t0=n&&t===Mt.Local;if(!_context81.t0){_context81.next=7;break;}_context81.next=7;return this.localWork.consumeFull(n);case 7:n&&t===Mt.Service&&this.serviceWork.consumeFull(n);case 8:case"end":return _context81.stop();}},_callee77,this);}));function consumeFull(_x92,_x93){return _consumeFull2.apply(this,arguments);}return consumeFull;}()},{key:"consumeDraw",value:function(){var _consumeDraw4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee78(t,e){var n;return _regeneratorRuntime().wrap(function _callee78$(_context82){while(1)switch(_context82.prev=_context82.next){case 0:n=e.workId;_context82.t0=t===Mt.Local&&n;if(!_context82.t0){_context82.next=6;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(e);_context82.next=6;return this.localWork.consumeDraw(e,this.serviceWork);case 6:t===Mt.Service&&this.serviceWork.consumeDraw(e);case 7:case"end":return _context82.stop();}},_callee78,this);}));function consumeDraw(_x94,_x95){return _consumeDraw4.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee79(t,e){var n;return _regeneratorRuntime().wrap(function _callee79$(_context83){while(1)switch(_context83.prev=_context83.next){case 0:n=e.workId;_context83.t0=t===Mt.Local&&n;if(!_context83.t0){_context83.next=6;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(e);_context83.next=6;return this.localWork.consumeDrawAll(e,this.serviceWork);case 6:case"end":return _context83.stop();}},_callee79,this);}));function consumeDrawAll(_x96,_x97){return _consumeDrawAll3.apply(this,arguments);}return consumeDrawAll;}()},{key:"updateCamera",value:function(){var _updateCamera=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee80(t){var _this108=this;var a,e,n,i,o,p,_iterator66,_step66,_step66$value,y,P,s,_iterator67,_step67,_step67$value,_p9,_y19,_P8,l,d,_p5,_iterator68,_step68,_y15,c,_iterator69,_step69,_p6,_y16,_iterator70,_step70,_P5,_iterator71,_step71,_step71$value,_p8,_y18,_P7,x,v,_T44,_f37,g,u,m,M,_iterator72,_step72,_step72$value,_p7,_y17;return _regeneratorRuntime().wrap(function _callee80$(_context84){while(1)switch(_context84.prev=_context84.next){case 0:e=[],n=t.cameraOpt,i=t.scenePath;if(!(n&&!oe(this.cameraOpt,n))){_context84.next=40;break;}this.taskUpdateCameraId&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0);o=!!this.serviceDrawLayer.children.length;if(!i){_context84.next=30;break;}p=!1;_iterator66=_createForOfIteratorHelper(this.localWork.getWorkShapes().entries());_context84.prev=7;_iterator66.s();case 9:if((_step66=_iterator66.n()).done){_context84.next=19;break;}_step66$value=_slicedToArray(_step66.value,2),y=_step66$value[0],P=_step66$value[1];_context84.t0=P.toolsType;_context84.next=_context84.t0===ut.Text?14:_context84.t0===ut.BitMapEraser?14:_context84.t0===ut.PencilEraser?14:_context84.t0===ut.Eraser?14:_context84.t0===ut.Selector?14:_context84.t0===ut.LaserPen?14:15;break;case 14:return _context84.abrupt("break",17);case 15:y!==be&&y!==Nt&&(p=!0);return _context84.abrupt("break",17);case 17:_context84.next=9;break;case 19:_context84.next=24;break;case 21:_context84.prev=21;_context84.t1=_context84["catch"](7);_iterator66.e(_context84.t1);case 24:_context84.prev=24;_iterator66.f();return _context84.finish(24);case 27:if(!p){_context84.next=30;break;}this.taskUpdateCameraId=setTimeout(function(){_this108.taskUpdateCameraId=void 0,_this108.updateCamera(t);},Cn);return _context84.abrupt("return");case 30:s=/* @__PURE__ */new Map();_iterator67=_createForOfIteratorHelper(this.vNodes.getNodesByType(ut.Text).entries());try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){_step67$value=_slicedToArray(_step67.value,2),_p9=_step67$value[0],_y19=_step67$value[1];_P8=_y19.rect;s.set(_p9,Xt(_P8));}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}l=new Set(s.keys());d=!1;if(this.localWork.hasSelector()){_p5=(a=this.localWork.getSelector())==null?void 0:a.selectIds;if(_p5){d=!0;_iterator68=_createForOfIteratorHelper(_p5);try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){_y15=_step68.value;l.add(_y15);}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}}}c=!1;if(this.serviceWork.selectorWorkShapes.size){_iterator69=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.values());try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){_p6=_step69.value;_y16=_p6.selectIds;if(_y16){c=!0;_iterator70=_createForOfIteratorHelper(_y16);try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){_P5=_step70.value;l.add(_P5);}}catch(err){_iterator70.e(err);}finally{_iterator70.f();}}}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}}if(this.setCameraOpt(n),this.vNodes.curNodeMap.size){this.vNodes.clearTarget(),this.vNodes.updateHighLevelNodesRect(l),this.debounceUpdateCameraId&&clearTimeout(this.debounceUpdateCameraId);_iterator71=_createForOfIteratorHelper(s.entries());try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){_step71$value=_slicedToArray(_step71.value,2),_p8=_step71$value[0],_y18=_step71$value[1];_P7=this.vNodes.get(_p8);if(_P7){x=_y18,v=_P7.rect,_T44=this.getSceneRect(),_f37=fr(x,_T44),g=fr(v,_T44);u=!1;if((_f37!==g||x.w!==v.w||x.h!==v.h||g===Te.intersect)&&(u=!0),u){m=_P7.toolsType,M=_P7.opt;m===ut.Text&&M.workState===It.Done&&this.debounceUpdateCache.add(_p8);}}}}catch(err){_iterator71.e(err);}finally{_iterator71.f();}if(d&&this.localWork.reRenderSelector(),c){_iterator72=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.entries());try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){_step72$value=_slicedToArray(_step72.value,2),_p7=_step72$value[0],_y17=_step72$value[1];this.serviceWork.runSelectWork({workId:_p7,selectIds:_y17.selectIds,msgType:at.Select,dataType:Mt.Service,viewId:this.viewId});}}catch(err){_iterator72.e(err);}finally{_iterator72.f();}}this.debounceUpdateCameraId=setTimeout(function(){var y;_this108.debounceUpdateCameraId=void 0;var p=[];var _iterator73=_createForOfIteratorHelper(_this108.debounceUpdateCache.values()),_step73;try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var _P6=_step73.value;if((y=_this108.fullLayer)==null?void 0:y.getElementsByName(_P6)[0]){var v=_this108.vNodes.get(_P6);if(v){var _T43=v.toolsType,_f36=v.opt,g=v.rect,u=_this108.localWork.setFullWork({toolsType:_T43,opt:_f36,workId:_P6});if(u){var m=_this108.getSceneRect(),M=fr(g,m);p.push(u.consumeServiceAsync({isFullWork:!0,replaceId:_P6,isDrawLabel:M!==Te.outside}));}}}_this108.debounceUpdateCache["delete"](_P6);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}p.length?Promise.all(p).then(function(){var P=[];P.push({isClearAll:!0,clearCanvas:St.Bg,viewId:_this108.viewId},{isDrawAll:!0,drawCanvas:St.Bg,viewId:_this108.viewId}),P.length&&_this108.post({render:P}),_this108.vNodes.updateLowLevelNodesRect(),_this108.vNodes.clearHighLevelIds();}):(_this108.vNodes.updateLowLevelNodesRect(),_this108.vNodes.clearHighLevelIds());},Cn);}o&&e.push({isClearAll:!0,clearCanvas:St.ServiceFloat,viewId:this.viewId}),this.vNodes.hasRenderNodes()&&e.push({isClearAll:!0,clearCanvas:St.Bg,viewId:this.viewId},{isDrawAll:!0,drawCanvas:St.Bg,viewId:this.viewId}),e.length&&this.post({render:e});case 40:case"end":return _context84.stop();}},_callee80,this,[[7,21,24,27]]);}));function updateCamera(_x98){return _updateCamera.apply(this,arguments);}return updateCamera;}()},{key:"getRectImageBitmap",value:function getRectImageBitmap(t){var e=t.rect,n=t.drawCanvas,i=Math.floor(e.x*this.dpr),a=Math.floor(e.y*this.dpr),o=Math.floor(e.w*this.dpr||1),s=Math.floor(e.h*this.dpr||1);return createImageBitmap(this.getOffscreen(n),i,a,o,s,{resizeQuality:"low"});}},{key:"cursorHover",value:function(){var _cursorHover2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee81(t){return _regeneratorRuntime().wrap(function _callee81$(_context85){while(1)switch(_context85.prev=_context85.next){case 0:_context85.next=2;return this.localWork.cursorHover(t);case 2:case"end":return _context85.stop();}},_callee81,this);}));function cursorHover(_x99){return _cursorHover2.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee82(){return _regeneratorRuntime().wrap(function _callee82$(_context86){while(1)switch(_context86.prev=_context86.next){case 0:_context86.next=2;return this.localWork.cursorBlur();case 2:case"end":return _context86.stop();}},_callee82,this);}));function cursorBlur(){return _cursorBlur2.apply(this,arguments);}return cursorBlur;}()},{key:"destroy",value:function destroy(){_superPropGet(xm,"destroy",this,3)([]);}}]);}(Ai);var Tm=/*#__PURE__*/function(_Ai2){function Tm(t,e,n){var _this109;_classCallCheck(this,Tm);_this109=_callSuper(this,Tm,[t,e,"sub"/* Sub */]);et(_this109,"type","sub");et(_this109,"_post");et(_this109,"topLayer");et(_this109,"snapshotFullLayer");et(_this109,"serviceWork");et(_this109,"localWork");et(_this109,"topLayerWork");_this109._post=n;var i=re.bufferSize.sub;_this109.topLayer=_this109.createLayer("topLayer",_this109.scene,_objectSpread(_objectSpread({},e.layerOpt),{},{bufferSize:i}));var a={thread:_this109,viewId:_this109.viewId,vNodes:_this109.vNodes,fullLayer:_this109.fullLayer,topLayer:_this109.topLayer};_this109.localWork=new vm(a),_this109.topLayerWork=new ym(a),_this109.vNodes.init(_this109.fullLayer);return _this109;}_inherits(Tm,_Ai2);return _createClass(Tm,[{key:"combinePost",value:function(){var _combinePost2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee83(){var _this110=this;var a,o,s,_this$combinePostData2,t,e,n,l,_iterator74,_step74,_d15,_i11,_l11,d,_l12,_iterator75,_step75,_d16,c,i;return _regeneratorRuntime().wrap(function _callee83$(_context87){while(1)switch(_context87.prev=_context87.next){case 0:_this$combinePostData2=this.combinePostData(),t=_this$combinePostData2.render,e=_objectWithoutProperties(_this$combinePostData2,_excluded5);if((a=e.workIds)!=null&&a.size&&e.drawCount){l=[];_iterator74=_createForOfIteratorHelper(e.workIds.values());try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){_d15=_step74.value;this.fullLayer.getElementsByName(_d15).forEach(function(c){c.id&&e.drawCount&&Number(c.id)<e.drawCount&&l.push(c);});}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}for(_i11=0,_l11=l;_i11<_l11.length;_i11++){d=_l11[_i11];d.remove(),d.disconnect();}}if(!(t!=null&&t.length)){_context87.next=29;break;}_l12=[];_iterator75=_createForOfIteratorHelper(t);_context87.prev=5;_iterator75.s();case 7:if((_step75=_iterator75.n()).done){_context87.next=20;break;}_d16=_step75.value;if(!_d16.rect){_context87.next=18;break;}if(!(_d16.rect=this.safariFixRect(Xt(_d16.rect),this.dpr),!_d16.rect)){_context87.next=12;break;}return _context87.abrupt("continue",18);case 12:if(!(_d16.drawCanvas&&_d16.rect&&_d16.rect.w>0&&_d16.rect.h>0)){_context87.next=17;break;}_context87.next=15;return this.getRectImageBitmap(_d16);case 15:c=_context87.sent;_d16.imageBitmap=c,n||(n=[]),n.push(c);case 17:_l12.push(_d16);case 18:_context87.next=7;break;case 20:_context87.next=25;break;case 22:_context87.prev=22;_context87.t0=_context87["catch"](5);_iterator75.e(_context87.t0);case 25:_context87.prev=25;_iterator75.f();return _context87.finish(25);case 28:e.render=_l12;case 29:i=(o=e.sp)==null?void 0:o.filter(function(l){return l.type!==at.None;});i!=null&&i.length?e.sp=i.map(function(l){return _objectSpread(_objectSpread({},l),{},{viewId:_this110.viewId});}):delete e.sp,e.drawCount===void 0&&delete e.drawCount,(i!=null&&i.length||e.drawCount||(s=e==null?void 0:e.render)!=null&&s.length)&&this._post(e,n),this.delayPostDoneResolve&&this.delayPostDoneResolve(!0);case 31:case"end":return _context87.stop();}},_callee83,this,[[5,22,25,28]]);}));function combinePost(){return _combinePost2.apply(this,arguments);}return combinePost;}()},{key:"getLayer",value:function getLayer(t,e){if(e&&this.snapshotFullLayer)return this.snapshotFullLayer;switch(t){case St.TopFloat:return this.topLayer;default:return this.fullLayer;}}},{key:"on",value:function(){var _on3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee84(t){var e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee84$(_context88){while(1)switch(_context88.prev=_context88.next){case 0:e=t.msgType,n=t.toolsType,i=t.opt,a=t.dataType,o=t.workState;_context88.t0=e;_context88.next=_context88.t0===at.UpdateTools?4:_context88.t0===at.CreateWork?9:_context88.t0===at.DrawWork?11:_context88.t0===at.RemoveNode?18:_context88.t0===at.FullWork?21:_context88.t0===at.Snapshot?26:_context88.t0===at.BoundingBox?33:40;break;case 4:if(!(n&&this.topLayerWork.canUseTopLayer(n)&&i)){_context88.next=8;break;}s={toolsType:n,toolsOpt:i};this.topLayerWork.setToolsOpt(s);return _context88.abrupt("return");case 8:return _context88.abrupt("break",40);case 9:this.createLocalWork(t);return _context88.abrupt("return");case 11:if(!(o===It.Done&&a===Mt.Local)){_context88.next=16;break;}_context88.next=14;return this.consumeDrawAll(a,t);case 14:_context88.next=17;break;case 16:this.consumeDraw(a,t);case 17:return _context88.abrupt("return");case 18:_context88.next=20;return this.removeNode(t);case 20:return _context88.abrupt("return");case 21:_context88.t1=n&&this.topLayerWork.canUseTopLayer(n);if(!_context88.t1){_context88.next=25;break;}_context88.next=25;return this.consumeDrawAll(a,t);case 25:return _context88.abrupt("return");case 26:this.snapshotFullLayer=this.createLayer("snapshotFullLayer",this.scene,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Qe?6e3:3e3}));_context88.t2=this.snapshotFullLayer;if(!_context88.t2){_context88.next=32;break;}_context88.next=31;return this.getSnapshot(t);case 31:this.snapshotFullLayer=void 0;case 32:return _context88.abrupt("return");case 33:this.snapshotFullLayer=this.createLayer("snapshotFullLayer",this.scene,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Qe?6e3:3e3}));_context88.t3=this.snapshotFullLayer;if(!_context88.t3){_context88.next=39;break;}_context88.next=38;return this.getBoundingRect(t);case 38:this.snapshotFullLayer=void 0;case 39:return _context88.abrupt("return");case 40:_context88.next=42;return _superPropGet(Tm,"on",this,3)([t]);case 42:case"end":return _context88.stop();}},_callee84,this);}));function on(_x100){return _on3.apply(this,arguments);}return on;}()},{key:"createLocalWork",value:function createLocalWork(t){var e=t.workId,n=t.toolsType,i=t.opt;if(n&&this.topLayerWork.canUseTopLayer(n)&&e&&i){this.topLayerWork.getToolsOpt()||this.topLayerWork.setToolsOpt({toolsType:n,toolsOpt:i}),this.topLayerWork.setWorkOptions(e.toString(),i);return;}n&&this.localWork.canUseSubWorker(n)&&_superPropGet(Tm,"createLocalWork",this,3)([t]);}},{key:"removeNode",value:function(){var _removeNode3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee85(t){var e;return _regeneratorRuntime().wrap(function _callee85$(_context89){while(1)switch(_context89.prev=_context89.next){case 0:e=t.dataType;_context89.t0=e===Mt.Local;if(!_context89.t0){_context89.next=5;break;}_context89.next=5;return this.localWork.removeWork(t);case 5:case"end":return _context89.stop();}},_callee85,this);}));function removeNode(_x101){return _removeNode3.apply(this,arguments);}return removeNode;}()},{key:"getOffscreen",value:function getOffscreen(t,e){return this.getLayer(t,e).parent.canvas;}},{key:"consumeDraw",value:function(){var _consumeDraw5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee86(t,e){var n,i;return _regeneratorRuntime().wrap(function _callee86$(_context90){while(1)switch(_context90.prev=_context90.next){case 0:n=e.workId,i=e.toolsType;if(!n){_context90.next=11;break;}if(!(i&&this.topLayerWork.canUseTopLayer(i))){_context90.next=5;break;}t===Mt.Local&&(this.topLayerWork.getWorkShape(n.toString())||this.createLocalWork(e)),this.topLayerWork.consumeDraw(e);return _context90.abrupt("return");case 5:_context90.t0=i&&this.localWork.canUseSubWorker(i);if(!_context90.t0){_context90.next=10;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(e);_context90.next=10;return this.localWork.consumeDraw(e);case 10:return _context90.abrupt("return");case 11:case"end":return _context90.stop();}},_callee86,this);}));function consumeDraw(_x102,_x103){return _consumeDraw5.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee87(t,e){var n,i,a,o;return _regeneratorRuntime().wrap(function _callee87$(_context91){while(1)switch(_context91.prev=_context91.next){case 0:n=e.workId,i=e.toolsType,a=e.dataType;if(!n){_context91.next=8;break;}o=n.toString();if(!(i&&this.topLayerWork.canUseTopLayer(i))){_context91.next=6;break;}a===Mt.Local&&(this.topLayerWork.getWorkShape(o)||this.createLocalWork(e)),this.topLayerWork.consumeDrawAll(e);return _context91.abrupt("return");case 6:i&&this.localWork.canUseSubWorker(i)&&(this.localWork.getWorkShape(o)||_superPropGet(Tm,"createLocalWork",this,3)([e]),this.localWork.consumeDrawAll(e));return _context91.abrupt("return");case 8:case"end":return _context91.stop();}},_callee87,this);}));function consumeDrawAll(_x104,_x105){return _consumeDrawAll4.apply(this,arguments);}return consumeDrawAll;}()},{key:"clearAll",value:function(){var _clearAll3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee88(){return _regeneratorRuntime().wrap(function _callee88$(_context92){while(1)switch(_context92.prev=_context92.next){case 0:this.vNodes.clear();_superPropGet(Tm,"clearAll",this,3)([]);this.topLayer&&(this.topLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),this.topLayer.removeAllChildren());_context92.next=5;return this.post({render:[{isClearAll:!0,clearCanvas:St.TopFloat,viewId:this.viewId}],sp:[{type:at.Clear}]});case 5:case"end":return _context92.stop();}},_callee88,this);}));function clearAll(){return _clearAll3.apply(this,arguments);}return clearAll;}()},{key:"getRectImageBitmap",value:function getRectImageBitmap(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var n=arguments.length>2?arguments[2]:undefined;var i=t.rect,a=t.drawCanvas,o=Math.floor(i.x*this.dpr),s=Math.floor(i.y*this.dpr),l=Math.floor(i.w*this.dpr||1),d=Math.floor(i.h*this.dpr||1);return createImageBitmap(this.getOffscreen(a,e),o,s,l,d,n);}},{key:"updateLayer",value:function updateLayer(t){var e=t.width,n=t.height;_superPropGet(Tm,"updateLayer",this,3)([t]),this.topLayer&&(this.topLayer.parent.setAttribute("width",e),this.topLayer.parent.setAttribute("height",n),this.topLayer.setAttribute("size",[e,n]),this.topLayer.setAttribute("pos",[e*0.5,n*0.5])),this.snapshotFullLayer&&(this.snapshotFullLayer.parent.setAttribute("width",e),this.snapshotFullLayer.parent.setAttribute("height",n),this.snapshotFullLayer.setAttribute("size",[e,n]),this.snapshotFullLayer.setAttribute("pos",[e*0.5,n*0.5]));}},{key:"updateCamera",value:function(){var _updateCamera2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee89(t){var _this111=this;var e,n,i,a,_iterator76,_step76,_loop8;return _regeneratorRuntime().wrap(function _callee89$(_context94){while(1)switch(_context94.prev=_context94.next){case 0:e=[],n=t.cameraOpt;if(!(n&&!oe(this.cameraOpt,n))){_context94.next=25;break;}i=!!this.topLayerWork.localWorkShapes.size,a=!!this.localWork.getWorkShapes().size;if(!(a&&this.localWork.workShapesDone(),this.setCameraOpt(n),a&&e.push({isClearAll:!0,clearCanvas:St.Float,viewId:this.viewId}),i)){_context94.next=21;break;}e.push({isClearAll:!0,clearCanvas:St.TopFloat,viewId:this.viewId});_iterator76=_createForOfIteratorHelper(this.topLayerWork.localWorkShapes.entries());_context94.prev=6;_loop8=/*#__PURE__*/_regeneratorRuntime().mark(function _loop8(){var _step76$value,o,s,l;return _regeneratorRuntime().wrap(function _loop8$(_context93){while(1)switch(_context93.prev=_context93.next){case 0:_step76$value=_slicedToArray(_step76.value,2),o=_step76$value[0],s=_step76$value[1];if(s.totalRect){_this111.topLayer.getElementsByName(o.toString()).forEach(function(d){var c=d.getBoundingClientRect(),p=wt({x:c.x,y:c.y,w:c.width,h:c.height});l=Pt(l,p);}),s.totalRect=l,_this111.topLayerWork.localWorkShapes.set(o,s);}case 2:case"end":return _context93.stop();}},_loop8);});_iterator76.s();case 9:if((_step76=_iterator76.n()).done){_context94.next=13;break;}return _context94.delegateYield(_loop8(),"t0",11);case 11:_context94.next=9;break;case 13:_context94.next=18;break;case 15:_context94.prev=15;_context94.t1=_context94["catch"](6);_iterator76.e(_context94.t1);case 18:_context94.prev=18;_iterator76.f();return _context94.finish(18);case 21:_context94.t2=e.length;if(!_context94.t2){_context94.next=25;break;}_context94.next=25;return this.post({render:e});case 25:case"end":return _context94.stop();}},_callee89,this,[[6,15,18,21]]);}));function updateCamera(_x106){return _updateCamera2.apply(this,arguments);}return updateCamera;}()},{key:"setCameraOpt",value:function setCameraOpt(t,e){this.cameraOpt=t;var n=t.scale,i=t.centerX,a=t.centerY,o=t.width,s=t.height;(o!==this.scene.width||s!==this.scene.height)&&this.updateScene({width:o,height:s}),e?(e.setAttribute("scale",[n,n]),e.setAttribute("translate",[-i,-a])):(this.fullLayer.setAttribute("scale",[n,n]),this.fullLayer.setAttribute("translate",[-i,-a]),this.topLayer.setAttribute("scale",[n,n]),this.topLayer.setAttribute("translate",[-i,-a]));}},{key:"getSnapshot",value:function(){var _getSnapshot=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee90(t){var e,n,i,a,o,s,l,_i12,_Object$entries,_Object$entries$_i,c,p,y,P,x,d;return _regeneratorRuntime().wrap(function _callee90$(_context95){while(1)switch(_context95.prev=_context95.next){case 0:e=t.scenePath,n=t.scenes,i=t.cameraOpt,a=t.w,o=t.h;if(!(e&&n&&i&&this.snapshotFullLayer)){_context95.next=26;break;}s=Xt(this.cameraOpt);this.setCameraOpt(i,this.snapshotFullLayer),this.localWork.fullLayer=this.snapshotFullLayer,this.localWork.drawLayer=void 0;_i12=0,_Object$entries=Object.entries(n);case 5:if(!(_i12<_Object$entries.length)){_context95.next=21;break;}_Object$entries$_i=_slicedToArray(_Object$entries[_i12],2),c=_Object$entries$_i[0],p=_Object$entries$_i[1];if(!(p!=null&&p.type)){_context95.next=18;break;}_context95.t0=p==null?void 0:p.type;_context95.next=_context95.t0===at.UpdateNode?11:_context95.t0===at.FullWork?11:18;break;case 11:y=p.opt;P=_objectSpread(_objectSpread({},p),{},{opt:y,workId:c,msgType:at.FullWork,dataType:Mt.Service,viewId:this.viewId});_context95.next=15;return this.localWork.runFullWork(P);case 15:x=_context95.sent;l=Pt(l,x);return _context95.abrupt("break",18);case 18:_i12++;_context95.next=5;break;case 21:a&&o&&(d={resizeWidth:a,resizeHeight:o});_context95.next=24;return this.getSnapshotRender({scenePath:e,curCameraOpt:s,options:d});case 24:this.localWork.fullLayer=this.fullLayer;this.localWork.drawLayer=void 0;case 26:case"end":return _context95.stop();}},_callee90,this);}));function getSnapshot(_x107){return _getSnapshot.apply(this,arguments);}return getSnapshot;}()},{key:"getSnapshotRender",value:function(){var _getSnapshotRender=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee91(t){var o,s,e,n,i,a;return _regeneratorRuntime().wrap(function _callee91$(_context96){while(1)switch(_context96.prev=_context96.next){case 0:e=t.scenePath,n=t.curCameraOpt,i=t.options;((o=this.snapshotFullLayer)==null?void 0:o.parent).render();_context96.next=4;return this.getRectImageBitmap({rect:this.getSceneRect(),drawCanvas:St.None},!0,i);case 4:a=_context96.sent;a&&(this._post({sp:[{type:at.Snapshot,scenePath:e,imageBitmap:a,viewId:this.viewId}]},[a]),a.close(),(s=this.snapshotFullLayer)==null||s.removeAllChildren(),this.setCameraOpt(n,this.fullLayer));case 6:case"end":return _context96.stop();}},_callee91,this);}));function getSnapshotRender(_x108){return _getSnapshotRender.apply(this,arguments);}return getSnapshotRender;}()},{key:"getBoundingRect",value:function(){var _getBoundingRect=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee92(t){var e,n,i,a,o,_i13,_Object$entries2,_Object$entries2$_i,s,l,d;return _regeneratorRuntime().wrap(function _callee92$(_context97){while(1)switch(_context97.prev=_context97.next){case 0:e=t.scenePath,n=t.scenes,i=t.cameraOpt;if(!(e&&n&&i&&this.snapshotFullLayer)){_context97.next=27;break;}a=Xt(this.cameraOpt);this.setCameraOpt(i,this.snapshotFullLayer),this.localWork.fullLayer=this.snapshotFullLayer,this.localWork.drawLayer=void 0;_i13=0,_Object$entries2=Object.entries(n);case 5:if(!(_i13<_Object$entries2.length)){_context97.next=19;break;}_Object$entries2$_i=_slicedToArray(_Object$entries2[_i13],2),s=_Object$entries2$_i[0],l=_Object$entries2$_i[1];if(!(l!=null&&l.type)){_context97.next=16;break;}_context97.t0=l==null?void 0:l.type;_context97.next=_context97.t0===at.UpdateNode?11:_context97.t0===at.FullWork?11:16;break;case 11:_context97.next=13;return this.localWork.runFullWork(_objectSpread(_objectSpread({},l),{},{workId:s,msgType:at.FullWork,dataType:Mt.Service,viewId:this.viewId}));case 13:d=_context97.sent;o=Pt(o,d);return _context97.abrupt("break",16);case 16:_i13++;_context97.next=5;break;case 19:_context97.t1=o;if(!_context97.t1){_context97.next=23;break;}_context97.next=23;return this.post({sp:[{type:at.BoundingBox,scenePath:e,rect:o}]});case 23:this.localWork.fullLayer=this.fullLayer;this.localWork.drawLayer=void 0;this.snapshotFullLayer.removeAllChildren();this.setCameraOpt(a,this.fullLayer);case 27:case"end":return _context97.stop();}},_callee92,this);}));function getBoundingRect(_x109){return _getBoundingRect.apply(this,arguments);}return getBoundingRect;}()}]);}(Ai);var Wn=self;Wn.full=new Sm(Wn,qe.Full);
438
+ et(xe,"eraserSizes",Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50})]));var ke=xe;var we=/*#__PURE__*/function(_vt15){function we(t){var _this87;_classCallCheck(this,we);_this87=_callSuper(this,we,[t]);et(_this87,"canRotate",!1);et(_this87,"scaleType",jt.none);et(_this87,"toolsType",ut.BitMapEraser);et(_this87,"tmpPoints",[]);et(_this87,"workOptions");et(_this87,"worldPosition");et(_this87,"worldScaling");et(_this87,"eraserRect");et(_this87,"eraserPolyline");et(_this87,"syncUnitTime",re.syncOpt.interval);et(_this87,"syncIndex",0);et(_this87,"syncTimestamp");_this87.workOptions=t.toolsOpt,_this87.worldPosition=_this87.fullLayer.worldPosition,_this87.worldScaling=_this87.fullLayer.worldScaling,_this87.syncTimestamp=0;return _this87;}_inherits(we,_vt15);return _createClass(we,[{key:"consumeService",value:function consumeService(t){var e=t.op,n=t.isFullWork;this.tmpPoints.length=0;for(var s=0;s<e.length;s+=3){var l=new xt(e[s],e[s+1],e[s+2]);if(this.tmpPoints.length>0){var d=this.tmpPoints[this.tmpPoints.length-1],c=_.Sub(l,d).uni();l.setv(c);}this.tmpPoints.push(l);}if(this.tmpPoints.length<2)return;var i=this.tmpPoints[0].z*2,a=n?this.fullLayer:this.drawLayer||this.fullLayer;return this.draw({consumePoints:this.tmpPoints,layer:a,thickness:i});}},{key:"updateTempPoints",value:function updateTempPoints(t,e){var n=this.tmpPoints.length-1;var i=Date.now();for(var a=0;a<t.length;a+=2){var o=this.tmpPoints.length,s=new xt(t[a],t[a+1]);if(o===0){this.tmpPoints.push(s);continue;}var l=o-1,d=this.tmpPoints[l],c=_.Sub(s,d).uni();s.isNear(d,e/2)||(_.Equals(c,d.v,0.02)&&(this.tmpPoints.pop(),n--),s.setv(c),s.setT(i),this.tmpPoints.push(s));}return Math.max(n,0);}},{key:"getChangeNodes",value:function getChangeNodes(t){if(!this.vNodes)return;var e=this.worldPosition;var n=Bt(this.tmpPoints,t);n=Sr(n,e),n=Hg(n,this.worldScaling,e);var _this$vNodes$getRectI3=this.vNodes.getRectIntersectRange(n),i=_this$vNodes$getRectI3.nodeRange;if(!i.size)return;var a=[];var o=0;for(var l=1;l<this.tmpPoints.length;l++){var d=this.tmpPoints[l-1],c=this.tmpPoints[l];if(l===1&&o===0&&(a[o]=[d.XY]),a[o].push(c.XY),l<this.tmpPoints.length-1){var p=c.getAngleByPoints(d,this.tmpPoints[l+1]);(p<90||p>270)&&(o++,a[o]=[c.XY]);}}this.tmpPoints.length===1&&a.length===0&&a.push([this.tmpPoints[0].XY,this.tmpPoints[0].XY]);var s=/* @__PURE__ */new Map();var _iterator32=_createForOfIteratorHelper(i.entries()),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _step32$value=_slicedToArray(_step32.value,2),_l6=_step32$value[0],_d11=_step32$value[1];var _c6=Sr(_d11.rect,[-e[0],-e[1]]);_c6={x:_c6.x/this.worldScaling[0],y:_c6.y/this.worldScaling[1],w:_c6.w/this.worldScaling[0],h:_c6.h/this.worldScaling[1]};var _p4=[_c6.x,_c6.y,_c6.x+_c6.w,_c6.y+_c6.h],y=[],P=[];var _iterator33=_createForOfIteratorHelper(a),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _v9=_step33.value;Dr.polyline(_v9,_p4,y);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}if(y.length&&_d11.opt){var _iterator34=_createForOfIteratorHelper(y),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var v=_step34.value;var _T40=[];for(var _f34=0;_f34<v.length;_f34++)_f34!==0&&oe(v[_f34],v[_f34-1])||_T40.push.apply(_T40,_toConsumableArray(v[_f34]));P.push(_T40);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}}_d11.opt.eraserlines||(_d11.opt.eraserlines=[]),_d11.opt.eraserlines&&(_d11.opt.eraserlines.push({op:P,thickness:t}),s.set(_l6,_d11));}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}return s;}},{key:"reRenderEffectNodes",value:function(){var _reRenderEffectNodes=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(t){var e,n,i,_iterator35,_step35,_step35$value,a,o,s,l,d;return _regeneratorRuntime().wrap(function _callee28$(_context30){while(1)switch(_context30.prev=_context30.next){case 0:n=t.willUpdateNodes,i=t.worker;_iterator35=_createForOfIteratorHelper(n.entries());_context30.prev=2;_iterator35.s();case 4:if((_step35=_iterator35.n()).done){_context30.next=31;break;}_step35$value=_slicedToArray(_step35.value,2),a=_step35$value[0],o=_step35$value[1];s=o.toolsType,l=i.createWorkShapeNode({workId:a,toolsType:s,toolsOpt:o.opt});l==null||l.setWorkId(a);d=void 0;if(!(s===ut.Image)){_context30.next=15;break;}_context30.next=12;return l.consumeServiceAsync({isFullWork:!0,replaceId:a,worker:i});case 12:d=_context30.sent;_context30.next=28;break;case 15:if(!(s===ut.Text)){_context30.next=21;break;}_context30.next=18;return l.consumeServiceAsync({isFullWork:!0,replaceId:a});case 18:d=_context30.sent;_context30.next=28;break;case 21:_context30.prev=21;d=l==null?void 0:l.consumeService({op:o.op,isFullWork:!0,replaceId:a});_context30.next=28;break;case 25:_context30.prev=25;_context30.t0=_context30["catch"](21);return _context30.abrupt("continue",29);case 28:d&&(e=Pt(e,d));case 29:_context30.next=4;break;case 31:_context30.next=36;break;case 33:_context30.prev=33;_context30.t1=_context30["catch"](2);_iterator35.e(_context30.t1);case 36:_context30.prev=36;_iterator35.f();return _context30.finish(36);case 39:return _context30.abrupt("return",e);case 40:case"end":return _context30.stop();}},_callee28,null,[[2,33,36,39],[21,25]]);}));function reRenderEffectNodes(_x36){return _reRenderEffectNodes.apply(this,arguments);}return reRenderEffectNodes;}()},{key:"consume",value:function consume(t){var e=t.data.op;if(!e||e.length===0)return _objectSpread({type:at.None},this.baseConsumeResult);var n=this.workOptions.thickness,_we$eraserSizes$n=we.eraserSizes[n],i=_we$eraserSizes$n.width,a=_we$eraserSizes$n.height,o=Math.max(i,a)/this.worldScaling[0],s=this.tmpPoints.length,l=this.tmpPoints[this.tmpPoints.length-1],d=this.updateTempPoints(e,o),c=this.tmpPoints[this.tmpPoints.length-1];if(s===this.tmpPoints.length&&c.equalsXY(l.x,l.y))return _objectSpread({type:at.None},this.baseConsumeResult);this.syncIndex=Math.min(this.syncIndex,d,Math.max(0,this.tmpPoints.length-2));var p=this.syncIndex;this.syncTimestamp===0&&(this.syncTimestamp=Date.now());var y=!1;var P=this.tmpPoints.slice(d),x=this.draw({consumePoints:P,layer:this.fullLayer,thickness:o});P[0].t-this.syncTimestamp>this.syncUnitTime&&(y=!0,this.syncTimestamp=P[0].t,this.syncIndex=this.tmpPoints.length);var v=[];return this.tmpPoints.slice(p).forEach(function(T){v.push(T.x,T.y,o/2);}),_objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:at.DrawWork,dataType:Mt.Local,rect:x,op:y?v:void 0,index:y?p*3:void 0,updateNodeOpt:{useAnimation:!0}});}},{key:"draw",value:function draw(t){var e=t.consumePoints,n=t.layer,i=t.thickness,a=this.workId;var o=n.getElementsByName(this.workId)[0],s=Bt(e,i);var d=[{op:[e.map(function(c){return[c.x,c.y];}).flat(1)],thickness:i}];return o||(o=new kt({normalize:!0,name:a,pos:[0,0],anchor:[0.5,0.5],bgcolor:"rgba(0,0,0,0.3)",zIndex:9999}),n.appendChild(o)),this.drawEraserlines({group:o,eraserlines:d,pos:[0,0],layer:n,isClear:!0}),s={x:Math.floor(s.x*this.worldScaling[0]+this.worldPosition[0]-vt.SafeBorderPadding),y:Math.floor(s.y*this.worldScaling[1]+this.worldPosition[1]-vt.SafeBorderPadding),w:Math.floor(s.w*this.worldScaling[0]+2*vt.SafeBorderPadding),h:Math.floor(s.h*this.worldScaling[1]+2*vt.SafeBorderPadding)},s;}},{key:"consumeAll",value:function consumeAll(){var t=this.fullLayer.getElementsByName(this.workId);var e;if(t.length&&(e=vt.getRectFromLayer(this.fullLayer,this.workId)),t.forEach(function(c){c.remove(),c.disconnect();}),!this.tmpPoints.length)return _objectSpread({type:at.None},this.baseConsumeResult);var n=this.workOptions.thickness,_we$eraserSizes$n2=we.eraserSizes[n],i=_we$eraserSizes$n2.width,a=_we$eraserSizes$n2.height,o=Math.max(i,a)/this.worldScaling[0],s=this.getChangeNodes(o);if(!(s!=null&&s.size))return _objectSpread(_objectSpread({type:at.FullWork},this.baseConsumeResult),{},{rect:e});var l=[];this.tmpPoints.map(function(c){l.push(c.x,c.y,o/2);});var d=Zt(l);return _objectSpread(_objectSpread({},this.baseConsumeResult),{},{type:at.FullWork,dataType:Mt.Local,rect:e,ops:d,willUpdateNodes:s});}},{key:"clearTmpPoints",value:function clearTmpPoints(){this.tmpPoints.length=0;}}]);}(vt);// 来源于white-sdk
439
+ et(we,"eraserSizes",Object.freeze([Object.freeze({width:18,height:26}),Object.freeze({width:26,height:34}),Object.freeze({width:34,height:50})]));var Je=we;function Pi(h){switch(h){case ut.Arrow:return mi;case ut.Pencil:return ui;case ut.Straight:return Mi;case ut.Ellipse:return vi;case ut.Polygon:case ut.Triangle:return xi;case ut.Star:case ut.Rhombus:return Si;case ut.Rectangle:return yi;case ut.SpeechBalloon:return Ti;case ut.Text:return Xe;case ut.LaserPen:return di;case ut.Eraser:return se;case ut.PencilEraser:return ke;case ut.BitMapEraser:return Je;case ut.Selector:return Ve;case ut.Image:return Ne;}}function Fr(h,r){var t=h.toolsType,e=_objectWithoutProperties(h,_excluded);switch(t){case ut.Arrow:return new mi(e);case ut.Pencil:return new ui(e);case ut.Straight:return new Mi(e);case ut.Ellipse:return new vi(e);case ut.Polygon:case ut.Triangle:return new xi(e);case ut.Star:case ut.Rhombus:return new Si(e);case ut.Rectangle:return new yi(e);case ut.SpeechBalloon:return new Ti(e);case ut.Text:return new Xe(e);case ut.LaserPen:return new di(e);case ut.Eraser:return new se(e,r);case ut.BitMapEraser:return new Je(e);case ut.PencilEraser:return new ke(e,r);case ut.Selector:return e.vNodes?new Ve(_objectSpread(_objectSpread({},e),{},{vNodes:e.vNodes,drawLayer:e.fullLayer})):void 0;case ut.Image:return new Ne(e);default:return;}}function Oi(h){var r=[],t=["PATH","SPRITE","POLYLINE","RECT","ELLIPSE","LABEL"];var _iterator36=_createForOfIteratorHelper(h),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _e6=_step36.value;if(_e6.tagName==="GROUP"&&_e6.children.length)return Oi(_e6.children);_e6.tagName&&t.includes(_e6.tagName)&&r.push(_e6);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}return r;}function Pt(h,r){if(h&&r){var t=Math.min(h.x,r.x),_e7=Math.min(h.y,r.y),n=Math.max(h.x+h.w,r.x+r.w),i=Math.max(h.y+h.h,r.y+r.h),a=n-t,o=i-_e7;return{x:t,y:_e7,w:a,h:o};}return r||h;}function Bt(h){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var t={x:0,y:0,w:0,h:0};var e=1/0,n=1/0,i=-1/0,a=-1/0;return h.forEach(function(o){var _o$XY=_slicedToArray(o.XY,2),s=_o$XY[0],l=_o$XY[1];e=Math.min(e,s-r),n=Math.min(n,l-r),i=Math.max(i,s+r),a=Math.max(a,l+r);}),t.x=e,t.y=n,t.w=i-e,t.h=a-n,t;}function We(h,r){return!(h.x+h.w<r.x||h.x>r.x+r.w||h.y+h.h<r.y||h.y>r.y+r.h);}function wt(h){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:10;return{x:Math.floor(h.x-r),y:Math.floor(h.y-r),w:Math.ceil(h.w+r*2),h:Math.ceil(h.h+r*2)};}function Sr(h,r){return{x:h.x+r[0],y:h.y+r[1],w:h.w,h:h.h};}function Gg(h,r){var t=new _(h.x,h.y),e=new _(h.x+h.w,h.y),n=new _(h.x+h.w,h.y+h.h),i=new _(h.x,h.y+h.h),a=new _(h.x+h.w/2,h.y+h.h/2),o=Math.PI*r/180,s=_.RotWith(t,a,o),l=_.RotWith(e,a,o),d=_.RotWith(n,a,o),c=_.RotWith(i,a,o);return[s,l,d,c];}function Ei(h,r){var t=Gg(h,r);return Bt(t);}function Hg(h,r,t){var e=new _(h.x,h.y),n=new _(h.x+h.w,h.y),i=new _(h.x+h.w,h.y+h.h),a=new _(h.x,h.y+h.h),o=new _(t[0],t[1]),s=new _(r[0],r[1]),l=_.ScaleWOrigin(e,s,o),d=_.ScaleWOrigin(n,s,o),c=_.ScaleWOrigin(i,s,o),p=_.ScaleWOrigin(a,s,o);return Bt([l,d,c,p]);}function Kg(h,r,t){var e=new _(r[0],r[1]);for(var n=0;n<h.length;n+=3){var i=new _(h[n],h[n+1]),a=Math.PI*t/180,o=_.RotWith(i,e,a);h[n]=o.x,h[n+1]=o.y;}}function Yg(h,r,t){var e=new _(r[0],r[1]);for(var n=0;n<h.length;n+=2){var i=new _(h[n],h[n+1]),a=Math.PI*t/180,o=_.RotWith(i,e,a);h[n]=o.x,h[n+1]=o.y;}}function Ur(h,r,t){var e=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var n=new _(r[0],r[1]);for(var i=0;i<h.length;i+=3){var a=new _(h[i],h[i+1]),o=new _(t[0],t[1]),s=_.ScaleWOrigin(a,o,n);h[i]=s.x+e[0],h[i+1]=s.y+e[1];}}function jr(h,r,t){var e=arguments.length>3&&arguments[3]!==undefined?arguments[3]:[0,0];var n=new _(r[0],r[1]);for(var i=0;i<h.length;i+=2){var a=new _(h[i],h[i+1]),o=new _(t[0],t[1]),s=_.ScaleWOrigin(a,o,n);h[i]=s.x+e[0],h[i+1]=s.y+e[1];}}function Vg(h,r){return h[0]>=r.x&&h[0]<=r.x+r.w&&h[1]>=r.y&&h[1]<=r.y+r.h;}function Ci(h,r){var t=h<=r?1:h/r,e=r<=h?1:r/h;return[t,e];}function Xg(h){var _iterator37=_createForOfIteratorHelper(h),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var r=_step37.value;if(isNaN(r)||r===1/0||r===-1/0)return!1;}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}return!0;}function kg(h){return h!==Math.floor(h);}function Jg(h){var r=h.toString();return r.indexOf(".")!==-1?r.split(".")[1].length:0;}function Zg(h,r){for(;r!==0;){var _ref168=[r,h%r];h=_ref168[0];r=_ref168[1];}return h;}var Qg=function Qg(h){if(h.tagName==="GROUP"){var r=Object.getOwnPropertySymbols(h).find(function(t){return t.toString()==="Symbol(sealed)";});if(r&&h[r])return!0;}return!1;};function pe(h){return"".concat(Ze(h.x),",").concat(Ze(h.y)," ");}function me(h,r){return"".concat(Ze((h.x+r.x)/2),",").concat(Ze((h.y+r.y)/2)," ");}function Ze(h){return+h.toFixed(4);}var fr=function fr(h,r){return h.x+h.w<r.x||h.x>r.x+r.w||h.y+h.h<r.y||h.y>r.y+r.h?Te.outside:h.x>=r.x&&h.y>=r.y&&h.x+h.w<=r.x+r.w&&h.y+h.h<=r.y+r.h?Te.inside:Te.intersect;};function qg(h){var r=0;for(var t=0;t<h.length;t++){var _e8=h.charCodeAt(t);_e8>=1&&_e8<=126||65376<=_e8&&_e8<=65439?r++:r+=2;}return r;}var be="cursorhover",Cn=20,Qe="mainView";var _g=/*#__PURE__*/function(){function _g(r,t){_classCallCheck(this,_g);et(this,"viewId");et(this,"scene");et(this,"fullLayer");et(this,"curNodeMap",/* @__PURE__ */new Map());et(this,"targetNodeMap",[]);et(this,"highLevelIds");et(this,"canClearUids");et(this,"localUid");this.viewId=r,this.scene=t;}return _createClass(_g,[{key:"init",value:function init(r){this.fullLayer=r;}},{key:"get",value:function get(r){return this.curNodeMap.get(r);}},{key:"setLocalUid",value:function setLocalUid(r){this.localUid=r;}},{key:"getLocalUid",value:function getLocalUid(){return this.localUid;}},{key:"setCanClearUids",value:function setCanClearUids(r){this.canClearUids=r;}},{key:"getCanClearUids",value:function getCanClearUids(){return this.canClearUids;}},{key:"getCanEraserNodes",value:function getCanEraserNodes(r){var t=/* @__PURE__ */new Map();var _iterator38=_createForOfIteratorHelper(r.entries()),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _step38$value=_slicedToArray(_step38.value,2),_e9=_step38$value[0],n=_step38$value[1];n.toolsType===ut.Image&&n.opt.locked||n.toolsType===ut.Text&&(n.opt.workState===It.Doing||n.opt.workState===It.Start)||this.isCanClearWorkId(_e9)&&t.set(_e9,n);}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return t;}},{key:"getNodesByType",value:function getNodesByType(r){var t=/* @__PURE__ */new Map();return this.curNodeMap.forEach(function(e,n){e.toolsType===r&&t.set(n,e);}),t;}},{key:"hasRenderNodes",value:function hasRenderNodes(){return!0;}},{key:"has",value:function has(r){return this.curNodeMap.has(r);}},{key:"setInfo",value:function setInfo(r,t){var e=this.curNodeMap.get(r)||{name:r,rect:t.rect};t.rect&&(e.rect=Xt(t.rect)),t.op&&Xg(t.op)&&(e.op=Xt(t.op)),t.canRotate&&(e.canRotate=t.canRotate),t.scaleType&&(e.scaleType=t.scaleType),t.opt&&(e.opt=Xt(t.opt)),t.toolsType&&(e.toolsType=t.toolsType),t.centerPos&&(e.centerPos=Xt(t.centerPos)),ye(t.isSelected)&&(e.isSelected=t.isSelected),e.rect?this.curNodeMap.set(r,e):this.curNodeMap["delete"](r);}},{key:"selected",value:function selected(r){this.setInfo(r,{isSelected:!0});}},{key:"unSelected",value:function unSelected(r){this.setInfo(r,{isSelected:!1});}},{key:"delete",value:function _delete(r){this.curNodeMap["delete"](r);}},{key:"clear",value:function clear(){this.curNodeMap.clear(),this.targetNodeMap.length=0;}},{key:"getRectIntersectRange",value:function getRectIntersectRange(r){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var n;var i=/* @__PURE__ */new Map();var _iterator39=_createForOfIteratorHelper(this.curNodeMap.entries()),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _step39$value=_slicedToArray(_step39.value,2),a=_step39$value[0],o=_step39$value[1];if(We(r,o.rect)){if(t&&o.toolsType===ut.Image&&o.opt.locked||e&&o.toolsType===ut.Text&&(o.opt.workState===It.Doing||o.opt.workState===It.Start))continue;n=Pt(n,o.rect),i.set(a,o);}}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}return{rectRange:n,nodeRange:i};}},{key:"getNodeRectFormShape",value:function getNodeRectFormShape(r,t){var e=Pi(t.toolsType);return this.fullLayer&&(e==null?void 0:e.getRectFromLayer(this.fullLayer,r));}},{key:"updateNodeRect",value:function updateNodeRect(r){var t=this.curNodeMap.get(r);if(t){var _e10=this.getNodeRectFormShape(r,t);if(!_e10){this.curNodeMap["delete"](r);return;}t.rect=_e10,this.curNodeMap.set(r,t);}}},{key:"updateHighLevelNodesRect",value:function updateHighLevelNodesRect(r){this.highLevelIds=r;var _iterator40=_createForOfIteratorHelper(this.highLevelIds.keys()),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var t=_step40.value;this.updateNodeRect(t);}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}},{key:"updateLowLevelNodesRect",value:function updateLowLevelNodesRect(){var r;var _iterator41=_createForOfIteratorHelper(this.curNodeMap.keys()),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var t=_step41.value;(r=this.highLevelIds)!=null&&r.has(t)||this.updateNodeRect(t);}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}}},{key:"clearHighLevelIds",value:function clearHighLevelIds(){this.highLevelIds=void 0;}},{key:"setTargetAssignKeys",value:function setTargetAssignKeys(r){var t=/* @__PURE__ */new Map();var _iterator42=_createForOfIteratorHelper(r),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _e11=_step42.value;var n=this.curNodeMap.get(_e11);n&&t.set(_e11,Xt(n));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return this.targetNodeMap.push(Xt(t)),this.targetNodeMap.length-1;}},{key:"setTarget",value:function setTarget(){return this.targetNodeMap.push(Xt(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(r){return this.targetNodeMap[r];}},{key:"deleteTarget",value:function deleteTarget(r){this.targetNodeMap.length=r;}},{key:"clearTarget",value:function clearTarget(){this.targetNodeMap.length=0;}},{key:"isLocalWorkId",value:function isLocalWorkId(r){return r.split(De).length===1;}},{key:"isCanClearWorkId",value:function isCanClearWorkId(r){if(this.canClearUids===void 0||this.canClearUids===!0)return!0;if(Iu(this.canClearUids)){var t=r.split(De);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 Ai=/*#__PURE__*/function(){function Ai(r,t,e){_classCallCheck(this,Ai);et(this,"viewId");et(this,"scene");et(this,"fullLayer");et(this,"vNodes");et(this,"dpr");et(this,"contextType");et(this,"opt");et(this,"cameraOpt");et(this,"isSafari",!1);et(this,"combinePostMsg",/* @__PURE__ */new Set());et(this,"workerTaskId");et(this,"protectedTask");et(this,"hasPriorityDraw",!0);et(this,"delayPostDoneResolve");et(this,"cacheImages",/* @__PURE__ */new Map());et(this,"imageResolveMap",/* @__PURE__ */new Map());var n,i;if(this.viewId=r,this.opt=t,this.dpr=t.dpr,this.contextType=this.getSupportContextType(e,(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.createRenderLayer(t);}catch(_unused25){if(this.contextType!=="2d")this.contextType="2d",(i=this.scene)==null||i.disconnect(),this.createRenderLayer(t);else throw new Error("Sorry, your browser doesn't support canvas context type ".concat(this.contextType));}this.vNodes=new _g(r,this.scene);}return _createClass(Ai,[{key:"createRenderLayer",value:function createRenderLayer(r){this.scene=this.createScene(r.offscreenCanvasOpt);var t=re.bufferSize.full,e=re.bufferSize.sub;this.fullLayer=this.createLayer("fullLayer",this.scene,_objectSpread(_objectSpread({},r.layerOpt),{},{bufferSize:this.viewId===Qe?t:e}));}},{key:"getCachedImages",value:function getCachedImages(r){var t;return(t=this.cacheImages.get(r))==null?void 0:t.imageBitmap;}},{key:"getCachedImagesByWorkId",value:function getCachedImagesByWorkId(r){var _iterator43=_createForOfIteratorHelper(this.cacheImages.entries()),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _step43$value=_slicedToArray(_step43.value,2),t=_step43$value[0],_e12=_step43$value[1];if(t===r&&_e12.imageBitmap)return _e12.imageBitmap;}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}}},{key:"deleteCachedImagesByWorkId",value:function deleteCachedImagesByWorkId(r,t){var _iterator44=_createForOfIteratorHelper(this.cacheImages.entries()),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var _step44$value=_slicedToArray(_step44.value,2),_e13=_step44$value[0],n=_step44$value[1];t&&_e13===t||n.workId===r&&(n.imageBitmap.close(),this.cacheImages["delete"](_e13));}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}},{key:"clearCacheImages",value:function clearCacheImages(){this.cacheImages.forEach(function(r){return r.imageBitmap.close();}),this.cacheImages.clear();}},{key:"clearImageResolveMap",value:function clearImageResolveMap(){this.imageResolveMap.forEach(function(_ref169){var r=_ref169.timer;r&&clearTimeout(r);}),this.imageResolveMap.clear();}},{key:"setHasPriorityDraw",value:function setHasPriorityDraw(r){this.hasPriorityDraw=r;}},{key:"getPriorityDraw",value:function getPriorityDraw(){return this.hasPriorityDraw;}},{key:"setIsSafari",value:function setIsSafari(r){this.isSafari=r;}},{key:"on",value:function(){var _on=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(r){var t,e,n,i,a,o,s,_s5,l,d,c;return _regeneratorRuntime().wrap(function _callee29$(_context31){while(1)switch(_context31.prev=_context31.next){case 0:t=r.msgType,e=r.toolsType,n=r.opt,i=r.imageSrc,a=r.imageBitmap,o=r.workId;_context31.t0=t;_context31.next=_context31.t0===at.UpdateCamera?4:_context31.t0===at.Destroy?7:_context31.t0===at.Clear?9:_context31.t0===at.UpdateTools?12:_context31.t0===at.GetImageBitMap?14:16;break;case 4:_context31.next=6;return this.updateCamera(r);case 6:return _context31.abrupt("break",16);case 7:this.destroy();return _context31.abrupt("break",16);case 9:_context31.next=11;return this.clearAll();case 11:return _context31.abrupt("break",16);case 12:if(e&&n){s={toolsType:e,toolsOpt:n};this.localWork.setToolsOpt(s);}return _context31.abrupt("break",16);case 14:if(i&&a&&o){_s5=o.toString();this.cacheImages.set(i,{imageBitmap:a,workId:_s5});l=this.imageResolveMap.get(i);if(l){d=l.resolve,c=l.timer;c&&clearTimeout(c),d&&d(i);}this.deleteCachedImagesByWorkId(_s5,i);}return _context31.abrupt("break",16);case 16:case"end":return _context31.stop();}},_callee29,this);}));function on(_x37){return _on.apply(this,arguments);}return on;}()},{key:"getIconSize",value:function getIconSize(r,t){var e=r*3,n=t*3;return e<=50||n<=50?[50,50]:e<=100||n<=100?[100,100]:e<=400||n<=400?[400,400]:e<=800||n<=800?[800,800]:e<=1600||n<=1600?[1600,1600]:[2e3,2e3];}},{key:"loadImageBitMap",value:function(){var _loadImageBitMap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(r){var _this88=this;var t,e,n,i,a,o,s,l,d,c,p,_this$getIconSize,_this$getIconSize2,v,_T41,_v10,_v11,x;return _regeneratorRuntime().wrap(function _callee30$(_context32){while(1)switch(_context32.prev=_context32.next){case 0:t=r.toolsType,e=r.opt,n=r.workId,i=r.isSubWorker;if(!(t===ut.Image&&e&&n)){_context32.next=19;break;}a=n.toString(),o=e.src,s=e.type,l=e.width,d=e.height,c=e.strokeColor;if(!(!o||!s||!l||!d)){_context32.next=5;break;}return _context32.abrupt("return");case 5:p=o;if(s===xr.Iconify){_this$getIconSize=this.getIconSize(l,d),_this$getIconSize2=_slicedToArray(_this$getIconSize,2),v=_this$getIconSize2[0],_T41=_this$getIconSize2[1];p="".concat(o,"?width=").concat(v,"&height=").concat(_T41,"&color=").concat(c);}if(!this.cacheImages.has(p)){_context32.next=11;break;}_v10=this.getCachedImages(p);if(!_v10){_context32.next=11;break;}return _context32.abrupt("return",_v10);case 11:if(!this.imageResolveMap.has(p)){_context32.next=15;break;}_v11=this.getCachedImagesByWorkId(a);if(!_v11){_context32.next=15;break;}return _context32.abrupt("return",_v11);case 15:_context32.next=17;return new Promise(function(v){var T=_this88.imageResolveMap.get(p)||{resolve:void 0,timer:void 0};T.timer&&clearTimeout(T.timer),T.resolve=v,T.timer=setTimeout(function(){var f=_this88.imageResolveMap.get(p);f!=null&&f.resolve&&f.resolve(p);},5e3),_this88.imageResolveMap.set(p,T),_this88._post({sp:[{imageSrc:p,workId:a,viewId:_this88.viewId,isgl:!!_this88.fullLayer.parent.gl,isSubWorker:i,type:at.GetImageBitMap}]});});case 17:x=_context32.sent;return _context32.abrupt("return",(this.imageResolveMap["delete"](x),this.getCachedImages(p)));case 19:case"end":return _context32.stop();}},_callee30,this);}));function loadImageBitMap(_x38){return _loadImageBitMap.apply(this,arguments);}return loadImageBitMap;}()},{key:"createLocalWork",value:function createLocalWork(r){var t=r.workId,e=r.opt,n=r.toolsType;t&&e&&(!this.localWork.getToolsOpt()&&n&&this.setToolsOpt({toolsType:n,toolsOpt:e}),this.setWorkOpt({workId:t,toolsOpt:e}));}},{key:"updateScene",value:function updateScene(r){this.scene.attr(_objectSpread({},r));var t=r.width,e=r.height;this.scene.container.width=t,this.scene.container.height=e,this.scene.width=t,this.scene.height=e,this.updateLayer({width:t,height:e});}},{key:"updateLayer",value:function updateLayer(r){var t=r.width,e=r.height;this.fullLayer&&(this.fullLayer.parent.setAttribute("width",t),this.fullLayer.parent.setAttribute("height",e),this.fullLayer.setAttribute("size",[t,e]),this.fullLayer.setAttribute("pos",[t*0.5,e*0.5]));}},{key:"getSupportContextType",value:function getSupportContextType(r,t){var e=new OffscreenCanvas(100,100);var n=["2d"];r===qe.Full&&this.viewId===Qe&&(n=["webgl2","webgl","2d"],t&&n.unshift(t));for(var _i9=0,_n7=n;_i9<_n7.length;_i9++){var i=_n7[_i9];try{if(e.getContext(i))return i;}catch(_unused26){continue;}}}},{key:"createScene",value:function createScene(r){var t=r.width,e=r.height,n=new OffscreenCanvas(t,e);r.contextType&&delete r.contextType;var i=new ts(_objectSpread(_objectSpread({container:n,displayRatio:this.dpr,depth:!1,desynchronized:!0,failIfMajorPerformanceCaveat:!0},r),{},{contextType:this.contextType,id:this.viewId}));return i.setAttribute("id",this.viewId),i;}},{key:"createLayer",value:function createLayer(r,t,e){var n=e.width,i=e.height,a="offscreen-".concat(r),o=t.layer(a,e),s=new kt({anchor:[0.5,0.5],pos:[n*0.5,i*0.5],size:[n,i],name:"viewport",id:r});return o.append(s),s;}},{key:"clearAll",value:function(){var _clearAll=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(){var r;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();}),this.fullLayer.removeAllChildren()),this.clearCacheImages(),this.clearImageResolveMap(),this.localWork.destroy(),(r=this.serviceWork)==null||r.destroy();case 1:case"end":return _context33.stop();}},_callee31,this);}));function clearAll(){return _clearAll.apply(this,arguments);}return clearAll;}()},{key:"setToolsOpt",value:function setToolsOpt(r){this.localWork.setToolsOpt(r);}},{key:"setWorkOpt",value:function setWorkOpt(r){var t=r.workId,e=r.toolsOpt;t&&e&&this.localWork.setWorkOptions(t.toString(),e);}},{key:"destroy",value:function destroy(){var r;this.vNodes.clear(),this.fullLayer.remove(),this.clearCacheImages(),this.clearImageResolveMap(),this.scene.remove(),this.localWork.destroy(),(r=this.serviceWork)==null||r.destroy();}},{key:"post",value:function(){var _post=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(r){return _regeneratorRuntime().wrap(function _callee32$(_context34){while(1)switch(_context34.prev=_context34.next){case 0:this.combinePostMsg.add(r);_context34.next=3;return this.runBatchPostData();case 3:case"end":return _context34.stop();}},_callee32,this);}));function post(_x39){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===qe.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 i,a;this.workerTaskId=void 0;var r=[],t=[];var e;var n=/* @__PURE__ */new Set();var _iterator45=_createForOfIteratorHelper(this.combinePostMsg.values()),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var o=_step45.value;if((i=o.render)!=null&&i.length){var _iterator46=_createForOfIteratorHelper(o.render),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var s=_step46.value;var l=!1;if(s.workId&&n.add(s.workId),s.isClearAll&&(s.rect=this.getSceneRect(),s.isClear=!0,delete s.isClearAll),s.drawCanvas){var d=this.getLayer(s.drawCanvas);if(!d||!(d.parent instanceof _i))continue;if(d.parent.render(),s.isDrawAll){var c=this.getSceneRect();s.rect=c,delete s.isDrawAll;}}var _iterator47=_createForOfIteratorHelper(r),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _d12=_step47.value;if(s.viewId===_d12.viewId){s.isClear&&_d12.clearCanvas&&_d12.isClear&&_d12.clearCanvas===s.clearCanvas&&(_d12.rect=Pt(_d12.rect,s.rect),l=!0),_d12.drawCanvas&&_d12.drawCanvas===s.drawCanvas&&(_d12.rect=Pt(_d12.rect,s.rect),l=!0);continue;}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}l||(s.isClear&&!s.drawCanvas?r.unshift(s):r.push(s));}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}}if((a=o.sp)!=null&&a.length){var _iterator48=_createForOfIteratorHelper(o.sp),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var _s6=_step48.value;var _l7=!1;var _iterator49=_createForOfIteratorHelper(t),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _d13=_step49.value;if(oe(_s6,_d13)){_l7=!0;break;}}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}_l7||t.push(_s6);}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}_t(o.drawCount)&&(e=o.drawCount);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}return this.combinePostMsg.clear(),{render:r,sp:t,drawCount:e,workIds:n,viewId:this.viewId};}},{key:"safariFixRect",value:function safariFixRect(r,t){if(r.w+r.x<=0||r.h+r.y<=0||r.w<=0||r.h<=0)return;var e=this.scene.width,n=this.scene.height,i={x:Math.floor(Math.max(0,r.x)),y:Math.floor(Math.max(0,r.y)),w:Math.floor(Math.min(e,r.w)),h:Math.floor(Math.min(n,r.h))};if(i.x+i.w>e&&(i.w=Math.floor(e-i.x)),i.y+i.h>n&&(i.h=Math.floor(n-i.y)),kg(t)){var a=Jg(t),o=Math.pow(10,a),s=Zg(o,t*o),l=i.x%s,d=i.x-l;d>=0?(i.x=d,i.w=i.w+l):(i.x=0,i.w=i.w+l-d);var c=i.y%s,p=i.y-c;p>=0?(i.y=p,i.h=i.h+c):(i.y=0,i.h=i.h+c-p);}return i;}},{key:"getSceneRect",value:function getSceneRect(){var _this$scene=this.scene,r=_this$scene.width,t=_this$scene.height;return{x:0,y:0,w:Math.floor(r),h:Math.floor(t)};}}]);}();var Ri=/*#__PURE__*/function(){function Ri(r){_classCallCheck(this,Ri);et(this,"viewId");et(this,"vNodes");et(this,"thread");et(this,"fullLayer");et(this,"drawLayer");et(this,"_post");et(this,"tmpOpt");et(this,"workShapes",/* @__PURE__ */new Map());et(this,"drawCount",0);et(this,"syncUnitTime",re.syncOpt.interval);this.thread=r.thread,this.viewId=r.viewId,this.vNodes=r.vNodes,this.fullLayer=r.fullLayer,this.drawLayer=r.drawLayer,this._post=this.thread.post.bind(r.thread);}return _createClass(Ri,[{key:"destroy",value:function destroy(){this.workShapes.clear();}},{key:"getWorkShapes",value:function getWorkShapes(){return this.workShapes;}},{key:"getWorkShape",value:function getWorkShape(r){return this.workShapes.get(r);}},{key:"createWorkShape",value:function createWorkShape(r,t){if(r&&this.tmpOpt){var _e14={toolsType:this.tmpOpt.toolsType,toolsOpt:t||this.tmpOpt.toolsOpt},n=this.createWorkShapeNode(_objectSpread(_objectSpread({},_e14),{},{workId:r}));n&&this.workShapes.set(r,n);}}},{key:"setWorkOptions",value:function setWorkOptions(r,t){var e=this.getWorkShape(r);e||this.createWorkShape(r,t),e==null||e.setWorkOptions(t);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(r){var t;return Fr(_objectSpread(_objectSpread({},r),{},{vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer}),(t=this.thread)==null?void 0:t.serviceWork);}},{key:"setToolsOpt",value:function setToolsOpt(r){var t,e,n;((t=this.tmpOpt)==null?void 0:t.toolsType)!==r.toolsType&&(e=this.tmpOpt)!=null&&e.toolsType&&this.clearAllWorkShapesCache(),this.tmpOpt=r,(n=r.toolsOpt)!=null&&n.syncUnitTime&&(this.syncUnitTime=r.toolsOpt.syncUnitTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"clearWorkShapeNodeCache",value:function clearWorkShapeNodeCache(r){var t;(t=this.getWorkShape(r))==null||t.clearTmpPoints(),this.workShapes["delete"](r);}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.workShapes.forEach(function(r){return r.clearTmpPoints();}),this.workShapes.clear();}},{key:"setFullWork",value:function setFullWork(r){var t=r.workId,e=r.opt,n=r.toolsType;if(t&&e&&n){var i=t.toString();var a;return t&&this.workShapes.has(i)?(a=this.workShapes.get(i),a==null||a.setWorkOptions(e)):a=this.createWorkShapeNode({toolsOpt:e,toolsType:n,workId:i}),a?(this.workShapes.set(i,a),a):void 0;}}}]);}();var t0=ee,e0=function e0(){return t0.Date.now();},r0=e0,n0=/\s/;function i0(h){for(var r=h.length;r--&&n0.test(h.charAt(r)););return r;}var s0=i0,o0=s0,a0=/^\s+/;function l0(h){return h&&h.slice(0,o0(h)+1).replace(a0,"");}var c0=l0,f0=de,h0=ne,u0="[object Symbol]";function d0(h){return _typeof(h)=="symbol"||h0(h)&&f0(h)==u0;}var g0=d0,p0=c0,An=he,m0=g0,Rn=NaN,v0=/^[-+]0x[0-9a-f]+$/i,y0=/^0b[01]+$/i,S0=/^0o[0-7]+$/i,x0=parseInt;function T0(h){if(typeof h=="number")return h;if(m0(h))return Rn;if(An(h)){var r=typeof h.valueOf=="function"?h.valueOf():h;h=An(r)?r+"":r;}if(typeof h!="string")return h===0?h:+h;h=p0(h);var t=y0.test(h);return t||S0.test(h)?x0(h.slice(2),t?2:8):v0.test(h)?Rn:+h;}var M0=T0,P0=he,hr=r0,In=M0,O0="Expected a function",E0=Math.max,C0=Math.min;function A0(h,r,t){var e,n,i,a,o,s,l=0,d=!1,c=!1,p=!0;if(typeof h!="function")throw new TypeError(O0);r=In(r)||0,P0(t)&&(d=!!t.leading,c="maxWait"in t,i=c?E0(In(t.maxWait)||0,r):i,p="trailing"in t?!!t.trailing:p);function y(M){var E=e,A=n;return e=n=void 0,l=M,a=h.apply(A,E),a;}function P(M){return l=M,o=setTimeout(T,r),d?y(M):a;}function x(M){var E=M-s,A=M-l,b=r-E;return c?C0(b,i-A):b;}function v(M){var E=M-s,A=M-l;return s===void 0||E>=r||E<0||c&&A>=i;}function T(){var M=hr();if(v(M))return f(M);o=setTimeout(T,x(M));}function f(M){return o=void 0,p&&e?y(M):(e=n=void 0,a);}function g(){o!==void 0&&clearTimeout(o),l=0,e=s=n=o=void 0;}function u(){return o===void 0?a:f(hr());}function m(){var M=hr(),E=v(M);if(e=arguments,n=this,s=M,E){if(o===void 0)return P(s);if(c)return clearTimeout(o),o=setTimeout(T,r),y(s);}return o===void 0&&(o=setTimeout(T,r)),a;}return m.cancel=g,m.flush=u,m;}var R0=A0,I0=R0,L0=he,b0="Expected a function";function w0(h,r,t){var e=!0,n=!0;if(typeof h!="function")throw new TypeError(b0);return L0(t)&&(e="leading"in t?!!t.leading:e,n="trailing"in t?!!t.trailing:n),I0(h,r,{leading:e,maxWait:r,trailing:n});}var D0=w0,N0=/* @__PURE__ */fe(D0);function W0(h){return h;}var Ii=W0;function B0(h,r,t){switch(t.length){case 0:return h.call(r);case 1:return h.call(r,t[0]);case 2:return h.call(r,t[0],t[1]);case 3:return h.call(r,t[0],t[1],t[2]);}return h.apply(r,t);}var F0=B0,U0=F0,Ln=Math.max;function j0(h,r,t){return r=Ln(r===void 0?h.length-1:r,0),function(){for(var e=arguments,n=-1,i=Ln(e.length-r,0),a=Array(i);++n<i;)a[n]=e[r+n];n=-1;for(var o=Array(r+1);++n<r;)o[n]=e[n];return o[r]=t(a),U0(h,this,o);};}var $0=j0;function z0(h){return function(){return h;};}var G0=z0,H0=G0,bn=Gn,K0=Ii,Y0=bn?function(h,r){return bn(h,"toString",{configurable:!0,enumerable:!1,value:H0(r),writable:!0});}:K0,V0=Y0,X0=800,k0=16,J0=Date.now;function Z0(h){var r=0,t=0;return function(){var e=J0(),n=k0-(e-t);if(t=e,n>0){if(++r>=X0)return arguments[0];}else r=0;return h.apply(void 0,arguments);};}var Q0=Z0,q0=V0,_0=Q0,tp=_0(q0),ep=tp,rp=Ii,np=$0,ip=ep;function sp(h,r){return ip(np(h,r,rp),h+"");}var op=sp;function ap(h,r,t,e){for(var n=h.length,i=t+(e?1:-1);e?i--:++i<n;)if(r(h[i],i,h))return i;return-1;}var lp=ap;function cp(h){return h!==h;}var fp=cp;function hp(h,r,t){for(var e=t-1,n=h.length;++e<n;)if(h[e]===r)return e;return-1;}var up=hp,dp=lp,gp=fp,pp=up;function mp(h,r,t){return r===r?pp(h,r,t):dp(h,gp,t);}var vp=mp,yp=vp;function Sp(h,r){var t=h==null?0:h.length;return!!t&&yp(h,r,0)>-1;}var Li=Sp;function xp(h,r,t){for(var e=-1,n=h==null?0:h.length;++e<n;)if(t(r,h[e]))return!0;return!1;}var bi=xp;function Tp(h,r){for(var t=-1,e=h==null?0:h.length,n=Array(e);++t<e;)n[t]=r(h[t],t,h);return n;}var Mp=Tp,Pp=Nr,Op=Li,Ep=bi,Cp=Mp,Ap=sr,Rp=Wr,Ip=200;function Lp(h,r,t,e){var n=-1,i=Op,a=!0,o=h.length,s=[],l=r.length;if(!o)return s;t&&(r=Cp(r,Ap(t))),e?(i=Ep,a=!1):r.length>=Ip&&(i=Rp,a=!1,r=new Pp(r));t:for(;++n<o;){var d=h[n],c=t==null?d:t(d);if(d=e||d!==0?d:0,a&&c===c){for(var p=l;p--;)if(r[p]===c)continue t;s.push(d);}else i(r,c,e)||s.push(d);}return s;}var bp=Lp,wn=Be,wp=Vn,Dp=Fe,Dn=wn?wn.isConcatSpreadable:void 0;function Np(h){return Dp(h)||wp(h)||!!(Dn&&h&&h[Dn]);}var Wp=Np,Bp=Lr,Fp=Wp;function wi(h,r,t,e,n){var i=-1,a=h.length;for(t||(t=Fp),n||(n=[]);++i<a;){var o=h[i];r>0&&t(o)?r>1?wi(o,r-1,t,e,n):Bp(n,o):e||(n[n.length]=o);}return n;}var Up=wi;function jp(){}var $p=jp,ur=ni,zp=$p,Gp=Br,Hp=1/0,Kp=ur&&1/Gp(new ur([,-0]))[1]==Hp?function(h){return new ur(h);}:zp,Yp=Kp,Vp=Nr,Xp=Li,kp=bi,Jp=Wr,Zp=Yp,Qp=Br,qp=200;function _p(h,r,t){var e=-1,n=Xp,i=h.length,a=!0,o=[],s=o;if(t)a=!1,n=kp;else if(i>=qp){var l=r?null:Zp(h);if(l)return Qp(l);a=!1,n=Jp,s=new Vp();}else s=r?[]:o;t:for(;++e<i;){var d=h[e],c=r?r(d):d;if(d=t||d!==0?d:0,a&&c===c){for(var p=s.length;p--;)if(s[p]===c)continue t;r&&s.push(c),o.push(d);}else n(s,c,t)||(s!==o&&s.push(c),o.push(d));}return o;}var tm=_p,em=bp,rm=Up,Nn=tm;function nm(h,r,t){var e=h.length;if(e<2)return e?Nn(h[0]):[];for(var n=-1,i=Array(e);++n<e;)for(var a=h[n],o=-1;++o<e;)o!=n&&(i[n]=em(i[n]||a,h[o],r,t));return Nn(rm(i,1),r,t);}var im=nm,sm=Cr,om=ne;function am(h){return om(h)&&sm(h);}var lm=am,cm=Qn,fm=op,hm=im,um=lm,dm=fm(function(h){return hm(cm(h,um));}),gm=dm,pm=/* @__PURE__ */fe(gm);var mm=/*#__PURE__*/function(_Ri){function mm(t){var _this90;_classCallCheck(this,mm);_this90=_callSuper(this,mm,[t]);et(_this90,"combineUnitTime",re.bezier.combineUnitTime);et(_this90,"combineTimerId");et(_this90,"combineDrawResolve");et(_this90,"combineDrawActiveId");et(_this90,"drawWorkActiveId");et(_this90,"effectSelectNodeData",/* @__PURE__ */new Set());et(_this90,"batchEraserWorks",/* @__PURE__ */new Set());et(_this90,"batchEraserRemoveNodes",/* @__PURE__ */new Set());et(_this90,"batchEraserCombine",N0(function(){var t=_this90.updateBatchEraserCombineNode(_this90.batchEraserWorks,_this90.batchEraserRemoveNodes);_this90.batchEraserWorks.clear(),_this90.batchEraserRemoveNodes.clear(),t.length&&_this90._post({render:t});},200,{leading:!1}));return _this90;}_inherits(mm,_Ri);return _createClass(mm,[{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(_x40){return _loadImageBitMap2.apply(this,arguments);}return loadImageBitMap;}()},{key:"consumeDraw",value:function(){var _consumeDraw=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(t,e){var _this91=this;var n,i,a,o,s,l,d;return _regeneratorRuntime().wrap(function _callee35$(_context37){while(1)switch(_context37.prev=_context37.next){case 0:n=t.op,i=t.workId,a=t.scenePath;if(!(n!=null&&n.length&&i)){_context37.next=57;break;}o=i.toString(),s=this.getWorkShape(o);if(s){_context37.next=5;break;}return _context37.abrupt("return");case 5:l=s.toolsType;if(!(l===ut.LaserPen)){_context37.next=8;break;}return _context37.abrupt("return");case 8:_context37.t0=this.combineDrawActiveId&&this.combineDrawActiveId!==o;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:a,viewId:this.viewId,msgType:at.DrawWork,dataType:Mt.Local},e);case 13:_context37.t1=this.drawWorkActiveId&&this.drawWorkActiveId!==o;if(!_context37.t1){_context37.next=18;break;}_context37.next=17;return this.consumeDrawAll({workId:this.drawWorkActiveId,scenePath:a,viewId:this.viewId,msgType:at.DrawWork,dataType:Mt.Local},e);case 17:this.drawWorkActiveId=void 0;case 18:!this.drawWorkActiveId&&o!==Nt&&(this.drawWorkActiveId=o);d=s.consume({data:t,isFullWork:!0});_context37.t2=l;_context37.next=_context37.t2===ut.Selector?23:_context37.t2===ut.PencilEraser?29:_context37.t2===ut.BitMapEraser?34:_context37.t2===ut.Eraser?39:_context37.t2===ut.Arrow?44:_context37.t2===ut.Straight?44:_context37.t2===ut.Ellipse?44:_context37.t2===ut.Rectangle?44:_context37.t2===ut.Star?44:_context37.t2===ut.Polygon?44:_context37.t2===ut.SpeechBalloon?44:_context37.t2===ut.Pencil?50:57;break;case 23:_context37.t3=d.type===at.Select;if(!_context37.t3){_context37.next=28;break;}d.selectIds&&e.runReverseSelectWork(d.selectIds);_context37.next=28;return this.drawSelector(d);case 28:return _context37.abrupt("break",57);case 29:_context37.t4=d!=null&&d.rect;if(!_context37.t4){_context37.next=33;break;}_context37.next=33;return this.drawPencilEraser(d);case 33:return _context37.abrupt("break",57);case 34:_context37.t5=d!=null&&d.rect;if(!_context37.t5){_context37.next=38;break;}_context37.next=38;return this.drawBitMapEraser(d);case 38:return _context37.abrupt("break",57);case 39:_context37.t6=d!=null&&d.rect;if(!_context37.t6){_context37.next=43;break;}_context37.next=43;return this.drawEraser(d);case 43:return _context37.abrupt("break",57);case 44:_context37.t7=d;if(!_context37.t7){_context37.next=49;break;}this.drawCount++;_context37.next=49;return this.drawShape(d);case 49:return _context37.abrupt("break",57);case 50:this.drawCount++;this.combineTimerId||new Promise(function(c){_this91.combineDrawActiveId=o,_this91.combineDrawResolve=c,_this91.combineTimerId=setTimeout(function(){_this91.combineTimerId=void 0,_this91.combineDrawResolve&&_this91.combineDrawResolve(!0);},_this91.combineUnitTime);}).then(function(c){c&&_this91.drawPencilCombine(o,_this91.drawCount),_this91.combineDrawResolve=void 0;});_context37.t8=d;if(!_context37.t8){_context37.next=56;break;}_context37.next=56;return this.drawPencil(d);case 56:return _context37.abrupt("break",57);case 57:case"end":return _context37.stop();}},_callee35,this);}));function consumeDraw(_x41,_x42){return _consumeDraw.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(t,e){var o,s,l,d,n,i,a,c,p,y,P,x,v;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,i=t.scenePath,a=t.isLockSentEventCursor;if(!n){_context38.next=42;break;}c=n.toString();this.drawWorkActiveId===c&&(this.drawWorkActiveId=void 0);p=this.workShapes.get(c);if(p){_context38.next=8;break;}return _context38.abrupt("return");case 8:y=p.toolsType;if(!(y===ut.LaserPen)){_context38.next=11;break;}return _context38.abrupt("return");case 11:P=this.workShapes.get(be),x=(o=P==null?void 0:P.selectIds)==null?void 0:o[0],v=p.consumeAll({data:t});_context38.t0=y;_context38.next=_context38.t0===ut.Selector?15:_context38.t0===ut.PencilEraser?21:_context38.t0===ut.BitMapEraser?23:_context38.t0===ut.Eraser?28:_context38.t0===ut.Arrow?30:_context38.t0===ut.Straight?30:_context38.t0===ut.Ellipse?30:_context38.t0===ut.Rectangle?30:_context38.t0===ut.Star?30:_context38.t0===ut.Polygon?30:_context38.t0===ut.SpeechBalloon?30:_context38.t0===ut.Pencil?35:42;break;case 15:v.selectIds&&x&&(s=v.selectIds)!=null&&s.includes(x)&&P.cursorBlur();v.selectIds&&e.runReverseSelectWork(v.selectIds);_context38.next=19;return this.drawSelector(_objectSpread(_objectSpread({},v),{},{scenePath:i}));case 19:(l=p.selectIds)!=null&&l.length?p.clearTmpPoints():this.clearWorkShapeNodeCache(c);return _context38.abrupt("break",42);case 21:this.drawPencilEraser(_objectSpread(_objectSpread({},v),{},{scenePath:i}),a),p.clearTmpPoints();return _context38.abrupt("break",42);case 23:_context38.t1=v.rect||(d=v.newWorkDatas)!=null&&d.size;if(!_context38.t1){_context38.next=27;break;}_context38.next=27;return this.drawBitMapEraserFull(p,v,a);case 27:return _context38.abrupt("break",42);case 28:this.drawEraser(_objectSpread(_objectSpread({},v),{},{scenePath:i}),a),p.clearTmpPoints();return _context38.abrupt("break",42);case 30:_context38.next=32;return this.drawPencilFull(_objectSpread(_objectSpread({},v),{},{scenePath:i}),a);case 32:this.drawCount=0;this.clearWorkShapeNodeCache(c);return _context38.abrupt("break",42);case 35:_context38.t2=v!=null&&v.rect;if(!_context38.t2){_context38.next=40;break;}_context38.next=39;return this.drawPencilFull(_objectSpread(_objectSpread({},v),{},{scenePath:i}),a);case 39:this.drawCount=0;case 40:this.clearWorkShapeNodeCache(c);return _context38.abrupt("break",42);case 42:case"end":return _context38.stop();}},_callee36,this);}));function consumeDrawAll(_x43,_x44){return _consumeDrawAll.apply(this,arguments);}return consumeDrawAll;}()},{key:"workShapesDone",value:function(){var _workShapesDone=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(t,e){var _iterator50,_step50,n;return _regeneratorRuntime().wrap(function _callee37$(_context39){while(1)switch(_context39.prev=_context39.next){case 0:_iterator50=_createForOfIteratorHelper(this.workShapes.keys());_context39.prev=1;_iterator50.s();case 3:if((_step50=_iterator50.n()).done){_context39.next=9;break;}n=_step50.value;_context39.next=7;return this.consumeDrawAll({workId:n,scenePath:t,viewId:this.viewId,msgType:at.DrawWork,dataType:Mt.Local},e);case 7:_context39.next=3;break;case 9:_context39.next=14;break;case 11:_context39.prev=11;_context39.t0=_context39["catch"](1);_iterator50.e(_context39.t0);case 14:_context39.prev=14;_iterator50.f();return _context39.finish(14);case 17:case"end":return _context39.stop();}},_callee37,this,[[1,11,14,17]]);}));function workShapesDone(_x45,_x46){return _workShapesDone.apply(this,arguments);}return workShapesDone;}()},{key:"consumeFull",value:function(){var _consumeFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(t){var i,a,e,n,o,s,l,d,c,p,y;return _regeneratorRuntime().wrap(function _callee38$(_context40){while(1)switch(_context40.prev=_context40.next){case 0:e=this.setFullWork(t),n=t.ops&&Me(t.ops)||t.op;if(!e){_context40.next=26;break;}o=(i=t.workId)==null?void 0:i.toString();if(o){_context40.next=5;break;}return _context40.abrupt("return");case 5:s=(a=this.vNodes.get(o))==null?void 0:a.rect;if(!(e.toolsType===ut.Image)){_context40.next=13;break;}_context40.next=9;return e.consumeServiceAsync({isFullWork:!0,replaceId:o,worker:this});case 9:l=_context40.sent;d=(t==null?void 0:t.updateNodeOpt)&&e.updataOptService(t.updateNodeOpt);_context40.next=20;break;case 13:if(!(e.toolsType===ut.Text)){_context40.next=19;break;}_context40.next=16;return e.consumeServiceAsync({isFullWork:!0,replaceId:o});case 16:l=_context40.sent;_context40.next=20;break;case 19:l=e.consumeService({op:n,isFullWork:!0,replaceId:o}),d=(t==null?void 0:t.updateNodeOpt)&&e.updataOptService(t.updateNodeOpt);case 20:l=Pt(l,d);c=[],p=[];if(!(t.workId&&this.workShapes["delete"](t.workId.toString()),l&&t.willRefresh&&(s&&c.push({rect:wt(s),isClear:!0,clearCanvas:St.Bg,viewId:this.viewId}),c.push({rect:wt(l),drawCanvas:St.Bg,viewId:this.viewId})),t.willSyncService&&p.push({opt:t.opt,toolsType:t.toolsType,type:at.FullWork,workId:t.workId,ops:t.ops,updateNodeOpt:t.updateNodeOpt,viewId:this.viewId}),c.length||p.length)){_context40.next=26;break;}y={render:c,sp:p};_context40.next=26;return this._post(y);case 26:case"end":return _context40.stop();}},_callee38,this);}));function consumeFull(_x47){return _consumeFull.apply(this,arguments);}return consumeFull;}()},{key:"commandDeleteText",value:function commandDeleteText(t){var e=this.vNodes.get(t);if(e&&e.toolsType===ut.Text)return{type:at.TextUpdate,toolsType:ut.Text,workId:t,dataType:Mt.Local};}},{key:"removeSelector",value:function(){var _removeSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(t,e){var n,i,a,o,s,l,_iterator51,_step51,d,y,p;return _regeneratorRuntime().wrap(function _callee39$(_context41){while(1)switch(_context41.prev=_context41.next){case 0:n=t.willSyncService,i=[],a=[],o=[],s=this.workShapes.get(Nt);if(s){_context41.next=3;break;}return _context41.abrupt("return");case 3:l=s.selectIds&&_toConsumableArray(s.selectIds)||[];_iterator51=_createForOfIteratorHelper(l);try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){d=_step51.value;if(this.vNodes.get(d)){y=this.commandDeleteText(d);y&&i.push(y);}p=this._removeWork(d);p.length&&a.push.apply(a,_toConsumableArray(p)),e==null||e.deleteCachedImagesByWorkId(d),o.push(d);}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}o.length&&i.push({type:at.RemoveNode,removeIds:o});i.push({type:at.Select,selectIds:[],willSyncService:n});_context41.next=10;return this.blurSelector();case 10:_context41.t0=a.length||i.length;if(!_context41.t0){_context41.next=14;break;}_context41.next=14;return this._post({render:a,sp:i});case 14:case"end":return _context41.stop();}},_callee39,this);}));function removeSelector(_x48,_x49){return _removeSelector.apply(this,arguments);}return removeSelector;}()},{key:"removeWork",value:function(){var _removeWork2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(t){var e,n,i;return _regeneratorRuntime().wrap(function _callee40$(_context42){while(1)switch(_context42.prev=_context42.next){case 0:e=t.workId,n=e==null?void 0:e.toString();if(!n){_context42.next=7;break;}i=this._removeWork(n);_context42.t0=i.length;if(!_context42.t0){_context42.next=7;break;}_context42.next=7;return this._post({render:i});case 7:case"end":return _context42.stop();}},_callee40,this);}));function removeWork(_x50){return _removeWork2.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(t){var i,a,o;var e=this.vNodes.get(t);e&&((i=this.fullLayer)==null||i.getElementsByName(t).forEach(function(s){s.remove();}),this.vNodes["delete"](t));var n=this.drawLayer&&vt.getRectFromLayer(this.drawLayer,t);if(n){var s=(a=this.drawLayer)==null?void 0:a.getElementsByName(t)[0];(o=this.drawLayer)==null||o.removeChild(s);}return this.getWorkShape(t)&&this.clearWorkShapeNodeCache(t),{fullRect:e==null?void 0:e.rect,drawRect:n};}},{key:"_removeWork",value:function _removeWork(t){var _this$removeNode=this.removeNode(t),e=_this$removeNode.fullRect,n=_this$removeNode.drawRect,i=[];return e&&i.push({rect:wt(e),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(e),drawCanvas:St.Bg,viewId:this.viewId}),n&&i.push({rect:wt(n),clearCanvas:St.Float,isClear:!0,viewId:this.viewId},{rect:wt(n),drawCanvas:St.Float,viewId:this.viewId}),i;}},{key:"checkTextActive",value:function(){var _checkTextActive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(t){var e,n,i,a,o,s,l,_iterator52,_step52,d,c,p,y,P;return _regeneratorRuntime().wrap(function _callee41$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:e=t.op,n=t.viewId,i=t.dataType;if(!(e!=null&&e.length)){_context43.next=32;break;}s=e[0]*this.fullLayer.worldScaling[0]+this.fullLayer.worldPosition[0],l=e[1]*this.fullLayer.worldScaling[1]+this.fullLayer.worldPosition[1];_iterator52=_createForOfIteratorHelper(this.vNodes.curNodeMap.values());_context43.prev=4;_iterator52.s();case 6:if((_step52=_iterator52.n()).done){_context43.next=14;break;}d=_step52.value;c=d.rect,p=d.name,y=d.toolsType,P=d.opt;if(!(y===ut.Text&&P.workState===It.Done&&Vg([s,l],c))){_context43.next=12;break;}a=p,o=this.setFullWork({workId:p,toolsType:y,opt:P});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);_iterator52.e(_context43.t0);case 19:_context43.prev=19;_iterator52.f();return _context43.finish(19);case 22:_context43.t1=a;if(!_context43.t1){_context43.next=32;break;}_context43.t2=o;if(!_context43.t2){_context43.next=28;break;}_context43.next=28;return o.consumeServiceAsync({isFullWork:!0,replaceId:o.getWorkId(),isDrawLabel:!1});case 28:_context43.next=30;return this.blurSelector({viewId:n,msgType:at.Select,dataType:i,isSync:!0});case 30:_context43.next=32;return this._post({sp:[{type:at.GetTextActive,toolsType:ut.Text,workId:a}]});case 32:case"end":return _context43.stop();}},_callee41,this,[[4,16,19,22]]);}));function checkTextActive(_x51){return _checkTextActive.apply(this,arguments);}return checkTextActive;}()},{key:"colloctEffectSelectWork",value:function(){var _colloctEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(t){var _this92=this;var e,n,i;return _regeneratorRuntime().wrap(function _callee42$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:e=this.workShapes.get(Nt),n=t.workId,i=t.msgType;if(!(e&&n&&e.selectIds&&e.selectIds.includes(n.toString()))){_context44.next=6;break;}i===at.RemoveNode?e.selectIds=e.selectIds.filter(function(a){return a!==n.toString();}):this.effectSelectNodeData.add(t);_context44.next=5;return this.runEffectSelectWork(!0).then(function(){var a;(a=_this92.effectSelectNodeData)==null||a.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(_x52){return _colloctEffectSelectWork.apply(this,arguments);}return colloctEffectSelectWork;}()},{key:"updateSelector",value:function(){var _updateSelector2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(t){var _this93=this;var P,e,n,i,a,o,s,l,d,c,p,y;return _regeneratorRuntime().wrap(function _callee43$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:e=this.workShapes.get(Nt);if((P=e==null?void 0:e.selectIds)!=null&&P.length){_context45.next=3;break;}return _context45.abrupt("return");case 3:n=t.callback;i=_objectWithoutProperties(t,_excluded2);a=i.updateSelectorOpt;o=i.willSerializeData;_context45.next=9;return e==null?void 0:e.updateSelector({updateSelectorOpt:a,selectIds:Xt(e.selectIds),vNodes:this.vNodes,willSerializeData:o,worker:this});case 9:s=_context45.sent;l=/* @__PURE__ */new Map();s!=null&&s.selectIds&&(d=pm(e.selectIds,s.selectIds),s.selectIds.forEach(function(x){var v=_this93.vNodes.get(x);if(v){var _T42=v.toolsType,_f35=v.op,g=v.opt;l.set(x,{opt:g,toolsType:_T42,ops:(_f35==null?void 0:_f35.length)&&Zt(_f35)||void 0});}}),e.selectIds=s.selectIds);c=[],p=[];s!=null&&s.rect&&c.push({rect:wt(s.rect),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(s.rect),drawCanvas:St.Bg,viewId:this.viewId});y=n&&n({res:s,workShapeNode:e,param:i,postData:{render:c,sp:p},newServiceStore:l})||{render:c,sp:p};d&&y.sp.push({type:at.RemoveNode,removeIds:d,viewId:this.viewId});_context45.t0=y.render.length||y.sp.length;if(!_context45.t0){_context45.next=20;break;}_context45.next=20;return this._post(y);case 20:case"end":return _context45.stop();}},_callee43,this);}));function updateSelector(_x53){return _updateSelector2.apply(this,arguments);}return updateSelector;}()},{key:"blurSelector",value:function(){var _blurSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(t){var i,e,n,a;return _regeneratorRuntime().wrap(function _callee44$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:e=this.workShapes.get(Nt),n=e==null?void 0:e.blurSelector();if(!(this.clearWorkShapeNodeCache(Nt),((i=this.fullLayer)==null?void 0:i.parent).children.forEach(function(a){a.name===Nt&&a.remove();}),n)){_context46.next=6;break;}a=[];a.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:wt(n.rect),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(n.rect),drawCanvas:St.Bg,viewId:this.viewId}],sp:a});case 6:case"end":return _context46.stop();}},_callee44,this);}));function blurSelector(_x54){return _blurSelector.apply(this,arguments);}return blurSelector;}()},{key:"hasSelector",value:function hasSelector(){return this.workShapes.has(Nt);}},{key:"getSelector",value:function getSelector(){return this.workShapes.get(Nt);}},{key:"reRenderSelector",value:function(){var _reRenderSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(){var t,a,e,n,i,o,_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;e=this.workShapes.get(Nt);if(e){_context47.next=4;break;}return _context47.abrupt("return");case 4:if(!(e&&!((a=e.selectIds)!=null&&a.length))){_context47.next=8;break;}_context47.next=7;return this.blurSelector();case 7:return _context47.abrupt("return");case 8:n=e.oldSelectRect,i=e.reRenderSelector();if(!i){_context47.next=13;break;}o=Pt(n,i)||i;_context47.next=13;return this._post({render:[{rect:wt(o),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(o),drawCanvas:St.Bg,viewId:this.viewId}],sp:[{type:at.Select,selectIds:e.selectIds,selectRect:i,willSyncService:t,viewId:this.viewId,points:e.getChildrenPoints(),textOpt:e.textOpt,selectorColor:e.selectorColor,strokeColor:e.strokeColor,fillColor:e.fillColor,canTextEdit:e.canTextEdit,canRotate:e.canRotate,scaleType:e.scaleType,opt:e.getWorkOptions()||void 0,canLock:e.canLock,isLocked:e.isLocked,toolsTypes:e.toolsTypes,shapeOpt:e.shapeOpt,thickness:e.thickness,useStroke:e.useStroke,strokeType:e.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 i,a,o,s,l,d,c,e,n,_e$updateSelectIds,p,y,P;return _regeneratorRuntime().wrap(function _callee46$(_context48){while(1)switch(_context48.prev=_context48.next){case 0:e=this.workShapes.get(Nt),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(e){_context48.next=10;break;}!this.setFullWork(t)&&t.workId&&((i=this.tmpOpt)==null?void 0:i.toolsType)===ut.Selector&&this.createWorkShape(t.workId.toString());_context48.next=9;return this.updateFullSelectWork(t);case 9:return _context48.abrupt("return");case 10:if(!(e&&n!=null&&n.length)){_context48.next=16;break;}_e$updateSelectIds=e.updateSelectIds(n),p=_e$updateSelectIds.bgRect,y=_e$updateSelectIds.selectRect,P={render:[],sp:[]};p&&((a=P.render)==null||a.push({rect:wt(p),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(p),drawCanvas:St.Bg,viewId:this.viewId}));(c=P.sp)==null||c.push(_objectSpread(_objectSpread({},t),{},{selectorColor:((o=t.opt)==null?void 0:o.strokeColor)||e.selectorColor,strokeColor:((s=t.opt)==null?void 0:s.strokeColor)||e.strokeColor,fillColor:((l=t.opt)==null?void 0:l.fillColor)||e.fillColor,textOpt:((d=t.opt)==null?void 0:d.textOpt)||e.textOpt,canTextEdit:e.canTextEdit,canRotate:e.canRotate,scaleType:e.scaleType,type:at.Select,selectRect:y,points:e.getChildrenPoints(),willSyncService:(t==null?void 0:t.willSyncService)||!1,opt:(t==null?void 0:t.willSyncService)&&e.getWorkOptions()||void 0,canLock:e.canLock,isLocked:e.isLocked,toolsTypes:e.toolsTypes,shapeOpt:e.shapeOpt,thickness:e.thickness,useStroke:e.useStroke,strokeType:e.strokeType}));_context48.next=16;return this._post(P);case 16:case"end":return _context48.stop();}},_callee46,this);}));function updateFullSelectWork(_x55){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(mm,"destroy",this,3)([]),this.effectSelectNodeData.clear(),this.batchEraserWorks.clear(),this.batchEraserRemoveNodes.clear();}},{key:"drawBitMapEraser",value:function(){var _drawBitMapEraser=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(t){var e,n,i;return _regeneratorRuntime().wrap(function _callee47$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:e=[];t.op&&e.push(t);n=[];if(t.rect){i=wt(t.rect);n.push({rect:i,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:i,drawCanvas:St.Bg,viewId:this.viewId});}_context49.t0=e.length||n.length;if(!_context49.t0){_context49.next=8;break;}_context49.next=8;return this._post({sp:e,render:n});case 8:case"end":return _context49.stop();}},_callee47,this);}));function drawBitMapEraser(_x56){return _drawBitMapEraser.apply(this,arguments);}return drawBitMapEraser;}()},{key:"drawBitMapEraserFull",value:function(){var _drawBitMapEraserFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(t,e,n){var i,a,o,s,l,d,c,y,_iterator53,_step53,_step53$value,P,x,p,_y13;return _regeneratorRuntime().wrap(function _callee48$(_context50){while(1)switch(_context50.prev=_context50.next){case 0:i=e.rect,a=e.willUpdateNodes,o=e.scenePath,s=_objectWithoutProperties(e,_excluded3);l=i;d=t.getWorkId(),c=[_objectSpread(_objectSpread({},s),{},{workId:d,scenePath:o,updateNodeOpt:{useAnimation:!1},isSync:!0,nextTasks:[{type:at.RemoveNode,removeIds:[d],viewId:this.viewId}]})];if(!(n&&c.push({type:at.None,isLockSentEventCursor:n}),a!=null&&a.size)){_context50.next=10;break;}_context50.next=6;return t==null?void 0:t.reRenderEffectNodes({willUpdateNodes:a,worker:this});case 6:y=_context50.sent;l=Pt(l,y);_iterator53=_createForOfIteratorHelper(a);try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){_step53$value=_slicedToArray(_step53.value,2),P=_step53$value[0],x=_step53$value[1];c.push({type:at.UpdateNode,dataType:Mt.Local,opt:x.opt,workId:P,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}case 10:p=[];if(l){_y13=wt(l);p.push({rect:_y13,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:_y13,drawCanvas:St.Bg,viewId:this.viewId});}_context50.t0=c.length||p.length;if(!_context50.t0){_context50.next=16;break;}_context50.next=16;return this._post({sp:c,render:p});case 16:case"end":return _context50.stop();}},_callee48,this);}));function drawBitMapEraserFull(_x57,_x58,_x59){return _drawBitMapEraserFull.apply(this,arguments);}return drawBitMapEraserFull;}()},{key:"drawPencilCombine",value:function(){var _drawPencilCombine=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(t,e){var i,a,o,n,s,l;return _regeneratorRuntime().wrap(function _callee49$(_context51){while(1)switch(_context51.prev=_context51.next){case 0:n=(i=this.workShapes.get(t))==null?void 0:i.combineConsume();if(!n){_context51.next=6;break;}s={render:[],drawCount:e};if(n!=null&&n.rect){l=wt(n.rect);(a=s.render)==null||a.push({rect:l,isClear:!0,clearCanvas:St.Float,viewId:this.viewId}),(o=s.render)==null||o.push({rect:l,drawCanvas:St.Float,viewId:this.viewId});}_context51.next=6;return this._post(s);case 6:case"end":return _context51.stop();}},_callee49,this);}));function drawPencilCombine(_x60,_x61){return _drawPencilCombine.apply(this,arguments);}return drawPencilCombine;}()},{key:"drawSelector",value:function(){var _drawSelector=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(t){var n,e;return _regeneratorRuntime().wrap(function _callee50$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:e={render:[],sp:[t]};t.rect&&((n=e.render)==null||n.push({rect:wt(t.rect),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(t.rect),drawCanvas:St.Bg,viewId:this.viewId}));_context52.next=4;return this._post(e);case 4:case"end":return _context52.stop();}},_callee50,this);}));function drawSelector(_x62){return _drawSelector.apply(this,arguments);}return drawSelector;}()},{key:"drawPencilEraser",value:function(){var _drawPencilEraser=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(t,e){var _this94=this;var i,a,n,_iterator54,_step54,o,s;return _regeneratorRuntime().wrap(function _callee51$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:n=[];if((i=t.newWorkDatas)!=null&&i.size){_iterator54=_createForOfIteratorHelper(t.newWorkDatas.values());try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){o=_step54.value;s=o.workId.toString();this.batchEraserWorks.add(s),n.push({type:at.FullWork,workId:s,ops:Zt(o.op),opt:o.opt,toolsType:o.toolsType,updateNodeOpt:{useAnimation:!1}});}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}delete t.newWorkDatas;}(a=t.removeIds)==null||a.forEach(function(o){_this94.batchEraserRemoveNodes.add(o);});e&&n.push({type:at.None,isLockSentEventCursor:e});t.rect&&n.push(t);_context53.next=7;return this._post({sp:n});case 7:this.batchEraserCombine();case 8:case"end":return _context53.stop();}},_callee51,this);}));function drawPencilEraser(_x63,_x64){return _drawPencilEraser.apply(this,arguments);}return drawPencilEraser;}()},{key:"drawEraser",value:function(){var _drawEraser=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(t,e){var n,i;return _regeneratorRuntime().wrap(function _callee52$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:n=[],i=[];e&&n.push({type:at.None,isLockSentEventCursor:e});t.removeIds&&n.push(t);t.rect&&i.push({rect:t.rect,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:t.rect,drawCanvas:St.Bg,viewId:this.viewId});_context54.next=6;return this._post({sp:n,render:i});case 6:case"end":return _context54.stop();}},_callee52,this);}));function drawEraser(_x65,_x66){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({drawCount:this.drawCount,sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context55.stop();}},_callee53,this);}));function drawShape(_x67){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(_x68){return _drawPencil.apply(this,arguments);}return drawPencil;}()},{key:"drawPencilFull",value:function(){var _drawPencilFull=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(t,e){var i,a,n;return _regeneratorRuntime().wrap(function _callee55$(_context57){while(1)switch(_context57.prev=_context57.next){case 0:n={drawCount:1/0,render:[],sp:[t]};e&&((i=n.sp)==null||i.push({type:at.None,isLockSentEventCursor:e}));(a=n.render)==null||a.push({isClearAll:!0,clearCanvas:St.Float,viewId:this.viewId},{rect:t.rect,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:t.rect,drawCanvas:St.Bg,viewId:this.viewId});_context57.next=5;return this._post(n);case 5:case"end":return _context57.stop();}},_callee55,this);}));function drawPencilFull(_x69,_x70){return _drawPencilFull.apply(this,arguments);}return drawPencilFull;}()},{key:"updateBatchEraserCombineNode",value:function updateBatchEraserCombineNode(t,e){var _this95=this;var n=[];var i;var _iterator55=_createForOfIteratorHelper(e.keys()),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var a=_step55.value;this.fullLayer.getElementsByName(a).forEach(function(o){var s=o.getBoundingClientRect();i=Pt(i,{x:s.x-se.SafeBorderPadding,y:s.y-se.SafeBorderPadding,w:s.width+se.SafeBorderPadding*2,h:s.height+se.SafeBorderPadding*2}),o.remove();});}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}return t.forEach(function(a){var o=_this95.vNodes.get(a);if(o)if(_this95.fullLayer.getElementsByName(a)[0])i=Pt(i,o.rect);else{var l=_this95.setFullWork(_objectSpread(_objectSpread({},o),{},{workId:a})),d=l&&l.consumeService({op:o.op,isFullWork:!0});d&&(o.rect=d,i=Pt(i,d));}}),i&&n.push({rect:i,isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:i,drawCanvas:St.Bg,viewId:this.viewId}),n;}},{key:"runEffectSelectWork",value:function(){var _runEffectSelectWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(t){var e,_iterator56,_step56,n,i,a,o;return _regeneratorRuntime().wrap(function _callee56$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:_iterator56=_createForOfIteratorHelper(this.effectSelectNodeData.values());_context58.prev=1;_iterator56.s();case 3:if((_step56=_iterator56.n()).done){_context58.next=23;break;}n=_step56.value;i=this.setFullWork(n);if(!i){_context58.next=21;break;}a=(e=i.getWorkId())==null?void 0:e.toString();if(!(i.toolsType===ut.Image)){_context58.next=13;break;}_context58.next=11;return i.consumeServiceAsync({isFullWork:!0,replaceId:a,worker:this});case 11:_context58.next=20;break;case 13:if(!(i.toolsType===ut.Text)){_context58.next=18;break;}_context58.next=16;return i.consumeServiceAsync({isFullWork:!0,replaceId:a});case 16:_context58.next=20;break;case 18:o=n.ops&&Me(n.ops);i.consumeService({op:o,isFullWork:!0,replaceId:a}),n!=null&&n.updateNodeOpt&&i.updataOptService(n.updateNodeOpt);case 20:n.workId&&this.workShapes["delete"](n.workId.toString());case 21:_context58.next=3;break;case 23:_context58.next=28;break;case 25:_context58.prev=25;_context58.t0=_context58["catch"](1);_iterator56.e(_context58.t0);case 28:_context58.prev=28;_iterator56.f();return _context58.finish(28);case 31:_context58.next=33;return this.reRenderSelector(t);case 33:case"end":return _context58.stop();}},_callee56,this,[[1,25,28,31]]);}));function runEffectSelectWork(_x71){return _runEffectSelectWork.apply(this,arguments);}return runEffectSelectWork;}()},{key:"cursorHover",value:function(){var _cursorHover=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(t){var o,e,n,i,a,s,l;return _regeneratorRuntime().wrap(function _callee57$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:e=t.opt,n=t.toolsType,i=t.point,a=this.setFullWork({workId:be,toolsType:n,opt:e});if(!(a&&i)){_context59.next=8;break;}s=a.cursorHover(i),l={render:[]};_context59.t0=s&&s.type===at.CursorHover&&s.rect;if(!_context59.t0){_context59.next=8;break;}(o=l.render)==null||o.push({rect:wt(s.rect),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(s.rect),drawCanvas:St.Bg,viewId:this.viewId});_context59.next=8;return this._post(l);case 8:case"end":return _context59.stop();}},_callee57,this);}));function cursorHover(_x72){return _cursorHover.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(){var n,t,e;return _regeneratorRuntime().wrap(function _callee58$(_context60){while(1)switch(_context60.prev=_context60.next){case 0:t=this.getWorkShape(be);_context60.t0=t&&(n=t.selectIds)!=null&&n.length;if(!_context60.t0){_context60.next=10;break;}e=t.oldSelectRect;t.cursorBlur();this.clearWorkShapeNodeCache(be);_context60.t1=e;if(!_context60.t1){_context60.next=10;break;}_context60.next=10;return this._post({render:[{rect:wt(e),clearCanvas:St.Bg,isClear:!0,viewId:this.viewId},{rect:wt(e),drawCanvas:St.Bg,viewId:this.viewId}]});case 10:this.fullLayer.parent.children.forEach(function(i){i.name==="Cursor_Hover_Id"&&i.remove();});case 11:case"end":return _context60.stop();}},_callee58,this);}));function cursorBlur(){return _cursorBlur.apply(this,arguments);}return cursorBlur;}()}]);}(Ri);var vm=/*#__PURE__*/function(){function vm(r){_classCallCheck(this,vm);et(this,"viewId");et(this,"vNodes");et(this,"fullLayer");et(this,"drawLayer");et(this,"workShapes",/* @__PURE__ */new Map());et(this,"selectorWorkShapes",/* @__PURE__ */new Map());et(this,"thread");et(this,"animationId");et(this,"willRunEffectSelectorIds",/* @__PURE__ */new Set());et(this,"runEffectId");et(this,"noAnimationRect");et(this,"syncUnitTime",re.syncOpt.interval);et(this,"post");this.viewId=r.viewId,this.vNodes=r.vNodes,this.fullLayer=r.fullLayer,this.drawLayer=r.drawLayer,this.thread=r.thread,this.post=r.thread.post.bind(r.thread);}return _createClass(vm,[{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 _callee59(r){return _regeneratorRuntime().wrap(function _callee59$(_context61){while(1)switch(_context61.prev=_context61.next){case 0:this.activeWorkShape(r),this.runAnimation();case 1:case"end":return _context61.stop();}},_callee59,this);}));function consumeDraw(_x73){return _consumeDraw2.apply(this,arguments);}return consumeDraw;}()},{key:"consumeFull",value:function consumeFull(r){this.activeWorkShape(r),this.runAnimation();}},{key:"runSelectWork",value:function runSelectWork(r){this.activeSelectorShape(r);var t=r.workId,e=t==null?void 0:t.toString();e&&this.willRunEffectSelectorIds.add(e),this.runEffect();}},{key:"setNodeKey",value:function setNodeKey(r,t,e,n){return t.toolsType=e,t.node=Fr({workId:r,toolsType:e,toolsOpt:n,vNodes:this.vNodes,fullLayer:this.fullLayer,drawLayer:this.drawLayer},this),t;}},{key:"runReverseSelectWork",value:function runReverseSelectWork(r){var _this96=this;r.forEach(function(t){_this96.selectorWorkShapes.forEach(function(e,n){var i;if((i=e.selectIds)!=null&&i.length){var a=e.selectIds.indexOf(t);a>-1&&(e.selectIds.splice(a,1),_this96.willRunEffectSelectorIds.add(n));}});}),this.willRunEffectSelectorIds.size&&this.runEffect();}},{key:"removeWork",value:function(){var _removeWork3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee60(r){var t,e,n;return _regeneratorRuntime().wrap(function _callee60$(_context62){while(1)switch(_context62.prev=_context62.next){case 0:t=r.workId,e=t==null?void 0:t.toString();if(!e){_context62.next=10;break;}n=this.workShapes.get(e);if(!n){_context62.next=8;break;}this.workShapes["delete"](e);_context62.next=7;return this.removeNode(e,r,n==null?void 0:n.totalRect,!1);case 7:return _context62.abrupt("return");case 8:_context62.next=10;return this.removeNode(e,r);case 10:case"end":return _context62.stop();}},_callee60,this);}));function removeWork(_x74){return _removeWork3.apply(this,arguments);}return removeWork;}()},{key:"removeSelectWork",value:function removeSelectWork(r){var t=r.workId,e=t==null?void 0:t.toString();e&&(this.activeSelectorShape(r),this.willRunEffectSelectorIds.add(e)),this.runEffect();}},{key:"removeNode",value:function(){var _removeNode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee61(r,t,e){var n,o,i,a,_args63=arguments;return _regeneratorRuntime().wrap(function _callee61$(_context63){while(1)switch(_context63.prev=_context63.next){case 0:n=_args63.length>3&&_args63[3]!==undefined?_args63[3]:!0;r.indexOf(Nt)>-1&&this.removeSelectWork(t);i=e;a=(o=this.vNodes.get(r))==null?void 0:o.rect;a&&(i=Pt(a,i));this.fullLayer.getElementsByName(r).forEach(function(s){s.remove();});this.drawLayer.getElementsByName(r).forEach(function(s){s.remove();});this.vNodes["delete"](r);_context63.t0=i;if(!_context63.t0){_context63.next=12;break;}_context63.next=12;return this.post({render:[{rect:wt(i),isClear:!0,clearCanvas:n?St.Bg:St.ServiceFloat,workerType:n?void 0:Mt.Service,viewId:this.viewId},{rect:wt(i),drawCanvas:n?St.Bg:St.ServiceFloat,workerType:n?void 0:Mt.Service,viewId:this.viewId}]});case 12:case"end":return _context63.stop();}},_callee61,this);}));function removeNode(_x75,_x76,_x77){return _removeNode.apply(this,arguments);}return removeNode;}()},{key:"activeWorkShape",value:function activeWorkShape(r){var y,P,x,v;var t=r.workId,e=r.opt,n=r.toolsType,i=r.type,a=r.updateNodeOpt,o=r.ops,s=r.op,l=r.useAnimation;if(!t)return;var d=t.toString(),c=(y=this.vNodes.get(d))==null?void 0:y.rect;if(!((P=this.workShapes)!=null&&P.has(d))){var _T43={toolsType:n,animationWorkData:s||[],animationIndex:0,type:i,updateNodeOpt:a,ops:o,useAnimation:_typeof(l)<"u"?l:_typeof(a==null?void 0:a.useAnimation)<"u"?a==null?void 0:a.useAnimation:!0,oldRect:c,isDiff:!1};n&&e&&(_T43=this.setNodeKey(d,_T43,n,e)),(x=this.workShapes)==null||x.set(d,_T43);}var p=(v=this.workShapes)==null?void 0:v.get(d);i&&(p.type=i),o&&(p.animationWorkData=Me(o),p.ops=o),a&&(p.updateNodeOpt=a),s&&(p.isDiff=this.hasDiffData(p.animationWorkData||[],s,p.toolsType),p.animationWorkData=s),p.node&&p.node.getWorkId()!==d&&p.node.setWorkId(d),c&&(p.oldRect=c),n&&e&&(e.syncUnitTime&&(this.syncUnitTime=e.syncUnitTime),p.toolsType!==n&&n&&e&&this.setNodeKey(d,p,n,e),p.node&&p.node.setWorkOptions(e));}},{key:"hasDiffData",value:function hasDiffData(r,t,e){var n=r.length;if(t.length<n)return!0;switch(e){case ut.Pencil:{for(var i=0;i<n;i+=3)if(t[i]!==r[i]||t[i+1]!==r[i+1])return!0;break;}case ut.LaserPen:{for(var _i10=0;_i10<n;_i10+=2)if(t[_i10]!==r[_i10]||t[_i10+1]!==r[_i10+1])return!0;break;}}return!1;}},{key:"animationDraw",value:function(){var _animationDraw=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee62(){var _this97=this;var n,i,a,o,s,l,d,c,p,y,P,x,v,T,f,g,u,m,M,E,A,b,O,L,w,I,R,W,z,K,k,q,U,G,Z,nt,r,t,e,_iterator57,_step57,_loop6;return _regeneratorRuntime().wrap(function _callee62$(_context65){while(1)switch(_context65.prev=_context65.next){case 0:this.animationId=void 0;r=!1;t={render:[]},e=/* @__PURE__ */new Map();_iterator57=_createForOfIteratorHelper(this.workShapes.entries());_context65.prev=4;_loop6=/*#__PURE__*/_regeneratorRuntime().mark(function _loop6(){var _step57$value,rt,tt,J,ht,_J4,_ht3,_J5,_ht4,dt,B,_J6,_ht5,_J7,_ht6,_dt2,_B,F,Y,X,_Y,_J8,_ht7,_dt3,_B2,_F,_Y2;return _regeneratorRuntime().wrap(function _loop6$(_context64){while(1)switch(_context64.prev=_context64.next){case 0:_step57$value=_slicedToArray(_step57.value,2),rt=_step57$value[0],tt=_step57$value[1];_context64.t0=tt.toolsType;_context64.next=_context64.t0===ut.Image?4:_context64.t0===ut.Text?11:_context64.t0===ut.Arrow?19:_context64.t0===ut.Straight?19:_context64.t0===ut.Rectangle?19:_context64.t0===ut.Ellipse?19:_context64.t0===ut.Star?19:_context64.t0===ut.Polygon?19:_context64.t0===ut.SpeechBalloon?19:_context64.t0===ut.Pencil?22:_context64.t0===ut.BitMapEraser?37:_context64.t0===ut.PencilEraser?37:50;break;case 4:J=tt.oldRect;J&&((n=t.render)==null||n.push({rect:J,isClear:!0,clearCanvas:St.Bg,viewId:_this97.viewId}),(i=t.render)==null||i.push({rect:J,drawCanvas:St.Bg,viewId:_this97.viewId}));_context64.next=8;return(a=tt.node)==null?void 0:a.consumeServiceAsync({isFullWork:!0,worker:_this97.thread});case 8:ht=_context64.sent;_this97.selectorWorkShapes.forEach(function(dt,B){var F;(F=dt.selectIds)!=null&&F.includes(rt)&&(_this97.willRunEffectSelectorIds.add(B),_this97.noAnimationRect=Pt(_this97.noAnimationRect,J),_this97.noAnimationRect=Pt(_this97.noAnimationRect,ht),_this97.runEffect());}),_this97.workShapes["delete"](rt),(o=t.render)==null||o.push({rect:ht,drawCanvas:St.Bg,viewId:_this97.viewId});return _context64.abrupt("break",50);case 11:if(!tt.node){_context64.next=18;break;}_J4=tt.oldRect;_J4&&((s=t.render)==null||s.push({rect:_J4,isClear:!0,clearCanvas:St.Bg,viewId:_this97.viewId}),(l=t.render)==null||l.push({rect:_J4,drawCanvas:St.Bg,viewId:_this97.viewId}));_context64.next=16;return tt.node.consumeServiceAsync({isFullWork:!0,replaceId:rt});case 16:_ht3=_context64.sent;_this97.selectorWorkShapes.forEach(function(dt,B){var F;(F=dt.selectIds)!=null&&F.includes(rt)&&(_this97.willRunEffectSelectorIds.add(B),_this97.noAnimationRect=Pt(_this97.noAnimationRect,_J4),_this97.noAnimationRect=Pt(_this97.noAnimationRect,_ht3),_this97.runEffect());}),(d=tt.node)==null||d.clearTmpPoints(),_this97.workShapes["delete"](rt),(c=t.render)==null||c.push({rect:_ht3,drawCanvas:St.Bg,viewId:_this97.viewId});case 18:return _context64.abrupt("break",50);case 19:_J5=!!tt.ops;if((p=tt.animationWorkData)!=null&&p.length){_ht4=tt.oldRect,dt=tt.node.oldRect;_ht4&&((y=t.render)==null||y.push({rect:_ht4,isClear:!0,clearCanvas:St.Bg,viewId:_this97.viewId}),(P=t.render)==null||P.push({rect:_ht4,drawCanvas:St.Bg,viewId:_this97.viewId})),dt&&((x=t.render)==null||x.push({rect:dt,isClear:!0,clearCanvas:St.ServiceFloat,viewId:_this97.viewId}));B=(v=tt.node)==null?void 0:v.consumeService({op:tt.animationWorkData,isFullWork:_J5});e.set(rt,{workState:_ht4?tt.ops?It.Done:It.Doing:It.Start,op:tt.animationWorkData.filter(function(F,Y){if(Y%3!==2)return!0;}).slice(-2)}),_J5?(_this97.selectorWorkShapes.forEach(function(F,Y){var X;(X=F.selectIds)!=null&&X.includes(rt)&&(_this97.willRunEffectSelectorIds.add(Y),_this97.noAnimationRect=Pt(_this97.noAnimationRect,_ht4),_this97.noAnimationRect=Pt(_this97.noAnimationRect,dt),_this97.noAnimationRect=Pt(_this97.noAnimationRect,B),_this97.runEffect());}),(T=tt.node)==null||T.clearTmpPoints(),_this97.workShapes["delete"](rt),(f=t.render)==null||f.push({rect:B,drawCanvas:St.Bg,viewId:_this97.viewId})):(g=t.render)==null||g.push({rect:B,drawCanvas:St.ServiceFloat,workerType:_J5?void 0:Mt.Service,viewId:_this97.viewId}),tt.animationWorkData.length=0;}return _context64.abrupt("break",50);case 22:if(!(!tt.useAnimation&&tt.ops)){_context64.next=28;break;}_J6=(u=tt.node)==null?void 0:u.consumeService({op:tt.animationWorkData||[],isFullWork:!0,replaceId:rt});_ht5=(m=tt.node)==null?void 0:m.updataOptService(tt.updateNodeOpt);_J6=Pt(_J6,_ht5),(M=t.render)==null||M.push({isClear:!0,rect:Pt(tt.oldRect,_J6),clearCanvas:St.Bg,viewId:_this97.viewId}),(E=t.render)==null||E.push({rect:Pt(tt.oldRect,_J6),drawCanvas:St.Bg,viewId:_this97.viewId}),_this97.selectorWorkShapes.forEach(function(dt,B){var F;(F=dt.selectIds)!=null&&F.includes(rt)&&(_this97.willRunEffectSelectorIds.add(B),_this97.noAnimationRect=Pt(_this97.noAnimationRect,_J6),_this97.runEffect());}),(A=tt.node)==null||A.clearTmpPoints(),_this97.workShapes["delete"](rt);_context64.next=36;break;case 28:if(!tt.useAnimation){_context64.next=36;break;}if(!tt.isDel){_context64.next=32;break;}(b=tt.node)==null||b.clearTmpPoints(),_this97.workShapes["delete"](rt);return _context64.abrupt("break",50);case 32:_J7=3,_ht6=_this97.computNextAnimationIndex(tt,_J7),_dt2=tt.isDiff?0:Math.max(0,(tt.animationIndex||0)-_J7),_B=(tt.animationWorkData||[]).slice(_dt2,_ht6),F=(L=(O=tt.node)==null?void 0:O.getWorkId())==null?void 0:L.toString();if((tt.animationIndex||0)<_ht6||tt.isDiff){Y=(w=tt.node)==null?void 0:w.consumeService({op:_B,isFullWork:!1});if((I=t.render)==null||I.push({rect:Y,drawCanvas:St.ServiceFloat,viewId:_this97.viewId}),tt.animationIndex=_ht6,tt.isDiff&&(tt.isDiff=!1),_B.length){X=_B.filter(function(N,$){if($%_J7!==_J7-1)return!0;}).slice(-2);e.set(rt,{workState:_dt2===0?It.Start:_ht6===((R=tt.animationWorkData)==null?void 0:R.length)?It.Done:It.Doing,op:X});}}else if(tt.ops){_Y=(W=tt.node)==null?void 0:W.consumeService({op:tt.animationWorkData||[],isFullWork:!0,replaceId:F});tt.isDel=!0,(z=t.render)==null||z.push({isClear:!0,rect:_Y,clearCanvas:St.ServiceFloat,viewId:_this97.viewId},{rect:_Y,drawCanvas:St.ServiceFloat,viewId:_this97.viewId},{isClear:!0,rect:_Y,clearCanvas:St.Bg,viewId:_this97.viewId},{rect:_Y,drawCanvas:St.Bg,viewId:_this97.viewId}),e.set(rt,{workState:It.Done,op:_B.filter(function(X,N){if(N%_J7!==_J7-1)return!0;}).slice(-2)});}r=!0;return _context64.abrupt("break",50);case 36:return _context64.abrupt("break",50);case 37:if(!tt.isDel){_context64.next=40;break;}(K=tt.node)==null||K.clearTmpPoints(),_this97.workShapes["delete"](rt);return _context64.abrupt("break",50);case 40:if(!(tt.ops&&(k=tt.animationWorkData)!=null&&k.length)){_context64.next=44;break;}_J8=tt.animationWorkData.slice(-3,-1);e.set(rt,{workState:It.Done,op:_J8}),tt.isDel=!0;return _context64.abrupt("break",50);case 44:if(!tt.useAnimation){_context64.next=49;break;}_ht7=_this97.computNextAnimationIndex(tt,3),_dt3=tt.isDiff?0:Math.max(0,(tt.animationIndex||0)-3),_B2=(tt.animationWorkData||[]).slice(_dt3,_ht7);if((tt.animationIndex||0)<_ht7||tt.isDiff){_F=(q=tt.node)==null?void 0:q.consumeService({op:_B2,isFullWork:!0});if((U=t.render)==null||U.push({isClear:!0,rect:Pt(tt.oldRect,_F),clearCanvas:St.Bg,viewId:_this97.viewId}),(G=t.render)==null||G.push({rect:Pt(tt.oldRect,_F),drawCanvas:St.Bg,viewId:_this97.viewId}),tt.animationIndex=_ht7,tt.isDiff&&(tt.isDiff=!1),_B2.length){_Y2=_B2.filter(function(X,N){if(N%3!==2)return!0;}).slice(-2);e.set(rt,{workState:_dt3===0?It.Start:_ht7===((Z=tt.animationWorkData)==null?void 0:Z.length)?It.Done:It.Doing,op:_Y2});}}r=!0;return _context64.abrupt("break",50);case 49:return _context64.abrupt("break",50);case 50:case"end":return _context64.stop();}},_loop6);});_iterator57.s();case 7:if((_step57=_iterator57.n()).done){_context65.next=11;break;}return _context65.delegateYield(_loop6(),"t0",9);case 9:_context65.next=7;break;case 11:_context65.next=16;break;case 13:_context65.prev=13;_context65.t1=_context65["catch"](4);_iterator57.e(_context65.t1);case 16:_context65.prev=16;_iterator57.f();return _context65.finish(16);case 19:r&&this.runAnimation();e.size&&(t.sp=[],e.forEach(function(rt,tt){var J;(J=t.sp)==null||J.push({type:at.Cursor,uid:tt.split(De)[0],op:rt.op,workState:rt.workState,viewId:_this97.viewId});}));_context65.t2=(nt=t.render)!=null&&nt.length;if(!_context65.t2){_context65.next=25;break;}_context65.next=25;return this.post(t);case 25:case"end":return _context65.stop();}},_callee62,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(r,t){var e=Math.floor((r.animationWorkData||[]).slice(r.animationIndex).length*32/t/this.syncUnitTime)*t;return Math.min((r.animationIndex||0)+(e||t),(r.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 _callee63(){var _this99=this;var r;return _regeneratorRuntime().wrap(function _callee63$(_context66){while(1)switch(_context66.prev=_context66.next){case 0:this.runEffectId=void 0;r=this.noAnimationRect;this.willRunEffectSelectorIds.forEach(function(t){var i,a;var e=_this99.selectorWorkShapes.get(t),n=e&&e.selectIds&&((i=e.node)==null?void 0:i.selectServiceNode(t,e,!0));r=Pt(r,n),(a=e==null?void 0:e.selectIds)!=null&&a.length||_this99.selectorWorkShapes["delete"](t);});_context66.t0=r;if(!_context66.t0){_context66.next=7;break;}_context66.next=7;return this.post({render:[{rect:wt(r),isClear:!0,clearCanvas:St.Bg,viewId:this.viewId},{rect:wt(r),drawCanvas:St.Bg,viewId:this.viewId}]});case 7:this.willRunEffectSelectorIds.clear();this.noAnimationRect=void 0;case 9:case"end":return _context66.stop();}},_callee63,this);}));function effectRunSelector(){return _effectRunSelector.apply(this,arguments);}return effectRunSelector;}()},{key:"activeSelectorShape",value:function activeSelectorShape(r){var d,c,p;var t=r.workId,e=r.opt,n=r.toolsType,i=r.type,a=r.selectIds,o=r.imageBitmap;if(!t)return;var s=t.toString();if(!((d=this.selectorWorkShapes)!=null&&d.has(s))){var y={toolsType:n,selectIds:a,type:i,opt:e,imageBitmap:o};n&&e&&(y=this.setNodeKey(s,y,n,e)),(c=this.selectorWorkShapes)==null||c.set(s,y);}var l=(p=this.selectorWorkShapes)==null?void 0:p.get(s);i&&(l.type=i),l.node&&l.node.getWorkId()!==s&&l.node.setWorkId(s),o&&(l.imageBitmap=o),l.selectIds=a||[];}}]);}();var ym=/*#__PURE__*/function(_Ri2){function ym(t){var _this100;_classCallCheck(this,ym);_this100=_callSuper(this,ym,[t]);et(_this100,"drawWorkActiveId");return _this100;}_inherits(ym,_Ri2);return _createClass(ym,[{key:"runFullWork",value:function(){var _runFullWork=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee64(t){var i,e,n,a,o,s;return _regeneratorRuntime().wrap(function _callee64$(_context67){while(1)switch(_context67.prev=_context67.next){case 0:e=this.setFullWork(t),n=t.ops&&Me(t.ops);if(!e){_context67.next=18;break;}s=(i=e.getWorkId())==null?void 0:i.toString();if(!(e.toolsType===ut.Image)){_context67.next=9;break;}_context67.next=6;return e.consumeServiceAsync({isFullWork:!0,worker:this.thread});case 6:a=_context67.sent;_context67.next=16;break;case 9:if(!(e.toolsType===ut.Text)){_context67.next=15;break;}_context67.next=12;return e.consumeServiceAsync({isFullWork:!0,replaceId:s,isDrawLabel:!0});case 12:a=_context67.sent;_context67.next=16;break;case 15:a=e.consumeService({op:n,isFullWork:!0,replaceId:s}),o=(t==null?void 0:t.updateNodeOpt)&&e.updataOptService(t.updateNodeOpt);case 16:t.workId&&this.workShapes["delete"](t.workId.toString());return _context67.abrupt("return",Pt(a,o));case 18:case"end":return _context67.stop();}},_callee64,this);}));function runFullWork(_x78){return _runFullWork.apply(this,arguments);}return runFullWork;}()},{key:"runSelectWork",value:function runSelectWork(t){var n;var e=this.setFullWork(t);e&&(n=t.selectIds)!=null&&n.length&&t.workId&&e.selectServiceNode(t.workId.toString(),{selectIds:t.selectIds},!1);}},{key:"workShapesDone",value:function workShapesDone(){var _iterator58=_createForOfIteratorHelper(this.workShapes.keys()),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var t=_step58.value;this.clearWorkShapeNodeCache(t);}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}this.fullLayer.removeAllChildren();}},{key:"canUseSubWorker",value:function canUseSubWorker(t){var e=this.thread.getPriorityDraw();return e||!e&&t!==ut.Pencil;}},{key:"consumeDraw",value:function(){var _consumeDraw3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee65(t){var e,n,i,a,o;return _regeneratorRuntime().wrap(function _callee65$(_context68){while(1)switch(_context68.prev=_context68.next){case 0:e=t.workId,n=e==null?void 0:e.toString(),i=n&&this.workShapes.get(n);if(i){_context68.next=3;break;}return _context68.abrupt("return");case 3:_context68.t0=this.drawWorkActiveId&&this.drawWorkActiveId!==n;if(!_context68.t0){_context68.next=8;break;}_context68.next=7;return this.consumeDrawAll({workId:this.drawWorkActiveId,viewId:this.viewId,msgType:at.DrawWork,dataType:Mt.Local});case 7:this.drawWorkActiveId=void 0;case 8:!this.drawWorkActiveId&&n!==Nt&&(this.drawWorkActiveId=n);a=i.toolsType,o=i.consume({data:t,drawCount:this.drawCount,isFullWork:!0,isSubWorker:!0});_context68.t1=a;_context68.next=_context68.t1===ut.Arrow?13:_context68.t1===ut.Straight?13:_context68.t1===ut.Ellipse?13:_context68.t1===ut.Rectangle?13:_context68.t1===ut.Star?13:_context68.t1===ut.Polygon?13:_context68.t1===ut.SpeechBalloon?13:_context68.t1===ut.Pencil?19:25;break;case 13:_context68.t2=o;if(!_context68.t2){_context68.next=18;break;}this.drawCount++;_context68.next=18;return this.drawShape(o);case 18:return _context68.abrupt("break",25);case 19:_context68.t3=o;if(!_context68.t3){_context68.next=24;break;}this.drawCount++;_context68.next=24;return this.drawPencil(o,e==null?void 0:e.toString());case 24:return _context68.abrupt("break",25);case 25:case"end":return _context68.stop();}},_callee65,this);}));function consumeDraw(_x79){return _consumeDraw3.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee66(t){var e,n,i;return _regeneratorRuntime().wrap(function _callee66$(_context69){while(1)switch(_context69.prev=_context69.next){case 0:e=t.workId;if(!e){_context69.next=12;break;}n=e.toString();this.drawWorkActiveId===n&&(this.drawWorkActiveId=void 0);i=this.workShapes.get(n);if(i){_context69.next=7;break;}return _context69.abrupt("return");case 7:_context69.t0=i.toolsType;_context69.next=_context69.t0===ut.Arrow?10:_context69.t0===ut.Straight?10:_context69.t0===ut.Ellipse?10:_context69.t0===ut.Pencil?10:_context69.t0===ut.Rectangle?10:_context69.t0===ut.Star?10:_context69.t0===ut.Polygon?10:_context69.t0===ut.SpeechBalloon?10:12;break;case 10:this.drawCount=0,this.fullLayer.removeAllChildren(),this.clearWorkShapeNodeCache(n);return _context69.abrupt("break",12);case 12:case"end":return _context69.stop();}},_callee66,this);}));function consumeDrawAll(_x80){return _consumeDrawAll2.apply(this,arguments);}return consumeDrawAll;}()},{key:"removeWork",value:function(){var _removeWork4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee67(t){var e,n,i,a;return _regeneratorRuntime().wrap(function _callee67$(_context70){while(1)switch(_context70.prev=_context70.next){case 0:e=t.workId,n=e==null?void 0:e.toString();if(!n){_context70.next=8;break;}i=this.removeNode(n);if(!i){_context70.next=8;break;}a=[];a.push({rect:wt(i),clearCanvas:St.Float,isClear:!0,viewId:this.viewId},{rect:wt(i),drawCanvas:St.Float,viewId:this.viewId});_context70.next=8;return this._post({render:a});case 8:case"end":return _context70.stop();}},_callee67,this);}));function removeWork(_x81){return _removeWork4.apply(this,arguments);}return removeWork;}()},{key:"removeNode",value:function removeNode(t){var e=this.workShapes.has(t);var n;return e&&(this.fullLayer.getElementsByName(t).forEach(function(i){var a=i.getBoundingClientRect();n=Pt(n,{x:a.x-vt.SafeBorderPadding,y:a.y-vt.SafeBorderPadding,w:a.width+vt.SafeBorderPadding*2,h:a.height+vt.SafeBorderPadding*2}),i.remove();}),n&&this.clearWorkShapeNodeCache(t)),n;}},{key:"drawPencil",value:function(){var _drawPencil2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee68(t,e){return _regeneratorRuntime().wrap(function _callee68$(_context71){while(1)switch(_context71.prev=_context71.next){case 0:_context71.next=2;return this._post({drawCount:this.drawCount,render:[{rect:t==null?void 0:t.rect,workId:e,drawCanvas:St.Float,viewId:this.viewId}],sp:(t==null?void 0:t.op)&&[t]});case 2:case"end":return _context71.stop();}},_callee68,this);}));function drawPencil(_x82,_x83){return _drawPencil2.apply(this,arguments);}return drawPencil;}()},{key:"drawShape",value:function(){var _drawShape2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee69(t){return _regeneratorRuntime().wrap(function _callee69$(_context72){while(1)switch(_context72.prev=_context72.next){case 0:_context72.next=2;return this._post({drawCount:this.drawCount,render:[{rect:(t==null?void 0:t.rect)&&wt(t.rect),isClear:!0,clearCanvas:St.Float,viewId:this.viewId},{rect:(t==null?void 0:t.rect)&&wt(t.rect),drawCanvas:St.Float,viewId:this.viewId}]});case 2:case"end":return _context72.stop();}},_callee69,this);}));function drawShape(_x84){return _drawShape2.apply(this,arguments);}return drawShape;}()}]);}(Ri);var Sm=/*#__PURE__*/function(){function Sm(r){_classCallCheck(this,Sm);et(this,"viewId");et(this,"vNodes");et(this,"topLayer");et(this,"thread");et(this,"post");et(this,"serviceWorkShapes",/* @__PURE__ */new Map());et(this,"localWorkShapes",/* @__PURE__ */new Map());et(this,"tmpOpt");et(this,"syncUnitTime",re.syncOpt.interval);et(this,"animationId");this.viewId=r.viewId,this.vNodes=r.vNodes,this.topLayer=r.topLayer,this.thread=r.thread,this.post=r.thread.post.bind(r.thread);}return _createClass(Sm,[{key:"canUseTopLayer",value:function canUseTopLayer(r){return r===ut.LaserPen;}},{key:"getWorkShape",value:function getWorkShape(r){return this.localWorkShapes.get(r);}},{key:"createWorkShape",value:function createWorkShape(r,t){if(r&&this.tmpOpt){var _e15={toolsType:this.tmpOpt.toolsType,toolsOpt:t||this.tmpOpt.toolsOpt},n=this.createWorkShapeNode(_objectSpread(_objectSpread({},_e15),{},{workId:r}));return n&&this.localWorkShapes.set(r,{node:n,toolsType:n.toolsType,workState:It.Start}),n;}}},{key:"setWorkOptions",value:function setWorkOptions(r,t){var n;var e=(n=this.localWorkShapes.get(r))==null?void 0:n.node;e||this.createWorkShape(r,t),e==null||e.setWorkOptions(t);}},{key:"createWorkShapeNode",value:function createWorkShapeNode(r){var t=r.toolsType;if(t===ut.LaserPen)return Fr(_objectSpread(_objectSpread({},r),{},{vNodes:this.vNodes,fullLayer:this.topLayer,drawLayer:this.topLayer}));}},{key:"clearAllWorkShapesCache",value:function clearAllWorkShapesCache(){this.localWorkShapes.forEach(function(r){var t;return(t=r.node)==null?void 0:t.clearTmpPoints();}),this.localWorkShapes.clear();}},{key:"setToolsOpt",value:function setToolsOpt(r){var t;this.tmpOpt=r,(t=r.toolsOpt)!=null&&t.syncUnitTime&&(this.syncUnitTime=r.toolsOpt.syncUnitTime);}},{key:"getToolsOpt",value:function getToolsOpt(){return this.tmpOpt;}},{key:"consumeDraw",value:function consumeDraw(r){var t=r.workId,e=r.dataType;if(e===Mt.Service)this.activeServiceWorkShape(r);else{var n=t==null?void 0:t.toString(),i=n&&this.localWorkShapes.get(n);if(!i)return;var a=i.node.consume({data:r,isFullWork:!1,isSubWorker:!0});a.rect&&(i.totalRect=Pt(a.rect,i.totalRect),i.result=a,i.workState=It.Doing,n&&this.localWorkShapes.set(n,i));}this.runAnimation();}},{key:"consumeDrawAll",value:function consumeDrawAll(r){var t=r.workId,e=r.dataType;if(e===Mt.Service)this.activeServiceWorkShape(r);else{var n=t==null?void 0:t.toString(),i=n&&this.localWorkShapes.get(n);if(!i)return;var a=i.node.consumeAll({data:r});i.totalRect=Pt(a.rect,i.totalRect),i.result=a,i.workState=It.Done,n&&this.localWorkShapes.set(n,i);}this.runAnimation();}},{key:"destroy",value:function destroy(){this.serviceWorkShapes.clear(),this.localWorkShapes.clear();}},{key:"setNodeKey",value:function setNodeKey(r,t,e,n){return t.toolsType=e,t.node=this.createWorkShapeNode({workId:r,toolsType:e,toolsOpt:n}),t;}},{key:"activeServiceWorkShape",value:function activeServiceWorkShape(r){var p,y;var t=r.workId,e=r.opt,n=r.toolsType,i=r.type,a=r.updateNodeOpt,o=r.ops,s=r.op;if(!t)return;var l=t.toString(),d=(p=this.vNodes.get(l))==null?void 0:p.rect;if(!((y=this.serviceWorkShapes)!=null&&y.has(l))){var P={toolsType:n,animationWorkData:s||[],animationIndex:0,type:i,updateNodeOpt:a,ops:o,oldRect:d};n&&e&&(P=this.setNodeKey(l,P,n,e)),this.serviceWorkShapes.set(l,P);}var c=this.serviceWorkShapes.get(l);i&&(c.type=i),o&&(c.animationWorkData=Me(o),c.ops=o),a&&(c.updateNodeOpt=a),s&&(c.animationWorkData=s),c.node&&c.node.getWorkId()!==l&&c.node.setWorkId(l),d&&(c.oldRect=d),n&&e&&(c.toolsType!==n&&n&&e&&this.setNodeKey(l,c,n,e),c.node&&c.node.setWorkOptions(e));}},{key:"computNextAnimationIndex",value:function computNextAnimationIndex(r,t){var e=Math.floor((r.animationWorkData||[]).slice(r.animationIndex).length*32/t/this.syncUnitTime)*t;return Math.min((r.animationIndex||0)+(e||t),(r.animationWorkData||[]).length);}},{key:"animationDraw",value:function(){var _animationDraw2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee70(){var _this101=this;var a,o,s,l,r,t,e,n,i,_iterator59,_step59,_step59$value,d,c,y,P,x,v,_iterator60,_step60,_step60$value,_d14,_c7,p,_y14,_P4,_x85,_v12;return _regeneratorRuntime().wrap(function _callee70$(_context73){while(1)switch(_context73.prev=_context73.next){case 0:this.animationId=void 0;r=!1;t=/* @__PURE__ */new Map(),e=[],n=[],i=[];_iterator59=_createForOfIteratorHelper(this.serviceWorkShapes.entries());_context73.prev=4;_iterator59.s();case 6:if((_step59=_iterator59.n()).done){_context73.next=20;break;}_step59$value=_slicedToArray(_step59.value,2),d=_step59$value[0],c=_step59$value[1];_context73.t0=c.toolsType;_context73.next=_context73.t0===ut.LaserPen?11:18;break;case 11:y=this.computNextAnimationIndex(c,8),P=Math.max(0,c.animationIndex||0),x=(c.animationWorkData||[]).slice(P,y);if((c.animationIndex||0)<y){v=(a=c.node)==null?void 0:a.consumeService({op:x,isFullWork:!1});c.totalRect=Pt(c.totalRect,v),c.animationIndex=y,x.length&&t.set(d,{workState:P===0?It.Start:y===((o=c.animationWorkData)==null?void 0:o.length)?It.Done:It.Doing,op:x.slice(-2)});}if(!(n.push({isClear:!0,rect:c.totalRect,clearCanvas:St.TopFloat,viewId:this.viewId}),e.push({rect:c.totalRect,drawCanvas:St.TopFloat,viewId:this.viewId}),c.isDel)){_context73.next=16;break;}(s=c.node)==null||s.clearTmpPoints(),this.serviceWorkShapes["delete"](d);return _context73.abrupt("break",18);case 16:c.ops&&c.animationIndex===((l=c.animationWorkData)==null?void 0:l.length)&&!c.isDel&&(this.topLayer.getElementsByName(d.toString())[0]||(c.isDel=!0,this.serviceWorkShapes.set(d,c))),r=!0;return _context73.abrupt("break",18);case 18:_context73.next=6;break;case 20:_context73.next=25;break;case 22:_context73.prev=22;_context73.t1=_context73["catch"](4);_iterator59.e(_context73.t1);case 25:_context73.prev=25;_iterator59.f();return _context73.finish(25);case 28:_iterator60=_createForOfIteratorHelper(this.localWorkShapes.entries());_context73.prev=29;_iterator60.s();case 31:if((_step60=_iterator60.n()).done){_context73.next=44;break;}_step60$value=_slicedToArray(_step60.value,2),_d14=_step60$value[0],_c7=_step60$value[1];p=_c7.result,_y14=_c7.toolsType,_P4=_c7.totalRect,_x85=_c7.isDel,_v12=_c7.workState;_context73.t2=_y14;_context73.next=_context73.t2===ut.LaserPen?37:42;break;case 37:if(!(_P4&&(n.push({isClear:!0,rect:_P4,clearCanvas:St.TopFloat,viewId:this.viewId}),e.push({rect:_P4,drawCanvas:St.TopFloat,viewId:this.viewId})),_x85)){_context73.next=40;break;}_c7.node.clearTmpPoints(),this.localWorkShapes["delete"](_d14),i.push({removeIds:[_d14.toString()],viewId:this.viewId,type:at.RemoveNode});return _context73.abrupt("break",42);case 40:p&&((p.op||p.ops)&&i.push(p),_c7.result=void 0),!this.topLayer.getElementsByName(_d14.toString())[0]&&_v12===It.Done&&(_c7.isDel=!0,this.localWorkShapes.set(_d14,_c7)),r=!0;return _context73.abrupt("break",42);case 42:_context73.next=31;break;case 44:_context73.next=49;break;case 46:_context73.prev=46;_context73.t3=_context73["catch"](29);_iterator60.e(_context73.t3);case 49:_context73.prev=49;_iterator60.f();return _context73.finish(49);case 52:r&&this.runAnimation(),t.size&&t.forEach(function(d,c){i.push({type:at.Cursor,uid:c.split(De)[0],op:d.op,workState:d.workState,viewId:_this101.viewId});}),(e.length||n.length||i.length)&&this.post({render:[].concat(n,e),sp:i});case 53:case"end":return _context73.stop();}},_callee70,this,[[4,22,25,28],[29,46,49,52]]);}));function animationDraw(){return _animationDraw2.apply(this,arguments);}return animationDraw;}()},{key:"runAnimation",value:function runAnimation(){var _this102=this;this.animationId||(this.animationId=setTimeout(function(){_this102.animationId=void 0,_this102.animationDraw();},16));}}]);}();var qe=/* @__PURE__ */function(h){return h.Full="full",h.Sub="sub",h;}(qe||{});var xm=/*#__PURE__*/function(){function xm(r,t){_classCallCheck(this,xm);et(this,"_self");et(this,"version",fi);et(this,"type");et(this,"hasPriorityDraw",!0);et(this,"workThreadMap",/* @__PURE__ */new Map());this._self=r,this.type=t,this.register();}return _createClass(xm,[{key:"init",value:function init(r){var t=r.viewId,e=r.dpr,n=r.offscreenCanvasOpt,i=r.layerOpt,a=r.isSafari;if(!e||!n||!i)return;var o;this.type==="full"&&(o=new Tm(t,{dpr:e,offscreenCanvasOpt:n,layerOpt:i},this.post.bind(this))),this.type==="sub"&&(o=new Di(t,{dpr:e,offscreenCanvasOpt:n,layerOpt:i},this.post.bind(this)),o.setHasPriorityDraw(this.hasPriorityDraw)),o&&a&&o.setIsSafari(a),o&&r.cameraOpt&&o.setCameraOpt(r.cameraOpt),o&&this.workThreadMap.set(t,o);}},{key:"register",value:function register(){var _this103=this;onmessage=/*#__PURE__*/function(){var _ref170=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee71(r){var t,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,_e16,n,i,a,o,_iterator61,_step61,l,_iterator62,_step62,_step62$value,_l8,d,c,_iterator63,_step63,_l9,s;return _regeneratorRuntime().wrap(function _callee71$(_context74){while(1)switch(_context74.prev=_context74.next){case 0:t=r.data;if(!t){_context74.next=56;break;}_iteratorAbruptCompletion=false;_didIteratorError=false;_context74.prev=4;_iterator=_asyncIterator(t.values());case 6:_context74.next=8;return _iterator.next();case 8:if(!(_iteratorAbruptCompletion=!(_step=_context74.sent).done)){_context74.next=40;break;}_e16=_step.value;n=_e16.msgType,i=_e16.viewId,a=_e16.tasksqueue,o=_e16.mainTasksqueueCount;if(!(n===at.Console)){_context74.next=14;break;}console.log(_this103);return _context74.abrupt("continue",37);case 14:if(!(n===at.Init)){_context74.next=17;break;}_this103.init(_e16);return _context74.abrupt("continue",37);case 17:if(!(_this103.type==="sub"&&(n===at.PriorityWorker||n===at.PriorityMainThreadWorker))){_context74.next=22;break;}n===at.PriorityWorker?_this103.hasPriorityDraw=!0:n===at.PriorityMainThreadWorker&&(_this103.hasPriorityDraw=!1);_iterator61=_createForOfIteratorHelper(_this103.workThreadMap.values());try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){l=_step61.value;l.setHasPriorityDraw(_this103.hasPriorityDraw);}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}return _context74.abrupt("continue",37);case 22:if(!(n===at.TasksQueue&&a!=null&&a.size)){_context74.next=27;break;}_iterator62=_createForOfIteratorHelper(_this103.workThreadMap.entries());try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){_step62$value=_slicedToArray(_step62.value,2),_l8=_step62$value[0],d=_step62$value[1];c=a.get(_l8);c&&d.on(c);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}_this103.type==="full"&&_t(o)&&_this103.post({workerTasksqueueCount:o});return _context74.abrupt("continue",37);case 27:if(!(i===Fi)){_context74.next=31;break;}_iterator63=_createForOfIteratorHelper(_this103.workThreadMap.values());try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){_l9=_step63.value;_l9.on(_e16),n===at.Destroy&&_this103.workThreadMap["delete"](i);}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}return _context74.abrupt("continue",37);case 31:s=_this103.workThreadMap.get(i);_context74.t0=s;if(!_context74.t0){_context74.next=37;break;}_context74.next=36;return s.on(_e16);case 36:n===at.Destroy&&_this103.workThreadMap["delete"](i);case 37:_iteratorAbruptCompletion=false;_context74.next=6;break;case 40:_context74.next=46;break;case 42:_context74.prev=42;_context74.t1=_context74["catch"](4);_didIteratorError=true;_iteratorError=_context74.t1;case 46:_context74.prev=46;_context74.prev=47;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context74.next=51;break;}_context74.next=51;return _iterator["return"]();case 51:_context74.prev=51;if(!_didIteratorError){_context74.next=54;break;}throw _iteratorError;case 54:return _context74.finish(51);case 55:return _context74.finish(46);case 56:case"end":return _context74.stop();}},_callee71,null,[[4,42,46,56],[47,,51,55]]);}));return function onmessage(_x86){return _ref170.apply(this,arguments);};}();}},{key:"post",value:function post(r,t){t?this._self.postMessage(r,t):this._self.postMessage(r);}}]);}();var Tm=/*#__PURE__*/function(_Ai){function Tm(t,e,n){var _this104;_classCallCheck(this,Tm);_this104=_callSuper(this,Tm,[t,e,"full"/* Full */]);et(_this104,"type","full");et(_this104,"serviceDrawLayer");et(_this104,"localDrawLayer");et(_this104,"snapshotFullLayer");et(_this104,"methodBuilder");et(_this104,"localWork");et(_this104,"serviceWork");et(_this104,"_post");et(_this104,"taskUpdateCameraId");et(_this104,"debounceUpdateCameraId");et(_this104,"debounceUpdateCache",/* @__PURE__ */new Set());_this104._post=n;var i=re.bufferSize.sub;_this104.serviceDrawLayer=_this104.createLayer("serviceDrawLayer",_this104.scene,_objectSpread(_objectSpread({},e.layerOpt),{},{bufferSize:i})),_this104.localDrawLayer=_this104.createLayer("localDrawLayer",_this104.scene,_objectSpread(_objectSpread({},e.layerOpt),{},{bufferSize:i}));var a={thread:_this104,viewId:_this104.viewId,vNodes:_this104.vNodes,fullLayer:_this104.fullLayer};_this104.localWork=new mm(_objectSpread(_objectSpread({},a),{},{drawLayer:_this104.localDrawLayer})),_this104.serviceWork=new vm(_objectSpread(_objectSpread({},a),{},{drawLayer:_this104.serviceDrawLayer})),_this104.methodBuilder=new ki([bt.CopyNode,bt.SetColorNode,bt.DeleteNode,bt.RotateNode,bt.ScaleNode,bt.TranslateNode,bt.ZIndexNode,bt.SetFontStyle,bt.SetPoint,bt.SetLock,bt.SetShapeOpt]).registerForWorker(_this104),_this104.vNodes.init(_this104.fullLayer);return _this104;}_inherits(Tm,_Ai);return _createClass(Tm,[{key:"combinePost",value:function(){var _combinePost=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee72(){var _this105=this;var a,o,_this$combinePostData,t,e,n,s,_iterator64,_step64,l,d,i;return _regeneratorRuntime().wrap(function _callee72$(_context75){while(1)switch(_context75.prev=_context75.next){case 0:_this$combinePostData=this.combinePostData(),t=_this$combinePostData.render,e=_objectWithoutProperties(_this$combinePostData,_excluded4);if(!(t!=null&&t.length)){_context75.next=28;break;}s=[];_iterator64=_createForOfIteratorHelper(t);_context75.prev=4;_iterator64.s();case 6:if((_step64=_iterator64.n()).done){_context75.next=19;break;}l=_step64.value;if(!l.rect){_context75.next=17;break;}if(!(l.rect=this.safariFixRect(Xt(l.rect),this.dpr),!l.rect)){_context75.next=11;break;}return _context75.abrupt("continue",17);case 11:if(!(l.drawCanvas&&l.rect&&l.rect.w>0&&l.rect.h>0)){_context75.next=16;break;}_context75.next=14;return this.getRectImageBitmap(l);case 14:d=_context75.sent;l.imageBitmap=d,n||(n=[]),n.push(d);case 16:s.push(l);case 17:_context75.next=6;break;case 19:_context75.next=24;break;case 21:_context75.prev=21;_context75.t0=_context75["catch"](4);_iterator64.e(_context75.t0);case 24:_context75.prev=24;_iterator64.f();return _context75.finish(24);case 27:e.render=s;case 28:i=(a=e.sp)==null?void 0:a.filter(function(s){return s.type!==at.None||s.isLockSentEventCursor;});i!=null&&i.length?e.sp=i.map(function(s){return _objectSpread(_objectSpread({},s),{},{viewId:_this105.viewId});}):delete e.sp,e.drawCount===void 0&&delete e.drawCount,(e!=null&&e.drawCount||i!=null&&i.length||(o=e.render)!=null&&o.length)&&this._post(e,n),this.delayPostDoneResolve&&this.delayPostDoneResolve(!0);case 30:case"end":return _context75.stop();}},_callee72,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 _callee73(t){var _this106=this;var e,n,i,a,o,s,l,d,_l10;return _regeneratorRuntime().wrap(function _callee73$(_context76){while(1)switch(_context76.prev=_context76.next){case 0:if(!this.methodBuilder.consumeForWorker(t)){_context76.next=2;break;}return _context76.abrupt("return");case 2:e=t.msgType,n=t.dataType,i=t.workId,a=t.toolsType,o=t.workState,s=t.workIds;_context76.t0=e;_context76.next=_context76.t0===at.AuthClear?6:_context76.t0===at.CreateWork?9:_context76.t0===at.DrawWork?11:_context76.t0===at.Select?20:_context76.t0===at.UpdateNode?27:_context76.t0===at.FullWork?27:_context76.t0===at.RemoveNode?29:_context76.t0===at.GetTextActive?32:_context76.t0===at.CursorHover?35:_context76.t0===at.CursorBlur?38:_context76.t0===at.GetVNodeInfo?41:43;break;case 6:l=t.clearUids,d=t.localUid;this.vNodes.setCanClearUids(l),this.vNodes.setLocalUid(d);return _context76.abrupt("break",43);case 9:a!==ut.LaserPen&&this.createLocalWork(t);return _context76.abrupt("break",43);case 11:_context76.t1=a!==ut.LaserPen;if(!_context76.t1){_context76.next=19;break;}if(!(o===It.Done&&n===Mt.Local)){_context76.next=18;break;}_context76.next=16;return this.consumeDrawAll(n,t);case 16:_context76.next=19;break;case 18:this.consumeDraw(n,t);case 19:return _context76.abrupt("break",43);case 20:if(!(i===Nt)){_context76.next=25;break;}_context76.next=23;return this.localWork.updateFullSelectWork(t);case 23:_context76.next=26;break;case 25:this.serviceWork.runSelectWork(t);case 26:return _context76.abrupt("return");case 27:this.consumeFull(n,t);return _context76.abrupt("return");case 29:_context76.next=31;return this.removeNode(t);case 31:return _context76.abrupt("return");case 32:_context76.next=34;return this.checkTextActive(t);case 34:return _context76.abrupt("return");case 35:_context76.next=37;return this.cursorHover(t);case 37:return _context76.abrupt("return");case 38:_context76.next=40;return this.cursorBlur();case 40:return _context76.abrupt("return");case 41:if(i&&s){_l10=s.map(function(d){return _this106.vNodes.get(d);});this.post({sp:[{type:at.GetVNodeInfo,dataType:Mt.Worker,workId:i,vInfo:_l10}]});}return _context76.abrupt("break",43);case 43:_context76.next=45;return _superPropGet(Tm,"on",this,3)([t]);case 45:case"end":return _context76.stop();}},_callee73,this);}));function on(_x87){return _on2.apply(this,arguments);}return on;}()},{key:"removeNode",value:function(){var _removeNode2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee74(t){var _this107=this;var e,n,i,a,o,_iterator65,_step65,_loop7;return _regeneratorRuntime().wrap(function _callee74$(_context78){while(1)switch(_context78.prev=_context78.next){case 0:e=t.dataType,n=t.workId,i=t.removeIds,a=[],o=i||[];if(!(n&&o.push(n.toString()),o.length)){_context78.next=20;break;}_iterator65=_createForOfIteratorHelper(o);_context78.prev=3;_loop7=/*#__PURE__*/_regeneratorRuntime().mark(function _loop7(){var s;return _regeneratorRuntime().wrap(function _loop7$(_context77){while(1)switch(_context77.prev=_context77.next){case 0:s=_step65.value;s===Nt?a.push(_this107.localWork.removeSelector(t,_this107)):e===Mt.Local?a.push(_this107.localWork.removeWork(t).then(function(){_this107.localWork.colloctEffectSelectWork(t),_this107.deleteCachedImagesByWorkId(s);})):e===Mt.Service&&a.push(_this107.serviceWork.removeWork(t).then(function(){_this107.localWork.colloctEffectSelectWork(t),_this107.deleteCachedImagesByWorkId(s);}));case 2:case"end":return _context77.stop();}},_loop7);});_iterator65.s();case 6:if((_step65=_iterator65.n()).done){_context78.next=10;break;}return _context78.delegateYield(_loop7(),"t0",8);case 8:_context78.next=6;break;case 10:_context78.next=15;break;case 12:_context78.prev=12;_context78.t1=_context78["catch"](3);_iterator65.e(_context78.t1);case 15:_context78.prev=15;_iterator65.f();return _context78.finish(15);case 18:_context78.next=20;return Promise.all(a);case 20:case"end":return _context78.stop();}},_callee74,null,[[3,12,15,18]]);}));function removeNode(_x88){return _removeNode2.apply(this,arguments);}return removeNode;}()},{key:"checkTextActive",value:function(){var _checkTextActive2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee75(t){var e;return _regeneratorRuntime().wrap(function _callee75$(_context79){while(1)switch(_context79.prev=_context79.next){case 0:e=t.dataType;_context79.t0=e===Mt.Local;if(!_context79.t0){_context79.next=5;break;}_context79.next=5;return this.localWork.checkTextActive(t);case 5:case"end":return _context79.stop();}},_callee75,this);}));function checkTextActive(_x89){return _checkTextActive2.apply(this,arguments);}return checkTextActive;}()},{key:"clearAll",value:function(){var _clearAll2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee76(){return _regeneratorRuntime().wrap(function _callee76$(_context80){while(1)switch(_context80.prev=_context80.next){case 0:this.vNodes.clear();_superPropGet(Tm,"clearAll",this,3)([]);this.localDrawLayer&&(this.localDrawLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),this.localDrawLayer.removeAllChildren());this.serviceDrawLayer&&(this.serviceDrawLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),this.serviceDrawLayer.removeAllChildren());_context80.next=6;return this.post({render:[{isClearAll:!0,clearCanvas:St.Bg,viewId:this.viewId},{isClearAll:!0,clearCanvas:St.ServiceFloat,viewId:this.viewId},{isClearAll:!0,clearCanvas:St.Float,viewId:this.viewId}],sp:[{type:at.Clear}]});case 6:case"end":return _context80.stop();}},_callee76,this);}));function clearAll(){return _clearAll2.apply(this,arguments);}return clearAll;}()},{key:"updateLayer",value:function updateLayer(t){var e=t.width,n=t.height;_superPropGet(Tm,"updateLayer",this,3)([t]),this.localDrawLayer&&(this.localDrawLayer.parent.setAttribute("width",e),this.localDrawLayer.parent.setAttribute("height",n),this.localDrawLayer.setAttribute("size",[e,n]),this.localDrawLayer.setAttribute("pos",[e*0.5,n*0.5])),this.serviceDrawLayer&&(this.serviceDrawLayer.parent.setAttribute("width",e),this.serviceDrawLayer.parent.setAttribute("height",n),this.serviceDrawLayer.setAttribute("size",[e,n]),this.serviceDrawLayer.setAttribute("pos",[e*0.5,n*0.5]));}},{key:"setCameraOpt",value:function setCameraOpt(t){this.cameraOpt=t;var e=t.scale,n=t.centerX,i=t.centerY,a=t.width,o=t.height;(a!==this.scene.width||o!==this.scene.height)&&this.updateScene({width:a,height:o}),this.fullLayer&&(this.fullLayer.setAttribute("scale",[e,e]),this.fullLayer.setAttribute("translate",[-n,-i])),this.localDrawLayer&&(this.localDrawLayer.setAttribute("scale",[e,e]),this.localDrawLayer.setAttribute("translate",[-n,-i])),this.serviceDrawLayer&&(this.serviceDrawLayer.setAttribute("scale",[e,e]),this.serviceDrawLayer.setAttribute("translate",[-n,-i]));}},{key:"getLayer",value:function getLayer(t){switch(t){case St.Bg:return this.fullLayer;case St.ServiceFloat:return this.serviceDrawLayer;case St.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 _callee77(t,e){var n;return _regeneratorRuntime().wrap(function _callee77$(_context81){while(1)switch(_context81.prev=_context81.next){case 0:_context81.next=2;return this.localWork.colloctEffectSelectWork(e);case 2:n=_context81.sent;_context81.t0=n&&t===Mt.Local;if(!_context81.t0){_context81.next=7;break;}_context81.next=7;return this.localWork.consumeFull(n);case 7:n&&t===Mt.Service&&this.serviceWork.consumeFull(n);case 8:case"end":return _context81.stop();}},_callee77,this);}));function consumeFull(_x90,_x91){return _consumeFull2.apply(this,arguments);}return consumeFull;}()},{key:"consumeDraw",value:function(){var _consumeDraw4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee78(t,e){var n;return _regeneratorRuntime().wrap(function _callee78$(_context82){while(1)switch(_context82.prev=_context82.next){case 0:n=e.workId;_context82.t0=t===Mt.Local&&n;if(!_context82.t0){_context82.next=6;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(e);_context82.next=6;return this.localWork.consumeDraw(e,this.serviceWork);case 6:t===Mt.Service&&this.serviceWork.consumeDraw(e);case 7:case"end":return _context82.stop();}},_callee78,this);}));function consumeDraw(_x92,_x93){return _consumeDraw4.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee79(t,e){var n;return _regeneratorRuntime().wrap(function _callee79$(_context83){while(1)switch(_context83.prev=_context83.next){case 0:n=e.workId;_context83.t0=t===Mt.Local&&n;if(!_context83.t0){_context83.next=6;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(e);_context83.next=6;return this.localWork.consumeDrawAll(e,this.serviceWork);case 6:case"end":return _context83.stop();}},_callee79,this);}));function consumeDrawAll(_x94,_x95){return _consumeDrawAll3.apply(this,arguments);}return consumeDrawAll;}()},{key:"updateCamera",value:function(){var _updateCamera=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee80(t){var _this108=this;var a,e,n,i,o,p,_iterator66,_step66,_step66$value,y,P,s,_iterator67,_step67,_step67$value,_p9,_y19,_P8,l,d,_p5,_iterator68,_step68,_y15,c,_iterator69,_step69,_p6,_y16,_iterator70,_step70,_P5,_iterator71,_step71,_step71$value,_p8,_y18,_P7,x,v,_T45,_f37,g,u,m,M,_iterator72,_step72,_step72$value,_p7,_y17;return _regeneratorRuntime().wrap(function _callee80$(_context84){while(1)switch(_context84.prev=_context84.next){case 0:e=[],n=t.cameraOpt,i=t.scenePath;if(!(n&&!oe(this.cameraOpt,n))){_context84.next=40;break;}this.taskUpdateCameraId&&(clearTimeout(this.taskUpdateCameraId),this.taskUpdateCameraId=void 0);o=!!this.serviceDrawLayer.children.length;if(!i){_context84.next=30;break;}p=!1;_iterator66=_createForOfIteratorHelper(this.localWork.getWorkShapes().entries());_context84.prev=7;_iterator66.s();case 9:if((_step66=_iterator66.n()).done){_context84.next=19;break;}_step66$value=_slicedToArray(_step66.value,2),y=_step66$value[0],P=_step66$value[1];_context84.t0=P.toolsType;_context84.next=_context84.t0===ut.Text?14:_context84.t0===ut.BitMapEraser?14:_context84.t0===ut.PencilEraser?14:_context84.t0===ut.Eraser?14:_context84.t0===ut.Selector?14:_context84.t0===ut.LaserPen?14:15;break;case 14:return _context84.abrupt("break",17);case 15:y!==be&&y!==Nt&&(p=!0);return _context84.abrupt("break",17);case 17:_context84.next=9;break;case 19:_context84.next=24;break;case 21:_context84.prev=21;_context84.t1=_context84["catch"](7);_iterator66.e(_context84.t1);case 24:_context84.prev=24;_iterator66.f();return _context84.finish(24);case 27:if(!p){_context84.next=30;break;}this.taskUpdateCameraId=setTimeout(function(){_this108.taskUpdateCameraId=void 0,_this108.updateCamera(t);},Cn);return _context84.abrupt("return");case 30:s=/* @__PURE__ */new Map();_iterator67=_createForOfIteratorHelper(this.vNodes.getNodesByType(ut.Text).entries());try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){_step67$value=_slicedToArray(_step67.value,2),_p9=_step67$value[0],_y19=_step67$value[1];_P8=_y19.rect;s.set(_p9,Xt(_P8));}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}l=new Set(s.keys());d=!1;if(this.localWork.hasSelector()){_p5=(a=this.localWork.getSelector())==null?void 0:a.selectIds;if(_p5){d=!0;_iterator68=_createForOfIteratorHelper(_p5);try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){_y15=_step68.value;l.add(_y15);}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}}}c=!1;if(this.serviceWork.selectorWorkShapes.size){_iterator69=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.values());try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){_p6=_step69.value;_y16=_p6.selectIds;if(_y16){c=!0;_iterator70=_createForOfIteratorHelper(_y16);try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){_P5=_step70.value;l.add(_P5);}}catch(err){_iterator70.e(err);}finally{_iterator70.f();}}}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}}if(this.setCameraOpt(n),this.vNodes.curNodeMap.size){this.vNodes.clearTarget(),this.vNodes.updateHighLevelNodesRect(l),this.debounceUpdateCameraId&&clearTimeout(this.debounceUpdateCameraId);_iterator71=_createForOfIteratorHelper(s.entries());try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){_step71$value=_slicedToArray(_step71.value,2),_p8=_step71$value[0],_y18=_step71$value[1];_P7=this.vNodes.get(_p8);if(_P7){x=_y18,v=_P7.rect,_T45=this.getSceneRect(),_f37=fr(x,_T45),g=fr(v,_T45);u=!1;if((_f37!==g||x.w!==v.w||x.h!==v.h||g===Te.intersect)&&(u=!0),u){m=_P7.toolsType,M=_P7.opt;m===ut.Text&&M.workState===It.Done&&this.debounceUpdateCache.add(_p8);}}}}catch(err){_iterator71.e(err);}finally{_iterator71.f();}if(d&&this.localWork.reRenderSelector(),c){_iterator72=_createForOfIteratorHelper(this.serviceWork.selectorWorkShapes.entries());try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){_step72$value=_slicedToArray(_step72.value,2),_p7=_step72$value[0],_y17=_step72$value[1];this.serviceWork.runSelectWork({workId:_p7,selectIds:_y17.selectIds,msgType:at.Select,dataType:Mt.Service,viewId:this.viewId});}}catch(err){_iterator72.e(err);}finally{_iterator72.f();}}this.debounceUpdateCameraId=setTimeout(function(){var y;_this108.debounceUpdateCameraId=void 0;var p=[];var _iterator73=_createForOfIteratorHelper(_this108.debounceUpdateCache.values()),_step73;try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var _P6=_step73.value;if((y=_this108.fullLayer)==null?void 0:y.getElementsByName(_P6)[0]){var v=_this108.vNodes.get(_P6);if(v){var _T44=v.toolsType,_f36=v.opt,g=v.rect,u=_this108.localWork.setFullWork({toolsType:_T44,opt:_f36,workId:_P6});if(u){var m=_this108.getSceneRect(),M=fr(g,m);p.push(u.consumeServiceAsync({isFullWork:!0,replaceId:_P6,isDrawLabel:M!==Te.outside}));}}}_this108.debounceUpdateCache["delete"](_P6);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}p.length?Promise.all(p).then(function(){var P=[];P.push({isClearAll:!0,clearCanvas:St.Bg,viewId:_this108.viewId},{isDrawAll:!0,drawCanvas:St.Bg,viewId:_this108.viewId}),P.length&&_this108.post({render:P}),_this108.vNodes.updateLowLevelNodesRect(),_this108.vNodes.clearHighLevelIds();}):(_this108.vNodes.updateLowLevelNodesRect(),_this108.vNodes.clearHighLevelIds());},Cn);}o&&e.push({isClearAll:!0,clearCanvas:St.ServiceFloat,viewId:this.viewId}),this.vNodes.hasRenderNodes()&&e.push({isClearAll:!0,clearCanvas:St.Bg,viewId:this.viewId},{isDrawAll:!0,drawCanvas:St.Bg,viewId:this.viewId}),e.length&&this.post({render:e});case 40:case"end":return _context84.stop();}},_callee80,this,[[7,21,24,27]]);}));function updateCamera(_x96){return _updateCamera.apply(this,arguments);}return updateCamera;}()},{key:"getRectImageBitmap",value:function getRectImageBitmap(t){var e=t.rect,n=t.drawCanvas,i=Math.floor(e.x*this.dpr),a=Math.floor(e.y*this.dpr),o=Math.floor(e.w*this.dpr||1),s=Math.floor(e.h*this.dpr||1);return createImageBitmap(this.getOffscreen(n),i,a,o,s,{resizeQuality:"low"});}},{key:"cursorHover",value:function(){var _cursorHover2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee81(t){return _regeneratorRuntime().wrap(function _callee81$(_context85){while(1)switch(_context85.prev=_context85.next){case 0:_context85.next=2;return this.localWork.cursorHover(t);case 2:case"end":return _context85.stop();}},_callee81,this);}));function cursorHover(_x97){return _cursorHover2.apply(this,arguments);}return cursorHover;}()},{key:"cursorBlur",value:function(){var _cursorBlur2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee82(){return _regeneratorRuntime().wrap(function _callee82$(_context86){while(1)switch(_context86.prev=_context86.next){case 0:_context86.next=2;return this.localWork.cursorBlur();case 2:case"end":return _context86.stop();}},_callee82,this);}));function cursorBlur(){return _cursorBlur2.apply(this,arguments);}return cursorBlur;}()},{key:"destroy",value:function destroy(){_superPropGet(Tm,"destroy",this,3)([]);}}]);}(Ai);var Di=/*#__PURE__*/function(_Ai2){function Di(t,e,n){var _this109;_classCallCheck(this,Di);_this109=_callSuper(this,Di,[t,e,"sub"/* Sub */]);et(_this109,"type","sub");et(_this109,"_post");et(_this109,"topLayer");et(_this109,"snapshotFullLayer");et(_this109,"serviceWork");et(_this109,"localWork");et(_this109,"topLayerWork");_this109._post=n;var i=re.bufferSize.sub;_this109.topLayer=_this109.createLayer("topLayer",_this109.scene,_objectSpread(_objectSpread({},e.layerOpt),{},{bufferSize:i}));var a={thread:_this109,viewId:_this109.viewId,vNodes:_this109.vNodes,fullLayer:_this109.fullLayer,topLayer:_this109.topLayer};_this109.localWork=new ym(a),_this109.topLayerWork=new Sm(a),_this109.vNodes.init(_this109.fullLayer);return _this109;}_inherits(Di,_Ai2);return _createClass(Di,[{key:"combinePost",value:function(){var _combinePost2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee83(){var _this110=this;var a,o,s,_this$combinePostData2,t,e,n,l,_iterator74,_step74,_d15,_i11,_l11,d,_l12,_iterator75,_step75,_d16,c,i;return _regeneratorRuntime().wrap(function _callee83$(_context87){while(1)switch(_context87.prev=_context87.next){case 0:_this$combinePostData2=this.combinePostData(),t=_this$combinePostData2.render,e=_objectWithoutProperties(_this$combinePostData2,_excluded5);if((a=e.workIds)!=null&&a.size&&e.drawCount){l=[];_iterator74=_createForOfIteratorHelper(e.workIds.values());try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){_d15=_step74.value;this.fullLayer.getElementsByName(_d15).forEach(function(c){c.id&&e.drawCount&&Number(c.id)<e.drawCount&&l.push(c);});}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}for(_i11=0,_l11=l;_i11<_l11.length;_i11++){d=_l11[_i11];d.remove(),d.disconnect();}}if(!(t!=null&&t.length)){_context87.next=29;break;}_l12=[];_iterator75=_createForOfIteratorHelper(t);_context87.prev=5;_iterator75.s();case 7:if((_step75=_iterator75.n()).done){_context87.next=20;break;}_d16=_step75.value;if(!_d16.rect){_context87.next=18;break;}if(!(_d16.rect=this.safariFixRect(Xt(_d16.rect),this.dpr),!_d16.rect)){_context87.next=12;break;}return _context87.abrupt("continue",18);case 12:if(!(_d16.drawCanvas&&_d16.rect&&_d16.rect.w>0&&_d16.rect.h>0)){_context87.next=17;break;}_context87.next=15;return this.getRectImageBitmap(_d16);case 15:c=_context87.sent;_d16.imageBitmap=c,n||(n=[]),n.push(c);case 17:_l12.push(_d16);case 18:_context87.next=7;break;case 20:_context87.next=25;break;case 22:_context87.prev=22;_context87.t0=_context87["catch"](5);_iterator75.e(_context87.t0);case 25:_context87.prev=25;_iterator75.f();return _context87.finish(25);case 28:e.render=_l12;case 29:i=(o=e.sp)==null?void 0:o.filter(function(l){return l.type!==at.None;});i!=null&&i.length?e.sp=i.map(function(l){return _objectSpread(_objectSpread({},l),{},{viewId:_this110.viewId});}):delete e.sp,e.drawCount===void 0&&delete e.drawCount,(i!=null&&i.length||e.drawCount||(s=e==null?void 0:e.render)!=null&&s.length)&&this._post(e,n),this.delayPostDoneResolve&&this.delayPostDoneResolve(!0);case 31:case"end":return _context87.stop();}},_callee83,this,[[5,22,25,28]]);}));function combinePost(){return _combinePost2.apply(this,arguments);}return combinePost;}()},{key:"getLayer",value:function getLayer(t,e){if(e&&this.snapshotFullLayer)return this.snapshotFullLayer;switch(t){case St.TopFloat:return this.topLayer;default:return this.fullLayer;}}},{key:"on",value:function(){var _on3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee84(t){var e,n,i,a,o,s;return _regeneratorRuntime().wrap(function _callee84$(_context88){while(1)switch(_context88.prev=_context88.next){case 0:e=t.msgType,n=t.toolsType,i=t.opt,a=t.dataType,o=t.workState;_context88.t0=e;_context88.next=_context88.t0===at.UpdateTools?4:_context88.t0===at.CreateWork?9:_context88.t0===at.DrawWork?11:_context88.t0===at.RemoveNode?18:_context88.t0===at.FullWork?21:_context88.t0===at.Snapshot?26:_context88.t0===at.BoundingBox?33:40;break;case 4:if(!(n&&this.topLayerWork.canUseTopLayer(n)&&i)){_context88.next=8;break;}s={toolsType:n,toolsOpt:i};this.topLayerWork.setToolsOpt(s);return _context88.abrupt("return");case 8:return _context88.abrupt("break",40);case 9:this.createLocalWork(t);return _context88.abrupt("return");case 11:if(!(o===It.Done&&a===Mt.Local)){_context88.next=16;break;}_context88.next=14;return this.consumeDrawAll(a,t);case 14:_context88.next=17;break;case 16:this.consumeDraw(a,t);case 17:return _context88.abrupt("return");case 18:_context88.next=20;return this.removeNode(t);case 20:return _context88.abrupt("return");case 21:_context88.t1=n&&this.topLayerWork.canUseTopLayer(n);if(!_context88.t1){_context88.next=25;break;}_context88.next=25;return this.consumeDrawAll(a,t);case 25:return _context88.abrupt("return");case 26:this.snapshotFullLayer=this.createLayer("snapshotFullLayer",this.scene,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Qe?6e3:3e3}));_context88.t2=this.snapshotFullLayer;if(!_context88.t2){_context88.next=32;break;}_context88.next=31;return this.getSnapshot(t);case 31:this.snapshotFullLayer=void 0;case 32:return _context88.abrupt("return");case 33:this.snapshotFullLayer=this.createLayer("snapshotFullLayer",this.scene,_objectSpread(_objectSpread({},this.opt.layerOpt),{},{bufferSize:this.viewId===Qe?6e3:3e3}));_context88.t3=this.snapshotFullLayer;if(!_context88.t3){_context88.next=39;break;}_context88.next=38;return this.getBoundingRect(t);case 38:this.snapshotFullLayer=void 0;case 39:return _context88.abrupt("return");case 40:_context88.next=42;return _superPropGet(Di,"on",this,3)([t]);case 42:case"end":return _context88.stop();}},_callee84,this);}));function on(_x98){return _on3.apply(this,arguments);}return on;}()},{key:"createLocalWork",value:function createLocalWork(t){var e=t.workId,n=t.toolsType,i=t.opt;if(n&&this.topLayerWork.canUseTopLayer(n)&&e&&i){this.topLayerWork.getToolsOpt()||this.topLayerWork.setToolsOpt({toolsType:n,toolsOpt:i}),this.topLayerWork.setWorkOptions(e.toString(),i);return;}n&&this.localWork.canUseSubWorker(n)&&_superPropGet(Di,"createLocalWork",this,3)([t]);}},{key:"removeNode",value:function(){var _removeNode3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee85(t){var e;return _regeneratorRuntime().wrap(function _callee85$(_context89){while(1)switch(_context89.prev=_context89.next){case 0:e=t.dataType;_context89.t0=e===Mt.Local;if(!_context89.t0){_context89.next=5;break;}_context89.next=5;return this.localWork.removeWork(t);case 5:case"end":return _context89.stop();}},_callee85,this);}));function removeNode(_x99){return _removeNode3.apply(this,arguments);}return removeNode;}()},{key:"getOffscreen",value:function getOffscreen(t,e){return this.getLayer(t,e).parent.canvas;}},{key:"consumeDraw",value:function(){var _consumeDraw5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee86(t,e){var n,i;return _regeneratorRuntime().wrap(function _callee86$(_context90){while(1)switch(_context90.prev=_context90.next){case 0:n=e.workId,i=e.toolsType;if(!n){_context90.next=11;break;}if(!(i&&this.topLayerWork.canUseTopLayer(i))){_context90.next=5;break;}t===Mt.Local&&(this.topLayerWork.getWorkShape(n.toString())||this.createLocalWork(e)),this.topLayerWork.consumeDraw(e);return _context90.abrupt("return");case 5:_context90.t0=i&&this.localWork.canUseSubWorker(i);if(!_context90.t0){_context90.next=10;break;}this.localWork.getWorkShape(n.toString())||this.createLocalWork(e);_context90.next=10;return this.localWork.consumeDraw(e);case 10:return _context90.abrupt("return");case 11:case"end":return _context90.stop();}},_callee86,this);}));function consumeDraw(_x100,_x101){return _consumeDraw5.apply(this,arguments);}return consumeDraw;}()},{key:"consumeDrawAll",value:function(){var _consumeDrawAll4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee87(t,e){var n,i,a,o;return _regeneratorRuntime().wrap(function _callee87$(_context91){while(1)switch(_context91.prev=_context91.next){case 0:n=e.workId,i=e.toolsType,a=e.dataType;if(!n){_context91.next=8;break;}o=n.toString();if(!(i&&this.topLayerWork.canUseTopLayer(i))){_context91.next=6;break;}a===Mt.Local&&(this.topLayerWork.getWorkShape(o)||this.createLocalWork(e)),this.topLayerWork.consumeDrawAll(e);return _context91.abrupt("return");case 6:i&&this.localWork.canUseSubWorker(i)&&(this.localWork.getWorkShape(o)||_superPropGet(Di,"createLocalWork",this,3)([e]),this.localWork.consumeDrawAll(e));return _context91.abrupt("return");case 8:case"end":return _context91.stop();}},_callee87,this);}));function consumeDrawAll(_x102,_x103){return _consumeDrawAll4.apply(this,arguments);}return consumeDrawAll;}()},{key:"clearAll",value:function(){var _clearAll3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee88(){return _regeneratorRuntime().wrap(function _callee88$(_context92){while(1)switch(_context92.prev=_context92.next){case 0:this.vNodes.clear();_superPropGet(Di,"clearAll",this,3)([]);this.topLayer&&(this.topLayer.parent.children.forEach(function(t){t.name!=="viewport"&&t.remove();}),this.topLayer.removeAllChildren());_context92.next=5;return this.post({render:[{isClearAll:!0,clearCanvas:St.TopFloat,viewId:this.viewId}],sp:[{type:at.Clear}]});case 5:case"end":return _context92.stop();}},_callee88,this);}));function clearAll(){return _clearAll3.apply(this,arguments);}return clearAll;}()},{key:"getRectImageBitmap",value:function getRectImageBitmap(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var n=arguments.length>2?arguments[2]:undefined;var i=t.rect,a=t.drawCanvas,o=Math.floor(i.x*this.dpr),s=Math.floor(i.y*this.dpr),l=Math.floor(i.w*this.dpr||1),d=Math.floor(i.h*this.dpr||1);return createImageBitmap(this.getOffscreen(a,e),o,s,l,d,n);}},{key:"updateLayer",value:function updateLayer(t){var e=t.width,n=t.height;_superPropGet(Di,"updateLayer",this,3)([t]),this.topLayer&&(this.topLayer.parent.setAttribute("width",e),this.topLayer.parent.setAttribute("height",n),this.topLayer.setAttribute("size",[e,n]),this.topLayer.setAttribute("pos",[e*0.5,n*0.5])),this.snapshotFullLayer&&(this.snapshotFullLayer.parent.setAttribute("width",e),this.snapshotFullLayer.parent.setAttribute("height",n),this.snapshotFullLayer.setAttribute("size",[e,n]),this.snapshotFullLayer.setAttribute("pos",[e*0.5,n*0.5]));}},{key:"updateCamera",value:function(){var _updateCamera2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee89(t){var _this111=this;var e,n,i,a,_iterator76,_step76,_loop8;return _regeneratorRuntime().wrap(function _callee89$(_context94){while(1)switch(_context94.prev=_context94.next){case 0:e=[],n=t.cameraOpt;if(!(n&&!oe(this.cameraOpt,n))){_context94.next=25;break;}i=!!this.topLayerWork.localWorkShapes.size,a=!!this.localWork.getWorkShapes().size;if(!(a&&this.localWork.workShapesDone(),this.setCameraOpt(n),a&&e.push({isClearAll:!0,clearCanvas:St.Float,viewId:this.viewId}),i)){_context94.next=21;break;}e.push({isClearAll:!0,clearCanvas:St.TopFloat,viewId:this.viewId});_iterator76=_createForOfIteratorHelper(this.topLayerWork.localWorkShapes.entries());_context94.prev=6;_loop8=/*#__PURE__*/_regeneratorRuntime().mark(function _loop8(){var _step76$value,o,s,l;return _regeneratorRuntime().wrap(function _loop8$(_context93){while(1)switch(_context93.prev=_context93.next){case 0:_step76$value=_slicedToArray(_step76.value,2),o=_step76$value[0],s=_step76$value[1];if(s.totalRect){_this111.topLayer.getElementsByName(o.toString()).forEach(function(d){var c=d.getBoundingClientRect(),p=wt({x:c.x,y:c.y,w:c.width,h:c.height});l=Pt(l,p);}),s.totalRect=l,_this111.topLayerWork.localWorkShapes.set(o,s);}case 2:case"end":return _context93.stop();}},_loop8);});_iterator76.s();case 9:if((_step76=_iterator76.n()).done){_context94.next=13;break;}return _context94.delegateYield(_loop8(),"t0",11);case 11:_context94.next=9;break;case 13:_context94.next=18;break;case 15:_context94.prev=15;_context94.t1=_context94["catch"](6);_iterator76.e(_context94.t1);case 18:_context94.prev=18;_iterator76.f();return _context94.finish(18);case 21:_context94.t2=e.length;if(!_context94.t2){_context94.next=25;break;}_context94.next=25;return this.post({render:e});case 25:case"end":return _context94.stop();}},_callee89,this,[[6,15,18,21]]);}));function updateCamera(_x104){return _updateCamera2.apply(this,arguments);}return updateCamera;}()},{key:"setCameraOpt",value:function setCameraOpt(t,e){this.cameraOpt=t;var n=t.scale,i=t.centerX,a=t.centerY,o=t.width,s=t.height;(o!==this.scene.width||s!==this.scene.height)&&this.updateScene({width:o,height:s}),e?(e.setAttribute("scale",[n,n]),e.setAttribute("translate",[-i,-a])):(this.fullLayer.setAttribute("scale",[n,n]),this.fullLayer.setAttribute("translate",[-i,-a]),this.topLayer.setAttribute("scale",[n,n]),this.topLayer.setAttribute("translate",[-i,-a]));}},{key:"getSnapshot",value:function(){var _getSnapshot=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee90(t){var e,n,i,a,o,s,l,_i12,_Object$entries,_Object$entries$_i,c,p,y,P,x,d;return _regeneratorRuntime().wrap(function _callee90$(_context95){while(1)switch(_context95.prev=_context95.next){case 0:e=t.scenePath,n=t.scenes,i=t.cameraOpt,a=t.w,o=t.h;if(!(e&&n&&i&&this.snapshotFullLayer)){_context95.next=26;break;}s=Xt(this.cameraOpt);this.setCameraOpt(i,this.snapshotFullLayer),this.localWork.fullLayer=this.snapshotFullLayer,this.localWork.drawLayer=void 0;_i12=0,_Object$entries=Object.entries(n);case 5:if(!(_i12<_Object$entries.length)){_context95.next=21;break;}_Object$entries$_i=_slicedToArray(_Object$entries[_i12],2),c=_Object$entries$_i[0],p=_Object$entries$_i[1];if(!(p!=null&&p.type)){_context95.next=18;break;}_context95.t0=p==null?void 0:p.type;_context95.next=_context95.t0===at.UpdateNode?11:_context95.t0===at.FullWork?11:18;break;case 11:y=p.opt;P=_objectSpread(_objectSpread({},p),{},{opt:y,workId:c,msgType:at.FullWork,dataType:Mt.Service,viewId:this.viewId});_context95.next=15;return this.localWork.runFullWork(P);case 15:x=_context95.sent;l=Pt(l,x);return _context95.abrupt("break",18);case 18:_i12++;_context95.next=5;break;case 21:a&&o&&(d={resizeWidth:a,resizeHeight:o});_context95.next=24;return this.getSnapshotRender({scenePath:e,curCameraOpt:s,options:d});case 24:this.localWork.fullLayer=this.fullLayer;this.localWork.drawLayer=void 0;case 26:case"end":return _context95.stop();}},_callee90,this);}));function getSnapshot(_x105){return _getSnapshot.apply(this,arguments);}return getSnapshot;}()},{key:"getSnapshotRender",value:function(){var _getSnapshotRender=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee91(t){var o,s,e,n,i,a;return _regeneratorRuntime().wrap(function _callee91$(_context96){while(1)switch(_context96.prev=_context96.next){case 0:e=t.scenePath,n=t.curCameraOpt,i=t.options;((o=this.snapshotFullLayer)==null?void 0:o.parent).render();_context96.next=4;return this.getRectImageBitmap({rect:this.getSceneRect(),drawCanvas:St.None},!0,i);case 4:a=_context96.sent;a&&(this._post({sp:[{type:at.Snapshot,scenePath:e,imageBitmap:a,viewId:this.viewId}]},[a]),a.close(),(s=this.snapshotFullLayer)==null||s.removeAllChildren(),this.setCameraOpt(n,this.fullLayer));case 6:case"end":return _context96.stop();}},_callee91,this);}));function getSnapshotRender(_x106){return _getSnapshotRender.apply(this,arguments);}return getSnapshotRender;}()},{key:"getBoundingRect",value:function(){var _getBoundingRect=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee92(t){var e,n,i,a,o,_i13,_Object$entries2,_Object$entries2$_i,s,l,d;return _regeneratorRuntime().wrap(function _callee92$(_context97){while(1)switch(_context97.prev=_context97.next){case 0:e=t.scenePath,n=t.scenes,i=t.cameraOpt;if(!(e&&n&&i&&this.snapshotFullLayer)){_context97.next=27;break;}a=Xt(this.cameraOpt);this.setCameraOpt(i,this.snapshotFullLayer),this.localWork.fullLayer=this.snapshotFullLayer,this.localWork.drawLayer=void 0;_i13=0,_Object$entries2=Object.entries(n);case 5:if(!(_i13<_Object$entries2.length)){_context97.next=19;break;}_Object$entries2$_i=_slicedToArray(_Object$entries2[_i13],2),s=_Object$entries2$_i[0],l=_Object$entries2$_i[1];if(!(l!=null&&l.type)){_context97.next=16;break;}_context97.t0=l==null?void 0:l.type;_context97.next=_context97.t0===at.UpdateNode?11:_context97.t0===at.FullWork?11:16;break;case 11:_context97.next=13;return this.localWork.runFullWork(_objectSpread(_objectSpread({},l),{},{workId:s,msgType:at.FullWork,dataType:Mt.Service,viewId:this.viewId}));case 13:d=_context97.sent;o=Pt(o,d);return _context97.abrupt("break",16);case 16:_i13++;_context97.next=5;break;case 19:_context97.t1=o;if(!_context97.t1){_context97.next=23;break;}_context97.next=23;return this.post({sp:[{type:at.BoundingBox,scenePath:e,rect:o}]});case 23:this.localWork.fullLayer=this.fullLayer;this.localWork.drawLayer=void 0;this.snapshotFullLayer.removeAllChildren();this.setCameraOpt(a,this.fullLayer);case 27:case"end":return _context97.stop();}},_callee92,this);}));function getBoundingRect(_x107){return _getBoundingRect.apply(this,arguments);}return getBoundingRect;}()}]);}(Ai);var Wn=self;Wn.sub=new xm(Wn,qe.Sub);