@idraw/board
Advanced tools
Comparing version 0.4.0-beta.21 to 0.4.0-beta.22
@@ -1,1 +0,1 @@ | ||
var iDrawBoard=function(t){"use strict";var e,i,n,o,a,s,r,l,h,c,f,d,u,w,v,g,p,y,m,b,x,S,I,M,z,C,P,W,k,E,O,R,A,T,L,V,j,D,$,B,X,Y,F,H,U,G,N,Q,q,K,J,Z,_,tt,et,it,nt,ot,at,st,rt,lt,ht,ct,ft,dt,ut,wt,vt,gt,pt,yt=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},mt=(t,e,i)=>(yt(t,e,"read from private field"),i?i.call(t):e.get(t)),bt=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},xt=(t,e,i,n)=>(yt(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),St=(t,e,i)=>(yt(t,e,"access private method"),i);function It(t){return"string"==typeof t&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^[a-z]{1,}$/i.test(t))}function Mt(t,e){if(1===e)return t;let i=1;const n=/^\#[0-9a-f]{6,6}$/i;let o=t;if(n.test(t)?i=parseInt(t.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(t)&&(i=parseInt(t.substring(7,9).replace(/^\#/,"0x")),o=t.substring(0,7)),i*=e,n.test(o)&&i>0&&i<1){const t=Math.max(0,Math.min(255,Math.ceil(256*i)));o=`${o.toUpperCase()}${t.toString(16).toUpperCase()}`}return o}function zt(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function Ct(t){let e=0;for(let i=0;i<t.length;i++)e+=t.charCodeAt(i)*t.charCodeAt(i)*i*i;return e.toString(16).substring(0,4)}function Pt(t){const e=t.length,i=Math.floor(e/2),n=t.substring(0,4).padEnd(4,"0"),o=t.substring(0,4).padEnd(4,"0");return`@assets/${Ct(e.toString(16).padEnd(4,n))}${Ct(t.substring(i-4,i).padEnd(4,n)).padEnd(4,"f")}-${Ct(t.substring(i-8,i-4).padEnd(4,n)).padEnd(4,"f")}-${Ct(t.substring(i-12,i-8).padEnd(4,n)).padEnd(4,"f")}-${Ct(t.substring(i-16,i-12).padEnd(4,o)).padEnd(4,"f")}-${Ct(t.substring(i,i+4).padEnd(4,o)).padEnd(4,"f")}${Ct(t.substring(i+4,i+8).padEnd(4,o)).padEnd(4,"f")}${Ct(o.padEnd(4,n).padEnd(4,o))}`}function Wt(t){return function t(e){const i=function(t){return Object.prototype.toString.call(t).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(e);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return e;if("Array"===i){const i=[];return e.forEach((e=>{i.push(t(e))})),i}if("Object"===i){const i={};Object.keys(e).forEach((n=>{i[n]=t(e[n])}));return Object.getOwnPropertySymbols(e).forEach((n=>{i[n]=t(e[n])})),i}}(t)}function kt(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const Et={type(t,e){const i=kt(t);return!0===e?i.toLocaleLowerCase():i},array:t=>"Array"===kt(t),json:t=>"Object"===kt(t),function:t=>"Function"===kt(t),asyncFunction:t=>"AsyncFunction"===kt(t),boolean:t=>"Boolean"===kt(t),string:t=>"String"===kt(t),number:t=>"Number"===kt(t),undefined:t=>"Undefined"===kt(t),null:t=>"Null"===kt(t),promise:t=>"Promise"===kt(t)};var Ot=function(t,e,i,n){return new(i||(i=Promise))((function(o,a){function s(t){try{l(n.next(t))}catch(t){a(t)}}function r(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((n=n.apply(t,e||[])).next())}))};const{Image:Rt}=window;function At(t){return new Promise(((e,i)=>{const n=new Rt;n.crossOrigin="anonymous",n.onload=function(){e(n)},n.onabort=i,n.onerror=i,n.src=t}))}function Tt(t){return Ot(this,void 0,void 0,(function*(){const e=yield function(t){return new Promise(((e,i)=>{const n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=new FileReader;o.readAsDataURL(n),o.onload=function(t){var i;const n=null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result;e(n)},o.onerror=function(t){i(t)}}))}(t);return yield At(e)}))}function Lt(t,e){return Ot(this,void 0,void 0,(function*(){t=t.replace(/\&/gi,"&");const i=yield function(t,e){const{width:i,height:n}=e;return new Promise(((e,o)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${n||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${t}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),s=new FileReader;s.readAsDataURL(a),s.onload=function(t){var i;const n=null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result;e(n)},s.onerror=function(t){o(t)}}))}(t,e);return yield At(i)}))}function Vt(t){return"number"==typeof t&&(t>0||t<=0)}function jt(t){return"number"==typeof t&&t>=0}function Dt(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function $t(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}const Bt={x:function(t){return Vt(t)},y:function(t){return Vt(t)},w:jt,h:function(t){return"number"==typeof t&&t>=0},angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:Vt,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return jt(t)},borderRadius:function(t){return Vt(t)&&t>=0},color:function(t){return It(t)},imageSrc:function(t){return $t(t)||Dt(t)},imageURL:Dt,imageBase64:$t,svg:function(t){return"string"==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test(`${t}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${t}`.trim())},html:function(t){let e=!1;if("string"==typeof t){let i=document.createElement("div");i.innerHTML=t,i.children.length>0&&(e=!0),i=null}return e},text:function(t){return"string"==typeof t},fontSize:function(t){return Vt(t)&&t>0},lineHeight:function(t){return Vt(t)&&t>0},textAlign:function(t){return["center","left","right"].includes(t)},fontFamily:function(t){return"string"==typeof t&&t.length>0},fontWeight:function(t){return["bold"].includes(t)},strokeWidth:function(t){return Vt(t)&&t>0}};var Xt,Yt=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class Ft{constructor(){Xt.set(this,void 0),function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,i):o?o.value=i:e.set(t,i)}(this,Xt,new Map,"f")}on(t,e){if(Yt(this,Xt,"f").has(t)){const i=Yt(this,Xt,"f").get(t)||[];null==i||i.push(e),Yt(this,Xt,"f").set(t,i)}else Yt(this,Xt,"f").set(t,[e])}off(t,e){if(Yt(this,Xt,"f").has(t)){const i=Yt(this,Xt,"f").get(t);if(Array.isArray(i))for(let t=0;t<(null==i?void 0:i.length);t++)if(i[t]===e){i.splice(t,1);break}Yt(this,Xt,"f").set(t,i||[])}}trigger(t,e){const i=Yt(this,Xt,"f").get(t);return!!Array.isArray(i)&&(i.forEach((t=>{t(e)})),!0)}has(t){if(Yt(this,Xt,"f").has(t)){const e=Yt(this,Xt,"f").get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){Yt(this,Xt,"f").clear()}}function Ht(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}Xt=new WeakMap;var Ut,Gt,Nt,Qt,qt=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},Kt=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class Jt{constructor(t){Ut.add(this),Gt.set(this,void 0),Nt.set(this,void 0),qt(this,Nt,Wt(t.defaultStorage),"f"),qt(this,Gt,Kt(this,Ut,"m",Qt).call(this),"f")}set(t,e){Kt(this,Gt,"f")[t]=e}get(t){return Kt(this,Gt,"f")[t]}getSnapshot(t){return!0===(null==t?void 0:t.deepClone)?Wt(Kt(this,Gt,"f")):Object.assign({},Kt(this,Gt,"f"))}clear(){qt(this,Gt,Kt(this,Ut,"m",Qt).call(this),"f")}destroy(){qt(this,Gt,null,"f")}}function Zt(t){return t/180*Math.PI}function _t(t,e,i){const n=te(e);!function(t,e,i,n){const o=Zt(e||0);i&&(o>0||o<0)&&(t.translate(i.x,i.y),t.rotate(o),t.translate(-i.x,-i.y)),n(t),i&&(o>0||o<0)&&(t.translate(i.x,i.y),t.rotate(-o),t.translate(-i.x,-i.y))}(t,e.angle||0,n,(()=>{i(t)}))}function te(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function ee(t){const e=Math.min(t[0].x,t[1].x,t[2].x,t[3].x),i=Math.min(t[0].y,t[1].y,t[2].y,t[3].y);return te({x:e,y:i,w:Math.max(t[0].x,t[1].x,t[2].x,t[3].x)-e,h:Math.max(t[0].y,t[1].y,t[2].y,t[3].y)-i})}function ie(t,e,i){const n=function(t,e){const i=e.x-t.x,n=e.y-t.y;if(0===i){if(n<0)return 0;if(n>0)return Math.PI}else if(0===n){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&n<0?Math.atan(Math.abs(i)/Math.abs(n)):i>0&&n>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(n)):i<0&&n>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(n)):i<0&&n<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(n)):0}(t,e);let o=n+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 a=function(t,e){const i=(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y);return 0===i?i:Math.sqrt(i)}(t,e);let s=0,r=0;return 0===o?(s=0,r=0-a):o>0&&o<Math.PI/2?(s=Math.sin(o)*a,r=0-Math.cos(o)*a):o===Math.PI/2?(s=a,r=0):o>Math.PI/2&&o<Math.PI?(s=Math.sin(Math.PI-o)*a,r=Math.cos(Math.PI-o)*a):o===Math.PI?(s=0,r=a):o>Math.PI&&o<1.5*Math.PI?(s=0-Math.sin(o-Math.PI)*a,r=Math.cos(o-Math.PI)*a):o===1.5*Math.PI?(s=0-a,r=0):o>1.5*Math.PI&&o<2*Math.PI?(s=0-Math.sin(2*Math.PI-o)*a,r=0-Math.cos(2*Math.PI-o)*a):o===2*Math.PI&&(s=0,r=0-a),s+=t.x,r+=t.y,{x:s,y:r}}function ne(t,e,i){const{x:n,y:o,w:a,h:s}=t;let r={x:n,y:o},l={x:n+a,y:o},h={x:n+a,y:o+s},c={x:n,y:o+s};if(i&&(i>0||i<0)){const t=Zt(function(t){if(!(t>0||t<0)||0===t)return 0;let e=t%360;e<0&&(e+=360);return e}(i));r=ie(e,r,t),l=ie(e,l,t),h=ie(e,h,t),c=ie(e,c,t)}return[r,l,h,c]}function oe(t){const{angle:e=0}=t;return ne(t,te(t),e)}function ae(t,e,i){return[ie(t,{x:e[0].x,y:e[0].y},i),ie(t,{x:e[1].x,y:e[1].y},i),ie(t,{x:e[2].x,y:e[2].y},i),ie(t,{x:e[3].x,y:e[3].y},i)]}function se(t,e){var i;const n=[];let o=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const a=o[e[t]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(i=null==a?void 0:a.detail)||void 0===i?void 0:i.children))return null;n.push(a),o=a.detail.children}return n}function re(t){const{x:e,y:i,h:n,w:o}=t;return[{x:e,y:i},{x:e+o,y:i},{x:e+o,y:i+n},{x:e,y:i+n}]}function le(t){const{x:e,y:i,w:n,h:o,angle:a=0}=t;return 0===a?re(t):ne(t,te({x:e,y:i,w:n,h:o,angle:a}),a)}function he(t,e){const{groupQueue:i}=e;if(!(i.length>0))return[le(t)];const n=function(t){const e=[];let i=0,n=0;const o=[],a=[...t];for(let t=0;t<a.length;t++){const{x:s,y:r,w:l,h:h,angle:c=0}=a[t];let f;if(i+=s,n+=r,0===t){const t={x:i,y:n,w:l,h:h,angle:c};f=le({x:s,y:r,w:l,h:h,angle:c}),o.push({center:te(t),angle:c,radian:Zt(c)})}else{f=re({x:i,y:n,w:l,h:h,angle:c});for(let t=0;t<o.length;t++){const{center:e,radian:i}=o[t];f=ae(e,f,i)}const t=ee(f);(c>0||c<0)&&(f=ae(t,f,Zt(c))),o.push({center:t,angle:c,radian:Zt(c)})}e.push(f)}return e}([...i,t]);return n}function ce(t,e){const{viewScaleInfo:i}=e,{x:n,y:o,w:a,h:s,angle:r}=t,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:n*l+c,y:o*l+h,w:a*l,h:s*l,angle:r}}function fe(t,e){const{viewScaleInfo:i}=e,{x:n,y:o}=t,{scale:a,offsetTop:s,offsetLeft:r}=i;return{x:n*a+r,y:o*a+s}}function de(t,e){const{context2d:i,element:n,viewScaleInfo:o}=e,{angle:a=0}=n,{x:s,y:r,w:l,h:h}=ce(n,{viewScaleInfo:o}),c=oe({x:s,y:r,w:l,h:h,angle:a});if(c.length>=2){i.beginPath(),i.moveTo(c[0].x,c[0].y);for(let t=1;t<c.length;t++)i.lineTo(c[t].x,c[t].y);i.closePath()}return!!i.isPointInPath(t.x,t.y)}function ue(t,e){const{groupQueue:i}=e,n=function(t,e){return he(t,e).pop()||null}(t,{groupQueue:i}),o=Ht(n[0],n[1]),a=Ht(n[1],n[2]),s=Ht(n[2],n[3]),r=Ht(n[3],n[0]),l=n[0],h=n[1],c=n[2],f=n[3],d=Math.max(l.x,h.x,c.x,f.x),u=Math.max(l.y,h.y,c.y,f.y);return{center:{x:(d+Math.min(l.x,h.x,c.x,f.x))/2,y:(u+Math.min(l.y,h.y,c.y,f.y))/2},topLeft:l,topRight:h,bottomLeft:f,bottomRight:c,top:o,right:a,left:r,bottom:s}}function we(t){const e=Math.max(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),i=Math.max(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),n=Math.min(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),a={x:t.center.x,y:t.center.y},s={x:n,y:o},r={x:e,y:o},l={x:e,y:i},h={x:n,y:i},c=Ht(s,r),f=Ht(h,l),d=Ht(s,h);return{center:a,topLeft:s,topRight:r,bottomLeft:h,bottomRight:l,top:c,right:Ht(r,l),left:d,bottom:f}}function ve(t,e){const i=function(t){const{viewScaleInfo:e,viewSizeInfo:i}=t,{scale:n,offsetTop:o,offsetLeft:a}=e,{width:s,height:r}=i,l=0-a/n,h=0-o/n,c=s/n,f=r/n,d=te({x:l,y:h,w:c,h:f}),u={x:l,y:h},w={x:l+c,y:h},v={x:l,y:h+f},g={x:l+c,y:h+f},p={x:l,y:d.y},y={x:d.x,y:h},m={x:l+c,y:d.y},b={x:d.x,y:h+f};return{center:d,topLeft:u,topRight:w,bottomLeft:v,bottomRight:g,left:p,top:y,right:m,bottom:b}}(e);let n=0,o=0;return Object.keys(t).forEach((e=>{const a=t[e];a.isVisibleInView=function(t,e){const i=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),n=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),a=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),s=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),r=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),l=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),h=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y);return i<=r&&n>=s&&o<=h&&a>=l||r<=a&&r>=a&&r<=a&&r>=a}(a.rangeRectInfo,i),a.isVisibleInView?n++:o++})),{viewVisibleInfoMap:t,visibleCount:n,invisibleCount:o}}function ge(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e}Gt=new WeakMap,Nt=new WeakMap,Ut=new WeakSet,Qt=function(){return Wt(Kt(this,Nt,"f"))};const pe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function ye(t,e){const{viewScaleInfo:i}=e,{scale:n}=i;let{borderRadius:o}=t.detail;const{boxSizing:a=pe.boxSizing,borderWidth:s}=t.detail;Array.isArray(s)&&(o=0);let{x:r,y:l,w:h,h:c}=t,f=[0,0,0,0];if("number"==typeof o){const t=o*n;f=[t,t,t,t]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(f=[o[0]*n,o[1]*n,o[2]*n,o[3]*n]);let d=0;return"number"==typeof s&&(d=(s||0)*n),"border-box"===a?(r=t.x+d/2,l=t.y+d/2,h=t.w-d,c=t.h-d):"content-box"===a?(r=t.x-d/2,l=t.y-d/2,h=t.w+d,c=t.h+d):(r=t.x,l=t.y,h=t.w,c=t.h),h=Math.max(h,1),c=Math.max(c,1),f=f.map((t=>Math.min(t,h/2,c/2))),{x:r,y:l,w:h,h:c,radiusList:f}}function me(t,e,i){if("string"==typeof e)return e;const{viewElementSize:n,viewScaleInfo:o,opacity:a=1}=i,{x:s,y:r}=n,{scale:l}=o;if("linear-gradient"===(null==e?void 0:e.type)){const{start:i,end:n,stops:o}=e,h={x:s+i.x*l,y:r+i.y*l},c={x:s+n.x*l,y:r+n.y*l},f=t.createLinearGradient(h.x,h.y,c.x,c.y);return o.forEach((t=>{f.addColorStop(t.offset,Mt(t.color,a))})),f}if("radial-gradient"===(null==e?void 0:e.type)){const{inner:i,outer:n,stops:o}=e,h={x:s+i.x*l,y:r+i.y*l,radius:i.radius*l},c={x:s+n.x*l,y:r+n.y*l,radius:n.radius*l},f=t.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return o.forEach((t=>{f.addColorStop(t.offset,Mt(t.color,a))})),f}return"#000000"}const be={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,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function xe(t){var e,i,n,o;let a=1;return void 0!==(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.opacity)&&(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.opacity)<=1&&(a=null===(o=null==t?void 0:t.detail)||void 0===o?void 0:o.opacity),a}function Se(t,e,i){const{pattern:n,renderContent:o,originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=xe(a)*h;!function(t,e,i){const{renderContent:n,originElem:o,calcElemSize:a,viewSizeInfo:s}=i,r=s.devicePixelRatio,{clipPath:l}=(null==o?void 0:o.detail)||{};if(l&&a&&l.commands){const{x:i,y:o,w:s,h:h}=a,{originW:c,originH:f,originX:d,originY:u}=l,w=s/c,v=h/f,g=i-d*w,p=o-u*v;t.save(),t.translate(g,p),t.scale(r*w,r*v);const y=ge(l.commands||[]),m=new Path2D(y);t.clip(m),t.translate(0-g,0-p),t.setTransform(1,0,0,1,0,0),_t(t,Object.assign({},e),(()=>{null==n||n()})),t.restore()}else null==n||n()}(t,e,{originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l,renderContent:()=>{t.globalAlpha=c,Ie(t,e,{pattern:n,viewScaleInfo:r,viewSizeInfo:l}),null==o||o(),Me(t,e,{viewScaleInfo:r,viewSizeInfo:l}),t.globalAlpha=h}})}function Ie(t,e,i){var n,o;const{pattern:a,viewScaleInfo:s,viewSizeInfo:r}=i,l=[];if(e.detail.background||a){const{x:i,y:h,w:c,h:f,radiusList:d}=ye(e,{viewScaleInfo:s,viewSizeInfo:r});if(t.beginPath(),t.moveTo(i+d[0],h),t.arcTo(i+c,h,i+c,h+f,d[1]),t.arcTo(i+c,h+f,i,h+f,d[2]),t.arcTo(i,h+f,i,h,d[3]),t.arcTo(i,h,i+c,h,d[0]),t.closePath(),"string"==typeof a)t.fillStyle=a;else if(["CanvasPattern"].includes(Et.type(a)))t.fillStyle=a;else if("string"==typeof e.detail.background)t.fillStyle=e.detail.background;else if("linear-gradient"===(null===(n=e.detail.background)||void 0===n?void 0:n.type)){const n=me(t,e.detail.background,{viewElementSize:{x:i,y:h,w:c,h:f},viewScaleInfo:s,opacity:t.globalAlpha});t.fillStyle=n}else if("radial-gradient"===(null===(o=e.detail.background)||void 0===o?void 0:o.type)){const n=me(t,e.detail.background,{viewElementSize:{x:i,y:h,w:c,h:f},viewScaleInfo:s,opacity:t.globalAlpha});if(t.fillStyle=n,l&&l.length>0)for(let e=0;e<(null==l?void 0:l.length);e++){const n=l[e];"translate"===n.method?t.translate(n.args[0]+i,n.args[1]+h):"rotate"===n.method?t.rotate(...n.args):"scale"===n.method&&t.scale(...n.args)}}t.fill(),l&&l.length>0&&t.setTransform(1,0,0,1,0,0)}}function Me(t,e,i){if(0===e.detail.borderWidth)return;if(!It(e.detail.borderColor))return;const{viewScaleInfo:n}=i,{scale:o}=n;let a=be.borderColor;!0===It(e.detail.borderColor)&&(a=e.detail.borderColor);const{borderWidth:s,borderRadius:r,borderDash:l,boxSizing:h=be.boxSizing}=e.detail;let c=0;"number"==typeof s&&(c=s||1),c*=o;let f=[0,0,0,0];if("number"==typeof r){const t=r*o;f=[t,t,t,t]}else Array.isArray(r)&&4===(null==r?void 0:r.length)&&(f=[r[0]*o,r[1]*o,r[2]*o,r[3]*o]);t.strokeStyle=a;let d=[];Array.isArray(l)&&l.length>0&&(d=l.map((t=>Math.ceil(t*o))));let u=0,w=0,v=0,g=0;if(Array.isArray(s)&&(u=(s[0]||0)*o,w=(s[1]||0)*o,v=(s[2]||0)*o,g=(s[3]||0)*o),g||w||u||v){t.lineCap="butt";let{x:i,y:n,w:o,h:a}=e;"border-box"===h?(i+=g/2,n+=u/2,o=o-g/2-w/2,a=a-u/2-v/2):"content-box"===h?(i-=g/2,n-=u/2,o=o+g/2+w/2,a=a+u/2+v/2):(i=e.x,n=e.y,o=e.w,a=e.h),u&&(t.beginPath(),t.lineWidth=u,t.moveTo(i-g/2,n),t.lineTo(i+o+w/2,n),t.closePath(),t.stroke()),w&&(t.beginPath(),t.lineWidth=w,t.moveTo(i+o,n-u/2),t.lineTo(i+o,n+a+v/2),t.closePath(),t.stroke()),v&&(t.beginPath(),t.lineWidth=v,t.moveTo(i-g/2,n+a),t.lineTo(i+o+w/2,n+a),t.closePath(),t.stroke()),g&&(t.beginPath(),t.lineWidth=g,t.moveTo(i,n-u/2),t.lineTo(i,n+a+v/2),t.closePath(),t.stroke())}else{let{x:i,y:n,w:o,h:a}=e;"border-box"===h?(i=e.x+c/2,n=e.y+c/2,o=e.w-c,a=e.h-c):"content-box"===h?(i=e.x-c/2,n=e.y-c/2,o=e.w+c,a=e.h+c):(i=e.x,n=e.y,o=e.w,a=e.h),d.length>0?t.lineCap="butt":t.lineCap="square",o=Math.max(o,1),a=Math.max(a,1),f=f.map((t=>Math.min(t,o/2,a/2))),t.setLineDash(d),t.lineWidth=c,t.beginPath(),t.moveTo(i+f[0],n),t.arcTo(i+o,n,i+o,n+a,f[1]),t.arcTo(i+o,n+a,i,n+a,f[2]),t.arcTo(i,n+a,i,n,f[3]),t.arcTo(i,n,i+o,n,f[0]),t.closePath(),t.stroke()}t.setLineDash([])}function ze(t,e,i){const{detail:n}=e,{viewScaleInfo:o,renderContent:a}=i,{shadowColor:s,shadowOffsetX:r,shadowOffsetY:l,shadowBlur:h}=n;Bt.number(h)?(t.save(),t.shadowColor=s||be.shadowColor,t.shadowOffsetX=(r||0)*o.scale,t.shadowOffsetY=(l||0)*o.scale,t.shadowBlur=(h||0)*o.scale,a(),t.restore()):(t.save(),t.shadowColor="transparent",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,a(),t.restore())}const Ce={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Pe(t,e,i){var n;if(!0===(null===(n=null==e?void 0:e.operations)||void 0===n?void 0:n.invisible))return;const{w:o,h:a}=e,{scale:s}=i.viewScaleInfo;if(!(s<1&&(o*s<1||a*s<1)||0===i.parentOpacity))try{switch(e.type){case"rect":!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ce(e,{viewScaleInfo:n,viewSizeInfo:o})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});_t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{ze(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{Se(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{}})}})}))}(t,e,i);break;case"circle":!function(t,e,i){const{detail:n,angle:o}=e,{viewScaleInfo:a,viewSizeInfo:s,parentOpacity:r}=i,{background:l="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:f=0}=n;let d=0;"number"==typeof f&&f>0?d=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(d=f[0]),d*=a.scale;const{x:u,y:w,w:v,h:g}=ce({x:e.x,y:e.y,w:e.w,h:e.h},{viewScaleInfo:a,viewSizeInfo:s})||e,p=Object.assign(Object.assign({},e),{x:u,y:w,w:v,h:g,angle:o});_t(t,{x:u,y:w,w:v,h:g,angle:o},(()=>{ze(t,p,{viewScaleInfo:a,viewSizeInfo:s,renderContent:()=>{let e=v/2,i=g/2;const n=u+e,o=w+i;if(d>0&&("border-box"===c?(e-=d,i-=d):"center-line"===c?(e-=d/2,i-=d/2):(e-=d,i-=d)),e>=0&&i>=0){const s=xe(p)*r;if(t.globalAlpha=s,"number"==typeof d&&d>0){const a=d/2+e,s=d/2+i;t.beginPath(),t.strokeStyle=h,t.lineWidth=d,t.circle(n,o,a,s,0,0,2*Math.PI),t.closePath(),t.stroke()}t.beginPath();const c=me(t,l,{viewElementSize:{x:u,y:w,w:v,h:g},viewScaleInfo:a,opacity:t.globalAlpha});t.fillStyle=c,t.circle(n,o,e,i,0,0,2*Math.PI),t.closePath(),t.fill(),t.globalAlpha=r}}})}))}(t,e,i);break;case"text":!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ce(e,{viewScaleInfo:n})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});_t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{Se(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const i=Object.assign(Object.assign({},Ce),e.detail),o=i.fontSize||Ce.fontSize,a=o*n.scale,c=(i.lineHeight||o)*n.scale;t.fillStyle=e.detail.color||Ce.color,t.textBaseline="top",t.$setFont({fontWeight:i.fontWeight,fontSize:a,fontFamily:i.fontFamily});const f=i.text.replace(/\r\n/gi,"\n"),d=c,u=f.split("\n"),w=[];let v=0;u.forEach(((e,i)=>{let n="";if(e.length>0){for(let o=0;o<e.length&&(t.measureText(n+(e[o]||"")).width<=t.$doPixelRatio(l)?n+=e[o]||"":(w.push({text:n,width:t.$undoPixelRatio(t.measureText(n).width)}),n=e[o]||"",v++),!((v+1)*d>h));o++)if(e.length-1===o&&(v+1)*d<=h){w.push({text:n,width:t.$undoPixelRatio(t.measureText(n).width)}),i<u.length-1&&v++;break}}else w.push({text:"",width:0})}));let g=0;w.length*d<h&&("top"===e.detail.verticalAlign?g=0:"bottom"===e.detail.verticalAlign?g+=h-w.length*d:g+=(h-w.length*d)/2);{const e=r+g;void 0!==i.textShadowColor&&It(i.textShadowColor)&&(t.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&Bt.number(i.textShadowOffsetX)&&(t.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&Bt.number(i.textShadowOffsetY)&&(t.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&Bt.number(i.textShadowBlur)&&(t.shadowBlur=i.textShadowBlur),w.forEach(((n,o)=>{let a=s;"center"===i.textAlign?a=s+(l-n.width)/2:"right"===i.textAlign&&(a=s+(l-n.width)),t.fillText(n.text,a,e+d*o)}))}}})}))}(t,e,i);break;case"image":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ce(e,{viewScaleInfo:o,viewSizeInfo:a})||e,d=Object.assign(Object.assign({},e),{x:r,y:l,w:h,h:c,angle:f});_t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{ze(t,d,{viewScaleInfo:o,viewSizeInfo:a,renderContent:()=>{Se(t,d,{originElem:e,calcElemSize:{x:r,y:l,w:h,h:c,angle:f},viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s,renderContent:()=>{if(n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"image"===e.type&&n){t.globalAlpha=xe(e)*s;const{x:i,y:r,w:l,h:h,radiusList:c}=ye(d,{viewScaleInfo:o,viewSizeInfo:a});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(i+c[0],r),t.arcTo(i+l,r,i+l,r+h,c[1]),t.arcTo(i+l,r+h,i,r+h,c[2]),t.arcTo(i,r+h,i,r,c[3]),t.arcTo(i,r,i+l,r,c[0]),t.closePath(),t.fill(),t.clip(),t.drawImage(n,i,r,l,h),t.globalAlpha=s,t.restore()}}})}})}))}(t,e,i);break;case"svg":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ce(e,{viewScaleInfo:o,viewSizeInfo:a})||e;_t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"svg"===e.type&&n&&(t.globalAlpha=xe(e)*s,t.drawImage(n,r,l,h,c),t.globalAlpha=s)}))}(t,e,i);break;case"html":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ce(e,{viewScaleInfo:o,viewSizeInfo:a})||e;_t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"html"===e.type&&n&&(t.globalAlpha=xe(e)*s,t.drawImage(n,r,l,h,c),t.globalAlpha=s)}))}(t,e,i);break;case"path":!function(t,e,i){const{detail:n}=e,{originX:o,originY:a,originW:s,originH:r}=n,{viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c}=i,{x:f,y:d,w:u,h:w,angle:v}=ce(e,{viewScaleInfo:l,viewSizeInfo:h})||e,g=u/s,p=w/r,y=f-o*g,m=d-a*p,b=l.scale*h.devicePixelRatio,x=Object.assign(Object.assign({},e),{x:f,y:d,w:u,h:w,angle:v});_t(t,{x:f,y:d,w:u,h:w,angle:v},(()=>{Se(t,x,{originElem:e,calcElemSize:{x:f,y:d,w:u,h:w,angle:v},viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c,renderContent:()=>{ze(t,x,{viewScaleInfo:l,viewSizeInfo:h,renderContent:()=>{t.save(),t.translate(y,m),t.scale(b*g/l.scale,b*p/l.scale);const e=ge(n.commands||[]),i=new Path2D(e);n.fill&&(t.fillStyle=n.fill,t.fill(i)),n.stroke&&0!==n.strokeWidth&&(t.strokeStyle=n.stroke,t.lineWidth=(n.strokeWidth||1)/h.devicePixelRatio,t.lineCap=n.strokeLineCap||"square",t.stroke(i)),t.translate(-y,-m),t.restore()}})}})}))}(t,e,i);break;case"group":{const n=Object.assign(Object.assign({},i.elementAssets||{}),e.detail.assets||{});!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ce({x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle},{viewScaleInfo:n,viewSizeInfo:o})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});_t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{t.globalAlpha=xe(e)*a,ze(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{Se(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const{x:s,y:r,w:l,h:h,radiusList:c}=ye(f,{viewScaleInfo:n,viewSizeInfo:o});if("hidden"===e.detail.overflow&&(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(s+c[0],r),t.arcTo(s+l,r,s+l,r+h,c[1]),t.arcTo(s+l,r+h,s,r+h,c[2]),t.arcTo(s,r+h,s,r,c[3]),t.arcTo(s,r,s+l,r,c[0]),t.closePath(),t.fill(),t.clip()),Array.isArray(e.detail.children)){const{parentElementSize:n}=i,o={x:n.x+e.x,y:n.y+e.y,w:e.w||n.w,h:e.h||n.h,angle:e.angle},{calculator:s}=i;for(let n=0;n<e.detail.children.length;n++){let r=e.detail.children[n];if(r=Object.assign(Object.assign({},r),{x:o.x+r.x,y:o.y+r.y}),!0===i.forceDrawAll||(null==s?void 0:s.needRender(r)))try{Pe(t,r,Object.assign(Object.assign({},i),{parentOpacity:a*xe(e)}))}catch(t){console.error(t)}}}"hidden"===e.detail.overflow&&t.restore()}})}}),t.globalAlpha=a}))}(t,e,Object.assign(Object.assign({},i),{elementAssets:n}));break}}}catch(t){console.error(t)}}const We={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,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function ke(t,e,i){var n;const{elements:o=[]}=e,{parentOpacity:a}=i;for(let e=0;e<o.length;e++){const s=o[e],r=Object.assign(Object.assign({},s),{detail:Object.assign(Object.assign({},We),null==s?void 0:s.detail)});if(!0===i.forceDrawAll||(null===(n=i.calculator)||void 0===n?void 0:n.needRender(r)))try{Pe(t,r,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(t){console.error(t)}}}var Ee,Oe,Re,Ae,Te,Le,Ve,je,De,$e,Be,Xe,Ye=function(t,e,i,n){return new(i||(i=Promise))((function(o,a){function s(t){try{l(n.next(t))}catch(t){a(t)}}function r(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((n=n.apply(t,e||[])).next())}))},Fe=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)},He=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i};const Ue=["image","svg","html"],Ge=t=>{var e,i,n;let o=null;return"image"===t.type?o=(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.src)||null:"svg"===t.type?o=(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.svg)||null:"html"===t.type&&(o=(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.html)||null),"string"==typeof o&&o?/^@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(`${o}`)?o:Pt(o):Pt(`${zt()}-${t.uuid}-${zt()}-${zt()}`)};class Ne extends Ft{constructor(){super(),Ee.add(this),Oe.set(this,{}),Re.set(this,{}),Ae.set(this,{}),Te.set(this,!1),Fe(this,Ee,"m",Le).call(this,"image",((t,e)=>Ye(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.src])||void 0===i?void 0:i.value)||t.detail.src,o=yield At(n);return{uuid:t.uuid,lastModified:Date.now(),content:o}})))),Fe(this,Ee,"m",Le).call(this,"html",((t,e)=>Ye(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.html])||void 0===i?void 0:i.value)||t.detail.html,o=yield Lt(n,{width:t.detail.originW||t.w,height:t.detail.originH||t.h});return{uuid:t.uuid,lastModified:Date.now(),content:o}})))),Fe(this,Ee,"m",Le).call(this,"svg",((t,e)=>Ye(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.svg])||void 0===i?void 0:i.value)||t.detail.svg,o=yield Tt(n);return{uuid:t.uuid,lastModified:Date.now(),content:o}}))))}isDestroyed(){return Fe(this,Te,"f")}destroy(){He(this,Te,!0,"f"),this.clear(),He(this,Oe,null,"f"),He(this,Re,null,"f"),He(this,Ae,null,"f")}load(t,e){!0!==Fe(this,Te,"f")&&(Fe(this,Ee,"m",Xe).call(this,t)||Ue.includes(t.type)&&Fe(this,Ee,"m",Be).call(this,t,e))}getContent(t){var e,i;const n=Ge(t);return(null===(i=null===(e=Fe(this,Ae,"f"))||void 0===e?void 0:e[n])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return Fe(this,Ae,"f")}setLoadItemMap(t){He(this,Ae,t,"f")}}Oe=new WeakMap,Re=new WeakMap,Ae=new WeakMap,Te=new WeakMap,Ee=new WeakSet,Le=function(t,e){Fe(this,Oe,"f")[t]=e},Ve=function(t){var e,i,n;let o=null;return"image"===t.type?o=(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.src)||null:"svg"===t.type?o=(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.svg)||null:"html"===t.type&&(o=(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.html)||null),o},je=function(t){return{element:t,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:Fe(this,Ee,"m",Ve).call(this,t)}},De=function(t){const e=Ge(t.element),i=Fe(this,Ae,"f")[e];Fe(this,Te,"f")||(i?i.startTime<t.startTime&&(Fe(this,Ae,"f")[e]=t,this.trigger("load",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))):(Fe(this,Ae,"f")[e]=t,this.trigger("load",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))))},$e=function(t){var e;const i=Ge(t.element),n=null===(e=Fe(this,Ae,"f"))||void 0===e?void 0:e[i];Fe(this,Te,"f")||(n?n.startTime<t.startTime&&(Fe(this,Ae,"f")[i]=t,this.trigger("error",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))):(Fe(this,Ae,"f")[i]=t,this.trigger("error",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))))},Be=function(t,e){const i=Fe(this,Ee,"m",je).call(this,t),n=Ge(t);if(Fe(this,Re,"f")[n])return;Fe(this,Re,"f")[n]=i;const o=Fe(this,Oe,"f")[t.type];"function"!=typeof o||Fe(this,Te,"f")||(i.startTime=Date.now(),o(t,e).then((t=>{Fe(this,Te,"f")||(i.content=t.content,i.endTime=Date.now(),i.status="load",Fe(this,Ee,"m",De).call(this,i))})).catch((e=>{console.warn(`Load element source "${i.source}" fail`,e,t),i.endTime=Date.now(),i.status="error",i.error=e,Fe(this,Ee,"m",$e).call(this,i)})))},Xe=function(t){var e;const i=Ge(t),n=null===(e=Fe(this,Re,"f"))||void 0===e?void 0:e[i];return!(!n||"error"!==n.status||!n.source||n.source!==Fe(this,Ee,"m",Ve).call(this,t))};var Qe,qe,Ke,Je,Ze,_e=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},ti=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class ei extends Ft{constructor(t){super(),Qe.add(this),qe.set(this,void 0),Ke.set(this,new Ne),Je.set(this,!1),_e(this,qe,t,"f"),ti(this,Qe,"m",Ze).call(this)}isDestroyed(){return ti(this,Je,"f")}destroy(){this.clear(),_e(this,qe,null,"f"),ti(this,Ke,"f").destroy(),_e(this,Ke,null,"f"),_e(this,Je,!0,"f")}updateOptions(t){_e(this,qe,t,"f")}drawData(t,e){const i=ti(this,Ke,"f"),{calculator:n}=ti(this,qe,"f"),o=ti(this,qe,"f").viewContext;o.clearRect(0,0,o.canvas.width,o.canvas.height);const a={x:0,y:0,w:e.viewSizeInfo.width,h:e.viewSizeInfo.height},s=Object.assign({loader:i,calculator:n,parentElementSize:a,elementAssets:t.assets,parentOpacity:1},e);t.layout?function(t,e,i,n){const{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,r=Object.assign({uuid:"layout",type:"group"},e),{x:l,y:h,w:c,h:f}=ce(r,{viewScaleInfo:o,viewSizeInfo:a})||r,d=Object.assign(Object.assign({},r),{x:l,y:h,w:c,h:f,angle:0});if(t.globalAlpha=1,ze(t,d,{viewScaleInfo:o,viewSizeInfo:a,renderContent:()=>{Ie(t,d,{viewScaleInfo:o,viewSizeInfo:a})}}),"hidden"===e.detail.overflow){const{viewScaleInfo:n,viewSizeInfo:o}=i,a=Object.assign({uuid:"layout",type:"group"},e),s=ce(a,{viewScaleInfo:n,viewSizeInfo:o})||a,r=Object.assign(Object.assign({},a),s),{x:l,y:h,w:c,h:f,radiusList:d}=ye(r,{viewScaleInfo:n,viewSizeInfo:o});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(l+d[0],h),t.arcTo(l+c,h,l+c,h+f,d[1]),t.arcTo(l+c,h+f,l,h+f,d[2]),t.arcTo(l,h+f,l,h,d[3]),t.arcTo(l,h,l+c,h,d[0]),t.closePath(),t.fill(),t.clip()}n(t),"hidden"===e.detail.overflow&&t.restore(),Me(t,d,{viewScaleInfo:o,viewSizeInfo:a}),t.globalAlpha=s}(o,t.layout,s,(()=>{ke(o,t,s)})):ke(o,t,s)}scale(t){const{sharer:e}=ti(this,qe,"f");if(!e)return;const{data:i,offsetTop:n,offsetBottom:o,offsetLeft:a,offsetRight:s,width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:f}=e.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:t,offsetTop:n,offsetBottom:o,offsetLeft:a,offsetRight:s},viewSizeInfo:{width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:f}})}setLoadItemMap(t){ti(this,Ke,"f").setLoadItemMap(t)}getLoadItemMap(){return ti(this,Ke,"f").getLoadItemMap()}getLoader(){return ti(this,Ke,"f")}}qe=new WeakMap,Ke=new WeakMap,Je=new WeakMap,Qe=new WeakSet,Ze=function(){const t=ti(this,Ke,"f");t.on("load",(t=>{this.trigger("load",t)})),t.on("error",(t=>{console.error(t)}))};class ii{constructor(t){bt(this,e,void 0),bt(this,i,void 0),xt(this,e,t),xt(this,i,new Jt({defaultStorage:{viewVisibleInfoMap:{},visibleCount:0,invisibleCount:0}}))}toGridNum(t,e){return!0===(null==e?void 0:e.ignore)?t:Math.round(t)}destroy(){xt(this,e,null)}needRender(t){const e=mt(this,i).get("viewVisibleInfoMap")[t.uuid];return!e||e.isVisibleInView}isPointInElement(t,i,n,o){return de(t,{context2d:mt(this,e).viewContext,element:i,viewScaleInfo:n,viewSizeInfo:o})}getPointElement(t,i){return function(t,e){var i,n,o;const{context2d:a,data:s,viewScaleInfo:r,viewSizeInfo:l,groupQueue:h}=e,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let e=h.length-1;e>=0;e--){let o=0,s=0,f=0;for(let t=0;t<=e;t++)o+=h[t].x,s+=h[t].y,f+=h[t].angle||0;const d=h[e];if(d&&"group"===d.type&&Array.isArray(null===(i=d.detail)||void 0===i?void 0:i.children))for(let i=0;i<d.detail.children.length;i++){const u=d.detail.children[i];if(!0!==(null===(n=null==u?void 0:u.operations)||void 0===n?void 0:n.invisible)){if(!u)break;if(de(t,{context2d:a,element:{x:o+u.x,y:s+u.y,w:u.w,h:u.h,angle:f+(u.angle||0)},viewScaleInfo:r,viewSizeInfo:l})){c.element=u,(e<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=e);break}}}if(c.element)break}if(c.element)return c;for(let e=s.elements.length-1;e>=0;e--){const i=s.elements[e];if(!0!==(null===(o=null==i?void 0:i.operations)||void 0===o?void 0:o.invisible)&&de(t,{context2d:a,element:i,viewScaleInfo:r,viewSizeInfo:l})){c.index=e,c.element=i;break}}return c}(t,{...i,context2d:mt(this,e).viewContext})}resetViewVisibleInfoMap(t,e){if(t){const{viewVisibleInfoMap:n,invisibleCount:o,visibleCount:a}=function(t,e){const i={},n=[],o=e=>{const a={isVisibleInView:!0,isGroup:"group"===e.type,position:[...n]};let s=null;s=ue(e,{groupQueue:se(t,n)||[]}),i[e.uuid]=Object.assign(Object.assign({},a),{originRectInfo:s,rangeRectInfo:Bt.angle(e.angle)?we(s):s}),"group"===e.type&&e.detail.children.forEach(((t,e)=>{n.push(e),o(t),n.pop()}))};return t.forEach(((t,e)=>{n.push(e),o(t),n.pop()})),ve(i,e)}(t.elements,e);mt(this,i).set("viewVisibleInfoMap",n),mt(this,i).set("invisibleCount",o),mt(this,i).set("visibleCount",a)}}updateVisiableStatus(t){const{viewVisibleInfoMap:e,invisibleCount:n,visibleCount:o}=ve(mt(this,i).get("viewVisibleInfoMap"),t);mt(this,i).set("viewVisibleInfoMap",e),mt(this,i).set("invisibleCount",n),mt(this,i).set("visibleCount",o)}calcViewRectInfoFromOrigin(t,e){const n=mt(this,i).get("viewVisibleInfoMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:a,viewSizeInfo:s}=e,{center:r,left:l,right:h,bottom:c,top:f,topLeft:d,topRight:u,bottomLeft:w,bottomRight:v}=n.originRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const g={viewScaleInfo:a,viewSizeInfo:s};return{center:fe(r,g),left:fe(l,g),right:fe(h,g),bottom:fe(c,g),top:fe(f,g),topLeft:fe(d,g),topRight:fe(u,g),bottomLeft:fe(w,g),bottomRight:fe(v,g)}}calcViewRectInfoFromRange(t,e){const n=mt(this,i).get("viewVisibleInfoMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:a,viewSizeInfo:s}=e,{center:r,left:l,right:h,bottom:c,top:f,topLeft:d,topRight:u,bottomLeft:w,bottomRight:v}=n.rangeRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const g={viewScaleInfo:a,viewSizeInfo:s};return{center:fe(r,g),left:fe(l,g),right:fe(h,g),bottom:fe(c,g),top:fe(f,g),topLeft:fe(d,g),topRight:fe(u,g),bottomLeft:fe(w,g),bottomRight:fe(v,g)}}modifyViewVisibleInfoMap(t,e){const{modifyOptions:n,viewScaleInfo:o,viewSizeInfo:a}=e,{type:s,content:r}=n,l=t.elements,h=mt(this,i).get("viewVisibleInfoMap");if("deleteElement"===s){const{element:t}=r;delete h[t.uuid]}else if("addElement"===s||"updateElement"===s){const{position:e}=r,i=function(t,e){let i=null,n=e;for(let e=0;e<t.length;e++){const o=n[t[e]];if(e<t.length-1&&"group"===o.type)n=o.detail.children;else{if(e!==t.length-1)break;i=o}}return i}(e,t.elements),n=se(l,e);if(i){const t=ue(i,{groupQueue:n||[]}),r={originRectInfo:t,rangeRectInfo:Bt.angle(i.angle)?we(t):t,isVisibleInView:!0,isGroup:"group"===(null==i?void 0:i.type),position:[...e]};h[i.uuid]=r,"updateElement"===s&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:a})}}else"moveElement"===s&&this.resetViewVisibleInfoMap(t,{viewScaleInfo:o,viewSizeInfo:a});mt(this,i).set("viewVisibleInfoMap",h)}}function ni(t){return t>0||t<0||0===t}e=new WeakMap,i=new WeakMap;class oi extends Ft{constructor(t){super(),bt(this,s),bt(this,g),bt(this,y),bt(this,b),bt(this,n,void 0),bt(this,o,void 0),bt(this,a,!1),bt(this,l,(t=>{if(!St(this,g,p).call(this,t))return;const e=St(this,y,m).call(this,t);if(!St(this,b,x).call(this,e))return;t.preventDefault(),t.stopPropagation();const i=t.deltaX>0||t.deltaX<0?t.deltaX:0,n=t.deltaY>0||t.deltaY<0?t.deltaY:0;!0===t.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:n,point:e}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:n,point:e})})),bt(this,h,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);St(this,b,x).call(this,e)})),bt(this,c,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);if(!St(this,b,x).call(this,e))return;const i=Date.now(),n=mt(this,o).get("prevClickPoint");n&&i-n.t<=500&&Math.abs(n.x-e.x)<=5&&Math.abs(n.y-e.y)<=5?this.trigger("doubleClick",{point:e}):mt(this,o).set("prevClickPoint",e)})),bt(this,f,(t=>{if(mt(this,o).set("hasPointDown",!1),!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);this.trigger("pointLeave",{point:e})})),bt(this,d,(t=>{if(mt(this,o).set("hasPointDown",!1),!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);this.trigger("pointEnd",{point:e})})),bt(this,u,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault(),t.stopPropagation();const e=St(this,y,m).call(this,t);St(this,b,x).call(this,e)?!0===mt(this,o).get("hasPointDown")&&this.trigger("pointMove",{point:e}):mt(this,o).get("hasPointDown")&&(this.trigger("pointLeave",{point:e}),mt(this,o).set("hasPointDown",!1))})),bt(this,w,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);St(this,b,x).call(this,e)&&(mt(this,o).set("hasPointDown",!0),this.trigger("pointStart",{point:e}))})),bt(this,v,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);St(this,b,x).call(this,e)&&this.trigger("hover",{point:e})}));const e=new Jt({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});xt(this,o,e),xt(this,n,t),St(this,s,r).call(this)}onEvents(){if(mt(this,a))return;const t=window;t.addEventListener("mousemove",mt(this,v)),t.addEventListener("mousedown",mt(this,w)),t.addEventListener("mousemove",mt(this,u)),t.addEventListener("mouseup",mt(this,d)),t.addEventListener("mouseleave",mt(this,f)),t.addEventListener("wheel",mt(this,l),{passive:!1}),t.addEventListener("click",mt(this,c)),t.addEventListener("contextmenu",mt(this,h))}offEvents(){const t=window;t.removeEventListener("mousemove",mt(this,v)),t.removeEventListener("mousedown",mt(this,w)),t.removeEventListener("mousemove",mt(this,u)),t.removeEventListener("mouseup",mt(this,d)),t.removeEventListener("mouseleave",mt(this,f)),t.removeEventListener("wheel",mt(this,l)),t.removeEventListener("click",mt(this,c)),t.removeEventListener("contextmenu",mt(this,h))}destroy(){this.offEvents(),mt(this,o).destroy(),xt(this,a,!0)}}n=new WeakMap,o=new WeakMap,a=new WeakMap,s=new WeakSet,r=function(){this.onEvents()},l=new WeakMap,h=new WeakMap,c=new WeakMap,f=new WeakMap,d=new WeakMap,u=new WeakMap,w=new WeakMap,v=new WeakMap,g=new WeakSet,p=function(t){return t.target===mt(this,n).boardContent.boardContext.canvas},y=new WeakSet,m=function(t){const e=mt(this,n).boardContent.boardContext.canvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top,t:Date.now()}},b=new WeakSet,x=function(t){const e=mt(this,n).sharer.getActiveViewSizeInfo(),{width:i,height:o}=e;return!!(ni(t.x)&&ni(t.y)&&t.x<=i&&t.y<=o)};const ai={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class si{constructor(){bt(this,S,void 0),bt(this,I,void 0);const t=new Jt({defaultStorage:ai}),e=new Jt({defaultStorage:{}});xt(this,S,t),xt(this,I,e)}getActiveStorage(t){return mt(this,S).get(t)}setActiveStorage(t,e){return mt(this,S).set(t,e)}getActiveStoreSnapshot(t){return mt(this,S).getSnapshot(t)}getSharedStorage(t){return mt(this,I).get(t)}setSharedStorage(t,e){return mt(this,I).set(t,e)}getSharedStoreSnapshot(t){return mt(this,I).getSnapshot(t)}getActiveViewScaleInfo(){return{scale:mt(this,S).get("scale"),offsetTop:mt(this,S).get("offsetTop"),offsetBottom:mt(this,S).get("offsetBottom"),offsetLeft:mt(this,S).get("offsetLeft"),offsetRight:mt(this,S).get("offsetRight")}}setActiveViewScaleInfo(t){const{scale:e,offsetTop:i,offsetBottom:n,offsetLeft:o,offsetRight:a}=t;mt(this,S).set("scale",e),mt(this,S).set("offsetTop",i),mt(this,S).set("offsetBottom",n),mt(this,S).set("offsetLeft",o),mt(this,S).set("offsetRight",a)}setActiveViewSizeInfo(t){mt(this,S).set("width",t.width),mt(this,S).set("height",t.height),mt(this,S).set("devicePixelRatio",t.devicePixelRatio),mt(this,S).set("contextWidth",t.contextWidth),mt(this,S).set("contextHeight",t.contextHeight)}getActiveViewSizeInfo(){return{width:mt(this,S).get("width"),height:mt(this,S).get("height"),devicePixelRatio:mt(this,S).get("devicePixelRatio"),contextWidth:mt(this,S).get("contextWidth"),contextHeight:mt(this,S).get("contextHeight")}}}S=new WeakMap,I=new WeakMap;const{requestAnimationFrame:ri}=window;class li extends Ft{constructor(t){super(),bt(this,P),bt(this,k),bt(this,M,void 0),bt(this,z,[]),bt(this,C,"FREE"),xt(this,M,t),St(this,P,W).call(this)}resetViewVisibleInfoMap(t,e){t&&mt(this,M).calculator.resetViewVisibleInfoMap(t,e)}drawFrame(){const{sharer:t}=mt(this,M),e=t.getActiveStoreSnapshot(),i=t.getSharedStoreSnapshot();mt(this,z).push({activeStore:e,sharedStore:i}),St(this,k,E).call(this)}scale(t){const{scale:e,point:i,ignoreUpdateVisibleStatus:n}=t,{sharer:o}=mt(this,M),{moveX:a,moveY:s}=function(t){const{scale:e,point:i,viewScaleInfo:n}=t,{offsetLeft:o,offsetTop:a}=n,s=e/n.scale,r=i.x,l=i.y;return{moveX:r-r*s+(o*s-o),moveY:l-l*s+(a*s-a)}}({scale:e,point:i,viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()});return o.setActiveStorage("scale",e),n||mt(this,M).calculator.updateVisiableStatus({viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()}),{moveX:a,moveY:s}}scroll(t){const{sharer:e}=mt(this,M),i=e.getActiveViewScaleInfo(),{moveX:n,moveY:o,ignoreUpdateVisibleStatus:a}=t,s=function(t){const{moveX:e=0,moveY:i=0,viewScaleInfo:n,viewSizeInfo:o}=t,{scale:a}=n,{width:s,height:r,contextWidth:l,contextHeight:h}=o;let c=n.offsetLeft,f=n.offsetRight,d=n.offsetTop,u=n.offsetBottom;return c+=e,d+=i,f=s-(l*a+c),u=r-(h*a+d),{scale:a,offsetTop:d,offsetLeft:c,offsetRight:f,offsetBottom:u}}({moveX:n,moveY:o,viewScaleInfo:i,viewSizeInfo:e.getActiveViewSizeInfo()});return e.setActiveViewScaleInfo(s),a||mt(this,M).calculator.updateVisiableStatus({viewScaleInfo:e.getActiveViewScaleInfo(),viewSizeInfo:e.getActiveViewSizeInfo()}),s}updateViewScaleInfo(t){const{sharer:e}=mt(this,M),i=function(t,e){const{scale:i,offsetX:n,offsetY:o}=t,{viewSizeInfo:a}=e,{width:s,height:r,contextWidth:l,contextHeight:h}=a,c=0-n*i,f=0-o*i;return{scale:i,offsetLeft:c,offsetTop:f,offsetRight:s-(l*i+c/i),offsetBottom:r-(h*i+f/i)}}(t,{viewSizeInfo:e.getActiveViewSizeInfo()});return e.setActiveViewScaleInfo(i),mt(this,M).calculator.updateVisiableStatus({viewScaleInfo:e.getActiveViewScaleInfo(),viewSizeInfo:e.getActiveViewSizeInfo()}),i}resize(t={},e){const{sharer:i}=mt(this,M),n={...i.getActiveViewSizeInfo(),...t},{width:o,height:a,devicePixelRatio:s}=n,{underContext:r,boardContext:l,helperContext:h,viewContext:c}=mt(this,M).boardContent;return l.canvas.width=o*s,l.canvas.height=a*s,l.canvas.style.width=`${o}px`,l.canvas.style.height=`${a}px`,r.canvas.width=o*s,r.canvas.height=a*s,h.canvas.width=o*s,h.canvas.height=a*s,c.canvas.width=o*s,c.canvas.height=a*s,i.setActiveViewSizeInfo(n),(null==e?void 0:e.ignoreUpdateVisibleStatus)||mt(this,M).calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),n}}M=new WeakMap,z=new WeakMap,C=new WeakMap,P=new WeakSet,W=function(){const{renderer:t}=mt(this,M);t.on("load",(()=>{this.drawFrame()}))},k=new WeakSet,E=function(){if("DRAWING"===mt(this,C)||0===mt(this,z).length)return;xt(this,C,"DRAWING");const t=mt(this,z).shift(),{renderer:e,boardContent:i,beforeDrawFrame:n,afterDrawFrame:o}=mt(this,M);if(t){const{scale:a,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h,width:c,height:f,contextHeight:d,contextWidth:u,devicePixelRatio:w}=t.activeStore,v={scale:a,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h},g={width:c,height:f,contextHeight:d,contextWidth:u,devicePixelRatio:w};(null==t?void 0:t.activeStore.data)&&e.drawData(t.activeStore.data,{viewScaleInfo:v,viewSizeInfo:g}),n({snapshot:t}),i.drawView(),o({snapshot:t})}0!==mt(this,z).length?xt(this,C,"DRAWING")&&ri((()=>{St(this,k,E).call(this)})):xt(this,C,"COMPLETE")};return O=new WeakMap,R=new WeakMap,A=new WeakMap,T=new WeakMap,L=new WeakMap,V=new WeakMap,j=new WeakMap,D=new WeakMap,$=new WeakMap,B=new WeakMap,X=new WeakMap,Y=new WeakSet,F=function(){mt(this,L).on("pointStart",St(this,H,U).bind(this)),mt(this,L).on("pointEnd",St(this,G,N).bind(this)),mt(this,L).on("pointMove",St(this,Q,q).bind(this)),mt(this,L).on("hover",St(this,K,J).bind(this)),mt(this,L).on("wheel",St(this,tt,et).bind(this)),mt(this,L).on("wheelScale",St(this,it,nt).bind(this)),mt(this,L).on("scrollX",St(this,ot,at).bind(this)),mt(this,L).on("scrollY",St(this,st,rt).bind(this)),mt(this,L).on("resize",St(this,lt,ht).bind(this)),mt(this,L).on("doubleClick",St(this,Z,_).bind(this)),mt(this,V).on("load",(()=>{mt(this,B).trigger("loadResource")}))},H=new WeakSet,U=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointStart)?void 0:e.call(n,t)))return}},G=new WeakSet,N=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointEnd)?void 0:e.call(n,t)))return}},Q=new WeakSet,q=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointMove)?void 0:e.call(n,t)))return}},K=new WeakSet,J=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.hover)?void 0:e.call(n,t)))return}},Z=new WeakSet,_=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.doubleClick)?void 0:e.call(n,t)))return}},tt=new WeakSet,et=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.wheel)?void 0:e.call(n,t)))return}},it=new WeakSet,nt=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.wheelScale)?void 0:e.call(n,t)))return}},ot=new WeakSet,at=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.scrollX)?void 0:e.call(n,t)))return}},st=new WeakSet,rt=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.scrollY)?void 0:e.call(n,t)))return}},lt=new WeakSet,ht=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.resize)?void 0:e.call(n,t)))return}},ct=new WeakSet,ft=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.clear)?void 0:e.call(n,t)))return}},dt=new WeakSet,ut=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.beforeDrawFrame)?void 0:e.call(n,t)))return}},wt=new WeakSet,vt=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.afterDrawFrame)?void 0:e.call(n,t)))return}},gt=new WeakSet,pt=function(){const t=[],e=mt(this,R);mt(this,A).forEach((i=>{const n=e.get(i);"enable"===(null==n?void 0:n.status)&&(null==n?void 0:n.middlewareObject)&&t.push(n.middlewareObject)})),xt(this,T,t)},t.Board=class{constructor(t){bt(this,Y),bt(this,H),bt(this,G),bt(this,Q),bt(this,K),bt(this,Z),bt(this,tt),bt(this,it),bt(this,ot),bt(this,st),bt(this,lt),bt(this,ct),bt(this,dt),bt(this,wt),bt(this,gt),bt(this,O,void 0),bt(this,R,new WeakMap),bt(this,A,[]),bt(this,T,[]),bt(this,L,void 0),bt(this,V,void 0),bt(this,j,void 0),bt(this,D,void 0),bt(this,$,void 0),bt(this,B,new Ft),bt(this,X,!1);const{boardContent:e}=t,i=new si,n=new ii({viewContext:e.viewContext}),o=new oi({boardContent:e,sharer:i}),a=new ei({viewContext:e.viewContext,sharer:i,calculator:n});xt(this,O,t),xt(this,j,i),xt(this,L,o),xt(this,V,a),xt(this,$,n),xt(this,D,new li({boardContent:t.boardContent,sharer:i,renderer:a,calculator:mt(this,$),beforeDrawFrame:t=>{St(this,dt,ut).call(this,t)},afterDrawFrame:t=>{St(this,wt,vt).call(this,t)}})),St(this,Y,F).call(this),St(this,gt,pt).call(this)}isDestroyed(){return mt(this,X)}destroy(){mt(this,L).destroy(),mt(this,V).destroy(),mt(this,$).destroy(),mt(this,B).destroy(),xt(this,X,!0)}getSharer(){return mt(this,j)}getViewer(){return mt(this,D)}getRenderer(){return mt(this,V)}setData(t,e){const{modifiedOptions:i}=e||{},n=mt(this,j);mt(this,j).setActiveStorage("data",t);const o=n.getActiveViewSizeInfo(),a=n.getActiveViewScaleInfo(),s=function(t,e){const i={x:0,y:0,w:0,h:0};t.forEach((t=>{const e={x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle};if(e.angle&&(e.angle>0||e.angle<0)){const t=oe(e);if(4===t.length){const i=[t[0].x,t[1].x,t[2].x,t[3].x],n=[t[0].y,t[1].y,t[2].y,t[3].y];e.x=Math.min(...i),e.y=Math.min(...n),e.w=Math.abs(Math.max(...i)-Math.min(...i)),e.h=Math.abs(Math.max(...n)-Math.min(...n))}}const n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),a=Math.max(e.x+e.w,i.x+i.w),s=Math.max(e.y+e.h,i.y+i.h);i.x=n,i.y=o,i.w=Math.abs(a-n),i.h=Math.abs(s-o)})),(null==e?void 0:e.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const n={contextWidth:i.w,contextHeight:i.h};return(null==e?void 0:e.viewWidth)&&(null==e?void 0:e.viewHeight)&&(null==e?void 0:e.viewWidth)>0&&(null==e?void 0:e.viewHeight)>0&&(e.viewWidth>i.x+i.w&&(n.contextWidth=e.viewWidth-i.x),e.viewHeight>i.y+i.h&&(n.contextHeight=e.viewHeight-i.y)),n}(t.elements,{viewWidth:o.width,viewHeight:o.height,extend:!0});mt(this,D).resetViewVisibleInfoMap(t,{viewSizeInfo:o,viewScaleInfo:a}),mt(this,D).drawFrame();const r={...o,...s};return mt(this,j).setActiveViewSizeInfo(r),{viewSizeInfo:r}}getData(){const{data:t}=mt(this,j).getActiveStoreSnapshot();return t}use(t){var e,i,n;if(mt(this,R).has(t)){const n=mt(this,R).get(t);if(n)return null==(i=(e=n.middlewareObject).use)||i.call(e),n.status="enable",mt(this,R).set(t,n),void St(this,gt,pt).call(this)}const{boardContent:o,container:a}=mt(this,O),s=t({boardContent:o,sharer:mt(this,j),viewer:mt(this,D),calculator:mt(this,$),eventHub:mt(this,B),container:a});null==(n=s.use)||n.call(s),mt(this,A).push(t),mt(this,T).push(s),mt(this,R).set(t,{status:"enable",middlewareObject:s}),St(this,gt,pt).call(this)}disuse(t){var e,i;const n=mt(this,R).get(t);n&&(null==(i=(e=n.middlewareObject).disuse)||i.call(e),n.status="disable",mt(this,R).set(t,n),St(this,gt,pt).call(this))}scale(t){const e=mt(this,D),{ignoreUpdateVisibleStatus:i}=t,{moveX:n,moveY:o}=e.scale({...t,ignoreUpdateVisibleStatus:!0});e.scroll({moveX:n,moveY:o,ignoreUpdateVisibleStatus:i})}scroll(t){return mt(this,D).scroll(t)}updateViewScaleInfo(t){return mt(this,D).updateViewScaleInfo(t)}resize(t,e){const i=mt(this,D).resize(t,e),{width:n,height:o,devicePixelRatio:a}=t,{boardContent:s}=mt(this,O);s.viewContext.$resize({width:n,height:o,devicePixelRatio:a}),s.helperContext.$resize({width:n,height:o,devicePixelRatio:a}),s.boardContext.$resize({width:n,height:o,devicePixelRatio:a}),s.underContext.$resize({width:n,height:o,devicePixelRatio:a}),mt(this,D).drawFrame(),mt(this,L).trigger("resize",i),mt(this,j).setActiveViewSizeInfo(t)}clear(){const{boardContent:t}=mt(this,O),{underContext:e,helperContext:i,viewContext:n,boardContext:o}=t;e.clearRect(0,0,e.canvas.width,e.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),St(this,ct,ft).call(this)}getEventHub(){return mt(this,B)}onWatcherEvents(){mt(this,L).onEvents()}offWatcherEvents(){mt(this,L).offEvents()}},t.Calculator=ii,t.Sharer=si,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({}); | ||
var iDrawBoard=function(t){"use strict";var e,i,n,o,a,s,r,l,h,c,f,d,u,w,v,g,p,y,m,b,x,S,I,M,z,C,P,W,k,E,O,A,R,T,L,V,j,D,$,B,X,Y,F,H,U,G,N,Q,q,K,J,Z,_,tt,et,it,nt,ot,at,st,rt,lt,ht,ct,ft,dt,ut,wt,vt,gt,pt,yt=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},mt=(t,e,i)=>(yt(t,e,"read from private field"),i?i.call(t):e.get(t)),bt=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},xt=(t,e,i,n)=>(yt(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),St=(t,e,i)=>(yt(t,e,"access private method"),i);function It(t){return"string"==typeof t&&(/^\#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^[a-z]{1,}$/i.test(t))}function Mt(t,e){if(1===e)return t;let i=1;const n=/^\#[0-9a-f]{6,6}$/i;let o=t;if(n.test(t)?i=parseInt(t.substring(5,7).replace(/^\#/,"0x")):/^\#[0-9a-f]{8,8}$/i.test(t)&&(i=parseInt(t.substring(7,9).replace(/^\#/,"0x")),o=t.substring(0,7)),i*=e,n.test(o)&&i>0&&i<1){const t=Math.max(0,Math.min(255,Math.ceil(256*i)));o=`${o.toUpperCase()}${t.toString(16).toUpperCase()}`}return o}function zt(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function Ct(t){let e=0;for(let i=0;i<t.length;i++)e+=t.charCodeAt(i)*t.charCodeAt(i)*i*i;return e.toString(16).substring(0,4)}function Pt(t){const e=t.length,i=Math.floor(e/2),n=t.substring(0,4).padEnd(4,"0"),o=t.substring(0,4).padEnd(4,"0");return`@assets/${Ct(e.toString(16).padEnd(4,n))}${Ct(t.substring(i-4,i).padEnd(4,n)).padEnd(4,"f")}-${Ct(t.substring(i-8,i-4).padEnd(4,n)).padEnd(4,"f")}-${Ct(t.substring(i-12,i-8).padEnd(4,n)).padEnd(4,"f")}-${Ct(t.substring(i-16,i-12).padEnd(4,o)).padEnd(4,"f")}-${Ct(t.substring(i,i+4).padEnd(4,o)).padEnd(4,"f")}${Ct(t.substring(i+4,i+8).padEnd(4,o)).padEnd(4,"f")}${Ct(o.padEnd(4,n).padEnd(4,o))}`}function Wt(t){return function t(e){const i=function(t){return Object.prototype.toString.call(t).replace(/[\]|\[]{1,1}/gi,"").split(" ")[1]}(e);if(["Null","Number","String","Boolean","Undefined"].indexOf(i)>=0)return e;if("Array"===i){const i=[];return e.forEach((e=>{i.push(t(e))})),i}if("Object"===i){const i={};Object.keys(e).forEach((n=>{i[n]=t(e[n])}));return Object.getOwnPropertySymbols(e).forEach((n=>{i[n]=t(e[n])})),i}}(t)}function kt(t){return(Object.prototype.toString.call(t)||"").replace(/(\[object|\])/gi,"").trim()}const Et={type(t,e){const i=kt(t);return!0===e?i.toLocaleLowerCase():i},array:t=>"Array"===kt(t),json:t=>"Object"===kt(t),function:t=>"Function"===kt(t),asyncFunction:t=>"AsyncFunction"===kt(t),boolean:t=>"Boolean"===kt(t),string:t=>"String"===kt(t),number:t=>"Number"===kt(t),undefined:t=>"Undefined"===kt(t),null:t=>"Null"===kt(t),promise:t=>"Promise"===kt(t)};var Ot=function(t,e,i,n){return new(i||(i=Promise))((function(o,a){function s(t){try{l(n.next(t))}catch(t){a(t)}}function r(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((n=n.apply(t,e||[])).next())}))};const{Image:At}=window;function Rt(t){return new Promise(((e,i)=>{const n=new At;n.crossOrigin="anonymous",n.onload=function(){e(n)},n.onabort=i,n.onerror=i,n.src=t}))}function Tt(t){return Ot(this,void 0,void 0,(function*(){const e=yield function(t){return new Promise(((e,i)=>{const n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),o=new FileReader;o.readAsDataURL(n),o.onload=function(t){var i;const n=null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result;e(n)},o.onerror=function(t){i(t)}}))}(t);return yield Rt(e)}))}function Lt(t,e){return Ot(this,void 0,void 0,(function*(){t=t.replace(/\&/gi,"&");const i=yield function(t,e){const{width:i,height:n}=e;return new Promise(((e,o)=>{const a=new Blob([`\n <svg \n xmlns="http://www.w3.org/2000/svg" \n width="${i||""}" \n height = "${n||""}">\n <foreignObject width="100%" height="100%">\n <div xmlns = "http://www.w3.org/1999/xhtml">\n ${t}\n </div>\n </foreignObject>\n </svg>\n `],{type:"image/svg+xml;charset=utf-8"}),s=new FileReader;s.readAsDataURL(a),s.onload=function(t){var i;const n=null===(i=null==t?void 0:t.target)||void 0===i?void 0:i.result;e(n)},s.onerror=function(t){o(t)}}))}(t,e);return yield Rt(i)}))}function Vt(t){return"number"==typeof t&&(t>0||t<=0)}function jt(t){return"number"==typeof t&&t>=0}function Dt(t){return"string"==typeof t&&/^(http:\/\/|https:\/\/|\.\/|\/)/.test(`${t}`)}function $t(t){return"string"==typeof t&&/^(data:image\/)/.test(`${t}`)}const Bt={x:function(t){return Vt(t)},y:function(t){return Vt(t)},w:jt,h:function(t){return"number"==typeof t&&t>=0},angle:function(t){return"number"==typeof t&&t>=-360&&t<=360},number:Vt,numberStr:function(t){return/^(-?\d+(?:\.\d+)?)$/.test(`${t}`)},borderWidth:function(t){return jt(t)},borderRadius:function(t){return Vt(t)&&t>=0},color:function(t){return It(t)},imageSrc:function(t){return $t(t)||Dt(t)},imageURL:Dt,imageBase64:$t,svg:function(t){return"string"==typeof t&&/^(<svg[\s]{1,}|<svg>)/i.test(`${t}`.trim())&&/<\/[\s]{0,}svg>$/i.test(`${t}`.trim())},html:function(t){let e=!1;if("string"==typeof t){let i=document.createElement("div");i.innerHTML=t,i.children.length>0&&(e=!0),i=null}return e},text:function(t){return"string"==typeof t},fontSize:function(t){return Vt(t)&&t>0},lineHeight:function(t){return Vt(t)&&t>0},textAlign:function(t){return["center","left","right"].includes(t)},fontFamily:function(t){return"string"==typeof t&&t.length>0},fontWeight:function(t){return["bold"].includes(t)},strokeWidth:function(t){return Vt(t)&&t>0}};var Xt,Yt=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class Ft{constructor(){Xt.set(this,void 0),function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,i):o?o.value=i:e.set(t,i)}(this,Xt,new Map,"f")}on(t,e){if(Yt(this,Xt,"f").has(t)){const i=Yt(this,Xt,"f").get(t)||[];null==i||i.push(e),Yt(this,Xt,"f").set(t,i)}else Yt(this,Xt,"f").set(t,[e])}off(t,e){if(Yt(this,Xt,"f").has(t)){const i=Yt(this,Xt,"f").get(t);if(Array.isArray(i))for(let t=0;t<(null==i?void 0:i.length);t++)if(i[t]===e){i.splice(t,1);break}Yt(this,Xt,"f").set(t,i||[])}}trigger(t,e){const i=Yt(this,Xt,"f").get(t);return!!Array.isArray(i)&&(i.forEach((t=>{t(e)})),!0)}has(t){if(Yt(this,Xt,"f").has(t)){const e=Yt(this,Xt,"f").get(t);if(Array.isArray(e)&&e.length>0)return!0}return!1}destroy(){this.clear()}clear(){Yt(this,Xt,"f").clear()}}function Ht(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}Xt=new WeakMap;var Ut,Gt,Nt,Qt,qt=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},Kt=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class Jt{constructor(t){Ut.add(this),Gt.set(this,void 0),Nt.set(this,void 0),qt(this,Nt,Wt(t.defaultStorage),"f"),qt(this,Gt,Kt(this,Ut,"m",Qt).call(this),"f")}set(t,e){Kt(this,Gt,"f")[t]=e}get(t){return Kt(this,Gt,"f")[t]}getSnapshot(t){return!0===(null==t?void 0:t.deepClone)?Wt(Kt(this,Gt,"f")):Object.assign({},Kt(this,Gt,"f"))}clear(){qt(this,Gt,Kt(this,Ut,"m",Qt).call(this),"f")}destroy(){qt(this,Gt,null,"f")}}function Zt(t){return t/180*Math.PI}function _t(t,e,i){const n=te(e);!function(t,e,i,n){const o=Zt(e||0);i&&(o>0||o<0)&&(t.translate(i.x,i.y),t.rotate(o),t.translate(-i.x,-i.y)),n(t),i&&(o>0||o<0)&&(t.translate(i.x,i.y),t.rotate(-o),t.translate(-i.x,-i.y))}(t,e.angle||0,n,(()=>{i(t)}))}function te(t){return{x:t.x+t.w/2,y:t.y+t.h/2}}function ee(t){const e=Math.min(t[0].x,t[1].x,t[2].x,t[3].x),i=Math.min(t[0].y,t[1].y,t[2].y,t[3].y);return te({x:e,y:i,w:Math.max(t[0].x,t[1].x,t[2].x,t[3].x)-e,h:Math.max(t[0].y,t[1].y,t[2].y,t[3].y)-i})}function ie(t,e,i){const n=function(t,e){const i=e.x-t.x,n=e.y-t.y;if(0===i){if(n<0)return 0;if(n>0)return Math.PI}else if(0===n){if(i<0)return 3*Math.PI/2;if(i>0)return Math.PI/2}return i>0&&n<0?Math.atan(Math.abs(i)/Math.abs(n)):i>0&&n>0?Math.PI-Math.atan(Math.abs(i)/Math.abs(n)):i<0&&n>0?Math.PI+Math.atan(Math.abs(i)/Math.abs(n)):i<0&&n<0?2*Math.PI-Math.atan(Math.abs(i)/Math.abs(n)):0}(t,e);let o=n+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 a=function(t,e){const i=(t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y);return 0===i?i:Math.sqrt(i)}(t,e);let s=0,r=0;return 0===o?(s=0,r=0-a):o>0&&o<Math.PI/2?(s=Math.sin(o)*a,r=0-Math.cos(o)*a):o===Math.PI/2?(s=a,r=0):o>Math.PI/2&&o<Math.PI?(s=Math.sin(Math.PI-o)*a,r=Math.cos(Math.PI-o)*a):o===Math.PI?(s=0,r=a):o>Math.PI&&o<1.5*Math.PI?(s=0-Math.sin(o-Math.PI)*a,r=Math.cos(o-Math.PI)*a):o===1.5*Math.PI?(s=0-a,r=0):o>1.5*Math.PI&&o<2*Math.PI?(s=0-Math.sin(2*Math.PI-o)*a,r=0-Math.cos(2*Math.PI-o)*a):o===2*Math.PI&&(s=0,r=0-a),s+=t.x,r+=t.y,{x:s,y:r}}function ne(t,e,i){const{x:n,y:o,w:a,h:s}=t;let r={x:n,y:o},l={x:n+a,y:o},h={x:n+a,y:o+s},c={x:n,y:o+s};if(i&&(i>0||i<0)){const t=Zt(function(t){if(!(t>0||t<0)||0===t)return 0;let e=t%360;e<0&&(e+=360);return e}(i));r=ie(e,r,t),l=ie(e,l,t),h=ie(e,h,t),c=ie(e,c,t)}return[r,l,h,c]}function oe(t){const{angle:e=0}=t;return ne(t,te(t),e)}function ae(t,e,i){return[ie(t,{x:e[0].x,y:e[0].y},i),ie(t,{x:e[1].x,y:e[1].y},i),ie(t,{x:e[2].x,y:e[2].y},i),ie(t,{x:e[3].x,y:e[3].y},i)]}function se(t,e){var i;const n=[];let o=t;if(e.length>1)for(let t=0;t<e.length-1;t++){const a=o[e[t]];if("group"!==(null==a?void 0:a.type)||!Array.isArray(null===(i=null==a?void 0:a.detail)||void 0===i?void 0:i.children))return null;n.push(a),o=a.detail.children}return n}function re(t){const{x:e,y:i,h:n,w:o}=t;return[{x:e,y:i},{x:e+o,y:i},{x:e+o,y:i+n},{x:e,y:i+n}]}function le(t){const{x:e,y:i,w:n,h:o,angle:a=0}=t;return 0===a?re(t):ne(t,te({x:e,y:i,w:n,h:o,angle:a}),a)}function he(t,e){const{groupQueue:i}=e;if(!(i.length>0))return[le(t)];const n=function(t){const e=[];let i=0,n=0;const o=[],a=[...t];for(let t=0;t<a.length;t++){const{x:s,y:r,w:l,h:h,angle:c=0}=a[t];let f;if(i+=s,n+=r,0===t){const t={x:i,y:n,w:l,h:h,angle:c};f=le({x:s,y:r,w:l,h:h,angle:c}),o.push({center:te(t),angle:c,radian:Zt(c)})}else{f=re({x:i,y:n,w:l,h:h,angle:c});for(let t=0;t<o.length;t++){const{center:e,radian:i}=o[t];f=ae(e,f,i)}const t=ee(f);(c>0||c<0)&&(f=ae(t,f,Zt(c))),o.push({center:t,angle:c,radian:Zt(c)})}e.push(f)}return e}([...i,t]);return n}function ce(t,e){const{viewScaleInfo:i}=e,{x:n,y:o,w:a,h:s,angle:r}=t,{scale:l,offsetTop:h,offsetLeft:c}=i;return{x:n*l+c,y:o*l+h,w:a*l,h:s*l,angle:r}}function fe(t,e){const{viewScaleInfo:i}=e,{x:n,y:o}=t,{scale:a,offsetTop:s,offsetLeft:r}=i;return{x:n*a+r,y:o*a+s}}function de(t,e){const{context2d:i,element:n,viewScaleInfo:o}=e,{angle:a=0}=n,{x:s,y:r,w:l,h:h}=ce(n,{viewScaleInfo:o}),c=oe({x:s,y:r,w:l,h:h,angle:a});if(c.length>=2){i.beginPath(),i.moveTo(c[0].x,c[0].y);for(let t=1;t<c.length;t++)i.lineTo(c[t].x,c[t].y);i.closePath()}return!!i.isPointInPath(t.x,t.y)}function ue(t,e){const{groupQueue:i}=e,n=function(t,e){return he(t,e).pop()||null}(t,{groupQueue:i}),o=Ht(n[0],n[1]),a=Ht(n[1],n[2]),s=Ht(n[2],n[3]),r=Ht(n[3],n[0]),l=n[0],h=n[1],c=n[2],f=n[3],d=Math.max(l.x,h.x,c.x,f.x),u=Math.max(l.y,h.y,c.y,f.y);return{center:{x:(d+Math.min(l.x,h.x,c.x,f.x))/2,y:(u+Math.min(l.y,h.y,c.y,f.y))/2},topLeft:l,topRight:h,bottomLeft:f,bottomRight:c,top:o,right:a,left:r,bottom:s}}function we(t){const e=Math.max(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),i=Math.max(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),n=Math.min(t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y),a={x:t.center.x,y:t.center.y},s={x:n,y:o},r={x:e,y:o},l={x:e,y:i},h={x:n,y:i},c=Ht(s,r),f=Ht(h,l),d=Ht(s,h);return{center:a,topLeft:s,topRight:r,bottomLeft:h,bottomRight:l,top:c,right:Ht(r,l),left:d,bottom:f}}function ve(t,e){const i=function(t){const{viewScaleInfo:e,viewSizeInfo:i}=t,{scale:n,offsetTop:o,offsetLeft:a}=e,{width:s,height:r}=i,l=0-a/n,h=0-o/n,c=s/n,f=r/n,d=te({x:l,y:h,w:c,h:f}),u={x:l,y:h},w={x:l+c,y:h},v={x:l,y:h+f},g={x:l+c,y:h+f},p={x:l,y:d.y},y={x:d.x,y:h},m={x:l+c,y:d.y},b={x:d.x,y:h+f};return{center:d,topLeft:u,topRight:w,bottomLeft:v,bottomRight:g,left:p,top:y,right:m,bottom:b}}(e);let n=0,o=0;return Object.keys(t).forEach((e=>{const a=t[e];a.isVisibleInView=function(t,e){const i=Math.min(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),n=Math.max(t.topLeft.x,t.topRight.x,t.bottomLeft.x,t.bottomRight.x),o=Math.min(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),a=Math.max(t.topLeft.y,t.topRight.y,t.bottomLeft.y,t.bottomRight.y),s=Math.min(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),r=Math.max(e.topLeft.x,e.topRight.x,e.bottomLeft.x,e.bottomRight.x),l=Math.min(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y),h=Math.max(e.topLeft.y,e.topRight.y,e.bottomLeft.y,e.bottomRight.y);return i<=r&&n>=s&&o<=h&&a>=l||r<=a&&r>=a&&r<=a&&r>=a}(a.rangeRectInfo,i),a.isVisibleInView?n++:o++})),{viewVisibleInfoMap:t,visibleCount:n,invisibleCount:o}}function ge(t){let e="";return t.forEach((t=>{e+=t.type+t.params.join(" ")})),e}Gt=new WeakMap,Nt=new WeakMap,Ut=new WeakSet,Qt=function(){return Wt(Kt(this,Nt,"f"))};const pe={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function ye(t,e){const{viewScaleInfo:i}=e,{scale:n}=i;let{borderRadius:o,borderDash:a}=t.detail;const s=Array.isArray(a)&&a.length>0,{boxSizing:r=pe.boxSizing,borderWidth:l}=t.detail;Array.isArray(l)&&(o=0);let{x:h,y:c,w:f,h:d}=t,u=[0,0,0,0];if("number"==typeof o){const t=o*n;u=[t,t,t,t]}else Array.isArray(o)&&4===(null==o?void 0:o.length)&&(u=[o[0]*n,o[1]*n,o[2]*n,o[3]*n]);let w=0;return"number"==typeof l&&(w=(l||0)*n),"border-box"!==r||s?"content-box"===r?(h=t.x-w/2,c=t.y-w/2,f=t.w+w,d=t.h+w):(h=t.x,c=t.y,f=t.w,d=t.h):(h=t.x+w/2,c=t.y+w/2,f=t.w-w,d=t.h-w),f=Math.max(f,1),d=Math.max(d,1),u=u.map((t=>Math.min(t,f/2,d/2))),{x:h,y:c,w:f,h:d,radiusList:u}}function me(t,e,i){if("string"==typeof e)return e;const{viewElementSize:n,viewScaleInfo:o,opacity:a=1}=i,{x:s,y:r}=n,{scale:l}=o;if("linear-gradient"===(null==e?void 0:e.type)){const{start:i,end:n,stops:o}=e,h={x:s+i.x*l,y:r+i.y*l},c={x:s+n.x*l,y:r+n.y*l},f=t.createLinearGradient(h.x,h.y,c.x,c.y);return o.forEach((t=>{f.addColorStop(t.offset,Mt(t.color,a))})),f}if("radial-gradient"===(null==e?void 0:e.type)){const{inner:i,outer:n,stops:o}=e,h={x:s+i.x*l,y:r+i.y*l,radius:i.radius*l},c={x:s+n.x*l,y:r+n.y*l,radius:n.radius*l},f=t.createRadialGradient(h.x,h.y,h.radius,c.x,c.y,c.radius);return o.forEach((t=>{f.addColorStop(t.offset,Mt(t.color,a))})),f}return"#000000"}const be={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,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function xe(t){var e,i,n,o;let a=1;return void 0!==(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.opacity)&&(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.opacity)>=0&&(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.opacity)<=1&&(a=null===(o=null==t?void 0:t.detail)||void 0===o?void 0:o.opacity),a}function Se(t,e,i){const{pattern:n,renderContent:o,originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l}=i||{},{parentOpacity:h}=i,c=xe(a)*h;!function(t,e,i){const{renderContent:n,originElem:o,calcElemSize:a,viewSizeInfo:s}=i,r=s.devicePixelRatio,{clipPath:l}=(null==o?void 0:o.detail)||{};if(l&&a&&l.commands){const{x:i,y:o,w:s,h:h}=a,{originW:c,originH:f,originX:d,originY:u}=l,w=s/c,v=h/f,g=i-d*w,p=o-u*v;t.save(),t.translate(g,p),t.scale(r*w,r*v);const y=ge(l.commands||[]),m=new Path2D(y);t.clip(m),t.translate(0-g,0-p),t.setTransform(1,0,0,1,0,0),_t(t,Object.assign({},e),(()=>{null==n||n()})),t.restore()}else null==n||n()}(t,e,{originElem:a,calcElemSize:s,viewScaleInfo:r,viewSizeInfo:l,renderContent:()=>{t.globalAlpha=c,Ie(t,e,{pattern:n,viewScaleInfo:r,viewSizeInfo:l}),null==o||o(),Me(t,e,{viewScaleInfo:r,viewSizeInfo:l}),t.globalAlpha=h}})}function Ie(t,e,i){var n,o;const{pattern:a,viewScaleInfo:s,viewSizeInfo:r}=i,l=[];if(e.detail.background||a){const{x:i,y:h,w:c,h:f,radiusList:d}=ye(e,{viewScaleInfo:s,viewSizeInfo:r});if(t.beginPath(),t.moveTo(i+d[0],h),t.arcTo(i+c,h,i+c,h+f,d[1]),t.arcTo(i+c,h+f,i,h+f,d[2]),t.arcTo(i,h+f,i,h,d[3]),t.arcTo(i,h,i+c,h,d[0]),t.closePath(),"string"==typeof a)t.fillStyle=a;else if(["CanvasPattern"].includes(Et.type(a)))t.fillStyle=a;else if("string"==typeof e.detail.background)t.fillStyle=e.detail.background;else if("linear-gradient"===(null===(n=e.detail.background)||void 0===n?void 0:n.type)){const n=me(t,e.detail.background,{viewElementSize:{x:i,y:h,w:c,h:f},viewScaleInfo:s,opacity:t.globalAlpha});t.fillStyle=n}else if("radial-gradient"===(null===(o=e.detail.background)||void 0===o?void 0:o.type)){const n=me(t,e.detail.background,{viewElementSize:{x:i,y:h,w:c,h:f},viewScaleInfo:s,opacity:t.globalAlpha});if(t.fillStyle=n,l&&l.length>0)for(let e=0;e<(null==l?void 0:l.length);e++){const n=l[e];"translate"===n.method?t.translate(n.args[0]+i,n.args[1]+h):"rotate"===n.method?t.rotate(...n.args):"scale"===n.method&&t.scale(...n.args)}}t.fill(),l&&l.length>0&&t.setTransform(1,0,0,1,0,0)}}function Me(t,e,i){if(0===e.detail.borderWidth)return;if(!It(e.detail.borderColor))return;const{viewScaleInfo:n}=i,{scale:o}=n;let a=be.borderColor;!0===It(e.detail.borderColor)&&(a=e.detail.borderColor);const{borderWidth:s,borderRadius:r,borderDash:l,boxSizing:h=be.boxSizing}=e.detail;let c=0;"number"==typeof s&&(c=s||1),c*=o;let f=[0,0,0,0];if("number"==typeof r){const t=r*o;f=[t,t,t,t]}else Array.isArray(r)&&4===(null==r?void 0:r.length)&&(f=[r[0]*o,r[1]*o,r[2]*o,r[3]*o]);t.strokeStyle=a;let d=[];Array.isArray(l)&&l.length>0&&(d=l.map((t=>Math.ceil(t*o))));let u=0,w=0,v=0,g=0;if(Array.isArray(s)&&(u=(s[0]||0)*o,w=(s[1]||0)*o,v=(s[2]||0)*o,g=(s[3]||0)*o),g||w||u||v){t.lineCap="butt";let{x:i,y:n,w:o,h:a}=e;"border-box"===h?(i+=g/2,n+=u/2,o=o-g/2-w/2,a=a-u/2-v/2):"content-box"===h?(i-=g/2,n-=u/2,o=o+g/2+w/2,a=a+u/2+v/2):(i=e.x,n=e.y,o=e.w,a=e.h),u&&(t.beginPath(),t.lineWidth=u,t.moveTo(i-g/2,n),t.lineTo(i+o+w/2,n),t.closePath(),t.stroke()),w&&(t.beginPath(),t.lineWidth=w,t.moveTo(i+o,n-u/2),t.lineTo(i+o,n+a+v/2),t.closePath(),t.stroke()),v&&(t.beginPath(),t.lineWidth=v,t.moveTo(i-g/2,n+a),t.lineTo(i+o+w/2,n+a),t.closePath(),t.stroke()),g&&(t.beginPath(),t.lineWidth=g,t.moveTo(i,n-u/2),t.lineTo(i,n+a+v/2),t.closePath(),t.stroke())}else{let{x:i,y:n,w:o,h:a}=e;"border-box"===h?(i=e.x+c/2,n=e.y+c/2,o=e.w-c,a=e.h-c):"content-box"===h?(i=e.x-c/2,n=e.y-c/2,o=e.w+c,a=e.h+c):(i=e.x,n=e.y,o=e.w,a=e.h),d.length>0?t.lineCap="butt":t.lineCap="square",o=Math.max(o,1),a=Math.max(a,1),f=f.map((t=>Math.min(t,o/2,a/2))),t.setLineDash(d),t.lineWidth=c,t.beginPath(),t.moveTo(i+f[0],n),t.arcTo(i+o,n,i+o,n+a,f[1]),t.arcTo(i+o,n+a,i,n+a,f[2]),t.arcTo(i,n+a,i,n,f[3]),t.arcTo(i,n,i+o,n,f[0]),t.closePath(),t.stroke()}t.setLineDash([])}function ze(t,e,i){const{detail:n}=e,{viewScaleInfo:o,renderContent:a}=i,{shadowColor:s,shadowOffsetX:r,shadowOffsetY:l,shadowBlur:h}=n;Bt.number(h)?(t.save(),t.shadowColor=s||be.shadowColor,t.shadowOffsetX=(r||0)*o.scale,t.shadowOffsetY=(l||0)*o.scale,t.shadowBlur=(h||0)*o.scale,a(),t.restore()):(t.save(),t.shadowColor="transparent",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,a(),t.restore())}const Ce={boxSizing:"border-box",borderWidth:0,borderColor:"#000000",shadowColor:"#000000",borderRadius:0,borderDash:[],shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,opacity:1,color:"#000000",textAlign:"left",verticalAlign:"top",fontSize:16,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function Pe(t,e,i){var n;if(!0===(null===(n=null==e?void 0:e.operations)||void 0===n?void 0:n.invisible))return;const{w:o,h:a}=e,{scale:s}=i.viewScaleInfo;if(!(s<1&&(o*s<1||a*s<1)||0===i.parentOpacity))try{switch(e.type){case"rect":!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ce(e,{viewScaleInfo:n,viewSizeInfo:o})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});_t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{ze(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{Se(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{}})}})}))}(t,e,i);break;case"circle":!function(t,e,i){const{detail:n,angle:o}=e,{viewScaleInfo:a,viewSizeInfo:s,parentOpacity:r}=i,{background:l="#000000",borderColor:h="#000000",boxSizing:c,borderWidth:f=0,borderDash:d}=n;let u=0;"number"==typeof f&&f>0?u=f:Array.isArray(f)&&"number"==typeof f[0]&&f[0]>0&&(u=f[0]),u*=a.scale;const{x:w,y:v,w:g,h:p}=ce({x:e.x,y:e.y,w:e.w,h:e.h},{viewScaleInfo:a})||e,y=Object.assign(Object.assign({},e),{x:w,y:v,w:g,h:p,angle:o});_t(t,{x:w,y:v,w:g,h:p,angle:o},(()=>{ze(t,y,{viewScaleInfo:a,viewSizeInfo:s,renderContent:()=>{let e=g/2,i=p/2;const n=w+e,o=v+i,s=e,f=i;if(u>0&&("content-box"===c||("center-line"===c?(e-=u/2,i-=u/2):(e-=u,i-=u))),e>=0&&i>=0){const c=xe(y)*r;t.globalAlpha=c,t.beginPath();const m=me(t,l,{viewElementSize:{x:w,y:v,w:g,h:p},viewScaleInfo:a,opacity:t.globalAlpha});if(t.fillStyle=m,t.circle(n,o,s,f,0,0,2*Math.PI),t.closePath(),t.fill(),t.globalAlpha=r,"number"==typeof u&&u>0){const s=u/2+e,r=u/2+i;if(t.beginPath(),d){const e=d.map((t=>t*a.scale));t.setLineDash(e)}t.strokeStyle=h,t.lineWidth=u,t.circle(n,o,s,r,0,0,2*Math.PI),t.closePath(),t.stroke(),t.setLineDash([])}}}})}))}(t,e,i);break;case"text":!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ce(e,{viewScaleInfo:n})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});_t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{Se(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const i=Object.assign(Object.assign({},Ce),e.detail),o=i.fontSize||Ce.fontSize,a=o*n.scale,c=(i.lineHeight||o)*n.scale;t.fillStyle=e.detail.color||Ce.color,t.textBaseline="top",t.$setFont({fontWeight:i.fontWeight,fontSize:a,fontFamily:i.fontFamily});const f=i.text.replace(/\r\n/gi,"\n"),d=c,u=f.split("\n"),w=[];let v=0;u.forEach(((e,i)=>{let n="";if(e.length>0){for(let o=0;o<e.length&&(t.measureText(n+(e[o]||"")).width<=t.$doPixelRatio(l)?n+=e[o]||"":(w.push({text:n,width:t.$undoPixelRatio(t.measureText(n).width)}),n=e[o]||"",v++),!((v+1)*d>h));o++)if(e.length-1===o&&(v+1)*d<=h){w.push({text:n,width:t.$undoPixelRatio(t.measureText(n).width)}),i<u.length-1&&v++;break}}else w.push({text:"",width:0})}));let g=0;w.length*d<h&&("top"===e.detail.verticalAlign?g=0:"bottom"===e.detail.verticalAlign?g+=h-w.length*d:g+=(h-w.length*d)/2);{const e=r+g;void 0!==i.textShadowColor&&It(i.textShadowColor)&&(t.shadowColor=i.textShadowColor),void 0!==i.textShadowOffsetX&&Bt.number(i.textShadowOffsetX)&&(t.shadowOffsetX=i.textShadowOffsetX),void 0!==i.textShadowOffsetY&&Bt.number(i.textShadowOffsetY)&&(t.shadowOffsetY=i.textShadowOffsetY),void 0!==i.textShadowBlur&&Bt.number(i.textShadowBlur)&&(t.shadowBlur=i.textShadowBlur),w.forEach(((n,o)=>{let a=s;"center"===i.textAlign?a=s+(l-n.width)/2:"right"===i.textAlign&&(a=s+(l-n.width)),t.fillText(n.text,a,e+d*o)}))}}})}))}(t,e,i);break;case"image":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ce(e,{viewScaleInfo:o,viewSizeInfo:a})||e,d=Object.assign(Object.assign({},e),{x:r,y:l,w:h,h:c,angle:f});_t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{ze(t,d,{viewScaleInfo:o,viewSizeInfo:a,renderContent:()=>{Se(t,d,{originElem:e,calcElemSize:{x:r,y:l,w:h,h:c,angle:f},viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s,renderContent:()=>{if(n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"image"===e.type&&n){t.globalAlpha=xe(e)*s;const{x:i,y:r,w:l,h:h,radiusList:c}=ye(d,{viewScaleInfo:o,viewSizeInfo:a});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(i+c[0],r),t.arcTo(i+l,r,i+l,r+h,c[1]),t.arcTo(i+l,r+h,i,r+h,c[2]),t.arcTo(i,r+h,i,r,c[3]),t.arcTo(i,r,i+l,r,c[0]),t.closePath(),t.fill(),t.clip(),t.drawImage(n,i,r,l,h),t.globalAlpha=s,t.restore()}}})}})}))}(t,e,i);break;case"svg":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ce(e,{viewScaleInfo:o,viewSizeInfo:a})||e;_t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"svg"===e.type&&n&&(t.globalAlpha=xe(e)*s,t.drawImage(n,r,l,h,c),t.globalAlpha=s)}))}(t,e,i);break;case"html":!function(t,e,i){const n=i.loader.getContent(e),{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,{x:r,y:l,w:h,h:c,angle:f}=ce(e,{viewScaleInfo:o,viewSizeInfo:a})||e;_t(t,{x:r,y:l,w:h,h:c,angle:f},(()=>{n||i.loader.isDestroyed()||i.loader.load(e,i.elementAssets||{}),"html"===e.type&&n&&(t.globalAlpha=xe(e)*s,t.drawImage(n,r,l,h,c),t.globalAlpha=s)}))}(t,e,i);break;case"path":!function(t,e,i){const{detail:n}=e,{originX:o,originY:a,originW:s,originH:r}=n,{viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c}=i,{x:f,y:d,w:u,h:w,angle:v}=ce(e,{viewScaleInfo:l,viewSizeInfo:h})||e,g=u/s,p=w/r,y=f-o*g,m=d-a*p,b=l.scale*h.devicePixelRatio,x=Object.assign(Object.assign({},e),{x:f,y:d,w:u,h:w,angle:v});_t(t,{x:f,y:d,w:u,h:w,angle:v},(()=>{Se(t,x,{originElem:e,calcElemSize:{x:f,y:d,w:u,h:w,angle:v},viewScaleInfo:l,viewSizeInfo:h,parentOpacity:c,renderContent:()=>{ze(t,x,{viewScaleInfo:l,viewSizeInfo:h,renderContent:()=>{t.save(),t.translate(y,m),t.scale(b*g/l.scale,b*p/l.scale);const e=ge(n.commands||[]),i=new Path2D(e);n.fill&&(t.fillStyle=n.fill,t.fill(i)),n.stroke&&0!==n.strokeWidth&&(t.strokeStyle=n.stroke,t.lineWidth=(n.strokeWidth||1)/h.devicePixelRatio,t.lineCap=n.strokeLineCap||"square",t.stroke(i)),t.translate(-y,-m),t.restore()}})}})}))}(t,e,i);break;case"group":{const n=Object.assign(Object.assign({},i.elementAssets||{}),e.detail.assets||{});!function(t,e,i){const{viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a}=i,{x:s,y:r,w:l,h:h,angle:c}=ce({x:e.x,y:e.y,w:e.w,h:e.h,angle:e.angle},{viewScaleInfo:n,viewSizeInfo:o})||e,f=Object.assign(Object.assign({},e),{x:s,y:r,w:l,h:h,angle:c});_t(t,{x:s,y:r,w:l,h:h,angle:c},(()=>{t.globalAlpha=xe(e)*a,ze(t,f,{viewScaleInfo:n,viewSizeInfo:o,renderContent:()=>{Se(t,f,{originElem:e,calcElemSize:{x:s,y:r,w:l,h:h,angle:c},viewScaleInfo:n,viewSizeInfo:o,parentOpacity:a,renderContent:()=>{const{x:s,y:r,w:l,h:h,radiusList:c}=ye(f,{viewScaleInfo:n,viewSizeInfo:o});if("hidden"===e.detail.overflow&&(t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(s+c[0],r),t.arcTo(s+l,r,s+l,r+h,c[1]),t.arcTo(s+l,r+h,s,r+h,c[2]),t.arcTo(s,r+h,s,r,c[3]),t.arcTo(s,r,s+l,r,c[0]),t.closePath(),t.fill(),t.clip()),Array.isArray(e.detail.children)){const{parentElementSize:n}=i,o={x:n.x+e.x,y:n.y+e.y,w:e.w||n.w,h:e.h||n.h,angle:e.angle},{calculator:s}=i;for(let n=0;n<e.detail.children.length;n++){let r=e.detail.children[n];if(r=Object.assign(Object.assign({},r),{x:o.x+r.x,y:o.y+r.y}),!0===i.forceDrawAll||(null==s?void 0:s.needRender(r)))try{Pe(t,r,Object.assign(Object.assign({},i),{parentOpacity:a*xe(e)}))}catch(t){console.error(t)}}}"hidden"===e.detail.overflow&&t.restore()}})}}),t.globalAlpha=a}))}(t,e,Object.assign(Object.assign({},i),{elementAssets:n}));break}}}catch(t){console.error(t)}}const We={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,fontFamily:"sans-serif",fontWeight:400,overflow:"hidden"};function ke(t,e,i){var n;const{elements:o=[]}=e,{parentOpacity:a}=i;for(let e=0;e<o.length;e++){const s=o[e],r=Object.assign(Object.assign({},s),{detail:Object.assign(Object.assign({},We),null==s?void 0:s.detail)});if(!0===i.forceDrawAll||(null===(n=i.calculator)||void 0===n?void 0:n.needRender(r)))try{Pe(t,r,Object.assign(Object.assign({},i),{parentOpacity:a}))}catch(t){console.error(t)}}}var Ee,Oe,Ae,Re,Te,Le,Ve,je,De,$e,Be,Xe,Ye=function(t,e,i,n){return new(i||(i=Promise))((function(o,a){function s(t){try{l(n.next(t))}catch(t){a(t)}}function r(t){try{l(n.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((n=n.apply(t,e||[])).next())}))},Fe=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)},He=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i};const Ue=["image","svg","html"],Ge=t=>{var e,i,n;let o=null;return"image"===t.type?o=(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.src)||null:"svg"===t.type?o=(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.svg)||null:"html"===t.type&&(o=(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.html)||null),"string"==typeof o&&o?/^@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(`${o}`)?o:Pt(o):Pt(`${zt()}-${t.uuid}-${zt()}-${zt()}`)};class Ne extends Ft{constructor(){super(),Ee.add(this),Oe.set(this,{}),Ae.set(this,{}),Re.set(this,{}),Te.set(this,!1),Fe(this,Ee,"m",Le).call(this,"image",((t,e)=>Ye(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.src])||void 0===i?void 0:i.value)||t.detail.src,o=yield Rt(n);return{uuid:t.uuid,lastModified:Date.now(),content:o}})))),Fe(this,Ee,"m",Le).call(this,"html",((t,e)=>Ye(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.html])||void 0===i?void 0:i.value)||t.detail.html,o=yield Lt(n,{width:t.detail.originW||t.w,height:t.detail.originH||t.h});return{uuid:t.uuid,lastModified:Date.now(),content:o}})))),Fe(this,Ee,"m",Le).call(this,"svg",((t,e)=>Ye(this,void 0,void 0,(function*(){var i;const n=(null===(i=e[t.detail.svg])||void 0===i?void 0:i.value)||t.detail.svg,o=yield Tt(n);return{uuid:t.uuid,lastModified:Date.now(),content:o}}))))}isDestroyed(){return Fe(this,Te,"f")}destroy(){He(this,Te,!0,"f"),this.clear(),He(this,Oe,null,"f"),He(this,Ae,null,"f"),He(this,Re,null,"f")}load(t,e){!0!==Fe(this,Te,"f")&&(Fe(this,Ee,"m",Xe).call(this,t)||Ue.includes(t.type)&&Fe(this,Ee,"m",Be).call(this,t,e))}getContent(t){var e,i;const n=Ge(t);return(null===(i=null===(e=Fe(this,Re,"f"))||void 0===e?void 0:e[n])||void 0===i?void 0:i.content)||null}getLoadItemMap(){return Fe(this,Re,"f")}setLoadItemMap(t){He(this,Re,t,"f")}}Oe=new WeakMap,Ae=new WeakMap,Re=new WeakMap,Te=new WeakMap,Ee=new WeakSet,Le=function(t,e){Fe(this,Oe,"f")[t]=e},Ve=function(t){var e,i,n;let o=null;return"image"===t.type?o=(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.src)||null:"svg"===t.type?o=(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.svg)||null:"html"===t.type&&(o=(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.html)||null),o},je=function(t){return{element:t,status:"null",content:null,error:null,startTime:-1,endTime:-1,source:Fe(this,Ee,"m",Ve).call(this,t)}},De=function(t){const e=Ge(t.element),i=Fe(this,Re,"f")[e];Fe(this,Te,"f")||(i?i.startTime<t.startTime&&(Fe(this,Re,"f")[e]=t,this.trigger("load",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))):(Fe(this,Re,"f")[e]=t,this.trigger("load",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))))},$e=function(t){var e;const i=Ge(t.element),n=null===(e=Fe(this,Re,"f"))||void 0===e?void 0:e[i];Fe(this,Te,"f")||(n?n.startTime<t.startTime&&(Fe(this,Re,"f")[i]=t,this.trigger("error",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))):(Fe(this,Re,"f")[i]=t,this.trigger("error",Object.assign(Object.assign({},t),{countTime:t.endTime-t.startTime}))))},Be=function(t,e){const i=Fe(this,Ee,"m",je).call(this,t),n=Ge(t);if(Fe(this,Ae,"f")[n])return;Fe(this,Ae,"f")[n]=i;const o=Fe(this,Oe,"f")[t.type];"function"!=typeof o||Fe(this,Te,"f")||(i.startTime=Date.now(),o(t,e).then((t=>{Fe(this,Te,"f")||(i.content=t.content,i.endTime=Date.now(),i.status="load",Fe(this,Ee,"m",De).call(this,i))})).catch((e=>{console.warn(`Load element source "${i.source}" fail`,e,t),i.endTime=Date.now(),i.status="error",i.error=e,Fe(this,Ee,"m",$e).call(this,i)})))},Xe=function(t){var e;const i=Ge(t),n=null===(e=Fe(this,Ae,"f"))||void 0===e?void 0:e[i];return!(!n||"error"!==n.status||!n.source||n.source!==Fe(this,Ee,"m",Ve).call(this,t))};var Qe,qe,Ke,Je,Ze,_e=function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},ti=function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};class ei extends Ft{constructor(t){super(),Qe.add(this),qe.set(this,void 0),Ke.set(this,new Ne),Je.set(this,!1),_e(this,qe,t,"f"),ti(this,Qe,"m",Ze).call(this)}isDestroyed(){return ti(this,Je,"f")}destroy(){this.clear(),_e(this,qe,null,"f"),ti(this,Ke,"f").destroy(),_e(this,Ke,null,"f"),_e(this,Je,!0,"f")}updateOptions(t){_e(this,qe,t,"f")}drawData(t,e){const i=ti(this,Ke,"f"),{calculator:n}=ti(this,qe,"f"),o=ti(this,qe,"f").viewContext;o.clearRect(0,0,o.canvas.width,o.canvas.height);const a={x:0,y:0,w:e.viewSizeInfo.width,h:e.viewSizeInfo.height},s=Object.assign({loader:i,calculator:n,parentElementSize:a,elementAssets:t.assets,parentOpacity:1},e);t.layout?function(t,e,i,n){const{viewScaleInfo:o,viewSizeInfo:a,parentOpacity:s}=i,r=Object.assign({uuid:"layout",type:"group"},e),{x:l,y:h,w:c,h:f}=ce(r,{viewScaleInfo:o,viewSizeInfo:a})||r,d=Object.assign(Object.assign({},r),{x:l,y:h,w:c,h:f,angle:0});if(t.globalAlpha=1,ze(t,d,{viewScaleInfo:o,viewSizeInfo:a,renderContent:()=>{Ie(t,d,{viewScaleInfo:o,viewSizeInfo:a})}}),"hidden"===e.detail.overflow){const{viewScaleInfo:n,viewSizeInfo:o}=i,a=Object.assign({uuid:"layout",type:"group"},e),s=ce(a,{viewScaleInfo:n,viewSizeInfo:o})||a,r=Object.assign(Object.assign({},a),s),{x:l,y:h,w:c,h:f,radiusList:d}=ye(r,{viewScaleInfo:n,viewSizeInfo:o});t.save(),t.fillStyle="transparent",t.beginPath(),t.moveTo(l+d[0],h),t.arcTo(l+c,h,l+c,h+f,d[1]),t.arcTo(l+c,h+f,l,h+f,d[2]),t.arcTo(l,h+f,l,h,d[3]),t.arcTo(l,h,l+c,h,d[0]),t.closePath(),t.fill(),t.clip()}n(t),"hidden"===e.detail.overflow&&t.restore(),Me(t,d,{viewScaleInfo:o,viewSizeInfo:a}),t.globalAlpha=s}(o,t.layout,s,(()=>{ke(o,t,s)})):ke(o,t,s)}scale(t){const{sharer:e}=ti(this,qe,"f");if(!e)return;const{data:i,offsetTop:n,offsetBottom:o,offsetLeft:a,offsetRight:s,width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:f}=e.getActiveStoreSnapshot();i&&this.drawData(i,{viewScaleInfo:{scale:t,offsetTop:n,offsetBottom:o,offsetLeft:a,offsetRight:s},viewSizeInfo:{width:r,height:l,contextHeight:h,contextWidth:c,devicePixelRatio:f}})}setLoadItemMap(t){ti(this,Ke,"f").setLoadItemMap(t)}getLoadItemMap(){return ti(this,Ke,"f").getLoadItemMap()}getLoader(){return ti(this,Ke,"f")}}qe=new WeakMap,Ke=new WeakMap,Je=new WeakMap,Qe=new WeakSet,Ze=function(){const t=ti(this,Ke,"f");t.on("load",(t=>{this.trigger("load",t)})),t.on("error",(t=>{console.error(t)}))};class ii{constructor(t){bt(this,e,void 0),bt(this,i,void 0),xt(this,e,t),xt(this,i,new Jt({defaultStorage:{viewVisibleInfoMap:{},visibleCount:0,invisibleCount:0}}))}toGridNum(t,e){return!0===(null==e?void 0:e.ignore)?t:Math.round(t)}destroy(){xt(this,e,null)}needRender(t){const e=mt(this,i).get("viewVisibleInfoMap")[t.uuid];return!e||e.isVisibleInView}isPointInElement(t,i,n,o){return de(t,{context2d:mt(this,e).viewContext,element:i,viewScaleInfo:n,viewSizeInfo:o})}getPointElement(t,i){return function(t,e){var i,n,o;const{context2d:a,data:s,viewScaleInfo:r,viewSizeInfo:l,groupQueue:h}=e,c={index:-1,element:null,groupQueueIndex:-1};if(h&&Array.isArray(h)&&(null==h?void 0:h.length)>0)for(let e=h.length-1;e>=0;e--){let o=0,s=0,f=0;for(let t=0;t<=e;t++)o+=h[t].x,s+=h[t].y,f+=h[t].angle||0;const d=h[e];if(d&&"group"===d.type&&Array.isArray(null===(i=d.detail)||void 0===i?void 0:i.children))for(let i=0;i<d.detail.children.length;i++){const u=d.detail.children[i];if(!0!==(null===(n=null==u?void 0:u.operations)||void 0===n?void 0:n.invisible)){if(!u)break;if(de(t,{context2d:a,element:{x:o+u.x,y:s+u.y,w:u.w,h:u.h,angle:f+(u.angle||0)},viewScaleInfo:r,viewSizeInfo:l})){c.element=u,(e<h.length-1||"group"!==u.type)&&(c.groupQueueIndex=e);break}}}if(c.element)break}if(c.element)return c;for(let e=s.elements.length-1;e>=0;e--){const i=s.elements[e];if(!0!==(null===(o=null==i?void 0:i.operations)||void 0===o?void 0:o.invisible)&&de(t,{context2d:a,element:i,viewScaleInfo:r,viewSizeInfo:l})){c.index=e,c.element=i;break}}return c}(t,{...i,context2d:mt(this,e).viewContext})}resetViewVisibleInfoMap(t,e){if(t){const{viewVisibleInfoMap:n,invisibleCount:o,visibleCount:a}=function(t,e){const i={},n=[],o=e=>{const a={isVisibleInView:!0,isGroup:"group"===e.type,position:[...n]};let s=null;s=ue(e,{groupQueue:se(t,n)||[]}),i[e.uuid]=Object.assign(Object.assign({},a),{originRectInfo:s,rangeRectInfo:Bt.angle(e.angle)?we(s):s}),"group"===e.type&&e.detail.children.forEach(((t,e)=>{n.push(e),o(t),n.pop()}))};return t.forEach(((t,e)=>{n.push(e),o(t),n.pop()})),ve(i,e)}(t.elements,e);mt(this,i).set("viewVisibleInfoMap",n),mt(this,i).set("invisibleCount",o),mt(this,i).set("visibleCount",a)}}updateVisiableStatus(t){const{viewVisibleInfoMap:e,invisibleCount:n,visibleCount:o}=ve(mt(this,i).get("viewVisibleInfoMap"),t);mt(this,i).set("viewVisibleInfoMap",e),mt(this,i).set("invisibleCount",n),mt(this,i).set("visibleCount",o)}calcViewRectInfoFromOrigin(t,e){const n=mt(this,i).get("viewVisibleInfoMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:a,viewSizeInfo:s}=e,{center:r,left:l,right:h,bottom:c,top:f,topLeft:d,topRight:u,bottomLeft:w,bottomRight:v}=n.originRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const g={viewScaleInfo:a,viewSizeInfo:s};return{center:fe(r,g),left:fe(l,g),right:fe(h,g),bottom:fe(c,g),top:fe(f,g),topLeft:fe(d,g),topRight:fe(u,g),bottomLeft:fe(w,g),bottomRight:fe(v,g)}}calcViewRectInfoFromRange(t,e){const n=mt(this,i).get("viewVisibleInfoMap")[t];if(!(null==n?void 0:n.originRectInfo))return null;const{checkVisible:o,viewScaleInfo:a,viewSizeInfo:s}=e,{center:r,left:l,right:h,bottom:c,top:f,topLeft:d,topRight:u,bottomLeft:w,bottomRight:v}=n.rangeRectInfo;if(!0===o&&!1===n.isVisibleInView)return null;const g={viewScaleInfo:a,viewSizeInfo:s};return{center:fe(r,g),left:fe(l,g),right:fe(h,g),bottom:fe(c,g),top:fe(f,g),topLeft:fe(d,g),topRight:fe(u,g),bottomLeft:fe(w,g),bottomRight:fe(v,g)}}modifyViewVisibleInfoMap(t,e){const{modifyOptions:n,viewScaleInfo:o,viewSizeInfo:a}=e,{type:s,content:r}=n,l=t.elements,h=mt(this,i).get("viewVisibleInfoMap");if("deleteElement"===s){const{element:t}=r;delete h[t.uuid]}else if("addElement"===s||"updateElement"===s){const{position:e}=r,i=function(t,e){let i=null,n=e;for(let e=0;e<t.length;e++){const o=n[t[e]];if(e<t.length-1&&"group"===o.type)n=o.detail.children;else{if(e!==t.length-1)break;i=o}}return i}(e,t.elements),n=se(l,e);if(i){const t=ue(i,{groupQueue:n||[]}),r={originRectInfo:t,rangeRectInfo:Bt.angle(i.angle)?we(t):t,isVisibleInView:!0,isGroup:"group"===(null==i?void 0:i.type),position:[...e]};h[i.uuid]=r,"updateElement"===s&&this.updateVisiableStatus({viewScaleInfo:o,viewSizeInfo:a})}}else"moveElement"===s&&this.resetViewVisibleInfoMap(t,{viewScaleInfo:o,viewSizeInfo:a});mt(this,i).set("viewVisibleInfoMap",h)}}function ni(t){return t>0||t<0||0===t}e=new WeakMap,i=new WeakMap;class oi extends Ft{constructor(t){super(),bt(this,s),bt(this,g),bt(this,y),bt(this,b),bt(this,n,void 0),bt(this,o,void 0),bt(this,a,!1),bt(this,l,(t=>{if(!St(this,g,p).call(this,t))return;const e=St(this,y,m).call(this,t);if(!St(this,b,x).call(this,e))return;t.preventDefault(),t.stopPropagation();const i=t.deltaX>0||t.deltaX<0?t.deltaX:0,n=t.deltaY>0||t.deltaY<0?t.deltaY:0;!0===t.ctrlKey&&this.has("wheelScale")?this.trigger("wheelScale",{deltaX:i,deltaY:n,point:e}):this.has("wheel")&&this.trigger("wheel",{deltaX:i,deltaY:n,point:e})})),bt(this,h,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);St(this,b,x).call(this,e)})),bt(this,c,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);if(!St(this,b,x).call(this,e))return;const i=Date.now(),n=mt(this,o).get("prevClickPoint");n&&i-n.t<=500&&Math.abs(n.x-e.x)<=5&&Math.abs(n.y-e.y)<=5?this.trigger("doubleClick",{point:e}):mt(this,o).set("prevClickPoint",e)})),bt(this,f,(t=>{if(mt(this,o).set("hasPointDown",!1),!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);this.trigger("pointLeave",{point:e})})),bt(this,d,(t=>{if(mt(this,o).set("hasPointDown",!1),!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);this.trigger("pointEnd",{point:e})})),bt(this,u,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault(),t.stopPropagation();const e=St(this,y,m).call(this,t);St(this,b,x).call(this,e)?!0===mt(this,o).get("hasPointDown")&&this.trigger("pointMove",{point:e}):mt(this,o).get("hasPointDown")&&(this.trigger("pointLeave",{point:e}),mt(this,o).set("hasPointDown",!1))})),bt(this,w,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);St(this,b,x).call(this,e)&&(mt(this,o).set("hasPointDown",!0),this.trigger("pointStart",{point:e}))})),bt(this,v,(t=>{if(!St(this,g,p).call(this,t))return;t.preventDefault();const e=St(this,y,m).call(this,t);St(this,b,x).call(this,e)&&this.trigger("hover",{point:e})}));const e=new Jt({defaultStorage:{hasPointDown:!1,prevClickPoint:null}});xt(this,o,e),xt(this,n,t),St(this,s,r).call(this)}onEvents(){if(mt(this,a))return;const t=window;t.addEventListener("mousemove",mt(this,v)),t.addEventListener("mousedown",mt(this,w)),t.addEventListener("mousemove",mt(this,u)),t.addEventListener("mouseup",mt(this,d)),t.addEventListener("mouseleave",mt(this,f)),t.addEventListener("wheel",mt(this,l),{passive:!1}),t.addEventListener("click",mt(this,c)),t.addEventListener("contextmenu",mt(this,h))}offEvents(){const t=window;t.removeEventListener("mousemove",mt(this,v)),t.removeEventListener("mousedown",mt(this,w)),t.removeEventListener("mousemove",mt(this,u)),t.removeEventListener("mouseup",mt(this,d)),t.removeEventListener("mouseleave",mt(this,f)),t.removeEventListener("wheel",mt(this,l)),t.removeEventListener("click",mt(this,c)),t.removeEventListener("contextmenu",mt(this,h))}destroy(){this.offEvents(),mt(this,o).destroy(),xt(this,a,!0)}}n=new WeakMap,o=new WeakMap,a=new WeakMap,s=new WeakSet,r=function(){this.onEvents()},l=new WeakMap,h=new WeakMap,c=new WeakMap,f=new WeakMap,d=new WeakMap,u=new WeakMap,w=new WeakMap,v=new WeakMap,g=new WeakSet,p=function(t){return t.target===mt(this,n).boardContent.boardContext.canvas},y=new WeakSet,m=function(t){const e=mt(this,n).boardContent.boardContext.canvas.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top,t:Date.now()}},b=new WeakSet,x=function(t){const e=mt(this,n).sharer.getActiveViewSizeInfo(),{width:i,height:o}=e;return!!(ni(t.x)&&ni(t.y)&&t.x<=i&&t.y<=o)};const ai={width:0,height:0,devicePixelRatio:1,contextWidth:0,contextHeight:0,data:null,scale:1,offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0};class si{constructor(){bt(this,S,void 0),bt(this,I,void 0);const t=new Jt({defaultStorage:ai}),e=new Jt({defaultStorage:{}});xt(this,S,t),xt(this,I,e)}getActiveStorage(t){return mt(this,S).get(t)}setActiveStorage(t,e){return mt(this,S).set(t,e)}getActiveStoreSnapshot(t){return mt(this,S).getSnapshot(t)}getSharedStorage(t){return mt(this,I).get(t)}setSharedStorage(t,e){return mt(this,I).set(t,e)}getSharedStoreSnapshot(t){return mt(this,I).getSnapshot(t)}getActiveViewScaleInfo(){return{scale:mt(this,S).get("scale"),offsetTop:mt(this,S).get("offsetTop"),offsetBottom:mt(this,S).get("offsetBottom"),offsetLeft:mt(this,S).get("offsetLeft"),offsetRight:mt(this,S).get("offsetRight")}}setActiveViewScaleInfo(t){const{scale:e,offsetTop:i,offsetBottom:n,offsetLeft:o,offsetRight:a}=t;mt(this,S).set("scale",e),mt(this,S).set("offsetTop",i),mt(this,S).set("offsetBottom",n),mt(this,S).set("offsetLeft",o),mt(this,S).set("offsetRight",a)}setActiveViewSizeInfo(t){mt(this,S).set("width",t.width),mt(this,S).set("height",t.height),mt(this,S).set("devicePixelRatio",t.devicePixelRatio),mt(this,S).set("contextWidth",t.contextWidth),mt(this,S).set("contextHeight",t.contextHeight)}getActiveViewSizeInfo(){return{width:mt(this,S).get("width"),height:mt(this,S).get("height"),devicePixelRatio:mt(this,S).get("devicePixelRatio"),contextWidth:mt(this,S).get("contextWidth"),contextHeight:mt(this,S).get("contextHeight")}}}S=new WeakMap,I=new WeakMap;const{requestAnimationFrame:ri}=window;class li extends Ft{constructor(t){super(),bt(this,P),bt(this,k),bt(this,M,void 0),bt(this,z,[]),bt(this,C,"FREE"),xt(this,M,t),St(this,P,W).call(this)}resetViewVisibleInfoMap(t,e){t&&mt(this,M).calculator.resetViewVisibleInfoMap(t,e)}drawFrame(){const{sharer:t}=mt(this,M),e=t.getActiveStoreSnapshot(),i=t.getSharedStoreSnapshot();mt(this,z).push({activeStore:e,sharedStore:i}),St(this,k,E).call(this)}scale(t){const{scale:e,point:i,ignoreUpdateVisibleStatus:n}=t,{sharer:o}=mt(this,M),{moveX:a,moveY:s}=function(t){const{scale:e,point:i,viewScaleInfo:n}=t,{offsetLeft:o,offsetTop:a}=n,s=e/n.scale,r=i.x,l=i.y;return{moveX:r-r*s+(o*s-o),moveY:l-l*s+(a*s-a)}}({scale:e,point:i,viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()});return o.setActiveStorage("scale",e),n||mt(this,M).calculator.updateVisiableStatus({viewScaleInfo:o.getActiveViewScaleInfo(),viewSizeInfo:o.getActiveViewSizeInfo()}),{moveX:a,moveY:s}}scroll(t){const{sharer:e}=mt(this,M),i=e.getActiveViewScaleInfo(),{moveX:n,moveY:o,ignoreUpdateVisibleStatus:a}=t,s=function(t){const{moveX:e=0,moveY:i=0,viewScaleInfo:n,viewSizeInfo:o}=t,{scale:a}=n,{width:s,height:r,contextWidth:l,contextHeight:h}=o;let c=n.offsetLeft,f=n.offsetRight,d=n.offsetTop,u=n.offsetBottom;return c+=e,d+=i,f=s-(l*a+c),u=r-(h*a+d),{scale:a,offsetTop:d,offsetLeft:c,offsetRight:f,offsetBottom:u}}({moveX:n,moveY:o,viewScaleInfo:i,viewSizeInfo:e.getActiveViewSizeInfo()});return e.setActiveViewScaleInfo(s),a||mt(this,M).calculator.updateVisiableStatus({viewScaleInfo:e.getActiveViewScaleInfo(),viewSizeInfo:e.getActiveViewSizeInfo()}),s}updateViewScaleInfo(t){const{sharer:e}=mt(this,M),i=function(t,e){const{scale:i,offsetX:n,offsetY:o}=t,{viewSizeInfo:a}=e,{width:s,height:r,contextWidth:l,contextHeight:h}=a,c=0-n*i,f=0-o*i;return{scale:i,offsetLeft:c,offsetTop:f,offsetRight:s-(l*i+c/i),offsetBottom:r-(h*i+f/i)}}(t,{viewSizeInfo:e.getActiveViewSizeInfo()});return e.setActiveViewScaleInfo(i),mt(this,M).calculator.updateVisiableStatus({viewScaleInfo:e.getActiveViewScaleInfo(),viewSizeInfo:e.getActiveViewSizeInfo()}),i}resize(t={},e){const{sharer:i}=mt(this,M),n={...i.getActiveViewSizeInfo(),...t},{width:o,height:a,devicePixelRatio:s}=n,{underContext:r,boardContext:l,helperContext:h,viewContext:c}=mt(this,M).boardContent;return l.canvas.width=o*s,l.canvas.height=a*s,l.canvas.style.width=`${o}px`,l.canvas.style.height=`${a}px`,r.canvas.width=o*s,r.canvas.height=a*s,h.canvas.width=o*s,h.canvas.height=a*s,c.canvas.width=o*s,c.canvas.height=a*s,i.setActiveViewSizeInfo(n),(null==e?void 0:e.ignoreUpdateVisibleStatus)||mt(this,M).calculator.updateVisiableStatus({viewScaleInfo:i.getActiveViewScaleInfo(),viewSizeInfo:i.getActiveViewSizeInfo()}),n}}M=new WeakMap,z=new WeakMap,C=new WeakMap,P=new WeakSet,W=function(){const{renderer:t}=mt(this,M);t.on("load",(()=>{this.drawFrame()}))},k=new WeakSet,E=function(){if("DRAWING"===mt(this,C)||0===mt(this,z).length)return;xt(this,C,"DRAWING");const t=mt(this,z).shift(),{renderer:e,boardContent:i,beforeDrawFrame:n,afterDrawFrame:o}=mt(this,M);if(t){const{scale:a,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h,width:c,height:f,contextHeight:d,contextWidth:u,devicePixelRatio:w}=t.activeStore,v={scale:a,offsetTop:s,offsetBottom:r,offsetLeft:l,offsetRight:h},g={width:c,height:f,contextHeight:d,contextWidth:u,devicePixelRatio:w};(null==t?void 0:t.activeStore.data)&&e.drawData(t.activeStore.data,{viewScaleInfo:v,viewSizeInfo:g}),n({snapshot:t}),i.drawView(),o({snapshot:t})}0!==mt(this,z).length?xt(this,C,"DRAWING")&&ri((()=>{St(this,k,E).call(this)})):xt(this,C,"COMPLETE")};return O=new WeakMap,A=new WeakMap,R=new WeakMap,T=new WeakMap,L=new WeakMap,V=new WeakMap,j=new WeakMap,D=new WeakMap,$=new WeakMap,B=new WeakMap,X=new WeakMap,Y=new WeakSet,F=function(){mt(this,L).on("pointStart",St(this,H,U).bind(this)),mt(this,L).on("pointEnd",St(this,G,N).bind(this)),mt(this,L).on("pointMove",St(this,Q,q).bind(this)),mt(this,L).on("hover",St(this,K,J).bind(this)),mt(this,L).on("wheel",St(this,tt,et).bind(this)),mt(this,L).on("wheelScale",St(this,it,nt).bind(this)),mt(this,L).on("scrollX",St(this,ot,at).bind(this)),mt(this,L).on("scrollY",St(this,st,rt).bind(this)),mt(this,L).on("resize",St(this,lt,ht).bind(this)),mt(this,L).on("doubleClick",St(this,Z,_).bind(this)),mt(this,V).on("load",(()=>{mt(this,B).trigger("loadResource")}))},H=new WeakSet,U=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointStart)?void 0:e.call(n,t)))return}},G=new WeakSet,N=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointEnd)?void 0:e.call(n,t)))return}},Q=new WeakSet,q=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.pointMove)?void 0:e.call(n,t)))return}},K=new WeakSet,J=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.hover)?void 0:e.call(n,t)))return}},Z=new WeakSet,_=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.doubleClick)?void 0:e.call(n,t)))return}},tt=new WeakSet,et=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.wheel)?void 0:e.call(n,t)))return}},it=new WeakSet,nt=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.wheelScale)?void 0:e.call(n,t)))return}},ot=new WeakSet,at=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.scrollX)?void 0:e.call(n,t)))return}},st=new WeakSet,rt=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.scrollY)?void 0:e.call(n,t)))return}},lt=new WeakSet,ht=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.resize)?void 0:e.call(n,t)))return}},ct=new WeakSet,ft=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.clear)?void 0:e.call(n,t)))return}},dt=new WeakSet,ut=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.beforeDrawFrame)?void 0:e.call(n,t)))return}},wt=new WeakSet,vt=function(t){var e;for(let i=0;i<mt(this,T).length;i++){const n=mt(this,T)[i];if(!1===(null==(e=null==n?void 0:n.afterDrawFrame)?void 0:e.call(n,t)))return}},gt=new WeakSet,pt=function(){const t=[],e=mt(this,A);mt(this,R).forEach((i=>{const n=e.get(i);"enable"===(null==n?void 0:n.status)&&(null==n?void 0:n.middlewareObject)&&t.push(n.middlewareObject)})),xt(this,T,t)},t.Board=class{constructor(t){bt(this,Y),bt(this,H),bt(this,G),bt(this,Q),bt(this,K),bt(this,Z),bt(this,tt),bt(this,it),bt(this,ot),bt(this,st),bt(this,lt),bt(this,ct),bt(this,dt),bt(this,wt),bt(this,gt),bt(this,O,void 0),bt(this,A,new WeakMap),bt(this,R,[]),bt(this,T,[]),bt(this,L,void 0),bt(this,V,void 0),bt(this,j,void 0),bt(this,D,void 0),bt(this,$,void 0),bt(this,B,new Ft),bt(this,X,!1);const{boardContent:e}=t,i=new si,n=new ii({viewContext:e.viewContext}),o=new oi({boardContent:e,sharer:i}),a=new ei({viewContext:e.viewContext,sharer:i,calculator:n});xt(this,O,t),xt(this,j,i),xt(this,L,o),xt(this,V,a),xt(this,$,n),xt(this,D,new li({boardContent:t.boardContent,sharer:i,renderer:a,calculator:mt(this,$),beforeDrawFrame:t=>{St(this,dt,ut).call(this,t)},afterDrawFrame:t=>{St(this,wt,vt).call(this,t)}})),St(this,Y,F).call(this),St(this,gt,pt).call(this)}isDestroyed(){return mt(this,X)}destroy(){mt(this,L).destroy(),mt(this,V).destroy(),mt(this,$).destroy(),mt(this,B).destroy(),xt(this,X,!0)}getSharer(){return mt(this,j)}getViewer(){return mt(this,D)}getRenderer(){return mt(this,V)}setData(t,e){const{modifiedOptions:i}=e||{},n=mt(this,j);mt(this,j).setActiveStorage("data",t);const o=n.getActiveViewSizeInfo(),a=n.getActiveViewScaleInfo(),s=function(t,e){const i={x:0,y:0,w:0,h:0};t.forEach((t=>{const e={x:t.x,y:t.y,w:t.w,h:t.h,angle:t.angle};if(e.angle&&(e.angle>0||e.angle<0)){const t=oe(e);if(4===t.length){const i=[t[0].x,t[1].x,t[2].x,t[3].x],n=[t[0].y,t[1].y,t[2].y,t[3].y];e.x=Math.min(...i),e.y=Math.min(...n),e.w=Math.abs(Math.max(...i)-Math.min(...i)),e.h=Math.abs(Math.max(...n)-Math.min(...n))}}const n=Math.min(e.x,i.x),o=Math.min(e.y,i.y),a=Math.max(e.x+e.w,i.x+i.w),s=Math.max(e.y+e.h,i.y+i.h);i.x=n,i.y=o,i.w=Math.abs(a-n),i.h=Math.abs(s-o)})),(null==e?void 0:e.extend)&&(i.x=Math.min(i.x,0),i.y=Math.min(i.y,0));const n={contextWidth:i.w,contextHeight:i.h};return(null==e?void 0:e.viewWidth)&&(null==e?void 0:e.viewHeight)&&(null==e?void 0:e.viewWidth)>0&&(null==e?void 0:e.viewHeight)>0&&(e.viewWidth>i.x+i.w&&(n.contextWidth=e.viewWidth-i.x),e.viewHeight>i.y+i.h&&(n.contextHeight=e.viewHeight-i.y)),n}(t.elements,{viewWidth:o.width,viewHeight:o.height,extend:!0});mt(this,D).resetViewVisibleInfoMap(t,{viewSizeInfo:o,viewScaleInfo:a}),mt(this,D).drawFrame();const r={...o,...s};return mt(this,j).setActiveViewSizeInfo(r),{viewSizeInfo:r}}getData(){const{data:t}=mt(this,j).getActiveStoreSnapshot();return t}use(t){var e,i,n;if(mt(this,A).has(t)){const n=mt(this,A).get(t);if(n)return null==(i=(e=n.middlewareObject).use)||i.call(e),n.status="enable",mt(this,A).set(t,n),void St(this,gt,pt).call(this)}const{boardContent:o,container:a}=mt(this,O),s=t({boardContent:o,sharer:mt(this,j),viewer:mt(this,D),calculator:mt(this,$),eventHub:mt(this,B),container:a});null==(n=s.use)||n.call(s),mt(this,R).push(t),mt(this,T).push(s),mt(this,A).set(t,{status:"enable",middlewareObject:s}),St(this,gt,pt).call(this)}disuse(t){var e,i;const n=mt(this,A).get(t);n&&(null==(i=(e=n.middlewareObject).disuse)||i.call(e),n.status="disable",mt(this,A).set(t,n),St(this,gt,pt).call(this))}scale(t){const e=mt(this,D),{ignoreUpdateVisibleStatus:i}=t,{moveX:n,moveY:o}=e.scale({...t,ignoreUpdateVisibleStatus:!0});e.scroll({moveX:n,moveY:o,ignoreUpdateVisibleStatus:i})}scroll(t){return mt(this,D).scroll(t)}updateViewScaleInfo(t){return mt(this,D).updateViewScaleInfo(t)}resize(t,e){const i=mt(this,D).resize(t,e),{width:n,height:o,devicePixelRatio:a}=t,{boardContent:s}=mt(this,O);s.viewContext.$resize({width:n,height:o,devicePixelRatio:a}),s.helperContext.$resize({width:n,height:o,devicePixelRatio:a}),s.boardContext.$resize({width:n,height:o,devicePixelRatio:a}),s.underContext.$resize({width:n,height:o,devicePixelRatio:a}),mt(this,D).drawFrame(),mt(this,L).trigger("resize",i),mt(this,j).setActiveViewSizeInfo(t)}clear(){const{boardContent:t}=mt(this,O),{underContext:e,helperContext:i,viewContext:n,boardContext:o}=t;e.clearRect(0,0,e.canvas.width,e.canvas.height),i.clearRect(0,0,i.canvas.width,i.canvas.height),n.clearRect(0,0,n.canvas.width,n.canvas.height),o.clearRect(0,0,o.canvas.width,o.canvas.height),St(this,ct,ft).call(this)}getEventHub(){return mt(this,B)}onWatcherEvents(){mt(this,L).onEvents()}offWatcherEvents(){mt(this,L).offEvents()}},t.Calculator=ii,t.Sharer=si,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({}); |
{ | ||
"name": "@idraw/board", | ||
"version": "0.4.0-beta.21", | ||
"version": "0.4.0-beta.22", | ||
"description": "", | ||
@@ -24,8 +24,8 @@ "main": "dist/esm/index.js", | ||
"devDependencies": { | ||
"@idraw/types": "^0.4.0-beta.21" | ||
"@idraw/types": "^0.4.0-beta.22" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
"@idraw/util": "^0.4.0-beta.21", | ||
"@idraw/renderer": "^0.4.0-beta.21" | ||
"@idraw/util": "^0.4.0-beta.22", | ||
"@idraw/renderer": "^0.4.0-beta.22" | ||
}, | ||
@@ -32,0 +32,0 @@ "publishConfig": { |
Sorry, the diff of this file is too big to display
250404
4442