@idraw/core 0.4.0-beta.16 → 0.4.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/middleware/selector/config.d.ts +4 -0
- package/dist/esm/middleware/selector/config.js +4 -0
- package/dist/esm/middleware/selector/draw-auxiliary.d.ts +4 -4
- package/dist/esm/middleware/selector/draw-auxiliary.js +26 -11
- package/dist/esm/middleware/selector/draw-reference.d.ts +5 -0
- package/dist/esm/middleware/selector/draw-reference.js +31 -0
- package/dist/esm/middleware/selector/draw-wrapper.d.ts +2 -2
- package/dist/esm/middleware/selector/draw-wrapper.js +2 -3
- package/dist/esm/middleware/selector/index.js +101 -15
- package/dist/esm/middleware/selector/reference.d.ts +13 -0
- package/dist/esm/middleware/selector/reference.js +273 -0
- package/dist/esm/middleware/selector/types.d.ts +5 -3
- package/dist/esm/middleware/selector/types.js +1 -1
- package/dist/esm/middleware/selector/util.js +12 -13
- package/dist/index.global.js +800 -78
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
- package/dist/esm/middleware/selector/auxiliary.d.ts +0 -5
- package/dist/esm/middleware/selector/auxiliary.js +0 -10
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var iDrawCore=function(e){"use strict";var t,i,o,n,a,r,s,l,h,c,d,f,u,g,v,w,m,y,p,x,S=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},b=(e,t,i)=>(S(e,t,"read from private field"),i?i.call(e):t.get(e)),A=(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)},I=(e,t,i,o)=>(S(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i),M=(e,t,i)=>(S(e,t,"access private method"),i);function z(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 P(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 R(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function T(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 E(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/${T(t.toString(16).padEnd(4,o))}${T(e.substring(i-4,i).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-8,i-4).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-12,i-8).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-16,i-12).padEnd(4,n)).padEnd(4,"f")}-${T(e.substring(i,i+4).padEnd(4,n)).padEnd(4,"f")}${T(e.substring(i+4,i+8).padEnd(4,n)).padEnd(4,"f")}${T(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 C(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const k={type(e,t){const i=C(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===C(e),json:e=>"Object"===C(e),function:e=>"Function"===C(e),asyncFunction:e=>"AsyncFunction"===C(e),boolean:e=>"Boolean"===C(e),string:e=>"String"===C(e),number:e=>"Number"===C(e),undefined:e=>"Undefined"===C(e),null:e=>"Null"===C(e),promise:e=>"Promise"===C(e)};var O=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:j}=window;function D(e){return new Promise(((t,i)=>{const o=new j;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function L(e){return O(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 D(t)}))}function B(e,t){return O(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&");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 D(i)}))}function F(e){return"number"==typeof e&&(e>0||e<=0)}function Y(e){return"number"==typeof e&&e>=0}function G(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function N(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const V={x:function(e){return F(e)},y:function(e){return F(e)},w:Y,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:F,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return Y(e)},borderRadius:function(e){return F(e)&&e>=0},color:function(e){return z(e)},imageSrc:function(e){return N(e)||G(e)},imageURL:G,imageBase64:N,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 F(e)&&e>0},lineHeight:function(e){return F(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 F(e)&&e>0}};var H,Z,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},Q=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 J{constructor(e,t){H.set(this,void 0),Z.set(this,void 0),X(this,H,e,"f"),X(this,Z,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f"),this.$resetFont()}$undoPixelRatio(e){return e/Q(this,Z,"f").devicePixelRatio}$doPixelRatio(e){return Q(this,Z,"f").devicePixelRatio*e}$getContext(){return Q(this,H,"f")}$setContext(e){X(this,H,e,"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"}`),Q(this,H,"f").font=`${t.join(" ")}`}$resetFont(){this.$setFont({fontSize:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontWeight:"400"})}$getOffscreenCanvas(){return Q(this,Z,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:a}=Q(this,H,"f");a.width=t*o,a.height=i*o,X(this,Z,Object.assign(Object.assign({},Q(this,Z,"f")),{devicePixelRatio:o}),"f"),!0===n&&(a.style.width=`${t}px`,a.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=Q(this,Z,"f"),{width:t,height:i}=Q(this,H,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return Q(this,H,"f").canvas}get fillStyle(){return Q(this,H,"f").fillStyle}set fillStyle(e){Q(this,H,"f").fillStyle=e}get strokeStyle(){return Q(this,H,"f").strokeStyle}set strokeStyle(e){Q(this,H,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(Q(this,H,"f").lineWidth)}set lineWidth(e){Q(this,H,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return Q(this,H,"f").textAlign}set textAlign(e){Q(this,H,"f").textAlign=e}get textBaseline(){return Q(this,H,"f").textBaseline}set textBaseline(e){Q(this,H,"f").textBaseline=e}get globalAlpha(){return Q(this,H,"f").globalAlpha}set globalAlpha(e){Q(this,H,"f").globalAlpha=e}get shadowColor(){return Q(this,H,"f").shadowColor}set shadowColor(e){Q(this,H,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(Q(this,H,"f").shadowOffsetX)}set shadowOffsetX(e){Q(this,H,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(Q(this,H,"f").shadowOffsetY)}set shadowOffsetY(e){Q(this,H,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(Q(this,H,"f").shadowBlur)}set shadowBlur(e){Q(this,H,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return Q(this,H,"f").lineCap}set lineCap(e){Q(this,H,"f").lineCap=e}get globalCompositeOperation(){return Q(this,H,"f").globalCompositeOperation}set globalCompositeOperation(e){Q(this,H,"f").globalCompositeOperation=e}fill(...e){return Q(this,H,"f").fill(...e)}arc(e,t,i,o,n,a){return Q(this,H,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,a)}rect(e,t,i,o){return Q(this,H,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return Q(this,H,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return Q(this,H,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return Q(this,H,"f").beginPath()}closePath(){return Q(this,H,"f").closePath()}lineTo(e,t){return Q(this,H,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return Q(this,H,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return Q(this,H,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}getLineDash(){return Q(this,H,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return Q(this,H,"f").setLineDash(t)}stroke(e){return e?Q(this,H,"f").stroke(e):Q(this,H,"f").stroke()}translate(e,t){return Q(this,H,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return Q(this,H,"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?Q(this,H,"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)):Q(this,H,"f").drawImage(t,this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h))}createPattern(e,t){return Q(this,H,"f").createPattern(e,t)}measureText(e){return Q(this,H,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?Q(this,H,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,H,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?Q(this,H,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,H,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){Q(this,H,"f").save()}restore(){Q(this,H,"f").restore()}scale(e,t){Q(this,H,"f").scale(e,t)}circle(e,t,i,o,n,a,r,s){Q(this,H,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,a,r,s)}isPointInPath(e,t){return Q(this,H,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return Q(this,H,"f").clip(...e)}setTransform(e,t,i,o,n,a){return Q(this,H,"f").setTransform(e,t,i,o,n,a)}getTransform(){return Q(this,H,"f").getTransform()}createLinearGradient(e,t,i,o){return Q(this,H,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,a){return Q(this,H,"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 Q(this,H,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function U(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 J(a,e)}function $(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 J(a,{devicePixelRatio:o,offscreenCanvas:n})}H=new WeakMap,Z=new WeakMap;var K,q=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 _{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(q(this,K,"f").has(e)){const i=q(this,K,"f").get(e)||[];null==i||i.push(t),q(this,K,"f").set(e,i)}else q(this,K,"f").set(e,[t])}off(e,t){if(q(this,K,"f").has(e)){const i=q(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}q(this,K,"f").set(e,i||[])}}trigger(e,t){const i=q(this,K,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(q(this,K,"f").has(e)){const t=q(this,K,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){q(this,K,"f").clear()}}function ee(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}K=new WeakMap;var te,ie,oe,ne,ae=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},re=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 se{constructor(e){te.add(this),ie.set(this,void 0),oe.set(this,void 0),ae(this,oe,W(e.defaultStorage),"f"),ae(this,ie,re(this,te,"m",ne).call(this),"f")}set(e,t){re(this,ie,"f")[e]=t}get(e){return re(this,ie,"f")[e]}getSnapshot(){return re(this,ie,"f")}clear(){ae(this,ie,re(this,te,"m",ne).call(this),"f")}destroy(){ae(this,ie,null,"f")}}function le(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 he(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 ce(e){return e/180*Math.PI}function de(e,t,i,o){const n=ce(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 fe(e,t,i){const o=ue(t);de(e,t.angle||0,o,(()=>{i(e)}))}function ue(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function ge(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 ue({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 ve(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}function we(e,t,i){let o=ve(e,t)+i;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const n=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 a=0,r=0;return 0===o?(a=0,r=0-n):o>0&&o<Math.PI/2?(a=Math.sin(o)*n,r=0-Math.cos(o)*n):o===Math.PI/2?(a=n,r=0):o>Math.PI/2&&o<Math.PI?(a=Math.sin(Math.PI-o)*n,r=Math.cos(Math.PI-o)*n):o===Math.PI?(a=0,r=n):o>Math.PI&&o<1.5*Math.PI?(a=0-Math.sin(o-Math.PI)*n,r=Math.cos(o-Math.PI)*n):o===1.5*Math.PI?(a=0-n,r=0):o>1.5*Math.PI&&o<2*Math.PI?(a=0-Math.sin(2*Math.PI-o)*n,r=0-Math.cos(2*Math.PI-o)*n):o===2*Math.PI&&(a=0,r=0-n),a+=e.x,r+=e.y,{x:a,y:r}}function me(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=we(ue({x:t,y:n,w:a,h:r,angle:s}),{x:i,y:o},ce(s));i=l.x,o=l.y})),{x:i,y:o}}return e}function ye(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=ce(Se(i));s=we(t,s,e),l=we(t,l,e),h=we(t,h,e),c=we(t,c,e)}return[s,l,h,c]}function pe(e){const{angle:t=0}=e;return ye(e,ue(e),t)}function xe(e,t,i){return[we(e,{x:t[0].x,y:t[0].y},i),we(e,{x:t[1].x,y:t[1].y},i),we(e,{x:t[2].x,y:t[2].y},i),we(e,{x:t[3].x,y:t[3].y},i)]}function Se(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function be(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=be(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function Ae(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=pe(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 Ie(e,t){const i=[];let o=!1;const n=t=>{var a;for(let r=0;r<t.length&&!0!==o;r++){i.push(r);const s=t[r];if(s.uuid===e){o=!0;break}if("group"===s.type&&n((null===(a=null==s?void 0:s.detail)||void 0===a?void 0:a.children)||[]),o)break;i.pop()}};return n(t),i}function Me(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 ze(e){const{x:t,y:i,w:o,h:n,angle:a=0}=e;return 0===a?Me(e):ye(e,ue({x:t,y:i,w:o,h:n,angle:a}),a)}function Pe(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=ze({x:r,y:s,w:l,h:h,angle:c}),n.push({center:ue(e),angle:c,radian:ce(c)})}else{d=Me({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=xe(t,d,i)}const e=ge(d);if(c>0||c<0){d=xe(e,d,ce(c))}n.push({center:e,angle:c,radian:ce(c)})}t.push(d)}return t}function Re(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Pe([...i,e]):[ze(e)]}(e,t);return i.pop()||null}function Te(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 Ee(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 We(e,t){return[Ee(e[0],t),Ee(e[1],t),Ee(e[2],t),Ee(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}=Te(o,{viewScaleInfo:n,viewSizeInfo:a}),d=pe({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 ke(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 Oe(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:R(),x:r,y:s,w:l,h:h,angle:c,type:"group",detail:{children:[]}},...i];let f=0;d.forEach((({angle:e=0})=>{f+=e}));const u=Re(e,{groupQueue:i}),g=Re({x:r-2*a,y:s-2*a,h:h+4*a,w:l+4*a,angle:c},{groupQueue:[...i]}),v=ee(u[0],u[1]),w=ee(u[1],u[2]),m=ee(u[2],u[3]),y=ee(u[3],u[0]),p=u[0],x=u[1],S=u[2],b=u[3],A=ke(v,{size:a,angle:f}),I=ke(w,{size:a,angle:f}),M=ke(m,{size:a,angle:f}),z=ke(y,{size:a,angle:f}),P=ke(p,{size:a,angle:f}),T=ke(x,{size:a,angle:f}),E=ke(b,{size:a,angle:f}),W=ke(S,{size:a,angle:f}),C=ze(P),k=ze(T),O=ze(E),j=ze(W),D=[C[1],k[0],k[3],C[2]],L=[k[3],k[2],j[1],j[0]],B=[O[1],j[0],j[3],O[2]],F=[C[3],C[2],O[1],O[0]],Y=ze(A),G=ze(I),N=ze(M),V=ze(z),H=ee(g[0],g[1]);return{elementWrapper:u,left:{type:"left",vertexes:F,center:y},right:{type:"right",vertexes:L,center:w},top:{type:"top",vertexes:D,center:v},bottom:{type:"bottom",vertexes:B,center:m},topLeft:{type:"top-left",vertexes:C,center:p},topRight:{type:"top-right",vertexes:k,center:x},bottomLeft:{type:"bottom-left",vertexes:O,center:b},bottomRight:{type:"bottom-right",vertexes:j,center:S},leftMiddle:{type:"left-middle",vertexes:V,center:y},rightMiddle:{type:"right-middle",vertexes:G,center:w},topMiddle:{type:"top-middle",vertexes:Y,center:v},bottomMiddle:{type:"bottom-middle",vertexes:N,center:m},rotate:{type:"rotate",vertexes:ze(ke(H,{size:a,angle:f})),center:H}}}function je(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function De(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))}ie=new WeakMap,oe=new WeakMap,te=new WeakSet,ne=function(){return W(re(this,oe,"f"))};const Le={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 Be(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{boxSizing:a=Le.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 Fe=e=>De(e,{decimalPlaces:4});function Ye(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=Fe(s*r);else if(Array.isArray(i.borderWidth)){const e=s;i.borderWidth=[Fe(e[0]*n),Fe(e[1]*o),Fe(e[2]*n),Fe(e[3]*o)]}if("number"==typeof l)i.borderRadius=Fe(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]=Fe(e*a)})),"number"==typeof c&&(i.shadowOffsetX=Fe(c*a)),"number"==typeof d&&(i.shadowOffsetX=Fe(d*a)),"number"==typeof f&&(i.shadowOffsetX=Fe(f*a))}function Ge(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=Fe(n*i),e.y=Fe(a*o),e.w=Fe(r*i),e.h=Fe(s*o),Ye(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=Fe(n*r)),a&&a>0&&(e.detail.lineHeight=Fe(a*r))}(e,t):"image"===i||"svg"===i||"html"===i||"path"===i||"group"===i&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ge(e,t)})))}function Ne(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},d=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{d.addColorStop(e.offset,P(e.color,a))})),d}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},d=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{d.addColorStop(e.offset,P(e.color,a))})),d}return"#000000"}const Ve={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 He(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 Ze(e,t,i){const{pattern:o,renderContent:n,originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=He(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,v=h/d,w=i-f*g,m=n-u*v;e.save(),e.translate(w,m),e.scale(s*g,s*v);const y=je(l.commands||[]),p=new Path2D(y);e.clip(p),e.translate(0-w,0-m),e.setTransform(1,0,0,1,0,0),fe(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=c,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}=Be(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(k.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=Ne(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=Ne(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(!z(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let a=Ve.borderColor;!0===z(t.detail.borderColor)&&(a=t.detail.borderColor);const{borderWidth:r,borderRadius:s,borderDash:l,boxSizing:h=Ve.boxSizing}=t.detail;let c=0;"number"==typeof r&&(c=r||1);c*=n;let d=[0,0,0,0];if("number"==typeof s){const e=s*n;d=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(d=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);e.strokeStyle=a;let f=[];Array.isArray(l)&&l.length>0&&(f=l.map((e=>Math.ceil(e*n))));let u=0,g=0,v=0,w=0;Array.isArray(r)&&(u=(r[0]||0)*n,g=(r[1]||0)*n,v=(r[2]||0)*n,w=(r[3]||0)*n);if(w||g||u||v){e.lineCap="butt";let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i+=w/2,o+=u/2,n=n-w/2-g/2,a=a-u/2-v/2):"content-box"===h?(i-=w/2,o-=u/2,n=n+w/2+g/2,a=a+u/2+v/2):(i=t.x,o=t.y,n=t.w,a=t.h),u&&(e.beginPath(),e.lineWidth=u,e.moveTo(i-w/2,o),e.lineTo(i+n+g/2,o),e.closePath(),e.stroke()),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i+n,o-u/2),e.lineTo(i+n,o+a+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-w/2,o+a),e.lineTo(i+n+g/2,o+a),e.closePath(),e.stroke()),w&&(e.beginPath(),e.lineWidth=w,e.moveTo(i,o-u/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+c/2,o=t.y+c/2,n=t.w-c,a=t.h-c):"content-box"===h?(i=t.x-c/2,o=t.y-c/2,n=t.w+c,a=t.h+c):(i=t.x,o=t.y,n=t.w,a=t.h),f.length>0?e.lineCap="butt":e.lineCap="square",n=Math.max(n,1),a=Math.max(a,1),d=d.map((e=>Math.min(e,n/2,a/2))),e.setLineDash(f),e.lineWidth=c,e.beginPath(),e.moveTo(i+d[0],o),e.arcTo(i+n,o,i+n,o+a,d[1]),e.arcTo(i+n,o+a,i,o+a,d[2]),e.arcTo(i,o+a,i,o,d[3]),e.arcTo(i,o,i+n,o,d[0]),e.closePath(),e.stroke()}e.setLineDash([])}(e,t,{viewScaleInfo:s,viewSizeInfo:l}),e.globalAlpha=h}})}function Xe(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:a}=i,{shadowColor:r,shadowOffsetX:s,shadowOffsetY:l,shadowBlur:h}=o;V.number(h)?(e.save(),e.shadowColor=r||Ve.shadowColor,e.shadowOffsetX=(s||0)*n.scale,e.shadowOffsetY=(l||0)*n.scale,e.shadowBlur=(h||0)*n.scale,a(),e.restore()):(e.save(),e.shadowColor="transparent",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,a(),e.restore())}const Qe={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 Je(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});fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(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,{calculator:a,viewScaleInfo:r,viewSizeInfo:s,parentOpacity:l}=i,{background:h="#000000",borderColor:c="#000000",boxSizing:d,borderWidth:f=0}=o;let u=0;"number"==typeof f&&f>0?u=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(u=f[0]),u*=r.scale;const{x:g,y:v,w:w,h:m}=(null==a?void 0:a.elementSize({x:t.x,y:t.y,w:t.w,h:t.h},r,s))||t,y=Object.assign(Object.assign({},t),{x:g,y:v,w:w,h:m,angle:n});fe(e,{x:g,y:v,w:w,h:m,angle:n},(()=>{Xe(e,y,{viewScaleInfo:r,viewSizeInfo:s,renderContent:()=>{let t=w/2,i=m/2;const o=g+t,n=v+i;if(u>0&&("border-box"===d?(t-=u,i-=u):"center-line"===d?(t-=u/2,i-=u/2):(t-=u,i-=u)),t>=0&&i>=0){const a=He(y)*l;if(e.globalAlpha=a,"number"==typeof u&&u>0){const a=u/2+t,r=u/2+i;e.beginPath(),e.strokeStyle=c,e.lineWidth=u,e.circle(o,n,a,r,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath();const s=Ne(e,h,{viewElementSize:{x:g,y:v,w:w,h:m},viewScaleInfo:r,opacity:e.globalAlpha});e.fillStyle=s,e.circle(o,n,t,i,0,0,2*Math.PI),e.closePath(),e.fill(),e.globalAlpha=l}}})}))}(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: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});fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{Ze(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const i=Object.assign(Object.assign({},Qe),t.detail),o=(i.fontSize||Qe.fontSize)*n.scale,a=i.lineHeight?i.lineHeight*n.scale:o;e.fillStyle=t.detail.color||Qe.color,e.textBaseline="top",e.$setFont({fontWeight:i.fontWeight,fontSize:o,fontFamily:i.fontFamily});const r=i.text.replace(/\r\n/gi,"\n"),d=a,f=r.split("\n"),u=[];let g=0;f.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]||"":(u.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),o=t[n]||"",g++),!((g+1)*d>c));n++)if(t.length-1===n&&(g+1)*d<c){u.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),i<f.length-1&&g++;break}}else u.push({text:"",width:0})}));let v=0;u.length*d<c&&("top"===t.detail.verticalAlign?v=0:"bottom"===t.detail.verticalAlign?v+=c-u.length*d:v+=(c-u.length*d)/2);{const t=l+v;void 0!==i.textShadowColor&&z(i.textShadowColor)&&(e.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&V.number(i.textShadowOffsetX)&&(e.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&V.number(i.textShadowOffsetY)&&(e.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&V.number(i.textShadowBlur)&&(e.shadowBlur=i.textShadowBlur),u.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+d*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});fe(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{Xe(e,u,{viewScaleInfo:a,viewSizeInfo:r,renderContent:()=>{Ze(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.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=He(t)*s;const{x:i,y:n,w:l,h:h,radiusList:c}=Be(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;fe(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=He(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;fe(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=He(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:v,angle:w}=(null==l?void 0:l.elementSize(t,h,c))||t,m=g/r,y=v/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:v,angle:w});fe(e,{x:f,y:u,w:g,h:v,angle:w},(()=>{Ze(e,b,{originElem:t,calcElemSize:{x:f,y:u,w:g,h:v,angle:w},viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d,renderContent:()=>{Xe(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=je(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});fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{e.globalAlpha=He(t)*r,Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(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}=Be(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{Je(e,s,Object.assign(Object.assign({},i),{parentOpacity:r*He(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 Ue={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 $e,Ke,qe,_e,et,tt,it,ot,nt,at,rt,st,lt=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())}))},ht=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)},ct=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 dt=["image","svg","html"],ft=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:E(n):E(`${R()}-${e.uuid}-${R()}-${R()}`)};class ut extends _{constructor(){super(),$e.add(this),Ke.set(this,{}),qe.set(this,{}),_e.set(this,{}),et.set(this,!1),ht(this,$e,"m",tt).call(this,"image",((e,t)=>lt(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 D(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),ht(this,$e,"m",tt).call(this,"html",((e,t)=>lt(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}})))),ht(this,$e,"m",tt).call(this,"svg",((e,t)=>lt(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 L(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}isDestroyed(){return ht(this,et,"f")}destroy(){ct(this,et,!0,"f"),this.clear(),ct(this,Ke,null,"f"),ct(this,qe,null,"f"),ct(this,_e,null,"f")}load(e,t){!0!==ht(this,et,"f")&&(ht(this,$e,"m",st).call(this,e)||dt.includes(e.type)&&ht(this,$e,"m",rt).call(this,e,t))}getContent(e){var t,i;const o=ft(e);return(null===(i=null===(t=ht(this,_e,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return ht(this,_e,"f")}setLoadItemMap(e){ct(this,_e,e,"f")}}Ke=new WeakMap,qe=new WeakMap,_e=new WeakMap,et=new WeakMap,$e=new WeakSet,tt=function(e,t){ht(this,Ke,"f")[e]=t},it=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},ot=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:ht(this,$e,"m",it).call(this,e)}},nt=function(e){const t=ft(e.element),i=ht(this,_e,"f")[t];ht(this,et,"f")||(i?i.startTime<e.startTime&&(ht(this,_e,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(ht(this,_e,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},at=function(e){var t;const i=ft(e.element),o=null===(t=ht(this,_e,"f"))||void 0===t?void 0:t[i];ht(this,et,"f")||(o?o.startTime<e.startTime&&(ht(this,_e,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(ht(this,_e,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},rt=function(e,t){const i=ht(this,$e,"m",ot).call(this,e),o=ft(e);if(ht(this,qe,"f")[o])return;ht(this,qe,"f")[o]=i;const n=ht(this,Ke,"f")[e.type];"function"!=typeof n||ht(this,et,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{ht(this,et,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",ht(this,$e,"m",nt).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,ht(this,$e,"m",at).call(this,i)})))},st=function(e){var t;const i=ft(e),o=null===(t=ht(this,qe,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==ht(this,$e,"m",it).call(this,e))};var gt,vt,wt,mt,yt,pt=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},xt=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 St extends _{constructor(e){super(),gt.add(this),vt.set(this,void 0),wt.set(this,new ut),mt.set(this,!1),pt(this,vt,e,"f"),xt(this,gt,"m",yt).call(this)}isDestroyed(){return xt(this,mt,"f")}destroy(){this.clear(),pt(this,vt,null,"f"),xt(this,wt,"f").destroy(),pt(this,wt,null,"f"),pt(this,mt,!0,"f")}updateOptions(e){pt(this,vt,e,"f")}drawData(e,t){const i=xt(this,wt,"f"),{calculator:o}=xt(this,vt,"f"),n=xt(this,vt,"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});Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(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({},Ue),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{Je(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}=xt(this,vt,"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){xt(this,wt,"f").setLoadItemMap(e)}getLoadItemMap(){return xt(this,wt,"f").getLoadItemMap()}getLoader(){return xt(this,wt,"f")}}vt=new WeakMap,wt=new WeakMap,mt=new WeakMap,gt=new WeakSet,yt=function(){const e=xt(this,wt,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(e=>{console.error(e)}))};var bt,At=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},It=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 Mt{constructor(e){bt.set(this,void 0),At(this,bt,e,"f")}destroy(){At(this,bt,null,"f")}elementSize(e,t,i){return Te(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}=Te(e,{viewScaleInfo:o,viewSizeInfo:i}),d=pe({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:It(this,bt,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=It(this,bt,"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}))}}bt=new WeakMap;var zt,Pt,Rt,Tt,Et,Wt,Ct,kt,Ot,jt,Dt,Lt,Bt,Ft,Yt,Gt,Nt=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},Vt=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 Ht(e){return e>0||e<0||0===e}class Zt extends _{constructor(e){super(),zt.add(this),Pt.set(this,void 0),Rt.set(this,void 0),Tt.set(this,!1),Wt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;const t=Vt(this,zt,"m",Yt).call(this,e);if(!Vt(this,zt,"m",Gt).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})})),Ct.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);Vt(this,zt,"m",Gt).call(this,t)})),kt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);if(!Vt(this,zt,"m",Gt).call(this,t))return;const i=Date.now(),o=Vt(this,Rt,"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}):Vt(this,Rt,"f").set("prevClickPoint",t)})),Ot.set(this,(e=>{if(Vt(this,Rt,"f").set("hasPointDown",!1),!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);this.trigger("pointLeave",{point:t})})),jt.set(this,(e=>{if(Vt(this,Rt,"f").set("hasPointDown",!1),!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);this.trigger("pointEnd",{point:t})})),Dt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=Vt(this,zt,"m",Yt).call(this,e);Vt(this,zt,"m",Gt).call(this,t)?!0===Vt(this,Rt,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):Vt(this,Rt,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),Vt(this,Rt,"f").set("hasPointDown",!1))})),Lt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);Vt(this,zt,"m",Gt).call(this,t)&&(Vt(this,Rt,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),Bt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);Vt(this,zt,"m",Gt).call(this,t)&&this.trigger("hover",{point:t})}));const t=new se({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});Nt(this,Rt,t,"f"),Nt(this,Pt,e,"f"),Vt(this,zt,"m",Et).call(this)}onEvents(){if(Vt(this,Tt,"f"))return;const e=window;e.addEventListener("mousemove",Vt(this,Bt,"f")),e.addEventListener("mousedown",Vt(this,Lt,"f")),e.addEventListener("mousemove",Vt(this,Dt,"f")),e.addEventListener("mouseup",Vt(this,jt,"f")),e.addEventListener("mouseleave",Vt(this,Ot,"f")),e.addEventListener("wheel",Vt(this,Wt,"f"),{passive:!1}),e.addEventListener("click",Vt(this,kt,"f")),e.addEventListener("contextmenu",Vt(this,Ct,"f"))}offEvents(){const e=window;e.removeEventListener("mousemove",Vt(this,Bt,"f")),e.removeEventListener("mousedown",Vt(this,Lt,"f")),e.removeEventListener("mousemove",Vt(this,Dt,"f")),e.removeEventListener("mouseup",Vt(this,jt,"f")),e.removeEventListener("mouseleave",Vt(this,Ot,"f")),e.removeEventListener("wheel",Vt(this,Wt,"f")),e.removeEventListener("click",Vt(this,kt,"f")),e.removeEventListener("contextmenu",Vt(this,Ct,"f"))}destroy(){this.offEvents(),Vt(this,Rt,"f").destroy(),Nt(this,Tt,!0,"f")}}Pt=new WeakMap,Rt=new WeakMap,Tt=new WeakMap,Wt=new WeakMap,Ct=new WeakMap,kt=new WeakMap,Ot=new WeakMap,jt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,Bt=new WeakMap,zt=new WeakSet,Et=function(){this.onEvents()},Ft=function(e){return e.target===Vt(this,Pt,"f").boardContent.boardContext.canvas},Yt=function(e){const t=Vt(this,Pt,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},Gt=function(e){const t=Vt(this,Pt,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!(Ht(e.x)&&Ht(e.y)&&e.x<=i&&e.y<=o)};var Xt,Qt,Jt=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},Ut=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 $t={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class Kt{constructor(){Xt.set(this,void 0),Qt.set(this,void 0);const e=new se({defaultStorage:$t}),t=new se({defaultStorage:{}});Jt(this,Xt,e,"f"),Jt(this,Qt,t,"f")}getActiveStorage(e){return Ut(this,Xt,"f").get(e)}setActiveStorage(e,t){return Ut(this,Xt,"f").set(e,t)}getActiveStoreSnapshot(){return Ut(this,Xt,"f").getSnapshot()}getSharedStorage(e){return Ut(this,Qt,"f").get(e)}setSharedStorage(e,t){return Ut(this,Qt,"f").set(e,t)}getSharedStoreSnapshot(){return Ut(this,Qt,"f").getSnapshot()}getActiveViewScaleInfo(){return{scale:Ut(this,Xt,"f").get("scale"),offsetTop:Ut(this,Xt,"f").get("offsetTop"),offsetBottom:Ut(this,Xt,"f").get("offsetBottom"),offsetLeft:Ut(this,Xt,"f").get("offsetLeft"),offsetRight:Ut(this,Xt,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;Ut(this,Xt,"f").set("scale",t),Ut(this,Xt,"f").set("offsetTop",i),Ut(this,Xt,"f").set("offsetBottom",o),Ut(this,Xt,"f").set("offsetLeft",n),Ut(this,Xt,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){Ut(this,Xt,"f").set("width",e.width),Ut(this,Xt,"f").set("height",e.height),Ut(this,Xt,"f").set("devicePixelRatio",e.devicePixelRatio),Ut(this,Xt,"f").set("contextWidth",e.contextWidth),Ut(this,Xt,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:Ut(this,Xt,"f").get("width"),height:Ut(this,Xt,"f").get("height"),devicePixelRatio:Ut(this,Xt,"f").get("devicePixelRatio"),contextWidth:Ut(this,Xt,"f").get("contextWidth"),contextHeight:Ut(this,Xt,"f").get("contextHeight")}}}Xt=new WeakMap,Qt=new WeakMap;var qt,_t,ei,ti,ii,oi,ni=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},ai=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:ri}=window;class si extends _{constructor(e){super(),qt.add(this),_t.set(this,void 0),ei.set(this,[]),ti.set(this,"FREE"),ni(this,_t,e,"f"),ai(this,qt,"m",ii).call(this)}drawFrame(){const{sharer:e}=ai(this,_t,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();ai(this,ei,"f").push({activeStore:t,sharedStore:i}),ai(this,qt,"m",oi).call(this)}scale(e){const{scale:t,point:i}=e,{sharer:o}=ai(this,_t,"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}=ai(this,_t,"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}=ai(this,_t,"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}=ai(this,_t,"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}=ai(this,_t,"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}}_t=new WeakMap,ei=new WeakMap,ti=new WeakMap,qt=new WeakSet,ii=function(){const{renderer:e}=ai(this,_t,"f");e.on("load",(()=>{this.drawFrame()}))},oi=function e(){if("DRAWING"===ai(this,ti,"f")||0===ai(this,ei,"f").length)return;ni(this,ti,"DRAWING","f");const t=ai(this,ei,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=ai(this,_t,"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,v={scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h},w={width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g};(null==t?void 0:t.activeStore.data)&&i.drawData(t.activeStore.data,{viewScaleInfo:v,viewSizeInfo:w}),n({snapshot:t}),o.drawView(),a({snapshot:t})}0!==ai(this,ei,"f").length?ni(this,ti,"DRAWING","f")&&ri((()=>{ai(this,qt,"m",e).call(this)})):ni(this,ti,"COMPLETE","f")};var li,hi,ci,di,fi,ui,gi,vi,wi,mi,yi,pi,xi,Si,bi,Ai,Ii,Mi,zi,Pi,Ri,Ti,Ei,Wi,Ci,ki,Oi,ji=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},Di=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 Li{constructor(e){li.add(this),hi.set(this,void 0),ci.set(this,new WeakMap),di.set(this,[]),fi.set(this,[]),ui.set(this,void 0),gi.set(this,void 0),vi.set(this,void 0),wi.set(this,void 0),mi.set(this,void 0),yi.set(this,new _),pi.set(this,!1);const{boardContent:t}=e,i=new Kt,o=new Mt({viewContext:t.viewContext}),n=new Zt({boardContent:t,sharer:i}),a=new St({viewContext:t.viewContext,sharer:i,calculator:o});ji(this,hi,e,"f"),ji(this,vi,i,"f"),ji(this,ui,n,"f"),ji(this,gi,a,"f"),ji(this,mi,o,"f"),ji(this,wi,new si({boardContent:e.boardContent,sharer:i,renderer:a,calculator:Di(this,mi,"f"),beforeDrawFrame:e=>{Di(this,li,"m",Ci).call(this,e)},afterDrawFrame:e=>{Di(this,li,"m",ki).call(this,e)}}),"f"),Di(this,li,"m",xi).call(this),Di(this,li,"m",Oi).call(this)}isDestroyed(){return Di(this,pi,"f")}destroy(){Di(this,ui,"f").destroy(),Di(this,gi,"f").destroy(),Di(this,mi,"f").destroy(),Di(this,yi,"f").destroy(),ji(this,pi,!0,"f")}getSharer(){return Di(this,vi,"f")}getViewer(){return Di(this,wi,"f")}getRenderer(){return Di(this,gi,"f")}setData(e){const t=Di(this,vi,"f");Di(this,vi,"f").setActiveStorage("data",e);const i=t.getActiveViewSizeInfo(),o=Ae(e.elements,{viewWidth:i.width,viewHeight:i.height,extend:!0});Di(this,wi,"f").drawFrame();const n=Object.assign(Object.assign({},i),o);return Di(this,vi,"f").setActiveViewSizeInfo(n),{viewSizeInfo:n}}getData(){const{data:e}=Di(this,vi,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(Di(this,ci,"f").has(e)){const o=Di(this,ci,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",Di(this,ci,"f").set(e,o),void Di(this,li,"m",Oi).call(this)}const{boardContent:n,container:a}=Di(this,hi,"f"),r=e({boardContent:n,sharer:Di(this,vi,"f"),viewer:Di(this,wi,"f"),calculator:Di(this,mi,"f"),eventHub:Di(this,yi,"f"),container:a});null===(o=r.use)||void 0===o||o.call(r),Di(this,di,"f").push(e),Di(this,fi,"f").push(r),Di(this,ci,"f").set(e,{status:"enable",middlewareObject:r}),Di(this,li,"m",Oi).call(this)}disuse(e){var t,i;const o=Di(this,ci,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",Di(this,ci,"f").set(e,o),Di(this,li,"m",Oi).call(this))}scale(e){const t=Di(this,wi,"f"),{moveX:i,moveY:o}=t.scale(e);t.scroll({moveX:i,moveY:o})}scroll(e){return Di(this,wi,"f").scroll(e)}updateViewScaleInfo(e){return Di(this,wi,"f").updateViewScaleInfo(e)}resize(e){const t=Di(this,wi,"f").resize(e),{width:i,height:o,devicePixelRatio:n}=e,{boardContent:a}=Di(this,hi,"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}),Di(this,wi,"f").drawFrame(),Di(this,ui,"f").trigger("resize",t),Di(this,vi,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=Di(this,hi,"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),Di(this,li,"m",Wi).call(this)}getEventHub(){return Di(this,yi,"f")}onWatcherEvents(){Di(this,ui,"f").onEvents()}offWatcherEvents(){Di(this,ui,"f").offEvents()}}hi=new WeakMap,ci=new WeakMap,di=new WeakMap,fi=new WeakMap,ui=new WeakMap,gi=new WeakMap,vi=new WeakMap,wi=new WeakMap,mi=new WeakMap,yi=new WeakMap,pi=new WeakMap,li=new WeakSet,xi=function(){Di(this,ui,"f").on("pointStart",Di(this,li,"m",Si).bind(this)),Di(this,ui,"f").on("pointEnd",Di(this,li,"m",bi).bind(this)),Di(this,ui,"f").on("pointMove",Di(this,li,"m",Ai).bind(this)),Di(this,ui,"f").on("hover",Di(this,li,"m",Ii).bind(this)),Di(this,ui,"f").on("wheel",Di(this,li,"m",zi).bind(this)),Di(this,ui,"f").on("wheelScale",Di(this,li,"m",Pi).bind(this)),Di(this,ui,"f").on("scrollX",Di(this,li,"m",Ri).bind(this)),Di(this,ui,"f").on("scrollY",Di(this,li,"m",Ti).bind(this)),Di(this,ui,"f").on("resize",Di(this,li,"m",Ei).bind(this)),Di(this,ui,"f").on("doubleClick",Di(this,li,"m",Mi).bind(this)),Di(this,gi,"f").on("load",(()=>{Di(this,yi,"f").trigger("loadResource")}))},Si=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},bi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},Ai=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"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<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},Mi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},zi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},Pi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"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<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},Ti=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},Ei=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},Wi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"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<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},ki=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Oi=function(){const e=[],t=Di(this,ci,"f");Di(this,di,"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)})),ji(this,fi,e,"f")};const Bi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmc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constructor(e,d){A(this,r),A(this,l),A(this,c),A(this,f),A(this,g),A(this,t,void 0),A(this,i,void 0),A(this,o,null),A(this,n,null),A(this,a,{auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDktMTdUMTY6MDc6MjYrMDg6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIzLTA5LTE3VDE2OjEyOjUwKzA4OjAwIiB4b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BYGRkhJaWFs6dO0ckEgGYj9v0xIA71rkha7jUgBYCb5hHGRoaIj8/f4Z5s8jafUpmN/diLBwAkmZKWiipSdKvJN2VpI6ODhUVFWUt7Js2bdLAwMBYLdAt6VNJlyV9IumLsRkOHjyo2tparVixQrdvp2Xmn00YrJI0R05VBRV+GjAiqcoUxA8lnfI1HD16dJz6WLVqla5fvz4tFdPZ2anm5uas8s3Nzf7zp5J+LmmNpFcl5U8GmCupWFKtpO9K+qWkG76W3bt3j4OMRqNqaWnRhQsXNDQ0lAWVTCZ169YtHThwQFVVVePKtrS0+Kw3pgsYso+Vkuol7ZD0W0ldvsHW1tZJZXxtba0aGxvV1NSkdevWaenSpYpGoxPmXb9+vXp6ejzgx5J+ZiGeLSk8GaD34ky5Hd23JP1I0h8kPQmGu7y8/L/aNEUiEe3fv1/Dw8Pp6Es6KqlZ0puSXpHbVU4KiPVglqQFkr4j6aeSfi/pvq/13r172rVrlyorK6cFFo1GtXnzZl25ciU4Ch5J+qOkH0v6tqTXzDk5EwGGlNFjOWQOd8px4vUN4E3cpn2pz/jgwQPef/99Ll68yJ07d+jt7WVwcJBIJEJJSQlz586loaGBTZs2UVdXF5w0OoDLwFWcbPsct6r04+bRLHEYCoWyAD1kBDfHleHmsxrccccS3NFHNV/eenBy6iZwCycMOnHz5wBuDh2nyyY6H0zhFmoF7vtxk+l9q3ieQfrDo8msF7cy3cN56g7ZWnKcep7IxnrQmz+wHKu2K3EKJWbPpWSUTQ4ZtRJc23sC6ZGB9ZM52JwcboIQjzUvZvNxYfeHlyVkZFcBbux6wKA6ShjoM5yM8uH0Xpuy8ekAQuZc2W8P8nEei9p9mMmPgAfJHO0O27e0lHppw9MEDJo//A4eoE91iB48SJ80lFMB/t/+V/sPGZfTmtMFR4EAAAAASUVORK5CYII="}),I(this,i,e),I(this,t,d.eventHub),M(this,r,s).call(this),M(this,l,h).call(this)}}t=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakSet,s=function(){const e=b(this,t);M(this,c,d).call(this,"default"),e.on("cursor",(e=>{var t;"over-element"!==e.type&&e.type?"resize-rotate"===e.type?M(this,c,d).call(this,"rotate"):"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?M(this,f,u).call(this,e):"drag-default"===e.type?M(this,c,d).call(this,"drag-default"):"drag-active"===e.type?M(this,c,d).call(this,"drag-active"):M(this,c,d).call(this,"auto"):M(this,c,d).call(this,"auto")}))},l=new WeakSet,h=function(){D(Bi).then((e=>{I(this,n,e)})).catch((e=>{console.error(e)}))},c=new WeakSet,d=function(e){if(b(this,o)===e)return;I(this,o,e);const t=b(this,a)[b(this,o)]||b(this,a).auto;let n=0,r=0;(e.startsWith("rotate-")&&b(this,a)[b(this,o)]||"rotate"===e)&&(n=10,r=10),b(this,i).style.cursor="default"===e?"default":`image-set(url(${t})2x) ${n} ${r}, auto`},f=new WeakSet,u=function(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+=Se((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+=Se(e.angle||0)})),i=Se(i);const o=M(this,g,v).call(this,i);M(this,c,d).call(this,o)},g=new WeakSet,v=function(e){const t=`rotate-${e}`;if(!b(this,a)[t]){const i=b(this,n);if(i){const o=document.createElement("canvas"),n=i.width,r=i.height,s={x:n/2,y:r/2};o.width=n,o.height=r;const l=o.getContext("2d"),h=ce(e);l.translate(s.x,s.y),l.rotate(h),l.translate(-s.x,-s.y),l.drawImage(i,0,0,n,r),l.translate(s.x,s.y),l.rotate(-h),l.translate(-s.x,-s.y);const c=o.toDataURL("image/png");b(this,a)[t]=c}}return t};const Yi="SELECT",Gi=Symbol(`${Yi}_actionType`),Ni=Symbol(`${Yi}_resizeType`),Vi=Symbol(`${Yi}_areaStart`),Hi=Symbol(`${Yi}_areaEnd`),Zi=Symbol(`${Yi}_hoverElement`),Xi=Symbol(`${Yi}_hoverElementVertexes`),Qi=Symbol(`${Yi}_selectedElementList`),Ji=Symbol(`${Yi}_selectedElementListVertexes`),Ui=Symbol(`${Yi}_selectedElementController`),$i=Symbol(`${Yi}_groupQueue`),Ki=Symbol(`${Yi}_groupQueueVertexesList`),qi=Symbol(`${Yi}_isMoving`),_i="#1973ba",eo="#5b5959b5";function to(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 io(e,t,i){const{borderColor:o,borderWidth:n,lineDash:a}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.setLineDash(a),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[2].x,t[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function oo(e,t,i){if(!t)return;const o={borderColor:_i,borderWidth:1,background:"transparent",lineDash:[]};to(e,We(t,i),o)}function no(e,t,i){if(!t)return;const o={borderColor:eo,borderWidth:1,background:"transparent",lineDash:[]};to(e,We(t,i),o);const{controller:n}=i;if(n){const{topLeft:t,topRight:a,bottomLeft:r,bottomRight:s,topMiddle:l,bottomMiddle:h,leftMiddle:c,rightMiddle:d}=n,f={...o,borderWidth:1,background:eo};io(e,We(l.vertexes,i),f),io(e,We(h.vertexes,i),f),io(e,We(c.vertexes,i),f),io(e,We(d.vertexes,i),f),io(e,We(t.vertexes,i),f),io(e,We(a.vertexes,i),f),io(e,We(r.vertexes,i),f),io(e,We(s.vertexes,i),f)}}function ao(e,t,i){if(!t)return;const{hideControllers:o}=i,{elementWrapper:n,topLeft:a,topRight:r,bottomLeft:s,bottomRight:l,top:h,rotate:c}=t,d={borderColor:_i,borderWidth:2,background:"transparent",lineDash:[]},f={...d,borderWidth:4,background:"#FFFFFF"};to(e,We(n,i),d),o||(function(e,t,i,o){const{borderColor:n,borderWidth:a,lineDash:r}=o;e.setLineDash([]),e.lineWidth=a,e.strokeStyle=n,e.setLineDash(r),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.closePath(),e.stroke()}(e,Ee(h.center,i),Ee(c.center,i),{...f,borderWidth:2}),to(e,We(a.vertexes,i),f),to(e,We(r.vertexes,i),f),to(e,We(s.vertexes,i),f),to(e,We(l.vertexes,i),f),function(e,t,i){const{size:o,borderColor:n,borderWidth:a,background:r}=i,s=t,l=o/2,h=l,c=l;if(h>=0&&c>=0){if("number"==typeof a&&a>0){const t=a/2+h,i=a/2+c;e.beginPath(),e.strokeStyle=n,e.lineWidth=a,e.circle(s.x,s.y,t,i,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath(),e.fillStyle=r,e.circle(s.x,s.y,h,c,0,0,2*Math.PI),e.closePath(),e.fill()}}(e,Ee(c.center,i),{...f,size:10,borderWidth:2}))}function ro(e){return e*Math.PI/180}function so(e,t){return Math.sqrt(e*e+t*t)}function lo(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function ho(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,vertexes:a}=t,r=Ee(a[0],{viewScaleInfo:o,viewSizeInfo:n}),s=Ee(a[1],{viewScaleInfo:o,viewSizeInfo:n}),l=Ee(a[2],{viewScaleInfo:o,viewSizeInfo:n}),h=Ee(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 co(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=Pe(a),s=r[r.length-1];return!!s&&ho(e,{ctx:i,vertexes:s,viewScaleInfo:o,viewSizeInfo:n})}function fo(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:v,rotate:w}=g,m=[t,i,o,n,s,l,f,v,w];for(let t=0;t<m.length;t++){const i=m[t];if(ho(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=Re(o,{groupQueue:u});if(n&&ho(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 uo(e,t){const{x:i,y:o,w:n,h:a,angle:r=0}=e,{center:s,start:l,end:h,viewScaleInfo:c,viewSizeInfo:d}=t,f=Ee(s,{viewScaleInfo:c,viewSizeInfo:d}),u=Se(r),g=function(e,t,i){const o=ve(e,t),n=ve(e,i);return null!==n&&null!==o?o>3*Math.PI/2&&n<Math.PI/2?n+(2*Math.PI-o):n>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-n):n-o:0}(f,l,h);return{x:i,y:o,w:n,h:a,angle:u+g/Math.PI*180}}function go(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=pe(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 vo="@middleware/text-edit",wo="@middleware/text-change",mo={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"},yo="@middleware/select",po="@middleware/select-clear",xo="SCROLL",So=Symbol(`${xo}_xThumbRect`),bo=Symbol(`${xo}_yThumbRect`),Ao=Symbol(`${xo}_prevPoint`),Io=Symbol(`${xo}_activePoint`),Mo=Symbol(`${xo}_activeThumbType`),zo=16,Po=.36,Ro={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function To(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 Eo(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=Po,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 Wo(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*zo,h=zo;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 v=g;n>0?v=g:a>0?v=o-d-h:n<=0&&d>0&&(0!==n||0!==a)&&(v=g+(o-d)*Math.abs(n)/(Math.abs(n)+Math.abs(a)),v=Math.min(Math.max(0,v-g),o-d));const w={x:u,y:o-h,w:c,h:h},m={x:i-h,y:v,w:h,h:d};return{lineSize:h,xSize:c,ySize:d,translateY:v,translateX:u,thumbColor:Ro.thumbColor,scrollBarColor:Ro.scrollBarColor,xThumbRect:w,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))),Eo(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),Eo(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function Co(e,t){const{snapshot:i}=t,o=he(i),n=le(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[Io]||null,prevPoint:t[Ao]||null,activeThumbType:t[Mo]||null,xThumbRect:t[So]||null,yThumbRect:t[bo]||null}}(i),{xThumbRect:r,yThumbRect:s}=Wo(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:r,yThumbRect:s}}const ko="@middleware/scale",Oo=16,jo="#000000",Do="#00000080",Lo="monospace",Bo="#AAAAAA20",Fo="#AAAAAA40";function Yo(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=De(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=De(f+l*a,{decimalPlaces:0}),t={num:e,position:De(u+l*h,{decimalPlaces:0}),showNum:e%r==0,isKeyNum:e%r==0,isSubKeyNum:e%s==0};n.push(t),l++}return n}const Go="@middleware/show-ruler",No=Symbol("DRAG_prevPoint");return w=new WeakMap,m=new WeakMap,y=new WeakMap,p=new WeakSet,x=function(){b(this,y).style.position="relative"},e.Core=class{constructor(e,t){A(this,p),A(this,w,void 0),A(this,m,void 0),A(this,y,void 0);const{devicePixelRatio:i=1,width:o,height:n,createCustomContext2D:a}=t;I(this,y,e);const r=document.createElement("canvas");I(this,m,r),M(this,p,x).call(this),e.appendChild(r);const s=function(e,t){const{width:i,height:o,devicePixelRatio:n,offscreen:a,createCustomContext2D:r}=t,s={width:i,height:o,devicePixelRatio:n},l=e.getContext("2d");if(r){const e=r(s),t=r(s),i=r(s),o=U(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}if(!0===a){const e=$(s),t=$(s),i=$(s),o=U(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}{const e=U(s),t=U(s),n=U(s),a=U(Object.assign({ctx:l},s)),r=()=>{a.clearRect(0,0,i,o),a.drawImage(n.canvas,0,0,i,o),a.drawImage(e.canvas,0,0,i,o),a.drawImage(t.canvas,0,0,i,o),n.clearRect(0,0,i,o),e.clearRect(0,0,i,o),t.clearRect(0,0,i,o)};return{underContext:n,viewContext:e,helperContext:t,boardContext:a,drawView:r}}}(r,{width:o,height:n,devicePixelRatio:i,offscreen:!0,createCustomContext2D:a}),l=new Li({boardContent:s,container:e}),h=l.getSharer();h.setActiveViewSizeInfo({width:o,height:n,devicePixelRatio:i,contextWidth:o,contextHeight:n}),I(this,w,l),this.resize(h.getActiveViewSizeInfo());const c=l.getEventHub();new Fi(e,{eventHub:c})}isDestroyed(){return b(this,w).isDestroyed()}destroy(){b(this,w).destroy(),b(this,m).remove()}use(e){b(this,w).use(e)}disuse(e){b(this,w).disuse(e)}setData(e){be((null==e?void 0:e.elements)||[]),b(this,w).setData(e)}getData(){return b(this,w).getData()}scale(e){b(this,w).scale(e);b(this,w).getViewer().drawFrame()}resize(e){const t=b(this,w),i=t.getSharer().getActiveViewSizeInfo();t.resize({...i,...e})}clear(){b(this,w).clear()}on(e,t){b(this,w).getEventHub().on(e,t)}off(e,t){b(this,w).getEventHub().off(e,t)}trigger(e,t){b(this,w).getEventHub().trigger(e,t)}getViewInfo(){const e=b(this,w).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){b(this,w).getViewer().drawFrame()}setViewScale(e){b(this,w).updateViewScaleInfo(e)}getLoadItemMap(){return b(this,w).getRenderer().getLoadItemMap()}onBoardWatcherEvents(){b(this,w).onWatcherEvents()}offBoardWatcherEvents(){b(this,w).offWatcherEvents()}},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(No,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(No);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(No,t)},pointEnd(){n=!1,i.setSharedStorage(No,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(Go,l)},disuse(){o.off(Go,l)},beforeDrawFrame:({snapshot:e})=>{if(!0===r){const t=le(e),i=he(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,Oo),e.lineTo(Oo,Oo),e.lineTo(Oo,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 Yo({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<Oo||(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=jo,e.stroke(),o.isKeyNum&&(e.fillStyle=Do,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 Yo({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<Oo)&&(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=jo,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===n.showNum)){const t=o,i=n.position+o,a=`${n.num}`;de(e,-90,{x:t,y:i},(()=>{e.fillStyle=Do,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=Fo:e.strokeStyle=Bo,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=Fo:e.strokeStyle=Bo,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=De(r);o.trigger(ko,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(So,null),o.setSharedStorage(bo,null);const a=()=>{o.setSharedStorage(Ao,null),o.setSharedStorage(Io,null),o.setSharedStorage(Mo,null)};a();const r=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&To(e,t,n)?o="X":a&&To(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(So),yThumbRect:o.getSharedStorage(bo)});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(Mo,i),o.setSharedStorage(Ao,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Mo);if("X"===n||"Y"===n)return o.setSharedStorage(Io,i),"X"===n?(e=>{const i=o.getSharedStorage(Ao);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(Ao);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(Ao,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Mo);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=Co(n,{snapshot:e});o.setSharedStorage(So,t),o.setSharedStorage(bo,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(Gi,null);const h=()=>i.getSharedStorage(Qi),c=e=>{let t=i.getSharedStorage($i);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=Pe(t);return i.setSharedStorage($i,t),i.setSharedStorage(Ki,o),t.length>0},d=e=>{i.setSharedStorage(Zi,e);let t=null;e&&(t=Re(e,{groupQueue:i.getSharedStorage($i)})),i.setSharedStorage(Xi,t)},f=(e,t)=>{if(i.setSharedStorage(Qi,e),1===e.length){const t=Oe(e[0],{groupQueue:i.getSharedStorage($i),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Ui,t)}else i.setSharedStorage(Ui,null);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(yo,{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($i),areaSize:null,selectedElementController:i.getSharedStorage(Ui)}),g=()=>{i.setSharedStorage(Gi,null),i.setSharedStorage(Ni,null),i.setSharedStorage(Vi,null),i.setSharedStorage(Hi,null),i.setSharedStorage($i,[]),i.setSharedStorage(Ki,[]),i.setSharedStorage(Zi,null),i.setSharedStorage(Xi,null),i.setSharedStorage(Qi,[]),i.setSharedStorage(Ji,null),i.setSharedStorage(Ui,null),i.setSharedStorage(qi,null)};g();const v=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage(Gi),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(Gi,"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($i,e),f(n),t.drawFrame()}},w=()=>{g(),t.drawFrame()};return{name:"@middleware/selector",use(){a.on(yo,v),a.on(po,w)},disuse(){a.off(yo,v),a.off(po,w)},hover:e=>{var o,s,c,f,g;const v=i.getSharedStorage(Ni),w=i.getSharedStorage(Gi),m=i.getSharedStorage($i),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(!co(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage($i)}))return d(null),void t.drawFrame();const n=fo(e.point,u());return y(n),v||["area","drag","drag-list"].includes(w)?(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(v||["area","drag","drag-list"].includes(w))return void d(null);if("drag"===w)return void d(null);const p=h(),x=i.getActiveViewScaleInfo(),S=i.getActiveViewSizeInfo(),b=fo(e.point,{...u(),areaSize:go(p,{viewScaleInfo:x,viewSizeInfo:S,calculator:n})});return y(b),null===b.type||"over-element"===b.type&&"select"===i.getSharedStorage(Gi)&&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(Gi)&&1===b.elements.length&&b.elements[0].uuid===(null==(f=i.getSharedStorage(Zi))?void 0:f.uuid)?void 0:"over-element"===b.type&&1===(null==(g=null==b?void 0:b.elements)?void 0:g.length)?(d(b.elements[0]),void t.drawFrame()):i.getSharedStorage(Zi)?(d(null),void t.drawFrame()):void 0},pointStart:e=>{var o,a,l,c,v,w,m,y,p,x;s=e.point;const S=i.getSharedStorage($i);if((null==S?void 0:S.length)>0){if(co(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:S})){const t=fo(e.point,u());if(1===(null==(o=null==t?void 0:t.elements)?void 0:o.length)&&!0===(null==(l=null==(a=t.elements[0])?void 0:a.operations)?void 0:l.lock))return;d(null),"over-element"===t.type&&1===(null==(c=null==t?void 0:t.elements)?void 0:c.length)?(f([t.elements[0]],{triggerEvent:!0}),i.setSharedStorage(Gi,"drag")):(null==(v=t.type)?void 0:v.startsWith("resize-"))?(i.setSharedStorage(Ni,t.type),i.setSharedStorage(Gi,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const b=go(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),A=fo(e.point,{...u(),areaSize:b,groupQueue:[]});1===(null==(w=null==A?void 0:A.elements)?void 0:w.length)&&!0===(null==(y=null==(m=A.elements[0])?void 0:m.operations)?void 0:y.lock)||(d(null),"list-area"===A.type?i.setSharedStorage(Gi,"drag-list"):"over-element"===A.type&&1===(null==(p=null==A?void 0:A.elements)?void 0:p.length)?(f([A.elements[0]],{triggerEvent:!0}),i.setSharedStorage(Gi,"drag")):(null==(x=A.type)?void 0:x.startsWith("resize-"))?(i.setSharedStorage(Ni,A.type),i.setSharedStorage(Gi,"resize")):(g(),i.setSharedStorage(Gi,"area"),i.setSharedStorage(Vi,e.point),f([],{triggerEvent:!0})),t.drawFrame())},pointMove:e=>{var o,n,a;i.setSharedStorage(qi,!0);const r=i.getActiveStorage("data"),c=h(),d=i.getActiveStorage("scale")||1,u=i.getActiveViewScaleInfo(),g=i.getActiveViewSizeInfo(),v=s,w=e.point,m=i.getSharedStorage(Ni),y=i.getSharedStorage(Gi),p=i.getSharedStorage($i);if("drag"===y){if(l="drag",r&&1===(null==c?void 0:c.length)&&v&&w&&!0!==(null==(n=null==(o=c[0])?void 0:o.operations)?void 0:n.lock)){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=me(e,a),r=me(t,a);o=r.x-i.x,n=r.y-i.y}return{moveX:o,moveY:n}}(v,w,p);c[0].x+=e/d,c[0].y+=t/d,f([c[0]])}t.drawFrame()}else if("drag-list"===y){if(l="drag-list",r&&v&&w&&(null==c?void 0:c.length)>1){const e=(w.x-v.x)/d,t=(w.y-v.y)/d;c.forEach((i=>{var o;i&&!0!==(null==(o=null==i?void 0:i.operations)?void 0:o.lock)&&(i.x+=e,i.y+=t)})),i.setActiveStorage("data",r)}t.drawFrame()}else if("resize"===y){if(r&&1===(null==c?void 0:c.length)&&v&&(null==m?void 0:m.startsWith("resize-"))){l="resize";const e=[];p.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 o=v,n=w;if(p.length>0&&(o=me(v,e),n=me(w,e)),"resize-rotate"===m){const e=i.getSharedStorage(Ui),t=ge([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),o=uo(c[0],{center:t,viewScaleInfo:u,viewSizeInfo:g,start:v,end:w,resizeType:m,sharer:i});c[0].angle=o.angle}else{const e=function(e,t){var i,o,n,a,r,s,l,h,c;let{x:d,y:f,w:u,h:g,angle:v=0}=e;const w=ue({x:d,y:f,w:u,h:g,angle:v});v=Se(v);const m=ce(v),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:w.y},z={x:I.x,y:w.y},P={...M},R={...z},T={x:w.x,y:A.y},E={x:w.x,y:I.y},W={...T},C={...E},k=(R.x-P.x)/b,O=(R.y-P.y)/b,j=so(k,O),D=(C.x-W.x)/b,L=(C.y-W.y)/b,B=so(D,L);(v>0||v<0)&&(A=we(w,p,0-m),I=we(w,x,0-m),M={x:A.x,y:w.y},z={x:I.x,y:w.y},P=we(w,M,m),R=we(w,z,m),T={x:w.x,y:A.y},E={x:w.x,y:I.y},W=we(w,T,m),C=we(w,E,m),k=(R.x-P.x)/b,O=(R.y-P.y)/b,j=so(k,O),j=lo(j,O),D=(C.x-W.x)/b,L=(C.y-W.y)/b,B=so(D,L),B=lo(B,L));let F=(x.x-p.x)/b,Y=(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(F),Math.abs(Y));F=(F>=0?1:-1)*t,Y=(Y>=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(k),Math.abs(O));k=(k>=0?1:-1)*o,O=(O>=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(F);F=(F>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?Y=F>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(Y=F>0?-i:i)}j=Math.abs(j),B=j/e.w*e.h}switch(S){case"resize-top":if(0===v)g-Y>0&&(f+=Y,g-=Y,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=Y/e.h*e.w/2,u-=Y/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){B=0-lo(B,L);const e=ro(v),o=B/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){B=lo(B,D);const e=ro(v-90),o=B/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){B=lo(B,L);const e=ro(v-180),o=B/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){B=0-lo(B,D);const e=ro(v-270),o=B/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+B>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(u+=B/e.h*e.w),g+=B,d=t-u/2,f=i-g/2)}break;case"resize-bottom":if(0===v)e.h+Y>0&&(g+=Y,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(d-=Y/e.h*e.w/2,u+=Y/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){B=lo(B,L);const e=ro(v),o=B/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){B=0-lo(B,D);const e=ro(v-90),o=B/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){B=lo(B,D);const e=ro(v-180),o=B/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){B=lo(B,D);const e=ro(v-270),o=B/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+B>0&&(!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(u+=B/e.h*e.w),g+=B,d=t-u/2,f=i-g/2)}break;case"resize-left":if(0===v)e.w-F>0&&(d+=F,u-=F,!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g-=F/e.w*e.h,f+=F/e.w*e.h/2));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){j=0-lo(j,k);const e=ro(v),o=j/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){j=lo(j,k);const e=ro(v-90),o=j/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){j=lo(j,O);const e=ro(v-180),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){j=lo(j,O);const e=ro(v-270),o=j/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}u+j>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(g+=j/e.w*e.h),u+=j,d=t-u/2,f=i-g/2)}break;case"resize-right":if(0===v)e.w+F>0&&(u+=F,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(f-=F*e.h/e.w/2,g+=F*e.h/e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){j=lo(j,O);const e=ro(v),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){j=lo(j,Y);const e=ro(v-90),o=j/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){j=lo(j,Y);const e=ro(v-180),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e),j=0-j}else if(v<360){j=lo(j,F);const e=ro(v-270),o=j/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}u+j>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=j/e.w*e.h),u+=j,d=t-u/2,f=i-g/2)}break;case"resize-top-left":if(0===v)u-F>0&&(d+=F,u-=F),g-Y>0&&(f+=Y,g-=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=0-lo(B,L),j=0-lo(j,y?0-B:k);const i=B/2;e+=i*Math.sin(m),t-=i*Math.cos(m);const o=j/2;e-=o*Math.cos(m),t-=o*Math.sin(m)}else if(v<180){B=lo(B,D),j=lo(j,y?B:k);const i=ro(v-90),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){B=lo(B,L),j=lo(j,y?B:O);const i=ro(v-180),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){B=0-lo(B,D),j=lo(j,y?B:O);const i=ro(v-270),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-top-right":if(0===v)u+F>0&&(u+=F),g-Y>0&&(f+=Y,g-=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=0-lo(B,L),j=lo(j,y?B:O);const i=ro(v),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){B=lo(B,D),j=lo(j,y?B:O);const i=ro(v-90),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){const i=ro(v-180);B=lo(B,L),j=lo(j,y?B:0-k);const o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){B=0-lo(B,D),j=lo(j,y?B:k);const i=ro(v-270),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-bottom-left":if(0===v)e.h+Y>0&&(g+=Y),e.w-F>0&&(d+=F,u-=F);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=lo(B,L),j=0-lo(j,y?0-B:k);const i=ro(v),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<180){B=0-lo(B,D),j=lo(j,y?B:k);const i=ro(v-90),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){B=lo(B,D),j=lo(j,y?B:O);const i=ro(v-180),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){B=lo(B,D),j=lo(j,y?B:O);const i=ro(v-270),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-bottom-right":if(0===v)e.h+Y>0&&(g+=Y),e.w+F>0&&(u+=F);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=lo(B,L),j=lo(j,y?B:O);const i=ro(v),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){B=0-lo(B,D),j=lo(j,y?B:Y);const i=ro(v-90),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){B=lo(B,D),j=lo(j,y?B:0-O);const i=ro(v-180),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){B=lo(B,D),j=lo(j,y?B:k);const i=ro(v-270),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}}return{x:d,y:f,w:u,h:g,angle:e.angle}}(c[0],{scale:d,start:o,end:n,resizeType:m,sharer:i});c[0].x=e.x,c[0].y=e.y,"group"===c[0].type&&!0===(null==(a=c[0].operations)?void 0:a.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=>{Ge(e,l)})),Ye(e,l)}(c[0],{w:e.w,h:e.h}):(c[0].w=e.w,c[0].h=e.h)}f([c[0]]),t.drawFrame()}}else"area"===y&&(l="area",i.setSharedStorage(Hi,e.point),t.drawFrame());s=e.point},pointEnd(e){l=null,i.setSharedStorage(qi,!1);const o=i.getActiveStorage("data"),r=i.getSharedStorage(Ni),h=i.getSharedStorage(Gi),c=i.getActiveViewSizeInfo();let d=!1;if(s=null,"resize"===h&&r)i.setSharedStorage(Ni,null),d=!0;else if("area"===h){if(i.setSharedStorage(Gi,null),o){const e=i.getSharedStorage(Vi),t=i.getSharedStorage(Hi);if(e&&t){const{elements:a}=function(e,t){var i;const o=[],n=[],a=[],{calculator:r,viewScaleInfo:s,viewSizeInfo:l,start:h,end:c}=t;if(!(Array.isArray(e.elements)&&h&&c))return{indexes:o,uuids:n,elements:a};const d=Math.min(h.x,c.x),f=Math.max(h.x,c.x),u=Math.min(h.y,c.y),g=Math.max(h.y,c.y);for(let t=0;t<e.elements.length;t++){const h=e.elements[t];if(!0===(null==(i=null==h?void 0:h.operations)?void 0:i.lock))continue;const c=r.elementSize(h,s,l),v=ue(c);if(v.x>=d&&v.x<=f&&v.y>=u&&v.y<=g&&(o.push(t),n.push(h.uuid),a.push(h),c.angle&&(c.angle>0||c.angle<0))){const e=pe(c);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];c.x=Math.min(...t),c.y=Math.min(...i),c.w=Math.abs(Math.max(...t)-Math.min(...t)),c.h=Math.abs(Math.max(...i)-Math.min(...i))}}}return{indexes:o,uuids:n,elements:a}}(o,{start:e,end:t,calculator:n,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()});a.length>0&&(i.setSharedStorage(Gi,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage(Gi,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage(Gi,"select"),d=!0):i.setSharedStorage(Gi,null)}null===i.getSharedStorage(Gi)&&(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=Ae(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="dragElement";a.trigger("change",{data:o,type:e})}t.drawFrame()}})()},pointLeave(){s=null,g(),t.drawFrame()},doubleClick(e){var o,n,r,s,l,h;const d=fo(e.point,u());if(i.setSharedStorage(Ui,null),i.setSharedStorage(Qi,[]),1!==d.elements.length||!0!==(null==(n=null==(o=d.elements[0])?void 0:o.operations)?void 0:n.lock)){if(1===d.elements.length&&"group"===(null==(r=d.elements[0])?void 0:r.type)){if(!0===c(d.elements[0]))return i.setSharedStorage(Gi,null),void t.drawFrame()}else 1===d.elements.length&&"text"===(null==(s=d.elements[0])?void 0:s.type)&&a.trigger(vo,{element:d.elements[0],groupQueue:i.getSharedStorage($i)||[],position:Ie(null==(l=d.elements[0])?void 0:l.uuid,(null==(h=i.getActiveStorage("data"))?void 0:h.elements)||[]),viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Gi,null)}},beforeDrawFrame({snapshot:t}){var i;const{activeStore:o,sharedStore:a}=t,{scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f,width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m}=o,y=e.sharer,p={scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f},x={width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m},S=a[Qi][0],b=a[Zi],A=a[Xi],I=a[Gi],M=a[Vi],z=a[Hi],P=a[$i],R=a[Ki],T=a[qi],E={calculator:n,viewScaleInfo:p,viewSizeInfo:x},W=S?Oe(S,{groupQueue:P,controllerSize:10,viewScaleInfo:p}):null,C=!!(null==(i=null==b?void 0:b.operations)?void 0:i.lock);if((null==P?void 0:P.length)>0)!function(e,t,i){for(let o=0;o<t.length;o++){const n=t[o],a={borderColor:_i,borderWidth:2,background:"transparent",lineDash:[4,4]};to(e,We(n,i),a)}}(r,R,E),b&&"drag"!==I&&(C?no(r,A,{...E,controller:Oe(b,{groupQueue:P,controllerSize:10,viewScaleInfo:p})}):oo(r,A,E)),!C&&S&&["select","drag","resize"].includes(I)&&ao(r,W,{...E,element:S,groupQueue:P,hideControllers:!!T&&"drag"===I});else if(b&&"drag"!==I&&(C?no(r,A,{...E,controller:Oe(b,{groupQueue:P,controllerSize:10,viewScaleInfo:p})}):oo(r,A,E)),!C&&S&&["select","drag","resize"].includes(I))ao(r,W,{...E,element:S,groupQueue:P,hideControllers:!!T&&"drag"===I});else if("area"===I&&M&&z)!function(e,t){const{start:i,end:o}=t;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=_i,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:M,end:z});else if(["drag-list","drag-list-end"].includes(I)){const e=go(h(),{viewScaleInfo:y.getActiveViewScaleInfo(),viewSizeInfo:y.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=_i,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("div");a.setAttribute("contenteditable","true");const r=document.createElement("div"),s=e.container||document.body,l=document.createElement("div");let h=null,c=[];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 d=()=>{l.style.display="none",h=null,c=[]},f=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:a,w:r,h:s}=t,l=Se(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},u=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,d={x:i*n,y:a*n,w:r*n,h:c*n,angle:Se(t.angle||0)};0===e&&(d.x+=l,d.y+=s),h=f({size:d,parent:h})}const c={...mo,...i.detail};let d=i.x*n+l,u=i.y*n+s,g=i.w*n,v=i.h*n;o.length>0&&(d=i.x*n,u=i.y*n,g=i.w*n,v=i.h*n);let w="center",m="center";"left"===c.textAlign?w="start":"right"===c.textAlign&&(w="end"),"top"===c.verticalAlign?m="start":"bottom"===c.verticalAlign&&(m="end"),a.style.display="inline-flex",a.style.justifyContent=w,a.style.alignItems=m,a.style.position="absolute",a.style.left=d-1+"px",a.style.top=u-1+"px",a.style.width=`${g+2}px`,a.style.height=`${v+2}px`,a.style.transform=`rotate(${Se(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.style.padding="0",a.style.margin="0",a.style.outline="none",a.innerText=c.text||"",h.appendChild(a)},g=()=>{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",(()=>{d()})),a.addEventListener("click",(e=>{e.stopPropagation()})),a.addEventListener("input",(()=>{h&&c&&(h.detail.text=a.innerText||"",t.trigger(wo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c||[]]}),o.drawFrame())})),a.addEventListener("blur",(()=>{h&&c&&t.trigger(wo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c]}),d()})),a.addEventListener("keydown",(e=>{e.stopPropagation()})),a.addEventListener("keypress",(e=>{e.stopPropagation()})),a.addEventListener("keyup",(e=>{e.stopPropagation()})),a.addEventListener("wheel",(e=>{e.stopPropagation(),e.preventDefault()}));const v=e=>{var t;(null==e?void 0:e.position)&&(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(h=e.element,c=e.position),(e=>{g(),u(e),l.style.display="block"})(e)};return{name:"@middleware/text-editor",use(){t.on(vo,v)},disuse(){t.off(vo,v)}}},e.middlewareEventRuler=Go,e.middlewareEventScale=ko,e.middlewareEventSelect=yo,e.middlewareEventSelectClear=po,e.middlewareEventTextChange=wo,e.middlewareEventTextEdit=vo,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
|
1
|
+
var iDrawCore=function(e){"use strict";var t,i,o,n,a,s,r,l,h,c,d,f,u,g,v,w,m,p,y,x,S=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},b=(e,t,i)=>(S(e,t,"read from private field"),i?i.call(e):t.get(e)),I=(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)},A=(e,t,i,o)=>(S(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i),M=(e,t,i)=>(S(e,t,"access private method"),i);function R(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 z(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 P(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function E(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 T(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/${E(t.toString(16).padEnd(4,o))}${E(e.substring(i-4,i).padEnd(4,o)).padEnd(4,"f")}-${E(e.substring(i-8,i-4).padEnd(4,o)).padEnd(4,"f")}-${E(e.substring(i-12,i-8).padEnd(4,o)).padEnd(4,"f")}-${E(e.substring(i-16,i-12).padEnd(4,n)).padEnd(4,"f")}-${E(e.substring(i,i+4).padEnd(4,n)).padEnd(4,"f")}${E(e.substring(i+4,i+8).padEnd(4,n)).padEnd(4,"f")}${E(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 C(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const L={type(e,t){const i=C(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===C(e),json:e=>"Object"===C(e),function:e=>"Function"===C(e),asyncFunction:e=>"AsyncFunction"===C(e),boolean:e=>"Boolean"===C(e),string:e=>"String"===C(e),number:e=>"Number"===C(e),undefined:e=>"Undefined"===C(e),null:e=>"Null"===C(e),promise:e=>"Promise"===C(e)};var O=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function s(e){try{l(o.next(e))}catch(e){a(e)}}function r(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(s,r)}l((o=o.apply(e,t||[])).next())}))};const{Image:k}=window;function j(e){return new Promise(((t,i)=>{const o=new k;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function D(e){return O(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 j(t)}))}function Y(e,t){return O(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&");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"}),s=new FileReader;s.readAsDataURL(a),s.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},s.onerror=function(e){n(e)}}))}(e,t);return yield j(i)}))}function V(e){return"number"==typeof e&&(e>0||e<=0)}function B(e){return"number"==typeof e&&e>=0}function X(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function F(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const G={x:function(e){return V(e)},y:function(e){return V(e)},w:B,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:V,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return B(e)},borderRadius:function(e){return V(e)&&e>=0},color:function(e){return R(e)},imageSrc:function(e){return F(e)||X(e)},imageURL:X,imageBase64:F,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 V(e)&&e>0},lineHeight:function(e){return V(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 V(e)&&e>0}};var N,H,Z=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},Q=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 U{constructor(e,t){N.set(this,void 0),H.set(this,void 0),Z(this,N,e,"f"),Z(this,H,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f"),this.$resetFont()}$undoPixelRatio(e){return e/Q(this,H,"f").devicePixelRatio}$doPixelRatio(e){return Q(this,H,"f").devicePixelRatio*e}$getContext(){return Q(this,N,"f")}$setContext(e){Z(this,N,e,"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"}`),Q(this,N,"f").font=`${t.join(" ")}`}$resetFont(){this.$setFont({fontSize:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontWeight:"400"})}$getOffscreenCanvas(){return Q(this,H,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:a}=Q(this,N,"f");a.width=t*o,a.height=i*o,Z(this,H,Object.assign(Object.assign({},Q(this,H,"f")),{devicePixelRatio:o}),"f"),!0===n&&(a.style.width=`${t}px`,a.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=Q(this,H,"f"),{width:t,height:i}=Q(this,N,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return Q(this,N,"f").canvas}get fillStyle(){return Q(this,N,"f").fillStyle}set fillStyle(e){Q(this,N,"f").fillStyle=e}get strokeStyle(){return Q(this,N,"f").strokeStyle}set strokeStyle(e){Q(this,N,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(Q(this,N,"f").lineWidth)}set lineWidth(e){Q(this,N,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return Q(this,N,"f").textAlign}set textAlign(e){Q(this,N,"f").textAlign=e}get textBaseline(){return Q(this,N,"f").textBaseline}set textBaseline(e){Q(this,N,"f").textBaseline=e}get globalAlpha(){return Q(this,N,"f").globalAlpha}set globalAlpha(e){Q(this,N,"f").globalAlpha=e}get shadowColor(){return Q(this,N,"f").shadowColor}set shadowColor(e){Q(this,N,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(Q(this,N,"f").shadowOffsetX)}set shadowOffsetX(e){Q(this,N,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(Q(this,N,"f").shadowOffsetY)}set shadowOffsetY(e){Q(this,N,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(Q(this,N,"f").shadowBlur)}set shadowBlur(e){Q(this,N,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return Q(this,N,"f").lineCap}set lineCap(e){Q(this,N,"f").lineCap=e}get globalCompositeOperation(){return Q(this,N,"f").globalCompositeOperation}set globalCompositeOperation(e){Q(this,N,"f").globalCompositeOperation=e}fill(...e){return Q(this,N,"f").fill(...e)}arc(e,t,i,o,n,a){return Q(this,N,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,a)}rect(e,t,i,o){return Q(this,N,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return Q(this,N,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return Q(this,N,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return Q(this,N,"f").beginPath()}closePath(){return Q(this,N,"f").closePath()}lineTo(e,t){return Q(this,N,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return Q(this,N,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return Q(this,N,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}getLineDash(){return Q(this,N,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return Q(this,N,"f").setLineDash(t)}stroke(e){return e?Q(this,N,"f").stroke(e):Q(this,N,"f").stroke()}translate(e,t){return Q(this,N,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return Q(this,N,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],a=e[4],s=e[e.length-4],r=e[e.length-3],l=e[e.length-2],h=e[e.length-1];return 9===e.length?Q(this,N,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a),this.$doPixelRatio(s),this.$doPixelRatio(r),this.$doPixelRatio(l),this.$doPixelRatio(h)):Q(this,N,"f").drawImage(t,this.$doPixelRatio(s),this.$doPixelRatio(r),this.$doPixelRatio(l),this.$doPixelRatio(h))}createPattern(e,t){return Q(this,N,"f").createPattern(e,t)}measureText(e){return Q(this,N,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?Q(this,N,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,N,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?Q(this,N,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,N,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){Q(this,N,"f").save()}restore(){Q(this,N,"f").restore()}scale(e,t){Q(this,N,"f").scale(e,t)}circle(e,t,i,o,n,a,s,r){Q(this,N,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,a,s,r)}isPointInPath(e,t){return Q(this,N,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return Q(this,N,"f").clip(...e)}setTransform(e,t,i,o,n,a){return Q(this,N,"f").setTransform(e,t,i,o,n,a)}getTransform(){return Q(this,N,"f").getTransform()}createLinearGradient(e,t,i,o){return Q(this,N,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,a){return Q(this,N,"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 Q(this,N,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function J(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 U(a,e)}function $(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 U(a,{devicePixelRatio:o,offscreenCanvas:n})}N=new WeakMap,H=new WeakMap;var K,q=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 _{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(q(this,K,"f").has(e)){const i=q(this,K,"f").get(e)||[];null==i||i.push(t),q(this,K,"f").set(e,i)}else q(this,K,"f").set(e,[t])}off(e,t){if(q(this,K,"f").has(e)){const i=q(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}q(this,K,"f").set(e,i||[])}}trigger(e,t){const i=q(this,K,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(q(this,K,"f").has(e)){const t=q(this,K,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){q(this,K,"f").clear()}}function ee(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}K=new WeakMap;var te,ie,oe,ne,ae=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},se=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 re{constructor(e){te.add(this),ie.set(this,void 0),oe.set(this,void 0),ae(this,oe,W(e.defaultStorage),"f"),ae(this,ie,se(this,te,"m",ne).call(this),"f")}set(e,t){se(this,ie,"f")[e]=t}get(e){return se(this,ie,"f")[e]}getSnapshot(e){return!0===(null==e?void 0:e.deepClone)?W(se(this,ie,"f")):Object.assign({},se(this,ie,"f"))}clear(){ae(this,ie,se(this,te,"m",ne).call(this),"f")}destroy(){ae(this,ie,null,"f")}}function le(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 he(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 ce(e){return e/180*Math.PI}function de(e,t,i,o){const n=ce(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 fe(e,t,i){const o=ue(t);de(e,t.angle||0,o,(()=>{i(e)}))}function ue(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function ge(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 ue({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 ve(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}function we(e,t,i){let o=ve(e,t)+i;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const n=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 a=0,s=0;return 0===o?(a=0,s=0-n):o>0&&o<Math.PI/2?(a=Math.sin(o)*n,s=0-Math.cos(o)*n):o===Math.PI/2?(a=n,s=0):o>Math.PI/2&&o<Math.PI?(a=Math.sin(Math.PI-o)*n,s=Math.cos(Math.PI-o)*n):o===Math.PI?(a=0,s=n):o>Math.PI&&o<1.5*Math.PI?(a=0-Math.sin(o-Math.PI)*n,s=Math.cos(o-Math.PI)*n):o===1.5*Math.PI?(a=0-n,s=0):o>1.5*Math.PI&&o<2*Math.PI?(a=0-Math.sin(2*Math.PI-o)*n,s=0-Math.cos(2*Math.PI-o)*n):o===2*Math.PI&&(a=0,s=0-n),a+=e.x,s+=e.y,{x:a,y:s}}function me(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:s,angle:r=0}=e,l=we(ue({x:t,y:n,w:a,h:s,angle:r}),{x:i,y:o},ce(r));i=l.x,o=l.y})),{x:i,y:o}}return e}function pe(e,t,i){const{x:o,y:n,w:a,h:s}=e;let r={x:o,y:n},l={x:o+a,y:n},h={x:o+a,y:n+s},c={x:o,y:n+s};if(i&&(i>0||i<0)){const e=ce(Se(i));r=we(t,r,e),l=we(t,l,e),h=we(t,h,e),c=we(t,c,e)}return[r,l,h,c]}function ye(e){const{angle:t=0}=e;return pe(e,ue(e),t)}function xe(e,t,i){return[we(e,{x:t[0].x,y:t[0].y},i),we(e,{x:t[1].x,y:t[1].y},i),we(e,{x:t[2].x,y:t[2].y},i),we(e,{x:t[3].x,y:t[3].y},i)]}function Se(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function be(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=be(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function Ie(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=ye(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),s=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(s-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 Ae(e,t){var i;const o=[];let n=e;if(t.length>1)for(let e=0;e<t.length-1;e++){const a=n[t[e]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(i=null==a?void 0:a.detail)||void 0===i?void 0:i.children))return null;o.push(a),n=a.detail.children}return o}function Me(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}function Re(e,t){const i=[];let o=!1;const n=t=>{var a;for(let s=0;s<t.length&&!0!==o;s++){i.push(s);const r=t[s];if(r.uuid===e){o=!0;break}if("group"===r.type&&n((null===(a=null==r?void 0:r.detail)||void 0===a?void 0:a.children)||[]),o)break;i.pop()}};return n(t),i}function ze(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 Pe(e){const{x:t,y:i,w:o,h:n,angle:a=0}=e;return 0===a?ze(e):pe(e,ue({x:t,y:i,w:o,h:n,angle:a}),a)}function Ee(e){const t=[];let i=0,o=0;const n=[],a=[...e];for(let e=0;e<a.length;e++){const{x:s,y:r,w:l,h:h,angle:c=0}=a[e];let d;if(i+=s,o+=r,0===e){const e={x:i,y:o,w:l,h:h,angle:c};d=Pe({x:s,y:r,w:l,h:h,angle:c}),n.push({center:ue(e),angle:c,radian:ce(c)})}else{d=ze({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=xe(t,d,i)}const e=ge(d);if(c>0||c<0){d=xe(e,d,ce(c))}n.push({center:e,angle:c,radian:ce(c)})}t.push(d)}return t}function Te(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Ee([...i,e]):[Pe(e)]}(e,t);return i.pop()||null}function We(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:a,h:s,angle:r}=e,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:o*l+c,y:n*l+h,w:a*l,h:s*l,angle:r}}function Ce(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:a,offsetTop:s,offsetLeft:r}=i;return{x:o*a+r,y:n*a+s}}function Le(e,t){return[Ce(e[0],t),Ce(e[1],t),Ce(e[2],t),Ce(e[3],t)]}function Oe(e,t){const{context2d:i,element:o,viewScaleInfo:n,viewSizeInfo:a}=t,{angle:s=0}=o,{x:r,y:l,w:h,h:c}=We(o,{viewScaleInfo:n,viewSizeInfo:a}),d=ye({x:r,y:l,w:h,h:c,angle:s});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 ke(e,t){const{groupQueue:i}=t,o=Te(e,{groupQueue:i}),n=ee(o[0],o[1]),a=ee(o[1],o[2]),s=ee(o[2],o[3]),r=ee(o[3],o[0]),l=o[0],h=o[1],c=o[2],d=o[3],f=Math.max(l.x,h.x,c.x,d.x),u=Math.max(l.y,h.y,c.y,d.y);return{center:{x:(f+Math.min(l.x,h.x,c.x,d.x))/2,y:(u+Math.min(l.y,h.y,c.y,d.y))/2},topLeft:l,topRight:h,bottomLeft:d,bottomRight:c,top:n,right:a,left:r,bottom:s}}function je(e){const t=Math.max(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),i=Math.max(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),o=Math.min(e.topLeft.x,e.topRight.x,e.bottomRight.x,e.bottomLeft.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomRight.y,e.bottomLeft.y),a={x:e.center.x,y:e.center.y},s={x:o,y:n},r={x:t,y:n},l={x:t,y:i},h={x:o,y:i},c=ee(s,r),d=ee(h,l),f=ee(s,h);return{center:a,topLeft:s,topRight:r,bottomLeft:h,bottomRight:l,top:c,right:ee(r,l),left:f,bottom:d}}function De(e,t){const i=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n,offsetLeft:a}=t,{width:s,height:r}=i,l=0-a/o,h=0-n/o,c=s/o,d=r/o,f=ue({x:l,y:h,w:c,h:d}),u={x:l,y:h},g={x:l+c,y:h},v={x:l,y:h+d},w={x:l+c,y:h+d},m={x:l,y:f.y},p={x:f.x,y:h},y={x:l+c,y:f.y},x={x:f.x,y:h+d};return{center:f,topLeft:u,topRight:g,bottomLeft:v,bottomRight:w,left:m,top:p,right:y,bottom:x}}(t);let o=0,n=0;return Object.keys(e).forEach((t=>{const a=e[t];a.isVisibleInView=function(e,t){const i=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),o=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),n=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),a=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),s=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),r=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),l=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),h=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y);return i<=r&&o>=s&&n<=h&&a>=l||r<=a&&r>=a&&r<=a&&r>=a}(a.rangeRectInfo,i),a.isVisibleInView?o++:n++})),{viewVisibleInfoMap:e,visibleCount:o,invisibleCount:n}}function Ye(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:s,y:r,w:l,h:h,angle:c=0}=e,d=[{uuid:P(),x:s,y:r,w:l,h:h,angle:c,type:"group",detail:{children:[]}},...i];let f=0;d.forEach((({angle:e=0})=>{f+=e}));const u=Te(e,{groupQueue:i}),g=Te({x:s-2*a,y:r-2*a,h:h+4*a,w:l+4*a,angle:c},{groupQueue:[...i]}),v=ee(u[0],u[1]),w=ee(u[1],u[2]),m=ee(u[2],u[3]),p=ee(u[3],u[0]),y=u[0],x=u[1],S=u[2],b=u[3],I=Ye(v,{size:a,angle:f}),A=Ye(w,{size:a,angle:f}),M=Ye(m,{size:a,angle:f}),R=Ye(p,{size:a,angle:f}),z=Ye(y,{size:a,angle:f}),E=Ye(x,{size:a,angle:f}),T=Ye(b,{size:a,angle:f}),W=Ye(S,{size:a,angle:f}),C=Pe(z),L=Pe(E),O=Pe(T),k=Pe(W),j=[C[1],L[0],L[3],C[2]],D=[L[3],L[2],k[1],k[0]],Y=[O[1],k[0],k[3],O[2]],V=[C[3],C[2],O[1],O[0]],B=Pe(I),X=Pe(A),F=Pe(M),G=Pe(R),N=ee(g[0],g[1]);return{elementWrapper:u,left:{type:"left",vertexes:V,center:p},right:{type:"right",vertexes:D,center:w},top:{type:"top",vertexes:j,center:v},bottom:{type:"bottom",vertexes:Y,center:m},topLeft:{type:"top-left",vertexes:C,center:y},topRight:{type:"top-right",vertexes:L,center:x},bottomLeft:{type:"bottom-left",vertexes:O,center:b},bottomRight:{type:"bottom-right",vertexes:k,center:S},leftMiddle:{type:"left-middle",vertexes:G,center:p},rightMiddle:{type:"right-middle",vertexes:X,center:w},topMiddle:{type:"top-middle",vertexes:B,center:v},bottomMiddle:{type:"bottom-middle",vertexes:F,center:m},rotate:{type:"rotate",vertexes:Pe(Ye(N,{size:a,angle:f})),center:N}}}function Be(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function Xe(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))}ie=new WeakMap,oe=new WeakMap,te=new WeakSet,ne=function(){return W(se(this,oe,"f"))};const Fe={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 Ge(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{boxSizing:a=Fe.boxSizing,borderWidth:s}=e.detail;Array.isArray(s)&&(n=0);let{x:r,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 s&&(f=(s||0)*o),"border-box"===a?(r=e.x+f/2,l=e.y+f/2,h=e.w-f,c=e.h-f):"content-box"===a?(r=e.x-f/2,l=e.y-f/2,h=e.w+f,c=e.h+f):(r=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:r,y:l,w:h,h:c,radiusList:d}}const Ne=e=>Xe(e,{decimalPlaces:4});function He(e,t){const{detail:i}=e,{xRatio:o,yRatio:n,maxRatio:a}=t,s=(o+n)/2,{borderWidth:r,borderRadius:l,borderDash:h,shadowOffsetX:c,shadowOffsetY:d,shadowBlur:f}=i;if("number"==typeof r)i.borderWidth=Ne(r*s);else if(Array.isArray(i.borderWidth)){const e=r;i.borderWidth=[Ne(e[0]*n),Ne(e[1]*o),Ne(e[2]*n),Ne(e[3]*o)]}if("number"==typeof l)i.borderRadius=Ne(l*s);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]=Ne(e*a)})),"number"==typeof c&&(i.shadowOffsetX=Ne(c*a)),"number"==typeof d&&(i.shadowOffsetX=Ne(d*a)),"number"==typeof f&&(i.shadowOffsetX=Ne(f*a))}function Ze(e,t){const{type:i}=e;!function(e,t){const{xRatio:i,yRatio:o}=t,{x:n,y:a,w:s,h:r}=e;e.x=Ne(n*i),e.y=Ne(a*o),e.w=Ne(s*i),e.h=Ne(r*o),He(e,t)}(e,t),"circle"===i||("text"===i?function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:a}=e.detail,s=(i+o)/2;n&&n>0&&(e.detail.fontSize=Ne(n*s)),a&&a>0&&(e.detail.lineHeight=Ne(a*s))}(e,t):"image"===i||"svg"===i||"html"===i||"path"===i||"group"===i&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ze(e,t)})))}function Qe(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:a=1}=i,{x:s,y:r}=o,{scale:l}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:s+i.x*l,y:r+i.y*l},c={x:s+o.x*l,y:r+o.y*l},d=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{d.addColorStop(e.offset,z(e.color,a))})),d}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:s+i.x*l,y:r+i.y*l,radius:i.radius*l},c={x:s+o.x*l,y:r+o.y*l,radius:o.radius*l},d=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{d.addColorStop(e.offset,z(e.color,a))})),d}return"#000000"}const Ue={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 Je(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 $e(e,t,i){const{pattern:o,renderContent:n,originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=Je(a)*h;!function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:a,viewSizeInfo:s}=i,r=s.devicePixelRatio,{clipPath:l}=(null==n?void 0:n.detail)||{};if(l&&a&&l.commands){const{x:i,y:n,w:s,h:h}=a,{originW:c,originH:d,originX:f,originY:u}=l,g=s/c,v=h/d,w=i-f*g,m=n-u*v;e.save(),e.translate(w,m),e.scale(r*g,r*v);const p=Be(l.commands||[]),y=new Path2D(p);e.clip(y),e.translate(0-w,0-m),e.setTransform(1,0,0,1,0,0),fe(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l,renderContent:()=>{e.globalAlpha=c,function(e,t,i){var o,n;const{pattern:a,viewScaleInfo:s,viewSizeInfo:r}=i,l=[];if(t.detail.background||a){const{x:i,y:h,w:c,h:d,radiusList:f}=Ge(t,{viewScaleInfo:s,viewSizeInfo:r});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(L.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=Qe(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:s,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=Qe(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:s,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:r,viewSizeInfo:l}),null==n||n(),function(e,t,i){if(0===t.detail.borderWidth)return;if(!R(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let a=Ue.borderColor;!0===R(t.detail.borderColor)&&(a=t.detail.borderColor);const{borderWidth:s,borderRadius:r,borderDash:l,boxSizing:h=Ue.boxSizing}=t.detail;let c=0;"number"==typeof s&&(c=s||1);c*=n;let d=[0,0,0,0];if("number"==typeof r){const e=r*n;d=[e,e,e,e]}else Array.isArray(r)&&4===(null==r?void 0:r.length)&&(d=[r[0]*n,r[1]*n,r[2]*n,r[3]*n]);e.strokeStyle=a;let f=[];Array.isArray(l)&&l.length>0&&(f=l.map((e=>Math.ceil(e*n))));let u=0,g=0,v=0,w=0;Array.isArray(s)&&(u=(s[0]||0)*n,g=(s[1]||0)*n,v=(s[2]||0)*n,w=(s[3]||0)*n);if(w||g||u||v){e.lineCap="butt";let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i+=w/2,o+=u/2,n=n-w/2-g/2,a=a-u/2-v/2):"content-box"===h?(i-=w/2,o-=u/2,n=n+w/2+g/2,a=a+u/2+v/2):(i=t.x,o=t.y,n=t.w,a=t.h),u&&(e.beginPath(),e.lineWidth=u,e.moveTo(i-w/2,o),e.lineTo(i+n+g/2,o),e.closePath(),e.stroke()),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i+n,o-u/2),e.lineTo(i+n,o+a+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-w/2,o+a),e.lineTo(i+n+g/2,o+a),e.closePath(),e.stroke()),w&&(e.beginPath(),e.lineWidth=w,e.moveTo(i,o-u/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+c/2,o=t.y+c/2,n=t.w-c,a=t.h-c):"content-box"===h?(i=t.x-c/2,o=t.y-c/2,n=t.w+c,a=t.h+c):(i=t.x,o=t.y,n=t.w,a=t.h),f.length>0?e.lineCap="butt":e.lineCap="square",n=Math.max(n,1),a=Math.max(a,1),d=d.map((e=>Math.min(e,n/2,a/2))),e.setLineDash(f),e.lineWidth=c,e.beginPath(),e.moveTo(i+d[0],o),e.arcTo(i+n,o,i+n,o+a,d[1]),e.arcTo(i+n,o+a,i,o+a,d[2]),e.arcTo(i,o+a,i,o,d[3]),e.arcTo(i,o,i+n,o,d[0]),e.closePath(),e.stroke()}e.setLineDash([])}(e,t,{viewScaleInfo:r,viewSizeInfo:l}),e.globalAlpha=h}})}function Ke(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:a}=i,{shadowColor:s,shadowOffsetX:r,shadowOffsetY:l,shadowBlur:h}=o;G.number(h)?(e.save(),e.shadowColor=s||Ue.shadowColor,e.shadowOffsetX=(r||0)*n.scale,e.shadowOffsetY=(l||0)*n.scale,e.shadowBlur=(h||0)*n.scale,a(),e.restore()):(e.save(),e.shadowColor="transparent",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,a(),e.restore())}const qe={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 _e(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:s}=i.viewScaleInfo;if(!(s<1&&(n*s<1||a*s<1)||0===i.parentOpacity))try{switch(t.type){case"rect":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=We(t,{viewScaleInfo:o,viewSizeInfo:n})||t,d=Object.assign(Object.assign({},t),{x:s,y:r,w:l,h:h,angle:c});fe(e,{x:s,y:r,w:l,h:h,angle:c},(()=>{Ke(e,d,{viewScaleInfo:o,viewSizeInfo:n,renderContent:()=>{$e(e,d,{originElem:t,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{viewScaleInfo:a,viewSizeInfo:s,parentOpacity:r}=i,{background:l="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:d=0}=o;let f=0;"number"==typeof d&&d>0?f=d:Array.isArray(d)&&"number"==typeof d[0]&&d[0]>0&&(f=d[0]),f*=a.scale;const{x:u,y:g,w:v,h:w}=We({x:t.x,y:t.y,w:t.w,h:t.h},{viewScaleInfo:a,viewSizeInfo:s})||t,m=Object.assign(Object.assign({},t),{x:u,y:g,w:v,h:w,angle:n});fe(e,{x:u,y:g,w:v,h:w,angle:n},(()=>{Ke(e,m,{viewScaleInfo:a,viewSizeInfo:s,renderContent:()=>{let t=v/2,i=w/2;const o=u+t,n=g+i;if(f>0&&("border-box"===c?(t-=f,i-=f):"center-line"===c?(t-=f/2,i-=f/2):(t-=f,i-=f)),t>=0&&i>=0){const s=Je(m)*r;if(e.globalAlpha=s,"number"==typeof f&&f>0){const a=f/2+t,s=f/2+i;e.beginPath(),e.strokeStyle=h,e.lineWidth=f,e.circle(o,n,a,s,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath();const c=Qe(e,l,{viewElementSize:{x:u,y:g,w:v,h:w},viewScaleInfo:a,opacity:e.globalAlpha});e.fillStyle=c,e.circle(o,n,t,i,0,0,2*Math.PI),e.closePath(),e.fill(),e.globalAlpha=r}}})}))}(e,t,i);break;case"text":!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=We(t,{viewScaleInfo:o,viewSizeInfo:n})||t,d=Object.assign(Object.assign({},t),{x:s,y:r,w:l,h:h,angle:c});fe(e,{x:s,y:r,w:l,h:h,angle:c},(()=>{$e(e,d,{originElem:t,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{const i=Object.assign(Object.assign({},qe),t.detail),n=(i.fontSize||qe.fontSize)*o.scale,a=i.lineHeight?i.lineHeight*o.scale:n;e.fillStyle=t.detail.color||qe.color,e.textBaseline="top",e.$setFont({fontWeight:i.fontWeight,fontSize:n,fontFamily:i.fontFamily});const c=i.text.replace(/\r\n/gi,"\n"),d=a,f=c.split("\n"),u=[];let g=0;f.forEach(((t,i)=>{let o="";if(t.length>0){for(let n=0;n<t.length&&(e.measureText(o+(t[n]||"")).width<e.$doPixelRatio(l)?o+=t[n]||"":(u.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),o=t[n]||"",g++),!((g+1)*d>h));n++)if(t.length-1===n&&(g+1)*d<h){u.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),i<f.length-1&&g++;break}}else u.push({text:"",width:0})}));let v=0;u.length*d<h&&("top"===t.detail.verticalAlign?v=0:"bottom"===t.detail.verticalAlign?v+=h-u.length*d:v+=(h-u.length*d)/2);{const t=r+v;void 0!==i.textShadowColor&&R(i.textShadowColor)&&(e.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&G.number(i.textShadowOffsetX)&&(e.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&G.number(i.textShadowOffsetY)&&(e.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&G.number(i.textShadowBlur)&&(e.shadowBlur=i.textShadowBlur),u.forEach(((o,n)=>{let a=s;"center"===i.textAlign?a=s+(l-o.width)/2:"right"===i.textAlign&&(a=s+(l-o.width)),e.fillText(o.text,a,t+d*n)}))}}})}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t,f=Object.assign(Object.assign({},t),{x:r,y:l,w:h,h:c,angle:d});fe(e,{x:r,y:l,w:h,h:c,angle:d},(()=>{Ke(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{$e(e,f,{originElem:t,calcElemSize:{x:r,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:s,renderContent:()=>{if(o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=Je(t)*s;const{x:i,y:r,w:l,h:h,radiusList:c}=Ge(f,{viewScaleInfo:n,viewSizeInfo:a});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+c[0],r),e.arcTo(i+l,r,i+l,r+h,c[1]),e.arcTo(i+l,r+h,i,r+h,c[2]),e.arcTo(i,r+h,i,r,c[3]),e.arcTo(i,r,i+l,r,c[0]),e.closePath(),e.fill(),e.clip(),e.drawImage(o,i,r,l,h),e.globalAlpha=s,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t;fe(e,{x:r,y:l,w:h,h:c,angle:d},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=Je(t)*s,e.drawImage(o,r,l,h,c),e.globalAlpha=s)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:d}=We(t,{viewScaleInfo:n,viewSizeInfo:a})||t;fe(e,{x:r,y:l,w:h,h:c,angle:d},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=Je(t)*s,e.drawImage(o,r,l,h,c),e.globalAlpha=s)}))}(e,t,i);break;case"path":!function(e,t,i){const{detail:o}=t,{originX:n,originY:a,originW:s,originH:r}=o,{viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c}=i,{x:d,y:f,w:u,h:g,angle:v}=We(t,{viewScaleInfo:l,viewSizeInfo:h})||t,w=u/s,m=g/r,p=d-n*w,y=f-a*m,x=l.scale*h.devicePixelRatio,S=Object.assign(Object.assign({},t),{x:d,y:f,w:u,h:g,angle:v});fe(e,{x:d,y:f,w:u,h:g,angle:v},(()=>{$e(e,S,{originElem:t,calcElemSize:{x:d,y:f,w:u,h:g,angle:v},viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c,renderContent:()=>{Ke(e,S,{viewScaleInfo:l,viewSizeInfo:h,renderContent:()=>{e.save(),e.translate(p,y),e.scale(x*w/l.scale,x*m/l.scale);const t=Be(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)/h.devicePixelRatio,e.lineCap=o.strokeLineCap||"square",e.stroke(i)),e.translate(-p,-y),e.restore()}})}})}))}(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=We({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},{viewScaleInfo:o,viewSizeInfo:n})||t,d=Object.assign(Object.assign({},t),{x:s,y:r,w:l,h:h,angle:c});fe(e,{x:s,y:r,w:l,h:h,angle:c},(()=>{e.globalAlpha=Je(t)*a,Ke(e,d,{viewScaleInfo:o,viewSizeInfo:n,renderContent:()=>{$e(e,d,{originElem:t,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,renderContent:()=>{const{x:s,y:r,w:l,h:h,radiusList:c}=Ge(d,{viewScaleInfo:o,viewSizeInfo:n});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(s+c[0],r),e.arcTo(s+l,r,s+l,r+h,c[1]),e.arcTo(s+l,r+h,s,r+h,c[2]),e.arcTo(s,r+h,s,r,c[3]),e.arcTo(s,r,s+l,r,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:s}=i;for(let o=0;o<t.detail.children.length;o++){let r=t.detail.children[o];if(r=Object.assign(Object.assign({},r),{x:n.x+r.x,y:n.y+r.y}),!0===i.forceDrawAll||(null==s?void 0:s.isElementInView(r,i.viewScaleInfo,i.viewSizeInfo)))try{_e(e,r,Object.assign(Object.assign({},i),{parentOpacity:a*Je(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=a}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const et={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 tt,it,ot,nt,at,st,rt,lt,ht,ct,dt,ft,ut=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function s(e){try{l(o.next(e))}catch(e){a(e)}}function r(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(s,r)}l((o=o.apply(e,t||[])).next())}))},gt=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)},vt=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 wt=["image","svg","html"],mt=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:T(n):T(`${P()}-${e.uuid}-${P()}-${P()}`)};class pt extends _{constructor(){super(),tt.add(this),it.set(this,{}),ot.set(this,{}),nt.set(this,{}),at.set(this,!1),gt(this,tt,"m",st).call(this,"image",((e,t)=>ut(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 j(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),gt(this,tt,"m",st).call(this,"html",((e,t)=>ut(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 Y(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),gt(this,tt,"m",st).call(this,"svg",((e,t)=>ut(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 D(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}isDestroyed(){return gt(this,at,"f")}destroy(){vt(this,at,!0,"f"),this.clear(),vt(this,it,null,"f"),vt(this,ot,null,"f"),vt(this,nt,null,"f")}load(e,t){!0!==gt(this,at,"f")&&(gt(this,tt,"m",ft).call(this,e)||wt.includes(e.type)&>(this,tt,"m",dt).call(this,e,t))}getContent(e){var t,i;const o=mt(e);return(null===(i=null===(t=gt(this,nt,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return gt(this,nt,"f")}setLoadItemMap(e){vt(this,nt,e,"f")}}it=new WeakMap,ot=new WeakMap,nt=new WeakMap,at=new WeakMap,tt=new WeakSet,st=function(e,t){gt(this,it,"f")[e]=t},rt=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},lt=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:gt(this,tt,"m",rt).call(this,e)}},ht=function(e){const t=mt(e.element),i=gt(this,nt,"f")[t];gt(this,at,"f")||(i?i.startTime<e.startTime&&(gt(this,nt,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(gt(this,nt,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},ct=function(e){var t;const i=mt(e.element),o=null===(t=gt(this,nt,"f"))||void 0===t?void 0:t[i];gt(this,at,"f")||(o?o.startTime<e.startTime&&(gt(this,nt,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(gt(this,nt,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},dt=function(e,t){const i=gt(this,tt,"m",lt).call(this,e),o=mt(e);if(gt(this,ot,"f")[o])return;gt(this,ot,"f")[o]=i;const n=gt(this,it,"f")[e.type];"function"!=typeof n||gt(this,at,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{gt(this,at,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",gt(this,tt,"m",ht).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,gt(this,tt,"m",ct).call(this,i)})))},ft=function(e){var t;const i=mt(e),o=null===(t=gt(this,ot,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==gt(this,tt,"m",rt).call(this,e))};var yt,xt,St,bt,It,At=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},Mt=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 Rt extends _{constructor(e){super(),yt.add(this),xt.set(this,void 0),St.set(this,new pt),bt.set(this,!1),At(this,xt,e,"f"),Mt(this,yt,"m",It).call(this)}isDestroyed(){return Mt(this,bt,"f")}destroy(){this.clear(),At(this,xt,null,"f"),Mt(this,St,"f").destroy(),At(this,St,null,"f"),At(this,bt,!0,"f")}updateOptions(e){At(this,xt,e,"f")}drawData(e,t){const i=Mt(this,St,"f"),{calculator:o}=Mt(this,xt,"f"),n=Mt(this,xt,"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{viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a}=i,s=Object.assign({uuid:"underlay"},t),{x:r,y:l,w:h,h:c}=We(s,{viewScaleInfo:o,viewSizeInfo:n})||s,d=Object.assign(Object.assign({},s),{x:r,y:l,w:h,h:c,angle:0});Ke(e,d,{viewScaleInfo:o,viewSizeInfo:n,renderContent:()=>{$e(e,d,{originElem:s,calcElemSize:{x:r,y:l,w:h,h:c,angle:0},viewScaleInfo:o,viewSizeInfo:n,parentOpacity:a,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 s=n[t],r=Object.assign(Object.assign({},s),{detail:Object.assign(Object.assign({},et),null==s?void 0:s.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.isElementInView(r,i.viewScaleInfo,i.viewSizeInfo)))try{_e(e,r,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}=Mt(this,xt,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:s,width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:s},viewSizeInfo:{width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){Mt(this,St,"f").setLoadItemMap(e)}getLoadItemMap(){return Mt(this,St,"f").getLoadItemMap()}getLoader(){return Mt(this,St,"f")}}xt=new WeakMap,St=new WeakMap,bt=new WeakMap,yt=new WeakSet,It=function(){const e=Mt(this,St,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(e=>{console.error(e)}))};var zt,Pt,Et=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},Tt=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 Wt{constructor(e){zt.set(this,void 0),Pt.set(this,void 0),Et(this,zt,e,"f"),Et(this,Pt,new re({defaultStorage:{viewVisibleInfoMap:{},visibleCount:0,invisibleCount:0}}),"f")}toGridNum(e){return Math.round(e)}destroy(){Et(this,zt,null,"f")}isElementInView(e,t,i){return function(e,t){const{viewSizeInfo:i,viewScaleInfo:o}=t,{width:n,height:a}=i,{angle:s}=e,{x:r,y:l,w:h,h:c}=We(e,{viewScaleInfo:o,viewSizeInfo:i}),d=ye({x:r,y:l,w:h,h:c,angle:s}),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,s=t.x,r=t.y,l=t.x+t.w,h=t.y+t.h;return i<=l&&n>=s&&o<=h&&a>=r}(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 Oe(e,{context2d:Tt(this,zt,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=Tt(this,zt,"f").viewContext;return function(e,t){var i,o,n;const{context2d:a,data:s,viewScaleInfo:r,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,s=0,d=0;for(let e=0;e<=t;e++)n+=h[e].x,s+=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(Oe(e,{context2d:a,element:{x:n+u.x,y:s+u.y,w:u.w,h:u.h,angle:d+(u.angle||0)},viewScaleInfo:r,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=s.elements.length-1;t>=0;t--){const i=s.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&Oe(e,{context2d:a,element:i,viewScaleInfo:r,viewSizeInfo:l})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}resetViewVisibleInfoMap(e,t){if(e){const{viewVisibleInfoMap:i,invisibleCount:o,visibleCount:n}=function(e,t){const i={},o=[],n=t=>{const a={isVisibleInView:!0,isGroup:"group"===t.type,position:[...o]};let s=null;s=ke(t,{groupQueue:Ae(e,o)||[]}),i[t.uuid]=Object.assign(Object.assign({},a),{originRectInfo:s,rangeRectInfo:G.angle(t.angle)?je(s):s}),"group"===t.type&&t.detail.children.forEach(((e,t)=>{o.push(t),n(e),o.pop()}))};return e.forEach(((e,t)=>{o.push(t),n(e),o.pop()})),De(i,t)}(e.elements,t);Tt(this,Pt,"f").set("viewVisibleInfoMap",i),Tt(this,Pt,"f").set("invisibleCount",o),Tt(this,Pt,"f").set("visibleCount",n)}}updateVisiableStatus(e){const{viewVisibleInfoMap:t,invisibleCount:i,visibleCount:o}=De(Tt(this,Pt,"f").get("viewVisibleInfoMap"),e);Tt(this,Pt,"f").set("viewVisibleInfoMap",t),Tt(this,Pt,"f").set("invisibleCount",i),Tt(this,Pt,"f").set("visibleCount",o)}calcViewRectInfoFromOrigin(e,t){const i=Tt(this,Pt,"f").get("viewVisibleInfoMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:a}=t,{center:s,left:r,right:l,bottom:h,top:c,topLeft:d,topRight:f,bottomLeft:u,bottomRight:g}=i.originRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n,viewSizeInfo:a};return{center:Ce(s,v),left:Ce(r,v),right:Ce(l,v),bottom:Ce(h,v),top:Ce(c,v),topLeft:Ce(d,v),topRight:Ce(f,v),bottomLeft:Ce(u,v),bottomRight:Ce(g,v)}}calcViewRectInfoFromRange(e,t){const i=Tt(this,Pt,"f").get("viewVisibleInfoMap")[e];if(!(null==i?void 0:i.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:n,viewSizeInfo:a}=t,{center:s,left:r,right:l,bottom:h,top:c,topLeft:d,topRight:f,bottomLeft:u,bottomRight:g}=i.rangeRectInfo;if(!0===o&&!1===i.isVisibleInView)return null;const v={viewScaleInfo:n,viewSizeInfo:a};return{center:Ce(s,v),left:Ce(r,v),right:Ce(l,v),bottom:Ce(h,v),top:Ce(c,v),topLeft:Ce(d,v),topRight:Ce(f,v),bottomLeft:Ce(u,v),bottomRight:Ce(g,v)}}modifyViewVisibleInfoMap(e,t){const{modifyOptions:i,viewScaleInfo:o,viewSizeInfo:n}=t,{type:a,content:s}=i,r=e.elements,l=Tt(this,Pt,"f").get("viewVisibleInfoMap");if("deleteElement"===a){const{element:e}=s;delete l[e.uuid]}else if("addElement"===a||"updateElement"===a){const{position:t}=s,i=Me(t,e.elements),h=Ae(r,t);if(i){const e=ke(i,{groupQueue:h||[]}),s={originRectInfo:e,rangeRectInfo:G.angle(i.angle)?je(e):e,isVisibleInView:!0,isGroup:"group"===(null==i?void 0:i.type),position:[...t]};l[i.uuid]=s,"updateElement"===a&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:n})}}else"moveElement"===a&&this.resetViewVisibleInfoMap(e,{viewScaleInfo:o,viewSizeInfo:n});Tt(this,Pt,"f").set("viewVisibleInfoMap",l)}}zt=new WeakMap,Pt=new WeakMap;var Ct,Lt,Ot,kt,jt,Dt,Yt,Vt,Bt,Xt,Ft,Gt,Nt,Ht,Zt,Qt,Ut=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},Jt=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 $t(e){return e>0||e<0||0===e}class Kt extends _{constructor(e){super(),Ct.add(this),Lt.set(this,void 0),Ot.set(this,void 0),kt.set(this,!1),Dt.set(this,(e=>{if(!Jt(this,Ct,"m",Ht).call(this,e))return;const t=Jt(this,Ct,"m",Zt).call(this,e);if(!Jt(this,Ct,"m",Qt).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})})),Yt.set(this,(e=>{if(!Jt(this,Ct,"m",Ht).call(this,e))return;e.preventDefault();const t=Jt(this,Ct,"m",Zt).call(this,e);Jt(this,Ct,"m",Qt).call(this,t)})),Vt.set(this,(e=>{if(!Jt(this,Ct,"m",Ht).call(this,e))return;e.preventDefault();const t=Jt(this,Ct,"m",Zt).call(this,e);if(!Jt(this,Ct,"m",Qt).call(this,t))return;const i=Date.now(),o=Jt(this,Ot,"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}):Jt(this,Ot,"f").set("prevClickPoint",t)})),Bt.set(this,(e=>{if(Jt(this,Ot,"f").set("hasPointDown",!1),!Jt(this,Ct,"m",Ht).call(this,e))return;e.preventDefault();const t=Jt(this,Ct,"m",Zt).call(this,e);this.trigger("pointLeave",{point:t})})),Xt.set(this,(e=>{if(Jt(this,Ot,"f").set("hasPointDown",!1),!Jt(this,Ct,"m",Ht).call(this,e))return;e.preventDefault();const t=Jt(this,Ct,"m",Zt).call(this,e);this.trigger("pointEnd",{point:t})})),Ft.set(this,(e=>{if(!Jt(this,Ct,"m",Ht).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=Jt(this,Ct,"m",Zt).call(this,e);Jt(this,Ct,"m",Qt).call(this,t)?!0===Jt(this,Ot,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):Jt(this,Ot,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),Jt(this,Ot,"f").set("hasPointDown",!1))})),Gt.set(this,(e=>{if(!Jt(this,Ct,"m",Ht).call(this,e))return;e.preventDefault();const t=Jt(this,Ct,"m",Zt).call(this,e);Jt(this,Ct,"m",Qt).call(this,t)&&(Jt(this,Ot,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),Nt.set(this,(e=>{if(!Jt(this,Ct,"m",Ht).call(this,e))return;e.preventDefault();const t=Jt(this,Ct,"m",Zt).call(this,e);Jt(this,Ct,"m",Qt).call(this,t)&&this.trigger("hover",{point:t})}));const t=new re({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});Ut(this,Ot,t,"f"),Ut(this,Lt,e,"f"),Jt(this,Ct,"m",jt).call(this)}onEvents(){if(Jt(this,kt,"f"))return;const e=window;e.addEventListener("mousemove",Jt(this,Nt,"f")),e.addEventListener("mousedown",Jt(this,Gt,"f")),e.addEventListener("mousemove",Jt(this,Ft,"f")),e.addEventListener("mouseup",Jt(this,Xt,"f")),e.addEventListener("mouseleave",Jt(this,Bt,"f")),e.addEventListener("wheel",Jt(this,Dt,"f"),{passive:!1}),e.addEventListener("click",Jt(this,Vt,"f")),e.addEventListener("contextmenu",Jt(this,Yt,"f"))}offEvents(){const e=window;e.removeEventListener("mousemove",Jt(this,Nt,"f")),e.removeEventListener("mousedown",Jt(this,Gt,"f")),e.removeEventListener("mousemove",Jt(this,Ft,"f")),e.removeEventListener("mouseup",Jt(this,Xt,"f")),e.removeEventListener("mouseleave",Jt(this,Bt,"f")),e.removeEventListener("wheel",Jt(this,Dt,"f")),e.removeEventListener("click",Jt(this,Vt,"f")),e.removeEventListener("contextmenu",Jt(this,Yt,"f"))}destroy(){this.offEvents(),Jt(this,Ot,"f").destroy(),Ut(this,kt,!0,"f")}}Lt=new WeakMap,Ot=new WeakMap,kt=new WeakMap,Dt=new WeakMap,Yt=new WeakMap,Vt=new WeakMap,Bt=new WeakMap,Xt=new WeakMap,Ft=new WeakMap,Gt=new WeakMap,Nt=new WeakMap,Ct=new WeakSet,jt=function(){this.onEvents()},Ht=function(e){return e.target===Jt(this,Lt,"f").boardContent.boardContext.canvas},Zt=function(e){const t=Jt(this,Lt,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},Qt=function(e){const t=Jt(this,Lt,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!($t(e.x)&&$t(e.y)&&e.x<=i&&e.y<=o)};var qt,_t,ei=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},ti=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 ii={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class oi{constructor(){qt.set(this,void 0),_t.set(this,void 0);const e=new re({defaultStorage:ii}),t=new re({defaultStorage:{}});ei(this,qt,e,"f"),ei(this,_t,t,"f")}getActiveStorage(e){return ti(this,qt,"f").get(e)}setActiveStorage(e,t){return ti(this,qt,"f").set(e,t)}getActiveStoreSnapshot(e){return ti(this,qt,"f").getSnapshot(e)}getSharedStorage(e){return ti(this,_t,"f").get(e)}setSharedStorage(e,t){return ti(this,_t,"f").set(e,t)}getSharedStoreSnapshot(e){return ti(this,_t,"f").getSnapshot(e)}getActiveViewScaleInfo(){return{scale:ti(this,qt,"f").get("scale"),offsetTop:ti(this,qt,"f").get("offsetTop"),offsetBottom:ti(this,qt,"f").get("offsetBottom"),offsetLeft:ti(this,qt,"f").get("offsetLeft"),offsetRight:ti(this,qt,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;ti(this,qt,"f").set("scale",t),ti(this,qt,"f").set("offsetTop",i),ti(this,qt,"f").set("offsetBottom",o),ti(this,qt,"f").set("offsetLeft",n),ti(this,qt,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){ti(this,qt,"f").set("width",e.width),ti(this,qt,"f").set("height",e.height),ti(this,qt,"f").set("devicePixelRatio",e.devicePixelRatio),ti(this,qt,"f").set("contextWidth",e.contextWidth),ti(this,qt,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:ti(this,qt,"f").get("width"),height:ti(this,qt,"f").get("height"),devicePixelRatio:ti(this,qt,"f").get("devicePixelRatio"),contextWidth:ti(this,qt,"f").get("contextWidth"),contextHeight:ti(this,qt,"f").get("contextHeight")}}}qt=new WeakMap,_t=new WeakMap;var ni,ai,si,ri,li,hi,ci=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},di=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:fi}=window;class ui extends _{constructor(e){super(),ni.add(this),ai.set(this,void 0),si.set(this,[]),ri.set(this,"FREE"),ci(this,ai,e,"f"),di(this,ni,"m",li).call(this)}resetViewVisibleInfoMap(e,t){e&&di(this,ai,"f").calculator.resetViewVisibleInfoMap(e,t)}drawFrame(){const{sharer:e}=di(this,ai,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();di(this,si,"f").push({activeStore:t,sharedStore:i}),di(this,ni,"m",hi).call(this)}scale(e){const{scale:t,point:i,ignoreUpdateVisibleStatus:o}=e,{sharer:n}=di(this,ai,"f"),{moveX:a,moveY:s}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:a}=o,s=t/o.scale,r=i.x,l=i.y;return{moveX:r-r*s+(n*s-n),moveY:l-l*s+(a*s-a)}}({scale:t,point:i,viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()});return n.setActiveStorage("scale",t),o||di(this,ai,"f").calculator.updateVisiableStatus({viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),{moveX:a,moveY:s}}scroll(e){const{sharer:t}=di(this,ai,"f"),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n,ignoreUpdateVisibleStatus:a}=e,s=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:a}=o,{width:s,height:r,contextWidth:l,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,f=o.offsetTop,u=o.offsetBottom;return c+=t,f+=i,d=s-(l*a+c),u=r-(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(s),a||di(this,ai,"f").calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),s}updateViewScaleInfo(e){const{sharer:t}=di(this,ai,"f"),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:a}=t,{width:s,height:r,contextWidth:l,contextHeight:h}=a,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:s-(l*i+c/i),offsetBottom:r-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),di(this,ai,"f").calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),i}resize(e={},t){const{sharer:i}=di(this,ai,"f"),o=i.getActiveViewSizeInfo(),n=Object.assign(Object.assign({},o),e),{width:a,height:s,devicePixelRatio:r}=n,{underContext:l,boardContext:h,helperContext:c,viewContext:d}=di(this,ai,"f").boardContent;return h.canvas.width=a*r,h.canvas.height=s*r,h.canvas.style.width=`${a}px`,h.canvas.style.height=`${s}px`,l.canvas.width=a*r,l.canvas.height=s*r,c.canvas.width=a*r,c.canvas.height=s*r,d.canvas.width=a*r,d.canvas.height=s*r,i.setActiveViewSizeInfo(n),(null==t?void 0:t.ignoreUpdateVisibleStatus)||di(this,ai,"f").calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),n}}ai=new WeakMap,si=new WeakMap,ri=new WeakMap,ni=new WeakSet,li=function(){const{renderer:e}=di(this,ai,"f");e.on("load",(()=>{this.drawFrame()}))},hi=function e(){if("DRAWING"===di(this,ri,"f")||0===di(this,si,"f").length)return;ci(this,ri,"DRAWING","f");const t=di(this,si,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=di(this,ai,"f");if(t){const{scale:e,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h,width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g}=t.activeStore,v={scale:e,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h},w={width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g};(null==t?void 0:t.activeStore.data)&&i.drawData(t.activeStore.data,{viewScaleInfo:v,viewSizeInfo:w}),n({snapshot:t}),o.drawView(),a({snapshot:t})}0!==di(this,si,"f").length?ci(this,ri,"DRAWING","f")&&fi((()=>{di(this,ni,"m",e).call(this)})):ci(this,ri,"COMPLETE","f")};var gi,vi,wi,mi,pi,yi,xi,Si,bi,Ii,Ai,Mi,Ri,zi,Pi,Ei,Ti,Wi,Ci,Li,Oi,ki,ji,Di,Yi,Vi,Bi,Xi=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},Fi=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 Gi{constructor(e){gi.add(this),vi.set(this,void 0),wi.set(this,new WeakMap),mi.set(this,[]),pi.set(this,[]),yi.set(this,void 0),xi.set(this,void 0),Si.set(this,void 0),bi.set(this,void 0),Ii.set(this,void 0),Ai.set(this,new _),Mi.set(this,!1);const{boardContent:t}=e,i=new oi,o=new Wt({viewContext:t.viewContext}),n=new Kt({boardContent:t,sharer:i}),a=new Rt({viewContext:t.viewContext,sharer:i,calculator:o});Xi(this,vi,e,"f"),Xi(this,Si,i,"f"),Xi(this,yi,n,"f"),Xi(this,xi,a,"f"),Xi(this,Ii,o,"f"),Xi(this,bi,new ui({boardContent:e.boardContent,sharer:i,renderer:a,calculator:Fi(this,Ii,"f"),beforeDrawFrame:e=>{Fi(this,gi,"m",Yi).call(this,e)},afterDrawFrame:e=>{Fi(this,gi,"m",Vi).call(this,e)}}),"f"),Fi(this,gi,"m",Ri).call(this),Fi(this,gi,"m",Bi).call(this)}isDestroyed(){return Fi(this,Mi,"f")}destroy(){Fi(this,yi,"f").destroy(),Fi(this,xi,"f").destroy(),Fi(this,Ii,"f").destroy(),Fi(this,Ai,"f").destroy(),Xi(this,Mi,!0,"f")}getSharer(){return Fi(this,Si,"f")}getViewer(){return Fi(this,bi,"f")}getRenderer(){return Fi(this,xi,"f")}setData(e,t){const{modifiedOptions:i}=t||{},o=Fi(this,Si,"f");Fi(this,Si,"f").setActiveStorage("data",e);const n=o.getActiveViewSizeInfo(),a=o.getActiveViewScaleInfo(),s=Ie(e.elements,{viewWidth:n.width,viewHeight:n.height,extend:!0});Fi(this,bi,"f").resetViewVisibleInfoMap(e,{viewSizeInfo:n,viewScaleInfo:a}),Fi(this,bi,"f").drawFrame();const r=Object.assign(Object.assign({},n),s);return Fi(this,Si,"f").setActiveViewSizeInfo(r),{viewSizeInfo:r}}getData(){const{data:e}=Fi(this,Si,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(Fi(this,wi,"f").has(e)){const o=Fi(this,wi,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",Fi(this,wi,"f").set(e,o),void Fi(this,gi,"m",Bi).call(this)}const{boardContent:n,container:a}=Fi(this,vi,"f"),s=e({boardContent:n,sharer:Fi(this,Si,"f"),viewer:Fi(this,bi,"f"),calculator:Fi(this,Ii,"f"),eventHub:Fi(this,Ai,"f"),container:a});null===(o=s.use)||void 0===o||o.call(s),Fi(this,mi,"f").push(e),Fi(this,pi,"f").push(s),Fi(this,wi,"f").set(e,{status:"enable",middlewareObject:s}),Fi(this,gi,"m",Bi).call(this)}disuse(e){var t,i;const o=Fi(this,wi,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",Fi(this,wi,"f").set(e,o),Fi(this,gi,"m",Bi).call(this))}scale(e){const t=Fi(this,bi,"f"),{ignoreUpdateVisibleStatus:i}=e,{moveX:o,moveY:n}=t.scale(Object.assign(Object.assign({},e),{ignoreUpdateVisibleStatus:!0}));t.scroll({moveX:o,moveY:n,ignoreUpdateVisibleStatus:i})}scroll(e){return Fi(this,bi,"f").scroll(e)}updateViewScaleInfo(e){return Fi(this,bi,"f").updateViewScaleInfo(e)}resize(e,t){const i=Fi(this,bi,"f").resize(e,t),{width:o,height:n,devicePixelRatio:a}=e,{boardContent:s}=Fi(this,vi,"f");s.viewContext.$resize({width:o,height:n,devicePixelRatio:a}),s.helperContext.$resize({width:o,height:n,devicePixelRatio:a}),s.boardContext.$resize({width:o,height:n,devicePixelRatio:a}),s.underContext.$resize({width:o,height:n,devicePixelRatio:a}),Fi(this,bi,"f").drawFrame(),Fi(this,yi,"f").trigger("resize",i),Fi(this,Si,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=Fi(this,vi,"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),Fi(this,gi,"m",Di).call(this)}getEventHub(){return Fi(this,Ai,"f")}onWatcherEvents(){Fi(this,yi,"f").onEvents()}offWatcherEvents(){Fi(this,yi,"f").offEvents()}}vi=new WeakMap,wi=new WeakMap,mi=new WeakMap,pi=new WeakMap,yi=new WeakMap,xi=new WeakMap,Si=new WeakMap,bi=new WeakMap,Ii=new WeakMap,Ai=new WeakMap,Mi=new WeakMap,gi=new WeakSet,Ri=function(){Fi(this,yi,"f").on("pointStart",Fi(this,gi,"m",zi).bind(this)),Fi(this,yi,"f").on("pointEnd",Fi(this,gi,"m",Pi).bind(this)),Fi(this,yi,"f").on("pointMove",Fi(this,gi,"m",Ei).bind(this)),Fi(this,yi,"f").on("hover",Fi(this,gi,"m",Ti).bind(this)),Fi(this,yi,"f").on("wheel",Fi(this,gi,"m",Ci).bind(this)),Fi(this,yi,"f").on("wheelScale",Fi(this,gi,"m",Li).bind(this)),Fi(this,yi,"f").on("scrollX",Fi(this,gi,"m",Oi).bind(this)),Fi(this,yi,"f").on("scrollY",Fi(this,gi,"m",ki).bind(this)),Fi(this,yi,"f").on("resize",Fi(this,gi,"m",ji).bind(this)),Fi(this,yi,"f").on("doubleClick",Fi(this,gi,"m",Wi).bind(this)),Fi(this,xi,"f").on("load",(()=>{Fi(this,Ai,"f").trigger("loadResource")}))},zi=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},Pi=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},Ei=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointMove)||void 0===t?void 0:t.call(o,e)))return}},Ti=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},Wi=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},Ci=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},Li=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheelScale)||void 0===t?void 0:t.call(o,e)))return}},Oi=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},ki=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},ji=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},Di=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.clear)||void 0===t?void 0:t.call(o,e)))return}},Yi=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Vi=function(e){var t;for(let i=0;i<Fi(this,pi,"f").length;i++){const o=Fi(this,pi,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Bi=function(){const e=[],t=Fi(this,wi,"f");Fi(this,mi,"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)})),Xi(this,pi,e,"f")};const Ni="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3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eBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";class Hi{constructor(e,d){I(this,s),I(this,l),I(this,c),I(this,f),I(this,g),I(this,t,void 0),I(this,i,void 0),I(this,o,null),I(this,n,null),I(this,a,{auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3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O27e0lHppw9MEDJo//A4eoE91iB48SJ80lFMB/t/+V/sPGZfTmtMFR4EAAAAASUVORK5CYII="}),A(this,i,e),A(this,t,d.eventHub),M(this,s,r).call(this),M(this,l,h).call(this)}}t=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakMap,a=new WeakMap,s=new WeakSet,r=function(){const e=b(this,t);M(this,c,d).call(this,"default"),e.on("cursor",(e=>{var t;"over-element"!==e.type&&e.type?"resize-rotate"===e.type?M(this,c,d).call(this,"rotate"):"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?M(this,f,u).call(this,e):"drag-default"===e.type?M(this,c,d).call(this,"drag-default"):"drag-active"===e.type?M(this,c,d).call(this,"drag-active"):M(this,c,d).call(this,"auto"):M(this,c,d).call(this,"auto")}))},l=new WeakSet,h=function(){j(Ni).then((e=>{A(this,n,e)})).catch((e=>{console.error(e)}))},c=new WeakSet,d=function(e){if(b(this,o)===e)return;A(this,o,e);const t=b(this,a)[b(this,o)]||b(this,a).auto;let n=0,s=0;(e.startsWith("rotate-")&&b(this,a)[b(this,o)]||"rotate"===e)&&(n=10,s=10),b(this,i).style.cursor="default"===e?"default":`image-set(url(${t})2x) ${n} ${s}, auto`},f=new WeakSet,u=function(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+=Se((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+=Se(e.angle||0)})),i=Se(i);const o=M(this,g,v).call(this,i);M(this,c,d).call(this,o)},g=new WeakSet,v=function(e){const t=`rotate-${e}`;if(!b(this,a)[t]){const i=b(this,n);if(i){const o=document.createElement("canvas"),n=i.width,s=i.height,r={x:n/2,y:s/2};o.width=n,o.height=s;const l=o.getContext("2d"),h=ce(e);l.translate(r.x,r.y),l.rotate(h),l.translate(-r.x,-r.y),l.drawImage(i,0,0,n,s),l.translate(r.x,r.y),l.rotate(-h),l.translate(-r.x,-r.y);const c=o.toDataURL("image/png");b(this,a)[t]=c}}return t};const Zi="SELECT",Qi=Symbol(`${Zi}_actionType`),Ui=Symbol(`${Zi}_resizeType`),Ji=Symbol(`${Zi}_areaStart`),$i=Symbol(`${Zi}_areaEnd`),Ki=Symbol(`${Zi}_hoverElement`),qi=Symbol(`${Zi}_hoverElementVertexes`),_i=Symbol(`${Zi}_selectedElementList`),eo=Symbol(`${Zi}_selectedElementListVertexes`),to=Symbol(`${Zi}_selectedElementController`),io=Symbol(`${Zi}_selectedElementPosition`),oo=Symbol(`${Zi}_selectedReferenceXLines`),no=Symbol(`${Zi}_selectedReferenceYLines`),ao=Symbol(`${Zi}_groupQueue`),so=Symbol(`${Zi}_groupQueueVertexesList`),ro=Symbol(`${Zi}_isMoving`),lo="#1973ba",ho="#5b5959b5";function co(e,t,i){const{borderColor:o,borderWidth:n,background:a,lineDash:s}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=a,e.setLineDash(s),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 fo(e,t,i,o){const{borderColor:n,borderWidth:a,lineDash:s}=o;e.setLineDash([]),e.lineWidth=a,e.strokeStyle=n,e.setLineDash(s),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.closePath(),e.stroke()}function uo(e,t,i){const{borderColor:o,borderWidth:n,lineDash:a}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.setLineDash(a),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[2].x,t[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function go(e,t,i){const{size:o,borderColor:n,borderWidth:a,lineDash:s}=i,r=t.x-o/2,l=t.x+o/2,h=t.y-o/2,c=t.y+o/2;uo(e,[{x:r,y:h},{x:l,y:h},{x:l,y:c},{x:r,y:c}],{borderColor:n,borderWidth:a,lineDash:s})}function vo(e,t,i){if(!t)return;const o={borderColor:lo,borderWidth:1,background:"transparent",lineDash:[]};co(e,Le(t,i),o)}function wo(e,t,i){if(!t)return;const o={borderColor:ho,borderWidth:1,background:"transparent",lineDash:[]};co(e,Le(t,i),o);const{controller:n}=i;if(n){const{topLeft:t,topRight:a,bottomLeft:s,bottomRight:r,topMiddle:l,bottomMiddle:h,leftMiddle:c,rightMiddle:d}=n,f={...o,borderWidth:1,background:ho};uo(e,Le(l.vertexes,i),f),uo(e,Le(h.vertexes,i),f),uo(e,Le(c.vertexes,i),f),uo(e,Le(d.vertexes,i),f),uo(e,Le(t.vertexes,i),f),uo(e,Le(a.vertexes,i),f),uo(e,Le(s.vertexes,i),f),uo(e,Le(r.vertexes,i),f)}}function mo(e,t,i){if(!t)return;const{hideControllers:o}=i,{elementWrapper:n,topLeft:a,topRight:s,bottomLeft:r,bottomRight:l,top:h,rotate:c}=t,d={borderColor:lo,borderWidth:2,background:"transparent",lineDash:[]},f={...d,borderWidth:4,background:"#FFFFFF"};co(e,Le(n,i),d),o||(fo(e,Ce(h.center,i),Ce(c.center,i),{...f,borderWidth:2}),co(e,Le(a.vertexes,i),f),co(e,Le(s.vertexes,i),f),co(e,Le(r.vertexes,i),f),co(e,Le(l.vertexes,i),f),function(e,t,i){const{size:o,borderColor:n,borderWidth:a,background:s}=i,r=t,l=o/2,h=l,c=l;if(h>=0&&c>=0){if("number"==typeof a&&a>0){const t=a/2+h,i=a/2+c;e.beginPath(),e.strokeStyle=n,e.lineWidth=a,e.circle(r.x,r.y,t,i,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath(),e.fillStyle=s,e.circle(r.x,r.y,h,c,0,0,2*Math.PI),e.closePath(),e.fill()}}(e,Ce(c.center,i),{...f,size:10,borderWidth:2}))}function po(e,t){const{xLines:i,yLines:o}=t,n={borderColor:"#f7276e",borderWidth:1,lineDash:[]},a={...n,size:6};i&&i.forEach((t=>{t.forEach(((i,o)=>{go(e,i,a),t[o+1]&&fo(e,t[o],t[o+1],n)}))})),o&&o.forEach((t=>{t.forEach(((i,o)=>{go(e,i,a),t[o+1]&&fo(e,t[o],t[o+1],n)}))}))}function yo(e){return e*Math.PI/180}function xo(e,t){return Math.sqrt(e*e+t*t)}function So(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function bo(e,t){const{ctx:i,viewScaleInfo:o,vertexes:n}=t,a=Ce(n[0],{viewScaleInfo:o}),s=Ce(n[1],{viewScaleInfo:o}),r=Ce(n[2],{viewScaleInfo:o}),l=Ce(n[3],{viewScaleInfo:o});return i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(s.x,s.y),i.lineTo(r.x,r.y),i.lineTo(l.x,l.y),i.lineTo(a.x,a.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function Io(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:a}=t;if(!(a&&(null==a?void 0:a.length)>0))return!1;const s=Ee(a),r=s[s.length-1];return!!r&&bo(e,{ctx:i,vertexes:r,viewScaleInfo:o,viewSizeInfo:n})}function Ao(e,t){var i,o,n;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:s,data:r,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:r,topRight:l,bottomLeft:f,bottomRight:v,rotate:w}=g,m=[t,i,o,n,r,l,f,v,w];for(let t=0;t<m.length;t++){const i=m[t];if(bo(e,{ctx:s,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=Te(o,{groupQueue:u});if(n&&bo(e,{ctx:s,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(r){const{index:t,element:i}=l.getPointElement(e,{data:r,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 Mo(e,t){const{x:i,y:o,w:n,h:a,angle:s=0}=e,{center:r,start:l,end:h,viewScaleInfo:c}=t,d=Ce(r,{viewScaleInfo:c}),f=Se(s),u=function(e,t,i){const o=ve(e,t),n=ve(e,i);return null!==n&&null!==o?o>3*Math.PI/2&&n<Math.PI/2?n+(2*Math.PI-o):n>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-n):n-o:0}(d,l,h);return{x:i,y:o,w:n,h:a,angle:f+u/Math.PI*180}}function Ro(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{viewScaleInfo:n,viewSizeInfo:a}=t;let s=null;for(let t=0;t<e.length;t++){const r=e[t];if(null==(i=null==r?void 0:r.operations)?void 0:i.invisible)continue;const l=We(r,{viewScaleInfo:n,viewSizeInfo:a});if(l.angle&&(l.angle>0||l.angle<0)){const e=ye(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))}}if(s){const e=Math.min(l.x,o.x),t=Math.min(l.y,o.y),i=Math.max(l.x+l.w,o.x+o.w),n=Math.max(l.y+l.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=l.x,o.y=l.y,o.w=l.w,o.h=l.h;s=l}return o}function zo(e){return{minX:e.topLeft.x,minY:e.topLeft.y,maxX:e.bottomRight.x,maxY:e.bottomRight.y,midX:e.center.x,midY:e.center.y}}const Po=(e,t)=>{if(0===e.length)throw null;if(1===e.length)return e[0];let i=0,o=e.length-1;for(;i<=o;){const n=Math.floor((i+o)/2);if(e[n]===t)return e[n];e[n]<t?i=n+1:o=n-1}return i>=e.length?e[o]:o<0?e[i]:Math.abs(e[o]-t)<=Math.abs(e[i]-t)?e[o]:e[i]},Eo=(e,t)=>Math.abs(e-t)<1e-5;const To="@middleware/text-edit",Wo="@middleware/text-change",Co={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"},Lo="@middleware/select",Oo="@middleware/select-clear",ko="SCROLL",jo=Symbol(`${ko}_xThumbRect`),Do=Symbol(`${ko}_yThumbRect`),Yo=Symbol(`${ko}_prevPoint`),Vo=Symbol(`${ko}_activePoint`),Bo=Symbol(`${ko}_activeThumbType`),Xo=16,Fo=.36,Go={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function No(e,t,i){const o=e,{x:n,y:a,w:s,h:r}=i;return o.beginPath(),o.rect(n,a,s,r),o.closePath(),!!o.isPointInPath(t.x,t.y)}function Ho(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:s,axis:r}=t;"X"===r?(o=o+n/4+0,n/=2):"Y"===r&&(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=Fo,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=s,e.fill(),e.globalAlpha=1,e.beginPath(),e.lineWidth=1,e.strokeStyle=s,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 Zo(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:a}=t,{activeThumbType:s,prevPoint:r,activePoint:l}=a,h=function(e,t){const{width:i,height:o}=t,{offsetTop:n,offsetBottom:a,offsetLeft:s,offsetRight:r}=e,l=2.5*Xo,h=Xo;let c=0,d=0;c=Math.max(l,i-2*h-(Math.abs(s)+Math.abs(r))),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;s>0?u=f:r>0?u=i-c-h:s<=0&&c>0&&(0!==s||0!==r)&&(u=f+(i-c)*Math.abs(s)/(Math.abs(s)+Math.abs(r)),u=Math.min(Math.max(0,u-f),i-c));const g=h;let v=g;n>0?v=g:a>0?v=o-d-h:n<=0&&d>0&&(0!==n||0!==a)&&(v=g+(o-d)*Math.abs(n)/(Math.abs(n)+Math.abs(a)),v=Math.min(Math.max(0,v-g),o-d));const w={x:u,y:o-h,w:c,h:h},m={x:i-h,y:v,w:h,h:d};return{lineSize:h,xSize:c,ySize:d,translateY:v,translateX:u,thumbColor:Go.thumbColor,scrollBarColor:Go.scrollBarColor,xThumbRect:w,yThumbRect:m}}(o,n);let c={...h.xThumbRect},d={...h.yThumbRect};return s&&r&&l&&("X"===s&&a.xThumbRect?(c={...a.xThumbRect},c.x=c.x+(l.x-r.x)):"Y"===s&&a.yThumbRect&&(d={...a.yThumbRect},d.y=d.y+(l.y-r.y))),Ho(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),Ho(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function Qo(e,t){const{snapshot:i}=t,o=he(i),n=le(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[Vo]||null,prevPoint:t[Yo]||null,activeThumbType:t[Bo]||null,xThumbRect:t[jo]||null,yThumbRect:t[Do]||null}}(i),{xThumbRect:s,yThumbRect:r}=Zo(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:s,yThumbRect:r}}const Uo="@middleware/scale",Jo=16,$o="#000000",Ko="#00000080",qo="monospace",_o="#AAAAAA20",en="#AAAAAA40";function tn(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=Xe(a/t,{decimalPlaces:0}),a=Math.max(10,Math.min(a,1e3));const s=10*a,r=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=Xe(f+l*a,{decimalPlaces:0}),t={num:e,position:Xe(u+l*h,{decimalPlaces:0}),showNum:e%s==0,isKeyNum:e%s==0,isSubKeyNum:e%r==0};n.push(t),l++}return n}const on="@middleware/show-ruler",nn=Symbol("DRAG_prevPoint");return w=new WeakMap,m=new WeakMap,p=new WeakMap,y=new WeakSet,x=function(){b(this,p).style.position="relative"},e.Core=class{constructor(e,t){I(this,y),I(this,w,void 0),I(this,m,void 0),I(this,p,void 0);const{devicePixelRatio:i=1,width:o,height:n,createCustomContext2D:a}=t;A(this,p,e);const s=document.createElement("canvas");A(this,m,s),M(this,y,x).call(this),e.appendChild(s);const r=function(e,t){const{width:i,height:o,devicePixelRatio:n,offscreen:a,createCustomContext2D:s}=t,r={width:i,height:o,devicePixelRatio:n},l=e.getContext("2d");if(s){const e=s(r),t=s(r),i=s(r),o=J(Object.assign({ctx:l},r)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}if(!0===a){const e=$(r),t=$(r),i=$(r),o=J(Object.assign({ctx:l},r)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}{const e=J(r),t=J(r),n=J(r),a=J(Object.assign({ctx:l},r)),s=()=>{a.clearRect(0,0,i,o),a.drawImage(n.canvas,0,0,i,o),a.drawImage(e.canvas,0,0,i,o),a.drawImage(t.canvas,0,0,i,o),n.clearRect(0,0,i,o),e.clearRect(0,0,i,o),t.clearRect(0,0,i,o)};return{underContext:n,viewContext:e,helperContext:t,boardContext:a,drawView:s}}}(s,{width:o,height:n,devicePixelRatio:i,offscreen:!0,createCustomContext2D:a}),l=new Gi({boardContent:r,container:e}),h=l.getSharer();h.setActiveViewSizeInfo({width:o,height:n,devicePixelRatio:i,contextWidth:o,contextHeight:n}),A(this,w,l),this.resize(h.getActiveViewSizeInfo());const c=l.getEventHub();new Hi(e,{eventHub:c})}isDestroyed(){return b(this,w).isDestroyed()}destroy(){b(this,w).destroy(),b(this,m).remove()}use(e){b(this,w).use(e)}disuse(e){b(this,w).disuse(e)}setData(e,t){be((null==e?void 0:e.elements)||[]),b(this,w).setData(e,t)}getData(){return b(this,w).getData()}scale(e){b(this,w).scale(e);b(this,w).getViewer().drawFrame()}resize(e){const t=b(this,w),i=t.getSharer().getActiveViewSizeInfo();t.resize({...i,...e})}clear(){b(this,w).clear()}on(e,t){b(this,w).getEventHub().on(e,t)}off(e,t){b(this,w).getEventHub().off(e,t)}trigger(e,t){b(this,w).getEventHub().trigger(e,t)}getViewInfo(){const e=b(this,w).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){b(this,w).getViewer().drawFrame()}setViewScale(e){b(this,w).updateViewScaleInfo(e)}getLoadItemMap(){return b(this,w).getRenderer().getLoadItemMap()}onBoardWatcherEvents(){b(this,w).onWatcherEvents()}offBoardWatcherEvents(){b(this,w).offWatcherEvents()}},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(nn,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(nn);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(nn,t)},pointEnd(){n=!1,i.setSharedStorage(nn,null),t.trigger("cursor",{type:"drag-default"})}}},e.MiddlewareRuler=e=>{const{boardContent:t,viewer:i,eventHub:o}=e,{helperContext:n,underContext:a}=t;let s=!0,r=!0;const l=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(s=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(r=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(on,l)},disuse(){o.off(on,l)},beforeDrawFrame:({snapshot:e})=>{if(!0===s){const t=le(e),i=he(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,Jo),e.lineTo(Jo,Jo),e.lineTo(Jo,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 tn({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<Jo||(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=$o,e.stroke(),o.isKeyNum&&(e.fillStyle=Ko,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:qo}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(n,{scaleList:o});const s=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:a}=i;return tn({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<Jo)&&(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=$o,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===n.showNum)){const t=o,i=n.position+o,a=`${n.num}`;de(e,-90,{x:t,y:i},(()=>{e.fillStyle=Ko,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:qo}),e.fillText(a,13.2,n.position+o)}))}}}(n,{scaleList:s}),!0===r&&function(e,t){const{xList:i,yList:o,viewSizeInfo:n}=t,{width:a,height:s}=n;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,s),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=en:e.strokeStyle=_o,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=en:e.strokeStyle=_o,e.lineWidth=1,e.closePath(),e.stroke()}}(a,{xList:o,yList:s,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:s}=i.getActiveViewScaleInfo();let r=s;if(n<0?r=1.1*s:n>0&&(r=.9*s),r<.05||r>50)return;const{moveX:l,moveY:h}=t.scale({scale:r,point:a});t.scroll({moveX:l,moveY:h}),t.drawFrame();const c=Xe(s);o.trigger(Uo,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(jo,null),o.setSharedStorage(Do,null);const a=()=>{o.setSharedStorage(Yo,null),o.setSharedStorage(Vo,null),o.setSharedStorage(Bo,null)};a();const s=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&No(e,t,n)?o="X":a&&No(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(jo),yThumbRect:o.getSharedStorage(Do)});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=s(t);if("X"===i||"Y"===i)return o.setSharedStorage(Bo,i),o.setSharedStorage(Yo,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Bo);if("X"===n||"Y"===n)return o.setSharedStorage(Vo,i),"X"===n?(e=>{const i=o.getSharedStorage(Yo);if(i){const{offsetLeft:n,offsetRight:a}=o.getActiveViewScaleInfo(),{width:s}=o.getActiveViewSizeInfo(),r=-(e.x-i.x)*(s+Math.abs(n)+Math.abs(a))/s;t.scroll({moveX:r}),t.drawFrame()}})(i):"Y"===n&&(e=>{const i=o.getSharedStorage(Yo);if(i){const{offsetTop:n,offsetBottom:a}=o.getActiveViewScaleInfo(),{height:s}=o.getActiveViewSizeInfo(),r=-(e.y-i.y)*(s+Math.abs(n)+Math.abs(a))/s;t.scroll({moveY:r}),t.drawFrame()}})(i),o.setSharedStorage(Yo,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Bo);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=Qo(n,{snapshot:e});o.setSharedStorage(jo,t),o.setSharedStorage(Do,i)}}},e.MiddlewareSelector=e=>{const{viewer:t,sharer:i,boardContent:o,calculator:n,eventHub:a}=e,{helperContext:s}=o;let r=null,l=null;i.setSharedStorage(Qi,null);const h=()=>i.getSharedStorage(_i),c=e=>{let t=i.getSharedStorage(ao);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=Ee(t);return i.setSharedStorage(ao,t),i.setSharedStorage(so,o),t.length>0},d=e=>{i.setSharedStorage(Ki,e);let t=null;e&&(t=Te(e,{groupQueue:i.getSharedStorage(ao)})),i.setSharedStorage(qi,t)},f=(e,t)=>{var o;if(i.setSharedStorage(_i,e),1===e.length){const t=Ve(e[0],{groupQueue:i.getSharedStorage(ao),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(to,t),i.setSharedStorage(io,Re(e[0].uuid,(null==(o=i.getActiveStorage("data"))?void 0:o.elements)||[]))}else i.setSharedStorage(to,null),i.setSharedStorage(io,[]);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(Lo,{uuids:e.map((e=>e.uuid))})},u=()=>({ctx:s,calculator:n,data:i.getActiveStorage("data"),selectedElements:h(),viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(ao),areaSize:null,selectedElementController:i.getSharedStorage(to),selectedElementPosition:i.getSharedStorage(io)}),g=()=>{i.setSharedStorage(Qi,null),i.setSharedStorage(Ui,null),i.setSharedStorage(Ji,null),i.setSharedStorage($i,null),i.setSharedStorage(ao,[]),i.setSharedStorage(so,[]),i.setSharedStorage(Ki,null),i.setSharedStorage(qi,null),i.setSharedStorage(_i,[]),i.setSharedStorage(eo,null),i.setSharedStorage(to,null),i.setSharedStorage(io,[]),i.setSharedStorage(oo,[]),i.setSharedStorage(no,[]),i.setSharedStorage(ro,null)};g();const v=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage(Qi),s=i.getActiveStorage("data");n=o&&Array.isArray(o)?function(e,t){const i=[];return e.forEach((e=>{const o=Me(e,t);o&&i.push(o)})),i}(o,(null==s?void 0:s.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let a=0;a<o.length;a++){const s=o[a];e.includes(s.uuid)?i.push(s):"group"===s.type&&t((null===(n=null==s?void 0:s.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==s?void 0:s.elements)||[]);let r=!1;if(a||1!==n.length?"select"===a&&1===n.length&&(r=!0):(i.setSharedStorage(Qi,"select"),r=!0),r){const e=function(e,t){const i=[];return function e(t,o){var n;let a=null;for(let s=0;s<o.length;s++){const r=o[s];if(r.uuid===t){a=r;break}if(!a&&"group"===r.type){i.push(r);const o=e(t,(null===(n=null==r?void 0:r.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==s?void 0:s.elements)||[]);i.setSharedStorage(ao,e),f(n),t.drawFrame()}},w=()=>{g(),t.drawFrame()};return{name:"@middleware/selector",use(){a.on(Lo,v),a.on(Oo,w)},disuse(){a.off(Lo,v),a.off(Oo,w)},hover:e=>{var o,r,c,f,g;const v=i.getSharedStorage(Ui),w=i.getSharedStorage(Qi),m=i.getSharedStorage(ao),p=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(!Io(e.point,{ctx:s,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(ao)}))return d(null),void t.drawFrame();const n=Ao(e.point,u());return p(n),v||["area","drag","drag-list"].includes(w)?(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(v||["area","drag","drag-list"].includes(w))return void d(null);if("drag"===w)return void d(null);const y=h(),x=i.getActiveViewScaleInfo(),S=i.getActiveViewSizeInfo(),b=Ao(e.point,{...u(),areaSize:Ro(y,{viewScaleInfo:x,viewSizeInfo:S,calculator:n})});return p(b),null===b.type||"over-element"===b.type&&"select"===i.getSharedStorage(Qi)&&1===b.elements.length&&b.elements[0].uuid===(null==(c=null==(r=h())?void 0:r[0])?void 0:c.uuid)||"over-element"===b.type&&null===i.getSharedStorage(Qi)&&1===b.elements.length&&b.elements[0].uuid===(null==(f=i.getSharedStorage(Ki))?void 0:f.uuid)?void 0:"over-element"===b.type&&1===(null==(g=null==b?void 0:b.elements)?void 0:g.length)?(d(b.elements[0]),void t.drawFrame()):i.getSharedStorage(Ki)?(d(null),void t.drawFrame()):void 0},pointStart:e=>{var o,a,l,c,v,w,m,p,y,x;r=e.point;const S=i.getSharedStorage(ao);if((null==S?void 0:S.length)>0){if(Io(e.point,{ctx:s,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:S})){const t=Ao(e.point,u());if(1===(null==(o=null==t?void 0:t.elements)?void 0:o.length)&&!0===(null==(l=null==(a=t.elements[0])?void 0:a.operations)?void 0:l.lock))return;d(null),"over-element"===t.type&&1===(null==(c=null==t?void 0:t.elements)?void 0:c.length)?(f([t.elements[0]],{triggerEvent:!0}),i.setSharedStorage(Qi,"drag")):(null==(v=t.type)?void 0:v.startsWith("resize-"))?(i.setSharedStorage(Ui,t.type),i.setSharedStorage(Qi,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const b=Ro(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),I=Ao(e.point,{...u(),areaSize:b,groupQueue:[]});1===(null==(w=null==I?void 0:I.elements)?void 0:w.length)&&!0===(null==(p=null==(m=I.elements[0])?void 0:m.operations)?void 0:p.lock)||(d(null),"list-area"===I.type?i.setSharedStorage(Qi,"drag-list"):"over-element"===I.type&&1===(null==(y=null==I?void 0:I.elements)?void 0:y.length)?(f([I.elements[0]],{triggerEvent:!0}),i.setSharedStorage(Qi,"drag")):(null==(x=I.type)?void 0:x.startsWith("resize-"))?(i.setSharedStorage(Ui,I.type),i.setSharedStorage(Qi,"resize")):(g(),i.setSharedStorage(Qi,"area"),i.setSharedStorage(Ji,e.point),f([],{triggerEvent:!0})),t.drawFrame())},pointMove:e=>{var o,a,s;i.setSharedStorage(oo,[]),i.setSharedStorage(no,[]),i.setSharedStorage(ro,!0);const c=i.getActiveStorage("data"),d=h(),u=i.getActiveStorage("scale")||1,g=i.getActiveViewScaleInfo(),v=i.getActiveViewSizeInfo(),w=r,m=e.point,p=i.getSharedStorage(Ui),y=i.getSharedStorage(Qi),x=i.getSharedStorage(ao);if("drag"===y){if(l="drag",c&&1===(null==d?void 0:d.length)&&w&&m&&!0!==(null==(a=null==(o=d[0])?void 0:o.operations)?void 0:a.lock)){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:s=0}=e;a.push({x:t,y:i,w:o,h:n,angle:0-s})})),(null==i?void 0:i.length)>0){const i=me(e,a),s=me(t,a);o=s.x-i.x,n=s.y-i.y}return{moveX:o,moveY:n}}(w,m,x);let o=n.toGridNum(e/u),a=n.toGridNum(t/u);const s=function(e,t){var i,o;const{data:n,groupQueue:a,calculator:s,viewScaleInfo:r,viewSizeInfo:l}=t;let h=n.elements||[];(null==a?void 0:a.length)>0&&(h=(null==(o=null==(i=a[a.length-1])?void 0:i.detail)?void 0:o.children)||[]);const c=[];h.forEach((t=>{if(t.uuid!==e){const e=s.calcViewRectInfoFromRange(t.uuid,{checkVisible:!0,viewScaleInfo:r,viewSizeInfo:l});e&&c.push(e)}}));const d=s.calcViewRectInfoFromRange(e,{viewScaleInfo:r,viewSizeInfo:l});if(!d)return null;const f={},u={},g=[],v=[];let w=[],m=[];const p=zo(d);c.forEach((e=>{const t=zo(e);f[t.minX]||(f[t.minX]=[]),f[t.midX]||(f[t.midX]=[]),f[t.maxX]||(f[t.maxX]=[]),u[t.minY]||(u[t.minY]=[]),u[t.midY]||(u[t.midY]=[]),u[t.maxY]||(u[t.maxY]=[]),f[t.minX]=[t.minY,t.midY,t.maxY],f[t.midX]=[t.minY,t.midY,t.maxY],f[t.maxX]=[t.minY,t.midY,t.maxY],w.push(t.minX),w.push(t.midX),w.push(t.maxX),u[t.minY]=[t.minX,t.midX,t.maxX],u[t.midY]=[t.minX,t.midX,t.maxX],u[t.maxY]=[t.minX,t.midX,t.maxX],m.push(t.minY),m.push(t.midY),m.push(t.maxY)})),w=w.sort(((e,t)=>e-t)),m=m.sort(((e,t)=>e-t));let y=null,x=null,S=null,b=null,I=null,A=null,M=null,R=null;if(w.length>0){S=Po(w,p.minX),b=Po(w,p.midX),I=Po(w,p.maxX);const e=Math.abs(S-p.minX),t=Math.abs(b-p.midX),i=Math.abs(I-p.maxX),o=Math.min(e,t,i);o<=2/r.scale&&(Eo(o,e)?y=S-p.minX:Eo(o,t)?y=b-p.midX:Eo(o,i)&&(y=I-p.maxX))}if(m.length>0){A=Po(m,p.minY),M=Po(m,p.midY),R=Po(m,p.maxY);const e=Math.abs(A-p.minY),t=Math.abs(M-p.midY),i=Math.abs(R-p.maxY),o=Math.min(e,t,i);o<=2/r.scale&&(Eo(o,e)?x=A-p.minY:Eo(o,t)?x=M-p.midY:Eo(o,i)&&(x=R-p.maxY))}const z={...p};if(null!==y&&(z.minX+=y,z.midX+=y,z.maxX+=y),null!==x&&(z.minY+=x,z.midY+=x,z.maxY+=x),G.x(y)&&null!==y&&null!==S&&null!==b&&null!==I){if(Eo(y,S-p.minX)){const e={x:S,yList:[]};e.yList.push(z.minY),e.yList.push(z.midY),e.yList.push(z.maxY),e.yList.push(...(null==u?void 0:u[S])||[]),g.push(e)}if(Eo(y,b-p.minX)){const e={x:b,yList:[]};e.yList.push(z.minY),e.yList.push(z.midY),e.yList.push(z.maxY),e.yList.push(...(null==u?void 0:u[b])||[]),g.push(e)}if(Eo(y,I-p.minX)){const e={x:I,yList:[]};e.yList.push(z.minY),e.yList.push(z.midY),e.yList.push(z.maxY),e.yList.push(...(null==u?void 0:u[I])||[]),g.push(e)}}if(G.y(x)&&null!==x&&null!==A&&null!==M&&null!==R){if(Eo(x,A-p.minY)){const e={y:A,xList:[]};e.xList.push(z.minX),e.xList.push(z.midX),e.xList.push(z.maxX),e.xList.push(...(null==f?void 0:f[A])||[]),v.push(e)}if(Eo(x,M-p.midY)){const e={y:M,xList:[]};e.xList.push(z.minX),e.xList.push(z.midX),e.xList.push(z.maxX),e.xList.push(...(null==f?void 0:f[A])||[]),v.push(e)}if(Eo(x,R-p.maxY)){const e={y:R,xList:[]};e.xList.push(z.minX),e.xList.push(z.midX),e.xList.push(z.maxX),e.xList.push(...(null==f?void 0:f[R])||[]),v.push(e)}}const P=[];(null==g?void 0:g.length)>0&&g.forEach(((e,t)=>{P.push([]),e.yList.forEach((i=>{P[t].push({x:e.x,y:i})}))}));const E=[];return(null==v?void 0:v.length)>0&&v.forEach(((e,t)=>{E.push([]),e.xList.forEach((i=>{E[t].push({x:i,y:e.y})}))})),{offsetX:y,offsetY:x,yLines:P,xLines:E}}(d[0].uuid,{calculator:n,data:c,groupQueue:x,viewScaleInfo:g,viewSizeInfo:v});try{s&&(G.x(s.offsetX)&&null!==s.offsetX&&(o=n.toGridNum(o+s.offsetX)),G.y(s.offsetY)&&null!==s.offsetY&&(a=n.toGridNum(a+s.offsetY)),i.setSharedStorage(oo,s.xLines),i.setSharedStorage(no,s.yLines))}catch(e){console.error(e)}d[0].x=n.toGridNum(d[0].x+o),d[0].y=n.toGridNum(d[0].y+a),f([d[0]]),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:d[0],position:i.getSharedStorage(io)||[]}},viewSizeInfo:v,viewScaleInfo:g})}t.drawFrame()}else if("drag-list"===y){if(l="drag-list",c&&w&&m&&(null==d?void 0:d.length)>1){const e=(m.x-w.x)/u,t=(m.y-w.y)/u;d.forEach((o=>{var a;o&&!0!==(null==(a=null==o?void 0:o.operations)?void 0:a.lock)&&(o.x=n.toGridNum(o.x+e),o.y=n.toGridNum(o.y+t),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:o,position:i.getSharedStorage(io)||[]}},viewSizeInfo:v,viewScaleInfo:g}))})),i.setActiveStorage("data",c)}t.drawFrame()}else if("resize"===y){if(c&&1===(null==d?void 0:d.length)&&w&&(null==p?void 0:p.startsWith("resize-"))){l="resize";const e=[];x.forEach((t=>{const{x:i,y:o,w:n,h:a,angle:s=0}=t;e.push({x:i,y:o,w:n,h:a,angle:0-s})}));let o=w,a=m;if(x.length>0&&(o=me(w,e),a=me(m,e)),"resize-rotate"===p){const e=i.getSharedStorage(to),t=ge([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),o=Mo(d[0],{center:t,viewScaleInfo:g,viewSizeInfo:v,start:w,end:m,resizeType:p,sharer:i});d[0].angle=o.angle}else{const e=function(e,t){var i,o,n,a,s,r,l,h,c;let{x:d,y:f,w:u,h:g,angle:v=0}=e;const w=ue({x:d,y:f,w:u,h:g,angle:v});v=Se(v);const m=ce(v),p=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:y,end:x,resizeType:S,scale:b}=t;let I={...y},A={...x},M={x:I.x,y:w.y},R={x:A.x,y:w.y},z={...M},P={...R},E={x:w.x,y:I.y},T={x:w.x,y:A.y},W={...E},C={...T},L=(P.x-z.x)/b,O=(P.y-z.y)/b,k=xo(L,O),j=(C.x-W.x)/b,D=(C.y-W.y)/b,Y=xo(j,D);(v>0||v<0)&&(I=we(w,y,0-m),A=we(w,x,0-m),M={x:I.x,y:w.y},R={x:A.x,y:w.y},z=we(w,M,m),P=we(w,R,m),E={x:w.x,y:I.y},T={x:w.x,y:A.y},W=we(w,E,m),C=we(w,T,m),L=(P.x-z.x)/b,O=(P.y-z.y)/b,k=xo(L,O),k=So(k,O),j=(C.x-W.x)/b,D=(C.y-W.y)/b,Y=xo(j,D),Y=So(Y,D));let V=(x.x-y.x)/b,B=(x.y-y.y)/b;if(!0===p)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(V),Math.abs(B));V=(V>=0?1:-1)*t,B=(B>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(j),Math.abs(D));j=(j>=0?1:-1)*i,D=(D>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(L),Math.abs(O));L=(L>=0?1:-1)*o,O=(O>=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(V);V=(V>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?B=V>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(B=V>0?-i:i)}k=Math.abs(k),Y=k/e.w*e.h}switch(S){case"resize-top":if(0===v)g-B>0&&(f+=B,g-=B,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=B/e.h*e.w/2,u-=B/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){Y=0-So(Y,D);const e=yo(v),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){Y=So(Y,j);const e=yo(v-90),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){Y=So(Y,D);const e=yo(v-180),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){Y=0-So(Y,j);const e=yo(v-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===v)e.h+B>0&&(g+=B,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(d-=B/e.h*e.w/2,u+=B/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){Y=So(Y,D);const e=yo(v),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){Y=0-So(Y,j);const e=yo(v-90),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){Y=So(Y,j);const e=yo(v-180),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){Y=So(Y,j);const e=yo(v-270),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+Y>0&&(!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(u+=Y/e.h*e.w),g+=Y,d=t-u/2,f=i-g/2)}break;case"resize-left":if(0===v)e.w-V>0&&(d+=V,u-=V,!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(g-=V/e.w*e.h,f+=V/e.w*e.h/2));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){k=0-So(k,L);const e=yo(v),o=k/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){k=So(k,L);const e=yo(v-90),o=k/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){k=So(k,O);const e=yo(v-180),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){k=So(k,O);const e=yo(v-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===v)e.w+V>0&&(u+=V,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(f-=V*e.h/e.w/2,g+=V*e.h/e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){k=So(k,O);const e=yo(v),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){k=So(k,B);const e=yo(v-90),o=k/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){k=So(k,B);const e=yo(v-180),o=k/2;t+=o*Math.cos(e),i+=o*Math.sin(e),k=0-k}else if(v<360){k=So(k,V);const e=yo(v-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===v)u-V>0&&(d+=V,u-=V),g-B>0&&(f+=B,g-=B);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){Y=0-So(Y,D),k=0-So(k,p?0-Y:L);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(v<180){Y=So(Y,j),k=So(k,p?Y:L);const i=yo(v-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(v<270){Y=So(Y,D),k=So(k,p?Y:O);const i=yo(v-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(v<360){Y=0-So(Y,j),k=So(k,p?Y:O);const i=yo(v-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===v)u+V>0&&(u+=V),g-B>0&&(f+=B,g-=B);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){Y=0-So(Y,D),k=So(k,p?Y:O);const i=yo(v),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(v<180){Y=So(Y,j),k=So(k,p?Y:O);const i=yo(v-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(v<270){const i=yo(v-180);Y=So(Y,D),k=So(k,p?Y:0-L);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(v<360){Y=0-So(Y,j),k=So(k,p?Y:L);const i=yo(v-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===v)e.h+B>0&&(g+=B),e.w-V>0&&(d+=V,u-=V);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){Y=So(Y,D),k=0-So(k,p?0-Y:L);const i=yo(v),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(v<180){Y=0-So(Y,j),k=So(k,p?Y:L);const i=yo(v-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(v<270){Y=So(Y,j),k=So(k,p?Y:O);const i=yo(v-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(v<360){Y=So(Y,j),k=So(k,p?Y:O);const i=yo(v-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===v)e.h+B>0&&(g+=B),e.w+V>0&&(u+=V);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){Y=So(Y,D),k=So(k,p?Y:O);const i=yo(v),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(v<180){Y=0-So(Y,j),k=So(k,p?Y:B);const i=yo(v-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(v<270){Y=So(Y,j),k=So(k,p?Y:0-O);const i=yo(v-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(v<360){Y=So(Y,j),k=So(k,p?Y:L);const i=yo(v-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}}(d[0],{scale:u,start:o,end:a,resizeType:p,sharer:i});d[0].x=n.toGridNum(e.x),d[0].y=n.toGridNum(e.y),"group"===d[0].type&&!0===(null==(s=d[0].operations)?void 0:s.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 s=Math.min(n,a),r=Math.max(n,a);e.w=i,e.h=o;const l={xRatio:n,yRatio:a,minRatio:s,maxRatio:r};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ze(e,l)})),He(e,l)}(d[0],{w:n.toGridNum(e.w),h:n.toGridNum(e.h)}):(d[0].w=n.toGridNum(e.w),d[0].h=n.toGridNum(e.h))}f([d[0]]),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:d[0],position:i.getSharedStorage(io)||[]}},viewSizeInfo:v,viewScaleInfo:g}),t.drawFrame()}}else"area"===y&&(l="area",i.setSharedStorage($i,e.point),t.drawFrame());r=e.point},pointEnd(e){l=null,i.setSharedStorage(oo,[]),i.setSharedStorage(no,[]),i.setSharedStorage(ro,!1);const o=i.getActiveStorage("data"),s=i.getSharedStorage(Ui),h=i.getSharedStorage(Qi),c=i.getActiveViewSizeInfo();let d=!1;if(r=null,"resize"===h&&s)i.setSharedStorage(Ui,null),d=!0;else if("area"===h){if(i.setSharedStorage(Qi,null),o){const e=i.getSharedStorage(Ji),t=i.getSharedStorage($i);if(e&&t){const{elements:a}=function(e,t){var i;const o=[],n=[],a=[],{viewScaleInfo:s,viewSizeInfo:r,start:l,end:h}=t;if(!(Array.isArray(e.elements)&&l&&h))return{indexes:o,uuids:n,elements:a};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);for(let t=0;t<e.elements.length;t++){const l=e.elements[t];if(!0===(null==(i=null==l?void 0:l.operations)?void 0:i.lock))continue;const h=We(l,{viewScaleInfo:s,viewSizeInfo:r}),g=ue(h);if(g.x>=c&&g.x<=d&&g.y>=f&&g.y<=u&&(o.push(t),n.push(l.uuid),a.push(l),h.angle&&(h.angle>0||h.angle<0))){const e=ye(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))}}}return{indexes:o,uuids:n,elements:a}}(o,{start:e,end:t,calculator:n,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()});a.length>0&&(i.setSharedStorage(Qi,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage(Qi,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage(Qi,"select"),d=!0):i.setSharedStorage(Qi,null)}null===i.getSharedStorage(Qi)&&(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=Ie(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="dragElement";a.trigger("change",{data:o,type:e})}t.drawFrame()}})()},pointLeave(){r=null,g(),t.drawFrame()},doubleClick(e){var o,n,s,r,l,h;const d=Ao(e.point,u());if(i.setSharedStorage(to,null),i.setSharedStorage(_i,[]),1!==d.elements.length||!0!==(null==(n=null==(o=d.elements[0])?void 0:o.operations)?void 0:n.lock)){if(1===d.elements.length&&"group"===(null==(s=d.elements[0])?void 0:s.type)){if(!0===c(d.elements[0]))return i.setSharedStorage(Qi,null),void t.drawFrame()}else 1===d.elements.length&&"text"===(null==(r=d.elements[0])?void 0:r.type)&&a.trigger(To,{element:d.elements[0],groupQueue:i.getSharedStorage(ao)||[],position:Re(null==(l=d.elements[0])?void 0:l.uuid,(null==(h=i.getActiveStorage("data"))?void 0:h.elements)||[]),viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Qi,null)}},beforeDrawFrame({snapshot:t}){var i;const{activeStore:o,sharedStore:a}=t,{scale:r,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f,width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m}=o,p=e.sharer,y={scale:r,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f},x={width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m},S=a[_i][0],b=a[Ki],I=a[qi],A=a[Qi],M=a[Ji],R=a[$i],z=a[ao],P=a[so],E=a[ro],T={calculator:n,viewScaleInfo:y,viewSizeInfo:x},W=S?Ve(S,{groupQueue:z,controllerSize:10,viewScaleInfo:y}):null,C=!!(null==(i=null==b?void 0:b.operations)?void 0:i.lock);if((null==z?void 0:z.length)>0){if(function(e,t,i){for(let o=0;o<t.length;o++){const n=t[o],a={borderColor:lo,borderWidth:2,background:"transparent",lineDash:[4,4]};co(e,Le(n,i),a)}}(s,P,T),b&&"drag"!==A&&(C?wo(s,I,{...T,controller:Ve(b,{groupQueue:z,controllerSize:10,viewScaleInfo:y})}):vo(s,I,T)),!C&&S&&["select","drag","resize"].includes(A)&&(mo(s,W,{...T,element:S,calculator:n,hideControllers:!!E&&"drag"===A}),"drag"===A)){const e=p.getSharedStorage(oo),t=p.getSharedStorage(no);po(s,{xLines:e,yLines:t})}}else if(b&&"drag"!==A&&(C?wo(s,I,{...T,controller:Ve(b,{groupQueue:z,controllerSize:10,viewScaleInfo:y})}):vo(s,I,T)),!C&&S&&["select","drag","resize"].includes(A)){if(mo(s,W,{...T,element:S,calculator:n,hideControllers:!!E&&"drag"===A}),"drag"===A){const e=p.getSharedStorage(oo),t=p.getSharedStorage(no);po(s,{xLines:e,yLines:t})}}else if("area"===A&&M&&R)!function(e,t){const{start:i,end:o}=t;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=lo,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()}(s,{start:M,end:R});else if(["drag-list","drag-list-end"].includes(A)){const e=Ro(h(),{viewScaleInfo:p.getActiveViewScaleInfo(),viewSizeInfo:p.getActiveViewSizeInfo(),calculator:n});e&&function(e,t){const{areaSize:i}=t,{x:o,y:n,w:a,h:s}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=lo,e.fillStyle="#1976d21c",e.beginPath(),e.moveTo(o,n),e.lineTo(o+a,n),e.lineTo(o+a,n+s),e.lineTo(o,n+s),e.closePath(),e.stroke(),e.fill()}(s,{areaSize:e})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o}=e,n=i.boardContext.canvas,a=document.createElement("div");a.setAttribute("contenteditable","true");const s=document.createElement("div"),r=e.container||document.body,l=document.createElement("div");let h=null,c=[];s.appendChild(a),s.style.position="absolute",l.appendChild(s),l.style.position="fixed",l.style.top="0",l.style.bottom="0",l.style.left="0",l.style.right="0",l.style.display="none",r.appendChild(l);const d=()=>{l.style.display="none",h=null,c=[]},f=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:a,w:s,h:r}=t,l=Se(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${a}px`,o.style.width=`${s}px`,o.style.height=`${r}px`,o.style.transform=`rotate(${l}deg)`,i.appendChild(o),o},u=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:r,offsetLeft:l}=t;s.children&&Array.from(s.children).forEach((e=>{e.remove()}));let h=s;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:a,w:s,h:c}=t,d={x:i*n,y:a*n,w:s*n,h:c*n,angle:Se(t.angle||0)};0===e&&(d.x+=l,d.y+=r),h=f({size:d,parent:h})}const c={...Co,...i.detail};let d=i.x*n+l,u=i.y*n+r,g=i.w*n,v=i.h*n;o.length>0&&(d=i.x*n,u=i.y*n,g=i.w*n,v=i.h*n);let w="center",m="center";"left"===c.textAlign?w="start":"right"===c.textAlign&&(w="end"),"top"===c.verticalAlign?m="start":"bottom"===c.verticalAlign&&(m="end"),a.style.display="inline-flex",a.style.justifyContent=w,a.style.alignItems=m,a.style.position="absolute",a.style.left=d-1+"px",a.style.top=u-1+"px",a.style.width=`${g+2}px`,a.style.height=`${v+2}px`,a.style.transform=`rotate(${Se(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.style.padding="0",a.style.margin="0",a.style.outline="none",a.innerText=c.text||"",h.appendChild(a)},g=()=>{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}})();s.style.position="absolute",s.style.overflow="hidden",s.style.top=`${t}px`,s.style.left=`${e}px`,s.style.width=`${i}px`,s.style.height=`${o}px`};l.addEventListener("click",(()=>{d()})),a.addEventListener("click",(e=>{e.stopPropagation()})),a.addEventListener("input",(()=>{h&&c&&(h.detail.text=a.innerText||"",t.trigger(Wo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c||[]]}),o.drawFrame())})),a.addEventListener("blur",(()=>{h&&c&&t.trigger(Wo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c]}),d()})),a.addEventListener("keydown",(e=>{e.stopPropagation()})),a.addEventListener("keypress",(e=>{e.stopPropagation()})),a.addEventListener("keyup",(e=>{e.stopPropagation()})),a.addEventListener("wheel",(e=>{e.stopPropagation(),e.preventDefault()}));const v=e=>{var t;(null==e?void 0:e.position)&&(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(h=e.element,c=e.position),(e=>{g(),u(e),l.style.display="block"})(e)};return{name:"@middleware/text-editor",use(){t.on(To,v)},disuse(){t.off(To,v)}}},e.middlewareEventRuler=on,e.middlewareEventScale=Uo,e.middlewareEventSelect=Lo,e.middlewareEventSelectClear=Oo,e.middlewareEventTextChange=Wo,e.middlewareEventTextEdit=To,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|