var nx=Object.defineProperty;var rx=(e,t,i)=>t in e?nx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var W=(e,t,i)=>(rx(e,typeof t!="symbol"?t+"":t,i),i);import{P as Be}from"./index.6f926b61.js";function Oa(e,t){const i=t||new Path2D;if(e.name==="combine"&&!e.draw)return i instanceof Path2D?i:void 0;e.setTheme||(e.setTheme=ox);let a=e.calculative.borderRadius||0,s=a;const{x:n,y:r,width:l,height:o,ex:u,ey:c}=e.calculative.worldRect;a<1&&(a=l*a,s=o*s);let f=at.x-i&&e.xt.y-i&&e.y0&&a>0?s=180-s:i<0&&a>0?s+=180:i<0&&a<0&&(s=360-s),s}function Qr(e,t){const i=e.x-t.x,a=e.y-t.y;return Math.sqrt(i*i+a*a)}function mx(e,t){let i=It.None;if(!t)return i;const a=e.x-t.x,s=e.y-t.y;return Math.abs(a)>Math.abs(s)?a>0?i=It.Right:i=It.Left:s>0?i=It.Bottom:i=It.Up,i}function nn(e,t,i){!e||(e.x+=t,e.y+=i,e.next&&(e.next.x+=t,e.next.y+=i),e.prev&&(e.prev.x+=t,e.prev.y+=i))}function df(e,t){return e.anchorId===t.anchorId&&e.connectTo===t.connectTo}function mr(e,t,i){let a=Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))/i.data.scale;t.rotate===0?e.x>>0,1)},emit:function(t,i){(e.get(t)||[]).slice().map(function(a){a(i)}),(e.get("*")||[]).slice().map(function(a){a(t,i)})}}}var Ba;(function(e){e[e.None=-1]="None",e[e.Document=0]="Document",e[e.Canvas=1]="Canvas"})(Ba||(Ba={}));const Ox={fontFamily:'"Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial',fontSize:12,lineHeight:1.5,textAlign:"center",textBaseline:"middle",color:"#222222",activeColor:"#278df8",hoverColor:"rgba(39,141,248,0.50)",anchorColor:"#278DF8",hoverAnchorColor:"#FF4101",anchorRadius:4,anchorBackground:"#fff",dockColor:"rgba(39,141,248,0.50)",dockPenColor:"#1890FF",dragColor:"#1890ff",rotateCursor:"rotate.cur",rightCursor:"right.cur",downCursor:"down.cur",hoverCursor:"pointer",minScale:.1,maxScale:10,keydown:Ba.Document,gridSize:20,gridColor:"#e2e2e2",ruleColor:"#888888",drawingLineName:"curve",interval:30,animateInterval:30,autoPolyline:!0,autoAnchor:!0,autoAlignGrid:!1,animateColor:"#30EEDC",ruleLineColor:"#FF4101",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:64,shadowColor:"#00000014",globalAlpha:1,defaultAnchors:[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}],measureTextWidth:!0,moveConnectedLine:!0,mouseRightActive:!0,disableClipboard:!1,drawingLineLength:0,disableTouchPadScale:!1,cdn:"",polylineSpace:10,domShapes:[],containerShapes:["tablePlus"],textFlip:!0,textRotate:!0,unavailableKeys:[],diagramOptions:{},svgPathStroke:!0,reconnetTimes:10},Nx=["color","hoverColor","activeColor","disabledColor","background","activeBackground","hoverBackground","disabledBackground","anchorColor","hoverAnchorColor","anchorBackground","animateColor","textColor","ruleColor","ruleLineColor","gridColor","lineColor","penBackground","dockPenColor"],zx={dark:{color:"#bdc7db",background:"#1e2430",parentBackground:"#080b0f",ruleColor:"#222E47",ruleOptions:{background:"#121924",textColor:"#6E7B91"}},light:{color:"#222222",background:"#FFFFFF",parentBackground:"#F0F1F2",ruleColor:"#C8D0E1",ruleOptions:{background:"#F7F8FA",textColor:"#C8D0E1"}}},Qs={cssRuleSelector:":root",style_prefix:"le5le_",vendor_css_prefix:"--le-",dark:["textColor-9: rgba(255,255,255,0.90)","textColor-6: rgba(255,255,255,0.60)","textColor-1: rgba(255,255,255,1)","textColor-4: rgba(255,255,255,0.40)","textPrimaryColor: #7f838c","textSecondColor: rgba(255,255,255,0.90)","textDisabledColor: rgba(255,255,255,0.40)","textActiveColor: #0052d9","buttonBg: #4583ff","buttonDisabledBg: #0057CC","buttonDisabledColor: #FFFFFF26","buttonGradient: linear-gradient(360deg,#4583ff, #33ccff)","containerBg: rgba(21,24,28,0.95)","tabBg: #303746","tabActiveBg: #4583ff","tabDisabledBg: #282e3b","tabDisabledColor: rgba(255,255,255,0.26)","tabActiveColor: rgba(255,255,255,0.90)","formBg: #2a2f36","datePickerCellActiveRangeBg: #2c4475","componentDisabledBg: #282e3b","dataPickerCellActiveBg: #001b52","activeBg: #25375b","popContentBg: #252b37","disabledBg: #7f838c","disabledBg-2: #282E3B","tableStripeColor: rgba(150,192,255,0.10)","tableMenuBg: #303746","tableMenuDividerBg: rgb(76 81 94)","tableMenuHandleBg: #454f64","tableMenuColor: #bdc7db","tableMenuBorderColor: transparent","tableColRowBg: #303746","tableColRowActiveBg: #4A5263","tableColRowColor: rgba(255,255,255,0.6)","paginationColor: rgba(255,255,255,0.6)","paginationActiveColor: #4583ff","paginationActiveBg: rgba(69,131,255,0.20)","sliderBg: #303746","sliderBtnBg: #000000","notificationBorderColor: transparent","notificationBg: #282e3b","borderColor: #424b61","borderOutsideColor: #4583ff","formBorderColor: #424b61","borderInsideColor: rgba(255,255,255,0.40)","shadow: 0px 1px 10px 0px rgba(0,0,0,0.05), 0px 4px 5px 0px rgba(0,0,0,0.08), 0px 2px 4px -1px rgba(0,0,0,0.12)","radius: 4px"],light:["textColor-9: rgba(0,0,0,0.90)","textColor-6: rgba(0,0,0,0.60)","textColor-1: rgba(0,0,0,1)","textColor-4: rgba(0,0,0,0.40)","textPrimaryColor: #7f838c","textSecondColor: #171B27","textDisabledColor: rgba(0, 0, 0, 0.6)","textActiveColor: #0052d9","buttonBg: #4583ff","buttonDisabledBg: #b5c7ff","buttonDisabledColor: #FFFFFF","buttonGradient: linear-gradient(360deg,#4583ff, #33ccff)","containerBg: #ffffff","tabBg: #f1f2f5","tabActiveBg: #4583ff","tabDisabledBg: #e2e6ea","tabDisabledColor: rgba(0,0,0,0.26)","tabActiveColor: #ffffff","formBg: #EFF1F4","datePickerCellActiveRangeBg: #f2f3ff","componentDisabledBg: #eee","dataPickerCellActiveBg: #edefff","activeBg: #f2f3ff","popContentBg: #ffffff","disabledBg: #7f838c","disabledBg-2: #E2E6EA","tableStripeColor: #f1f2f5","tableMenuBg: #ffffff","tableMenuDividerBg: #e2e6ea","tableMenuHandleBg: #ebedf1","tableMenuColor: rgba(0,0,0,0.60)","tableMenuBorderColor: #e2e6ea","tableColRowBg: #ebedf1","tableColRowActiveBg: #bcc4d0","tableColRowColor: rgba(0,0,0,0.4)","paginationColor: rgba(0,0,0,0.6)","paginationActiveColor: #ffffff","paginationActiveBg: #4583ff","sliderBg: #e2e6ea","sliderBtnBg: #ffffff","notificationBorderColor: transparent","notificationBg: #ffffff","borderColor: #d6dbe3","borderOutsideColor: #d6dbe3","formBorderColor: #d4d6d9","borderInsideColor: #e7e7e7","shadow: 0px 2px 4px 0px rgba(107,113,121,0.25)","radius: 4px"],camelCaseToHyphenated(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())},_addVendorCssPrefix(e){return e.map(t=>{const[i,a]=t.split(":");return`${this.vendor_css_prefix}${this.camelCaseToHyphenated(i.trim())}:${a.trim()}`})},createThemeSheet(e,t){const i=document.createElement("style");i.type="text/css",i.id=this.style_prefix+t,document.head.appendChild(i);const a=e||"dark",s=this.getTheme(a),n=`${this.cssRuleSelector} { ${s.join(";")} }`;i.innerHTML=n},destroyThemeSheet(e){const t=this.findStyleSheet(this.style_prefix+e);t&&document.head.removeChild(t.ownerNode)},addTheme(e,t){Object.assign(this,{[e]:t})},getTheme(e){return this._addVendorCssPrefix(this[e]||this.light)},getThemeObj(e="dark"){const t=":";return this[e].reduce((a,s)=>{const[n,r]=s.split(t);return a[n]=r,a},{})},findStyleSheet(e){const t=document.styleSheets;for(let i=0;il.selectorText===this.cssRuleSelector);if(r){const l=a.join(";");r.style.cssText+=`; ${l}`}else s.addRule(this.cssRuleSelector,a.join(";"))}}};var bt;(function(e){e[e.Add=0]="Add",e[e.Update=1]="Update",e[e.Delete=2]="Delete",e[e.Replace=3]="Replace"})(bt||(bt={}));const Hx=()=>({data:{x:0,y:0,scale:1,pens:[],origin:{x:0,y:0},center:{x:0,y:0},paths:{}},histories:[],pens:{},path2dMap:new WeakMap,animateMap:new WeakMap,active:[],animates:new Set,options:{...Ox},theme:{...zx},emitter:Mx(),bindDatas:{},bind:{},pensNetwork:{},cacheDatas:[],messageEvents:{},templatePens:{},globalTriggers:{}}),Wx=(e="default")=>(Et[e]||(Et[e]=Hx(),Et[e].id=e),Et[e]),Ux=(e,t)=>{const i=e.data.template===t;if(i)for(const a of e.data.pens)a.canvasLayer===zt.CanvasTemplate&&(e.templatePens[a.id]=a);e.lastScale=e.data.scale,e.data={x:0,y:0,scale:1,pens:[],origin:{x:0,y:0},center:{x:0,y:0},paths:{},template:i?t:null,lineAnimateDraws:{}},e.sameTemplate=i,e.pens={},e.histories=[],e.historyIndex=null,e.path2dMap=new WeakMap,e.animateMap=new WeakMap,e.bindDatas={},e.bind={},e.pensNetwork={},e.active=[],e.hover=void 0,e.lastHover=void 0,e.animates.clear()};function Fi(e){const{paddingTop:t,paddingBottom:i,paddingLeft:a,paddingRight:s,worldRect:n,canvas:r}=e.calculative;let{textLeft:l,textTop:o,textWidth:u,textHeight:c}=e.calculative,f=a,g=t;const v=n.width-a-s,m=n.height-t-i;u&&u<1&&(u*=n.width),c&&c<1&&(c*=n.height),u1?r:1;switch(e.whiteSpace){case"nowrap":if(e.ellipsis!==!1){const c=gf(t.split(""),e);c[0]&&(a.push(c[0]),c.length>1&&Rl(a))}else a.push(t);break;case"pre-line":a=t.split(/[\n]/g),e.ellipsis!==!1&&a.length>l&&(a=a.slice(0,l),Rl(a));break;case"break-all":default:const o=t.split(/[\n]/g);let u=0;t:for(const c of o){const f=e.whiteSpace==="break-all"?c.split(""):Wd(c);let g=gf(f,e);if(g.length===0&&(g=[""]),e.ellipsis!=!1)for(const v of g)if(u++,u>l){Rl(a);break t}else a.push(v);else a.push(...g)}break}return e.calculative.textLines=a,a}function Wd(e=""){const t=[];let i="";for(let a=0;a126?(i&&(t.push(i),i=""),t.push(e[a])):i+=e[a]}return i&&t.push(i),t}function gf(e,t){const i=t.calculative.canvas,a=i.offscreen.getContext("2d"),{fontStyle:s,fontWeight:n,fontSize:r,fontFamily:l,lineHeight:o}=t.calculative;a.save();const u=[];let c=e[0]||"";for(let f=1;f{const s=e.measureText(a).width;t.calculative.textLineWidths.push(s),iu&&(u=c)}a.restore();let f=t.length*r*o;e.textAlign==="left"||(e.textAlign==="right"?e.x=e.x-(u-e.width):e.x=e.x-(u-e.width)/2),e.textBaseline==="top"||(e.textBaseline==="bottom"?e.y=e.y-(f-e.height):e.y=e.y-(f-e.height)/2),e.height=f+5,e.width=u+5,e.calculative.canvas.updatePenRect(e),e.calculative.canvas.calcActiveRect()}function ht(e,t=!1){if(Array.isArray(e)){const i=[];return e.forEach(a=>{i.push(ht(a,t))}),i}else if(typeof e=="object"){if(e===null)return null;if(e.constructor===RegExp)return e;const i={};for(const a in e)if(!(["canvas","lastFrame","socketFn"].includes(a)||e[a]instanceof HTMLImageElement||e[a]instanceof HTMLMediaElement)){{if(a==="calculative"&&!t)continue;if(a==="singleton"){t?i[a]={}:i[a]=e[a];continue}}i[a]=ht(e[a],t)}return i}return e}function Xl(e,t,i){if(Array.isArray(e)){const a=[];return e.forEach(s=>{a.push(Xl(s,t,i))}),a}else if(typeof e=="object"){if(e===null)return null;for(const a in e)if(t.includes(a))if(Array.isArray(e[a]))e[a].forEach((s,n)=>{Number.isNaN(Number(s))||(e[a][n]=Number(s*i))});else{if(Number.isNaN(Number(e[a])))continue;e[a]=Number(e[a])*i}else e[a]=Xl(e[a],t,i);return e}return e}const je={};function Ud(e,t,i){if(!je[t.fromArrow])return;const a=le(t),{x:s,y:n}=a,r={x:s,y:n};if(r.step=(t.fromArrowSize||10)*i.data.scale,a.next)r.rotate=ui(a.next,a)+90;else{const o=t.calculative.worldAnchors[1];if(!o)return;o.prev?r.rotate=ui(o.prev,a)+90:r.rotate=ui(o,a)+90}e.save(),e.beginPath(),e.setLineDash([]);const l=t.fromArrowColor||t.calculative.color;l&&(e.strokeStyle=l),je[t.fromArrow](e,t,i,r),e.restore()}function Vd(e,t,i){if(!je[t.toArrow]||t.calculative.worldAnchors.length<2)return;e.save();const a=Vt(t),{x:s,y:n}=a,r={x:s,y:n};if(r.step=(t.toArrowSize||10)*i.data.scale,a.prev)r.rotate=ui(a.prev,a)+90;else{const o=t.calculative.worldAnchors[t.calculative.worldAnchors.length-2];o.next?r.rotate=ui(o.next,a)+90:r.rotate=ui(o,a)+90}e.beginPath(),e.setLineDash([]);const l=t.toArrowColor||t.calculative.color;l&&(e.strokeStyle=l),je[t.toArrow](e,t,i,r),e.restore()}je.triangleSolid=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.x-a.step;e.moveTo(s,a.y-a.step/4),e.lineTo(a.x,a.y),e.lineTo(s,a.y+a.step/4),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};je.reTriangleSolid=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.x-a.step/2;e.moveTo(a.x,a.y-a.step/2),e.lineTo(s,a.y),e.lineTo(a.x,a.y+a.step/2),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};je.triangle=(e,t,i,a)=>{e.save(),e.lineWidth<2&&(e.lineWidth=2),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.x-a.step;e.moveTo(s,a.y-a.step/4),e.lineTo(a.x,a.y),e.lineTo(s,a.y+a.step/4),e.closePath(),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};je.circleSolid=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.step/2;e.arc(a.x-s,a.y,s,0,2*Math.PI),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};je.circle=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.step/2;e.arc(a.x-s,a.y,s,0,2*Math.PI),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};je.diamondSolid=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.x-a.step,n=a.step/2;e.moveTo(s,a.y),e.lineTo(s+n,a.y-n/2),e.lineTo(a.x,a.y),e.lineTo(s+n,a.y+n/2),e.closePath(),e.stroke(),e.fillStyle=e.strokeStyle,e.fill(),e.restore()};je.diamond=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.x-a.step,n=a.step/2;e.moveTo(s,a.y),e.lineTo(s+n,a.y-n/2),e.lineTo(a.x,a.y),e.lineTo(s+n,a.y+n/2),e.closePath(),e.stroke(),e.fillStyle=i.data.background||"#ffffff",e.fill(),e.restore()};je.line=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.x-a.step;e.moveTo(s,a.y-a.step/3),e.lineTo(a.x,a.y),e.lineTo(s,a.y+a.step/3),e.stroke(),e.restore()};je.lineUp=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.x-a.step;e.moveTo(s,a.y-a.step/3),e.lineTo(a.x,a.y),e.stroke(),e.restore()};je.lineDown=(e,t,i,a)=>{e.save(),e.translate(a.x,a.y),e.rotate(a.rotate*Math.PI/180),e.translate(-a.x,-a.y);const s=a.x-a.step;e.moveTo(s,a.y+a.step/3),e.lineTo(a.x,a.y),e.stroke(),e.restore()};function Gl(e){const t=parseInt,i=Math.round;let a=e.length,s={};if(a>9){const[n,r,l,o]=e=e.split(",");if(a=e.length,a<3||a>4)return null;s.r=t(n[3]=="a"?n.slice(5):n.slice(4)),s.g=t(r),s.b=t(l),s.a=o?parseFloat(o):-1}else{if(a==8||a==6||a<4)return null;a<6&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+(a>4?e[4]+e[4]:"")),e=t(e.slice(1),16),a==9||a==5?(s.r=e>>24&255,s.g=e>>16&255,s.b=e>>8&255,s.a=i((e&255)/.255)/1e3):(s.r=e>>16,s.g=e>>8&255,s.b=e&255,s.a=-1)}return s}function ke(e,t,i,a){let s,n,r,l,o,u,c,f=Math.round,g=typeof i=="string";return typeof e!="number"||e<-1||e>1||typeof t!="string"||t[0]!="r"&&t[0]!="#"||i&&!g||(c=t.length>9,c=g?i.length>9?!0:i=="c"?!c:!1:c,o=Gl(t),l=e<0,u=i&&i!="c"?Gl(i):l?{r:0,g:0,b:0,a:-1}:{r:255,g:255,b:255,a:-1},e=l?e*-1:e,l=1-e,!o||!u)?null:(a?(s=f(l*o.r+e*u.r),n=f(l*o.g+e*u.g),r=f(l*o.b+e*u.b)):(s=f((l*o.r**2+e*u.r**2)**.5),n=f((l*o.g**2+e*u.g**2)**.5),r=f((l*o.b**2+e*u.b**2)**.5)),g=o.a,u=u.a,o=g>=0||u>=0,g=o?g<0?u:u<0?g:g*l+u*e:0,c?"rgb"+(o?"a(":"(")+s+","+n+","+r+(o?","+f(g*1e3)/1e3:"")+")":"#"+(4294967296+s*16777216+n*65536+r*256+(o?f(g*255):0)).toString(16).slice(1,o?void 0:-2))}globalThis.pSBC=ke;function Wr(e,t){const i=Gl(e)||{r:0,g:0,b:0};return i.a<0?`rgba(${i.r},${i.g},${i.b},${t})`:`rgba(${i.r},${i.g},${i.b},${t+i.a})`}function us(e,t){if(isNaN(e)){console.warn("realValue not number");return}if(typeof t!="string"){console.warn("collection must be string");return}const[i,a]=[t[0],t[t.length-1]];if(!["[","("].includes(i)){console.warn('collection must start with "[" or "("');return}if(!["]",")"].includes(a)){console.warn('collection must end with "]" or ")"');return}const s=t.substring(1,t.length-1).split(",");if(s.length!==2){console.warn("collection must have 2 numbers");return}const[n,r]=[+s[0],+s[1]];if(n>=r){console.warn("startNum must less than endNum");return}return e>n||i==="["&&e===n?e=u){console.warn("startNum must less than endNum");return}if(e>=o&&e<=u)return!0}else if(e==n)return!0;return!1}function jx(e,t,i){const a=1-e;return 3*a*a*e*t+3*a*e*e*i+e*e*e}function St(){return((1+Math.random())*4294967296|0).toString(16).substring(1)}const qi=e=>{let t=0,i=0,a=0,s=0;return typeof e=="number"?t=i=a=s=e:typeof e=="string"?t=i=a=s=parseInt(e,10):Array.isArray(e)&&(t=e[0],a=Tl(e[1])?e[0]:e[1],s=Tl(e[2])?e[0]:e[2],i=Tl(e[3])?a:e[3]),[t,a,s,i]};function Tl(e){return e==null}async function qx(e){return new Promise((t,i)=>{const a=new FileReader;a.onload=s=>{t(s.target.result)},a.onerror=s=>{i(s)},a.readAsDataURL(e)})}async function Yx(e,t,i,a){const s=new FormData;if(s.append("file",e),i)for(const r in i)i.hasOwnProperty(r)&&s.append(r,i[r]);return(await(await fetch(t,{method:"POST",headers:a,body:s})).json()).url}function Kx(e,t,i){var a=document.createElement("link");a.href=e,a.rel="stylesheet",t&&(a.onload=t),i&&(a.onerror=i),document.head.appendChild(a)}function ws(e){let t=e||window.location.search.split("?")[1];const i=new URLSearchParams(t);return Object.fromEntries(i.entries())}function gn(e){let t;const i=new RegExp("(^| )"+e+"=([^;]*)(;|$)");return(t=document.cookie.match(i))?decodeURIComponent(t[2]):""}var Ur;(function(e){e[e.None=0]="None",e[e.LocalStorage=1]="LocalStorage",e[e.Cookie=2]="Cookie"})(Ur||(Ur={}));const Xx=location.host.indexOf("le5le.com")!==-1;function Sr(){var t;const e=(t=globalThis.le5leTokenName)!=null?t:"token";switch(globalThis.le5leTokenType){case Ur.LocalStorage:return localStorage.getItem(e);case Ur.Cookie:return gn(e);default:return Xx?gn(e):localStorage.getItem(e)}}async function $d(e,t){var o,u;if(globalThis.getMeta2dData)return await globalThis.getMeta2dData(t);const i=e.options.navigatorNetWork;let s=`/api/data/${location.href.includes("2d.")||location.href.includes("/2d")?"2d":"v"}/get`,n=((o=ws())==null?void 0:o.id)||s.includes("${id}");if(!n&&((u=ws())==null?void 0:u.data)){s=`./projects/${t}`;const f=new URL(window.location);f.searchParams.set("data",t),history.pushState({},"",f)}i!=null&&i.url&&(i.url.includes("${id}")?s=i.url.replace("${id}",t):s=i.url+((i==null?void 0:i.method)==="GET"?`?id=${t}`:""));let r=(i==null?void 0:i.method)||"POST";n||(r="GET");const l=await fetch(s,{headers:{Authorization:`Bearer ${Sr()}`},method:r,body:r==="GET"?void 0:JSON.stringify({id:t})});if(l.ok){let c=await l.text();return c.constructor===Object||c.constructor===Array?c=JSON.parse(JSON.stringify(c)):typeof c=="string"&&(c=JSON.parse(c)),c.data&&(c=c.data),c}else e.emitter.emit("error",{type:"http",error:l})}function ya(e,t){if(t==null)return e;const i=t.split(".");for(;i.length&&(e=e[i.shift()]););return e}function Vr(e,t,i){t!=null&&t.split(".").reduce((a,s,n)=>a[s]=t.split(".").length===++n?i:a[s]||{},e)}function Zl(e,t){const i=["\u5929","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"];let a=new Date;t&&(a=new Date(t));const s=a.getFullYear(),n=a.getMonth()+1,r=a.getDate(),l=a.getDay(),o=a.getHours(),u=a.getMinutes(),c=a.getSeconds();return new Function("year","month","day","week","hours","minutes","seconds",e?`return ${e}`:"return `${year}:${month}:${day} ${hours}:${minutes}:${seconds} \u661F\u671F${week}`")(s,n,r,i[l],o,u,c)}function Gx(e,t){if(!e||!t)return!1;let i=ti(e);for(;i;){if(i.id===t.id)return!0;i=ti(i)}return!1}function ti(e,t){if(!e||!e.parentId||!e.calculative)return;const a=e.calculative.canvas.store.pens[e.parentId];return t&&ti(a,t)||a}function Qe(e,t){if(!e||!e.children)return[];const i=[];return e.children.forEach(a=>{const s=t.pens[a];s&&(i.push(s),i.push(...Qe(s,t)))}),i}function mc(e,t){if(!e||!e.followers)return[];const i=[];return e.followers.forEach(a=>{const s=t.pens[a];s&&!s.parentId&&(i.push(s),i.push(...mc(s,t)))}),i}function Zx(e,t){const{worldRect:i,gradientFromColor:a,gradientToColor:s,gradientAngle:n}=t.calculative;return qd(e,i,a,s,n)}function Jx(e,t){const{worldRect:i,gradientFromColor:a,gradientToColor:s,gradientRadius:n}=t.calculative;if(!a||!s)return;const{width:r,height:l,center:o}=i,{x:u,y:c}=o;let f=r;f{v.addColorStop(m.i,m.color)}),v}function e2(e,t){const{x:i,y:a,ex:s,width:n,height:r,center:l}=t.calculative.worldRect;let o=[{x:s,y:a+r/2},{x:i,y:a+r/2}],u=t.calculative.gradientColors;t.calculative.checked&&(u=t.calculative.onGradientColors);const{angle:c,colors:f}=Ya(u);let g=yc(c,n,r);return o.forEach(v=>{Gt(v,c,l)}),to(e,o,f,g)}function i2(e,t){const{worldRect:i,textGradientColors:a}=t.calculative;if(!a)return;const{width:s,height:n,center:r}=i,{x:l,y:o}=r;let u=s;u{f.addColorStop(g.i,g.color)}),f}function a2(e,t){!t.calculative.textDrawRect&&vc(e,t),Qt(t.calculative.textDrawRect);const{x:i,y:a,ex:s,width:n,height:r,center:l}=t.calculative.textDrawRect;let o=[{x:s,y:a+r/2},{x:i,y:a+r/2}];const{angle:u,colors:c}=Ya(t.calculative.textGradientColors);let f=yc(u,n,r);return o.forEach(g=>{Gt(g,u,l)}),to(e,o,c,f)}function yc(e,t,i){const a=Math.atan(i/t)/Math.PI*180;let s=(e-90)%360,n=0;return s>a&&s<180-a||s>180+a&&s<360-a||s<0?(s>270?s=360-s:s>180?s=s-180:s>90&&(s=180-s),n=Math.abs(i/Math.sin(s/180*Math.PI)/2)):(s>270?s=360-s:s>180?s=s-180:s>90&&(s=180-s),n=Math.abs(t/Math.cos(s/180*Math.PI)/2)),n}function Ya(e){if(typeof e=="string"&&e.startsWith("linear-gradient")){let t=e.slice(16,-2).split("deg,");if(t.length>1){let i=t[1].split("%,");const a=[];return i.forEach(s=>{if(/rgba?/.test(s)){let n=s.split(") ");a.push({color:s2(n[0]+")"),i:parseFloat(n[1])/100})}else{let n=s.split(" ");n.length>2?a.push({color:n[1],i:parseFloat(n[2])/100}):a.push({color:n[0],i:parseFloat(n[1])/100})}}),{angle:parseFloat(t[0]),colors:a}}else return{angle:parseFloat(t[0]),colors:[]}}else return{angle:0,colors:[]}}function s2(e){if(/rgba?/.test(e)){let t=e.split(",");if(t.length<3)return"";e="#";for(let i=0,a;a=t[i++];)if(i<4)a=parseInt(a.replace(/[^\d]/gi,""),10).toString(16),e+=a.length==1?"0"+a:a;else{a=a.replace(")","");let n=parseInt(a*255+"").toString(16);n=n.length===2?n:"0"+n,e+=n}e=e.toUpperCase()}return e}function n2(e,t){const{x:i,y:a,ex:s,width:n,height:r,center:l}=t.calculative.worldRect;let o=[{x:s,y:a+r/2},{x:i,y:a+r/2}];const{angle:u,colors:c}=Ya(t.calculative.lineGradientColors);let f=yc(u,n,r);return o.forEach(g=>{Gt(g,u,l)}),to(e,o,c,f)}function to(e,t,i,a){let s=Qx(t[0].x,t[0].y,t[1].x,t[1].y,a),n=e.createLinearGradient(s[0],s[1],s[2],s[3]);return i.forEach(r=>{n.addColorStop(r.i,r.color)}),n}function ua(e,t,i){let a=[];t.calculative.gradientColorStop?a=t.calculative.gradientColorStop:(a=Ya(t.calculative.lineGradientColors).colors,t.calculative.gradientColorStop=a),e.strokeStyle=to(e,i,a,t.calculative.lineWidth/2),e.beginPath(),e.moveTo(i[0].x,i[0].y),e.lineTo(i[1].x,i[1].y),e.stroke()}function jd(e,t){const i=t.calculative.worldAnchors;let a=t.calculative.lineWidth*(t.calculative.gradientSmooth||t.calculative.lineSmooth||0);for(let s=0;s0){let l=i[s-1].curvePoints;l?yr(e,t,a,l[l.length-1],i[s],i[s].curvePoints[0]):yr(e,t,a,i[s-1],i[s],i[s].curvePoints[0]);let o=Ki(a,i[s],i[s].curvePoints[0]);ua(e,t,[o,i[s].curvePoints[1]])}else ua(e,t,[i[s],i[s].curvePoints[0]]),ua(e,t,[i[s].curvePoints[0],i[s].curvePoints[1]]);let n=i[s].curvePoints.length-1;for(let l=1;l0&&s0&&s0&&s0&&s{const V=t.calculative.textLineWidths[B];let Q=0;T==="center"?Q=(A-V)/2:T==="right"&&(Q=A-V),e.fillText(D,y+Q,_+(B+C)*I);const{textDecorationColor:F,textDecorationDash:R,textDecoration:P}=t;P&&f2(e,{x:y+Q,y:_+(B+C)*I,width:V},{textDecorationColor:F,textDecorationDash:R,fontSize:s});const{textStrickoutColor:M,textStrickoutDash:Y,textStrickout:Z}=t;Z&&d2(e,{x:y+Q,y:_+(B+C)*I,width:V},{textStrickoutColor:M,textStrickoutDash:Y,fontSize:s})}),e.restore()}function f2(e,t,i){const{textDecorationColor:a,textDecorationDash:s,fontSize:n}=i;let{x:r,y:l,width:o}=t;switch(e.textBaseline){case"top":l+=n;break;case"middle":l+=n/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(r,l),e.setLineDash(s||[]),e.lineTo(r+o,l),e.stroke(),e.restore()}function d2(e,t,i){const{textStrickoutColor:a,textStrickoutDash:s,fontSize:n}=i;let{x:r,y:l,width:o}=t;switch(e.textBaseline){case"top":l+=n/2;break;case"bottom":l-=n/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(r,l),e.setLineDash(s||[]),e.lineTo(r+o,l),e.stroke(),e.restore()}function Kd(e,t,i){if(i==null)return;const{fontStyle:a,fontWeight:s,fontSize:n,fontFamily:r,lineHeight:l,canvas:o}=t.calculative,u=o.store;e.save();let c;t.calculative.hover?c=t.hoverTextColor||t.hoverColor||u.styles.hoverColor:t.calculative.active&&(c=t.activeTextColor||t.activeColor||u.styles.activeColor),e.fillStyle=c||Ji(t,u),e.font=Le({fontStyle:a,fontWeight:s,fontFamily:r||u.options.fontFamily,fontSize:n,lineHeight:l});const f=e.measureText(i).width;let g,v;for(const m of t.calculative.worldAnchors){if(!v){v=m;continue}const w=Qr(v,m),y=Math.floor(w/f);g="";for(let A=0;A0?l=t.calculative.iconSize:a.width>a.height?l=a.height:l=a.width,e.font=Le({fontSize:l,fontWeight:r,fontFamily:o}),e.fillStyle=t.calculative.iconColor||Ji(t,i),t.calculative.iconRotate&&(e.translate(a.center.x,a.center.y),e.rotate(t.calculative.iconRotate*Math.PI/180),e.translate(-a.center.x,-a.center.y)),e.beginPath(),e.fillText(t.calculative.icon,s,n),e.restore()}function Gd(e,t){if(!t.input)return;const i=t.calculative.canvas.store.data.scale,a=t.calculative.canvas.inputDiv.dataset.penId,{x:s,y:n,width:r,height:l}=t.calculative.worldRect;e.save(),e.beginPath(),t.id===a?(e.moveTo(s+r-20*i,n+l/2+2*i),e.lineTo(s+r-14*i,n+l/2-4*i),e.lineTo(s+r-8*i,n+l/2+2*i)):(e.moveTo(s+r-20*i,n+l/2-4*i),e.lineTo(s+r-14*i,n+l/2+2*i),e.lineTo(s+r-8*i,n+l/2-4*i)),e.stroke(),e.restore()}function Le({fontStyle:e="normal",textDecoration:t="normal",fontWeight:i="normal",fontSize:a=12,fontFamily:s="Arial",lineHeight:n=1}={}){return`${e} ${t} ${i} ${a}px/${n} ${s}`}function za(e,t){const{x:i,ex:a,y:s,ey:n}=t.calculative.worldRect||{};t.calculative.flipX&&(e.translate(i+a,0),e.scale(-1,1)),t.calculative.flipY&&(e.translate(0,s+n),e.scale(1,-1))}function Gi(e,t,i=!1){const{x:a,y:s}=t.calculative.worldRect.pivot||t.calculative.worldRect.center;e.translate(a,s);let n=t.calculative.rotate*Math.PI/180;i||(t.calculative.flipX&&(n*=-1),t.calculative.flipY&&(n*=-1)),e.rotate(n),e.translate(-a,-s)}function Sa(e,t,i){e.save(),e.translate(.5,.5),e.beginPath(),L2(e,t);const a=t.calculative.canvas.store,s=t.textFlip||a.options.textFlip,n=t.textRotate||a.options.textRotate;(!s||!n)&&e.save(),za(e,t),t.calculative.rotate&&t.name!=="line"&&Gi(e,t),(t.calculative.lineWidth>1||i)&&(e.lineWidth=t.calculative.lineWidth),T2(e,a,t);let r,l=!1,o;t.calculative.disabled?(o=t.disabledColor||a.styles.disabledColor||ke(.4,t.calculative.color||a.styles.color),r=t.disabledBackground||a.styles.disabledBackground||ke(.4,t.calculative.background||a.styles.penBackground)):t.mouseDownValid&&t.calculative.mouseDown?(o=t.mouseDownColor||ke(-.4,t.calculative.color||a.styles.color),r=t.mouseDownBackground||ke(-.4,t.calculative.background||a.styles.penBackground)):t.switch&&t.calculative.checked?t.calculative.bkType||(r=t.onBackground):t.calculative.hover?(o=t.hoverColor||a.styles.hoverColor,r=t.hoverBackground||a.styles.hoverBackground):t.calculative.active?(o=t.activeColor||a.styles.activeColor,r=t.activeBackground||a.styles.activeBackground):t.calculative.isDock&&(t.type===$t.Line?o=a.styles.dockPenColor:r=Wr(a.styles.dockPenColor,.2));const u=t.calculative.strokeImg;if(t.calculative.strokeImage&&u)e.strokeStyle=o||e.createPattern(u,"repeat");else{let f;t.calculative.strokeType?t.calculative.lineGradientColors?t.name==="line"?l=!0:t.calculative.lineGradient?f=t.calculative.lineGradient:(f=n2(e,t),t.calculative.lineGradient=f):f=h2(e,t):f=t.calculative.color||(t.type?a.data.lineColor:"")||a.styles.color,e.strokeStyle=o||f}const c=t.calculative.backgroundImg;if(t.calculative.backgroundImage&&c)e.fillStyle=r||e.createPattern(c,"repeat"),r=!0;else{let f;t.calculative.bkType===Rs.Linear?t.calculative.gradientColors?t.calculative.gradient?f=t.calculative.gradient:(f=e2(e,t),t.calculative.gradient=f):f=Zx(e,t):t.calculative.bkType===Rs.Radial?t.calculative.gradientColors?t.calculative.radialGradient?f=t.calculative.radialGradient:(f=t2(e,t),t.calculative.radialGradient=f):f=Jx(e,t):f=t.calculative.background||a.styles.penBackground,e.fillStyle=r||f,r=!!f}if(Zd(e,t),Jd(e,t),Ha(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash.map(f=>f*t.calculative.canvas.store.data.scale)),t.calculative.lineDashOffset&&(e.lineDashOffset=t.calculative.lineDashOffset),t.calculative.shadowColor&&(e.shadowColor=t.calculative.shadowColor,e.shadowOffsetX=t.calculative.shadowOffsetX,e.shadowOffsetY=t.calculative.shadowOffsetY,e.shadowBlur=t.calculative.shadowBlur),l?(jd(e,t),tg(!0,e,t,a)):(Qd(!0,e,t,a,r),og(e,t)),!(t.image&&t.calculative.img)&&t.calculative.icon&&Xd(e,t),t.dropdownList&&Gd(e,t),(!s||!n)&&e.restore(),s&&!n&&za(e,t),!s&&n&&t.calculative.rotate&&t.name!=="line"&&Gi(e,t,!0),Yd(e,t),t.type===$t.Line&&t.fillTexts)for(const f of t.fillTexts)Kd(e,t,f);e.restore()}function Zd(e,t){const i=t.lineCap||(t.type?"round":"square");i?e.lineCap=i:t.type&&(e.lineCap="round")}function Jd(e,t){const i=t.lineJoin;i?e.lineJoin=i:t.type&&(e.lineJoin="round")}function $r(e,t,i,a){var u;e.save(),i&&e.translate(-i.x,-i.y),(u=e.setAttrs)==null||u.call(e,t);let s=!1;const n=t.calculative.canvas.store,r=t.textFlip||n.options.textFlip,l=t.textRotate||n.options.textRotate;e.beginPath(),(!r||!l)&&e.save(),t.calculative.flipX&&(e.translate(t.calculative.worldRect.x+t.calculative.worldRect.ex,0),e.scale(-1,1)),t.calculative.flipY&&(e.translate(0,t.calculative.worldRect.y+t.calculative.worldRect.ey),e.scale(1,-1)),t.calculative.rotate&&t.name!=="line"&&Gi(e,t),(t.calculative.lineWidth>1||a)&&(e.lineWidth=t.calculative.lineWidth);let o;if(t.calculative.hover)e.strokeStyle=t.hoverColor||n.styles.hoverColor,e.fillStyle=t.hoverBackground||n.styles.hoverBackground,o=t.hoverBackground||n.styles.hoverBackground;else if(t.calculative.active)e.strokeStyle=t.activeColor||n.styles.activeColor,e.fillStyle=t.activeBackground||n.styles.activeBackground,o=t.activeBackground||n.styles.activeBackground;else{if(t.strokeImage)t.calculative.strokeImg&&(e.strokeStyle=e.createPattern(t.calculative.strokeImg,"repeat"),o=!0);else{let c;t.calculative.strokeType&&t.calculative.lineGradientColors&&t.name==="line"?s=!0:c=t.calculative.color||n.styles.color,e.strokeStyle=c}t.backgroundImage?t.calculative.backgroundImg&&(e.fillStyle=e.createPattern(t.calculative.backgroundImg,"repeat"),o=!0):(e.fillStyle=t.background,o=!!t.background)}if(Zd(e,t),Jd(e,t),Ha(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash),t.calculative.lineDashOffset&&(e.lineDashOffset=t.calculative.lineDashOffset),t.calculative.shadowColor&&(e.shadowColor=t.calculative.shadowColor,e.shadowOffsetX=t.calculative.shadowOffsetX,e.shadowOffsetY=t.calculative.shadowOffsetY,e.shadowBlur=t.calculative.shadowBlur),s?(jd(e,t),tg(!0,e,t,n)):(Qd(!1,e,t,n,o),og(e,t)),t.calculative.img?(e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,Es(e,t),e.restore()):t.calculative.icon&&Xd(e,t),t.dropdownList&&Gd(e,t),(!r||!l)&&e.restore(),r&&!l&&(t.calculative.flipX&&(e.translate(t.calculative.worldRect.x+t.calculative.worldRect.ex,0),e.scale(-1,1)),t.calculative.flipY&&(e.translate(0,t.calculative.worldRect.y+t.calculative.worldRect.ey),e.scale(1,-1))),!r&&l&&t.calculative.rotate&&t.name!=="line"&&Gi(e,t,!0),Yd(e,t),t.type===$t.Line&&t.fillTexts)for(const c of t.fillTexts)Kd(e,t,c);e.restore()}function Qd(e=!0,t,i,a,s){if(i.name==="drawCommand")return;const n=e?a.path2dMap.get(i):Et.path2dDraws[i.name];let r=null,l=null;if(i.type===$t.Line&&(i.fromLineCap&&i.fromLineCap!=="butt"&&(t.lineCap="butt",r=new Path2D,r.moveTo(i.calculative.worldAnchors[0].x,i.calculative.worldAnchors[0].y),r.lineTo(i.calculative.worldAnchors[0].x,i.calculative.worldAnchors[0].y)),i.toLineCap&&i.toLineCap!=="butt"&&(t.lineCap="butt",l=new Path2D,l.moveTo(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].x,i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].y),l.lineTo(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].x,i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].y))),n){if(i.type===$t.Line&&i.borderWidth){t.save(),t.beginPath();const u=i.calculative.lineWidth+i.calculative.borderWidth;t.lineWidth=u,t.strokeStyle=i.borderColor,r&&(t.save(),t.lineCap=i.fromLineCap,t.stroke(r),t.restore()),n instanceof Path2D?(s&&t.fill(n),u&&t.stroke(n)):(n(i,t),s&&t.fill(),u&&t.stroke()),l&&(t.save(),t.lineCap=i.toLineCap,t.stroke(l),t.restore()),t.restore()}n instanceof Path2D?i.type?i.close&&s&&t.fill(n):s&&t.fill(n):(t.save(),n(i,t),s&&t.fill(),t.restore());const o=i.calculative.progress;if(o!=null){t.save();const{ex:u,x:c,y:f,width:g,height:v,ey:m}=i.calculative.worldRect;let w=null;if(i.calculative.verticalProgress?w=i.reverseProgress?t.createLinearGradient(c,f,c,f+v*o):t.createLinearGradient(c,m,c,f+v*(1-o)):w=i.reverseProgress?t.createLinearGradient(u,f,c+g*(1-o),f):t.createLinearGradient(c,f,c+g*o,f),i.calculative.progressGradientColors){const{colors:y}=Ya(i.calculative.progressGradientColors);y.forEach(_=>{w.addColorStop(_.i,_.color)})}else{const y=i.calculative.progressColor||i.calculative.color||a.options.activeColor||a.data.color;w.addColorStop(0,y),w.addColorStop(1,y)}w.addColorStop(1,"transparent"),t.fillStyle=w,n instanceof Path2D?t.fill(n):(n(i,t),t.fill()),t.restore()}if(i.calculative.lineWidth&&(n instanceof Path2D?(a.options.svgPathStroke||i.name!=="svgPath")&&(r&&(t.save(),t.lineCap=i.fromLineCap,t.stroke(r),t.restore()),t.stroke(n),l&&(t.save(),t.lineCap=i.toLineCap,t.stroke(l),t.restore())):(n(i,t),t.stroke())),i.type){if(i.calculative.animatePos){if(t.save(),eg(t,i,a),i.lineAnimateType===We.Arrow||i.lineAnimateType===We.WaterDrop){let u=gg(i,t);u instanceof Path2D?(t.stroke(u),t.fill(u)):(t.stroke(),t.fill())}else n instanceof Path2D?(r&&!i.lineAnimateType&&(t.save(),t.lineCap=i.fromLineCap,t.stroke(r),t.restore()),t.lineCap=i.lineCap,t.stroke(n)):(n(i,t),t.stroke());t.restore()}i.fromArrow&&Ud(t,i,a),i.toArrow&&Vd(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&ig(t,i)}}}function tg(e=!0,t,i,a){const s=e?a.path2dMap.get(i):Et.path2dDraws[i.name];if(s&&i.type){if(i.calculative.animatePos){if(t.save(),eg(t,i,a),t.beginPath(),s instanceof Path2D)if(i.lineName==="polyline"||i.lineName==="line")if(i.lineAnimateType===We.Arrow||i.lineAnimateType===We.WaterDrop){const n=gg(i);t.stroke(n),t.fill(n)}else i.calculative.gradientSmooth||i.calculative.lineSmooth?(i.calculative.gradientAnimatePath||(i.calculative.gradientAnimatePath=pc(i)),i.calculative.gradientAnimatePath instanceof Path2D&&t.stroke(i.calculative.gradientAnimatePath)):t.stroke(s);else t.stroke(s);else s(i,t),t.stroke();t.restore()}i.fromArrow&&Ud(t,i,a),i.toArrow&&Vd(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&ig(t,i)}}function eg(e,t,i){var s;e.strokeStyle=t.animateColor||i.styles.animateColor,t.animateShadow&&(e.shadowBlur=t.animateShadowBlur||t.animateLineWidth||6,e.shadowColor=t.animateShadowColor||t.animateColor||i.styles.animateColor),t.calculative.animateLineWidth&&(e.lineWidth=t.calculative.animateLineWidth*i.data.scale);let a=0;switch(t.lineAnimateType){case We.Beads:t.animateReverse?e.lineDashOffset=t.calculative.animatePos:e.lineDashOffset=t.length-t.calculative.animatePos,a=t.calculative.lineWidth||5,a<5&&(a=5);const n=t.animateLineDash&&t.animateLineDash.map(r=>r*a/5);e.setLineDash(n||[a,a*2]);break;case We.Dot:t.animateReverse?e.lineDashOffset=t.calculative.animatePos:e.lineDashOffset=t.length-t.calculative.animatePos,a=t.calculative.animateDotSize||t.calculative.lineWidth*2||6,a<6&&(a=6),a>40&&(a=40),e.lineWidth=(t.calculative.animateLineWidth||a)*i.data.scale,e.setLineDash([.1,t.length]);break;case We.Arrow:e.fillStyle=t.animateColor||i.styles.animateColor,e.lineWidth=1;break;case We.WaterDrop:e.fillStyle=t.animateColor||i.styles.animateColor,e.lineWidth=1;break;case We.Custom:switch(t.lineAnimateTargetType){case ps.Image:if((s=t.lineAnimateImages)!=null||(t.lineAnimateImages=[]),t.lineAnimateImages.length>0){const o=t.lineAnimateImages.map((u,c)=>{const f=Et.htmlElements[u];if(!f)t.calculative.canvas.__loadImage(u);else return f});pr(e,t,"image",o)}break;case ps.Icon:const r=t.lineAnimateIcon;pr(e,t,"icon",r);break;case ps.Pen:t.lineAnimatePens&&pr(e,t,"pen",t.lineAnimatePens);break;case ps.Element:const l=t.lineAnimateElement;pr(e,t,"element",l)}break;default:t.animateReverse?(e.lineDashOffset=Number.EPSILON,e.setLineDash([0,t.length-t.calculative.animatePos+1,t.calculative.animatePos])):e.setLineDash([t.calculative.animatePos,t.length+.01-t.calculative.animatePos]);break}}function pr(e,t,i,a){let s=null;switch(i){case"image":s=g2(a);break;case"icon":s=m2(a);break;case"pen":let n=t.calculative.canvas.find(a);t.lineAnimateElementCount=n.length,s=v2(n);break;case"element":if(s=Et.lineAnimateDraws[a],!s)return;break}y2(e,t,s)}function g2(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale,r=i.lineAnimateElementWidth||10,l=i.lineAnimateElementHeight||10,o=e[s%e.length];!o||(t.beginPath(),t.translate(a.x+r/2*n,a.y+l/2*n),t.rotate(a.rotate*Math.PI/180),t.scale(n,n),t.translate(-(r/2*n),-(l/2*n)),t.drawImage(o,0,0,r,l))}}function v2(e){return function(t,i,a,s){const n=e[s%e.length];if(!n)return;const r=i.calculative.canvas.store.data.scale,l=i.calculative.canvas.store.data.origin,o=i.calculative.canvas.parent,u=n.width,c=n.height,f=a.x-u/2,g=a.y-c/2,v=(f-l.x)/r,m=(g-l.y)/r,w=u/r,y=c/r,_={x:v,y:m,width:w,height:y,rotate:a.rotate};o.setValue({id:n.id,..._})}}function m2(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale,r=i.lineAnimateElementWidth||10,l=i.lineAnimateElementHeight||10;t.beginPath(),t.translate(a.x+r/2*n,a.y+l/2*n),t.rotate(a.rotate*Math.PI/180),t.scale(n,n),t.translate(-(r/2*n),-(l/2*n));const o=i.calculative.iconWeight;let u;const c=i.calculative.iconFamily;u=i.calculative.iconSize||Math.max(i.lineAnimateElementWidth||0,i.lineAnimateElementHeight||0)||10,t.font=Le({fontSize:u,fontWeight:o,fontFamily:c}),t.fillStyle=i.calculative.iconColor||Ji(i,i.calculative.canvas.parent.store),i.calculative.iconRotate&&t.rotate(i.calculative.iconRotate*Math.PI/180),t.beginPath(),t.fillText(e,0,0)}}function y2(e,t,i){var l;const a=Array.isArray(t.lineAnimateDash)?t.lineAnimateDash:((l=t.lineAnimateDash)==null?void 0:l.split(",").map(o=>Number(o)))||[10,20],s=t.calculative.canvas.store.data.scale,n=Yr(t)/s;p2(n,a,t.lineAnimateDashOffset,t.lineAnimateElementCount).forEach((o,u)=>{const c=w2(t,o.start);if(!!c)try{e.save(),i(e,t,c,u),e.restore()}catch(f){e.restore(),console.warn(f)}})}function p2(e,t,i=0,a,s=0){const n=[];if(!t||t.length===0)return n.push({start:0,end:e,isDash:!0}),n;const r=t.reduce((c,f)=>c+f,0);let l=(-i+s)%r;l<0&&(l+=r);let o=0,u=0;for(a||(a=1/0);ue&&(m=e),g&&m>v){const w=(v+s)%e,y=(m+s)%e;n.push({start:w,end:y,isDash:!0}),o+=1}if(u=m,l=0,u>=e||o>=a)break}return n}function w2(e,t=0){let i,a=null;if(e.calculative.worldAnchors.forEach(r=>{a&&(i=Bf(i,a,a.next,r.prev,r)),a=r}),e.close){let r=e.calculative.worldAnchors[0];i=Bf(i,a,a.next,r.prev,r)}let s=0;return e.animateReverse?s=e.length-e.calculative.animatePos-t*e.calculative.canvas.store.data.scale:s=e.calculative.animatePos-t*e.calculative.canvas.store.data.scale,T_(i,s)}function ig(e,t){const i=t.calculative.canvas.store;e.save(),e.lineWidth=1,e.fillStyle=t.activeColor||i.styles.activeColor,t.calculative.worldAnchors.forEach(a=>{!a.hidden&&!a.isTemp&&b2(e,a,t)}),e.restore()}function b2(e,t,i){if(!t)return;const a=i.calculative.canvas.store.activeAnchor===i.calculative.activeAnchor&&i.calculative.activeAnchor===t;let s=3;i.calculative.lineWidth>3&&(s=i.calculative.lineWidth),i.anchorRadius&&(s=i.anchorRadius),t.radius&&(s=t.radius),a?(t.prev&&(e.save(),e.strokeStyle="#4dffff",e.beginPath(),e.moveTo(t.prev.x,t.prev.y),e.lineTo(t.x,t.y),e.stroke(),e.restore(),e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.prev.x,t.prev.y,s,0,Math.PI*2),e.fill(),e.stroke(),e.restore()),t.next&&(e.save(),e.strokeStyle="#4dffff",e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(t.next.x,t.next.y),e.stroke(),e.restore(),e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.next.x,t.next.y,s,0,Math.PI*2),e.fill(),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,s,0,Math.PI*2),e.fill(),e.stroke()),e.beginPath(),e.arc(t.x,t.y,s,0,Math.PI*2),e.fill(),e.stroke()):(e.save(),e.fillStyle="#ffffff",e.beginPath(),e.arc(t.x,t.y,s,0,Math.PI*2),e.fill(),e.stroke(),e.restore())}function ag(e){const t=e.calculative.canvas.store;let i={x:e.x,y:e.y};if(!e.parentId||e.parentId&&!t.pens[e.parentId])e.parentId=void 0,i.width=e.width,i.height=e.height,i.rotate=e.rotate,re(i),Qt(i),e.pivot&&Ql(i,e.pivot);else{const a=t.pens[e.parentId];let s=a.calculative.worldRect;s||(s=ag(a)),i.x=s.x+s.width*e.x,i.y=s.y+s.height*e.y,i.width=s.width*e.width,i.height=s.height*e.height,a.flipX&&(i.x=s.width-(i.x-s.x+i.width)+s.x),a.flipY&&(i.y=s.height-(i.y-s.y+i.height)+s.y),re(i),i.rotate=s.rotate+e.rotate,Qt(i),e.pivot&&Ql(i,e.pivot)}return e.calculative.worldRect=i,wc(e,i),i}function wc(e,t){!e.paddingTop&&(e.calculative.paddingTop=0),!e.paddingBottom&&(e.calculative.paddingBottom=0),!e.paddingLeft&&(e.calculative.paddingLeft=0),!e.paddingRight&&(e.calculative.paddingRight=0),Math.abs(e.calculative.paddingTop)<1&&(e.calculative.paddingTop*=t.height),Math.abs(e.calculative.paddingBottom)<1&&(e.calculative.paddingBottom*=t.height),Math.abs(e.calculative.paddingLeft)<1&&(e.calculative.paddingLeft*=t.width),Math.abs(e.calculative.paddingRight)<1&&(e.calculative.paddingRight*=t.width)}function Ir(e){const t=ht(e.calculative.worldRect);if(delete t.pivot,!e.parentId){Object.assign(e,t);return}const a=e.calculative.canvas.store.pens[e.parentId].calculative.worldRect;Object.assign(e,fa(t,a))}function As(e){const t=e.calculative.canvas.store;let i=[];if(e.anchors){let a=ht(e.anchors);e.flipX&&a.forEach(s=>{s.x=.5-(s.x-.5)}),e.flipY&&a.forEach(s=>{s.y=.5-(s.y-.5)}),a.forEach(s=>{i.push(x2(e,s))})}if(!i.length&&!e.type&&!e.calculative.canvas.parent.isCombine(e)){const{x:a,y:s,width:n,height:r}=e.calculative.worldRect;i=t.options.defaultAnchors.map((l,o)=>({id:`${o}`,penId:e.id,x:a+n*l.x,y:s+r*l.y}))}e.calculative.rotate&&e.name!=="line"&&i.forEach(a=>{Gt(a,e.calculative.rotate,e.calculative.worldRect.pivot||e.calculative.worldRect.center)}),(!e.type||e.anchors)&&(e.calculative.worldAnchors=i),e.calculative.activeAnchor&&i.length&&(e.calculative.activeAnchor=i.find(a=>{a.id,e.calculative.activeAnchor.id})),e.calculative.gradientAnimatePath=void 0}function sg(e){var t;if((t=e.children)!=null&&t.length){let i=e.calculative.worldRect;e.children.forEach(a=>{const s=e.calculative.canvas.store.pens[a];s.calculative.initRect&&s.calculative.initRelativeRect&&(s.calculative.initRect.x=i.x+i.width*s.calculative.initRelativeRect.x,s.calculative.initRect.y=i.y+i.height*s.calculative.initRelativeRect.y,s.calculative.initRect.ex=s.calculative.initRect.x+i.width*s.calculative.initRelativeRect.width,s.calculative.initRect.ey=s.calculative.initRect.y+i.height+s.calculative.initRelativeRect.height,Qt(s.calculative.initRect)),sg(s)})}}function x2(e,t){const i={...t},{x:a,y:s,width:n,height:r}=e.calculative.worldRect;return i.x=a+n*t.x,i.y=s+r*t.y,t.prev&&(i.prev={penId:e.id,connectTo:t.prev.connectTo,x:a+n*t.prev.x,y:s+r*t.prev.y}),t.next&&(i.next={penId:e.id,connectTo:t.next.connectTo,x:a+n*t.next.x,y:s+r*t.next.y}),i}function mf(e,t){const{paddingTop:i,paddingBottom:a,paddingLeft:s,paddingRight:n}=t.calculative;let r=s,l=i,o=t.calculative.worldRect.width-s-n,u=t.calculative.worldRect.height-i-a,c=t.calculative.iconLeft,f=t.calculative.iconTop;c&&Math.abs(c)<1&&(c=t.calculative.worldRect.width*c),f&&Math.abs(f)<1&&(f=t.calculative.worldRect.height*f),r+=c||0,l+=f||0,o-=c||0,u-=f||0;let g=t.calculative.iconRotate||0;if(t.parentId){const v=e[t.parentId].calculative;v&&(g+=v.rotate,g%=360)}r=t.calculative.worldRect.x+r,l=t.calculative.worldRect.y+l,t.calculative.worldIconRect={x:r,y:l,width:o,height:u,rotate:g},re(t.calculative.worldIconRect),Qt(t.calculative.worldIconRect)}function ds(e,t,i){vn(e.calculative.worldRect,t,i,e.pivot),e.calculative.initRect&&vn(e.calculative.initRect,t,i,e.pivot),ng(e,t,i),e.calculative.x&&Hr(e.calculative,t,i),e.type&&As(e)}function ng(e,t,i){var a;!e||(a=e.children)!=null&&a.length&&e.children.forEach(s=>{const n=e.calculative.canvas.store.pens[s];n&&(n.calculative.initRect&&vn(n.calculative.initRect,t,i),ng(n,t,i))})}function _2(e,t){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);const i={id:t.id,penId:e.id,x:t.x,y:t.y};if(e.calculative.worldAnchors.push(i),e.calculative.worldRect){e.rotate%360&&Gt(t,-e.rotate,e.calculative.worldRect.center);const a={id:t.id,penId:e.id,x:(t.x-e.calculative.worldRect.x)/e.calculative.worldRect.width,y:(t.y-e.calculative.worldRect.y)/e.calculative.worldRect.height};e.anchors.push(a)}return i}function E2(e,t,i){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);const a=__(e,t,i);return e.calculative.worldAnchors.splice(i+1,0,a),e.anchors.splice(i+1,0,rn(a,e.calculative.worldRect)),e.calculative.activeAnchor=a,a}function A2(e,t){if(!e||!e.calculative.worldAnchors)return;let i=e.calculative.worldAnchors.findIndex(a=>a.id===t.id);i>-1&&e.calculative.worldAnchors.splice(i,1),i=e.anchors.findIndex(a=>a.id===t.id),i>-1&&e.anchors.splice(i,1)}function Ts(e,t){if(!t||!t.calculative||!t.calculative.worldRect.center)return It.None;if(e.anchorId){let i=t.anchors.filter(a=>a.id===e.anchorId);if(i.length&&i[0].direction>-1)return i[0].direction}return mx(e,t.calculative.worldRect.center)}function bs(e,t){let i=1/0,a;return e.calculative.worldAnchors.forEach(s=>{const n=Qr(t,s);i>n&&(i=n,a=s)}),a}function yf(e,t,i){e.x+=t,e.y+=i,e.anchors&&e.anchors.forEach(a=>{nn(a,t,i)}),e.calculative.worldAnchors&&e.calculative.worldAnchors.forEach(a=>{nn(a,t,i)})}function bc(e){if(e&&e.calculative&&e.calculative.worldAnchors.length){let t=Vt(e);if(!e.anchors||!e.anchors.length)for(;e.calculative.worldAnchors.length&&t!==e.calculative.activeAnchor;)e.calculative.worldAnchors.pop(),t=Vt(e);else t===e.calculative.activeAnchor?e.calculative.worldAnchors=[e.calculative.worldAnchors[0]]:e.calculative.worldAnchors[0]===e.calculative.activeAnchor&&(e.calculative.worldAnchors=[e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]])}}function we(e,t,i,a){var l,o,u,c,f,g;if(!e||!t||!i||!a||t.twoWay===Ae.DisableConnected||t.twoWay===Ae.Disable||a.twoWay===Ae.DisableConnectTo||a.twoWay===Ae.Disable)return;if(t.twoWay===Ae.In){if(i.calculative.worldAnchors.length===1)return;const v=Vt(i);if(a.id!==v.id)return}if(t.twoWay===Ae.Out){const v=le(i);if(a.id!==v.id)return}if(a.connectTo===e.id&&a.anchorId===t.id)return;if(a.connectTo){const v=e.calculative.canvas.store.pens[a.connectTo];xs(v,Ia(v,a.anchorId),i,a)}e.connectedLines||(e.connectedLines=[]),e.connectedLines.findIndex(v=>v.lineId===i.id&&v.lineAnchor===a.id&&v.anchor===t.id)<0&&e.connectedLines.push({lineId:i.id,lineAnchor:a.id,anchor:t.id}),a.connectTo=e.id,a.anchorId=t.id,e.type&&we(i,a,e,t),e.calculative.canvas.store.emitter.emit("connectLine",{line:i,lineAnchor:a,pen:e,anchor:t});let n=((l=i.calculative.worldAnchors)==null?void 0:l.length)>=2?(o=i.calculative.worldAnchors)==null?void 0:o[0].connectTo:void 0,r=((u=i.calculative.worldAnchors)==null?void 0:u.length)>=2?(f=i.calculative.canvas.store.pens[(c=i.calculative.worldAnchors)==null?void 0:c[0].connectTo])==null?void 0:f.anchors.find(v=>{var m;return v.id===((m=i.calculative.worldAnchors)==null?void 0:m[0].anchorId)}):void 0;return(g=e.onConnectLine)==null||g.call(e,e,{line:i,lineAnchor:a,pen:e,anchor:t,fromPen:n,fromAnchor:r}),!0}function xs(e,t,i,a){if(!(!e||!t||!i||!a)&&!(!e.connectedLines||!e.connectedLines.length))return i.lastConnected||(i.lastConnected={}),i.lastConnected[e.id]||(i.lastConnected[e.id]=ht(e.connectedLines)),e.connectedLines.forEach((s,n,r)=>{(s.lineId===i.id||s.lineId===i.id)&&s.lineAnchor===a.id&&s.anchor===t.id&&r.splice(n,1)}),a.connectTo=void 0,a.anchorId=void 0,e.type&&t.connectTo===i.id&&t.anchorId===a.id&&xs(i,a,e,t),e.calculative.canvas.store.emitter.emit("disconnectLine",{line:i,lineAnchor:a,pen:e,anchor:t}),!0}function Ia(e,t){var i;if(!(!e||!t))return(i=e.calculative.worldAnchors)==null?void 0:i.find(a=>a.id===t)}function le(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[0]}function Vt(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]}function k2(e,t){var a,s;if(e.calculative.start===0||!e.frames||!e.frames.length)return e.calculative.start=void 0,0;if(!e.calculative.duration){e.calculative.duration=0;for(const n of e.frames){e.calculative.duration+=n.duration;for(const r in n)r!=="duration"&&!e[r]&&r==="scale"&&(e[r]=1)}}if(e.animateCycle||(e.animateCycle=1/0),e.calculative.start){let n=0;const r=Math.ceil((t-e.calculative.start)/e.calculative.duration);if(r>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,wf(e,1),0;const l=(t-e.calculative.start)%e.calculative.duration||e.calculative.duration;let o=0;for(const f of e.frames)if(o+=f.duration,l>o)++n;else break;if(!e.frames[n])return!0;let u=!1;n!==e.calculative.frameIndex&&(u=!0,e.calculative.frameIndex=n,e.calculative.frameDuration=e.frames[n].duration,n>0&&(e.calculative.frameStart+=e.frames[n-1].duration),e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration);let c=!1;if(r>e.calculative.cycleIndex&&(e.calculative.cycleIndex=r,e.calculative.frameStart=e.calculative.start+e.calculative.duration*(r-1),c=!0),u||c)if(e.calculative.x=e.calculative.initRect.x,e.calculative.y=e.calculative.initRect.y,((s=e.children)==null?void 0:s.length)&&!e.parentId?e.calculative.canvas.rotatePen(e,(e.calculative.initRect.rotate||0)-(e.calculative.rotate||0),e.calculative.initRect):e.calculative.rotate=e.calculative.initRect.rotate||0,n>0){e.prevFrame={};const f=e.frames[n-1];for(const g in f)e.prevFrame[g]=f[g];Object.assign(e.prevFrame,{rotate:f.rotate||0,x:f.x||0,y:f.y||0,scale:f.scale||1})}else pf(e)}else{if(e.calculative.start=t,e.calculative.frameIndex=0,e.calculative.frameStart=e.calculative.start,e.calculative.frameDuration=e.frames[0].duration,e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration,e.calculative.cycleIndex=1,e.calculative.x=e.calculative.worldRect.x,e.calculative.y=e.calculative.worldRect.y,e.calculative.initRect=ht(e.calculative.worldRect),e.parentId&&(e.calculative.initRelativeRect={x:e.x,y:e.y,width:e.width,height:e.height}),(a=e.children)!=null&&a.length){const n=e.calculative.canvas.store;e.calculative.childrenVisible={},e.children.forEach(r=>{e.calculative.childrenVisible[r]=n.pens[r].visible})}e.calculative.initRect.rotate=e.calculative.rotate||0,pf(e)}const i=(t-e.calculative.frameStart)/e.calculative.frameDuration%1;return i>0&&wf(e,i),!0}function pf(e){e.prevFrame={};for(const t in e)(typeof e[t]!="object"||t==="lineDash")&&(e.prevFrame[t]=e[t]);e.prevFrame.rotate=0,e.prevFrame.x=0,e.prevFrame.y=0,e.prevFrame.scale=1}function wf(e,t){var s,n,r,l,o,u;if(t<0)return;t>1&&(t=1);const i=e.frames[e.calculative.frameIndex],a=e.calculative.canvas.store.data.scale;for(const c in i)if(c!=="duration"){if(c==="scale"){e.calculative.worldRect=ht(e.calculative.initRect),vn(e.calculative.worldRect,e.prevFrame.scale,e.calculative.worldRect.center);const f=e.prevFrame.scale+(i[c]-e.prevFrame.scale)*t;vn(e.calculative.worldRect,f/e.prevFrame.scale,e.calculative.worldRect.center),e.calculative.patchFlags=!0}else if(c==="x"){const f=Zs(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.x=e.calculative.initRect.x+f,e.calculative.worldRect.ex=e.calculative.initRect.ex+f,e.calculative.worldRect.center.x=e.calculative.initRect.center.x+f,(s=e.calculative.worldRect.pivot)!=null&&s.x&&(e.calculative.worldRect.pivot.x=((n=e.calculative.initRect.pivot)==null?void 0:n.x)+f),Da(e.calculative.worldRect,i[c]*t*a,0),e.calculative.patchFlags=!0}else if(c==="y"){const f=Zs(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.y=e.calculative.initRect.y+f,e.calculative.worldRect.ey=e.calculative.initRect.ey+f,e.calculative.worldRect.center.y=e.calculative.initRect.center.y+f,(r=e.calculative.worldRect.pivot)!=null&&r.x&&(e.calculative.worldRect.pivot.y=((l=e.calculative.initRect.pivot)==null?void 0:l.y)+f),Da(e.calculative.worldRect,0,i[c]*t*a),e.calculative.patchFlags=!0}else if(c==="width"){const f=Zs(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.width=e.calculative.initRect.width+f,e.calculative.worldRect.ex=e.calculative.initRect.ex+f,e.calculative.worldRect.center.x=e.calculative.initRect.center.x+f;let g=i[c]*t*a;e.calculative.worldRect.width+=g,e.calculative.worldRect.ex+=g,e.calculative.worldRect.center.x+=g,e.calculative.patchFlags=!0}else if(c==="height"){const f=Zs(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.height=e.calculative.initRect.height+f,e.calculative.worldRect.ey=e.calculative.initRect.ey+f,e.calculative.worldRect.center.y=e.calculative.initRect.center.y+f;let g=i[c]*t*a;e.calculative.worldRect.height+=g,e.calculative.worldRect.ey+=g,e.calculative.worldRect.center.y+=g,e.calculative.patchFlags=!0}else if(c==="rotate"){e.prevFrame[c]>=360&&(e.prevFrame[c]%=360);const f=Zs(e,c,e.calculative.frameIndex),g=(e.calculative.initRect.rotate+f+i[c]*t)%360-(e.calculative.rotate||0);(o=e.children)!=null&&o.length?e.calculative.canvas.rotatePen(e,g,e.calculative.initRect):e.calculative.rotate=(e.calculative.initRect.rotate+f+i[c]*t)%360,e.calculative.patchFlags=!0}else if(c==="image")e.image=i.image,e.calculative.image=void 0,e.calculative.canvas.loadImage(e),e.canvasLayer===zt.CanvasImageBottom?e.calculative.canvas.canvasImageBottom.init():e.canvasLayer===zt.CanvasImage&&e.calculative.canvas.canvasImage.init();else if(C2(i[c],c,e)){e.prevFrame[c]==null&&(c==="globalAlpha"?e.prevFrame[c]=1:e.prevFrame[c]=0);const f=e.prevFrame[c]+(i[c]-e.prevFrame[c])*t;e.calculative[c]=Math.round(f*100)/100}else{if(c==="visible"&&!e.calculative.image){if((u=e.children)!=null&&u.length){const g=Qe(e,e.calculative.canvas.store);e.calculative.canvas.initImageCanvas(g)}}e.calculative[c]=i[c];const f={};f[c]=i[c],xc(e,f)}c==="text"&&_n(e)}}function C2(e,t,i){const a=["strokeType","bkType","showChild"];return typeof e=="number"&&i.linear!==!1&&!a.includes(t)}function F2(e,t){if(e.calculative.start===0)return e.calculative.start=void 0,e.calculative.cycleStart=void 0,0;e.animateCycle||(e.animateCycle=1/0),e.animateSpan||(e.animateSpan=1);const i=(t-e.calculative.cycleStart)/1e3;if(e.curveAnimate){let a=[];e.animateTimingFunction?a=Array.isArray(e.animateTimingFunction)?e.animateTimingFunction:e.animateTimingFunction.split(","):a=[.25,.25,.75,.75];const s=e.duration||5,n=i/s,r=jx(n,a[1],a[3]);e.calculative.animatePos=r*e.length}else e.calculative.animatePos+=e.animateSpan*(e.calculative.canvas.store.data.scale||1);if(e.calculative.cycleStart||(e.calculative.cycleStart=t),!e.calculative.start)e.calculative.start=Date.now(),e.calculative.animatePos=e.animateSpan*(e.calculative.canvas.store.data.scale||1),e.calculative.cycleIndex=1;else if(e.calculative.animatePos>e.length||e.curveAnimate&&i>e.duration){if(++e.calculative.cycleIndex,e.calculative.cycleIndex>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,e.calculative.cycleStart=void 0,0;e.calculative.cycleStart=void 0,e.calculative.animatePos=e.animateSpan}return!0}function ys(e,t=!0){if(!e.children||e.childActive===!1)return;const i=e.calculative.canvas.store;e.children.forEach(a=>{const s=i.pens[a];s&&(s.calculative.active=t,ys(s,t))})}function tn(e,t=!0){if(!e)return;const i=e.calculative.canvas.store;e.calculative.hover=t,e.childHover!==!1&&e.children&&e.children.forEach(a=>{var s,n;((s=i.pens[a])==null?void 0:s.hoverColor)==null&&((n=i.pens[a])==null?void 0:n.hoverBackground)==null&&tn(i.pens[a],t)})}function Fe(e,t){if(!t)return;const i=e.calculative.canvas.store,a=e.calculative.worldRect;if(t.style.opacity=e.globalAlpha+"",t.style.position="absolute",t.style.outline="none",t.style.left=a.x+i.data.x+"px",t.style.top=a.y+i.data.y+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.style.display=e.calculative.inView!=!1?e.calculative.cssDisplay||"inline":"none",!e.calculative.rotate&&(e.calculative.rotate=0),t.style.transform=`rotate(${e.calculative.rotate}deg)`,e.calculative.rotate||(e.calculative.flipX&&(t.style.transform="rotateY(180deg)"),e.calculative.flipY&&(t.style.transform="rotateX(180deg)"),e.calculative.flipX&&e.calculative.flipY&&(t.style.transform="rotateZ(180deg)")),t.style.zIndex=e.calculative.zIndex!==void 0?e.calculative.zIndex+"":"5",e.calculative.zIndex>e.calculative.canvas.maxZindex&&(e.calculative.canvas.maxZindex=e.calculative.zIndex),e.locked===Mt.DisableEdit||e.locked===Mt.DisableMove||i.data.locked?(t.style.userSelect="initial",t.style.pointerEvents="initial",e.name==="gif"&&(t.style.userSelect="none",t.style.pointerEvents="none")):(t.style.userSelect="none",t.style.pointerEvents="none"),e.className&&(t.className=e.className),e.styles)for(let s in e.styles)t.style[s]=e.styles[s]}function Pl(e){return e.every(t=>t.locked)}function bf(e){return e.every(t=>t.disableRotate)}function rg(e,t,i){var a;e.type?(e.calculative.worldAnchors.forEach(s=>{Gt(s,t,i.center)}),R2(e),Ir(e)):(e.calculative.rotate?e.calculative.rotate+=t:e.calculative.rotate=t,Gt(e.calculative.worldRect.center,t,i.center),e.parentId&&(e.calculative.worldRect.x=e.calculative.worldRect.center.x-e.calculative.worldRect.width/2,e.calculative.worldRect.y=e.calculative.worldRect.center.y-e.calculative.worldRect.height/2,e.x=(e.calculative.worldRect.x-i.x)/i.width,e.y=(e.calculative.worldRect.y-i.y)/i.height)),(a=e.children)==null||a.forEach(s=>{const n=e.calculative.canvas.store.pens[s];rg(n,t,i)})}function R2(e){var s;if(!((s=e.calculative.worldAnchors)!=null&&s.length)||!isFinite(e.x)||!isFinite(e.x)||e.x==null||e.y==null)return;const t=ic(e);e.parentId||Object.assign(e,t);const{fontSize:i,lineHeight:a}=e.calculative.canvas.store.options;e.fontSize?e.fontSize<0&&(e.fontSize=0,e.calculative.fontSize=0):(e.fontSize=i>=0?i:12,e.calculative.fontSize=e.fontSize*e.calculative.canvas.store.data.scale),e.lineHeight||(e.lineHeight=a,e.calculative.lineHeight=e.lineHeight),Qt(t),e.calculative.worldRect=t,wc(e,t),Fi(e),e.calculative.worldAnchors&&(e.anchors=e.calculative.worldAnchors.map(n=>rn(n,e.calculative.worldRect)))}function xf(e){return e.every(t=>t.disableSize||t.pivot)}function Zs(e,t,i){if(!e.frames||!t)return 0;let a=0;for(let s=0;s{const o=i.pens[l];o&&Yi(o,!0)})),e.calculative.inView=!0,jr(e,i)?(e.visible==!1||e.calculative.visible==!1)&&(e.calculative.inView=!1,(e.canvasLayer===zt.CanvasImageBottom||e.canvasLayer===zt.CanvasImage)&&((n=e.frames)==null?void 0:n.length)&&(e.calculative.inView=e.frames.some(l=>l.hasOwnProperty("visible")))):e.calculative.inView=!1,e.calculative.inView){const{x:l,y:o,width:u,height:c,rotate:f}=e.calculative.worldRect,g={x:l+i.data.x,y:o+i.data.y,width:u,height:c,rotate:f};re(g),Xi(g,a)||(e.calculative.inView=!1)}(r=e.calculative.singleton)!=null&&r.div&&Fe(e,e.calculative.singleton.div)}function T2(e,t,i){if(t.fillWorldTextRect){e.save(),e.fillStyle="#c3deb7";const{x:a,y:s,width:n,height:r}=i.calculative.worldTextRect;e.fillRect(a,s,n,r),e.restore()}}function Ha(e,t){const i=t.calculative.globalAlpha;typeof i=="number"&&i<1&&!isNaN(i)&&(e.globalAlpha=i)}function og(e,t){const i=P2(e,t)||Et.canvasDraws[t.name];i&&(e.save(),i(e,t),e.restore())}function P2(e,t){const i=t.drawCommand;if(!(!i||t.name==="line"))return(a,s)=>{i.forEach(n=>{try{n.steps=n.steps.flat(1/0),n.steps.reduce((r,l)=>{const o=S2(l,s,r.x,r.y);try{if(o.c){if(o.c.startsWith("_")){const c=o.c.split("_")[1];return typeof o.v.value=="number"&&(o.v.value*=s.calculative.canvas.store.data.scale),(o.p||a)[c]=o.v.value,{x:r.x,y:r.y}}let u=[];for(const c in o.v)u.push(o.v[c]);return(o.p||a)[o.c](...u),{x:o.startX||o.v.x,y:o.startY||o.v.y}}return{x:r.x,y:r.y}}catch{}},{})}catch{}}),a.stroke()}}function S2(e,t,i,a){var n;const s={visio:D2,dxf:I2,canvas:B2};return((n=s[t.parseType])==null?void 0:n.call(s,e,t,i,a))||e}function I2(e,t,i,a){var c,f;const{x:s,y:n,width:r,height:l}=t.calculative.worldRect,{originWidth:o,originHeight:u}=t.dxfOrigin;switch(e.c){case"beginPath":return{c:"beginPath",v:{}};case"closePath":return{c:"closePath",v:{}};case"moveTo":return{c:"moveTo",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n}};case"arc":return{c:"ellipse",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n,rx:e.v.xr*(r/o),ry:e.v.yr*(l/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(c=e.v.aclockwise)!=null?c:!0}};case"ellipse":return{c:"ellipse",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n,rx:e.v.xr*(r/o),ry:e.v.yr*(l/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(f=e.v.aclockwise)!=null?f:!0}};case"_font":return{c:"_font",v:{value:e.v.fontSize*t.calculative.canvas.store.data.scale+"px "+(e.v.fontFamily||t.calculative.canvas.store.options.fontFamily)}};case"_fillStyle":return{c:"_fillStyle",v:{value:t.color||e.v.value}};default:const g={c:e.c,v:{...e.v}};return g.v.x!==void 0&&(g.v.x=e.v.x*(r/o)+s),g.v.y!==void 0&&(g.v.y=e.v.y*(l/u)+n),g}}function B2(e,t,i,a){var c,f;const{x:s,y:n,width:r,height:l}=t.calculative.worldRect,{originWidth:o,originHeight:u}=t.origin;switch(e.c){case"beginPath":return{c:"beginPath",v:{}};case"closePath":return{c:"closePath",v:{}};case"moveTo":return{c:"moveTo",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n}};case"arc":return{c:"ellipse",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n,rx:e.v.xr*(r/o),ry:e.v.yr*(l/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(c=e.v.aclockwise)!=null?c:!0}};case"ellipse":return{c:"ellipse",v:{x:e.v.x*(r/o)+s,y:e.v.y*(l/u)+n,rx:e.v.xr*(r/o),ry:e.v.yr*(l/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(f=e.v.aclockwise)!=null?f:!0}};case"_font":return{c:"_font",v:{value:e.v.fontSize*t.calculative.canvas.store.data.scale+"px "+(e.v.fontFamily||t.calculative.canvas.store.options.fontFamily)}};default:const g={c:e.c,v:{...e.v}};return g.v.x!==void 0&&(g.v.x=e.v.x*(r/o)+s),g.v.y!==void 0&&(g.v.y=e.v.y*(l/u)+n),g}}function D2(e,t,i,a){const{x:s,y:n,width:r,height:l}=t.calculative.worldRect,{width:o,height:u}=t.origin;switch(e.c){case"MoveTo":return{c:"moveTo",v:{x:+e.v.X*100*(r/o)+s,y:+e.v.Y*100*(l/u)+n}};case"RelMoveTo":return{c:"moveTo",v:{x:+e.v.X*o*(r/o)+s,y:+e.v.Y*u*(l/u)+n}};case"LineTo":return{c:"lineTo",v:{x:+e.v.X*100*(r/o)+s,y:+e.v.Y*100*(l/u)+n}};case"RelLineTo":return{c:"lineTo",v:{x:+e.v.X*o*(r/o)+s,y:+e.v.Y*u*(l/u)+n}};case"Ellipse":let c=e.v.X,f=e.v.Y,g=Math.abs(e.v.A-e.v.C),v=Math.abs(e.v.B-e.v.D);return{c:"ellipse",v:{x:c*100*(r/o)+s,y:f*100*(l/u)+n,radiuX:g*100*(r/o),radiuY:v*100*(l/u),rotation:0,startAngle:0,endAngle:Math.PI*2,anticlockwise:!0}};case"EllipticalArcTo":const m=e.v.X*100*(r/o)+s,w=e.v.Y*100*(l/u)+n,y=e.v.A*100*(r/o)+s,_=e.v.B*100*(l/u)+n;e.v.C;const A=e.v.D*(r/l)*(u/o),x=(m-i)*(_-a)-(w-a)*(y-i)>0,C=_f(i,a,m,w,y,_,A);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=wr(C.x0,C.y0,i,a)),!e.orign.endA&&(e.orign.endA=wr(C.x0,C.y0,m,w)),{c:"ellipse",v:{centerX:C.x0,centerY:C.y0,radiuX:C.a,radiuY:C.b,rotation:0,startAngle:e.orign.startA,endAngle:e.orign.endA,anticlockwise:x},startX:m,startY:w};case"RelEllipticalArcTo":const T=e.v.X*o*(r/o)+s,I=e.v.Y*u*(l/u)+n,D=e.v.A*o*(r/o)+s,B=e.v.B*u*(l/u)+n;e.v.C;const V=e.v.D*(r/l)*(u/o),Q=(T-i)*(B-a)-(I-a)*(D-i)>0,F=_f(i,a,T,I,D,B,V);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=wr(F.x0,F.y0,i,a)),!e.orign.endA&&(e.orign.endA=wr(F.x0,F.y0,T,I)),{c:"ellipse",v:{centerX:F.x0,centerY:F.y0,radiuX:F.a,radiuY:F.b,rotation:0,startAngle:e.orign.startA,endAngle:e.orign.endA,anticlockwise:Q},startX:T,startY:I};case"ArcTo":let R=e.v.X*100*r/o+s,P=e.v.Y*100*l/u+n,M=e.v.A*100*(r/l)*(u/o),Y=(i+R)/2,Z=(a+P)/2,nt=Math.sqrt((R-i)**2+(P-a)**2),j=nt**2/(8*M)+M/2,H=-(P-a)/nt,$=(R-i)/nt,K=Y+H*j,U=Z+$*j,tt=K,at=U,et=Math.atan2(a-at,i-tt),ut=Math.atan2(P-at,R-tt);return{c:"arc",v:{x:tt,y:at,radius:j,startAngle:et,endAngle:ut,aclockwise:!0}};default:const ct=ht(e);return Object.entries(ct.v).forEach(([ot,b])=>{var E,S;(E=ot.endsWith)!=null&&E.call(ot,"_x")?typeof b=="number"&&(ct.v[ot]=b*(r/o)+s):(S=ot.endsWith)!=null&&S.call(ot,"_y")?typeof b=="number"&&(ct.v[ot]=b*(l/u)+n):typeof b=="number"&&(ct.v[ot]=b)}),ct}}function L2(e,t){e.filter=t.filter}function xc(e,t){for(const i in t)Nd.includes(i)&&(i=="fontSize"&&t[i]<0&&(t[i]=0),e[i]=t[i],["fontSize","lineWidth"].includes(i)?(e.calculative[i]=t[i]*e.calculative.canvas.store.data.scale,Fi(e)):e.calculative[i]=t[i]),e.image&&e.name!=="gif"&&Md.includes(i)&&(e.calculative.canvas.store.patchFlagsTop=!0,e.calculative.canvas.store.patchFlagsBackground=!0,e.calculative.imageDrawed=!1);if(e.calculative.canvas.parent.isCombine(e)){const i=e.children;i==null||i.forEach(a=>{let s=ht(t);e.calculative.childrenVisible&&e.calculative.childrenVisible[a]===!1&&delete s.visible;const n=e.calculative.canvas.store.pens[a];n&&xc(n,s)})}}function _f(e,t,i,a,s,n,r){let l=(e-i)*(e+i)*(a-n)-(i-s)*(i+s)*(t-a)+r*r*(t-a)*(a-n)*(t-n),o=2*((e-i)*(a-n)-(i-s)*(t-a)),u=l/o,c=(e-i)*(i-s)*(e-s)+r*r*((i-s)*(t-a)*(t+a)-(e-i)*(a-n)*(a+n)),f=2*r*r*((i-s)*(t-a)-(e-i)*(a-n)),g=c/f,v=Math.sqrt(Math.pow(e-u,2)+Math.pow(r*(t-g),2)),m=v/r;return{x0:u,y0:g,a:v,b:m}}function wr(e,t,i,a){let s=i-e,n=a-t,r=Math.atan2(n,s);return r<0&&(r+=2*Math.PI),r}function Ef(e,t,i){let a,s,n=1/0,r=1/0;const l=8;for(const o of e.data.pens){if(o.calculative.inView===!1)continue;_c(o).forEach(c=>{if(c===t||c===i)return;let f=(o.calculative.worldRect.center.x-t.x)*(o.calculative.worldRect.center.x-t.x)+(o.calculative.worldRect.center.y-t.y)*(o.calculative.worldRect.center.y-t.y);const g=Math.abs(c.x-t.x);g>0&&g0&&v{n.x+=a.x,n.y+=a.y})):(Qt(t),s=[t.center,...Zi(t)]),lg(e,s,t,!0)}function _c(e){if(e.type){if(e.type===$t.Line)return e.calculative.worldAnchors}else{const t=Zi(e.calculative.worldRect);return Qt(e.calculative.worldRect),[...e.calculative.worldAnchors,...t,e.calculative.worldRect.center]}}function O2(e,t,i,a){const s=Zi(t);return lg(e,s,t)}function lg(e,t,i,a=!1){let s,n,r=1/0,l=1/0;const o=10,u=$2(i,o);return e.data.pens.forEach(c=>{const{inView:f,worldRect:g,active:v}=c.calculative;if(f===!1||!a&&v||V2(u,g)||c.type&&e.active.some(w=>cg(e,w,c)))return;const m=_c(c);if(!!m)for(const w of m)for(const y of t){const _=w.x-y.x,A=w.y-y.y,x=Math.abs(_),C=Math.abs(A);i.center||(i.center={x:i.x+i.width/2,y:i.y+i.height/2}),xu.calculative.worldRect);const a=i.map(u=>u.x),s=i.map(u=>u.y),n=a.reduce((u,c)=>u+c,0)/a.length,r=s.reduce((u,c)=>u+c,0)/s.length,l=Math.sqrt(a.map(u=>Math.pow(u-n,2)).reduce((u,c)=>u+c,0)/a.length),o=Math.sqrt(s.map(u=>Math.pow(u-r,2)).reduce((u,c)=>u+c,0)/s.length);return e.filter(u=>{let c=u.calculative.worldRect;const f=(c.x-n)/l,g=(c.y-r)/o;return Math.sqrt(f*f+g*g)>t})}function Af(e){if(e.id=St(),Array.isArray(e.anchors))for(const t of e.anchors)e.type&&(t.id=St()),t.penId=e.id,t.prev&&(e.type&&(t.prev.id=St()),t.prev.penId=e.id),t.next&&(e.type&&(t.next.id=St()),t.next.penId=e.id)}function z2(){let e=null,t=new Map;return(i,a,s,n=!1)=>{if(t.has(i)&&t.get(i)?e=t.get(i):t.set(i,e=new Map),typeof s!="function")return()=>{console.warn("[rewritePenLifeCycle] warn: not a function ")};let r=new Set,l=new Map;e.has(a)&&e.get(a)?r=e.get(a):(l.set(a,i[a]),e.set(a,r)),n?r.delete(s):r.add(s);let o=l.get(a),u=(...c)=>{o==null||o(...c),r.forEach(f=>{f(...c)})};i[a]=u}}let H2=z2();function W2(e){return!e.name&&!e.install?(console.error("installPenPlugin Error: Validation Failed"),!1):!0}function Ui(e,t){if(!t)return;if(t.ex==null&&re(t),!t.rotate||t.rotate%360===0)return e.x>t.x&&e.xt.y&&e.y{Gt(a,t.rotate,t.pivot||t.center)}),U2(e,i)}function Wa(e,t,i=0){const{x:a,y:s,ex:n,ey:r}=t;return e.x>=a-i&&e.x<=n+i&&e.y>=s-i&&e.y<=r+i}function Qt(e){e.center||(e.center={}),e.center.x=e.x+e.width/2,e.center.y=e.y+e.height/2}function re(e){e.ex=e.x+e.width,e.ey=e.y+e.height}function Ql(e,t){e.pivot||(e.pivot={}),e.pivot.x=e.x+e.width*t.x,e.pivot.y=e.y+e.height*t.y}function U2(e,t){if(t.length<3)return!1;let i=!1,a=t[t.length-1];for(const s of t)a.y>e.y!=s.y>e.y&&s.x+(e.y-s.y)*(a.x-s.x)/(a.y-s.y)>e.x&&(i=!i),a=s;return i}function hi(e){const t=[];e.forEach(a=>{if(a.isRuleLine)return;const s=a.calculative.worldRect;if(s){const n=Zi(s);t.push(...n)}});const i=En(t);return Qt(i),i}function Zi(e){const t=[{x:e.x,y:e.y},{x:e.ex,y:e.y},{x:e.ex,y:e.ey},{x:e.x,y:e.ey}];return e.rotate&&(e.center||Qt(e),t.forEach(i=>{Gt(i,e.rotate,e.pivot||e.center)})),t}function En(e){let t=1/0,i=1/0,a=-1/0,s=-1/0;return e==null||e.forEach(n=>{!isFinite(n.x)||!isFinite(n.y)||(t=Math.min(t,n.x),i=Math.min(i,n.y),a=Math.max(a,n.x),s=Math.max(s,n.y))}),{x:t,y:i,ex:a,ey:s,width:a-t,height:s-i}}function Xi(e,t,i){return e.rotate&&(e=En(Zi(e))),i?e.x>t.x&&e.ext.y&&e.eyt.ex||e.ext.ey)}function V2(e,t){return(t.x>e.ex||t.exe.ey||t.eye.y!=o>e.y&&e.x<(l-n)*(e.y-r)/(o-r)+n&&(i=!i)}return i}const K2=/^[\t\n\f\r ]*([MLHVZCSQTAmlhvzcsqta])[\t\n\f\r ]*/,Cf=/^[01]/,Jt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,X2=/^(([\t\n\f\r ]+,?[\t\n\f\r ]*)|(,[\t\n\f\r ]*))/,G2={M:[Jt,Jt],L:[Jt,Jt],H:[Jt],V:[Jt],Z:[],C:[Jt,Jt,Jt,Jt,Jt,Jt],S:[Jt,Jt,Jt,Jt],Q:[Jt,Jt,Jt,Jt],T:[Jt,Jt],A:[Jt,Jt,Jt,Cf,Cf,Jt,Jt]};function Z2(e){let t=0;const i=[];for(;t{n.worldPoints.forEach((r,l)=>{l%2===0?(ra&&(a=r)):(rs&&(s=r))})}),{x:t,y:i,ex:a,ey:s,width:a-t+1,height:s-i+1}}function J2(e,t,i){i==null&&(i=t),e.commands.forEach((a,s)=>{if(!(a.relative&&s))switch(a.key){case"A":case"a":a.values[5]+=t,a.values[6]+=i;break;case"V":case"v":a.values[0]+=i;break;default:a.values.forEach((n,r)=>{a.values[r]=n+(r%2===0?t:i)});break}})}function Q2(e,t,i){i==null&&(i=t),e.commands.forEach(a=>{switch(a.key){case"A":case"a":const s=a.values[0],n=a.values[1],r=Math.PI*a.values[2]/180,l=Math.cos(r),o=Math.sin(r),u=n*n*i*i*l*l+s*s*i*i*o*o,c=2*t*i*l*o*(n*n-s*s),f=s*s*t*t*l*l+n*n*t*t*o*o,g=-(s*s*n*n*t*t*i*i),v=c*c-4*u*f,m=Math.sqrt((u-f)*(u-f)+c*c);a.values[2]=c!==0?Math.atan((f-u-m)/c)*180/Math.PI:u=0?a.values[4]:1-a.values[4];break;case"V":case"v":a.values[0]*=i;break;default:a.values.forEach((w,y)=>{a.values[y]=w*(y%2===0?t:i)});break}})}function t_(e){let t="";return e.commands.forEach(i=>{t+=i.key+" ",i.values.forEach(a=>{t+=a+" "})}),t}function e_(e,t,i){const a=G2[e.toUpperCase()],s=[];for(;i<=t.length;){const n={key:e,values:[]};for(const r of a){const l=t.slice(i).match(r);if(l!==null){n.values.push(+l[0]),i+=l[0].length;const o=t.slice(i).match(X2);o!==null&&(i+=o[0].length)}else{if(n.values.length===0)return{cursor:i,commands:s};throw new Error("malformed path (first error at "+i+")")}}if(n.relative=n.key.toUpperCase()!==n.key,s.push(n),a.length===0)return{cursor:i,commands:s};e==="m"&&(e="l"),e==="M"&&(e="L")}throw new Error("malformed path (first error at "+i+")")}function i_(e,t){const i=[];let a=e.relative&&t?{x:t.worldPoints[t.worldPoints.length-2],y:t.worldPoints[t.worldPoints.length-1]}:{x:0,y:0};for(let s=0;s{switch(s.key){case"Z":case"z":s.worldPoints=[i,a];break;case"H":s.worldPoints=[s.values[0],t.worldPoints[t.worldPoints.length-1]];break;case"h":s.worldPoints=[s.values[0]+t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1]];break;case"V":s.worldPoints=[t.worldPoints[t.worldPoints.length-2],s.values[0]];break;case"v":s.worldPoints=[t.worldPoints[t.worldPoints.length-2],s.values[0]+t.worldPoints[t.worldPoints.length-1]];break;case"A":s.worldPoints=[t.worldPoints[t.worldPoints.length-2],s.values[0]+t.worldPoints[t.worldPoints.length-1]];break;default:i_(s,t);break}(s.key==="M"||s.key==="m"||s.key==="Z"||s.key==="z")&&(i=s.worldPoints[s.worldPoints.length-2],a=s.worldPoints[s.worldPoints.length-1]),t=s})}function s_(e,t){var o;const a=e.calculative.canvas.store.data.paths[e.pathId];if(!a)return new Path2D;const s=Z2(a);e.calculative.svgRect=Ff(s),Qt(e.calculative.svgRect),(e.calculative.svgRect.width!==e.calculative.worldRect.width||e.calculative.svgRect.height!==e.calculative.worldRect.height)&&Q2(s,e.calculative.worldRect.width/e.calculative.svgRect.width,e.calculative.worldRect.height/e.calculative.svgRect.height);const n=Ff(s);Qt(n),J2(s,e.calculative.worldRect.x-n.x,e.calculative.worldRect.y-n.y);const r=t_(s);if(t){(o=t.svgPath)==null||o.call(t,r);return}return new Path2D(r)}function n_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/2,s),i.lineTo(a+n,s+r/2),i.lineTo(a+n/2,s+r),i.lineTo(a,s+r/2),i.lineTo(a+n/2,s),i.closePath(),i instanceof Path2D)return i}function r_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/2,s),i.lineTo(a+n,s+r),i.lineTo(a,s+r),i.lineTo(a+n/2,s),i.closePath(),i instanceof Path2D)return i}function o_(e){const t=[{x:.5,y:0},{x:.75,y:.5},{x:.5,y:1},{x:.25,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function l_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/2,s),i.lineTo(a+n,s+r*2/5),i.lineTo(a+n*4/5,s+r),i.lineTo(a+n/5,s+r),i.lineTo(a,s+r*2/5),i.closePath(),i instanceof Path2D)return i}function c_(e){const t=[{x:.5,y:0},{x:1,y:.4},{x:.8,y:1},{x:.2,y:1},{x:0,y:.4}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function h_(e,t){e.onResize||(e.onResize=u_);const i=t||new Path2D,{width:a,height:s,center:n}=e.calculative.worldRect,r=a>s?s:a,l=n.x,o=n.y,u=o-r/2,c=o-r/4,f=-(c-o)*Math.sin(Math.PI/180*324)+l,g=(c-o)*Math.cos(Math.PI/180*324)+o;i.moveTo(f,g);for(let v=0;v<5;++v)i.lineTo(-(u-o)*Math.sin(Math.PI/180*72*v)+l,(u-o)*Math.cos(Math.PI/180*72*v)+o),i.lineTo((f-l)*Math.cos(Math.PI/180*72*(v+1))-(g-o)*Math.sin(Math.PI/180*72*(v+1))+l,(f-l)*Math.sin(Math.PI/180*72*(v+1))+(g-o)*Math.cos(Math.PI/180*72*(v+1))+o);if(i.closePath(),i instanceof Path2D)return i}function hg(e){const{width:t,height:i}=e,a=t>i?i:t,s=[];for(let n=0;n<5;++n)s.push({flag:1,id:String(n),penId:e.id,x:.5+a/2*Math.sin(Math.PI/180*72*n)/t,y:-a/2*Math.cos(Math.PI/180*72*n)/i+.5});e.anchors=s}function u_(e){const t=e.anchors.filter(i=>i.flag!==1);hg(e),e.anchors=e.anchors.concat(...t)}function f_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/4,s),i.lineTo(a+n*3/4,s),i.lineTo(a+n,s+r/2),i.lineTo(a+n*3/4,s+r),i.lineTo(a+n*1/4,s+r),i.lineTo(a,s+r/2),i.lineTo(a+n/4,s),i.closePath(),i instanceof Path2D)return i}function d_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r/2),i.lineTo(a+r/2,s),i.lineTo(a+r/2,s+r/3),i.lineTo(a+n,s+r/3),i.lineTo(a+n,s+r*2/3),i.lineTo(a+r/2,s+r*2/3),i.lineTo(a+r/2,s+r*2/3),i.lineTo(a+r/2,s+r),i.closePath(),i instanceof Path2D)return i}function g_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r/3),i.lineTo(a+(n-r/2),s+r/3),i.lineTo(a+(n-r/2),s),i.lineTo(a+n,s+r/2),i.lineTo(a+(n-r/2),s+r),i.lineTo(a+(n-r/2),s+r*2/3),i.lineTo(a,s+r*2/3),i.closePath(),i instanceof Path2D)return i}function v_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r/2),i.lineTo(a+r/2,s),i.lineTo(a+r/2,s+r/3),i.lineTo(a+(n-r/2),s+r/3),i.lineTo(a+(n-r/2),s),i.lineTo(a+n,s+r/2),i.lineTo(a+(n-r/2),s+r),i.lineTo(a+(n-r/2),s+r*2/3),i.lineTo(a+r/2,s+r*2/3),i.lineTo(a+r/2,s+r),i.closePath(),i instanceof Path2D)return i}function m_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ey:l}=e.calculative.worldRect;if(i.moveTo(a,s),i.lineTo(a+n,s),i.lineTo(a+n,s+r*3/4),i.lineTo(a+n*8/16,s+r*3/4),i.lineTo(a+n/4,l),i.lineTo(a+n*5/16,s+r*3/4),i.lineTo(a,s+r*3/4),i.closePath(),i instanceof Path2D)return i}function y_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a+n/5,s+r*13/16),i.bezierCurveTo(a-n/15,s+r*13/16,a-n/15,s+r*7/16,a+n/5,s+r*7/16),i.bezierCurveTo(a+n/5,s,a+n*4/5,s,a+n*4/5,s+r*7/16),i.bezierCurveTo(a+n*16/15,s+r*7/16,a+n*16/15,s+r*13/16,a+n*4/5,s+r*13/16),i.closePath(),i instanceof Path2D)return i}function p_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=n/6;if(i.moveTo(a,s),i.lineTo(r-o,s),i.lineTo(r,s+o),i.lineTo(r,l),i.lineTo(a,l),i.closePath(),i.moveTo(r-o,s),i.lineTo(r-o,s+o),i.lineTo(r,s+o),i.closePath(),i instanceof Path2D)return i}function w_(e,t){const{x:i,y:a,width:s,ex:n,ey:r}=t.calculative.worldRect;let l=s*.25;const o=t.z;o>1?l=o*t.calculative.canvas.store.data.scale:o>0&&(l=s*o);const u={x:i,y:a+l},c={x:n-l,y:a+l},f={x:n-l,y:r};Sl(e,[u,c,f,{x:i,y:r}],t.backgroundFront||t.background,t.color),Sl(e,[u,{x:i+l,y:a},{x:n,y:a},c],t.backgroundUp||t.background,t.color),Sl(e,[c,{x:n,y:a},{x:n,y:r-l},f],t.backgroundRight||t.background,t.color)}function Sl(e,t,i="",a=""){e.save(),i&&(e.fillStyle=i),a&&(e.strokeStyle=a),e.beginPath();for(let s=0;sa.x?l=It.Right:l=It.Left),a.next={id:St(),penId:t.id,x:a.x,y:a.y,prevNextType:2},s.prev={id:St(),penId:t.id,x:s.x,y:s.y,prevNextType:2},l){case It.Up:a.next.y-=n,s.prev.y=a.y;break;case It.Bottom:a.next.y+=n,s.prev.y=a.y;break;case It.Left:a.next.x-=n,s.prev.x=a.x;break;default:a.next.x+=n,s.prev.x=a.x;break}}function A_(e,t){const i=t||new Path2D;if((e.lineName==="line"||e.lineName==="polyline")&&e.calculative.lineSmooth){let s=pc(e);if(i instanceof Path2D&&i.addPath(s),i instanceof Path2D)return i}const a=e.calculative.worldAnchors;if(a.length>1){let s;a.forEach(n=>{s?Tf(i,s,n):n.start=!0,s=n}),e.close&&(e.lineName==="curve"?Tf(i,s,a[0]):i.closePath())}if(i instanceof Path2D)return i}function k_(e,t,i){var n;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.calculative.worldAnchors.length<2||((n=t.anchors)==null?void 0:n.length)>1)return;const a=le(t),s=Vt(t);!a||!s||!s.id||a===s||(a.next=void 0,bc(t),s.prev=void 0,t.calculative.worldAnchors.push(s))}function Tf(e,t,i){!i||i.isTemp||(t.start&&e.moveTo(t.x,t.y),t.next?i.prev?e.bezierCurveTo(t.next.x,t.next.y,i.prev.x,i.prev.y,i.x,i.y):e.quadraticCurveTo(t.next.x,t.next.y,i.x,i.y):i.prev?e.quadraticCurveTo(i.prev.x,i.prev.y,i.x,i.y):e.lineTo(i.x,i.y))}function ic(e){return Yr(e),En(fg(e))}function fg(e){const t=[];let i;return e.calculative.worldAnchors.forEach(a=>{t.push(a),i&&t.push(...Pf(i,a,e)),i=a}),e.close&&e.calculative.worldAnchors.length>1&&t.push(...Pf(i,e.calculative.worldAnchors[0],e)),t}function qr(e){return e!=null&&e.lineWidth?e.lineWidth/2+4:4}function Pf(e,t,i){const a=[];if(!t)return a;let s=.02;if(e.lineLength&&!i.parentId&&(s=qr(i)/e.lineLength),e.next)if(t.prev)for(let n=s;n<1;n+=s)a.push(ug(n,e,e.next,t.prev,t));else for(let n=s;n<1;n+=s)a.push(ec(n,e,e.next,t));else if(t.prev)for(let n=s;n<1;n+=s)a.push(ec(n,e,t.prev,t));else a.push({x:t.x,y:t.y});return a.length>1&&(e.curvePoints=a),a}function C_(e,t){const i=qr(t);let a=0,s,n;for(const r of t.calculative.worldAnchors){if(s){if(n=Sf(e,s,r,i),n)return{i:a,point:n};++a}s=r}if(t.close&&t.calculative.worldAnchors.length>1&&(n=Sf(e,s,t.calculative.worldAnchors[0],i)))return{i:a,point:n}}function Sf(e,t,i,a=4){if(!t.next&&!i.prev){const{x:s,y:n}=t,{x:r,y:l}=i,o=Math.min(s,r),u=Math.max(s,r),c=Math.min(n,l),f=Math.max(n,l);return e.x>=o-a&&e.x<=u+a&&e.y>=c-a&&e.y<=f+a?F_(e,t,i,a):void 0}else if(t.curvePoints){for(const s of t.curvePoints)if(ms(e,s,a))return s}}function F_(e,t,i,a=4){if(t.x===i.x){if(Math.abs(e.x-t.x)<=a)return{x:t.x,y:e.y}}else{const s=(t.y-i.y)/(t.x-i.x),n=t.y-s*t.x;if(Math.abs((s*e.x+n-e.y)/Math.sqrt(s*s+1))<=a){const o=(e.x+s*e.y-s*n)/(s*s+1);return{x:o,y:s*o+n}}}}function If(e,t,i,a){if(!t&&!i)return Math.sqrt(Math.pow(Math.abs(e.x-a.x),2)+Math.pow(Math.abs(e.y-a.y),2))||0;const s=document.createElementNS("http://www.w3.org/2000/svg","path");return t&&i?s.setAttribute("d",`M${e.x} ${e.y} C${t.x} ${t.y} ${i.x} ${i.y} ${a.x} ${a.y}`):t?s.setAttribute("d",`M${e.x} ${e.y} Q${t.x} ${t.y} ${a.x} ${a.y}`):s.setAttribute("d",`M${e.x} ${e.y} Q${i.x} ${i.y} ${a.x} ${a.y}`),s.getTotalLength()||0}function Yr(e){if(e.calculative.worldAnchors.length<2)return 0;let t=0,i;if(e.calculative.worldAnchors.forEach(a=>{i&&(i.lineLength=If(i,i.next,a.prev,a),t+=i.lineLength),i=a}),e.close){const a=le(e);i.lineLength=If(i,i.next,a.prev,a),t+=i.lineLength}return e.calculative.animatePos&&(e.calculative.animatePos=t/e.length*e.calculative.animatePos),e.length=t,t}function Il(e,t){const i=e.calculative.worldAnchors;for(let a=0;a=0&&f*u+g*c+v<=0||f*l+g*o+v<=0&&f*u+g*c+v>=0||f*l+g*c+v>=0&&f*u+g*o+v<=0||f*l+g*c+v<=0&&f*u+g*o+v>=0){if(l>u){const m=l;l=u,u=m}if(ou&&n>u||s>o&&r>o||si)return null;const a=.01,s=e.getPointAtLength(t),n=e.getPointAtLength(t-a),r=Math.atan2(s.y-n.y,s.x-n.x);return{x:s.x,y:s.y,rotate:r/Math.PI*180,progress:t/i}}let Ue=10;function P_(e,t,i){var w;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),Ue=e.options.polylineSpace||10,t.calculative.worldAnchors.length<2)return;let a=le(t),s=Vt(t);if(!a||!s)return;let n;if(((w=t.anchors)==null?void 0:w.length)&&a===t.calculative.activeAnchor?(n=!0,a=s,s=le(t)):(!t.anchors||!t.anchors.length)&&a!==t.calculative.activeAnchor&&(a=t.calculative.activeAnchor),!a||!s)return;a.next=void 0,s.prev=void 0;const r=s.connectTo;bc(t);const l=[],o=e.pens[a.connectTo],u=e.pens[s.connectTo],c=Ts(a,o),f=Ts(s,u);let g=Df(a,c,Ue);g&&(a=g,l.push(g)),g=Df(s,f,Ue);const v=s;let m;if(g&&(s=g,v.connectTo&&(g.y>v.y&&a.yv.y))){m=g;let y=Ue;a.x{y.id=St(),y.penId=t.id,t.calculative.worldAnchors.push(y)}),t.calculative.worldAnchors.push(s),m&&t.calculative.worldAnchors.push(m),g&&t.calculative.worldAnchors.push(v),n&&t.calculative.worldAnchors.reverse(),r){const y=t.calculative.worldAnchors.length-2;t.calculative.worldAnchors[y].isTemp=!1,t.calculative.worldAnchors[1].isTemp=!1}}function Df(e,t,i){const a={x:e.x,y:e.y,id:St()};switch(t){case It.Up:a.y-=i;break;case It.Right:a.x+=i;break;case It.Bottom:a.y+=i;break;case It.Left:a.x-=i;break;default:return}return a}function S_(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case It.Up:e.ye.y)s=e.x+(t.x-e.x)/2,a.push({x:s,y:e.y},{x:s,y:t.y});else{const r=(e.y+t.y)/2;a.push({x:e.x,y:r},{x:t.x,y:r})}break;case It.Right:s=t.x,n=e.y,t.xe.x&&t.ye.y-Ue)s=e.x+(t.x-e.x)/2,a.push({x:s,y:e.y},{x:s,y:t.y});else{const r=(e.y+t.y+Ue)/2;a.push({x:e.x,y:r},{x:t.x,y:r})}break}return a}function I_(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case It.Up:s=e.x,n=t.y,t.x>e.x&&t.y>e.y&&(s=t.x,n=e.y),a.push({x:s,y:n});break;case It.Bottom:s=e.x,n=t.y,t.x>e.x&&t.ye.y&&(s=e.x,n=t.y),a.push({x:s,y:n});break;case It.Bottom:e.y>t.y?(s=t.x,n=e.y):(s=e.x,n=t.y),a.push({x:s,y:n});break;case It.Left:s=t.x,n=e.y,t.x>e.x&&t.y>e.y&&(s=e.x,n=t.y),a.push({x:s,y:n});break;default:if(s=e.x,t.ye.y&&(s=t.x,n=e.y),a.push({x:s,y:n});break;case It.Bottom:s=e.x,n=t.y,t.xe.x)s=t.x,n=e.y+(t.y-e.y)/2,a.push({x:e.x,y:n},{x:t.x,y:n});else{const r=(e.x+t.x)/2;a.push({x:r,y:e.y},{x:r,y:t.y})}break;case It.Left:t.x>e.x?a.push({x:e.x,y:t.y}):a.push({x:t.x,y:e.y});break;default:if(s=e.x,n=t.y,t.xMath.abs(i.y-t.y));let s=e.calculative.worldAnchors.findIndex(n=>n.id==t.id);if(s>1){let n=e.calculative.worldAnchors[s-1];if(n.x===t.x&&n.y!==t.y)return a.push({x:i.x,y:t.y}),a;if(n.y===t.y&&n.x!==t.x)return a.push({x:t.x,y:i.y}),a}return e.calculative.worldAnchors.length&&(i.isTemp=void 0,e.calculative.drawlineH?(a.push({x:i.x,y:t.y}),Math.abs(i.y-t.y){a.unshift(r)}));for(let r=0;r{a.unshift(r)}));for(let r=0;ro.id===t.id),s=le(e),n=Vt(e);let r=e.calculative.worldAnchors[a-1],l=e.calculative.worldAnchors[a+1];if(e.calculative.h==null&&(s.connectTo&&(br(e,t,!0)?e.calculative.h=!0:xr(e,t,!0)&&(e.calculative.h=!1)),e.calculative.h==null&&n.connectTo&&(br(e,t,!1)?e.calculative.h=!0:xr(e,t,!1)&&(e.calculative.h=!1)),e.calculative.h==null&&(r?e.calculative.h=r.y===t.y:l&&(e.calculative.h=l.y===t.y))),e.calculative.h){if(t.x=i.x,s.connectTo&&br(e,t,!0)){l&&l.y!==t.y&&(l.x=t.x);return}if(n.connectTo&&br(e,t,!1)){r&&r.y!==t.y&&(r.x=t.x);return}const o=e.anchors[a];let u;for(let c=a-1;c>-1;c--)if(r=e.anchors[c],u==null&&(u=r.y===o.y),u===!0)if(r.y===o.y)e.calculative.worldAnchors[c].y=i.y;else break;else if(r.x===o.x)e.calculative.worldAnchors[c].x=i.x;else break;u=void 0;for(let c=a+1;c-1;c--)if(r=e.anchors[c],u==null&&(u=r.x===o.x),u===!0)if(r.x===o.x)e.calculative.worldAnchors[c].x=i.x;else break;else if(r.y===o.y)e.calculative.worldAnchors[c].y=i.y;else break;u=void 0;for(let c=a+1;c1?(u=w.x-m.x,c=w.y-m.y):y>0?(u=w.x-(l+f*y),c=w.y-(o+g*y)):(u=w.x-l,c=w.y-o)):(u=w.x-l,c=w.y-o),_=u*u+c*c,_>n&&(r=x,n=_);return n>t&&(r-i>1&&s.push(...ac(e,t,i,r)),s.push({id:e[r].id,penId:e[r].penId,x:e[r].x,y:e[r].y}),a-r>1&&s.push(...ac(e,t,r,a))),s}function O_(e,t=.8,i=!1){if(e.length<3)return e;let a,s,n,r,l,o,u,c,f,g,v,m,w,y,_;const A=(x,C,T,I)=>(r=Math.sqrt(x*x+C*C),r>0?(m=x/r,y=C/r):(m=1,y=0),l=Math.sqrt(T*T+I*I),l>0?(w=T/l,_=I/l):(w=1,_=0),Math.acos(m*w+y*_));g=[],v=e.length,a=e[0],e[v-1],g.push({...e[0]});for(let x=0;x1){let c,f=0;for(let g=0;gr)&&y>o+r&&_-y>o&&(e.lineAnimateType===We.Arrow?z_(i,w,n,m,u,r):e.lineAnimateType===We.WaterDrop&&H_(i,w,e.animateReverse,m,u,r)),w.x+=l*Math.cos(m*Math.PI/180),w.y-=l*Math.sin(m*Math.PI/180),y=Math.sqrt((w.x-c.x)**2+(w.y-c.y)**2)}c=v}}if(i instanceof Path2D)return i}function N_(e,t){let i=t.x-e.x,a=t.y-e.y,s=Math.atan(a/i)*180/Math.PI;return t.x>=e.x?s=-s:s=180-s,s}function va(e,t,i){let a=(180-i)*Math.PI/180;return{x:(e.x-t.x)*Math.cos(a)-(e.y-t.y)*Math.sin(a)+t.x,y:(e.x-t.x)*Math.sin(a)+(e.y-t.y)*Math.cos(a)+t.y}}function z_(e,t,i,a,s,n){let r=va({x:t.x+i,y:t.y+.57*i},{x:t.x,y:t.y},a),l=va({x:t.x+i,y:t.y-.57*i},{x:t.x,y:t.y},a),o=va({x:t.x+i,y:t.y+s/2},{x:t.x,y:t.y},a),u=va({x:t.x+n,y:t.y+s/2},{x:t.x,y:t.y},a),c=va({x:t.x+i,y:t.y-s/2},{x:t.x,y:t.y},a),f=va({x:t.x+n,y:t.y-s/2},{x:t.x,y:t.y},a);e.moveTo(r.x,r.y),e.lineTo(t.x,t.y),e.lineTo(l.x,l.y),e.lineTo(c.x,c.y),e.lineTo(f.x,f.y),e.lineTo(u.x,u.y),e.lineTo(o.x,o.y),e.lineTo(r.x,r.y)}function H_(e,t,i,a,s,n){let r=s/2;i&&(r=-s/2);let l=va({x:t.x,y:t.y+r},{x:t.x,y:t.y},a),o=va({x:t.x+n,y:t.y},{x:t.x,y:t.y},a),u=Math.PI/2;i&&(u=-Math.PI/2),e.moveTo(t.x,t.y),e.arc(t.x,t.y,s/2,-u-a/180*Math.PI,u-a/180*Math.PI,!1),e.lineTo(o.x,o.y),e.lineTo(l.x,l.y)}function W_(e){var i;e.onDestroy||(e.onDestroy=U_,e.onMove=_r,e.onResize=_r,e.onRotate=_r,e.onValue=_r,e.onMouseMove=$_,e.onBeforeValue=V_,e.onRenderPenRaw=j_),e.calculative.singleton||(e.calculative.singleton={});const t=e.calculative.worldRect;if(!e.calculative.singleton.div){const a=document.createElement("div");a.style.position="absolute",a.style.outline="none",a.style.left="-9999px",a.style.top="-9999px",a.style.width=t.width+"px",a.style.height=t.height+"px",document.body.appendChild(a),(i=e.calculative.canvas.externalElements)==null||i.parentElement.appendChild(a),Fe(e,a),e.calculative.singleton.div=a;const s=document.createElement("iframe");s.style.width="100%",s.style.height="100%",s.scrolling=e.scrolling||"no",s.frameBorder="0",s.style.border="none",s.src=e.iframe,e.calculative.iframe=e.iframe,a.appendChild(s),mg(e),s.onload=()=>{s.setAttribute("document.domain","")}}return e.calculative.patchFlags&&Fe(e,e.calculative.singleton.div),e.onRenderPenRaw(e),new Path2D}function U_(e){yg(e),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function _r(e){e.calculative.singleton.div&&Fe(e,e.calculative.singleton.div)}function V_(e,t){if(t.iframe&&e.calculative.singleton.div&&(e.calculative.singleton.div.children[0].src=t.iframe,e.calculative.iframe=t.iframe),t.operationalRect||t["operationalRect.x"]!==void 0||t["operationalRect.y"]!==void 0||t["operationalRect.width"]!==void 0||t["operationalRect.height"]!==void 0){e.operationalRect||(e.operationalRect={});let i=ht(t);i.operationalRect||(i.operationalRect={}),i["operationalRect.x"]!==void 0&&(i.operationalRect.x=i["operationalRect.x"]),i["operationalRect.y"]!==void 0&&(i.operationalRect.y=i["operationalRect.y"]),i["operationalRect.width"]!==void 0&&(i.operationalRect.width=i["operationalRect.width"]),i["operationalRect.height"]!==void 0&&(i.operationalRect.height=i["operationalRect.height"]),Object.assign(e.operationalRect,i.operationalRect),e.calculative.singleton.div&&(e.calculative.singleton.div.children.length===1?mg(e):(e.calculative.singleton.div.children[1].style.height=e.operationalRect.y*100+"%",e.calculative.singleton.div.children[1].style.left=e.operationalRect.x*100+"%",e.calculative.singleton.div.children[1].style.width=e.operationalRect.width*100+"%",e.calculative.singleton.div.children[2].style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",e.calculative.singleton.div.children[3].style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",e.calculative.singleton.div.children[3].style.left=e.operationalRect.x*100+"%",e.calculative.singleton.div.children[3].style.width=e.operationalRect.width*100+"%",e.calculative.singleton.div.children[4].style.width=e.operationalRect.x*100+"%"))}if(t.blur!==void 0)for(let i=1;i<5;i++)e.calculative.singleton.div.children[i].style["backdrop-filter"]=`blur(${t.blur||2}px)`;if(t.blurBackground!==void 0)for(let i=1;i<5;i++)e.calculative.singleton.div.children[i].style.backgroundColor=t.blurBackground;return t}function $_(e,t){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&vg(e.operationalRect)&&e.calculative.zIndex<5&&t.x>e.x+e.width*e.operationalRect.x&&t.xe.y+e.height*e.operationalRect.y&&t.y{yg(e)};i.onmouseenter=r,s.onmouseenter=r,a.onmouseenter=r,n.onmouseenter=r,t.onmouseleave=r}function yg(e){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&e.calculative.zIndex<5){let t=e.calculative.singleton.div.parentNode.children;for(let i=1;i<6;i++)t[i].style.pointerEvents="initial"}}function j_(e){if(e.thumbImg&&!e.calculative.img){const t=new Image;t.crossOrigin=e.crossOrigin==="undefined"?void 0:e.crossOrigin||"anonymous",e.calculative.canvas.store.options.cdn&&!(e.thumbImg.startsWith("http")||e.thumbImg.startsWith("//")||e.thumbImg.startsWith("data:image"))?t.src=e.calculative.canvas.store.options.cdn+e.thumbImg:t.src=e.thumbImg,t.onerror=i=>{t.remove(),e.calculative.img=void 0},e.calculative.img=t}}const Ve={},Br=['',''];function q_(e){var t;if(e.onDestroy||(e.onDestroy=Y_,e.onMove=Bl,e.onResize=Bl,e.onRotate=Bl,e.onClick=Lf,e.onValue=X_,e.onChangeId=K_),Ve[e.id])e.video&&e.calculative.media&&e.video!==e.calculative.video?(console.warn("video \u66F4\u6539, \u6B64\u5904\u662F\u5426\u6267\u884C\uFF1F"),e.calculative.media.src=e.video,e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop,e.calculative.video=e.video):e.audio&&e.calculative.media&&e.audio!==e.calculative.audio&&(e.calculative.media.src=e.audio,e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop,e.calculative.audio=e.audio);else{const i=document.createElement("div"),a=document.createElement("div");a.style.position="absolute",a.style.outline="none",a.style.left="0",a.style.bottom="0",a.style.width="0",a.style.height="2px",a.style.background="#52c41a",a.style.zIndex="1",e.hideProgress&&(a.style.display="none");const s=document.createElement("div");s.innerHTML=Br[1],s.style.position="absolute",s.style.right="0",s.style.bottom="0",s.style.width="20px",s.style.height="20px",s.style.fill="hsla(0, 0%, 100%, .8)",s.style.zIndex="1",s.style.display="none",i.appendChild(a),i.appendChild(s),s.onclick=r=>{r.stopPropagation(),e.calculative.media.muted?(s.innerHTML=Br[0],e.calculative.media.muted=!1):(s.innerHTML=Br[1],e.calculative.media.muted=!0)},e.calculative.singleton||(e.calculative.singleton={}),e.calculative.singleton.muted=s,i.onmouseenter=r=>{e.hideMuted||(s.style.display="block")},i.onmouseleave=r=>{s.style.display="none"},i.onclick=r=>{r.stopPropagation(),Lf(e)};let n;e.audio?(n=document.createElement("audio"),n.controls=e.controls,n.src=e.audio):(n=document.createElement("video"),n.src=e.video),n.loop=e.playLoop,n.ontimeupdate=()=>{pg(a,n,e.calculative.worldRect.width)},n.onended=()=>{e.calculative.onended&&e.calculative.onended(e)},e.calculative.media=n,n.style.position="absolute",n.style.outline="none",n.style.left="0",n.style.top="0",n.style.width="100%",n.style.height="100%",n.style.objectFit=e.objectFit||"contain",i.appendChild(n),Ve[e.id]=i,(t=e.calculative.canvas.externalElements)==null||t.parentElement.appendChild(i),Fe(e,i),e.autoPlay&&(n.autoplay=!0,n.muted=!0)}return e.calculative.patchFlags&&Fe(e,Ve[e.id]),new Path2D}function Y_(e){Ve[e.id].onclick=null,Ve[e.id].remove(),Ve[e.id]=void 0}function Bl(e){Fe(e,Ve[e.id]);const t=Ve[e.id].children[0],i=Ve[e.id].children[1];pg(t,i,e.calculative.worldRect.width)}function Lf(e){e.calculative.media&&(e.calculative.media.muted=!1,e.calculative.singleton.muted.innerHTML=Br[0],e.calculative.media.paused?e.calculative.media.play():e.calculative.media.pause())}function pg(e,t,i){e.style.width=t.currentTime/t.duration*i+"px"}function K_(e,t,i){!Ve[t]||(Ve[i]=Ve[t],delete Ve[t])}function X_(e){const t=Ve[e.id];if(!t)return;Fe(e,t),e.calculative.media||(e.calculative.media=t.querySelector("video"));const i=e.calculative.media.getAttribute("src");e.video?i!==e.video&&(e.calculative.media.src=e.video):e.audio&&i!==e.audio&&(e.calculative.media.src=e.audio),e.autoPlay&&(e.calculative.media.muted=!0,e.calculative.media.autoplay=!0),e.calculative.media.loop=e.playLoop}function Pi(){try{const e=new OffscreenCanvas(0,0),t=e.getContext("2d");return t&&t.arc?e:document.createElement("canvas")}catch{return document.createElement("canvas")}}class on{constructor(t,i){W(this,"parentElement");W(this,"store");W(this,"box");W(this,"text");W(this,"arrowUp");W(this,"arrowDown");W(this,"x");W(this,"y");W(this,"currentPen");this.parentElement=t,this.store=i,this.box=document.createElement("div"),this.text=document.createElement("div"),this.arrowUp=document.createElement("div"),this.arrowDown=document.createElement("div"),this.box.className="meta2d-tooltip",this.text.className="text",this.arrowUp.className="arrow",this.arrowDown.className="arrow down",this.box.appendChild(this.text),this.box.appendChild(this.arrowUp),this.box.appendChild(this.arrowDown),t.appendChild(this.box),this.box.onmouseleave=()=>{this.hide(),this.store.lastHover=void 0};let a;for(let s=0;s0?(this.arrowUp.style.borderBottomColor="transparent",this.arrowDown.style.borderTopColor="#777777"):(r+=a.height+s.height+5,this.arrowUp.style.borderBottomColor="#777777",this.arrowDown.style.borderTopColor="transparent"),this.x=n,this.y=r,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"}hide(){this.currentPen=null,this.x=-9999,this.box.style.left="-9999px"}translate(t,i){this.x<-1e3||(this.x+=t,this.y+=i,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px")}destroy(){this.box.onmouseleave=null}}class wg{constructor(t){W(this,"parent");W(this,"h");W(this,"v");W(this,"isDownH");W(this,"isDownV");W(this,"x");W(this,"y");W(this,"hSize");W(this,"vSize");W(this,"scrollX");W(this,"scrollY");W(this,"lastScrollX");W(this,"lastScrollY");W(this,"rect");W(this,"isShow");W(this,"pageMode");W(this,"onMouseDownH",t=>{t.preventDefault(),t.stopPropagation(),this.isDownH=t.x,this.x=this.parent.store.data.x||0,this.lastScrollX=this.scrollX});W(this,"onMouseDownV",t=>{t.preventDefault(),t.stopPropagation(),this.isDownV=t.y,this.y=this.parent.store.data.y||0,this.lastScrollY=this.scrollY});W(this,"onMouseMove",t=>{if(this.isDownH){const i=t.x-this.isDownH;this.scrollX=this.lastScrollX+i,this.h.style.left=`${this.scrollX}px`,this.parent.store.data.x=this.x-i*this.rect.width/this.parent.parentElement.clientWidth}if(this.isDownV){const i=t.y-this.isDownV;if(this.pageMode&&this.canMouseMove(i))return;this.scrollY=this.lastScrollY+i,this.v.style.top=`${this.scrollY}px`,this.parent.store.data.y=this.y-i*this.rect.height/this.parent.parentElement.clientHeight}(this.isDownH||this.isDownV)&&(this.parent.onMovePens(),this.parent.canvasTemplate.init(),this.parent.canvasImage.init(),this.parent.canvasImageBottom.init(),this.parent.render())});W(this,"onMouseUp",t=>{!this.isDownH&&!this.isDownV||(this.isDownH=void 0,this.isDownV=void 0,this.scrollX<20?(this.scrollX=20,this.h.style.left=`${this.scrollX}px`):this.scrollX>this.parent.parentElement.clientWidth-this.hSize-20&&(this.scrollX=this.parent.parentElement.clientWidth-this.hSize-20,this.h.style.left=`${this.scrollX}px`),this.scrollY<20?(this.scrollY=20,this.v.style.top=`${this.scrollY}px`):this.scrollY>this.parent.parentElement.clientHeight-this.vSize-20&&(this.scrollY=this.parent.parentElement.clientHeight-this.vSize-20,this.v.style.top=`${this.scrollY}px`),this.resize())});this.parent=t,this.h=document.createElement("div"),this.v=document.createElement("div"),this.parent.externalElements.appendChild(this.h),this.parent.externalElements.appendChild(this.v),this.h.className="meta2d-scroll h",this.h.onmousedown=this.onMouseDownH,this.v.className="meta2d-scroll v",this.v.onmousedown=this.onMouseDownV,document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp);let i;for(let a=0;a=0||t>0&&i.ey-this.parent.height+this.parent.store.data.y<=0}changeMode(){this.pageMode=!0,this.h.style.display="none",this.parent.parent.getRect().height0?this.rect.width+=this.parent.store.data.x+(this.rect.x>0?0:this.rect.x):this.rect.width-=this.parent.store.data.x+(this.rect.x>0?0:this.rect.x),this.parent.store.data.y>0?this.rect.height+=this.parent.store.data.y+(this.rect.y>0?0:this.rect.y):this.rect.height-=this.parent.store.data.y+(this.rect.y>0?0:this.rect.y),this.rect.width<1400&&(this.rect.width=1400),this.rect.height<900&&(this.rect.height=900),this.hSize=1e3*this.parent.parentElement.clientWidth/this.rect.width/3,this.vSize=1e3*this.parent.parentElement.clientHeight/this.rect.height/3,this.h.style.width=this.hSize+"px",this.v.style.height=this.vSize+"px"}show(){this.isShow=!0,this.h.style.display="block",this.v.style.display="block",document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)}hide(){this.isShow=!1,this.h.style.display="none",this.v.style.display="none",this.destroy()}translate(t,i){t&&(this.scrollX-=t*this.parent.parentElement.clientWidth/this.rect.width,this.h.style.left=`${this.scrollX}px`),i&&(this.scrollY-=i*this.parent.parentElement.clientHeight/this.rect.height,this.v.style.top=`${this.scrollY}px`)}wheel(t){let i=10;t&&(i=-10),!(this.pageMode&&this.canMouseMove(i))&&(this.scrollY+=i,this.v.style.top=`${this.scrollY}px`,this.parent.store.data.y-=i*this.rect.height/this.parent.parentElement.clientHeight,this.parent.onMovePens(),this.parent.canvasTemplate.init(),this.parent.canvasImage.init(),this.parent.canvasImageBottom.init(),this.parent.render())}destroy(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)}}class Mf{constructor(t,i,a){W(this,"parentElement");W(this,"store");W(this,"isBottom");W(this,"canvas",document.createElement("canvas"));W(this,"otherOffsreen",Pi());W(this,"offscreen",Pi());W(this,"animateOffsScreen",Pi());W(this,"fitOffscreen",Pi());W(this,"fitFlag",!1);W(this,"currentFit");W(this,"activeFit");this.parentElement=t,this.store=i,this.isBottom=a,t.appendChild(this.canvas),this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.position="absolute",this.canvas.style.top="0",this.canvas.style.left="0"}resize(t,i){this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",t=t*this.store.dpiRatio|0,i=i*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=i,this.otherOffsreen.width=t,this.otherOffsreen.height=i,this.offscreen.width=t,this.offscreen.height=i,this.animateOffsScreen.width=t,this.animateOffsScreen.height=i,this.fitOffscreen.width=t,this.fitOffscreen.height=i,this.otherOffsreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.otherOffsreen.getContext("2d").textBaseline="middle",this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.animateOffsScreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.animateOffsScreen.getContext("2d").textBaseline="middle",this.fitOffscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.fitOffscreen.getContext("2d").textBaseline="middle",this.init()}init(){this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.animateOffsScreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.fitOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);for(const t of this.store.data.pens)this.hasImage(t)&&(t.calculative.imageDrawed=!1);this.isBottom?this.store.patchFlagsBackground=!0:this.store.patchFlagsTop=!0}clear(){this.otherOffsreen.getContext("2d").clearRect(0,0,this.otherOffsreen.width,this.otherOffsreen.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.animateOffsScreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.fitOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)}hasImage(t){return t.calculative.hasImage=t.calculative&&t.calculative.inView&&(this.isBottom&&t.canvasLayer===zt.CanvasImageBottom||!this.isBottom&&t.canvasLayer===zt.CanvasImage)&&t.image&&t.calculative.img&&t.name!=="gif",t.calculative.hasImage}render(){var r;let t=!1,i=!1;for(const l of this.store.data.pens)this.hasImage(l)&&(this.store.animates.has(l)?i=!0:l.calculative.imageDrawed||(t=!0),l.parentId&&this.store.animates.has(ti(l,!0))&&(i=!0));const a=this.store.patchFlagsBackground,s=this.store.patchFlagsTop;if(s&&!this.isBottom){const l=this.otherOffsreen.getContext("2d");l.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderRule(l)}if(this.store.patchFlagsLast&&this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),t){const l=this.offscreen.getContext("2d");l.save(),l.clearRect(0,0,this.canvas.width,this.canvas.height),l.translate(this.store.data.x,this.store.data.y);for(const o of this.store.data.pens)!o.calculative.hasImage||this.store.animates.has(o)||this.store.animates.has(ti(o,!0))||o.canvasLayer!==zt.CanvasTemplate&&(o.calculative.imageDrawed=!0,l.save(),za(l,o),o.calculative.rotate&&Gi(l,o),Ha(l,o),Es(l,o),l.restore());l.restore()}if(i){const l=this.animateOffsScreen.getContext("2d");l.save(),l.clearRect(0,0,this.canvas.width,this.canvas.height),l.translate(this.store.data.x,this.store.data.y);for(const o of this.store.animates)!o.calculative.hasImage||o.canvasLayer!==zt.CanvasTemplate&&(o.visible===!1||o.calculative.visible===!1||(o.calculative.imageDrawed=!0,l.save(),za(l,o),o.calculative.rotate&&Gi(l,o),Ha(l,o),Es(l,o),l.restore()));for(const o of this.store.data.pens)!o.calculative.hasImage||!o.parentId||o.canvasLayer!==zt.CanvasTemplate&&(o.visible===!1||o.calculative.visible===!1||this.store.animates.has(ti(o,!0))&&(o.calculative.imageDrawed=!0,l.save(),za(l,o),o.calculative.rotate&&Gi(l,o),Ha(l,o),Es(l,o),l.restore()));l.restore()}if(!this.isBottom&&!this.store.data.locked&&this.fitFlag){const l=(this.store.data.width||this.store.options.width)*this.store.data.scale,o=(this.store.data.height||this.store.options.height)*this.store.data.scale,u=this.store.data.origin.x+this.store.data.x||this.store.options.x||0,c=this.store.data.origin.y+this.store.data.y||this.store.options.y||0,f=this.fitOffscreen.getContext("2d");f.save(),f.clearRect(0,0,this.canvas.width,this.canvas.height),f.fillStyle="#ffffff66",f.strokeStyle=this.store.styles.activeColor,(r=this.store.data.fits)==null||r.forEach((g,v)=>{f.fillRect(u+l*g.x,c+o*g.y,l*g.width,o*g.height),g.active&&f.strokeRect(u+l*g.x,c+o*g.y,l*g.width,o*g.height)}),f.restore()}if(t||i||a&&this.isBottom||s&&!this.isBottom){const l=this.canvas.getContext("2d");l.clearRect(0,0,this.canvas.width,this.canvas.height),this.isBottom&&(this.store.patchFlagsBackground=!1),l.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),l.drawImage(this.animateOffsScreen,0,0,this.canvas.width,this.canvas.height),this.isBottom||(l.drawImage(this.otherOffsreen,0,0,this.canvas.width,this.canvas.height),this.store.patchFlagsTop=!1,!this.store.data.locked&&this.fitFlag&&l.drawImage(this.fitOffscreen,0,0,this.canvas.width,this.canvas.height))}}renderRule(t){var x,C,T,I,D,B,V,Q;const{data:i,options:a}=this.store,{rule:s,ruleColor:n,scale:r,origin:l}=i;if(!(s!=null?s:a.rule))return;const o=r*10;t.save();const u=n||a.ruleColor||"#ccc";t.strokeStyle=Wr(u,.7);const c=l.x+i.x,f=l.y+i.y,{width:g,height:v}=this.canvas;let m=((x=a.ruleOptions)==null?void 0:x.height)||20;(C=a.ruleOptions)!=null&&C.background&&(t.beginPath(),t.fillStyle=(T=a.ruleOptions)==null?void 0:T.background,t.rect(0,0,g,m),t.fill(),t.rect(0,0,m,v),t.fill()),(I=a.ruleOptions)!=null&&I.underline&&(t.beginPath(),t.fillStyle=Wr(u,.7),t.moveTo(0,m),t.lineTo(g,m),t.stroke(),t.moveTo(m,0),t.lineTo(m,v),t.stroke());let w=m/4;((D=a.ruleOptions)==null?void 0:D.baseline)==="bottom"&&(w=m*3/4),t.beginPath(),t.lineWidth=m/2,t.lineDashOffset=-c%o,t.setLineDash([1,o-1]),t.moveTo(0,w),t.lineTo(g,w),t.stroke(),t.beginPath(),t.lineDashOffset=-f%o,t.moveTo(w,0),t.lineTo(w,v),t.stroke(),t.strokeStyle=u,t.beginPath(),t.lineWidth=m,t.lineDashOffset=-c%(o*10),t.setLineDash([1,o*10-1]),t.moveTo(0,m/2),t.lineTo(g,m/2),t.stroke(),t.beginPath(),t.lineDashOffset=-f%(o*10),t.moveTo(m/2,0),t.lineTo(m/2,v),t.stroke(),t.beginPath(),t.fillStyle=((B=a.ruleOptions)==null?void 0:B.textColor)||t.strokeStyle;let y=0-Math.floor(c/o/10)*100,_=((V=a.ruleOptions)==null?void 0:V.textTop)||16,A=((Q=a.ruleOptions)==null?void 0:Q.textLeft)||4;c<0&&(y-=100);for(let F=c%(o*10);F{a.drawImage(o,s.x-t,s.y-t,this.magnifierSize,this.magnifierSize,0,0,this.magnifierSize,this.magnifierSize)}),a.restore(),a.beginPath();const r=a.createRadialGradient(t,t,t-5,t,t,t);r.addColorStop(0,"rgba(0,0,0,0.2)"),r.addColorStop(.8,"rgb(200,200,200)"),r.addColorStop(.9,"rgb(200,200,200)"),r.addColorStop(1,"rgba(200,200,200,0.9)"),a.strokeStyle=r,a.arc(t,t,t,0,Math.PI*2,!1),a.stroke(),a.restore(),this.offscreen.getContext("2d").drawImage(this.magnifierScreen,0,0,this.magnifierSize+5,this.magnifierSize+5,(s.x-t-2.5)/this.store.dpiRatio,(s.y-t-2.5)/this.store.dpiRatio,(this.magnifierSize+5)/this.store.dpiRatio,(this.magnifierSize+5)/this.store.dpiRatio)}updateDomOffscreen(){const t=this.domOffscreen.getContext("2d");t.clearRect(0,0,this.domOffscreen.width,this.domOffscreen.height);for(const i of this.store.data.pens)if((i.externElement||i.name==="gif")&&i.calculative.img){t.save(),t.translate(this.store.data.x,this.store.data.y);const{x:a,y:s,width:n,height:r}=i.calculative.worldRect;t.drawImage(i.calculative.img,a,s,n,r),t.restore()}}render(){this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.renderMagnifier();const t=this.canvas.getContext("2d");t.clearRect(0,0,this.canvas.width,this.canvas.height),t.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height)}}function bg(e){if(e.data.locked)throw new Error("canvas is locked")}class Z_{constructor(t,i){W(this,"parentElement");W(this,"box");W(this,"iframe");W(this,"dialog");W(this,"close");W(this,"title");W(this,"body");W(this,"x");W(this,"y");W(this,"url");W(this,"meta2dDiv");W(this,"dialogMeta2d");W(this,"store");this.parentElement=t,this.store=i,this.box=document.createElement("div"),this.dialog=document.createElement("div");let a=document.createElement("div");this.title=document.createElement("div"),this.close=document.createElement("span"),this.close.innerHTML=` `,this.body=document.createElement("div"),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.meta2dDiv=document.createElement("div"),this.box.className="meta2d-dialog_mask",this.dialog.className="meta2d-dialog",this.body.className="meta2d-dialog_body",a.className="meta2d-dialog_header",this.title.className="meta2d-dialog-content",this.close.className="meta2d-dialog-close",this.meta2dDiv.className="meta2d-dialog-meta2d",a.appendChild(this.title),a.appendChild(this.close),this.body.appendChild(this.iframe),this.body.appendChild(this.meta2dDiv),this.dialog.appendChild(a),this.dialog.appendChild(this.body),this.box.appendChild(this.dialog),t.appendChild(this.box),this.dialog.onclick=n=>{n.stopPropagation()},this.box.onclick=()=>{this.hide()},this.close.onclick=()=>{this.hide()};let s;for(let n=0;n{this.iframe.contentWindow.meta2d&&(clearInterval(l),setTimeout(()=>{this.iframe.contentWindow.postMessage(JSON.stringify({name:"dialog",data:s}),"*")},100)),r++,r>50&&clearInterval(l)},300)}if((!this.dialogMeta2d||n)&&(this.box.style.display="block"),!n){this.meta2dDiv.style.display="block",this.dialogMeta2d||(globalThis.mainMeta2d=globalThis.meta2d,this.dialogMeta2d=new TE(this.meta2dDiv),globalThis.meta2d=globalThis.mainMeta2d);const r=await $d(this.store,i);r&&(this.box.style.display="block",this.dialogMeta2d.clear(!0),this.dialogMeta2d.open(r,!1),this.dialogMeta2d.lock(1),this.dialogMeta2d.resize(),this.dialogMeta2d.fitView(!0,0),this.dialogMeta2d.render(!0))}}hide(){this.box.style.display="none"}isUrl(t){return!!(t.startsWith("http")||t.includes("?")||t.includes("/"))}destroy(){var t;this.dialog.onclick=void 0,this.box.onclick=void 0,this.close.onclick=void 0,(t=this.dialogMeta2d)==null||t.destroy(!0)}}class Kr{constructor(t){W(this,"parentElement");W(this,"box");W(this,"currentAnchor");this.parentElement=t,this.box=document.createElement("div"),this.box.className="meta2d-title",t.appendChild(this.box);let i;for(let a=0;a{const f=c.x*s.x+c.y*s.y;l=Math.min(l,f),o=Math.max(o,f)});const u=Math.ceil((o-l)/a);e.beginPath();for(let c=0;c<=u;c++){const f=l+c*a;let g=[];for(let v=0;v1e-6){const _=(f-m.x*s.x-m.y*s.y)/(s.x*(w.x-m.x)+s.y*(w.y-m.y));if(_>=0&&_<=1){const A=m.x+_*(w.x-m.x),x=m.y+_*(w.y-m.y);g.push({x:A,y:x})}}}g.length>=2&&(e.moveTo(g[0].x,g[0].y),e.lineTo(g[1].x,g[1].y))}e.stroke()}function Nf(e,t,i,a,s,n,r,l){const o=[{x:t,y:i},{x:t+a,y:i},{x:t+a,y:i+s},{x:t,y:i+s}];let u=1/0,c=-1/0;o.forEach(m=>{const w=m.x*r.x+m.y*r.y;u=Math.min(u,w),c=Math.max(c,w)});const f=c-u,g=Math.ceil(f/n),v=u;e.beginPath();for(let m=0;m<=g;m++){const w=v+m*n,y=[];for(let _=0;_1e-6){const D=(w-A.x*r.x-A.y*r.y)/(r.x*C+r.y*T);D>=0&&D<=1&&y.push({x:A.x+D*C,y:A.y+D*T})}}y.length>=2&&(e.moveTo(y[0].x,y[0].y),e.lineTo(y[1].x,y[1].y))}e.stroke()}const Q_={success:{},info:{icon:''},warning:{},error:{}};class tE{constructor(t,i){W(this,"parentElement");W(this,"store");W(this,"box");W(this,"text");W(this,"arrowUp");W(this,"arrowDown");W(this,"icon");W(this,"confirm");W(this,"cancel");W(this,"x");W(this,"y");this.parentElement=t,this.store=i,this.box=document.createElement("div"),this.text=document.createElement("div"),this.arrowUp=document.createElement("div"),this.arrowDown=document.createElement("div"),this.icon=document.createElement("div"),this.confirm=document.createElement("button"),this.cancel=document.createElement("button"),this.box.className="meta2d-popconfirm",this.text.className="text",this.arrowUp.className="arrow",this.arrowDown.className="arrow down",this.icon.className="icon",this.confirm.className="confirm",this.cancel.className="cancel",this.confirm.innerHTML="\u786E\u5B9A",this.cancel.innerHTML="\u53D6\u6D88",this.icon.innerHTML=Q_.info.icon,this.box.appendChild(this.text),this.box.appendChild(this.arrowUp),this.box.appendChild(this.arrowDown),this.box.appendChild(this.confirm),this.box.appendChild(this.cancel),this.box.appendChild(this.icon),t.appendChild(this.box);let a;for(let s=0;s0?(this.arrowUp.style.borderBottomColor="transparent",this.arrowDown.style.borderTopColor="#fff",r-=10):(r+=a.height+s.height+5,r+=10,this.arrowUp.style.borderBottomColor="#fff",this.arrowDown.style.borderTopColor="transparent"),this.x=n,this.y=r,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"}hide(){this.x=-9999,this.box.style.left="-9999px"}showModal(t,i,a){return new Promise(s=>{this.text.innerHTML=a||"\u786E\u8BA4\u6267\u884C\u64CD\u4F5C\u5417\uFF1F",this.show(t,i),this.confirm.onclick=()=>{s(!0),this.hide()},this.cancel.onclick=()=>{s(!1),this.hide()}})}destroy(){this.box=null}}const He="-moving";class zf{constructor(t,i,a){W(this,"parent");W(this,"parentElement");W(this,"store");W(this,"canvas",document.createElement("canvas"));W(this,"offscreen",Pi());W(this,"width");W(this,"height");W(this,"externalElements",document.createElement("div"));W(this,"clientRect");W(this,"canvasRect");W(this,"activeRect");W(this,"initActiveRect");W(this,"dragRect");W(this,"lastRotate",0);W(this,"sizeCPs");W(this,"activeInitPos");W(this,"hoverType",xt.None);W(this,"resizeIndex",0);W(this,"mouseDown");W(this,"hotkeyType");W(this,"mouseRight");W(this,"addCaches");W(this,"touchCenter");W(this,"initTouchDis");W(this,"initScale");W(this,"touchScaling");W(this,"touchMoving");W(this,"startTouches");W(this,"lastOffsetX",0);W(this,"lastOffsetY",0);W(this,"drawingLineName");W(this,"drawLineFns",[...vx]);W(this,"drawingLine");W(this,"pencil");W(this,"pencilLine");W(this,"movingPens");W(this,"patchFlagsLines",new Set);W(this,"dock");W(this,"prevAnchor");W(this,"nextAnchor");W(this,"lastMouseTime",0);W(this,"hoverTimer",0);W(this,"fitTimer",0);W(this,"willInactivePen");W(this,"patchFlags",!1);W(this,"lastRender",0);W(this,"touchStart",0);W(this,"touchStartTimer");W(this,"timer");W(this,"lastAnimateRender",0);W(this,"animateRendering",!1);W(this,"renderTimer");W(this,"initPens");W(this,"pointSize",8);W(this,"pasteOffset",!0);W(this,"opening",!1);W(this,"maxZindex",5);W(this,"canMoveLine",!1);W(this,"randomIdObj");W(this,"keyOptions");W(this,"beforeAddPen");W(this,"beforeAddPens");W(this,"beforeAddAnchor");W(this,"beforeRemovePens");W(this,"beforeRemoveAnchor");W(this,"customResizeDock");W(this,"customMoveDock");W(this,"inputParent",document.createElement("div"));W(this,"inputDiv",document.createElement("div"));W(this,"dropdown",document.createElement("ul"));W(this,"tooltip");W(this,"popconfirm");W(this,"title");W(this,"mousePos",{x:0,y:0});W(this,"scroll");W(this,"movingAnchor");W(this,"canvasTemplate");W(this,"canvasImage");W(this,"canvasImageBottom");W(this,"magnifierCanvas");W(this,"dialog");W(this,"autoPolylineFlag",!1);W(this,"stopPropagation",t=>{t.stopPropagation()});W(this,"curve",x_);W(this,"polyline",P_);W(this,"mind",E_);W(this,"line",k_);W(this,"onCopy",t=>{this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements||this.copy()});W(this,"onCut",t=>{this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements||this.cut()});W(this,"onPaste",async t=>{if(this.store.data.locked||this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements)return;let i;if(navigator.clipboard&&t.clipboardData){const a=t.clipboardData.items;if(a){for(let s=0;s{if(typeof t.data!="string"||!t.data||t.data.startsWith("setImmediate")||t.data.startsWith("webpackHotUpdate"))return;let i=JSON.parse(t.data);typeof i=="object"?this.parent.doMessageEvent(i.name,JSON.stringify(i.data)):this.parent.doMessageEvent(i)});W(this,"onwheel",t=>{if(this.inputDiv.contentEditable==="true"||this.drawingLine||this.pencil)return;if(this.store.hover&&this.store.hover.onWheel){this.store.hover.onWheel(this.store.hover,t);return}if(this.store.data.disableScale||this.store.options.disableScale||(t.preventDefault(),t.stopPropagation(),this.mouseDown&&(this.hoverType===xt.Node||this.hoverType===xt.Line))||this.store.data.locked===Mt.Disable||this.store.data.locked===Mt.DisableScale||this.store.data.locked===Mt.DisableMoveScale)return;if(!t.ctrlKey&&Math.abs(t.wheelDelta)<100&&t.deltaY.toString().indexOf(".")===-1){if(this.store.options.scroll&&!t.metaKey&&this.scroll){this.scroll.wheel(t.deltaY<0);return}const n=this.store.data.scale||1;this.translate(-t.deltaX/n,-t.deltaY/n);return}if(Math.abs(t.wheelDelta)>100&&this.store.options.scroll&&this.scroll&&!this.store.options.scrollButScale&&!(t.ctrlKey||t.metaKey)){this.scroll.wheel(t.deltaY<0);return}if(this.store.options.disableTouchPadScale)return;let i=.015;if(this.store.options.scaleOff)i=this.store.options.scaleOff,t.deltaY>0&&(i=-this.store.options.scaleOff);else if(/mac os /i.test(navigator.userAgent))t.ctrlKey?t.deltaY>0&&(i*=-1):i*=t.wheelDeltaY/240;else{let r=.2;t.deltaY.toString().indexOf(".")!==-1&&(r=.01),t.deltaY>0?i=-r:i=r}let{offsetX:a,offsetY:s}=t;this.scale(this.store.data.scale+i,{x:a,y:s}),this.externalElements.focus()});W(this,"onkeydown",t=>{var n,r,l;if(this.store.data.locked>=Mt.DisableEdit&&t.target.tagName!=="INPUT"&&t.target.tagName!=="TEXTAREA"&&!t.target.dataset.meta2dIgnore&&this.store.active.forEach(o=>{var u;(u=o.onKeyDown)==null||u.call(o,o,t.key)}),this.store.data.locked>=Mt.DisableEdit||t.target.tagName==="INPUT"||t.target.tagName==="TEXTAREA"||t.target.dataset.meta2dIgnore||this.store.options.unavailableKeys.includes(t.key))return;this.keyOptions||(this.keyOptions={}),this.keyOptions.altKey=t.altKey,this.keyOptions.shiftKey=t.shiftKey,this.keyOptions.ctrlKey=t.ctrlKey,this.keyOptions.metaKey=t.metaKey,this.keyOptions.F=!1,(t.key==="F"||t.key==="f")&&(this.keyOptions.F=!0);let i=10,a=10,s=null;if(this.store.options.strictScope){const o=this.store.data.width||this.store.options.width,u=this.store.data.height||this.store.options.height;o&&u&&(s={x:this.store.data.origin.x,y:this.store.data.origin.y,width:o*this.store.data.scale,height:u*this.store.data.scale})}switch(t.key){case" ":this.hotkeyType=Yt.Translate;break;case"Control":this.drawingLine?this.drawingLine.calculative.drawlineH=!this.drawingLine.calculative.drawlineH:this.hotkeyType||(this.patchFlags=!0,this.hotkeyType=Yt.Select);break;case"Meta":break;case"Shift":this.store.active.length===1&&this.store.active[0].type&&this.store.activeAnchor?this.toggleAnchorHand():this.hotkeyType||(this.patchFlags=!0,this.store.options.resizeMode||(this.hotkeyType=Yt.Resize));break;case"Alt":if(!t.ctrlKey&&!t.shiftKey&&this.drawingLine){const o=Vt(this.drawingLine);o!==this.drawingLine.calculative.activeAnchor?(bc(this.drawingLine),this.drawingLine.calculative.worldAnchors.push(o)):this.drawingLine.calculative.worldAnchors.push({x:o.x,y:o.y});const u=this.drawLineFns.indexOf(this.drawingLineName);this.drawingLineName=this.drawLineFns[(u+1)%this.drawLineFns.length],this.drawingLine.lineName=this.drawingLineName,this.drawline(),this.patchFlags=!0}t.preventDefault();break;case"a":case"A":t.ctrlKey||t.metaKey?(this.active(this.store.data.pens.filter(o=>!o.parentId&&o.locked!==Mt.Disable)),t.preventDefault()):this.toggleAnchorMode();break;case"Delete":case"Backspace":if(this.canvasImage.fitFlag&&this.canvasImage.activeFit){this.deleteFit();break}!this.store.data.locked&&this.delete();break;case"ArrowLeft":if(this.movingAnchor){this.translateAnchor(-1,0);break}if(i=-1,t.shiftKey&&(i=-5),(t.ctrlKey||t.metaKey)&&(i=-10),i=i*this.store.data.scale,this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){this.moveLineAnchor({x:this.store.activeAnchor.x+i,y:this.store.activeAnchor.y},{});break}s&&this.activeRect.x+is.x+s.width&&(i=s.x+s.width-(this.activeRect.x+this.activeRect.width)),this.translatePens(this.store.active,i,0);break;case"ArrowDown":if(this.movingAnchor){this.translateAnchor(0,1);break}if(a=1,t.shiftKey&&(a=5),(t.ctrlKey||t.metaKey)&&(a=10),a=a*this.store.data.scale,s&&this.activeRect.y+this.activeRect.height+a>s.y+s.height&&(a=s.y+s.height-(this.activeRect.y+this.activeRect.height)),this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){this.moveLineAnchor({x:this.store.activeAnchor.x,y:this.store.activeAnchor.y+a},{});break}this.translatePens(this.store.active,0,a);break;case"d":case"D":(n=this.store.active[0])!=null&&n.locked||this.removeAnchorHand();break;case"h":case"H":(r=this.store.active[0])!=null&&r.locked||this.addAnchorHand();break;case"m":case"M":this.toggleMagnifier();break;case"g":case"G":if(t.ctrlKey||t.metaKey){t.shiftKey?this.parent.uncombine():this.store.active.length>1&&this.parent.combine(this.store.active),t.preventDefault();break}this.hoverType===xt.NodeAnchor&&(this.movingAnchor=this.store.hoverAnchor,this.externalElements.style.cursor="move");break;case"s":case"S":!this.store.data.locked&&this.hoverType===xt.LineAnchor&&this.store.hover===this.store.active[0]&&this.splitLine(this.store.active[0],this.store.hoverAnchor),(t.ctrlKey||t.metaKey)&&this.store.emitter.emit("save",{event:t});break;case"c":case"C":(t.ctrlKey||t.metaKey)&&this.store.options.disableClipboard&&this.copy();break;case"x":case"X":(t.ctrlKey||t.metaKey)&&this.store.options.disableClipboard&&this.cut();break;case"\u221A":case"v":case"V":!t.ctrlKey&&!t.metaKey&&(this.pencil&&this.stopPencil(),this.drawingLineName?(this.finishDrawline(),this.drawingLineName=""):this.drawingLineName=this.store.options.drawingLineName),!this.store.data.locked&&(t.ctrlKey||t.metaKey)&&(this.store.options.disableClipboard||!this.store.options.disableClipboard&&t.altKey)&&this.paste();break;case"b":case"B":this.drawingLineName&&(this.finishDrawline(),this.drawingLineName=""),this.pencil?this.stopPencil():this.drawingPencil();break;case"y":case"Y":(t.ctrlKey||t.metaKey)&&this.redo();break;case"z":case"Z":t.ctrlKey||t.metaKey?this.undo():t.shiftKey&&this.redo();break;case"Enter":this.drawingLineName&&(this.finishDrawline(!0),this.store.active[0].anchors[0].connectTo?this.drawingLineName="":this.drawingLineName=this.store.options.drawingLineName),this.store.active&&(this.store.active.forEach(o=>{o.type?(o.close=!o.close,o.close&&fg(o),this.store.path2dMap.set(o,Et.path2dDraws.line(o)),Yr(o)):o.calculative.focus=!0}),this.render());break;case"Escape":this.drawingLineName&&this.finishDrawline(),this.drawingLineName=void 0,this.stopPencil(),this.store.active&&this.store.active.forEach(o=>{o.type||(o.calculative.focus=!1)}),this.movingPens&&(this.getAllByPens(this.movingPens).forEach(o=>{this.store.pens[o.id]=void 0}),this.movingPens=void 0,this.mouseDown=void 0,this.clearDock(),(l=this.store.active)==null||l.forEach(o=>{this.updateLines(o)}),this.calcActiveRect(),this.patchFlags=!0),this.hotkeyType=Yt.None,this.movingAnchor=void 0,this.magnifierCanvas.magnifier&&(this.magnifierCanvas.magnifier=!1,this.patchFlags=!0);break;case"E":case"e":this.store.options.disableAnchor=!this.store.options.disableAnchor,this.store.emitter.emit("disableAnchor",this.store.options.disableAnchor);break;case"=":(t.ctrlKey||t.metaKey)&&(this.scale(this.store.data.scale+.1),t.preventDefault(),t.stopPropagation());break;case"-":(t.ctrlKey||t.metaKey)&&(this.scale(this.store.data.scale-.1),t.preventDefault(),t.stopPropagation());break;case"l":case"L":this.canMoveLine=!0;break;case"[":this.parent.down();break;case"]":this.parent.up();break;case"{":this.parent.bottom();break;case"}":this.parent.top();break;case"F":case"f":!this.store.data.locked&&(t.ctrlKey||t.metaKey)&&!this.store.options.disableClipboard&&this.paste(),this.setFollowers();break}this.render(!1)});W(this,"onkeyup",t=>{switch(t.key){case"l":case"L":this.canMoveLine=!1;break}this.hotkeyType&&this.render(),this.hotkeyType{if(this.store.data.locked){console.warn("canvas is locked, can not drop");return}t.preventDefault(),t.stopPropagation();const i=t.dataTransfer.getData("Meta2d")||t.dataTransfer.getData("Text");let a=null;try{i&&(a=JSON.parse(i))}catch{}if(!a){const{files:s}=t.dataTransfer;if(s.length&&s[0].type.match("image.*")&&!(this.addCaches&&this.addCaches.length)){const n=s[0].type==="image/gif";a=await this.fileToPen(s[0],n)}else if(this.addCaches&&this.addCaches.length)a=this.addCaches,this.addCaches=[];else{this.store.emitter.emit("drop",void 0);return}}if(a=Array.isArray(a)?a:[a],a[0]&&a[0].draggable!==!1){const s={x:t.offsetX,y:t.offsetY};this.calibrateMouse(s),this.dropPens(a,s),this.addCaches=[],this.getContainerHover(s),this.mousePos.x=s.x,this.mousePos.y=s.y,this.store.emitter.emit("mouseup",{x:s.x,y:s.y,pen:this.store.hoverContainer})}this.store.emitter.emit("drop",a||i)});W(this,"ontouchstart",t=>{this.store.data.locked!==Mt.Disable&&(this.touchStartTimer&&clearTimeout(this.touchStartTimer),this.touchStartTimer=setTimeout(()=>{this.touchStart=performance.now();const i=t.touches[0].pageX-this.clientRect.x,a=t.touches[0].pageY-this.clientRect.y,s={x:i,y:a};if(this.calibrateMouse(s),this.getHover(s),this.onMouseDown({x:i,y:a,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:1}),t.touches.length===2){this.initTouchDis=Math.hypot(t.touches[0].pageX-t.touches[1].pageX,t.touches[0].pageY-t.touches[1].pageY),this.initScale=this.store.data.scale,this.startTouches=t.touches,this.touchCenter={x:t.touches[0].pageX+(t.touches[1].pageX-t.touches[0].pageX)/2-this.clientRect.x,y:t.touches[0].pageY+(t.touches[1].pageY-t.touches[0].pageY)/2-this.clientRect.y};return}else t.touches.length===3&&(this.store.emitter.emit("contextmenu",{e:{x:i,y:a,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,pageX:t.touches[0].pageX,pageY:t.touches[0].pageY},clientRect:this.clientRect}),t.preventDefault(),t.stopPropagation());this.touchStartTimer=void 0},50))});W(this,"ontouchmove",t=>{var l;if(this.store.data.locked===Mt.Disable)return;t.stopPropagation(),t.preventDefault();const i=performance.now();if(i-this.touchStart<50)return;this.touchStart=i;const a=t.touches,s=a.length,n=t.touches[0].pageX-this.clientRect.x,r=t.touches[0].pageY-this.clientRect.y;if(s===1)this.onMouseMove({x:n,y:r,clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:1});else if(s===2&&((l=this.startTouches)==null?void 0:l.length)===2){if(!this.touchMoving&&!this.touchScaling){const o=this.startTouches[0].pageX-a[0].pageX,u=this.startTouches[1].pageX-a[1].pageX,c=this.startTouches[0].pageY-a[0].pageY,f=this.startTouches[1].pageY-a[1].pageY;(o>=0&&u<0||o<=0&&u>0)&&(c>=0&&f<0||c<=0&&f>0)?this.touchScaling=!0:this.touchMoving=!0}if(this.touchScaling){if(this.store.data.disableScale||this.store.options.disableScale)return;const o=Math.hypot(a[0].pageX-a[1].pageX,a[0].pageY-a[1].pageY)/this.initTouchDis;this.scale(this.initScale*o,ht(this.touchCenter))}if(this.touchMoving){if(this.store.data.locked>=Mt.DisableMove&&this.store.data.locked!==Mt.DisableScale||this.store.data.disableScale||this.store.options.disableScale)return;if(this.lastOffsetX){const{scale:o}=this.store.data;this.translate((n-this.lastOffsetX)/o,(r-this.lastOffsetY)/o)}this.lastOffsetX=n,this.lastOffsetY=r}}});W(this,"ontouchend",t=>{if(this.store.data.locked===Mt.Disable)return;this.touchCenter=void 0,this.touchScaling=void 0,this.touchMoving=void 0,this.startTouches=void 0,this.lastOffsetX=0,this.lastOffsetY=0;const i=t.changedTouches[0].pageX-this.clientRect.x,a=t.changedTouches[0].pageY-this.clientRect.y;this.onMouseUp({x:i,y:a,clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,pageX:t.changedTouches[0].pageX,pageY:t.changedTouches[0].pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:1}),setTimeout(()=>{this.render()},20)});W(this,"onGesturestart",t=>{t.preventDefault()});W(this,"onMouseDown",t=>{var i,a,s,n,r;if(t.buttons===2&&!this.drawingLine&&(this.mouseRight=Vi.Down),this.hideInput(),this.popconfirm.hide(),this.store.data.locked===Mt.Disable||t.buttons!==1&&t.buttons!==2){this.hoverType=xt.None;return}if(!this.magnifierCanvas.magnifier){if(this.calibrateMouse(t),this.mousePos.x=t.x,this.mousePos.y=t.y,this.mouseDown=t,this.lastMouseTime=performance.now(),this.canvasImage.fitFlag){this.canvasImage.currentFit||this.calcuActiveFit();return}if(this.hotkeyType===Yt.AddAnchor){this.setAnchor(this.store.pointAt);return}if(!this.store.options.autoAnchor&&!this.drawingLine&&t.shiftKey&&t.ctrlKey&&t.altKey){this.setAnchor(this.store.pointAt),this.drawingLineName=this.store.options.drawingLineName;const l=this.store.activeAnchor;if(!l)return;const o={id:St(),x:l.x,y:l.y};this.drawingLine=this.createDrawingLine(o);let u=le(this.drawingLine);this.drawingLine.calculative.activeAnchor=u,we(this.store.hover,l,this.drawingLine,o),this.drawline();return}if(!(this.hotkeyType===Yt.Translate||this.mouseRight===Vi.Down&&!this.store.options.mouseRightActive)){if(this.drawingLine){if(this.store.hoverAnchor){const o=Vt(this.drawingLine);this.store.hoverAnchor.type===$i.Line?mr(o,this.store.hoverAnchor,this.store):(o.x=this.store.hoverAnchor.x,o.y=this.store.hoverAnchor.y),we(this.store.hover,this.store.hoverAnchor,this.drawingLine,o),this.drawline(),this.finishDrawline(!0);return}if(!this.store.options.autoAnchor&&t.shiftKey&&t.altKey&&t.ctrlKey){this.setAnchor(this.store.pointAt);const o=Vt(this.drawingLine),u=this.store.activeAnchor;if(!u)return;o.x=u.x,o.y=u.y,we(this.store.hover,u,this.drawingLine,o),this.drawline(),this.finishDrawline(!0);return}if(t.buttons===2||this.drawingLineName==="mind"&&((i=this.drawingLine)==null?void 0:i.calculative.worldAnchors.length)>1||this.store.options.drawingLineLength&&((a=this.drawingLine)==null?void 0:a.calculative.worldAnchors.length)>this.store.options.drawingLineLength){this.finishDrawline(!0),((s=this.store.active[0])==null?void 0:s.anchors[0].connectTo)||this.store.active.length==0?this.drawingLineName="":this.drawingLineName=this.store.options.drawingLineName;return}if(this.store.options.autoAnchor&&this.hoverType===xt.Node){const o=Vt(this.drawingLine),u=bs(this.store.hover,t);o.x=u.x,o.y=u.y,this.drawingLine.autoTo=!0,we(this.store.hover,u,this.drawingLine,o),this.drawline(),this.finishDrawline(!0);return}const l=Vt(this.drawingLine);l.isTemp?(this.drawingLine.calculative.activeAnchor=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2],l.isTemp=void 0):(this.drawingLine.calculative.activeAnchor=l,this.drawingLine.calculative.worldAnchors.push({x:l.x,y:l.y,penId:l.penId})),this.drawingLine.calculative.drawlineH=void 0,this.drawingLineName!=="polyline"&&this.drawline()}if(this.drawingLineName){if(this.hoverType===xt.Node)if(this.store.options.autoAnchor){this.inactive(!0);const l=bs(this.store.hover,t);this.store.hoverAnchor=l;const o={id:St(),x:l.x,y:l.y};this.drawingLine=this.createDrawingLine(o),this.drawingLine.autoFrom=!0,we(this.store.hover,l,this.drawingLine,o)}else this.inactive(),this.hoverType=xt.None;else if(this.hoverType===xt.NodeAnchor){this.drawingLineName=this.store.options.drawingLineName;const l={id:St(),x:this.store.hoverAnchor.x,y:this.store.hoverAnchor.y};this.drawingLine=this.createDrawingLine(l),this.drawingLine.calculative.activeAnchor=l,we(this.store.hover,this.store.hoverAnchor,this.drawingLine,l)}else if(!this.drawingLine&&this.drawingLineName!=="curve"){this.inactive(!0);const l={id:St(),x:t.x,y:t.y};this.drawingLine=this.createDrawingLine(l),this.drawingLine.calculative.activeAnchor=l}}else if(this.pencil){this.inactive(!0);const l=St(),o={x:t.x,y:t.y,id:St(),penId:l};this.pencilLine=this.getInitPencilLine(o)}else{switch(this.hoverType){case xt.None:(this.store.data.rule||this.store.options.rule)&&!this.store.options.disableRuleLine&&this.addRuleLine(t),this.store.options.resizeMode&&(this.hotkeyType=Yt.None),this.inactive();break;case xt.Node:case xt.Line:if(this.store.hover){if(((n=this.store.active)==null?void 0:n.length)&&this.store.active.length===1&&this.store.hover.id===this.store.active[0].id){this.calcActiveRect();break}const l=ti(this.store.hover,!0);let o=l||this.store.hover;l&&(l.container||((r=this.store.options.containerShapes)==null?void 0:r.includes(l.name)))&&(o=this.store.hover),t.ctrlKey&&!t.shiftKey?(o.calculative.active?this.willInactivePen=o:this.store.active.length>0&&(o.calculative.active=!0,ys(o),this.store.active.push(o),this.store.emitter.emit("active",this.store.active)),this.patchFlags=!0):t.ctrlKey&&t.shiftKey&&this.store.hover.parentId?this.active([this.store.hover]):(!(this.activeRect&&Ui({x:t.x,y:t.y},this.activeRect))||this.store.active.length==1)&&(o.calculative.active||(this.active([o]),this.store.options.resizeMode&&(this.hotkeyType=Yt.Resize))),this.calcActiveRect()}break;case xt.LineAnchor:this.store.activeAnchor=this.store.hoverAnchor,this.store.hover.calculative.activeAnchor=this.store.hoverAnchor,this.active([this.store.hover]);break;case xt.LineAnchorPrev:case xt.LineAnchorNext:this.store.activeAnchor&&(this.prevAnchor={...this.store.activeAnchor.prev},this.nextAnchor={...this.store.activeAnchor.next});break;case xt.Resize:this.activeInitPos=[],this.store.active.forEach(l=>{this.activeInitPos.push({x:(l.calculative.worldRect.x-this.activeRect.x)/this.activeRect.width,y:(l.calculative.worldRect.y-this.activeRect.y)/this.activeRect.height})});break}this.store.hover&&(this.store.hover.calculative.mouseDown=!0),this.store.emitter.emit("mousedown",{x:t.x,y:t.y,pen:this.store.hover})}this.render()}}});W(this,"onMouseMove",t=>{var a,s,n,r,l,o,u,c;if(this.store.data.locked===Mt.Disable){this.hoverType=xt.None;return}if(this.mouseDown&&!this.mouseDown.restore&&t.buttons!==1&&t.buttons!==2){this.onMouseUp(t);return}if(this.lastMouseTime){if(performance.now()-this.lastMouseTime<50){this.lastMouseTime=0;return}this.lastMouseTime=0}if(this.calibrateMouse(t),this.mousePos.x=t.x,this.mousePos.y=t.y,this.magnifierCanvas.magnifier){this.render();return}if(this.canvasImage.fitFlag&&this.canvasImage.activeFit){const f=performance.now();f-this.fitTimer>100&&(this.mouseDown?this.updateFit(t):this.inFitBorder(this.mousePos),this.fitTimer=f);return}if(this.mouseDown&&!this.store.options.disableTranslate&&!this.store.data.disableTranslate){if(this.mouseRight===Vi.Down&&(this.mouseRight=Vi.Translate),this.store.data.locked===Mt.DisableEdit||this.store.data.locked===Mt.DisableScale||this.hotkeyType===Yt.Translate||this.mouseRight===Vi.Translate){const{scale:f}=this.store.data;let g=(t.x-this.mouseDown.x)/f,v=(t.y-this.mouseDown.y)/f;t.shiftKey&&!t.ctrlKey&&(v=0),t.ctrlKey&&(g=0),this.translate(g,v);return}if(this.store.data.locked)return;if(!this.drawingLine&&!this.pencil){if(!this.drawingLineName&&!this.movingAnchor){if(this.hoverType===xt.NodeAnchor){if(!this.store.hoverAnchor)return;this.drawingLineName=this.store.options.drawingLineName;const f={id:St(),x:this.store.hoverAnchor.x,y:this.store.hoverAnchor.y};this.drawingLine=this.createDrawingLine(f),this.drawingLine.calculative.activeAnchor=f,we(this.store.hover,this.store.hoverAnchor,this.drawingLine,f),this.drawline();return}}else if(this.drawingLineName&&this.hoverType===xt.None){const f={id:St(),x:t.x,y:t.y};this.drawingLine=this.createDrawingLine(f),this.drawingLine.calculative.activeAnchor=f,this.drawline();return}if(t.buttons===1&&(t.ctrlKey||!this.hoverType&&!this.hotkeyType)&&!(t.ctrlKey&&(this.store.activeAnchor||((a=this.store.active)==null?void 0:a.length)))){this.dragRect={x:Math.min(this.mouseDown.x,t.x),y:Math.min(this.mouseDown.y,t.y),ex:Math.max(this.mouseDown.x,t.x),ey:Math.max(this.mouseDown.y,t.y),width:Math.abs(t.x-this.mouseDown.x),height:Math.abs(t.y-this.mouseDown.y)},this.render();return}if(this.movingAnchor){const f=t.x-this.movingAnchor.x,g=t.y-this.movingAnchor.y;this.translateAnchor(f,g),this.render();return}else if(!((s=this.store.active[0])!=null&&s.locked)){const f={x:t.x,y:t.y};if(this.hoverType===xt.LineAnchor){(this.dockInAnchor(t)||((n=this.store.active[0])==null?void 0:n.lineName)==="line")&&!this.store.options.disableDock&&!this.store.options.disableLineDock&&(this.clearDock(),this.dock=Ef(this.store,f,this.store.activeAnchor),(r=this.dock)!=null&&r.xDock&&(f.x+=this.dock.xDock.step),(l=this.dock)!=null&&l.yDock&&(f.y+=this.dock.yDock.step)),this.moveLineAnchor(f,t);return}if(this.hoverType===xt.LineAnchorPrev){this.moveLineAnchorPrev(t);return}if(this.hoverType===xt.LineAnchorNext){this.moveLineAnchorNext(t);return}}if(this.hoverType===xt.Rotate){this.rotatePens({x:t.x,y:t.y});return}if(this.hoverType===xt.Resize){this.resizePens(t);return}if(this.hoverType===xt.Node||this.hoverType===xt.Line){const f=t.x-this.mouseDown.x,g=t.y-this.mouseDown.y,v=20;if(t.ctrlKey&&!t.shiftKey&&(Math.abs(f)>=v||Math.abs(g)>=v)&&(this.willInactivePen=void 0),this.store.active.length===1){const m=this.store.active[0];if((m.locked===void 0||m.locked1&&(m=Vt(this.drawingLine)),m?(m.prev=void 0,m.next=void 0,m.id||(m.id=St()),m.x=v.x,m.y=v.y,m.connectTo=void 0):(m={...v},this.drawingLine.calculative.worldAnchors.push(m)),(this.hoverType===xt.NodeAnchor||this.hoverType===xt.LineAnchor)&&(this.store.hoverAnchor.type!==$i.Line&&(m.x=this.store.hoverAnchor.x,m.y=this.store.hoverAnchor.y),m.connectTo=this.store.hoverAnchor.penId,this.drawingLineName==="polyline"&&(m.isTemp=!1)),this.drawingLineName==="line"){if(t.ctrlKey&&!t.shiftKey)m.x=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2].x;else if(t.shiftKey&&!t.ctrlKey)m.y=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2].y;else if(t.shiftKey&&t.ctrlKey){let w=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2];this.getSpecialAngle(m,w)}}this.drawline()}}globalThis.debug&&console.time("hover");const i=performance.now();i-this.hoverTimer>50&&(this.hoverTimer=i,this.getHover(t)),globalThis.debug&&console.timeEnd("hover"),this.hotkeyType===Yt.AddAnchor&&(this.patchFlags=!0),this.render(!1)});W(this,"onMouseUp",t=>{if(this.store.data.locked===Mt.Disable){this.hoverType=xt.None;return}if(!!this.mouseDown){if(this.mouseRight===Vi.Down&&(this.store.hover&&this.store.hover.onContextmenu?this.store.hover.onContextmenu(this.store.hover,t):this.store.emitter.emit("contextmenu",{e:t,clientRect:this.clientRect,pen:this.store.hover})),this.mouseRight=Vi.None,this.calibrateMouse(t),this.mousePos.x=t.x,this.mousePos.y=t.y,this.pencil&&this.finishPencil(),this.drawingLine){if(this.store.hoverAnchor){const i=Vt(this.drawingLine);this.store.hoverAnchor.type===$i.Line?mr(i,this.store.hoverAnchor,this.store):(i.x=this.store.hoverAnchor.x,i.y=this.store.hoverAnchor.y),we(this.store.hover,this.store.hoverAnchor,this.drawingLine,i),this.drawline(),this.finishDrawline(!0);return}if(this.store.options.autoAnchor&&this.hoverType===xt.Node){const i=Vt(this.drawingLine),a=bs(this.store.hover,t);i.x=a.x,i.y=a.y,this.drawingLine.autoTo=!0,we(this.store.hover,a,this.drawingLine,i),this.drawline(),this.finishDrawline(!0);return}}if(this.hoverType===xt.LineAnchor&&this.store.hover&&this.store.active[0]&&this.store.active[0].name==="line"&&this.store.active[0]!==this.store.hover){const i=this.store.active[0],a=le(i),s=Vt(i);if(this.store.hoverAnchor){const n=this.store.hover,r=le(n)===this.store.hoverAnchor,l=Vt(n)===this.store.hoverAnchor,o=a===this.store.activeAnchor,u=s===this.store.activeAnchor;if((t.ctrlKey||t.altKey)&&n.type===$t.Line&&(r||l)&&(o||u)){const c=n.calculative.worldAnchors.map(f=>({...f,penId:i.id}));r?c.shift():l&&c.pop(),(r&&o||l&&u)&&c.reverse(),o?(i.calculative.worldAnchors[0].connectTo=void 0,i.calculative.worldAnchors.unshift(...c)):u&&(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].connectTo=void 0,i.calculative.worldAnchors.push(...c)),this.delete([n]),this.render()}else this.store.activeAnchor&&(this.store.hoverAnchor.type===$i.Line?mr(this.store.activeAnchor,this.store.hoverAnchor,this.store):(this.store.activeAnchor.x=this.store.hoverAnchor.x,this.store.activeAnchor.y=this.store.hoverAnchor.y),we(this.store.hover,this.store.hoverAnchor,i,this.store.activeAnchor));this[i.lineName]&&i.lineName!=="polyline"&&this[i.lineName](this.store,i),this.store.path2dMap.set(i,Et.path2dDraws.line(i)),this.initLineRect(i)}else a===this.store.activeAnchor&&i.autoFrom?this.calcAutoAnchor(i,a,this.store.hover):s===this.store.activeAnchor&&i.autoTo&&this.calcAutoAnchor(i,s,this.store.hover)}if(this.addCaches&&this.addCaches.length){if(!this.store.data.locked){if(this.dragRect&&this.addCaches.length===1){const i=this.addCaches[0];i.width=this.dragRect.width/this.store.data.scale,i.height=this.dragRect.height/this.store.data.scale,t.x=(this.dragRect.x+this.dragRect.ex)/2,t.y=(this.dragRect.y+this.dragRect.ey)/2}this.dropPens(this.addCaches,t)}this.addCaches=void 0}if(this.hoverType===xt.Rotate&&(this.getSizeCPs(),this.store.active.forEach(i=>{i.rotate=i.calculative.rotate})),this.patchFlagsLines.forEach(i=>{i.type&&this.initLineRect(i)}),this.patchFlagsLines.clear(),this.dragRect)if(this.canvasImage.fitFlag)this.makeFit();else{const i=this.store.data.pens.filter(a=>{if(a.visible===!1||a.locked>=Mt.DisableMove||a.parentId||a.isRuleLine)return!1;if(Xi(a.calculative.worldRect,this.dragRect,t.ctrlKey||this.store.options.dragAllIn))return a.type===$t.Line&&!this.store.options.dragAllIn?Il(a,this.dragRect):!0});this.active(i)}if(t.button!==2&&(Qr(this.mouseDown,t)<2&&(this.store.hover&&this.store.hover.input&&(this.store.hover.onShowInput?this.store.hover.onShowInput(this.store.hover,t):(this.store.hover.parentId&&this.active([this.store.hover]),this.showInput(this.store.hover))),this.store.emitter.emit("click",{x:t.x,y:t.y,pen:this.store.hover})),this.store.hover&&(this.store.hover.calculative.mouseDown=!1),this.store.hover!=this.store.hoverContainer&&this.store.emitter.emit("mouseup",{x:t.x,y:t.y,pen:this.store.hover}),this.store.emitter.emit("mouseup",{x:t.x,y:t.y,pen:this.store.hoverContainer})),this.willInactivePen){this.willInactivePen.calculative.active=void 0,ys(this.willInactivePen,!1);const i=this.store.active.findIndex(a=>a===this.willInactivePen);i>=0&&this.store.active.splice(i,1),this.calcActiveRect(),this.willInactivePen=void 0,this.store.emitter.emit("inactive",[this.willInactivePen]),this.render()}this.movingPens&&(t.altKey&&!t.shiftKey?this.copyMovedPens():this.movedActivePens(t.ctrlKey&&t.shiftKey),this.getAllByPens(this.movingPens).forEach(i=>{this.store.pens[i.id]=void 0}),this.movingPens=void 0),this.store.active&&this.store.active[0]&&(this.store.active[0].calculative.h=void 0),this.mouseDown=void 0,this.lastOffsetX=0,this.lastOffsetY=0,this.clearDock(),this.dragRect=void 0,this.initActiveRect=void 0,this.render()}});W(this,"clearDock",()=>{var n,r,l,o;const t=(r=(n=this.dock)==null?void 0:n.xDock)==null?void 0:r.penId,i=(o=(l=this.dock)==null?void 0:l.yDock)==null?void 0:o.penId,a=this.store.pens[t];a&&(a.calculative.isDock=!1);const s=this.store.pens[i];s&&(s.calculative.isDock=!1),this.dock=void 0});W(this,"onResize",()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.resize(),this.timer=void 0},100)});W(this,"onScroll",()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.clientRect=this.canvas.getBoundingClientRect(),this.timer=void 0},100)});W(this,"calibrateMouse",t=>(t.x-=this.store.data.x,t.y-=this.store.data.y,t));W(this,"getContainerHover",t=>{var a;if(this.dragRect)return;this.store.hoverContainer=void 0;const i=this.store.data.pens.filter(s=>{var n;return s.container||((n=this.store.options.containerShapes)==null?void 0:n.includes(s.name))});if(i.length)for(let s=i.length-1;s>=0;--s){const n=i[s];if(!(n.visible==!1||n.calculative.inView==!1||n.locked===Mt.Disable)){if(Ui(t,n.calculative.worldRect))this.store.hoverContainer=n,(a=n==null?void 0:n.onMouseMove)==null||a.call(n,n,t),this.store.lastHoverContainer!==this.store.hoverContainer&&(this.patchFlags=!0,this.store.lastHoverContainer&&(this.store.lastHoverContainer.calculative.containerHover=!1,this.store.emitter.emit("leave",this.store.lastHoverContainer)),this.store.hoverContainer&&(this.store.hoverContainer.calculative.containerHover=!0,this.store.emitter.emit("enter",this.store.hoverContainer)),this.store.lastHoverContainer=this.store.hoverContainer);else if(n===this.store.hoverContainer&&(this.store.hoverContainer=void 0,this.store.lastHoverContainer!==this.store.hoverContainer)){this.patchFlags=!0;const r=this.store.lastHoverContainer.calculative.canvas.store.pens[this.store.lastHoverContainer.id+He];this.store.lastHoverContainer&&!r&&(this.store.lastHoverContainer.calculative.containerHover=!1,this.store.emitter.emit("leave",this.store.lastHoverContainer)),this.store.lastHoverContainer=this.store.hoverContainer}}}});W(this,"getHover",t=>{var s,n;if(this.dragRect||this.canvasImage.fitFlag)return;let i=xt.None;this.store.hover=void 0,this.store.hoverAnchor=void 0,this.title.hide(),this.store.pointAt=void 0,this.store.pointAtIndex=void 0;const a=this.store.active.length===1&&this.store.active[0].type;if(!this.drawingLineName&&this.hotkeyType!==Yt.AddAnchor&&this.activeRect&&!a&&!this.store.data.locked){const r=Pl(this.store.active),l=bf(this.store.active)||this.store.options.disableRotate,o=xf(this.store.active)||this.store.options.disableSize;if(!r&&!l){const u={x:this.activeRect.center.x,y:this.activeRect.y-30};this.activeRect.rotate&&Gt(u,this.activeRect.rotate,this.activeRect.pivot||this.activeRect.center),!this.hotkeyType&&ms(t,u,this.pointSize)&&(i=xt.Rotate,this.externalElements.style.cursor=`url("${this.store.options.rotateCursor}"), auto`)}if(!r&&!o)for(let u=0;u<8;u++){const c=u<4;if((this.hotkeyType===Yt.Resize||c&&!this.hotkeyType)&&ms(t,this.sizeCPs[u],this.pointSize)){let g=c?uf:ff,v=0;Math.abs(this.activeRect.rotate%90-45)<25?(g=c?ff:uf,v=Math.round((this.activeRect.rotate-45)/90)+(c?0:1)):v=Math.round(this.activeRect.rotate/90),i=xt.Resize,this.resizeIndex=u,this.externalElements.style.cursor=g[(u+v)%4];break}}}i===xt.None&&(i=this.inPens(t,this.store.data.pens)),!i&&!a&&Ui(t,this.activeRect)&&(i=xt.Node,this.externalElements.style.cursor="move"),this.hoverType=i,i===xt.None&&(this.drawingLineName||this.pencil?this.externalElements.style.cursor="crosshair":this.mouseDown||(this.externalElements.style.cursor="default"),this.store.hover=void 0),this.store.lastHover!==this.store.hover&&(this.patchFlags=!0,this.store.lastHover&&(this.store.lastHover.calculative.hover=!1,tn(ti(this.store.lastHover,!0)||this.store.lastHover,!1),this.store.emitter.emit("leave",this.store.lastHover),this.tooltip.hide()),this.store.hover&&(this.store.hover.calculative.hover=!0,tn(ti(this.store.hover,!0)||this.store.hover),this.store.emitter.emit("enter",this.store.hover),this.tooltip.show(this.store.hover,t)),this.store.lastHover=this.store.hover),(n=(s=this.store.hover)==null?void 0:s.onMouseMove)==null||n.call(s,this.store.hover,this.mousePos)});W(this,"inPens",(t,i)=>{var s;let a=xt.None;t:for(let n=i.length-1;n>=0;--n){const r=i[n];if(r.visible==!1||r.calculative.inView==!1||r.locked===Mt.Disable)continue;const l=qr(r);if(!(!r.calculative.active&&!Wa(t,r.calculative.worldRect,l)&&!Ui(t,r.calculative.worldRect))){if(!this.store.data.locked&&this.hotkeyType!==Yt.Resize&&r.calculative.worldAnchors){for(const o of r.calculative.worldAnchors)if(a=this.inAnchor(t,r,o),a){let u=ht(o);Object.assign(u,t),this.title.show(u,r);break t}}if(r.type){if(r.isRuleLine){let u=((s=this.store.options.ruleOptions)==null?void 0:s.height)||20;if(t.x+this.store.data.x>u&&t.y+this.store.data.y>u)break}const o=C_(t,r);if(o){!this.store.data.locked&&!r.locked?this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="pointer":this.externalElements.style.cursor="move":this.externalElements.style.cursor=this.store.options.hoverCursor,r.calculative.disabled&&(this.externalElements.style.cursor="not-allowed"),this.store.hover=r,this.store.pointAt=o.point,this.store.pointAtIndex=o.i,this.initTemplateCanvas([this.store.hover]),a=xt.Line;break}}else{if(r.children){const u=[];if(r.children.forEach(c=>{this.store.pens[c]&&u.push(this.store.pens[c])}),a=this.inPens(t,u),a)break}let o=!1;if(r.name==="line"?o=Wa(t,r.calculative.worldRect,r.lineWidth):o=Ui(t,r.calculative.worldRect),o){if(r.type===$t.Node&&r.name==="line"&&!Y2(t,r.calculative.worldAnchors))continue;if(!this.store.data.locked&&!r.locked?this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="pointer":this.externalElements.style.cursor="move":this.externalElements.style.cursor=this.store.options.hoverCursor,r.calculative.disabled&&(this.externalElements.style.cursor="not-allowed"),this.store.hover=r,this.initTemplateCanvas([this.store.hover]),a=xt.Node,this.store.pointAt=t,!t.ctrlKey){let{x:u,y:c,ex:f,ey:g,rotate:v,center:m}=this.store.hover.calculative.worldRect;if(v){const w=[{x:u,y:c},{x:f,y:c},{x:f,y:g},{x:u,y:g}];w.forEach(_=>{Gt(_,v,m)});let y=w[w.length-1];for(const _ of w){if(y.y>t.y!=_.y>t.y){const A=_.x+(t.y-_.y)*(y.x-_.x)/(y.y-_.y);Math.abs(A-this.store.pointAt.x)<10&&(this.store.pointAt.x=A)}y=_}}else this.store.pointAt.x-10f&&(this.store.pointAt.x=f),this.store.pointAt.y-10g&&(this.store.pointAt.y=g)}break}}}}return a});W(this,"dockInAnchor",t=>{var i,a;this.store.hover=void 0;for(let s=this.store.data.pens.length-1;s>=0;--s){const n=this.store.data.pens[s];if(n.visible==!1||n.locked===Mt.Disable||n===this.store.active[0])continue;let r=qr(n);if(r+=2*this.store.options.anchorRadius,!!Wa(t,n.calculative.worldRect,r)&&(this.store.hover=n,this.hotkeyType!==Yt.Resize&&n.calculative.worldAnchors))for(const l of n.calculative.worldAnchors){if(l.twoWay===Ae.In){const o=Vt(this.store.active[0]);if(this.store.activeAnchor.id!==o.id)continue}if(l.twoWay===Ae.Out){const o=le(this.store.active[0]);if(this.store.activeAnchor.id!==o.id)continue}if(!(l.twoWay===Ae.DisableConnected||l.twoWay===Ae.Disable||((i=this.store.activeAnchor)==null?void 0:i.twoWay)===Ae.DisableConnectTo||((a=this.store.activeAnchor)==null?void 0:a.twoWay)===Ae.Disable)&&(this.title.hide(),this.inAnchor(t,n,l))){let o=ht(l);return Object.assign(o,t),this.title.show(o,n),!0}}}});W(this,"imageTimer");W(this,"templateImageTimer");W(this,"render",t=>{if(t&&(this.opening=!1),this.opening)return;let i;if(t==null||t===!0||t===1/0?(i=performance.now(),this.patchFlags=!0):t>1?i=t:i=performance.now(),!this.patchFlags)return;if(i-this.lastRender{const t=this.offscreen.getContext("2d");t.strokeStyle=this.store.styles.color;for(const i of this.store.data.pens)!isFinite(i.x)||i.canvasLayer!==zt.CanvasTemplate&&i.calculative.inView&&(i.canvasLayer===zt.CanvasMain&&i.name!=="gif"&&i.image&&i.calculative.img&&(t.save(),za(t,i),i.calculative.rotate&&Gi(t,i),Ha(t,i),Es(t,i),t.restore()),Sa(t,i));this.drawingLine&&Sa(t,this.drawingLine),this.pencilLine&&Sa(t,this.pencilLine),this.movingPens&&this.movingPens.forEach(i=>{this.renderPenContainChild(t,i)})});W(this,"renderPenContainChild",(t,i)=>{var a;i.calculative.inView&&Sa(t,i),(a=i.children)==null||a.forEach(s=>{const n=this.store.pens[s];n&&this.renderPenContainChild(t,n)})});W(this,"renderBorder",()=>{if(!this.store.data.locked&&this.activeRect&&!(this.store.active.length===1&&this.store.active[0].type)&&!this.movingPens){const t=this.offscreen.getContext("2d");t.save(),t.translate(.5,.5);const i=this.activeRect.pivot||this.activeRect.center;if(this.activeRect.rotate&&(t.translate(i.x,i.y),t.rotate(this.activeRect.rotate*Math.PI/180),t.translate(-i.x,-i.y)),t.strokeStyle=this.store.styles.activeColor,t.globalAlpha=this.store.options.activeGlobalAlpha===void 0?.3:this.store.options.activeGlobalAlpha,t.beginPath(),t.lineWidth=this.store.options.activeLineWidth||1,t.setLineDash(this.store.options.activeLineDash||[]),t.strokeRect(this.activeRect.x,this.activeRect.y,this.activeRect.width,this.activeRect.height),t.setLineDash([]),t.lineWidth=1,t.globalAlpha=1,Pl(this.store.active)||bf(this.store.active)||this.store.options.disableRotate){t.restore();return}t.beginPath(),t.moveTo(this.activeRect.center.x,this.activeRect.y),t.lineTo(this.activeRect.center.x,this.activeRect.y-30),t.stroke(),t.beginPath(),t.strokeStyle=this.store.styles.activeColor,t.fillStyle="#ffffff",t.arc(this.activeRect.center.x,this.activeRect.y-30,5,0,Math.PI*2),t.fill(),t.stroke(),t.restore()}});W(this,"renderHoverPoint",()=>{if(this.store.data.locked)return;const t=this.offscreen.getContext("2d");if(t.save(),t.translate(.5,.5),!this.store.options.disableAnchor&&this.store.hover&&!this.store.hover.disableAnchor&&(this.hotkeyType!==Yt.Resize||this.store.active.length!==1||this.store.active[0]!==this.store.hover)){const i=[...this.store.hover.calculative.worldAnchors];this.store.pointAt&&this.hotkeyType===Yt.AddAnchor&&i.push(this.store.pointAt),i&&(t.strokeStyle=this.store.hover.anchorColor||this.store.styles.anchorColor,t.fillStyle=this.store.hover.anchorBackground||this.store.options.anchorBackground,i.forEach(a=>{if(a.hidden&&a.locked>Mt.DisableEdit)return;if(a===this.store.hoverAnchor){t.save();const n=this.store.hover.hoverAnchorColor||this.store.options.hoverAnchorColor;t.strokeStyle=n,t.fillStyle=n}t.beginPath();let s=a.radius||this.store.hover.anchorRadius||this.store.options.anchorRadius;if(this.store.hover.type&&!a.radius&&!this.store.hover.anchorRadius&&(s=3,this.store.hover.calculative.lineWidth>3&&(s=this.store.hover.calculative.lineWidth)),a.type===$i.Line){let n=this.store.pens[a.penId].rotate||0;this.store.pens[a.penId].calculative.flipX&&(n*=-1),this.store.pens[a.penId].calculative.flipY&&(n*=-1);let r=a.rotate+n;this.store.pens[a.penId].calculative.flipX&&(r*=-1),this.store.pens[a.penId].calculative.flipY&&(r*=-1),t.save(),t.translate(a.x,a.y),t.rotate(r*Math.PI/180),t.translate(-a.x,-a.y),t.rect(a.x-a.length*this.store.data.scale/2,a.y-s,a.length*this.store.data.scale,s*2),t.restore()}else t.arc(a.x,a.y,s,0,Math.PI*2);if(this.store.hover.type&&this.store.hoverAnchor===a?(t.save(),t.strokeStyle=this.store.hover.activeColor||this.store.styles.activeColor,t.fillStyle=t.strokeStyle):(a.color||a.background)&&(t.save(),t.strokeStyle=a.color,t.fillStyle=a.background),t.fill(),t.stroke(),a===this.store.hoverAnchor&&t.restore(),(this.store.hover.type&&this.store.hoverAnchor===a||a.color||a.background)&&t.restore(),!this.store.hover.parentId&&this.store.hover.children&&this.store.hover.children.length>0&&a===this.store.hoverAnchor){t.save(),t.beginPath(),t.lineWidth=3;const n=this.store.hover.hoverAnchorColor||this.store.options.hoverAnchorColor;globalThis.pSBC&&(t.strokeStyle=globalThis.pSBC(.5,n)),t.arc(a.x,a.y,s+1.5,0,Math.PI*2),t.stroke(),t.restore()}}))}this.hotkeyType!==Yt.AddAnchor&&!this.movingPens&&this.activeRect&&!(this.store.active.length===1&&this.store.active[0].type)&&!Pl(this.store.active)&&!xf(this.store.active)&&!this.store.options.disableSize&&(t.strokeStyle=this.store.styles.activeColor,t.fillStyle="#ffffff",this.sizeCPs.forEach((i,a)=>{this.activeRect.rotate&&(t.save(),t.translate(i.x,i.y),t.rotate(this.activeRect.rotate*Math.PI/180),t.translate(-i.x,-i.y)),(a<4||this.hotkeyType===Yt.Resize)&&(t.beginPath(),t.fillRect(i.x-4.5,i.y-4.5,8,8),t.strokeRect(i.x-5.5,i.y-5.5,10,10)),this.activeRect.rotate&&t.restore()})),!this.store.data.locked&&this.dragRect&&(t.save(),t.fillStyle=Wr(this.store.options.dragColor,.2),t.strokeStyle=this.store.options.dragColor,t.beginPath(),t.strokeRect(this.dragRect.x,this.dragRect.y,this.dragRect.width,this.dragRect.height),t.fillRect(this.dragRect.x,this.dragRect.y,this.dragRect.width,this.dragRect.height),t.restore()),this.dock&&(t.strokeStyle=this.store.options.dockColor,this.dock.xDock&&(t.beginPath(),t.moveTo(this.dock.xDock.x,this.dock.xDock.y),t.lineTo(this.dock.xDock.x,this.dock.xDock.prev.y),t.stroke()),this.dock.yDock&&(t.beginPath(),t.moveTo(this.dock.yDock.x,this.dock.yDock.y),t.lineTo(this.dock.yDock.prev.x,this.dock.yDock.y),t.stroke())),t.restore()});W(this,"transTimeout");W(this,"pastePen",(t,i)=>{const a=t.id;if(Af(t),t.parentId=i,t.type===$t.Line?this.changeNodeConnectedLine(a,t,this.store.clipboard.pens):this.changeLineAnchors(a,t,this.store.clipboard.pens),!t.parentId){const n=this.getPenRect(t,this.store.clipboard.origin,this.store.clipboard.scale),r=this.getPenRect(this.store.clipboard.initRect,this.store.clipboard.origin,this.store.clipboard.scale),{origin:l,scale:o}=this.store.data;t.x=l.x+n.x*o,t.y=l.y+n.y*o,t.width=n.width*o,t.height=n.height*o,r.x=l.x+r.x*o,r.y=l.y+r.y*o,Qt(r),this.store.clipboard.pos&&(t.x-=r.center.x-this.store.clipboard.pos.x,t.y-=r.center.y-this.store.clipboard.pos.y),this.keyOptions&&this.keyOptions.altKey&&(this.keyOptions.ctrlKey||this.keyOptions.metaKey)?(t.x=-this.store.data.x+this.width/2-t.width/2,t.y=-this.store.data.y+this.height/2-t.height/2):this.keyOptions&&this.keyOptions.shiftKey&&(this.keyOptions.ctrlKey||this.keyOptions.metaKey||this.keyOptions.F)||(t.x+=this.store.clipboard.offset*this.store.data.scale,t.y+=this.store.clipboard.offset*this.store.data.scale)}this.makePen(t);const s=[];if(Array.isArray(t.children))for(const n of t.children){const r=this.store.clipboard.pens.find(l=>l.id===n);r&&s.push(this.pastePen(r,t.id).id)}return t.children=s,Yi(t,!0),t});W(this,"ondblclick",t=>{var i,a,s;if(this.store.hover&&(!this.store.data.locked||this.store.hover.dbInput)&&!this.store.options.disableInput)if(this.store.hover.onShowInput)this.store.hover.onShowInput(this.store.hover,t);else if(this.store.hover&&this.store.hover.parentId)if(((i=this.store.active)==null?void 0:i.length)===1&&this.store.active[0].id===this.store.hover.id)this.showInput(this.store.hover);else{if(this.store.pens[this.store.hover.parentId].children.forEach(n=>{this.store.pens[n].calculative.active=!1,this.store.pens[n].calculative.hover=!1}),this.store.hover.parentId){let n=this.store.hover.id;const r=this.calibrateMouse({x:t.offsetX,y:t.offsetY});let l=1/0;(s=(a=this.store.pens[this.store.hover.parentId])==null?void 0:a.children)==null||s.forEach(o=>{const u=this.store.pens[o];if(Ui(r,u.calculative.worldRect)){const c=Math.sqrt((r.x-u.calculative.worldRect.center.x)**2+(r.y-u.calculative.worldRect.center.y)**2);c{if(!window||!this.store.hover||this.store.hover.locked||this.store.hover.externElement||this.store.hover.disableInput||this.store.hover.disabled)return;if(this.inputDiv.dataset.penId===t.id){this.inputDiv.dataset.isInput="true",this.inputDiv.contentEditable="true",this.inputDiv.focus();const c=window.getSelection();c.selectAllChildren(this.inputDiv),c.collapseToEnd(),this.inputDiv.scrollTop=this.inputDiv.scrollHeight,this.inputDiv.scrollLeft=this.inputDiv.scrollWidth;return}!i&&!t.dbInput?this.setInputStyle(t):(this.inputDiv.style.width="100%",this.inputDiv.style.height="100%");const s=i||t.calculative.worldTextRect,l=`${(t.calculative.tempText===void 0?t.text+""||"":t.calculative.tempText).replace(/\x20/g," ").split(/[\s\n]/).join("
")}
`.replace("","").replace(/\\<\/div\>/g,"

");this.inputDiv.innerHTML=l,this.inputParent.style.left=s.x+this.store.data.x-(t.calculative.textLeft||0)+"px",this.inputParent.style.top=s.y+this.store.data.y-(t.calculative.textTop||0)+"px";let o=s.width;this.inputParent.style.width=(o<0?12:o)+"px",this.inputParent.style.height=s.height+(t.textTop||0)+"px",this.inputParent.style.zIndex="9999",this.inputParent.style.background=a,t.rotate%360?this.inputParent.style.transform=`rotate(${t.rotate}deg)`:this.inputParent.style.transform=null,this.inputParent.style.display="flex",this.inputDiv.dataset.penId=t.id,this.inputDiv.contentEditable=t.disableInput==null?"true":t.disableInput.toString(),t.dropdownList&&this.dropdown.style.display!=="block"&&(this.dropdown.style.background=t.dropdownBackground||this.store.styles.popContentBg||"#fff",this.dropdown.style.color=t.dropdownColor||"#bdc7db",this.dropdown.style.width=this.inputParent.style.width,this.dropdown.style.fontSize=(t.fontSize||12)+"px",this.setDropdownList(),this.externalElements.style.zIndex="9999"),this.inputDiv.contentEditable="true",this.inputDiv.focus();const u=window.getSelection();u.selectAllChildren(this.inputDiv),u.collapseToEnd(),this.inputDiv.scrollTop=this.inputDiv.scrollHeight,this.inputDiv.scrollLeft=this.inputDiv.scrollWidth,t.calculative.text=void 0,this.initTemplateCanvas([t]),this.render()});W(this,"setInputStyle",t=>{t.text||(t.text="");let i;for(let o=0;o1?t.textLeft*n:t.textLeft*n/r}px;`),t.textTop&&(a+=`margin-top:${r>1?t.textTop*n:t.textTop*n/r}px;`),t.lineHeight&&(a+=`line-height:${r>1?t.fontSize*t.lineHeight*r:t.fontSize*t.lineHeight*n}px;`),t.textHeight)a+=`height:${r>1?t.textHeight*n*r:t.textHeight*n}px;`;else{let o=t.calculative.worldRect.height/r;o<0&&(o=0);let u=t.fontSize*r<12?o*n:o*r*n;u-1?t.textWidth*t.calculative.worldRect.width:t.textWidth,t.whiteSpace!=="pre-line"&&(l1?l*n*r:l*n}px;`);else if(t.whiteSpace===void 0||t.whiteSpace==="break-all"){let o=(t.calculative.worldTextRect.width||12)/r;o<0&&(o=0),a+=`width:${t.fontSize*r<12?o*n:o*r}px;`}if(t.whiteSpace&&(t.whiteSpace==="pre-line"?a+="white-space:pre;":(a+=`white-space:${t.whiteSpace};`,t.whiteSpace==="nowrap"&&(s+="display:contents;"))),t.whiteSpace!=="nowrap"){let o=t.fontSize*1.2*t.text.length,u=(l||t.calculative.worldRect.width/r)*Math.floor(t.calculative.worldRect.height/r/(t.lineHeight*t.fontSize));o>u&&(a+="justify-content: start;")}i.deleteRule(0),i.deleteRule(0),i.insertRule(`.meta2d-input .input-div{ resize:none;border:none;outline:none;background:transparent;position:absolute;flex-grow:1;height:100%;width: 100%;position:absolute;left:0;top:0;display:flex;flex-direction: column;cursor: text;${a}}`),i.insertRule(`.input-div div{${s}}`)});W(this,"hideInput",()=>{if(this.externalElements.style.zIndex="5",this.inputParent.style.display==="flex"){this.inputParent.style.display="none";const t=this.store.pens[this.inputDiv.dataset.penId];if(!t)return;if(t.calculative.text=t.text,this.inputDiv.dataset.value=this.inputDiv.innerHTML.replace(/\/g,` `).replace(/\<\/div\>/g,"").replace(/\/g,"").replace(/ /g," ").replace(/(<([^>]+)>)/gi,""),this.inputDiv.dataset.value=this.convertSpecialCharacter(this.inputDiv.dataset.value),t.onInput)t.onInput(t,this.inputDiv.dataset.value);else if(t.text!==this.inputDiv.dataset.value){const i=[ht(t,!0)];t.text=this.inputDiv.dataset.value,t.calculative.text=t.text,this.inputDiv.dataset.penId=void 0,t.text&&t.textAutoAdjust&&!t.parentId&&$x(t),Fi(t),this.patchFlags=!0,this.pushHistory({type:bt.Update,pens:[ht(t,!0)],initPens:i}),this.store.emitter.emit("change",t),this.store.emitter.emit("valueUpdate",t)}else t.text===this.inputDiv.dataset.value&&t.calculative.textLines.length==0&&Fi(t);this.initTemplateCanvas([t])}this.inputDiv.dataset.penId=void 0,this.dropdown.style.display="none",this.inputDiv.dataset.isInput="false",this.inputDiv.contentEditable="false",this.render()});W(this,"setDropdownList",t=>{this.clearDropdownList();const i=this.store.pens[this.inputDiv.dataset.penId];if(!this.store.data.locked&&!["tablePlus"].includes(i.name))return;if(this.dropdown.style.display="block",!i||!i.dropdownList){this.dropdown.style.display="none";return}if(!i.dropdownList.length){const n=document.createElement("div");n.innerText="None",n.style.padding="5px 12px",n.style.color="#ddd",this.dropdown.appendChild(n);return}const a=this.inputDiv.innerHTML.replace(/\/g,` `).replace(/\<\/div\>/g,"").replace(/\/g,"");let s=0;for(const n of i.dropdownList){const r=typeof n=="string"?n:n.text;t&&a?r.includes(a)&&this.dropdownAppendOption(r,s):this.dropdownAppendOption(r,s),++s}if(!this.dropdown.hasChildNodes()){const n=document.createElement("div");n.innerText="None",n.style.padding="5px 12px",n.style.color="#ddd",this.dropdown.appendChild(n)}});W(this,"selectDropdown",t=>{const i=t.target,a=this.store.pens[this.inputDiv.dataset.penId];if(!i||!a||!a.dropdownList)return;const s=+i.dataset.i,n=a.dropdownList[s];if(!n)return;const r=[ht(a,!0)];typeof n=="object"?(this.updateValue(a,{...n}),a.calculative.text=void 0,this.calcActiveRect()):a.text=n+"",this.inputDiv.innerText=a.text,this.hideInput(),this.pushHistory({type:bt.Update,pens:[ht(a,!0)],initPens:r}),this.render(),this.store.emitter.emit("change",a),this.store.emitter.emit("valueUpdate",a)});W(this,"inFitBorder",t=>{let i;const a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height;let n={x:(t.x-this.store.data.origin.x)/this.store.data.scale,y:(t.y-this.store.data.origin.y)/this.store.data.scale};const r=this.canvasImage.activeFit;this.externalElements.style.cursor="default",n.y>s*r.y-10&&n.ys*(r.y+r.height)-10&&n.ya*r.x-10&&n.xa*(r.x+r.width)-10&&n.x{this.patchFlags=!0,this.store.lastHover&&(this.store.lastHover.calculative.hover=!1);let n=this.store.data.pens.find(r=>r.calculative.hover===!0);tn(n,!1)},this.popconfirm=new tE(i,a),this.dialog=new Z_(i,a),this.title=new Kr(i),this.store.options.scroll&&(this.scroll=new wg(this)),this.store.dpiRatio=globalThis.devicePixelRatio||1,this.store.dpiRatio<1?this.store.dpiRatio=1:this.store.dpiRatio>1&&this.store.dpiRatio<1.5&&(this.store.dpiRatio=1.5),this.clientRect=this.externalElements.getBoundingClientRect(),this.listen(),window==null||window.addEventListener("resize",this.onResize),window==null||window.addEventListener("scroll",this.onScroll),window==null||window.addEventListener("message",this.onMessage)}listen(){switch(this.externalElements.addEventListener("gesturestart",this.onGesturestart),this.externalElements.ondragover=t=>t.preventDefault(),this.externalElements.ondrop=this.ondrop,this.externalElements.oncontextmenu=t=>t.preventDefault(),this.store.options.interval=50,this.externalElements.ontouchstart=this.ontouchstart,this.externalElements.ontouchmove=this.ontouchmove,this.externalElements.ontouchend=this.ontouchend,this.externalElements.onmousedown=t=>{this.onMouseDown({x:t.offsetX,y:t.offsetY,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:t.buttons})},this.externalElements.onmousemove=t=>{t.target===this.externalElements&&this.onMouseMove({x:t.offsetX,y:t.offsetY,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:t.buttons})},this.externalElements.onmouseup=t=>{this.onMouseUp({x:t.offsetX,y:t.offsetY,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,altKey:t.altKey,buttons:t.buttons,button:t.button})},this.externalElements.onmouseleave=t=>{this.store.data.pens.forEach(i=>{i.calculative.hover&&(i.calculative.hover=!1)}),this.store.hover&&(this.store.hover.calculative.hover=!1,this.store.hover=void 0),this.render(),t.toElement!==this.tooltip.box&&t.toElement!==this.tooltip.arrowUp&&t.toElement!==this.tooltip.arrowDown&&(this.tooltip.hide(),this.store.lastHover=void 0)},this.externalElements.ondblclick=this.ondblclick,this.externalElements.tabIndex=0,this.externalElements.onblur=()=>{this.mouseDown=void 0},this.externalElements.onwheel=this.onwheel,document.addEventListener("copy",this.onCopy),document.addEventListener("cut",this.onCut),document.addEventListener("paste",this.onPaste),this.store.options.keydown){case Ba.Document:document.addEventListener("keydown",this.onkeydown),document.addEventListener("keyup",this.onkeyup);break;case Ba.Canvas:this.externalElements.addEventListener("keydown",this.onkeydown),this.externalElements.addEventListener("keyup",this.onkeyup);break}}splitLine(t,i){const a=t.calculative.worldAnchors,s=a.findIndex(c=>c===i);if([-1,0,a.length-1].includes(s))return;const n=ht(t,!0),r=ht(t,!0),l=St();r.id=l,r.calculative.canvas=this,r.calculative.active=!1,r.calculative.hover=!1;const o=ht(a.slice(0,s+1)),u=ht(a.slice(s)).map(c=>(c.penId=l,c));t.calculative.worldAnchors=o,r.calculative.worldAnchors=u,this.initLineRect(t),this.initLineRect(r),this.store.data.pens.push(r),this.store.pens[l]=r,this.pushHistory({type:bt.Add,pens:[ht(r,!0)],step:2}),this.pushHistory({type:bt.Update,initPens:[n],pens:[ht(t,!0)],step:2})}translateAnchor(t,i){this.movingAnchor.x+=t,this.movingAnchor.y+=i;const a=this.movingAnchor.penId;if(a){const s=this.store.pens[a],n=s.calculative.worldRect;this.movingAnchor.xn.ex&&(this.movingAnchor.x=n.ex),this.movingAnchor.yn.ey&&(this.movingAnchor.y=n.ey);const r=rn(this.movingAnchor,n),l=s.anchors.findIndex(o=>o.id===this.movingAnchor.id);s.anchors[l]=r,this.patchFlags=!0}}async fileToPen(t,i){let a="";return this.store.options.uploadFn?a=await this.store.options.uploadFn(t):this.store.options.uploadUrl?a=await Yx(t,this.store.options.uploadUrl,this.store.options.uploadParams,this.store.options.uploadHeaders):a=await qx(t),new Promise((s,n)=>{const r=new Image;r.onload=()=>{Et.htmlElements[a]=r,s({width:r.width,height:r.height,name:i?"gif":"image",image:a})},r.onerror=l=>{n(l)},r.crossOrigin="anonymous",r.src=a})}async dropPens(t,i){var o,u,c,f;this.randomIdObj={};for(const g of t)!g.parentId&&this.randomCombineId(g,t);if(Object.keys(this.randomIdObj).length!==0){const g=Object.keys(this.randomIdObj).join("|"),v=new RegExp(`(${g})`,"g");for(const m of t){if(m.type?(m.anchors[0].connectTo=this.randomIdObj[m.anchors[0].connectTo],m.anchors[m.anchors.length-1].connectTo=this.randomIdObj[m.anchors[m.anchors.length-1].connectTo]):(o=m.connectedLines)==null||o.forEach(w=>{w.lineAnchor=this.randomIdObj[w.lineAnchor],w.lineId=this.randomIdObj[w.lineId]}),(u=m.animations)!=null&&u.length){const w=JSON.stringify(m.animations).replace(v,y=>this.randomIdObj[y]);m.animations=JSON.parse(w)}if((c=m.triggers)!=null&&c.length){const w=JSON.stringify(m.triggers).replace(v,y=>this.randomIdObj[y]);m.triggers=JSON.parse(w)}if((f=m.events)!=null&&f.length){const w=JSON.stringify(m.events).replace(v,y=>this.randomIdObj[y]);m.events=JSON.parse(w)}}}for(const g of t)g.id||(g.id=St()),!g.calculative&&(g.calculative={canvas:this}),this.store.pens[g.id]=g;let a=0,s=0,n=0;for(const g of t)g.parentId||(g.width*=this.store.data.scale,g.height*=this.store.data.scale,g.x=i.x-g.width/2+n,g.y=i.y-g.height/2+s,g.tags&&g.tags.includes("meta3d")&&(g.x=this.store.data.origin.x,g.y=this.store.data.origin.y),g.dataset&&(a%2===0?n=g.width-40*this.store.data.scale:n=0,a++,a%2===0&&(s+=g.height+10*this.store.data.scale)));const r=this.store.data.width||this.store.options.width,l=this.store.data.height||this.store.options.height;if(r&&l){let g={x:this.store.data.origin.x,y:this.store.data.origin.y,width:r*this.store.data.scale,height:l*this.store.data.scale},v=!0;for(const m of t)if(!m.parentId){let w=[{x:m.x,y:m.y},{x:m.x+m.width,y:m.y},{x:m.x,y:m.y+m.height},{x:m.x+m.width,y:m.y+m.height},{x:m.x+m.width/2,y:m.y+m.height/2}];if(m.x===g.x&&m.y===g.y&&m.width===g.width&&m.height===g.height||w.some(y=>Ui(y,g))){v=!1,this.store.options.strictScope&&(m.xg.x+g.width&&(m.x=g.x+g.width-m.width),m.y+m.height>g.y+g.height&&(m.y=g.y+g.height-m.height));break}}if(v){console.info("\u753B\u7B14\u5728\u5927\u5C4F\u8303\u56F4\u5916");return}}await this.addPens(t,!0),this.active(t.filter(g=>!g.parentId)),this.render(),this.externalElements.focus()}randomCombineId(t,i,a){let s=null;t.type?t.anchors[0].connectTo||t.anchors[t.anchors.length-1].connectTo?s=[t.id,t.anchors[0].id,t.anchors[t.anchors.length-1].id]:s=[t.id]:i.length>1&&(s=[t.id]),Af(t),i.length>1&&(s.length===1?this.randomIdObj[s[0]]=t.id:(this.randomIdObj[s[0]]=t.id,this.randomIdObj[s[1]]=t.anchors[0].id,this.randomIdObj[s[2]]=t.anchors[t.anchors.length-1].id)),t.parentId=a;const n=[];if(Array.isArray(t.children))for(const r of t.children){const l=i.find(o=>o.id===r);l&&n.push(this.randomCombineId(l,i,t.id).id)}return t.children=n,t}async addPens(t,i,a){if(this.beforeAddPens&&await this.beforeAddPens(t)!=!0)return[];const s=[];for(const n of t)this.beforeAddPen&&this.beforeAddPen(n)!=!0||(a&&!n.parentId&&(n.x=n.x*this.store.data.scale+this.store.data.origin.x,n.y=n.y*this.store.data.scale+this.store.data.origin.y,n.width=n.width*this.store.data.scale,n.height=n.height*this.store.data.scale),this.makePen(n),s.push(n));return this.render(),this.store.emitter.emit("add",s),i&&this.pushHistory({type:bt.Add,pens:ht(s,!0)}),s}getInitPencilLine(t){const{data:i,options:a}=this.store,s=i.scale,n=i.lineWidth||1;return{id:t.penId,name:"line",x:t.x,y:t.y,type:$t.Line,calculative:{canvas:this,pencil:!0,active:!0,worldAnchors:[t],lineWidth:n*s},fromArrow:i.fromArrow||a.fromArrow,toArrow:i.toArrow||a.toArrow,lineWidth:n}}createDrawingLine(t){this.inactive();const{data:i,options:a}=this.store,s=i.scale,n=i.lineWidth||1;return t.penId=St(),{id:t.penId,name:"line",lineName:this.drawingLineName,x:t.x,y:t.y,type:$t.Line,calculative:{canvas:this,active:!0,worldAnchors:[t],lineWidth:n*s,...a.linePresetStyle},fromArrow:i.fromArrow||a.fromArrow,toArrow:i.toArrow||a.toArrow,lineWidth:n,...a.linePresetStyle}}addRuleLine(t){const{x:i,y:a,scale:s,origin:n}=this.store.data,r=t.x+i,l=t.y+a;let o=t.x,u=t.y,c=0,f=0,g=0,v=0;if(r<=l&&r<20)o=-i,c=this.width,g=1,t.ctrlKey||(u=Math.round((u-n.y)/(s*10))*(s*10)+n.y);else if(lt.isRuleLine)}alignPenToGrid(t){var a;if(this.store.options.autoAlignGrid&&this.store.data.grid&&!t.type){const s=this.store.data.gridSize||this.store.options.gridSize,{origin:n,scale:r}=this.store.data,{x:l,y:o}=t,u={x:l,y:o},c=this.getPenRect(t),f=parseInt((c.x/s).toFixed()),g=parseInt((c.y/s).toFixed()),v=f*s,m=g*s;u.x=n.x+v*r,u.y=n.y+m*r,Object.assign(t,u),(a=t.onMove)==null||a.call(t,t),this.updatePenRect(t),this.calcActiveRect(),this.getSizeCPs()}}movedActivePens(t){let i=this.getAllFollowersByPens(this.store.active,!1);const a=ht(i,!0),s=this.store.data.gridSize||this.store.options.gridSize,{origin:n,scale:r}=this.store.data,l=this.store.options.autoAlignGrid&&(this.store.data.grid||this.store.options.grid);if(i.forEach(g=>{var _;const v=this.movingPens.findIndex(A=>A.id===g.id+He);if(v<0)return;const{x:m,y:w}=this.movingPens[v],y={x:m,y:w};if(l&&!this.movingPens[v].type){const A=this.getPenRect(this.movingPens[v]),x=parseInt((A.x/s).toFixed()),C=parseInt((A.y/s).toFixed()),T=x*s,I=C*s;y.x=n.x+T*r,y.y=n.y+I*r}Object.assign(g,y),(_=g.onMove)==null||_.call(g,g),this.updatePenRect(g),this.updateLines(g),this.store.emitter.emit("updateLines",g),this.patchFlagsLines.forEach(A=>{A.type&&this.initLineRect(A)}),this.patchFlagsLines.clear(),g.calculative.x=g.x,g.calculative.y=g.y,g.calculative.initRect&&(g.calculative.initRect.x=g.calculative.x,g.calculative.initRect.y=g.calculative.y,g.calculative.initRect.ex=g.calculative.x+g.calculative.width,g.calculative.initRect.ey=g.calculative.y+g.calculative.height),sg(g),g.parentId&&this.parent.updateRectbyChild(g.calculative.worldRect,g,this.store.pens[g.parentId])}),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),!this.dock)return;const{xDock:o,yDock:u}=this.dock;let c;o&&(c=this.store.pens[o.penId]),!c&&u&&(c=this.store.pens[u.penId]);const f=ht(this.store.active,!0);if(t&&this.store.active.length===1&&(c==null?void 0:c.type)===1&&((o==null?void 0:o.anchorId)||(u==null?void 0:u.anchorId))){const g=le(c),v=Vt(c);if(o!=null&&o.anchorId){const m=this.store.pens[this.store.active[0].id+He].calculative.worldAnchors.find(w=>w.id===o.anchorId);m.x===g.x&&m.y===g.y?(a.push(ht(c,!0)),we(this.store.active[0],m,c,g),f.push(ht(c,!0))):m.x===v.x&&m.y===v.y&&(a.push(ht(c,!0)),we(this.store.active[0],m,c,v),f.push(ht(c,!0)))}else if(u!=null&&u.anchorId){const m=this.store.pens[this.store.active[0].id+He].calculative.worldAnchors.find(w=>w.id===u.anchorId);m.x===g.x&&m.y===g.y?(a.push(ht(c,!0)),we(this.store.active[0],m,c,g),f.push(ht(c,!0))):m.x===v.x&&m.y===v.y&&(a.push(ht(c,!0)),we(this.store.active[0],m,c,v),f.push(ht(c,!0)))}}l&&(this.calcActiveRect(),this.getSizeCPs()),this.pushHistory({type:bt.Update,pens:f,initPens:a}),this.store.emitter.emit("translatePens",f)}copyMovedPens(){this.copy(this.store.active.map((t,i)=>{const{x:a,y:s}=this.movingPens[i];return this.updateLines(t),{...t,x:a,y:s}})),this.pasteOffset=!1,this.paste()}initImageCanvas(t){t.some(i=>this.hasImage(i,!1))&&this.canvasImage.init(),t.some(i=>this.hasImage(i,!0))&&this.canvasImageBottom.init()}initTemplateCanvas(t){t.some(i=>i.canvasLayer===zt.CanvasTemplate)&&this.canvasTemplate.init()}hasImage(t,i){var a;return t.image&&t.name!=="gif"?i?t.canvasLayer===zt.CanvasImageBottom:t.canvasLayer===zt.CanvasImage:(a=t.children)==null?void 0:a.some(s=>{const n=this.store.pens[s];return n&&this.hasImage(n,i)})}inactive(t){!this.store.active.length||(this.initTemplateCanvas(this.store.active),this.store.active.forEach(i=>{i.calculative.active=void 0,i.calculative.activeAnchor=void 0,i.calculative.hover=!1,ys(i,!1)}),!t&&this.store.emitter.emit("inactive",this.store.active),this.store.active=[],this.activeRect=void 0,this.sizeCPs=void 0,this.store.activeAnchor=void 0,this.patchFlags=!0)}active(t,i=!0){if(this.store.active){i&&this.store.emitter.emit("inactive",this.store.active);for(const a of this.store.active)a.calculative.active=void 0,a.calculative.hover=!1,ys(a,!1)}this.store.active=[],t.forEach(a=>{a.calculative.active=!0,ys(a)}),this.store.active.push(...t),this.activeRect=void 0,this.calcActiveRect(),this.initTemplateCanvas(t),this.patchFlags=!0,i&&this.store.emitter.emit("active",this.store.active)}getSizeCPs(){this.sizeCPs=Zi(this.activeRect);const t=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}],{x:i,y:a,width:s,height:n,rotate:r,center:l}=this.activeRect;t.forEach(o=>{const u={x:o.x*s+i,y:o.y*n+a};Gt(u,r,l),this.sizeCPs.push(u)})}getSpecialAngle(t,i){let a=0;t.x-i.x!==0?(a=Math.atan((i.y-t.y)/(t.x-i.x))*180/Math.PI,t.x0?a-=180:a+=180)):i.y>t.y?a=90:i.yMt.DisableEdit||!(i.type&&i.calculative.active)&&this.store.options.disableAnchor||i.disableAnchor)return xt.None;if((this.mouseDown||this.drawingLine)&&i.name==="line"&&a.connectTo){const n=this.findOne(a.connectTo);if((n==null?void 0:n.calculative)&&!(n!=null&&n.calculative.active)){i=n;const r=n.calculative.worldAnchors.find(l=>l.id===a.anchorId);r&&(a=r)}}if(a.twoWay===Ae.Disable&&i.name!=="line")return xt.None;if(i.name==="line"&&a.connectTo){let n=(s=this.findOne(a.connectTo))==null?void 0:s.anchors.find(r=>r.id===a.anchorId);if(n&&n.twoWay)return xt.None}if(this.drawingLine){if(a.twoWay===Ae.Out)return xt.None}else if(!(this.mouseDown&&this.hoverType===xt.LineAnchor)){if(a.twoWay===Ae.In)return xt.None}if(ms(t,a,this.pointSize,a.penId?this.store.pens[a.penId]:void 0))return a!==this.store.hoverAnchor&&(this.patchFlags=!0),this.store.hoverAnchor=a,this.store.hover=i,i.type?a.connectTo&&!i.calculative.active&&(this.store.hover=this.store.pens[a.connectTo],this.store.hover)?(this.store.hoverAnchor=this.store.hover.calculative.worldAnchors.find(n=>n.id===a.anchorId),this.store.hoverAnchor?(this.externalElements.style.cursor="crosshair",xt.NodeAnchor):xt.None):(this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="vertical-text":this.externalElements.style.cursor="pointer",xt.LineAnchor):(this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="vertical-text":this.externalElements.style.cursor="crosshair",xt.NodeAnchor);if(!this.mouseDown&&i.type){if(i.calculative.active&&a.prev&&ms(t,a.prev,this.pointSize))return this.store.hoverAnchor=a,this.store.hover=i,this.externalElements.style.cursor="pointer",xt.LineAnchorPrev;if(i.calculative.active&&a.next&&ms(t,a.next,this.pointSize))return this.store.hoverAnchor=a,this.store.hover=i,this.externalElements.style.cursor="pointer",xt.LineAnchorNext}return xt.None}resize(t,i){t=t||this.parentElement.clientWidth,i=i||this.parentElement.clientHeight,this.width=t,this.height=i,this.canvasRect={x:0,y:0,width:t,height:i},re(this.canvasRect),this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",this.externalElements.style.width=t+"px",this.externalElements.style.height=i+"px",this.canvasTemplate.resize(t,i),this.canvasImage.resize(t,i),this.canvasImageBottom.resize(t,i),this.magnifierCanvas.resize(t,i),t=t*this.store.dpiRatio|0,i=i*this.store.dpiRatio|0,this.canvas.width=t,this.canvas.height=i,this.offscreen.width=t,this.offscreen.height=i,this.clientRect=this.externalElements.getBoundingClientRect(),this.canvas.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle";for(const a of this.store.data.pens)a.isRuleLine&&(a.width?a.height||(a.width=this.width):a.height=this.height,this.updatePenRect(a)),Yi(a);this.render()}clearCanvas(){this.activeRect=void 0,this.sizeCPs=void 0,this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.offscreen.width,this.offscreen.height),this.store.data.template||this.canvasTemplate.clear(),this.canvasImage.clear(),this.canvasImageBottom.clear()}async addPen(t,i,a,s){if(!(this.beforeAddPens&&await this.beforeAddPens([t])!=!0)&&!(this.beforeAddPen&&this.beforeAddPen(t)!=!0))return s&&(t.x=t.x*this.store.data.scale+this.store.data.origin.x,t.y=t.y*this.store.data.scale+this.store.data.origin.y,t.width=t.width*this.store.data.scale,t.height=t.height*this.store.data.scale),this.makePen(t),this.active([t]),this.render(),a&&this.store.emitter.emit("add",[t]),i&&this.pushHistory({type:bt.Add,pens:[t]}),t}pushHistory(t){var s;if(this.store.data.locked)return;const{origin:i,scale:a}=this.store.data;t.origin=ht(i),t.scale=a,t.type!==bt.Update&&t.pens&&t.pens.forEach(n=>{n.calculative&&(n.calculative.layer=this.store.data.pens.findIndex(r=>r.id===n.id))}),this.store.historyIndex{let r;if(t.initPens)for(const l of t.initPens)l.id===n.id&&(r=l);if(r)for(const l in n)r[l]==null&&(r[l]=void 0)}),this.store.histories.push(t),this.store.historyIndex=this.store.histories.length-1,this.store.emitter.emit("update",{previous:t.initPens,current:t.pens})}undo(){if(this.store.data.locked||this.store.historyIndex==null||this.store.historyIndex<0)return;const t=this.store.histories[this.store.historyIndex--];this.doEditAction(t,!0);let i=t.step;for(;i>1;){const a=this.store.histories[this.store.historyIndex--];this.doEditAction(a,!0),i--}(t.type==bt.Add||t.type==bt.Delete||t.type==bt.Update)&&this.activeHistory()}redo(){if(this.store.data.locked||this.store.historyIndex==null||this.store.historyIndex>this.store.histories.length-2)return;const t=this.store.histories[++this.store.historyIndex];this.doEditAction(t,!1);let i=t.step;for(;i>1;){const a=this.store.histories[++this.store.historyIndex];this.doEditAction(a,!1),i--}(t.type==bt.Add||t.type==bt.Delete||t.type==bt.Update)&&this.activeHistory()}activeHistory(){let t=this.store.histories[this.store.historyIndex+1];const i=[];if(t&&t.type===bt.Update){t.pens.forEach(s=>{i.push(this.store.pens[s.id])}),this.active(i);return}let a=this.store.histories[this.store.historyIndex];a&&(a.type===bt.Add||a.type===bt.Delete)&&(a.pens.forEach(s=>{i.push(this.store.pens[s.id])}),this.active(i))}doEditAction(t,i){switch(this.inactive(),this.store.hoverAnchor=void 0,this.store.hover=void 0,t.type){case bt.Add:t.pens.forEach(n=>{var o;const r=ht(n,!0),l=this.store.data.pens.findIndex(u=>u.id===r.id);l>-1&&((o=r.onDestroy)==null||o.call(r,this.store.pens[r.id]),this.store.data.pens.splice(l,1),this.store.pens[r.id]=void 0,r.calculative||(r.calculative={}),r.calculative.canvas=this,this.store.animates.delete(r),this.store.animateMap.delete(r))}),t.type=bt.Delete;break;case bt.Update:const a=i?t.initPens:t.pens,s=i?t.pens:t.initPens;a.forEach(n=>{const r=ht(n,!0),l=this.store.data.pens.findIndex(o=>o.id===r.id);if(l>-1){if(r.calculative=this.store.data.pens[l].calculative,this.store.data.pens[l].type&&this.store.data.pens[l].lastConnected){for(let u in this.store.data.pens[l].lastConnected)if(this.store.pens[u]){let c=ht(this.store.data.pens[l].lastConnected[u]);this.store.pens[u].connectedLines=c,r.anchors.forEach(f=>{c.forEach(g=>{f.id===g.lineAnchor&&(f.connectTo=u)})})}}this.store.data.pens[l]=r,this.store.pens[r.id]=r;for(const u in r)(typeof r[u]!="object"||u==="lineDash")&&(r.calculative[u]=r[u]);r.calculative.image=void 0;const o=this.getPenRect(r,t.origin,t.scale);if(this.setPenRect(r,o,!1),this.updateLines(r,!0),r.calculative.canvas.parent.isCombine(r)){let u=s.find(c=>c.id===r.id);Nd.forEach(c=>{r[c]!==u[c]&&this.parent.setValue({id:r.id,[c]:r[c]},{render:!0,doEvent:!1})})}}});break;case bt.Delete:t.pens.reverse().forEach(n=>{var l,o;const r=ht(n,!0);if(r.calculative||(r.calculative={}),this.store.data.pens.splice(((l=r.calculative)==null?void 0:l.layer)!==-1?(o=r.calculative)==null?void 0:o.layer:this.store.data.pens.length,0,r),this.store.pens[r.id]=r,r.type&&r.lastConnected)for(let u in r.lastConnected)this.store.pens[u]&&(this.store.pens[u].connectedLines=r.lastConnected[u]);r.calculative.canvas=this}),t.pens.reverse().forEach(n=>{const r=this.store.pens[n.id],l=this.getPenRect(r,t.origin,t.scale);this.setPenRect(r,l,!1),r.calculative.image=void 0,r.calculative.backgroundImage=void 0,r.calculative.strokeImage=void 0,this.loadImage(r)}),t.type=bt.Add;break;case bt.Replace:{const n=i?t.initPens:t.pens;(i?t.pens:t.initPens).forEach(l=>{var c;const o=ht(l,!0);if(this.store.data.pens.findIndex(f=>f.id===o.id)>-1){(c=o.onDestroy)==null||c.call(o,this.store.data.pens.find(g=>g.id===o.id));const f=this.store.data.pens.findIndex(g=>g.id===o.id);this.store.data.pens.splice(f,1),this.store.pens[o.id]=void 0,o.calculative||(o.calculative={}),o.calculative.canvas=this,this.store.animates.delete(o),this.store.animateMap.delete(o)}}),n.reverse().forEach(l=>{var u,c;const o=ht(l,!0);if(o.calculative||(o.calculative={}),this.store.data.pens.splice(((u=o.calculative)==null?void 0:u.layer)!==-1?(c=o.calculative)==null?void 0:c.layer:this.store.data.pens.length,0,o),this.store.pens[o.id]=o,o.type&&o.lastConnected)for(let f in o.lastConnected)this.store.pens[f]&&(this.store.pens[f].connectedLines=o.lastConnected[f]);o.calculative.canvas=this}),n.reverse().forEach(l=>{const o=this.store.data.pens.find(c=>c.id===l.id),u=this.getPenRect(o,t.origin,t.scale);this.setPenRect(o,u,!1),o.calculative.image=void 0,o.calculative.backgroundImage=void 0,o.calculative.strokeImage=void 0,this.loadImage(o)}),t.type=bt.Replace;break}}if(t.type===bt.Update){let a=[...t.pens,...t.initPens];this.initImageCanvas(a),this.initTemplateCanvas(a)}else this.initImageCanvas(t.pens),this.initTemplateCanvas(t.pens);this.parent.onSizeUpdate(),this.render(),this.store.emitter.emit(i?"undo":"redo",t)}makePen(t){var s,n;if(t.id||(t.id=St()),Math.abs(this.store.lastScale-this.store.data.scale)<1e-4&&this.store.sameTemplate&&this.store.templatePens[t.id]&&t.canvasLayer===zt.CanvasTemplate){t=this.store.templatePens[t.id],this.store.data.pens.push(t),this.updatePenRect(t);return}if(t.copyIndex?(this.store.data.pens.splice(t.copyIndex+1,0,t),delete t.copyIndex):this.store.data.pens.push(t),this.store.pens[t.id]=t,t.path){!t.pathId&&(t.pathId=St());const r=this.store.data.paths;!r[t.pathId]&&(r[t.pathId]=t.path),t.path=void 0}t.lineWidth==null&&(t.lineWidth=1);const{fontSize:i,lineHeight:a}=this.store.options;t.fontSize?t.fontSize<0&&(t.fontSize=0):t.fontSize=i>=0?i:12,t.lineHeight||(t.lineHeight=a),t.image&&t.name!=="gif"&&t.canvasLayer===void 0&&(t.isBottom?t.canvasLayer=zt.CanvasImageBottom:t.canvasLayer=zt.CanvasImage,delete t.isBottom),t.template&&(t.canvasLayer=zt.CanvasTemplate),t.calculative={canvas:this,singleton:(s=t.calculative)==null?void 0:s.singleton},(t.video||t.audio)&&(t.calculative.onended=r=>{this.nextAnimate(r)});for(const r in t)(typeof t[r]!="object"||r==="lineDash")&&(t.calculative[r]=t[r]);if(t.calculative.image=void 0,t.calculative.backgroundImage=void 0,t.calculative.strokeImage=void 0,!t.anchors&&Et.anchors[t.name]&&(t.anchors||(t.anchors=[]),Et.anchors[t.name](t)),!t.anchors){const r=ht(this.store.options.defaultAnchors);r.forEach((l,o)=>{l.id=`${o}`,l.penId=t.id}),t.anchors=r}this.updatePenRect(t),!t.anchors&&t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(r=>rn(r,t.calculative.worldRect))),!t.rotate&&(t.rotate=0),(n=t.lineAnimateImages)!=null||(t.lineAnimateImages=[]),t.lineAnimateImages&&t.lineAnimateImages.forEach(r=>{this.__loadImage(r)}),this.loadImage(t),this.parent.penNetwork(t)}drawline(t){var i;!this.drawingLine||((i=this[this.drawingLineName])==null||i.call(this,this.store,this.drawingLine,t),this.store.path2dMap.set(this.drawingLine,Et.path2dDraws.line(this.drawingLine)),this.patchFlags=!0)}initLineRect(t){var n;if(!t)return;if(!((n=t.calculative.worldAnchors)!=null&&n.length)){this._del([t]);return}if(!isFinite(t.x)||!isFinite(t.x)||t.x==null||t.y==null)return;const i=ic(t);t.parentId||Object.assign(t,i);const{fontSize:a,lineHeight:s}=this.store.options;t.fontSize||(t.fontSize=a>=0?a:12,t.calculative.fontSize=t.fontSize*this.store.data.scale),t.lineHeight||(t.lineHeight=s,t.calculative.lineHeight=t.lineHeight),Qt(i),t.calculative.worldRect=i,wc(t,i),Fi(t),Yi(t),t.calculative&&(t.calculative.gradientAnimatePath=void 0),this.store.path2dMap.set(t,Et.path2dDraws[t.name](t)),t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(r=>rn(r,t.calculative.worldRect)))}drawingPencil(){bg(this.store),this.pencil=!0,this.externalElements.style.cursor="crosshair"}stopPencil(){this.pencil=!1,this.pencilLine=void 0,this.externalElements.style.cursor="default"}async finishDrawline(t){if(!this.drawingLine)return;const i=le(this.drawingLine);let a=Vt(this.drawingLine);if(a.isTemp&&(this.drawingLine.calculative.worldAnchors.pop(),a=Vt(this.drawingLine)),!t&&(!a.connectTo&&this.drawingLine.calculative.worldAnchors.pop(),le(this.drawingLine)===this.drawingLine.calculative.activeAnchor)){this.drawingLine=void 0,this.render();return}if(!i.connectTo||!a.connectTo){if(this.store.options.disableEmptyLine){i.connectTo&&(this.store.pens[i.connectTo].connectedLines=this.store.pens[i.connectTo].connectedLines.filter(r=>r.lineId!==this.drawingLine.id)),this.drawingLine=void 0,this.render();return}}else if(this.store.options.disableRepeatLine&&this.store.data.pens.find(l=>{if(l.type){const o=le(l),u=Vt(l);return df(o,i)&&df(u,a)}})){this.drawingLine=void 0,this.render();return}const s=ic(this.drawingLine);Object.assign(this.drawingLine,s),this.drawingLine.calculative.worldRect=s,this.drawingLine.calculative.activeAnchor=Vt(this.drawingLine),this.store.activeAnchor=this.drawingLine.calculative.activeAnchor,(!this.beforeAddPens||await this.beforeAddPens([this.drawingLine]))&&(!this.beforeAddPen||this.beforeAddPen(this.drawingLine))&&(this.initLineRect(this.drawingLine),this.store.data.pens.push(this.drawingLine),this.store.pens[this.drawingLine.id]=this.drawingLine,this.store.emitter.emit("add",[this.drawingLine]),this.active([this.drawingLine]),this.pushHistory({type:bt.Add,pens:ht([this.drawingLine],!0)})),this.store.path2dMap.set(this.drawingLine,Et.path2dDraws[this.drawingLine.name](this.drawingLine)),this.drawingLine=void 0,this.drawingLineName=void 0,this.render()}async finishPencil(){if(this.pencilLine){const t=ac(this.pencilLine.calculative.worldAnchors,10,0,this.pencilLine.calculative.worldAnchors.length-1);let i=le(this.pencilLine);t.unshift({id:i.id,penId:i.penId,x:i.x,y:i.y}),i=Vt(this.pencilLine),t.push({id:i.id,penId:i.penId,x:i.x,y:i.y}),this.pencilLine.calculative.worldAnchors=O_(t),this.pencilLine.calculative.worldAnchors.length>1&&(this.pencilLine.calculative.pencil=!1,this.store.path2dMap.set(this.pencilLine,Et.path2dDraws[this.pencilLine.name](this.pencilLine)),(!this.beforeAddPens||await this.beforeAddPens([this.pencilLine]))&&(!this.beforeAddPen||this.beforeAddPen(this.pencilLine))&&(this.initLineRect(this.pencilLine),this.store.data.pens.push(this.pencilLine),this.store.pens[this.pencilLine.id]=this.pencilLine,this.store.emitter.emit("add",[this.pencilLine]),this.active([this.pencilLine]),this.pushHistory({type:bt.Add,pens:ht([this.pencilLine],!0)}))),this.pencilLine=void 0,this.render()}}firefoxLoadSvg(t){const i=new Image,a=new XMLHttpRequest;a.open("GET",t.image,!0),a.onload=()=>{const r=new DOMParser().parseFromString(a.responseText,"text/xml").getElementsByTagName("svg")[0],{width:l,height:o}=t.calculative.worldRect;r.setAttribute("width",`${l}px`),r.setAttribute("height",`${o}px`);const c="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(new XMLSerializer().serializeToString(r))));i.src=c,i.onload=()=>{t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,Et.htmlElements[t.image]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&this.templateImageLoaded()}},a.send()}loadImage(t){if(t.image!==t.calculative.image||!t.calculative.img){if(t.calculative.img=void 0,t.image)if(Et.htmlElements[t.image]){const i=Et.htmlElements[t.image];t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&this.templateImageLoaded()}else if(navigator.userAgent.includes("Firefox")&&t.image.endsWith(".svg"))this.firefoxLoadSvg(t);else{const i=new Image;i.crossOrigin=t.crossOrigin==="undefined"?void 0:t.crossOrigin||"anonymous",i.src=t.image,this.store.options.cdn&&!(t.image.startsWith("http")||t.image.startsWith("//")||t.image.startsWith("data:image"))&&(i.src=this.store.options.cdn+t.image),i.onload=()=>{t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,Et.htmlElements[t.image]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&this.templateImageLoaded()}}t.calculative.image=t.image}if(t.backgroundImage!==t.calculative.backgroundImage){if(t.calculative.backgroundImg=void 0,t.backgroundImage)if(Et.htmlElements[t.backgroundImage]){const i=Et.htmlElements[t.backgroundImage];t.calculative.backgroundImg=i}else{const i=new Image;i.crossOrigin="anonymous",i.src=t.backgroundImage,this.store.options.cdn&&!(t.backgroundImage.startsWith("http")||t.backgroundImage.startsWith("//")||t.backgroundImage.startsWith("data:image"))&&(i.src=this.store.options.cdn+t.backgroundImage),i.onload=()=>{t.calculative.backgroundImg=i,Et.htmlElements[t.backgroundImage]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&this.templateImageLoaded()}}t.calculative.backgroundImage=t.backgroundImage}if(t.strokeImage!==t.calculative.strokeImage){if(t.calculative.strokeImg=void 0,t.strokeImage)if(Et.htmlElements[t.strokeImage]){const i=Et.htmlElements[t.strokeImage];t.calculative.strokeImg=i}else{const i=new Image;i.crossOrigin="anonymous",i.src=t.strokeImage,this.store.options.cdn&&!(t.strokeImage.startsWith("http")||t.strokeImage.startsWith("//")||t.strokeImage.startsWith("data:image"))&&(i.src=this.store.options.cdn+t.strokeImage),i.onload=()=>{t.calculative.strokeImg=i,Et.htmlElements[t.strokeImage]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&t.name!=="gif"&&this.templateImageLoaded()}}t.calculative.strokeImage=t.strokeImage}}__loadImage(t){return new Promise(i=>{if(Et.htmlElements[t])i(Et.htmlElements[t]);else{const a=new Image;a.crossOrigin="anonymous",a.src=t,this.store.options.cdn&&!(t.startsWith("http")||t.startsWith("//")||t.startsWith("data:image"))&&(a.src=this.store.options.cdn+t),a.onload=()=>{Et.htmlElements[t]=a,i(a)}}})}imageLoaded(){this.imageTimer&&clearTimeout(this.imageTimer),this.imageTimer=setTimeout(()=>{this.canvasImage.init(),this.canvasImageBottom.init(),this.render()},100)}templateImageLoaded(){this.templateImageTimer&&clearTimeout(this.templateImageTimer),this.templateImageTimer=setTimeout(()=>{this.canvasTemplate.init(),this.render()},100)}setCalculativeByScale(t){const i=this.store.data.scale;t.calculative.lineWidth=t.lineWidth*i,t.calculative.fontSize=t.fontSize*i,t.fontSize<1&&t.fontSize>0&&(t.calculative.fontSize=t.fontSize*t.calculative.worldRect.height),t.calculative.iconSize=t.iconSize*i,t.calculative.iconWidth=t.iconWidth*i,t.calculative.iconHeight=t.iconHeight*i,t.calculative.iconLeft=t.iconLeft<1&&t.iconLeft>-1?t.iconLeft:t.iconLeft*i,t.calculative.iconTop=t.iconTop<1&&t.iconTop>-1?t.iconTop:t.iconTop*i,t.calculative.textWidth=t.textWidth<1&&t.textWidth>-1?t.textWidth:t.textWidth*i,t.calculative.textHeight=t.textHeight<1&&t.textHeight>-1?t.textHeight:t.textHeight*i,t.calculative.textLeft=t.textLeft<1&&t.textLeft>-1?t.textLeft*t.calculative.worldRect.width:t.textLeft*i,t.calculative.textTop=t.textTop<1&&t.textTop>-1?t.textTop*t.calculative.worldRect.height:t.textTop*i,t.type===$t.Line&&t.borderWidth&&(t.calculative.borderWidth=t.borderWidth*i)}updatePenRect(t,{worldRectIsReady:i,playingAnimate:a}={}){i?Ir(t):ag(t),a||this.setCalculativeByScale(t),As(t),mf(this.store.pens,t),Fi(t),Yi(t),Et.path2dDraws[t.name]&&this.store.path2dMap.set(t,Et.path2dDraws[t.name](t)),t.calculative.patchFlags=!0,this.patchFlags=!0,t.children&&t.children.forEach(s=>{const n=this.store.pens[s];n&&this.updatePenRect(n,{worldRectIsReady:!1})}),t.type&&this.initLineRect(t),t.calculative.gradientTimer&&clearTimeout(t.calculative.gradientTimer),t.calculative.gradientTimer=setTimeout(()=>{t.calculative.lineGradient&&(t.calculative.lineGradient=null),t.calculative.gradient&&(t.calculative.gradient=null),t.calculative.radialGradient&&(t.calculative.radialGradient=null),this.patchFlags=!0,t.calculative.gradientTimer=void 0},50)}initGlobalStyle(){if(this.store.options.themeOnlyCanvas||this.store.data.themeOnlyCanvas)return;const t={},i={},a={};Nx.forEach(n=>{var r;if(this.store.options[n]!==void 0&&(t[n]=this.store.options[n]),this.store.data[n]!==void 0&&(i[n]=this.store.data[n]),this.store.data.theme){const l=(r=this.store.theme[this.store.data.theme])==null?void 0:r[n];l!==void 0&&(a[n]=l)}}),this.store.styles={};const s=Qs.getThemeObj(this.store.data.theme);Object.assign(this.store.styles,t,i,a,s)}translate(t=0,i=0){if(this.store.data.x+=t*this.store.data.scale,this.store.data.y+=i*this.store.data.scale,this.store.data.x=Math.round(this.store.data.x),this.store.data.y=Math.round(this.store.data.y),this.store.options.padding){let a=qi(this.store.options.padding);const s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;this.width<(s+a[1]+a[3])*this.store.data.scale&&(this.store.data.x+this.store.data.origin.x>a[3]*this.store.data.scale&&(this.store.data.x=a[3]*this.store.data.scale-this.store.data.origin.x),this.store.data.x+this.store.data.origin.x+s*this.store.data.scalea[0]*this.store.data.scale&&(this.store.data.y=a[0]*this.store.data.scale-this.store.data.origin.y),this.store.data.y+this.store.data.origin.y+n*this.store.data.scale{this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render()},300)):(this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render()),this.store.emitter.emit("translate",{x:this.store.data.x,y:this.store.data.y}),this.tooltip.translate(t,i),this.scroll&&this.scroll.isShow&&this.scroll.translate(t,i),this.onMovePens()}onMovePens(){var i;const t=this.parent.map;t&&t.isShow&&t.setView();for(const a of this.store.data.pens)Yi(a),(i=a.onMove)==null||i.call(a,a),a.isRuleLine&&(a.width?a.height||(a.x=-this.store.data.x):a.y=-this.store.data.y,this.updatePenRect(a))}scale(t,i={x:0,y:0}){var l;const a=this.store.data.minScale||this.store.options.minScale,s=this.store.data.maxScale||this.store.options.maxScale;if(!(t>=a&&t<=s))return;this.calibrateMouse(i);const n=t/this.store.data.scale;this.store.data.scale=t,this.store.data.center=i,(l=this.store.clipboard)!=null&&l.pos&&Hr(this.store.clipboard.pos,n,i),Hr(this.store.data.origin,n,i),this.store.data.pens.forEach(o=>{if(o.onScale&&o.onScale(o),!o.parentId){if(ds(o,n,i),o.isRuleLine){const u=1/n,c=o.calculative.worldRect.center;o.width&&o.height||ds(o,u,c)}this.updatePenRect(o,{worldRectIsReady:!0}),this.execPenResize(o)}}),this.onMovePens(),this.calcActiveRect(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init();const r=this.parent.map;r&&r.isShow&&r.setView(),this.render(),this.store.emitter.emit("scale",this.store.data.scale)}templateScale(t,i={x:0,y:0}){const{minScale:a,maxScale:s}=this.store.options;if(!(t>=a&&t<=s))return;const n=t/this.store.data.scale;this.store.data.scale=t,this.store.data.center={x:0,y:0},this.store.data.origin={x:0,y:0},this.store.data.pens.forEach(r=>{if(!r.parentId){if(ds(r,n,i),r.onScale&&r.onScale(r),r.isRuleLine){const l=n>1?1:1/n/n,o=r.calculative.worldRect.center;r.width&&r.height||ds(r,l,o)}this.execPenResize(r)}}),this.calcActiveRect()}rotatePens(t){this.initPens||(this.initPens=ht(this.getAllByPens(this.store.active))),this.activeRect.rotate=ui(t,this.activeRect.center),this.activeRect.rotate%90<10&&(this.activeRect.rotate-=this.activeRect.rotate%90),this.activeRect.rotate%90>80&&(this.activeRect.rotate+=90-this.activeRect.rotate%90),this.store.active.length===1&&(this.lastRotate=this.store.active[0].rotate||0);const i=this.activeRect.rotate-this.lastRotate;for(const a of this.store.active){if(a.parentId)return;this.rotatePen(a,i,this.activeRect),a.onRotate&&a.onRotate(a),this.updateLines(a)}this.lastRotate=this.activeRect.rotate,this.getSizeCPs(),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),this.render(),this.store.emitter.emit("rotatePens",this.store.active),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.getAllByPens(this.store.active)),initPens:this.initPens}),this.initPens=void 0},200)}resizePens(t){if(this.initPens||(this.initPens=ht(this.store.active,!0)),!this.initActiveRect){this.initActiveRect=ht(this.activeRect);return}const i={x:this.mouseDown.x,y:this.mouseDown.y},a={x:t.x,y:t.y};let s=a.x-i.x,n=a.y-i.y;const r=ht(this.initActiveRect);if(kf(r,s,n,this.resizeIndex),Qt(r),!this.store.options.disableDock){this.clearDock();const v=this.customResizeDock||O2;this.dock=v(this.store,r,this.store.active,this.resizeIndex);const{xDock:m,yDock:w}=this.dock;if(m){s+=m.step;const y=this.store.pens[m.penId];y.calculative.isDock=!0}if(w){n+=w.step;const y=this.store.pens[w.penId];y.calculative.isDock=!0}}const l=this.activeRect.width,o=this.activeRect.height;let u=s-this.lastOffsetX,c=n-this.lastOffsetY;if(this.lastOffsetX=s,this.lastOffsetY=n,(t.ctrlKey||this.initPens.length===1&&this.initPens[0].ratio)&&(c=([1,3].includes(this.resizeIndex)?-1:1)*(u*o)/l),this.activeRect.ratio=this.initPens[0].ratio,kf(this.activeRect,u,c,this.resizeIndex),this.store.options.strictScope){const v=this.store.data.width||this.store.options.width,m=this.store.data.height||this.store.options.height;if(v&&m){let w={x:this.store.data.origin.x,y:this.store.data.origin.y,width:v*this.store.data.scale,height:m*this.store.data.scale};this.activeRect.xw.x+w.width&&(this.activeRect.width=this.activeRect.width-(this.activeRect.x+this.activeRect.width-(w.x+w.width)),this.activeRect.x=w.x+w.width-this.activeRect.width,this.activeRect.ex=this.activeRect.x+this.activeRect.width),this.activeRect.y+this.activeRect.height>w.y+w.height&&(this.activeRect.height=this.activeRect.height-(this.activeRect.y+this.activeRect.height-(w.y+w.height)),this.activeRect.y=w.y+w.height-this.activeRect.height,this.activeRect.ey=this.activeRect.y+this.activeRect.height)}}Qt(this.activeRect);const f=this.activeRect.width/l,g=this.activeRect.height/o;this.store.active.forEach((v,m)=>{v.calculative.worldRect.x=this.activeInitPos[m].x*this.activeRect.width+this.activeRect.x,v.calculative.worldRect.y=this.activeInitPos[m].y*this.activeRect.height+this.activeRect.y,v.calculative.worldRect.width*=f,v.calculative.iconWidth&&(v.calculative.iconWidth*=f),v.calculative.worldRect.height*=g,v.calculative.iconHeight&&(v.calculative.iconHeight*=g),re(v.calculative.worldRect),Qt(v.calculative.worldRect),this.updatePenRect(v,{worldRectIsReady:!0}),this.execPenResize(v),this.updateLines(v)}),this.getSizeCPs(),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),this.render(),this.store.emitter.emit("resizePens",this.store.active),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}movePens(t){var l,o;if(!this.activeRect||this.store.data.locked)return;if(!this.initActiveRect){this.initActiveRect=ht(this.activeRect);return}if(!this.store.options.moveConnectedLine&&!this.canMoveLine&&this.store.active.length===1&&(((l=this.store.active[0].anchors[0])==null?void 0:l.connectTo)||((o=this.store.active[0].anchors[this.store.active[0].anchors.length-1])==null?void 0:o.connectTo))||(this.movingPens||(this.initMovingPens(),this.store.active.forEach(u=>{tn(u,!1)}),this.store.hover=void 0),!this.mouseDown))return;let i=t.x-this.mouseDown.x,a=t.y-this.mouseDown.y;t.shiftKey&&!t.ctrlKey&&(a=0),t.ctrlKey&&(i=0);const s=ht(this.initActiveRect);Da(s,i,a);let n=!1;if(this.store.options.strictScope){const u=this.store.data.width||this.store.options.width,c=this.store.data.height||this.store.options.height;if(u&&c){let f={x:this.store.data.origin.x,y:this.store.data.origin.y,width:u*this.store.data.scale,height:c*this.store.data.scale};s.xf.x+f.width&&(s.x=f.x+f.width-s.width,n=!0),s.y+s.height>f.y+f.height&&(s.y=f.y+f.height-s.height,n=!0)}}const r={x:s.x-this.activeRect.x,y:s.y-this.activeRect.y};if(!this.store.options.disableDock&&!n){this.clearDock();const u=this.customMoveDock||M2;this.dock=u(this.store,s,this.movingPens,r);const{xDock:c,yDock:f}=this.dock;let g;c&&(r.x+=c.step,g=this.store.pens[c.penId],g.calculative.isDock=!0),f&&(r.y+=f.step,g=this.store.pens[f.penId],g.calculative.isDock=!0)}this.translatePens(this.movingPens,r.x,r.y,!0)}changeIdsByMoving(t,i){t.id+=He,t.parentId&&i.find(a=>a.id===t.parentId)&&(t.parentId+=He),t.children&&(t.children=t.children.map(a=>a+He)),t.connectedLines&&(t.connectedLines=t.connectedLines.map(a=>(i.find(s=>s.id===a.lineId)&&(a.lineId+=He),a))),t.type&&t.calculative.worldAnchors&&(t.calculative.worldAnchors=t.calculative.worldAnchors.map(a=>(a.connectTo&&i.find(s=>s.id===a.connectTo)&&(a.connectTo+=He),a)))}initMovingPens(){var a,s;if(!this.store.options.moveConnectedLine&&!this.canMoveLine)for(let n=0;n{this.changeIdsByMoving(n,i),this.store.pens[n.id]=n,n.calculative.canvas=this;const r={globalAlpha:.5};n.lineWidth===0&&(r.lineWidth=1),(n.name.endsWith("Dom")||Od.includes(n.name)||this.store.options.domShapes.includes(n.name)||n.image)&&(r.name="rectangle",r.onDestroy=void 0),this.updateValue(n,r),n.calculative.image=void 0})}moveLineAnchor(t,i){var l,o,u,c,f;if(!this.activeRect||this.store.data.locked)return;if(this.initPens||(this.initPens=ht(this.store.active,!0)),(l=this.store.activeAnchor)!=null&&l.connectTo){const g=this.store.pens[this.store.activeAnchor.connectTo];xs(g,Ia(g,this.store.activeAnchor.anchorId),this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor)}let a=(o=this.store.activeAnchor)==null?void 0:o.id,s=(c=(u=this.store.pens[this.store.activeAnchor.penId])==null?void 0:u.connectedLines)==null?void 0:c.filter(g=>g.anchor===a);s&&s.length>0&&s.forEach(g=>{const v=this.store.pens[g.lineId];xs(this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor,v,Ia(v,g.lineAnchor))});const n=this.store.active[0];le(n);const r=Vt(n);if(n.lineName==="polyline"&&!i.shiftKey)M_(n,this.store.activeAnchor,t);else{let g=0,v=0;if(n.lineName==="line"){let m=n.calculative.worldAnchors.findIndex(y=>y.id===this.store.activeAnchor.id);m===0&&(m=2);let w=n.calculative.worldAnchors[m-1];if(i.ctrlKey&&i.shiftKey){let y=ht(t);this.getSpecialAngle(y,w),g=y.x-this.store.activeAnchor.x,v=y.y-this.store.activeAnchor.y}else if(!i.ctrlKey&&i.shiftKey){let y={x:t.x,y:w.y};g=y.x-this.store.activeAnchor.x,v=y.y-this.store.activeAnchor.y}else if(i.ctrlKey&&!i.shiftKey){let y={x:w.x,y:t.y};g=y.x-this.store.activeAnchor.x,v=y.y-this.store.activeAnchor.y}else g=t.x-this.store.activeAnchor.x,v=t.y-this.store.activeAnchor.y}else!i.ctrlKey&&i.shiftKey?(g=t.x-this.store.activeAnchor.x,v=0):i.ctrlKey&&!i.shiftKey?(g=0,v=t.y-this.store.activeAnchor.y):(g=t.x-this.store.activeAnchor.x,v=t.y-this.store.activeAnchor.y);nn(this.store.activeAnchor,g,v),this.store.hover&&this.store.hoverAnchor&&this.store.hoverAnchor.penId!==this.store.activeAnchor.penId&&(this.store.hoverAnchor.type===$i.Line?(g=t.x-this.store.activeAnchor.x,v=t.y-this.store.activeAnchor.y,mr(this.store.activeAnchor,this.store.hoverAnchor,this.store)):(g=this.store.hoverAnchor.x-this.store.activeAnchor.x,v=this.store.hoverAnchor.y-this.store.activeAnchor.y),nn(this.store.activeAnchor,g,v),r.prev=void 0,n.lineName!=="polyline"&&((f=this[n.lineName])==null||f.call(this,this.store,n)))}this.patchFlagsLines.add(n),this.store.path2dMap.set(n,Et.path2dDraws[n.name](n)),this.render(),this.store.active[0].calculative&&(this.store.active[0].calculative.gradientAnimatePath=void 0),this.store.emitter.emit("moveLineAnchor",{pen:this.store.active[0],anchor:this.store.activeAnchor}),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},500)}moveLineAnchorPrev(t){if(!this.activeRect||this.store.data.locked||!this.store.activeAnchor)return;if(this.initPens||(this.initPens=ht(this.store.active,!0)),this.store.activeAnchor.prev.x=t.x,this.store.activeAnchor.prev.y=t.y,this.store.activeAnchor.next){if(!this.store.activeAnchor.prevNextType)this.store.activeAnchor.next.x=t.x,this.store.activeAnchor.next.y=t.y,Gt(this.store.activeAnchor.next,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===Na.Bilateral&&this.prevAnchor){const a=ui(t,this.store.activeAnchor),s=ui(this.prevAnchor,this.store.activeAnchor);this.store.activeAnchor.next.x=this.nextAnchor.x,this.store.activeAnchor.next.y=this.nextAnchor.y,Gt(this.store.activeAnchor.next,a-s,this.store.activeAnchor)}}const i=this.store.active[0];this.patchFlagsLines.add(i),this.store.path2dMap.set(i,Et.path2dDraws[i.name](i)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}moveLineAnchorNext(t){if(!this.activeRect||this.store.data.locked||!this.store.activeAnchor)return;if(this.initPens||(this.initPens=ht(this.store.active,!0)),this.store.activeAnchor.next.x=t.x,this.store.activeAnchor.next.y=t.y,this.store.activeAnchor.prev){if(!this.store.activeAnchor.prevNextType)this.store.activeAnchor.prev.x=t.x,this.store.activeAnchor.prev.y=t.y,Gt(this.store.activeAnchor.prev,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===Na.Bilateral&&this.nextAnchor){const a=ui(t,this.store.activeAnchor),s=ui(this.nextAnchor,this.store.activeAnchor);this.store.activeAnchor.prev.x=this.prevAnchor.x,this.store.activeAnchor.prev.y=this.prevAnchor.y,Gt(this.store.activeAnchor.prev,a-s,this.store.activeAnchor)}}const i=this.store.active[0];this.patchFlagsLines.add(i),this.store.path2dMap.set(i,Et.path2dDraws[i.name](i)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:bt.Update,pens:ht(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}async setAnchor(t){var s;const i=[ht(this.store.hover,!0)],a=this.store.hover;if(this.store.hoverAnchor){if(this.beforeRemoveAnchor&&!await this.beforeRemoveAnchor(a,this.store.hoverAnchor))return;a.type===$t.Line&&((s=a.calculative.worldAnchors)==null?void 0:s.length)<=2?this.delete([a]):(A2(a,this.store.hoverAnchor),a.type===$t.Line&&this.initLineRect(a)),this.store.hoverAnchor=void 0,this.store.activeAnchor=void 0,this.externalElements.style.cursor="default"}else if(a){if(this.beforeAddAnchor&&!await this.beforeAddAnchor(a,this.store.pointAt))return;if(a.type===$t.Line){this.store.activeAnchor=E2(a,this.store.pointAt,this.store.pointAtIndex),this.initLineRect(a);const n={x:t.x,y:t.y};this.getHover(n)}else{const n={id:St(),x:t.x,y:t.y};this.store.activeAnchor=_2(a,n)}}this.hotkeyType=Yt.None,this.render(),a&&this.pushHistory({type:bt.Update,pens:[ht(a,!0)],initPens:i})}checkDisconnect(t,i){if(t.id.indexOf(He)>0){const a=t.id;t=this.store.pens[a.replace(He,"")]}t.anchors.forEach(a=>{if(a.connectTo&&!i.find(s=>s.id===a.connectTo||s.id===a.connectTo+He)){const s=this.store.pens[a.connectTo];if(!s||s.type)return;xs(s,Ia(s,a.anchorId),t,a)}})}translatePens(t=this.store.active,i,a,s){if(!t||!t.length||t.some(o=>{if(o.locked>=Mt.DisableMove)return!0}))return;const r=!s&&ht(t,!0);this.activeRect&&Da(this.activeRect,i,a);const l=this.getAllByPens(t);t.forEach(o=>{var u,c;if(!(o.locked>=Mt.DisableMove)){if(o.type===$t.Line){if(!this.store.options.moveConnectedLine&&!this.canMoveLine||o.isRuleLine)return;yf(o,i,a),this.checkDisconnect(o,l),this.store.path2dMap.set(o,Et.path2dDraws[o.name](o)),s||(this.initLineRect(o),(u=o.connectedLines)==null||u.forEach(f=>{const g=this.store.pens[f.lineId];this.initLineRect(g)}))}else Da(o.calculative.worldRect,i,a),this.updatePenRect(o,{worldRectIsReady:!0}),o.calculative.x=o.x,o.calculative.y=o.y,o.calculative.initRect&&(o.calculative.initRect.x=o.calculative.x,o.calculative.initRect.y=o.calculative.y,o.calculative.initRect.ex=o.calculative.x+o.calculative.width,o.calculative.initRect.ey=o.calculative.y+o.calculative.height);this.updateLines(o),(c=o.onMove)==null||c.call(o,o)}}),this.activeRect&&this.getSizeCPs(),this.render(),this.tooltip.translate(i,a),s||(this.pushHistory({type:bt.Update,pens:ht(t,!0),initPens:r}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.store.emitter.emit("translatePens",t)),this.store.emitter.emit("translatingPens",t)}templateTranslatePens(t=this.store.active,i,a){if(!t||!t.length)return;const s=this.getAllByPens(t);t.forEach(n=>{var r;if(n.type===$t.Line){if(!this.store.options.moveConnectedLine&&!this.canMoveLine)return;yf(n,i,a),this.checkDisconnect(n,s),this.store.path2dMap.set(n,Et.path2dDraws[n.name](n))}else Da(n.calculative.worldRect,i,a),this.updatePenRect(n,{worldRectIsReady:!0}),n.calculative.x=n.x,n.calculative.y=n.y,n.calculative.initRect&&(n.calculative.initRect.x=n.calculative.x,n.calculative.initRect.y=n.calculative.y,n.calculative.initRect.ex=n.calculative.x+n.calculative.width,n.calculative.initRect.ey=n.calculative.y+n.calculative.height);(r=n.onMove)==null||r.call(n,n)})}calcAutoAnchor(t,i,a,s){const n=le(t),r=Vt(t),l=bs(a,i===n?r:n);!l||(i.x=l.x,i.y=l.y,i.prev=void 0,i.next=void 0,s?s.anchor=l.id:we(a,l,t,i),this[t.lineName]&&this[t.lineName](this.store,t),this.store.path2dMap.set(t,Et.path2dDraws.line(t)),this.initLineRect(t))}restoreNodeAnimate(t){var i,a;if(t.calculative.initRect){if(t.keepAnimateState)for(const s in t)t.calculative[s]!==void 0&&s!=="x"&&s!=="y"&&s!=="width"&&s!=="height"&&s!=="initRect"&&(typeof t[s]!="object"||s==="lineDash")&&(s==="fontSize"||s==="lineWidth"?t[s]=t.calculative[s]/t.calculative.canvas.store.data.scale:t[s]=t.calculative[s]);else{const s=t.calculative.initRect.rotate-t.calculative.rotate;for(const r in t)r!=="x"&&r!=="y"&&r!=="width"&&r!=="height"&&r!=="initRect"&&r!=="rotate"&&(typeof t[r]!="object"||r==="lineDash")&&(t.calculative[r]=t[r]);(i=t.children)!=null&&i.length?s&&rg(t,s,t.calculative.worldRect):t.calculative.rotate=t.rotate;const n=ht(this.store.animateMap.get(t));n&&(n.id=t.id,this.parent.setValue(n,{doEvent:!1,render:!0,history:!1})),t.calculative.worldRect=t.calculative.initRect}this.updatePenRect(t,{worldRectIsReady:!0}),this.updateLines(t),t.image&&t.name!=="gif"&&(this.canvasImage.init(),this.canvasImageBottom.init()),t.calculative.text!==t.text&&(t.calculative.text=t.text,_n(t)),(a=this.store.active)!=null&&a.length&&this.calcActiveRect(),t.calculative.initRect=void 0}}updateLines(t,i){var a;(a=t.children)==null||a.forEach(s=>{const n=this.store.pens[s];n&&this.updateLines(n,i)}),t.connectedLines&&t.connectedLines.forEach((s,n)=>{const r=this.store.pens[s.lineId];if(!r||r.calculative.active)return;const l=Ia(r,s.lineAnchor);if(!l)return;if(!l.connectTo){t.connectedLines.splice(n,1);return}if(r.autoFrom){const g=le(r);g.id===l.id&&this.calcAutoAnchor(r,g,t,s)}if(r.autoTo){const g=Vt(r);g.id===l.id&&this.calcAutoAnchor(r,g,t,s)}const o=Ia(t,s.anchor);if(!o)return;let u=t.rotate;t.flipX&&(u*=-1),t.flipY&&(u*=-1);let c=l.distance*this.store.data.scale*Math.cos((u+o.rotate)/180*Math.PI)||0,f=l.distance*this.store.data.scale*Math.sin((u+o.rotate)/180*Math.PI)||0;if(t.flipX&&(c=-c),t.flipY&&(f=-f),nn(l,o.x-l.x+c,o.y-l.y+f),this.store.options.autoPolyline&&!this.autoPolylineFlag&&r.autoPolyline!==!1&&r.lineName==="polyline"){let g=le(r),v=Vt(r),m=!1;g.id===l.id?(g=l,m=!0):v.id===l.id&&(v=l,m=!0),m&&(r.calculative.worldAnchors=[g,v],r.calculative.activeAnchor=g,this.polyline(this.store,r,v),this.initLineRect(r))}this.store.path2dMap.set(r,Et.path2dDraws[r.name](r)),this.patchFlagsLines.add(r),r.calculative.gradientSmooth&&(r.calculative.gradientAnimatePath=pc(r)),i&&Yr(r)})}calcActiveRect(){const t=this.store.active.filter(i=>(!i.locked||i.locked{Gt(s,i,a.center)}),this.initLineRect(t),Ir(t)):(t.calculative.rotate?t.calculative.rotate+=i:t.calculative.rotate=i,Gt(t.calculative.worldRect.center,i,a.center),t.parentId?(t.calculative.worldRect.x=t.calculative.worldRect.center.x-t.calculative.worldRect.width/2,t.calculative.worldRect.y=t.calculative.worldRect.center.y-t.calculative.worldRect.height/2,t.x=(t.calculative.worldRect.x-a.x)/a.width,t.y=(t.calculative.worldRect.y-a.y)/a.height):(t.x=t.calculative.worldRect.center.x-t.width/2,t.y=t.calculative.worldRect.center.y-t.height/2),t.rotate=t.calculative.rotate,this.updatePenRect(t),t.children&&t.children.forEach(s=>{const n=this.store.pens[s];this.rotatePen(n,i,t.calculative.worldRect)}))}nextAnimate(t){if(!t)return;this.store.emitter.emit("animateEnd",t);let i;t.nextAnimate&&(i=this.store.data.pens.filter(a=>a.id===t.nextAnimate||a.tags&&a.tags.indexOf(t.nextAnimate)>-1)),i&&(i.forEach(a=>{var s,n,r,l,o;if(a.calculative.pause){const u=Date.now()-a.calculative.pause;a.calculative.pause=void 0,a.calculative.frameStart+=u,a.calculative.frameEnd+=u}else if(a.name==="video")a.calculative.media.currentTime=0,(s=a.calculative.media)==null||s.play(),(n=a.onStartVideo)==null||n.call(a,a);else if(a.type||((r=a.frames)==null?void 0:r.length)||a.animations&&a.animations.length){if(a.type){if((o=a.animations)!=null&&o.length){const u=ht(a.animations[0]);delete u.name,u.currentAnimation=0,this.parent.setValue({id:a.id,...u},{doEvent:!1,history:!1})}}else{if(!a.frames&&a.animations&&a.animations.length){let u=(l=a.animations)==null?void 0:l.findIndex(g=>g.autoPlay),c=u===-1?0:u;const f=ht(a.animations[c]);delete f.name,f.currentAnimation=c,!a.type&&f.frames&&(f.showDuration=this.parent.calcAnimateDuration(f)),this.parent.setValue({id:a.id,...f},{doEvent:!1,history:!1})}this.store.animateMap.set(a,this.getFrameProps(a))}this.store.animates.add(a)}}),this.animate())}getFrameProps(t){let i={};return t.frames&&t.frames.forEach(a=>{for(let s in a)!["duration","x","y","width","height","rotate"].includes(s)&&!i[s]&&(i[s]=t[s])}),i}animate(){this.animateRendering||requestAnimationFrame(()=>{const t=Date.now();if(t-this.lastAnimateRender0&&this.animate();return}this.lastAnimateRender=t,this.animateRendering=!0;const i=[];let a=!1;for(const s of this.store.animates)if(!s.calculative.pause){if(s.calculative.active&&!s.type&&!this.movingPens&&(a=!0),!s.type)k2(s,t)?s.calculative.patchFlags&&(Qt(s.calculative.worldRect),this.updatePenRect(s,{worldRectIsReady:!0,playingAnimate:!0})):(requestAnimationFrame(()=>{this.restoreNodeAnimate(s)}),i.push(s),this.nextAnimate(s)),this.updateLines(s,!0);else if(!F2(s,t)){if(s.keepAnimateState){for(const n in s)s.calculative[n]!==void 0&&n!=="length"&&(typeof s[n]!="object"||n==="lineDash")&&(n==="lineWidth"?s[n]=s.calculative[n]/s.calculative.canvas.store.data.scale:s[n]=s.calculative[n]);Ir(s)}else for(const n in s)(typeof s[n]!="object"||n==="lineDash")&&(n==="lineWidth"?s.calculative[n]=s[n]*s.calculative.canvas.store.data.scale:s.calculative[n]=s[n]);i.push(s),this.nextAnimate(s)}this.patchFlags=!0}a&&this.calcActiveRect(),i.forEach(s=>{this.store.animates.delete(s)}),this.render(!1),this.animateRendering=!1,this.animate()})}get clipboardName(){return"meta2d-clipboard"}async copy(t,i=!0){const a=St(),{origin:s,scale:n}=this.store.data;this.store.clipboard=void 0,localStorage.removeItem(this.clipboardName),sessionStorage.setItem("page",a);let r=this.getAllByPens(ht(t||this.store.active,!0));r.forEach(o=>{o.copyIndex=this.store.data.pens.findIndex(u=>u.id===o.id),o.pathId&&(o.path=this.store.data.paths[o.pathId])}),r.sort((o,u)=>o.copyIndex-u.copyIndex);const l={meta2d:!0,pens:r,origin:ht(s),scale:n,page:a,initRect:ht(this.activeRect),offset:10,mousePos:ht(this.mousePos)};if(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox"))try{await navigator.clipboard.writeText(JSON.stringify(l))}catch{localStorage.setItem(this.clipboardName,JSON.stringify(l))}else localStorage.setItem(this.clipboardName,JSON.stringify(l));i&&this.store.emitter.emit("copy",l.pens)}cut(t){this.copy(t,!1),this.delete(t),this.store.emitter.emit("cut",t)}async paste(){var o,u;let t,i;if(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox"))try{t=await((o=navigator.clipboard)==null?void 0:o.readText())}catch{t=localStorage.getItem(this.clipboardName)}else t=localStorage.getItem(this.clipboardName);if(t){try{i=JSON.parse(t)}catch(c){console.warn("\u526A\u5207\u677F\u6570\u636E\u4E0D\u662Fjson",c.message);return}if(!i||!i.meta2d)return}else return;if(this.beforeAddPens&&await this.beforeAddPens(i.pens)!=!0)return;let a,s;this.store.clipboard&&(a=this.store.clipboard.offset+10,s=this.store.clipboard.pos),this.store.clipboard=ht(i);const n=sessionStorage.getItem("page"),r=this.store.data.scale;if(this.store.clipboard.mousePos&&(Math.abs(this.store.clipboard.mousePos.x-this.mousePos.x)>100*r||Math.abs(this.store.clipboard.mousePos.y-this.mousePos.y)>100*r)){let c=-this.store.clipboard.initRect.width/this.store.clipboard.scale/10/r,f=-this.store.clipboard.initRect.height/this.store.clipboard.scale/10/r,g=(r-this.store.clipboard.scale)*this.store.clipboard.initRect.width/2+c,v=(r-this.store.clipboard.scale)*this.store.clipboard.initRect.height/2+f;r1&&(g=(r-1)*this.store.clipboard.initRect.width/this.store.clipboard.scale/2,v=(r-1)*this.store.clipboard.initRect.height/this.store.clipboard.scale/2),this.store.clipboard.pos={x:this.mousePos.x-g,y:this.mousePos.y-v},this.store.clipboard.offset=0}else n!==i.page?(this.store.clipboard.pos={x:this.mousePos.x,y:this.mousePos.y},this.store.clipboard.offset=0):this.pasteOffset?(a&&(this.store.clipboard.offset=a),s&&(this.store.clipboard.pos=s)):(this.store.clipboard.offset=0,this.pasteOffset=!0);(u=this.keyOptions)!=null&&u.F||this.store.clipboard.pens.forEach(c=>{delete c.copyIndex});const l=this.store.clipboard.pens.filter(c=>!c.parentId);for(const c of l)this.pastePen(c,void 0);sessionStorage.setItem("page",i.page),this.active(l),this.pushHistory({type:bt.Add,pens:this.store.clipboard.pens}),this.render(),this.store.emitter.emit("add",this.store.clipboard.pens),this.store.emitter.emit("paste",this.store.clipboard.pens)}getAllByPens(t){const i=[];for(const a of t)i.push(...ht(Qe(a,this.store),!0));return i.concat(t)}getAllFollowersByPens(t,i=!0){const a=t;for(const s of t){let n=mc(s,this.store);i&&(n=ht(n,!0));for(const r of n)a.find(l=>l.id===r.id)||a.push(r)}return a}setFollowers(t=this.store.active){if(!!t)if(t.length<2)t[0].followers=[];else{let i=t.map(s=>s.id);i.pop();const a=t[t.length-1];a.followers?i.forEach(s=>{a.followers.includes(s)||a.followers.push(s)}):a.followers=i}}changeLineAnchors(t,i,a){if(!!Array.isArray(i.connectedLines))for(let s=0;sl.id===n);if(r){const l=r.anchors[0],o=r.anchors[r.anchors.length-1];l.connectTo===t&&(l.connectTo=i.id),o.connectTo===t&&(o.connectTo=i.id)}else i.connectedLines.splice(s,1),s--}}changeNodeConnectedLine(t,i,a){var l;const s=i.anchors[0],n=i.anchors[i.anchors.length-1],r=[s,n];for(const o of r){const u=o.connectTo;if(u){const c=a.find(f=>f.id===u);c?(l=c.connectedLines)==null||l.forEach(f=>{f.lineId===t&&(f.lineId=i.id,f.lineAnchor=o.id)}):(o.connectTo=void 0,o.prev&&(o.prev.connectTo=void 0),o.next&&(o.next.connectTo=void 0))}}}async delete(t=this.store.active,i=!1,a=!0){if(!t||!t.length||this.beforeRemovePens&&await this.beforeRemovePens(t)!=!0||(i||(t=t.filter(n=>!n.locked)),!t||!t.length))return;const s=[];if(this._del(t,s,i),this.initImageCanvas(s),this.initTemplateCanvas(s),this.inactive(),this.clearHover(),this.render(),a){if(s.length===0)return;this.pushHistory({type:bt.Delete,pens:s})}this.store.emitter.emit("delete",t)}_del(t,i,a){!t||t.forEach(s=>{if(s.type&&(s.lastConnected={}),s.parentId)if(this.getLockedParent(s)){console.warn("\u7236\u8282\u70B9\u9501\u5B9A");return}else{const r=ti(s),l=r.children.indexOf(s.id);r.children.splice(l,1),i&&this.getDelPens(s,i),this.delForce(s)}else{if(!a&&s.locked)return;i&&this.getDelPens(s,i),this.delForce(s)}})}getDelPens(t,i){if(!t)return;if(this.store.data.pens.findIndex(s=>s.id===t.id)>-1){const s=this.store.pens[t.id];s&&s.calculative&&(s.calculative.active=void 0),i.push(s)}t.children&&t.children.forEach(s=>{this.getDelPens(this.store.pens[s],i)})}getLockedParent(t){if(!t.parentId)return!1;const i=ti(t);if(i.locked)return i;this.getLockedParent(i)}delForce(t){var a;if(!t)return;const i=this.store.data.pens.findIndex(s=>s.id===t.id);i>-1&&(this.delConnectedLines(this.store.data.pens[i]),this.store.data.pens.splice(i,1),this.store.pens[t.id]=void 0,delete this.store.pens[t.id],t.pathId&&delete this.store.data.paths[t.pathId]),this.store.animates.delete(t),this.store.animateMap.delete(t),t.children&&t.children.forEach(s=>{this.delForce(this.store.pens[s])}),(a=t.onDestroy)==null||a.call(t,t)}delConnectedLines(t){var i;if(t.connectedLines)for(let a=0;ao.id===n);(l==null?void 0:l.connectTo)===t.id&&(l.connectTo=void 0,l.anchorId=void 0,l.prev&&(l.prev.connectTo=void 0),l.next&&(l.next.connectTo=void 0)),l=Ia(r,n),l&&(l.connectTo=void 0,l.anchorId=void 0,l.prev&&(l.prev.connectTo=void 0),l.next&&(l.next.connectTo=void 0))}}!t.type||(i=t.calculative.worldAnchors)==null||i.forEach((a,s)=>{var r;if(!a.connectTo)return;const n=this.store.pens[a.connectTo];n&&((r=n.calculative.worldAnchors)==null||r.forEach(l=>{xs(n,l,t,a)}))})}convertSpecialCharacter(t){var i={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return t.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(a,s){return i[s]})}createInput(){this.inputParent.classList.add("meta2d-input"),this.inputDiv.classList.add("input-div"),this.inputParent.appendChild(this.inputDiv),this.dropdown.onmouseleave=()=>{this.store.hover=null},this.inputParent.appendChild(this.dropdown),this.externalElements.appendChild(this.inputParent),this.inputParent.onmousedown=this.stopPropagation,this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.contentEditable="false",this.dropdown.onmousedown=this.stopPropagation;let t;for(let i=0;i{if(navigator.userAgent.includes("Firefox")){if(!i.target.innerText){let a=this.inputDiv.offsetWidth/2;window.getComputedStyle(this.inputDiv,null).textAlign!=="center"&&(a=0),this.inputDiv.innerHTML=`
`}}else if(i.target.innerText)this.inputDiv.style.paddingTop="";else{let a=window.getComputedStyle(this.inputDiv,null);a.justifyContent==="center"&&(this.inputDiv.style.paddingTop=` ${this.inputDiv.offsetHeight/2-parseFloat(a.lineHeight)/2}px`)}},this.inputDiv.onblur=()=>{setTimeout(()=>{this.hideInput()},300)},this.inputDiv.oninput=i=>{const a=this.store.pens[this.inputDiv.dataset.penId];if(a&&a.inputType==="number"){const s=i.target.innerText,n=s.replace(/[^0-9]/g,"");s!==n&&(i.preventDefault(),i.target.innerText=n)}if(navigator.userAgent.includes("Firefox")){if(!i.target.innerText.trim()){let s=this.inputDiv.offsetWidth/2;window.getComputedStyle(this.inputDiv,null).textAlign!=="center"&&(s=0),this.inputDiv.innerHTML=`
`}}else if(i.target.innerText)this.inputDiv.style.paddingTop="";else{let s=window.getComputedStyle(this.inputDiv,null);s.justifyContent==="center"&&(this.inputDiv.style.paddingTop=` ${this.inputDiv.offsetHeight/2-parseFloat(s.lineHeight)/2}px`)}this.store.emitter.emit("input",a)},this.inputDiv.onclick=i=>{i.stopPropagation();const a=this.store.pens[this.inputDiv.dataset.penId];this.dropdown.style.display==="block"?this.dropdown.style.display="none":(a==null?void 0:a.dropdownList)&&this.store.data.locked&&(this.dropdown.style.display="block"),this.store.emitter.emit("clickInput",a)},this.inputDiv.onkeyup=i=>{this.setDropdownList(!0);const a=this.store.pens[this.inputDiv.dataset.penId];this.store.emitter.emit("input",{pen:a,text:i.key}),i.stopPropagation()},this.inputDiv.onkeydown=i=>{i.stopPropagation()},this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.onwheel=i=>{i.stopPropagation()},this.inputDiv.onpaste=i=>{i.preventDefault();let a="";i.clipboardData&&i.clipboardData.getData&&(a=i.clipboardData.getData("text/plain")),document.execCommand("insertHTML",!1,a)}}clearDropdownList(){if(this.dropdown.hasChildNodes())for(let t=0;t{a.style.background=s.dropdownHoverBackground||this.store.styles.activeBg||"#eee",a.style.color=s.dropdownHoverColor||"#bdc7db"},a.onmouseleave=()=>{a.style.background=s.dropdownBackground||this.store.styles.popContentBg||"#fff",a.style.color=s.dropdownColor||"#bdc7db"},this.dropdown.appendChild(a)}find(t){return this.store.data.pens.filter(i=>i.id==t||i.tags&&i.tags.indexOf(t)>-1)}findOne(t){return this.store.data.pens.find(i=>i.id==t||i.tags&&i.tags.indexOf(t)>-1)}changePenId(t,i){var s,n,r,l,o,u,c;if(t===i)return;const a=this.store.pens[t];if(!!a&&!this.store.pens[i]){if(a.id=i,this.store.pens[i]=this.store.pens[t],(s=a.onChangeId)==null||s.call(a,a,t,i),delete this.store.pens[t],a.parentId){const f=this.store.pens[a.parentId],g=(n=f.children)==null?void 0:n.findIndex(v=>v===t);g!==-1&&((r=f.children)==null||r.splice(g,1,i))}(l=a.children)==null||l.forEach(f=>{const g=this.store.pens[f];g.parentId=i}),a.formId&&a.followers.forEach(f=>{const g=this.store.pens[f];g.formId=i}),a.type===$t.Line?this.changeNodeConnectedLine(t,a,this.store.data.pens):(this.changeLineAnchors(t,a,this.store.data.pens),(o=a.connectedLines)==null||o.forEach(({lineId:f})=>{const g=this.store.pens[f];As(g)})),(u=a.anchors)==null||u.forEach(f=>f.penId=i),(c=a.calculative.worldAnchors)==null||c.forEach(f=>f.penId=i)}}updateValue(t,i){var m,w,y,_,A,x;const a=this.getPenRect(t),s=t.name;Object.assign(t,i);const n=s!==t.name;i.newId&&this.changePenId(t.id,i.newId);let r=!1,l=!1,o=!1,u=!1,c=!1,f=!1,g,v=!1;for(const C in i)C.indexOf(".")===-1?(C==="rotate"?t.disableRotate?t.rotate=t.calculative.rotate||0:g=t.calculative.rotate||0:C==="canvasLayer"||C==="isBottom"||C==="showChild"?f=!0:C==="image"&&(v=!0),(typeof t[C]!="object"||C==="lineDash")&&(!t.disableRotate||C!=="rotate")&&(t.calculative[C]=i[C]),hx.includes(C)&&(l=!0),["name","borderRadius","lineSmooth","close"].includes(C)&&(r=!0),ux.includes(C)&&(c=!0),fx.includes(C)&&(o=!0),dx.includes(C)&&(u=!0),t.image&&t.name!=="gif"&&Md.includes(C)&&(v=!0)):(delete t[C],Vr(t,C,i[C])),C.split(".")[0]==="anchors"&&As(t);if(this.setCalculativeByScale(t),n&&((m=t.onDestroy)==null||m.call(t,t),gx(t)),c){const C={x:(w=i.x)!=null?w:a.x,y:(y=i.y)!=null?y:a.y,width:(_=i.width)!=null?_:a.width,height:(A=i.height)!=null?A:a.height};this.setPenRect(t,C,!1),this.updateLines(t,!0),this.store.active&&this.store.active.length&&t.id===this.store.active[0].id&&this.calcActiveRect()}else o?this.updatePenRect(t):(l&&Fi(t),u&&mf(this.store.pens,t),r&&Et.path2dDraws[t.name]&&this.store.path2dMap.set(t,Et.path2dDraws[t.name](t)));if(g!==void 0){const C=t.calculative.rotate;t.calculative.rotate=g,this.rotatePen(t,C-g,t.calculative.worldRect)}(i.image||i.backgroundImage||i.strokeImage)&&(t.calculative.image=void 0,t.calculative.backgroundImage=void 0,t.calculative.strokeImage=void 0,this.loadImage(t)),i.lineGradientColors&&(t.calculative.lineGradient=void 0,t.calculative.gradientColorStop=void 0),i.gradientColors&&(t.calculative.gradient=void 0,t.calculative.radialGradient=void 0),i.gradientRadius&&(t.calculative.gradient=void 0,t.calculative.radialGradient=void 0),i.animateLineWidth&&(t.calculative.gradientAnimatePath=void 0),i.gradientSmooth&&(t.calculative.gradientAnimatePath=void 0),f?(this.canvasImage.init(),this.canvasImageBottom.init()):v&&(t.canvasLayer===void 0&&(t.canvasLayer=zt.CanvasImageBottom,t.calculative.canvasLayer=zt.CanvasImageBottom),t.canvasLayer===zt.CanvasImageBottom?this.canvasImageBottom.init():t.canvasLayer===zt.CanvasImage&&this.canvasImage.init()),(i.canvasLayer!==void 0||t.canvasLayer===zt.CanvasTemplate)&&this.initTemplateCanvas([t]),i.zIndex!==void 0&&(x=t.calculative.singleton)!=null&&x.div&&Fe(t,t.calculative.singleton.div)}execPenResize(t){var i,a;(i=t.onResize)==null||i.call(t,t),(a=t.children)==null||a.forEach(s=>{const n=this.store.pens[s];n&&this.execPenResize(n)})}setPenRect(t,i,a=!0){if(t.parentId)Object.assign(t,i);else{const{origin:s,scale:n}=this.store.data;t.x=s.x+i.x*n,t.y=s.y+i.y*n,t.width=i.width*n,t.height=i.height*n}this.updatePenRect(t),this.execPenResize(t),a&&this.render()}getPenRect(t,i=this.store.data.origin,a=this.store.data.scale){if(!!t)return t.parentId?{x:t.x,y:t.y,width:t.width,height:t.height}:{x:(t.x-i.x)/a,y:(t.y-i.y)/a,width:t.width/a,height:t.height/a}}toPng(t=2,i,a=!1,s){const n=hi(this.store.data.pens),r=this.store.data.scale;if(!isFinite(n.width))throw new Error("can not to png, because width is not finite");const l=ht(n),o=this.store.data,u=a&&this.store.bkImg;let c=!1,f=!1;if(u){if(n.x+=o.x,n.y+=o.y,re(n),Xi(n,this.canvasRect,!0))Object.assign(n,this.canvasRect);else{const T=En([...Zi(n),...Zi(this.canvasRect)]);Object.assign(n,T)}c=n.x===0,f=n.y===0}const g=this.store.data.width||this.store.options.width,v=this.store.data.height||this.store.options.height;let m=!1;g&&v&&!this.store.data.component&&(m=!0),m&&(n.x=this.store.data.origin.x,n.y=this.store.data.origin.y,n.width=g*this.store.data.scale,n.height=v*this.store.data.scale);const w=ht(n),y=qi(t);n.x-=y[3]*r,n.y-=y[0]*r,n.width+=(y[3]+y[1])*r,n.height+=(y[0]+y[2])*r;const _=(s||1920)/n.width;n.width*=_,n.height*=_,re(n);const A=document.createElement("canvas");if(A.width=n.width,A.height=n.height,A.width>32767||A.height>32767||!navigator.userAgent.includes("Firefox")&&A.height*A.width>268435456||navigator.userAgent.includes("Firefox")&&A.height*A.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");const x=A.getContext("2d");x.textBaseline="middle",x.scale(_,_);const C=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;if(C&&m&&(x.save(),x.fillStyle=C,x.fillRect(0,0,w.width+(y[1]+y[3])*r,w.height+(y[0]+y[2])*r),x.restore()),u)if(m)x.drawImage(this.store.bkImg,y[3]*r||0,y[0]*r||0,w.width,w.height);else{const T=n.x<0?-n.x:0,I=n.y<0?-n.y:0;x.drawImage(this.store.bkImg,T,I,this.canvasRect.width,this.canvasRect.height)}if(C&&!m)if(u){const T=n.x<0?-n.x:0,I=n.y<0?-n.y:0;x.save(),x.fillStyle=C,x.fillRect(T,I,this.canvasRect.width,this.canvasRect.height),x.restore()}else x.save(),x.fillStyle=C,x.fillRect(0,0,l.width+(y[3]+y[1])*r,l.height+(y[0]+y[2])*r),x.restore();u?m?x.translate(-n.x,-n.y):x.translate((c?o.x:-l.x)+y[3]*r||0,(f?o.y:-l.y)+y[0]*r||0):x.translate(-n.x,-n.y);for(const T of this.store.data.pens){if(!jr(T,this.store)||T.visible==!1)continue;const{active:I}=T.calculative;T.calculative.active=!1,T.calculative.img?$r(x,T):Sa(x,T,!0),T.calculative.active=I}if(i){A.toBlob(i);return}return A.toDataURL()}activeToPng(t=2,i){return this.pensToPng(this.store.active,t,i)}pensToPng(t=this.store.active,i=2,a){if(t.length===0)return;const s=this.getAllByPens(t);let n=s.map(v=>v.id);const r=hi(s);if(!isFinite(r.width))throw new Error("can not to png, because width is not finite");const l=ht(r),o=qi(i);r.x-=o[3],r.y-=o[0],r.width+=o[3]+o[1],r.height+=o[0]+o[2],re(r);const u=(a||r.width)/r.width;r.width*=u,r.height*=u;const c=document.createElement("canvas");if(c.width=r.width,c.height=r.height,c.width>32767||c.height>32767||!navigator.userAgent.includes("Firefox")&&c.height*c.width>268435456||navigator.userAgent.includes("Firefox")&&c.height*c.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");const f=c.getContext("2d");f.textBaseline="middle",f.scale(u,u);const g=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;g&&(f.save(),f.fillStyle=g,f.fillRect(0,0,l.width+(o[3]+o[1]),l.height+(o[0]+o[2])),f.restore()),f.translate(-l.x+o[3],-l.y+o[0]);for(const v of this.store.data.pens)if(n.includes(v.id)){if(!jr(v,this.store)||v.visible==!1)continue;const{active:m}=v.calculative;v.calculative.active=!1,v.calculative.img?$r(f,v):Sa(f,v),v.calculative.active=m}return c.toDataURL()}toggleAnchorMode(){var t;if(this.hotkeyType)this.hotkeyType===Yt.AddAnchor&&(this.hotkeyType=Yt.None,this.store.hoverAnchor?this.externalElements.style.cursor="vertical-text":this.store.hover&&(this.externalElements.style.cursor="move"));else{if(this.store.options.disableAnchor||((t=this.store.hover)==null?void 0:t.disableAnchor))return;this.hotkeyType=Yt.AddAnchor,this.store.hover&&(this.externalElements.style.cursor="pointer")}this.patchFlags=!0}addAnchorHand(){if(this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){const t=[ht(this.store.active[0],!0)];this.store.activeAnchor.prev?this.store.activeAnchor.next||(this.store.activeAnchor.next={...this.store.activeAnchor.prev},Gt(this.store.activeAnchor.next,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0):(this.store.activeAnchor.next||(this.store.activeAnchor.next={penId:this.store.activeAnchor.penId,x:this.store.activeAnchor.x+50,y:this.store.activeAnchor.y}),this.store.activeAnchor.prev={...this.store.activeAnchor.next},Gt(this.store.activeAnchor.prev,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:bt.Update,pens:[ht(this.store.active[0],!0)],initPens:t})}}removeAnchorHand(){if(this.store.activeAnchor&&this.store.active&&this.store.active.length===1&&this.store.active[0].type){const t=[ht(this.store.active[0],!0)];this.hoverType===xt.LineAnchorPrev?(this.store.activeAnchor.prev=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0):this.hoverType===xt.LineAnchorNext?(this.store.activeAnchor.next=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0):(this.store.activeAnchor.prev=void 0,this.store.activeAnchor.next=void 0,this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:bt.Update,pens:[ht(this.store.active[0])],initPens:t})}}toggleAnchorHand(){this.store.active.length===1&&this.store.active[0].type&&this.store.activeAnchor&&(this.store.activeAnchor.prevNextType||(this.store.activeAnchor.prevNextType=Na.Mirror),this.store.activeAnchor.prevNextType=(this.store.activeAnchor.prevNextType+1)%3)}gotoView(t,i){let a=hi(this.store.data.pens);if(!isFinite(a.width))throw new Error("can not move view, because width is not finite");const s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;s&&n&&(a={x:this.store.data.origin.x,y:this.store.data.origin.y,width:s*this.store.data.scale,height:n*this.store.data.scale}),this.store.data.x=this.canvas.clientWidth/2-t*a.width-a.x,this.store.data.y=this.canvas.clientHeight/2-i*a.height-a.y,this.onMovePens(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render()}showMagnifier(){this.magnifierCanvas.canvas.style.zIndex="100",this.externalElements.style.zIndex="101",this.magnifierCanvas.magnifier=!0,this.magnifierCanvas.updateDomOffscreen(),this.externalElements.style.cursor="default",this.render()}hideMagnifier(){this.magnifierCanvas.canvas.style.zIndex="5",this.externalElements.style.zIndex="5",this.magnifierCanvas.magnifier=!1,this.externalElements.style.cursor="default",this.magnifierCanvas.render(),this.render()}showFit(){this.store.data.locked=0,this.canvasImage.fitFlag=!0,this.canvasImage.activeFit=void 0,this.canvasImage.currentFit=void 0,this.store.data.fits||(this.store.data.fits=[]),this.store.data.fits.forEach(t=>t.active=!1),this.canvasImage.init(),this.canvasImage.render()}hideFit(){this.canvasImage.fitFlag=!1,this.canvasImage.activeFit=void 0,this.canvasImage.currentFit=void 0,this.canvasImage.init(),this.canvasImage.render()}makeFit(){if(this.dragRect.width<100&&this.dragRect.height<100)return;const t=this.store.data.pens.filter(u=>{if(u.parentId||u.isRuleLine)return!1;if(Xi(u.calculative.worldRect,this.dragRect,!0))return u.type===$t.Line&&!this.store.options.dragAllIn?Il(u,this.dragRect):!0});if(!t.length)return;const i=this.parent.getRect(t),a=this.store.data.scale,s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;let r=(Math.floor(i.x)-this.store.data.origin.x)/a/s,l=(Math.floor(i.y)-this.store.data.origin.y)/a/n,o={x:r,y:l,width:(Math.ceil(i.width)+1)/a/s,height:(Math.ceil(i.height)+1)/a/n,children:t.map(u=>u.id),id:St(),active:!0};o.x<-.1&&(o.x=-.1),o.y<-.1&&(o.y=-.1),o.width>.5?(o.left=!0,o.right=!0,o.leftValue=(o.x-0)*a*s,o.rightValue=(1-(o.x+o.width))*a*s):o.x<.5?(o.left=!0,o.leftValue=(o.x-0)*a*s):(o.right=!0,o.rightValue=(1-(o.x+o.width))*a*s),o.leftValue<1&&(o.leftValue=0),o.rightValue<1&&(o.rightValue=0),o.height>.5?(o.top=!0,o.bottom=!0,o.topValue=(o.y-0)*a*n,o.bottomValue=(1-(o.y+o.height))*a*n):o.y<.5?(o.top=!0,o.topValue=(o.y-0)*a*n):(o.bottom=!0,o.bottomValue=(1-(o.y+o.height))*a*n),o.topValue<1&&(o.topValue=0),o.bottomValue<1&&(o.bottomValue=0),this.store.data.fits||(this.store.data.fits=[]),this.store.data.fits.forEach(u=>{u.active=!1}),this.store.data.fits.push(o),this.canvasImage.activeFit=o,this.store.emitter.emit("fit",o),this.canvasImage.init(),this.canvasImage.render()}updateFit(t){const i=this.store.data.scale,a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height;let n=(t.x-this.store.data.origin.x)/i/a,r=(t.y-this.store.data.origin.y)/i/s;if(this.canvasImage.currentFit){const l=this.canvasImage.activeFit;if(this.canvasImage.currentFit==="top"){r<-.1&&(r=-.1);let c=r-l.y;if(l.height-=c,l.height<.01){l.height=.01;return}l.y=r}if(this.canvasImage.currentFit==="bottom"&&(r>1.1&&(r=1.1),l.height=r-l.y,l.height<=.01&&(l.height=.01)),this.canvasImage.currentFit==="left"){n<-.1&&(n=-.1);let c=n-l.x;if(l.width-=c,l.width<.01){l.width=.01;return}l.x=n}this.canvasImage.currentFit==="right"&&(n>1.1&&(n=1.1),l.width=n-l.x,l.width<=.01&&(l.width=.01));let o={x:l.x*a*i+this.store.data.origin.x,y:l.y*s*i+this.store.data.origin.y,width:l.width*a*i,height:l.height*s*i};re(o);const u=this.store.data.pens.filter(c=>{if(c.parentId||c.isRuleLine)return!1;if(Xi(c.calculative.worldRect,o,!0))return c.type===$t.Line&&!this.store.options.dragAllIn?Il(c,o):!0});l.left=void 0,l.leftValue=void 0,l.right=void 0,l.rightValue=void 0,l.top=void 0,l.topValue=void 0,l.bottom=void 0,l.bottomValue=void 0,l.width>.5?(l.left=!0,l.right=!0,l.leftValue=(l.x-0)*i*a,l.rightValue=(1-(l.x+l.width))*i*a):l.x<.5?(l.left=!0,l.leftValue=(l.x-0)*i*a):(l.right=!0,l.rightValue=(1-(l.x+l.width))*i*a),Math.abs(l.leftValue)<1&&(l.leftValue=0),Math.abs(l.rightValue)<1&&(l.rightValue=0),l.height>.5?(l.top=!0,l.bottom=!0,l.topValue=(l.y-0)*i*s,l.bottomValue=(1-(l.y+l.height))*i*s):l.y<.5?(l.top=!0,l.topValue=(l.y-0)*i*s):(l.bottom=!0,l.bottomValue=(1-(l.y+l.height))*i*s),Math.abs(l.topValue)<1&&(l.topValue=0),Math.abs(l.bottomValue)<1&&(l.bottomValue=0),l.children=u.map(c=>c.id),this.store.emitter.emit("fit",l),this.mouseDown.x=t.x,this.mouseDown.y=t.y,this.canvasImage.init(),this.canvasImage.render()}}updateFitRect(t=this.canvasImage.activeFit){const i=this.store.data.width||this.store.options.width,a=this.store.data.height||this.store.options.height;t.left&&(t.leftValue?t.x=Math.abs(t.leftValue)<1?t.leftValue:t.leftValue/i:t.x=0),t.right&&(t.rightValue?t.width=1-(Math.abs(t.rightValue)<1?t.rightValue:t.rightValue/i)-t.x:t.width=1-t.x),t.top&&(t.topValue?t.y=Math.abs(t.topValue)<1?t.topValue:t.topValue/a:t.y=0),t.bottom&&(t.bottomValue?t.height=1-(Math.abs(t.bottomValue)<1?t.bottomValue:t.bottomValue/a)-t.y:t.height=1-t.y),this.canvasImage.init(),this.canvasImage.render()}deleteFit(t=this.canvasImage.activeFit){if(!t)return;const i=this.store.data.fits.findIndex(a=>a.id===t.id);this.store.data.fits.splice(i,1),this.canvasImage.activeFit=void 0,this.canvasImage.init(),this.canvasImage.render(),this.store.emitter.emit("fit",void 0)}calcuActiveFit(){var l;const t=this.store.data.width||this.store.options.width,i=this.store.data.height||this.store.options.height;let a=(this.mouseDown.x-this.store.data.origin.x)/this.store.data.scale/t,s=(this.mouseDown.y-this.store.data.origin.y)/this.store.data.scale/i,n=-1,r=-1;(l=this.store.data.fits)==null||l.forEach((o,u)=>{o.ex=null,o.ey=null,Ui({x:a,y:s},o)&&(n=u),o.active&&(r=u)}),n!==-1&&n!==r?(this.canvasImage.activeFit=this.store.data.fits[n],this.store.data.fits[n].active=!0,r!==-1&&(this.store.data.fits[r].active=!1),this.store.emitter.emit("fit",this.store.data.fits[n])):n===-1&&r!==-1&&(this.store.data.fits[r].active=!1,this.store.emitter.emit("fit",void 0),this.canvasImage.activeFit=null),this.inactive(),this.canvasImage.init(),this.canvasImage.render()}toggleMagnifier(){this.magnifierCanvas.magnifier=!this.magnifierCanvas.magnifier,this.magnifierCanvas.magnifier&&(this.externalElements.style.cursor="default"),this.render()}destroy(){var t,i,a,s;switch(this.scroll&&this.scroll.destroy(),(t=this.tooltip)==null||t.destroy(),(i=this.dialog)==null||i.destroy(),(a=this.title)==null||a.destroy(),(s=this.popconfirm)==null||s.destroy(),this.externalElements.removeEventListener("gesturestart",this.onGesturestart),this.externalElements.ondragover=n=>n.preventDefault(),this.externalElements.ondrop=void 0,this.externalElements.ontouchstart=void 0,this.externalElements.ontouchmove=void 0,this.externalElements.ontouchend=void 0,this.externalElements.onmousedown=void 0,this.externalElements.onmousemove=void 0,this.externalElements.onmouseup=void 0,this.externalElements.onmouseleave=void 0,this.externalElements.ondblclick=void 0,this.store.options.keydown){case Ba.Document:document.removeEventListener("keydown",this.onkeydown),document.removeEventListener("keyup",this.onkeyup);break;case Ba.Canvas:this.externalElements.removeEventListener("keydown",this.onkeydown),this.externalElements.removeEventListener("keyup",this.onkeyup);break}document.removeEventListener("copy",this.onCopy),document.removeEventListener("cut",this.onCut),document.removeEventListener("paste",this.onPaste),window&&window.removeEventListener("message",this.onMessage),window&&window.removeEventListener("resize",this.onResize),window&&window.removeEventListener("scroll",this.onScroll),this.parentElement.innerHTML=""}}function eE(e,t){const i=t||new Path2D;e.onDestroy||(e.onDestroy=aE,e.onMove=Hf,e.onRotate=Hf,e.onMouseEnter=sE,e.onMouseLeave=nE,e.onMouseMove=oE,e.onMouseUp=rE,e.onInput=iE),e.formId=e.id;let a=e.calculative.borderRadius||0,s=a;const{x:n,y:r,width:l,height:o,ex:u,ey:c}=e.calculative.worldRect;e.calculative.worldTextRect,a<1&&(a=l*a,s=o*s);let f=a{if(e.followers){let a=e.followers.findIndex(s=>s===i.id);if(a!==-1){const s=e.calculative.canvas.store.pens[i.id+He];s&&s.calculative&&(Xi(s.calculative.worldRect,e.calculative.worldRect,!0)||(e.followers.splice(a,1),delete i.formId))}}})}function rE(e){const t=e.calculative.canvas.store.active;t&&t.length&&t.forEach(i=>{const a=e.calculative.canvas.store.pens[i.id+He];if(a&&a.calculative){let s=ht(e.calculative.worldRect);s.x-=1,s.y-=1,s.width+=2,s.height+=2,Xi(a.calculative.worldRect,s,!0)&&(e.followers||(e.followers=[]),e.followers.includes(i.id)||e.followers.push(i.id),i.formId=e.id)}})}function oE(e,t){}function Wf(e,t){if(e.formId&&e.formKey&&e.formValue){const i=e.calculative.canvas.store.pens[e.formId];i&&(i.formData||(i.formData={}),i.formData[e.formKey]=e[e.formValue])}}function lE(e){const t=e.calculative.canvas.store.pens[e.formId];t.followers.forEach(i=>{const a=e.calculative.canvas.store.pens[i];if(a.formId&&a.formKey&&t.formData[a.formKey]){const s=a[a.formValue];let n="";Array.isArray(s)&&(n=[]),e.calculative.canvas.parent.setValue({id:a.id,[a.formValue]:n},{render:!1,doEvent:!1,history:!1})}}),t.formData={},e.calculative.canvas.parent.render()}const ge={};function cE(e){e.onDestroy||(e.onDestroy=hE,e.onMove=Uf,e.onResize=uE,e.onRotate=Uf,e.onValue=fE,e.onChangeId=dE);const t=new Path2D;if(!e.image)return;const a=e.calculative.canvas.store.id+"-"+e.id;if(!ge[a]){const s=new Image;s.crossOrigin="anonymous",s.src=e.image,e.calculative.canvas.parent.store.options.cdn&&!(e.image.startsWith("http")||e.image.startsWith("//")||e.image.startsWith("data:image"))&&(s.src=e.calculative.canvas.parent.store.options.cdn+e.image),ge[a]=s,s.onload=()=>{var n;ge[a]===s&&(e.calculative.img=s,e.calculative.imgNaturalWidth=s.naturalWidth||e.iconWidth,e.calculative.imgNaturalHeight=s.naturalHeight||e.iconHeight,(n=e.calculative.canvas.externalElements)==null||n.parentElement.appendChild(s),mn(e,s))}}return e.calculative.patchFlags&&ge[a]&&mn(e,ge[a]),t}function hE(e){const i=e.calculative.canvas.store.id+"-"+e.id;ge[i]&&(ge[i].remove(),ge[i]=void 0)}function Uf(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ge[i]||mn(e,ge[i])}function uE(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ge[i]||mn(e,ge[i])}function fE(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ge[i]||(mn(e,ge[i]),ge[i].getAttribute("src")!==e.image&&(ge[i].src=e.image))}function dE(e,t,i){const a=e.calculative.canvas.store.id;!ge[a+"-"+t]||(ge[a+"-"+i]=ge[a+"-"+t],delete ge[a+"-"+t])}function mn(e,t){t.style.objectFit=e.imageRatio?"contain":"fill",Fe(e,t)}function gE(e,t){return e.onResize||(e.onResize=xg,e.onValue=vE),Oa(e,t)}function xg(e){const t=e.anchors.filter(i=>i.flag!==1);_g(e),e.anchors=e.anchors.concat(...t)}function vE(e){xg(e),As(e)}function _g(e){const t=[],{x:i,y:a,width:s,height:n}=e,r=mE(e),l=5;for(let f=0;fi+s-r&&(v=Ar(i+s-r,v+r,g,r,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(g-i)/s,y:(v-a)/n})}const o=3;for(let f=0;fa+n-r&&(v=Er(v-r,a+n-r,g,r)),t.push({id:String(t.length),flag:1,penId:e.id,x:(v-i)/s,y:(g-a)/n})}const u=5;for(let f=0;fi+s-r&&(v=Ar(i+s-r,v-r,g,r)),t.push({id:String(t.length),flag:1,penId:e.id,x:(g-i)/s,y:(v-a)/n})}const c=3;for(let f=0;fa+n-r&&(v=Er(v+r,a+n-r,g,r,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(v-i)/s,y:(g-a)/n})}e.anchors=t}function mE(e){let t=e.calculative.borderRadius||0,i=e.calculative.borderRadius||0;const{width:a,height:s}=e;e.calculative.borderRadius<1&&(t=a*e.calculative.borderRadius,i=s*e.calculative.borderRadius);let n=t({id:s+"",x:i,y:a,penId:e.id}))}function wE(){return{rectangle:Oa,square:lx,circle:cx,svgPath:s_,diamond:n_,triangle:r_,pentagon:l_,pentagram:h_,hexagon:f_,leftArrow:d_,rightArrow:g_,twowayArrow:v_,message:m_,cloud:y_,file:p_,people:b_,line:A_,iframe:W_,video:q_,gif:cE,mindNode:gE,mindLine:yE,mindNode2:Oa,form:eE,combine:Oa}}function bE(){return{triangle:o_,pentagon:c_,pentagram:hg,mindNode:_g,mindLine:pE}}var he;(function(e){e[e.Link=0]="Link",e[e.SetProps=1]="SetProps",e[e.StartAnimate=2]="StartAnimate",e[e.PauseAnimate=3]="PauseAnimate",e[e.StopAnimate=4]="StopAnimate",e[e.JS=5]="JS",e[e.GlobalFn=6]="GlobalFn",e[e.Emit=7]="Emit",e[e.StartVideo=8]="StartVideo",e[e.PauseVideo=9]="PauseVideo",e[e.StopVideo=10]="StopVideo",e[e.SendPropData=11]="SendPropData",e[e.SendVarData=12]="SendVarData",e[e.Navigator=13]="Navigator",e[e.Dialog=14]="Dialog",e[e.SendData=15]="SendData",e[e.PostMessage=16]="PostMessage",e[e.PostMessageToParent=17]="PostMessageToParent",e[e.Message=18]="Message"})(he||(he={}));class xE{constructor(t){W(this,"parent");W(this,"box");W(this,"boxWidth",320);W(this,"boxHeight",180);W(this,"ratio",this.boxWidth/this.boxHeight);W(this,"padding",5);W(this,"img");W(this,"isShow");W(this,"isDown");W(this,"view");W(this,"timer");W(this,"onMouseDown",t=>{t.preventDefault(),t.stopPropagation(),this.isDown=!0});W(this,"onMouseMove",t=>{if(t.preventDefault(),t.stopPropagation(),this.isDown)try{this.parent.gotoView(t.offsetX/this.box.clientWidth,t.offsetY/this.box.clientHeight)}catch(i){console.warn(i.message),this.isDown=!1}});W(this,"onMouseUp",t=>{t.preventDefault(),t.stopPropagation();try{this.parent.gotoView(t.offsetX/this.box.clientWidth,t.offsetY/this.box.clientHeight)}catch(i){console.warn(i.message)}finally{this.isDown=!1}});W(this,"onWheel",t=>{let i=.015;if(this.parent.store.options.scaleOff)i=this.parent.store.options.scaleOff,t.deltaY>0&&(i=-this.parent.store.options.scaleOff);else if(/mac os /i.test(navigator.userAgent))t.ctrlKey?t.deltaY>0&&(i*=-1):i*=t.wheelDeltaY/240;else{let o=.2;t.deltaY.toString().indexOf(".")!==-1&&(o=.01),t.deltaY>0?i=-o:i=o}let{offsetX:a,offsetY:s}=t;const n=this.parent.store.data.width||this.parent.store.options.width,r=this.parent.store.data.height||this.parent.store.options.height;if(n&&r)a=a/this.boxWidth*n*this.parent.store.data.scale+this.parent.store.data.origin.x+this.parent.store.data.x,s=s/this.boxHeight*r*this.parent.store.data.scale+this.parent.store.data.origin.y+this.parent.store.data.y;else{const l=this.parent.parent.getRect();a=a/this.boxWidth*l.width+l.x+this.parent.store.data.x,s=s/this.boxHeight*l.height+l.y+this.parent.store.data.y}this.parent.scale(this.parent.store.data.scale+i,{x:a,y:s})});var a;this.parent=t,this.box=document.createElement("div"),this.img=new Image,this.view=document.createElement("div"),this.box.appendChild(this.img),this.box.appendChild(this.view),(a=this.parent.externalElements)==null||a.parentElement.appendChild(this.box),this.box.className="meta2d-map",this.box.onmousedown=this.onMouseDown,this.box.onmousemove=this.onMouseMove,this.box.onmouseup=this.onMouseUp,this.box.onwheel=this.onWheel;let i;for(let s=0;s{this.parent.store.bkImg&&(this.img.src=this.parent.toPng(0,void 0,!0))},300)),Da(i,t.x,t.y),i.width/i.height>this.ratio){const f=i.width/this.ratio;i.y-=(f-i.height)/2,i.height=f,re(i)}else{const f=i.height*this.ratio;i.x-=(f-i.width)/2,i.width=f,re(i)}const r=this.parent.canvasRect;let l=0,o=0;if(i.x<0)l=-i.x/i.width;else if(i.x+i.width>r.width){let f=0;r.width>i.width&&(f=r.width-i.width),l=(-i.x+f)/i.width}if(i.y<0)o=-i.y/i.height;else if(i.y+i.height>r.height){let f=0;r.height>i.height&&(f=r.height-i.height),o=(-i.y+f)/i.height}const u=r.width>i.width?1:r.width/i.width,c=r.height>i.height?1:r.height/i.height;this.view.style.left=this.padding+l*this.boxWidth+"px",this.view.style.width=u*this.boxWidth+"px",this.view.style.top=this.padding+o*this.boxHeight+"px",this.view.style.height=c*this.boxHeight+"px"}}}function kr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var en={exports:{}};(function(e,t){(function(i){e.exports=i()})(function(){return function(){return function i(a,s,n){function r(u,c){if(!s[u]){if(!a[u]){var f=typeof kr=="function"&&kr;if(!c&&f)return f(u,!0);if(l)return l(u,!0);var g=new Error("Cannot find module '"+u+"'");throw g.code="MODULE_NOT_FOUND",g}var v=s[u]={exports:{}};a[u][0].call(v.exports,function(m){return r(a[u][1][m]||m)},v,v.exports,i,a,s,n)}return s[u].exports}for(var l=typeof kr=="function"&&kr,o=0;o0&&(M.topicAliasMaximum>65535?x("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new u(M.topicAliasMaximum)),this.on("connect",function(){const nt=this.queue;x("connect :: sending queued packets"),function j(){const H=nt.shift();x("deliver :: entry %o",H);let $=null;if(!H)return void Z._resubscribe();$=H.packet,x("deliver :: call _sendPacket for %o",$);let K=!0;$.messageId&&$.messageId!==0&&(Z.messageIdProvider.register($.messageId)||(K=!1)),K?Z._sendPacket($,function(U){H.cb&&H.cb(U),j()}):(x("messageId: %d has already used. The message is skipped and removed.",$.messageId),j())}()}),this.on("close",function(){x("close :: connected set to `false`"),this.connected=!1,x("close :: clearing connackTimer"),clearTimeout(this.connackTimer),x("close :: clearing ping timer"),Z.pingTimer!==null&&(Z.pingTimer.clear(),Z.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),x("close :: calling _setupReconnect"),this._setupReconnect()}),l.call(this),x("MqttClient :: setting up stream"),this._setupStream()}m(R,l),R.prototype._setupStream=function(){const P=this,M=new v,Y=f.parser(this.options);let Z=null;const nt=[];function j(){if(nt.length)C(H);else{const K=Z;Z=null,K()}}function H(){x("work :: getting next packet in queue");const K=nt.shift();if(K)x("work :: packet pulled from queue"),P._handlePacket(K,j);else{x("work :: no packets in queue");const U=Z;Z=null,x("work :: done flag is %s",!!U),U&&U()}}x("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),x("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),Y.on("packet",function(K){x("parser :: on packet push to packets array."),nt.push(K)}),M._write=function(K,U,tt){Z=tt,x("writable stream :: parsing buffer"),Y.parse(K),H()},x("_setupStream :: pipe stream to writable stream"),this.stream.pipe(M),this.stream.on("error",function(K){x("streamErrorHandler :: error",K.message),K.code?(x("streamErrorHandler :: emitting error"),P.emit("error",K)):F(K)}),this.stream.on("close",function(){var K;x("(%s)stream :: on close",P.options.clientId),(K=P.outgoing)&&(x("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(K).forEach(function(U){K[U].volatile&&typeof K[U].cb=="function"&&(K[U].cb(new Error("Connection closed")),delete K[U])})),x("stream: emit close to MqttClient"),P.emit("close")}),x("_setupStream: sending packet `connect`");const $=Object.create(this.options);if($.cmd="connect",this.topicAliasRecv&&($.properties||($.properties={}),this.topicAliasRecv&&($.properties.topicAliasMaximum=this.topicAliasRecv.max)),V(this,$),Y.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return P.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"&&V(this,A({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){x("!!connectTimeout hit!! Calling _cleanUp with force `true`"),P._cleanUp(!0)},this.options.connectTimeout)},R.prototype._handlePacket=function(P,M){const Y=this.options;if(Y.protocolVersion===5&&Y.properties&&Y.properties.maximumPacketSize&&Y.properties.maximumPacketSize0||!H())&&this._storeProcessingQueue.push({invoke:H,cbStorePut:Y.cbStorePut,callback:Z}),this},R.prototype.subscribe=function(){const P=this,M=new Array(arguments.length);for(let at=0;at0){const ot={qos:ct.qos};$===5&&(ot.nl=ct.nl||!1,ot.rap=ct.rap||!1,ot.rh=ct.rh||0,ot.properties=ct.properties),P._resubscribeTopics[ct.topic]=ot,ut.push(ct.topic)}}),P.messageIdToTopic[et.messageId]=ut}return P.outgoing[et.messageId]={volatile:!0,cb:function(ut,ct){if(!ut){const ot=ct.granted;for(let b=0;b0||!tt())&&this._storeProcessingQueue.push({invoke:tt,callback:j}),this},R.prototype.unsubscribe=function(){const P=this,M=new Array(arguments.length);for(let $=0;$0||!H())&&this._storeProcessingQueue.push({invoke:H,callback:Z}),this},R.prototype.end=function(P,M,Y){const Z=this;function nt(){x("end :: (%s) :: finish :: calling _cleanUp with force %s",Z.options.clientId,P),Z._cleanUp(P,()=>{x("end :: finish :: calling process.nextTick on closeStores"),C(function(){x("end :: closeStores: closing incoming and outgoing stores"),Z.disconnected=!0,Z.incomingStore.close(function(j){Z.outgoingStore.close(function(H){if(x("end :: closeStores: emitting end"),Z.emit("end"),Y){const $=j||H;x("end :: closeStores: invoking callback with args"),Y($)}})}),Z._deferredReconnect&&Z._deferredReconnect()}.bind(Z))},M)}return x("end :: (%s)",this.options.clientId),P!=null&&typeof P=="boolean"||(Y=M||F,M=P,P=!1,typeof M!="object"&&(Y=M,M=null,typeof Y!="function"&&(Y=F))),typeof M!="object"&&(Y=M,M=null),x("end :: cb? %s",!!Y),Y=Y||F,this.disconnecting?(Y(),this):(this._clearReconnect(),this.disconnecting=!0,!P&&Object.keys(this.outgoing).length>0?(x("end :: (%s) :: calling finish in 10ms once outgoing is empty",Z.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,nt,10))):(x("end :: (%s) :: immediately calling finish",Z.options.clientId),nt()),this)},R.prototype.removeOutgoingMessage=function(P){const M=this.outgoing[P]?this.outgoing[P].cb:null;return delete this.outgoing[P],this.outgoingStore.del({messageId:P},function(){M(new Error("Message removed"))}),this},R.prototype.reconnect=function(P){x("client reconnect");const M=this,Y=function(){P?(M.options.incomingStore=P.incomingStore,M.options.outgoingStore=P.outgoingStore):(M.options.incomingStore=null,M.options.outgoingStore=null),M.incomingStore=M.options.incomingStore||new o,M.outgoingStore=M.options.outgoingStore||new o,M.disconnecting=!1,M.disconnected=!1,M._deferredReconnect=null,M._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=Y:Y(),this},R.prototype._reconnect=function(){x("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),x("client already connected. disconnecting first.")):(x("_reconnect: calling _setupStream"),this._setupStream())},R.prototype._setupReconnect=function(){const P=this;!P.disconnecting&&!P.reconnectTimer&&P.options.reconnectPeriod>0?(this.reconnecting||(x("_setupReconnect :: emit `offline` state"),this.emit("offline"),x("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),x("_setupReconnect :: setting reconnectTimer for %d ms",P.options.reconnectPeriod),P.reconnectTimer=setInterval(function(){x("reconnectTimer :: reconnect triggered!"),P._reconnect()},P.options.reconnectPeriod)):x("_setupReconnect :: doing nothing...")},R.prototype._clearReconnect=function(){x("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},R.prototype._cleanUp=function(P,M){const Y=arguments[2];if(M&&(x("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",M)),x("_cleanUp :: forced? %s",P),P)this.options.reconnectPeriod===0&&this.options.clean&&(Z=this.outgoing)&&(x("flush: queue exists? %b",!!Z),Object.keys(Z).forEach(function(nt){typeof Z[nt].cb=="function"&&(Z[nt].cb(new Error("Connection closed")),delete Z[nt])})),x("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const nt=A({cmd:"disconnect"},Y);x("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(nt,T.bind(null,this.stream.end.bind(this.stream)))}var Z;this.disconnecting||(x("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(x("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),M&&!this.connected&&(x("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",M),M())},R.prototype._sendPacket=function(P,M,Y){x("_sendPacket :: (%s) :: start",this.options.clientId),Y=Y||F,M=M||F;const Z=function(nt,j){if(nt.options.protocolVersion===5&&j.cmd==="publish"){let H;j.properties&&(H=j.properties.topicAlias);const $=j.topic.toString();if(nt.topicAliasSend)if(H){if($.length!==0&&(x("applyTopicAlias :: register topic: %s - alias: %d",$,H),!nt.topicAliasSend.put($,H)))return x("applyTopicAlias :: error out of range. topic: %s - alias: %d",$,H),new Error("Sending Topic Alias out of range")}else $.length!==0&&(nt.options.autoAssignTopicAlias?(H=nt.topicAliasSend.getAliasByTopic($))?(j.topic="",j.properties={...j.properties,topicAlias:H},x("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",$,H)):(H=nt.topicAliasSend.getLruAlias(),nt.topicAliasSend.put($,H),j.properties={...j.properties,topicAlias:H},x("applyTopicAlias :: auto assign topic: %s - alias: %d",$,H)):nt.options.autoUseTopicAlias&&(H=nt.topicAliasSend.getAliasByTopic($))&&(j.topic="",j.properties={...j.properties,topicAlias:H},x("applyTopicAlias :: auto use topic: %s - alias: %d",$,H)));else if(H)return x("applyTopicAlias :: error out of range. topic: %s - alias: %d",$,H),new Error("Sending Topic Alias out of range")}}(this,P);if(Z)M(Z);else{if(!this.connected)return P.cmd==="auth"?(this._shiftPingInterval(),void V(this,P,M)):(x("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(P,M,Y));switch(this._shiftPingInterval(),P.cmd){case"publish":break;case"pubrel":return void Q(this,P,M,Y);default:return void V(this,P,M)}switch(P.qos){case 2:case 1:Q(this,P,M,Y);break;case 0:default:V(this,P,M)}x("_sendPacket :: (%s) :: end",this.options.clientId)}},R.prototype._storePacket=function(P,M,Y){x("_storePacket :: packet: %o",P),x("_storePacket :: cb? %s",!!M),Y=Y||F;let Z=P;if(Z.cmd==="publish"){const nt=B(this,Z=y(P));if(nt)return M&&M(nt)}(Z.qos||0)===0&&this.queueQoSZero||Z.cmd!=="publish"?this.queue.push({packet:Z,cb:M}):Z.qos>0?(M=this.outgoing[Z.messageId]?this.outgoing[Z.messageId].cb:null,this.outgoingStore.put(Z,function(nt){if(nt)return M&&M(nt);Y()})):M&&M(new Error("No connection to broker"))},R.prototype._setupPingTimer=function(){x("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const P=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=w(function(){P._checkPing()},1e3*this.options.keepalive))},R.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},R.prototype._checkPing=function(){x("_checkPing :: checking ping..."),this.pingResp?(x("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(x("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},R.prototype._handlePingresp=function(){this.pingResp=!0},R.prototype._handleConnack=function(P){x("_handleConnack");const M=this.options,Y=M.protocolVersion===5?P.reasonCode:P.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,P.properties){if(P.properties.topicAliasMaximum){if(P.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));P.properties.topicAliasMaximum>0&&(this.topicAliasSend=new c(P.properties.topicAliasMaximum))}P.properties.serverKeepAlive&&M.keepalive&&(M.keepalive=P.properties.serverKeepAlive,this._shiftPingInterval()),P.properties.maximumPacketSize&&(M.properties||(M.properties={}),M.properties.maximumPacketSize=P.properties.maximumPacketSize)}if(Y===0)this.reconnecting=!1,this._onConnect(P);else if(Y>0){const Z=new Error("Connection refused: "+D[Y]);Z.code=Y,this.emit("error",Z)}},R.prototype._handleAuth=function(P){const M=this.options.protocolVersion,Y=M===5?P.reasonCode:P.returnCode;if(M!==5){const nt=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+M);return nt.code=Y,void this.emit("error",nt)}const Z=this;this.handleAuth(P,function(nt,j){if(nt)Z.emit("error",nt);else if(Y===24)Z.reconnecting=!1,Z._sendPacket(j);else{const H=new Error("Connection refused: "+D[Y]);nt.code=Y,Z.emit("error",H)}})},R.prototype.handleAuth=function(P,M){M()},R.prototype._handlePublish=function(P,M){x("_handlePublish: packet %o",P),M=M!==void 0?M:F;let Y=P.topic.toString();const Z=P.payload,nt=P.qos,j=P.messageId,H=this,$=this.options,K=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let U;if(P.properties&&(U=P.properties.topicAlias),U!==void 0)if(Y.length===0){if(!(U>0&&U<=65535))return x("_handlePublish :: topic alias out of range. alias: %d",U),void this.emit("error",new Error("Received Topic Alias is out of range"));{const tt=this.topicAliasRecv.getTopicByAlias(U);if(!tt)return x("_handlePublish :: unregistered topic alias. alias: %d",U),void this.emit("error",new Error("Received unregistered Topic Alias"));x("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",Y=tt,U)}}else{if(!this.topicAliasRecv.put(Y,U))return x("_handlePublish :: topic alias out of range. alias: %d",U),void this.emit("error",new Error("Received Topic Alias is out of range"));x("_handlePublish :: registered topic: %s - alias: %d",Y,U)}}switch(x("_handlePublish: qos %d",nt),nt){case 2:$.customHandleAcks(Y,Z,P,function(U,tt){return U instanceof Error||(tt=U,U=null),U?H.emit("error",U):K.indexOf(tt)===-1?H.emit("error",new Error("Wrong reason code for pubrec")):void(tt?H._sendPacket({cmd:"pubrec",messageId:j,reasonCode:tt},M):H.incomingStore.put(P,function(){H._sendPacket({cmd:"pubrec",messageId:j},M)}))});break;case 1:$.customHandleAcks(Y,Z,P,function(U,tt){return U instanceof Error||(tt=U,U=null),U?H.emit("error",U):K.indexOf(tt)===-1?H.emit("error",new Error("Wrong reason code for puback")):(tt||H.emit("message",Y,Z,P),void H.handleMessage(P,function(at){if(at)return M&&M(at);H._sendPacket({cmd:"puback",messageId:j,reasonCode:tt},M)}))});break;case 0:this.emit("message",Y,Z,P),this.handleMessage(P,M);break;default:x("_handlePublish: unknown QoS. Doing nothing.")}},R.prototype.handleMessage=function(P,M){M()},R.prototype._handleAck=function(P){const M=P.messageId,Y=P.cmd;let Z=null;const nt=this.outgoing[M]?this.outgoing[M].cb:null,j=this;let H;if(nt){switch(x("_handleAck :: packet type",Y),Y){case"pubcomp":case"puback":{const $=P.reasonCode;$&&$>0&&$!==16&&((H=new Error("Publish error: "+D[$])).code=$,nt(H,P)),delete this.outgoing[M],this.outgoingStore.del(P,nt),this.messageIdProvider.deallocate(M),this._invokeStoreProcessingQueue();break}case"pubrec":{Z={cmd:"pubrel",qos:2,messageId:M};const $=P.reasonCode;$&&$>0&&$!==16?((H=new Error("Publish error: "+D[$])).code=$,nt(H,P)):this._sendPacket(Z);break}case"suback":delete this.outgoing[M],this.messageIdProvider.deallocate(M);for(let $=0;$0)if(this.options.resubscribe)if(this.options.protocolVersion===5){x("_resubscribe: protocolVersion 5");for(let M=0;M0){const P=this._storeProcessingQueue[0];if(P&&P.invoke())return this._storeProcessingQueue.shift(),!0}return!1},R.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},R.prototype._flushStoreProcessingQueue=function(){for(const P of this._storeProcessingQueue)P.cbStorePut&&P.cbStorePut(new Error("Connection closed")),P.callback&&P.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},a.exports=R}).call(this)}).call(this,i("_process"),typeof Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(i,a,s){const{Buffer:n}=i("buffer"),r=i("readable-stream").Transform,l=i("duplexify");let o,u,c,f=!1;a.exports=function(g,v){if(v.hostname=v.hostname||v.host,!v.hostname)throw new Error("Could not determine host. Specify host manually.");const m=v.protocolId==="MQIsdp"&&v.protocolVersion===3?"mqttv3.1":"mqtt";(function(y){y.hostname||(y.hostname="localhost"),y.path||(y.path="/"),y.wsOptions||(y.wsOptions={})})(v);const w=function(y,_){const A=y.protocol==="alis"?"wss":"ws";let x=A+"://"+y.hostname+y.path;return y.port&&y.port!==80&&y.port!==443&&(x=A+"://"+y.hostname+":"+y.port+y.path),typeof y.transformWsUrl=="function"&&(x=y.transformWsUrl(x,y,_)),x}(v,g);return(o=v.my).connectSocket({url:w,protocols:m}),u=function(){const y=new r;return y._write=function(_,A,x){o.sendSocketMessage({data:_.buffer,success:function(){x()},fail:function(){x(new Error)}})},y._flush=function(_){o.closeSocket({success:function(){_()}})},y}(),c=l.obj(),f||(f=!0,o.onSocketOpen(function(){c.setReadable(u),c.setWritable(u),c.emit("connect")}),o.onSocketMessage(function(y){if(typeof y.data=="string"){const _=n.from(y.data,"base64");u.push(_)}else{const _=new FileReader;_.addEventListener("load",function(){let A=_.result;A=A instanceof ArrayBuffer?n.from(A):n.from(A,"utf8"),u.push(A)}),_.readAsArrayBuffer(y.data)}}),o.onSocketClose(function(){c.end(),c.destroy()}),o.onSocketError(function(y){c.destroy(y)})),c}},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(i,a,s){const n=i("net"),r=i("debug")("mqttjs:tcp");a.exports=function(l,o){o.port=o.port||1883,o.hostname=o.hostname||o.host||"localhost";const u=o.port,c=o.hostname;return r("port %d and host %s",u,c),n.createConnection(u,c)}},{debug:18,net:16}],4:[function(i,a,s){const n=i("tls"),r=i("net"),l=i("debug")("mqttjs:tls");a.exports=function(o,u){u.port=u.port||8883,u.host=u.hostname||u.host||"localhost",r.isIP(u.host)===0&&(u.servername=u.host),u.rejectUnauthorized=u.rejectUnauthorized!==!1,delete u.path,l("port %d host %s rejectUnauthorized %b",u.port,u.host,u.rejectUnauthorized);const c=n.connect(u);function f(g){u.rejectUnauthorized&&o.emit("error",g),c.end()}return c.on("secureConnect",function(){u.rejectUnauthorized&&!c.authorized?c.emit("error",new Error("TLS not authorized")):c.removeListener("error",f)}),c.on("error",f),c}},{debug:18,net:16,tls:16}],5:[function(i,a,s){(function(n){(function(){const{Buffer:r}=i("buffer"),l=i("ws"),o=i("debug")("mqttjs:ws"),u=i("duplexify"),c=i("readable-stream").Transform,f=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],g=n!==void 0&&n.title==="browser"||typeof __webpack_require__=="function";function v(w,y){let _=w.protocol+"://"+w.hostname+":"+w.port+w.path;return typeof w.transformWsUrl=="function"&&(_=w.transformWsUrl(_,w,y)),_}function m(w){const y=w;return w.hostname||(y.hostname="localhost"),w.port||(w.protocol==="wss"?y.port=443:y.port=80),w.path||(y.path="/"),w.wsOptions||(y.wsOptions={}),g||w.protocol!=="wss"||f.forEach(function(_){Object.prototype.hasOwnProperty.call(w,_)&&!Object.prototype.hasOwnProperty.call(w.wsOptions,_)&&(y.wsOptions[_]=w[_])}),y}a.exports=g?function(w,y){let _;o("browserStreamBuilder");const A=function(P){const M=m(P);if(M.hostname||(M.hostname=M.host),!M.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const Y=new URL(document.URL);M.hostname=Y.hostname,M.port||(M.port=Y.port)}return M.objectMode===void 0&&(M.objectMode=!(M.binary===!0||M.binary===void 0)),M}(y).browserBufferSize||524288,x=y.browserBufferTimeout||1e3,C=!y.objectMode,T=function(P,M){const Y=M.protocolId==="MQIsdp"&&M.protocolVersion===3?"mqttv3.1":"mqtt",Z=v(M,P),nt=new WebSocket(Z,[Y]);return nt.binaryType="arraybuffer",nt}(w,y),I=function(P,M,Y){const Z=new c({objectModeMode:P.objectMode});return Z._write=M,Z._flush=Y,Z}(y,function P(M,Y,Z){T.bufferedAmount>A&&setTimeout(P,x,M,Y,Z),C&&typeof M=="string"&&(M=r.from(M,"utf8"));try{T.send(M)}catch(nt){return Z(nt)}Z()},function(P){T.close(),P()});y.objectMode||(I._writev=R),I.on("close",()=>{T.close()});const D=T.addEventListener!==void 0;function B(){_.setReadable(I),_.setWritable(I),_.emit("connect")}function V(){_.end(),_.destroy()}function Q(P){_.destroy(P)}function F(P){let M=P.data;M=M instanceof ArrayBuffer?r.from(M):r.from(M,"utf8"),I.push(M)}function R(P,M){const Y=new Array(P.length);for(let Z=0;Z{C.destroy()}),C}}).call(this)}).call(this,i("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(i,a,s){const{Buffer:n}=i("buffer"),r=i("readable-stream").Transform,l=i("duplexify");let o,u,c;a.exports=function(f,g){if(g.hostname=g.hostname||g.host,!g.hostname)throw new Error("Could not determine host. Specify host manually.");const v=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt";(function(y){y.hostname||(y.hostname="localhost"),y.path||(y.path="/"),y.wsOptions||(y.wsOptions={})})(g);const m=function(y,_){const A=y.protocol==="wxs"?"wss":"ws";let x=A+"://"+y.hostname+y.path;return y.port&&y.port!==80&&y.port!==443&&(x=A+"://"+y.hostname+":"+y.port+y.path),typeof y.transformWsUrl=="function"&&(x=y.transformWsUrl(x,y,_)),x}(g,f);o=wx.connectSocket({url:m,protocols:[v]}),u=function(){const y=new r;return y._write=function(_,A,x){o.send({data:_.buffer,success:function(){x()},fail:function(C){x(new Error(C))}})},y._flush=function(_){o.close({success:function(){_()}})},y}(),(c=l.obj())._destroy=function(y,_){o.close({success:function(){_&&_(y)}})};const w=c.destroy;return c.destroy=function(){c.destroy=w;const y=this;setTimeout(function(){o.close({fail:function(){y._destroy(new Error)}})},0)}.bind(c),o.onOpen(function(){c.setReadable(u),c.setWritable(u),c.emit("connect")}),o.onMessage(function(y){let _=y.data;_=_ instanceof ArrayBuffer?n.from(_):n.from(_,"utf8"),u.push(_)}),o.onClose(function(){c.end(),c.destroy()}),o.onError(function(y){c.destroy(new Error(y.errMsg))}),c}},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(i,a,s){function n(){if(!(this instanceof n))return new n;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}n.prototype.allocate=function(){const r=this.nextId++;return this.nextId===65536&&(this.nextId=1),r},n.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},n.prototype.register=function(r){return!0},n.prototype.deallocate=function(r){},n.prototype.clear=function(){},a.exports=n},{}],8:[function(i,a,s){const n=i("xtend"),r=i("readable-stream").Readable,l={objectMode:!0},o={clean:!0};function u(c){if(!(this instanceof u))return new u(c);this.options=c||{},this.options=n(o,c),this._inflights=new Map}u.prototype.put=function(c,f){return this._inflights.set(c.messageId,c),f&&f(),this},u.prototype.createStream=function(){const c=new r(l),f=[];let g=!1,v=0;return this._inflights.forEach(function(m,w){f.push(m)}),c._read=function(){!g&&vthis.max)&&(this.aliasToTopic[l]=r,this.length=Object.keys(this.aliasToTopic).length,!0)},n.prototype.getTopicByAlias=function(r){return this.aliasToTopic[r]},n.prototype.clear=function(){this.aliasToTopic={}},a.exports=n},{}],10:[function(i,a,s){const n=i("lru-cache"),r=i("number-allocator").NumberAllocator;function l(o){if(!(this instanceof l))return new l(o);o>0&&(this.aliasToTopic=new n({max:o}),this.topicToAlias={},this.numberAllocator=new r(1,o),this.max=o,this.length=0)}l.prototype.put=function(o,u){if(u===0||u>this.max)return!1;const c=this.aliasToTopic.get(u);return c&&delete this.topicToAlias[c],this.aliasToTopic.set(u,o),this.topicToAlias[o]=u,this.numberAllocator.use(u),this.length=this.aliasToTopic.length,!0},l.prototype.getTopicByAlias=function(o){return this.aliasToTopic.get(o)},l.prototype.getAliasByTopic=function(o){const u=this.topicToAlias[o];return u!==void 0&&this.aliasToTopic.get(u),u},l.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},l.prototype.getLruAlias=function(){return this.numberAllocator.firstVacant()||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},a.exports=l},{"lru-cache":37,"number-allocator":46}],11:[function(i,a,s){function n(r){const l=r.split("/");for(let o=0;o0?_-4:_;for(w=0;w>16&255,x[C++]=m>>8&255,x[C++]=255&m;return A===2&&(m=r[v.charCodeAt(w)]<<2|r[v.charCodeAt(w+1)]>>4,x[C++]=255&m),A===1&&(m=r[v.charCodeAt(w)]<<10|r[v.charCodeAt(w+1)]<<4|r[v.charCodeAt(w+2)]>>2,x[C++]=m>>8&255,x[C++]=255&m),x},s.fromByteArray=function(v){for(var m,w=v.length,y=w%3,_=[],A=0,x=w-y;Ax?x:A+16383));return y===1?(m=v[w-1],_.push(n[m>>2]+n[m<<4&63]+"==")):y===2&&(m=(v[w-2]<<8)+v[w-1],_.push(n[m>>10]+n[m>>4&63]+n[m<<2&63]+"=")),_.join("")};for(var n=[],r=[],l=typeof Uint8Array<"u"?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,c=o.length;u0)throw new Error("Invalid string. Length must be a multiple of 4");var w=v.indexOf("=");return w===-1&&(w=m),[w,w===m?0:4-w%4]}function g(v,m,w){for(var y,_,A=[],x=m;x>18&63]+n[_>>12&63]+n[_>>6&63]+n[63&_]);return A.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},{}],14:[function(i,a,s){const{Buffer:n}=i("buffer"),r=Symbol.for("BufferList");function l(o){if(!(this instanceof l))return new l(o);l._init.call(this,o)}l._init=function(o){Object.defineProperty(this,r,{value:!0}),this._bufs=[],this.length=0,o&&this.append(o)},l.prototype._new=function(o){return new l(o)},l.prototype._offset=function(o){if(o===0)return[0,0];let u=0;for(let c=0;cthis.length||o<0)return;const u=this._offset(o);return this._bufs[u[0]][u[1]]},l.prototype.slice=function(o,u){return typeof o=="number"&&o<0&&(o+=this.length),typeof u=="number"&&u<0&&(u+=this.length),this.copy(null,0,o,u)},l.prototype.copy=function(o,u,c,f){if((typeof c!="number"||c<0)&&(c=0),(typeof f!="number"||f>this.length)&&(f=this.length),c>=this.length||f<=0)return o||n.alloc(0);const g=!!o,v=this._offset(c),m=f-c;let w=m,y=g&&u||0,_=v[1];if(c===0&&f===this.length){if(!g)return this._bufs.length===1?this._bufs[0]:n.concat(this._bufs,this.length);for(let A=0;Ax)){this._bufs[A].copy(o,y,_,_+w),y+=x;break}this._bufs[A].copy(o,y,_),y+=x,w-=x,_&&(_=0)}return o.length>y?o.slice(0,y):o},l.prototype.shallowSlice=function(o,u){if(o=o||0,u=typeof u!="number"?this.length:u,o<0&&(o+=this.length),u<0&&(u+=this.length),o===u)return this._new();const c=this._offset(o),f=this._offset(u),g=this._bufs.slice(c[0],f[0]+1);return f[1]===0?g.pop():g[g.length-1]=g[g.length-1].slice(0,f[1]),c[1]!==0&&(g[0]=g[0].slice(c[1])),this._new(g)},l.prototype.toString=function(o,u,c){return this.slice(u,c).toString(o)},l.prototype.consume=function(o){if(o=Math.trunc(o),Number.isNaN(o)||o<=0)return this;for(;this._bufs.length;){if(!(o>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(o),this.length-=o;break}o-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},l.prototype.duplicate=function(){const o=this._new();for(let u=0;uthis.length?this.length:u;const f=this._offset(u);let g=f[0],v=f[1];for(;g=o.length){const w=m.indexOf(o,v);if(w!==-1)return this._reverseOffset([g,w]);v=m.length-o.length+1}else{const w=this._reverseOffset([g,v]);if(this._match(w,o))return w;v++}v=0}return-1},l.prototype._match=function(o,u){if(this.length-oo)throw new RangeError('The value "'+b+'" is invalid for option "size"');var E=new Uint8Array(b);return E.__proto__=c.prototype,E}function c(b,E,S){if(typeof b=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(b)}return f(b,E,S)}function f(b,E,S){if(typeof b=="string")return function(G,rt){if(typeof rt=="string"&&rt!==""||(rt="utf8"),!c.isEncoding(rt))throw new TypeError("Unknown encoding: "+rt);var yt=0|y(G,rt),mt=u(yt),At=mt.write(G,rt);return At!==yt&&(mt=mt.slice(0,At)),mt}(b,E);if(ArrayBuffer.isView(b))return m(b);if(b==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b);if(ct(b,ArrayBuffer)||b&&ct(b.buffer,ArrayBuffer))return function(G,rt,yt){if(rt<0||G.byteLength=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|b}function y(b,E){if(c.isBuffer(b))return b.length;if(ArrayBuffer.isView(b)||ct(b,ArrayBuffer))return b.byteLength;if(typeof b!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof b);var S=b.length,N=arguments.length>2&&arguments[2]===!0;if(!N&&S===0)return 0;for(var X=!1;;)switch(E){case"ascii":case"latin1":case"binary":return S;case"utf8":case"utf-8":return at(b).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*S;case"hex":return S>>>1;case"base64":return et(b).length;default:if(X)return N?-1:at(b).length;E=(""+E).toLowerCase(),X=!0}}function _(b,E,S){var N=b[E];b[E]=b[S],b[S]=N}function A(b,E,S,N,X){if(b.length===0)return-1;if(typeof S=="string"?(N=S,S=0):S>2147483647?S=2147483647:S<-2147483648&&(S=-2147483648),ot(S=+S)&&(S=X?0:b.length-1),S<0&&(S=b.length+S),S>=b.length){if(X)return-1;S=b.length-1}else if(S<0){if(!X)return-1;S=0}if(typeof E=="string"&&(E=c.from(E,N)),c.isBuffer(E))return E.length===0?-1:x(b,E,S,N,X);if(typeof E=="number")return E&=255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(b,E,S):Uint8Array.prototype.lastIndexOf.call(b,E,S):x(b,[E],S,N,X);throw new TypeError("val must be string, number or Buffer")}function x(b,E,S,N,X){var G,rt=1,yt=b.length,mt=E.length;if(N!==void 0&&((N=String(N).toLowerCase())==="ucs2"||N==="ucs-2"||N==="utf16le"||N==="utf-16le")){if(b.length<2||E.length<2)return-1;rt=2,yt/=2,mt/=2,S/=2}function At(xe,jt){return rt===1?xe[jt]:xe.readUInt16BE(jt*rt)}if(X){var Rt=-1;for(G=S;Gyt&&(S=yt-mt),G=S;G>=0;G--){for(var be=!0,ae=0;aeX&&(N=X):N=X;var G=E.length;N>G/2&&(N=G/2);for(var rt=0;rt>8,mt=rt%256,At.push(mt),At.push(yt);return At}(E,b.length-S),b,S,N)}function Q(b,E,S){return E===0&&S===b.length?r.fromByteArray(b):r.fromByteArray(b.slice(E,S))}function F(b,E,S){S=Math.min(b.length,S);for(var N=[],X=E;X239?4:At>223?3:At>191?2:1;if(X+be<=S)switch(be){case 1:At<128&&(Rt=At);break;case 2:(192&(G=b[X+1]))==128&&(mt=(31&At)<<6|63&G)>127&&(Rt=mt);break;case 3:G=b[X+1],rt=b[X+2],(192&G)==128&&(192&rt)==128&&(mt=(15&At)<<12|(63&G)<<6|63&rt)>2047&&(mt<55296||mt>57343)&&(Rt=mt);break;case 4:G=b[X+1],rt=b[X+2],yt=b[X+3],(192&G)==128&&(192&rt)==128&&(192&yt)==128&&(mt=(15&At)<<18|(63&G)<<12|(63&rt)<<6|63&yt)>65535&&mt<1114112&&(Rt=mt)}Rt===null?(Rt=65533,be=1):Rt>65535&&(Rt-=65536,N.push(Rt>>>10&1023|55296),Rt=56320|1023&Rt),N.push(Rt),X+=be}return function(ae){var xe=ae.length;if(xe<=R)return String.fromCharCode.apply(String,ae);for(var jt="",te=0;te"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),c.poolSize=8192,c.from=function(b,E,S){return f(b,E,S)},c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,c.alloc=function(b,E,S){return function(N,X,G){return g(N),N<=0?u(N):X!==void 0?typeof G=="string"?u(N).fill(X,G):u(N).fill(X):u(N)}(b,E,S)},c.allocUnsafe=function(b){return v(b)},c.allocUnsafeSlow=function(b){return v(b)},c.isBuffer=function(b){return b!=null&&b._isBuffer===!0&&b!==c.prototype},c.compare=function(b,E){if(ct(b,Uint8Array)&&(b=c.from(b,b.offset,b.byteLength)),ct(E,Uint8Array)&&(E=c.from(E,E.offset,E.byteLength)),!c.isBuffer(b)||!c.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(b===E)return 0;for(var S=b.length,N=E.length,X=0,G=Math.min(S,N);Xthis.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0)<=(S>>>=0))return"";for(E||(E="utf8");;)switch(E){case"hex":return Y(this,S,N);case"utf8":case"utf-8":return F(this,S,N);case"ascii":return P(this,S,N);case"latin1":case"binary":return M(this,S,N);case"base64":return Q(this,S,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,S,N);default:if(X)throw new TypeError("Unknown encoding: "+E);E=(E+"").toLowerCase(),X=!0}}.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(b){if(!c.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||c.compare(this,b)===0},c.prototype.inspect=function(){var b="",E=s.INSPECT_MAX_BYTES;return b=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(b+=" ... "),""},c.prototype.compare=function(b,E,S,N,X){if(ct(b,Uint8Array)&&(b=c.from(b,b.offset,b.byteLength)),!c.isBuffer(b))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof b);if(E===void 0&&(E=0),S===void 0&&(S=b?b.length:0),N===void 0&&(N=0),X===void 0&&(X=this.length),E<0||S>b.length||N<0||X>this.length)throw new RangeError("out of range index");if(N>=X&&E>=S)return 0;if(N>=X)return-1;if(E>=S)return 1;if(E>>>=0,S>>>=0,N>>>=0,X>>>=0,this===b)return 0;for(var G=X-N,rt=S-E,yt=Math.min(G,rt),mt=this.slice(N,X),At=b.slice(E,S),Rt=0;Rt>>=0,isFinite(S)?(S>>>=0,N===void 0&&(N="utf8")):(N=S,S=void 0)}var X=this.length-E;if((S===void 0||S>X)&&(S=X),b.length>0&&(S<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var G=!1;;)switch(N){case"hex":return C(this,b,E,S);case"utf8":case"utf-8":return T(this,b,E,S);case"ascii":return I(this,b,E,S);case"latin1":case"binary":return D(this,b,E,S);case"base64":return B(this,b,E,S);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,b,E,S);default:if(G)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),G=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function P(b,E,S){var N="";S=Math.min(b.length,S);for(var X=E;XN)&&(S=N);for(var X="",G=E;GS)throw new RangeError("Trying to access beyond buffer length")}function j(b,E,S,N,X,G){if(!c.isBuffer(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>X||Eb.length)throw new RangeError("Index out of range")}function H(b,E,S,N,X,G){if(S+N>b.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("Index out of range")}function $(b,E,S,N,X){return E=+E,S>>>=0,X||H(b,0,S,4),l.write(b,E,S,N,23,4),S+4}function K(b,E,S,N,X){return E=+E,S>>>=0,X||H(b,0,S,8),l.write(b,E,S,N,52,8),S+8}c.prototype.slice=function(b,E){var S=this.length;b=~~b,E=E===void 0?S:~~E,b<0?(b+=S)<0&&(b=0):b>S&&(b=S),E<0?(E+=S)<0&&(E=0):E>S&&(E=S),E>>=0,E>>>=0,S||nt(b,E,this.length);for(var N=this[b],X=1,G=0;++G>>=0,E>>>=0,S||nt(b,E,this.length);for(var N=this[b+--E],X=1;E>0&&(X*=256);)N+=this[b+--E]*X;return N},c.prototype.readUInt8=function(b,E){return b>>>=0,E||nt(b,1,this.length),this[b]},c.prototype.readUInt16LE=function(b,E){return b>>>=0,E||nt(b,2,this.length),this[b]|this[b+1]<<8},c.prototype.readUInt16BE=function(b,E){return b>>>=0,E||nt(b,2,this.length),this[b]<<8|this[b+1]},c.prototype.readUInt32LE=function(b,E){return b>>>=0,E||nt(b,4,this.length),(this[b]|this[b+1]<<8|this[b+2]<<16)+16777216*this[b+3]},c.prototype.readUInt32BE=function(b,E){return b>>>=0,E||nt(b,4,this.length),16777216*this[b]+(this[b+1]<<16|this[b+2]<<8|this[b+3])},c.prototype.readIntLE=function(b,E,S){b>>>=0,E>>>=0,S||nt(b,E,this.length);for(var N=this[b],X=1,G=0;++G=(X*=128)&&(N-=Math.pow(2,8*E)),N},c.prototype.readIntBE=function(b,E,S){b>>>=0,E>>>=0,S||nt(b,E,this.length);for(var N=E,X=1,G=this[b+--N];N>0&&(X*=256);)G+=this[b+--N]*X;return G>=(X*=128)&&(G-=Math.pow(2,8*E)),G},c.prototype.readInt8=function(b,E){return b>>>=0,E||nt(b,1,this.length),128&this[b]?-1*(255-this[b]+1):this[b]},c.prototype.readInt16LE=function(b,E){b>>>=0,E||nt(b,2,this.length);var S=this[b]|this[b+1]<<8;return 32768&S?4294901760|S:S},c.prototype.readInt16BE=function(b,E){b>>>=0,E||nt(b,2,this.length);var S=this[b+1]|this[b]<<8;return 32768&S?4294901760|S:S},c.prototype.readInt32LE=function(b,E){return b>>>=0,E||nt(b,4,this.length),this[b]|this[b+1]<<8|this[b+2]<<16|this[b+3]<<24},c.prototype.readInt32BE=function(b,E){return b>>>=0,E||nt(b,4,this.length),this[b]<<24|this[b+1]<<16|this[b+2]<<8|this[b+3]},c.prototype.readFloatLE=function(b,E){return b>>>=0,E||nt(b,4,this.length),l.read(this,b,!0,23,4)},c.prototype.readFloatBE=function(b,E){return b>>>=0,E||nt(b,4,this.length),l.read(this,b,!1,23,4)},c.prototype.readDoubleLE=function(b,E){return b>>>=0,E||nt(b,8,this.length),l.read(this,b,!0,52,8)},c.prototype.readDoubleBE=function(b,E){return b>>>=0,E||nt(b,8,this.length),l.read(this,b,!1,52,8)},c.prototype.writeUIntLE=function(b,E,S,N){b=+b,E>>>=0,S>>>=0,N||j(this,b,E,S,Math.pow(2,8*S)-1,0);var X=1,G=0;for(this[E]=255&b;++G>>=0,S>>>=0,N||j(this,b,E,S,Math.pow(2,8*S)-1,0);var X=S-1,G=1;for(this[E+X]=255&b;--X>=0&&(G*=256);)this[E+X]=b/G&255;return E+S},c.prototype.writeUInt8=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,1,255,0),this[E]=255&b,E+1},c.prototype.writeUInt16LE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,2,65535,0),this[E]=255&b,this[E+1]=b>>>8,E+2},c.prototype.writeUInt16BE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,2,65535,0),this[E]=b>>>8,this[E+1]=255&b,E+2},c.prototype.writeUInt32LE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,4,4294967295,0),this[E+3]=b>>>24,this[E+2]=b>>>16,this[E+1]=b>>>8,this[E]=255&b,E+4},c.prototype.writeUInt32BE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,4,4294967295,0),this[E]=b>>>24,this[E+1]=b>>>16,this[E+2]=b>>>8,this[E+3]=255&b,E+4},c.prototype.writeIntLE=function(b,E,S,N){if(b=+b,E>>>=0,!N){var X=Math.pow(2,8*S-1);j(this,b,E,S,X-1,-X)}var G=0,rt=1,yt=0;for(this[E]=255&b;++G>0)-yt&255;return E+S},c.prototype.writeIntBE=function(b,E,S,N){if(b=+b,E>>>=0,!N){var X=Math.pow(2,8*S-1);j(this,b,E,S,X-1,-X)}var G=S-1,rt=1,yt=0;for(this[E+G]=255&b;--G>=0&&(rt*=256);)b<0&&yt===0&&this[E+G+1]!==0&&(yt=1),this[E+G]=(b/rt>>0)-yt&255;return E+S},c.prototype.writeInt8=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,1,127,-128),b<0&&(b=255+b+1),this[E]=255&b,E+1},c.prototype.writeInt16LE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,2,32767,-32768),this[E]=255&b,this[E+1]=b>>>8,E+2},c.prototype.writeInt16BE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,2,32767,-32768),this[E]=b>>>8,this[E+1]=255&b,E+2},c.prototype.writeInt32LE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,4,2147483647,-2147483648),this[E]=255&b,this[E+1]=b>>>8,this[E+2]=b>>>16,this[E+3]=b>>>24,E+4},c.prototype.writeInt32BE=function(b,E,S){return b=+b,E>>>=0,S||j(this,b,E,4,2147483647,-2147483648),b<0&&(b=4294967295+b+1),this[E]=b>>>24,this[E+1]=b>>>16,this[E+2]=b>>>8,this[E+3]=255&b,E+4},c.prototype.writeFloatLE=function(b,E,S){return $(this,b,E,!0,S)},c.prototype.writeFloatBE=function(b,E,S){return $(this,b,E,!1,S)},c.prototype.writeDoubleLE=function(b,E,S){return K(this,b,E,!0,S)},c.prototype.writeDoubleBE=function(b,E,S){return K(this,b,E,!1,S)},c.prototype.copy=function(b,E,S,N){if(!c.isBuffer(b))throw new TypeError("argument should be a Buffer");if(S||(S=0),N||N===0||(N=this.length),E>=b.length&&(E=b.length),E||(E=0),N>0&&N=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),b.length-E=0;--G)b[G+E]=this[G+S];else Uint8Array.prototype.set.call(b,this.subarray(S,N),E);return X},c.prototype.fill=function(b,E,S,N){if(typeof b=="string"){if(typeof E=="string"?(N=E,E=0,S=this.length):typeof S=="string"&&(N=S,S=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!c.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(b.length===1){var X=b.charCodeAt(0);(N==="utf8"&&X<128||N==="latin1")&&(b=X)}}else typeof b=="number"&&(b&=255);if(E<0||this.length>>=0,S=S===void 0?this.length:S>>>0,b||(b=0),typeof b=="number")for(G=E;G55295&&S<57344){if(!X){if(S>56319){(E-=3)>-1&&G.push(239,191,189);continue}if(rt+1===N){(E-=3)>-1&&G.push(239,191,189);continue}X=S;continue}if(S<56320){(E-=3)>-1&&G.push(239,191,189),X=S;continue}S=65536+(X-55296<<10|S-56320)}else X&&(E-=3)>-1&&G.push(239,191,189);if(X=null,S<128){if((E-=1)<0)break;G.push(S)}else if(S<2048){if((E-=2)<0)break;G.push(S>>6|192,63&S|128)}else if(S<65536){if((E-=3)<0)break;G.push(S>>12|224,S>>6&63|128,63&S|128)}else{if(!(S<1114112))throw new Error("Invalid code point");if((E-=4)<0)break;G.push(S>>18|240,S>>12&63|128,S>>6&63|128,63&S|128)}}return G}function et(b){return r.toByteArray(function(E){if((E=(E=E.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;E.length%4!=0;)E+="=";return E}(b))}function ut(b,E,S,N){for(var X=0;X=E.length||X>=b.length);++X)E[X+S]=b[X];return X}function ct(b,E){return b instanceof E||b!=null&&b.constructor!=null&&b.constructor.name!=null&&b.constructor.name===E.name}function ot(b){return b!=b}}).call(this)}).call(this,i("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(i,a,s){(function(n){(function(){s.formatArgs=function(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+a.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;l.splice(1,0,o,"color: inherit");let u=0,c=0;l[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&f==="%c"&&(c=++u)}),l.splice(c,0,o)},s.save=function(l){try{l?s.storage.setItem("debug",l):s.storage.removeItem("debug")}catch{}},s.load=function(){let l;try{l=s.storage.getItem("debug")}catch{}return!l&&n!==void 0&&"env"in n&&(l=n.env.DEBUG),l},s.useColors=function(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},s.storage=function(){try{return localStorage}catch{}}(),s.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),s.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],s.log=console.debug||console.log||(()=>{}),a.exports=i("./common")(s);const{formatters:r}=a.exports;r.j=function(l){try{return JSON.stringify(l)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}}}).call(this)}).call(this,i("_process"))},{"./common":19,_process:50}],19:[function(i,a,s){a.exports=function(n){function r(u){let c,f,g,v=null;function m(...w){if(!m.enabled)return;const y=m,_=Number(new Date),A=_-(c||_);y.diff=A,y.prev=c,y.curr=_,c=_,w[0]=r.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let x=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(C,T)=>{if(C==="%%")return"%";x++;const I=r.formatters[T];if(typeof I=="function"){const D=w[x];C=I.call(y,D),w.splice(x,1),x--}return C}),r.formatArgs.call(y,w),(y.log||r.log).apply(y,w)}return m.namespace=u,m.useColors=r.useColors(),m.color=r.selectColor(u),m.extend=l,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>v!==null?v:(f!==r.namespaces&&(f=r.namespaces,g=r.enabled(u)),g),set:w=>{v=w}}),typeof r.init=="function"&&r.init(m),m}function l(u,c){const f=r(this.namespace+(c===void 0?":":c)+u);return f.log=this.log,f}function o(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(u){return u instanceof Error?u.stack||u.message:u},r.disable=function(){const u=[...r.names.map(o),...r.skips.map(o).map(c=>"-"+c)].join(",");return r.enable(""),u},r.enable=function(u){let c;r.save(u),r.namespaces=u,r.names=[],r.skips=[];const f=(typeof u=="string"?u:"").split(/[\s,]+/),g=f.length;for(c=0;c{r[u]=n[u]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(u){let c=0;for(let f=0;f0&&V.length>D){V.warned=!0;var Q=new Error("Possible EventEmitter memory leak detected. "+V.length+' "'+String(C)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');Q.name="MaxListenersExceededWarning",Q.emitter=x,Q.type=C,Q.count=V.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",Q.name,Q.message)}}else V=B[C]=T,++x._eventsCount;return x}function m(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var x=new Array(arguments.length),C=0;C1&&(C=arguments[1]),C instanceof Error)throw C;var F=new Error('Unhandled "error" event. ('+C+")");throw F.context=C,F}if(!(T=V[x]))return!1;var R=typeof T=="function";switch(I=arguments.length){case 1:(function(P,M,Y){if(M)P.call(Y);else for(var Z=P.length,nt=A(P,Z),j=0;j=0;B--)if(T[B]===C||T[B].listener===C){V=T[B].listener,D=B;break}if(D<0)return this;D===0?T.shift():function(Q,F){for(var R=F,P=R+1,M=Q.length;P=0;I--)this.removeListener(x,C[I]);return this},o.prototype.listeners=function(x){return y(this,x,!0)},o.prototype.rawListeners=function(x){return y(this,x,!1)},o.listenerCount=function(x,C){return typeof x.listenerCount=="function"?x.listenerCount(C):_.call(x,C)},o.prototype.listenerCount=_,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(i,a,s){s.read=function(n,r,l,o,u){var c,f,g=8*u-o-1,v=(1<>1,w=-7,y=l?u-1:0,_=l?-1:1,A=n[r+y];for(y+=_,c=A&(1<<-w)-1,A>>=-w,w+=g;w>0;c=256*c+n[r+y],y+=_,w-=8);for(f=c&(1<<-w)-1,c>>=-w,w+=o;w>0;f=256*f+n[r+y],y+=_,w-=8);if(c===0)c=1-m;else{if(c===v)return f?NaN:1/0*(A?-1:1);f+=Math.pow(2,o),c-=m}return(A?-1:1)*f*Math.pow(2,c-o)},s.write=function(n,r,l,o,u,c){var f,g,v,m=8*c-u-1,w=(1<>1,_=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=o?0:c-1,x=o?1:-1,C=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(g=isNaN(r)?1:0,f=w):(f=Math.floor(Math.log(r)/Math.LN2),r*(v=Math.pow(2,-f))<1&&(f--,v*=2),(r+=f+y>=1?_/v:_*Math.pow(2,1-y))*v>=2&&(f++,v/=2),f+y>=w?(g=0,f=w):f+y>=1?(g=(r*v-1)*Math.pow(2,u),f+=y):(g=r*Math.pow(2,y-1)*Math.pow(2,u),f=0));u>=8;n[l+A]=255&g,A+=x,g/=256,u-=8);for(f=f<0;n[l+A]=255&f,A+=x,f/=256,m-=8);n[l+A-x]|=128*C}},{}],24:[function(i,a,s){typeof Object.create=="function"?a.exports=function(n,r){r&&(n.super_=r,n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:a.exports=function(n,r){if(r){n.super_=r;var l=function(){};l.prototype=r.prototype,n.prototype=new l,n.prototype.constructor=n}}},{}],25:[function(i,a,s){Object.defineProperty(s,"__esModule",{value:!0});var n=function(){function r(l,o){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=l,this.value=o}return r.prototype.rotateLeft=function(){var l=this.parent,o=this.brother,u=this.leftChild,c=this.rightChild;if(!c)throw new Error("unknown error");var f=c.leftChild,g=c.rightChild;return l&&(l.leftChild===this?l.leftChild=c:l.rightChild===this&&(l.rightChild=c)),c.parent=l,c.brother=o,c.leftChild=this,c.rightChild=g,o&&(o.brother=c),this.parent=c,this.brother=g,this.leftChild=u,this.rightChild=f,g&&(g.parent=c,g.brother=this),u&&(u.parent=this,u.brother=f),f&&(f.parent=this,f.brother=u),c},r.prototype.rotateRight=function(){var l=this.parent,o=this.brother,u=this.leftChild;if(!u)throw new Error("unknown error");var c=this.rightChild,f=u.leftChild,g=u.rightChild;return l&&(l.leftChild===this?l.leftChild=u:l.rightChild===this&&(l.rightChild=u)),u.parent=l,u.brother=o,u.leftChild=f,u.rightChild=this,o&&(o.brother=u),f&&(f.parent=u,f.brother=this),this.parent=u,this.brother=f,this.leftChild=g,this.rightChild=c,g&&(g.parent=this,g.brother=c),c&&(c.parent=this,c.brother=g),u},r.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},r.TreeNodeColorType={red:!0,black:!1},r}();Object.freeze(n),s.default=n},{}],26:[function(i,a,s){var n=this&&this.__generator||function(l,o){var u,c,f,g,v={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return g={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function m(w){return function(y){return function(_){if(u)throw new TypeError("Generator is already executing.");for(;v;)try{if(u=1,c&&(f=2&_[0]?c.return:_[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,_[1])).done)return f;switch(c=0,f&&(_=[2&_[0],f.value]),_[0]){case 0:case 1:f=_;break;case 4:return v.label++,{value:_[1],done:!1};case 5:v.label++,c=_[1],_=[0];continue;case 7:_=v.ops.pop(),v.trys.pop();continue;default:if(!(f=(f=v.trys).length>0&&f[f.length-1])&&(_[0]===6||_[0]===2)){v=0;continue}if(_[0]===3&&(!f||_[1]>f[0]&&_[1]T)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(C/r.bucketSize),curNodePointerIndex:C%r.bucketSize}};this.getElementByPos=function(A){var x=y(A),C=x.curNodeBucketIndex,T=x.curNodePointerIndex;return u[C][T]},this.eraseElementByPos=function(A){var x=this;if(A<0||A>w)throw new Error("pos should more than 0 and less than queue's size");if(A===0)this.popFront();else if(A===this.size())this.popBack();else{for(var C=[],T=A+1;T0?--v:c0&&--w)},this.setElementByPos=function(A,x){var C=y(A),T=C.curNodeBucketIndex,I=C.curNodePointerIndex;u[T][I]=x},this.insert=function(A,x,C){var T=this;if(C===void 0&&(C=1),A===0)for(;C--;)this.pushFront(x);else if(A===this.size())for(;C--;)this.pushBack(x);else{for(var I=[],D=A;D0?--f:c>0&&(--c,f=r.bucketSize-1)),++w,u[c][f]=A},this.popFront=function(){this.empty()||(this.size()!==1&&(f0&&--w)},this.shrinkToFit=function(){var A=this,x=[];this.forEach(function(D){x.push(D)});var C=x.length;u=[];for(var T=Math.ceil(C/r.bucketSize),I=0;I0&&m[m.length-1])&&(C[0]===6||C[0]===2)){y=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]=c.length&&(c=void 0),{value:c&&c[v++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var l=i("../LinkList/LinkList"),o=i("../Map/Map");function u(c,f,g){var v=this;if(c===void 0&&(c=[]),f===void 0&&(f=u.initSize),g=g||function(_){var A,x,C=0,T="";if(typeof _=="number")C=((C=Math.floor(_))<<5)-C,C&=C;else{T=typeof _!="string"?JSON.stringify(_):_;try{for(var I=r(T),D=I.next();!D.done;D=I.next())C=(C<<5)-C+D.value.charCodeAt(0),C&=C}catch(B){A={error:B}}finally{try{D&&!D.done&&(x=I.return)&&x.call(I)}finally{if(A)throw A.error}}}return C^=C>>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var m=0,w=[],y=Math.max(u.initSize,Math.min(u.maxSize,f));this.size=function(){return m},this.empty=function(){return m===0},this.clear=function(){m=0,y=f,w=[]},this.forEach=function(_){var A=0;w.forEach(function(x){x.forEach(function(C){_(C,A++)})})},this.setElement=function(_,A){var x,C;if(_==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(A!=null){var T=g(_)&y-1;if(w[T]){var I=w[T].size();if(w[T]instanceof l.default){try{for(var D=r(w[T]),B=D.next();!B.done;B=D.next()){var V=B.value;if(V.key===_)return void(V.value=A)}}catch(F){x={error:F}}finally{try{B&&!B.done&&(C=D.return)&&C.call(D)}finally{if(x)throw x.error}}w[T].pushBack({key:_,value:A}),w[T].size()>=u.treeifyThreshold&&(w[T]=new o.default(w[T]))}else w[T].setElement(_,A);var Q=w[T].size();m+=Q-I}else++m,w[T]=new l.default([{key:_,value:A}]);m>y*u.sigma&&function(F){if(!(F>=u.maxSize)){y=2*F;var R=[];w.forEach(function(P,M){if(!P.empty()){if(P instanceof l.default&&P.size()===1){var Y=P.front(),Z=Y.key,nt=Y.value;R[g(Z)&y-1]=new l.default([{key:Z,value:nt}])}else if(P instanceof o.default){var j=new l.default,H=new l.default;P.forEach(function(U){(g(U.key)&F)==0?j.pushBack(U):H.pushBack(U)}),j.size()>u.untreeifyThreshold?R[M]=new o.default(j):j.size()&&(R[M]=j),H.size()>u.untreeifyThreshold?R[M+F]=new o.default(H):H.size()&&(R[M+F]=H)}else{var $=new l.default,K=new l.default;P.forEach(function(U){(g(U.key)&F)==0?$.pushBack(U):K.pushBack(U)}),$.size()&&(R[M]=$),K.size()&&(R[M+F]=K)}w[M].clear()}}),w=R}}.call(this,y)}else this.eraseElementByKey(_)},this.getElementByKey=function(_){var A,x,C=g(_)&y-1;if(w[C]){if(w[C]instanceof o.default)return w[C].getElementByKey(_);try{for(var T=r(w[C]),I=T.next();!I.done;I=T.next()){var D=I.value;if(D.key===_)return D.value}}catch(B){A={error:B}}finally{try{I&&!I.done&&(x=T.return)&&x.call(T)}finally{if(A)throw A.error}}}},this.eraseElementByKey=function(_){var A,x,C=g(_)&y-1;if(w[C]){var T=w[C].size();if(w[C]instanceof o.default)w[C].eraseElementByKey(_),w[C].size()<=u.untreeifyThreshold&&(w[C]=new l.default(w[C]));else{var I=-1;try{for(var D=r(w[C]),B=D.next();!B.done;B=D.next())if(++I,B.value.key===_){w[C].eraseElementByPos(I);break}}catch(Q){A={error:Q}}finally{try{B&&!B.done&&(x=D.return)&&x.call(D)}finally{if(A)throw A.error}}}var V=w[C].size();m+=V-T}},this.find=function(_){var A,x,C=g(_)&y-1;if(!w[C])return!1;if(w[C]instanceof o.default)return w[C].find(_);try{for(var T=r(w[C]),I=T.next();!I.done;I=T.next())if(I.value.key===_)return!0}catch(D){A={error:D}}finally{try{I&&!I.done&&(x=T.return)&&x.call(T)}finally{if(A)throw A.error}}return!1},this[Symbol.iterator]=function(){return function(){var _,A,x,C,T,I;return n(this,function(D){switch(D.label){case 0:_=0,D.label=1;case 1:if(!(_=y)return[3,10];D.label=2;case 2:D.trys.push([2,7,8,9]),T=void 0,A=r(w[_]),x=A.next(),D.label=3;case 3:return x.done?[3,6]:[4,x.value];case 4:D.sent(),D.label=5;case 5:return x=A.next(),[3,3];case 6:return[3,9];case 7:return C=D.sent(),T={error:C},[3,9];case 8:try{x&&!x.done&&(I=A.return)&&I.call(A)}finally{if(T)throw T.error}return[7];case 9:return++_,[3,1];case 10:return[2]}})}()},c.forEach(function(_){var A=_.key,x=_.value;return v.setElement(A,x)}),Object.freeze(this)}u.initSize=16,u.maxSize=1<<30,u.sigma=.75,u.treeifyThreshold=8,u.untreeifyThreshold=6,u.minTreeifySize=64,Object.freeze(u),s.default=u},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(i,a,s){var n=this&&this.__generator||function(c,f){var g,v,m,w,y={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return w={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function _(A){return function(x){return function(C){if(g)throw new TypeError("Generator is already executing.");for(;y;)try{if(g=1,v&&(m=2&C[0]?v.return:C[0]?v.throw||((m=v.return)&&m.call(v),0):v.next)&&!(m=m.call(v,C[1])).done)return m;switch(v=0,m&&(C=[2&C[0],m.value]),C[0]){case 0:case 1:m=C;break;case 4:return y.label++,{value:C[1],done:!1};case 5:y.label++,v=C[1],C=[0];continue;case 7:C=y.ops.pop(),y.trys.pop();continue;default:if(!(m=(m=y.trys).length>0&&m[m.length-1])&&(C[0]===6||C[0]===2)){y=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]=c.length&&(c=void 0),{value:c&&c[v++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var l=i("../Set/Set"),o=i("../LinkList/LinkList");function u(c,f,g){var v=this;if(c===void 0&&(c=[]),f===void 0&&(f=u.initSize),g=g||function(_){var A=0,x="";if(typeof _=="number")A=((A=Math.floor(_))<<5)-A,A&=A;else{x=typeof _!="string"?JSON.stringify(_):_;for(var C=0;C>>16},(f&f-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var m=0,w=[],y=Math.max(u.initSize,Math.min(u.maxSize,f));this.size=function(){return m},this.empty=function(){return m===0},this.clear=function(){m=0,y=f,w=[]},this.forEach=function(_){var A=0;w.forEach(function(x){x.forEach(function(C){_(C,A++)})})},this.insert=function(_){if(_==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var A=g(_)&y-1;if(w[A]){var x=w[A].size();if(w[A]instanceof o.default){if(w[A].find(_))return;w[A].pushBack(_),w[A].size()>=u.treeifyThreshold&&(w[A]=new l.default(w[A]))}else w[A].insert(_);var C=w[A].size();m+=C-x}else w[A]=new o.default([_]),++m;m>y*u.sigma&&function(T){if(!(T>=u.maxSize)){y=2*T;var I=[];w.forEach(function(D,B){if(!D.empty()){if(D instanceof o.default&&D.size()===1){var V=D.front();if(V===void 0)throw new Error("unknown error");I[g(V)&y-1]=new o.default([V])}else if(D instanceof l.default){var Q=new o.default,F=new o.default;D.forEach(function(M){(g(M)&T)==0?Q.pushBack(M):F.pushBack(M)}),Q.size()>u.untreeifyThreshold?I[B]=new l.default(Q):Q.size()&&(I[B]=Q),F.size()>u.untreeifyThreshold?I[B+T]=new l.default(F):F.size()&&(I[B+T]=F)}else{var R=new o.default,P=new o.default;D.forEach(function(M){(g(M)&T)==0?R.pushBack(M):P.pushBack(M)}),R.size()&&(I[B]=R),P.size()&&(I[B+T]=P)}w[B].clear()}}),w=I}}.call(this,y)},this.eraseElementByValue=function(_){var A=g(_)&y-1;if(w[A]){var x=w[A].size();w[A].eraseElementByValue(_),w[A]instanceof l.default&&w[A].size()<=u.untreeifyThreshold&&(w[A]=new o.default(w[A]));var C=w[A].size();m+=C-x}},this.find=function(_){var A=g(_)&y-1;return!!w[A]&&w[A].find(_)},this[Symbol.iterator]=function(){return function(){var _,A,x,C,T,I;return n(this,function(D){switch(D.label){case 0:_=0,D.label=1;case 1:if(!(_=y)return[3,10];D.label=2;case 2:D.trys.push([2,7,8,9]),T=void 0,A=r(w[_]),x=A.next(),D.label=3;case 3:return x.done?[3,6]:[4,x.value];case 4:D.sent(),D.label=5;case 5:return x=A.next(),[3,3];case 6:return[3,9];case 7:return C=D.sent(),T={error:C},[3,9];case 8:try{x&&!x.done&&(I=A.return)&&I.call(A)}finally{if(T)throw T.error}return[7];case 9:return++_,[3,1];case 10:return[2]}})}()},c.forEach(function(_){return v.insert(_)}),Object.freeze(this)}u.initSize=16,u.maxSize=1<<30,u.sigma=.75,u.treeifyThreshold=8,u.untreeifyThreshold=6,u.minTreeifySize=64,Object.freeze(u),s.default=u},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(i,a,s){var n=this&&this.__generator||function(o,u){var c,f,g,v,m={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return v={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function w(y){return function(_){return function(A){if(c)throw new TypeError("Generator is already executing.");for(;m;)try{if(c=1,f&&(g=2&A[0]?f.return:A[0]?f.throw||((g=f.return)&&g.call(f),0):f.next)&&!(g=g.call(f,A[1])).done)return g;switch(f=0,g&&(A=[2&A[0],g.value]),A[0]){case 0:case 1:g=A;break;case 4:return m.label++,{value:A[1],done:!1};case 5:m.label++,f=A[1],A=[0];continue;case 7:A=m.ops.pop(),m.trys.pop();continue;default:if(!(g=(g=m.trys).length>0&&g[g.length-1])&&(A[0]===6||A[0]===2)){m=0;continue}if(A[0]===3&&(!g||A[1]>g[0]&&A[1]=c)throw new Error("pos must more then 0 and less then the list length");for(var m=f;v--&&m;)m=m.next;if(!m||m.value===void 0)throw new Error("unknown error");return m.value},this.eraseElementByPos=function(v){if(v<0||v>=c)throw new Error("erase pos must more then 0 and less then the list length");if(v===0)this.popFront();else if(v===c-1)this.popBack();else{for(var m=f;v--;){if(!(m!=null&&m.next))throw new Error("unknown error");m=m.next}if(!m||!m.pre||!m.next)throw new Error("unknown error");var w=m.pre,y=m.next;y.pre=w,w.next=y,c>0&&--c}},this.eraseElementByValue=function(v){for(;f&&f.value===v;)this.popFront();for(;g&&g.value===v;)this.popBack();if(f)for(var m=f;m;){if(m.value===v){var w=m.pre,y=m.next;y&&(y.pre=w),w&&(w.next=y),c>0&&--c}m=m.next}},this.pushBack=function(v){if(v==null)throw new Error("you can't push null or undefined here");++c;var m=new r(v);g?(g.next=m,m.pre=g,g=m):f=g=m},this.popBack=function(){g&&(c>0&&--c,g&&(f===g?f=g=void 0:(g=g.pre)&&(g.next=void 0)))},this.setElementByPos=function(v,m){if(m==null)throw new Error("you can't set null or undefined here");if(v<0||v>=c)throw new Error("pos must more then 0 and less then the list length");for(var w=f;v--;){if(!w)throw new Error("unknown error");w=w.next}w&&(w.value=m)},this.insert=function(v,m,w){if(w===void 0&&(w=1),m==null)throw new Error("you can't insert null or undefined here");if(v<0||v>c)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(w<0)throw new Error("insert size must more than 0");if(v===0)for(;w--;)this.pushFront(m);else if(v===c)for(;w--;)this.pushBack(m);else{for(var y=f,_=1;_0&&--c;v.next=m.next,v.next&&(v.next.pre=v),v=v.next}},this.sort=function(v){var m=[];this.forEach(function(y){m.push(y)}),m.sort(v);var w=f;m.forEach(function(y){w&&(w.value=y,w=w.next)})},this.pushFront=function(v){if(v==null)throw new Error("you can't push null or undefined here");++c;var m=new r(v);f?(m.next=f,f.pre=m,f=m):f=g=m},this.popFront=function(){f&&(c>0&&--c,f&&(f===g?f=g=void 0:(f=f.next)&&(f.pre=void 0)))},this.merge=function(v){var m=this,w=f;v.forEach(function(y){for(;w&&w.value!==void 0&&w.value<=y;)w=w.next;if(w===void 0)m.pushBack(y),w=g;else if(w===f)m.pushFront(y),w=f;else{++c;var _=w.pre;_&&(_.next=new r(y),_.next.pre=_,_.next.next=w,w&&(w.pre=_.next))}})},this[Symbol.iterator]=function(){return function(){var v;return n(this,function(m){switch(m.label){case 0:v=f,m.label=1;case 1:if(v===void 0)return[3,3];if(!v.value)throw new Error("unknown error");return[4,v.value];case 2:return m.sent(),v=v.next,[3,1];case 3:return[2]}})}()},o.forEach(function(v){return u.pushBack(v)}),Object.freeze(this)}Object.freeze(l),s.default=l},{}],30:[function(i,a,s){var n=this&&this.__generator||function(u,c){var f,g,v,m,w={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return m={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function y(_){return function(A){return function(x){if(f)throw new TypeError("Generator is already executing.");for(;w;)try{if(f=1,g&&(v=2&x[0]?g.return:x[0]?g.throw||((v=g.return)&&v.call(g),0):g.next)&&!(v=v.call(g,x[1])).done)return v;switch(g=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return w.label++,{value:x[1],done:!1};case 5:w.label++,g=x[1],x=[0];continue;case 7:x=w.ops.pop(),w.trys.pop();continue;default:if(!(v=(v=w.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){w=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]=u.length&&(u=void 0),{value:u&&u[g++],done:!u}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var l=i("../Base/TreeNode");function o(u,c){var f=this;u===void 0&&(u=[]),c=c||function(F,R){return FR?1:0};var g=0,v=new l.default;v.color=l.default.TreeNodeColorType.black,this.size=function(){return g},this.empty=function(){return g===0},this.clear=function(){g=0,v.key=v.value=void 0,v.leftChild=v.rightChild=v.brother=void 0};var m=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.leftChild?m(F.leftChild):F},w=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.rightChild?w(F.rightChild):F};this.front=function(){if(!this.empty()){var F=m(v);if(F.key===void 0||F.value===void 0)throw new Error("unknown error");return{key:F.key,value:F.value}}},this.back=function(){if(!this.empty()){var F=w(v);if(F.key===void 0||F.value===void 0)throw new Error("unknown error");return{key:F.key,value:F.value}}},this.forEach=function(F){var R,P,M=0;try{for(var Y=r(this),Z=Y.next();!Z.done;Z=Y.next())F(Z.value,M++)}catch(nt){R={error:nt}}finally{try{Z&&!Z.done&&(P=Y.return)&&P.call(Y)}finally{if(R)throw R.error}}},this.getElementByPos=function(F){var R,P;if(F<0||F>=this.size())throw new Error("pos must more than 0 and less than set's size");var M=0;try{for(var Y=r(this),Z=Y.next();!Z.done;Z=Y.next()){var nt=Z.value;if(M===F)return nt;++M}}catch(j){R={error:j}}finally{try{Z&&!Z.done&&(P=Y.return)&&P.call(Y)}finally{if(R)throw R.error}}throw new Error("unknown Error")};var y=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0){var P=c(F.key,R);return P===0?{key:F.key,value:F.value}:P<0?y(F.rightChild,R):y(F.leftChild,R)||{key:F.key,value:F.value}}};this.lowerBound=function(F){return y(v,F)};var _=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0)return c(F.key,R)<=0?_(F.rightChild,R):_(F.leftChild,R)||{key:F.key,value:F.value}};this.upperBound=function(F){return _(v,F)};var A=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0){var P=c(F.key,R);return P===0?{key:F.key,value:F.value}:P>0?A(F.leftChild,R):A(F.rightChild,R)||{key:F.key,value:F.value}}};this.reverseLowerBound=function(F){return A(v,F)};var x=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0)return c(F.key,R)>=0?x(F.leftChild,R):x(F.rightChild,R)||{key:F.key,value:F.value}};this.reverseUpperBound=function(F){return x(v,F)};var C=function(F){var R=F.parent;if(!R){if(F===v)return;throw new Error("unknown error")}if(F.color!==l.default.TreeNodeColorType.red){var P=F.brother;if(!P)throw new Error("unknown error");if(F===R.leftChild)if(P.color===l.default.TreeNodeColorType.red){P.color=l.default.TreeNodeColorType.black,R.color=l.default.TreeNodeColorType.red;var M=R.rotateLeft();v===R&&(v=M),C(F)}else P.color===l.default.TreeNodeColorType.black&&(P.rightChild&&P.rightChild.color===l.default.TreeNodeColorType.red?(P.color=R.color,R.color=l.default.TreeNodeColorType.black,P.rightChild&&(P.rightChild.color=l.default.TreeNodeColorType.black),M=R.rotateLeft(),v===R&&(v=M),F.color=l.default.TreeNodeColorType.black):P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||!P.leftChild||P.leftChild.color!==l.default.TreeNodeColorType.red?P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||(P.color=l.default.TreeNodeColorType.red,C(R)):(P.color=l.default.TreeNodeColorType.red,P.leftChild&&(P.leftChild.color=l.default.TreeNodeColorType.black),M=P.rotateRight(),v===P&&(v=M),C(F)));else F===R.rightChild&&(P.color===l.default.TreeNodeColorType.red?(P.color=l.default.TreeNodeColorType.black,R.color=l.default.TreeNodeColorType.red,M=R.rotateRight(),v===R&&(v=M),C(F)):P.color===l.default.TreeNodeColorType.black&&(P.leftChild&&P.leftChild.color===l.default.TreeNodeColorType.red?(P.color=R.color,R.color=l.default.TreeNodeColorType.black,P.leftChild&&(P.leftChild.color=l.default.TreeNodeColorType.black),M=R.rotateRight(),v===R&&(v=M),F.color=l.default.TreeNodeColorType.black):P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||!P.rightChild||P.rightChild.color!==l.default.TreeNodeColorType.red?P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||(P.color=l.default.TreeNodeColorType.red,C(R)):(P.color=l.default.TreeNodeColorType.red,P.rightChild&&(P.rightChild.color=l.default.TreeNodeColorType.black),M=P.rotateLeft(),v===P&&(v=M),C(F))))}else F.color=l.default.TreeNodeColorType.black},T=function(F){for(var R=F;R.leftChild||R.rightChild;){if(R.rightChild){R=m(R.rightChild);var P=F.key;F.key=R.key,R.key=P;var M=F.value;F.value=R.value,R.value=M,F=R}R.leftChild&&(R=w(R.leftChild),P=F.key,F.key=R.key,R.key=P,M=F.value,F.value=R.value,R.value=M,F=R)}C(R),R&&R.remove(),--g,v.color=l.default.TreeNodeColorType.black},I=function(F,R){return!(!F||F.key===void 0)&&(!!I(F.leftChild,R)||!!R(F)||I(F.rightChild,R))};this.eraseElementByPos=function(F){if(F<0||F>=g)throw new Error("pos must more than 0 and less than set's size");var R=0;I(v,function(P){return F===R?(T(P),!0):(++R,!1)})},this.eraseElementByKey=function(F){if(!this.empty()){var R=V(v,F);R!==void 0&&R.key!==void 0&&c(R.key,F)===0&&T(R)}};var D=function(F,R){if(!F||F.key===void 0)throw new Error("unknown error");var P=c(R,F.key);return P<0?F.leftChild?D(F.leftChild,R):(F.leftChild=new l.default,F.leftChild.parent=F,F.leftChild.brother=F.rightChild,F.rightChild&&(F.rightChild.brother=F.leftChild),F.leftChild):P>0?F.rightChild?D(F.rightChild,R):(F.rightChild=new l.default,F.rightChild.parent=F,F.rightChild.brother=F.leftChild,F.leftChild&&(F.leftChild.brother=F.rightChild),F.rightChild):F},B=function(F){var R=F.parent;if(!R){if(F===v)return;throw new Error("unknown error")}if(R.color!==l.default.TreeNodeColorType.black&&R.color===l.default.TreeNodeColorType.red){var P=R.brother,M=R.parent;if(!M)throw new Error("unknown error");if(P&&P.color===l.default.TreeNodeColorType.red)P.color=R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red,B(M);else if(!P||P.color===l.default.TreeNodeColorType.black)if(R===M.leftChild)if(F===R.leftChild){R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red;var Y=M.rotateRight();M===v&&(v=Y)}else F===R.rightChild&&(Y=R.rotateLeft(),M===v&&(v=Y),B(R));else R===M.rightChild&&(F===R.leftChild?(Y=R.rotateRight(),M===v&&(v=Y),B(R)):F===R.rightChild&&(R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red,Y=M.rotateLeft(),M===v&&(v=Y)))}};this.setElement=function(F,R){if(F==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(R!=null){if(this.empty())return++g,v.key=F,v.value=R,void(v.color=l.default.TreeNodeColorType.black);var P=D(v,F);P.key===void 0||c(P.key,F)!==0?(++g,P.key=F,P.value=R,B(P),v.color=l.default.TreeNodeColorType.black):P.value=R}else this.eraseElementByKey(F)};var V=function(F,R){if(F&&F.key!==void 0){var P=c(R,F.key);return P<0?V(F.leftChild,R):P>0?V(F.rightChild,R):F}};this.find=function(F){return!!V(v,F)},this.getElementByKey=function(F){var R=V(v,F);if((R==null?void 0:R.key)===void 0||(R==null?void 0:R.value)===void 0)throw new Error("unknown error");return R.value},this.union=function(F){var R=this;F.forEach(function(P){var M=P.key,Y=P.value;return R.setElement(M,Y)})},this.getHeight=function(){if(this.empty())return 0;var F=function(R){return R?Math.max(F(R.leftChild),F(R.rightChild))+1:1};return F(v)};var Q=function(F){return n(this,function(R){switch(R.label){case 0:return F&&F.key!==void 0&&F.value!==void 0?[5,r(Q(F.leftChild))]:[2];case 1:return R.sent(),[4,{key:F.key,value:F.value}];case 2:return R.sent(),[5,r(Q(F.rightChild))];case 3:return R.sent(),[2]}})};this[Symbol.iterator]=function(){return Q(v)},u.forEach(function(F){var R=F.key,P=F.value;return f.setElement(R,P)}),Object.freeze(this)}Object.freeze(o),s.default=o},{"../Base/TreeNode":25}],31:[function(i,a,s){function n(r,l){r===void 0&&(r=[]),l=l||function(g,v){return g>v?-1:g=u)throw new Error("unknown error");if(v<0||v>=u)throw new Error("unknown error");var m=o[g];o[g]=o[v],o[v]=m},f=function(g){if(g<0||g>=u)throw new Error("unknown error");var v=2*g+1,m=2*g+2;v0&&c(g,v),m0&&c(g,m)};(function(){for(var g=Math.floor((u-1)/2);g>=0;--g)for(var v=g,m=2*v+1;m0&&(y=w),l(o[v],o[y])<=0)break;c(v,y),m=2*(v=y)+1}})(),this.size=function(){return u},this.empty=function(){return u===0},this.clear=function(){u=0,o.length=0},this.push=function(g){if(o.push(g),++u!==1)for(var v=u-1;v>0;){var m=Math.floor((v-1)/2);if(l(o[m],g)<=0)break;f(m),v=m}},this.pop=function(){if(!this.empty())if(this.size()!==1){var g=o[u-1];--u;for(var v=0;v=this.size())break;var y=m;if(w0&&(y=w),l(o[y],g)>=0)break;o[v]=o[y],v=y}o[v]=g}else--u},this.top=function(){return o[0]},Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),Object.freeze(n),s.default=n},{}],32:[function(i,a,s){Object.defineProperty(s,"__esModule",{value:!0});var n=i("../LinkList/LinkList");function r(l){l===void 0&&(l=[]);var o=new n.default(l);this.size=function(){return o.size()},this.empty=function(){return o.empty()},this.clear=function(){o.clear()},this.push=function(u){o.pushBack(u)},this.pop=function(){o.popFront()},this.front=function(){return o.front()},Object.freeze(this)}Object.freeze(r),s.default=r},{"../LinkList/LinkList":29}],33:[function(i,a,s){var n=this&&this.__generator||function(u,c){var f,g,v,m,w={label:0,sent:function(){if(1&v[0])throw v[1];return v[1]},trys:[],ops:[]};return m={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function y(_){return function(A){return function(x){if(f)throw new TypeError("Generator is already executing.");for(;w;)try{if(f=1,g&&(v=2&x[0]?g.return:x[0]?g.throw||((v=g.return)&&v.call(g),0):g.next)&&!(v=v.call(g,x[1])).done)return v;switch(g=0,v&&(x=[2&x[0],v.value]),x[0]){case 0:case 1:v=x;break;case 4:return w.label++,{value:x[1],done:!1};case 5:w.label++,g=x[1],x=[0];continue;case 7:x=w.ops.pop(),w.trys.pop();continue;default:if(!(v=(v=w.trys).length>0&&v[v.length-1])&&(x[0]===6||x[0]===2)){w=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]=u.length&&(u=void 0),{value:u&&u[g++],done:!u}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var l=i("../Base/TreeNode");function o(u,c){var f=this;u===void 0&&(u=[]),c=c||function(F,R){return FR?1:0};var g=0,v=new l.default;v.color=l.default.TreeNodeColorType.black,this.size=function(){return g},this.empty=function(){return g===0},this.clear=function(){g=0,v.key=void 0,v.leftChild=v.rightChild=v.brother=v.parent=void 0,v.color=l.default.TreeNodeColorType.black};var m=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.leftChild?m(F.leftChild):F},w=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.rightChild?w(F.rightChild):F};this.front=function(){if(!this.empty())return m(v).key},this.back=function(){if(!this.empty())return w(v).key},this.forEach=function(F){var R,P,M=0;try{for(var Y=r(this),Z=Y.next();!Z.done;Z=Y.next())F(Z.value,M++)}catch(nt){R={error:nt}}finally{try{Z&&!Z.done&&(P=Y.return)&&P.call(Y)}finally{if(R)throw R.error}}},this.getElementByPos=function(F){var R,P;if(F<0||F>=this.size())throw new Error("pos must more than 0 and less than set's size");var M=0;try{for(var Y=r(this),Z=Y.next();!Z.done;Z=Y.next()){var nt=Z.value;if(M===F)return nt;++M}}catch(j){R={error:j}}finally{try{Z&&!Z.done&&(P=Y.return)&&P.call(Y)}finally{if(R)throw R.error}}throw new Error("unknown error")};var y=function(F){var R=F.parent;if(!R){if(F===v)return;throw new Error("unknown error")}if(F.color!==l.default.TreeNodeColorType.red){var P=F.brother;if(!P)throw new Error("unknown error");if(F===R.leftChild)if(P.color===l.default.TreeNodeColorType.red){P.color=l.default.TreeNodeColorType.black,R.color=l.default.TreeNodeColorType.red;var M=R.rotateLeft();v===R&&(v=M),y(F)}else P.color===l.default.TreeNodeColorType.black&&(P.rightChild&&P.rightChild.color===l.default.TreeNodeColorType.red?(P.color=R.color,R.color=l.default.TreeNodeColorType.black,P.rightChild&&(P.rightChild.color=l.default.TreeNodeColorType.black),M=R.rotateLeft(),v===R&&(v=M),F.color=l.default.TreeNodeColorType.black):P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||!P.leftChild||P.leftChild.color!==l.default.TreeNodeColorType.red?P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||(P.color=l.default.TreeNodeColorType.red,y(R)):(P.color=l.default.TreeNodeColorType.red,P.leftChild&&(P.leftChild.color=l.default.TreeNodeColorType.black),M=P.rotateRight(),v===P&&(v=M),y(F)));else F===R.rightChild&&(P.color===l.default.TreeNodeColorType.red?(P.color=l.default.TreeNodeColorType.black,R.color=l.default.TreeNodeColorType.red,M=R.rotateRight(),v===R&&(v=M),y(F)):P.color===l.default.TreeNodeColorType.black&&(P.leftChild&&P.leftChild.color===l.default.TreeNodeColorType.red?(P.color=R.color,R.color=l.default.TreeNodeColorType.black,P.leftChild&&(P.leftChild.color=l.default.TreeNodeColorType.black),M=R.rotateRight(),v===R&&(v=M),F.color=l.default.TreeNodeColorType.black):P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||!P.rightChild||P.rightChild.color!==l.default.TreeNodeColorType.red?P.leftChild&&P.leftChild.color!==l.default.TreeNodeColorType.black||P.rightChild&&P.rightChild.color!==l.default.TreeNodeColorType.black||(P.color=l.default.TreeNodeColorType.red,y(R)):(P.color=l.default.TreeNodeColorType.red,P.rightChild&&(P.rightChild.color=l.default.TreeNodeColorType.black),M=P.rotateLeft(),v===P&&(v=M),y(F))))}else F.color=l.default.TreeNodeColorType.black},_=function(F){for(var R=F;R.leftChild||R.rightChild;){if(R.rightChild){R=m(R.rightChild);var P=F.key;F.key=R.key,R.key=P,F=R}R.leftChild&&(R=w(R.leftChild),P=F.key,F.key=R.key,R.key=P,F=R)}y(R),R&&R.remove(),--g,v.color=l.default.TreeNodeColorType.black},A=function(F,R){return!(!F||F.key===void 0)&&(!!A(F.leftChild,R)||!!R(F)||A(F.rightChild,R))};this.eraseElementByPos=function(F){if(F<0||F>=g)throw new Error("pos must more than 0 and less than set's size");var R=0;A(v,function(P){return F===R?(_(P),!0):(++R,!1)})},this.eraseElementByValue=function(F){if(!this.empty()){var R=T(v,F);R!==void 0&&R.key!==void 0&&c(R.key,F)===0&&_(R)}};var x=function(F,R){if(!F||F.key===void 0)throw new Error("unknown error");var P=c(R,F.key);return P<0?F.leftChild?x(F.leftChild,R):(F.leftChild=new l.default,F.leftChild.parent=F,F.leftChild.brother=F.rightChild,F.rightChild&&(F.rightChild.brother=F.leftChild),F.leftChild):P>0?F.rightChild?x(F.rightChild,R):(F.rightChild=new l.default,F.rightChild.parent=F,F.rightChild.brother=F.leftChild,F.leftChild&&(F.leftChild.brother=F.rightChild),F.rightChild):F},C=function(F){var R=F.parent;if(!R){if(F===v)return;throw new Error("unknown error")}if(R.color!==l.default.TreeNodeColorType.black&&R.color===l.default.TreeNodeColorType.red){var P=R.brother,M=R.parent;if(!M)throw new Error("unknown error");if(P&&P.color===l.default.TreeNodeColorType.red)P.color=R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red,C(M);else if(!P||P.color===l.default.TreeNodeColorType.black)if(R===M.leftChild)if(F===R.leftChild){R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red;var Y=M.rotateRight();M===v&&(v=Y)}else F===R.rightChild&&(Y=R.rotateLeft(),M===v&&(v=Y),C(R));else R===M.rightChild&&(F===R.leftChild?(Y=R.rotateRight(),M===v&&(v=Y),C(R)):F===R.rightChild&&(R.color=l.default.TreeNodeColorType.black,M.color=l.default.TreeNodeColorType.red,Y=M.rotateLeft(),M===v&&(v=Y)))}};this.insert=function(F){if(F==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++g,v.key=F,void(v.color=l.default.TreeNodeColorType.black);var R=x(v,F);R.key!==void 0&&c(R.key,F)===0||(++g,R.key=F,C(R),v.color=l.default.TreeNodeColorType.black)};var T=function(F,R){if(F&&F.key!==void 0){var P=c(R,F.key);return P<0?T(F.leftChild,R):P>0?T(F.rightChild,R):F}};this.find=function(F){var R=T(v,F);return R!==void 0&&R.key!==void 0&&c(R.key,F)===0};var I=function(F,R){if(F&&F.key!==void 0){var P=c(F.key,R);if(P===0)return F.key;if(P<0)return I(F.rightChild,R);var M=I(F.leftChild,R);return M!==void 0?M:F.key}};this.lowerBound=function(F){return I(v,F)};var D=function(F,R){if(F&&F.key!==void 0){if(c(F.key,R)<=0)return D(F.rightChild,R);var P=D(F.leftChild,R);return P!==void 0?P:F.key}};this.upperBound=function(F){return D(v,F)};var B=function(F,R){if(F&&F.key!==void 0){var P=c(F.key,R);if(P===0)return F.key;if(P>0)return B(F.leftChild,R);var M=B(F.rightChild,R);return M!==void 0?M:F.key}};this.reverseLowerBound=function(F){return B(v,F)};var V=function(F,R){if(F&&F.key!==void 0){if(c(F.key,R)>=0)return V(F.leftChild,R);var P=V(F.rightChild,R);return P!==void 0?P:F.key}};this.reverseUpperBound=function(F){return V(v,F)},this.union=function(F){var R=this;F.forEach(function(P){return R.insert(P)})},this.getHeight=function(){if(this.empty())return 0;var F=function(R){return R?Math.max(F(R.leftChild),F(R.rightChild))+1:1};return F(v)};var Q=function(F){return n(this,function(R){switch(R.label){case 0:return F&&F.key!==void 0?[5,r(Q(F.leftChild))]:[2];case 1:return R.sent(),[4,F.key];case 2:return R.sent(),[5,r(Q(F.rightChild))];case 3:return R.sent(),[2]}})};this[Symbol.iterator]=function(){return Q(v)},u.forEach(function(F){return f.insert(F)}),Object.freeze(this)}Object.freeze(o),s.default=o},{"../Base/TreeNode":25}],34:[function(i,a,s){function n(r){var l=this;r===void 0&&(r=[]);var o=0,u=[];this.size=function(){return o},this.empty=function(){return o===0},this.clear=function(){o=0,u.length=0},this.push=function(c){u.push(c),++o},this.pop=function(){u.pop(),o>0&&--o},this.top=function(){return u[o-1]},r.forEach(function(c){return l.push(c)}),Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),Object.freeze(n),s.default=n},{}],35:[function(i,a,s){var n=this&&this.__generator||function(c,f){var g,v,m,w,y={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return w={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(w[Symbol.iterator]=function(){return this}),w;function _(A){return function(x){return function(C){if(g)throw new TypeError("Generator is already executing.");for(;y;)try{if(g=1,v&&(m=2&C[0]?v.return:C[0]?v.throw||((m=v.return)&&m.call(v),0):v.next)&&!(m=m.call(v,C[1])).done)return m;switch(v=0,m&&(C=[2&C[0],m.value]),C[0]){case 0:case 1:m=C;break;case 4:return y.label++,{value:C[1],done:!1};case 5:y.label++,v=C[1],C=[0];continue;case 7:C=y.ops.pop(),y.trys.pop();continue;default:if(!(m=(m=y.trys).length>0&&m[m.length-1])&&(C[0]===6||C[0]===2)){y=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]0)&&!(v=w.next()).done;)y.push(v.value)}catch(_){m={error:_}}finally{try{v&&!v.done&&(g=w.return)&&g.call(w)}finally{if(m)throw m.error}}return y},l=this&&this.__spreadArray||function(c,f,g){if(g||arguments.length===2)for(var v,m=0,w=f.length;m=c.length&&(c=void 0),{value:c&&c[v++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")};function u(c){var f=this;c===void 0&&(c=[]);var g=0,v=[];this.size=function(){return g},this.empty=function(){return g===0},this.clear=function(){g=0,v.length=0},this.front=function(){if(!this.empty())return v[0]},this.back=function(){if(!this.empty())return v[g-1]},this.forEach=function(m){v.forEach(m)},this.getElementByPos=function(m){if(m<0||m>=g)throw new Error("pos must more than 0 and less than vector's size");return v[m]},this.eraseElementByPos=function(m){if(m<0||m>=g)throw new Error("pos must more than 0 and less than vector's size");for(var w=m;wy;)this.popBack()},this.pushBack=function(m){v.push(m),++g},this.popBack=function(){v.pop(),g>0&&--g},this.setElementByPos=function(m,w){if(m<0||m>=g)throw new Error("pos must more than 0 and less than vector's size");v[m]=w},this.insert=function(m,w,y){if(y===void 0&&(y=1),m<0||m>g)throw new Error("pos must more than 0 and less than or equal to vector's size");v.splice.apply(v,l([m,0],r(new Array(y).fill(w)),!1)),g+=y},this.find=function(m){return v.includes(m)},this.reverse=function(){v.reverse()},this.unique=function(){var m,w=[];this.forEach(function(_,A){A!==0&&_===m||(w.push(_),m=_)}),w.forEach(function(_,A){v[A]=_});for(var y=w.length;g>y;)this.popBack()},this.sort=function(m){v.sort(m)},this[Symbol.iterator]=function(){return function(){return n(this,function(m){switch(m.label){case 0:return[5,o(v)];case 1:return[2,m.sent()]}})}()},c.forEach(function(m){return f.pushBack(m)}),Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),Object.freeze(u),s.default=u},{}],36:[function(i,a,s){Object.defineProperty(s,"__esModule",{value:!0}),s.HashMap=s.HashSet=s.Map=s.Set=s.PriorityQueue=s.Deque=s.LinkList=s.Queue=s.Stack=s.Vector=void 0;var n=i("./Vector/Vector");s.Vector=n.default;var r=i("./Stack/Stack");s.Stack=r.default;var l=i("./Queue/Queue");s.Queue=l.default;var o=i("./LinkList/LinkList");s.LinkList=o.default;var u=i("./Deque/Deque");s.Deque=u.default;var c=i("./PriorityQueue/PriorityQueue");s.PriorityQueue=c.default;var f=i("./Set/Set");s.Set=f.default;var g=i("./Map/Map");s.Map=g.default;var v=i("./HashSet/HashSet");s.HashSet=v.default;var m=i("./HashMap/HashMap");s.HashMap=m.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(i,a,s){const n=i("yallist"),r=Symbol("max"),l=Symbol("length"),o=Symbol("lengthCalculator"),u=Symbol("allowStale"),c=Symbol("maxAge"),f=Symbol("dispose"),g=Symbol("noDisposeOnSet"),v=Symbol("lruList"),m=Symbol("cache"),w=Symbol("updateAgeOnGet"),y=()=>1,_=(D,B,V)=>{const Q=D[m].get(B);if(Q){const F=Q.value;if(A(D,F)){if(C(D,Q),!D[u])return}else V&&(D[w]&&(Q.value.now=Date.now()),D[v].unshiftNode(Q));return F.value}},A=(D,B)=>{if(!B||!B.maxAge&&!D[c])return!1;const V=Date.now()-B.now;return B.maxAge?V>B.maxAge:D[c]&&V>D[c]},x=D=>{if(D[l]>D[r])for(let B=D[v].tail;D[l]>D[r]&&B!==null;){const V=B.prev;C(D,B),B=V}},C=(D,B)=>{if(B){const V=B.value;D[f]&&D[f](V.key,V.value),D[l]-=V.length,D[m].delete(V.key),D[v].removeNode(B)}};class T{constructor(B,V,Q,F,R){this.key=B,this.value=V,this.length=Q,this.now=F,this.maxAge=R||0}}const I=(D,B,V,Q)=>{let F=V.value;A(D,F)&&(C(D,V),D[u]||(F=void 0)),F&&B.call(Q,F.value,F.key,D)};a.exports=class{constructor(D){if(typeof D=="number"&&(D={max:D}),D||(D={}),D.max&&(typeof D.max!="number"||D.max<0))throw new TypeError("max must be a non-negative number");this[r]=D.max||1/0;const B=D.length||y;if(this[o]=typeof B!="function"?y:B,this[u]=D.stale||!1,D.maxAge&&typeof D.maxAge!="number")throw new TypeError("maxAge must be a number");this[c]=D.maxAge||0,this[f]=D.dispose,this[g]=D.noDisposeOnSet||!1,this[w]=D.updateAgeOnGet||!1,this.reset()}set max(D){if(typeof D!="number"||D<0)throw new TypeError("max must be a non-negative number");this[r]=D||1/0,x(this)}get max(){return this[r]}set allowStale(D){this[u]=!!D}get allowStale(){return this[u]}set maxAge(D){if(typeof D!="number")throw new TypeError("maxAge must be a non-negative number");this[c]=D,x(this)}get maxAge(){return this[c]}set lengthCalculator(D){typeof D!="function"&&(D=y),D!==this[o]&&(this[o]=D,this[l]=0,this[v].forEach(B=>{B.length=this[o](B.value,B.key),this[l]+=B.length})),x(this)}get lengthCalculator(){return this[o]}get length(){return this[l]}get itemCount(){return this[v].length}rforEach(D,B){B=B||this;for(let V=this[v].tail;V!==null;){const Q=V.prev;I(this,D,V,B),V=Q}}forEach(D,B){B=B||this;for(let V=this[v].head;V!==null;){const Q=V.next;I(this,D,V,B),V=Q}}keys(){return this[v].toArray().map(D=>D.key)}values(){return this[v].toArray().map(D=>D.value)}reset(){this[f]&&this[v]&&this[v].length&&this[v].forEach(D=>this[f](D.key,D.value)),this[m]=new Map,this[v]=new n,this[l]=0}dump(){return this[v].map(D=>!A(this,D)&&{k:D.key,v:D.value,e:D.now+(D.maxAge||0)}).toArray().filter(D=>D)}dumpLru(){return this[v]}set(D,B,V){if((V=V||this[c])&&typeof V!="number")throw new TypeError("maxAge must be a number");const Q=V?Date.now():0,F=this[o](B,D);if(this[m].has(D)){if(F>this[r])return C(this,this[m].get(D)),!1;const P=this[m].get(D).value;return this[f]&&(this[g]||this[f](D,P.value)),P.now=Q,P.maxAge=V,P.value=B,this[l]+=F-P.length,P.length=F,this.get(D),x(this),!0}const R=new T(D,B,F,Q,V);return R.length>this[r]?(this[f]&&this[f](D,B),!1):(this[l]+=R.length,this[v].unshift(R),this[m].set(D,this[v].head),x(this),!0)}has(D){if(!this[m].has(D))return!1;const B=this[m].get(D).value;return!A(this,B)}get(D){return _(this,D,!0)}peek(D){return _(this,D,!1)}pop(){const D=this[v].tail;return D?(C(this,D),D.value):null}del(D){C(this,this[m].get(D))}load(D){this.reset();const B=Date.now();for(let V=D.length-1;V>=0;V--){const Q=D[V],F=Q.e||0;if(F===0)this.set(Q.k,Q.v);else{const R=F-B;R>0&&this.set(Q.k,Q.v,R)}}}prune(){this[m].forEach((D,B)=>_(this,B,!1))}}},{yallist:83}],38:[function(i,a,s){(function(n){(function(){const r=a.exports;r.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},r.codes={};for(const o in r.types){const u=r.types[o];r.codes[u]=o}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=n.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=n.from([r.codes.connack<[0,1].map(c=>[0,1].map(f=>{const g=n.alloc(1);return g.writeUInt8(r.codes[o]<n.from([o])),r.EMPTY={pingreq:n.from([r.codes.pingreq<<4,0]),pingresp:n.from([r.codes.pingresp<<4,0]),disconnect:n.from([r.codes.disconnect<<4,0])}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],39:[function(i,a,s){(function(n){(function(){const r=i("./writeToStream"),l=i("events");class o extends l{constructor(){super(),this._array=new Array(20),this._i=0}write(c){return this._array[this._i++]=c,!0}concat(){let c=0;const f=new Array(this._array.length),g=this._array;let v,m=0;for(v=0;v>8,0),f.writeUInt8(255&c,1),f}a.exports={cache:l,generateCache:function(){for(let c=0;c<65536;c++)l[c]=u(c)},generateNumber:u,genBufVariableByteInt:function(c){let f=0,g=0;const v=n.allocUnsafe(4);do f=c%128|0,(c=c/128|0)>0&&(f|=128),v.writeUInt8(f,g++);while(c>0&&g<4);return c>0&&(g=0),o?v.subarray(0,g):v.slice(0,g)},generate4ByteBuffer:function(c){const f=n.allocUnsafe(4);return f.writeUInt32BE(c,0),f}}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],42:[function(i,a,s){a.exports=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},{}],43:[function(i,a,s){const n=i("bl"),r=i("events"),l=i("./packet"),o=i("./constants"),u=i("debug")("mqtt-packet:parser");class c extends r{constructor(){super(),this.parser=this.constructor.parser}static parser(g){return this instanceof c?(this.settings=g||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new c().parser(g)}_resetState(){u("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new l,this.error=null,this._list=n(),this._stateCounter=0}parse(g){for(this.error&&this._resetState(),this._list.append(g),u("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,u("parse: state complete. _stateCounter is now: %d",this._stateCounter),u("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return u("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const g=this._list.readUInt8(0);return this.packet.cmd=o.types[g>>o.CMD_SHIFT],this.packet.retain=(g&o.RETAIN_MASK)!=0,this.packet.qos=g>>o.QOS_SHIFT&o.QOS_MASK,this.packet.dup=(g&o.DUP_MASK)!=0,u("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const g=this._parseVarByteNum(!0);return g&&(this.packet.length=g.value,this._list.consume(g.bytes)),u("_parseLength %d",g.value),!!g}_parsePayload(){u("_parsePayload: payload %O",this._list);let g=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}g=!0}return u("_parsePayload complete result: %s",g),g}_parseConnect(){let g,v,m,w;u("_parseConnect");const y={},_=this.packet,A=this._parseString();if(A===null)return this._emitError(new Error("Cannot parse protocolId"));if(A!=="MQTT"&&A!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(_.protocolId=A,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(_.protocolVersion=this._list.readUInt8(this._pos),_.protocolVersion>=128&&(_.bridgeMode=!0,_.protocolVersion=_.protocolVersion-128),_.protocolVersion!==3&&_.protocolVersion!==4&&_.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(y.username=this._list.readUInt8(this._pos)&o.USERNAME_MASK,y.password=this._list.readUInt8(this._pos)&o.PASSWORD_MASK,y.will=this._list.readUInt8(this._pos)&o.WILL_FLAG_MASK,y.will&&(_.will={},_.will.retain=(this._list.readUInt8(this._pos)&o.WILL_RETAIN_MASK)!=0,_.will.qos=(this._list.readUInt8(this._pos)&o.WILL_QOS_MASK)>>o.WILL_QOS_SHIFT),_.clean=(this._list.readUInt8(this._pos)&o.CLEAN_SESSION_MASK)!=0,this._pos++,_.keepalive=this._parseNum(),_.keepalive===-1)return this._emitError(new Error("Packet too short"));if(_.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(_.properties=C)}const x=this._parseString();if(x===null)return this._emitError(new Error("Packet too short"));if(_.clientId=x,u("_parseConnect: packet.clientId: %s",_.clientId),y.will){if(_.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(_.will.properties=C)}if((g=this._parseString())===null)return this._emitError(new Error("Cannot parse will topic"));if(_.will.topic=g,u("_parseConnect: packet.will.topic: %s",_.will.topic),(v=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse will payload"));_.will.payload=v,u("_parseConnect: packet.will.paylaod: %s",_.will.payload)}if(y.username){if((w=this._parseString())===null)return this._emitError(new Error("Cannot parse username"));_.username=w,u("_parseConnect: packet.username: %s",_.username)}if(y.password){if((m=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse password"));_.password=m}return this.settings=_,u("_parseConnect: complete"),_}_parseConnack(){u("_parseConnack");const g=this.packet;if(this._list.length<1)return null;if(g.sessionPresent=!!(this._list.readUInt8(this._pos++)&o.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?g.reasonCode=this._list.readUInt8(this._pos++):g.reasonCode=0;else{if(this._list.length<2)return null;g.returnCode=this._list.readUInt8(this._pos++)}if(g.returnCode===-1||g.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}u("_parseConnack: complete")}_parsePublish(){u("_parsePublish");const g=this.packet;if(g.topic=this._parseString(),g.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(g.qos>0)||this._parseMessageId()){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}g.payload=this._list.slice(this._pos,g.length),u("_parsePublish: payload from buffer list: %o",g.payload)}}_parseSubscribe(){u("_parseSubscribe");const g=this.packet;let v,m,w,y,_,A,x;if(g.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(g.subscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(g.properties=C)}for(;this._pos=g.length)return this._emitError(new Error("Malformed Subscribe Payload"));w=(m=this._parseByte())&o.SUBSCRIBE_OPTIONS_QOS_MASK,A=(m>>o.SUBSCRIBE_OPTIONS_NL_SHIFT&o.SUBSCRIBE_OPTIONS_NL_MASK)!=0,_=(m>>o.SUBSCRIBE_OPTIONS_RAP_SHIFT&o.SUBSCRIBE_OPTIONS_RAP_MASK)!=0,y=m>>o.SUBSCRIBE_OPTIONS_RH_SHIFT&o.SUBSCRIBE_OPTIONS_RH_MASK,x={topic:v,qos:w},this.settings.protocolVersion===5?(x.nl=A,x.rap=_,x.rh=y):this.settings.bridgeMode&&(x.rh=0,x.rap=!0,x.nl=!0),u("_parseSubscribe: push subscription `%s` to subscription",x),g.subscriptions.push(x)}}}_parseSuback(){u("_parseSuback");const g=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}for(;this._pos2?(g.reasonCode=this._parseByte(),u("_parseConfirmation: packet.reasonCode `%d`",g.reasonCode)):g.reasonCode=0,g.length>3)){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}return!0}_parseDisconnect(){const g=this.packet;if(u("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?g.reasonCode=this._parseByte():g.reasonCode=0;const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(g.properties=v)}return u("_parseDisconnect result: true"),!0}_parseAuth(){u("_parseAuth");const g=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));g.reasonCode=this._parseByte();const v=this._parseProperties();return Object.getOwnPropertyNames(v).length&&(g.properties=v),u("_parseAuth: result: true"),!0}_parseMessageId(){const g=this.packet;return g.messageId=this._parseNum(),g.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(u("_parseMessageId: packet.messageId %d",g.messageId),!0)}_parseString(g){const v=this._parseNum(),m=v+this._pos;if(v===-1||m>this._list.length||m>this.packet.length)return null;const w=this._list.toString("utf8",this._pos,m);return this._pos+=v,u("_parseString: result: %s",w),w}_parseStringPair(){return u("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const g=this._parseNum(),v=g+this._pos;if(g===-1||v>this._list.length||v>this.packet.length)return null;const m=this._list.slice(this._pos,v);return this._pos+=g,u("_parseBuffer: result: %o",m),m}_parseNum(){if(this._list.length-this._pos<2)return-1;const g=this._list.readUInt16BE(this._pos);return this._pos+=2,u("_parseNum: result: %s",g),g}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const g=this._list.readUInt32BE(this._pos);return this._pos+=4,u("_parse4ByteNum: result: %s",g),g}_parseVarByteNum(g){u("_parseVarByteNum");let v,m=0,w=1,y=0,_=!1;const A=this._pos?this._pos:0;for(;m<4&&A+m=m&&this._emitError(new Error("Invalid variable byte integer")),A&&(this._pos+=m),u("_parseVarByteNum: result: %o",_=!!_&&(g?{bytes:m,value:y}:y)),_}_parseByte(){let g;return this._pos=4)&&(E||ot))G+=n.byteLength(E)+2;else{if(ut<4)return U.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*ot==0)return U.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof b!="number"||b<0||b>65535||b%1!=0)return U.emit("error",new Error("Invalid keepalive")),!1;if(G+=2,G+=1,ut===5){var rt=R(U,X);if(!rt)return!1;G+=rt.length}if(ct){if(typeof ct!="object")return U.emit("error",new Error("Invalid will")),!1;if(!ct.topic||typeof ct.topic!="string")return U.emit("error",new Error("Invalid will topic")),!1;if(G+=n.byteLength(ct.topic)+2,G+=2,ct.payload){if(!(ct.payload.length>=0))return U.emit("error",new Error("Invalid will payload")),!1;typeof ct.payload=="string"?G+=n.byteLength(ct.payload):G+=ct.payload.length}var yt={};if(ut===5){if(!(yt=R(U,ct.properties)))return!1;G+=yt.length}}let mt=!1;if(S!=null){if(!nt(S))return U.emit("error",new Error("Invalid username")),!1;mt=!0,G+=n.byteLength(S)+2}if(N!=null){if(!mt)return U.emit("error",new Error("Username is required to use password")),!1;if(!nt(N))return U.emit("error",new Error("Invalid password")),!1;G+=Z(N)+2}U.write(r.CONNECT_HEADER),I(U,G),F(U,et),at.bridgeMode&&(ut+=128),U.write(ut===131?r.VERSION131:ut===132?r.VERSION132:ut===4?r.VERSION4:ut===5?r.VERSION5:r.VERSION3);let At=0;return At|=S!=null?r.USERNAME_MASK:0,At|=N!=null?r.PASSWORD_MASK:0,At|=ct&&ct.retain?r.WILL_RETAIN_MASK:0,At|=ct&&ct.qos?ct.qos<0&&_(U,E),X!=null&&X.write(),f("publish: payload: %o",b),U.write(b)}(j,H,$);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=et.cmd||"puback",ct=et.messageId,ot=et.dup&&ut==="pubrel"?r.DUP_MASK:0;let b=0;const E=et.reasonCode,S=et.properties;let N=at===5?3:2;if(ut==="pubrel"&&(b=1),typeof ct!="number")return U.emit("error",new Error("Invalid messageId")),!1;let X=null;if(at===5&&typeof S=="object"){if(!(X=P(U,S,tt,N)))return!1;N+=X.length}return U.write(r.ACKS[ut][b][ot][0]),I(U,N),_(U,ct),at===5&&U.write(n.from([E])),X!==null&&X.write(),!0}(j,H,$);case"subscribe":return function(K,U,tt){f("subscribe: packet: ");const at=tt?tt.protocolVersion:4,et=K||{},ut=et.dup?r.DUP_MASK:0,ct=et.messageId,ot=et.subscriptions,b=et.properties;let E=0;if(typeof ct!="number")return U.emit("error",new Error("Invalid messageId")),!1;E+=2;let S=null;if(at===5){if(!(S=R(U,b)))return!1;E+=S.length}if(typeof ot!="object"||!ot.length)return U.emit("error",new Error("Invalid subscriptions")),!1;for(let X=0;X2)return U.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}E+=n.byteLength(G)+2+1}f("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),U.write(r.SUBSCRIBE_HEADER[1][ut?1:0][0]),I(U,E),_(U,ct),S!==null&&S.write();let N=!0;for(const X of ot){const G=X.topic,rt=X.qos,yt=+X.nl,mt=+X.rap,At=X.rh;let Rt;D(U,G),Rt=r.SUBSCRIBE_OPTIONS_QOS[rt],at===5&&(Rt|=yt?r.SUBSCRIBE_OPTIONS_NL:0,Rt|=mt?r.SUBSCRIBE_OPTIONS_RAP:0,Rt|=At?r.SUBSCRIBE_OPTIONS_RH[At]:0),N=U.write(n.from([Rt]))}return N}(j,H,$);case"suback":return function(K,U,tt){const at=tt?tt.protocolVersion:4,et=K||{},ut=et.messageId,ct=et.granted,ot=et.properties;let b=0;if(typeof ut!="number")return U.emit("error",new Error("Invalid messageId")),!1;if(b+=2,typeof ct!="object"||!ct.length)return U.emit("error",new Error("Invalid qos vector")),!1;for(let S=0;S_===V,set(j){j?(g&&Object.keys(g).length!==0||(A=!0),_=V):(A=!1,_=Q)}});const T={};function I(j,H){if(H>r.VARBYTEINT_MAX)return j.emit("error",new Error(`Invalid variable byte integer: ${H}`)),!1;let $=T[H];return $||($=w(H),H<16384&&(T[H]=$)),f("writeVarByteInt: writing to stream: %o",$),j.write($)}function D(j,H){const $=n.byteLength(H);return _(j,$),f("writeString: %s",H),j.write(H,"utf8")}function B(j,H,$){D(j,H),D(j,$)}function V(j,H){return f("writeNumberCached: number: %d",H),f("writeNumberCached: %o",g[H]),j.write(g[H])}function Q(j,H){const $=v(H);return f("writeNumberGenerated: %o",$),j.write($)}function F(j,H){typeof H=="string"?D(j,H):H?(_(j,H.length),j.write(H)):_(j,0)}function R(j,H){if(typeof H!="object"||H.length!=null)return{length:1,write(){Y(j,{},0)}};let $=0;function K(U,tt){let at=0;switch(r.propertiesTypes[U]){case"byte":if(typeof tt!="boolean")return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=2;break;case"int8":if(typeof tt!="number"||tt<0||tt>255)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=2;break;case"binary":if(tt&&tt===null)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=1+n.byteLength(tt)+2;break;case"int16":if(typeof tt!="number"||tt<0||tt>65535)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=3;break;case"int32":if(typeof tt!="number"||tt<0||tt>4294967295)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=5;break;case"var":if(typeof tt!="number"||tt<0||tt>268435455)return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=1+n.byteLength(w(tt));break;case"string":if(typeof tt!="string")return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=3+n.byteLength(tt.toString());break;case"pair":if(typeof tt!="object")return j.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;at+=Object.getOwnPropertyNames(tt).reduce((et,ut)=>{const ct=tt[ut];return Array.isArray(ct)?et+=ct.reduce((ot,b)=>ot+=3+n.byteLength(ut.toString())+2+n.byteLength(b.toString()),0):et+=3+n.byteLength(ut.toString())+2+n.byteLength(tt[ut].toString()),et},0);break;default:return j.emit("error",new Error(`Invalid property ${U}: ${tt}`)),!1}return at}if(H)for(const U in H){let tt=0,at=0;const et=H[U];if(Array.isArray(et))for(let ut=0;uttt;){const et=U.shift();if(!et||!H[et])return!1;delete H[et],at=R(j,H)}return at}function M(j,H,$){switch(r.propertiesTypes[H]){case"byte":j.write(n.from([r.properties[H]])),j.write(n.from([+$]));break;case"int8":j.write(n.from([r.properties[H]])),j.write(n.from([$]));break;case"binary":j.write(n.from([r.properties[H]])),F(j,$);break;case"int16":j.write(n.from([r.properties[H]])),_(j,$);break;case"int32":j.write(n.from([r.properties[H]])),function(K,U){const tt=y(U);f("write4ByteNumber: %o",tt),K.write(tt)}(j,$);break;case"var":j.write(n.from([r.properties[H]])),I(j,$);break;case"string":j.write(n.from([r.properties[H]])),D(j,$);break;case"pair":Object.getOwnPropertyNames($).forEach(K=>{const U=$[K];Array.isArray(U)?U.forEach(tt=>{j.write(n.from([r.properties[H]])),B(j,K.toString(),tt.toString())}):(j.write(n.from([r.properties[H]])),B(j,K.toString(),U.toString()))});break;default:return j.emit("error",new Error(`Invalid property ${H} value: ${$}`)),!1}}function Y(j,H,$){I(j,$);for(const K in H)if(Object.prototype.hasOwnProperty.call(H,K)&&H[K]!==null){const U=H[K];if(Array.isArray(U))for(let tt=0;tt=1.5*m;return Math.round(g/m)+" "+w+(y?"s":"")}a.exports=function(g,v){v=v||{};var m=typeof g;if(m==="string"&&g.length>0)return function(w){if(!((w=String(w)).length>100)){var y=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(w);if(!!y){var _=parseFloat(y[1]);switch((y[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return _*c;case"weeks":case"week":case"w":return _*u;case"days":case"day":case"d":return _*o;case"hours":case"hour":case"hrs":case"hr":case"h":return _*l;case"minutes":case"minute":case"mins":case"min":case"m":return _*r;case"seconds":case"second":case"secs":case"sec":case"s":return _*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return _;default:return}}}}(g);if(m==="number"&&isFinite(g))return v.long?function(w){var y=Math.abs(w);return y>=o?f(w,y,o,"day"):y>=l?f(w,y,l,"hour"):y>=r?f(w,y,r,"minute"):y>=n?f(w,y,n,"second"):w+" ms"}(g):function(w){var y=Math.abs(w);return y>=o?Math.round(w/o)+"d":y>=l?Math.round(w/l)+"h":y>=r?Math.round(w/r)+"m":y>=n?Math.round(w/n)+"s":w+"ms"}(g);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(g))}},{}],46:[function(i,a,s){const n=i("./lib/number-allocator.js");a.exports.NumberAllocator=n},{"./lib/number-allocator.js":47}],47:[function(i,a,s){const n=i("js-sdsl").Set,r=i("debug")("number-allocator:trace"),l=i("debug")("number-allocator:error");function o(c,f){this.low=c,this.high=f}function u(c,f){if(!(this instanceof u))return new u(c,f);this.min=c,this.max=f,this.ss=new n([],(g,v)=>g.compare(v)),r("Create"),this.clear()}o.prototype.equals=function(c){return this.low===c.low&&this.high===c.high},o.prototype.compare=function(c){return this.lowc)return!1;if(g.low===c)return++g.low,r("use():"+c),!0;if(g.high===c)return--g.high,r("use():"+c),!0;const v=g.low;return g.low=c+1,this.ss.insert(new o(v,c-1)),r("use():"+c),!0}return r("use():failed"),!1},u.prototype.free=function(c){if(cthis.max)return void l("free():"+c+" is out of range");const f=new o(c,c),g=this.ss.lowerBound(f);if(g){if(g.low<=c&&c<=g.high)return void l("free():"+c+" has already been vacant");if(g===this.ss.front())c+1===g.low?--g.low:this.ss.insert(f);else{const v=this.ss.reverseLowerBound(f);v.high+1===c?c+1===g.low?(this.ss.eraseElementByValue(v),g.low=v.low):v.high=c:c+1===g.low?g.low=c:this.ss.insert(f)}}else{if(g===this.ss.front())return void this.ss.insert(f);const v=this.ss.reverseLowerBound(f);v.high+1===c?v.high=c:this.ss.insert(f)}r("free():"+c)},u.prototype.clear=function(){r("clear()"),this.ss.clear(),this.ss.insert(new o(this.min,this.max))},u.prototype.intervalCount=function(){return this.ss.size()},u.prototype.dump=function(){console.log("length:"+this.ss.size());for(const c of this.ss)console.log(c)},a.exports=u},{debug:18,"js-sdsl":36}],48:[function(i,a,s){var n=i("wrappy");function r(o){var u=function(){return u.called?u.value:(u.called=!0,u.value=o.apply(this,arguments))};return u.called=!1,u}function l(o){var u=function(){if(u.called)throw new Error(u.onceError);return u.called=!0,u.value=o.apply(this,arguments)},c=o.name||"Function wrapped with `once`";return u.onceError=c+" shouldn't be called more than once",u.called=!1,u}a.exports=n(r),a.exports.strict=n(l),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return l(this)},configurable:!0})})},{wrappy:79}],49:[function(i,a,s){(function(n){(function(){n===void 0||!n.version||n.version.indexOf("v0.")===0||n.version.indexOf("v1.")===0&&n.version.indexOf("v1.8.")!==0?a.exports={nextTick:function(r,l,o,u){if(typeof r!="function")throw new TypeError('"callback" argument must be a function');var c,f,g=arguments.length;switch(g){case 0:case 1:return n.nextTick(r);case 2:return n.nextTick(function(){r.call(null,l)});case 3:return n.nextTick(function(){r.call(null,l,o)});case 4:return n.nextTick(function(){r.call(null,l,o,u)});default:for(c=new Array(g-1),f=0;f1)for(var T=1;T= 0x80 (not a basic code point)","invalid-input":"Invalid input"},V=v-m,Q=Math.floor,F=String.fromCharCode;function R(K){throw new RangeError(B[K])}function P(K,U){for(var tt=K.length,at=[];tt--;)at[tt]=U(K[tt]);return at}function M(K,U){var tt=K.split("@"),at="";return tt.length>1&&(at=tt[0]+"@",K=tt[1]),at+P((K=K.replace(D,".")).split("."),U).join(".")}function Y(K){for(var U,tt,at=[],et=0,ut=K.length;et=55296&&U<=56319&&et65535&&(tt+=F((U-=65536)>>>10&1023|55296),U=56320|1023&U),tt+=F(U)}).join("")}function nt(K,U){return K+22+75*(K<26)-((U!=0)<<5)}function j(K,U,tt){var at=0;for(K=tt?Q(K/_):K>>1,K+=Q(K/U);K>V*w>>1;at+=v)K=Q(K/V);return Q(at+(V+1)*K/(K+y))}function H(K){var U,tt,at,et,ut,ct,ot,b,E,S,N,X=[],G=K.length,rt=0,yt=x,mt=A;for((tt=K.lastIndexOf(C))<0&&(tt=0),at=0;at=128&&R("not-basic"),X.push(K.charCodeAt(at));for(et=tt>0?tt+1:0;et=G&&R("invalid-input"),((b=(N=K.charCodeAt(et++))-48<10?N-22:N-65<26?N-65:N-97<26?N-97:v)>=v||b>Q((g-rt)/ct))&&R("overflow"),rt+=b*ct,!(b<(E=ot<=mt?m:ot>=mt+w?w:ot-mt));ot+=v)ct>Q(g/(S=v-E))&&R("overflow"),ct*=S;mt=j(rt-ut,U=X.length+1,ut==0),Q(rt/U)>g-yt&&R("overflow"),yt+=Q(rt/U),rt%=U,X.splice(rt++,0,yt)}return Z(X)}function $(K){var U,tt,at,et,ut,ct,ot,b,E,S,N,X,G,rt,yt,mt=[];for(X=(K=Y(K)).length,U=x,tt=0,ut=A,ct=0;ct=U&&NQ((g-tt)/(G=at+1))&&R("overflow"),tt+=(ot-U)*G,U=ot,ct=0;ctg&&R("overflow"),N==U){for(b=tt,E=v;!(b<(S=E<=ut?m:E>=ut+w?w:E-ut));E+=v)yt=b-S,rt=v-S,mt.push(F(nt(S+yt%rt,0))),b=Q(yt/rt);mt.push(F(nt(b,0))),ut=j(tt,G,at==et),tt=0,++at}++tt,++U}return mt.join("")}if(c={version:"1.4.1",ucs2:{decode:Y,encode:Z},decode:H,encode:$,toASCII:function(K){return M(K,function(U){return I.test(U)?"xn--"+$(U):U})},toUnicode:function(K){return M(K,function(U){return T.test(U)?H(U.slice(4).toLowerCase()):U})}},l&&o)if(a.exports==l)o.exports=c;else for(f in c)c.hasOwnProperty(f)&&(l[f]=c[f]);else r.punycode=c})(this)}).call(this)}).call(this,typeof Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(i,a,s){function n(l,o){return Object.prototype.hasOwnProperty.call(l,o)}a.exports=function(l,o,u,c){o=o||"&",u=u||"=";var f={};if(typeof l!="string"||l.length===0)return f;var g=/\+/g;l=l.split(o);var v=1e3;c&&typeof c.maxKeys=="number"&&(v=c.maxKeys);var m=l.length;v>0&&m>v&&(m=v);for(var w=0;w=0?(y=C.substr(0,T),_=C.substr(T+1)):(y=C,_=""),A=decodeURIComponent(y),x=decodeURIComponent(_),n(f,A)?r(f[A])?f[A].push(x):f[A]=[f[A],x]:f[A]=x}return f};var r=Array.isArray||function(l){return Object.prototype.toString.call(l)==="[object Array]"}},{}],53:[function(i,a,s){var n=function(u){switch(typeof u){case"string":return u;case"boolean":return u?"true":"false";case"number":return isFinite(u)?u:"";default:return""}};a.exports=function(u,c,f,g){return c=c||"&",f=f||"=",u===null&&(u=void 0),typeof u=="object"?l(o(u),function(v){var m=encodeURIComponent(n(v))+f;return r(u[v])?l(u[v],function(w){return m+encodeURIComponent(n(w))}).join(c):m+encodeURIComponent(n(u[v]))}).join(c):g?encodeURIComponent(n(g))+f+encodeURIComponent(n(u)):""};var r=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"};function l(u,c){if(u.map)return u.map(c);for(var f=[],g=0;g2?"one of ".concat(u," ").concat(o.slice(0,c-1).join(", "),", or ")+o[c-1]:c===2?"one of ".concat(u," ").concat(o[0]," or ").concat(o[1]):"of ".concat(u," ").concat(o[0])}return"of ".concat(u," ").concat(String(o))}r("ERR_INVALID_OPT_VALUE",function(o,u){return'The value "'+u+'" is invalid for option "'+o+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(o,u,c){var f,g,v;if(typeof u=="string"&&(g="not ",u.substr(0,g.length)===g)?(f="must not be",u=u.replace(/^not /,"")):f="must be",function(w,y,_){return(_===void 0||_>w.length)&&(_=w.length),w.substring(_-y.length,_)===y}(o," argument"))v="The ".concat(o," ").concat(f," ").concat(l(u,"type"));else{var m=function(w,y,_){return typeof _!="number"&&(_=0),!(_+y.length>w.length)&&w.indexOf(y,_)!==-1}(o,".")?"property":"argument";v='The "'.concat(o,'" ').concat(m," ").concat(f," ").concat(l(u,"type"))}return v+=". Received type ".concat(typeof c)},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(o){return"The "+o+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(o){return"Cannot call "+o+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(o){return"Unknown encoding: "+o},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),a.exports.codes=n},{}],56:[function(i,a,s){(function(n){(function(){var r=Object.keys||function(w){var y=[];for(var _ in w)y.push(_);return y};a.exports=g;var l=i("./_stream_readable"),o=i("./_stream_writable");i("inherits")(g,l);for(var u=r(o.prototype),c=0;c0)if(typeof E=="string"||rt.objectMode||Object.getPrototypeOf(E)===c.prototype||(E=function(yt){return c.from(yt)}(E)),N)rt.endEmitted?V(b,new B):M(b,rt,E,!0);else if(rt.ended)V(b,new I);else{if(rt.destroyed)return!1;rt.reading=!1,rt.decoder&&!S?(E=rt.decoder.write(E),rt.objectMode||E.length!==0?M(b,rt,E,!1):H(b,rt)):M(b,rt,E,!1)}else N||(rt.reading=!1,H(b,rt));return!rt.ended&&(rt.lengthE.highWaterMark&&(E.highWaterMark=function(S){return S>=Y?S=Y:(S--,S|=S>>>1,S|=S>>>2,S|=S>>>4,S|=S>>>8,S|=S>>>16,S++),S}(b)),b<=E.length?b:E.ended?E.length:(E.needReadable=!0,0))}function nt(b){var E=b._readableState;g("emitReadable",E.needReadable,E.emittedReadable),E.needReadable=!1,E.emittedReadable||(g("emitReadable",E.flowing),E.emittedReadable=!0,n.nextTick(j,b))}function j(b){var E=b._readableState;g("emitReadable_",E.destroyed,E.length,E.ended),E.destroyed||!E.length&&!E.ended||(b.emit("readable"),E.emittedReadable=!1),E.needReadable=!E.flowing&&!E.ended&&E.length<=E.highWaterMark,at(b)}function H(b,E){E.readingMore||(E.readingMore=!0,n.nextTick($,b,E))}function $(b,E){for(;!E.reading&&!E.ended&&(E.length0,E.resumeScheduled&&!E.paused?E.flowing=!0:b.listenerCount("data")>0&&b.resume()}function U(b){g("readable nexttick read 0"),b.read(0)}function tt(b,E){g("resume",E.reading),E.reading||b.read(0),E.resumeScheduled=!1,b.emit("resume"),at(b),E.flowing&&!E.reading&&b.read(0)}function at(b){var E=b._readableState;for(g("flow",E.flowing);E.flowing&&b.read()!==null;);}function et(b,E){return E.length===0?null:(E.objectMode?S=E.buffer.shift():!b||b>=E.length?(S=E.decoder?E.buffer.join(""):E.buffer.length===1?E.buffer.first():E.buffer.concat(E.length),E.buffer.clear()):S=E.buffer.consume(b,E.decoder),S);var S}function ut(b){var E=b._readableState;g("endReadable",E.endEmitted),E.endEmitted||(E.ended=!0,n.nextTick(ct,E,b))}function ct(b,E){if(g("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,E.readable=!1,E.emit("end"),b.autoDestroy)){var S=E._writableState;(!S||S.autoDestroy&&S.finished)&&E.destroy()}}function ot(b,E){for(var S=0,N=b.length;S=E.highWaterMark:E.length>0)||E.ended))return g("read: emitReadable",E.length,E.ended),E.length===0&&E.ended?ut(this):nt(this),null;if((b=Z(b,E))===0&&E.ended)return E.length===0&&ut(this),null;var N,X=E.needReadable;return g("need readable",X),(E.length===0||E.length-b0?et(b,E):null)===null?(E.needReadable=E.length<=E.highWaterMark,b=0):(E.length-=b,E.awaitDrain=0),E.length===0&&(E.ended||(E.needReadable=!0),S!==b&&E.ended&&ut(this)),N!==null&&this.emit("data",N),N},R.prototype._read=function(b){V(this,new D("_read()"))},R.prototype.pipe=function(b,E){var S=this,N=this._readableState;switch(N.pipesCount){case 0:N.pipes=b;break;case 1:N.pipes=[N.pipes,b];break;default:N.pipes.push(b)}N.pipesCount+=1,g("pipe count=%d opts=%j",N.pipesCount,E);var X=(!E||E.end!==!1)&&b!==n.stdout&&b!==n.stderr?rt:xe;function G(jt,te){g("onunpipe"),jt===S&&te&&te.hasUnpiped===!1&&(te.hasUnpiped=!0,g("cleanup"),b.removeListener("close",be),b.removeListener("finish",ae),b.removeListener("drain",yt),b.removeListener("error",Rt),b.removeListener("unpipe",G),S.removeListener("end",rt),S.removeListener("end",xe),S.removeListener("data",At),mt=!0,!N.awaitDrain||b._writableState&&!b._writableState.needDrain||yt())}function rt(){g("onend"),b.end()}N.endEmitted?n.nextTick(X):S.once("end",X),b.on("unpipe",G);var yt=function(jt){return function(){var te=jt._readableState;g("pipeOnDrain",te.awaitDrain),te.awaitDrain&&te.awaitDrain--,te.awaitDrain===0&&o(jt,"data")&&(te.flowing=!0,at(jt))}}(S);b.on("drain",yt);var mt=!1;function At(jt){g("ondata");var te=b.write(jt);g("dest.write",te),te===!1&&((N.pipesCount===1&&N.pipes===b||N.pipesCount>1&&ot(N.pipes,b)!==-1)&&!mt&&(g("false write response, pause",N.awaitDrain),N.awaitDrain++),S.pause())}function Rt(jt){g("onerror",jt),xe(),b.removeListener("error",Rt),o(b,"error")===0&&V(b,jt)}function be(){b.removeListener("finish",ae),xe()}function ae(){g("onfinish"),b.removeListener("close",be),xe()}function xe(){g("unpipe"),S.unpipe(b)}return S.on("data",At),function(jt,te,xi){if(typeof jt.prependListener=="function")return jt.prependListener(te,xi);jt._events&&jt._events[te]?Array.isArray(jt._events[te])?jt._events[te].unshift(xi):jt._events[te]=[xi,jt._events[te]]:jt.on(te,xi)}(b,"error",Rt),b.once("close",be),b.once("finish",ae),b.emit("pipe",S),N.flowing||(g("pipe resume"),S.resume()),b},R.prototype.unpipe=function(b){var E=this._readableState,S={hasUnpiped:!1};if(E.pipesCount===0)return this;if(E.pipesCount===1)return b&&b!==E.pipes?this:(b||(b=E.pipes),E.pipes=null,E.pipesCount=0,E.flowing=!1,b&&b.emit("unpipe",this,S),this);if(!b){var N=E.pipes,X=E.pipesCount;E.pipes=null,E.pipesCount=0,E.flowing=!1;for(var G=0;G0,N.flowing!==!1&&this.resume()):b==="readable"&&(N.endEmitted||N.readableListening||(N.readableListening=N.needReadable=!0,N.flowing=!1,N.emittedReadable=!1,g("on readable",N.length,N.reading),N.length?nt(this):N.reading||n.nextTick(U,this))),S},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(b,E){var S=u.prototype.removeListener.call(this,b,E);return b==="readable"&&n.nextTick(K,this),S},R.prototype.removeAllListeners=function(b){var E=u.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||n.nextTick(K,this),E},R.prototype.resume=function(){var b=this._readableState;return b.flowing||(g("resume"),b.flowing=!b.readableListening,function(E,S){S.resumeScheduled||(S.resumeScheduled=!0,n.nextTick(tt,E,S))}(this,b)),b.paused=!1,this},R.prototype.pause=function(){return g("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(g("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(b){var E=this,S=this._readableState,N=!1;for(var X in b.on("end",function(){if(g("wrapped end"),S.decoder&&!S.ended){var rt=S.decoder.end();rt&&rt.length&&E.push(rt)}E.push(null)}),b.on("data",function(rt){g("wrapped data"),S.decoder&&(rt=S.decoder.write(rt)),(!S.objectMode||rt!=null)&&(S.objectMode||rt&&rt.length)&&(E.push(rt)||(N=!0,b.pause()))}),b)this[X]===void 0&&typeof b[X]=="function"&&(this[X]=function(rt){return function(){return b[rt].apply(b,arguments)}}(X));for(var G=0;G-1))throw new B(H);return this._writableState.defaultEncoding=H,this},Object.defineProperty(R.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),R.prototype._write=function(H,$,K){K(new A("_write()"))},R.prototype._writev=null,R.prototype.end=function(H,$,K){var U=this._writableState;return typeof H=="function"?(K=H,H=null,$=null):typeof $=="function"&&(K=$,$=null),H!=null&&this.write(H,$),U.corked&&(U.corked=1,this.uncork()),U.ending||function(tt,at,et){at.ending=!0,j(tt,at),et&&(at.finished?n.nextTick(et):tt.once("finish",et)),at.ended=!0,tt.writable=!1}(this,U,K),this},Object.defineProperty(R.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(H){this._writableState&&(this._writableState.destroyed=H)}}),R.prototype.destroy=m.destroy,R.prototype._undestroy=m.undestroy,R.prototype._destroy=function(H,$){$(H)}}).call(this)}).call(this,i("_process"),typeof Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(i,a,s){(function(n){(function(){var r;function l(C,T,I){return T in C?Object.defineProperty(C,T,{value:I,enumerable:!0,configurable:!0,writable:!0}):C[T]=I,C}var o=i("./end-of-stream"),u=Symbol("lastResolve"),c=Symbol("lastReject"),f=Symbol("error"),g=Symbol("ended"),v=Symbol("lastPromise"),m=Symbol("handlePromise"),w=Symbol("stream");function y(C,T){return{value:C,done:T}}function _(C){var T=C[u];if(T!==null){var I=C[w].read();I!==null&&(C[v]=null,C[u]=null,C[c]=null,T(y(I,!1)))}}var A=Object.getPrototypeOf(function(){}),x=Object.setPrototypeOf((l(r={get stream(){return this[w]},next:function(){var C=this,T=this[f];if(T!==null)return Promise.reject(T);if(this[g])return Promise.resolve(y(void 0,!0));if(this[w].destroyed)return new Promise(function(V,Q){n.nextTick(function(){C[f]?Q(C[f]):V(y(void 0,!0))})});var I,D=this[v];if(D)I=new Promise(function(V,Q){return function(F,R){V.then(function(){Q[g]?F(y(void 0,!0)):Q[m](F,R)},R)}}(D,this));else{var B=this[w].read();if(B!==null)return Promise.resolve(y(B,!1));I=new Promise(this[m])}return this[v]=I,I}},Symbol.asyncIterator,function(){return this}),l(r,"return",function(){var C=this;return new Promise(function(T,I){C[w].destroy(null,function(D){D?I(D):T(y(void 0,!0))})})}),r),A);a.exports=function(C){var T,I=Object.create(x,(l(T={},w,{value:C,writable:!0}),l(T,u,{value:null,writable:!0}),l(T,c,{value:null,writable:!0}),l(T,f,{value:null,writable:!0}),l(T,g,{value:C._readableState.endEmitted,writable:!0}),l(T,m,{value:function(D,B){var V=I[w].read();V?(I[v]=null,I[u]=null,I[c]=null,D(y(V,!1))):(I[u]=D,I[c]=B)},writable:!0}),T));return I[v]=null,o(C,function(D){if(D&&D.code!=="ERR_STREAM_PREMATURE_CLOSE"){var B=I[c];return B!==null&&(I[v]=null,I[u]=null,I[c]=null,B(D)),void(I[f]=D)}var V=I[u];V!==null&&(I[v]=null,I[u]=null,I[c]=null,V(y(void 0,!0))),I[g]=!0}),C.on("readable",function(D){n.nextTick(_,D)}.bind(null,I)),I}}).call(this)}).call(this,i("_process"))},{"./end-of-stream":64,_process:50}],62:[function(i,a,s){function n(f,g){var v=Object.keys(f);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(f);g&&(m=m.filter(function(w){return Object.getOwnPropertyDescriptor(f,w).enumerable})),v.push.apply(v,m)}return v}function r(f,g,v){return g in f?Object.defineProperty(f,g,{value:v,enumerable:!0,configurable:!0,writable:!0}):f[g]=v,f}function l(f,g){for(var v=0;v0?this.tail.next=w:this.head=w,this.tail=w,++this.length}},{key:"unshift",value:function(m){var w={data:m,next:this.head};this.length===0&&(this.tail=w),this.head=w,++this.length}},{key:"shift",value:function(){if(this.length!==0){var m=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,m}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(m){if(this.length===0)return"";for(var w=this.head,y=""+w.data;w=w.next;)y+=m+w.data;return y}},{key:"concat",value:function(m){if(this.length===0)return o.alloc(0);for(var w,y,_,A=o.allocUnsafe(m>>>0),x=this.head,C=0;x;)w=x.data,y=A,_=C,o.prototype.copy.call(w,y,_),C+=x.data.length,x=x.next;return A}},{key:"consume",value:function(m,w){var y;return mA.length?A.length:m;if(x===A.length?_+=A:_+=A.slice(0,m),(m-=x)===0){x===A.length?(++y,w.next?this.head=w.next:this.head=this.tail=null):(this.head=w,w.data=A.slice(x));break}++y}return this.length-=y,_}},{key:"_getBuffer",value:function(m){var w=o.allocUnsafe(m),y=this.head,_=1;for(y.data.copy(w),m-=y.data.length;y=y.next;){var A=y.data,x=m>A.length?A.length:m;if(A.copy(w,w.length-m,0,x),(m-=x)===0){x===A.length?(++_,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=A.slice(x));break}++_}return this.length-=_,w}},{key:c,value:function(m,w){return u(this,function(y){for(var _=1;_0,function(T){w||(w=T),T&&_.forEach(c),C||(_.forEach(c),y(w))})});return v.reduce(f)}},{"../../../errors":55,"./end-of-stream":64}],67:[function(i,a,s){var n=i("../../../errors").codes.ERR_INVALID_OPT_VALUE;a.exports={getHighWaterMark:function(r,l,o,u){var c=function(f,g,v){return f.highWaterMark!=null?f.highWaterMark:g?f[v]:null}(l,u,o);if(c!=null){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new n(u?o:"highWaterMark",c);return Math.floor(c)}return r.objectMode?16:16384}}},{"../../../errors":55}],68:[function(i,a,s){a.exports=i("events").EventEmitter},{events:22}],69:[function(i,a,s){(s=a.exports=i("./lib/_stream_readable.js")).Stream=s,s.Readable=s,s.Writable=i("./lib/_stream_writable.js"),s.Duplex=i("./lib/_stream_duplex.js"),s.Transform=i("./lib/_stream_transform.js"),s.PassThrough=i("./lib/_stream_passthrough.js"),s.finished=i("./lib/internal/streams/end-of-stream.js"),s.pipeline=i("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(i,a,s){a.exports=function(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var n;if(arguments.length>0){n=new Array(arguments.length-2);for(var r=0;r>5==6?2:y>>4==14?3:y>>3==30?4:y>>6==2?-1:-2}function u(y){var _=this.lastTotal-this.lastNeed,A=function(x,C,T){if((192&C[0])!=128)return x.lastNeed=0,"\uFFFD";if(x.lastNeed>1&&C.length>1){if((192&C[1])!=128)return x.lastNeed=1,"\uFFFD";if(x.lastNeed>2&&C.length>2&&(192&C[2])!=128)return x.lastNeed=2,"\uFFFD"}}(this,y);return A!==void 0?A:this.lastNeed<=y.length?(y.copy(this.lastChar,_,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(y.copy(this.lastChar,_,0,y.length),void(this.lastNeed-=y.length))}function c(y,_){if((y.length-_)%2==0){var A=y.toString("utf16le",_);if(A){var x=A.charCodeAt(A.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],A.slice(0,-1)}return A}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",_,y.length-1)}function f(y){var _=y&&y.length?this.write(y):"";if(this.lastNeed){var A=this.lastTotal-this.lastNeed;return _+this.lastChar.toString("utf16le",0,A)}return _}function g(y,_){var A=(y.length-_)%3;return A===0?y.toString("base64",_):(this.lastNeed=3-A,this.lastTotal=3,A===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",_,y.length-A))}function v(y){var _=y&&y.length?this.write(y):"";return this.lastNeed?_+this.lastChar.toString("base64",0,3-this.lastNeed):_}function m(y){return y.toString(this.encoding)}function w(y){return y&&y.length?this.write(y):""}s.StringDecoder=l,l.prototype.write=function(y){if(y.length===0)return"";var _,A;if(this.lastNeed){if((_=this.fillLast(y))===void 0)return"";A=this.lastNeed,this.lastNeed=0}else A=0;return A=0?(B>0&&(C.lastNeed=B-1),B):--D=0?(B>0&&(C.lastNeed=B-2),B):--D=0?(B>0&&(B===2?B=0:C.lastNeed=B-3),B):0}(this,y,_);if(!this.lastNeed)return y.toString("utf8",_);this.lastTotal=A;var x=y.length-(A-this.lastNeed);return y.copy(this.lastChar,0,x),y.toString("utf8",_,x)},l.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length}},{"safe-buffer":73}],76:[function(i,a,s){var n=i("punycode"),r=i("./util");function l(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}s.parse=T,s.resolve=function(I,D){return T(I,!1,!0).resolve(D)},s.resolveObject=function(I,D){return I?T(I,!1,!0).resolveObject(D):D},s.format=function(I){return r.isString(I)&&(I=T(I)),I instanceof l?I.format():l.prototype.format.call(I)},s.Url=l;var o=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",` `," "]),g=["'"].concat(f),v=["%","/","?",";","#"].concat(g),m=["/","?","#"],w=/^[+a-z0-9A-Z_-]{0,63}$/,y=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},A={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},C=i("querystring");function T(I,D,B){if(I&&r.isObject(I)&&I instanceof l)return I;var V=new l;return V.parse(I,D,B),V}l.prototype.parse=function(I,D,B){if(!r.isString(I))throw new TypeError("Parameter 'url' must be a string, not "+typeof I);var V=I.indexOf("?"),Q=V!==-1&&V127?ut+="x":ut+=et[ct];if(!ut.match(w)){var b=tt.slice(0,$),E=tt.slice($+1),S=et.match(y);S&&(b.push(S[1]),E.unshift(S[2])),E.length&&(R="/"+E.join(".")+R),this.hostname=b.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),U||(this.hostname=n.toASCII(this.hostname));var N=this.port?":"+this.port:"",X=this.hostname||"";this.host=X+N,this.href+=this.host,U&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),R[0]!=="/"&&(R="/"+R))}if(!_[Y])for($=0,at=g.length;$0)&&B.host.split("@"))&&(B.auth=S.shift(),B.host=B.hostname=S.shift())),B.search=I.search,B.query=I.query,r.isNull(B.pathname)&&r.isNull(B.search)||(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.href=B.format(),B;if(!et.length)return B.pathname=null,B.search?B.path="/"+B.search:B.path=null,B.href=B.format(),B;for(var ct=et.slice(-1)[0],ot=(B.host||I.host||et.length>1)&&(ct==="."||ct==="..")||ct==="",b=0,E=et.length;E>=0;E--)(ct=et[E])==="."?et.splice(E,1):ct===".."?(et.splice(E,1),b++):b&&(et.splice(E,1),b--);if(!tt&&!at)for(;b--;b)et.unshift("..");!tt||et[0]===""||et[0]&&et[0].charAt(0)==="/"||et.unshift(""),ot&&et.join("/").substr(-1)!=="/"&&et.push("");var S,N=et[0]===""||et[0]&&et[0].charAt(0)==="/";return ut&&(B.hostname=B.host=N?"":et.length?et.shift():"",(S=!!(B.host&&B.host.indexOf("@")>0)&&B.host.split("@"))&&(B.auth=S.shift(),B.host=B.hostname=S.shift())),(tt=tt||B.host&&et.length)&&!N&&et.unshift(""),et.length?B.pathname=et.join("/"):(B.pathname=null,B.path=null),r.isNull(B.pathname)&&r.isNull(B.search)||(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.auth=I.auth||B.auth,B.slashes=B.slashes||I.slashes,B.href=B.format(),B},l.prototype.parseHost=function(){var I=this.host,D=u.exec(I);D&&((D=D[0])!==":"&&(this.port=D.substr(1)),I=I.substr(0,I.length-D.length)),I&&(this.hostname=I)}},{"./util":77,punycode:51,querystring:54}],77:[function(i,a,s){a.exports={isString:function(n){return typeof n=="string"},isObject:function(n){return typeof n=="object"&&n!==null},isNull:function(n){return n===null},isNullOrUndefined:function(n){return n==null}}},{}],78:[function(i,a,s){(function(n){(function(){function r(l){try{if(!n.localStorage)return!1}catch{return!1}var o=n.localStorage[l];return o!=null&&String(o).toLowerCase()==="true"}a.exports=function(l,o){if(r("noDeprecation"))return l;var u=!1;return function(){if(!u){if(r("throwDeprecation"))throw new Error(o);r("traceDeprecation")?console.trace(o):console.warn(o),u=!0}return l.apply(this,arguments)}}}).call(this)}).call(this,typeof Be<"u"?Be:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,a,s){a.exports=function n(r,l){if(r&&l)return n(r)(l);if(typeof r!="function")throw new TypeError("need wrapper function");return Object.keys(r).forEach(function(u){o[u]=r[u]}),o;function o(){for(var u=new Array(arguments.length),c=0;c0)for(var g=0,v=arguments.length;g1)g=f;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");v=this.head.next,g=this.head.value}for(var m=0;v!==null;m++)g=c(g,v.value,m),v=v.next;return g},n.prototype.reduceReverse=function(c,f){var g,v=this.tail;if(arguments.length>1)g=f;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");v=this.tail.prev,g=this.tail.value}for(var m=this.length-1;v!==null;m--)g=c(g,v.value,m),v=v.prev;return g},n.prototype.toArray=function(){for(var c=new Array(this.length),f=0,g=this.head;g!==null;f++)c[f]=g.value,g=g.next;return c},n.prototype.toArrayReverse=function(){for(var c=new Array(this.length),f=0,g=this.tail;g!==null;f++)c[f]=g.value,g=g.prev;return c},n.prototype.slice=function(c,f){(f=f||this.length)<0&&(f+=this.length),(c=c||0)<0&&(c+=this.length);var g=new n;if(fthis.length&&(f=this.length);for(var v=0,m=this.head;m!==null&&vthis.length&&(f=this.length);for(var v=this.length,m=this.tail;m!==null&&v>f;v--)m=m.prev;for(;m!==null&&v>c;v--,m=m.prev)g.push(m.value);return g},n.prototype.splice=function(c,f,...g){c>this.length&&(c=this.length-1),c<0&&(c=this.length+c);for(var v=0,m=this.head;m!==null&&v'},info:{color:"#0052d9",icon:''},warning:{color:"#e37318",icon:''},error:{color:"#d54941",icon:''},question:{color:"#0052d9",icon:''}},Je={};class _E{constructor(t,i){W(this,"parentElement");W(this,"box");W(this,"icon");W(this,"text");W(this,"closeBtn");W(this,"duration");W(this,"content");W(this,"theme");W(this,"placement");W(this,"height");W(this,"id");var s;this.parentElement=t,this.box=document.createElement("div"),this.icon=document.createElement("div"),this.text=document.createElement("div"),this.box.className="meta2d-message",this.icon.className="icon",this.text.className="text",this.icon.innerHTML=Vf[i.theme||"info"].icon,this.text.innerHTML=i.content,this.box.appendChild(this.icon),this.box.appendChild(this.text),i.closeBtn&&(this.closeBtn=document.createElement("div"),this.closeBtn.className="close",this.closeBtn.innerHTML="x",this.closeBtn.onclick=()=>{this.close()},this.box.appendChild(this.closeBtn)),t.appendChild(this.box);let a;for(let n=0;n{this.close()},this.duration);let t=-1;Object.keys(Je).forEach(i=>{var a;((a=Je[i])==null?void 0:a.placement)===this.placement&&t++}),this.setPosition(this.placement,t),this.icon.children[0].style.fill=Vf[this.theme].color}setPosition(t,i=0){switch(t){case"top":this.box.style.top=`${30+i*(this.height||60)}px`,this.box.style.left="50%";break;case"bottom":this.box.style.bottom=`${30+i*(this.height||60)}px`,this.box.style.left="50%";break;case"left":this.box.style.top=`${30+i*(this.height||60)}px`,this.box.style.left="30px";break;case"right":this.box.style.top=`${30+i*(this.height||60)}px`,this.box.style.right="30px";break}}close(){Object.keys(Je).forEach(t=>{var i;if(((i=Je[t])==null?void 0:i.placement)===this.placement)switch(this.placement){case"top":case"left":case"right":Je[t].box.style.top=parseInt(Je[t].box.style.top)-60+"px";break;case"bottom":Je[t].box.style.bottom=parseInt(Je[t].box.style.bottom)-60+"px";break}}),Je[this.id]=null,delete Je[this.id],this.box.remove()}}function EE(e,t){if(e.jetLinksList.length){let i=t.url;i.startsWith("/")&&(i=(location.protocol==="https:"?"wss://":"ws://")+window.location.host+i),e.jetLinksClient=new WebSocket(`${i}/${localStorage.getItem("X-Access-Token")||gn("X-Access-Token")||new URLSearchParams(location.search).get("X-Access-Token")||""}`),e.jetLinksClient.onmessage=a=>{var n;const s=JSON.parse(a.data);if(!!s.payload)if((n=s.payload)!=null&&n.properties){const r=[];for(let l in s.payload.properties)r.push({id:`${s.payload.headers.productId}#${s.payload.deviceId}#${l}`,value:s.payload.properties[l]});e.setDatas(r,{history:!1})}else s.topic.startsWith("/notifications")&&Eg(e,s)},e.jetLinksClient.onopen=()=>{e.jetLinksList.forEach(a=>{e.jetLinksClient.send(JSON.stringify({type:"sub",topic:`/device${a.topic}/message/property/report`,parameter:{deviceId:a.deviceId,properties:a.properties,history:1},id:a.topic+"-"+St()}))}),t.notification&&e.jetLinksClient.send(JSON.stringify({type:"sub",topic:"/notifications",id:"notification",parameter:{}}))}}}function Eg(e,t){var r,l;let i=t.payload.topicName,a=t.payload.message,s=t.payload.notifyTime,n=`
${i}
${AE(s)}
${a}
`;e.message({content:n,duration:0,closeBtn:!0,placement:"right",height:75}),(r=t.payload.detail)!=null&&r.alarmConfigId&&RE(e,(l=t.payload.detail)==null?void 0:l.alarmConfigId)}globalThis.doWarning=Eg;function AE(e){const t=new Date(e),i=t.getFullYear(),a=(t.getMonth()+1+"").padStart(2,"0"),s=(t.getDate()+"").padStart(2,"0"),n=(t.getHours()+"").padStart(2,"0"),r=(t.getMinutes()+"").padStart(2,"0"),l=(t.getSeconds()+"").padStart(2,"0");return i+"-"+a+"-"+s+" "+n+":"+r+":"+l}function kE(e){e.jetLinksClient&&(e.jetLinksClient.close(),e.jetLinksClient=void 0)}function CE(e,t,i){const a=[];return i.list.forEach((s,n)=>{var l,o,u;const r=s.params?e.findOne(s.params):t;a[n]={deviceId:r.deviceId,productId:r.productId,properties:{}};for(let c in s.value)if(s.value[c]===void 0||s.value[c]===""){const f=(l=r.realTimes)==null?void 0:l.find(g=>g.propertyId===c);f&&(a[n].properties[c]=r[f.key])}else if(typeof s.value[c]=="string"&&((o=s.value[c])==null?void 0:o.indexOf("${"))>-1){let f=s.value[c].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));f!=null&&f.length&&(a[n].properties[c]=(u=r[f[0]])!=null?u:e.getDynamicParam(f[0]))}else a[n].properties[c]=s.value[c]}),a}async function FE(e,t){t.forEach(async i=>{let a=i.deviceId;if(a&&a.indexOf("${")>-1){let n=a.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));n!=null&&n.length&&(a=e.getDynamicParam(n[0])||a)}(await fetch(`/api/device-instance/${a}/property`,{headers:{"X-Access-Token":localStorage.getItem("X-Access-Token")||new URLSearchParams(location.search).get("X-Access-Token")||"","Content-Type":"application/json"},method:"put",body:JSON.stringify(i.properties)})).ok?(console.info("\u53D1\u9001\u6210\u529F"),e.message({theme:"success",content:"\u4E0B\u53D1\u6210\u529F"})):e.message({theme:"error",content:"\u4E0B\u53D1\u5931\u8D25"})})}async function RE(e,t){const i=await fetch(`/api/alarm/config/${t}`,{headers:{"X-Access-Token":localStorage.getItem("X-Access-Token")||new URLSearchParams(location.search).get("X-Access-Token")||"","Content-Type":"application/json"},method:"GET"});if(i.ok){let a=await i.json();a.result.media&&Ag(e,a.result.media,a.result.playTimes)}}function Ag(e,t,i){if(e.store.globalAudio||(e.store.globalAudio=document.createElement("audio")),e.store.globalAudio.src=t,e.store.globalAudio.play(),i===-1)e.store.globalAudio.loop=!0;else{e.store.globalAudio.loop=!1;let a=0;e.store.globalAudio.onended=()=>{a++,a{this.store.data.lineAnimateDraws[t]=i,Et.lineAnimateDraws[t]=new Function("ctx","pen","state","index",i)});W(this,"websocketTimes",0);W(this,"mqttTimes",0);W(this,"httpTimer");W(this,"httpTimerList",[]);W(this,"updateTimer");W(this,"updateTimerList",[]);W(this,"sqlTimerList",[]);W(this,"iotMqttClient");W(this,"iotTimer");W(this,"iotWebsocketClient");W(this,"onEvent",(t,i)=>{switch(t){case"add":i.forEach(a=>{var s;(s=a.onAdd)==null||s.call(a,a)}),this.onSizeUpdate();break;case"enter":i&&i.onMouseEnter&&i.onMouseEnter(i,this.canvas.mousePos),this.store.data.locked&&this.doEvent(i,t);break;case"leave":i&&i.onMouseLeave&&i.onMouseLeave(i,this.canvas.mousePos),this.store.data.locked&&this.doEvent(i,t);break;case"active":case"inactive":this.store.data.locked&&i.forEach(a=>{this.doEvent(a,t)});break;case"click":if(this.store.data.locked&&i.pen&&!i.pen.disabled&&i.pen.switch&&(i.pen.checked=!i.pen.checked,i.pen.calculative.checked=i.pen.checked,i.pen.calculative.gradient=void 0,i.pen.calculative.radialGradient=void 0),i.pen&&i.pen.formId){const a=this.store.pens[i.pen.formId];i.pen.formType==="submit"?this.store.data.locked&&a&&!a.disabled&&this.doEvent(a,"submit"):i.pen.formType==="reset"&&(lE(i.pen),this.store.data.locked&&a&&!a.disabled&&this.doEvent(a,"reset"))}i.pen&&i.pen.onClick&&!i.pen.disabled&&i.pen.onClick(i.pen,this.canvas.mousePos),this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"contextmenu":i.pen&&i.pen.onContextmenu&&!i.pen.disabled&&i.pen.onContextmenu(i.pen,this.canvas.mousePos),this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"mousedown":i.pen&&i.pen.onMouseDown&&!i.pen.disabled&&i.pen.onMouseDown(i.pen,this.canvas.mousePos),this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"mouseup":i.pen&&i.pen.onMouseUp&&!i.pen.disabled&&i.pen.onMouseUp(i.pen,this.canvas.mousePos),this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"dblclick":this.store.data.locked&&i.pen&&!i.pen.disabled&&this.doEvent(i.pen,t);break;case"valueUpdate":i&&Wf(i,i.formValue),this.store.data.locked&&this.doEvent(i,t),this.canvas.tooltip.updateText(i);break;case"update":case"delete":case"translatePens":case"rotatePens":case"resizePens":this.onSizeUpdate();break;case"navigator":this.store.data.id||console.warn("\u8BF7\u5148\u4FDD\u5B58\u5F53\u524D\u56FE\u7EB8"),this.navigatorTo(i.params);break;case"input":this.store.data.locked&&i&&!i.disabled&&this.doEvent(i,t);break;case"change":i.pen&&Wf(i.pen),i.pen?this.store.data.locked&&!i.pen.disabled&&this.doEvent(i.pen,t):this.store.data.locked&&i&&!i.disabled&&this.doEvent(i,t);break}this.doMessageEvent(t,i)});W(this,"doEvent",(t,i)=>{var n,r,l,o,u,c,f,g,v,m;if(!t)return;let a=!1,s=[];if((n=t.events)==null||n.forEach((w,y)=>{var _;if(w.actions&&w.actions.length){if(w.name===i){let A=!1;w.conditions&&w.conditions.length?w.conditionType==="and"?A=w.conditions.every(x=>this.judgeCondition(t,x.key,x)):w.conditionType==="or"&&(A=w.conditions.some(x=>this.judgeCondition(t,x.key,x))):A=!0,A&&s.push(y)}}else if(a=!0,this.events[w.action]&&w.name===i){let A=!((_=w.where)!=null&&_.type);if(w.where){const{fn:x,fnJs:C,comparison:T,key:I,value:D}=w.where;if(x)A=x(t,{meta2d:this});else if(C){try{w.where.fn=new Function("pen","context",C)}catch(B){console.error("Error: make function:",B)}w.where.fn&&(A=w.where.fn(t,{meta2d:this}))}else{let B=t[I];switch(["x","y","width","height"].includes(I)&&(B=this.getPenRect(t)[I]),T){case">":A=B>+D;break;case">=":A=B>=+D;break;case"<":A=B<+D;break;case"<=":A=B<=+D;break;case"=":case"==":A=B==D;break;case"!=":A=B!=D;break;case"[)":A=us(+B,D);break;case"![)":A=!us(+B,D);break;case"[]":A=fs(B,D);break;case"![]":A=!fs(B,D);break}}}A&&s.push(y)}}),a?(r=t.events)==null||r.forEach((w,y)=>{s.includes(y)&&this.events[w.action](t,w)}):(l=t.events)==null||l.forEach(async(w,y)=>{if(s.includes(y)){if(w.confirm&&!await this.canvas.popconfirm.showModal(t,this.canvas.mousePos,w.confirmTitle))return;w.actions.forEach(_=>{if(_.timeout){let A=setTimeout(()=>{this.events[_.action]&&(this.events[_.action](t,_),clearTimeout(A),A=null)},_.timeout)}else this.events[_.action]&&this.events[_.action](t,_)})}}),i==="valueUpdate"){(o=t.realTimes)==null||o.forEach(y=>{var A,x;let _=[];(A=y.triggers)==null||A.forEach((C,T)=>{var D;let I=!1;(D=C.conditions)!=null&&D.length?C.conditionType==="and"?I=C.conditions.every(B=>this.judgeCondition(t,y.key,B)):C.conditionType==="or"&&(I=C.conditions.some(B=>this.judgeCondition(t,y.key,B))):I=!0,I&&_.push(T)}),(x=y.triggers)==null||x.forEach((C,T)=>{var I;_.includes(T)&&((I=C.actions)==null||I.forEach(D=>{if(D.timeout){let B=setTimeout(()=>{this.events[D.action]&&(this.events[D.action](t,D),clearTimeout(B),B=null)},D.timeout)}else this.events[D.action](t,D)}))})});let w=[];if((u=this.store.globalTriggers[t.id])==null||u.forEach((y,_)=>{var x;let A=!1;(x=y.conditions)!=null&&x.length?y.conditionType==="and"?A=y.conditions.every(C=>this.judgeCondition(this.store.pens[C.source],C.key,C)):y.conditionType==="or"&&(A=y.conditions.some(C=>this.judgeCondition(this.store.pens[C.source],C.key,C))):A=!0,A&&w.push(_)}),(c=this.store.globalTriggers[t.id])==null||c.forEach((y,_)=>{var A;w.includes(_)&&((A=y.actions)==null||A.forEach(x=>{if(x.timeout){let C=setTimeout(()=>{this.events[x.action]&&(this.events[x.action](t,x),clearTimeout(C),C=null)},x.timeout)}else this.events[x.action](t,x)}))}),(f=t.triggers)!=null&&f.length){for(let y of t.triggers)if((g=y.status)!=null&&g.length)for(let _ of y.status){let A=!1;if((v=_.conditions)!=null&&v.length?_.conditionType==="and"?A=_.conditions.every(x=>this.judgeCondition(t,x.key,x)):_.conditionType==="or"&&(A=_.conditions.some(x=>this.judgeCondition(t,x.key,x))):A=!0,A){(m=_.actions)==null||m.forEach(x=>{if(x.timeout){let C=setTimeout(()=>{this.events[x.action]&&(this.events[x.action](t,x),clearTimeout(C),C=null)},x.timeout)}else this.events[x.action](t,x)});break}}}}this.doEvent(this.store.pens[t.parentId],i)});W(this,"doDataEvent",t=>{var s,n,r;if(!((s=this.store.data.dataEvents)!=null&&s.length))return;const i=t.reduce((l,{dataId:o,id:u,value:c})=>(l[u||o]=c,l),{});let a=[];(n=this.store.data.dataEvents)==null||n.forEach((l,o)=>{let u=!1;l.conditions&&l.conditions.length?l.conditionType==="and"?u=l.conditions.every(c=>this.dataJudegeCondition(i,c.key,c)):l.conditionType==="or"&&(u=l.conditions.some(c=>this.dataJudegeCondition(i,c.key,c))):u=!0,u&&a.push(o)}),(r=this.store.data.dataEvents)==null||r.forEach((l,o)=>{var u;a.includes(o)&&((u=l.actions)==null||u.forEach(c=>{this.events[c.action](i,c)}))})});W(this,"renderPenRaw",$r);W(this,"setElemPosition",Fe);W(this,"setLifeCycleFunc",H2);this.store=Wx(St()),this.setOptions(i),this.setDatabyOptions(i),this.init(t),this.register(wE()),this.registerCanvasDraw({cube:w_}),this.registerAnchors(bE()),globalThis.meta2d=this,this.initEventFns(),this.store.emitter.on("*",this.onEvent)}get beforeAddPen(){return this.canvas.beforeAddPen}set beforeAddPen(t){this.canvas.beforeAddPen=t}get beforeAddPens(){return this.canvas.beforeAddPens}set beforeAddPens(t){this.canvas.beforeAddPens=t}get beforeAddAnchor(){return this.canvas.beforeAddAnchor}set beforeAddAnchor(t){this.canvas.beforeAddAnchor=t}get beforeRemovePens(){return this.canvas.beforeRemovePens}set beforeRemovePens(t){this.canvas.beforeRemovePens=t}get beforeRemoveAnchor(){return this.canvas.beforeRemoveAnchor}set beforeRemoveAnchor(t){this.canvas.beforeRemoveAnchor=t}setOptions(t={}){var i,a;(t.grid!==void 0||t.gridColor!==void 0||t.gridSize!==void 0)&&this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),(t.rule!==void 0||t.ruleColor!==void 0||t.ruleOptions!==void 0)&&(this.store.patchFlagsTop=!0,t.ruleOptions&&(i=this.store.options)!=null&&i.ruleOptions&&(Object.assign(this.store.options.ruleOptions,t.ruleOptions),t.ruleOptions=this.store.options.ruleOptions)),t.background!==void 0&&this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),t.resizeMode!==void 0&&(t.resizeMode||(this.canvas.hotkeyType=Yt.None)),(t.width!==void 0||t.height!==void 0)&&(this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0),this.canvas&&this.canvas.canvasTemplate.canvas.style.backgroundImage&&(this.canvas.canvasTemplate.canvas.style.backgroundImage="")),this.store.options=Object.assign(this.store.options,t),this.canvas&&t.scroll!==void 0&&(t.scroll?(!this.canvas.scroll&&(this.canvas.scroll=new wg(this.canvas)),this.canvas.scroll.show()):this.canvas.scroll&&this.canvas.scroll.hide()),(a=this.canvas)==null||a.initGlobalStyle()}getOptions(){return this.store.options}registerTheme(t,i){if(!Array.isArray(i))return;const a=/^\s*\S+\s*:\s*\S+\s*$/;if(!i.every(l=>a.test(l)))return;const n={},r=[];for(let l=0;l{var a,s;if(window&&i.value&&typeof i.value=="string"){let n=i.value;if(n.includes("${")){let r=(a=n.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(l=>l.slice(2,-1));r&&(r==null||r.forEach(l=>{n=n.replace(`\${${l}}`,t[l]||this.getDynamicParam(l))}))}window.open(n,(s=i.params)!=null?s:"_blank");return}console.warn("[meta2d] Link param is not a string")},this.events[he.SetProps]=(t,i)=>{var s,n,r;const a=i.value;if(a&&typeof a=="object"){const l=i.params?this.find(i.params):this.find(t.id),o={};for(let u in a)if((s=a[u])!=null&&s.id)o[u]=(n=this.store.pens[a[u].id])==null?void 0:n[a[u].key];else if(typeof a[u]=="string"&&a[u].includes("${")){let c=a[u],f=(r=c.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(g=>g.slice(2,-1));f&&f.forEach(g=>{c=c.replace(`\${${g}}`,t[g]||this.getDynamicParam(g))}),o[u]=c}else o[u]=a[u];l.forEach(u=>{o.hasOwnProperty("visible")&&u.visible!==o.visible&&this.setVisible(u,o.visible),this.setValue({id:u.id,...o},{render:!1,doEvent:!1})}),this.render();return}console.warn("[meta2d] SetProps value is not an object")},this.events[he.StartAnimate]=(t,i)=>{let a=t;if(i.value&&(a=this.findOne(i.value)),!(this.store.animates.has(a)&&!a.calculative.pause&&a.animateName===i.params)){if(i.targetType&&i.params){this.startAnimate(i.value||[t],i.params);return}if(!i.value||typeof i.value=="string"){this.startAnimate(i.value||[t]);return}console.warn("[meta2d] StartAnimate value is not a string")}},this.events[he.PauseAnimate]=(t,i)=>{if(!i.value||typeof i.value=="string"){this.pauseAnimate(i.value||[t]);return}console.warn("[meta2d] PauseAnimate value is not a string")},this.events[he.StopAnimate]=(t,i)=>{if(!i.value||typeof i.value=="string"){if(i.value){let a=this.findOne(i.value);if(!this.store.animates.has(a))return}else if(!this.store.animates.has(t))return;this.stopAnimate(i.value||[t]);return}console.warn("[meta2d] StopAnimate event value is not a string")},this.events[he.StartVideo]=(t,i)=>{if(!i.value||typeof i.value=="string"){this.startVideo(i.value||[t]);return}console.warn("[meta2d] StartVideo value is not a string")},this.events[he.PauseVideo]=(t,i)=>{if(!i.value||typeof i.value=="string"){this.pauseVideo(i.value||[t]);return}console.warn("[meta2d] PauseVideo value is not a string")},this.events[he.StopVideo]=(t,i)=>{if(!i.value||typeof i.value=="string"){this.stopVideo(i.value||[t]);return}console.warn("[meta2d] StopVideo event value is not a string")},this.events[he.JS]=(t,i,a)=>{var s;if(i.value&&!i.fn)try{if(typeof i.value!="string")throw new Error("[meta2d] Function value must be string");const n=i.value;i.fn=new Function("pen","params","context",n)}catch(n){console.error("[meta2d]: Error on make a function:",n)}(s=i.fn)==null||s.call(i,t,a||i.params,{meta2d:this,eventName:i.name})},this.events[he.GlobalFn]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] GlobalFn value must be a string");return}globalThis[i.value]&&globalThis[i.value](t,i.params)},this.events[he.Emit]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] Emit value must be a string");return}this.store.emitter.emit(i.value,{pen:t,params:i.params,eventName:i.name})},this.events[he.SendPropData]=(t,i)=>{const a=ht(i.value);if(a&&typeof a=="object"){const s=i.params?this.findOne(i.params):t;for(let n in a)(a[n]===void 0||a[n]==="")&&(a[n]=s[n]);a.id=s.id,this.doSendDataEvent(a,i.extend);return}console.warn("[meta2d] SendPropData value is not an object")},this.events[he.SendVarData]=(t,i)=>{const a=ht(i.value);if(a&&typeof a=="object"){const s=i.params?this.findOne(i.params):t;let n=[];for(let r in a){let l={dataId:r,value:a[r]};if(!l.value){let o=s.form.find(u=>u.dataIds&&u.dataIds.dataId===l.dataId);o&&(l.value=s[o.key])}n.push(l)}this.doSendDataEvent(n,i.extend);return}console.warn("[meta2d] SendVarData value is not an object")},this.events[he.Navigator]=(t,i)=>{i.value&&typeof i.value=="string"&&this.navigatorTo(i.value)},this.events[he.Dialog]=(t,i)=>{var a;if(i.params&&typeof i.params=="string"){let s=i.params;if(i.params.includes("${")){let r=(a=i.params.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(l=>l.slice(2,-1));r&&(r==null||r.forEach(l=>{s=s.replace(`\${${l}}`,t[l]||this.getDynamicParam(l))}))}Object.keys(i.extend).forEach(r=>{["x","y","width","height"].includes(r)||(s.indexOf("?")!==-1?s+=`&${r}=${i.extend[r]}`:s+=`?${r}=${i.extend[r]}`)});let n=this.getEventData(i.list,t);Object.keys(n).length&&(n=null),this.canvas.dialog.show(i.value,s,i.extend,n)}},this.events[he.SendData]=(t,i)=>{var s,n,r,l,o;if((s=i.data)!=null&&s.length){const u=this.getSendData(i.data);t.formId&&t.formData&&Object.assign(u,t.formData),this.sendDataToNetWork(u,t,i);return}if((n=i.list)!=null&&n.length){if(i.network&&i.network.protocol==="ADIIOT"){const c=CE(this,t,i);c.length&&FE(this,c);return}const u=this.getEventData(i.list,t);t.deviceId&&(u.deviceId=t.deviceId),t.formId&&t.formData&&Object.assign(u,t.formData),this.sendDataToNetWork(u,t,i);return}const a=ht(i.value);if(a&&typeof a=="object"&&i.targetType==="id"){const u=i.params?this.findOne(i.params):t;for(let c in a)if(a[c]===void 0||a[c]==="")a[c]=u[c];else if(typeof a[c]=="string"&&((r=a[c])==null?void 0:r.indexOf("${"))>-1){let f=(l=a[c].match(/\$\{([^}]+)\}/g))==null?void 0:l.map(g=>g.slice(2,-1));f!=null&&f.length&&(a[c]=(o=u[f[0]])!=null?o:this.getDynamicParam(f[0]))}u.deviceId&&(a.deviceId=u.deviceId),this.sendDataToNetWork(a,t,i);return}},this.events[he.PostMessage]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] Emit value must be a string");return}const a=i.params?this.findOne(i.params):t;if(a.name!=="iframe"||!a.iframe){console.warn("\u4E0D\u662F\u5D4C\u5165\u9875\u9762");return}let s=ws(a.iframe.split("?")[1]);const n=this.getEventData(i.list,a);a.calculative.singleton.div.children[0].contentWindow.postMessage(JSON.stringify({name:i.value,id:s.id,data:n}),"*")},this.events[he.PostMessageToParent]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] Emit value must be a string");return}const a=this.getEventData(i.list,t);window.parent.postMessage(JSON.stringify({name:i.value,data:a}),"*")},this.events[he.Message]=(t,i)=>{this.message({theme:i.params,content:i.value,...i.extend})}}getSendData(t){const i={};return t.forEach(a=>{var s;if(a.prop)if(a.id&&a.id!=="\u56FA\u5B9A\u503C"){const n=this.findOne(a.id);i[a.prop]=n[a.key]}else if(typeof a.value=="string"&&a.value.includes("${")){let n=a.value,r=(s=n.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(l=>l.slice(2,-1));r&&r.forEach(l=>{n=n.replace(`\${${l}}`,this.getDynamicParam(l))}),i[a.prop]=n}else i[a.prop]=this.convertType(a.value,a.type)}),i}convertType(t,i){if(typeof t=="string"){if(["switch","bool","boolean"].includes(i)){if(t==="false")return!1;if(t==="true")return!0}else if(["integer","number","int","enum","double","float"].includes(i)&&!isNaN(Number(t)))return Number(t)}return t}getEventData(t,i){const a={};return t!=null&&t.length&&t.forEach(s=>{var r,l,o;const n=s.params?this.findOne(s.params):i;for(let u in s.value)if(s.value[u]===void 0||s.value[u]==="")a[u]=n[u];else if(typeof s.value[u]=="string"&&((r=s.value[u])==null?void 0:r.indexOf("${"))>-1){let c=(l=s.value[u].match(/\$\{([^}]+)\}/g))==null?void 0:l.map(f=>f.slice(2,-1));c!=null&&c.length&&(a[u]=(o=n[c[0]])!=null?o:this.getDynamicParam(c[0]))}else a[u]=s.value[u]}),Object.keys(a).length?a:{}}message(t){new _E(this.canvas.parentElement,t).init()}closeAll(){for(let t in Je)Je[t].close()}async navigatorTo(t){var s;if(!t)return;if((s=ws())==null?void 0:s.id){const n=new URL(window.location);n.searchParams.set("id",t),history.pushState({},"",n)}const a=await $d(this.store,t);a&&(this.open(a),this.lock(1),this.fitView(!0,10))}doSendDataEvent(t,i){let a=JSON.stringify(t);this.mqttClient&&this.mqttClient.connected&&(i?i.split(",").forEach(s=>{this.mqttClient.publish(s,a)}):this.store.data.mqttTopics&&this.store.data.mqttTopics.split(",").forEach(s=>{this.mqttClient.publish(s,a)})),this.websocket&&this.websocket.readyState===1&&this.websocket.send(a),(this.store.data.https||this.store.data.http)&&this.sendDatabyHttp(a),this.store.emitter.emit("sendData",a)}async sendDataToNetWork(t,i,a){var n,r,l,o,u,c;const s=ht(a.network);if(s.data&&(Object.assign(s,s.data),delete s.data),s.protocol==="iot"){this.iotMqttClient&&this.iotMqttClient.publish(`le5le-iot/property/set/${(n=this.store.data.iot)==null?void 0:n.token}`,JSON.stringify(t));return}if(!!s.url){if(s.protocol==="http"){if(typeof s.headers=="object"){let m=JSON.stringify(s.headers),w=(r=m.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(y=>y.slice(2,-1));if(w!=null&&w.length)for(let y=0;ym+"="+t[m]).join("&")),s.method==="POST"&&g.indexOf("${")>-1){let m=(l=g.match(/\$\{([^}]+)\}/g))==null?void 0:l.map(w=>w.slice(2,-1));m&&m.forEach(w=>{g=g.replace(`\${${w}}`,ya(i,w)||this.getDynamicParam(w))})}const v=await fetch(g+(f||""),{headers:s.headers||{},method:s.method,body:s.method==="POST"?JSON.stringify(t):void 0});if(v.ok){if(a.callback){const m=await v.text();if(!a.fn)try{if(typeof a.callback!="string")throw new Error("[meta2d] Function callback must be string");const w=a.callback;a.fn=new Function("pen","data","context",w)}catch(w){console.error("[meta2d]: Error on make a function:",w)}(o=a.fn)==null||o.call(a,i,m,{meta2d:this,e:a})}console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F")}}else if(s.protocol==="mqtt"){const f=(u=this.mqttClients)==null?void 0:u.filter(g=>g.options.href===s.url);if(f&&f.length)f[0].connected&&s.topics.split(",").forEach(g=>{f[0].publish(g,JSON.stringify(t))});else{let g=en.exports.connect(s.url,s.options);g.on("connect",()=>{console.info("mqtt\u8FDE\u63A5\u6210\u529F"),s.topics.split(",").forEach(v=>{g.publish(v,JSON.stringify(t)),setTimeout(()=>{g==null||g.end()},1e3)})})}}else if(s.protocol==="websocket"){const f=(c=this.websockets)==null?void 0:c.filter(g=>g.url===s.url);if(f&&f.length)f[0].readyState===1&&f[0].send(JSON.stringify(t));else{let g=new WebSocket(s.url,s.protocols||void 0);g.onopen=function(){console.info("websocket\u8FDE\u63A5\u6210\u529F"),g.send(JSON.stringify(t)),setTimeout(()=>{g.close()},100)}}}}}resize(t,i){this.canvas.resize(t,i),this.render(),this.store.emitter.emit("resize",{width:t,height:i}),this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.init()}async addPen(t,i,a=!0,s=!1){return await this.canvas.addPen(t,i,a,s)}async addPens(t,i,a=!1){return await this.canvas.addPens(t,i,a)}render(t){var i;(i=this.canvas)==null||i.render(t)}async setBackgroundImage(t,i){var l,o,u,c;let a=this;async function s(f){return new Promise(g=>{const v=new Image;v.src=f,a.store.options.cdn&&!(f.startsWith("http")||f.startsWith("//")||f.startsWith("data:image"))&&(v.src=a.store.options.cdn+f),v.crossOrigin="anonymous",v.onload=()=>{g(v)}})}this.store.data.bkImage=t;const n=(i==null?void 0:i.width)||((l=this.store.data)==null?void 0:l.width)||((o=this.store.options)==null?void 0:o.width),r=(i==null?void 0:i.height)||((u=this.store.data)==null?void 0:u.height)||((c=this.store.options)==null?void 0:c.height);if(n&&r?(this.canvas.canvasTemplate.canvas.style.backgroundImage=null,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)):this.canvas.canvasTemplate.canvas.style.backgroundImage=t?`url('${t}')`:"",t){const f=await s(t);this.store.bkImg=f,n&&r&&this.canvas&&(this.canvas.canvasTemplate.init(),this.render())}else this.store.bkImg=null}setBackgroundColor(t=this.store.data.background){this.store.data.background=t,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)}setGrid({grid:t=this.store.data.grid,gridColor:i=this.store.data.gridColor,gridSize:a=this.store.data.gridSize,gridRotate:s=this.store.data.gridRotate}={}){this.store.data.grid=t,this.store.data.gridColor=i,this.store.data.gridSize=a<0?0:a,this.store.data.gridRotate=s,this.canvas&&(this.canvas.canvasTemplate.bgPatchFlags=!0)}setRule({rule:t=this.store.data.rule,ruleColor:i=this.store.data.ruleColor}={}){this.store.data.rule=t,this.store.data.ruleColor=i,this.store.patchFlagsTop=!0}open(t,i=!0){if(this.clear(!1,t==null?void 0:t.template),this.canvas.autoPolylineFlag=!0,t){t.theme&&this.setTheme(t.theme),this.setBackgroundImage(t.bkImage,t),Object.assign(this.store.data,t),this.store.data.pens=[];for(const a of t.pens)a.id||(a.id=St()),!a.calculative&&(a.calculative={canvas:this.canvas}),this.store.pens[a.id]=a;for(const a of t.pens)this.canvas.makePen(a)}if(this.canvas.patchFlagsLines.forEach(a=>{a.type&&this.canvas.initLineRect(a)}),this.store.data.template||(this.store.data.template=St()),i||(this.canvas.opening=!0),this.doInitJS(),this.initBindDatas(),this.initBinds(),this.doInitFn(),this.loadLineAnimateDraws(),this.initMessageEvents(),this.initGlobalTriggers(),this.startAnimate(),this.startVideo(),this.listenSocket(),this.connectSocket(),this.connectNetwork(),this.startDataMock(),this.canvas.initGlobalStyle(),this.render(),setTimeout(()=>{const a=this.store.data.pens.find(s=>s.autofocus);a&&this.focus(a.id)},100),this.store.data.iconUrls)for(const a of this.store.data.iconUrls)Kx(a,()=>{this.render()});this.canvas.autoPolylineFlag=!1,this.store.emitter.emit("opened"),this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.init()}dirtyData(t){const i=this.store.data.pens,a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height,n=[];for(let r=i.length-1;r>=0;r--){let l=i[r];if(l.parentId){const o=this.store.pens[l.parentId];(l.x>10||l.y>10||l.width>10||l.height>10||!o.children||!o.children.includes(l.id))&&n.push(l)}if(a&&s){let o=this.getPenRect(l);(o.x<-10||o.y<-10||o.x+o.width>a||o.y+o.height>s)&&n.push(l)}}return(!a||!s)&&N2(i).forEach(l=>{n.filter(u=>u.id===l.id).length||n.push(l)}),t&&this.active(n),n}clearDirtyData(){let t=this.dirtyData();this.delete(t,!0)}cacheData(t){if(t&&this.store.options.cacheLength){let i=this.store.cacheDatas.findIndex(a=>a.data&&a.data._id===t);if(i===-1)this.store.cacheDatas.push({data:ht(this.store.data,!0)}),this.store.cacheDatas.length>this.store.options.cacheLength&&this.store.cacheDatas.shift();else{let a=this.store.cacheDatas.splice(i,1)[0];this.store.cacheDatas.push(a)}}}loadCacheData(t){let i=this.store.cacheDatas.findIndex(a=>a.data&&a.data._id===t);i!==-1&&(this.store.data=this.store.cacheDatas[i].data,this.setBackgroundImage(this.store.data.bkImage),this.store.pens={},this.store.data.pens.forEach(a=>{a.calculative.canvas=this.canvas,this.store.pens[a.id]=a,Et.path2dDraws[a.name]&&this.store.path2dMap.set(a,Et.path2dDraws[a.name](a)),a.type&&this.store.path2dMap.set(a,Et.path2dDraws[a.name](a)),a.image&&(a.calculative.imageDrawed=!1,this.canvas.loadImage(a))}),this.render())}loadLineAnimateDraws(){Et.lineAnimateDraws={},Object.entries(this.store.data.lineAnimateDraws).forEach(([t,i])=>{Et.lineAnimateDraws[t]=new Function("ctx","pen","state","index",i)})}statistics(){const t=this.store.data.pens.length,i=this.store.data.pens.filter(l=>l.image).length,a=this.store.data.pens.filter(l=>l.image&&l.calculative.inView).length,s=this.store.data.pens.filter(l=>l.name.endsWith("Dom")||Od.includes(l.name)||this.store.options.domShapes.includes(l.name)||l.externElement).length,n=this.store.animates.size;let r=0;return Object.keys(this.store.bind).forEach(l=>{r+=this.store.bind[l].length}),Object.keys(this.store.bindDatas).forEach(l=>{r+=this.store.bindDatas[l].length}),{\u56FE\u5143\u603B\u6570\u91CF:t,\u56FE\u7247\u56FE\u5143\u6570\u91CF:i,\u56FE\u7247\u56FE\u5143\u7ED8\u5236\u6570\u91CF:a,dom\u56FE\u5143\u6570\u91CF:s,\u6B63\u5728\u6267\u884C\u7684\u52A8\u753B\u6570\u91CF:n,\u6570\u636E\u70B9\u6570\u91CF:r}}initBindDatas(){this.store.bindDatas={},this.store.data.pens.forEach(t=>{var i;(i=t.form)==null||i.forEach(a=>{let s;a.dataIds&&(Array.isArray(a.dataIds)?s=a.dataIds:s=[a.dataIds]),s==null||s.forEach(n=>{this.store.bindDatas[n.dataId]||(this.store.bindDatas[n.dataId]=[]),this.store.bindDatas[n.dataId].push({id:t.id,formItem:a})})})})}initBinds(){this.jetLinksList=[],this.store.bind={};const t=[],i=[];this.store.data.pens.forEach(a=>{var s,n;(s=a.realTimes)==null||s.forEach(r=>{if(r.bind&&r.bind.id){let l=r.productId||a.productId,o=r.deviceId||a.deviceId,u=r.propertyId,c=!1;if(l&&l.indexOf("${")>-1){let f=l.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));f!=null&&f.length&&(l=this.getDynamicParam(f[0])||l),c=!0}if(o&&o.indexOf("${")>-1){let f=o.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));f!=null&&f.length&&(o=this.getDynamicParam(f[0])||o),c=!0}if(u&&u.indexOf("${")>-1){let f=u.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));f!=null&&f.length&&(u=this.getDynamicParam(f[0])||u),c=!0}if(c&&r.bind&&(r.bind.id=l+"#"+o+"#"+u),this.store.bind[r.bind.id]||(this.store.bind[r.bind.id]=[]),this.store.bind[r.bind.id].push({id:a.id,key:r.key}),l&&o&&u){const f=this.jetLinksList.findIndex(g=>g.topic.startsWith(`/${l}/${o}`));f>-1?this.jetLinksList[f].properties.includes(r.propertyId)||this.jetLinksList[f].properties.push(r.propertyId):this.jetLinksList.push({topic:`/${l}/${o}`,deviceId:o,properties:[r.propertyId]})}if(r.bind.class==="iot"){let f=r.bind.id.split("#"),g=t.findIndex(m=>m.deviceId===f[0]);g>-1?t[g].properties.includes(f[1])||t[g].properties.push(f[1]):t.push({deviceId:f[0],properties:[f[1]],token:r.bind.token}),i.findIndex(m=>m.key===r.bind.id)===-1&&i.push({key:r.bind.id,label:r.bind.label})}else if(r.bind.class==="sql"){let f=r.bind.id.split("#");const g=this.store.data.sqls.find(v=>v.bindId===f[0]);if(g){g.keys||(g.keys=[]),f.shift();const v=f.join("#");g.keys.includes(v)||g.keys.push(v)}}}}),(n=a.events)==null||n.forEach(r=>{var o;const l=(o=r.actions)==null?void 0:o.filter(u=>u.action===he.SendData);l==null||l.forEach(u=>{var c;(c=u.data)==null||c.forEach(f=>{if(f.class==="iot"){let g=f.prop.split("#"),v=t.findIndex(m=>m.deviceId===g[0]);v>-1?t[v].properties.includes(g[1])||t[v].properties.push(g[1]):t.push({deviceId:g[0],properties:[g[1]],token:f.token})}})})})}),t.length&&(this.store.data.iot||(this.store.data.iot={}),this.store.data.iot.devices=t),i.length&&(this.store.data.iot.list=i)}connectSocket(){this.connectWebsocket(),this.connectMqtt(),this.connectHttp()}doInitJS(){const t=this.store.data.initJs;if(t&&t.trim())try{new Function("context",t)({meta2d:this})}catch(i){console.warn("initJs error",i)}}doInitFn(){let t=ws(),i=[];for(let a in t)t.hasOwnProperty(a)&&a.startsWith("bind-")&&i.push({id:a.replace("bind-",""),dataId:a.replace("bind-",""),value:t[a]});i.length&&this.setDatas(i,{history:!1})}drawLine(t){t&&bg(this.store),this.canvas.drawingLineName=t}alignPenToGrid(t){this.canvas.alignPenToGrid(t)}drawingPencil(){this.canvas.drawingPencil()}stopPencil(){this.canvas.stopPencil()}lock(t){this.store.data.locked=t,this.finishDrawLine(!0),this.canvas.drawingLineName="",this.stopPencil(),this.store.data.pens.forEach(i=>{var a;i.externElement===!0&&(a=i.calculative.singleton)!=null&&a.div&&Fe(i,i.calculative.singleton.div)}),t>0&&this.initMessageEvents()}async finishDrawLine(t){await this.canvas.finishDrawline(t)}async finishPencil(){await this.canvas.finishPencil()}updateLineType(t,i){if(!t||t.name!="line"||!i||!this.canvas[i])return;t.lineName=i;const a=le(t),s=Vt(t);a.prev=void 0,a.next=void 0,s.prev=void 0,s.next=void 0,t.calculative.worldAnchors=[a,s],t.calculative.activeAnchor=a,this.canvas[i](this.store,t,s),t.lineName==="curve"&&(a.prev={penId:a.penId,x:a.x-50,y:a.y},a.next={penId:a.penId,x:a.x+50,y:a.y},s.prev={penId:s.penId,x:s.x-50,y:s.y},s.next={penId:s.penId,x:s.x+50,y:s.y}),t.calculative.activeAnchor=void 0,this.canvas.initLineRect(t),this.render()}addDrawLineFn(t,i){this.canvas[t]=i,this.canvas.drawLineFns.push(t)}removeDrawLineFn(t){const i=this.canvas.drawLineFns.indexOf(t);i>-1&&this.canvas.drawLineFns.splice(i,1)}showMagnifier(){this.canvas.showMagnifier()}hideMagnifier(){this.canvas.hideMagnifier()}toggleMagnifier(){this.canvas.toggleMagnifier()}clear(t=!0,i){var a;for(const s of this.store.data.pens)(a=s.onDestroy)==null||a.call(s,s);Ux(this.store,i),this.hideInput(),this.canvas.tooltip.hide(),this.map&&this.map.isShow&&(this.map.show(),this.map.setView()),this.canvas.clearCanvas(),sessionStorage.removeItem("page"),this.store.clipboard=void 0,this.store.sameTemplate||(this.canvas.canvasTemplate.bgPatchFlags=!0),this.store.patchFlagsBackground=!0,this.store.patchFlagsTop=!0,this.setBackgroundImage(void 0),t&&this.render()}emit(t,i){this.store.emitter.emit(t,i)}on(t,i){return this.store.emitter.on(t,i),this}off(t,i){return this.store.emitter.off(t,i),this}updateLineAnimateDraws(t,i){!i||(delete this.store.data.lineAnimateDraws[t],delete Et.lineAnimateDraws[t],i!==-1&&this.registerLineAnimateDraws(i.name||t,i.code))}registerMoveDock(t){this.canvas.customMoveDock=t}registerResizeDock(t){this.canvas.customResizeDock=t}find(t){return this.canvas.find(t)}findOne(t){return this.canvas.findOne(t)}getPenRect(t){return this.canvas.getPenRect(t)}setPenRect(t,i,a=!0){this.canvas.setPenRect(t,i,a)}startAnimate(t,i){this.stopAnimate(t);let a;t?typeof t=="string"?a=this.find(t):a=t:a=this.store.data.pens.filter(s=>(s.type||s.frames)&&s.autoPlay||s.animations&&s.animations.length&&s.animations.findIndex(n=>n.autoPlay)!==-1),a.length&&(a.forEach(s=>{var n,r;if(s.calculative.pause){const l=Date.now()-s.calculative.pause;s.calculative.pause=void 0,s.calculative.frameStart+=l,s.calculative.frameEnd+=l}else{let l=-1;if(i!==void 0&&s.animations){if(typeof i=="string"){if(l=s.animations.findIndex(o=>o.name===i),l===-1)return}else if(typeof i=="number")if(s.animations.length>i)l=i;else return}else i===void 0&&(l=(n=s.animations)==null?void 0:n.findIndex(o=>o.autoPlay),l===-1&&((r=s.animations)==null?void 0:r.length)&&(l=0));if(l!==-1&&l!==void 0){const o=ht(s.animations[l]);o.animateName=o.name,delete o.name,o.currentAnimation=l,!s.type&&o.frames&&(o.showDuration=this.calcAnimateDuration(o)),this.setValue({id:s.id,...o},{doEvent:!1,history:!1})}this.store.animates.add(s),s.type||this.store.animateMap.set(s,s.calculative.canvas.getFrameProps(s))}}),this.initImageCanvas(a),this.canvas.animate())}pauseAnimate(t){let i=[];t?typeof t=="string"?i=this.find(t):i=t:this.store.animates.forEach(a=>{i.push(a)}),i.forEach(a=>{a.calculative.pause||(a.calculative.pause=Date.now())})}stopAnimate(t){let i=[];t?typeof t=="string"?i=this.find(t):i=t:this.store.animates.forEach(a=>{i.push(a)}),i.forEach(a=>{a.currentAnimation=void 0,a.calculative.pause=void 0,a.calculative.start=void 0,a.calculative.cycleStart=void 0,a.calculative.duration=void 0,a.calculative.animatePos=0,this.store.animates.delete(a),this.canvas.restoreNodeAnimate(a),this.canvas.updateLines(a),this.store.animateMap.delete(a)}),this.initImageCanvas(i),setTimeout(()=>{var a;(a=this.canvas)==null||a.calcActiveRect(),this.render()},20)}startVideo(t){let i;t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(a=>(a.video||a.audio)&&a.autoPlay),i.forEach(a=>{var s,n;(s=a.calculative.media)==null||s.play(),(n=a.onStartVideo)==null||n.call(a,a)})}pauseVideo(t){let i=[];t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(a=>(a.video||a.audio)&&a.autoPlay),i.forEach(a=>{var s,n;(s=a.calculative.media)==null||s.pause(),(n=a.onPauseVideo)==null||n.call(a,a)})}stopVideo(t){let i=[];t?typeof t=="string"?i=this.find(t):i=t:i=this.store.data.pens.filter(a=>(a.video||a.audio)&&a.autoPlay),i.forEach(a=>{var s;a.calculative.media&&(a.calculative.media.currentTime=0,a.calculative.media.pause()),(s=a.onStopVideo)==null||s.call(a,a)})}calcAnimateDuration(t){return t.frames.reduce((i,a)=>i+a.duration,0)}combine(t=this.store.active,i,a=!0){if(!t||!t.length)return;const s=ht(t);if(t.length===1&&t[0].type){t[0].type=$t.Node,this.canvas.active(t),this.pushHistory({type:bt.Update,initPens:s,pens:ht(t,!0)}),this.render();return}const n=hi(t);let r={id:St(),name:"combine",...n,children:[],showChild:i};this.canvas.makePen(r);const l=ht(r);let o=1/0;return t.forEach(u=>{var g;const c=this.store.data.pens.findIndex(v=>v.id===u.id);if(c{Yi(u,!0)}),this.initImageCanvas([r])),this.store.emitter.emit("combine",[r]),this.render(),r}uncombine(t){if(!t&&this.store.active&&(t=this.store.active[0]),!t||!t.children)return;const i=t.children.map(n=>this.store.pens[n]);let a=ht(i);i.forEach(n=>{n.parentId=void 0,n.x=n.calculative.worldRect.x,n.y=n.calculative.worldRect.y,n.width=n.calculative.worldRect.width,n.height=n.calculative.worldRect.height,n.locked=Mt.None,n.calculative.active=void 0,n.calculative.hover=!1,this.setVisible(n,!0)});const s=this.isCombine(t)?3:2;this.pushHistory({type:bt.Update,initPens:a,pens:i,step:s}),a=[ht(t)],t.children=void 0,this.pushHistory({type:bt.Update,initPens:a,pens:[t],step:s}),this.isCombine(t)&&(this.delete([t]),this.store.histories[this.store.histories.length-1].step=s),this.inactive()}clearCombine(t){if(!t&&this.store.active&&(t=this.store.active[0]),!t||!t.children)return;const i=Qe(t,this.store);i.forEach(s=>{s.parentId=void 0,s.x=s.calculative.worldRect.x,s.y=s.calculative.worldRect.y,s.width=s.calculative.worldRect.width,s.height=s.calculative.worldRect.height,s.locked=Mt.None,s.calculative.active=void 0,s.calculative.hover=!1,s.showChild!==void 0&&this.setVisible(s,!0),s.children=void 0});const a=[];i.forEach((s,n)=>{s.name==="combine"&&(s.children=void 0,a.push(s))}),this.delete(a,!0,!1),t.children=void 0,this.isCombine(t)&&this.delete([t],!0,!1),this.inactive()}appendChild(t=this.store.active){if(!t||t.length<2)return;const i=t.findIndex(a=>a.name==="combine"&&a.showChild!==void 0);if(i!==-1){let a=t[i];const s=hi(t);Object.assign(a,s),Object.assign(a.calculative.worldRect,s),As(a),a.children.forEach(n=>{const r=this.store.pens[n],l=fa(r.calculative.worldRect,s);Object.assign(r,l)}),t.forEach(n=>{var r;if(n.id!==a.id){a.children.push(n.id),n.parentId=a.id;const l=fa(n.calculative.worldRect,s);Object.assign(n,l),n.locked=(r=n.lockedOnCombine)!=null?r:Mt.DisableMove,n.locked=n.interaction||Cl.includes(n.name)?0:n.locked,Yi(n,!0)}}),this.initImageCanvas(t),this.render()}else console.warn("Invalid operation!")}updateRectbyChild(t,i,a){if(re(t),Qt(t),i.calculative.worldRect=t,a.container&&Xi(t,a.calculative.worldRect,!0)){const s=fa(t,a.calculative.worldRect);Object.assign(i,s)}else{if(a.container){let s=Math.min(t.x,a.calculative.worldRect.x),n=Math.min(t.y,a.calculative.worldRect.y),r=Math.max(t.ex,a.calculative.worldRect.ex),l=Math.max(t.ey,a.calculative.worldRect.ey);a.calculative.worldRect={x:s,y:n,width:r-s,height:l-n,ex:r,ey:l},Qt(a.calculative.worldRect)}else{const s=a.children.map(n=>this.store.pens[n]);a.calculative.worldRect=hi(s)}a.parentId||Object.assign(a,a.calculative.worldRect),a.children.forEach(s=>{const n=this.store.pens[s],r=fa(n.calculative.worldRect,a.calculative.worldRect);Object.assign(n,r)}),a.parentId&&this.updateRectbyChild(a.calculative.worldRect,a,this.store.pens[a.parentId])}this.canvas.updatePenRect(a),this.render()}isCombine(t){return!!(t.name==="combine"||t.children&&t.children.length>0)}active(t,i=!0){this.canvas.active(t,i)}inactive(){this.canvas.inactive()}activeAll(){this.canvas.active(this.store.data.pens.filter(t=>!t.parentId&&t.locked!==Mt.Disable)),this.render()}focus(t){const i=this.findOne(t);i&&(this.store.hover=i,this.store.hover.calculative.hover=!0,this.showInput(i))}delete(t,i=!1,a=!0){this.canvas.delete(t,i,a)}scale(t,i={x:0,y:0}){this.canvas.scale(t,i)}translate(t,i){this.canvas.translate(t,i)}translatePens(t,i,a){this.canvas.translatePens(t,i,a)}getParent(t,i){return ti(t,i)}getAllChildren(t){return Qe(t,this.store)}getAllFollowers(t){return mc(t,this.store)}data(){const t=ht(this.store.data),{pens:i,paths:a}=this.store.data;t.version=zd.version,t.paths={};for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.find(n=>n.pathId===s)&&(t.paths[s]=a[s]);return t.dataPoints=[...Object.keys(this.store.bind),...Object.keys(this.store.bindDatas)],t}copy(t){this.canvas.copy(t)}cut(t){this.canvas.cut(t)}paste(){this.canvas.paste()}undo(){this.canvas.undo()}redo(){this.canvas.redo()}listenSocket(){try{let t;const i=this.store.data.socketCbJs;if(i&&(t=new Function("e","context",i)),!t)return this.socketFn=null,!1;this.socketFn=t}catch(t){return console.error("Create the function for socket:",t),!1}return!0}connectWebsocket(t){this.closeWebsocket(),t&&(this.store.data.websocket=t),this.store.data.websocket&&(this.websocket=new WebSocket(this.store.data.websocket,this.store.data.websocketProtocols||void 0),this.websocket.onmessage=i=>{this.socketCallback(i.data,{type:"websocket",url:this.store.data.websocket})},this.websocket.onerror=i=>{this.store.emitter.emit("error",{type:"websocket",error:i})},this.websocket.onclose=()=>{if(this.store.options.reconnetTimes&&(this.websocketTimes++,this.websocketTimes>=this.store.options.reconnetTimes)){this.websocketTimes=0,this.closeWebsocket();return}console.info("Canvas websocket closed and reconneting..."),this.connectWebsocket()})}closeWebsocket(){this.websocket&&(this.websocket.onclose=void 0,this.websocket.close(),this.websocket=void 0)}connectMqtt(t){if(this.closeMqtt(),t&&(this.store.data.mqtt=t.mqtt,this.store.data.mqttTopics=t.mqttTopics,this.store.data.mqttOptions=t.mqttOptions),this.store.data.mqtt){this.store.data.mqttOptions.clientId&&!this.store.data.mqttOptions.customClientId&&(this.store.data.mqttOptions.clientId=St());const i={...this.store.data.mqttOptions};i.username||delete i.username,i.password||delete i.password;const{username:a,password:s}=i;a&&s||!a&&!s?(this.mqttClient=en.exports.connect(this.store.data.mqtt,i),this.mqttClient.on("message",(n,r)=>{this.socketCallback(r.toString(),{topic:n,type:"mqtt",url:this.store.data.mqtt})}),this.mqttClient.on("error",n=>{this.store.emitter.emit("error",{type:"mqtt",error:n})}),this.mqttClient.on("close",()=>{this.store.options.reconnetTimes&&(this.mqttTimes++,this.mqttTimes>=this.store.options.reconnetTimes&&(this.mqttTimes=0,this.closeMqtt()))}),this.store.data.mqttTopics&&this.mqttClient.subscribe(this.store.data.mqttTopics.split(","))):console.warn("\u7F3A\u5C11\u7528\u6237\u540D\u6216\u5BC6\u7801")}}closeMqtt(){var t;(t=this.mqttClient)==null||t.end()}connectHttp(){this.closeHttp();const{https:t}=this.store.data;if(t)this.store.data.cancelFirstConnect||t.forEach(async i=>{this.oldRequestHttp(i)}),t.forEach((i,a)=>{i.http&&i.httpTimeInterval!==0&&(i.times=0,this.httpTimerList[a]=setInterval(async()=>{this.oldRequestHttp(i),this.store.options.reconnetTimes&&i.times>=this.store.options.reconnetTimes&&(i.times=0,clearInterval(this.httpTimerList[a]),this.httpTimerList[a]=void 0)},i.httpTimeInterval||1e3))});else{const{http:i,httpTimeInterval:a,httpHeaders:s}=this.store.data;i&&(this.httpTimer=setInterval(async()=>{const n=await fetch(i,{headers:s});if(n.ok){const r=await n.text();this.socketCallback(r,{type:"http",url:i})}},a||1e3))}}async oldRequestHttp(t){let i=ht(t);if(i.http){const a=await fetch(i.http,{headers:i.httpHeaders,method:i.method||"GET",body:i.method==="POST"?JSON.stringify(i.body):void 0});if(a.ok){const s=await a.text();this.socketCallback(s,{type:"http",url:i.http})}else t.times++,this.store.emitter.emit("error",{type:"http",error:a})}}async sendDatabyHttp(t){const{https:i}=this.store.data;if(i)i.forEach(async a=>{a.http&&(await fetch(a.http,{method:"post",body:t,headers:a.httpHeaders})).ok&&console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F")});else{const{http:a,httpHeaders:s}=this.store.data;a&&(await fetch(a,{method:"post",body:t,headers:s})).ok&&console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F")}}closeHttp(){clearInterval(this.httpTimer),this.httpTimer=void 0,this.httpTimerList&&this.httpTimerList.forEach(t=>{clearInterval(t),t=void 0})}connectNetwork(){this.closeNetwork();const{networks:t}=this.store.data,i=[];if(t){let a=0,s=0,n=0,r=0;this.mqttClients=[],this.websockets=[],this.eventSources=[],t.forEach(async l=>{l.protocol==="mqtt"?(l.index=a,this.connectNetMqtt(l),a+=1):l.protocol==="websocket"?(l.index=n,this.connectNetWebSocket(l),n+=1):l.protocol==="http"?(l.index=s,i.push({url:l.url,interval:l.interval,headers:l.headers||void 0,method:l.method,body:l.body,enable:l.enable,index:l.index,once:l.once}),s+=1):l.protocol==="ADIIOT"?EE(this,l):l.protocol==="SSE"&&(l.index=r,this.connectSSE(l),r+=1)})}this.onNetworkConnect(i),this.connectIot(),this.connectSqls()}reconnectNetwork(t){var a,s;const i=this.store.data.networks[t];if(i.protocol==="mqtt")this.mqttClients&&((a=this.mqttClients[i.index])==null||a.end()),this.connectNetMqtt(i);else if(i.protocol==="websocket")this.websockets&&this.websockets[i.index]&&(this.websockets[i.index].onclose=void 0,this.websockets[i.index].close(),this.websockets[i.index]=void 0),this.connectNetWebSocket(i);else if(i.protocol==="http"){this.updateTimerList&&(clearInterval(this.updateTimerList[i.index]),this.updateTimerList[i.index]=void 0);const n=ht(i);this.store.data.cancelFirstConnect||this.requestHttp(n),this.updateTimerList[i.index]=setInterval(async()=>{this.requestHttp(n)},n.interval||1e3)}else i.protocol==="SSE"&&(this.eventSources&&((s=this.eventSources[i.index])==null||s.close(),this.eventSources[i.index]=void 0),this.connectSSE(i))}async connectIot(){var s;const{iot:t}=this.store.data;if(!(t&&((s=t==null?void 0:t.devices)==null?void 0:s.length))||t&&t.enable===!1)return;const i=globalThis.iotUrl||await this.getMqttUrl();if(!i){console.warn("iot Request address error");return}const a=await this.getIotToken(t.devices,t.protocol==="websocket"?1:void 0);t.token=a,this.iotMqttClient=en.exports.connect(i),this.iotMqttClient.on("message",(n,r)=>{this.socketCallback(r.toString(),{topic:`le5le-iot/properties/${a}`,type:"iot",url:i,method:"mqtt"})}),this.iotMqttClient.on("error",n=>{this.store.emitter.emit("error",{type:"mqtt",error:n})}),this.iotMqttClient.subscribe(`le5le-iot/properties/${a}`),this.iotTimer=setInterval(()=>{this.iotMqttClient&&this.iotMqttClient.publish("le5le-iot/subscribe/ping",a)},3e5)}closeIot(){if(this.iotMqttClient){const{iot:t}=this.store.data;t!=null&&t.token&&this.unsubscribeIot(t.token),this.iotMqttClient.end(),this.iotMqttClient=void 0}clearInterval(this.iotTimer),this.iotTimer=void 0}connectSqls(){const{sqls:t}=this.store.data;t&&t.length&&t.forEach(async(i,a)=>{i.enable!==!1&&(await this.doSqlCode(i),i.interval&&(i.index=a,this.sqlTimerList[a]=setInterval(async()=>{await this.doSqlCode(i)},i.interval)))})}connectSSE(t){t.enable!==!1&&(this.eventSources[t.index]=new EventSource(t.url,{withCredentials:t.withCredentials}),this.eventSources[t.index].onmessage=i=>{this.socketCallback(i.data,{type:"SSE",url:t.url,name:t.name,net:t})},this.eventSources[t.index].onerror=i=>{this.store.emitter.emit("error",{type:"SSE",error:i})})}closeSSE(){this.eventSources&&this.eventSources.forEach(t=>{t&&(t.close(),t=void 0)})}connectNetMqtt(t){var s,n,r,l;if(t.enable===!1)return;t.options.clientId&&!t.options.customClientId&&(t.options.clientId=St());let i=t.url;if(i.indexOf("${")>-1){let o=(s=i.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(u=>u.slice(2,-1));o&&o.forEach(u=>{i=i.replace(`\${${u}}`,this.getDynamicParam(u))})}t.times=0;let a=ht(t.options);if((a==null?void 0:a.username)&&a.username.includes("${")){let o=(n=a.username.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(u=>u.slice(2,-1));o&&o.forEach(u=>{a.username=a.username.replace(`\${${u}}`,this.getDynamicParam(u))})}if((a==null?void 0:a.password)&&a.password.includes("${")){let o=(r=a.password.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(u=>u.slice(2,-1));o&&o.forEach(u=>{a.password=a.password.replace(`\${${u}}`,this.getDynamicParam(u))})}if(this.mqttClients[t.index]=en.exports.connect(i,a),this.mqttClients[t.index].on("message",(o,u)=>{this.socketCallback(u.toString(),{topic:o,type:"mqtt",url:t.url,name:t.name,net:t})}),this.mqttClients[t.index].on("error",o=>{this.store.emitter.emit("error",{type:"mqtt",error:o})}),this.mqttClients[t.index].on("close",()=>{var o;this.store.options.reconnetTimes&&(t.times++,t.times>=this.store.options.reconnetTimes&&(t.times=0,this.mqttClients&&((o=this.mqttClients[t.index])==null||o.end())))}),t.topics){let o=t.topics;if(o.indexOf("${")>-1){let u=(l=o.match(/\$\{([^}]+)\}/g))==null?void 0:l.map(c=>c.slice(2,-1));u&&u.forEach(c=>{o=o.replace(`\${${c}}`,this.getDynamicParam(c))})}this.mqttClients[t.index].subscribe(o.split(","))}}connectNetWebSocket(t){var a,s;if(this.websockets[t.index]&&(this.websockets[t.index].onclose=void 0,(a=this.websockets[t.index])==null||a.close(),this.websockets[t.index]=void 0),t.enable===!1)return;let i=t.url;if(i.indexOf("${")>-1){let n=(s=i.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(r=>r.slice(2,-1));n&&n.forEach(r=>{i=i.replace(`\${${r}}`,this.getDynamicParam(r))})}this.websockets[t.index]=new WebSocket(i,t.protocols||void 0),this.websockets[t.index].onmessage=n=>{this.socketCallback(n.data,{type:"websocket",url:t.url,name:t.name,net:t})},this.websockets[t.index].onerror=n=>{this.store.emitter.emit("error",{type:"websocket",error:n})},this.websockets[t.index].onclose=()=>{var n;if(this.store.options.reconnetTimes&&(t.times++,t.times>=this.store.options.reconnetTimes)){t.times=0,this.websockets[t.index].onclose=void 0,(n=this.websockets[t.index])==null||n.close(),this.websockets[t.index]=void 0;return}setTimeout(()=>{console.info("Canvas websocket closed and reconneting..."),this.connectNetWebSocket(t)},2e3)}}async getMqttUrl(){const t=await fetch("/api/iot/app/mqtt",{method:"GET",headers:{Authorization:`Bearer ${Sr()}`}});if(t.ok){const i=await t.text();let a=JSON.parse(i);return a.wssPort||a.wsPort?`${location.protocol==="https:"?"wss":"ws"}://${a.host}:${location.protocol==="https:"?a.wssPort:a.wsPort}${a.path}`:void 0}}async getIotToken(t,i){const a=await fetch("/api/iot/subscribe/properties",{method:"POST",headers:{Authorization:`Bearer ${Sr()}`},body:JSON.stringify({devices:t,type:i})});if(a.ok){const s=await a.text();return JSON.parse(s).token}}async unsubscribeIot(t){return await fetch("/api/iot/unsubscribe/properties",{method:"POST",headers:{Authorization:`Bearer ${Sr()}`},body:JSON.stringify({token:t})})}async doSqlCode(t){var n;const i=t.method||"get";let a=t.sql;i==="list"&&(t.dbType==="oracle"?a.includes("OFFSET")||(a+=` OFFSET ${(t.current||1-1)*(t.pageSize||20)} ROWS FETCH NEXT ${t.pageSize||20} ROWS ONLY`):a.includes("LIMIT")||(a+=` LIMIT ${t.pageSize||20}`+(t.current>1?" OFFSET "+(t.current-1)*(t.pageSize||20):"")));const s=await fetch(`/api/iot/data/sql/${i}`,{method:"POST",headers:{Authorization:`Bearer ${gn("token")||localStorage.getItem("token")||new URLSearchParams(location.search).get("token")||""}`},body:JSON.stringify({dbId:t.dbId||t.dbid,sql:a})});if(s.ok){let r=await s.text();if(r){const l=[];if(r=JSON.parse(r),r.error){this.store.emitter.emit("error",{type:"sql",error:r.error});return}(n=t.keys)==null||n.forEach(o=>{l.push({id:t.bindId+"#"+o,value:ya(r,o.split("#").join("."))})}),l.push({id:t.bindId,value:r}),this.socketCallback(JSON.stringify(l),{type:"sql",url:`/api/iot/data/sql/${i}`,method:i})}}}randomString(t){t=t||32;let i="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",a=i.length,s="";for(let n=0;n{let n=this.mockValue(s);n!==void 0&&t.push({id:s.id,value:n})}),t.length&&this.setDatas(t,{render:!0,doEvent:!0,history:!1})}networkMock(){if(this.store.data.networks&&this.store.data.networks.length){let t=[];this.store.data.networks.forEach(i=>{var a;i.enable===!1&&((a=i.children)==null||a.forEach(s=>{let n=ht(s);n.enableMock=!0;let r=this.mockValue(n);r!==void 0&&t.push({id:s.id,value:r})}))}),t.length&&this.setDatas(t,{render:!0,doEvent:!0,history:!1})}}startDataMock(){this.store.data.enableMock?(this.stopDataMock(),this.initBinds(),this.updateTimer=setInterval(()=>{this.store.data.pens.forEach(i=>{this.penMock(i)}),this.networkMock(),this.render()},this.store.data.networkInterval||1e3)):this.stopDataMock()}stopDataMock(){clearInterval(this.updateTimer),this.updateTimer=void 0}penMock(t){var i;if(t.realTimes){let a={};if(t.realTimes.forEach(s=>{let n=this.mockValue(s);n!==void 0&&(a[s.key]=n)}),Object.keys(a).length){let s=t.onBeforeValue?t.onBeforeValue(t,a):a;this.canvas.updateValue(t,s),(i=t.onValue)==null||i.call(t,t),this.store.emitter.emit("valueUpdate",t)}}}penNetwork(t){const i={url:t.apiUrl,method:t.apiMethod,headers:t.apiHeaders,body:t.apiBody};this.requestHttp(i),t.apiEnable?(this.store.pensNetwork||(this.store.pensNetwork={}),this.store.pensNetwork[t.id]=i):delete this.store.pensNetwork[t.id]}getDynamicParam(t){return ws()[t]||localStorage[t]||gn(t)||globalThis[t]||""}onNetworkConnect(t){if(!!(t&&t.length)){if(this.store.pensNetwork)for(let i in this.store.pensNetwork)t.push(this.store.pensNetwork[i]);this.store.data.cancelFirstConnect||t.forEach(async i=>{i.enable!==!1&&this.requestHttp(i)}),t.forEach((i,a)=>{i.times=0,i.interval!==0&&i.enable!==!1&&(i.once?setTimeout(async()=>{this.requestHttp(i)},i.interval||1e3):this.updateTimerList[a]=setInterval(async()=>{this.requestHttp(i),this.store.options.reconnetTimes&&i.times>=this.store.options.reconnetTimes&&(i.times=0,clearInterval(this.updateTimerList[a]),this.updateTimerList[a]=void 0)},i.interval||1e3))})}}async requestHttp(t){var a,s,n;let i=ht(t);if(i.url){if(i.url.indexOf("${")>-1){let l=(a=i.url.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(o=>o.slice(2,-1));l&&l.forEach(o=>{i.url=i.url.replace(`\${${o}}`,this.getDynamicParam(o))})}if(typeof i.headers=="object"){let l=JSON.stringify(i.headers),o=(s=l.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(u=>u.slice(2,-1));if(o!=null&&o.length)for(let u=0;uu.slice(2,-1));if(o!=null&&o.length)for(let u=0;uu.protocol==="http")[i.index];this.socketCallback(l,{type:"http",url:i.url,name:i.name,net:o})}else t.times++,this.store.emitter.emit("error",{type:"http",error:r})}}closeNetwork(){this.mqttClients&&this.mqttClients.forEach(t=>{t.end()}),this.websockets&&this.websockets.forEach(t=>{t&&(t.onclose=void 0,t.close(),t=void 0)}),this.mqttClients=void 0,this.websockets=void 0,this.updateTimerList&&this.updateTimerList.forEach(t=>{clearInterval(t),t=void 0}),this.sqlTimerList&&this.sqlTimerList.forEach(t=>{clearInterval(t),t=void 0}),this.closeIot(),kE(this),this.closeSSE()}socketCallback(t,i){var n,r;this.store.emitter.emit("socket",{message:t,context:i});let a=t;if((n=i.net)!=null&&n.socketCbJs&&((r=i.net)!=null&&r.socketFn||(i.net.socketFn=new Function("e","context",i.net.socketCbJs)),i.net.socketFn)){if(a=i.net.socketFn(t,{meta2d:this,type:i.type,topic:i.topic,url:i.url,method:i.method}),!a)return;a&&a!==!0&&(t=a)}if(this.socketFn&&(a=this.socketFn(t,{meta2d:this,type:i.type,topic:i.topic,url:i.url,method:i.method}),!a))return;a===!0&&(a=t);let s;if(a.constructor===Object||a.constructor===Array)s=a;else if(typeof a=="string")try{s=JSON.parse(a)}catch(l){console.warn("Invalid socket data:",s,l)}else return;!s||(Array.isArray(s)||(s=[s]),s.length&&(s[0].dataId?this.setDatas(s):s.forEach(l=>{this.setValue(l)})))}setDatas(t,{render:i=!0,doEvent:a=!0,history:s}={}){const n=new Map;t.forEach(o=>{var u,c;(u=this.store.bindDatas[o.dataId])==null||u.forEach(f=>{const g=this.store.pens[f.id];if(!g)return;let v=n.get(g);if(!g.noOnBinds&&typeof g.onBinds=="function"){if(v)return;n.set(g,g.onBinds(g,t,f.formItem));return}v?v[f.formItem.key]=o.value:(v={id:f.id,[f.formItem.key]:o.value},n.set(g,v))}),(c=this.store.bind[o.id||o.dataId])==null||c.forEach(f=>{const g=this.store.pens[f.id];if(!g)return;let v=n.get(g);v?v[f.key]=o.value:(v={id:f.id,[f.key]:o.value},n.set(g,v))})}),this.store.data.locked&&this.doDataEvent(t);let r,l;s&&(r=[]),n.forEach((o,u)=>{this.setValue(o,{render:!1,doEvent:a,history:!1}),s&&(r.push(ht(u,!0)),l.push(u))}),i&&this.render(),s&&this.pushHistory({type:bt.Update,initPens:r,pens:l})}setValue(t,{render:i=!0,doEvent:a=!0,history:s}={}){let n=[];if(!t)return;if(t.id){if(t.id===this.store.data.id){this.setDatabyOptions(t),t.bkImage&&this.setBackgroundImage(t.bkImage),t.background&&this.setBackgroundColor(t.background),this.render();return}const l=this.store.pens[t.id];if(l)n=[l];else{let o=this.store.bind[t.id];if(o&&o.length){n=[],this.setDatas([t],{render:i,doEvent:a,history:s});return}}}else if(t.dataId){n=[],this.setDatas([t],{render:i,doEvent:a,history:s});return}else if(t.tag)n=this.find(t.tag);else{let l=[];for(let o in t)l.push({dataId:o,id:o,value:t[o]});l.length&&this.setDatas(l,{render:i,doEvent:a,history:s});return}s=s&&!this.store.data.locked;let r;if(s&&(r=ht(n)),n.forEach(l=>{var u;const o=l.onBeforeValue?l.onBeforeValue(l,t):t;t.frames&&(this.stopAnimate([l]),t.showDuration||(t.showDuration=t.frames.reduce((c,f)=>c+f.duration,0))),xc(l,o),this.canvas.updateValue(l,o),(u=l.onValue)==null||u.call(l,l)}),!this.store.data.locked&&this.store.active.length&&!this.canvas.movingPens&&this.canvas.calcActiveRect(),s){let l=ht(n);this.pushHistory({type:bt.Update,initPens:r,pens:l})}a&&n.forEach(l=>{this.store.emitter.emit("valueUpdate",l)}),i&&this.render()}_setValue(t,i=!1){this.setValue(t,{history:i,render:!1,doEvent:!1})}pushHistory(t){this.canvas.pushHistory(t)}showInput(t,i){this.canvas.showInput(t,i)}hideInput(){this.canvas.hideInput()}clearDropdownList(){this.canvas.clearDropdownList()}clearRuleLines(){this.canvas.clearRuleLines()}doMessageEvent(t,i){this.store.messageEvents[t]&&this.store.messageEvents[t].forEach(a=>{let s=!1;a.event.conditions&&a.event.conditions.length?a.event.conditionType==="and"?s=a.event.conditions.every(n=>this.judgeCondition(a.pen,n.key,n)):a.event.conditionType==="or"&&(s=a.event.conditions.some(n=>this.judgeCondition(a.pen,n.key,n))):s=!0,s&&a.event.actions.forEach(n=>{this.events[n.action](a.pen,n,i)})})}initGlobalTriggers(){var t;this.store.globalTriggers={},(t=this.store.data.triggers)==null||t.forEach(i=>{i.conditions.forEach(a=>{a.source&&(this.store.globalTriggers[a.source]||(this.store.globalTriggers[a.source]=[]),this.store.globalTriggers[a.source].includes(i)||this.store.globalTriggers[a.source].push(i))})})}initMessageEvents(){this.store.messageEvents={},this.store.data.pens.forEach(t=>{var i;(i=t.events)==null||i.forEach(a=>{a.name==="message"&&a.message&&(this.store.messageEvents[a.message]||(this.store.messageEvents[a.message]=[]),this.store.messageEvents[a.message].push({pen:t,event:a}))})})}dataJudegeCondition(t,i,a){const{type:s,target:n,fnJs:r,fn:l,operator:o,valueType:u}=a;let c=!1;if(s==="fn"){if(l)c=l(t,{meta2d:this});else if(r){try{a.fn=new Function("data","context",r)}catch(f){console.error("Error: make function:",f)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{let f=a.value;u==="prop"&&(f=t[a.value]);let g=t[i];switch(o){case">":c=g>+f;break;case">=":c=g>=+f;break;case"<":c=g<+f;break;case"<=":c=g<=+f;break;case"=":case"==":c=g==f;break;case"!=":c=g!=f;break;case"[)":c=us(+g,f);break;case"![)":c=!us(+g,f);break;case"[]":c=fs(g,f);break;case"![]":c=!fs(g,f);break}}return c}judgeCondition(t,i,a){const{type:s,target:n,fnJs:r,fn:l,operator:o,valueType:u}=a;let c=!1;if(s==="fn"){if(l)c=l(t,{meta2d:this});else if(r){try{a.fn=new Function("pen","context",r)}catch(f){console.error("Error: make function:",f)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{let f=a.value;u==="prop"&&(f=this.store.pens[n][a.value]);let g=ya(t,i);switch(["x","y","width","height"].includes(i)&&(g=this.getPenRect(t)[i]),o){case">":c=g>+f;break;case">=":c=g>=+f;break;case"<":c=g<+f;break;case"<=":c=g<=+f;break;case"=":case"==":c=g==f;break;case"!=":c=g!=f;break;case"[)":c=us(+g,f);break;case"![)":c=!us(+g,f);break;case"[]":c=fs(g,f);break;case"![]":c=!fs(g,f);break}}return c}pushChildren(t,i){const a=[ht(t,!0)],s=[];t.children||(t.children=[]);const n=[];i.forEach(l=>{var c;let o=ht(l,!0);if((!l.id||!this.store.pens[l.id])&&(this.canvas.makePen(l),o=null),l.parentId){const f=this.store.pens[l.parentId],g=f.children.findIndex(v=>v===l.id);a.push(ht(f,!0)),f.children.splice(g,1),n.push(ht(f,!0))}t.children.push(l.id),l.parentId=t.id;const u=fa(l.calculative.worldRect,t.calculative.worldRect);Object.assign(l,u),l.locked=(c=l.lockedOnCombine)!=null?c:Mt.DisableMove,l.locked=l.interaction||Cl.includes(l.name)?0:l.locked,o?(a.push(o),n.push(ht(l,!0))):s.push(ht(l,!0))}),n.push(ht(t,!0));let r=1;s.length&&(r=2,this.pushHistory({type:bt.Add,pens:s,step:r})),this.pushHistory({type:bt.Update,initPens:a,pens:n,step:r})}toPng(t,i,a=!1,s){return this.canvas.toPng(t,i,a,s)}activeToPng(t,i){return this.canvas.activeToPng(t,i)}pensToPng(t=this.store.active,i,a){return this.canvas.pensToPng(t,i,a)}downloadPng(t,i,a){var s;for(const n of this.store.data.pens)(n.calculative.img||["iframe"].includes(n.name))&&((s=n.onRenderPenRaw)==null||s.call(n,n));setTimeout(()=>{const n=document.createElement("a");n.setAttribute("download",(t||this.store.data.name||"le5le.meta2d")+".png"),n.setAttribute("href",this.toPng(i,void 0,!0,a));const r=document.createEvent("MouseEvents");r.initEvent("click",!0,!0),n.dispatchEvent(r)},1e3)}downloadSvg(t){if(!window.C2S)throw console.error("\u8BF7\u5148\u52A0\u8F7D\u4E50\u543E\u4E50\u5B98\u7F51\u4E0B\u7684canvas2svg.js","https://assets.le5lecdn.com/2d/canvas2svg.js"),new Error("\u8BF7\u5148\u52A0\u8F7D\u4E50\u543E\u4E50\u5B98\u7F51\u4E0B\u7684canvas2svg.js");let i=!1;const a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height;a&&s&&!this.store.data.component&&(i=!0);const n=this.getRect();i&&(n.x=this.store.data.origin.x,n.y=this.store.data.origin.y,n.width=a*this.store.data.scale,n.height=s*this.store.data.scale),n.x-=10,n.y-=10;const r=new window.C2S(n.width+20,n.height+20);r.textBaseline="middle",r.strokeStyle=this.store.styles.color;const l=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;l&&i&&(r.save(),r.fillStyle=l,r.fillRect(0,0,n.width,n.height),r.restore()),this.store.bkImg&&i&&r.drawImage(this.store.bkImg,0,0,n.width,n.height),l&&!i&&(r.save(),r.fillStyle=l,r.fillRect(0,0,n.width+20,n.height+20),r.restore());for(const m of this.store.data.pens)m.visible==!1||!jr(m,this.store)||$r(r,m,n,!0);let o=r.getSerializedSvg();t!=null&&t.length&&(o=o.replace("",` {{bk}} {{bkRect}}`)),l?(o=o.replace("{{bk}}",""),o=o.replace("{{bkRect}}",``)):(o=o.replace("{{bk}}",""),o=o.replace("{{bkRect}}","")),o=o.replace(/--le5le--/g,"&#x");const u=window.URL,c=new Blob([o]),f=u.createObjectURL(c),g=document.createElement("a");g.setAttribute("download",`${this.store.data.name||"le5le.meta2d"}.svg`),g.setAttribute("href",f);const v=document.createEvent("MouseEvents");v.initEvent("click",!0,!0),g.dispatchEvent(v)}getRect(t=this.store.data.pens){return hi(t)}hiddenTemplate(){this.canvas.canvasTemplate.hidden()}showTemplate(){this.canvas.canvasTemplate.show()}lockTemplate(t){this.store.data.pens.forEach(i=>{i.canvasLayer===zt.CanvasTemplate&&(i.locked=t)})}fitView(t=!0,i=10){var f,g;if(!this.hasView())return;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a;this.resize(s,n);const r=qi(i),l=this.getRect(),o=(s-r[1]-r[3])/l.width,u=(n-r[0]-r[2])/l.height;let c=o;t?c=o>u?u:o:c=o>u?o:u,(f=this.store.data.fits)!=null&&f.length&&(this.canvas.opening=!0),this.scale(c*this.store.data.scale),this.centerView(),(g=this.store.data.fits)!=null&&g.length&&this.fillView()}fillView(){var s,n;const t=this.getRect(),i=this.canvas.width-t.width,a=this.canvas.height-t.height;if(Math.abs(i)>10){(s=this.store.data.fits)==null||s.forEach(o=>{let u=[];o.children.forEach(f=>{this.store.pens[f]&&(this.store.pens[f].locked=Mt.None,u.push(this.store.pens[f]))});let c=i/2;if(o.left&&o.right){let f=o.leftValue,g=o.rightValue;f?f=Math.abs(f)<1?f*this.canvas.width:f:f=0,g?g=Math.abs(g)<1?g*this.canvas.width:g:g=0;let v=(this.canvas.width-f-g)/(t.width-f-g);u.forEach(m=>{var w,y;m.image&&m.imageRatio&&m.calculative.worldRect.width/this.canvas.width>.1&&(m.imageRatio=!1),m.calculative.worldRect.x=t.x-i/2+f+(m.calculative.worldRect.x-t.x)*v,m.calculative.worldRect.width*=v,m.calculative.worldRect.ex=m.calculative.worldRect.x+m.calculative.worldRect.width,m.calculative.width=m.calculative.worldRect.width,m.calculative.x=m.calculative.worldRect.x,m.width=m.calculative.worldRect.width,m.x=m.calculative.worldRect.x,this.canvas.updatePenRect(m,{worldRectIsReady:!1}),m.externElement&&((w=m.onResize)==null||w.call(m,m)),(y=m.children)!=null&&y.length&&Qe(m,this.store).forEach(A=>{var x;A.externElement&&((x=A.onResize)==null||x.call(A,A))})})}else o.left?(c=-c,o.leftValue&&(c+=Math.abs(o.leftValue)<1?o.leftValue*this.canvas.width:o.leftValue),this.translatePens(u,c,0)):o.right&&(o.rightValue&&(c=c-(Math.abs(o.rightValue)<1?o.rightValue*this.canvas.width:o.rightValue)),this.translatePens(u,c,0))});const r=this.store.data.pens.filter(o=>o.name==="iframe");r==null||r.forEach(o=>{var c,f;const u=o.calculative.worldRect;if(u.width/this.store.data.scale>t.width*.8){let g=u.width;o.calculative.worldRect.x=u.x-i/2,o.calculative.worldRect.width=u.width+i,o.calculative.worldRect.ex=u.ex+i,o.operationalRect.x=o.operationalRect.x*g/o.calculative.worldRect.width,o.operationalRect.width=(o.calculative.worldRect.width-(1-o.operationalRect.width)*g)/o.calculative.worldRect.width,(c=o.onBeforeValue)==null||c.call(o,o,{operationalRect:o.operationalRect}),(f=o.onResize)==null||f.call(o,o)}});const l=this.store.data.pens.filter(o=>o.name==="video");l==null||l.forEach(o=>{var c;const u=o.calculative.worldRect;u.width/this.store.data.scale>t.width*.8&&(o.calculative.worldRect.x=u.x-i/2,o.calculative.worldRect.width=u.width+i,o.calculative.worldRect.ex=u.ex+i,(c=o.onResize)==null||c.call(o,o))})}if(Math.abs(a)>10){(n=this.store.data.fits)==null||n.forEach(o=>{let u=[];o.children.forEach(f=>{this.store.pens[f]&&(this.store.pens[f].locked=Mt.None,u.push(this.store.pens[f]))});let c=a/2;if(o.top&&o.bottom){let f=o.topValue,g=o.bottomValue;f?f=Math.abs(f)<1?f*this.canvas.height:f:f=0,g?g=Math.abs(g)<1?g*this.canvas.height:g:g=0;let v=(this.canvas.height-f-g)/t.height;u.forEach(m=>{var w,y;m.image&&m.imageRatio&&m.calculative.worldRect.height/this.canvas.height>.1&&(m.imageRatio=!1),m.calculative.worldRect.y=t.y-a/2+f+(m.calculative.worldRect.y-t.y)*v,m.calculative.worldRect.height*=v,m.calculative.worldRect.ey=m.calculative.worldRect.y+m.calculative.worldRect.height,m.calculative.height=m.calculative.worldRect.height,m.calculative.y=m.calculative.worldRect.y,m.height=m.calculative.worldRect.height,m.y=m.calculative.worldRect.y,this.canvas.updatePenRect(m,{worldRectIsReady:!1}),m.externElement&&((w=m.onResize)==null||w.call(m,m)),(y=m.children)!=null&&y.length&&Qe(m,this.store).forEach(A=>{var x;A.externElement&&((x=A.onResize)==null||x.call(A,A))})})}else o.top?(c=-c,o.topValue&&(c+=Math.abs(o.topValue)<1?o.topValue*this.canvas.height:o.topValue),this.translatePens(u,0,c)):o.bottom&&(o.bottomValue&&(c=c-(Math.abs(o.bottomValue)<1?o.bottomValue*this.canvas.height:o.bottomValue)),this.translatePens(u,0,c))});const r=this.store.data.pens.filter(o=>o.name==="iframe");r==null||r.forEach(o=>{var c,f;const u=o.calculative.worldRect;if(u.height/this.store.data.scale>t.height*.8){let g=u.height;o.calculative.worldRect.y=u.y-a/2,o.calculative.worldRect.height=u.height+a,o.calculative.worldRect.ey=u.ey+a,o.operationalRect.y=o.operationalRect.y*g/o.calculative.worldRect.width,o.operationalRect.height=(o.calculative.worldRect.height-(1-o.operationalRect.height)*g)/o.calculative.worldRect.height,(c=o.onBeforeValue)==null||c.call(o,o,{operationalRect:o.operationalRect}),(f=o.onResize)==null||f.call(o,o)}});const l=this.store.data.pens.filter(o=>o.name==="video");l==null||l.forEach(o=>{var c;const u=o.calculative.worldRect;u.height/this.store.data.scale>t.height*.8&&(o.calculative.worldRect.y=u.y-a/2,o.calculative.worldRect.height=u.height+a,o.calculative.worldRect.ey=u.ey+a,(c=o.onResize)==null||c.call(o,o))})}this.canvas.canvasTemplate.fit=!0,this.canvas.canvasTemplate.init(),this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render(!0)}trimPens(){let t=this.store.data.pens.filter(i=>i.name==="line"&&i.anchors.length<2);this.delete(t)}fitTemplateView(t=!0,i=10){if(!this.hasView())return;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a,r=qi(i),l=this.getRect(),o=(s-r[1]-r[3])/l.width,u=(n-r[0]-r[2])/l.height;let c=o;t?c=o>u?u:o:c=o>u?o:u,this.canvas.templateScale(c*this.store.data.scale);let f=this.getRect(),g=this.store.data.pens.filter(v=>!v.parentId);this.canvas.templateTranslatePens(g,-f.x,-f.y),this.store.data.pens.forEach(v=>{v.type?this.canvas.initLineRect(v):this.canvas.updateLines(v)}),this.centerView()}fitSizeView(t=!0,i=10){var g,v;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a;this.resize(s,n);const r=qi(i),l=(this.store.data.width||this.store.options.width)*this.store.data.scale,o=(this.store.data.height||this.store.options.height)*this.store.data.scale,u=(s-r[1]-r[3])/l,c=(n-r[0]-r[2])/o;let f=u;t==="width"?f=u:t==="height"?f=c:t?f=u>c?c:u:f=u>c?u:c,(g=this.store.data.fits)!=null&&g.length&&(this.canvas.opening=!0),this.scale(f*this.store.data.scale),this.centerSizeView(),(v=this.store.data.fits)!=null&&v.length&&this.fillView()}centerSizeView(){const t=this.getViewCenter(),i=this.store.data.width||this.store.options.width,a=this.store.data.height||this.store.options.height,s={x:0,y:0,width:i,height:a};Qt(s);const{center:n}=s,{scale:r,origin:l,x:o,y:u}=this.store.data;this.translate((t.x-l.x)/r-n.x-o/r,(t.y-l.y)/r-n.y-u/r);const{canvas:c}=this.canvas,f=(c.scrollWidth-c.offsetWidth)/2,g=(c.scrollHeight-c.offsetHeight)/2;c.scrollTo(f,g)}scrollView(t=10,i=!1){if(!this.hasView()||!this.canvas.scroll)return;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a;this.resize(s,n);const r=qi(t),l=this.getRect(),o=(s-r[1]-r[3])/l.width;this.scale(o*this.store.data.scale),this.topView(r[0]),i&&this.canvas.scroll.changeMode()}screenView(t=10,i=!0){if(!this.hasView())return;const{canvas:a}=this.canvas,{offsetWidth:s,offsetHeight:n}=a;this.resize(s,n);const r=qi(t),l=this.getRect();let o=(s-r[1]-r[3])/l.width;i||(o=(n-r[0]-r[2])/l.height),this.scale(o*this.store.data.scale),this.topView(r[0])}topView(t=10){if(!this.hasView())return;const i=this.getRect(),a=this.getViewCenter(),s=this.getPenRect(i);Qt(s);const{center:n}=s,{scale:r,origin:l,x:o,y:u}=this.store.data;this.translate((a.x-l.x)/r-n.x-o/r,(t-l.y)/r-s.y-u/r);const{canvas:c}=this.canvas,f=(c.scrollWidth-c.offsetWidth)/2,g=(c.scrollHeight-c.offsetHeight)/2;c.scrollTo(f,g)}centerView(){if(!this.hasView())return;const t=this.getRect(),i=this.getViewCenter(),a=this.getPenRect(t);Qt(a);const{center:s}=a,{scale:n,origin:r,x:l,y:o}=this.store.data;this.translate((i.x-r.x)/n-s.x-l/n,(i.y-r.y)/n-s.y-o/n);const{canvas:u}=this.canvas,c=(u.scrollWidth-u.offsetWidth)/2,f=(u.scrollHeight-u.offsetHeight)/2;u.scrollTo(c,f)}hasView(){return!!this.store.data.pens.filter(t=>!t.isRuleLine).length}getViewCenter(){const{width:t,height:i}=this.canvas;return{x:t/2,y:i/2}}beSameByFirst(t=this.store.data.pens,i){const a=ht(t),s=t[0],{width:n,height:r}=this.getPenRect(s);for(let l=1;l{s[n]=a[n]});for(let n=1;n{s[n]=a[n]});for(let n=0;n0){const a=t[0];Gs.forEach(s=>{i[s]=a[s]!==void 0?a[s]:this.store.options.defaultFormat[s]||this.store.data[s]||this.store.options[s]})}else Gs.forEach(a=>{this.store.options.defaultFormat[a]||this.store.data[a]||this.store.options[a]});localStorage.setItem("meta2d-formatPainter",JSON.stringify(i))}formatPainter(){const t=this.store.active,i=ht(t),a=JSON.parse(localStorage.getItem("meta2d-formatPainter"));for(let s=0;s{for(let s=0;s{u=Math.min(u,g.calculative.worldRect[f]),c=Math.max(c,g.calculative.worldRect["e"+f])}),a=(c-u)/this.store.data.scale}if(i=i.filter(u=>!u.parentId),i.length<=2)return;const s=ht(i),n=i.reduce((u,c)=>{const f=this.getPenRect(c);return u+f[t]},0),r=(a-n)/(i.length-1);i=i.sort((u,c)=>t==="width"?u.x-c.x:u.y-c.y);const l=this.getPenRect(i[0]);let o=t==="width"?l.x:l.y;for(const u of i){const c=this.getPenRect(u);t==="width"?c.x=o:c.y=o,o+=c[t]+r,this.setValue({id:u.id,...c},{render:!1,doEvent:!1})}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:bt.Update,initPens:s,pens:i})}spaceBetween(t,i){this.spaceBetweenByDirection("width",t,i)}spaceBetweenColumn(t,i){this.spaceBetweenByDirection("height",t,i)}layout(t=this.store.data.pens,i,a=30){const s=this.getPenRect(hi(t));!i&&(i=s.width),t=t.filter(u=>!u.type&&!u.parentId);const n=ht(t);let r=0;t.forEach(u=>{const c=this.getPenRect(u);c.height>r&&(r=c.height)});let l=s.x,o=s.y;t.forEach((u,c)=>{const f=this.getPenRect(u);if(f.x=l,f.y=o+r/2-f.height/2,this.setValue({id:u.id,...f},{render:!1,doEvent:!1}),c===t.length-1)return;const g=l+f.width-s.x,v=this.getPenRect(t[c+1]);Math.round(i-g)>=Math.round(v.width+a)?l+=f.width+a:(l=s.x,o+=r+a)}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.render(),this.pushHistory({type:bt.Update,initPens:n,pens:t})}gotoView(t){const i=this.getViewCenter(),a=i.x-t.calculative.worldRect.x-t.calculative.worldRect.width/2,s=i.y-t.calculative.worldRect.y-t.calculative.worldRect.height/2;this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.translate(a-this.store.data.x,s-this.store.data.y),this.store.data.x=a,this.store.data.y=s;for(const n of this.store.data.pens)Yi(n);this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render()}showMap(){this.map||(this.map=new xE(this.canvas)),this.map.show()}hideMap(){this.map.hide()}onSizeUpdate(){this.mapTimer&&(clearTimeout(this.mapTimer),this.mapTimer=void 0),this.mapTimer=setTimeout(()=>{this.map&&this.map.isShow&&this.map.show(),this.canvas&&this.canvas.scroll&&this.canvas.scroll.isShow&&this.canvas.scroll.resize()},500)}toggleAnchorMode(){this.canvas.toggleAnchorMode()}addAnchorHand(){this.canvas.addAnchorHand()}removeAnchorHand(){this.canvas.removeAnchorHand()}toggleAnchorHand(){this.canvas.toggleAnchorHand()}top(t){t||(t=this.store.active),Array.isArray(t)||(t=[t]);for(const i of t){const a=this.store.data.pens,s=[...Qe(i,this.store),i].map(r=>r.id);a.filter(r=>s.includes(r.id)).forEach(r=>{const l=a.findIndex(o=>o.id===r.id);l>-1&&(a.push(a[l]),a.splice(l,1),this.initTemplateCanvas([r]),this.initImageCanvas([r])),this.specificLayerMove(r,"top")})}this.store.emitter.emit("layer",{type:"top",pens:t})}initImageCanvas(t){this.canvas&&this.canvas.initImageCanvas(t)}initTemplateCanvas(t){this.canvas&&this.canvas.initTemplateCanvas(t)}bottom(t){t||(t=this.store.active),Array.isArray(t)||(t=[t]);for(const i of t){const a=this.store.data.pens,s=[...Qe(i,this.store),i].map(r=>r.id),n=a.filter(r=>s.includes(r.id));for(let r=n.length-1;r>=0;r--){const l=n[r],o=a.findIndex(u=>u.id===l.id);o>-1&&(a.unshift(a[o]),a.splice(o+1,1),this.initTemplateCanvas([l]),this.initImageCanvas([l])),this.specificLayerMove(l,"bottom")}}this.store.emitter.emit("layer",{type:"bottom",pens:t})}upByArea(t){if(this.store.data.pens.findIndex(o=>o.id===t.id)===-1){console.warn("upByArea: pen not in canvas");return}const a=[t,...Qe(t,this.store)];let s=a.map(o=>this.store.data.pens.findIndex(u=>u.id===o.id));s.includes(-1)&&(console.warn("upByArea: pen children not in canvas"),s=s.filter(o=>o!==-1));const n=Math.min(...s),r=t.calculative.worldRect,l=this.store.data.pens.findIndex((o,u)=>{if(u<=n||o.id===t.id||Gx(o,t))return!1;const c=o.calculative.worldRect;return Xi(r,c)});if(l===-1){this.up(t);return}this.store.data.pens.splice(l+1,0,...a);for(const o of a){const u=this.store.data.pens.findIndex(c=>c.id===o.id);u>-1&&this.store.data.pens.splice(u,1)}this.initImageCanvas([t])}specificLayerMove(t,i){var a;if(t.image&&t.name!=="gif"){let s=zt.CanvasImageBottom;i==="top"?s=zt.CanvasImage:(i==="up"||i==="down")&&(s=zt.CanvasMain),this.setValue({id:t.id,canvasLayer:s},{render:!1,doEvent:!1,history:!1})}else if(t.externElement||t.name==="gif"){let s=0;i==="top"?(t.calculative.canvas.maxZindex+=1,s=t.calculative.canvas.maxZindex):i==="up"?s=t.calculative.zIndex===void 0?6:t.calculative.zIndex+1:i==="down"&&(s=t.calculative.zIndex===void 0?3:t.calculative.zIndex-1,s<0&&(s=0)),this.setValue({id:t.id,zIndex:s},{render:!1,doEvent:!1,history:!1}),(a=t.calculative.singleton)!=null&&a.div&&Fe(t,t.calculative.singleton.div)}}up(t){t||(t=this.store.active),Array.isArray(t)||(t=[t]);for(const i of t){const a=this.store.data.pens;if(i.children&&i.children.length){const s=[...Qe(i,this.store),i],n=[];for(let o=0;oc.id===u.id)!==-1&&(u.temIndex=o,n.push(u))}let r=-1,l=0;n.forEach(o=>{o.temIndex-=l,a.splice(o.temIndex,1),l+=1,r=o.temIndex,delete o.temIndex,this.specificLayerMove(o,"up")}),a.splice(r+1,0,...n),this.initTemplateCanvas(n),this.initImageCanvas(n)}else{const s=a.findIndex(n=>n.id===i.id);s>-1&&s!==a.length-1&&(a.splice(s+2,0,a[s]),a.splice(s,1),this.initTemplateCanvas([i]),this.initImageCanvas([i])),this.specificLayerMove(i,"up")}}this.store.emitter.emit("layer",{type:"up",pens:t})}down(t){t||(t=this.store.active),Array.isArray(t)||(t=[t]);for(const i of t){const a=this.store.data.pens;if(i.children&&i.children.length){const s=[...Qe(i,this.store),i],n=[];for(let o=0;oc.id===u.id)!==-1&&(u.temIndex=o,n.push(u))}let r=-1,l=0;n.forEach((o,u)=>{o.temIndex-=l,a.splice(o.temIndex,1),l+=1,u===0&&(r=o.temIndex),delete o.temIndex,this.specificLayerMove(o,"down")}),a.splice(r-1,0,...n),this.initTemplateCanvas(n),this.initImageCanvas(n)}else{const s=a.findIndex(n=>n.id===i.id);s>-1&&s!==0&&(a.splice(s-1,0,a[s]),a.splice(s+1,1),this.initTemplateCanvas([i]),this.initImageCanvas([i])),this.specificLayerMove(i,"down")}}this.store.emitter.emit("layer",{type:"down",pens:t})}setLayer(t,i,a=this.store.data.pens){const s=a.findIndex(n=>n.id===t.id);s>-1&&(s>i?(a.splice(i,0,a[s]),a.splice(s+1,1)):s{const r=this.store.pens[n];if(!r){console.warn(t,"node contain a error connectedLine");return}if(!a.find(l=>l.id===r.id))switch(i){case"all":a.push(r);break;case"in":Vt(r).connectTo===t.id&&a.push(r);break;case"out":le(r).connectTo===t.id&&a.push(r);break}}),a}nextNode(t){if(t.type===$t.Line){const i=this.store.pens[Vt(t).connectTo];return i?[i]:[]}else{const i=this.getLines(t,"out"),a=[];return i.forEach(s=>{const n=this.nextNode(s);for(const r of n)!a.find(o=>o.id===r.id)&&a.push(r)}),a}}previousNode(t){if(t.type===$t.Line){const i=this.store.pens[le(t).connectTo];return i?[i]:[]}else{const i=this.getLines(t,"in"),a=[];return i.forEach(s=>{const n=this.previousNode(s);for(const r of n)!a.find(o=>o.id===r.id)&&a.push(r)}),a}}getNext(t){var a;if(t.type===$t.Line){console.warn("\u975E\u8FDE\u7EBF\u8282\u70B9");return}const i=[];return(a=t.connectedLines)==null||a.forEach(({lineId:s,anchor:n})=>{var o,u;const r=(o=t.anchors)==null?void 0:o.filter(c=>c.id===n)[0],l=this.findOne(s);if(l.anchors[0].connectTo==t.id){const c=l.anchors[l.anchors.length-1].connectTo;if(c){const f=this.findOne(c),g=(u=f.connectedLines)==null?void 0:u.filter(m=>m.lineId===l.id)[0],v=f.anchors.filter(m=>m.id===g.anchor)[0];i.push({from:t,fromAnchor:r,line:l,to:f,toAnchor:v})}}}),i}addAnchor(t,i,a){if(!t)return;if(t.anchors||(t.anchors=[]),t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.type===$t.Line&&(a<0&&(a=t.anchors.length+1+a),a>t.anchors.length&&(a=t.anchors.length),a<0&&(a=0),a==0&&t.anchors[0].connectTo||a==t.anchors.length&&t.anchors[a-1].connectTo)){console.warn("\u7AEF\u70B9\u5B58\u5728\u8FDE\u63A5\u5173\u7CFB");return}let s=null,n=null;i.x<=1&&i.x>=0&&i.y<=1&&i.y>=0?(n={id:i.id||St(),penId:t.id,x:t.calculative.worldRect.x+t.calculative.worldRect.width*i.x,y:t.calculative.worldRect.y+t.calculative.worldRect.height*i.y},t.calculative.worldRect&&t.rotate%360&&Gt(n,t.rotate,t.calculative.worldRect.center),s={id:n.id,penId:t.id,x:i.x,y:i.y}):(n={id:i.id||St(),penId:t.id,x:i.x,y:i.y},t.calculative.worldRect&&(t.rotate%360&&Gt(i,-t.rotate,t.calculative.worldRect.center),s={id:n.id,penId:t.id,x:(i.x-t.calculative.worldRect.x)/t.calculative.worldRect.width,y:(i.y-t.calculative.worldRect.y)/t.calculative.worldRect.height})),t.type===$t.Line?(t.calculative.worldAnchors.splice(a,0,n),t.anchors.splice(a,0,s),this.canvas.updateLines(t),this.canvas.initLineRect(t),this.render()):(t.calculative.worldAnchors.push(n),t.anchors.push(s))}connectLine(t,i,a,s,n=!0){if(!a){const u=i.calculative.worldRect;a=bs(t,{x:u.x+u.width/2,y:u.y+u.height/2})}if(!s){const u=t.calculative.worldRect;s=bs(i,{x:u.x+u.width/2,y:u.y+u.height/2})}const r=Math.abs(a.x-s.x),o={height:Math.abs(a.y-s.y),lineName:"line",lineWidth:1,name:"line",type:1,width:r,x:Math.min(a.x,s.x),y:Math.min(a.y,s.y),anchors:[{x:a.x>s.x?1:0,y:a.y>s.y?1:0,id:St()},{x:a.x>s.x?0:1,y:a.x>s.x?0:1,id:St()}]};return this.addPens([o]),we(t,a,o,o.calculative.worldAnchors[0]),we(i,s,o,o.calculative.worldAnchors[1]),o.calculative.active=!1,this.canvas.updateLines(o),this.canvas.updateLines(t),this.canvas.updateLines(i),this.canvas.initLineRect(o),n&&this.render(),o}toComponent(t=this.store.data.pens,i,a){if(t.length===1){const c=ht(t[0]);return c.type=$t.Node,c.id=void 0,[c]}const s=ht(t,!0),n=hi(s);let r={id:St(),name:"combine",...n,children:[],showChild:i};a&&(r.anchors=[{id:"0",penId:r.id,x:.5,y:0},{id:"1",penId:r.id,x:1,y:.5},{id:"2",penId:r.id,x:.5,y:1},{id:"3",penId:r.id,x:0,y:.5}]);const l=s.filter(c=>!c.parentId),o=s.find(c=>c.width===n.width&&c.height===n.height),u=o&&i===void 0;return l.length===1?r=l[0]:u&&(o.children||(o.children=[]),r=o),s.forEach(c=>{var g;if(c===r||c.parentId===r.id||c.parentId)return;r.children.push(c.id),c.parentId=r.id;const f=fa(c.calculative.worldRect,n);Object.assign(c,f),c.locked=(g=c.lockedOnCombine)!=null?g:Mt.DisableMove}),u||l.length===1?ht(s):ht([r,...s])}installPenPlugins(t,i){if(!t.tag&&!t.name&&!t.id)return;let a;t.id?a="id":t.tag?a="tag":t.name&&(a="name"),i.forEach(s=>{let n=s.plugin,r=s.options;if(!!n&&W2(n)&&a)if(n.install(t,r),!this.penPluginMap.has(n))this.penPluginMap.set(n,[{[a]:t[a],option:r}]);else{let l=this.penPluginMap.get(n).find(o=>o[a]===t[a]);l?l.option=r:this.penPluginMap.get(n).push({[a]:t[a],option:r})}})}uninstallPenPlugins(t,i){let a;t.id?a="id":t.tag?a="tag":t.name&&(a="name"),a&&i.forEach(s=>{let n=s.plugin;n.uninstall(t,s.options);let r=this.penPluginMap.get(n),l=r.findIndex(o=>o[a]===t[a]);l!==-1&&(r.splice(l,1),r.length===0&&this.penPluginMap.delete(n))})}setVisible(t,i,a=!0){if(this.onSizeUpdate(),this.setValue({id:t.id,visible:i},{render:!1,doEvent:!1}),t.children)for(const n of t.children){const r=this.store.pens[n];r&&this.setVisible(r,i,!1)}let s=Qe(t,this.store);s.push(t),this.initImageCanvas(s),a&&this.render()}clearHover(){this.canvas.clearHover()}closeSocket(){this.closeWebsocket(),this.closeMqtt(),this.closeHttp()}destroy(t){if(this.clear(!1),this.stopDataMock(),this.closeSocket(),this.closeNetwork(),this.closeAll(),Qs.destroyThemeSheet(this.store.id),this.store.emitter.all.clear(),this.canvas.destroy(),this.canvas=void 0,Et[this.store.id]=void 0,!t){for(const i in Et)delete Et[i];Et.path2dDraws={},Et.canvasDraws={},Et.anchors={},Et.htmlElements={}}}}function PE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ey:r}=e.calculative.worldRect,l=n/4;if(i.moveTo(a+l,s),i.lineTo(a,s),i.lineTo(a,r),i.lineTo(a+l,r),i instanceof Path2D)return i}function SE(e){const t=[{x:.25,y:0},{x:.25,y:1},{x:0,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:s+"",x:i,y:a,penId:e.id}))}function IE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=e.offsetX;let u=n/7;if(o>1?u=o:o>0&&(u=n*o),i.moveTo(a+u,s),i.lineTo(r,s),i.lineTo(a+n-u,l),i.lineTo(a,l),i.closePath(),i instanceof Path2D)return i}function BE(e){const t=[{x:.5,y:0},{x:.9285714285714286,y:.5},{x:.5,y:1},{x:.07142857142857142,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function DE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l,ey:o}=e.calculative.worldRect,u=n/8;if(i.moveTo(a+u,s),i.lineTo(l-u,s),i.bezierCurveTo(l+u/3,s,l+u/3,o,l-u,o),i.lineTo(a+u,o),i.lineTo(a,s+r/2),i.closePath(),i instanceof Path2D)return i}function LE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l,center:o}=e.calculative.worldRect,u=o.x,c=s+r*6/7,f=r/6;if(i.moveTo(a,s),i.lineTo(l,s),i.lineTo(l,c),i.bezierCurveTo(l-20,c-f,u+n/5,c-f,u,c),i.bezierCurveTo(u-n/5,c+f,a,c+f,a,c),i.closePath(),i instanceof Path2D)return i}function ME(e){const t=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:.8571428571428571},{x:0,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function OE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=n/10;if(i.moveTo(a+o*2,s),i.bezierCurveTo(a-o*2/3,s,a-o*2/3,l,a+o*2,l),i.lineTo(r,l),i.bezierCurveTo(r-o,l,r-o,s,r,s),i.closePath(),i instanceof Path2D)return i}function NE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect;i.moveTo(a,s),i.lineTo(r,s),i.lineTo(r,l),i.lineTo(a,l),i.closePath();const o=n/7;if(i.moveTo(a,s+o),i.lineTo(r,s+o),i.moveTo(a+o,s),i.lineTo(a+o,l),i instanceof Path2D)return i}function zE(e,t){const i=t||new Path2D,{x:a,y:s,height:n,ex:r,ey:l}=e.calculative.worldRect,o=n/4;if(i.moveTo(a,s+o),i.lineTo(r,s),i.lineTo(r,l),i.lineTo(a,l),i.closePath(),i instanceof Path2D)return i}function HE(e){const t=[{x:.5,y:.125},{x:1,y:.5},{x:.5,y:1},{x:0,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function WE(e,t){const i=t||new Path2D,{x:a,y:s,ex:n,ey:r}=e.calculative.worldRect;if(i.moveTo(a,s),i.lineTo(n,s),i.moveTo(a,r),i.lineTo(n,r),i instanceof Path2D)return i}function UE(e){const t=[{x:.5,y:0},{x:.5,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:s+"",x:i,y:a,penId:e.id}))}function VE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l,ey:o}=e.calculative.worldRect;if(i.ellipse(a+n/2,s+r/2,n/2,r/2,0,0,Math.PI*2),i.moveTo(a+n/2,o),i.lineTo(l,o),i.closePath(),i instanceof Path2D)return i}function $E(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:l}=e.calculative.worldRect,o=n/7;if(i.moveTo(a,s),i.lineTo(r,s),i.lineTo(r,l),i.lineTo(a,l),i.closePath(),i.moveTo(a+o,s),i.lineTo(a+o,l),i.moveTo(r-o,s),i.lineTo(r-o,l),i instanceof Path2D)return i}function jE(e,t){const i=t||new Path2D,{x:a,y:s,height:n,ex:r,ey:l}=e.calculative.worldRect,o=n/7;if(i.moveTo(a,s+o),i.bezierCurveTo(a,s-o/2|0,r,s-o/2|0,r,s+o),i.lineTo(r,l-o),i.bezierCurveTo(r,l+o/2|0,a,l+o/2|0,a,l-o),i.closePath(),i.moveTo(a,l-o),i.bezierCurveTo(a,l-o*2|0,r,l-o*2|0,r,l-o),i instanceof Path2D)return i}function v5(){return{flowComment:PE,flowData:IE,flowDb:jE,flowDisplay:DE,flowDocument:LE,flowExternStorage:OE,flowInternalStorage:NE,flowManually:zE,flowParallel:WE,flowQueue:VE,flowSubprocess:$E}}function m5(){return{flowDocument:ME,flowManually:HE,flowParallel:UE,flowComment:SE,flowData:BE}}var Xr;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(Xr||(Xr={}));function kg(e,t){const i=t.calculative.worldRect.height*14/16,s=(e.match(/[\u4e00-\u9fa5]/g)||"").length;return(e.length-s)*i*.6+s*i}function Cg(e){if(e.direction=="horizontal"){const t=[];let i=0;const a=e.height;e.checkboxHeight=a,e.options.forEach((n,r)=>{t.push(r*(40+a)+i),i+=kg(n.text,e)}),e.optionPos=t;const s=t.length*(40+a)+i;e.checkboxWidth=s,e.width=s,e.calculative.width=s,e.calculative.worldRect={x:e.x,y:e.y,height:e.height,width:e.width,center:{x:e.x+e.width/2,y:e.y+e.height/2}},re(e.calculative.worldRect)}else if(e.direction=="vertical"){e.optionInterval==null&&(e.optionInterval=20),e.optionHeight||(e.optionHeight=20);const t=[];e.options.forEach((a,s)=>{t.push(s*(e.optionInterval+e.optionHeight))}),e.optionPos=t;const i=t[t.length-1]+e.optionHeight;e.checkboxHeight=i,e.width||(e.height=i,e.calculative.height=i,e.calculative.worldRect={x:e.x,y:e.y,height:e.height,width:e.width,center:{x:e.x+e.width/2,y:e.y+e.height/2}},re(e.calculative.worldRect))}}function $f(e,t){t.onAdd||(t.onAdd=Fg,(!t.rowPos||!t.colPos||!t.calculative.maxOffsetY)&&t.onAdd(t),t.onMouseMove=JE,t.onMouseLeave=QE,t.onMouseDown=tA,t.onShowInput=GE,t.onInput=ZE,t.onValue=aA,t.onBeforeValue=sA,t.onMouseEnter=cA,t.onWheel=nA,t.onDestroy=oA),t.data.length!==t.rowPos.length&&(t.initWorldRect=null,t.calculative.isUpdateData=!0,t.onValue(t)),t.data[0].length!==t.colPos.length&&(t.initWorldRect=null,t.calculative.isUpdateData=!0,t.onValue(t));const i=t.calculative.canvas.store;if(t.calculative.canvas.store.data,t.calculative.canvas.store.options,t.color=t.color||i.styles.color,t.textColor=t.textColor||t.color||i.styles.textColor,t.activeColor=t.activeColor||i.styles.activeColor,t.hoverColor=t.hoverColor||i.styles.hoverColor,t.activeBackground=t.activeBackground||i.styles.activeBackground,t.hoverBackground=t.hoverBackground||i.styles.hoverBackground,!t.hasHeader){e.save(),e.beginPath();const{x:a,y:s,width:n,height:r}=t.calculative.worldRect;e.fillStyle="#fff0",e.rect(a-1,s-1,n+2,r+2),e.fill(),e.clip()}KE(e,t),XE(e,t),qE(e,t),e.restore(),t.isFirstTime=!1}function qE(e,t){if(!t.calculative.hover||!t.calculative.hoverCell||t.calculative.isInput||!t.calculative.isHover)return;let i=t.calculative.worldRect,a=t.calculative.canvas.mousePos;if(!(a.x>i.x&&a.xi.y&&a.yv.col!==void 0&&v.row===void 0&&v.width);let r={};n&&n.forEach(v=>{r[v.col]=v.width});for(let v=0;vw.col===v&&w.row===void 0);m&&(a[v]=m[0])}let l=0;const o=e.styles&&e.styles.filter(v=>v.col===void 0&&v.row!==void 0&&v.height);let u={};o&&o.forEach(v=>{u[v.row]=v.height});let c=l;for(let v=0;vt.calculative.worldRect.height)continue}else if(v<0||v>t.calculative.worldRect.height)continue;e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+v),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+v),e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke()}}if(t.vLine!==!1){let f=t.colPos[t.colPos.length-1];t.colPos.forEach((g,v)=>{if(g===f)return;const m=g*t.calculative.worldRect.width/t.tableWidth;e.beginPath(),e.moveTo(t.calculative.worldRect.x+m,t.calculative.worldRect.y),e.lineTo(t.calculative.worldRect.x+m,t.calculative.worldRect.ey),e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke()})}e.restore()}function XE(e,t){var a,s,n,r,l;if(!t.colPos)return;t.calculative.texts||(t.calculative.texts=[]);const i=1;for(let o=0;o0){let B=0;g.forEach((V,Q)=>{V.wheres&&V.wheres.every(R=>new Function("attr",`return attr ${R.comparison} ${R.value}`)(f))&&(B=Q)}),g=g[B]}else g.wheres&&Array.isArray(g.wheres)&&(v=!1,v=g.wheres.every(function(B){return new Function("attr",`return attr ${B.comparison} ${B.value}`)(f)}));let m=t.color,w=t.textColor||t.color,y=null,_=null,A=null,x=null;v&&(m=g.color||u.color||t.color,w=g.textColor||u.textColor||t.textColor,y=g.background||u.background,_=(g.fontSize||u.fontSize||0)*t.calculative.canvas.store.data.scale,A=g.fontWeight||u.fontWeight,x=g.fontStyle||u.fontStyle);let C;t.stripe&&(t.hasHeader!==!1?o%2===1&&(y=y||t.stripeColor||"#407FFF1F"):o%2===0&&(y=y||t.stripeColor||"#407FFF1F")),t.calculative.active&&((a=t.calculative.activeCell)==null?void 0:a.row)===o&&((s=t.calculative.activeCell)==null?void 0:s.col)===c&&(m=t.activeColor,y=t.activeBackground,C=m,w=t.activeTextColor||t.activeColor),t.calculative.hover&&((n=t.calculative.hoverCell)==null?void 0:n.row)===o&&((r=t.calculative.hoverCell)==null?void 0:r.col)===c&&(m=t.hoverColor,y=t.hoverBackground,w=t.hoverTextColor||t.hoverColor,C=m);const T=Sg(t,o,c);if(T.y+T.heightt.calculative.worldRect.height+t.calculative.worldRect.y)continue;y&&(e.save(),e.beginPath(),e.fillStyle=y,e.fillRect(T.x,T.y,T.width+.25*t.calculative.canvas.store.data.scale,T.height),e.restore()),C&&(e.save(),e.beginPath(),e.strokeStyle=C,e.strokeRect(T.x,T.y,T.width,T.height),e.restore()),t.calculative.worldTextRect=T;let I=t.calculative.texts[o];if(t.calculative.texts[o]||(I=[],t.calculative.texts.push(I)),I[c]==null){if(typeof f=="object"){const B=t.styles&&t.styles.filter(V=>V.col===c&&V.row===void 0&&V.pens);if(B.length>0){if(I[c]="",t.isFirstTime){t.maxNum&&t.hasHeader&&o>=t.maxNum&&(f.visible=!1);let V=JSON.parse(JSON.stringify(B[0].pens));V.forEach(Q=>{Object.assign(Q,{row:o,col:c},f),Q.activeBackground=Q.background,Q.hoverBackground=Q.background,Q.activeColor=Q.color,Q.hoverColor=Q.color,Q.activeTextColor=Q.textColor,Q.hoverTextColor=Q.textColor,Q.height*=t.calculative.canvas.store.data.scale,Q.width*=t.calculative.canvas.store.data.scale}),iA(t,T,V),t.calculative.canvas.parent.pushChildren(t,V)}continue}}else f===void 0?I[c]="":I[c]=f.text||f+"";if(!I[c])continue;I[c]=_n(t,I[c])}if(!I[c])continue;e.save(),e.beginPath(),e.fillStyle=w,e.textAlign="center",e.textBaseline="middle",e.font=(x||t.calculative.fontStyle||"")+" normal "+(A||t.calculative.fontWeight||"")+" "+(_||t.calculative.fontSize||12)*i+"px "+t.calculative.fontFamily;let D=t.colStyle&&((l=t.colStyle[c])==null?void 0:l.textAlign);if(D&&(e.textAlign=D),I[c].length===1)D==="left"?e.fillText(I[c][0],T.x,T.y+T.height/2):D==="right"?e.fillText(I[c][0],T.x+T.width,T.y+T.height/2):e.fillText(I[c][0],T.x+T.width/2,T.y+T.height/2);else{const V=(_||t.calculative.fontSize)*t.calculative.lineHeight*i,Q=I[c].length*V;let F=(T.height-Q)/2;D==="left"?I[c].forEach((R,P)=>{e.fillText(R,T.x,T.y+F+(P+.55)*V)}):D==="right"?I[c].forEach((R,P)=>{e.fillText(R,T.x+T.width,T.y+F+(P+.55)*V)}):I[c].forEach((R,P)=>{e.fillText(R,T.x+T.width/2,T.y+F+(P+.55)*V)})}e.restore()}}}function Fg(e){var t;Ac(e),(t=e.children)!=null&&t.length||(e.isFirstTime=!0),e.offsetY||(e.offsetY=0),YE(e)}function GE(e,t){if(!e.calculative.hoverCell)return;const{value:i}=Tg(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);if(typeof i=="object")return;e.calculative.isHover=!1,e.calculative.isInput=!0,e.calculative.canvas.render(),e.calculative.inputCell=e.calculative.hoverCell;const a=Sg(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);e.calculative.tempText=i.text||i+"",e.calculative.canvas.showInput(e,a,"#ffffff")}function ZE(e,t){!e.calculative.inputCell||(Pg(e,e.calculative.inputCell.row,e.calculative.inputCell.col,t),e.calculative.isInput=!1,e.calculative.isHover=!0,e.calculative.canvas.render())}function JE(e,t){e.timer&&(e.calculative.isHover=!1,clearTimeout(e.timer)),e.timer=setTimeout(()=>{e.calculative.isHover=!0,e.calculative.canvas.render()},500),e.calculative.hoverCell=Rg(e,t),e.calculative.canvas.render()}function QE(e,t){Ac(e),e.calculative.hoverCell=void 0,e.calculative.canvas.render()}function tA(e,t){e.calculative.activeCell=Rg(e,t),e.calculative.canvas.render()}function Rg(e,t){const i=e.calculative.worldRect.width/e.tableWidth,a=e.calculative.worldRect.height/e.tableHeight,s={row:0,col:0};for(let n=0;ne.calculative.worldRect.x+e.colPos[n]*i&&(s.col=n+1);for(let n=0;ne.calculative.worldRect.y+e.rowPos[n]*a-e.offsetY*e.calculative.canvas.store.data.scale&&(s.row=n+1);return s}function Tg(e,t,i){if(!e.data||!Array.isArray(e.data))return;const a=e.data[t],s=e.styles&&e.styles.filter(n=>n.row===t&&n.col===i);if(Array.isArray(a))return{value:a[i],style:(s==null?void 0:s.length)>0?s.length>1?s:s[0]:{}};if(!a.data||!Array.isArray(a.data))return}function eA(e,t){if(!e.data||!Array.isArray(e.data))return;const i=e.data[t],a=e.styles&&e.styles.filter(s=>s.row===t&&s.col===void 0);if(Array.isArray(i))return{value:i,style:(a==null?void 0:a.length)>0?a[0]:{}};if(!i.data||!Array.isArray(i.data))return}function Pg(e,t,i,a){if(!e.data||!Array.isArray(e.data))return;e.isFirstTime=!1,e.calculative.texts=void 0;let s=e.data[t];!s||(s[i]instanceof Object||(s[i]=a),e.calculative.canvas.store.emitter.emit("valueUpdate",e))}function Sg(e,t,i){const a=e.calculative.worldRect.width/e.tableWidth,s=e.calculative.worldRect.height/e.tableHeight;let n=0,r=e.colPos[i]*a;i>0&&(n=e.colPos[i-1]*a);let l=0,o=e.rowPos[t]*s;t>0&&(l=e.rowPos[t-1]*s);let u=e.offsetY*e.calculative.canvas.store.data.scale;return t===0&&e.hasHeader&&(u=0),{x:e.calculative.worldRect.x+n,y:e.calculative.worldRect.y+l-u,ex:e.calculative.worldRect.x+r,ey:e.calculative.worldRect.y+o-u,width:r-n,height:o-l}}function iA(e,t,i){if(!(i&&i.length))return;const a=e.calculative.worldRect.width/e.tableWidth,s=e.calculative.worldRect.height/e.tableHeight;let n=1,r=1;e.initWorldRect&&(e.calculative.worldRect.width!==e.initWorldRect.width&&(n=e.calculative.worldRect.width/e.initWorldRect.width),e.calculative.worldRect.height!==e.initWorldRect.height&&(r=e.calculative.worldRect.height/e.initWorldRect.height));let l=0,o=0,u=0;const c=e.calculative.canvas.store.data.scale;if(i.length>1){for(const f of i)o+f.width*a+20*c*a{f.width=f.width*n,f.height=f.height*r})}function aA(e){if(e.calculative.isUpdateData){delete e.calculative.isUpdateData;let t=ht(e.children);e.children=[],Fg(e),t&&t.forEach(i=>{e.calculative.canvas.delForce(e.calculative.canvas.findOne(i))}),e.calculative.texts=void 0}}function sA(e,t){if(e.calculative.isUpdateData=!1,e.swiper!==void 0&&(e.swiper?Ac(e):Ec(e)),t.styles&&(e.initWorldRect=void 0),t.table||t.col==null&&t.row==null){if(t.dataY){const a=e.replaceMode;let s=[];return a?a===Xr.Replace?(s=e.data,t.dataX&&t.dataX.forEach((n,r)=>{s[n]=t.dataY[r]})):a===Xr.ReplaceAll&&(t.dataX?s[0]=t.dataX:s[0]=e.data[0],s=s.concat(t.dataY)):s=e.data.concat(t.dataY),delete t.dataX,delete t.dataY,e.calculative.isUpdateData=!0,Object.assign(t,{data:s})}(t.data||t.styles||t.maxNum||t.rowHeight||t.colWidth)&&(e.calculative.isUpdateData=!0,e.initWorldRect=null);for(let a of Object.keys(t))a.includes("data.")&&(e.calculative.isUpdateData=!0);return t}let i=e.data[t.row];return i&&(i[t.col]instanceof Object||(i[t.col]=t.value),Pg(e,t.row,t.col,t.value),e.calculative.canvas.render(),delete t.col,delete t.row),t}function nA(e,t){if(!e.locked&&!e.calculative.canvas.store.data.locked||!e.maxNum)return;let i=0;t.deltaY>0?i=4:i=-4,sc(e,i)}function sc(e,t){var i;e.offsetY||(e.offsetY=0),e.offsetY+=t,e.offsetY>e.calculative.maxOffsetY&&(e.offsetY=e.calculative.maxOffsetY),e.offsetY<0&&(e.offsetY=0),(i=e.children)==null||i.forEach(a=>{const s=e.calculative.canvas.store.pens[a];rA(e,s)}),e.calculative.canvas.render()}function rA(e,t){if(!t)return;t.oldY||(t.oldY=t.y),t.calculative.worldRect,e.calculative.worldRect;const i=e.calculative.canvas.store.data.scale;e.calculative.worldRect.height/e.tableHeight;const a=e.rowHeight;t.y=t.oldY-e.offsetY*i/e.calculative.worldRect.height;const s=a*(e.initScale||1)/e.tableHeight*e.maxNum;if(e.calculative.canvas.updatePenRect(t),e.hasHeader)if(t.y1){if(t.calculative.visible=!1,t.visible=!1,t.y+t.height/2>1){t.oldY-=s;let n=t.row-e.maxNum;if(!e.data[n])return;let r=ht(e.data[n][t.col]);r.background&&(r.activeBackground=r.background,r.hoverBackground=r.background),r.color&&(r.hoverColor=r.color,r.activeColor=r.color),r.textColor&&(r.activeTextColor=r.textColor,r.hoverTextColor=r.textColor),Object.assign(t,r,{row:n}),Object.assign(t.calculative,r,{row:n})}}else t.visible=!0,t.calculative.visible=!0;else if(t.y<0){if(t.calculative.visible=!1,t.visible=!1,t.y<-a/e.tableHeight/2){t.oldY+=s;let n=t.row+e.maxNum;if(!e.data[n])return;let r=ht(e.data[n][t.col]);r.background&&(r.activeBackground=r.background,r.hoverBackground=r.background),r.color&&(r.hoverColor=r.color,r.activeColor=r.color),r.textColor&&(r.activeTextColor=r.textColor,r.hoverTextColor=r.textColor),Object.assign(t,r,{row:n}),Object.assign(t.calculative,r,{row:n})}}else if(t.y+t.height>1){if(t.calculative.visible=!1,t.visible=!1,t.y+t.height/2>1){t.oldY-=s;let n=t.row-e.maxNum;if(!e.data[n])return;let r=ht(e.data[n][t.col]);r.background&&(r.activeBackground=r.background,r.hoverBackground=r.background),r.color&&(r.hoverColor=r.color,r.activeColor=r.color),r.textColor&&(r.activeTextColor=r.textColor,r.hoverTextColor=r.textColor),Object.assign(t,r,{row:n}),Object.assign(t.calculative,r,{row:n})}}else t.calculative.visible=!0,t.visible=!0}function oA(e){Ec(e)}function Ec(e){e.interval&&(globalThis.clearInterval(e.interval),e.interval=null)}function Ac(e){if(e.maxNum&&e.swiper){if(e.interval)return;e.interval=globalThis.setInterval(()=>{e.offsetY>=e.calculative.maxOffsetY?(e.offsetY=0,lA(e)):e.offsetY%e.rowHeight?sc(e,1):(e.calculative.stap||(e.calculative.stap=0),e.calculative.stap+=1,e.calculative.stap==12&&(e.calculative.stap=0,sc(e,1)))},50)}}function lA(e){var t;(t=e.children)==null||t.forEach(i=>{const a=e.rowHeight,s=e.calculative.canvas.store.pens[i];if(!s)return;const n=a*(e.initScale||1)/e.tableHeight*e.maxNum;s.oldY-=n;const r=s.row-e.maxNum;if(!e.data[r])return;let l=ht(e.data[r][s.col]);l.background&&(l.activeBackground=l.background,l.hoverBackground=l.background),l.color&&(l.hoverColor=l.color,l.activeColor=l.color),l.textColor&&(l.activeTextColor=l.textColor,l.hoverTextColor=l.textColor),s.calculative.visible=!0,s.visible=!0,Object.assign(s,l,{row:r}),Object.assign(s.calculative,l,{row:r})}),e.calculative.canvas.render()}function cA(e){Ec(e)}function hA(e,t){t.onClick||(t.onClick=uA,t.setTheme=fA);let i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.width,n=t.calculative.worldRect.height;s2?n/2-2:1,0,Math.PI*2),e.fill()):(e.fillStyle=t.offColor,(t.disabled||t.disable)&&(e.fillStyle=t.disableOffColor||ke(.6,t.offColor)),t.lineWidth&&(e.strokeStyle=t.offStrokeColor,e.stroke()),e.fill(),e.closePath(),e.beginPath(),e.fillStyle="#ffffff",e.moveTo(i+n,a+n/2),e.arc(i+n/2,a+n/2,n/2>2?n/2-2:1,0,Math.PI*2),e.fill()),e.closePath()}function uA(e){e.disableDefaultClick||e.disabled||e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function fA(e,t){for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e.hasOwnProperty(i)&&(e[i]=a),e.calculative.hasOwnProperty(i)&&(e.calculative[i]=a)}e.onStrokeColor=t.borderColor,e.offStrokeColor=t.borderColor}function dA(e,t){t.onAdd||(t.onAdd=an,t.onResize=an,t.onMove=an,t.onMouseMove=gA,t.onMouseDown=Ig,t.onValue=vA,t.onBeforeValue=mA,t.setTheme=yA),t.calculative.barRect||an(t);const i=t.calculative.canvas.store;t.calculative.canvas.store.options;let a=t.background;t.disabled&&(a=t.disabledBackground||ke(.6,a)),e.fillStyle=a,e.beginPath();let s=t.calculative.worldRect.x+t.calculative.barRect.x,n=t.calculative.worldRect.y+t.calculative.barRect.y,r=t.calculative.barRect.width,l=t.calculative.barRect.height,o=l/2;e.moveTo(s+o,n),e.arcTo(s+r,n,s+r,n+l,o),e.arcTo(s+r,n+l,s,n+l,o),e.arcTo(s,n+l,t.x,t.y,o),e.arcTo(s,n,s+r,n,o),e.fill();let u=t.activeColor||i.styles.activeColor;t.disabled&&(u=t.disabledColor||ke(.6,u)),e.fillStyle=u,e.beginPath(),r=t.calculative.ballRect.x,e.moveTo(s+o,n),e.arcTo(s+r,n,s+r,n+l,o),e.arcTo(s+r,n+l,s,n+l,o),e.arcTo(s,n+l,t.x,t.y,o),e.arcTo(s,n,s+r,n,o),e.fill(),e.fillStyle=t.btnBackground||"#fff",e.strokeStyle=u,e.lineWidth=2,e.beginPath(),s=t.calculative.worldRect.x+t.calculative.ballRect.x,n=t.calculative.worldRect.y+t.calculative.ballRect.y+t.calculative.ballRect.height/2,e.lineWidth=t.calculative.ballRect.width/10,e.arc(s,n,t.calculative.ballRect.width/2,0,Math.PI*2),e.fill(),e.stroke()}function an(e){if(e._textWidth||(e._textWidth=e.textWidth||50,e._fontSize=e.fontSize||12),e.textWidth=e.calculative.worldRect.width,e.calculative.textWidth=e.textWidth,e.unit||(e.unit="%"),e.sliderWidth||(e.sliderWidth=e.width),e.sliderHeight||(e.sliderHeight=e.height),!e.calculative.worldRect)return;const t=e.calculative.worldRect.width/e.sliderWidth,i=e.calculative.worldRect.height/e.sliderHeight,a=Math.min(t,i);e.fontSize=e._fontSize*a;const s=e.calculative.worldRect.width-e._textWidth*a;e.textLeft=s+10*a,e.calculative.textLeft=e.textLeft,e.calculative.barRect={x:0,y:(e.calculative.worldRect.height-e.barHeight*i)/2,width:s,height:e.barHeight*i},re(e.calculative.barRect),kc(e)}function kc(e){const t=e.calculative.barRect.height*3.5,i=e.calculative.barRect.width*e.value/100;e.calculative.ballRect={x:i,y:(e.calculative.worldRect.height-t)/2,width:t,height:t},re(e.calculative.ballRect),e.calculative.text=e.value+e.unit,Fi(e)}function Ig(e,t){if(e.disabled)return;const i=t.x-e.calculative.worldRect.x;if(i>e.calculative.barRect.width)return;let a=Math.round(i/e.calculative.barRect.width*100);ae.max||a<0||a>100||(e.value=a,kc(e),e.calculative.text=e.value+e.unit,Fi(e),e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function gA(e,t){e.calculative.canvas.mouseDown&&Ig(e,t)}function vA(e){e.calculative.isUpdateData&&(delete e.calculative.isUpdateData,an(e)),kc(e)}function mA(e,t){return e.calculative.isUpdateData=!1,(t.textWidth||t.barHeight)&&(t.textWidth&&(e._textWidth=0),e.calculative.isUpdateData=!0),t}function yA(e,t){for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e.hasOwnProperty(i)&&(e[i]=a),e.calculative.hasOwnProperty(i)&&(e.calculative[i]=a)}e.background=t.sliderBg,e.calculative.background=t.sliderBg,e.btnBackground=t.sliderBtnBg,e.calculative.btnBackground=t.sliderBtnBg,e.activeColor=t.tabActiveBg,e.calculative.activeColor=t.tabActiveBg}function pA(e,t){t.onMouseDown||(t.onMouseDown=wA),t.options||(t.options=t.data);let i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.height;t.calculative.worldRect.width;const{fontStyle:n,fontWeight:r,fontSize:l,fontFamily:o,lineHeight:u}=t.calculative;let c=2;e.beginPath(),e.moveTo(i,a),e.arcTo(i+s,a,i+s,a+s,c),e.arcTo(i+s,a+s,i,a+s,c),e.arcTo(i,a+s,i,a,c),e.arcTo(i,a,i+s,a,c),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.checked&&(e.fillStyle=t.background||"#1890ff",e.strokeStyle=t.background||"#1890ff"),(t.isForbidden||t.disabled)&&(e.fillStyle=t.disabledBackground||ke(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||ke(.6,t.color)||"#d9d9d9"),e.closePath(),e.fill(),e.stroke(),e.save(),t.checked&&(e.beginPath(),e.lineWidth=s/10,e.strokeStyle="#ffffff",e.moveTo(i+102/506*s,a+s/2),e.lineTo(i+220/506*s,a+346/460*s),e.lineTo(i+404/506*s,a+142/460*s),e.stroke()),e.restore(),e.save(),e.fillStyle=t.disabled||t.isForbidden?t.disabledTextColor||ke(.6,t.textColor||t.color)||"#00000040":Ji(t,t.calculative.canvas.parent.store)||"#000000d9",e.textAlign="start",e.textBaseline="middle",e.font=Le({fontStyle:n,fontWeight:r,fontFamily:o||t.calculative.canvas.parent.store.options.fontFamily,fontSize:l,lineHeight:u}),e.fillText(t.value+"",i+s+10,a+s/2),e.restore()}function wA(e,t){e.isForbidden||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function bA(e,t){t.options||(t.options=t.data),t.onAdd||(t.onAdd=xA,t.optionPos||(t.onAdd(t),t.calculative.canvas.parent.active([t])),t.onMouseDown=_A,t.onValue=EA,t.onBeforeValue=AA);let i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.height,n=t.calculative.worldRect.width;if(!t.optionPos)return;const{fontStyle:r,fontWeight:l,fontSize:o,fontFamily:u,lineHeight:c}=t.calculative;if(t.direction=="horizontal")for(let f=0;fe.calculative.worldRect.x+e.optionPos[i]*e.calculative.worldRect.width/e.checkboxWidth&&t.xe.calculative.worldRect.y+e.optionPos[a]*i&&t.y{const a=t.data.pens.findIndex(s=>s.id===i);a>-1&&(t.data.pens.splice(a,1),t.pens[i]=void 0)}),e.children=void 0}function SA(e,t){e.onDestroy||(e.onDestroy=BA,e.onAdd=IA);const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:l}=e.calculative.worldRect;let o=e.calculative.borderRadius||0,u=o;o<1&&(o=n*o,u=r*u);let c=o{const a=t.data.pens.findIndex(s=>s.id===i);a>-1&&(t.data.pens.splice(a,1),t.pens[i]=void 0)}),e.children=[]}function b5(){return{interfaceClass:RA,simpleClass:SA}}var ln;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(ln||(ln={}));let nc=["fontSize","nameGap","margin","width","symbolSize","itemWidth","itemHeight","fontWeight","top","left","right","bottom","zoom","edgeSymbolSize","nodeWidth","nodeGap","distance","length","length2","offsetCenter","size","symbolOffset","padding","barWidth","symbolOffset","shadowOffsetY","shadowOffsetX"];function DA(e){var s,n;let t=globalThis.echarts;if(!e.echarts||!t)return;if(typeof e.echarts=="string")try{e.echarts=JSON.parse(e.echarts)}catch{}nc=((s=e.calculative.canvas.store.options.diagramOptions.chart)==null?void 0:s.keyWords)||nc,e.onDestroy||(e.onDestroy=MA,e.onMove=Dr,e.onResize=OA,e.onRotate=Dr,e.onValue=zA,e.onBeforeValue=HA,e.onBinds=UA,e.onMouseEnter=Dr,e.onRenderPenRaw=Dl,e.onScale=NA),e.calculative.singleton||(e.calculative.singleton={});const i=new Path2D,a=e.calculative.worldRect;if(!e.calculative.singleton.div){const r=document.createElement("div");r.style.position="absolute",r.style.outline="none",r.style.left="-9999px",r.style.top="-9999px",r.style.width=a.width+"px",r.style.height=a.height+"px",document.body.appendChild(r),(n=e.calculative.canvas.externalElements)==null||n.parentElement.appendChild(r),Fe(e,r),e.calculative.singleton.div=r,e.calculative.singleton.echart=t.init(r,e.echarts.theme),LA(e),e.calculative.singleton.echartsReady=!0,e.echarts.geoName&&!t.getMap(e.echarts.geoName)&&(e.echarts.geoJson?t.registerMap(e.echarts.geoName,e.echarts.geoJson):e.echarts.geoUrl&&(e.calculative.singleton.echartsReady=!1,fetch(e.echarts.geoUrl).then(l=>{l.text().then(o=>{if(typeof o=="string")try{o=JSON.parse(o)}catch{}if(o.constructor!==Object&&o.constructor!==Array){console.warn("Invalid data:",o);return}t.registerMap(e.echarts.geoName,o),e.calculative.singleton.echartsReady=!0,e.calculative.singleton.echart.setOption(Gr(e.echarts.option,e.calculative.canvas.store.data.scale),!0),e.calculative.singleton.echart.resize(),setTimeout(()=>{Dl(e)},300)})}))),e.calculative.singleton.echartsReady&&setTimeout(()=>{e.calculative.singleton.echart.setOption(Gr(e.echarts.option,e.calculative.canvas.store.data.scale),!0),setTimeout(()=>Dl(e),300)})}return i}function LA(e){var a;const t=e.calculative.singleton.echart,i=["click","dblclick","mousedown","mousemove","mouseup","mouseover","mouseout","globalout","contextmenu"];i.forEach(s=>{t.off(s)}),(a=e.events)==null||a.forEach(s=>{s.actions&&s.actions.length&&i.includes(s.name)&&t.on(s.name,n=>{let r=!1;s.conditions&&s.conditions.length?s.conditionType==="and"?r=s.conditions.every(l=>e.calculative.canvas.parent.judgeCondition(e,l.key,l)):s.conditionType==="or"&&(r=s.conditions.some(l=>e.calculative.canvas.parent.judgeCondition(e,l.key,l))):r=!0,r&&s.actions.forEach(l=>{if(l.timeout){let o=setTimeout(()=>{e.calculative.canvas.parent.events[l.action]&&(e.calculative.canvas.parent.events[l.action](e,l,n),clearTimeout(o),o=null)},l.timeout)}else e.calculative.canvas.parent.events[l.action]&&e.calculative.canvas.parent.events[l.action](e,l,n)})})})}function MA(e){if(e.calculative.singleton&&e.calculative.singleton.div){e.calculative.singleton.div.remove();let t=globalThis.echarts;t&&t.dispose(e.calculative.singleton.echart),delete e.calculative.singleton.div,delete e.calculative.singleton.echart}}function Dr(e){e.calculative.singleton.div&&Fe(e,e.calculative.singleton.div)}function OA(e){var t;Dr(e),(t=e.calculative.singleton)!=null&&t.echart&&e.calculative.singleton.echart.resize()}function NA(e){var i,a;if(!e.calculative.singleton.echart)return;let t=globalThis.echarts;if(Fe(e,e.calculative.singleton.div),!(e.echarts.geoName&&!t.getMap(e.echarts.geoName))){if(!e.echarts.diabled){if((i=e.echarts.option)!=null&&i.dataZoom){const n=e.calculative.singleton.echart.getOption().dataZoom;(a=e.echarts.option.dataZoom)==null||a.forEach((r,l)=>{n[l]&&(r.start=n[l].start,r.end=n[l].end)})}e.calculative.singleton.echart.setOption(Gr(e.echarts.option,e.calculative.canvas.store.data.scale),!0)}e.calculative.singleton.echart.resize()}}function zA(e){var t,i;if(!!e.calculative.singleton.echart&&(Fe(e,e.calculative.singleton.div),e.calculative.singleton.echartsReady))if(e.calculative.partialOption){const a=e.calculative.partialOption.echarts.option;(Array.isArray((t=e.echarts)==null?void 0:t.replaceMerge)?(i=e.echarts)==null?void 0:i.replaceMerge.some(n=>a[n]):!1)?e.calculative.singleton.echart.setOption(ht(a),{replaceMerge:e.echarts.replaceMerge}):e.calculative.singleton.echart.setOption(ht(a))}else e.calculative.singleton.echart.setOption(Gr(e.echarts.option,e.calculative.canvas.store.data.scale),!0)}function HA(e,t){if(e.calculative.partialOption=null,t.echarts){let m=globalThis.echarts;return t.echarts.geoName&&!m.getMap(t.echarts.geoName)&&(t.echarts.geoJson?m.registerMap(t.echarts.geoName,t.echarts.geoJson):t.echarts.geoUrl&&(e.calculative.singleton.echartsReady=!1,fetch(t.echarts.geoUrl).then(w=>{w.text().then(y=>{if(typeof y=="string")try{y=JSON.parse(y)}catch{}if(y.constructor!==Object&&y.constructor!==Array){console.warn("Invalid data:",y);return}return m.registerMap(t.echarts.geoName,y),e.calculative.singleton.echartsReady=!0,e.onValue(e),!1})}))),t}if(e.realTimes&&e.realTimes.length){e.echarts.dataMap&&t.data&&(t=WA(e,t));let m=Object.keys(t);const{xAxis:w,yAxis:y}=e.echarts.option,{max:_,replaceMode:A,timeFormat:x}=e.echarts;let C=[],T=!1;for(let I in t)if(I.includes("echarts.option")){T=!0;let D=ya(e,I);if(Array.isArray(D)&&A===ln.Add&&(D.push(t[I]),_&&D.splice(0,D.length-_),t[I]=D,!m.includes("echarts.option.xAxis.data"))){let B="echarts.option.xAxis.data";Array.isArray(w)&&w.length&&(B="echarts.option.xAxis.0.data");let V=ya(e,B),Q=Zl(x||"`${hours}:${minutes}:${seconds}`");V.push(Q),_&&V.splice(0,V.length-_),t[B]=V}if(I.includes(".data.")){let B=I.substring(0,I.indexOf(".data.")+5);C.includes(B)||C.push(B)}}if(T){const I=ht(t);e.calculative.partialOption=VA(I,e),C.forEach(D=>{let B=ya(e,D);Vr(e.calculative.partialOption,D,B)})}return t}if(!t.dataX&&!t.dataY)return t;const i=e.echarts,{max:a,replaceMode:s}=i;let n=t.dataX,r=t.dataY,l=[];r&&l.push("echarts.option.series");const o=i.option.series,u=o.length,{xAxis:c,yAxis:f}=i.option;Array.isArray(c)&&c.length>1&&console.warn("echarts \u53EA\u652F\u6301\u5355 x \u8F74\uFF0C\u591A x \u8F74\u5C06\u88AB\u5FFD\u7565");const g=Array.isArray(c)?c[0]:c,v=Array.isArray(f)?f[0]:f;if(s)if(s===ln.Replace){if(!g&&!v)r&&(u===1?(!Array.isArray(r)&&(r=[r]),r.forEach((m,w)=>{const y=o[0].data.find(_=>_.name===m.name);y&&(y.value=m.value)})):o.forEach((m,w)=>{Array.isArray(r[w])||(r[w]=[r[w]]),r[w].forEach((y,_)=>{const A=m.data.find(x=>x.name===y.name);A&&(A.value=y.value)})}));else if((g.type==="category"||v.type==="category")&&n&&r){const m=g.type==="category"?g.data:v.data;!Array.isArray(n)&&(n=[n]),!Array.isArray(r)&&(r=[r]),g.type==="category"?l.push("echarts.option.xAxis"):l.push("echarts.option.yAxis"),u===1?r.forEach((w,y)=>{const _=m.indexOf(n[y]);o[0].data[_]=w}):o.forEach((w,y)=>{r[y].forEach((_,A)=>{const x=m.indexOf(n[A]);w.data[x]=_})})}}else s===ln.ReplaceAll&&(n&&(g.data=n,g.data.splice(0,g.data.length-a),l.push("echarts.option.xAxis")),r&&(u===1?(o[0].data=r,o[0].data.splice(0,o[0].data.length-a)):o.forEach((m,w)=>{m.data=r[w],m.data.splice(0,m.data.length-a)})));else{if(n){!Array.isArray(n)&&(n=[n]);const m=g.data;m.push(...n),m.splice(0,m.length-a),l.push("echarts.option.xAxis")}if(r)if(u===1){!Array.isArray(r)&&(r=[r]);const m=o[0].data;m.push(...r),m.splice(0,m.length-a)}else o.forEach((m,w)=>{Array.isArray(r[w])||(r[w]=[r[w]]);const y=m.data;y.push(...r[w]),y.splice(0,y.length-a)})}return e.calculative.partialOption={},l.forEach(m=>{let w=ya(e,m);Vr(e.calculative.partialOption,m,w)}),delete t.dataX,delete t.dataY,Object.assign(t,{echarts:i})}function WA(e,t){var i,a;if(!e.echarts.dataMap||!t.data)return t;if(t.data){let s={};if(Array.isArray(t.data))for(const n in e.echarts.dataMap)e.echarts.dataMap.hasOwnProperty(n)&&(((i=e.echarts.timeKeys)==null?void 0:i.length)&&e.echarts.timeKeys.includes(e.echarts.dataMap[n])?s[n]=t.data.map(r=>Zl(e.echarts.timeFormat,r[e.echarts.dataMap[n]])):s[n]=t.data.map(r=>r[e.echarts.dataMap[n]]));else for(const n in e.echarts.dataMap)e.echarts.dataMap.hasOwnProperty(n)&&(((a=e.echarts.timeKeys)==null?void 0:a.length)&&e.echarts.timeKeys.includes(e.echarts.dataMap[n])?s[n]=Zl(e.echarts.timeFormat,t.data[e.echarts.dataMap[n]]):s[n]=t.data[e.echarts.dataMap[n]]);return delete t.data,Object.assign(t,s),t}}function UA(e,t,i){if(i.key!=="dataY")return;const a=e.echarts,{xAxis:s,yAxis:n}=a.option;Array.isArray(s)&&s.length>1&&console.warn("echarts \u53EA\u652F\u6301\u5355 x \u8F74\uFF0C\u591A x \u8F74\u5C06\u88AB\u5FFD\u7565");const r=Array.isArray(s)?s[0]:s,l=Array.isArray(n)?n[0]:n,o=a.option.series;if(!r&&!l){const u=[];if(Array.isArray(o)&&o.length===1)return o[0].data.forEach(c=>{const{dataId:f}=i.dataIds.find(g=>g.name===c.name);if(f){const g=t.find(v=>v.dataId===f);g&&u.push({name:c.name,value:g.value})}}),{id:e.id,dataY:u}}else if(r.type==="category"||l.type==="category"){const u=[],c=[],f=r.type==="category"?r.data:l.data;return f==null||f.forEach(g=>{const{dataId:v}=i.dataIds.find(m=>m.name===g);if(v){const m=t.find(w=>w.dataId===v);m&&(c.push(g),u.push(m.value))}}),{id:e.id,dataY:u,dataX:c}}else if(r.type==="time"){const u=[],c=+new Date;let f=!1;if(o.forEach((g,v)=>{const m=[],{dataId:w}=i.dataIds.find(y=>y.name===g.name);if(w){const y=t.find(_=>_.dataId===w);y&&(m.push([c,y.value]),f=!0)}u[v]=m}),f)u.forEach((g,v)=>{if(!g||g.length===0){const m=o[v].data[o[v].data.length-1];u[v]=[[c,m[1]]]}});else return;return{id:e.id,dataY:u.length===1?u[0]:u}}}function Dl(e){var i,a;const t=new Image;t.src=(a=(i=e.calculative.singleton)==null?void 0:i.echart)==null?void 0:a.getDataURL({pixelRatio:2}),e.calculative.img=t}function Gr(e,t){const i=ht(e);if(i.dataZoom){let a=["right","top","width","height","left","bottom"];for(let s=0;s{isNaN(n[a[s]])||(n[a[s]]*=t)})}return Xl(i,nc,t),i}function VA(e,t){const i={};return Object.keys(e).forEach(a=>{const s=a.split(".");let n=i;s.forEach((r,l)=>{const o=!isNaN(parseInt(r));if(l===6){let u=s.slice(0,7).join(".");Vr(t,a,e[a]);let c=ya(t,u);n[s[l]]=c}else{if(l>6)return;if(l===s.length-1)o?(Array.isArray(n)||(n=[]),n[parseInt(r)]=e[a]):n[r]=e[a];else if(o){const u=parseInt(r);if(Array.isArray(n)||n[s[l-1]],n[u]||(n[u]={}),Array.isArray(n))for(let c=0;c=0&&(i=Number.parseFloat(i).toFixed(t)),Number.parseFloat(i)}function Ll(e){return typeof e=="number"&&Number.isFinite(e)}function jA(e){e={max:null,min:null,splitNumber:4,symmetrical:!1,deviation:!1,preferZero:!1,...e};const t=[10,15,20,25,30,40,50,60,70,80,90,100,150];let{max:i,min:a,splitNumber:s,symmetrical:n,deviation:r,preferZero:l}=e;if(!Ll(i)||!Ll(a)||i0&&(i<0?i=0:a=0);const o=(i-a)/s;let u=Math.floor(Math.log10(o)-1);u=Math.pow(10,u);const c=o/u;let f=t[0]*u,g=-1,v;for(v=0;vc){f=t[v]*u;break}let m=i,w=a;function y(A){if(m=parseInt(""+(i/A+1))*A,w=parseInt(""+(a/A-1))*A,i===0&&(m=0),a===0&&(w=0),n&&m*w<0){const x=Math.max(Math.abs(m),Math.abs(w));m=x,w=-x}}if(y(f),r)return{max:Pa(m),min:Pa(w),interval:Pa(f),splitNumber:Math.round((m-w)/f)};if(!n||m*w>0){let A;t:do{if(A=Math.round((m-w)/f),(v-g)*(A-s)<0){for(;A=t.length-1||v<=0||A===s)break;g=v,A>s?f=t[++v]*u:f=t[--v]*u,y(f)}while(A!==s)}m=Pa(m),w=Pa(w);const _=Pa((m-w)/s);return{max:m,min:w,interval:_,splitNumber:s}}function Bg(e,t){var y,_,A,x,C,T,I,D,B,V,Q,F,R,P,M,Y,Z,nt,j,H,$,K,U,tt,at,et,ut,ct;const i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.width,n=t.calculative.worldRect.height;let r=t.calculative.canvas.store.data.scale,l=[];if(t.echarts)for(let ot=0;ot{m=i+(1+o/2)+(o+1)*T,w=a+s-(v[T]-u.min)/(u.max-u.min)*s;let I=i+(1+o/2)+(o+1)*(T+1),D=a+s-(v[T+1]-u.min)/(u.max-u.min)*s,B=i+(1+o/2)+(o+1)*(T-1),V=a+s-(v[T-1]-u.min)/(u.max-u.min)*s,Q=i+(1+o/2)+(o+1)*(T+2),F=a+s-(v[T+2]-u.min)/(u.max-u.min)*s;T===0?(B=i+(1+o/2)+(o+1)*T,V=a+s-(v[T]-u.min)/(u.max-u.min)*s):T===v.length-2&&(Q=i+(1+o/2)+(o+1)*(T+1),F=a+s-(v[T+1]-u.min)/(u.max-u.min)*s),f.push({x:m,y:w}),y=m+(I-B)/4,_=w+(D-V)/4,A=I-(Q-m)/4,x=D-(F-w)/4,e.bezierCurveTo(y,_,A,x,I,D)})}else for(let y=1;y{e.beginPath(),e.strokeStyle="#fff",e.lineWidth=2*n,e.arc(y.x,y.y,4*n,0,Math.PI*2),e.stroke(),e.fill(),e.closePath()}),e.restore(),f=[]}}function Dg(e,t){if(t.xAxisData||t.data||!t.dataX&&!t.dataY)return t;const i=e.xAxisData,a=e.data,s=e.replaceMode;let n=[],r=[];return s?s===Ps.Replace?(t.dataX.forEach((l,o)=>{let u=i.indexOf(l);a.forEach((c,f)=>{c[u]=t.dataY[f][o]})}),n=i,r=a):s===Ps.ReplaceAll&&(n=t.dataX,r=t.dataY):(n=[...i,...t.dataX],a.forEach((l,o)=>{let u=[...l,...t.dataY[o]];r.push(u)})),delete t.dataX,delete t.dataY,Object.assign(t,{xAxisData:n,data:r})}function KA(e,t){var c,f;t.onBeforeValue||(t.onBeforeValue=XA);let i=t.calculative.canvas.store.data.scale;const a=t.calculative.worldRect.x,s=t.calculative.worldRect.y,n=t.calculative.worldRect.width,r=t.calculative.worldRect.height,l=!!t.echarts;t.echarts?(t.echarts.option.color||(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]),t.chartsColor=t.echarts.option.color):t.chartsColor||(t.chartsColor=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]);const o=l?t.echarts.option.series:t.data;let u=0;for(let g=0;gD+B.value,0):_=v.reduce((D,B)=>D+B.value,0);const A=m*parseFloat(l?v.radius[0]:t.chartsRadius[g][0])/100,x=m*parseFloat(l?v.radius[1]:t.chartsRadius[g][1])/100;if(A>x)return;let C=0,T=0;e.strokeStyle=l&&((c=v.itemStyle)==null?void 0:c.borderColor)||"#fff",e.lineWidth=(l&&((f=v.itemStyle)==null?void 0:f.borderWidth)||2)*i;const I=l?v.data:v;I.forEach((D,B)=>{var Y,Z,nt,j,H,$,K,U,tt,at,et,ut,ct;T+=Math.PI*2*D.value/_,e.beginPath();let V=u+B;V>=t.chartsColor.length&&(V=V%t.chartsColor.length),e.fillStyle=l?t.echarts.option.color[V]:t.chartsColor[V],e.moveTo(w+A*Math.sin(T),y-A*Math.cos(T)),e.arc(w,y,A,-Math.PI/2+T,-Math.PI/2+C,!0),e.lineTo(w+x*Math.sin(C),y-x*Math.cos(C)),e.arc(w,y,x,-Math.PI/2+C,-Math.PI/2+T),e.lineTo(w+A*Math.sin(T),y-A*Math.cos(T)),e.stroke(),e.fill(),e.closePath();let Q=(C+T)/2,F=w+(x+10*i)*Math.sin(Q),R=y-(x+10*i)*Math.cos(Q),P=e.fillStyle;v.label||(v.label={position:"outside",show:!0}),l&&["inner","inside"].includes(v.label.position)?(e.fillStyle="#ffffff",F=w+(x-A)/2*Math.sin(Q),R=y-(x-A)/2*Math.cos(Q)):l&&v.label.position=="outside",v.labelLine||(v.labelLine={show:!0}),(l&&v.labelLine.show!==!1||!l)&&(e.beginPath(),e.strokeStyle=l?t.echarts.option.color[u+B]:t.chartsColor[u+B],e.moveTo(w+x*Math.sin(Q),y-x*Math.cos(Q)),e.lineTo(F,R));let M={fontStyle:((Y=t.tickLabel)==null?void 0:Y.fontStyle)||t.calculative.fontStyle,fontWeight:((Z=t.tickLabel)==null?void 0:Z.fontWeight)||t.calculative.fontWeight,fontFamily:((nt=t.tickLabel)==null?void 0:nt.fontFamily)||t.calculative.fontFamily,lineHeight:((j=t.tickLabel)==null?void 0:j.lineHeight)||t.calculative.lineHeight,fontSize:(((H=t.tickLabel)==null?void 0:H.fontSize)||t.calculative.fontSize)*i};e.font=Le(M),e.textBaseline="middle",e.textAlign="center",Q>Math.PI?((l&&v.label.position==="outside"||!l)&&(e.textAlign="end"),(l&&v.labelLine.show!==!1||!l&&((U=(K=($=t.tickLabel)==null?void 0:$.labelLine)==null?void 0:K.show)!=null?U:!0))&&e.lineTo(F-5*i,R),(l&&v.label.show!==!1||!l&&((at=(tt=t.tickLabel)==null?void 0:tt.show)!=null?at:!0))&&e.fillText(D.name,F-5*i,R)):((l&&v.label.position==="outside"||!l)&&(e.textAlign="start"),(l&&v.labelLine.show!==!1||!l)&&e.lineTo(F+5*i,R),(l&&v.label.show!==!1||!l&&((ut=(et=t.tickLabel)==null?void 0:et.show)!=null?ut:!0))&&e.fillText(D.name,F+5*i,R)),e.stroke(),e.closePath(),e.fillStyle=P,e.strokeStyle=l&&((ct=v.itemStyle)==null?void 0:ct.borderColor)||"#fff",C=T}),u+=I.length}}function XA(e,t){if(t.data||!t.dataX&&!t.dataY)return t;const i=e.data,a=e.replaceMode;let s=[];return a?a===Ps.Replace?(t.dataY.forEach((n,r)=>{n.forEach((l,o)=>{let u=i[r].filter(c=>c.name===l.name);u.length>0&&(u[0].value=l.value)})}),s=i):a===Ps.ReplaceAll&&(s=t.dataY):i.forEach((n,r)=>{let l=[...n,...t.dataY[r]];s.push(l)}),delete t.dataX,delete t.dataY,Object.assign(t,{data:s})}function GA(e,t){t.onBeforeValue||(t.onBeforeValue=Dg);let i=t.calculative.canvas.store.data.scale;const a=t.calculative.worldRect.x,s=t.calculative.worldRect.y;t.calculative.worldRect.width;const n=t.calculative.worldRect.height;let r=[];if(t.echarts&&!t.echarts.option.color&&(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]),t.echarts)for(let f=0;fn?n/2*9/10:s/2*9/10,u=i+s/2,c=a+n/2,f=t.echarts?t.echarts.option.series[0].data[0].value:t.value,g,v=t.startAngle-t.endAngle,m=t.background||"#E6EBF8";e.strokeStyle=m;let w=o/10;e.lineWidth=w,e.beginPath(),e.lineCap="round",e.arc(u,c,o,-t.startAngle/180*Math.PI,-t.endAngle/180*Math.PI),e.stroke(),e.closePath();let y=0;if(t.axisLine&&!t.isClock)for(let N=t.axisLine.length-1;N>=0;N--)t.axisLine[N][0]*(t.max-t.min).02?e.textAlign="end":G<-.02?e.textAlign="start":e.textAlign="center",rt>.02?e.textBaseline="top":rt<-.02?e.textBaseline="bottom":e.textBaseline="middle",e.fillText(qA(R*N+t.min,1),u+M*G,c-M*rt),e.fill()}e.closePath();let Y=1,Z=["value"];if(t.isClock&&(Y=3,Z=["hourvalue","minutevalue","secondvalue"]),t.isClock)for(let N=0;N0&&(X=(t.startAngle-(t[Z[N]]-t.min)/(t.max*5-t.min)*v)/180*Math.PI);let G=4/5*o;Z[N]==="hourvalue"&&(G=3/5*o),Z[N]==="minutevalue"&&(G=3.5/5*o);let rt=o*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=o/(N+1)/20,e.strokeStyle=t.color||"#999999",e.moveTo(u-rt*3*Math.cos(X),c+rt*3*Math.sin(X)),e.lineTo(u+G*Math.cos(X),c-G*Math.sin(X)),e.stroke()}else{let N=(t.startAngle-(f-t.min)/(t.max-t.min)*v)/180*Math.PI,X=4/5*o,G=o*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=2,e.fillStyle=g,e.moveTo(u-G*3*Math.cos(N),c+G*3*Math.sin(N)),e.lineTo(u+G*Math.cos(N-Math.PI/2),c-G*Math.sin(N-Math.PI/2)),e.lineTo(u+X*Math.cos(N),c-X*Math.sin(N)),e.lineTo(u+G*Math.cos(N+Math.PI/2),c-G*Math.sin(N+Math.PI/2)),e.lineTo(u-G*3*Math.cos(N),c+G*3*Math.sin(N)),e.fill()}e.beginPath(),e.textAlign="center",e.textBaseline="middle";let nt={fontStyle:((et=t.titleLabel)==null?void 0:et.fontStyle)||t.calculative.fontStyle,textDecoration:((ut=t.titleLabel)==null?void 0:ut.textDecoration)||t.textDecoration,fontWeight:((ct=t.titleLabel)==null?void 0:ct.fontWeight)||t.calculative.fontWeight,fontFamily:((ot=t.titleLabel)==null?void 0:ot.fontFamily)||t.calculative.fontFamily,fontSize:(((b=t.titleLabel)==null?void 0:b.fontSize)||t.calculative.fontSize)*r,lineHeight:((E=t.titleLabel)==null?void 0:E.lineHeight)||t.calculative.lineHeight};e.font=Le(nt),e.fillStyle=((S=t.titleLabel)==null?void 0:S.color)||g,t.isClock?e.fillText(("0"+parseInt(t.hourvalue)).slice(-2)+":"+("0"+parseInt(t.minutevalue)).slice(-2)+":"+("0"+parseInt(t.secondvalue)).slice(-2),u,c+o/2):e.fillText(f+" "+(t.unit||""),u,c+o/2),e.fill(),t.isClock&&(e.beginPath(),e.fillStyle=t.color||"#999999",e.strokeStyle="#ffffff",e.arc(u,c,o/20,0,Math.PI*2),e.stroke(),e.fill(),e.closePath())}function JA(e){if(e.isClock)e.clockInterval=setInterval(()=>{let t=new Date,i=t.getSeconds(),a=t.getMinutes()+i/60,s=t.getHours()%12+a/60;e.calculative.canvas.parent.setValue({id:e.id,hourvalue:s,minutevalue:a,secondvalue:i},{render:!0,doEvent:!1})},1e3);else{const t=e.value;e.value=0,e.frames=[{duration:2e3,value:t}],e.calculative.canvas.parent.startAnimate(e.id),setTimeout(()=>{e.value=t},1e3)}}function QA(e){e.clockInterval&&(clearInterval(e.clockInterval),e.clockInterval=void 0)}function tk(e){e.isClock&&(e.onDestroy(e),e.onAdd(e))}function _5(){return{lineChart:YA,histogram:GA,pieChart:KA,gauge:ZA}}function ek(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.rect(a,s,n,r),i.closePath(),i instanceof Path2D)return i}function ik(e,t){var g;const i=(g=t.headHeight)!=null?g:50,{x:a,y:s,width:n,height:r,ey:l}=t.calculative.worldRect;let o=t.calculative.borderRadius||0,u=o;t.calculative.borderRadius<1&&(o*=n,u*=r);let c=o({id:`${s}`,penId:e.id,x:i,y:a}))}function sk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r-n,o=.5*n;if(i.moveTo(a+n/2,s),i.lineTo(a+n/2,s+l),i.moveTo(a+n,s+o+l),i.arc(a+n/2,s+o+l,o,0,Math.PI*2,!1),i.closePath(),i instanceof Path2D)return i}function qf(e){const t=[{x:.5,y:0},{x:.5,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function nk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/2,o=n/5;if(i.moveTo(a,s+l),i.lineTo(a+o,s+l),i.moveTo(a+o*5,s+l),i.ellipse(a+o*3,s+l,2*o,l,0,0,Math.PI*2),i.closePath(),i instanceof Path2D)return i}function rk(e){const t=[{x:.6,y:0},{x:1,y:.5},{x:.6,y:1},{x:0,y:.5}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function ok(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/4,o=.5*n;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.moveTo(a,s+l),i.rect(a,s+l,o*2,l*2),i.moveTo(a+o,s+3*l),i.lineTo(a+o,s+4*l),i.closePath(),i instanceof Path2D)return i}function lk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/8,o=.25*n;if(i.moveTo(a+o*2,s),i.lineTo(a+o*2,s+l*2),i.lineTo(a+o*3,s+l*3),i.lineTo(a+o*3,s+l*5),i.lineTo(a+o*2,s+l*6),i.lineTo(a+o*1,s+l*5),i.lineTo(a+o*1,s+l*3),i.lineTo(a+o*2,s+l*2),i.moveTo(a+o*3,s+l*4),i.lineTo(a+o*4,s+l*4),i.moveTo(a+o*2,s+l*6),i.lineTo(a+o*2,s+l*8),i.closePath(),i instanceof Path2D)return i}function ck(e){const t=[{x:.5,y:0},{x:1,y:.5},{x:.5,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function hk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=n/2,o=r/10;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.moveTo(a+l,s+o),i.quadraticCurveTo(a+l*2,s+o,a+l*2,s+o*9),i.moveTo(a+l,s+o),i.quadraticCurveTo(a,s+o,a,s+o*9),i.quadraticCurveTo(a+l,s+o*6,a+l*2,s+o*9),i.moveTo(a+l,s+r*3/4),i.lineTo(a+l,s+r),i.moveTo(a+l*2/5,s+r*201/250),i.lineTo(a+l*2/5,s+r),i.moveTo(a+l*8/5,s+r*201/250),i.lineTo(a+l*8/5,s+r),i.closePath(),i instanceof Path2D)return i}function Yf(e){const t=[{x:.5,y:0},{x:.2,y:1},{x:.5,y:1},{x:.8,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function uk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/6,o=n/4;if(i.moveTo(a+o*2,s+0),i.lineTo(a+o*2,s+l),i.moveTo(a,s+l+o*2),i.arc(a+o*2,s+l+o*2,o*2,Math.PI*1,Math.PI*2,!1),i.lineTo(a+o*4,s+l*5),i.lineTo(a,s+l*5),i.lineTo(a,s+l+o*2),i.moveTo(a,s+l*5-l/3),i.lineTo(a+o*4,s+l*5-l/3),i.moveTo(a+o,s+l*5),i.lineTo(a+o,s+l*6),i.moveTo(a+o*2,s+l*5),i.lineTo(a+o*2,s+l*6),i.moveTo(a+o*3,s+l*5),i.lineTo(a+o*3,s+l*6),i.closePath(),i instanceof Path2D)return i}function fk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/4,o=.5*n;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.lineTo(a+o*2,s+l*2),i.lineTo(a+o*2,s+l*4),i.lineTo(a,s+l*4),i.lineTo(a,s+l*2),i.lineTo(a+o,s+l),i.closePath(),i instanceof Path2D)return i}function dk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/4,o=n/2;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.lineTo(a+o*2,s+l*4),i.lineTo(a,s+l*4),i.lineTo(a+o,s+l),i.closePath(),i instanceof Path2D)return i}function gk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,l=r/3,o=.5*n;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.lineTo(a+n,s+2*l),i.lineTo(a+o,s+r),i.lineTo(a,s+2*l),i.lineTo(a+o,s+l),i.closePath(),i instanceof Path2D)return i}function vk(e){const t=[{x:.5,y:0},{x:1,y:.6666666666666666},{x:.5,y:1},{x:0,y:.6666666666666666}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function mk(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;let l=n/2,o=r/10;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.moveTo(a+l,s+o),i.quadraticCurveTo(a+l*2,s+o,a+l*2,s+o*9),i.moveTo(a+l,s+o),i.quadraticCurveTo(a,s+o,a,s+o*9),i.quadraticCurveTo(a+l,s+o*6,a+l*2,s+o*9),i.moveTo(a,s+o*10),i.quadraticCurveTo(a+l,s+o*7,a+l*2,s+o*10),i.moveTo(a+l*2/5,s+r*201/250+o),i.lineTo(a+l*2/5,s+r),i.moveTo(a+l*8/5,s+r*201/250+o),i.lineTo(a+l*8/5,s+r),i.closePath(),i instanceof Path2D)return i}function yk(e){const t=[{x:.5,y:0},{x:.2,y:1},{x:.8,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function pk(e,t){const{x:i,y:a,width:s,height:n}=t.calculative.worldRect,r=s/2,l=n/10;e.beginPath(),e.moveTo(i+r,a),e.lineTo(i+r,a+l),e.moveTo(i+r,a+l),e.quadraticCurveTo(i+r*2,a+l,i+r*2,a+l*9),e.moveTo(i+r,a+l),e.quadraticCurveTo(i,a+l,i,a+l*9),e.quadraticCurveTo(i+r,a+l*6,i+r*2,a+l*9),e.moveTo(i+r,a+n*3/4),e.lineTo(i+r,a+n*9/10),e.moveTo(i+r*2/5,a+n*201/250),e.lineTo(i+r*2/5,a+n*9/10),e.moveTo(i+r*8/5,a+n*201/250),e.lineTo(i+r*8/5,a+n*9/10),e.stroke(),e.closePath(),e.beginPath();const o=r*2>l*10?l:r/5;e.fillStyle="#333333",e.font=o+"px Arial",e.textBaseline="bottom",e.textAlign="center",e.fillText("o",i+r,a+n),e.fillText("m",i+r*2/5,a+n),e.fillText("o",i+r*8/5,a+n),e.closePath()}function k5(){return{andGate:ak,basicEvent:sk,conditionalEvent:nk,event:ok,forbiddenGate:lk,orGate:hk,priorityAndGate:uk,switchEvent:fk,transferSymbol:dk,unexpandedEvent:gk,xorGate:mk}}function C5(){return{votingGate:pk}}function F5(){return{andGate:jf,orGate:Yf,priorityAndGate:jf,votingGate:Yf,xorGate:yk,forbiddenGate:ck,basicEvent:qf,unexpandedEvent:vk,conditionalEvent:rk,transferSymbol:qf}}const R5={background:"#ECE5E5",color:"#fff",textColor:"#fff",anchorColor:"#f90",gridSize:30,grid:!1,gridColor:"rgba(255,255,255,0.1)",drawingLineName:"line"},T5=[{name:"line",label:"\u76F4\u7EBF",icon:"t-line"},{name:"polyline",label:"\u7EBF\u6BB5",icon:"t-polyline"},{name:"curve",label:"\u66F2\u7EBF",icon:"t-curve2"},{name:"mind",label:"\u8111\u56FE\u66F2\u7EBF",icon:"t-mind"}],P5=["triangle","diamond","circle","lineDown","lineUp","triangleSolid","diamondSolid","circleSolid","line"],S5=["#000","#fff","#f00","#0f0","rgba(255,255,255,0.5)"],Lg={name:"\u6309\u94AE\u5F00\u5173",show:!0,list:[{name:"Lifter\uFF08\u5347\u964D\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/Lifter\uFF08\u5347\u964D\u673A\uFF09.svg"}},{name:"Light- green\uFF08\u7EFF\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/Light- green\uFF08\u7EFF\u706F\uFF09.svg"}},{name:"Light- red\uFF08\u7EA2\u706F\uFF09 (2).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/Light- red\uFF08\u7EA2\u706F\uFF09 (2).svg"}},{name:"iot-\u6309\u94AE_3-D black button(3d\u9ED1\u8272\u6309\u94AE).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D black button(3d\u9ED1\u8272\u6309\u94AE).svg"}},{name:"iot-\u6309\u94AE_3-D blue button\uFF083d\u84DD\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D blue button\uFF083d\u84DD\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_3-D green button\uFF083d\u7EFF\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D green button\uFF083d\u7EFF\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_3-D red button\uFF083d\u7EA2\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D red button\uFF083d\u7EA2\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_3-D yellow button\uFF083d\u9EC4\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_3-D yellow button\uFF083d\u9EC4\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_Blue pilot light\uFF08\u84DD\u8272\u6307\u793A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Blue pilot light\uFF08\u84DD\u8272\u6307\u793A\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Button \uFF08\u6309\u94AE\uFF09-10.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Button \uFF08\u6309\u94AE\uFF09-10.svg"}},{name:"iot-\u6309\u94AE_Button \uFF08\u6309\u94AE\uFF09-13.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Button \uFF08\u6309\u94AE\uFF09-13.svg"}},{name:"iot-\u6309\u94AE_Dark green pilot light\uFF08\u6DF1\u7EFF\u8272\u6307\u793A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dark green pilot light\uFF08\u6DF1\u7EFF\u8272\u6307\u793A\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-15.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-15.svg"}},{name:"iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-16.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-16.svg"}},{name:"iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-17.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-17.svg"}},{name:"iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-18.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Dial \uFF08\u8868\u76D8\uFF09-18.svg"}},{name:"iot-\u6309\u94AE_Long flip switch (\u957F\u7FFB\u8F6C\u5F00\u5173\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Long flip switch (\u957F\u7FFB\u8F6C\u5F00\u5173\uFF09.svg"}},{name:"iot-\u6309\u94AE_Navy pilot light\uFF08\u6D77\u519B\u9886\u822A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Navy pilot light\uFF08\u6D77\u519B\u9886\u822A\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Pilot light (off)\uFF08\u6307\u793A\u706F\uFF08\u5173\uFF09\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Pilot light (off)\uFF08\u6307\u793A\u706F\uFF08\u5173\uFF09\uFF09.svg"}},{name:"iot-\u6309\u94AE_Rectangular pushbutton\uFF08\u77E9\u5F62\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Rectangular pushbutton\uFF08\u77E9\u5F62\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_Red pilot light\uFF08\u7EA2\u8272\u4FE1\u53F7\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Red pilot light\uFF08\u7EA2\u8272\u4FE1\u53F7\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Red pushbutton\uFF08\u7EA2\u8272\u6309\u94AE\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Red pushbutton\uFF08\u7EA2\u8272\u6309\u94AE\uFF09.svg"}},{name:"iot-\u6309\u94AE_Rocker switch\uFF08\u7FD8\u677F\u5F00\u5173\uFF09-27.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Rocker switch\uFF08\u7FD8\u677F\u5F00\u5173\uFF09-27.svg"}},{name:"iot-\u6309\u94AE_Slider \uFF08\u6ED1\u5757\uFF09-40.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Slider \uFF08\u6ED1\u5757\uFF09-40.svg"}},{name:"iot-\u6309\u94AE_Slider \uFF08\u6ED1\u5757\uFF09-41.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Slider \uFF08\u6ED1\u5757\uFF09-41.svg"}},{name:"iot-\u6309\u94AE_Start button \uFF08\u542F\u52A8\u6309\u94AE\uFF09-47.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Start button \uFF08\u542F\u52A8\u6309\u94AE\uFF09-47.svg"}},{name:"iot-\u6309\u94AE_Throw switch (\u8F6C\u6362\u5F00\u5173\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Throw switch (\u8F6C\u6362\u5F00\u5173\uFF09.svg"}},{name:"iot-\u6309\u94AE_White pilot light\uFF08\u767D\u8272\u6307\u793A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_White pilot light\uFF08\u767D\u8272\u6307\u793A\u706F\uFF09.svg"}},{name:"iot-\u6309\u94AE_Yellow pushbutton(\u9EC4\u8272\u6309\u94AE).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_Yellow pushbutton(\u9EC4\u8272\u6309\u94AE).svg"}},{name:"iot-\u6309\u94AE_pilot light\uFF08\u6307\u793A\u706F\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6309\u94AE\u5F00\u5173/iot-\u6309\u94AE_pilot light\uFF08\u6307\u793A\u706F\uFF09.svg"}}]},Mg={name:"\u673A\u68B0\u8BBE\u5907",show:!0,list:[{name:"AGI mixer(AGI\u6DF7\u5408\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/AGI mixer(AGI\u6DF7\u5408\u5668).svg"}},{name:"Airswept tubular dryer(\u6C14\u6D41\u7BA1\u5F0F\u5E72\u71E5\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Airswept tubular dryer(\u6C14\u6D41\u7BA1\u5F0F\u5E72\u71E5\u673A).svg"}},{name:"Bag dump station(\u5378\u888B\u7AD9).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Bag dump station(\u5378\u888B\u7AD9).svg"}},{name:"Baghouse dust collector\uFF08\u888B\u5F0F\u9664\u5C18\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Baghouse dust collector\uFF08\u888B\u5F0F\u9664\u5C18\u5668\uFF09.svg"}},{name:"Ball mill(\u7403\u78E8\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Ball mill(\u7403\u78E8\u673A).svg"}},{name:"Cartridge dust collector\uFF08\u7B80\u5F0F\u9664\u5C18\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Cartridge dust collector\uFF08\u7B80\u5F0F\u9664\u5C18\u5668\uFF09.svg"}},{name:"Centrifugal type sifter(\u79BB\u5FC3\u5F0F\u7B5B).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Centrifugal type sifter(\u79BB\u5FC3\u5F0F\u7B5B).svg"}},{name:"Centrifuge(\u79BB\u5FC3\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Centrifuge(\u79BB\u5FC3\u673A).svg"}},{name:"Clarifier(\u6F84\u6E05\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Clarifier(\u6F84\u6E05\u5668).svg"}},{name:"Colloid mixer\uFF08\u80F6\u4F53\u6DF7\u5408\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Colloid mixer\uFF08\u80F6\u4F53\u6DF7\u5408\u5668\uFF09.svg"}},{name:"Compact spray dryer\uFF08\u7D27\u51D1\u578B\u55B7\u96FE\u5E72\u71E5\u5668 \uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Compact spray dryer\uFF08\u7D27\u51D1\u578B\u55B7\u96FE\u5E72\u71E5\u5668 \uFF09.svg"}},{name:"Cone crusher\uFF08\u5706\u9525\u7834\u788E\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Cone crusher\uFF08\u5706\u9525\u7834\u788E\u673A\uFF09.svg"}},{name:"Conical screw processor\uFF08\u9525\u5F62\u87BA\u6746\u5904\u7406\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Conical screw processor\uFF08\u9525\u5F62\u87BA\u6746\u5904\u7406\u673A\uFF09.svg"}},{name:"Cyclone \uFF08\u65CB\u98CE\u5206\u79BB\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Cyclone \uFF08\u65CB\u98CE\u5206\u79BB\u5668\uFF09.svg"}},{name:"Double roll crusher(\u53CC\u8F8A\u7834\u788E\u673A)-27.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Double roll crusher(\u53CC\u8F8A\u7834\u788E\u673A)-27.svg"}},{name:"Dryer-cooler\uFF08\u5E72\u71E5\u51B7\u5374\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Dryer-cooler\uFF08\u5E72\u71E5\u51B7\u5374\u5668\uFF09.svg"}},{name:"Dust collector (\u9664\u5C18\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Dust collector (\u9664\u5C18\u5668).svg"}},{name:"Dust reclaim\uFF08\u7C89\u5C18\u56DE\u6536\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Dust reclaim\uFF08\u7C89\u5C18\u56DE\u6536\u5668\uFF09.svg"}},{name:"Feeder\uFF08\u8FDB\u6599\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Feeder\uFF08\u8FDB\u6599\u5668\uFF09.svg"}},{name:"Flow meter\uFF08\u6D41\u91CF\u8BA1\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Flow meter\uFF08\u6D41\u91CF\u8BA1\uFF09.svg"}},{name:"Fluidizing conveyor\uFF08\u6DB2\u5316\u8F93\u9001\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Fluidizing conveyor\uFF08\u6DB2\u5316\u8F93\u9001\u673A\uFF09.svg"}},{name:"Gravimetric feeder (\u91CD\u529B\u7ED9\u6599\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Gravimetric feeder (\u91CD\u529B\u7ED9\u6599\u673A).svg"}},{name:"Hammermill \uFF08\u9524\u78E8\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Hammermill \uFF08\u9524\u78E8\u673A\uFF09.svg"}},{name:"Homomixer\uFF08\u5747\u8D28\u6DF7\u5408\u5668\uFF09 (1).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Homomixer\uFF08\u5747\u8D28\u6DF7\u5408\u5668\uFF09 (1).svg"}},{name:"Loss-in-weight feeder(\u5931\u91CD\u7ED9\u6599\u673A) .svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Loss-in-weight feeder(\u5931\u91CD\u7ED9\u6599\u673A) .svg"}},{name:"Loss-in-weight feeder(\u5931\u91CD\u7ED9\u6599\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Loss-in-weight feeder(\u5931\u91CD\u7ED9\u6599\u673A).svg"}},{name:"Meter 1(\u4EEA\u88681).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 1(\u4EEA\u88681).svg"}},{name:"Meter 10(\u4EEA\u886810).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 10(\u4EEA\u886810).svg"}},{name:"Meter 11(\u4EEA\u886811).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 11(\u4EEA\u886811).svg"}},{name:"Meter 12(\u4EEA\u886812).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 12(\u4EEA\u886812).svg"}},{name:"Meter 2(\u4EEA\u88682).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 2(\u4EEA\u88682).svg"}},{name:"Meter 4(\u4EEA\u88684).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 4(\u4EEA\u88684).svg"}},{name:"Meter 6(\u4EEA\u88686).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 6(\u4EEA\u88686).svg"}},{name:"Meter 7(\u4EEA\u88687).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 7(\u4EEA\u88687).svg"}},{name:"Meter 8(\u4EEA\u88688).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 8(\u4EEA\u88688).svg"}},{name:"Meter 9(\u4EEA\u88689).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter 9(\u4EEA\u88689).svg"}},{name:"Meter3(\u4EEA\u88683).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter3(\u4EEA\u88683).svg"}},{name:"Meter5(\u4EEA\u88685).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Meter5(\u4EEA\u88685).svg"}},{name:"Mill classification system(\u78E8\u673A\u5206\u7EA7\u7CFB\u7EDF).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Mill classification system(\u78E8\u673A\u5206\u7EA7\u7CFB\u7EDF).svg"}},{name:"Particles(\u7C92\u5B50).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Particles(\u7C92\u5B50).svg"}},{name:"Silo \uFF08\u7B52\u4ED3\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Silo \uFF08\u7B52\u4ED3\uFF09.svg"}},{name:"Spiral conveyor with hopper(\u5E26\u6599\u6597\u7684\u87BA\u65CB\u8F93\u9001\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Spiral conveyor with hopper(\u5E26\u6599\u6597\u7684\u87BA\u65CB\u8F93\u9001\u673A).svg"}},{name:"Stainless steel heavy-duty mixer(\u4E0D\u9508\u94A2\u91CD\u578B\u6405\u62CC\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Stainless steel heavy-duty mixer(\u4E0D\u9508\u94A2\u91CD\u578B\u6405\u62CC\u673A).svg"}},{name:"Steam boiler 1(\u84B8\u6C7D\u9505\u70891).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Steam boiler 1(\u84B8\u6C7D\u9505\u70891).svg"}},{name:"Three-stage wet collector\uFF08\u4E09\u7EA7\u6E7F\u5F0F\u6536\u96C6\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Three-stage wet collector\uFF08\u4E09\u7EA7\u6E7F\u5F0F\u6536\u96C6\u5668\uFF09.svg"}},{name:"Truck loader(\u6C7D\u8F66\u88C5\u8F7D\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Truck loader(\u6C7D\u8F66\u88C5\u8F7D\u673A).svg"}},{name:"Vacuum pressure unloader\uFF08\u771F\u7A7A\u51CF\u538B\u5668\uFF09-53.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Vacuum pressure unloader\uFF08\u771F\u7A7A\u51CF\u538B\u5668\uFF09-53.svg"}},{name:"Vertical shaft impactor\u7ACB\u8F74\u51B2\u51FB\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Vertical shaft impactor\u7ACB\u8F74\u51B2\u51FB\u5668).svg"}},{name:"Vibrating bin discharger with dual outlets\uFF08\u53CC\u51FA\u53E3\u632F\u52A8\u6599\u4ED3\u5378\u6599\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Vibrating bin discharger with dual outlets\uFF08\u53CC\u51FA\u53E3\u632F\u52A8\u6599\u4ED3\u5378\u6599\u5668\uFF09.svg"}},{name:"Volumatic feeder machine\uFF08\u5BB9\u79EF\u5F0F\u7ED9\u6599\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Volumatic feeder machine\uFF08\u5BB9\u79EF\u5F0F\u7ED9\u6599\u673A\uFF09.svg"}},{name:"Volumetric feeder(\u5BB9\u91CF\u7ED9\u6599\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Volumetric feeder(\u5BB9\u91CF\u7ED9\u6599\u673A).svg"}},{name:"Wire mesh container(\u91D1\u5C5E\u4E1D\u7F51\u5BB9\u5668).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/Wire mesh container(\u91D1\u5C5E\u4E1D\u7F51\u5BB9\u5668).svg"}},{name:"hopper(\u6F0F\u6597).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/hopper(\u6F0F\u6597).svg"}},{name:"truck(\u5361\u8F66).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u673A\u68B0\u8BBE\u5907/truck(\u5361\u8F66).svg"}}]},Og={name:"\u6C34\u5229\u8BBE\u5907",show:!0,list:[{name:"3-D 3-way solenoid valve with reset(\u5E26\u590D\u4F4D\u529F\u80FD\u76843d\u4E09\u901A\u7535\u78C1\u9600).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D 3-way solenoid valve with reset(\u5E26\u590D\u4F4D\u529F\u80FD\u76843d\u4E09\u901A\u7535\u78C1\u9600).svg"}},{name:"3-D 3-way solenoid valve\uFF083d\u4E09\u901A\u7535\u78C1\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D 3-way solenoid valve\uFF083d\u4E09\u901A\u7535\u78C1\u9600\uFF09.svg"}},{name:"3-D 3-way valve\uFF083d\u4E09\u901A\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D 3-way valve\uFF083d\u4E09\u901A\u9600\uFF09.svg"}},{name:"3-D 4-way valve\uFF083d\u56DB\u901A\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D 4-way valve\uFF083d\u56DB\u901A\u9600\uFF09.svg"}},{name:"3-D Angle blowdown valve\uFF08\u4E09\u7EF4\u89D2\u6392\u6C61\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Angle blowdown valve\uFF08\u4E09\u7EF4\u89D2\u6392\u6C61\u9600\uFF09.svg"}},{name:"3-D Plug valve\uFF083d\u65CB\u585E\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Plug valve\uFF083d\u65CB\u585E\u9600\uFF09.svg"}},{name:"3-D Regulator with external pressure tap\uFF08\u5E26\u5916\u90E8\u6D4B\u538B\u53E3\u76843d\u8C03\u8282\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Regulator with external pressure tap\uFF08\u5E26\u5916\u90E8\u6D4B\u538B\u53E3\u76843d\u8C03\u8282\u5668\uFF09.svg"}},{name:"3-D Stop check valve\uFF083d\u622A\u6B62\u6B62\u56DE\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Stop check valve\uFF083d\u622A\u6B62\u6B62\u56DE\u9600\uFF09.svg"}},{name:"3-D Valve,fail locked\uFF083d\u9600 \u6545\u969C\u9501\u5B9A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Valve,fail locked\uFF083d\u9600 \u6545\u969C\u9501\u5B9A\uFF09.svg"}},{name:"3-D Valve\uFF083d\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-D Valve\uFF083d\u9600\uFF09.svg"}},{name:"3-d pump(3d\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/3-d pump(3d\u6CF5).svg"}},{name:"Aeration basin 1\uFF08\u66DD\u6C14\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Aeration basin 1\uFF08\u66DD\u6C14\u6C60\uFF09.svg"}},{name:"Aeration basin 2\uFF08\u66DD\u6C14\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Aeration basin 2\uFF08\u66DD\u6C14\u6C60\uFF09.svg"}},{name:"Aeration digester \uFF08\u66DD\u6C14\u6C60).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Aeration digester \uFF08\u66DD\u6C14\u6C60).svg"}},{name:"Air diffuser system(\u7A7A\u6C14\u6269\u6563\u7CFB\u7EDF).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Air diffuser system(\u7A7A\u6C14\u6269\u6563\u7CFB\u7EDF).svg"}},{name:"Anaerobic sequencing batch reactor\uFF08\u538C\u6C27\u5E8F\u6279\u5F0F\u53CD\u5E94\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Anaerobic sequencing batch reactor\uFF08\u538C\u6C27\u5E8F\u6279\u5F0F\u53CD\u5E94\u5668\uFF09.svg"}},{name:"Ash disposal pond\uFF08\u7070\u6E23\u5904\u7406\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Ash disposal pond\uFF08\u7070\u6E23\u5904\u7406\u6C60\uFF09.svg"}},{name:"Asphalt filter\uFF08\u6CA5\u9752\u8FC7\u6EE4\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Asphalt filter\uFF08\u6CA5\u9752\u8FC7\u6EE4\u5668\uFF09.svg"}},{name:"Bag filtration system\uFF08\u888B\u5F0F\u8FC7\u6EE4\u7CFB\u7EDF\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Bag filtration system\uFF08\u888B\u5F0F\u8FC7\u6EE4\u7CFB\u7EDF\uFF09.svg"}},{name:"Ball valve \uFF08\u7403\u5F62\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Ball valve \uFF08\u7403\u5F62\u9600\uFF09.svg"}},{name:"Belt filter press\uFF08\u5E26\u5F0F\u8FC7\u6EE4\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Belt filter press\uFF08\u5E26\u5F0F\u8FC7\u6EE4\u5668\uFF09.svg"}},{name:"Biological treatment plant\uFF08\u751F\u7269\u5904\u7406\u5382\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Biological treatment plant\uFF08\u751F\u7269\u5904\u7406\u5382\uFF09.svg"}},{name:"Blue control valve with no flange\uFF08\u6CD5\u5170\u63A7\u5236\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Blue control valve with no flange\uFF08\u6CD5\u5170\u63A7\u5236\u9600\uFF09.svg"}},{name:"Carbon absorber\uFF08\u78B3\u5438\u6536\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Carbon absorber\uFF08\u78B3\u5438\u6536\u5668\uFF09.svg"}},{name:"Central Water Purifier\uFF08\u4E2D\u592E\u51C0\u6C34\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Central Water Purifier\uFF08\u4E2D\u592E\u51C0\u6C34\u5668\uFF09.svg"}},{name:"Central Water Softener\uFF08\u4E2D\u592E\u8F6F\u6C34\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Central Water Softener\uFF08\u4E2D\u592E\u8F6F\u6C34\u5668\uFF09.svg"}},{name:"Centrifugal pump (\u79BB\u5FC3\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Centrifugal pump (\u79BB\u5FC3\u6CF5).svg"}},{name:"Centrifugal pump with integral pump-motor shaft\uFF08\u6574\u4F53\u6CF5\u7535\u673A\u8F74\u79BB\u5FC3\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Centrifugal pump with integral pump-motor shaft\uFF08\u6574\u4F53\u6CF5\u7535\u673A\u8F74\u79BB\u5FC3\u6CF5\uFF09.svg"}},{name:"Centrifugal thermoplastic pump(\u79BB\u5FC3\u70ED\u5851\u6027\u5851\u6599\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Centrifugal thermoplastic pump(\u79BB\u5FC3\u70ED\u5851\u6027\u5851\u6599\u6CF5).svg"}},{name:"Check valve - Vertical\uFF08\u5782\u76F4\u5355\u5411\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Check valve - Vertical\uFF08\u5782\u76F4\u5355\u5411\u9600\uFF09.svg"}},{name:"Check valve - horizontal\uFF08\u6C34\u5E73\u5355\u5411\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Check valve - horizontal\uFF08\u6C34\u5E73\u5355\u5411\u9600\uFF09.svg"}},{name:"Chemical feeder\uFF08\u5316\u5B66\u52A0\u6599\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Chemical feeder\uFF08\u5316\u5B66\u52A0\u6599\u5668\uFF09.svg"}},{name:"Chemical pump (\u5316\u5B66\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Chemical pump (\u5316\u5B66\u6CF5).svg"}},{name:"Chlorinator\uFF08\u6C2F\u5316\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Chlorinator\uFF08\u6C2F\u5316\u5668\uFF09.svg"}},{name:"Civic Tap Water\uFF08\u57CE\u5E02\u81EA\u6765\u6C34\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Civic Tap Water\uFF08\u57CE\u5E02\u81EA\u6765\u6C34\uFF09.svg"}},{name:"Clarifier\uFF08\u6F84\u6E05\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Clarifier\uFF08\u6F84\u6E05\u6C60\uFF09.svg"}},{name:"Combustion turbine\uFF08\u71C3\u70E7\u5F0F\u6DA1\u8F6E\u673A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Combustion turbine\uFF08\u71C3\u70E7\u5F0F\u6DA1\u8F6E\u673A\uFF09.svg"}},{name:"Container\uFF08\u5BB9\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Container\uFF08\u5BB9\u5668\uFF09.svg"}},{name:"Control value\uFF08\u63A7\u5236\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Control value\uFF08\u63A7\u5236\u9600\uFF09.svg"}},{name:"Control valve - horizontal\uFF08\u6C34\u5E73\u63A7\u5236\u9600\uFF09 (2).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Control valve - horizontal\uFF08\u6C34\u5E73\u63A7\u5236\u9600\uFF09 (2).svg"}},{name:"Control valve - horizontal\uFF08\u6C34\u5E73\u63A7\u5236\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Control valve - horizontal\uFF08\u6C34\u5E73\u63A7\u5236\u9600\uFF09.svg"}},{name:"Corrosion resistant submersible pump(\u8010\u8150\u8680\u6F5C\u6C34\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Corrosion resistant submersible pump(\u8010\u8150\u8680\u6F5C\u6C34\u6CF5).svg"}},{name:"Covered dome tank(\u6709\u76D6\u62F1\u9876\u7F50).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Covered dome tank(\u6709\u76D6\u62F1\u9876\u7F50).svg"}},{name:"Dewatering system\uFF08\u8131\u6C34\u7CFB\u7EDF\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Dewatering system\uFF08\u8131\u6C34\u7CFB\u7EDF\uFF09.svg"}},{name:"Diaphragm pump(\u9694\u819C\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Diaphragm pump(\u9694\u819C\u6CF5).svg"}},{name:"Digester gas tanks\uFF08\u6CBC\u6C14\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Digester gas tanks\uFF08\u6CBC\u6C14\u6C60\uFF09.svg"}},{name:"Digester\uFF08\u84B8\u716E\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Digester\uFF08\u84B8\u716E\u5668\uFF09.svg"}},{name:"Digestion Reaction Tank\uFF08\u6D88\u5316\u53CD\u5E94\u7F50\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Digestion Reaction Tank\uFF08\u6D88\u5316\u53CD\u5E94\u7F50\uFF09.svg"}},{name:"Disc and drum filter\uFF08\u76D8\u5F0F\u9F13\u5F0F\u8FC7\u6EE4\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Disc and drum filter\uFF08\u76D8\u5F0F\u9F13\u5F0F\u8FC7\u6EE4\u5668\uFF09.svg"}},{name:"Drain\uFF08\u6392\u6C34\u7BA1\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Drain\uFF08\u6392\u6C34\u7BA1\uFF09.svg"}},{name:"Environmental gas process\uFF08\u73AF\u5883\u6C14\u4F53\u5DE5\u827A\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Environmental gas process\uFF08\u73AF\u5883\u6C14\u4F53\u5DE5\u827A\uFF09.svg"}},{name:"Evaporation\uFF08\u84B8\u53D1\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Evaporation\uFF08\u84B8\u53D1\u5668\uFF09.svg"}},{name:"Evaporator\uFF08\u84B8\u53D1\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Evaporator\uFF08\u84B8\u53D1\u5668\uFF09.svg"}},{name:"Explosion-proof pump\uFF08\u9632\u7206\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Explosion-proof pump\uFF08\u9632\u7206\u6CF5\uFF09.svg"}},{name:"Flanged pump \uFF08\u6CD5\u5170\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Flanged pump \uFF08\u6CD5\u5170\u6CF5\uFF09.svg"}},{name:"Flat vessel 1\uFF08\u6241\u5E73\u5BB9\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Flat vessel 1\uFF08\u6241\u5E73\u5BB9\u5668\uFF09.svg"}},{name:"Flex-mounted centrifugal pump(\u6320\u6027\u79BB\u5FC3\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Flex-mounted centrifugal pump(\u6320\u6027\u79BB\u5FC3\u6CF5).svg"}},{name:"Gravity belt thickener(\u91CD\u529B\u76AE\u5E26\u6D53\u7F29\u673A).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Gravity belt thickener(\u91CD\u529B\u76AE\u5E26\u6D53\u7F29\u673A).svg"}},{name:"Hand valve \uFF08\u624B\u52A8\u9600\uFF09 (3).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Hand valve \uFF08\u624B\u52A8\u9600\uFF09 (3).svg"}},{name:"Hand valve \uFF08\u624B\u52A8\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Hand valve \uFF08\u624B\u52A8\u9600\uFF09.svg"}},{name:"High temp heat trans pump\uFF08\u9AD8\u6E29\u70ED\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/High temp heat trans pump\uFF08\u9AD8\u6E29\u70ED\u6CF5\uFF09.svg"}},{name:"Hot Living Water Tank\uFF08\u70ED\u751F\u6D3B\u6C34\u7BB1\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Hot Living Water Tank\uFF08\u70ED\u751F\u6D3B\u6C34\u7BB1\uFF09.svg"}},{name:"Inclined plate clarifier \uFF08\u659C\u677F\u6F84\u6E05\u6C60\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Inclined plate clarifier \uFF08\u659C\u677F\u6F84\u6E05\u6C60\uFF09.svg"}},{name:"Metering pump \uFF08\u8BA1\u91CF\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Metering pump \uFF08\u8BA1\u91CF\u6CF5\uFF09.svg"}},{name:"Motor valve(\u7535\u52A8\u9600).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Motor valve(\u7535\u52A8\u9600).svg"}},{name:"Oil pump\uFF08\u6CB9\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Oil pump\uFF08\u6CB9\u6CF5\uFF09.svg"}},{name:"PVC two-way ball valve\uFF08\u53CC\u901A\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/PVC two-way ball valve\uFF08\u53CC\u901A\u9600\uFF09.svg"}},{name:"Pinch valve\uFF08\u5939\u7BA1\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Pinch valve\uFF08\u5939\u7BA1\u9600\uFF09.svg"}},{name:"Positive displacement gear pump\uFF08\u5BB9\u79EF\u5F0F\u9F7F\u8F6E\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Positive displacement gear pump\uFF08\u5BB9\u79EF\u5F0F\u9F7F\u8F6E\u6CF5\uFF09.svg"}},{name:"Pressure vessel\uFF08\u538B\u529B\u5BB9\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Pressure vessel\uFF08\u538B\u529B\u5BB9\u5668\uFF09.svg"}},{name:"Pump station\uFF08\u6CF5\u7AD9\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Pump station\uFF08\u6CF5\u7AD9\uFF09.svg"}},{name:"Pumping trap\uFF08\u62BD\u6C34\u84C4\u80FD\u5668\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Pumping trap\uFF08\u62BD\u6C34\u84C4\u80FD\u5668\uFF09.svg"}},{name:"Rotary valve\uFF08\u65CB\u8F6C\u9600\uFF09 (2).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Rotary valve\uFF08\u65CB\u8F6C\u9600\uFF09 (2).svg"}},{name:"Rotary valve\uFF08\u65CB\u8F6C\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Rotary valve\uFF08\u65CB\u8F6C\u9600\uFF09.svg"}},{name:"Running state\uFF08\u8FD0\u884C\u72B6\u6001\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Running state\uFF08\u8FD0\u884C\u72B6\u6001\uFF09.svg"}},{name:"Safety valve\uFF08\u5B89\u5168\u9600\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Safety valve\uFF08\u5B89\u5168\u9600\uFF09.svg"}},{name:"Self-priming centrifugal pump\uFF08\u81EA\u5438\u79BB\u5FC3\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Self-priming centrifugal pump\uFF08\u81EA\u5438\u79BB\u5FC3\u6CF5\uFF09.svg"}},{name:"Sewage pump(\u6C61\u6C34\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Sewage pump(\u6C61\u6C34\u6CF5).svg"}},{name:"Simple tank\uFF08\u7B80\u6613\u7F50\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Simple tank\uFF08\u7B80\u6613\u7F50\uFF09.svg"}},{name:"Solids-handling self-priming pump(\u56FA\u4F53\u8F93\u9001\u81EA\u5438\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Solids-handling self-priming pump(\u56FA\u4F53\u8F93\u9001\u81EA\u5438\u6CF5).svg"}},{name:"Spherical tank\uFF08\u7403\u7F50\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Spherical tank\uFF08\u7403\u7F50\uFF09.svg"}},{name:"Standard-flange positive displacement pump(\u6807\u51C6\u6CD5\u5170\u5BB9\u79EF\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Standard-flange positive displacement pump(\u6807\u51C6\u6CD5\u5170\u5BB9\u79EF\u6CF5).svg"}},{name:"Submersible sump pump\uFF08\u6F5C\u6C34\u96C6\u6C34\u5751\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Submersible sump pump\uFF08\u6F5C\u6C34\u96C6\u6C34\u5751\u6CF5\uFF09.svg"}},{name:"Tank with hatch\uFF08\u5E26\u8231\u53E3\u7684\u6C34\u7BB1\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Tank with hatch\uFF08\u5E26\u8231\u53E3\u7684\u6C34\u7BB1\uFF09.svg"}},{name:"Threaded gear\uFF08\u87BA\u7EB9\u9F7F\u8F6E\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Threaded gear\uFF08\u87BA\u7EB9\u9F7F\u8F6E\uFF09.svg"}},{name:"Valve wheel\uFF08\u9600\u8F6E\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Valve wheel\uFF08\u9600\u8F6E\uFF09.svg"}},{name:"Vertical pump \uFF08\u7ACB\u5F0F\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/Vertical pump \uFF08\u7ACB\u5F0F\u6CF5\uFF09.svg"}},{name:"cool pump(\u51B7\u5374\u6CF5).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/cool pump(\u51B7\u5374\u6CF5).svg"}},{name:"heavy-duty plastic centrifugal pump\uFF08\u91CD\u578B\u5851\u6599\u79BB\u5FC3\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/heavy-duty plastic centrifugal pump\uFF08\u91CD\u578B\u5851\u6599\u79BB\u5FC3\u6CF5\uFF09.svg"}},{name:"iot-\u7BA1\u9053(21)-02.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-02.svg"}},{name:"iot-\u7BA1\u9053(21)-03.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-03.svg"}},{name:"iot-\u7BA1\u9053(21)-04.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-04.svg"}},{name:"iot-\u7BA1\u9053(21)-05.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-05.svg"}},{name:"iot-\u7BA1\u9053(21)-06.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-06.svg"}},{name:"iot-\u7BA1\u9053(21)-07.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-07.svg"}},{name:"iot-\u7BA1\u9053(21)-08.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-08.svg"}},{name:"iot-\u7BA1\u9053(21)-09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-09.svg"}},{name:"iot-\u7BA1\u9053(21)-10.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-10.svg"}},{name:"iot-\u7BA1\u9053(21)-11.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-11.svg"}},{name:"iot-\u7BA1\u9053(21)-12.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-12.svg"}},{name:"iot-\u7BA1\u9053(21)-13.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-13.svg"}},{name:"iot-\u7BA1\u9053(21)-14.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-14.svg"}},{name:"iot-\u7BA1\u9053(21)-15.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-15.svg"}},{name:"iot-\u7BA1\u9053(21)-16.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-16.svg"}},{name:"iot-\u7BA1\u9053(21)-17.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-17.svg"}},{name:"iot-\u7BA1\u9053(21)-18.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-18.svg"}},{name:"iot-\u7BA1\u9053(21)-19.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-19.svg"}},{name:"iot-\u7BA1\u9053(21)-20.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-20.svg"}},{name:"iot-\u7BA1\u9053(21)-21.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)-21.svg"}},{name:"iot-\u7BA1\u9053(21)_\u753B\u677F 1.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/iot-\u7BA1\u9053(21)_\u753B\u677F 1.svg"}},{name:"oil well pump\uFF08\u6CB9\u4E95\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/oil well pump\uFF08\u6CB9\u4E95\u6CF5\uFF09.svg"}},{name:"simple Vertical pump \uFF08\u7B80\u6613\u7ACB\u5F0F\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/simple Vertical pump \uFF08\u7B80\u6613\u7ACB\u5F0F\u6CF5\uFF09.svg"}},{name:"sump pump\uFF08\u6C61\u6C34\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/sump pump\uFF08\u6C61\u6C34\u6CF5\uFF09.svg"}},{name:"tube pump\uFF08\u7BA1\u5F0F\u6CF5\uFF09.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/tube pump\uFF08\u7BA1\u5F0F\u6CF5\uFF09.svg"}},{name:"\u706B.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u706B.svg"}},{name:"\u9600\u95E8-01.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u9600\u95E8-01.svg"}},{name:"\u71C3\u8102.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u71C3\u8102.svg"}},{name:"\u9505\u7089.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u9505\u7089.svg"}},{name:"\u84C4\u6C34\u6C60 (1).svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u84C4\u6C34\u6C60 (1).svg"}},{name:"\u84C4\u6C34\u6C60.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u84C4\u6C34\u6C60.svg"}},{name:"\u6C34\u5229\u4F01\u4E1A.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u6C34\u5229\u4F01\u4E1A.svg"}},{name:"\u6C34\u5229\u8BBE\u65BD.svg",data:{text:"",width:100,height:100,name:"svgPath",image:"/static/figures/\u6C34\u5229\u8BBE\u5907/\u6C34\u5229\u8BBE\u65BD.svg"}}]},wk={name:"\u7BA1\u9053",show:!0,list:[{name:"\u77ED",data:{text:"",width:22,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u77ED.svg"}},{name:"\u6A2A\u5411",data:{text:"",width:68,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u6A2A\u5411.svg"}},{name:"45\u5EA6",data:{text:"",width:75,height:58,name:"svgPath",image:"/static/figures/pipe-new/45\u5EA6.svg"}},{name:"90\u5EA6",data:{text:"",width:84,height:84,name:"svgPath",image:"/static/figures/pipe-new/90\u5EA6.svg"}},{name:"\u56DB\u901A",data:{text:"",width:95,height:84,name:"svgPath",image:"/static/figures/pipe-new/\u56DB\u901A.svg"}},{name:"\u77ED-\u7070\u8272",data:{text:"",width:22,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u77ED-\u7070\u8272.svg"}},{name:"\u6A2A\u5411-\u7070\u8272",data:{text:"",width:68,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u6A2A\u5411-\u7070\u8272.svg"}},{name:"45\u5EA6-\u7070\u8272",data:{text:"",width:75,height:58,name:"svgPath",image:"/static/figures/pipe-new/45\u5EA6-\u7070\u8272.svg"}},{name:"90\u5EA6-\u7070\u8272",data:{text:"",width:84,height:84,name:"svgPath",image:"/static/figures/pipe-new/90\u5EA6-\u7070\u8272.svg"}},{name:"\u4E09\u901AL",data:{text:"",width:91,height:79,name:"svgPath",image:"/static/figures/pipe-new/\u4E09\u901AL.svg"}},{name:"\u77ED-\u84DD\u8272",data:{text:"",width:22,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u77ED-\u84DD\u8272.svg"}},{name:"\u6A2A\u5411-\u84DD\u8272",data:{text:"",width:68,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u6A2A\u5411-\u84DD\u8272.svg"}},{name:"45\u5EA6-\u84DD\u8272",data:{text:"",width:75,height:58,name:"svgPath",image:"/static/figures/pipe-new/45\u5EA6-\u84DD\u8272.svg"}},{name:"90\u5EA6-\u84DD\u8272",data:{text:"",width:84,height:84,name:"svgPath",image:"/static/figures/pipe-new/90\u5EA6-\u84DD\u8272.svg"}},{name:"\u4E09\u901AT",data:{text:"",width:85,height:66,name:"svgPath",image:"/static/figures/pipe-new/\u4E09\u901AT.svg"}},{name:"\u77ED-\u7D2B\u8272",data:{text:"",width:22,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u77ED-\u7D2B\u8272.svg"}},{name:"\u6A2A\u5411-\u7D2B\u8272",data:{text:"",width:68,height:30,name:"svgPath",image:"/static/figures/pipe-new/\u6A2A\u5411-\u7D2B\u8272.svg"}},{name:"45\u5EA6-\u7D2B\u8272",data:{text:"",width:75,height:58,name:"svgPath",image:"/static/figures/pipe-new/45\u5EA6-\u7D2B\u8272.svg"}},{name:"90\u5EA6-\u7D2B\u8272",data:{text:"",width:84,height:84,name:"svgPath",image:"/static/figures/pipe-new/90\u5EA6-\u7D2B\u8272.svg"}},{name:"\u4E09\u901AY",data:{text:"",width:85,height:85,name:"svgPath",image:"/static/figures/pipe-new/\u4E09\u901AY.svg"}},{name:"\u9600\u95E8-\u7EFF\u8272",data:{text:"",width:32,height:80,name:"svgPath",image:"/static/figures/pipe-new/\u9600\u95E8-green.svg"}},{name:"\u9600\u95E8-\u7EA2\u8272",data:{text:"",width:32,height:80,name:"svgPath",image:"/static/figures/pipe-new/\u9600\u95E8-red.svg"}},{name:"\u9600\u95E8-\u9EC4\u8272",data:{text:"",width:32,height:80,name:"svgPath",image:"/static/figures/pipe-new/\u9600\u95E8-yellow.svg"}},{name:"\u7BA1\u9053\u5E26\u9600\u95E8",data:{text:"",width:86,height:38,name:"svgPath",image:"/static/figures/pipe-new/\u7BA1\u9053\u5E26\u9600\u95E8.svg"}},{name:"\u5206\u6C14\u7F38",data:{text:"",width:229,height:108,name:"svgPath",image:"/static/figures/pipe-new/\u5206\u6C14\u7F38.svg"}}]},bk={name:"\u6309\u94AE",show:!0,list:[{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE0.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE1.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE2.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE3.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE4.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE5.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE6.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE7.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE8.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE9.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE10.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE11.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE12.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE13.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE14.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE15.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE16.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE17.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE18.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE19.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE20.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE21.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE22.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE23.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE24.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE25.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE26.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE27.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE28.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE29.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE30.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE31.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE32.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE33.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE34.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE35.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE36.svg"}},{data:{text:"",width:31,height:52,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE37.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE38.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE39.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE40.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE41.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE42.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE43.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE44.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE45.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE46.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE47.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE48.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/btn-1/\u6309\u94AE49.svg"}}]},xk={name:"\u7535\u529B",show:!0,list:[{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/1.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/2.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/3.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/4.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/5.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/6.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/7.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/8.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/9.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/10.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/11.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/12.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/13.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/14.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/15.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/16.svg"}},{data:{text:"",width:40,height:40,name:"svgPath",image:"/static/figures/ele-1/17.svg"}}]},I5=["time-comp"],Cc=window.allEnv.topo.showAllMenu||!1;Lg.show=Cc;Mg.show=Cc;Og.show=Cc;const B5=[{name:"\u57FA\u672C\u5F62\u72B6",show:!0,list:[{name:"square",icon:"t-icon t-rect",id:1,data:{text:"\u6B63\u65B9\u5F62",width:100,height:100,name:"square"}},{name:"rectangle",icon:"t-icon t-rectangle",id:2,data:{text:"\u5706\u89D2\u77E9\u5F62",width:200,height:50,borderRadius:.1,name:"rectangle"}},{name:"circle",icon:"t-icon t-circle",id:3,data:{text:"\u5706",width:100,height:100,name:"circle"}},{name:"text",icon:"t-icon t-text",id:16,data:{text:"\u6587\u5B57",width:100,height:40,name:"text",disableAnchor:!0}},{name:"triangle",icon:"t-icon t-triangle",id:4,data:{text:"\u4E09\u89D2\u5F62",width:100,height:100,name:"triangle"}},{name:"diamond",icon:"t-icon t-diamond",id:5,data:{text:"\u83F1\u5F62",width:100,height:100,name:"diamond"}},{name:"pentagon",icon:"t-icon t-pentagon",id:6,data:{text:"\u4E94\u8FB9\u5F62",width:100,height:100,name:"pentagon"}},{name:"hexagon",icon:"t-icon t-hexagon",id:7,data:{text:"\u516D\u8FB9\u5F62",width:100,height:100,name:"hexagon"}},{name:"pentagram",icon:"t-icon t-pentagram",id:8,data:{text:"\u4E94\u89D2\u661F",width:100,height:100,name:"pentagram"}},{name:"leftArrow",icon:"t-icon t-arrow-left",id:9,data:{text:"\u5DE6\u7BAD\u5934",width:120,height:60,name:"leftArrow"}},{name:"rightArrow",icon:"t-icon t-arrow-right",id:10,data:{text:"\u53F3\u7BAD\u5934",width:120,height:60,name:"rightArrow"}},{name:"twowayArrow",icon:"t-icon t-twoway-arrow",id:11,data:{text:"\u53CC\u5411\u7BAD\u5934",width:150,height:60,name:"twowayArrow"}},{name:"cloud",icon:"t-icon t-cloud",id:13,data:{text:"\u4E91",width:100,height:100,name:"cloud"}},{name:"message",icon:"t-icon t-msg",id:14,data:{textTop:-.1,text:"\u6D88\u606F\u6846",width:100,height:100,name:"message"}},{name:"file",icon:"t-icon t-file",id:15,data:{text:"\u6587\u6863",width:80,height:100,name:"file"}},{name:"image",icon:"t-icon t-image",id:17,data:{text:"",width:100,height:100,name:"image",image:"https://zhgy.sagoo.cn/base-api/upload_file/2023-11-24/cx73xp2ebryeijgtdt.jpeg"}},{name:"\u52A8\u56FE",icon:"t-icon t-image",data:{text:"",width:100,height:100,name:"gif",image:"/plugin/topo/static/gif.gif"}},{name:"people",icon:"t-icon t-people",id:19,data:{width:70,height:100,name:"people"}},{name:"switch",icon:"t-icon t-kaiguan",data:{name:"switch",checked:!0,onColor:"#1890ff",offColor:"#BFBFBF",width:60,height:30}},{name:"rectangle",icon:"t-icon t-shurukuang",id:2,data:{width:200,height:50,borderRadius:.1,input:!0,name:"rectangle",activeTextColor:"#000000FF",color:"#D9D9D9FF",hoverTextColor:"#000000FF",lineHeight:1.5,lineWidth:1,text:"\u8F93\u5165\u6570\u636E",textAlign:"left",textColor:"#000000FF",textLeft:10}}]},{name:"Echarts\u56FE\u5F62",show:!0,list:[{name:"\u6298\u7EBF\u56FE",icon:"t-icon t-line-chart",data:{name:"echarts",width:400,height:300,externElement:!0,disableAnchor:!0,canDataBind:!0,echarts:{option:{grid:{top:10,bottom:30,left:40,right:50},xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},yAxis:{type:"value"},series:[{data:[820,932,901,934,1290,1330,1320],type:"line"}]}}}},{name:"\u67F1\u72B6\u56FE",icon:"t-icon t-bar-chart",data:{width:300,height:200,disableAnchor:!0,externElement:!0,name:"echarts",canDataBind:!0,echarts:{option:{tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],axisTick:{alignWithLabel:!0}},yAxis:[{type:"value"}],series:[{name:"\u76F4\u63A5\u8BBF\u95EE",type:"bar",barWidth:"60%",data:[10,52,200,334,390,330,220]}]},max:100}}},{name:"\u997C\u56FE",icon:"t-icon t-pie-chart",data:{width:200,height:200,disableAnchor:!0,externElement:!0,name:"echarts",canDataBind:!1,echarts:{option:{tooltip:{trigger:"item",formatter:"{a}
{b}: {c} ({d}%)"},legend:{},series:[{name:"\u8BBF\u95EE\u6765\u6E90",type:"pie",radius:["50%","70%"],avoidLabelOverlap:!1,label:{normal:{show:!1,position:"center"},emphasis:{show:!0,textStyle:{fontSize:"30",fontWeight:"bold"}}},labelLine:{normal:{show:!1}},data:[{value:335,name:"\u76F4\u63A5\u8BBF\u95EE"},{value:310,name:"\u90AE\u4EF6\u8425\u9500"},{value:234,name:"\u8054\u76DF\u5E7F\u544A"},{value:135,name:"\u89C6\u9891\u5E7F\u544A"},{value:1548,name:"\u641C\u7D22\u5F15\u64CE"}]}]}}}},{name:"\u4EEA\u8868\u76D8",icon:"t-icon t-dashboard-chart",data:{width:300,height:300,disableAnchor:!0,externElement:!0,name:"echarts",canDataBind:!0,echarts:{option:{series:[{name:"\u4E1A\u52A1\u6307\u6807",type:"gauge",min:0,max:100,detail:{formatter:"{value}%"},data:[{value:50,name:"\u5B8C\u6210\u7387"}]}]}}}}]},{name:"\u529F\u80FD\u7EC4\u4EF6",show:!0,list:[{name:"\u65F6\u95F4",icon:"topoicon topo-time",id:16,data:{text:"2022/12/12 12:12:12",width:200,height:40,name:"text",tags:["time-comp"],disableAnchor:!0}},{name:"\u6309\u94AE",icon:"t-icon t-anniu",data:{name:"rectangle",customType:"link-button",x:300,y:200,width:80,height:30,disableAnchor:!0,borderRadius:2,text:"\u6309\u94AE",activeBackground:"",activeColor:"",background:"#1890ff",color:"#1890ff",hoverBackground:"",hoverColor:"",textColor:"#ffffff",hoverTextColor:"#ffffff",activeTextColor:"#ffffff"}}]},{...wk},{...bk},{...xk},{...Lg},{...Mg},{...Og},{name:"\u7535\u529B\u7CFB\u7EDF-1",show:!0,list:[{font_family:"sg-ele",my_class:"uniE00A",unicode:"e900"},{font_family:"sg-ele",my_class:"uniE04D",unicode:"e97e"},{font_family:"sg-ele",my_class:"uniE04E",unicode:"e97f"},{font_family:"sg-ele",my_class:"uniE005",unicode:"e981"},{font_family:"sg-ele",my_class:"uniE007",unicode:"e98f"},{font_family:"sg-ele",my_class:"uniE006",unicode:"e988"},{font_family:"sg-ele",my_class:"uniE008",unicode:"e996"},{font_family:"sg-ele",my_class:"uniE009",unicode:"e99d"},{font_family:"sg-ele",my_class:"uniE012",unicode:"e9b2"},{font_family:"sg-ele",my_class:"uniE082",unicode:"ea09"},{font_family:"sg-ele",my_class:"uniE088",unicode:"ea0f"},{font_family:"sg-ele",my_class:"uniE090",unicode:"ea11"},{font_family:"sg-ele",my_class:"uniE107",unicode:"ea22"},{font_family:"sg-ele",my_class:"uniE152",unicode:"ea4f"},{font_family:"sg-ele",my_class:"uniE080",unicode:"ea07"},{font_family:"sg-ele",my_class:"uniE084",unicode:"ea0b"},{font_family:"sg-ele",my_class:"uniE059",unicode:"e9f2"},{font_family:"sg-ele",my_class:"uniE10C",unicode:"e9a7"},{font_family:"sg-ele",my_class:"uniE0A0",unicode:"e901"}]},{name:"\u7535\u529B\u7CFB\u7EDF-2",show:!0,list:[{font_family:"sg-ele",my_class:"uniE09E",unicode:"e9a2"},{font_family:"sg-ele",my_class:"uniE010",unicode:"e9a4"},{font_family:"sg-ele",my_class:"uniE014",unicode:"e9bf"},{font_family:"sg-ele",my_class:"uniE040",unicode:"e9df"},{font_family:"sg-ele",my_class:"uniE041",unicode:"e9e0"},{font_family:"sg-ele",my_class:"uniE042",unicode:"e9e1"},{font_family:"sg-ele",my_class:"uniE043",unicode:"e9e2"},{font_family:"sg-ele",my_class:"uniE044",unicode:"e9e3"},{font_family:"sg-ele",my_class:"uniE062",unicode:"e9f5"},{font_family:"sg-ele",my_class:"uniE110",unicode:"ea25"},{font_family:"sg-ele",my_class:"uniE095",unicode:"ea16"},{font_family:"sg-ele",my_class:"uniE0FC",unicode:"e961"},{font_family:"sg-ele",my_class:"uniE02B",unicode:"e96e"},{font_family:"sg-ele",my_class:"uniE06C",unicode:"e98b"},{font_family:"sg-ele",my_class:"uniE0A1",unicode:"e902"},{font_family:"sg-ele",my_class:"uniE0ED",unicode:"e951"},{font_family:"sg-ele",my_class:"uniE00E",unicode:"e943"},{font_family:"sg-ele",my_class:"uniE0DB",unicode:"e93e"},{font_family:"sg-ele",my_class:"uniE0F0",unicode:"e955"},{font_family:"sg-ele",my_class:"uniE0EC",unicode:"e950"},{font_family:"sg-ele",my_class:"uniE0EE",unicode:"e952"},{font_family:"sg-ele",my_class:"uniE00B",unicode:"e911"},{font_family:"sg-ele",my_class:"uniE018",unicode:"e9c9"},{font_family:"sg-ele",my_class:"uniE103",unicode:"ea1e"},{font_family:"sg-ele",my_class:"uniE094",unicode:"ea15"},{font_family:"sg-ele",my_class:"uniE073",unicode:"ea00"}]},{name:"\u7535\u529B\u7CFB\u7EDF-3",show:!0,list:[{font_family:"sg-ele",my_class:"uniE0E4",unicode:"e948"},{font_family:"sg-ele",my_class:"uniE00F",unicode:"e954"},{font_family:"sg-ele",my_class:"uniE05A",unicode:"e982"},{font_family:"sg-ele",my_class:"uniE0AC",unicode:"e90d"},{font_family:"sg-ele",my_class:"uniE0AD",unicode:"e90e"},{font_family:"sg-ele",my_class:"uniE08F",unicode:"e99c"},{font_family:"sg-ele",my_class:"uniE02D",unicode:"e970"},{font_family:"sg-ele",my_class:"uniE09A",unicode:"e99e"},{font_family:"sg-ele",my_class:"uniE00D",unicode:"e932"},{font_family:"sg-ele",my_class:"uniE0C5",unicode:"e928"},{font_family:"sg-ele",my_class:"uniE10B",unicode:"e9a6"},{font_family:"sg-ele",my_class:"uniE00C",unicode:"e922"},{font_family:"sg-ele",my_class:"uniE0F5",unicode:"e95a"},{font_family:"sg-ele",my_class:"uniE01D",unicode:"e969"},{font_family:"sg-ele",my_class:"uniE02C",unicode:"e96f"},{font_family:"sg-ele",my_class:"uniE002",unicode:"e96c"},{font_family:"sg-ele",my_class:"uniE019",unicode:"e9ca"},{font_family:"sg-ele",my_class:"uniE020",unicode:"e9cb"},{font_family:"sg-ele",my_class:"uniE021",unicode:"e9cc"},{font_family:"sg-ele",my_class:"uniE022",unicode:"e9cd"},{font_family:"sg-ele",my_class:"uniE102",unicode:"ea1d"},{font_family:"sg-ele",my_class:"uniE023",unicode:"e9ce"},{font_family:"sg-ele",my_class:"uniE024",unicode:"e9cf"},{font_family:"sg-ele",my_class:"uniE025",unicode:"e9d0"},{font_family:"sg-ele",my_class:"uniE015",unicode:"e9c6"},{font_family:"sg-ele",my_class:"uniE0CB",unicode:"e92d"},{font_family:"sg-ele",my_class:"uniE0E2",unicode:"e946"},{font_family:"sg-ele",my_class:"uniE091",unicode:"ea12"},{font_family:"sg-ele",my_class:"uniE096",unicode:"ea17"}]},{name:"\u7535\u529B\u7CFB\u7EDF-4",show:!0,list:[{font_family:"sg-ele",my_class:"uniE0A2",unicode:"e903"},{font_family:"sg-ele",my_class:"uniE0A3",unicode:"e904"},{font_family:"sg-ele",my_class:"uniE0A6",unicode:"e907"},{font_family:"sg-ele",my_class:"uniE0A8",unicode:"e909"},{font_family:"sg-ele",my_class:"uniE0AE",unicode:"e90f"},{font_family:"sg-ele",my_class:"uniE0C7",unicode:"e929"},{font_family:"sg-ele",my_class:"uniE0C8",unicode:"e92a"},{font_family:"sg-ele",my_class:"uniE0EB",unicode:"e94f"},{font_family:"sg-ele",my_class:"uniE03E",unicode:"e978"},{font_family:"sg-ele",my_class:"uniE05F",unicode:"e987"},{font_family:"sg-ele",my_class:"uniE08A",unicode:"e997"},{font_family:"sg-ele",my_class:"uniE0BC",unicode:"e91e"},{font_family:"sg-ele",my_class:"uniE071",unicode:"e9fe"},{font_family:"sg-ele",my_class:"uniE111",unicode:"ea26"},{font_family:"sg-ele",my_class:"uniE112",unicode:"ea27"},{font_family:"sg-ele",my_class:"uniE100",unicode:"ea1b"},{font_family:"sg-ele",my_class:"uniE108",unicode:"ea23"},{font_family:"sg-ele",my_class:"uniE104",unicode:"ea1f"},{font_family:"sg-ele",my_class:"uniE105",unicode:"ea20"},{font_family:"sg-ele",my_class:"uniE079",unicode:"ea06"},{font_family:"sg-ele",my_class:"uniE072",unicode:"e9ff"},{font_family:"sg-ele",my_class:"uniE10D",unicode:"e9a8"},{font_family:"sg-ele",my_class:"uniE056",unicode:"e9ef"},{font_family:"sg-ele",my_class:"uniE047",unicode:"e9e6"},{font_family:"sg-ele",my_class:"uniE048",unicode:"e9e7"},{font_family:"sg-ele",my_class:"uniE049",unicode:"e9e8"},{font_family:"sg-ele",my_class:"uniE026",unicode:"e9d1"},{font_family:"sg-ele",my_class:"uniE028",unicode:"e9d3"},{font_family:"sg-ele",my_class:"uniE06F",unicode:"e98e"},{font_family:"sg-ele",my_class:"uniE11B",unicode:"e9ad"},{font_family:"sg-ele",my_class:"uniE04A",unicode:"e97b"},{font_family:"sg-ele",my_class:"uniE04B",unicode:"e97c"},{font_family:"sg-ele",my_class:"uniE04C",unicode:"e97d"},{font_family:"sg-ele",my_class:"uniE0EF",unicode:"e953"},{font_family:"sg-ele",my_class:"uniE0D8",unicode:"e93b"},{font_family:"sg-ele",my_class:"uniE0C9",unicode:"e92b"},{font_family:"sg-ele",my_class:"uniE0BE",unicode:"e920"}]},{name:"\u7535\u529B\u7CFB\u7EDF-5",show:!0,list:[{font_family:"sg-ele",my_class:"uniE140",unicode:"ea43"},{font_family:"sg-ele",my_class:"uniE0B5",unicode:"e917"},{font_family:"sg-ele",my_class:"uniE0E8",unicode:"e94c"},{font_family:"sg-ele",my_class:"uniE0B9",unicode:"e91b"},{font_family:"sg-ele",my_class:"uniE0AB",unicode:"e90c"},{font_family:"sg-ele",my_class:"uniE14F",unicode:"e9c5"},{font_family:"sg-ele",my_class:"uniE070",unicode:"e9fd"},{font_family:"sg-ele",my_class:"uniE0A7",unicode:"e908"},{font_family:"sg-ele",my_class:"uniE0A9",unicode:"e90a"},{font_family:"sg-ele",my_class:"uniE0AA",unicode:"e90b"},{font_family:"sg-ele",my_class:"uniE077",unicode:"ea04"},{font_family:"sg-ele",my_class:"uniE06E",unicode:"e98d"},{font_family:"sg-ele",my_class:"uniE10E",unicode:"e9a9"},{font_family:"sg-ele",my_class:"uniE10F",unicode:"e9aa"},{font_family:"sg-ele",my_class:"uniE0DC",unicode:"e93f"},{font_family:"sg-ele",my_class:"uniE0E7",unicode:"e94b"},{font_family:"sg-ele",my_class:"uniE113",unicode:"ea28"},{font_family:"sg-ele",my_class:"uniE127",unicode:"ea36"},{font_family:"sg-ele",my_class:"uniE097",unicode:"ea18"},{font_family:"sg-ele",my_class:"uniE136",unicode:"ea3f"},{font_family:"sg-ele",my_class:"uniE0A5",unicode:"e906"},{font_family:"sg-ele",my_class:"uniE0CE",unicode:"e930"},{font_family:"sg-ele",my_class:"uniE045",unicode:"e9e4"},{font_family:"sg-ele",my_class:"uniE046",unicode:"e9e5"},{font_family:"sg-ele",my_class:"uniE0E0",unicode:"e944"},{font_family:"sg-ele",my_class:"uniE063",unicode:"e9f6"},{font_family:"sg-ele",my_class:"uniE0F1",unicode:"e956"},{font_family:"sg-ele",my_class:"uniE07C",unicode:"e992"},{font_family:"sg-ele",my_class:"uniE07D",unicode:"e993"},{font_family:"sg-ele",my_class:"uniE08C",unicode:"e999"},{font_family:"sg-ele",my_class:"uniE0B3",unicode:"e915"},{font_family:"sg-ele",my_class:"uniE0AF",unicode:"e910"},{font_family:"sg-ele",my_class:"uniE0B2",unicode:"e914"},{font_family:"sg-ele",my_class:"uniE0B6",unicode:"e918"},{font_family:"sg-ele",my_class:"uniE0FB",unicode:"e960"},{font_family:"sg-ele",my_class:"uniE0B8",unicode:"e91a"},{font_family:"sg-ele",my_class:"uniE0CD",unicode:"e92f"},{font_family:"sg-ele",my_class:"uniE0D1",unicode:"e934"},{font_family:"sg-ele",my_class:"uniE0D3",unicode:"e936"},{font_family:"sg-ele",my_class:"uniE0D5",unicode:"e938"},{font_family:"sg-ele",my_class:"uniE087",unicode:"ea0e"},{font_family:"sg-ele",my_class:"uniE0D9",unicode:"e93c"},{font_family:"sg-ele",my_class:"uniE0DD",unicode:"e940"},{font_family:"sg-ele",my_class:"uniE0DE",unicode:"e941"},{font_family:"sg-ele",my_class:"uniE0DF",unicode:"e942"},{font_family:"sg-ele",my_class:"uniE0E3",unicode:"e947"},{font_family:"sg-ele",my_class:"uniE0E5",unicode:"e949"},{font_family:"sg-ele",my_class:"uniE0E6",unicode:"e94a"},{font_family:"sg-ele",my_class:"uniE0E9",unicode:"e94d"},{font_family:"sg-ele",my_class:"uniE0F2",unicode:"e957"},{font_family:"sg-ele",my_class:"uniE0FA",unicode:"e95f"},{font_family:"sg-ele",my_class:"uniE0FF",unicode:"e964"},{font_family:"sg-ele",my_class:"uniE001",unicode:"e965"},{font_family:"sg-ele",my_class:"uniE01A",unicode:"e966"},{font_family:"sg-ele",my_class:"uniE01E",unicode:"e96a"},{font_family:"sg-ele",my_class:"uniE003",unicode:"e973"},{font_family:"sg-ele",my_class:"uniE0E1",unicode:"e945"},{font_family:"sg-ele",my_class:"uniE035",unicode:"e9da"},{font_family:"sg-ele",my_class:"uniE0C0",unicode:"e923"},{font_family:"sg-ele",my_class:"uniE03F",unicode:"e979"},{font_family:"sg-ele",my_class:"uniE05E",unicode:"e986"},{font_family:"sg-ele",my_class:"uniE07F",unicode:"e995"},{font_family:"sg-ele",my_class:"uniE08B",unicode:"e998"},{font_family:"sg-ele",my_class:"uniE08D",unicode:"e99a"},{font_family:"sg-ele",my_class:"uniE09B",unicode:"e99f"},{font_family:"sg-ele",my_class:"uniE09C",unicode:"e9a0"},{font_family:"sg-ele",my_class:"uniE029",unicode:"e9d4"},{font_family:"sg-ele",my_class:"uniE036",unicode:"e9db"},{font_family:"sg-ele",my_class:"uniE037",unicode:"e9dc"},{font_family:"sg-ele",my_class:"uniE038",unicode:"e9dd"},{font_family:"sg-ele",my_class:"uniE053",unicode:"e9ec"},{font_family:"sg-ele",my_class:"uniE054",unicode:"e9ed"},{font_family:"sg-ele",my_class:"uniE076",unicode:"ea03"},{font_family:"sg-ele",my_class:"uniE081",unicode:"ea08"},{font_family:"sg-ele",my_class:"uniE085",unicode:"ea0c"},{font_family:"sg-ele",my_class:"uniE089",unicode:"ea10"},{font_family:"sg-ele",my_class:"uniE098",unicode:"ea19"},{font_family:"sg-ele",my_class:"uniE093",unicode:"ea14"}]},{name:"\u7535\u529B\u7CFB\u7EDF-6",show:!0,list:[{font_family:"sg-ele",my_class:"uniE147",unicode:"ea4a"},{font_family:"sg-ele",my_class:"uniE145",unicode:"ea48"},{font_family:"sg-ele",my_class:"uniE148",unicode:"ea4b"},{font_family:"sg-ele",my_class:"uniE139",unicode:"ea42"},{font_family:"sg-ele",my_class:"uniE133",unicode:"ea3c"},{font_family:"sg-ele",my_class:"uniE135",unicode:"ea3e"},{font_family:"sg-ele",my_class:"uniE064",unicode:"e9f7"},{font_family:"sg-ele",my_class:"uniE065",unicode:"e9f8"},{font_family:"sg-ele",my_class:"uniE066",unicode:"e9f9"},{font_family:"sg-ele",my_class:"uniE067",unicode:"e9fa"},{font_family:"sg-ele",my_class:"uniE068",unicode:"e9fb"},{font_family:"sg-ele",my_class:"uniE14B",unicode:"e9c1"},{font_family:"sg-ele",my_class:"uniE14D",unicode:"e9c3"},{font_family:"sg-ele",my_class:"uniE13A",unicode:"e9b9"},{font_family:"sg-ele",my_class:"uniE13B",unicode:"e9ba"},{font_family:"sg-ele",my_class:"uniE12C",unicode:"e9b4"},{font_family:"sg-ele",my_class:"uniE06D",unicode:"e98c"},{font_family:"sg-ele",my_class:"uniE05C",unicode:"e984"},{font_family:"sg-ele",my_class:"uniE03A",unicode:"e974"},{font_family:"sg-ele",my_class:"uniE03B",unicode:"e975"},{font_family:"sg-ele",my_class:"uniE03C",unicode:"e976"},{font_family:"sg-ele",my_class:"uniE004",unicode:"e97a"},{font_family:"sg-ele",my_class:"uniE134",unicode:"ea3d"},{font_family:"sg-ele",my_class:"uniE128",unicode:"ea37"},{font_family:"sg-ele",my_class:"uniE122",unicode:"ea31"},{font_family:"sg-ele",my_class:"uniE123",unicode:"ea32"},{font_family:"sg-ele",my_class:"uniE120",unicode:"ea2f"},{font_family:"sg-ele",my_class:"uniE039",unicode:"e9de"},{font_family:"sg-ele",my_class:"uniE03D",unicode:"e977"},{font_family:"sg-ele",my_class:"uniE05D",unicode:"e985"},{font_family:"sg-ele",my_class:"uniE0EA",unicode:"e94e"},{font_family:"sg-ele",my_class:"uniE08E",unicode:"e99b"},{font_family:"sg-ele",my_class:"uniE07A",unicode:"e990"},{font_family:"sg-ele",my_class:"uniE07B",unicode:"e991"},{font_family:"sg-ele",my_class:"uniE074",unicode:"ea01"},{font_family:"sg-ele",my_class:"uniE078",unicode:"ea05"}]},{name:"\u7535\u529B\u7CFB\u7EDF-7",show:!0,list:[{font_family:"sg-ele",my_class:"uniE02A",unicode:"e96d"},{font_family:"sg-ele",my_class:"uniE02E",unicode:"e971"},{font_family:"sg-ele",my_class:"uniE02F",unicode:"e972"},{font_family:"sg-ele",my_class:"uniE131",unicode:"ea3a"},{font_family:"sg-ele",my_class:"uniE132",unicode:"ea3b"},{font_family:"sg-ele",my_class:"uniE143",unicode:"ea46"},{font_family:"sg-ele",my_class:"uniE0A4",unicode:"e905"},{font_family:"sg-ele",my_class:"uniE144",unicode:"ea47"},{font_family:"sg-ele",my_class:"uniE146",unicode:"ea49"},{font_family:"sg-ele",my_class:"uniE149",unicode:"ea4c"},{font_family:"sg-ele",my_class:"uniE150",unicode:"ea4d"},{font_family:"sg-ele",my_class:"uniE154",unicode:"ea50"},{font_family:"sg-ele",my_class:"uniE151",unicode:"ea4e"},{font_family:"sg-ele",my_class:"uniE138",unicode:"ea41"},{font_family:"sg-ele",my_class:"uniE0C2",unicode:"e925"},{font_family:"sg-ele",my_class:"uniE027",unicode:"e9d2"},{font_family:"sg-ele",my_class:"uniE141",unicode:"ea44"},{font_family:"sg-ele",my_class:"uniE126",unicode:"ea35"},{font_family:"sg-ele",my_class:"uniE129",unicode:"ea38"},{font_family:"sg-ele",my_class:"uniE130",unicode:"ea39"},{font_family:"sg-ele",my_class:"uniE069",unicode:"e9fc"},{font_family:"sg-ele",my_class:"uniE057",unicode:"e9f0"},{font_family:"sg-ele",my_class:"uniE058",unicode:"e9f1"},{font_family:"sg-ele",my_class:"uniE030",unicode:"e9d5"},{font_family:"sg-ele",my_class:"uniE031",unicode:"e9d6"},{font_family:"sg-ele",my_class:"uniE032",unicode:"e9d7"},{font_family:"sg-ele",my_class:"uniE033",unicode:"e9d8"},{font_family:"sg-ele",my_class:"uniE034",unicode:"e9d9"},{font_family:"sg-ele",my_class:"uniE12B",unicode:"e9b3"},{font_family:"sg-ele",my_class:"uniE12D",unicode:"e9b5"},{font_family:"sg-ele",my_class:"uniE12E",unicode:"e9b6"},{font_family:"sg-ele",my_class:"uniE12F",unicode:"e9b7"},{font_family:"sg-ele",my_class:"uniE14A",unicode:"e9c0"},{font_family:"sg-ele",my_class:"uniE14C",unicode:"e9c2"},{font_family:"sg-ele",my_class:"uniE14E",unicode:"e9c4"},{font_family:"sg-ele",my_class:"uniE06A",unicode:"e989"},{font_family:"sg-ele",my_class:"uniE011",unicode:"e9ab"},{font_family:"sg-ele",my_class:"uniE075",unicode:"ea02"},{font_family:"sg-ele",my_class:"uniE083",unicode:"ea0a"},{font_family:"sg-ele",my_class:"uniE0C4",unicode:"e927"},{font_family:"sg-ele",my_class:"uniE0B1",unicode:"e913"},{font_family:"sg-ele",my_class:"uniE0FE",unicode:"e963"}]},{name:"\u7535\u529B\u7CFB\u7EDF-8",show:!0,list:[{font_family:"sg-ele",my_class:"uniE114",unicode:"ea29"},{font_family:"sg-ele",my_class:"uniE115",unicode:"ea2a"},{font_family:"sg-ele",my_class:"uniE116",unicode:"ea2b"},{font_family:"sg-ele",my_class:"uniE117",unicode:"ea2c"},{font_family:"sg-ele",my_class:"uniE118",unicode:"ea2d"},{font_family:"sg-ele",my_class:"uniE119",unicode:"ea2e"},{font_family:"sg-ele",my_class:"uniE121",unicode:"ea30"},{font_family:"sg-ele",my_class:"uniE124",unicode:"ea33"},{font_family:"sg-ele",my_class:"uniE0B0",unicode:"e912"},{font_family:"sg-ele",my_class:"uniE0B7",unicode:"e919"},{font_family:"sg-ele",my_class:"uniE0BA",unicode:"e91c"},{font_family:"sg-ele",my_class:"uniE0BB",unicode:"e91d"},{font_family:"sg-ele",my_class:"uniE0BD",unicode:"e91f"},{font_family:"sg-ele",my_class:"uniE0C1",unicode:"e924"},{font_family:"sg-ele",my_class:"uniE0CC",unicode:"e92e"},{font_family:"sg-ele",my_class:"uniE0DA",unicode:"e93d"},{font_family:"sg-ele",my_class:"uniE0F3",unicode:"e958"},{font_family:"sg-ele",my_class:"uniE0F4",unicode:"e959"},{font_family:"sg-ele",my_class:"uniE0F6",unicode:"e95b"},{font_family:"sg-ele",my_class:"uniE0F7",unicode:"e95c"},{font_family:"sg-ele",my_class:"uniE0F8",unicode:"e95d"},{font_family:"sg-ele",my_class:"uniE0F9",unicode:"e95e"},{font_family:"sg-ele",my_class:"uniE0FD",unicode:"e962"},{font_family:"sg-ele",my_class:"uniE04F",unicode:"e980"},{font_family:"sg-ele",my_class:"uniE05B",unicode:"e983"},{font_family:"sg-ele",my_class:"uniE11A",unicode:"e9ac"},{font_family:"sg-ele",my_class:"uniE11C",unicode:"e9ae"},{font_family:"sg-ele",my_class:"uniE11D",unicode:"e9af"},{font_family:"sg-ele",my_class:"uniE11E",unicode:"e9b0"},{font_family:"sg-ele",my_class:"uniE13C",unicode:"e9bb"},{font_family:"sg-ele",my_class:"uniE13D",unicode:"e9bc"},{font_family:"sg-ele",my_class:"uniE13E",unicode:"e9bd"},{font_family:"sg-ele",my_class:"uniE052",unicode:"e9eb"},{font_family:"sg-ele",my_class:"uniE055",unicode:"e9ee"},{font_family:"sg-ele",my_class:"uniE060",unicode:"e9f3"},{font_family:"sg-ele",my_class:"uniE0B4",unicode:"e916"},{font_family:"sg-ele",my_class:"uniE0BF",unicode:"e921"},{font_family:"sg-ele",my_class:"uniE0CA",unicode:"e92c"},{font_family:"sg-ele",my_class:"uniE0D7",unicode:"e93a"},{font_family:"sg-ele",my_class:"uniE06B",unicode:"e98a"},{font_family:"sg-ele",my_class:"uniE10A",unicode:"e9a5"},{font_family:"sg-ele",my_class:"uniE017",unicode:"e9c8"},{font_family:"sg-ele",my_class:"uniE050",unicode:"e9e9"},{font_family:"sg-ele",my_class:"uniE086",unicode:"ea0d"},{font_family:"sg-ele",my_class:"uniE099",unicode:"ea1a"},{font_family:"sg-ele",my_class:"uniE101",unicode:"ea1c"}]},{name:"\u7535\u529B\u7CFB\u7EDF-9",show:!0,list:[{font_family:"sg-ele",my_class:"uniE106",unicode:"ea21"},{font_family:"sg-ele",my_class:"uniE109",unicode:"ea24"},{font_family:"sg-ele",my_class:"uniE061",unicode:"e9f4"},{font_family:"sg-ele",my_class:"uniE092",unicode:"ea13"},{font_family:"sg-ele",my_class:"uniE01B",unicode:"e967"},{font_family:"sg-ele",my_class:"uniE01C",unicode:"e968"},{font_family:"sg-ele",my_class:"uniE09D",unicode:"e9a1"},{font_family:"sg-ele",my_class:"uniE09F",unicode:"e9a3"},{font_family:"sg-ele",my_class:"uniE11F",unicode:"e9b1"},{font_family:"sg-ele",my_class:"uniE13F",unicode:"e9be"},{font_family:"sg-ele",my_class:"uniE016",unicode:"e9c7"},{font_family:"sg-ele",my_class:"uniE125",unicode:"ea34"},{font_family:"sg-ele",my_class:"uniE137",unicode:"ea40"},{font_family:"sg-ele",my_class:"uniE142",unicode:"ea45"},{font_family:"sg-ele",my_class:"uniE0C3",unicode:"e926"},{font_family:"sg-ele",my_class:"uniE0CF",unicode:"e931"},{font_family:"sg-ele",my_class:"uniE0D0",unicode:"e933"},{font_family:"sg-ele",my_class:"uniE0D2",unicode:"e935"},{font_family:"sg-ele",my_class:"uniE0D4",unicode:"e937"},{font_family:"sg-ele",my_class:"uniE0D6",unicode:"e939"},{font_family:"sg-ele",my_class:"uniE051",unicode:"e9ea"}]},{name:"\u8111\u56FE",show:!1,list:[{name:"mindNode",icon:"t-icon t-zhuti",data:{text:"\u4E3B\u9898",width:200,height:50,name:"mindNode",borderRadius:.5}},{name:"mindLine",icon:"t-icon t-zizhuti",data:{text:"\u5B50\u4E3B\u9898",width:160,height:40,name:"mindLine"}}]},{name:"\u6D41\u7A0B\u56FE",show:!1,list:[{name:"\u5F00\u59CB/\u7ED3\u675F",icon:"t-icon t-flow-start",id:21,data:{text:"\u5F00\u59CB/\u7ED3\u675F",width:120,height:40,borderRadius:.5,name:"rectangle"}},{name:"\u6D41\u7A0B",icon:"t-icon t-rectangle",id:22,data:{text:"\u6D41\u7A0B",width:120,height:40,name:"rectangle"}},{name:"\u5224\u5B9A",icon:"t-icon t-diamond",id:23,data:{text:"\u5224\u5B9A",width:120,height:60,name:"diamond"}},{name:"\u6570\u636E",icon:"t-icon t-flow-data",id:24,data:{text:"\u6570\u636E",width:120,height:50,name:"flowData"}},{name:"\u51C6\u5907",icon:"t-icon t-flow-ready",id:25,data:{text:"\u51C6\u5907",width:120,height:50,name:"hexagon"}},{name:"\u5B50\u6D41\u7A0B",icon:"t-icon t-flow-subprocess",id:26,data:{text:"\u5B50\u6D41\u7A0B",width:120,height:50,name:"flowSubprocess"}},{name:"\u6570\u636E\u5E93",icon:"t-icon t-db",id:27,data:{text:"\u6570\u636E\u5E93",width:80,height:120,name:"flowDb"}},{name:"\u6587\u6863",icon:"t-icon t-flow-document",id:28,data:{text:"\u6587\u6863",width:120,height:100,name:"flowDocument"}},{name:"\u5185\u90E8\u5B58\u50A8",icon:"t-icon t-internal-storage",id:29,data:{text:"\u5185\u90E8\u5B58\u50A8",width:120,height:80,name:"flowInternalStorage"}},{name:"\u5916\u90E8\u5B58\u50A8",icon:"t-icon t-extern-storage",id:30,data:{text:"\u5916\u90E8\u5B58\u50A8",width:120,height:80,name:"flowExternStorage"}},{name:"\u961F\u5217",icon:"t-icon t-flow-queue",id:31,data:{text:"\u961F\u5217",width:100,height:100,name:"flowQueue"}},{name:"\u624B\u52A8\u8F93\u5165",icon:"t-icon t-flow-manually",id:32,data:{text:"\u624B\u52A8\u8F93\u5165",width:120,height:80,name:"flowManually"}},{name:"\u5C55\u793A",icon:"t-icon t-flow-display",id:33,data:{text:"\u5C55\u793A",width:120,height:80,name:"flowDisplay"}},{name:"\u5E76\u884C\u6A21\u5F0F",icon:"t-icon t-flow-parallel",id:34,data:{text:"\u5E76\u884C\u6A21\u5F0F",width:120,height:50,name:"flowParallel"}},{name:"\u6CE8\u91CA",icon:"t-icon t-flow-comment",id:35,data:{text:"\u6CE8\u91CA",width:100,height:100,name:"flowComment"}}]},{name:"\u6D3B\u52A8\u56FE",show:!1,list:[{name:"\u5F00\u59CB",icon:"t-icon t-inital",id:36,data:{text:"",width:30,height:30,name:"circle",background:"#555",color:"transparent"}},{name:"\u7ED3\u675F",icon:"t-icon t-final",id:37,data:{width:30,height:30,name:"activityFinal"}},{name:"\u6D3B\u52A8",icon:"t-icon t-action",id:38,data:{text:"\u6D3B\u52A8",width:120,height:50,borderRadius:.25,name:"rectangle"}},{name:"\u51B3\u7B56/\u5408\u5E76",icon:"t-icon t-diamond",id:39,data:{text:"\u51B3\u7B56/\u5408\u5E76",width:120,height:50,name:"diamond"}},{name:"\u5782\u76F4\u6CF3\u9053",icon:"t-icon t-swimlane-v",id:40,data:{text:"\u5782\u76F4\u6CF3\u9053",width:200,height:500,name:"swimlaneV",textHeight:.1}},{name:"\u6C34\u5E73\u6CF3\u9053",icon:"t-icon t-swimlane-h",id:41,data:{text:"\u6C34\u5E73\u6CF3\u9053",width:500,height:200,name:"swimlaneH",textWidth:.01,textLeft:.04,textAlign:"start"}},{name:"\u5782\u76F4\u5206\u5C94/\u6C47\u5408",icon:"t-icon t-fork-v",id:42,data:{text:"\u5782\u76F4\u5206\u5C94/\u6C47\u5408",width:10,height:150,name:"forkV",fillStyle:"#555",strokeStyle:"transparent"}},{name:"\u6C34\u5E73\u5206\u5C94/\u6C47\u5408",icon:"t-icon t-fork",id:43,data:{text:"\u6C34\u5E73\u5206\u5C94/\u6C47\u5408",width:150,height:10,name:"forkH",fillStyle:"#555",strokeStyle:"transparent"}}]},{name:"\u65F6\u5E8F\u56FE\u548C\u7C7B\u56FE",show:!1,list:[{name:"\u751F\u547D\u7EBF",icon:"t-icon t-lifeline",id:44,data:{text:"\u751F\u547D\u7EBF",width:150,height:400,textHeight:50,name:"lifeline"}},{name:"\u6FC0\u6D3B",icon:"t-icon t-focus",id:45,data:{text:"\u6FC0\u6D3B",width:12,height:200,name:"sequenceFocus"}},{name:"\u7B80\u5355\u7C7B",icon:"t-icon t-simple-class",id:46,data:{text:"Topolgoy",width:270,height:200,textHeight:.2,name:"simpleClass",textAlign:"center",textBaseline:"top",textTop:10,list:[{text:`- name: string + setName(name: string): void`}]}},{name:"\u7C7B",icon:"t-icon t-class",id:47,data:{text:"Topolgoy",width:270,height:200,textHeight:.2,name:"interfaceClass",textAlign:"center",textBaseline:"top",textTop:10,list:[{text:"- name: string"},{text:"+ setName(name: string): void"}]}}]}];var Qi={};(function(e){var t=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function i(n,r){return Object.prototype.hasOwnProperty.call(n,r)}e.assign=function(n){for(var r=Array.prototype.slice.call(arguments,1);r.length;){var l=r.shift();if(!!l){if(typeof l!="object")throw new TypeError(l+"must be non-object");for(var o in l)i(l,o)&&(n[o]=l[o])}}return n},e.shrinkBuf=function(n,r){return n.length===r?n:n.subarray?n.subarray(0,r):(n.length=r,n)};var a={arraySet:function(n,r,l,o,u){if(r.subarray&&n.subarray){n.set(r.subarray(l,l+o),u);return}for(var c=0;c=0;)e[t]=0}var kk=0,Ng=1,Ck=2,Fk=3,Rk=258,Fc=29,kn=256,yn=kn+1+Fc,ks=30,Rc=19,zg=2*yn+1,La=15,Ml=16,Tk=7,Tc=256,Hg=16,Wg=17,Ug=18,rc=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Lr=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Pk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Vg=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Sk=512,ji=new Array((yn+2)*2);Is(ji);var cn=new Array(ks*2);Is(cn);var pn=new Array(Sk);Is(pn);var wn=new Array(Rk-Fk+1);Is(wn);var Pc=new Array(Fc);Is(Pc);var Zr=new Array(ks);Is(Zr);function Ol(e,t,i,a,s){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=a,this.max_length=s,this.has_stree=e&&e.length}var $g,jg,qg;function Nl(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Yg(e){return e<256?pn[e]:pn[256+(e>>>7)]}function bn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function $e(e,t,i){e.bi_valid>Ml-i?(e.bi_buf|=t<>Ml-e.bi_valid,e.bi_valid+=i-Ml):(e.bi_buf|=t<>>=1,i<<=1;while(--t>0);return i>>>1}function Ik(e){e.bi_valid===16?(bn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function Bk(e,t){var i=t.dyn_tree,a=t.max_code,s=t.stat_desc.static_tree,n=t.stat_desc.has_stree,r=t.stat_desc.extra_bits,l=t.stat_desc.extra_base,o=t.stat_desc.max_length,u,c,f,g,v,m,w=0;for(g=0;g<=La;g++)e.bl_count[g]=0;for(i[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;uo&&(g=o,w++),i[c*2+1]=g,!(c>a)&&(e.bl_count[g]++,v=0,c>=l&&(v=r[c-l]),m=i[c*2],e.opt_len+=m*(g+v),n&&(e.static_len+=m*(s[c*2+1]+v)));if(w!==0){do{for(g=o-1;e.bl_count[g]===0;)g--;e.bl_count[g]--,e.bl_count[g+1]+=2,e.bl_count[o]--,w-=2}while(w>0);for(g=o;g!==0;g--)for(c=e.bl_count[g];c!==0;)f=e.heap[--u],!(f>a)&&(i[f*2+1]!==g&&(e.opt_len+=(g-i[f*2+1])*i[f*2],i[f*2+1]=g),c--)}}function Xg(e,t,i){var a=new Array(La+1),s=0,n,r;for(n=1;n<=La;n++)a[n]=s=s+i[n-1]<<1;for(r=0;r<=t;r++){var l=e[r*2+1];l!==0&&(e[r*2]=Kg(a[l]++,l))}}function Dk(){var e,t,i,a,s,n=new Array(La+1);for(i=0,a=0;a>=7;a8?bn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Lk(e,t,i,a){Zg(e),a&&(bn(e,i),bn(e,~i)),_k.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function Gf(e,t,i,a){var s=t*2,n=i*2;return e[s]>1;r>=1;r--)zl(e,i,r);u=n;do r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],zl(e,i,1),l=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=l,i[u*2]=i[r*2]+i[l*2],e.depth[u]=(e.depth[r]>=e.depth[l]?e.depth[r]:e.depth[l])+1,i[r*2+1]=i[l*2+1]=u,e.heap[1]=u++,zl(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Bk(e,t),Xg(i,o,e.bl_count)}function Jf(e,t,i){var a,s=-1,n,r=t[0*2+1],l=0,o=7,u=4;for(r===0&&(o=138,u=3),t[(i+1)*2+1]=65535,a=0;a<=i;a++)n=r,r=t[(a+1)*2+1],!(++l=3&&e.bl_tree[Vg[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Ok(e,t,i,a){var s;for($e(e,t-257,5),$e(e,i-1,5),$e(e,a-4,4),s=0;s>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return Kf;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Xf;for(i=32;i0?(e.strm.data_type===Ak&&(e.strm.data_type=Nk(e)),oc(e,e.l_desc),oc(e,e.d_desc),r=Mk(e),s=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=s&&(s=n)):s=n=i+5,i+4<=s&&t!==-1?Jg(e,t,i,a):e.strategy===Ek||n===s?($e(e,(Ng<<1)+(a?1:0),3),Zf(e,ji,cn)):($e(e,(Ck<<1)+(a?1:0),3),Ok(e,e.l_desc.max_code+1,e.d_desc.max_code+1,r+1),Zf(e,e.dyn_ltree,e.dyn_dtree)),Gg(e),a&&Zg(e)}function Uk(e,t,i){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=i&255,e.last_lit++,t===0?e.dyn_ltree[i*2]++:(e.matches++,t--,e.dyn_ltree[(wn[i]+kn+1)*2]++,e.dyn_dtree[Yg(t)*2]++),e.last_lit===e.lit_bufsize-1}Ss._tr_init=zk;Ss._tr_stored_block=Jg;Ss._tr_flush_block=Wk;Ss._tr_tally=Uk;Ss._tr_align=Hk;function Vk(e,t,i,a){for(var s=e&65535|0,n=e>>>16&65535|0,r=0;i!==0;){r=i>2e3?2e3:i,i-=r;do s=s+t[a++]|0,n=n+s|0;while(--r);s%=65521,n%=65521}return s|n<<16|0}var Qg=Vk;function $k(){for(var e,t=[],i=0;i<256;i++){e=i;for(var a=0;a<8;a++)e=e&1?3988292384^e>>>1:e>>>1;t[i]=e}return t}var jk=$k();function qk(e,t,i,a){var s=jk,n=a+i;e^=-1;for(var r=a;r>>8^s[(e^t[r])&255];return e^-1}var tv=qk,Sc={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},De=Qi,fi=Ss,ev=Qg,da=tv,Yk=Sc,Ka=0,Kk=1,Xk=3,ba=4,ed=5,Ti=0,id=1,di=-2,Gk=-3,Hl=-5,Zk=-1,Jk=1,Cr=2,Qk=3,tC=4,eC=0,iC=2,eo=8,aC=9,sC=15,nC=8,rC=29,oC=256,lc=oC+1+rC,lC=30,cC=19,hC=2*lc+1,uC=15,Wt=3,pa=258,wi=pa+Wt+1,fC=32,io=42,cc=69,Mr=73,Or=91,Nr=103,Ma=113,sn=666,ye=1,Cn=2,Ua=3,Bs=4,dC=3;function wa(e,t){return e.msg=Yk[t],t}function ad(e){return(e<<1)-(e>4?9:0)}function ma(e){for(var t=e.length;--t>=0;)e[t]=0}function ga(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(De.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,t.pending===0&&(t.pending_out=0))}function Ce(e,t){fi._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ga(e.strm)}function Ut(e,t){e.pending_buf[e.pending++]=t}function Js(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function gC(e,t,i,a){var s=e.avail_in;return s>a&&(s=a),s===0?0:(e.avail_in-=s,De.arraySet(t,e.input,e.next_in,s,i),e.state.wrap===1?e.adler=ev(e.adler,t,s,i):e.state.wrap===2&&(e.adler=da(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)}function iv(e,t){var i=e.max_chain_length,a=e.strstart,s,n,r=e.prev_length,l=e.nice_match,o=e.strstart>e.w_size-wi?e.strstart-(e.w_size-wi):0,u=e.window,c=e.w_mask,f=e.prev,g=e.strstart+pa,v=u[a+r-1],m=u[a+r];e.prev_length>=e.good_match&&(i>>=2),l>e.lookahead&&(l=e.lookahead);do if(s=t,!(u[s+r]!==m||u[s+r-1]!==v||u[s]!==u[a]||u[++s]!==u[a+1])){a+=2,s++;do;while(u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&u[++a]===u[++s]&&ar){if(e.match_start=t,r=n,n>=l)break;v=u[a+r-1],m=u[a+r]}}while((t=f[t&c])>o&&--i!==0);return r<=e.lookahead?r:e.lookahead}function Va(e){var t=e.w_size,i,a,s,n,r;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-wi)){De.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,a=e.hash_size,i=a;do s=e.head[--i],e.head[i]=s>=t?s-t:0;while(--a);a=t,i=a;do s=e.prev[--i],e.prev[i]=s>=t?s-t:0;while(--a);n+=t}if(e.strm.avail_in===0)break;if(a=gC(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=Wt)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Va(e),e.lookahead===0&&t===Ka)return ye;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var a=e.block_start+i;if((e.strstart===0||e.strstart>=a)&&(e.lookahead=e.strstart-a,e.strstart=a,Ce(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-wi&&(Ce(e,!1),e.strm.avail_out===0))return ye}return e.insert=0,t===ba?(Ce(e,!0),e.strm.avail_out===0?Ua:Bs):(e.strstart>e.block_start&&(Ce(e,!1),e.strm.avail_out===0),ye)}function Wl(e,t){for(var i,a;;){if(e.lookahead=Wt&&(e.ins_h=(e.ins_h<=Wt)if(a=fi._tr_tally(e,e.strstart-e.match_start,e.match_length-Wt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Wt){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=Wt&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=Wt-1)),e.prev_length>=Wt&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-Wt,a=fi._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-Wt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<=Wt&&e.strstart>0&&(s=e.strstart-1,a=r[s],a===r[++s]&&a===r[++s]&&a===r[++s])){n=e.strstart+pa;do;while(a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&a===r[++s]&&se.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Wt?(i=fi._tr_tally(e,1,e.match_length-Wt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=fi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Ce(e,!1),e.strm.avail_out===0))return ye}return e.insert=0,t===ba?(Ce(e,!0),e.strm.avail_out===0?Ua:Bs):e.last_lit&&(Ce(e,!1),e.strm.avail_out===0)?ye:Cn}function yC(e,t){for(var i;;){if(e.lookahead===0&&(Va(e),e.lookahead===0)){if(t===Ka)return ye;break}if(e.match_length=0,i=fi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Ce(e,!1),e.strm.avail_out===0))return ye}return e.insert=0,t===ba?(Ce(e,!0),e.strm.avail_out===0?Ua:Bs):e.last_lit&&(Ce(e,!1),e.strm.avail_out===0)?ye:Cn}function ki(e,t,i,a,s){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=a,this.func=s}var _s;_s=[new ki(0,0,0,0,vC),new ki(4,4,8,4,Wl),new ki(4,5,16,8,Wl),new ki(4,6,32,32,Wl),new ki(4,4,16,16,gs),new ki(8,16,32,32,gs),new ki(8,16,128,128,gs),new ki(8,32,128,256,gs),new ki(32,128,258,1024,gs),new ki(32,258,258,4096,gs)];function pC(e){e.window_size=2*e.w_size,ma(e.head),e.max_lazy_match=_s[e.level].max_lazy,e.good_match=_s[e.level].good_length,e.nice_match=_s[e.level].nice_length,e.max_chain_length=_s[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Wt-1,e.match_available=0,e.ins_h=0}function wC(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=eo,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new De.Buf16(hC*2),this.dyn_dtree=new De.Buf16((2*lC+1)*2),this.bl_tree=new De.Buf16((2*cC+1)*2),ma(this.dyn_ltree),ma(this.dyn_dtree),ma(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new De.Buf16(uC+1),this.heap=new De.Buf16(2*lc+1),ma(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new De.Buf16(2*lc+1),ma(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function av(e){var t;return!e||!e.state?wa(e,di):(e.total_in=e.total_out=0,e.data_type=iC,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?io:Ma,e.adler=t.wrap===2?0:1,t.last_flush=Ka,fi._tr_init(t),Ti)}function sv(e){var t=av(e);return t===Ti&&pC(e.state),t}function bC(e,t){return!e||!e.state||e.state.wrap!==2?di:(e.state.gzhead=t,Ti)}function nv(e,t,i,a,s,n){if(!e)return di;var r=1;if(t===Zk&&(t=6),a<0?(r=0,a=-a):a>15&&(r=2,a-=16),s<1||s>aC||i!==eo||a<8||a>15||t<0||t>9||n<0||n>tC)return wa(e,di);a===8&&(a=9);var l=new wC;return e.state=l,l.strm=e,l.wrap=r,l.gzhead=null,l.w_bits=a,l.w_size=1<ed||t<0)return e?wa(e,di):di;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===sn&&t!==ba)return wa(e,e.avail_out===0?Hl:di);if(a.strm=e,i=a.last_flush,a.last_flush=t,a.status===io)if(a.wrap===2)e.adler=0,Ut(a,31),Ut(a,139),Ut(a,8),a.gzhead?(Ut(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),Ut(a,a.gzhead.time&255),Ut(a,a.gzhead.time>>8&255),Ut(a,a.gzhead.time>>16&255),Ut(a,a.gzhead.time>>24&255),Ut(a,a.level===9?2:a.strategy>=Cr||a.level<2?4:0),Ut(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&(Ut(a,a.gzhead.extra.length&255),Ut(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=da(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=cc):(Ut(a,0),Ut(a,0),Ut(a,0),Ut(a,0),Ut(a,0),Ut(a,a.level===9?2:a.strategy>=Cr||a.level<2?4:0),Ut(a,dC),a.status=Ma);else{var r=eo+(a.w_bits-8<<4)<<8,l=-1;a.strategy>=Cr||a.level<2?l=0:a.level<6?l=1:a.level===6?l=2:l=3,r|=l<<6,a.strstart!==0&&(r|=fC),r+=31-r%31,a.status=Ma,Js(a,r),a.strstart!==0&&(Js(a,e.adler>>>16),Js(a,e.adler&65535)),e.adler=1}if(a.status===cc)if(a.gzhead.extra){for(s=a.pending;a.gzindex<(a.gzhead.extra.length&65535)&&!(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),ga(e),s=a.pending,a.pending===a.pending_buf_size));)Ut(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=Mr)}else a.status=Mr;if(a.status===Mr)if(a.gzhead.name){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),ga(e),s=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindexs&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),n===0&&(a.gzindex=0,a.status=Or)}else a.status=Or;if(a.status===Or)if(a.gzhead.comment){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),ga(e),s=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindexs&&(e.adler=da(e.adler,a.pending_buf,a.pending-s,s)),n===0&&(a.status=Nr)}else a.status=Nr;if(a.status===Nr&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&ga(e),a.pending+2<=a.pending_buf_size&&(Ut(a,e.adler&255),Ut(a,e.adler>>8&255),e.adler=0,a.status=Ma)):a.status=Ma),a.pending!==0){if(ga(e),e.avail_out===0)return a.last_flush=-1,Ti}else if(e.avail_in===0&&ad(t)<=ad(i)&&t!==ba)return wa(e,Hl);if(a.status===sn&&e.avail_in!==0)return wa(e,Hl);if(e.avail_in!==0||a.lookahead!==0||t!==Ka&&a.status!==sn){var o=a.strategy===Cr?yC(a,t):a.strategy===Qk?mC(a,t):_s[a.level].func(a,t);if((o===Ua||o===Bs)&&(a.status=sn),o===ye||o===Ua)return e.avail_out===0&&(a.last_flush=-1),Ti;if(o===Cn&&(t===Kk?fi._tr_align(a):t!==ed&&(fi._tr_stored_block(a,0,0,!1),t===Xk&&(ma(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),ga(e),e.avail_out===0))return a.last_flush=-1,Ti}return t!==ba?Ti:a.wrap<=0?id:(a.wrap===2?(Ut(a,e.adler&255),Ut(a,e.adler>>8&255),Ut(a,e.adler>>16&255),Ut(a,e.adler>>24&255),Ut(a,e.total_in&255),Ut(a,e.total_in>>8&255),Ut(a,e.total_in>>16&255),Ut(a,e.total_in>>24&255)):(Js(a,e.adler>>>16),Js(a,e.adler&65535)),ga(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending!==0?Ti:id)}function EC(e){var t;return!e||!e.state?di:(t=e.state.status,t!==io&&t!==cc&&t!==Mr&&t!==Or&&t!==Nr&&t!==Ma&&t!==sn?wa(e,di):(e.state=null,t===Ma?wa(e,Gk):Ti))}function AC(e,t){var i=t.length,a,s,n,r,l,o,u,c;if(!e||!e.state||(a=e.state,r=a.wrap,r===2||r===1&&a.status!==io||a.lookahead))return di;for(r===1&&(e.adler=ev(e.adler,t,i,0)),a.wrap=0,i>=a.w_size&&(r===0&&(ma(a.head),a.strstart=0,a.block_start=0,a.insert=0),c=new De.Buf8(a.w_size),De.arraySet(c,t,i-a.w_size,a.w_size,0),t=c,i=a.w_size),l=e.avail_in,o=e.next_in,u=e.input,e.avail_in=i,e.next_in=0,e.input=t,Va(a);a.lookahead>=Wt;){s=a.strstart,n=a.lookahead-(Wt-1);do a.ins_h=(a.ins_h<=252?6:ha>=248?5:ha>=240?4:ha>=224?3:ha>=192?2:1;xn[254]=xn[254]=1;Xa.string2buf=function(e){var t,i,a,s,n,r=e.length,l=0;for(s=0;s>>6,t[n++]=128|i&63):i<65536?(t[n++]=224|i>>>12,t[n++]=128|i>>>6&63,t[n++]=128|i&63):(t[n++]=240|i>>>18,t[n++]=128|i>>>12&63,t[n++]=128|i>>>6&63,t[n++]=128|i&63);return t};function lv(e,t){if(t<65534&&(e.subarray&&ov||!e.subarray&&rv))return String.fromCharCode.apply(null,ao.shrinkBuf(e,t));for(var i="",a=0;a4){l[a++]=65533,i+=n-1;continue}for(s&=n===2?31:n===3?15:7;n>1&&i1){l[a++]=65533;continue}s<65536?l[a++]=s:(s-=65536,l[a++]=55296|s>>10&1023,l[a++]=56320|s&1023)}return lv(l,a)};Xa.utf8border=function(e,t){var i;for(t=t||e.length,t>e.length&&(t=e.length),i=t-1;i>=0&&(e[i]&192)===128;)i--;return i<0||i===0?t:i+xn[e[i]]>t?i:t};function kC(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var cv=kC,hn=Si,un=Qi,hc=Xa,uc=Sc,CC=cv,hv=Object.prototype.toString,FC=0,Ul=4,Cs=0,sd=1,nd=2,RC=-1,TC=0,PC=8;function $a(e){if(!(this instanceof $a))return new $a(e);this.options=un.assign({level:RC,method:PC,chunkSize:16384,windowBits:15,memLevel:8,strategy:TC,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new CC,this.strm.avail_out=0;var i=hn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Cs)throw new Error(uc[i]);if(t.header&&hn.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(typeof t.dictionary=="string"?a=hc.string2buf(t.dictionary):hv.call(t.dictionary)==="[object ArrayBuffer]"?a=new Uint8Array(t.dictionary):a=t.dictionary,i=hn.deflateSetDictionary(this.strm,a),i!==Cs)throw new Error(uc[i]);this._dict_set=!0}}$a.prototype.push=function(e,t){var i=this.strm,a=this.options.chunkSize,s,n;if(this.ended)return!1;n=t===~~t?t:t===!0?Ul:FC,typeof e=="string"?i.input=hc.string2buf(e):hv.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new un.Buf8(a),i.next_out=0,i.avail_out=a),s=hn.deflate(i,n),s!==sd&&s!==Cs)return this.onEnd(s),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(n===Ul||n===nd))&&(this.options.to==="string"?this.onData(hc.buf2binstring(un.shrinkBuf(i.output,i.next_out))):this.onData(un.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&s!==sd);return n===Ul?(s=hn.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Cs):(n===nd&&(this.onEnd(Cs),i.avail_out=0),!0)};$a.prototype.onData=function(e){this.chunks.push(e)};$a.prototype.onEnd=function(e){e===Cs&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=un.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Ic(e,t){var i=new $a(t);if(i.push(e,!0),i.err)throw i.msg||uc[i.err];return i.result}function SC(e,t){return t=t||{},t.raw=!0,Ic(e,t)}function IC(e,t){return t=t||{},t.gzip=!0,Ic(e,t)}An.Deflate=$a;An.deflate=Ic;An.deflateRaw=SC;An.gzip=IC;var Fn={},bi={},Fr=30,BC=12,DC=function(t,i){var a,s,n,r,l,o,u,c,f,g,v,m,w,y,_,A,x,C,T,I,D,B,V,Q,F;a=t.state,s=t.next_in,Q=t.input,n=s+(t.avail_in-5),r=t.next_out,F=t.output,l=r-(i-t.avail_out),o=r+(t.avail_out-257),u=a.dmax,c=a.wsize,f=a.whave,g=a.wnext,v=a.window,m=a.hold,w=a.bits,y=a.lencode,_=a.distcode,A=(1<>>24,m>>>=T,w-=T,T=C>>>16&255,T===0)F[r++]=C&65535;else if(T&16){I=C&65535,T&=15,T&&(w>>=T,w-=T),w<15&&(m+=Q[s++]<>>24,m>>>=T,w-=T,T=C>>>16&255,T&16){if(D=C&65535,T&=15,wu){t.msg="invalid distance too far back",a.mode=Fr;break t}if(m>>>=T,w-=T,T=r-l,D>T){if(T=D-T,T>f&&a.sane){t.msg="invalid distance too far back",a.mode=Fr;break t}if(B=0,V=v,g===0){if(B+=c-T,T2;)F[r++]=V[B++],F[r++]=V[B++],F[r++]=V[B++],I-=3;I&&(F[r++]=V[B++],I>1&&(F[r++]=V[B++]))}else{B=r-D;do F[r++]=F[B++],F[r++]=F[B++],F[r++]=F[B++],I-=3;while(I>2);I&&(F[r++]=F[B++],I>1&&(F[r++]=F[B++]))}}else if((T&64)===0){C=_[(C&65535)+(m&(1<>3,s-=I,w-=I<<3,m&=(1<=1&&R[v]===0;v--);if(m>v&&(m=v),v===0)return n[r++]=1<<24|64<<16|0,n[r++]=1<<24|64<<16|0,o.bits=1,0;for(g=1;g0&&(t===cd||v!==1))return-1;for(P[1]=0,c=1;cod||t===hd&&A>ld)return 1;for(;;){Z=c-y,l[f]F?(nt=M[Y+l[f]],j=V[Q+l[f]]):(nt=32+64,j=0),C=1<>y)+T]=Z<<24|nt<<16|j|0;while(T!==0);for(C=1<>=1;if(C!==0?(x&=C-1,x+=C):x=0,f++,--R[c]===0){if(c===v)break;c=i[a+l[f]]}if(c>m&&(x&D)!==I){for(y===0&&(y=m),B+=g,w=c-y,_=1<od||t===hd&&A>ld)return 1;I=x&D,n[I]=m<<24|w<<16|B-r|0}}return x!==0&&(n[B+x]=c-y<<24|64<<16|0),o.bits=m,0},ei=Qi,fc=Qg,Ci=tv,HC=DC,fn=zC,WC=0,uv=1,fv=2,ud=4,UC=5,Rr=6,ja=0,VC=1,$C=2,gi=-2,dv=-3,gv=-4,jC=-5,fd=8,vv=1,dd=2,gd=3,vd=4,md=5,yd=6,pd=7,wd=8,bd=9,xd=10,Jr=11,Wi=12,$l=13,_d=14,jl=15,Ed=16,Ad=17,kd=18,Cd=19,Tr=20,Pr=21,Fd=22,Rd=23,Td=24,Pd=25,Sd=26,ql=27,Id=28,Bd=29,ne=30,mv=31,qC=32,YC=852,KC=592,XC=15,GC=XC;function Dd(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function ZC(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new ei.Buf16(320),this.work=new ei.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function yv(e){var t;return!e||!e.state?gi:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=vv,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new ei.Buf32(YC),t.distcode=t.distdyn=new ei.Buf32(KC),t.sane=1,t.back=-1,ja)}function pv(e){var t;return!e||!e.state?gi:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,yv(e))}function wv(e,t){var i,a;return!e||!e.state||(a=e.state,t<0?(i=0,t=-t):(i=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?gi:(a.window!==null&&a.wbits!==t&&(a.window=null),a.wrap=i,a.wbits=t,pv(e))}function bv(e,t){var i,a;return e?(a=new ZC,e.state=a,a.window=null,i=wv(e,t),i!==ja&&(e.state=null),i):gi}function JC(e){return bv(e,GC)}var Ld=!0,Yl,Kl;function QC(e){if(Ld){var t;for(Yl=new ei.Buf32(512),Kl=new ei.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(fn(uv,e.lens,0,288,Yl,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;fn(fv,e.lens,0,32,Kl,0,e.work,{bits:5}),Ld=!1}e.lencode=Yl,e.lenbits=9,e.distcode=Kl,e.distbits=5}function xv(e,t,i,a){var s,n=e.state;return n.window===null&&(n.wsize=1<=n.wsize?(ei.arraySet(n.window,t,i-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(s=n.wsize-n.wnext,s>a&&(s=a),ei.arraySet(n.window,t,i-a,s,n.wnext),a-=s,a?(ei.arraySet(n.window,t,i-a,a,0),n.wnext=a,n.whave=n.wsize):(n.wnext+=s,n.wnext===n.wsize&&(n.wnext=0),n.whave>>8&255,i.check=Ci(i.check,V,2,0),u=0,c=0,i.mode=dd;break}if(i.flags=0,i.head&&(i.head.done=!1),!(i.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=ne;break}if((u&15)!==fd){e.msg="unknown compression method",i.mode=ne;break}if(u>>>=4,c-=4,D=(u&15)+8,i.wbits===0)i.wbits=D;else if(D>i.wbits){e.msg="invalid window size",i.mode=ne;break}i.dmax=1<>8&1),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,i.check=Ci(i.check,V,2,0)),u=0,c=0,i.mode=gd;case gd:for(;c<32;){if(l===0)break t;l--,u+=a[n++]<>>8&255,V[2]=u>>>16&255,V[3]=u>>>24&255,i.check=Ci(i.check,V,4,0)),u=0,c=0,i.mode=vd;case vd:for(;c<16;){if(l===0)break t;l--,u+=a[n++]<>8),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,i.check=Ci(i.check,V,2,0)),u=0,c=0,i.mode=md;case md:if(i.flags&1024){for(;c<16;){if(l===0)break t;l--,u+=a[n++]<>>8&255,i.check=Ci(i.check,V,2,0)),u=0,c=0}else i.head&&(i.head.extra=null);i.mode=yd;case yd:if(i.flags&1024&&(v=i.length,v>l&&(v=l),v&&(i.head&&(D=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),ei.arraySet(i.head.extra,a,n,v,D)),i.flags&512&&(i.check=Ci(i.check,a,v,n)),l-=v,n+=v,i.length-=v),i.length))break t;i.length=0,i.mode=pd;case pd:if(i.flags&2048){if(l===0)break t;v=0;do D=a[n+v++],i.head&&D&&i.length<65536&&(i.head.name+=String.fromCharCode(D));while(D&&v>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Wi;break;case xd:for(;c<32;){if(l===0)break t;l--,u+=a[n++]<>>=c&7,c-=c&7,i.mode=ql;break}for(;c<3;){if(l===0)break t;l--,u+=a[n++]<>>=1,c-=1,u&3){case 0:i.mode=_d;break;case 1:if(QC(i),i.mode=Tr,t===Rr){u>>>=2,c-=2;break t}break;case 2:i.mode=Ad;break;case 3:e.msg="invalid block type",i.mode=ne}u>>>=2,c-=2;break;case _d:for(u>>>=c&7,c-=c&7;c<32;){if(l===0)break t;l--,u+=a[n++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=ne;break}if(i.length=u&65535,u=0,c=0,i.mode=jl,t===Rr)break t;case jl:i.mode=Ed;case Ed:if(v=i.length,v){if(v>l&&(v=l),v>o&&(v=o),v===0)break t;ei.arraySet(s,a,n,v,r),l-=v,n+=v,o-=v,r+=v,i.length-=v;break}i.mode=Wi;break;case Ad:for(;c<14;){if(l===0)break t;l--,u+=a[n++]<>>=5,c-=5,i.ndist=(u&31)+1,u>>>=5,c-=5,i.ncode=(u&15)+4,u>>>=4,c-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=ne;break}i.have=0,i.mode=kd;case kd:for(;i.have>>=3,c-=3}for(;i.have<19;)i.lens[R[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Q={bits:i.lenbits},B=fn(WC,i.lens,0,19,i.lencode,0,i.work,Q),i.lenbits=Q.bits,B){e.msg="invalid code lengths set",i.mode=ne;break}i.have=0,i.mode=Cd;case Cd:for(;i.have>>24,A=y>>>16&255,x=y&65535,!(_<=c);){if(l===0)break t;l--,u+=a[n++]<>>=_,c-=_,i.lens[i.have++]=x;else{if(x===16){for(F=_+2;c>>=_,c-=_,i.have===0){e.msg="invalid bit length repeat",i.mode=ne;break}D=i.lens[i.have-1],v=3+(u&3),u>>>=2,c-=2}else if(x===17){for(F=_+3;c>>=_,c-=_,D=0,v=3+(u&7),u>>>=3,c-=3}else{for(F=_+7;c>>=_,c-=_,D=0,v=11+(u&127),u>>>=7,c-=7}if(i.have+v>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=ne;break}for(;v--;)i.lens[i.have++]=D}}if(i.mode===ne)break;if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block",i.mode=ne;break}if(i.lenbits=9,Q={bits:i.lenbits},B=fn(uv,i.lens,0,i.nlen,i.lencode,0,i.work,Q),i.lenbits=Q.bits,B){e.msg="invalid literal/lengths set",i.mode=ne;break}if(i.distbits=6,i.distcode=i.distdyn,Q={bits:i.distbits},B=fn(fv,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Q),i.distbits=Q.bits,B){e.msg="invalid distances set",i.mode=ne;break}if(i.mode=Tr,t===Rr)break t;case Tr:i.mode=Pr;case Pr:if(l>=6&&o>=258){e.next_out=r,e.avail_out=o,e.next_in=n,e.avail_in=l,i.hold=u,i.bits=c,HC(e,g),r=e.next_out,s=e.output,o=e.avail_out,n=e.next_in,a=e.input,l=e.avail_in,u=i.hold,c=i.bits,i.mode===Wi&&(i.back=-1);break}for(i.back=0;y=i.lencode[u&(1<>>24,A=y>>>16&255,x=y&65535,!(_<=c);){if(l===0)break t;l--,u+=a[n++]<>C)],_=y>>>24,A=y>>>16&255,x=y&65535,!(C+_<=c);){if(l===0)break t;l--,u+=a[n++]<>>=C,c-=C,i.back+=C}if(u>>>=_,c-=_,i.back+=_,i.length=x,A===0){i.mode=Sd;break}if(A&32){i.back=-1,i.mode=Wi;break}if(A&64){e.msg="invalid literal/length code",i.mode=ne;break}i.extra=A&15,i.mode=Fd;case Fd:if(i.extra){for(F=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=Rd;case Rd:for(;y=i.distcode[u&(1<>>24,A=y>>>16&255,x=y&65535,!(_<=c);){if(l===0)break t;l--,u+=a[n++]<>C)],_=y>>>24,A=y>>>16&255,x=y&65535,!(C+_<=c);){if(l===0)break t;l--,u+=a[n++]<>>=C,c-=C,i.back+=C}if(u>>>=_,c-=_,i.back+=_,A&64){e.msg="invalid distance code",i.mode=ne;break}i.offset=x,i.extra=A&15,i.mode=Td;case Td:if(i.extra){for(F=i.extra;c>>=i.extra,c-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=ne;break}i.mode=Pd;case Pd:if(o===0)break t;if(v=g-o,i.offset>v){if(v=i.offset-v,v>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=ne;break}v>i.wnext?(v-=i.wnext,m=i.wsize-v):m=i.wnext-v,v>i.length&&(v=i.length),w=i.window}else w=s,m=r-i.offset,v=i.length;v>o&&(v=o),o-=v,i.length-=v;do s[r++]=w[m++];while(--v);i.length===0&&(i.mode=Pr);break;case Sd:if(o===0)break t;s[r++]=i.length,o--,i.mode=Pr;break;case ql:if(i.wrap){for(;c<32;){if(l===0)break t;l--,u|=a[n++]<=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new r5,this.strm.avail_out=0;var i=Fs.inflateInit2(this.strm,t.windowBits);if(i!==de.Z_OK)throw new Error(dc[i]);if(this.header=new o5,Fs.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=zr.string2buf(t.dictionary):Ev.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Fs.inflateSetDictionary(this.strm,t.dictionary),i!==de.Z_OK)))throw new Error(dc[i])}qa.prototype.push=function(e,t){var i=this.strm,a=this.options.chunkSize,s=this.options.dictionary,n,r,l,o,u,c=!1;if(this.ended)return!1;r=t===~~t?t:t===!0?de.Z_FINISH:de.Z_NO_FLUSH,typeof e=="string"?i.input=zr.binstring2buf(e):Ev.call(e)==="[object ArrayBuffer]"?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(i.avail_out===0&&(i.output=new dn.Buf8(a),i.next_out=0,i.avail_out=a),n=Fs.inflate(i,de.Z_NO_FLUSH),n===de.Z_NEED_DICT&&s&&(n=Fs.inflateSetDictionary(this.strm,s)),n===de.Z_BUF_ERROR&&c===!0&&(n=de.Z_OK,c=!1),n!==de.Z_STREAM_END&&n!==de.Z_OK)return this.onEnd(n),this.ended=!0,!1;i.next_out&&(i.avail_out===0||n===de.Z_STREAM_END||i.avail_in===0&&(r===de.Z_FINISH||r===de.Z_SYNC_FLUSH))&&(this.options.to==="string"?(l=zr.utf8border(i.output,i.next_out),o=i.next_out-l,u=zr.buf2string(i.output,l),i.next_out=o,i.avail_out=a-o,o&&dn.arraySet(i.output,i.output,l,o,0),this.onData(u)):this.onData(dn.shrinkBuf(i.output,i.next_out))),i.avail_in===0&&i.avail_out===0&&(c=!0)}while((i.avail_in>0||i.avail_out===0)&&n!==de.Z_STREAM_END);return n===de.Z_STREAM_END&&(r=de.Z_FINISH),r===de.Z_FINISH?(n=Fs.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===de.Z_OK):(r===de.Z_SYNC_FLUSH&&(this.onEnd(de.Z_OK),i.avail_out=0),!0)};qa.prototype.onData=function(e){this.chunks.push(e)};qa.prototype.onEnd=function(e){e===de.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=dn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Bc(e,t){var i=new qa(t);if(i.push(e,!0),i.err)throw i.msg||dc[i.err];return i.result}function l5(e,t){return t=t||{},t.raw=!0,Bc(e,t)}Fn.Inflate=qa;Fn.inflate=Bc;Fn.inflateRaw=l5;Fn.ungzip=Bc;var c5=Qi.assign,h5=An,u5=Fn,f5=_v,Av={};c5(Av,h5,u5,f5);var D5=Av,gc={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */(function(e,t){(function(){var i,a="4.17.21",s=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",r="Expected a function",l="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",u=500,c="__lodash_placeholder__",f=1,g=2,v=4,m=1,w=2,y=1,_=2,A=4,x=8,C=16,T=32,I=64,D=128,B=256,V=512,Q=30,F="...",R=800,P=16,M=1,Y=2,Z=3,nt=1/0,j=9007199254740991,H=17976931348623157e292,$=0/0,K=4294967295,U=K-1,tt=K>>>1,at=[["ary",D],["bind",y],["bindKey",_],["curry",x],["curryRight",C],["flip",V],["partial",T],["partialRight",I],["rearg",B]],et="[object Arguments]",ut="[object Array]",ct="[object AsyncFunction]",ot="[object Boolean]",b="[object Date]",E="[object DOMException]",S="[object Error]",N="[object Function]",X="[object GeneratorFunction]",G="[object Map]",rt="[object Number]",yt="[object Null]",mt="[object Object]",At="[object Promise]",Rt="[object Proxy]",be="[object RegExp]",ae="[object Set]",xe="[object String]",jt="[object Symbol]",te="[object Undefined]",xi="[object WeakMap]",kv="[object WeakSet]",Ds="[object ArrayBuffer]",Ga="[object DataView]",so="[object Float32Array]",no="[object Float64Array]",ro="[object Int8Array]",oo="[object Int16Array]",lo="[object Int32Array]",co="[object Uint8Array]",ho="[object Uint8ClampedArray]",uo="[object Uint16Array]",fo="[object Uint32Array]",Cv=/\b__p \+= '';/g,Fv=/\b(__p \+=) '' \+/g,Rv=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Dc=/&(?:amp|lt|gt|quot|#39);/g,Lc=/[&<>"']/g,Tv=RegExp(Dc.source),Pv=RegExp(Lc.source),Sv=/<%-([\s\S]+?)%>/g,Iv=/<%([\s\S]+?)%>/g,Mc=/<%=([\s\S]+?)%>/g,Bv=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dv=/^\w*$/,Lv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,go=/[\\^$.*+?()[\]{}|]/g,Mv=RegExp(go.source),vo=/^\s+/,Ov=/\s/,Nv=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,zv=/\{\n\/\* \[wrapped with (.+)\] \*/,Hv=/,? & /,Wv=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Uv=/[()=,{}\[\]\/\s]/,Vv=/\\(\\)?/g,$v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Oc=/\w*$/,jv=/^[-+]0x[0-9a-f]+$/i,qv=/^0b[01]+$/i,Yv=/^\[object .+?Constructor\]$/,Kv=/^0o[0-7]+$/i,Xv=/^(?:0|[1-9]\d*)$/,Gv=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Rn=/($^)/,Zv=/['\n\r\u2028\u2029\\]/g,Tn="\\ud800-\\udfff",Jv="\\u0300-\\u036f",Qv="\\ufe20-\\ufe2f",t0="\\u20d0-\\u20ff",Nc=Jv+Qv+t0,zc="\\u2700-\\u27bf",Hc="a-z\\xdf-\\xf6\\xf8-\\xff",e0="\\xac\\xb1\\xd7\\xf7",i0="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",a0="\\u2000-\\u206f",s0=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Wc="A-Z\\xc0-\\xd6\\xd8-\\xde",Uc="\\ufe0e\\ufe0f",Vc=e0+i0+a0+s0,mo="['\u2019]",n0="["+Tn+"]",$c="["+Vc+"]",Pn="["+Nc+"]",jc="\\d+",r0="["+zc+"]",qc="["+Hc+"]",Yc="[^"+Tn+Vc+jc+zc+Hc+Wc+"]",yo="\\ud83c[\\udffb-\\udfff]",o0="(?:"+Pn+"|"+yo+")",Kc="[^"+Tn+"]",po="(?:\\ud83c[\\udde6-\\uddff]){2}",wo="[\\ud800-\\udbff][\\udc00-\\udfff]",Za="["+Wc+"]",Xc="\\u200d",Gc="(?:"+qc+"|"+Yc+")",l0="(?:"+Za+"|"+Yc+")",Zc="(?:"+mo+"(?:d|ll|m|re|s|t|ve))?",Jc="(?:"+mo+"(?:D|LL|M|RE|S|T|VE))?",Qc=o0+"?",th="["+Uc+"]?",c0="(?:"+Xc+"(?:"+[Kc,po,wo].join("|")+")"+th+Qc+")*",h0="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",u0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",eh=th+Qc+c0,f0="(?:"+[r0,po,wo].join("|")+")"+eh,d0="(?:"+[Kc+Pn+"?",Pn,po,wo,n0].join("|")+")",g0=RegExp(mo,"g"),v0=RegExp(Pn,"g"),bo=RegExp(yo+"(?="+yo+")|"+d0+eh,"g"),m0=RegExp([Za+"?"+qc+"+"+Zc+"(?="+[$c,Za,"$"].join("|")+")",l0+"+"+Jc+"(?="+[$c,Za+Gc,"$"].join("|")+")",Za+"?"+Gc+"+"+Zc,Za+"+"+Jc,u0,h0,jc,f0].join("|"),"g"),y0=RegExp("["+Xc+Tn+Nc+Uc+"]"),p0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,w0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],b0=-1,ie={};ie[so]=ie[no]=ie[ro]=ie[oo]=ie[lo]=ie[co]=ie[ho]=ie[uo]=ie[fo]=!0,ie[et]=ie[ut]=ie[Ds]=ie[ot]=ie[Ga]=ie[b]=ie[S]=ie[N]=ie[G]=ie[rt]=ie[mt]=ie[be]=ie[ae]=ie[xe]=ie[xi]=!1;var ee={};ee[et]=ee[ut]=ee[Ds]=ee[Ga]=ee[ot]=ee[b]=ee[so]=ee[no]=ee[ro]=ee[oo]=ee[lo]=ee[G]=ee[rt]=ee[mt]=ee[be]=ee[ae]=ee[xe]=ee[jt]=ee[co]=ee[ho]=ee[uo]=ee[fo]=!0,ee[S]=ee[N]=ee[xi]=!1;var x0={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},_0={"&":"&","<":"<",">":">",'"':""","'":"'"},E0={"&":"&","<":"<",">":">",""":'"',"'":"'"},A0={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},k0=parseFloat,C0=parseInt,ih=typeof Be=="object"&&Be&&Be.Object===Object&&Be,F0=typeof self=="object"&&self&&self.Object===Object&&self,_e=ih||F0||Function("return this")(),xo=t&&!t.nodeType&&t,xa=xo&&!0&&e&&!e.nodeType&&e,ah=xa&&xa.exports===xo,_o=ah&&ih.process,ii=function(){try{var it=xa&&xa.require&&xa.require("util").types;return it||_o&&_o.binding&&_o.binding("util")}catch{}}(),sh=ii&&ii.isArrayBuffer,nh=ii&&ii.isDate,rh=ii&&ii.isMap,oh=ii&&ii.isRegExp,lh=ii&&ii.isSet,ch=ii&&ii.isTypedArray;function qe(it,ft,lt){switch(lt.length){case 0:return it.call(ft);case 1:return it.call(ft,lt[0]);case 2:return it.call(ft,lt[0],lt[1]);case 3:return it.call(ft,lt[0],lt[1],lt[2])}return it.apply(ft,lt)}function R0(it,ft,lt,wt){for(var Tt=-1,qt=it==null?0:it.length;++Tt-1}function Eo(it,ft,lt){for(var wt=-1,Tt=it==null?0:it.length;++wt-1;);return lt}function yh(it,ft){for(var lt=it.length;lt--&&Ja(ft,it[lt],0)>-1;);return lt}function O0(it,ft){for(var lt=it.length,wt=0;lt--;)it[lt]===ft&&++wt;return wt}var N0=Fo(x0),z0=Fo(_0);function H0(it){return"\\"+A0[it]}function W0(it,ft){return it==null?i:it[ft]}function Qa(it){return y0.test(it)}function U0(it){return p0.test(it)}function V0(it){for(var ft,lt=[];!(ft=it.next()).done;)lt.push(ft.value);return lt}function So(it){var ft=-1,lt=Array(it.size);return it.forEach(function(wt,Tt){lt[++ft]=[Tt,wt]}),lt}function ph(it,ft){return function(lt){return it(ft(lt))}}function ia(it,ft){for(var lt=-1,wt=it.length,Tt=0,qt=[];++lt-1}function Pm(h,d){var p=this.__data__,k=Kn(p,h);return k<0?(++this.size,p.push([h,d])):p[k][1]=d,this}Ii.prototype.clear=Cm,Ii.prototype.delete=Fm,Ii.prototype.get=Rm,Ii.prototype.has=Tm,Ii.prototype.set=Pm;function Bi(h){var d=-1,p=h==null?0:h.length;for(this.clear();++d=d?h:d)),h}function ri(h,d,p,k,L,z){var q,J=d&f,st=d&g,dt=d&v;if(p&&(q=L?p(h,k,L,z):p(h)),q!==i)return q;if(!oe(h))return h;var gt=Pt(h);if(gt){if(q=Dy(h),!J)return Me(h,q)}else{var vt=Te(h),pt=vt==N||vt==X;if(la(h))return tu(h,J);if(vt==mt||vt==et||pt&&!L){if(q=st||pt?{}:wu(h),!J)return st?Ey(h,qm(q,h)):_y(h,Ph(q,h))}else{if(!ee[vt])return L?h:{};q=Ly(h,vt,J)}}z||(z=new mi);var _t=z.get(h);if(_t)return _t;z.set(h,q),Ku(h)?h.forEach(function(Ft){q.add(ri(Ft,d,p,Ft,h,z))}):qu(h)&&h.forEach(function(Ft,Ot){q.set(Ot,ri(Ft,d,p,Ot,h,z))});var Ct=dt?st?al:il:st?Ne:pe,Dt=gt?i:Ct(h);return ai(Dt||h,function(Ft,Ot){Dt&&(Ot=Ft,Ft=h[Ot]),Ws(q,Ot,ri(Ft,d,p,Ot,h,z))}),q}function Ym(h){var d=pe(h);return function(p){return Sh(p,h,d)}}function Sh(h,d,p){var k=p.length;if(h==null)return!k;for(h=Zt(h);k--;){var L=p[k],z=d[L],q=h[L];if(q===i&&!(L in h)||!z(q))return!1}return!0}function Ih(h,d,p){if(typeof h!="function")throw new si(r);return Ks(function(){h.apply(i,p)},d)}function Us(h,d,p,k){var L=-1,z=Sn,q=!0,J=h.length,st=[],dt=d.length;if(!J)return st;p&&(d=se(d,Ye(p))),k?(z=Eo,q=!1):d.length>=s&&(z=Ls,q=!1,d=new Aa(d));t:for(;++LL?0:L+p),k=k===i||k>L?L:Bt(k),k<0&&(k+=L),k=p>k?0:Gu(k);p0&&p(J)?d>1?Ee(J,d-1,p,k,L):ea(L,J):k||(L[L.length]=J)}return L}var No=ru(),Lh=ru(!0);function _i(h,d){return h&&No(h,d,pe)}function zo(h,d){return h&&Lh(h,d,pe)}function Gn(h,d){return ta(d,function(p){return Ni(h[p])})}function Ca(h,d){d=ra(d,h);for(var p=0,k=d.length;h!=null&&pd}function Gm(h,d){return h!=null&&Xt.call(h,d)}function Zm(h,d){return h!=null&&d in Zt(h)}function Jm(h,d,p){return h>=Re(d,p)&&h=120&>.length>=120)?new Aa(q&>):i}gt=h[0];var vt=-1,pt=J[0];t:for(;++vt-1;)J!==h&&Wn.call(J,st,1),Wn.call(h,st,1);return h}function qh(h,d){for(var p=h?d.length:0,k=p-1;p--;){var L=d[p];if(p==k||L!==z){var z=L;Oi(L)?Wn.call(h,L,1):Xo(h,L)}}return h}function qo(h,d){return h+$n(Ch()*(d-h+1))}function uy(h,d,p,k){for(var L=-1,z=me(Vn((d-h)/(p||1)),0),q=lt(z);z--;)q[k?z:++L]=h,h+=p;return q}function Yo(h,d){var p="";if(!h||d<1||d>j)return p;do d%2&&(p+=h),d=$n(d/2),d&&(h+=h);while(d);return p}function Lt(h,d){return hl(_u(h,d,ze),h+"")}function fy(h){return Th(hs(h))}function dy(h,d){var p=hs(h);return or(p,ka(d,0,p.length))}function js(h,d,p,k){if(!oe(h))return h;d=ra(d,h);for(var L=-1,z=d.length,q=z-1,J=h;J!=null&&++LL?0:L+d),p=p>L?L:p,p<0&&(p+=L),L=d>p?0:p-d>>>0,d>>>=0;for(var z=lt(L);++k>>1,q=h[z];q!==null&&!Xe(q)&&(p?q<=d:q=s){var dt=d?null:Fy(h);if(dt)return Bn(dt);q=!1,L=Ls,st=new Aa}else st=d?[]:J;t:for(;++k=k?h:oi(h,d,p)}var Qh=sm||function(h){return _e.clearTimeout(h)};function tu(h,d){if(d)return h.slice();var p=h.length,k=xh?xh(p):new h.constructor(p);return h.copy(k),k}function Qo(h){var d=new h.constructor(h.byteLength);return new zn(d).set(new zn(h)),d}function py(h,d){var p=d?Qo(h.buffer):h.buffer;return new h.constructor(p,h.byteOffset,h.byteLength)}function wy(h){var d=new h.constructor(h.source,Oc.exec(h));return d.lastIndex=h.lastIndex,d}function by(h){return Hs?Zt(Hs.call(h)):{}}function eu(h,d){var p=d?Qo(h.buffer):h.buffer;return new h.constructor(p,h.byteOffset,h.length)}function iu(h,d){if(h!==d){var p=h!==i,k=h===null,L=h===h,z=Xe(h),q=d!==i,J=d===null,st=d===d,dt=Xe(d);if(!J&&!dt&&!z&&h>d||z&&q&&st&&!J&&!dt||k&&q&&st||!p&&st||!L)return 1;if(!k&&!z&&!dt&&h=J)return st;var dt=p[k];return st*(dt=="desc"?-1:1)}}return h.index-d.index}function au(h,d,p,k){for(var L=-1,z=h.length,q=p.length,J=-1,st=d.length,dt=me(z-q,0),gt=lt(st+dt),vt=!k;++J1?p[L-1]:i,q=L>2?p[2]:i;for(z=h.length>3&&typeof z=="function"?(L--,z):i,q&&Se(p[0],p[1],q)&&(z=L<3?i:z,L=1),d=Zt(d);++k-1?L[z?d[q]:q]:i}}function cu(h){return Mi(function(d){var p=d.length,k=p,L=ni.prototype.thru;for(h&&d.reverse();k--;){var z=d[k];if(typeof z!="function")throw new si(r);if(L&&!q&&nr(z)=="wrapper")var q=new ni([],!0)}for(k=q?k:p;++k1&&Ht.reverse(),gt&&stJ))return!1;var dt=z.get(h),gt=z.get(d);if(dt&>)return dt==d&>==h;var vt=-1,pt=!0,_t=p&w?new Aa:i;for(z.set(h,d),z.set(d,h);++vt1?"& ":"")+d[k],d=d.join(p>2?", ":" "),h.replace(Nv,`{ /* [wrapped with `+d+`] */ `)}function Oy(h){return Pt(h)||Ta(h)||!!(Ah&&h&&h[Ah])}function Oi(h,d){var p=typeof h;return d=d==null?j:d,!!d&&(p=="number"||p!="symbol"&&Xv.test(h))&&h>-1&&h%1==0&&h0){if(++d>=R)return arguments[0]}else d=0;return h.apply(i,arguments)}}function or(h,d){var p=-1,k=h.length,L=k-1;for(d=d===i?k:d;++p1?h[d-1]:i;return p=typeof p=="function"?(h.pop(),p):i,Du(h,p)});function Lu(h){var d=O(h);return d.__chain__=!0,d}function Kp(h,d){return d(h),h}function lr(h,d){return d(h)}var Xp=Mi(function(h){var d=h.length,p=d?h[0]:0,k=this.__wrapped__,L=function(z){return Oo(z,h)};return d>1||this.__actions__.length||!(k instanceof Nt)||!Oi(p)?this.thru(L):(k=k.slice(p,+p+(d?1:0)),k.__actions__.push({func:lr,args:[L],thisArg:i}),new ni(k,this.__chain__).thru(function(z){return d&&!z.length&&z.push(i),z}))});function Gp(){return Lu(this)}function Zp(){return new ni(this.value(),this.__chain__)}function Jp(){this.__values__===i&&(this.__values__=Xu(this.value()));var h=this.__index__>=this.__values__.length,d=h?i:this.__values__[this.__index__++];return{done:h,value:d}}function Qp(){return this}function tw(h){for(var d,p=this;p instanceof Yn;){var k=Ru(p);k.__index__=0,k.__values__=i,d?L.__wrapped__=k:d=k;var L=k;p=p.__wrapped__}return L.__wrapped__=h,d}function ew(){var h=this.__wrapped__;if(h instanceof Nt){var d=h;return this.__actions__.length&&(d=new Nt(this)),d=d.reverse(),d.__actions__.push({func:lr,args:[ul],thisArg:i}),new ni(d,this.__chain__)}return this.thru(ul)}function iw(){return Zh(this.__wrapped__,this.__actions__)}var aw=tr(function(h,d,p){Xt.call(h,p)?++h[p]:Di(h,p,1)});function sw(h,d,p){var k=Pt(h)?hh:Km;return p&&Se(h,d,p)&&(d=i),k(h,kt(d,3))}function nw(h,d){var p=Pt(h)?ta:Dh;return p(h,kt(d,3))}var rw=lu(Tu),ow=lu(Pu);function lw(h,d){return Ee(cr(h,d),1)}function cw(h,d){return Ee(cr(h,d),nt)}function hw(h,d,p){return p=p===i?1:Bt(p),Ee(cr(h,d),p)}function Mu(h,d){var p=Pt(h)?ai:sa;return p(h,kt(d,3))}function Ou(h,d){var p=Pt(h)?T0:Bh;return p(h,kt(d,3))}var uw=tr(function(h,d,p){Xt.call(h,p)?h[p].push(d):Di(h,p,[d])});function fw(h,d,p,k){h=Oe(h)?h:hs(h),p=p&&!k?Bt(p):0;var L=h.length;return p<0&&(p=me(L+p,0)),gr(h)?p<=L&&h.indexOf(d,p)>-1:!!L&&Ja(h,d,p)>-1}var dw=Lt(function(h,d,p){var k=-1,L=typeof d=="function",z=Oe(h)?lt(h.length):[];return sa(h,function(q){z[++k]=L?qe(d,q,p):Vs(q,d,p)}),z}),gw=tr(function(h,d,p){Di(h,p,d)});function cr(h,d){var p=Pt(h)?se:Hh;return p(h,kt(d,3))}function vw(h,d,p,k){return h==null?[]:(Pt(d)||(d=d==null?[]:[d]),p=k?i:p,Pt(p)||(p=p==null?[]:[p]),$h(h,d,p))}var mw=tr(function(h,d,p){h[p?0:1].push(d)},function(){return[[],[]]});function yw(h,d,p){var k=Pt(h)?Ao:gh,L=arguments.length<3;return k(h,kt(d,4),p,L,sa)}function pw(h,d,p){var k=Pt(h)?P0:gh,L=arguments.length<3;return k(h,kt(d,4),p,L,Bh)}function ww(h,d){var p=Pt(h)?ta:Dh;return p(h,fr(kt(d,3)))}function bw(h){var d=Pt(h)?Th:fy;return d(h)}function xw(h,d,p){(p?Se(h,d,p):d===i)?d=1:d=Bt(d);var k=Pt(h)?Vm:dy;return k(h,d)}function _w(h){var d=Pt(h)?$m:vy;return d(h)}function Ew(h){if(h==null)return 0;if(Oe(h))return gr(h)?ts(h):h.length;var d=Te(h);return d==G||d==ae?h.size:Vo(h).length}function Aw(h,d,p){var k=Pt(h)?ko:my;return p&&Se(h,d,p)&&(d=i),k(h,kt(d,3))}var kw=Lt(function(h,d){if(h==null)return[];var p=d.length;return p>1&&Se(h,d[0],d[1])?d=[]:p>2&&Se(d[0],d[1],d[2])&&(d=[d[0]]),$h(h,Ee(d,1),[])}),hr=nm||function(){return _e.Date.now()};function Cw(h,d){if(typeof d!="function")throw new si(r);return h=Bt(h),function(){if(--h<1)return d.apply(this,arguments)}}function Nu(h,d,p){return d=p?i:d,d=h&&d==null?h.length:d,Li(h,D,i,i,i,i,d)}function zu(h,d){var p;if(typeof d!="function")throw new si(r);return h=Bt(h),function(){return--h>0&&(p=d.apply(this,arguments)),h<=1&&(d=i),p}}var dl=Lt(function(h,d,p){var k=y;if(p.length){var L=ia(p,ls(dl));k|=T}return Li(h,k,d,p,L)}),Hu=Lt(function(h,d,p){var k=y|_;if(p.length){var L=ia(p,ls(Hu));k|=T}return Li(d,k,h,p,L)});function Wu(h,d,p){d=p?i:d;var k=Li(h,x,i,i,i,i,i,d);return k.placeholder=Wu.placeholder,k}function Uu(h,d,p){d=p?i:d;var k=Li(h,C,i,i,i,i,i,d);return k.placeholder=Uu.placeholder,k}function Vu(h,d,p){var k,L,z,q,J,st,dt=0,gt=!1,vt=!1,pt=!0;if(typeof h!="function")throw new si(r);d=ci(d)||0,oe(p)&&(gt=!!p.leading,vt="maxWait"in p,z=vt?me(ci(p.maxWait)||0,d):z,pt="trailing"in p?!!p.trailing:pt);function _t(fe){var pi=k,Hi=L;return k=L=i,dt=fe,q=h.apply(Hi,pi),q}function Ct(fe){return dt=fe,J=Ks(Ot,d),gt?_t(fe):q}function Dt(fe){var pi=fe-st,Hi=fe-dt,cf=d-pi;return vt?Re(cf,z-Hi):cf}function Ft(fe){var pi=fe-st,Hi=fe-dt;return st===i||pi>=d||pi<0||vt&&Hi>=z}function Ot(){var fe=hr();if(Ft(fe))return Ht(fe);J=Ks(Ot,Dt(fe))}function Ht(fe){return J=i,pt&&k?_t(fe):(k=L=i,q)}function Ge(){J!==i&&Qh(J),dt=0,k=st=L=J=i}function Ie(){return J===i?q:Ht(hr())}function Ze(){var fe=hr(),pi=Ft(fe);if(k=arguments,L=this,st=fe,pi){if(J===i)return Ct(st);if(vt)return Qh(J),J=Ks(Ot,d),_t(st)}return J===i&&(J=Ks(Ot,d)),q}return Ze.cancel=Ge,Ze.flush=Ie,Ze}var Fw=Lt(function(h,d){return Ih(h,1,d)}),Rw=Lt(function(h,d,p){return Ih(h,ci(d)||0,p)});function Tw(h){return Li(h,V)}function ur(h,d){if(typeof h!="function"||d!=null&&typeof d!="function")throw new si(r);var p=function(){var k=arguments,L=d?d.apply(this,k):k[0],z=p.cache;if(z.has(L))return z.get(L);var q=h.apply(this,k);return p.cache=z.set(L,q)||z,q};return p.cache=new(ur.Cache||Bi),p}ur.Cache=Bi;function fr(h){if(typeof h!="function")throw new si(r);return function(){var d=arguments;switch(d.length){case 0:return!h.call(this);case 1:return!h.call(this,d[0]);case 2:return!h.call(this,d[0],d[1]);case 3:return!h.call(this,d[0],d[1],d[2])}return!h.apply(this,d)}}function Pw(h){return zu(2,h)}var Sw=yy(function(h,d){d=d.length==1&&Pt(d[0])?se(d[0],Ye(kt())):se(Ee(d,1),Ye(kt()));var p=d.length;return Lt(function(k){for(var L=-1,z=Re(k.length,p);++L=d}),Ta=Oh(function(){return arguments}())?Oh:function(h){return ce(h)&&Xt.call(h,"callee")&&!Eh.call(h,"callee")},Pt=lt.isArray,qw=sh?Ye(sh):ty;function Oe(h){return h!=null&&dr(h.length)&&!Ni(h)}function ue(h){return ce(h)&&Oe(h)}function Yw(h){return h===!0||h===!1||ce(h)&&Pe(h)==ot}var la=om||kl,Kw=nh?Ye(nh):ey;function Xw(h){return ce(h)&&h.nodeType===1&&!Xs(h)}function Gw(h){if(h==null)return!0;if(Oe(h)&&(Pt(h)||typeof h=="string"||typeof h.splice=="function"||la(h)||cs(h)||Ta(h)))return!h.length;var d=Te(h);if(d==G||d==ae)return!h.size;if(Ys(h))return!Vo(h).length;for(var p in h)if(Xt.call(h,p))return!1;return!0}function Zw(h,d){return $s(h,d)}function Jw(h,d,p){p=typeof p=="function"?p:i;var k=p?p(h,d):i;return k===i?$s(h,d,i,p):!!k}function vl(h){if(!ce(h))return!1;var d=Pe(h);return d==S||d==E||typeof h.message=="string"&&typeof h.name=="string"&&!Xs(h)}function Qw(h){return typeof h=="number"&&kh(h)}function Ni(h){if(!oe(h))return!1;var d=Pe(h);return d==N||d==X||d==ct||d==Rt}function ju(h){return typeof h=="number"&&h==Bt(h)}function dr(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=j}function oe(h){var d=typeof h;return h!=null&&(d=="object"||d=="function")}function ce(h){return h!=null&&typeof h=="object"}var qu=rh?Ye(rh):ay;function t1(h,d){return h===d||Uo(h,d,nl(d))}function e1(h,d,p){return p=typeof p=="function"?p:i,Uo(h,d,nl(d),p)}function i1(h){return Yu(h)&&h!=+h}function a1(h){if(Hy(h))throw new Tt(n);return Nh(h)}function s1(h){return h===null}function n1(h){return h==null}function Yu(h){return typeof h=="number"||ce(h)&&Pe(h)==rt}function Xs(h){if(!ce(h)||Pe(h)!=mt)return!1;var d=Hn(h);if(d===null)return!0;var p=Xt.call(d,"constructor")&&d.constructor;return typeof p=="function"&&p instanceof p&&Mn.call(p)==em}var ml=oh?Ye(oh):sy;function r1(h){return ju(h)&&h>=-j&&h<=j}var Ku=lh?Ye(lh):ny;function gr(h){return typeof h=="string"||!Pt(h)&&ce(h)&&Pe(h)==xe}function Xe(h){return typeof h=="symbol"||ce(h)&&Pe(h)==jt}var cs=ch?Ye(ch):ry;function o1(h){return h===i}function l1(h){return ce(h)&&Te(h)==xi}function c1(h){return ce(h)&&Pe(h)==kv}var h1=sr($o),u1=sr(function(h,d){return h<=d});function Xu(h){if(!h)return[];if(Oe(h))return gr(h)?vi(h):Me(h);if(Ms&&h[Ms])return V0(h[Ms]());var d=Te(h),p=d==G?So:d==ae?Bn:hs;return p(h)}function zi(h){if(!h)return h===0?h:0;if(h=ci(h),h===nt||h===-nt){var d=h<0?-1:1;return d*H}return h===h?h:0}function Bt(h){var d=zi(h),p=d%1;return d===d?p?d-p:d:0}function Gu(h){return h?ka(Bt(h),0,K):0}function ci(h){if(typeof h=="number")return h;if(Xe(h))return $;if(oe(h)){var d=typeof h.valueOf=="function"?h.valueOf():h;h=oe(d)?d+"":d}if(typeof h!="string")return h===0?h:+h;h=vh(h);var p=qv.test(h);return p||Kv.test(h)?C0(h.slice(2),p?2:8):jv.test(h)?$:+h}function Zu(h){return Ei(h,Ne(h))}function f1(h){return h?ka(Bt(h),-j,j):h===0?h:0}function Kt(h){return h==null?"":Ke(h)}var d1=rs(function(h,d){if(Ys(d)||Oe(d)){Ei(d,pe(d),h);return}for(var p in d)Xt.call(d,p)&&Ws(h,p,d[p])}),Ju=rs(function(h,d){Ei(d,Ne(d),h)}),vr=rs(function(h,d,p,k){Ei(d,Ne(d),h,k)}),g1=rs(function(h,d,p,k){Ei(d,pe(d),h,k)}),v1=Mi(Oo);function m1(h,d){var p=ns(h);return d==null?p:Ph(p,d)}var y1=Lt(function(h,d){h=Zt(h);var p=-1,k=d.length,L=k>2?d[2]:i;for(L&&Se(d[0],d[1],L)&&(k=1);++p1),z}),Ei(h,al(h),p),k&&(p=ri(p,f|g|v,Ry));for(var L=d.length;L--;)Xo(p,d[L]);return p});function L1(h,d){return tf(h,fr(kt(d)))}var M1=Mi(function(h,d){return h==null?{}:cy(h,d)});function tf(h,d){if(h==null)return{};var p=se(al(h),function(k){return[k]});return d=kt(d),jh(h,p,function(k,L){return d(k,L[0])})}function O1(h,d,p){d=ra(d,h);var k=-1,L=d.length;for(L||(L=1,h=i);++kd){var k=h;h=d,d=k}if(p||h%1||d%1){var L=Ch();return Re(h+L*(d-h+k0("1e-"+((L+"").length-1))),d)}return qo(h,d)}var K1=os(function(h,d,p){return d=d.toLowerCase(),h+(p?sf(d):d)});function sf(h){return wl(Kt(h).toLowerCase())}function nf(h){return h=Kt(h),h&&h.replace(Gv,N0).replace(v0,"")}function X1(h,d,p){h=Kt(h),d=Ke(d);var k=h.length;p=p===i?k:ka(Bt(p),0,k);var L=p;return p-=d.length,p>=0&&h.slice(p,L)==d}function G1(h){return h=Kt(h),h&&Pv.test(h)?h.replace(Lc,z0):h}function Z1(h){return h=Kt(h),h&&Mv.test(h)?h.replace(go,"\\$&"):h}var J1=os(function(h,d,p){return h+(p?"-":"")+d.toLowerCase()}),Q1=os(function(h,d,p){return h+(p?" ":"")+d.toLowerCase()}),tb=ou("toLowerCase");function eb(h,d,p){h=Kt(h),d=Bt(d);var k=d?ts(h):0;if(!d||k>=d)return h;var L=(d-k)/2;return ar($n(L),p)+h+ar(Vn(L),p)}function ib(h,d,p){h=Kt(h),d=Bt(d);var k=d?ts(h):0;return d&&k>>0,p?(h=Kt(h),h&&(typeof d=="string"||d!=null&&!ml(d))&&(d=Ke(d),!d&&Qa(h))?oa(vi(h),0,p):h.split(d,p)):[]}var cb=os(function(h,d,p){return h+(p?" ":"")+wl(d)});function hb(h,d,p){return h=Kt(h),p=p==null?0:ka(Bt(p),0,h.length),d=Ke(d),h.slice(p,p+d.length)==d}function ub(h,d,p){var k=O.templateSettings;p&&Se(h,d,p)&&(d=i),h=Kt(h),d=vr({},d,k,gu);var L=vr({},d.imports,k.imports,gu),z=pe(L),q=Po(L,z),J,st,dt=0,gt=d.interpolate||Rn,vt="__p += '",pt=Io((d.escape||Rn).source+"|"+gt.source+"|"+(gt===Mc?$v:Rn).source+"|"+(d.evaluate||Rn).source+"|$","g"),_t="//# sourceURL="+(Xt.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++b0+"]")+` `;h.replace(pt,function(Ft,Ot,Ht,Ge,Ie,Ze){return Ht||(Ht=Ge),vt+=h.slice(dt,Ze).replace(Zv,H0),Ot&&(J=!0,vt+=`' + __e(`+Ot+`) + '`),Ie&&(st=!0,vt+=`'; `+Ie+`; __p += '`),Ht&&(vt+=`' + ((__t = (`+Ht+`)) == null ? '' : __t) + '`),dt=Ze+Ft.length,Ft}),vt+=`'; `;var Ct=Xt.call(d,"variable")&&d.variable;if(!Ct)vt=`with (obj) { `+vt+` } `;else if(Uv.test(Ct))throw new Tt(l);vt=(st?vt.replace(Cv,""):vt).replace(Fv,"$1").replace(Rv,"$1;"),vt="function("+(Ct||"obj")+`) { `+(Ct?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(J?", __e = _.escape":"")+(st?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+vt+`return __p }`;var Dt=of(function(){return qt(z,_t+"return "+vt).apply(i,q)});if(Dt.source=vt,vl(Dt))throw Dt;return Dt}function fb(h){return Kt(h).toLowerCase()}function db(h){return Kt(h).toUpperCase()}function gb(h,d,p){if(h=Kt(h),h&&(p||d===i))return vh(h);if(!h||!(d=Ke(d)))return h;var k=vi(h),L=vi(d),z=mh(k,L),q=yh(k,L)+1;return oa(k,z,q).join("")}function vb(h,d,p){if(h=Kt(h),h&&(p||d===i))return h.slice(0,wh(h)+1);if(!h||!(d=Ke(d)))return h;var k=vi(h),L=yh(k,vi(d))+1;return oa(k,0,L).join("")}function mb(h,d,p){if(h=Kt(h),h&&(p||d===i))return h.replace(vo,"");if(!h||!(d=Ke(d)))return h;var k=vi(h),L=mh(k,vi(d));return oa(k,L).join("")}function yb(h,d){var p=Q,k=F;if(oe(d)){var L="separator"in d?d.separator:L;p="length"in d?Bt(d.length):p,k="omission"in d?Ke(d.omission):k}h=Kt(h);var z=h.length;if(Qa(h)){var q=vi(h);z=q.length}if(p>=z)return h;var J=p-ts(k);if(J<1)return k;var st=q?oa(q,0,J).join(""):h.slice(0,J);if(L===i)return st+k;if(q&&(J+=st.length-J),ml(L)){if(h.slice(J).search(L)){var dt,gt=st;for(L.global||(L=Io(L.source,Kt(Oc.exec(L))+"g")),L.lastIndex=0;dt=L.exec(gt);)var vt=dt.index;st=st.slice(0,vt===i?J:vt)}}else if(h.indexOf(Ke(L),J)!=J){var pt=st.lastIndexOf(L);pt>-1&&(st=st.slice(0,pt))}return st+k}function pb(h){return h=Kt(h),h&&Tv.test(h)?h.replace(Dc,Y0):h}var wb=os(function(h,d,p){return h+(p?" ":"")+d.toUpperCase()}),wl=ou("toUpperCase");function rf(h,d,p){return h=Kt(h),d=p?i:d,d===i?U0(h)?G0(h):B0(h):h.match(d)||[]}var of=Lt(function(h,d){try{return qe(h,i,d)}catch(p){return vl(p)?p:new Tt(p)}}),bb=Mi(function(h,d){return ai(d,function(p){p=Ai(p),Di(h,p,dl(h[p],h))}),h});function xb(h){var d=h==null?0:h.length,p=kt();return h=d?se(h,function(k){if(typeof k[1]!="function")throw new si(r);return[p(k[0]),k[1]]}):[],Lt(function(k){for(var L=-1;++Lj)return[];var p=K,k=Re(h,K);d=kt(d),h-=K;for(var L=To(k,d);++p0||d<0)?new Nt(p):(h<0?p=p.takeRight(-h):h&&(p=p.drop(h)),d!==i&&(d=Bt(d),p=d<0?p.dropRight(-d):p.take(d-h)),p)},Nt.prototype.takeRightWhile=function(h){return this.reverse().takeWhile(h).reverse()},Nt.prototype.toArray=function(){return this.take(K)},_i(Nt.prototype,function(h,d){var p=/^(?:filter|find|map|reject)|While$/.test(d),k=/^(?:head|last)$/.test(d),L=O[k?"take"+(d=="last"?"Right":""):d],z=k||/^find/.test(d);!L||(O.prototype[d]=function(){var q=this.__wrapped__,J=k?[1]:arguments,st=q instanceof Nt,dt=J[0],gt=st||Pt(q),vt=function(Ot){var Ht=L.apply(O,ea([Ot],J));return k&&pt?Ht[0]:Ht};gt&&p&&typeof dt=="function"&&dt.length!=1&&(st=gt=!1);var pt=this.__chain__,_t=!!this.__actions__.length,Ct=z&&!pt,Dt=st&&!_t;if(!z&>){q=Dt?q:new Nt(this);var Ft=h.apply(q,J);return Ft.__actions__.push({func:lr,args:[vt],thisArg:i}),new ni(Ft,pt)}return Ct&&Dt?h.apply(this,J):(Ft=this.thru(vt),Ct?k?Ft.value()[0]:Ft.value():Ft)})}),ai(["pop","push","shift","sort","splice","unshift"],function(h){var d=Dn[h],p=/^(?:push|sort|unshift)$/.test(h)?"tap":"thru",k=/^(?:pop|shift)$/.test(h);O.prototype[h]=function(){var L=arguments;if(k&&!this.__chain__){var z=this.value();return d.apply(Pt(z)?z:[],L)}return this[p](function(q){return d.apply(Pt(q)?q:[],L)})}}),_i(Nt.prototype,function(h,d){var p=O[d];if(p){var k=p.name+"";Xt.call(ss,k)||(ss[k]=[]),ss[k].push({name:d,func:p})}}),ss[er(i,_).name]=[{name:"wrapper",func:i}],Nt.prototype.clone=pm,Nt.prototype.reverse=wm,Nt.prototype.value=bm,O.prototype.at=Xp,O.prototype.chain=Gp,O.prototype.commit=Zp,O.prototype.next=Jp,O.prototype.plant=tw,O.prototype.reverse=ew,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=iw,O.prototype.first=O.prototype.head,Ms&&(O.prototype[Ms]=Qp),O},es=Z0();xa?((xa.exports=es)._=es,xo._=es):_e._=es}).call(Be)})(gc,gc.exports);const L5=gc.exports;export{TE as M,L5 as _,m5 as a,p5 as b,w5 as c,b5 as d,A5 as e,v5 as f,y5 as g,_5 as h,k5 as i,C5 as j,F5 as k,B5 as l,S5 as m,T5 as n,P5 as o,D5 as p,I5 as q,x5 as r,E5 as s,R5 as t};