@idraw/core 0.4.0-beta.14 → 0.4.0-beta.16
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 +3 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/lib/cursor.d.ts +2 -2
- package/dist/esm/middleware/dragger/index.d.ts +2 -2
- package/dist/esm/middleware/ruler/index.d.ts +2 -2
- package/dist/esm/middleware/scaler/index.d.ts +2 -2
- package/dist/esm/middleware/selector/auxiliary.d.ts +5 -0
- package/dist/esm/middleware/selector/auxiliary.js +10 -0
- package/dist/esm/middleware/selector/config.d.ts +2 -0
- package/dist/esm/middleware/selector/config.js +2 -0
- package/dist/esm/middleware/selector/draw-auxiliary.d.ts +7 -0
- package/dist/esm/middleware/selector/draw-auxiliary.js +31 -0
- package/dist/esm/middleware/selector/draw-base.d.ts +30 -0
- package/dist/esm/middleware/selector/draw-base.js +100 -0
- package/dist/esm/middleware/selector/draw-wrapper.d.ts +3 -0
- package/dist/esm/middleware/selector/draw-wrapper.js +10 -77
- package/dist/esm/middleware/selector/index.d.ts +2 -2
- package/dist/esm/middleware/selector/index.js +10 -5
- package/dist/esm/middleware/selector/types.d.ts +2 -1
- package/dist/esm/middleware/selector/types.js +1 -1
- package/dist/esm/middleware/text-editor/index.d.ts +20 -2
- package/dist/esm/middleware/text-editor/index.js +61 -6
- package/dist/index.global.js +229 -127
- 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,r,s,l,h,c,d,f,u,g,v,w,m,y,p,x,S=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},b=(e,t,i)=>(S(e,t,"read from private field"),i?i.call(e):t.get(e)),A=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},I=(e,t,i,o)=>(S(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i),M=(e,t,i)=>(S(e,t,"access private method"),i);function z(e,t){let i=-1;return function(...o){i>=0||(i=setTimeout((()=>{e(...o),i=-1}),t))}}function P(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 R(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 T(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function W(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/${W(t.toString(16).padEnd(4,o))}${W(e.substring(i-4,i).padEnd(4,o)).padEnd(4,"f")}-${W(e.substring(i-8,i-4).padEnd(4,o)).padEnd(4,"f")}-${W(e.substring(i-12,i-8).padEnd(4,o)).padEnd(4,"f")}-${W(e.substring(i-16,i-12).padEnd(4,n)).padEnd(4,"f")}-${W(e.substring(i,i+4).padEnd(4,n)).padEnd(4,"f")}${W(e.substring(i+4,i+8).padEnd(4,n)).padEnd(4,"f")}${W(n.padEnd(4,o).padEnd(4,n))}`}function C(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 k(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const O={type(e,t){const i=k(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===k(e),json:e=>"Object"===k(e),function:e=>"Function"===k(e),asyncFunction:e=>"AsyncFunction"===k(e),boolean:e=>"Boolean"===k(e),string:e=>"String"===k(e),number:e=>"Number"===k(e),undefined:e=>"Undefined"===k(e),null:e=>"Null"===k(e),promise:e=>"Promise"===k(e)};var j=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))};const{Image:D}=window;function L(e){return new Promise(((t,i)=>{const o=new D;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function B(e){return j(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 L(t)}))}function Y(e,t){return j(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&");const i=yield function(e,t){const{width:i,height:o}=t;return new Promise(((t,n)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},r.onerror=function(e){n(e)}}))}(e,t);return yield L(i)}))}function F(e){return"number"==typeof e&&(e>0||e<=0)}function G(e){return"number"==typeof e&&e>=0}function V(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function N(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const H={x:function(e){return F(e)},y:function(e){return F(e)},w:G,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:F,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return G(e)},borderRadius:function(e){return F(e)&&e>=0},color:function(e){return P(e)},imageSrc:function(e){return N(e)||V(e)},imageURL:V,imageBase64:N,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let i=document.createElement("div");i.innerHTML=e,i.children.length>0&&(t=!0),i=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return F(e)&&e>0},lineHeight:function(e){return F(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return F(e)&&e>0}};var Z,X,Q=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},J=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){Z.set(this,void 0),X.set(this,void 0),Q(this,Z,e,"f"),Q(this,X,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f")}$undoPixelRatio(e){return e/J(this,X,"f").devicePixelRatio}$doPixelRatio(e){return J(this,X,"f").devicePixelRatio*e}$getContext(){return J(this,Z,"f")}$setContext(e){Q(this,Z,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"}`),J(this,Z,"f").font=`${t.join(" ")}`}$getOffscreenCanvas(){return J(this,X,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:a}=J(this,Z,"f");a.width=t*o,a.height=i*o,Q(this,X,Object.assign(Object.assign({},J(this,X,"f")),{devicePixelRatio:o}),"f"),!0===n&&(a.style.width=`${t}px`,a.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=J(this,X,"f"),{width:t,height:i}=J(this,Z,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return J(this,Z,"f").canvas}get fillStyle(){return J(this,Z,"f").fillStyle}set fillStyle(e){J(this,Z,"f").fillStyle=e}get strokeStyle(){return J(this,Z,"f").strokeStyle}set strokeStyle(e){J(this,Z,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(J(this,Z,"f").lineWidth)}set lineWidth(e){J(this,Z,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return J(this,Z,"f").textAlign}set textAlign(e){J(this,Z,"f").textAlign=e}get textBaseline(){return J(this,Z,"f").textBaseline}set textBaseline(e){J(this,Z,"f").textBaseline=e}get globalAlpha(){return J(this,Z,"f").globalAlpha}set globalAlpha(e){J(this,Z,"f").globalAlpha=e}get shadowColor(){return J(this,Z,"f").shadowColor}set shadowColor(e){J(this,Z,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(J(this,Z,"f").shadowOffsetX)}set shadowOffsetX(e){J(this,Z,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(J(this,Z,"f").shadowOffsetY)}set shadowOffsetY(e){J(this,Z,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(J(this,Z,"f").shadowBlur)}set shadowBlur(e){J(this,Z,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return J(this,Z,"f").lineCap}set lineCap(e){J(this,Z,"f").lineCap=e}get globalCompositeOperation(){return J(this,Z,"f").globalCompositeOperation}set globalCompositeOperation(e){J(this,Z,"f").globalCompositeOperation=e}fill(...e){return J(this,Z,"f").fill(...e)}arc(e,t,i,o,n,a){return J(this,Z,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,a)}rect(e,t,i,o){return J(this,Z,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return J(this,Z,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return J(this,Z,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return J(this,Z,"f").beginPath()}closePath(){return J(this,Z,"f").closePath()}lineTo(e,t){return J(this,Z,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return J(this,Z,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return J(this,Z,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}getLineDash(){return J(this,Z,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return J(this,Z,"f").setLineDash(t)}stroke(e){return e?J(this,Z,"f").stroke(e):J(this,Z,"f").stroke()}translate(e,t){return J(this,Z,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return J(this,Z,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],a=e[4],r=e[e.length-4],s=e[e.length-3],l=e[e.length-2],h=e[e.length-1];return 9===e.length?J(this,Z,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a),this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h)):J(this,Z,"f").drawImage(t,this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h))}createPattern(e,t){return J(this,Z,"f").createPattern(e,t)}measureText(e){return J(this,Z,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?J(this,Z,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):J(this,Z,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?J(this,Z,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):J(this,Z,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){J(this,Z,"f").save()}restore(){J(this,Z,"f").restore()}scale(e,t){J(this,Z,"f").scale(e,t)}circle(e,t,i,o,n,a,r,s){J(this,Z,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,a,r,s)}isPointInPath(e,t){return J(this,Z,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return J(this,Z,"f").clip(...e)}setTransform(e,t,i,o,n,a){return J(this,Z,"f").setTransform(e,t,i,o,n,a)}getTransform(){return J(this,Z,"f").getTransform()}createLinearGradient(e,t,i,o){return J(this,Z,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,a){return J(this,Z,"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 J(this,Z,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function $(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 K(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})}Z=new WeakMap,X=new WeakMap;var 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 ee{constructor(){q.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,q,new Map,"f")}on(e,t){if(_(this,q,"f").has(e)){const i=_(this,q,"f").get(e)||[];null==i||i.push(t),_(this,q,"f").set(e,i)}else _(this,q,"f").set(e,[t])}off(e,t){if(_(this,q,"f").has(e)){const i=_(this,q,"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}_(this,q,"f").set(e,i||[])}}trigger(e,t){const i=_(this,q,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(_(this,q,"f").has(e)){const t=_(this,q,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){_(this,q,"f").clear()}}function te(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}q=new WeakMap;var ie,oe,ne,ae,re=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 le{constructor(e){ie.add(this),oe.set(this,void 0),ne.set(this,void 0),re(this,ne,C(e.defaultStorage),"f"),re(this,oe,se(this,ie,"m",ae).call(this),"f")}set(e,t){se(this,oe,"f")[e]=t}get(e){return se(this,oe,"f")[e]}getSnapshot(){return C(se(this,oe,"f"))}clear(){re(this,oe,se(this,ie,"m",ae).call(this),"f")}destroy(){re(this,oe,null,"f")}}function he(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 ce(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 de(e){return e/180*Math.PI}function fe(e,t,i,o){const n=de(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 ue(e,t,i){const o=ge(t);fe(e,t.angle||0,o,(()=>{i(e)}))}function ge(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function ve(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 ge({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 we(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 me(e,t,i){let o=we(e,t)+i;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const n=function(e,t){const i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===i?i:Math.sqrt(i)}(e,t);let a=0,r=0;return 0===o?(a=0,r=0-n):o>0&&o<Math.PI/2?(a=Math.sin(o)*n,r=0-Math.cos(o)*n):o===Math.PI/2?(a=n,r=0):o>Math.PI/2&&o<Math.PI?(a=Math.sin(Math.PI-o)*n,r=Math.cos(Math.PI-o)*n):o===Math.PI?(a=0,r=n):o>Math.PI&&o<1.5*Math.PI?(a=0-Math.sin(o-Math.PI)*n,r=Math.cos(o-Math.PI)*n):o===1.5*Math.PI?(a=0-n,r=0):o>1.5*Math.PI&&o<2*Math.PI?(a=0-Math.sin(2*Math.PI-o)*n,r=0-Math.cos(2*Math.PI-o)*n):o===2*Math.PI&&(a=0,r=0-n),a+=e.x,r+=e.y,{x:a,y:r}}function ye(e,t){if((null==t?void 0:t.length)>0){let i=e.x,o=e.y;return t.forEach((e=>{const{x:t,y:n,w:a,h:r,angle:s=0}=e,l=me(ge({x:t,y:n,w:a,h:r,angle:s}),{x:i,y:o},de(s));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:r}=e;let s={x:o,y:n},l={x:o+a,y:n},h={x:o+a,y:n+r},c={x:o,y:n+r};if(i&&(i>0||i<0)){const e=de(be(i));s=me(t,s,e),l=me(t,l,e),h=me(t,h,e),c=me(t,c,e)}return[s,l,h,c]}function xe(e){const{angle:t=0}=e;return pe(e,ge(e),t)}function Se(e,t,i){return[me(e,{x:t[0].x,y:t[0].y},i),me(e,{x:t[1].x,y:t[1].y},i),me(e,{x:t[2].x,y:t[2].y},i),me(e,{x:t[3].x,y:t[3].y},i)]}function be(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function Ae(e){let t=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(t=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(t=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(t=Ae(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function 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=xe(t);if(4===e.length){const i=[e[0].x,e[1].x,e[2].x,e[3].x],o=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...i),t.y=Math.min(...o),t.w=Math.abs(Math.max(...i)-Math.min(...i)),t.h=Math.abs(Math.max(...o)-Math.min(...o))}}const o=Math.min(t.x,i.x),n=Math.min(t.y,i.y),a=Math.max(t.x+t.w,i.x+i.w),r=Math.max(t.y+t.h,i.y+i.h);i.x=o,i.y=n,i.w=Math.abs(a-o),i.h=Math.abs(r-n)})),(null==t?void 0:t.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const o={contextWidth:i.w,contextHeight:i.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>i.x+i.w&&(o.contextWidth=t.viewWidth-i.x),t.viewHeight>i.y+i.h&&(o.contextHeight=t.viewHeight-i.y)),o}function Me(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:a,h:r,angle:s}=e,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:o*l+c,y:n*l+h,w:a*l,h:r*l,angle:s}}function ze(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:a,offsetTop:r,offsetLeft:s}=i;return{x:o*a+s,y:n*a+r}}function Pe(e,t){return[ze(e[0],t),ze(e[1],t),ze(e[2],t),ze(e[3],t)]}function Re(e,t){const{context2d:i,element:o,viewScaleInfo:n,viewSizeInfo:a}=t,{angle:r=0}=o,{x:s,y:l,w:h,h:c}=Me(o,{viewScaleInfo:n,viewSizeInfo:a}),d=xe({x:s,y:l,w:h,h:c,angle:r});if(d.length>=2){i.beginPath(),i.moveTo(d[0].x,d[0].y);for(let e=1;e<d.length;e++)i.lineTo(d[e].x,d[e].y);i.closePath()}return!!i.isPointInPath(e.x,e.y)}function Te(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 We(e){const{x:t,y:i,w:o,h:n,angle:a=0}=e;return 0===a?Te(e):pe(e,ge({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:r,y:s,w:l,h:h,angle:c=0}=a[e];let d;if(i+=r,o+=s,0===e){const e={x:i,y:o,w:l,h:h,angle:c};d=We({x:r,y:s,w:l,h:h,angle:c}),n.push({center:ge(e),angle:c,radian:de(c)})}else{d=Te({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=Se(t,d,i)}const e=ve(d);if(c>0||c<0){d=Se(e,d,de(c))}n.push({center:e,angle:c,radian:de(c)})}t.push(d)}return t}function Ce(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Ee([...i,e]):[We(e)]}(e,t);return i.pop()||null}function ke(e,t){const{x:i,y:o}=e,{size:n,angle:a}=t;return{x:i-n/2,y:o-n/2,w:n,h:n,angle:a}}function Oe(e,t){const{groupQueue:i,controllerSize:o,viewScaleInfo:n}=t,a=(o&&o>0?o:8)/n.scale,{x:r,y:s,w:l,h:h,angle:c=0}=e,d=[{uuid:T(),x:r,y:s,w:l,h:h,angle:c,type:"group",detail:{children:[]}},...i];let f=0;d.forEach((({angle:e=0})=>{f+=e}));const u=Ce(e,{groupQueue:i}),g=Ce({x:r-2*a,y:s-2*a,h:h+4*a,w:l+4*a,angle:c},{groupQueue:[...i]}),v=te(u[0],u[1]),w=te(u[1],u[2]),m=te(u[2],u[3]),y=te(u[3],u[0]),p=u[0],x=u[1],S=u[2],b=u[3],A=ke(v,{size:a,angle:f}),I=ke(w,{size:a,angle:f}),M=ke(m,{size:a,angle:f}),z=ke(y,{size:a,angle:f}),P=ke(p,{size:a,angle:f}),R=ke(x,{size:a,angle:f}),W=ke(b,{size:a,angle:f}),E=ke(S,{size:a,angle:f}),C=We(P),k=We(R),O=We(W),j=We(E),D=[C[1],k[0],k[3],C[2]],L=[k[3],k[2],j[1],j[0]],B=[O[1],j[0],j[3],O[2]],Y=[C[3],C[2],O[1],O[0]],F=We(A),G=We(I),V=We(M),N=We(z),H=te(g[0],g[1]);return{elementWrapper:u,left:{type:"left",vertexes:Y,center:y},right:{type:"right",vertexes:L,center:w},top:{type:"top",vertexes:D,center:v},bottom:{type:"bottom",vertexes:B,center:m},topLeft:{type:"top-left",vertexes:C,center:p},topRight:{type:"top-right",vertexes:k,center:x},bottomLeft:{type:"bottom-left",vertexes:O,center:b},bottomRight:{type:"bottom-right",vertexes:j,center:S},leftMiddle:{type:"left-middle",vertexes:N,center:y},rightMiddle:{type:"right-middle",vertexes:G,center:w},topMiddle:{type:"top-middle",vertexes:F,center:v},bottomMiddle:{type:"bottom-middle",vertexes:V,center:m},rotate:{type:"rotate",vertexes:We(ke(H,{size:a,angle:f})),center:H}}}function je(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function De(e,t){let i=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(i=t.decimalPlaces),parseFloat(e.toFixed(i))}oe=new WeakMap,ne=new WeakMap,ie=new WeakSet,ae=function(){return C(se(this,ne,"f"))};const Le={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Be(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{boxSizing:a=Le.boxSizing,borderWidth:r}=e.detail;Array.isArray(r)&&(n=0);let{x:s,y:l,w:h,h:c}=e,d=[0,0,0,0];if("number"==typeof n){const e=n*o;d=[e,e,e,e]}else Array.isArray(n)&&4===(null==n?void 0:n.length)&&(d=[n[0]*o,n[1]*o,n[2]*o,n[3]*o]);let f=0;return"number"==typeof r&&(f=(r||0)*o),"border-box"===a?(s=e.x+f/2,l=e.y+f/2,h=e.w-f,c=e.h-f):"content-box"===a?(s=e.x-f/2,l=e.y-f/2,h=e.w+f,c=e.h+f):(s=e.x,l=e.y,h=e.w,c=e.h),h=Math.max(h,1),c=Math.max(c,1),d=d.map((e=>Math.min(e,h/2,c/2))),{x:s,y:l,w:h,h:c,radiusList:d}}const Ye=e=>De(e,{decimalPlaces:4});function Fe(e,t){const{detail:i}=e,{xRatio:o,yRatio:n,maxRatio:a}=t,r=(o+n)/2,{borderWidth:s,borderRadius:l,borderDash:h,shadowOffsetX:c,shadowOffsetY:d,shadowBlur:f}=i;if("number"==typeof s)i.borderWidth=Ye(s*r);else if(Array.isArray(i.borderWidth)){const e=s;i.borderWidth=[Ye(e[0]*n),Ye(e[1]*o),Ye(e[2]*n),Ye(e[3]*o)]}if("number"==typeof l)i.borderRadius=Ye(l*r);else if(Array.isArray(i.borderRadius)){const e=l;i.borderRadius=[e[0]*o,e[1]*o,e[2]*n,e[3]*n]}Array.isArray(h)&&h.forEach(((e,t)=>{i.borderDash[t]=Ye(e*a)})),"number"==typeof c&&(i.shadowOffsetX=Ye(c*a)),"number"==typeof d&&(i.shadowOffsetX=Ye(d*a)),"number"==typeof f&&(i.shadowOffsetX=Ye(f*a))}function Ge(e,t){const{type:i}=e;!function(e,t){const{xRatio:i,yRatio:o}=t,{x:n,y:a,w:r,h:s}=e;e.x=Ye(n*i),e.y=Ye(a*o),e.w=Ye(r*i),e.h=Ye(s*o),Fe(e,t)}(e,t),"circle"===i||("text"===i?function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:a}=e.detail,r=(i+o)/2;n&&n>0&&(e.detail.fontSize=Ye(n*r)),a&&a>0&&(e.detail.lineHeight=Ye(a*r))}(e,t):"image"===i||"svg"===i||"html"===i||"path"===i||"group"===i&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ge(e,t)})))}function Ve(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:a=1}=i,{x:r,y:s}=o,{scale:l}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l},c={x:r+o.x*l,y:s+o.y*l},d=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{d.addColorStop(e.offset,R(e.color,a))})),d}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l,radius:i.radius*l},c={x:r+o.x*l,y:s+o.y*l,radius:o.radius*l},d=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{d.addColorStop(e.offset,R(e.color,a))})),d}return"#000000"}const Ne={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function He(e){var t,i,o,n;let a=1;return void 0!==(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.opacity)&&(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.opacity)<=1&&(a=null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.opacity),a}function Ze(e,t,i){const{pattern:o,renderContent:n,originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=He(a)*h;!function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:a,viewSizeInfo:r}=i,s=r.devicePixelRatio,{clipPath:l}=(null==n?void 0:n.detail)||{};if(l&&a&&l.commands){const{x:i,y:n,w:r,h:h}=a,{originW:c,originH:d,originX:f,originY:u}=l,g=r/c,v=h/d,w=i-f*g,m=n-u*v;e.save(),e.translate(w,m),e.scale(s*g,s*v);const y=je(l.commands||[]),p=new Path2D(y);e.clip(p),e.translate(0-w,0-m),e.setTransform(1,0,0,1,0,0),ue(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l,renderContent:()=>{e.globalAlpha=c,function(e,t,i){var o,n;const{pattern:a,viewScaleInfo:r,viewSizeInfo:s}=i,l=[];if(t.detail.background||a){const{x:i,y:h,w:c,h:d,radiusList:f}=Be(t,{viewScaleInfo:r,viewSizeInfo:s});if(e.beginPath(),e.moveTo(i+f[0],h),e.arcTo(i+c,h,i+c,h+d,f[1]),e.arcTo(i+c,h+d,i,h+d,f[2]),e.arcTo(i,h+d,i,h,f[3]),e.arcTo(i,h,i+c,h,f[0]),e.closePath(),"string"==typeof a)e.fillStyle=a;else if(["CanvasPattern"].includes(O.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=Ve(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=Ve(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});if(e.fillStyle=o,l&&l.length>0)for(let t=0;t<(null==l?void 0:l.length);t++){const o=l[t];"translate"===o.method?e.translate(o.args[0]+i,o.args[1]+h):"rotate"===o.method?e.rotate(...o.args):"scale"===o.method&&e.scale(...o.args)}}e.fill(),l&&l.length>0&&e.setTransform(1,0,0,1,0,0)}}(e,t,{pattern:o,viewScaleInfo:s,viewSizeInfo:l}),null==n||n(),function(e,t,i){if(0===t.detail.borderWidth)return;if(!P(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let a=Ne.borderColor;!0===P(t.detail.borderColor)&&(a=t.detail.borderColor);const{borderWidth:r,borderRadius:s,borderDash:l,boxSizing:h=Ne.boxSizing}=t.detail;let c=0;"number"==typeof r&&(c=r||1);c*=n;let d=[0,0,0,0];if("number"==typeof s){const e=s*n;d=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(d=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);e.strokeStyle=a;let f=[];Array.isArray(l)&&l.length>0&&(f=l.map((e=>Math.ceil(e*n))));let u=0,g=0,v=0,w=0;Array.isArray(r)&&(u=(r[0]||0)*n,g=(r[1]||0)*n,v=(r[2]||0)*n,w=(r[3]||0)*n);if(w||g||u||v){e.lineCap="butt";let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i+=w/2,o+=u/2,n=n-w/2-g/2,a=a-u/2-v/2):"content-box"===h?(i-=w/2,o-=u/2,n=n+w/2+g/2,a=a+u/2+v/2):(i=t.x,o=t.y,n=t.w,a=t.h),u&&(e.beginPath(),e.lineWidth=u,e.moveTo(i-w/2,o),e.lineTo(i+n+g/2,o),e.closePath(),e.stroke()),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i+n,o-u/2),e.lineTo(i+n,o+a+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-w/2,o+a),e.lineTo(i+n+g/2,o+a),e.closePath(),e.stroke()),w&&(e.beginPath(),e.lineWidth=w,e.moveTo(i,o-u/2),e.lineTo(i,o+a+v/2),e.closePath(),e.stroke())}else{let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i=t.x+c/2,o=t.y+c/2,n=t.w-c,a=t.h-c):"content-box"===h?(i=t.x-c/2,o=t.y-c/2,n=t.w+c,a=t.h+c):(i=t.x,o=t.y,n=t.w,a=t.h),f.length>0?e.lineCap="butt":e.lineCap="square",n=Math.max(n,1),a=Math.max(a,1),d=d.map((e=>Math.min(e,n/2,a/2))),e.setLineDash(f),e.lineWidth=c,e.beginPath(),e.moveTo(i+d[0],o),e.arcTo(i+n,o,i+n,o+a,d[1]),e.arcTo(i+n,o+a,i,o+a,d[2]),e.arcTo(i,o+a,i,o,d[3]),e.arcTo(i,o,i+n,o,d[0]),e.closePath(),e.stroke()}e.setLineDash([])}(e,t,{viewScaleInfo:s,viewSizeInfo:l}),e.globalAlpha=h}})}function Xe(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:a}=i,{shadowColor:r,shadowOffsetX:s,shadowOffsetY:l,shadowBlur:h}=o;H.number(h)?(e.save(),e.shadowColor=r||Ne.shadowColor,e.shadowOffsetX=(s||0)*n.scale,e.shadowOffsetY=(l||0)*n.scale,e.shadowBlur=(h||0)*n.scale,a(),e.restore()):a()}const Qe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Je(e,t,i){var o;if(!0===(null===(o=null==t?void 0:t.operations)||void 0===o?void 0:o.invisible))return;const{w:n,h:a}=t,{scale:r}=i.viewScaleInfo;if(!(r<1&&(n*r<1||a*r<1)||0===i.parentOpacity))try{switch(t.type){case"rect":!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize(t,n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});ue(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{background:a="#000000",borderColor:r="#000000",boxSizing:s,borderWidth:l=0}=o;let h=0;"number"==typeof l&&l>0?h=l:Array.isArray(l)&&"number"==typeof l[0]&&l[0]>0&&(h=l[0]);const{calculator:c,viewScaleInfo:d,viewSizeInfo:f,parentOpacity:u}=i,{x:g,y:v,w:w,h:m}=(null==c?void 0:c.elementSize({x:t.x,y:t.y,w:t.w,h:t.h},d,f))||t,y=Object.assign(Object.assign({},t),{x:g,y:v,w:w,h:m,angle:n});ue(e,{x:g,y:v,w:w,h:m,angle:n},(()=>{Xe(e,y,{viewScaleInfo:d,viewSizeInfo:f,renderContent:()=>{let t=w/2,i=m/2;const o=g+t,n=v+i;if(h>0&&("border-box"===s?(t-=h,i-=h):"center-line"===s?(t-=h/2,i-=h/2):(t-=h,i-=h)),t>=0&&i>=0){const s=He(y)*u;if(e.globalAlpha=s,"number"==typeof l&&l>0){const a=l/2+t,s=l/2+i;e.beginPath(),e.strokeStyle=r,e.lineWidth=l,e.circle(o,n,a,s,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath();const h=Ve(e,a,{viewElementSize:{x:g,y:v,w:w,h:m},viewScaleInfo:d,opacity:e.globalAlpha});e.fillStyle=h,e.circle(o,n,t,i,0,0,2*Math.PI),e.closePath(),e.fill(),e.globalAlpha=u}}})}))}(e,t,i);break;case"text":!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize(t,n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});ue(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{Ze(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const i=Object.assign(Object.assign({},Qe),t.detail),o=(i.fontSize||Qe.fontSize)*n.scale,a=i.lineHeight?i.lineHeight*n.scale:o;e.fillStyle=t.detail.color||Qe.color,e.textBaseline="top",e.$setFont({fontWeight:i.fontWeight,fontSize:o,fontFamily:i.fontFamily});const r=i.text.replace(/\r\n/gi,"\n"),d=a,f=r.split("\n"),u=[];let g=0;f.forEach(((t,i)=>{let o="";if(t.length>0){for(let n=0;n<t.length&&(e.measureText(o+(t[n]||"")).width<e.$doPixelRatio(h)?o+=t[n]||"":(u.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),o=t[n]||"",g++),!((g+1)*d>c));n++)if(t.length-1===n&&(g+1)*d<c){u.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),i<f.length-1&&g++;break}}else u.push({text:"",width:0})}));let v=0;u.length*d<c&&("top"===t.detail.verticalAlign?v=0:"bottom"===t.detail.verticalAlign?v+=c-u.length*d:v+=(c-u.length*d)/2);{const t=l+v;void 0!==i.textShadowColor&&P(i.textShadowColor)&&(e.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&H.number(i.textShadowOffsetX)&&(e.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&H.number(i.textShadowOffsetY)&&(e.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&H.number(i.textShadowBlur)&&(e.shadowBlur=i.textShadowBlur),u.forEach(((o,n)=>{let a=s;"center"===i.textAlign?a=s+(h-o.width)/2:"right"===i.textAlign&&(a=s+(h-o.width)),e.fillText(o.text,a,t+d*n)}))}}})}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t,u=Object.assign(Object.assign({},t),{x:l,y:h,w:c,h:d,angle:f});ue(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{Xe(e,u,{viewScaleInfo:a,viewSizeInfo:r,renderContent:()=>{Ze(e,u,{originElem:t,calcElemSize:{x:l,y:h,w:c,h:d,angle:f},viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s,renderContent:()=>{if(o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=He(t)*s;const{x:i,y:n,w:l,h:h,radiusList:c}=Be(u,{viewScaleInfo:a,viewSizeInfo:r});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+c[0],n),e.arcTo(i+l,n,i+l,n+h,c[1]),e.arcTo(i+l,n+h,i,n+h,c[2]),e.arcTo(i,n+h,i,n,c[3]),e.arcTo(i,n,i+l,n,c[0]),e.closePath(),e.fill(),e.clip(),e.drawImage(o,i,n,l,h),e.globalAlpha=s,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t;ue(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=He(t)*s,e.drawImage(o,l,h,c,d),e.globalAlpha=s)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t;ue(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=He(t)*s,e.drawImage(o,l,h,c,d),e.globalAlpha=s)}))}(e,t,i);break;case"path":!function(e,t,i){const{detail:o}=t,{originX:n,originY:a,originW:r,originH:s}=o,{calculator:l,viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d}=i,{x:f,y:u,w:g,h:v,angle:w}=(null==l?void 0:l.elementSize(t,h,c))||t,m=g/r,y=v/s,p=f-n*m,x=u-a*y,S=h.scale*c.devicePixelRatio,b=Object.assign(Object.assign({},t),{x:f,y:u,w:g,h:v,angle:w});ue(e,{x:f,y:u,w:g,h:v,angle:w},(()=>{Ze(e,b,{originElem:t,calcElemSize:{x:f,y:u,w:g,h:v,angle:w},viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d,renderContent:()=>{Xe(e,b,{viewScaleInfo:h,viewSizeInfo:c,renderContent:()=>{e.save(),e.translate(p,x),e.scale(S*m/h.scale,S*y/h.scale);const t=je(o.commands||[]),i=new Path2D(t);o.fill&&(e.fillStyle=o.fill,e.fill(i)),o.stroke&&0!==o.strokeWidth&&(e.strokeStyle=o.stroke,e.lineWidth=(o.strokeWidth||1)/c.devicePixelRatio,e.lineCap=o.strokeLineCap||"square",e.stroke(i)),e.translate(-p,-x),e.restore()}})}})}))}(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});ue(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{e.globalAlpha=He(t)*r,Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const{x:o,y:s,w:l,h:h,radiusList:c}=Be(f,{viewScaleInfo:n,viewSizeInfo:a});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(o+c[0],s),e.arcTo(o+l,s,o+l,s+h,c[1]),e.arcTo(o+l,s+h,o,s+h,c[2]),e.arcTo(o,s+h,o,s,c[3]),e.arcTo(o,s,o+l,s,c[0]),e.closePath(),e.fill(),e.clip()),Array.isArray(t.detail.children)){const{parentElementSize:o}=i,n={x:o.x+t.x,y:o.y+t.y,w:t.w||o.w,h:t.h||o.h,angle:t.angle},{calculator:a}=i;for(let o=0;o<t.detail.children.length;o++){let s=t.detail.children[o];if(s=Object.assign(Object.assign({},s),{x:n.x+s.x,y:n.y+s.y}),!0===i.forceDrawAll||(null==a?void 0:a.isElementInView(s,i.viewScaleInfo,i.viewSizeInfo)))try{Je(e,s,Object.assign(Object.assign({},i),{parentOpacity:r*He(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=r}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const Ue={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};var $e,Ke,qe,_e,et,tt,it,ot,nt,at,rt,st,lt=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))},ht=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)},ct=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i};const dt=["image","svg","html"],ft=e=>{var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),"string"==typeof n&&n?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${n}`)?n:E(n):E(`${T()}-${e.uuid}-${T()}-${T()}`)};class ut extends ee{constructor(){super(),$e.add(this),Ke.set(this,{}),qe.set(this,{}),_e.set(this,{}),et.set(this,!1),ht(this,$e,"m",tt).call(this,"image",((e,t)=>lt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.src])||void 0===i?void 0:i.value)||e.detail.src,n=yield L(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),ht(this,$e,"m",tt).call(this,"html",((e,t)=>lt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.html])||void 0===i?void 0:i.value)||e.detail.html,n=yield Y(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),ht(this,$e,"m",tt).call(this,"svg",((e,t)=>lt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.svg])||void 0===i?void 0:i.value)||e.detail.svg,n=yield B(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}isDestroyed(){return ht(this,et,"f")}destroy(){ct(this,et,!0,"f"),this.clear(),ct(this,Ke,null,"f"),ct(this,qe,null,"f"),ct(this,_e,null,"f")}load(e,t){!0!==ht(this,et,"f")&&(ht(this,$e,"m",st).call(this,e)||dt.includes(e.type)&&ht(this,$e,"m",rt).call(this,e,t))}getContent(e){var t,i;const o=ft(e);return(null===(i=null===(t=ht(this,_e,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return ht(this,_e,"f")}setLoadItemMap(e){ct(this,_e,e,"f")}}Ke=new WeakMap,qe=new WeakMap,_e=new WeakMap,et=new WeakMap,$e=new WeakSet,tt=function(e,t){ht(this,Ke,"f")[e]=t},it=function(e){var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),n},ot=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:ht(this,$e,"m",it).call(this,e)}},nt=function(e){const t=ft(e.element),i=ht(this,_e,"f")[t];ht(this,et,"f")||(i?i.startTime<e.startTime&&(ht(this,_e,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(ht(this,_e,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},at=function(e){var t;const i=ft(e.element),o=null===(t=ht(this,_e,"f"))||void 0===t?void 0:t[i];ht(this,et,"f")||(o?o.startTime<e.startTime&&(ht(this,_e,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(ht(this,_e,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},rt=function(e,t){const i=ht(this,$e,"m",ot).call(this,e),o=ft(e);ht(this,qe,"f")[o]=i;const n=ht(this,Ke,"f")[e.type];"function"!=typeof n||ht(this,et,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{ht(this,et,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",ht(this,$e,"m",nt).call(this,i))})).catch((t=>{console.warn(`Load element source "${i.source}" fail`,t,e),i.endTime=Date.now(),i.status="error",i.error=t,ht(this,$e,"m",at).call(this,i)})))},st=function(e){var t;const i=ft(e),o=null===(t=ht(this,qe,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==ht(this,$e,"m",it).call(this,e))};var gt,vt,wt,mt,yt,pt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},xt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class St extends ee{constructor(e){super(),gt.add(this),vt.set(this,void 0),wt.set(this,new ut),mt.set(this,!1),pt(this,vt,e,"f"),xt(this,gt,"m",yt).call(this)}isDestroyed(){return xt(this,mt,"f")}destroy(){this.clear(),pt(this,vt,null,"f"),xt(this,wt,"f").destroy(),pt(this,wt,null,"f"),pt(this,mt,!0,"f")}updateOptions(e){pt(this,vt,e,"f")}drawData(e,t){const i=xt(this,wt,"f"),{calculator:o}=xt(this,vt,"f"),n=xt(this,vt,"f").viewContext;n.clearRect(0,0,n.canvas.width,n.canvas.height);const a={x:0,y:0,w:t.viewSizeInfo.width,h:t.viewSizeInfo.height};e.underlay&&function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,s=Object.assign({uuid:"underlay"},t),{x:l,y:h,w:c,h:d}=(null==o?void 0:o.elementSize(s,n,a))||s,f=Object.assign(Object.assign({},s),{x:l,y:h,w:c,h:d,angle:0});Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(e,f,{originElem:s,calcElemSize:{x:l,y:h,w:c,h:d,angle:0},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{}})}})}(n,e.underlay,Object.assign({loader:i,calculator:o,parentElementSize:a,parentOpacity:1},t)),function(e,t,i){var o;const{elements:n=[]}=t,{parentOpacity:a}=i;for(let t=0;t<n.length;t++){const r=n[t],s=Object.assign(Object.assign({},r),{detail:Object.assign(Object.assign({},Ue),null==r?void 0:r.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.isElementInView(s,i.viewScaleInfo,i.viewSizeInfo)))try{Je(e,s,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(e){console.error(e)}}}(n,e,Object.assign({loader:i,calculator:o,parentElementSize:a,elementAssets:e.assets,parentOpacity:1},t))}scale(e){const{sharer:t}=xt(this,vt,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r,width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){xt(this,wt,"f").setLoadItemMap(e)}getLoadItemMap(){return xt(this,wt,"f").getLoadItemMap()}getLoader(){return xt(this,wt,"f")}}vt=new WeakMap,wt=new WeakMap,mt=new WeakMap,gt=new WeakSet,yt=function(){const e=xt(this,wt,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(()=>{}))};var bt,At=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},It=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Mt{constructor(e){bt.set(this,void 0),At(this,bt,e,"f")}destroy(){At(this,bt,null,"f")}elementSize(e,t,i){return Me(e,{viewScaleInfo:t,viewSizeInfo:i})}isElementInView(e,t,i){return function(e,t){const{viewSizeInfo:i,viewScaleInfo:o}=t,{width:n,height:a}=i,{angle:r}=e,{x:s,y:l,w:h,h:c}=Me(e,{viewScaleInfo:o,viewSizeInfo:i}),d=xe({x:s,y:l,w:h,h:c,angle:r}),f={x:0,y:0,w:n,h:a},u=Math.min(d[0].x,d[1].x,d[2].x,d[3].x),g=Math.min(d[0].y,d[1].y,d[2].y,d[3].y);return function(e,t){const i=e.x,o=e.y,n=e.x+e.w,a=e.y+e.h,r=t.x,s=t.y,l=t.x+t.w,h=t.y+t.h;return i<=l&&n>=r&&o<=h&&a>=s}(f,{x:u,y:g,w:Math.max(d[0].x,d[1].x,d[2].x,d[3].x)-u,h:Math.max(d[0].y,d[1].y,d[2].y,d[3].y)-g})}(e,{viewScaleInfo:t,viewSizeInfo:i})}isPointInElement(e,t,i,o){return Re(e,{context2d:It(this,bt,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=It(this,bt,"f").viewContext;return function(e,t){var i,o,n;const{context2d:a,data:r,viewScaleInfo:s,viewSizeInfo:l,groupQueue:h}=t,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let t=h.length-1;t>=0;t--){let n=0,r=0,d=0;for(let e=0;e<=t;e++)n+=h[e].x,r+=h[e].y,d+=h[e].angle||0;const f=h[t];if(f&&"group"===f.type&&Array.isArray(null===(i=f.detail)||void 0===i?void 0:i.children))for(let i=0;i<f.detail.children.length;i++){const u=f.detail.children[i];if(!0!==(null===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(Re(e,{context2d:a,element:{x:n+u.x,y:r+u.y,w:u.w,h:u.h,angle:d+(u.angle||0)},viewScaleInfo:s,viewSizeInfo:l})){c.element=u,(t<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=t);break}}}if(c.element)break}if(c.element)return c;for(let t=r.elements.length-1;t>=0;t--){const i=r.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&Re(e,{context2d:a,element:i,viewScaleInfo:s,viewSizeInfo:l})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}}bt=new WeakMap;var zt,Pt,Rt,Tt,Wt,Et,Ct,kt,Ot,jt,Dt,Lt,Bt,Yt,Ft,Gt,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},Nt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};function Ht(e){return e>0||e<0||0===e}class Zt extends ee{constructor(e){super(),zt.add(this),Pt.set(this,void 0),Rt.set(this,void 0),Tt.set(this,!1),Et.set(this,(e=>{if(!Nt(this,zt,"m",Yt).call(this,e))return;const t=Nt(this,zt,"m",Ft).call(this,e);if(!Nt(this,zt,"m",Gt).call(this,t))return;e.preventDefault(),e.stopPropagation();const i=e.deltaX>0||e.deltaX<0?e.deltaX:0,o=e.deltaY>0||e.deltaY<0?e.deltaY:0;!0===e.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:o,point:t}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:o,point:t})})),Ct.set(this,(e=>{if(!Nt(this,zt,"m",Yt).call(this,e))return;e.preventDefault();const t=Nt(this,zt,"m",Ft).call(this,e);Nt(this,zt,"m",Gt).call(this,t)})),kt.set(this,(e=>{if(!Nt(this,zt,"m",Yt).call(this,e))return;e.preventDefault();const t=Nt(this,zt,"m",Ft).call(this,e);if(!Nt(this,zt,"m",Gt).call(this,t))return;const i=Date.now(),o=Nt(this,Rt,"f").get("prevClickPoint");o&&i-o.t<=500&&Math.abs(o.x-t.x)<=5&&Math.abs(o.y-t.y)<=5?this.trigger("doubleClick",{point:t}):Nt(this,Rt,"f").set("prevClickPoint",t)})),Ot.set(this,(e=>{if(Nt(this,Rt,"f").set("hasPointDown",!1),!Nt(this,zt,"m",Yt).call(this,e))return;e.preventDefault();const t=Nt(this,zt,"m",Ft).call(this,e);this.trigger("pointLeave",{point:t})})),jt.set(this,(e=>{if(Nt(this,Rt,"f").set("hasPointDown",!1),!Nt(this,zt,"m",Yt).call(this,e))return;e.preventDefault();const t=Nt(this,zt,"m",Ft).call(this,e);this.trigger("pointEnd",{point:t})})),Dt.set(this,(e=>{if(!Nt(this,zt,"m",Yt).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=Nt(this,zt,"m",Ft).call(this,e);Nt(this,zt,"m",Gt).call(this,t)?!0===Nt(this,Rt,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):Nt(this,Rt,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),Nt(this,Rt,"f").set("hasPointDown",!1))})),Lt.set(this,(e=>{if(!Nt(this,zt,"m",Yt).call(this,e))return;e.preventDefault();const t=Nt(this,zt,"m",Ft).call(this,e);Nt(this,zt,"m",Gt).call(this,t)&&(Nt(this,Rt,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),Bt.set(this,(e=>{if(!Nt(this,zt,"m",Yt).call(this,e))return;e.preventDefault();const t=Nt(this,zt,"m",Ft).call(this,e);Nt(this,zt,"m",Gt).call(this,t)&&this.trigger("hover",{point:t})}));const t=new le({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});Vt(this,Rt,t,"f"),Vt(this,Pt,e,"f"),Nt(this,zt,"m",Wt).call(this)}onEvents(){if(Nt(this,Tt,"f"))return;const e=window;e.addEventListener("mousemove",Nt(this,Bt,"f")),e.addEventListener("mousedown",Nt(this,Lt,"f")),e.addEventListener("mousemove",Nt(this,Dt,"f")),e.addEventListener("mouseup",Nt(this,jt,"f")),e.addEventListener("mouseleave",Nt(this,Ot,"f")),e.addEventListener("wheel",Nt(this,Et,"f"),{passive:!1}),e.addEventListener("click",Nt(this,kt,"f")),e.addEventListener("contextmenu",Nt(this,Ct,"f"))}offEvents(){const e=window;e.removeEventListener("mousemove",Nt(this,Bt,"f")),e.removeEventListener("mousedown",Nt(this,Lt,"f")),e.removeEventListener("mousemove",Nt(this,Dt,"f")),e.removeEventListener("mouseup",Nt(this,jt,"f")),e.removeEventListener("mouseleave",Nt(this,Ot,"f")),e.removeEventListener("wheel",Nt(this,Et,"f")),e.removeEventListener("click",Nt(this,kt,"f")),e.removeEventListener("contextmenu",Nt(this,Ct,"f"))}destroy(){this.offEvents(),Nt(this,Rt,"f").destroy(),Vt(this,Tt,!0,"f")}}Pt=new WeakMap,Rt=new WeakMap,Tt=new WeakMap,Et=new WeakMap,Ct=new WeakMap,kt=new WeakMap,Ot=new WeakMap,jt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,Bt=new WeakMap,zt=new WeakSet,Wt=function(){this.onEvents()},Yt=function(e){return e.target===Nt(this,Pt,"f").boardContent.boardContext.canvas},Ft=function(e){const t=Nt(this,Pt,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},Gt=function(e){const t=Nt(this,Pt,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!(Ht(e.x)&&Ht(e.y)&&e.x<=i&&e.y<=o)};var Xt,Qt,Jt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Ut=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const $t={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class Kt{constructor(){Xt.set(this,void 0),Qt.set(this,void 0);const e=new le({defaultStorage:$t}),t=new le({defaultStorage:{}});Jt(this,Xt,e,"f"),Jt(this,Qt,t,"f")}getActiveStorage(e){return Ut(this,Xt,"f").get(e)}setActiveStorage(e,t){return Ut(this,Xt,"f").set(e,t)}getActiveStoreSnapshot(){return Ut(this,Xt,"f").getSnapshot()}getSharedStorage(e){return Ut(this,Qt,"f").get(e)}setSharedStorage(e,t){return Ut(this,Qt,"f").set(e,t)}getSharedStoreSnapshot(){return Ut(this,Qt,"f").getSnapshot()}getActiveViewScaleInfo(){return{scale:Ut(this,Xt,"f").get("scale"),offsetTop:Ut(this,Xt,"f").get("offsetTop"),offsetBottom:Ut(this,Xt,"f").get("offsetBottom"),offsetLeft:Ut(this,Xt,"f").get("offsetLeft"),offsetRight:Ut(this,Xt,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;Ut(this,Xt,"f").set("scale",t),Ut(this,Xt,"f").set("offsetTop",i),Ut(this,Xt,"f").set("offsetBottom",o),Ut(this,Xt,"f").set("offsetLeft",n),Ut(this,Xt,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){Ut(this,Xt,"f").set("width",e.width),Ut(this,Xt,"f").set("height",e.height),Ut(this,Xt,"f").set("devicePixelRatio",e.devicePixelRatio),Ut(this,Xt,"f").set("contextWidth",e.contextWidth),Ut(this,Xt,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:Ut(this,Xt,"f").get("width"),height:Ut(this,Xt,"f").get("height"),devicePixelRatio:Ut(this,Xt,"f").get("devicePixelRatio"),contextWidth:Ut(this,Xt,"f").get("contextWidth"),contextHeight:Ut(this,Xt,"f").get("contextHeight")}}}Xt=new WeakMap,Qt=new WeakMap;var qt,_t,ei,ti,ii,oi,ni=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},ai=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const{requestAnimationFrame:ri}=window;class si extends ee{constructor(e){super(),qt.add(this),_t.set(this,void 0),ei.set(this,[]),ti.set(this,"FREE"),ni(this,_t,e,"f"),ai(this,qt,"m",ii).call(this)}drawFrame(){const{sharer:e}=ai(this,_t,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();ai(this,ei,"f").push({activeStore:t,sharedStore:i}),ai(this,qt,"m",oi).call(this)}scale(e){const{scale:t,point:i}=e,{sharer:o}=ai(this,_t,"f"),{moveX:n,moveY:a}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:a}=o,r=t/o.scale,s=i.x,l=i.y;return{moveX:s-s*r+(n*r-n),moveY:l-l*r+(a*r-a)}}({scale:t,point:i,viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()});return o.setActiveStorage("scale",t),{moveX:n,moveY:a}}scroll(e){const{sharer:t}=ai(this,_t,"f"),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n}=e,a=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:a}=o,{width:r,height:s,contextWidth:l,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,f=o.offsetTop,u=o.offsetBottom;return c+=t,f+=i,d=r-(l*a+c),u=s-(h*a+f),{scale:a,offsetTop:f,offsetLeft:c,offsetRight:d,offsetBottom:u}}({moveX:o,moveY:n,viewScaleInfo:i,viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(a),a}updateViewScaleInfo(e){const{sharer:t}=ai(this,_t,"f"),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:a}=t,{width:r,height:s,contextWidth:l,contextHeight:h}=a,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:r-(l*i+c/i),offsetBottom:s-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),i}resize(e={}){const{sharer:t}=ai(this,_t,"f"),i=t.getActiveViewSizeInfo(),o=Object.assign(Object.assign({},i),e),{width:n,height:a,devicePixelRatio:r}=o,{underContext:s,boardContext:l,helperContext:h,viewContext:c}=ai(this,_t,"f").boardContent;return l.canvas.width=n*r,l.canvas.height=a*r,l.canvas.style.width=`${n}px`,l.canvas.style.height=`${a}px`,s.canvas.width=n*r,s.canvas.height=a*r,h.canvas.width=n*r,h.canvas.height=a*r,c.canvas.width=n*r,c.canvas.height=a*r,t.setActiveViewSizeInfo(o),o}}_t=new WeakMap,ei=new WeakMap,ti=new WeakMap,qt=new WeakSet,ii=function(){const{renderer:e}=ai(this,_t,"f");e.on("load",(()=>{this.drawFrame()}))},oi=function e(){if("DRAWING"===ai(this,ti,"f")||0===ai(this,ei,"f").length)return;ni(this,ti,"DRAWING","f");const t=ai(this,ei,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=ai(this,_t,"f");if(t){const{scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h,width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g}=t.activeStore,v={scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h},w={width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g};(null==t?void 0:t.activeStore.data)&&i.drawData(t.activeStore.data,{viewScaleInfo:v,viewSizeInfo:w}),n({snapshot:t}),o.drawView(),a({snapshot:t})}0!==ai(this,ei,"f").length?ni(this,ti,"DRAWING","f")&&ri((()=>{ai(this,qt,"m",e).call(this)})):ni(this,ti,"COMPLETE","f")};var li,hi,ci,di,fi,ui,gi,vi,wi,mi,yi,pi,xi,Si,bi,Ai,Ii,Mi,zi,Pi,Ri,Ti,Wi,Ei,Ci,ki,Oi,ji=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Di=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Li{constructor(e){li.add(this),hi.set(this,void 0),ci.set(this,new WeakMap),di.set(this,[]),fi.set(this,[]),ui.set(this,void 0),gi.set(this,void 0),vi.set(this,void 0),wi.set(this,void 0),mi.set(this,void 0),yi.set(this,new ee),pi.set(this,!1);const{boardContent:t}=e,i=new Kt,o=new Mt({viewContext:t.viewContext}),n=new Zt({boardContent:t,sharer:i}),a=new St({viewContext:t.viewContext,sharer:i,calculator:o});ji(this,hi,e,"f"),ji(this,vi,i,"f"),ji(this,ui,n,"f"),ji(this,gi,a,"f"),ji(this,mi,o,"f"),ji(this,wi,new si({boardContent:e.boardContent,sharer:i,renderer:a,calculator:Di(this,mi,"f"),beforeDrawFrame:e=>{Di(this,li,"m",Ci).call(this,e)},afterDrawFrame:e=>{Di(this,li,"m",ki).call(this,e)}}),"f"),Di(this,li,"m",xi).call(this),Di(this,li,"m",Oi).call(this)}isDestroyed(){return Di(this,pi,"f")}destroy(){Di(this,ui,"f").destroy(),Di(this,gi,"f").destroy(),Di(this,mi,"f").destroy(),Di(this,yi,"f").destroy(),ji(this,pi,!0,"f")}getSharer(){return Di(this,vi,"f")}getViewer(){return Di(this,wi,"f")}getRenderer(){return Di(this,gi,"f")}setData(e){const t=Di(this,vi,"f");Di(this,vi,"f").setActiveStorage("data",e);const i=t.getActiveViewSizeInfo(),o=Ie(e.elements,{viewWidth:i.width,viewHeight:i.height,extend:!0});Di(this,wi,"f").drawFrame();const n=Object.assign(Object.assign({},i),o);return Di(this,vi,"f").setActiveViewSizeInfo(n),{viewSizeInfo:n}}getData(){const{data:e}=Di(this,vi,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(Di(this,ci,"f").has(e)){const o=Di(this,ci,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",Di(this,ci,"f").set(e,o),void Di(this,li,"m",Oi).call(this)}const{boardContent:n,container:a}=Di(this,hi,"f"),r=e({boardContent:n,sharer:Di(this,vi,"f"),viewer:Di(this,wi,"f"),calculator:Di(this,mi,"f"),eventHub:Di(this,yi,"f"),container:a});null===(o=r.use)||void 0===o||o.call(r),Di(this,di,"f").push(e),Di(this,fi,"f").push(r),Di(this,ci,"f").set(e,{status:"enable",middlewareObject:r}),Di(this,li,"m",Oi).call(this)}disuse(e){var t,i;const o=Di(this,ci,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",Di(this,ci,"f").set(e,o),Di(this,li,"m",Oi).call(this))}scale(e){const t=Di(this,wi,"f"),{moveX:i,moveY:o}=t.scale(e);t.scroll({moveX:i,moveY:o})}scroll(e){return Di(this,wi,"f").scroll(e)}updateViewScaleInfo(e){return Di(this,wi,"f").updateViewScaleInfo(e)}resize(e){const t=Di(this,wi,"f").resize(e),{width:i,height:o,devicePixelRatio:n}=e,{boardContent:a}=Di(this,hi,"f");a.viewContext.$resize({width:i,height:o,devicePixelRatio:n}),a.helperContext.$resize({width:i,height:o,devicePixelRatio:n}),a.boardContext.$resize({width:i,height:o,devicePixelRatio:n}),a.underContext.$resize({width:i,height:o,devicePixelRatio:n}),Di(this,wi,"f").drawFrame(),Di(this,ui,"f").trigger("resize",t),Di(this,vi,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=Di(this,hi,"f"),{underContext:t,helperContext:i,viewContext:o,boardContext:n}=e;t.clearRect(0,0,t.canvas.width,t.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),Di(this,li,"m",Ei).call(this)}getEventHub(){return Di(this,yi,"f")}onWatcherEvents(){Di(this,ui,"f").onEvents()}offWatcherEvents(){Di(this,ui,"f").offEvents()}}hi=new WeakMap,ci=new WeakMap,di=new WeakMap,fi=new WeakMap,ui=new WeakMap,gi=new WeakMap,vi=new WeakMap,wi=new WeakMap,mi=new WeakMap,yi=new WeakMap,pi=new WeakMap,li=new WeakSet,xi=function(){Di(this,ui,"f").on("pointStart",Di(this,li,"m",Si).bind(this)),Di(this,ui,"f").on("pointEnd",Di(this,li,"m",bi).bind(this)),Di(this,ui,"f").on("pointMove",z((e=>{Di(this,li,"m",Ai).call(this,e)}),10)),Di(this,ui,"f").on("hover",z((e=>{Di(this,li,"m",Ii).call(this,e)}),10)),Di(this,ui,"f").on("wheel",z((e=>{Di(this,li,"m",zi).call(this,e)}),10)),Di(this,ui,"f").on("wheelScale",z((e=>{Di(this,li,"m",Pi).call(this,e)}),10)),Di(this,ui,"f").on("scrollX",Di(this,li,"m",Ri).bind(this)),Di(this,ui,"f").on("scrollY",Di(this,li,"m",Ti).bind(this)),Di(this,ui,"f").on("resize",Di(this,li,"m",Wi).bind(this)),Di(this,ui,"f").on("doubleClick",Di(this,li,"m",Mi).bind(this))},Si=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},bi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},Ai=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointMove)||void 0===t?void 0:t.call(o,e)))return}},Ii=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},Mi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},zi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},Pi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheelScale)||void 0===t?void 0:t.call(o,e)))return}},Ri=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},Ti=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},Wi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},Ei=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.clear)||void 0===t?void 0:t.call(o,e)))return}},Ci=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},ki=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Oi=function(){const e=[],t=Di(this,ci,"f");Di(this,di,"f").forEach((i=>{const o=t.get(i);"enable"===(null==o?void 0:o.status)&&(null==o?void 0:o.middlewareObject)&&e.push(o.middlewareObject)})),ji(this,fi,e,"f")};const Bi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9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AJAhfrfrO4k/7lxZxnr2JlJqry8POnWyePx6H4JR0vhktVkHGOXQI20SkpKLLcOhmGsA5YCaZiVLS5XoADi9XpdkznDMERhnE0fCgUHZhvOW+CO4/8A5hR7wFxjD5hr7AFzjZyBlmVlrOYdYaS1HUUuQA/gWV9fd51URDyqn1c1j6MVFGjoidfW1oq2ABrYj0V82OmVzwHNajVdB88C5wOKTdM87NaxsrKyQsFKHC2BnTDo+/TWt8Bd5INeVC44NDT0xXYZdXNz8w/AaeyS8yjwCPdzQu92ht2m/OUjIyOfS1pkAoqItLS0fA+8D7wKPA0cxs6qC1O4T0xMfKYnb21tnXEDNjc3z+nXbW1t3wFvYz9dCAL7KUThHovFPtGTNjU1jQFSX18/lg68cuXKLUAaGxs3vkB7e/u3wHHgCQpUdnpTqdQvesJgMDisUVevXh3Xry9fvnxTv66qqprQ/cfHx/vVNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";class Yi{constructor(e,d){A(this,r),A(this,l),A(this,c),A(this,f),A(this,g),A(this,t,void 0),A(this,i,void 0),A(this,o,null),A(this,n,null),A(this,a,{auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjO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aWnRhQsXNDQ0lAWVTCZ169YtHThwQFVVVePKtrS0+Kw3pgsYso+Vkuol7ZD0W0ldvsHW1tZJZXxtba0aGxvV1NSkdevWaenSpYpGoxPmXb9+vXp6ejzgx5J+ZiGeLSk8GaD34ky5Hd23JP1I0h8kPQmGu7y8/L/aNEUiEe3fv1/Dw8Pp6Es6KqlZ0puSXpHbVU4KiPVglqQFkr4j6aeSfi/pvq/13r172rVrlyorK6cFFo1GtXnzZl25ciU4Ch5J+qOkH0v6tqTXzDk5EwGGlNFjOWQOd8px4vUN4E3cpn2pz/jgwQPef/99Ll68yJ07d+jt7WVwcJBIJEJJSQlz586loaGBTZs2UVdXF5w0OoDLwFWcbPsct6r04+bRLHEYCoWyAD1kBDfHleHmsxrccccS3NFHNV/eenBy6iZwCycMOnHz5wBuDh2nyyY6H0zhFmoF7vtxk+l9q3ieQfrDo8msF7cy3cN56g7ZWnKcep7IxnrQmz+wHKu2K3EKJWbPpWSUTQ4ZtRJc23sC6ZGB9ZM52JwcboIQjzUvZvNxYfeHlyVkZFcBbux6wKA6ShjoM5yM8uH0Xpuy8ekAQuZc2W8P8nEei9p9mMmPgAfJHO0O27e0lHppw9MEDJo//A4eoE91iB48SJ80lFMB/t/+V/sPGZfTmtMFR4EAAAAASUVORK5CYII="}),I(this,i,e),I(this,t,d.eventHub),M(this,r,s).call(this),M(this,l,h).call(this)}}t=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakSet,s=function(){const e=b(this,t);M(this,c,d).call(this,"default"),e.on("cursor",(e=>{var t;"over-element"!==e.type&&e.type?"resize-rotate"===e.type?M(this,c,d).call(this,"rotate"):"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?M(this,f,u).call(this,e):"drag-default"===e.type?M(this,c,d).call(this,"drag-default"):"drag-active"===e.type?M(this,c,d).call(this,"drag-active"):M(this,c,d).call(this,"auto"):M(this,c,d).call(this,"auto")}))},l=new WeakSet,h=function(){L(Bi).then((e=>{I(this,n,e)})).catch((e=>{console.error(e)}))},c=new WeakSet,d=function(e){if(b(this,o)===e)return;I(this,o,e);const t=b(this,a)[b(this,o)]||b(this,a).auto;let n=0,r=0;(e.startsWith("rotate-")&&b(this,a)[b(this,o)]||"rotate"===e)&&(n=10,r=10),b(this,i).style.cursor="default"===e?"default":`image-set(url(${t})2x) ${n} ${r}, auto`},f=new WeakSet,u=function(e){var t;let i=0;"resize-top"===e.type?i+=0:"resize-top-right"===e.type?i+=45:"resize-right"===e.type?i+=90:"resize-bottom-right"===e.type?i+=135:"resize-bottom"===e.type?i+=180:"resize-bottom-left"===e.type?i+=225:"resize-left"===e.type?i+=270:"resize-top-left"===e.type&&(i+=315),i+=be((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+=be(e.angle||0)})),i=be(i);const o=M(this,g,v).call(this,i);M(this,c,d).call(this,o)},g=new WeakSet,v=function(e){const t=`rotate-${e}`;if(!b(this,a)[t]){const i=b(this,n);if(i){const o=document.createElement("canvas"),n=i.width,r=i.height,s={x:n/2,y:r/2};o.width=n,o.height=r;const l=o.getContext("2d"),h=de(e);l.translate(s.x,s.y),l.rotate(h),l.translate(-s.x,-s.y),l.drawImage(i,0,0,n,r),l.translate(s.x,s.y),l.rotate(-h),l.translate(-s.x,-s.y);const c=o.toDataURL("image/png");b(this,a)[t]=c}}return t};const Fi="SELECT",Gi=Symbol(`${Fi}_actionType`),Vi=Symbol(`${Fi}_resizeType`),Ni=Symbol(`${Fi}_areaStart`),Hi=Symbol(`${Fi}_areaEnd`),Zi=Symbol(`${Fi}_hoverElement`),Xi=Symbol(`${Fi}_hoverElementVertexes`),Qi=Symbol(`${Fi}_selectedElementList`),Ji=Symbol(`${Fi}_selectedElementListVertexes`),Ui=Symbol(`${Fi}_selectedElementController`),$i=Symbol(`${Fi}_groupQueue`),Ki=Symbol(`${Fi}_groupQueueVertexesList`),qi="#1973ba",_i="#5b5959b5";function eo(e,t,i){const{borderColor:o,borderWidth:n,background:a,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=a,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[0].x,t[0].y),e.closePath(),e.stroke(),e.fill()}function to(e,t,i){if(!t)return;const o={borderColor:qi,borderWidth:1,background:"transparent",lineDash:[]};eo(e,Pe(t,i),o)}function io(e,t,i){const{borderColor:o,borderWidth:n,background:a,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=a,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[2].x,t[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function oo(e,t,i){if(!t)return;const o={borderColor:_i,borderWidth:1,background:"transparent",lineDash:[]};eo(e,Pe(t,i),o);const{controller:n}=i;if(n){const{topLeft:t,topRight:a,bottomLeft:r,bottomRight:s,topMiddle:l,bottomMiddle:h,leftMiddle:c,rightMiddle:d}=n,f={...o,borderWidth:1,background:_i};io(e,Pe(l.vertexes,i),f),io(e,Pe(h.vertexes,i),f),io(e,Pe(c.vertexes,i),f),io(e,Pe(d.vertexes,i),f),io(e,Pe(t.vertexes,i),f),io(e,Pe(a.vertexes,i),f),io(e,Pe(r.vertexes,i),f),io(e,Pe(s.vertexes,i),f)}}function no(e,t,i){if(!t)return;const{elementWrapper:o,topLeft:n,topRight:a,bottomLeft:r,bottomRight:s,top:l,rotate:h}=t,c={borderColor:qi,borderWidth:2,background:"transparent",lineDash:[]},d={...c,borderWidth:4,background:"#FFFFFF"};!function(e,t,i,o){const{borderColor:n,borderWidth:a,lineDash:r}=o;e.setLineDash([]),e.lineWidth=a,e.strokeStyle=n,e.setLineDash(r),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.closePath(),e.stroke()}(e,ze(l.center,i),ze(h.center,i),{...d,borderWidth:2}),eo(e,Pe(o,i),c),eo(e,Pe(n.vertexes,i),d),eo(e,Pe(a.vertexes,i),d),eo(e,Pe(r.vertexes,i),d),eo(e,Pe(s.vertexes,i),d),function(e,t,i){const{size:o,borderColor:n,borderWidth:a,background:r}=i,s=t,l=o/2,h=l,c=l;if(h>=0&&c>=0){if("number"==typeof a&&a>0){const t=a/2+h,i=a/2+c;e.beginPath(),e.strokeStyle=n,e.lineWidth=a,e.circle(s.x,s.y,t,i,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath(),e.fillStyle=r,e.circle(s.x,s.y,h,c,0,0,2*Math.PI),e.closePath(),e.fill()}}(e,ze(h.center,i),{...d,size:10,borderWidth:2})}function ao(e){return e*Math.PI/180}function ro(e,t){return Math.sqrt(e*e+t*t)}function so(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function lo(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,vertexes:a}=t,r=ze(a[0],{viewScaleInfo:o,viewSizeInfo:n}),s=ze(a[1],{viewScaleInfo:o,viewSizeInfo:n}),l=ze(a[2],{viewScaleInfo:o,viewSizeInfo:n}),h=ze(a[3],{viewScaleInfo:o,viewSizeInfo:n});return i.beginPath(),i.moveTo(r.x,r.y),i.lineTo(s.x,s.y),i.lineTo(l.x,l.y),i.lineTo(h.x,h.y),i.lineTo(r.x,r.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function ho(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:a}=t;if(!(a&&(null==a?void 0:a.length)>0))return!1;const r=Ee(a),s=r[r.length-1];return!!s&&lo(e,{ctx:i,vertexes:s,viewScaleInfo:o,viewSizeInfo:n})}function co(e,t){var i,o,n;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:r,data:s,calculator:l,selectedElements:h,viewScaleInfo:c,viewSizeInfo:d,areaSize:f,groupQueue:u,selectedElementController:g}=t;if(g){const{left:t,right:i,top:o,bottom:n,topLeft:s,topRight:l,bottomLeft:f,bottomRight:v,rotate:w}=g,m=[t,i,o,n,s,l,f,v,w];for(let t=0;t<m.length;t++){const i=m[t];if(lo(e,{ctx:r,vertexes:i.vertexes,viewSizeInfo:d,viewScaleInfo:c})){a.type=`resize-${i.type}`,h&&(null==h?void 0:h.length)>0&&(a.groupQueue=u||[],a.elements=[h[0]]);break}}}if(u&&Array.isArray(u)&&u.length>0){const t=u[u.length-1];if((null==(i=null==t?void 0:t.detail)?void 0:i.children)&&Array.isArray(null==(o=null==t?void 0:t.detail)?void 0:o.children))for(let i=t.detail.children.length-1;i>=0;i--){const o=t.detail.children[i],n=Ce(o,{groupQueue:u});if(n&&lo(e,{ctx:r,vertexes:n,viewScaleInfo:c,viewSizeInfo:d}))return a.type||(a.type="over-element"),a.groupQueue=u,a.elements=[o],a}return a}if(null!==a.type)return a;if(f&&Array.isArray(h)&&(null==h?void 0:h.length)>1){const{x:t,y:i,w:o,h:n}=f;if(e.x>=t&&e.x<=t+o&&e.y>=i&&e.y<=i+n)return a.type="list-area",a.elements=h,a}if(s){const{index:t,element:i}=l.getPointElement(e,{data:s,viewScaleInfo:c,viewSizeInfo:d});if(t>=0&&i&&!0!==(null==(n=null==i?void 0:i.operations)?void 0:n.invisible))return a.elements=[i],a.type="over-element",a}return a}function fo(e,t){const{x:i,y:o,w:n,h:a,angle:r=0}=e,{center:s,start:l,end:h,viewScaleInfo:c,viewSizeInfo:d}=t,f=ze(s,{viewScaleInfo:c,viewSizeInfo:d}),u=be(r),g=function(e,t,i){const o=we(e,t),n=we(e,i);return null!==n&&null!==o?o>3*Math.PI/2&&n<Math.PI/2?n+(2*Math.PI-o):n>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-n):n-o:0}(f,l,h);return{x:i,y:o,w:n,h:a,angle:u+g/Math.PI*180}}function uo(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{calculator:n,viewScaleInfo:a,viewSizeInfo:r}=t;let s=null;for(let t=0;t<e.length;t++){const l=e[t];if(null==(i=null==l?void 0:l.operations)?void 0:i.invisible)continue;const h=n.elementSize(l,a,r);if(h.angle&&(h.angle>0||h.angle<0)){const e=xe(h);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];h.x=Math.min(...t),h.y=Math.min(...i),h.w=Math.abs(Math.max(...t)-Math.min(...t)),h.h=Math.abs(Math.max(...i)-Math.min(...i))}}if(s){const e=Math.min(h.x,o.x),t=Math.min(h.y,o.y),i=Math.max(h.x+h.w,o.x+o.w),n=Math.max(h.y+h.h,o.y+o.h);o.x=e,o.y=t,o.w=Math.abs(i-e),o.h=Math.abs(n-t)}else o.x=h.x,o.y=h.y,o.w=h.w,o.h=h.h;s=h}return o}const go="@middleware/text-edit",vo={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"},wo="@middleware/select",mo="@middleware/select-clear",yo="SCROLL",po=Symbol(`${yo}_xThumbRect`),xo=Symbol(`${yo}_yThumbRect`),So=Symbol(`${yo}_prevPoint`),bo=Symbol(`${yo}_activePoint`),Ao=Symbol(`${yo}_activeThumbType`),Io=16,Mo=.36,zo={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function Po(e,t,i){const o=e,{x:n,y:a,w:r,h:s}=i;return o.beginPath(),o.rect(n,a,r,s),o.closePath(),!!o.isPointInPath(t.x,t.y)}function Ro(e,t){let{x:i,y:o,h:n,w:a}=t;e.save(),e.shadowColor="#FFFFFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=1;{const{color:r,axis:s}=t;"X"===s?(o=o+n/4+0,n/=2):"Y"===s&&(i=i+a/4+0,a/=2);let l=t.r;l=Math.min(l,a/2,n/2),(a<2*l||n<2*l)&&(l=0),e.globalAlpha=Mo,e.beginPath(),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.fillStyle=r,e.fill(),e.globalAlpha=1,e.beginPath(),e.lineWidth=1,e.strokeStyle=r,e.setLineDash([]),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.stroke()}e.restore()}function To(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:a}=t,{activeThumbType:r,prevPoint:s,activePoint:l}=a,h=function(e,t){const{width:i,height:o}=t,{offsetTop:n,offsetBottom:a,offsetLeft:r,offsetRight:s}=e,l=2.5*Io,h=Io;let c=0,d=0;c=Math.max(l,i-2*h-(Math.abs(r)+Math.abs(s))),c>=i&&(c=i),d=Math.max(l,o-2*h-(Math.abs(n)+Math.abs(a))),d>=o&&(d=o);const f=h;let u=f;r>0?u=f:s>0?u=i-c-h:r<=0&&c>0&&(0!==r||0!==s)&&(u=f+(i-c)*Math.abs(r)/(Math.abs(r)+Math.abs(s)),u=Math.min(Math.max(0,u-f),i-c));const g=h;let v=g;n>0?v=g:a>0?v=o-d-h:n<=0&&d>0&&(0!==n||0!==a)&&(v=g+(o-d)*Math.abs(n)/(Math.abs(n)+Math.abs(a)),v=Math.min(Math.max(0,v-g),o-d));const w={x:u,y:o-h,w:c,h:h},m={x:i-h,y:v,w:h,h:d};return{lineSize:h,xSize:c,ySize:d,translateY:v,translateX:u,thumbColor:zo.thumbColor,scrollBarColor:zo.scrollBarColor,xThumbRect:w,yThumbRect:m}}(o,n);let c={...h.xThumbRect},d={...h.yThumbRect};return r&&s&&l&&("X"===r&&a.xThumbRect?(c={...a.xThumbRect},c.x=c.x+(l.x-s.x)):"Y"===r&&a.yThumbRect&&(d={...a.yThumbRect},d.y=d.y+(l.y-s.y))),Ro(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),Ro(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function Wo(e,t){const{snapshot:i}=t,o=ce(i),n=he(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[bo]||null,prevPoint:t[So]||null,activeThumbType:t[Ao]||null,xThumbRect:t[po]||null,yThumbRect:t[xo]||null}}(i),{xThumbRect:r,yThumbRect:s}=To(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:r,yThumbRect:s}}const Eo="@middleware/scale",Co=16,ko="#000000",Oo="#00000080",jo="monospace",Do="#AAAAAA20",Lo="#AAAAAA40";function Bo(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=De(a/t,{decimalPlaces:0}),a=Math.max(10,Math.min(a,1e3));const r=10*a,s=5*a;let l=0;const h=a*t,c=0-o,d=c%h,f=(c-d+h)/t,u=h-d+0;for(;u+l*h<i;){const e=De(f+l*a,{decimalPlaces:0}),t={num:e,position:De(u+l*h,{decimalPlaces:0}),showNum:e%r==0,isKeyNum:e%r==0,isSubKeyNum:e%s==0};n.push(t),l++}return n}const Yo="@middleware/show-ruler",Fo=Symbol("DRAG_prevPoint");return w=new WeakMap,m=new WeakMap,y=new WeakMap,p=new WeakSet,x=function(){b(this,y).style.position="relative"},e.Core=class{constructor(e,t){A(this,p),A(this,w,void 0),A(this,m,void 0),A(this,y,void 0);const{devicePixelRatio:i=1,width:o,height:n,createCustomContext2D:a}=t;I(this,y,e);const r=document.createElement("canvas");I(this,m,r),M(this,p,x).call(this),e.appendChild(r);const s=function(e,t){const{width:i,height:o,devicePixelRatio:n,offscreen:a,createCustomContext2D:r}=t,s={width:i,height:o,devicePixelRatio:n},l=e.getContext("2d");if(r){const e=r(s),t=r(s),i=r(s),o=$(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}if(!0===a){const e=K(s),t=K(s),i=K(s),o=$(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}{const e=$(s),t=$(s),n=$(s),a=$(Object.assign({ctx:l},s)),r=()=>{a.clearRect(0,0,i,o),a.drawImage(n.canvas,0,0,i,o),a.drawImage(e.canvas,0,0,i,o),a.drawImage(t.canvas,0,0,i,o),n.clearRect(0,0,i,o),e.clearRect(0,0,i,o),t.clearRect(0,0,i,o)};return{underContext:n,viewContext:e,helperContext:t,boardContext:a,drawView:r}}}(r,{width:o,height:n,devicePixelRatio:i,offscreen:!0,createCustomContext2D:a}),l=new Li({boardContent:s,container:e}),h=l.getSharer();h.setActiveViewSizeInfo({width:o,height:n,devicePixelRatio:i,contextWidth:o,contextHeight:n}),I(this,w,l),this.resize(h.getActiveViewSizeInfo());const c=l.getEventHub();new Yi(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){Ae((null==e?void 0:e.elements)||[]),b(this,w).setData(e)}getData(){return b(this,w).getData()}scale(e){b(this,w).scale(e);b(this,w).getViewer().drawFrame()}resize(e){const t=b(this,w),i=t.getSharer().getActiveViewSizeInfo();t.resize({...i,...e})}clear(){b(this,w).clear()}on(e,t){b(this,w).getEventHub().on(e,t)}off(e,t){b(this,w).getEventHub().off(e,t)}trigger(e,t){b(this,w).getEventHub().trigger(e,t)}getViewInfo(){const e=b(this,w).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){b(this,w).getViewer().drawFrame()}setViewScale(e){b(this,w).updateViewScaleInfo(e)}getLoadItemMap(){return b(this,w).getRenderer().getLoadItemMap()}onBoardWatcherEvents(){b(this,w).onWatcherEvents()}offBoardWatcherEvents(){b(this,w).offWatcherEvents()}},e.MiddlewareDragger=e=>{const{eventHub:t,sharer:i,viewer:o}=e;let n=!1;return{name:"@middleware/dragger",hover(){!0!==n&&t.trigger("cursor",{type:"drag-default"})},pointStart(e){const{point:o}=e;i.setSharedStorage(Fo,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(Fo);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(Fo,t)},pointEnd(){n=!1,i.setSharedStorage(Fo,null),t.trigger("cursor",{type:"drag-default"})}}},e.MiddlewareRuler=e=>{const{boardContent:t,viewer:i,eventHub:o}=e,{helperContext:n,underContext:a}=t;let r=!0,s=!0;const l=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(r=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(s=e.showGrid),"boolean"!=typeof(null==e?void 0:e.show)&&"boolean"!=typeof(null==e?void 0:e.showGrid)||i.drawFrame()};return{name:"@middleware/ruler",use(){o.on(Yo,l)},disuse(){o.off(Yo,l)},beforeDrawFrame:({snapshot:e})=>{if(!0===r){const t=he(e),i=ce(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,Co),e.lineTo(Co,Co),e.lineTo(Co,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 Bo({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<Co||(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=ko,e.stroke(),o.isKeyNum&&(e.fillStyle=Oo,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:jo}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(n,{scaleList:o});const r=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:a}=i;return Bo({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<Co)&&(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=ko,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===n.showNum)){const t=o,i=n.position+o,a=`${n.num}`;fe(e,-90,{x:t,y:i},(()=>{e.fillStyle=Oo,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:jo}),e.fillText(a,13.2,n.position+o)}))}}}(n,{scaleList:r}),!0===s&&function(e,t){const{xList:i,yList:o,viewSizeInfo:n}=t,{width:a,height:r}=n;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,r),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=Lo:e.strokeStyle=Do,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=Lo:e.strokeStyle=Do,e.lineWidth=1,e.closePath(),e.stroke()}}(a,{xList:o,yList:r,viewScaleInfo:t,viewSizeInfo:i})}}}},e.MiddlewareScaler=e=>{const{viewer:t,sharer:i,eventHub:o}=e;return{name:"@middleware/scaler",wheelScale(e){const{deltaY:n,point:a}=e,{scale:r}=i.getActiveViewScaleInfo();let s=r;if(n<0?s=1.1*r:n>0&&(s=.9*r),s<.05||s>50)return;const{moveX:l,moveY:h}=t.scale({scale:s,point:a});t.scroll({moveX:l,moveY:h}),t.drawFrame();const c=De(r);o.trigger(Eo,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(po,null),o.setSharedStorage(xo,null);const a=()=>{o.setSharedStorage(So,null),o.setSharedStorage(bo,null),o.setSharedStorage(Ao,null)};a();const r=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&Po(e,t,n)?o="X":a&&Po(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(po),yThumbRect:o.getSharedStorage(xo)});return{name:"@middleware/scroller",wheel:e=>{t.scroll({moveX:0-e.deltaX,moveY:0-e.deltaY}),t.drawFrame()},pointStart:e=>{const{point:t}=e,i=r(t);if("X"===i||"Y"===i)return o.setSharedStorage(Ao,i),o.setSharedStorage(So,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Ao);if("X"===n||"Y"===n)return o.setSharedStorage(bo,i),"X"===n?(e=>{const i=o.getSharedStorage(So);if(i){const{offsetLeft:n,offsetRight:a}=o.getActiveViewScaleInfo(),{width:r}=o.getActiveViewSizeInfo(),s=-(e.x-i.x)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveX:s}),t.drawFrame()}})(i):"Y"===n&&(e=>{const i=o.getSharedStorage(So);if(i){const{offsetTop:n,offsetBottom:a}=o.getActiveViewScaleInfo(),{height:r}=o.getActiveViewSizeInfo(),s=-(e.y-i.y)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveY:s}),t.drawFrame()}})(i),o.setSharedStorage(So,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Ao);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=Wo(n,{snapshot:e});o.setSharedStorage(po,t),o.setSharedStorage(xo,i)}}},e.MiddlewareSelector=e=>{const{viewer:t,sharer:i,boardContent:o,calculator:n,eventHub:a}=e,{helperContext:r}=o;let s=null,l=null;i.setSharedStorage(Gi,null);const h=()=>i.getSharedStorage(Qi),c=e=>{let t=i.getSharedStorage($i);Array.isArray(t)||(t=[]),t.length>0?!function(e,t){var i;if("group"===(null==t?void 0:t.type)&&Array.isArray(null==(i=null==t?void 0:t.detail)?void 0:i.children))for(let i=0;i<t.detail.children.length;i++){const o=t.detail.children[i];if(e.uuid===o.uuid)return!0}return!1}(e,t[t.length-1])?t=[]:t.push(e):0===t.length&&t.push(e);const o=Ee(t);return i.setSharedStorage($i,t),i.setSharedStorage(Ki,o),t.length>0},d=e=>{i.setSharedStorage(Zi,e);let t=null;e&&(t=Ce(e,{groupQueue:i.getSharedStorage($i)})),i.setSharedStorage(Xi,t)},f=(e,t)=>{if(i.setSharedStorage(Qi,e),1===e.length){const t=Oe(e[0],{groupQueue:i.getSharedStorage($i),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Ui,t)}else i.setSharedStorage(Ui,null);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(wo,{uuids:e.map((e=>e.uuid))})},u=()=>({ctx:r,calculator:n,data:i.getActiveStorage("data"),selectedElements:h(),viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage($i),areaSize:null,selectedElementController:i.getSharedStorage(Ui)}),g=()=>{i.setSharedStorage(Gi,null),i.setSharedStorage(Vi,null),i.setSharedStorage(Ni,null),i.setSharedStorage(Hi,null),i.setSharedStorage($i,[]),i.setSharedStorage(Ki,[]),i.setSharedStorage(Zi,null),i.setSharedStorage(Xi,null),i.setSharedStorage(Qi,[]),i.setSharedStorage(Ji,null),i.setSharedStorage(Ui,null)};g();const v=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage(Gi),r=i.getActiveStorage("data");n=o&&Array.isArray(o)?function(e,t){const i=[];return e.forEach((e=>{const o=function(e,t){let i=null,o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t<e.length-1&&"group"===n.type)o=n.detail.children;else{if(t!==e.length-1)break;i=n}}return i}(e,t);o&&i.push(o)})),i}(o,(null==r?void 0:r.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let a=0;a<o.length;a++){const r=o[a];e.includes(r.uuid)?i.push(r):"group"===r.type&&t((null===(n=null==r?void 0:r.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==r?void 0:r.elements)||[]);let s=!1;if(a||1!==n.length?"select"===a&&1===n.length&&(s=!0):(i.setSharedStorage(Gi,"select"),s=!0),s){const e=function(e,t){const i=[];return function e(t,o){var n;let a=null;for(let r=0;r<o.length;r++){const s=o[r];if(s.uuid===t){a=s;break}if(!a&&"group"===s.type){i.push(s);const o=e(t,(null===(n=null==s?void 0:s.detail)||void 0===n?void 0:n.children)||[]);if((null==o?void 0:o.uuid)===t){a=o;break}i.pop()}}return a}(e,t),i}(n[0].uuid,(null==r?void 0:r.elements)||[]);i.setSharedStorage($i,e),f(n),t.drawFrame()}},w=()=>{g(),t.drawFrame()};return{name:"@middleware/selector",use(){a.on(wo,v),a.on(mo,w)},disuse(){a.off(wo,v),a.off(mo,w)},hover:e=>{var o,s,c,f,g;const v=i.getSharedStorage(Vi),w=i.getSharedStorage(Gi),m=i.getSharedStorage($i),y=e=>{const t=e.type;null===l&&a.trigger("cursor",{type:t,groupQueue:e.groupQueue,element:e.elements[0]})};if((null==m?void 0:m.length)>0){if(!ho(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage($i)}))return d(null),void t.drawFrame();const n=co(e.point,u());return y(n),v||["area","drag","drag-list"].includes(w)?(d(null),void t.drawFrame()):1===(null==(o=null==n?void 0:n.elements)?void 0:o.length)?(d(n.elements[0]),void t.drawFrame()):(d(null),void t.drawFrame())}if(v||["area","drag","drag-list"].includes(w))return void d(null);if("drag"===w)return void d(null);const p=h(),x=i.getActiveViewScaleInfo(),S=i.getActiveViewSizeInfo(),b=co(e.point,{...u(),areaSize:uo(p,{viewScaleInfo:x,viewSizeInfo:S,calculator:n})});return y(b),null===b.type||"over-element"===b.type&&"select"===i.getSharedStorage(Gi)&&1===b.elements.length&&b.elements[0].uuid===(null==(c=null==(s=h())?void 0:s[0])?void 0:c.uuid)||"over-element"===b.type&&null===i.getSharedStorage(Gi)&&1===b.elements.length&&b.elements[0].uuid===(null==(f=i.getSharedStorage(Zi))?void 0:f.uuid)?void 0:"over-element"===b.type&&1===(null==(g=null==b?void 0:b.elements)?void 0:g.length)?(d(b.elements[0]),void t.drawFrame()):i.getSharedStorage(Zi)?(d(null),void t.drawFrame()):void 0},pointStart:e=>{var o,a,l,c,v,w,m,y,p,x;s=e.point;const S=i.getSharedStorage($i);if((null==S?void 0:S.length)>0){if(ho(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:S})){const t=co(e.point,u());if(1===(null==(o=null==t?void 0:t.elements)?void 0:o.length)&&!0===(null==(l=null==(a=t.elements[0])?void 0:a.operations)?void 0:l.lock))return;d(null),"over-element"===t.type&&1===(null==(c=null==t?void 0:t.elements)?void 0:c.length)?(f([t.elements[0]],{triggerEvent:!0}),i.setSharedStorage(Gi,"drag")):(null==(v=t.type)?void 0:v.startsWith("resize-"))?(i.setSharedStorage(Vi,t.type),i.setSharedStorage(Gi,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const b=uo(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),A=co(e.point,{...u(),areaSize:b,groupQueue:[]});1===(null==(w=null==A?void 0:A.elements)?void 0:w.length)&&!0===(null==(y=null==(m=A.elements[0])?void 0:m.operations)?void 0:y.lock)||(d(null),"list-area"===A.type?i.setSharedStorage(Gi,"drag-list"):"over-element"===A.type&&1===(null==(p=null==A?void 0:A.elements)?void 0:p.length)?(f([A.elements[0]],{triggerEvent:!0}),i.setSharedStorage(Gi,"drag")):(null==(x=A.type)?void 0:x.startsWith("resize-"))?(i.setSharedStorage(Vi,A.type),i.setSharedStorage(Gi,"resize")):(g(),i.setSharedStorage(Gi,"area"),i.setSharedStorage(Ni,e.point),f([],{triggerEvent:!0})),t.drawFrame())},pointMove:e=>{var o,n,a;const r=i.getActiveStorage("data"),c=h(),d=i.getActiveStorage("scale")||1,u=i.getActiveViewScaleInfo(),g=i.getActiveViewSizeInfo(),v=s,w=e.point,m=i.getSharedStorage(Vi),y=i.getSharedStorage(Gi),p=i.getSharedStorage($i);if("drag"===y){if(l="drag",r&&1===(null==c?void 0:c.length)&&v&&w&&!0!==(null==(n=null==(o=c[0])?void 0:o.operations)?void 0:n.lock)){const{moveX:e,moveY:t}=function(e,t,i){let o=t.x-e.x,n=t.y-e.y;const a=[];if(i.forEach((e=>{const{x:t,y:i,w:o,h:n,angle:r=0}=e;a.push({x:t,y:i,w:o,h:n,angle:0-r})})),(null==i?void 0:i.length)>0){const i=ye(e,a),r=ye(t,a);o=r.x-i.x,n=r.y-i.y}return{moveX:o,moveY:n}}(v,w,p);c[0].x+=e/d,c[0].y+=t/d,f([c[0]])}t.drawFrame()}else if("drag-list"===y){if(l="drag-list",r&&v&&w&&(null==c?void 0:c.length)>1){const e=(w.x-v.x)/d,t=(w.y-v.y)/d;c.forEach((i=>{var o;i&&!0!==(null==(o=null==i?void 0:i.operations)?void 0:o.lock)&&(i.x+=e,i.y+=t)})),i.setActiveStorage("data",r)}t.drawFrame()}else if("resize"===y){if(r&&1===(null==c?void 0:c.length)&&v&&(null==m?void 0:m.startsWith("resize-"))){l="resize";const e=[];p.forEach((t=>{const{x:i,y:o,w:n,h:a,angle:r=0}=t;e.push({x:i,y:o,w:n,h:a,angle:0-r})}));let o=v,n=w;if(p.length>0&&(o=ye(v,e),n=ye(w,e)),"resize-rotate"===m){const e=i.getSharedStorage(Ui),t=ve([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),o=fo(c[0],{center:t,viewScaleInfo:u,viewSizeInfo:g,start:v,end:w,resizeType:m,sharer:i});c[0].angle=o.angle}else{const e=function(e,t){var i,o,n,a,r,s,l,h,c;let{x:d,y:f,w:u,h:g,angle:v=0}=e;const w=ge({x:d,y:f,w:u,h:g,angle:v});v=be(v);const m=de(v),y=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:p,end:x,resizeType:S,scale:b}=t;let A={...p},I={...x},M={x:A.x,y:w.y},z={x:I.x,y:w.y},P={...M},R={...z},T={x:w.x,y:A.y},W={x:w.x,y:I.y},E={...T},C={...W},k=(R.x-P.x)/b,O=(R.y-P.y)/b,j=ro(k,O),D=(C.x-E.x)/b,L=(C.y-E.y)/b,B=ro(D,L);(v>0||v<0)&&(A=me(w,p,0-m),I=me(w,x,0-m),M={x:A.x,y:w.y},z={x:I.x,y:w.y},P=me(w,M,m),R=me(w,z,m),T={x:w.x,y:A.y},W={x:w.x,y:I.y},E=me(w,T,m),C=me(w,W,m),k=(R.x-P.x)/b,O=(R.y-P.y)/b,j=ro(k,O),j=so(j,O),D=(C.x-E.x)/b,L=(C.y-E.y)/b,B=ro(D,L),B=so(B,L));let Y=(x.x-p.x)/b,F=(x.y-p.y)/b;if(!0===y)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(Y),Math.abs(F));Y=(Y>=0?1:-1)*t,F=(F>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(D),Math.abs(L));D=(D>=0?1:-1)*i,L=(L>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(k),Math.abs(O));k=(k>=0?1:-1)*o,O=(O>=0?1:-1)*o/e.w*e.h}else if(["resize-top-left","resize-top-right","resize-bottom-left","resize-bottom-right"].includes(S)){{const t=Math.abs(Y);Y=(Y>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?F=Y>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(F=Y>0?-i:i)}j=Math.abs(j),B=j/e.w*e.h}switch(S){case"resize-top":if(0===v)g-F>0&&(f+=F,g-=F,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=F/e.h*e.w/2,u-=F/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){B=0-so(B,L);const e=ao(v),o=B/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){B=so(B,D);const e=ao(v-90),o=B/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){B=so(B,L);const e=ao(v-180),o=B/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){B=0-so(B,D);const e=ao(v-270),o=B/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+B>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(u+=B/e.h*e.w),g+=B,d=t-u/2,f=i-g/2)}break;case"resize-bottom":if(0===v)e.h+F>0&&(g+=F,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(d-=F/e.h*e.w/2,u+=F/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){B=so(B,L);const e=ao(v),o=B/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){B=0-so(B,D);const e=ao(v-90),o=B/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){B=so(B,D);const e=ao(v-180),o=B/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){B=so(B,D);const e=ao(v-270),o=B/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+B>0&&(!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(u+=B/e.h*e.w),g+=B,d=t-u/2,f=i-g/2)}break;case"resize-left":if(0===v)e.w-Y>0&&(d+=Y,u-=Y,!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g-=Y/e.w*e.h,f+=Y/e.w*e.h/2));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){j=0-so(j,k);const e=ao(v),o=j/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){j=so(j,k);const e=ao(v-90),o=j/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){j=so(j,O);const e=ao(v-180),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){j=so(j,O);const e=ao(v-270),o=j/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}u+j>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(g+=j/e.w*e.h),u+=j,d=t-u/2,f=i-g/2)}break;case"resize-right":if(0===v)e.w+Y>0&&(u+=Y,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(f-=Y*e.h/e.w/2,g+=Y*e.h/e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){j=so(j,O);const e=ao(v),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){j=so(j,F);const e=ao(v-90),o=j/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){j=so(j,F);const e=ao(v-180),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e),j=0-j}else if(v<360){j=so(j,Y);const e=ao(v-270),o=j/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}u+j>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=j/e.w*e.h),u+=j,d=t-u/2,f=i-g/2)}break;case"resize-top-left":if(0===v)u-Y>0&&(d+=Y,u-=Y),g-F>0&&(f+=F,g-=F);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=0-so(B,L),j=0-so(j,y?0-B:k);const i=B/2;e+=i*Math.sin(m),t-=i*Math.cos(m);const o=j/2;e-=o*Math.cos(m),t-=o*Math.sin(m)}else if(v<180){B=so(B,D),j=so(j,y?B:k);const i=ao(v-90),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){B=so(B,L),j=so(j,y?B:O);const i=ao(v-180),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){B=0-so(B,D),j=so(j,y?B:O);const i=ao(v-270),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-top-right":if(0===v)u+Y>0&&(u+=Y),g-F>0&&(f+=F,g-=F);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=0-so(B,L),j=so(j,y?B:O);const i=ao(v),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){B=so(B,D),j=so(j,y?B:O);const i=ao(v-90),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){const i=ao(v-180);B=so(B,L),j=so(j,y?B:0-k);const o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){B=0-so(B,D),j=so(j,y?B:k);const i=ao(v-270),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-bottom-left":if(0===v)e.h+F>0&&(g+=F),e.w-Y>0&&(d+=Y,u-=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=so(B,L),j=0-so(j,y?0-B:k);const i=ao(v),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<180){B=0-so(B,D),j=so(j,y?B:k);const i=ao(v-90),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){B=so(B,D),j=so(j,y?B:O);const i=ao(v-180),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){B=so(B,D),j=so(j,y?B:O);const i=ao(v-270),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-bottom-right":if(0===v)e.h+F>0&&(g+=F),e.w+Y>0&&(u+=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=so(B,L),j=so(j,y?B:O);const i=ao(v),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){B=0-so(B,D),j=so(j,y?B:F);const i=ao(v-90),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){B=so(B,D),j=so(j,y?B:0-O);const i=ao(v-180),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){B=so(B,D),j=so(j,y?B:k);const i=ao(v-270),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}}return{x:d,y:f,w:u,h:g,angle:e.angle}}(c[0],{scale:d,start:o,end:n,resizeType:m,sharer:i});c[0].x=e.x,c[0].y=e.y,"group"===c[0].type&&!0===(null==(a=c[0].operations)?void 0:a.deepResize)?function(e,t){const i=t.w&&t.w>0?t.w:e.w,o=t.h&&t.h>0?t.h:e.h,n=i/e.w,a=o/e.h;if(n===a&&1===n)return e;const r=Math.min(n,a),s=Math.max(n,a);e.w=i,e.h=o;const l={xRatio:n,yRatio:a,minRatio:r,maxRatio:s};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ge(e,l)})),Fe(e,l)}(c[0],{w:e.w,h:e.h}):(c[0].w=e.w,c[0].h=e.h)}f([c[0]]),t.drawFrame()}}else"area"===y&&(l="area",i.setSharedStorage(Hi,e.point),t.drawFrame());s=e.point},pointEnd(e){l=null;const o=i.getActiveStorage("data"),r=i.getSharedStorage(Vi),h=i.getSharedStorage(Gi),c=i.getActiveViewSizeInfo();let d=!1;if(s=null,"resize"===h&&r)i.setSharedStorage(Vi,null),d=!0;else if("area"===h){if(i.setSharedStorage(Gi,null),o){const e=i.getSharedStorage(Ni),t=i.getSharedStorage(Hi);if(e&&t){const{elements:a}=function(e,t){var i;const o=[],n=[],a=[],{calculator:r,viewScaleInfo:s,viewSizeInfo:l,start:h,end:c}=t;if(!(Array.isArray(e.elements)&&h&&c))return{indexes:o,uuids:n,elements:a};const d=Math.min(h.x,c.x),f=Math.max(h.x,c.x),u=Math.min(h.y,c.y),g=Math.max(h.y,c.y);for(let t=0;t<e.elements.length;t++){const h=e.elements[t];if(!0===(null==(i=null==h?void 0:h.operations)?void 0:i.lock))continue;const c=r.elementSize(h,s,l),v=ge(c);if(v.x>=d&&v.x<=f&&v.y>=u&&v.y<=g&&(o.push(t),n.push(h.uuid),a.push(h),c.angle&&(c.angle>0||c.angle<0))){const e=xe(c);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];c.x=Math.min(...t),c.y=Math.min(...i),c.w=Math.abs(Math.max(...t)-Math.min(...t)),c.h=Math.abs(Math.max(...i)-Math.min(...i))}}}return{indexes:o,uuids:n,elements:a}}(o,{start:e,end:t,calculator:n,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()});a.length>0&&(i.setSharedStorage(Gi,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage(Gi,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage(Gi,"select"),d=!0):i.setSharedStorage(Gi,null)}null===i.getSharedStorage(Gi)&&(g(),d=!0);(()=>{if(d){if(o&&Array.isArray(null==o?void 0:o.elements)&&["drag","drag-list"].includes(h)){const e=function(e,t,i){const o=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(){s=null,g(),t.drawFrame()},doubleClick(e){var o,n,r,s;const l=co(e.point,u());if(i.setSharedStorage(Ui,null),i.setSharedStorage(Qi,[]),1!==l.elements.length||!0!==(null==(n=null==(o=l.elements[0])?void 0:o.operations)?void 0:n.lock)){if(1===l.elements.length&&"group"===(null==(r=l.elements[0])?void 0:r.type)){if(!0===c(l.elements[0]))return i.setSharedStorage(Gi,null),void t.drawFrame()}else 1===l.elements.length&&"text"===(null==(s=l.elements[0])?void 0:s.type)&&a.trigger(go,{element:l.elements[0],groupQueue:i.getSharedStorage($i)||[],viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Gi,null)}},beforeDrawFrame({snapshot:t}){var i;const{activeStore:o,sharedStore:a}=t,{scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f,width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m}=o,y=e.sharer,p={scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f},x={width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m},S=a[Qi][0],b=a[Zi],A=a[Xi],I=a[Gi],M=a[Ni],z=a[Hi],P=a[$i],R=a[Ki],T={calculator:n,viewScaleInfo:p,viewSizeInfo:x},W=S?Oe(S,{groupQueue:P,controllerSize:10,viewScaleInfo:p}):null,E=!!(null==(i=null==b?void 0:b.operations)?void 0:i.lock);if((null==P?void 0:P.length)>0)!function(e,t,i){for(let o=0;o<t.length;o++){const n=t[o],a={borderColor:qi,borderWidth:2,background:"transparent",lineDash:[4,4]};eo(e,Pe(n,i),a)}}(r,R,T),b&&"drag"!==I&&(E?oo(r,A,{...T,controller:Oe(b,{groupQueue:P,controllerSize:10,viewScaleInfo:p})}):to(r,A,T)),!E&&S&&["select","drag","resize"].includes(I)&&no(r,W,{...T});else if(b&&"drag"!==I&&(E?oo(r,A,{...T,controller:Oe(b,{groupQueue:P,controllerSize:10,viewScaleInfo:p})}):to(r,A,T)),!E&&S&&["select","drag","resize"].includes(I))no(r,W,{...T});else if("area"===I&&M&&z)!function(e,t){const{start:i,end:o}=t;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=qi,e.fillStyle="#1976d24f",e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,i.y),e.lineTo(o.x,o.y),e.lineTo(i.x,o.y),e.closePath(),e.stroke(),e.fill()}(r,{start:M,end:z});else if(["drag-list","drag-list-end"].includes(I)){const e=uo(h(),{viewScaleInfo:y.getActiveViewScaleInfo(),viewSizeInfo:y.getActiveViewSizeInfo(),calculator:n});e&&function(e,t){const{areaSize:i}=t,{x:o,y:n,w:a,h:r}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=qi,e.fillStyle="#1976d21c",e.beginPath(),e.moveTo(o,n),e.lineTo(o+a,n),e.lineTo(o+a,n+r),e.lineTo(o,n+r),e.closePath(),e.stroke(),e.fill()}(r,{areaSize:e})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o}=e,n=i.boardContext.canvas,a=document.createElement("textarea"),r=document.createElement("div"),s=e.container||document.body,l=document.createElement("div");let h=null;r.appendChild(a),r.style.position="absolute",l.appendChild(r),l.style.position="fixed",l.style.top="0",l.style.bottom="0",l.style.left="0",l.style.right="0",l.style.display="none",s.appendChild(l);const c=()=>{l.style.display="none",h=null},d=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:a,w:r,h:s}=t,l=be(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${a}px`,o.style.width=`${r}px`,o.style.height=`${s}px`,o.style.transform=`rotate(${l}deg)`,i.appendChild(o),o},f=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:s,offsetLeft:l}=t;r.children&&Array.from(r.children).forEach((e=>{e.remove()}));let h=r;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:a,w:r,h:c}=t,f={x:i*n,y:a*n,w:r*n,h:c*n,angle:be(t.angle||0)};0===e&&(f.x+=l,f.y+=s),h=d({size:f,parent:h})}const c={...vo,...i.detail};let f=i.x*n+l,u=i.y*n+s,g=i.w*n,v=i.h*n;o.length>0&&(f=i.x*n,u=i.y*n,g=i.w*n,v=i.h*n),a.style.position="absolute",a.style.left=f-1+"px",a.style.top=u-1+"px",a.style.width=`${g+2}px`,a.style.height=`${v+2}px`,a.style.transform=`rotate(${be(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.value=c.text||"",h.appendChild(a)},u=()=>{const{left:e,top:t,width:i,height:o}=(()=>{const e=n.getBoundingClientRect(),{left:t,top:i,width:o,height:a}=e;return{left:t,top:i,width:o,height:a}})();r.style.position="absolute",r.style.overflow="hidden",r.style.top=`${t}px`,r.style.left=`${e}px`,r.style.width=`${i}px`,r.style.height=`${o}px`};l.addEventListener("click",(()=>{c()})),a.addEventListener("click",(e=>{e.stopPropagation()})),a.addEventListener("input",(e=>{h&&(h.detail.text=e.target.value||"",o.drawFrame())})),a.addEventListener("blur",(()=>{c()}));const g=e=>{var t;(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(h=e.element),(e=>{u(),f(e),l.style.display="block"})(e)};return{name:"@middleware/text-editor",use(){t.on(go,g)},disuse(){t.off(go,g)}}},e.middlewareEventRuler=Yo,e.middlewareEventScale=Eo,e.middlewareEventSelect=wo,e.middlewareEventSelectClear=mo,e.middlewareEventTextEdit=go,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|
|
1
|
+
var iDrawCore=function(e){"use strict";var t,i,o,n,a,r,s,l,h,c,d,f,u,g,v,w,m,y,p,x,S=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},b=(e,t,i)=>(S(e,t,"read from private field"),i?i.call(e):t.get(e)),A=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},I=(e,t,i,o)=>(S(e,t,"write to private field"),o?o.call(e,i):t.set(e,i),i),M=(e,t,i)=>(S(e,t,"access private method"),i);function z(e){return"string"==typeof e&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e)||/^[a-z]{1,}$/i.test(e))}function P(e,t){if(1===t)return e;let i=1;const o=/^\#[0-9a-f]{6,6}$/i;let n=e;if(o.test(e)?i=parseInt(e.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(e)&&(i=parseInt(e.substring(7,9).replace(/^\#/,"0x")),n=e.substring(0,7)),i*=t,o.test(n)&&i>0&&i<1){const e=Math.max(0,Math.min(255,Math.ceil(256*i)));n=`${n.toUpperCase()}${e.toString(16).toUpperCase()}`}return n}function R(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`}function T(e){let t=0;for(let i=0;i<e.length;i++)t+=e.charCodeAt(i)*e.charCodeAt(i)*i*i;return t.toString(16).substring(0,4)}function E(e){const t=e.length,i=Math.floor(t/2),o=e.substring(0,4).padEnd(4,"0"),n=e.substring(0,4).padEnd(4,"0");return`@assets/${T(t.toString(16).padEnd(4,o))}${T(e.substring(i-4,i).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-8,i-4).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-12,i-8).padEnd(4,o)).padEnd(4,"f")}-${T(e.substring(i-16,i-12).padEnd(4,n)).padEnd(4,"f")}-${T(e.substring(i,i+4).padEnd(4,n)).padEnd(4,"f")}${T(e.substring(i+4,i+8).padEnd(4,n)).padEnd(4,"f")}${T(n.padEnd(4,o).padEnd(4,n))}`}function W(e){return function e(t){const i=function(e){return Object.prototype.toString.call(e).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(t);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return t;if("Array"===i){const i=[];return t.forEach((t=>{i.push(e(t))})),i}if("Object"===i){const i={};Object.keys(t).forEach((o=>{i[o]=e(t[o])}));return Object.getOwnPropertySymbols(t).forEach((o=>{i[o]=e(t[o])})),i}}(e)}function C(e){return(Object.prototype.toString.call(e)||"").replace(/(\[object|\])/gi,"").trim()}const k={type(e,t){const i=C(e);return!0===t?i.toLocaleLowerCase():i},array:e=>"Array"===C(e),json:e=>"Object"===C(e),function:e=>"Function"===C(e),asyncFunction:e=>"AsyncFunction"===C(e),boolean:e=>"Boolean"===C(e),string:e=>"String"===C(e),number:e=>"Number"===C(e),undefined:e=>"Undefined"===C(e),null:e=>"Null"===C(e),promise:e=>"Promise"===C(e)};var O=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))};const{Image:j}=window;function D(e){return new Promise(((t,i)=>{const o=new j;o.crossOrigin="anonymous",o.onload=function(){t(o)},o.onabort=i,o.onerror=i,o.src=e}))}function L(e){return O(this,void 0,void 0,(function*(){const t=yield function(e){return new Promise(((t,i)=>{const o=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n=new FileReader;n.readAsDataURL(o),n.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},n.onerror=function(e){i(e)}}))}(e);return yield D(t)}))}function B(e,t){return O(this,void 0,void 0,(function*(){e=e.replace(/\&/gi,"&");const i=yield function(e,t){const{width:i,height:o}=t;return new Promise(((t,n)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${o||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${e}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),r=new FileReader;r.readAsDataURL(a),r.onload=function(e){var i;const o=null===(i=null==e?void 0:e.target)||void 0===i?void 0:i.result;t(o)},r.onerror=function(e){n(e)}}))}(e,t);return yield D(i)}))}function F(e){return"number"==typeof e&&(e>0||e<=0)}function Y(e){return"number"==typeof e&&e>=0}function G(e){return"string"==typeof e&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${e}`)}function N(e){return"string"==typeof e&&/^(data:image\/)/.test(`${e}`)}const V={x:function(e){return F(e)},y:function(e){return F(e)},w:Y,h:function(e){return"number"==typeof e&&e>=0},angle:function(e){return"number"==typeof e&&e>=-360&&e<=360},number:F,numberStr:function(e){return/^(-?\d+(?:\.\d+)?)$/.test(`${e}`)},borderWidth:function(e){return Y(e)},borderRadius:function(e){return F(e)&&e>=0},color:function(e){return z(e)},imageSrc:function(e){return N(e)||G(e)},imageURL:G,imageBase64:N,svg:function(e){return"string"==typeof e&&/^(<svg[\s]{1,}|<svg>)/i.test(`${e}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${e}`.trim())},html:function(e){let t=!1;if("string"==typeof e){let i=document.createElement("div");i.innerHTML=e,i.children.length>0&&(t=!0),i=null}return t},text:function(e){return"string"==typeof e},fontSize:function(e){return F(e)&&e>0},lineHeight:function(e){return F(e)&&e>0},textAlign:function(e){return["center","left","right"].includes(e)},fontFamily:function(e){return"string"==typeof e&&e.length>0},fontWeight:function(e){return["bold"].includes(e)},strokeWidth:function(e){return F(e)&&e>0}};var H,Z,X=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Q=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class J{constructor(e,t){H.set(this,void 0),Z.set(this,void 0),X(this,H,e,"f"),X(this,Z,Object.assign({devicePixelRatio:1,offscreenCanvas:null},t),"f"),this.$resetFont()}$undoPixelRatio(e){return e/Q(this,Z,"f").devicePixelRatio}$doPixelRatio(e){return Q(this,Z,"f").devicePixelRatio*e}$getContext(){return Q(this,H,"f")}$setContext(e){X(this,H,e,"f")}$setFont(e){const t=[];e.fontWeight&&t.push(`${e.fontWeight}`),t.push(`${this.$doPixelRatio(e.fontSize||12)}px`),t.push(`${e.fontFamily||"sans-serif"}`),Q(this,H,"f").font=`${t.join(" ")}`}$resetFont(){this.$setFont({fontSize:12,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",fontWeight:"400"})}$getOffscreenCanvas(){return Q(this,Z,"f").offscreenCanvas}$resize(e){const{width:t,height:i,devicePixelRatio:o,resetStyle:n}=e,{canvas:a}=Q(this,H,"f");a.width=t*o,a.height=i*o,X(this,Z,Object.assign(Object.assign({},Q(this,Z,"f")),{devicePixelRatio:o}),"f"),!0===n&&(a.style.width=`${t}px`,a.style.height=`${i}px`)}$getSize(){const{devicePixelRatio:e}=Q(this,Z,"f"),{width:t,height:i}=Q(this,H,"f").canvas;return{width:t/e,height:i/e,devicePixelRatio:e}}get canvas(){return Q(this,H,"f").canvas}get fillStyle(){return Q(this,H,"f").fillStyle}set fillStyle(e){Q(this,H,"f").fillStyle=e}get strokeStyle(){return Q(this,H,"f").strokeStyle}set strokeStyle(e){Q(this,H,"f").strokeStyle=e}get lineWidth(){return this.$undoPixelRatio(Q(this,H,"f").lineWidth)}set lineWidth(e){Q(this,H,"f").lineWidth=this.$doPixelRatio(e)}get textAlign(){return Q(this,H,"f").textAlign}set textAlign(e){Q(this,H,"f").textAlign=e}get textBaseline(){return Q(this,H,"f").textBaseline}set textBaseline(e){Q(this,H,"f").textBaseline=e}get globalAlpha(){return Q(this,H,"f").globalAlpha}set globalAlpha(e){Q(this,H,"f").globalAlpha=e}get shadowColor(){return Q(this,H,"f").shadowColor}set shadowColor(e){Q(this,H,"f").shadowColor=e}get shadowOffsetX(){return this.$undoPixelRatio(Q(this,H,"f").shadowOffsetX)}set shadowOffsetX(e){Q(this,H,"f").shadowOffsetX=this.$doPixelRatio(e)}get shadowOffsetY(){return this.$undoPixelRatio(Q(this,H,"f").shadowOffsetY)}set shadowOffsetY(e){Q(this,H,"f").shadowOffsetY=this.$doPixelRatio(e)}get shadowBlur(){return this.$undoPixelRatio(Q(this,H,"f").shadowBlur)}set shadowBlur(e){Q(this,H,"f").shadowBlur=this.$doPixelRatio(e)}get lineCap(){return Q(this,H,"f").lineCap}set lineCap(e){Q(this,H,"f").lineCap=e}get globalCompositeOperation(){return Q(this,H,"f").globalCompositeOperation}set globalCompositeOperation(e){Q(this,H,"f").globalCompositeOperation=e}fill(...e){return Q(this,H,"f").fill(...e)}arc(e,t,i,o,n,a){return Q(this,H,"f").arc(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),o,n,a)}rect(e,t,i,o){return Q(this,H,"f").rect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}fillRect(e,t,i,o){return Q(this,H,"f").fillRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}clearRect(e,t,i,o){return Q(this,H,"f").clearRect(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}beginPath(){return Q(this,H,"f").beginPath()}closePath(){return Q(this,H,"f").closePath()}lineTo(e,t){return Q(this,H,"f").lineTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}moveTo(e,t){return Q(this,H,"f").moveTo(this.$doPixelRatio(e),this.$doPixelRatio(t))}arcTo(e,t,i,o,n){return Q(this,H,"f").arcTo(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n))}getLineDash(){return Q(this,H,"f").getLineDash()}setLineDash(e){const t=e.map((e=>this.$doPixelRatio(e)));return Q(this,H,"f").setLineDash(t)}stroke(e){return e?Q(this,H,"f").stroke(e):Q(this,H,"f").stroke()}translate(e,t){return Q(this,H,"f").translate(this.$doPixelRatio(e),this.$doPixelRatio(t))}rotate(e){return Q(this,H,"f").rotate(e)}drawImage(...e){const t=e[0],i=e[1],o=e[2],n=e[3],a=e[4],r=e[e.length-4],s=e[e.length-3],l=e[e.length-2],h=e[e.length-1];return 9===e.length?Q(this,H,"f").drawImage(t,this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a),this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h)):Q(this,H,"f").drawImage(t,this.$doPixelRatio(r),this.$doPixelRatio(s),this.$doPixelRatio(l),this.$doPixelRatio(h))}createPattern(e,t){return Q(this,H,"f").createPattern(e,t)}measureText(e){return Q(this,H,"f").measureText(e)}fillText(e,t,i,o){return void 0!==o?Q(this,H,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,H,"f").fillText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}strokeText(e,t,i,o){return void 0!==o?Q(this,H,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o)):Q(this,H,"f").strokeText(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}save(){Q(this,H,"f").save()}restore(){Q(this,H,"f").restore()}scale(e,t){Q(this,H,"f").scale(e,t)}circle(e,t,i,o,n,a,r,s){Q(this,H,"f").ellipse(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),n,a,r,s)}isPointInPath(e,t){return Q(this,H,"f").isPointInPath(this.$doPixelRatio(e),this.$doPixelRatio(t))}clip(...e){return Q(this,H,"f").clip(...e)}setTransform(e,t,i,o,n,a){return Q(this,H,"f").setTransform(e,t,i,o,n,a)}getTransform(){return Q(this,H,"f").getTransform()}createLinearGradient(e,t,i,o){return Q(this,H,"f").createLinearGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o))}createRadialGradient(e,t,i,o,n,a){return Q(this,H,"f").createRadialGradient(this.$doPixelRatio(e),this.$doPixelRatio(t),this.$doPixelRatio(i),this.$doPixelRatio(o),this.$doPixelRatio(n),this.$doPixelRatio(a))}createConicGradient(e,t,i){return Q(this,H,"f").createConicGradient(e,this.$doPixelRatio(t),this.$doPixelRatio(i))}}function U(e){const{width:t,height:i,ctx:o,devicePixelRatio:n}=e;let a=o;if(!a){const e=document.createElement("canvas");e.width=t*n,e.height=i*n,a=e.getContext("2d")}return new J(a,e)}function $(e){const{width:t,height:i,devicePixelRatio:o}=e,n=new OffscreenCanvas(t*o,i*o),a=n.getContext("2d").canvas.getContext("2d");return new J(a,{devicePixelRatio:o,offscreenCanvas:n})}H=new WeakMap,Z=new WeakMap;var K,q=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class _{constructor(){K.set(this,void 0),function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===o?n.call(e,i):n?n.value=i:t.set(e,i)}(this,K,new Map,"f")}on(e,t){if(q(this,K,"f").has(e)){const i=q(this,K,"f").get(e)||[];null==i||i.push(t),q(this,K,"f").set(e,i)}else q(this,K,"f").set(e,[t])}off(e,t){if(q(this,K,"f").has(e)){const i=q(this,K,"f").get(e);if(Array.isArray(i))for(let e=0;e<(null==i?void 0:i.length);e++)if(i[e]===t){i.splice(e,1);break}q(this,K,"f").set(e,i||[])}}trigger(e,t){const i=q(this,K,"f").get(e);return!!Array.isArray(i)&&(i.forEach((e=>{e(t)})),!0)}has(e){if(q(this,K,"f").has(e)){const t=q(this,K,"f").get(e);if(Array.isArray(t)&&t.length>0)return!0}return!1}destroy(){this.clear()}clear(){q(this,K,"f").clear()}}function ee(e,t){return{x:e.x+(t.x-e.x)/2,y:e.y+(t.y-e.y)/2}}K=new WeakMap;var te,ie,oe,ne,ae=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},re=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class se{constructor(e){te.add(this),ie.set(this,void 0),oe.set(this,void 0),ae(this,oe,W(e.defaultStorage),"f"),ae(this,ie,re(this,te,"m",ne).call(this),"f")}set(e,t){re(this,ie,"f")[e]=t}get(e){return re(this,ie,"f")[e]}getSnapshot(){return re(this,ie,"f")}clear(){ae(this,ie,re(this,te,"m",ne).call(this),"f")}destroy(){ae(this,ie,null,"f")}}function le(e){const{activeStore:t}=e;return{scale:null==t?void 0:t.scale,offsetTop:null==t?void 0:t.offsetTop,offsetBottom:null==t?void 0:t.offsetBottom,offsetLeft:null==t?void 0:t.offsetLeft,offsetRight:null==t?void 0:t.offsetRight}}function he(e){const{activeStore:t}=e;return{devicePixelRatio:t.devicePixelRatio,width:null==t?void 0:t.width,height:null==t?void 0:t.height,contextWidth:null==t?void 0:t.contextWidth,contextHeight:null==t?void 0:t.contextHeight}}function ce(e){return e/180*Math.PI}function de(e,t,i,o){const n=ce(t||0);i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(n),e.translate(-i.x,-i.y)),o(e),i&&(n>0||n<0)&&(e.translate(i.x,i.y),e.rotate(-n),e.translate(-i.x,-i.y))}function fe(e,t,i){const o=ue(t);de(e,t.angle||0,o,(()=>{i(e)}))}function ue(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function ge(e){const t=Math.min(e[0].x,e[1].x,e[2].x,e[3].x),i=Math.min(e[0].y,e[1].y,e[2].y,e[3].y);return ue({x:t,y:i,w:Math.max(e[0].x,e[1].x,e[2].x,e[3].x)-t,h:Math.max(e[0].y,e[1].y,e[2].y,e[3].y)-i})}function ve(e,t){const i=t.x-e.x,o=t.y-e.y;if(0===i){if(o<0)return 0;if(o>0)return Math.PI}else if(0===o){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&o<0?Math.atan(Math.abs(i)/Math.abs(o)):i>0&&o>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(o)):i<0&&o<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(o)):0}function we(e,t,i){let o=ve(e,t)+i;o>2*Math.PI?o-=2*Math.PI:o<0-2*Math.PI&&(o+=2*Math.PI),o<0&&(o+=2*Math.PI);const n=function(e,t){const i=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y);return 0===i?i:Math.sqrt(i)}(e,t);let a=0,r=0;return 0===o?(a=0,r=0-n):o>0&&o<Math.PI/2?(a=Math.sin(o)*n,r=0-Math.cos(o)*n):o===Math.PI/2?(a=n,r=0):o>Math.PI/2&&o<Math.PI?(a=Math.sin(Math.PI-o)*n,r=Math.cos(Math.PI-o)*n):o===Math.PI?(a=0,r=n):o>Math.PI&&o<1.5*Math.PI?(a=0-Math.sin(o-Math.PI)*n,r=Math.cos(o-Math.PI)*n):o===1.5*Math.PI?(a=0-n,r=0):o>1.5*Math.PI&&o<2*Math.PI?(a=0-Math.sin(2*Math.PI-o)*n,r=0-Math.cos(2*Math.PI-o)*n):o===2*Math.PI&&(a=0,r=0-n),a+=e.x,r+=e.y,{x:a,y:r}}function me(e,t){if((null==t?void 0:t.length)>0){let i=e.x,o=e.y;return t.forEach((e=>{const{x:t,y:n,w:a,h:r,angle:s=0}=e,l=we(ue({x:t,y:n,w:a,h:r,angle:s}),{x:i,y:o},ce(s));i=l.x,o=l.y})),{x:i,y:o}}return e}function ye(e,t,i){const{x:o,y:n,w:a,h:r}=e;let s={x:o,y:n},l={x:o+a,y:n},h={x:o+a,y:n+r},c={x:o,y:n+r};if(i&&(i>0||i<0)){const e=ce(Se(i));s=we(t,s,e),l=we(t,l,e),h=we(t,h,e),c=we(t,c,e)}return[s,l,h,c]}function pe(e){const{angle:t=0}=e;return ye(e,ue(e),t)}function xe(e,t,i){return[we(e,{x:t[0].x,y:t[0].y},i),we(e,{x:t[1].x,y:t[1].y},i),we(e,{x:t[2].x,y:t[2].y},i),we(e,{x:t[3].x,y:t[3].y},i)]}function Se(e){if(!(e>0||e<0)||0===e)return 0;let t=e%360;return t<0&&(t+=360),t}function be(e){let t=!0;if(Array.isArray(e)){const i=[];e.forEach((e=>{var o;"string"==typeof e.uuid&&e.uuid?i.includes(e.uuid)?(t=!1,console.warn(`Duplicate uuids: ${e.uuid}`)):i.push(e.uuid):(t=!1,console.warn("Element missing uuid",e)),"group"===e.type&&(t=be(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.children))}))}return t}function Ae(e,t){const i={x:0,y:0,w:0,h:0};e.forEach((e=>{const t={x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle};if(t.angle&&(t.angle>0||t.angle<0)){const e=pe(t);if(4===e.length){const i=[e[0].x,e[1].x,e[2].x,e[3].x],o=[e[0].y,e[1].y,e[2].y,e[3].y];t.x=Math.min(...i),t.y=Math.min(...o),t.w=Math.abs(Math.max(...i)-Math.min(...i)),t.h=Math.abs(Math.max(...o)-Math.min(...o))}}const o=Math.min(t.x,i.x),n=Math.min(t.y,i.y),a=Math.max(t.x+t.w,i.x+i.w),r=Math.max(t.y+t.h,i.y+i.h);i.x=o,i.y=n,i.w=Math.abs(a-o),i.h=Math.abs(r-n)})),(null==t?void 0:t.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const o={contextWidth:i.w,contextHeight:i.h};return(null==t?void 0:t.viewWidth)&&(null==t?void 0:t.viewHeight)&&(null==t?void 0:t.viewWidth)>0&&(null==t?void 0:t.viewHeight)>0&&(t.viewWidth>i.x+i.w&&(o.contextWidth=t.viewWidth-i.x),t.viewHeight>i.y+i.h&&(o.contextHeight=t.viewHeight-i.y)),o}function Ie(e,t){const i=[];let o=!1;const n=t=>{var a;for(let r=0;r<t.length&&!0!==o;r++){i.push(r);const s=t[r];if(s.uuid===e){o=!0;break}if("group"===s.type&&n((null===(a=null==s?void 0:s.detail)||void 0===a?void 0:a.children)||[]),o)break;i.pop()}};return n(t),i}function Me(e){const{x:t,y:i,h:o,w:n}=e;return[{x:t,y:i},{x:t+n,y:i},{x:t+n,y:i+o},{x:t,y:i+o}]}function ze(e){const{x:t,y:i,w:o,h:n,angle:a=0}=e;return 0===a?Me(e):ye(e,ue({x:t,y:i,w:o,h:n,angle:a}),a)}function Pe(e){const t=[];let i=0,o=0;const n=[],a=[...e];for(let e=0;e<a.length;e++){const{x:r,y:s,w:l,h:h,angle:c=0}=a[e];let d;if(i+=r,o+=s,0===e){const e={x:i,y:o,w:l,h:h,angle:c};d=ze({x:r,y:s,w:l,h:h,angle:c}),n.push({center:ue(e),angle:c,radian:ce(c)})}else{d=Me({x:i,y:o,w:l,h:h,angle:c});for(let e=0;e<n.length;e++){const{center:t,radian:i}=n[e];d=xe(t,d,i)}const e=ge(d);if(c>0||c<0){d=xe(e,d,ce(c))}n.push({center:e,angle:c,radian:ce(c)})}t.push(d)}return t}function Re(e,t){const i=function(e,t){const{groupQueue:i}=t;return i.length>0?Pe([...i,e]):[ze(e)]}(e,t);return i.pop()||null}function Te(e,t){const{viewScaleInfo:i}=t,{x:o,y:n,w:a,h:r,angle:s}=e,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:o*l+c,y:n*l+h,w:a*l,h:r*l,angle:s}}function Ee(e,t){const{viewScaleInfo:i}=t,{x:o,y:n}=e,{scale:a,offsetTop:r,offsetLeft:s}=i;return{x:o*a+s,y:n*a+r}}function We(e,t){return[Ee(e[0],t),Ee(e[1],t),Ee(e[2],t),Ee(e[3],t)]}function Ce(e,t){const{context2d:i,element:o,viewScaleInfo:n,viewSizeInfo:a}=t,{angle:r=0}=o,{x:s,y:l,w:h,h:c}=Te(o,{viewScaleInfo:n,viewSizeInfo:a}),d=pe({x:s,y:l,w:h,h:c,angle:r});if(d.length>=2){i.beginPath(),i.moveTo(d[0].x,d[0].y);for(let e=1;e<d.length;e++)i.lineTo(d[e].x,d[e].y);i.closePath()}return!!i.isPointInPath(e.x,e.y)}function ke(e,t){const{x:i,y:o}=e,{size:n,angle:a}=t;return{x:i-n/2,y:o-n/2,w:n,h:n,angle:a}}function Oe(e,t){const{groupQueue:i,controllerSize:o,viewScaleInfo:n}=t,a=(o&&o>0?o:8)/n.scale,{x:r,y:s,w:l,h:h,angle:c=0}=e,d=[{uuid:R(),x:r,y:s,w:l,h:h,angle:c,type:"group",detail:{children:[]}},...i];let f=0;d.forEach((({angle:e=0})=>{f+=e}));const u=Re(e,{groupQueue:i}),g=Re({x:r-2*a,y:s-2*a,h:h+4*a,w:l+4*a,angle:c},{groupQueue:[...i]}),v=ee(u[0],u[1]),w=ee(u[1],u[2]),m=ee(u[2],u[3]),y=ee(u[3],u[0]),p=u[0],x=u[1],S=u[2],b=u[3],A=ke(v,{size:a,angle:f}),I=ke(w,{size:a,angle:f}),M=ke(m,{size:a,angle:f}),z=ke(y,{size:a,angle:f}),P=ke(p,{size:a,angle:f}),T=ke(x,{size:a,angle:f}),E=ke(b,{size:a,angle:f}),W=ke(S,{size:a,angle:f}),C=ze(P),k=ze(T),O=ze(E),j=ze(W),D=[C[1],k[0],k[3],C[2]],L=[k[3],k[2],j[1],j[0]],B=[O[1],j[0],j[3],O[2]],F=[C[3],C[2],O[1],O[0]],Y=ze(A),G=ze(I),N=ze(M),V=ze(z),H=ee(g[0],g[1]);return{elementWrapper:u,left:{type:"left",vertexes:F,center:y},right:{type:"right",vertexes:L,center:w},top:{type:"top",vertexes:D,center:v},bottom:{type:"bottom",vertexes:B,center:m},topLeft:{type:"top-left",vertexes:C,center:p},topRight:{type:"top-right",vertexes:k,center:x},bottomLeft:{type:"bottom-left",vertexes:O,center:b},bottomRight:{type:"bottom-right",vertexes:j,center:S},leftMiddle:{type:"left-middle",vertexes:V,center:y},rightMiddle:{type:"right-middle",vertexes:G,center:w},topMiddle:{type:"top-middle",vertexes:Y,center:v},bottomMiddle:{type:"bottom-middle",vertexes:N,center:m},rotate:{type:"rotate",vertexes:ze(ke(H,{size:a,angle:f})),center:H}}}function je(e){let t="";return e.forEach((e=>{t+=e.type+e.params.join(" ")})),t}function De(e,t){let i=2;return void 0!==(null==t?void 0:t.decimalPlaces)&&(null==t?void 0:t.decimalPlaces)>=0&&(i=t.decimalPlaces),parseFloat(e.toFixed(i))}ie=new WeakMap,oe=new WeakMap,te=new WeakSet,ne=function(){return W(re(this,oe,"f"))};const Le={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Be(e,t){const{viewScaleInfo:i}=t,{scale:o}=i;let{borderRadius:n}=e.detail;const{boxSizing:a=Le.boxSizing,borderWidth:r}=e.detail;Array.isArray(r)&&(n=0);let{x:s,y:l,w:h,h:c}=e,d=[0,0,0,0];if("number"==typeof n){const e=n*o;d=[e,e,e,e]}else Array.isArray(n)&&4===(null==n?void 0:n.length)&&(d=[n[0]*o,n[1]*o,n[2]*o,n[3]*o]);let f=0;return"number"==typeof r&&(f=(r||0)*o),"border-box"===a?(s=e.x+f/2,l=e.y+f/2,h=e.w-f,c=e.h-f):"content-box"===a?(s=e.x-f/2,l=e.y-f/2,h=e.w+f,c=e.h+f):(s=e.x,l=e.y,h=e.w,c=e.h),h=Math.max(h,1),c=Math.max(c,1),d=d.map((e=>Math.min(e,h/2,c/2))),{x:s,y:l,w:h,h:c,radiusList:d}}const Fe=e=>De(e,{decimalPlaces:4});function Ye(e,t){const{detail:i}=e,{xRatio:o,yRatio:n,maxRatio:a}=t,r=(o+n)/2,{borderWidth:s,borderRadius:l,borderDash:h,shadowOffsetX:c,shadowOffsetY:d,shadowBlur:f}=i;if("number"==typeof s)i.borderWidth=Fe(s*r);else if(Array.isArray(i.borderWidth)){const e=s;i.borderWidth=[Fe(e[0]*n),Fe(e[1]*o),Fe(e[2]*n),Fe(e[3]*o)]}if("number"==typeof l)i.borderRadius=Fe(l*r);else if(Array.isArray(i.borderRadius)){const e=l;i.borderRadius=[e[0]*o,e[1]*o,e[2]*n,e[3]*n]}Array.isArray(h)&&h.forEach(((e,t)=>{i.borderDash[t]=Fe(e*a)})),"number"==typeof c&&(i.shadowOffsetX=Fe(c*a)),"number"==typeof d&&(i.shadowOffsetX=Fe(d*a)),"number"==typeof f&&(i.shadowOffsetX=Fe(f*a))}function Ge(e,t){const{type:i}=e;!function(e,t){const{xRatio:i,yRatio:o}=t,{x:n,y:a,w:r,h:s}=e;e.x=Fe(n*i),e.y=Fe(a*o),e.w=Fe(r*i),e.h=Fe(s*o),Ye(e,t)}(e,t),"circle"===i||("text"===i?function(e,t){const{minRatio:i,maxRatio:o}=t,{fontSize:n,lineHeight:a}=e.detail,r=(i+o)/2;n&&n>0&&(e.detail.fontSize=Fe(n*r)),a&&a>0&&(e.detail.lineHeight=Fe(a*r))}(e,t):"image"===i||"svg"===i||"html"===i||"path"===i||"group"===i&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ge(e,t)})))}function Ne(e,t,i){if("string"==typeof t)return t;const{viewElementSize:o,viewScaleInfo:n,opacity:a=1}=i,{x:r,y:s}=o,{scale:l}=n;if("linear-gradient"===(null==t?void 0:t.type)){const{start:i,end:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l},c={x:r+o.x*l,y:s+o.y*l},d=e.createLinearGradient(h.x,h.y,c.x,c.y);return n.forEach((e=>{d.addColorStop(e.offset,P(e.color,a))})),d}if("radial-gradient"===(null==t?void 0:t.type)){const{inner:i,outer:o,stops:n}=t,h={x:r+i.x*l,y:s+i.y*l,radius:i.radius*l},c={x:r+o.x*l,y:s+o.y*l,radius:o.radius*l},d=e.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return n.forEach((e=>{d.addColorStop(e.offset,P(e.color,a))})),d}return"#000000"}const Ve={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function He(e){var t,i,o,n;let a=1;return void 0!==(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.opacity)&&(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.opacity)<=1&&(a=null===(n=null==e?void 0:e.detail)||void 0===n?void 0:n.opacity),a}function Ze(e,t,i){const{pattern:o,renderContent:n,originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=He(a)*h;!function(e,t,i){const{renderContent:o,originElem:n,calcElemSize:a,viewSizeInfo:r}=i,s=r.devicePixelRatio,{clipPath:l}=(null==n?void 0:n.detail)||{};if(l&&a&&l.commands){const{x:i,y:n,w:r,h:h}=a,{originW:c,originH:d,originX:f,originY:u}=l,g=r/c,v=h/d,w=i-f*g,m=n-u*v;e.save(),e.translate(w,m),e.scale(s*g,s*v);const y=je(l.commands||[]),p=new Path2D(y);e.clip(p),e.translate(0-w,0-m),e.setTransform(1,0,0,1,0,0),fe(e,Object.assign({},t),(()=>{null==o||o()})),e.restore()}else null==o||o()}(e,t,{originElem:a,calcElemSize:r,viewScaleInfo:s,viewSizeInfo:l,renderContent:()=>{e.globalAlpha=c,function(e,t,i){var o,n;const{pattern:a,viewScaleInfo:r,viewSizeInfo:s}=i,l=[];if(t.detail.background||a){const{x:i,y:h,w:c,h:d,radiusList:f}=Be(t,{viewScaleInfo:r,viewSizeInfo:s});if(e.beginPath(),e.moveTo(i+f[0],h),e.arcTo(i+c,h,i+c,h+d,f[1]),e.arcTo(i+c,h+d,i,h+d,f[2]),e.arcTo(i,h+d,i,h,f[3]),e.arcTo(i,h,i+c,h,f[0]),e.closePath(),"string"==typeof a)e.fillStyle=a;else if(["CanvasPattern"].includes(k.type(a)))e.fillStyle=a;else if("string"==typeof t.detail.background)e.fillStyle=t.detail.background;else if("linear-gradient"===(null===(o=t.detail.background)||void 0===o?void 0:o.type)){const o=Ne(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});e.fillStyle=o}else if("radial-gradient"===(null===(n=t.detail.background)||void 0===n?void 0:n.type)){const o=Ne(e,t.detail.background,{viewElementSize:{x:i,y:h,w:c,h:d},viewScaleInfo:r,opacity:e.globalAlpha});if(e.fillStyle=o,l&&l.length>0)for(let t=0;t<(null==l?void 0:l.length);t++){const o=l[t];"translate"===o.method?e.translate(o.args[0]+i,o.args[1]+h):"rotate"===o.method?e.rotate(...o.args):"scale"===o.method&&e.scale(...o.args)}}e.fill(),l&&l.length>0&&e.setTransform(1,0,0,1,0,0)}}(e,t,{pattern:o,viewScaleInfo:s,viewSizeInfo:l}),null==n||n(),function(e,t,i){if(0===t.detail.borderWidth)return;if(!z(t.detail.borderColor))return;const{viewScaleInfo:o}=i,{scale:n}=o;let a=Ve.borderColor;!0===z(t.detail.borderColor)&&(a=t.detail.borderColor);const{borderWidth:r,borderRadius:s,borderDash:l,boxSizing:h=Ve.boxSizing}=t.detail;let c=0;"number"==typeof r&&(c=r||1);c*=n;let d=[0,0,0,0];if("number"==typeof s){const e=s*n;d=[e,e,e,e]}else Array.isArray(s)&&4===(null==s?void 0:s.length)&&(d=[s[0]*n,s[1]*n,s[2]*n,s[3]*n]);e.strokeStyle=a;let f=[];Array.isArray(l)&&l.length>0&&(f=l.map((e=>Math.ceil(e*n))));let u=0,g=0,v=0,w=0;Array.isArray(r)&&(u=(r[0]||0)*n,g=(r[1]||0)*n,v=(r[2]||0)*n,w=(r[3]||0)*n);if(w||g||u||v){e.lineCap="butt";let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i+=w/2,o+=u/2,n=n-w/2-g/2,a=a-u/2-v/2):"content-box"===h?(i-=w/2,o-=u/2,n=n+w/2+g/2,a=a+u/2+v/2):(i=t.x,o=t.y,n=t.w,a=t.h),u&&(e.beginPath(),e.lineWidth=u,e.moveTo(i-w/2,o),e.lineTo(i+n+g/2,o),e.closePath(),e.stroke()),g&&(e.beginPath(),e.lineWidth=g,e.moveTo(i+n,o-u/2),e.lineTo(i+n,o+a+v/2),e.closePath(),e.stroke()),v&&(e.beginPath(),e.lineWidth=v,e.moveTo(i-w/2,o+a),e.lineTo(i+n+g/2,o+a),e.closePath(),e.stroke()),w&&(e.beginPath(),e.lineWidth=w,e.moveTo(i,o-u/2),e.lineTo(i,o+a+v/2),e.closePath(),e.stroke())}else{let{x:i,y:o,w:n,h:a}=t;"border-box"===h?(i=t.x+c/2,o=t.y+c/2,n=t.w-c,a=t.h-c):"content-box"===h?(i=t.x-c/2,o=t.y-c/2,n=t.w+c,a=t.h+c):(i=t.x,o=t.y,n=t.w,a=t.h),f.length>0?e.lineCap="butt":e.lineCap="square",n=Math.max(n,1),a=Math.max(a,1),d=d.map((e=>Math.min(e,n/2,a/2))),e.setLineDash(f),e.lineWidth=c,e.beginPath(),e.moveTo(i+d[0],o),e.arcTo(i+n,o,i+n,o+a,d[1]),e.arcTo(i+n,o+a,i,o+a,d[2]),e.arcTo(i,o+a,i,o,d[3]),e.arcTo(i,o,i+n,o,d[0]),e.closePath(),e.stroke()}e.setLineDash([])}(e,t,{viewScaleInfo:s,viewSizeInfo:l}),e.globalAlpha=h}})}function Xe(e,t,i){const{detail:o}=t,{viewScaleInfo:n,renderContent:a}=i,{shadowColor:r,shadowOffsetX:s,shadowOffsetY:l,shadowBlur:h}=o;V.number(h)?(e.save(),e.shadowColor=r||Ve.shadowColor,e.shadowOffsetX=(s||0)*n.scale,e.shadowOffsetY=(l||0)*n.scale,e.shadowBlur=(h||0)*n.scale,a(),e.restore()):(e.save(),e.shadowColor="transparent",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,a(),e.restore())}const Qe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Je(e,t,i){var o;if(!0===(null===(o=null==t?void 0:t.operations)||void 0===o?void 0:o.invisible))return;const{w:n,h:a}=t,{scale:r}=i.viewScaleInfo;if(!(r<1&&(n*r<1||a*r<1)||0===i.parentOpacity))try{switch(t.type){case"rect":!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize(t,n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{}})}})}))}(e,t,i);break;case"circle":!function(e,t,i){const{detail:o,angle:n}=t,{calculator:a,viewScaleInfo:r,viewSizeInfo:s,parentOpacity:l}=i,{background:h="#000000",borderColor:c="#000000",boxSizing:d,borderWidth:f=0}=o;let u=0;"number"==typeof f&&f>0?u=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(u=f[0]),u*=r.scale;const{x:g,y:v,w:w,h:m}=(null==a?void 0:a.elementSize({x:t.x,y:t.y,w:t.w,h:t.h},r,s))||t,y=Object.assign(Object.assign({},t),{x:g,y:v,w:w,h:m,angle:n});fe(e,{x:g,y:v,w:w,h:m,angle:n},(()=>{Xe(e,y,{viewScaleInfo:r,viewSizeInfo:s,renderContent:()=>{let t=w/2,i=m/2;const o=g+t,n=v+i;if(u>0&&("border-box"===d?(t-=u,i-=u):"center-line"===d?(t-=u/2,i-=u/2):(t-=u,i-=u)),t>=0&&i>=0){const a=He(y)*l;if(e.globalAlpha=a,"number"==typeof u&&u>0){const a=u/2+t,r=u/2+i;e.beginPath(),e.strokeStyle=c,e.lineWidth=u,e.circle(o,n,a,r,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath();const s=Ne(e,h,{viewElementSize:{x:g,y:v,w:w,h:m},viewScaleInfo:r,opacity:e.globalAlpha});e.fillStyle=s,e.circle(o,n,t,i,0,0,2*Math.PI),e.closePath(),e.fill(),e.globalAlpha=l}}})}))}(e,t,i);break;case"text":!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize(t,n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{Ze(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const i=Object.assign(Object.assign({},Qe),t.detail),o=(i.fontSize||Qe.fontSize)*n.scale,a=i.lineHeight?i.lineHeight*n.scale:o;e.fillStyle=t.detail.color||Qe.color,e.textBaseline="top",e.$setFont({fontWeight:i.fontWeight,fontSize:o,fontFamily:i.fontFamily});const r=i.text.replace(/\r\n/gi,"\n"),d=a,f=r.split("\n"),u=[];let g=0;f.forEach(((t,i)=>{let o="";if(t.length>0){for(let n=0;n<t.length&&(e.measureText(o+(t[n]||"")).width<e.$doPixelRatio(h)?o+=t[n]||"":(u.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),o=t[n]||"",g++),!((g+1)*d>c));n++)if(t.length-1===n&&(g+1)*d<c){u.push({text:o,width:e.$undoPixelRatio(e.measureText(o).width)}),i<f.length-1&&g++;break}}else u.push({text:"",width:0})}));let v=0;u.length*d<c&&("top"===t.detail.verticalAlign?v=0:"bottom"===t.detail.verticalAlign?v+=c-u.length*d:v+=(c-u.length*d)/2);{const t=l+v;void 0!==i.textShadowColor&&z(i.textShadowColor)&&(e.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&V.number(i.textShadowOffsetX)&&(e.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&V.number(i.textShadowOffsetY)&&(e.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&V.number(i.textShadowBlur)&&(e.shadowBlur=i.textShadowBlur),u.forEach(((o,n)=>{let a=s;"center"===i.textAlign?a=s+(h-o.width)/2:"right"===i.textAlign&&(a=s+(h-o.width)),e.fillText(o.text,a,t+d*n)}))}}})}))}(e,t,i);break;case"image":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t,u=Object.assign(Object.assign({},t),{x:l,y:h,w:c,h:d,angle:f});fe(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{Xe(e,u,{viewScaleInfo:a,viewSizeInfo:r,renderContent:()=>{Ze(e,u,{originElem:t,calcElemSize:{x:l,y:h,w:c,h:d,angle:f},viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s,renderContent:()=>{if(o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"image"===t.type&&o){e.globalAlpha=He(t)*s;const{x:i,y:n,w:l,h:h,radiusList:c}=Be(u,{viewScaleInfo:a,viewSizeInfo:r});e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(i+c[0],n),e.arcTo(i+l,n,i+l,n+h,c[1]),e.arcTo(i+l,n+h,i,n+h,c[2]),e.arcTo(i,n+h,i,n,c[3]),e.arcTo(i,n,i+l,n,c[0]),e.closePath(),e.fill(),e.clip(),e.drawImage(o,i,n,l,h),e.globalAlpha=s,e.restore()}}})}})}))}(e,t,i);break;case"svg":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t;fe(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"svg"===t.type&&o&&(e.globalAlpha=He(t)*s,e.drawImage(o,l,h,c,d),e.globalAlpha=s)}))}(e,t,i);break;case"html":!function(e,t,i){const o=i.loader.getContent(t),{calculator:n,viewScaleInfo:a,viewSizeInfo:r,parentOpacity:s}=i,{x:l,y:h,w:c,h:d,angle:f}=(null==n?void 0:n.elementSize(t,a,r))||t;fe(e,{x:l,y:h,w:c,h:d,angle:f},(()=>{o||i.loader.isDestroyed()||i.loader.load(t,i.elementAssets||{}),"html"===t.type&&o&&(e.globalAlpha=He(t)*s,e.drawImage(o,l,h,c,d),e.globalAlpha=s)}))}(e,t,i);break;case"path":!function(e,t,i){const{detail:o}=t,{originX:n,originY:a,originW:r,originH:s}=o,{calculator:l,viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d}=i,{x:f,y:u,w:g,h:v,angle:w}=(null==l?void 0:l.elementSize(t,h,c))||t,m=g/r,y=v/s,p=f-n*m,x=u-a*y,S=h.scale*c.devicePixelRatio,b=Object.assign(Object.assign({},t),{x:f,y:u,w:g,h:v,angle:w});fe(e,{x:f,y:u,w:g,h:v,angle:w},(()=>{Ze(e,b,{originElem:t,calcElemSize:{x:f,y:u,w:g,h:v,angle:w},viewScaleInfo:h,viewSizeInfo:c,parentOpacity:d,renderContent:()=>{Xe(e,b,{viewScaleInfo:h,viewSizeInfo:c,renderContent:()=>{e.save(),e.translate(p,x),e.scale(S*m/h.scale,S*y/h.scale);const t=je(o.commands||[]),i=new Path2D(t);o.fill&&(e.fillStyle=o.fill,e.fill(i)),o.stroke&&0!==o.strokeWidth&&(e.strokeStyle=o.stroke,e.lineWidth=(o.strokeWidth||1)/c.devicePixelRatio,e.lineCap=o.strokeLineCap||"square",e.stroke(i)),e.translate(-p,-x),e.restore()}})}})}))}(e,t,i);break;case"group":{const o=Object.assign(Object.assign({},i.elementAssets||{}),t.detail.assets||{});!function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,{x:s,y:l,w:h,h:c,angle:d}=(null==o?void 0:o.elementSize({x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle},n,a))||t,f=Object.assign(Object.assign({},t),{x:s,y:l,w:h,h:c,angle:d});fe(e,{x:s,y:l,w:h,h:c,angle:d},(()=>{e.globalAlpha=He(t)*r,Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(e,f,{originElem:t,calcElemSize:{x:s,y:l,w:h,h:c,angle:d},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{const{x:o,y:s,w:l,h:h,radiusList:c}=Be(f,{viewScaleInfo:n,viewSizeInfo:a});if("hidden"===t.detail.overflow&&(e.save(),e.fillStyle="transparent",e.beginPath(),e.moveTo(o+c[0],s),e.arcTo(o+l,s,o+l,s+h,c[1]),e.arcTo(o+l,s+h,o,s+h,c[2]),e.arcTo(o,s+h,o,s,c[3]),e.arcTo(o,s,o+l,s,c[0]),e.closePath(),e.fill(),e.clip()),Array.isArray(t.detail.children)){const{parentElementSize:o}=i,n={x:o.x+t.x,y:o.y+t.y,w:t.w||o.w,h:t.h||o.h,angle:t.angle},{calculator:a}=i;for(let o=0;o<t.detail.children.length;o++){let s=t.detail.children[o];if(s=Object.assign(Object.assign({},s),{x:n.x+s.x,y:n.y+s.y}),!0===i.forceDrawAll||(null==a?void 0:a.isElementInView(s,i.viewScaleInfo,i.viewSizeInfo)))try{Je(e,s,Object.assign(Object.assign({},i),{parentOpacity:r*He(t)}))}catch(e){console.error(e)}}}"hidden"===t.detail.overflow&&e.restore()}})}}),e.globalAlpha=r}))}(e,t,Object.assign(Object.assign({},i),{elementAssets:o}));break}}}catch(e){console.error(e)}}const Ue={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};var $e,Ke,qe,_e,et,tt,it,ot,nt,at,rt,st,lt=function(e,t,i,o){return new(i||(i=Promise))((function(n,a){function r(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}l((o=o.apply(e,t||[])).next())}))},ht=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)},ct=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i};const dt=["image","svg","html"],ft=e=>{var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),"string"==typeof n&&n?/^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${n}`)?n:E(n):E(`${R()}-${e.uuid}-${R()}-${R()}`)};class ut extends _{constructor(){super(),$e.add(this),Ke.set(this,{}),qe.set(this,{}),_e.set(this,{}),et.set(this,!1),ht(this,$e,"m",tt).call(this,"image",((e,t)=>lt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.src])||void 0===i?void 0:i.value)||e.detail.src,n=yield D(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),ht(this,$e,"m",tt).call(this,"html",((e,t)=>lt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.html])||void 0===i?void 0:i.value)||e.detail.html,n=yield B(o,{width:e.detail.originW||e.w,height:e.detail.originH||e.h});return{uuid:e.uuid,lastModified:Date.now(),content:n}})))),ht(this,$e,"m",tt).call(this,"svg",((e,t)=>lt(this,void 0,void 0,(function*(){var i;const o=(null===(i=t[e.detail.svg])||void 0===i?void 0:i.value)||e.detail.svg,n=yield L(o);return{uuid:e.uuid,lastModified:Date.now(),content:n}}))))}isDestroyed(){return ht(this,et,"f")}destroy(){ct(this,et,!0,"f"),this.clear(),ct(this,Ke,null,"f"),ct(this,qe,null,"f"),ct(this,_e,null,"f")}load(e,t){!0!==ht(this,et,"f")&&(ht(this,$e,"m",st).call(this,e)||dt.includes(e.type)&&ht(this,$e,"m",rt).call(this,e,t))}getContent(e){var t,i;const o=ft(e);return(null===(i=null===(t=ht(this,_e,"f"))||void 0===t?void 0:t[o])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return ht(this,_e,"f")}setLoadItemMap(e){ct(this,_e,e,"f")}}Ke=new WeakMap,qe=new WeakMap,_e=new WeakMap,et=new WeakMap,$e=new WeakSet,tt=function(e,t){ht(this,Ke,"f")[e]=t},it=function(e){var t,i,o;let n=null;return"image"===e.type?n=(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.src)||null:"svg"===e.type?n=(null===(i=null==e?void 0:e.detail)||void 0===i?void 0:i.svg)||null:"html"===e.type&&(n=(null===(o=null==e?void 0:e.detail)||void 0===o?void 0:o.html)||null),n},ot=function(e){return{element:e,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:ht(this,$e,"m",it).call(this,e)}},nt=function(e){const t=ft(e.element),i=ht(this,_e,"f")[t];ht(this,et,"f")||(i?i.startTime<e.startTime&&(ht(this,_e,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(ht(this,_e,"f")[t]=e,this.trigger("load",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},at=function(e){var t;const i=ft(e.element),o=null===(t=ht(this,_e,"f"))||void 0===t?void 0:t[i];ht(this,et,"f")||(o?o.startTime<e.startTime&&(ht(this,_e,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))):(ht(this,_e,"f")[i]=e,this.trigger("error",Object.assign(Object.assign({},e),{countTime:e.endTime-e.startTime}))))},rt=function(e,t){const i=ht(this,$e,"m",ot).call(this,e),o=ft(e);if(ht(this,qe,"f")[o])return;ht(this,qe,"f")[o]=i;const n=ht(this,Ke,"f")[e.type];"function"!=typeof n||ht(this,et,"f")||(i.startTime=Date.now(),n(e,t).then((e=>{ht(this,et,"f")||(i.content=e.content,i.endTime=Date.now(),i.status="load",ht(this,$e,"m",nt).call(this,i))})).catch((t=>{console.warn(`Load element source "${i.source}" fail`,t,e),i.endTime=Date.now(),i.status="error",i.error=t,ht(this,$e,"m",at).call(this,i)})))},st=function(e){var t;const i=ft(e),o=null===(t=ht(this,qe,"f"))||void 0===t?void 0:t[i];return!(!o||"error"!==o.status||!o.source||o.source!==ht(this,$e,"m",it).call(this,e))};var gt,vt,wt,mt,yt,pt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},xt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class St extends _{constructor(e){super(),gt.add(this),vt.set(this,void 0),wt.set(this,new ut),mt.set(this,!1),pt(this,vt,e,"f"),xt(this,gt,"m",yt).call(this)}isDestroyed(){return xt(this,mt,"f")}destroy(){this.clear(),pt(this,vt,null,"f"),xt(this,wt,"f").destroy(),pt(this,wt,null,"f"),pt(this,mt,!0,"f")}updateOptions(e){pt(this,vt,e,"f")}drawData(e,t){const i=xt(this,wt,"f"),{calculator:o}=xt(this,vt,"f"),n=xt(this,vt,"f").viewContext;n.clearRect(0,0,n.canvas.width,n.canvas.height);const a={x:0,y:0,w:t.viewSizeInfo.width,h:t.viewSizeInfo.height};e.underlay&&function(e,t,i){const{calculator:o,viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r}=i,s=Object.assign({uuid:"underlay"},t),{x:l,y:h,w:c,h:d}=(null==o?void 0:o.elementSize(s,n,a))||s,f=Object.assign(Object.assign({},s),{x:l,y:h,w:c,h:d,angle:0});Xe(e,f,{viewScaleInfo:n,viewSizeInfo:a,renderContent:()=>{Ze(e,f,{originElem:s,calcElemSize:{x:l,y:h,w:c,h:d,angle:0},viewScaleInfo:n,viewSizeInfo:a,parentOpacity:r,renderContent:()=>{}})}})}(n,e.underlay,Object.assign({loader:i,calculator:o,parentElementSize:a,parentOpacity:1},t)),function(e,t,i){var o;const{elements:n=[]}=t,{parentOpacity:a}=i;for(let t=0;t<n.length;t++){const r=n[t],s=Object.assign(Object.assign({},r),{detail:Object.assign(Object.assign({},Ue),null==r?void 0:r.detail)});if(!0===i.forceDrawAll||(null===(o=i.calculator)||void 0===o?void 0:o.isElementInView(s,i.viewScaleInfo,i.viewSizeInfo)))try{Je(e,s,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(e){console.error(e)}}}(n,e,Object.assign({loader:i,calculator:o,parentElementSize:a,elementAssets:e.assets,parentOpacity:1},t))}scale(e){const{sharer:t}=xt(this,vt,"f");if(!t)return;const{data:i,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r,width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}=t.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:e,offsetTop:o,offsetBottom:n,offsetLeft:a,offsetRight:r},viewSizeInfo:{width:s,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:d}})}setLoadItemMap(e){xt(this,wt,"f").setLoadItemMap(e)}getLoadItemMap(){return xt(this,wt,"f").getLoadItemMap()}getLoader(){return xt(this,wt,"f")}}vt=new WeakMap,wt=new WeakMap,mt=new WeakMap,gt=new WeakSet,yt=function(){const e=xt(this,wt,"f");e.on("load",(e=>{this.trigger("load",e)})),e.on("error",(e=>{console.error(e)}))};var bt,At=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},It=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Mt{constructor(e){bt.set(this,void 0),At(this,bt,e,"f")}destroy(){At(this,bt,null,"f")}elementSize(e,t,i){return Te(e,{viewScaleInfo:t,viewSizeInfo:i})}isElementInView(e,t,i){return function(e,t){const{viewSizeInfo:i,viewScaleInfo:o}=t,{width:n,height:a}=i,{angle:r}=e,{x:s,y:l,w:h,h:c}=Te(e,{viewScaleInfo:o,viewSizeInfo:i}),d=pe({x:s,y:l,w:h,h:c,angle:r}),f={x:0,y:0,w:n,h:a},u=Math.min(d[0].x,d[1].x,d[2].x,d[3].x),g=Math.min(d[0].y,d[1].y,d[2].y,d[3].y);return function(e,t){const i=e.x,o=e.y,n=e.x+e.w,a=e.y+e.h,r=t.x,s=t.y,l=t.x+t.w,h=t.y+t.h;return i<=l&&n>=r&&o<=h&&a>=s}(f,{x:u,y:g,w:Math.max(d[0].x,d[1].x,d[2].x,d[3].x)-u,h:Math.max(d[0].y,d[1].y,d[2].y,d[3].y)-g})}(e,{viewScaleInfo:t,viewSizeInfo:i})}isPointInElement(e,t,i,o){return Ce(e,{context2d:It(this,bt,"f").viewContext,element:t,viewScaleInfo:i,viewSizeInfo:o})}getPointElement(e,t){const i=It(this,bt,"f").viewContext;return function(e,t){var i,o,n;const{context2d:a,data:r,viewScaleInfo:s,viewSizeInfo:l,groupQueue:h}=t,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let t=h.length-1;t>=0;t--){let n=0,r=0,d=0;for(let e=0;e<=t;e++)n+=h[e].x,r+=h[e].y,d+=h[e].angle||0;const f=h[t];if(f&&"group"===f.type&&Array.isArray(null===(i=f.detail)||void 0===i?void 0:i.children))for(let i=0;i<f.detail.children.length;i++){const u=f.detail.children[i];if(!0!==(null===(o=null==u?void 0:u.operations)||void 0===o?void 0:o.invisible)){if(!u)break;if(Ce(e,{context2d:a,element:{x:n+u.x,y:r+u.y,w:u.w,h:u.h,angle:d+(u.angle||0)},viewScaleInfo:s,viewSizeInfo:l})){c.element=u,(t<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=t);break}}}if(c.element)break}if(c.element)return c;for(let t=r.elements.length-1;t>=0;t--){const i=r.elements[t];if(!0!==(null===(n=null==i?void 0:i.operations)||void 0===n?void 0:n.invisible)&&Ce(e,{context2d:a,element:i,viewScaleInfo:s,viewSizeInfo:l})){c.index=t,c.element=i;break}}return c}(e,Object.assign(Object.assign({},t),{context2d:i}))}}bt=new WeakMap;var zt,Pt,Rt,Tt,Et,Wt,Ct,kt,Ot,jt,Dt,Lt,Bt,Ft,Yt,Gt,Nt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Vt=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};function Ht(e){return e>0||e<0||0===e}class Zt extends _{constructor(e){super(),zt.add(this),Pt.set(this,void 0),Rt.set(this,void 0),Tt.set(this,!1),Wt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;const t=Vt(this,zt,"m",Yt).call(this,e);if(!Vt(this,zt,"m",Gt).call(this,t))return;e.preventDefault(),e.stopPropagation();const i=e.deltaX>0||e.deltaX<0?e.deltaX:0,o=e.deltaY>0||e.deltaY<0?e.deltaY:0;!0===e.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:o,point:t}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:o,point:t})})),Ct.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);Vt(this,zt,"m",Gt).call(this,t)})),kt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);if(!Vt(this,zt,"m",Gt).call(this,t))return;const i=Date.now(),o=Vt(this,Rt,"f").get("prevClickPoint");o&&i-o.t<=500&&Math.abs(o.x-t.x)<=5&&Math.abs(o.y-t.y)<=5?this.trigger("doubleClick",{point:t}):Vt(this,Rt,"f").set("prevClickPoint",t)})),Ot.set(this,(e=>{if(Vt(this,Rt,"f").set("hasPointDown",!1),!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);this.trigger("pointLeave",{point:t})})),jt.set(this,(e=>{if(Vt(this,Rt,"f").set("hasPointDown",!1),!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);this.trigger("pointEnd",{point:t})})),Dt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault(),e.stopPropagation();const t=Vt(this,zt,"m",Yt).call(this,e);Vt(this,zt,"m",Gt).call(this,t)?!0===Vt(this,Rt,"f").get("hasPointDown")&&this.trigger("pointMove",{point:t}):Vt(this,Rt,"f").get("hasPointDown")&&(this.trigger("pointLeave",{point:t}),Vt(this,Rt,"f").set("hasPointDown",!1))})),Lt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);Vt(this,zt,"m",Gt).call(this,t)&&(Vt(this,Rt,"f").set("hasPointDown",!0),this.trigger("pointStart",{point:t}))})),Bt.set(this,(e=>{if(!Vt(this,zt,"m",Ft).call(this,e))return;e.preventDefault();const t=Vt(this,zt,"m",Yt).call(this,e);Vt(this,zt,"m",Gt).call(this,t)&&this.trigger("hover",{point:t})}));const t=new se({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});Nt(this,Rt,t,"f"),Nt(this,Pt,e,"f"),Vt(this,zt,"m",Et).call(this)}onEvents(){if(Vt(this,Tt,"f"))return;const e=window;e.addEventListener("mousemove",Vt(this,Bt,"f")),e.addEventListener("mousedown",Vt(this,Lt,"f")),e.addEventListener("mousemove",Vt(this,Dt,"f")),e.addEventListener("mouseup",Vt(this,jt,"f")),e.addEventListener("mouseleave",Vt(this,Ot,"f")),e.addEventListener("wheel",Vt(this,Wt,"f"),{passive:!1}),e.addEventListener("click",Vt(this,kt,"f")),e.addEventListener("contextmenu",Vt(this,Ct,"f"))}offEvents(){const e=window;e.removeEventListener("mousemove",Vt(this,Bt,"f")),e.removeEventListener("mousedown",Vt(this,Lt,"f")),e.removeEventListener("mousemove",Vt(this,Dt,"f")),e.removeEventListener("mouseup",Vt(this,jt,"f")),e.removeEventListener("mouseleave",Vt(this,Ot,"f")),e.removeEventListener("wheel",Vt(this,Wt,"f")),e.removeEventListener("click",Vt(this,kt,"f")),e.removeEventListener("contextmenu",Vt(this,Ct,"f"))}destroy(){this.offEvents(),Vt(this,Rt,"f").destroy(),Nt(this,Tt,!0,"f")}}Pt=new WeakMap,Rt=new WeakMap,Tt=new WeakMap,Wt=new WeakMap,Ct=new WeakMap,kt=new WeakMap,Ot=new WeakMap,jt=new WeakMap,Dt=new WeakMap,Lt=new WeakMap,Bt=new WeakMap,zt=new WeakSet,Et=function(){this.onEvents()},Ft=function(e){return e.target===Vt(this,Pt,"f").boardContent.boardContext.canvas},Yt=function(e){const t=Vt(this,Pt,"f").boardContent.boardContext.canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top,t:Date.now()}},Gt=function(e){const t=Vt(this,Pt,"f").sharer.getActiveViewSizeInfo(),{width:i,height:o}=t;return!!(Ht(e.x)&&Ht(e.y)&&e.x<=i&&e.y<=o)};var Xt,Qt,Jt=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Ut=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const $t={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class Kt{constructor(){Xt.set(this,void 0),Qt.set(this,void 0);const e=new se({defaultStorage:$t}),t=new se({defaultStorage:{}});Jt(this,Xt,e,"f"),Jt(this,Qt,t,"f")}getActiveStorage(e){return Ut(this,Xt,"f").get(e)}setActiveStorage(e,t){return Ut(this,Xt,"f").set(e,t)}getActiveStoreSnapshot(){return Ut(this,Xt,"f").getSnapshot()}getSharedStorage(e){return Ut(this,Qt,"f").get(e)}setSharedStorage(e,t){return Ut(this,Qt,"f").set(e,t)}getSharedStoreSnapshot(){return Ut(this,Qt,"f").getSnapshot()}getActiveViewScaleInfo(){return{scale:Ut(this,Xt,"f").get("scale"),offsetTop:Ut(this,Xt,"f").get("offsetTop"),offsetBottom:Ut(this,Xt,"f").get("offsetBottom"),offsetLeft:Ut(this,Xt,"f").get("offsetLeft"),offsetRight:Ut(this,Xt,"f").get("offsetRight")}}setActiveViewScaleInfo(e){const{scale:t,offsetTop:i,offsetBottom:o,offsetLeft:n,offsetRight:a}=e;Ut(this,Xt,"f").set("scale",t),Ut(this,Xt,"f").set("offsetTop",i),Ut(this,Xt,"f").set("offsetBottom",o),Ut(this,Xt,"f").set("offsetLeft",n),Ut(this,Xt,"f").set("offsetRight",a)}setActiveViewSizeInfo(e){Ut(this,Xt,"f").set("width",e.width),Ut(this,Xt,"f").set("height",e.height),Ut(this,Xt,"f").set("devicePixelRatio",e.devicePixelRatio),Ut(this,Xt,"f").set("contextWidth",e.contextWidth),Ut(this,Xt,"f").set("contextHeight",e.contextHeight)}getActiveViewSizeInfo(){return{width:Ut(this,Xt,"f").get("width"),height:Ut(this,Xt,"f").get("height"),devicePixelRatio:Ut(this,Xt,"f").get("devicePixelRatio"),contextWidth:Ut(this,Xt,"f").get("contextWidth"),contextHeight:Ut(this,Xt,"f").get("contextHeight")}}}Xt=new WeakMap,Qt=new WeakMap;var qt,_t,ei,ti,ii,oi,ni=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},ai=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};const{requestAnimationFrame:ri}=window;class si extends _{constructor(e){super(),qt.add(this),_t.set(this,void 0),ei.set(this,[]),ti.set(this,"FREE"),ni(this,_t,e,"f"),ai(this,qt,"m",ii).call(this)}drawFrame(){const{sharer:e}=ai(this,_t,"f"),t=e.getActiveStoreSnapshot(),i=e.getSharedStoreSnapshot();ai(this,ei,"f").push({activeStore:t,sharedStore:i}),ai(this,qt,"m",oi).call(this)}scale(e){const{scale:t,point:i}=e,{sharer:o}=ai(this,_t,"f"),{moveX:n,moveY:a}=function(e){const{scale:t,point:i,viewScaleInfo:o}=e,{offsetLeft:n,offsetTop:a}=o,r=t/o.scale,s=i.x,l=i.y;return{moveX:s-s*r+(n*r-n),moveY:l-l*r+(a*r-a)}}({scale:t,point:i,viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()});return o.setActiveStorage("scale",t),{moveX:n,moveY:a}}scroll(e){const{sharer:t}=ai(this,_t,"f"),i=t.getActiveViewScaleInfo(),{moveX:o,moveY:n}=e,a=function(e){const{moveX:t=0,moveY:i=0,viewScaleInfo:o,viewSizeInfo:n}=e,{scale:a}=o,{width:r,height:s,contextWidth:l,contextHeight:h}=n;let c=o.offsetLeft,d=o.offsetRight,f=o.offsetTop,u=o.offsetBottom;return c+=t,f+=i,d=r-(l*a+c),u=s-(h*a+f),{scale:a,offsetTop:f,offsetLeft:c,offsetRight:d,offsetBottom:u}}({moveX:o,moveY:n,viewScaleInfo:i,viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(a),a}updateViewScaleInfo(e){const{sharer:t}=ai(this,_t,"f"),i=function(e,t){const{scale:i,offsetX:o,offsetY:n}=e,{viewSizeInfo:a}=t,{width:r,height:s,contextWidth:l,contextHeight:h}=a,c=0-o*i,d=0-n*i;return{scale:i,offsetLeft:c,offsetTop:d,offsetRight:r-(l*i+c/i),offsetBottom:s-(h*i+d/i)}}(e,{viewSizeInfo:t.getActiveViewSizeInfo()});return t.setActiveViewScaleInfo(i),i}resize(e={}){const{sharer:t}=ai(this,_t,"f"),i=t.getActiveViewSizeInfo(),o=Object.assign(Object.assign({},i),e),{width:n,height:a,devicePixelRatio:r}=o,{underContext:s,boardContext:l,helperContext:h,viewContext:c}=ai(this,_t,"f").boardContent;return l.canvas.width=n*r,l.canvas.height=a*r,l.canvas.style.width=`${n}px`,l.canvas.style.height=`${a}px`,s.canvas.width=n*r,s.canvas.height=a*r,h.canvas.width=n*r,h.canvas.height=a*r,c.canvas.width=n*r,c.canvas.height=a*r,t.setActiveViewSizeInfo(o),o}}_t=new WeakMap,ei=new WeakMap,ti=new WeakMap,qt=new WeakSet,ii=function(){const{renderer:e}=ai(this,_t,"f");e.on("load",(()=>{this.drawFrame()}))},oi=function e(){if("DRAWING"===ai(this,ti,"f")||0===ai(this,ei,"f").length)return;ni(this,ti,"DRAWING","f");const t=ai(this,ei,"f").shift(),{renderer:i,boardContent:o,beforeDrawFrame:n,afterDrawFrame:a}=ai(this,_t,"f");if(t){const{scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h,width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g}=t.activeStore,v={scale:e,offsetTop:r,offsetBottom:s,offsetLeft:l,offsetRight:h},w={width:c,height:d,contextHeight:f,contextWidth:u,devicePixelRatio:g};(null==t?void 0:t.activeStore.data)&&i.drawData(t.activeStore.data,{viewScaleInfo:v,viewSizeInfo:w}),n({snapshot:t}),o.drawView(),a({snapshot:t})}0!==ai(this,ei,"f").length?ni(this,ti,"DRAWING","f")&&ri((()=>{ai(this,qt,"m",e).call(this)})):ni(this,ti,"COMPLETE","f")};var li,hi,ci,di,fi,ui,gi,vi,wi,mi,yi,pi,xi,Si,bi,Ai,Ii,Mi,zi,Pi,Ri,Ti,Ei,Wi,Ci,ki,Oi,ji=function(e,t,i,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,i):n?n.value=i:t.set(e,i),i},Di=function(e,t,i,o){if("a"===i&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?o:"a"===i?o.call(e):o?o.value:t.get(e)};class Li{constructor(e){li.add(this),hi.set(this,void 0),ci.set(this,new WeakMap),di.set(this,[]),fi.set(this,[]),ui.set(this,void 0),gi.set(this,void 0),vi.set(this,void 0),wi.set(this,void 0),mi.set(this,void 0),yi.set(this,new _),pi.set(this,!1);const{boardContent:t}=e,i=new Kt,o=new Mt({viewContext:t.viewContext}),n=new Zt({boardContent:t,sharer:i}),a=new St({viewContext:t.viewContext,sharer:i,calculator:o});ji(this,hi,e,"f"),ji(this,vi,i,"f"),ji(this,ui,n,"f"),ji(this,gi,a,"f"),ji(this,mi,o,"f"),ji(this,wi,new si({boardContent:e.boardContent,sharer:i,renderer:a,calculator:Di(this,mi,"f"),beforeDrawFrame:e=>{Di(this,li,"m",Ci).call(this,e)},afterDrawFrame:e=>{Di(this,li,"m",ki).call(this,e)}}),"f"),Di(this,li,"m",xi).call(this),Di(this,li,"m",Oi).call(this)}isDestroyed(){return Di(this,pi,"f")}destroy(){Di(this,ui,"f").destroy(),Di(this,gi,"f").destroy(),Di(this,mi,"f").destroy(),Di(this,yi,"f").destroy(),ji(this,pi,!0,"f")}getSharer(){return Di(this,vi,"f")}getViewer(){return Di(this,wi,"f")}getRenderer(){return Di(this,gi,"f")}setData(e){const t=Di(this,vi,"f");Di(this,vi,"f").setActiveStorage("data",e);const i=t.getActiveViewSizeInfo(),o=Ae(e.elements,{viewWidth:i.width,viewHeight:i.height,extend:!0});Di(this,wi,"f").drawFrame();const n=Object.assign(Object.assign({},i),o);return Di(this,vi,"f").setActiveViewSizeInfo(n),{viewSizeInfo:n}}getData(){const{data:e}=Di(this,vi,"f").getActiveStoreSnapshot();return e}use(e){var t,i,o;if(Di(this,ci,"f").has(e)){const o=Di(this,ci,"f").get(e);if(o)return null===(i=(t=o.middlewareObject).use)||void 0===i||i.call(t),o.status="enable",Di(this,ci,"f").set(e,o),void Di(this,li,"m",Oi).call(this)}const{boardContent:n,container:a}=Di(this,hi,"f"),r=e({boardContent:n,sharer:Di(this,vi,"f"),viewer:Di(this,wi,"f"),calculator:Di(this,mi,"f"),eventHub:Di(this,yi,"f"),container:a});null===(o=r.use)||void 0===o||o.call(r),Di(this,di,"f").push(e),Di(this,fi,"f").push(r),Di(this,ci,"f").set(e,{status:"enable",middlewareObject:r}),Di(this,li,"m",Oi).call(this)}disuse(e){var t,i;const o=Di(this,ci,"f").get(e);o&&(null===(i=(t=o.middlewareObject).disuse)||void 0===i||i.call(t),o.status="disable",Di(this,ci,"f").set(e,o),Di(this,li,"m",Oi).call(this))}scale(e){const t=Di(this,wi,"f"),{moveX:i,moveY:o}=t.scale(e);t.scroll({moveX:i,moveY:o})}scroll(e){return Di(this,wi,"f").scroll(e)}updateViewScaleInfo(e){return Di(this,wi,"f").updateViewScaleInfo(e)}resize(e){const t=Di(this,wi,"f").resize(e),{width:i,height:o,devicePixelRatio:n}=e,{boardContent:a}=Di(this,hi,"f");a.viewContext.$resize({width:i,height:o,devicePixelRatio:n}),a.helperContext.$resize({width:i,height:o,devicePixelRatio:n}),a.boardContext.$resize({width:i,height:o,devicePixelRatio:n}),a.underContext.$resize({width:i,height:o,devicePixelRatio:n}),Di(this,wi,"f").drawFrame(),Di(this,ui,"f").trigger("resize",t),Di(this,vi,"f").setActiveViewSizeInfo(e)}clear(){const{boardContent:e}=Di(this,hi,"f"),{underContext:t,helperContext:i,viewContext:o,boardContext:n}=e;t.clearRect(0,0,t.canvas.width,t.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),Di(this,li,"m",Wi).call(this)}getEventHub(){return Di(this,yi,"f")}onWatcherEvents(){Di(this,ui,"f").onEvents()}offWatcherEvents(){Di(this,ui,"f").offEvents()}}hi=new WeakMap,ci=new WeakMap,di=new WeakMap,fi=new WeakMap,ui=new WeakMap,gi=new WeakMap,vi=new WeakMap,wi=new WeakMap,mi=new WeakMap,yi=new WeakMap,pi=new WeakMap,li=new WeakSet,xi=function(){Di(this,ui,"f").on("pointStart",Di(this,li,"m",Si).bind(this)),Di(this,ui,"f").on("pointEnd",Di(this,li,"m",bi).bind(this)),Di(this,ui,"f").on("pointMove",Di(this,li,"m",Ai).bind(this)),Di(this,ui,"f").on("hover",Di(this,li,"m",Ii).bind(this)),Di(this,ui,"f").on("wheel",Di(this,li,"m",zi).bind(this)),Di(this,ui,"f").on("wheelScale",Di(this,li,"m",Pi).bind(this)),Di(this,ui,"f").on("scrollX",Di(this,li,"m",Ri).bind(this)),Di(this,ui,"f").on("scrollY",Di(this,li,"m",Ti).bind(this)),Di(this,ui,"f").on("resize",Di(this,li,"m",Ei).bind(this)),Di(this,ui,"f").on("doubleClick",Di(this,li,"m",Mi).bind(this)),Di(this,gi,"f").on("load",(()=>{Di(this,yi,"f").trigger("loadResource")}))},Si=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointStart)||void 0===t?void 0:t.call(o,e)))return}},bi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointEnd)||void 0===t?void 0:t.call(o,e)))return}},Ai=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.pointMove)||void 0===t?void 0:t.call(o,e)))return}},Ii=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.hover)||void 0===t?void 0:t.call(o,e)))return}},Mi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.doubleClick)||void 0===t?void 0:t.call(o,e)))return}},zi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheel)||void 0===t?void 0:t.call(o,e)))return}},Pi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.wheelScale)||void 0===t?void 0:t.call(o,e)))return}},Ri=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollX)||void 0===t?void 0:t.call(o,e)))return}},Ti=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.scrollY)||void 0===t?void 0:t.call(o,e)))return}},Ei=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.resize)||void 0===t?void 0:t.call(o,e)))return}},Wi=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.clear)||void 0===t?void 0:t.call(o,e)))return}},Ci=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.beforeDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},ki=function(e){var t;for(let i=0;i<Di(this,fi,"f").length;i++){const o=Di(this,fi,"f")[i];if(!1===(null===(t=null==o?void 0:o.afterDrawFrame)||void 0===t?void 0:t.call(o,e)))return}},Oi=function(){const e=[],t=Di(this,ci,"f");Di(this,di,"f").forEach((i=>{const o=t.get(i);"enable"===(null==o?void 0:o.status)&&(null==o?void 0:o.middlewareObject)&&e.push(o.middlewareObject)})),ji(this,fi,e,"f")};const Bi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0Y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qqprQ/cfHx/vVNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";class Fi{constructor(e,d){A(this,r),A(this,l),A(this,c),A(this,f),A(this,g),A(this,t,void 0),A(this,i,void 0),A(this,o,null),A(this,n,null),A(this,a,{auto:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8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xk+l9q3ieQfrDo8msF7cy3cN56g7ZWnKcep7IxnrQmz+wHKu2K3EKJWbPpWSUTQ4ZtRJc23sC6ZGB9ZM52JwcboIQjzUvZvNxYfeHlyVkZFcBbux6wKA6ShjoM5yM8uH0Xpuy8ekAQuZc2W8P8nEei9p9mMmPgAfJHO0O27e0lHppw9MEDJo//A4eoE91iB48SJ80lFMB/t/+V/sPGZfTmtMFR4EAAAAASUVORK5CYII="}),I(this,i,e),I(this,t,d.eventHub),M(this,r,s).call(this),M(this,l,h).call(this)}}t=new WeakMap,i=new WeakMap,o=new WeakMap,n=new WeakMap,a=new WeakMap,r=new WeakSet,s=function(){const e=b(this,t);M(this,c,d).call(this,"default"),e.on("cursor",(e=>{var t;"over-element"!==e.type&&e.type?"resize-rotate"===e.type?M(this,c,d).call(this,"rotate"):"string"==typeof e.type&&(null==(t=e.type)?void 0:t.startsWith("resize-"))?M(this,f,u).call(this,e):"drag-default"===e.type?M(this,c,d).call(this,"drag-default"):"drag-active"===e.type?M(this,c,d).call(this,"drag-active"):M(this,c,d).call(this,"auto"):M(this,c,d).call(this,"auto")}))},l=new WeakSet,h=function(){D(Bi).then((e=>{I(this,n,e)})).catch((e=>{console.error(e)}))},c=new WeakSet,d=function(e){if(b(this,o)===e)return;I(this,o,e);const t=b(this,a)[b(this,o)]||b(this,a).auto;let n=0,r=0;(e.startsWith("rotate-")&&b(this,a)[b(this,o)]||"rotate"===e)&&(n=10,r=10),b(this,i).style.cursor="default"===e?"default":`image-set(url(${t})2x) ${n} ${r}, auto`},f=new WeakSet,u=function(e){var t;let i=0;"resize-top"===e.type?i+=0:"resize-top-right"===e.type?i+=45:"resize-right"===e.type?i+=90:"resize-bottom-right"===e.type?i+=135:"resize-bottom"===e.type?i+=180:"resize-bottom-left"===e.type?i+=225:"resize-left"===e.type?i+=270:"resize-top-left"===e.type&&(i+=315),i+=Se((null==(t=null==e?void 0:e.element)?void 0:t.angle)||0),Array.isArray(e.groupQueue)&&e.groupQueue.length>0&&e.groupQueue.forEach((e=>{i+=Se(e.angle||0)})),i=Se(i);const o=M(this,g,v).call(this,i);M(this,c,d).call(this,o)},g=new WeakSet,v=function(e){const t=`rotate-${e}`;if(!b(this,a)[t]){const i=b(this,n);if(i){const o=document.createElement("canvas"),n=i.width,r=i.height,s={x:n/2,y:r/2};o.width=n,o.height=r;const l=o.getContext("2d"),h=ce(e);l.translate(s.x,s.y),l.rotate(h),l.translate(-s.x,-s.y),l.drawImage(i,0,0,n,r),l.translate(s.x,s.y),l.rotate(-h),l.translate(-s.x,-s.y);const c=o.toDataURL("image/png");b(this,a)[t]=c}}return t};const Yi="SELECT",Gi=Symbol(`${Yi}_actionType`),Ni=Symbol(`${Yi}_resizeType`),Vi=Symbol(`${Yi}_areaStart`),Hi=Symbol(`${Yi}_areaEnd`),Zi=Symbol(`${Yi}_hoverElement`),Xi=Symbol(`${Yi}_hoverElementVertexes`),Qi=Symbol(`${Yi}_selectedElementList`),Ji=Symbol(`${Yi}_selectedElementListVertexes`),Ui=Symbol(`${Yi}_selectedElementController`),$i=Symbol(`${Yi}_groupQueue`),Ki=Symbol(`${Yi}_groupQueueVertexesList`),qi=Symbol(`${Yi}_isMoving`),_i="#1973ba",eo="#5b5959b5";function to(e,t,i){const{borderColor:o,borderWidth:n,background:a,lineDash:r}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.fillStyle=a,e.setLineDash(r),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[1].x,t[1].y),e.lineTo(t[2].x,t[2].y),e.lineTo(t[3].x,t[3].y),e.lineTo(t[0].x,t[0].y),e.closePath(),e.stroke(),e.fill()}function io(e,t,i){const{borderColor:o,borderWidth:n,lineDash:a}=i;e.setLineDash([]),e.lineWidth=n,e.strokeStyle=o,e.setLineDash(a),e.beginPath(),e.moveTo(t[0].x,t[0].y),e.lineTo(t[2].x,t[2].y),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(t[1].x,t[1].y),e.lineTo(t[3].x,t[3].y),e.closePath(),e.stroke()}function oo(e,t,i){if(!t)return;const o={borderColor:_i,borderWidth:1,background:"transparent",lineDash:[]};to(e,We(t,i),o)}function no(e,t,i){if(!t)return;const o={borderColor:eo,borderWidth:1,background:"transparent",lineDash:[]};to(e,We(t,i),o);const{controller:n}=i;if(n){const{topLeft:t,topRight:a,bottomLeft:r,bottomRight:s,topMiddle:l,bottomMiddle:h,leftMiddle:c,rightMiddle:d}=n,f={...o,borderWidth:1,background:eo};io(e,We(l.vertexes,i),f),io(e,We(h.vertexes,i),f),io(e,We(c.vertexes,i),f),io(e,We(d.vertexes,i),f),io(e,We(t.vertexes,i),f),io(e,We(a.vertexes,i),f),io(e,We(r.vertexes,i),f),io(e,We(s.vertexes,i),f)}}function ao(e,t,i){if(!t)return;const{hideControllers:o}=i,{elementWrapper:n,topLeft:a,topRight:r,bottomLeft:s,bottomRight:l,top:h,rotate:c}=t,d={borderColor:_i,borderWidth:2,background:"transparent",lineDash:[]},f={...d,borderWidth:4,background:"#FFFFFF"};to(e,We(n,i),d),o||(function(e,t,i,o){const{borderColor:n,borderWidth:a,lineDash:r}=o;e.setLineDash([]),e.lineWidth=a,e.strokeStyle=n,e.setLineDash(r),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.closePath(),e.stroke()}(e,Ee(h.center,i),Ee(c.center,i),{...f,borderWidth:2}),to(e,We(a.vertexes,i),f),to(e,We(r.vertexes,i),f),to(e,We(s.vertexes,i),f),to(e,We(l.vertexes,i),f),function(e,t,i){const{size:o,borderColor:n,borderWidth:a,background:r}=i,s=t,l=o/2,h=l,c=l;if(h>=0&&c>=0){if("number"==typeof a&&a>0){const t=a/2+h,i=a/2+c;e.beginPath(),e.strokeStyle=n,e.lineWidth=a,e.circle(s.x,s.y,t,i,0,0,2*Math.PI),e.closePath(),e.stroke()}e.beginPath(),e.fillStyle=r,e.circle(s.x,s.y,h,c,0,0,2*Math.PI),e.closePath(),e.fill()}}(e,Ee(c.center,i),{...f,size:10,borderWidth:2}))}function ro(e){return e*Math.PI/180}function so(e,t){return Math.sqrt(e*e+t*t)}function lo(e,t){return t>0?Math.abs(e):0-Math.abs(e)}function ho(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,vertexes:a}=t,r=Ee(a[0],{viewScaleInfo:o,viewSizeInfo:n}),s=Ee(a[1],{viewScaleInfo:o,viewSizeInfo:n}),l=Ee(a[2],{viewScaleInfo:o,viewSizeInfo:n}),h=Ee(a[3],{viewScaleInfo:o,viewSizeInfo:n});return i.beginPath(),i.moveTo(r.x,r.y),i.lineTo(s.x,s.y),i.lineTo(l.x,l.y),i.lineTo(h.x,h.y),i.lineTo(r.x,r.y),i.closePath(),!!i.isPointInPath(e.x,e.y)}function co(e,t){const{ctx:i,viewScaleInfo:o,viewSizeInfo:n,groupQueue:a}=t;if(!(a&&(null==a?void 0:a.length)>0))return!1;const r=Pe(a),s=r[r.length-1];return!!s&&ho(e,{ctx:i,vertexes:s,viewScaleInfo:o,viewSizeInfo:n})}function fo(e,t){var i,o,n;const a={type:null,elements:[],elementVertexesList:[],groupQueue:[],groupQueueVertexesList:[]},{ctx:r,data:s,calculator:l,selectedElements:h,viewScaleInfo:c,viewSizeInfo:d,areaSize:f,groupQueue:u,selectedElementController:g}=t;if(g){const{left:t,right:i,top:o,bottom:n,topLeft:s,topRight:l,bottomLeft:f,bottomRight:v,rotate:w}=g,m=[t,i,o,n,s,l,f,v,w];for(let t=0;t<m.length;t++){const i=m[t];if(ho(e,{ctx:r,vertexes:i.vertexes,viewSizeInfo:d,viewScaleInfo:c})){a.type=`resize-${i.type}`,h&&(null==h?void 0:h.length)>0&&(a.groupQueue=u||[],a.elements=[h[0]]);break}}}if(u&&Array.isArray(u)&&u.length>0){const t=u[u.length-1];if((null==(i=null==t?void 0:t.detail)?void 0:i.children)&&Array.isArray(null==(o=null==t?void 0:t.detail)?void 0:o.children))for(let i=t.detail.children.length-1;i>=0;i--){const o=t.detail.children[i],n=Re(o,{groupQueue:u});if(n&&ho(e,{ctx:r,vertexes:n,viewScaleInfo:c,viewSizeInfo:d}))return a.type||(a.type="over-element"),a.groupQueue=u,a.elements=[o],a}return a}if(null!==a.type)return a;if(f&&Array.isArray(h)&&(null==h?void 0:h.length)>1){const{x:t,y:i,w:o,h:n}=f;if(e.x>=t&&e.x<=t+o&&e.y>=i&&e.y<=i+n)return a.type="list-area",a.elements=h,a}if(s){const{index:t,element:i}=l.getPointElement(e,{data:s,viewScaleInfo:c,viewSizeInfo:d});if(t>=0&&i&&!0!==(null==(n=null==i?void 0:i.operations)?void 0:n.invisible))return a.elements=[i],a.type="over-element",a}return a}function uo(e,t){const{x:i,y:o,w:n,h:a,angle:r=0}=e,{center:s,start:l,end:h,viewScaleInfo:c,viewSizeInfo:d}=t,f=Ee(s,{viewScaleInfo:c,viewSizeInfo:d}),u=Se(r),g=function(e,t,i){const o=ve(e,t),n=ve(e,i);return null!==n&&null!==o?o>3*Math.PI/2&&n<Math.PI/2?n+(2*Math.PI-o):n>3*Math.PI/2&&o<Math.PI/2?o+(2*Math.PI-n):n-o:0}(f,l,h);return{x:i,y:o,w:n,h:a,angle:u+g/Math.PI*180}}function go(e,t){var i;if(!Array.isArray(e))return null;const o={x:0,y:0,w:0,h:0},{calculator:n,viewScaleInfo:a,viewSizeInfo:r}=t;let s=null;for(let t=0;t<e.length;t++){const l=e[t];if(null==(i=null==l?void 0:l.operations)?void 0:i.invisible)continue;const h=n.elementSize(l,a,r);if(h.angle&&(h.angle>0||h.angle<0)){const e=pe(h);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];h.x=Math.min(...t),h.y=Math.min(...i),h.w=Math.abs(Math.max(...t)-Math.min(...t)),h.h=Math.abs(Math.max(...i)-Math.min(...i))}}if(s){const e=Math.min(h.x,o.x),t=Math.min(h.y,o.y),i=Math.max(h.x+h.w,o.x+o.w),n=Math.max(h.y+h.h,o.y+o.h);o.x=e,o.y=t,o.w=Math.abs(i-e),o.h=Math.abs(n-t)}else o.x=h.x,o.y=h.y,o.w=h.w,o.h=h.h;s=h}return o}const vo="@middleware/text-edit",wo="@middleware/text-change",mo={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,lineHeight:20,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"},yo="@middleware/select",po="@middleware/select-clear",xo="SCROLL",So=Symbol(`${xo}_xThumbRect`),bo=Symbol(`${xo}_yThumbRect`),Ao=Symbol(`${xo}_prevPoint`),Io=Symbol(`${xo}_activePoint`),Mo=Symbol(`${xo}_activeThumbType`),zo=16,Po=.36,Ro={width:12,thumbColor:"#000000AA",scrollBarColor:"#FFFFFF60",showScrollBar:!1};function To(e,t,i){const o=e,{x:n,y:a,w:r,h:s}=i;return o.beginPath(),o.rect(n,a,r,s),o.closePath(),!!o.isPointInPath(t.x,t.y)}function Eo(e,t){let{x:i,y:o,h:n,w:a}=t;e.save(),e.shadowColor="#FFFFFF",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=1;{const{color:r,axis:s}=t;"X"===s?(o=o+n/4+0,n/=2):"Y"===s&&(i=i+a/4+0,a/=2);let l=t.r;l=Math.min(l,a/2,n/2),(a<2*l||n<2*l)&&(l=0),e.globalAlpha=Po,e.beginPath(),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.fillStyle=r,e.fill(),e.globalAlpha=1,e.beginPath(),e.lineWidth=1,e.strokeStyle=r,e.setLineDash([]),e.moveTo(i+l,o),e.arcTo(i+a,o,i+a,o+n,l),e.arcTo(i+a,o+n,i,o+n,l),e.arcTo(i,o+n,i,o,l),e.arcTo(i,o,i+a,o,l),e.closePath(),e.stroke()}e.restore()}function Wo(e,t){const i=e,{viewScaleInfo:o,viewSizeInfo:n,scrollInfo:a}=t,{activeThumbType:r,prevPoint:s,activePoint:l}=a,h=function(e,t){const{width:i,height:o}=t,{offsetTop:n,offsetBottom:a,offsetLeft:r,offsetRight:s}=e,l=2.5*zo,h=zo;let c=0,d=0;c=Math.max(l,i-2*h-(Math.abs(r)+Math.abs(s))),c>=i&&(c=i),d=Math.max(l,o-2*h-(Math.abs(n)+Math.abs(a))),d>=o&&(d=o);const f=h;let u=f;r>0?u=f:s>0?u=i-c-h:r<=0&&c>0&&(0!==r||0!==s)&&(u=f+(i-c)*Math.abs(r)/(Math.abs(r)+Math.abs(s)),u=Math.min(Math.max(0,u-f),i-c));const g=h;let v=g;n>0?v=g:a>0?v=o-d-h:n<=0&&d>0&&(0!==n||0!==a)&&(v=g+(o-d)*Math.abs(n)/(Math.abs(n)+Math.abs(a)),v=Math.min(Math.max(0,v-g),o-d));const w={x:u,y:o-h,w:c,h:h},m={x:i-h,y:v,w:h,h:d};return{lineSize:h,xSize:c,ySize:d,translateY:v,translateX:u,thumbColor:Ro.thumbColor,scrollBarColor:Ro.scrollBarColor,xThumbRect:w,yThumbRect:m}}(o,n);let c={...h.xThumbRect},d={...h.yThumbRect};return r&&s&&l&&("X"===r&&a.xThumbRect?(c={...a.xThumbRect},c.x=c.x+(l.x-s.x)):"Y"===r&&a.yThumbRect&&(d={...a.yThumbRect},d.y=d.y+(l.y-s.y))),Eo(i,{axis:"X",...c,r:h.lineSize/2,color:h.thumbColor}),Eo(i,{axis:"Y",...d,r:h.lineSize/2,color:h.thumbColor}),i.globalAlpha=1,{xThumbRect:c,yThumbRect:d}}function Co(e,t){const{snapshot:i}=t,o=he(i),n=le(i),a=function(e){const{sharedStore:t}=e;return{activePoint:t[Io]||null,prevPoint:t[Ao]||null,activeThumbType:t[Mo]||null,xThumbRect:t[So]||null,yThumbRect:t[bo]||null}}(i),{xThumbRect:r,yThumbRect:s}=Wo(e,{viewSizeInfo:o,viewScaleInfo:n,scrollInfo:a});return{xThumbRect:r,yThumbRect:s}}const ko="@middleware/scale",Oo=16,jo="#000000",Do="#00000080",Lo="monospace",Bo="#AAAAAA20",Fo="#AAAAAA40";function Yo(e){const{scale:t,viewLength:i,viewOffset:o}=e,n=[];let a=10;a=De(a/t,{decimalPlaces:0}),a=Math.max(10,Math.min(a,1e3));const r=10*a,s=5*a;let l=0;const h=a*t,c=0-o,d=c%h,f=(c-d+h)/t,u=h-d+0;for(;u+l*h<i;){const e=De(f+l*a,{decimalPlaces:0}),t={num:e,position:De(u+l*h,{decimalPlaces:0}),showNum:e%r==0,isKeyNum:e%r==0,isSubKeyNum:e%s==0};n.push(t),l++}return n}const Go="@middleware/show-ruler",No=Symbol("DRAG_prevPoint");return w=new WeakMap,m=new WeakMap,y=new WeakMap,p=new WeakSet,x=function(){b(this,y).style.position="relative"},e.Core=class{constructor(e,t){A(this,p),A(this,w,void 0),A(this,m,void 0),A(this,y,void 0);const{devicePixelRatio:i=1,width:o,height:n,createCustomContext2D:a}=t;I(this,y,e);const r=document.createElement("canvas");I(this,m,r),M(this,p,x).call(this),e.appendChild(r);const s=function(e,t){const{width:i,height:o,devicePixelRatio:n,offscreen:a,createCustomContext2D:r}=t,s={width:i,height:o,devicePixelRatio:n},l=e.getContext("2d");if(r){const e=r(s),t=r(s),i=r(s),o=U(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}if(!0===a){const e=$(s),t=$(s),i=$(s),o=U(Object.assign({ctx:l},s)),n=()=>{const{width:n,height:a}=e.$getSize();o.clearRect(0,0,n,a),o.drawImage(i.canvas,0,0,n,a),o.drawImage(e.canvas,0,0,n,a),o.drawImage(t.canvas,0,0,n,a),i.clearRect(0,0,n,a),e.clearRect(0,0,n,a),t.clearRect(0,0,n,a)};return{underContext:i,viewContext:e,helperContext:t,boardContext:o,drawView:n}}{const e=U(s),t=U(s),n=U(s),a=U(Object.assign({ctx:l},s)),r=()=>{a.clearRect(0,0,i,o),a.drawImage(n.canvas,0,0,i,o),a.drawImage(e.canvas,0,0,i,o),a.drawImage(t.canvas,0,0,i,o),n.clearRect(0,0,i,o),e.clearRect(0,0,i,o),t.clearRect(0,0,i,o)};return{underContext:n,viewContext:e,helperContext:t,boardContext:a,drawView:r}}}(r,{width:o,height:n,devicePixelRatio:i,offscreen:!0,createCustomContext2D:a}),l=new Li({boardContent:s,container:e}),h=l.getSharer();h.setActiveViewSizeInfo({width:o,height:n,devicePixelRatio:i,contextWidth:o,contextHeight:n}),I(this,w,l),this.resize(h.getActiveViewSizeInfo());const c=l.getEventHub();new Fi(e,{eventHub:c})}isDestroyed(){return b(this,w).isDestroyed()}destroy(){b(this,w).destroy(),b(this,m).remove()}use(e){b(this,w).use(e)}disuse(e){b(this,w).disuse(e)}setData(e){be((null==e?void 0:e.elements)||[]),b(this,w).setData(e)}getData(){return b(this,w).getData()}scale(e){b(this,w).scale(e);b(this,w).getViewer().drawFrame()}resize(e){const t=b(this,w),i=t.getSharer().getActiveViewSizeInfo();t.resize({...i,...e})}clear(){b(this,w).clear()}on(e,t){b(this,w).getEventHub().on(e,t)}off(e,t){b(this,w).getEventHub().off(e,t)}trigger(e,t){b(this,w).getEventHub().trigger(e,t)}getViewInfo(){const e=b(this,w).getSharer();return{viewSizeInfo:e.getActiveViewSizeInfo(),viewScaleInfo:e.getActiveViewScaleInfo()}}refresh(){b(this,w).getViewer().drawFrame()}setViewScale(e){b(this,w).updateViewScaleInfo(e)}getLoadItemMap(){return b(this,w).getRenderer().getLoadItemMap()}onBoardWatcherEvents(){b(this,w).onWatcherEvents()}offBoardWatcherEvents(){b(this,w).offWatcherEvents()}},e.MiddlewareDragger=e=>{const{eventHub:t,sharer:i,viewer:o}=e;let n=!1;return{name:"@middleware/dragger",hover(){!0!==n&&t.trigger("cursor",{type:"drag-default"})},pointStart(e){const{point:o}=e;i.setSharedStorage(No,o),n=!0,t.trigger("cursor",{type:"drag-active"})},pointMove(e){const{point:t}=e,n=i.getSharedStorage(No);if(t&&n){const e=t.x-n.x,i=t.y-n.y;o.scroll({moveX:e,moveY:i}),o.drawFrame()}i.setSharedStorage(No,t)},pointEnd(){n=!1,i.setSharedStorage(No,null),t.trigger("cursor",{type:"drag-default"})}}},e.MiddlewareRuler=e=>{const{boardContent:t,viewer:i,eventHub:o}=e,{helperContext:n,underContext:a}=t;let r=!0,s=!0;const l=e=>{"boolean"==typeof(null==e?void 0:e.show)&&(r=e.show),"boolean"==typeof(null==e?void 0:e.showGrid)&&(s=e.showGrid),"boolean"!=typeof(null==e?void 0:e.show)&&"boolean"!=typeof(null==e?void 0:e.showGrid)||i.drawFrame()};return{name:"@middleware/ruler",use(){o.on(Go,l)},disuse(){o.off(Go,l)},beforeDrawFrame:({snapshot:e})=>{if(!0===r){const t=le(e),i=he(e);!function(e,t){const{viewSizeInfo:i}=t,{width:o,height:n}=i;e.beginPath(),e.moveTo(0,0),e.lineTo(o+1,0),e.lineTo(o+1,Oo),e.lineTo(Oo,Oo),e.lineTo(Oo,n+1),e.lineTo(0,n+1),e.lineTo(0,0),e.closePath(),e.fillStyle="#FFFFFFA8",e.fill(),e.lineWidth=1,e.setLineDash([]),e.strokeStyle="#00000080",e.stroke()}(n,{viewScaleInfo:t,viewSizeInfo:i});const o=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetLeft:n}=t,{width:a}=i;return Yo({axis:"X",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t;for(let t=0;t<i.length;t++){const o=i[t];o.position<Oo||(e.beginPath(),e.moveTo(o.position,16),e.lineTo(o.position,o.isKeyNum?3.2:o.isSubKeyNum?6.4:12.8),e.closePath(),e.lineWidth=1,e.setLineDash([]),e.fillStyle=jo,e.stroke(),o.isKeyNum&&(e.fillStyle=Do,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:Lo}),e.fillText(`${o.num}`,o.position+3.2,3.2)))}}(n,{scaleList:o});const r=function(e){const{viewScaleInfo:t,viewSizeInfo:i}=e,{scale:o,offsetTop:n}=t,{height:a}=i;return Yo({axis:"Y",scale:o,viewLength:a,viewOffset:n})}({viewScaleInfo:t,viewSizeInfo:i});!function(e,t){const{scaleList:i}=t,o=3.2;for(let t=0;t<i.length;t++){const n=i[t];if(!(n.position<Oo)&&(e.beginPath(),e.moveTo(16,n.position),e.lineTo(n.isKeyNum?3.2:n.isSubKeyNum?6.4:12.8,n.position),e.closePath(),e.fillStyle=jo,e.lineWidth=1,e.setLineDash([]),e.stroke(),!0===n.showNum)){const t=o,i=n.position+o,a=`${n.num}`;de(e,-90,{x:t,y:i},(()=>{e.fillStyle=Do,e.textBaseline="top",e.$setFont({fontWeight:100,fontSize:10,fontFamily:Lo}),e.fillText(a,13.2,n.position+o)}))}}}(n,{scaleList:r}),!0===s&&function(e,t){const{xList:i,yList:o,viewSizeInfo:n}=t,{width:a,height:r}=n;for(let t=0;t<i.length;t++){const o=i[t];e.beginPath(),e.moveTo(o.position,0),e.lineTo(o.position,r),!0===o.isKeyNum||!0===o.isSubKeyNum?e.strokeStyle=Fo:e.strokeStyle=Bo,e.closePath(),e.lineWidth=1,e.setLineDash([]),e.stroke()}for(let t=0;t<o.length;t++){const i=o[t];e.beginPath(),e.moveTo(0,i.position),e.lineTo(a,i.position),!0===i.isKeyNum||!0===i.isSubKeyNum?e.strokeStyle=Fo:e.strokeStyle=Bo,e.lineWidth=1,e.closePath(),e.stroke()}}(a,{xList:o,yList:r,viewScaleInfo:t,viewSizeInfo:i})}}}},e.MiddlewareScaler=e=>{const{viewer:t,sharer:i,eventHub:o}=e;return{name:"@middleware/scaler",wheelScale(e){const{deltaY:n,point:a}=e,{scale:r}=i.getActiveViewScaleInfo();let s=r;if(n<0?s=1.1*r:n>0&&(s=.9*r),s<.05||s>50)return;const{moveX:l,moveY:h}=t.scale({scale:s,point:a});t.scroll({moveX:l,moveY:h}),t.drawFrame();const c=De(r);o.trigger(ko,{scale:c})}}},e.MiddlewareScroller=e=>{const{viewer:t,boardContent:i,sharer:o}=e,{helperContext:n}=i;o.setSharedStorage(So,null),o.setSharedStorage(bo,null);const a=()=>{o.setSharedStorage(Ao,null),o.setSharedStorage(Io,null),o.setSharedStorage(Mo,null)};a();const r=e=>function(e,t,i){let o=null;const{xThumbRect:n,yThumbRect:a}=i;return n&&To(e,t,n)?o="X":a&&To(e,t,a)&&(o="Y"),o}(n,e,{xThumbRect:o.getSharedStorage(So),yThumbRect:o.getSharedStorage(bo)});return{name:"@middleware/scroller",wheel:e=>{t.scroll({moveX:0-e.deltaX,moveY:0-e.deltaY}),t.drawFrame()},pointStart:e=>{const{point:t}=e,i=r(t);if("X"===i||"Y"===i)return o.setSharedStorage(Mo,i),o.setSharedStorage(Ao,t),!1},pointMove:e=>{const{point:i}=e,n=o.getSharedStorage(Mo);if("X"===n||"Y"===n)return o.setSharedStorage(Io,i),"X"===n?(e=>{const i=o.getSharedStorage(Ao);if(i){const{offsetLeft:n,offsetRight:a}=o.getActiveViewScaleInfo(),{width:r}=o.getActiveViewSizeInfo(),s=-(e.x-i.x)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveX:s}),t.drawFrame()}})(i):"Y"===n&&(e=>{const i=o.getSharedStorage(Ao);if(i){const{offsetTop:n,offsetBottom:a}=o.getActiveViewScaleInfo(),{height:r}=o.getActiveViewSizeInfo(),s=-(e.y-i.y)*(r+Math.abs(n)+Math.abs(a))/r;t.scroll({moveY:s}),t.drawFrame()}})(i),o.setSharedStorage(Ao,i),!1},pointEnd:()=>{const e=o.getSharedStorage(Mo);if(a(),"X"===e||"Y"===e)return t.scroll({moveX:0,moveY:0}),t.drawFrame(),!1},beforeDrawFrame({snapshot:e}){const{xThumbRect:t,yThumbRect:i}=Co(n,{snapshot:e});o.setSharedStorage(So,t),o.setSharedStorage(bo,i)}}},e.MiddlewareSelector=e=>{const{viewer:t,sharer:i,boardContent:o,calculator:n,eventHub:a}=e,{helperContext:r}=o;let s=null,l=null;i.setSharedStorage(Gi,null);const h=()=>i.getSharedStorage(Qi),c=e=>{let t=i.getSharedStorage($i);Array.isArray(t)||(t=[]),t.length>0?!function(e,t){var i;if("group"===(null==t?void 0:t.type)&&Array.isArray(null==(i=null==t?void 0:t.detail)?void 0:i.children))for(let i=0;i<t.detail.children.length;i++){const o=t.detail.children[i];if(e.uuid===o.uuid)return!0}return!1}(e,t[t.length-1])?t=[]:t.push(e):0===t.length&&t.push(e);const o=Pe(t);return i.setSharedStorage($i,t),i.setSharedStorage(Ki,o),t.length>0},d=e=>{i.setSharedStorage(Zi,e);let t=null;e&&(t=Re(e,{groupQueue:i.getSharedStorage($i)})),i.setSharedStorage(Xi,t)},f=(e,t)=>{if(i.setSharedStorage(Qi,e),1===e.length){const t=Oe(e[0],{groupQueue:i.getSharedStorage($i),controllerSize:10,viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Ui,t)}else i.setSharedStorage(Ui,null);!0===(null==t?void 0:t.triggerEvent)&&a.trigger(yo,{uuids:e.map((e=>e.uuid))})},u=()=>({ctx:r,calculator:n,data:i.getActiveStorage("data"),selectedElements:h(),viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage($i),areaSize:null,selectedElementController:i.getSharedStorage(Ui)}),g=()=>{i.setSharedStorage(Gi,null),i.setSharedStorage(Ni,null),i.setSharedStorage(Vi,null),i.setSharedStorage(Hi,null),i.setSharedStorage($i,[]),i.setSharedStorage(Ki,[]),i.setSharedStorage(Zi,null),i.setSharedStorage(Xi,null),i.setSharedStorage(Qi,[]),i.setSharedStorage(Ji,null),i.setSharedStorage(Ui,null),i.setSharedStorage(qi,null)};g();const v=({uuids:e,positions:o})=>{let n=[];const a=i.getSharedStorage(Gi),r=i.getActiveStorage("data");n=o&&Array.isArray(o)?function(e,t){const i=[];return e.forEach((e=>{const o=function(e,t){let i=null,o=t;for(let t=0;t<e.length;t++){const n=o[e[t]];if(t<e.length-1&&"group"===n.type)o=n.detail.children;else{if(t!==e.length-1)break;i=n}}return i}(e,t);o&&i.push(o)})),i}(o,(null==r?void 0:r.elements)||[]):function(e,t){const i=[];return function t(o){var n;for(let a=0;a<o.length;a++){const r=o[a];e.includes(r.uuid)?i.push(r):"group"===r.type&&t((null===(n=null==r?void 0:r.detail)||void 0===n?void 0:n.children)||[])}}(t),i}(e,(null==r?void 0:r.elements)||[]);let s=!1;if(a||1!==n.length?"select"===a&&1===n.length&&(s=!0):(i.setSharedStorage(Gi,"select"),s=!0),s){const e=function(e,t){const i=[];return function e(t,o){var n;let a=null;for(let r=0;r<o.length;r++){const s=o[r];if(s.uuid===t){a=s;break}if(!a&&"group"===s.type){i.push(s);const o=e(t,(null===(n=null==s?void 0:s.detail)||void 0===n?void 0:n.children)||[]);if((null==o?void 0:o.uuid)===t){a=o;break}i.pop()}}return a}(e,t),i}(n[0].uuid,(null==r?void 0:r.elements)||[]);i.setSharedStorage($i,e),f(n),t.drawFrame()}},w=()=>{g(),t.drawFrame()};return{name:"@middleware/selector",use(){a.on(yo,v),a.on(po,w)},disuse(){a.off(yo,v),a.off(po,w)},hover:e=>{var o,s,c,f,g;const v=i.getSharedStorage(Ni),w=i.getSharedStorage(Gi),m=i.getSharedStorage($i),y=e=>{const t=e.type;null===l&&a.trigger("cursor",{type:t,groupQueue:e.groupQueue,element:e.elements[0]})};if((null==m?void 0:m.length)>0){if(!co(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:i.getSharedStorage($i)}))return d(null),void t.drawFrame();const n=fo(e.point,u());return y(n),v||["area","drag","drag-list"].includes(w)?(d(null),void t.drawFrame()):1===(null==(o=null==n?void 0:n.elements)?void 0:o.length)?(d(n.elements[0]),void t.drawFrame()):(d(null),void t.drawFrame())}if(v||["area","drag","drag-list"].includes(w))return void d(null);if("drag"===w)return void d(null);const p=h(),x=i.getActiveViewScaleInfo(),S=i.getActiveViewSizeInfo(),b=fo(e.point,{...u(),areaSize:go(p,{viewScaleInfo:x,viewSizeInfo:S,calculator:n})});return y(b),null===b.type||"over-element"===b.type&&"select"===i.getSharedStorage(Gi)&&1===b.elements.length&&b.elements[0].uuid===(null==(c=null==(s=h())?void 0:s[0])?void 0:c.uuid)||"over-element"===b.type&&null===i.getSharedStorage(Gi)&&1===b.elements.length&&b.elements[0].uuid===(null==(f=i.getSharedStorage(Zi))?void 0:f.uuid)?void 0:"over-element"===b.type&&1===(null==(g=null==b?void 0:b.elements)?void 0:g.length)?(d(b.elements[0]),void t.drawFrame()):i.getSharedStorage(Zi)?(d(null),void t.drawFrame()):void 0},pointStart:e=>{var o,a,l,c,v,w,m,y,p,x;s=e.point;const S=i.getSharedStorage($i);if((null==S?void 0:S.length)>0){if(co(e.point,{ctx:r,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),groupQueue:S})){const t=fo(e.point,u());if(1===(null==(o=null==t?void 0:t.elements)?void 0:o.length)&&!0===(null==(l=null==(a=t.elements[0])?void 0:a.operations)?void 0:l.lock))return;d(null),"over-element"===t.type&&1===(null==(c=null==t?void 0:t.elements)?void 0:c.length)?(f([t.elements[0]],{triggerEvent:!0}),i.setSharedStorage(Gi,"drag")):(null==(v=t.type)?void 0:v.startsWith("resize-"))?(i.setSharedStorage(Ni,t.type),i.setSharedStorage(Gi,"resize")):f([],{triggerEvent:!0})}else g();return void t.drawFrame()}const b=go(h(),{viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo(),calculator:n}),A=fo(e.point,{...u(),areaSize:b,groupQueue:[]});1===(null==(w=null==A?void 0:A.elements)?void 0:w.length)&&!0===(null==(y=null==(m=A.elements[0])?void 0:m.operations)?void 0:y.lock)||(d(null),"list-area"===A.type?i.setSharedStorage(Gi,"drag-list"):"over-element"===A.type&&1===(null==(p=null==A?void 0:A.elements)?void 0:p.length)?(f([A.elements[0]],{triggerEvent:!0}),i.setSharedStorage(Gi,"drag")):(null==(x=A.type)?void 0:x.startsWith("resize-"))?(i.setSharedStorage(Ni,A.type),i.setSharedStorage(Gi,"resize")):(g(),i.setSharedStorage(Gi,"area"),i.setSharedStorage(Vi,e.point),f([],{triggerEvent:!0})),t.drawFrame())},pointMove:e=>{var o,n,a;i.setSharedStorage(qi,!0);const r=i.getActiveStorage("data"),c=h(),d=i.getActiveStorage("scale")||1,u=i.getActiveViewScaleInfo(),g=i.getActiveViewSizeInfo(),v=s,w=e.point,m=i.getSharedStorage(Ni),y=i.getSharedStorage(Gi),p=i.getSharedStorage($i);if("drag"===y){if(l="drag",r&&1===(null==c?void 0:c.length)&&v&&w&&!0!==(null==(n=null==(o=c[0])?void 0:o.operations)?void 0:n.lock)){const{moveX:e,moveY:t}=function(e,t,i){let o=t.x-e.x,n=t.y-e.y;const a=[];if(i.forEach((e=>{const{x:t,y:i,w:o,h:n,angle:r=0}=e;a.push({x:t,y:i,w:o,h:n,angle:0-r})})),(null==i?void 0:i.length)>0){const i=me(e,a),r=me(t,a);o=r.x-i.x,n=r.y-i.y}return{moveX:o,moveY:n}}(v,w,p);c[0].x+=e/d,c[0].y+=t/d,f([c[0]])}t.drawFrame()}else if("drag-list"===y){if(l="drag-list",r&&v&&w&&(null==c?void 0:c.length)>1){const e=(w.x-v.x)/d,t=(w.y-v.y)/d;c.forEach((i=>{var o;i&&!0!==(null==(o=null==i?void 0:i.operations)?void 0:o.lock)&&(i.x+=e,i.y+=t)})),i.setActiveStorage("data",r)}t.drawFrame()}else if("resize"===y){if(r&&1===(null==c?void 0:c.length)&&v&&(null==m?void 0:m.startsWith("resize-"))){l="resize";const e=[];p.forEach((t=>{const{x:i,y:o,w:n,h:a,angle:r=0}=t;e.push({x:i,y:o,w:n,h:a,angle:0-r})}));let o=v,n=w;if(p.length>0&&(o=me(v,e),n=me(w,e)),"resize-rotate"===m){const e=i.getSharedStorage(Ui),t=ge([e.topLeft.center,e.topRight.center,e.bottomLeft.center,e.bottomRight.center]),o=uo(c[0],{center:t,viewScaleInfo:u,viewSizeInfo:g,start:v,end:w,resizeType:m,sharer:i});c[0].angle=o.angle}else{const e=function(e,t){var i,o,n,a,r,s,l,h,c;let{x:d,y:f,w:u,h:g,angle:v=0}=e;const w=ue({x:d,y:f,w:u,h:g,angle:v});v=Se(v);const m=ce(v),y=!!(null==(i=null==e?void 0:e.operations)?void 0:i.limitRatio),{start:p,end:x,resizeType:S,scale:b}=t;let A={...p},I={...x},M={x:A.x,y:w.y},z={x:I.x,y:w.y},P={...M},R={...z},T={x:w.x,y:A.y},E={x:w.x,y:I.y},W={...T},C={...E},k=(R.x-P.x)/b,O=(R.y-P.y)/b,j=so(k,O),D=(C.x-W.x)/b,L=(C.y-W.y)/b,B=so(D,L);(v>0||v<0)&&(A=we(w,p,0-m),I=we(w,x,0-m),M={x:A.x,y:w.y},z={x:I.x,y:w.y},P=we(w,M,m),R=we(w,z,m),T={x:w.x,y:A.y},E={x:w.x,y:I.y},W=we(w,T,m),C=we(w,E,m),k=(R.x-P.x)/b,O=(R.y-P.y)/b,j=so(k,O),j=lo(j,O),D=(C.x-W.x)/b,L=(C.y-W.y)/b,B=so(D,L),B=lo(B,L));let F=(x.x-p.x)/b,Y=(x.y-p.y)/b;if(!0===y)if(["resize-top","resize-bottom","resize-left","resize-right"].includes(S)){const t=Math.max(Math.abs(F),Math.abs(Y));F=(F>=0?1:-1)*t,Y=(Y>=0?1:-1)*t/e.w*e.h;const i=Math.max(Math.abs(D),Math.abs(L));D=(D>=0?1:-1)*i,L=(L>=0?1:-1)*i/e.w*e.h;const o=Math.max(Math.abs(k),Math.abs(O));k=(k>=0?1:-1)*o,O=(O>=0?1:-1)*o/e.w*e.h}else if(["resize-top-left","resize-top-right","resize-bottom-left","resize-bottom-right"].includes(S)){{const t=Math.abs(F);F=(F>=0?1:-1)*t;const i=t/e.w*e.h;"resize-top-left"===S||"resize-bottom-right"===S?Y=F>0?i:-i:"resize-top-right"!==S&&"resize-bottom-left"!==S||(Y=F>0?-i:i)}j=Math.abs(j),B=j/e.w*e.h}switch(S){case"resize-top":if(0===v)g-Y>0&&(f+=Y,g-=Y,!0===(null==(o=e.operations)?void 0:o.limitRatio)&&(d+=Y/e.h*e.w/2,u-=Y/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){B=0-lo(B,L);const e=ro(v),o=B/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<180){B=lo(B,D);const e=ro(v-90),o=B/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<270){B=lo(B,L);const e=ro(v-180),o=B/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<360){B=0-lo(B,D);const e=ro(v-270),o=B/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}g+B>0&&(!0===(null==(n=e.operations)?void 0:n.limitRatio)&&(u+=B/e.h*e.w),g+=B,d=t-u/2,f=i-g/2)}break;case"resize-bottom":if(0===v)e.h+Y>0&&(g+=Y,!0===(null==(a=e.operations)?void 0:a.limitRatio)&&(d-=Y/e.h*e.w/2,u+=Y/e.h*e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){B=lo(B,L);const e=ro(v),o=B/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<180){B=0-lo(B,D);const e=ro(v-90),o=B/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<270){B=lo(B,D);const e=ro(v-180),o=B/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<360){B=lo(B,D);const e=ro(v-270),o=B/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}g+B>0&&(!0===(null==(r=e.operations)?void 0:r.limitRatio)&&(u+=B/e.h*e.w),g+=B,d=t-u/2,f=i-g/2)}break;case"resize-left":if(0===v)e.w-F>0&&(d+=F,u-=F,!0===(null==(s=e.operations)?void 0:s.limitRatio)&&(g-=F/e.w*e.h,f+=F/e.w*e.h/2));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){j=0-lo(j,k);const e=ro(v),o=j/2;t-=o*Math.cos(e),i-=o*Math.sin(e)}else if(v<180){j=lo(j,k);const e=ro(v-90),o=j/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}else if(v<270){j=lo(j,O);const e=ro(v-180),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<360){j=lo(j,O);const e=ro(v-270),o=j/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}u+j>0&&(!0===(null==(l=e.operations)?void 0:l.limitRatio)&&(g+=j/e.w*e.h),u+=j,d=t-u/2,f=i-g/2)}break;case"resize-right":if(0===v)e.w+F>0&&(u+=F,!0===(null==(h=e.operations)?void 0:h.limitRatio)&&(f-=F*e.h/e.w/2,g+=F*e.h/e.w));else if(v>0||v<0){let t=w.x,i=w.y;if(v<90){j=lo(j,O);const e=ro(v),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e)}else if(v<180){j=lo(j,Y);const e=ro(v-90),o=j/2;t-=o*Math.sin(e),i+=o*Math.cos(e)}else if(v<270){j=lo(j,Y);const e=ro(v-180),o=j/2;t+=o*Math.cos(e),i+=o*Math.sin(e),j=0-j}else if(v<360){j=lo(j,F);const e=ro(v-270),o=j/2;t+=o*Math.sin(e),i-=o*Math.cos(e)}u+j>0&&(!0===(null==(c=e.operations)?void 0:c.limitRatio)&&(g+=j/e.w*e.h),u+=j,d=t-u/2,f=i-g/2)}break;case"resize-top-left":if(0===v)u-F>0&&(d+=F,u-=F),g-Y>0&&(f+=Y,g-=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=0-lo(B,L),j=0-lo(j,y?0-B:k);const i=B/2;e+=i*Math.sin(m),t-=i*Math.cos(m);const o=j/2;e-=o*Math.cos(m),t-=o*Math.sin(m)}else if(v<180){B=lo(B,D),j=lo(j,y?B:k);const i=ro(v-90),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){B=lo(B,L),j=lo(j,y?B:O);const i=ro(v-180),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){B=0-lo(B,D),j=lo(j,y?B:O);const i=ro(v-270),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-top-right":if(0===v)u+F>0&&(u+=F),g-Y>0&&(f+=Y,g-=Y);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=0-lo(B,L),j=lo(j,y?B:O);const i=ro(v),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){B=lo(B,D),j=lo(j,y?B:O);const i=ro(v-90),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){const i=ro(v-180);B=lo(B,L),j=lo(j,y?B:0-k);const o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){B=0-lo(B,D),j=lo(j,y?B:k);const i=ro(v-270),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-bottom-left":if(0===v)e.h+Y>0&&(g+=Y),e.w-F>0&&(d+=F,u-=F);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=lo(B,L),j=0-lo(j,y?0-B:k);const i=ro(v),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<180){B=0-lo(B,D),j=lo(j,y?B:k);const i=ro(v-90),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}else if(v<270){B=lo(B,D),j=lo(j,y?B:O);const i=ro(v-180),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<360){B=lo(B,D),j=lo(j,y?B:O);const i=ro(v-270),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}break;case"resize-bottom-right":if(0===v)e.h+Y>0&&(g+=Y),e.w+F>0&&(u+=F);else if(v>0||v<0){let e=w.x,t=w.y;if(v<90){B=lo(B,L),j=lo(j,y?B:O);const i=ro(v),o=B/2;e-=o*Math.sin(i),t+=o*Math.cos(i);const n=j/2;e+=n*Math.cos(i),t+=n*Math.sin(i)}else if(v<180){B=0-lo(B,D),j=lo(j,y?B:Y);const i=ro(v-90),o=B/2;e-=o*Math.cos(i),t-=o*Math.sin(i);const n=j/2;e-=n*Math.sin(i),t+=n*Math.cos(i)}else if(v<270){B=lo(B,D),j=lo(j,y?B:0-O);const i=ro(v-180),o=B/2;e+=o*Math.sin(i),t-=o*Math.cos(i);const n=j/2;e-=n*Math.cos(i),t-=n*Math.sin(i)}else if(v<360){B=lo(B,D),j=lo(j,y?B:k);const i=ro(v-270),o=B/2;e+=o*Math.cos(i),t+=o*Math.sin(i);const n=j/2;e+=n*Math.sin(i),t-=n*Math.cos(i)}g+B>0&&(g+=B),u+j>0&&(u+=j),d=e-u/2,f=t-g/2}}return{x:d,y:f,w:u,h:g,angle:e.angle}}(c[0],{scale:d,start:o,end:n,resizeType:m,sharer:i});c[0].x=e.x,c[0].y=e.y,"group"===c[0].type&&!0===(null==(a=c[0].operations)?void 0:a.deepResize)?function(e,t){const i=t.w&&t.w>0?t.w:e.w,o=t.h&&t.h>0?t.h:e.h,n=i/e.w,a=o/e.h;if(n===a&&1===n)return e;const r=Math.min(n,a),s=Math.max(n,a);e.w=i,e.h=o;const l={xRatio:n,yRatio:a,minRatio:r,maxRatio:s};"group"===e.type&&Array.isArray(e.detail.children)&&e.detail.children.forEach((e=>{Ge(e,l)})),Ye(e,l)}(c[0],{w:e.w,h:e.h}):(c[0].w=e.w,c[0].h=e.h)}f([c[0]]),t.drawFrame()}}else"area"===y&&(l="area",i.setSharedStorage(Hi,e.point),t.drawFrame());s=e.point},pointEnd(e){l=null,i.setSharedStorage(qi,!1);const o=i.getActiveStorage("data"),r=i.getSharedStorage(Ni),h=i.getSharedStorage(Gi),c=i.getActiveViewSizeInfo();let d=!1;if(s=null,"resize"===h&&r)i.setSharedStorage(Ni,null),d=!0;else if("area"===h){if(i.setSharedStorage(Gi,null),o){const e=i.getSharedStorage(Vi),t=i.getSharedStorage(Hi);if(e&&t){const{elements:a}=function(e,t){var i;const o=[],n=[],a=[],{calculator:r,viewScaleInfo:s,viewSizeInfo:l,start:h,end:c}=t;if(!(Array.isArray(e.elements)&&h&&c))return{indexes:o,uuids:n,elements:a};const d=Math.min(h.x,c.x),f=Math.max(h.x,c.x),u=Math.min(h.y,c.y),g=Math.max(h.y,c.y);for(let t=0;t<e.elements.length;t++){const h=e.elements[t];if(!0===(null==(i=null==h?void 0:h.operations)?void 0:i.lock))continue;const c=r.elementSize(h,s,l),v=ue(c);if(v.x>=d&&v.x<=f&&v.y>=u&&v.y<=g&&(o.push(t),n.push(h.uuid),a.push(h),c.angle&&(c.angle>0||c.angle<0))){const e=pe(c);if(4===e.length){const t=[e[0].x,e[1].x,e[2].x,e[3].x],i=[e[0].y,e[1].y,e[2].y,e[3].y];c.x=Math.min(...t),c.y=Math.min(...i),c.w=Math.abs(Math.max(...t)-Math.min(...t)),c.h=Math.abs(Math.max(...i)-Math.min(...i))}}}return{indexes:o,uuids:n,elements:a}}(o,{start:e,end:t,calculator:n,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()});a.length>0&&(i.setSharedStorage(Gi,"drag-list"),f(a,{triggerEvent:!0}),d=!0)}}}else if("drag-list"===h)i.setSharedStorage(Gi,"drag-list-end"),d=!0;else if(o){n.getPointElement(e.point,{data:o,viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}).element?(i.setSharedStorage(Gi,"select"),d=!0):i.setSharedStorage(Gi,null)}null===i.getSharedStorage(Gi)&&(g(),d=!0);(()=>{if(d){if(o&&Array.isArray(null==o?void 0:o.elements)&&["drag","drag-list"].includes(h)){const e=function(e,t,i){const o=Ae(e,{viewWidth:t.width,viewHeight:t.height,extend:null==i?void 0:i.extend});return!0===(null==i?void 0:i.extend)&&(o.contextWidth=Math.max(o.contextWidth,t.contextWidth),o.contextHeight=Math.max(o.contextHeight,t.contextHeight)),{contextSize:o}}(o.elements,c,{extend:!0});i.setActiveStorage("contextHeight",e.contextSize.contextHeight),i.setActiveStorage("contextWidth",e.contextSize.contextWidth)}if(o&&["drag","drag-list","drag-list-end","resize"].includes(h)){let e="dragElement";a.trigger("change",{data:o,type:e})}t.drawFrame()}})()},pointLeave(){s=null,g(),t.drawFrame()},doubleClick(e){var o,n,r,s,l,h;const d=fo(e.point,u());if(i.setSharedStorage(Ui,null),i.setSharedStorage(Qi,[]),1!==d.elements.length||!0!==(null==(n=null==(o=d.elements[0])?void 0:o.operations)?void 0:n.lock)){if(1===d.elements.length&&"group"===(null==(r=d.elements[0])?void 0:r.type)){if(!0===c(d.elements[0]))return i.setSharedStorage(Gi,null),void t.drawFrame()}else 1===d.elements.length&&"text"===(null==(s=d.elements[0])?void 0:s.type)&&a.trigger(vo,{element:d.elements[0],groupQueue:i.getSharedStorage($i)||[],position:Ie(null==(l=d.elements[0])?void 0:l.uuid,(null==(h=i.getActiveStorage("data"))?void 0:h.elements)||[]),viewScaleInfo:i.getActiveViewScaleInfo()});i.setSharedStorage(Gi,null)}},beforeDrawFrame({snapshot:t}){var i;const{activeStore:o,sharedStore:a}=t,{scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f,width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m}=o,y=e.sharer,p={scale:s,offsetLeft:l,offsetTop:c,offsetRight:d,offsetBottom:f},x={width:u,height:g,contextHeight:v,contextWidth:w,devicePixelRatio:m},S=a[Qi][0],b=a[Zi],A=a[Xi],I=a[Gi],M=a[Vi],z=a[Hi],P=a[$i],R=a[Ki],T=a[qi],E={calculator:n,viewScaleInfo:p,viewSizeInfo:x},W=S?Oe(S,{groupQueue:P,controllerSize:10,viewScaleInfo:p}):null,C=!!(null==(i=null==b?void 0:b.operations)?void 0:i.lock);if((null==P?void 0:P.length)>0)!function(e,t,i){for(let o=0;o<t.length;o++){const n=t[o],a={borderColor:_i,borderWidth:2,background:"transparent",lineDash:[4,4]};to(e,We(n,i),a)}}(r,R,E),b&&"drag"!==I&&(C?no(r,A,{...E,controller:Oe(b,{groupQueue:P,controllerSize:10,viewScaleInfo:p})}):oo(r,A,E)),!C&&S&&["select","drag","resize"].includes(I)&&ao(r,W,{...E,element:S,groupQueue:P,hideControllers:!!T&&"drag"===I});else if(b&&"drag"!==I&&(C?no(r,A,{...E,controller:Oe(b,{groupQueue:P,controllerSize:10,viewScaleInfo:p})}):oo(r,A,E)),!C&&S&&["select","drag","resize"].includes(I))ao(r,W,{...E,element:S,groupQueue:P,hideControllers:!!T&&"drag"===I});else if("area"===I&&M&&z)!function(e,t){const{start:i,end:o}=t;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=_i,e.fillStyle="#1976d24f",e.beginPath(),e.moveTo(i.x,i.y),e.lineTo(o.x,i.y),e.lineTo(o.x,o.y),e.lineTo(i.x,o.y),e.closePath(),e.stroke(),e.fill()}(r,{start:M,end:z});else if(["drag-list","drag-list-end"].includes(I)){const e=go(h(),{viewScaleInfo:y.getActiveViewScaleInfo(),viewSizeInfo:y.getActiveViewSizeInfo(),calculator:n});e&&function(e,t){const{areaSize:i}=t,{x:o,y:n,w:a,h:r}=i;e.setLineDash([]),e.lineWidth=1,e.strokeStyle=_i,e.fillStyle="#1976d21c",e.beginPath(),e.moveTo(o,n),e.lineTo(o+a,n),e.lineTo(o+a,n+r),e.lineTo(o,n+r),e.closePath(),e.stroke(),e.fill()}(r,{areaSize:e})}}}},e.MiddlewareTextEditor=e=>{const{eventHub:t,boardContent:i,viewer:o}=e,n=i.boardContext.canvas,a=document.createElement("div");a.setAttribute("contenteditable","true");const r=document.createElement("div"),s=e.container||document.body,l=document.createElement("div");let h=null,c=[];r.appendChild(a),r.style.position="absolute",l.appendChild(r),l.style.position="fixed",l.style.top="0",l.style.bottom="0",l.style.left="0",l.style.right="0",l.style.display="none",s.appendChild(l);const d=()=>{l.style.display="none",h=null,c=[]},f=e=>{const{size:t,parent:i}=e,o=document.createElement("div"),{x:n,y:a,w:r,h:s}=t,l=Se(t.angle||0);return o.style.position="absolute",o.style.left=`${n}px`,o.style.top=`${a}px`,o.style.width=`${r}px`,o.style.height=`${s}px`,o.style.transform=`rotate(${l}deg)`,i.appendChild(o),o},u=e=>{const{viewScaleInfo:t,element:i,groupQueue:o}=e,{scale:n,offsetTop:s,offsetLeft:l}=t;r.children&&Array.from(r.children).forEach((e=>{e.remove()}));let h=r;for(let e=0;e<o.length;e++){const t=o[e],{x:i,y:a,w:r,h:c}=t,d={x:i*n,y:a*n,w:r*n,h:c*n,angle:Se(t.angle||0)};0===e&&(d.x+=l,d.y+=s),h=f({size:d,parent:h})}const c={...mo,...i.detail};let d=i.x*n+l,u=i.y*n+s,g=i.w*n,v=i.h*n;o.length>0&&(d=i.x*n,u=i.y*n,g=i.w*n,v=i.h*n);let w="center",m="center";"left"===c.textAlign?w="start":"right"===c.textAlign&&(w="end"),"top"===c.verticalAlign?m="start":"bottom"===c.verticalAlign&&(m="end"),a.style.display="inline-flex",a.style.justifyContent=w,a.style.alignItems=m,a.style.position="absolute",a.style.left=d-1+"px",a.style.top=u-1+"px",a.style.width=`${g+2}px`,a.style.height=`${v+2}px`,a.style.transform=`rotate(${Se(i.angle||0)}deg)`,a.style.boxSizing="border-box",a.style.border="1px solid #1973ba",a.style.resize="none",a.style.overflow="hidden",a.style.wordBreak="break-all",a.style.background="#FFFFFF",a.style.color="#333333",a.style.fontSize=c.fontSize*n+"px",a.style.lineHeight=c.lineHeight*n+"px",a.style.fontFamily=c.fontFamily,a.style.fontWeight=`${c.fontWeight}`,a.style.padding="0",a.style.margin="0",a.style.outline="none",a.innerText=c.text||"",h.appendChild(a)},g=()=>{const{left:e,top:t,width:i,height:o}=(()=>{const e=n.getBoundingClientRect(),{left:t,top:i,width:o,height:a}=e;return{left:t,top:i,width:o,height:a}})();r.style.position="absolute",r.style.overflow="hidden",r.style.top=`${t}px`,r.style.left=`${e}px`,r.style.width=`${i}px`,r.style.height=`${o}px`};l.addEventListener("click",(()=>{d()})),a.addEventListener("click",(e=>{e.stopPropagation()})),a.addEventListener("input",(()=>{h&&c&&(h.detail.text=a.innerText||"",t.trigger(wo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c||[]]}),o.drawFrame())})),a.addEventListener("blur",(()=>{h&&c&&t.trigger(wo,{element:{uuid:h.uuid,detail:{text:h.detail.text}},position:[...c]}),d()})),a.addEventListener("keydown",(e=>{e.stopPropagation()})),a.addEventListener("keypress",(e=>{e.stopPropagation()})),a.addEventListener("keyup",(e=>{e.stopPropagation()})),a.addEventListener("wheel",(e=>{e.stopPropagation(),e.preventDefault()}));const v=e=>{var t;(null==e?void 0:e.position)&&(null==e?void 0:e.element)&&"text"===(null==(t=null==e?void 0:e.element)?void 0:t.type)&&(h=e.element,c=e.position),(e=>{g(),u(e),l.style.display="block"})(e)};return{name:"@middleware/text-editor",use(){t.on(vo,v)},disuse(){t.off(vo,v)}}},e.middlewareEventRuler=Go,e.middlewareEventScale=ko,e.middlewareEventSelect=yo,e.middlewareEventSelectClear=po,e.middlewareEventTextChange=wo,e.middlewareEventTextEdit=vo,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
|