@idraw/core 0.2.0-alpha.21 → 0.2.0-alpha.22

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 +1 @@
1
- var iDrawCore=function(){'use strict';var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};var e=function(){return e=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},e.apply(this,arguments)};function o(t,e,o,n){return new(o||(o=Promise))((function(r,i){function s(t){try{a(n.next(t))}catch(t){i(t)}}function l(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,l)}a((n=n.apply(t,e||[])).next())}))}function n(t,e){var o,n,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var r=function(){return r=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},r.apply(this,arguments)};function i(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function s(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var l={type:function(t,e){var o=s(t);return!0===e?o.toLocaleLowerCase():o},array:function(t){return'Array'===s(t)},json:function(t){return'Object'===s(t)},function:function(t){return'Function'===s(t)},asyncFunction:function(t){return'AsyncFunction'===s(t)},string:function(t){return'String'===s(t)},number:function(t){return'Number'===s(t)},undefined:function(t){return'Undefined'===s(t)},null:function(t){return'Null'===s(t)},promise:function(t){return'Promise'===s(t)}},a=function(){return a=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a.apply(this,arguments)};function c(t,e,o,n){return new(o||(o=Promise))((function(r,i){function s(t){try{a(n.next(t))}catch(t){i(t)}}function l(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,l)}a((n=n.apply(t,e||[])).next())}))}function u(t,e){var o,n,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function h(t,e){var o=e.width,n=e.height;return new Promise((function(e,r){var i=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(o||'')+"\" height = \""+(n||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(i),s.onload=function(t){var o,n=null===(o=null==t?void 0:t.target)||void 0===o?void 0:o.result;e(n)},s.onerror=function(t){r(t)}}))}function f(t){return new Promise((function(e,o){var n=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),r=new FileReader;r.readAsDataURL(n),r.onload=function(t){var o,n=null===(o=null==t?void 0:t.target)||void 0===o?void 0:o.result;e(n)},r.onerror=function(t){o(t)}}))}var d=window.Image;function p(t){return new Promise((function(e,o){var n=new d;n.onload=function(){e(n)},n.onabort=o,n.onerror=o,n.src=t}))}var v=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=a(a({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=a(a({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,o,n,r,i){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(o),n,r,i)},t.prototype.rect=function(t,e,o,n){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.fillRect=function(t,e,o,n){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.clearRect=function(t,e,o,n){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,o,n,r){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n),this._doSize(r))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var o=t[0],n=t[1],r=t[2],i=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],u=t[t.length-1];return 9===t.length?this._ctx.drawImage(o,this._doSize(n),this._doSize(r),this._doSize(i),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(u)):this._ctx.drawImage(o,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(u))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,o,n){return void 0!==n?this._ctx.fillText(t,this._doSize(e),this._doSize(o),this._doSize(n)):this._ctx.fillText(t,this._doSize(e),this._doSize(o))},t.prototype.strokeText=function(t,e,o,n){return void 0!==n?this._ctx.strokeText(t,this._doSize(e),this._doSize(o),this._doSize(n)):this._ctx.strokeText(t,this._doSize(e),this._doSize(o))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,o,n,r,i,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n),r,i,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,o=e.scale,n=(t-e.scrollX)/o;return this._doSize(n)},t.prototype._doY=function(t){var e=this._transform,o=e.scale,n=(t-e.scrollY)/o;return this._doSize(n)},t}();function g(t){return'number'==typeof t&&(t>0||t<=0)}function y(t){return'number'==typeof t&&t>=0}function m(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function _(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var x={x:function(t){return g(t)},y:function(t){return g(t)},w:y,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:g,borderWidth:function(t){return y(t)},borderRadius:function(t){return g(t)&&t>=0},color:function(t){return i(t)},imageSrc:function(t){return _(t)||m(t)},imageURL:m,imageBase64:_,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var o=document.createElement('div');o.innerHTML=t,o.children.length>0&&(e=!0),o=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return g(t)&&t>0},lineHeight:function(t){return g(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return g(t)&&t>0}};function S(t){void 0===t&&(t={});var e=t.borderColor,o=t.borderRadius,n=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!x.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!x.number(o))&&!(t.hasOwnProperty('borderWidth')&&!x.number(n)))}var b={attrs:function(t){var e=t.x,o=t.y,n=t.w,r=t.h,i=t.angle;return!!(x.x(e)&&x.y(o)&&x.w(n)&&x.h(r)&&x.angle(i))&&(i>=-360&&i<=360)},textDesc:function(t){var e=t.text,o=t.color,n=t.fontSize,r=t.lineHeight,i=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,u=t.strokeColor;return!!x.text(e)&&(!!x.color(o)&&(!!x.fontSize(n)&&(!(t.hasOwnProperty('bgColor')&&!x.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!x.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!x.lineHeight(r))&&(!(t.hasOwnProperty('fontFamily')&&!x.fontFamily(i))&&(!(t.hasOwnProperty('textAlign')&&!x.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!x.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!x.color(u))&&!!S(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!x.color(e))&&!!S(t)},circleDesc:function(t){var e=t.bgColor,o=t.borderColor,n=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!x.color(e))&&(!(t.hasOwnProperty('borderColor')&&!x.color(o))&&!(t.hasOwnProperty('borderWidth')&&!x.number(n)))},imageDesc:function(t){var e=t.src;return!!x.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!x.svg(e)},htmlDesc:function(t){var e=t.html;return!!x.html(e)}},w={is:x,check:b,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,o){return function n(r){var i=t[r];r===t.length&&o&&(i=o);if(!i)return Promise.resolve();try{return Promise.resolve(i(e,n.bind(null,r+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var o=-1;return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];o>0||(o=setTimeout((function(){t.apply(void 0,n),o=-1}),e))}}},loader:{loadImage:p,loadSVG:function(t){return c(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,f(t)];case 1:return[4,p(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return c(this,void 0,void 0,(function(){return u(this,(function(o){switch(o.label){case 0:return[4,h(t,e)];case 1:return[4,p(o.sent())];case 2:return[2,o.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var o=e.filename,n=e.type,r=void 0===n?'image/jpeg':n,i=t.toDataURL(r),s=document.createElement('a');s.href=i,s.download=o;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:i},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:l,data:{deepClone:function(t){return function t(e){var o,n=(o=e,Object.prototype.toString.call(o).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(n)>=0)return e;if('Array'===n){var r=[];return e.forEach((function(e){r.push(t(e))})),r}if('Object'===n){var i={};return Object.keys(e).forEach((function(o){i[o]=t(e[o])})),i}}(t)}},Context:v},E=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);null==o||o.push(e),this._listeners.set(t,o||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);if(Array.isArray(o))for(var n=0;n<(null==o?void 0:o.length);n++)if(o[n]===e){o.splice(n,1);break}this._listeners.set(t,o||[])}},t.prototype.trigger=function(t,e){var o=this._listeners.get(t);return!!Array.isArray(o)&&(o.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var C=function(){function t(){this._temp={prevClickPoint:null,isHoverCanvas:!1,isDragCanvas:!1,statusMap:{canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}}}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp={prevClickPoint:null,isHoverCanvas:!1,isDragCanvas:!1,statusMap:{canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}}},t}(),P=function(){function t(t,e){this._isMoving=!1,this._temp=new C,this._container=window,this._canvas=t,this._isMoving=!1,this._initEvent(),this._event=new E}return t.prototype.setStatusMap=function(t){this._temp.set('statusMap',t)},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype._initEvent=function(){var t=this._canvas,e=this._container;e.addEventListener('mousemove',this._listenWindowMove.bind(this),!1),e.addEventListener('mouseup',this._listenWindowMoveEnd.bind(this),!1),t.addEventListener('mousemove',this._listenHover.bind(this),!1),t.addEventListener('mousedown',this._listenMoveStart.bind(this),!1),t.addEventListener('mousemove',this._listenMove.bind(this),!1),t.addEventListener('mouseup',this._listenMoveEnd.bind(this),!1),t.addEventListener('click',this._listenCanvasClick.bind(this),!1),t.addEventListener('wheel',this._listenCanvasWheel.bind(this),!1),t.addEventListener('mousedown',this._listenCanvasMoveStart.bind(this),!0),t.addEventListener('mouseup',this._listenCanvasMoveEnd.bind(this),!0),t.addEventListener('mouseover',this._listenCanvasMoveOver.bind(this),!0),t.addEventListener('mouseleave',this._listenCanvasMoveLeave.bind(this),!0),this._initParentEvent()},t.prototype._initParentEvent=function(){for(var t=window,e=t.origin;t.self!==t.top&&(t.self!==t.parent&&t.origin===e&&t.parent.window.addEventListener('mousemove',this._listSameOriginParentWindow.bind(this),!1),t=t.parent););},t.prototype._listenHover=function(t){t.preventDefault();var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.has('hover')&&this._event.trigger('hover',e),this._isMoving=!0},t.prototype._listenMoveStart=function(t){t.preventDefault();var e=this._getPosition(t);this._isVaildPoint(e)&&(this._event.has('point')&&this._event.trigger('point',e),this._event.has('moveStart')&&this._event.trigger('moveStart',e)),this._isMoving=!0},t.prototype._listenMove=function(t){if(t.preventDefault(),t.stopPropagation(),this._event.has('move')&&!0===this._isMoving){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('move',e)}},t.prototype._listenMoveEnd=function(t){if(t.preventDefault(),this._event.has('moveEnd')){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('moveEnd',e)}this._isMoving=!1},t.prototype._listSameOriginParentWindow=function(){this._temp.get('isHoverCanvas')&&this._event.has('leave')&&this._event.trigger('leave',void 0),this._temp.get('isDragCanvas')&&this._event.has('moveEnd')&&this._event.trigger('moveEnd',{x:NaN,y:NaN}),this._isMoving=!1,this._temp.set('isDragCanvas',!1),this._temp.set('isHoverCanvas',!1)},t.prototype._listenCanvasMoveStart=function(){this._temp.get('isHoverCanvas')&&this._temp.set('isDragCanvas',!0)},t.prototype._listenCanvasMoveEnd=function(){this._temp.set('isDragCanvas',!1)},t.prototype._listenCanvasMoveOver=function(){this._temp.set('isHoverCanvas',!0)},t.prototype._listenCanvasMoveLeave=function(){this._temp.set('isHoverCanvas',!1),this._event.has('leave')&&this._event.trigger('leave',void 0)},t.prototype._listenWindowMove=function(t){if(!0===this._temp.get('isDragCanvas')&&(t.preventDefault(),t.stopPropagation(),this._event.has('move')&&!0===this._isMoving)){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('move',e)}},t.prototype._listenWindowMoveEnd=function(t){if(!0!=!this._temp.get('isDragCanvas')){if(t.preventDefault(),this._event.has('moveEnd')){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('moveEnd',e)}this._temp.set('isDragCanvas',!1),this._isMoving=!1}},t.prototype._listenCanvasWheel=function(t){this._event.has('wheelX')&&(t.deltaX>0||t.deltaX<0)&&this._event.trigger('wheelX',t.deltaX),this._event.has('wheelY')&&(t.deltaY>0||t.deltaY<0)&&this._event.trigger('wheelY',t.deltaY);var e=this._temp.get('statusMap'),o=e.canScrollYNext,n=e.canScrollYPrev;(t.deltaX>0&&t.deltaX<0||t.deltaY>0&&!0===o||t.deltaY<0&&!0===n)&&t.preventDefault()},t.prototype._listenCanvasClick=function(t){t.preventDefault();var e=this._getPosition(t),o=Date.now();if(this._isVaildPoint(e)){var n=this._temp.get('prevClickPoint');n&&o-n.t<=500&&Math.abs(n.x-e.x)<=5&&Math.abs(n.y-e.y)<=5?this._event.has('doubleClick')&&this._event.trigger('doubleClick',{x:e.x,y:e.y}):this._temp.set('prevClickPoint',{x:e.x,y:e.y,t:o})}},t.prototype._getPosition=function(t){var e=this._canvas,o=0,n=0;if(t&&t.touches&&t.touches.length>0){var r=t.touches[0];r&&(o=r.clientX,n=r.clientY)}else o=t.clientX,n=t.clientY;return{x:o-e.getBoundingClientRect().left,y:n-e.getBoundingClientRect().top,t:Date.now()}},t.prototype._isVaildPoint=function(t){return z(t.x)&&z(t.y)},t}();function z(t){return t>0||t<0||0===t}var L={lineWidth:12,color:'#a0a0a0'},D=function(){function t(t,e){this._displayCtx=t,this._opts=this._getOpts(e)}return t.prototype.draw=function(t){var e=this._opts,o=e.width,n=e.height,r=this.calc(t),i=this._displayCtx;r.xSize>0&&(i.globalAlpha=.2,i.fillStyle=r.color,i.fillRect(0,this._doSize(n-r.lineSize),this._doSize(o),this._doSize(r.lineSize)),i.globalAlpha=1,T(i,{x:this._doSize(r.translateX),y:this._doSize(n-r.lineSize),w:this._doSize(r.xSize),h:this._doSize(r.lineSize),r:this._doSize(r.lineSize/2),color:r.color})),r.ySize>0&&(i.globalAlpha=.2,i.fillStyle=r.color,i.fillRect(this._doSize(o-r.lineSize),0,this._doSize(r.lineSize),this._doSize(n)),i.globalAlpha=1,T(i,{x:this._doSize(o-r.lineSize),y:this._doSize(r.translateY),w:this._doSize(r.lineSize),h:this._doSize(r.ySize),r:this._doSize(r.lineSize/2),color:r.color})),i.globalAlpha=1},t.prototype.resetSize=function(t){this._opts=r(r({},this._opts),t)},t.prototype.isPointAtScrollY=function(t){var e=this._opts,o=e.width,n=e.height,r=e.scrollConfig,i=this._displayCtx;return i.beginPath(),i.rect(this._doSize(o-r.lineWidth),0,this._doSize(r.lineWidth),this._doSize(n)),i.closePath(),!!i.isPointInPath(this._doSize(t.x),this._doSize(t.y))},t.prototype.isPointAtScrollX=function(t){var e=this._opts,o=e.width,n=e.height,r=e.scrollConfig,i=this._displayCtx;return i.beginPath(),i.rect(0,this._doSize(n-r.lineWidth),this._doSize(o-r.lineWidth),this._doSize(r.lineWidth)),i.closePath(),!!i.isPointInPath(this._doSize(t.x),this._doSize(t.y))},t.prototype.getLineWidth=function(){return this._opts.scrollConfig.lineWidth},t.prototype.calc=function(t){var e=this._opts,o=e.width,n=e.height,r=e.scrollConfig,i=2.5*r.lineWidth,s=r.lineWidth,l=0,a=0;t.left<=0&&t.right<=0&&(l=Math.max(i,o-(Math.abs(t.left)+Math.abs(t.right))))>=o&&(l=0),(t.top<=0||t.bottom<=0)&&(a=Math.max(i,n-(Math.abs(t.top)+Math.abs(t.bottom))))>=n&&(a=0);var c=0;l>0&&(c=l/2+(o-l)*Math.abs(t.left)/(Math.abs(t.left)+Math.abs(t.right)),c=Math.min(Math.max(0,c-l/2),o-l));var u=0;return a>0&&(u=a/2+(n-a)*Math.abs(t.top)/(Math.abs(t.top)+Math.abs(t.bottom)),u=Math.min(Math.max(0,u-a/2),n-a)),{lineSize:s,xSize:l,ySize:a,translateY:u,translateX:c,color:this._opts.scrollConfig.color}},t.prototype._doSize=function(t){return t*this._opts.devicePixelRatio},t.prototype._getOpts=function(t){var e=r({scrollConfig:L},t);return e.scrollConfig||(e.scrollConfig=L),e.scrollConfig.lineWidth>0||(e.scrollConfig.lineWidth=L.lineWidth),e.scrollConfig.lineWidth=Math.max(e.scrollConfig.lineWidth,L.lineWidth),!0!==w.color.isColorStr(e.scrollConfig.color)&&(e.scrollConfig.color=e.scrollConfig.color),e},t}();function T(t,e){var o=e.x,n=e.y,r=e.w,i=e.h,s=e.color,l=e.r;(r<2*(l=Math.min(l,r/2,i/2))||i<2*l)&&(l=0),t.beginPath(),t.moveTo(o+l,n),t.arcTo(o+r,n,o+r,n+i,l),t.arcTo(o+r,n+i,o,n+i,l),t.arcTo(o,n+i,o,n,l),t.arcTo(o,n,o+r,n,l),t.closePath(),t.fillStyle=s,t.fill()}var I=Symbol('_opts'),W=Symbol('_ctx'),M=function(){function t(t,e){this[I]=e,this[W]=t}return t.prototype.resetSize=function(t){this[I]=r(r({},this[I]),t)},t.prototype.calcScreen=function(){var t=this[W].getTransform().scale,e=this[I],o=e.width,n=e.height,r=e.contextWidth,i=e.contextHeight,s=e.devicePixelRatio,l=!0,a=!0,c=!0,u=!0;r*t<=o&&(this[W].setTransform({scrollX:(o-r*t)/2}),l=!1,a=!1),i*t<=n&&(this[W].setTransform({scrollY:(n-i*t)/2}),c=!1,u=!1),r*t>=o&&this[W].getTransform().scrollX>0&&(this[W].setTransform({scrollX:0}),l=!1),i*t>=n&&this[W].getTransform().scrollY>0&&(this[W].setTransform({scrollY:0}),c=!1);var h=this[W].getTransform(),f=h.scrollX,d=h.scrollY;f<0&&Math.abs(f)>Math.abs(r*t-o)&&(this[W].setTransform({scrollX:0-Math.abs(r*t-o)}),a=!1),d<0&&Math.abs(d)>Math.abs(i*t-n)&&(this[W].setTransform({scrollY:0-Math.abs(i*t-n)}),u=!1);var p=this[W].getTransform(),v=p.scrollX,g=p.scrollY;return{size:{x:v*t,y:g*t,w:r*t,h:i*t},position:{top:g,bottom:n-(i*t+g),left:v,right:o-(r*t+v)},deviceSize:{x:v*s,y:g*s,w:r*s*t,h:i*s*t},width:this[I].width,height:this[I].height,devicePixelRatio:this[I].devicePixelRatio,canScrollYPrev:c,canScrollYNext:u,canScrollXPrev:l,canScrollXNext:a}},t.prototype.calcScreenScroll=function(t,e,o,n,r){var i=n-o;t<=0&&e<=0&&(i=Math.abs(t)+Math.abs(e));var s=1;return i>0&&(s=i/(n-o)),0-s*r},t}(),O=w.Context;function k(t){var e=document.createElement('canvas').getContext('2d');return{plugins:[],ctx:new O(e,{width:t.width,height:t.height,contextWidth:t.contextWidth,contextHeight:t.contextHeight,devicePixelRatio:t.devicePixelRatio||window.devicePixelRatio||1})}}var R,U=function(){function t(t){this._temp=k(t)}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(t){this._temp=k(t)},t}(),A=Symbol('_canvas'),F=Symbol('_displayCanvas'),N=Symbol('_helperCanvas'),Y=Symbol('_mount'),X=Symbol('_opts'),H=Symbol('_hasRendered'),B=Symbol('_ctx'),j=Symbol('_helperCtx'),G=Symbol('_watcher'),Q=Symbol('_render'),q=Symbol('_parsePrivateOptions'),V=Symbol('_scroller'),Z=Symbol('_initEvent'),$=Symbol('_doScrollX'),J=Symbol('_doScrollY'),K=Symbol('_doMoveScroll'),tt=Symbol('_resetContext'),et=Symbol('_screen'),ot=Symbol('_tempData'),nt=w.Context,rt=w.time.throttle,it=function(){function t(t,e){this[R]=!1,this[ot]=new U(e),this[Y]=t,this[A]=document.createElement('canvas'),this[N]=document.createElement('canvas'),this[F]=document.createElement('canvas'),this[Y].appendChild(this[F]),this[X]=this[q](e);var o=this[A].getContext('2d'),n=this[F].getContext('2d'),r=this[N].getContext('2d');this[B]=new nt(o,this[X]),this[j]=new nt(r,this[X]),this[et]=new M(this[B],this[X]),this[G]=new P(this[F],this[B]),this[V]=new D(n,{width:e.width,height:e.height,devicePixelRatio:e.devicePixelRatio||1,scrollConfig:e.scrollConfig}),this[Q]()}return t.prototype.getDisplayContext2D=function(){return this[F].getContext('2d')},t.prototype.getOriginContext2D=function(){return this[B].getContext()},t.prototype.getHelperContext2D=function(){return this[j].getContext()},t.prototype.getContext=function(){return this[B]},t.prototype.getHelperContext=function(){return this[j]},t.prototype.scale=function(t){t>0&&(this[B].setTransform({scale:t}),this[j].setTransform({scale:t}));var e=this[et].calcScreen();return{position:e.position,size:e.size}},t.prototype.scrollX=function(t){this[G].setStatusMap({canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}),(t>=0||t<0)&&(this[B].setTransform({scrollX:t}),this[j].setTransform({scrollX:t}));var e=this[et].calcScreen(),o=e.position,n=e.size,r=e.canScrollXNext,i=e.canScrollYNext,s=e.canScrollXPrev,l=e.canScrollYPrev;return this[G].setStatusMap({canScrollYPrev:l,canScrollYNext:i,canScrollXPrev:s,canScrollXNext:r}),{position:o,size:n}},t.prototype.scrollY=function(t){this[G].setStatusMap({canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}),(t>=0||t<0)&&(this[B].setTransform({scrollY:t}),this[j].setTransform({scrollY:t}));var e=this[et].calcScreen(),o=e.position,n=e.size,r=e.canScrollXNext,i=e.canScrollYNext,s=e.canScrollXPrev,l=e.canScrollYPrev;return this[G].setStatusMap({canScrollYPrev:l,canScrollYNext:i,canScrollXPrev:s,canScrollXNext:r}),{position:o,size:n}},t.prototype.getTransform=function(){return this[B].getTransform()},t.prototype.draw=function(){this.clear();var t=this[et].calcScreen(),e=t.position,o=t.deviceSize,n=t.size,r=this[F].getContext('2d');return null==r||r.drawImage(this[A],o.x,o.y,o.w,o.h),null==r||r.drawImage(this[N],o.x,o.y,o.w,o.h),!0===this[X].canScroll&&this[V].draw(e),{position:e,size:n}},t.prototype.addPlugin=function(t){this[ot].get('plugins').push(t)},t.prototype.clear=function(){var t=this[F].getContext('2d');null==t||t.clearRect(0,0,this[F].width,this[F].height)},t.prototype.on=function(t,e){this[G].on(t,e)},t.prototype.off=function(t,e){this[G].off(t,e)},t.prototype.getScreenInfo=function(){return this[et].calcScreen()},t.prototype.setCursor=function(t){this[F].style.cursor=t},t.prototype.resetCursor=function(){this[F].style.cursor='auto'},t.prototype.resetSize=function(t){this[X]=r(r({},this[X]),t),this[tt](),this[B].resetSize(t),this[j].resetSize(t),this[et].resetSize(t),this[V].resetSize({width:this[X].width,height:this[X].height,devicePixelRatio:this[X].devicePixelRatio}),this.draw()},t.prototype.getScrollLineWidth=function(){var t=0;return!0===this[X].canScroll&&(t=this[V].getLineWidth()),t},t.prototype.pointScreenToContext=function(t){var e=this.getTransform(),o=e.scrollX,n=e.scrollY,r=e.scale;return{x:(t.x-o)/r,y:(t.y-n)/r}},t.prototype.pointContextToScreen=function(t){var e=this.getTransform(),o=e.scrollX,n=e.scrollY,r=e.scale;return{x:t.x*r+o,y:t.y*r+n}},t.prototype[(R=H,Q)]=function(){!0!==this[H]&&(this[tt](),this[Z](),this[H]=!0)},t.prototype[tt]=function(){var t,e,o,n,i,s,l=this[X],a=l.width,c=l.height,u=l.contextWidth,h=l.contextHeight,f=l.devicePixelRatio;this[A].width=u*f,this[A].height=h*f,this[N].width=u*f,this[N].height=h*f,this[F].width=a*f,this[F].height=c*f,t=this[F],e={width:a+"px",height:c+"px"},o=function(t){var e={};return(t.getAttribute('style')||'').split(';').forEach((function(t){var o=t.split(':');o[0]&&'string'==typeof o[0]&&(e[o[0]]=o[1]||'')})),e}(t),n=r(r({},o),e),i=Object.keys(n),s='',i.forEach((function(t){s+=t+":"+(n[t]||'')+";"})),t.setAttribute('style',s)},t.prototype[q]=function(t){return r(r({},{devicePixelRatio:1}),t)},t.prototype[Z]=function(){var t=this;if(!0!==this[H]&&!0===this[X].canScroll){this.on('wheelX',rt((function(e){t[$](e)}),16)),this.on('wheelY',rt((function(e){t[J](e)}),16));var e=null;this.on('moveStart',rt((function(o){t[V].isPointAtScrollX(o)?e='x':t[V].isPointAtScrollY(o)&&(e='y')}),16)),this.on('move',rt((function(o){e&&t[K](e,o)}),16)),this.on('moveEnd',rt((function(o){e&&t[K](e,o),e=null}),16))}},t.prototype[$]=function(t,e){var o=this[X].width,n=e;'number'==typeof n&&(n>0||n<=0)||(n=this[B].getTransform().scrollX);var r=this[et].calcScreen().position,i=this[V].calc(r).xSize,s=this[et].calcScreenScroll(r.left,r.right,i,o,t);this.scrollX(n+s),this.draw()},t.prototype[J]=function(t,e){var o=this[X].height,n=e;'number'==typeof n&&(n>0||n<=0)||(n=this[B].getTransform().scrollY);var r=this[et].calcScreen().position,i=this[V].calc(r).ySize,s=this[et].calcScreenScroll(r.top,r.bottom,i,o,t);this.scrollY(n+s),this.draw()},t.prototype[K]=function(t,e){if(t){var o=this[et].calcScreen().position,n=this[V].calc(o),r=n.xSize,i=n.ySize;'x'===t?this[$](e.x-r/2,0):'y'===t&&this[J](e.y-i/2,0)}},t}();function st(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function lt(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var at={type:function(t,e){var o=lt(t);return!0===e?o.toLocaleLowerCase():o},array:function(t){return'Array'===lt(t)},json:function(t){return'Object'===lt(t)},function:function(t){return'Function'===lt(t)},asyncFunction:function(t){return'AsyncFunction'===lt(t)},string:function(t){return'String'===lt(t)},number:function(t){return'Number'===lt(t)},undefined:function(t){return'Undefined'===lt(t)},null:function(t){return'Null'===lt(t)},promise:function(t){return'Promise'===lt(t)}},ct=function(){return ct=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},ct.apply(this,arguments)};function ut(t,e,o,n){return new(o||(o=Promise))((function(r,i){function s(t){try{a(n.next(t))}catch(t){i(t)}}function l(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,l)}a((n=n.apply(t,e||[])).next())}))}function ht(t,e){var o,n,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function ft(t,e){var o=e.width,n=e.height;return new Promise((function(e,r){var i=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(o||'')+"\" height = \""+(n||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(i),s.onload=function(t){var o,n=null===(o=null==t?void 0:t.target)||void 0===o?void 0:o.result;e(n)},s.onerror=function(t){r(t)}}))}function dt(t){return new Promise((function(e,o){var n=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),r=new FileReader;r.readAsDataURL(n),r.onload=function(t){var o,n=null===(o=null==t?void 0:t.target)||void 0===o?void 0:o.result;e(n)},r.onerror=function(t){o(t)}}))}var pt=window.Image;function vt(t){return new Promise((function(e,o){var n=new pt;n.onload=function(){e(n)},n.onabort=o,n.onerror=o,n.src=t}))}var gt=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=ct(ct({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=ct(ct({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,o,n,r,i){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(o),n,r,i)},t.prototype.rect=function(t,e,o,n){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.fillRect=function(t,e,o,n){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.clearRect=function(t,e,o,n){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,o,n,r){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n),this._doSize(r))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var o=t[0],n=t[1],r=t[2],i=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],u=t[t.length-1];return 9===t.length?this._ctx.drawImage(o,this._doSize(n),this._doSize(r),this._doSize(i),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(u)):this._ctx.drawImage(o,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(u))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,o,n){return void 0!==n?this._ctx.fillText(t,this._doSize(e),this._doSize(o),this._doSize(n)):this._ctx.fillText(t,this._doSize(e),this._doSize(o))},t.prototype.strokeText=function(t,e,o,n){return void 0!==n?this._ctx.strokeText(t,this._doSize(e),this._doSize(o),this._doSize(n)):this._ctx.strokeText(t,this._doSize(e),this._doSize(o))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,o,n,r,i,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n),r,i,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,o=e.scale,n=(t-e.scrollX)/o;return this._doSize(n)},t.prototype._doY=function(t){var e=this._transform,o=e.scale,n=(t-e.scrollY)/o;return this._doSize(n)},t}();function yt(t){return'number'==typeof t&&(t>0||t<=0)}function mt(t){return'number'==typeof t&&t>=0}function _t(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function xt(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var St={x:function(t){return yt(t)},y:function(t){return yt(t)},w:mt,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:yt,borderWidth:function(t){return mt(t)},borderRadius:function(t){return yt(t)&&t>=0},color:function(t){return st(t)},imageSrc:function(t){return xt(t)||_t(t)},imageURL:_t,imageBase64:xt,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var o=document.createElement('div');o.innerHTML=t,o.children.length>0&&(e=!0),o=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return yt(t)&&t>0},lineHeight:function(t){return yt(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return yt(t)&&t>0}};function bt(t){void 0===t&&(t={});var e=t.borderColor,o=t.borderRadius,n=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!St.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!St.number(o))&&!(t.hasOwnProperty('borderWidth')&&!St.number(n)))}var wt={attrs:function(t){var e=t.x,o=t.y,n=t.w,r=t.h,i=t.angle;return!!(St.x(e)&&St.y(o)&&St.w(n)&&St.h(r)&&St.angle(i))&&(i>=-360&&i<=360)},textDesc:function(t){var e=t.text,o=t.color,n=t.fontSize,r=t.lineHeight,i=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,u=t.strokeColor;return!!St.text(e)&&(!!St.color(o)&&(!!St.fontSize(n)&&(!(t.hasOwnProperty('bgColor')&&!St.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!St.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!St.lineHeight(r))&&(!(t.hasOwnProperty('fontFamily')&&!St.fontFamily(i))&&(!(t.hasOwnProperty('textAlign')&&!St.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!St.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!St.color(u))&&!!bt(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!St.color(e))&&!!bt(t)},circleDesc:function(t){var e=t.bgColor,o=t.borderColor,n=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!St.color(e))&&(!(t.hasOwnProperty('borderColor')&&!St.color(o))&&!(t.hasOwnProperty('borderWidth')&&!St.number(n)))},imageDesc:function(t){var e=t.src;return!!St.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!St.svg(e)},htmlDesc:function(t){var e=t.html;return!!St.html(e)}},Et={is:St,check:wt,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,o){return function n(r){var i=t[r];r===t.length&&o&&(i=o);if(!i)return Promise.resolve();try{return Promise.resolve(i(e,n.bind(null,r+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var o=-1;return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];o>0||(o=setTimeout((function(){t.apply(void 0,n),o=-1}),e))}}},loader:{loadImage:vt,loadSVG:function(t){return ut(this,void 0,void 0,(function(){return ht(this,(function(e){switch(e.label){case 0:return[4,dt(t)];case 1:return[4,vt(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return ut(this,void 0,void 0,(function(){return ht(this,(function(o){switch(o.label){case 0:return[4,ft(t,e)];case 1:return[4,vt(o.sent())];case 2:return[2,o.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var o=e.filename,n=e.type,r=void 0===n?'image/jpeg':n,i=t.toDataURL(r),s=document.createElement('a');s.href=i,s.download=o;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:st},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:at,data:{deepClone:function(t){return function t(e){var o,n=(o=e,Object.prototype.toString.call(o).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(n)>=0)return e;if('Array'===n){var r=[];return e.forEach((function(e){r.push(t(e))})),r}if('Object'===n){var i={};return Object.keys(e).forEach((function(o){i[o]=t(e[o])})),i}}(t)}},Context:gt},Ct=function(t,e){return Ct=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},Ct(t,e)};var Pt=function(){return Pt=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Pt.apply(this,arguments)};function zt(t,e,o,n){return new(o||(o=Promise))((function(r,i){function s(t){try{a(n.next(t))}catch(t){i(t)}}function l(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,l)}a((n=n.apply(t,e||[])).next())}))}function Lt(t,e){var o,n,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function Dt(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function Tt(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var It={type:function(t,e){var o=Tt(t);return!0===e?o.toLocaleLowerCase():o},array:function(t){return'Array'===Tt(t)},json:function(t){return'Object'===Tt(t)},function:function(t){return'Function'===Tt(t)},asyncFunction:function(t){return'AsyncFunction'===Tt(t)},string:function(t){return'String'===Tt(t)},number:function(t){return'Number'===Tt(t)},undefined:function(t){return'Undefined'===Tt(t)},null:function(t){return'Null'===Tt(t)},promise:function(t){return'Promise'===Tt(t)}},Wt=function(){return Wt=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var r in e=arguments[o])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Wt.apply(this,arguments)};function Mt(t,e,o,n){return new(o||(o=Promise))((function(r,i){function s(t){try{a(n.next(t))}catch(t){i(t)}}function l(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(s,l)}a((n=n.apply(t,e||[])).next())}))}function Ot(t,e){var o,n,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,n&&(r=2&i[0]?n.return:i[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,i[1])).done)return r;switch(n=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{o=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function kt(t,e){var o=e.width,n=e.height;return new Promise((function(e,r){var i=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(o||'')+"\" height = \""+(n||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(i),s.onload=function(t){var o,n=null===(o=null==t?void 0:t.target)||void 0===o?void 0:o.result;e(n)},s.onerror=function(t){r(t)}}))}function Rt(t){return new Promise((function(e,o){var n=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),r=new FileReader;r.readAsDataURL(n),r.onload=function(t){var o,n=null===(o=null==t?void 0:t.target)||void 0===o?void 0:o.result;e(n)},r.onerror=function(t){o(t)}}))}var Ut=window.Image;function At(t){return new Promise((function(e,o){var n=new Ut;n.onload=function(){e(n)},n.onabort=o,n.onerror=o,n.src=t}))}var Ft=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=Wt(Wt({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=Wt(Wt({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,o,n,r,i){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(o),n,r,i)},t.prototype.rect=function(t,e,o,n){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.fillRect=function(t,e,o,n){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.clearRect=function(t,e,o,n){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,o,n,r){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n),this._doSize(r))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var o=t[0],n=t[1],r=t[2],i=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],u=t[t.length-1];return 9===t.length?this._ctx.drawImage(o,this._doSize(n),this._doSize(r),this._doSize(i),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(u)):this._ctx.drawImage(o,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(u))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,o,n){return void 0!==n?this._ctx.fillText(t,this._doSize(e),this._doSize(o),this._doSize(n)):this._ctx.fillText(t,this._doSize(e),this._doSize(o))},t.prototype.strokeText=function(t,e,o,n){return void 0!==n?this._ctx.strokeText(t,this._doSize(e),this._doSize(o),this._doSize(n)):this._ctx.strokeText(t,this._doSize(e),this._doSize(o))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,o,n,r,i,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(o),this._doSize(n),r,i,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,o=e.scale,n=(t-e.scrollX)/o;return this._doSize(n)},t.prototype._doY=function(t){var e=this._transform,o=e.scale,n=(t-e.scrollY)/o;return this._doSize(n)},t}();function Nt(t){return'number'==typeof t&&(t>0||t<=0)}function Yt(t){return'number'==typeof t&&t>=0}function Xt(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function Ht(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var Bt={x:function(t){return Nt(t)},y:function(t){return Nt(t)},w:Yt,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:Nt,borderWidth:function(t){return Yt(t)},borderRadius:function(t){return Nt(t)&&t>=0},color:function(t){return Dt(t)},imageSrc:function(t){return Ht(t)||Xt(t)},imageURL:Xt,imageBase64:Ht,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var o=document.createElement('div');o.innerHTML=t,o.children.length>0&&(e=!0),o=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return Nt(t)&&t>0},lineHeight:function(t){return Nt(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return Nt(t)&&t>0}};function jt(t){void 0===t&&(t={});var e=t.borderColor,o=t.borderRadius,n=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!Bt.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!Bt.number(o))&&!(t.hasOwnProperty('borderWidth')&&!Bt.number(n)))}var Gt={attrs:function(t){var e=t.x,o=t.y,n=t.w,r=t.h,i=t.angle;return!!(Bt.x(e)&&Bt.y(o)&&Bt.w(n)&&Bt.h(r)&&Bt.angle(i))&&(i>=-360&&i<=360)},textDesc:function(t){var e=t.text,o=t.color,n=t.fontSize,r=t.lineHeight,i=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,u=t.strokeColor;return!!Bt.text(e)&&(!!Bt.color(o)&&(!!Bt.fontSize(n)&&(!(t.hasOwnProperty('bgColor')&&!Bt.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!Bt.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!Bt.lineHeight(r))&&(!(t.hasOwnProperty('fontFamily')&&!Bt.fontFamily(i))&&(!(t.hasOwnProperty('textAlign')&&!Bt.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!Bt.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!Bt.color(u))&&!!jt(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!Bt.color(e))&&!!jt(t)},circleDesc:function(t){var e=t.bgColor,o=t.borderColor,n=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!Bt.color(e))&&(!(t.hasOwnProperty('borderColor')&&!Bt.color(o))&&!(t.hasOwnProperty('borderWidth')&&!Bt.number(n)))},imageDesc:function(t){var e=t.src;return!!Bt.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!Bt.svg(e)},htmlDesc:function(t){var e=t.html;return!!Bt.html(e)}},Qt={is:Bt,check:Gt,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,o){return function n(r){var i=t[r];r===t.length&&o&&(i=o);if(!i)return Promise.resolve();try{return Promise.resolve(i(e,n.bind(null,r+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var o=-1;return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];o>0||(o=setTimeout((function(){t.apply(void 0,n),o=-1}),e))}}},loader:{loadImage:At,loadSVG:function(t){return Mt(this,void 0,void 0,(function(){return Ot(this,(function(e){switch(e.label){case 0:return[4,Rt(t)];case 1:return[4,At(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return Mt(this,void 0,void 0,(function(){return Ot(this,(function(o){switch(o.label){case 0:return[4,kt(t,e)];case 1:return[4,At(o.sent())];case 2:return[2,o.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var o=e.filename,n=e.type,r=void 0===n?'image/jpeg':n,i=t.toDataURL(r),s=document.createElement('a');s.href=i,s.download=o;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:Dt},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:It,data:{deepClone:function(t){return function t(e){var o,n=(o=e,Object.prototype.toString.call(o).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(n)>=0)return e;if('Array'===n){var r=[];return e.forEach((function(e){r.push(t(e))})),r}if('Object'===n){var i={};return Object.keys(e).forEach((function(o){i[o]=t(e[o])})),i}}(t)}},Context:Ft};function qt(t,e,o){var n=function(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}(e),r=function(t){return t/180*Math.PI}(e.angle||0);return function(t,e,o,n){e&&(o>0||o<0)&&(t.translate(e.x,e.y),t.rotate(o),t.translate(-e.x,-e.y));n(t),e&&(o>0||o<0)&&(t.translate(e.x,e.y),t.rotate(-o),t.translate(-e.x,-e.y))}(t,n,r||0,o)}var Vt=Qt.is,Zt=Qt.istype,$t=Qt.color;function Jt(t){t.setFillStyle('#000000'),t.setStrokeStyle('#000000'),t.setLineDash([]),t.setGlobalAlpha(1),t.setShadowColor('#00000000'),t.setShadowOffsetX(0),t.setShadowOffsetY(0),t.setShadowBlur(0)}function Kt(t,e,o){Jt(t),function(t,e){Jt(t),qt(t,e,(function(){if(e.desc.borderWidth&&e.desc.borderWidth>0){var o=e.desc.borderWidth,n='#000000';!0===$t.isColorStr(e.desc.borderColor)&&(n=e.desc.borderColor);var r=e.x-o/2,i=e.y-o/2,s=e.w+o,l=e.h+o,a=e.desc.borderRadius||0;(a=Math.min(a,s/2,l/2))<s/2&&a<l/2&&(a+=o/2);var c=e.desc;void 0!==c.shadowColor&&$t.isColorStr(c.shadowColor)&&t.setShadowColor(c.shadowColor),void 0!==c.shadowOffsetX&&Vt.number(c.shadowOffsetX)&&t.setShadowOffsetX(c.shadowOffsetX),void 0!==c.shadowOffsetY&&Vt.number(c.shadowOffsetY)&&t.setShadowOffsetY(c.shadowOffsetY),void 0!==c.shadowBlur&&Vt.number(c.shadowBlur)&&t.setShadowBlur(c.shadowBlur),t.beginPath(),t.setLineWidth(o),t.setStrokeStyle(n),t.moveTo(r+a,i),t.arcTo(r+s,i,r+s,i+l,a),t.arcTo(r+s,i+l,r,i+l,a),t.arcTo(r,i+l,r,i,a),t.arcTo(r,i,r+s,i,a),t.closePath(),t.stroke()}}))}(t,e),Jt(t),qt(t,e,(function(){var n=e.x,r=e.y,i=e.w,s=e.h,l=e.desc.borderRadius||0;(i<2*(l=Math.min(l,i/2,s/2))||s<2*l)&&(l=0),t.beginPath(),t.moveTo(n+l,r),t.arcTo(n+i,r,n+i,r+s,l),t.arcTo(n+i,r+s,n,r+s,l),t.arcTo(n,r+s,n,r,l),t.arcTo(n,r,n+i,r,l),t.closePath(),('string'==typeof o||['CanvasPattern'].includes(Zt.type(o)))&&t.setFillStyle(o),t.fill()}))}function te(t,e){Kt(t,e,e.desc.bgColor)}function ee(t,e,o){var n=o.getContent(e.uuid);qt(t,e,(function(){n&&t.drawImage(n,e.x,e.y,e.w,e.h)}))}function oe(t,e,o){var n=o.getContent(e.uuid);qt(t,e,(function(){n&&t.drawImage(n,e.x,e.y,e.w,e.h)}))}function ne(t,e,o){var n=o.getContent(e.uuid);qt(t,e,(function(){n&&t.drawImage(n,e.x,e.y,e.w,e.h)}))}var re=Qt.is,ie=Qt.color;function se(t,e,o){Jt(t),Kt(t,e,e.desc.bgColor||'transparent'),qt(t,e,(function(){var o=Pt({fontSize:12,fontFamily:'sans-serif',textAlign:'center'},e.desc);t.setFillStyle(e.desc.color),t.setTextBaseline('top'),t.setFont({fontWeight:o.fontWeight,fontSize:o.fontSize,fontFamily:o.fontFamily});var n=o.text.replace(/\r\n/gi,'\n'),r=o.lineHeight||o.fontSize,i=n.split('\n'),s=[];i.forEach((function(o){for(var n='',i=0,l=0;l<o.length&&(t.measureText(n+(o[l]||'')).width<t.calcDeviceNum(e.w)?n+=o[l]||'':(s.push({text:n,width:t.calcScreenNum(t.measureText(n).width)}),n=o[l]||'',i++),!((i+1)*r>e.h));l++)if(n&&o.length-1===l&&(i+1)*r<e.h){s.push({text:n,width:t.calcScreenNum(t.measureText(n).width)});break}}));var l=e.y;if(s.length*r<e.h&&(l+=(e.h-s.length*r)/2),void 0!==o.textShadowColor&&ie.isColorStr(o.textShadowColor)&&t.setShadowColor(o.textShadowColor),void 0!==o.textShadowOffsetX&&re.number(o.textShadowOffsetX)&&t.setShadowOffsetX(o.textShadowOffsetX),void 0!==o.textShadowOffsetY&&re.number(o.textShadowOffsetY)&&t.setShadowOffsetY(o.textShadowOffsetY),void 0!==o.textShadowBlur&&re.number(o.textShadowBlur)&&t.setShadowBlur(o.textShadowBlur),s.forEach((function(n,i){var s=e.x;'center'===o.textAlign?s=e.x+(e.w-n.width)/2:'right'===o.textAlign&&(s=e.x+(e.w-n.width)),t.fillText(n.text,s,l+r*i)})),Jt(t),ie.isColorStr(o.strokeColor)&&void 0!==o.strokeWidth&&o.strokeWidth>0){var a=e.y;s.length*r<e.h&&(a+=(e.h-s.length*r)/2),s.forEach((function(n,i){var s=e.x;'center'===o.textAlign?s=e.x+(e.w-n.width)/2:'right'===o.textAlign&&(s=e.x+(e.w-n.width)),void 0!==o.strokeColor&&t.setStrokeStyle(o.strokeColor),void 0!==o.strokeWidth&&o.strokeWidth>0&&t.setLineWidth(o.strokeWidth),t.strokeText(n.text,s,a+r*i)}))}}))}function le(t,e){Jt(t),qt(t,e,(function(t){var o=e.x,n=e.y,r=e.w,i=e.h,s=e.desc,l=s.bgColor,a=void 0===l?'#000000':l,c=s.borderColor,u=void 0===c?'#000000':c,h=s.borderWidth,f=void 0===h?0:h,d=r/2,p=i/2,v=o+d,g=n+p;if(f&&f>0){var y=f/2+d,m=f/2+p;t.beginPath(),t.setStrokeStyle(u),t.setLineWidth(f),t.ellipse(v,g,y,m,0,0,2*Math.PI),t.closePath(),t.stroke()}t.beginPath(),t.setFillStyle(a),t.ellipse(v,g,d,p,0,0,2*Math.PI),t.closePath(),t.fill()}))}var ae=Qt.color.isColorStr;function ce(t,e,o){var n;Jt(t);var r=t.getSize();if(t.clearRect(0,0,r.contextWidth,r.contextHeight),'string'==typeof e.bgColor&&ae(e.bgColor)&&function(t,e){var o=t.getSize();t.setFillStyle(e),t.fillRect(0,0,o.contextWidth,o.contextHeight)}(t,e.bgColor),e.elements.length>0)for(var i=0;i<e.elements.length;i++){var s=e.elements[i];if(!0!==(null===(n=null==s?void 0:s.operation)||void 0===n?void 0:n.invisible))switch(s.type){case'rect':te(t,s);break;case'text':se(t,s);break;case'image':ee(t,s,o);break;case'svg':oe(t,s,o);break;case'html':ne(t,s,o);break;case'circle':le(t,s)}}}var ue=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);null==o||o.push(e),this._listeners.set(t,o||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);if(Array.isArray(o))for(var n=0;n<(null==o?void 0:o.length);n++)if(o[n]===e){o.splice(n,1);break}this._listeners.set(t,o||[])}},t.prototype.trigger=function(t,e){var o=this._listeners.get(t);return!!Array.isArray(o)&&(o.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var he,fe=Qt.loader,de=fe.loadImage,pe=fe.loadSVG,ve=fe.loadHTML,ge=Qt.data.deepClone;!function(t){t.FREE="free",t.LOADING="loading",t.COMPLETE="complete"}(he||(he={}));var ye,me,_e,xe,Se=function(){function t(t){this._currentLoadData={},this._currentUUIDQueue=[],this._storageLoadData={},this._status=he.FREE,this._waitingLoadQueue=[],this._opts=t,this._event=new ue,this._waitingLoadQueue=[]}return t.prototype.load=function(t,e){var o=this._resetLoadData(t,e),n=o[0],r=o[1];this._status===he.FREE||this._status===he.COMPLETE?(this._currentUUIDQueue=n,this._currentLoadData=r,this._loadTask()):this._status===he.LOADING&&n.length>0&&this._waitingLoadQueue.push({uuidQueue:n,loadData:r})},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype.isComplete=function(){return this._status===he.COMPLETE},t.prototype.getContent=function(t){var e;return'loaded'===(null===(e=this._storageLoadData[t])||void 0===e?void 0:e.status)?this._storageLoadData[t].content:null},t.prototype._resetLoadData=function(t,e){for(var o={},n=[],r=this._storageLoadData,i=t.elements.length-1;i>=0;i--){var s=t.elements[i];['image','svg','html'].includes(s.type)&&(r[s.uuid]?e.includes(s.uuid)&&(o[s.uuid]=this._createEmptyLoadItem(s),n.push(s.uuid)):(o[s.uuid]=this._createEmptyLoadItem(s),n.push(s.uuid)))}return[n,o]},t.prototype._createEmptyLoadItem=function(t){var e='',o=t.type,n=t.w,r=t.h;if('image'===t.type)e=(i=t).desc.src||'';else if('svg'===t.type){e=(i=t).desc.svg||''}else if('html'===t.type){var i;e=function(t){return t.replace(/<script[\s\S]*?<\/script>/gi,'')}((i=t).desc.html||''),n=i.desc.width||t.w,r=i.desc.height||t.h}return{uuid:t.uuid,type:o,status:'null',content:null,source:e,elemW:n,elemH:r,element:ge(t)}},t.prototype._loadTask=function(){var t=this;if(this._status!==he.LOADING){if(this._status=he.LOADING,0===this._currentUUIDQueue.length){if(0===this._waitingLoadQueue.length)return this._status=he.COMPLETE,void this._event.trigger('complete',void 0);var e=this._waitingLoadQueue.shift();if(e){var o=e.uuidQueue,n=e.loadData;this._currentLoadData=n,this._currentUUIDQueue=o}}var r=this._opts.maxParallelNum,i=this._currentUUIDQueue.splice(0,r),s={};i.forEach((function(t,e){s[t]=e}));var l=[],a=function(){if(l.length>=r)return!1;if(0===i.length)return!0;for(var e=function(e){var o=i.shift();if(void 0===o)return"break";l.push(o),t._loadElementSource(t._currentLoadData[o]).then((function(e){var n,r;l.splice(l.indexOf(o),1);var s=a();t._storageLoadData[o]={uuid:o,type:t._currentLoadData[o].type,status:'loaded',content:e,source:t._currentLoadData[o].source,elemW:t._currentLoadData[o].elemW,elemH:t._currentLoadData[o].elemH,element:t._currentLoadData[o].element},0===l.length&&0===i.length&&!0===s&&(t._status=he.FREE,t._loadTask()),t._event.trigger('load',{uuid:null===(n=t._storageLoadData[o])||void 0===n?void 0:n.uuid,type:t._storageLoadData[o].type,status:t._storageLoadData[o].status,content:t._storageLoadData[o].content,source:t._storageLoadData[o].source,elemW:t._storageLoadData[o].elemW,elemH:t._storageLoadData[o].elemH,element:null===(r=t._storageLoadData[o])||void 0===r?void 0:r.element})})).catch((function(e){var n,r,s,c,u,h,f,d,p,v,g,y;console.warn(e),l.splice(l.indexOf(o),1);var m=a();t._currentLoadData[o]&&(t._storageLoadData[o]={uuid:o,type:null===(n=t._currentLoadData[o])||void 0===n?void 0:n.type,status:'fail',content:null,error:e,source:null===(r=t._currentLoadData[o])||void 0===r?void 0:r.source,elemW:null===(s=t._currentLoadData[o])||void 0===s?void 0:s.elemW,elemH:null===(c=t._currentLoadData[o])||void 0===c?void 0:c.elemH,element:null===(u=t._currentLoadData[o])||void 0===u?void 0:u.element}),0===l.length&&0===i.length&&!0===m&&(t._status=he.FREE,t._loadTask()),t._currentLoadData[o]&&t._event.trigger('error',{uuid:o,type:null===(h=t._storageLoadData[o])||void 0===h?void 0:h.type,status:null===(f=t._storageLoadData[o])||void 0===f?void 0:f.status,content:null===(d=t._storageLoadData[o])||void 0===d?void 0:d.content,source:null===(p=t._storageLoadData[o])||void 0===p?void 0:p.source,elemW:null===(v=t._storageLoadData[o])||void 0===v?void 0:v.elemW,elemH:null===(g=t._storageLoadData[o])||void 0===g?void 0:g.elemH,element:null===(y=t._storageLoadData[o])||void 0===y?void 0:y.element})}))},o=l.length;o<r;o++){if("break"===e())break}return!1};a()}},t.prototype._loadElementSource=function(t){return zt(this,void 0,void 0,(function(){return Lt(this,(function(e){switch(e.label){case 0:return t&&'image'===t.type?[4,de(t.source)]:[3,2];case 1:case 3:case 5:return[2,e.sent()];case 2:return t&&'svg'===t.type?[4,pe(t.source)]:[3,4];case 4:return t&&'html'===t.type?[4,ve(t.source,{width:t.elemW,height:t.elemH})]:[3,6];case 6:throw Error('Element\'s source is not support!')}}))}))},t}(),be=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);null==o||o.push(e),this._listeners.set(t,o||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);if(Array.isArray(o))for(var n=0;n<(null==o?void 0:o.length);n++)if(o[n]===e){o.splice(n,1);break}this._listeners.set(t,o||[])}},t.prototype.trigger=function(t,e){var o=this._listeners.get(t);return!!Array.isArray(o)&&(o.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}(),we=Symbol('_queue'),Ee=Symbol('_ctx'),Ce=Symbol('_status'),Pe=Symbol('_loader'),ze=Symbol('_opts'),Le=Symbol('_freeze'),De=Symbol('_drawFrame'),Te=Symbol('_retainQueueOneItem'),Ie=window.requestAnimationFrame,We=Qt.uuid.createUUID,Me=Qt.data.deepClone,Oe=Qt.Context;!function(t){t.NULL="null",t.FREE="free",t.DRAWING="drawing",t.FREEZE="freeze"}(xe||(xe={}));var ke=function(t){function e(e){var o=t.call(this)||this;return o[ye]=[],o[me]=null,o[_e]=xe.NULL,o[ze]=e,o[Pe]=new Se({maxParallelNum:6}),o[Pe].on('load',(function(t){o[De](),o.trigger('load',{element:t.element})})),o[Pe].on('error',(function(t){o.trigger('error',{element:t.element,error:t.error})})),o[Pe].on('complete',(function(){o.trigger('loadComplete',{t:Date.now()})})),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}Ct(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}(e,t),e.prototype.render=function(t,e,o){var n=(o||{}).changeResourceUUIDs,r=void 0===n?[]:n;this[Ce]=xe.FREE;var i=Me(e);if(Array.isArray(i.elements)&&i.elements.forEach((function(t){'string'==typeof t.uuid&&t.uuid||(t.uuid=We())})),!this[Ee])if(this[ze]&&'[object HTMLCanvasElement]'===Object.prototype.toString.call(t)){var s=this[ze],l=s.width,a=s.height,c=s.contextWidth,u=s.contextHeight,h=s.devicePixelRatio,f=t;f.width=l*h,f.height=a*h;var d=f.getContext('2d');this[Ee]=new Oe(d,{width:l,height:a,contextWidth:c||l,contextHeight:u||a,devicePixelRatio:h})}else t&&(this[Ee]=t);if(![xe.FREEZE].includes(this[Ce])){var p=Me({data:i});this[we].push(p),this[De](),this[Pe].load(i,r||[])}},e.prototype.getContext=function(){return this[Ee]},e.prototype.thaw=function(){this[Ce]=xe.FREE},e.prototype[(ye=we,me=Ee,_e=Ce,Le)]=function(){this[Ce]=xe.FREEZE},e.prototype[De]=function(){var t=this;this[Ce]!==xe.FREEZE&&Ie((function(){if(t[Ce]!==xe.FREEZE){var e=t[Ee],o=t[we][0],n=!1;t[we].length>1?o=t[we].shift():n=!0,!0!==t[Pe].isComplete()?(t[De](),o&&e&&ce(e,o.data,t[Pe])):o&&e?(ce(e,o.data,t[Pe]),t[Te](),n?t[Ce]=xe.FREE:t[De]()):t[Ce]=xe.FREE,t.trigger('drawFrame',{t:Date.now()}),!0===t[Pe].isComplete()&&1===t[we].length&&t[Ce]===xe.FREE&&(e&&t[we][0]&&t[we][0].data&&ce(e,t[we][0].data,t[Pe]),t.trigger('drawFrameComplete',{t:Date.now()}),t[Le]())}}))},e.prototype[Te]=function(){if(!(this[we].length<=1)){var t=Me(this[we][this[we].length-1]);this[we]=[t]}},e}(be),Re=Et.color.isColorStr;function Ue(t){return'number'==typeof t&&(t>0||t<=0)}function Ae(t){return'number'==typeof t&&t>=0}function Fe(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function Ne(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var Ye={x:function(t){return Ue(t)},y:function(t){return Ue(t)},w:Ae,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:Ue,borderWidth:function(t){return Ae(t)},borderRadius:function(t){return Ue(t)&&t>=0},color:function(t){return Re(t)},imageSrc:function(t){return Ne(t)||Fe(t)},imageURL:Fe,imageBase64:Ne,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var o=document.createElement('div');o.innerHTML=t,o.children.length>0&&(e=!0),o=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return Ue(t)&&t>0},lineHeight:function(t){return Ue(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return Ue(t)&&t>0}};function Xe(t){void 0===t&&(t={});var e=t.borderColor,o=t.borderRadius,n=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!Ye.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!Ye.number(o))&&!(t.hasOwnProperty('borderWidth')&&!Ye.number(n)))}var He={attrs:function(t){var e=t.x,o=t.y,n=t.w,r=t.h,i=t.angle;return!!(Ye.x(e)&&Ye.y(o)&&Ye.w(n)&&Ye.h(r)&&Ye.angle(i))&&(i>=-360&&i<=360)},textDesc:function(t){var e=t.text,o=t.color,n=t.fontSize,r=t.lineHeight,i=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,u=t.strokeColor;return!!Ye.text(e)&&(!!Ye.color(o)&&(!!Ye.fontSize(n)&&(!(t.hasOwnProperty('bgColor')&&!Ye.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!Ye.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!Ye.lineHeight(r))&&(!(t.hasOwnProperty('fontFamily')&&!Ye.fontFamily(i))&&(!(t.hasOwnProperty('textAlign')&&!Ye.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!Ye.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!Ye.color(u))&&!!Xe(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!Ye.color(e))&&!!Xe(t)},circleDesc:function(t){var e=t.bgColor,o=t.borderColor,n=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!Ye.color(e))&&(!(t.hasOwnProperty('borderColor')&&!Ye.color(o))&&!(t.hasOwnProperty('borderWidth')&&!Ye.number(n)))},imageDesc:function(t){var e=t.src;return!!Ye.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!Ye.svg(e)},htmlDesc:function(t){var e=t.html;return!!Ye.html(e)}};function Be(t){return t/180*Math.PI}function je(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function Ge(t,e){var o=e.x-t.x,n=t.y-e.y;if(0===o){if(n<0)return Math.PI/2;if(n>0)return 1.5*Math.PI}else if(0===n){if(o<0)return Math.PI;if(o>0)return 0}return o>0&&n<0?Math.atan(Math.abs(n)/Math.abs(o)):o<0&&n<0?Math.PI-Math.atan(Math.abs(n)/Math.abs(o)):o<0&&n>0?Math.PI+Math.atan(Math.abs(n)/Math.abs(o)):o>0&&n>0?2*Math.PI-Math.atan(Math.abs(n)/Math.abs(o)):null}function Qe(t,e,o){return qe(t,je(e),Be(e.angle||0)||0,o)}function qe(t,e,o,n){e&&(o>0||o<0)&&(t.translate(e.x,e.y),t.rotate(o),t.translate(-e.x,-e.y)),n(t),e&&(o>0||o<0)&&(t.translate(e.x,e.y),t.rotate(-o),t.translate(-e.x,-e.y))}var Ve=Et.istype,Ze=Et.color;function $e(t){t.setFillStyle('#000000'),t.setStrokeStyle('#000000'),t.setLineDash([]),t.setGlobalAlpha(1),t.setShadowColor('#00000000'),t.setShadowOffsetX(0),t.setShadowOffsetY(0),t.setShadowBlur(0)}function Je(t,e,o){$e(t),function(t,e){$e(t),Qe(t,e,(function(){if(e.desc.borderWidth&&e.desc.borderWidth>0){var o=e.desc.borderWidth,n='#000000';!0===Ze.isColorStr(e.desc.borderColor)&&(n=e.desc.borderColor);var r=e.x-o/2,i=e.y-o/2,s=e.w+o,l=e.h+o,a=e.desc.borderRadius||0;(a=Math.min(a,s/2,l/2))<s/2&&a<l/2&&(a+=o/2);var c=e.desc;void 0!==c.shadowColor&&Et.color.isColorStr(c.shadowColor)&&t.setShadowColor(c.shadowColor),void 0!==c.shadowOffsetX&&Ye.number(c.shadowOffsetX)&&t.setShadowOffsetX(c.shadowOffsetX),void 0!==c.shadowOffsetY&&Ye.number(c.shadowOffsetY)&&t.setShadowOffsetY(c.shadowOffsetY),void 0!==c.shadowBlur&&Ye.number(c.shadowBlur)&&t.setShadowBlur(c.shadowBlur),t.beginPath(),t.setLineWidth(o),t.setStrokeStyle(n),t.moveTo(r+a,i),t.arcTo(r+s,i,r+s,i+l,a),t.arcTo(r+s,i+l,r,i+l,a),t.arcTo(r,i+l,r,i,a),t.arcTo(r,i,r+s,i,a),t.closePath(),t.stroke()}}))}(t,e),$e(t),Qe(t,e,(function(){var n=e.x,r=e.y,i=e.w,s=e.h,l=e.desc.borderRadius||0;(i<2*(l=Math.min(l,i/2,s/2))||s<2*l)&&(l=0),t.beginPath(),t.moveTo(n+l,r),t.arcTo(n+i,r,n+i,r+s,l),t.arcTo(n+i,r+s,n,r+s,l),t.arcTo(n,r+s,n,r,l),t.arcTo(n,r,n+i,r,l),t.closePath(),('string'==typeof o||['CanvasPattern'].includes(Ve.type(o)))&&t.setFillStyle(o),t.fill()}))}function Ke(t,e){Je(t,e,e.desc.bgColor)}function to(t,e,o){var n=o.getContent(e.uuid);Qe(t,e,(function(){n&&t.drawImage(n,e.x,e.y,e.w,e.h)}))}function eo(t,e,o){var n=o.getContent(e.uuid);Qe(t,e,(function(){n&&t.drawImage(n,e.x,e.y,e.w,e.h)}))}function oo(t,e,o){var n=o.getContent(e.uuid);Qe(t,e,(function(){n&&t.drawImage(n,e.x,e.y,e.w,e.h)}))}function no(t,o,n,r){$e(t),Je(t,o,o.desc.bgColor||'transparent'),Qe(t,o,(function(){var n=e({fontSize:12,fontFamily:'sans-serif',textAlign:'center'},o.desc);t.setFillStyle(o.desc.color),t.setTextBaseline('top'),t.setFont({fontWeight:n.fontWeight,fontSize:n.fontSize,fontFamily:n.fontFamily});var r=n.text.replace(/\r\n/gi,'\n'),i=n.lineHeight||n.fontSize,s=r.split('\n'),l=[];s.forEach((function(e){for(var n='',r=0,s=0;s<e.length&&(t.measureText(n+(e[s]||'')).width<t.calcDeviceNum(o.w)?n+=e[s]||'':(l.push({text:n,width:t.calcScreenNum(t.measureText(n).width)}),n=e[s]||'',r++),!((r+1)*i>o.h));s++)if(n&&e.length-1===s&&(r+1)*i<o.h){l.push({text:n,width:t.calcScreenNum(t.measureText(n).width)});break}}));var a=o.y;if(l.length*i<o.h&&(a+=(o.h-l.length*i)/2),void 0!==n.textShadowColor&&Et.color.isColorStr(n.textShadowColor)&&t.setShadowColor(n.textShadowColor),void 0!==n.textShadowOffsetX&&Ye.number(n.textShadowOffsetX)&&t.setShadowOffsetX(n.textShadowOffsetX),void 0!==n.textShadowOffsetY&&Ye.number(n.textShadowOffsetY)&&t.setShadowOffsetY(n.textShadowOffsetY),void 0!==n.textShadowBlur&&Ye.number(n.textShadowBlur)&&t.setShadowBlur(n.textShadowBlur),l.forEach((function(e,r){var s=o.x;'center'===n.textAlign?s=o.x+(o.w-e.width)/2:'right'===n.textAlign&&(s=o.x+(o.w-e.width)),t.fillText(e.text,s,a+i*r)})),$e(t),Et.color.isColorStr(n.strokeColor)&&void 0!==n.strokeWidth&&n.strokeWidth>0){var c=o.y;l.length*i<o.h&&(c+=(o.h-l.length*i)/2),l.forEach((function(e,r){var s=o.x;'center'===n.textAlign?s=o.x+(o.w-e.width)/2:'right'===n.textAlign&&(s=o.x+(o.w-e.width)),void 0!==n.strokeColor&&t.setStrokeStyle(n.strokeColor),void 0!==n.strokeWidth&&n.strokeWidth>0&&t.setLineWidth(n.strokeWidth),t.strokeText(e.text,s,c+i*r)}))}}))}function ro(t,e){$e(t),Qe(t,e,(function(t){var o=e.x,n=e.y,r=e.w,i=e.h,s=e.desc,l=s.bgColor,a=void 0===l?'#000000':l,c=s.borderColor,u=void 0===c?'#000000':c,h=s.borderWidth,f=void 0===h?0:h,d=r/2,p=i/2,v=o+d,g=n+p;if(f&&f>0){var y=f/2+d,m=f/2+p;t.beginPath(),t.setStrokeStyle(u),t.setLineWidth(f),t.ellipse(v,g,y,m,0,0,2*Math.PI),t.closePath(),t.stroke()}t.beginPath(),t.setFillStyle(a),t.ellipse(v,g,d,p,0,0,2*Math.PI),t.closePath(),t.fill()}))}function io(t,e){if(null==e?void 0:e.selectedElementWrapper){var o=e.selectedElementWrapper;$e(t),qe(t,o.translate,o.radian||0,(function(){t.beginPath(),t.setLineDash(o.lineDash),t.setLineWidth(o.lineWidth),t.setStrokeStyle(o.color),t.moveTo(o.controllers.topLeft.x,o.controllers.topLeft.y),t.lineTo(o.controllers.topRight.x,o.controllers.topRight.y),t.lineTo(o.controllers.bottomRight.x,o.controllers.bottomRight.y),t.lineTo(o.controllers.bottomLeft.x,o.controllers.bottomLeft.y),t.lineTo(o.controllers.topLeft.x,o.controllers.topLeft.y-o.lineWidth/2),t.stroke(),t.closePath(),!0!==o.lock?(!0!==o.controllers.rotate.invisible&&(t.beginPath(),t.moveTo(o.controllers.top.x,o.controllers.top.y),t.lineTo(o.controllers.rotate.x,o.controllers.rotate.y+o.controllerSize),t.stroke(),t.closePath(),t.beginPath(),t.setLineDash([]),t.setLineWidth(o.controllerSize/2),t.arc(o.controllers.rotate.x,o.controllers.rotate.y,.8*o.controllerSize,Math.PI/6,2*Math.PI),t.stroke(),t.closePath()),t.setFillStyle(o.color),[o.controllers.topLeft,o.controllers.top,o.controllers.topRight,o.controllers.right,o.controllers.bottomRight,o.controllers.bottom,o.controllers.bottomLeft,o.controllers.left].forEach((function(e){!0!==e.invisible&&(t.beginPath(),t.arc(e.x,e.y,o.controllerSize,0,2*Math.PI),t.fill(),t.closePath())}))):($e(t),t.setStrokeStyle(o.color),[o.controllers.topLeft,o.controllers.top,o.controllers.topRight,o.controllers.right,o.controllers.bottomRight,o.controllers.bottom,o.controllers.bottomLeft,o.controllers.left].forEach((function(e){t.beginPath(),t.moveTo(e.x-o.controllerSize/2,e.y-o.controllerSize/2),t.lineTo(e.x+o.controllerSize/2,e.y+o.controllerSize/2),t.stroke(),t.closePath(),t.beginPath(),t.moveTo(e.x+o.controllerSize/2,e.y-o.controllerSize/2),t.lineTo(e.x-o.controllerSize/2,e.y+o.controllerSize/2),t.stroke(),t.closePath()})))}))}}function so(t,e){if(null==e?void 0:e.selectedAreaWrapper){var o=e.selectedAreaWrapper;o&&o.w>0&&o.h>0&&($e(t),t.setGlobalAlpha(.3),t.setFillStyle(o.color),t.fillRect(o.x,o.y,o.w,o.h),$e(t),t.beginPath(),t.setLineDash(o.lineDash),t.setLineWidth(o.lineWidth),t.setStrokeStyle(o.color),t.moveTo(o.x,o.y),t.lineTo(o.x+o.w,o.y),t.lineTo(o.x+o.w,o.y+o.h),t.lineTo(o.x,o.y+o.h),t.lineTo(o.x,o.y),t.stroke(),t.closePath())}}function lo(t,e){if(Array.isArray(null==e?void 0:e.selectedElementListWrappers)){var o=e.selectedElementListWrappers;null==o||o.forEach((function(e){$e(t),qe(t,e.translate,e.radian||0,(function(){$e(t),t.setGlobalAlpha(.05),t.setFillStyle(e.color),t.fillRect(e.controllers.topLeft.x,e.controllers.topLeft.y,e.controllers.bottomRight.x-e.controllers.topLeft.x,e.controllers.bottomRight.y-e.controllers.topLeft.y),$e(t),t.beginPath(),t.setLineDash(e.lineDash),t.setLineWidth(e.lineWidth),t.setStrokeStyle(e.color),t.moveTo(e.controllers.topLeft.x,e.controllers.topLeft.y),t.lineTo(e.controllers.topRight.x,e.controllers.topRight.y),t.lineTo(e.controllers.bottomRight.x,e.controllers.bottomRight.y),t.lineTo(e.controllers.bottomLeft.x,e.controllers.bottomLeft.y),t.lineTo(e.controllers.topLeft.x,e.controllers.topLeft.y-e.lineWidth/2),t.stroke(),t.closePath(),!0===e.lock&&($e(t),t.setStrokeStyle(e.color),[e.controllers.topLeft,e.controllers.top,e.controllers.topRight,e.controllers.right,e.controllers.bottomRight,e.controllers.bottom,e.controllers.bottomLeft,e.controllers.left].forEach((function(o){t.beginPath(),t.moveTo(o.x-e.controllerSize/2,o.y-e.controllerSize/2),t.lineTo(o.x+e.controllerSize/2,o.y+e.controllerSize/2),t.stroke(),t.closePath(),t.beginPath(),t.moveTo(o.x+e.controllerSize/2,o.y-e.controllerSize/2),t.lineTo(o.x-e.controllerSize/2,o.y+e.controllerSize/2),t.stroke(),t.closePath()})))}))}))}}var ao=Et.color.isColorStr;function co(t,e,o,n){var r;$e(t);var i=t.getSize();if(t.clearRect(0,0,i.contextWidth,i.contextHeight),'string'==typeof e.bgColor&&ao(e.bgColor)&&function(t,e){var o=t.getSize();t.setFillStyle(e),t.fillRect(0,0,o.contextWidth,o.contextHeight)}(t,e.bgColor),e.elements.length>0){for(var s=0;s<e.elements.length;s++){var l=e.elements[s];if(!0!==(null===(r=null==l?void 0:l.operation)||void 0===r?void 0:r.invisible))switch(l.type){case'rect':Ke(t,l);break;case'text':no(t,l);break;case'image':to(t,l,n);break;case'svg':eo(t,l,n);break;case'html':oo(t,l,n);break;case'circle':ro(t,l)}}io(t,o),so(t,o),lo(t,o)}}var uo={elementWrapper:{color:'#2ab6f1',lockColor:'#aaaaaa',controllerSize:6,lineWidth:1,lineDash:[4,3]}};var ho=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);null==o||o.push(e),this._listeners.set(t,o||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);if(Array.isArray(o))for(var n=0;n<(null==o?void 0:o.length);n++)if(o[n]===e){o.splice(n,1);break}this._listeners.set(t,o||[])}},t.prototype.trigger=function(t,e){var o=this._listeners.get(t);return!!Array.isArray(o)&&(o.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();function fo(t,e){var o,n;return(null===(o=null==t?void 0:t.desc)||void 0===o?void 0:o.src)!==(null===(n=null==e?void 0:e.desc)||void 0===n?void 0:n.src)}function po(t,e){var o,n;return(null===(o=null==t?void 0:t.desc)||void 0===o?void 0:o.svg)!==(null===(n=null==e?void 0:e.desc)||void 0===n?void 0:n.svg)}function vo(t,e){var o,n,r,i,s,l;return(null===(o=null==t?void 0:t.desc)||void 0===o?void 0:o.html)!==(null===(n=null==e?void 0:e.desc)||void 0===n?void 0:n.html)||(null===(r=null==t?void 0:t.desc)||void 0===r?void 0:r.width)!==(null===(i=null==e?void 0:e.desc)||void 0===i?void 0:i.width)||(null===(s=null==t?void 0:t.desc)||void 0===s?void 0:s.height)!==(null===(l=null==e?void 0:e.desc)||void 0===l?void 0:l.height)}function go(t,e){var o=null,n=!1;switch(e.type){case'image':n=fo(t,e);break;case'svg':n=po(t,e);break;case'html':n=vo(t,e)}return!0===n&&(o=e.uuid),o}function yo(t){var e={};return t.elements.forEach((function(t){e[t.uuid]=t})),e}function mo(t){var e=t.toFixed(2);return parseFloat(e)}function _o(t){return mo(t%360)}var xo=Object.keys({text:{},rect:{},image:{},svg:{},circle:{},html:{}}),So=Et.uuid.createUUID,bo=15,wo=function(){function t(t){this._ctx=t}return t.prototype.initData=function(t){return t.elements.forEach((function(t){t.uuid&&'string'==typeof t.uuid||(t.uuid=So())})),t},t.prototype.isPointInElement=function(t,e){for(var o,n,r=this._ctx,i=-1,s=null,l=function(l){var a=e.elements[l];if(!0===(null===(o=a.operation)||void 0===o?void 0:o.invisible))return"continue";var c=0;return(null===(n=a.desc)||void 0===n?void 0:n.borderWidth)>0&&(c=a.desc.borderWidth),Qe(r,a,(function(){r.beginPath(),r.moveTo(a.x-c,a.y-c),r.lineTo(a.x+a.w+c,a.y-c),r.lineTo(a.x+a.w+c,a.y+a.h+c),r.lineTo(a.x-c,a.y+a.h+c),r.lineTo(a.x-c,a.y-c),r.closePath(),r.isPointInPath(t.x,t.y)&&(i=l,s=a.uuid)})),i>=0?"break":void 0},a=e.elements.length-1;a>=0;a--){if("break"===l(a))break}return[i,s]},t.prototype.dragElement=function(t,e,o,n,r){var i=this.getElementIndex(t,e);if(t.elements[i]){var s=o.x-n.x,l=o.y-n.y;t.elements[i].x+=s/r,t.elements[i].y+=l/r,this.limitElementAttrs(t.elements[i])}},t.prototype.transformElement=function(t,e,o,n,r,i){var s,l,a=this.getElementIndex(t,e);if(!t.elements[a])return null;if(!0===(null===(l=null===(s=t.elements[a])||void 0===s?void 0:s.operation)||void 0===l?void 0:l.lock))return null;var c=(o.x-n.x)/r,u=(o.y-n.y)/r,h=t.elements[a];if(['top-left','top','top-right','right','bottom-right','bottom','bottom-left','left'].includes(i)){var f=function(t,e,o,n,r){var i={x:t.x,y:t.y,w:t.w,h:t.h};switch(t.angle,n){case'top-left':t.w-e>0&&t.h-o>0&&(i.x+=e,i.y+=o,i.w-=e,i.h-=o);break;case'top':if(0===t.angle||Math.abs(t.angle)<bo)i.h-o>0&&(i.y+=o,i.h-=o);else if(t.angle>0||t.angle<0){var s=t.angle>0?t.angle:Math.max(0,t.angle+360),l=Co(e,o),a=i.x+t.w/2,c=i.y+t.h/2;if(s<90){l=0-Po(l,o);var u=Eo(s);a+=(p=l/2)*Math.sin(u),c-=p*Math.cos(u)}else if(s<180){l=Po(l,e);u=Eo(s-90);a+=(p=l/2)*Math.cos(u),c+=p*Math.sin(u)}else if(s<270){l=Po(l,o);u=Eo(s-180);a-=(p=l/2)*Math.sin(u),c+=p*Math.cos(u)}else if(s<360){l=0-Po(l,e);u=Eo(s-270);a-=(p=l/2)*Math.cos(u),c-=p*Math.sin(u)}i.h+l>0&&(i.h=i.h+l,i.x=a-i.w/2,i.y=c-i.h/2)}else i.h-o>0&&(i.y+=o,i.h-=o);break;case'top-right':i.h-o>0&&i.w+e>0&&(i.y+=o,i.w+=e,i.h-=o);break;case'right':if(0===t.angle||Math.abs(t.angle)<bo)t.w+e>0&&(i.w+=e);else if(t.angle>0||t.angle<0){var h=t.angle>0?t.angle:Math.max(0,t.angle+360);l=Co(e,o),a=i.x+t.w/2,c=i.y+t.h/2;if(h<90){l=Po(l,o);u=Eo(h);a+=(p=l/2)*Math.cos(u),c+=p*Math.sin(u)}else if(h<180){l=Po(l,o);u=Eo(h-90);a-=(p=l/2)*Math.sin(u),c+=p*Math.cos(u)}else if(h<270){l=Po(l,o);u=Eo(h-180);a+=(p=l/2)*Math.cos(u),c+=p*Math.sin(u),l=0-l}else if(h<360){l=Po(l,e);u=Eo(h-270);a+=(p=l/2)*Math.sin(u),c-=p*Math.cos(u)}i.w+l>0&&(i.w=i.w+l,i.x=a-i.w/2,i.y=c-i.h/2)}else t.w+e>0&&(i.w+=e);break;case'bottom-right':t.w+e>0&&t.h+o>0&&(i.w+=e,i.h+=o);break;case'bottom':if(0===t.angle||Math.abs(t.angle)<bo)t.h+o>0&&(i.h+=o);else if(t.angle>0||t.angle<0){var f=t.angle>0?t.angle:Math.max(0,t.angle+360);l=Co(e,o),a=i.x+t.w/2,c=i.y+t.h/2;if(f<90){l=Po(l,o);u=Eo(f);a-=(p=l/2)*Math.sin(u),c+=p*Math.cos(u)}else if(f<180){l=0-Po(l,e);u=Eo(f-90);a-=(p=l/2)*Math.cos(u),c-=p*Math.sin(u)}else if(f<270){l=Po(l,e);u=Eo(f-180);a+=(p=l/2)*Math.sin(u),c-=p*Math.cos(u)}else if(f<360){l=Po(l,e);u=Eo(f-270);a+=(p=l/2)*Math.cos(u),c+=p*Math.sin(u)}i.h+l>0&&(i.h=i.h+l,i.x=a-i.w/2,i.y=c-i.h/2)}else t.h+o>0&&(i.h+=o);break;case'bottom-left':t.w-e>0&&t.h+o>0&&(i.x+=e,i.w-=e,i.h+=o);break;case'left':if(0===t.angle||Math.abs(t.angle)<bo)t.w-e>0&&(i.x+=e,i.w-=e);else if(t.angle>0||t.angle<0){var d=t.angle>0?t.angle:Math.max(0,t.angle+360);l=Co(e,o),a=i.x+t.w/2,c=i.y+t.h/2;if(d<90){l=0-Po(l,e);u=Eo(d);a-=(p=l/2)*Math.cos(u),c-=p*Math.sin(u)}else if(d<180){l=Po(l,e);u=Eo(d-90);a+=(p=l/2)*Math.sin(u),c-=p*Math.cos(u)}else if(d<270){l=Po(l,o);u=Eo(d-180);a+=(p=l/2)*Math.cos(u),c+=p*Math.sin(u)}else if(d<360){l=Po(l,o);var p;u=Eo(d-270);a-=(p=l/2)*Math.sin(u),c+=p*Math.cos(u)}i.w+l>0&&(i.w=i.w+l,i.x=a-i.w/2,i.y=c-i.h/2)}else t.w-e>0&&(i.x+=e,i.w-=e)}return i}(h,c,u,i);h.x=f.x,h.y=f.y,h.w=f.w,h.h=f.h}else if('rotate'===i){var d=function(t,e,o){var n=Ge(t,e),r=Ge(t,o);return null!==r&&null!==n?n>3*Math.PI/2&&r<Math.PI/2?r+(2*Math.PI-n):r>3*Math.PI/2&&n<Math.PI/2?n+(2*Math.PI-r):r-n:0}(je(h),n,o);h.angle=(h.angle||0)+function(t){return t/Math.PI*180}(d)}return this.limitElementAttrs(h),{width:mo(h.w),height:mo(h.h),angle:_o(h.angle||0)}},t.prototype.getElementIndex=function(t,e){for(var o=-1,n=0;n<t.elements.length;n++)if(t.elements[n].uuid===e){o=n;break}return o},t.prototype.limitElementAttrs=function(t){t.x=mo(t.x),t.y=mo(t.y),t.w=mo(t.w),t.h=mo(t.h),t.angle=_o(t.angle||0)},t}();function Eo(t){return t*Math.PI/180}function Co(t,e){return Math.sqrt(t*t+e*e)}function Po(t,e){return e>0?Math.abs(t):0-Math.abs(t)}var zo=Et.data.deepClone,Lo=function(){function t(t,e){this._areaStart={x:0,y:0},this._areaEnd={x:0,y:0},this._board=t,this._ctx=this._board.getContext(),this._coreConfig=e,this._helperConfig={elementIndexMap:{}}}return t.prototype.updateConfig=function(t,e){this._updateElementIndex(t),this._updateSelectedElementWrapper(t,e),this._updateSelectedElementListWrapper(t,e)},t.prototype.getConfig=function(){return zo(this._helperConfig)},t.prototype.getElementIndexByUUID=function(t){var e=this._helperConfig.elementIndexMap[t];return e>=0?e:null},t.prototype.isPointInElementWrapperController=function(t,e){var o,n,r=this._ctx,i=(null===(n=null===(o=this._helperConfig)||void 0===o?void 0:o.selectedElementWrapper)||void 0===n?void 0:n.uuid)||null,s=null,l=null,a=null;if(!this._helperConfig.selectedElementWrapper)return{uuid:i,selectedControllerDirection:l,directIndex:s,hoverControllerDirection:a};var c=this._helperConfig.selectedElementWrapper,u=[c.controllers.right,c.controllers.topRight,c.controllers.top,c.controllers.topLeft,c.controllers.left,c.controllers.bottomLeft,c.controllers.bottom,c.controllers.bottomRight],h=['right','top-right','top','top-left','left','bottom-left','bottom','bottom-right'],f=Et.data.deepClone(h),d=0;if(e&&i){var p=this.getElementIndexByUUID(i);if(null!==p&&p>=0){var v=e.elements[p].angle;v<0&&(v+=360),v<45?d=0:v<90?d=1:v<135?d=2:v<180?d=3:v<225?d=4:v<270?d=5:v<315&&(d=6)}}if(d>0&&(f=f.slice(-d).concat(f.slice(0,-d))),qe(r,c.translate,c.radian||0,(function(){for(var e=0;e<u.length;e++){var o=u[e];if(!0!==o.invisible&&(r.beginPath(),r.arc(o.x,o.y,c.controllerSize,0,2*Math.PI),r.closePath(),r.isPointInPath(t.x,t.y)&&(l=h[e],a=f[e]),l)){s=e;break}}})),null===l){var g=c.controllers.rotate;!0!==g.invisible&&qe(r,c.translate,c.radian||0,(function(){r.beginPath(),r.arc(g.x,g.y,c.controllerSize,0,2*Math.PI),r.closePath(),r.isPointInPath(t.x,t.y)&&(l='rotate',a='rotate')}))}return{uuid:i,selectedControllerDirection:l,hoverControllerDirection:a,directIndex:s}},t.prototype.isPointInElementList=function(t,e){for(var o,n,r,i=this._ctx,s=-1,l=null,a=(null===(o=this._helperConfig)||void 0===o?void 0:o.selectedElementListWrappers)||[],c=function(o){var c=a[o],h=u._helperConfig.elementIndexMap[c.uuid],f=e.elements[h];if(!f)return"continue";if(!0===(null===(n=f.operation)||void 0===n?void 0:n.invisible))return"continue";var d=0;return(null===(r=f.desc)||void 0===r?void 0:r.borderWidth)>0&&(d=f.desc.borderWidth),Qe(i,f,(function(){i.beginPath(),i.moveTo(f.x-d,f.y-d),i.lineTo(f.x+f.w+d,f.y-d),i.lineTo(f.x+f.w+d,f.y+f.h+d),i.lineTo(f.x-d,f.y+f.h+d),i.lineTo(f.x-d,f.y-d),i.closePath(),i.isPointInPath(t.x,t.y)&&(s=o,l=f.uuid)})),s>=0?"break":void 0},u=this,h=0;h<a.length;h++){if("break"===c(h))break}return!!(l&&s>=0)},t.prototype.startSelectArea=function(t){this._areaStart=t,this._areaEnd=t},t.prototype.changeSelectArea=function(t){this._areaEnd=t,this._calcSelectedArea()},t.prototype.clearSelectedArea=function(){this._areaStart={x:0,y:0},this._areaEnd={x:0,y:0},this._calcSelectedArea()},t.prototype.calcSelectedElements=function(t){var e=this._ctx.getTransform(),o=e.scale,n=void 0===o?1:o,r=e.scrollX,i=void 0===r?0:r,s=e.scrollY,l=void 0===s?0:s,a=this._areaStart,c=this._areaEnd,u=(Math.min(a.x,c.x)-i)/n,h=(Math.min(a.y,c.y)-l)/n,f=Math.abs(c.x-a.x)/n,d=Math.abs(c.y-a.y)/n,p=[],v=this._ctx;return v.beginPath(),v.moveTo(u,h),v.lineTo(u+f,h),v.lineTo(u+f,h+d),v.lineTo(u,h+d),v.lineTo(u,h),v.closePath(),t.elements.forEach((function(t){var e;if(!0!==(null===(e=null==t?void 0:t.operation)||void 0===e?void 0:e.invisible)){var o=t.x+t.w/2,n=t.y+t.h/2;v.isPointInPathWithoutScroll(o,n)&&p.push(t.uuid)}})),p},t.prototype._calcSelectedArea=function(){var t=this._areaStart,e=this._areaEnd,o=this._ctx.getTransform(),n=o.scale,r=void 0===n?1:n,i=o.scrollX,s=void 0===i?0:i,l=o.scrollY,a=void 0===l?0:l,c=this._coreConfig.elementWrapper,u=c.lineWidth/r,h=c.lineDash.map((function(t){return t/r}));this._helperConfig.selectedAreaWrapper={x:(Math.min(t.x,e.x)-s)/r,y:(Math.min(t.y,e.y)-a)/r,w:Math.abs(e.x-t.x)/r,h:Math.abs(e.y-t.y)/r,startPoint:{x:t.x,y:t.y},endPoint:{x:e.x,y:e.y},lineWidth:u,lineDash:h,color:c.color}},t.prototype._updateElementIndex=function(t){var e=this;this._helperConfig.elementIndexMap={},t.elements.forEach((function(t,o){e._helperConfig.elementIndexMap[t.uuid]=o}))},t.prototype._updateSelectedElementWrapper=function(t,e){var o,n=e.selectedUUID;if('string'==typeof n&&this._helperConfig.elementIndexMap[n]>=0){var r=this._helperConfig.elementIndexMap[n],i=t.elements[r];if(!0!==(null===(o=null==i?void 0:i.operation)||void 0===o?void 0:o.invisible)){var s=this._createSelectedElementWrapper(i,e);this._helperConfig.selectedElementWrapper=s}}else delete this._helperConfig.selectedElementWrapper},t.prototype._updateSelectedElementListWrapper=function(t,e){var o=this,n=e.selectedUUIDList,r=[];t.elements.forEach((function(t,i){if(null==n?void 0:n.includes(t.uuid)){var s=o._createSelectedElementWrapper(t,e);r.push(s)}})),this._helperConfig.selectedElementListWrappers=r},t.prototype._createSelectedElementWrapper=function(t,e){var o,n,r,i,s,l,a,c,u,h,f,d,p=e.scale,v=this._coreConfig.elementWrapper,g=v.controllerSize/p,y=v.lineWidth/p,m=v.lineDash.map((function(t){return t/p})),_=(null===(o=t.desc)||void 0===o?void 0:o.borderWidth)||0,x=!1;'number'==typeof t.angle&&Math.abs(t.angle)>15&&(x=!0);var S={uuid:t.uuid,controllerSize:g,lock:!0===(null===(n=null==t?void 0:t.operation)||void 0===n?void 0:n.lock),controllers:{topLeft:{x:t.x-g-_,y:t.y-g-_,invisible:x||!0===(null===(r=null==t?void 0:t.operation)||void 0===r?void 0:r.disbaleScale)},top:{x:t.x+t.w/2,y:t.y-g-_,invisible:!0===(null===(i=null==t?void 0:t.operation)||void 0===i?void 0:i.disbaleScale)},topRight:{x:t.x+t.w+g+_,y:t.y-g-_,invisible:x||!0===(null===(s=null==t?void 0:t.operation)||void 0===s?void 0:s.disbaleScale)},right:{x:t.x+t.w+g+_,y:t.y+t.h/2,invisible:!0===(null===(l=null==t?void 0:t.operation)||void 0===l?void 0:l.disbaleScale)},bottomRight:{x:t.x+t.w+g+_,y:t.y+t.h+g+_,invisible:x||!0===(null===(a=null==t?void 0:t.operation)||void 0===a?void 0:a.disbaleScale)},bottom:{x:t.x+t.w/2,y:t.y+t.h+g+_,invisible:!0===(null===(c=null==t?void 0:t.operation)||void 0===c?void 0:c.disbaleScale)},bottomLeft:{x:t.x-g-_,y:t.y+t.h+g+_,invisible:x||!0===(null===(u=null==t?void 0:t.operation)||void 0===u?void 0:u.disbaleScale)},left:{x:t.x-g-_,y:t.y+t.h/2,invisible:!0===(null===(h=null==t?void 0:t.operation)||void 0===h?void 0:h.disbaleScale)},rotate:{x:t.x+t.w/2,y:t.y-g-(2*g+12)-_,invisible:!0===(null===(f=null==t?void 0:t.operation)||void 0===f?void 0:f.disbaleRotate)}},lineWidth:y,lineDash:m,color:!0===(null===(d=null==t?void 0:t.operation)||void 0===d?void 0:d.lock)?v.lockColor:v.color};return'number'==typeof t.angle&&(t.angle>0||t.angle<0)&&(S.radian=Be(t.angle),S.translate=je(t)),S},t}(),Do=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);null==o||o.push(e),this._listeners.set(t,o||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);if(Array.isArray(o))for(var n=0;n<(null==o?void 0:o.length);n++)if(o[n]===e){o.splice(n,1);break}this._listeners.set(t,o||[])}},t.prototype.trigger=function(t,e){var o=this._listeners.get(t);return!!Array.isArray(o)&&(o.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var To,Io=Et.loader,Wo=Io.loadImage,Mo=Io.loadSVG,Oo=Io.loadHTML;!function(t){t.FREE="free",t.LOADING="loading",t.COMPLETE="complete"}(To||(To={}));var ko=function(){function t(t){this._currentLoadData={},this._currentUUIDQueue=[],this._storageLoadData={},this._status=To.FREE,this._waitingLoadQueue=[],this._opts=t,this._event=new Do,this._waitingLoadQueue=[]}return t.prototype.load=function(t,e){var o=this._resetLoadData(t,e),n=o[0],r=o[1];this._status===To.FREE||this._status===To.COMPLETE?(this._currentUUIDQueue=n,this._currentLoadData=r,this._loadTask()):this._status===To.LOADING&&n.length>0&&this._waitingLoadQueue.push({uuidQueue:n,loadData:r})},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype.isComplete=function(){return this._status===To.COMPLETE},t.prototype.getContent=function(t){var e;return'loaded'===(null===(e=this._storageLoadData[t])||void 0===e?void 0:e.status)?this._storageLoadData[t].content:null},t.prototype._resetLoadData=function(t,e){for(var o={},n=[],r=this._storageLoadData,i=t.elements.length-1;i>=0;i--){var s=t.elements[i];['image','svg','html'].includes(s.type)&&(r[s.uuid]?e.includes(s.uuid)&&(o[s.uuid]=this._createEmptyLoadItem(s),n.push(s.uuid)):(o[s.uuid]=this._createEmptyLoadItem(s),n.push(s.uuid)))}return[n,o]},t.prototype._createEmptyLoadItem=function(t){var e='',o=t.type,n=t.w,r=t.h;if('image'===t.type)e=(i=t).desc.src||'';else if('svg'===t.type){e=(i=t).desc.svg||''}else if('html'===t.type){var i;e=function(t){return t.replace(/<script[\s\S]*?<\/script>/gi,'')}((i=t).desc.html||''),n=i.desc.width||t.w,r=i.desc.height||t.h}return{type:o,status:'null',content:null,source:e,elemW:n,elemH:r}},t.prototype._loadTask=function(){var t=this;if(this._status!==To.LOADING){if(this._status=To.LOADING,0===this._currentUUIDQueue.length){if(0===this._waitingLoadQueue.length)return this._status=To.COMPLETE,void this._event.trigger('complete',void 0);var e=this._waitingLoadQueue.shift();if(e){var o=e.uuidQueue,n=e.loadData;this._currentLoadData=n,this._currentUUIDQueue=o}}var r=this._opts.maxParallelNum,i=this._currentUUIDQueue.splice(0,r),s={};i.forEach((function(t,e){s[t]=e}));var l=[],a=function(){if(l.length>=r)return!1;if(0===i.length)return!0;for(var e=function(e){var o=i.shift();if(void 0===o)return"break";l.push(o),t._loadElementSource(t._currentLoadData[o]).then((function(e){l.splice(l.indexOf(o),1);var n=a();t._storageLoadData[o]={type:t._currentLoadData[o].type,status:'loaded',content:e,source:t._currentLoadData[o].source,elemW:t._currentLoadData[o].elemW,elemH:t._currentLoadData[o].elemH},0===l.length&&0===i.length&&!0===n&&(t._status=To.FREE,t._loadTask()),t._event.trigger('load',{type:t._storageLoadData[o].type,status:t._storageLoadData[o].status,content:t._storageLoadData[o].content,source:t._storageLoadData[o].source,elemW:t._storageLoadData[o].elemW,elemH:t._storageLoadData[o].elemH})})).catch((function(e){var n,r,s,c,u,h,f,d,p,v;console.warn(e),l.splice(l.indexOf(o),1);var g=a();t._currentLoadData[o]&&(t._storageLoadData[o]={type:null===(n=t._currentLoadData[o])||void 0===n?void 0:n.type,status:'fail',content:null,error:e,source:null===(r=t._currentLoadData[o])||void 0===r?void 0:r.source,elemW:null===(s=t._currentLoadData[o])||void 0===s?void 0:s.elemW,elemH:null===(c=t._currentLoadData[o])||void 0===c?void 0:c.elemH}),0===l.length&&0===i.length&&!0===g&&(t._status=To.FREE,t._loadTask()),t._currentLoadData[o]&&t._event.trigger('error',{type:null===(u=t._storageLoadData[o])||void 0===u?void 0:u.type,status:null===(h=t._storageLoadData[o])||void 0===h?void 0:h.status,content:null===(f=t._storageLoadData[o])||void 0===f?void 0:f.content,source:null===(d=t._storageLoadData[o])||void 0===d?void 0:d.source,elemW:null===(p=t._storageLoadData[o])||void 0===p?void 0:p.elemW,elemH:null===(v=t._storageLoadData[o])||void 0===v?void 0:v.elemH})}))},o=l.length;o<r;o++){if("break"===e())break}return!1};a()}},t.prototype._loadElementSource=function(t){return o(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return t&&'image'===t.type?[4,Wo(t.source)]:[3,2];case 1:case 3:case 5:return[2,e.sent()];case 2:return t&&'svg'===t.type?[4,Mo(t.source)]:[3,4];case 4:return t&&'html'===t.type?[4,Oo(t.source,{width:t.elemW,height:t.elemH})]:[3,6];case 6:throw Error('Element\'s source is not support!')}}))}))},t}(),Ro=Symbol('_displayCtx'),Uo=Symbol('_helper'),Ao=Symbol('_element'),Fo=Symbol('_opts'),No=function(){function t(t){this[Fo]=t,this[Ro]=this[Fo].board,this[Ao]=this[Fo].element,this[Uo]=this[Fo].helper}return t.prototype.isEffectivePoint=function(t){var e=this[Ro].getScrollLineWidth(),o=this[Ro].getScreenInfo();return t.x<=o.width-e&&t.y<=o.height-e},t.prototype.judgePointCursor=function(t,e){var o='auto',n=null;if(!this.isEffectivePoint(t))return{cursor:o,elementUUID:n};var r=this[Uo].isPointInElementWrapperController(t,e),i=r.uuid,s=r.hoverControllerDirection;if(i&&s){switch(s){case'top-right':o='ne-resize';break;case'top-left':o='nw-resize';break;case'top':o='n-resize';break;case'right':o='e-resize';break;case'bottom-right':o='se-resize';break;case'bottom':o='s-resize';break;case'bottom-left':o='sw-resize';break;case'left':o='w-resize';break;case'rotate':o='grab'}i&&(n=i)}else{var l=this[Ao].isPointInElement(t,e),a=l[0],c=l[1];a>=0&&(o='move'),c&&(n=c)}return{cursor:o,elementUUID:n}},t}();function Yo(t){var e={elements:[]};return Array.isArray(null==t?void 0:t.elements)&&(null==t||t.elements.forEach((function(t){void 0===t&&(t={}),function(t){if(!(Xo(t.x)&&Xo(t.y)&&Xo(t.w)&&Xo(t.h)))return!1;if('string'!=typeof t.type||!xo.includes(t.type))return!1;return!0}(t)&&e.elements.push(t)}))),'string'==typeof t.bgColor&&(e.bgColor=t.bgColor),e}function Xo(t){return t>=0||t<0}var Ho,Bo,jo,Go=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);null==o||o.push(e),this._listeners.set(t,o||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var o=this._listeners.get(t);if(Array.isArray(o))for(var n=0;n<(null==o?void 0:o.length);n++)if(o[n]===e){o.splice(n,1);break}this._listeners.set(t,o||[])}},t.prototype.trigger=function(t,e){var o=this._listeners.get(t);return!!Array.isArray(o)&&(o.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}(),Qo=window.requestAnimationFrame,qo=Et.data.deepClone;function Vo(){return{onlyRender:!1,hasInited:!1,mode:Bo.NULL,cursorStatus:jo.NULL,selectedUUID:null,selectedUUIDList:[],hoverUUID:null,selectedControllerDirection:null,hoverControllerDirection:null,prevPoint:null}}!function(t){t.NULL="null",t.FREE="free",t.DRAWING="drawing",t.FREEZE="freeze"}(Ho||(Ho={})),function(e){function o(t){var o=e.call(this)||this;return o._queue=[],o._status=Ho.NULL,o._board=t,o._loader=new ko({board:t,maxParallelNum:6}),o._loader.on('load',(function(t){o._drawFrame()})),o._loader.on('error',(function(t){console.log('Loader Error: ',t)})),o._loader.on('complete',(function(t){})),o}(function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)})(o,e),o.prototype.freeze=function(){this._status=Ho.FREEZE},o.prototype.thaw=function(){this._status=Ho.FREE},o.prototype.render=function(t,e,o){if(![Ho.FREEZE].includes(this._status)){var n=qo({data:t,helper:e});this._queue.push(n),this._status!==Ho.DRAWING&&(this._status=Ho.DRAWING,this._drawFrame()),this._loader.load(t,o)}},o.prototype._drawFrame=function(){var t=this;this._status!==Ho.FREEZE&&Qo((function(){if(t._status!==Ho.FREEZE){var e=t._board.getContext(),o=t._queue[0],n=!1;t._queue.length>1?o=t._queue.shift():n=!0,!0!==t._loader.isComplete()?(t._drawFrame(),o&&(co(e,o.data,o.helper,t._loader),t._board.draw())):o?(co(e,o.data,o.helper,t._loader),t._board.draw(),t._retainQueueOneItem(),n?t._status=Ho.FREE:t._drawFrame()):t._status=Ho.FREE,t.trigger('drawFrame',void 0),!0===t._loader.isComplete()&&1===t._queue.length&&t._status===Ho.FREE&&(t.trigger('drawFrameComplete',void 0),t.freeze())}}))},o.prototype._retainQueueOneItem=function(){if(!(this._queue.length<=1)){var t=qo(this._queue[this._queue.length-1]);this._queue=[t]}}}(Go),function(t){t.NULL="null",t.SELECT_ELEMENT="select-element",t.SELECT_ELEMENT_LIST="select-element-list",t.SELECT_ELEMENT_WRAPPER_CONTROLLER="select-element-wrapper-controller",t.SELECT_AREA="select-area"}(Bo||(Bo={})),function(t){t.DRAGGING="dragging",t.NULL="null"}(jo||(jo={}));var Zo=function(){function t(){this._temp=Vo()}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp=Vo()},t}(),$o=Symbol('_board'),Jo=Symbol('_data'),Ko=Symbol('_opts'),tn=Symbol('_config'),en=Symbol('_renderer'),on=Symbol('_element'),nn=Symbol('_helper'),rn=Symbol('_tempData'),sn=Symbol('_draw'),ln=Symbol('_coreEvent'),an=Symbol('_mapper'),cn=Symbol('_emitChangeScreen'),un=Symbol('_emitChangeData'),hn=Symbol('_todo'),fn=Et.data.deepClone,dn=Et.uuid.createUUID;var pn=Et.time,vn=Et.data.deepClone;function gn(t){!0!==t[rn].get('hasInited')&&(t[$o].on('hover',pn.throttle(function(t){return function(e){var o,n,r=!1;if(t[rn].get('mode')===Bo.SELECT_AREA)!0!==t[rn].get('onlyRender')&&t[$o].resetCursor();else if(t[rn].get('cursorStatus')===jo.NULL){var i=t[an].judgePointCursor(e,t[Jo]),s=i.cursor,l=i.elementUUID;if(!0!==t[rn].get('onlyRender')&&t[$o].setCursor(s),l)if(null!==(u=t[nn].getElementIndexByUUID(l))&&u>=0){var a=t[Jo].elements[u];if(!0===(null===(o=null==a?void 0:a.operation)||void 0===o?void 0:o.lock)||!0===(null===(n=null==a?void 0:a.operation)||void 0===n?void 0:n.invisible))return void t[$o].resetCursor();if(t[rn].get('hoverUUID')!==a.uuid){var c=t[nn].getElementIndexByUUID(t[rn].get('hoverUUID')||'');null!==c&&t[Jo].elements[c]&&t[ln].trigger('mouseLeaveElement',{uuid:t[rn].get('hoverUUID'),index:c,element:t[Jo].elements[c]})}a&&(t[ln].trigger('mouseOverElement',{uuid:a.uuid,index:u,element:a}),t[rn].set('hoverUUID',a.uuid),r=!0)}}if(!0!==r&&null!==t[rn].get('hoverUUID')){var u,h=t[rn].get('hoverUUID');null!==(u=t[nn].getElementIndexByUUID(h||''))&&t[ln].trigger('mouseLeaveElement',{uuid:h,index:u,element:t[Jo].elements[u]}),t[rn].set('hoverUUID',null)}t[ln].has('mouseOverScreen')&&t[ln].trigger('mouseOverScreen',e)}}(t),32)),t[$o].on('leave',pn.throttle(function(t){return function(){t[ln].has('mouseLeaveScreen')&&t[ln].trigger('mouseLeaveScreen',void 0)}}(t),32)),t[$o].on('point',pn.throttle(function(t){return function(e){var o,n=t[on].isPointInElement(e,t[Jo]),r=n[0],i=n[1];r>=0&&i&&t[ln].trigger('screenClickElement',{index:r,uuid:i,element:vn(null===(o=t[Jo].elements)||void 0===o?void 0:o[r])}),t[sn]()}}(t),16)),t[$o].on('doubleClick',function(t){return function(e){var o,n,r,i=t[on].isPointInElement(e,t[Jo]),s=i[0],l=i[1];if(s>=0&&l){var a=vn(null===(o=t[Jo].elements)||void 0===o?void 0:o[s]);!0!==(null===(n=null==a?void 0:a.operation)||void 0===n?void 0:n.invisible)&&t[ln].trigger('screenDoubleClickElement',{index:s,uuid:l,element:vn(null===(r=t[Jo].elements)||void 0===r?void 0:r[s])})}t[sn]()}}(t)),!0!==t[rn].get('onlyRender')&&(t[$o].on('point',function(t){return function(e){var o,n,r;if(t[an].isEffectivePoint(e)){if(t[nn].isPointInElementList(e,t[Jo]))t[rn].set('mode',Bo.SELECT_ELEMENT_LIST);else{var i=t[nn].isPointInElementWrapperController(e,t[Jo]),s=i.uuid,l=i.selectedControllerDirection;if(s&&l)t[rn].set('mode',Bo.SELECT_ELEMENT_WRAPPER_CONTROLLER),t[rn].set('selectedControllerDirection',l),t[rn].set('selectedUUID',s);else{var a=t[on].isPointInElement(e,t[Jo]),c=a[0],u=a[1];c>=0&&!0!==(null===(n=null===(o=t[Jo].elements[c])||void 0===o?void 0:o.operation)||void 0===n?void 0:n.invisible)?(t.selectElementByIndex(c,{useMode:!0}),'string'==typeof u&&t[ln].has('screenSelectElement')&&(t[ln].trigger('screenSelectElement',{index:c,uuid:u,element:vn(null===(r=t[Jo].elements)||void 0===r?void 0:r[c])}),t[cn]()),t[rn].set('mode',Bo.SELECT_ELEMENT)):(t[rn].set('selectedUUIDList',[]),t[rn].set('selectedUUID',null),t[rn].set('mode',Bo.SELECT_AREA))}}t[sn]()}}}(t)),t[$o].on('moveStart',function(t){return function(e){t[rn].set('prevPoint',e);var o=t[rn].get('selectedUUID');t[rn].get('mode')===Bo.SELECT_ELEMENT_LIST||(t[rn].get('mode')===Bo.SELECT_ELEMENT?'string'==typeof o&&t[ln].has('screenMoveElementStart')&&t[ln].trigger('screenMoveElementStart',{index:t[on].getElementIndex(t[Jo],o),uuid:o,x:e.x,y:e.y}):t[rn].get('mode')===Bo.SELECT_AREA&&t[nn].startSelectArea(e))}}(t)),t[$o].on('move',pn.throttle(function(t){return function(e){t[rn].get('mode')===Bo.SELECT_ELEMENT_LIST?(yn(t,t[rn].get('selectedUUIDList'),e,t[rn].get('prevPoint')),t[sn](),t[rn].set('cursorStatus',jo.DRAGGING)):'string'==typeof t[rn].get('selectedUUID')?t[rn].get('mode')===Bo.SELECT_ELEMENT?(yn(t,[t[rn].get('selectedUUID')],e,t[rn].get('prevPoint')),t[sn](),t[rn].set('cursorStatus',jo.DRAGGING)):t[rn].get('mode')===Bo.SELECT_ELEMENT_WRAPPER_CONTROLLER&&t[rn].get('selectedControllerDirection')&&(!function(t,e,o,n,r){if(!n)return null;var i=t[on].transformElement(t[Jo],e,o,n,t[$o].getContext().getTransform().scale,r);t[sn]()}(t,t[rn].get('selectedUUID'),e,t[rn].get('prevPoint'),t[rn].get('selectedControllerDirection')),t[rn].set('cursorStatus',jo.DRAGGING)):t[rn].get('mode')===Bo.SELECT_AREA&&(t[nn].changeSelectArea(e),t[sn]()),t[rn].set('prevPoint',e)}}(t),16)),t[$o].on('moveEnd',function(t){return function(e){var o=t[rn].get('selectedUUID');if('string'==typeof o){var n=t[on].getElementIndex(t[Jo],o),r=t[Jo].elements[n];r&&(t[ln].has('screenMoveElementEnd')&&t[ln].trigger('screenMoveElementEnd',{index:n,uuid:o,x:e.x,y:e.y}),t[ln].has('screenChangeElement')&&t[ln].trigger('screenChangeElement',{index:n,uuid:o,width:r.w,height:r.h,angle:r.angle||0}),t[un]())}else if(t[rn].get('mode')===Bo.SELECT_AREA){var i=t[nn].calcSelectedElements(t[Jo]);i.length>0?(t[rn].set('selectedUUIDList',i),t[rn].set('selectedUUID',null)):t[rn].set('mode',Bo.NULL),t[nn].clearSelectedArea(),t[sn]()}t[rn].get('mode')!==Bo.SELECT_ELEMENT&&t[rn].set('selectedUUID',null),t[rn].set('cursorStatus',jo.NULL),t[rn].set('mode',Bo.NULL)}}(t)),t[en].on('drawFrame',(function(){t[ln].trigger('drawFrame',void 0)})),t[en].on('drawFrameComplete',(function(){t[ln].trigger('drawFrameComplete',void 0)})),t[rn].set('hasInited',!0)))}function yn(t,e,o,n){n&&(e.forEach((function(e){var r,i,s=t[nn].getElementIndexByUUID(e);if(null!==s){var l=t[Jo].elements[s];!0!==(null===(r=null==l?void 0:l.operation)||void 0===r?void 0:r.lock)&&!0!==(null===(i=null==l?void 0:l.operation)||void 0===i?void 0:i.invisible)&&t[on].dragElement(t[Jo],e,o,n,t[$o].getContext().getTransform().scale)}})),t[sn]())}var mn=Et.data.deepClone,_n=function(){function t(t,r,i){var s,l,a,c=this;this[o]=new ho,this[n]=new Zo,this[Jo]={elements:[]},this[Ko]=r,this[rn].set('onlyRender',!0===r.onlyRender),this[tn]=function(t){var o=Et.data.deepClone(uo);return t&&t.elementWrapper&&(o.elementWrapper=e(e({},o.elementWrapper),t.elementWrapper)),o}(i||{}),this[$o]=new it(t,e(e({},this[Ko]),{canScroll:null===(s=null==i?void 0:i.scrollWrapper)||void 0===s?void 0:s.use,scrollConfig:{color:(null===(l=null==i?void 0:i.scrollWrapper)||void 0===l?void 0:l.color)||'#a0a0a0',lineWidth:(null===(a=null==i?void 0:i.scrollWrapper)||void 0===a?void 0:a.lineWidth)||12}})),this[en]=new ke;var u=function(){var t=c[$o].getHelperContext(),e=c[nn].getConfig();c[$o].clear();var o=c[Ko],n=o.contextWidth,r=o.contextHeight,i=o.devicePixelRatio;t.clearRect(0,0,n*i,r*i),io(t,e),so(t,e),lo(t,e),c[$o].draw()};this[en].on('drawFrame',(function(t){u()})),this[en].on('drawFrameComplete',(function(t){u()})),this[on]=new wo(this[$o].getContext()),this[nn]=new Lo(this[$o],this[tn]),this[an]=new No({board:this[$o],helper:this[nn],element:this[on]}),gn(this)}var o,n;return t.prototype[(o=ln,n=rn,sn)]=function(t){var e,o,n=this[$o].getTransform();this[nn].updateConfig(this[Jo],{width:this[Ko].width,height:this[Ko].height,canScroll:!0===(null===(o=null===(e=this[tn])||void 0===e?void 0:e.scrollWrapper)||void 0===o?void 0:o.use),selectedUUID:this[rn].get('selectedUUID'),selectedUUIDList:this[rn].get('selectedUUIDList'),devicePixelRatio:this[Ko].devicePixelRatio,scale:n.scale,scrollX:n.scrollX,scrollY:n.scrollY}),this[en].thaw(),this[en].render(this[$o].getContext(),this[Jo],{changeResourceUUIDs:(null==t?void 0:t.resourceChangeUUIDs)||[]})},t.prototype.getElement=function(t){return function(t,e){var o=null,n=t[nn].getElementIndexByUUID(e);return null!==n&&t[Jo].elements[n]&&(o=fn(t[Jo].elements[n])),o}(this,t)},t.prototype.getElementByIndex=function(t){return function(t,e){var o=null;return e>=0&&t[Jo].elements[e]&&(o=fn(t[Jo].elements[e])),o}(this,t)},t.prototype.selectElementByIndex=function(t,e){return function(t,e,o){if(!0!==t[rn].get('onlyRender')&&t[Jo].elements[e]){var n=t[Jo].elements[e].uuid;!0===(null==o?void 0:o.useMode)?t[rn].set('mode',Bo.SELECT_ELEMENT):t[rn].set('mode',Bo.NULL),'string'==typeof n&&(t[rn].set('selectedUUID',n),t[rn].set('selectedUUIDList',[])),t[sn]()}}(this,t,e)},t.prototype.selectElement=function(t,e){return function(t,e,o){if(!0!==t[rn].get('onlyRender')){var n=t[nn].getElementIndexByUUID(e);'number'==typeof n&&n>=0&&t.selectElementByIndex(n,o)}}(this,t,e)},t.prototype.moveUpElement=function(t){return function(t,e){var o=t[nn].getElementIndexByUUID(e);if('number'==typeof o&&o>=0&&o<t[Jo].elements.length-1){var n=t[Jo].elements[o];t[Jo].elements[o]=t[Jo].elements[o+1],t[Jo].elements[o+1]=n}t[un](),t[sn]()}(this,t)},t.prototype.moveDownElement=function(t){return function(t,e){var o=t[nn].getElementIndexByUUID(e);if('number'==typeof o&&o>0&&o<t[Jo].elements.length){var n=t[Jo].elements[o];t[Jo].elements[o]=t[Jo].elements[o-1],t[Jo].elements[o-1]=n}t[un](),t[sn]()}(this,t)},t.prototype.updateElement=function(t){return function(t,e){for(var o,n=fn(e),r=t[Jo],i=[],s=0;s<r.elements.length;s++)if(n.uuid===(null===(o=r.elements[s])||void 0===o?void 0:o.uuid)){var l=go(r.elements[s],n);'string'==typeof l&&i.push(l),r.elements[s]=n;break}t[un](),t[sn]({resourceChangeUUIDs:i})}(this,t)},t.prototype.addElement=function(t){return function(t,e){var o=fn(e);return o.uuid=dn(),t[Jo].elements.push(o),t[un](),t[sn](),o.uuid}(this,t)},t.prototype.deleteElement=function(t){return function(t,e){var o=t[on].getElementIndex(t[Jo],e);o>=0&&(t[Jo].elements.splice(o,1),t[un](),t[sn]())}(this,t)},t.prototype.insertElementBefore=function(t,e){return function(t,e,o){var n=t[nn].getElementIndexByUUID(o);return null!==n?t.insertElementBeforeIndex(e,n):null}(this,t,e)},t.prototype.insertElementBeforeIndex=function(t,e){return function(t,e,o){var n=fn(e);return n.uuid=dn(),o>=0?(t[Jo].elements.splice(o,0,n),t[un](),t[sn](),n.uuid):null}(this,t,e)},t.prototype.getSelectedElements=function(){return e=[],o=[],'string'==typeof(n=(t=this)[rn].get('selectedUUID'))&&n?o.push(n):o=t[rn].get('selectedUUIDList'),o.forEach((function(o){var n,r=t[nn].getElementIndexByUUID(o);if(null!==r&&r>=0){var i=null===(n=t[Jo])||void 0===n?void 0:n.elements[r];i&&e.push(i)}})),fn(e);var t,e,o,n},t.prototype.insertElementAfter=function(t,e){return function(t,e,o){var n=t[nn].getElementIndexByUUID(o);return null!==n?t.insertElementAfterIndex(e,n):null}(this,t,e)},t.prototype.insertElementAfterIndex=function(t,e){return function(t,e,o){var n=fn(e);return n.uuid=dn(),o>=0?(t[Jo].elements.splice(o+1,0,n),t[un](),t[sn](),n.uuid):null}(this,t,e)},t.prototype.resetSize=function(t){this[Ko]=e(e({},this[Ko]),t),this[$o].resetSize(t),this[sn]()},t.prototype.scale=function(t){var e=this[$o].scale(t);return this[sn](),this[cn](),e},t.prototype.scrollLeft=function(t){var e=this[$o].scrollX(0-t);return this[sn](),this[cn](),e},t.prototype.scrollTop=function(t){var e=this[$o].scrollY(0-t);return this[sn](),this[cn](),e},t.prototype.getScreenTransform=function(){var t=this[$o].getTransform();return{scale:t.scale,scrollTop:Math.max(0,0-t.scrollY),scrollLeft:Math.max(0,0-t.scrollX)}},t.prototype.getData=function(){return mn(this[Jo])},t.prototype.setData=function(t,e){var o=function(t,e){var o,n=[],r=yo(t),i=yo(e);for(var s in i)if(!0===['image','svg','html'].includes(null===(o=i[s])||void 0===o?void 0:o.type))if(r[s]){var l=!1;switch(r[s].type){case'image':l=fo(r[s],i[s]);break;case'svg':l=po(r[s],i[s]);break;case'html':l=vo(r[s],i[s])}!0===l&&n.push(s)}else n.push(s);return n}(this[Jo],t);this[Jo]=this[on].initData(mn(Yo(t))),e&&!0===e.triggerChangeEvent&&this[un](),this[sn]({resourceChangeUUIDs:o})},t.prototype.clearOperation=function(){this[rn].clear(),this[rn].set('onlyRender',!0===this[Ko].onlyRender),this[sn]()},t.prototype.on=function(t,e){this[ln].on(t,e)},t.prototype.off=function(t,e){this[ln].off(t,e)},t.prototype.pointScreenToContext=function(t){return this[$o].pointScreenToContext(t)},t.prototype.pointContextToScreen=function(t){return this[$o].pointContextToScreen(t)},t.prototype.setOnlyRender=function(){this[rn].set('onlyRender',!0)},t.prototype.cancelOnlyRender=function(){this[rn].set('onlyRender',!1)},t.prototype.__getBoardContext=function(){return this[$o].getContext()},t.prototype.__getDisplayContext2D=function(){return this[$o].getDisplayContext2D()},t.prototype.__getOriginContext2D=function(){return this[$o].getOriginContext2D()},t.prototype[cn]=function(){this[ln].has('changeScreen')&&this[ln].trigger('changeScreen',e({},this.getScreenTransform()))},t.prototype[un]=function(){this[ln].has('changeData')&&this[ln].trigger('changeData',mn(this[Jo]))},t.prototype[hn]=function(){console.log(this[an])},t.is=Ye,t.check=He,t}();return _n}();
1
+ var iDrawCore=function(){'use strict';var t=function(){return t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)},e=function(){return e=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function n(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function o(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var i={type:function(t,e){var n=o(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===o(t)},json:function(t){return'Object'===o(t)},function:function(t){return'Function'===o(t)},asyncFunction:function(t){return'AsyncFunction'===o(t)},string:function(t){return'String'===o(t)},number:function(t){return'Number'===o(t)},undefined:function(t){return'Undefined'===o(t)},null:function(t){return'Null'===o(t)},promise:function(t){return'Promise'===o(t)}},r=function(){return r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function s(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function l(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function a(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function c(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var h=window.Image;function u(t){return new Promise((function(e,n){var o=new h;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var f=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=r(r({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=r(r({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function d(t){return'number'==typeof t&&(t>0||t<=0)}function p(t){return'number'==typeof t&&t>=0}function v(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function g(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var m={x:function(t){return d(t)},y:function(t){return d(t)},w:p,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:d,borderWidth:function(t){return p(t)},borderRadius:function(t){return d(t)&&t>=0},color:function(t){return n(t)},imageSrc:function(t){return g(t)||v(t)},imageURL:v,imageBase64:g,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return d(t)&&t>0},lineHeight:function(t){return d(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return d(t)&&t>0}};function y(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!m.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!m.number(n))&&!(t.hasOwnProperty('borderWidth')&&!m.number(o)))}var _={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(m.x(e)&&m.y(n)&&m.w(o)&&m.h(i)&&m.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!m.text(e)&&(!!m.color(n)&&(!!m.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!m.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!m.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!m.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!m.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!m.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!m.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!m.color(h))&&!!y(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!m.color(e))&&!!y(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!m.color(e))&&(!(t.hasOwnProperty('borderColor')&&!m.color(n))&&!(t.hasOwnProperty('borderWidth')&&!m.number(o)))},imageDesc:function(t){var e=t.src;return!!m.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!m.svg(e)},htmlDesc:function(t){var e=t.html;return!!m.html(e)}},S={is:m,check:_,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:u,loadSVG:function(t){return s(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,c(t)];case 1:return[4,u(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return s(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,a(t,e)];case 1:return[4,u(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:n},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:i,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:f},x=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var b=function(){function t(){this._temp={prevClickPoint:null,isHoverCanvas:!1,isDragCanvas:!1,statusMap:{canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}}}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp={prevClickPoint:null,isHoverCanvas:!1,isDragCanvas:!1,statusMap:{canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}}},t}(),w=function(){function t(t,e){this._isMoving=!1,this._temp=new b,this._container=window,this._canvas=t,this._isMoving=!1,this._initEvent(),this._event=new x}return t.prototype.setStatusMap=function(t){this._temp.set('statusMap',t)},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype._initEvent=function(){var t=this._canvas,e=this._container;e.addEventListener('mousemove',this._listenWindowMove.bind(this),!1),e.addEventListener('mouseup',this._listenWindowMoveEnd.bind(this),!1),t.addEventListener('mousemove',this._listenHover.bind(this),!1),t.addEventListener('mousedown',this._listenMoveStart.bind(this),!1),t.addEventListener('mousemove',this._listenMove.bind(this),!1),t.addEventListener('mouseup',this._listenMoveEnd.bind(this),!1),t.addEventListener('click',this._listenCanvasClick.bind(this),!1),t.addEventListener('wheel',this._listenCanvasWheel.bind(this),!1),t.addEventListener('mousedown',this._listenCanvasMoveStart.bind(this),!0),t.addEventListener('mouseup',this._listenCanvasMoveEnd.bind(this),!0),t.addEventListener('mouseover',this._listenCanvasMoveOver.bind(this),!0),t.addEventListener('mouseleave',this._listenCanvasMoveLeave.bind(this),!0),this._initParentEvent()},t.prototype._initParentEvent=function(){for(var t=window,e=t.origin;t.self!==t.top&&(t.self!==t.parent&&t.origin===e&&t.parent.window.addEventListener('mousemove',this._listSameOriginParentWindow.bind(this),!1),t=t.parent););},t.prototype._listenHover=function(t){t.preventDefault();var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.has('hover')&&this._event.trigger('hover',e),this._isMoving=!0},t.prototype._listenMoveStart=function(t){t.preventDefault();var e=this._getPosition(t);this._isVaildPoint(e)&&(this._event.has('point')&&this._event.trigger('point',e),this._event.has('moveStart')&&this._event.trigger('moveStart',e)),this._isMoving=!0},t.prototype._listenMove=function(t){if(t.preventDefault(),t.stopPropagation(),this._event.has('move')&&!0===this._isMoving){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('move',e)}},t.prototype._listenMoveEnd=function(t){if(t.preventDefault(),this._event.has('moveEnd')){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('moveEnd',e)}this._isMoving=!1},t.prototype._listSameOriginParentWindow=function(){this._temp.get('isHoverCanvas')&&this._event.has('leave')&&this._event.trigger('leave',void 0),this._temp.get('isDragCanvas')&&this._event.has('moveEnd')&&this._event.trigger('moveEnd',{x:NaN,y:NaN}),this._isMoving=!1,this._temp.set('isDragCanvas',!1),this._temp.set('isHoverCanvas',!1)},t.prototype._listenCanvasMoveStart=function(){this._temp.get('isHoverCanvas')&&this._temp.set('isDragCanvas',!0)},t.prototype._listenCanvasMoveEnd=function(){this._temp.set('isDragCanvas',!1)},t.prototype._listenCanvasMoveOver=function(){this._temp.set('isHoverCanvas',!0)},t.prototype._listenCanvasMoveLeave=function(){this._temp.set('isHoverCanvas',!1),this._event.has('leave')&&this._event.trigger('leave',void 0)},t.prototype._listenWindowMove=function(t){if(!0===this._temp.get('isDragCanvas')&&(t.preventDefault(),t.stopPropagation(),this._event.has('move')&&!0===this._isMoving)){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('move',e)}},t.prototype._listenWindowMoveEnd=function(t){if(!0!=!this._temp.get('isDragCanvas')){if(t.preventDefault(),this._event.has('moveEnd')){var e=this._getPosition(t);this._isVaildPoint(e)&&this._event.trigger('moveEnd',e)}this._temp.set('isDragCanvas',!1),this._isMoving=!1}},t.prototype._listenCanvasWheel=function(t){this._event.has('wheelX')&&(t.deltaX>0||t.deltaX<0)&&this._event.trigger('wheelX',t.deltaX),this._event.has('wheelY')&&(t.deltaY>0||t.deltaY<0)&&this._event.trigger('wheelY',t.deltaY);var e=this._temp.get('statusMap'),n=e.canScrollYNext,o=e.canScrollYPrev;(t.deltaX>0&&t.deltaX<0||t.deltaY>0&&!0===n||t.deltaY<0&&!0===o)&&t.preventDefault()},t.prototype._listenCanvasClick=function(t){t.preventDefault();var e=this._getPosition(t),n=Date.now();if(this._isVaildPoint(e)){var o=this._temp.get('prevClickPoint');o&&n-o.t<=500&&Math.abs(o.x-e.x)<=5&&Math.abs(o.y-e.y)<=5?this._event.has('doubleClick')&&this._event.trigger('doubleClick',{x:e.x,y:e.y}):this._temp.set('prevClickPoint',{x:e.x,y:e.y,t:n})}},t.prototype._getPosition=function(t){var e=this._canvas,n=0,o=0;if(t&&t.touches&&t.touches.length>0){var i=t.touches[0];i&&(n=i.clientX,o=i.clientY)}else n=t.clientX,o=t.clientY;return{x:n-e.getBoundingClientRect().left,y:o-e.getBoundingClientRect().top,t:Date.now()}},t.prototype._isVaildPoint=function(t){return E(t.x)&&E(t.y)},t}();function E(t){return t>0||t<0||0===t}var P={lineWidth:12,color:'#a0a0a0'},C=function(){function t(t,e){this._displayCtx=t,this._opts=this._getOpts(e)}return t.prototype.draw=function(t){var e=this._opts,n=e.width,o=e.height,i=this.calc(t),r=this._displayCtx;i.xSize>0&&(r.globalAlpha=.2,r.fillStyle=i.color,r.fillRect(0,this._doSize(o-i.lineSize),this._doSize(n),this._doSize(i.lineSize)),r.globalAlpha=1,z(r,{x:this._doSize(i.translateX),y:this._doSize(o-i.lineSize),w:this._doSize(i.xSize),h:this._doSize(i.lineSize),r:this._doSize(i.lineSize/2),color:i.color})),i.ySize>0&&(r.globalAlpha=.2,r.fillStyle=i.color,r.fillRect(this._doSize(n-i.lineSize),0,this._doSize(i.lineSize),this._doSize(o)),r.globalAlpha=1,z(r,{x:this._doSize(n-i.lineSize),y:this._doSize(i.translateY),w:this._doSize(i.lineSize),h:this._doSize(i.ySize),r:this._doSize(i.lineSize/2),color:i.color})),r.globalAlpha=1},t.prototype.resetSize=function(t){this._opts=e(e({},this._opts),t)},t.prototype.isPointAtScrollY=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=this._displayCtx;return r.beginPath(),r.rect(this._doSize(n-i.lineWidth),0,this._doSize(i.lineWidth),this._doSize(o)),r.closePath(),!!r.isPointInPath(this._doSize(t.x),this._doSize(t.y))},t.prototype.isPointAtScrollX=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=this._displayCtx;return r.beginPath(),r.rect(0,this._doSize(o-i.lineWidth),this._doSize(n-i.lineWidth),this._doSize(i.lineWidth)),r.closePath(),!!r.isPointInPath(this._doSize(t.x),this._doSize(t.y))},t.prototype.getLineWidth=function(){return this._opts.scrollConfig.lineWidth},t.prototype.calc=function(t){var e=this._opts,n=e.width,o=e.height,i=e.scrollConfig,r=2.5*i.lineWidth,s=i.lineWidth,l=0,a=0;t.left<=0&&t.right<=0&&(l=Math.max(r,n-(Math.abs(t.left)+Math.abs(t.right))))>=n&&(l=0),(t.top<=0||t.bottom<=0)&&(a=Math.max(r,o-(Math.abs(t.top)+Math.abs(t.bottom))))>=o&&(a=0);var c=0;l>0&&(c=l/2+(n-l)*Math.abs(t.left)/(Math.abs(t.left)+Math.abs(t.right)),c=Math.min(Math.max(0,c-l/2),n-l));var h=0;return a>0&&(h=a/2+(o-a)*Math.abs(t.top)/(Math.abs(t.top)+Math.abs(t.bottom)),h=Math.min(Math.max(0,h-a/2),o-a)),{lineSize:s,xSize:l,ySize:a,translateY:h,translateX:c,color:this._opts.scrollConfig.color}},t.prototype._doSize=function(t){return t*this._opts.devicePixelRatio},t.prototype._getOpts=function(t){var n=e({scrollConfig:P},t);return n.scrollConfig||(n.scrollConfig=P),n.scrollConfig.lineWidth>0||(n.scrollConfig.lineWidth=P.lineWidth),n.scrollConfig.lineWidth=Math.max(n.scrollConfig.lineWidth,P.lineWidth),!0!==S.color.isColorStr(n.scrollConfig.color)&&(n.scrollConfig.color=n.scrollConfig.color),n},t}();function z(t,e){var n=e.x,o=e.y,i=e.w,r=e.h,s=e.color,l=e.r;(i<2*(l=Math.min(l,i/2,r/2))||r<2*l)&&(l=0),t.beginPath(),t.moveTo(n+l,o),t.arcTo(n+i,o,n+i,o+r,l),t.arcTo(n+i,o+r,n,o+r,l),t.arcTo(n,o+r,n,o,l),t.arcTo(n,o,n+i,o,l),t.closePath(),t.fillStyle=s,t.fill()}var D,L=Symbol('_opts'),T=Symbol('_ctx'),M=function(){function t(t,e){this[L]=e,this[T]=t}return t.prototype.resetSize=function(t){this[L]=e(e({},this[L]),t)},t.prototype.calcScreen=function(){var t=this[T].getTransform().scale,e=this[L],n=e.width,o=e.height,i=e.contextWidth,r=e.contextHeight,s=e.devicePixelRatio,l=!0,a=!0,c=!0,h=!0;i*t<=n&&(this[T].setTransform({scrollX:(n-i*t)/2}),l=!1,a=!1),r*t<=o&&(this[T].setTransform({scrollY:(o-r*t)/2}),c=!1,h=!1),i*t>=n&&this[T].getTransform().scrollX>0&&(this[T].setTransform({scrollX:0}),l=!1),r*t>=o&&this[T].getTransform().scrollY>0&&(this[T].setTransform({scrollY:0}),c=!1);var u=this[T].getTransform(),f=u.scrollX,d=u.scrollY;f<0&&Math.abs(f)>Math.abs(i*t-n)&&(this[T].setTransform({scrollX:0-Math.abs(i*t-n)}),a=!1),d<0&&Math.abs(d)>Math.abs(r*t-o)&&(this[T].setTransform({scrollY:0-Math.abs(r*t-o)}),h=!1);var p=this[T].getTransform(),v=p.scrollX,g=p.scrollY;return{size:{x:v*t,y:g*t,w:i*t,h:r*t},position:{top:g,bottom:o-(r*t+g),left:v,right:n-(i*t+v)},deviceSize:{x:v*s,y:g*s,w:i*s*t,h:r*s*t},width:this[L].width,height:this[L].height,devicePixelRatio:this[L].devicePixelRatio,canScrollYPrev:c,canScrollYNext:h,canScrollXPrev:l,canScrollXNext:a}},t.prototype.calcScreenScroll=function(t,e,n,o,i){var r=o-n;t<=0&&e<=0&&(r=Math.abs(t)+Math.abs(e));var s=1;return r>0&&(s=r/(o-n)),0-s*i},t}(),k=Symbol('_canvas'),I=Symbol('_displayCanvas'),W=Symbol('_helperCanvas'),O=Symbol('_mount'),U=Symbol('_opts'),R=Symbol('_hasRendered'),A=Symbol('_ctx'),F=Symbol('_helperCtx'),Y=Symbol('_watcher'),X=Symbol('_render'),N=Symbol('_parsePrivateOptions'),H=Symbol('_scroller'),B=Symbol('_initEvent'),j=Symbol('_doScrollX'),G=Symbol('_doScrollY'),Q=Symbol('_doMoveScroll'),V=Symbol('_resetContext'),$=Symbol('_screen'),Z=S.Context,q=S.time.throttle,J=function(){function t(t,e){this[D]=!1,this[O]=t,this[k]=document.createElement('canvas'),this[W]=document.createElement('canvas'),this[I]=document.createElement('canvas'),this[O].appendChild(this[I]),this[U]=this[N](e);var n=this[k].getContext('2d'),o=this[I].getContext('2d'),i=this[W].getContext('2d');this[A]=new Z(n,this[U]),this[F]=new Z(i,this[U]),this[$]=new M(this[A],this[U]),this[Y]=new w(this[I],this[A]),this[H]=new C(o,{width:e.width,height:e.height,devicePixelRatio:e.devicePixelRatio||1,scrollConfig:e.scrollConfig}),this[X]()}return t.prototype.getDisplayContext2D=function(){return this[I].getContext('2d')},t.prototype.getOriginContext2D=function(){return this[A].getContext()},t.prototype.getHelperContext2D=function(){return this[F].getContext()},t.prototype.getContext=function(){return this[A]},t.prototype.getHelperContext=function(){return this[F]},t.prototype.scale=function(t){t>0&&(this[A].setTransform({scale:t}),this[F].setTransform({scale:t}));var e=this[$].calcScreen();return{position:e.position,size:e.size}},t.prototype.scrollX=function(t){this[Y].setStatusMap({canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}),(t>=0||t<0)&&(this[A].setTransform({scrollX:t}),this[F].setTransform({scrollX:t}));var e=this[$].calcScreen(),n=e.position,o=e.size,i=e.canScrollXNext,r=e.canScrollYNext,s=e.canScrollXPrev,l=e.canScrollYPrev;return this[Y].setStatusMap({canScrollYPrev:l,canScrollYNext:r,canScrollXPrev:s,canScrollXNext:i}),{position:n,size:o}},t.prototype.scrollY=function(t){this[Y].setStatusMap({canScrollYPrev:!0,canScrollYNext:!0,canScrollXPrev:!0,canScrollXNext:!0}),(t>=0||t<0)&&(this[A].setTransform({scrollY:t}),this[F].setTransform({scrollY:t}));var e=this[$].calcScreen(),n=e.position,o=e.size,i=e.canScrollXNext,r=e.canScrollYNext,s=e.canScrollXPrev,l=e.canScrollYPrev;return this[Y].setStatusMap({canScrollYPrev:l,canScrollYNext:r,canScrollXPrev:s,canScrollXNext:i}),{position:n,size:o}},t.prototype.getTransform=function(){return this[A].getTransform()},t.prototype.draw=function(){this.clear();var t=this[$].calcScreen(),e=t.position,n=t.deviceSize,o=t.size,i=this[I].getContext('2d');return null==i||i.drawImage(this[k],n.x,n.y,n.w,n.h),null==i||i.drawImage(this[W],n.x,n.y,n.w,n.h),!0===this[U].canScroll&&this[H].draw(e),{position:e,size:o}},t.prototype.clear=function(){var t=this[I].getContext('2d');null==t||t.clearRect(0,0,this[I].width,this[I].height)},t.prototype.on=function(t,e){this[Y].on(t,e)},t.prototype.off=function(t,e){this[Y].off(t,e)},t.prototype.getScreenInfo=function(){return this[$].calcScreen()},t.prototype.setCursor=function(t){this[I].style.cursor=t},t.prototype.resetCursor=function(){this[I].style.cursor='auto'},t.prototype.resetSize=function(t){this[U]=e(e({},this[U]),t),this[V](),this[A].resetSize(t),this[F].resetSize(t),this[$].resetSize(t),this[H].resetSize({width:this[U].width,height:this[U].height,devicePixelRatio:this[U].devicePixelRatio}),this.draw()},t.prototype.getScrollLineWidth=function(){var t=0;return!0===this[U].canScroll&&(t=this[H].getLineWidth()),t},t.prototype.pointScreenToContext=function(t){var e=this.getTransform(),n=e.scrollX,o=e.scrollY,i=e.scale;return{x:(t.x-n)/i,y:(t.y-o)/i}},t.prototype.pointContextToScreen=function(t){var e=this.getTransform(),n=e.scrollX,o=e.scrollY,i=e.scale;return{x:t.x*i+n,y:t.y*i+o}},t.prototype[(D=R,X)]=function(){!0!==this[R]&&(this[V](),this[B](),this[R]=!0)},t.prototype[V]=function(){var t,n,o,i,r,s,l=this[U],a=l.width,c=l.height,h=l.contextWidth,u=l.contextHeight,f=l.devicePixelRatio;this[k].width=h*f,this[k].height=u*f,this[W].width=h*f,this[W].height=u*f,this[I].width=a*f,this[I].height=c*f,t=this[I],n={width:a+"px",height:c+"px"},o=function(t){var e={};return(t.getAttribute('style')||'').split(';').forEach((function(t){var n=t.split(':');n[0]&&'string'==typeof n[0]&&(e[n[0]]=n[1]||'')})),e}(t),i=e(e({},o),n),r=Object.keys(i),s='',r.forEach((function(t){s+=t+":"+(i[t]||'')+";"})),t.setAttribute('style',s)},t.prototype[N]=function(t){return e(e({},{devicePixelRatio:1}),t)},t.prototype[B]=function(){var t=this;if(!0!==this[R]&&!0===this[U].canScroll){this.on('wheelX',q((function(e){t[j](e)}),16)),this.on('wheelY',q((function(e){t[G](e)}),16));var e=null;this.on('moveStart',q((function(n){t[H].isPointAtScrollX(n)?e='x':t[H].isPointAtScrollY(n)&&(e='y')}),16)),this.on('move',q((function(n){e&&t[Q](e,n)}),16)),this.on('moveEnd',q((function(n){e&&t[Q](e,n),e=null}),16))}},t.prototype[j]=function(t,e){var n=this[U].width,o=e;'number'==typeof o&&(o>0||o<=0)||(o=this[A].getTransform().scrollX);var i=this[$].calcScreen().position,r=this[H].calc(i).xSize,s=this[$].calcScreenScroll(i.left,i.right,r,n,t);this.scrollX(o+s),this.draw()},t.prototype[G]=function(t,e){var n=this[U].height,o=e;'number'==typeof o&&(o>0||o<=0)||(o=this[A].getTransform().scrollY);var i=this[$].calcScreen().position,r=this[H].calc(i).ySize,s=this[$].calcScreenScroll(i.top,i.bottom,r,n,t);this.scrollY(o+s),this.draw()},t.prototype[Q]=function(t,e){if(t){var n=this[$].calcScreen().position,o=this[H].calc(n),i=o.xSize,r=o.ySize;'x'===t?this[j](e.x-i/2,0):'y'===t&&this[G](e.y-r/2,0)}},t}();function K(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function tt(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var et={type:function(t,e){var n=tt(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===tt(t)},json:function(t){return'Object'===tt(t)},function:function(t){return'Function'===tt(t)},asyncFunction:function(t){return'AsyncFunction'===tt(t)},string:function(t){return'String'===tt(t)},number:function(t){return'Number'===tt(t)},undefined:function(t){return'Undefined'===tt(t)},null:function(t){return'Null'===tt(t)},promise:function(t){return'Promise'===tt(t)}},nt=function(){return nt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},nt.apply(this,arguments)};function ot(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function it(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function rt(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function st(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var lt=window.Image;function at(t){return new Promise((function(e,n){var o=new lt;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var ct=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=nt(nt({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=nt(nt({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function ht(t){return'number'==typeof t&&(t>0||t<=0)}function ut(t){return'number'==typeof t&&t>=0}function ft(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function dt(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var pt={x:function(t){return ht(t)},y:function(t){return ht(t)},w:ut,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:ht,borderWidth:function(t){return ut(t)},borderRadius:function(t){return ht(t)&&t>=0},color:function(t){return K(t)},imageSrc:function(t){return dt(t)||ft(t)},imageURL:ft,imageBase64:dt,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return ht(t)&&t>0},lineHeight:function(t){return ht(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return ht(t)&&t>0}};function vt(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!pt.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!pt.number(n))&&!(t.hasOwnProperty('borderWidth')&&!pt.number(o)))}var gt={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(pt.x(e)&&pt.y(n)&&pt.w(o)&&pt.h(i)&&pt.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!pt.text(e)&&(!!pt.color(n)&&(!!pt.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!pt.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!pt.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!pt.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!pt.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!pt.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!pt.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!pt.color(h))&&!!vt(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!pt.color(e))&&!!vt(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!pt.color(e))&&(!(t.hasOwnProperty('borderColor')&&!pt.color(n))&&!(t.hasOwnProperty('borderWidth')&&!pt.number(o)))},imageDesc:function(t){var e=t.src;return!!pt.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!pt.svg(e)},htmlDesc:function(t){var e=t.html;return!!pt.html(e)}},mt={is:pt,check:gt,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:at,loadSVG:function(t){return ot(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,st(t)];case 1:return[4,at(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return ot(this,void 0,void 0,(function(){return it(this,(function(n){switch(n.label){case 0:return[4,rt(t,e)];case 1:return[4,at(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:K},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:et,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:ct},yt=function(t,e){return yt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},yt(t,e)};var _t=function(){return _t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},_t.apply(this,arguments)};function St(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function xt(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function bt(t){return'string'==typeof t&&/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)}function wt(t){return(Object.prototype.toString.call(t)||'').replace(/(\[object|\])/gi,'').trim()}var Et={type:function(t,e){var n=wt(t);return!0===e?n.toLocaleLowerCase():n},array:function(t){return'Array'===wt(t)},json:function(t){return'Object'===wt(t)},function:function(t){return'Function'===wt(t)},asyncFunction:function(t){return'AsyncFunction'===wt(t)},string:function(t){return'String'===wt(t)},number:function(t){return'Number'===wt(t)},undefined:function(t){return'Undefined'===wt(t)},null:function(t){return'Null'===wt(t)},promise:function(t){return'Promise'===wt(t)}},Pt=function(){return Pt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Pt.apply(this,arguments)};function Ct(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{a(o.next(t))}catch(t){r(t)}}function l(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}a((o=o.apply(t,e||[])).next())}))}function zt(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}function Dt(t,e){var n=e.width,o=e.height;return new Promise((function(e,i){var r=new Blob(["\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\""+(n||'')+"\" height = \""+(o||'')+"\">\n <foreignObject width=\"100%\" height=\"100%\">\n <div xmlns = \"http://www.w3.org/1999/xhtml\">\n "+t+"\n </div>\n </foreignObject>\n </svg>\n "],{type:'image/svg+xml;charset=utf-8'}),s=new FileReader;s.readAsDataURL(r),s.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},s.onerror=function(t){i(t)}}))}function Lt(t){return new Promise((function(e,n){var o=new Blob([t],{type:'image/svg+xml;charset=utf-8'}),i=new FileReader;i.readAsDataURL(o),i.onload=function(t){var n,o=null===(n=null==t?void 0:t.target)||void 0===n?void 0:n.result;e(o)},i.onerror=function(t){n(t)}}))}var Tt=window.Image;function Mt(t){return new Promise((function(e,n){var o=new Tt;o.onload=function(){e(o)},o.onabort=n,o.onerror=n,o.src=t}))}var kt=function(){function t(t,e){this._opts=e,this._ctx=t,this._transform={scale:1,scrollX:0,scrollY:0}}return t.prototype.getContext=function(){return this._ctx},t.prototype.resetSize=function(t){this._opts=Pt(Pt({},this._opts),t)},t.prototype.calcDeviceNum=function(t){return t*this._opts.devicePixelRatio},t.prototype.calcScreenNum=function(t){return t/this._opts.devicePixelRatio},t.prototype.getSize=function(){return{width:this._opts.width,height:this._opts.height,contextWidth:this._opts.contextWidth,contextHeight:this._opts.contextHeight,devicePixelRatio:this._opts.devicePixelRatio}},t.prototype.setTransform=function(t){this._transform=Pt(Pt({},this._transform),t)},t.prototype.getTransform=function(){return{scale:this._transform.scale,scrollX:this._transform.scrollX,scrollY:this._transform.scrollY}},t.prototype.setFillStyle=function(t){this._ctx.fillStyle=t},t.prototype.fill=function(t){return this._ctx.fill(t||'nonzero')},t.prototype.arc=function(t,e,n,o,i,r){return this._ctx.arc(this._doSize(t),this._doSize(e),this._doSize(n),o,i,r)},t.prototype.rect=function(t,e,n,o){return this._ctx.rect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.fillRect=function(t,e,n,o){return this._ctx.fillRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.clearRect=function(t,e,n,o){return this._ctx.clearRect(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o))},t.prototype.beginPath=function(){return this._ctx.beginPath()},t.prototype.closePath=function(){return this._ctx.closePath()},t.prototype.lineTo=function(t,e){return this._ctx.lineTo(this._doSize(t),this._doSize(e))},t.prototype.moveTo=function(t,e){return this._ctx.moveTo(this._doSize(t),this._doSize(e))},t.prototype.arcTo=function(t,e,n,o,i){return this._ctx.arcTo(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),this._doSize(i))},t.prototype.setLineWidth=function(t){return this._ctx.lineWidth=this._doSize(t)},t.prototype.setLineDash=function(t){var e=this;return this._ctx.setLineDash(t.map((function(t){return e._doSize(t)})))},t.prototype.isPointInPath=function(t,e){return this._ctx.isPointInPath(this._doX(t),this._doY(e))},t.prototype.isPointInPathWithoutScroll=function(t,e){return this._ctx.isPointInPath(this._doSize(t),this._doSize(e))},t.prototype.setStrokeStyle=function(t){this._ctx.strokeStyle=t},t.prototype.stroke=function(){return this._ctx.stroke()},t.prototype.translate=function(t,e){return this._ctx.translate(this._doSize(t),this._doSize(e))},t.prototype.rotate=function(t){return this._ctx.rotate(t)},t.prototype.drawImage=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],o=t[1],i=t[2],r=t[3],s=t[4],l=t[t.length-4],a=t[t.length-3],c=t[t.length-2],h=t[t.length-1];return 9===t.length?this._ctx.drawImage(n,this._doSize(o),this._doSize(i),this._doSize(r),this._doSize(s),this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h)):this._ctx.drawImage(n,this._doSize(l),this._doSize(a),this._doSize(c),this._doSize(h))},t.prototype.createPattern=function(t,e){return this._ctx.createPattern(t,e)},t.prototype.measureText=function(t){return this._ctx.measureText(t)},t.prototype.setTextAlign=function(t){this._ctx.textAlign=t},t.prototype.fillText=function(t,e,n,o){return void 0!==o?this._ctx.fillText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.fillText(t,this._doSize(e),this._doSize(n))},t.prototype.strokeText=function(t,e,n,o){return void 0!==o?this._ctx.strokeText(t,this._doSize(e),this._doSize(n),this._doSize(o)):this._ctx.strokeText(t,this._doSize(e),this._doSize(n))},t.prototype.setFont=function(t){var e=[];'bold'===t.fontWeight&&e.push(""+t.fontWeight),e.push(this._doSize(t.fontSize||12)+"px"),e.push(""+(t.fontFamily||'sans-serif')),this._ctx.font=""+e.join(' ')},t.prototype.setTextBaseline=function(t){this._ctx.textBaseline=t},t.prototype.setGlobalAlpha=function(t){this._ctx.globalAlpha=t},t.prototype.save=function(){this._ctx.save()},t.prototype.restore=function(){this._ctx.restore()},t.prototype.scale=function(t,e){this._ctx.scale(t,e)},t.prototype.setShadowColor=function(t){this._ctx.shadowColor=t},t.prototype.setShadowOffsetX=function(t){this._ctx.shadowOffsetX=this._doSize(t)},t.prototype.setShadowOffsetY=function(t){this._ctx.shadowOffsetY=this._doSize(t)},t.prototype.setShadowBlur=function(t){this._ctx.shadowBlur=this._doSize(t)},t.prototype.ellipse=function(t,e,n,o,i,r,s,l){this._ctx.ellipse(this._doSize(t),this._doSize(e),this._doSize(n),this._doSize(o),i,r,s,l)},t.prototype._doSize=function(t){return this._opts.devicePixelRatio*t},t.prototype._doX=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollX)/n;return this._doSize(o)},t.prototype._doY=function(t){var e=this._transform,n=e.scale,o=(t-e.scrollY)/n;return this._doSize(o)},t}();function It(t){return'number'==typeof t&&(t>0||t<=0)}function Wt(t){return'number'==typeof t&&t>=0}function Ot(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function Ut(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var Rt={x:function(t){return It(t)},y:function(t){return It(t)},w:Wt,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:It,borderWidth:function(t){return Wt(t)},borderRadius:function(t){return It(t)&&t>=0},color:function(t){return bt(t)},imageSrc:function(t){return Ut(t)||Ot(t)},imageURL:Ot,imageBase64:Ut,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return It(t)&&t>0},lineHeight:function(t){return It(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return It(t)&&t>0}};function At(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!Rt.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!Rt.number(n))&&!(t.hasOwnProperty('borderWidth')&&!Rt.number(o)))}var Ft={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(Rt.x(e)&&Rt.y(n)&&Rt.w(o)&&Rt.h(i)&&Rt.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!Rt.text(e)&&(!!Rt.color(n)&&(!!Rt.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!Rt.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!Rt.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!Rt.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!Rt.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!Rt.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!Rt.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!Rt.color(h))&&!!At(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!Rt.color(e))&&!!At(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!Rt.color(e))&&(!(t.hasOwnProperty('borderColor')&&!Rt.color(n))&&!(t.hasOwnProperty('borderWidth')&&!Rt.number(o)))},imageDesc:function(t){var e=t.src;return!!Rt.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!Rt.svg(e)},htmlDesc:function(t){var e=t.html;return!!Rt.html(e)}},Yt={is:Rt,check:Ft,time:{delay:function(t){return new Promise((function(e){setTimeout((function(){e()}),t)}))},compose:function(t){return function(e,n){return function o(i){var r=t[i];i===t.length&&n&&(r=n);if(!r)return Promise.resolve();try{return Promise.resolve(r(e,o.bind(null,i+1)))}catch(t){return Promise.reject(t)}}(0)}},throttle:function(t,e){var n=-1;return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];n>0||(n=setTimeout((function(){t.apply(void 0,o),n=-1}),e))}}},loader:{loadImage:Mt,loadSVG:function(t){return Ct(this,void 0,void 0,(function(){return zt(this,(function(e){switch(e.label){case 0:return[4,Lt(t)];case 1:return[4,Mt(e.sent())];case 2:return[2,e.sent()]}}))}))},loadHTML:function(t,e){return Ct(this,void 0,void 0,(function(){return zt(this,(function(n){switch(n.label){case 0:return[4,Dt(t,e)];case 1:return[4,Mt(n.sent())];case 2:return[2,n.sent()]}}))}))}},file:{downloadImageFromCanvas:function(t,e){var n=e.filename,o=e.type,i=void 0===o?'image/jpeg':o,r=t.toDataURL(i),s=document.createElement('a');s.href=r,s.download=n;var l=document.createEvent('MouseEvents');l.initEvent('click',!0,!1),s.dispatchEvent(l)}},color:{toColorHexStr:function(t){return'#'+t.toString(16)},toColorHexNum:function(t){return parseInt(t.replace(/^\#/,'0x'))},isColorStr:bt},uuid:{createUUID:function(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},istype:Et,data:{deepClone:function(t){return function t(e){var n,o=(n=e,Object.prototype.toString.call(n).replace(/[\]|\[]{1,1}/gi,'').split(' ')[1]);if(['Null','Number','String','Boolean','Undefined'].indexOf(o)>=0)return e;if('Array'===o){var i=[];return e.forEach((function(e){i.push(t(e))})),i}if('Object'===o){var r={};return Object.keys(e).forEach((function(n){r[n]=t(e[n])})),r}}(t)}},Context:kt};function Xt(t,e,n){var o=function(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}(e),i=function(t){return t/180*Math.PI}(e.angle||0);return function(t,e,n,o){e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(n),t.translate(-e.x,-e.y));o(t),e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(-n),t.translate(-e.x,-e.y))}(t,o,i||0,n)}var Nt=Yt.is,Ht=Yt.istype,Bt=Yt.color;function jt(t){t.setFillStyle('#000000'),t.setStrokeStyle('#000000'),t.setLineDash([]),t.setGlobalAlpha(1),t.setShadowColor('#00000000'),t.setShadowOffsetX(0),t.setShadowOffsetY(0),t.setShadowBlur(0)}function Gt(t,e,n){jt(t),function(t,e){jt(t),Xt(t,e,(function(){if(e.desc.borderWidth&&e.desc.borderWidth>0){var n=e.desc.borderWidth,o='#000000';!0===Bt.isColorStr(e.desc.borderColor)&&(o=e.desc.borderColor);var i=e.x-n/2,r=e.y-n/2,s=e.w+n,l=e.h+n,a=e.desc.borderRadius||0;(a=Math.min(a,s/2,l/2))<s/2&&a<l/2&&(a+=n/2);var c=e.desc;void 0!==c.shadowColor&&Bt.isColorStr(c.shadowColor)&&t.setShadowColor(c.shadowColor),void 0!==c.shadowOffsetX&&Nt.number(c.shadowOffsetX)&&t.setShadowOffsetX(c.shadowOffsetX),void 0!==c.shadowOffsetY&&Nt.number(c.shadowOffsetY)&&t.setShadowOffsetY(c.shadowOffsetY),void 0!==c.shadowBlur&&Nt.number(c.shadowBlur)&&t.setShadowBlur(c.shadowBlur),t.beginPath(),t.setLineWidth(n),t.setStrokeStyle(o),t.moveTo(i+a,r),t.arcTo(i+s,r,i+s,r+l,a),t.arcTo(i+s,r+l,i,r+l,a),t.arcTo(i,r+l,i,r,a),t.arcTo(i,r,i+s,r,a),t.closePath(),t.stroke()}}))}(t,e),jt(t),Xt(t,e,(function(){var o=e.x,i=e.y,r=e.w,s=e.h,l=e.desc.borderRadius||0;(r<2*(l=Math.min(l,r/2,s/2))||s<2*l)&&(l=0),t.beginPath(),t.moveTo(o+l,i),t.arcTo(o+r,i,o+r,i+s,l),t.arcTo(o+r,i+s,o,i+s,l),t.arcTo(o,i+s,o,i,l),t.arcTo(o,i,o+r,i,l),t.closePath(),('string'==typeof n||['CanvasPattern'].includes(Ht.type(n)))&&t.setFillStyle(n),t.fill()}))}function Qt(t,e){Gt(t,e,e.desc.bgColor)}function Vt(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}function $t(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}function Zt(t,e,n){var o=n.getContent(e.uuid);Xt(t,e,(function(){o&&t.drawImage(o,e.x,e.y,e.w,e.h)}))}var qt=Yt.is,Jt=Yt.color;function Kt(t,e,n){jt(t),Gt(t,e,e.desc.bgColor||'transparent'),Xt(t,e,(function(){var n=_t({fontSize:12,fontFamily:'sans-serif',textAlign:'center'},e.desc);t.setFillStyle(e.desc.color),t.setTextBaseline('top'),t.setFont({fontWeight:n.fontWeight,fontSize:n.fontSize,fontFamily:n.fontFamily});var o=n.text.replace(/\r\n/gi,'\n'),i=n.lineHeight||n.fontSize,r=o.split('\n'),s=[];r.forEach((function(n){for(var o='',r=0,l=0;l<n.length&&(t.measureText(o+(n[l]||'')).width<t.calcDeviceNum(e.w)?o+=n[l]||'':(s.push({text:o,width:t.calcScreenNum(t.measureText(o).width)}),o=n[l]||'',r++),!((r+1)*i>e.h));l++)if(o&&n.length-1===l&&(r+1)*i<e.h){s.push({text:o,width:t.calcScreenNum(t.measureText(o).width)});break}}));var l=e.y;if(s.length*i<e.h&&(l+=(e.h-s.length*i)/2),void 0!==n.textShadowColor&&Jt.isColorStr(n.textShadowColor)&&t.setShadowColor(n.textShadowColor),void 0!==n.textShadowOffsetX&&qt.number(n.textShadowOffsetX)&&t.setShadowOffsetX(n.textShadowOffsetX),void 0!==n.textShadowOffsetY&&qt.number(n.textShadowOffsetY)&&t.setShadowOffsetY(n.textShadowOffsetY),void 0!==n.textShadowBlur&&qt.number(n.textShadowBlur)&&t.setShadowBlur(n.textShadowBlur),s.forEach((function(o,r){var s=e.x;'center'===n.textAlign?s=e.x+(e.w-o.width)/2:'right'===n.textAlign&&(s=e.x+(e.w-o.width)),t.fillText(o.text,s,l+i*r)})),jt(t),Jt.isColorStr(n.strokeColor)&&void 0!==n.strokeWidth&&n.strokeWidth>0){var a=e.y;s.length*i<e.h&&(a+=(e.h-s.length*i)/2),s.forEach((function(o,r){var s=e.x;'center'===n.textAlign?s=e.x+(e.w-o.width)/2:'right'===n.textAlign&&(s=e.x+(e.w-o.width)),void 0!==n.strokeColor&&t.setStrokeStyle(n.strokeColor),void 0!==n.strokeWidth&&n.strokeWidth>0&&t.setLineWidth(n.strokeWidth),t.strokeText(o.text,s,a+i*r)}))}}))}function te(t,e){jt(t),Xt(t,e,(function(t){var n=e.x,o=e.y,i=e.w,r=e.h,s=e.desc,l=s.bgColor,a=void 0===l?'#000000':l,c=s.borderColor,h=void 0===c?'#000000':c,u=s.borderWidth,f=void 0===u?0:u,d=i/2,p=r/2,v=n+d,g=o+p;if(f&&f>0){var m=f/2+d,y=f/2+p;t.beginPath(),t.setStrokeStyle(h),t.setLineWidth(f),t.ellipse(v,g,m,y,0,0,2*Math.PI),t.closePath(),t.stroke()}t.beginPath(),t.setFillStyle(a),t.ellipse(v,g,d,p,0,0,2*Math.PI),t.closePath(),t.fill()}))}var ee=Yt.color.isColorStr;function ne(t,e,n){var o;jt(t);var i=t.getSize();if(t.clearRect(0,0,i.contextWidth,i.contextHeight),'string'==typeof e.bgColor&&ee(e.bgColor)&&function(t,e){var n=t.getSize();t.setFillStyle(e),t.fillRect(0,0,n.contextWidth,n.contextHeight)}(t,e.bgColor),e.elements.length>0)for(var r=0;r<e.elements.length;r++){var s=e.elements[r];if(!0!==(null===(o=null==s?void 0:s.operation)||void 0===o?void 0:o.invisible))switch(s.type){case'rect':Qt(t,s);break;case'text':Kt(t,s);break;case'image':Vt(t,s,n);break;case'svg':$t(t,s,n);break;case'html':Zt(t,s,n);break;case'circle':te(t,s)}}}var oe=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();var ie,re=Yt.loader,se=re.loadImage,le=re.loadSVG,ae=re.loadHTML,ce=Yt.data.deepClone;!function(t){t.FREE="free",t.LOADING="loading",t.COMPLETE="complete"}(ie||(ie={}));var he,ue,fe,de,pe=function(){function t(t){this._currentLoadData={},this._currentUUIDQueue=[],this._storageLoadData={},this._status=ie.FREE,this._waitingLoadQueue=[],this._opts=t,this._event=new oe,this._waitingLoadQueue=[]}return t.prototype.load=function(t,e){var n=this._resetLoadData(t,e),o=n[0],i=n[1];this._status===ie.FREE||this._status===ie.COMPLETE?(this._currentUUIDQueue=o,this._currentLoadData=i,this._loadTask()):this._status===ie.LOADING&&o.length>0&&this._waitingLoadQueue.push({uuidQueue:o,loadData:i})},t.prototype.on=function(t,e){this._event.on(t,e)},t.prototype.off=function(t,e){this._event.off(t,e)},t.prototype.isComplete=function(){return this._status===ie.COMPLETE},t.prototype.getContent=function(t){var e;return'loaded'===(null===(e=this._storageLoadData[t])||void 0===e?void 0:e.status)?this._storageLoadData[t].content:null},t.prototype._resetLoadData=function(t,e){for(var n={},o=[],i=this._storageLoadData,r=t.elements.length-1;r>=0;r--){var s=t.elements[r];['image','svg','html'].includes(s.type)&&(i[s.uuid]?e.includes(s.uuid)&&(n[s.uuid]=this._createEmptyLoadItem(s),o.push(s.uuid)):(n[s.uuid]=this._createEmptyLoadItem(s),o.push(s.uuid)))}return[o,n]},t.prototype._createEmptyLoadItem=function(t){var e='',n=t.type,o=t.w,i=t.h;if('image'===t.type)e=(r=t).desc.src||'';else if('svg'===t.type){e=(r=t).desc.svg||''}else if('html'===t.type){var r;e=function(t){return t.replace(/<script[\s\S]*?<\/script>/gi,'')}((r=t).desc.html||''),o=r.desc.width||t.w,i=r.desc.height||t.h}return{uuid:t.uuid,type:n,status:'null',content:null,source:e,elemW:o,elemH:i,element:ce(t)}},t.prototype._loadTask=function(){var t=this;if(this._status!==ie.LOADING){if(this._status=ie.LOADING,0===this._currentUUIDQueue.length){if(0===this._waitingLoadQueue.length)return this._status=ie.COMPLETE,void this._event.trigger('complete',void 0);var e=this._waitingLoadQueue.shift();if(e){var n=e.uuidQueue,o=e.loadData;this._currentLoadData=o,this._currentUUIDQueue=n}}var i=this._opts.maxParallelNum,r=this._currentUUIDQueue.splice(0,i),s={};r.forEach((function(t,e){s[t]=e}));var l=[],a=function(){if(l.length>=i)return!1;if(0===r.length)return!0;for(var e=function(e){var n=r.shift();if(void 0===n)return"break";l.push(n),t._loadElementSource(t._currentLoadData[n]).then((function(e){var o,i;l.splice(l.indexOf(n),1);var s=a();t._storageLoadData[n]={uuid:n,type:t._currentLoadData[n].type,status:'loaded',content:e,source:t._currentLoadData[n].source,elemW:t._currentLoadData[n].elemW,elemH:t._currentLoadData[n].elemH,element:t._currentLoadData[n].element},0===l.length&&0===r.length&&!0===s&&(t._status=ie.FREE,t._loadTask()),t._event.trigger('load',{uuid:null===(o=t._storageLoadData[n])||void 0===o?void 0:o.uuid,type:t._storageLoadData[n].type,status:t._storageLoadData[n].status,content:t._storageLoadData[n].content,source:t._storageLoadData[n].source,elemW:t._storageLoadData[n].elemW,elemH:t._storageLoadData[n].elemH,element:null===(i=t._storageLoadData[n])||void 0===i?void 0:i.element})})).catch((function(e){var o,i,s,c,h,u,f,d,p,v,g,m;console.warn(e),l.splice(l.indexOf(n),1);var y=a();t._currentLoadData[n]&&(t._storageLoadData[n]={uuid:n,type:null===(o=t._currentLoadData[n])||void 0===o?void 0:o.type,status:'fail',content:null,error:e,source:null===(i=t._currentLoadData[n])||void 0===i?void 0:i.source,elemW:null===(s=t._currentLoadData[n])||void 0===s?void 0:s.elemW,elemH:null===(c=t._currentLoadData[n])||void 0===c?void 0:c.elemH,element:null===(h=t._currentLoadData[n])||void 0===h?void 0:h.element}),0===l.length&&0===r.length&&!0===y&&(t._status=ie.FREE,t._loadTask()),t._currentLoadData[n]&&t._event.trigger('error',{uuid:n,type:null===(u=t._storageLoadData[n])||void 0===u?void 0:u.type,status:null===(f=t._storageLoadData[n])||void 0===f?void 0:f.status,content:null===(d=t._storageLoadData[n])||void 0===d?void 0:d.content,source:null===(p=t._storageLoadData[n])||void 0===p?void 0:p.source,elemW:null===(v=t._storageLoadData[n])||void 0===v?void 0:v.elemW,elemH:null===(g=t._storageLoadData[n])||void 0===g?void 0:g.elemH,element:null===(m=t._storageLoadData[n])||void 0===m?void 0:m.element})}))},n=l.length;n<i;n++){if("break"===e())break}return!1};a()}},t.prototype._loadElementSource=function(t){return St(this,void 0,void 0,(function(){return xt(this,(function(e){switch(e.label){case 0:return t&&'image'===t.type?[4,se(t.source)]:[3,2];case 1:case 3:case 5:return[2,e.sent()];case 2:return t&&'svg'===t.type?[4,le(t.source)]:[3,4];case 4:return t&&'html'===t.type?[4,ae(t.source,{width:t.elemW,height:t.elemH})]:[3,6];case 6:throw Error('Element\'s source is not support!')}}))}))},t}(),ve=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}(),ge=Symbol('_queue'),me=Symbol('_ctx'),ye=Symbol('_status'),_e=Symbol('_loader'),Se=Symbol('_opts'),xe=Symbol('_freeze'),be=Symbol('_drawFrame'),we=Symbol('_retainQueueOneItem'),Ee=window.requestAnimationFrame,Pe=Yt.uuid.createUUID,Ce=Yt.data.deepClone,ze=Yt.Context;!function(t){t.NULL="null",t.FREE="free",t.DRAWING="drawing",t.FREEZE="freeze"}(de||(de={}));var De=function(t){function e(e){var n=t.call(this)||this;return n[he]=[],n[ue]=null,n[fe]=de.NULL,n[Se]=e,n[_e]=new pe({maxParallelNum:6}),n[_e].on('load',(function(t){n[be](),n.trigger('load',{element:t.element})})),n[_e].on('error',(function(t){n.trigger('error',{element:t.element,error:t.error})})),n[_e].on('complete',(function(){n.trigger('loadComplete',{t:Date.now()})})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}yt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.render=function(t,e,n){var o=(n||{}).changeResourceUUIDs,i=void 0===o?[]:o;this[ye]=de.FREE;var r=Ce(e);if(Array.isArray(r.elements)&&r.elements.forEach((function(t){'string'==typeof t.uuid&&t.uuid||(t.uuid=Pe())})),!this[me])if(this[Se]&&'[object HTMLCanvasElement]'===Object.prototype.toString.call(t)){var s=this[Se],l=s.width,a=s.height,c=s.contextWidth,h=s.contextHeight,u=s.devicePixelRatio,f=t;f.width=l*u,f.height=a*u;var d=f.getContext('2d');this[me]=new ze(d,{width:l,height:a,contextWidth:c||l,contextHeight:h||a,devicePixelRatio:u})}else t&&(this[me]=t);if(![de.FREEZE].includes(this[ye])){var p=Ce({data:r});this[ge].push(p),this[be](),this[_e].load(r,i||[])}},e.prototype.getContext=function(){return this[me]},e.prototype.thaw=function(){this[ye]=de.FREE},e.prototype[(he=ge,ue=me,fe=ye,xe)]=function(){this[ye]=de.FREEZE},e.prototype[be]=function(){var t=this;this[ye]!==de.FREEZE&&Ee((function(){if(t[ye]!==de.FREEZE){var e=t[me],n=t[ge][0],o=!1;t[ge].length>1?n=t[ge].shift():o=!0,!0!==t[_e].isComplete()?(t[be](),n&&e&&ne(e,n.data,t[_e])):n&&e?(ne(e,n.data,t[_e]),t[we](),o?t[ye]=de.FREE:t[be]()):t[ye]=de.FREE,t.trigger('drawFrame',{t:Date.now()}),!0===t[_e].isComplete()&&1===t[ge].length&&t[ye]===de.FREE&&(e&&t[ge][0]&&t[ge][0].data&&ne(e,t[ge][0].data,t[_e]),t.trigger('drawFrameComplete',{t:Date.now()}),t[xe]())}}))},e.prototype[we]=function(){if(!(this[ge].length<=1)){var t=Ce(this[ge][this[ge].length-1]);this[ge]=[t]}},e}(ve),Le=mt.color.isColorStr;function Te(t){return'number'==typeof t&&(t>0||t<=0)}function Me(t){return'number'==typeof t&&t>=0}function ke(t){return'string'==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(""+t)}function Ie(t){return'string'==typeof t&&/^(data:image\/)/.test(""+t)}var We={x:function(t){return Te(t)},y:function(t){return Te(t)},w:Me,h:function(t){return'number'==typeof t&&t>=0},angle:function(t){return'number'==typeof t&&t>=-360&&t<=360},number:Te,borderWidth:function(t){return Me(t)},borderRadius:function(t){return Te(t)&&t>=0},color:function(t){return Le(t)},imageSrc:function(t){return Ie(t)||ke(t)},imageURL:ke,imageBase64:Ie,svg:function(t){return'string'==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test((""+t).trim())&&/<\/[\s]{0,}svg>$/i.test((""+t).trim())},html:function(t){var e=!1;if('string'==typeof t){var n=document.createElement('div');n.innerHTML=t,n.children.length>0&&(e=!0),n=null}return e},text:function(t){return'string'==typeof t},fontSize:function(t){return Te(t)&&t>0},lineHeight:function(t){return Te(t)&&t>0},textAlign:function(t){return['center','left','right'].includes(t)},fontFamily:function(t){return'string'==typeof t&&t.length>0},fontWeight:function(t){return['bold'].includes(t)},strokeWidth:function(t){return Te(t)&&t>0}};function Oe(t){void 0===t&&(t={});var e=t.borderColor,n=t.borderRadius,o=t.borderWidth;return!(t.hasOwnProperty('borderColor')&&!We.color(e))&&(!(t.hasOwnProperty('borderRadius')&&!We.number(n))&&!(t.hasOwnProperty('borderWidth')&&!We.number(o)))}var Ue={attrs:function(t){var e=t.x,n=t.y,o=t.w,i=t.h,r=t.angle;return!!(We.x(e)&&We.y(n)&&We.w(o)&&We.h(i)&&We.angle(r))&&(r>=-360&&r<=360)},textDesc:function(t){var e=t.text,n=t.color,o=t.fontSize,i=t.lineHeight,r=t.fontFamily,s=t.textAlign,l=t.fontWeight,a=t.bgColor,c=t.strokeWidth,h=t.strokeColor;return!!We.text(e)&&(!!We.color(n)&&(!!We.fontSize(o)&&(!(t.hasOwnProperty('bgColor')&&!We.color(a))&&(!(t.hasOwnProperty('fontWeight')&&!We.fontWeight(l))&&(!(t.hasOwnProperty('lineHeight')&&!We.lineHeight(i))&&(!(t.hasOwnProperty('fontFamily')&&!We.fontFamily(r))&&(!(t.hasOwnProperty('textAlign')&&!We.textAlign(s))&&(!(t.hasOwnProperty('strokeWidth')&&!We.strokeWidth(c))&&(!(t.hasOwnProperty('strokeColor')&&!We.color(h))&&!!Oe(t))))))))))},rectDesc:function(t){var e=t.bgColor;return!(t.hasOwnProperty('bgColor')&&!We.color(e))&&!!Oe(t)},circleDesc:function(t){var e=t.bgColor,n=t.borderColor,o=t.borderWidth;return!(t.hasOwnProperty('bgColor')&&!We.color(e))&&(!(t.hasOwnProperty('borderColor')&&!We.color(n))&&!(t.hasOwnProperty('borderWidth')&&!We.number(o)))},imageDesc:function(t){var e=t.src;return!!We.imageSrc(e)},svgDesc:function(t){var e=t.svg;return!!We.svg(e)},htmlDesc:function(t){var e=t.html;return!!We.html(e)}};function Re(t){return t/180*Math.PI}function Ae(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function Fe(t,e){var n=e.x-t.x,o=t.y-e.y;if(0===n){if(o<0)return Math.PI/2;if(o>0)return 1.5*Math.PI}else if(0===o){if(n<0)return Math.PI;if(n>0)return 0}return n>0&&o<0?Math.atan(Math.abs(o)/Math.abs(n)):n<0&&o<0?Math.PI-Math.atan(Math.abs(o)/Math.abs(n)):n<0&&o>0?Math.PI+Math.atan(Math.abs(o)/Math.abs(n)):n>0&&o>0?2*Math.PI-Math.atan(Math.abs(o)/Math.abs(n)):null}var Ye={elementWrapper:{color:'#2ab6f1',lockColor:'#aaaaaa',controllerSize:6,lineWidth:1,lineDash:[4,3]}};var Xe=function(){function t(){this._listeners=new Map}return t.prototype.on=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);null==n||n.push(e),this._listeners.set(t,n||[])}else this._listeners.set(t,[e])},t.prototype.off=function(t,e){if(this._listeners.has(t)){var n=this._listeners.get(t);if(Array.isArray(n))for(var o=0;o<(null==n?void 0:n.length);o++)if(n[o]===e){n.splice(o,1);break}this._listeners.set(t,n||[])}},t.prototype.trigger=function(t,e){var n=this._listeners.get(t);return!!Array.isArray(n)&&(n.forEach((function(t){t(e)})),!0)},t.prototype.has=function(t){if(this._listeners.has(t)){var e=this._listeners.get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1},t}();function Ne(t,e){var n,o;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.src)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.src)}function He(t,e){var n,o;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.svg)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.svg)}function Be(t,e){var n,o,i,r,s,l;return(null===(n=null==t?void 0:t.desc)||void 0===n?void 0:n.html)!==(null===(o=null==e?void 0:e.desc)||void 0===o?void 0:o.html)||(null===(i=null==t?void 0:t.desc)||void 0===i?void 0:i.width)!==(null===(r=null==e?void 0:e.desc)||void 0===r?void 0:r.width)||(null===(s=null==t?void 0:t.desc)||void 0===s?void 0:s.height)!==(null===(l=null==e?void 0:e.desc)||void 0===l?void 0:l.height)}function je(t,e){var n=null,o=!1;switch(e.type){case'image':o=Ne(t,e);break;case'svg':o=He(t,e);break;case'html':o=Be(t,e)}return!0===o&&(n=e.uuid),n}function Ge(t){var e={};return t.elements.forEach((function(t){e[t.uuid]=t})),e}function Qe(t,e,n){return Ve(t,Ae(e),Re(e.angle||0)||0,n)}function Ve(t,e,n,o){e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(n),t.translate(-e.x,-e.y)),o(t),e&&(n>0||n<0)&&(t.translate(e.x,e.y),t.rotate(-n),t.translate(-e.x,-e.y))}function $e(t){var e=t.toFixed(2);return parseFloat(e)}function Ze(t){return $e(t%360)}var qe=Object.keys({text:{},rect:{},image:{},svg:{},circle:{},html:{}}),Je=mt.uuid.createUUID,Ke=15,tn=function(){function t(t){this._ctx=t}return t.prototype.initData=function(t){return t.elements.forEach((function(t){t.uuid&&'string'==typeof t.uuid||(t.uuid=Je())})),t},t.prototype.isPointInElement=function(t,e){for(var n,o,i=this._ctx,r=-1,s=null,l=function(l){var a=e.elements[l];if(!0===(null===(n=a.operation)||void 0===n?void 0:n.invisible))return"continue";var c=0;return(null===(o=a.desc)||void 0===o?void 0:o.borderWidth)>0&&(c=a.desc.borderWidth),Qe(i,a,(function(){i.beginPath(),i.moveTo(a.x-c,a.y-c),i.lineTo(a.x+a.w+c,a.y-c),i.lineTo(a.x+a.w+c,a.y+a.h+c),i.lineTo(a.x-c,a.y+a.h+c),i.lineTo(a.x-c,a.y-c),i.closePath(),i.isPointInPath(t.x,t.y)&&(r=l,s=a.uuid)})),r>=0?"break":void 0},a=e.elements.length-1;a>=0;a--){if("break"===l(a))break}return[r,s]},t.prototype.dragElement=function(t,e,n,o,i){var r=this.getElementIndex(t,e);if(t.elements[r]){var s=n.x-o.x,l=n.y-o.y;t.elements[r].x+=s/i,t.elements[r].y+=l/i,this.limitElementAttrs(t.elements[r])}},t.prototype.transformElement=function(t,e,n,o,i,r){var s,l,a=this.getElementIndex(t,e);if(!t.elements[a])return null;if(!0===(null===(l=null===(s=t.elements[a])||void 0===s?void 0:s.operation)||void 0===l?void 0:l.lock))return null;var c=(n.x-o.x)/i,h=(n.y-o.y)/i,u=t.elements[a];if(['top-left','top','top-right','right','bottom-right','bottom','bottom-left','left'].includes(r)){var f=function(t,e,n,o,i){var r={x:t.x,y:t.y,w:t.w,h:t.h};switch(t.angle,o){case'top-left':t.w-e>0&&t.h-n>0&&(r.x+=e,r.y+=n,r.w-=e,r.h-=n);break;case'top':if(0===t.angle||Math.abs(t.angle)<Ke)r.h-n>0&&(r.y+=n,r.h-=n);else if(t.angle>0||t.angle<0){var s=t.angle>0?t.angle:Math.max(0,t.angle+360),l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(s<90){l=0-on(l,n);var h=en(s);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(s<180){l=on(l,e);h=en(s-90);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(s<270){l=on(l,n);h=en(s-180);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(s<360){l=0-on(l,e);h=en(s-270);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}r.h+l>0&&(r.h=r.h+l,r.x=a-r.w/2,r.y=c-r.h/2)}else r.h-n>0&&(r.y+=n,r.h-=n);break;case'top-right':r.h-n>0&&r.w+e>0&&(r.y+=n,r.w+=e,r.h-=n);break;case'right':if(0===t.angle||Math.abs(t.angle)<Ke)t.w+e>0&&(r.w+=e);else if(t.angle>0||t.angle<0){var u=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(u<90){l=on(l,n);h=en(u);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(u<180){l=on(l,n);h=en(u-90);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(u<270){l=on(l,n);h=en(u-180);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h),l=0-l}else if(u<360){l=on(l,e);h=en(u-270);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}r.w+l>0&&(r.w=r.w+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.w+e>0&&(r.w+=e);break;case'bottom-right':t.w+e>0&&t.h+n>0&&(r.w+=e,r.h+=n);break;case'bottom':if(0===t.angle||Math.abs(t.angle)<Ke)t.h+n>0&&(r.h+=n);else if(t.angle>0||t.angle<0){var f=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(f<90){l=on(l,n);h=en(f);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}else if(f<180){l=0-on(l,e);h=en(f-90);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}else if(f<270){l=on(l,e);h=en(f-180);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(f<360){l=on(l,e);h=en(f-270);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}r.h+l>0&&(r.h=r.h+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.h+n>0&&(r.h+=n);break;case'bottom-left':t.w-e>0&&t.h+n>0&&(r.x+=e,r.w-=e,r.h+=n);break;case'left':if(0===t.angle||Math.abs(t.angle)<Ke)t.w-e>0&&(r.x+=e,r.w-=e);else if(t.angle>0||t.angle<0){var d=t.angle>0?t.angle:Math.max(0,t.angle+360);l=nn(e,n),a=r.x+t.w/2,c=r.y+t.h/2;if(d<90){l=0-on(l,e);h=en(d);a-=(p=l/2)*Math.cos(h),c-=p*Math.sin(h)}else if(d<180){l=on(l,e);h=en(d-90);a+=(p=l/2)*Math.sin(h),c-=p*Math.cos(h)}else if(d<270){l=on(l,n);h=en(d-180);a+=(p=l/2)*Math.cos(h),c+=p*Math.sin(h)}else if(d<360){l=on(l,n);var p;h=en(d-270);a-=(p=l/2)*Math.sin(h),c+=p*Math.cos(h)}r.w+l>0&&(r.w=r.w+l,r.x=a-r.w/2,r.y=c-r.h/2)}else t.w-e>0&&(r.x+=e,r.w-=e)}return r}(u,c,h,r);u.x=f.x,u.y=f.y,u.w=f.w,u.h=f.h}else if('rotate'===r){var d=function(t,e,n){var o=Fe(t,e),i=Fe(t,n);return null!==i&&null!==o?o>3*Math.PI/2&&i<Math.PI/2?i+(2*Math.PI-o):i>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-i):i-o:0}(Ae(u),o,n);u.angle=(u.angle||0)+function(t){return t/Math.PI*180}(d)}return this.limitElementAttrs(u),{width:$e(u.w),height:$e(u.h),angle:Ze(u.angle||0)}},t.prototype.getElementIndex=function(t,e){for(var n=-1,o=0;o<t.elements.length;o++)if(t.elements[o].uuid===e){n=o;break}return n},t.prototype.limitElementAttrs=function(t){t.x=$e(t.x),t.y=$e(t.y),t.w=$e(t.w),t.h=$e(t.h),t.angle=Ze(t.angle||0)},t}();function en(t){return t*Math.PI/180}function nn(t,e){return Math.sqrt(t*t+e*e)}function on(t,e){return e>0?Math.abs(t):0-Math.abs(t)}var rn=mt.data.deepClone,sn=function(){function t(t,e){this._areaStart={x:0,y:0},this._areaEnd={x:0,y:0},this._board=t,this._ctx=this._board.getContext(),this._coreConfig=e,this._helperConfig={elementIndexMap:{}}}return t.prototype.updateConfig=function(t,e){this._updateElementIndex(t),this._updateSelectedElementWrapper(t,e),this._updateSelectedElementListWrapper(t,e)},t.prototype.getConfig=function(){return rn(this._helperConfig)},t.prototype.getElementIndexByUUID=function(t){var e=this._helperConfig.elementIndexMap[t];return e>=0?e:null},t.prototype.isPointInElementWrapperController=function(t,e){var n,o,i=this._ctx,r=(null===(o=null===(n=this._helperConfig)||void 0===n?void 0:n.selectedElementWrapper)||void 0===o?void 0:o.uuid)||null,s=null,l=null,a=null;if(!this._helperConfig.selectedElementWrapper)return{uuid:r,selectedControllerDirection:l,directIndex:s,hoverControllerDirection:a};var c=this._helperConfig.selectedElementWrapper,h=[c.controllers.right,c.controllers.topRight,c.controllers.top,c.controllers.topLeft,c.controllers.left,c.controllers.bottomLeft,c.controllers.bottom,c.controllers.bottomRight],u=['right','top-right','top','top-left','left','bottom-left','bottom','bottom-right'],f=mt.data.deepClone(u),d=0;if(e&&r){var p=this.getElementIndexByUUID(r);if(null!==p&&p>=0){var v=e.elements[p].angle;v<0&&(v+=360),v<45?d=0:v<90?d=1:v<135?d=2:v<180?d=3:v<225?d=4:v<270?d=5:v<315&&(d=6)}}if(d>0&&(f=f.slice(-d).concat(f.slice(0,-d))),Ve(i,c.translate,c.radian||0,(function(){for(var e=0;e<h.length;e++){var n=h[e];if(!0!==n.invisible&&(i.beginPath(),i.arc(n.x,n.y,c.controllerSize,0,2*Math.PI),i.closePath(),i.isPointInPath(t.x,t.y)&&(l=u[e],a=f[e]),l)){s=e;break}}})),null===l){var g=c.controllers.rotate;!0!==g.invisible&&Ve(i,c.translate,c.radian||0,(function(){i.beginPath(),i.arc(g.x,g.y,c.controllerSize,0,2*Math.PI),i.closePath(),i.isPointInPath(t.x,t.y)&&(l='rotate',a='rotate')}))}return{uuid:r,selectedControllerDirection:l,hoverControllerDirection:a,directIndex:s}},t.prototype.isPointInElementList=function(t,e){for(var n,o,i,r=this._ctx,s=-1,l=null,a=(null===(n=this._helperConfig)||void 0===n?void 0:n.selectedElementListWrappers)||[],c=function(n){var c=a[n],u=h._helperConfig.elementIndexMap[c.uuid],f=e.elements[u];if(!f)return"continue";if(!0===(null===(o=f.operation)||void 0===o?void 0:o.invisible))return"continue";var d=0;return(null===(i=f.desc)||void 0===i?void 0:i.borderWidth)>0&&(d=f.desc.borderWidth),Qe(r,f,(function(){r.beginPath(),r.moveTo(f.x-d,f.y-d),r.lineTo(f.x+f.w+d,f.y-d),r.lineTo(f.x+f.w+d,f.y+f.h+d),r.lineTo(f.x-d,f.y+f.h+d),r.lineTo(f.x-d,f.y-d),r.closePath(),r.isPointInPath(t.x,t.y)&&(s=n,l=f.uuid)})),s>=0?"break":void 0},h=this,u=0;u<a.length;u++){if("break"===c(u))break}return!!(l&&s>=0)},t.prototype.startSelectArea=function(t){this._areaStart=t,this._areaEnd=t},t.prototype.changeSelectArea=function(t){this._areaEnd=t,this._calcSelectedArea()},t.prototype.clearSelectedArea=function(){this._areaStart={x:0,y:0},this._areaEnd={x:0,y:0},this._calcSelectedArea()},t.prototype.calcSelectedElements=function(t){var e=this._ctx.getTransform(),n=e.scale,o=void 0===n?1:n,i=e.scrollX,r=void 0===i?0:i,s=e.scrollY,l=void 0===s?0:s,a=this._areaStart,c=this._areaEnd,h=(Math.min(a.x,c.x)-r)/o,u=(Math.min(a.y,c.y)-l)/o,f=Math.abs(c.x-a.x)/o,d=Math.abs(c.y-a.y)/o,p=[],v=this._ctx;return v.beginPath(),v.moveTo(h,u),v.lineTo(h+f,u),v.lineTo(h+f,u+d),v.lineTo(h,u+d),v.lineTo(h,u),v.closePath(),t.elements.forEach((function(t){var e;if(!0!==(null===(e=null==t?void 0:t.operation)||void 0===e?void 0:e.invisible)){var n=t.x+t.w/2,o=t.y+t.h/2;v.isPointInPathWithoutScroll(n,o)&&p.push(t.uuid)}})),p},t.prototype._calcSelectedArea=function(){var t=this._areaStart,e=this._areaEnd,n=this._ctx.getTransform(),o=n.scale,i=void 0===o?1:o,r=n.scrollX,s=void 0===r?0:r,l=n.scrollY,a=void 0===l?0:l,c=this._coreConfig.elementWrapper,h=c.lineWidth/i,u=c.lineDash.map((function(t){return t/i}));this._helperConfig.selectedAreaWrapper={x:(Math.min(t.x,e.x)-s)/i,y:(Math.min(t.y,e.y)-a)/i,w:Math.abs(e.x-t.x)/i,h:Math.abs(e.y-t.y)/i,startPoint:{x:t.x,y:t.y},endPoint:{x:e.x,y:e.y},lineWidth:h,lineDash:u,color:c.color}},t.prototype._updateElementIndex=function(t){var e=this;this._helperConfig.elementIndexMap={},t.elements.forEach((function(t,n){e._helperConfig.elementIndexMap[t.uuid]=n}))},t.prototype._updateSelectedElementWrapper=function(t,e){var n,o=e.selectedUUID;if('string'==typeof o&&this._helperConfig.elementIndexMap[o]>=0){var i=this._helperConfig.elementIndexMap[o],r=t.elements[i];if(!0!==(null===(n=null==r?void 0:r.operation)||void 0===n?void 0:n.invisible)){var s=this._createSelectedElementWrapper(r,e);this._helperConfig.selectedElementWrapper=s}}else delete this._helperConfig.selectedElementWrapper},t.prototype._updateSelectedElementListWrapper=function(t,e){var n=this,o=e.selectedUUIDList,i=[];t.elements.forEach((function(t,r){if(null==o?void 0:o.includes(t.uuid)){var s=n._createSelectedElementWrapper(t,e);i.push(s)}})),this._helperConfig.selectedElementListWrappers=i},t.prototype._createSelectedElementWrapper=function(t,e){var n,o,i,r,s,l,a,c,h,u,f,d,p=e.scale,v=this._coreConfig.elementWrapper,g=v.controllerSize/p,m=v.lineWidth/p,y=v.lineDash.map((function(t){return t/p})),_=(null===(n=t.desc)||void 0===n?void 0:n.borderWidth)||0,S=!1;'number'==typeof t.angle&&Math.abs(t.angle)>15&&(S=!0);var x={uuid:t.uuid,controllerSize:g,lock:!0===(null===(o=null==t?void 0:t.operation)||void 0===o?void 0:o.lock),controllers:{topLeft:{x:t.x-g-_,y:t.y-g-_,invisible:S||!0===(null===(i=null==t?void 0:t.operation)||void 0===i?void 0:i.disbaleScale)},top:{x:t.x+t.w/2,y:t.y-g-_,invisible:!0===(null===(r=null==t?void 0:t.operation)||void 0===r?void 0:r.disbaleScale)},topRight:{x:t.x+t.w+g+_,y:t.y-g-_,invisible:S||!0===(null===(s=null==t?void 0:t.operation)||void 0===s?void 0:s.disbaleScale)},right:{x:t.x+t.w+g+_,y:t.y+t.h/2,invisible:!0===(null===(l=null==t?void 0:t.operation)||void 0===l?void 0:l.disbaleScale)},bottomRight:{x:t.x+t.w+g+_,y:t.y+t.h+g+_,invisible:S||!0===(null===(a=null==t?void 0:t.operation)||void 0===a?void 0:a.disbaleScale)},bottom:{x:t.x+t.w/2,y:t.y+t.h+g+_,invisible:!0===(null===(c=null==t?void 0:t.operation)||void 0===c?void 0:c.disbaleScale)},bottomLeft:{x:t.x-g-_,y:t.y+t.h+g+_,invisible:S||!0===(null===(h=null==t?void 0:t.operation)||void 0===h?void 0:h.disbaleScale)},left:{x:t.x-g-_,y:t.y+t.h/2,invisible:!0===(null===(u=null==t?void 0:t.operation)||void 0===u?void 0:u.disbaleScale)},rotate:{x:t.x+t.w/2,y:t.y-g-(2*g+12)-_,invisible:!0===(null===(f=null==t?void 0:t.operation)||void 0===f?void 0:f.disbaleRotate)}},lineWidth:m,lineDash:y,color:!0===(null===(d=null==t?void 0:t.operation)||void 0===d?void 0:d.lock)?v.lockColor:v.color};return'number'==typeof t.angle&&(t.angle>0||t.angle<0)&&(x.radian=Re(t.angle),x.translate=Ae(t)),x},t}(),ln=Symbol('_displayCtx'),an=Symbol('_helper'),cn=Symbol('_element'),hn=Symbol('_opts'),un=function(){function t(t){this[hn]=t,this[ln]=this[hn].board,this[cn]=this[hn].element,this[an]=this[hn].helper}return t.prototype.isEffectivePoint=function(t){var e=this[ln].getScrollLineWidth(),n=this[ln].getScreenInfo();return t.x<=n.width-e&&t.y<=n.height-e},t.prototype.judgePointCursor=function(t,e){var n='auto',o=null;if(!this.isEffectivePoint(t))return{cursor:n,elementUUID:o};var i=this[an].isPointInElementWrapperController(t,e),r=i.uuid,s=i.hoverControllerDirection;if(r&&s){switch(s){case'top-right':n='ne-resize';break;case'top-left':n='nw-resize';break;case'top':n='n-resize';break;case'right':n='e-resize';break;case'bottom-right':n='se-resize';break;case'bottom':n='s-resize';break;case'bottom-left':n='sw-resize';break;case'left':n='w-resize';break;case'rotate':n='grab'}r&&(o=r)}else{var l=this[cn].isPointInElement(t,e),a=l[0],c=l[1];a>=0&&(n='move'),c&&(o=c)}return{cursor:n,elementUUID:o}},t}();function fn(t){var e={elements:[]};return Array.isArray(null==t?void 0:t.elements)&&(null==t||t.elements.forEach((function(t){void 0===t&&(t={}),function(t){if(!(dn(t.x)&&dn(t.y)&&dn(t.w)&&dn(t.h)))return!1;if('string'!=typeof t.type||!qe.includes(t.type))return!1;return!0}(t)&&e.elements.push(t)}))),'string'==typeof t.bgColor&&(e.bgColor=t.bgColor),e}function dn(t){return t>=0||t<0}var pn,vn,gn=function(){function t(){this._temp={hasInited:!1}}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp={hasInited:!1}},t}(),mn=Symbol('_board'),yn=Symbol('_data'),_n=Symbol('_opts'),Sn=Symbol('_config'),xn=Symbol('_renderer'),bn=Symbol('_element'),wn=Symbol('_tempData'),En=Symbol('_draw'),Pn=Symbol('_coreEvent'),Cn=Symbol('_emitChangeScreen'),zn=Symbol('_emitChangeData'),Dn=Symbol('_engine');!function(t){t.NULL="null",t.SELECT_ELEMENT="select-element",t.SELECT_ELEMENT_LIST="select-element-list",t.SELECT_ELEMENT_WRAPPER_CONTROLLER="select-element-wrapper-controller",t.SELECT_AREA="select-area"}(pn||(pn={})),function(t){t.DRAGGING="dragging",t.NULL="null"}(vn||(vn={}));var Ln=mt.data.deepClone,Tn=mt.uuid.createUUID;function Mn(){return{hasInited:!1,mode:pn.NULL,cursorStatus:vn.NULL,selectedUUID:null,selectedUUIDList:[],hoverUUID:null,selectedControllerDirection:null,hoverControllerDirection:null,prevPoint:null}}var kn=function(){function t(){this._temp=Mn()}return t.prototype.set=function(t,e){this._temp[t]=e},t.prototype.get=function(t){return this._temp[t]},t.prototype.clear=function(){this._temp=Mn()},t}(),In=mt.time,Wn=mt.data.deepClone,On=function(){function t(t){this._plugins=[];var e=t.board,n=t.config,o=t.element,i=new sn(e,n);this._opts=t,this.temp=new kn,this.helper=i,this._mapper=new un({board:e,helper:i,element:o})}return t.prototype.addPlugin=function(t){this._plugins.push(t)},t.prototype.getHelperConfig=function(){return this.helper.getConfig()},t.prototype.updateHelperConfig=function(t){var e,n=this._opts,o=n.board,i=n.getDataFeekback,r=n.config,s=i(),l=o.getTransform();this.helper.updateConfig(s,{width:t.width,height:t.height,devicePixelRatio:t.devicePixelRatio,canScroll:!0===(null===(e=null==r?void 0:r.scrollWrapper)||void 0===e?void 0:e.use),selectedUUID:this.temp.get('selectedUUID'),selectedUUIDList:this.temp.get('selectedUUIDList'),scale:l.scale,scrollX:l.scrollX,scrollY:l.scrollY})},t.prototype.init=function(){this._initEvent()},t.prototype._initEvent=function(){if(!0!==this.temp.get('hasInited')){var t=this._opts.board;t.on('hover',In.throttle(this._handleHover.bind(this),32)),t.on('leave',In.throttle(this._handleLeave.bind(this),32)),t.on('point',In.throttle(this._handleClick.bind(this),16)),t.on('doubleClick',this._handleDoubleClick.bind(this)),t.on('point',this._handlePoint.bind(this)),t.on('moveStart',this._handleMoveStart.bind(this)),t.on('move',In.throttle(this._handleMove.bind(this),16)),t.on('moveEnd',this._handleMoveEnd.bind(this))}},t.prototype._handleDoubleClick=function(t){var e,n,o,i=this._opts,r=i.element,s=i.getDataFeekback,l=i.drawFeekback,a=i.coreEvent,c=s(),h=r.isPointInElement(t,c),u=h[0],f=h[1];if(u>=0&&f){var d=Wn(null===(e=c.elements)||void 0===e?void 0:e[u]);!0!==(null===(n=null==d?void 0:d.operation)||void 0===n?void 0:n.invisible)&&a.trigger('screenDoubleClickElement',{index:u,uuid:f,element:Wn(null===(o=c.elements)||void 0===o?void 0:o[u])})}l()},t.prototype._handlePoint=function(t){var e,n,o;if(this._mapper.isEffectivePoint(t)){var i=this._opts,r=i.element,s=i.getDataFeekback,l=i.selectElementByIndex,a=i.coreEvent,c=i.emitChangeScreen,h=i.drawFeekback,u=this.helper,f=s();if(u.isPointInElementList(t,f))this.temp.set('mode',pn.SELECT_ELEMENT_LIST);else{var d=u.isPointInElementWrapperController(t,f),p=d.uuid,v=d.selectedControllerDirection;if(p&&v)this.temp.set('mode',pn.SELECT_ELEMENT_WRAPPER_CONTROLLER),this.temp.set('selectedControllerDirection',v),this.temp.set('selectedUUID',p);else{var g=r.isPointInElement(t,f),m=g[0],y=g[1];m>=0&&!0!==(null===(n=null===(e=f.elements[m])||void 0===e?void 0:e.operation)||void 0===n?void 0:n.invisible)?(l(m,{useMode:!0}),'string'==typeof y&&a.has('screenSelectElement')&&(a.trigger('screenSelectElement',{index:m,uuid:y,element:Wn(null===(o=f.elements)||void 0===o?void 0:o[m])}),c()),this.temp.set('mode',pn.SELECT_ELEMENT)):(this.temp.set('selectedUUIDList',[]),this.temp.set('selectedUUID',null),this.temp.set('mode',pn.SELECT_AREA))}}h()}},t.prototype._handleClick=function(t){var e,n=this._opts,o=n.element,i=n.getDataFeekback,r=n.coreEvent,s=n.drawFeekback,l=i(),a=o.isPointInElement(t,l),c=a[0],h=a[1];c>=0&&h&&r.trigger('screenClickElement',{index:c,uuid:h,element:Wn(null===(e=l.elements)||void 0===e?void 0:e[c])}),s()},t.prototype._handleMoveStart=function(t){var e=this._opts,n=e.element,o=e.getDataFeekback,i=e.coreEvent,r=o(),s=this.helper;this.temp.set('prevPoint',t);var l=this.temp.get('selectedUUID');this.temp.get('mode')===pn.SELECT_ELEMENT_LIST||(this.temp.get('mode')===pn.SELECT_ELEMENT?'string'==typeof l&&i.has('screenMoveElementStart')&&i.trigger('screenMoveElementStart',{index:n.getElementIndex(r,l),uuid:l,x:t.x,y:t.y}):this.temp.get('mode')===pn.SELECT_AREA&&s.startSelectArea(t))},t.prototype._handleMove=function(t){var e=this._opts.drawFeekback,n=this.helper;this.temp.get('mode')===pn.SELECT_ELEMENT_LIST?(this._dragElements(this.temp.get('selectedUUIDList'),t,this.temp.get('prevPoint')),e(),this.temp.set('cursorStatus',vn.DRAGGING)):'string'==typeof this.temp.get('selectedUUID')?this.temp.get('mode')===pn.SELECT_ELEMENT?(this._dragElements([this.temp.get('selectedUUID')],t,this.temp.get('prevPoint')),e(),this.temp.set('cursorStatus',vn.DRAGGING)):this.temp.get('mode')===pn.SELECT_ELEMENT_WRAPPER_CONTROLLER&&this.temp.get('selectedControllerDirection')&&(this._transfromElement(this.temp.get('selectedUUID'),t,this.temp.get('prevPoint'),this.temp.get('selectedControllerDirection')),this.temp.set('cursorStatus',vn.DRAGGING)):this.temp.get('mode')===pn.SELECT_AREA&&(n.changeSelectArea(t),e()),this.temp.set('prevPoint',t)},t.prototype._dragElements=function(t,e,n){if(n){var o=this._opts,i=o.board,r=o.element,s=o.getDataFeekback,l=o.drawFeekback,a=s(),c=this.helper;t.forEach((function(t){var o,s,l=c.getElementIndexByUUID(t);if(null!==l){var h=a.elements[l];!0!==(null===(o=null==h?void 0:h.operation)||void 0===o?void 0:o.lock)&&!0!==(null===(s=null==h?void 0:h.operation)||void 0===s?void 0:s.invisible)&&r.dragElement(a,t,e,n,i.getContext().getTransform().scale)}})),l()}},t.prototype._transfromElement=function(t,e,n,o){if(!n)return null;var i=this._opts,r=i.board,s=i.element,l=i.getDataFeekback,a=i.drawFeekback,c=l(),h=s.transformElement(c,t,e,n,r.getContext().getTransform().scale,o);return a(),h},t.prototype._handleMoveEnd=function(t){var e=this._opts,n=e.element,o=e.getDataFeekback,i=e.coreEvent,r=e.drawFeekback,s=e.emitChangeData,l=o(),a=this.helper,c=this.temp.get('selectedUUID');if('string'==typeof c){var h=n.getElementIndex(l,c),u=l.elements[h];u&&(i.has('screenMoveElementEnd')&&i.trigger('screenMoveElementEnd',{index:h,uuid:c,x:t.x,y:t.y}),i.has('screenChangeElement')&&i.trigger('screenChangeElement',{index:h,uuid:c,width:u.w,height:u.h,angle:u.angle||0}),s())}else if(this.temp.get('mode')===pn.SELECT_AREA){var f=a.calcSelectedElements(l);f.length>0?(this.temp.set('selectedUUIDList',f),this.temp.set('selectedUUID',null)):this.temp.set('mode',pn.NULL),a.clearSelectedArea(),r()}this.temp.get('mode')!==pn.SELECT_ELEMENT&&this.temp.set('selectedUUID',null),this.temp.set('cursorStatus',vn.NULL),this.temp.set('mode',pn.NULL)},t.prototype._handleHover=function(t){var e,n,o=!1,i=this._opts,r=i.board,s=i.getDataFeekback,l=i.coreEvent,a=s(),c=this.helper,h=this._mapper;if(this.temp.get('mode')===pn.SELECT_AREA)r.resetCursor();else if(this.temp.get('cursorStatus')===vn.NULL){var u=h.judgePointCursor(t,a),f=u.cursor,d=u.elementUUID;if(r.setCursor(f),d)if(null!==(g=c.getElementIndexByUUID(d))&&g>=0){var p=a.elements[g];if(!0===(null===(e=null==p?void 0:p.operation)||void 0===e?void 0:e.lock)||!0===(null===(n=null==p?void 0:p.operation)||void 0===n?void 0:n.invisible))return void r.resetCursor();if(this.temp.get('hoverUUID')!==p.uuid){var v=c.getElementIndexByUUID(this.temp.get('hoverUUID')||'');null!==v&&a.elements[v]&&l.trigger('mouseLeaveElement',{uuid:this.temp.get('hoverUUID'),index:v,element:a.elements[v]})}p&&(l.trigger('mouseOverElement',{uuid:p.uuid,index:g,element:p}),this.temp.set('hoverUUID',p.uuid),o=!0)}}if(!0!==o&&null!==this.temp.get('hoverUUID')){var g,m=this.temp.get('hoverUUID');null!==(g=c.getElementIndexByUUID(m||''))&&l.trigger('mouseLeaveElement',{uuid:m,index:g,element:a.elements[g]}),this.temp.set('hoverUUID',null)}l.has('mouseOverScreen')&&l.trigger('mouseOverScreen',t)},t.prototype._handleLeave=function(){var t=this._opts.coreEvent;t.has('mouseLeaveScreen')&&t.trigger('mouseLeaveScreen',void 0)},t}();function Un(t){t.setFillStyle('#000000'),t.setStrokeStyle('#000000'),t.setLineDash([]),t.setGlobalAlpha(1),t.setShadowColor('#00000000'),t.setShadowOffsetX(0),t.setShadowOffsetY(0),t.setShadowBlur(0)}var Rn=mt.data.deepClone,An=function(){function e(e,i,r){var s,l,a,c=this;this[n]=new Xe,this[o]=new gn,this[yn]={elements:[]},this[_n]=i,this[Sn]=function(e){var n=mt.data.deepClone(Ye);return e&&e.elementWrapper&&(n.elementWrapper=t(t({},n.elementWrapper),e.elementWrapper)),n}(r||{}),this[mn]=new J(e,t(t({},this[_n]),{canScroll:null===(s=null==r?void 0:r.scrollWrapper)||void 0===s?void 0:s.use,scrollConfig:{color:(null===(l=null==r?void 0:r.scrollWrapper)||void 0===l?void 0:l.color)||'#a0a0a0',lineWidth:(null===(a=null==r?void 0:r.scrollWrapper)||void 0===a?void 0:a.lineWidth)||12}})),this[xn]=new De;var h=function(){var t=c[mn].getHelperContext(),e=c[Dn].getHelperConfig();c[mn].clear();var n=c[_n],o=n.contextWidth,i=n.contextHeight,r=n.devicePixelRatio;t.clearRect(0,0,o*r,i*r),function(t,e){if(null==e?void 0:e.selectedElementWrapper){var n=e.selectedElementWrapper;Un(t),Ve(t,n.translate,n.radian||0,(function(){t.beginPath(),t.setLineDash(n.lineDash),t.setLineWidth(n.lineWidth),t.setStrokeStyle(n.color),t.moveTo(n.controllers.topLeft.x,n.controllers.topLeft.y),t.lineTo(n.controllers.topRight.x,n.controllers.topRight.y),t.lineTo(n.controllers.bottomRight.x,n.controllers.bottomRight.y),t.lineTo(n.controllers.bottomLeft.x,n.controllers.bottomLeft.y),t.lineTo(n.controllers.topLeft.x,n.controllers.topLeft.y-n.lineWidth/2),t.stroke(),t.closePath(),!0!==n.lock?(!0!==n.controllers.rotate.invisible&&(t.beginPath(),t.moveTo(n.controllers.top.x,n.controllers.top.y),t.lineTo(n.controllers.rotate.x,n.controllers.rotate.y+n.controllerSize),t.stroke(),t.closePath(),t.beginPath(),t.setLineDash([]),t.setLineWidth(n.controllerSize/2),t.arc(n.controllers.rotate.x,n.controllers.rotate.y,.8*n.controllerSize,Math.PI/6,2*Math.PI),t.stroke(),t.closePath()),t.setFillStyle(n.color),[n.controllers.topLeft,n.controllers.top,n.controllers.topRight,n.controllers.right,n.controllers.bottomRight,n.controllers.bottom,n.controllers.bottomLeft,n.controllers.left].forEach((function(e){!0!==e.invisible&&(t.beginPath(),t.arc(e.x,e.y,n.controllerSize,0,2*Math.PI),t.fill(),t.closePath())}))):(Un(t),t.setStrokeStyle(n.color),[n.controllers.topLeft,n.controllers.top,n.controllers.topRight,n.controllers.right,n.controllers.bottomRight,n.controllers.bottom,n.controllers.bottomLeft,n.controllers.left].forEach((function(e){t.beginPath(),t.moveTo(e.x-n.controllerSize/2,e.y-n.controllerSize/2),t.lineTo(e.x+n.controllerSize/2,e.y+n.controllerSize/2),t.stroke(),t.closePath(),t.beginPath(),t.moveTo(e.x+n.controllerSize/2,e.y-n.controllerSize/2),t.lineTo(e.x-n.controllerSize/2,e.y+n.controllerSize/2),t.stroke(),t.closePath()})))}))}}(t,e),function(t,e){if(null==e?void 0:e.selectedAreaWrapper){var n=e.selectedAreaWrapper;n&&n.w>0&&n.h>0&&(Un(t),t.setGlobalAlpha(.3),t.setFillStyle(n.color),t.fillRect(n.x,n.y,n.w,n.h),Un(t),t.beginPath(),t.setLineDash(n.lineDash),t.setLineWidth(n.lineWidth),t.setStrokeStyle(n.color),t.moveTo(n.x,n.y),t.lineTo(n.x+n.w,n.y),t.lineTo(n.x+n.w,n.y+n.h),t.lineTo(n.x,n.y+n.h),t.lineTo(n.x,n.y),t.stroke(),t.closePath())}}(t,e),function(t,e){if(Array.isArray(null==e?void 0:e.selectedElementListWrappers)){var n=e.selectedElementListWrappers;null==n||n.forEach((function(e){Un(t),Ve(t,e.translate,e.radian||0,(function(){Un(t),t.setGlobalAlpha(.05),t.setFillStyle(e.color),t.fillRect(e.controllers.topLeft.x,e.controllers.topLeft.y,e.controllers.bottomRight.x-e.controllers.topLeft.x,e.controllers.bottomRight.y-e.controllers.topLeft.y),Un(t),t.beginPath(),t.setLineDash(e.lineDash),t.setLineWidth(e.lineWidth),t.setStrokeStyle(e.color),t.moveTo(e.controllers.topLeft.x,e.controllers.topLeft.y),t.lineTo(e.controllers.topRight.x,e.controllers.topRight.y),t.lineTo(e.controllers.bottomRight.x,e.controllers.bottomRight.y),t.lineTo(e.controllers.bottomLeft.x,e.controllers.bottomLeft.y),t.lineTo(e.controllers.topLeft.x,e.controllers.topLeft.y-e.lineWidth/2),t.stroke(),t.closePath(),!0===e.lock&&(Un(t),t.setStrokeStyle(e.color),[e.controllers.topLeft,e.controllers.top,e.controllers.topRight,e.controllers.right,e.controllers.bottomRight,e.controllers.bottom,e.controllers.bottomLeft,e.controllers.left].forEach((function(n){t.beginPath(),t.moveTo(n.x-e.controllerSize/2,n.y-e.controllerSize/2),t.lineTo(n.x+e.controllerSize/2,n.y+e.controllerSize/2),t.stroke(),t.closePath(),t.beginPath(),t.moveTo(n.x+e.controllerSize/2,n.y-e.controllerSize/2),t.lineTo(n.x-e.controllerSize/2,n.y+e.controllerSize/2),t.stroke(),t.closePath()})))}))}))}}(t,e),c[mn].draw()};this[xn].on('drawFrame',(function(t){h()})),this[xn].on('drawFrameComplete',(function(t){h()})),this[bn]=new tn(this[mn].getContext()),this[Dn]=new On({coreEvent:this[Pn],board:this[mn],element:this[bn],config:this[Sn],drawFeekback:this[En].bind(this),getDataFeekback:function(){return c[yn]},selectElementByIndex:this.selectElementByIndex.bind(this),emitChangeScreen:this[Cn].bind(this),emitChangeData:this[zn].bind(this)}),this[Dn].init(),this[xn].on('drawFrame',(function(){c[Pn].trigger('drawFrame',void 0)})),this[xn].on('drawFrameComplete',(function(){c[Pn].trigger('drawFrameComplete',void 0)})),this[wn].set('hasInited',!0)}var n,o;return e.prototype[(n=Pn,o=wn,En)]=function(t){this[Dn].updateHelperConfig({width:this[_n].width,height:this[_n].height,devicePixelRatio:this[_n].devicePixelRatio}),this[xn].thaw(),this[xn].render(this[mn].getContext(),this[yn],{changeResourceUUIDs:(null==t?void 0:t.resourceChangeUUIDs)||[]})},e.prototype.getElement=function(t){return function(t,e){var n=null,o=t[Dn].helper.getElementIndexByUUID(e);return null!==o&&t[yn].elements[o]&&(n=Ln(t[yn].elements[o])),n}(this,t)},e.prototype.getElementByIndex=function(t){return function(t,e){var n=null;return e>=0&&t[yn].elements[e]&&(n=Ln(t[yn].elements[e])),n}(this,t)},e.prototype.selectElementByIndex=function(t,e){return function(t,e,n){if(t[yn].elements[e]){var o=t[yn].elements[e].uuid;!0===(null==n?void 0:n.useMode)?t[Dn].temp.set('mode',pn.SELECT_ELEMENT):t[Dn].temp.set('mode',pn.NULL),'string'==typeof o&&(t[Dn].temp.set('selectedUUID',o),t[Dn].temp.set('selectedUUIDList',[])),t[En]()}}(this,t,e)},e.prototype.selectElement=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(e);'number'==typeof o&&o>=0&&t.selectElementByIndex(o,n)}(this,t,e)},e.prototype.moveUpElement=function(t){return function(t,e){var n=t[Dn].helper.getElementIndexByUUID(e);if('number'==typeof n&&n>=0&&n<t[yn].elements.length-1){var o=t[yn].elements[n];t[yn].elements[n]=t[yn].elements[n+1],t[yn].elements[n+1]=o}t[zn](),t[En]()}(this,t)},e.prototype.moveDownElement=function(t){return function(t,e){var n=t[Dn].helper.getElementIndexByUUID(e);if('number'==typeof n&&n>0&&n<t[yn].elements.length){var o=t[yn].elements[n];t[yn].elements[n]=t[yn].elements[n-1],t[yn].elements[n-1]=o}t[zn](),t[En]()}(this,t)},e.prototype.updateElement=function(t){return function(t,e){for(var n,o=Ln(e),i=t[yn],r=[],s=0;s<i.elements.length;s++)if(o.uuid===(null===(n=i.elements[s])||void 0===n?void 0:n.uuid)){var l=je(i.elements[s],o);'string'==typeof l&&r.push(l),i.elements[s]=o;break}t[zn](),t[En]({resourceChangeUUIDs:r})}(this,t)},e.prototype.addElement=function(t){return function(t,e){var n=Ln(e);return n.uuid=Tn(),t[yn].elements.push(n),t[zn](),t[En](),n.uuid}(this,t)},e.prototype.deleteElement=function(t){return function(t,e){var n=t[bn].getElementIndex(t[yn],e);n>=0&&(t[yn].elements.splice(n,1),t[zn](),t[En]())}(this,t)},e.prototype.insertElementBefore=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(n);return null!==o?t.insertElementBeforeIndex(e,o):null}(this,t,e)},e.prototype.insertElementBeforeIndex=function(t,e){return function(t,e,n){var o=Ln(e);return o.uuid=Tn(),n>=0?(t[yn].elements.splice(n,0,o),t[zn](),t[En](),o.uuid):null}(this,t,e)},e.prototype.getSelectedElements=function(){return e=[],n=[],'string'==typeof(o=(t=this)[Dn].temp.get('selectedUUID'))&&o?n.push(o):n=t[Dn].temp.get('selectedUUIDList'),n.forEach((function(n){var o,i=t[Dn].helper.getElementIndexByUUID(n);if(null!==i&&i>=0){var r=null===(o=t[yn])||void 0===o?void 0:o.elements[i];r&&e.push(r)}})),Ln(e);var t,e,n,o},e.prototype.insertElementAfter=function(t,e){return function(t,e,n){var o=t[Dn].helper.getElementIndexByUUID(n);return null!==o?t.insertElementAfterIndex(e,o):null}(this,t,e)},e.prototype.insertElementAfterIndex=function(t,e){return function(t,e,n){var o=Ln(e);return o.uuid=Tn(),n>=0?(t[yn].elements.splice(n+1,0,o),t[zn](),t[En](),o.uuid):null}(this,t,e)},e.prototype.resetSize=function(e){this[_n]=t(t({},this[_n]),e),this[mn].resetSize(e),this[En]()},e.prototype.scale=function(t){var e=this[mn].scale(t);return this[En](),this[Cn](),e},e.prototype.scrollLeft=function(t){var e=this[mn].scrollX(0-t);return this[En](),this[Cn](),e},e.prototype.scrollTop=function(t){var e=this[mn].scrollY(0-t);return this[En](),this[Cn](),e},e.prototype.getScreenTransform=function(){var t=this[mn].getTransform();return{scale:t.scale,scrollTop:Math.max(0,0-t.scrollY),scrollLeft:Math.max(0,0-t.scrollX)}},e.prototype.getData=function(){return Rn(this[yn])},e.prototype.setData=function(t,e){var n=function(t,e){var n,o=[],i=Ge(t),r=Ge(e);for(var s in r)if(!0===['image','svg','html'].includes(null===(n=r[s])||void 0===n?void 0:n.type))if(i[s]){var l=!1;switch(i[s].type){case'image':l=Ne(i[s],r[s]);break;case'svg':l=He(i[s],r[s]);break;case'html':l=Be(i[s],r[s])}!0===l&&o.push(s)}else o.push(s);return o}(this[yn],t);this[yn]=this[bn].initData(Rn(fn(t))),e&&!0===e.triggerChangeEvent&&this[zn](),this[En]({resourceChangeUUIDs:n})},e.prototype.clearOperation=function(){this[wn].clear(),this[En]()},e.prototype.on=function(t,e){this[Pn].on(t,e)},e.prototype.off=function(t,e){this[Pn].off(t,e)},e.prototype.pointScreenToContext=function(t){return this[mn].pointScreenToContext(t)},e.prototype.pointContextToScreen=function(t){return this[mn].pointContextToScreen(t)},e.prototype.__getBoardContext=function(){return this[mn].getContext()},e.prototype.__getDisplayContext2D=function(){return this[mn].getDisplayContext2D()},e.prototype.__getOriginContext2D=function(){return this[mn].getOriginContext2D()},e.prototype[Cn]=function(){this[Pn].has('changeScreen')&&this[Pn].trigger('changeScreen',t({},this.getScreenTransform()))},e.prototype[zn]=function(){this[Pn].has('changeData')&&this[Pn].trigger('changeData',Rn(this[yn]))},e.is=We,e.check=Ue,e}();return An}();