@idraw/core 0.4.0-beta.17 → 0.4.0-beta.18
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 +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/middleware/info/draw-info.d.ts +31 -0
- package/dist/esm/middleware/info/draw-info.js +110 -0
- package/dist/esm/middleware/info/index.d.ts +3 -0
- package/dist/esm/middleware/info/index.js +110 -0
- package/dist/esm/middleware/info/types.d.ts +3 -0
- package/dist/esm/middleware/info/types.js +1 -0
- package/dist/esm/middleware/ruler/index.d.ts +2 -1
- package/dist/esm/middleware/ruler/index.js +3 -2
- package/dist/esm/middleware/ruler/types.d.ts +3 -0
- package/dist/esm/middleware/ruler/types.js +1 -0
- package/dist/esm/middleware/ruler/util.d.ts +6 -1
- package/dist/esm/middleware/ruler/util.js +55 -1
- package/dist/esm/middleware/scroller/index.d.ts +2 -1
- package/dist/esm/middleware/scroller/types.d.ts +9 -0
- package/dist/esm/middleware/scroller/types.js +1 -0
- package/dist/esm/middleware/scroller/util.js +1 -1
- package/dist/esm/middleware/selector/index.d.ts +3 -0
- package/dist/esm/middleware/selector/index.js +10 -8
- package/dist/index.global.js +340 -66
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
package/dist/index.global.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudH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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/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDktMTdUMTY6MDc6MjYrMDg6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIzLTA5LTE3VDE2OjEyOjUwKzA4OjAwIiB4bXA6TWV0YWRhdGF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0ckEgGYj9v0xIA71rkha7jUgBYCb5hHGRoaIj8/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="}),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}({});
|
|
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 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 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 k=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:O}=window;function j(e){return new Promise(((t,i)=>{const o=new O;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function D(e){return k(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 k(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 F(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function X(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 X(e)||F(e)},imageURL:F,imageBase64:X,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 Te(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 Ee(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Te([...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 ke(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 Oe(e,t){const{groupQueue:i}=t,o=Ee(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=Ee(e,{groupQueue:i}),g=Ee({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}),T=Ye(x,{size:a,angle:f}),E=Ye(b,{size:a,angle:f}),W=Ye(S,{size:a,angle:f}),C=Pe(z),L=Pe(T),k=Pe(E),O=Pe(W),j=[C[1],L[0],L[3],C[2]],D=[L[3],L[2],O[1],O[0]],Y=[k[1],O[0],O[3],k[2]],V=[C[3],C[2],k[1],k[0]],B=Pe(I),F=Pe(A),X=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:k,center:b},bottomRight:{type:"bottom-right",vertexes:O,center:S},leftMiddle:{type:"left-middle",vertexes:G,center:p},rightMiddle:{type:"right-middle",vertexes:F,center:w},topMiddle:{type:"top-middle",vertexes:B,center:v},bottomMiddle:{type:"bottom-middle",vertexes:X,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 Fe(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 Xe={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=Xe.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=>Fe(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,Ke(e,t,{pattern:o,viewScaleInfo:r,viewSizeInfo:l}),null==n||n(),qe(e,t,{viewScaleInfo:r,viewSizeInfo:l}),e.globalAlpha=h}})}function Ke(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)}}function qe(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;if(Array.isArray(s)&&(u=(s[0]||0)*n,g=(s[1]||0)*n,v=(s[2]||0)*n,w=(s[3]||0)*n),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([])}function _e(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 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"};function tt(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},(()=>{_e(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},(()=>{_e(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({},et),t.detail),n=(i.fontSize||et.fontSize)*o.scale,a=i.lineHeight?i.lineHeight*o.scale:n;e.fillStyle=t.detail.color||et.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},(()=>{_e(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:()=>{_e(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,_e(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.needRender(r)))try{tt(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 it={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 ot(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({},it),null==s?void 0:s.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.needRender(r)))try{tt(e,r,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(e){console.error(e)}}}var nt,at,st,rt,lt,ht,ct,dt,ft,ut,gt,vt,wt=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())}))},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)},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};const yt=["image","svg","html"],xt=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(`${P()}-${e.uuid}-${P()}-${P()}`)};class St extends _{constructor(){super(),nt.add(this),at.set(this,{}),st.set(this,{}),rt.set(this,{}),lt.set(this,!1),mt(this,nt,"m",ht).call(this,"image",((e,t)=>wt(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}})))),mt(this,nt,"m",ht).call(this,"html",((e,t)=>wt(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}})))),mt(this,nt,"m",ht).call(this,"svg",((e,t)=>wt(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 mt(this,lt,"f")}destroy(){pt(this,lt,!0,"f"),this.clear(),pt(this,at,null,"f"),pt(this,st,null,"f"),pt(this,rt,null,"f")}load(e,t){!0!==mt(this,lt,"f")&&(mt(this,nt,"m",vt).call(this,e)||yt.includes(e.type)&&mt(this,nt,"m",gt).call(this,e,t))}getContent(e){var t,i;const o=xt(e);return(null===(i=null===(t=mt(this,rt,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return mt(this,rt,"f")}setLoadItemMap(e){pt(this,rt,e,"f")}}at=new WeakMap,st=new WeakMap,rt=new WeakMap,lt=new WeakMap,nt=new WeakSet,ht=function(e,t){mt(this,at,"f")[e]=t},ct=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},dt=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:mt(this,nt,"m",ct).call(this,e)}},ft=function(e){const t=xt(e.element),i=mt(this,rt,"f")[t];mt(this,lt,"f")||(i?i.startTime<e.startTime&&(mt(this,rt,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(mt(this,rt,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},ut=function(e){var t;const i=xt(e.element),o=null===(t=mt(this,rt,"f"))||void 0===t?void 0:t[i];mt(this,lt,"f")||(o?o.startTime<e.startTime&&(mt(this,rt,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(mt(this,rt,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},gt=function(e,t){const i=mt(this,nt,"m",dt).call(this,e),o=xt(e);if(mt(this,st,"f")[o])return;mt(this,st,"f")[o]=i;const n=mt(this,at,"f")[e.type];"function"!=typeof n||mt(this,lt,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{mt(this,lt,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",mt(this,nt,"m",ft).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,mt(this,nt,"m",ut).call(this,i)})))},vt=function(e){var t;const i=xt(e),o=null===(t=mt(this,st,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==mt(this,nt,"m",ct).call(this,e))};var bt,It,At,Mt,Rt,zt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Pt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Tt extends _{constructor(e){super(),bt.add(this),It.set(this,void 0),At.set(this,new St),Mt.set(this,!1),zt(this,It,e,"f"),Pt(this,bt,"m",Rt).call(this)}isDestroyed(){return Pt(this,Mt,"f")}destroy(){this.clear(),zt(this,It,null,"f"),Pt(this,At,"f").destroy(),zt(this,At,null,"f"),zt(this,Mt,!0,"f")}updateOptions(e){zt(this,It,e,"f")}drawData(e,t){const i=Pt(this,At,"f"),{calculator:o}=Pt(this,It,"f"),n=Pt(this,It,"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},s=Object.assign({loader:i,calculator:o,parentElementSize:a,elementAssets:e.assets,parentOpacity:1},t);e.layout?function(e,t,i,o){const{viewScaleInfo:n,viewSizeInfo:a,parentOpacity:s}=i,r=Object.assign({uuid:"layout",type:"group",x:0,y:0},t),{x:l,y:h,w:c,h:d}=We(r,{viewScaleInfo:n,viewSizeInfo:a})||r,f=Object.assign(Object.assign({},r),{x:l,y:h,w:c,h:d,angle:0});if(e.globalAlpha=1,_e(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ke(e,f,{viewScaleInfo:n,viewSizeInfo:a})}}),"hidden"===t.detail.overflow){const{viewScaleInfo:o,viewSizeInfo:n}=i,a=Object.assign({uuid:"layout",type:"group",x:0,y:0},t),s=We(a,{viewScaleInfo:o,viewSizeInfo:n})||a,r=Object.assign(Object.assign({},a),s),{x:l,y:h,w:c,h:d,radiusList:f}=Ge(r,{viewScaleInfo:o,viewSizeInfo:n});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(l+f[0],h),e.arcTo(l+c,h,l+c,h+d,f[1]),e.arcTo(l+c,h+d,l,h+d,f[2]),e.arcTo(l,h+d,l,h,f[3]),e.arcTo(l,h,l+c,h,f[0]),e.closePath(),e.fill(),e.clip()}o(e),"hidden"===t.detail.overflow&&e.restore(),qe(e,f,{viewScaleInfo:n,viewSizeInfo:a}),e.globalAlpha=s}(n,e.layout,s,(()=>{ot(n,e,s)})):ot(n,e,s)}scale(e){const{sharer:t}=Pt(this,It,"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){Pt(this,At,"f").setLoadItemMap(e)}getLoadItemMap(){return Pt(this,At,"f").getLoadItemMap()}getLoader(){return Pt(this,At,"f")}}It=new WeakMap,At=new WeakMap,Mt=new WeakMap,bt=new WeakSet,Rt=function(){const e=Pt(this,At,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(e=>{console.error(e)}))};var Et,Wt,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},Lt=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 kt{constructor(e){Et.set(this,void 0),Wt.set(this,void 0),Ct(this,Et,e,"f"),Ct(this,Wt,new re({defaultStorage:{viewVisibleInfoMap:{},visibleCount:0,invisibleCount:0}}),"f")}toGridNum(e,t){return!0===(null==t?void 0:t.ignore)?e:Math.round(e)}destroy(){Ct(this,Et,null,"f")}needRender(e){const t=Lt(this,Wt,"f").get("viewVisibleInfoMap")[e.uuid];return!t||t.isVisibleInView}isPointInElement(e,t,i,o){return ke(e,{context2d:Lt(this,Et,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=Lt(this,Et,"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(ke(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)&&ke(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=Oe(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);Lt(this,Wt,"f").set("viewVisibleInfoMap",i),Lt(this,Wt,"f").set("invisibleCount",o),Lt(this,Wt,"f").set("visibleCount",n)}}updateVisiableStatus(e){const{viewVisibleInfoMap:t,invisibleCount:i,visibleCount:o}=De(Lt(this,Wt,"f").get("viewVisibleInfoMap"),e);Lt(this,Wt,"f").set("viewVisibleInfoMap",t),Lt(this,Wt,"f").set("invisibleCount",i),Lt(this,Wt,"f").set("visibleCount",o)}calcViewRectInfoFromOrigin(e,t){const i=Lt(this,Wt,"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=Lt(this,Wt,"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=Lt(this,Wt,"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=Oe(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});Lt(this,Wt,"f").set("viewVisibleInfoMap",l)}}Et=new WeakMap,Wt=new WeakMap;var Ot,jt,Dt,Yt,Vt,Bt,Ft,Xt,Gt,Nt,Ht,Zt,Qt,Ut,Jt,$t,Kt=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},qt=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 ei extends _{constructor(e){super(),Ot.add(this),jt.set(this,void 0),Dt.set(this,void 0),Yt.set(this,!1),Bt.set(this,(e=>{if(!qt(this,Ot,"m",Ut).call(this,e))return;const t=qt(this,Ot,"m",Jt).call(this,e);if(!qt(this,Ot,"m",$t).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})})),Ft.set(this,(e=>{if(!qt(this,Ot,"m",Ut).call(this,e))return;e.preventDefault();const t=qt(this,Ot,"m",Jt).call(this,e);qt(this,Ot,"m",$t).call(this,t)})),Xt.set(this,(e=>{if(!qt(this,Ot,"m",Ut).call(this,e))return;e.preventDefault();const t=qt(this,Ot,"m",Jt).call(this,e);if(!qt(this,Ot,"m",$t).call(this,t))return;const i=Date.now(),o=qt(this,Dt,"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}):qt(this,Dt,"f").set("prevClickPoint",t)})),Gt.set(this,(e=>{if(qt(this,Dt,"f").set("hasPointDown",!1),!qt(this,Ot,"m",Ut).call(this,e))return;e.preventDefault();const t=qt(this,Ot,"m",Jt).call(this,e);this.trigger("pointLeave",{point:t})})),Nt.set(this,(e=>{if(qt(this,Dt,"f").set("hasPointDown",!1),!qt(this,Ot,"m",Ut).call(this,e))return;e.preventDefault();const t=qt(this,Ot,"m",Jt).call(this,e);this.trigger("pointEnd",{point:t})})),Ht.set(this,(e=>{if(!qt(this,Ot,"m",Ut).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=qt(this,Ot,"m",Jt).call(this,e);qt(this,Ot,"m",$t).call(this,t)?!0===qt(this,Dt,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):qt(this,Dt,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),qt(this,Dt,"f").set("hasPointDown",!1))})),Zt.set(this,(e=>{if(!qt(this,Ot,"m",Ut).call(this,e))return;e.preventDefault();const t=qt(this,Ot,"m",Jt).call(this,e);qt(this,Ot,"m",$t).call(this,t)&&(qt(this,Dt,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),Qt.set(this,(e=>{if(!qt(this,Ot,"m",Ut).call(this,e))return;e.preventDefault();const t=qt(this,Ot,"m",Jt).call(this,e);qt(this,Ot,"m",$t).call(this,t)&&this.trigger("hover",{point:t})}));const t=new re({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});Kt(this,Dt,t,"f"),Kt(this,jt,e,"f"),qt(this,Ot,"m",Vt).call(this)}onEvents(){if(qt(this,Yt,"f"))return;const e=window;e.addEventListener("mousemove",qt(this,Qt,"f")),e.addEventListener("mousedown",qt(this,Zt,"f")),e.addEventListener("mousemove",qt(this,Ht,"f")),e.addEventListener("mouseup",qt(this,Nt,"f")),e.addEventListener("mouseleave",qt(this,Gt,"f")),e.addEventListener("wheel",qt(this,Bt,"f"),{passive:!1}),e.addEventListener("click",qt(this,Xt,"f")),e.addEventListener("contextmenu",qt(this,Ft,"f"))}offEvents(){const e=window;e.removeEventListener("mousemove",qt(this,Qt,"f")),e.removeEventListener("mousedown",qt(this,Zt,"f")),e.removeEventListener("mousemove",qt(this,Ht,"f")),e.removeEventListener("mouseup",qt(this,Nt,"f")),e.removeEventListener("mouseleave",qt(this,Gt,"f")),e.removeEventListener("wheel",qt(this,Bt,"f")),e.removeEventListener("click",qt(this,Xt,"f")),e.removeEventListener("contextmenu",qt(this,Ft,"f"))}destroy(){this.offEvents(),qt(this,Dt,"f").destroy(),Kt(this,Yt,!0,"f")}}jt=new WeakMap,Dt=new WeakMap,Yt=new WeakMap,Bt=new WeakMap,Ft=new WeakMap,Xt=new WeakMap,Gt=new WeakMap,Nt=new WeakMap,Ht=new WeakMap,Zt=new WeakMap,Qt=new WeakMap,Ot=new WeakSet,Vt=function(){this.onEvents()},Ut=function(e){return e.target===qt(this,jt,"f").boardContent.boardContext.canvas},Jt=function(e){const t=qt(this,jt,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},$t=function(e){const t=qt(this,jt,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!(_t(e.x)&&_t(e.y)&&e.x<=i&&e.y<=o)};var ti,ii,oi=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},ni=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 ai={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class si{constructor(){ti.set(this,void 0),ii.set(this,void 0);const e=new re({defaultStorage:ai}),t=new re({defaultStorage:{}});oi(this,ti,e,"f"),oi(this,ii,t,"f")}getActiveStorage(e){return ni(this,ti,"f").get(e)}setActiveStorage(e,t){return ni(this,ti,"f").set(e,t)}getActiveStoreSnapshot(e){return ni(this,ti,"f").getSnapshot(e)}getSharedStorage(e){return ni(this,ii,"f").get(e)}setSharedStorage(e,t){return ni(this,ii,"f").set(e,t)}getSharedStoreSnapshot(e){return ni(this,ii,"f").getSnapshot(e)}getActiveViewScaleInfo(){return{scale:ni(this,ti,"f").get("scale"),offsetTop:ni(this,ti,"f").get("offsetTop"),offsetBottom:ni(this,ti,"f").get("offsetBottom"),offsetLeft:ni(this,ti,"f").get("offsetLeft"),offsetRight:ni(this,ti,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;ni(this,ti,"f").set("scale",t),ni(this,ti,"f").set("offsetTop",i),ni(this,ti,"f").set("offsetBottom",o),ni(this,ti,"f").set("offsetLeft",n),ni(this,ti,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){ni(this,ti,"f").set("width",e.width),ni(this,ti,"f").set("height",e.height),ni(this,ti,"f").set("devicePixelRatio",e.devicePixelRatio),ni(this,ti,"f").set("contextWidth",e.contextWidth),ni(this,ti,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:ni(this,ti,"f").get("width"),height:ni(this,ti,"f").get("height"),devicePixelRatio:ni(this,ti,"f").get("devicePixelRatio"),contextWidth:ni(this,ti,"f").get("contextWidth"),contextHeight:ni(this,ti,"f").get("contextHeight")}}}ti=new WeakMap,ii=new WeakMap;var ri,li,hi,ci,di,fi,ui=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},gi=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const{requestAnimationFrame:vi}=window;class wi extends _{constructor(e){super(),ri.add(this),li.set(this,void 0),hi.set(this,[]),ci.set(this,"FREE"),ui(this,li,e,"f"),gi(this,ri,"m",di).call(this)}resetViewVisibleInfoMap(e,t){e&&gi(this,li,"f").calculator.resetViewVisibleInfoMap(e,t)}drawFrame(){const{sharer:e}=gi(this,li,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();gi(this,hi,"f").push({activeStore:t,sharedStore:i}),gi(this,ri,"m",fi).call(this)}scale(e){const{scale:t,point:i,ignoreUpdateVisibleStatus:o}=e,{sharer:n}=gi(this,li,"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||gi(this,li,"f").calculator.updateVisiableStatus({viewScaleInfo:n.getActiveViewScaleInfo(),viewSizeInfo:n.getActiveViewSizeInfo()}),{moveX:a,moveY:s}}scroll(e){const{sharer:t}=gi(this,li,"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||gi(this,li,"f").calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),s}updateViewScaleInfo(e){const{sharer:t}=gi(this,li,"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),gi(this,li,"f").calculator.updateVisiableStatus({viewScaleInfo:t.getActiveViewScaleInfo(),viewSizeInfo:t.getActiveViewSizeInfo()}),i}resize(e={},t){const{sharer:i}=gi(this,li,"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}=gi(this,li,"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)||gi(this,li,"f").calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),n}}li=new WeakMap,hi=new WeakMap,ci=new WeakMap,ri=new WeakSet,di=function(){const{renderer:e}=gi(this,li,"f");e.on("load",(()=>{this.drawFrame()}))},fi=function e(){if("DRAWING"===gi(this,ci,"f")||0===gi(this,hi,"f").length)return;ui(this,ci,"DRAWING","f");const t=gi(this,hi,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=gi(this,li,"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!==gi(this,hi,"f").length?ui(this,ci,"DRAWING","f")&&vi((()=>{gi(this,ri,"m",e).call(this)})):ui(this,ci,"COMPLETE","f")};var mi,pi,yi,xi,Si,bi,Ii,Ai,Mi,Ri,zi,Pi,Ti,Ei,Wi,Ci,Li,ki,Oi,ji,Di,Yi,Vi,Bi,Fi,Xi,Gi,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},Hi=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 Zi{constructor(e){mi.add(this),pi.set(this,void 0),yi.set(this,new WeakMap),xi.set(this,[]),Si.set(this,[]),bi.set(this,void 0),Ii.set(this,void 0),Ai.set(this,void 0),Mi.set(this,void 0),Ri.set(this,void 0),zi.set(this,new _),Pi.set(this,!1);const{boardContent:t}=e,i=new si,o=new kt({viewContext:t.viewContext}),n=new ei({boardContent:t,sharer:i}),a=new Tt({viewContext:t.viewContext,sharer:i,calculator:o});Ni(this,pi,e,"f"),Ni(this,Ai,i,"f"),Ni(this,bi,n,"f"),Ni(this,Ii,a,"f"),Ni(this,Ri,o,"f"),Ni(this,Mi,new wi({boardContent:e.boardContent,sharer:i,renderer:a,calculator:Hi(this,Ri,"f"),beforeDrawFrame:e=>{Hi(this,mi,"m",Fi).call(this,e)},afterDrawFrame:e=>{Hi(this,mi,"m",Xi).call(this,e)}}),"f"),Hi(this,mi,"m",Ti).call(this),Hi(this,mi,"m",Gi).call(this)}isDestroyed(){return Hi(this,Pi,"f")}destroy(){Hi(this,bi,"f").destroy(),Hi(this,Ii,"f").destroy(),Hi(this,Ri,"f").destroy(),Hi(this,zi,"f").destroy(),Ni(this,Pi,!0,"f")}getSharer(){return Hi(this,Ai,"f")}getViewer(){return Hi(this,Mi,"f")}getRenderer(){return Hi(this,Ii,"f")}setData(e,t){const{modifiedOptions:i}=t||{},o=Hi(this,Ai,"f");Hi(this,Ai,"f").setActiveStorage("data",e);const n=o.getActiveViewSizeInfo(),a=o.getActiveViewScaleInfo(),s=Ie(e.elements,{viewWidth:n.width,viewHeight:n.height,extend:!0});Hi(this,Mi,"f").resetViewVisibleInfoMap(e,{viewSizeInfo:n,viewScaleInfo:a}),Hi(this,Mi,"f").drawFrame();const r=Object.assign(Object.assign({},n),s);return Hi(this,Ai,"f").setActiveViewSizeInfo(r),{viewSizeInfo:r}}getData(){const{data:e}=Hi(this,Ai,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(Hi(this,yi,"f").has(e)){const o=Hi(this,yi,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",Hi(this,yi,"f").set(e,o),void Hi(this,mi,"m",Gi).call(this)}const{boardContent:n,container:a}=Hi(this,pi,"f"),s=e({boardContent:n,sharer:Hi(this,Ai,"f"),viewer:Hi(this,Mi,"f"),calculator:Hi(this,Ri,"f"),eventHub:Hi(this,zi,"f"),container:a});null===(o=s.use)||void 0===o||o.call(s),Hi(this,xi,"f").push(e),Hi(this,Si,"f").push(s),Hi(this,yi,"f").set(e,{status:"enable",middlewareObject:s}),Hi(this,mi,"m",Gi).call(this)}disuse(e){var t,i;const o=Hi(this,yi,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",Hi(this,yi,"f").set(e,o),Hi(this,mi,"m",Gi).call(this))}scale(e){const t=Hi(this,Mi,"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 Hi(this,Mi,"f").scroll(e)}updateViewScaleInfo(e){return Hi(this,Mi,"f").updateViewScaleInfo(e)}resize(e,t){const i=Hi(this,Mi,"f").resize(e,t),{width:o,height:n,devicePixelRatio:a}=e,{boardContent:s}=Hi(this,pi,"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}),Hi(this,Mi,"f").drawFrame(),Hi(this,bi,"f").trigger("resize",i),Hi(this,Ai,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=Hi(this,pi,"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),Hi(this,mi,"m",Bi).call(this)}getEventHub(){return Hi(this,zi,"f")}onWatcherEvents(){Hi(this,bi,"f").onEvents()}offWatcherEvents(){Hi(this,bi,"f").offEvents()}}pi=new WeakMap,yi=new WeakMap,xi=new WeakMap,Si=new WeakMap,bi=new WeakMap,Ii=new WeakMap,Ai=new WeakMap,Mi=new WeakMap,Ri=new WeakMap,zi=new WeakMap,Pi=new WeakMap,mi=new WeakSet,Ti=function(){Hi(this,bi,"f").on("pointStart",Hi(this,mi,"m",Ei).bind(this)),Hi(this,bi,"f").on("pointEnd",Hi(this,mi,"m",Wi).bind(this)),Hi(this,bi,"f").on("pointMove",Hi(this,mi,"m",Ci).bind(this)),Hi(this,bi,"f").on("hover",Hi(this,mi,"m",Li).bind(this)),Hi(this,bi,"f").on("wheel",Hi(this,mi,"m",Oi).bind(this)),Hi(this,bi,"f").on("wheelScale",Hi(this,mi,"m",ji).bind(this)),Hi(this,bi,"f").on("scrollX",Hi(this,mi,"m",Di).bind(this)),Hi(this,bi,"f").on("scrollY",Hi(this,mi,"m",Yi).bind(this)),Hi(this,bi,"f").on("resize",Hi(this,mi,"m",Vi).bind(this)),Hi(this,bi,"f").on("doubleClick",Hi(this,mi,"m",ki).bind(this)),Hi(this,Ii,"f").on("load",(()=>{Hi(this,zi,"f").trigger("loadResource")}))},Ei=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},Wi=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},Ci=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointMove)||void 0===t?void 0:t.call(o,e)))return}},Li=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},ki=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},Oi=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},ji=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheelScale)||void 0===t?void 0:t.call(o,e)))return}},Di=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},Yi=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},Vi=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},Bi=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.clear)||void 0===t?void 0:t.call(o,e)))return}},Fi=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Xi=function(e){var t;for(let i=0;i<Hi(this,Si,"f").length;i++){const o=Hi(this,Si,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Gi=function(){const e=[],t=Hi(this,yi,"f");Hi(this,xi,"f").forEach((i=>{const o=t.get(i);"enable"===(null==o?void 0:o.status)&&(null==o?void 0:o.middlewareObject)&&e.push(o.middleware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C2BnTDo+/TWt8Bd5INeVC44NDT0xXYZdXNz8w/AaeyS8yjwCPdzQu92ht2m/OUjIyOfS1pkAoqItLS0fA+8D7wKPA0cxs6qC1O4T0xMfKYnb21tnXEDNjc3z+nXbW1t3wFvYz9dCAL7KUThHovFPtGTNjU1jQFSX18/lg68cuXKLUAaGxs3vkB7e/u3wHHgCQpUdnpTqdQvesJgMDisUVevXh3Xry9fvnxTv66qqprQ/cfHx/vVNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";class Ui{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/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRhe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r172rVrlyorK6cFFo1GtXnzZl25ciU4Ch5J+qOkH0v6tqTXzDk5EwGGlNFjOWQOd8px4vUN4E3cpn2pz/jgwQPef/99Ll68yJ07d+jt7WVwcJBIJEJJSQlz586loaGBTZs2UVdXF5w0OoDLwFWcbPsct6r04+bRLHEYCoWyAD1kBDfHleHmsxrccccS3NFHNV/eenBy6iZwCycMOnHz5wBuDh2nyyY6H0zhFmoF7vtxk+l9q3ieQfrDo8msF7cy3cN56g7ZWnKcep7IxnrQmz+wHKu2K3EKJWbPpWSUTQ4ZtRJc23sC6ZGB9ZM52JwcboIQjzUvZvNxYfeHlyVkZFcBbux6wKA6ShjoM5yM8uH0Xpuy8ekAQuZc2W8P8nEei9p9mMmPgAfJHO0O27e0lHppw9MEDJo//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(Qi).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 Ji="SELECT",$i=Symbol(`${Ji}_actionType`),Ki=Symbol(`${Ji}_resizeType`),qi=Symbol(`${Ji}_areaStart`),_i=Symbol(`${Ji}_areaEnd`),eo=Symbol(`${Ji}_hoverElement`),to=Symbol(`${Ji}_hoverElementVertexes`),io=Symbol(`${Ji}_selectedElementList`),oo=Symbol(`${Ji}_selectedElementListVertexes`),no=Symbol(`${Ji}_selectedElementController`),ao=Symbol(`${Ji}_selectedElementPosition`),so=Symbol(`${Ji}_selectedReferenceXLines`),ro=Symbol(`${Ji}_selectedReferenceYLines`),lo=Symbol(`${Ji}_groupQueue`),ho=Symbol(`${Ji}_groupQueueVertexesList`),co=Symbol(`${Ji}_isMoving`),fo="#1973ba",uo="#5b5959b5";function go(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 vo(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 wo(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 mo(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;wo(e,[{x:r,y:h},{x:l,y:h},{x:l,y:c},{x:r,y:c}],{borderColor:n,borderWidth:a,lineDash:s})}function po(e,t,i){if(!t)return;const o={borderColor:fo,borderWidth:1,background:"transparent",lineDash:[]};go(e,Le(t,i),o)}function yo(e,t,i){if(!t)return;const o={borderColor:uo,borderWidth:1,background:"transparent",lineDash:[]};go(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:uo};wo(e,Le(l.vertexes,i),f),wo(e,Le(h.vertexes,i),f),wo(e,Le(c.vertexes,i),f),wo(e,Le(d.vertexes,i),f),wo(e,Le(t.vertexes,i),f),wo(e,Le(a.vertexes,i),f),wo(e,Le(s.vertexes,i),f),wo(e,Le(r.vertexes,i),f)}}function xo(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:fo,borderWidth:2,background:"transparent",lineDash:[]},f={...d,borderWidth:4,background:"#FFFFFF"};go(e,Le(n,i),d),o||(vo(e,Ce(h.center,i),Ce(c.center,i),{...f,borderWidth:2}),go(e,Le(a.vertexes,i),f),go(e,Le(s.vertexes,i),f),go(e,Le(r.vertexes,i),f),go(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 So(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)=>{mo(e,i,a),t[o+1]&&vo(e,t[o],t[o+1],n)}))})),o&&o.forEach((t=>{t.forEach(((i,o)=>{mo(e,i,a),t[o+1]&&vo(e,t[o],t[o+1],n)}))}))}function bo(e){return e*Math.PI/180}function Io(e,t){return Math.sqrt(e*e+t*t)}function Ao(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function Mo(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 Ro(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=Te(a),r=s[s.length-1];return!!r&&Mo(e,{ctx:i,vertexes:r,viewScaleInfo:o,viewSizeInfo:n})}function zo(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(Mo(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=Ee(o,{groupQueue:u});if(n&&Mo(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 Po(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 To(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 Eo(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 Wo=(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]},Co=(e,t)=>Math.abs(e-t)<1e-5;const Lo="@middleware/text-edit",ko="@middleware/text-change",Oo={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"},jo="@middleware/select",Do="@middleware/select-clear",Yo="SCROLL",Vo=Symbol(`${Yo}_xThumbRect`),Bo=Symbol(`${Yo}_yThumbRect`),Fo=Symbol(`${Yo}_prevPoint`),Xo=Symbol(`${Yo}_activePoint`),Go=Symbol(`${Yo}_activeThumbType`),No=16,Ho=.3,Zo={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function Qo(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 Uo(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=Ho,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 Jo(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*No,h=No;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:Zo.thumbColor,scrollBarColor:Zo.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))),Uo(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),Uo(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function $o(e,t){const{snapshot:i}=t,o=he(i),n=le(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[Xo]||null,prevPoint:t[Fo]||null,activeThumbType:t[Go]||null,xThumbRect:t[Vo]||null,yThumbRect:t[Bo]||null}}(i),{xThumbRect:s,yThumbRect:r}=Jo(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:s,yThumbRect:r}}const Ko="@middleware/scale",qo=16,_o="#000000",en="#00000080",tn="monospace",on="#AAAAAA20",nn="#AAAAAA40",an="#196097";function sn(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=Fe(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=Fe(f+l*a,{decimalPlaces:0}),t={num:e,position:Fe(u+l*h,{decimalPlaces:0}),showNum:e%s==0,isKeyNum:e%s==0,isSubKeyNum:e%r==0};n.push(t),l++}return n}const rn="@middleware/show-ruler",ln=Symbol("DRAG_prevPoint"),hn="monospace";const cn="#1973bac6",dn="#ffffff",fn=10;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 Zi({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 Ui(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(ln,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(ln);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(ln,t)},pointEnd(){n=!1,i.setSharedStorage(ln,null),t.trigger("cursor",{type:"drag-default"})}}},e.MiddlewareInfo=e=>{const{boardContent:t,calculator:i}=e,{helperContext:o}=t;return{name:"@middleware/info",beforeDrawFrame({snapshot:e}){const{sharedStore:t}=e,n=t[io],a=t[$i],s=t[lo]||[];if(1===n.length){const t=n[0];if(t&&["select","drag","resize"].includes(a)){const n=le(e),a=he(e),{x:r,y:l,w:h,h:c,angle:d}=t,f=[...s,{uuid:P(),x:r,y:l,w:h,h:c,angle:d,type:"group",detail:{children:[]}}],u={viewScaleInfo:n,viewSizeInfo:a},g=i.calcViewRectInfoFromOrigin(t.uuid,u);let v=0;f.forEach((e=>{v+=e.angle||0}));const w=ce(Se(0-v));if(g){const e=null==g?void 0:g.center,i={topLeft:we(e,g.topLeft,w),topRight:we(e,g.topRight,w),bottomRight:we(e,g.bottomRight,w),bottomLeft:we(e,g.bottomLeft,w),center:we(e,g.center,w),top:we(e,g.top,w),right:we(e,g.right,w),bottom:we(e,g.bottom,w),left:we(e,g.left,w)},n=Fe(t.x,{decimalPlaces:2}),a=Fe(t.y,{decimalPlaces:2}),s=Fe(t.w,{decimalPlaces:2}),r=Fe(t.h,{decimalPlaces:2}),l=`${Fe(n,{decimalPlaces:0})},${Fe(a,{decimalPlaces:0})}`,h=`${Fe(s,{decimalPlaces:0})}x${Fe(r,{decimalPlaces:0})}`,c=`${Fe(t.angle||0,{decimalPlaces:0})}°`;!function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:s,background:r,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:hn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x-o/2-t,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x-o/2,y:i.y};e.setLineDash([]),e.fillStyle=r,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=s,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.bottom.x,y:i.bottom.y+fn},rotateCenter:i.center,angle:v,text:h,fontSize:fn,lineHeight:16,color:dn,background:cn}),function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:s,background:r,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:hn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=r,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=s,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.topLeft.x,y:i.topLeft.y-20},rotateCenter:i.center,angle:v,text:l,fontSize:fn,lineHeight:16,color:dn,background:cn}),function(e,t){const{point:i,rotateCenter:o,angle:n,text:a,color:s,background:r,fontSize:l,lineHeight:h}=t;de(e,n,o,(()=>{e.$setFont({fontWeight:"300",fontSize:l,fontFamily:hn});const t=(h-l)/2,o=e.$undoPixelRatio(e.measureText(a).width),n={x:i.x,y:i.y},c={x:n.x+o+2*t,y:n.y+l+t},d={x:i.x+t,y:i.y};e.setLineDash([]),e.fillStyle=r,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(c.x,n.y),e.lineTo(c.x,c.y),e.lineTo(n.x,c.y),e.closePath(),e.fill(),e.fillStyle=s,e.textBaseline="top",e.fillText(a,d.x,d.y+t)}))}(o,{point:{x:i.top.x+fn,y:i.top.y-20},rotateCenter:i.center,angle:v,text:c,fontSize:fn,lineHeight:16,color:dn,background:cn})}}}}}},e.MiddlewareRuler=e=>{const{boardContent:t,viewer:i,eventHub:o,calculator:n}=e,{helperContext:a,underContext:s}=t;let r=!0,l=!0;const h=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(r=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(l=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(rn,h)},disuse(){o.off(rn,h)},beforeDrawFrame:({snapshot:e})=>{if(!0===r){const t=le(e),i=he(e);!function(e,t){const{snapshot:i,calculator:o}=t,{sharedStore:n}=i,a=n[io],s=n[$i];if(["select","drag","drag-list","drag-list-end"].includes(s)&&a.length>0){const t=le(i),n=he(i),s=[],r=[],l=[],h=[],c=[];if(a.forEach((e=>{const i=o.calcViewRectInfoFromRange(e.uuid,{viewScaleInfo:t,viewSizeInfo:n});i&&(s.push(i),r.push(i.left.x),l.push(i.right.x),h.push(i.top.y),c.push(i.bottom.y))})),!(s.length>0))return;const d=Math.min(...r),f=Math.max(...l),u=Math.min(...h),g=Math.max(...c);e.globalAlpha=1,e.beginPath(),e.moveTo(d,0),e.lineTo(f,0),e.lineTo(f,qo),e.lineTo(d,qo),e.fillStyle=an,e.closePath(),e.fill(),e.beginPath(),e.moveTo(0,u),e.lineTo(qo,u),e.lineTo(qo,g),e.lineTo(0,g),e.fillStyle=an,e.closePath(),e.fill()}}(a,{snapshot:e,calculator:n}),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,qo),e.lineTo(qo,qo),e.lineTo(qo,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()}(a,{viewScaleInfo:t,viewSizeInfo:i});const o=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetLeft:n}=t,{width:a}=i;return sn({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<qo||(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=en,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:tn}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(a,{scaleList:o});const r=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:a}=i;return sn({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<qo)&&(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=en,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:tn}),e.fillText(a,13.2,n.position+o)}))}}}(a,{scaleList:r}),!0===l&&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=nn:e.strokeStyle=on,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=nn:e.strokeStyle=on,e.lineWidth=1,e.closePath(),e.stroke()}}(s,{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: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=Fe(s);o.trigger(Ko,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(Vo,null),o.setSharedStorage(Bo,null);const a=()=>{o.setSharedStorage(Fo,null),o.setSharedStorage(Xo,null),o.setSharedStorage(Go,null)};a();const s=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&Qo(e,t,n)?o="X":a&&Qo(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(Vo),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=s(t);if("X"===i||"Y"===i)return o.setSharedStorage(Go,i),o.setSharedStorage(Fo,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Go);if("X"===n||"Y"===n)return o.setSharedStorage(Xo,i),"X"===n?(e=>{const i=o.getSharedStorage(Fo);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(Fo);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(Fo,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Go);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=$o(n,{snapshot:e});o.setSharedStorage(Vo,t),o.setSharedStorage(Bo,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($i,null);const h=()=>i.getSharedStorage(io),c=e=>{let t=i.getSharedStorage(lo);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=Te(t);return i.setSharedStorage(lo,t),i.setSharedStorage(ho,o),t.length>0},d=e=>{i.setSharedStorage(eo,e);let t=null;e&&(t=Ee(e,{groupQueue:i.getSharedStorage(lo)})),i.setSharedStorage(to,t)},f=(e,t)=>{var o;if(i.setSharedStorage(io,e),1===e.length){const t=Ve(e[0],{groupQueue:i.getSharedStorage(lo),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(no,t),i.setSharedStorage(ao,Re(e[0].uuid,(null==(o=i.getActiveStorage("data"))?void 0:o.elements)||[]))}else i.setSharedStorage(no,null),i.setSharedStorage(ao,[]);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(jo,{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(lo),areaSize:null,selectedElementController:i.getSharedStorage(no),selectedElementPosition:i.getSharedStorage(ao)}),g=()=>{i.setSharedStorage($i,null),i.setSharedStorage(Ki,null),i.setSharedStorage(qi,null),i.setSharedStorage(_i,null),i.setSharedStorage(lo,[]),i.setSharedStorage(ho,[]),i.setSharedStorage(eo,null),i.setSharedStorage(to,null),i.setSharedStorage(io,[]),i.setSharedStorage(oo,null),i.setSharedStorage(no,null),i.setSharedStorage(ao,[]),i.setSharedStorage(so,[]),i.setSharedStorage(ro,[]),i.setSharedStorage(co,null)};g();const v=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage($i),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($i,"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(lo,e),f(n),t.drawFrame()}},w=()=>{g(),t.drawFrame()};return{name:"@middleware/selector",use(){a.on(jo,v),a.on(Do,w)},disuse(){a.off(jo,v),a.off(Do,w)},hover:e=>{var o,r,c,f,g;const v=i.getSharedStorage(Ki),w=i.getSharedStorage($i),m=i.getSharedStorage(lo),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(!Ro(e.point,{ctx:s,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage(lo)}))return d(null),void t.drawFrame();const n=zo(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=zo(e.point,{...u(),areaSize:To(y,{viewScaleInfo:x,viewSizeInfo:S,calculator:n})});return p(b),null===b.type||"over-element"===b.type&&"select"===i.getSharedStorage($i)&&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($i)&&1===b.elements.length&&b.elements[0].uuid===(null==(f=i.getSharedStorage(eo))?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(eo)?(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(lo);if((null==S?void 0:S.length)>0){if(Ro(e.point,{ctx:s,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:S})){const t=zo(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($i,"drag")):(null==(v=t.type)?void 0:v.startsWith("resize-"))?(i.setSharedStorage(Ki,t.type),i.setSharedStorage($i,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const b=To(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),I=zo(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($i,"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($i,"drag")):(null==(x=I.type)?void 0:x.startsWith("resize-"))?(i.setSharedStorage(Ki,I.type),i.setSharedStorage($i,"resize")):(g(),i.setSharedStorage($i,"area"),i.setSharedStorage(qi,e.point),f([],{triggerEvent:!0})),t.drawFrame())},pointMove:e=>{var o,a,s;i.setSharedStorage(so,[]),i.setSharedStorage(ro,[]),i.setSharedStorage(co,!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(Ki),y=i.getSharedStorage($i),x=i.getSharedStorage(lo);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=Eo(d);c.forEach((e=>{const t=Eo(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=Wo(w,p.minX),b=Wo(w,p.midX),I=Wo(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&&(Co(o,e)?y=S-p.minX:Co(o,t)?y=b-p.midX:Co(o,i)&&(y=I-p.maxX))}if(m.length>0){A=Wo(m,p.minY),M=Wo(m,p.midY),R=Wo(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&&(Co(o,e)?x=A-p.minY:Co(o,t)?x=M-p.midY:Co(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(Co(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(Co(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(Co(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(Co(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(Co(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(Co(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 T=[];return(null==v?void 0:v.length)>0&&v.forEach(((e,t)=>{T.push([]),e.xList.forEach((i=>{T[t].push({x:i,y:e.y})}))})),{offsetX:y,offsetY:x,yLines:P,xLines:T}}(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(so,s.xLines),i.setSharedStorage(ro,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(ao)||[]}},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((i=>{var o;i&&!0!==(null==(o=null==i?void 0:i.operations)?void 0:o.lock)&&(i.x=n.toGridNum(i.x+e),i.y=n.toGridNum(i.y+t),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:i,position:Re(i.uuid,c.elements)||[]}},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(no),t=ge([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),o=Po(d[0],{center:t,viewScaleInfo:g,viewSizeInfo:v,start:w,end:m,resizeType:p,sharer:i});d[0].angle=n.toGridNum(o.angle||0)}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},T={x:w.x,y:I.y},E={x:w.x,y:A.y},W={...T},C={...E},L=(P.x-z.x)/b,k=(P.y-z.y)/b,O=Io(L,k),j=(C.x-W.x)/b,D=(C.y-W.y)/b,Y=Io(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),T={x:w.x,y:I.y},E={x:w.x,y:A.y},W=we(w,T,m),C=we(w,E,m),L=(P.x-z.x)/b,k=(P.y-z.y)/b,O=Io(L,k),O=Ao(O,k),j=(C.x-W.x)/b,D=(C.y-W.y)/b,Y=Io(j,D),Y=Ao(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(k));L=(L>=0?1:-1)*o,k=(k>=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)}O=Math.abs(O),Y=O/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-Ao(Y,D);const e=bo(v),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){Y=Ao(Y,j);const e=bo(v-90),o=Y/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){Y=Ao(Y,D);const e=bo(v-180),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){Y=0-Ao(Y,j);const e=bo(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=Ao(Y,D);const e=bo(v),o=Y/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){Y=0-Ao(Y,j);const e=bo(v-90),o=Y/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){Y=Ao(Y,j);const e=bo(v-180),o=Y/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){Y=Ao(Y,j);const e=bo(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){O=0-Ao(O,L);const e=bo(v),o=O/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){O=Ao(O,L);const e=bo(v-90),o=O/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){O=Ao(O,k);const e=bo(v-180),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){O=Ao(O,k);const e=bo(v-270),o=O/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}u+O>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(g+=O/e.w*e.h),u+=O,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){O=Ao(O,k);const e=bo(v),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){O=Ao(O,B);const e=bo(v-90),o=O/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){O=Ao(O,B);const e=bo(v-180),o=O/2;t+=o*Math.cos(e),i+=o*Math.sin(e),O=0-O}else if(v<360){O=Ao(O,V);const e=bo(v-270),o=O/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}u+O>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=O/e.w*e.h),u+=O,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-Ao(Y,D),O=0-Ao(O,p?0-Y:L);const i=Y/2;e+=i*Math.sin(m),t-=i*Math.cos(m);const o=O/2;e-=o*Math.cos(m),t-=o*Math.sin(m)}else if(v<180){Y=Ao(Y,j),O=Ao(O,p?Y:L);const i=bo(v-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){Y=Ao(Y,D),O=Ao(O,p?Y:k);const i=bo(v-180),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){Y=0-Ao(Y,j),O=Ao(O,p?Y:k);const i=bo(v-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),u+O>0&&(u+=O),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-Ao(Y,D),O=Ao(O,p?Y:k);const i=bo(v),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){Y=Ao(Y,j),O=Ao(O,p?Y:k);const i=bo(v-90),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){const i=bo(v-180);Y=Ao(Y,D),O=Ao(O,p?Y:0-L);const o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){Y=0-Ao(Y,j),O=Ao(O,p?Y:L);const i=bo(v-270),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),u+O>0&&(u+=O),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=Ao(Y,D),O=0-Ao(O,p?0-Y:L);const i=bo(v),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<180){Y=0-Ao(Y,j),O=Ao(O,p?Y:L);const i=bo(v-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){Y=Ao(Y,j),O=Ao(O,p?Y:k);const i=bo(v-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){Y=Ao(Y,j),O=Ao(O,p?Y:k);const i=bo(v-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+Y>0&&(g+=Y),u+O>0&&(u+=O),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=Ao(Y,D),O=Ao(O,p?Y:k);const i=bo(v),o=Y/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=O/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){Y=0-Ao(Y,j),O=Ao(O,p?Y:B);const i=bo(v-90),o=Y/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=O/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){Y=Ao(Y,j),O=Ao(O,p?Y:0-k);const i=bo(v-180),o=Y/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=O/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){Y=Ao(Y,j),O=Ao(O,p?Y:L);const i=bo(v-270),o=Y/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=O/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+Y>0&&(g+=Y),u+O>0&&(u+=O),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}),t={ignore:!!d[0].angle};d[0].x=n.toGridNum(e.x,t),d[0].y=n.toGridNum(e.y,t),"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,t),h:n.toGridNum(e.h,t)}):(d[0].w=n.toGridNum(e.w,t),d[0].h=n.toGridNum(e.h,t))}f([d[0]]),n.modifyViewVisibleInfoMap(c,{modifyOptions:{type:"updateElement",content:{element:d[0],position:i.getSharedStorage(ao)||[]}},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(so,[]),i.setSharedStorage(ro,[]),i.setSharedStorage(co,!1);const o=i.getActiveStorage("data"),s=i.getSharedStorage(Ki),h=i.getSharedStorage($i),c=i.getActiveViewSizeInfo();let d=!1;if(r=null,"resize"===h&&s)i.setSharedStorage(Ki,null),d=!0;else if("area"===h){if(i.setSharedStorage($i,null),o){const e=i.getSharedStorage(qi),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($i,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage($i,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage($i,"select"),d=!0):i.setSharedStorage($i,null)}null===i.getSharedStorage($i)&&(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=zo(e.point,u());if(i.setSharedStorage(no,null),i.setSharedStorage(io,[]),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($i,null),void t.drawFrame()}else 1===d.elements.length&&"text"===(null==(r=d.elements[0])?void 0:r.type)&&a.trigger(Lo,{element:d.elements[0],groupQueue:i.getSharedStorage(lo)||[],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($i,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[io][0],b=a[eo],I=a[to],A=a[$i],M=a[qi],R=a[_i],z=a[lo],P=a[ho],T=a[co],E={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:fo,borderWidth:2,background:"transparent",lineDash:[4,4]};go(e,Le(n,i),a)}}(s,P,E),b&&"drag"!==A&&(C?yo(s,I,{...E,controller:Ve(b,{groupQueue:z,controllerSize:10,viewScaleInfo:y})}):po(s,I,E)),!C&&S&&["select","drag","resize"].includes(A)&&(xo(s,W,{...E,element:S,calculator:n,hideControllers:!!T&&"drag"===A}),"drag"===A)){const e=p.getSharedStorage(so),t=p.getSharedStorage(ro);So(s,{xLines:e,yLines:t})}}else if(b&&"drag"!==A&&(C?yo(s,I,{...E,controller:Ve(b,{groupQueue:z,controllerSize:10,viewScaleInfo:y})}):po(s,I,E)),!C&&S&&["select","drag","resize"].includes(A)){if(xo(s,W,{...E,element:S,calculator:n,hideControllers:!!T&&"drag"===A}),"drag"===A){const e=p.getSharedStorage(so),t=p.getSharedStorage(ro);So(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=fo,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=To(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=fo,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={...Oo,...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(ko,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c||[]]}),o.drawFrame())})),a.addEventListener("blur",(()=>{h&&c&&t.trigger(ko,{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(Lo,v)},disuse(){t.off(Lo,v)}}},e.middlewareEventRuler=rn,e.middlewareEventScale=Ko,e.middlewareEventSelect=jo,e.middlewareEventSelectClear=Do,e.middlewareEventTextChange=ko,e.middlewareEventTextEdit=Lo,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|