@idraw/core 0.4.0-beta.8 → 0.4.0-beta.9

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.
@@ -130,7 +130,7 @@ export const MiddlewareSelector = (opts) => {
130
130
  eventHub.off(middlewareEventSelectClear, selectClearCallback);
131
131
  },
132
132
  hover: (e) => {
133
- var _a, _b;
133
+ var _a, _b, _c, _d, _e;
134
134
  const resizeType = sharer.getSharedStorage(keyResizeType);
135
135
  const actionType = sharer.getSharedStorage(keyActionType);
136
136
  const groupQueue = sharer.getSharedStorage(keyGroupQueue);
@@ -189,7 +189,22 @@ export const MiddlewareSelector = (opts) => {
189
189
  calculator
190
190
  }) }));
191
191
  triggerCursor(target);
192
- if (target.type === 'over-element' && ((_b = target === null || target === void 0 ? void 0 : target.elements) === null || _b === void 0 ? void 0 : _b.length) === 1) {
192
+ if (target.type === null) {
193
+ return;
194
+ }
195
+ if (target.type === 'over-element' &&
196
+ sharer.getSharedStorage(keyActionType) === 'select' &&
197
+ target.elements.length === 1 &&
198
+ target.elements[0].uuid === ((_c = (_b = getActiveElements()) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.uuid)) {
199
+ return;
200
+ }
201
+ if (target.type === 'over-element' &&
202
+ sharer.getSharedStorage(keyActionType) === null &&
203
+ target.elements.length === 1 &&
204
+ target.elements[0].uuid === ((_d = sharer.getSharedStorage(keyHoverElement)) === null || _d === void 0 ? void 0 : _d.uuid)) {
205
+ return;
206
+ }
207
+ if (target.type === 'over-element' && ((_e = target === null || target === void 0 ? void 0 : target.elements) === null || _e === void 0 ? void 0 : _e.length) === 1) {
193
208
  sharer.setSharedStorage(keyHoverElement, target.elements[0]);
194
209
  updateHoverElement(target.elements[0]);
195
210
  viewer.drawFrame();
@@ -26,7 +26,7 @@ var __privateMethod = (obj, member, method) => {
26
26
  function throttle(fn, timeout) {
27
27
  let timer = -1;
28
28
  return function(...args) {
29
- if (timer > 0) {
29
+ if (timer >= 0) {
30
30
  return;
31
31
  }
32
32
  timer = setTimeout(() => {
@@ -1785,8 +1785,8 @@ var __privateMethod = (obj, member, method) => {
1785
1785
  });
1786
1786
  }
1787
1787
  function drawClipPath(ctx, viewElem, opts) {
1788
- const { renderContent, originElem, calcElemSize, viewScaleInfo, viewSizeInfo } = opts;
1789
- const totalScale = viewScaleInfo.scale * viewSizeInfo.devicePixelRatio;
1788
+ const { renderContent, originElem, calcElemSize, viewSizeInfo } = opts;
1789
+ const totalScale = viewSizeInfo.devicePixelRatio;
1790
1790
  const { clipPath } = (originElem === null || originElem === void 0 ? void 0 : originElem.detail) || {};
1791
1791
  if (clipPath && calcElemSize && clipPath.commands) {
1792
1792
  const { x: x2, y: y2, w: w2, h: h2 } = calcElemSize;
@@ -2050,29 +2050,31 @@ var __privateMethod = (obj, member, method) => {
2050
2050
  b = b - bw;
2051
2051
  }
2052
2052
  }
2053
- const opacity = getOpacity(viewElem) * parentOpacity;
2054
- ctx.globalAlpha = opacity;
2055
- if (typeof borderWidth2 === "number" && borderWidth2 > 0) {
2056
- const ba = borderWidth2 / 2 + a;
2057
- const bb = borderWidth2 / 2 + b;
2053
+ if (a >= 0 && b >= 0) {
2054
+ const opacity = getOpacity(viewElem) * parentOpacity;
2055
+ ctx.globalAlpha = opacity;
2056
+ if (typeof borderWidth2 === "number" && borderWidth2 > 0) {
2057
+ const ba = borderWidth2 / 2 + a;
2058
+ const bb = borderWidth2 / 2 + b;
2059
+ ctx.beginPath();
2060
+ ctx.strokeStyle = borderColor2;
2061
+ ctx.lineWidth = borderWidth2;
2062
+ ctx.circle(centerX, centerY, ba, bb, 0, 0, 2 * Math.PI);
2063
+ ctx.closePath();
2064
+ ctx.stroke();
2065
+ }
2058
2066
  ctx.beginPath();
2059
- ctx.strokeStyle = borderColor2;
2060
- ctx.lineWidth = borderWidth2;
2061
- ctx.circle(centerX, centerY, ba, bb, 0, 0, 2 * Math.PI);
2067
+ const fillStyle = createColorStyle(ctx, background2, {
2068
+ viewElementSize: { x: x2, y: y2, w: w2, h: h2 },
2069
+ viewScaleInfo,
2070
+ opacity: ctx.globalAlpha
2071
+ });
2072
+ ctx.fillStyle = fillStyle;
2073
+ ctx.circle(centerX, centerY, a, b, 0, 0, 2 * Math.PI);
2062
2074
  ctx.closePath();
2063
- ctx.stroke();
2075
+ ctx.fill();
2076
+ ctx.globalAlpha = parentOpacity;
2064
2077
  }
2065
- ctx.beginPath();
2066
- const fillStyle = createColorStyle(ctx, background2, {
2067
- viewElementSize: { x: x2, y: y2, w: w2, h: h2 },
2068
- viewScaleInfo,
2069
- opacity: ctx.globalAlpha
2070
- });
2071
- ctx.fillStyle = fillStyle;
2072
- ctx.circle(centerX, centerY, a, b, 0, 0, 2 * Math.PI);
2073
- ctx.closePath();
2074
- ctx.fill();
2075
- ctx.globalAlpha = parentOpacity;
2076
2078
  }
2077
2079
  });
2078
2080
  });
@@ -2332,6 +2334,11 @@ var __privateMethod = (obj, member, method) => {
2332
2334
  if (((_a = elem === null || elem === void 0 ? void 0 : elem.operations) === null || _a === void 0 ? void 0 : _a.invisible) === true) {
2333
2335
  return;
2334
2336
  }
2337
+ const { w: w2, h: h2 } = elem;
2338
+ const { scale } = opts.viewScaleInfo;
2339
+ if (scale < 1 && (w2 * scale < 1 || h2 * scale < 1) || opts.parentOpacity === 0) {
2340
+ return;
2341
+ }
2335
2342
  try {
2336
2343
  switch (elem.type) {
2337
2344
  case "rect": {
@@ -4808,7 +4815,7 @@ var __privateMethod = (obj, member, method) => {
4808
4815
  eventHub.off(middlewareEventSelectClear, selectClearCallback);
4809
4816
  },
4810
4817
  hover: (e) => {
4811
- var _a, _b;
4818
+ var _a, _b, _c, _d, _e;
4812
4819
  const resizeType = sharer.getSharedStorage(keyResizeType);
4813
4820
  const actionType = sharer.getSharedStorage(keyActionType);
4814
4821
  const groupQueue = sharer.getSharedStorage(keyGroupQueue);
@@ -4870,7 +4877,16 @@ var __privateMethod = (obj, member, method) => {
4870
4877
  })
4871
4878
  });
4872
4879
  triggerCursor(target);
4873
- if (target.type === "over-element" && ((_b = target == null ? void 0 : target.elements) == null ? void 0 : _b.length) === 1) {
4880
+ if (target.type === null) {
4881
+ return;
4882
+ }
4883
+ if (target.type === "over-element" && sharer.getSharedStorage(keyActionType) === "select" && target.elements.length === 1 && target.elements[0].uuid === ((_c = (_b = getActiveElements()) == null ? void 0 : _b[0]) == null ? void 0 : _c.uuid)) {
4884
+ return;
4885
+ }
4886
+ if (target.type === "over-element" && sharer.getSharedStorage(keyActionType) === null && target.elements.length === 1 && target.elements[0].uuid === ((_d = sharer.getSharedStorage(keyHoverElement)) == null ? void 0 : _d.uuid)) {
4887
+ return;
4888
+ }
4889
+ if (target.type === "over-element" && ((_e = target == null ? void 0 : target.elements) == null ? void 0 : _e.length) === 1) {
4874
4890
  sharer.setSharedStorage(keyHoverElement, target.elements[0]);
4875
4891
  updateHoverElement(target.elements[0]);
4876
4892
  viewer.drawFrame();
@@ -1 +1 @@
1
- var iDrawCore=function(e){"use strict";var t,i,o,n,a=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},r=(e,t,i)=>(a(e,t,"read from private field"),i?i.call(e):t.get(e)),s=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},l=(e,t,i,o)=>(a(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i);function h(e,t){let i=-1;return function(...o){i>0||(i=setTimeout((()=>{e(...o),i=-1}),t))}}function c(e){return"string"==typeof e&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^[a-z]{1,}$/i.test(e))}function d(e,t){if(1===t)return e;let i=1;const o=/^\#[0-9a-f]{6,6}$/i;let n=e;if(o.test(e)?i=parseInt(e.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(e)&&(i=parseInt(e.substring(7,9).replace(/^\#/,"0x")),n=e.substring(0,7)),i*=t,o.test(n)&&i>0&&i<1){const e=Math.max(0,Math.min(255,Math.ceil(256*i)));n=`${n.toUpperCase()}${e.toString(16).toUpperCase()}`}return n}function f(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function u(e){let t=0;for(let i=0;i<e.length;i++)t+=e.charCodeAt(i)*e.charCodeAt(i)*i*i;return t.toString(16).substring(0,4)}function g(e){const t=e.length,i=Math.floor(t/2),o=e.substring(0,4).padEnd(4,"0"),n=e.substring(0,4).padEnd(4,"0");return`@assets/${u(t.toString(16).padEnd(4,o))}${u(e.substring(i-4,i).padEnd(4,o)).padEnd(4,"f")}-${u(e.substring(i-8,i-4).padEnd(4,o)).padEnd(4,"f")}-${u(e.substring(i-12,i-8).padEnd(4,o)).padEnd(4,"f")}-${u(e.substring(i-16,i-12).padEnd(4,n)).padEnd(4,"f")}-${u(e.substring(i,i+4).padEnd(4,n)).padEnd(4,"f")}${u(e.substring(i+4,i+8).padEnd(4,n)).padEnd(4,"f")}${u(n.padEnd(4,o).padEnd(4,n))}`}function w(e){return function e(t){const i=function(e){return Object.prototype.toString.call(e).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(t);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return t;if("Array"===i){const i=[];return t.forEach((t=>{i.push(e(t))})),i}if("Object"===i){const i={};Object.keys(t).forEach((o=>{i[o]=e(t[o])}));return Object.getOwnPropertySymbols(t).forEach((o=>{i[o]=e(t[o])})),i}}(e)}function v(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const m={type(e,t){const i=v(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===v(e),json:e=>"Object"===v(e),function:e=>"Function"===v(e),asyncFunction:e=>"AsyncFunction"===v(e),string:e=>"String"===v(e),number:e=>"Number"===v(e),undefined:e=>"Undefined"===v(e),null:e=>"Null"===v(e),promise:e=>"Promise"===v(e)};var y=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))};const{Image:p}=window;function x(e){return new Promise(((t,i)=>{const o=new p;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function S(e){return y(this,void 0,void 0,(function*(){const t=yield function(e){return new Promise(((t,i)=>{const o=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=new FileReader;n.readAsDataURL(o),n.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},n.onerror=function(e){i(e)}}))}(e);return yield x(t)}))}function b(e,t){return y(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&amp;");const i=yield function(e,t){const{width:i,height:o}=t;return new Promise(((t,n)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},r.onerror=function(e){n(e)}}))}(e,t);return yield x(i)}))}function A(e){return"number"==typeof e&&(e>0||e<=0)}function I(e){return"number"==typeof e&&e>=0}function M(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function z(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const R={x:function(e){return A(e)},y:function(e){return A(e)},w:I,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:A,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return I(e)},borderRadius:function(e){return A(e)&&e>=0},color:function(e){return c(e)},imageSrc:function(e){return z(e)||M(e)},imageURL:M,imageBase64:z,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let i=document.createElement("div");i.innerHTML=e,i.children.length>0&&(t=!0),i=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return A(e)&&e>0},lineHeight:function(e){return A(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return A(e)&&e>0}};var P,T,E=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},C=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class W{constructor(e,t){P.set(this,void 0),T.set(this,void 0),E(this,P,e,"f"),E(this,T,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f")}$undoPixelRatio(e){return e/C(this,T,"f").devicePixelRatio}$doPixelRatio(e){return C(this,T,"f").devicePixelRatio*e}$getContext(){return C(this,P,"f")}$setFont(e){const t=[];e.fontWeight&&t.push(`${e.fontWeight}`),t.push(`${this.$doPixelRatio(e.fontSize||12)}px`),t.push(`${e.fontFamily||"sans-serif"}`),C(this,P,"f").font=`${t.join(" ")}`}$getOffscreenCanvas(){return C(this,T,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:a}=C(this,P,"f");a.width=t*o,a.height=i*o,E(this,T,Object.assign(Object.assign({},C(this,T,"f")),{devicePixelRatio:o}),"f"),!0===n&&(a.style.width=`${t}px`,a.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=C(this,T,"f"),{width:t,height:i}=C(this,P,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return C(this,P,"f").canvas}get fillStyle(){return C(this,P,"f").fillStyle}set fillStyle(e){C(this,P,"f").fillStyle=e}get strokeStyle(){return C(this,P,"f").strokeStyle}set strokeStyle(e){C(this,P,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(C(this,P,"f").lineWidth)}set lineWidth(e){C(this,P,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return C(this,P,"f").textAlign}set textAlign(e){C(this,P,"f").textAlign=e}get textBaseline(){return C(this,P,"f").textBaseline}set textBaseline(e){C(this,P,"f").textBaseline=e}get globalAlpha(){return C(this,P,"f").globalAlpha}set globalAlpha(e){C(this,P,"f").globalAlpha=e}get shadowColor(){return C(this,P,"f").shadowColor}set shadowColor(e){C(this,P,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(C(this,P,"f").shadowOffsetX)}set shadowOffsetX(e){C(this,P,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(C(this,P,"f").shadowOffsetY)}set shadowOffsetY(e){C(this,P,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(C(this,P,"f").shadowBlur)}set shadowBlur(e){C(this,P,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return C(this,P,"f").lineCap}set lineCap(e){C(this,P,"f").lineCap=e}get globalCompositeOperation(){return C(this,P,"f").globalCompositeOperation}set globalCompositeOperation(e){C(this,P,"f").globalCompositeOperation=e}fill(...e){return C(this,P,"f").fill(...e)}arc(e,t,i,o,n,a){return C(this,P,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,a)}rect(e,t,i,o){return C(this,P,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return C(this,P,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return C(this,P,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return C(this,P,"f").beginPath()}closePath(){return C(this,P,"f").closePath()}lineTo(e,t){return C(this,P,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return C(this,P,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return C(this,P,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}getLineDash(){return C(this,P,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return C(this,P,"f").setLineDash(t)}stroke(e){return e?C(this,P,"f").stroke(e):C(this,P,"f").stroke()}translate(e,t){return C(this,P,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return C(this,P,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],a=e[4],r=e[e.length-4],s=e[e.length-3],l=e[e.length-2],h=e[e.length-1];return 9===e.length?C(this,P,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a),this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h)):C(this,P,"f").drawImage(t,this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h))}createPattern(e,t){return C(this,P,"f").createPattern(e,t)}measureText(e){return C(this,P,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?C(this,P,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):C(this,P,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?C(this,P,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):C(this,P,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){C(this,P,"f").save()}restore(){C(this,P,"f").restore()}scale(e,t){C(this,P,"f").scale(e,t)}circle(e,t,i,o,n,a,r,s){C(this,P,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,a,r,s)}isPointInPath(e,t){return C(this,P,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return C(this,P,"f").clip(...e)}setTransform(e,t,i,o,n,a){return C(this,P,"f").setTransform(e,t,i,o,n,a)}getTransform(){return C(this,P,"f").getTransform()}createLinearGradient(e,t,i,o){return C(this,P,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,a){return C(this,P,"f").createRadialGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a))}createConicGradient(e,t,i){return C(this,P,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function O(e){const{width:t,height:i,ctx:o,devicePixelRatio:n}=e;let a=o;if(!a){const e=document.createElement("canvas");e.width=t*n,e.height=i*n,a=e.getContext("2d")}return new W(a,e)}function j(e){const{width:t,height:i,devicePixelRatio:o}=e,n=new OffscreenCanvas(t*o,i*o),a=n.getContext("2d").canvas.getContext("2d");return new W(a,{devicePixelRatio:o,offscreenCanvas:n})}P=new WeakMap,T=new WeakMap;var k,D=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class L{constructor(){k.set(this,void 0),function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,i):n?n.value=i:t.set(e,i)}(this,k,new Map,"f")}on(e,t){if(D(this,k,"f").has(e)){const i=D(this,k,"f").get(e)||[];null==i||i.push(t),D(this,k,"f").set(e,i)}else D(this,k,"f").set(e,[t])}off(e,t){if(D(this,k,"f").has(e)){const i=D(this,k,"f").get(e);if(Array.isArray(i))for(let e=0;e<(null==i?void 0:i.length);e++)if(i[e]===t){i.splice(e,1);break}D(this,k,"f").set(e,i||[])}}trigger(e,t){const i=D(this,k,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(D(this,k,"f").has(e)){const t=D(this,k,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){D(this,k,"f").clear()}}function Y(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}k=new WeakMap;var B,F,G,N,X=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},V=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class H{constructor(e){B.add(this),F.set(this,void 0),G.set(this,void 0),X(this,G,w(e.defaultStorage),"f"),X(this,F,V(this,B,"m",N).call(this),"f")}set(e,t){V(this,F,"f")[e]=t}get(e){return V(this,F,"f")[e]}getSnapshot(){return w(V(this,F,"f"))}clear(){X(this,F,V(this,B,"m",N).call(this),"f")}destroy(){X(this,F,null,"f")}}function Z(e){const{activeStore:t}=e;return{scale:null==t?void 0:t.scale,offsetTop:null==t?void 0:t.offsetTop,offsetBottom:null==t?void 0:t.offsetBottom,offsetLeft:null==t?void 0:t.offsetLeft,offsetRight:null==t?void 0:t.offsetRight}}function Q(e){const{activeStore:t}=e;return{devicePixelRatio:t.devicePixelRatio,width:null==t?void 0:t.width,height:null==t?void 0:t.height,contextWidth:null==t?void 0:t.contextWidth,contextHeight:null==t?void 0:t.contextHeight}}function $(e){return e/180*Math.PI}function U(e,t,i,o){const n=$(t||0);i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(n),e.translate(-i.x,-i.y)),o(e),i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(-n),e.translate(-i.x,-i.y))}function J(e,t,i){const o=K(t);U(e,t.angle||0,o,(()=>{i(e)}))}function K(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function q(e){const t=Math.min(e[0].x,e[1].x,e[2].x,e[3].x),i=Math.min(e[0].y,e[1].y,e[2].y,e[3].y);return K({x:t,y:i,w:Math.max(e[0].x,e[1].x,e[2].x,e[3].x)-t,h:Math.max(e[0].y,e[1].y,e[2].y,e[3].y)-i})}function _(e,t,i){const o=function(e,t){const i=t.x-e.x,o=t.y-e.y;if(0===i){if(o<0)return 0;if(o>0)return Math.PI}else if(0===o){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&o<0?Math.atan(Math.abs(i)/Math.abs(o)):i>0&&o>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):0}(e,t);let n=o+i;n>2*Math.PI?n-=2*Math.PI:n<0-2*Math.PI&&(n+=2*Math.PI),n<0&&(n+=2*Math.PI);const a=function(e,t){const i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===i?i:Math.sqrt(i)}(e,t);let r=0,s=0;return 0===n?(r=0,s=0-a):n>0&&n<Math.PI/2?(r=Math.sin(n)*a,s=0-Math.cos(n)*a):n===Math.PI/2?(r=a,s=0):n>Math.PI/2&&n<Math.PI?(r=Math.sin(Math.PI-n)*a,s=Math.cos(Math.PI-n)*a):n===Math.PI?(r=0,s=a):n>Math.PI&&n<1.5*Math.PI?(r=0-Math.sin(n-Math.PI)*a,s=Math.cos(n-Math.PI)*a):n===1.5*Math.PI?(r=0-a,s=0):n>1.5*Math.PI&&n<2*Math.PI?(r=0-Math.sin(2*Math.PI-n)*a,s=0-Math.cos(2*Math.PI-n)*a):n===2*Math.PI&&(r=0,s=0-a),r+=e.x,s+=e.y,{x:r,y:s}}function ee(e,t){if((null==t?void 0:t.length)>0){let i=e.x,o=e.y;return t.forEach((e=>{const{x:t,y:n,w:a,h:r,angle:s=0}=e,l=_(K({x:t,y:n,w:a,h:r,angle:s}),{x:i,y:o},$(s));i=l.x,o=l.y})),{x:i,y:o}}return e}function te(e,t,i){const{x:o,y:n,w:a,h:r}=e;let s={x:o,y:n},l={x:o+a,y:n},h={x:o+a,y:n+r},c={x:o,y:n+r};if(i&&(i>0||i<0)){const e=$(ne(i));s=_(t,s,e),l=_(t,l,e),h=_(t,h,e),c=_(t,c,e)}return[s,l,h,c]}function ie(e){const{angle:t=0}=e;return te(e,K(e),t)}function oe(e,t,i){return[_(e,{x:t[0].x,y:t[0].y},i),_(e,{x:t[1].x,y:t[1].y},i),_(e,{x:t[2].x,y:t[2].y},i),_(e,{x:t[3].x,y:t[3].y},i)]}function ne(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function ae(e){let t=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(t=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(t=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(t=ae(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function re(e,t){const i={x:0,y:0,w:0,h:0};e.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=ie(t);if(4===e.length){const i=[e[0].x,e[1].x,e[2].x,e[3].x],o=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...i),t.y=Math.min(...o),t.w=Math.abs(Math.max(...i)-Math.min(...i)),t.h=Math.abs(Math.max(...o)-Math.min(...o))}}const o=Math.min(t.x,i.x),n=Math.min(t.y,i.y),a=Math.max(t.x+t.w,i.x+i.w),r=Math.max(t.y+t.h,i.y+i.h);i.x=o,i.y=n,i.w=Math.abs(a-o),i.h=Math.abs(r-n)})),(null==t?void 0:t.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const o={contextWidth:i.w,contextHeight:i.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>i.x+i.w&&(o.contextWidth=t.viewWidth-i.x),t.viewHeight>i.y+i.h&&(o.contextHeight=t.viewHeight-i.y)),o}function se(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:a,h:r,angle:s}=e,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:o*l+c,y:n*l+h,w:a*l,h:r*l,angle:s}}function le(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:a,offsetTop:r,offsetLeft:s}=i;return{x:o*a+s,y:n*a+r}}function he(e,t){return[le(e[0],t),le(e[1],t),le(e[2],t),le(e[3],t)]}function ce(e,t){const{context2d:i,element:o,viewScaleInfo:n,viewSizeInfo:a}=t,{angle:r=0}=o,{x:s,y:l,w:h,h:c}=se(o,{viewScaleInfo:n,viewSizeInfo:a}),d=ie({x:s,y:l,w:h,h:c,angle:r});if(d.length>=2){i.beginPath(),i.moveTo(d[0].x,d[0].y);for(let e=1;e<d.length;e++)i.lineTo(d[e].x,d[e].y);i.closePath()}return!!i.isPointInPath(e.x,e.y)}function de(e){const{x:t,y:i,h:o,w:n}=e;return[{x:t,y:i},{x:t+n,y:i},{x:t+n,y:i+o},{x:t,y:i+o}]}function fe(e){const{x:t,y:i,w:o,h:n,angle:a=0}=e;return 0===a?de(e):te(e,K({x:t,y:i,w:o,h:n,angle:a}),a)}function ue(e){const t=[];let i=0,o=0;const n=[],a=[...e];for(let e=0;e<a.length;e++){const{x:r,y:s,w:l,h:h,angle:c=0}=a[e];let d;if(i+=r,o+=s,0===e){const e={x:i,y:o,w:l,h:h,angle:c};d=fe({x:r,y:s,w:l,h:h,angle:c}),n.push({center:K(e),angle:c,radian:$(c)})}else{d=de({x:i,y:o,w:l,h:h,angle:c});for(let e=0;e<n.length;e++){const{center:t,radian:i}=n[e];d=oe(t,d,i)}const e=q(d);if(c>0||c<0){d=oe(e,d,$(c))}n.push({center:e,angle:c,radian:$(c)})}t.push(d)}return t}function ge(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?ue([...i,e]):[fe(e)]}(e,t);return i.pop()||null}function we(e,t){const{x:i,y:o}=e,{size:n,angle:a}=t;return{x:i-n/2,y:o-n/2,w:n,h:n,angle:a}}function ve(e,t){const{groupQueue:i,controllerSize:o,viewScaleInfo:n}=t,a=(o&&o>0?o:8)/n.scale,{x:r,y:s,w:l,h:h,angle:c=0}=e,d=[{uuid:f(),x:r,y:s,w:l,h:h,angle:c,type:"group",detail:{children:[]}},...i];let u=0;d.forEach((({angle:e=0})=>{u+=e}));const g=ge(e,{groupQueue:i}),w=Y(g[0],g[1]),v=Y(g[1],g[2]),m=Y(g[2],g[3]),y=Y(g[3],g[0]),p=g[0],x=g[1],S=g[2],b=g[3],A=we(p,{size:a,angle:u}),I=we(x,{size:a,angle:u}),M=we(b,{size:a,angle:u}),z=we(S,{size:a,angle:u}),R=fe(A),P=fe(I),T=fe(M),E=fe(z),C=[R[1],P[0],P[3],R[2]],W=[P[3],P[2],E[1],E[0]],O=[T[1],E[0],E[3],T[2]];return{elementWrapper:g,left:{type:"left",vertexes:[R[3],R[2],T[1],T[0]],center:y},right:{type:"right",vertexes:W,center:v},top:{type:"top",vertexes:C,center:w},bottom:{type:"bottom",vertexes:O,center:m},topLeft:{type:"top-left",vertexes:R,center:p},topRight:{type:"top-right",vertexes:P,center:x},bottomLeft:{type:"bottom-left",vertexes:T,center:b},bottomRight:{type:"bottom-right",vertexes:E,center:S}}}function me(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function ye(e,t){let i=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(i=t.decimalPlaces),parseFloat(e.toFixed(i))}F=new WeakMap,G=new WeakMap,B=new WeakSet,N=function(){return w(V(this,G,"f"))};const pe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function xe(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{boxSizing:a=pe.boxSizing,borderWidth:r}=e.detail;Array.isArray(r)&&(n=0);let{x:s,y:l,w:h,h:c}=e,d=[0,0,0,0];if("number"==typeof n){const e=n*o;d=[e,e,e,e]}else Array.isArray(n)&&4===(null==n?void 0:n.length)&&(d=[n[0]*o,n[1]*o,n[2]*o,n[3]*o]);let f=0;return"number"==typeof r&&(f=(r||0)*o),"border-box"===a?(s=e.x+f/2,l=e.y+f/2,h=e.w-f,c=e.h-f):"content-box"===a?(s=e.x-f/2,l=e.y-f/2,h=e.w+f,c=e.h+f):(s=e.x,l=e.y,h=e.w,c=e.h),h=Math.max(h,1),c=Math.max(c,1),d=d.map((e=>Math.min(e,h/2,c/2))),{x:s,y:l,w:h,h:c,radiusList:d}}const Se=e=>ye(e,{decimalPlaces:4});function be(e,t){const{detail:i}=e,{xRatio:o,yRatio:n,maxRatio:a}=t,r=(o+n)/2,{borderWidth:s,borderRadius:l,borderDash:h,shadowOffsetX:c,shadowOffsetY:d,shadowBlur:f}=i;if("number"==typeof s)i.borderWidth=Se(s*r);else if(Array.isArray(i.borderWidth)){const e=s;i.borderWidth=[Se(e[0]*n),Se(e[1]*o),Se(e[2]*n),Se(e[3]*o)]}if("number"==typeof l)i.borderRadius=Se(l*r);else if(Array.isArray(i.borderRadius)){const e=l;i.borderRadius=[e[0]*o,e[1]*o,e[2]*n,e[3]*n]}Array.isArray(h)&&h.forEach(((e,t)=>{i.borderDash[t]=Se(e*a)})),"number"==typeof c&&(i.shadowOffsetX=Se(c*a)),"number"==typeof d&&(i.shadowOffsetX=Se(d*a)),"number"==typeof f&&(i.shadowOffsetX=Se(f*a))}function Ae(e,t){const{type:i}=e;!function(e,t){const{xRatio:i,yRatio:o}=t,{x:n,y:a,w:r,h:s}=e;e.x=Se(n*i),e.y=Se(a*o),e.w=Se(r*i),e.h=Se(s*o),be(e,t)}(e,t),"circle"===i||("text"===i?function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:a}=e.detail,r=(i+o)/2;n&&n>0&&(e.detail.fontSize=Se(n*r)),a&&a>0&&(e.detail.lineHeight=Se(a*r))}(e,t):"image"===i||"svg"===i||"html"===i||"path"===i||"group"===i&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ae(e,t)})))}function Ie(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:a=1}=i,{x:r,y:s}=o,{scale:l}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l},c={x:r+o.x*l,y:s+o.y*l},f=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{f.addColorStop(e.offset,d(e.color,a))})),f}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l,radius:i.radius*l},c={x:r+o.x*l,y:s+o.y*l,radius:o.radius*l},f=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{f.addColorStop(e.offset,d(e.color,a))})),f}return"#000000"}const Me={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function ze(e){var t,i,o,n;let a=1;return void 0!==(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.opacity)&&(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.opacity)<=1&&(a=null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.opacity),a}function Re(e,t,i){const{pattern:o,renderContent:n,originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,d=ze(a)*h;!function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:a,viewScaleInfo:r,viewSizeInfo:s}=i,l=r.scale*s.devicePixelRatio,{clipPath:h}=(null==n?void 0:n.detail)||{};if(h&&a&&h.commands){const{x:i,y:n,w:r,h:s}=a,{originW:c,originH:d,originX:f,originY:u}=h,g=r/c,w=s/d,v=i-f*g,m=n-u*w;e.save(),e.translate(v,m),e.scale(l*g,l*w);const y=me(h.commands||[]),p=new Path2D(y);e.clip(p),e.translate(0-v,0-m),e.setTransform(1,0,0,1,0,0),J(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l,renderContent:()=>{e.globalAlpha=d,function(e,t,i){var o,n;const{pattern:a,viewScaleInfo:r,viewSizeInfo:s}=i,l=[];if(t.detail.background||a){const{x:i,y:h,w:c,h:d,radiusList:f}=xe(t,{viewScaleInfo:r,viewSizeInfo:s});if(e.beginPath(),e.moveTo(i+f[0],h),e.arcTo(i+c,h,i+c,h+d,f[1]),e.arcTo(i+c,h+d,i,h+d,f[2]),e.arcTo(i,h+d,i,h,f[3]),e.arcTo(i,h,i+c,h,f[0]),e.closePath(),"string"==typeof a)e.fillStyle=a;else if(["CanvasPattern"].includes(m.type(a)))e.fillStyle=a;else if("string"==typeof t.detail.background)e.fillStyle=t.detail.background;else if("linear-gradient"===(null===(o=t.detail.background)||void 0===o?void 0:o.type)){const o=Ie(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=Ie(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});if(e.fillStyle=o,l&&l.length>0)for(let t=0;t<(null==l?void 0:l.length);t++){const o=l[t];"translate"===o.method?e.translate(o.args[0]+i,o.args[1]+h):"rotate"===o.method?e.rotate(...o.args):"scale"===o.method&&e.scale(...o.args)}}e.fill(),l&&l.length>0&&e.setTransform(1,0,0,1,0,0)}}(e,t,{pattern:o,viewScaleInfo:s,viewSizeInfo:l}),null==n||n(),function(e,t,i){if(0===t.detail.borderWidth)return;if(!c(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let a=Me.borderColor;!0===c(t.detail.borderColor)&&(a=t.detail.borderColor);const{borderWidth:r,borderRadius:s,borderDash:l,boxSizing:h=Me.boxSizing}=t.detail;let d=0;"number"==typeof r&&(d=r||1);d*=n;let f=[0,0,0,0];if("number"==typeof s){const e=s*n;f=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(f=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);e.strokeStyle=a;let u=[];Array.isArray(l)&&l.length>0&&(u=l.map((e=>Math.ceil(e*n))));let g=0,w=0,v=0,m=0;Array.isArray(r)&&(g=(r[0]||0)*n,w=(r[1]||0)*n,v=(r[2]||0)*n,m=(r[3]||0)*n);if(m||w||g||v){e.lineCap="butt";let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i+=m/2,o+=g/2,n=n-m/2-w/2,a=a-g/2-v/2):"content-box"===h?(i-=m/2,o-=g/2,n=n+m/2+w/2,a=a+g/2+v/2):(i=t.x,o=t.y,n=t.w,a=t.h),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i-m/2,o),e.lineTo(i+n+w/2,o),e.closePath(),e.stroke()),w&&(e.beginPath(),e.lineWidth=w,e.moveTo(i+n,o-g/2),e.lineTo(i+n,o+a+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-m/2,o+a),e.lineTo(i+n+w/2,o+a),e.closePath(),e.stroke()),m&&(e.beginPath(),e.lineWidth=m,e.moveTo(i,o-g/2),e.lineTo(i,o+a+v/2),e.closePath(),e.stroke())}else{let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i=t.x+d/2,o=t.y+d/2,n=t.w-d,a=t.h-d):"content-box"===h?(i=t.x-d/2,o=t.y-d/2,n=t.w+d,a=t.h+d):(i=t.x,o=t.y,n=t.w,a=t.h),u.length>0?e.lineCap="butt":e.lineCap="square",n=Math.max(n,1),a=Math.max(a,1),f=f.map((e=>Math.min(e,n/2,a/2))),e.setLineDash(u),e.lineWidth=d,e.beginPath(),e.moveTo(i+f[0],o),e.arcTo(i+n,o,i+n,o+a,f[1]),e.arcTo(i+n,o+a,i,o+a,f[2]),e.arcTo(i,o+a,i,o,f[3]),e.arcTo(i,o,i+n,o,f[0]),e.closePath(),e.stroke()}e.setLineDash([])}(e,t,{viewScaleInfo:s,viewSizeInfo:l}),e.globalAlpha=h}})}function Pe(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:a}=i,{shadowColor:r,shadowOffsetX:s,shadowOffsetY:l,shadowBlur:h}=o;R.number(h)?(e.save(),e.shadowColor=r||Me.shadowColor,e.shadowOffsetX=(s||0)*n.scale,e.shadowOffsetY=(l||0)*n.scale,e.shadowBlur=(h||0)*n.scale,a(),e.restore()):a()}const Te={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Ee(e,t,i){var o;if(!0!==(null===(o=null==t?void 0:t.operations)||void 0===o?void 0:o.invisible))try{switch(t.type){case"rect":!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize(t,n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});J(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{Pe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Re(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{background:a="#000000",borderColor:r="#000000",boxSizing:s,borderWidth:l=0}=o;let h=0;"number"==typeof l&&l>0?h=l:Array.isArray(l)&&"number"==typeof l[0]&&l[0]>0&&(h=l[0]);const{calculator:c,viewScaleInfo:d,viewSizeInfo:f,parentOpacity:u}=i,{x:g,y:w,w:v,h:m}=(null==c?void 0:c.elementSize({x:t.x,y:t.y,w:t.w,h:t.h},d,f))||t,y=Object.assign(Object.assign({},t),{x:g,y:w,w:v,h:m,angle:n});J(e,{x:g,y:w,w:v,h:m,angle:n},(()=>{Pe(e,y,{viewScaleInfo:d,viewSizeInfo:f,renderContent:()=>{let t=v/2,i=m/2;const o=g+t,n=w+i;h>0&&("border-box"===s?(t-=h,i-=h):"center-line"===s?(t-=h/2,i-=h/2):(t-=h,i-=h));const c=ze(y)*u;if(e.globalAlpha=c,"number"==typeof l&&l>0){const a=l/2+t,s=l/2+i;e.beginPath(),e.strokeStyle=r,e.lineWidth=l,e.circle(o,n,a,s,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath();const f=Ie(e,a,{viewElementSize:{x:g,y:w,w:v,h:m},viewScaleInfo:d,opacity:e.globalAlpha});e.fillStyle=f,e.circle(o,n,t,i,0,0,2*Math.PI),e.closePath(),e.fill(),e.globalAlpha=u}})}))}(e,t,i);break;case"text":!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:d,angle:f}=(null==o?void 0:o.elementSize(t,n,a))||t,u=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:d,angle:f});J(e,{x:s,y:l,w:h,h:d,angle:f},(()=>{Re(e,u,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:d,angle:f},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const i=Object.assign(Object.assign({},Te),t.detail),o=(i.fontSize||Te.fontSize)*n.scale,a=i.lineHeight?i.lineHeight*n.scale:o;e.fillStyle=t.detail.color||Te.color,e.textBaseline="top",e.$setFont({fontWeight:i.fontWeight,fontSize:o,fontFamily:i.fontFamily});const r=i.text.replace(/\r\n/gi,"\n"),f=a,u=r.split("\n"),g=[];let w=0;u.forEach(((t,i)=>{let o="";if(t.length>0){for(let n=0;n<t.length&&(e.measureText(o+(t[n]||"")).width<e.$doPixelRatio(h)?o+=t[n]||"":(g.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),o=t[n]||"",w++),!((w+1)*f>d));n++)if(t.length-1===n&&(w+1)*f<d){g.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),i<u.length-1&&w++;break}}else g.push({text:"",width:0})}));let v=0;g.length*f<d&&("top"===t.detail.verticalAlign?v=0:"bottom"===t.detail.verticalAlign?v+=d-g.length*f:v+=(d-g.length*f)/2);{const t=l+v;void 0!==i.textShadowColor&&c(i.textShadowColor)&&(e.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&R.number(i.textShadowOffsetX)&&(e.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&R.number(i.textShadowOffsetY)&&(e.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&R.number(i.textShadowBlur)&&(e.shadowBlur=i.textShadowBlur),g.forEach(((o,n)=>{let a=s;"center"===i.textAlign?a=s+(h-o.width)/2:"right"===i.textAlign&&(a=s+(h-o.width)),e.fillText(o.text,a,t+f*n)}))}}})}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t,u=Object.assign(Object.assign({},t),{x:l,y:h,w:c,h:d,angle:f});J(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{Pe(e,u,{viewScaleInfo:a,viewSizeInfo:r,renderContent:()=>{Re(e,u,{originElem:t,calcElemSize:{x:l,y:h,w:c,h:d,angle:f},viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s,renderContent:()=>{if(o||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=ze(t)*s;const{x:i,y:n,w:l,h:h,radiusList:c}=xe(u,{viewScaleInfo:a,viewSizeInfo:r});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+c[0],n),e.arcTo(i+l,n,i+l,n+h,c[1]),e.arcTo(i+l,n+h,i,n+h,c[2]),e.arcTo(i,n+h,i,n,c[3]),e.arcTo(i,n,i+l,n,c[0]),e.closePath(),e.fill(),e.clip(),e.drawImage(o,i,n,l,h),e.globalAlpha=s,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t;J(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=ze(t)*s,e.drawImage(o,l,h,c,d),e.globalAlpha=s)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t;J(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=ze(t)*s,e.drawImage(o,l,h,c,d),e.globalAlpha=s)}))}(e,t,i);break;case"path":!function(e,t,i){const{detail:o}=t,{originX:n,originY:a,originW:r,originH:s}=o,{calculator:l,viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d}=i,{x:f,y:u,w:g,h:w,angle:v}=(null==l?void 0:l.elementSize(t,h,c))||t,m=g/r,y=w/s,p=f-n*m,x=u-a*y,S=h.scale*c.devicePixelRatio,b=Object.assign(Object.assign({},t),{x:f,y:u,w:g,h:w,angle:v});J(e,{x:f,y:u,w:g,h:w,angle:v},(()=>{Re(e,b,{originElem:t,calcElemSize:{x:f,y:u,w:g,h:w,angle:v},viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d,renderContent:()=>{Pe(e,b,{viewScaleInfo:h,viewSizeInfo:c,renderContent:()=>{e.save(),e.translate(p,x),e.scale(S*m/h.scale,S*y/h.scale);const t=me(o.commands||[]),i=new Path2D(t);o.fill&&(e.fillStyle=o.fill,e.fill(i)),o.stroke&&0!==o.strokeWidth&&(e.strokeStyle=o.stroke,e.lineWidth=(o.strokeWidth||1)/c.devicePixelRatio,e.lineCap=o.strokeLineCap||"square",e.stroke(i)),e.translate(-p,-x),e.restore()}})}})}))}(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});J(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{e.globalAlpha=ze(t)*r,Pe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Re(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const{x:o,y:s,w:l,h:h,radiusList:c}=xe(f,{viewScaleInfo:n,viewSizeInfo:a});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(o+c[0],s),e.arcTo(o+l,s,o+l,s+h,c[1]),e.arcTo(o+l,s+h,o,s+h,c[2]),e.arcTo(o,s+h,o,s,c[3]),e.arcTo(o,s,o+l,s,c[0]),e.closePath(),e.fill(),e.clip()),Array.isArray(t.detail.children)){const{parentElementSize:o}=i,n={x:o.x+t.x,y:o.y+t.y,w:t.w||o.w,h:t.h||o.h,angle:t.angle},{calculator:a}=i;for(let o=0;o<t.detail.children.length;o++){let s=t.detail.children[o];if(s=Object.assign(Object.assign({},s),{x:n.x+s.x,y:n.y+s.y}),!0===i.forceDrawAll||(null==a?void 0:a.isElementInView(s,i.viewScaleInfo,i.viewSizeInfo)))try{Ee(e,s,Object.assign(Object.assign({},i),{parentOpacity:r*ze(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=r}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const Ce={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};var We,Oe,je,ke,De,Le,Ye,Be,Fe,Ge,Ne,Xe=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))},Ve=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)},He=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i};const Ze=["image","svg","html"],Qe=e=>{var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),"string"==typeof n&&n?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${n}`)?n:g(n):g(`${f()}-${e.uuid}-${f()}-${f()}`)};class $e extends L{constructor(){super(),We.add(this),Oe.set(this,{}),je.set(this,{}),ke.set(this,{}),Ve(this,We,"m",De).call(this,"image",((e,t)=>Xe(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.src])||void 0===i?void 0:i.value)||e.detail.src,n=yield x(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),Ve(this,We,"m",De).call(this,"html",((e,t)=>Xe(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.html])||void 0===i?void 0:i.value)||e.detail.html,n=yield b(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),Ve(this,We,"m",De).call(this,"svg",((e,t)=>Xe(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.svg])||void 0===i?void 0:i.value)||e.detail.svg,n=yield S(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}destroy(){He(this,Oe,null,"f"),He(this,je,null,"f"),He(this,ke,null,"f")}load(e,t){Ve(this,We,"m",Ne).call(this,e)||Ze.includes(e.type)&&Ve(this,We,"m",Ge).call(this,e,t)}getContent(e){var t,i;const o=Qe(e);return(null===(i=null===(t=Ve(this,ke,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return Ve(this,ke,"f")}setLoadItemMap(e){He(this,ke,e,"f")}}Oe=new WeakMap,je=new WeakMap,ke=new WeakMap,We=new WeakSet,De=function(e,t){Ve(this,Oe,"f")[e]=t},Le=function(e){var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),n},Ye=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:Ve(this,We,"m",Le).call(this,e)}},Be=function(e){const t=Qe(e.element),i=Ve(this,ke,"f")[t];i?i.startTime<e.startTime&&(Ve(this,ke,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(Ve(this,ke,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime})))},Fe=function(e){const t=Qe(e.element),i=Ve(this,ke,"f")[t];i?i.startTime<e.startTime&&(Ve(this,ke,"f")[t]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(Ve(this,ke,"f")[t]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime})))},Ge=function(e,t){const i=Ve(this,We,"m",Ye).call(this,e),o=Qe(e);Ve(this,je,"f")[o]=i;const n=Ve(this,Oe,"f")[e.type];"function"==typeof n&&(i.startTime=Date.now(),n(e,t).then((e=>{i.content=e.content,i.endTime=Date.now(),i.status="load",Ve(this,We,"m",Be).call(this,i)})).catch((t=>{console.warn(`Load element source "${i.source}" fail`,t,e),i.endTime=Date.now(),i.status="error",i.error=t,Ve(this,We,"m",Fe).call(this,i)})))},Ne=function(e){var t;const i=Qe(e),o=null===(t=Ve(this,je,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==Ve(this,We,"m",Le).call(this,e))};var Ue,Je,Ke,qe,_e=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},et=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class tt extends L{constructor(e){super(),Ue.add(this),Je.set(this,void 0),Ke.set(this,new $e),_e(this,Je,e,"f"),et(this,Ue,"m",qe).call(this)}destroy(){_e(this,Je,null,"f"),et(this,Ke,"f").destroy(),_e(this,Ke,null,"f")}updateOptions(e){_e(this,Je,e,"f")}drawData(e,t){const i=et(this,Ke,"f"),{calculator:o}=et(this,Je,"f"),n=et(this,Je,"f").viewContext;n.clearRect(0,0,n.canvas.width,n.canvas.height);const a={x:0,y:0,w:t.viewSizeInfo.width,h:t.viewSizeInfo.height};e.underlay&&function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,s=Object.assign({uuid:"underlay"},t),{x:l,y:h,w:c,h:d}=(null==o?void 0:o.elementSize(s,n,a))||s,f=Object.assign(Object.assign({},s),{x:l,y:h,w:c,h:d,angle:0});Pe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Re(e,f,{originElem:s,calcElemSize:{x:l,y:h,w:c,h:d,angle:0},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{}})}})}(n,e.underlay,Object.assign({loader:i,calculator:o,parentElementSize:a,parentOpacity:1},t)),function(e,t,i){var o;const{elements:n=[]}=t,{parentOpacity:a}=i;for(let t=0;t<n.length;t++){const r=n[t],s=Object.assign(Object.assign({},r),{detail:Object.assign(Object.assign({},Ce),null==r?void 0:r.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.isElementInView(s,i.viewScaleInfo,i.viewSizeInfo)))try{Ee(e,s,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(e){console.error(e)}}}(n,e,Object.assign({loader:i,calculator:o,parentElementSize:a,elementAssets:e.assets,parentOpacity:1},t))}scale(e){const{sharer:t}=et(this,Je,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r,width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){et(this,Ke,"f").setLoadItemMap(e)}getLoadItemMap(){return et(this,Ke,"f").getLoadItemMap()}getLoader(){return et(this,Ke,"f")}}Je=new WeakMap,Ke=new WeakMap,Ue=new WeakSet,qe=function(){const e=et(this,Ke,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(()=>{}))};var it,ot=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},nt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class at{constructor(e){it.set(this,void 0),ot(this,it,e,"f")}destroy(){ot(this,it,null,"f")}elementSize(e,t,i){return se(e,{viewScaleInfo:t,viewSizeInfo:i})}isElementInView(e,t,i){return function(e,t){const{viewSizeInfo:i,viewScaleInfo:o}=t,{width:n,height:a}=i,{angle:r}=e,{x:s,y:l,w:h,h:c}=se(e,{viewScaleInfo:o,viewSizeInfo:i}),d=ie({x:s,y:l,w:h,h:c,angle:r}),f={x:0,y:0,w:n,h:a},u=Math.min(d[0].x,d[1].x,d[2].x,d[3].x),g=Math.min(d[0].y,d[1].y,d[2].y,d[3].y);return function(e,t){const i=e.x,o=e.y,n=e.x+e.w,a=e.y+e.h,r=t.x,s=t.y,l=t.x+t.w,h=t.y+t.h;return i<=l&&n>=r&&o<=h&&a>=s}(f,{x:u,y:g,w:Math.max(d[0].x,d[1].x,d[2].x,d[3].x)-u,h:Math.max(d[0].y,d[1].y,d[2].y,d[3].y)-g})}(e,{viewScaleInfo:t,viewSizeInfo:i})}isPointInElement(e,t,i,o){return ce(e,{context2d:nt(this,it,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=nt(this,it,"f").viewContext;return function(e,t){var i,o,n;const{context2d:a,data:r,viewScaleInfo:s,viewSizeInfo:l,groupQueue:h}=t,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let t=h.length-1;t>=0;t--){let n=0,r=0,d=0;for(let e=0;e<=t;e++)n+=h[e].x,r+=h[e].y,d+=h[e].angle||0;const f=h[t];if(f&&"group"===f.type&&Array.isArray(null===(i=f.detail)||void 0===i?void 0:i.children))for(let i=0;i<f.detail.children.length;i++){const u=f.detail.children[i];if(!0!==(null===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(ce(e,{context2d:a,element:{x:n+u.x,y:r+u.y,w:u.w,h:u.h,angle:d+(u.angle||0)},viewScaleInfo:s,viewSizeInfo:l})){c.element=u,(t<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=t);break}}}if(c.element)break}if(c.element)return c;for(let t=r.elements.length-1;t>=0;t--){const i=r.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&ce(e,{context2d:a,element:i,viewScaleInfo:s,viewSizeInfo:l})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}}it=new WeakMap;var rt,st,lt,ht,ct,dt,ft,ut,gt,wt,vt,mt,yt,pt,xt,St=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},bt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};function At(e){return e>0||e<0||0===e}class It extends L{constructor(e){super(),rt.add(this),st.set(this,void 0),lt.set(this,void 0),ct.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;const t=bt(this,rt,"m",pt).call(this,e);if(!bt(this,rt,"m",xt).call(this,t))return;e.preventDefault(),e.stopPropagation();const i=e.deltaX>0||e.deltaX<0?e.deltaX:0,o=e.deltaY>0||e.deltaY<0?e.deltaY:0;!0===e.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:o,point:t}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:o,point:t})})),dt.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);bt(this,rt,"m",xt).call(this,t)})),ft.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);if(!bt(this,rt,"m",xt).call(this,t))return;const i=Date.now(),o=bt(this,lt,"f").get("prevClickPoint");o&&i-o.t<=500&&Math.abs(o.x-t.x)<=5&&Math.abs(o.y-t.y)<=5?this.trigger("doubleClick",{point:t}):bt(this,lt,"f").set("prevClickPoint",t)})),ut.set(this,(e=>{if(bt(this,lt,"f").set("hasPointDown",!1),!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);this.trigger("pointLeave",{point:t})})),gt.set(this,(e=>{if(bt(this,lt,"f").set("hasPointDown",!1),!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);this.trigger("pointEnd",{point:t})})),wt.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=bt(this,rt,"m",pt).call(this,e);bt(this,rt,"m",xt).call(this,t)?!0===bt(this,lt,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):bt(this,lt,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),bt(this,lt,"f").set("hasPointDown",!1))})),vt.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);bt(this,rt,"m",xt).call(this,t)&&(bt(this,lt,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),mt.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);bt(this,rt,"m",xt).call(this,t)&&this.trigger("hover",{point:t})}));const t=new H({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});St(this,lt,t,"f"),St(this,st,e,"f"),bt(this,rt,"m",ht).call(this)}destroy(){const e=window;e.removeEventListener("mousemove",bt(this,mt,"f")),e.removeEventListener("mousedown",bt(this,vt,"f")),e.removeEventListener("mousemove",bt(this,wt,"f")),e.removeEventListener("mouseup",bt(this,gt,"f")),e.removeEventListener("mouseleave",bt(this,ut,"f")),e.removeEventListener("wheel",bt(this,ct,"f")),e.removeEventListener("click",bt(this,ft,"f")),e.removeEventListener("contextmenu",bt(this,dt,"f")),this.destroy()}}st=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,ft=new WeakMap,ut=new WeakMap,gt=new WeakMap,wt=new WeakMap,vt=new WeakMap,mt=new WeakMap,rt=new WeakSet,ht=function(){const e=window;e.addEventListener("mousemove",bt(this,mt,"f")),e.addEventListener("mousedown",bt(this,vt,"f")),e.addEventListener("mousemove",bt(this,wt,"f")),e.addEventListener("mouseup",bt(this,gt,"f")),e.addEventListener("mouseleave",bt(this,ut,"f")),e.addEventListener("wheel",bt(this,ct,"f"),{passive:!1}),e.addEventListener("click",bt(this,ft,"f")),e.addEventListener("contextmenu",bt(this,dt,"f"))},yt=function(e){return e.target===bt(this,st,"f").boardContent.boardContext.canvas},pt=function(e){const t=bt(this,st,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},xt=function(e){const t=bt(this,st,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!(At(e.x)&&At(e.y)&&e.x<=i&&e.y<=o)};var Mt,zt,Rt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Pt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const Tt={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class Et{constructor(){Mt.set(this,void 0),zt.set(this,void 0);const e=new H({defaultStorage:Tt}),t=new H({defaultStorage:{}});Rt(this,Mt,e,"f"),Rt(this,zt,t,"f")}getActiveStorage(e){return Pt(this,Mt,"f").get(e)}setActiveStorage(e,t){return Pt(this,Mt,"f").set(e,t)}getActiveStoreSnapshot(){return Pt(this,Mt,"f").getSnapshot()}getSharedStorage(e){return Pt(this,zt,"f").get(e)}setSharedStorage(e,t){return Pt(this,zt,"f").set(e,t)}getSharedStoreSnapshot(){return Pt(this,zt,"f").getSnapshot()}getActiveViewScaleInfo(){return{scale:Pt(this,Mt,"f").get("scale"),offsetTop:Pt(this,Mt,"f").get("offsetTop"),offsetBottom:Pt(this,Mt,"f").get("offsetBottom"),offsetLeft:Pt(this,Mt,"f").get("offsetLeft"),offsetRight:Pt(this,Mt,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;Pt(this,Mt,"f").set("scale",t),Pt(this,Mt,"f").set("offsetTop",i),Pt(this,Mt,"f").set("offsetBottom",o),Pt(this,Mt,"f").set("offsetLeft",n),Pt(this,Mt,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){Pt(this,Mt,"f").set("width",e.width),Pt(this,Mt,"f").set("height",e.height),Pt(this,Mt,"f").set("devicePixelRatio",e.devicePixelRatio),Pt(this,Mt,"f").set("contextWidth",e.contextWidth),Pt(this,Mt,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:Pt(this,Mt,"f").get("width"),height:Pt(this,Mt,"f").get("height"),devicePixelRatio:Pt(this,Mt,"f").get("devicePixelRatio"),contextWidth:Pt(this,Mt,"f").get("contextWidth"),contextHeight:Pt(this,Mt,"f").get("contextHeight")}}}Mt=new WeakMap,zt=new WeakMap;var Ct,Wt,Ot,jt,kt,Dt,Lt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Yt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const{requestAnimationFrame:Bt}=window;class Ft extends L{constructor(e){super(),Ct.add(this),Wt.set(this,void 0),Ot.set(this,[]),jt.set(this,"FREE"),Lt(this,Wt,e,"f"),Yt(this,Ct,"m",kt).call(this)}drawFrame(){const{sharer:e}=Yt(this,Wt,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();Yt(this,Ot,"f").push({activeStore:t,sharedStore:i}),Yt(this,Ct,"m",Dt).call(this)}scale(e){const{scale:t,point:i}=e,{sharer:o}=Yt(this,Wt,"f"),{moveX:n,moveY:a}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:a}=o,r=t/o.scale,s=i.x,l=i.y;return{moveX:s-s*r+(n*r-n),moveY:l-l*r+(a*r-a)}}({scale:t,point:i,viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()});return o.setActiveStorage("scale",t),{moveX:n,moveY:a}}scroll(e){const{sharer:t}=Yt(this,Wt,"f"),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n}=e,a=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:a}=o,{width:r,height:s,contextWidth:l,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,f=o.offsetTop,u=o.offsetBottom;return c+=t,f+=i,d=r-(l*a+c),u=s-(h*a+f),{scale:a,offsetTop:f,offsetLeft:c,offsetRight:d,offsetBottom:u}}({moveX:o,moveY:n,viewScaleInfo:i,viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(a),a}updateViewScaleInfo(e){const{sharer:t}=Yt(this,Wt,"f"),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:a}=t,{width:r,height:s,contextWidth:l,contextHeight:h}=a,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:r-(l*i+c/i),offsetBottom:s-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),i}resize(e={}){const{sharer:t}=Yt(this,Wt,"f"),i=t.getActiveViewSizeInfo(),o=Object.assign(Object.assign({},i),e),{width:n,height:a,devicePixelRatio:r}=o,{underContext:s,boardContext:l,helperContext:h,viewContext:c}=Yt(this,Wt,"f").boardContent;return l.canvas.width=n*r,l.canvas.height=a*r,l.canvas.style.width=`${n}px`,l.canvas.style.height=`${a}px`,s.canvas.width=n*r,s.canvas.height=a*r,h.canvas.width=n*r,h.canvas.height=a*r,c.canvas.width=n*r,c.canvas.height=a*r,t.setActiveViewSizeInfo(o),o}}Wt=new WeakMap,Ot=new WeakMap,jt=new WeakMap,Ct=new WeakSet,kt=function(){const{renderer:e}=Yt(this,Wt,"f");e.on("load",(()=>{this.drawFrame()}))},Dt=function e(){if("DRAWING"===Yt(this,jt,"f")||0===Yt(this,Ot,"f").length)return;Lt(this,jt,"DRAWING","f");const t=Yt(this,Ot,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=Yt(this,Wt,"f");if(t){const{scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h,width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g}=t.activeStore,w={scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h},v={width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g};(null==t?void 0:t.activeStore.data)&&i.drawData(t.activeStore.data,{viewScaleInfo:w,viewSizeInfo:v}),n({snapshot:t}),o.drawView(),a({snapshot:t})}0!==Yt(this,Ot,"f").length?Lt(this,jt,"DRAWING","f")&&Bt((()=>{Yt(this,Ct,"m",e).call(this)})):Lt(this,jt,"COMPLETE","f")};var Gt,Nt,Xt,Vt,Ht,Zt,Qt,$t,Ut,Jt,Kt,qt,_t,ei,ti,ii,oi,ni,ai,ri,si,li,hi,ci,di,fi,ui=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},gi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class wi{constructor(e){Gt.add(this),Nt.set(this,void 0),Xt.set(this,new WeakMap),Vt.set(this,[]),Ht.set(this,[]),Zt.set(this,void 0),Qt.set(this,void 0),$t.set(this,void 0),Ut.set(this,void 0),Jt.set(this,void 0),Kt.set(this,new L);const{boardContent:t}=e,i=new Et,o=new at({viewContext:t.viewContext}),n=new It({boardContent:t,sharer:i}),a=new tt({viewContext:t.viewContext,sharer:i,calculator:o});ui(this,Nt,e,"f"),ui(this,$t,i,"f"),ui(this,Zt,n,"f"),ui(this,Qt,a,"f"),ui(this,Jt,o,"f"),ui(this,Ut,new Ft({boardContent:e.boardContent,sharer:i,renderer:a,calculator:gi(this,Jt,"f"),beforeDrawFrame:e=>{gi(this,Gt,"m",ci).call(this,e)},afterDrawFrame:e=>{gi(this,Gt,"m",di).call(this,e)}}),"f"),gi(this,Gt,"m",qt).call(this),gi(this,Gt,"m",fi).call(this)}destroy(){gi(this,Zt,"f").destroy(),gi(this,Qt,"f").destroy(),gi(this,Jt,"f").destroy(),gi(this,Kt,"f").destroy()}getSharer(){return gi(this,$t,"f")}getViewer(){return gi(this,Ut,"f")}getRenderer(){return gi(this,Qt,"f")}setData(e){const t=gi(this,$t,"f");gi(this,$t,"f").setActiveStorage("data",e);const i=t.getActiveViewSizeInfo(),o=re(e.elements,{viewWidth:i.width,viewHeight:i.height,extend:!0});gi(this,Ut,"f").drawFrame();const n=Object.assign(Object.assign({},i),o);return gi(this,$t,"f").setActiveViewSizeInfo(n),{viewSizeInfo:n}}getData(){const{data:e}=gi(this,$t,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(gi(this,Xt,"f").has(e)){const o=gi(this,Xt,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",gi(this,Xt,"f").set(e,o),void gi(this,Gt,"m",fi).call(this)}const{boardContent:n,container:a}=gi(this,Nt,"f"),r=e({boardContent:n,sharer:gi(this,$t,"f"),viewer:gi(this,Ut,"f"),calculator:gi(this,Jt,"f"),eventHub:gi(this,Kt,"f"),container:a});null===(o=r.use)||void 0===o||o.call(r),gi(this,Vt,"f").push(e),gi(this,Ht,"f").push(r),gi(this,Xt,"f").set(e,{status:"enable",middlewareObject:r}),gi(this,Gt,"m",fi).call(this)}disuse(e){var t,i;const o=gi(this,Xt,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",gi(this,Xt,"f").set(e,o),gi(this,Gt,"m",fi).call(this))}scale(e){const t=gi(this,Ut,"f"),{moveX:i,moveY:o}=t.scale(e);t.scroll({moveX:i,moveY:o})}scroll(e){return gi(this,Ut,"f").scroll(e)}updateViewScaleInfo(e){return gi(this,Ut,"f").updateViewScaleInfo(e)}resize(e){const t=gi(this,Ut,"f").resize(e),{width:i,height:o,devicePixelRatio:n}=e,{boardContent:a}=gi(this,Nt,"f");a.viewContext.$resize({width:i,height:o,devicePixelRatio:n}),a.helperContext.$resize({width:i,height:o,devicePixelRatio:n}),a.boardContext.$resize({width:i,height:o,devicePixelRatio:n}),a.underContext.$resize({width:i,height:o,devicePixelRatio:n}),gi(this,Ut,"f").drawFrame(),gi(this,Zt,"f").trigger("resize",t),gi(this,$t,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=gi(this,Nt,"f"),{underContext:t,helperContext:i,viewContext:o,boardContext:n}=e;t.clearRect(0,0,t.canvas.width,t.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),gi(this,Gt,"m",hi).call(this)}getEventHub(){return gi(this,Kt,"f")}}Nt=new WeakMap,Xt=new WeakMap,Vt=new WeakMap,Ht=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,$t=new WeakMap,Ut=new WeakMap,Jt=new WeakMap,Kt=new WeakMap,Gt=new WeakSet,qt=function(){gi(this,Zt,"f").on("pointStart",gi(this,Gt,"m",_t).bind(this)),gi(this,Zt,"f").on("pointEnd",gi(this,Gt,"m",ei).bind(this)),gi(this,Zt,"f").on("pointMove",h((e=>{gi(this,Gt,"m",ti).call(this,e)}),10)),gi(this,Zt,"f").on("hover",h((e=>{gi(this,Gt,"m",ii).call(this,e)}),10)),gi(this,Zt,"f").on("wheel",h((e=>{gi(this,Gt,"m",ni).call(this,e)}),10)),gi(this,Zt,"f").on("wheelScale",h((e=>{gi(this,Gt,"m",ai).call(this,e)}),10)),gi(this,Zt,"f").on("scrollX",gi(this,Gt,"m",ri).bind(this)),gi(this,Zt,"f").on("scrollY",gi(this,Gt,"m",si).bind(this)),gi(this,Zt,"f").on("resize",gi(this,Gt,"m",li).bind(this)),gi(this,Zt,"f").on("doubleClick",gi(this,Gt,"m",oi).bind(this))},_t=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},ei=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},ti=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointMove)||void 0===t?void 0:t.call(o,e)))return}},ii=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},oi=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},ni=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},ai=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheelScale)||void 0===t?void 0:t.call(o,e)))return}},ri=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},si=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},li=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},hi=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.clear)||void 0===t?void 0:t.call(o,e)))return}},ci=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},di=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},fi=function(){const e=[],t=gi(this,Xt,"f");gi(this,Vt,"f").forEach((i=>{const o=t.get(i);"enable"===(null==o?void 0:o.status)&&(null==o?void 0:o.middlewareObject)&&e.push(o.middlewareObject)})),ui(this,Ht,e,"f")};const vi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0I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1jQFSX18/lg68cuXKLUAaGxs3vkB7e/u3wHHgCQpUdnpTqdQvesJgMDisUVevXh3Xry9fvnxTv66qqprQ/cfHx/vVNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";class mi{constructor(e,t){this._cursorType=null,this._resizeCursorBaseImage=null,this._cursorImageMap={auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8v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14CnpY+oij35km0qwmjwqAU8ISM9hIwBeQA17KsG9PT07+1gxsZGdmgdqW+BjwLDAAPoo4ALU+W9arVwWoIpXp9kouKZpPAO8AwQCwW+2d0dLQ0OTkZSafT0UKhUJ6bm9t2HKeysrIS3tra0g7+KvABUJC0g5rrJdRcbLpImtleRzYashc1P2OSXwbebDVykX3gW+Ab1AHqhuQ3pe6AJlFMO0CoPROHDcio5I8DL1A9C8dQbmod+APYAK4DvwjQnsDdErgyVTfTEaCG1GFYGHXG7TVSo2OkdvhlAflXoHSuNdfStFqaRhEi2kfdprrj6M5LAt0I8EDaaMdflPal48CB95hMr3Bt8h4jD0kyL5E0pN6dysZzW7N2AqjbmhdIZjJvufTOpE19x3g+9s1XJ/ck5tVbfdhu+rxDfLiSO+lFToCjZwrXyH2/0Lwv95z8B1jAqXmDnj4YAAAAAElFTkSuQmCC","rotate-0":vi},this._container=e,this._eventHub=t.eventHub,this._init(),this._loadResizeCursorBaseImage()}_init(){const{_eventHub:e}=this;this._resetCursor("auto"),e.on("cursor",(e=>{var t;"over-element"!==e.type&&e.type?"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?this._setCursorResize(e):"drag-default"===e.type?this._resetCursor("drag-default"):"drag-active"===e.type?this._resetCursor("drag-active"):this._resetCursor("auto"):this._resetCursor("auto")}))}_loadResizeCursorBaseImage(){x(vi).then((e=>{this._resizeCursorBaseImage=e})).catch((e=>{console.error(e)}))}_resetCursor(e){if(this._cursorType===e)return;this._cursorType=e;const t=this._cursorImageMap[this._cursorType]||this._cursorImageMap.auto;let i=0,o=0;e.startsWith("rotate-")&&this._cursorImageMap[this._cursorType]&&(i=10,o=10),this._container.style.cursor=`image-set(url(${t})2x) ${i} ${o}, auto`}_setCursorResize(e){var t;let i=0;"resize-top"===e.type?i+=0:"resize-top-right"===e.type?i+=45:"resize-right"===e.type?i+=90:"resize-bottom-right"===e.type?i+=135:"resize-bottom"===e.type?i+=180:"resize-bottom-left"===e.type?i+=225:"resize-left"===e.type?i+=270:"resize-top-left"===e.type&&(i+=315),i+=ne((null==(t=null==e?void 0:e.element)?void 0:t.angle)||0),Array.isArray(e.groupQueue)&&e.groupQueue.length>0&&e.groupQueue.forEach((e=>{i+=ne(e.angle||0)})),i=ne(i);const o=this._appendRotateResizeImage(i);this._resetCursor(o)}_appendRotateResizeImage(e){const t=`rotate-${e}`;if(!this._cursorImageMap[t]){const i=this._resizeCursorBaseImage;if(i){const o=document.createElement("canvas"),n=i.width,a=i.height,r={x:n/2,y:a/2};o.width=n,o.height=a;const s=o.getContext("2d"),l=$(e);s.translate(r.x,r.y),s.rotate(l),s.translate(-r.x,-r.y),s.drawImage(i,0,0,n,a),s.translate(r.x,r.y),s.rotate(-l),s.translate(-r.x,-r.y);const h=o.toDataURL("image/png");this._cursorImageMap[t]=h}}return t}}const yi="SELECT",pi=Symbol(`${yi}_actionType`),xi=Symbol(`${yi}_resizeType`),Si=Symbol(`${yi}_areaStart`),bi=Symbol(`${yi}_areaEnd`),Ai=Symbol(`${yi}_hoverElement`),Ii=Symbol(`${yi}_hoverElementVertexes`),Mi=Symbol(`${yi}_selectedElementList`),zi=Symbol(`${yi}_selectedElementListVertexes`),Ri=Symbol(`${yi}_selectedElementController`),Pi=Symbol(`${yi}_groupQueue`),Ti=Symbol(`${yi}_groupQueueVertexesList`),Ei="#1973ba";function Ci(e,t,i){const{borderColor:o,borderWidth:n,background:a,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=a,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[0].x,t[0].y),e.closePath(),e.stroke(),e.fill()}function Wi(e,t,i){if(!t)return;const o={borderColor:Ei,borderWidth:1,background:"transparent",lineDash:[]};Ci(e,he(t,i),o)}function Oi(e,t,i){if(!t)return;const{elementWrapper:o,topLeft:n,topRight:a,bottomLeft:r,bottomRight:s}=t,l={borderColor:Ei,borderWidth:2,background:"transparent",lineDash:[]},h={...l,borderWidth:4,background:"#FFFFFF"};Ci(e,he(o,i),l),Ci(e,he(n.vertexes,i),h),Ci(e,he(a.vertexes,i),h),Ci(e,he(r.vertexes,i),h),Ci(e,he(s.vertexes,i),h)}function ji(e){return e*Math.PI/180}function ki(e,t){return Math.sqrt(e*e+t*t)}function Di(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function Li(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,vertexes:a}=t,r=le(a[0],{viewScaleInfo:o,viewSizeInfo:n}),s=le(a[1],{viewScaleInfo:o,viewSizeInfo:n}),l=le(a[2],{viewScaleInfo:o,viewSizeInfo:n}),h=le(a[3],{viewScaleInfo:o,viewSizeInfo:n});return i.beginPath(),i.moveTo(r.x,r.y),i.lineTo(s.x,s.y),i.lineTo(l.x,l.y),i.lineTo(h.x,h.y),i.lineTo(r.x,r.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function Yi(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:a}=t;if(!(a&&(null==a?void 0:a.length)>0))return!1;const r=ue(a),s=r[r.length-1];return!!s&&Li(e,{ctx:i,vertexes:s,viewScaleInfo:o,viewSizeInfo:n})}function Bi(e,t){var i,o,n;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:r,data:s,calculator:l,selectedElements:h,viewScaleInfo:c,viewSizeInfo:d,areaSize:f,groupQueue:u,selectedElementController:g}=t;if(g){const{left:t,right:i,top:o,bottom:n,topLeft:s,topRight:l,bottomLeft:f,bottomRight:w}=g,v=[t,i,o,n,s,l,f,w];for(let t=0;t<v.length;t++){const i=v[t];if(Li(e,{ctx:r,vertexes:i.vertexes,viewSizeInfo:d,viewScaleInfo:c})){a.type=`resize-${i.type}`,h&&(null==h?void 0:h.length)>0&&(a.groupQueue=u||[],a.elements=[h[0]]);break}}}if(u&&Array.isArray(u)&&u.length>0){const t=u[u.length-1];if((null==(i=null==t?void 0:t.detail)?void 0:i.children)&&Array.isArray(null==(o=null==t?void 0:t.detail)?void 0:o.children))for(let i=t.detail.children.length-1;i>=0;i--){const o=t.detail.children[i],n=ge(o,{groupQueue:u});if(n&&Li(e,{ctx:r,vertexes:n,viewScaleInfo:c,viewSizeInfo:d}))return a.type||(a.type="over-element"),a.groupQueue=u,a.elements=[o],a}return a}if(null!==a.type)return a;if(f&&Array.isArray(h)&&(null==h?void 0:h.length)>1){const{x:t,y:i,w:o,h:n}=f;if(e.x>=t&&e.x<=t+o&&e.y>=i&&e.y<=i+n)return a.type="list-area",a.elements=h,a}if(s){const{index:t,element:i}=l.getPointElement(e,{data:s,viewScaleInfo:c,viewSizeInfo:d});if(t>=0&&i&&!0!==(null==(n=null==i?void 0:i.operations)?void 0:n.invisible))return a.elements=[i],a.type="over-element",a}return a}function Fi(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{calculator:n,viewScaleInfo:a,viewSizeInfo:r}=t;let s=null;for(let t=0;t<e.length;t++){const l=e[t];if(null==(i=null==l?void 0:l.operations)?void 0:i.invisible)continue;const h=n.elementSize(l,a,r);if(h.angle&&(h.angle>0||h.angle<0)){const e=ie(h);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];h.x=Math.min(...t),h.y=Math.min(...i),h.w=Math.abs(Math.max(...t)-Math.min(...t)),h.h=Math.abs(Math.max(...i)-Math.min(...i))}}if(s){const e=Math.min(h.x,o.x),t=Math.min(h.y,o.y),i=Math.max(h.x+h.w,o.x+o.w),n=Math.max(h.y+h.h,o.y+o.h);o.x=e,o.y=t,o.w=Math.abs(i-e),o.h=Math.abs(n-t)}else o.x=h.x,o.y=h.y,o.w=h.w,o.h=h.h;s=h}return o}const Gi="@middleware/text-edit",Ni={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"},Xi="@middleware/select",Vi="@middleware/select-clear",Hi="SCROLL",Zi=Symbol(`${Hi}_xThumbRect`),Qi=Symbol(`${Hi}_yThumbRect`),$i=Symbol(`${Hi}_prevPoint`),Ui=Symbol(`${Hi}_activePoint`),Ji=Symbol(`${Hi}_activeThumbType`),Ki=16,qi=.36,_i={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function eo(e,t,i){const o=e,{x:n,y:a,w:r,h:s}=i;return o.beginPath(),o.rect(n,a,r,s),o.closePath(),!!o.isPointInPath(t.x,t.y)}function to(e,t){let{x:i,y:o,h:n,w:a}=t;e.save(),e.shadowColor="#FFFFFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=1;{const{color:r,axis:s}=t;"X"===s?(o=o+n/4+0,n/=2):"Y"===s&&(i=i+a/4+0,a/=2);let l=t.r;l=Math.min(l,a/2,n/2),(a<2*l||n<2*l)&&(l=0),e.globalAlpha=qi,e.beginPath(),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.fillStyle=r,e.fill(),e.globalAlpha=1,e.beginPath(),e.lineWidth=1,e.strokeStyle=r,e.setLineDash([]),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.stroke()}e.restore()}function io(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:a}=t,{activeThumbType:r,prevPoint:s,activePoint:l}=a,h=function(e,t){const{width:i,height:o}=t,{offsetTop:n,offsetBottom:a,offsetLeft:r,offsetRight:s}=e,l=2.5*Ki,h=Ki;let c=0,d=0;c=Math.max(l,i-2*h-(Math.abs(r)+Math.abs(s))),c>=i&&(c=i),d=Math.max(l,o-2*h-(Math.abs(n)+Math.abs(a))),d>=o&&(d=o);const f=h;let u=f;r>0?u=f:s>0?u=i-c-h:r<=0&&c>0&&(0!==r||0!==s)&&(u=f+(i-c)*Math.abs(r)/(Math.abs(r)+Math.abs(s)),u=Math.min(Math.max(0,u-f),i-c));const g=h;let w=g;n>0?w=g:a>0?w=o-d-h:n<=0&&d>0&&(0!==n||0!==a)&&(w=g+(o-d)*Math.abs(n)/(Math.abs(n)+Math.abs(a)),w=Math.min(Math.max(0,w-g),o-d));const v={x:u,y:o-h,w:c,h:h},m={x:i-h,y:w,w:h,h:d};return{lineSize:h,xSize:c,ySize:d,translateY:w,translateX:u,thumbColor:_i.thumbColor,scrollBarColor:_i.scrollBarColor,xThumbRect:v,yThumbRect:m}}(o,n);let c={...h.xThumbRect},d={...h.yThumbRect};return r&&s&&l&&("X"===r&&a.xThumbRect?(c={...a.xThumbRect},c.x=c.x+(l.x-s.x)):"Y"===r&&a.yThumbRect&&(d={...a.yThumbRect},d.y=d.y+(l.y-s.y))),to(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),to(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function oo(e,t){const{snapshot:i}=t,o=Q(i),n=Z(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[Ui]||null,prevPoint:t[$i]||null,activeThumbType:t[Ji]||null,xThumbRect:t[Zi]||null,yThumbRect:t[Qi]||null}}(i),{xThumbRect:r,yThumbRect:s}=io(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:r,yThumbRect:s}}const no="@middleware/scale",ao=16,ro="#000000",so="#00000080",lo="monospace",ho="#AAAAAA20",co="#AAAAAA40";function fo(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=ye(a/t,{decimalPlaces:0}),a=Math.max(10,Math.min(a,1e3));const r=10*a,s=5*a;let l=0;const h=a*t,c=0-o,d=c%h,f=(c-d+h)/t,u=h-d+0;for(;u+l*h<i;){const e=ye(f+l*a,{decimalPlaces:0}),t={num:e,position:ye(u+l*h,{decimalPlaces:0}),showNum:e%r==0,isKeyNum:e%r==0,isSubKeyNum:e%s==0};n.push(t),l++}return n}const uo="@middleware/show-ruler",go=Symbol("DRAG_prevPoint");return t=new WeakMap,i=new WeakMap,o=new WeakSet,n=function(){r(this,i).style.position="relative"},e.Core=class{constructor(e,r){s(this,o),s(this,t,void 0),s(this,i,void 0);const{devicePixelRatio:h=1,width:c,height:d}=r;l(this,i,e);const f=document.createElement("canvas");var u,g,w;(u=this,g=o,w=n,a(u,g,"access private method"),w).call(this),e.appendChild(f);const v=function(e,t){const{width:i,height:o,devicePixelRatio:n,offscreen:a}=t,r={width:i,height:o,devicePixelRatio:n};if(!0===a){const t=e.getContext("2d"),i=j(r),o=j(r),n=j(r),a=O(Object.assign({ctx:t},r)),s=()=>{const{width:e,height:t}=i.$getSize();a.clearRect(0,0,e,t),a.drawImage(n.canvas,0,0,e,t),a.drawImage(i.canvas,0,0,e,t),a.drawImage(o.canvas,0,0,e,t),n.clearRect(0,0,e,t),i.clearRect(0,0,e,t),o.clearRect(0,0,e,t)};return{underContext:n,viewContext:i,helperContext:o,boardContext:a,drawView:s}}{const t=e.getContext("2d"),n=O(r),a=O(r),s=O(r),l=O(Object.assign({ctx:t},r)),h=()=>{l.clearRect(0,0,i,o),l.drawImage(s.canvas,0,0,i,o),l.drawImage(n.canvas,0,0,i,o),l.drawImage(a.canvas,0,0,i,o),s.clearRect(0,0,i,o),n.clearRect(0,0,i,o),a.clearRect(0,0,i,o)};return{underContext:s,viewContext:n,helperContext:a,boardContext:l,drawView:h}}}(f,{width:c,height:d,devicePixelRatio:h,offscreen:!0}),m=new wi({boardContent:v,container:e}),y=m.getSharer();y.setActiveViewSizeInfo({width:c,height:d,devicePixelRatio:h,contextWidth:c,contextHeight:d}),l(this,t,m),this.resize(y.getActiveViewSizeInfo());const p=m.getEventHub();new mi(e,{eventHub:p})}destroy(){r(this,t).destroy()}use(e){r(this,t).use(e)}disuse(e){r(this,t).disuse(e)}setData(e){ae((null==e?void 0:e.elements)||[]),r(this,t).setData(e)}getData(){return r(this,t).getData()}scale(e){r(this,t).scale(e);r(this,t).getViewer().drawFrame()}resize(e){const i=r(this,t),o=i.getSharer().getActiveViewSizeInfo();i.resize({...o,...e})}clear(){r(this,t).clear()}on(e,i){r(this,t).getEventHub().on(e,i)}off(e,i){r(this,t).getEventHub().off(e,i)}trigger(e,i){r(this,t).getEventHub().trigger(e,i)}getViewInfo(){const e=r(this,t).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){r(this,t).getViewer().drawFrame()}setViewScale(e){r(this,t).updateViewScaleInfo(e)}getLoadItemMap(){return r(this,t).getRenderer().getLoadItemMap()}},e.MiddlewareDragger=e=>{const{eventHub:t,sharer:i,viewer:o}=e;let n=!1;return{name:"@middleware/dragger",hover(){!0!==n&&t.trigger("cursor",{type:"drag-default"})},pointStart(e){const{point:o}=e;i.setSharedStorage(go,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(go);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(go,t)},pointEnd(){n=!1,i.setSharedStorage(go,null),t.trigger("cursor",{type:"drag-default"})}}},e.MiddlewareRuler=e=>{const{boardContent:t,viewer:i,eventHub:o}=e,{helperContext:n,underContext:a}=t;let r=!0,s=!0;const l=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(r=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(s=e.showGrid),"boolean"!=typeof(null==e?void 0:e.show)&&"boolean"!=typeof(null==e?void 0:e.showGrid)||i.drawFrame()};return{name:"@middleware/ruler",use(){o.on(uo,l)},disuse(){o.off(uo,l)},beforeDrawFrame:({snapshot:e})=>{if(!0===r){const t=Z(e),i=Q(e);!function(e,t){const{viewSizeInfo:i}=t,{width:o,height:n}=i;e.beginPath(),e.moveTo(0,0),e.lineTo(o+1,0),e.lineTo(o+1,ao),e.lineTo(ao,ao),e.lineTo(ao,n+1),e.lineTo(0,n+1),e.lineTo(0,0),e.closePath(),e.fillStyle="#FFFFFFA8",e.fill(),e.lineWidth=1,e.setLineDash([]),e.strokeStyle="#00000080",e.stroke()}(n,{viewScaleInfo:t,viewSizeInfo:i});const o=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetLeft:n}=t,{width:a}=i;return fo({axis:"X",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t;for(let t=0;t<i.length;t++){const o=i[t];o.position<ao||(e.beginPath(),e.moveTo(o.position,16),e.lineTo(o.position,o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8),e.closePath(),e.lineWidth=1,e.setLineDash([]),e.fillStyle=ro,e.stroke(),o.isKeyNum&&(e.fillStyle=so,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:lo}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(n,{scaleList:o});const r=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:a}=i;return fo({axis:"Y",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t,o=3.2;for(let t=0;t<i.length;t++){const n=i[t];if(!(n.position<ao)&&(e.beginPath(),e.moveTo(16,n.position),e.lineTo(n.isKeyNum?3.2:n.isSubKeyNum?6.4:12.8,n.position),e.closePath(),e.fillStyle=ro,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===n.showNum)){const t=o,i=n.position+o,a=`${n.num}`;U(e,-90,{x:t,y:i},(()=>{e.fillStyle=so,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:lo}),e.fillText(a,13.2,n.position+o)}))}}}(n,{scaleList:r}),!0===s&&function(e,t){const{xList:i,yList:o,viewSizeInfo:n}=t,{width:a,height:r}=n;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,r),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=co:e.strokeStyle=ho,e.closePath(),e.lineWidth=1,e.setLineDash([]),e.stroke()}for(let t=0;t<o.length;t++){const i=o[t];e.beginPath(),e.moveTo(0,i.position),e.lineTo(a,i.position),!0===i.isKeyNum||!0===i.isSubKeyNum?e.strokeStyle=co:e.strokeStyle=ho,e.lineWidth=1,e.closePath(),e.stroke()}}(a,{xList:o,yList:r,viewScaleInfo:t,viewSizeInfo:i})}}}},e.MiddlewareScaler=e=>{const{viewer:t,sharer:i,eventHub:o}=e;return{name:"@middleware/scaler",wheelScale(e){const{deltaY:n,point:a}=e,{scale:r}=i.getActiveViewScaleInfo();let s=r;if(n<0?s=1.1*r:n>0&&(s=.9*r),s<.05||s>50)return;const{moveX:l,moveY:h}=t.scale({scale:s,point:a});t.scroll({moveX:l,moveY:h}),t.drawFrame();const c=ye(r);o.trigger(no,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(Zi,null),o.setSharedStorage(Qi,null);const a=()=>{o.setSharedStorage($i,null),o.setSharedStorage(Ui,null),o.setSharedStorage(Ji,null)};a();const r=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&eo(e,t,n)?o="X":a&&eo(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(Zi),yThumbRect:o.getSharedStorage(Qi)});return{name:"@middleware/scroller",wheel:e=>{t.scroll({moveX:0-e.deltaX,moveY:0-e.deltaY}),t.drawFrame()},pointStart:e=>{const{point:t}=e,i=r(t);if("X"===i||"Y"===i)return o.setSharedStorage(Ji,i),o.setSharedStorage($i,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Ji);if("X"===n||"Y"===n)return o.setSharedStorage(Ui,i),"X"===n?(e=>{const i=o.getSharedStorage($i);if(i){const{offsetLeft:n,offsetRight:a}=o.getActiveViewScaleInfo(),{width:r}=o.getActiveViewSizeInfo(),s=-(e.x-i.x)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveX:s}),t.drawFrame()}})(i):"Y"===n&&(e=>{const i=o.getSharedStorage($i);if(i){const{offsetTop:n,offsetBottom:a}=o.getActiveViewScaleInfo(),{height:r}=o.getActiveViewSizeInfo(),s=-(e.y-i.y)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveY:s}),t.drawFrame()}})(i),o.setSharedStorage($i,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Ji);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=oo(n,{snapshot:e});o.setSharedStorage(Zi,t),o.setSharedStorage(Qi,i)}}},e.MiddlewareSelector=e=>{const{viewer:t,sharer:i,boardContent:o,calculator:n,eventHub:a}=e,{helperContext:r}=o;let s=null,l=null;i.setSharedStorage(pi,null);const h=()=>i.getSharedStorage(Mi),c=e=>{let t=i.getSharedStorage(Pi);Array.isArray(t)||(t=[]),t.length>0?!function(e,t){var i;if("group"===(null==t?void 0:t.type)&&Array.isArray(null==(i=null==t?void 0:t.detail)?void 0:i.children))for(let i=0;i<t.detail.children.length;i++){const o=t.detail.children[i];if(e.uuid===o.uuid)return!0}return!1}(e,t[t.length-1])?t=[]:t.push(e):0===t.length&&t.push(e);const o=ue(t);return i.setSharedStorage(Pi,t),i.setSharedStorage(Ti,o),t.length>0},d=e=>{i.setSharedStorage(Ai,e);let t=null;e&&(t=ge(e,{groupQueue:i.getSharedStorage(Pi)})),i.setSharedStorage(Ii,t)},f=(e,t)=>{if(i.setSharedStorage(Mi,e),1===e.length){const t=ve(e[0],{groupQueue:i.getSharedStorage(Pi),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Ri,t)}else i.setSharedStorage(Ri,null);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(Xi,{uuids:e.map((e=>e.uuid))})},u=()=>({ctx:r,calculator:n,data:i.getActiveStorage("data"),selectedElements:h(),viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(Pi),areaSize:null,selectedElementController:i.getSharedStorage(Ri)}),g=()=>{i.setSharedStorage(pi,null),i.setSharedStorage(xi,null),i.setSharedStorage(Si,null),i.setSharedStorage(bi,null),i.setSharedStorage(Pi,[]),i.setSharedStorage(Ti,[]),i.setSharedStorage(Ai,null),i.setSharedStorage(Ii,null),i.setSharedStorage(Mi,[]),i.setSharedStorage(zi,null),i.setSharedStorage(Ri,null)};g();const w=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage(pi),r=i.getActiveStorage("data");n=o&&Array.isArray(o)?function(e,t){const i=[];return e.forEach((e=>{const o=function(e,t){let i=null,o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t<e.length-1&&"group"===n.type)o=n.detail.children;else{if(t!==e.length-1)break;i=n}}return i}(e,t);o&&i.push(o)})),i}(o,(null==r?void 0:r.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let a=0;a<o.length;a++){const r=o[a];e.includes(r.uuid)?i.push(r):"group"===r.type&&t((null===(n=null==r?void 0:r.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==r?void 0:r.elements)||[]);let s=!1;if(a||1!==n.length?"select"===a&&1===n.length&&(s=!0):(i.setSharedStorage(pi,"select"),s=!0),s){const e=function(e,t){const i=[];return function e(t,o){var n;let a=null;for(let r=0;r<o.length;r++){const s=o[r];if(s.uuid===t){a=s;break}if(!a&&"group"===s.type){i.push(s);const o=e(t,(null===(n=null==s?void 0:s.detail)||void 0===n?void 0:n.children)||[]);if((null==o?void 0:o.uuid)===t){a=o;break}i.pop()}}return a}(e,t),i}(n[0].uuid,(null==r?void 0:r.elements)||[]);i.setSharedStorage(Pi,e),f(n),t.drawFrame()}},v=()=>{g(),t.drawFrame()};return{name:"@middleware/selector",use(){a.on(Xi,w),a.on(Vi,v)},disuse(){a.off(Xi,w),a.off(Vi,v)},hover:e=>{var o,s;const c=i.getSharedStorage(xi),f=i.getSharedStorage(pi),g=i.getSharedStorage(Pi),w=e=>{const t=e.type;null===l&&a.trigger("cursor",{type:t,groupQueue:e.groupQueue,element:e.elements[0]})};if((null==g?void 0:g.length)>0){if(!Yi(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(Pi)}))return d(null),void t.drawFrame();const n=Bi(e.point,u());return w(n),c||["area","drag","drag-list"].includes(f)?(d(null),void t.drawFrame()):1===(null==(o=null==n?void 0:n.elements)?void 0:o.length)?(d(n.elements[0]),void t.drawFrame()):(d(null),void t.drawFrame())}if(c||["area","drag","drag-list"].includes(f))return void d(null);if("drag"===f)return void d(null);const v=h(),m=i.getActiveViewScaleInfo(),y=i.getActiveViewSizeInfo(),p=Bi(e.point,{...u(),areaSize:Fi(v,{viewScaleInfo:m,viewSizeInfo:y,calculator:n})});return w(p),"over-element"===p.type&&1===(null==(s=null==p?void 0:p.elements)?void 0:s.length)?(i.setSharedStorage(Ai,p.elements[0]),d(p.elements[0]),void t.drawFrame()):i.getSharedStorage(Ai)?(d(null),void t.drawFrame()):void 0},pointStart:e=>{var o,a,l,c;s=e.point,d(null);const w=i.getSharedStorage(Pi);if((null==w?void 0:w.length)>0){if(Yi(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:w})){const t=Bi(e.point,u());d(null),"over-element"===t.type&&1===(null==(o=null==t?void 0:t.elements)?void 0:o.length)?(f([t.elements[0]],{triggerEvent:!0}),i.setSharedStorage(pi,"drag")):(null==(a=t.type)?void 0:a.startsWith("resize-"))?(i.setSharedStorage(xi,t.type),i.setSharedStorage(pi,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const v=Fi(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),m=Bi(e.point,{...u(),areaSize:v,groupQueue:[]});"list-area"===m.type?i.setSharedStorage(pi,"drag-list"):"over-element"===m.type&&1===(null==(l=null==m?void 0:m.elements)?void 0:l.length)?(f([m.elements[0]],{triggerEvent:!0}),i.setSharedStorage(pi,"drag")):(null==(c=m.type)?void 0:c.startsWith("resize-"))?(i.setSharedStorage(xi,m.type),i.setSharedStorage(pi,"resize")):(g(),i.setSharedStorage(pi,"area"),i.setSharedStorage(Si,e.point),f([],{triggerEvent:!0})),t.drawFrame()},pointMove:e=>{var o;const n=i.getActiveStorage("data"),a=h(),r=i.getActiveStorage("scale")||1,c=s,d=e.point,u=i.getSharedStorage(xi),g=i.getSharedStorage(pi),w=i.getSharedStorage(Pi);if("drag"===g){if(l="drag",n&&1===(null==a?void 0:a.length)&&c&&d){const{moveX:e,moveY:t}=function(e,t,i){let o=t.x-e.x,n=t.y-e.y;const a=[];if(i.forEach((e=>{const{x:t,y:i,w:o,h:n,angle:r=0}=e;a.push({x:t,y:i,w:o,h:n,angle:0-r})})),(null==i?void 0:i.length)>0){const i=ee(e,a),r=ee(t,a);o=r.x-i.x,n=r.y-i.y}return{moveX:o,moveY:n}}(c,d,w);a[0].x+=e/r,a[0].y+=t/r,f([a[0]])}t.drawFrame()}else if("drag-list"===g){if(l="drag-list",n&&c&&d&&(null==a?void 0:a.length)>1){const e=(d.x-c.x)/r,t=(d.y-c.y)/r;a.forEach((i=>{i&&(i.x+=e,i.y+=t)})),i.setActiveStorage("data",n)}t.drawFrame()}else if("resize"===g){if(n&&1===(null==a?void 0:a.length)&&c&&(null==u?void 0:u.startsWith("resize-"))){l="resize";const e=[];w.forEach((t=>{const{x:i,y:o,w:n,h:a,angle:r=0}=t;e.push({x:i,y:o,w:n,h:a,angle:0-r})}));let n=c,s=d;w.length>0&&(n=ee(c,e),s=ee(d,e));const h=function(e,t){var i,o,n,a,r,s,l,h,c;let{x:d,y:f,w:u,h:g,angle:w=0}=e;const v=K({x:d,y:f,w:u,h:g,angle:w});w=ne(w);const m=$(w),y=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:p,end:x,resizeType:S,scale:b}=t;let A={...p},I={...x},M={x:A.x,y:v.y},z={x:I.x,y:v.y},R={...M},P={...z},T={x:v.x,y:A.y},E={x:v.x,y:I.y},C={...T},W={...E},O=(P.x-R.x)/b,j=(P.y-R.y)/b,k=ki(O,j),D=(W.x-C.x)/b,L=(W.y-C.y)/b,Y=ki(D,L);(w>0||w<0)&&(A=_(v,p,0-m),I=_(v,x,0-m),M={x:A.x,y:v.y},z={x:I.x,y:v.y},R=_(v,M,m),P=_(v,z,m),T={x:v.x,y:A.y},E={x:v.x,y:I.y},C=_(v,T,m),W=_(v,E,m),O=(P.x-R.x)/b,j=(P.y-R.y)/b,k=ki(O,j),k=Di(k,j),D=(W.x-C.x)/b,L=(W.y-C.y)/b,Y=ki(D,L),Y=Di(Y,L));let B=(x.x-p.x)/b,F=(x.y-p.y)/b;if(!0===y)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(B),Math.abs(F));B=(B>=0?1:-1)*t,F=(F>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(D),Math.abs(L));D=(D>=0?1:-1)*i,L=(L>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(O),Math.abs(j));O=(O>=0?1:-1)*o,j=(j>=0?1:-1)*o/e.w*e.h}else if(["resize-top-left","resize-top-right","resize-bottom-left","resize-bottom-right"].includes(S)){{const t=Math.abs(B);B=(B>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?F=B>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(F=B>0?-i:i)}k=Math.abs(k),Y=k/e.w*e.h}switch(S){case"resize-top":if(0===w)g-F>0&&(f+=F,g-=F,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=F/e.h*e.w/2,u-=F/e.h*e.w));else if(w>0||w<0){let t=v.x,i=v.y;if(w<90){Y=0-Di(Y,L);const e=ji(w),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(w<180){Y=Di(Y,D);const e=ji(w-90),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(w<270){Y=Di(Y,L);const e=ji(w-180),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(w<360){Y=0-Di(Y,D);const e=ji(w-270),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+Y>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(u+=Y/e.h*e.w),g+=Y,d=t-u/2,f=i-g/2)}break;case"resize-bottom":if(0===w)e.h+F>0&&(g+=F,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(d-=F/e.h*e.w/2,u+=F/e.h*e.w));else if(w>0||w<0){let t=v.x,i=v.y;if(w<90){Y=Di(Y,L);const e=ji(w),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(w<180){Y=0-Di(Y,D);const e=ji(w-90),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(w<270){Y=Di(Y,D);const e=ji(w-180),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(w<360){Y=Di(Y,D);const e=ji(w-270),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+Y>0&&(!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(u+=Y/e.h*e.w),g+=Y,d=t-u/2,f=i-g/2)}break;case"resize-left":if(0===w)e.w-B>0&&(d+=B,u-=B,!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g-=B/e.w*e.h,f+=B/e.w*e.h/2));else if(w>0||w<0){let t=v.x,i=v.y;if(w<90){k=0-Di(k,O);const e=ji(w),o=k/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(w<180){k=Di(k,O);const e=ji(w-90),o=k/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(w<270){k=Di(k,j);const e=ji(w-180),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(w<360){k=Di(k,j);const e=ji(w-270),o=k/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}u+k>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(g+=k/e.w*e.h),u+=k,d=t-u/2,f=i-g/2)}break;case"resize-right":if(0===w)e.w+B>0&&(u+=B,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(f-=B*e.h/e.w/2,g+=B*e.h/e.w));else if(w>0||w<0){let t=v.x,i=v.y;if(w<90){k=Di(k,j);const e=ji(w),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(w<180){k=Di(k,F);const e=ji(w-90),o=k/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(w<270){k=Di(k,F);const e=ji(w-180),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e),k=0-k}else if(w<360){k=Di(k,B);const e=ji(w-270),o=k/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}u+k>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=k/e.w*e.h),u+=k,d=t-u/2,f=i-g/2)}break;case"resize-top-left":if(0===w)u-B>0&&(d+=B,u-=B),g-F>0&&(f+=F,g-=F);else if(w>0||w<0){let e=v.x,t=v.y;if(w<90){Y=0-Di(Y,L),k=0-Di(k,y?0-Y:O);const i=Y/2;e+=i*Math.sin(m),t-=i*Math.cos(m);const o=k/2;e-=o*Math.cos(m),t-=o*Math.sin(m)}else if(w<180){Y=Di(Y,D),k=Di(k,y?Y:O);const i=ji(w-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=k/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(w<270){Y=Di(Y,L),k=Di(k,y?Y:j);const i=ji(w-180),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=k/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(w<360){Y=0-Di(Y,D),k=Di(k,y?Y:j);const i=ji(w-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=k/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),u+k>0&&(u+=k),d=e-u/2,f=t-g/2}break;case"resize-top-right":if(0===w)u+B>0&&(u+=B),g-F>0&&(f+=F,g-=F);else if(w>0||w<0){let e=v.x,t=v.y;if(w<90){Y=0-Di(Y,L),k=Di(k,y?Y:j);const i=ji(w),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=k/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(w<180){Y=Di(Y,D),k=Di(k,y?Y:j);const i=ji(w-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=k/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(w<270){const i=ji(w-180);Y=Di(Y,L),k=Di(k,y?Y:0-O);const o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=k/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(w<360){Y=0-Di(Y,D),k=Di(k,y?Y:O);const i=ji(w-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=k/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),u+k>0&&(u+=k),d=e-u/2,f=t-g/2}break;case"resize-bottom-left":if(0===w)e.h+F>0&&(g+=F),e.w-B>0&&(d+=B,u-=B);else if(w>0||w<0){let e=v.x,t=v.y;if(w<90){Y=Di(Y,L),k=0-Di(k,y?0-Y:O);const i=ji(w),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=k/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(w<180){Y=0-Di(Y,D),k=Di(k,y?Y:O);const i=ji(w-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=k/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(w<270){Y=Di(Y,D),k=Di(k,y?Y:j);const i=ji(w-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=k/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(w<360){Y=Di(Y,D),k=Di(k,y?Y:j);const i=ji(w-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=k/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),u+k>0&&(u+=k),d=e-u/2,f=t-g/2}break;case"resize-bottom-right":if(0===w)e.h+F>0&&(g+=F),e.w+B>0&&(u+=B);else if(w>0||w<0){let e=v.x,t=v.y;if(w<90){Y=Di(Y,L),k=Di(k,y?Y:j);const i=ji(w),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=k/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(w<180){Y=0-Di(Y,D),k=Di(k,y?Y:F);const i=ji(w-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=k/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(w<270){Y=Di(Y,D),k=Di(k,y?Y:0-j);const i=ji(w-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=k/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(w<360){Y=Di(Y,D),k=Di(k,y?Y:O);const i=ji(w-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=k/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),u+k>0&&(u+=k),d=e-u/2,f=t-g/2}}return{x:d,y:f,w:u,h:g,angle:e.angle}}(a[0],{scale:r,start:n,end:s,resizeType:u,sharer:i});a[0].x=h.x,a[0].y=h.y,"group"===a[0].type&&!0===(null==(o=a[0].operations)?void 0:o.deepResize)?function(e,t){const i=t.w&&t.w>0?t.w:e.w,o=t.h&&t.h>0?t.h:e.h,n=i/e.w,a=o/e.h;if(n===a&&1===n)return e;const r=Math.min(n,a),s=Math.max(n,a);e.w=i,e.h=o;const l={xRatio:n,yRatio:a,minRatio:r,maxRatio:s};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ae(e,l)})),be(e,l)}(a[0],{w:h.w,h:h.h}):(a[0].w=h.w,a[0].h=h.h),f([a[0]]),t.drawFrame()}}else"area"===g&&(l="area",i.setSharedStorage(bi,e.point),t.drawFrame());s=e.point},pointEnd(e){l=null;const o=i.getActiveStorage("data"),r=i.getSharedStorage(xi),h=i.getSharedStorage(pi),c=i.getActiveViewSizeInfo();let d=!1;if(s=null,"resize"===h&&r)i.setSharedStorage(xi,null),d=!0;else if("area"===h){if(i.setSharedStorage(pi,null),o){const e=i.getSharedStorage(Si),t=i.getSharedStorage(bi);if(e&&t){const{elements:a}=function(e,t){const i=[],o=[],n=[],{calculator:a,viewScaleInfo:r,viewSizeInfo:s,start:l,end:h}=t;if(!(Array.isArray(e.elements)&&l&&h))return{indexes:i,uuids:o,elements:n};const c=Math.min(l.x,h.x),d=Math.max(l.x,h.x),f=Math.min(l.y,h.y),u=Math.max(l.y,h.y);return e.elements.forEach(((e,t)=>{const l=a.elementSize(e,r,s),h=K(l);if(h.x>=c&&h.x<=d&&h.y>=f&&h.y<=u&&(i.push(t),o.push(e.uuid),n.push(e),l.angle&&(l.angle>0||l.angle<0))){const e=ie(l);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];l.x=Math.min(...t),l.y=Math.min(...i),l.w=Math.abs(Math.max(...t)-Math.min(...t)),l.h=Math.abs(Math.max(...i)-Math.min(...i))}}})),{indexes:i,uuids:o,elements:n}}(o,{start:e,end:t,calculator:n,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()});a.length>0&&(i.setSharedStorage(pi,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage(pi,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage(pi,"select"),d=!0):i.setSharedStorage(pi,null)}null===i.getSharedStorage(pi)&&(g(),d=!0);(()=>{if(d){if(o&&Array.isArray(null==o?void 0:o.elements)&&["drag","drag-list"].includes(h)){const e=function(e,t,i){const o=re(e,{viewWidth:t.width,viewHeight:t.height,extend:null==i?void 0:i.extend});return!0===(null==i?void 0:i.extend)&&(o.contextWidth=Math.max(o.contextWidth,t.contextWidth),o.contextHeight=Math.max(o.contextHeight,t.contextHeight)),{contextSize:o}}(o.elements,c,{extend:!0});i.setActiveStorage("contextHeight",e.contextSize.contextHeight),i.setActiveStorage("contextWidth",e.contextSize.contextWidth)}if(o&&["drag","drag-list","drag-list-end","resize"].includes(h)){let e="drag-element";a.trigger("change",{data:o,type:e})}t.drawFrame()}})()},pointLeave(){s=null,g(),t.drawFrame()},doubleClick(e){var o,n;const r=Bi(e.point,u());if(1===r.elements.length&&"group"===(null==(o=r.elements[0])?void 0:o.type)){if(!0===c(r.elements[0]))return i.setSharedStorage(pi,null),void t.drawFrame()}else 1===r.elements.length&&"text"===(null==(n=r.elements[0])?void 0:n.type)&&a.trigger(Gi,{element:r.elements[0],groupQueue:i.getSharedStorage(Pi)||[],viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(pi,null)},beforeDrawFrame({snapshot:t}){const{activeStore:i,sharedStore:o}=t,{scale:a,offsetLeft:s,offsetTop:l,offsetRight:c,offsetBottom:d,width:f,height:u,contextHeight:g,contextWidth:w,devicePixelRatio:v}=i,m=e.sharer,y={scale:a,offsetLeft:s,offsetTop:l,offsetRight:c,offsetBottom:d},p={width:f,height:u,contextHeight:g,contextWidth:w,devicePixelRatio:v},x=o[Mi][0],S=o[Ai],b=o[Ii],A=o[pi],I=o[Si],M=o[bi],z=o[Pi],R=o[Ti],P={calculator:n,viewScaleInfo:y,viewSizeInfo:p},T=x?ve(x,{groupQueue:z,controllerSize:10,viewScaleInfo:y}):null;if((null==z?void 0:z.length)>0)!function(e,t,i){for(let o=0;o<t.length;o++){const n=t[o],a={borderColor:Ei,borderWidth:2,background:"transparent",lineDash:[4,4]};Ci(e,he(n,i),a)}}(r,R,P),S&&"drag"!==A&&Wi(r,b,P),x&&["select","drag","resize"].includes(A)&&Oi(r,T,{...P});else if(S&&"drag"!==A&&Wi(r,b,P),x&&["select","drag","resize"].includes(A))Oi(r,T,{...P});else if("area"===A&&I&&M)!function(e,t){const{start:i,end:o}=t;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=Ei,e.fillStyle="#1976d24f",e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,i.y),e.lineTo(o.x,o.y),e.lineTo(i.x,o.y),e.closePath(),e.stroke(),e.fill()}(r,{start:I,end:M});else if(["drag-list","drag-list-end"].includes(A)){const e=Fi(h(),{viewScaleInfo:m.getActiveViewScaleInfo(),viewSizeInfo:m.getActiveViewSizeInfo(),calculator:n});e&&function(e,t){const{areaSize:i}=t,{x:o,y:n,w:a,h:r}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=Ei,e.fillStyle="#1976d21c",e.beginPath(),e.moveTo(o,n),e.lineTo(o+a,n),e.lineTo(o+a,n+r),e.lineTo(o,n+r),e.closePath(),e.stroke(),e.fill()}(r,{areaSize:e})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o}=e,n=i.boardContext.canvas,a=document.createElement("textarea"),r=document.createElement("div"),s=e.container||document.body,l=document.createElement("div");let h=null;r.appendChild(a),r.style.position="absolute",l.appendChild(r),l.style.position="fixed",l.style.top="0",l.style.bottom="0",l.style.left="0",l.style.right="0",l.style.display="none",s.appendChild(l);const c=()=>{l.style.display="none",h=null},d=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:a,w:r,h:s}=t,l=ne(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${a}px`,o.style.width=`${r}px`,o.style.height=`${s}px`,o.style.transform=`rotate(${l}deg)`,i.appendChild(o),o},f=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:s,offsetLeft:l}=t;r.children&&Array.from(r.children).forEach((e=>{e.remove()}));let h=r;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:a,w:r,h:c}=t,f={x:i*n,y:a*n,w:r*n,h:c*n,angle:ne(t.angle||0)};0===e&&(f.x+=l,f.y+=s),h=d({size:f,parent:h})}const c={...Ni,...i.detail};let f=i.x*n+l,u=i.y*n+s,g=i.w*n,w=i.h*n;o.length>0&&(f=i.x*n,u=i.y*n,g=i.w*n,w=i.h*n),a.style.position="absolute",a.style.left=`${f}px`,a.style.top=`${u}px`,a.style.width=`${g}px`,a.style.height=`${w}px`,a.style.transform=`rotate(${ne(i.angle||0)}deg)`,a.style.boxSizing="border-box",a.style.border="1px solid #1973ba",a.style.resize="none",a.style.overflow="hidden",a.style.wordBreak="break-all",a.style.background="#FFFFFF",a.style.color="#333333",a.style.fontSize=c.fontSize*n+"px",a.style.lineHeight=c.lineHeight*n+"px",a.style.fontFamily=c.fontFamily,a.style.fontWeight=`${c.fontWeight}`,a.value=c.text||"",h.appendChild(a)},u=()=>{const{left:e,top:t,width:i,height:o}=(()=>{const e=n.getBoundingClientRect(),{left:t,top:i,width:o,height:a}=e;return{left:t,top:i,width:o,height:a}})();r.style.position="absolute",r.style.overflow="hidden",r.style.top=`${t}px`,r.style.left=`${e}px`,r.style.width=`${i}px`,r.style.height=`${o}px`};l.addEventListener("click",(()=>{c()})),a.addEventListener("click",(e=>{e.stopPropagation()})),a.addEventListener("input",(e=>{h&&(h.detail.text=e.target.value||"",o.drawFrame())})),a.addEventListener("blur",(()=>{c()}));const g=e=>{var t;(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(h=e.element),(e=>{u(),f(e),l.style.display="block"})(e)};return{name:"@middleware/text-editor",use(){t.on(Gi,g)},disuse(){t.off(Gi,g)}}},e.middlewareEventRuler=uo,e.middlewareEventScale=no,e.middlewareEventSelect=Xi,e.middlewareEventSelectClear=Vi,e.middlewareEventTextEdit=Gi,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
1
+ var iDrawCore=function(e){"use strict";var t,i,o,n,a=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},r=(e,t,i)=>(a(e,t,"read from private field"),i?i.call(e):t.get(e)),s=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},l=(e,t,i,o)=>(a(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i);function h(e,t){let i=-1;return function(...o){i>=0||(i=setTimeout((()=>{e(...o),i=-1}),t))}}function c(e){return"string"==typeof e&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^[a-z]{1,}$/i.test(e))}function d(e,t){if(1===t)return e;let i=1;const o=/^\#[0-9a-f]{6,6}$/i;let n=e;if(o.test(e)?i=parseInt(e.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(e)&&(i=parseInt(e.substring(7,9).replace(/^\#/,"0x")),n=e.substring(0,7)),i*=t,o.test(n)&&i>0&&i<1){const e=Math.max(0,Math.min(255,Math.ceil(256*i)));n=`${n.toUpperCase()}${e.toString(16).toUpperCase()}`}return n}function f(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function u(e){let t=0;for(let i=0;i<e.length;i++)t+=e.charCodeAt(i)*e.charCodeAt(i)*i*i;return t.toString(16).substring(0,4)}function g(e){const t=e.length,i=Math.floor(t/2),o=e.substring(0,4).padEnd(4,"0"),n=e.substring(0,4).padEnd(4,"0");return`@assets/${u(t.toString(16).padEnd(4,o))}${u(e.substring(i-4,i).padEnd(4,o)).padEnd(4,"f")}-${u(e.substring(i-8,i-4).padEnd(4,o)).padEnd(4,"f")}-${u(e.substring(i-12,i-8).padEnd(4,o)).padEnd(4,"f")}-${u(e.substring(i-16,i-12).padEnd(4,n)).padEnd(4,"f")}-${u(e.substring(i,i+4).padEnd(4,n)).padEnd(4,"f")}${u(e.substring(i+4,i+8).padEnd(4,n)).padEnd(4,"f")}${u(n.padEnd(4,o).padEnd(4,n))}`}function w(e){return function e(t){const i=function(e){return Object.prototype.toString.call(e).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(t);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return t;if("Array"===i){const i=[];return t.forEach((t=>{i.push(e(t))})),i}if("Object"===i){const i={};Object.keys(t).forEach((o=>{i[o]=e(t[o])}));return Object.getOwnPropertySymbols(t).forEach((o=>{i[o]=e(t[o])})),i}}(e)}function v(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const m={type(e,t){const i=v(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===v(e),json:e=>"Object"===v(e),function:e=>"Function"===v(e),asyncFunction:e=>"AsyncFunction"===v(e),string:e=>"String"===v(e),number:e=>"Number"===v(e),undefined:e=>"Undefined"===v(e),null:e=>"Null"===v(e),promise:e=>"Promise"===v(e)};var y=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))};const{Image:p}=window;function x(e){return new Promise(((t,i)=>{const o=new p;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function S(e){return y(this,void 0,void 0,(function*(){const t=yield function(e){return new Promise(((t,i)=>{const o=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=new FileReader;n.readAsDataURL(o),n.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},n.onerror=function(e){i(e)}}))}(e);return yield x(t)}))}function b(e,t){return y(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&amp;");const i=yield function(e,t){const{width:i,height:o}=t;return new Promise(((t,n)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},r.onerror=function(e){n(e)}}))}(e,t);return yield x(i)}))}function A(e){return"number"==typeof e&&(e>0||e<=0)}function I(e){return"number"==typeof e&&e>=0}function M(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function z(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const R={x:function(e){return A(e)},y:function(e){return A(e)},w:I,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:A,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return I(e)},borderRadius:function(e){return A(e)&&e>=0},color:function(e){return c(e)},imageSrc:function(e){return z(e)||M(e)},imageURL:M,imageBase64:z,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let i=document.createElement("div");i.innerHTML=e,i.children.length>0&&(t=!0),i=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return A(e)&&e>0},lineHeight:function(e){return A(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return A(e)&&e>0}};var P,T,E=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},C=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class W{constructor(e,t){P.set(this,void 0),T.set(this,void 0),E(this,P,e,"f"),E(this,T,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f")}$undoPixelRatio(e){return e/C(this,T,"f").devicePixelRatio}$doPixelRatio(e){return C(this,T,"f").devicePixelRatio*e}$getContext(){return C(this,P,"f")}$setFont(e){const t=[];e.fontWeight&&t.push(`${e.fontWeight}`),t.push(`${this.$doPixelRatio(e.fontSize||12)}px`),t.push(`${e.fontFamily||"sans-serif"}`),C(this,P,"f").font=`${t.join(" ")}`}$getOffscreenCanvas(){return C(this,T,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:a}=C(this,P,"f");a.width=t*o,a.height=i*o,E(this,T,Object.assign(Object.assign({},C(this,T,"f")),{devicePixelRatio:o}),"f"),!0===n&&(a.style.width=`${t}px`,a.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=C(this,T,"f"),{width:t,height:i}=C(this,P,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return C(this,P,"f").canvas}get fillStyle(){return C(this,P,"f").fillStyle}set fillStyle(e){C(this,P,"f").fillStyle=e}get strokeStyle(){return C(this,P,"f").strokeStyle}set strokeStyle(e){C(this,P,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(C(this,P,"f").lineWidth)}set lineWidth(e){C(this,P,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return C(this,P,"f").textAlign}set textAlign(e){C(this,P,"f").textAlign=e}get textBaseline(){return C(this,P,"f").textBaseline}set textBaseline(e){C(this,P,"f").textBaseline=e}get globalAlpha(){return C(this,P,"f").globalAlpha}set globalAlpha(e){C(this,P,"f").globalAlpha=e}get shadowColor(){return C(this,P,"f").shadowColor}set shadowColor(e){C(this,P,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(C(this,P,"f").shadowOffsetX)}set shadowOffsetX(e){C(this,P,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(C(this,P,"f").shadowOffsetY)}set shadowOffsetY(e){C(this,P,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(C(this,P,"f").shadowBlur)}set shadowBlur(e){C(this,P,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return C(this,P,"f").lineCap}set lineCap(e){C(this,P,"f").lineCap=e}get globalCompositeOperation(){return C(this,P,"f").globalCompositeOperation}set globalCompositeOperation(e){C(this,P,"f").globalCompositeOperation=e}fill(...e){return C(this,P,"f").fill(...e)}arc(e,t,i,o,n,a){return C(this,P,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,a)}rect(e,t,i,o){return C(this,P,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return C(this,P,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return C(this,P,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return C(this,P,"f").beginPath()}closePath(){return C(this,P,"f").closePath()}lineTo(e,t){return C(this,P,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return C(this,P,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return C(this,P,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}getLineDash(){return C(this,P,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return C(this,P,"f").setLineDash(t)}stroke(e){return e?C(this,P,"f").stroke(e):C(this,P,"f").stroke()}translate(e,t){return C(this,P,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return C(this,P,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],a=e[4],r=e[e.length-4],s=e[e.length-3],l=e[e.length-2],h=e[e.length-1];return 9===e.length?C(this,P,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a),this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h)):C(this,P,"f").drawImage(t,this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h))}createPattern(e,t){return C(this,P,"f").createPattern(e,t)}measureText(e){return C(this,P,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?C(this,P,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):C(this,P,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?C(this,P,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):C(this,P,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){C(this,P,"f").save()}restore(){C(this,P,"f").restore()}scale(e,t){C(this,P,"f").scale(e,t)}circle(e,t,i,o,n,a,r,s){C(this,P,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,a,r,s)}isPointInPath(e,t){return C(this,P,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return C(this,P,"f").clip(...e)}setTransform(e,t,i,o,n,a){return C(this,P,"f").setTransform(e,t,i,o,n,a)}getTransform(){return C(this,P,"f").getTransform()}createLinearGradient(e,t,i,o){return C(this,P,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,a){return C(this,P,"f").createRadialGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a))}createConicGradient(e,t,i){return C(this,P,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function O(e){const{width:t,height:i,ctx:o,devicePixelRatio:n}=e;let a=o;if(!a){const e=document.createElement("canvas");e.width=t*n,e.height=i*n,a=e.getContext("2d")}return new W(a,e)}function j(e){const{width:t,height:i,devicePixelRatio:o}=e,n=new OffscreenCanvas(t*o,i*o),a=n.getContext("2d").canvas.getContext("2d");return new W(a,{devicePixelRatio:o,offscreenCanvas:n})}P=new WeakMap,T=new WeakMap;var k,D=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class L{constructor(){k.set(this,void 0),function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,i):n?n.value=i:t.set(e,i)}(this,k,new Map,"f")}on(e,t){if(D(this,k,"f").has(e)){const i=D(this,k,"f").get(e)||[];null==i||i.push(t),D(this,k,"f").set(e,i)}else D(this,k,"f").set(e,[t])}off(e,t){if(D(this,k,"f").has(e)){const i=D(this,k,"f").get(e);if(Array.isArray(i))for(let e=0;e<(null==i?void 0:i.length);e++)if(i[e]===t){i.splice(e,1);break}D(this,k,"f").set(e,i||[])}}trigger(e,t){const i=D(this,k,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(D(this,k,"f").has(e)){const t=D(this,k,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){D(this,k,"f").clear()}}function Y(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}k=new WeakMap;var B,F,G,N,X=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},V=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class H{constructor(e){B.add(this),F.set(this,void 0),G.set(this,void 0),X(this,G,w(e.defaultStorage),"f"),X(this,F,V(this,B,"m",N).call(this),"f")}set(e,t){V(this,F,"f")[e]=t}get(e){return V(this,F,"f")[e]}getSnapshot(){return w(V(this,F,"f"))}clear(){X(this,F,V(this,B,"m",N).call(this),"f")}destroy(){X(this,F,null,"f")}}function Z(e){const{activeStore:t}=e;return{scale:null==t?void 0:t.scale,offsetTop:null==t?void 0:t.offsetTop,offsetBottom:null==t?void 0:t.offsetBottom,offsetLeft:null==t?void 0:t.offsetLeft,offsetRight:null==t?void 0:t.offsetRight}}function Q(e){const{activeStore:t}=e;return{devicePixelRatio:t.devicePixelRatio,width:null==t?void 0:t.width,height:null==t?void 0:t.height,contextWidth:null==t?void 0:t.contextWidth,contextHeight:null==t?void 0:t.contextHeight}}function $(e){return e/180*Math.PI}function U(e,t,i,o){const n=$(t||0);i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(n),e.translate(-i.x,-i.y)),o(e),i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(-n),e.translate(-i.x,-i.y))}function J(e,t,i){const o=K(t);U(e,t.angle||0,o,(()=>{i(e)}))}function K(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function q(e){const t=Math.min(e[0].x,e[1].x,e[2].x,e[3].x),i=Math.min(e[0].y,e[1].y,e[2].y,e[3].y);return K({x:t,y:i,w:Math.max(e[0].x,e[1].x,e[2].x,e[3].x)-t,h:Math.max(e[0].y,e[1].y,e[2].y,e[3].y)-i})}function _(e,t,i){const o=function(e,t){const i=t.x-e.x,o=t.y-e.y;if(0===i){if(o<0)return 0;if(o>0)return Math.PI}else if(0===o){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&o<0?Math.atan(Math.abs(i)/Math.abs(o)):i>0&&o>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):0}(e,t);let n=o+i;n>2*Math.PI?n-=2*Math.PI:n<0-2*Math.PI&&(n+=2*Math.PI),n<0&&(n+=2*Math.PI);const a=function(e,t){const i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===i?i:Math.sqrt(i)}(e,t);let r=0,s=0;return 0===n?(r=0,s=0-a):n>0&&n<Math.PI/2?(r=Math.sin(n)*a,s=0-Math.cos(n)*a):n===Math.PI/2?(r=a,s=0):n>Math.PI/2&&n<Math.PI?(r=Math.sin(Math.PI-n)*a,s=Math.cos(Math.PI-n)*a):n===Math.PI?(r=0,s=a):n>Math.PI&&n<1.5*Math.PI?(r=0-Math.sin(n-Math.PI)*a,s=Math.cos(n-Math.PI)*a):n===1.5*Math.PI?(r=0-a,s=0):n>1.5*Math.PI&&n<2*Math.PI?(r=0-Math.sin(2*Math.PI-n)*a,s=0-Math.cos(2*Math.PI-n)*a):n===2*Math.PI&&(r=0,s=0-a),r+=e.x,s+=e.y,{x:r,y:s}}function ee(e,t){if((null==t?void 0:t.length)>0){let i=e.x,o=e.y;return t.forEach((e=>{const{x:t,y:n,w:a,h:r,angle:s=0}=e,l=_(K({x:t,y:n,w:a,h:r,angle:s}),{x:i,y:o},$(s));i=l.x,o=l.y})),{x:i,y:o}}return e}function te(e,t,i){const{x:o,y:n,w:a,h:r}=e;let s={x:o,y:n},l={x:o+a,y:n},h={x:o+a,y:n+r},c={x:o,y:n+r};if(i&&(i>0||i<0)){const e=$(ne(i));s=_(t,s,e),l=_(t,l,e),h=_(t,h,e),c=_(t,c,e)}return[s,l,h,c]}function ie(e){const{angle:t=0}=e;return te(e,K(e),t)}function oe(e,t,i){return[_(e,{x:t[0].x,y:t[0].y},i),_(e,{x:t[1].x,y:t[1].y},i),_(e,{x:t[2].x,y:t[2].y},i),_(e,{x:t[3].x,y:t[3].y},i)]}function ne(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function ae(e){let t=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(t=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(t=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(t=ae(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function re(e,t){const i={x:0,y:0,w:0,h:0};e.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=ie(t);if(4===e.length){const i=[e[0].x,e[1].x,e[2].x,e[3].x],o=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...i),t.y=Math.min(...o),t.w=Math.abs(Math.max(...i)-Math.min(...i)),t.h=Math.abs(Math.max(...o)-Math.min(...o))}}const o=Math.min(t.x,i.x),n=Math.min(t.y,i.y),a=Math.max(t.x+t.w,i.x+i.w),r=Math.max(t.y+t.h,i.y+i.h);i.x=o,i.y=n,i.w=Math.abs(a-o),i.h=Math.abs(r-n)})),(null==t?void 0:t.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const o={contextWidth:i.w,contextHeight:i.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>i.x+i.w&&(o.contextWidth=t.viewWidth-i.x),t.viewHeight>i.y+i.h&&(o.contextHeight=t.viewHeight-i.y)),o}function se(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:a,h:r,angle:s}=e,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:o*l+c,y:n*l+h,w:a*l,h:r*l,angle:s}}function le(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:a,offsetTop:r,offsetLeft:s}=i;return{x:o*a+s,y:n*a+r}}function he(e,t){return[le(e[0],t),le(e[1],t),le(e[2],t),le(e[3],t)]}function ce(e,t){const{context2d:i,element:o,viewScaleInfo:n,viewSizeInfo:a}=t,{angle:r=0}=o,{x:s,y:l,w:h,h:c}=se(o,{viewScaleInfo:n,viewSizeInfo:a}),d=ie({x:s,y:l,w:h,h:c,angle:r});if(d.length>=2){i.beginPath(),i.moveTo(d[0].x,d[0].y);for(let e=1;e<d.length;e++)i.lineTo(d[e].x,d[e].y);i.closePath()}return!!i.isPointInPath(e.x,e.y)}function de(e){const{x:t,y:i,h:o,w:n}=e;return[{x:t,y:i},{x:t+n,y:i},{x:t+n,y:i+o},{x:t,y:i+o}]}function fe(e){const{x:t,y:i,w:o,h:n,angle:a=0}=e;return 0===a?de(e):te(e,K({x:t,y:i,w:o,h:n,angle:a}),a)}function ue(e){const t=[];let i=0,o=0;const n=[],a=[...e];for(let e=0;e<a.length;e++){const{x:r,y:s,w:l,h:h,angle:c=0}=a[e];let d;if(i+=r,o+=s,0===e){const e={x:i,y:o,w:l,h:h,angle:c};d=fe({x:r,y:s,w:l,h:h,angle:c}),n.push({center:K(e),angle:c,radian:$(c)})}else{d=de({x:i,y:o,w:l,h:h,angle:c});for(let e=0;e<n.length;e++){const{center:t,radian:i}=n[e];d=oe(t,d,i)}const e=q(d);if(c>0||c<0){d=oe(e,d,$(c))}n.push({center:e,angle:c,radian:$(c)})}t.push(d)}return t}function ge(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?ue([...i,e]):[fe(e)]}(e,t);return i.pop()||null}function we(e,t){const{x:i,y:o}=e,{size:n,angle:a}=t;return{x:i-n/2,y:o-n/2,w:n,h:n,angle:a}}function ve(e,t){const{groupQueue:i,controllerSize:o,viewScaleInfo:n}=t,a=(o&&o>0?o:8)/n.scale,{x:r,y:s,w:l,h:h,angle:c=0}=e,d=[{uuid:f(),x:r,y:s,w:l,h:h,angle:c,type:"group",detail:{children:[]}},...i];let u=0;d.forEach((({angle:e=0})=>{u+=e}));const g=ge(e,{groupQueue:i}),w=Y(g[0],g[1]),v=Y(g[1],g[2]),m=Y(g[2],g[3]),y=Y(g[3],g[0]),p=g[0],x=g[1],S=g[2],b=g[3],A=we(p,{size:a,angle:u}),I=we(x,{size:a,angle:u}),M=we(b,{size:a,angle:u}),z=we(S,{size:a,angle:u}),R=fe(A),P=fe(I),T=fe(M),E=fe(z),C=[R[1],P[0],P[3],R[2]],W=[P[3],P[2],E[1],E[0]],O=[T[1],E[0],E[3],T[2]];return{elementWrapper:g,left:{type:"left",vertexes:[R[3],R[2],T[1],T[0]],center:y},right:{type:"right",vertexes:W,center:v},top:{type:"top",vertexes:C,center:w},bottom:{type:"bottom",vertexes:O,center:m},topLeft:{type:"top-left",vertexes:R,center:p},topRight:{type:"top-right",vertexes:P,center:x},bottomLeft:{type:"bottom-left",vertexes:T,center:b},bottomRight:{type:"bottom-right",vertexes:E,center:S}}}function me(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function ye(e,t){let i=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(i=t.decimalPlaces),parseFloat(e.toFixed(i))}F=new WeakMap,G=new WeakMap,B=new WeakSet,N=function(){return w(V(this,G,"f"))};const pe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function xe(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{boxSizing:a=pe.boxSizing,borderWidth:r}=e.detail;Array.isArray(r)&&(n=0);let{x:s,y:l,w:h,h:c}=e,d=[0,0,0,0];if("number"==typeof n){const e=n*o;d=[e,e,e,e]}else Array.isArray(n)&&4===(null==n?void 0:n.length)&&(d=[n[0]*o,n[1]*o,n[2]*o,n[3]*o]);let f=0;return"number"==typeof r&&(f=(r||0)*o),"border-box"===a?(s=e.x+f/2,l=e.y+f/2,h=e.w-f,c=e.h-f):"content-box"===a?(s=e.x-f/2,l=e.y-f/2,h=e.w+f,c=e.h+f):(s=e.x,l=e.y,h=e.w,c=e.h),h=Math.max(h,1),c=Math.max(c,1),d=d.map((e=>Math.min(e,h/2,c/2))),{x:s,y:l,w:h,h:c,radiusList:d}}const Se=e=>ye(e,{decimalPlaces:4});function be(e,t){const{detail:i}=e,{xRatio:o,yRatio:n,maxRatio:a}=t,r=(o+n)/2,{borderWidth:s,borderRadius:l,borderDash:h,shadowOffsetX:c,shadowOffsetY:d,shadowBlur:f}=i;if("number"==typeof s)i.borderWidth=Se(s*r);else if(Array.isArray(i.borderWidth)){const e=s;i.borderWidth=[Se(e[0]*n),Se(e[1]*o),Se(e[2]*n),Se(e[3]*o)]}if("number"==typeof l)i.borderRadius=Se(l*r);else if(Array.isArray(i.borderRadius)){const e=l;i.borderRadius=[e[0]*o,e[1]*o,e[2]*n,e[3]*n]}Array.isArray(h)&&h.forEach(((e,t)=>{i.borderDash[t]=Se(e*a)})),"number"==typeof c&&(i.shadowOffsetX=Se(c*a)),"number"==typeof d&&(i.shadowOffsetX=Se(d*a)),"number"==typeof f&&(i.shadowOffsetX=Se(f*a))}function Ae(e,t){const{type:i}=e;!function(e,t){const{xRatio:i,yRatio:o}=t,{x:n,y:a,w:r,h:s}=e;e.x=Se(n*i),e.y=Se(a*o),e.w=Se(r*i),e.h=Se(s*o),be(e,t)}(e,t),"circle"===i||("text"===i?function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:a}=e.detail,r=(i+o)/2;n&&n>0&&(e.detail.fontSize=Se(n*r)),a&&a>0&&(e.detail.lineHeight=Se(a*r))}(e,t):"image"===i||"svg"===i||"html"===i||"path"===i||"group"===i&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ae(e,t)})))}function Ie(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:a=1}=i,{x:r,y:s}=o,{scale:l}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l},c={x:r+o.x*l,y:s+o.y*l},f=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{f.addColorStop(e.offset,d(e.color,a))})),f}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l,radius:i.radius*l},c={x:r+o.x*l,y:s+o.y*l,radius:o.radius*l},f=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{f.addColorStop(e.offset,d(e.color,a))})),f}return"#000000"}const Me={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function ze(e){var t,i,o,n;let a=1;return void 0!==(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.opacity)&&(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.opacity)<=1&&(a=null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.opacity),a}function Re(e,t,i){const{pattern:o,renderContent:n,originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,d=ze(a)*h;!function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:a,viewSizeInfo:r}=i,s=r.devicePixelRatio,{clipPath:l}=(null==n?void 0:n.detail)||{};if(l&&a&&l.commands){const{x:i,y:n,w:r,h:h}=a,{originW:c,originH:d,originX:f,originY:u}=l,g=r/c,w=h/d,v=i-f*g,m=n-u*w;e.save(),e.translate(v,m),e.scale(s*g,s*w);const y=me(l.commands||[]),p=new Path2D(y);e.clip(p),e.translate(0-v,0-m),e.setTransform(1,0,0,1,0,0),J(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l,renderContent:()=>{e.globalAlpha=d,function(e,t,i){var o,n;const{pattern:a,viewScaleInfo:r,viewSizeInfo:s}=i,l=[];if(t.detail.background||a){const{x:i,y:h,w:c,h:d,radiusList:f}=xe(t,{viewScaleInfo:r,viewSizeInfo:s});if(e.beginPath(),e.moveTo(i+f[0],h),e.arcTo(i+c,h,i+c,h+d,f[1]),e.arcTo(i+c,h+d,i,h+d,f[2]),e.arcTo(i,h+d,i,h,f[3]),e.arcTo(i,h,i+c,h,f[0]),e.closePath(),"string"==typeof a)e.fillStyle=a;else if(["CanvasPattern"].includes(m.type(a)))e.fillStyle=a;else if("string"==typeof t.detail.background)e.fillStyle=t.detail.background;else if("linear-gradient"===(null===(o=t.detail.background)||void 0===o?void 0:o.type)){const o=Ie(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=Ie(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});if(e.fillStyle=o,l&&l.length>0)for(let t=0;t<(null==l?void 0:l.length);t++){const o=l[t];"translate"===o.method?e.translate(o.args[0]+i,o.args[1]+h):"rotate"===o.method?e.rotate(...o.args):"scale"===o.method&&e.scale(...o.args)}}e.fill(),l&&l.length>0&&e.setTransform(1,0,0,1,0,0)}}(e,t,{pattern:o,viewScaleInfo:s,viewSizeInfo:l}),null==n||n(),function(e,t,i){if(0===t.detail.borderWidth)return;if(!c(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let a=Me.borderColor;!0===c(t.detail.borderColor)&&(a=t.detail.borderColor);const{borderWidth:r,borderRadius:s,borderDash:l,boxSizing:h=Me.boxSizing}=t.detail;let d=0;"number"==typeof r&&(d=r||1);d*=n;let f=[0,0,0,0];if("number"==typeof s){const e=s*n;f=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(f=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);e.strokeStyle=a;let u=[];Array.isArray(l)&&l.length>0&&(u=l.map((e=>Math.ceil(e*n))));let g=0,w=0,v=0,m=0;Array.isArray(r)&&(g=(r[0]||0)*n,w=(r[1]||0)*n,v=(r[2]||0)*n,m=(r[3]||0)*n);if(m||w||g||v){e.lineCap="butt";let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i+=m/2,o+=g/2,n=n-m/2-w/2,a=a-g/2-v/2):"content-box"===h?(i-=m/2,o-=g/2,n=n+m/2+w/2,a=a+g/2+v/2):(i=t.x,o=t.y,n=t.w,a=t.h),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i-m/2,o),e.lineTo(i+n+w/2,o),e.closePath(),e.stroke()),w&&(e.beginPath(),e.lineWidth=w,e.moveTo(i+n,o-g/2),e.lineTo(i+n,o+a+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-m/2,o+a),e.lineTo(i+n+w/2,o+a),e.closePath(),e.stroke()),m&&(e.beginPath(),e.lineWidth=m,e.moveTo(i,o-g/2),e.lineTo(i,o+a+v/2),e.closePath(),e.stroke())}else{let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i=t.x+d/2,o=t.y+d/2,n=t.w-d,a=t.h-d):"content-box"===h?(i=t.x-d/2,o=t.y-d/2,n=t.w+d,a=t.h+d):(i=t.x,o=t.y,n=t.w,a=t.h),u.length>0?e.lineCap="butt":e.lineCap="square",n=Math.max(n,1),a=Math.max(a,1),f=f.map((e=>Math.min(e,n/2,a/2))),e.setLineDash(u),e.lineWidth=d,e.beginPath(),e.moveTo(i+f[0],o),e.arcTo(i+n,o,i+n,o+a,f[1]),e.arcTo(i+n,o+a,i,o+a,f[2]),e.arcTo(i,o+a,i,o,f[3]),e.arcTo(i,o,i+n,o,f[0]),e.closePath(),e.stroke()}e.setLineDash([])}(e,t,{viewScaleInfo:s,viewSizeInfo:l}),e.globalAlpha=h}})}function Pe(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:a}=i,{shadowColor:r,shadowOffsetX:s,shadowOffsetY:l,shadowBlur:h}=o;R.number(h)?(e.save(),e.shadowColor=r||Me.shadowColor,e.shadowOffsetX=(s||0)*n.scale,e.shadowOffsetY=(l||0)*n.scale,e.shadowBlur=(h||0)*n.scale,a(),e.restore()):a()}const Te={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Ee(e,t,i){var o;if(!0===(null===(o=null==t?void 0:t.operations)||void 0===o?void 0:o.invisible))return;const{w:n,h:a}=t,{scale:r}=i.viewScaleInfo;if(!(r<1&&(n*r<1||a*r<1)||0===i.parentOpacity))try{switch(t.type){case"rect":!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize(t,n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});J(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{Pe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Re(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{background:a="#000000",borderColor:r="#000000",boxSizing:s,borderWidth:l=0}=o;let h=0;"number"==typeof l&&l>0?h=l:Array.isArray(l)&&"number"==typeof l[0]&&l[0]>0&&(h=l[0]);const{calculator:c,viewScaleInfo:d,viewSizeInfo:f,parentOpacity:u}=i,{x:g,y:w,w:v,h:m}=(null==c?void 0:c.elementSize({x:t.x,y:t.y,w:t.w,h:t.h},d,f))||t,y=Object.assign(Object.assign({},t),{x:g,y:w,w:v,h:m,angle:n});J(e,{x:g,y:w,w:v,h:m,angle:n},(()=>{Pe(e,y,{viewScaleInfo:d,viewSizeInfo:f,renderContent:()=>{let t=v/2,i=m/2;const o=g+t,n=w+i;if(h>0&&("border-box"===s?(t-=h,i-=h):"center-line"===s?(t-=h/2,i-=h/2):(t-=h,i-=h)),t>=0&&i>=0){const s=ze(y)*u;if(e.globalAlpha=s,"number"==typeof l&&l>0){const a=l/2+t,s=l/2+i;e.beginPath(),e.strokeStyle=r,e.lineWidth=l,e.circle(o,n,a,s,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath();const h=Ie(e,a,{viewElementSize:{x:g,y:w,w:v,h:m},viewScaleInfo:d,opacity:e.globalAlpha});e.fillStyle=h,e.circle(o,n,t,i,0,0,2*Math.PI),e.closePath(),e.fill(),e.globalAlpha=u}}})}))}(e,t,i);break;case"text":!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:d,angle:f}=(null==o?void 0:o.elementSize(t,n,a))||t,u=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:d,angle:f});J(e,{x:s,y:l,w:h,h:d,angle:f},(()=>{Re(e,u,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:d,angle:f},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const i=Object.assign(Object.assign({},Te),t.detail),o=(i.fontSize||Te.fontSize)*n.scale,a=i.lineHeight?i.lineHeight*n.scale:o;e.fillStyle=t.detail.color||Te.color,e.textBaseline="top",e.$setFont({fontWeight:i.fontWeight,fontSize:o,fontFamily:i.fontFamily});const r=i.text.replace(/\r\n/gi,"\n"),f=a,u=r.split("\n"),g=[];let w=0;u.forEach(((t,i)=>{let o="";if(t.length>0){for(let n=0;n<t.length&&(e.measureText(o+(t[n]||"")).width<e.$doPixelRatio(h)?o+=t[n]||"":(g.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),o=t[n]||"",w++),!((w+1)*f>d));n++)if(t.length-1===n&&(w+1)*f<d){g.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),i<u.length-1&&w++;break}}else g.push({text:"",width:0})}));let v=0;g.length*f<d&&("top"===t.detail.verticalAlign?v=0:"bottom"===t.detail.verticalAlign?v+=d-g.length*f:v+=(d-g.length*f)/2);{const t=l+v;void 0!==i.textShadowColor&&c(i.textShadowColor)&&(e.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&R.number(i.textShadowOffsetX)&&(e.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&R.number(i.textShadowOffsetY)&&(e.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&R.number(i.textShadowBlur)&&(e.shadowBlur=i.textShadowBlur),g.forEach(((o,n)=>{let a=s;"center"===i.textAlign?a=s+(h-o.width)/2:"right"===i.textAlign&&(a=s+(h-o.width)),e.fillText(o.text,a,t+f*n)}))}}})}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t,u=Object.assign(Object.assign({},t),{x:l,y:h,w:c,h:d,angle:f});J(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{Pe(e,u,{viewScaleInfo:a,viewSizeInfo:r,renderContent:()=>{Re(e,u,{originElem:t,calcElemSize:{x:l,y:h,w:c,h:d,angle:f},viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s,renderContent:()=>{if(o||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=ze(t)*s;const{x:i,y:n,w:l,h:h,radiusList:c}=xe(u,{viewScaleInfo:a,viewSizeInfo:r});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+c[0],n),e.arcTo(i+l,n,i+l,n+h,c[1]),e.arcTo(i+l,n+h,i,n+h,c[2]),e.arcTo(i,n+h,i,n,c[3]),e.arcTo(i,n,i+l,n,c[0]),e.closePath(),e.fill(),e.clip(),e.drawImage(o,i,n,l,h),e.globalAlpha=s,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t;J(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=ze(t)*s,e.drawImage(o,l,h,c,d),e.globalAlpha=s)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t;J(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=ze(t)*s,e.drawImage(o,l,h,c,d),e.globalAlpha=s)}))}(e,t,i);break;case"path":!function(e,t,i){const{detail:o}=t,{originX:n,originY:a,originW:r,originH:s}=o,{calculator:l,viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d}=i,{x:f,y:u,w:g,h:w,angle:v}=(null==l?void 0:l.elementSize(t,h,c))||t,m=g/r,y=w/s,p=f-n*m,x=u-a*y,S=h.scale*c.devicePixelRatio,b=Object.assign(Object.assign({},t),{x:f,y:u,w:g,h:w,angle:v});J(e,{x:f,y:u,w:g,h:w,angle:v},(()=>{Re(e,b,{originElem:t,calcElemSize:{x:f,y:u,w:g,h:w,angle:v},viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d,renderContent:()=>{Pe(e,b,{viewScaleInfo:h,viewSizeInfo:c,renderContent:()=>{e.save(),e.translate(p,x),e.scale(S*m/h.scale,S*y/h.scale);const t=me(o.commands||[]),i=new Path2D(t);o.fill&&(e.fillStyle=o.fill,e.fill(i)),o.stroke&&0!==o.strokeWidth&&(e.strokeStyle=o.stroke,e.lineWidth=(o.strokeWidth||1)/c.devicePixelRatio,e.lineCap=o.strokeLineCap||"square",e.stroke(i)),e.translate(-p,-x),e.restore()}})}})}))}(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});J(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{e.globalAlpha=ze(t)*r,Pe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Re(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const{x:o,y:s,w:l,h:h,radiusList:c}=xe(f,{viewScaleInfo:n,viewSizeInfo:a});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(o+c[0],s),e.arcTo(o+l,s,o+l,s+h,c[1]),e.arcTo(o+l,s+h,o,s+h,c[2]),e.arcTo(o,s+h,o,s,c[3]),e.arcTo(o,s,o+l,s,c[0]),e.closePath(),e.fill(),e.clip()),Array.isArray(t.detail.children)){const{parentElementSize:o}=i,n={x:o.x+t.x,y:o.y+t.y,w:t.w||o.w,h:t.h||o.h,angle:t.angle},{calculator:a}=i;for(let o=0;o<t.detail.children.length;o++){let s=t.detail.children[o];if(s=Object.assign(Object.assign({},s),{x:n.x+s.x,y:n.y+s.y}),!0===i.forceDrawAll||(null==a?void 0:a.isElementInView(s,i.viewScaleInfo,i.viewSizeInfo)))try{Ee(e,s,Object.assign(Object.assign({},i),{parentOpacity:r*ze(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=r}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const Ce={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};var We,Oe,je,ke,De,Le,Ye,Be,Fe,Ge,Ne,Xe=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))},Ve=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)},He=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i};const Ze=["image","svg","html"],Qe=e=>{var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),"string"==typeof n&&n?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${n}`)?n:g(n):g(`${f()}-${e.uuid}-${f()}-${f()}`)};class $e extends L{constructor(){super(),We.add(this),Oe.set(this,{}),je.set(this,{}),ke.set(this,{}),Ve(this,We,"m",De).call(this,"image",((e,t)=>Xe(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.src])||void 0===i?void 0:i.value)||e.detail.src,n=yield x(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),Ve(this,We,"m",De).call(this,"html",((e,t)=>Xe(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.html])||void 0===i?void 0:i.value)||e.detail.html,n=yield b(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),Ve(this,We,"m",De).call(this,"svg",((e,t)=>Xe(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.svg])||void 0===i?void 0:i.value)||e.detail.svg,n=yield S(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}destroy(){He(this,Oe,null,"f"),He(this,je,null,"f"),He(this,ke,null,"f")}load(e,t){Ve(this,We,"m",Ne).call(this,e)||Ze.includes(e.type)&&Ve(this,We,"m",Ge).call(this,e,t)}getContent(e){var t,i;const o=Qe(e);return(null===(i=null===(t=Ve(this,ke,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return Ve(this,ke,"f")}setLoadItemMap(e){He(this,ke,e,"f")}}Oe=new WeakMap,je=new WeakMap,ke=new WeakMap,We=new WeakSet,De=function(e,t){Ve(this,Oe,"f")[e]=t},Le=function(e){var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),n},Ye=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:Ve(this,We,"m",Le).call(this,e)}},Be=function(e){const t=Qe(e.element),i=Ve(this,ke,"f")[t];i?i.startTime<e.startTime&&(Ve(this,ke,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(Ve(this,ke,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime})))},Fe=function(e){const t=Qe(e.element),i=Ve(this,ke,"f")[t];i?i.startTime<e.startTime&&(Ve(this,ke,"f")[t]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(Ve(this,ke,"f")[t]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime})))},Ge=function(e,t){const i=Ve(this,We,"m",Ye).call(this,e),o=Qe(e);Ve(this,je,"f")[o]=i;const n=Ve(this,Oe,"f")[e.type];"function"==typeof n&&(i.startTime=Date.now(),n(e,t).then((e=>{i.content=e.content,i.endTime=Date.now(),i.status="load",Ve(this,We,"m",Be).call(this,i)})).catch((t=>{console.warn(`Load element source "${i.source}" fail`,t,e),i.endTime=Date.now(),i.status="error",i.error=t,Ve(this,We,"m",Fe).call(this,i)})))},Ne=function(e){var t;const i=Qe(e),o=null===(t=Ve(this,je,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==Ve(this,We,"m",Le).call(this,e))};var Ue,Je,Ke,qe,_e=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},et=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class tt extends L{constructor(e){super(),Ue.add(this),Je.set(this,void 0),Ke.set(this,new $e),_e(this,Je,e,"f"),et(this,Ue,"m",qe).call(this)}destroy(){_e(this,Je,null,"f"),et(this,Ke,"f").destroy(),_e(this,Ke,null,"f")}updateOptions(e){_e(this,Je,e,"f")}drawData(e,t){const i=et(this,Ke,"f"),{calculator:o}=et(this,Je,"f"),n=et(this,Je,"f").viewContext;n.clearRect(0,0,n.canvas.width,n.canvas.height);const a={x:0,y:0,w:t.viewSizeInfo.width,h:t.viewSizeInfo.height};e.underlay&&function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,s=Object.assign({uuid:"underlay"},t),{x:l,y:h,w:c,h:d}=(null==o?void 0:o.elementSize(s,n,a))||s,f=Object.assign(Object.assign({},s),{x:l,y:h,w:c,h:d,angle:0});Pe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Re(e,f,{originElem:s,calcElemSize:{x:l,y:h,w:c,h:d,angle:0},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{}})}})}(n,e.underlay,Object.assign({loader:i,calculator:o,parentElementSize:a,parentOpacity:1},t)),function(e,t,i){var o;const{elements:n=[]}=t,{parentOpacity:a}=i;for(let t=0;t<n.length;t++){const r=n[t],s=Object.assign(Object.assign({},r),{detail:Object.assign(Object.assign({},Ce),null==r?void 0:r.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.isElementInView(s,i.viewScaleInfo,i.viewSizeInfo)))try{Ee(e,s,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(e){console.error(e)}}}(n,e,Object.assign({loader:i,calculator:o,parentElementSize:a,elementAssets:e.assets,parentOpacity:1},t))}scale(e){const{sharer:t}=et(this,Je,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r,width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){et(this,Ke,"f").setLoadItemMap(e)}getLoadItemMap(){return et(this,Ke,"f").getLoadItemMap()}getLoader(){return et(this,Ke,"f")}}Je=new WeakMap,Ke=new WeakMap,Ue=new WeakSet,qe=function(){const e=et(this,Ke,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(()=>{}))};var it,ot=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},nt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class at{constructor(e){it.set(this,void 0),ot(this,it,e,"f")}destroy(){ot(this,it,null,"f")}elementSize(e,t,i){return se(e,{viewScaleInfo:t,viewSizeInfo:i})}isElementInView(e,t,i){return function(e,t){const{viewSizeInfo:i,viewScaleInfo:o}=t,{width:n,height:a}=i,{angle:r}=e,{x:s,y:l,w:h,h:c}=se(e,{viewScaleInfo:o,viewSizeInfo:i}),d=ie({x:s,y:l,w:h,h:c,angle:r}),f={x:0,y:0,w:n,h:a},u=Math.min(d[0].x,d[1].x,d[2].x,d[3].x),g=Math.min(d[0].y,d[1].y,d[2].y,d[3].y);return function(e,t){const i=e.x,o=e.y,n=e.x+e.w,a=e.y+e.h,r=t.x,s=t.y,l=t.x+t.w,h=t.y+t.h;return i<=l&&n>=r&&o<=h&&a>=s}(f,{x:u,y:g,w:Math.max(d[0].x,d[1].x,d[2].x,d[3].x)-u,h:Math.max(d[0].y,d[1].y,d[2].y,d[3].y)-g})}(e,{viewScaleInfo:t,viewSizeInfo:i})}isPointInElement(e,t,i,o){return ce(e,{context2d:nt(this,it,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=nt(this,it,"f").viewContext;return function(e,t){var i,o,n;const{context2d:a,data:r,viewScaleInfo:s,viewSizeInfo:l,groupQueue:h}=t,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let t=h.length-1;t>=0;t--){let n=0,r=0,d=0;for(let e=0;e<=t;e++)n+=h[e].x,r+=h[e].y,d+=h[e].angle||0;const f=h[t];if(f&&"group"===f.type&&Array.isArray(null===(i=f.detail)||void 0===i?void 0:i.children))for(let i=0;i<f.detail.children.length;i++){const u=f.detail.children[i];if(!0!==(null===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(ce(e,{context2d:a,element:{x:n+u.x,y:r+u.y,w:u.w,h:u.h,angle:d+(u.angle||0)},viewScaleInfo:s,viewSizeInfo:l})){c.element=u,(t<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=t);break}}}if(c.element)break}if(c.element)return c;for(let t=r.elements.length-1;t>=0;t--){const i=r.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&ce(e,{context2d:a,element:i,viewScaleInfo:s,viewSizeInfo:l})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}}it=new WeakMap;var rt,st,lt,ht,ct,dt,ft,ut,gt,wt,vt,mt,yt,pt,xt,St=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},bt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};function At(e){return e>0||e<0||0===e}class It extends L{constructor(e){super(),rt.add(this),st.set(this,void 0),lt.set(this,void 0),ct.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;const t=bt(this,rt,"m",pt).call(this,e);if(!bt(this,rt,"m",xt).call(this,t))return;e.preventDefault(),e.stopPropagation();const i=e.deltaX>0||e.deltaX<0?e.deltaX:0,o=e.deltaY>0||e.deltaY<0?e.deltaY:0;!0===e.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:o,point:t}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:o,point:t})})),dt.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);bt(this,rt,"m",xt).call(this,t)})),ft.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);if(!bt(this,rt,"m",xt).call(this,t))return;const i=Date.now(),o=bt(this,lt,"f").get("prevClickPoint");o&&i-o.t<=500&&Math.abs(o.x-t.x)<=5&&Math.abs(o.y-t.y)<=5?this.trigger("doubleClick",{point:t}):bt(this,lt,"f").set("prevClickPoint",t)})),ut.set(this,(e=>{if(bt(this,lt,"f").set("hasPointDown",!1),!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);this.trigger("pointLeave",{point:t})})),gt.set(this,(e=>{if(bt(this,lt,"f").set("hasPointDown",!1),!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);this.trigger("pointEnd",{point:t})})),wt.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=bt(this,rt,"m",pt).call(this,e);bt(this,rt,"m",xt).call(this,t)?!0===bt(this,lt,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):bt(this,lt,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),bt(this,lt,"f").set("hasPointDown",!1))})),vt.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);bt(this,rt,"m",xt).call(this,t)&&(bt(this,lt,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),mt.set(this,(e=>{if(!bt(this,rt,"m",yt).call(this,e))return;e.preventDefault();const t=bt(this,rt,"m",pt).call(this,e);bt(this,rt,"m",xt).call(this,t)&&this.trigger("hover",{point:t})}));const t=new H({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});St(this,lt,t,"f"),St(this,st,e,"f"),bt(this,rt,"m",ht).call(this)}destroy(){const e=window;e.removeEventListener("mousemove",bt(this,mt,"f")),e.removeEventListener("mousedown",bt(this,vt,"f")),e.removeEventListener("mousemove",bt(this,wt,"f")),e.removeEventListener("mouseup",bt(this,gt,"f")),e.removeEventListener("mouseleave",bt(this,ut,"f")),e.removeEventListener("wheel",bt(this,ct,"f")),e.removeEventListener("click",bt(this,ft,"f")),e.removeEventListener("contextmenu",bt(this,dt,"f")),this.destroy()}}st=new WeakMap,lt=new WeakMap,ct=new WeakMap,dt=new WeakMap,ft=new WeakMap,ut=new WeakMap,gt=new WeakMap,wt=new WeakMap,vt=new WeakMap,mt=new WeakMap,rt=new WeakSet,ht=function(){const e=window;e.addEventListener("mousemove",bt(this,mt,"f")),e.addEventListener("mousedown",bt(this,vt,"f")),e.addEventListener("mousemove",bt(this,wt,"f")),e.addEventListener("mouseup",bt(this,gt,"f")),e.addEventListener("mouseleave",bt(this,ut,"f")),e.addEventListener("wheel",bt(this,ct,"f"),{passive:!1}),e.addEventListener("click",bt(this,ft,"f")),e.addEventListener("contextmenu",bt(this,dt,"f"))},yt=function(e){return e.target===bt(this,st,"f").boardContent.boardContext.canvas},pt=function(e){const t=bt(this,st,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},xt=function(e){const t=bt(this,st,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!(At(e.x)&&At(e.y)&&e.x<=i&&e.y<=o)};var Mt,zt,Rt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Pt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const Tt={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class Et{constructor(){Mt.set(this,void 0),zt.set(this,void 0);const e=new H({defaultStorage:Tt}),t=new H({defaultStorage:{}});Rt(this,Mt,e,"f"),Rt(this,zt,t,"f")}getActiveStorage(e){return Pt(this,Mt,"f").get(e)}setActiveStorage(e,t){return Pt(this,Mt,"f").set(e,t)}getActiveStoreSnapshot(){return Pt(this,Mt,"f").getSnapshot()}getSharedStorage(e){return Pt(this,zt,"f").get(e)}setSharedStorage(e,t){return Pt(this,zt,"f").set(e,t)}getSharedStoreSnapshot(){return Pt(this,zt,"f").getSnapshot()}getActiveViewScaleInfo(){return{scale:Pt(this,Mt,"f").get("scale"),offsetTop:Pt(this,Mt,"f").get("offsetTop"),offsetBottom:Pt(this,Mt,"f").get("offsetBottom"),offsetLeft:Pt(this,Mt,"f").get("offsetLeft"),offsetRight:Pt(this,Mt,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;Pt(this,Mt,"f").set("scale",t),Pt(this,Mt,"f").set("offsetTop",i),Pt(this,Mt,"f").set("offsetBottom",o),Pt(this,Mt,"f").set("offsetLeft",n),Pt(this,Mt,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){Pt(this,Mt,"f").set("width",e.width),Pt(this,Mt,"f").set("height",e.height),Pt(this,Mt,"f").set("devicePixelRatio",e.devicePixelRatio),Pt(this,Mt,"f").set("contextWidth",e.contextWidth),Pt(this,Mt,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:Pt(this,Mt,"f").get("width"),height:Pt(this,Mt,"f").get("height"),devicePixelRatio:Pt(this,Mt,"f").get("devicePixelRatio"),contextWidth:Pt(this,Mt,"f").get("contextWidth"),contextHeight:Pt(this,Mt,"f").get("contextHeight")}}}Mt=new WeakMap,zt=new WeakMap;var Ct,Wt,Ot,jt,kt,Dt,Lt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Yt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const{requestAnimationFrame:Bt}=window;class Ft extends L{constructor(e){super(),Ct.add(this),Wt.set(this,void 0),Ot.set(this,[]),jt.set(this,"FREE"),Lt(this,Wt,e,"f"),Yt(this,Ct,"m",kt).call(this)}drawFrame(){const{sharer:e}=Yt(this,Wt,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();Yt(this,Ot,"f").push({activeStore:t,sharedStore:i}),Yt(this,Ct,"m",Dt).call(this)}scale(e){const{scale:t,point:i}=e,{sharer:o}=Yt(this,Wt,"f"),{moveX:n,moveY:a}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:a}=o,r=t/o.scale,s=i.x,l=i.y;return{moveX:s-s*r+(n*r-n),moveY:l-l*r+(a*r-a)}}({scale:t,point:i,viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()});return o.setActiveStorage("scale",t),{moveX:n,moveY:a}}scroll(e){const{sharer:t}=Yt(this,Wt,"f"),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n}=e,a=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:a}=o,{width:r,height:s,contextWidth:l,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,f=o.offsetTop,u=o.offsetBottom;return c+=t,f+=i,d=r-(l*a+c),u=s-(h*a+f),{scale:a,offsetTop:f,offsetLeft:c,offsetRight:d,offsetBottom:u}}({moveX:o,moveY:n,viewScaleInfo:i,viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(a),a}updateViewScaleInfo(e){const{sharer:t}=Yt(this,Wt,"f"),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:a}=t,{width:r,height:s,contextWidth:l,contextHeight:h}=a,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:r-(l*i+c/i),offsetBottom:s-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),i}resize(e={}){const{sharer:t}=Yt(this,Wt,"f"),i=t.getActiveViewSizeInfo(),o=Object.assign(Object.assign({},i),e),{width:n,height:a,devicePixelRatio:r}=o,{underContext:s,boardContext:l,helperContext:h,viewContext:c}=Yt(this,Wt,"f").boardContent;return l.canvas.width=n*r,l.canvas.height=a*r,l.canvas.style.width=`${n}px`,l.canvas.style.height=`${a}px`,s.canvas.width=n*r,s.canvas.height=a*r,h.canvas.width=n*r,h.canvas.height=a*r,c.canvas.width=n*r,c.canvas.height=a*r,t.setActiveViewSizeInfo(o),o}}Wt=new WeakMap,Ot=new WeakMap,jt=new WeakMap,Ct=new WeakSet,kt=function(){const{renderer:e}=Yt(this,Wt,"f");e.on("load",(()=>{this.drawFrame()}))},Dt=function e(){if("DRAWING"===Yt(this,jt,"f")||0===Yt(this,Ot,"f").length)return;Lt(this,jt,"DRAWING","f");const t=Yt(this,Ot,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=Yt(this,Wt,"f");if(t){const{scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h,width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g}=t.activeStore,w={scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h},v={width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g};(null==t?void 0:t.activeStore.data)&&i.drawData(t.activeStore.data,{viewScaleInfo:w,viewSizeInfo:v}),n({snapshot:t}),o.drawView(),a({snapshot:t})}0!==Yt(this,Ot,"f").length?Lt(this,jt,"DRAWING","f")&&Bt((()=>{Yt(this,Ct,"m",e).call(this)})):Lt(this,jt,"COMPLETE","f")};var Gt,Nt,Xt,Vt,Ht,Zt,Qt,$t,Ut,Jt,Kt,qt,_t,ei,ti,ii,oi,ni,ai,ri,si,li,hi,ci,di,fi,ui=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},gi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class wi{constructor(e){Gt.add(this),Nt.set(this,void 0),Xt.set(this,new WeakMap),Vt.set(this,[]),Ht.set(this,[]),Zt.set(this,void 0),Qt.set(this,void 0),$t.set(this,void 0),Ut.set(this,void 0),Jt.set(this,void 0),Kt.set(this,new L);const{boardContent:t}=e,i=new Et,o=new at({viewContext:t.viewContext}),n=new It({boardContent:t,sharer:i}),a=new tt({viewContext:t.viewContext,sharer:i,calculator:o});ui(this,Nt,e,"f"),ui(this,$t,i,"f"),ui(this,Zt,n,"f"),ui(this,Qt,a,"f"),ui(this,Jt,o,"f"),ui(this,Ut,new Ft({boardContent:e.boardContent,sharer:i,renderer:a,calculator:gi(this,Jt,"f"),beforeDrawFrame:e=>{gi(this,Gt,"m",ci).call(this,e)},afterDrawFrame:e=>{gi(this,Gt,"m",di).call(this,e)}}),"f"),gi(this,Gt,"m",qt).call(this),gi(this,Gt,"m",fi).call(this)}destroy(){gi(this,Zt,"f").destroy(),gi(this,Qt,"f").destroy(),gi(this,Jt,"f").destroy(),gi(this,Kt,"f").destroy()}getSharer(){return gi(this,$t,"f")}getViewer(){return gi(this,Ut,"f")}getRenderer(){return gi(this,Qt,"f")}setData(e){const t=gi(this,$t,"f");gi(this,$t,"f").setActiveStorage("data",e);const i=t.getActiveViewSizeInfo(),o=re(e.elements,{viewWidth:i.width,viewHeight:i.height,extend:!0});gi(this,Ut,"f").drawFrame();const n=Object.assign(Object.assign({},i),o);return gi(this,$t,"f").setActiveViewSizeInfo(n),{viewSizeInfo:n}}getData(){const{data:e}=gi(this,$t,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(gi(this,Xt,"f").has(e)){const o=gi(this,Xt,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",gi(this,Xt,"f").set(e,o),void gi(this,Gt,"m",fi).call(this)}const{boardContent:n,container:a}=gi(this,Nt,"f"),r=e({boardContent:n,sharer:gi(this,$t,"f"),viewer:gi(this,Ut,"f"),calculator:gi(this,Jt,"f"),eventHub:gi(this,Kt,"f"),container:a});null===(o=r.use)||void 0===o||o.call(r),gi(this,Vt,"f").push(e),gi(this,Ht,"f").push(r),gi(this,Xt,"f").set(e,{status:"enable",middlewareObject:r}),gi(this,Gt,"m",fi).call(this)}disuse(e){var t,i;const o=gi(this,Xt,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",gi(this,Xt,"f").set(e,o),gi(this,Gt,"m",fi).call(this))}scale(e){const t=gi(this,Ut,"f"),{moveX:i,moveY:o}=t.scale(e);t.scroll({moveX:i,moveY:o})}scroll(e){return gi(this,Ut,"f").scroll(e)}updateViewScaleInfo(e){return gi(this,Ut,"f").updateViewScaleInfo(e)}resize(e){const t=gi(this,Ut,"f").resize(e),{width:i,height:o,devicePixelRatio:n}=e,{boardContent:a}=gi(this,Nt,"f");a.viewContext.$resize({width:i,height:o,devicePixelRatio:n}),a.helperContext.$resize({width:i,height:o,devicePixelRatio:n}),a.boardContext.$resize({width:i,height:o,devicePixelRatio:n}),a.underContext.$resize({width:i,height:o,devicePixelRatio:n}),gi(this,Ut,"f").drawFrame(),gi(this,Zt,"f").trigger("resize",t),gi(this,$t,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=gi(this,Nt,"f"),{underContext:t,helperContext:i,viewContext:o,boardContext:n}=e;t.clearRect(0,0,t.canvas.width,t.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),gi(this,Gt,"m",hi).call(this)}getEventHub(){return gi(this,Kt,"f")}}Nt=new WeakMap,Xt=new WeakMap,Vt=new WeakMap,Ht=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,$t=new WeakMap,Ut=new WeakMap,Jt=new WeakMap,Kt=new WeakMap,Gt=new WeakSet,qt=function(){gi(this,Zt,"f").on("pointStart",gi(this,Gt,"m",_t).bind(this)),gi(this,Zt,"f").on("pointEnd",gi(this,Gt,"m",ei).bind(this)),gi(this,Zt,"f").on("pointMove",h((e=>{gi(this,Gt,"m",ti).call(this,e)}),10)),gi(this,Zt,"f").on("hover",h((e=>{gi(this,Gt,"m",ii).call(this,e)}),10)),gi(this,Zt,"f").on("wheel",h((e=>{gi(this,Gt,"m",ni).call(this,e)}),10)),gi(this,Zt,"f").on("wheelScale",h((e=>{gi(this,Gt,"m",ai).call(this,e)}),10)),gi(this,Zt,"f").on("scrollX",gi(this,Gt,"m",ri).bind(this)),gi(this,Zt,"f").on("scrollY",gi(this,Gt,"m",si).bind(this)),gi(this,Zt,"f").on("resize",gi(this,Gt,"m",li).bind(this)),gi(this,Zt,"f").on("doubleClick",gi(this,Gt,"m",oi).bind(this))},_t=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},ei=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},ti=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointMove)||void 0===t?void 0:t.call(o,e)))return}},ii=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},oi=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},ni=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},ai=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheelScale)||void 0===t?void 0:t.call(o,e)))return}},ri=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},si=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},li=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},hi=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.clear)||void 0===t?void 0:t.call(o,e)))return}},ci=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},di=function(e){var t;for(let i=0;i<gi(this,Ht,"f").length;i++){const o=gi(this,Ht,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},fi=function(){const e=[],t=gi(this,Xt,"f");gi(this,Vt,"f").forEach((i=>{const o=t.get(i);"enable"===(null==o?void 0:o.status)&&(null==o?void 0:o.middlewareObject)&&e.push(o.middlewareObject)})),ui(this,Ht,e,"f")};const vi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PS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VNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";class mi{constructor(e,t){this._cursorType=null,this._resizeCursorBaseImage=null,this._cursorImageMap={auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YX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KZpPAO8AwQCwW+2d0dLQ0OTkZSafT0UKhUJ6bm9t2HKeysrIS3tra0g7+KvABUJC0g5rrJdRcbLpImtleRzYashc1P2OSXwbebDVykX3gW+Ab1AHqhuQ3pe6AJlFMO0CoPROHDcio5I8DL1A9C8dQbmod+APYAK4DvwjQnsDdErgyVTfTEaCG1GFYGHXG7TVSo2OkdvhlAflXoHSuNdfStFqaRhEi2kfdprrj6M5LAt0I8EDaaMdflPal48CB95hMr3Bt8h4jD0kyL5E0pN6dysZzW7N2AqjbmhdIZjJvufTOpE19x3g+9s1XJ/ck5tVbfdhu+rxDfLiSO+lFToCjZwrXyH2/0Lwv95z8B1jAqXmDnj4YAAAAAElFTkSuQmCC","rotate-0":vi},this._container=e,this._eventHub=t.eventHub,this._init(),this._loadResizeCursorBaseImage()}_init(){const{_eventHub:e}=this;this._resetCursor("auto"),e.on("cursor",(e=>{var t;"over-element"!==e.type&&e.type?"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?this._setCursorResize(e):"drag-default"===e.type?this._resetCursor("drag-default"):"drag-active"===e.type?this._resetCursor("drag-active"):this._resetCursor("auto"):this._resetCursor("auto")}))}_loadResizeCursorBaseImage(){x(vi).then((e=>{this._resizeCursorBaseImage=e})).catch((e=>{console.error(e)}))}_resetCursor(e){if(this._cursorType===e)return;this._cursorType=e;const t=this._cursorImageMap[this._cursorType]||this._cursorImageMap.auto;let i=0,o=0;e.startsWith("rotate-")&&this._cursorImageMap[this._cursorType]&&(i=10,o=10),this._container.style.cursor=`image-set(url(${t})2x) ${i} ${o}, auto`}_setCursorResize(e){var t;let i=0;"resize-top"===e.type?i+=0:"resize-top-right"===e.type?i+=45:"resize-right"===e.type?i+=90:"resize-bottom-right"===e.type?i+=135:"resize-bottom"===e.type?i+=180:"resize-bottom-left"===e.type?i+=225:"resize-left"===e.type?i+=270:"resize-top-left"===e.type&&(i+=315),i+=ne((null==(t=null==e?void 0:e.element)?void 0:t.angle)||0),Array.isArray(e.groupQueue)&&e.groupQueue.length>0&&e.groupQueue.forEach((e=>{i+=ne(e.angle||0)})),i=ne(i);const o=this._appendRotateResizeImage(i);this._resetCursor(o)}_appendRotateResizeImage(e){const t=`rotate-${e}`;if(!this._cursorImageMap[t]){const i=this._resizeCursorBaseImage;if(i){const o=document.createElement("canvas"),n=i.width,a=i.height,r={x:n/2,y:a/2};o.width=n,o.height=a;const s=o.getContext("2d"),l=$(e);s.translate(r.x,r.y),s.rotate(l),s.translate(-r.x,-r.y),s.drawImage(i,0,0,n,a),s.translate(r.x,r.y),s.rotate(-l),s.translate(-r.x,-r.y);const h=o.toDataURL("image/png");this._cursorImageMap[t]=h}}return t}}const yi="SELECT",pi=Symbol(`${yi}_actionType`),xi=Symbol(`${yi}_resizeType`),Si=Symbol(`${yi}_areaStart`),bi=Symbol(`${yi}_areaEnd`),Ai=Symbol(`${yi}_hoverElement`),Ii=Symbol(`${yi}_hoverElementVertexes`),Mi=Symbol(`${yi}_selectedElementList`),zi=Symbol(`${yi}_selectedElementListVertexes`),Ri=Symbol(`${yi}_selectedElementController`),Pi=Symbol(`${yi}_groupQueue`),Ti=Symbol(`${yi}_groupQueueVertexesList`),Ei="#1973ba";function Ci(e,t,i){const{borderColor:o,borderWidth:n,background:a,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=a,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[0].x,t[0].y),e.closePath(),e.stroke(),e.fill()}function Wi(e,t,i){if(!t)return;const o={borderColor:Ei,borderWidth:1,background:"transparent",lineDash:[]};Ci(e,he(t,i),o)}function Oi(e,t,i){if(!t)return;const{elementWrapper:o,topLeft:n,topRight:a,bottomLeft:r,bottomRight:s}=t,l={borderColor:Ei,borderWidth:2,background:"transparent",lineDash:[]},h={...l,borderWidth:4,background:"#FFFFFF"};Ci(e,he(o,i),l),Ci(e,he(n.vertexes,i),h),Ci(e,he(a.vertexes,i),h),Ci(e,he(r.vertexes,i),h),Ci(e,he(s.vertexes,i),h)}function ji(e){return e*Math.PI/180}function ki(e,t){return Math.sqrt(e*e+t*t)}function Di(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function Li(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,vertexes:a}=t,r=le(a[0],{viewScaleInfo:o,viewSizeInfo:n}),s=le(a[1],{viewScaleInfo:o,viewSizeInfo:n}),l=le(a[2],{viewScaleInfo:o,viewSizeInfo:n}),h=le(a[3],{viewScaleInfo:o,viewSizeInfo:n});return i.beginPath(),i.moveTo(r.x,r.y),i.lineTo(s.x,s.y),i.lineTo(l.x,l.y),i.lineTo(h.x,h.y),i.lineTo(r.x,r.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function Yi(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:a}=t;if(!(a&&(null==a?void 0:a.length)>0))return!1;const r=ue(a),s=r[r.length-1];return!!s&&Li(e,{ctx:i,vertexes:s,viewScaleInfo:o,viewSizeInfo:n})}function Bi(e,t){var i,o,n;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:r,data:s,calculator:l,selectedElements:h,viewScaleInfo:c,viewSizeInfo:d,areaSize:f,groupQueue:u,selectedElementController:g}=t;if(g){const{left:t,right:i,top:o,bottom:n,topLeft:s,topRight:l,bottomLeft:f,bottomRight:w}=g,v=[t,i,o,n,s,l,f,w];for(let t=0;t<v.length;t++){const i=v[t];if(Li(e,{ctx:r,vertexes:i.vertexes,viewSizeInfo:d,viewScaleInfo:c})){a.type=`resize-${i.type}`,h&&(null==h?void 0:h.length)>0&&(a.groupQueue=u||[],a.elements=[h[0]]);break}}}if(u&&Array.isArray(u)&&u.length>0){const t=u[u.length-1];if((null==(i=null==t?void 0:t.detail)?void 0:i.children)&&Array.isArray(null==(o=null==t?void 0:t.detail)?void 0:o.children))for(let i=t.detail.children.length-1;i>=0;i--){const o=t.detail.children[i],n=ge(o,{groupQueue:u});if(n&&Li(e,{ctx:r,vertexes:n,viewScaleInfo:c,viewSizeInfo:d}))return a.type||(a.type="over-element"),a.groupQueue=u,a.elements=[o],a}return a}if(null!==a.type)return a;if(f&&Array.isArray(h)&&(null==h?void 0:h.length)>1){const{x:t,y:i,w:o,h:n}=f;if(e.x>=t&&e.x<=t+o&&e.y>=i&&e.y<=i+n)return a.type="list-area",a.elements=h,a}if(s){const{index:t,element:i}=l.getPointElement(e,{data:s,viewScaleInfo:c,viewSizeInfo:d});if(t>=0&&i&&!0!==(null==(n=null==i?void 0:i.operations)?void 0:n.invisible))return a.elements=[i],a.type="over-element",a}return a}function Fi(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{calculator:n,viewScaleInfo:a,viewSizeInfo:r}=t;let s=null;for(let t=0;t<e.length;t++){const l=e[t];if(null==(i=null==l?void 0:l.operations)?void 0:i.invisible)continue;const h=n.elementSize(l,a,r);if(h.angle&&(h.angle>0||h.angle<0)){const e=ie(h);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];h.x=Math.min(...t),h.y=Math.min(...i),h.w=Math.abs(Math.max(...t)-Math.min(...t)),h.h=Math.abs(Math.max(...i)-Math.min(...i))}}if(s){const e=Math.min(h.x,o.x),t=Math.min(h.y,o.y),i=Math.max(h.x+h.w,o.x+o.w),n=Math.max(h.y+h.h,o.y+o.h);o.x=e,o.y=t,o.w=Math.abs(i-e),o.h=Math.abs(n-t)}else o.x=h.x,o.y=h.y,o.w=h.w,o.h=h.h;s=h}return o}const Gi="@middleware/text-edit",Ni={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"},Xi="@middleware/select",Vi="@middleware/select-clear",Hi="SCROLL",Zi=Symbol(`${Hi}_xThumbRect`),Qi=Symbol(`${Hi}_yThumbRect`),$i=Symbol(`${Hi}_prevPoint`),Ui=Symbol(`${Hi}_activePoint`),Ji=Symbol(`${Hi}_activeThumbType`),Ki=16,qi=.36,_i={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function eo(e,t,i){const o=e,{x:n,y:a,w:r,h:s}=i;return o.beginPath(),o.rect(n,a,r,s),o.closePath(),!!o.isPointInPath(t.x,t.y)}function to(e,t){let{x:i,y:o,h:n,w:a}=t;e.save(),e.shadowColor="#FFFFFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=1;{const{color:r,axis:s}=t;"X"===s?(o=o+n/4+0,n/=2):"Y"===s&&(i=i+a/4+0,a/=2);let l=t.r;l=Math.min(l,a/2,n/2),(a<2*l||n<2*l)&&(l=0),e.globalAlpha=qi,e.beginPath(),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.fillStyle=r,e.fill(),e.globalAlpha=1,e.beginPath(),e.lineWidth=1,e.strokeStyle=r,e.setLineDash([]),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.stroke()}e.restore()}function io(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:a}=t,{activeThumbType:r,prevPoint:s,activePoint:l}=a,h=function(e,t){const{width:i,height:o}=t,{offsetTop:n,offsetBottom:a,offsetLeft:r,offsetRight:s}=e,l=2.5*Ki,h=Ki;let c=0,d=0;c=Math.max(l,i-2*h-(Math.abs(r)+Math.abs(s))),c>=i&&(c=i),d=Math.max(l,o-2*h-(Math.abs(n)+Math.abs(a))),d>=o&&(d=o);const f=h;let u=f;r>0?u=f:s>0?u=i-c-h:r<=0&&c>0&&(0!==r||0!==s)&&(u=f+(i-c)*Math.abs(r)/(Math.abs(r)+Math.abs(s)),u=Math.min(Math.max(0,u-f),i-c));const g=h;let w=g;n>0?w=g:a>0?w=o-d-h:n<=0&&d>0&&(0!==n||0!==a)&&(w=g+(o-d)*Math.abs(n)/(Math.abs(n)+Math.abs(a)),w=Math.min(Math.max(0,w-g),o-d));const v={x:u,y:o-h,w:c,h:h},m={x:i-h,y:w,w:h,h:d};return{lineSize:h,xSize:c,ySize:d,translateY:w,translateX:u,thumbColor:_i.thumbColor,scrollBarColor:_i.scrollBarColor,xThumbRect:v,yThumbRect:m}}(o,n);let c={...h.xThumbRect},d={...h.yThumbRect};return r&&s&&l&&("X"===r&&a.xThumbRect?(c={...a.xThumbRect},c.x=c.x+(l.x-s.x)):"Y"===r&&a.yThumbRect&&(d={...a.yThumbRect},d.y=d.y+(l.y-s.y))),to(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),to(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function oo(e,t){const{snapshot:i}=t,o=Q(i),n=Z(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[Ui]||null,prevPoint:t[$i]||null,activeThumbType:t[Ji]||null,xThumbRect:t[Zi]||null,yThumbRect:t[Qi]||null}}(i),{xThumbRect:r,yThumbRect:s}=io(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:r,yThumbRect:s}}const no="@middleware/scale",ao=16,ro="#000000",so="#00000080",lo="monospace",ho="#AAAAAA20",co="#AAAAAA40";function fo(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=ye(a/t,{decimalPlaces:0}),a=Math.max(10,Math.min(a,1e3));const r=10*a,s=5*a;let l=0;const h=a*t,c=0-o,d=c%h,f=(c-d+h)/t,u=h-d+0;for(;u+l*h<i;){const e=ye(f+l*a,{decimalPlaces:0}),t={num:e,position:ye(u+l*h,{decimalPlaces:0}),showNum:e%r==0,isKeyNum:e%r==0,isSubKeyNum:e%s==0};n.push(t),l++}return n}const uo="@middleware/show-ruler",go=Symbol("DRAG_prevPoint");return t=new WeakMap,i=new WeakMap,o=new WeakSet,n=function(){r(this,i).style.position="relative"},e.Core=class{constructor(e,r){s(this,o),s(this,t,void 0),s(this,i,void 0);const{devicePixelRatio:h=1,width:c,height:d}=r;l(this,i,e);const f=document.createElement("canvas");var u,g,w;(u=this,g=o,w=n,a(u,g,"access private method"),w).call(this),e.appendChild(f);const v=function(e,t){const{width:i,height:o,devicePixelRatio:n,offscreen:a}=t,r={width:i,height:o,devicePixelRatio:n};if(!0===a){const t=e.getContext("2d"),i=j(r),o=j(r),n=j(r),a=O(Object.assign({ctx:t},r)),s=()=>{const{width:e,height:t}=i.$getSize();a.clearRect(0,0,e,t),a.drawImage(n.canvas,0,0,e,t),a.drawImage(i.canvas,0,0,e,t),a.drawImage(o.canvas,0,0,e,t),n.clearRect(0,0,e,t),i.clearRect(0,0,e,t),o.clearRect(0,0,e,t)};return{underContext:n,viewContext:i,helperContext:o,boardContext:a,drawView:s}}{const t=e.getContext("2d"),n=O(r),a=O(r),s=O(r),l=O(Object.assign({ctx:t},r)),h=()=>{l.clearRect(0,0,i,o),l.drawImage(s.canvas,0,0,i,o),l.drawImage(n.canvas,0,0,i,o),l.drawImage(a.canvas,0,0,i,o),s.clearRect(0,0,i,o),n.clearRect(0,0,i,o),a.clearRect(0,0,i,o)};return{underContext:s,viewContext:n,helperContext:a,boardContext:l,drawView:h}}}(f,{width:c,height:d,devicePixelRatio:h,offscreen:!0}),m=new wi({boardContent:v,container:e}),y=m.getSharer();y.setActiveViewSizeInfo({width:c,height:d,devicePixelRatio:h,contextWidth:c,contextHeight:d}),l(this,t,m),this.resize(y.getActiveViewSizeInfo());const p=m.getEventHub();new mi(e,{eventHub:p})}destroy(){r(this,t).destroy()}use(e){r(this,t).use(e)}disuse(e){r(this,t).disuse(e)}setData(e){ae((null==e?void 0:e.elements)||[]),r(this,t).setData(e)}getData(){return r(this,t).getData()}scale(e){r(this,t).scale(e);r(this,t).getViewer().drawFrame()}resize(e){const i=r(this,t),o=i.getSharer().getActiveViewSizeInfo();i.resize({...o,...e})}clear(){r(this,t).clear()}on(e,i){r(this,t).getEventHub().on(e,i)}off(e,i){r(this,t).getEventHub().off(e,i)}trigger(e,i){r(this,t).getEventHub().trigger(e,i)}getViewInfo(){const e=r(this,t).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){r(this,t).getViewer().drawFrame()}setViewScale(e){r(this,t).updateViewScaleInfo(e)}getLoadItemMap(){return r(this,t).getRenderer().getLoadItemMap()}},e.MiddlewareDragger=e=>{const{eventHub:t,sharer:i,viewer:o}=e;let n=!1;return{name:"@middleware/dragger",hover(){!0!==n&&t.trigger("cursor",{type:"drag-default"})},pointStart(e){const{point:o}=e;i.setSharedStorage(go,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(go);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(go,t)},pointEnd(){n=!1,i.setSharedStorage(go,null),t.trigger("cursor",{type:"drag-default"})}}},e.MiddlewareRuler=e=>{const{boardContent:t,viewer:i,eventHub:o}=e,{helperContext:n,underContext:a}=t;let r=!0,s=!0;const l=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(r=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(s=e.showGrid),"boolean"!=typeof(null==e?void 0:e.show)&&"boolean"!=typeof(null==e?void 0:e.showGrid)||i.drawFrame()};return{name:"@middleware/ruler",use(){o.on(uo,l)},disuse(){o.off(uo,l)},beforeDrawFrame:({snapshot:e})=>{if(!0===r){const t=Z(e),i=Q(e);!function(e,t){const{viewSizeInfo:i}=t,{width:o,height:n}=i;e.beginPath(),e.moveTo(0,0),e.lineTo(o+1,0),e.lineTo(o+1,ao),e.lineTo(ao,ao),e.lineTo(ao,n+1),e.lineTo(0,n+1),e.lineTo(0,0),e.closePath(),e.fillStyle="#FFFFFFA8",e.fill(),e.lineWidth=1,e.setLineDash([]),e.strokeStyle="#00000080",e.stroke()}(n,{viewScaleInfo:t,viewSizeInfo:i});const o=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetLeft:n}=t,{width:a}=i;return fo({axis:"X",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t;for(let t=0;t<i.length;t++){const o=i[t];o.position<ao||(e.beginPath(),e.moveTo(o.position,16),e.lineTo(o.position,o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8),e.closePath(),e.lineWidth=1,e.setLineDash([]),e.fillStyle=ro,e.stroke(),o.isKeyNum&&(e.fillStyle=so,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:lo}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(n,{scaleList:o});const r=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:a}=i;return fo({axis:"Y",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t,o=3.2;for(let t=0;t<i.length;t++){const n=i[t];if(!(n.position<ao)&&(e.beginPath(),e.moveTo(16,n.position),e.lineTo(n.isKeyNum?3.2:n.isSubKeyNum?6.4:12.8,n.position),e.closePath(),e.fillStyle=ro,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===n.showNum)){const t=o,i=n.position+o,a=`${n.num}`;U(e,-90,{x:t,y:i},(()=>{e.fillStyle=so,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:lo}),e.fillText(a,13.2,n.position+o)}))}}}(n,{scaleList:r}),!0===s&&function(e,t){const{xList:i,yList:o,viewSizeInfo:n}=t,{width:a,height:r}=n;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,r),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=co:e.strokeStyle=ho,e.closePath(),e.lineWidth=1,e.setLineDash([]),e.stroke()}for(let t=0;t<o.length;t++){const i=o[t];e.beginPath(),e.moveTo(0,i.position),e.lineTo(a,i.position),!0===i.isKeyNum||!0===i.isSubKeyNum?e.strokeStyle=co:e.strokeStyle=ho,e.lineWidth=1,e.closePath(),e.stroke()}}(a,{xList:o,yList:r,viewScaleInfo:t,viewSizeInfo:i})}}}},e.MiddlewareScaler=e=>{const{viewer:t,sharer:i,eventHub:o}=e;return{name:"@middleware/scaler",wheelScale(e){const{deltaY:n,point:a}=e,{scale:r}=i.getActiveViewScaleInfo();let s=r;if(n<0?s=1.1*r:n>0&&(s=.9*r),s<.05||s>50)return;const{moveX:l,moveY:h}=t.scale({scale:s,point:a});t.scroll({moveX:l,moveY:h}),t.drawFrame();const c=ye(r);o.trigger(no,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(Zi,null),o.setSharedStorage(Qi,null);const a=()=>{o.setSharedStorage($i,null),o.setSharedStorage(Ui,null),o.setSharedStorage(Ji,null)};a();const r=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&eo(e,t,n)?o="X":a&&eo(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(Zi),yThumbRect:o.getSharedStorage(Qi)});return{name:"@middleware/scroller",wheel:e=>{t.scroll({moveX:0-e.deltaX,moveY:0-e.deltaY}),t.drawFrame()},pointStart:e=>{const{point:t}=e,i=r(t);if("X"===i||"Y"===i)return o.setSharedStorage(Ji,i),o.setSharedStorage($i,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Ji);if("X"===n||"Y"===n)return o.setSharedStorage(Ui,i),"X"===n?(e=>{const i=o.getSharedStorage($i);if(i){const{offsetLeft:n,offsetRight:a}=o.getActiveViewScaleInfo(),{width:r}=o.getActiveViewSizeInfo(),s=-(e.x-i.x)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveX:s}),t.drawFrame()}})(i):"Y"===n&&(e=>{const i=o.getSharedStorage($i);if(i){const{offsetTop:n,offsetBottom:a}=o.getActiveViewScaleInfo(),{height:r}=o.getActiveViewSizeInfo(),s=-(e.y-i.y)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveY:s}),t.drawFrame()}})(i),o.setSharedStorage($i,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Ji);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=oo(n,{snapshot:e});o.setSharedStorage(Zi,t),o.setSharedStorage(Qi,i)}}},e.MiddlewareSelector=e=>{const{viewer:t,sharer:i,boardContent:o,calculator:n,eventHub:a}=e,{helperContext:r}=o;let s=null,l=null;i.setSharedStorage(pi,null);const h=()=>i.getSharedStorage(Mi),c=e=>{let t=i.getSharedStorage(Pi);Array.isArray(t)||(t=[]),t.length>0?!function(e,t){var i;if("group"===(null==t?void 0:t.type)&&Array.isArray(null==(i=null==t?void 0:t.detail)?void 0:i.children))for(let i=0;i<t.detail.children.length;i++){const o=t.detail.children[i];if(e.uuid===o.uuid)return!0}return!1}(e,t[t.length-1])?t=[]:t.push(e):0===t.length&&t.push(e);const o=ue(t);return i.setSharedStorage(Pi,t),i.setSharedStorage(Ti,o),t.length>0},d=e=>{i.setSharedStorage(Ai,e);let t=null;e&&(t=ge(e,{groupQueue:i.getSharedStorage(Pi)})),i.setSharedStorage(Ii,t)},f=(e,t)=>{if(i.setSharedStorage(Mi,e),1===e.length){const t=ve(e[0],{groupQueue:i.getSharedStorage(Pi),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Ri,t)}else i.setSharedStorage(Ri,null);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(Xi,{uuids:e.map((e=>e.uuid))})},u=()=>({ctx:r,calculator:n,data:i.getActiveStorage("data"),selectedElements:h(),viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(Pi),areaSize:null,selectedElementController:i.getSharedStorage(Ri)}),g=()=>{i.setSharedStorage(pi,null),i.setSharedStorage(xi,null),i.setSharedStorage(Si,null),i.setSharedStorage(bi,null),i.setSharedStorage(Pi,[]),i.setSharedStorage(Ti,[]),i.setSharedStorage(Ai,null),i.setSharedStorage(Ii,null),i.setSharedStorage(Mi,[]),i.setSharedStorage(zi,null),i.setSharedStorage(Ri,null)};g();const w=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage(pi),r=i.getActiveStorage("data");n=o&&Array.isArray(o)?function(e,t){const i=[];return e.forEach((e=>{const o=function(e,t){let i=null,o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t<e.length-1&&"group"===n.type)o=n.detail.children;else{if(t!==e.length-1)break;i=n}}return i}(e,t);o&&i.push(o)})),i}(o,(null==r?void 0:r.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let a=0;a<o.length;a++){const r=o[a];e.includes(r.uuid)?i.push(r):"group"===r.type&&t((null===(n=null==r?void 0:r.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==r?void 0:r.elements)||[]);let s=!1;if(a||1!==n.length?"select"===a&&1===n.length&&(s=!0):(i.setSharedStorage(pi,"select"),s=!0),s){const e=function(e,t){const i=[];return function e(t,o){var n;let a=null;for(let r=0;r<o.length;r++){const s=o[r];if(s.uuid===t){a=s;break}if(!a&&"group"===s.type){i.push(s);const o=e(t,(null===(n=null==s?void 0:s.detail)||void 0===n?void 0:n.children)||[]);if((null==o?void 0:o.uuid)===t){a=o;break}i.pop()}}return a}(e,t),i}(n[0].uuid,(null==r?void 0:r.elements)||[]);i.setSharedStorage(Pi,e),f(n),t.drawFrame()}},v=()=>{g(),t.drawFrame()};return{name:"@middleware/selector",use(){a.on(Xi,w),a.on(Vi,v)},disuse(){a.off(Xi,w),a.off(Vi,v)},hover:e=>{var o,s,c,f,g;const w=i.getSharedStorage(xi),v=i.getSharedStorage(pi),m=i.getSharedStorage(Pi),y=e=>{const t=e.type;null===l&&a.trigger("cursor",{type:t,groupQueue:e.groupQueue,element:e.elements[0]})};if((null==m?void 0:m.length)>0){if(!Yi(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(Pi)}))return d(null),void t.drawFrame();const n=Bi(e.point,u());return y(n),w||["area","drag","drag-list"].includes(v)?(d(null),void t.drawFrame()):1===(null==(o=null==n?void 0:n.elements)?void 0:o.length)?(d(n.elements[0]),void t.drawFrame()):(d(null),void t.drawFrame())}if(w||["area","drag","drag-list"].includes(v))return void d(null);if("drag"===v)return void d(null);const p=h(),x=i.getActiveViewScaleInfo(),S=i.getActiveViewSizeInfo(),b=Bi(e.point,{...u(),areaSize:Fi(p,{viewScaleInfo:x,viewSizeInfo:S,calculator:n})});return y(b),null===b.type||"over-element"===b.type&&"select"===i.getSharedStorage(pi)&&1===b.elements.length&&b.elements[0].uuid===(null==(c=null==(s=h())?void 0:s[0])?void 0:c.uuid)||"over-element"===b.type&&null===i.getSharedStorage(pi)&&1===b.elements.length&&b.elements[0].uuid===(null==(f=i.getSharedStorage(Ai))?void 0:f.uuid)?void 0:"over-element"===b.type&&1===(null==(g=null==b?void 0:b.elements)?void 0:g.length)?(i.setSharedStorage(Ai,b.elements[0]),d(b.elements[0]),void t.drawFrame()):i.getSharedStorage(Ai)?(d(null),void t.drawFrame()):void 0},pointStart:e=>{var o,a,l,c;s=e.point,d(null);const w=i.getSharedStorage(Pi);if((null==w?void 0:w.length)>0){if(Yi(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:w})){const t=Bi(e.point,u());d(null),"over-element"===t.type&&1===(null==(o=null==t?void 0:t.elements)?void 0:o.length)?(f([t.elements[0]],{triggerEvent:!0}),i.setSharedStorage(pi,"drag")):(null==(a=t.type)?void 0:a.startsWith("resize-"))?(i.setSharedStorage(xi,t.type),i.setSharedStorage(pi,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const v=Fi(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),m=Bi(e.point,{...u(),areaSize:v,groupQueue:[]});"list-area"===m.type?i.setSharedStorage(pi,"drag-list"):"over-element"===m.type&&1===(null==(l=null==m?void 0:m.elements)?void 0:l.length)?(f([m.elements[0]],{triggerEvent:!0}),i.setSharedStorage(pi,"drag")):(null==(c=m.type)?void 0:c.startsWith("resize-"))?(i.setSharedStorage(xi,m.type),i.setSharedStorage(pi,"resize")):(g(),i.setSharedStorage(pi,"area"),i.setSharedStorage(Si,e.point),f([],{triggerEvent:!0})),t.drawFrame()},pointMove:e=>{var o;const n=i.getActiveStorage("data"),a=h(),r=i.getActiveStorage("scale")||1,c=s,d=e.point,u=i.getSharedStorage(xi),g=i.getSharedStorage(pi),w=i.getSharedStorage(Pi);if("drag"===g){if(l="drag",n&&1===(null==a?void 0:a.length)&&c&&d){const{moveX:e,moveY:t}=function(e,t,i){let o=t.x-e.x,n=t.y-e.y;const a=[];if(i.forEach((e=>{const{x:t,y:i,w:o,h:n,angle:r=0}=e;a.push({x:t,y:i,w:o,h:n,angle:0-r})})),(null==i?void 0:i.length)>0){const i=ee(e,a),r=ee(t,a);o=r.x-i.x,n=r.y-i.y}return{moveX:o,moveY:n}}(c,d,w);a[0].x+=e/r,a[0].y+=t/r,f([a[0]])}t.drawFrame()}else if("drag-list"===g){if(l="drag-list",n&&c&&d&&(null==a?void 0:a.length)>1){const e=(d.x-c.x)/r,t=(d.y-c.y)/r;a.forEach((i=>{i&&(i.x+=e,i.y+=t)})),i.setActiveStorage("data",n)}t.drawFrame()}else if("resize"===g){if(n&&1===(null==a?void 0:a.length)&&c&&(null==u?void 0:u.startsWith("resize-"))){l="resize";const e=[];w.forEach((t=>{const{x:i,y:o,w:n,h:a,angle:r=0}=t;e.push({x:i,y:o,w:n,h:a,angle:0-r})}));let n=c,s=d;w.length>0&&(n=ee(c,e),s=ee(d,e));const h=function(e,t){var i,o,n,a,r,s,l,h,c;let{x:d,y:f,w:u,h:g,angle:w=0}=e;const v=K({x:d,y:f,w:u,h:g,angle:w});w=ne(w);const m=$(w),y=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:p,end:x,resizeType:S,scale:b}=t;let A={...p},I={...x},M={x:A.x,y:v.y},z={x:I.x,y:v.y},R={...M},P={...z},T={x:v.x,y:A.y},E={x:v.x,y:I.y},C={...T},W={...E},O=(P.x-R.x)/b,j=(P.y-R.y)/b,k=ki(O,j),D=(W.x-C.x)/b,L=(W.y-C.y)/b,Y=ki(D,L);(w>0||w<0)&&(A=_(v,p,0-m),I=_(v,x,0-m),M={x:A.x,y:v.y},z={x:I.x,y:v.y},R=_(v,M,m),P=_(v,z,m),T={x:v.x,y:A.y},E={x:v.x,y:I.y},C=_(v,T,m),W=_(v,E,m),O=(P.x-R.x)/b,j=(P.y-R.y)/b,k=ki(O,j),k=Di(k,j),D=(W.x-C.x)/b,L=(W.y-C.y)/b,Y=ki(D,L),Y=Di(Y,L));let B=(x.x-p.x)/b,F=(x.y-p.y)/b;if(!0===y)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(B),Math.abs(F));B=(B>=0?1:-1)*t,F=(F>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(D),Math.abs(L));D=(D>=0?1:-1)*i,L=(L>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(O),Math.abs(j));O=(O>=0?1:-1)*o,j=(j>=0?1:-1)*o/e.w*e.h}else if(["resize-top-left","resize-top-right","resize-bottom-left","resize-bottom-right"].includes(S)){{const t=Math.abs(B);B=(B>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?F=B>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(F=B>0?-i:i)}k=Math.abs(k),Y=k/e.w*e.h}switch(S){case"resize-top":if(0===w)g-F>0&&(f+=F,g-=F,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=F/e.h*e.w/2,u-=F/e.h*e.w));else if(w>0||w<0){let t=v.x,i=v.y;if(w<90){Y=0-Di(Y,L);const e=ji(w),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(w<180){Y=Di(Y,D);const e=ji(w-90),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(w<270){Y=Di(Y,L);const e=ji(w-180),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(w<360){Y=0-Di(Y,D);const e=ji(w-270),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+Y>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(u+=Y/e.h*e.w),g+=Y,d=t-u/2,f=i-g/2)}break;case"resize-bottom":if(0===w)e.h+F>0&&(g+=F,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(d-=F/e.h*e.w/2,u+=F/e.h*e.w));else if(w>0||w<0){let t=v.x,i=v.y;if(w<90){Y=Di(Y,L);const e=ji(w),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(w<180){Y=0-Di(Y,D);const e=ji(w-90),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(w<270){Y=Di(Y,D);const e=ji(w-180),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(w<360){Y=Di(Y,D);const e=ji(w-270),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+Y>0&&(!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(u+=Y/e.h*e.w),g+=Y,d=t-u/2,f=i-g/2)}break;case"resize-left":if(0===w)e.w-B>0&&(d+=B,u-=B,!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g-=B/e.w*e.h,f+=B/e.w*e.h/2));else if(w>0||w<0){let t=v.x,i=v.y;if(w<90){k=0-Di(k,O);const e=ji(w),o=k/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(w<180){k=Di(k,O);const e=ji(w-90),o=k/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(w<270){k=Di(k,j);const e=ji(w-180),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(w<360){k=Di(k,j);const e=ji(w-270),o=k/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}u+k>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(g+=k/e.w*e.h),u+=k,d=t-u/2,f=i-g/2)}break;case"resize-right":if(0===w)e.w+B>0&&(u+=B,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(f-=B*e.h/e.w/2,g+=B*e.h/e.w));else if(w>0||w<0){let t=v.x,i=v.y;if(w<90){k=Di(k,j);const e=ji(w),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(w<180){k=Di(k,F);const e=ji(w-90),o=k/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(w<270){k=Di(k,F);const e=ji(w-180),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e),k=0-k}else if(w<360){k=Di(k,B);const e=ji(w-270),o=k/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}u+k>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=k/e.w*e.h),u+=k,d=t-u/2,f=i-g/2)}break;case"resize-top-left":if(0===w)u-B>0&&(d+=B,u-=B),g-F>0&&(f+=F,g-=F);else if(w>0||w<0){let e=v.x,t=v.y;if(w<90){Y=0-Di(Y,L),k=0-Di(k,y?0-Y:O);const i=Y/2;e+=i*Math.sin(m),t-=i*Math.cos(m);const o=k/2;e-=o*Math.cos(m),t-=o*Math.sin(m)}else if(w<180){Y=Di(Y,D),k=Di(k,y?Y:O);const i=ji(w-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=k/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(w<270){Y=Di(Y,L),k=Di(k,y?Y:j);const i=ji(w-180),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=k/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(w<360){Y=0-Di(Y,D),k=Di(k,y?Y:j);const i=ji(w-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=k/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),u+k>0&&(u+=k),d=e-u/2,f=t-g/2}break;case"resize-top-right":if(0===w)u+B>0&&(u+=B),g-F>0&&(f+=F,g-=F);else if(w>0||w<0){let e=v.x,t=v.y;if(w<90){Y=0-Di(Y,L),k=Di(k,y?Y:j);const i=ji(w),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=k/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(w<180){Y=Di(Y,D),k=Di(k,y?Y:j);const i=ji(w-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=k/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(w<270){const i=ji(w-180);Y=Di(Y,L),k=Di(k,y?Y:0-O);const o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=k/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(w<360){Y=0-Di(Y,D),k=Di(k,y?Y:O);const i=ji(w-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=k/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),u+k>0&&(u+=k),d=e-u/2,f=t-g/2}break;case"resize-bottom-left":if(0===w)e.h+F>0&&(g+=F),e.w-B>0&&(d+=B,u-=B);else if(w>0||w<0){let e=v.x,t=v.y;if(w<90){Y=Di(Y,L),k=0-Di(k,y?0-Y:O);const i=ji(w),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=k/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(w<180){Y=0-Di(Y,D),k=Di(k,y?Y:O);const i=ji(w-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=k/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(w<270){Y=Di(Y,D),k=Di(k,y?Y:j);const i=ji(w-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=k/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(w<360){Y=Di(Y,D),k=Di(k,y?Y:j);const i=ji(w-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=k/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),u+k>0&&(u+=k),d=e-u/2,f=t-g/2}break;case"resize-bottom-right":if(0===w)e.h+F>0&&(g+=F),e.w+B>0&&(u+=B);else if(w>0||w<0){let e=v.x,t=v.y;if(w<90){Y=Di(Y,L),k=Di(k,y?Y:j);const i=ji(w),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=k/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(w<180){Y=0-Di(Y,D),k=Di(k,y?Y:F);const i=ji(w-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=k/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(w<270){Y=Di(Y,D),k=Di(k,y?Y:0-j);const i=ji(w-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=k/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(w<360){Y=Di(Y,D),k=Di(k,y?Y:O);const i=ji(w-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=k/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),u+k>0&&(u+=k),d=e-u/2,f=t-g/2}}return{x:d,y:f,w:u,h:g,angle:e.angle}}(a[0],{scale:r,start:n,end:s,resizeType:u,sharer:i});a[0].x=h.x,a[0].y=h.y,"group"===a[0].type&&!0===(null==(o=a[0].operations)?void 0:o.deepResize)?function(e,t){const i=t.w&&t.w>0?t.w:e.w,o=t.h&&t.h>0?t.h:e.h,n=i/e.w,a=o/e.h;if(n===a&&1===n)return e;const r=Math.min(n,a),s=Math.max(n,a);e.w=i,e.h=o;const l={xRatio:n,yRatio:a,minRatio:r,maxRatio:s};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ae(e,l)})),be(e,l)}(a[0],{w:h.w,h:h.h}):(a[0].w=h.w,a[0].h=h.h),f([a[0]]),t.drawFrame()}}else"area"===g&&(l="area",i.setSharedStorage(bi,e.point),t.drawFrame());s=e.point},pointEnd(e){l=null;const o=i.getActiveStorage("data"),r=i.getSharedStorage(xi),h=i.getSharedStorage(pi),c=i.getActiveViewSizeInfo();let d=!1;if(s=null,"resize"===h&&r)i.setSharedStorage(xi,null),d=!0;else if("area"===h){if(i.setSharedStorage(pi,null),o){const e=i.getSharedStorage(Si),t=i.getSharedStorage(bi);if(e&&t){const{elements:a}=function(e,t){const i=[],o=[],n=[],{calculator:a,viewScaleInfo:r,viewSizeInfo:s,start:l,end:h}=t;if(!(Array.isArray(e.elements)&&l&&h))return{indexes:i,uuids:o,elements:n};const c=Math.min(l.x,h.x),d=Math.max(l.x,h.x),f=Math.min(l.y,h.y),u=Math.max(l.y,h.y);return e.elements.forEach(((e,t)=>{const l=a.elementSize(e,r,s),h=K(l);if(h.x>=c&&h.x<=d&&h.y>=f&&h.y<=u&&(i.push(t),o.push(e.uuid),n.push(e),l.angle&&(l.angle>0||l.angle<0))){const e=ie(l);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];l.x=Math.min(...t),l.y=Math.min(...i),l.w=Math.abs(Math.max(...t)-Math.min(...t)),l.h=Math.abs(Math.max(...i)-Math.min(...i))}}})),{indexes:i,uuids:o,elements:n}}(o,{start:e,end:t,calculator:n,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()});a.length>0&&(i.setSharedStorage(pi,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage(pi,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage(pi,"select"),d=!0):i.setSharedStorage(pi,null)}null===i.getSharedStorage(pi)&&(g(),d=!0);(()=>{if(d){if(o&&Array.isArray(null==o?void 0:o.elements)&&["drag","drag-list"].includes(h)){const e=function(e,t,i){const o=re(e,{viewWidth:t.width,viewHeight:t.height,extend:null==i?void 0:i.extend});return!0===(null==i?void 0:i.extend)&&(o.contextWidth=Math.max(o.contextWidth,t.contextWidth),o.contextHeight=Math.max(o.contextHeight,t.contextHeight)),{contextSize:o}}(o.elements,c,{extend:!0});i.setActiveStorage("contextHeight",e.contextSize.contextHeight),i.setActiveStorage("contextWidth",e.contextSize.contextWidth)}if(o&&["drag","drag-list","drag-list-end","resize"].includes(h)){let e="drag-element";a.trigger("change",{data:o,type:e})}t.drawFrame()}})()},pointLeave(){s=null,g(),t.drawFrame()},doubleClick(e){var o,n;const r=Bi(e.point,u());if(1===r.elements.length&&"group"===(null==(o=r.elements[0])?void 0:o.type)){if(!0===c(r.elements[0]))return i.setSharedStorage(pi,null),void t.drawFrame()}else 1===r.elements.length&&"text"===(null==(n=r.elements[0])?void 0:n.type)&&a.trigger(Gi,{element:r.elements[0],groupQueue:i.getSharedStorage(Pi)||[],viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(pi,null)},beforeDrawFrame({snapshot:t}){const{activeStore:i,sharedStore:o}=t,{scale:a,offsetLeft:s,offsetTop:l,offsetRight:c,offsetBottom:d,width:f,height:u,contextHeight:g,contextWidth:w,devicePixelRatio:v}=i,m=e.sharer,y={scale:a,offsetLeft:s,offsetTop:l,offsetRight:c,offsetBottom:d},p={width:f,height:u,contextHeight:g,contextWidth:w,devicePixelRatio:v},x=o[Mi][0],S=o[Ai],b=o[Ii],A=o[pi],I=o[Si],M=o[bi],z=o[Pi],R=o[Ti],P={calculator:n,viewScaleInfo:y,viewSizeInfo:p},T=x?ve(x,{groupQueue:z,controllerSize:10,viewScaleInfo:y}):null;if((null==z?void 0:z.length)>0)!function(e,t,i){for(let o=0;o<t.length;o++){const n=t[o],a={borderColor:Ei,borderWidth:2,background:"transparent",lineDash:[4,4]};Ci(e,he(n,i),a)}}(r,R,P),S&&"drag"!==A&&Wi(r,b,P),x&&["select","drag","resize"].includes(A)&&Oi(r,T,{...P});else if(S&&"drag"!==A&&Wi(r,b,P),x&&["select","drag","resize"].includes(A))Oi(r,T,{...P});else if("area"===A&&I&&M)!function(e,t){const{start:i,end:o}=t;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=Ei,e.fillStyle="#1976d24f",e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,i.y),e.lineTo(o.x,o.y),e.lineTo(i.x,o.y),e.closePath(),e.stroke(),e.fill()}(r,{start:I,end:M});else if(["drag-list","drag-list-end"].includes(A)){const e=Fi(h(),{viewScaleInfo:m.getActiveViewScaleInfo(),viewSizeInfo:m.getActiveViewSizeInfo(),calculator:n});e&&function(e,t){const{areaSize:i}=t,{x:o,y:n,w:a,h:r}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=Ei,e.fillStyle="#1976d21c",e.beginPath(),e.moveTo(o,n),e.lineTo(o+a,n),e.lineTo(o+a,n+r),e.lineTo(o,n+r),e.closePath(),e.stroke(),e.fill()}(r,{areaSize:e})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o}=e,n=i.boardContext.canvas,a=document.createElement("textarea"),r=document.createElement("div"),s=e.container||document.body,l=document.createElement("div");let h=null;r.appendChild(a),r.style.position="absolute",l.appendChild(r),l.style.position="fixed",l.style.top="0",l.style.bottom="0",l.style.left="0",l.style.right="0",l.style.display="none",s.appendChild(l);const c=()=>{l.style.display="none",h=null},d=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:a,w:r,h:s}=t,l=ne(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${a}px`,o.style.width=`${r}px`,o.style.height=`${s}px`,o.style.transform=`rotate(${l}deg)`,i.appendChild(o),o},f=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:s,offsetLeft:l}=t;r.children&&Array.from(r.children).forEach((e=>{e.remove()}));let h=r;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:a,w:r,h:c}=t,f={x:i*n,y:a*n,w:r*n,h:c*n,angle:ne(t.angle||0)};0===e&&(f.x+=l,f.y+=s),h=d({size:f,parent:h})}const c={...Ni,...i.detail};let f=i.x*n+l,u=i.y*n+s,g=i.w*n,w=i.h*n;o.length>0&&(f=i.x*n,u=i.y*n,g=i.w*n,w=i.h*n),a.style.position="absolute",a.style.left=`${f}px`,a.style.top=`${u}px`,a.style.width=`${g}px`,a.style.height=`${w}px`,a.style.transform=`rotate(${ne(i.angle||0)}deg)`,a.style.boxSizing="border-box",a.style.border="1px solid #1973ba",a.style.resize="none",a.style.overflow="hidden",a.style.wordBreak="break-all",a.style.background="#FFFFFF",a.style.color="#333333",a.style.fontSize=c.fontSize*n+"px",a.style.lineHeight=c.lineHeight*n+"px",a.style.fontFamily=c.fontFamily,a.style.fontWeight=`${c.fontWeight}`,a.value=c.text||"",h.appendChild(a)},u=()=>{const{left:e,top:t,width:i,height:o}=(()=>{const e=n.getBoundingClientRect(),{left:t,top:i,width:o,height:a}=e;return{left:t,top:i,width:o,height:a}})();r.style.position="absolute",r.style.overflow="hidden",r.style.top=`${t}px`,r.style.left=`${e}px`,r.style.width=`${i}px`,r.style.height=`${o}px`};l.addEventListener("click",(()=>{c()})),a.addEventListener("click",(e=>{e.stopPropagation()})),a.addEventListener("input",(e=>{h&&(h.detail.text=e.target.value||"",o.drawFrame())})),a.addEventListener("blur",(()=>{c()}));const g=e=>{var t;(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(h=e.element),(e=>{u(),f(e),l.style.display="block"})(e)};return{name:"@middleware/text-editor",use(){t.on(Gi,g)},disuse(){t.off(Gi,g)}}},e.middlewareEventRuler=uo,e.middlewareEventScale=no,e.middlewareEventSelect=Xi,e.middlewareEventSelectClear=Vi,e.middlewareEventTextEdit=Gi,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idraw/core",
3
- "version": "0.4.0-beta.8",
3
+ "version": "0.4.0-beta.9",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -21,13 +21,13 @@
21
21
  "author": "chenshenhai",
22
22
  "license": "MIT",
23
23
  "devDependencies": {
24
- "@idraw/types": "^0.4.0-beta.8"
24
+ "@idraw/types": "^0.4.0-beta.9"
25
25
  },
26
26
  "dependencies": {},
27
27
  "peerDependencies": {
28
- "@idraw/board": "^0.4.0-beta.8",
29
- "@idraw/renderer": "^0.4.0-beta.8",
30
- "@idraw/util": "^0.4.0-beta.8"
28
+ "@idraw/board": "^0.4.0-beta.9",
29
+ "@idraw/renderer": "^0.4.0-beta.9",
30
+ "@idraw/util": "^0.4.0-beta.9"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public",