lodash.12932064.js 993 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. var t2=Object.defineProperty;var e2=(e,t,i)=>t in e?t2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var H=(e,t,i)=>(e2(e,typeof t!="symbol"?t+"":t,i),i);import{P as Oe}from"./index.0a536df3.js";function ja(e,t){const i=t||new Path2D;if(e.name==="combine"&&!e.draw)return i instanceof Path2D?i:void 0;e.setTheme||(e.setTheme=i2);let a=e.calculative.borderRadius*e.calculative.canvas.store.data.scale||0,s=a;const{x:n,y:r,width:o,height:l,ex:u,ey:c}=e.calculative.worldRect;a<1&&(a=o*a,s=l*s);let d=a<s?a:s;if(o<2*d&&(d=o/2),l<2*d&&(d=l/2),i.moveTo(n+d,r),i.arcTo(u,r,u,c,d),i.arcTo(u,c,n,c,d),i.arcTo(n,c,n,r,d),i.arcTo(n,r,u,r,d),i.closePath(),i instanceof Path2D)return i}function i2(e,t){if(!!e.affectByTheme){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.hoverTextColor=t.textPrimaryColor,e.iconColor=t.buttonBg,e.calculative.iconColor=t.buttonBg,e.hoverBackground=t.formBg,e.activeBackground=t.activeBg,e.color=t.borderColor,e.calculative.color=t.borderColor,e.textColor=t["textColor-9"],e.calculative.textColor=t["textColor-9"]}}const a2=ja;function s2(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.ellipse(a+n/2,s+r/2,n/2,r/2,0,0,Math.PI*2),i instanceof Path2D)return i}var Ut;(function(e){e[e.Node=0]="Node",e[e.Line=1]="Line"})(Ut||(Ut={}));var It;(function(e){e[e.None=0]="None",e[e.DisableEdit=1]="DisableEdit",e[e.DisableMove=2]="DisableMove",e[e.DisableScale=3]="DisableScale",e[e.DisableMoveScale=4]="DisableMoveScale",e[e.Disable=10]="Disable"})(It||(It={}));var qf;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out"})(qf||(qf={}));var Oi;(function(e){e[e.None=0]="None",e[e.Linear=1]="Linear",e[e.Radial=2]="Radial"})(Oi||(Oi={}));var zt;(function(e){e[e.CanvasTemplate=1]="CanvasTemplate",e[e.CanvasImageBottom=2]="CanvasImageBottom",e[e.CanvasMain=3]="CanvasMain",e[e.CanvasImage=4]="CanvasImage"})(zt||(zt={}));const n2=["text","textWidth","textHeight","textLeft","textTop","fontFamily","fontSize","lineHeight","fontStyle","fontWeight","textAlign","textBaseline","whiteSpace","ellipsis","keepDecimal","letterSpacing"],r2=["x","y","width","height","flipX","flipY"],o2=["paddingTop","paddingRight","paddingBottom","paddingLeft","flipX","flipY","visible","showChild"],l2=["iconLeft","iconTop","iconRotate","icon"],Sg=["globalAlpha","flipY","flipX","x","y","width","height","iconWidth","iconHeight","imageRatio","iconLeft","iconTop","iconAlign","rotate","visible"];var ie;(function(e){e[e.Normal=0]="Normal",e[e.Beads=1]="Beads",e[e.Dot=2]="Dot",e[e.Arrow=3]="Arrow",e[e.WaterDrop=4]="WaterDrop",e[e.Custom=5]="Custom",e[e.Breath=6]="Breath"})(ie||(ie={}));var ks;(function(e){e[e.Image=0]="Image",e[e.Icon=1]="Icon",e[e.Pen=2]="Pen",e[e.Element=3]="Element"})(ks||(ks={}));const bc=["gif","iframe","video","echarts","highcharts","lightningCharts","vue"],Gl=["radio","checkbox","button","inputDom","slider","echarts"],ln=new Set(["borderRadius","paddingLeft","paddingRight","paddingTop","paddingBottom","progress","progressColor","verticalProgress","reverseProgress","flipX","flipY","input","lineDash","lineCap","lineJoin","strokeType","lineGradientFromColor","lineGradientToColor","lineGradientAngle","color","hoverColor","activeColor","lineWidth","bkType","gradientFromColor","gradientToColor","gradientAngle","gradientRadius","hoverBackground","activeBackground","globalAlpha","anchorColor","anchorRadius","shadow","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","textHasShadow","fontFamily","fontSize","textColor","hoverTextColor","activeTextColor","textBackground","fontStyle","fontWeight","textAlign","textBaseline","lineHeight","whiteSpace","textWidth","textHeight","textLeft","textTop","ellipsis","hiddenText","keepDecimal","borderWidth","borderColor","animateLineWidth","lineAnimateType","frames","animateColor","animateType","animateReverse","background","gradientColors","lineGradientColors","animateLineWidth","gradientSmooth","lineSmooth","animations","toArrow","fromArrow","dirMarkerLineWidth","lineName","textType","textGradientColors"]),Zl={textType:0,bkType:0,strokeType:0};function c2(e){e.onAdd=void 0,e.onValue=void 0,e.onBeforeValue=void 0,e.onDestroy=void 0,e.onMove=void 0,e.onResize=void 0,e.onRotate=void 0,e.onClick=void 0,e.onMouseEnter=void 0,e.onMouseLeave=void 0,e.onMouseDown=void 0,e.onMouseMove=void 0,e.onMouseUp=void 0,e.onShowInput=void 0,e.onInput=void 0,e.onChangeId=void 0,e.onBinds=void 0,e.onStartVideo=void 0,e.onPauseVideo=void 0,e.onStopVideo=void 0,e.onRenderPenRaw=void 0,e.onKeyDown=void 0,e.onContextmenu=void 0,e.onScale=void 0,e.onWheel=void 0,e.onConnectLine=void 0}var xt;(function(e){e[e.None=0]="None",e[e.LineAnchor=1]="LineAnchor",e[e.NodeAnchor=2]="NodeAnchor",e[e.Line=3]="Line",e[e.Node=4]="Node",e[e.Resize=5]="Resize",e[e.Rotate=6]="Rotate",e[e.LineAnchorPrev=7]="LineAnchorPrev",e[e.LineAnchorNext=8]="LineAnchorNext"})(xt||(xt={}));var Yt;(function(e){e[e.None=0]="None",e[e.Translate=1]="Translate",e[e.Select=2]="Select",e[e.Resize=3]="Resize",e[e.AddAnchor=4]="AddAnchor"})(Yt||(Yt={}));var Zi;(function(e){e[e.None=0]="None",e[e.Down=1]="Down",e[e.Translate=2]="Translate"})(Zi||(Zi={}));var Rt;(function(e){e[e.None=-1]="None",e[e.Up=0]="Up",e[e.Right=1]="Right",e[e.Bottom=2]="Bottom",e[e.Left=3]="Left"})(Rt||(Rt={}));const Yf=["nw-resize","ne-resize","se-resize","sw-resize"],Kf=["n-resize","e-resize","s-resize","w-resize"],u2=["curve","polyline","line"],Tg=["dash","lineWidth","lineCap","lineJoin","strokeType","color","lineGradientFromColor","lineGradientToColor","lineGradientAngle","globalAlpha","bkType","background","gradientFromColor","gradientToColor","gradientAngle","gradientRadius","fontFamily","fontSize","textColor","hoverTextColor","activeTextColor","textBackground","fontStyle","fontWeight","textAlign","textBaseline","lineHeight","whiteSpace","textLeft","textTop","flipX","flipY","lineDash","visible","iconColor"];var qa;(function(e){e[e.Mirror=0]="Mirror",e[e.Bilateral=1]="Bilateral",e[e.Free=2]="Free"})(qa||(qa={}));var Ae;(function(e){e[e.Default=0]="Default",e[e.In=1]="In",e[e.Out=2]="Out",e[e.DisableConnected=3]="DisableConnected",e[e.DisableConnectTo=4]="DisableConnectTo",e[e.Disable=10]="Disable"})(Ae||(Ae={}));var Bi;(function(e){e[e.Default=0]="Default",e[e.Line=1]="Line"})(Bi||(Bi={}));function Zt(e,t,i){if(!t||t%360===0)return;const a=t*Math.PI/180,s=(e.x-i.x)*Math.cos(a)-(e.y-i.y)*Math.sin(a)+i.x,n=(e.x-i.x)*Math.sin(a)+(e.y-i.y)*Math.cos(a)+i.y;e.x=s,e.y=n,e.prev&&Zt(e.prev,t,i),e.next&&Zt(e.next,t,i)}function As(e,t,i=5,a){if(t.type===Bi.Line){let s=a.rotate;a.flipX&&(s*=-1),a.flipY&&(s*=-1);let n=t.rotate+s;return a.flipX&&(n*=-1),a.flipY&&(n*=-1),Gi(e,{x:t.x-t.length*a.calculative.canvas.store.data.scale/2,y:t.y-i,width:t.length*a.calculative.canvas.store.data.scale,height:i*2,rotate:n})}else return e.x>t.x-i&&e.x<t.x+i&&e.y>t.y-i&&e.y<t.y+i}function Fs(e,t,i){e.x=i.x-(i.x-e.x)*t,e.y=i.y-(i.y-e.y)*t}function gi(e,t){if(e.x===t.x)return e.y<=t.y?0:180;if(e.y===t.y)return e.x<t.x?270:90;const i=e.x-t.x,a=e.y-t.y;let s=Math.atan(Math.abs(i/a))/(2*Math.PI)*360;return i>0&&a>0?s=180-s:i<0&&a>0?s+=180:i<0&&a<0&&(s=360-s),s}function wo(e,t){const i=e.x-t.x,a=e.y-t.y;return Math.sqrt(i*i+a*a)}function h2(e,t){let i=Rt.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=Rt.Right:i=Rt.Left:s>0?i=Rt.Bottom:i=Rt.Up,i}function bn(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 Xf(e,t){return e.anchorId===t.anchorId&&e.connectTo===t.connectTo}function Pr(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<t.x?i.pens[t.penId].flipX||(a*=-1):i.pens[t.penId].flipX&&(a*=-1):e.y<t.y?i.pens[t.penId].flipY||(a*=-1):i.pens[t.penId].flipY&&(a*=-1),e.distance=a}const f2="@meta2d/core",d2="1.1.33",g2="@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",v2="index.js",m2="index.d.ts",y2={copy:"copyfiles package.json ../../dist/core/",build:"tsc && npm run copy"},p2=["meta2d","diagram","2D","canvas"],w2="alsmile123@qq.com",b2="MIT",x2={type:"git",url:"git+https://github.com/le5le-com/meta2d.js.git"},_2={url:"https://github.com/le5le-com/meta2d.js/issues"},E2="https://github.com/le5le-com/meta2d.js#readme",A2={"@types/marked":"^4.0.3","@types/offscreencanvas":"latest","@types/zrender":"^4.0.0"},C2={mitt:"^2.1.0",mqtt:"^4.2.6"},k2={access:"public"},F2="78f2a53ca1839c89b56e2e498d17ba4eb987ad14",Bg={name:f2,version:d2,description:g2,main:v2,types:m2,scripts:y2,keywords:p2,author:w2,license:b2,repository:x2,bugs:_2,homepage:E2,devDependencies:A2,dependencies:C2,publishConfig:k2,gitHead:F2},wt={version:Bg.version,path2dDraws:{},canvasDraws:{},anchors:{},lineAnimateDraws:{},htmlElements:{},gridDrawers:{}};function Ig(e){Object.assign(wt.path2dDraws,e)}function P2(e){Object.assign(wt.canvasDraws,e)}function R2(e){Object.assign(wt.anchors,e)}function S2(e,t){wt.gridDrawers[e]=t}function T2(e){delete wt.gridDrawers[e]}function B2(e){return{all:e=e||new Map,on:function(t,i){var a=e.get(t);a&&a.push(i)||e.set(t,[i])},off:function(t,i){var a=e.get(t);a&&a.splice(a.indexOf(i)>>>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 Wa;(function(e){e[e.None=-1]="None",e[e.Document=0]="Document",e[e.Canvas=1]="Canvas"})(Wa||(Wa={}));const I2="#FFFFFF00",D2={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:Wa.Document,gridSize:20,gridColor:"#e2e2e2",ruleColor:"#888888",drawingLineName:"curve",interval:30,minFPSNumber:10,autoFPS:!0,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,parentTouch:!0,cdn:"",polylineSpace:10,dirMarkers:!1,domShapes:[],containerShapes:["tablePlus"],textFlip:!0,textRotate:!0,unavailableKeys:[],diagramOptions:{},svgPathStroke:!0,reconnetTimes:10},M2=["color","hoverColor","activeColor","disabledColor","background","activeBackground","hoverBackground","disabledBackground","anchorColor","hoverAnchorColor","anchorBackground","animateColor","textColor","ruleColor","ruleLineColor","gridColor","lineColor","penBackground","dockPenColor"],L2={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"}}},gn={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"){var a;const t=":";return(a=this[e])==null?void 0:a.reduce((s,n)=>{const[r,o]=n.split(t);return s[r]=o,s},{})},findStyleSheet(e){const t=document.styleSheets;for(let i=0;i<t.length;i++){const a=t[i];if(a.ownerNode&&a.ownerNode.id===e)return a}return null},updateCssRule(e,t){const a=this.getTheme(t),s=this.findStyleSheet(this.style_prefix+e);if(!s)return;let n=!1;for(let r=0;r<s.cssRules.length;r++)if(s.cssRules[r].selectorText===this.cssRuleSelector){n=!0;break}if(n)for(let r=0;r<s.cssRules.length;r++){const o=s.cssRules[r];if(o.selectorText===this.cssRuleSelector)if(s.insertRule){s.deleteRule(r);const l=`${this.cssRuleSelector} { ${a.join(";")} }`;s.insertRule(l,r)}else s.addRule&&(o.style.cssText=a.join(";"))}else if(s.insertRule){const r=`${this.cssRuleSelector} { ${a.join(";")} }`;s.insertRule(r,s.cssRules.length)}else if(s.addRule){const r=s.cssRules.find(o=>o.selectorText===this.cssRuleSelector);if(r){const o=a.join(";");r.style.cssText+=`; ${o}`}else s.addRule(this.cssRuleSelector,a.join(";"))}}};var _t;(function(e){e[e.Add=0]="Add",e[e.Update=1]="Update",e[e.Delete=2]="Delete",e[e.Replace=3]="Replace"})(_t||(_t={}));const O2=()=>({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:{...D2},theme:{...L2},emitter:B2(),bindDatas:{},bind:{},pensNetwork:{},cacheDatas:[],messageEvents:{},templatePens:{},globalTriggers:{}}),N2=(e="default")=>(wt[e]||(wt[e]=O2(),wt[e].id=e),wt[e]),z2=(e,t)=>{const i=e.data.template===t;if(i)for(const a of e.data.pens)a.canvasLayer,zt.CanvasTemplate;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()},xc={en:{\u786E\u5B9A:"OK",\u53D6\u6D88:"Cancel","\u786E\u8BA4\u6267\u884C\u64CD\u4F5C\u5417\uFF1F":"Confirm this action?",\u8BF7\u8F93\u5165:"Enter text",\u65E0:"None","\u8BF7\u6309\u4F4F\u6ED1\u5757\uFF0C\u62D6\u52A8\u5230\u6700\u53F3\u8FB9\u5B8C\u6210\u9A8C\u8BC1":"Hold and drag the slider to the right",\u9A8C\u8BC1\u6210\u529F:"Verified",\u641C\u7D22:"Search",\u6682\u65E0\u6570\u636E:"No data",\u8BF7\u9009\u62E9:"Please select",\u53EF\u62D6\u62FD\u8868\u683C:"Draggable table",SQL\u547D\u4EE4:"SQL Command",\u5171:"Total",\u6761\u6570\u636E:"records",\u6BCF\u9875:"Per page",\u6761:"items",\u6D4B\u8BD5:"Test",\u5F00\u59CB\u65E5\u671F:"Start date",\u7ED3\u675F\u65E5\u671F:"End date",\u5F00\u59CB\u5468:"Start week",\u7ED3\u675F\u5468:"End week",\u5F00\u59CB\u6708\u4EFD:"Start month",\u7ED3\u675F\u6708\u4EFD:"End month",\u5F00\u59CB\u5E74\u4EFD:"Start year",\u7ED3\u675F\u5E74\u4EFD:"End year",\u5F00\u59CB\u65F6\u95F4:"Start time",\u7ED3\u675F\u65F6\u95F4:"End time",\u65F6\u95F4:"Time",\u661F\u671F:"Week ",\u65E5:"Sun",\u4E00:"Mon",\u4E8C:"Tue",\u4E09:"Wed",\u56DB:"Thu",\u4E94:"Fri",\u516D:"Sat"}};let _c="zh-CN";function Ce(e){var t,i;return _c==="zh-CN"?e:(i=(t=xc[_c])==null?void 0:t[e])!=null?i:e}function W2(e){_c=e}function H2(e,t){var i;xc[e]={...(i=xc[e])!=null?i:{},...t}}function Ri(e){return typeof e=="number"&&!isNaN(e)}function to(e){return e==null||typeof e=="string"&&e.trim()===""||!e&&e!==0&&e!=="0"&&e!==!1}function Ii(e){const{paddingTop:t,paddingBottom:i,paddingLeft:a,paddingRight:s,worldRect:n,canvas:r,text:o}=e.calculative;let{textLeft:l,textTop:u,textWidth:c,textHeight:d}=e.calculative,f=a,g=t;const m=n.width-a-s,y=n.height-t-i;c&&c<1&&(c*=n.width),d&&d<1&&(d*=n.height),c<e.calculative.fontSize&&(c=e.calculative.fontSize),f+=(l||0)+n.x,g+=(u||0)+n.y;const p=e.textAlign||r.store.options.textAlign,x=e.textBaseline||r.store.options.textBaseline;switch(p){case"center":f+=(m-(c||m))/2;break;case"right":f+=m-(c||m);break}switch(x){case"middle":g+=(y-(d||y))/2;break;case"bottom":g+=y-(d||y);break}const _={x:f,y:g,width:c||m,height:d||y};re(_),e.calculative.worldTextRect=_,Ws(e),e.calculative.textDrawRect=void 0}function jc(e,t){const i=t.calculative;if(to(i.text))return;i.textLines||Ws(t);const{worldTextRect:a,textLines:s,fontSize:n,lineHeight:r,canvas:o}=i;if(!s)return;const l=n*r,u=s.length*l;t.calculative.fontsChecked!==!1&&(document.fonts.check(e.font)?t.calculative.fontsChecked=!1:t.calculative.fontsChecked=!0);const c=U2(e,t);let d=a.x+(a.width-c)/2,f=a.y+(a.height-u)/2;const{options:g}=o.store;switch(t.textAlign||g.textAlign){case"left":d=a.x;break;case"right":d=a.x+a.width-c;break}switch(t.textBaseline||g.textBaseline){case"top":f=a.y;break;case"bottom":f=a.ey-u;break}t.calculative.textDrawRect={x:d,y:f,width:c,height:u},re(t.calculative.textDrawRect)}function Ws(e,t=e.calculative.text){const i=e.calculative;if(to(t)){i.textLines=void 0;return}let a=typeof t=="string"?t:t.toString();const{whiteSpace:s,ellipsis:n}=e,{keepDecimal:r}=i;if(r!=null&&a.trim()!==""){const f=Number(a);isNaN(f)||(a=f.toFixed(r))}let o=[];const l=i.fontSize*i.lineHeight,u=i.worldTextRect.height,c=Math.floor(u/l),d=c>1?c:1;switch(s){case"nowrap":if(n!==!1){const m=Gf([...a],e);m[0]&&(o.push(m[0]),m.length>1&&Jl(o))}else o.push(a);break;case"pre-line":o=a.split(/[\n]/g),n!==!1&&o.length>d&&(o=o.slice(0,d),Jl(o));break;case"break-all":default:const f=a.split(/[\n]/g);let g=0;t:for(const m of f){const y=s==="break-all"?m.split(""):Dg(m);let p=Gf(y,e);if(p.length===0&&(p=[""]),n!=!1)for(const x of p)if(g++,g>d){Jl(o);break t}else o.push(x);else o.push(...p)}break}return i.textLines=o,o}function Dg(e=""){const t=[];let i="";for(let a=0;a<e.length;++a){const s=e.charCodeAt(a);s<33||s>126?(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:o,lineHeight:l}=t.calculative;a.save();const u=[];let c=e[0]||"";for(let d=1;d<e.length;++d){const f=e[d]||"",g=c+f;let m=0;if(i.store.options.measureTextWidth)a.font=Be({fontStyle:s,fontWeight:n,fontFamily:o||i.store.options.fontFamily,fontSize:r,lineHeight:l}),m=a.measureText(g).width;else{const p=g.match(/[^\x00-\xff]/g)||"",x=p.length*r,_=g.match(/\s/g)||"",b=_.length*r*.3,C=(g.length-p.length-_.length)*r*.6;m=x+b+C}const y=t.calculative.worldTextRect.width;m<=y+.1?c+=f:(c.length&&u.push(c),c=f)}return c.length&&u.push(c),a.restore(),u}function U2(e,t){let i=0;return t.calculative.textLineWidths=[],t.calculative.textLines&&t.calculative.textLines.forEach(a=>{let s;t.calculative.textType?s=V2(a,t)+a.length*t.calculative.letterSpacing:s=e.measureText(a).width+a.length*t.calculative.letterSpacing,t.calculative.textLineWidths.push(s),i<s&&(i=s)}),i}function V2(e,t){const i=t.calculative.fontSize,a=e.match(/[^\x00-\xff]/g)||"",s=a.length*i,n=e.match(/\s/g)||"",r=n.length*i*(t.CSmultiple||.5),o=(e.length-a.length-n.length)*i*(t.CEmultiple||.54);return s+r+o}function Jl(e){e[e.length-1]=e[e.length-1].slice(0,-3)+"..."}function $2(e){let t=e.text.split(`
  2. `);const i=e.calculative.canvas,a=i.offscreen.getContext("2d"),{fontStyle:s,fontWeight:n,fontSize:r,fontFamily:o,lineHeight:l}=e.calculative;let u=0,c=0;a.save();for(let f=0;f<t.length;f++){if(i.store.options.measureTextWidth)a.font=Be({fontStyle:s,fontWeight:n,fontFamily:o||i.store.options.fontFamily,fontSize:r,lineHeight:l}),c=a.measureText(t[f]).width+t[f].length*e.calculative.letterSpacing;else{const g=t[f].match(/[^\x00-\xff]/g)||"",m=g.length*r,y=t[f].match(/\s/g)||"",p=y.length*r*.3,x=(t[f].length-g.length-y.length)*r*.6;c=m+p+x+t[f].length*e.calculative.letterSpacing}c>u&&(u=c)}a.restore();let d=t.length*r*l;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-(d-e.height):e.y=e.y-(d-e.height)/2),e.height=d+5,e.width=u+5,e.calculative.canvas.updatePenRect(e),e.calculative.canvas.calcActiveRect()}function ot(e,t=!1){if(Array.isArray(e)){const i=[];return e.forEach(a=>{i.push(ot(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 HTMLCanvasElement||e[a]instanceof HTMLMediaElement)){{if(a==="calculative"&&!t)continue;if(a==="singleton"){t?i[a]={}:i[a]=e[a];continue}}i[a]=ot(e[a],t)}return i}return e}function Ec(e,t,i){if(Array.isArray(e)){const a=[];return e.forEach(s=>{a.push(Ec(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]=Ec(e[a],t,i);return e}return e}const Xe={};function Mg(e,t,i){if(!Xe[t.fromArrow])return;const a=ce(t),{x:s,y:n}=a,r={x:s,y:n};if(r.step=(t.fromArrowSize||10)*i.data.scale,a.next)r.rotate=gi(a.next,a)+90;else{const l=t.calculative.worldAnchors[1];if(!l)return;l.prev?r.rotate=gi(l.prev,a)+90:r.rotate=gi(l,a)+90}e.save(),e.beginPath(),e.setLineDash([]);const o=t.fromArrowColor||t.calculative.color;o&&(e.strokeStyle=o),Xe[t.fromArrow](e,t,i,r),e.restore()}function Lg(e,t,i){if(!Xe[t.toArrow]||t.calculative.worldAnchors.length<2)return;e.save();const a=jt(t),{x:s,y:n}=a,r={x:s,y:n};if(r.step=(t.toArrowSize||10)*i.data.scale,a.prev)r.rotate=gi(a.prev,a)+90;else{const l=t.calculative.worldAnchors[t.calculative.worldAnchors.length-2];l.next?r.rotate=gi(l.next,a)+90:r.rotate=gi(l,a)+90}e.beginPath(),e.setLineDash([]);const o=t.toArrowColor||t.calculative.color;o&&(e.strokeStyle=o),Xe[t.toArrow](e,t,i,r),e.restore()}Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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()};Xe.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 Ac(e){const t=parseInt,i=Math.round;let a=e.length,s={};if(a>9){const[n,r,o,l]=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(o),s.a=l?parseFloat(l):-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,o,l,u,c,d=Math.round,f=typeof i=="string";return typeof e!="number"||e<-1||e>1||typeof t!="string"||t[0]!="r"&&t[0]!="#"||i&&!f||(c=t.length>9,c=f?i.length>9?!0:i=="c"?!c:!1:c,l=Ac(t),o=e<0,u=i&&i!="c"?Ac(i):o?{r:0,g:0,b:0,a:-1}:{r:255,g:255,b:255,a:-1},e=o?e*-1:e,o=1-e,!l||!u)?null:(a?(s=d(o*l.r+e*u.r),n=d(o*l.g+e*u.g),r=d(o*l.b+e*u.b)):(s=d((o*l.r**2+e*u.r**2)**.5),n=d((o*l.g**2+e*u.g**2)**.5),r=d((o*l.b**2+e*u.b**2)**.5)),f=l.a,u=u.a,l=f>=0||u>=0,f=l?f<0?u:u<0?f:f*o+u*e:0,c?"rgb"+(l?"a(":"(")+s+","+n+","+r+(l?","+d(f*1e3)/1e3:"")+")":"#"+(4294967296+s*16777216+n*65536+r*256+(l?d(f*255):0)).toString(16).slice(1,l?void 0:-2))}globalThis.pSBC=ke;function eo(e,t){const i=Ac(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 bs(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<r||a==="]"&&e===r:!1}function xs(e,t){if(typeof t!="string"){console.warn("collection must be string");return}const[i,a]=[t[0],t[t.length-1]];if(i!=="["||a!=="]"){console.warn('collection must start with "[" and end with "]"');return}const s=t.substring(1,t.length-1).split(",");for(const n of s)if(n.includes("..")){const[r,o]=n.split(".."),[l,u]=[+r,+o];if(l>=u){console.warn("startNum must less than endNum");return}if(e>=l&&e<=u)return!0}else if(e==n)return!0;return!1}function Og(e,t,i){const a=1-e;return 3*a*a*e*t+3*a*e*e*i+e*e*e}function j2(e){const t=e.match(/^-?\d*\.?\d*/);if(e=t?t[0]:"",e.includes("-")&&e.indexOf("-")!==0&&(e=e.replace(/-/g,""),e&&(e="-"+e)),(e.match(/\./g)||[]).length>1){const a=e.split(".");e=a[0]+"."+a.slice(1).join("")}return e}function Tt(){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=Ql(e[1])?e[0]:e[1],s=Ql(e[2])?e[0]:e[2],i=Ql(e[3])?a:e[3]),[t,a,s,i]};function Ql(e){return e==null}async function q2(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 Y2(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 K2(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 Ps(e){let t=e||window.location.search.split("?")[1];const i=new URLSearchParams(t);return Object.fromEntries(i.entries())}function io(e){let t;const i=new RegExp("(^| )"+e+"=([^;]*)(;|$)");return(t=document.cookie.match(i))?decodeURIComponent(t[2]):""}var ao;(function(e){e[e.None=0]="None",e[e.LocalStorage=1]="LocalStorage",e[e.Cookie=2]="Cookie"})(ao||(ao={}));const X2=location.host.indexOf("le5le.com")!==-1;function vn(){var i,a;let e="";const t=(i=globalThis.le5leTokenName)!=null?i:"token";switch(globalThis.le5leTokenType){case ao.LocalStorage:e=localStorage.getItem(t);break;case ao.Cookie:e=io(t);break;default:e=X2?io(t):localStorage.getItem(t)}return((a=globalThis.TokenPrefix)!=null?a:"Bearer ")+(globalThis.le5leTokenD?Ng(e):e)}function Ng(e){if(!e)return e;const t=e.split("");for(let i=0;i<Math.min(10,t.length);i++){const a=t[i],s=i+1;if(new RegExp("[0-9]","").test(a)){let r=parseInt(a,10)-s;for(;r<0;)r+=10;t[i]=r.toString()}else if(new RegExp("[A-Z]","").test(a)){let r=a.charCodeAt(0)-65-s;for(;r<0;)r+=26;t[i]=String.fromCharCode(r+65)}else if(new RegExp("[a-z]","").test(a)){let r=a.charCodeAt(0)-97-s;for(;r<0;)r+=26;t[i]=String.fromCharCode(r+97)}}return t.join("")}async function qc(e,t){var l,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=((l=Ps())==null?void 0:l.id)||s.includes("${id}");if(!n&&((u=Ps())==null?void 0:u.data)){s=`./projects/${t}`;const d=new URL(window.location);d.searchParams.set("data",t),history.pushState({},"",d)}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 o=await fetch(s,{headers:{Authorization:vn()},method:r,body:r==="GET"?void 0:JSON.stringify({id:t})});if(o.ok){let c=await o.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:o})}function Ne(e,t){if(t==null)return e;const i=t.split(".");for(;i.length&&(e=e[i.shift()]););return e}function so(e,t,i){t!=null&&t.split(".").reduce((a,s,n)=>a[s]=t.split(".").length===++n?i:a[s]||{},e)}function zg(){}function Yc(e){return!!(e!=null&&e.allowScript)}function Te(e,...t){return Yc(e)?new Function(...t):zg}function Rr(e,...t){if(!Yc(e))return async()=>{};const i=Object.getPrototypeOf(async function(){}).constructor;return new i(...t)}function G2(e,t){return Yc(e)?Te(e,`return (${t})`)():zg}function no(e,t,i){const a=["\u5929","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"];let s=new Date;t&&(s=new Date(t));const n=s.getFullYear(),r=s.getMonth()+1,o=s.getDate(),l=s.getDay(),u=s.getHours(),c=s.getMinutes(),d=s.getSeconds();if(!e)return`${n}:${r}:${o} ${u}:${c}:${d} \u661F\u671F${a[l]}`;let f=Te(i,"year","month","day","week","hours","minutes","seconds",`return ${e}`);const g=f(n,r,o,a[l],u,c,d);return f=null,g}const tc=new WeakMap;function Wg(e,t,i){let a=tc.get(e);return a?clearTimeout(a.timer):(a={},tc.set(e,a)),new Promise((s,n)=>{a.timer=setTimeout(async()=>{s(await e(i)),tc.delete(e)},t)})}class Kc{static debounce(t,i,a=300){const s=Symbol(`${t.constructor.name}.${i}`);this.instances.has(t)||this.instances.set(t,{});const n=this.instances.get(t);return(...r)=>{n[s]&&clearTimeout(n[s]),n[s]=setTimeout(()=>{t[i](...r),delete n[s]},a)}}}H(Kc,"instances",new WeakMap);const Zf="line",ro="repeat";function Z2(e,t){if(!e||!t)return!1;let i=We(e);for(;i;){if(i.id===t.id)return!0;i=We(i)}return!1}function We(e,t){if(!e||!e.parentId||!e.calculative)return;const a=e.calculative.canvas.store.pens[e.parentId];return t&&We(a,t)||a}function Le(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(...Le(s,t)))}),i}function Xc(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(...Xc(s,t)))}),i}function J2(e,t){const{worldRect:i,gradientFromColor:a,gradientToColor:s,gradientAngle:n}=t.calculative;return Ug(e,i,a,s,n)}function Q2(e,t){const{worldRect:i,gradientFromColor:a,gradientToColor:s,gradientRadius:n}=t.calculative;if(!a||!s)return;const{width:r,height:o,center:l}=i,{x:u,y:c}=l;let d=r;d<o&&(d=o),d*=.5;const f=e.createRadialGradient(u,c,d*(n||0),u,c,d);return f.addColorStop(0,a),f.addColorStop(1,s),f}function t6(e,t,i,a,s){let n=0;n=Math.PI/2-Math.atan2(a-t,i-e);const r=(e+i)/2,o=(t+a)/2,l=r+s*Math.sin(90*Math.PI/180-n),u=o+s*-Math.cos(90*Math.PI/180-n),c=r+s*Math.sin(270*Math.PI/180-n),d=o+s*-Math.cos(270*Math.PI/180-n);return[l,u,c,d]}function e6(e,t,i){const{worldRect:a,gradientRadius:s}=t.calculative;let n=i||t.calculative.gradientColors;if(t.calculative.checked&&(n=t.calculative.onGradientColors),!n)return;const{width:r,height:o,center:l}=a,{x:u,y:c}=l;let d=r;d<o&&(d=o),d*=.5;const{colors:f}=na(n),g=e.createRadialGradient(u,c,d*(s||0),u,c,d);return f.forEach(m=>{g.addColorStop(m.i,m.color)}),g}function Jf(e,t,i){const{x:a,y:s,ex:n,width:r,height:o,center:l}=t.calculative.worldRect;let u=[{x:n,y:s+o/2},{x:a,y:s+o/2}],c=i||t.calculative.gradientColors;t.calculative.checked&&(c=t.calculative.onGradientColors);const{angle:d,colors:f}=na(c);let g=bo(d,r,o);return u.forEach(m=>{Zt(m,d,l)}),Dn(e,u,f,g)}function i6(e,t){const{worldRect:i,textGradientColors:a}=t.calculative;if(!a)return;const{width:s,height:n,center:r}=i,{x:o,y:l}=r;let u=s;u<n&&(u=n),u*=.5;const{colors:c}=na(a),d=e.createRadialGradient(o,l,0,o,l,u);return c.forEach(f=>{d.addColorStop(f.i,f.color)}),d}function a6(e,t){!t.calculative.textDrawRect&&jc(e,t),te(t.calculative.textDrawRect);const{x:i,y:a,ex:s,width:n,height:r,center:o}=t.calculative.textDrawRect;let l=[{x:s,y:a+r/2},{x:i,y:a+r/2}];const{angle:u,colors:c}=na(t.calculative.textGradientColors);let d=bo(u,n,r);return l.forEach(f=>{Zt(f,u,o)}),Dn(e,l,c,d)}function s6(e,t){const{worldIconRect:i,iconGradientColors:a}=t.calculative;if(!a||!i)return;const{x:s,y:n,ex:r,width:o,height:l,center:u}=i;let c=[{x:r,y:n+l/2},{x:s,y:n+l/2}];const{angle:d,colors:f}=na(a);let g=bo(d,o,l);return c.forEach(m=>{Zt(m,d,u)}),Dn(e,c,f,g)}function n6(e,t){const{worldIconRect:i,iconGradientColors:a,iconGradientRadius:s}=t.calculative;if(!a||!i)return;const{width:n,height:r,center:o}=i,{x:l,y:u}=o;let c=n;c<r&&(c=r),c*=.5;const{colors:d}=na(a),f=e.createRadialGradient(l,u,c*(s||0),l,u,c);return d.forEach(g=>{f.addColorStop(g.i,g.color)}),f}function bo(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 na(e){if(typeof e!="string"||!e.startsWith("linear-gradient"))return{angle:0,colors:[]};const t=e.indexOf("("),i=e.lastIndexOf(")");if(t===-1||i===-1||i<=t)return{angle:0,colors:[]};const a=e.slice(t+1,i).trim(),s=r6(a);if(s.length===0)return{angle:0,colors:[]};let n=0,r=0;const o=s[0].trim();o.endsWith("deg")?(n=parseFloat(o),r=1):o.startsWith("to ")&&(n=l6(o),r=1);const l=[];for(let c=r;c<s.length;c++){const d=o6(s[c].trim());d&&l.push(d)}if(l.length===0)return{angle:n,colors:[]};c6(l);const u=l.map(c=>({color:c.color,i:c.offset/100}));return{angle:n,colors:u}}function r6(e){const t=[];let i="",a=0;for(let s=0;s<e.length;s++){const n=e[s];n==="("?(a++,i+=n):n===")"?(a--,i+=n):n===","&&a===0?(t.push(i),i=""):i+=n}return i.trim()&&t.push(i),t}function o6(e){if(!e)return null;const t=e.match(/^(.+?)\s+(\d+(?:\.\d+)?%)\s*$/);return t?{color:Qf(t[1].trim()),offset:parseFloat(t[2])}:{color:Qf(e)}}function Qf(e){return/^rgba?\s*\(/.test(e)?u6(e):e}function l6(e){var i;return(i={"to top":90,"to right":180,"to bottom":270,"to left":0,"to top right":135,"to right top":135,"to bottom right":225,"to right bottom":225,"to bottom left":315,"to left bottom":315,"to top left":45,"to left top":45}[e])!=null?i:0}function c6(e){if(e.length===0)return;e[0].offset==null&&(e[0].offset=0),e[e.length-1].offset==null&&(e[e.length-1].offset=100);let t=0;for(;t<e.length;)if(e[t].offset==null){let i=t-1,a=t+1;for(;a<e.length&&e[a].offset==null;)a++;const s=e[i].offset,n=e[a].offset,r=a-i;for(let o=1;o<r;o++)e[i+o].offset=s+(n-s)*(o/r);t=a}else t++}function u6(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 h6(e,t){const{x:i,y:a,ex:s,width:n,height:r,center:o}=t.calculative.worldRect;let l=[{x:s,y:a+r/2},{x:i,y:a+r/2}];const{angle:u,colors:c}=na(t.calculative.lineGradientColors);let d=bo(u,n,r);return l.forEach(f=>{Zt(f,u,o)}),Dn(e,l,c,d)}function Dn(e,t,i,a){let s=t6(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 pa(e,t,i){let a=[];t.calculative.gradientColorStop?a=t.calculative.gradientColorStop:(a=na(t.calculative.lineGradientColors).colors,t.calculative.gradientColorStop=a),e.strokeStyle=Dn(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 Hg(e,t){const i=t.calculative.worldAnchors;let a=t.calculative.lineWidth*(t.calculative.gradientSmooth||t.calculative.lineSmooth||0);for(let s=0;s<i.length-1;s++)if((t.lineName==="curve"||t.lineName==="mind")&&i[s].curvePoints){if(s>0){let o=i[s-1].curvePoints;o?Sr(e,t,a,o[o.length-1],i[s],i[s].curvePoints[0]):Sr(e,t,a,i[s-1],i[s],i[s].curvePoints[0]);let l=ta(a,i[s],i[s].curvePoints[0]);pa(e,t,[l,i[s].curvePoints[1]])}else pa(e,t,[i[s],i[s].curvePoints[0]]),pa(e,t,[i[s].curvePoints[0],i[s].curvePoints[1]]);let n=i[s].curvePoints.length-1;for(let o=1;o<n;o++)pa(e,t,[i[s].curvePoints[o],i[s].curvePoints[o+1]]);let r=ta(a,i[s+1],i[s].curvePoints[n]);pa(e,t,[i[s].curvePoints[n],r])}else{let n=i[s],r=i[s+1];if(s>0&&s<i.length-1){let l=i[s-1].curvePoints;l?Sr(e,t,a,l[l.length-1],i[s],i[s+1]):Sr(e,t,a,i[s-1],i[s],i[s+1])}s>0&&s<i.length-1&&(n=ta(a,i[s],i[s+1])),s<i.length-2&&(r=ta(a,i[s+1],i[s]));let o=!1;if(s===0&&t.fromLineCap&&t.fromLineCap!=="butt"&&(e.save(),o=!0,e.lineCap=t.fromLineCap),s!==0&&s===i.length-2&&t.toLineCap&&t.toLineCap!=="butt"&&(e.save(),o=!0,e.lineCap=t.toLineCap),pa(e,t,[n,r]),o&&e.restore(),i.length===2&&s===0){e.save(),o=!0,e.lineCap=t.toLineCap;let l=.1,u=.1;n.x-r.x===0?u=0:l=(n.y-r.y)/(n.x-r.x)*.1,pa(e,t,[{x:r.x-u,y:r.y-l},r]),e.restore()}}}function ta(e,t,i){let a=Math.sqrt((i.x-t.x)*(i.x-t.x)+(i.y-t.y)*(i.y-t.y));return a===0?{x:t.x,y:t.y}:e<a?{x:t.x+(i.x-t.x)*e/a,y:t.y+(i.y-t.y)*e/a}:{x:t.x+(i.x-t.x)/a/2,y:t.y+(i.y-t.y)/a/2}}function Sr(e,t,i,a,s,n){let r=ta(i,s,a),o=ta(i,s,n),l={x:s.x,y:s.y},u=f6(t.calculative.canvas.store.data.smoothNum||20,r,l,o);for(let c=0;c<u.length-1;c++)pa(e,t,[{x:u[c].x,y:u[c].y},{x:u[c+1].x,y:u[c+1].y}])}function td(e,t,i,a){let s=ta(t,i,a),n={x:i.x,y:i.y};e.quadraticCurveTo(n.x,n.y,s.x,s.y)}function Gc(e){const t=e.calculative.worldAnchors;let i=e.calculative.lineWidth*(e.calculative.gradientSmooth||e.calculative.lineSmooth||0);const a=new Path2D;for(let s=0;s<t.length-1;s++){t[s];let n=t[s+1];if(s==0&&a.moveTo(t[s].x,t[s].y),s>0&&s<t.length-1){let r=t[s-1].curvePoints;td(a,i,t[s],t[s+1])}s>0&&s<t.length-1&&ta(i,t[s],t[s+1]),s<t.length-2&&(n=ta(i,t[s+1],t[s])),a.lineTo(n.x,n.y)}return a}function f6(e=100,t,i,a,s){let n=null;const r=[];!a&&!s?n=d6:a&&!s?n=g6:a&&s&&(n=v6);for(let o=0;o<e;o++)r.push(n(o/e,t,i,a,s));return s?r.push(s):a&&r.push(a),r}function d6(e,t,i){const{x:a,y:s}=t,{x:n,y:r}=i;let o=a+(n-a)*e,l=s+(r-s)*e;return{x:o,y:l}}function g6(e,t,i,a){const{x:s,y:n}=t,{x:r,y:o}=i,{x:l,y:u}=a;let c=(1-e)*(1-e)*s+2*e*(1-e)*r+e*e*l,d=(1-e)*(1-e)*n+2*e*(1-e)*o+e*e*u;return{x:c,y:d}}function v6(e,t,i,a,s){const{x:n,y:r}=t,{x:o,y:l}=s,{x:u,y:c}=i,{x:d,y:f}=a;let g=n*(1-e)*(1-e)*(1-e)+3*u*e*(1-e)*(1-e)+3*d*e*e*(1-e)+o*e*e*e,m=r*(1-e)*(1-e)*(1-e)+3*c*e*(1-e)*(1-e)+3*f*e*e*(1-e)+l*e*e*e;return{x:g,y:m}}function m6(e,t){const{worldRect:i,lineGradientFromColor:a,lineGradientToColor:s,lineGradientAngle:n}=t.calculative;return Ug(e,i,a,s,n)}function Ug(e,t,i,a,s){if(!i||!a)return;const{x:n,y:r,center:o,ex:l,ey:u}=t,c={x:n,y:o.y},d={x:l,y:o.y};s%90===0&&s%180?(c.x=o.x,d.x=o.x,s%270?(c.y=r,d.y=u):(c.y=u,d.y=r)):s&&(Zt(c,s,t.center),Zt(d,s,t.center));const f=e.createLinearGradient(c.x,c.y,d.x,d.y);return f.addColorStop(0,i),f.addColorStop(1,a),f}function y6(e){const{worldIconRect:t,iconWidth:i,iconHeight:a,imgNaturalWidth:s,imgNaturalHeight:n,worldRect:r}=e.calculative;if(!t)return{x:r.x,y:r.y,width:r.width||s||e.calculative.img.naturalWidth,height:r.height||n||e.calculative.img.naturalHeight};let{x:o,y:l,width:u,height:c}=t;if(i&&(u=i),a&&(c=a),s&&n&&e.imageRatio){const d=t.width/s,f=t.height/n,g=Math.min(d,f),m=s/n;i?c=i/m:a?u=a*m:(u=g*s,c=g*n)}switch(o+=(t.width-u)/2,l+=(t.height-c)/2,e.iconAlign){case"top":l=t.y;break;case"bottom":l=t.ey-c;break;case"left":o=t.x;break;case"right":o=t.ex-u;break;case"left-top":o=t.x,l=t.y;break;case"right-top":o=t.ex-u,l=t.y;break;case"left-bottom":o=t.x,l=t.ey-c;break;case"right-bottom":o=t.ex-u,l=t.ey-c;break}return{x:o,y:l,width:u,height:c}}function Bs(e,t){const{x:i,y:a,width:s,height:n}=y6(t),{worldIconRect:r,iconRotate:o}=t.calculative;let{img:l}=t.calculative;if(e.getSerializedSvg&&(l==null?void 0:l.toDataURL)){const u=new Image;u.src=l.toDataURL("image/png"),l=u}if(e.filter=t.filter,o){const{x:u,y:c}=r.center;e.translate(u,c),e.rotate(o*Math.PI/180),e.translate(-u,-c)}if(t.imageRadius){e.save();let u=t.calculative.imageRadius||0,c=u;const{x:d,y:f,width:g,height:m,ex:y,ey:p}=t.calculative.worldRect;u<1&&(u=g*u,c=m*c);let x=u<c?u:c;g<2*x&&(x=g/2),m<2*x&&(x=m/2),e.beginPath(),e.moveTo(d+x,f),e.arcTo(y,f,y,p,x),e.arcTo(y,p,d,p,x),e.arcTo(d,p,d,f,x),e.arcTo(d,f,y,f,x),e.clip(),e.drawImage(l,i,a,s,n),e.restore()}else{let u=a,c=0;if(t.thumbImg){let d=l.naturalWidth,f=l.naturalHeight;c=(n/s*d-f)/2,n-2*c<0&&(c=(n-f/d*s)/2),u=a+c}e.drawImage(l,i,u,s,n-2*c)}}function zi(e,t){const{textColor:i,color:a}=e.calculative,{styles:s}=t;return i||a||s.textColor||s.color}function Vg(e,t){const{fontStyle:i,fontWeight:a,fontSize:s,fontFamily:n,lineHeight:r,text:o,hiddenText:l,canvas:u,textHasShadow:c,textBackground:d,textType:f}=t.calculative;if(t.input&&to(t.text)&&t.calculative.canvas.inputDiv.dataset.penId!==t.id&&!t.onShowInput){e.save(),e.font=Be({fontStyle:i,fontWeight:a,fontFamily:n,fontSize:s,lineHeight:r}),e.textBaseline="top",e.fillStyle=t.placeholderColor||"#c0c0c0";const S=e.measureText(t.placeholder||Ce("\u8BF7\u8F93\u5165")).width,B=t.calculative.worldTextRect;let D=0;const V=s*r;let G=(B.height-V)/2;t.textAlign==="center"?D=(B.width-S)/2:t.textAlign==="right"&&(D=B.width-S),t.textBaseline==="top"?G=0:t.textBaseline==="bottom"&&(G=B.height-V),e.fillText(t.placeholder||Ce("\u8BF7\u8F93\u5165"),B.x+D,B.y+G+ed(e,t.placeholder||Ce("\u8BF7\u8F93\u5165"),V)),e.restore()}if(to(o)||l||t.hiddenText)return;const g=u.store;e.save(),c||(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0);let m;t.calculative.disabled?m=t.disabledTextColor||t.disabledColor||ke(.4,zi(t,g)):t.calculative.hover?m=t.hoverTextColor||t.hoverColor||g.styles.hoverColor:t.calculative.active&&(m=t.activeTextColor||t.activeColor||g.styles.activeColor);let y;f===Oi.Linear?y=a6(e,t):f===Oi.Radial&&(y=i6(e,t)),e.fillStyle=m||y||zi(t,g),e.font=Be({fontStyle:i,fontWeight:a,fontFamily:n||g.options.fontFamily,fontSize:s,lineHeight:r}),(!t.calculative.textDrawRect||t.calculative.fontsChecked)&&jc(e,t);const{x:p,y:x,width:_,height:b}=t.calculative.textDrawRect;d&&(e.save(),e.fillStyle=d,e.fillRect(p,x,_,b),e.restore());const C=t.textAlign||g.options.textAlign,P=s*r;t.calculative.textLines&&t.calculative.textLines.forEach((S,B)=>{const D=t.calculative.textLineWidths[B];let V=0;C==="center"?V=(_-D)/2:C==="right"&&(V=_-D);const G=x+B*P+ed(e,S,P);t.letterSpacing?p6(e,S&&Ce(S),p+V,G,t.calculative.letterSpacing):e.fillText(S&&Ce(S),p+V,G);const{textDecorationColor:F,textDecorationDash:R,textDecoration:T}=t;T&&w6(e,{x:p+V,y:G,width:D},{textDecorationColor:F,textDecorationDash:R,fontSize:s});const{textStrickoutColor:L,textStrickoutDash:$,textStrickout:Z}=t;Z&&b6(e,{x:p+V,y:G,width:D},{textStrickoutColor:L,textStrickoutDash:$,fontSize:s})}),e.restore()}function ed(e,t,i){const a=e.measureText(t),{actualBoundingBoxAscent:s,actualBoundingBoxDescent:n}=a;return s||n?i/2+(s-n)/2:i*.55}function p6(e,t,i,a,s=0){if(s===0){e.fillText(t,i,a);return}let n=0;for(let r=0;r<t.length;r++)e.fillText(t[r],i+n,a),n+=e.measureText(t[r]).width+s}function w6(e,t,i){const{textDecorationColor:a,textDecorationDash:s,fontSize:n}=i;let{x:r,y:o,width:l}=t;switch(e.textBaseline){case"top":o+=n;break;case"middle":o+=n/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(r,o),e.setLineDash(s||[]),e.lineTo(r+l,o),e.stroke(),e.restore()}function b6(e,t,i){const{textStrickoutColor:a,textStrickoutDash:s,fontSize:n}=i;let{x:r,y:o,width:l}=t;switch(e.textBaseline){case"top":o+=n/2;break;case"bottom":o-=n/2;break}e.save(),e.beginPath(),e.strokeStyle=a||e.fillStyle,e.lineWidth=1,e.moveTo(r,o),e.setLineDash(s||[]),e.lineTo(r+l,o),e.stroke(),e.restore()}function $g(e,t,i){if(i==null)return;const{fontStyle:a,fontWeight:s,fontSize:n,fontFamily:r,lineHeight:o,canvas:l}=t.calculative,u=l.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||zi(t,u),e.font=Be({fontStyle:a,fontWeight:s,fontFamily:r||u.options.fontFamily,fontSize:n,lineHeight:o});const d=e.measureText(i).width;let f,g;for(const m of t.calculative.worldAnchors){if(!g){g=m;continue}const y=wo(g,m),p=Math.floor(y/d);f="";for(let _=0;_<p;_++)f+=i;const x=gi(g,m)-270;if(e.save(),x%360!==0){const{x:_,y:b}=g;e.translate(_,b);let C=x*Math.PI/180;e.rotate(C),e.translate(-_,-b)}e.fillText(f&&Ce(f),g.x,g.y+o/2),e.restore(),g=m}e.restore()}function jg(e,t){const i=t.calculative.canvas.store,a=t.calculative.worldIconRect;if(!a)return;e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.textAlign="center",e.textBaseline="middle";let s=a.x+a.width/2,n=a.y+a.height/2;switch(t.iconAlign){case"top":n=a.y,e.textBaseline="top";break;case"bottom":n=a.ey,e.textBaseline="bottom";break;case"left":s=a.x,e.textAlign="left";break;case"right":s=a.ex,e.textAlign="right";break;case"left-top":s=a.x,n=a.y,e.textAlign="left",e.textBaseline="top";break;case"right-top":s=a.ex,n=a.y,e.textAlign="right",e.textBaseline="top";break;case"left-bottom":s=a.x,n=a.ey,e.textAlign="left",e.textBaseline="bottom";break;case"right-bottom":s=a.ex,n=a.ey,e.textAlign="right",e.textBaseline="bottom";break}const r=t.calculative.iconWeight;let o;const l=t.calculative.iconFamily;t.calculative.iconSize>0?o=t.calculative.iconSize:a.width>a.height?o=a.height:o=a.width,e.font=Be({fontSize:o,fontWeight:r,fontFamily:l});let u;t.calculative.iconType===Oi.Linear?u=s6(e,t):t.calculative.iconType===Oi.Radial&&(u=n6(e,t)),e.fillStyle=u||t.calculative.iconColor||zi(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 qg(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:o}=t.calculative.worldRect;e.save(),e.beginPath(),t.id===a?(e.moveTo(s+r-20*i,n+o/2+2*i),e.lineTo(s+r-14*i,n+o/2-4*i),e.lineTo(s+r-8*i,n+o/2+2*i)):(e.moveTo(s+r-20*i,n+o/2-4*i),e.lineTo(s+r-14*i,n+o/2+2*i),e.lineTo(s+r-8*i,n+o/2-4*i)),e.stroke(),e.restore()}function Be({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 Ya(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 ia(e,t,i=!1){if(t.parentId&&t.rotateByRoot){let a=We(t,!0);if(a){const{x:s,y:n}=a.calculative.worldRect.pivot||a.calculative.worldRect.center;e.translate(s,n);let r=a.calculative.rotate*Math.PI/180;i||(a.calculative.flipX&&(r*=-1),a.calculative.flipY&&(r*=-1)),e.rotate(r),e.translate(-s,-n)}}else{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 Oa(e,t,i){var m;const a=t.calculative.canvas.store.options.debug,s=a===!0||typeof a=="object"&&!!a.renderTime,n=s?performance.now():0;e.save(),e.translate(.5,.5),e.beginPath(),j6(e,t);const r=t.calculative.canvas.store,o=t.textFlip||r.options.textFlip,l=t.textRotate||r.options.textRotate;(!o||!l)&&e.save(),Ya(e,t),(t.rotateByRoot||t.calculative.rotate&&t.name!==Zf)&&ia(e,t),(t.calculative.lineWidth>1||i)&&(e.lineWidth=t.calculative.lineWidth),z6(e,r,t);let u,c=!1,d;t.calculative.disabled?(d=t.disabledColor||r.styles.disabledColor||ke(.4,t.calculative.color||r.styles.color),u=t.disabledBackground||r.styles.disabledBackground||ke(.4,t.calculative.background||r.styles.penBackground)):t.mouseDownValid&&t.calculative.mouseDown?(d=t.mouseDownColor||ke(-.4,t.calculative.color||r.styles.color),u=t.mouseDownBackground||ke(-.4,t.calculative.background||r.styles.penBackground)):t.switch&&t.calculative.checked?t.calculative.bkType||(u=t.onBackground):t.calculative.hover?(d=t.hoverColor||r.styles.hoverColor,u=t.hoverBackground||r.styles.hoverBackground):t.calculative.active?(d=t.activeColor||r.styles.activeColor,u=t.activeBackground||r.styles.activeBackground):t.calculative.isDock&&(t.type===Ut.Line?d=r.styles.dockPenColor:u=eo(r.styles.dockPenColor,.2));const f=t.calculative.strokeImg;if(t.calculative.strokeImage&&f)e.strokeStyle=d||e.createPattern(f,ro);else{let y;t.calculative.strokeType?t.calculative.lineGradientColors?t.name===Zf?c=!0:t.calculative.lineGradient?y=t.calculative.lineGradient:(y=h6(e,t),t.calculative.lineGradient=y):y=m6(e,t):y=t.calculative.color||(t.type?r.data.lineColor:"")||r.styles.color,e.strokeStyle=d||y}const g=t.calculative.backgroundImg;if(t.calculative.backgroundImage&&g)e.fillStyle=u||e.createPattern(g,ro),u=!0;else{let y;const p=t.calculative.background||"";let x=t.calculative.bkType,_=t.calculative.gradientColors;x==null&&(typeof p=="string"&&p.startsWith("linear-gradient")?(_=_||p,x=Oi.Linear):!p&&_&&(x=Oi.Linear)),x===Oi.Linear?_?t.calculative.gradient?y=t.calculative.gradient:(y=Jf(e,t,_),t.calculative.gradient=y):y=J2(e,t):x===Oi.Radial?_?t.calculative.radialGradient?y=t.calculative.radialGradient:(y=e6(e,t,_),t.calculative.radialGradient=y):y=Q2(e,t):typeof p=="string"&&p.startsWith("linear-gradient")?t.calculative.gradient?y=t.calculative.gradient:(y=Jf(e,t,p),t.calculative.gradient=y):y=t.calculative.background||r.styles.penBackground,e.fillStyle=u||y,u=!!y}if(Yg(e,t),Kg(e,t),Ka(e,t),t.calculative.lineDash&&e.setLineDash(t.calculative.lineDash.map(y=>y*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),c?(Hg(e,t),Gg(!0,e,t,r)):(Xg(!0,e,t,r,u),a0(e,t)),!(t.image&&t.calculative.img)&&t.calculative.icon&&jg(e,t),t.dropdownList&&qg(e,t),(!o||!l)&&e.restore(),o&&!l&&Ya(e,t),!o&&l&&(t.rotateByRoot||t.calculative.rotate&&t.name!=="line")&&ia(e,t,!0),Vg(e,t),t.type===Ut.Line&&((m=t.fillTexts)==null?void 0:m.length)>0)for(const y of t.fillTexts)$g(e,t,y);e.restore(),s&&(t.calculative.debug||(t.calculative.debug={}),t.calculative.debug.renderTime=performance.now()-n)}function Yg(e,t){const i=t.lineCap||(t.type?"round":"square");i?e.lineCap=i:t.type&&(e.lineCap="round")}function Kg(e,t){const i=t.lineJoin;i?e.lineJoin=i:t.type&&(e.lineJoin="round")}function oo(e,t,i,a){var u,c;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,o=t.textRotate||n.options.textRotate;e.beginPath(),(!r||!o)&&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.rotateByRoot||t.calculative.rotate&&t.name!=="line")&&ia(e,t),(t.calculative.lineWidth>1||a)&&(e.lineWidth=t.calculative.lineWidth);let l;if(t.calculative.hover)e.strokeStyle=t.hoverColor||n.styles.hoverColor,e.fillStyle=t.hoverBackground||n.styles.hoverBackground,l=t.hoverBackground||n.styles.hoverBackground;else if(t.calculative.active)e.strokeStyle=t.activeColor||n.styles.activeColor,e.fillStyle=t.activeBackground||n.styles.activeBackground,l=t.activeBackground||n.styles.activeBackground;else{if(t.strokeImage)t.calculative.strokeImg&&(e.strokeStyle=e.createPattern(t.calculative.strokeImg,ro),l=!0);else{let d;t.calculative.strokeType&&t.calculative.lineGradientColors&&t.name==="line"?s=!0:d=t.calculative.color||n.styles.color,e.strokeStyle=d}t.backgroundImage?t.calculative.backgroundImg&&(e.fillStyle=e.createPattern(t.calculative.backgroundImg,ro),l=!0):(e.fillStyle=t.background,l=!!t.background)}if(Yg(e,t),Kg(e,t),Ka(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?(Hg(e,t),Gg(!0,e,t,n)):(Xg(!1,e,t,n,l),a0(e,t)),t.calculative.img?(e.save(),e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,Bs(e,t),e.restore()):t.calculative.icon&&jg(e,t),t.dropdownList&&qg(e,t),(!r||!o)&&e.restore(),r&&!o&&(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&&o&&(t.rotateByRoot||t.calculative.rotate&&t.name!=="line")&&ia(e,t,!0),Vg(e,t),t.type===Ut.Line&&((c=t.fillTexts)==null?void 0:c.length)>0)for(const d of t.fillTexts)$g(e,t,d);e.restore()}function Xg(e=!0,t,i,a,s){if(i.name==="drawCommand")return;const n=e?a.path2dMap.get(i):wt.path2dDraws[i.name];let r=null,o=null;if(i.type===Ut.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",o=new Path2D,o.moveTo(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].x,i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].y),o.lineTo(i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].x,i.calculative.worldAnchors[i.calculative.worldAnchors.length-1].y))),n){if(i.type===Ut.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()),o&&(t.save(),t.lineCap=i.toLineCap,t.stroke(o),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 l=(i.calculative.progress-(i.calculative.min||0))/((i.calculative.max||1)-(i.calculative.min||0));if(l!=null&&!isNaN(l)){t.save();const{ex:u,x:c,y:d,width:f,height:g,ey:m}=i.calculative.worldRect;let y=null;if(i.calculative.verticalProgress?y=i.reverseProgress?t.createLinearGradient(c,d,c,d+g*l):t.createLinearGradient(c,m,c,d+g*(1-l)):y=i.reverseProgress?t.createLinearGradient(u,d,c+f*(1-l),d):t.createLinearGradient(c,d,c+f*l,d),i.calculative.progressGradientColors){const{colors:p}=na(i.calculative.progressGradientColors);p.forEach(x=>{y.addColorStop(x.i,x.color)})}else{const p=i.calculative.progressColor||i.calculative.color||a.options.activeColor||a.data.color;y.addColorStop(0,p),y.addColorStop(1,p)}y.addColorStop(1,"transparent"),t.fillStyle=y,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),o&&(t.save(),t.lineCap=i.toLineCap,t.stroke(o),t.restore())):(n(i,t),t.stroke())),i.type){if(i.calculative.animatePos){if(t.save(),Zg(t,i,a),i.lineAnimateType===ie.Arrow||i.lineAnimateType===ie.WaterDrop){let u=c0(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&&Mg(t,i,a),i.toArrow&&Lg(t,i,a),o0(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&Jg(t,i)}}}function Gg(e=!0,t,i,a){const s=e?a.path2dMap.get(i):wt.path2dDraws[i.name];if(s&&i.type){if(i.calculative.animatePos){if(t.save(),Zg(t,i,a),t.beginPath(),s instanceof Path2D)if(i.lineAnimateType===ie.Arrow||i.lineAnimateType===ie.WaterDrop){const n=c0(i);t.stroke(n),t.fill(n)}else i.calculative.gradientSmooth||i.calculative.lineSmooth?(i.calculative.gradientAnimatePath||(i.calculative.gradientAnimatePath=Gc(i)),i.calculative.gradientAnimatePath instanceof Path2D&&t.stroke(i.calculative.gradientAnimatePath)):t.stroke(s);else s(i,t),t.stroke();t.restore()}i.fromArrow&&Mg(t,i,a),i.toArrow&&Lg(t,i,a),o0(t,i,a),i.calculative.active&&!i.calculative.pencil&&!a.options.disableAnchor&&!a.data.locked&&Jg(t,i)}}function Zg(e,t,i){e.strokeStyle=t.lineAnimateType===ie.Custom?t.animateColor||I2: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),Array.isArray(t.lineAnimateType)?t.lineAnimateType.forEach(a=>{id(t,i,a,e)}):id(t,i,t.lineAnimateType,e)}function id(e,t,i,a){var n,r,o;let s=0;switch(i){case ie.Breath:{const u=e.length>0?Math.max(0,Math.min(1,(e.calculative.animatePos||0)/e.length)):0,c=(1-Math.cos(2*Math.PI*u))/2,d=e.calculative.lineWidth,f=Math.max(d,((n=e.calculative.animateLineWidth)!=null?n:0)*t.data.scale);a.lineWidth=d+(f-d)*c,a.shadowBlur=e.animateShadow?Math.max(0,(r=e.animateShadowBlur)!=null?r:e.animateLineWidth||6)*c:0,a.lineDashOffset=0,a.setLineDash([]);break}case ie.Beads:e.animateReverse?a.lineDashOffset=e.calculative.animatePos:a.lineDashOffset=e.length-e.calculative.animatePos,s=e.calculative.lineWidth||5,s<5&&(s=5);const l=e.animateLineDash&&e.animateLineDash.map(u=>u*s/5);a.setLineDash(l||[s,s*2]);break;case ie.Dot:e.animateReverse?a.lineDashOffset=e.calculative.animatePos:a.lineDashOffset=e.length-e.calculative.animatePos,s=e.calculative.animateDotSize||e.calculative.lineWidth*2||6,s<6&&(s=6),s>40&&(s=40),a.lineWidth=(e.calculative.animateLineWidth||s)*t.data.scale,a.setLineDash([.1,e.length]);break;case ie.Arrow:a.fillStyle=e.animateColor||t.styles.animateColor,a.lineWidth=1;break;case ie.WaterDrop:a.fillStyle=e.animateColor||t.styles.animateColor,a.lineWidth=1;break;case ie.Custom:switch(e.lineAnimateTargetType){case ks.Image:if((o=e.lineAnimateImages)!=null||(e.lineAnimateImages=[]),e.lineAnimateImages.length>0){const d=e.lineAnimateImages.map((f,g)=>{const m=wt.htmlElements[f];if(!m)e.calculative.canvas.__loadImage(f);else return m});Tr(a,e,"image",d)}break;case ks.Icon:const u=e.lineAnimateIcon;Tr(a,e,"icon",u);break;case ks.Pen:e.lineAnimatePens&&Tr(a,e,"pen",e.lineAnimatePens);break;case ks.Element:const c=e.lineAnimateElement;Tr(a,e,"element",c)}break;default:e.animateReverse?(a.lineDashOffset=Number.EPSILON,a.setLineDash([0,e.length-e.calculative.animatePos+1,e.calculative.animatePos])):a.setLineDash([e.calculative.animatePos,e.length+.01-e.calculative.animatePos]);break}}function Tr(e,t,i,a){let s=null;switch(i){case"image":s=_6(a);break;case"icon":s=A6(a);break;case"pen":let n=t.calculative.canvas.find(a);t.lineAnimateElementCount=n.length,s=E6(n);break;case"element":if(s=wt.lineAnimateDraws[a],!s)return;s=x6(s);break}C6(e,t,s)}function x6(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale;t.translate(a.x,a.y),t.rotate(a.rotate*Math.PI/180),t.scale(n,n),e(t,i,a,s)}}function _6(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale,r=i.lineAnimateElementWidth||10,o=i.lineAnimateElementHeight||10,l=e[s%e.length];!l||(t.save(),t.translate(a.x,a.y),t.rotate(a.rotate*Math.PI/180),t.scale(n,n),t.drawImage(l,-r/2,-o/2,r,o),t.restore())}}function E6(e){return function(t,i,a,s){const n=e[s%e.length];if(!n)return;const r=i.calculative.canvas.store.data.scale,o=i.calculative.canvas.store.data.origin,l=i.calculative.canvas.parent,u=n.width,c=n.height,d=a.x-u/2,f=a.y-c/2,g=(d-o.x)/r,m=(f-o.y)/r,y=u/r,p=c/r,x={x:g,y:m,width:y,height:p,rotate:a.rotate};l.setValue({id:n.id,...x},{render:!1,doEvent:!1,history:!1})}}function A6(e){return function(t,i,a,s){const n=i.calculative.canvas.store.data.scale;t.beginPath(),t.translate(a.x,a.y),t.rotate(a.rotate*Math.PI/180),t.scale(n,n);const r=i.calculative.iconWeight;let o;const l=i.calculative.iconFamily;o=i.calculative.iconSize||Math.max(i.lineAnimateElementWidth||0,i.lineAnimateElementHeight||0)||10,t.font=Be({fontSize:o,fontWeight:r,fontFamily:l}),t.fillStyle=i.calculative.iconColor||zi(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 C6(e,t,i){var n;const a=t.calculative.canvas.store.data.scale,s=ho(t)/a;if(t.lineAnimateLoopMode)k6(e,t,i,s,a);else{const r=Array.isArray(t.lineAnimateDash)?t.lineAnimateDash:((n=t.lineAnimateDash)==null?void 0:n.split(",").map(l=>Number(l)))||[10,20];F6(s,r,t.lineAnimateDashOffset,t.lineAnimateElementCount).forEach((l,u)=>{const c=Cc(t,l.start);if(!!c)try{e.save(),i(e,t,c,u),e.restore()}catch(d){e.restore(),console.warn(d)}})}}function k6(e,t,i,a,s){var u;const r=((Array.isArray(t.lineAnimateDash)?t.lineAnimateDash:((u=t.lineAnimateDash)==null?void 0:u.split(",").map(c=>Number(c)))||[10,20])[0]||30)*s,o=t.calculative.animatePos,l=t.calculative.worldAnchors;if(l.length>1){let c,d=0;for(let f=0;f<l.length;f++){let g=l[f];if(c){const m=t.length;let p=(o-d)%r-r,x=0;for(;p<m;){if(p>=0){const _=d+p,b=(o-_)/s;try{e.save();const C=Cc(t,b);C&&i(e,t,C,x),e.restore()}catch(C){e.restore(),console.warn(C)}}p+=r,x++}d+=m}c=g}if(t.close){let f=l[0];if(c){const g=Math.sqrt((f.x-c.x)**2+(f.y-c.y)**2);let y=(o-d)%r-r,p=0;for(;y<g;){if(y>=0){const x=d+y,_=(o-x)/s;try{e.save();const b=Cc(t,_);b&&i(e,t,b,p),e.restore()}catch(b){e.restore(),console.warn(b)}}y+=r,p++}}}}}function F6(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,d)=>c+d,0);let o=(-i+s)%r;o<0&&(o+=r);let l=0,u=0;for(a||(a=1/0);u<e&&l<a;)for(let c=0;c<t.length;c++){const d=t[c],f=c%2===0;let g=u,m=u+d-o;if(m>e&&(m=e),f&&m>g){const y=(g+s)%e,p=(m+s)%e;n.push({start:y,end:p,isDash:!0}),l+=1}if(u=m,o=0,u>=e||l>=a)break}return n}function Cc(e,t=0){const i=e.calculative.worldAnchors;if(!i||i.length<2)return null;const a={x:i[0].x,y:i[0].y},s=u=>u&&{...u,x:u.x-a.x,y:u.y-a.y};let n,r=null;if(i.forEach(u=>{if(r){const c=s(r);c.next=s(r.next);const d=s(u);d.prev=s(u.prev),n=yd(n,c,c.next,d.prev,d)}r=u}),e.close){const u=i[0],c=s(r);c.next=s(r.next);const d=s(u);d.prev=s(u.prev),n=yd(n,c,c.next,d.prev,d)}let o=0;e.animateReverse?o=e.length-e.calculative.animatePos+t*e.calculative.canvas.store.data.scale:o=e.calculative.animatePos-t*e.calculative.canvas.store.data.scale;const l=r5(n,o);return l?(l.x+=a.x,l.y+=a.y,l):null}function Jg(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&&P6(e,a,t)}),e.restore()}function P6(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 Qg(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),te(i),e.pivot&&Pc(i,e.pivot);else{const a=t.pens[e.parentId];let s=a.calculative.worldRect;s||(s=Qg(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,te(i),e.pivot&&Pc(i,e.pivot)}return e.calculative.worldRect=i,Zc(e,i),i}function Zc(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 qr(e){const t=ot(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,wa(t,a))}function Is(e){const t=e.calculative.canvas.store;let i=[];if(e.anchors){let a=ot(e.anchors);e.flipX&&e.name!=="line"&&a.forEach(s=>{s.x=.5-(s.x-.5)}),e.flipY&&e.name!=="line"&&a.forEach(s=>{s.y=.5-(s.y-.5)}),a.forEach(s=>{i.push(R6(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;for(let o=0;o<t.options.defaultAnchors.length;o++){const l=t.options.defaultAnchors[o];i.push({id:`${o}`,penId:e.id,x:a+n*l.x,y:s+r*l.y})}}e.calculative.rotate&&e.name!=="line"&&i.forEach(a=>{Zt(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 t0(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,te(s.calculative.initRect)),t0(s)})}}function R6(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 ad(e,t){if(!t.image&&!t.icon&&!t.thumbImg)return;const{paddingTop:i,paddingBottom:a,paddingLeft:s,paddingRight:n}=t.calculative;let r=s,o=i,l=t.calculative.worldRect.width-s-n,u=t.calculative.worldRect.height-i-a,c=t.calculative.iconLeft||0,d=t.calculative.iconTop||0;c&&Math.abs(c)<1&&(c=t.calculative.worldRect.width*c),d&&Math.abs(d)<1&&(d=t.calculative.worldRect.height*d),r+=c||0,o+=d||0,l-=c||0,u-=d||0;let f=t.calculative.iconRotate||0;if(t.parentId){const g=e[t.parentId].calculative;g&&(f+=g.rotate,f%=360)}r=t.calculative.worldRect.x+r,o=t.calculative.worldRect.y+o,t.calculative.worldIconRect={x:r,y:o,width:l,height:u,rotate:f},re(t.calculative.worldIconRect),te(t.calculative.worldIconRect)}function di(e,t,i){Ds(e.calculative.worldRect,t,i,e.pivot),e.calculative.initRect&&Ds(e.calculative.initRect,t,i,e.pivot),e.calculative.prevFrameRect&&Ds(e.calculative.prevFrameRect,t,i,e.pivot),e0(e,t,i),e.calculative.x&&Fs(e.calculative,t,i),e.type&&Is(e)}function e0(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&&Ds(n.calculative.initRect,t,i),e0(n,t,i))})}function S6(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&&Zt(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 T6(e,t,i){e.anchors||(e.anchors=[]),e.calculative.worldAnchors||(e.calculative.worldAnchors=[]);const a=Q6(e,t,i);return e.calculative.worldAnchors.splice(i+1,0,a),e.anchors.splice(i+1,0,xn(a,e.calculative.worldRect)),e.calculative.activeAnchor=a,a}function B6(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 Ns(e,t){if(!t||!t.calculative||!t.calculative.worldRect.center)return Rt.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 h2(e,t.calculative.worldRect.center)}function Rs(e,t){let i=1/0,a;return e.calculative.worldAnchors.forEach(s=>{const n=wo(t,s);i>n&&(i=n,a=s)}),a}function sd(e,t,i){e.x+=t,e.y+=i,e.anchors&&e.anchors.forEach(a=>{bn(a,t,i)}),e.calculative.worldAnchors&&e.calculative.worldAnchors.forEach(a=>{bn(a,t,i)})}function Jc(e){if(e&&e.calculative&&e.calculative.worldAnchors.length){let t=jt(e);if(!e.anchors||!e.anchors.length)for(;e.calculative.worldAnchors.length&&t!==e.calculative.activeAnchor;)e.calculative.worldAnchors.pop(),t=jt(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 xe(e,t,i,a){var o,l,u,c,d,f;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 g=jt(i);if(a.id!==g.id)return}if(t.twoWay===Ae.Out){const g=ce(i);if(a.id!==g.id)return}if(a.connectTo===e.id&&a.anchorId===t.id)return;if(a.connectTo){const g=e.calculative.canvas.store.pens[a.connectTo];Ss(g,Na(g,a.anchorId),i,a)}e.connectedLines||(e.connectedLines=[]),e.connectedLines.findIndex(g=>g.lineId===i.id&&g.lineAnchor===a.id&&g.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&&xe(i,a,e,t),e.calculative.canvas.store.emitter.emit("connectLine",{line:i,lineAnchor:a,pen:e,anchor:t});let n=((o=i.calculative.worldAnchors)==null?void 0:o.length)>=2?(l=i.calculative.worldAnchors)==null?void 0:l[0].connectTo:void 0,r=((u=i.calculative.worldAnchors)==null?void 0:u.length)>=2?(d=i.calculative.canvas.store.pens[(c=i.calculative.worldAnchors)==null?void 0:c[0].connectTo])==null?void 0:d.anchors.find(g=>{var m;return g.id===((m=i.calculative.worldAnchors)==null?void 0:m[0].anchorId)}):void 0;return(f=e.onConnectLine)==null||f.call(e,e,{line:i,lineAnchor:a,pen:e,anchor:t,fromPen:n,fromAnchor:r}),!0}function Ss(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]=ot(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&&Ss(i,a,e,t),e.calculative.canvas.store.emitter.emit("disconnectLine",{line:i,lineAnchor:a,pen:e,anchor:t}),!0}function Na(e,t){var i;if(!(!e||!t))return(i=e.calculative.worldAnchors)==null?void 0:i.find(a=>a.id===t)}function ce(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[0]}function jt(e){if(!(!e||!e.calculative.worldAnchors))return e.calculative.worldAnchors[e.calculative.worldAnchors.length-1]}function I6(e,t){var s,n;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 r of e.frames){e.calculative.duration+=r.duration;for(const o in r)o!=="duration"&&!e[o]&&o==="scale"&&(e[o]=1)}}if(e.animateCycle||(e.animateCycle=1/0),e.calculative.start){let r=0;const o=Math.ceil((t-e.calculative.start)/e.calculative.duration);if(o>e.animateCycle)return e.currentAnimation=void 0,e.calculative.start=void 0,rd(e,1),0;const l=(t-e.calculative.start)%e.calculative.duration||e.calculative.duration;let u=0;for(const f of e.frames)if(u+=f.duration,l>u)e.frames[r].switch||(e.calculative.prevFrameRect=ot(e.calculative.worldRect),e.frames[r].switch=!0),++r;else break;if(!e.frames[r])return!0;let c=!1;r!==e.calculative.frameIndex&&(c=!0,e.calculative.frameIndex=r,e.calculative.frameDuration=e.frames[r].duration,r>0&&(e.calculative.frameStart+=e.frames[r-1].duration),e.calculative.frameEnd=e.calculative.frameStart+e.calculative.frameDuration);let d=!1;if(o>e.calculative.cycleIndex&&(e.frames.forEach(f=>{f.switch=!1}),e.calculative.worldRect=ot(e.calculative.initRect),e.calculative.prevFrameRect=ot(e.calculative.initRect),e.calculative.cycleIndex=o,e.calculative.frameStart=e.calculative.start+e.calculative.duration*(o-1),d=!0),c||d)if(e.calculative.x=e.calculative.initRect.x,e.calculative.y=e.calculative.initRect.y,((n=e.children)==null?void 0:n.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,r>0){e.prevFrame={};const f=e.frames[r-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 nd(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=ot(e.calculative.worldRect),e.calculative.prevFrameRect=ot(e.calculative.worldRect),e.parentId&&(e.calculative.initRelativeRect={x:e.x,y:e.y,width:e.width,height:e.height}),(s=e.children)!=null&&s.length){const r=e.calculative.canvas.store;e.calculative.childrenVisible={},e.children.forEach(o=>{e.calculative.childrenVisible[o]=r.pens[o].visible})}e.calculative.initRect.rotate=e.calculative.rotate||0,nd(e)}const i=e.frames[e.calculative.frameIndex];let a=0;if(i.curveAnimate){const r=(t-e.calculative.frameStart)/e.calculative.frameDuration%1;let o=[];i.animateTimingFunction?o=Array.isArray(i.animateTimingFunction)?i.animateTimingFunction:i.animateTimingFunction.split(","):o=[.25,.25,.75,.75],a=Og(r,o[1],o[3])}else a=(t-e.calculative.frameStart)/e.calculative.frameDuration%1;return a>0&&rd(e,a),!0}function nd(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 rd(e,t){var s,n,r,o,l,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=ot(e.calculative.prevFrameRect),Ds(e.calculative.worldRect,e.prevFrame.scale,e.calculative.worldRect.center);const d=e.prevFrame.scale+(i[c]-e.prevFrame.scale)*t;Ds(e.calculative.worldRect,d/e.prevFrame.scale,e.calculative.worldRect.center),e.calculative.patchFlags=!0}else if(c==="x"){const d=cn(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.x=e.calculative.initRect.x+d,e.calculative.worldRect.ex=e.calculative.initRect.ex+d,e.calculative.worldRect.center.x=e.calculative.initRect.center.x+d,(s=e.calculative.worldRect.pivot)!=null&&s.x&&(e.calculative.worldRect.pivot.x=((n=e.calculative.initRect.pivot)==null?void 0:n.x)+d),Ua(e.calculative.worldRect,i[c]*t*a,0),e.calculative.patchFlags=!0}else if(c==="y"){const d=cn(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.y=e.calculative.initRect.y+d,e.calculative.worldRect.ey=e.calculative.initRect.ey+d,e.calculative.worldRect.center.y=e.calculative.initRect.center.y+d,(r=e.calculative.worldRect.pivot)!=null&&r.x&&(e.calculative.worldRect.pivot.y=((o=e.calculative.initRect.pivot)==null?void 0:o.y)+d),Ua(e.calculative.worldRect,0,i[c]*t*a),e.calculative.patchFlags=!0}else if(c==="width"){const d=cn(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.width=e.calculative.initRect.width+d,e.calculative.worldRect.ex=e.calculative.initRect.ex+d,e.calculative.worldRect.center.x=e.calculative.initRect.center.x+d;let f=i[c]*t*a;e.calculative.worldRect.width+=f,e.calculative.worldRect.ex+=f,e.calculative.worldRect.center.x+=f,e.calculative.patchFlags=!0}else if(c==="height"){const d=cn(e,c,e.calculative.frameIndex)*a;e.calculative.worldRect.height=e.calculative.initRect.height+d,e.calculative.worldRect.ey=e.calculative.initRect.ey+d,e.calculative.worldRect.center.y=e.calculative.initRect.center.y+d;let f=i[c]*t*a;e.calculative.worldRect.height+=f,e.calculative.worldRect.ey+=f,e.calculative.worldRect.center.y+=f,e.calculative.patchFlags=!0}else if(c==="rotate"){e.prevFrame[c]>=360&&(e.prevFrame[c]%=360);const d=cn(e,c,e.calculative.frameIndex),f=(e.calculative.initRect.rotate+d+i[c]*t)%360-(e.calculative.rotate||0);(l=e.children)!=null&&l.length?e.calculative.canvas.rotatePen(e,f,e.calculative.initRect):e.calculative.rotate=(e.calculative.initRect.rotate+d+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(D6(i[c],c,e)){e.prevFrame[c]==null&&(c==="globalAlpha"?e.prevFrame[c]=1:e.prevFrame[c]=0);const d=e.prevFrame[c]+(i[c]-e.prevFrame[c])*t;["lineWidth"].includes(c)?e.calculative[c]=Math.round(d*100)/100*a:e.calculative[c]=Math.round(d*100)/100}else{if(c==="visible"&&!e.calculative.image){if((u=e.children)!=null&&u.length){const f=Le(e,e.calculative.canvas.store);e.calculative.canvas.initImageCanvas(f)}}e.calculative[c]=i[c];const d={};d[c]=i[c],Qc(e,d)}c==="text"&&Ws(e)}}function D6(e,t,i){const a=["strokeType","bkType","showChild"];return typeof e=="number"&&i.linear!==!1&&!a.includes(t)}function M6(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=Og(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 Cs(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,Cs(s,t))})}function mn(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&&mn(i.pens[a],t)})}function Pe(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",e.name==="iframe"?t.style.opacity=e.calculative.inView?"1":"0":t.style.display=e.calculative.inView!=!1?e.calculative.cssDisplay||"inline":"none",e.disableTransform||(!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===It.DisableEdit||e.locked===It.DisableMove||i.data.locked?(t.style.userSelect="initial",t.style.pointerEvents="initial",(e.name==="gif"||e.ignoreEvent)&&(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]}async function L6(e,t){if(!!t&&globalThis.html2canvas){const i=await globalThis.html2canvas(t);if(i){const a=new Image;a.src=i.toDataURL("image/png",.1),a.src.length>10&&(e.calculative.img=a)}}}function ec(e){return e.every(t=>t.locked)}function od(e){return e.every(t=>t.disableRotate)}function i0(e,t,i){var a;e.rotateByRoot||(e.name==="line"?(e.calculative.worldAnchors.forEach(s=>{Zt(s,t,i.center)}),O6(e),qr(e)):(e.calculative.rotate?e.calculative.rotate+=t:e.calculative.rotate=t,Zt(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];i0(n,t,i)}))}function O6(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=Fc(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),te(t),e.calculative.worldRect=t,Zc(e,t),Ii(e),e.calculative.worldAnchors&&(e.anchors=e.calculative.worldAnchors.map(n=>xn(n,e.calculative.worldRect)))}function ld(e){return e.every(t=>t.disableSize||t.pivot)}function cn(e,t,i){if(!e.frames||!t)return 0;let a=0;for(let s=0;s<i;s++)e.frames[s]&&(a+=e.frames[s][t]||0);return a}function lo(e,t){var a;let i=e;for(;i&&i.parentId;){const s=i;i=t.pens[i.parentId];const n=(a=i==null?void 0:i.calculative)==null?void 0:a.showChild;if(n!=null&&i.children[n]!==s.id)return!1}return!0}function Di(e,t=!1){var s,n,r;const{store:i,canvasRect:a}=e.calculative.canvas;if(t&&((s=e.children)==null||s.forEach(o=>{const l=i.pens[o];l&&Di(l,!0)})),e.calculative.inView=!0,lo(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(o=>o.hasOwnProperty("visible")))):e.calculative.inView=!1,e.calculative.inView){const{x:o,y:l,width:u,height:c,rotate:d}=e.calculative.worldRect,f={x:o+i.data.x,y:l+i.data.y,width:u,height:c,rotate:d};re(f),ea(f,a)||(e.calculative.inView=!1)}i.data.locked&&e.calculative.inView&&(e.calculative.inView=N6(e,i.options.roles)),(r=e.calculative.singleton)!=null&&r.div&&Pe(e,e.calculative.singleton.div)}function N6(e,t){var s;const i=new Set;let a=e;for(;a;){if(i.has(a))return!1;if(i.add(a),(s=a.roles)!=null&&s.length)return!!(t!=null&&t.some(n=>a.roles.includes(n)));if(!a.parentId)return!0;a=We(a,!1)}return!1}function z6(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 Ka(e,t){const i=t.calculative.globalAlpha;typeof i=="number"&&i<1&&!isNaN(i)&&(e.globalAlpha=i)}function a0(e,t){const i=W6(e,t)||wt.canvasDraws[t.name];i&&(e.save(),i(e,t),e.restore())}function W6(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,o)=>{const l=H6(o,s,r.x,r.y);try{if(l.c){if(l.c.startsWith("_")){const c=l.c.split("_")[1];return typeof l.v.value=="number"&&(l.v.value*=s.calculative.canvas.store.data.scale),(l.p||a)[c]=l.v.value,{x:r.x,y:r.y}}let u=[];for(const c in l.v)u.push(l.v[c]);return(l.p||a)[l.c](...u),{x:l.startX||l.v.x,y:l.startY||l.v.y}}return{x:r.x,y:r.y}}catch{}},{})}catch{}}),a.stroke()}}function H6(e,t,i,a){var n;const s={visio:$6,dxf:U6,canvas:V6};return((n=s[t.parseType])==null?void 0:n.call(s,e,t,i,a))||e}function U6(e,t,i,a){var c,d;const{x:s,y:n,width:r,height:o}=t.calculative.worldRect,{originWidth:l,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/l)+s,y:e.v.y*(o/u)+n}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*(r/l)+s,y:e.v.y*(o/u)+n}};case"arc":return{c:"ellipse",v:{x:e.v.x*(r/l)+s,y:e.v.y*(o/u)+n,rx:e.v.xr*(r/l),ry:e.v.yr*(o/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/l)+s,y:e.v.y*(o/u)+n,rx:e.v.xr*(r/l),ry:e.v.yr*(o/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(d=e.v.aclockwise)!=null?d:!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 f={c:e.c,v:{...e.v}};return f.v.x!==void 0&&(f.v.x=e.v.x*(r/l)+s),f.v.y!==void 0&&(f.v.y=e.v.y*(o/u)+n),f}}function V6(e,t,i,a){var c,d;const{x:s,y:n,width:r,height:o}=t.calculative.worldRect,{originWidth:l,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/l)+s,y:e.v.y*(o/u)+n}};case"lineTo":return{c:"lineTo",v:{x:e.v.x*(r/l)+s,y:e.v.y*(o/u)+n}};case"arc":return{c:"ellipse",v:{x:e.v.x*(r/l)+s,y:e.v.y*(o/u)+n,rx:e.v.xr*(r/l),ry:e.v.yr*(o/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/l)+s,y:e.v.y*(o/u)+n,rx:e.v.xr*(r/l),ry:e.v.yr*(o/u),rotation:e.v.rotation||0,startAngle:e.v.startAngle,endAngle:e.v.endAngle,a:(d=e.v.aclockwise)!=null?d:!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 f={c:e.c,v:{...e.v}};return f.v.x!==void 0&&(f.v.x=e.v.x*(r/l)+s),f.v.y!==void 0&&(f.v.y=e.v.y*(o/u)+n),f}}function $6(e,t,i,a){const{x:s,y:n,width:r,height:o}=t.calculative.worldRect,{width:l,height:u}=t.origin;switch(e.c){case"MoveTo":return{c:"moveTo",v:{x:+e.v.X*100*(r/l)+s,y:+e.v.Y*100*(o/u)+n}};case"RelMoveTo":return{c:"moveTo",v:{x:+e.v.X*l*(r/l)+s,y:+e.v.Y*u*(o/u)+n}};case"LineTo":return{c:"lineTo",v:{x:+e.v.X*100*(r/l)+s,y:+e.v.Y*100*(o/u)+n}};case"RelLineTo":return{c:"lineTo",v:{x:+e.v.X*l*(r/l)+s,y:+e.v.Y*u*(o/u)+n}};case"Ellipse":let c=e.v.X,d=e.v.Y,f=Math.abs(e.v.A-e.v.C),g=Math.abs(e.v.B-e.v.D);return{c:"ellipse",v:{x:c*100*(r/l)+s,y:d*100*(o/u)+n,radiuX:f*100*(r/l),radiuY:g*100*(o/u),rotation:0,startAngle:0,endAngle:Math.PI*2,anticlockwise:!0}};case"EllipticalArcTo":const m=e.v.X*100*(r/l)+s,y=e.v.Y*100*(o/u)+n,p=e.v.A*100*(r/l)+s,x=e.v.B*100*(o/u)+n;e.v.C;const _=e.v.D*(r/o)*(u/l),b=(m-i)*(x-a)-(y-a)*(p-i)>0,C=cd(i,a,m,y,p,x,_);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=Br(C.x0,C.y0,i,a)),!e.orign.endA&&(e.orign.endA=Br(C.x0,C.y0,m,y)),{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:b},startX:m,startY:y};case"RelEllipticalArcTo":const P=e.v.X*l*(r/l)+s,S=e.v.Y*u*(o/u)+n,B=e.v.A*l*(r/l)+s,D=e.v.B*u*(o/u)+n;e.v.C;const V=e.v.D*(r/o)*(u/l),G=(P-i)*(D-a)-(S-a)*(B-i)>0,F=cd(i,a,P,S,B,D,V);return!e.orign&&(e.orign={}),!e.orign.startA&&(e.orign.startA=Br(F.x0,F.y0,i,a)),!e.orign.endA&&(e.orign.endA=Br(F.x0,F.y0,P,S)),{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:G},startX:P,startY:S};case"ArcTo":let R=e.v.X*100*r/l+s,T=e.v.Y*100*o/u+n,L=e.v.A*100*t.calculative.canvas.store.data.scale,$=(i+R)/2,Z=(a+T)/2,at=Math.sqrt((R-i)**2+(T-a)**2);if(Math.abs(L)<.001||at<.001)return{c:"lineTo",v:{x:R,y:T}};let q=at*at/(8*Math.abs(L))+Math.abs(L)/2,W=-(T-a)/at,j=(R-i)/at,K=q-Math.abs(L),U=$-Math.sign(L)*W*K,tt=Z-Math.sign(L)*j*K,st=Math.atan2(a-tt,i-U),it=Math.atan2(T-tt,R-U),ht=it-st;for(;ht>Math.PI;)ht-=2*Math.PI;for(;ht<-Math.PI;)ht+=2*Math.PI;let lt=L>0;return(lt&&ht>0||!lt&&ht<0)&&([st,it]=[it,st],lt=!lt),{c:"arc",v:{x:U,y:tt,radius:q,startAngle:st,endAngle:it,anticlockwise:lt},startX:R,startY:T};default:const ut=ot(e);return Object.entries(ut.v).forEach(([E,A])=>{var I,N;(I=E.endsWith)!=null&&I.call(E,"_x")?typeof A=="number"&&(ut.v[E]=A*(r/l)+s):(N=E.endsWith)!=null&&N.call(E,"_y")?typeof A=="number"&&(ut.v[E]=A*(o/u)+n):typeof A=="number"&&(ut.v[E]=A)}),ut}}function j6(e,t){e.filter=t.filter}function Qc(e,t){for(const i in t)Tg.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,Ii(e)):e.calculative[i]=t[i]),e.image&&e.name!=="gif"&&Sg.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=ot(t);e.calculative.childrenVisible&&e.calculative.childrenVisible[a]===!1&&delete s.visible;const n=e.calculative.canvas.store.pens[a];n&&Qc(n,s)})}}function cd(e,t,i,a,s,n,r){let o=(e-i)*(e+i)*(a-n)-(i-s)*(i+s)*(t-a)+r*r*(t-a)*(a-n)*(t-n),l=2*((e-i)*(a-n)-(i-s)*(t-a)),u=o/l,c=(e-i)*(i-s)*(e-s)+r*r*((i-s)*(t-a)*(t+a)-(e-i)*(a-n)*(a+n)),d=2*r*r*((i-s)*(t-a)-(e-i)*(a-n)),f=c/d,g=Math.sqrt(Math.pow(e-u,2)+Math.pow(r*(t-f),2)),m=g/r;return{x0:u,y0:f,a:g,b:m}}function Br(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 ud(e,t,i){let a,s,n=1/0,r=1/0;const o=8;for(const l of e.data.pens){if(l.calculative.inView===!1)continue;tu(l).forEach(c=>{if(c===t||c===i)return;let d=(l.calculative.worldRect.center.x-t.x)*(l.calculative.worldRect.center.x-t.x)+(l.calculative.worldRect.center.y-t.y)*(l.calculative.worldRect.center.y-t.y);const f=Math.abs(c.x-t.x);f>0&&f<o&&d<n&&(a={x:Math.round(c.x)+.5,y:Math.round(c.y)+.5,prev:{x:Math.round(t.x)+.5,y:Math.round(t.y)+.5},step:c.x-t.x},n=d);const g=Math.abs(c.y-t.y);g>0&&g<o&&d<r&&(s={x:Math.round(c.x)+.5,y:Math.round(c.y)+.5,prev:{x:Math.round(t.x)+.5,y:Math.round(t.y)+.5},step:c.y-t.y},r=d)})}return{xDock:a,yDock:s}}function q6(e,t,i,a){let s=[];return i.length===1?(s=ot(tu(i[0])),s.forEach(n=>{n.x+=a.x,n.y+=a.y})):(te(t),s=[t.center,...aa(t)]),s0(e,s,t,!0)}function tu(e){if(e.type){if(e.type===Ut.Line)return e.calculative.worldAnchors}else{const t=aa(e.calculative.worldRect);return te(e.calculative.worldRect),[...e.calculative.worldAnchors,...t,e.calculative.worldRect.center]}}function Y6(e,t,i,a){const s=aa(t);return s0(e,s,t)}function s0(e,t,i,a=!1){let s,n,r=1/0,o=1/0;const l=10,u=f5(i,l);return e.data.pens.forEach(c=>{const{inView:d,worldRect:f,active:g}=c.calculative;if(d===!1||!a&&g||h5(u,f)||c.type&&e.active.some(y=>n0(e,y,c)))return;const m=tu(c);if(!!m)for(const y of m)for(const p of t){const x=y.x-p.x,_=y.y-p.y,b=Math.abs(x),C=Math.abs(_);i.center||(i.center={x:i.x+i.width/2,y:i.y+i.height/2}),b<l&&b<r&&(s={x:Math.round(y.x)+.5,y:Math.round(y.y)+.5,step:x,prev:{x:Math.round(p.x)+.5,y:Math.round(p.y)+.5},penId:c.id,anchorId:p.id,dockAnchorId:y.id},r=b),C<l&&C<o&&(n={x:Math.round(y.x)+.5,y:Math.round(y.y)+.5,step:_,prev:{x:Math.round(p.x)+.5,y:Math.round(p.y)+.5},penId:c.id,anchorId:p.id,dockAnchorId:y.id},o=C)}}),{xDock:s,yDock:n}}function n0(e,t,i){if(!i.type)return!1;if(Array.isArray(t==null?void 0:t.connectedLines)){for(const a of t==null?void 0:t.connectedLines)if(a.lineId===i.id)return!0}if(Array.isArray(t==null?void 0:t.children))for(const a of t.children){const s=e.pens[a];if(n0(e,s,i))return!0}return!1}function kc(e,t){return e.toFixed(12)==t}function K6(e,t=4){let i=e.map(u=>u.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,o=Math.sqrt(a.map(u=>Math.pow(u-n,2)).reduce((u,c)=>u+c,0)/a.length),l=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 d=(c.x-n)/o,f=(c.y-r)/l;return Math.sqrt(d*d+f*f)>t})}function hd(e){if(e.id=Tt(),Array.isArray(e.anchors))for(const t of e.anchors)e.type&&(t.id=Tt()),t.penId=e.id,t.prev&&(e.type&&(t.prev.id=Tt()),t.prev.penId=e.id),t.next&&(e.type&&(t.next.id=Tt()),t.next.penId=e.id)}function X6(){let e=null,t=new WeakMap;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,o=new Map;e.has(a)&&e.get(a)?r=e.get(a):(o.set(a,i[a]),e.set(a,r)),n?r.delete(s):r.add(s);let l=o.get(a),u=(...c)=>{l==null||l(...c),r.forEach(d=>{d(...c)})};i[a]=u}}let G6=X6();function Z6(e){return!e.name&&!e.install?(console.error("installPenPlugin Error: Validation Failed"),!1):!0}function J6(e,t,i){if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),i)t.calculative.activeAnchor&&(t.calculative.activeAnchor.next={penId:t.id,x:i.x,y:i.y},wo(t.calculative.activeAnchor.next,t.calculative.activeAnchor)<5?t.calculative.activeAnchor.next=void 0:(t.calculative.activeAnchor.prev={...t.calculative.activeAnchor.next},Zt(t.calculative.activeAnchor.prev,180,t.calculative.activeAnchor)));else{const a=t.calculative.worldAnchors[0];if(!a.next){const n=Ns(a,e.pens[a.connectTo]);fd(a,n,50),a.prev=void 0}const s=t.calculative.worldAnchors[t.calculative.worldAnchors.length-1];if(s&&s!==a&&!s.prev){const n=Ns(s,e.pens[s.connectTo]);fd(s,n,-50),s.next=void 0}}}function fd(e,t,i){switch(t){case Rt.Up:e.prev={penId:e.penId,x:e.x,y:e.y+i},e.next={penId:e.penId,x:e.x,y:e.y-i};break;case Rt.Right:e.prev={penId:e.penId,x:e.x-i,y:e.y},e.next={penId:e.penId,x:e.x+i,y:e.y};break;case Rt.Bottom:e.prev={penId:e.penId,x:e.x,y:e.y-i},e.next={penId:e.penId,x:e.x,y:e.y+i};break;case Rt.Left:e.prev={penId:e.penId,x:e.x+i,y:e.y},e.next={penId:e.penId,x:e.x-i,y:e.y};break}}function Ha(e,t,i,a){const s=1-e,n=s*s*t.x+2*s*e*i.x+e*e*a.x,r=s*s*t.y+2*s*e*i.y+e*e*a.y;return{x:n,y:r,step:e}}function co(e,t,i,a,s){const{x:n,y:r}=t,{x:o,y:l}=s,{x:u,y:c}=i,{x:d,y:f}=a,g=1-e,m=n*g*g*g+3*u*e*g*g+3*d*e*e*g+o*e*e*e,y=r*g*g*g+3*c*e*g*g+3*f*e*e*g+l*e*e*e;return{x:m,y,step:e}}function ma(e,t,i){return{x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)}}function Q6(e,t,i){let a=e.calculative.worldAnchors[i],s=e.calculative.worldAnchors[i+1];!s&&e.close&&(s=e.calculative.worldAnchors[0]);const n=t.step;let r;if(a.next&&s.prev){const o=a,l=a.next,u=s.prev,c=s,d=ma(o,l,n),f=ma(l,u,n),g=ma(u,c,n),m=ma(d,f,n),y=ma(f,g,n);r=ma(m,y,n),m.penId=e.id,r.prev=m,y.penId=e.id,r.next=y,a.next.x=d.x,a.next.y=d.y,s.prev.x=g.x,s.prev.y=g.y}else if(a.next||s.prev){const o=a,l=a.next||s.prev,u=s,c=ma(o,l,n),d=ma(l,u,n);r=t,c.penId=e.id,d.penId=e.id,r.prev=c,r.next=d,a.next=void 0,s.prev=void 0}else r=t;return r.penId=e.id,r.id=Tt(),r.prevNextType=qa.Bilateral,r}function t5(e,t,i){if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.calculative.worldAnchors.length<2)return;let a=t.calculative.activeAnchor,s=i||jt(t);if(!a||!s)return;const n=20,r=e.pens[a.connectTo];let o=Ns(a,r);switch(o===Rt.None&&(s.x>a.x?o=Rt.Right:o=Rt.Left),a.next={id:Tt(),penId:t.id,x:a.x,y:a.y,prevNextType:2},s.prev={id:Tt(),penId:t.id,x:s.x,y:s.y,prevNextType:2},o){case Rt.Up:a.next.y-=n,s.prev.y=a.y;break;case Rt.Bottom:a.next.y+=n,s.prev.y=a.y;break;case Rt.Left:a.next.x-=n,s.prev.x=a.x;break;default:a.next.x+=n,s.prev.x=a.x;break}}function e5(e,t){const i=t||new Path2D;if((e.lineName==="line"||e.lineName==="polyline")&&e.calculative.lineSmooth){let s=Gc(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?dd(i,s,n):n.start=!0,s=n}),e.close&&(e.lineName==="curve"?dd(i,s,a[0]):i.closePath())}if(i instanceof Path2D)return i}function i5(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=ce(t),s=jt(t);!a||!s||!s.id||a===s||(a.next=void 0,Jc(t),s.prev=void 0,t.calculative.worldAnchors.push(s))}function dd(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 Fc(e){return ho(e),Mn(eu(e))}function eu(e){const t=[];let i;return e.calculative.worldAnchors.forEach(a=>{i&&t.push(...gd(i,a,e)),t.push(a),i=a}),e.close&&e.calculative.worldAnchors.length>1&&t.push(...gd(i,e.calculative.worldAnchors[0],e)),t}function uo(e){return e!=null&&e.lineWidth?e.lineWidth/2+4:4}function gd(e,t,i){const a=[];if(!t)return a;let s=.02;if(e.lineLength&&!i.parentId&&(s=uo(i)/e.lineLength),e.next)if(t.prev)for(let n=s;n<1;n+=s)a.push(co(n,e,e.next,t.prev,t));else for(let n=s;n<1;n+=s)a.push(Ha(n,e,e.next,t));else if(t.prev)for(let n=s;n<1;n+=s)a.push(Ha(n,e,t.prev,t));else a.push({x:t.x,y:t.y});return a.length>1&&(e.curvePoints=a),a}function a5(e,t){const i=uo(t);let a=0,s,n;for(const r of t.calculative.worldAnchors){if(s){if(n=vd(e,s,r,i),n)return{i:a,point:n};++a}s=r}if(t.close&&t.calculative.worldAnchors.length>1&&(n=vd(e,s,t.calculative.worldAnchors[0],i)))return{i:a,point:n}}function vd(e,t,i,a=4){if(!t.next&&!i.prev){const{x:s,y:n}=t,{x:r,y:o}=i,l=Math.min(s,r),u=Math.max(s,r),c=Math.min(n,o),d=Math.max(n,o);return e.x>=l-a&&e.x<=u+a&&e.y>=c-a&&e.y<=d+a?s5(e,t,i,a):void 0}else if(t.curvePoints){for(const s of t.curvePoints)if(As(e,s,a))return s}}function s5(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 l=(e.x+s*e.y-s*n)/(s*s+1);return{x:l,y:s*l+n}}}}function md(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 ho(e){if(e.calculative.worldAnchors.length<2)return 0;let t=0,i;if(e.calculative.worldAnchors.forEach(a=>{i&&(i.lineLength=md(i,i.next,a.prev,a),t+=i.lineLength),i=a}),e.close){const a=ce(e);i.lineLength=md(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 ic(e,t){const i=e.calculative.worldAnchors;for(let a=0;a<i.length-1;a++){const s=i[a],n=i[a+1];if(!s.next&&!n.prev){if(r0(s,n,t))return!0}else if(n5(s,n,t))return!0}return!1}function r0(e,t,i){if(Xa(e,i)||Xa(t,i))return!0;const a=e.x,s=e.y,n=t.x,r=t.y;let o=i.x,l=i.y,u=i.ex,c=i.ey;const d=s-r,f=n-a,g=a*r-n*s;if(d*o+f*l+g>=0&&d*u+f*c+g<=0||d*o+f*l+g<=0&&d*u+f*c+g>=0||d*o+f*c+g>=0&&d*u+f*l+g<=0||d*o+f*c+g<=0&&d*u+f*l+g>=0){if(o>u){const m=o;o=u,u=m}if(l<c){const m=l;l=c,c=m}return!(a<o&&n<o||a>u&&n>u||s>l&&r>l||s<c&&r<c)}else return!1}function n5(e,t,i){if(!e.next&&!t.prev)return r0(e,t,i);if(e.next&&t.prev)for(let s=.02;s<1;s+=.02){const n=co(s,e,e.next,t.prev,t);if(Xa(n,i))return!0}else if(e.next||t.prev)for(let s=.02;s<1;s+=.02){const n=Ha(s,e,e.next||t.prev,t);if(Xa(n,i))return!0}return!1}function yd(e,t,i,a,s){let n="";return e||(n+=`M${t.x} ${t.y} `,e=document.createElementNS("http://www.w3.org/2000/svg","path"),e.setAttribute("d",n)),n=e.getAttribute("d")||"",i&&a?n+=`C${i.x} ${i.y} ${a.x} ${a.y} ${s.x} ${s.y}`:i?n+=`Q${i.x} ${i.y} ${s.x} ${s.y}`:n+=`Q${(a==null?void 0:a.x)||t.x} ${(a==null?void 0:a.y)||t.y} ${s.x} ${s.y}`,e.setAttribute("d",n),e}function r5(e,t){const i=e.getTotalLength();if(t<0||t>i)return null;const a=Math.max(.01,i*1e-4),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}}function o5(e){const t=e.lineAnimateType;return t==null?!1:(Array.isArray(t)?t:[t]).some(a=>a===ie.Arrow||a===ie.WaterDrop)}function l5(e,t,i){e.beginPath(),e.moveTo(0,0),e.lineTo(-t,-i),e.moveTo(0,0),e.lineTo(-t,i),e.stroke()}function c5(e,t,i,a,s,n){e.save(),e.translate(t,i),e.rotate(a),l5(e,s,n),e.restore()}function pd(e,t,i){let a=0,s=t.length-1;for(;s-a>1;){const g=a+s>>1;t[g]<=i?a=g:s=g}const n=a,r=e[n],o=e[n+1],l=t[n+1]-t[n],u=l>1e-6?(i-t[n])/l:0,c=r.x+u*(o.x-r.x),d=r.y+u*(o.y-r.y),f=Math.atan2(o.y-r.y,o.x-r.x);return{x:c,y:d,ang:f}}function o0(e,t,i){var y,p,x,_,b,C;if(t.type!==Ut.Line||!(t.dirMarkers||i.options.dirMarkers)||t.calculative.pencil)return;const s=t.calculative.worldAnchors;if(!s||s.length<2||t.calculative.animatePos&&o5(t))return;const n=i.options.drawDirMarkers;e.save(),e.setLineDash([]),e.shadowBlur=0,e.shadowColor="",e.shadowOffsetX=0,e.shadowOffsetY=0;const r=eu(t);if(r.length<2){e.restore();return}const o=i.data.scale,l=((p=(y=t.dirMarkerInterval)!=null?y:i.options.dirMarkerInterval)!=null?p:40)*o,u=(_=(x=t.dirMarkerColor)!=null?x:i.options.dirMarkerColor)!=null?_:"#ffffff",c=t.calculative.lineWidth||2,d=((b=t.dirMarkerLineWidth)!=null?b:i.options.dirMarkerLineWidth)!=null?((C=t.dirMarkerLineWidth)!=null?C:i.options.dirMarkerLineWidth)*o:Math.min(c*.38,Math.max(.75,c*.14)),f=[0];let g=0;for(let P=0;P<r.length-1;P++){const S=r[P+1].x-r[P].x,B=r[P+1].y-r[P].y;g+=Math.sqrt(S*S+B*B),f.push(g)}if(g<=1e-6){e.restore();return}let m=[];for(let P=l/2;P<g;P+=l)m.push(P);if((m.length===0||m.length===1)&&(m=[g/2]),n){e.strokeStyle=u,e.lineWidth=d,e.lineJoin="round",e.lineCap="round";for(const P of m){const{x:S,y:B,ang:D}=pd(r,f,P);n(e,S,B,D,u,t)}}else{const S=Math.max(0,c-d)*.38,B=c*.52;e.strokeStyle=u,e.lineWidth=d,e.lineJoin="round",e.lineCap="round";for(const D of m){const{x:V,y:G,ang:F}=pd(r,f,D);c5(e,V,G,F,B,S)}}e.restore()}function Gi(e,t){if(!t)return;if(t.ex==null&&re(t),!t.rotate||t.rotate%360===0)return e.x>t.x&&e.x<t.ex&&e.y>t.y&&e.y<t.ey;t.center||te(t);const i=[{x:t.x,y:t.y},{x:t.ex,y:t.y},{x:t.ex,y:t.ey},{x:t.x,y:t.ey}];return i.forEach(a=>{Zt(a,t.rotate,t.pivot||t.center)}),u5(e,i)}function Xa(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 te(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 Pc(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 u5(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 Ei(e){const t=[];e.forEach(a=>{if(a.isRuleLine)return;const s=a.calculative.worldRect;if(s){const n=aa(s);t.push(...n)}});const i=Mn(t);return te(i),i}function aa(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||te(e),t.forEach(i=>{Zt(i,e.rotate,e.pivot||e.center)})),t}function Mn(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 ea(e,t,i){return e.rotate&&(e=Mn(aa(e))),i?e.x>t.x&&e.ex<t.ex&&e.y>t.y&&e.ey<t.ey:!(e.x>t.ex||e.ex<t.x||e.ey<t.y||e.y>t.ey)}function h5(e,t){return(t.x>e.ex||t.ex<e.x)&&(t.y>e.ey||t.ey<e.y)}function f5(e,t){const i=Qi(t),a={x:e.x-i[3],y:e.y-i[0],width:e.width+i[1]+i[3],height:e.height+i[0]+i[2]};return re(a),a}function Ua(e,t,i){e.x+=t,e.y+=i,e.ex+=t,e.ey+=i,e.center&&(e.center.x+=t,e.center.y+=i),e.pivot&&(e.pivot.x+=t,e.pivot.y+=i)}function d5(e,t){const i=(e.to.y-e.from.y)/(e.to.x-e.from.x),a=(t.to.y-t.from.y)/(t.to.x-t.from.x);return Rc({k:i,point:e.from},{k:a,point:t.from})}function Rc(e,t){if(kc(e.k,0))return{x:t.point.x,y:e.point.y};if(kc(t.k,0))return{x:e.point.x,y:t.point.y};const i=e.point.y-e.k*e.point.x,s=(t.point.y-t.k*t.point.x-i)/(e.k-t.k),n=e.k*s+i;return{x:s,y:n}}function g5(e,t){const i=d5({from:e[0],to:e[2]},{from:e[1],to:e[3]});for(const a of e)Zt(a,-t,i);return Mn(e)}function wd(e,t,i,a){let s=e.rotate?e.rotate%360:0;if(s){const n=aa(e),r=(n[0].y-n[1].y)/(n[0].x-n[1].x),o=(n[1].y-n[2].y)/(n[1].x-n[2].x);if(a<4){if(n[a].x+=t,e.ratio)if(a===0||a===2){let c=t*Math.tan((90-(360-s)-Math.atan(e.width/e.height)/Math.PI*180)/180*Math.PI);n[a].y+=c}else{let c=t*Math.tan((90-(360-s)+Math.atan(e.width/e.height)/Math.PI*180)/180*Math.PI);n[a].y+=c}else n[a].y+=i;const u=n[(a+2)%4];n[(a+1)%4]=Rc({k:a%2?o:r,point:n[a]},{k:a%2?r:o,point:u}),n[(a+4-1)%4]=Rc({k:a%2?r:o,point:n[a]},{k:a%2?o:r,point:u})}else{const u=[4,6].includes(a)?o:r;kc(u,0)?(n[a%4].x+=t,n[(a+1)%4].x+=t):(n[a%4].y+=i,n[a%4].x+=i/u,n[(a+1)%4].y+=i,n[(a+1)%4].x+=i/u)}if((n[0].x-n[1].x)**2+(n[0].y-n[1].y)**2<25||(n[1].x-n[2].x)**2+(n[1].y-n[2].y)**2<25)return;const l=g5(n,e.rotate);te(l),Object.assign(e,l);return}switch(a){case 0:if(e.width-t<5||e.height-i<5)break;e.x+=t,e.y+=i,e.width-=t,e.height-=i;break;case 1:if(e.width+t<5||e.height-i<5)break;e.ex+=t,e.y+=i,e.width+=t,e.height-=i;break;case 2:if(e.width+t<5||e.height+i<5)break;e.ex+=t,e.ey+=i,e.width+=t,e.height+=i;break;case 3:if(e.width-t<5||e.height+i<5)break;e.x+=t,e.ey+=i,e.width-=t,e.height+=i;break;case 4:if(e.height-i<5)break;e.y+=i,e.height-=i;break;case 5:if(e.width+t<5)break;e.ex+=t,e.width+=t;break;case 6:if(e.height+i<5)break;e.ey+=i,e.height+=i;break;case 7:if(e.width-t<5)break;e.x+=t,e.width-=t;break}}function Ds(e,t,i,a){!e||(e.width*=t,e.height*=t,Fs(e,t,i),re(e),te(e),a&&Pc(e,a))}function wa(e,t){const i={x:(e.x-t.x)/t.width,y:(e.y-t.y)/t.height,width:e.width/t.width,height:e.height/t.height};return re(i),i}function xn(e,t){const{x:i,y:a,width:s,height:n}=t,{penId:r,connectTo:o}=e,l=Object.assign({},e,{x:s?(e.x-i)/s:0,y:n?(e.y-a)/n:0});return e.prev&&(l.prev={penId:r,connectTo:o,x:s?(e.prev.x-i)/s:0,y:n?(e.prev.y-a)/n:0}),e.next&&(l.next={penId:r,connectTo:o,x:s?(e.next.x-i)/s:0,y:n?(e.next.y-a)/n:0}),l}function v5(e,t){let i=!1;for(let a=0,s=t.length-1;a<t.length;s=a++){let n=t[a].x,r=t[a].y,o=t[s].x,l=t[s].y;r>e.y!=l>e.y&&e.x<(o-n)*(e.y-r)/(l-r)+n&&(i=!i)}return i}const m5=/^[\t\n\f\r ]*([MLHVZCSQTAmlhvzcsqta])[\t\n\f\r ]*/,bd=/^[01]/,Qt=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,y5=/^(([\t\n\f\r ]+,?[\t\n\f\r ]*)|(,[\t\n\f\r ]*))/,p5={M:[Qt,Qt],L:[Qt,Qt],H:[Qt],V:[Qt],Z:[],C:[Qt,Qt,Qt,Qt,Qt,Qt],S:[Qt,Qt,Qt,Qt],Q:[Qt,Qt,Qt,Qt],T:[Qt,Qt],A:[Qt,Qt,Qt,bd,bd,Qt,Qt]};function w5(e){let t=0;const i=[];for(;t<e.length;){const a=e.slice(t).match(m5);if(a!==null){const s=a[1];t+=a[0].length;const n=E5(s,e,t);t=n.cursor,i.push(...n.commands)}else throw new Error("malformed path (first error at "+t+")")}return{commands:i}}function xd(e){let t=1/0,i=1/0,a=-1/0,s=-1/0;return C5(e),e.commands.forEach(n=>{n.worldPoints.forEach((r,o)=>{o%2===0?(r<t&&(t=r),r>a&&(a=r)):(r<i&&(i=r),r>s&&(s=r))})}),{x:t,y:i,ex:a,ey:s,width:a-t+1,height:s-i+1}}function b5(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 x5(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,o=Math.cos(r),l=Math.sin(r),u=n*n*i*i*o*o+s*s*i*i*l*l,c=2*t*i*o*l*(n*n-s*s),d=s*s*t*t*o*o+n*n*t*t*l*l,f=-(s*s*n*n*t*t*i*i),g=c*c-4*u*d,m=Math.sqrt((u-d)*(u-d)+c*c);a.values[2]=c!==0?Math.atan((d-u-m)/c)*180/Math.PI:u<d?0:90,a.values[0]=-Math.sqrt(2*g*f*(u+d+m))/g,a.values[1]=-Math.sqrt(2*g*f*(u+d-m))/g,a.values[5]*=t,a.values[6]*=i,a.values[4]=t*i>=0?a.values[4]:1-a.values[4];break;case"V":case"v":a.values[0]*=i;break;default:a.values.forEach((y,p)=>{a.values[p]=y*(p%2===0?t:i)});break}})}function _5(e){let t="";return e.commands.forEach(i=>{t+=i.key+" ",i.values.forEach(a=>{t+=a+" "})}),t}function E5(e,t,i){const a=p5[e.toUpperCase()],s=[];for(;i<=t.length;){const n={key:e,values:[]};for(const r of a){const o=t.slice(i).match(r);if(o!==null){n.values.push(+o[0]),i+=o[0].length;const l=t.slice(i).match(y5);l!==null&&(i+=l[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 A5(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<e.values.length-1;s+=2)i.push(a.x+e.values[s]),i.push(a.y+e.values[s+1]);e.worldPoints=i}function _d(e,t,i,a,s,n,r,o,l){const u=Math.cos(r),c=Math.sin(r),d=(e-i)/2,f=(t-a)/2,g=u*d+c*f,m=-c*d+u*f;let y=s*s,p=n*n;const x=g*g,_=m*m,b=x/y+_/p;if(b>1){const $=Math.sqrt(b);s*=$,n*=$,y=s*s,p=n*n}const C=Math.sqrt(Math.max(0,(y*p-y*_-p*x)/(y*_+p*x))),P=o===l?-C:C,S=P*s*m/n,B=-P*n*g/s,D=u*S-c*B+(e+i)/2,V=c*S+u*B+(t+a)/2;let G=Math.atan2(m-B,g-S),R=Math.atan2(-m-B,-g-S)-G;l===0&&R>0?R-=2*Math.PI:l===1&&R<0&&(R+=2*Math.PI);const T=[e,t];function L($){const Z=G+R;let at=$;const q=2*Math.PI,W=Math.floor((G-at)/q);at+=W*q;const j=1e-10;let K;if(R>0?(K=at>=G-j&&at<=Z+j||at+q>=G-j&&at+q<=Z+j,at+q>=G-j&&at+q<=Z+j&&(at+=q)):(K=at<=G+j&&at>=Z-j||at-q<=G+j&&at-q>=Z-j,at-q<=G+j&&at-q>=Z-j&&(at-=q)),K){const U=Math.cos(at),tt=Math.sin(at);T.push(D+s*U*u-n*tt*c),T.push(V+s*U*c+n*tt*u)}}if(Math.abs(u)>1e-10){const $=Math.atan(-n*c/(s*u));L($),L($+Math.PI)}else L(Math.PI/2),L(3*Math.PI/2);if(Math.abs(c)>1e-10){const $=Math.atan(n*u/(s*c));L($),L($+Math.PI)}else L(Math.PI/2),L(3*Math.PI/2);return T.push(i,a),T}function C5(e){let t,i=0,a=0;e.commands.forEach(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=_d(t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1],s.values[5],s.values[6],s.values[0],s.values[1],s.values[2]*Math.PI/180,s.values[3],s.values[4]);break;case"a":s.worldPoints=_d(t.worldPoints[t.worldPoints.length-2],t.worldPoints[t.worldPoints.length-1],t.worldPoints[t.worldPoints.length-2]+s.values[5],t.worldPoints[t.worldPoints.length-1]+s.values[6],s.values[0],s.values[1],s.values[2]*Math.PI/180,s.values[3],s.values[4]);break;default:A5(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 k5(e,t){var l;const a=e.calculative.canvas.store.data.paths[e.pathId];if(!a)return new Path2D;const s=w5(a);e.calculative.svgRect=xd(s),te(e.calculative.svgRect),(e.calculative.svgRect.width!==e.calculative.worldRect.width||e.calculative.svgRect.height!==e.calculative.worldRect.height)&&x5(s,e.calculative.worldRect.width/e.calculative.svgRect.width,e.calculative.worldRect.height/e.calculative.svgRect.height);const n=xd(s);te(n),b5(s,e.calculative.worldRect.x-n.x,e.calculative.worldRect.y-n.y);const r=_5(s);if(t){(l=t.svgPath)==null||l.call(t,r);return}return new Path2D(r)}function F5(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 P5(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 R5(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 S5(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 T5(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 B5(e,t){e.onResize||(e.onResize=I5);const i=t||new Path2D,{width:a,height:s,center:n}=e.calculative.worldRect,r=a>s?s:a,o=n.x,l=n.y,u=l-r/2,c=l-r/4,d=-(c-l)*Math.sin(Math.PI/180*324)+o,f=(c-l)*Math.cos(Math.PI/180*324)+l;i.moveTo(d,f);for(let g=0;g<5;++g)i.lineTo(-(u-l)*Math.sin(Math.PI/180*72*g)+o,(u-l)*Math.cos(Math.PI/180*72*g)+l),i.lineTo((d-o)*Math.cos(Math.PI/180*72*(g+1))-(f-l)*Math.sin(Math.PI/180*72*(g+1))+o,(d-o)*Math.sin(Math.PI/180*72*(g+1))+(f-l)*Math.cos(Math.PI/180*72*(g+1))+l);if(i.closePath(),i instanceof Path2D)return i}function l0(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 I5(e){const t=e.anchors.filter(i=>i.flag!==1);l0(e),e.anchors=e.anchors.concat(...t)}function D5(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 M5(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 L5(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 O5(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 N5(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ey:o}=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,o),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 z5(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 W5(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect,l=n/6;if(i.moveTo(a,s),i.lineTo(r-l,s),i.lineTo(r,s+l),i.lineTo(r,o),i.lineTo(a,o),i.closePath(),i.moveTo(r-l,s),i.lineTo(r-l,s+l),i.lineTo(r,s+l),i.closePath(),i instanceof Path2D)return i}function H5(e,t){const{x:i,y:a,width:s,ex:n,ey:r}=t.calculative.worldRect;let o=s*.25;const l=t.z;l>1?o=l*t.calculative.canvas.store.data.scale:l>0&&(o=s*l);const u={x:i,y:a+o},c={x:n-o,y:a+o},d={x:n-o,y:r};ac(e,[u,c,d,{x:i,y:r}],t.backgroundFront||t.background,t.color),ac(e,[u,{x:i+o,y:a},{x:n,y:a},c],t.backgroundUp||t.background,t.color),ac(e,[c,{x:n,y:a},{x:n,y:r-o},d],t.backgroundRight||t.background,t.color)}function ac(e,t,i="",a=""){e.save(),i&&(e.fillStyle=i),a&&(e.strokeStyle=a),e.beginPath();for(let s=0;s<t.length;++s)s?e.lineTo(t[s].x,t[s].y):e.moveTo(t[s].x,t[s].y);e.closePath(),i&&e.fill(),e.stroke(),e.restore()}function U5(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect,l=n/4,u=a+n/2;if(i.arc(u,s+l,l,0,Math.PI*2),i.moveTo(a,s+l*3),i.lineTo(r,s+l*3),i.moveTo(u,s+l*2),i.lineTo(u,s+l*4),i.moveTo(u,s+l*4),i.lineTo(a,o),i.moveTo(u,s+l*4),i.lineTo(r,o),i.closePath(),i instanceof Path2D)return i}let qe=10;function V5(e,t,i){var y;if(t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),qe=e.options.polylineSpace||10,t.calculative.worldAnchors.length<2)return;let a=ce(t),s=jt(t);if(!a||!s)return;let n;if(((y=t.anchors)==null?void 0:y.length)&&a===t.calculative.activeAnchor?(n=!0,a=s,s=ce(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;Jc(t);const o=[],l=e.pens[a.connectTo],u=e.pens[s.connectTo],c=Ns(a,l),d=Ns(s,u);let f=Ed(a,c,qe);f&&(a=f,o.push(f)),f=Ed(s,d,qe);const g=s;let m;if(f&&(s=f,g.connectTo&&(f.y>g.y&&a.y<g.y||f.y<g.y&&a.y>g.y))){m=f;let p=qe;a.x<f.x&&(p=-p),Math.abs(a.x-f.x)<p&&(p=-p),s={x:f.x+p,y:f.y,id:Tt()}}switch(c){case Rt.Up:o.push(...$5(a,s,d));break;case Rt.Right:o.push(...j5(a,s,d));break;case Rt.Bottom:o.push(...q5(a,s,d));break;case Rt.Left:o.push(...Y5(a,s,d));break;default:o.push(...K5(t,a,s));break}if(o.forEach(p=>{p.id=Tt(),p.penId=t.id,t.calculative.worldAnchors.push(p)}),t.calculative.worldAnchors.push(s),m&&t.calculative.worldAnchors.push(m),f&&t.calculative.worldAnchors.push(g),n&&t.calculative.worldAnchors.reverse(),r){const p=t.calculative.worldAnchors.length-2;t.calculative.worldAnchors[p].isTemp=!1,t.calculative.worldAnchors[1].isTemp=!1}}function Ed(e,t,i){const a={x:e.x,y:e.y,id:Tt()};switch(t){case Rt.Up:a.y-=i;break;case Rt.Right:a.x+=i;break;case Rt.Bottom:a.y+=i;break;case Rt.Left:a.x-=i;break;default:return}return a}function $5(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case Rt.Up:e.y<t.y?(s=t.x,n=e.y):(s=e.x,n=t.y),a.push({x:s,y:n});break;case Rt.Bottom:if(s=t.x,n=e.y,t.y>e.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 Rt.Right: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;case Rt.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(t.y>e.y-qe)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+qe)/2;a.push({x:e.x,y:r},{x:t.x,y:r})}break}return a}function j5(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case Rt.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 Rt.Bottom: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 Rt.Left:if(s=t.x,n=e.y,t.x<e.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:n},{x:r,y:t.y})}break;case Rt.Right:t.x<e.x?a.push({x:e.x,y:t.y}):a.push({x:t.x,y:e.y});break;default:if(s=t.x,n=t.y,t.x<e.x+qe)a.push({x:e.x,y:n});else{const r=(e.x+t.x-qe)/2;a.push({x:r,y:e.y},{x:r,y:n})}break}return a}function q5(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case Rt.Up:if(s=e.x,n=t.y,t.y<e.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:s,y:r},{x:t.x,y:r})}break;case Rt.Right: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;case Rt.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 Rt.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.y<e.y+qe)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-qe)/2;a.push({x:s,y:r},{x:t.x,y:r})}break}return a}function Y5(e,t,i){if(e.x===t.x||e.y===t.y)return[];const a=[];let s,n;switch(i){case Rt.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 Rt.Bottom: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 Rt.Right:if(s=e.x,n=t.y,t.x>e.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 Rt.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.x<e.x-qe){const r=(e.x+t.x+qe)/2;a.push({x:r,y:e.y},{x:r,y:n})}else a.push({x:e.x,y:n});break}return a}function K5(e,t,i){const a=[];e.calculative.drawlineH==null&&(e.calculative.drawlineH=Math.abs(i.x-t.x)>Math.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)<qe&&(i.isTemp=!0)):(a.push({x:t.x,y:i.y}),Math.abs(i.x-t.x)<qe&&(i.isTemp=!0))),a}function Ir(e,t,i=!0){var s,n;let a=e.calculative.worldAnchors;i||(a=[],e.calculative.worldAnchors.forEach(r=>{a.unshift(r)}));for(let r=0;r<a.length&&a[r].id!==t.id;r++)if(a[r].y!==t.y||a[r].x===((s=a[r+1])==null?void 0:s.x)&&a[r].y!==((n=a[r+1])==null?void 0:n.y))return!1;return!0}function Dr(e,t,i=!0){var s,n;let a=e.calculative.worldAnchors;i||(a=[],e.calculative.worldAnchors.forEach(r=>{a.unshift(r)}));for(let r=0;r<a.length&&a[r].id!==t.id;r++)if(a[r].x!==t.x||a[r].y===((s=a[r+1])==null?void 0:s.y)&&a[r].x!==((n=a[r+1])==null?void 0:n.x))return!1;return!0}function X5(e,t,i){if(!e.calculative.worldAnchors)return;const a=e.calculative.worldAnchors.findIndex(l=>l.id===t.id),s=ce(e),n=jt(e);let r=e.calculative.worldAnchors[a-1],o=e.calculative.worldAnchors[a+1];if(e.calculative.h==null&&(s.connectTo&&(Ir(e,t,!0)?e.calculative.h=!0:Dr(e,t,!0)&&(e.calculative.h=!1)),e.calculative.h==null&&n.connectTo&&(Ir(e,t,!1)?e.calculative.h=!0:Dr(e,t,!1)&&(e.calculative.h=!1)),e.calculative.h==null&&(r?e.calculative.h=r.y===t.y:o&&(e.calculative.h=o.y===t.y))),e.calculative.h){if(t.x=i.x,s.connectTo&&Ir(e,t,!0)){o&&o.y!==t.y&&(o.x=t.x);return}if(n.connectTo&&Ir(e,t,!1)){r&&r.y!==t.y&&(r.x=t.x);return}const l=e.anchors[a];let u;for(let c=a-1;c>-1;c--)if(r=e.anchors[c],u==null&&(u=r.y===l.y),u===!0)if(r.y===l.y)e.calculative.worldAnchors[c].y=i.y;else break;else if(r.x===l.x)e.calculative.worldAnchors[c].x=i.x;else break;u=void 0;for(let c=a+1;c<e.calculative.worldAnchors.length&&(o=e.anchors[c],o);c++)if(u==null&&(u=o.y===l.y),u===!0)if(o.y===l.y)e.calculative.worldAnchors[c].y=i.y;else break;else if(o.x===l.x)e.calculative.worldAnchors[c].x=i.x;else break;t.y=i.y}else{if(t.y=i.y,s.connectTo&&Dr(e,t,!0)){o&&o.x!==t.x&&(o.y=t.y);return}if(n.connectTo&&Dr(e,t,!1)){r&&r.x!==t.x&&(r.y=t.y);return}const l=e.anchors[a];let u;for(let c=a-1;c>-1;c--)if(r=e.anchors[c],u==null&&(u=r.x===l.x),u===!0)if(r.x===l.x)e.calculative.worldAnchors[c].x=i.x;else break;else if(r.y===l.y)e.calculative.worldAnchors[c].y=i.y;else break;u=void 0;for(let c=a+1;c<e.calculative.worldAnchors.length&&(o=e.anchors[c],o);c++)if(u==null&&(u=o.x===l.x),u===!0)if(o.x===l.x)e.calculative.worldAnchors[c].x=i.x;else break;else if(o.y===l.y)e.calculative.worldAnchors[c].y=i.y;else break;t.x=i.x}}function Sc(e,t,i,a){const s=[];let n,r,o,l,u,c,d,f,g,m,y,p,x,_;g=e[i],m=e[a],o=g.x,l=g.y,d=m.x-o,f=m.y-l,_=d*d+f*f,n=t;for(let b=i+1;b<a;b++)y=e[b],d!==0||f!==0?(p=((y.x-o)*d+(y.y-l)*f)/_,p>1?(u=y.x-m.x,c=y.y-m.y):p>0?(u=y.x-(o+d*p),c=y.y-(l+f*p)):(u=y.x-o,c=y.y-l)):(u=y.x-o,c=y.y-l),x=u*u+c*c,x>n&&(r=b,n=x);return n>t&&(r-i>1&&s.push(...Sc(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(...Sc(e,t,r,a))),s}function G5(e,t=.8,i=!1){if(e.length<3)return e;let a,s,n,r,o,l,u,c,d,f,g,m,y,p,x;const _=(b,C,P,S)=>(r=Math.sqrt(b*b+C*C),r>0?(m=b/r,p=C/r):(m=1,p=0),o=Math.sqrt(P*P+S*S),o>0?(y=P/o,x=S/o):(y=1,x=0),Math.acos(m*y+p*x));f=[],g=e.length,a=e[0],e[g-1],f.push({...e[0]});for(let b=0;b<g-1;b++){if(s=e[b],n=e[b+1],d=Math.abs(_(s.x-a.x,s.y-a.y,n.x-s.x,n.y-s.y)),r)if(d<t*3.14)if(i&&(r=Math.min(r,o),o=r),l=(m+y)/2,u=(p+x)/2,c=Math.sqrt(l*l+u*u),c===0)f.push({...s});else{l/=c,u/=c;const C={...s};C.prevNextType=qa.Bilateral,C.prev={penId:C.penId,x:s.x-l*r*.25,y:s.y-u*r*.25},C.next={penId:C.penId,x:s.x+l*o*.25,y:s.y+u*o*.25},f.push(C)}else f.push({...s});a=s}return f.push({...e[e.length-1]}),f}function c0(e,t){const i=t||new Path2D;let a=e.calculative.worldAnchors,s=e.calculative.canvas.store.data.scale,n=(e.calculative.animateLineWidth||6)*s,r=(e.animateLineWidth*2||12)*s;e.lineAnimateType===ie.WaterDrop&&(r=(e.animateLineWidth*4||24)*s);let o=(e.animateInterval||100)*s,l=e.calculative.lineWidth*(e.calculative.lineSmooth||0),u=(e.calculative.animateLineWidth/2||3)*s;if(e.animateReverse&&(r=-r,n=-n),a.length>1){let c,d=0;if(e.close&&(a=ot(a),a.push(a[0])),["polyline","line"].includes(e.lineName))for(let f=0;f<a.length;f++){let g=a[f];if(c){let m=un(c,g),y={x:c.x+(e.calculative.animatePos-d)%o*Math.cos(m*Math.PI/180),y:c.y-(e.calculative.animatePos-d)%o*Math.sin(m*Math.PI/180)};e.animateReverse&&(y={x:c.x+(e.length-(e.calculative.animatePos+d))%o*Math.cos(m*Math.PI/180),y:c.y-(e.length-(e.calculative.animatePos+d))%o*Math.sin(m*Math.PI/180)});let p=Math.sqrt((y.x-c.x)**2+(y.y-c.y)**2),x=Math.sqrt((g.x-c.x)**2+(g.y-c.y)**2);for(;p<x;)(e.animateReverse&&p-r<x||!e.animateReverse&&p>r)&&p>l+r&&x-p>l&&(e.lineAnimateType===ie.Arrow?hn(i,y,n,m,u,r):e.lineAnimateType===ie.WaterDrop&&fn(i,y,e.animateReverse,m,u,r)),y.x+=o*Math.cos(m*Math.PI/180),y.y-=o*Math.sin(m*Math.PI/180),p=Math.sqrt((y.x-c.x)**2+(y.y-c.y)**2)}c=g}else{let f,g=e.calculative.animatePos%o/o;g>1&&(g=1),e.animateReverse&&(g=1-g);let m=1/(a[0].lineLength/o),y=g*m,p;a.forEach(x=>{let _=x;if(f)if(m=1/(f.lineLength/o),f.next)if(_.prev)for(p=y;p<1;p+=m){let b=co(p,f,f.next,_.prev,_),C=co(p+.001,f,f.next,_.prev,_),P=un(b,C);e.lineAnimateType===ie.Arrow?hn(i,b,n,P,u,r):e.lineAnimateType===ie.WaterDrop&&fn(i,b,e.animateReverse,P,u,r)}else for(p=y;p<1;p+=m){let b=Ha(p,f,f.next,_),C=Ha(p+.001,f,f.next,_),P=un(b,C);e.lineAnimateType===ie.Arrow?hn(i,b,n,P,u,r):e.lineAnimateType===ie.WaterDrop&&fn(i,b,e.animateReverse,P,u,r)}else if(_.prev)for(p=y;p<1;p+=m){let b=Ha(p,f,_.prev,_),C=Ha(p+.001,f,_.prev,_),P=un(b,C);e.lineAnimateType===ie.Arrow?hn(i,b,n,P,u,r):e.lineAnimateType===ie.WaterDrop&&fn(i,b,e.animateReverse,P,u,r)}else{let b=un(f,_);for(p=y;p<1;p+=m){let C={x:f.x+(_.x-f.x)*p,y:f.y+(_.y-f.y)*p};e.lineAnimateType===ie.Arrow?hn(i,C,n,b,u,r):e.lineAnimateType===ie.WaterDrop&&fn(i,C,e.animateReverse,b,u,r)}}f=x,p?y=p-1:p=y})}}if(i instanceof Path2D)return i}function un(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 _a(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 hn(e,t,i,a,s,n){let r=_a({x:t.x+i,y:t.y+.57*i},{x:t.x,y:t.y},a),o=_a({x:t.x+i,y:t.y-.57*i},{x:t.x,y:t.y},a),l=_a({x:t.x+i,y:t.y+s/2},{x:t.x,y:t.y},a),u=_a({x:t.x+n,y:t.y+s/2},{x:t.x,y:t.y},a),c=_a({x:t.x+i,y:t.y-s/2},{x:t.x,y:t.y},a),d=_a({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(o.x,o.y),e.lineTo(c.x,c.y),e.lineTo(d.x,d.y),e.lineTo(u.x,u.y),e.lineTo(l.x,l.y),e.lineTo(r.x,r.y)}function fn(e,t,i,a,s,n){let r=s/2;i&&(r=-s/2);let o=_a({x:t.x,y:t.y+r},{x:t.x,y:t.y},a),l=_a({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(l.x,l.y),e.lineTo(o.x,o.y)}function u0(e){return e?!e.width||!e.height?!1:(e.x===void 0&&(e.x=(1-e.width)/2),e.y===void 0&&(e.y=(1-e.height)/2),!0):!1}function Z5(e){for(;e.childNodes.length>1;)e.removeChild(e.lastChild)}function xo(e){if(!u0(e.operationalRect))return;const t=e.calculative.singleton.div;if(!t)return;t.childNodes.length>1&&Z5(t);const i=navigator.userAgent.indexOf("Linux")>-1,a=document.createElement("div");a.style.position="absolute",a.style.left=e.operationalRect.x*100+"%",a.style.top="0px",a.style.width=e.operationalRect.width*100+"%",a.style.height=e.operationalRect.y*100+"%",!i&&e.blur&&(a.style["backdrop-filter"]=`blur(${e.blur}px)`),a.style.backgroundColor=e.blurBackground,t.appendChild(a);const s=document.createElement("div");s.style.position="absolute",s.style.right="0px",s.style.top="0px",s.style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",s.style.height="100%",!i&&e.blur&&(s.style["backdrop-filter"]=`blur(${e.blur}px)`),s.style.backgroundColor=e.blurBackground,t.appendChild(s);const n=document.createElement("div");n.style.position="absolute",n.style.left=e.operationalRect.x*100+"%",n.style.bottom="0px",n.style.width=e.operationalRect.width*100+"%",n.style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",!i&&e.blur&&(n.style["backdrop-filter"]=`blur(${e.blur}px)`),n.style.backgroundColor=e.blurBackground,t.appendChild(n);const r=document.createElement("div");r.style.position="absolute",r.style.left="0px",r.style.top="0px",r.style.width=e.operationalRect.x*100+"%",r.style.height="100%",!i&&e.blur&&(r.style["backdrop-filter"]=`blur(${e.blur}px)`),r.style.backgroundColor=e.blurBackground,t.appendChild(r);let o=()=>{iu(e)};a.onmouseenter=o,n.onmouseenter=o,s.onmouseenter=o,r.onmouseenter=o,t.onmouseleave=o}function J5(e){const t=e.calculative.singleton.div.children;t[1].style.height=e.operationalRect.y*100+"%",t[1].style.left=e.operationalRect.x*100+"%",t[1].style.width=e.operationalRect.width*100+"%",t[2].style.width=(1-e.operationalRect.x-e.operationalRect.width)*100+"%",t[3].style.height=(1-e.operationalRect.y-e.operationalRect.height)*100+"%",t[3].style.left=e.operationalRect.x*100+"%",t[3].style.width=e.operationalRect.width*100+"%",t[4].style.width=e.operationalRect.x*100+"%"}function iu(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 h0(e,t){if(!(!e.calculative.canvas.store.data.locked&&!e.locked)&&u0(e.operationalRect)&&e.calculative.zIndex<5&&t.x>e.x+e.width*e.operationalRect.x&&t.x<e.x+e.width*(e.operationalRect.x+e.operationalRect.width)&&t.y>e.y+e.height*e.operationalRect.y&&t.y<e.y+e.height*(e.operationalRect.y+e.operationalRect.height)&&e.calculative.singleton.div){let i=e.calculative.singleton.div.parentNode.children;for(let a=0;a<6;a++)i[a].style.pointerEvents="none"}}function f0(e,t){if(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=ot(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?xo(e):J5(e))}if(t.blur!==void 0)for(let i=1;i<5;i++)e.calculative.singleton.div.children[i]&&(e.calculative.singleton.div.children[i].style["backdrop-filter"]=`blur(${t.blur}px)`);if(t.blurBackground!==void 0)for(let i=1;i<5;i++)e.calculative.singleton.div.children[i]&&(e.calculative.singleton.div.children[i].style.backgroundColor=t.blurBackground)}const sa={};function _o(e){if(!e)return"";try{return new URL(e,window.location.href).searchParams.get("id")||e}catch{return e}}function Q5(){var e;for(const t in sa)(e=sa[t])==null||e.remove(),delete sa[t]}function t_(e){var t;for(const i in sa)e.some(a=>a.name=="iframe"&&_o(a.iframe)==i)||((t=sa[i])==null||t.remove(),delete sa[i])}function e_(e){const t=_o(e.iframe),i=sa[t];return i?(e.calculative.singleton.div=i,e.calculative.iframeKey=t,xo(e),!0):!1}function i_(e){var i;e.onDestroy||(e.onDestroy=a_,e.onMove=Mr,e.onResize=Mr,e.onRotate=Mr,e.onValue=Mr,e.onMouseMove=h0,e.onBeforeValue=s_,e.onRenderPenRaw=n_),e.calculative.singleton||(e.calculative.singleton={});const t=e.calculative.worldRect;if(!e.calculative.singleton.div){if(e_(e))return;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",(i=e.calculative.canvas.externalElements)==null||i.parentElement.appendChild(a),Pe(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,s.allowFullscreen=!0,e.calculative.iframe=e.iframe,e.calculative.iframeKey=_o(e.iframe),a.appendChild(s),xo(e)}return e.calculative.patchFlags&&Pe(e,e.calculative.singleton.div),e.onRenderPenRaw(e),new Path2D}function a_(e){iu(e),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.canvas.store.data.locked?(sa[e.calculative.iframeKey]=e.calculative.singleton.div,delete e.calculative.singleton.div):(e.calculative.singleton.div.remove(),sa[e.calculative.iframeKey]=null))}function Mr(e){e.calculative.singleton.div&&Pe(e,e.calculative.singleton.div)}function s_(e,t){if(t.iframe&&e.calculative.singleton.div){const i=_o(t.iframe),a=e.calculative.iframeKey;i!==a&&(e.calculative.singleton.div.children[0].src=t.iframe,e.calculative.iframe=t.iframe,e.calculative.iframeKey=i)}return f0(e,t),t}function n_(e){if(e.thumbImg&&!e.calculative.img){const t=new Image;t.crossOrigin=e.crossOrigin==="undefined"?void 0:e.crossOrigin||e.calculative.canvas.store.options.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 Ye={},Yr=['<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M473.088 125.44L256 256H52.224C23.552 256 0 279.552 0 308.224V716.8c0 28.16 23.04 51.2 51.2 51.2h204.8l217.088 130.56c16.896 10.24 38.912-2.048 38.912-22.016V147.456c0-19.968-21.504-32.256-38.912-22.016zM699.904 320.512c-20.992-18.944-53.248-17.408-72.192 3.584-18.944 20.992-17.408 53.248 3.584 72.192 0.512 0.512 58.368 54.784 58.368 121.344 0 37.888-19.456 74.752-58.368 110.08-20.992 18.944-22.528 51.2-3.584 72.192 10.24 11.264 24.064 16.896 37.888 16.896 12.288 0 24.576-4.608 34.304-13.312 61.44-55.296 92.16-117.76 92.16-185.856 0-112.64-88.576-193.536-92.16-197.12z" fill="" p-id="2434"></path><path d="M853.504 166.4c-20.992-18.944-53.248-16.896-72.192 4.096-18.944 20.992-16.896 53.248 4.096 72.192 1.536 1.024 135.68 122.88 135.68 280.576 0 90.624-45.568 177.152-135.68 257.536-20.992 18.944-23.04 51.2-4.096 72.192 10.24 11.264 24.064 16.896 38.4 16.896 12.288 0 24.576-4.096 34.304-12.8 112.64-100.864 169.984-212.992 169.984-333.824-1.024-202.752-163.84-350.208-170.496-356.864z"></path></svg>','<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" ><path d="M256 768H51.2c-28.16 0-51.2-23.04-51.2-51.2V308.224C0 279.552 23.552 256 52.224 256H256v512zM512 147.456v728.576c0 19.968-21.504 32.256-38.912 22.016L256 768V256l217.088-130.56c17.408-10.24 38.912 2.048 38.912 22.016zM623.104 656.896c-19.968-19.968-19.968-52.224 0-72.192l217.088-217.088c19.968-19.968 52.224-19.968 72.192 0 19.968 19.968 19.968 52.224 0 72.192l-217.088 217.088c-19.456 19.968-52.224 19.968-72.192 0z" fill="" p-id="2582"></path><path d="M623.104 367.104c19.968-19.968 52.224-19.968 72.192 0l217.088 217.088c19.968 19.968 19.968 52.224 0 72.192-19.968 19.968-52.224 19.968-72.192 0l-217.088-217.088c-19.968-19.456-19.968-52.224 0-72.192z"></path></svg>'];function r_(e){var t;if(e.onDestroy||(e.onDestroy=o_,e.onMove=sc,e.onResize=sc,e.onRotate=sc,e.onClick=Ad,e.onValue=c_,e.onChangeId=l_),Ye[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=Yr[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=Yr[0],e.calculative.media.muted=!1):(s.innerHTML=Yr[1],e.calculative.media.muted=!0)},e.calculative.singleton||(e.calculative.singleton={div:i}),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(),Ad(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.crossOrigin=e.crossOrigin||"anonymous",e.calculative.img=n),n.loop=e.playLoop,n.ontimeupdate=()=>{d0(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),Ye[e.id]=i,(t=e.calculative.canvas.externalElements)==null||t.parentElement.appendChild(i),Pe(e,i),e.autoPlay&&(n.autoplay=!0,n.muted=!0)}return e.calculative.patchFlags&&Pe(e,Ye[e.id]),new Path2D}function o_(e){Ye[e.id].onclick=null,Ye[e.id].remove(),Ye[e.id]=void 0}function sc(e){Pe(e,Ye[e.id]);const t=Ye[e.id].children[0],i=Ye[e.id].children[1];d0(t,i,e.calculative.worldRect.width)}function Ad(e){e.calculative.media&&(e.calculative.media.muted=!1,e.calculative.singleton.muted.innerHTML=Yr[0],e.calculative.media.paused?e.calculative.media.play():e.calculative.media.pause())}function d0(e,t,i){e.style.width=t.currentTime/t.duration*i+"px"}function l_(e,t,i){!Ye[t]||(Ye[i]=Ye[t],delete Ye[t])}function c_(e){const t=Ye[e.id];if(!t)return;Pe(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 Ni(){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 za{constructor(t,i){H(this,"parentElement");H(this,"store");H(this,"box");H(this,"text");H(this,"arrowUp");H(this,"arrowDown");H(this,"x");H(this,"y");H(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;s<document.styleSheets.length;s++)document.styleSheets[s].title==="le5le.com/tooltip"&&(a=document.styleSheets[s]);if(!a){let s=document.createElement("style");s.type="text/css",s.title="le5le.com/tooltip",document.head.appendChild(s),s=document.createElement("style"),s.type="text/css",document.head.appendChild(s),a=s.sheet,a.insertRule(".meta2d-tooltip{position:absolute;padding:8px 0;z-index:10;left: -9999px;top: -9999px;}"),a.insertRule(".meta2d-tooltip .text{max-width:320px;min-height:30px;max-height:400px;outline:none;padding:8px 16px;border-radius:4px;background:#777777;color:#ffffff;line-height:1.8;overflow-y:auto;}"),a.insertRule(".meta2d-tooltip .arrow{position:absolute;border:10px solid transparent;background:transparent;top:-5px;left:50%;transform:translateX(-50%)}"),a.insertRule(".meta2d-tooltip .arrow.down{top:initial;bottom: -1px;}")}}static getTitle(t){var a,s,n;if(t.titleFnJs&&!t.titleFn)try{t.titleFn=Te((n=(s=(a=t.calculative)==null?void 0:a.canvas)==null?void 0:s.store)==null?void 0:n.options,"pen",t.titleFnJs)}catch(r){console.log("titleFnJs",r)}const i=t.titleFn?t.titleFn(t):t.title;return i==null?void 0:String(i)}setText(t,i=za.getTitle(t)){const a=this.box.getBoundingClientRect();let s=globalThis.marked;if(!i)return a;const n=Ce(i);if(s){this.text.innerHTML=s(n);const r=this.text.getElementsByTagName("A");for(let o=0;o<r.length;++o)r[o].setAttribute("target","_blank")}else this.text.innerHTML=n;return a}updateText(t){var n;if(((n=this.currentPen)==null?void 0:n.id)!==t.id||za.titleEmpty(t)||t.titleUnUpdate)return;const i=za.getTitle(t);if(!i){this.hide();return}const a=this.setText(t,i),s=this.box.getBoundingClientRect();this.changePositionByText(a,s)}changePositionByText(t,i){this.x-=(i.width-t.width)/2,this.y-=i.height-t.height,this.box.style.left=this.x+"px",this.box.style.top=this.y+"px"}static titleEmpty(t){return!t.title&&!t.titleFn&&!t.titleFnJs}show(t,i){if(this.currentPen=t,za.titleEmpty(t)){let l=We(t,!0);l&&this.show(l,i);return}const a=za.getTitle(t);if(!a){this.hide();return}this.setText(t,a);const s=this.box.getBoundingClientRect(),n=t.calculative.worldRect;let r=t.calculative.canvas.store.data.x+i.x-s.width/2,o=t.calculative.canvas.store.data.y+i.y-s.height;t.type||(r=t.calculative.canvas.store.data.x+n.x-(s.width-n.width)/2,o=t.calculative.canvas.store.data.y+n.ey-s.height-n.height),o>0?(this.arrowUp.style.borderBottomColor="transparent",this.arrowDown.style.borderTopColor="#777777"):(o+=s.height+n.height+5,this.arrowUp.style.borderBottomColor="#777777",this.arrowDown.style.borderTopColor="transparent"),this.x=r,this.y=o,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 g0{constructor(t){H(this,"parent");H(this,"h");H(this,"v");H(this,"isDownH");H(this,"isDownV");H(this,"x");H(this,"y");H(this,"hSize");H(this,"vSize");H(this,"scrollX");H(this,"scrollY");H(this,"lastScrollX");H(this,"lastScrollY");H(this,"rect");H(this,"isShow");H(this,"isV");H(this,"padding");H(this,"pageMode");H(this,"onMouseDownH",t=>{t.preventDefault(),t.stopPropagation(),this.isDownH=t.x,this.x=this.parent.store.data.x||0,this.lastScrollX=this.scrollX});H(this,"onMouseDownV",t=>{t.preventDefault(),t.stopPropagation(),this.isDownV=t.y,this.y=this.parent.store.data.y||0,this.lastScrollY=this.scrollY});H(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.isV?this.parent.store.data.y=this.y-i*this.isV.h/this.parent.parentElement.clientHeight: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())});H(this,"onMouseUp",t=>{!this.isDownH&&!this.isDownV||(this.isDownH=void 0,this.isDownV=void 0,!this.isV&&(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<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le/scroll"&&(i=document.styleSheets[a]);if(!i){let a=document.createElement("style");a.type="text/css",a.title="le5le.com/scroll",document.head.appendChild(a),a=document.createElement("style"),a.type="text/css",document.head.appendChild(a),i=a.sheet,i.insertRule(".meta2d-scroll{position:absolute;width:8px;height:200px;background:#dddddd;border-radius:10px;z-index:20;cursor:default;}"),i.insertRule(".meta2d-scroll:hover{background:#cccccc;cursor:pointer}"),i.insertRule(".meta2d-scroll.v{right:0;top:calc(50% - 100px);}"),i.insertRule(".meta2d-scroll.h{bottom:2px;left:calc(50% - 100px);width:200px;height:8px;}")}this.init()}init(){this.isShow=!0,this.resize(),this.initPos(),this.getV()}getV(){const t=this.parent.store.data.width||this.parent.store.options.width,i=this.parent.store.data.height||this.parent.store.options.height;if(t&&i){const a=this.parent.store.data.scale;this.isV={w:t*a,h:i*a}}}canMouseMove(t){if(this.isV){let a=this.parent.store.data.origin;return t<0&&(Math.abs(a.y+this.parent.store.data.y-this.padding)<1||a.y+this.parent.store.data.y-this.padding>0)?(this.scrollY=0,this.v.style.top="0px",!0):t>0&&(Math.abs(a.y+this.isV.h-this.parent.height+this.parent.store.data.y-this.padding)<1||a.y+this.isV.h-this.parent.height+this.parent.store.data.y-this.padding<=0)?(this.parent.store.data.y=-(a.y+this.isV.h-this.parent.height+this.padding)-1,this.parent.onMovePens(),this.parent.canvasTemplate.init(),this.parent.canvasImage.init(),this.parent.canvasImageBottom.init(),this.parent.render(),!0):!1}const i=this.parent.parent.getRect();return t<0&&i.y+this.parent.store.data.y>=0||t>0&&i.ey-this.parent.height+this.parent.store.data.y<=0}changeMode(t){this.pageMode=!0,this.h.style.display="none";const i=this.parent.parent.getRect();if(i.height<this.parent.height&&(this.v.style.display="none"),this.isV){let a=i.height;this.padding=t||0,this.getV(),a=this.isV.h,this.v.style.top="0px",this.v.style.height=this.parent.parentElement.clientHeight/(a+this.padding||0)*this.parent.parentElement.clientHeight+"px",this.scrollY=0}}initPos(){this.scrollX=(this.parent.parentElement.clientWidth-this.hSize)/2,this.scrollY=(this.parent.parentElement.clientHeight-this.vSize)/2,this.h.style.left=`${this.scrollX}px`,this.v.style.top=`${this.scrollY}px`}resize(){this.rect=this.parent.parent.getRect(),this.rect.width<1400&&(this.rect.width=1400),this.rect.height<900&&(this.rect.height=900),this.parent.store.data.x>0?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;typeof t=="boolean"?t&&(i=-10):i=t,!(this.pageMode&&this.canMouseMove(i))&&(this.scrollY+=i,this.v.style.top=`${this.scrollY}px`,this.isV?this.parent.store.data.y-=i*this.isV.h/this.parent.parentElement.clientHeight: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 Cd{constructor(t,i,a){H(this,"parentElement");H(this,"store");H(this,"isBottom");H(this,"canvas",document.createElement("canvas"));H(this,"otherOffsreen",Ni());H(this,"offscreen",Ni());H(this,"animateOffsScreen",Ni());H(this,"fitOffscreen",Ni());H(this,"fitFlag",!1);H(this,"currentFit");H(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 o of this.store.data.pens)this.hasImage(o)&&(this.store.animates.has(o)?i=!0:o.calculative.imageDrawed||(t=!0),o.parentId&&this.store.animates.has(We(o,!0))&&(i=!0));const a=this.store.patchFlagsBackground,s=this.store.patchFlagsTop;if(s&&!this.isBottom){const o=this.otherOffsreen.getContext("2d");o.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderRule(o)}if(this.store.patchFlagsLast&&this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),t){const o=this.offscreen.getContext("2d");o.save(),o.clearRect(0,0,this.canvas.width,this.canvas.height),o.translate(this.store.data.x,this.store.data.y);for(const l of this.store.data.pens)!l.calculative.hasImage||this.store.animates.has(l)||this.store.animates.has(We(l,!0))||l.canvasLayer!==zt.CanvasTemplate&&(l.calculative.imageDrawed=!0,o.save(),Ya(o,l),(l.rotateByRoot||l.calculative.rotate)&&ia(o,l),Ka(o,l),Bs(o,l),o.restore());o.restore()}if(i){const o=this.animateOffsScreen.getContext("2d");o.save(),o.clearRect(0,0,this.canvas.width,this.canvas.height),o.translate(this.store.data.x,this.store.data.y);for(const l of this.store.animates)!l.calculative.hasImage||l.canvasLayer!==zt.CanvasTemplate&&(l.visible===!1||l.calculative.visible===!1||(l.calculative.imageDrawed=!0,o.save(),Ya(o,l),(l.rotateByRoot||l.calculative.rotate)&&ia(o,l),Ka(o,l),Bs(o,l),o.restore()));for(const l of this.store.data.pens)!l.calculative.hasImage||!l.parentId||l.canvasLayer!==zt.CanvasTemplate&&(l.visible===!1||l.calculative.visible===!1||this.store.animates.has(We(l,!0))&&(l.calculative.imageDrawed=!0,o.save(),Ya(o,l),(l.rotateByRoot||l.calculative.rotate)&&ia(o,l),Ka(o,l),Bs(o,l),o.restore()));o.restore()}if(!this.isBottom&&!this.store.data.locked&&this.fitFlag){const o=(this.store.data.width||this.store.options.width)*this.store.data.scale,l=(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,d=this.fitOffscreen.getContext("2d");d.save(),d.clearRect(0,0,this.canvas.width,this.canvas.height),d.fillStyle="#ffffff66",d.strokeStyle=this.store.styles.activeColor,(r=this.store.data.fits)==null||r.forEach((f,g)=>{d.fillRect(u+o*f.x,c+l*f.y,o*f.width,l*f.height),f.active&&d.strokeRect(u+o*f.x,c+l*f.y,o*f.width,l*f.height)}),d.restore()}if(t||i||a&&this.isBottom||s&&!this.isBottom){const o=this.canvas.getContext("2d");o.clearRect(0,0,this.canvas.width,this.canvas.height),this.isBottom&&(this.store.patchFlagsBackground=!1),o.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),o.drawImage(this.animateOffsScreen,0,0,this.canvas.width,this.canvas.height),this.isBottom||(o.drawImage(this.otherOffsreen,0,0,this.canvas.width,this.canvas.height),this.store.patchFlagsTop=!1,!this.store.data.locked&&this.fitFlag&&o.drawImage(this.fitOffscreen,0,0,this.canvas.width,this.canvas.height))}}renderRule(t){var b,C,P,S,B,D,V,G;const{data:i,options:a}=this.store,{rule:s,ruleColor:n,scale:r,origin:o}=i;if(!(s!=null?s:a.rule))return;const l=r*10;t.save();const u=n||a.ruleColor||"#ccc";t.strokeStyle=eo(u,.7);const c=o.x+i.x,d=o.y+i.y,{width:f,height:g}=this.canvas;let m=((b=a.ruleOptions)==null?void 0:b.height)||20;(C=a.ruleOptions)!=null&&C.background&&(t.beginPath(),t.fillStyle=(P=a.ruleOptions)==null?void 0:P.background,t.rect(0,0,f,m),t.fill(),t.rect(0,0,m,g),t.fill()),(S=a.ruleOptions)!=null&&S.underline&&(t.beginPath(),t.fillStyle=eo(u,.7),t.moveTo(0,m),t.lineTo(f,m),t.stroke(),t.moveTo(m,0),t.lineTo(m,g),t.stroke());let y=m/4;((B=a.ruleOptions)==null?void 0:B.baseline)==="bottom"&&(y=m*3/4),t.beginPath(),t.lineWidth=m/2,t.lineDashOffset=-c%l,t.setLineDash([1,l-1]),t.moveTo(0,y),t.lineTo(f,y),t.stroke(),t.beginPath(),t.lineDashOffset=-d%l,t.moveTo(y,0),t.lineTo(y,g),t.stroke(),t.strokeStyle=u,t.beginPath(),t.lineWidth=m,t.lineDashOffset=-c%(l*10),t.setLineDash([1,l*10-1]),t.moveTo(0,m/2),t.lineTo(f,m/2),t.stroke(),t.beginPath(),t.lineDashOffset=-d%(l*10),t.moveTo(m/2,0),t.lineTo(m/2,g),t.stroke(),t.beginPath(),t.fillStyle=((D=a.ruleOptions)==null?void 0:D.textColor)||t.strokeStyle;let p=0-Math.floor(c/l/10)*100,x=((V=a.ruleOptions)==null?void 0:V.textTop)||16,_=((G=a.ruleOptions)==null?void 0:G.textLeft)||4;c<0&&(p-=100);for(let F=c%(l*10);F<f;F+=10*l,p+=100)l<3&&p%500||t.fillText(p.toString(),F+_,x);p=0-Math.floor(d/l/10)*100,d<0&&(p-=100);for(let F=d%(l*10);F<g;F+=10*l,p+=100)l<3&&p%500||(t.save(),t.beginPath(),t.translate(x,F-_),t.rotate(270*Math.PI/180),t.fillText(p.toString(),0,0),t.restore());t.restore()}}class u_{constructor(t,i,a){H(this,"parentCanvas");H(this,"parentElement");H(this,"store");H(this,"canvas",document.createElement("canvas"));H(this,"magnifierScreen",Ni());H(this,"offscreen",Ni());H(this,"domOffscreen",Ni());H(this,"magnifierSize",300);H(this,"magnifier");this.parentCanvas=t,this.parentElement=i,this.store=a,i.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",this.canvas.style.pointerEvents="none"}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.offscreen.width=t,this.offscreen.height=i,this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.domOffscreen.width=t,this.domOffscreen.height=i,this.domOffscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.domOffscreen.getContext("2d").textBaseline="middle",this.magnifierScreen.width=this.magnifierSize+5,this.magnifierScreen.height=this.magnifierSize+5}renderMagnifier(){if(!this.magnifier)return;const t=this.magnifierSize/2,i=this.magnifierSize+5,a=this.magnifierScreen.getContext("2d");a.clearRect(0,0,i,i),a.lineWidth=5,a.save(),a.translate(2.5,2.5),a.save(),a.arc(t,t,t,0,Math.PI*2,!1),a.clip(),a.translate(-t,-t),a.scale(2,2);const s={x:(this.parentCanvas.mousePos.x+this.store.data.x)*this.store.dpiRatio,y:(this.parentCanvas.mousePos.y+this.store.data.y)*this.store.dpiRatio};[this.parentCanvas.canvasTemplate.bgOffscreen,this.parentCanvas.canvasTemplate.offscreen,this.parentCanvas.canvasImageBottom.offscreen,this.parentCanvas.canvasImageBottom.animateOffsScreen,this.parentCanvas.offscreen,this.parentCanvas.canvasImage.offscreen,this.parentCanvas.canvasImage.animateOffsScreen,this.domOffscreen].forEach(l=>{a.drawImage(l,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 v0(e){if(e.data.locked)throw new Error("canvas is locked")}class h_{constructor(t,i){H(this,"parentElement");H(this,"box");H(this,"iframe");H(this,"dialog");H(this,"close");H(this,"title");H(this,"body");H(this,"x");H(this,"y");H(this,"url");H(this,"meta2dDiv");H(this,"dialogMeta2d");H(this,"store");H(this,"data");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=`
  3. <svg fill="none" viewBox="0 0 16 16" width="1em" height="1em">
  4. <path
  5. fill="currentColor"
  6. d="M8 8.92L11.08 12l.92-.92L8.92 8 12 4.92 11.08 4 8 7.08 4.92 4 4 4.92 7.08 8 4 11.08l.92.92L8 8.92z"
  7. fill-opacity="0.9"
  8. ></path>
  9. </svg>`,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<document.styleSheets.length;n++)document.styleSheets[n].title==="le5le.com/dialog"&&(s=document.styleSheets[n]);if(!s){let n=document.createElement("style");n.type="text/css",n.title="le5le.com/dialog",document.head.appendChild(n),n=document.createElement("style"),n.type="text/css",document.head.appendChild(n),s=n.sheet,s.insertRule(`.meta2d-dialog_mask {
  10. display: none;
  11. position: absolute;
  12. top: 0%;
  13. left: 0%;
  14. width: 100%;
  15. height: 100%;
  16. background-color: #0000006f;
  17. z-index: 9999;`),s.insertRule(`.meta2d-dialog_mask .meta2d-dialog {
  18. position: absolute;
  19. top: 15vh;
  20. left: 10%;
  21. width: 80%;
  22. height:420px;
  23. padding: 16px 20px;
  24. border-radius: 9px;
  25. z-index: 19999;
  26. overflow: auto;
  27. }`),s.insertRule(`.meta2d-dialog_header {
  28. display: flex;
  29. position: relative;
  30. z-index: 999;
  31. }`),s.insertRule(`.meta2d-dialog-content {
  32. width: calc(100% - 20px);
  33. font-weight: 600;
  34. font-size: 14px;
  35. color: #bdc7db;
  36. padding-bottom:8px;
  37. }`),s.insertRule(`.meta2d-dialog-close {
  38. width: 20px;
  39. height: 20px;
  40. line-height: 20px;
  41. text-align: center;
  42. color: #617b91;
  43. position: absolute;
  44. right:20px;
  45. top:2px;
  46. display:none;
  47. }`),s.insertRule(`.meta2d-dialog-close svg{
  48. width: 18px;
  49. height: 18px;
  50. }`),s.insertRule(`.meta2d-dialog-close :hover{
  51. cursor: pointer;
  52. }`),s.insertRule(`.meta2d-dialog_body{
  53. width: 100%;
  54. height: 100%;
  55. } `),s.insertRule(`.meta2d-dialog_body iframe{
  56. width: 100%;
  57. height: 100%;
  58. }`),s.insertRule(`.meta2d-dialog_body .meta2d-dialog-meta2d{
  59. width: 100%;
  60. height: 100%;
  61. display: none;
  62. }`)}}async show(t,i,a,s){if(!i)return;if(this.data=s,t&&(this.title.innerText=t&&Ce(t)),t?(this.dialog.style.padding="16px 20px",this.title.style.display="block",this.body.style.height="calc(100% - 30px)",this.close.style.top=((a==null?void 0:a.closeTop)||2)+"px",this.close.style.right=((a==null?void 0:a.closeRight)||2)+"px",this.dialog.style.background=(a==null?void 0:a.background)||this.store.data.background||"#1e2430"):(this.dialog.style.padding="0px",this.title.style.display="none",this.body.style.height="100%",this.body.style.overflow="hidden",this.close.style.top=((a==null?void 0:a.closeTop)||18)+"px",this.close.style.right=((a==null?void 0:a.closeRight)||20)+"px",this.body.style.background="transparent"),this.box.style.display="block",a){const{x:l,y:u,width:c,height:d}=this.detailRect(a);this.dialog.style.width=c,this.dialog.style.height=d,this.dialog.style.top=u,this.dialog.style.left=l,this.dialog.style.transform=`translate(${l==="50%"?"-50%":0}, ${u==="50%"?"-50%":0})`,this.box.style.background=a.maskBackground||"#0000006f"}const n=this.isUrl(i);let r=!1;n?(this.meta2dDiv.style.display="none",this.iframe.style.display="block"):(this.iframe.style.display="none",this.meta2dDiv.style.display="block"),n&&i!==this.url&&(this.iframe.setAttribute("src",i),this.url=i,r=!0);const o=()=>{this.close.style.display=a!=null&&a.hideClose?"none":"block",this.box.style.opacity="1"};if(this.iframe.onload=()=>{n&&o()},(!n||!r)&&o(),!n){this.meta2dDiv.style.display="block",this.dialogMeta2d||(globalThis.mainMeta2d=globalThis.meta2d,this.dialogMeta2d=new EE(this.meta2dDiv),globalThis.meta2d=globalThis.mainMeta2d);const l=await qc(this.store,i);l&&(this.box.style.display="block",this.dialogMeta2d.clear(!0),this.dialogMeta2d.open(l,!1),this.dialogMeta2d.lock(1),this.dialogMeta2d.resize(),this.dialogMeta2d.fitView(!0,0),this.dialogMeta2d.render(!0))}}detailRect(t){var o,l,u,c,d,f;const i=this.formatRectValue(t==null?void 0:t.x),a=this.formatRectValue(t==null?void 0:t.y),s=this.formatRectValue(t==null?void 0:t.width),n=this.formatRectValue(t==null?void 0:t.height),r=t!=null&&t.relative?(l=(o=t.pen)==null?void 0:o.calculative)==null?void 0:l.worldRect:void 0;if(r){const g=(c=(u=r.center)==null?void 0:u.x)!=null?c:r.x+r.width/2,m=(f=(d=r.center)==null?void 0:d.y)!=null?f:r.y+r.height/2;return{x:`calc(${g+this.store.data.x}px + ${i||"0px"})`,y:`calc(${m+this.store.data.y}px + ${a||"0px"})`,width:s||"80%",height:n||"420px"}}return{x:i||"50%",y:a||"50%",width:s||"80%",height:n||"420px"}}formatRectValue(t){if(t==null||t==="")return;if(typeof t=="number")return t+"px";const i=t.trim();if(!isNaN(Number(i)))return Number(i)+"px";if(/^-?\d+(\.\d+)?(px|vh|vw|%)$/.test(i)||/^(calc|min|max|clamp)\(.+\)$/.test(i))return i;const a=parseFloat(i);return isNaN(a)?void 0:a+"px"}hide(){var t;(t=this.dialogMeta2d)==null||t.clear(!1),this.box.style.display="none",this.box.style.opacity="0",this.iframe.onload=null,this.iframe.setAttribute("src","about:blank"),this.url="about:blank"}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 fo{constructor(t){H(this,"parentElement");H(this,"box");H(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<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le.com/title"&&(i=document.styleSheets[a]);if(!i){let a=document.createElement("style");a.type="text/css",a.title="le5le.com/title",document.head.appendChild(a),a=document.createElement("style"),a.type="text/css",document.head.appendChild(a),i=a.sheet,i.insertRule(".meta2d-title{position:absolute;padding:0;z-index:10;left: -9999px;top: -9999px;background:#fff;color:#000; cursor: crosshair;border: 1px solid black;max-width:300px;overflow-wrap: break-word;}")}}static getTitle(t){}setText(t){this.box.innerText=t.title?Ce(t.title):t.title}updateText(t){var i;((i=this.currentAnchor)==null?void 0:i.id)===t.id&&(fo.titleEmpty(t)||(this.setText(t),this.changePositionByAnchor(t)))}changePositionByAnchor(t){let i=this.parentElement.clientWidth,a=this.parentElement.clientHeight;t.x+20+300>i?(this.box.style.right=i-t.x+"px",this.box.style.left="auto"):(this.box.style.left=t.x+10+"px",this.box.style.right="auto"),t.y+10+100>a?(this.box.style.bottom=a-t.y+"px",this.box.style.top="auto"):(this.box.style.top=t.y+10+"px",this.box.style.bottom="auto")}static titleEmpty(t){return!t.title}show(t,i){if(fo.titleEmpty(t))return;this.currentAnchor=t,this.setText(t);let a={x:i.calculative.canvas.store.data.x+t.x,y:i.calculative.canvas.store.data.y+t.y};this.changePositionByAnchor(a)}hide(){this.box.style.left="-9999px",this.box.innerText="",this.currentAnchor=null}destroy(){this.box.onmouseleave=null}}function f_(e,{area:t,align:i,size:a,color:s,rotate:n},r){if(e.lineWidth=1,e.strokeStyle=s,n){const o=n*Math.PI/180,l=o+Math.PI/2,u={x:Math.sin(o),y:-Math.cos(o)},c={x:Math.sin(l),y:-Math.cos(l)};kd(e,t,a,u),kd(e,t,a,c)}else{const o=i.x/a,l=i.y/a,u=a*10,c=i.x-Math.ceil(o)*a,d=i.y-Math.ceil(l)*a,f=t.x+t.width+u,g=t.y+t.height+u;e.beginPath();for(let m=c;m<=f;m+=a)e.moveTo(m,d),e.lineTo(m,t.y+t.height+u);for(let m=d;m<=g;m+=a)e.moveTo(c,m),e.lineTo(t.x+t.width+u,m);e.stroke()}return!1}function kd(e,t,i,a,s){const n=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let r=1/0,o=-1/0;n.forEach(u=>{const c=u.x*a.x+u.y*a.y;r=Math.min(r,c),o=Math.max(o,c)});const l=Math.ceil((o-r)/i);e.beginPath();for(let u=0;u<=l;u++){const c=r+u*i;let d=[];for(let f=0;f<n.length;f++){const g=n[f],m=n[(f+1)%n.length],y=a.x*(m.y-g.y)-a.y*(m.x-g.x);if(Math.abs(y)>1e-6){const p=(c-g.x*a.x-g.y*a.y)/(a.x*(m.x-g.x)+a.y*(m.y-g.y));if(p>=0&&p<=1){const x=g.x+p*(m.x-g.x),_=g.y+p*(m.y-g.y);d.push({x,y:_})}}}d.length>=2&&(e.moveTo(d[0].x,d[0].y),e.lineTo(d[1].x,d[1].y))}e.stroke()}function d_(e,{store:t,area:i,align:a,size:s,color:n},r){const o=n;e.fillStyle=o;const l=Math.max(.5,1.5*t.data.scale),u=a.x/s,c=a.y/s,d=s*10,f=a.x-Math.ceil(u)*s,g=a.y-Math.ceil(c)*s,m=i.x+i.width+d,y=i.y+i.height+d;for(let p=f+l;p<=m-l;p+=s)for(let x=g+l;x<=y-l;x+=s)e.beginPath(),e.arc(p,x,l,0,Math.PI*2),e.fill();return!0}class g_{constructor(t,i,a){H(this,"parentElement");H(this,"store");H(this,"canvas",document.createElement("canvas"));H(this,"offscreen",Ni());H(this,"bgOffscreen",Ni());H(this,"patchFlags");H(this,"bgPatchFlags");H(this,"parentCanvas");H(this,"fit");this.parentElement=t,this.store=i,t.appendChild(this.canvas),this.parentCanvas=a,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",wt.gridDrawers.default||(wt.gridDrawers.default=f_),wt.gridDrawers.dot||(wt.gridDrawers.dot=d_)}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.bgOffscreen.width=t,this.bgOffscreen.height=i,this.offscreen.width=t,this.offscreen.height=i,this.bgOffscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.bgOffscreen.getContext("2d").textBaseline="middle",this.offscreen.getContext("2d").scale(this.store.dpiRatio,this.store.dpiRatio),this.offscreen.getContext("2d").textBaseline="middle",this.init()}init(){this.bgOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.patchFlags=!0,this.bgPatchFlags=!0}hidden(){this.canvas.style.display="none"}show(){this.canvas.style.display="block"}clear(){this.bgOffscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.offscreen.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),this.bgPatchFlags=!0,this.patchFlags=!0}render(){var t;if(this.bgPatchFlags){const i=this.bgOffscreen.getContext("2d");i.clearRect(0,0,this.canvas.width,this.canvas.height);const a=this.store.data.width||this.store.options.width,s=this.store.data.height||this.store.options.height,n=this.store.data.x||this.store.options.x||0,r=this.store.data.y||this.store.options.y||0,o=this.store.data.background||this.store.styles.background;o&&(i.save(),i.fillStyle=o,i.globalAlpha=(t=this.store.data.globalAlpha)!=null?t:this.store.options.globalAlpha,a&&s&&!this.fit?(i.shadowOffsetX=this.store.options.shadowOffsetX,i.shadowOffsetY=this.store.options.shadowOffsetY,i.shadowBlur=this.store.options.shadowBlur,i.shadowColor=this.store.options.shadowColor,i.fillRect(this.store.data.origin.x+n,this.store.data.origin.y+r,a*this.store.data.scale,s*this.store.data.scale)):i.fillRect(0,0,this.canvas.width,this.canvas.height),i.restore()),a&&s&&this.store.bkImg&&(i.save(),this.fit?i.drawImage(this.store.bkImg,0,0,this.canvas.offsetWidth,this.canvas.offsetHeight):i.drawImage(this.store.bkImg,this.store.data.origin.x+n,this.store.data.origin.y+r,a*this.store.data.scale,s*this.store.data.scale),i.restore()),this.renderGrid(i)}if(this.patchFlags){const i=this.offscreen.getContext("2d");i.save(),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.translate(this.store.data.x,this.store.data.y);for(const a of this.store.data.pens)!isFinite(a.x)||a.canvasLayer===zt.CanvasTemplate&&a.calculative.inView&&(Oa(i,a),a.image&&a.name!=="gif"&&a.calculative.img&&(i.save(),Ya(i,a),(a.rotateByRoot||a.calculative.rotate)&&ia(i,a),Ka(i,a),Bs(i,a),i.restore()));i.restore()}if(this.patchFlags||this.bgPatchFlags){const i=this.canvas.getContext("2d");i.clearRect(0,0,this.canvas.width,this.canvas.height),i.drawImage(this.bgOffscreen,0,0,this.canvas.width,this.canvas.height),i.drawImage(this.offscreen,0,0,this.canvas.width,this.canvas.height),this.patchFlags=!1,this.bgPatchFlags=!1}}renderGrid(t){const{data:i,options:a}=this.store,s={x:this.parentCanvas.mousePos.x+this.parentCanvas.store.data.x,y:this.parentCanvas.mousePos.y+this.parentCanvas.store.data.y},{grid:n}=i;if(!(n!=null?n:a.grid))return;const{gridRotate:r,gridColor:o,gridSize:l,scale:u,origin:c,gridScope:d}=i;let f=(l||a.gridSize)*u;f=f<0?0:f;const g=(i.width||a.width)*u,m=(i.height||a.height)*u,y=(i.x||a.x||0)+c.x,p=(i.y||a.y||0)+c.y,x=this.store.dpiRatio,_=this.canvas.width/x,b=this.canvas.height/x,C=d||a.gridScope,P=g&&m;t.save();let S;C==="full"?S={x:0,y:0,width:_,height:b}:C==="inner"?P?(S={x:y,y:p,width:g,height:m},t.beginPath(),t.rect(y,p,g,m),t.clip()):S={x:0,y:0,width:_,height:b}:C==="outer"?(S={x:0,y:0,width:_,height:b},P&&(t.beginPath(),t.rect(0,0,_,b),t.rect(y,p,g,m),t.clip("evenodd"))):P?(S={x:y,y:p,width:g,height:m},t.beginPath(),t.rect(y,p,g,m),t.clip()):S={x:0,y:0,width:_,height:b};const B={store:this.store,canvas:this.canvas,area:S,align:{x:y,y:p},size:f,color:o||a.gridColor,rotate:r,scale:u,mousePos:s},D=i.gridType||a.gridType||"default",V=wt.gridDrawers[D]||wt.gridDrawers.default;V&&(this.parentCanvas.store.options.gridAlwaysRender=V(t,B,s)),t.restore()}}const v_={success:{},info:{icon:'<svg fill="none" viewBox="0 0 24 24"><path fill="#0052d9" d="M12 23a11 11 0 100-22 11 11 0 000 22zM11 8.5v-2h2v2h-2zm2 1.5v7.5h-2V10h2z"></path></svg>'},warning:{},error:{}};class m_{constructor(t,i){H(this,"parentElement");H(this,"store");H(this,"box");H(this,"text");H(this,"arrowUp");H(this,"arrowDown");H(this,"icon");H(this,"confirm");H(this,"cancel");H(this,"x");H(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=Ce("\u786E\u5B9A"),this.cancel.innerHTML=Ce("\u53D6\u6D88"),this.icon.innerHTML=v_.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;s<document.styleSheets.length;s++)document.styleSheets[s].title==="le5le.com/popconfirm"&&(a=document.styleSheets[s]);if(!a){let s=document.createElement("style");s.type="text/css",s.title="le5le.com/popconfirm",document.head.appendChild(s),s=document.createElement("style"),s.type="text/css",document.head.appendChild(s),a=s.sheet,a.insertRule(".meta2d-popconfirm{position:absolute;z-index:999;left: -9999px;top: -9999px;padding:16px;max-width:400px;background:#fff;border-radius:6px;box-shadow:0 3px 14px 2px rgba(0, 0, 0, .05),0 8px 10px 1px rgba(0, 0, 0, 6%),0 5px 5px -3px rgba(0, 0, 0, 10%);}"),a.insertRule(".meta2d-popconfirm .text{outline:none;padding:0px 0px 40px 28px;border-radius:4px;color:rgba(0, 0, 0, 0.9);overflow-y:auto;line-height:22px;font-size:13px;}"),a.insertRule(".meta2d-popconfirm .arrow{position:absolute;border:10px solid transparent;background:transparent;top:-18px;left:50%;transform:translateX(-50%)}"),a.insertRule(".meta2d-popconfirm .arrow.down{top:initial;bottom: -18px;}"),a.insertRule(".meta2d-popconfirm .icon{position:absolute;width:22px;height:22px;left:16px;top:16px;}"),a.insertRule(".meta2d-popconfirm .confirm{position:absolute;right:16px;bottom:16px;width:40px;height:24px;text-align:center;background:#4582e6;color:#fff;border-radius:3px;border-color:transparent}"),a.insertRule(".meta2d-popconfirm .confirm:hover{background:#003cab;}"),a.insertRule(".meta2d-popconfirm .cancel{position:absolute;right:64px;bottom:16px;width:40px;height:24px;text-align:center;background:#dcdcdc;color:rgba(0, 0, 0, 0.9);border-radius:3px;border-color:transparent}"),a.insertRule(".meta2d-popconfirm .cancel:hover{background:#a6a6a6;}")}}show(t,i){if(!t)return;const a=this.box.getBoundingClientRect(),s=t.calculative.worldRect;let n=t.calculative.canvas.store.data.x+i.x-a.width/2,r=t.calculative.canvas.store.data.y+i.y-a.height-20;t.type||(n=t.calculative.canvas.store.data.x+s.x-(a.width-s.width)/2,r=t.calculative.canvas.store.data.y+s.ey-a.height-s.height),r>0?(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||Ce("\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 Fd={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2};function y_(e){return Fd[e]||Fd.easeOutCubic}const je="-moving";class Pd{constructor(t,i,a){H(this,"parent");H(this,"parentElement");H(this,"store");H(this,"canvas",document.createElement("canvas"));H(this,"offscreen",Ni());H(this,"width");H(this,"height");H(this,"externalElements",document.createElement("div"));H(this,"clientRect");H(this,"canvasRect");H(this,"activeRect");H(this,"initActiveRect");H(this,"dragRect");H(this,"lastRotate",0);H(this,"sizeCPs");H(this,"activeInitPos");H(this,"hoverType",xt.None);H(this,"resizeIndex",0);H(this,"mouseDown");H(this,"hotkeyType");H(this,"mouseRight");H(this,"addCaches");H(this,"touchCenter");H(this,"initTouchDis");H(this,"initScale");H(this,"touchScaling");H(this,"touchMoving");H(this,"startTouches");H(this,"lastTouchY");H(this,"startDistance");H(this,"startCenter");H(this,"currentCenter");H(this,"lastOffsetX",0);H(this,"lastOffsetY",0);H(this,"drawingLineName");H(this,"drawLineFns",[...u2]);H(this,"drawingLine");H(this,"pencil");H(this,"pencilLine");H(this,"movingPens");H(this,"patchFlagsLines",new Set);H(this,"dock");H(this,"prevAnchor");H(this,"nextAnchor");H(this,"lastMouseTime",0);H(this,"hoverTimer",0);H(this,"fitTimer",0);H(this,"willInactivePen");H(this,"patchFlags",!1);H(this,"lastRender",0);H(this,"batchRendering",!1);H(this,"touchStart",0);H(this,"touchStartTimer");H(this,"timer");H(this,"lastTapTime",0);H(this,"lastAnimateRender",0);H(this,"animateRendering",!1);H(this,"renderTimer");H(this,"viewAnimation");H(this,"viewAnimationTimer");H(this,"initPens");H(this,"pointSize",8);H(this,"pasteOffset",!0);H(this,"opening",!1);H(this,"maxZindex",5);H(this,"canMoveLine",!1);H(this,"randomIdObj");H(this,"keyOptions");H(this,"isMobile",/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));H(this,"beforeAddPen");H(this,"beforeAddPens");H(this,"beforeAddAnchor");H(this,"beforeRemovePens");H(this,"beforeRemoveAnchor");H(this,"customResizeDock");H(this,"customMoveDock");H(this,"inputParent",document.createElement("div"));H(this,"inputDiv",document.createElement("div"));H(this,"dropdown",document.createElement("ul"));H(this,"tooltip");H(this,"popconfirm");H(this,"title");H(this,"mousePos",{x:0,y:0});H(this,"scroll");H(this,"movingAnchor");H(this,"canvasTemplate");H(this,"canvasImage");H(this,"canvasImageBottom");H(this,"magnifierCanvas");H(this,"dialog");H(this,"autoPolylineFlag",!1);H(this,"stopPropagation",t=>{t.stopPropagation()});H(this,"curve",J6);H(this,"polyline",V5);H(this,"mind",t5);H(this,"line",i5);H(this,"onCopy",t=>{this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements||this.copy()});H(this,"onCut",t=>{this.store.options.disableClipboard||t.target!==this.externalElements&&t.target!==document.body&&t.target.offsetParent!==this.externalElements||this.cut()});H(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<a.length;s++)if(a[s].type.indexOf("image")!==-1&&a[s].getAsFile()){i=!0;break}}}if(i){const a=t.clipboardData.items;if(a){for(let s=0;s<a.length;s++)if(a[s].type.indexOf("image")!==-1&&a[s].getAsFile()){const{x:n,y:r}=this.mousePos,o=a[s].getAsFile();let l=a[s].type.slice(6)==="gif"?"gif":"image";if(o!==null){const u=l==="gif",c=await this.fileToPen(o,u);c.height=c.height/c.width*100,c.width=100,c.x=n-50/2,c.y=r-c.height/c.width*50,c.externElement=u,this.addPens([c]),this.active([c]),this.copy([c])}}}}else this.paste()});H(this,"onMessage",t=>{var a,s,n,r;if(!t.data||typeof t.data=="string"&&(((s=(a=t.data).startsWith)==null?void 0:s.call(a,"setImmediate"))||((r=(n=t.data).startsWith)==null?void 0:r.call(n,"webpackHotUpdate"))))return;let i=typeof t.data=="string"?JSON.parse(t.data):t.data;typeof i=="object"?(i.name==="onload"&&this.dialog.iframe.contentWindow.postMessage(JSON.stringify({name:"dialog",data:this.dialog.data}),"*"),i.name==="closeDialog"&&this.dialog.hide(),this.parent.doMessageEvent(i.name,JSON.stringify(i.data))):this.parent.doMessageEvent(i)});H(this,"onwheel",t=>{if(this.viewAnimation=void 0,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===It.Disable||this.store.data.locked===It.DisableScale||this.store.data.locked===It.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()});H(this,"onkeydown",t=>{var n,r,o;if(this.store.data.locked>=It.DisableEdit&&t.target.tagName!=="INPUT"&&t.target.tagName!=="TEXTAREA"&&!t.target.dataset.meta2dIgnore&&this.store.active.forEach(l=>{var u;(u=l.onKeyDown)==null||u.call(l,l,t.key)}),this.store.data.locked>=It.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 l=this.store.data.width||this.store.options.width,u=this.store.data.height||this.store.options.height;l&&u&&(s={x:this.store.data.origin.x,y:this.store.data.origin.y,width:l*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 l=jt(this.drawingLine);l!==this.drawingLine.calculative.activeAnchor?(Jc(this.drawingLine),this.drawingLine.calculative.worldAnchors.push(l)):this.drawingLine.calculative.worldAnchors.push({x:l.x,y:l.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(l=>!l.parentId&&l.locked!==It.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+i<s.x&&(i=s.x-this.activeRect.x),this.translatePens(this.store.active,i,0);break;case"ArrowUp":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+a<s.y&&(a=s.y-this.activeRect.y),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"ArrowRight":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+this.activeRect.width+i>s.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?t.shiftKey?this.redo():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(l=>{l.type?(l.close=!l.close,l.close&&eu(l),this.store.path2dMap.set(l,wt.path2dDraws.line(l)),ho(l)):l.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(l=>{l.type||(l.calculative.focus=!1)}),this.movingPens&&(this.getAllByPens(this.movingPens).forEach(l=>{this.store.pens[l.id]=void 0}),this.movingPens=void 0,this.mouseDown=void 0,this.clearDock(),(o=this.store.active)==null||o.forEach(l=>{this.updateLines(l)}),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)});H(this,"onkeyup",t=>{switch(t.key){case"l":case"L":this.canMoveLine=!1;break}this.hotkeyType&&this.render(),this.hotkeyType<Yt.AddAnchor&&(this.hotkeyType=Yt.None)});H(this,"ondrop",async t=>{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),await 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)});H(this,"ontouchstart",t=>{if(this.viewAnimation=void 0,this.lastTouchY=t.touches[0].clientY,this.store.data.locked===It.Disable)return;const i=new Date().getTime(),a=i-this.lastTapTime;a<300&&a>0&&t.touches.length!==2&&this.ondblclick(t),this.lastTapTime=i,this.touchStartTimer&&clearTimeout(this.touchStartTimer),this.touchStartTimer=setTimeout(()=>{this.touchStart=performance.now();const s=t.touches[0].pageX-this.clientRect.x,n=t.touches[0].pageY-this.clientRect.y,r={x:s,y:n};if(this.calibrateMouse(r),this.getHover(r),this.onMouseDown({x:s,y:n,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.mouseDown=void 0,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},this.startDistance=this.getDistance(t.touches[0],t.touches[1]),this.startCenter=this.getCenter(t.touches[0],t.touches[1]),this.currentCenter={...this.startCenter},this.touchScaling=void 0,this.touchMoving=void 0;return}else t.touches.length===3&&(this.store.emitter.emit("contextmenu",{e:{x:s,y:n,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)});H(this,"ontouchmove",t=>{var o,l;if(this.store.data.locked===It.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){const u=this.lastTouchY-t.touches[0].clientY;if(u){const c={x:n,y:r};if(this.calibrateMouse(c),this.getHover(c),(o=this.store.hover)!=null&&o.onWheel){this.onwheel(this.touchToWheelEvent(t,u)),this.lastTouchY=t.touches[0].clientY;return}}if(this.store.options.scroll&&this.scroll&&!this.store.options.scrollButScale){if(!u)return;this.scroll.wheel(u),this.lastTouchY=t.touches[0].clientY;return}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.mouseDown=void 0,!this.touchMoving&&!this.touchScaling){const u=this.getDistance(a[0],a[1]),c=this.getCenter(a[0],a[1]),d=u-this.startDistance,f=c.x-this.currentCenter.x,g=c.y-this.currentCenter.y,m=Math.sqrt(f*f+g*g);Math.abs(d)/this.startDistance>m/100?this.touchScaling=!0:m>5&&(this.touchMoving=!0)}if(this.touchScaling){if(this.store.data.disableScale||this.store.options.disableScale)return;const u=Math.hypot(a[0].pageX-a[1].pageX,a[0].pageY-a[1].pageY)/this.initTouchDis;this.scale(this.initScale*u,ot(this.touchCenter))}if(this.touchMoving){if(this.store.data.locked>=It.DisableMove&&this.store.data.locked!==It.DisableScale||this.store.data.disableScale||this.store.options.disableScale)return;if(this.lastOffsetX){const{scale:u}=this.store.data;this.translate((n-this.lastOffsetX)/u,(r-this.lastOffsetY)/u)}this.lastOffsetX=n,this.lastOffsetY=r}}});H(this,"ontouchend",t=>{if(this.store.data.locked===It.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;setTimeout(()=>{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}),this.render()},60)});H(this,"onGesturestart",t=>{t.preventDefault()});H(this,"onMouseDown",t=>{var i,a,s,n,r;if(this.viewAnimation=void 0,t.buttons===2&&!this.drawingLine&&(this.mouseRight=Zi.Down),this.hideInput(),this.popconfirm.hide(),this.store.data.locked===It.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 o=this.store.activeAnchor;if(!o)return;const l={id:Tt(),x:o.x,y:o.y};this.drawingLine=this.createDrawingLine(l);let u=ce(this.drawingLine);this.drawingLine.calculative.activeAnchor=u,xe(this.store.hover,o,this.drawingLine,l),this.drawline();return}if(!(this.hotkeyType===Yt.Translate||this.mouseRight===Zi.Down&&!this.store.options.mouseRightActive)){if(this.drawingLine){if(this.store.hoverAnchor){const l=jt(this.drawingLine);this.store.hoverAnchor.type===Bi.Line?Pr(l,this.store.hoverAnchor,this.store):(l.x=this.store.hoverAnchor.x,l.y=this.store.hoverAnchor.y),xe(this.store.hover,this.store.hoverAnchor,this.drawingLine,l),this.drawline(),this.finishDrawline(!0);return}if(!this.store.options.autoAnchor&&t.shiftKey&&t.altKey&&t.ctrlKey){this.setAnchor(this.store.pointAt);const l=jt(this.drawingLine),u=this.store.activeAnchor;if(!u)return;l.x=u.x,l.y=u.y,xe(this.store.hover,u,this.drawingLine,l),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 l=jt(this.drawingLine),u=Rs(this.store.hover,t);l.x=u.x,l.y=u.y,this.drawingLine.autoTo=!0,xe(this.store.hover,u,this.drawingLine,l),this.drawline(),this.finishDrawline(!0);return}const o=jt(this.drawingLine);o.isTemp?(this.drawingLine.calculative.activeAnchor=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2],o.isTemp=void 0):(this.drawingLine.calculative.activeAnchor=o,this.drawingLine.calculative.worldAnchors.push({x:o.x,y:o.y,penId:o.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 o=Rs(this.store.hover,t);this.store.hoverAnchor=o;const l={id:Tt(),x:o.x,y:o.y};this.drawingLine=this.createDrawingLine(l),this.drawingLine.autoFrom=!0,xe(this.store.hover,o,this.drawingLine,l)}else this.inactive(),this.hoverType=xt.None;else if(this.hoverType===xt.NodeAnchor){this.drawingLineName=this.store.options.drawingLineName;const o={id:Tt(),x:this.store.hoverAnchor.x,y:this.store.hoverAnchor.y};this.drawingLine=this.createDrawingLine(o),this.drawingLine.calculative.activeAnchor=o,xe(this.store.hover,this.store.hoverAnchor,this.drawingLine,o)}else if(!this.drawingLine&&this.drawingLineName!=="curve"){this.inactive(!0);const o={id:Tt(),x:t.x,y:t.y};this.drawingLine=this.createDrawingLine(o),this.drawingLine.calculative.activeAnchor=o}}else if(this.pencil){this.inactive(!0);const o=Tt(),l={x:t.x,y:t.y,id:Tt(),penId:o};this.pencilLine=this.getInitPencilLine(l)}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 o=We(this.store.hover,!0);let l=o||this.store.hover;o&&(o.container||((r=this.store.options.containerShapes)==null?void 0:r.includes(o.name)))&&(l=this.store.hover),t.ctrlKey&&!t.shiftKey?(l.calculative.active?this.willInactivePen=l:this.store.active.length>0&&(l.calculative.active=!0,Cs(l),this.store.active.push(l),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&&Gi({x:t.x,y:t.y},this.activeRect))||this.store.active.length==1)&&(l.calculative.active||(this.active([l]),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(o=>{this.activeInitPos.push({x:(o.calculative.worldRect.x-this.activeRect.x)/this.activeRect.width,y:(o.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()}}});H(this,"onMouseMove",t=>{var a,s,n,r,o,l,u,c,d;if(this.store.data.locked===It.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){this.mouseRight===Zi.Down&&(this.mouseRight=Zi.Translate);const f=this.store.active[0];if(f&&this.store.data.locked&&(f.locked===void 0||f.locked<It.DisableMove)){(a=f==null?void 0:f.onMouseMove)==null||a.call(f,f,this.mousePos);return}if(this.store.data.locked===It.DisableEdit||this.store.data.locked===It.DisableScale||this.hotkeyType===Yt.Translate||this.mouseRight===Zi.Translate){const{scale:g}=this.store.data;let m=(t.x-this.mouseDown.x)/g,y=(t.y-this.mouseDown.y)/g;t.shiftKey&&!t.ctrlKey&&(y=0),t.ctrlKey&&(m=0),this.translate(m,y);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 g={id:Tt(),x:this.store.hoverAnchor.x,y:this.store.hoverAnchor.y};this.drawingLine=this.createDrawingLine(g),this.drawingLine.calculative.activeAnchor=g,xe(this.store.hover,this.store.hoverAnchor,this.drawingLine,g),this.drawline();return}}else if(this.drawingLineName&&this.hoverType===xt.None){const g={id:Tt(),x:t.x,y:t.y};this.drawingLine=this.createDrawingLine(g),this.drawingLine.calculative.activeAnchor=g,this.drawline();return}if(t.buttons===1&&(t.ctrlKey||!this.hoverType&&!this.hotkeyType)&&!(t.ctrlKey&&(this.store.activeAnchor||((s=this.store.active)==null?void 0:s.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 g=t.x-this.movingAnchor.x,m=t.y-this.movingAnchor.y;this.translateAnchor(g,m),this.render();return}else if(!((n=this.store.active[0])!=null&&n.locked)){const g={x:t.x,y:t.y};if(this.hoverType===xt.LineAnchor){(this.dockInAnchor(t)||((r=this.store.active[0])==null?void 0:r.lineName)==="line")&&!this.store.options.disableDock&&!this.store.options.disableLineDock&&(this.clearDock(),this.dock=ud(this.store,g,this.store.activeAnchor),(o=this.dock)!=null&&o.xDock&&(g.x+=this.dock.xDock.step),(l=this.dock)!=null&&l.yDock&&(g.y+=this.dock.yDock.step)),this.moveLineAnchor(g,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 g=t.x-this.mouseDown.x,m=t.y-this.mouseDown.y,y=20;if(t.ctrlKey&&!t.shiftKey&&(Math.abs(g)>=y||Math.abs(m)>=y)&&(this.willInactivePen=void 0),this.store.active.length===1){const p=this.store.active[0];if((p.locked===void 0||p.locked<It.DisableMove)&&((u=p==null?void 0:p.onMouseMove)==null||u.call(p,p,this.mousePos)),p.calculative.focus)return}this.movePens(t),this.getContainerHover(t);return}}else if(this.pencil){const{x:g,y:m}=t,y={x:g,y:m};y.id=Tt(),y.penId=this.pencilLine.id,this.pencilLine.calculative.worldAnchors.push(y),this.store.path2dMap.set(this.pencilLine,wt.path2dDraws[this.pencilLine.name](this.pencilLine)),this.patchFlags=!0}}if(this.drawingLine){const{x:f,y:g}=t,m={x:f,y:g};if(m.id=Tt(),m.penId=this.drawingLine.id,!this.store.options.disableDock&&!this.store.options.disableLineDock&&(this.clearDock(),this.dock=ud(this.store,m),(c=this.dock)!=null&&c.xDock&&(m.x+=this.dock.xDock.step),(d=this.dock)!=null&&d.yDock&&(m.y+=this.dock.yDock.step)),this.mouseDown&&this.drawingLineName==="curve"&&!this.drawingLine.calculative.worldAnchors[0].connectTo)this.drawline(m);else{let y;if(this.drawingLine.calculative.worldAnchors.length>1&&(y=jt(this.drawingLine)),y?(y.prev=void 0,y.next=void 0,y.id||(y.id=Tt()),y.x=m.x,y.y=m.y,y.connectTo=void 0):(y={...m},this.drawingLine.calculative.worldAnchors.push(y)),(this.hoverType===xt.NodeAnchor||this.hoverType===xt.LineAnchor)&&(this.store.hoverAnchor.type!==Bi.Line&&(y.x=this.store.hoverAnchor.x,y.y=this.store.hoverAnchor.y),y.connectTo=this.store.hoverAnchor.penId,this.drawingLineName==="polyline"&&(y.isTemp=!1)),this.drawingLineName==="line"){if(t.ctrlKey&&!t.shiftKey)y.x=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2].x;else if(t.shiftKey&&!t.ctrlKey)y.y=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2].y;else if(t.shiftKey&&t.ctrlKey){let p=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2];this.getSpecialAngle(y,p)}}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)});H(this,"onMouseUp",t=>{if(this.store.data.locked===It.Disable){this.hoverType=xt.None;return}if(!!this.mouseDown){if(this.mouseRight===Zi.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=Zi.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=jt(this.drawingLine);this.store.hoverAnchor.type===Bi.Line?Pr(i,this.store.hoverAnchor,this.store):(i.x=this.store.hoverAnchor.x,i.y=this.store.hoverAnchor.y),xe(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=jt(this.drawingLine),a=Rs(this.store.hover,t);i.x=a.x,i.y=a.y,this.drawingLine.autoTo=!0,xe(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=ce(i),s=jt(i);if(this.store.hoverAnchor){const n=this.store.hover,r=ce(n)===this.store.hoverAnchor,o=jt(n)===this.store.hoverAnchor,l=a===this.store.activeAnchor,u=s===this.store.activeAnchor;if((t.ctrlKey||t.altKey)&&n.type===Ut.Line&&(r||o)&&(l||u)){const c=n.calculative.worldAnchors.map(d=>({...d,penId:i.id}));r?c.shift():o&&c.pop(),(r&&l||o&&u)&&c.reverse(),l?(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===Bi.Line?Pr(this.store.activeAnchor,this.store.hoverAnchor,this.store):(this.store.activeAnchor.x=this.store.hoverAnchor.x,this.store.activeAnchor.y=this.store.hoverAnchor.y),xe(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,wt.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>=It.DisableMove||a.parentId||a.isRuleLine)return!1;if(ea(a.calculative.worldRect,this.dragRect,t.ctrlKey||this.store.options.dragAllIn))return a.type===Ut.Line&&!this.store.options.dragAllIn?ic(a,this.dragRect):!0});this.active(i)}if(t.button!==2&&(wo(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,Cs(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()}});H(this,"clearDock",()=>{var n,r,o,l;const t=(r=(n=this.dock)==null?void 0:n.xDock)==null?void 0:r.penId,i=(l=(o=this.dock)==null?void 0:o.yDock)==null?void 0:l.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});H(this,"onResize",()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.resize(),this.timer=void 0},100)});H(this,"onScroll",()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.clientRect=this.canvas.getBoundingClientRect(),this.timer=void 0},100)});H(this,"calibrateMouse",t=>(t.x-=this.store.data.x,t.y-=this.store.data.y,t));H(this,"getContainerHover",t=>{var a;if(this.dragRect)return;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===It.Disable)){if(Gi(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+je];this.store.lastHoverContainer&&!r&&(this.store.lastHoverContainer.calculative.containerHover=!1,this.store.emitter.emit("leave",this.store.lastHoverContainer)),this.store.lastHoverContainer=this.store.hoverContainer}}}});H(this,"lastHoverType",xt.None);H(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=ec(this.store.active),o=od(this.store.active)||this.store.options.disableRotate,l=ld(this.store.active)||this.store.options.disableSize;if(!r&&!o){const u={x:this.activeRect.center.x,y:this.activeRect.y-30};this.activeRect.rotate&&Zt(u,this.activeRect.rotate,this.activeRect.pivot||this.activeRect.center),!this.hotkeyType&&As(t,u,this.pointSize)&&(i=xt.Rotate,this.externalElements.style.cursor=`url("${this.store.options.rotateCursor}"), auto`)}if(!r&&!l)for(let u=0;u<8;u++){const c=u<4;if((this.hotkeyType===Yt.Resize||c&&!this.hotkeyType)&&As(t,this.sizeCPs[u],this.pointSize)){let f=c?Yf:Kf,g=0;Math.abs(this.activeRect.rotate%90-45)<25?(f=c?Kf:Yf,g=Math.round((this.activeRect.rotate-45)/90)+(c?0:1)):g=Math.round(this.activeRect.rotate/90),i=xt.Resize,this.resizeIndex=u,this.externalElements.style.cursor=f[(u+g)%4];break}}}i===xt.None&&(i=this.inPens(t,this.store.data.pens)),!i&&!a&&Gi(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,mn(We(this.store.lastHover,!0)||this.store.lastHover,!1),this.store.pens[this.store.lastHover.id]&&this.store.emitter.emit("leave",this.store.lastHover),this.tooltip.hide()),this.store.hover&&(this.store.hover.calculative.hover=!0,mn(We(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),[xt.LineAnchor,xt.NodeAnchor].includes(i)&&![xt.LineAnchor,xt.NodeAnchor].includes(this.lastHoverType)&&this.store.emitter.emit("enterAnchor",{pen:this.store.hover,anchor:this.store.hoverAnchor}),this.lastHoverType=i,(n=(s=this.store.hover)==null?void 0:s.onMouseMove)==null||n.call(s,this.store.hover,this.mousePos)});H(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===It.Disable||this.store.data.locked&&r.name==="sceneContainer")continue;const o=this.store.data.locked&&r.ignoreEvent===!0,l=uo(r);if(!(!r.calculative.active&&!Xa(t,r.calculative.worldRect,l)&&!Gi(t,r.calculative.worldRect))){if(!o&&!this.store.data.locked&&this.hotkeyType!==Yt.Resize&&r.calculative.worldAnchors){for(const u of r.calculative.worldAnchors)if(a=this.inAnchor(t,r,u),a){let c=ot(u);Object.assign(c,t),this.title.show(c,r);break t}}if(r.type){if(o)continue;if(r.isRuleLine){let c=((s=this.store.options.ruleOptions)==null?void 0:s.height)||20;if(t.x+this.store.data.x>c&&t.y+this.store.data.y>c)break}const u=a5(t,r);if(u){!this.store.data.locked&&!r.locked?this.hotkeyType===Yt.AddAnchor?this.externalElements.style.cursor="pointer":this.externalElements.style.cursor="move":this.externalElements.style.cursor=r.hoverCursor||this.store.options.hoverCursor,r.calculative.disabled&&(this.externalElements.style.cursor="not-allowed"),this.store.hover=r,this.store.pointAt=u.point,this.store.pointAtIndex=u.i,this.initTemplateCanvas([this.store.hover]),a=xt.Line;break}}else{if(r.children){const c=[];if(r.children.forEach(d=>{this.store.pens[d]&&c.push(this.store.pens[d])}),a=this.inPens(t,c),a)break}if(o)continue;let u=!1;if(r.name==="line"?u=Xa(t,r.calculative.worldRect,r.lineWidth):u=Gi(t,r.calculative.worldRect),u){if(r.type===Ut.Node&&r.name==="line"&&!v5(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=r.hoverCursor||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:c,y:d,ex:f,ey:g,rotate:m,center:y}=this.store.hover.calculative.worldRect;if(m){const p=[{x:c,y:d},{x:f,y:d},{x:f,y:g},{x:c,y:g}];p.forEach(_=>{Zt(_,m,y)});let x=p[p.length-1];for(const _ of p){if(x.y>t.y!=_.y>t.y){const b=_.x+(t.y-_.y)*(x.x-_.x)/(x.y-_.y);Math.abs(b-this.store.pointAt.x)<10&&(this.store.pointAt.x=b)}x=_}}else this.store.pointAt.x-10<c?this.store.pointAt.x=c:this.store.pointAt.x+10>f&&(this.store.pointAt.x=f),this.store.pointAt.y-10<d?this.store.pointAt.y=d:this.store.pointAt.y+10>g&&(this.store.pointAt.y=g)}break}}}}return a});H(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===It.Disable||this.store.data.locked&&n.ignoreEvent===!0||n===this.store.active[0])continue;let r=uo(n);if(r+=2*this.store.options.anchorRadius,!!Xa(t,n.calculative.worldRect,r)&&(this.store.hover=n,this.hotkeyType!==Yt.Resize&&n.calculative.worldAnchors))for(const o of n.calculative.worldAnchors){if(o.twoWay===Ae.In){const l=jt(this.store.active[0]);if(this.store.activeAnchor.id!==l.id)continue}if(o.twoWay===Ae.Out){const l=ce(this.store.active[0]);if(this.store.activeAnchor.id!==l.id)continue}if(!(o.twoWay===Ae.DisableConnected||o.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,o))){let l=ot(o);return Object.assign(l,t),this.title.show(l,n),!0}}}});H(this,"__loadMap",new Map);H(this,"imageTimer");H(this,"templateImageTimer");H(this,"render",t=>{if(this.batchRendering){this.patchFlags=!0;return}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){this.store.options.gridAlwaysRender&&(this.store.options.grid||this.store.data.grid)&&(this.canvasTemplate.bgPatchFlags=!0,this.canvasTemplate.render());return}if(t!=null)if(i-this.lastRender<this.store.options.interval){this.store.options.interval>this.store.options.minFPSNumber&&this.store.options.autoFPS&&(this.store.options.interval--,this.store.options.animateInterval=this.store.options.interval),this.renderTimer&&cancelAnimationFrame(this.renderTimer),this.renderTimer=requestAnimationFrame(this.render);return}else i-this.lastRender-this.store.options.interval>10&&this.store.options.autoFPS&&document.visibilityState==="visible"&&(this.store.options.interval++,this.store.options.animateInterval=this.store.options.interval);this.renderTimer=void 0,this.lastRender=i;const a=this.offscreen.getContext("2d");a.clearRect(0,0,this.offscreen.width,this.offscreen.height),a.save(),a.translate(this.store.data.x,this.store.data.y),globalThis.debugRender&&console.time("renderPens"),this.renderPens(),globalThis.debugRender&&console.timeEnd("renderPens"),this.renderBorder(),this.renderHoverPoint(),this.renderPensAnchors(),a.restore(),this.magnifierCanvas.magnifier&&this.magnifierCanvas.render();const s=this.canvas.getContext("2d");s.clearRect(0,0,this.canvas.width,this.canvas.height),s.drawImage(this.offscreen,0,0,this.width,this.height),this.canvasTemplate.render(),this.canvasImageBottom.render(),this.canvasImage.render(),this.patchFlags=!1});H(this,"renderPens",()=>{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(),Ya(t,i),(i.rotateByRoot||i.calculative.rotate)&&ia(t,i),Ka(t,i),Bs(t,i),t.restore()),Oa(t,i));this.drawingLine&&Oa(t,this.drawingLine),this.pencilLine&&Oa(t,this.pencilLine),this.movingPens&&this.movingPens.forEach(i=>{this.renderPenContainChild(t,i)})});H(this,"renderPenContainChild",(t,i)=>{var a;i.calculative.inView&&Oa(t,i),(a=i.children)==null||a.forEach(s=>{const n=this.store.pens[s];n&&this.renderPenContainChild(t,n)})});H(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,ec(this.store.active)||od(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()}});H(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>It.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===Bi.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)&&!ec(this.store.active)&&!ld(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=eo(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()});H(this,"renderPensAnchors",()=>{for(const t of this.store.data.pens)!isFinite(t.x)||t.anchorVisible===!0&&this.renderAnchors(t)});H(this,"renderAnchors",t=>{const i=this.offscreen.getContext("2d");i.save(),i.translate(.5,.5),i.strokeStyle=t.anchorColor||this.store.styles.anchorColor,i.fillStyle=t.anchorBackground||this.store.options.anchorBackground;const{fontStyle:a,fontWeight:s,fontSize:n,fontFamily:r,lineHeight:o}=t.calculative,l=this.store.data.scale;t.calculative.worldAnchors.forEach((u,c)=>{var f,g,m,y,p,x;if(u.hidden||u.locked>It.DisableEdit)return;if(u===this.store.hoverAnchor){i.save();const _=t.hoverAnchorColor||this.store.options.hoverAnchorColor;i.strokeStyle=_,i.fillStyle=_}i.beginPath();let d=u.radius||t.anchorRadius||this.store.options.anchorRadius;if(t.type&&!u.radius&&!t.anchorRadius&&(d=3,t.calculative.lineWidth>3&&(d=t.calculative.lineWidth)),u.type===Bi.Line){let _=this.store.pens[u.penId].rotate||0;this.store.pens[u.penId].calculative.flipX&&(_*=-1),this.store.pens[u.penId].calculative.flipY&&(_*=-1);let b=u.rotate+_;this.store.pens[u.penId].calculative.flipX&&(b*=-1),this.store.pens[u.penId].calculative.flipY&&(b*=-1),i.save(),i.translate(u.x,u.y),i.rotate(b*Math.PI/180),i.translate(-u.x,-u.y),i.rect(u.x-u.length*this.store.data.scale/2,u.y-d,u.length*this.store.data.scale,d*2),i.restore()}else i.arc(u.x,u.y,d,0,Math.PI*2);if(t.type&&this.store.hoverAnchor===u?(i.save(),i.strokeStyle=t.activeColor||this.store.styles.activeColor,i.fillStyle=i.strokeStyle):(u.color||u.background)&&(i.save(),i.strokeStyle=u.color,i.fillStyle=u.background),i.fill(),i.stroke(),u===this.store.hoverAnchor&&i.restore(),(t.type&&this.store.hoverAnchor===u||u.color||u.background)&&i.restore(),u.label){i.save(),i.font=Be({fontStyle:((f=u.labelStyle)==null?void 0:f.fontStyle)||a,fontWeight:((g=u.labelStyle)==null?void 0:g.fontWeight)||s,fontFamily:((m=u.labelStyle)==null?void 0:m.fontFamily)||r,lineHeight:((y=u.labelStyle)==null?void 0:y.lineHeight)||o,fontSize:((p=u.labelStyle)==null?void 0:p.fontSize)*l||n});const _=t.anchors[c].x,b=t.anchors[c].y;let C=0,P=0;u.labelDirection!==void 0?u.labelDirection===Rt.Left?(i.textAlign="right",i.textBaseline="middle",C=-(u.labelGap||10)*l):u.labelDirection===Rt.Right?(i.textAlign="left",i.textBaseline="middle",C=(u.labelGap||10)*l):u.labelDirection===Rt.Up?(i.textAlign="center",i.textBaseline="bottom",P=-(u.labelGap||5)*l):u.labelDirection===Rt.Bottom&&(i.textAlign="center",i.textBaseline="top",P=(u.labelGap||5)*l):_<.1?(i.textAlign="left",i.textBaseline="middle",C=(u.labelGap||10)*l):_>.9?(i.textAlign="right",i.textBaseline="middle",C=-(u.labelGap||10)*l):(i.textAlign="center",b<.1?(i.textBaseline="top",P=(u.labelGap||5)*l):b>.9?(i.textBaseline="bottom",P=-(u.labelGap||5)*l):i.textBaseline="middle"),i.fillStyle=((x=u.labelStyle)==null?void 0:x.textColor)||zi(t,this.store),i.fillText(u.label,u.x+C,u.y+P),i.restore()}if(!t.parentId&&t.children&&t.children.length>0&&u===this.store.hoverAnchor){i.save(),i.beginPath(),i.lineWidth=3;const _=t.hoverAnchorColor||this.store.options.hoverAnchorColor;globalThis.pSBC&&(i.strokeStyle=globalThis.pSBC(.5,_)),i.arc(u.x,u.y,d+1.5,0,Math.PI*2),i.stroke(),i.restore()}}),i.restore()});H(this,"transTimeout");H(this,"animateViewFrame",()=>{if(!this.viewAnimation)return;const t=performance.now(),{startTime:i,duration:a,fromX:s,fromY:n,fromScale:r,toX:o,toY:l,toScale:u,easing:c,center:d,pen:f}=this.viewAnimation;let g=Math.min(1,(t-i)/a);g=c(g);const m=this.store.data.scale,y=r+(u-r)*g,p=y/m;p!==1&&(this.store.data.scale=y,this.store.data.center=d,Fs(this.store.data.origin,p,d),this.store.data.pens.forEach(P=>{if(P.onScale&&P.onScale(P),!P.parentId){if(di(P,p,d),P.isRuleLine){const S=1/p,B=P.calculative.worldRect.center;P.width&&P.height||di(P,S,B)}this.updatePenRect(P,{worldRectIsReady:!0}),this.execPenResize(P)}}),this.calcActiveRect());let x,_;if(f){const P={x:this.width/2,y:this.height/2},S=P.x-f.calculative.worldRect.x-f.calculative.worldRect.width/2,B=P.y-f.calculative.worldRect.y-f.calculative.worldRect.height/2;x=s+(S-s)*g,_=n+(B-n)*g}else x=s+(o-s)*g,_=n+(l-n)*g;const b=this.store.data.x,C=this.store.data.y;if(this.store.data.x=x,this.store.data.y=_,this.scroll&&this.scroll.isShow&&this.scroll.translate(x-b,_-C),this.onMovePens(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render(),g<1)this.viewAnimationTimer=requestAnimationFrame(this.animateViewFrame);else{if(f||(this.store.data.x=o,this.store.data.y=l),Math.abs(this.store.data.scale-u)>.001){const P=u/this.store.data.scale;this.store.data.scale=u,this.store.data.center=d,Fs(this.store.data.origin,P,d),this.store.data.pens.forEach(S=>{if(S.onScale&&S.onScale(S),!S.parentId){if(di(S,P,d),S.isRuleLine){const B=1/P,D=S.calculative.worldRect.center;S.width&&S.height||di(S,B,D)}this.updatePenRect(S,{worldRectIsReady:!0}),this.execPenResize(S)}}),this.calcActiveRect(),this.onMovePens(),this.canvasTemplate.init(),this.canvasImage.init(),this.canvasImageBottom.init(),this.render()}this.viewAnimation=void 0,this.viewAnimationTimer=void 0,this.store.emitter.emit("scale",this.store.data.scale),this.store.emitter.emit("translate",{x:this.store.data.x,y:this.store.data.y})}});H(this,"pastePen",(t,i)=>{const a=t.id;if(hd(t),t.parentId=i,t.type===Ut.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:o,scale:l}=this.store.data;t.x=o.x+n.x*l,t.y=o.y+n.y*l,t.width=n.width*l,t.height=n.height*l,r.x=o.x+r.x*l,r.y=o.y+r.y*l,te(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(o=>o.id===n);r&&s.push(this.pastePen(r,t.id).id)}return t.children=s,Di(t,!0),t});H(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 o=1/0;(s=(a=this.store.pens[this.store.hover.parentId])==null?void 0:a.children)==null||s.forEach(l=>{const u=this.store.pens[l];if(Gi(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<o&&(o=c,n=l)}}),this.store.hover=this.store.pens[n],this.store.pens[n].calculative.hover=!0}this.active([this.store.hover])}else this.showInput(this.store.hover);this.store.emitter.emit("dblclick",{x:t.x,y:t.y,pen:this.store.hover})});H(this,"showInput",(t,i,a="transparent")=>{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,o=`${(t.calculative.tempText===void 0?t.text+""||"":t.calculative.tempText).replace(/\x20/g,"&nbsp;").split(/[\s\n]/).join("</div><div>")}</div>`.replace("</div>","").replace(/\<div\>\<\/div\>/g,"<div><br></div>");this.inputDiv.innerHTML=o,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 l=s.width;if(this.inputParent.style.width=(l<0?12:l)+"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";const c=this.inputDiv.getBoundingClientRect();let d=window.innerHeight-c.top-c.height;d=d>200?200:d,this.dropdown.style.maxHeight=d+"px",this.setDropdownList(),this.externalElements.style.zIndex="9999"}this.inputDiv.contentEditable=t.readonly?"false":"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()});H(this,"setInputStyle",t=>{t.text||(t.text="");let i;for(let u=0;u<document.styleSheets.length;u++)document.styleSheets[u].title==="le5le.com"&&(i=document.styleSheets[u]);let a="overflow: scroll;",s="",n=1;const{scale:r}=this.store.data;t.fontSize<12&&(n=12/t.fontSize),t.textAlign?a+=`text-align: ${t.textAlign};`:a+="text-align: center;",t.textAlign&&t.whiteSpace==="pre-line"&&(a+=`align-items: ${{left:"start",center:"center",right:"end"}[t.textAlign]};`),t.textBaseline?a+=`justify-content: ${{top:"start",middle:"center",bottom:"end"}[t.textBaseline]};`:a+="justify-content: center;",t.fontFamily&&(a+=`font-family: ${t.fontFamily};`),t.fontSize&&(t.fontSize*r<12?a+=`font-size:${t.calculative.fontSize}px;`:a+=`font-size:${t.fontSize*r}px;`),a+=`color:${zi(t,this.store)};`,t.fontStyle&&(a+=`font-style: ${t.fontStyle};`),t.fontWeight&&(a+=`font-weight: ${t.fontWeight};`);let o=0;if(t.textLeft&&(o=(r>1,t.textLeft*r),a+=`margin-left:${o}px;`),t.textTop&&(a+=`margin-top:${r>1,t.textTop*n}px;`),t.lineHeight&&(a+=`line-height:${r>1?t.fontSize*t.lineHeight*r:t.calculative.fontSize*t.lineHeight}px;`),t.textHeight)a+=`height:${r>1?t.textHeight*n*r:t.textHeight*n}px;`;else{let u=t.calculative.worldRect.height/r;u<0&&(u=0);let c=(t.fontSize*r<12,u*r*n);c<t.fontSize*t.lineHeight*r&&(c=t.fontSize*t.lineHeight*r,a+=`top:-${c/2}px;`),a+=`height:${c}px;`}t.letterSpacing&&(a+=`letter-spacing:${t.calculative.letterSpacing}px;`);let l=null;if(t.textWidth)l=t.calculative.textWidth,t.whiteSpace!=="pre-line"&&(l<t.fontSize?a+=`width:${t.fontSize*1.2*n}px;`:a+=`width:${r>1,l*n}px;`);else if(t.whiteSpace===void 0||t.whiteSpace==="break-all"){let u=(t.calculative.worldTextRect.width||12)/r;u<0&&(u=0),a+=`width:${t.fontSize*r<12,u*r-o}px;`}t.whiteSpace&&(t.whiteSpace==="pre-line"?a+="white-space:pre;":(a+=`white-space:${t.whiteSpace};`,t.whiteSpace==="nowrap"&&(s+="display:contents;"))),t.whiteSpace!=="nowrap"&&(t.fontSize*1.2*t.text.length,(l||t.calculative.worldRect.width/r)*Math.floor(t.calculative.worldRect.height/r/(t.lineHeight*t.fontSize))),i.deleteRule(0),i.deleteRule(0),i.insertRule(`.meta2d-input
  63. .input-div{
  64. 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}}`)});H(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(/\<div\>/g,`
  65. `).replace(/\<\/div\>/g,"").replace(/\<br\>/g,"").replace(/&nbsp;/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=[ot(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&&$2(t),Ii(t),this.patchFlags=!0,this.pushHistory({type:_t.Update,pens:[ot(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&&t.calculative.textLines.length==0&&Ii(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()});H(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=Ce("\u65E0"),n.style.padding="5px 12px",n.style.color="#ddd",this.dropdown.appendChild(n);return}const a=this.inputDiv.innerHTML.replace(/\<div\>/g,`
  66. `).replace(/\<\/div\>/g,"").replace(/\<br\>/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(Ce(r),s):this.dropdownAppendOption(Ce(r),s),++s}if(!this.dropdown.hasChildNodes()){const n=document.createElement("div");n.innerText=Ce("\u65E0"),n.style.padding="5px 12px",n.style.color="#ddd",this.dropdown.appendChild(n)}});H(this,"selectDropdown",t=>{t.stopPropagation();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=[ot(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:_t.Update,pens:[ot(a,!0)],initPens:r}),this.render(),this.store.emitter.emit("change",a),this.store.emitter.emit("valueUpdate",a)});H(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.y<s*r.y+10&&(i="top",this.externalElements.style.cursor="row-resize"),n.y>s*(r.y+r.height)-10&&n.y<s*(r.y+r.height)+10&&(i="bottom",this.externalElements.style.cursor="row-resize"),n.x>a*r.x-10&&n.x<a*r.x&&(i="left",this.externalElements.style.cursor="col-resize"),n.x>a*(r.x+r.width)-10&&n.x<a*(r.x+r.width)+10&&(i="right",this.externalElements.style.cursor="col-resize"),this.canvasImage.currentFit=i});this.parent=t,this.parentElement=i,this.store=a,this.canvasTemplate=new g_(i,a,this),this.canvasTemplate.canvas.style.zIndex="1",this.canvasImageBottom=new Cd(i,a,!0),this.canvasImageBottom.canvas.style.zIndex="2",i.appendChild(this.canvas),this.canvas.style.position="absolute",this.canvas.style.backgroundRepeat="no-repeat",this.canvas.style.backgroundSize="100% 100%",this.canvas.style.zIndex="3",this.canvasImage=new Cd(i,a),this.canvasImage.canvas.style.zIndex="4",this.magnifierCanvas=new u_(this,i,a),this.magnifierCanvas.canvas.style.zIndex="5",this.externalElements.style.position="absolute",this.externalElements.style.left="0",this.externalElements.style.top="0",this.externalElements.style.outline="none",this.externalElements.style.background="transparent",this.externalElements.style.zIndex="5",i.style.position="relative",i.style["-webkit-tap-highlight-color"]="transparent",i.appendChild(this.externalElements),this.createInput(),this.tooltip=new za(i,a),this.tooltip.box.onmouseleave=s=>{this.patchFlags=!0,this.store.lastHover&&(this.store.lastHover.calculative.hover=!1);let n=this.store.data.pens.find(r=>r.calculative.hover===!0);mn(n,!1)},this.popconfirm=new m_(i,a),this.dialog=new h_(i,a),this.title=new fo(i),this.store.options.scroll&&(this.scroll=new g0(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.store.options.parentTouch?(this.parentElement.ontouchstart=this.ontouchstart,this.parentElement.ontouchmove=this.ontouchmove,this.parentElement.ontouchend=this.ontouchend):(this.externalElements.ontouchstart=this.ontouchstart,this.externalElements.ontouchmove=this.ontouchmove,this.externalElements.ontouchend=this.ontouchend),this.externalElements.onmousedown=t=>{this.isMobile||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=>{this.isMobile||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.isMobile||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=t=>{this.isMobile||this.ondblclick(t)},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 Wa.Document:document.addEventListener("keydown",this.onkeydown),document.addEventListener("keyup",this.onkeyup);break;case Wa.Canvas:this.externalElements.addEventListener("keydown",this.onkeydown),this.externalElements.addEventListener("keyup",this.onkeyup);break}}touchToWheelEvent(t,i){const a=t.changedTouches[0]||t.touches[0];return{deltaX:0,deltaY:i,deltaZ:0,deltaMode:0,clientX:a.clientX,clientY:a.clientY,pageX:a.pageX,pageY:a.pageY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,wheelDelta:-i,wheelDeltaY:-i,preventDefault:()=>t.preventDefault(),stopPropagation:()=>t.stopPropagation()}}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=ot(t,!0),r=ot(t,!0),o=Tt();r.id=o,r.calculative.canvas=this,r.calculative.active=!1,r.calculative.hover=!1;const l=ot(a.slice(0,s+1)),u=ot(a.slice(s)).map(c=>(c.penId=o,c));t.calculative.worldAnchors=l,r.calculative.worldAnchors=u,this.initLineRect(t),this.initLineRect(r),this.store.data.pens.push(r),this.store.pens[o]=r,this.pushHistory({type:_t.Add,pens:[ot(r,!0)],step:2}),this.pushHistory({type:_t.Update,initPens:[n],pens:[ot(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.x<n.x?this.movingAnchor.x=n.x:this.movingAnchor.x>n.ex&&(this.movingAnchor.x=n.ex),this.movingAnchor.y<n.y?this.movingAnchor.y=n.y:this.movingAnchor.y>n.ey&&(this.movingAnchor.y=n.ey);const r=xn(this.movingAnchor,n),o=s.anchors.findIndex(l=>l.id===this.movingAnchor.id);s.anchors[o]=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 Y2(t,this.store.options.uploadUrl,this.store.options.uploadParams,this.store.options.uploadHeaders):a=await q2(t),new Promise((s,n)=>{const r=new Image;r.onload=()=>{wt.htmlElements[a]=r,s({width:r.width,height:r.height,name:i?"gif":"image",image:a})},r.onerror=o=>{n(o)},r.crossOrigin=this.store.options.crossOrigin||"anonymous",r.src=a})}async dropPens(t,i){var l,u,c,d;this.randomIdObj={},this.parent.store.options.textPresetStyle&&t.length===1&&!t[0].temPreset&&t[0].name==="text"&&Object.assign(t[0],this.parent.store.options.textPresetStyle);for(const f of t)!f.parentId&&this.randomCombineId(f,t);if(Object.keys(this.randomIdObj).length!==0){const f=Object.keys(this.randomIdObj).join("|"),g=new RegExp(`(${f})`,"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]):(l=m.connectedLines)==null||l.forEach(y=>{y.lineAnchor=this.randomIdObj[y.lineAnchor],y.lineId=this.randomIdObj[y.lineId]}),(u=m.animations)!=null&&u.length){const y=JSON.stringify(m.animations).replace(g,p=>this.randomIdObj[p]);m.animations=JSON.parse(y)}if((c=m.triggers)!=null&&c.length){const y=JSON.stringify(m.triggers).replace(g,p=>this.randomIdObj[p]);m.triggers=JSON.parse(y)}if((d=m.events)!=null&&d.length){const y=JSON.stringify(m.events).replace(g,p=>this.randomIdObj[p]);m.events=JSON.parse(y)}}}for(const f of t)f.id||(f.id=Tt()),!f.calculative&&(f.calculative={canvas:this}),this.store.pens[f.id]=f;let a=0,s=0,n=0;for(const f of t)f.parentId||(f.width*=this.store.data.scale,f.height*=this.store.data.scale,f.x=i.x-f.width/2+n,f.y=i.y-f.height/2+s,f.tags&&f.tags.includes("meta3d")&&(f.x=this.store.data.origin.x,f.y=this.store.data.origin.y),f.dataset&&(a%2===0?n=f.width-40*this.store.data.scale:n=0,a++,a%2===0&&(s+=f.height+10*this.store.data.scale),delete f.dataset),f.temOffsetX&&(f.x+=f.temOffsetX*this.store.data.scale,delete f.temOffsetX),f.temOffsetY&&(f.y+=f.temOffsetY*this.store.data.scale,delete f.temOffsetY));const r=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height;if(r&&o){let f={x:this.store.data.origin.x,y:this.store.data.origin.y,width:r*this.store.data.scale,height:o*this.store.data.scale},g=!0;for(const m of t)if(!m.parentId){let y=[{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===f.x&&m.y===f.y&&m.width===f.width&&m.height===f.height||y.some(p=>Gi(p,f))){g=!1,this.store.options.strictScope&&(m.x<f.x&&(m.x=f.x),m.y<f.y&&(m.y=f.y),m.x+m.width>f.x+f.width&&(m.x=f.x+f.width-m.width),m.y+m.height>f.y+f.height&&(m.y=f.y+f.height-m.height));break}}if(g){console.info("\u753B\u7B14\u5728\u5927\u5C4F\u8303\u56F4\u5916");return}}await this.addPens(t,!0),this.active(t.filter(f=>!f.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]),hd(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 o=i.find(l=>l.id===r);o&&n.push(this.randomCombineId(o,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:_t.Add,pens:ot(s,!0)}),s}addPensSync(t,i,a){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:_t.Add,pens:ot(s,!0)}),s}getDistance(t,i){const a=i.clientX-t.clientX,s=i.clientY-t.clientY;return Math.sqrt(a*a+s*s)}getCenter(t,i){return{x:(t.clientX+i.clientX)/2,y:(t.clientY+i.clientY)/2}}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:Ut.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){var r;this.inactive();const{data:i,options:a}=this.store,s=i.scale,n=i.lineWidth||1;return t.penId=Tt(),{id:t.penId,name:"line",lineName:this.drawingLineName,x:t.x,y:t.y,type:Ut.Line,calculative:{canvas:this,active:!0,worldAnchors:[t],...a.linePresetStyle,lineWidth:a.linePresetStyle&&a.linePresetStyle.lineWidth?((r=a.linePresetStyle)==null?void 0:r.lineWidth)*s:n*s},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,o=t.y+a;let l=t.x,u=t.y,c=0,d=0,f=0,g=0;if(r<=o&&r<20)l=-i,c=this.width,f=1,t.ctrlKey||(u=Math.round((u-n.y)/(s*10))*(s*10)+n.y);else if(o<r&&o<20)u=-a,d=this.height,g=1,t.ctrlKey||(l=Math.round((l-n.x)/(s*10))*(s*10)+n.x);else return;this.addPen({isRuleLine:!0,type:Ut.Line,name:"line",lineName:"line",x:l,y:u,width:c,height:d,color:this.store.options.ruleLineColor,anchors:[{x:0,y:0},{x:f,y:g}]})}clearRuleLines(){this.delete(this.ruleLines)}get ruleLines(){return this.store.data.pens.filter(t=>t.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:o,y:l}=t,u={x:o,y:l},c=this.getPenRect(t),d=parseInt((c.x/s).toFixed()),f=parseInt((c.y/s).toFixed()),g=d*s,m=f*s;u.x=n.x+g*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=ot(i,!0),s=this.store.data.gridSize||this.store.options.gridSize,{origin:n,scale:r}=this.store.data,o=this.store.options.autoAlignGrid&&(this.store.data.grid||this.store.options.grid);if(i.forEach(f=>{var x;const g=this.movingPens.findIndex(_=>_.id===f.id+je);if(g<0)return;const{x:m,y}=this.movingPens[g],p={x:m,y};if(o&&!this.movingPens[g].type){const _=this.getPenRect(this.movingPens[g]),b=parseInt((_.x/s).toFixed()),C=parseInt((_.y/s).toFixed()),P=b*s,S=C*s;p.x=n.x+P*r,p.y=n.y+S*r}Object.assign(f,p),(x=f.onMove)==null||x.call(f,f),this.updatePenRect(f),this.updateLines(f),this.store.emitter.emit("updateLines",f),this.patchFlagsLines.forEach(_=>{_.type&&this.initLineRect(_)}),this.patchFlagsLines.clear(),f.calculative.x=f.x,f.calculative.y=f.y,f.calculative.initRect&&(f.calculative.initRect.x=f.calculative.x,f.calculative.initRect.y=f.calculative.y,f.calculative.initRect.ex=f.calculative.x+f.calculative.width,f.calculative.initRect.ey=f.calculative.y+f.calculative.height),t0(f),f.parentId&&this.parent.updateRectbyChild(f.calculative.worldRect,f,this.store.pens[f.parentId])}),this.initImageCanvas(this.store.active),this.initTemplateCanvas(this.store.active),!this.dock)return;const{xDock:l,yDock:u}=this.dock;let c;l&&(c=this.store.pens[l.penId]),!c&&u&&(c=this.store.pens[u.penId]);const d=ot(this.store.active,!0);if(t&&this.store.active.length===1&&(c==null?void 0:c.type)===1&&((l==null?void 0:l.anchorId)||(u==null?void 0:u.anchorId))){const f=ce(c),g=jt(c);if(l!=null&&l.anchorId){const m=this.store.pens[this.store.active[0].id+je].calculative.worldAnchors.find(y=>y.id===l.anchorId);m.x===f.x&&m.y===f.y?(a.push(ot(c,!0)),xe(this.store.active[0],m,c,f),d.push(ot(c,!0))):m.x===g.x&&m.y===g.y&&(a.push(ot(c,!0)),xe(this.store.active[0],m,c,g),d.push(ot(c,!0)))}else if(u!=null&&u.anchorId){const m=this.store.pens[this.store.active[0].id+je].calculative.worldAnchors.find(y=>y.id===u.anchorId);m.x===f.x&&m.y===f.y?(a.push(ot(c,!0)),xe(this.store.active[0],m,c,f),d.push(ot(c,!0))):m.x===g.x&&m.y===g.y&&(a.push(ot(c,!0)),xe(this.store.active[0],m,c,g),d.push(ot(c,!0)))}}o&&(this.calcActiveRect(),this.getSizeCPs()),this.pushHistory({type:_t.Update,pens:d,initPens:a}),this.store.emitter.emit("translatePens",d)}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){if(!this.store.active.length)return;this.initTemplateCanvas(this.store.active),this.store.active.forEach(a=>{a.calculative.active=void 0,a.calculative.activeAnchor=void 0,a.calculative.hover=!1,Cs(a,!1)});const i=[...this.store.active];this.store.active=[],this.activeRect=void 0,this.sizeCPs=void 0,this.store.activeAnchor=void 0,this.patchFlags=!0,!t&&this.store.emitter.emit("inactive",i)}active(t,i=!0){if(this.store.active&&this.store.active.length){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,Cs(a,!1)}this.store.active=[],t.forEach(a=>{a.calculative.active=!0,Cs(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=aa(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:o}=this.activeRect;t.forEach(l=>{const u={x:l.x*s+i,y:l.y*n+a};Zt(u,r,o),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.x<i.x&&(a>0?a-=180:a+=180)):i.y>t.y?a=90:i.y<t.y&&(a=-90),a=Math.round(a/15)*15;let s=Math.sqrt((i.x-t.x)*(i.x-t.x)+(i.y-t.y)*(i.y-t.y));t.x=i.x+Math.cos(a/180*Math.PI)*s,t.y=i.y-Math.sin(a/180*Math.PI)*s}clearHover(){this.hoverType=xt.None,this.store.hover=null,this.store.hoverAnchor=null}inAnchor(t,i,a){var s;if(this.store.hoverAnchor=void 0,this.movingAnchor=void 0,!a||a.locked>It.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(o=>o.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(As(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&&As(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&&As(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)),Di(a);this.render()}clearCanvas(){this.activeRect=void 0,this.sizeCPs=void 0,this.__loadMap=new Map,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:_t.Add,pens:[t]}),t}addPenSync(t,i,a,s){if(!(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:_t.Add,pens:[t]}),t}pushHistory(t){var s;if(this.store.data.locked)return;const{origin:i,scale:a}=this.store.data;t.origin=ot(i),t.scale=a,t.type!==_t.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<this.store.histories.length-1&&this.store.histories.splice(this.store.historyIndex+1,this.store.histories.length-this.store.historyIndex-1),(s=t.pens)==null||s.forEach(n=>{let r;if(t.initPens)for(const o of t.initPens)o.id===n.id&&(r=o);if(r)for(const o in n)r[o]==null&&(r[o]=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==_t.Add||t.type==_t.Delete||t.type==_t.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==_t.Add||t.type==_t.Delete||t.type==_t.Update)&&this.activeHistory()}activeHistory(){let t=this.store.histories[this.store.historyIndex+1];const i=[];if(t&&t.type===_t.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===_t.Add||a.type===_t.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 _t.Add:t.pens.forEach(n=>{var l;const r=ot(n,!0),o=this.store.data.pens.findIndex(u=>u.id===r.id);if(o>-1){(l=r.onDestroy)==null||l.call(r,this.store.pens[r.id]);const u=r.parentId?this.store.pens[r.parentId]:void 0;u!=null&&u.children&&(u.children=u.children.filter(c=>c!==r.id)),this.store.data.pens.splice(o,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=_t.Delete;break;case _t.Update:const a=i?t.initPens:t.pens,s=i?t.pens:t.initPens;a.forEach(n=>{const r=ot(n,!0),o=this.store.data.pens.findIndex(l=>l.id===r.id);if(o>-1){if(r.calculative=this.store.data.pens[o].calculative,this.store.data.pens[o].type&&this.store.data.pens[o].lastConnected){for(let u in this.store.data.pens[o].lastConnected)if(this.store.pens[u]){let c=ot(this.store.data.pens[o].lastConnected[u]);this.store.pens[u].connectedLines=c,r.anchors.forEach(d=>{c.forEach(f=>{d.id===f.lineAnchor&&(d.connectTo=u)})})}}this.store.data.pens[o]=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 l=this.getPenRect(r,t.origin,t.scale);if(this.setPenRect(r,l,!1),this.updateLines(r,!0),r.calculative.canvas.parent.isCombine(r)){let u=s.find(c=>c.id===r.id);Tg.forEach(c=>{r[c]!==u[c]&&this.parent.setValue({id:r.id,[c]:r[c]},{render:!0,doEvent:!1})})}}});break;case _t.Delete:t.pens.reverse().forEach(n=>{var o,l;const r=ot(n,!0);if(r.calculative||(r.calculative={}),this.store.data.pens.splice(((o=r.calculative)==null?void 0:o.layer)!==-1?(l=r.calculative)==null?void 0:l.layer:this.store.data.pens.length,0,r),r.path&&!this.store.data.paths[r.pathId]&&(this.store.data.paths[r.pathId]=r.path),r.calculative.canvas=this,this.store.pens[r.id]=r,r.parentId){const u=this.store.pens[r.parentId];u&&(!u.children&&(u.children=[]),u.children.includes(r.id)||u.children.push(r.id))}if(r.type&&r.lastConnected)for(let u in r.lastConnected)this.store.pens[u]&&(this.store.pens[u].connectedLines=r.lastConnected[u])}),t.pens.reverse().forEach(n=>{const r=this.store.pens[n.id],o=this.getPenRect(r,t.origin,t.scale);this.setPenRect(r,o,!1),r.calculative.image=void 0,r.calculative.backgroundImage=void 0,r.calculative.strokeImage=void 0,this.loadImage(r)}),t.type=_t.Add;break;case _t.Replace:{const n=i?t.initPens:t.pens;(i?t.pens:t.initPens).forEach(o=>{var c;const l=ot(o,!0);if(this.store.data.pens.findIndex(d=>d.id===l.id)>-1){(c=l.onDestroy)==null||c.call(l,this.store.data.pens.find(f=>f.id===l.id));const d=this.store.data.pens.findIndex(f=>f.id===l.id);this.store.data.pens.splice(d,1),this.store.pens[l.id]=void 0,l.calculative||(l.calculative={}),l.calculative.canvas=this,this.store.animates.delete(l),this.store.animateMap.delete(l)}}),n.reverse().forEach(o=>{var u,c;const l=ot(o,!0);if(l.calculative||(l.calculative={}),this.store.data.pens.splice(((u=l.calculative)==null?void 0:u.layer)!==-1?(c=l.calculative)==null?void 0:c.layer:this.store.data.pens.length,0,l),this.store.pens[l.id]=l,l.type&&l.lastConnected)for(let d in l.lastConnected)this.store.pens[d]&&(this.store.pens[d].connectedLines=l.lastConnected[d]);l.calculative.canvas=this}),n.reverse().forEach(o=>{const l=this.store.data.pens.find(c=>c.id===o.id),u=this.getPenRect(l,t.origin,t.scale);this.setPenRect(l,u,!1),l.calculative.image=void 0,l.calculative.backgroundImage=void 0,l.calculative.strokeImage=void 0,this.loadImage(l)}),t.type=_t.Replace;break}}if(t.type===_t.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=Tt()),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=Tt());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&&wt.anchors[t.name]&&(t.anchors||(t.anchors=[]),wt.anchors[t.name](t)),!t.anchors){const r=ot(this.store.options.defaultAnchors);r.forEach((o,l)=>{o.id=`${l}`,o.penId=t.id}),t.anchors=r}this.updatePenRect(t),!t.anchors&&t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(r=>xn(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,wt.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=Fc(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),te(i),t.calculative.worldRect=i,Zc(t,i),Ii(t),Di(t),t.calculative&&(t.calculative.gradientAnimatePath=void 0),this.store.path2dMap.set(t,wt.path2dDraws[t.name](t)),t.calculative.worldAnchors&&(t.anchors=t.calculative.worldAnchors.map(r=>xn(r,t.calculative.worldRect)))}drawingPencil(){v0(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=ce(this.drawingLine);let a=jt(this.drawingLine);if(a.isTemp&&(this.drawingLine.calculative.worldAnchors.pop(),a=jt(this.drawingLine)),!t&&(!a.connectTo&&this.drawingLine.calculative.worldAnchors.pop(),ce(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(o=>{if(o.type){const l=ce(o),u=jt(o);return Xf(l,i)&&Xf(u,a)}})){this.drawingLine=void 0,this.render();return}if(this.drawingLine.lineName==="polyline"&&!a.connectTo&&this.drawingLine.calculative.worldAnchors.length>2){let r=this.drawingLine.calculative.worldAnchors[this.drawingLine.calculative.worldAnchors.length-2];Math.abs(r.x-a.x)/this.store.data.scale<5&&Math.abs(r.y-a.y)/this.store.data.scale<5&&this.drawingLine.calculative.worldAnchors.pop()}const s=Fc(this.drawingLine);Object.assign(this.drawingLine,s),this.drawingLine.calculative.worldRect=s,this.drawingLine.calculative.activeAnchor=jt(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:_t.Add,pens:ot([this.drawingLine],!0)})),this.store.path2dMap.set(this.drawingLine,wt.path2dDraws[this.drawingLine.name](this.drawingLine)),this.drawingLine=void 0,this.drawingLineName=void 0,this.render()}async finishPencil(){if(this.pencilLine){const t=Sc(this.pencilLine.calculative.worldAnchors,10,0,this.pencilLine.calculative.worldAnchors.length-1);let i=ce(this.pencilLine);t.unshift({id:i.id,penId:i.penId,x:i.x,y:i.y}),i=jt(this.pencilLine),t.push({id:i.id,penId:i.penId,x:i.x,y:i.y}),this.pencilLine.calculative.worldAnchors=G5(t),this.pencilLine.calculative.worldAnchors.length>1&&(this.pencilLine.calculative.pencil=!1,this.store.path2dMap.set(this.pencilLine,wt.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:_t.Add,pens:ot([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:o,height:l}=t.calculative.worldRect;r.setAttribute("width",`${o}px`),r.setAttribute("height",`${l}px`);const c="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(new XMLSerializer().serializeToString(r))));i.src=c,i.crossOrigin=t.crossOrigin||this.store.options.crossOrigin||"anonymous",i.onload=()=>{t.calculative.img=i,t.calculative.imgNaturalWidth=i.naturalWidth||t.iconWidth,t.calculative.imgNaturalHeight=i.naturalHeight||t.iconHeight,wt.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(wt.htmlElements[t.image]){const i=wt.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||this.store.options.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,wt.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(wt.htmlElements[t.backgroundImage]){const i=wt.htmlElements[t.backgroundImage];t.calculative.backgroundImg=i}else{const i=new Image;i.crossOrigin=t.crossOrigin||this.store.options.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,wt.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(wt.htmlElements[t.strokeImage]){const i=wt.htmlElements[t.strokeImage];t.calculative.strokeImg=i}else{const i=new Image;i.crossOrigin=t.crossOrigin||this.store.options.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,wt.htmlElements[t.strokeImage]=i,this.imageLoaded(),t.canvasLayer===zt.CanvasTemplate&&t.name!=="gif"&&this.templateImageLoaded()}}t.calculative.strokeImage=t.strokeImage}}__loadImage(t,i=5){if(this.__loadMap.has(t))return this.__loadMap.get(t);const a=new Promise((s,n)=>{if(wt.htmlElements[t])s(wt.htmlElements[t]);else{const r=new Image;r.crossOrigin=this.store.options.crossOrigin||"anonymous",this.store.options.cdn&&!(t.startsWith("http")||t.startsWith("//")||t.startsWith("data:image"))?r.src=this.store.options.cdn+t:r.src=t,r.onload=()=>{wt.htmlElements[t]=r,this.__loadMap.delete(t),s(r)},r.onerror=()=>{i>0?(console.warn(`Image ${t} load failed, retrying... (${i})`),setTimeout(()=>{this.__loadMap.delete(t),this.__loadImage(t,i-1).then(s).catch(n)},1e3)):(this.__loadMap.set(t,0),n(new Error(`Failed to load image: ${t}`)))}}});return this.__loadMap.set(t,a),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.calculative.letterSpacing=(t.letterSpacing||0)*i,t.fontSize<1&&t.fontSize>0&&(t.calculative.fontSize=t.fontSize*t.calculative.worldRect.height),Ri(t.iconSize)&&(t.calculative.iconSize=t.iconSize*i),Ri(t.iconWidth)&&(t.calculative.iconWidth=t.iconWidth*i),Ri(t.iconHeight)&&(t.calculative.iconHeight=t.iconHeight*i),Ri(t.iconLeft)&&(t.calculative.iconLeft=t.iconLeft<1&&t.iconLeft>-1?t.iconLeft:t.iconLeft*i),Ri(t.iconTop)&&(t.calculative.iconTop=t.iconTop<1&&t.iconTop>-1?t.iconTop:t.iconTop*i),Ri(t.textWidth)&&(t.calculative.textWidth=t.textWidth<1&&t.textWidth>-1?t.textWidth:t.textWidth*i),Ri(t.textHeight)&&(t.calculative.textHeight=t.textHeight<1&&t.textHeight>-1?t.textHeight:t.textHeight*i),Ri(t.textLeft)&&(t.calculative.textLeft=t.textLeft<1&&t.textLeft>-1?t.textLeft*t.calculative.worldRect.width:t.textLeft*i),Ri(t.textTop)&&(t.calculative.textTop=t.textTop<1&&t.textTop>-1?t.textTop*t.calculative.worldRect.height:t.textTop*i),Ri(t.borderWidth)&&t.type===Ut.Line&&t.borderWidth&&(t.calculative.borderWidth=t.borderWidth*i)}updatePenRect(t,{worldRectIsReady:i,playingAnimate:a}={}){i?qr(t):Qg(t),a||this.setCalculativeByScale(t),Is(t),ad(this.store.pens,t),Ii(t),Di(t),wt.path2dDraws[t.name]&&this.store.path2dMap.set(t,wt.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.bkType&&t.gradientColors||t.strokeType&&t.lineGradientColors||typeof t.background=="string"&&t.background.startsWith("linear-gradient"))&&(t.calculative.lineGradient&&(t.calculative.lineGradient=null),t.calculative.gradient&&(t.calculative.gradient=null),t.calculative.radialGradient&&(t.calculative.radialGradient=null))}initGlobalStyle(){if(this.store.options.themeOnlyCanvas||this.store.data.themeOnlyCanvas)return;const t={},i={},a={};M2.forEach(l=>{var u;if(this.store.options[l]!=null&&this.store.options[l]!==""&&(t[l]=this.store.options[l]),this.store.data[l]!=null&&this.store.data[l]!==""&&(i[l]=this.store.data[l]),this.store.data.theme){const c=(u=this.store.theme[this.store.data.theme])==null?void 0:u[l];c!=null&&c!==""&&(a[l]=c)}}),this.store.styles={};let s="";const n=this.store.data.width||this.store.options.width,r=this.store.data.height||this.store.options.height;!n&&!r&&(s="default");const o=gn.getThemeObj(this.store.data.theme||s);Object.assign(this.store.styles,t,i,a,o)}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.scale<this.width-a[1]*this.store.data.scale&&(this.store.data.x=this.width-a[1]*this.store.data.scale-(this.store.data.origin.x+s*this.store.data.scale))),this.height<(n+a[0]+a[2])*this.store.data.scale&&(this.store.data.y+this.store.data.origin.y>a[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.height-a[2]*this.store.data.scale&&(this.store.data.y=this.height-a[2]*this.store.data.scale-(this.store.data.origin.y+n*this.store.data.scale)))}this.store.data.asyncTranslate?(clearTimeout(this.transTimeout),this.transTimeout=setTimeout(()=>{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)Di(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 o;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,(o=this.store.clipboard)!=null&&o.pos&&Fs(this.store.clipboard.pos,n,i),Fs(this.store.data.origin,n,i),this.store.data.pens.forEach(l=>{if(l.onScale&&l.onScale(l),!l.parentId){if(di(l,n,i),l.isRuleLine){const u=1/n,c=l.calculative.worldRect.center;l.width&&l.height||di(l,u,c)}this.updatePenRect(l,{worldRectIsReady:!0}),this.execPenResize(l)}}),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)}animateView(t){var c,d;this.viewAnimationTimer&&(cancelAnimationFrame(this.viewAnimationTimer),this.viewAnimationTimer=void 0),this.viewAnimation=void 0;const i=(c=t.duration)!=null?c:300,a=(d=t.easing)!=null?d:"easeOutCubic",s=t.center?{...t.center}:{x:this.width/2,y:this.height/2};let n=t.x!==void 0?t.x:this.store.data.x,r=t.y!==void 0?t.y:this.store.data.y,o=t.scale!==void 0?t.scale:this.store.data.scale;const l=this.store.data.minScale||this.store.options.minScale,u=this.store.data.maxScale||this.store.options.maxScale;if(o<l&&(o=l),o>u&&(o=u),t.pen){const f={x:this.width/2,y:this.height/2};n=f.x-t.pen.calculative.worldRect.x-t.pen.calculative.worldRect.width/2,r=f.y-t.pen.calculative.worldRect.y-t.pen.calculative.worldRect.height/2}!t.pen&&Math.abs(n-this.store.data.x)<.5&&Math.abs(r-this.store.data.y)<.5&&Math.abs(o-this.store.data.scale)<.001||(this.calibrateMouse(s),this.viewAnimation={startTime:performance.now(),duration:i,fromX:this.store.data.x,fromY:this.store.data.y,fromScale:this.store.data.scale,toX:n,toY:r,toScale:o,easing:y_(a),center:s,pen:t.pen},this.animateViewFrame())}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(di(r,n,i),r.onScale&&r.onScale(r),r.isRuleLine){const o=n>1?1:1/n/n,l=r.calculative.worldRect.center;r.width&&r.height||di(r,o,l)}this.execPenResize(r)}}),this.calcActiveRect()}rotatePens(t){this.initPens||(this.initPens=ot(this.getAllByPens(this.store.active))),this.activeRect.rotate=gi(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:_t.Update,pens:ot(this.getAllByPens(this.store.active)),initPens:this.initPens}),this.initPens=void 0},200)}resizePens(t){if(this.initPens||(this.initPens=ot(this.store.active,!0)),!this.initActiveRect){this.initActiveRect=ot(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=ot(this.initActiveRect);if(wd(r,s,n,this.resizeIndex),te(r),!this.store.options.disableDock){this.clearDock();const g=this.customResizeDock||Y6;this.dock=g(this.store,r,this.store.active,this.resizeIndex);const{xDock:m,yDock:y}=this.dock;if(m){s+=m.step;const p=this.store.pens[m.penId];p.calculative.isDock=!0}if(y){n+=y.step;const p=this.store.pens[y.penId];p.calculative.isDock=!0}}const o=this.activeRect.width,l=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*l)/o),this.activeRect.ratio=this.initPens[0].ratio,wd(this.activeRect,u,c,this.resizeIndex),this.store.options.strictScope){const g=this.store.data.width||this.store.options.width,m=this.store.data.height||this.store.options.height;if(g&&m){let y={x:this.store.data.origin.x,y:this.store.data.origin.y,width:g*this.store.data.scale,height:m*this.store.data.scale};this.activeRect.x<y.x&&(this.activeRect.width=this.activeRect.width-(y.x-this.activeRect.x),this.activeRect.x=y.x),this.activeRect.y<y.y&&(this.activeRect.height=this.activeRect.height-(y.y-this.activeRect.y),this.activeRect.y=y.y),this.activeRect.x+this.activeRect.width>y.x+y.width&&(this.activeRect.width=this.activeRect.width-(this.activeRect.x+this.activeRect.width-(y.x+y.width)),this.activeRect.x=y.x+y.width-this.activeRect.width,this.activeRect.ex=this.activeRect.x+this.activeRect.width),this.activeRect.y+this.activeRect.height>y.y+y.height&&(this.activeRect.height=this.activeRect.height-(this.activeRect.y+this.activeRect.height-(y.y+y.height)),this.activeRect.y=y.y+y.height-this.activeRect.height,this.activeRect.ey=this.activeRect.y+this.activeRect.height)}}te(this.activeRect);const d=this.activeRect.width/o,f=this.activeRect.height/l;this.store.active.forEach((g,m)=>{g.calculative.worldRect.x=this.activeInitPos[m].x*this.activeRect.width+this.activeRect.x,g.calculative.worldRect.y=this.activeInitPos[m].y*this.activeRect.height+this.activeRect.y,g.calculative.worldRect.width*=d,g.calculative.iconWidth&&(g.calculative.iconWidth*=d),g.calculative.worldRect.height*=f,g.calculative.iconHeight&&(g.calculative.iconHeight*=f),re(g.calculative.worldRect),te(g.calculative.worldRect),this.updatePenRect(g,{worldRectIsReady:!0}),this.execPenResize(g,!0),this.updateLines(g)}),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:_t.Update,pens:ot(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}movePens(t){var o,l;if(!this.activeRect||this.store.data.locked)return;if(!this.initActiveRect){this.initActiveRect=ot(this.activeRect);return}if(!this.store.options.moveConnectedLine&&!this.canMoveLine&&this.store.active.length===1&&(((o=this.store.active[0].anchors[0])==null?void 0:o.connectTo)||((l=this.store.active[0].anchors[this.store.active[0].anchors.length-1])==null?void 0:l.connectTo))||(this.movingPens||(this.initMovingPens(),this.store.active.forEach(u=>{mn(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=ot(this.initActiveRect);Ua(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 d={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.x<d.x&&(s.x=d.x,n=!0),s.y<d.y&&(s.y=d.y,n=!0),s.x+s.width>d.x+d.width&&(s.x=d.x+d.width-s.width,n=!0),s.y+s.height>d.y+d.height&&(s.y=d.y+d.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||q6;this.dock=u(this.store,s,this.movingPens,r);const{xDock:c,yDock:d}=this.dock;let f;c&&(r.x+=c.step,f=this.store.pens[c.penId],f.calculative.isDock=!0),d&&(r.y+=d.step,f=this.store.pens[d.penId],f.calculative.isDock=!0)}this.translatePens(this.movingPens,r.x,r.y,!0)}changeIdsByMoving(t,i){t.id+=je,t.parentId&&i.find(a=>a.id===t.parentId)&&(t.parentId+=je),t.children&&(t.children=t.children.map(a=>a+je)),t.connectedLines&&(t.connectedLines=t.connectedLines.map(a=>(i.find(s=>s.id===a.lineId)&&(a.lineId+=je),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+=je),a)))}initMovingPens(){var a,s;if(!this.store.options.moveConnectedLine&&!this.canMoveLine)for(let n=0;n<this.store.active.length;n++){const r=this.store.active[n];(((a=r.anchors[0])==null?void 0:a.connectTo)||((s=r.anchors[r.anchors.length-1])==null?void 0:s.connectTo))&&(this.store.active.splice(n,1),r.calculative.active=void 0,--n)}this.movingPens=ot(this.store.active,!0),this.movingPens=this.getAllFollowersByPens(this.movingPens);const t=this.getAllByPens(this.movingPens),i=ot(t,!0);t.forEach(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")||bc.includes(n.name)||this.store.options.domShapes.includes(n.name)||n.image||n.isDom)&&(r.name="rectangle",r.onDestroy=void 0),this.updateValue(n,r),n.calculative.image=void 0})}moveLineAnchor(t,i){var o,l,u,c,d;if(!this.activeRect||this.store.data.locked)return;if(this.initPens||(this.initPens=ot(this.store.active,!0)),(o=this.store.activeAnchor)!=null&&o.connectTo){const f=this.store.pens[this.store.activeAnchor.connectTo];Ss(f,Na(f,this.store.activeAnchor.anchorId),this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor)}let a=(l=this.store.activeAnchor)==null?void 0:l.id,s=(c=(u=this.store.pens[this.store.activeAnchor.penId])==null?void 0:u.connectedLines)==null?void 0:c.filter(f=>f.anchor===a);s&&s.length>0&&s.forEach(f=>{const g=this.store.pens[f.lineId];Ss(this.store.pens[this.store.activeAnchor.penId],this.store.activeAnchor,g,Na(g,f.lineAnchor))});const n=this.store.active[0];ce(n);const r=jt(n);if(n.lineName==="polyline"&&!i.shiftKey)X5(n,this.store.activeAnchor,t);else{let f=0,g=0;if(n.lineName==="line"){let m=n.calculative.worldAnchors.findIndex(p=>p.id===this.store.activeAnchor.id);m===0&&(m=2);let y=n.calculative.worldAnchors[m-1];if(i.ctrlKey&&i.shiftKey){let p=ot(t);this.getSpecialAngle(p,y),f=p.x-this.store.activeAnchor.x,g=p.y-this.store.activeAnchor.y}else if(!i.ctrlKey&&i.shiftKey){let p={x:t.x,y:y.y};f=p.x-this.store.activeAnchor.x,g=p.y-this.store.activeAnchor.y}else if(i.ctrlKey&&!i.shiftKey){let p={x:y.x,y:t.y};f=p.x-this.store.activeAnchor.x,g=p.y-this.store.activeAnchor.y}else f=t.x-this.store.activeAnchor.x,g=t.y-this.store.activeAnchor.y}else!i.ctrlKey&&i.shiftKey?(f=t.x-this.store.activeAnchor.x,g=0):i.ctrlKey&&!i.shiftKey?(f=0,g=t.y-this.store.activeAnchor.y):(f=t.x-this.store.activeAnchor.x,g=t.y-this.store.activeAnchor.y);bn(this.store.activeAnchor,f,g),this.store.hover&&this.store.hoverAnchor&&this.store.hoverAnchor.penId!==this.store.activeAnchor.penId&&(this.store.hoverAnchor.type===Bi.Line?(f=t.x-this.store.activeAnchor.x,g=t.y-this.store.activeAnchor.y,Pr(this.store.activeAnchor,this.store.hoverAnchor,this.store)):(f=this.store.hoverAnchor.x-this.store.activeAnchor.x,g=this.store.hoverAnchor.y-this.store.activeAnchor.y),bn(this.store.activeAnchor,f,g),r.prev=void 0,n.lineName!=="polyline"&&((d=this[n.lineName])==null||d.call(this,this.store,n)))}this.patchFlagsLines.add(n),this.store.path2dMap.set(n,wt.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:_t.Update,pens:ot(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=ot(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,Zt(this.store.activeAnchor.next,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===qa.Bilateral&&this.prevAnchor){const a=gi(t,this.store.activeAnchor),s=gi(this.prevAnchor,this.store.activeAnchor);this.store.activeAnchor.next.x=this.nextAnchor.x,this.store.activeAnchor.next.y=this.nextAnchor.y,Zt(this.store.activeAnchor.next,a-s,this.store.activeAnchor)}}const i=this.store.active[0];this.patchFlagsLines.add(i),this.store.path2dMap.set(i,wt.path2dDraws[i.name](i)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:_t.Update,pens:ot(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=ot(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,Zt(this.store.activeAnchor.prev,180,this.store.activeAnchor);else if(this.store.activeAnchor.prevNextType===qa.Bilateral&&this.nextAnchor){const a=gi(t,this.store.activeAnchor),s=gi(this.nextAnchor,this.store.activeAnchor);this.store.activeAnchor.prev.x=this.prevAnchor.x,this.store.activeAnchor.prev.y=this.prevAnchor.y,Zt(this.store.activeAnchor.prev,a-s,this.store.activeAnchor)}}const i=this.store.active[0];this.patchFlagsLines.add(i),this.store.path2dMap.set(i,wt.path2dDraws[i.name](i)),this.render(),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=void 0,this.pushHistory({type:_t.Update,pens:ot(this.store.active,!0),initPens:this.initPens}),this.initPens=void 0},200)}async setAnchor(t){var s;const i=[ot(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===Ut.Line&&((s=a.calculative.worldAnchors)==null?void 0:s.length)<=2?this.delete([a]):(B6(a,this.store.hoverAnchor),a.type===Ut.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===Ut.Line){this.store.activeAnchor=T6(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:Tt(),x:t.x,y:t.y};this.store.activeAnchor=S6(a,n)}}this.hotkeyType=Yt.None,this.render(),a&&this.pushHistory({type:_t.Update,pens:[ot(a,!0)],initPens:i})}checkDisconnect(t,i){if(t.id.indexOf(je)>0){const a=t.id;t=this.store.pens[a.replace(je,"")]}t.anchors.forEach(a=>{if(a.connectTo&&!i.find(s=>s.id===a.connectTo||s.id===a.connectTo+je)){const s=this.store.pens[a.connectTo];if(!s||s.type)return;Ss(s,Na(s,a.anchorId),t,a)}})}translatePens(t=this.store.active,i,a,s){if(!t||!t.length||t.some(l=>{if(l.locked>=It.DisableMove)return!0}))return;const r=!s&&ot(t,!0);this.activeRect&&Ua(this.activeRect,i,a);const o=this.getAllByPens(t);t.forEach(l=>{var u,c;if(!(l.locked>=It.DisableMove)){if(l.type===Ut.Line){if(!this.store.options.moveConnectedLine&&!this.canMoveLine||l.isRuleLine)return;sd(l,i,a),this.checkDisconnect(l,o),this.store.path2dMap.set(l,wt.path2dDraws[l.name](l)),s||(this.initLineRect(l),(u=l.connectedLines)==null||u.forEach(d=>{const f=this.store.pens[d.lineId];this.initLineRect(f)}))}else Ua(l.calculative.worldRect,i,a),this.updatePenRect(l,{worldRectIsReady:!0}),l.calculative.x=l.x,l.calculative.y=l.y,l.calculative.initRect&&(l.calculative.initRect.x=l.calculative.x,l.calculative.initRect.y=l.calculative.y,l.calculative.initRect.ex=l.calculative.x+l.calculative.width,l.calculative.initRect.ey=l.calculative.y+l.calculative.height);this.updateLines(l),(c=l.onMove)==null||c.call(l,l)}}),this.activeRect&&this.getSizeCPs(),this.render(),this.tooltip.translate(i,a),s||(this.pushHistory({type:_t.Update,pens:ot(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===Ut.Line){if(!this.store.options.moveConnectedLine&&!this.canMoveLine)return;sd(n,i,a),this.checkDisconnect(n,s),this.store.path2dMap.set(n,wt.path2dDraws[n.name](n))}else Ua(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=ce(t),r=jt(t),o=Rs(a,i===n?r:n);!o||(i.x=o.x,i.y=o.y,i.prev=void 0,i.next=void 0,s?s.anchor=o.id:xe(a,o,t,i),this[t.lineName]&&this[t.lineName](this.store,t),this.store.path2dMap.set(t,wt.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&&i0(t,s,t.calculative.worldRect):t.calculative.rotate=t.rotate;const n=ot(this.store.animateMap.get(t));n&&(n.id=t.id,this.parent.setValue(n,{doEvent:!1,render:!1,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,Ws(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 o=Na(r,s.lineAnchor);if(!o)return;if(!o.connectTo){t.connectedLines.splice(n,1);return}if(r.autoFrom){const f=ce(r);f.id===o.id&&this.calcAutoAnchor(r,f,t,s)}if(r.autoTo){const f=jt(r);f.id===o.id&&this.calcAutoAnchor(r,f,t,s)}const l=Na(t,s.anchor);if(!l)return;let u=t.rotate;t.flipX&&(u*=-1),t.flipY&&(u*=-1);let c=o.distance*this.store.data.scale*Math.cos((u+l.rotate)/180*Math.PI)||0,d=o.distance*this.store.data.scale*Math.sin((u+l.rotate)/180*Math.PI)||0;if(t.flipX&&(c=-c),t.flipY&&(d=-d),bn(o,l.x-o.x+c,l.y-o.y+d),this.store.options.autoPolyline&&!this.autoPolylineFlag&&r.autoPolyline!==!1&&r.lineName==="polyline"){let f=ce(r),g=jt(r),m=!1;f.id===o.id?(f=o,m=!0):g.id===o.id&&(g=o,m=!0),m&&(r.calculative.worldAnchors=[f,g],r.calculative.activeAnchor=f,this.polyline(this.store,r,g),this.initLineRect(r))}this.store.path2dMap.set(r,wt.path2dDraws[r.name](r)),this.patchFlagsLines.add(r),r.calculative.gradientSmooth&&(r.calculative.gradientAnimatePath=Gc(r)),i&&ho(r)})}calcActiveRect(){const t=this.store.active.filter(i=>(!i.locked||i.locked<It.DisableMove)&&i.visible!=!1);if(t.length)t.length===1?(this.activeRect=ot(t[0].calculative.worldRect),this.activeRect.rotate=t[0].calculative.rotate||0,te(this.activeRect)):(this.activeRect=Ei(t),this.activeRect.rotate=0);else return;this.lastRotate=0,this.getSizeCPs()}rotatePen(t,i,a){t.rotateByRoot||(t.name==="line"?(t.calculative.worldAnchors.forEach(s=>{Zt(s,i,a.center)}),this.initLineRect(t),qr(t)):(t.calculative.rotate?t.calculative.rotate+=i:t.calculative.rotate=i,Zt(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,o,l;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((l=a.animations)!=null&&l.length){const u=ot(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=(o=a.animations)==null?void 0:o.findIndex(f=>f.autoPlay),c=u===-1?0:u;const d=ot(a.animations[c]);delete d.name,d.currentAnimation=c,!a.type&&d.frames&&(d.showDuration=this.parent.calcAnimateDuration(d)),this.parent.setValue({id:a.id,...d},{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.lastAnimateRender<this.store.options.animateInterval){this.store.animates.size>0&&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)I6(s,t)?s.calculative.patchFlags&&(te(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(!M6(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]);qr(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=Tt(),{origin:s,scale:n}=this.store.data;this.store.clipboard=void 0,localStorage.removeItem(this.clipboardName),sessionStorage.setItem("page",a);let r=ot(t,!0);r||(r=ot(this.store.active,!0),r.length===1&&r[0].parentId&&(r[0].parentId=void 0,r[0].x=r[0].calculative.worldRect.x,r[0].y=r[0].calculative.worldRect.y,r[0].width=r[0].calculative.worldRect.width,r[0].height=r[0].calculative.worldRect.height));let o=this.getAllByPens(r);o.forEach(u=>{var c;u.copyIndex=this.store.data.pens.findIndex(d=>d.id===u.id),(c=u.followers)!=null&&c.length&&(u.followers=void 0),u.pathId&&(u.path=this.store.data.paths[u.pathId])}),o.sort((u,c)=>u.copyIndex-c.copyIndex);const l={meta2d:!0,pens:o,origin:ot(s),scale:n,page:a,initRect:ot(this.activeRect),offset:10,mousePos:ot(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 l,u;let t,i;if(navigator.clipboard&&!this.store.options.disableClipboard&&!navigator.userAgent.includes("Firefox"))try{t=await((l=navigator.clipboard)==null?void 0:l.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=ot(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,d=-this.store.clipboard.initRect.height/this.store.clipboard.scale/10/r,f=(r-this.store.clipboard.scale)*this.store.clipboard.initRect.width/2+c,g=(r-this.store.clipboard.scale)*this.store.clipboard.initRect.height/2+d;r<this.store.clipboard.scale&&(f=(r-this.store.clipboard.scale)/((this.store.clipboard.scale-r)*100)*this.store.clipboard.initRect.width/2+c,g=(r-this.store.clipboard.scale)/((this.store.clipboard.scale-r)*100)*this.store.clipboard.initRect.height/2+d),this.store.clipboard.pens.length>1&&(f=(r-1)*this.store.clipboard.initRect.width/this.store.clipboard.scale/2,g=(r-1)*this.store.clipboard.initRect.height/this.store.clipboard.scale/2),this.store.clipboard.pos={x:this.mousePos.x-f,y:this.mousePos.y-g},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);const o=this.store.clipboard.pens.filter(c=>!c.parentId);for(const c of o)this.pastePen(c,void 0);(u=this.keyOptions)!=null&&u.F||this.store.clipboard.pens.forEach(c=>{delete c.copyIndex}),sessionStorage.setItem("page",i.page),this.active(o),this.pushHistory({type:_t.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(...ot(Le(a,this.store),!0));return i.concat(t)}getAllFollowersByPens(t,i=!0){const a=t;for(const s of t){let n=Xc(s,this.store);i&&(n=ot(n,!0));for(const r of n)a.find(o=>o.id===r.id)||a.push(r)}return a}setFollowers(t=this.store.active){if(!(!t||t.length===0))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;s<i.connectedLines.length;s++){const{lineId:n}=i.connectedLines[s],r=a.find(o=>o.id===n);if(r){const o=r.anchors[0],l=r.anchors[r.anchors.length-1];o.connectTo===t&&(o.connectTo=i.id),l.connectTo===t&&(l.connectTo=i.id)}else i.connectedLines.splice(s,1),s--}}changeNodeConnectedLine(t,i,a){var o;const s=i.anchors[0],n=i.anchors[i.anchors.length-1],r=[s,n];for(const l of r){const u=l.connectTo;if(u){const c=a.find(d=>d.id===u);c?(o=c.connectedLines)==null||o.forEach(d=>{d.lineId===t&&(d.lineId=i.id,d.lineAnchor=l.id)}):(l.connectTo=void 0,l.prev&&(l.prev.connectTo=void 0),l.next&&(l.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:_t.Delete,pens:s})}this.store.emitter.emit("delete",t)}deleteSync(t=this.store.active,i=!1,a=!0){if(!t||!t.length||(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:_t.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=We(s),o=r.children.indexOf(s.id);r.children.splice(o,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),s.pathId&&(s.path=this.store.data.paths[t.pathId]),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=We(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&&(this.store.data.pens.some(n=>n.pathId===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;a<t.connectedLines.length;a++){const{lineId:s,lineAnchor:n}=t.connectedLines[a],r=this.store.pens[s];if(r){let o=r.anchors.find(l=>l.id===n);(o==null?void 0:o.connectTo)===t.id&&(o.connectTo=void 0,o.anchorId=void 0,o.prev&&(o.prev.connectTo=void 0),o.next&&(o.next.connectTo=void 0)),o=Na(r,n),o&&(o.connectTo=void 0,o.anchorId=void 0,o.prev&&(o.prev.connectTo=void 0),o.next&&(o.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(o=>{Ss(n,o,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(){var i;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 a=0;a<document.styleSheets.length;a++)document.styleSheets[a].title==="le5le.com"&&(t=document.styleSheets[a]);if(!t){const a=document.createElement("style");a.title="le5le.com",document.head.appendChild(a),t=a.sheet,t.insertRule(".meta2d-input{display:none;position:absolute;outline:none;align-items: center;}"),t.insertRule(".meta2d-input textarea{resize:none;border:none;outline:none;background:transparent;flex-grow:1;height:100%;left:0;top:0}"),t.insertRule(".meta2d-input .right{width:10px;height:10px;flex-shrink:0;border-top: 1px solid;border-right: 1px solid;margin-right: 5px;transition: all .3s cubic-bezier(.645,.045,.355,1);position:absolute;right:1px;}"),t.insertRule(".meta2d-input ul{position:absolute;top:100%;margin-top:4px; width:calc(100% + 10px);min-height:30px;border-radius: 2px;box-shadow: 0 2px 8px #00000026;list-style-type: none;background-color: #fff;padding: 4px 0;max-height: 105px;overflow-y: auto;}"),t.insertRule(".meta2d-input ul li{padding: 5px 12px;line-height: 22px;white-space: nowrap;cursor: pointer;}"),t.insertRule(".meta2d-input ul li:hover{background: #eeeeee;}"),(i=CSS.supports)!=null&&i.call(CSS,"selector(.input-div::-webkit-scrollbar)")&&t.insertRule(".input-div::-webkit-scrollbar {display:none}"),t.insertRule(".input-div{scrollbar-width: none;}"),t.insertRule(".meta2d-input .input-div{resize:none;border:none;outline:none;background:transparent;flex-grow:1;height:100%;width: 100%;left:0;top:0;display:flex;text-align: center;justify-content: center;flex-direction: column;}"),t.insertRule(".input-div div{}")}this.inputDiv.onfocus=a=>{if(navigator.userAgent.includes("Firefox")){if(!a.target.innerText){let s=this.inputDiv.offsetWidth/2;window.getComputedStyle(this.inputDiv,null).textAlign!=="center"&&(s=0),this.inputDiv.innerHTML=`<br style="margin-left:${s}px;margin-top:4px;" />`}}else if(a.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.inputDiv.oninput=a=>{const s=this.store.pens[this.inputDiv.dataset.penId],n=a.target.innerText;if((s==null?void 0:s.dropdownList)&&!n.trim()){const r={};s.dropdownList.forEach(o=>{typeof o=="object"&&Object.keys(o).forEach(l=>{l!=="text"&&(r[l]=void 0)})}),this.updateValue(s,r)}if(s&&s.inputType==="number"){const r=j2(n);n!==r&&(a.preventDefault(),a.target.innerText=r)}if(navigator.userAgent.includes("Firefox")){if(!a.target.innerText.trim()){let r=this.inputDiv.offsetWidth/2;window.getComputedStyle(this.inputDiv,null).textAlign!=="center"&&(r=0),this.inputDiv.innerHTML=`<br style="margin-left:${r}px;margin-top:4px;" />`}}else if(a.target.innerText)this.inputDiv.style.paddingTop="";else{let r=window.getComputedStyle(this.inputDiv,null);r.justifyContent==="center"&&(this.inputDiv.style.paddingTop=` ${this.inputDiv.offsetHeight/2-parseFloat(r.lineHeight)/2}px`)}this.store.emitter.emit("input",s)},this.inputDiv.onclick=a=>{a.stopPropagation();const s=this.store.pens[this.inputDiv.dataset.penId];this.dropdown.style.display==="block"?this.dropdown.style.display="none":(s==null?void 0:s.dropdownList)&&this.store.data.locked&&(this.dropdown.style.display="block"),this.store.emitter.emit("clickInput",s)},this.inputDiv.onkeyup=a=>{this.setDropdownList(!0);const s=this.store.pens[this.inputDiv.dataset.penId];this.store.emitter.emit("input",{pen:s,text:a.key}),a.stopPropagation()},this.inputDiv.onkeydown=a=>{if(a.key==="Enter"){const s=this.store.pens[this.inputDiv.dataset.penId];s.input&&s.whiteSpace==="nowrap"&&this.hideInput()}a.stopPropagation()},this.inputDiv.onmousedown=this.stopPropagation,this.inputDiv.onwheel=a=>{a.stopPropagation()},this.inputDiv.onpaste=a=>{a.preventDefault();let s="";a.clipboardData&&a.clipboardData.getData&&(s=a.clipboardData.getData("text/plain")),document.execCommand("insertHTML",!1,s)}}clearDropdownList(){if(this.dropdown.hasChildNodes())for(let t=0;t<this.dropdown.childNodes.length;t++)this.dropdown.childNodes[t].remove(),--t}dropdownAppendOption(t,i){const a=document.createElement("li");a.onwheel=this.stopPropagation,a.innerText=t,a.style.overflow="hidden",a.style.textOverflow="ellipsis",a.title=t,a.style.zoom=this.store.data.scale,a.onmousedown=this.stopPropagation,a.dataset.i=i+"",a.onclick=this.selectDropdown,a.ontouchstart=this.selectDropdown;const s=this.store.pens[this.inputDiv.dataset.penId];a.onmouseenter=()=>{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,o,l,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 d=this.store.pens[a.parentId],f=(n=d.children)==null?void 0:n.findIndex(g=>g===t);f!==-1&&((r=d.children)==null||r.splice(f,1,i))}(o=a.children)==null||o.forEach(d=>{const f=this.store.pens[d];f.parentId=i}),a.formId&&a.followers.forEach(d=>{const f=this.store.pens[d];f.formId=i}),a.type===Ut.Line?this.changeNodeConnectedLine(t,a,this.store.data.pens):(this.changeLineAnchors(t,a,this.store.data.pens),(l=a.connectedLines)==null||l.forEach(({lineId:d})=>{const f=this.store.pens[d];Is(f)})),(u=a.anchors)==null||u.forEach(d=>d.penId=i),(c=a.calculative.worldAnchors)==null||c.forEach(d=>d.penId=i)}}updateValue(t,i){var m,y,p,x,_,b;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,o=!1,l=!1,u=!1,c=!1,d=!1,f,g=!1;for(const C in i)C.indexOf(".")===-1?(C==="rotate"?t.disableRotate?t.rotate=t.calculative.rotate||0:f=t.calculative.rotate||0:C==="canvasLayer"||C==="isBottom"||C==="showChild"?d=!0:C==="image"&&(g=!0),(typeof t[C]!="object"||C==="lineDash")&&(!t.disableRotate||C!=="rotate")&&(t.calculative[C]=i[C]),n2.includes(C)&&(o=!0),["name","borderRadius","lineSmooth","close"].includes(C)&&(r=!0),r2.includes(C)&&(c=!0),o2.includes(C)&&(l=!0),l2.includes(C)&&(u=!0),t.image&&t.name!=="gif"&&Sg.includes(C)&&(g=!0)):(delete t[C],so(t,C,i[C])),C.split(".")[0]==="anchors"&&Is(t);if(this.setCalculativeByScale(t),n&&((m=t.onDestroy)==null||m.call(t,t),c2(t)),c){const C={x:(y=i.x)!=null?y:a.x,y:(p=i.y)!=null?p:a.y,width:(x=i.width)!=null?x:a.width,height:(_=i.height)!=null?_: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 l?this.updatePenRect(t):(!t.hiddenText&&o&&Ii(t),u&&ad(this.store.pens,t),r&&wt.path2dDraws[t.name]&&this.store.path2dMap.set(t,wt.path2dDraws[t.name](t)));if(f!==void 0){const C=t.calculative.rotate;t.calculative.rotate=f,this.rotatePen(t,C-f,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.background!==void 0&&(t.calculative.gradient=void 0,t.calculative.radialGradient=void 0),i.bkType!==void 0&&(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),d?(this.canvasImage.init(),this.canvasImageBottom.init()):g&&(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&&(b=t.calculative.singleton)!=null&&b.div&&Pe(t,t.calculative.singleton.div)}execPenResize(t,i){var a,s;(a=t.onResize)==null||a.call(t,t,i),(s=t.children)==null||s.forEach(n=>{const r=this.store.pens[n];r&&this.execPenResize(r,i)})}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,!0),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){var P;const n=Ei(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 o=ot(n),l=this.store.data,u=a&&this.store.bkImg;let c=!1,d=!1;if(u){if(n.x+=l.x,n.y+=l.y,re(n),ea(n,this.canvasRect,!0))Object.assign(n,this.canvasRect);else{const S=Mn([...aa(n),...aa(this.canvasRect)]);Object.assign(n,S)}c=n.x===0,d=n.y===0}const f=this.store.data.width||this.store.options.width,g=this.store.data.height||this.store.options.height;let m=!1;f&&g&&!this.store.data.component&&(m=!0),m&&(n.x=this.store.data.origin.x,n.y=this.store.data.origin.y,n.width=f*this.store.data.scale,n.height=g*this.store.data.scale);const y=ot(n),p=Qi(t);n.x-=p[3]*r,n.y-=p[0]*r,n.width+=(p[3]+p[1])*r,n.height+=(p[0]+p[2])*r;const x=(s||1920)/n.width;n.width*=x,n.height*=x,re(n);const _=document.createElement("canvas");if(_.width=n.width,_.height=n.height,_.width>32767||_.height>32767||!navigator.userAgent.includes("Firefox")&&_.height*_.width>268435456||navigator.userAgent.includes("Firefox")&&_.height*_.width>472907776)throw new Error("can not to png, because the size exceeds the browser limit");const b=_.getContext("2d");b.textBaseline="middle",b.scale(x,x);const C=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;if(C&&m&&(b.save(),b.fillStyle=C,b.fillRect(0,0,y.width+(p[1]+p[3])*r,y.height+(p[0]+p[2])*r),b.restore()),u)if(m)b.drawImage(this.store.bkImg,p[3]*r||0,p[0]*r||0,y.width,y.height);else{const S=n.x<0?-n.x:0,B=n.y<0?-n.y:0;b.drawImage(this.store.bkImg,S,B,this.canvasRect.width,this.canvasRect.height)}if(C&&!m)if(u){const S=n.x<0?-n.x:0,B=n.y<0?-n.y:0;b.save(),b.fillStyle=C,b.fillRect(S,B,this.canvasRect.width,this.canvasRect.height),b.restore()}else b.save(),b.fillStyle=C,b.fillRect(0,0,o.width+(p[3]+p[1])*r,o.height+(p[0]+p[2])*r),b.restore();u?m?b.translate(-n.x,-n.y):b.translate((c?l.x:-o.x)+p[3]*r||0,(d?l.y:-o.y)+p[0]*r||0):b.translate(-n.x,-n.y);for(const S of this.store.data.pens){if(!lo(S,this.store)||S.visible==!1)continue;(P=S.onRenderPenRaw)==null||P.call(S,S);const{active:B}=S.calculative;S.calculative.active=!1,S.calculative.img?oo(b,S):Oa(b,S,!0),S.calculative.active=B}if(i){_.toBlob(i);return}return _.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(g=>g.id);const r=Ei(s);if(!isFinite(r.width))throw new Error("can not to png, because width is not finite");const o=ot(r),l=Qi(i);r.x-=l[3],r.y-=l[0],r.width+=l[3]+l[1],r.height+=l[0]+l[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 d=c.getContext("2d");d.textBaseline="middle",d.scale(u,u);const f=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;f&&(d.save(),d.fillStyle=f,d.fillRect(0,0,o.width+(l[3]+l[1]),o.height+(l[0]+l[2])),d.restore()),d.translate(-o.x+l[3],-o.y+l[0]);for(const g of this.store.data.pens)if(n.includes(g.id)){if(!lo(g,this.store)||g.visible==!1)continue;const{active:m}=g.calculative;g.calculative.active=!1,g.calculative.img?oo(d,g):Oa(d,g),g.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=[ot(this.store.active[0],!0)];this.store.activeAnchor.prev?this.store.activeAnchor.next||(this.store.activeAnchor.next={...this.store.activeAnchor.prev},Zt(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},Zt(this.store.activeAnchor.prev,180,this.store.activeAnchor),this.initLineRect(this.store.active[0]),this.patchFlags=!0),this.pushHistory({type:_t.Update,pens:[ot(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=[ot(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:_t.Update,pens:[ot(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=qa.Mirror),this.store.activeAnchor.prevNextType=(this.store.activeAnchor.prevNextType+1)%3)}gotoView(t,i){let a=Ei(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(ea(u.calculative.worldRect,this.dragRect,!0))return u.type===Ut.Line&&!this.store.options.dragAllIn?ic(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,o=(Math.floor(i.y)-this.store.data.origin.y)/a/n,l={x:r,y:o,width:(Math.ceil(i.width)+1)/a/s,height:(Math.ceil(i.height)+1)/a/n,children:t.map(u=>u.id),id:Tt(),active:!0};l.x<-.1&&(l.x=-.1),l.y<-.1&&(l.y=-.1),l.width>.5?(l.left=!0,l.right=!0,l.leftValue=l.x,l.rightValue=1-(l.x+l.width)):l.x<.5?(l.left=!0,l.leftValue=l.x,l.x>.2&&l.x+l.width>.5&&(l.right=!0,l.rightValue=1-(l.x+l.width))):(l.right=!0,l.rightValue=1-(l.x+l.width)),l.leftValue<.05&&(l.leftValue=0),l.rightValue<.05&&(l.rightValue=0),l.height>.5?(l.top=!0,l.bottom=!0,l.topValue=l.y,l.bottomValue=1-(l.y+l.height)):l.y<.5?(l.top=!0,l.topValue=l.y):(l.bottom=!0,l.bottomValue=1-(l.y+l.height)),l.topValue<.05&&(l.topValue=0),l.bottomValue<.05&&(l.bottomValue=0),this.store.data.fits||(this.store.data.fits=[]),this.store.data.fits.forEach(u=>{u.active=!1}),this.store.data.fits.push(l),this.canvasImage.activeFit=l,this.store.emitter.emit("fit",l),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 o=this.canvasImage.activeFit;if(this.canvasImage.currentFit==="top"){r<-.1&&(r=-.1);let c=r-o.y;if(o.height-=c,o.height<.01){o.height=.01;return}o.y=r}if(this.canvasImage.currentFit==="bottom"&&(r>1.1&&(r=1.1),o.height=r-o.y,o.height<=.01&&(o.height=.01)),this.canvasImage.currentFit==="left"){n<-.1&&(n=-.1);let c=n-o.x;if(o.width-=c,o.width<.01){o.width=.01;return}o.x=n}this.canvasImage.currentFit==="right"&&(n>1.1&&(n=1.1),o.width=n-o.x,o.width<=.01&&(o.width=.01));let l={x:o.x*a*i+this.store.data.origin.x,y:o.y*s*i+this.store.data.origin.y,width:o.width*a*i,height:o.height*s*i};re(l);const u=this.store.data.pens.filter(c=>{if(c.parentId||c.isRuleLine)return!1;if(ea(c.calculative.worldRect,l,!0))return c.type===Ut.Line&&!this.store.options.dragAllIn?ic(c,l):!0});o.left=void 0,o.leftValue=void 0,o.right=void 0,o.rightValue=void 0,o.top=void 0,o.topValue=void 0,o.bottom=void 0,o.bottomValue=void 0,o.width>.5?(o.left=!0,o.right=!0,o.leftValue=o.x,o.rightValue=1-(o.x+o.width)):o.x<.5?(o.left=!0,o.leftValue=o.x,o.x>.2&&o.x+o.width>.5&&(o.right=!0,o.rightValue=1-(o.x+o.width))):(o.right=!0,o.rightValue=1-(o.x+o.width)),Math.abs(o.leftValue)<.05&&(o.leftValue=0),Math.abs(o.rightValue)<.05&&(o.rightValue=0),o.height>.5?(o.top=!0,o.bottom=!0,o.topValue=o.y,o.bottomValue=1-(o.y+o.height)):o.y<.5?(o.top=!0,o.topValue=o.y-0):(o.bottom=!0,o.bottomValue=1-(o.y+o.height)),Math.abs(o.topValue)<.05&&(o.topValue=0),Math.abs(o.bottomValue)<.05&&(o.bottomValue=0),o.children=u.map(c=>c.id),this.store.emitter.emit("fit",o),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 o;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;(o=this.store.data.fits)==null||o.forEach((l,u)=>{l.ex=null,l.ey=null,Gi({x:a,y:s},l)&&(n=u),l.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.magnifierCanvas.render(),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.store.options.parentTouch?(this.parentElement.ontouchstart=void 0,this.parentElement.ontouchmove=void 0,this.parentElement.ontouchend=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 Wa.Document:document.removeEventListener("keydown",this.onkeydown),document.removeEventListener("keyup",this.onkeyup);break;case Wa.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 p_(e,t){const i=t||new Path2D;e.onDestroy||(e.onDestroy=w_,e.onMouseLeave=b_,e.onMouseUp=x_),e.formId=e.id;let a=e.calculative.borderRadius||0,s=a;const{x:n,y:r,width:o,height:l,ex:u,ey:c}=e.calculative.worldRect;e.calculative.worldTextRect,a<1&&(a=o*a,s=l*s);let d=a<s?a:s;if(o<2*d&&(d=o/2),l<2*d&&(d=l/2),i.moveTo(n+d,r),i.arcTo(u,r,u,c,d),i.arcTo(u,c,n,c,d),i.arcTo(n,c,n,r,d),i.arcTo(n,r,u,r,d),i instanceof Path2D)return i}function w_(e){e.followers.forEach(t=>{let i=e.calculative.canvas.store.pens[t];i.formKey=void 0,i.formValue=void 0,i.formType=void 0,i.formId=void 0})}function b_(e){const t=e.calculative.canvas.store.active;t&&t.length&&t.forEach(i=>{if(e.followers){let a=e.followers.findIndex(s=>s===i.id);if(a!==-1){const s=e.calculative.canvas.store.pens[i.id+je];s&&s.calculative&&(ea(s.calculative.worldRect,e.calculative.worldRect,!0)||(e.followers.splice(a,1),delete i.formKey,delete i.formValue,delete i.formType,delete i.formId))}}})}function x_(e){const t=e.calculative.canvas.store.active;t&&t.length&&t.forEach(i=>{let a=e.calculative.canvas.store.pens[i.id+je];if(a||(a=e.calculative.canvas.store.pens[i.id]),a&&a.calculative){let s=ot(e.calculative.worldRect);s.x-=1,s.y-=1,s.width+=2,s.height+=2,ea(a.calculative.worldRect,s,!0)&&(e.followers||(e.followers=[]),e.followers.includes(i.id)||e.followers.push(i.id),i.formId=e.id,A_(i))}})}function nc(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 __(e){const t=e.calculative.canvas.store.pens[e.formId];for(let i=t.followers.length-1;i>=0;i--){let a=t.followers[i];const s=e.calculative.canvas.store.pens[a];if(s&&s.formId&&s.formKey&&t.formData[s.formKey]){const n=s[s.formValue];let r="";Array.isArray(n)&&(r=[]),e.calculative.canvas.parent.setValue({id:s.id,[s.formValue]:r},{render:!1,doEvent:!1,history:!1})}s||t.followers.splice(i,1)}t.formData={},e.calculative.canvas.parent.render()}const E_={progress:"progress",cascadeFilterDom:"checked",treeFilterDom:"checked",dateRangePickerDom:"pickerTimes",datePickerDom:"pickerTimes",slider:"value",switch:"checked",inputDom:"text",checkbox:"selectedKeys",radio:"selectKey",rectangle:"text"};function A_(e){e.name==="rectangle"&&!e.input&&!e.dropdownList||(e.formValue=E_[e.name])}function C_(e,t){e.onDestroy||(e.onAdd=k_,e.onDestroy=R_,e.onMove=T_,e.onBeforeValue=S_,e.onMouseDown=B_,e.onMouseUp=I_);const i=t||new Path2D;if(i instanceof Path2D)return i}async function k_(e){e.sceneId||(e.sceneId=Tt())}const Tc=async(e,t)=>{var o;const i=e.calculative.canvas.store,a=i.data.origin,s=i.data.scale,n=t||e.vId,r=await qc(i,n);if(r&&((o=r.pens)==null?void 0:o.length)){const l=r.scale,u=r.origin;r.pens.forEach(d=>{d.parentId||(d.width=d.width/l,d.height=d.height/l,d.x=(d.x-u.x)/l+(e.x-a.x)/s,d.y=(d.y-u.y)/l+(e.y-a.y)/s),d.p_sceneId||(d.p_sceneId=e.sceneId,d.name!=="sceneContainer"&&(d.p_vId=n))}),e.calculative.canvas.parent.addPens(r.pens,!1,!0)}D_(e)},go=e=>{const t=e.calculative.canvas.parent;F_(e).forEach(a=>{t.canvas.delForce(a)}),t.canvas.canvasTemplate.init(),t.canvas.canvasImage.init(),t.canvas.canvasImageBottom.init(),t.render()},F_=e=>{let t=[];return e.calculative.canvas.parent.store.data.pens.forEach(a=>{a.p_sceneId&&e.sceneId&&a.p_sceneId===e.sceneId&&a.id!==e.id&&(a.calculative.locked=0,a.locked=0,t.push(a))}),t},P_=async e=>{e.calculative.drag&&e.calculative.active&&!(e.locked>1)&&(e.calculative.drag=!1,go(e),Tc(e))};function R_(e){go(e)}function S_(e,t){return t.vId&&(go(e),Tc(e,t.vId)),(t.x!==void 0||t.y!==void 0)&&(go(e),Tc(e)),t}function T_(e){Wg(P_,500,e)}function B_(e,t){e.calculative.drag=!0}function I_(e,t){e.calculative.drag=!1}function D_(e){let t=e.calculative.canvas.store.data.pens,i=t.findIndex(s=>s.id===e.id);if(i<0||i>=t.length)return t;const a=t.splice(i,1)[0];t.push(a)}function M_(e){const t=new Path2D;if(e.calculative.worldRect,e.calculative.singleton||(e.calculative.singleton={}),e.onDestroy||(e.onDestroy=L_,e.onResize=Rd,e.onRenderPenRaw=z_,e.onMove=Sd,e.onMouseMove=h0,e.onBeforeValue=O_),!e.calculative.singleton.div){const i=document.createElement("div");i.style.position="absolute",i.style.outline="none",i.style.left="-9999px",i.style.top="-9999px",e.ignoreEvent&&(i.style.pointerEvents="none");const a=e.html.iframe?document.createElement("iframe"):document.createElement("div");e.html.iframe?(a.srcdoc=e.html.content||"",a.onload=()=>{a.style.overflow="hidden",a.style.border="none",a.scrolling="no",Eo(e)}):a.innerHTML=e.html.content||"",a.style.width="100%",a.style.height="100%",a.style.outline="none",a.style.border="none",a.style.overflow="hidden",i.appendChild(a),e.calculative.canvas.externalElements.parentElement.appendChild(i),e.calculative.singleton.div=i,xo(e),Rd(e),Pe(e,i)}return Sd(e),t}function L_(e){iu(e),e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function O_(e,t){var a,s,n,r,o;const i=(s=(a=t.html)==null?void 0:a.content)!=null?s:t["html.content"];if(i!==void 0){const l=(r=(n=e.calculative.singleton)==null?void 0:n.div)==null?void 0:r.children[0];l&&(e.html.iframe?l.srcdoc=i:(l.innerHTML=i,l.onload=()=>{requestAnimationFrame(()=>Eo(e))}))}if(t.ignoreEvent!==void 0){const l=(o=e.calculative.singleton)==null?void 0:o.div;l&&(l.style.pointerEvents=t.ignoreEvent?"none":"")}return f0(e,t),t}const N_=e=>Eo(e);function Rd(e){const{width:t,height:i}=window.meta2d.getPenRect(e);e.calculative.singleton._width=t,e.calculative.singleton._height=i,Wg(N_,1e3,e)}function Sd(e){requestAnimationFrame(()=>{const t=e.calculative.worldRect,i=e.calculative.canvas.store,a=e.calculative.singleton.div;!a||(a.style.width=e.calculative.singleton._width+"px",a.style.height=e.calculative.singleton._height+"px",a.style.left=t.x+i.data.x-1/2*e.calculative.singleton._width+1/2*t.width+"px",a.style.top=t.y+i.data.y-1/2*e.calculative.singleton._height+1/2*t.height+"px",a.style.scale=e.calculative.canvas.store.data.scale)})}function Eo(e){var s,n;const t=(s=e.calculative.singleton)==null?void 0:s.div;if(!t)return;const i=t.children[0];if(!i)return;const a=e.html.iframe?(n=i.contentDocument)==null?void 0:n.querySelector("body"):i;!a||L6(e,a)}function z_(e){Eo(e)}function W_(e,t){var m,y;const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=a+n/2,l=s+r/2,u=Math.min(n,r)/2,c=(m=e.calculative.startAngle)!=null?m:45,d=(y=e.calculative.endAngle)!=null?y:135,f=(c-90)*Math.PI/180,g=(d-90)*Math.PI/180;if(i.moveTo(o,l),i.arc(o,l,u,f,g),i.closePath(),i instanceof Path2D)return i}function H_(e,t){var y,p;const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=a+n/2,l=s+r/2,u=n/2,c=r/2,d=(y=e.calculative.startAngle)!=null?y:0,f=(p=e.calculative.endAngle)!=null?p:180,g=(d-90)*Math.PI/180,m=(f-90)*Math.PI/180;if(i.ellipse(o,l,u,c,0,g,m),i instanceof Path2D)return i}function U_(e,t){const i=t||new Path2D;if(V_(e).forEach(({x:s,y:n},r)=>{r?i.lineTo(s,n):i.moveTo(s,n)}),i.closePath(),i instanceof Path2D)return i}function V_(e){const{x:t,y:i,width:a,height:s}=e.calculative.worldRect,n=t+a/2,r=i+s/2,o=Math.min(a,s)/2,l=Math.max(3,Math.round(Number(e.calculative.sides||e.calculative.sideCount||e.calculative.edgeCount)||5)),u=-Math.PI/2;return new Array(l).fill(0).map((c,d)=>{const f=u+Math.PI*2*d/l;return{x:n+o*Math.cos(f),y:r+o*Math.sin(f)}})}function $_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=a+n/2,l=s+r/2,u=Math.min(n,r)/2,c=8,d=Math.PI*2/c;let f=-Math.PI/2;i.moveTo(o+u*Math.cos(f),l+u*Math.sin(f));for(let g=1;g<=c;g++)f+=d,i.lineTo(o+u*Math.cos(f),l+u*Math.sin(f));if(i.closePath(),i instanceof Path2D)return i}function j_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=e.calculative.topRatio||.5,l=n*o,u=a+(n-l)/2,c=u+l;if(i.moveTo(u,s),i.lineTo(c,s),i.lineTo(a+n,s+r),i.lineTo(a,s+r),i.closePath(),i instanceof Path2D)return i}function q_(e){const t=e.calculative.topRatio||.5;e.anchors=[{id:"0",penId:e.id,x:0+(1-t)/2,y:0},{id:"1",penId:e.id,x:1-(1-t)/2,y:0},{id:"2",penId:e.id,x:0,y:1},{id:"3",penId:e.id,x:1,y:1}]}function Y_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=e.calculative.barRatio||.3,l=n*o,u=r*o,c=a+n/2,d=s+r/2;if(i.rect(c-l/2,s,l,r),i.rect(a,d-u/2,n,u),i instanceof Path2D)return i}function K_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r),i.lineTo(a,s),i.lineTo(a+n,s+r),i.closePath(),i instanceof Path2D)return i}function X_(e){e.anchors=[{id:"0",penId:e.id,x:0,y:0},{id:"1",penId:e.id,x:0,y:1},{id:"2",penId:e.id,x:1,y:1}]}function G_(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=e.calculative.skewRatio||.2,l=n*o;if(i.moveTo(a+l,s),i.lineTo(a+n,s),i.lineTo(a+n-l,s+r),i.lineTo(a,s+r),i.closePath(),i instanceof Path2D)return i}function Z_(e){const t=e.calculative.skewRatio||.2;e.anchors=[{id:"0",penId:e.id,x:t,y:0},{id:"1",penId:e.id,x:1,y:0},{id:"2",penId:e.id,x:0,y:1},{id:"3",penId:e.id,x:1-t,y:1}]}function J_(e){var t;if(e.onDestroy||(e.onDestroy=Q_,e.onMove=Lr,e.onResize=Lr,e.onRotate=Lr,e.onValue=Lr,e.onBeforeValue=tE),e.calculative.singleton||(e.calculative.singleton={}),!e.calculative.singleton.div){const i=document.createElement("div");i.style.position="absolute",i.style.outline="none",i.style.left="-9999px",i.style.top="-9999px",(t=e.calculative.canvas.externalElements)==null||t.parentElement.appendChild(i),e.calculative.singleton.div=i}return m0(e),Pe(e,e.calculative.singleton.div),e.calculative.singleton.div.style.pointerEvents="none",new Path2D}function Q_(e){e.calculative.singleton&&e.calculative.singleton.div&&(e.calculative.singleton.div.remove(),delete e.calculative.singleton.div)}function Lr(e){e.calculative.singleton.div&&Pe(e,e.calculative.singleton.div)}function tE(e,t){return(t.blur!==void 0||t.blurBackground!==void 0||t.background!==void 0||t.borderRadius!==void 0)&&requestAnimationFrame(()=>m0(e)),t}function m0(e){var n,r,o,l,u,c;const t=e.calculative.singleton.div;if(!t)return;const i=`blur(${(n=e.blur)!=null?n:10}px)`;t.style["backdrop-filter"]=i,t.style["-webkit-backdrop-filter"]=i,t.style.background=(l=(o=(r=e.blurBackground)!=null?r:e.calculative.background)!=null?o:e.background)!=null?l:"rgba(255, 255, 255, 0.25)";const a=e.calculative.canvas.store.data.scale||1,s=((c=(u=e.calculative.borderRadius)!=null?u:e.borderRadius)!=null?c:0)*a;t.style.borderRadius=s+"px"}const ve={};function eE(e){e.onDestroy||(e.onDestroy=iE,e.onMove=Td,e.onResize=aE,e.onRotate=Td,e.onValue=sE,e.onChangeId=nE);const t=new Path2D;if(!e.image)return;const a=e.calculative.canvas.store.id+"-"+e.id;if(!ve[a]){const s=new Image;s.crossOrigin=e.crossOrigin||e.calculative.canvas.parent.store.options.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),ve[a]=s,s.onload=()=>{var n;ve[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),Pn(e,s))}}return e.calculative.patchFlags&&ve[a]&&Pn(e,ve[a]),t}function iE(e){const i=e.calculative.canvas.store.id+"-"+e.id;ve[i]&&(ve[i].remove(),ve[i]=void 0)}function Td(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ve[i]||Pn(e,ve[i])}function aE(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ve[i]||Pn(e,ve[i])}function sE(e){const i=e.calculative.canvas.store.id+"-"+e.id;!ve[i]||(Pn(e,ve[i]),ve[i].getAttribute("src")!==e.image&&(ve[i].src=e.image))}function nE(e,t,i){const a=e.calculative.canvas.store.id;!ve[a+"-"+t]||(ve[a+"-"+i]=ve[a+"-"+t],delete ve[a+"-"+t])}function Pn(e,t){t.style.objectFit=e.imageRatio?"contain":"fill",Pe(e,t)}function rE(e,t){return e.onResize||(e.onResize=y0,e.onValue=oE),ja(e,t)}function y0(e){const t=e.anchors.filter(i=>i.flag!==1);p0(e),e.anchors=e.anchors.concat(...t)}function oE(e){y0(e),Is(e)}function p0(e){const t=[],{x:i,y:a,width:s,height:n}=e,r=lE(e),o=5;for(let d=0;d<o;d++){if(d===2)continue;let f=i+s*(d+1)/(o+1),g=a;f<i+r?g=Nr(i+r,g+r,f,r,-1):f>i+s-r&&(g=Nr(i+s-r,g+r,f,r,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(f-i)/s,y:(g-a)/n})}const l=3;for(let d=0;d<l;d++){let f=a+n*(d+1)/(l+1),g=i+s;f<a+r?g=Or(g-r,a+r,f,r):f>a+n-r&&(g=Or(g-r,a+n-r,f,r)),t.push({id:String(t.length),flag:1,penId:e.id,x:(g-i)/s,y:(f-a)/n})}const u=5;for(let d=0;d<u;d++){if(d===2)continue;let f=i+s*(d+1)/(u+1),g=a+n;f<i+r?g=Nr(i+r,g-r,f,r):f>i+s-r&&(g=Nr(i+s-r,g-r,f,r)),t.push({id:String(t.length),flag:1,penId:e.id,x:(f-i)/s,y:(g-a)/n})}const c=3;for(let d=0;d<c;d++){let f=a+n*(d+1)/(c+1),g=i;f<a+r?g=Or(g+r,a+r,f,r,-1):f>a+n-r&&(g=Or(g+r,a+n-r,f,r,-1)),t.push({id:String(t.length),flag:1,penId:e.id,x:(g-i)/s,y:(f-a)/n})}e.anchors=t}function lE(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<i?t:i;return a<2*n&&(n=a/2),s<2*n&&(n=s/2),n}function Or(e,t,i,a,s=1){return s*Math.sqrt(a**2-(i-t)**2)+e}function Nr(e,t,i,a,s=1){return s*Math.sqrt(a**2-(i-e)**2)+t}function cE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;if(i.moveTo(a,s+r),i.lineTo(a+n,s+r),i.closePath(),i instanceof Path2D)return i}function uE(e){const t=[{x:0,y:1},{x:1,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:s+"",x:i,y:a,penId:e.id}))}function hE(){return{rectangle:ja,square:a2,circle:s2,htmlDom:M_,svgPath:k5,diamond:F5,triangle:P5,pentagon:S5,pentagram:B5,hexagon:D5,leftArrow:M5,rightArrow:L5,twowayArrow:O5,message:N5,cloud:z5,file:W5,people:U5,line:e5,iframe:i_,video:r_,gif:eE,mindNode:rE,mindLine:cE,mindNode2:ja,form:p_,combine:ja,sceneContainer:C_,sector:W_,chord:H_,polygon:U_,octagon:$_,trapezoid:j_,crosse:Y_,rightTriangle:K_,parallelogram:G_,frostedGlassDom:J_}}function fE(){return{triangle:R5,pentagon:T5,pentagram:l0,mindNode:p0,mindLine:uE,rightTriangle:X_,trapezoid:q_,parallelogram:Z_}}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 dE{constructor(t){H(this,"parent");H(this,"box");H(this,"boxWidth",320);H(this,"boxHeight",180);H(this,"ratio",this.boxWidth/this.boxHeight);H(this,"padding",5);H(this,"img");H(this,"isShow");H(this,"isDown");H(this,"view");H(this,"timer");H(this,"onMouseDown",t=>{t.preventDefault(),t.stopPropagation(),this.isDown=!0});H(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}});H(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}});H(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 l=.2;t.deltaY.toString().indexOf(".")!==-1&&(l=.01),t.deltaY>0?i=-l:i=l}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 o=this.parent.parent.getRect();a=a/this.boxWidth*o.width+o.x+this.parent.store.data.x,s=s/this.boxHeight*o.height+o.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<document.styleSheets.length;s++)document.styleSheets[s].title==="le5le/map"&&(i=document.styleSheets[s]);if(!i){let s=document.createElement("style");s.type="text/css",s.title="le5le.com/map",document.head.appendChild(s),s=document.createElement("style"),s.type="text/css",document.head.appendChild(s),i=s.sheet,i.insertRule(`.meta2d-map{display:flex;width:${this.boxWidth+2*this.padding}px;height:${this.boxHeight+2*this.padding}px;padding:${this.padding}px;background:#f4f4f4;border:1px solid #ffffff;box-shadow: 0px 0px 14px 0px rgba(0,10,38,0.30);border-radius:8px;position:absolute;z-index:9999;right:0;bottom:0;justify-content:center;align-items:center;cursor:default;user-select:none;overflow: hidden;}`),i.insertRule(".meta2d-map img{max-width:100%;max-height:100%;pointer-events: none;}"),i.insertRule(".meta2d-map div{pointer-events: none;border:1px solid #1890ff;position:absolute}")}}show(){this.box.style.display="flex",this.parent.store.data.pens.length?(this.img.style.display="block",this.img.src=this.parent.toPng(0,void 0,!0),this.setView()):this.img.style.display="none",this.isShow=!0}hide(){this.box.style.display="none",this.isShow=!1}setView(){const t=this.parent.store.data;if(t.pens.length){let i=Ei(t.pens);const a=this.parent.store.data.width||this.parent.store.options.width,s=this.parent.store.data.height||this.parent.store.options.height;if(a&&s?i={x:this.parent.store.data.origin.x,y:this.parent.store.data.origin.y,width:a*this.parent.store.data.scale,height:s*this.parent.store.data.scale}:(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.parent.store.bkImg&&(this.img.src=this.parent.toPng(0,void 0,!0))},300)),Ua(i,t.x,t.y),i.width/i.height>this.ratio){const d=i.width/this.ratio;i.y-=(d-i.height)/2,i.height=d,re(i)}else{const d=i.height*this.ratio;i.x-=(d-i.width)/2,i.width=d,re(i)}const r=this.parent.canvasRect;let o=0,l=0;if(i.x<0)o=-i.x/i.width;else if(i.x+i.width>r.width){let d=0;r.width>i.width&&(d=r.width-i.width),o=(-i.x+d)/i.width}if(i.y<0)l=-i.y/i.height;else if(i.y+i.height>r.height){let d=0;r.height>i.height&&(d=r.height-i.height),l=(-i.y+d)/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+o*this.boxWidth+"px",this.view.style.width=u*this.boxWidth+"px",this.view.style.top=this.padding+l*this.boxHeight+"px",this.view.style.height=c*this.boxHeight+"px"}}}function zr(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 yn={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 d=typeof zr=="function"&&zr;if(!c&&d)return d(u,!0);if(o)return o(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var g=s[u]={exports:{}};a[u][0].call(g.exports,function(m){return r(a[u][1][m]||m)},g,g.exports,i,a,s,n)}return s[u].exports}for(var o=typeof zr=="function"&&zr,l=0;l<n.length;l++)r(n[l]);return r}}()({1:[function(i,a,s){(function(n,r){(function(){const o=i("events").EventEmitter,l=i("./store"),u=i("./topic-alias-recv"),c=i("./topic-alias-send"),d=i("mqtt-packet"),f=i("./default-message-id-provider"),g=i("readable-stream").Writable,m=i("inherits"),y=i("reinterval"),p=i("rfdc/default"),x=i("./validations"),_=i("xtend"),b=i("debug")("mqttjs:client"),C=n?n.nextTick:function(T){setTimeout(T,0)},P=r.setImmediate||function(T){C(T)},S={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},B={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function D(T,L){let $;L.properties&&($=L.properties.topicAlias);let Z=L.topic.toString();if(Z.length===0){if($===void 0)return new Error("Unregistered Topic Alias");if((Z=T.topicAliasSend.getTopicByAlias($))===void 0)return new Error("Unregistered Topic Alias");L.topic=Z}$&&delete L.properties.topicAlias}function V(T,L,$){b("sendPacket :: packet: %O",L),b("sendPacket :: emitting `packetsend`"),T.emit("packetsend",L),b("sendPacket :: writing to stream");const Z=d.writeToStream(L,T.stream,T.options);b("sendPacket :: writeToStream result %s",Z),!Z&&$&&$!==F?(b("sendPacket :: handle events on `drain` once through callback."),T.stream.once("drain",$)):$&&(b("sendPacket :: invoking cb"),$())}function G(T,L,$,Z){b("storeAndSend :: store packet with cmd %s to outgoingStore",L.cmd);let at,q=L;if(q.cmd==="publish"&&(q=p(L),at=D(T,q)))return $&&$(at);T.outgoingStore.put(q,function(W){if(W)return $&&$(W);Z(),V(T,L,$)})}function F(T){b("nop ::",T)}function R(T,L){let $;const Z=this;if(!(this instanceof R))return new R(T,L);for($ in this.options=L||{},S)this.options[$]===void 0?this.options[$]=S[$]:this.options[$]=L[$];b("MqttClient :: options.protocol",L.protocol),b("MqttClient :: options.protocolVersion",L.protocolVersion),b("MqttClient :: options.username",L.username),b("MqttClient :: options.keepalive",L.keepalive),b("MqttClient :: options.reconnectPeriod",L.reconnectPeriod),b("MqttClient :: options.rejectUnauthorized",L.rejectUnauthorized),b("MqttClient :: options.topicAliasMaximum",L.topicAliasMaximum),this.options.clientId=typeof L.clientId=="string"?L.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),b("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=L.protocolVersion===5&&L.customHandleAcks?L.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=T,this.messageIdProvider=this.options.messageIdProvider===void 0?new f:this.options.messageIdProvider,this.outgoingStore=L.outgoingStore||new l,this.incomingStore=L.incomingStore||new l,this.queueQoSZero=L.queueQoSZero===void 0||L.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,L.topicAliasMaximum>0&&(L.topicAliasMaximum>65535?b("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new u(L.topicAliasMaximum)),this.on("connect",function(){const at=this.queue;b("connect :: sending queued packets"),function q(){const W=at.shift();b("deliver :: entry %o",W);let j=null;if(!W)return void Z._resubscribe();j=W.packet,b("deliver :: call _sendPacket for %o",j);let K=!0;j.messageId&&j.messageId!==0&&(Z.messageIdProvider.register(j.messageId)||(K=!1)),K?Z._sendPacket(j,function(U){W.cb&&W.cb(U),q()}):(b("messageId: %d has already used. The message is skipped and removed.",j.messageId),q())}()}),this.on("close",function(){b("close :: connected set to `false`"),this.connected=!1,b("close :: clearing connackTimer"),clearTimeout(this.connackTimer),b("close :: clearing ping timer"),Z.pingTimer!==null&&(Z.pingTimer.clear(),Z.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),b("close :: calling _setupReconnect"),this._setupReconnect()}),o.call(this),b("MqttClient :: setting up stream"),this._setupStream()}m(R,o),R.prototype._setupStream=function(){const T=this,L=new g,$=d.parser(this.options);let Z=null;const at=[];function q(){if(at.length)C(W);else{const K=Z;Z=null,K()}}function W(){b("work :: getting next packet in queue");const K=at.shift();if(K)b("work :: packet pulled from queue"),T._handlePacket(K,q);else{b("work :: no packets in queue");const U=Z;Z=null,b("work :: done flag is %s",!!U),U&&U()}}b("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),b("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),$.on("packet",function(K){b("parser :: on packet push to packets array."),at.push(K)}),L._write=function(K,U,tt){Z=tt,b("writable stream :: parsing buffer"),$.parse(K),W()},b("_setupStream :: pipe stream to writable stream"),this.stream.pipe(L),this.stream.on("error",function(K){b("streamErrorHandler :: error",K.message),K.code?(b("streamErrorHandler :: emitting error"),T.emit("error",K)):F(K)}),this.stream.on("close",function(){var K;b("(%s)stream :: on close",T.options.clientId),(K=T.outgoing)&&(b("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])})),b("stream: emit close to MqttClient"),T.emit("close")}),b("_setupStream: sending packet `connect`");const j=Object.create(this.options);if(j.cmd="connect",this.topicAliasRecv&&(j.properties||(j.properties={}),this.topicAliasRecv&&(j.properties.topicAliasMaximum=this.topicAliasRecv.max)),V(this,j),$.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return T.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,_({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){b("!!connectTimeout hit!! Calling _cleanUp with force `true`"),T._cleanUp(!0)},this.options.connectTimeout)},R.prototype._handlePacket=function(T,L){const $=this.options;if($.protocolVersion===5&&$.properties&&$.properties.maximumPacketSize&&$.properties.maximumPacketSize<T.length)return this.emit("error",new Error("exceeding packets size "+T.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(b("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",T),T.cmd){case"publish":this._handlePublish(T,L);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(T),L();break;case"pubrel":this._handlePubrel(T,L);break;case"connack":this._handleConnack(T),L();break;case"auth":this._handleAuth(T),L();break;case"pingresp":this._handlePingresp(T),L();break;case"disconnect":this._handleDisconnect(T),L()}},R.prototype._checkDisconnecting=function(T){return this.disconnecting&&(T&&T!==F?T(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},R.prototype.publish=function(T,L,$,Z){b("publish :: message `%s` to topic `%s`",L,T);const at=this.options;if(typeof $=="function"&&(Z=$,$=null),$=_({qos:0,retain:!1,dup:!1},$),this._checkDisconnecting(Z))return this;const q=this,W=function(){let j=0;if(($.qos===1||$.qos===2)&&(j=q._nextId())===null)return b("No messageId left"),!1;const K={cmd:"publish",topic:T,payload:L,qos:$.qos,retain:$.retain,messageId:j,dup:$.dup};switch(at.protocolVersion===5&&(K.properties=$.properties),b("publish :: qos",$.qos),$.qos){case 1:case 2:q.outgoing[K.messageId]={volatile:!1,cb:Z||F},b("MqttClient:publish: packet cmd: %s",K.cmd),q._sendPacket(K,void 0,$.cbStorePut);break;default:b("MqttClient:publish: packet cmd: %s",K.cmd),q._sendPacket(K,Z,$.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!W())&&this._storeProcessingQueue.push({invoke:W,cbStorePut:$.cbStorePut,callback:Z}),this},R.prototype.subscribe=function(){const T=this,L=new Array(arguments.length);for(let st=0;st<arguments.length;st++)L[st]=arguments[st];const $=[];let Z=L.shift();const at=Z.resubscribe;let q=L.pop()||F,W=L.pop();const j=this.options.protocolVersion;delete Z.resubscribe,typeof Z=="string"&&(Z=[Z]),typeof q!="function"&&(W=q,q=F);const K=x.validateTopics(Z);if(K!==null)return P(q,new Error("Invalid topic "+K)),this;if(this._checkDisconnecting(q))return b("subscribe: discconecting true"),this;const U={qos:0};if(j===5&&(U.nl=!1,U.rap=!1,U.rh=0),W=_(U,W),Array.isArray(Z)?Z.forEach(function(st){if(b("subscribe: array topic %s",st),!Object.prototype.hasOwnProperty.call(T._resubscribeTopics,st)||T._resubscribeTopics[st].qos<W.qos||at){const it={topic:st,qos:W.qos};j===5&&(it.nl=W.nl,it.rap=W.rap,it.rh=W.rh,it.properties=W.properties),b("subscribe: pushing topic `%s` and qos `%s` to subs list",it.topic,it.qos),$.push(it)}}):Object.keys(Z).forEach(function(st){if(b("subscribe: object topic %s",st),!Object.prototype.hasOwnProperty.call(T._resubscribeTopics,st)||T._resubscribeTopics[st].qos<Z[st].qos||at){const it={topic:st,qos:Z[st].qos};j===5&&(it.nl=Z[st].nl,it.rap=Z[st].rap,it.rh=Z[st].rh,it.properties=W.properties),b("subscribe: pushing `%s` to subs list",it),$.push(it)}}),!$.length)return q(null,[]),this;const tt=function(){const st=T._nextId();if(st===null)return b("No messageId left"),!1;const it={cmd:"subscribe",subscriptions:$,qos:1,retain:!1,dup:!1,messageId:st};if(W.properties&&(it.properties=W.properties),T.options.resubscribe){b("subscribe :: resubscribe true");const ht=[];$.forEach(function(lt){if(T.options.reconnectPeriod>0){const ut={qos:lt.qos};j===5&&(ut.nl=lt.nl||!1,ut.rap=lt.rap||!1,ut.rh=lt.rh||0,ut.properties=lt.properties),T._resubscribeTopics[lt.topic]=ut,ht.push(lt.topic)}}),T.messageIdToTopic[it.messageId]=ht}return T.outgoing[it.messageId]={volatile:!0,cb:function(ht,lt){if(!ht){const ut=lt.granted;for(let E=0;E<ut.length;E+=1)$[E].qos=ut[E]}q(ht,$)}},b("subscribe :: call _sendPacket"),T._sendPacket(it),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!tt())&&this._storeProcessingQueue.push({invoke:tt,callback:q}),this},R.prototype.unsubscribe=function(){const T=this,L=new Array(arguments.length);for(let j=0;j<arguments.length;j++)L[j]=arguments[j];let $=L.shift(),Z=L.pop()||F,at=L.pop();typeof $=="string"&&($=[$]),typeof Z!="function"&&(at=Z,Z=F);const q=x.validateTopics($);if(q!==null)return P(Z,new Error("Invalid topic "+q)),this;if(T._checkDisconnecting(Z))return this;const W=function(){const j=T._nextId();if(j===null)return b("No messageId left"),!1;const K={cmd:"unsubscribe",qos:1,messageId:j};return typeof $=="string"?K.unsubscriptions=[$]:Array.isArray($)&&(K.unsubscriptions=$),T.options.resubscribe&&K.unsubscriptions.forEach(function(U){delete T._resubscribeTopics[U]}),typeof at=="object"&&at.properties&&(K.properties=at.properties),T.outgoing[K.messageId]={volatile:!0,cb:Z},b("unsubscribe: call _sendPacket"),T._sendPacket(K),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!W())&&this._storeProcessingQueue.push({invoke:W,callback:Z}),this},R.prototype.end=function(T,L,$){const Z=this;function at(){b("end :: (%s) :: finish :: calling _cleanUp with force %s",Z.options.clientId,T),Z._cleanUp(T,()=>{b("end :: finish :: calling process.nextTick on closeStores"),C(function(){b("end :: closeStores: closing incoming and outgoing stores"),Z.disconnected=!0,Z.incomingStore.close(function(q){Z.outgoingStore.close(function(W){if(b("end :: closeStores: emitting end"),Z.emit("end"),$){const j=q||W;b("end :: closeStores: invoking callback with args"),$(j)}})}),Z._deferredReconnect&&Z._deferredReconnect()}.bind(Z))},L)}return b("end :: (%s)",this.options.clientId),T!=null&&typeof T=="boolean"||($=L||F,L=T,T=!1,typeof L!="object"&&($=L,L=null,typeof $!="function"&&($=F))),typeof L!="object"&&($=L,L=null),b("end :: cb? %s",!!$),$=$||F,this.disconnecting?($(),this):(this._clearReconnect(),this.disconnecting=!0,!T&&Object.keys(this.outgoing).length>0?(b("end :: (%s) :: calling finish in 10ms once outgoing is empty",Z.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,at,10))):(b("end :: (%s) :: immediately calling finish",Z.options.clientId),at()),this)},R.prototype.removeOutgoingMessage=function(T){const L=this.outgoing[T]?this.outgoing[T].cb:null;return delete this.outgoing[T],this.outgoingStore.del({messageId:T},function(){L(new Error("Message removed"))}),this},R.prototype.reconnect=function(T){b("client reconnect");const L=this,$=function(){T?(L.options.incomingStore=T.incomingStore,L.options.outgoingStore=T.outgoingStore):(L.options.incomingStore=null,L.options.outgoingStore=null),L.incomingStore=L.options.incomingStore||new l,L.outgoingStore=L.options.outgoingStore||new l,L.disconnecting=!1,L.disconnected=!1,L._deferredReconnect=null,L._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=$:$(),this},R.prototype._reconnect=function(){b("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),b("client already connected. disconnecting first.")):(b("_reconnect: calling _setupStream"),this._setupStream())},R.prototype._setupReconnect=function(){const T=this;!T.disconnecting&&!T.reconnectTimer&&T.options.reconnectPeriod>0?(this.reconnecting||(b("_setupReconnect :: emit `offline` state"),this.emit("offline"),b("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),b("_setupReconnect :: setting reconnectTimer for %d ms",T.options.reconnectPeriod),T.reconnectTimer=setInterval(function(){b("reconnectTimer :: reconnect triggered!"),T._reconnect()},T.options.reconnectPeriod)):b("_setupReconnect :: doing nothing...")},R.prototype._clearReconnect=function(){b("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},R.prototype._cleanUp=function(T,L){const $=arguments[2];if(L&&(b("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",L)),b("_cleanUp :: forced? %s",T),T)this.options.reconnectPeriod===0&&this.options.clean&&(Z=this.outgoing)&&(b("flush: queue exists? %b",!!Z),Object.keys(Z).forEach(function(at){typeof Z[at].cb=="function"&&(Z[at].cb(new Error("Connection closed")),delete Z[at])})),b("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const at=_({cmd:"disconnect"},$);b("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(at,P.bind(null,this.stream.end.bind(this.stream)))}var Z;this.disconnecting||(b("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(b("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),L&&!this.connected&&(b("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",L),L())},R.prototype._sendPacket=function(T,L,$){b("_sendPacket :: (%s) :: start",this.options.clientId),$=$||F,L=L||F;const Z=function(at,q){if(at.options.protocolVersion===5&&q.cmd==="publish"){let W;q.properties&&(W=q.properties.topicAlias);const j=q.topic.toString();if(at.topicAliasSend)if(W){if(j.length!==0&&(b("applyTopicAlias :: register topic: %s - alias: %d",j,W),!at.topicAliasSend.put(j,W)))return b("applyTopicAlias :: error out of range. topic: %s - alias: %d",j,W),new Error("Sending Topic Alias out of range")}else j.length!==0&&(at.options.autoAssignTopicAlias?(W=at.topicAliasSend.getAliasByTopic(j))?(q.topic="",q.properties={...q.properties,topicAlias:W},b("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",j,W)):(W=at.topicAliasSend.getLruAlias(),at.topicAliasSend.put(j,W),q.properties={...q.properties,topicAlias:W},b("applyTopicAlias :: auto assign topic: %s - alias: %d",j,W)):at.options.autoUseTopicAlias&&(W=at.topicAliasSend.getAliasByTopic(j))&&(q.topic="",q.properties={...q.properties,topicAlias:W},b("applyTopicAlias :: auto use topic: %s - alias: %d",j,W)));else if(W)return b("applyTopicAlias :: error out of range. topic: %s - alias: %d",j,W),new Error("Sending Topic Alias out of range")}}(this,T);if(Z)L(Z);else{if(!this.connected)return T.cmd==="auth"?(this._shiftPingInterval(),void V(this,T,L)):(b("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(T,L,$));switch(this._shiftPingInterval(),T.cmd){case"publish":break;case"pubrel":return void G(this,T,L,$);default:return void V(this,T,L)}switch(T.qos){case 2:case 1:G(this,T,L,$);break;case 0:default:V(this,T,L)}b("_sendPacket :: (%s) :: end",this.options.clientId)}},R.prototype._storePacket=function(T,L,$){b("_storePacket :: packet: %o",T),b("_storePacket :: cb? %s",!!L),$=$||F;let Z=T;if(Z.cmd==="publish"){const at=D(this,Z=p(T));if(at)return L&&L(at)}(Z.qos||0)===0&&this.queueQoSZero||Z.cmd!=="publish"?this.queue.push({packet:Z,cb:L}):Z.qos>0?(L=this.outgoing[Z.messageId]?this.outgoing[Z.messageId].cb:null,this.outgoingStore.put(Z,function(at){if(at)return L&&L(at);$()})):L&&L(new Error("No connection to broker"))},R.prototype._setupPingTimer=function(){b("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const T=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=y(function(){T._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(){b("_checkPing :: checking ping..."),this.pingResp?(b("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(b("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},R.prototype._handlePingresp=function(){this.pingResp=!0},R.prototype._handleConnack=function(T){b("_handleConnack");const L=this.options,$=L.protocolVersion===5?T.reasonCode:T.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,T.properties){if(T.properties.topicAliasMaximum){if(T.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));T.properties.topicAliasMaximum>0&&(this.topicAliasSend=new c(T.properties.topicAliasMaximum))}T.properties.serverKeepAlive&&L.keepalive&&(L.keepalive=T.properties.serverKeepAlive,this._shiftPingInterval()),T.properties.maximumPacketSize&&(L.properties||(L.properties={}),L.properties.maximumPacketSize=T.properties.maximumPacketSize)}if($===0)this.reconnecting=!1,this._onConnect(T);else if($>0){const Z=new Error("Connection refused: "+B[$]);Z.code=$,this.emit("error",Z)}},R.prototype._handleAuth=function(T){const L=this.options.protocolVersion,$=L===5?T.reasonCode:T.returnCode;if(L!==5){const at=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+L);return at.code=$,void this.emit("error",at)}const Z=this;this.handleAuth(T,function(at,q){if(at)Z.emit("error",at);else if($===24)Z.reconnecting=!1,Z._sendPacket(q);else{const W=new Error("Connection refused: "+B[$]);at.code=$,Z.emit("error",W)}})},R.prototype.handleAuth=function(T,L){L()},R.prototype._handlePublish=function(T,L){b("_handlePublish: packet %o",T),L=L!==void 0?L:F;let $=T.topic.toString();const Z=T.payload,at=T.qos,q=T.messageId,W=this,j=this.options,K=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let U;if(T.properties&&(U=T.properties.topicAlias),U!==void 0)if($.length===0){if(!(U>0&&U<=65535))return b("_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 b("_handlePublish :: unregistered topic alias. alias: %d",U),void this.emit("error",new Error("Received unregistered Topic Alias"));b("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",$=tt,U)}}else{if(!this.topicAliasRecv.put($,U))return b("_handlePublish :: topic alias out of range. alias: %d",U),void this.emit("error",new Error("Received Topic Alias is out of range"));b("_handlePublish :: registered topic: %s - alias: %d",$,U)}}switch(b("_handlePublish: qos %d",at),at){case 2:j.customHandleAcks($,Z,T,function(U,tt){return U instanceof Error||(tt=U,U=null),U?W.emit("error",U):K.indexOf(tt)===-1?W.emit("error",new Error("Wrong reason code for pubrec")):void(tt?W._sendPacket({cmd:"pubrec",messageId:q,reasonCode:tt},L):W.incomingStore.put(T,function(){W._sendPacket({cmd:"pubrec",messageId:q},L)}))});break;case 1:j.customHandleAcks($,Z,T,function(U,tt){return U instanceof Error||(tt=U,U=null),U?W.emit("error",U):K.indexOf(tt)===-1?W.emit("error",new Error("Wrong reason code for puback")):(tt||W.emit("message",$,Z,T),void W.handleMessage(T,function(st){if(st)return L&&L(st);W._sendPacket({cmd:"puback",messageId:q,reasonCode:tt},L)}))});break;case 0:this.emit("message",$,Z,T),this.handleMessage(T,L);break;default:b("_handlePublish: unknown QoS. Doing nothing.")}},R.prototype.handleMessage=function(T,L){L()},R.prototype._handleAck=function(T){const L=T.messageId,$=T.cmd;let Z=null;const at=this.outgoing[L]?this.outgoing[L].cb:null,q=this;let W;if(at){switch(b("_handleAck :: packet type",$),$){case"pubcomp":case"puback":{const j=T.reasonCode;j&&j>0&&j!==16&&((W=new Error("Publish error: "+B[j])).code=j,at(W,T)),delete this.outgoing[L],this.outgoingStore.del(T,at),this.messageIdProvider.deallocate(L),this._invokeStoreProcessingQueue();break}case"pubrec":{Z={cmd:"pubrel",qos:2,messageId:L};const j=T.reasonCode;j&&j>0&&j!==16?((W=new Error("Publish error: "+B[j])).code=j,at(W,T)):this._sendPacket(Z);break}case"suback":delete this.outgoing[L],this.messageIdProvider.deallocate(L);for(let j=0;j<T.granted.length;j++)if((128&T.granted[j])!=0){const K=this.messageIdToTopic[L];K&&K.forEach(function(U){delete q._resubscribeTopics[U]})}this._invokeStoreProcessingQueue(),at(null,T);break;case"unsuback":delete this.outgoing[L],this.messageIdProvider.deallocate(L),this._invokeStoreProcessingQueue(),at(null);break;default:q.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")}else b("_handleAck :: Server sent an ack in error. Ignoring.")},R.prototype._handlePubrel=function(T,L){b("handling pubrel packet"),L=L!==void 0?L:F;const $=this,Z={cmd:"pubcomp",messageId:T.messageId};$.incomingStore.get(T,function(at,q){at?$._sendPacket(Z,L):($.emit("message",q.topic,q.payload,q),$.handleMessage(q,function(W){if(W)return L(W);$.incomingStore.del(q,F),$._sendPacket(Z,L)}))})},R.prototype._handleDisconnect=function(T){this.emit("disconnect",T)},R.prototype._nextId=function(){return this.messageIdProvider.allocate()},R.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},R.prototype._resubscribe=function(){b("_resubscribe");const T=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&T.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){b("_resubscribe: protocolVersion 5");for(let L=0;L<T.length;L++){const $={};$[T[L]]=this._resubscribeTopics[T[L]],$.resubscribe=!0,this.subscribe($,{properties:$[T[L]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},R.prototype._onConnect=function(T){if(this.disconnected)return void this.emit("connect",T);const L=this;this.connackPacket=T,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,function $(){let Z=L.outgoingStore.createStream();function at(){L._storeProcessing=!1,L._packetIdsDuringStoreProcessing={}}function q(){Z.destroy(),Z=null,L._flushStoreProcessingQueue(),at()}L.once("close",q),Z.on("error",function(W){at(),L._flushStoreProcessingQueue(),L.removeListener("close",q),L.emit("error",W)}),Z.on("end",function(){let W=!0;for(const j in L._packetIdsDuringStoreProcessing)if(!L._packetIdsDuringStoreProcessing[j]){W=!1;break}W?(at(),L.removeListener("close",q),L._invokeAllStoreProcessingQueue(),L.emit("connect",T)):$()}),function W(){if(!Z)return;L._storeProcessing=!0;const j=Z.read(1);let K;j?L._packetIdsDuringStoreProcessing[j.messageId]?W():L.disconnecting||L.reconnectTimer?Z.destroy&&Z.destroy():(K=L.outgoing[j.messageId]?L.outgoing[j.messageId].cb:null,L.outgoing[j.messageId]={volatile:!1,cb:function(U,tt){K&&K(U,tt),W()}},L._packetIdsDuringStoreProcessing[j.messageId]=!0,L.messageIdProvider.register(j.messageId)?L._sendPacket(j):b("messageId: %d has already used.",j.messageId)):Z.once("readable",W)}()}()},R.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const T=this._storeProcessingQueue[0];if(T&&T.invoke())return this._storeProcessingQueue.shift(),!0}return!1},R.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},R.prototype._flushStoreProcessingQueue=function(){for(const T of this._storeProcessingQueue)T.cbStorePut&&T.cbStorePut(new Error("Connection closed")),T.callback&&T.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},a.exports=R}).call(this)}).call(this,i("_process"),typeof Oe<"u"?Oe: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,o=i("duplexify");let l,u,c,d=!1;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 m=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt";(function(p){p.hostname||(p.hostname="localhost"),p.path||(p.path="/"),p.wsOptions||(p.wsOptions={})})(g);const y=function(p,x){const _=p.protocol==="alis"?"wss":"ws";let b=_+"://"+p.hostname+p.path;return p.port&&p.port!==80&&p.port!==443&&(b=_+"://"+p.hostname+":"+p.port+p.path),typeof p.transformWsUrl=="function"&&(b=p.transformWsUrl(b,p,x)),b}(g,f);return(l=g.my).connectSocket({url:y,protocols:m}),u=function(){const p=new r;return p._write=function(x,_,b){l.sendSocketMessage({data:x.buffer,success:function(){b()},fail:function(){b(new Error)}})},p._flush=function(x){l.closeSocket({success:function(){x()}})},p}(),c=o.obj(),d||(d=!0,l.onSocketOpen(function(){c.setReadable(u),c.setWritable(u),c.emit("connect")}),l.onSocketMessage(function(p){if(typeof p.data=="string"){const x=n.from(p.data,"base64");u.push(x)}else{const x=new FileReader;x.addEventListener("load",function(){let _=x.result;_=_ instanceof ArrayBuffer?n.from(_):n.from(_,"utf8"),u.push(_)}),x.readAsArrayBuffer(p.data)}}),l.onSocketClose(function(){c.end(),c.destroy()}),l.onSocketError(function(p){c.destroy(p)})),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(o,l){l.port=l.port||1883,l.hostname=l.hostname||l.host||"localhost";const u=l.port,c=l.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"),o=i("debug")("mqttjs:tls");a.exports=function(l,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,o("port %d host %s rejectUnauthorized %b",u.port,u.host,u.rejectUnauthorized);const c=n.connect(u);function d(f){u.rejectUnauthorized&&l.emit("error",f),c.end()}return c.on("secureConnect",function(){u.rejectUnauthorized&&!c.authorized?c.emit("error",new Error("TLS not authorized")):c.removeListener("error",d)}),c.on("error",d),c}},{debug:18,net:16,tls:16}],5:[function(i,a,s){(function(n){(function(){const{Buffer:r}=i("buffer"),o=i("ws"),l=i("debug")("mqttjs:ws"),u=i("duplexify"),c=i("readable-stream").Transform,d=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],f=n!==void 0&&n.title==="browser"||typeof __webpack_require__=="function";function g(y,p){let x=y.protocol+"://"+y.hostname+":"+y.port+y.path;return typeof y.transformWsUrl=="function"&&(x=y.transformWsUrl(x,y,p)),x}function m(y){const p=y;return y.hostname||(p.hostname="localhost"),y.port||(y.protocol==="wss"?p.port=443:p.port=80),y.path||(p.path="/"),y.wsOptions||(p.wsOptions={}),f||y.protocol!=="wss"||d.forEach(function(x){Object.prototype.hasOwnProperty.call(y,x)&&!Object.prototype.hasOwnProperty.call(y.wsOptions,x)&&(p.wsOptions[x]=y[x])}),p}a.exports=f?function(y,p){let x;l("browserStreamBuilder");const _=function(T){const L=m(T);if(L.hostname||(L.hostname=L.host),!L.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const $=new URL(document.URL);L.hostname=$.hostname,L.port||(L.port=$.port)}return L.objectMode===void 0&&(L.objectMode=!(L.binary===!0||L.binary===void 0)),L}(p).browserBufferSize||524288,b=p.browserBufferTimeout||1e3,C=!p.objectMode,P=function(T,L){const $=L.protocolId==="MQIsdp"&&L.protocolVersion===3?"mqttv3.1":"mqtt",Z=g(L,T),at=new WebSocket(Z,[$]);return at.binaryType="arraybuffer",at}(y,p),S=function(T,L,$){const Z=new c({objectModeMode:T.objectMode});return Z._write=L,Z._flush=$,Z}(p,function T(L,$,Z){P.bufferedAmount>_&&setTimeout(T,b,L,$,Z),C&&typeof L=="string"&&(L=r.from(L,"utf8"));try{P.send(L)}catch(at){return Z(at)}Z()},function(T){P.close(),T()});p.objectMode||(S._writev=R),S.on("close",()=>{P.close()});const B=P.addEventListener!==void 0;function D(){x.setReadable(S),x.setWritable(S),x.emit("connect")}function V(){x.end(),x.destroy()}function G(T){x.destroy(T)}function F(T){let L=T.data;L=L instanceof ArrayBuffer?r.from(L):r.from(L,"utf8"),S.push(L)}function R(T,L){const $=new Array(T.length);for(let Z=0;Z<T.length;Z++)typeof T[Z].chunk=="string"?$[Z]=r.from(T[Z],"utf8"):$[Z]=T[Z].chunk;this._write(r.concat($),"binary",L)}return P.readyState===P.OPEN?x=S:(x=x=u(void 0,void 0,p),p.objectMode||(x._writev=R),B?P.addEventListener("open",D):P.onopen=D),x.socket=P,B?(P.addEventListener("close",V),P.addEventListener("error",G),P.addEventListener("message",F)):(P.onclose=V,P.onerror=G,P.onmessage=F),x}:function(y,p){l("streamBuilder");const x=m(p),_=g(x,y),b=function(P,S,B){l("createWebSocket"),l("protocol: "+B.protocolId+" "+B.protocolVersion);const D=B.protocolId==="MQIsdp"&&B.protocolVersion===3?"mqttv3.1":"mqtt";return l("creating new Websocket for url: "+S+" and protocol: "+D),new o(S,[D],B.wsOptions)}(0,_,x),C=o.createWebSocketStream(b,x.wsOptions);return C.url=_,b.on("close",()=>{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,o=i("duplexify");let l,u,c;a.exports=function(d,f){if(f.hostname=f.hostname||f.host,!f.hostname)throw new Error("Could not determine host. Specify host manually.");const g=f.protocolId==="MQIsdp"&&f.protocolVersion===3?"mqttv3.1":"mqtt";(function(p){p.hostname||(p.hostname="localhost"),p.path||(p.path="/"),p.wsOptions||(p.wsOptions={})})(f);const m=function(p,x){const _=p.protocol==="wxs"?"wss":"ws";let b=_+"://"+p.hostname+p.path;return p.port&&p.port!==80&&p.port!==443&&(b=_+"://"+p.hostname+":"+p.port+p.path),typeof p.transformWsUrl=="function"&&(b=p.transformWsUrl(b,p,x)),b}(f,d);l=wx.connectSocket({url:m,protocols:[g]}),u=function(){const p=new r;return p._write=function(x,_,b){l.send({data:x.buffer,success:function(){b()},fail:function(C){b(new Error(C))}})},p._flush=function(x){l.close({success:function(){x()}})},p}(),(c=o.obj())._destroy=function(p,x){l.close({success:function(){x&&x(p)}})};const y=c.destroy;return c.destroy=function(){c.destroy=y;const p=this;setTimeout(function(){l.close({fail:function(){p._destroy(new Error)}})},0)}.bind(c),l.onOpen(function(){c.setReadable(u),c.setWritable(u),c.emit("connect")}),l.onMessage(function(p){let x=p.data;x=x instanceof ArrayBuffer?n.from(x):n.from(x,"utf8"),u.push(x)}),l.onClose(function(){c.end(),c.destroy()}),l.onError(function(p){c.destroy(new Error(p.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,o={objectMode:!0},l={clean:!0};function u(c){if(!(this instanceof u))return new u(c);this.options=c||{},this.options=n(l,c),this._inflights=new Map}u.prototype.put=function(c,d){return this._inflights.set(c.messageId,c),d&&d(),this},u.prototype.createStream=function(){const c=new r(o),d=[];let f=!1,g=0;return this._inflights.forEach(function(m,y){d.push(m)}),c._read=function(){!f&&g<d.length?this.push(d[g++]):this.push(null)},c.destroy=function(){if(f)return;const m=this;f=!0,setTimeout(function(){m.emit("close")},0)},c},u.prototype.del=function(c,d){return(c=this._inflights.get(c.messageId))?(this._inflights.delete(c.messageId),d(null,c)):d&&d(new Error("missing packet")),this},u.prototype.get=function(c,d){return(c=this._inflights.get(c.messageId))?d(null,c):d&&d(new Error("missing packet")),this},u.prototype.close=function(c){this.options.clean&&(this._inflights=null),c&&c()},a.exports=u},{"readable-stream":69,xtend:81}],9:[function(i,a,s){function n(r){if(!(this instanceof n))return new n(r);this.aliasToTopic={},this.max=r}n.prototype.put=function(r,o){return!(o===0||o>this.max)&&(this.aliasToTopic[o]=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 o(l){if(!(this instanceof o))return new o(l);l>0&&(this.aliasToTopic=new n({max:l}),this.topicToAlias={},this.numberAllocator=new r(1,l),this.max=l,this.length=0)}o.prototype.put=function(l,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,l),this.topicToAlias[l]=u,this.numberAllocator.use(u),this.length=this.aliasToTopic.length,!0},o.prototype.getTopicByAlias=function(l){return this.aliasToTopic.get(l)},o.prototype.getAliasByTopic=function(l){const u=this.topicToAlias[l];return u!==void 0&&this.aliasToTopic.get(u),u},o.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},o.prototype.getLruAlias=function(){return this.numberAllocator.firstVacant()||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},a.exports=o},{"lru-cache":37,"number-allocator":46}],11:[function(i,a,s){function n(r){const o=r.split("/");for(let l=0;l<o.length;l++)if(o[l]!=="+"){if(o[l]==="#")return l===o.length-1;if(o[l].indexOf("+")!==-1||o[l].indexOf("#")!==-1)return!1}return!0}a.exports={validateTopics:function(r){if(r.length===0)return"empty_topic_list";for(let o=0;o<r.length;o++)if(!n(r[o]))return r[o];return null}}},{}],12:[function(i,a,s){(function(n){(function(){const r=i("../client"),o=i("../store"),l=i("url"),u=i("xtend"),c=i("debug")("mqttjs"),d={};function f(g,m){if(c("connecting to an MQTT broker..."),typeof g!="object"||m||(m=g,g=null),m=m||{},g){const p=l.parse(g,!0);if(p.port!=null&&(p.port=Number(p.port)),(m=u(p,m)).protocol===null)throw new Error("Missing protocol");m.protocol=m.protocol.replace(/:$/,"")}if(function(p){let x;p.auth&&((x=p.auth.match(/^(.+):(.+)$/))?(p.username=x[1],p.password=x[2]):p.username=p.auth)}(m),m.query&&typeof m.query.clientId=="string"&&(m.clientId=m.query.clientId),m.cert&&m.key){if(!m.protocol)throw new Error("Missing secure protocol key");if(["mqtts","wss","wxs","alis"].indexOf(m.protocol)===-1)switch(m.protocol){case"mqtt":m.protocol="mqtts";break;case"ws":m.protocol="wss";break;case"wx":m.protocol="wxs";break;case"ali":m.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+m.protocol+'"!')}}if(!d[m.protocol]){const p=["mqtts","wss"].indexOf(m.protocol)!==-1;m.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(x,_){return(!p||_%2!=0)&&typeof d[x]=="function"})[0]}if(m.clean===!1&&!m.clientId)throw new Error("Missing clientId for unclean clients");m.protocol&&(m.defaultProtocol=m.protocol);const y=new r(function(p){return m.servers&&(p._reconnectCount&&p._reconnectCount!==m.servers.length||(p._reconnectCount=0),m.host=m.servers[p._reconnectCount].host,m.port=m.servers[p._reconnectCount].port,m.protocol=m.servers[p._reconnectCount].protocol?m.servers[p._reconnectCount].protocol:m.defaultProtocol,m.hostname=m.host,p._reconnectCount++),c("calling streambuilder for",m.protocol),d[m.protocol](p,m)},m);return y.on("error",function(){}),y}n!==void 0&&n.title!=="browser"||typeof __webpack_require__!="function"?(d.mqtt=i("./tcp"),d.tcp=i("./tcp"),d.ssl=i("./tls"),d.tls=i("./tls"),d.mqtts=i("./tls")):(d.wx=i("./wx"),d.wxs=i("./wx"),d.ali=i("./ali"),d.alis=i("./ali")),d.ws=i("./ws"),d.wss=i("./ws"),a.exports=f,a.exports.connect=f,a.exports.MqttClient=r,a.exports.Store=o}).call(this)}).call(this,i("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(i,a,s){s.byteLength=function(g){var m=d(g),y=m[0],p=m[1];return 3*(y+p)/4-p},s.toByteArray=function(g){var m,y,p=d(g),x=p[0],_=p[1],b=new o(function(S,B,D){return 3*(B+D)/4-D}(0,x,_)),C=0,P=_>0?x-4:x;for(y=0;y<P;y+=4)m=r[g.charCodeAt(y)]<<18|r[g.charCodeAt(y+1)]<<12|r[g.charCodeAt(y+2)]<<6|r[g.charCodeAt(y+3)],b[C++]=m>>16&255,b[C++]=m>>8&255,b[C++]=255&m;return _===2&&(m=r[g.charCodeAt(y)]<<2|r[g.charCodeAt(y+1)]>>4,b[C++]=255&m),_===1&&(m=r[g.charCodeAt(y)]<<10|r[g.charCodeAt(y+1)]<<4|r[g.charCodeAt(y+2)]>>2,b[C++]=m>>8&255,b[C++]=255&m),b},s.fromByteArray=function(g){for(var m,y=g.length,p=y%3,x=[],_=0,b=y-p;_<b;_+=16383)x.push(f(g,_,_+16383>b?b:_+16383));return p===1?(m=g[y-1],x.push(n[m>>2]+n[m<<4&63]+"==")):p===2&&(m=(g[y-2]<<8)+g[y-1],x.push(n[m>>10]+n[m>>4&63]+n[m<<2&63]+"=")),x.join("")};for(var n=[],r=[],o=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,c=l.length;u<c;++u)n[u]=l[u],r[l.charCodeAt(u)]=u;function d(g){var m=g.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var y=g.indexOf("=");return y===-1&&(y=m),[y,y===m?0:4-y%4]}function f(g,m,y){for(var p,x,_=[],b=m;b<y;b+=3)p=(g[b]<<16&16711680)+(g[b+1]<<8&65280)+(255&g[b+2]),_.push(n[(x=p)>>18&63]+n[x>>12&63]+n[x>>6&63]+n[63&x]);return _.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},{}],14:[function(i,a,s){const{Buffer:n}=i("buffer"),r=Symbol.for("BufferList");function o(l){if(!(this instanceof o))return new o(l);o._init.call(this,l)}o._init=function(l){Object.defineProperty(this,r,{value:!0}),this._bufs=[],this.length=0,l&&this.append(l)},o.prototype._new=function(l){return new o(l)},o.prototype._offset=function(l){if(l===0)return[0,0];let u=0;for(let c=0;c<this._bufs.length;c++){const d=u+this._bufs[c].length;if(l<d||c===this._bufs.length-1)return[c,l-u];u=d}},o.prototype._reverseOffset=function(l){const u=l[0];let c=l[1];for(let d=0;d<u;d++)c+=this._bufs[d].length;return c},o.prototype.get=function(l){if(l>this.length||l<0)return;const u=this._offset(l);return this._bufs[u[0]][u[1]]},o.prototype.slice=function(l,u){return typeof l=="number"&&l<0&&(l+=this.length),typeof u=="number"&&u<0&&(u+=this.length),this.copy(null,0,l,u)},o.prototype.copy=function(l,u,c,d){if((typeof c!="number"||c<0)&&(c=0),(typeof d!="number"||d>this.length)&&(d=this.length),c>=this.length||d<=0)return l||n.alloc(0);const f=!!l,g=this._offset(c),m=d-c;let y=m,p=f&&u||0,x=g[1];if(c===0&&d===this.length){if(!f)return this._bufs.length===1?this._bufs[0]:n.concat(this._bufs,this.length);for(let _=0;_<this._bufs.length;_++)this._bufs[_].copy(l,p),p+=this._bufs[_].length;return l}if(y<=this._bufs[g[0]].length-x)return f?this._bufs[g[0]].copy(l,u,x,x+y):this._bufs[g[0]].slice(x,x+y);f||(l=n.allocUnsafe(m));for(let _=g[0];_<this._bufs.length;_++){const b=this._bufs[_].length-x;if(!(y>b)){this._bufs[_].copy(l,p,x,x+y),p+=b;break}this._bufs[_].copy(l,p,x),p+=b,y-=b,x&&(x=0)}return l.length>p?l.slice(0,p):l},o.prototype.shallowSlice=function(l,u){if(l=l||0,u=typeof u!="number"?this.length:u,l<0&&(l+=this.length),u<0&&(u+=this.length),l===u)return this._new();const c=this._offset(l),d=this._offset(u),f=this._bufs.slice(c[0],d[0]+1);return d[1]===0?f.pop():f[f.length-1]=f[f.length-1].slice(0,d[1]),c[1]!==0&&(f[0]=f[0].slice(c[1])),this._new(f)},o.prototype.toString=function(l,u,c){return this.slice(u,c).toString(l)},o.prototype.consume=function(l){if(l=Math.trunc(l),Number.isNaN(l)||l<=0)return this;for(;this._bufs.length;){if(!(l>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(l),this.length-=l;break}l-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const l=this._new();for(let u=0;u<this._bufs.length;u++)l.append(this._bufs[u]);return l},o.prototype.append=function(l){if(l==null)return this;if(l.buffer)this._appendBuffer(n.from(l.buffer,l.byteOffset,l.byteLength));else if(Array.isArray(l))for(let u=0;u<l.length;u++)this.append(l[u]);else if(this._isBufferList(l))for(let u=0;u<l._bufs.length;u++)this.append(l._bufs[u]);else typeof l=="number"&&(l=l.toString()),this._appendBuffer(n.from(l));return this},o.prototype._appendBuffer=function(l){this._bufs.push(l),this.length+=l.length},o.prototype.indexOf=function(l,u,c){if(c===void 0&&typeof u=="string"&&(c=u,u=void 0),typeof l=="function"||Array.isArray(l))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof l=="number"?l=n.from([l]):typeof l=="string"?l=n.from(l,c):this._isBufferList(l)?l=l.slice():Array.isArray(l.buffer)?l=n.from(l.buffer,l.byteOffset,l.byteLength):n.isBuffer(l)||(l=n.from(l)),u=Number(u||0),isNaN(u)&&(u=0),u<0&&(u=this.length+u),u<0&&(u=0),l.length===0)return u>this.length?this.length:u;const d=this._offset(u);let f=d[0],g=d[1];for(;f<this._bufs.length;f++){const m=this._bufs[f];for(;g<m.length;)if(m.length-g>=l.length){const y=m.indexOf(l,g);if(y!==-1)return this._reverseOffset([f,y]);g=m.length-l.length+1}else{const y=this._reverseOffset([f,g]);if(this._match(y,l))return y;g++}g=0}return-1},o.prototype._match=function(l,u){if(this.length-l<u.length)return!1;for(let c=0;c<u.length;c++)if(this.get(l+c)!==u[c])return!1;return!0},function(){const l={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const u in l)(function(c){o.prototype[c]=l[c]===null?function(d,f){return this.slice(d,d+f)[c](0,f)}:function(d=0){return this.slice(d,d+l[c])[c](0)}})(u)}(),o.prototype._isBufferList=function(l){return l instanceof o||o.isBufferList(l)},o.isBufferList=function(l){return l!=null&&l[r]},a.exports=o},{buffer:17}],15:[function(i,a,s){const n=i("readable-stream").Duplex,r=i("inherits"),o=i("./BufferList");function l(u){if(!(this instanceof l))return new l(u);if(typeof u=="function"){this._callback=u;const c=function(d){this._callback&&(this._callback(d),this._callback=null)}.bind(this);this.on("pipe",function(d){d.on("error",c)}),this.on("unpipe",function(d){d.removeListener("error",c)}),u=null}o._init.call(this,u),n.call(this)}r(l,n),Object.assign(l.prototype,o.prototype),l.prototype._new=function(u){return new l(u)},l.prototype._write=function(u,c,d){this._appendBuffer(u),typeof d=="function"&&d()},l.prototype._read=function(u){if(!this.length)return this.push(null);u=Math.min(u,this.length),this.push(this.slice(0,u)),this.consume(u)},l.prototype.end=function(u){n.prototype.end.call(this,u),this._callback&&(this._callback(null,this.slice()),this._callback=null)},l.prototype._destroy=function(u,c){this._bufs.length=0,this.length=0,c(u)},l.prototype._isBufferList=function(u){return u instanceof l||u instanceof o||l.isBufferList(u)},l.isBufferList=o.isBufferList,a.exports=l,a.exports.BufferListStream=l,a.exports.BufferList=o},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(i,a,s){},{}],17:[function(i,a,s){(function(n){(function(){var r=i("base64-js"),o=i("ieee754");s.Buffer=c,s.SlowBuffer=function(E){return+E!=E&&(E=0),c.alloc(+E)},s.INSPECT_MAX_BYTES=50;var l=2147483647;function u(E){if(E>l)throw new RangeError('The value "'+E+'" is invalid for option "size"');var A=new Uint8Array(E);return A.__proto__=c.prototype,A}function c(E,A,I){if(typeof E=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(E)}return d(E,A,I)}function d(E,A,I){if(typeof E=="string")return function(J,rt){if(typeof rt=="string"&&rt!==""||(rt="utf8"),!c.isEncoding(rt))throw new TypeError("Unknown encoding: "+rt);var yt=0|p(J,rt),mt=u(yt),Et=mt.write(J,rt);return Et!==yt&&(mt=mt.slice(0,Et)),mt}(E,A);if(ArrayBuffer.isView(E))return m(E);if(E==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E);if(lt(E,ArrayBuffer)||E&&lt(E.buffer,ArrayBuffer))return function(J,rt,yt){if(rt<0||J.byteLength<rt)throw new RangeError('"offset" is outside of buffer bounds');if(J.byteLength<rt+(yt||0))throw new RangeError('"length" is outside of buffer bounds');var mt;return mt=rt===void 0&&yt===void 0?new Uint8Array(J):yt===void 0?new Uint8Array(J,rt):new Uint8Array(J,rt,yt),mt.__proto__=c.prototype,mt}(E,A,I);if(typeof E=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var N=E.valueOf&&E.valueOf();if(N!=null&&N!==E)return c.from(N,A,I);var X=function(J){if(c.isBuffer(J)){var rt=0|y(J.length),yt=u(rt);return yt.length===0||J.copy(yt,0,0,rt),yt}if(J.length!==void 0)return typeof J.length!="number"||ut(J.length)?u(0):m(J);if(J.type==="Buffer"&&Array.isArray(J.data))return m(J.data)}(E);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof E[Symbol.toPrimitive]=="function")return c.from(E[Symbol.toPrimitive]("string"),A,I);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E)}function f(E){if(typeof E!="number")throw new TypeError('"size" argument must be of type number');if(E<0)throw new RangeError('The value "'+E+'" is invalid for option "size"')}function g(E){return f(E),u(E<0?0:0|y(E))}function m(E){for(var A=E.length<0?0:0|y(E.length),I=u(A),N=0;N<A;N+=1)I[N]=255&E[N];return I}function y(E){if(E>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return 0|E}function p(E,A){if(c.isBuffer(E))return E.length;if(ArrayBuffer.isView(E)||lt(E,ArrayBuffer))return E.byteLength;if(typeof E!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof E);var I=E.length,N=arguments.length>2&&arguments[2]===!0;if(!N&&I===0)return 0;for(var X=!1;;)switch(A){case"ascii":case"latin1":case"binary":return I;case"utf8":case"utf-8":return st(E).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*I;case"hex":return I>>>1;case"base64":return it(E).length;default:if(X)return N?-1:st(E).length;A=(""+A).toLowerCase(),X=!0}}function x(E,A,I){var N=E[A];E[A]=E[I],E[I]=N}function _(E,A,I,N,X){if(E.length===0)return-1;if(typeof I=="string"?(N=I,I=0):I>2147483647?I=2147483647:I<-2147483648&&(I=-2147483648),ut(I=+I)&&(I=X?0:E.length-1),I<0&&(I=E.length+I),I>=E.length){if(X)return-1;I=E.length-1}else if(I<0){if(!X)return-1;I=0}if(typeof A=="string"&&(A=c.from(A,N)),c.isBuffer(A))return A.length===0?-1:b(E,A,I,N,X);if(typeof A=="number")return A&=255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(E,A,I):Uint8Array.prototype.lastIndexOf.call(E,A,I):b(E,[A],I,N,X);throw new TypeError("val must be string, number or Buffer")}function b(E,A,I,N,X){var J,rt=1,yt=E.length,mt=A.length;if(N!==void 0&&((N=String(N).toLowerCase())==="ucs2"||N==="ucs-2"||N==="utf16le"||N==="utf-16le")){if(E.length<2||A.length<2)return-1;rt=2,yt/=2,mt/=2,I/=2}function Et(oe,Vt){return rt===1?oe[Vt]:oe.readUInt16BE(Vt*rt)}if(X){var Ft=-1;for(J=I;J<yt;J++)if(Et(E,J)===Et(A,Ft===-1?0:J-Ft)){if(Ft===-1&&(Ft=J),J-Ft+1===mt)return Ft*rt}else Ft!==-1&&(J-=J-Ft),Ft=-1}else for(I+mt>yt&&(I=yt-mt),J=I;J>=0;J--){for(var Ge=!0,we=0;we<mt;we++)if(Et(E,J+we)!==Et(A,we)){Ge=!1;break}if(Ge)return J}return-1}function C(E,A,I,N){I=Number(I)||0;var X=E.length-I;N?(N=Number(N))>X&&(N=X):N=X;var J=A.length;N>J/2&&(N=J/2);for(var rt=0;rt<N;++rt){var yt=parseInt(A.substr(2*rt,2),16);if(ut(yt))return rt;E[I+rt]=yt}return rt}function P(E,A,I,N){return ht(st(A,E.length-I),E,I,N)}function S(E,A,I,N){return ht(function(X){for(var J=[],rt=0;rt<X.length;++rt)J.push(255&X.charCodeAt(rt));return J}(A),E,I,N)}function B(E,A,I,N){return S(E,A,I,N)}function D(E,A,I,N){return ht(it(A),E,I,N)}function V(E,A,I,N){return ht(function(X,J){for(var rt,yt,mt,Et=[],Ft=0;Ft<X.length&&!((J-=2)<0);++Ft)rt=X.charCodeAt(Ft),yt=rt>>8,mt=rt%256,Et.push(mt),Et.push(yt);return Et}(A,E.length-I),E,I,N)}function G(E,A,I){return A===0&&I===E.length?r.fromByteArray(E):r.fromByteArray(E.slice(A,I))}function F(E,A,I){I=Math.min(E.length,I);for(var N=[],X=A;X<I;){var J,rt,yt,mt,Et=E[X],Ft=null,Ge=Et>239?4:Et>223?3:Et>191?2:1;if(X+Ge<=I)switch(Ge){case 1:Et<128&&(Ft=Et);break;case 2:(192&(J=E[X+1]))==128&&(mt=(31&Et)<<6|63&J)>127&&(Ft=mt);break;case 3:J=E[X+1],rt=E[X+2],(192&J)==128&&(192&rt)==128&&(mt=(15&Et)<<12|(63&J)<<6|63&rt)>2047&&(mt<55296||mt>57343)&&(Ft=mt);break;case 4:J=E[X+1],rt=E[X+2],yt=E[X+3],(192&J)==128&&(192&rt)==128&&(192&yt)==128&&(mt=(15&Et)<<18|(63&J)<<12|(63&rt)<<6|63&yt)>65535&&mt<1114112&&(Ft=mt)}Ft===null?(Ft=65533,Ge=1):Ft>65535&&(Ft-=65536,N.push(Ft>>>10&1023|55296),Ft=56320|1023&Ft),N.push(Ft),X+=Ge}return function(we){var oe=we.length;if(oe<=R)return String.fromCharCode.apply(String,we);for(var Vt="",Gt=0;Gt<oe;)Vt+=String.fromCharCode.apply(String,we.slice(Gt,Gt+=R));return Vt}(N)}s.kMaxLength=l,c.TYPED_ARRAY_SUPPORT=function(){try{var E=new Uint8Array(1);return E.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},E.foo()===42}catch{return!1}}(),c.TYPED_ARRAY_SUPPORT||typeof console>"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(E,A,I){return d(E,A,I)},c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,c.alloc=function(E,A,I){return function(N,X,J){return f(N),N<=0?u(N):X!==void 0?typeof J=="string"?u(N).fill(X,J):u(N).fill(X):u(N)}(E,A,I)},c.allocUnsafe=function(E){return g(E)},c.allocUnsafeSlow=function(E){return g(E)},c.isBuffer=function(E){return E!=null&&E._isBuffer===!0&&E!==c.prototype},c.compare=function(E,A){if(lt(E,Uint8Array)&&(E=c.from(E,E.offset,E.byteLength)),lt(A,Uint8Array)&&(A=c.from(A,A.offset,A.byteLength)),!c.isBuffer(E)||!c.isBuffer(A))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(E===A)return 0;for(var I=E.length,N=A.length,X=0,J=Math.min(I,N);X<J;++X)if(E[X]!==A[X]){I=E[X],N=A[X];break}return I<N?-1:N<I?1:0},c.isEncoding=function(E){switch(String(E).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(E,A){if(!Array.isArray(E))throw new TypeError('"list" argument must be an Array of Buffers');if(E.length===0)return c.alloc(0);var I;if(A===void 0)for(A=0,I=0;I<E.length;++I)A+=E[I].length;var N=c.allocUnsafe(A),X=0;for(I=0;I<E.length;++I){var J=E[I];if(lt(J,Uint8Array)&&(J=c.from(J)),!c.isBuffer(J))throw new TypeError('"list" argument must be an Array of Buffers');J.copy(N,X),X+=J.length}return N},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var E=this.length;if(E%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var A=0;A<E;A+=2)x(this,A,A+1);return this},c.prototype.swap32=function(){var E=this.length;if(E%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var A=0;A<E;A+=4)x(this,A,A+3),x(this,A+1,A+2);return this},c.prototype.swap64=function(){var E=this.length;if(E%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var A=0;A<E;A+=8)x(this,A,A+7),x(this,A+1,A+6),x(this,A+2,A+5),x(this,A+3,A+4);return this},c.prototype.toString=function(){var E=this.length;return E===0?"":arguments.length===0?F(this,0,E):function(A,I,N){var X=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0)<=(I>>>=0))return"";for(A||(A="utf8");;)switch(A){case"hex":return $(this,I,N);case"utf8":case"utf-8":return F(this,I,N);case"ascii":return T(this,I,N);case"latin1":case"binary":return L(this,I,N);case"base64":return G(this,I,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z(this,I,N);default:if(X)throw new TypeError("Unknown encoding: "+A);A=(A+"").toLowerCase(),X=!0}}.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(E){if(!c.isBuffer(E))throw new TypeError("Argument must be a Buffer");return this===E||c.compare(this,E)===0},c.prototype.inspect=function(){var E="",A=s.INSPECT_MAX_BYTES;return E=this.toString("hex",0,A).replace(/(.{2})/g,"$1 ").trim(),this.length>A&&(E+=" ... "),"<Buffer "+E+">"},c.prototype.compare=function(E,A,I,N,X){if(lt(E,Uint8Array)&&(E=c.from(E,E.offset,E.byteLength)),!c.isBuffer(E))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof E);if(A===void 0&&(A=0),I===void 0&&(I=E?E.length:0),N===void 0&&(N=0),X===void 0&&(X=this.length),A<0||I>E.length||N<0||X>this.length)throw new RangeError("out of range index");if(N>=X&&A>=I)return 0;if(N>=X)return-1;if(A>=I)return 1;if(A>>>=0,I>>>=0,N>>>=0,X>>>=0,this===E)return 0;for(var J=X-N,rt=I-A,yt=Math.min(J,rt),mt=this.slice(N,X),Et=E.slice(A,I),Ft=0;Ft<yt;++Ft)if(mt[Ft]!==Et[Ft]){J=mt[Ft],rt=Et[Ft];break}return J<rt?-1:rt<J?1:0},c.prototype.includes=function(E,A,I){return this.indexOf(E,A,I)!==-1},c.prototype.indexOf=function(E,A,I){return _(this,E,A,I,!0)},c.prototype.lastIndexOf=function(E,A,I){return _(this,E,A,I,!1)},c.prototype.write=function(E,A,I,N){if(A===void 0)N="utf8",I=this.length,A=0;else if(I===void 0&&typeof A=="string")N=A,I=this.length,A=0;else{if(!isFinite(A))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");A>>>=0,isFinite(I)?(I>>>=0,N===void 0&&(N="utf8")):(N=I,I=void 0)}var X=this.length-A;if((I===void 0||I>X)&&(I=X),E.length>0&&(I<0||A<0)||A>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var J=!1;;)switch(N){case"hex":return C(this,E,A,I);case"utf8":case"utf-8":return P(this,E,A,I);case"ascii":return S(this,E,A,I);case"latin1":case"binary":return B(this,E,A,I);case"base64":return D(this,E,A,I);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,E,A,I);default:if(J)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),J=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function T(E,A,I){var N="";I=Math.min(E.length,I);for(var X=A;X<I;++X)N+=String.fromCharCode(127&E[X]);return N}function L(E,A,I){var N="";I=Math.min(E.length,I);for(var X=A;X<I;++X)N+=String.fromCharCode(E[X]);return N}function $(E,A,I){var N=E.length;(!A||A<0)&&(A=0),(!I||I<0||I>N)&&(I=N);for(var X="",J=A;J<I;++J)X+=tt(E[J]);return X}function Z(E,A,I){for(var N=E.slice(A,I),X="",J=0;J<N.length;J+=2)X+=String.fromCharCode(N[J]+256*N[J+1]);return X}function at(E,A,I){if(E%1!=0||E<0)throw new RangeError("offset is not uint");if(E+A>I)throw new RangeError("Trying to access beyond buffer length")}function q(E,A,I,N,X,J){if(!c.isBuffer(E))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>X||A<J)throw new RangeError('"value" argument is out of bounds');if(I+N>E.length)throw new RangeError("Index out of range")}function W(E,A,I,N,X,J){if(I+N>E.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("Index out of range")}function j(E,A,I,N,X){return A=+A,I>>>=0,X||W(E,0,I,4),o.write(E,A,I,N,23,4),I+4}function K(E,A,I,N,X){return A=+A,I>>>=0,X||W(E,0,I,8),o.write(E,A,I,N,52,8),I+8}c.prototype.slice=function(E,A){var I=this.length;E=~~E,A=A===void 0?I:~~A,E<0?(E+=I)<0&&(E=0):E>I&&(E=I),A<0?(A+=I)<0&&(A=0):A>I&&(A=I),A<E&&(A=E);var N=this.subarray(E,A);return N.__proto__=c.prototype,N},c.prototype.readUIntLE=function(E,A,I){E>>>=0,A>>>=0,I||at(E,A,this.length);for(var N=this[E],X=1,J=0;++J<A&&(X*=256);)N+=this[E+J]*X;return N},c.prototype.readUIntBE=function(E,A,I){E>>>=0,A>>>=0,I||at(E,A,this.length);for(var N=this[E+--A],X=1;A>0&&(X*=256);)N+=this[E+--A]*X;return N},c.prototype.readUInt8=function(E,A){return E>>>=0,A||at(E,1,this.length),this[E]},c.prototype.readUInt16LE=function(E,A){return E>>>=0,A||at(E,2,this.length),this[E]|this[E+1]<<8},c.prototype.readUInt16BE=function(E,A){return E>>>=0,A||at(E,2,this.length),this[E]<<8|this[E+1]},c.prototype.readUInt32LE=function(E,A){return E>>>=0,A||at(E,4,this.length),(this[E]|this[E+1]<<8|this[E+2]<<16)+16777216*this[E+3]},c.prototype.readUInt32BE=function(E,A){return E>>>=0,A||at(E,4,this.length),16777216*this[E]+(this[E+1]<<16|this[E+2]<<8|this[E+3])},c.prototype.readIntLE=function(E,A,I){E>>>=0,A>>>=0,I||at(E,A,this.length);for(var N=this[E],X=1,J=0;++J<A&&(X*=256);)N+=this[E+J]*X;return N>=(X*=128)&&(N-=Math.pow(2,8*A)),N},c.prototype.readIntBE=function(E,A,I){E>>>=0,A>>>=0,I||at(E,A,this.length);for(var N=A,X=1,J=this[E+--N];N>0&&(X*=256);)J+=this[E+--N]*X;return J>=(X*=128)&&(J-=Math.pow(2,8*A)),J},c.prototype.readInt8=function(E,A){return E>>>=0,A||at(E,1,this.length),128&this[E]?-1*(255-this[E]+1):this[E]},c.prototype.readInt16LE=function(E,A){E>>>=0,A||at(E,2,this.length);var I=this[E]|this[E+1]<<8;return 32768&I?4294901760|I:I},c.prototype.readInt16BE=function(E,A){E>>>=0,A||at(E,2,this.length);var I=this[E+1]|this[E]<<8;return 32768&I?4294901760|I:I},c.prototype.readInt32LE=function(E,A){return E>>>=0,A||at(E,4,this.length),this[E]|this[E+1]<<8|this[E+2]<<16|this[E+3]<<24},c.prototype.readInt32BE=function(E,A){return E>>>=0,A||at(E,4,this.length),this[E]<<24|this[E+1]<<16|this[E+2]<<8|this[E+3]},c.prototype.readFloatLE=function(E,A){return E>>>=0,A||at(E,4,this.length),o.read(this,E,!0,23,4)},c.prototype.readFloatBE=function(E,A){return E>>>=0,A||at(E,4,this.length),o.read(this,E,!1,23,4)},c.prototype.readDoubleLE=function(E,A){return E>>>=0,A||at(E,8,this.length),o.read(this,E,!0,52,8)},c.prototype.readDoubleBE=function(E,A){return E>>>=0,A||at(E,8,this.length),o.read(this,E,!1,52,8)},c.prototype.writeUIntLE=function(E,A,I,N){E=+E,A>>>=0,I>>>=0,N||q(this,E,A,I,Math.pow(2,8*I)-1,0);var X=1,J=0;for(this[A]=255&E;++J<I&&(X*=256);)this[A+J]=E/X&255;return A+I},c.prototype.writeUIntBE=function(E,A,I,N){E=+E,A>>>=0,I>>>=0,N||q(this,E,A,I,Math.pow(2,8*I)-1,0);var X=I-1,J=1;for(this[A+X]=255&E;--X>=0&&(J*=256);)this[A+X]=E/J&255;return A+I},c.prototype.writeUInt8=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,1,255,0),this[A]=255&E,A+1},c.prototype.writeUInt16LE=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,2,65535,0),this[A]=255&E,this[A+1]=E>>>8,A+2},c.prototype.writeUInt16BE=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,2,65535,0),this[A]=E>>>8,this[A+1]=255&E,A+2},c.prototype.writeUInt32LE=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,4,4294967295,0),this[A+3]=E>>>24,this[A+2]=E>>>16,this[A+1]=E>>>8,this[A]=255&E,A+4},c.prototype.writeUInt32BE=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,4,4294967295,0),this[A]=E>>>24,this[A+1]=E>>>16,this[A+2]=E>>>8,this[A+3]=255&E,A+4},c.prototype.writeIntLE=function(E,A,I,N){if(E=+E,A>>>=0,!N){var X=Math.pow(2,8*I-1);q(this,E,A,I,X-1,-X)}var J=0,rt=1,yt=0;for(this[A]=255&E;++J<I&&(rt*=256);)E<0&&yt===0&&this[A+J-1]!==0&&(yt=1),this[A+J]=(E/rt>>0)-yt&255;return A+I},c.prototype.writeIntBE=function(E,A,I,N){if(E=+E,A>>>=0,!N){var X=Math.pow(2,8*I-1);q(this,E,A,I,X-1,-X)}var J=I-1,rt=1,yt=0;for(this[A+J]=255&E;--J>=0&&(rt*=256);)E<0&&yt===0&&this[A+J+1]!==0&&(yt=1),this[A+J]=(E/rt>>0)-yt&255;return A+I},c.prototype.writeInt8=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,1,127,-128),E<0&&(E=255+E+1),this[A]=255&E,A+1},c.prototype.writeInt16LE=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,2,32767,-32768),this[A]=255&E,this[A+1]=E>>>8,A+2},c.prototype.writeInt16BE=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,2,32767,-32768),this[A]=E>>>8,this[A+1]=255&E,A+2},c.prototype.writeInt32LE=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,4,2147483647,-2147483648),this[A]=255&E,this[A+1]=E>>>8,this[A+2]=E>>>16,this[A+3]=E>>>24,A+4},c.prototype.writeInt32BE=function(E,A,I){return E=+E,A>>>=0,I||q(this,E,A,4,2147483647,-2147483648),E<0&&(E=4294967295+E+1),this[A]=E>>>24,this[A+1]=E>>>16,this[A+2]=E>>>8,this[A+3]=255&E,A+4},c.prototype.writeFloatLE=function(E,A,I){return j(this,E,A,!0,I)},c.prototype.writeFloatBE=function(E,A,I){return j(this,E,A,!1,I)},c.prototype.writeDoubleLE=function(E,A,I){return K(this,E,A,!0,I)},c.prototype.writeDoubleBE=function(E,A,I){return K(this,E,A,!1,I)},c.prototype.copy=function(E,A,I,N){if(!c.isBuffer(E))throw new TypeError("argument should be a Buffer");if(I||(I=0),N||N===0||(N=this.length),A>=E.length&&(A=E.length),A||(A=0),N>0&&N<I&&(N=I),N===I||E.length===0||this.length===0)return 0;if(A<0)throw new RangeError("targetStart out of bounds");if(I<0||I>=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),E.length-A<N-I&&(N=E.length-A+I);var X=N-I;if(this===E&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(A,I,N);else if(this===E&&I<A&&A<N)for(var J=X-1;J>=0;--J)E[J+A]=this[J+I];else Uint8Array.prototype.set.call(E,this.subarray(I,N),A);return X},c.prototype.fill=function(E,A,I,N){if(typeof E=="string"){if(typeof A=="string"?(N=A,A=0,I=this.length):typeof I=="string"&&(N=I,I=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(E.length===1){var X=E.charCodeAt(0);(N==="utf8"&&X<128||N==="latin1")&&(E=X)}}else typeof E=="number"&&(E&=255);if(A<0||this.length<A||this.length<I)throw new RangeError("Out of range index");if(I<=A)return this;var J;if(A>>>=0,I=I===void 0?this.length:I>>>0,E||(E=0),typeof E=="number")for(J=A;J<I;++J)this[J]=E;else{var rt=c.isBuffer(E)?E:c.from(E,N),yt=rt.length;if(yt===0)throw new TypeError('The value "'+E+'" is invalid for argument "value"');for(J=0;J<I-A;++J)this[J+A]=rt[J%yt]}return this};var U=/[^+/0-9A-Za-z-_]/g;function tt(E){return E<16?"0"+E.toString(16):E.toString(16)}function st(E,A){var I;A=A||1/0;for(var N=E.length,X=null,J=[],rt=0;rt<N;++rt){if((I=E.charCodeAt(rt))>55295&&I<57344){if(!X){if(I>56319){(A-=3)>-1&&J.push(239,191,189);continue}if(rt+1===N){(A-=3)>-1&&J.push(239,191,189);continue}X=I;continue}if(I<56320){(A-=3)>-1&&J.push(239,191,189),X=I;continue}I=65536+(X-55296<<10|I-56320)}else X&&(A-=3)>-1&&J.push(239,191,189);if(X=null,I<128){if((A-=1)<0)break;J.push(I)}else if(I<2048){if((A-=2)<0)break;J.push(I>>6|192,63&I|128)}else if(I<65536){if((A-=3)<0)break;J.push(I>>12|224,I>>6&63|128,63&I|128)}else{if(!(I<1114112))throw new Error("Invalid code point");if((A-=4)<0)break;J.push(I>>18|240,I>>12&63|128,I>>6&63|128,63&I|128)}}return J}function it(E){return r.toByteArray(function(A){if((A=(A=A.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;A.length%4!=0;)A+="=";return A}(E))}function ht(E,A,I,N){for(var X=0;X<N&&!(X+I>=A.length||X>=E.length);++X)A[X+I]=E[X];return X}function lt(E,A){return E instanceof A||E!=null&&E.constructor!=null&&E.constructor.name!=null&&E.constructor.name===A.name}function ut(E){return E!=E}}).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(o){if(o[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+o[0]+(this.useColors?"%c ":" ")+"+"+a.exports.humanize(this.diff),!this.useColors)return;const l="color: "+this.color;o.splice(1,0,l,"color: inherit");let u=0,c=0;o[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&d==="%c"&&(c=++u)}),o.splice(c,0,l)},s.save=function(o){try{o?s.storage.setItem("debug",o):s.storage.removeItem("debug")}catch{}},s.load=function(){let o;try{o=s.storage.getItem("debug")}catch{}return!o&&n!==void 0&&"env"in n&&(o=n.env.DEBUG),o},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 o=!1;return()=>{o||(o=!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(o){try{return JSON.stringify(o)}catch(l){return"[UnexpectedJSONParseError]: "+l.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,d,f,g=null;function m(...y){if(!m.enabled)return;const p=m,x=Number(new Date),_=x-(c||x);p.diff=_,p.prev=c,p.curr=x,c=x,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let b=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(C,P)=>{if(C==="%%")return"%";b++;const S=r.formatters[P];if(typeof S=="function"){const B=y[b];C=S.call(p,B),y.splice(b,1),b--}return C}),r.formatArgs.call(p,y),(p.log||r.log).apply(p,y)}return m.namespace=u,m.useColors=r.useColors(),m.color=r.selectColor(u),m.extend=o,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(d!==r.namespaces&&(d=r.namespaces,f=r.enabled(u)),f),set:y=>{g=y}}),typeof r.init=="function"&&r.init(m),m}function o(u,c){const d=r(this.namespace+(c===void 0?":":c)+u);return d.log=this.log,d}function l(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(l),...r.skips.map(l).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 d=(typeof u=="string"?u:"").split(/[\s,]+/),f=d.length;for(c=0;c<f;c++)d[c]&&((u=d[c].replace(/\*/g,".*?"))[0]==="-"?r.skips.push(new RegExp("^"+u.substr(1)+"$")):r.names.push(new RegExp("^"+u+"$")))},r.enabled=function(u){if(u[u.length-1]==="*")return!0;let c,d;for(c=0,d=r.skips.length;c<d;c++)if(r.skips[c].test(u))return!1;for(c=0,d=r.names.length;c<d;c++)if(r.names[c].test(u))return!0;return!1},r.humanize=i("ms"),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(n).forEach(u=>{r[u]=n[u]}),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(u){let c=0;for(let d=0;d<u.length;d++)c=(c<<5)-c+u.charCodeAt(d),c|=0;return r.colors[Math.abs(c)%r.colors.length]},r.enable(r.load()),r}},{ms:45}],20:[function(i,a,s){(function(n,r){(function(){var o=i("readable-stream"),l=i("end-of-stream"),u=i("inherits"),c=i("stream-shift"),d=r.from&&r.from!==Uint8Array.from?r.from([0]):new r([0]),f=function(p,x){p._corked?p.once("uncork",x):x()},g=function(p,x){return function(_){_?function(b,C){b._autoDestroy&&b.destroy(C)}(p,_.message==="premature close"?null:_):x&&!p._ended&&p.end()}},m=function(){},y=function(p,x,_){if(!(this instanceof y))return new y(p,x,_);o.Duplex.call(this,_),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!_||_.autoDestroy!==!1,this._forwardDestroy=!_||_.destroy!==!1,this._forwardEnd=!_||_.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,p&&this.setWritable(p),x&&this.setReadable(x)};u(y,o.Duplex),y.obj=function(p,x,_){return _||(_={}),_.objectMode=!0,_.highWaterMark=16,new y(p,x,_)},y.prototype.cork=function(){++this._corked==1&&this.emit("cork")},y.prototype.uncork=function(){this._corked&&--this._corked==0&&this.emit("uncork")},y.prototype.setWritable=function(p){if(this._unwrite&&this._unwrite(),this.destroyed)p&&p.destroy&&p.destroy();else if(p!==null&&p!==!1){var x=this,_=l(p,{writable:!0,readable:!1},g(this,this._forwardEnd)),b=function(){var C=x._ondrain;x._ondrain=null,C&&C()};this._unwrite&&n.nextTick(b),this._writable=p,this._writable.on("drain",b),this._unwrite=function(){x._writable.removeListener("drain",b),_()},this.uncork()}else this.end()},y.prototype.setReadable=function(p){if(this._unread&&this._unread(),this.destroyed)p&&p.destroy&&p.destroy();else{if(p===null||p===!1)return this.push(null),void this.resume();var x,_=this,b=l(p,{writable:!1,readable:!0},g(this)),C=function(){_._forward()},P=function(){_.push(null)};this._drained=!0,this._readable=p,this._readable2=p._readableState?p:(x=p,new o.Readable({objectMode:!0,highWaterMark:16}).wrap(x)),this._readable2.on("readable",C),this._readable2.on("end",P),this._unread=function(){_._readable2.removeListener("readable",C),_._readable2.removeListener("end",P),b()},this._forward()}},y.prototype._read=function(){this._drained=!0,this._forward()},y.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var p;for(this._forwarding=!0;this._drained&&(p=c(this._readable2))!==null;)this.destroyed||(this._drained=this.push(p));this._forwarding=!1}},y.prototype.destroy=function(p,x){if(x||(x=m),this.destroyed)return x(null);this.destroyed=!0;var _=this;n.nextTick(function(){_._destroy(p),x(null)})},y.prototype._destroy=function(p){if(p){var x=this._ondrain;this._ondrain=null,x?x(p):this.emit("error",p)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},y.prototype._write=function(p,x,_){if(!this.destroyed)return this._corked?f(this,this._write.bind(this,p,x,_)):p===d?this._finish(_):this._writable?void(this._writable.write(p)===!1?this._ondrain=_:this.destroyed||_()):_()},y.prototype._finish=function(p){var x=this;this.emit("preend"),f(this,function(){var _,b;_=x._forwardEnd&&x._writable,b=function(){x._writableState.prefinished===!1&&(x._writableState.prefinished=!0),x.emit("prefinish"),f(x,p)},_?_._writableState&&_._writableState.finished?b():_._writableState?_.end(b):(_.end(),b()):b()})},y.prototype.end=function(p,x,_){return typeof p=="function"?this.end(null,null,p):typeof x=="function"?this.end(p,null,x):(this._ended=!0,p&&this.write(p),this._writableState.ending||this._writableState.destroyed||this.write(d),o.Writable.prototype.end.call(this,_))},a.exports=y}).call(this)}).call(this,i("_process"),i("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(i,a,s){(function(n){(function(){var r=i("once"),o=function(){},l=function(u,c,d){if(typeof c=="function")return l(u,null,c);c||(c={}),d=r(d||o);var f=u._writableState,g=u._readableState,m=c.readable||c.readable!==!1&&u.readable,y=c.writable||c.writable!==!1&&u.writable,p=!1,x=function(){u.writable||_()},_=function(){y=!1,m||d.call(u)},b=function(){m=!1,y||d.call(u)},C=function(V){d.call(u,V?new Error("exited with error code: "+V):null)},P=function(V){d.call(u,V)},S=function(){n.nextTick(B)},B=function(){if(!p)return(!m||g&&g.ended&&!g.destroyed)&&(!y||f&&f.ended&&!f.destroyed)?void 0:d.call(u,new Error("premature close"))},D=function(){u.req.on("finish",_)};return function(V){return V.setHeader&&typeof V.abort=="function"}(u)?(u.on("complete",_),u.on("abort",S),u.req?D():u.on("request",D)):y&&!f&&(u.on("end",x),u.on("close",x)),function(V){return V.stdio&&Array.isArray(V.stdio)&&V.stdio.length===3}(u)&&u.on("exit",C),u.on("end",b),u.on("finish",_),c.error!==!1&&u.on("error",P),u.on("close",S),function(){p=!0,u.removeListener("complete",_),u.removeListener("abort",S),u.removeListener("request",D),u.req&&u.req.removeListener("finish",_),u.removeListener("end",x),u.removeListener("close",x),u.removeListener("finish",_),u.removeListener("exit",C),u.removeListener("end",b),u.removeListener("error",P),u.removeListener("close",S)}};a.exports=l}).call(this)}).call(this,i("_process"))},{_process:50,once:48}],22:[function(i,a,s){var n=Object.create||function(b){var C=function(){};return C.prototype=b,new C},r=Object.keys||function(b){var C=[];for(var P in b)Object.prototype.hasOwnProperty.call(b,P)&&C.push(P);return P},o=Function.prototype.bind||function(b){var C=this;return function(){return C.apply(b,arguments)}};function l(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}a.exports=l,l.EventEmitter=l,l.prototype._events=void 0,l.prototype._maxListeners=void 0;var u,c=10;try{var d={};Object.defineProperty&&Object.defineProperty(d,"x",{value:0}),u=d.x===0}catch{u=!1}function f(b){return b._maxListeners===void 0?l.defaultMaxListeners:b._maxListeners}function g(b,C,P,S){var B,D,V;if(typeof P!="function")throw new TypeError('"listener" argument must be a function');if((D=b._events)?(D.newListener&&(b.emit("newListener",C,P.listener?P.listener:P),D=b._events),V=D[C]):(D=b._events=n(null),b._eventsCount=0),V){if(typeof V=="function"?V=D[C]=S?[P,V]:[V,P]:S?V.unshift(P):V.push(P),!V.warned&&(B=f(b))&&B>0&&V.length>B){V.warned=!0;var G=new Error("Possible EventEmitter memory leak detected. "+V.length+' "'+String(C)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');G.name="MaxListenersExceededWarning",G.emitter=b,G.type=C,G.count=V.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",G.name,G.message)}}else V=D[C]=P,++b._eventsCount;return b}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 b=new Array(arguments.length),C=0;C<b.length;++C)b[C]=arguments[C];this.listener.apply(this.target,b)}}function y(b,C,P){var S={fired:!1,wrapFn:void 0,target:b,type:C,listener:P},B=o.call(m,S);return B.listener=P,S.wrapFn=B,B}function p(b,C,P){var S=b._events;if(!S)return[];var B=S[C];return B?typeof B=="function"?P?[B.listener||B]:[B]:P?function(D){for(var V=new Array(D.length),G=0;G<V.length;++G)V[G]=D[G].listener||D[G];return V}(B):_(B,B.length):[]}function x(b){var C=this._events;if(C){var P=C[b];if(typeof P=="function")return 1;if(P)return P.length}return 0}function _(b,C){for(var P=new Array(C),S=0;S<C;++S)P[S]=b[S];return P}u?Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(b){if(typeof b!="number"||b<0||b!=b)throw new TypeError('"defaultMaxListeners" must be a positive number');c=b}}):l.defaultMaxListeners=c,l.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||isNaN(b))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=b,this},l.prototype.getMaxListeners=function(){return f(this)},l.prototype.emit=function(b){var C,P,S,B,D,V,G=b==="error";if(V=this._events)G=G&&V.error==null;else if(!G)return!1;if(G){if(arguments.length>1&&(C=arguments[1]),C instanceof Error)throw C;var F=new Error('Unhandled "error" event. ('+C+")");throw F.context=C,F}if(!(P=V[b]))return!1;var R=typeof P=="function";switch(S=arguments.length){case 1:(function(T,L,$){if(L)T.call($);else for(var Z=T.length,at=_(T,Z),q=0;q<Z;++q)at[q].call($)})(P,R,this);break;case 2:(function(T,L,$,Z){if(L)T.call($,Z);else for(var at=T.length,q=_(T,at),W=0;W<at;++W)q[W].call($,Z)})(P,R,this,arguments[1]);break;case 3:(function(T,L,$,Z,at){if(L)T.call($,Z,at);else for(var q=T.length,W=_(T,q),j=0;j<q;++j)W[j].call($,Z,at)})(P,R,this,arguments[1],arguments[2]);break;case 4:(function(T,L,$,Z,at,q){if(L)T.call($,Z,at,q);else for(var W=T.length,j=_(T,W),K=0;K<W;++K)j[K].call($,Z,at,q)})(P,R,this,arguments[1],arguments[2],arguments[3]);break;default:for(B=new Array(S-1),D=1;D<S;D++)B[D-1]=arguments[D];(function(T,L,$,Z){if(L)T.apply($,Z);else for(var at=T.length,q=_(T,at),W=0;W<at;++W)q[W].apply($,Z)})(P,R,this,B)}return!0},l.prototype.addListener=function(b,C){return g(this,b,C,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(b,C){return g(this,b,C,!0)},l.prototype.once=function(b,C){if(typeof C!="function")throw new TypeError('"listener" argument must be a function');return this.on(b,y(this,b,C)),this},l.prototype.prependOnceListener=function(b,C){if(typeof C!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(b,y(this,b,C)),this},l.prototype.removeListener=function(b,C){var P,S,B,D,V;if(typeof C!="function")throw new TypeError('"listener" argument must be a function');if(!(S=this._events))return this;if(!(P=S[b]))return this;if(P===C||P.listener===C)--this._eventsCount==0?this._events=n(null):(delete S[b],S.removeListener&&this.emit("removeListener",b,P.listener||C));else if(typeof P!="function"){for(B=-1,D=P.length-1;D>=0;D--)if(P[D]===C||P[D].listener===C){V=P[D].listener,B=D;break}if(B<0)return this;B===0?P.shift():function(G,F){for(var R=F,T=R+1,L=G.length;T<L;R+=1,T+=1)G[R]=G[T];G.pop()}(P,B),P.length===1&&(S[b]=P[0]),S.removeListener&&this.emit("removeListener",b,V||C)}return this},l.prototype.removeAllListeners=function(b){var C,P,S;if(!(P=this._events))return this;if(!P.removeListener)return arguments.length===0?(this._events=n(null),this._eventsCount=0):P[b]&&(--this._eventsCount==0?this._events=n(null):delete P[b]),this;if(arguments.length===0){var B,D=r(P);for(S=0;S<D.length;++S)(B=D[S])!=="removeListener"&&this.removeAllListeners(B);return this.removeAllListeners("removeListener"),this._events=n(null),this._eventsCount=0,this}if(typeof(C=P[b])=="function")this.removeListener(b,C);else if(C)for(S=C.length-1;S>=0;S--)this.removeListener(b,C[S]);return this},l.prototype.listeners=function(b){return p(this,b,!0)},l.prototype.rawListeners=function(b){return p(this,b,!1)},l.listenerCount=function(b,C){return typeof b.listenerCount=="function"?b.listenerCount(C):x.call(b,C)},l.prototype.listenerCount=x,l.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(i,a,s){s.read=function(n,r,o,l,u){var c,d,f=8*u-l-1,g=(1<<f)-1,m=g>>1,y=-7,p=o?u-1:0,x=o?-1:1,_=n[r+p];for(p+=x,c=_&(1<<-y)-1,_>>=-y,y+=f;y>0;c=256*c+n[r+p],p+=x,y-=8);for(d=c&(1<<-y)-1,c>>=-y,y+=l;y>0;d=256*d+n[r+p],p+=x,y-=8);if(c===0)c=1-m;else{if(c===g)return d?NaN:1/0*(_?-1:1);d+=Math.pow(2,l),c-=m}return(_?-1:1)*d*Math.pow(2,c-l)},s.write=function(n,r,o,l,u,c){var d,f,g,m=8*c-u-1,y=(1<<m)-1,p=y>>1,x=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=l?0:c-1,b=l?1:-1,C=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,d=y):(d=Math.floor(Math.log(r)/Math.LN2),r*(g=Math.pow(2,-d))<1&&(d--,g*=2),(r+=d+p>=1?x/g:x*Math.pow(2,1-p))*g>=2&&(d++,g/=2),d+p>=y?(f=0,d=y):d+p>=1?(f=(r*g-1)*Math.pow(2,u),d+=p):(f=r*Math.pow(2,p-1)*Math.pow(2,u),d=0));u>=8;n[o+_]=255&f,_+=b,f/=256,u-=8);for(d=d<<u|f,m+=u;m>0;n[o+_]=255&d,_+=b,d/=256,m-=8);n[o+_-b]|=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 o=function(){};o.prototype=r.prototype,n.prototype=new o,n.prototype.constructor=n}}},{}],25:[function(i,a,s){Object.defineProperty(s,"__esModule",{value:!0});var n=function(){function r(o,l){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=o,this.value=l}return r.prototype.rotateLeft=function(){var o=this.parent,l=this.brother,u=this.leftChild,c=this.rightChild;if(!c)throw new Error("unknown error");var d=c.leftChild,f=c.rightChild;return o&&(o.leftChild===this?o.leftChild=c:o.rightChild===this&&(o.rightChild=c)),c.parent=o,c.brother=l,c.leftChild=this,c.rightChild=f,l&&(l.brother=c),this.parent=c,this.brother=f,this.leftChild=u,this.rightChild=d,f&&(f.parent=c,f.brother=this),u&&(u.parent=this,u.brother=d),d&&(d.parent=this,d.brother=u),c},r.prototype.rotateRight=function(){var o=this.parent,l=this.brother,u=this.leftChild;if(!u)throw new Error("unknown error");var c=this.rightChild,d=u.leftChild,f=u.rightChild;return o&&(o.leftChild===this?o.leftChild=u:o.rightChild===this&&(o.rightChild=u)),u.parent=o,u.brother=l,u.leftChild=d,u.rightChild=this,l&&(l.brother=u),d&&(d.parent=u,d.brother=this),this.parent=u,this.brother=d,this.leftChild=f,this.rightChild=c,f&&(f.parent=this,f.brother=c),c&&(c.parent=this,c.brother=f),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(o,l){var u,c,d,f,g={label:0,sent:function(){if(1&d[0])throw d[1];return d[1]},trys:[],ops:[]};return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(y){return function(p){return function(x){if(u)throw new TypeError("Generator is already executing.");for(;g;)try{if(u=1,c&&(d=2&x[0]?c.return:x[0]?c.throw||((d=c.return)&&d.call(c),0):c.next)&&!(d=d.call(c,x[1])).done)return d;switch(c=0,d&&(x=[2&x[0],d.value]),x[0]){case 0:case 1:d=x;break;case 4:return g.label++,{value:x[1],done:!1};case 5:g.label++,c=x[1],x=[0];continue;case 7:x=g.ops.pop(),g.trys.pop();continue;default:if(!(d=(d=g.trys).length>0&&d[d.length-1])&&(x[0]===6||x[0]===2)){g=0;continue}if(x[0]===3&&(!d||x[1]>d[0]&&x[1]<d[3])){g.label=x[1];break}if(x[0]===6&&g.label<d[1]){g.label=d[1],d=x;break}if(d&&g.label<d[2]){g.label=d[2],g.ops.push(x);break}d[2]&&g.ops.pop(),g.trys.pop();continue}x=l.call(o,g)}catch(_){x=[6,_],c=0}finally{u=d=0}if(5&x[0])throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}([y,p])}}};function r(o){var l=this;o===void 0&&(o=[]);var u=[],c=0,d=0,f=0,g=0,m=0,y=0;this.size=function(){return y},this.empty=function(){return y===0},this.clear=function(){c=f=d=g=m=y=0,x.call(this,r.bucketSize),y=0},this.front=function(){return u[c][d]},this.back=function(){return u[f][g]},this.forEach=function(_){if(!this.empty()){var b=0;if(c!==f){for(P=d;P<r.bucketSize;++P)_(u[c][P],b++);for(P=c+1;P<f;++P)for(var C=0;C<r.bucketSize;++C)_(u[P][C],b++);for(P=0;P<=g;++P)_(u[f][P],b++)}else for(var P=d;P<=g;++P)_(u[c][P],b++)}};var p=function(_){var b=c*r.bucketSize+d,C=b+_,P=f*r.bucketSize+g;if(C<b||C>P)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(_){var b=p(_),C=b.curNodeBucketIndex,P=b.curNodePointerIndex;return u[C][P]},this.eraseElementByPos=function(_){var b=this;if(_<0||_>y)throw new Error("pos should more than 0 and less than queue's size");if(_===0)this.popFront();else if(_===this.size())this.popBack();else{for(var C=[],P=_+1;P<y;++P)C.push(this.getElementByPos(P));this.cut(_),this.popBack(),C.forEach(function(S){return b.pushBack(S)})}},this.eraseElementByValue=function(_){if(!this.empty()){var b=[];this.forEach(function(S){S!==_&&b.push(S)});for(var C=b.length,P=0;P<C;++P)this.setElementByPos(P,b[P]);this.cut(C-1)}};var x=function(_){for(var b=[],C=_*r.sigma,P=Math.max(Math.ceil(C/r.bucketSize),2),S=0;S<P;++S)b.push(new Array(r.bucketSize));var B=Math.ceil(_/r.bucketSize),D=Math.floor(P/2)-Math.floor(B/2),V=D,G=0;if(this.size())for(S=0;S<B;++S){for(var F=0;F<r.bucketSize;++F)if(b[D+S][F]=this.front(),this.popFront(),this.empty()){V=D+S,G=F;break}if(this.empty())break}u=b,c=D,d=0,f=V,g=G,m=P,y=_};this.pushBack=function(_){this.empty()||(f===m-1&&g===r.bucketSize-1&&x.call(this,this.size()),g<r.bucketSize-1?++g:f<m-1&&(++f,g=0)),++y,u[f][g]=_},this.popBack=function(){this.empty()||(this.size()!==1&&(g>0?--g:c<f&&(--f,g=r.bucketSize-1)),y>0&&--y)},this.setElementByPos=function(_,b){var C=p(_),P=C.curNodeBucketIndex,S=C.curNodePointerIndex;u[P][S]=b},this.insert=function(_,b,C){var P=this;if(C===void 0&&(C=1),_===0)for(;C--;)this.pushFront(b);else if(_===this.size())for(;C--;)this.pushBack(b);else{for(var S=[],B=_;B<y;++B)S.push(this.getElementByPos(B));for(this.cut(_-1),B=0;B<C;++B)this.pushBack(b);S.forEach(function(D){return P.pushBack(D)})}},this.find=function(_){if(c===f){for(var b=d;b<=g;++b)if(u[c][b]===_)return!0;return!1}for(b=d;b<r.bucketSize;++b)if(u[c][b]===_)return!0;for(b=c+1;b<f;++b)for(var C=0;C<r.bucketSize;++C)if(u[b][C]===_)return!0;for(b=0;b<=g;++b)if(u[f][b]===_)return!0;return!1},this.reverse=function(){for(var _=0,b=y-1;_<b;){var C=this.getElementByPos(_);this.setElementByPos(_,this.getElementByPos(b)),this.setElementByPos(b,C),++_,--b}},this.unique=function(){if(!this.empty()){var _=[],b=this.front();this.forEach(function(P,S){S!==0&&P===b||(_.push(P),b=P)});for(var C=0;C<y;++C)this.setElementByPos(C,_[C]);this.cut(_.length-1)}},this.sort=function(_){var b=[];this.forEach(function(P){b.push(P)}),b.sort(_);for(var C=0;C<y;++C)this.setElementByPos(C,b[C])},this.pushFront=function(_){this.empty()||(c===0&&d===0&&x.call(this,this.size()),d>0?--d:c>0&&(--c,d=r.bucketSize-1)),++y,u[c][d]=_},this.popFront=function(){this.empty()||(this.size()!==1&&(d<r.bucketSize-1?++d:c<f&&(++c,d=0)),y>0&&--y)},this.shrinkToFit=function(){var _=this,b=[];this.forEach(function(B){b.push(B)});var C=b.length;u=[];for(var P=Math.ceil(C/r.bucketSize),S=0;S<P;++S)u.push(new Array(r.bucketSize));this.clear(),b.forEach(function(B){return _.pushBack(B)})},this.cut=function(_){if(_<0)this.clear();else{var b=p(_),C=b.curNodeBucketIndex,P=b.curNodePointerIndex;f=C,g=P,y=_+1}},this[Symbol.iterator]=function(){return function(){var _,b;return n(this,function(C){switch(C.label){case 0:if(y===0)return[2];if(c!==f)return[3,5];b=d,C.label=1;case 1:return b<=g?[4,u[c][b]]:[3,4];case 2:C.sent(),C.label=3;case 3:return++b,[3,1];case 4:return[2];case 5:b=d,C.label=6;case 6:return b<r.bucketSize?[4,u[c][b]]:[3,9];case 7:C.sent(),C.label=8;case 8:return++b,[3,6];case 9:b=c+1,C.label=10;case 10:if(!(b<f))return[3,15];_=0,C.label=11;case 11:return _<r.bucketSize?[4,u[b][_]]:[3,14];case 12:C.sent(),C.label=13;case 13:return++_,[3,11];case 14:return++b,[3,10];case 15:b=0,C.label=16;case 16:return b<=g?[4,u[f][b]]:[3,19];case 17:C.sent(),C.label=18;case 18:return++b,[3,16];case 19:return[2]}})}()},function(){var _=r.bucketSize;o.size?_=o.size():o.length&&(_=o.length);var b=_*r.sigma;m=Math.ceil(b/r.bucketSize),m=Math.max(m,3);for(var C=0;C<m;++C)u.push(new Array(r.bucketSize));var P=Math.ceil(_/r.bucketSize);c=Math.floor(m/2)-Math.floor(P/2),f=c,o.forEach(function(S){return l.pushBack(S)})}(),Object.freeze(this)}Object.defineProperty(s,"__esModule",{value:!0}),r.sigma=3,r.bucketSize=5e3,Object.freeze(r),s.default=r},{}],27:[function(i,a,s){var n=this&&this.__generator||function(c,d){var f,g,m,y,p={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return y={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function x(_){return function(b){return function(C){if(f)throw new TypeError("Generator is already executing.");for(;p;)try{if(f=1,g&&(m=2&C[0]?g.return:C[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,C[1])).done)return m;switch(g=0,m&&(C=[2&C[0],m.value]),C[0]){case 0:case 1:m=C;break;case 4:return p.label++,{value:C[1],done:!1};case 5:p.label++,g=C[1],C=[0];continue;case 7:C=p.ops.pop(),p.trys.pop();continue;default:if(!(m=(m=p.trys).length>0&&m[m.length-1])&&(C[0]===6||C[0]===2)){p=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]<m[3])){p.label=C[1];break}if(C[0]===6&&p.label<m[1]){p.label=m[1],m=C;break}if(m&&p.label<m[2]){p.label=m[2],p.ops.push(C);break}m[2]&&p.ops.pop(),p.trys.pop();continue}C=d.call(c,p)}catch(P){C=[6,P],g=0}finally{f=m=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([_,b])}}},r=this&&this.__values||function(c){var d=typeof Symbol=="function"&&Symbol.iterator,f=d&&c[d],g=0;if(f)return f.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&g>=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var o=i("../LinkList/LinkList"),l=i("../Map/Map");function u(c,d,f){var g=this;if(c===void 0&&(c=[]),d===void 0&&(d=u.initSize),f=f||function(x){var _,b,C=0,P="";if(typeof x=="number")C=((C=Math.floor(x))<<5)-C,C&=C;else{P=typeof x!="string"?JSON.stringify(x):x;try{for(var S=r(P),B=S.next();!B.done;B=S.next())C=(C<<5)-C+B.value.charCodeAt(0),C&=C}catch(D){_={error:D}}finally{try{B&&!B.done&&(b=S.return)&&b.call(S)}finally{if(_)throw _.error}}}return C^=C>>>16},(d&d-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var m=0,y=[],p=Math.max(u.initSize,Math.min(u.maxSize,d));this.size=function(){return m},this.empty=function(){return m===0},this.clear=function(){m=0,p=d,y=[]},this.forEach=function(x){var _=0;y.forEach(function(b){b.forEach(function(C){x(C,_++)})})},this.setElement=function(x,_){var b,C;if(x==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(_!=null){var P=f(x)&p-1;if(y[P]){var S=y[P].size();if(y[P]instanceof o.default){try{for(var B=r(y[P]),D=B.next();!D.done;D=B.next()){var V=D.value;if(V.key===x)return void(V.value=_)}}catch(F){b={error:F}}finally{try{D&&!D.done&&(C=B.return)&&C.call(B)}finally{if(b)throw b.error}}y[P].pushBack({key:x,value:_}),y[P].size()>=u.treeifyThreshold&&(y[P]=new l.default(y[P]))}else y[P].setElement(x,_);var G=y[P].size();m+=G-S}else++m,y[P]=new o.default([{key:x,value:_}]);m>p*u.sigma&&function(F){if(!(F>=u.maxSize)){p=2*F;var R=[];y.forEach(function(T,L){if(!T.empty()){if(T instanceof o.default&&T.size()===1){var $=T.front(),Z=$.key,at=$.value;R[f(Z)&p-1]=new o.default([{key:Z,value:at}])}else if(T instanceof l.default){var q=new o.default,W=new o.default;T.forEach(function(U){(f(U.key)&F)==0?q.pushBack(U):W.pushBack(U)}),q.size()>u.untreeifyThreshold?R[L]=new l.default(q):q.size()&&(R[L]=q),W.size()>u.untreeifyThreshold?R[L+F]=new l.default(W):W.size()&&(R[L+F]=W)}else{var j=new o.default,K=new o.default;T.forEach(function(U){(f(U.key)&F)==0?j.pushBack(U):K.pushBack(U)}),j.size()&&(R[L]=j),K.size()&&(R[L+F]=K)}y[L].clear()}}),y=R}}.call(this,p)}else this.eraseElementByKey(x)},this.getElementByKey=function(x){var _,b,C=f(x)&p-1;if(y[C]){if(y[C]instanceof l.default)return y[C].getElementByKey(x);try{for(var P=r(y[C]),S=P.next();!S.done;S=P.next()){var B=S.value;if(B.key===x)return B.value}}catch(D){_={error:D}}finally{try{S&&!S.done&&(b=P.return)&&b.call(P)}finally{if(_)throw _.error}}}},this.eraseElementByKey=function(x){var _,b,C=f(x)&p-1;if(y[C]){var P=y[C].size();if(y[C]instanceof l.default)y[C].eraseElementByKey(x),y[C].size()<=u.untreeifyThreshold&&(y[C]=new o.default(y[C]));else{var S=-1;try{for(var B=r(y[C]),D=B.next();!D.done;D=B.next())if(++S,D.value.key===x){y[C].eraseElementByPos(S);break}}catch(G){_={error:G}}finally{try{D&&!D.done&&(b=B.return)&&b.call(B)}finally{if(_)throw _.error}}}var V=y[C].size();m+=V-P}},this.find=function(x){var _,b,C=f(x)&p-1;if(!y[C])return!1;if(y[C]instanceof l.default)return y[C].find(x);try{for(var P=r(y[C]),S=P.next();!S.done;S=P.next())if(S.value.key===x)return!0}catch(B){_={error:B}}finally{try{S&&!S.done&&(b=P.return)&&b.call(P)}finally{if(_)throw _.error}}return!1},this[Symbol.iterator]=function(){return function(){var x,_,b,C,P,S;return n(this,function(B){switch(B.label){case 0:x=0,B.label=1;case 1:if(!(x<p))return[3,10];for(;x<p&&!y[x];)++x;if(x>=p)return[3,10];B.label=2;case 2:B.trys.push([2,7,8,9]),P=void 0,_=r(y[x]),b=_.next(),B.label=3;case 3:return b.done?[3,6]:[4,b.value];case 4:B.sent(),B.label=5;case 5:return b=_.next(),[3,3];case 6:return[3,9];case 7:return C=B.sent(),P={error:C},[3,9];case 8:try{b&&!b.done&&(S=_.return)&&S.call(_)}finally{if(P)throw P.error}return[7];case 9:return++x,[3,1];case 10:return[2]}})}()},c.forEach(function(x){var _=x.key,b=x.value;return g.setElement(_,b)}),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,d){var f,g,m,y,p={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return y={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function x(_){return function(b){return function(C){if(f)throw new TypeError("Generator is already executing.");for(;p;)try{if(f=1,g&&(m=2&C[0]?g.return:C[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,C[1])).done)return m;switch(g=0,m&&(C=[2&C[0],m.value]),C[0]){case 0:case 1:m=C;break;case 4:return p.label++,{value:C[1],done:!1};case 5:p.label++,g=C[1],C=[0];continue;case 7:C=p.ops.pop(),p.trys.pop();continue;default:if(!(m=(m=p.trys).length>0&&m[m.length-1])&&(C[0]===6||C[0]===2)){p=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]<m[3])){p.label=C[1];break}if(C[0]===6&&p.label<m[1]){p.label=m[1],m=C;break}if(m&&p.label<m[2]){p.label=m[2],p.ops.push(C);break}m[2]&&p.ops.pop(),p.trys.pop();continue}C=d.call(c,p)}catch(P){C=[6,P],g=0}finally{f=m=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([_,b])}}},r=this&&this.__values||function(c){var d=typeof Symbol=="function"&&Symbol.iterator,f=d&&c[d],g=0;if(f)return f.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&g>=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var o=i("../Set/Set"),l=i("../LinkList/LinkList");function u(c,d,f){var g=this;if(c===void 0&&(c=[]),d===void 0&&(d=u.initSize),f=f||function(x){var _=0,b="";if(typeof x=="number")_=((_=Math.floor(x))<<5)-_,_&=_;else{b=typeof x!="string"?JSON.stringify(x):x;for(var C=0;C<b.length;C++)_=(_<<5)-_+b.charCodeAt(C),_&=_}return _^=_>>>16},(d&d-1)!=0)throw new Error("initBucketNum must be 2 to the power of n");var m=0,y=[],p=Math.max(u.initSize,Math.min(u.maxSize,d));this.size=function(){return m},this.empty=function(){return m===0},this.clear=function(){m=0,p=d,y=[]},this.forEach=function(x){var _=0;y.forEach(function(b){b.forEach(function(C){x(C,_++)})})},this.insert=function(x){if(x==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var _=f(x)&p-1;if(y[_]){var b=y[_].size();if(y[_]instanceof l.default){if(y[_].find(x))return;y[_].pushBack(x),y[_].size()>=u.treeifyThreshold&&(y[_]=new o.default(y[_]))}else y[_].insert(x);var C=y[_].size();m+=C-b}else y[_]=new l.default([x]),++m;m>p*u.sigma&&function(P){if(!(P>=u.maxSize)){p=2*P;var S=[];y.forEach(function(B,D){if(!B.empty()){if(B instanceof l.default&&B.size()===1){var V=B.front();if(V===void 0)throw new Error("unknown error");S[f(V)&p-1]=new l.default([V])}else if(B instanceof o.default){var G=new l.default,F=new l.default;B.forEach(function(L){(f(L)&P)==0?G.pushBack(L):F.pushBack(L)}),G.size()>u.untreeifyThreshold?S[D]=new o.default(G):G.size()&&(S[D]=G),F.size()>u.untreeifyThreshold?S[D+P]=new o.default(F):F.size()&&(S[D+P]=F)}else{var R=new l.default,T=new l.default;B.forEach(function(L){(f(L)&P)==0?R.pushBack(L):T.pushBack(L)}),R.size()&&(S[D]=R),T.size()&&(S[D+P]=T)}y[D].clear()}}),y=S}}.call(this,p)},this.eraseElementByValue=function(x){var _=f(x)&p-1;if(y[_]){var b=y[_].size();y[_].eraseElementByValue(x),y[_]instanceof o.default&&y[_].size()<=u.untreeifyThreshold&&(y[_]=new l.default(y[_]));var C=y[_].size();m+=C-b}},this.find=function(x){var _=f(x)&p-1;return!!y[_]&&y[_].find(x)},this[Symbol.iterator]=function(){return function(){var x,_,b,C,P,S;return n(this,function(B){switch(B.label){case 0:x=0,B.label=1;case 1:if(!(x<p))return[3,10];for(;x<p&&!y[x];)++x;if(x>=p)return[3,10];B.label=2;case 2:B.trys.push([2,7,8,9]),P=void 0,_=r(y[x]),b=_.next(),B.label=3;case 3:return b.done?[3,6]:[4,b.value];case 4:B.sent(),B.label=5;case 5:return b=_.next(),[3,3];case 6:return[3,9];case 7:return C=B.sent(),P={error:C},[3,9];case 8:try{b&&!b.done&&(S=_.return)&&S.call(_)}finally{if(P)throw P.error}return[7];case 9:return++x,[3,1];case 10:return[2]}})}()},c.forEach(function(x){return g.insert(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,"../Set/Set":33}],29:[function(i,a,s){var n=this&&this.__generator||function(l,u){var c,d,f,g,m={label:0,sent:function(){if(1&f[0])throw f[1];return f[1]},trys:[],ops:[]};return g={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function y(p){return function(x){return function(_){if(c)throw new TypeError("Generator is already executing.");for(;m;)try{if(c=1,d&&(f=2&_[0]?d.return:_[0]?d.throw||((f=d.return)&&f.call(d),0):d.next)&&!(f=f.call(d,_[1])).done)return f;switch(d=0,f&&(_=[2&_[0],f.value]),_[0]){case 0:case 1:f=_;break;case 4:return m.label++,{value:_[1],done:!1};case 5:m.label++,d=_[1],_=[0];continue;case 7:_=m.ops.pop(),m.trys.pop();continue;default:if(!(f=(f=m.trys).length>0&&f[f.length-1])&&(_[0]===6||_[0]===2)){m=0;continue}if(_[0]===3&&(!f||_[1]>f[0]&&_[1]<f[3])){m.label=_[1];break}if(_[0]===6&&m.label<f[1]){m.label=f[1],f=_;break}if(f&&m.label<f[2]){m.label=f[2],m.ops.push(_);break}f[2]&&m.ops.pop(),m.trys.pop();continue}_=u.call(l,m)}catch(b){_=[6,b],d=0}finally{c=f=0}if(5&_[0])throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}([p,x])}}};Object.defineProperty(s,"__esModule",{value:!0});var r=function(){return function(l){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=l}}();function o(l){var u=this;l===void 0&&(l=[]);var c=0,d=void 0,f=void 0;this.size=function(){return c},this.empty=function(){return c===0},this.clear=function(){d=f=void 0,c=0},this.front=function(){return d==null?void 0:d.value},this.back=function(){return f==null?void 0:f.value},this.forEach=function(g){for(var m=d,y=0;m;){if(m.value===void 0)throw new Error("unknown error");g(m.value,y++),m=m.next}},this.getElementByPos=function(g){if(g<0||g>=c)throw new Error("pos must more then 0 and less then the list length");for(var m=d;g--&&m;)m=m.next;if(!m||m.value===void 0)throw new Error("unknown error");return m.value},this.eraseElementByPos=function(g){if(g<0||g>=c)throw new Error("erase pos must more then 0 and less then the list length");if(g===0)this.popFront();else if(g===c-1)this.popBack();else{for(var m=d;g--;){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 y=m.pre,p=m.next;p.pre=y,y.next=p,c>0&&--c}},this.eraseElementByValue=function(g){for(;d&&d.value===g;)this.popFront();for(;f&&f.value===g;)this.popBack();if(d)for(var m=d;m;){if(m.value===g){var y=m.pre,p=m.next;p&&(p.pre=y),y&&(y.next=p),c>0&&--c}m=m.next}},this.pushBack=function(g){if(g==null)throw new Error("you can't push null or undefined here");++c;var m=new r(g);f?(f.next=m,m.pre=f,f=m):d=f=m},this.popBack=function(){f&&(c>0&&--c,f&&(d===f?d=f=void 0:(f=f.pre)&&(f.next=void 0)))},this.setElementByPos=function(g,m){if(m==null)throw new Error("you can't set null or undefined here");if(g<0||g>=c)throw new Error("pos must more then 0 and less then the list length");for(var y=d;g--;){if(!y)throw new Error("unknown error");y=y.next}y&&(y.value=m)},this.insert=function(g,m,y){if(y===void 0&&(y=1),m==null)throw new Error("you can't insert null or undefined here");if(g<0||g>c)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(y<0)throw new Error("insert size must more than 0");if(g===0)for(;y--;)this.pushFront(m);else if(g===c)for(;y--;)this.pushBack(m);else{for(var p=d,x=1;x<g;++x){if(!(p!=null&&p.next))throw new Error("unknown error");p=p==null?void 0:p.next}if(!p)throw new Error("unknown error");var _=p.next;for(c+=y;y--;)p.next=new r(m),p.next.pre=p,p=p.next;p.next=_,_&&(_.pre=p)}},this.find=function(g){for(var m=d;m;){if(m.value===g)return!0;m=m.next}return!1},this.reverse=function(){for(var g=d,m=f,y=0;g&&m&&2*y<c;){var p=g.value;g.value=m.value,m.value=p,g=g.next,m=m.pre,++y}},this.unique=function(){for(var g=d;g;){for(var m=g;m&&m.next&&m.value===m.next.value;)m=m.next,c>0&&--c;g.next=m.next,g.next&&(g.next.pre=g),g=g.next}},this.sort=function(g){var m=[];this.forEach(function(p){m.push(p)}),m.sort(g);var y=d;m.forEach(function(p){y&&(y.value=p,y=y.next)})},this.pushFront=function(g){if(g==null)throw new Error("you can't push null or undefined here");++c;var m=new r(g);d?(m.next=d,d.pre=m,d=m):d=f=m},this.popFront=function(){d&&(c>0&&--c,d&&(d===f?d=f=void 0:(d=d.next)&&(d.pre=void 0)))},this.merge=function(g){var m=this,y=d;g.forEach(function(p){for(;y&&y.value!==void 0&&y.value<=p;)y=y.next;if(y===void 0)m.pushBack(p),y=f;else if(y===d)m.pushFront(p),y=d;else{++c;var x=y.pre;x&&(x.next=new r(p),x.next.pre=x,x.next.next=y,y&&(y.pre=x.next))}})},this[Symbol.iterator]=function(){return function(){var g;return n(this,function(m){switch(m.label){case 0:g=d,m.label=1;case 1:if(g===void 0)return[3,3];if(!g.value)throw new Error("unknown error");return[4,g.value];case 2:return m.sent(),g=g.next,[3,1];case 3:return[2]}})}()},l.forEach(function(g){return u.pushBack(g)}),Object.freeze(this)}Object.freeze(o),s.default=o},{}],30:[function(i,a,s){var n=this&&this.__generator||function(u,c){var d,f,g,m,y={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(_){return function(b){if(d)throw new TypeError("Generator is already executing.");for(;y;)try{if(d=1,f&&(g=2&b[0]?f.return:b[0]?f.throw||((g=f.return)&&g.call(f),0):f.next)&&!(g=g.call(f,b[1])).done)return g;switch(f=0,g&&(b=[2&b[0],g.value]),b[0]){case 0:case 1:g=b;break;case 4:return y.label++,{value:b[1],done:!1};case 5:y.label++,f=b[1],b=[0];continue;case 7:b=y.ops.pop(),y.trys.pop();continue;default:if(!(g=(g=y.trys).length>0&&g[g.length-1])&&(b[0]===6||b[0]===2)){y=0;continue}if(b[0]===3&&(!g||b[1]>g[0]&&b[1]<g[3])){y.label=b[1];break}if(b[0]===6&&y.label<g[1]){y.label=g[1],g=b;break}if(g&&y.label<g[2]){y.label=g[2],y.ops.push(b);break}g[2]&&y.ops.pop(),y.trys.pop();continue}b=c.call(u,y)}catch(C){b=[6,C],f=0}finally{d=g=0}if(5&b[0])throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}([x,_])}}},r=this&&this.__values||function(u){var c=typeof Symbol=="function"&&Symbol.iterator,d=c&&u[c],f=0;if(d)return d.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&f>=u.length&&(u=void 0),{value:u&&u[f++],done:!u}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var o=i("../Base/TreeNode");function l(u,c){var d=this;u===void 0&&(u=[]),c=c||function(F,R){return F<R?-1:F>R?1:0};var f=0,g=new o.default;g.color=o.default.TreeNodeColorType.black,this.size=function(){return f},this.empty=function(){return f===0},this.clear=function(){f=0,g.key=g.value=void 0,g.leftChild=g.rightChild=g.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},y=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.rightChild?y(F.rightChild):F};this.front=function(){if(!this.empty()){var F=m(g);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=y(g);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,T,L=0;try{for(var $=r(this),Z=$.next();!Z.done;Z=$.next())F(Z.value,L++)}catch(at){R={error:at}}finally{try{Z&&!Z.done&&(T=$.return)&&T.call($)}finally{if(R)throw R.error}}},this.getElementByPos=function(F){var R,T;if(F<0||F>=this.size())throw new Error("pos must more than 0 and less than set's size");var L=0;try{for(var $=r(this),Z=$.next();!Z.done;Z=$.next()){var at=Z.value;if(L===F)return at;++L}}catch(q){R={error:q}}finally{try{Z&&!Z.done&&(T=$.return)&&T.call($)}finally{if(R)throw R.error}}throw new Error("unknown Error")};var p=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0){var T=c(F.key,R);return T===0?{key:F.key,value:F.value}:T<0?p(F.rightChild,R):p(F.leftChild,R)||{key:F.key,value:F.value}}};this.lowerBound=function(F){return p(g,F)};var x=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0)return c(F.key,R)<=0?x(F.rightChild,R):x(F.leftChild,R)||{key:F.key,value:F.value}};this.upperBound=function(F){return x(g,F)};var _=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0){var T=c(F.key,R);return T===0?{key:F.key,value:F.value}:T>0?_(F.leftChild,R):_(F.rightChild,R)||{key:F.key,value:F.value}}};this.reverseLowerBound=function(F){return _(g,F)};var b=function(F,R){if(F&&F.key!==void 0&&F.value!==void 0)return c(F.key,R)>=0?b(F.leftChild,R):b(F.rightChild,R)||{key:F.key,value:F.value}};this.reverseUpperBound=function(F){return b(g,F)};var C=function(F){var R=F.parent;if(!R){if(F===g)return;throw new Error("unknown error")}if(F.color!==o.default.TreeNodeColorType.red){var T=F.brother;if(!T)throw new Error("unknown error");if(F===R.leftChild)if(T.color===o.default.TreeNodeColorType.red){T.color=o.default.TreeNodeColorType.black,R.color=o.default.TreeNodeColorType.red;var L=R.rotateLeft();g===R&&(g=L),C(F)}else T.color===o.default.TreeNodeColorType.black&&(T.rightChild&&T.rightChild.color===o.default.TreeNodeColorType.red?(T.color=R.color,R.color=o.default.TreeNodeColorType.black,T.rightChild&&(T.rightChild.color=o.default.TreeNodeColorType.black),L=R.rotateLeft(),g===R&&(g=L),F.color=o.default.TreeNodeColorType.black):T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||!T.leftChild||T.leftChild.color!==o.default.TreeNodeColorType.red?T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||(T.color=o.default.TreeNodeColorType.red,C(R)):(T.color=o.default.TreeNodeColorType.red,T.leftChild&&(T.leftChild.color=o.default.TreeNodeColorType.black),L=T.rotateRight(),g===T&&(g=L),C(F)));else F===R.rightChild&&(T.color===o.default.TreeNodeColorType.red?(T.color=o.default.TreeNodeColorType.black,R.color=o.default.TreeNodeColorType.red,L=R.rotateRight(),g===R&&(g=L),C(F)):T.color===o.default.TreeNodeColorType.black&&(T.leftChild&&T.leftChild.color===o.default.TreeNodeColorType.red?(T.color=R.color,R.color=o.default.TreeNodeColorType.black,T.leftChild&&(T.leftChild.color=o.default.TreeNodeColorType.black),L=R.rotateRight(),g===R&&(g=L),F.color=o.default.TreeNodeColorType.black):T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||!T.rightChild||T.rightChild.color!==o.default.TreeNodeColorType.red?T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||(T.color=o.default.TreeNodeColorType.red,C(R)):(T.color=o.default.TreeNodeColorType.red,T.rightChild&&(T.rightChild.color=o.default.TreeNodeColorType.black),L=T.rotateLeft(),g===T&&(g=L),C(F))))}else F.color=o.default.TreeNodeColorType.black},P=function(F){for(var R=F;R.leftChild||R.rightChild;){if(R.rightChild){R=m(R.rightChild);var T=F.key;F.key=R.key,R.key=T;var L=F.value;F.value=R.value,R.value=L,F=R}R.leftChild&&(R=y(R.leftChild),T=F.key,F.key=R.key,R.key=T,L=F.value,F.value=R.value,R.value=L,F=R)}C(R),R&&R.remove(),--f,g.color=o.default.TreeNodeColorType.black},S=function(F,R){return!(!F||F.key===void 0)&&(!!S(F.leftChild,R)||!!R(F)||S(F.rightChild,R))};this.eraseElementByPos=function(F){if(F<0||F>=f)throw new Error("pos must more than 0 and less than set's size");var R=0;S(g,function(T){return F===R?(P(T),!0):(++R,!1)})},this.eraseElementByKey=function(F){if(!this.empty()){var R=V(g,F);R!==void 0&&R.key!==void 0&&c(R.key,F)===0&&P(R)}};var B=function(F,R){if(!F||F.key===void 0)throw new Error("unknown error");var T=c(R,F.key);return T<0?F.leftChild?B(F.leftChild,R):(F.leftChild=new o.default,F.leftChild.parent=F,F.leftChild.brother=F.rightChild,F.rightChild&&(F.rightChild.brother=F.leftChild),F.leftChild):T>0?F.rightChild?B(F.rightChild,R):(F.rightChild=new o.default,F.rightChild.parent=F,F.rightChild.brother=F.leftChild,F.leftChild&&(F.leftChild.brother=F.rightChild),F.rightChild):F},D=function(F){var R=F.parent;if(!R){if(F===g)return;throw new Error("unknown error")}if(R.color!==o.default.TreeNodeColorType.black&&R.color===o.default.TreeNodeColorType.red){var T=R.brother,L=R.parent;if(!L)throw new Error("unknown error");if(T&&T.color===o.default.TreeNodeColorType.red)T.color=R.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red,D(L);else if(!T||T.color===o.default.TreeNodeColorType.black)if(R===L.leftChild)if(F===R.leftChild){R.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red;var $=L.rotateRight();L===g&&(g=$)}else F===R.rightChild&&($=R.rotateLeft(),L===g&&(g=$),D(R));else R===L.rightChild&&(F===R.leftChild?($=R.rotateRight(),L===g&&(g=$),D(R)):F===R.rightChild&&(R.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red,$=L.rotateLeft(),L===g&&(g=$)))}};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++f,g.key=F,g.value=R,void(g.color=o.default.TreeNodeColorType.black);var T=B(g,F);T.key===void 0||c(T.key,F)!==0?(++f,T.key=F,T.value=R,D(T),g.color=o.default.TreeNodeColorType.black):T.value=R}else this.eraseElementByKey(F)};var V=function(F,R){if(F&&F.key!==void 0){var T=c(R,F.key);return T<0?V(F.leftChild,R):T>0?V(F.rightChild,R):F}};this.find=function(F){return!!V(g,F)},this.getElementByKey=function(F){var R=V(g,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(T){var L=T.key,$=T.value;return R.setElement(L,$)})},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(g)};var G=function(F){return n(this,function(R){switch(R.label){case 0:return F&&F.key!==void 0&&F.value!==void 0?[5,r(G(F.leftChild))]:[2];case 1:return R.sent(),[4,{key:F.key,value:F.value}];case 2:return R.sent(),[5,r(G(F.rightChild))];case 3:return R.sent(),[2]}})};this[Symbol.iterator]=function(){return G(g)},u.forEach(function(F){var R=F.key,T=F.value;return d.setElement(R,T)}),Object.freeze(this)}Object.freeze(l),s.default=l},{"../Base/TreeNode":25}],31:[function(i,a,s){function n(r,o){r===void 0&&(r=[]),o=o||function(f,g){return f>g?-1:f<g?1:0};var l=[];r.forEach(function(f){return l.push(f)});var u=l.length,c=function(f,g){if(f<0||f>=u)throw new Error("unknown error");if(g<0||g>=u)throw new Error("unknown error");var m=l[f];l[f]=l[g],l[g]=m},d=function(f){if(f<0||f>=u)throw new Error("unknown error");var g=2*f+1,m=2*f+2;g<u&&o(l[f],l[g])>0&&c(f,g),m<u&&o(l[f],l[m])>0&&c(f,m)};(function(){for(var f=Math.floor((u-1)/2);f>=0;--f)for(var g=f,m=2*g+1;m<u;){var y=m+1,p=m;if(y<u&&o(l[m],l[y])>0&&(p=y),o(l[g],l[p])<=0)break;c(g,p),m=2*(g=p)+1}})(),this.size=function(){return u},this.empty=function(){return u===0},this.clear=function(){u=0,l.length=0},this.push=function(f){if(l.push(f),++u!==1)for(var g=u-1;g>0;){var m=Math.floor((g-1)/2);if(o(l[m],f)<=0)break;d(m),g=m}},this.pop=function(){if(!this.empty())if(this.size()!==1){var f=l[u-1];--u;for(var g=0;g<this.size();){var m=2*g+1,y=2*g+2;if(m>=this.size())break;var p=m;if(y<this.size()&&o(l[m],l[y])>0&&(p=y),o(l[p],f)>=0)break;l[g]=l[p],g=p}l[g]=f}else--u},this.top=function(){return l[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(o){o===void 0&&(o=[]);var l=new n.default(o);this.size=function(){return l.size()},this.empty=function(){return l.empty()},this.clear=function(){l.clear()},this.push=function(u){l.pushBack(u)},this.pop=function(){l.popFront()},this.front=function(){return l.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 d,f,g,m,y={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(_){return function(b){if(d)throw new TypeError("Generator is already executing.");for(;y;)try{if(d=1,f&&(g=2&b[0]?f.return:b[0]?f.throw||((g=f.return)&&g.call(f),0):f.next)&&!(g=g.call(f,b[1])).done)return g;switch(f=0,g&&(b=[2&b[0],g.value]),b[0]){case 0:case 1:g=b;break;case 4:return y.label++,{value:b[1],done:!1};case 5:y.label++,f=b[1],b=[0];continue;case 7:b=y.ops.pop(),y.trys.pop();continue;default:if(!(g=(g=y.trys).length>0&&g[g.length-1])&&(b[0]===6||b[0]===2)){y=0;continue}if(b[0]===3&&(!g||b[1]>g[0]&&b[1]<g[3])){y.label=b[1];break}if(b[0]===6&&y.label<g[1]){y.label=g[1],g=b;break}if(g&&y.label<g[2]){y.label=g[2],y.ops.push(b);break}g[2]&&y.ops.pop(),y.trys.pop();continue}b=c.call(u,y)}catch(C){b=[6,C],f=0}finally{d=g=0}if(5&b[0])throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}([x,_])}}},r=this&&this.__values||function(u){var c=typeof Symbol=="function"&&Symbol.iterator,d=c&&u[c],f=0;if(d)return d.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&f>=u.length&&(u=void 0),{value:u&&u[f++],done:!u}}};throw new TypeError(c?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(s,"__esModule",{value:!0});var o=i("../Base/TreeNode");function l(u,c){var d=this;u===void 0&&(u=[]),c=c||function(F,R){return F<R?-1:F>R?1:0};var f=0,g=new o.default;g.color=o.default.TreeNodeColorType.black,this.size=function(){return f},this.empty=function(){return f===0},this.clear=function(){f=0,g.key=void 0,g.leftChild=g.rightChild=g.brother=g.parent=void 0,g.color=o.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},y=function(F){if(!F||F.key===void 0)throw new Error("unknown error");return F.rightChild?y(F.rightChild):F};this.front=function(){if(!this.empty())return m(g).key},this.back=function(){if(!this.empty())return y(g).key},this.forEach=function(F){var R,T,L=0;try{for(var $=r(this),Z=$.next();!Z.done;Z=$.next())F(Z.value,L++)}catch(at){R={error:at}}finally{try{Z&&!Z.done&&(T=$.return)&&T.call($)}finally{if(R)throw R.error}}},this.getElementByPos=function(F){var R,T;if(F<0||F>=this.size())throw new Error("pos must more than 0 and less than set's size");var L=0;try{for(var $=r(this),Z=$.next();!Z.done;Z=$.next()){var at=Z.value;if(L===F)return at;++L}}catch(q){R={error:q}}finally{try{Z&&!Z.done&&(T=$.return)&&T.call($)}finally{if(R)throw R.error}}throw new Error("unknown error")};var p=function(F){var R=F.parent;if(!R){if(F===g)return;throw new Error("unknown error")}if(F.color!==o.default.TreeNodeColorType.red){var T=F.brother;if(!T)throw new Error("unknown error");if(F===R.leftChild)if(T.color===o.default.TreeNodeColorType.red){T.color=o.default.TreeNodeColorType.black,R.color=o.default.TreeNodeColorType.red;var L=R.rotateLeft();g===R&&(g=L),p(F)}else T.color===o.default.TreeNodeColorType.black&&(T.rightChild&&T.rightChild.color===o.default.TreeNodeColorType.red?(T.color=R.color,R.color=o.default.TreeNodeColorType.black,T.rightChild&&(T.rightChild.color=o.default.TreeNodeColorType.black),L=R.rotateLeft(),g===R&&(g=L),F.color=o.default.TreeNodeColorType.black):T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||!T.leftChild||T.leftChild.color!==o.default.TreeNodeColorType.red?T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||(T.color=o.default.TreeNodeColorType.red,p(R)):(T.color=o.default.TreeNodeColorType.red,T.leftChild&&(T.leftChild.color=o.default.TreeNodeColorType.black),L=T.rotateRight(),g===T&&(g=L),p(F)));else F===R.rightChild&&(T.color===o.default.TreeNodeColorType.red?(T.color=o.default.TreeNodeColorType.black,R.color=o.default.TreeNodeColorType.red,L=R.rotateRight(),g===R&&(g=L),p(F)):T.color===o.default.TreeNodeColorType.black&&(T.leftChild&&T.leftChild.color===o.default.TreeNodeColorType.red?(T.color=R.color,R.color=o.default.TreeNodeColorType.black,T.leftChild&&(T.leftChild.color=o.default.TreeNodeColorType.black),L=R.rotateRight(),g===R&&(g=L),F.color=o.default.TreeNodeColorType.black):T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||!T.rightChild||T.rightChild.color!==o.default.TreeNodeColorType.red?T.leftChild&&T.leftChild.color!==o.default.TreeNodeColorType.black||T.rightChild&&T.rightChild.color!==o.default.TreeNodeColorType.black||(T.color=o.default.TreeNodeColorType.red,p(R)):(T.color=o.default.TreeNodeColorType.red,T.rightChild&&(T.rightChild.color=o.default.TreeNodeColorType.black),L=T.rotateLeft(),g===T&&(g=L),p(F))))}else F.color=o.default.TreeNodeColorType.black},x=function(F){for(var R=F;R.leftChild||R.rightChild;){if(R.rightChild){R=m(R.rightChild);var T=F.key;F.key=R.key,R.key=T,F=R}R.leftChild&&(R=y(R.leftChild),T=F.key,F.key=R.key,R.key=T,F=R)}p(R),R&&R.remove(),--f,g.color=o.default.TreeNodeColorType.black},_=function(F,R){return!(!F||F.key===void 0)&&(!!_(F.leftChild,R)||!!R(F)||_(F.rightChild,R))};this.eraseElementByPos=function(F){if(F<0||F>=f)throw new Error("pos must more than 0 and less than set's size");var R=0;_(g,function(T){return F===R?(x(T),!0):(++R,!1)})},this.eraseElementByValue=function(F){if(!this.empty()){var R=P(g,F);R!==void 0&&R.key!==void 0&&c(R.key,F)===0&&x(R)}};var b=function(F,R){if(!F||F.key===void 0)throw new Error("unknown error");var T=c(R,F.key);return T<0?F.leftChild?b(F.leftChild,R):(F.leftChild=new o.default,F.leftChild.parent=F,F.leftChild.brother=F.rightChild,F.rightChild&&(F.rightChild.brother=F.leftChild),F.leftChild):T>0?F.rightChild?b(F.rightChild,R):(F.rightChild=new o.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===g)return;throw new Error("unknown error")}if(R.color!==o.default.TreeNodeColorType.black&&R.color===o.default.TreeNodeColorType.red){var T=R.brother,L=R.parent;if(!L)throw new Error("unknown error");if(T&&T.color===o.default.TreeNodeColorType.red)T.color=R.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red,C(L);else if(!T||T.color===o.default.TreeNodeColorType.black)if(R===L.leftChild)if(F===R.leftChild){R.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red;var $=L.rotateRight();L===g&&(g=$)}else F===R.rightChild&&($=R.rotateLeft(),L===g&&(g=$),C(R));else R===L.rightChild&&(F===R.leftChild?($=R.rotateRight(),L===g&&(g=$),C(R)):F===R.rightChild&&(R.color=o.default.TreeNodeColorType.black,L.color=o.default.TreeNodeColorType.red,$=L.rotateLeft(),L===g&&(g=$)))}};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++f,g.key=F,void(g.color=o.default.TreeNodeColorType.black);var R=b(g,F);R.key!==void 0&&c(R.key,F)===0||(++f,R.key=F,C(R),g.color=o.default.TreeNodeColorType.black)};var P=function(F,R){if(F&&F.key!==void 0){var T=c(R,F.key);return T<0?P(F.leftChild,R):T>0?P(F.rightChild,R):F}};this.find=function(F){var R=P(g,F);return R!==void 0&&R.key!==void 0&&c(R.key,F)===0};var S=function(F,R){if(F&&F.key!==void 0){var T=c(F.key,R);if(T===0)return F.key;if(T<0)return S(F.rightChild,R);var L=S(F.leftChild,R);return L!==void 0?L:F.key}};this.lowerBound=function(F){return S(g,F)};var B=function(F,R){if(F&&F.key!==void 0){if(c(F.key,R)<=0)return B(F.rightChild,R);var T=B(F.leftChild,R);return T!==void 0?T:F.key}};this.upperBound=function(F){return B(g,F)};var D=function(F,R){if(F&&F.key!==void 0){var T=c(F.key,R);if(T===0)return F.key;if(T>0)return D(F.leftChild,R);var L=D(F.rightChild,R);return L!==void 0?L:F.key}};this.reverseLowerBound=function(F){return D(g,F)};var V=function(F,R){if(F&&F.key!==void 0){if(c(F.key,R)>=0)return V(F.leftChild,R);var T=V(F.rightChild,R);return T!==void 0?T:F.key}};this.reverseUpperBound=function(F){return V(g,F)},this.union=function(F){var R=this;F.forEach(function(T){return R.insert(T)})},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(g)};var G=function(F){return n(this,function(R){switch(R.label){case 0:return F&&F.key!==void 0?[5,r(G(F.leftChild))]:[2];case 1:return R.sent(),[4,F.key];case 2:return R.sent(),[5,r(G(F.rightChild))];case 3:return R.sent(),[2]}})};this[Symbol.iterator]=function(){return G(g)},u.forEach(function(F){return d.insert(F)}),Object.freeze(this)}Object.freeze(l),s.default=l},{"../Base/TreeNode":25}],34:[function(i,a,s){function n(r){var o=this;r===void 0&&(r=[]);var l=0,u=[];this.size=function(){return l},this.empty=function(){return l===0},this.clear=function(){l=0,u.length=0},this.push=function(c){u.push(c),++l},this.pop=function(){u.pop(),l>0&&--l},this.top=function(){return u[l-1]},r.forEach(function(c){return o.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,d){var f,g,m,y,p={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return y={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function x(_){return function(b){return function(C){if(f)throw new TypeError("Generator is already executing.");for(;p;)try{if(f=1,g&&(m=2&C[0]?g.return:C[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,C[1])).done)return m;switch(g=0,m&&(C=[2&C[0],m.value]),C[0]){case 0:case 1:m=C;break;case 4:return p.label++,{value:C[1],done:!1};case 5:p.label++,g=C[1],C=[0];continue;case 7:C=p.ops.pop(),p.trys.pop();continue;default:if(!(m=(m=p.trys).length>0&&m[m.length-1])&&(C[0]===6||C[0]===2)){p=0;continue}if(C[0]===3&&(!m||C[1]>m[0]&&C[1]<m[3])){p.label=C[1];break}if(C[0]===6&&p.label<m[1]){p.label=m[1],m=C;break}if(m&&p.label<m[2]){p.label=m[2],p.ops.push(C);break}m[2]&&p.ops.pop(),p.trys.pop();continue}C=d.call(c,p)}catch(P){C=[6,P],g=0}finally{f=m=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([_,b])}}},r=this&&this.__read||function(c,d){var f=typeof Symbol=="function"&&c[Symbol.iterator];if(!f)return c;var g,m,y=f.call(c),p=[];try{for(;(d===void 0||d-- >0)&&!(g=y.next()).done;)p.push(g.value)}catch(x){m={error:x}}finally{try{g&&!g.done&&(f=y.return)&&f.call(y)}finally{if(m)throw m.error}}return p},o=this&&this.__spreadArray||function(c,d,f){if(f||arguments.length===2)for(var g,m=0,y=d.length;m<y;m++)!g&&m in d||(g||(g=Array.prototype.slice.call(d,0,m)),g[m]=d[m]);return c.concat(g||Array.prototype.slice.call(d))},l=this&&this.__values||function(c){var d=typeof Symbol=="function"&&Symbol.iterator,f=d&&c[d],g=0;if(f)return f.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&g>=c.length&&(c=void 0),{value:c&&c[g++],done:!c}}};throw new TypeError(d?"Object is not iterable.":"Symbol.iterator is not defined.")};function u(c){var d=this;c===void 0&&(c=[]);var f=0,g=[];this.size=function(){return f},this.empty=function(){return f===0},this.clear=function(){f=0,g.length=0},this.front=function(){if(!this.empty())return g[0]},this.back=function(){if(!this.empty())return g[f-1]},this.forEach=function(m){g.forEach(m)},this.getElementByPos=function(m){if(m<0||m>=f)throw new Error("pos must more than 0 and less than vector's size");return g[m]},this.eraseElementByPos=function(m){if(m<0||m>=f)throw new Error("pos must more than 0 and less than vector's size");for(var y=m;y<f-1;++y)g[y]=g[y+1];this.popBack()},this.eraseElementByValue=function(m){var y=[];this.forEach(function(x){x!==m&&y.push(x)}),y.forEach(function(x,_){g[_]=x});for(var p=y.length;f>p;)this.popBack()},this.pushBack=function(m){g.push(m),++f},this.popBack=function(){g.pop(),f>0&&--f},this.setElementByPos=function(m,y){if(m<0||m>=f)throw new Error("pos must more than 0 and less than vector's size");g[m]=y},this.insert=function(m,y,p){if(p===void 0&&(p=1),m<0||m>f)throw new Error("pos must more than 0 and less than or equal to vector's size");g.splice.apply(g,o([m,0],r(new Array(p).fill(y)),!1)),f+=p},this.find=function(m){return g.includes(m)},this.reverse=function(){g.reverse()},this.unique=function(){var m,y=[];this.forEach(function(x,_){_!==0&&x===m||(y.push(x),m=x)}),y.forEach(function(x,_){g[_]=x});for(var p=y.length;f>p;)this.popBack()},this.sort=function(m){g.sort(m)},this[Symbol.iterator]=function(){return function(){return n(this,function(m){switch(m.label){case 0:return[5,l(g)];case 1:return[2,m.sent()]}})}()},c.forEach(function(m){return d.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 o=i("./Queue/Queue");s.Queue=o.default;var l=i("./LinkList/LinkList");s.LinkList=l.default;var u=i("./Deque/Deque");s.Deque=u.default;var c=i("./PriorityQueue/PriorityQueue");s.PriorityQueue=c.default;var d=i("./Set/Set");s.Set=d.default;var f=i("./Map/Map");s.Map=f.default;var g=i("./HashSet/HashSet");s.HashSet=g.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"),o=Symbol("length"),l=Symbol("lengthCalculator"),u=Symbol("allowStale"),c=Symbol("maxAge"),d=Symbol("dispose"),f=Symbol("noDisposeOnSet"),g=Symbol("lruList"),m=Symbol("cache"),y=Symbol("updateAgeOnGet"),p=()=>1,x=(B,D,V)=>{const G=B[m].get(D);if(G){const F=G.value;if(_(B,F)){if(C(B,G),!B[u])return}else V&&(B[y]&&(G.value.now=Date.now()),B[g].unshiftNode(G));return F.value}},_=(B,D)=>{if(!D||!D.maxAge&&!B[c])return!1;const V=Date.now()-D.now;return D.maxAge?V>D.maxAge:B[c]&&V>B[c]},b=B=>{if(B[o]>B[r])for(let D=B[g].tail;B[o]>B[r]&&D!==null;){const V=D.prev;C(B,D),D=V}},C=(B,D)=>{if(D){const V=D.value;B[d]&&B[d](V.key,V.value),B[o]-=V.length,B[m].delete(V.key),B[g].removeNode(D)}};class P{constructor(D,V,G,F,R){this.key=D,this.value=V,this.length=G,this.now=F,this.maxAge=R||0}}const S=(B,D,V,G)=>{let F=V.value;_(B,F)&&(C(B,V),B[u]||(F=void 0)),F&&D.call(G,F.value,F.key,B)};a.exports=class{constructor(B){if(typeof B=="number"&&(B={max:B}),B||(B={}),B.max&&(typeof B.max!="number"||B.max<0))throw new TypeError("max must be a non-negative number");this[r]=B.max||1/0;const D=B.length||p;if(this[l]=typeof D!="function"?p:D,this[u]=B.stale||!1,B.maxAge&&typeof B.maxAge!="number")throw new TypeError("maxAge must be a number");this[c]=B.maxAge||0,this[d]=B.dispose,this[f]=B.noDisposeOnSet||!1,this[y]=B.updateAgeOnGet||!1,this.reset()}set max(B){if(typeof B!="number"||B<0)throw new TypeError("max must be a non-negative number");this[r]=B||1/0,b(this)}get max(){return this[r]}set allowStale(B){this[u]=!!B}get allowStale(){return this[u]}set maxAge(B){if(typeof B!="number")throw new TypeError("maxAge must be a non-negative number");this[c]=B,b(this)}get maxAge(){return this[c]}set lengthCalculator(B){typeof B!="function"&&(B=p),B!==this[l]&&(this[l]=B,this[o]=0,this[g].forEach(D=>{D.length=this[l](D.value,D.key),this[o]+=D.length})),b(this)}get lengthCalculator(){return this[l]}get length(){return this[o]}get itemCount(){return this[g].length}rforEach(B,D){D=D||this;for(let V=this[g].tail;V!==null;){const G=V.prev;S(this,B,V,D),V=G}}forEach(B,D){D=D||this;for(let V=this[g].head;V!==null;){const G=V.next;S(this,B,V,D),V=G}}keys(){return this[g].toArray().map(B=>B.key)}values(){return this[g].toArray().map(B=>B.value)}reset(){this[d]&&this[g]&&this[g].length&&this[g].forEach(B=>this[d](B.key,B.value)),this[m]=new Map,this[g]=new n,this[o]=0}dump(){return this[g].map(B=>!_(this,B)&&{k:B.key,v:B.value,e:B.now+(B.maxAge||0)}).toArray().filter(B=>B)}dumpLru(){return this[g]}set(B,D,V){if((V=V||this[c])&&typeof V!="number")throw new TypeError("maxAge must be a number");const G=V?Date.now():0,F=this[l](D,B);if(this[m].has(B)){if(F>this[r])return C(this,this[m].get(B)),!1;const T=this[m].get(B).value;return this[d]&&(this[f]||this[d](B,T.value)),T.now=G,T.maxAge=V,T.value=D,this[o]+=F-T.length,T.length=F,this.get(B),b(this),!0}const R=new P(B,D,F,G,V);return R.length>this[r]?(this[d]&&this[d](B,D),!1):(this[o]+=R.length,this[g].unshift(R),this[m].set(B,this[g].head),b(this),!0)}has(B){if(!this[m].has(B))return!1;const D=this[m].get(B).value;return!_(this,D)}get(B){return x(this,B,!0)}peek(B){return x(this,B,!1)}pop(){const B=this[g].tail;return B?(C(this,B),B.value):null}del(B){C(this,this[m].get(B))}load(B){this.reset();const D=Date.now();for(let V=B.length-1;V>=0;V--){const G=B[V],F=G.e||0;if(F===0)this.set(G.k,G.v);else{const R=F-D;R>0&&this.set(G.k,G.v,R)}}}prune(){this[m].forEach((B,D)=>x(this,D,!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 l in r.types){const u=r.types[l];r.codes[u]=l}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<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=n.from([r.codes.connect<<r.CMD_SHIFT]),r.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},r.propertiesCodes={};for(const l in r.properties){const u=r.properties[l];r.propertiesCodes[u]=l}function o(l){return[0,1,2].map(u=>[0,1].map(c=>[0,1].map(d=>{const f=n.alloc(1);return f.writeUInt8(r.codes[l]<<r.CMD_SHIFT|(c?r.DUP_MASK:0)|u<<r.QOS_SHIFT|d,0,!0),f})))}r.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},r.PUBLISH_HEADER=o("publish"),r.SUBSCRIBE_HEADER=o("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=o("unsubscribe"),r.ACKS={unsuback:o("unsuback"),puback:o("puback"),pubcomp:o("pubcomp"),pubrel:o("pubrel"),pubrec:o("pubrec")},r.SUBACK_HEADER=n.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=n.from([3]),r.VERSION4=n.from([4]),r.VERSION5=n.from([5]),r.VERSION131=n.from([131]),r.VERSION132=n.from([132]),r.QOS=[0,1,2].map(l=>n.from([l])),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"),o=i("events");class l extends o{constructor(){super(),this._array=new Array(20),this._i=0}write(c){return this._array[this._i++]=c,!0}concat(){let c=0;const d=new Array(this._array.length),f=this._array;let g,m=0;for(g=0;g<f.length&&f[g]!==void 0;g++)typeof f[g]!="string"?d[g]=f[g].length:d[g]=n.byteLength(f[g]),c+=d[g];const y=n.allocUnsafe(c);for(g=0;g<f.length&&f[g]!==void 0;g++)typeof f[g]!="string"?(f[g].copy(y,m),m+=d[g]):(y.write(f[g],m),m+=d[g]);return y}}a.exports=function(u,c){const d=new l;return r(u,d,c),d.concat()}}).call(this)}).call(this,i("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(i,a,s){s.parser=i("./parser").parser,s.generate=i("./generate"),s.writeToStream=i("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(i,a,s){(function(n){(function(){const o={},l=n.isBuffer(n.from([1,2]).subarray(0,1));function u(c){const d=n.allocUnsafe(2);return d.writeUInt8(c>>8,0),d.writeUInt8(255&c,1),d}a.exports={cache:o,generateCache:function(){for(let c=0;c<65536;c++)o[c]=u(c)},generateNumber:u,genBufVariableByteInt:function(c){let d=0,f=0;const g=n.allocUnsafe(4);do d=c%128|0,(c=c/128|0)>0&&(d|=128),g.writeUInt8(d,f++);while(c>0&&f<4);return c>0&&(f=0),l?g.subarray(0,f):g.slice(0,f)},generate4ByteBuffer:function(c){const d=n.allocUnsafe(4);return d.writeUInt32BE(c,0),d}}}).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"),o=i("./packet"),l=i("./constants"),u=i("debug")("mqtt-packet:parser");class c extends r{constructor(){super(),this.parser=this.constructor.parser}static parser(f){return this instanceof c?(this.settings=f||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new c().parser(f)}_resetState(){u("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=n(),this._stateCounter=0}parse(f){for(this.error&&this._resetState(),this._list.append(f),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 f=this._list.readUInt8(0);return this.packet.cmd=l.types[f>>l.CMD_SHIFT],this.packet.retain=(f&l.RETAIN_MASK)!=0,this.packet.qos=f>>l.QOS_SHIFT&l.QOS_MASK,this.packet.dup=(f&l.DUP_MASK)!=0,u("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const f=this._parseVarByteNum(!0);return f&&(this.packet.length=f.value,this._list.consume(f.bytes)),u("_parseLength %d",f.value),!!f}_parsePayload(){u("_parsePayload: payload %O",this._list);let f=!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"))}f=!0}return u("_parsePayload complete result: %s",f),f}_parseConnect(){let f,g,m,y;u("_parseConnect");const p={},x=this.packet,_=this._parseString();if(_===null)return this._emitError(new Error("Cannot parse protocolId"));if(_!=="MQTT"&&_!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(x.protocolId=_,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(x.protocolVersion=this._list.readUInt8(this._pos),x.protocolVersion>=128&&(x.bridgeMode=!0,x.protocolVersion=x.protocolVersion-128),x.protocolVersion!==3&&x.protocolVersion!==4&&x.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(p.username=this._list.readUInt8(this._pos)&l.USERNAME_MASK,p.password=this._list.readUInt8(this._pos)&l.PASSWORD_MASK,p.will=this._list.readUInt8(this._pos)&l.WILL_FLAG_MASK,p.will&&(x.will={},x.will.retain=(this._list.readUInt8(this._pos)&l.WILL_RETAIN_MASK)!=0,x.will.qos=(this._list.readUInt8(this._pos)&l.WILL_QOS_MASK)>>l.WILL_QOS_SHIFT),x.clean=(this._list.readUInt8(this._pos)&l.CLEAN_SESSION_MASK)!=0,this._pos++,x.keepalive=this._parseNum(),x.keepalive===-1)return this._emitError(new Error("Packet too short"));if(x.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(x.properties=C)}const b=this._parseString();if(b===null)return this._emitError(new Error("Packet too short"));if(x.clientId=b,u("_parseConnect: packet.clientId: %s",x.clientId),p.will){if(x.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(x.will.properties=C)}if((f=this._parseString())===null)return this._emitError(new Error("Cannot parse will topic"));if(x.will.topic=f,u("_parseConnect: packet.will.topic: %s",x.will.topic),(g=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse will payload"));x.will.payload=g,u("_parseConnect: packet.will.paylaod: %s",x.will.payload)}if(p.username){if((y=this._parseString())===null)return this._emitError(new Error("Cannot parse username"));x.username=y,u("_parseConnect: packet.username: %s",x.username)}if(p.password){if((m=this._parseBuffer())===null)return this._emitError(new Error("Cannot parse password"));x.password=m}return this.settings=x,u("_parseConnect: complete"),x}_parseConnack(){u("_parseConnack");const f=this.packet;if(this._list.length<1)return null;if(f.sessionPresent=!!(this._list.readUInt8(this._pos++)&l.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?f.reasonCode=this._list.readUInt8(this._pos++):f.reasonCode=0;else{if(this._list.length<2)return null;f.returnCode=this._list.readUInt8(this._pos++)}if(f.returnCode===-1||f.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}u("_parseConnack: complete")}_parsePublish(){u("_parsePublish");const f=this.packet;if(f.topic=this._parseString(),f.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(f.qos>0)||this._parseMessageId()){if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}f.payload=this._list.slice(this._pos,f.length),u("_parsePublish: payload from buffer list: %o",f.payload)}}_parseSubscribe(){u("_parseSubscribe");const f=this.packet;let g,m,y,p,x,_,b;if(f.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(f.subscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const C=this._parseProperties();Object.getOwnPropertyNames(C).length&&(f.properties=C)}for(;this._pos<f.length;){if((g=this._parseString())===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=f.length)return this._emitError(new Error("Malformed Subscribe Payload"));y=(m=this._parseByte())&l.SUBSCRIBE_OPTIONS_QOS_MASK,_=(m>>l.SUBSCRIBE_OPTIONS_NL_SHIFT&l.SUBSCRIBE_OPTIONS_NL_MASK)!=0,x=(m>>l.SUBSCRIBE_OPTIONS_RAP_SHIFT&l.SUBSCRIBE_OPTIONS_RAP_MASK)!=0,p=m>>l.SUBSCRIBE_OPTIONS_RH_SHIFT&l.SUBSCRIBE_OPTIONS_RH_MASK,b={topic:g,qos:y},this.settings.protocolVersion===5?(b.nl=_,b.rap=x,b.rh=p):this.settings.bridgeMode&&(b.rh=0,b.rap=!0,b.nl=!0),u("_parseSubscribe: push subscription `%s` to subscription",b),f.subscriptions.push(b)}}}_parseSuback(){u("_parseSuback");const f=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){u("_parseUnsubscribe");const f=this.packet;if(f.unsubscriptions=[],this._parseMessageId()){if(this.settings.protocolVersion===5){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}for(;this._pos<f.length;){const g=this._parseString();if(g===null)return this._emitError(new Error("Cannot parse topic"));u("_parseUnsubscribe: push topic `%s` to unsubscriptions",g),f.unsubscriptions.push(g)}}}_parseUnsuback(){u("_parseUnsuback");const f=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const g=this._parseProperties();for(Object.getOwnPropertyNames(g).length&&(f.properties=g),f.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){u("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const f=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(f.length>2?(f.reasonCode=this._parseByte(),u("_parseConfirmation: packet.reasonCode `%d`",f.reasonCode)):f.reasonCode=0,f.length>3)){const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}return!0}_parseDisconnect(){const f=this.packet;if(u("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?f.reasonCode=this._parseByte():f.reasonCode=0;const g=this._parseProperties();Object.getOwnPropertyNames(g).length&&(f.properties=g)}return u("_parseDisconnect result: true"),!0}_parseAuth(){u("_parseAuth");const f=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));f.reasonCode=this._parseByte();const g=this._parseProperties();return Object.getOwnPropertyNames(g).length&&(f.properties=g),u("_parseAuth: result: true"),!0}_parseMessageId(){const f=this.packet;return f.messageId=this._parseNum(),f.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(u("_parseMessageId: packet.messageId %d",f.messageId),!0)}_parseString(f){const g=this._parseNum(),m=g+this._pos;if(g===-1||m>this._list.length||m>this.packet.length)return null;const y=this._list.toString("utf8",this._pos,m);return this._pos+=g,u("_parseString: result: %s",y),y}_parseStringPair(){return u("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const f=this._parseNum(),g=f+this._pos;if(f===-1||g>this._list.length||g>this.packet.length)return null;const m=this._list.slice(this._pos,g);return this._pos+=f,u("_parseBuffer: result: %o",m),m}_parseNum(){if(this._list.length-this._pos<2)return-1;const f=this._list.readUInt16BE(this._pos);return this._pos+=2,u("_parseNum: result: %s",f),f}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const f=this._list.readUInt32BE(this._pos);return this._pos+=4,u("_parse4ByteNum: result: %s",f),f}_parseVarByteNum(f){u("_parseVarByteNum");let g,m=0,y=1,p=0,x=!1;const _=this._pos?this._pos:0;for(;m<4&&_+m<this._list.length;){if(p+=y*((g=this._list.readUInt8(_+m++))&l.VARBYTEINT_MASK),y*=128,(g&l.VARBYTEINT_FIN_MASK)==0){x=!0;break}if(this._list.length<=m)break}return!x&&m===4&&this._list.length>=m&&this._emitError(new Error("Invalid variable byte integer")),_&&(this._pos+=m),u("_parseVarByteNum: result: %o",x=!!x&&(f?{bytes:m,value:p}:p)),x}_parseByte(){let f;return this._pos<this._list.length&&(f=this._list.readUInt8(this._pos),this._pos++),u("_parseByte: result: %o",f),f}_parseByType(f){switch(u("_parseByType: type: %s",f),f){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){u("_parseProperties");const f=this._parseVarByteNum(),g=this._pos+f,m={};for(;this._pos<g;){const y=this._parseByte();if(!y)return this._emitError(new Error("Cannot parse property code type")),!1;const p=l.propertiesCodes[y];if(!p)return this._emitError(new Error("Unknown property")),!1;if(p!=="userProperties")m[p]?Array.isArray(m[p])?m[p].push(this._parseByType(l.propertiesTypes[p])):(m[p]=[m[p]],m[p].push(this._parseByType(l.propertiesTypes[p]))):m[p]=this._parseByType(l.propertiesTypes[p]);else{m[p]||(m[p]=Object.create(null));const x=this._parseByType(l.propertiesTypes[p]);if(m[p][x.name])if(Array.isArray(m[p][x.name]))m[p][x.name].push(x.value);else{const _=m[p][x.name];m[p][x.name]=[_],m[p][x.name].push(x.value)}else m[p][x.name]=x.value}}return m}_newPacket(){return u("_newPacket"),this.packet&&(this._list.consume(this.packet.length),u("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),u("_newPacket: new packet"),this.packet=new o,this._pos=0,!0}_emitError(f){u("_emitError"),this.error=f,this.emit("error",f)}}a.exports=c},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(i,a,s){(function(n){(function(){const r=i("./constants"),o=n.allocUnsafe(0),l=n.from([0]),u=i("./numbers"),c=i("process-nextick-args").nextTick,d=i("debug")("mqtt-packet:writeToStream"),f=u.cache,g=u.generateNumber,m=u.generateCache,y=u.genBufVariableByteInt,p=u.generate4ByteBuffer;let x=V,_=!0;function b(q,W,j){switch(d("generate called"),W.cork&&(W.cork(),c(C,W)),_&&(_=!1,m()),d("generate: packet.cmd: %s",q.cmd),q.cmd){case"connect":return function(K,U,tt){const st=K||{},it=st.protocolId||"MQTT";let ht=st.protocolVersion||4;const lt=st.will;let ut=st.clean;const E=st.keepalive||0,A=st.clientId||"",I=st.username,N=st.password,X=st.properties;ut===void 0&&(ut=!0);let J=0;if(!it||typeof it!="string"&&!n.isBuffer(it))return U.emit("error",new Error("Invalid protocolId")),!1;if(J+=it.length+2,ht!==3&&ht!==4&&ht!==5)return U.emit("error",new Error("Invalid protocol version")),!1;if(J+=1,(typeof A=="string"||n.isBuffer(A))&&(A||ht>=4)&&(A||ut))J+=n.byteLength(A)+2;else{if(ht<4)return U.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*ut==0)return U.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof E!="number"||E<0||E>65535||E%1!=0)return U.emit("error",new Error("Invalid keepalive")),!1;if(J+=2,J+=1,ht===5){var rt=R(U,X);if(!rt)return!1;J+=rt.length}if(lt){if(typeof lt!="object")return U.emit("error",new Error("Invalid will")),!1;if(!lt.topic||typeof lt.topic!="string")return U.emit("error",new Error("Invalid will topic")),!1;if(J+=n.byteLength(lt.topic)+2,J+=2,lt.payload){if(!(lt.payload.length>=0))return U.emit("error",new Error("Invalid will payload")),!1;typeof lt.payload=="string"?J+=n.byteLength(lt.payload):J+=lt.payload.length}var yt={};if(ht===5){if(!(yt=R(U,lt.properties)))return!1;J+=yt.length}}let mt=!1;if(I!=null){if(!at(I))return U.emit("error",new Error("Invalid username")),!1;mt=!0,J+=n.byteLength(I)+2}if(N!=null){if(!mt)return U.emit("error",new Error("Username is required to use password")),!1;if(!at(N))return U.emit("error",new Error("Invalid password")),!1;J+=Z(N)+2}U.write(r.CONNECT_HEADER),S(U,J),F(U,it),st.bridgeMode&&(ht+=128),U.write(ht===131?r.VERSION131:ht===132?r.VERSION132:ht===4?r.VERSION4:ht===5?r.VERSION5:r.VERSION3);let Et=0;return Et|=I!=null?r.USERNAME_MASK:0,Et|=N!=null?r.PASSWORD_MASK:0,Et|=lt&&lt.retain?r.WILL_RETAIN_MASK:0,Et|=lt&&lt.qos?lt.qos<<r.WILL_QOS_SHIFT:0,Et|=lt?r.WILL_FLAG_MASK:0,Et|=ut?r.CLEAN_SESSION_MASK:0,U.write(n.from([Et])),x(U,E),ht===5&&rt.write(),F(U,A),lt&&(ht===5&&yt.write(),B(U,lt.topic),F(U,lt.payload)),I!=null&&F(U,I),N!=null&&F(U,N),!0}(q,W);case"connack":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ht=st===5?it.reasonCode:it.returnCode,lt=it.properties;let ut=2;if(typeof ht!="number")return U.emit("error",new Error("Invalid return code")),!1;let E=null;if(st===5){if(!(E=R(U,lt)))return!1;ut+=E.length}return U.write(r.CONNACK_HEADER),S(U,ut),U.write(it.sessionPresent?r.SESSIONPRESENT_HEADER:l),U.write(n.from([ht])),E!=null&&E.write(),!0}(q,W,j);case"publish":return function(K,U,tt){d("publish: packet: %o",K);const st=tt?tt.protocolVersion:4,it=K||{},ht=it.qos||0,lt=it.retain?r.RETAIN_MASK:0,ut=it.topic,E=it.payload||o,A=it.messageId,I=it.properties;let N=0;if(typeof ut=="string")N+=n.byteLength(ut)+2;else{if(!n.isBuffer(ut))return U.emit("error",new Error("Invalid topic")),!1;N+=ut.length+2}if(n.isBuffer(E)?N+=E.length:N+=n.byteLength(E),ht&&typeof A!="number")return U.emit("error",new Error("Invalid messageId")),!1;ht&&(N+=2);let X=null;if(st===5){if(!(X=R(U,I)))return!1;N+=X.length}return U.write(r.PUBLISH_HEADER[ht][it.dup?1:0][lt?1:0]),S(U,N),x(U,Z(ut)),U.write(ut),ht>0&&x(U,A),X!=null&&X.write(),d("publish: payload: %o",E),U.write(E)}(q,W,j);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ht=it.cmd||"puback",lt=it.messageId,ut=it.dup&&ht==="pubrel"?r.DUP_MASK:0;let E=0;const A=it.reasonCode,I=it.properties;let N=st===5?3:2;if(ht==="pubrel"&&(E=1),typeof lt!="number")return U.emit("error",new Error("Invalid messageId")),!1;let X=null;if(st===5&&typeof I=="object"){if(!(X=T(U,I,tt,N)))return!1;N+=X.length}return U.write(r.ACKS[ht][E][ut][0]),S(U,N),x(U,lt),st===5&&U.write(n.from([A])),X!==null&&X.write(),!0}(q,W,j);case"subscribe":return function(K,U,tt){d("subscribe: packet: ");const st=tt?tt.protocolVersion:4,it=K||{},ht=it.dup?r.DUP_MASK:0,lt=it.messageId,ut=it.subscriptions,E=it.properties;let A=0;if(typeof lt!="number")return U.emit("error",new Error("Invalid messageId")),!1;A+=2;let I=null;if(st===5){if(!(I=R(U,E)))return!1;A+=I.length}if(typeof ut!="object"||!ut.length)return U.emit("error",new Error("Invalid subscriptions")),!1;for(let X=0;X<ut.length;X+=1){const J=ut[X].topic,rt=ut[X].qos;if(typeof J!="string")return U.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof rt!="number")return U.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(st===5){if(typeof(ut[X].nl||!1)!="boolean")return U.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(ut[X].rap||!1)!="boolean")return U.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const Et=ut[X].rh||0;if(typeof Et!="number"||Et>2)return U.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}A+=n.byteLength(J)+2+1}d("subscribe: writing to stream: %o",r.SUBSCRIBE_HEADER),U.write(r.SUBSCRIBE_HEADER[1][ht?1:0][0]),S(U,A),x(U,lt),I!==null&&I.write();let N=!0;for(const X of ut){const J=X.topic,rt=X.qos,yt=+X.nl,mt=+X.rap,Et=X.rh;let Ft;B(U,J),Ft=r.SUBSCRIBE_OPTIONS_QOS[rt],st===5&&(Ft|=yt?r.SUBSCRIBE_OPTIONS_NL:0,Ft|=mt?r.SUBSCRIBE_OPTIONS_RAP:0,Ft|=Et?r.SUBSCRIBE_OPTIONS_RH[Et]:0),N=U.write(n.from([Ft]))}return N}(q,W,j);case"suback":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ht=it.messageId,lt=it.granted,ut=it.properties;let E=0;if(typeof ht!="number")return U.emit("error",new Error("Invalid messageId")),!1;if(E+=2,typeof lt!="object"||!lt.length)return U.emit("error",new Error("Invalid qos vector")),!1;for(let I=0;I<lt.length;I+=1){if(typeof lt[I]!="number")return U.emit("error",new Error("Invalid qos vector")),!1;E+=1}let A=null;if(st===5){if(!(A=T(U,ut,tt,E)))return!1;E+=A.length}return U.write(r.SUBACK_HEADER),S(U,E),x(U,ht),A!==null&&A.write(),U.write(n.from(lt))}(q,W,j);case"unsubscribe":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ht=it.messageId,lt=it.dup?r.DUP_MASK:0,ut=it.unsubscriptions,E=it.properties;let A=0;if(typeof ht!="number")return U.emit("error",new Error("Invalid messageId")),!1;if(A+=2,typeof ut!="object"||!ut.length)return U.emit("error",new Error("Invalid unsubscriptions")),!1;for(let X=0;X<ut.length;X+=1){if(typeof ut[X]!="string")return U.emit("error",new Error("Invalid unsubscriptions")),!1;A+=n.byteLength(ut[X])+2}let I=null;if(st===5){if(!(I=R(U,E)))return!1;A+=I.length}U.write(r.UNSUBSCRIBE_HEADER[1][lt?1:0][0]),S(U,A),x(U,ht),I!==null&&I.write();let N=!0;for(let X=0;X<ut.length;X++)N=B(U,ut[X]);return N}(q,W,j);case"unsuback":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ht=it.messageId,lt=it.dup?r.DUP_MASK:0,ut=it.granted,E=it.properties,A=it.cmd;let I=2;if(typeof ht!="number")return U.emit("error",new Error("Invalid messageId")),!1;if(st===5){if(typeof ut!="object"||!ut.length)return U.emit("error",new Error("Invalid qos vector")),!1;for(let X=0;X<ut.length;X+=1){if(typeof ut[X]!="number")return U.emit("error",new Error("Invalid qos vector")),!1;I+=1}}let N=null;if(st===5){if(!(N=T(U,E,tt,I)))return!1;I+=N.length}return U.write(r.ACKS[A][0][lt][0]),S(U,I),x(U,ht),N!==null&&N.write(),st===5&&U.write(n.from(ut)),!0}(q,W,j);case"pingreq":case"pingresp":return function(K,U,tt){return U.write(r.EMPTY[K.cmd])}(q,W);case"disconnect":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ht=it.reasonCode,lt=it.properties;let ut=st===5?1:0,E=null;if(st===5){if(!(E=T(U,lt,tt,ut)))return!1;ut+=E.length}return U.write(n.from([r.codes.disconnect<<4])),S(U,ut),st===5&&U.write(n.from([ht])),E!==null&&E.write(),!0}(q,W,j);case"auth":return function(K,U,tt){const st=tt?tt.protocolVersion:4,it=K||{},ht=it.reasonCode,lt=it.properties;let ut=st===5?1:0;st!==5&&U.emit("error",new Error("Invalid mqtt version for auth packet"));const E=T(U,lt,tt,ut);return E?(ut+=E.length,U.write(n.from([r.codes.auth<<4])),S(U,ut),U.write(n.from([ht])),E!==null&&E.write(),!0):!1}(q,W,j);default:return W.emit("error",new Error("Unknown command")),!1}}function C(q){q.uncork()}Object.defineProperty(b,"cacheNumbers",{get:()=>x===V,set(q){q?(f&&Object.keys(f).length!==0||(_=!0),x=V):(_=!1,x=G)}});const P={};function S(q,W){if(W>r.VARBYTEINT_MAX)return q.emit("error",new Error(`Invalid variable byte integer: ${W}`)),!1;let j=P[W];return j||(j=y(W),W<16384&&(P[W]=j)),d("writeVarByteInt: writing to stream: %o",j),q.write(j)}function B(q,W){const j=n.byteLength(W);return x(q,j),d("writeString: %s",W),q.write(W,"utf8")}function D(q,W,j){B(q,W),B(q,j)}function V(q,W){return d("writeNumberCached: number: %d",W),d("writeNumberCached: %o",f[W]),q.write(f[W])}function G(q,W){const j=g(W);return d("writeNumberGenerated: %o",j),q.write(j)}function F(q,W){typeof W=="string"?B(q,W):W?(x(q,W.length),q.write(W)):x(q,0)}function R(q,W){if(typeof W!="object"||W.length!=null)return{length:1,write(){$(q,{},0)}};let j=0;function K(U,tt){let st=0;switch(r.propertiesTypes[U]){case"byte":if(typeof tt!="boolean")return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=2;break;case"int8":if(typeof tt!="number"||tt<0||tt>255)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=2;break;case"binary":if(tt&&tt===null)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=1+n.byteLength(tt)+2;break;case"int16":if(typeof tt!="number"||tt<0||tt>65535)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=3;break;case"int32":if(typeof tt!="number"||tt<0||tt>4294967295)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=5;break;case"var":if(typeof tt!="number"||tt<0||tt>268435455)return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=1+n.byteLength(y(tt));break;case"string":if(typeof tt!="string")return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=3+n.byteLength(tt.toString());break;case"pair":if(typeof tt!="object")return q.emit("error",new Error(`Invalid ${U}: ${tt}`)),!1;st+=Object.getOwnPropertyNames(tt).reduce((it,ht)=>{const lt=tt[ht];return Array.isArray(lt)?it+=lt.reduce((ut,E)=>ut+=3+n.byteLength(ht.toString())+2+n.byteLength(E.toString()),0):it+=3+n.byteLength(ht.toString())+2+n.byteLength(tt[ht].toString()),it},0);break;default:return q.emit("error",new Error(`Invalid property ${U}: ${tt}`)),!1}return st}if(W)for(const U in W){let tt=0,st=0;const it=W[U];if(Array.isArray(it))for(let ht=0;ht<it.length;ht++){if(!(st=K(U,it[ht])))return!1;tt+=st}else{if(!(st=K(U,it)))return!1;tt=st}if(!tt)return!1;j+=tt}return{length:n.byteLength(y(j))+j,write(){$(q,W,j)}}}function T(q,W,j,K){const U=["reasonString","userProperties"],tt=j&&j.properties&&j.properties.maximumPacketSize?j.properties.maximumPacketSize:0;let st=R(q,W);if(tt)for(;K+st.length>tt;){const it=U.shift();if(!it||!W[it])return!1;delete W[it],st=R(q,W)}return st}function L(q,W,j){switch(r.propertiesTypes[W]){case"byte":q.write(n.from([r.properties[W]])),q.write(n.from([+j]));break;case"int8":q.write(n.from([r.properties[W]])),q.write(n.from([j]));break;case"binary":q.write(n.from([r.properties[W]])),F(q,j);break;case"int16":q.write(n.from([r.properties[W]])),x(q,j);break;case"int32":q.write(n.from([r.properties[W]])),function(K,U){const tt=p(U);d("write4ByteNumber: %o",tt),K.write(tt)}(q,j);break;case"var":q.write(n.from([r.properties[W]])),S(q,j);break;case"string":q.write(n.from([r.properties[W]])),B(q,j);break;case"pair":Object.getOwnPropertyNames(j).forEach(K=>{const U=j[K];Array.isArray(U)?U.forEach(tt=>{q.write(n.from([r.properties[W]])),D(q,K.toString(),tt.toString())}):(q.write(n.from([r.properties[W]])),D(q,K.toString(),U.toString()))});break;default:return q.emit("error",new Error(`Invalid property ${W} value: ${j}`)),!1}}function $(q,W,j){S(q,j);for(const K in W)if(Object.prototype.hasOwnProperty.call(W,K)&&W[K]!==null){const U=W[K];if(Array.isArray(U))for(let tt=0;tt<U.length;tt++)L(q,K,U[tt]);else L(q,K,U)}}function Z(q){return q?q instanceof n?q.length:n.byteLength(q):0}function at(q){return typeof q=="string"||q instanceof n}a.exports=b}).call(this)}).call(this,i("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(i,a,s){var n=1e3,r=60*n,o=60*r,l=24*o,u=7*l,c=365.25*l;function d(f,g,m,y){var p=g>=1.5*m;return Math.round(f/m)+" "+y+(p?"s":"")}a.exports=function(f,g){g=g||{};var m=typeof f;if(m==="string"&&f.length>0)return function(y){if(!((y=String(y)).length>100)){var p=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(y);if(!!p){var x=parseFloat(p[1]);switch((p[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return x*c;case"weeks":case"week":case"w":return x*u;case"days":case"day":case"d":return x*l;case"hours":case"hour":case"hrs":case"hr":case"h":return x*o;case"minutes":case"minute":case"mins":case"min":case"m":return x*r;case"seconds":case"second":case"secs":case"sec":case"s":return x*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return x;default:return}}}}(f);if(m==="number"&&isFinite(f))return g.long?function(y){var p=Math.abs(y);return p>=l?d(y,p,l,"day"):p>=o?d(y,p,o,"hour"):p>=r?d(y,p,r,"minute"):p>=n?d(y,p,n,"second"):y+" ms"}(f):function(y){var p=Math.abs(y);return p>=l?Math.round(y/l)+"d":p>=o?Math.round(y/o)+"h":p>=r?Math.round(y/r)+"m":p>=n?Math.round(y/n)+"s":y+"ms"}(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))}},{}],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"),o=i("debug")("number-allocator:error");function l(c,d){this.low=c,this.high=d}function u(c,d){if(!(this instanceof u))return new u(c,d);this.min=c,this.max=d,this.ss=new n([],(f,g)=>f.compare(g)),r("Create"),this.clear()}l.prototype.equals=function(c){return this.low===c.low&&this.high===c.high},l.prototype.compare=function(c){return this.low<c.low&&this.high<c.low?-1:c.low<this.low&&c.high<this.low?1:0},u.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},u.prototype.alloc=function(){if(this.ss.size()===0)return r("alloc():empty"),null;const c=this.ss.front(),d=c.low;return d+1<=c.high?++c.low:this.ss.eraseElementByPos(0),r("alloc():"+d),d},u.prototype.use=function(c){const d=new l(c,c),f=this.ss.lowerBound(d);if(f){if(f.equals(d))return this.ss.eraseElementByValue(f),r("use():"+c),!0;if(f.low>c)return!1;if(f.low===c)return++f.low,r("use():"+c),!0;if(f.high===c)return--f.high,r("use():"+c),!0;const g=f.low;return f.low=c+1,this.ss.insert(new l(g,c-1)),r("use():"+c),!0}return r("use():failed"),!1},u.prototype.free=function(c){if(c<this.min||c>this.max)return void o("free():"+c+" is out of range");const d=new l(c,c),f=this.ss.lowerBound(d);if(f){if(f.low<=c&&c<=f.high)return void o("free():"+c+" has already been vacant");if(f===this.ss.front())c+1===f.low?--f.low:this.ss.insert(d);else{const g=this.ss.reverseLowerBound(d);g.high+1===c?c+1===f.low?(this.ss.eraseElementByValue(g),f.low=g.low):g.high=c:c+1===f.low?f.low=c:this.ss.insert(d)}}else{if(f===this.ss.front())return void this.ss.insert(d);const g=this.ss.reverseLowerBound(d);g.high+1===c?g.high=c:this.ss.insert(d)}r("free():"+c)},u.prototype.clear=function(){r("clear()"),this.ss.clear(),this.ss.insert(new l(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(l){var u=function(){return u.called?u.value:(u.called=!0,u.value=l.apply(this,arguments))};return u.called=!1,u}function o(l){var u=function(){if(u.called)throw new Error(u.onceError);return u.called=!0,u.value=l.apply(this,arguments)},c=l.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(o),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(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,o,l,u){if(typeof r!="function")throw new TypeError('"callback" argument must be a function');var c,d,f=arguments.length;switch(f){case 0:case 1:return n.nextTick(r);case 2:return n.nextTick(function(){r.call(null,o)});case 3:return n.nextTick(function(){r.call(null,o,l)});case 4:return n.nextTick(function(){r.call(null,o,l,u)});default:for(c=new Array(f-1),d=0;d<c.length;)c[d++]=arguments[d];return n.nextTick(function(){r.apply(null,c)})}}}:a.exports=n}).call(this)}).call(this,i("_process"))},{_process:50}],50:[function(i,a,s){var n,r,o=a.exports={};function l(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(b){if(n===setTimeout)return setTimeout(b,0);if((n===l||!n)&&setTimeout)return n=setTimeout,setTimeout(b,0);try{return n(b,0)}catch{try{return n.call(null,b,0)}catch{return n.call(this,b,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:l}catch{n=l}try{r=typeof clearTimeout=="function"?clearTimeout:u}catch{r=u}})();var d,f=[],g=!1,m=-1;function y(){g&&d&&(g=!1,d.length?f=d.concat(f):m=-1,f.length&&p())}function p(){if(!g){var b=c(y);g=!0;for(var C=f.length;C;){for(d=f,f=[];++m<C;)d&&d[m].run();m=-1,C=f.length}d=null,g=!1,function(P){if(r===clearTimeout)return clearTimeout(P);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(P);try{r(P)}catch{try{return r.call(null,P)}catch{return r.call(this,P)}}}(b)}}function x(b,C){this.fun=b,this.array=C}function _(){}o.nextTick=function(b){var C=new Array(arguments.length-1);if(arguments.length>1)for(var P=1;P<arguments.length;P++)C[P-1]=arguments[P];f.push(new x(b,C)),f.length!==1||g||c(p)},x.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=_,o.addListener=_,o.once=_,o.off=_,o.removeListener=_,o.removeAllListeners=_,o.emit=_,o.prependListener=_,o.prependOnceListener=_,o.listeners=function(b){return[]},o.binding=function(b){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(b){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],51:[function(i,a,s){(function(n){(function(){(function(r){var o=typeof s=="object"&&s&&!s.nodeType&&s,l=typeof a=="object"&&a&&!a.nodeType&&a,u=typeof n=="object"&&n;u.global!==u&&u.window!==u&&u.self!==u||(r=u);var c,d,f=2147483647,g=36,m=1,y=26,p=38,x=700,_=72,b=128,C="-",P=/^xn--/,S=/[^\x20-\x7E]/,B=/[\x2E\u3002\uFF0E\uFF61]/g,D={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},V=g-m,G=Math.floor,F=String.fromCharCode;function R(K){throw new RangeError(D[K])}function T(K,U){for(var tt=K.length,st=[];tt--;)st[tt]=U(K[tt]);return st}function L(K,U){var tt=K.split("@"),st="";return tt.length>1&&(st=tt[0]+"@",K=tt[1]),st+T((K=K.replace(B,".")).split("."),U).join(".")}function $(K){for(var U,tt,st=[],it=0,ht=K.length;it<ht;)(U=K.charCodeAt(it++))>=55296&&U<=56319&&it<ht?(64512&(tt=K.charCodeAt(it++)))==56320?st.push(((1023&U)<<10)+(1023&tt)+65536):(st.push(U),it--):st.push(U);return st}function Z(K){return T(K,function(U){var tt="";return U>65535&&(tt+=F((U-=65536)>>>10&1023|55296),U=56320|1023&U),tt+=F(U)}).join("")}function at(K,U){return K+22+75*(K<26)-((U!=0)<<5)}function q(K,U,tt){var st=0;for(K=tt?G(K/x):K>>1,K+=G(K/U);K>V*y>>1;st+=g)K=G(K/V);return G(st+(V+1)*K/(K+p))}function W(K){var U,tt,st,it,ht,lt,ut,E,A,I,N,X=[],J=K.length,rt=0,yt=b,mt=_;for((tt=K.lastIndexOf(C))<0&&(tt=0),st=0;st<tt;++st)K.charCodeAt(st)>=128&&R("not-basic"),X.push(K.charCodeAt(st));for(it=tt>0?tt+1:0;it<J;){for(ht=rt,lt=1,ut=g;it>=J&&R("invalid-input"),((E=(N=K.charCodeAt(it++))-48<10?N-22:N-65<26?N-65:N-97<26?N-97:g)>=g||E>G((f-rt)/lt))&&R("overflow"),rt+=E*lt,!(E<(A=ut<=mt?m:ut>=mt+y?y:ut-mt));ut+=g)lt>G(f/(I=g-A))&&R("overflow"),lt*=I;mt=q(rt-ht,U=X.length+1,ht==0),G(rt/U)>f-yt&&R("overflow"),yt+=G(rt/U),rt%=U,X.splice(rt++,0,yt)}return Z(X)}function j(K){var U,tt,st,it,ht,lt,ut,E,A,I,N,X,J,rt,yt,mt=[];for(X=(K=$(K)).length,U=b,tt=0,ht=_,lt=0;lt<X;++lt)(N=K[lt])<128&&mt.push(F(N));for(st=it=mt.length,it&&mt.push(C);st<X;){for(ut=f,lt=0;lt<X;++lt)(N=K[lt])>=U&&N<ut&&(ut=N);for(ut-U>G((f-tt)/(J=st+1))&&R("overflow"),tt+=(ut-U)*J,U=ut,lt=0;lt<X;++lt)if((N=K[lt])<U&&++tt>f&&R("overflow"),N==U){for(E=tt,A=g;!(E<(I=A<=ht?m:A>=ht+y?y:A-ht));A+=g)yt=E-I,rt=g-I,mt.push(F(at(I+yt%rt,0))),E=G(yt/rt);mt.push(F(at(E,0))),ht=q(tt,J,st==it),tt=0,++st}++tt,++U}return mt.join("")}if(c={version:"1.4.1",ucs2:{decode:$,encode:Z},decode:W,encode:j,toASCII:function(K){return L(K,function(U){return S.test(U)?"xn--"+j(U):U})},toUnicode:function(K){return L(K,function(U){return P.test(U)?W(U.slice(4).toLowerCase()):U})}},o&&l)if(a.exports==o)l.exports=c;else for(d in c)c.hasOwnProperty(d)&&(o[d]=c[d]);else r.punycode=c})(this)}).call(this)}).call(this,typeof Oe<"u"?Oe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(i,a,s){function n(o,l){return Object.prototype.hasOwnProperty.call(o,l)}a.exports=function(o,l,u,c){l=l||"&",u=u||"=";var d={};if(typeof o!="string"||o.length===0)return d;var f=/\+/g;o=o.split(l);var g=1e3;c&&typeof c.maxKeys=="number"&&(g=c.maxKeys);var m=o.length;g>0&&m>g&&(m=g);for(var y=0;y<m;++y){var p,x,_,b,C=o[y].replace(f,"%20"),P=C.indexOf(u);P>=0?(p=C.substr(0,P),x=C.substr(P+1)):(p=C,x=""),_=decodeURIComponent(p),b=decodeURIComponent(x),n(d,_)?r(d[_])?d[_].push(b):d[_]=[d[_],b]:d[_]=b}return d};var r=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[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,d,f){return c=c||"&",d=d||"=",u===null&&(u=void 0),typeof u=="object"?o(l(u),function(g){var m=encodeURIComponent(n(g))+d;return r(u[g])?o(u[g],function(y){return m+encodeURIComponent(n(y))}).join(c):m+encodeURIComponent(n(u[g]))}).join(c):f?encodeURIComponent(n(f))+d+encodeURIComponent(n(u)):""};var r=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"};function o(u,c){if(u.map)return u.map(c);for(var d=[],f=0;f<u.length;f++)d.push(c(u[f],f));return d}var l=Object.keys||function(u){var c=[];for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&c.push(d);return c}},{}],54:[function(i,a,s){s.decode=s.parse=i("./decode"),s.encode=s.stringify=i("./encode")},{"./decode":52,"./encode":53}],55:[function(i,a,s){var n={};function r(l,u,c){c||(c=Error);var d=function(f){var g,m;function y(p,x,_){return f.call(this,function(b,C,P){return typeof u=="string"?u:u(b,C,P)}(p,x,_))||this}return m=f,(g=y).prototype=Object.create(m.prototype),g.prototype.constructor=g,g.__proto__=m,y}(c);d.prototype.name=c.name,d.prototype.code=l,n[l]=d}function o(l,u){if(Array.isArray(l)){var c=l.length;return l=l.map(function(d){return String(d)}),c>2?"one of ".concat(u," ").concat(l.slice(0,c-1).join(", "),", or ")+l[c-1]:c===2?"one of ".concat(u," ").concat(l[0]," or ").concat(l[1]):"of ".concat(u," ").concat(l[0])}return"of ".concat(u," ").concat(String(l))}r("ERR_INVALID_OPT_VALUE",function(l,u){return'The value "'+u+'" is invalid for option "'+l+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(l,u,c){var d,f,g;if(typeof u=="string"&&(f="not ",u.substr(0,f.length)===f)?(d="must not be",u=u.replace(/^not /,"")):d="must be",function(y,p,x){return(x===void 0||x>y.length)&&(x=y.length),y.substring(x-p.length,x)===p}(l," argument"))g="The ".concat(l," ").concat(d," ").concat(o(u,"type"));else{var m=function(y,p,x){return typeof x!="number"&&(x=0),!(x+p.length>y.length)&&y.indexOf(p,x)!==-1}(l,".")?"property":"argument";g='The "'.concat(l,'" ').concat(m," ").concat(d," ").concat(o(u,"type"))}return g+=". Received type ".concat(typeof c)},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(l){return"The "+l+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(l){return"Cannot call "+l+" 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(l){return"Unknown encoding: "+l},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(y){var p=[];for(var x in y)p.push(x);return p};a.exports=f;var o=i("./_stream_readable"),l=i("./_stream_writable");i("inherits")(f,o);for(var u=r(l.prototype),c=0;c<u.length;c++){var d=u[c];f.prototype[d]||(f.prototype[d]=l.prototype[d])}function f(y){if(!(this instanceof f))return new f(y);o.call(this,y),l.call(this,y),this.allowHalfOpen=!0,y&&(y.readable===!1&&(this.readable=!1),y.writable===!1&&(this.writable=!1),y.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",g)))}function g(){this._writableState.ended||n.nextTick(m,this)}function m(y){y.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(f.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(f.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=y,this._writableState.destroyed=y)}})}).call(this)}).call(this,i("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(i,a,s){a.exports=r;var n=i("./_stream_transform");function r(o){if(!(this instanceof r))return new r(o);n.call(this,o)}i("inherits")(r,n),r.prototype._transform=function(o,l,u){u(null,o)}},{"./_stream_transform":59,inherits:24}],58:[function(i,a,s){(function(n,r){(function(){var o;a.exports=R,R.ReadableState=F,i("events").EventEmitter;var l=function(E,A){return E.listeners(A).length},u=i("./internal/streams/stream"),c=i("buffer").Buffer,d=r.Uint8Array||function(){},f,g=i("util");f=g&&g.debuglog?g.debuglog("stream"):function(){};var m,y,p,x=i("./internal/streams/buffer_list"),_=i("./internal/streams/destroy"),b=i("./internal/streams/state").getHighWaterMark,C=i("../errors").codes,P=C.ERR_INVALID_ARG_TYPE,S=C.ERR_STREAM_PUSH_AFTER_EOF,B=C.ERR_METHOD_NOT_IMPLEMENTED,D=C.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;i("inherits")(R,u);var V=_.errorOrDestroy,G=["error","close","destroy","pause","resume"];function F(E,A,I){o=o||i("./_stream_duplex"),E=E||{},typeof I!="boolean"&&(I=A instanceof o),this.objectMode=!!E.objectMode,I&&(this.objectMode=this.objectMode||!!E.readableObjectMode),this.highWaterMark=b(this,E,"readableHighWaterMark",I),this.buffer=new x,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=E.emitClose!==!1,this.autoDestroy=!!E.autoDestroy,this.destroyed=!1,this.defaultEncoding=E.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,E.encoding&&(m||(m=i("string_decoder/").StringDecoder),this.decoder=new m(E.encoding),this.encoding=E.encoding)}function R(E){if(o=o||i("./_stream_duplex"),!(this instanceof R))return new R(E);var A=this instanceof o;this._readableState=new F(E,this,A),this.readable=!0,E&&(typeof E.read=="function"&&(this._read=E.read),typeof E.destroy=="function"&&(this._destroy=E.destroy)),u.call(this)}function T(E,A,I,N,X){f("readableAddChunk",A);var J,rt=E._readableState;if(A===null)rt.reading=!1,function(yt,mt){if(f("onEofChunk"),!mt.ended){if(mt.decoder){var Et=mt.decoder.end();Et&&Et.length&&(mt.buffer.push(Et),mt.length+=mt.objectMode?1:Et.length)}mt.ended=!0,mt.sync?at(yt):(mt.needReadable=!1,mt.emittedReadable||(mt.emittedReadable=!0,q(yt)))}}(E,rt);else if(X||(J=function(yt,mt){var Et;Ft=mt,c.isBuffer(Ft)||Ft instanceof d||typeof mt=="string"||mt===void 0||yt.objectMode||(Et=new P("chunk",["string","Buffer","Uint8Array"],mt));var Ft;return Et}(rt,A)),J)V(E,J);else if(rt.objectMode||A&&A.length>0)if(typeof A=="string"||rt.objectMode||Object.getPrototypeOf(A)===c.prototype||(A=function(yt){return c.from(yt)}(A)),N)rt.endEmitted?V(E,new D):L(E,rt,A,!0);else if(rt.ended)V(E,new S);else{if(rt.destroyed)return!1;rt.reading=!1,rt.decoder&&!I?(A=rt.decoder.write(A),rt.objectMode||A.length!==0?L(E,rt,A,!1):W(E,rt)):L(E,rt,A,!1)}else N||(rt.reading=!1,W(E,rt));return!rt.ended&&(rt.length<rt.highWaterMark||rt.length===0)}function L(E,A,I,N){A.flowing&&A.length===0&&!A.sync?(A.awaitDrain=0,E.emit("data",I)):(A.length+=A.objectMode?1:I.length,N?A.buffer.unshift(I):A.buffer.push(I),A.needReadable&&at(E)),W(E,A)}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(E){this._readableState&&(this._readableState.destroyed=E)}}),R.prototype.destroy=_.destroy,R.prototype._undestroy=_.undestroy,R.prototype._destroy=function(E,A){A(E)},R.prototype.push=function(E,A){var I,N=this._readableState;return N.objectMode?I=!0:typeof E=="string"&&((A=A||N.defaultEncoding)!==N.encoding&&(E=c.from(E,A),A=""),I=!0),T(this,E,A,!1,I)},R.prototype.unshift=function(E){return T(this,E,null,!0,!1)},R.prototype.isPaused=function(){return this._readableState.flowing===!1},R.prototype.setEncoding=function(E){m||(m=i("string_decoder/").StringDecoder);var A=new m(E);this._readableState.decoder=A,this._readableState.encoding=this._readableState.decoder.encoding;for(var I=this._readableState.buffer.head,N="";I!==null;)N+=A.write(I.data),I=I.next;return this._readableState.buffer.clear(),N!==""&&this._readableState.buffer.push(N),this._readableState.length=N.length,this};var $=1073741824;function Z(E,A){return E<=0||A.length===0&&A.ended?0:A.objectMode?1:E!=E?A.flowing&&A.length?A.buffer.head.data.length:A.length:(E>A.highWaterMark&&(A.highWaterMark=function(I){return I>=$?I=$:(I--,I|=I>>>1,I|=I>>>2,I|=I>>>4,I|=I>>>8,I|=I>>>16,I++),I}(E)),E<=A.length?E:A.ended?A.length:(A.needReadable=!0,0))}function at(E){var A=E._readableState;f("emitReadable",A.needReadable,A.emittedReadable),A.needReadable=!1,A.emittedReadable||(f("emitReadable",A.flowing),A.emittedReadable=!0,n.nextTick(q,E))}function q(E){var A=E._readableState;f("emitReadable_",A.destroyed,A.length,A.ended),A.destroyed||!A.length&&!A.ended||(E.emit("readable"),A.emittedReadable=!1),A.needReadable=!A.flowing&&!A.ended&&A.length<=A.highWaterMark,st(E)}function W(E,A){A.readingMore||(A.readingMore=!0,n.nextTick(j,E,A))}function j(E,A){for(;!A.reading&&!A.ended&&(A.length<A.highWaterMark||A.flowing&&A.length===0);){var I=A.length;if(f("maybeReadMore read 0"),E.read(0),I===A.length)break}A.readingMore=!1}function K(E){var A=E._readableState;A.readableListening=E.listenerCount("readable")>0,A.resumeScheduled&&!A.paused?A.flowing=!0:E.listenerCount("data")>0&&E.resume()}function U(E){f("readable nexttick read 0"),E.read(0)}function tt(E,A){f("resume",A.reading),A.reading||E.read(0),A.resumeScheduled=!1,E.emit("resume"),st(E),A.flowing&&!A.reading&&E.read(0)}function st(E){var A=E._readableState;for(f("flow",A.flowing);A.flowing&&E.read()!==null;);}function it(E,A){return A.length===0?null:(A.objectMode?I=A.buffer.shift():!E||E>=A.length?(I=A.decoder?A.buffer.join(""):A.buffer.length===1?A.buffer.first():A.buffer.concat(A.length),A.buffer.clear()):I=A.buffer.consume(E,A.decoder),I);var I}function ht(E){var A=E._readableState;f("endReadable",A.endEmitted),A.endEmitted||(A.ended=!0,n.nextTick(lt,A,E))}function lt(E,A){if(f("endReadableNT",E.endEmitted,E.length),!E.endEmitted&&E.length===0&&(E.endEmitted=!0,A.readable=!1,A.emit("end"),E.autoDestroy)){var I=A._writableState;(!I||I.autoDestroy&&I.finished)&&A.destroy()}}function ut(E,A){for(var I=0,N=E.length;I<N;I++)if(E[I]===A)return I;return-1}R.prototype.read=function(E){f("read",E),E=parseInt(E,10);var A=this._readableState,I=E;if(E!==0&&(A.emittedReadable=!1),E===0&&A.needReadable&&((A.highWaterMark!==0?A.length>=A.highWaterMark:A.length>0)||A.ended))return f("read: emitReadable",A.length,A.ended),A.length===0&&A.ended?ht(this):at(this),null;if((E=Z(E,A))===0&&A.ended)return A.length===0&&ht(this),null;var N,X=A.needReadable;return f("need readable",X),(A.length===0||A.length-E<A.highWaterMark)&&f("length less than watermark",X=!0),A.ended||A.reading?f("reading or ended",X=!1):X&&(f("do read"),A.reading=!0,A.sync=!0,A.length===0&&(A.needReadable=!0),this._read(A.highWaterMark),A.sync=!1,A.reading||(E=Z(I,A))),(N=E>0?it(E,A):null)===null?(A.needReadable=A.length<=A.highWaterMark,E=0):(A.length-=E,A.awaitDrain=0),A.length===0&&(A.ended||(A.needReadable=!0),I!==E&&A.ended&&ht(this)),N!==null&&this.emit("data",N),N},R.prototype._read=function(E){V(this,new B("_read()"))},R.prototype.pipe=function(E,A){var I=this,N=this._readableState;switch(N.pipesCount){case 0:N.pipes=E;break;case 1:N.pipes=[N.pipes,E];break;default:N.pipes.push(E)}N.pipesCount+=1,f("pipe count=%d opts=%j",N.pipesCount,A);var X=(!A||A.end!==!1)&&E!==n.stdout&&E!==n.stderr?rt:oe;function J(Vt,Gt){f("onunpipe"),Vt===I&&Gt&&Gt.hasUnpiped===!1&&(Gt.hasUnpiped=!0,f("cleanup"),E.removeListener("close",Ge),E.removeListener("finish",we),E.removeListener("drain",yt),E.removeListener("error",Ft),E.removeListener("unpipe",J),I.removeListener("end",rt),I.removeListener("end",oe),I.removeListener("data",Et),mt=!0,!N.awaitDrain||E._writableState&&!E._writableState.needDrain||yt())}function rt(){f("onend"),E.end()}N.endEmitted?n.nextTick(X):I.once("end",X),E.on("unpipe",J);var yt=function(Vt){return function(){var Gt=Vt._readableState;f("pipeOnDrain",Gt.awaitDrain),Gt.awaitDrain&&Gt.awaitDrain--,Gt.awaitDrain===0&&l(Vt,"data")&&(Gt.flowing=!0,st(Vt))}}(I);E.on("drain",yt);var mt=!1;function Et(Vt){f("ondata");var Gt=E.write(Vt);f("dest.write",Gt),Gt===!1&&((N.pipesCount===1&&N.pipes===E||N.pipesCount>1&&ut(N.pipes,E)!==-1)&&!mt&&(f("false write response, pause",N.awaitDrain),N.awaitDrain++),I.pause())}function Ft(Vt){f("onerror",Vt),oe(),E.removeListener("error",Ft),l(E,"error")===0&&V(E,Vt)}function Ge(){E.removeListener("finish",we),oe()}function we(){f("onfinish"),E.removeListener("close",Ge),oe()}function oe(){f("unpipe"),I.unpipe(E)}return I.on("data",Et),function(Vt,Gt,ss){if(typeof Vt.prependListener=="function")return Vt.prependListener(Gt,ss);Vt._events&&Vt._events[Gt]?Array.isArray(Vt._events[Gt])?Vt._events[Gt].unshift(ss):Vt._events[Gt]=[ss,Vt._events[Gt]]:Vt.on(Gt,ss)}(E,"error",Ft),E.once("close",Ge),E.once("finish",we),E.emit("pipe",I),N.flowing||(f("pipe resume"),I.resume()),E},R.prototype.unpipe=function(E){var A=this._readableState,I={hasUnpiped:!1};if(A.pipesCount===0)return this;if(A.pipesCount===1)return E&&E!==A.pipes?this:(E||(E=A.pipes),A.pipes=null,A.pipesCount=0,A.flowing=!1,E&&E.emit("unpipe",this,I),this);if(!E){var N=A.pipes,X=A.pipesCount;A.pipes=null,A.pipesCount=0,A.flowing=!1;for(var J=0;J<X;J++)N[J].emit("unpipe",this,{hasUnpiped:!1});return this}var rt=ut(A.pipes,E);return rt===-1?this:(A.pipes.splice(rt,1),A.pipesCount-=1,A.pipesCount===1&&(A.pipes=A.pipes[0]),E.emit("unpipe",this,I),this)},R.prototype.on=function(E,A){var I=u.prototype.on.call(this,E,A),N=this._readableState;return E==="data"?(N.readableListening=this.listenerCount("readable")>0,N.flowing!==!1&&this.resume()):E==="readable"&&(N.endEmitted||N.readableListening||(N.readableListening=N.needReadable=!0,N.flowing=!1,N.emittedReadable=!1,f("on readable",N.length,N.reading),N.length?at(this):N.reading||n.nextTick(U,this))),I},R.prototype.addListener=R.prototype.on,R.prototype.removeListener=function(E,A){var I=u.prototype.removeListener.call(this,E,A);return E==="readable"&&n.nextTick(K,this),I},R.prototype.removeAllListeners=function(E){var A=u.prototype.removeAllListeners.apply(this,arguments);return E!=="readable"&&E!==void 0||n.nextTick(K,this),A},R.prototype.resume=function(){var E=this._readableState;return E.flowing||(f("resume"),E.flowing=!E.readableListening,function(A,I){I.resumeScheduled||(I.resumeScheduled=!0,n.nextTick(tt,A,I))}(this,E)),E.paused=!1,this},R.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},R.prototype.wrap=function(E){var A=this,I=this._readableState,N=!1;for(var X in E.on("end",function(){if(f("wrapped end"),I.decoder&&!I.ended){var rt=I.decoder.end();rt&&rt.length&&A.push(rt)}A.push(null)}),E.on("data",function(rt){f("wrapped data"),I.decoder&&(rt=I.decoder.write(rt)),(!I.objectMode||rt!=null)&&(I.objectMode||rt&&rt.length)&&(A.push(rt)||(N=!0,E.pause()))}),E)this[X]===void 0&&typeof E[X]=="function"&&(this[X]=function(rt){return function(){return E[rt].apply(E,arguments)}}(X));for(var J=0;J<G.length;J++)E.on(G[J],this.emit.bind(this,G[J]));return this._read=function(rt){f("wrapped _read",rt),N&&(N=!1,E.resume())},this},typeof Symbol=="function"&&(R.prototype[Symbol.asyncIterator]=function(){return y===void 0&&(y=i("./internal/streams/async_iterator")),y(this)}),Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(R.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(R.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(E){this._readableState&&(this._readableState.flowing=E)}}),R._fromList=it,Object.defineProperty(R.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(R.from=function(E,A){return p===void 0&&(p=i("./internal/streams/from")),p(R,E,A)})}).call(this)}).call(this,i("_process"),typeof Oe<"u"?Oe:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(i,a,s){a.exports=d;var n=i("../errors").codes,r=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,l=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,u=n.ERR_TRANSFORM_WITH_LENGTH_0,c=i("./_stream_duplex");function d(m){if(!(this instanceof d))return new d(m);c.call(this,m),this._transformState={afterTransform:function(y,p){var x=this._transformState;x.transforming=!1;var _=x.writecb;if(_===null)return this.emit("error",new o);x.writechunk=null,x.writecb=null,p!=null&&this.push(p),_(y);var b=this._readableState;b.reading=!1,(b.needReadable||b.length<b.highWaterMark)&&this._read(b.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,m&&(typeof m.transform=="function"&&(this._transform=m.transform),typeof m.flush=="function"&&(this._flush=m.flush)),this.on("prefinish",f)}function f(){var m=this;typeof this._flush!="function"||this._readableState.destroyed?g(this,null,null):this._flush(function(y,p){g(m,y,p)})}function g(m,y,p){if(y)return m.emit("error",y);if(p!=null&&m.push(p),m._writableState.length)throw new u;if(m._transformState.transforming)throw new l;return m.push(null)}i("inherits")(d,c),d.prototype.push=function(m,y){return this._transformState.needTransform=!1,c.prototype.push.call(this,m,y)},d.prototype._transform=function(m,y,p){p(new r("_transform()"))},d.prototype._write=function(m,y,p){var x=this._transformState;if(x.writecb=p,x.writechunk=m,x.writeencoding=y,!x.transforming){var _=this._readableState;(x.needTransform||_.needReadable||_.length<_.highWaterMark)&&this._read(_.highWaterMark)}},d.prototype._read=function(m){var y=this._transformState;y.writechunk===null||y.transforming?y.needTransform=!0:(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform))},d.prototype._destroy=function(m,y){c.prototype._destroy.call(this,m,function(p){y(p)})}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(i,a,s){(function(n,r){(function(){function o(W){var j=this;this.next=null,this.entry=null,this.finish=function(){(function(K,U,tt){var st=K.entry;for(K.entry=null;st;){var it=st.callback;U.pendingcb--,it(tt),st=st.next}U.corkedRequestsFree.next=K})(j,W)}}var l;a.exports=R,R.WritableState=F;var u={deprecate:i("util-deprecate")},c=i("./internal/streams/stream"),d=i("buffer").Buffer,f=r.Uint8Array||function(){},g,m=i("./internal/streams/destroy"),y=i("./internal/streams/state").getHighWaterMark,p=i("../errors").codes,x=p.ERR_INVALID_ARG_TYPE,_=p.ERR_METHOD_NOT_IMPLEMENTED,b=p.ERR_MULTIPLE_CALLBACK,C=p.ERR_STREAM_CANNOT_PIPE,P=p.ERR_STREAM_DESTROYED,S=p.ERR_STREAM_NULL_VALUES,B=p.ERR_STREAM_WRITE_AFTER_END,D=p.ERR_UNKNOWN_ENCODING,V=m.errorOrDestroy;function G(){}function F(W,j,K){l=l||i("./_stream_duplex"),W=W||{},typeof K!="boolean"&&(K=j instanceof l),this.objectMode=!!W.objectMode,K&&(this.objectMode=this.objectMode||!!W.writableObjectMode),this.highWaterMark=y(this,W,"writableHighWaterMark",K),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var U=W.decodeStrings===!1;this.decodeStrings=!U,this.defaultEncoding=W.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(tt){(function(st,it){var ht=st._writableState,lt=ht.sync,ut=ht.writecb;if(typeof ut!="function")throw new b;if(function(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}(ht),it)(function(A,I,N,X,J){--I.pendingcb,N?(n.nextTick(J,X),n.nextTick(q,A,I),A._writableState.errorEmitted=!0,V(A,X)):(J(X),A._writableState.errorEmitted=!0,V(A,X),q(A,I))})(st,ht,lt,it,ut);else{var E=Z(ht)||st.destroyed;E||ht.corked||ht.bufferProcessing||!ht.bufferedRequest||$(st,ht),lt?n.nextTick(L,st,ht,E,ut):L(st,ht,E,ut)}})(j,tt)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=W.emitClose!==!1,this.autoDestroy=!!W.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function R(W){var j=this instanceof(l=l||i("./_stream_duplex"));if(!j&&!g.call(R,this))return new R(W);this._writableState=new F(W,this,j),this.writable=!0,W&&(typeof W.write=="function"&&(this._write=W.write),typeof W.writev=="function"&&(this._writev=W.writev),typeof W.destroy=="function"&&(this._destroy=W.destroy),typeof W.final=="function"&&(this._final=W.final)),c.call(this)}function T(W,j,K,U,tt,st,it){j.writelen=U,j.writecb=it,j.writing=!0,j.sync=!0,j.destroyed?j.onwrite(new P("write")):K?W._writev(tt,j.onwrite):W._write(tt,st,j.onwrite),j.sync=!1}function L(W,j,K,U){K||function(tt,st){st.length===0&&st.needDrain&&(st.needDrain=!1,tt.emit("drain"))}(W,j),j.pendingcb--,U(),q(W,j)}function $(W,j){j.bufferProcessing=!0;var K=j.bufferedRequest;if(W._writev&&K&&K.next){var U=j.bufferedRequestCount,tt=new Array(U),st=j.corkedRequestsFree;st.entry=K;for(var it=0,ht=!0;K;)tt[it]=K,K.isBuf||(ht=!1),K=K.next,it+=1;tt.allBuffers=ht,T(W,j,!0,j.length,tt,"",st.finish),j.pendingcb++,j.lastBufferedRequest=null,st.next?(j.corkedRequestsFree=st.next,st.next=null):j.corkedRequestsFree=new o(j),j.bufferedRequestCount=0}else{for(;K;){var lt=K.chunk,ut=K.encoding,E=K.callback;if(T(W,j,!1,j.objectMode?1:lt.length,lt,ut,E),K=K.next,j.bufferedRequestCount--,j.writing)break}K===null&&(j.lastBufferedRequest=null)}j.bufferedRequest=K,j.bufferProcessing=!1}function Z(W){return W.ending&&W.length===0&&W.bufferedRequest===null&&!W.finished&&!W.writing}function at(W,j){W._final(function(K){j.pendingcb--,K&&V(W,K),j.prefinished=!0,W.emit("prefinish"),q(W,j)})}function q(W,j){var K=Z(j);if(K&&(function(tt,st){st.prefinished||st.finalCalled||(typeof tt._final!="function"||st.destroyed?(st.prefinished=!0,tt.emit("prefinish")):(st.pendingcb++,st.finalCalled=!0,n.nextTick(at,tt,st)))}(W,j),j.pendingcb===0&&(j.finished=!0,W.emit("finish"),j.autoDestroy))){var U=W._readableState;(!U||U.autoDestroy&&U.endEmitted)&&W.destroy()}return K}i("inherits")(R,c),F.prototype.getBuffer=function(){for(var W=this.bufferedRequest,j=[];W;)j.push(W),W=W.next;return j},function(){try{Object.defineProperty(F.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(g=Function.prototype[Symbol.hasInstance],Object.defineProperty(R,Symbol.hasInstance,{value:function(W){return!!g.call(this,W)||this===R&&W&&W._writableState instanceof F}})):g=function(W){return W instanceof this},R.prototype.pipe=function(){V(this,new C)},R.prototype.write=function(W,j,K){var U,tt=this._writableState,st=!1,it=!tt.objectMode&&(U=W,d.isBuffer(U)||U instanceof f);return it&&!d.isBuffer(W)&&(W=function(ht){return d.from(ht)}(W)),typeof j=="function"&&(K=j,j=null),it?j="buffer":j||(j=tt.defaultEncoding),typeof K!="function"&&(K=G),tt.ending?function(ht,lt){var ut=new B;V(ht,ut),n.nextTick(lt,ut)}(this,K):(it||function(ht,lt,ut,E){var A;return ut===null?A=new S:typeof ut=="string"||lt.objectMode||(A=new x("chunk",["string","Buffer"],ut)),!A||(V(ht,A),n.nextTick(E,A),!1)}(this,tt,W,K))&&(tt.pendingcb++,st=function(ht,lt,ut,E,A,I){if(!ut){var N=function(yt,mt,Et){return yt.objectMode||yt.decodeStrings===!1||typeof mt!="string"||(mt=d.from(mt,Et)),mt}(lt,E,A);E!==N&&(ut=!0,A="buffer",E=N)}var X=lt.objectMode?1:E.length;lt.length+=X;var J=lt.length<lt.highWaterMark;if(J||(lt.needDrain=!0),lt.writing||lt.corked){var rt=lt.lastBufferedRequest;lt.lastBufferedRequest={chunk:E,encoding:A,isBuf:ut,callback:I,next:null},rt?rt.next=lt.lastBufferedRequest:lt.bufferedRequest=lt.lastBufferedRequest,lt.bufferedRequestCount+=1}else T(ht,lt,!1,X,E,A,I);return J}(this,tt,it,W,j,K)),st},R.prototype.cork=function(){this._writableState.corked++},R.prototype.uncork=function(){var W=this._writableState;W.corked&&(W.corked--,W.writing||W.corked||W.bufferProcessing||!W.bufferedRequest||$(this,W))},R.prototype.setDefaultEncoding=function(W){if(typeof W=="string"&&(W=W.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((W+"").toLowerCase())>-1))throw new D(W);return this._writableState.defaultEncoding=W,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(W,j,K){K(new _("_write()"))},R.prototype._writev=null,R.prototype.end=function(W,j,K){var U=this._writableState;return typeof W=="function"?(K=W,W=null,j=null):typeof j=="function"&&(K=j,j=null),W!=null&&this.write(W,j),U.corked&&(U.corked=1,this.uncork()),U.ending||function(tt,st,it){st.ending=!0,q(tt,st),it&&(st.finished?n.nextTick(it):tt.once("finish",it)),st.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(W){this._writableState&&(this._writableState.destroyed=W)}}),R.prototype.destroy=m.destroy,R.prototype._undestroy=m.undestroy,R.prototype._destroy=function(W,j){j(W)}}).call(this)}).call(this,i("_process"),typeof Oe<"u"?Oe: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 o(C,P,S){return P in C?Object.defineProperty(C,P,{value:S,enumerable:!0,configurable:!0,writable:!0}):C[P]=S,C}var l=i("./end-of-stream"),u=Symbol("lastResolve"),c=Symbol("lastReject"),d=Symbol("error"),f=Symbol("ended"),g=Symbol("lastPromise"),m=Symbol("handlePromise"),y=Symbol("stream");function p(C,P){return{value:C,done:P}}function x(C){var P=C[u];if(P!==null){var S=C[y].read();S!==null&&(C[g]=null,C[u]=null,C[c]=null,P(p(S,!1)))}}var _=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((o(r={get stream(){return this[y]},next:function(){var C=this,P=this[d];if(P!==null)return Promise.reject(P);if(this[f])return Promise.resolve(p(void 0,!0));if(this[y].destroyed)return new Promise(function(V,G){n.nextTick(function(){C[d]?G(C[d]):V(p(void 0,!0))})});var S,B=this[g];if(B)S=new Promise(function(V,G){return function(F,R){V.then(function(){G[f]?F(p(void 0,!0)):G[m](F,R)},R)}}(B,this));else{var D=this[y].read();if(D!==null)return Promise.resolve(p(D,!1));S=new Promise(this[m])}return this[g]=S,S}},Symbol.asyncIterator,function(){return this}),o(r,"return",function(){var C=this;return new Promise(function(P,S){C[y].destroy(null,function(B){B?S(B):P(p(void 0,!0))})})}),r),_);a.exports=function(C){var P,S=Object.create(b,(o(P={},y,{value:C,writable:!0}),o(P,u,{value:null,writable:!0}),o(P,c,{value:null,writable:!0}),o(P,d,{value:null,writable:!0}),o(P,f,{value:C._readableState.endEmitted,writable:!0}),o(P,m,{value:function(B,D){var V=S[y].read();V?(S[g]=null,S[u]=null,S[c]=null,B(p(V,!1))):(S[u]=B,S[c]=D)},writable:!0}),P));return S[g]=null,l(C,function(B){if(B&&B.code!=="ERR_STREAM_PREMATURE_CLOSE"){var D=S[c];return D!==null&&(S[g]=null,S[u]=null,S[c]=null,D(B)),void(S[d]=B)}var V=S[u];V!==null&&(S[g]=null,S[u]=null,S[c]=null,V(p(void 0,!0))),S[f]=!0}),C.on("readable",function(B){n.nextTick(x,B)}.bind(null,S)),S}}).call(this)}).call(this,i("_process"))},{"./end-of-stream":64,_process:50}],62:[function(i,a,s){function n(d,f){var g=Object.keys(d);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(d);f&&(m=m.filter(function(y){return Object.getOwnPropertyDescriptor(d,y).enumerable})),g.push.apply(g,m)}return g}function r(d,f,g){return f in d?Object.defineProperty(d,f,{value:g,enumerable:!0,configurable:!0,writable:!0}):d[f]=g,d}function o(d,f){for(var g=0;g<f.length;g++){var m=f[g];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(d,m.key,m)}}var l=i("buffer").Buffer,u=i("util").inspect,c=u&&u.custom||"inspect";a.exports=function(){function d(){(function(m,y){if(!(m instanceof y))throw new TypeError("Cannot call a class as a function")})(this,d),this.head=null,this.tail=null,this.length=0}var f,g;return f=d,(g=[{key:"push",value:function(m){var y={data:m,next:null};this.length>0?this.tail.next=y:this.head=y,this.tail=y,++this.length}},{key:"unshift",value:function(m){var y={data:m,next:this.head};this.length===0&&(this.tail=y),this.head=y,++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 y=this.head,p=""+y.data;y=y.next;)p+=m+y.data;return p}},{key:"concat",value:function(m){if(this.length===0)return l.alloc(0);for(var y,p,x,_=l.allocUnsafe(m>>>0),b=this.head,C=0;b;)y=b.data,p=_,x=C,l.prototype.copy.call(y,p,x),C+=b.data.length,b=b.next;return _}},{key:"consume",value:function(m,y){var p;return m<this.head.data.length?(p=this.head.data.slice(0,m),this.head.data=this.head.data.slice(m)):p=m===this.head.data.length?this.shift():y?this._getString(m):this._getBuffer(m),p}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(m){var y=this.head,p=1,x=y.data;for(m-=x.length;y=y.next;){var _=y.data,b=m>_.length?_.length:m;if(b===_.length?x+=_:x+=_.slice(0,m),(m-=b)===0){b===_.length?(++p,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=_.slice(b));break}++p}return this.length-=p,x}},{key:"_getBuffer",value:function(m){var y=l.allocUnsafe(m),p=this.head,x=1;for(p.data.copy(y),m-=p.data.length;p=p.next;){var _=p.data,b=m>_.length?_.length:m;if(_.copy(y,y.length-m,0,b),(m-=b)===0){b===_.length?(++x,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=_.slice(b));break}++x}return this.length-=x,y}},{key:c,value:function(m,y){return u(this,function(p){for(var x=1;x<arguments.length;x++){var _=arguments[x]!=null?arguments[x]:{};x%2?n(Object(_),!0).forEach(function(b){r(p,b,_[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(_)):n(Object(_)).forEach(function(b){Object.defineProperty(p,b,Object.getOwnPropertyDescriptor(_,b))})}return p}({},y,{depth:0,customInspect:!1}))}}])&&o(f.prototype,g),d}()},{buffer:17,util:16}],63:[function(i,a,s){(function(n){(function(){function r(u,c){l(u,c),o(u)}function o(u){u._writableState&&!u._writableState.emitClose||u._readableState&&!u._readableState.emitClose||u.emit("close")}function l(u,c){u.emit("error",c)}a.exports={destroy:function(u,c){var d=this,f=this._readableState&&this._readableState.destroyed,g=this._writableState&&this._writableState.destroyed;return f||g?(c?c(u):u&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(l,this,u)):n.nextTick(l,this,u)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(u||null,function(m){!c&&m?d._writableState?d._writableState.errorEmitted?n.nextTick(o,d):(d._writableState.errorEmitted=!0,n.nextTick(r,d,m)):n.nextTick(r,d,m):c?(n.nextTick(o,d),c(m)):n.nextTick(o,d)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(u,c){var d=u._readableState,f=u._writableState;d&&d.autoDestroy||f&&f.autoDestroy?u.destroy(c):u.emit("error",c)}}}).call(this)}).call(this,i("_process"))},{_process:50}],64:[function(i,a,s){var n=i("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function r(){}a.exports=function o(l,u,c){if(typeof u=="function")return o(l,null,u);u||(u={}),c=function(P){var S=!1;return function(){if(!S){S=!0;for(var B=arguments.length,D=new Array(B),V=0;V<B;V++)D[V]=arguments[V];P.apply(this,D)}}}(c||r);var d=u.readable||u.readable!==!1&&l.readable,f=u.writable||u.writable!==!1&&l.writable,g=function(){l.writable||y()},m=l._writableState&&l._writableState.finished,y=function(){f=!1,m=!0,d||c.call(l)},p=l._readableState&&l._readableState.endEmitted,x=function(){d=!1,p=!0,f||c.call(l)},_=function(P){c.call(l,P)},b=function(){var P;return d&&!p?(l._readableState&&l._readableState.ended||(P=new n),c.call(l,P)):f&&!m?(l._writableState&&l._writableState.ended||(P=new n),c.call(l,P)):void 0},C=function(){l.req.on("finish",y)};return function(P){return P.setHeader&&typeof P.abort=="function"}(l)?(l.on("complete",y),l.on("abort",b),l.req?C():l.on("request",C)):f&&!l._writableState&&(l.on("end",g),l.on("close",g)),l.on("end",x),l.on("finish",y),u.error!==!1&&l.on("error",_),l.on("close",b),function(){l.removeListener("complete",y),l.removeListener("abort",b),l.removeListener("request",C),l.req&&l.req.removeListener("finish",y),l.removeListener("end",g),l.removeListener("close",g),l.removeListener("finish",y),l.removeListener("end",x),l.removeListener("error",_),l.removeListener("close",b)}}},{"../../../errors":55}],65:[function(i,a,s){a.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(i,a,s){var n,r=i("../../../errors").codes,o=r.ERR_MISSING_ARGS,l=r.ERR_STREAM_DESTROYED;function u(f){if(f)throw f}function c(f){f()}function d(f,g){return f.pipe(g)}a.exports=function(){for(var f=arguments.length,g=new Array(f),m=0;m<f;m++)g[m]=arguments[m];var y,p=function(_){return _.length?typeof _[_.length-1]!="function"?u:_.pop():u}(g);if(Array.isArray(g[0])&&(g=g[0]),g.length<2)throw new o("streams");var x=g.map(function(_,b){var C=b<g.length-1;return function(P,S,B,D){D=function(F){var R=!1;return function(){R||(R=!0,F.apply(void 0,arguments))}}(D);var V=!1;P.on("close",function(){V=!0}),n===void 0&&(n=i("./end-of-stream")),n(P,{readable:S,writable:B},function(F){if(F)return D(F);V=!0,D()});var G=!1;return function(F){if(!V&&!G)return G=!0,function(R){return R.setHeader&&typeof R.abort=="function"}(P)?P.abort():typeof P.destroy=="function"?P.destroy():void D(F||new l("pipe"))}}(_,C,b>0,function(P){y||(y=P),P&&x.forEach(c),C||(x.forEach(c),p(y))})});return g.reduce(d)}},{"../../../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,o,l,u){var c=function(d,f,g){return d.highWaterMark!=null?d.highWaterMark:f?d[g]:null}(o,u,l);if(c!=null){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new n(u?l:"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<n.length;r++)n[r]=arguments[r+2]}return new function(o,l,u){var c=this;this._callback=o,this._args=u,this._interval=setInterval(o,l,this._args),this.reschedule=function(d){d||(d=c._interval),c._interval&&clearInterval(c._interval),c._interval=setInterval(c._callback,d,c._args)},this.clear=function(){c._interval&&(clearInterval(c._interval),c._interval=void 0)},this.destroy=function(){c._interval&&clearInterval(c._interval),c._callback=void 0,c._interval=void 0,c._args=void 0}}(arguments[0],arguments[1],n)}},{}],71:[function(i,a,s){a.exports=i("./index.js")()},{"./index.js":72}],72:[function(i,a,s){(function(n){(function(){function r(o){return o instanceof n?n.from(o):new o.constructor(o.buffer.slice(),o.byteOffset,o.length)}a.exports=function(o){return(o=o||{}).circles?function(u){var c=[],d=[];return u.proto?function g(m){if(typeof m!="object"||m===null)return m;if(m instanceof Date)return new Date(m);if(Array.isArray(m))return f(m,g);if(m instanceof Map)return new Map(f(Array.from(m),g));if(m instanceof Set)return new Set(f(Array.from(m),g));var y={};for(var p in c.push(m),d.push(y),m){var x=m[p];if(typeof x!="object"||x===null)y[p]=x;else if(x instanceof Date)y[p]=new Date(x);else if(x instanceof Map)y[p]=new Map(f(Array.from(x),g));else if(x instanceof Set)y[p]=new Set(f(Array.from(x),g));else if(ArrayBuffer.isView(x))y[p]=r(x);else{var _=c.indexOf(x);y[p]=_!==-1?d[_]:g(x)}}return c.pop(),d.pop(),y}:function g(m){if(typeof m!="object"||m===null)return m;if(m instanceof Date)return new Date(m);if(Array.isArray(m))return f(m,g);if(m instanceof Map)return new Map(f(Array.from(m),g));if(m instanceof Set)return new Set(f(Array.from(m),g));var y={};for(var p in c.push(m),d.push(y),m)if(Object.hasOwnProperty.call(m,p)!==!1){var x=m[p];if(typeof x!="object"||x===null)y[p]=x;else if(x instanceof Date)y[p]=new Date(x);else if(x instanceof Map)y[p]=new Map(f(Array.from(x),g));else if(x instanceof Set)y[p]=new Set(f(Array.from(x),g));else if(ArrayBuffer.isView(x))y[p]=r(x);else{var _=c.indexOf(x);y[p]=_!==-1?d[_]:g(x)}}return c.pop(),d.pop(),y};function f(g,m){for(var y=Object.keys(g),p=new Array(y.length),x=0;x<y.length;x++){var _=y[x],b=g[_];if(typeof b!="object"||b===null)p[_]=b;else if(b instanceof Date)p[_]=new Date(b);else if(ArrayBuffer.isView(b))p[_]=r(b);else{var C=c.indexOf(b);p[_]=C!==-1?d[C]:m(b)}}return p}}(o):o.proto?function u(c){if(typeof c!="object"||c===null)return c;if(c instanceof Date)return new Date(c);if(Array.isArray(c))return l(c,u);if(c instanceof Map)return new Map(l(Array.from(c),u));if(c instanceof Set)return new Set(l(Array.from(c),u));var d={};for(var f in c){var g=c[f];typeof g!="object"||g===null?d[f]=g:g instanceof Date?d[f]=new Date(g):g instanceof Map?d[f]=new Map(l(Array.from(g),u)):g instanceof Set?d[f]=new Set(l(Array.from(g),u)):ArrayBuffer.isView(g)?d[f]=r(g):d[f]=u(g)}return d}:function u(c){if(typeof c!="object"||c===null)return c;if(c instanceof Date)return new Date(c);if(Array.isArray(c))return l(c,u);if(c instanceof Map)return new Map(l(Array.from(c),u));if(c instanceof Set)return new Set(l(Array.from(c),u));var d={};for(var f in c)if(Object.hasOwnProperty.call(c,f)!==!1){var g=c[f];typeof g!="object"||g===null?d[f]=g:g instanceof Date?d[f]=new Date(g):g instanceof Map?d[f]=new Map(l(Array.from(g),u)):g instanceof Set?d[f]=new Set(l(Array.from(g),u)):ArrayBuffer.isView(g)?d[f]=r(g):d[f]=u(g)}return d};function l(u,c){for(var d=Object.keys(u),f=new Array(d.length),g=0;g<d.length;g++){var m=d[g],y=u[m];typeof y!="object"||y===null?f[m]=y:y instanceof Date?f[m]=new Date(y):ArrayBuffer.isView(y)?f[m]=r(y):f[m]=c(y)}return f}}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],73:[function(i,a,s){var n=i("buffer"),r=n.Buffer;function o(u,c){for(var d in u)c[d]=u[d]}function l(u,c,d){return r(u,c,d)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?a.exports=n:(o(n,s),s.Buffer=l),l.prototype=Object.create(r.prototype),o(r,l),l.from=function(u,c,d){if(typeof u=="number")throw new TypeError("Argument must not be a number");return r(u,c,d)},l.alloc=function(u,c,d){if(typeof u!="number")throw new TypeError("Argument must be a number");var f=r(u);return c!==void 0?typeof d=="string"?f.fill(c,d):f.fill(c):f.fill(0),f},l.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return r(u)},l.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(u)}},{buffer:17}],74:[function(i,a,s){a.exports=function(n){var r=n._readableState;return r?r.objectMode||typeof n._duplexState=="number"?n.read():n.read((o=r,o.buffer.length?o.buffer.head?o.buffer.head.data.length:o.buffer[0].length:o.length)):null;var o}},{}],75:[function(i,a,s){var n=i("safe-buffer").Buffer,r=n.isEncoding||function(p){switch((p=""+p)&&p.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(p){var x;switch(this.encoding=function(_){var b=function(C){if(!C)return"utf8";for(var P;;)switch(C){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return C;default:if(P)return;C=(""+C).toLowerCase(),P=!0}}(_);if(typeof b!="string"&&(n.isEncoding===r||!r(_)))throw new Error("Unknown encoding: "+_);return b||_}(p),this.encoding){case"utf16le":this.text=c,this.end=d,x=4;break;case"utf8":this.fillLast=u,x=4;break;case"base64":this.text=f,this.end=g,x=3;break;default:return this.write=m,void(this.end=y)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(x)}function l(p){return p<=127?0:p>>5==6?2:p>>4==14?3:p>>3==30?4:p>>6==2?-1:-2}function u(p){var x=this.lastTotal-this.lastNeed,_=function(b,C,P){if((192&C[0])!=128)return b.lastNeed=0,"\uFFFD";if(b.lastNeed>1&&C.length>1){if((192&C[1])!=128)return b.lastNeed=1,"\uFFFD";if(b.lastNeed>2&&C.length>2&&(192&C[2])!=128)return b.lastNeed=2,"\uFFFD"}}(this,p);return _!==void 0?_:this.lastNeed<=p.length?(p.copy(this.lastChar,x,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(p.copy(this.lastChar,x,0,p.length),void(this.lastNeed-=p.length))}function c(p,x){if((p.length-x)%2==0){var _=p.toString("utf16le",x);if(_){var b=_.charCodeAt(_.length-1);if(b>=55296&&b<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=p[p.length-2],this.lastChar[1]=p[p.length-1],_.slice(0,-1)}return _}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=p[p.length-1],p.toString("utf16le",x,p.length-1)}function d(p){var x=p&&p.length?this.write(p):"";if(this.lastNeed){var _=this.lastTotal-this.lastNeed;return x+this.lastChar.toString("utf16le",0,_)}return x}function f(p,x){var _=(p.length-x)%3;return _===0?p.toString("base64",x):(this.lastNeed=3-_,this.lastTotal=3,_===1?this.lastChar[0]=p[p.length-1]:(this.lastChar[0]=p[p.length-2],this.lastChar[1]=p[p.length-1]),p.toString("base64",x,p.length-_))}function g(p){var x=p&&p.length?this.write(p):"";return this.lastNeed?x+this.lastChar.toString("base64",0,3-this.lastNeed):x}function m(p){return p.toString(this.encoding)}function y(p){return p&&p.length?this.write(p):""}s.StringDecoder=o,o.prototype.write=function(p){if(p.length===0)return"";var x,_;if(this.lastNeed){if((x=this.fillLast(p))===void 0)return"";_=this.lastNeed,this.lastNeed=0}else _=0;return _<p.length?x?x+this.text(p,_):this.text(p,_):x||""},o.prototype.end=function(p){var x=p&&p.length?this.write(p):"";return this.lastNeed?x+"\uFFFD":x},o.prototype.text=function(p,x){var _=function(C,P,S){var B=P.length-1;if(B<S)return 0;var D=l(P[B]);return D>=0?(D>0&&(C.lastNeed=D-1),D):--B<S||D===-2?0:(D=l(P[B]))>=0?(D>0&&(C.lastNeed=D-2),D):--B<S||D===-2?0:(D=l(P[B]))>=0?(D>0&&(D===2?D=0:C.lastNeed=D-3),D):0}(this,p,x);if(!this.lastNeed)return p.toString("utf8",x);this.lastTotal=_;var b=p.length-(_-this.lastNeed);return p.copy(this.lastChar,0,b),p.toString("utf8",x,b)},o.prototype.fillLast=function(p){if(this.lastNeed<=p.length)return p.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);p.copy(this.lastChar,this.lastTotal-this.lastNeed,0,p.length),this.lastNeed-=p.length}},{"safe-buffer":73}],76:[function(i,a,s){var n=i("punycode"),r=i("./util");function o(){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=P,s.resolve=function(S,B){return P(S,!1,!0).resolve(B)},s.resolveObject=function(S,B){return S?P(S,!1,!0).resolveObject(B):B},s.format=function(S){return r.isString(S)&&(S=P(S)),S instanceof o?S.format():o.prototype.format.call(S)},s.Url=o;var l=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
  67. `," "]),f=["'"].concat(d),g=["%","/","?",";","#"].concat(f),m=["/","?","#"],y=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,x={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},C=i("querystring");function P(S,B,D){if(S&&r.isObject(S)&&S instanceof o)return S;var V=new o;return V.parse(S,B,D),V}o.prototype.parse=function(S,B,D){if(!r.isString(S))throw new TypeError("Parameter 'url' must be a string, not "+typeof S);var V=S.indexOf("?"),G=V!==-1&&V<S.indexOf("#")?"?":"#",F=S.split(G);F[0]=F[0].replace(/\\/g,"/");var R=S=F.join(G);if(R=R.trim(),!D&&S.split("#").length===1){var T=c.exec(R);if(T)return this.path=R,this.href=R,this.pathname=T[1],T[2]?(this.search=T[2],this.query=B?C.parse(this.search.substr(1)):this.search.substr(1)):B&&(this.search="",this.query={}),this}var L=l.exec(R);if(L){var $=(L=L[0]).toLowerCase();this.protocol=$,R=R.substr(L.length)}if(D||L||R.match(/^\/\/[^@\/]+@[^@\/]+/)){var Z=R.substr(0,2)==="//";!Z||L&&_[L]||(R=R.substr(2),this.slashes=!0)}if(!_[L]&&(Z||L&&!b[L])){for(var at,q,W=-1,j=0;j<m.length;j++)(K=R.indexOf(m[j]))!==-1&&(W===-1||K<W)&&(W=K);for((q=W===-1?R.lastIndexOf("@"):R.lastIndexOf("@",W))!==-1&&(at=R.slice(0,q),R=R.slice(q+1),this.auth=decodeURIComponent(at)),W=-1,j=0;j<g.length;j++){var K;(K=R.indexOf(g[j]))!==-1&&(W===-1||K<W)&&(W=K)}W===-1&&(W=R.length),this.host=R.slice(0,W),R=R.slice(W),this.parseHost(),this.hostname=this.hostname||"";var U=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!U)for(var tt=this.hostname.split(/\./),st=(j=0,tt.length);j<st;j++){var it=tt[j];if(it&&!it.match(y)){for(var ht="",lt=0,ut=it.length;lt<ut;lt++)it.charCodeAt(lt)>127?ht+="x":ht+=it[lt];if(!ht.match(y)){var E=tt.slice(0,j),A=tt.slice(j+1),I=it.match(p);I&&(E.push(I[1]),A.unshift(I[2])),A.length&&(R="/"+A.join(".")+R),this.hostname=E.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(!x[$])for(j=0,st=f.length;j<st;j++){var J=f[j];if(R.indexOf(J)!==-1){var rt=encodeURIComponent(J);rt===J&&(rt=escape(J)),R=R.split(J).join(rt)}}var yt=R.indexOf("#");yt!==-1&&(this.hash=R.substr(yt),R=R.slice(0,yt));var mt=R.indexOf("?");if(mt!==-1?(this.search=R.substr(mt),this.query=R.substr(mt+1),B&&(this.query=C.parse(this.query)),R=R.slice(0,mt)):B&&(this.search="",this.query={}),R&&(this.pathname=R),b[$]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){N=this.pathname||"";var Et=this.search||"";this.path=N+Et}return this.href=this.format(),this},o.prototype.format=function(){var S=this.auth||"";S&&(S=(S=encodeURIComponent(S)).replace(/%3A/i,":"),S+="@");var B=this.protocol||"",D=this.pathname||"",V=this.hash||"",G=!1,F="";this.host?G=S+this.host:this.hostname&&(G=S+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(G+=":"+this.port)),this.query&&r.isObject(this.query)&&Object.keys(this.query).length&&(F=C.stringify(this.query));var R=this.search||F&&"?"+F||"";return B&&B.substr(-1)!==":"&&(B+=":"),this.slashes||(!B||b[B])&&G!==!1?(G="//"+(G||""),D&&D.charAt(0)!=="/"&&(D="/"+D)):G||(G=""),V&&V.charAt(0)!=="#"&&(V="#"+V),R&&R.charAt(0)!=="?"&&(R="?"+R),B+G+(D=D.replace(/[?#]/g,function(T){return encodeURIComponent(T)}))+(R=R.replace("#","%23"))+V},o.prototype.resolve=function(S){return this.resolveObject(P(S,!1,!0)).format()},o.prototype.resolveObject=function(S){if(r.isString(S)){var B=new o;B.parse(S,!1,!0),S=B}for(var D=new o,V=Object.keys(this),G=0;G<V.length;G++){var F=V[G];D[F]=this[F]}if(D.hash=S.hash,S.href==="")return D.href=D.format(),D;if(S.slashes&&!S.protocol){for(var R=Object.keys(S),T=0;T<R.length;T++){var L=R[T];L!=="protocol"&&(D[L]=S[L])}return b[D.protocol]&&D.hostname&&!D.pathname&&(D.path=D.pathname="/"),D.href=D.format(),D}if(S.protocol&&S.protocol!==D.protocol){if(!b[S.protocol]){for(var $=Object.keys(S),Z=0;Z<$.length;Z++){var at=$[Z];D[at]=S[at]}return D.href=D.format(),D}if(D.protocol=S.protocol,S.host||_[S.protocol])D.pathname=S.pathname;else{for(var q=(S.pathname||"").split("/");q.length&&!(S.host=q.shift()););S.host||(S.host=""),S.hostname||(S.hostname=""),q[0]!==""&&q.unshift(""),q.length<2&&q.unshift(""),D.pathname=q.join("/")}if(D.search=S.search,D.query=S.query,D.host=S.host||"",D.auth=S.auth,D.hostname=S.hostname||S.host,D.port=S.port,D.pathname||D.search){var W=D.pathname||"",j=D.search||"";D.path=W+j}return D.slashes=D.slashes||S.slashes,D.href=D.format(),D}var K=D.pathname&&D.pathname.charAt(0)==="/",U=S.host||S.pathname&&S.pathname.charAt(0)==="/",tt=U||K||D.host&&S.pathname,st=tt,it=D.pathname&&D.pathname.split("/")||[],ht=(q=S.pathname&&S.pathname.split("/")||[],D.protocol&&!b[D.protocol]);if(ht&&(D.hostname="",D.port=null,D.host&&(it[0]===""?it[0]=D.host:it.unshift(D.host)),D.host="",S.protocol&&(S.hostname=null,S.port=null,S.host&&(q[0]===""?q[0]=S.host:q.unshift(S.host)),S.host=null),tt=tt&&(q[0]===""||it[0]==="")),U)D.host=S.host||S.host===""?S.host:D.host,D.hostname=S.hostname||S.hostname===""?S.hostname:D.hostname,D.search=S.search,D.query=S.query,it=q;else if(q.length)it||(it=[]),it.pop(),it=it.concat(q),D.search=S.search,D.query=S.query;else if(!r.isNullOrUndefined(S.search))return ht&&(D.hostname=D.host=it.shift(),(I=!!(D.host&&D.host.indexOf("@")>0)&&D.host.split("@"))&&(D.auth=I.shift(),D.host=D.hostname=I.shift())),D.search=S.search,D.query=S.query,r.isNull(D.pathname)&&r.isNull(D.search)||(D.path=(D.pathname?D.pathname:"")+(D.search?D.search:"")),D.href=D.format(),D;if(!it.length)return D.pathname=null,D.search?D.path="/"+D.search:D.path=null,D.href=D.format(),D;for(var lt=it.slice(-1)[0],ut=(D.host||S.host||it.length>1)&&(lt==="."||lt==="..")||lt==="",E=0,A=it.length;A>=0;A--)(lt=it[A])==="."?it.splice(A,1):lt===".."?(it.splice(A,1),E++):E&&(it.splice(A,1),E--);if(!tt&&!st)for(;E--;E)it.unshift("..");!tt||it[0]===""||it[0]&&it[0].charAt(0)==="/"||it.unshift(""),ut&&it.join("/").substr(-1)!=="/"&&it.push("");var I,N=it[0]===""||it[0]&&it[0].charAt(0)==="/";return ht&&(D.hostname=D.host=N?"":it.length?it.shift():"",(I=!!(D.host&&D.host.indexOf("@")>0)&&D.host.split("@"))&&(D.auth=I.shift(),D.host=D.hostname=I.shift())),(tt=tt||D.host&&it.length)&&!N&&it.unshift(""),it.length?D.pathname=it.join("/"):(D.pathname=null,D.path=null),r.isNull(D.pathname)&&r.isNull(D.search)||(D.path=(D.pathname?D.pathname:"")+(D.search?D.search:"")),D.auth=S.auth||D.auth,D.slashes=D.slashes||S.slashes,D.href=D.format(),D},o.prototype.parseHost=function(){var S=this.host,B=u.exec(S);B&&((B=B[0])!==":"&&(this.port=B.substr(1)),S=S.substr(0,S.length-B.length)),S&&(this.hostname=S)}},{"./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(o){try{if(!n.localStorage)return!1}catch{return!1}var l=n.localStorage[o];return l!=null&&String(l).toLowerCase()==="true"}a.exports=function(o,l){if(r("noDeprecation"))return o;var u=!1;return function(){if(!u){if(r("throwDeprecation"))throw new Error(l);r("traceDeprecation")?console.trace(l):console.warn(l),u=!0}return o.apply(this,arguments)}}}).call(this)}).call(this,typeof Oe<"u"?Oe:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,a,s){a.exports=function n(r,o){if(r&&o)return n(r)(o);if(typeof r!="function")throw new TypeError("need wrapper function");return Object.keys(r).forEach(function(u){l[u]=r[u]}),l;function l(){for(var u=new Array(arguments.length),c=0;c<u.length;c++)u[c]=arguments[c];var d=r.apply(this,u),f=u[u.length-1];return typeof d=="function"&&d!==f&&Object.keys(f).forEach(function(g){d[g]=f[g]}),d}}},{}],80:[function(i,a,s){a.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(i,a,s){a.exports=function(){for(var r={},o=0;o<arguments.length;o++){var l=arguments[o];for(var u in l)n.call(l,u)&&(r[u]=l[u])}return r};var n=Object.prototype.hasOwnProperty},{}],82:[function(i,a,s){a.exports=function(n){n.prototype[Symbol.iterator]=function*(){for(let r=this.head;r;r=r.next)yield r.value}}},{}],83:[function(i,a,s){function n(c){var d=this;if(d instanceof n||(d=new n),d.tail=null,d.head=null,d.length=0,c&&typeof c.forEach=="function")c.forEach(function(m){d.push(m)});else if(arguments.length>0)for(var f=0,g=arguments.length;f<g;f++)d.push(arguments[f]);return d}function r(c,d,f){var g=d===c.head?new u(f,null,d,c):new u(f,d,d.next,c);return g.next===null&&(c.tail=g),g.prev===null&&(c.head=g),c.length++,g}function o(c,d){c.tail=new u(d,c.tail,null,c),c.head||(c.head=c.tail),c.length++}function l(c,d){c.head=new u(d,null,c.head,c),c.tail||(c.tail=c.head),c.length++}function u(c,d,f,g){if(!(this instanceof u))return new u(c,d,f,g);this.list=g,this.value=c,d?(d.next=this,this.prev=d):this.prev=null,f?(f.prev=this,this.next=f):this.next=null}a.exports=n,n.Node=u,n.create=n,n.prototype.removeNode=function(c){if(c.list!==this)throw new Error("removing node which does not belong to this list");var d=c.next,f=c.prev;return d&&(d.prev=f),f&&(f.next=d),c===this.head&&(this.head=d),c===this.tail&&(this.tail=f),c.list.length--,c.next=null,c.prev=null,c.list=null,d},n.prototype.unshiftNode=function(c){if(c!==this.head){c.list&&c.list.removeNode(c);var d=this.head;c.list=this,c.next=d,d&&(d.prev=c),this.head=c,this.tail||(this.tail=c),this.length++}},n.prototype.pushNode=function(c){if(c!==this.tail){c.list&&c.list.removeNode(c);var d=this.tail;c.list=this,c.prev=d,d&&(d.next=c),this.tail=c,this.head||(this.head=c),this.length++}},n.prototype.push=function(){for(var c=0,d=arguments.length;c<d;c++)o(this,arguments[c]);return this.length},n.prototype.unshift=function(){for(var c=0,d=arguments.length;c<d;c++)l(this,arguments[c]);return this.length},n.prototype.pop=function(){if(this.tail){var c=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,c}},n.prototype.shift=function(){if(this.head){var c=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,c}},n.prototype.forEach=function(c,d){d=d||this;for(var f=this.head,g=0;f!==null;g++)c.call(d,f.value,g,this),f=f.next},n.prototype.forEachReverse=function(c,d){d=d||this;for(var f=this.tail,g=this.length-1;f!==null;g--)c.call(d,f.value,g,this),f=f.prev},n.prototype.get=function(c){for(var d=0,f=this.head;f!==null&&d<c;d++)f=f.next;if(d===c&&f!==null)return f.value},n.prototype.getReverse=function(c){for(var d=0,f=this.tail;f!==null&&d<c;d++)f=f.prev;if(d===c&&f!==null)return f.value},n.prototype.map=function(c,d){d=d||this;for(var f=new n,g=this.head;g!==null;)f.push(c.call(d,g.value,this)),g=g.next;return f},n.prototype.mapReverse=function(c,d){d=d||this;for(var f=new n,g=this.tail;g!==null;)f.push(c.call(d,g.value,this)),g=g.prev;return f},n.prototype.reduce=function(c,d){var f,g=this.head;if(arguments.length>1)f=d;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");g=this.head.next,f=this.head.value}for(var m=0;g!==null;m++)f=c(f,g.value,m),g=g.next;return f},n.prototype.reduceReverse=function(c,d){var f,g=this.tail;if(arguments.length>1)f=d;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");g=this.tail.prev,f=this.tail.value}for(var m=this.length-1;g!==null;m--)f=c(f,g.value,m),g=g.prev;return f},n.prototype.toArray=function(){for(var c=new Array(this.length),d=0,f=this.head;f!==null;d++)c[d]=f.value,f=f.next;return c},n.prototype.toArrayReverse=function(){for(var c=new Array(this.length),d=0,f=this.tail;f!==null;d++)c[d]=f.value,f=f.prev;return c},n.prototype.slice=function(c,d){(d=d||this.length)<0&&(d+=this.length),(c=c||0)<0&&(c+=this.length);var f=new n;if(d<c||d<0)return f;c<0&&(c=0),d>this.length&&(d=this.length);for(var g=0,m=this.head;m!==null&&g<c;g++)m=m.next;for(;m!==null&&g<d;g++,m=m.next)f.push(m.value);return f},n.prototype.sliceReverse=function(c,d){(d=d||this.length)<0&&(d+=this.length),(c=c||0)<0&&(c+=this.length);var f=new n;if(d<c||d<0)return f;c<0&&(c=0),d>this.length&&(d=this.length);for(var g=this.length,m=this.tail;m!==null&&g>d;g--)m=m.prev;for(;m!==null&&g>c;g--,m=m.prev)f.push(m.value);return f},n.prototype.splice=function(c,d,...f){c>this.length&&(c=this.length-1),c<0&&(c=this.length+c);for(var g=0,m=this.head;m!==null&&g<c;g++)m=m.next;var y=[];for(g=0;m&&g<d;g++)y.push(m.value),m=this.removeNode(m);for(m===null&&(m=this.tail),m!==this.head&&m!==this.tail&&(m=m.prev),g=0;g<f.length;g++)m=r(this,m,f[g]);return y},n.prototype.reverse=function(){for(var c=this.head,d=this.tail,f=c;f!==null;f=f.prev){var g=f.prev;f.prev=f.next,f.next=g}return this.head=d,this.tail=c,this};try{i("./iterator.js")(n)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(yn);const Bd={success:{color:"#2ba471",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 23a11 11 0 100-22 11 11 0 000 22zM7.5 10.59l3 3 6-6L17.91 9l-7.41 7.41L6.09 12l1.41-1.41z"></path></svg>'},info:{color:"#0052d9",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 23a11 11 0 100-22 11 11 0 000 22zM11 8.5v-2h2v2h-2zm2 1.5v7.5h-2V10h2z"></path></svg>'},warning:{color:"#e37318",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 1a11 11 0 110 22 11 11 0 010-22zm-1 13h2V6.5h-2V14zm2 1.5h-2v2h2v-2z"></path></svg>'},error:{color:"#d54941",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 1a11 11 0 110 22 11 11 0 010-22zm-1 13h2V6.5h-2V14zm2 1.5h-2v2h2v-2z"></path></svg>'},question:{color:"#0052d9",icon:'<svg fill="none" viewBox="0 0 24 24"><path d="M12 23a11 11 0 100-22 11 11 0 000 22zm-.17-11.11c.43-.53.97-.97 1.4-1.32A2 2 0 0012 7a2 2 0 00-1.89 1.33l-.33.95L7.9 8.6l.34-.94a4 4 0 116.24 4.47 7 7 0 00-1.1 1.01c-.27.34-.37.61-.37.85v1.25h-2V14c0-.87.39-1.57.83-2.11zM11 18.25v-2h2v2h-2z"></path></svg>'}},si={};class gE{constructor(t,i){H(this,"parentElement");H(this,"box");H(this,"icon");H(this,"text");H(this,"closeBtn");H(this,"duration");H(this,"content");H(this,"theme");H(this,"placement");H(this,"height");H(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=Bd[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<document.styleSheets.length;n++)document.styleSheets[n].title==="le5le.com/message"&&(a=document.styleSheets[n]);if(!a){let n=document.createElement("style");n.type="text/css",n.title="le5le.com/message",document.head.appendChild(n),n=document.createElement("style"),n.type="text/css",document.head.appendChild(n),a=n.sheet,a.insertRule(`.meta2d-message{
  68. position:absolute;
  69. z-index:999;
  70. transform: translateX(-50%);
  71. padding:12px 16px;
  72. max-width:400px;
  73. background:#fff;
  74. border-radius:6px;
  75. box-shadow:0 3px 14px 2px rgba(0, 0, 0, .05),0 8px 10px 1px rgba(0, 0, 0, 6%),0 5px 5px -3px rgba(0, 0, 0, 10%);
  76. display:flex;
  77. animation: fadein .5s;}`),a.insertRule(`
  78. @keyframes fadein {
  79. 0% {
  80. transform: translate(-50%, -100%);
  81. }
  82. 100% {
  83. transform: translate(-50%,0);
  84. }
  85. }`),a.insertRule(".meta2d-message .icon{width:20px;height:20px;}"),a.insertRule(".meta2d-message .text{color:rgba(0, 0, 0, 0.9);font-size:12px;margin-left:8px;line-height:20px;}"),a.insertRule(".meta2d-message .close{width:20px;height:20px;padding-left: 16px; cursor: pointer;}")}this.id=i.id||Tt(),this.duration=(s=i.duration)!=null?s:3e3,this.placement=i.placement||"top",this.theme=i.theme||"info",this.height=i.height}init(){si[this.id]=this,this.duration&&setTimeout(()=>{this.close()},this.duration);let t=-1;Object.keys(si).forEach(i=>{var a;((a=si[i])==null?void 0:a.placement)===this.placement&&t++}),this.setPosition(this.placement,t),this.icon.children[0].style.fill=Bd[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(si).forEach(t=>{var i;if(((i=si[t])==null?void 0:i.placement)===this.placement)switch(this.placement){case"top":case"left":case"right":si[t].box.style.top=parseInt(si[t].box.style.top)-60+"px";break;case"bottom":si[t].box.style.bottom=parseInt(si[t].box.style.bottom)-60+"px";break}}),si[this.id]=null,delete si[this.id],this.box.remove()}}function vE(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")||io("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 o in s.payload.properties)r.push({id:`${s.payload.headers.productId}#${s.payload.deviceId}#${o}`,value:s.payload.properties[o]});e.setDatas(r,{history:!1})}else s.topic.startsWith("/notifications")&&w0(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+"-"+Tt()}))}),t.notification&&e.jetLinksClient.send(JSON.stringify({type:"sub",topic:"/notifications",id:"notification",parameter:{}}))}}}function w0(e,t){var r,o;let i=t.payload.topicName,a=t.payload.message,s=t.payload.notifyTime,n=`<div style="padding:0px 12px 0px 0px;width:300px;">
  86. <div style="display:flex;height: 20px;justify-content: space-between">
  87. <div style="color: #000000d9;
  88. font-size: 14px;
  89. font-weight: 700;">${i}</div><div style="color: #00000073;">${mE(s)}</div>
  90. </div>
  91. <span>${a}</span>
  92. </div>`;e.message({content:n,duration:0,closeBtn:!0,placement:"right",height:75}),(r=t.payload.detail)!=null&&r.alarmConfigId&&bE(e,(o=t.payload.detail)==null?void 0:o.alarmConfigId)}globalThis.doWarning=w0;function mE(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"),o=(t.getSeconds()+"").padStart(2,"0");return i+"-"+a+"-"+s+" "+n+":"+r+":"+o}function yE(e){e.jetLinksClient&&(e.jetLinksClient.close(),e.jetLinksClient=void 0)}function pE(e,t,i){const a=[];return i.list.forEach((s,n)=>{var o,l,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 d=(o=r.realTimes)==null?void 0:o.find(f=>f.propertyId===c);d&&(a[n].properties[c]=r[d.key])}else if(typeof s.value[c]=="string"&&((l=s.value[c])==null?void 0:l.indexOf("${"))>-1){let d=s.value[c].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));d!=null&&d.length&&(a[n].properties[c]=(u=r[d[0]])!=null?u:e.getDynamicParam(d[0]))}else a[n].properties[c]=s.value[c]}),a}async function wE(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 bE(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&&b0(e,a.result.media,a.result.playTimes)}}function b0(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<i&&e.store.globalAudio.play()}}}globalThis.createAudio=b0;const xE=/^echarts/,_E="meta2d";class EE{constructor(t,i={}){H(this,"store");H(this,"canvas");H(this,"websocket");H(this,"mqttClient");H(this,"websockets");H(this,"mqttClients");H(this,"eventSources");H(this,"penPluginMap",new Map);H(this,"socketFn");H(this,"events",{});H(this,"setPropsRenderPending",!1);H(this,"map");H(this,"mapTimer");H(this,"fillViewSnapshot",null);H(this,"facePen",Ns);H(this,"getWords",Dg);H(this,"calcTextLines",Ws);H(this,"calcTextRect",Ii);H(this,"calcTextDrawRect",jc);H(this,"jetLinksList",[]);H(this,"jetLinksClient");H(this,"register",Ig);H(this,"registerCanvasDraw",P2);H(this,"registerAnchors",R2);H(this,"registerGridDrawer",S2);H(this,"unregisterGridDrawer",T2);H(this,"registerLineAnimateDraws",(t,i)=>{this.store.data.lineAnimateDraws[t]=i,wt.lineAnimateDraws[t]=Te(this.store.options,"ctx","pen","state","index",i)});H(this,"websocketTimes",0);H(this,"mqttTimes",0);H(this,"httpTimer");H(this,"httpTimerList",[]);H(this,"updateTimer");H(this,"updateTimerList",[]);H(this,"sqlTimerList",[]);H(this,"iotMqttClient");H(this,"iotTimer");H(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"&&(__(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&&nc(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?(nc(i.pen),this.store.data.locked&&!i.pen.disabled&&this.doEvent(i.pen,t)):(nc(i),this.store.data.locked&&i&&!i.disabled&&this.doEvent(i,t));break}this.doMessageEvent(t,i)});H(this,"doEvent",(t,i)=>{var n,r,o,l,u,c,d,f,g,m;if(!t)return;let a=!1,s=[];if((n=t.events)==null||n.forEach((y,p)=>{var x;if(y.actions&&y.actions.length){if(y.name===i){let _=!1;y.conditions&&y.conditions.length?y.conditionType==="and"?_=y.conditions.every(b=>this.judgeCondition(t,b.key,b)):y.conditionType==="or"&&(_=y.conditions.some(b=>this.judgeCondition(t,b.key,b))):_=!0,_&&s.push(p)}}else if(a=!0,this.events[y.action]&&y.name===i){let _=!((x=y.where)!=null&&x.type);if(y.where){const{fn:b,fnJs:C,comparison:P,key:S,value:B}=y.where;if(b)_=b(t,{meta2d:this});else if(C){try{y.where.fn=Te(this.store.options,"pen","context",C)}catch(D){console.error("Error: make function:",D,"code:",C)}y.where.fn&&(_=y.where.fn(t,{meta2d:this}))}else{let D=t[S];switch(["x","y","width","height"].includes(S)&&(D=this.getPenRect(t)[S]),P){case">":_=D>+B;break;case">=":_=D>=+B;break;case"<":_=D<+B;break;case"<=":_=D<=+B;break;case"=":case"==":_=D==B;break;case"!=":_=D!=B;break;case"[)":_=bs(+D,B);break;case"![)":_=!bs(+D,B);break;case"[]":_=xs(D,B);break;case"![]":_=!xs(D,B);break}}}_&&s.push(p)}}),a?(r=t.events)==null||r.forEach((y,p)=>{s.includes(p)&&this.events[y.action]&&this.events[y.action](t,y)}):(o=t.events)==null||o.forEach(async(y,p)=>{if(s.includes(p)){if(y.confirm&&!await this.canvas.popconfirm.showModal(t,this.canvas.mousePos,y.confirmTitle))return;y.actions.forEach(x=>{x.timeout?setTimeout(()=>{this.events[x.action]&&this.events[x.action](t,x)},x.timeout):this.events[x.action]&&this.events[x.action](t,x)})}}),i==="valueUpdate"){(l=t.realTimes)==null||l.forEach(p=>{var _,b;let x=[];(_=p.triggers)==null||_.forEach((C,P)=>{var B;let S=!1;(B=C.conditions)!=null&&B.length?C.conditionType==="and"?S=C.conditions.every(D=>this.judgeCondition(t,p.key,D)):C.conditionType==="or"&&(S=C.conditions.some(D=>this.judgeCondition(t,p.key,D))):S=!0,S&&x.push(P)}),(b=p.triggers)==null||b.forEach((C,P)=>{var S;x.includes(P)&&((S=C.actions)==null||S.forEach(B=>{B.timeout?setTimeout(()=>{this.events[B.action]&&this.events[B.action](t,B)},B.timeout):this.events[B.action]&&this.events[B.action](t,B)}))})});let y=[];if((u=this.store.globalTriggers[t.id])==null||u.forEach((p,x)=>{var b;let _=!1;(b=p.conditions)!=null&&b.length?p.conditionType==="and"?_=p.conditions.every(C=>this.judgeCondition(this.store.pens[C.source],C.key,C)):p.conditionType==="or"&&(_=p.conditions.some(C=>this.judgeCondition(this.store.pens[C.source],C.key,C))):_=!0,_&&y.push(x)}),(c=this.store.globalTriggers[t.id])==null||c.forEach((p,x)=>{var _;y.includes(x)&&((_=p.actions)==null||_.forEach(b=>{b.timeout?setTimeout(()=>{this.events[b.action]&&this.events[b.action](t,b)},b.timeout):this.events[b.action]&&this.events[b.action](t,b)}))}),(d=t.triggers)!=null&&d.length){for(let p of t.triggers)if((f=p.status)!=null&&f.length)for(let x of p.status){let _=!1;if((g=x.conditions)!=null&&g.length?x.conditionType==="and"?_=x.conditions.every(b=>this.judgeCondition(t,b.key,b)):x.conditionType==="or"&&(_=x.conditions.some(b=>this.judgeCondition(t,b.key,b))):_=!0,_){(m=x.actions)==null||m.forEach(b=>{b.timeout?setTimeout(()=>{this.events[b.action]&&this.events[b.action](t,b)},b.timeout):this.events[b.action]&&this.events[b.action](t,b)});break}}}}this.doEvent(this.store.pens[t.parentId],i)});H(this,"doDataEvent",t=>{var s,n,r;if(!((s=this.store.data.dataEvents)!=null&&s.length))return;const i=t.reduce((o,{dataId:l,id:u,value:c})=>(o[u||l]=c,o),{});let a=[];(n=this.store.data.dataEvents)==null||n.forEach((o,l)=>{let u=!1;o.conditions&&o.conditions.length?o.conditionType==="and"?u=o.conditions.every(c=>this.dataJudegeCondition(i,c.key,c)):o.conditionType==="or"&&(u=o.conditions.some(c=>this.dataJudegeCondition(i,c.key,c))):u=!0,u&&a.push(l)}),(r=this.store.data.dataEvents)==null||r.forEach((o,l)=>{var u;a.includes(l)&&((u=o.actions)==null||u.forEach(c=>{this.events[c.action]&&this.events[c.action](i,c)}))})});H(this,"renderPenRaw",oo);H(this,"setElemPosition",Pe);H(this,"setLifeCycleFunc",G6);this.store=N2(Tt()),this.setOptions(i),this.setDatabyOptions(i),this.init(t),this.register(hE()),this.registerCanvasDraw({cube:H5}),this.registerAnchors(fE()),globalThis[i.alias||_E]=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,s;if((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),t.roles&&((a=this.store.data.pens)==null?void 0:a.length))for(const n of this.store.data.pens)Di(n);this.canvas&&t.scroll!==void 0&&(t.scroll?(!this.canvas.scroll&&(this.canvas.scroll=new g0(this.canvas)),this.canvas.scroll.show()):this.canvas.scroll&&this.canvas.scroll.hide()),(s=this.canvas)==null||s.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(o=>a.test(o)))return;const n={},r=[];for(let o=0;o<i.length;o++){const u=i[o].split(":"),c=u[0].trim(),d=u[1].trim();r.push([c,d].join(":")),n[c]=d}gn.addTheme(t,r),this.store.theme[t]=n}setTheme(t){if(this.store.data.theme=t,this.setBackgroundColor(this.store.theme[t].background),this.canvas.parentElement.style.background=this.store.theme[t].parentBackground,this.setOptions({ruleColor:this.store.theme[t].ruleColor,ruleOptions:this.store.theme[t].ruleOptions}),!(this.store.options.themeOnlyCanvas||this.store.data.themeOnlyCanvas)){this.store.data.color=this.store.theme[t].color,gn.updateCssRule(this.store.id,t),this.canvas.initGlobalStyle();for(let i=0;i<this.store.data.pens.length;i++){const a=this.store.data.pens[i];a.setTheme&&a.setTheme(a,this.store.styles)}}this.render()}setDatabyOptions(t={}){const{color:i,activeColor:a,activeBackground:s,grid:n,gridColor:r,gridSize:o,gridType:l,gridScope:u,fromArrow:c,toArrow:d,rule:f,ruleColor:g,textColor:m,x:y=0,y:p=0}=t;this.setRule({rule:f,ruleColor:g}),this.setGrid({grid:n,gridColor:r,gridSize:o,gridType:l,gridScope:u}),this.store.data=Object.assign(this.store.data,{textColor:m,color:i,activeColor:a,activeBackground:s,fromArrow:c,toArrow:d,x:y,y:p})}init(t){typeof t=="string"?this.canvas=new Pd(this,document.getElementById(t),this.store):this.canvas=new Pd(this,t,this.store),this.canvas.initGlobalStyle(),this.resize(),this.canvas.listen(),gn.createThemeSheet(this.store.data.theme,this.store.id)}initEventFns(){this.events[he.Link]=(t,i)=>{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(o=>o.slice(2,-1));r&&(r==null||r.forEach(o=>{n=n.replace(`\${${o}}`,Ne(t,o)||this.getDynamicParam(o))}))}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 o=i.params?this.find(i.params):this.find(t.id),l={};for(let c in a)if((s=a[c])!=null&&s.id)l[c]=(n=this.store.pens[a[c].id])==null?void 0:n[a[c].key];else if(typeof a[c]=="string"&&a[c].includes("${")){let d=a[c],f=(r=d.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(g=>g.slice(2,-1));f&&f.forEach(g=>{d=d.replace(`\${${g}}`,Ne(t,g)||this.getDynamicParam(g))}),l[c]=d}else if(typeof a[c]=="string"&&(a[c].startsWith("{")&&a[c].endsWith("}")||a[c].startsWith("[")&&a[c].endsWith("]")))try{l[c]=JSON.parse(a[c])}catch{l[c]=a[c]}else l[c]=a[c];let u=!1;o.forEach(c=>{l.hasOwnProperty("visible")&&c.visible!==l.visible&&(u=!0,this.store.emitter.emit("setProps-visible",{pen:c,visible:l.visible}),this.setVisible(c,l.visible,!1,!1)),this.setValue({id:c.id,...l},{render:!1,doEvent:!1})}),u&&this.onSizeUpdate(),this.requestSetPropsRender();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=Te(this.store.options,"pen","params","context",n)}catch(n){console.error("[meta2d]: Error on make a function:",n,"code:",i.value)}(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=ot(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)=>{var s;const a=ot(i.value);if(a&&typeof a=="object"){const n=i.params?this.findOne(i.params):t;let r=[];for(let o in a){let l={dataId:o,value:a[o]};if(!l.value){let u=(s=n.form)==null?void 0:s.find(c=>c.dataIds&&c.dataIds.dataId===l.dataId);u&&(l.value=n[u.key])}r.push(l)}this.doSendDataEvent(r,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 o=(a=i.params.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(l=>l.slice(2,-1));o&&(o==null||o.forEach(l=>{s=s.replace(`\${${l}}`,Ne(t,l)||this.getDynamicParam(l))}))}const n=i.extend||{};Object.keys(n).forEach(o=>{["x","y","width","height","relative","pen"].includes(o)||(s.indexOf("?")!==-1?s+=`&${o}=${n[o]}`:s+=`?${o}=${n[o]}`)});let r=this.getEventData(i.list,t);Object.keys(r).length&&(r=null),this.canvas.dialog.show(i.value,s,i.extend?{...n,pen:t}:void 0,r)}},this.events[he.SendData]=(t,i)=>{var s,n,r,o,l;if((s=i.data)!=null&&s.length){const u=this.getSendData(i.data,t);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=pE(this,t,i);c.length&&wE(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=ot(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]=Ne(u,c);else if(typeof a[c]=="string"&&((r=a[c])==null?void 0:r.indexOf("${"))>-1){let d=(o=a[c].match(/\$\{([^}]+)\}/g))==null?void 0:o.map(f=>f.slice(2,-1));d!=null&&d.length&&(a[c]=(l=Ne(u,c[0]))!=null?l:this.getDynamicParam(d[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(!["iframe","htmlDom"].includes(a.name)&&!a.iframe){console.warn("\u4E0D\u662F\u5D4C\u5165\u9875\u9762");return}let n={};a.iframe?n=Ps(a.iframe.split("?")[1]):n={id:a.id};let r=this.getSendData(i.data,t);i.list&&(r=this.getEventData(i.list,t)),a.calculative.singleton.div.children[0].contentWindow.postMessage(JSON.stringify({name:i.value,id:n.id,data:r}),"*")},this.events[he.PostMessageToParent]=(t,i)=>{if(typeof i.value!="string"){console.warn("[meta2d] Emit value must be a string");return}let a=this.getSendData(i.data,t);i.list&&(a=this.getEventData(i.list,t)),window.parent.postMessage(JSON.stringify({name:i.value,data:a}),"*")},this.events[he.Message]=(t,i,a)=>{let s=i.params,n=i.value;!n&&a&&a.type==="http"&&(n=a.error.statusText,s||(s="error")),this.message({theme:s,content:n,...i.extend})}}getSendData(t,i){const a={};return t==null||t.forEach(s=>{var n;if(s.prop)if(s.id&&s.id!=="\u56FA\u5B9A\u503C"){const r=this.findOne(s.id);a[s.prop]=Ne(r,s.key)}else if(typeof s.value=="string"&&s.value.includes("${")){let r=s.value,o=(n=r.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(l=>l.slice(2,-1));o&&o.forEach(l=>{r=r.replace(`\${${l}}`,Ne(i,l)||this.getDynamicParam(l))}),a[s.prop]=r}else a[s.prop]=this.convertType(s.value,s.type)}),a}convertType(t,i){var a;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)}else if(typeof t=="object"){let s=JSON.stringify(t),n=(a=s.match(/\$\{([^}]+)\}/g))==null?void 0:a.map(r=>r.slice(2,-1));if(n!=null&&n.length)for(let r=0;r<n.length;r++)s=s.replace(`\${${n[r]}}`,this.getDynamicParam(n[r]));return JSON.parse(s)}return t}getEventData(t,i){const a={};return t!=null&&t.length&&t.forEach(s=>{var r,o,l;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=(o=s.value[u].match(/\$\{([^}]+)\}/g))==null?void 0:o.map(d=>d.slice(2,-1));c!=null&&c.length&&(a[u]=(l=n[c[0]])!=null?l:this.getDynamicParam(c[0]))}else a[u]=s.value[u]}),Object.keys(a).length?a:{}}message(t){new gE(this.canvas.parentElement,t).init()}closeAll(){for(let t in si)si[t].close()}async navigatorTo(t){var s,n;if(!t)return;if((s=Ps())==null?void 0:s.id){const r=new URL(window.location);r.searchParams.set("id",t),history.pushState({},"",r)}const a=await qc(this.store,t);if(a){a.locked=1,(n=a.fits)!=null&&n.length&&(globalThis.meta2dData=JSON.stringify(a)),this.canvas.opening=!0,this.open(a),this.lock(1);const r=this.store.data.width||this.store.options.width,o=this.store.data.height||this.store.options.height;r&&o?this.fitSizeView(!0,0):this.fitView(!0,10),this.render(!0)}}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,o,l,u,c;const s=ot(a.network);if(s.data&&(Object.assign(s,s.data),delete s.data),s.protocol==="iot"){if(this.store.data.iot.room){let d={token:this.store.data.iot.token,data:t};if(t.name){const f=Object.keys(t).filter(g=>t[g]==="aggregate");if(f.length){const g=ot(t);f.forEach(y=>{delete g[y]}),delete g.name,g.start&&typeof g.start=="string"&&(g.start=Math.floor(new Date(g.start).getTime()/1e3)),g.end&&typeof g.end=="string"&&(g.end=Math.floor(new Date(g.end).getTime()/1e3));let m=[];f.forEach(y=>{let p=y.split("#");m.push({token:this.store.data.iot.token,deviceId:p[0],key:p[1],name:p[1]+"_"+t.name,...g})}),this.iotMqttClient&&this.iotMqttClient.publish(`le5le-iot/${this.store.data.iot.room}/property/aggregate`,JSON.stringify(m));return}}this.iotMqttClient&&this.iotMqttClient.publish(`le5le-iot/${this.store.data.iot.room}/properties/set`,JSON.stringify(d))}else 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),y=(r=m.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(p=>p.slice(2,-1));if(y!=null&&y.length)for(let p=0;p<y.length;p++)m=m.replace(`\${${y[p]}}`,this.getDynamicParam(y[p]));s.headers=JSON.parse(m)}let d,f=s.url;if(s.method==="GET"&&Object.keys(t).length!==0&&(f.includes("?")?d="&"+Object.keys(t).map(m=>m+"="+t[m]).join("&"):d="?"+Object.keys(t).map(m=>m+"="+t[m]).join("&")),f.indexOf("${")>-1){let m=(o=f.match(/\$\{([^}]+)\}/g))==null?void 0:o.map(y=>y.slice(2,-1));m&&m.forEach(y=>{f=f.replace(`\${${y}}`,Ne(i,y)||this.getDynamicParam(y))})}const g=await fetch(f+(d||""),{headers:s.headers||{},method:s.method,body:s.method==="POST"?JSON.stringify(t):void 0});if(g.ok){if(a.callback){const m=await g.text();if(!a.fn)try{if(typeof a.callback!="string")throw new Error("[meta2d] Function callback must be string");const y=a.callback;a.fn=Te(this.store.options,"pen","data","context",y)}catch(y){console.error("[meta2d]: Error on make a function:",y,"code:",a.callback)}(l=a.fn)==null||l.call(a,i,m,{meta2d:this,e:a})}console.info("http\u6D88\u606F\u53D1\u9001\u6210\u529F")}else this.store.emitter.emit("error",{type:"http",error:g})}else if(s.protocol==="mqtt"){const d=(u=this.mqttClients)==null?void 0:u.filter(f=>f.options.href===s.url);if(d&&d.length)d[0].connected&&s.topics.split(",").forEach(f=>{d[0].publish(f,JSON.stringify(t))});else{let f=yn.exports.connect(s.url,s.options);f.on("connect",()=>{console.info("mqtt\u8FDE\u63A5\u6210\u529F"),s.topics.split(",").forEach(g=>{f.publish(g,JSON.stringify(t)),setTimeout(()=>{f==null||f.end()},1e3)})})}}else if(s.protocol==="websocket"){const d=(c=this.websockets)==null?void 0:c.filter(f=>f.url===s.url);if(d&&d.length)d[0].readyState===1&&d[0].send(JSON.stringify(t));else{let f=new WebSocket(s.url,s.protocols||void 0);f.onopen=function(){console.info("websocket\u8FDE\u63A5\u6210\u529F"),f.send(JSON.stringify(t)),setTimeout(()=>{f.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)}addPenSync(t,i,a=!0,s=!0){return this.canvas.addPenSync(t,i,a,s)}addPensSync(t,i,a=!0){return this.canvas.addPensSync(t,i,a)}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)}requestSetPropsRender(){this.setPropsRenderPending||(this.setPropsRenderPending=!0,requestAnimationFrame(()=>{this.setPropsRenderPending=!1,this.render(!1)}))}async setBackgroundImage(t,i){var o,l,u,c;let a=this;async function s(d){return new Promise(f=>{const g=new Image;g.src=d,a.store.options.cdn&&!(d.startsWith("http")||d.startsWith("//")||d.startsWith("data:image"))&&(g.src=a.store.options.cdn+d),g.crossOrigin=a.store.options.crossOrigin||"anonymous",g.onload=()=>{f(g)}})}this.store.data.bkImage=t;const n=(i==null?void 0:i.width)||((o=this.store.data)==null?void 0:o.width)||((l=this.store.options)==null?void 0:l.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 d=await s(t);this.store.bkImg=d,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,gridType:n=this.store.data.gridType,gridScope:r=this.store.data.gridScope}={}){this.store.data.grid=t,this.store.data.gridColor=i,this.store.data.gridSize=a<0?0:a,this.store.data.gridRotate=s,this.store.data.gridType=n,this.store.data.gridScope=r,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.fillViewSnapshot=null,this.canvas.autoPolylineFlag=!0,t){t.theme&&this.setTheme(t.theme),t_(t.pens),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=Tt()),!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=Tt()),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)K2(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 o=i[r];if(o.parentId){const l=this.store.pens[o.parentId];(o.x>10||o.y>10||o.width>10||o.height>10||!l.children||!l.children.includes(o.id))&&n.push(o)}if(a&&s){let l=this.getPenRect(o);(l.x<-10||l.y<-10||l.x+l.width>a||l.y+l.height>s)&&n.push(o)}o.name==="line"&&o.anchors.length<2&&n.push(o)}return(!a||!s)&&K6(i).forEach(o=>{n.filter(u=>u.id===o.id).length||n.push(o)}),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:ot(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,wt.path2dDraws[a.name]&&this.store.path2dMap.set(a,wt.path2dDraws[a.name](a)),a.type&&this.store.path2dMap.set(a,wt.path2dDraws[a.name](a)),a.image&&(a.calculative.imageDrawed=!1,this.canvas.loadImage(a))}),this.render())}loadLineAnimateDraws(){wt.lineAnimateDraws={},Object.entries(this.store.data.lineAnimateDraws).forEach(([t,i])=>{wt.lineAnimateDraws[t]=Te(this.store.options,"ctx","pen","state","index",i)})}statistics(){const t=this.store.data.pens.length,i=this.store.data.pens.filter(o=>o.image).length,a=this.store.data.pens.filter(o=>o.image&&o.calculative.inView).length,s=this.store.data.pens.filter(o=>o.name.endsWith("Dom")||bc.includes(o.name)||this.store.options.domShapes.includes(o.name)||o.externElement||o.isDom).length,n=this.store.animates.size;let r=0;return Object.keys(this.store.bind).forEach(o=>{r+=this.store.bind[o].length}),Object.keys(this.store.bindDatas).forEach(o=>{r+=this.store.bindDatas[o].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=[],a=[];this.store.data.pens.forEach(s=>{var n,r;(n=s.realTimes)==null||n.forEach(o=>{var l;if(o.bind&&o.bind.id){const u=(l=this.store.data.networks)==null?void 0:l.some(m=>m.protocol==="ADIIOT");let c=o.productId||s.productId,d=o.deviceId||s.deviceId,f=o.propertyId,g=!1;if(u){if(c&&typeof c=="string"&&c.indexOf("${")>-1){let m=c.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));m!=null&&m.length&&(c=this.getDynamicParam(m[0])||c),g=!0}if(d&&typeof d=="string"&&d.indexOf("${")>-1){let m=d.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));m!=null&&m.length&&(d=this.getDynamicParam(m[0])||d),g=!0}if(f&&typeof f=="string"&&f.indexOf("${")>-1){let m=f.match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));m!=null&&m.length&&(f=this.getDynamicParam(m[0])||f),g=!0}g&&o.bind&&(o.bind.id=c+"#"+d+"#"+f)}if(this.store.bind[o.bind.id]||(this.store.bind[o.bind.id]=[]),this.store.bind[o.bind.id].push({id:s.id,key:o.key}),u&&c&&d&&f){const m=this.jetLinksList.findIndex(y=>y.topic.startsWith(`/${c}/${d}`));m>-1?this.jetLinksList[m].properties.includes(o.propertyId)||this.jetLinksList[m].properties.push(o.propertyId):this.jetLinksList.push({topic:`/${c}/${d}`,deviceId:d,properties:[o.propertyId]})}if(o.bind.class==="iot")if(o.bind.compute_name){a.findIndex(p=>p.id===o.bind.id)===-1&&a.push(ot(o.bind));let y=t.findIndex(p=>p.deviceId===o.bind.deviceId);y>-1?t[y].properties.includes(o.bind.key)||t[y].properties.push(o.bind.key):t.push({deviceId:o.bind.deviceId,properties:[o.bind.key],token:o.bind.token})}else{let m=o.bind.id.split("#"),y=t.findIndex(x=>x.deviceId===m[0]);y>-1?t[y].properties.includes(m[1])||t[y].properties.push(m[1]):t.push({deviceId:m[0],properties:[m[1]],token:o.bind.token}),i.findIndex(x=>x.key===o.bind.id)===-1&&i.push({key:o.bind.id,label:o.bind.label})}else if(o.bind.class==="sql"){let m=o.bind.id.split("#");const y=this.store.data.sqls.find(p=>p.bindId===m[0]);if(y){y.keys||(y.keys=[]),m.shift();const p=m.join("#");y.keys.includes(p)||y.keys.push(p)}}}}),(r=s.events)==null||r.forEach(o=>{var u;const l=(u=o.actions)==null?void 0:u.filter(c=>c.action===he.SendData);l==null||l.forEach(c=>{var d;(d=c.data)==null||d.forEach(f=>{if(f.class==="iot"){let g=f.prop.split("#"),m=t.findIndex(y=>y.deviceId===g[0]);m>-1?t[m].properties.includes(g[1])||t[m].properties.push(g[1]):t.push({deviceId:g[0],properties:[g[1]],token:f.token})}})})})}),this.store.data.iot||(this.store.data.iot={}),t.length?this.store.data.iot.devices=t:delete this.store.data.iot.devices,i.length?this.store.data.iot.list=i:delete this.store.data.iot.list,a.length&&(this.store.data.iot.computes=a)}connectSocket(){this.connectWebsocket(),this.connectMqtt(),this.connectHttp()}doInitJS(){const t=this.store.data.initJs;if(t&&t.trim())try{let i=Te(this.store.options,"context",t);i({meta2d:this}),i=null}catch(i){console.warn("initJs error",i)}}doInitFn(){let t=Ps(),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&&v0(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&&Pe(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=ce(t),s=jt(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);z2(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 wt.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){let a;t?typeof t=="string"?(a=this.find(t),a.forEach(s=>{(!s.calculative.pause||s.currentAnimation!==i)&&this.stopAnimate([s])})):(a=t,a.forEach(s=>{(!s.calculative.pause||s.currentAnimation!==i)&&this.stopAnimate([s])})):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 o=Date.now()-s.calculative.pause;s.calculative.pause=void 0,s.calculative.frameStart+=o,s.calculative.frameEnd+=o}else{let o=-1;if(i!==void 0&&s.animations){if(typeof i=="string"){if(o=s.animations.findIndex(l=>l.name===i),o===-1)return}else if(typeof i=="number")if(s.animations.length>i)o=i;else return}else i===void 0&&(o=(n=s.animations)==null?void 0:n.findIndex(l=>l.autoPlay),o===-1&&((r=s.animations)==null?void 0:r.length)&&(o=0));if(o!==-1&&o!==void 0){const l=ot(s.animations[o]);l.animateCycle||(l.animateCycle=0),l.animateName=l.name,delete l.name,l.currentAnimation=o,!s.type&&l.frames&&(l.showDuration=this.calcAnimateDuration(l)),this.setValue({id:s.id,...l},{doEvent:!1,history:!1,render:!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),this.store.data.locked===It.None&&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=ot(t);if(t.length===1&&t[0].type){t[0].type=Ut.Node,this.canvas.active(t),this.pushHistory({type:_t.Update,initPens:s,pens:ot(t,!0)}),this.render();return}const n=Ei(t);let r={id:Tt(),name:"combine",...n,children:[],showChild:i};this.canvas.makePen(r);const o=ot(r);let l=1/0;return t.forEach(u=>{var f;const c=this.store.data.pens.findIndex(g=>g.id===u.id);if(c<l&&(l=c),u===r||u.parentId===r.id||u.id===r.id)return;r.children.push(u.id),u.parentId=r.id;const d=wa(u.calculative.worldRect,n);Object.assign(u,d),u.locked=(f=u.lockedOnCombine)!=null?f:It.None,u.locked=u.interaction||Gl.includes(u.name)?0:u.locked}),this.store.data.pens.splice(l,0,r),this.store.data.pens.pop(),a&&this.canvas.active([r]),this.pushHistory({type:_t.Add,pens:[o],step:3}),this.pushHistory({type:_t.Update,initPens:[o],pens:[r],step:3}),this.pushHistory({type:_t.Update,initPens:s,pens:t,step:3}),i!=null&&(t.forEach(u=>{Di(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=ot(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=It.None,n.calculative.active=void 0,n.calculative.hover=!1,this.setVisible(n,!0)});const s=this.isCombine(t)?3:2;this.pushHistory({type:_t.Update,initPens:a,pens:i,step:s}),a=[ot(t)],this.inactive(),t.children=void 0,this.pushHistory({type:_t.Update,initPens:a,pens:[t],step:s}),this.isCombine(t)&&(this.delete([t]),this.store.histories[this.store.histories.length-1].step=s)}clearCombine(t){if(!t&&this.store.active&&(t=this.store.active[0]),!t||!t.children)return;const i=Le(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=It.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=Ei(t);Object.assign(a,s),Object.assign(a.calculative.worldRect,s),Is(a),a.children.forEach(n=>{const r=this.store.pens[n],o=wa(r.calculative.worldRect,s);Object.assign(r,o)}),t.forEach(n=>{var r;if(n.id!==a.id){a.children.push(n.id),n.parentId=a.id;const o=wa(n.calculative.worldRect,s);Object.assign(n,o),n.locked=(r=n.lockedOnCombine)!=null?r:It.DisableMove,n.locked=n.interaction||Gl.includes(n.name)?0:n.locked,Di(n,!0)}}),this.initImageCanvas(t),this.render()}else console.warn("Invalid operation!")}updateRectbyChild(t,i,a){if(re(t),te(t),i.calculative.worldRect=t,a.container&&ea(t,a.calculative.worldRect,!0)){const s=wa(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),o=Math.max(t.ey,a.calculative.worldRect.ey);a.calculative.worldRect={x:s,y:n,width:r-s,height:o-n,ex:r,ey:o},te(a.calculative.worldRect)}else{const s=a.children.map(n=>this.store.pens[n]);a.calculative.worldRect=Ei(s)}a.parentId||Object.assign(a,a.calculative.worldRect),a.children.forEach(s=>{const n=this.store.pens[s],r=wa(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!==It.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)}deleteSync(t,i=!1,a=!0){this.canvas.deleteSync(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 We(t,i)}getAllChildren(t){return Le(t,this.store)}getAllFollowers(t){return Xc(t,this.store)}data(){this.initBinds();const t=ot(this.store.data),{pens:i,paths:a}=this.store.data;t.version=Bg.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=Te(this.store.options,"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){if(this.closeWebsocket(),t&&(this.store.data.websocket=t),this.store.data.websocket){try{this.websocket=new WebSocket(this.store.data.websocket,this.store.data.websocketProtocols||void 0)}catch(i){this.store.emitter.emit("error",{type:"websocket",error:i});return}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=Tt());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=yn.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=ot(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 o=>{o.protocol==="mqtt"?(o.index=a,this.connectNetMqtt(o),a+=1):o.protocol==="websocket"?(o.index=n,this.connectNetWebSocket(o),n+=1):o.protocol==="http"?(o.index=s,i.push({url:o.url,interval:o.interval,headers:o.headers||void 0,method:o.method,body:o.body,enable:o.enable,index:o.index,once:o.once}),s+=1):o.protocol==="ADIIOT"?vE(this,o):o.protocol==="SSE"&&(o.index=r,this.connectSSE(o),r+=1)})}this.onNetworkConnect(i),this.connectIot(),this.connectSqls()}reconnectNetwork(t){var a,s,n;const i=(a=this.store.data.networks)==null?void 0:a[t];if(!!i)if(i.protocol==="mqtt")this.mqttClients&&((s=this.mqttClients[i.index])==null||s.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 r=ot(i);this.store.data.cancelFirstConnect||this.requestHttp(r),i.interval!==0&&(this.updateTimerList[i.index]=setInterval(async()=>{this.requestHttp(r)},r.interval||1e3))}else i.protocol==="SSE"&&(this.eventSources&&((n=this.eventSources[i.index])==null||n.close(),this.eventSources[i.index]=void 0),this.connectSSE(i))}async connectIot(){var u,c;const{iot:t}=this.store.data;if(!(t&&((u=t==null?void 0:t.devices)==null?void 0:u.length))||t&&t.enable===!1)return;let{url:i,password:a,username:s}=await this.getMqttUrl();if(i||(i=globalThis.iotUrl),!i){console.warn("iot Request address error");return}const{token:n,room:r,data:o}=await this.getIotToken(t.devices,t.protocol==="websocket"?1:void 0,t.room);o&&this.socketCallback(JSON.stringify(o),{type:"iot",url:i,method:"mqtt"}),r&&(t.room=r),t.token=n;const l={username:s,password:a,clientId:"client-"+Math.random().toString(16).slice(2,8)};if(this.iotMqttClient=yn.exports.connect(i,l),this.iotMqttClient.on("message",(d,f)=>{this.socketCallback(f.toString(),{topic:`le5le-iot/properties/${n}`,type:"iot",url:i,method:"mqtt"})}),this.iotMqttClient.on("error",d=>{this.store.emitter.emit("error",{type:"mqtt",error:d})}),t.room?this.iotMqttClient.subscribe(`le5le-iot/${t.room}/properties/get`):this.iotMqttClient.subscribe(`le5le-iot/properties/${n}`),this.iotTimer=setInterval(()=>{t.room?this.iotMqttClient&&this.iotMqttClient.publish("le5le-iot/subscribe/ping",t.room):this.iotMqttClient&&this.iotMqttClient.publish("le5le-iot/subscribe/ping",n)},3e5),(c=this.store.data.iot.computes)!=null&&c.length){let d=!1;this.store.data.iot.computes.forEach(f=>{f.times>0&&(d=!0)}),this.iotAggregatePublish(this.store.data.iot.computes),t.times=0,d&&(t.interval=setInterval(()=>{t.times+=1;let f=this.store.data.iot.computes.filter(g=>g.times&&t.times%g.times===0);f.length&&this.iotAggregatePublish(f)},1e3))}}iotAggregateBuild(t){let i={token:this.store.data.iot.token,deviceId:t.deviceId,key:t.key,name:t.key+"_"+t.compute_name};return["aggregate","start","end","groupBy","limit","recent"].forEach(a=>{if(t[a])if(t[a].indexOf("${")>-1){let s=t[a].match(new RegExp("(?<=\\$\\{).*?(?=\\})","g"));i[a]=this.getDynamicParam(s[0])}else(a==="start"||a==="end")&&typeof t[a]=="string"?i[a]=Math.floor(new Date(t[a]).getTime()/1e3):i[a]=t[a]}),i}iotAggregatePublish(t){if(this.iotMqttClient){let i=t.map(a=>this.iotAggregateBuild(a));this.iotMqttClient.publish(`le5le-iot/${this.store.data.iot.room}/property/aggregate`,JSON.stringify(i))}}closeIot(){if(this.iotMqttClient){const{iot:t}=this.store.data;t.interval&&(clearInterval(t.interval),t.interval=void 0),t!=null&&t.token&&this.unsubscribeIot(t.token,t.room),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)))})}async connectSSE(t){if(t.enable!==!1){if(t.preJs&&(t.preFn||(t.preFn=Rr(this.store.options,"network",t.preJs)),t.preFn)){const i=await t.preFn(t);i&&(t=i)}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)})}async connectNetMqtt(t){var s,n,r;if(t.enable===!1)return;if(t.preJs&&(t.preFn||(t.preFn=Rr(this.store.options,"network",t.preJs)),t.preFn)){const o=await t.preFn(t);o&&(t=o)}t.options.clientId&&!t.options.customClientId&&(t.options.clientId=Tt());let i=t.url;if(i.indexOf("${")>-1){let o=(s=i.match(/\$\{([^}]+)\}/g))==null?void 0:s.map(l=>l.slice(2,-1));o&&o.forEach(l=>{i=i.replace(`\${${l}}`,this.getDynamicParam(l))})}t.times=0;let a=ot(t.options);if((a==null?void 0:a.username)&&a.username.includes("${")){let o=(n=a.username.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(l=>l.slice(2,-1));o&&o.forEach(l=>{a.username=a.username.replace(`\${${l}}`,this.getDynamicParam(l))})}if((a==null?void 0:a.password)&&a.password.includes("${")){let o=(r=a.password.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(l=>l.slice(2,-1));o&&o.forEach(l=>{a.password=a.password.replace(`\${${l}}`,this.getDynamicParam(l))})}a.hasOwnProperty("keepalive")||Object.assign(a,{keepallive:30}),a.hasOwnProperty("reconnectPeriod")||Object.assign(a,{reconnectPeriod:5e3}),a.hasOwnProperty("connectTimeout")||Object.assign(a,{connectTimeout:10*1e3}),this.mqttClients[t.index]=yn.exports.connect(i,a),this.mqttClients[t.index].on("message",(o,l)=>{this.socketCallback(l.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("connect",o=>{var l;if(!o.sessionPresent&&t.topics){let u=t.topics;if(u.indexOf("${")>-1){let c=(l=u.match(/\$\{([^}]+)\}/g))==null?void 0:l.map(d=>d.slice(2,-1));c&&c.forEach(d=>{u=u.replace(`\${${d}}`,this.getDynamicParam(d))})}this.mqttClients[t.index].subscribe(u.split(","),{qos:1},c=>{c&&console.error("\u8BA2\u9605\u5931\u8D25\uFF1A",c)})}})}async 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;if(t.preJs&&(t.preFn||(t.preFn=Rr(this.store.options,"network",t.preJs)),t.preFn)){const n=await t.preFn(t);n&&(t=n)}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:vn()}});if(t.ok){const i=await t.text();let a=JSON.parse(i);return a.wssPort||a.wsPort?{username:a.username,password:a.password,url:`${location.protocol==="https:"?"wss":"ws"}://${a.host}:${location.protocol==="https:"?a.wssPort:a.wsPort}${a.path}`}:void 0}}async getIotToken(t,i,a){const s=await fetch("/api/iot/subscribe/properties",{method:"POST",headers:{Authorization:vn()},body:JSON.stringify({devices:t,type:i,room:a})});if(s.ok)return await s.json()}async unsubscribeIot(t,i){return await fetch("/api/iot/unsubscribe/properties",{method:"POST",headers:{Authorization:vn()},body:JSON.stringify({token:t,room:i})})}async doSqlCode(t){var n;const i=t.method||"get";let a=t.sql;i==="list"&&t.pageSize!==-1&&(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:vn()},body:JSON.stringify({dbId:t.dbId||t.dbid,sql:a})});if(s.ok){let r=await s.text();if(r){const o=[];if(r=JSON.parse(r),r.error){this.store.emitter.emit("error",{type:"sql",error:r.error});return}(n=t.keys)==null||n.forEach(l=>{o.push({id:t.bindId+"#"+l,value:Ne(r,l.split("#").join("."))})}),o.push({id:t.bindId,value:r}),this.socketCallback(JSON.stringify(o),{type:"sql",url:`/api/iot/data/sql/${i}`,method:i,net:t})}}}randomString(t){t=t||32;let i="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",a=i.length,s="";for(let n=0;n<t;n++)s+=i.charAt(Math.floor(Math.random()*a));return s}mockValue(t){let i;if(t.enableMock&&t.mock!==void 0)if(t.type==="float")if(t.mock&&t.mock.indexOf(",")!==-1){let a=t.mock.split(","),s=Math.floor(Math.random()*a.length);i=parseFloat(a[s])}else if(t.mock&&t.mock.indexOf("-")!==-1){let a,s,n,r=t.mock.split("-");if(t.mock.charAt(0)==="-"?r.length===4?(a=-parseFloat(r[3]),s=-parseFloat(r[1]),n=r[3]):(a=parseFloat(r[2]),s=-parseFloat(r[1]),n=r[2]):(a=parseFloat(r[1]),s=parseFloat(r[0]),n=r[1]),(n+"").indexOf(".")!==-1){let o=(n+"").split(".")[1].length;i=(Math.random()*(a-s)+s).toFixed(o)}else i=Math.random()*(a-s)+s}else i=parseFloat(t.mock);else if(t.type==="integer")if(t.mock&&t.mock.indexOf(",")!==-1){let a=t.mock.split(","),s=Math.floor(Math.random()*a.length);i=parseInt(a[s])}else if(t.mock&&t.mock.indexOf("-")!==-1){let a,s,n=t.mock.split("-");t.mock.charAt(0)==="-"?n.length===4?(a=-parseFloat(n[3]),s=-parseFloat(n[1])):(a=parseFloat(n[2]),s=-parseFloat(n[1])):(a=parseInt(n[1]),s=parseInt(n[0])),i=parseInt(Math.random()*(a-s)+s+"")}else i=parseInt(t.mock);else if(t.type==="bool")typeof t.mock=="boolean"?i=t.mock:t.mock==="true"?i=!0:t.mock==="false"?i=!1:i=Math.random()<.5;else if(t.type==="object"||t.type==="array")t.mock;else if(t.mock&&t.mock.indexOf(",")!==-1){let a=t.mock.split(","),s=Math.floor(Math.random()*a.length);i=a[s]}else if(t.mock&&t.mock.startsWith("[")&&t.mock.endsWith("]")){let a=parseInt(t.mock.substring(1,t.mock.length-1));i=this.randomString(a)}else i=t.mock;return i}dataMock(){var i,a;let t=[];(a=(i=this.store.data.dataset)==null?void 0:i.devices)==null||a.forEach(s=>{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=ot(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){if(!t.apiUrl)return;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){var n,r;let i=localStorage.getItem(t);return globalThis.le5leTokenD&&[(n=globalThis.le5leSSOTokenName)!=null?n:"ssotoken",(r=globalThis.le5leTokenName)!=null?r:"token"].includes(t)&&(i=Ng(i)),Ps()[t]||i||io(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 s,n,r,o;let i=ot(t);const a=(s=this.store.data.networks)==null?void 0:s.filter(l=>l.protocol==="http")[i.index];if(a!=null&&a.preJs&&(a.preFn||(a.preFn=Rr(this.store.options,"network",a.preJs)),a.preFn)){const l=await a.preFn(i);l&&(i=l)}if(i.url){if(i.url.indexOf("${")>-1){let u=(n=i.url.match(/\$\{([^}]+)\}/g))==null?void 0:n.map(c=>c.slice(2,-1));u&&u.forEach(c=>{i.url=i.url.replace(`\${${c}}`,this.getDynamicParam(c))})}if(typeof i.headers=="object"){let u=JSON.stringify(i.headers),c=(r=u.match(/\$\{([^}]+)\}/g))==null?void 0:r.map(d=>d.slice(2,-1));if(c!=null&&c.length)for(let d=0;d<c.length;d++)u=u.replace(`\${${c[d]}}`,this.getDynamicParam(c[d]));i.headers=JSON.parse(u)}if(typeof i.body=="object"){let u=JSON.stringify(i.body),c=(o=u.match(/\$\{([^}]+)\}/g))==null?void 0:o.map(d=>d.slice(2,-1));if(c!=null&&c.length)for(let d=0;d<c.length;d++)u=u.replace(`\${${c[d]}}`,this.getDynamicParam(c[d]));i.body=JSON.parse(u)}const l=await fetch(i.url,{headers:i.headers,method:i.method,body:i.method==="GET"?void 0:JSON.stringify(i.body)});if(l.ok){const u=await l.text();this.socketCallback(u,{type:"http",method:i.method,url:i.url,name:i.name,net:a})}else t.times++,this.store.emitter.emit("error",{type:"http",error:l})}}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(),yE(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=Te(this.store.options,"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,net:i.net}),!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(o){console.warn("Invalid socket data:",s,o)}else return;if(!!s){if(!Array.isArray(s)&&s.constructor===Object&&!s.id&&!s.dataId&&!s.tag){const o=Object.keys(s).map(l=>({dataId:l,id:l,value:s[l]}));o.length&&(this.setDatas(o,{render:!1}),this.render(!0));return}Array.isArray(s)||(s=[s]),s.length&&(s[0].dataId?this.setDatas(s,{render:!1}):s.forEach(o=>{this.setValue(o,{render:!1})}),this.render(!0))}}setDatas(t,{render:i=!0,doEvent:a=!0,history:s}={}){const n=new Map;t.forEach(u=>{var c,d;(c=this.store.bindDatas[u.dataId])==null||c.forEach(f=>{const g=this.store.pens[f.id];if(!g)return;let m=n.get(g);if(!g.noOnBinds&&typeof g.onBinds=="function"){if(m)return;n.set(g,g.onBinds(g,t,f.formItem));return}m?m[f.formItem.key]=u.value:(m={id:f.id,[f.formItem.key]:u.value},n.set(g,m))}),(d=this.store.bind[u.id||u.dataId])==null||d.forEach(f=>{const g=this.store.pens[f.id];if(!g)return;let m=n.get(g);m?m[f.key]=u.value:(m={id:f.id,[f.key]:u.value},n.set(g,m))})});let r,o;s&&(r=[],o=[]);const l=this.canvas.batchRendering;this.canvas.batchRendering=!0;try{this.store.data.locked&&this.doDataEvent(t),n.forEach((u,c)=>{!u||(s&&r.push(ot(c,!0)),this.updatePenValue(c,u),a&&this.store.emitter.emit("valueUpdate",c),s&&o.push(c))})}finally{this.canvas.batchRendering=l}i&&this.render(),s&&this.pushHistory({type:_t.Update,initPens:r,pens:o})}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 o=this.store.pens[t.id];if(o)n=[o];else{let l=this.store.bind[t.id];if(l&&l.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 o=[];for(let l in t)o.push({dataId:l,id:l,value:t[l]});o.length&&this.setDatas(o,{render:i,doEvent:a,history:s});return}s=s&&!this.store.data.locked;let r;if(s&&(r=ot(n)),n.forEach(o=>{this.updatePenValue(o,t)}),!this.store.data.locked&&this.store.active.length&&!this.canvas.movingPens&&this.canvas.calcActiveRect(),s){let o=ot(n);this.pushHistory({type:_t.Update,initPens:r,pens:o})}a&&n.forEach(o=>{this.store.emitter.emit("valueUpdate",o)}),i&&this.render()}updatePenValue(t,i){var s;if(t.name==="echarts"&&!t.onBeforeValue&&Object.keys(i).some(r=>xE.test(r)))return;const a=t.onBeforeValue?t.onBeforeValue(t,i):i;i.frames&&(this.stopAnimate([t]),i.showDuration||(i.showDuration=i.frames.reduce((n,r)=>n+r.duration,0))),Qc(t,a),this.canvas.updateValue(t,a),(s=t.onValue)==null||s.call(t,t)}_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=>{n.timeout?setTimeout(()=>{this.events[n.action]&&this.events[n.action](a.pen,n,i)},n.timeout):this.events[n.action]&&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:o,operator:l,valueType:u}=a;let c=!1;if(s==="fn"){if(o)c=o(t,{meta2d:this});else if(r){try{a.fn=Te(this.store.options,"data","context",r)}catch(d){console.error("Error: make function:",d)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{let d=a.value;u==="prop"&&(d=t[a.value]);let f=t[i];switch(l){case">":c=f>+d;break;case">=":c=f>=+d;break;case"<":c=f<+d;break;case"<=":c=f<=+d;break;case"=":case"==":c=f==d;break;case"!=":c=f!=d;break;case"[)":c=bs(+f,d);break;case"![)":c=!bs(+f,d);break;case"[]":c=xs(f,d);break;case"![]":c=!xs(f,d);break}}return c}judgeCondition(t,i,a){const{type:s,target:n,fnJs:r,fn:o,operator:l,valueType:u}=a;let c=!1;if(s==="fn"){if(o)c=o(t,{meta2d:this});else if(r){try{a.fn=Te(this.store.options,"pen","context",r)}catch(d){console.error("Error: make function:",d)}a.fn&&(c=a.fn(t,{meta2d:this}))}}else{let d=a.value;u==="prop"&&(d=this.store.pens[n][a.value]);let f=Ne(t,i);switch(["x","y","width","height"].includes(i)&&(f=this.getPenRect(t)[i]),l){case">":c=f>+d;break;case">=":c=f>=+d;break;case"<":c=f<+d;break;case"<=":c=f<=+d;break;case"=":case"==":c=f==d;break;case"!=":c=f!=d;break;case"[)":c=bs(+f,d);break;case"![)":c=!bs(+f,d);break;case"[]":c=xs(f,d);break;case"![]":c=!xs(f,d);break}}return c}pushChildren(t,i){const a=[ot(t,!0)],s=[];t.children||(t.children=[]);const n=[];i.forEach(o=>{var c;let l=ot(o,!0);if((!o.id||!this.store.pens[o.id])&&(this.canvas.makePen(o),l=null),o.parentId){const d=this.store.pens[o.parentId],f=d.children.findIndex(g=>g===o.id);a.push(ot(d,!0)),d.children.splice(f,1),n.push(ot(d,!0))}t.children.push(o.id),o.parentId=t.id;const u=wa(o.calculative.worldRect,t.calculative.worldRect);Object.assign(o,u),o.locked=(c=o.lockedOnCombine)!=null?c:It.DisableMove,o.locked=o.interaction||Gl.includes(o.name)?0:o.locked,l?(a.push(l),n.push(ot(o,!0))):s.push(ot(o,!0))}),n.push(ot(t,!0));let r=1;s.length&&(r=2,this.pushHistory({type:_t.Add,pens:s,step:r})),this.pushHistory({type:_t.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 o=this.store.options.downloadBgTransparent?void 0:this.store.data.background||this.store.styles.background;o&&i&&(r.save(),r.fillStyle=o,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),o&&!i&&(r.save(),r.fillStyle=o,r.fillRect(0,0,n.width+20,n.height+20),r.restore());for(const m of this.store.data.pens)m.visible==!1||!lo(m,this.store)||oo(r,m,n,!0);let l=r.getSerializedSvg();t!=null&&t.length&&(l=l.replace("<defs/>",`<defs>
  93. <style type="text/css">
  94. ${t.join(`
  95. `)}
  96. </style>
  97. {{bk}}
  98. </defs>
  99. {{bkRect}}`)),o?(l=l.replace("{{bk}}",""),l=l.replace("{{bkRect}}",`<rect x="0" y="0" width="100%" height="100%" fill="${o}"></rect>`)):(l=l.replace("{{bk}}",""),l=l.replace("{{bkRect}}","")),l=l.replace(/--le5le--/g,"&#x");const u=window.URL,c=new Blob([l]),d=u.createObjectURL(c),f=document.createElement("a");f.setAttribute("download",`${this.store.data.name||"le5le.meta2d"}.svg`),f.setAttribute("href",d);const g=document.createEvent("MouseEvents");g.initEvent("click",!0,!0),f.dispatchEvent(g)}getRect(t=this.store.data.pens){return Ei(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,a=!0){var f,g;if(!this.hasView())return;const{canvas:s}=this.canvas,{offsetWidth:n,offsetHeight:r}=s;this.resize(n,r);const o=Qi(i),l=this.getRect(),u=(n-o[1]-o[3])/l.width,c=(r-o[0]-o[2])/l.height;let d=u;t?d=u>c?c:u:d=u>c?u:c,a&&((f=this.store.data.fits)==null?void 0:f.length)&&(this.canvas.opening=!0),this.scale(d*this.store.data.scale),this.centerView(),a&&((g=this.store.data.fits)==null?void 0:g.length)&&this.fillView()}fillView(){var u,c,d,f;if(this.store.options.unFill)return;let t={x:this.store.data.origin.x,y:this.store.data.origin.y,width:this.store.data.width*this.store.data.scale,height:this.store.data.height*this.store.data.scale};(isNaN(t.width)||isNaN(t.height))&&(t=this.getRect());const i=new Set;(u=this.store.data.fits)==null||u.forEach(g=>{var m;(m=g.children)==null||m.forEach(y=>i.add(y))});const a=(g,m,y)=>{var p,x;!g||g.name!=="tablePlus"||y!=null&&y.has(g.id)||(y==null||y.add(g.id),g.colWidth=((p=g.colWidth)!=null?p:150)*m,(x=g.styles)==null||x.forEach(_=>{_.width&&(_.width*=m)}))},s=(g,m,y)=>{var p;a(g,m,y),(p=g.children)!=null&&p.length&&Le(g,this.store).forEach(x=>{a(x,m,y)})},{origin:n,scale:r}=this.store.data;if(this.fillViewSnapshot)this.fillViewSnapshot.forEach((g,m)=>{var p,x,_,b;const y=this.store.pens[m];!y||(g.colWidth!==void 0&&(y.colWidth=g.colWidth),g.styleWidths&&((p=y.styles)==null||p.forEach((C,P)=>{g.styleWidths[P]!==void 0&&(C.width=g.styleWidths[P])})),!g.onlyTablePlus&&(y.x=n.x+g.x*r,y.y=n.y+g.y*r,y.width=g.width*r,y.height=g.height*r,g.textWidth!==void 0&&(y.textWidth=g.textWidth*r),g.imageRatio!==void 0&&(y.imageRatio=g.imageRatio),g.ratio!==void 0&&(y.ratio=g.ratio),(y.name==="iframe"||y.name==="htmlDom")&&g.operationalRect&&(y.operationalRect=ot(g.operationalRect),(x=y.onBeforeValue)==null||x.call(y,y,{operationalRect:y.operationalRect})),this.canvas.updatePenRect(y,{worldRectIsReady:!1}),y.externElement&&((_=y.onResize)==null||_.call(y,y)),(b=y.children)!=null&&b.length&&Le(y,this.store).forEach(C=>{var P;C.externElement&&((P=C.onResize)==null||P.call(C,C))})))});else{this.fillViewSnapshot=new Map;const g=(m,y=!1)=>{var x;const p=m.calculative.worldRect;this.fillViewSnapshot.set(m.id,{onlyTablePlus:y,x:y?void 0:(p.x-n.x)/r,y:y?void 0:(p.y-n.y)/r,width:y?void 0:p.width/r,height:y?void 0:p.height/r,textWidth:!y&&m.textWidth!=null?m.textWidth/r:void 0,colWidth:m.name==="tablePlus"?m.colWidth:void 0,styleWidths:m.name==="tablePlus"?(x=m.styles)==null?void 0:x.map(_=>_.width):void 0,imageRatio:y?void 0:m.imageRatio,ratio:y?void 0:m.ratio,operationalRect:!y&&(m.name==="iframe"||m.name==="htmlDom")&&m.operationalRect?ot(m.operationalRect):void 0})};(c=this.store.data.fits)==null||c.forEach(m=>{m.children.forEach(y=>{var x;const p=this.store.pens[y];!p||(g(p),(x=p.children)!=null&&x.length&&Le(p,this.store).forEach(_=>{_.name==="tablePlus"&&!this.fillViewSnapshot.has(_.id)&&g(_,!0)}))})}),this.store.data.pens.filter(m=>m.name==="iframe"||m.name==="htmlDom").forEach(m=>g(m))}const o=this.canvas.width-t.width,l=this.canvas.height-t.height;if(Math.abs(o)>10){(d=this.store.data.fits)==null||d.forEach(y=>{let p=[];y.children.forEach(_=>{this.store.pens[_]&&(this.store.pens[_].locked=It.None,p.push(this.store.pens[_]))});let x=o/2;if(y.left&&y.right){let _=y.leftValue,b=y.rightValue;_?_=Math.abs(_)<1?_*t.width:_:_=0,b?b=Math.abs(b)<1?b*t.width:b:b=0;let C=(this.canvas.width-_-b)/(t.width-_-b);const P=new Set;p.forEach(S=>{var B,D;S.image&&S.imageRatio&&S.calculative.worldRect.width/this.canvas.width>.1&&(S.imageRatio=!1,S.ratio=!1),s(S,C,P),Math.abs(y.leftValue)<1?S.calculative.worldRect.x=t.x-o/2+_+(S.calculative.worldRect.x-t.x-_)*C:S.calculative.worldRect.x=t.x-o/2+_+(S.calculative.worldRect.x-t.x)*C,S.calculative.worldRect.width*=C,S.calculative.worldRect.ex=S.calculative.worldRect.x+S.calculative.worldRect.width,S.calculative.width=S.calculative.worldRect.width,S.calculative.x=S.calculative.worldRect.x,S.width=S.calculative.worldRect.width,S.x=S.calculative.worldRect.x,S.textWidth*=C,S.calculative.textWidth*=C,this.canvas.updatePenRect(S,{worldRectIsReady:!1}),S.externElement&&((B=S.onResize)==null||B.call(S,S)),(D=S.children)!=null&&D.length&&Le(S,this.store).forEach(G=>{var F;G.externElement&&((F=G.onResize)==null||F.call(G,G))})})}else y.left?(x=-x,y.leftValue&&(x+=Math.abs(y.leftValue)<1?y.leftValue*this.canvas.width:y.leftValue),this.translatePens(p,x,0)):y.right&&(y.rightValue&&(x=x-(Math.abs(y.rightValue)<1?y.rightValue*this.canvas.width:y.rightValue)),this.translatePens(p,x,0))});const g=this.store.data.pens.filter(y=>y.name==="iframe"&&!i.has(y.id));g==null||g.forEach(y=>{var x,_;const p=y.calculative.worldRect;if(p.width/t.width>.8){let b=p.width;y.calculative.worldRect.x=p.x-o/2,y.calculative.worldRect.width=p.width+o,y.calculative.worldRect.ex=p.ex+o,y.operationalRect&&(y.operationalRect.x=y.operationalRect.x*b/y.calculative.worldRect.width,y.operationalRect.width=(y.calculative.worldRect.width-(1-y.operationalRect.width)*b)/y.calculative.worldRect.width,(x=y.onBeforeValue)==null||x.call(y,y,{operationalRect:y.operationalRect})),(_=y.onResize)==null||_.call(y,y)}});const m=this.store.data.pens.filter(y=>y.name==="video");m==null||m.forEach(y=>{var x;const p=y.calculative.worldRect;p.width/this.canvas.width>.8&&(y.calculative.worldRect.x=p.x-o/2,y.calculative.worldRect.width=p.width+o,y.calculative.worldRect.ex=p.ex+o,(x=y.onResize)==null||x.call(y,y))})}if(Math.abs(l)>10){(f=this.store.data.fits)==null||f.forEach(y=>{let p=[];y.children.forEach(_=>{this.store.pens[_]&&(this.store.pens[_].locked=It.None,p.push(this.store.pens[_]))});let x=l/2;if(y.top&&y.bottom){let _=y.topValue,b=y.bottomValue;_?_=Math.abs(_)<1?_*this.canvas.height:_:_=0,b?b=Math.abs(b)<1?b*this.canvas.height:b:b=0;let C=(this.canvas.height-_-b)/t.height;p.forEach(P=>{var S,B;P.image&&P.imageRatio&&P.calculative.worldRect.height/this.canvas.height>.1&&(P.imageRatio=!1,P.ratio=!1),P.calculative.worldRect.y=t.y-l/2+_+(P.calculative.worldRect.y-t.y)*C,P.calculative.worldRect.height*=C,P.calculative.worldRect.ey=P.calculative.worldRect.y+P.calculative.worldRect.height,P.calculative.height=P.calculative.worldRect.height,P.calculative.y=P.calculative.worldRect.y,P.height=P.calculative.worldRect.height,P.y=P.calculative.worldRect.y,this.canvas.updatePenRect(P,{worldRectIsReady:!1}),P.externElement&&((S=P.onResize)==null||S.call(P,P)),(B=P.children)!=null&&B.length&&Le(P,this.store).forEach(V=>{var G;V.externElement&&((G=V.onResize)==null||G.call(V,V))})})}else y.top?(x=-x,y.topValue&&(x+=Math.abs(y.topValue)<1?y.topValue*this.canvas.height:y.topValue),this.translatePens(p,0,x)):y.bottom&&(y.bottomValue&&(x=x-(Math.abs(y.bottomValue)<1?y.bottomValue*this.canvas.height:y.bottomValue)),this.translatePens(p,0,x))});const g=this.store.data.pens.filter(y=>y.name==="iframe"&&!i.has(y.id));g==null||g.forEach(y=>{var x,_;const p=y.calculative.worldRect;if(p.height/t.height>.8){let b=p.height;y.calculative.worldRect.y=p.y-l/2,y.calculative.worldRect.height=p.height+l,y.calculative.worldRect.ey=p.ey+l,y.operationalRect&&(y.operationalRect.y=y.operationalRect.y*b/y.calculative.worldRect.width,y.operationalRect.height=(y.calculative.worldRect.height-(1-y.operationalRect.height)*b)/y.calculative.worldRect.height,(x=y.onBeforeValue)==null||x.call(y,y,{operationalRect:y.operationalRect})),(_=y.onResize)==null||_.call(y,y)}});const m=this.store.data.pens.filter(y=>y.name==="video");m==null||m.forEach(y=>{var x;const p=y.calculative.worldRect;p.height/this.canvas.height>.8&&(y.calculative.worldRect.y=p.y-l/2,y.calculative.worldRect.height=p.height+l,y.calculative.worldRect.ey=p.ey+l,(x=y.onResize)==null||x.call(y,y))})}this.canvas.canvasTemplate.fit=!0,this.canvas.canvasTemplate.init(),this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render(!0)}scaleView(){const t=window.innerWidth/window.innerHeight,i=this.getRect(),a=i.width/i.height;if(Math.abs(t-a)<.001)return;let s;t>a?s=`scale(${t/a},1)`:s=`scale(1,${a/t})`,this.canvas.parentElement.style.transform=s}setFits(){if(!this.store.data.fits){const t=this.store.data.pens.filter(i=>!i.parentId).map(i=>i.id);this.store.data.fits=[{bottom:!0,bottomValue:0,left:!0,leftValue:0,right:!0,rightValue:0,top:!0,topValue:0,x:0,y:0,height:1,width:1,children:t}]}}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),o=this.getRect(),l=(s-r[1]-r[3])/o.width,u=(n-r[0]-r[2])/o.height;let c=l;t?c=l>u?u:l:c=l>u?l:u,this.canvas.templateScale(c*this.store.data.scale);let d=this.getRect(),f=this.store.data.pens.filter(g=>!g.parentId);this.canvas.templateTranslatePens(f,-d.x,-d.y),this.store.data.pens.forEach(g=>{g.type?this.canvas.initLineRect(g):this.canvas.updateLines(g)}),this.centerView()}fitSizeView(t=!0,i=10,a=!0){var g,m;const{canvas:s}=this.canvas,{offsetWidth:n,offsetHeight:r}=s;this.resize(n,r);const o=Qi(i),l=(this.store.data.width||this.store.options.width)*this.store.data.scale,u=(this.store.data.height||this.store.options.height)*this.store.data.scale,c=(n-o[1]-o[3])/l,d=(r-o[0]-o[2])/u;let f=c;t==="width"?f=c:t==="height"?f=d:t?f=c>d?d:c:f=c>d?c:d,a&&((g=this.store.data.fits)==null?void 0:g.length)&&(this.canvas.opening=!0),this.scale(f*this.store.data.scale),this.centerSizeView(),a&&((m=this.store.data.fits)==null?void 0:m.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};te(s);const{center:n}=s,{scale:r,origin:o,x:l,y:u}=this.store.data;this.translate((t.x-o.x)/r-n.x-l/r,(t.y-o.y)/r-n.y-u/r);const{canvas:c}=this.canvas,d=(c.scrollWidth-c.offsetWidth)/2,f=(c.scrollHeight-c.offsetHeight)/2;c.scrollTo(d,f)}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);let o=null;const l=this.store.data.width||this.store.options.width,u=this.store.data.height||this.store.options.height;l&&u?o={width:l*this.store.data.scale,height:u*this.store.data.scale}:o=this.getRect();const c=(s-r[1]-r[3])/o.width;this.scale(c*this.store.data.scale),this.topView(r[0]),i&&this.canvas.scroll.changeMode(r[0])}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),o=this.getRect();let l=(s-r[1]-r[3])/o.width;i||(l=(n-r[0]-r[2])/o.height),this.scale(l*this.store.data.scale),this.topView(r[0])}topView(t=10){if(!this.hasView())return;const i=this.getRect(),a=this.getViewCenter(),s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;let r=null;s&&n?r={x:0,y:0,width:s,height:n}:r=this.getPenRect(i),te(r);const{center:o}=r,{scale:l,origin:u,x:c,y:d}=this.store.data;this.translate((a.x-u.x)/l-o.x-c/l,(t-u.y)/l-r.y-d/l);const{canvas:f}=this.canvas,g=(f.scrollWidth-f.offsetWidth)/2,m=(f.scrollHeight-f.offsetHeight)/2;f.scrollTo(g,m)}centerView(){if(!this.hasView())return;const t=this.getRect(),i=this.getViewCenter(),a=this.getPenRect(t);te(a);const{center:s}=a,{scale:n,origin:r,x:o,y:l}=this.store.data;this.translate((i.x-r.x)/n-s.x-o/n,(i.y-r.y)/n-s.y-l/n);const{canvas:u}=this.canvas,c=(u.scrollWidth-u.offsetWidth)/2,d=(u.scrollHeight-u.offsetHeight)/2;u.scrollTo(c,d)}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=ot(t),s=t[0],{width:n,height:r}=this.getPenRect(s);for(let o=1;o<t.length;o++){const l=t[o];i==="width"?this.setValue({id:l.id,width:n},{render:!1,doEvent:!1}):i==="height"?this.setValue({id:l.id,height:r},{render:!1,doEvent:!1}):this.setValue({id:l.id,width:n,height:r},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:_t.Update,initPens:a,pens:t})}beSameByLast(t=this.store.data.pens,i){const a=ot(t),s=t[t.length-1],{width:n,height:r}=this.getPenRect(s);for(let o=0;o<t.length-1;o++){const l=t[o];i==="width"?this.setValue({id:l.id,width:n},{render:!1,doEvent:!1}):i==="height"?this.setValue({id:l.id,height:r},{render:!1,doEvent:!1}):this.setValue({id:l.id,width:n,height:r},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:_t.Update,initPens:a,pens:t})}formatPainterByFirst(t=this.store.data.pens){const i=ot(t),a=t[0],s={};ln.forEach(n=>{s[n]=a[n]});for(let n=1;n<t.length;n++){const r=t[n];this.setValue({id:r.id,...Zl,...s},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:_t.Update,initPens:i,pens:t})}formatPainterByLast(t=this.store.data.pens){const i=ot(t),a=t[t.length-1],s={};ln.forEach(n=>{s[n]=a[n]});for(let n=0;n<t.length-1;n++){const r=t[n];this.setValue({id:r.id,...Zl,...s},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:_t.Update,initPens:i,pens:t})}setFormatPainter(){const t=this.store.active,i={};if(t.length>0){const a=t[0];ln.forEach(s=>{i[s]=a[s]!==void 0?a[s]:this.store.options.defaultFormat[s]||this.store.data[s]||this.store.options[s]})}else ln.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=ot(t),a=JSON.parse(localStorage.getItem("meta2d-formatPainter"));for(let s=0;s<t.length;s++){const n=t[s];this.setValue({id:n.id,...Zl,...a},{render:!1,doEvent:!1})}this.render(),this.pushHistory({type:_t.Update,initPens:i,pens:t})}clearFormatPainter(){const t=this.store.active,i=ot(t);ln.forEach(a=>{for(let s=0;s<t.length;s++){const n=t[s],{fontSize:r,lineHeight:o}=this.store.options;a==="lineWidth"?(n.lineWidth=1,n.calculative.lineWidth=1):a==="fontSize"?(n.fontSize=r,n.calculative.fontSize=r):a==="lineHeight"?(n.lineHeight=o,n.calculative.lineHeight=o):(delete n[a],delete n.calculative[a])}}),this.render(),this.pushHistory({type:_t.Update,initPens:i,pens:t})}alignNodes(t,i=this.store.data.pens,a){!a&&(a=this.getPenRect(this.getRect(i)));const s=ot(i);for(const n of i)this.alignPen(t,n,a);this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:_t.Update,initPens:s,pens:i})}alignNodesV(t,i=this.store.data.pens,a=!1){const s=this.store.data.width||this.store.options.width,n=this.store.data.height||this.store.options.height;let r={x:0,y:0,width:s,height:n};const o=ot(i);if(a){const l=this.store.data.scale,u=this.getRect(i),c=(u.x-this.store.data.origin.x)/l,d=(u.y-this.store.data.origin.y)/l,f=u.width/l,g=u.height/l;let m=0,y=0;switch(t){case"left":m=-c;break;case"right":m=s-(c+f);break;case"top":y=-d;break;case"bottom":y=n-(d+g);break;case"center":m=s/2-(c+f/2);break;case"middle":y=n/2-(d+g/2);break}this.translatePens(i,m*l,y*l)}else for(const l of i)this.alignPen(t,l,r);this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:_t.Update,initPens:o,pens:i})}alignNodesByFirst(t,i=this.store.data.pens){const a=ot(i),s=i[0],n=this.getPenRect(s);for(let r=1;r<i.length;r++){const o=i[r];this.alignPen(t,o,n)}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:_t.Update,initPens:a,pens:i})}alignNodesByLast(t,i=this.store.data.pens){const a=ot(i),s=i[i.length-1],n=this.getPenRect(s);for(let r=0;r<i.length-1;r++){const o=i[r];this.alignPen(t,o,n)}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:_t.Update,initPens:a,pens:i})}alignPen(t,i,a){const s=this.getPenRect(i);switch(t){case"left":s.x=a.x;break;case"right":s.x=a.x+a.width-s.width;break;case"top":s.y=a.y;break;case"bottom":s.y=a.y+a.height-s.height;break;case"center":s.x=a.x+a.width/2-s.width/2;break;case"middle":s.y=a.y+a.height/2-s.height/2;break}this.setValue({id:i.id,...s},{render:!1,doEvent:!1})}spaceBetweenByDirection(t,i=this.store.data.pens,a){if(!a){let u=1/0,c=-1/0,d=t==="width"?"x":"y";i.forEach(f=>{u=Math.min(u,f.calculative.worldRect[d]),c=Math.max(c,f.calculative.worldRect["e"+d])}),a=(c-u)/this.store.data.scale}if(i=i.filter(u=>!u.parentId),i.length<=2)return;const s=ot(i),n=i.reduce((u,c)=>{const d=this.getPenRect(c);return u+d[t]},0),r=(a-n)/(i.length-1);i=i.sort((u,c)=>t==="width"?u.x-c.x:u.y-c.y);const o=this.getPenRect(i[0]);let l=t==="width"?o.x:o.y;for(const u of i){const c=this.getPenRect(u);t==="width"?c.x=l:c.y=l,l+=c[t]+r,this.setValue({id:u.id,...c},{render:!1,doEvent:!1})}this.initImageCanvas(i),this.initTemplateCanvas(i),this.render(),this.pushHistory({type:_t.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(Ei(t));!i&&(i=s.width),t=t.filter(u=>!u.type&&!u.parentId);const n=ot(t);let r=0;t.forEach(u=>{const c=this.getPenRect(u);c.height>r&&(r=c.height)});let o=s.x,l=s.y;t.forEach((u,c)=>{const d=this.getPenRect(u);if(d.x=o,d.y=l+r/2-d.height/2,this.setValue({id:u.id,...d},{render:!1,doEvent:!1}),c===t.length-1)return;const f=o+d.width-s.x,g=this.getPenRect(t[c+1]);Math.round(i-f)>=Math.round(g.width+a)?o+=d.width+a:(o=s.x,l+=r+a)}),this.initImageCanvas(t),this.initTemplateCanvas(t),this.render(),this.pushHistory({type:_t.Update,initPens:n,pens:t})}gotoView(t){var n;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 r of this.store.data.pens)Di(r),(n=r.onMove)==null||n.call(r,r);this.canvas.canvasTemplate.init(),this.canvas.canvasImage.init(),this.canvas.canvasImageBottom.init(),this.render()}animateView(t){this.canvas.animateView(t)}showMap(){this.map||(this.map=new dE(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=[...Le(i,this.store),i].map(r=>r.id);a.filter(r=>s.includes(r.id)).forEach(r=>{const o=a.findIndex(l=>l.id===r.id);o>-1&&(a.push(a[o]),a.splice(o,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=[...Le(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 o=n[r],l=a.findIndex(u=>u.id===o.id);l>-1&&(a.unshift(a[l]),a.splice(l+1,1),this.initTemplateCanvas([o]),this.initImageCanvas([o])),this.specificLayerMove(o,"bottom")}}this.store.emitter.emit("layer",{type:"bottom",pens:t})}upByArea(t){if(this.store.data.pens.findIndex(l=>l.id===t.id)===-1){console.warn("upByArea: pen not in canvas");return}const a=[t,...Le(t,this.store)];let s=a.map(l=>this.store.data.pens.findIndex(u=>u.id===l.id));s.includes(-1)&&(console.warn("upByArea: pen children not in canvas"),s=s.filter(l=>l!==-1));const n=Math.min(...s),r=t.calculative.worldRect,o=this.store.data.pens.findIndex((l,u)=>{if(u<=n||l.id===t.id||Z2(l,t))return!1;const c=l.calculative.worldRect;return ea(r,c)});if(o===-1){this.up(t);return}this.store.data.pens.splice(o+1,0,...a);for(const l of a){const u=this.store.data.pens.findIndex(c=>c.id===l.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.name.endsWith("Dom")||bc.includes(t.name)||this.store.options.domShapes.includes(t.name)||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&&Pe(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=[...Le(i,this.store),i],n=[];for(let l=0;l<a.length;l++){const u=a[l];s.findIndex(c=>c.id===u.id)!==-1&&(u.temIndex=l,n.push(u))}let r=-1,o=0;n.forEach(l=>{l.temIndex-=o,a.splice(l.temIndex,1),o+=1,r=l.temIndex,delete l.temIndex,this.specificLayerMove(l,"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=[...Le(i,this.store),i],n=[];for(let l=0;l<a.length;l++){const u=a[l];s.findIndex(c=>c.id===u.id)!==-1&&(u.temIndex=l,n.push(u))}let r=-1,o=0;n.forEach((l,u)=>{l.temIndex-=o,a.splice(l.temIndex,1),o+=1,u===0&&(r=l.temIndex),delete l.temIndex,this.specificLayerMove(l,"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<i&&(a.splice(i,0,a[s]),a.splice(s,1))),this.initTemplateCanvas([t]),this.initImageCanvas([t])}changePenId(t,i){this.canvas.changePenId(t,i)}getLines(t,i="all"){var s;if(t.type===Ut.Line)return[];const a=[];return(s=t.connectedLines)==null||s.forEach(({lineId:n})=>{const r=this.store.pens[n];if(!r){console.warn(t,"node contain a error connectedLine");return}if(!a.find(o=>o.id===r.id))switch(i){case"all":a.push(r);break;case"in":jt(r).connectTo===t.id&&a.push(r);break;case"out":ce(r).connectTo===t.id&&a.push(r);break}}),a}nextNode(t){if(t.type===Ut.Line){const i=this.store.pens[jt(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(l=>l.id===r.id)&&a.push(r)}),a}}previousNode(t){if(t.type===Ut.Line){const i=this.store.pens[ce(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(l=>l.id===r.id)&&a.push(r)}),a}}getNext(t){var a;if(t.type===Ut.Line){console.warn("\u975E\u8FDE\u7EBF\u8282\u70B9");return}const i=[];return(a=t.connectedLines)==null||a.forEach(({lineId:s,anchor:n})=>{var l,u;const r=(l=t.anchors)==null?void 0:l.filter(c=>c.id===n)[0],o=this.findOne(s);if(o.anchors[0].connectTo==t.id){const c=o.anchors[o.anchors.length-1].connectTo;if(c){const d=this.findOne(c),f=(u=d.connectedLines)==null?void 0:u.filter(m=>m.lineId===o.id)[0],g=d.anchors.filter(m=>m.id===f.anchor)[0];i.push({from:t,fromAnchor:r,line:o,to:d,toAnchor:g})}}}),i}addAnchor(t,i,a){if(!t)return;if(t.anchors||(t.anchors=[]),t.calculative.worldAnchors||(t.calculative.worldAnchors=[]),t.type===Ut.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||Tt(),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&&Zt(n,t.rotate,t.calculative.worldRect.center),s={id:n.id,penId:t.id,x:i.x,y:i.y}):(n={id:i.id||Tt(),penId:t.id,x:i.x,y:i.y},t.calculative.worldRect&&(t.rotate%360&&Zt(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===Ut.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=Rs(t,{x:u.x+u.width/2,y:u.y+u.height/2})}if(!s){const u=t.calculative.worldRect;s=Rs(i,{x:u.x+u.width/2,y:u.y+u.height/2})}const r=Math.abs(a.x-s.x),l={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:Tt()},{x:a.x>s.x?0:1,y:a.x>s.x?0:1,id:Tt()}]};return this.addPens([l]),xe(t,a,l,l.calculative.worldAnchors[0]),xe(i,s,l,l.calculative.worldAnchors[1]),l.calculative.active=!1,this.canvas.updateLines(l),this.canvas.updateLines(t),this.canvas.updateLines(i),this.canvas.initLineRect(l),n&&this.render(),l}async addLineByPoints(t,i={},a=!0){if(!t||t.length<2){console.warn("addLineByPoints: \u81F3\u5C11\u9700\u8981 2 \u4E2A\u70B9");return}const{scale:s,origin:n}=this.store.data,r=t.map(y=>({x:y.x*s+n.x,y:y.y*s+n.y})),o=r.map(y=>y.x),l=r.map(y=>y.y),u=Math.min(...o),c=Math.min(...l),d=Math.max(...o)-u,f=Math.max(...l)-c,g=i.id||Tt(),m={lineName:"line",...i,id:g,name:"line",type:Ut.Line,x:u,y:c,width:d,height:f,anchors:r.map((y,p)=>({id:`${p}`,penId:g,x:d?(y.x-u)/d:0,y:f?(y.y-c)/f:0}))};return await this.addPen(m,a,!0)}toComponent(t=this.store.data.pens,i,a){if(t.length===1){const c=ot(t[0]);return c.type=Ut.Node,c.id=void 0,[c]}const s=ot(t,!0),n=Ei(s);let r={id:Tt(),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 o=s.filter(c=>!c.parentId),l=s.find(c=>c.width===n.width&&c.height===n.height),u=l&&i===void 0;return o.length===1?r=o[0]:u&&(l.children||(l.children=[]),r=l),s.forEach(c=>{var f;if(c===r||c.parentId===r.id||c.parentId)return;r.children.push(c.id),c.parentId=r.id;const d=wa(c.calculative.worldRect,n);Object.assign(c,d),c.locked=(f=c.lockedOnCombine)!=null?f:It.DisableMove}),u||o.length===1?ot(s):ot([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&&Z6(n)&&a)if(n.install(t,r),!this.penPluginMap.has(n))this.penPluginMap.set(n,[{[a]:t[a],option:r}]);else{let o=this.penPluginMap.get(n).find(l=>l[a]===t[a]);o?o.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),o=r.findIndex(l=>l[a]===t[a]);o!==-1&&(r.splice(o,1),r.length===0&&this.penPluginMap.delete(n))})}setVisible(t,i,a=!0,s=!0,n=!0){if(this.setValue({id:t.id,visible:i},{render:!1,doEvent:!1}),t.children)for(const o of t.children){const l=this.store.pens[o];l&&this.setVisible(l,i,!1,!1,!1)}a&&this.store.emitter.emit("visible",{pen:t,visible:i});const r=[t];s&&this.onSizeUpdate(),n&&this.initImageCanvas(r),a&&this.render()}clearHover(){this.canvas.clearHover()}closeSocket(){this.closeWebsocket(),this.closeMqtt(),this.closeHttp()}setLocale(t){W2(t)}addLocale(t,i){H2(t,i)}destroy(t){if(this.clear(!1),Q5(),this.stopDataMock(),this.closeSocket(),this.closeNetwork(),this.closeAll(),gn.destroyThemeSheet(this.store.id),this.store.emitter.all.clear(),this.canvas.destroy(),this.canvas=void 0,wt[this.store.id]=void 0,!t){for(const i in wt)delete wt[i];wt.path2dDraws={},wt.canvasDraws={},wt.anchors={},wt.htmlElements={},wt.lineAnimateDraws={},wt.gridDrawers={}}}}function AE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ey:r}=e.calculative.worldRect,o=n/4;if(i.moveTo(a+o,s),i.lineTo(a,s),i.lineTo(a,r),i.lineTo(a+o,r),i instanceof Path2D)return i}function CE(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 kE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect,l=e.offsetX;let u=n/7;if(l>1?u=l:l>0&&(u=n*l),i.moveTo(a+u,s),i.lineTo(r,s),i.lineTo(a+n-u,o),i.lineTo(a,o),i.closePath(),i instanceof Path2D)return i}function FE(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 PE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o,ey:l}=e.calculative.worldRect,u=n/8;if(i.moveTo(a+u,s),i.lineTo(o-u,s),i.bezierCurveTo(o+u/3,s,o+u/3,l,o-u,l),i.lineTo(a+u,l),i.lineTo(a,s+r/2),i.closePath(),i instanceof Path2D)return i}function RE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o,center:l}=e.calculative.worldRect,u=l.x,c=s+r*6/7,d=r/6;if(i.moveTo(a,s),i.lineTo(o,s),i.lineTo(o,c),i.bezierCurveTo(o-20,c-d,u+n/5,c-d,u,c),i.bezierCurveTo(u-n/5,c+d,a,c+d,a,c),i.closePath(),i instanceof Path2D)return i}function SE(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 TE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect,l=n/10;if(i.moveTo(a+l*2,s),i.bezierCurveTo(a-l*2/3,s,a-l*2/3,o,a+l*2,o),i.lineTo(r,o),i.bezierCurveTo(r-l,o,r-l,s,r,s),i.closePath(),i instanceof Path2D)return i}function BE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,ex:r,ey:o}=e.calculative.worldRect;i.moveTo(a,s),i.lineTo(r,s),i.lineTo(r,o),i.lineTo(a,o),i.closePath();const l=n/7;if(i.moveTo(a,s+l),i.lineTo(r,s+l),i.moveTo(a+l,s),i.lineTo(a+l,o),i instanceof Path2D)return i}function IE(e,t){const i=t||new Path2D,{x:a,y:s,height:n,ex:r,ey:o}=e.calculative.worldRect,l=n/4;if(i.moveTo(a,s+l),i.lineTo(r,s),i.lineTo(r,o),i.lineTo(a,o),i.closePath(),i instanceof Path2D)return i}function DE(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 ME(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 LE(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 OE(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o,ey:l}=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,l),i.lineTo(o,l),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:o}=e.calculative.worldRect,l=n/7;if(i.moveTo(a,s),i.lineTo(r,s),i.lineTo(r,o),i.lineTo(a,o),i.closePath(),i.moveTo(a+l,s),i.lineTo(a+l,o),i.moveTo(r-l,s),i.lineTo(r-l,o),i instanceof Path2D)return i}function zE(e,t){const i=t||new Path2D,{x:a,y:s,height:n,ex:r,ey:o}=e.calculative.worldRect,l=n/7;if(i.moveTo(a,s+l),i.bezierCurveTo(a,s-l/2|0,r,s-l/2|0,r,s+l),i.lineTo(r,o-l),i.bezierCurveTo(r,o+l/2|0,a,o+l/2|0,a,o-l),i.closePath(),i.moveTo(a,o-l),i.bezierCurveTo(a,o-l*2|0,r,o-l*2|0,r,o-l),i instanceof Path2D)return i}function C9(){return{flowComment:AE,flowData:kE,flowDb:zE,flowDisplay:PE,flowDocument:RE,flowExternStorage:TE,flowInternalStorage:BE,flowManually:IE,flowParallel:ME,flowQueue:OE,flowSubprocess:NE}}function k9(){return{flowDocument:SE,flowManually:DE,flowParallel:LE,flowComment:CE,flowData:FE}}var vo;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(vo||(vo={}));function x0(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 _0(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+=x0(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 Id(e,t){t.onAdd||(t.onAdd=E0,(!t.rowPos||!t.colPos||!t.calculative.maxOffsetY)&&t.onAdd(t),t.onMouseMove=qE,t.onMouseLeave=YE,t.onMouseDown=KE,t.onShowInput=$E,t.onInput=jE,t.onValue=ZE,t.onBeforeValue=JE,t.onMouseEnter=aA,t.onWheel=QE,t.onDestroy=eA),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()}UE(e,t),VE(e,t),WE(e,t),e.restore(),t.isFirstTime=!1}function WE(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.x<i.x+i.width&&a.y>i.y&&a.y<i.y+i.height)){t.calculative.hover=!1,t.calculative.isHover=!1,t.calculative.hoverCell=void 0;return}const{row:s,col:n}=t.calculative.hoverCell,{x:r,y:o}=t.calculative.canvas.mousePos;if(!t.data[s])return;let l=t.data[s][n];if(typeof l=="object"||!l)return;e.save(),e.beginPath(),e.textAlign="start",e.textBaseline="middle",e.font=e.font=(t.calculative.fontStyle||"")+" normal "+(t.calculative.fontWeight||"")+" "+(t.calculative.fontSize||12)+"px "+t.calculative.fontFamily;const u=e.measureText(l).width;e.beginPath(),e.fillStyle="#fff",e.strokeStyle="#000",e.moveTo(r,o),e.rect(r-10,o,u+20,20),e.fill(),e.stroke(),e.beginPath(),e.fillStyle="#000",e.fillText(l,r,o+10),e.restore()}function HE(e){const t=[],i=[],a={};e.rowHeight||(e.rowHeight=40),e.colWidth||(e.colWidth=150);let s=0;const n=e.styles&&e.styles.filter(p=>p.col!==void 0&&p.row===void 0&&p.width);let r={};n&&n.forEach(p=>{r[p.col]=p.width});for(let p=0;p<e.data[0].length;p++){s+=(r[p]||e.colWidth)*e.calculative.canvas.store.data.scale,t.push(s);let x=e.styles&&e.styles.filter(_=>_.col===p&&_.row===void 0);x&&(a[p]=x[0])}let o=0;const l=e.styles&&e.styles.filter(p=>p.col===void 0&&p.row!==void 0&&p.height);let u={};l&&l.forEach(p=>{u[p.row]=p.height});let c=o;for(let p=0;p<e.data.length;p++)o+=(u[p]||e.rowHeight)*e.calculative.canvas.store.data.scale,i.push(o),p<e.maxNum&&(c=o);if(e.calculative.maxOffsetY=(o-c)/e.calculative.canvas.store.data.scale,e.initWorldRect)return;e.colPos=t,e.rowPos=i,e.colStyle=a,e.initScale=e.calculative.canvas.store.data.scale,e.tableWidth=s,e.tableHeight=c||o;let d=c||o,f=s,g=d;e.parentId&&(s=f/e.calculative.canvas.parent.store.pens[e.parentId].calculative.worldRect.width,g=d/e.calculative.canvas.parent.store.pens[e.parentId].calculative.worldRect.height),e.calculative.width=s,e.calculative.height=g,e.calculative.width=s,e.calculative.height=g,e.height||(e.height=e.calculative.height),e.width||(e.width=e.calculative.width);let m=e.x,y=e.y;if(e.parentId){let p=e.calculative.canvas.store.pens[e.parentId];m=p.calculative.worldRect.x+p.calculative.worldRect.width*e.x,y=p.calculative.worldRect.y+p.calculative.worldRect.height*e.y}e.calculative.worldRect={x:m,y,height:d,width:f},e.width=e.calculative.width,e.height=e.calculative.height,e.initWorldRect||(e.initWorldRect={width:e.calculative.worldRect.width,height:e.calculative.worldRect.height}),re(e.calculative.worldRect)}function UE(e,t){if(!t.colPos)return;const{x:i,y:a,width:s,height:n,ex:r,ey:o}=t.calculative.worldRect;e.save(),e.beginPath(),e.strokeStyle=t.color;let l=t.calculative.borderRadius||0,u=l;l<1&&(l=s*l,u=n*u);let c=l<u?l:u;if(s<2*c&&(c=s/2),n<2*c&&(c=n/2),e.moveTo(i+c,a),e.arcTo(r,a,r,o,c),e.arcTo(r,o,i,o,c),e.arcTo(i,o,i,a,c),e.arcTo(i,a,r,a,c),t.background&&(e.fillStyle=t.background,e.fill()),t.bordered!==!1&&(e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke()),t.hLine!==!1){let d=t.rowPos[t.rowPos.length-1];t.hasHeader&&(e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight),e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke());for(const f of t.rowPos){if(f===d)continue;const g=f*t.calculative.worldRect.height/t.tableHeight-t.offsetY*t.calculative.canvas.store.data.scale;if(t.hasHeader){if(g<0+t.rowPos[0]||g>t.calculative.worldRect.height)continue}else if(g<0||g>t.calculative.worldRect.height)continue;e.beginPath(),e.moveTo(t.calculative.worldRect.x,t.calculative.worldRect.y+g),e.lineTo(t.calculative.worldRect.ex,t.calculative.worldRect.y+g),e.strokeStyle=t.borderColor||t.color||"#424B61",e.stroke()}}if(t.vLine!==!1){let d=t.colPos[t.colPos.length-1];t.colPos.forEach((f,g)=>{if(f===d)return;const m=f*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 VE(e,t){var a,s,n,r,o;if(!t.colPos)return;t.calculative.texts||(t.calculative.texts=[]);const i=1;for(let l=0;l<t.rowPos.length;l++){if(t.hasHeader&&l===1){e.save(),e.beginPath();const{x:c,y:d,width:f,height:g}=t.calculative.worldRect;e.fillStyle="#fff0",e.rect(c-1,d+t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight-1,f+2,g-t.rowPos[0]*t.calculative.worldRect.height/t.tableHeight+2),e.fill(),e.clip()}let{style:u}=XE(t,l);for(let c=0;c<t.colPos.length;c++){let{value:d,style:f}=C0(t,l,c),g=!0;if(Array.isArray(f)&&f.length>0){let D=0;f.forEach((V,G)=>{V.wheres&&V.wheres.every(R=>{var $,Z,at;let T=Te((at=(Z=($=t.calculative)==null?void 0:$.canvas)==null?void 0:Z.store)==null?void 0:at.options,"attr",`return attr ${R.comparison} ${R.value}`);const L=T(d);return T=null,L})&&(D=G)}),f=f[D]}else f.wheres&&Array.isArray(f.wheres)&&(g=!1,g=f.wheres.every(function(D){var F,R,T;let V=Te((T=(R=(F=t.calculative)==null?void 0:F.canvas)==null?void 0:R.store)==null?void 0:T.options,"attr",`return attr ${D.comparison} ${D.value}`);const G=V(d);return V=null,G}));let m=t.color,y=t.textColor||t.color,p=null,x=null,_=null,b=null;g&&(m=f.color||u.color||t.color,y=f.textColor||u.textColor||t.textColor,p=f.background||u.background,x=(f.fontSize||u.fontSize||0)*t.calculative.canvas.store.data.scale,_=f.fontWeight||u.fontWeight,b=f.fontStyle||u.fontStyle);let C;t.stripe&&(t.hasHeader!==!1?l%2===1&&(p=p||t.stripeColor||"#407FFF1F"):l%2===0&&(p=p||t.stripeColor||"#407FFF1F")),t.calculative.active&&((a=t.calculative.activeCell)==null?void 0:a.row)===l&&((s=t.calculative.activeCell)==null?void 0:s.col)===c&&(m=t.activeColor,p=t.activeBackground,C=m,y=t.activeTextColor||t.activeColor),t.calculative.hover&&((n=t.calculative.hoverCell)==null?void 0:n.row)===l&&((r=t.calculative.hoverCell)==null?void 0:r.col)===c&&(m=t.hoverColor,p=t.hoverBackground,y=t.hoverTextColor||t.hoverColor,C=m);const P=F0(t,l,c);if(P.y+P.height<t.calculative.worldRect.y||P.y>t.calculative.worldRect.height+t.calculative.worldRect.y)continue;p&&(e.save(),e.beginPath(),e.fillStyle=p,e.fillRect(P.x,P.y,P.width+.25*t.calculative.canvas.store.data.scale,P.height),e.restore()),C&&(e.save(),e.beginPath(),e.strokeStyle=C,e.strokeRect(P.x,P.y,P.width,P.height),e.restore()),t.calculative.worldTextRect=P;let S=t.calculative.texts[l];if(t.calculative.texts[l]||(S=[],t.calculative.texts.push(S)),S[c]==null){if(typeof d=="object"){const D=t.styles&&t.styles.filter(V=>V.col===c&&V.row===void 0&&V.pens);if(D.length>0){if(S[c]="",t.isFirstTime){t.maxNum&&t.hasHeader&&l>=t.maxNum&&(d.visible=!1);let V=JSON.parse(JSON.stringify(D[0].pens));V.forEach(G=>{Object.assign(G,{row:l,col:c},d),G.activeBackground=G.background,G.hoverBackground=G.background,G.activeColor=G.color,G.hoverColor=G.color,G.activeTextColor=G.textColor,G.hoverTextColor=G.textColor,G.height*=t.calculative.canvas.store.data.scale,G.width*=t.calculative.canvas.store.data.scale}),GE(t,P,V),t.calculative.canvas.parent.pushChildren(t,V)}continue}}else d===void 0?S[c]="":S[c]=d.text||d+"";if(!S[c])continue;S[c]=Ws(t,S[c])}if(!S[c])continue;e.save(),e.beginPath(),e.fillStyle=y,e.textAlign="center",e.textBaseline="middle",e.font=(b||t.calculative.fontStyle||"")+" normal "+(_||t.calculative.fontWeight||"")+" "+(x||t.calculative.fontSize||12)*i+"px "+t.calculative.fontFamily;let B=t.colStyle&&((o=t.colStyle[c])==null?void 0:o.textAlign);if(B&&(e.textAlign=B),S[c].length===1)B==="left"?e.fillText(S[c][0],P.x,P.y+P.height/2):B==="right"?e.fillText(S[c][0],P.x+P.width,P.y+P.height/2):e.fillText(S[c][0],P.x+P.width/2,P.y+P.height/2);else{const V=(x||t.calculative.fontSize)*t.calculative.lineHeight*i,G=S[c].length*V;let F=(P.height-G)/2;B==="left"?S[c].forEach((R,T)=>{e.fillText(R,P.x,P.y+F+(T+.55)*V)}):B==="right"?S[c].forEach((R,T)=>{e.fillText(R,P.x+P.width,P.y+F+(T+.55)*V)}):S[c].forEach((R,T)=>{e.fillText(R,P.x+P.width/2,P.y+F+(T+.55)*V)})}e.restore()}}}function E0(e){var t;su(e),(t=e.children)!=null&&t.length||(e.isFirstTime=!0),e.offsetY||(e.offsetY=0),HE(e)}function $E(e,t){if(!e.calculative.hoverCell)return;const{value:i}=C0(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=F0(e,e.calculative.hoverCell.row,e.calculative.hoverCell.col);e.calculative.tempText=i.text||i+"",e.calculative.canvas.showInput(e,a,"#ffffff")}function jE(e,t){!e.calculative.inputCell||(k0(e,e.calculative.inputCell.row,e.calculative.inputCell.col,t),e.calculative.isInput=!1,e.calculative.isHover=!0,e.calculative.canvas.render())}function qE(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=A0(e,t),e.calculative.canvas.render()}function YE(e,t){su(e),e.calculative.hoverCell=void 0,e.calculative.canvas.render()}function KE(e,t){e.calculative.activeCell=A0(e,t),e.calculative.canvas.render()}function A0(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;n<e.colPos.length;n++)t.x>e.calculative.worldRect.x+e.colPos[n]*i&&(s.col=n+1);for(let n=0;n<e.rowPos.length;n++)t.y>e.calculative.worldRect.y+e.rowPos[n]*a-e.offsetY*e.calculative.canvas.store.data.scale&&(s.row=n+1);return s}function C0(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 XE(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 k0(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 F0(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 o=0,l=e.rowPos[t]*s;t>0&&(o=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+o-u,ex:e.calculative.worldRect.x+r,ey:e.calculative.worldRect.y+l-u,width:r-n,height:l-o}}function GE(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 o=0,l=0,u=0;const c=e.calculative.canvas.store.data.scale;if(i.length>1){for(const d of i)l+d.width*a+20*c*a<t.width?(d.x=t.x+l+10*c*a,d.y=t.y+u+10*c*s,l+=(d.width+10*c)*a,o=Math.max(o,u+(d.height+10*c)*s)):(l=0,u=o,d.x=t.x+l+10*c*a,d.y=t.y+u+10*c*s,o+=(d.height+10*c)*s);if(o+20*c*s<t.height){const d=(t.height-o-10*c*s)/2;for(const f of i)f.y+=d}}else i[0].x=t.x+(t.width-i[0].width)/2,i[0].y=t.y+(t.height-i[0].height)/2;i.forEach(d=>{d.width=d.width*n,d.height=d.height*r})}function ZE(e){if(e.calculative.isUpdateData){delete e.calculative.isUpdateData;let t=ot(e.children);e.children=[],E0(e),t&&t.forEach(i=>{e.calculative.canvas.delForce(e.calculative.canvas.findOne(i))}),e.calculative.texts=void 0}}function JE(e,t){if(e.calculative.isUpdateData=!1,e.swiper!==void 0&&(e.swiper?su(e):au(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===vo.Replace?(s=e.data,t.dataX&&t.dataX.forEach((n,r)=>{s[n]=t.dataY[r]})):a===vo.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),k0(e,t.row,t.col,t.value),e.calculative.canvas.render(),delete t.col,delete t.row),t}function QE(e,t){if(!e.locked&&!e.calculative.canvas.store.data.locked||!e.maxNum)return;let i=0;t.deltaY>0?i=4:i=-4,Bc(e,i)}function Bc(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];tA(e,s)}),e.calculative.canvas.render()}function tA(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.y<e.rowPos[0]/e.tableHeight){if(t.calculative.visible=!1,t.visible=!1,t.y<e.rowPos[0]/e.tableHeight/2){t.oldY+=s;let n=t.row+e.maxNum;if(!e.data[n])return;let r=ot(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=ot(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=ot(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=ot(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 eA(e){au(e)}function au(e){e.interval&&(globalThis.clearInterval(e.interval),e.interval=null)}function su(e){if(e.maxNum&&e.swiper){if(e.interval)return;e.interval=globalThis.setInterval(()=>{e.offsetY>=e.calculative.maxOffsetY?(e.offsetY=0,iA(e)):e.offsetY%e.rowHeight?Bc(e,1):(e.calculative.stap||(e.calculative.stap=0),e.calculative.stap+=1,e.calculative.stap==12&&(e.calculative.stap=0,Bc(e,1)))},50)}}function iA(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 o=ot(e.data[r][s.col]);o.background&&(o.activeBackground=o.background,o.hoverBackground=o.background),o.color&&(o.hoverColor=o.color,o.activeColor=o.color),o.textColor&&(o.activeTextColor=o.textColor,o.hoverTextColor=o.textColor),s.calculative.visible=!0,s.visible=!0,Object.assign(s,o,{row:r}),Object.assign(s.calculative,o,{row:r})}),e.calculative.canvas.render()}function aA(e){au(e)}function sA(e,t){t.onClick||(t.onClick=nA,t.setTheme=rA);let i=t.calculative.worldRect.x,a=t.calculative.worldRect.y,s=t.calculative.worldRect.width,n=t.calculative.worldRect.height;s<n*1.5&&(s=1.5*n),e.beginPath(),e.arc(i+n/2,a+n/2,n/2,Math.PI/2,Math.PI*3/2),e.lineTo(i+s-n/2,a),e.arc(i+s-n/2,a+n/2,n/2,-Math.PI/2,Math.PI/2),e.lineTo(i+n/2,a+n),t.checked?(e.fillStyle=t.onColor,(t.disabled||t.disable)&&(e.fillStyle=t.disableOnColor||ke(.6,t.onColor)),t.lineWidth&&(e.strokeStyle=t.onStrokeColor,e.stroke()),e.fill(),e.closePath(),e.beginPath(),e.fillStyle="#ffffff",e.moveTo(i+n*2,a+n/2),e.arc(i+s-n/2,a+n/2,n/2>2?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 nA(e){e.disableDefaultClick||e.disabled||e.disable||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function rA(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 oA(e,t){t.onAdd||(t.onAdd=pn,t.onResize=pn,t.onMove=pn,t.onMouseMove=lA,t.onMouseDown=P0,t.onValue=cA,t.onBeforeValue=uA,t.onMouseUp=fA,t.setTheme=hA),t.calculative.barRect||pn(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,o=t.calculative.barRect.height,l=o/2;e.moveTo(s+l,n),e.arcTo(s+r,n,s+r,n+o,l),e.arcTo(s+r,n+o,s,n+o,l),e.arcTo(s,n+o,s,n,l),e.arcTo(s,n,s+r,n,l),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+l,n),e.arcTo(s+r,n,s+r,n+o,l),e.arcTo(s+r,n+o,s,n+o,l),e.arcTo(s,n+o,s,n,l),e.arcTo(s,n,s+r,n,l),e.fill(),e.fillStyle=t.btnBackground||"#fff",e.strokeStyle=u,e.lineWidth=2,e.beginPath();const c=t.calculative.canvas.store.data.scale;s=t.calculative.worldRect.x+t.calculative.ballRect.x+20*c,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 pn(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;e.calculative.worldRect.width/e.sliderWidth;const t=e.calculative.worldRect.height/e.sliderHeight,i=e.calculative.canvas.store.data.scale,a=e.calculative.worldRect.width-3*e.calculative.fontSize;e.calculative.barRect={x:0+20*i,y:(e.calculative.worldRect.height-e.barHeight*t)/2,width:a-20*i,height:e.barHeight*t},re(e.calculative.barRect),nu(e)}function nu(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,Ii(e)}function P0(e,t){if(e.disabled)return;let i=0;const a=e.calculative.canvas.store.data.scale,s=t.x-e.calculative.worldRect.x-20*a;if(s>e.calculative.barRect.width)i=100;else{let n=s/e.calculative.barRect.width*100;if(n<1?i=0:n>99?i=100:i=Math.round(n),i<e.min||i>e.max||i<0||i>100)return}e.value=i,nu(e),e.calculative.text=e.value+e.unit,Ii(e),e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render()}function lA(e,t){e.calculative.canvas.mouseDown&&P0(e,t)}function cA(e){e.calculative.isUpdateData&&(delete e.calculative.isUpdateData,pn(e)),nu(e)}function uA(e,t){return e.calculative.isUpdateData=!1,(t.textWidth||t.barHeight)&&(t.textWidth&&(e._textWidth=0),e.calculative.isUpdateData=!0),t}function hA(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 fA(e,t){e.calculative.canvas.store.emitter.emit("change",e)}function dA(e,t){t.onMouseDown||(t.onMouseDown=gA),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:o,fontFamily:l,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":zi(t,t.calculative.canvas.parent.store)||"#000000d9",e.textAlign="start",e.textBaseline="middle",e.font=Be({fontStyle:n,fontWeight:r,fontFamily:l||t.calculative.canvas.parent.store.options.fontFamily,fontSize:o,lineHeight:u}),e.fillText(t.value+"",i+s+10,a+s/2),e.restore()}function gA(e,t){e.isForbidden||(e.checked=!e.checked,e.calculative.canvas.store.emitter.emit("valueUpdate",e),e.calculative.canvas.render())}function vA(e,t){t.options||(t.options=t.data),t.onAdd||(t.onAdd=mA,t.optionPos||(t.onAdd(t),t.calculative.canvas.parent.active([t])),t.onMouseDown=yA,t.onValue=pA,t.onBeforeValue=wA);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:o,fontSize:l,fontFamily:u,lineHeight:c}=t.calculative;if(t.direction=="horizontal")for(let d=0;d<t.optionPos.length;d++){const f=t.optionPos[d]*n/t.checkboxWidth,g=t.options[d].isForbidden||t.disabled;e.beginPath(),e.arc(i+f+s/2,a+s/2,s/2,0,Math.PI*2),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.options[d].text===t.checked&&(e.strokeStyle=t.options[d].background||t.background||"#1890ff"),g&&(e.fillStyle=t.disabledBackground||ke(.6,t.background)||"#ebebeb",e.strokeStyle=t.disabledColor||ke(.6,t.color)||"#d9d9d9",t.options[d].text===t.checked&&(e.fillStyle="#ffffff00")),e.closePath(),e.fill(),e.stroke(),e.save(),t.options[d].text===t.checked&&(e.beginPath(),e.strokeStyle=t.options[d].background?t.options[d].background+"20":t.background||"#1890ff20",g&&(e.strokeStyle=t.disabledBackground||ke(.6,t.background)||"#ebebeb"),e.arc(i+s/2+f,a+s/2,s/2+1.5,0,Math.PI*2),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle=t.options[d].background||t.background||"#1890ff",g&&(e.fillStyle=t.disabledBackground||ke(.6,t.background)||"#ebebeb"),e.arc(i+s/2+f,a+s/2,s/4,0,Math.PI*2),e.fill(),e.closePath()),e.restore(),e.save(),e.fillStyle=g?t.disabledTextColor||"#00000040":zi(t,t.calculative.canvas.parent.store)||"#000000d9";const m=t.calculative.worldRect.height*14/16;e.textAlign="start",e.textBaseline="middle",e.font=Be({fontStyle:r,fontWeight:o,fontFamily:u||t.calculative.canvas.parent.store.options.fontFamily,fontSize:m,lineHeight:c}),e.fillText(t.options[d].text,i+s+f+10/t.checkboxWidth*n,a+s/2),e.restore()}else if(t.direction=="vertical"){const d=t.optionHeight*s/t.checkboxHeight;for(let f=0;f<t.optionPos.length;f++){const g=t.optionPos[f]*s/t.checkboxHeight,m=t.options[f].isForbidden;e.beginPath(),e.arc(i+d/2,a+d/2+g,d/2,0,Math.PI*2),e.strokeStyle="#d9d9d9",e.fillStyle="#ffffff00",t.options[f].text===t.checked&&(e.strokeStyle=t.options[f].background||"#1890ff"),m&&(e.fillStyle="#ebebeb",e.strokeStyle="#d9d9d9"),e.closePath(),e.fill(),e.stroke(),e.save(),!m&&t.options[f].text===t.checked&&(e.beginPath(),e.strokeStyle=t.options[f].background?t.options[f].background+"20":"#1890ff20",e.arc(i+d/2,a+d/2+g,d/2+1.5,0,Math.PI*2),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle=t.options[f].background||"#1890ff",e.arc(i+d/2,a+d/2+g,d/4,0,Math.PI*2),e.fill(),e.closePath()),e.restore(),e.save(),e.fillStyle=m?"#00000040":zi(t,t.calculative.canvas.parent.store)||"#000000d9";const y=14*t.calculative.worldRect.height/t.checkboxHeight;e.textAlign="start",e.textBaseline="middle",e.font=Be({fontStyle:r,fontWeight:o,fontFamily:u||t.calculative.canvas.parent.store.options.fontFamily,fontSize:y,lineHeight:c}),e.fillText(t.options[f].text,i+d+10,a+d/2+g),e.restore()}}}function mA(e){_0(e)}function yA(e,t){if(e.direction=="horizontal")for(let i=0;i<e.optionPos.length;i++)!e.options[i].isForbidden&&t.x>e.calculative.worldRect.x+e.optionPos[i]*e.calculative.worldRect.width/e.checkboxWidth&&t.x<e.calculative.worldRect.x+(e.optionPos[i]+e.height)/e.checkboxWidth*e.calculative.worldRect.width+x0(e.options[i].text,e)+10/e.checkboxWidth*e.calculative.worldRect.width&&(e.checked=e.options[i].text,e.calculative.canvas.store.emitter.emit("valueUpdate",e));else if(e.direction=="vertical"){const i=e.calculative.worldRect.height/e.checkboxHeight;for(let a=0;a<e.optionPos.length;a++)!e.options[a].isForbidden&&t.y>e.calculative.worldRect.y+e.optionPos[a]*i&&t.y<e.calculative.worldRect.y+(e.optionPos[a]+e.optionHeight)*i&&(e.checked=e.options[a].text,e.calculative.canvas.store.emitter.emit("valueUpdate",e))}e.calculative.canvas.render()}function pA(e){e.calculative.flag&&_0(e)}function wA(e,t){return e.calculative.flag=!1,(t.options!==void 0||t.direction!==void 0||t.optionInterval!==void 0||t.optionHeight!==void 0)&&(e.calculative.flag=!0),t}function F9(){return{radio:vA,switch:sA,slider:oA,checkbox:dA,table:Id,table2:Id}}function bA(e,t){const{x:i,y:a,width:s,height:n}=t.calculative.worldRect;e.beginPath(),e.ellipse(i+s/2,a+n/2,s/2,n/2,0,0,Math.PI*2),e.stroke(),e.beginPath(),e.fillStyle=e.strokeStyle,e.ellipse(i+s/2,a+n/2,s/4,n/4,0,0,Math.PI*2),e.fill()}function xA(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ey:o}=e.calculative.worldRect,l=e.calculative.lineLeft||.08;let u=e.calculative.borderRadius||0,c=u;u<1&&(u=n*u,c=r*u);let d=u<c?u:c;if(n<2*d&&(d=n/2),r<2*d&&(d=r/2),i.moveTo(a+d,s),i.arcTo(a+n,s,a+n,s+r,d),i.arcTo(a+n,s+r,a,s+r,d),i.arcTo(a,s+r,a,s,d),i.arcTo(a,s,a+n,s,d),i.closePath(),i.moveTo(a+l*n,s),i.lineTo(a+l*n,o),i instanceof Path2D)return i}function _A(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o}=e.calculative.worldRect,l=e.calculative.lineTop||.08;let u=e.calculative.borderRadius||0,c=u;u<1&&(u=n*u,c=r*c);let d=u<c?u:c;if(n<2*d&&(d=n/2),r<2*d&&(d=r/2),i.moveTo(a+d,s),i.arcTo(a+n,s,a+n,s+r,d),i.arcTo(a+n,s+r,a,s+r,d),i.arcTo(a,s+r,a,s,d),i.arcTo(a,s,a+n,s,d),i.closePath(),i.moveTo(a,s+l*r),i.lineTo(o,s+l*r),i instanceof Path2D)return i}function P9(){return{forkV:ja,forkH:ja,swimlaneH:xA,swimlaneV:_A}}function R9(){return{activityFinal:bA}}function EA(e,t){e.onDestroy||(e.onDestroy=CA,e.onAdd=AA);const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o}=e.calculative.worldRect;let l=e.calculative.borderRadius||0,u=l;l<1&&(l*=n,u*=r);let c=l<u?l:u;n<2*c&&(c=n/2),r<2*c&&(c=r/2),i.moveTo(a+c,s),i.arcTo(a+n,s,a+n,s+r,c),i.arcTo(a+n,s+r,a,s+r,c),i.arcTo(a,s+r,a,s,c),i.arcTo(a,s,a+n,s,c);const d=.2*r;i.moveTo(a,s+d),i.lineTo(o,s+d);const f=s+d+(r-d)/2;if(i.moveTo(a,f),i.lineTo(o,f),i.closePath(),i instanceof Path2D)return i}function AA(e){const{x:t,y:i,width:a,height:s}=e.calculative.worldRect,n=e.list,r={name:"text",x:t,y:i+.2*s,width:a,height:.4*s,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10},o={name:"text",x:t,y:i+.6*s,width:a,height:.4*s,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10};Object.assign(r,n[0]),Object.assign(o,n[1]),e.calculative.canvas.makePen(r),e.calculative.canvas.makePen(o),e.calculative.canvas.parent.pushChildren(e,[r]),e.calculative.canvas.parent.pushChildren(e,[o])}function CA(e){const t=e.calculative.canvas.store;e.children.forEach(i=>{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 kA(e,t){e.onDestroy||(e.onDestroy=PA,e.onAdd=FA);const i=t||new Path2D,{x:a,y:s,width:n,height:r,ex:o}=e.calculative.worldRect;let l=e.calculative.borderRadius||0,u=l;l<1&&(l=n*l,u=r*u);let c=l<u?l:u;n<2*c&&(c=n/2),r<2*c&&(c=r/2),i.moveTo(a+c,s),i.arcTo(a+n,s,a+n,s+r,c),i.lineTo(a+n,s+r-c),i.arcTo(a+n,s+r,a,s+r,c),i.arcTo(a,s+r,a,s,c),i.arcTo(a,s,a+n,s,c);const d=.2*r;if(i.moveTo(a,s+d),i.lineTo(o,s+d),i.closePath(),i instanceof Path2D)return i}function FA(e){const{x:t,y:i,width:a,height:s}=e.calculative.worldRect,n=e.list;let r={name:"text",x:t,y:i+.2*s,width:a,height:.8*s,textAlign:"left",textBaseline:"top",textLeft:10,textTop:10};Object.assign(r,n[0]),e.calculative.canvas.makePen(r),e.calculative.canvas.parent.pushChildren(e,[r])}function PA(e){const t=e.calculative.canvas.store;e.children.forEach(i=>{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 S9(){return{interfaceClass:EA,simpleClass:kA}}function RA(e){if(!e||typeof e!="object")return e;const t=JSON.parse(JSON.stringify(e)),i=new Set(["text","subtext","name","label","placeholder"]),a=new Set(["type","id","formatter","color","emphasis","itemStyle","lineStyle","areaStyle","textStyle","axisLabel"]);function s(n,r){if(Array.isArray(n))return n.map((o,l)=>s(o,r));if(typeof n=="string")return r&&i.has(r)?Ce(n):n;if(typeof n=="function")return n;if(n&&typeof n=="object"){const o={};for(const l in n)if(!!n.hasOwnProperty(l)){if(a.has(l)){o[l]=n[l];continue}o[l]=s(n[l],l)}return o}return n}return s(t)}const Dd={enter:"mouseover",leave:"mouseout"};var _n;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(_n||(_n={}));let Ic=["fontSize","lineHeight","nameGap","margin","width","height","symbolSize","itemWidth","itemHeight","fontWeight","top","left","right","bottom","zoom","edgeSymbolSize","nodeWidth","nodeGap","distance","length","length2","offsetCenter","size","symbolOffset","padding","barWidth","symbolOffset","shadowOffsetY","shadowOffsetX","itemGap","pageIconSize","scrollIconSize","pageItemGap","pageTextGap","borderWidth","borderRadius","itemGap","labelWidth","labelHeight","centerX","centerY","radius2","startAngle","endAngle","richWidth","richHeight"];const SA=["formatter","color"];function Ga(e,t,i){var s,n;const a=(n=(s=e.calculative)==null?void 0:s.singleton)==null?void 0:n.echart;if(!a)return!1;if(t==null)return console.warn("[meta2d:echarts] Skip setOption because option is empty.",e),!1;try{return a.setOption(t,i),!0}catch(r){return console.error("[meta2d:echarts] setOption failed.",{penId:e.id,option:t,opts:i,error:r}),!1}}function Ao(e){var n,r,o,l,u;const t=(r=(n=e.calculative)==null?void 0:n.singleton)==null?void 0:r.echart,i=(l=(o=e.calculative)==null?void 0:o.singleton)==null?void 0:l.div;if(!t||!i||!i.isConnected)return!1;const{width:a,height:s}=((u=e.calculative)==null?void 0:u.worldRect)||{};if(!(a>0)||!(s>0))return console.warn("[meta2d:echarts] Skip resize because container size is invalid.",{penId:e.id,width:a,height:s}),!1;try{return t.resize(),!0}catch(c){return console.error("[meta2d:echarts] resize failed.",{penId:e.id,width:a,height:s,error:c}),!1}}function Md(e,t){if(!t)return;const i=t;e.calculative.img=i,e.calculative.imgNaturalWidth=i.width||i.naturalWidth,e.calculative.imgNaturalHeight=i.height||i.naturalHeight}function Dc(e){var t;return(t=e.echarts)!=null&&t.scaleDom?1:e.calculative.canvas.store.data.scale||1}function Ln(e,t){var o,l;if(!t||((o=e.echarts)!=null&&o.scaleDom&&(e.disableTransform=!0),Pe(e,t),!((l=e.echarts)!=null&&l.scaleDom)))return;const i=e.calculative.canvas.store.data.scale||1,a=e.calculative.worldRect,s=a.width/i,n=a.height/i;t.style.width=s+"px",t.style.height=n+"px",t.style.transformOrigin="0 0";const r=e.calculative.rotate||0;t.style.transform=r?`scale(${i}) translate(${s/2}px, ${n/2}px) rotate(${r}deg) translate(${-s/2}px, ${-n/2}px)`:`scale(${i})`}function Wr(e){var n,r,o,l,u,c,d,f,g,m;const t=(r=(n=e.calculative)==null?void 0:n.singleton)==null?void 0:r.echart,i=(l=(o=e.calculative)==null?void 0:o.singleton)==null?void 0:l.div;if(!t||!i||((c=(u=e.calculative)==null?void 0:u.singleton)==null?void 0:c.echartsReady)===!1)return;Ln(e,i),Ao(e),(g=(d=t.getZr)==null?void 0:(f=d.call(t)).flush)==null||g.call(f);const a=(m=t.getRenderedCanvas)==null?void 0:m.call(t,{pixelRatio:2});if((a==null?void 0:a.width)&&(a==null?void 0:a.height)){Md(e,a);return}const s=new Image;s.onload=()=>Md(e,s);try{s.src=t.getDataURL({pixelRatio:2})}catch(y){console.error("[meta2d:echarts] getDataURL failed.",{penId:e.id,error:y})}}function TA(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{}Ic=((s=e.calculative.canvas.store.options.diagramOptions.chart)==null?void 0:s.keyWords)||Ic,e.onDestroy||(e.onDestroy=IA,e.onMove=Kr,e.onResize=DA,e.onRotate=Kr,e.onValue=LA,e.onBeforeValue=OA,e.onBinds=zA,e.onMouseEnter=Kr,e.onRenderPenRaw=Wr,e.onScale=MA),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),e.echarts.scaleDom!==!1&&(e.echarts.scaleDom=!0),Ln(e,r),e.calculative.singleton.div=r,e.calculative.singleton.echart=t.init(r,e.echarts.theme),BA(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(o=>{o.text().then(l=>{if(typeof l=="string")try{l=JSON.parse(l)}catch{}if(l.constructor!==Object&&l.constructor!==Array){console.warn("Invalid data:",l);return}t.registerMap(e.echarts.geoName,l),e.calculative.singleton.echartsReady=!0,Ga(e,mo(e.echarts.option,Dc(e),e.calculative.canvas.store.options),!0),Ao(e),setTimeout(()=>Wr(e),300)})}))),e.calculative.singleton.echartsReady&&setTimeout(()=>{if(e.echarts.initJs){const l=Te(e.calculative.canvas.store.options,"myChart","context",`return async function () { ${e.echarts.initJs}}`)(e.calculative.singleton.echart,{meta2d:this,pen:e});l==null||l().then(u=>{if(u&&Ga(e,u,!0)){let d=e.calculative.singleton.echart.getOption();e.echarts.option=d,setTimeout(()=>Wr(e),300)}})}else Ga(e,mo(e.echarts.option,Dc(e),e.calculative.canvas.store.options),!0);setTimeout(()=>Wr(e),300)})}return i}function BA(e){var a;const t=e.calculative.singleton.echart,i=["click","dblclick","mousedown","mousemove","mouseup","mouseover","mouseout","globalout","contextmenu"];(a=e.events)==null||a.forEach(s=>{s.actions&&s.actions.length&&i.includes(Dd[s.name]||s.name)&&t.getZr().on(Dd[s.name]||s.name,n=>{let r=!1;s.conditions&&s.conditions.length?s.conditionType==="and"?r=s.conditions.every(o=>e.calculative.canvas.parent.judgeCondition(e,o.key,o)):s.conditionType==="or"&&(r=s.conditions.some(o=>e.calculative.canvas.parent.judgeCondition(e,o.key,o))):r=!0,r&&s.actions.forEach(o=>{if(o.timeout){let l=setTimeout(()=>{e.calculative.canvas.parent.events[o.action]&&(e.calculative.canvas.parent.events[o.action](e,o,n),clearTimeout(l),l=null)},o.timeout)}else e.calculative.canvas.parent.events[o.action]&&e.calculative.canvas.parent.events[o.action](e,o,n)})})})}function IA(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 Kr(e){e.calculative.singleton.div&&Ln(e,e.calculative.singleton.div)}function DA(e){e.debounceTime?(e.resizeFn||(e.resizeFn=Ld,e.debounceResize=Kc.debounce(e,"resizeFn",e.debounceTime)),e.debounceResize(e)):Ld(e)}function Ld(e){var t;Kr(e),(t=e.calculative.singleton)!=null&&t.echart&&Ao(e)}function MA(e){e.debounceTime?(e.scaleFn||(e.scaleFn=Od,e.debounceScale=Kc.debounce(e,"scaleFn",e.debounceTime)),e.debounceScale(e)):Od(e)}function Od(e){var i,a;if(!e.calculative.singleton.echart)return;let t=globalThis.echarts;if(Ln(e,e.calculative.singleton.div),!e.echarts.scaleDom&&!(e.echarts.geoName&&!t.getMap(e.echarts.geoName))){if(!(e.echarts.diabled||e.echarts.disabled)&&!e.echarts.initJs){if((i=e.echarts.option)!=null&&i.dataZoom){const s=e.calculative.singleton.echart.getOption();if(s!=null&&s.dataZoom){const n=s.dataZoom;(a=e.echarts.option.dataZoom)==null||a.forEach((r,o)=>{n[o]&&(r.start=n[o].start,r.end=n[o].end)})}}Ga(e,mo(e.echarts.option,e.calculative.canvas.store.data.scale,e.calculative.canvas.store.options),!0)}Ao(e)}}function LA(e){var t,i;if(!!e.calculative.singleton.echart&&(Ln(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)?Ga(e,ot(a),{replaceMerge:e.echarts.replaceMerge}):Ga(e,ot(a))}else Ga(e,mo(e.echarts.option,Dc(e),e.calculative.canvas.store.options),!0)}function OA(e,t){var m,y,p;if(e.calculative.partialOption=null,t.echarts){let x=globalThis.echarts;return t.echarts.geoName&&!x.getMap(t.echarts.geoName)&&(t.echarts.geoJson?x.registerMap(t.echarts.geoName,t.echarts.geoJson):t.echarts.geoUrl&&(e.calculative.singleton.echartsReady=!1,fetch(t.echarts.geoUrl).then(_=>{_.text().then(b=>{if(typeof b=="string")try{b=JSON.parse(b)}catch{}if(b.constructor!==Object&&b.constructor!==Array){console.warn("Invalid data:",b);return}return x.registerMap(t.echarts.geoName,b),e.calculative.singleton.echartsReady=!0,e.onValue(e),!1})}))),t}if(e.realTimes&&e.realTimes.length){e.echarts.dataMap&&t.data&&(t=NA(e,t));let x=Object.keys(t);const{xAxis:_,yAxis:b}=e.echarts.option,{max:C,replaceMode:P,timeFormat:S,autoGetTime:B=!0}=e.echarts;let D=[],V=!1,G=e.realTimes.filter(F=>F.bind&&F.bind.class==="iot"&&F.bind.compute_name);if(G.length&&G.find(R=>x.includes(R.key))){let R={},T=[];for(let L in t)L.includes("echarts.option.series")&&(R[L]=Object.fromEntries(t[L]),T.push(...Object.keys(R[L])));T=[...new Set(T)].sort((L,$)=>L-$);for(let L in t)L.includes("echarts.option.series")&&(R[L]=T.map($=>R[L][$]));return(T[0]+"").length===19&&(T=T.map(L=>L/1e6)),T=T.map(L=>{var $,Z,at;return no(S||"`${year}:${month}:${day} ${hours}:${minutes}:${seconds}`",L,(at=(Z=($=e.calculative)==null?void 0:$.canvas)==null?void 0:Z.store)==null?void 0:at.options)}),R["echarts.option.xAxis.data"]=T,R}for(let F in t)if(F.includes("echarts.option")){V=!0,F.includes("series.links.")&&(V=!1);let R=Ne(e,F);if(Array.isArray(R)&&P===_n.Add&&(R.push(t[F]),C&&R.splice(0,R.length-C),t[F]=R,B&&!x.includes("echarts.option.xAxis.data"))){let T="echarts.option.xAxis.data";if(!t[T]){Array.isArray(_)&&_.length&&(T="echarts.option.xAxis.0.data");let L=Ne(e,T),$=no(S||"`${hours}:${minutes}:${seconds}`",void 0,(p=(y=(m=e.calculative)==null?void 0:m.canvas)==null?void 0:y.store)==null?void 0:p.options);L.push($),C&&L.splice(0,L.length-C),t[T]=L}}if(F.includes(".data.")){let T=F.substring(0,F.indexOf(".data.")+5);D.includes(T)||D.push(T)}}if(V){const F=ot(t);e.calculative.partialOption=WA(F,e),D.forEach(R=>{let T=Ne(e,R);so(e.calculative.partialOption,R,T)})}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,o=[];r&&o.push("echarts.option.series");const l=i.option.series,u=l.length,{xAxis:c,yAxis:d}=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 f=Array.isArray(c)?c[0]:c,g=Array.isArray(d)?d[0]:d;if(s)if(s===_n.Replace){if(!f&&!g)r&&(u===1?(!Array.isArray(r)&&(r=[r]),r.forEach((x,_)=>{const b=l[0].data.find(C=>C.name===x.name);b&&(b.value=x.value)})):l.forEach((x,_)=>{Array.isArray(r[_])||(r[_]=[r[_]]),r[_].forEach((b,C)=>{const P=x.data.find(S=>S.name===b.name);P&&(P.value=b.value)})}));else if((f.type==="category"||g.type==="category")&&n&&r){const x=f.type==="category"?f.data:g.data;!Array.isArray(n)&&(n=[n]),!Array.isArray(r)&&(r=[r]),f.type==="category"?o.push("echarts.option.xAxis"):o.push("echarts.option.yAxis"),u===1?r.forEach((_,b)=>{const C=x.indexOf(n[b]);l[0].data[C]=_}):l.forEach((_,b)=>{r[b].forEach((C,P)=>{const S=x.indexOf(n[P]);_.data[S]=C})})}}else s===_n.ReplaceAll&&(n&&(f.data=n,f.data.splice(0,f.data.length-a),o.push("echarts.option.xAxis")),r&&(u===1?(l[0].data=r,l[0].data.splice(0,l[0].data.length-a)):l.forEach((x,_)=>{x.data=r[_],x.data.splice(0,x.data.length-a)})));else{if(n){!Array.isArray(n)&&(n=[n]);const x=f.data;x.push(...n),x.splice(0,x.length-a),o.push("echarts.option.xAxis")}if(r)if(u===1){!Array.isArray(r)&&(r=[r]);const x=l[0].data;x.push(...r),x.splice(0,x.length-a)}else l.forEach((x,_)=>{Array.isArray(r[_])||(r[_]=[r[_]]);const b=x.data;b.push(...r[_]),b.splice(0,b.length-a)})}return e.calculative.partialOption={},o.forEach(x=>{let _=Ne(e,x);so(e.calculative.partialOption,x,_)}),delete t.dataX,delete t.dataY,Object.assign(t,{echarts:i})}function NA(e,t){var i,a,s,n,r;if(!e.echarts.dataMap||!t.data)return t;if(t.data){let o={};if(Array.isArray(t.data))for(const l in e.echarts.dataMap)e.echarts.dataMap.hasOwnProperty(l)&&(((i=e.echarts.timeKeys)==null?void 0:i.length)&&e.echarts.timeKeys.includes(e.echarts.dataMap[l])?o[l]=t.data.map(u=>{var c,d,f;return no(e.echarts.timeFormat,u[e.echarts.dataMap[l]],(f=(d=(c=e.calculative)==null?void 0:c.canvas)==null?void 0:d.store)==null?void 0:f.options)}):o[l]=t.data.map(u=>u[e.echarts.dataMap[l]]));else for(const l in e.echarts.dataMap)e.echarts.dataMap.hasOwnProperty(l)&&(((a=e.echarts.timeKeys)==null?void 0:a.length)&&e.echarts.timeKeys.includes(e.echarts.dataMap[l])?o[l]=no(e.echarts.timeFormat,t.data[e.echarts.dataMap[l]],(r=(n=(s=e.calculative)==null?void 0:s.canvas)==null?void 0:n.store)==null?void 0:r.options):o[l]=t.data[e.echarts.dataMap[l]]);return delete t.data,Object.assign(t,o),t}}function zA(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,o=Array.isArray(n)?n[0]:n,l=a.option.series;if(!r&&!o){const u=[];if(Array.isArray(l)&&l.length===1)return l[0].data.forEach(c=>{const{dataId:d}=i.dataIds.find(f=>f.name===c.name);if(d){const f=t.find(g=>g.dataId===d);f&&u.push({name:c.name,value:f.value})}}),{id:e.id,dataY:u}}else if(r.type==="category"||o.type==="category"){const u=[],c=[],d=r.type==="category"?r.data:o.data;return d==null||d.forEach(f=>{const{dataId:g}=i.dataIds.find(m=>m.name===f);if(g){const m=t.find(y=>y.dataId===g);m&&(c.push(f),u.push(m.value))}}),{id:e.id,dataY:u,dataX:c}}else if(r.type==="time"){const u=[],c=+new Date;let d=!1;if(l.forEach((f,g)=>{const m=[],{dataId:y}=i.dataIds.find(p=>p.name===f.name);if(y){const p=t.find(x=>x.dataId===y);p&&(m.push([c,p.value]),d=!0)}u[g]=m}),d)u.forEach((f,g)=>{if(!f||f.length===0){const m=l[g].data[l[g].data.length-1];u[g]=[[c,m[1]]]}});else return;return{id:e.id,dataY:u.length===1?u[0]:u}}}function mo(e,t,i){const a=ot(e),s=RA(a);if(s.dataZoom){let n=["right","top","width","height","left","bottom"];for(let r=0;r<n.length;r++)s.dataZoom.forEach(o=>{isNaN(o[n[r]])||(o[n[r]]*=t)})}return Ec(s,Ic,t),Mc(s,SA,i),s}function WA(e,t){const i={};return Object.keys(e).forEach(a=>{const s=a.split(".");let n=i;s.forEach((r,o)=>{const l=!isNaN(parseInt(r));if(o===6){let u=s.slice(0,7).join(".");so(t,a,e[a]);let c=Ne(t,u);n[s[o]]=c}else{if(o>6)return;if(o===s.length-1)l?(Array.isArray(n)||(n=[]),n[parseInt(r)]=e[a]):n[r]=e[a];else if(l){const u=parseInt(r);if(Array.isArray(n)||n[s[o-1]],n[u]||(n[u]={}),Array.isArray(n))for(let c=0;c<parseInt(r);c++)n[c]||(n[c]={});n=n[u]}else n[r]||(["series","yAxis","xAxis"].includes(r)&&!isNaN(parseInt(s[o+1]))?n[r]=[]:n[r]={}),n=n[r]}})}),i}function HA(e){if(typeof e!="string")return!1;const t=e.trim(),i=/^\s*function(\s+\w+)?\s*\([^)]*\)\s*\{[\s\S]*\}\s*$/,a=/^\s*(\([^)]*\)|\w+)\s*=>\s*(\{[\s\S]*\}|[^{}]+)\s*$/;return i.test(t)||a.test(t)}function Mc(e,t,i){if(Array.isArray(e)){const a=[];return e.forEach(s=>{a.push(Mc(s,t,i))}),a}else if(typeof e=="object"){if(e===null)return null;for(const a in e)t.includes(a)?HA(e[a])&&(e[a]=G2(i,e[a])):e[a]=Mc(e[a],t,i);return e}return e}function T9(e){e&&(globalThis.echarts=e),Ig({echarts:TA})}const UA=15;function La(e,t=UA){let i=""+e;return i.indexOf(".")>=0&&(i=Number.parseFloat(i).toFixed(t)),Number.parseFloat(i)}function rc(e){return typeof e=="number"&&Number.isFinite(e)}function VA(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:o}=e;if(!rc(i)||!rc(a)||i<a)return{splitNumber:s};if(i===a&&i===0)return{max:La(t[0]*s),min:a,interval:t[0],splitNumber:s};i===a&&(o=!0),(!rc(s)||s<=0)&&(s=4),o&&i*a>0&&(i<0?i=0:a=0);const l=(i-a)/s;let u=Math.floor(Math.log10(l)-1);u=Math.pow(10,u);const c=l/u;let d=t[0]*u,f=-1,g;for(g=0;g<t.length;g++)if(t[g]>c){d=t[g]*u;break}let m=i,y=a;function p(_){if(m=parseInt(""+(i/_+1))*_,y=parseInt(""+(a/_-1))*_,i===0&&(m=0),a===0&&(y=0),n&&m*y<0){const b=Math.max(Math.abs(m),Math.abs(y));m=b,y=-b}}if(p(d),r)return{max:La(m),min:La(y),interval:La(d),splitNumber:Math.round((m-y)/d)};if(!n||m*y>0){let _;t:do{if(_=Math.round((m-y)/d),(g-f)*(_-s)<0){for(;_<s;)if(y-a<=m-i&&y!==0||m===0?y-=d:m+=d,_++,_===s)break t}if(g>=t.length-1||g<=0||_===s)break;f=g,_>s?d=t[++g]*u:d=t[--g]*u,p(d)}while(_!==s)}m=La(m),y=La(y);const x=La((m-y)/s);return{max:m,min:y,interval:x,splitNumber:s}}function R0(e,t){var p,x,_,b,C,P,S,B,D,V,G,F,R,T,L,$,Z,at,q,W,j,K,U,tt,st,it,ht,lt;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,o=[];if(t.echarts)for(let ut=0;ut<t.echarts.option.series.length;ut++)o.push(t.echarts.option.series[ut].data);else o=t.data;let l=[];for(let ut=0;ut<o.length;ut++)l=l.concat(o[ut]);let u={max:Math.max.apply(null,l),min:Math.min.apply(null,l),splitNumber:5},c=VA(u),d=t.echarts?t.echarts.option.xAxis.data.length:t.xAxisData.length;e.beginPath(),e.strokeStyle="#BFBFBF",e.lineWidth=6*r,e.lineCap="butt";let f=(s-1*(d+1))/d;e.setLineDash([1,f]),e.moveTo(i,a+n+3*r),e.lineTo(i+s,a+n+3*r),e.stroke(),e.closePath(),e.beginPath(),e.lineWidth=1*r,e.setLineDash([]),e.moveTo(i,a+n),e.lineTo(i+s,a+n),e.stroke(),e.closePath(),e.beginPath(),e.fillStyle="#BFBFBF",e.strokeStyle="#E9E9E9",e.setLineDash([2,2]);let g={fontStyle:((x=(p=t.yAxis)==null?void 0:p.axisLabel)==null?void 0:x.fontStyle)||t.fontStyle,textDecoration:(b=(_=t.yAxis)==null?void 0:_.axisLabel)==null?void 0:b.textDecoration,fontWeight:((P=(C=t.yAxis)==null?void 0:C.axisLabel)==null?void 0:P.fontWeight)||t.fontWeight,fontFamily:((B=(S=t.yAxis)==null?void 0:S.axisLabel)==null?void 0:B.fontFamily)||t.fontFamily,fontSize:((V=(D=t.yAxis)==null?void 0:D.axisLabel)==null?void 0:V.fontSize)||t.fontSize,lineHeight:((F=(G=t.yAxis)==null?void 0:G.axisLabel)==null?void 0:F.lineHeight)||t.lineHeight};e.fillStyle=((T=(R=t.yAxis)==null?void 0:R.axisLabel)==null?void 0:T.fontColor)||t.color;for(let ut=0;ut<c.splitNumber+1;ut++){let E=ut*n/c.splitNumber;e.textAlign="right",e.textBaseline="middle",e.font=Be(g),e.fillText(c.max-ut*c.interval+"",i-10*r,a+E),e.fill(),ut<c.splitNumber&&(e.beginPath(),e.moveTo(i,a+E),e.lineTo(i+s,a+E),e.stroke())}e.closePath(),e.beginPath(),e.strokeStyle="#BFBFBF";let m=t.echarts?t.echarts.option.xAxis.data:t.xAxisData,y=0;for(let ut=0;ut<m.length;ut++){y=i+(1+f/2)+(f+1)*ut,e.textAlign="center",e.textBaseline="top";let E={fontStyle:(($=(L=t.xAxis)==null?void 0:L.axisLabel)==null?void 0:$.fontStyle)||t.calculative.fontStyle,textDecoration:(at=(Z=t.xAxis)==null?void 0:Z.axisLabel)==null?void 0:at.textDecoration,fontWeight:((W=(q=t.xAxis)==null?void 0:q.axisLabel)==null?void 0:W.fontWeight)||t.calculative.fontWeight,fontFamily:((K=(j=t.xAxis)==null?void 0:j.axisLabel)==null?void 0:K.fontFamily)||t.calculative.fontFamily,fontSize:((tt=(U=t.xAxis)==null?void 0:U.axisLabel)==null?void 0:tt.fontSize)||t.calculative.fontSize,lineHeight:((it=(st=t.xAxis)==null?void 0:st.axisLabel)==null?void 0:it.lineHeight)||t.calculative.lineHeight};e.font=Be(E),e.fillStyle=((lt=(ht=t.xAxis)==null?void 0:ht.axisLabel)==null?void 0:lt.fontColor)||t.calculative.color,e.fillText(m[ut],y,a+n+10*r),e.fill()}return e.closePath(),e.setLineDash([]),{dash:f,normalizedOption:c}}function $A(e,t){if(!isNaN(e))return t===-1?e:Math.round(Number(e)*1e3)/1e3}var zs;(function(e){e[e.Add=0]="Add",e[e.Replace=1]="Replace",e[e.ReplaceAll=2]="ReplaceAll"})(zs||(zs={}));function jA(e,t){t.onBeforeValue||(t.onBeforeValue=S0);const i=t.calculative.worldRect.x,a=t.calculative.worldRect.y;t.calculative.worldRect.width;const s=t.calculative.worldRect.height;let n=t.calculative.canvas.store.data.scale,r=[];t.echarts&&!t.echarts.option.color&&(t.echarts.option.color=["#1890ff","#2FC25B","#FACC14","#c23531","#2f4554","#61a0a8","#d48265"]);let o=R0(e,t),l=o.dash,u=o.normalizedOption;const c=!!(t.echarts?t.echarts.option.series[0].smooth:t.smooth);let d=[];if(t.echarts)for(let f=0;f<t.echarts.option.series.length;f++)r.push(t.echarts.option.series[f].data);else r=t.data;for(let f=0;f<r.length;f++){e.beginPath();let g=r[f];e.strokeStyle=t.echarts?t.echarts.option.color[f]:t.chartsColor[f],e.fillStyle=t.echarts?t.echarts.option.color[f]:t.chartsColor[f];let m=i+(1+l/2),y=a+s-(g[0]-u.min)/(u.max-u.min)*s;if(e.moveTo(m,y),d.push({x:m,y}),c)if(g.length<=2)for(let p=1;p<g.length;p++)m=i+(1+l/2)+(l+1)*p,y=a+s-(g[p]-u.min)/(u.max-u.min)*s,e.lineTo(m,y),d.push({x:m,y});else{let p,x,_,b;g.forEach((C,P)=>{m=i+(1+l/2)+(l+1)*P,y=a+s-(g[P]-u.min)/(u.max-u.min)*s;let S=i+(1+l/2)+(l+1)*(P+1),B=a+s-(g[P+1]-u.min)/(u.max-u.min)*s,D=i+(1+l/2)+(l+1)*(P-1),V=a+s-(g[P-1]-u.min)/(u.max-u.min)*s,G=i+(1+l/2)+(l+1)*(P+2),F=a+s-(g[P+2]-u.min)/(u.max-u.min)*s;P===0?(D=i+(1+l/2)+(l+1)*P,V=a+s-(g[P]-u.min)/(u.max-u.min)*s):P===g.length-2&&(G=i+(1+l/2)+(l+1)*(P+1),F=a+s-(g[P+1]-u.min)/(u.max-u.min)*s),d.push({x:m,y}),p=m+(S-D)/4,x=y+(B-V)/4,_=S-(G-m)/4,b=B-(F-y)/4,e.bezierCurveTo(p,x,_,b,S,B)})}else for(let p=1;p<g.length;p++)m=i+(1+l/2)+(l+1)*p,y=a+s-(g[p]-u.min)/(u.max-u.min)*s,e.lineTo(m,y),d.push({x:m,y});e.stroke(),e.closePath(),e.save(),d.forEach((p,x)=>{e.beginPath(),e.strokeStyle="#fff",e.lineWidth=2*n,e.arc(p.x,p.y,4*n,0,Math.PI*2),e.stroke(),e.fill(),e.closePath()}),e.restore(),d=[]}}function S0(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===zs.Replace?(t.dataX.forEach((o,l)=>{let u=i.indexOf(o);a.forEach((c,d)=>{c[u]=t.dataY[d][l]})}),n=i,r=a):s===zs.ReplaceAll&&(n=t.dataX,r=t.dataY):(n=[...i,...t.dataX],a.forEach((o,l)=>{let u=[...o,...t.dataY[l]];r.push(u)})),delete t.dataX,delete t.dataY,Object.assign(t,{xAxisData:n,data:r})}function qA(e,t){var c,d;t.onBeforeValue||(t.onBeforeValue=YA);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,o=!!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 l=o?t.echarts.option.series:t.data;let u=0;for(let f=0;f<l.length;f++){let g=l[f],m=n/2;r<n&&(m=r/2);const y=a+n/2,p=s+r/2;let x=0;o?x=g.data.reduce((B,D)=>B+D.value,0):x=g.reduce((B,D)=>B+D.value,0);const _=m*parseFloat(o?g.radius[0]:t.chartsRadius[f][0])/100,b=m*parseFloat(o?g.radius[1]:t.chartsRadius[f][1])/100;if(_>b)return;let C=0,P=0;e.strokeStyle=o&&((c=g.itemStyle)==null?void 0:c.borderColor)||"#fff",e.lineWidth=(o&&((d=g.itemStyle)==null?void 0:d.borderWidth)||2)*i;const S=o?g.data:g;S.forEach((B,D)=>{var $,Z,at,q,W,j,K,U,tt,st,it,ht,lt;P+=Math.PI*2*B.value/x,e.beginPath();let V=u+D;V>=t.chartsColor.length&&(V=V%t.chartsColor.length),e.fillStyle=o?t.echarts.option.color[V]:t.chartsColor[V],e.moveTo(y+_*Math.sin(P),p-_*Math.cos(P)),e.arc(y,p,_,-Math.PI/2+P,-Math.PI/2+C,!0),e.lineTo(y+b*Math.sin(C),p-b*Math.cos(C)),e.arc(y,p,b,-Math.PI/2+C,-Math.PI/2+P),e.lineTo(y+_*Math.sin(P),p-_*Math.cos(P)),e.stroke(),e.fill(),e.closePath();let G=(C+P)/2,F=y+(b+10*i)*Math.sin(G),R=p-(b+10*i)*Math.cos(G),T=e.fillStyle;g.label||(g.label={position:"outside",show:!0}),o&&["inner","inside"].includes(g.label.position)?(e.fillStyle="#ffffff",F=y+(b-_)/2*Math.sin(G),R=p-(b-_)/2*Math.cos(G)):o&&g.label.position=="outside",g.labelLine||(g.labelLine={show:!0}),(o&&g.labelLine.show!==!1||!o)&&(e.beginPath(),e.strokeStyle=o?t.echarts.option.color[u+D]:t.chartsColor[u+D],e.moveTo(y+b*Math.sin(G),p-b*Math.cos(G)),e.lineTo(F,R));let L={fontStyle:(($=t.tickLabel)==null?void 0:$.fontStyle)||t.calculative.fontStyle,fontWeight:((Z=t.tickLabel)==null?void 0:Z.fontWeight)||t.calculative.fontWeight,fontFamily:((at=t.tickLabel)==null?void 0:at.fontFamily)||t.calculative.fontFamily,lineHeight:((q=t.tickLabel)==null?void 0:q.lineHeight)||t.calculative.lineHeight,fontSize:(((W=t.tickLabel)==null?void 0:W.fontSize)||t.calculative.fontSize)*i};e.font=Be(L),e.textBaseline="middle",e.textAlign="center",G>Math.PI?((o&&g.label.position==="outside"||!o)&&(e.textAlign="end"),(o&&g.labelLine.show!==!1||!o&&((U=(K=(j=t.tickLabel)==null?void 0:j.labelLine)==null?void 0:K.show)!=null?U:!0))&&e.lineTo(F-5*i,R),(o&&g.label.show!==!1||!o&&((st=(tt=t.tickLabel)==null?void 0:tt.show)!=null?st:!0))&&e.fillText(B.name,F-5*i,R)):((o&&g.label.position==="outside"||!o)&&(e.textAlign="start"),(o&&g.labelLine.show!==!1||!o)&&e.lineTo(F+5*i,R),(o&&g.label.show!==!1||!o&&((ht=(it=t.tickLabel)==null?void 0:it.show)!=null?ht:!0))&&e.fillText(B.name,F+5*i,R)),e.stroke(),e.closePath(),e.fillStyle=T,e.strokeStyle=o&&((lt=g.itemStyle)==null?void 0:lt.borderColor)||"#fff",C=P}),u+=S.length}}function YA(e,t){if(t.data||!t.dataX&&!t.dataY)return t;const i=e.data,a=e.replaceMode;let s=[];return a?a===zs.Replace?(t.dataY.forEach((n,r)=>{n.forEach((o,l)=>{let u=i[r].filter(c=>c.name===o.name);u.length>0&&(u[0].value=o.value)})}),s=i):a===zs.ReplaceAll&&(s=t.dataY):i.forEach((n,r)=>{let o=[...n,...t.dataY[r]];s.push(o)}),delete t.dataX,delete t.dataY,Object.assign(t,{data:s})}function KA(e,t){t.onBeforeValue||(t.onBeforeValue=S0);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 d=0;d<t.echarts.option.series.length;d++)r.push(t.echarts.option.series[d].data);else r=t.data;let o=R0(e,t),l=o.dash,u=o.normalizedOption,c=l*4/5/r.length;for(let d=0;d<r.length;d++){e.beginPath();let f=r[d];e.fillStyle=t.echarts?t.echarts.option.color[d]:t.chartsColor[d],e.strokeStyle="#ffffff",e.lineWidth=1*i;let g=0,m=0,y=0;for(let p=0;p<f.length;p++)g=a+(1+.1*l)+(l+1)*p+c*d,y=(f[p]-u.min)/(u.max-u.min)*n,m=s+n-y,e.rect(g,m,c-1,y-1),e.stroke(),e.fill();e.closePath()}}function XA(e,t){var q,W,j,K,U,tt,st,it,ht,lt,ut,E,A,I;t.onAdd||(t.onAdd=GA,t.onDestroy=ZA,t.onClick=JA,t.clockInterval&&(t.onDestroy(t),t.onAdd(t)));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,o={startAngle:225,endAngle:-45,min:0,max:100,splitNumber:10};if(t.echarts&&t.echarts.option){let N=t.echarts.option.series[0];t.startAngle=N.startAngle||o.startAngle,t.endAngle=N.endAngle||o.endAngle,t.min=N.min||o.min,t.max=N.max||o.max,t.axisLine=N.axisLine.lineStyle.color,t.unit=N.detail.formatter.replace("{value}",""),t.value=N.data[0].value,t.splitNumber=N.splitNumber||o.splitNumber}t={...o,...t};let l=s>n?n/2*9/10:s/2*9/10,u=i+s/2,c=a+n/2,d=t.echarts?t.echarts.option.series[0].data[0].value:t.value,f,g=t.startAngle-t.endAngle,m=t.background||"#E6EBF8";e.strokeStyle=m;let y=l/10;e.lineWidth=y,e.beginPath(),e.lineCap="round",e.arc(u,c,l,-t.startAngle/180*Math.PI,-t.endAngle/180*Math.PI),e.stroke(),e.closePath();let p=0;if(t.axisLine&&!t.isClock)for(let N=t.axisLine.length-1;N>=0;N--)t.axisLine[N][0]*(t.max-t.min)<d?p=t.axisLine[N][0]:(p=(d-t.min)/(t.max-t.min),f=t.axisLine[N][1]),e.beginPath(),e.strokeStyle=t.axisLine[N][1],e.arc(u,c,l,-t.startAngle/180*Math.PI,(-t.startAngle+p*g)/180*Math.PI),e.stroke(),e.closePath();e.lineCap="butt";let x=2*r,_=l-y;_<0&&(_=0);let b=g/180*Math.PI*_,C=(b-x*t.splitNumber)/t.splitNumber,P=g/180*Math.PI*x/2/b;e.beginPath(),e.strokeStyle=t.color||"#999999",e.lineWidth=l/20,e.setLineDash([x,C]),e.arc(u,c,_,-t.startAngle/180*Math.PI-P,-t.endAngle/180*Math.PI+P),e.stroke(),e.closePath();let S=1*r,B=l-y;B<0&&(B=0);let D=g/180*Math.PI*B,V=(D-S*5*t.splitNumber)/5/t.splitNumber,G=g/180*Math.PI*S/2/D;e.beginPath(),e.strokeStyle=t.color||"#999999",e.lineWidth=l/40,e.setLineDash([S,V]),e.arc(u,c,B,-t.startAngle/180*Math.PI-G,-t.endAngle/180*Math.PI+G),e.stroke(),e.closePath(),e.beginPath();let F=t.max-t.min,R=F/t.splitNumber,T={fontStyle:((q=t.tickLabel)==null?void 0:q.fontStyle)||t.calculative.fontStyle,textDecoration:((W=t.tickLabel)==null?void 0:W.textDecoration)||t.textDecoration,fontWeight:((j=t.tickLabel)==null?void 0:j.fontWeight)||t.calculative.fontWeight,fontFamily:((K=t.tickLabel)==null?void 0:K.fontFamily)||t.calculative.fontFamily,fontSize:(((U=t.tickLabel)==null?void 0:U.fontSize)||t.calculative.fontSize)*r,lineHeight:((tt=t.tickLabel)==null?void 0:tt.lineHeight)||t.calculative.lineHeight};e.font=Be(T);let L=l-y-l/20;for(let N=0;N<=t.splitNumber;N++){if(Math.abs(t.startAngle)+Math.abs(t.endAngle)===360&&N==0)continue;let X=t.startAngle-R*N/F*g,J=Math.cos(X/180*Math.PI),rt=Math.sin(X/180*Math.PI);e.fillStyle=((st=t.tickLabel)==null?void 0:st.color)||"#999999",J>.02?e.textAlign="end":J<-.02?e.textAlign="start":e.textAlign="center",rt>.02?e.textBaseline="top":rt<-.02?e.textBaseline="bottom":e.textBaseline="middle",e.fillText($A(R*N+t.min,1),u+L*J,c-L*rt),e.fill()}e.closePath();let $=1,Z=["value"];if(t.isClock&&($=3,Z=["hourvalue","minutevalue","secondvalue"]),t.isClock)for(let N=0;N<$;N++){let X=(t.startAngle-(t[Z[N]]-t.min)/(t.max-t.min)*g)/180*Math.PI;N>0&&(X=(t.startAngle-(t[Z[N]]-t.min)/(t.max*5-t.min)*g)/180*Math.PI);let J=4/5*l;Z[N]==="hourvalue"&&(J=3/5*l),Z[N]==="minutevalue"&&(J=3.5/5*l);let rt=l*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=l/(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+J*Math.cos(X),c-J*Math.sin(X)),e.stroke()}else{let N=(t.startAngle-(d-t.min)/(t.max-t.min)*g)/180*Math.PI,X=4/5*l,J=l*1/40;e.beginPath(),e.setLineDash([]),e.lineWidth=2,e.fillStyle=f,e.moveTo(u-J*3*Math.cos(N),c+J*3*Math.sin(N)),e.lineTo(u+J*Math.cos(N-Math.PI/2),c-J*Math.sin(N-Math.PI/2)),e.lineTo(u+X*Math.cos(N),c-X*Math.sin(N)),e.lineTo(u+J*Math.cos(N+Math.PI/2),c-J*Math.sin(N+Math.PI/2)),e.lineTo(u-J*3*Math.cos(N),c+J*3*Math.sin(N)),e.fill()}e.beginPath(),e.textAlign="center",e.textBaseline="middle";let at={fontStyle:((it=t.titleLabel)==null?void 0:it.fontStyle)||t.calculative.fontStyle,textDecoration:((ht=t.titleLabel)==null?void 0:ht.textDecoration)||t.textDecoration,fontWeight:((lt=t.titleLabel)==null?void 0:lt.fontWeight)||t.calculative.fontWeight,fontFamily:((ut=t.titleLabel)==null?void 0:ut.fontFamily)||t.calculative.fontFamily,fontSize:(((E=t.titleLabel)==null?void 0:E.fontSize)||t.calculative.fontSize)*r,lineHeight:((A=t.titleLabel)==null?void 0:A.lineHeight)||t.calculative.lineHeight};e.font=Be(at),e.fillStyle=((I=t.titleLabel)==null?void 0:I.color)||f,t.isClock?e.fillText(("0"+parseInt(t.hourvalue)).slice(-2)+":"+("0"+parseInt(t.minutevalue)).slice(-2)+":"+("0"+parseInt(t.secondvalue)).slice(-2),u,c+l/2):e.fillText(d+" "+(t.unit||""),u,c+l/2),e.fill(),t.isClock&&(e.beginPath(),e.fillStyle=t.color||"#999999",e.strokeStyle="#ffffff",e.arc(u,c,l/20,0,Math.PI*2),e.stroke(),e.fill(),e.closePath())}function GA(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 ZA(e){e.clockInterval&&(clearInterval(e.clockInterval),e.clockInterval=void 0)}function JA(e){e.isClock&&(e.onDestroy(e),e.onAdd(e))}function QA(e,t){if(t.onBeforeValue||(t.onBeforeValue=tC),t.calculative.update===void 0&&(t.calculative.update=!0),t.calculative.update){const i=eC(t);i&&(t.calculative.img||(t.calculative.img=new Image),t.calculative.img.src=i),t.calculative.update=!1}if(t.calculative.img){const{x:i,y:a,width:s,height:n}=t.calculative.worldRect;e.drawImage(t.calculative.img,i,a,s,n)}}function tC(e,t){return(t.data||t.min||t.max||t.chartsColor)&&(e.calculative.update=!0),t}function eC(e){var p,x;const{width:t,height:i}=e.calculative.worldRect,a=e.data,s=(a==null?void 0:a.length)||0,n=s>0?a[0].length:0,r=document.createElement("canvas");r.style.width=`${t}px`,r.style.height=`${i}px`,r.width=t,r.height=i;const o=r.width,l=r.height,u=r.getContext("2d");(x=(p=e.calculative)==null?void 0:p.canvas)==null||x.getPenRect(e);const c=(n-1)/o,d=(s-1)/l;if(s===0||n===0){console.warn("\u65E0\u6548\u6570\u636E\u7EF4\u5EA6");return}const f=u.createImageData(o,l),g=f.data,m=iC(a,s,n),y=sC(e.min,e.max,e.chartsColor);for(let _=0;_<l;_++){const b=_*d;for(let C=0;C<o;C++){const P=C*c,S=aC(e,m,P,b),{r:B,g:D,b:V}=y(S),G=(_*o+C)*4;g[G]=B,g[G+1]=D,g[G+2]=V,g[G+3]=255}}return u.putImageData(f,0,0),r.toDataURL()}function iC(e,t,i){const s=t+4,n=i+2*2,r=Array(s).fill(null).map(()=>Array(n).fill(0));for(let o=0;o<t;o++)for(let l=0;l<i;l++)r[o+2][l+2]=e[o][l];for(let o=0;o<2;o++)for(let l=0;l<n;l++)r[o][l]=r[2+(2-o-1)][l];for(let o=0;o<2;o++){let l=s-2+o,u=s-2-1-o;for(let c=0;c<n;c++)r[l][c]=r[u][c]}for(let o=0;o<2;o++)for(let l=0;l<s;l++)r[l][o]=r[l][2+(2-o-1)];for(let o=0;o<2;o++){let l=n-2+o,u=n-2-1-o;for(let c=0;c<s;c++)r[c][l]=r[c][u]}return r}function aC(e,t,i,a){const n=i+2,r=a+2,o=Math.floor(n),l=Math.floor(r),u=n-o,c=r-l;let d=0;for(let f=-1;f<=2;f++){const g=Nd(f-u);for(let m=-1;m<=2;m++){const y=Nd(m-c),p=t[l+m][o+f];d+=p*g*y}}return Math.min(e.max,Math.max(e.min,d))}function Nd(e,t=-.5){return e=Math.abs(e),e<=1?(t+2)*e*e*e-(t+3)*e*e+1:e<2?t*e*e*e-5*t*e*e+8*t*e-4*t:0}function sC(e,t,i){const a=i.length,s=[];for(let n=0;n<a;n++){const r=n/(a-1),o=nC(i[n]);s.push({pos:r,rgb:o})}return function(n){let r=(n-e)/(t-e);r=Math.min(1,Math.max(0,r));let o=0;for(;o<s.length-1&&!(r<=s[o+1].pos);o++);const l=s[o],u=s[o+1];if(r<=l.pos)return l.rgb;if(r>=u.pos)return u.rgb;const c=(r-l.pos)/(u.pos-l.pos),d=Math.round(l.rgb.r+(u.rgb.r-l.rgb.r)*c),f=Math.round(l.rgb.g+(u.rgb.g-l.rgb.g)*c),g=Math.round(l.rgb.b+(u.rgb.b-l.rgb.b)*c);return{r:d,g:f,b:g}}}function nC(e){const t=document.createElement("div");t.style.color=e,t.style.display="none",document.body.appendChild(t);const i=window.getComputedStyle(t).color;document.body.removeChild(t);const a=i.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(!a)throw new Error(`\u65E0\u6CD5\u89E3\u6790\u989C\u8272: ${e}`);return{r:parseInt(a[1]),g:parseInt(a[2]),b:parseInt(a[3])}}function B9(){return{lineChart:jA,histogram:KA,pieChart:qA,gauge:XA,heatmap:QA}}function rC(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 oC(e,t){var f;const i=(f=t.headHeight)!=null?f:50,{x:a,y:s,width:n,height:r,ey:o}=t.calculative.worldRect;let l=t.calculative.borderRadius||0,u=l;t.calculative.borderRadius<1&&(l*=n,u*=r);let c=l<u?l:u;n<2*c&&(c=n/2),i<2*c&&(c=i/2),e.beginPath(),e.moveTo(a+c,s),e.arcTo(a+n,s,a+n,s+i,c),e.arcTo(a+n,s+i,a,s+i,c),e.arcTo(a,s+i,a,s,c),e.arcTo(a,s,a+n,s,c),e.closePath(),e.stroke(),e.save(),e.beginPath(),e.lineWidth=1,e.setLineDash([7,7]);const d=a+n/2;e.moveTo(d,s+i+1),e.lineTo(d,o),e.stroke(),e.restore()}function I9(){return{sequenceFocus:rC}}function D9(){return{lifeline:oC}}function lC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/6,l=n/4;if(i.moveTo(a+l*2,s+0),i.lineTo(a+l*2,s+o),i.moveTo(a,s+o+l*2),i.arc(a+l*2,s+o+l*2,l*2,Math.PI*1,Math.PI*2,!1),i.lineTo(a+l*4,s+o*5),i.lineTo(a,s+o*5),i.lineTo(a,s+o+l*2),i.moveTo(a+l,s+o*5),i.lineTo(a+l,s+o*6),i.moveTo(a+l*2,s+o*5),i.lineTo(a+l*2,s+o*6),i.moveTo(a+l*3,s+o*5),i.lineTo(a+l*3,s+o*6),i.closePath(),i instanceof Path2D)return i}function zd(e){const t=[{x:.5,y:0},{x:.25,y:1},{x:.5,y:1},{x:.75,y:1}];e.anchors=t.map(({x:i,y:a},s)=>({id:`${s}`,penId:e.id,x:i,y:a}))}function cC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r-n,l=.5*n;if(i.moveTo(a+n/2,s),i.lineTo(a+n/2,s+o),i.moveTo(a+n,s+l+o),i.arc(a+n/2,s+l+o,l,0,Math.PI*2,!1),i.closePath(),i instanceof Path2D)return i}function Wd(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 uC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/2,l=n/5;if(i.moveTo(a,s+o),i.lineTo(a+l,s+o),i.moveTo(a+l*5,s+o),i.ellipse(a+l*3,s+o,2*l,o,0,0,Math.PI*2),i.closePath(),i instanceof Path2D)return i}function hC(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 fC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/4,l=.5*n;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.moveTo(a,s+o),i.rect(a,s+o,l*2,o*2),i.moveTo(a+l,s+3*o),i.lineTo(a+l,s+4*o),i.closePath(),i instanceof Path2D)return i}function dC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/8,l=.25*n;if(i.moveTo(a+l*2,s),i.lineTo(a+l*2,s+o*2),i.lineTo(a+l*3,s+o*3),i.lineTo(a+l*3,s+o*5),i.lineTo(a+l*2,s+o*6),i.lineTo(a+l*1,s+o*5),i.lineTo(a+l*1,s+o*3),i.lineTo(a+l*2,s+o*2),i.moveTo(a+l*3,s+o*4),i.lineTo(a+l*4,s+o*4),i.moveTo(a+l*2,s+o*6),i.lineTo(a+l*2,s+o*8),i.closePath(),i instanceof Path2D)return i}function gC(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 vC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=n/2,l=r/10;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.moveTo(a+o,s+l),i.quadraticCurveTo(a+o*2,s+l,a+o*2,s+l*9),i.moveTo(a+o,s+l),i.quadraticCurveTo(a,s+l,a,s+l*9),i.quadraticCurveTo(a+o,s+l*6,a+o*2,s+l*9),i.moveTo(a+o,s+r*3/4),i.lineTo(a+o,s+r),i.moveTo(a+o*2/5,s+r*201/250),i.lineTo(a+o*2/5,s+r),i.moveTo(a+o*8/5,s+r*201/250),i.lineTo(a+o*8/5,s+r),i.closePath(),i instanceof Path2D)return i}function Hd(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 mC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/6,l=n/4;if(i.moveTo(a+l*2,s+0),i.lineTo(a+l*2,s+o),i.moveTo(a,s+o+l*2),i.arc(a+l*2,s+o+l*2,l*2,Math.PI*1,Math.PI*2,!1),i.lineTo(a+l*4,s+o*5),i.lineTo(a,s+o*5),i.lineTo(a,s+o+l*2),i.moveTo(a,s+o*5-o/3),i.lineTo(a+l*4,s+o*5-o/3),i.moveTo(a+l,s+o*5),i.lineTo(a+l,s+o*6),i.moveTo(a+l*2,s+o*5),i.lineTo(a+l*2,s+o*6),i.moveTo(a+l*3,s+o*5),i.lineTo(a+l*3,s+o*6),i.closePath(),i instanceof Path2D)return i}function yC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/4,l=.5*n;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.lineTo(a+l*2,s+o*2),i.lineTo(a+l*2,s+o*4),i.lineTo(a,s+o*4),i.lineTo(a,s+o*2),i.lineTo(a+l,s+o),i.closePath(),i instanceof Path2D)return i}function pC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/4,l=n/2;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.lineTo(a+l*2,s+o*4),i.lineTo(a,s+o*4),i.lineTo(a+l,s+o),i.closePath(),i instanceof Path2D)return i}function wC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect,o=r/3,l=.5*n;if(i.moveTo(a+l,s),i.lineTo(a+l,s+o),i.lineTo(a+n,s+2*o),i.lineTo(a+l,s+r),i.lineTo(a,s+2*o),i.lineTo(a+l,s+o),i.closePath(),i instanceof Path2D)return i}function bC(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 xC(e,t){const i=t||new Path2D,{x:a,y:s,width:n,height:r}=e.calculative.worldRect;let o=n/2,l=r/10;if(i.moveTo(a+o,s),i.lineTo(a+o,s+l),i.moveTo(a+o,s+l),i.quadraticCurveTo(a+o*2,s+l,a+o*2,s+l*9),i.moveTo(a+o,s+l),i.quadraticCurveTo(a,s+l,a,s+l*9),i.quadraticCurveTo(a+o,s+l*6,a+o*2,s+l*9),i.moveTo(a,s+l*10),i.quadraticCurveTo(a+o,s+l*7,a+o*2,s+l*10),i.moveTo(a+o*2/5,s+r*201/250+l),i.lineTo(a+o*2/5,s+r),i.moveTo(a+o*8/5,s+r*201/250+l),i.lineTo(a+o*8/5,s+r),i.closePath(),i instanceof Path2D)return i}function _C(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 EC(e,t){const{x:i,y:a,width:s,height:n}=t.calculative.worldRect,r=s/2,o=n/10;e.beginPath(),e.moveTo(i+r,a),e.lineTo(i+r,a+o),e.moveTo(i+r,a+o),e.quadraticCurveTo(i+r*2,a+o,i+r*2,a+o*9),e.moveTo(i+r,a+o),e.quadraticCurveTo(i,a+o,i,a+o*9),e.quadraticCurveTo(i+r,a+o*6,i+r*2,a+o*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 l=r*2>o*10?o:r/5;e.fillStyle="#333333",e.font=l+"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 M9(){return{andGate:lC,basicEvent:cC,conditionalEvent:uC,event:fC,forbiddenGate:dC,orGate:vC,priorityAndGate:mC,switchEvent:yC,transferSymbol:pC,unexpandedEvent:wC,xorGate:xC}}function L9(){return{votingGate:EC}}function O9(){return{andGate:zd,orGate:Hd,priorityAndGate:zd,votingGate:Hd,xorGate:_C,forbiddenGate:gC,basicEvent:Wd,unexpandedEvent:bC,conditionalEvent:hC,transferSymbol:Wd}}const N9={background:"#ECE5E5",color:"#fff",textColor:"#fff",anchorColor:"#f90",gridSize:30,grid:!1,gridColor:"rgba(255,255,255,0.1)",drawingLineName:"line",eventPassword:""},z9=[{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"}],W9=["triangle","diamond","circle","lineDown","lineUp","triangleSolid","diamondSolid","circleSolid","line"],H9=["#000","#fff","#f00","#0f0","rgba(255,255,255,0.5)"],T0={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"}}]},B0={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"}}]},I0={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"}}]},AC={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"}}]},CC={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"}}]},kC={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"}}]},FC={name:"\u56FD\u5BB6\u7535\u7F51",show:!0,list:[{name:"\u907F\u96F7\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u907F\u96F7\u5668.svg"}},{name:"\u907F\u96F7\u9488",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u907F\u96F7\u9488.svg"}},{name:"\u6D4B\u91CF\u8868\u8BA1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6D4B\u91CF\u8868\u8BA1.svg"}},{name:"\u5145\u7535\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5145\u7535\u673A.svg"}},{name:"\u51FA\u7EBF",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u51FA\u7EBF.svg"}},{name:"\u7A7F\u5899\u5957\u7BA1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7A7F\u5899\u5957\u7BA1.svg"}},{name:"\u5E26\u7535\u663E\u793A\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5E26\u7535\u663E\u793A\u5668.svg"}},{name:"\u7535\u52A8\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u52A8\u673A.svg"}},{name:"\u7535\u6297\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u6297\u5668.svg"}},{name:"\u7535\u7F06\u7EBF\u8DEF",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u7F06\u7EBF\u8DEF.svg"}},{name:"\u7535\u7F06\u7EC8\u7AEF",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u7F06\u7EC8\u7AEF.svg"}},{name:"\u7535\u6D41\u4E92\u611F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u6D41\u4E92\u611F\u5668.svg"}},{name:"\u7535\u80FD\u8868",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u80FD\u8868.svg"}},{name:"\u7535\u5BB9\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u5BB9\u5668.svg"}},{name:"\u7535\u538B\u4E92\u611F\u5668-\u5E26\u7194\u65AD\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u538B\u4E92\u611F\u5668-\u5E26\u7194\u65AD\u5668.svg"}},{name:"\u7535\u538B\u4E92\u611F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u538B\u4E92\u611F\u5668.svg"}},{name:"\u7535\u963B\u63A5\u5730",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7535\u963B\u63A5\u5730.svg"}},{name:"\u8DCC\u843D\u5F0F\u7194\u65AD\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u8DCC\u843D\u5F0F\u7194\u65AD\u5668.svg"}},{name:"\u65AD\u8DEF\u5668-\u5206",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u65AD\u8DEF\u5668-\u5206.svg"}},{name:"\u65AD\u8DEF\u5668-\u5408",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u65AD\u8DEF\u5668-\u5408.svg"}},{name:"\u65AD\u8DEF\u5668\u624B\u8F66",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u65AD\u8DEF\u5668\u624B\u8F66.svg"}},{name:"\u53D1\u7535\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u53D1\u7535\u673A.svg"}},{name:"\u98CE\u529B\u53D1\u7535\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u98CE\u529B\u53D1\u7535\u673A.svg"}},{name:"\u8D1F\u8377\u5F00\u5173",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u8D1F\u8377\u5F00\u5173.svg"}},{name:"\u9694\u79BB\u5F00\u5173-\u5E26\u63A5\u5730",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u9694\u79BB\u5F00\u5173-\u5E26\u63A5\u5730.svg"}},{name:"\u9694\u79BB\u5F00\u5173-\u5206",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u9694\u79BB\u5F00\u5173-\u5206.svg"}},{name:"\u9694\u79BB\u5F00\u5173-\u5408",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u9694\u79BB\u5F00\u5173-\u5408.svg"}},{name:"\u5149\u4F0F\u9006\u53D8\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5149\u4F0F\u9006\u53D8\u5668.svg"}},{name:"\u5149\u4F0F\u7EC4\u4EF6",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5149\u4F0F\u7EC4\u4EF6.svg"}},{name:"\u73AF\u7F51\u67DC",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u73AF\u7F51\u67DC.svg"}},{name:"\u6362\u6D41\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6362\u6D41\u53D8\u538B\u5668.svg"}},{name:"\u6362\u6D41\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6362\u6D41\u9600.svg"}},{name:"\u4EA4\u6D41\u6EE4\u6CE2\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u4EA4\u6D41\u6EE4\u6CE2\u5668.svg"}},{name:"\u63A5\u5730",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u63A5\u5730.svg"}},{name:"\u63A5\u5730\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u63A5\u5730\u53D8\u538B\u5668.svg"}},{name:"\u63A5\u5730\u5F00\u5173",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u63A5\u5730\u5F00\u5173.svg"}},{name:"\u9759\u6B62\u65E0\u529F\u8865\u507FSVG",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u9759\u6B62\u65E0\u529F\u8865\u507FSVG.svg"}},{name:"\u8FDE\u63A5\u8282\u70B9",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u8FDE\u63A5\u8282\u70B9.svg"}},{name:"\u96F6\u5E8F\u7535\u6D41\u4E92\u611F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u96F6\u5E8F\u7535\u6D41\u4E92\u611F\u5668.svg"}},{name:"\u6BCD\u7EBF",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6BCD\u7EBF.svg"}},{name:"\u8026\u5408\u7535\u5BB9\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u8026\u5408\u7535\u5BB9\u5668.svg"}},{name:"\u5E73\u6CE2\u7535\u6297\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u5E73\u6CE2\u7535\u6297\u5668.svg"}},{name:"\u7194\u65AD\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7194\u65AD\u5668.svg"}},{name:"\u4E09\u7ED5\u7EC4\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u4E09\u7ED5\u7EC4\u53D8\u538B\u5668.svg"}},{name:"\u624B\u8F66\u89E6\u5934",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u624B\u8F66\u89E6\u5934.svg"}},{name:"\u53CC\u7ED5\u7EC4\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u53CC\u7ED5\u7EC4\u53D8\u538B\u5668.svg"}},{name:"\u7BB1\u5F0F\u53D8\u7535\u7AD9",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7BB1\u5F0F\u53D8\u7535\u7AD9.svg"}},{name:"\u6D88\u5F27\u7EBF\u5708",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u6D88\u5F27\u7EBF\u5708.svg"}},{name:"\u84C4\u7535\u6C60",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u84C4\u7535\u6C60.svg"}},{name:"\u7AD9\u7528\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u7AD9\u7528\u53D8\u538B\u5668.svg"}},{name:"\u76F4\u6D41\u65AD\u8DEF\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u76F4\u6D41\u65AD\u8DEF\u5668.svg"}},{name:"\u81EA\u8026\u53D8\u538B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u81EA\u8026\u53D8\u538B\u5668.svg"}},{name:"\u963B\u6CE2\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/\u963B\u6CE2\u5668.svg"}},{name:"GIS\u7EC4\u5408\u7535\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/GIS\u7EC4\u5408\u7535\u5668.svg"}},{name:"SVC\u9759\u6B62\u65E0\u529F\u8865\u507F",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/SVC\u9759\u6B62\u65E0\u529F\u8865\u507F.svg"}},{name:"UPS\u7535\u6E90",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u56FD\u5BB6\u7535\u7F51/UPS\u7535\u6E90.svg"}}]},PC={name:"\u5B89\u9632\u5F31\u7535",show:!0,list:[{name:"\u534A\u7403\u6444\u50CF\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u534A\u7403\u6444\u50CF\u673A.svg"}},{name:"\u73BB\u7483\u7834\u788E\u63A2\u6D4B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u73BB\u7483\u7834\u788E\u63A2\u6D4B\u5668.svg"}},{name:"\u64CD\u4F5C\u952E\u76D8",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u64CD\u4F5C\u952E\u76D8.svg"}},{name:"\u51FA\u95E8\u6309\u94AE",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u51FA\u95E8\u6309\u94AE.svg"}},{name:"\u78C1\u529B\u9501",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u78C1\u529B\u9501.svg"}},{name:"\u7535\u89C6\u63D2\u5EA7",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u7535\u89C6\u63D2\u5EA7.svg"}},{name:"\u8BFB\u5361\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u8BFB\u5361\u5668.svg"}},{name:"\u9632\u76D7\u62A5\u8B66\u4E3B\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u9632\u76D7\u62A5\u8B66\u4E3B\u673A.svg"}},{name:"\u670D\u52A1\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u670D\u52A1\u5668.svg"}},{name:"\u7EA2\u5916\u5BF9\u5C04",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u7EA2\u5916\u5BF9\u5C04.svg"}},{name:"\u7EA2\u5916\u63A2\u6D4B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u7EA2\u5916\u63A2\u6D4B\u5668.svg"}},{name:"\u76D1\u89C6\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u76D1\u89C6\u5668.svg"}},{name:"\u7D27\u6025\u6C42\u52A9\u6309\u94AE",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u7D27\u6025\u6C42\u52A9\u6309\u94AE.svg"}},{name:"\u53EF\u89C6\u5BF9\u8BB2\u5206\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u53EF\u89C6\u5BF9\u8BB2\u5206\u673A.svg"}},{name:"\u95E8\u78C1\u5F00\u5173",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u95E8\u78C1\u5F00\u5173.svg"}},{name:"\u95E8\u7981\u63A7\u5236\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u95E8\u7981\u63A7\u5236\u5668.svg"}},{name:"\u67AA\u5F0F\u6444\u50CF\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u67AA\u5F0F\u6444\u50CF\u673A.svg"}},{name:"\u7403\u578B\u6444\u50CF\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u7403\u578B\u6444\u50CF\u673A.svg"}},{name:"\u7F51\u7EDC\u4EA4\u6362\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u7F51\u7EDC\u4EA4\u6362\u673A.svg"}},{name:"\u65E0\u7EBFAP",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u65E0\u7EBFAP.svg"}},{name:"\u4FE1\u606F\u63D2\u5EA7",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u4FE1\u606F\u63D2\u5EA7.svg"}},{name:"\u626C\u58F0\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u626C\u58F0\u5668.svg"}},{name:"\u4E91\u53F0\u6444\u50CF\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u5B89\u9632\u5F31\u7535/\u4E91\u53F0\u6444\u50CF\u673A.svg"}}]},RC={name:"\u6696\u901A\u7A7A\u8C03",show:!0,list:[{name:"\u767E\u53F6\u98CE\u53E3",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u767E\u53F6\u98CE\u53E3.svg"}},{name:"\u53D8\u9891\u6C34\u6CF5",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u53D8\u9891\u6C34\u6CF5.svg"}},{name:"\u7535\u78C1\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u7535\u78C1\u9600.svg"}},{name:"\u7535\u52A8\u8C03\u8282\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u7535\u52A8\u8C03\u8282\u9600.svg"}},{name:"\u8776\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u8776\u9600.svg"}},{name:"\u9632\u706B\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u9632\u706B\u9600.svg"}},{name:"\u98CE\u7BA1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u98CE\u7BA1.svg"}},{name:"\u98CE\u673A\u76D8\u7BA1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u98CE\u673A\u76D8\u7BA1.svg"}},{name:"\u6362\u70ED\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u6362\u70ED\u5668.svg"}},{name:"\u52A0\u6E7F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u52A0\u6E7F\u5668.svg"}},{name:"\u7A7A\u8C03\u673A\u7EC4",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u7A7A\u8C03\u673A\u7EC4.svg"}},{name:"\u51B7\u5374\u5854",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u51B7\u5374\u5854.svg"}},{name:"\u51B7\u6C34\u673A\u7EC4",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u51B7\u6C34\u673A\u7EC4.svg"}},{name:"\u79BB\u5FC3\u98CE\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u79BB\u5FC3\u98CE\u673A.svg"}},{name:"\u6D41\u91CF\u8BA1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u6D41\u91CF\u8BA1.svg"}},{name:"\u81A8\u80C0\u6C34\u7BB1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u81A8\u80C0\u6C34\u7BB1.svg"}},{name:"\u6563\u6D41\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u6563\u6D41\u5668.svg"}},{name:"\u6E7F\u5EA6\u4F20\u611F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u6E7F\u5EA6\u4F20\u611F\u5668.svg"}},{name:"\u6C34\u6CF5",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u6C34\u6CF5.svg"}},{name:"\u6C34\u8FC7\u6EE4\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u6C34\u8FC7\u6EE4\u5668.svg"}},{name:"\u6E29\u5EA6\u4F20\u611F\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u6E29\u5EA6\u4F20\u611F\u5668.svg"}},{name:"\u65B0\u98CE\u673A\u7EC4",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u65B0\u98CE\u673A\u7EC4.svg"}},{name:"\u538B\u5DEE\u5F00\u5173",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u538B\u5DEE\u5F00\u5173.svg"}},{name:"\u538B\u529B\u8868",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u538B\u529B\u8868.svg"}},{name:"\u95F8\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u95F8\u9600.svg"}},{name:"\u6B62\u56DE\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u6B62\u56DE\u9600.svg"}},{name:"\u8F74\u6D41\u98CE\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6696\u901A\u7A7A\u8C03/\u8F74\u6D41\u98CE\u673A.svg"}}]},SC={name:"\u6D88\u9632\u62A5\u8B66",show:!0,list:[{name:"\u70B9\u578B\u611F\u6E29\u63A2\u6D4B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u70B9\u578B\u611F\u6E29\u63A2\u6D4B\u5668.svg"}},{name:"\u70B9\u578B\u611F\u70DF\u63A2\u6D4B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u70B9\u578B\u611F\u70DF\u63A2\u6D4B\u5668.svg"}},{name:"\u9632\u706B\u5377\u5E18",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u9632\u706B\u5377\u5E18.svg"}},{name:"\u706B\u707E\u62A5\u8B66\u63A7\u5236\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u706B\u707E\u62A5\u8B66\u63A7\u5236\u5668.svg"}},{name:"\u706D\u706B\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u706D\u706B\u5668.svg"}},{name:"\u6392\u70DF\u9632\u706B\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u6392\u70DF\u9632\u706B\u9600.svg"}},{name:"\u55B7\u6DCB\u5934",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u55B7\u6DCB\u5934.svg"}},{name:"\u6C14\u4F53\u706D\u706B\u94A2\u74F6",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u6C14\u4F53\u706D\u706B\u94A2\u74F6.svg"}},{name:"\u58F0\u5149\u62A5\u8B66\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u58F0\u5149\u62A5\u8B66\u5668.svg"}},{name:"\u6E7F\u5F0F\u62A5\u8B66\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u6E7F\u5F0F\u62A5\u8B66\u9600.svg"}},{name:"\u5BA4\u5185\u6D88\u706B\u6813",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u5BA4\u5185\u6D88\u706B\u6813.svg"}},{name:"\u624B\u52A8\u62A5\u8B66\u6309\u94AE",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u624B\u52A8\u62A5\u8B66\u6309\u94AE.svg"}},{name:"\u758F\u6563\u6307\u793A\u706F",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u758F\u6563\u6307\u793A\u706F.svg"}},{name:"\u6C34\u6D41\u6307\u793A\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u6C34\u6D41\u6307\u793A\u5668.svg"}},{name:"\u6D88\u9632\u7535\u8BDD\u5206\u673A",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u6D88\u9632\u7535\u8BDD\u5206\u673A.svg"}},{name:"\u6D88\u9632\u63A5\u7EBF\u7AEF\u5B50\u7BB1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u6D88\u9632\u63A5\u7EBF\u7AEF\u5B50\u7BB1.svg"}},{name:"\u6D88\u9632\u6C34\u6CF5",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u6D88\u9632\u6C34\u6CF5.svg"}},{name:"\u6D88\u9632\u5E94\u6025\u5E7F\u64AD",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u6D88\u9632\u5E94\u6025\u5E7F\u64AD.svg"}},{name:"\u4FE1\u53F7\u8776\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u4FE1\u53F7\u8776\u9600.svg"}},{name:"\u5E94\u6025\u7167\u660E\u706F",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u6D88\u9632\u62A5\u8B66/\u5E94\u6025\u7167\u660E\u706F.svg"}}]},TC={name:"\u7ED9\u6392\u6C34",show:!0,list:[{name:"\u5B89\u5168\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u5B89\u5168\u9600.svg"}},{name:"\u53D8\u9891\u7ED9\u6C34\u673A\u7EC4",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u53D8\u9891\u7ED9\u6C34\u673A\u7EC4.svg"}},{name:"\u5B58\u6C34\u5F2F",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u5B58\u6C34\u5F2F.svg"}},{name:"\u5730\u6F0F",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u5730\u6F0F.svg"}},{name:"\u7535\u78C1\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u7535\u78C1\u9600.svg"}},{name:"\u8776\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u8776\u9600.svg"}},{name:"\u6D6E\u7403\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6D6E\u7403\u9600.svg"}},{name:"\u5316\u7CAA\u6C60",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u5316\u7CAA\u6C60.svg"}},{name:"\u51CF\u538B\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u51CF\u538B\u9600.svg"}},{name:"\u622A\u6B62\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u622A\u6B62\u9600.svg"}},{name:"\u79BB\u5FC3\u6C34\u6CF5",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u79BB\u5FC3\u6C34\u6CF5.svg"}},{name:"\u6F5C\u6C34\u6CF5",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6F5C\u6C34\u6CF5.svg"}},{name:"\u7403\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u7403\u9600.svg"}},{name:"\u6C34\u8868",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6C34\u8868.svg"}},{name:"\u6C34\u6C60",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6C34\u6C60.svg"}},{name:"\u6C34\u6D41\u5F00\u5173",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6C34\u6D41\u5F00\u5173.svg"}},{name:"\u6C34\u9F99\u5934",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6C34\u9F99\u5934.svg"}},{name:"\u6C34\u7BB1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6C34\u7BB1.svg"}},{name:"\u6DB2\u4F4D\u8BA1",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6DB2\u4F4D\u8BA1.svg"}},{name:"\u96E8\u6C34\u6597",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u96E8\u6C34\u6597.svg"}},{name:"\u95F8\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u95F8\u9600.svg"}},{name:"\u6B62\u56DE\u9600",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/\u6B62\u56DE\u9600.svg"}},{name:"Y\u578B\u8FC7\u6EE4\u5668",data:{text:"",width:60,height:60,name:"svgPath",image:"/static/figures/\u7ED9\u6392\u6C34/Y\u578B\u8FC7\u6EE4\u5668.svg"}}]},U9=["time-comp"],ru=window.allEnv.topo.showAllMenu||!1;T0.show=ru;B0.show=ru;I0.show=ru;const V9=[{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} <br/>{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"}}]},{...AC},{...CC},{...kC},{...FC},{...PC},{...RC},{...SC},{...TC},{...T0},{...B0},{...I0},{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
  100. + 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 ra={};(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 o=r.shift();if(!!o){if(typeof o!="object")throw new TypeError(o+"must be non-object");for(var l in o)i(o,l)&&(n[l]=o[l])}}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,o,l,u){if(r.subarray&&n.subarray){n.set(r.subarray(o,o+l),u);return}for(var c=0;c<l;c++)n[u+c]=r[o+c]},flattenChunks:function(n){var r,o,l,u,c,d;for(l=0,r=0,o=n.length;r<o;r++)l+=n[r].length;for(d=new Uint8Array(l),u=0,r=0,o=n.length;r<o;r++)c=n[r],d.set(c,u),u+=c.length;return d}},s={arraySet:function(n,r,o,l,u){for(var c=0;c<l;c++)n[u+c]=r[o+c]},flattenChunks:function(n){return[].concat.apply([],n)}};e.setTyped=function(n){n?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,a)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,s))},e.setTyped(t)})(ra);var On={},Wi={},Hs={},BC=ra,IC=4,Ud=0,Vd=1,DC=2;function Us(e){for(var t=e.length;--t>=0;)e[t]=0}var MC=0,D0=1,LC=2,OC=3,NC=258,ou=29,Nn=256,Rn=Nn+1+ou,Ms=30,lu=19,M0=2*Rn+1,Va=15,oc=16,zC=7,cu=256,L0=16,O0=17,N0=18,Lc=[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],Xr=[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],WC=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],z0=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],HC=512,Ji=new Array((Rn+2)*2);Us(Ji);var En=new Array(Ms*2);Us(En);var Sn=new Array(HC);Us(Sn);var Tn=new Array(NC-OC+1);Us(Tn);var uu=new Array(ou);Us(uu);var yo=new Array(Ms);Us(yo);function lc(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 W0,H0,U0;function cc(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function V0(e){return e<256?Sn[e]:Sn[256+(e>>>7)]}function Bn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function Ke(e,t,i){e.bi_valid>oc-i?(e.bi_buf|=t<<e.bi_valid&65535,Bn(e,e.bi_buf),e.bi_buf=t>>oc-e.bi_valid,e.bi_valid+=i-oc):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function Mi(e,t,i){Ke(e,i[t*2],i[t*2+1])}function $0(e,t){var i=0;do i|=e&1,e>>>=1,i<<=1;while(--t>0);return i>>>1}function UC(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 VC(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,o=t.stat_desc.extra_base,l=t.stat_desc.max_length,u,c,d,f,g,m,y=0;for(f=0;f<=Va;f++)e.bl_count[f]=0;for(i[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;u<M0;u++)c=e.heap[u],f=i[i[c*2+1]*2+1]+1,f>l&&(f=l,y++),i[c*2+1]=f,!(c>a)&&(e.bl_count[f]++,g=0,c>=o&&(g=r[c-o]),m=i[c*2],e.opt_len+=m*(f+g),n&&(e.static_len+=m*(s[c*2+1]+g)));if(y!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,y-=2}while(y>0);for(f=l;f!==0;f--)for(c=e.bl_count[f];c!==0;)d=e.heap[--u],!(d>a)&&(i[d*2+1]!==f&&(e.opt_len+=(f-i[d*2+1])*i[d*2],i[d*2+1]=f),c--)}}function j0(e,t,i){var a=new Array(Va+1),s=0,n,r;for(n=1;n<=Va;n++)a[n]=s=s+i[n-1]<<1;for(r=0;r<=t;r++){var o=e[r*2+1];o!==0&&(e[r*2]=$0(a[o]++,o))}}function $C(){var e,t,i,a,s,n=new Array(Va+1);for(i=0,a=0;a<ou-1;a++)for(uu[a]=i,e=0;e<1<<Lc[a];e++)Tn[i++]=a;for(Tn[i-1]=a,s=0,a=0;a<16;a++)for(yo[a]=s,e=0;e<1<<Xr[a];e++)Sn[s++]=a;for(s>>=7;a<Ms;a++)for(yo[a]=s<<7,e=0;e<1<<Xr[a]-7;e++)Sn[256+s++]=a;for(t=0;t<=Va;t++)n[t]=0;for(e=0;e<=143;)Ji[e*2+1]=8,e++,n[8]++;for(;e<=255;)Ji[e*2+1]=9,e++,n[9]++;for(;e<=279;)Ji[e*2+1]=7,e++,n[7]++;for(;e<=287;)Ji[e*2+1]=8,e++,n[8]++;for(j0(Ji,Rn+1,n),e=0;e<Ms;e++)En[e*2+1]=5,En[e*2]=$0(e,5);W0=new lc(Ji,Lc,Nn+1,Rn,Va),H0=new lc(En,Xr,0,Ms,Va),U0=new lc(new Array(0),WC,0,lu,zC)}function q0(e){var t;for(t=0;t<Rn;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Ms;t++)e.dyn_dtree[t*2]=0;for(t=0;t<lu;t++)e.bl_tree[t*2]=0;e.dyn_ltree[cu*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Y0(e){e.bi_valid>8?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 jC(e,t,i,a){Y0(e),a&&(Bn(e,i),Bn(e,~i)),BC.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function $d(e,t,i,a){var s=t*2,n=i*2;return e[s]<e[n]||e[s]===e[n]&&a[t]<=a[i]}function uc(e,t,i){for(var a=e.heap[i],s=i<<1;s<=e.heap_len&&(s<e.heap_len&&$d(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!$d(t,a,e.heap[s],e.depth));)e.heap[i]=e.heap[s],i=s,s<<=1;e.heap[i]=a}function jd(e,t,i){var a,s,n=0,r,o;if(e.last_lit!==0)do a=e.pending_buf[e.d_buf+n*2]<<8|e.pending_buf[e.d_buf+n*2+1],s=e.pending_buf[e.l_buf+n],n++,a===0?Mi(e,s,t):(r=Tn[s],Mi(e,r+Nn+1,t),o=Lc[r],o!==0&&(s-=uu[r],Ke(e,s,o)),a--,r=V0(a),Mi(e,r,i),o=Xr[r],o!==0&&(a-=yo[r],Ke(e,a,o)));while(n<e.last_lit);Mi(e,cu,t)}function Oc(e,t){var i=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,n=t.stat_desc.elems,r,o,l=-1,u;for(e.heap_len=0,e.heap_max=M0,r=0;r<n;r++)i[r*2]!==0?(e.heap[++e.heap_len]=l=r,e.depth[r]=0):i[r*2+1]=0;for(;e.heap_len<2;)u=e.heap[++e.heap_len]=l<2?++l:0,i[u*2]=1,e.depth[u]=0,e.opt_len--,s&&(e.static_len-=a[u*2+1]);for(t.max_code=l,r=e.heap_len>>1;r>=1;r--)uc(e,i,r);u=n;do r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],uc(e,i,1),o=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=o,i[u*2]=i[r*2]+i[o*2],e.depth[u]=(e.depth[r]>=e.depth[o]?e.depth[r]:e.depth[o])+1,i[r*2+1]=i[o*2+1]=u,e.heap[1]=u++,uc(e,i,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],VC(e,t),j0(i,l,e.bl_count)}function qd(e,t,i){var a,s=-1,n,r=t[0*2+1],o=0,l=7,u=4;for(r===0&&(l=138,u=3),t[(i+1)*2+1]=65535,a=0;a<=i;a++)n=r,r=t[(a+1)*2+1],!(++o<l&&n===r)&&(o<u?e.bl_tree[n*2]+=o:n!==0?(n!==s&&e.bl_tree[n*2]++,e.bl_tree[L0*2]++):o<=10?e.bl_tree[O0*2]++:e.bl_tree[N0*2]++,o=0,s=n,r===0?(l=138,u=3):n===r?(l=6,u=3):(l=7,u=4))}function Yd(e,t,i){var a,s=-1,n,r=t[0*2+1],o=0,l=7,u=4;for(r===0&&(l=138,u=3),a=0;a<=i;a++)if(n=r,r=t[(a+1)*2+1],!(++o<l&&n===r)){if(o<u)do Mi(e,n,e.bl_tree);while(--o!==0);else n!==0?(n!==s&&(Mi(e,n,e.bl_tree),o--),Mi(e,L0,e.bl_tree),Ke(e,o-3,2)):o<=10?(Mi(e,O0,e.bl_tree),Ke(e,o-3,3)):(Mi(e,N0,e.bl_tree),Ke(e,o-11,7));o=0,s=n,r===0?(l=138,u=3):n===r?(l=6,u=3):(l=7,u=4)}}function qC(e){var t;for(qd(e,e.dyn_ltree,e.l_desc.max_code),qd(e,e.dyn_dtree,e.d_desc.max_code),Oc(e,e.bl_desc),t=lu-1;t>=3&&e.bl_tree[z0[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function YC(e,t,i,a){var s;for(Ke(e,t-257,5),Ke(e,i-1,5),Ke(e,a-4,4),s=0;s<a;s++)Ke(e,e.bl_tree[z0[s]*2+1],3);Yd(e,e.dyn_ltree,t-1),Yd(e,e.dyn_dtree,i-1)}function KC(e){var t=4093624447,i;for(i=0;i<=31;i++,t>>>=1)if(t&1&&e.dyn_ltree[i*2]!==0)return Ud;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Vd;for(i=32;i<Nn;i++)if(e.dyn_ltree[i*2]!==0)return Vd;return Ud}var Kd=!1;function XC(e){Kd||($C(),Kd=!0),e.l_desc=new cc(e.dyn_ltree,W0),e.d_desc=new cc(e.dyn_dtree,H0),e.bl_desc=new cc(e.bl_tree,U0),e.bi_buf=0,e.bi_valid=0,q0(e)}function K0(e,t,i,a){Ke(e,(MC<<1)+(a?1:0),3),jC(e,t,i,!0)}function GC(e){Ke(e,D0<<1,3),Mi(e,cu,Ji),UC(e)}function ZC(e,t,i,a){var s,n,r=0;e.level>0?(e.strm.data_type===DC&&(e.strm.data_type=KC(e)),Oc(e,e.l_desc),Oc(e,e.d_desc),r=qC(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?K0(e,t,i,a):e.strategy===IC||n===s?(Ke(e,(D0<<1)+(a?1:0),3),jd(e,Ji,En)):(Ke(e,(LC<<1)+(a?1:0),3),YC(e,e.l_desc.max_code+1,e.d_desc.max_code+1,r+1),jd(e,e.dyn_ltree,e.dyn_dtree)),q0(e),a&&Y0(e)}function JC(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[(Tn[i]+Nn+1)*2]++,e.dyn_dtree[V0(t)*2]++),e.last_lit===e.lit_bufsize-1}Hs._tr_init=XC;Hs._tr_stored_block=K0;Hs._tr_flush_block=ZC;Hs._tr_tally=JC;Hs._tr_align=GC;function QC(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 X0=QC;function tk(){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 ek=tk();function ik(e,t,i,a){var s=ek,n=a+i;e^=-1;for(var r=a;r<n;r++)e=e>>>8^s[(e^t[r])&255];return e^-1}var G0=ik,hu={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"},ze=ra,vi=Hs,Z0=X0,ba=G0,ak=hu,is=0,sk=1,nk=3,ka=4,Xd=5,Li=0,Gd=1,mi=-2,rk=-3,hc=-5,ok=-1,lk=1,Hr=2,ck=3,uk=4,hk=0,fk=2,Co=8,dk=9,gk=15,vk=8,mk=29,yk=256,Nc=yk+1+mk,pk=30,wk=19,bk=2*Nc+1,xk=15,Ht=3,Aa=258,Ai=Aa+Ht+1,_k=32,ko=42,zc=69,Gr=73,Zr=91,Jr=103,$a=113,wn=666,pe=1,zn=2,Za=3,Vs=4,Ek=3;function Ca(e,t){return e.msg=ak[t],t}function Zd(e){return(e<<1)-(e>4?9:0)}function Ea(e){for(var t=e.length;--t>=0;)e[t]=0}function xa(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),i!==0&&(ze.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 Fe(e,t){vi._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,xa(e.strm)}function $t(e,t){e.pending_buf[e.pending++]=t}function dn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Ak(e,t,i,a){var s=e.avail_in;return s>a&&(s=a),s===0?0:(e.avail_in-=s,ze.arraySet(t,e.input,e.next_in,s,i),e.state.wrap===1?e.adler=Z0(e.adler,t,s,i):e.state.wrap===2&&(e.adler=ba(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)}function J0(e,t){var i=e.max_chain_length,a=e.strstart,s,n,r=e.prev_length,o=e.nice_match,l=e.strstart>e.w_size-Ai?e.strstart-(e.w_size-Ai):0,u=e.window,c=e.w_mask,d=e.prev,f=e.strstart+Aa,g=u[a+r-1],m=u[a+r];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do if(s=t,!(u[s+r]!==m||u[s+r-1]!==g||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]&&a<f);if(n=Aa-(f-a),a=f-Aa,n>r){if(e.match_start=t,r=n,n>=o)break;g=u[a+r-1],m=u[a+r]}}while((t=d[t&c])>l&&--i!==0);return r<=e.lookahead?r:e.lookahead}function Ja(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-Ai)){ze.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=Ak(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=Ht)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=(e.ins_h<<e.hash_shift^e.window[r+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[r+Ht-1])&e.hash_mask,e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<Ht)););}while(e.lookahead<Ai&&e.strm.avail_in!==0)}function Ck(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Ja(e),e.lookahead===0&&t===is)return pe;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,Fe(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-Ai&&(Fe(e,!1),e.strm.avail_out===0))return pe}return e.insert=0,t===ka?(Fe(e,!0),e.strm.avail_out===0?Za:Vs):(e.strstart>e.block_start&&(Fe(e,!1),e.strm.avail_out===0),pe)}function fc(e,t){for(var i,a;;){if(e.lookahead<Ai){if(Ja(e),e.lookahead<Ai&&t===is)return pe;if(e.lookahead===0)break}if(i=0,e.lookahead>=Ht&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ht-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),i!==0&&e.strstart-i<=e.w_size-Ai&&(e.match_length=J0(e,i)),e.match_length>=Ht)if(a=vi._tr_tally(e,e.strstart-e.match_start,e.match_length-Ht),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Ht){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ht-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else a=vi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(a&&(Fe(e,!1),e.strm.avail_out===0))return pe}return e.insert=e.strstart<Ht-1?e.strstart:Ht-1,t===ka?(Fe(e,!0),e.strm.avail_out===0?Za:Vs):e.last_lit&&(Fe(e,!1),e.strm.avail_out===0)?pe:zn}function _s(e,t){for(var i,a,s;;){if(e.lookahead<Ai){if(Ja(e),e.lookahead<Ai&&t===is)return pe;if(e.lookahead===0)break}if(i=0,e.lookahead>=Ht&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ht-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Ht-1,i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-Ai&&(e.match_length=J0(e,i),e.match_length<=5&&(e.strategy===lk||e.match_length===Ht&&e.strstart-e.match_start>4096)&&(e.match_length=Ht-1)),e.prev_length>=Ht&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-Ht,a=vi._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-Ht),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=s&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+Ht-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Ht-1,e.strstart++,a&&(Fe(e,!1),e.strm.avail_out===0))return pe}else if(e.match_available){if(a=vi._tr_tally(e,0,e.window[e.strstart-1]),a&&Fe(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return pe}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(a=vi._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<Ht-1?e.strstart:Ht-1,t===ka?(Fe(e,!0),e.strm.avail_out===0?Za:Vs):e.last_lit&&(Fe(e,!1),e.strm.avail_out===0)?pe:zn}function kk(e,t){for(var i,a,s,n,r=e.window;;){if(e.lookahead<=Aa){if(Ja(e),e.lookahead<=Aa&&t===is)return pe;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Ht&&e.strstart>0&&(s=e.strstart-1,a=r[s],a===r[++s]&&a===r[++s]&&a===r[++s])){n=e.strstart+Aa;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]&&s<n);e.match_length=Aa-(n-s),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Ht?(i=vi._tr_tally(e,1,e.match_length-Ht),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=vi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(Fe(e,!1),e.strm.avail_out===0))return pe}return e.insert=0,t===ka?(Fe(e,!0),e.strm.avail_out===0?Za:Vs):e.last_lit&&(Fe(e,!1),e.strm.avail_out===0)?pe:zn}function Fk(e,t){for(var i;;){if(e.lookahead===0&&(Ja(e),e.lookahead===0)){if(t===is)return pe;break}if(e.match_length=0,i=vi._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(Fe(e,!1),e.strm.avail_out===0))return pe}return e.insert=0,t===ka?(Fe(e,!0),e.strm.avail_out===0?Za:Vs):e.last_lit&&(Fe(e,!1),e.strm.avail_out===0)?pe:zn}function Si(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 Ts;Ts=[new Si(0,0,0,0,Ck),new Si(4,4,8,4,fc),new Si(4,5,16,8,fc),new Si(4,6,32,32,fc),new Si(4,4,16,16,_s),new Si(8,16,32,32,_s),new Si(8,16,128,128,_s),new Si(8,32,128,256,_s),new Si(32,128,258,1024,_s),new Si(32,258,258,4096,_s)];function Pk(e){e.window_size=2*e.w_size,Ea(e.head),e.max_lazy_match=Ts[e.level].max_lazy,e.good_match=Ts[e.level].good_length,e.nice_match=Ts[e.level].nice_length,e.max_chain_length=Ts[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Ht-1,e.match_available=0,e.ins_h=0}function Rk(){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=Co,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 ze.Buf16(bk*2),this.dyn_dtree=new ze.Buf16((2*pk+1)*2),this.bl_tree=new ze.Buf16((2*wk+1)*2),Ea(this.dyn_ltree),Ea(this.dyn_dtree),Ea(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new ze.Buf16(xk+1),this.heap=new ze.Buf16(2*Nc+1),Ea(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new ze.Buf16(2*Nc+1),Ea(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 Q0(e){var t;return!e||!e.state?Ca(e,mi):(e.total_in=e.total_out=0,e.data_type=fk,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?ko:$a,e.adler=t.wrap===2?0:1,t.last_flush=is,vi._tr_init(t),Li)}function tv(e){var t=Q0(e);return t===Li&&Pk(e.state),t}function Sk(e,t){return!e||!e.state||e.state.wrap!==2?mi:(e.state.gzhead=t,Li)}function ev(e,t,i,a,s,n){if(!e)return mi;var r=1;if(t===ok&&(t=6),a<0?(r=0,a=-a):a>15&&(r=2,a-=16),s<1||s>dk||i!==Co||a<8||a>15||t<0||t>9||n<0||n>uk)return Ca(e,mi);a===8&&(a=9);var o=new Rk;return e.state=o,o.strm=e,o.wrap=r,o.gzhead=null,o.w_bits=a,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=s+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Ht-1)/Ht),o.window=new ze.Buf8(o.w_size*2),o.head=new ze.Buf16(o.hash_size),o.prev=new ze.Buf16(o.w_size),o.lit_bufsize=1<<s+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new ze.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=(1+2)*o.lit_bufsize,o.level=t,o.strategy=n,o.method=i,tv(e)}function Tk(e,t){return ev(e,t,Co,gk,vk,hk)}function Bk(e,t){var i,a,s,n;if(!e||!e.state||t>Xd||t<0)return e?Ca(e,mi):mi;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===wn&&t!==ka)return Ca(e,e.avail_out===0?hc:mi);if(a.strm=e,i=a.last_flush,a.last_flush=t,a.status===ko)if(a.wrap===2)e.adler=0,$t(a,31),$t(a,139),$t(a,8),a.gzhead?($t(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)),$t(a,a.gzhead.time&255),$t(a,a.gzhead.time>>8&255),$t(a,a.gzhead.time>>16&255),$t(a,a.gzhead.time>>24&255),$t(a,a.level===9?2:a.strategy>=Hr||a.level<2?4:0),$t(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&($t(a,a.gzhead.extra.length&255),$t(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=ba(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=zc):($t(a,0),$t(a,0),$t(a,0),$t(a,0),$t(a,0),$t(a,a.level===9?2:a.strategy>=Hr||a.level<2?4:0),$t(a,Ek),a.status=$a);else{var r=Co+(a.w_bits-8<<4)<<8,o=-1;a.strategy>=Hr||a.level<2?o=0:a.level<6?o=1:a.level===6?o=2:o=3,r|=o<<6,a.strstart!==0&&(r|=_k),r+=31-r%31,a.status=$a,dn(a,r),a.strstart!==0&&(dn(a,e.adler>>>16),dn(a,e.adler&65535)),e.adler=1}if(a.status===zc)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=ba(e.adler,a.pending_buf,a.pending-s,s)),xa(e),s=a.pending,a.pending===a.pending_buf_size));)$t(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>s&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=Gr)}else a.status=Gr;if(a.status===Gr)if(a.gzhead.name){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),xa(e),s=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindex<a.gzhead.name.length?n=a.gzhead.name.charCodeAt(a.gzindex++)&255:n=0,$t(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>s&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),n===0&&(a.gzindex=0,a.status=Zr)}else a.status=Zr;if(a.status===Zr)if(a.gzhead.comment){s=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>s&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),xa(e),s=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindex<a.gzhead.comment.length?n=a.gzhead.comment.charCodeAt(a.gzindex++)&255:n=0,$t(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>s&&(e.adler=ba(e.adler,a.pending_buf,a.pending-s,s)),n===0&&(a.status=Jr)}else a.status=Jr;if(a.status===Jr&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&xa(e),a.pending+2<=a.pending_buf_size&&($t(a,e.adler&255),$t(a,e.adler>>8&255),e.adler=0,a.status=$a)):a.status=$a),a.pending!==0){if(xa(e),e.avail_out===0)return a.last_flush=-1,Li}else if(e.avail_in===0&&Zd(t)<=Zd(i)&&t!==ka)return Ca(e,hc);if(a.status===wn&&e.avail_in!==0)return Ca(e,hc);if(e.avail_in!==0||a.lookahead!==0||t!==is&&a.status!==wn){var l=a.strategy===Hr?Fk(a,t):a.strategy===ck?kk(a,t):Ts[a.level].func(a,t);if((l===Za||l===Vs)&&(a.status=wn),l===pe||l===Za)return e.avail_out===0&&(a.last_flush=-1),Li;if(l===zn&&(t===sk?vi._tr_align(a):t!==Xd&&(vi._tr_stored_block(a,0,0,!1),t===nk&&(Ea(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),xa(e),e.avail_out===0))return a.last_flush=-1,Li}return t!==ka?Li:a.wrap<=0?Gd:(a.wrap===2?($t(a,e.adler&255),$t(a,e.adler>>8&255),$t(a,e.adler>>16&255),$t(a,e.adler>>24&255),$t(a,e.total_in&255),$t(a,e.total_in>>8&255),$t(a,e.total_in>>16&255),$t(a,e.total_in>>24&255)):(dn(a,e.adler>>>16),dn(a,e.adler&65535)),xa(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending!==0?Li:Gd)}function Ik(e){var t;return!e||!e.state?mi:(t=e.state.status,t!==ko&&t!==zc&&t!==Gr&&t!==Zr&&t!==Jr&&t!==$a&&t!==wn?Ca(e,mi):(e.state=null,t===$a?Ca(e,rk):Li))}function Dk(e,t){var i=t.length,a,s,n,r,o,l,u,c;if(!e||!e.state||(a=e.state,r=a.wrap,r===2||r===1&&a.status!==ko||a.lookahead))return mi;for(r===1&&(e.adler=Z0(e.adler,t,i,0)),a.wrap=0,i>=a.w_size&&(r===0&&(Ea(a.head),a.strstart=0,a.block_start=0,a.insert=0),c=new ze.Buf8(a.w_size),ze.arraySet(c,t,i-a.w_size,a.w_size,0),t=c,i=a.w_size),o=e.avail_in,l=e.next_in,u=e.input,e.avail_in=i,e.next_in=0,e.input=t,Ja(a);a.lookahead>=Ht;){s=a.strstart,n=a.lookahead-(Ht-1);do a.ins_h=(a.ins_h<<a.hash_shift^a.window[s+Ht-1])&a.hash_mask,a.prev[s&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=s,s++;while(--n);a.strstart=s,a.lookahead=Ht-1,Ja(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=Ht-1,a.match_available=0,e.next_in=l,e.input=u,e.avail_in=o,a.wrap=r,Li}Wi.deflateInit=Tk;Wi.deflateInit2=ev;Wi.deflateReset=tv;Wi.deflateResetKeep=Q0;Wi.deflateSetHeader=Sk;Wi.deflate=Bk;Wi.deflateEnd=Ik;Wi.deflateSetDictionary=Dk;Wi.deflateInfo="pako deflate (from Nodeca project)";var as={},Fo=ra,iv=!0,av=!0;try{String.fromCharCode.apply(null,[0])}catch{iv=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{av=!1}var In=new Fo.Buf8(256);for(var ya=0;ya<256;ya++)In[ya]=ya>=252?6:ya>=248?5:ya>=240?4:ya>=224?3:ya>=192?2:1;In[254]=In[254]=1;as.string2buf=function(e){var t,i,a,s,n,r=e.length,o=0;for(s=0;s<r;s++)i=e.charCodeAt(s),(i&64512)===55296&&s+1<r&&(a=e.charCodeAt(s+1),(a&64512)===56320&&(i=65536+(i-55296<<10)+(a-56320),s++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Fo.Buf8(o),n=0,s=0;n<o;s++)i=e.charCodeAt(s),(i&64512)===55296&&s+1<r&&(a=e.charCodeAt(s+1),(a&64512)===56320&&(i=65536+(i-55296<<10)+(a-56320),s++)),i<128?t[n++]=i:i<2048?(t[n++]=192|i>>>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 sv(e,t){if(t<65534&&(e.subarray&&av||!e.subarray&&iv))return String.fromCharCode.apply(null,Fo.shrinkBuf(e,t));for(var i="",a=0;a<t;a++)i+=String.fromCharCode(e[a]);return i}as.buf2binstring=function(e){return sv(e,e.length)};as.binstring2buf=function(e){for(var t=new Fo.Buf8(e.length),i=0,a=t.length;i<a;i++)t[i]=e.charCodeAt(i);return t};as.buf2string=function(e,t){var i,a,s,n,r=t||e.length,o=new Array(r*2);for(a=0,i=0;i<r;){if(s=e[i++],s<128){o[a++]=s;continue}if(n=In[s],n>4){o[a++]=65533,i+=n-1;continue}for(s&=n===2?31:n===3?15:7;n>1&&i<r;)s=s<<6|e[i++]&63,n--;if(n>1){o[a++]=65533;continue}s<65536?o[a++]=s:(s-=65536,o[a++]=55296|s>>10&1023,o[a++]=56320|s&1023)}return sv(o,a)};as.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+In[e[i]]>t?i:t};function Mk(){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 nv=Mk,An=Wi,Cn=ra,Wc=as,Hc=hu,Lk=nv,rv=Object.prototype.toString,Ok=0,dc=4,Ls=0,Jd=1,Qd=2,Nk=-1,zk=0,Wk=8;function Qa(e){if(!(this instanceof Qa))return new Qa(e);this.options=Cn.assign({level:Nk,method:Wk,chunkSize:16384,windowBits:15,memLevel:8,strategy:zk,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 Lk,this.strm.avail_out=0;var i=An.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==Ls)throw new Error(Hc[i]);if(t.header&&An.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(typeof t.dictionary=="string"?a=Wc.string2buf(t.dictionary):rv.call(t.dictionary)==="[object ArrayBuffer]"?a=new Uint8Array(t.dictionary):a=t.dictionary,i=An.deflateSetDictionary(this.strm,a),i!==Ls)throw new Error(Hc[i]);this._dict_set=!0}}Qa.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?dc:Ok,typeof e=="string"?i.input=Wc.string2buf(e):rv.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 Cn.Buf8(a),i.next_out=0,i.avail_out=a),s=An.deflate(i,n),s!==Jd&&s!==Ls)return this.onEnd(s),this.ended=!0,!1;(i.avail_out===0||i.avail_in===0&&(n===dc||n===Qd))&&(this.options.to==="string"?this.onData(Wc.buf2binstring(Cn.shrinkBuf(i.output,i.next_out))):this.onData(Cn.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||i.avail_out===0)&&s!==Jd);return n===dc?(s=An.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Ls):(n===Qd&&(this.onEnd(Ls),i.avail_out=0),!0)};Qa.prototype.onData=function(e){this.chunks.push(e)};Qa.prototype.onEnd=function(e){e===Ls&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Cn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function fu(e,t){var i=new Qa(t);if(i.push(e,!0),i.err)throw i.msg||Hc[i.err];return i.result}function Hk(e,t){return t=t||{},t.raw=!0,fu(e,t)}function Uk(e,t){return t=t||{},t.gzip=!0,fu(e,t)}On.Deflate=Qa;On.deflate=fu;On.deflateRaw=Hk;On.gzip=Uk;var Wn={},Ci={},Ur=30,Vk=12,$k=function(t,i){var a,s,n,r,o,l,u,c,d,f,g,m,y,p,x,_,b,C,P,S,B,D,V,G,F;a=t.state,s=t.next_in,G=t.input,n=s+(t.avail_in-5),r=t.next_out,F=t.output,o=r-(i-t.avail_out),l=r+(t.avail_out-257),u=a.dmax,c=a.wsize,d=a.whave,f=a.wnext,g=a.window,m=a.hold,y=a.bits,p=a.lencode,x=a.distcode,_=(1<<a.lenbits)-1,b=(1<<a.distbits)-1;t:do{y<15&&(m+=G[s++]<<y,y+=8,m+=G[s++]<<y,y+=8),C=p[m&_];e:for(;;){if(P=C>>>24,m>>>=P,y-=P,P=C>>>16&255,P===0)F[r++]=C&65535;else if(P&16){S=C&65535,P&=15,P&&(y<P&&(m+=G[s++]<<y,y+=8),S+=m&(1<<P)-1,m>>>=P,y-=P),y<15&&(m+=G[s++]<<y,y+=8,m+=G[s++]<<y,y+=8),C=x[m&b];i:for(;;){if(P=C>>>24,m>>>=P,y-=P,P=C>>>16&255,P&16){if(B=C&65535,P&=15,y<P&&(m+=G[s++]<<y,y+=8,y<P&&(m+=G[s++]<<y,y+=8)),B+=m&(1<<P)-1,B>u){t.msg="invalid distance too far back",a.mode=Ur;break t}if(m>>>=P,y-=P,P=r-o,B>P){if(P=B-P,P>d&&a.sane){t.msg="invalid distance too far back",a.mode=Ur;break t}if(D=0,V=g,f===0){if(D+=c-P,P<S){S-=P;do F[r++]=g[D++];while(--P);D=r-B,V=F}}else if(f<P){if(D+=c+f-P,P-=f,P<S){S-=P;do F[r++]=g[D++];while(--P);if(D=0,f<S){P=f,S-=P;do F[r++]=g[D++];while(--P);D=r-B,V=F}}}else if(D+=f-P,P<S){S-=P;do F[r++]=g[D++];while(--P);D=r-B,V=F}for(;S>2;)F[r++]=V[D++],F[r++]=V[D++],F[r++]=V[D++],S-=3;S&&(F[r++]=V[D++],S>1&&(F[r++]=V[D++]))}else{D=r-B;do F[r++]=F[D++],F[r++]=F[D++],F[r++]=F[D++],S-=3;while(S>2);S&&(F[r++]=F[D++],S>1&&(F[r++]=F[D++]))}}else if((P&64)===0){C=x[(C&65535)+(m&(1<<P)-1)];continue i}else{t.msg="invalid distance code",a.mode=Ur;break t}break}}else if((P&64)===0){C=p[(C&65535)+(m&(1<<P)-1)];continue e}else if(P&32){a.mode=Vk;break t}else{t.msg="invalid literal/length code",a.mode=Ur;break t}break}}while(s<n&&r<l);S=y>>3,s-=S,y-=S<<3,m&=(1<<y)-1,t.next_in=s,t.next_out=r,t.avail_in=s<n?5+(n-s):5-(s-n),t.avail_out=r<l?257+(l-r):257-(r-l),a.hold=m,a.bits=y},tg=ra,Es=15,eg=852,ig=592,ag=0,gc=1,sg=2,jk=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],qk=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Yk=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Kk=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],Xk=function(t,i,a,s,n,r,o,l){var u=l.bits,c=0,d=0,f=0,g=0,m=0,y=0,p=0,x=0,_=0,b=0,C,P,S,B,D,V=null,G=0,F,R=new tg.Buf16(Es+1),T=new tg.Buf16(Es+1),L=null,$=0,Z,at,q;for(c=0;c<=Es;c++)R[c]=0;for(d=0;d<s;d++)R[i[a+d]]++;for(m=u,g=Es;g>=1&&R[g]===0;g--);if(m>g&&(m=g),g===0)return n[r++]=1<<24|64<<16|0,n[r++]=1<<24|64<<16|0,l.bits=1,0;for(f=1;f<g&&R[f]===0;f++);for(m<f&&(m=f),x=1,c=1;c<=Es;c++)if(x<<=1,x-=R[c],x<0)return-1;if(x>0&&(t===ag||g!==1))return-1;for(T[1]=0,c=1;c<Es;c++)T[c+1]=T[c]+R[c];for(d=0;d<s;d++)i[a+d]!==0&&(o[T[i[a+d]]++]=d);if(t===ag?(V=L=o,F=19):t===gc?(V=jk,G-=257,L=qk,$-=257,F=256):(V=Yk,L=Kk,F=-1),b=0,d=0,c=f,D=r,y=m,p=0,S=-1,_=1<<m,B=_-1,t===gc&&_>eg||t===sg&&_>ig)return 1;for(;;){Z=c-p,o[d]<F?(at=0,q=o[d]):o[d]>F?(at=L[$+o[d]],q=V[G+o[d]]):(at=32+64,q=0),C=1<<c-p,P=1<<y,f=P;do P-=C,n[D+(b>>p)+P]=Z<<24|at<<16|q|0;while(P!==0);for(C=1<<c-1;b&C;)C>>=1;if(C!==0?(b&=C-1,b+=C):b=0,d++,--R[c]===0){if(c===g)break;c=i[a+o[d]]}if(c>m&&(b&B)!==S){for(p===0&&(p=m),D+=f,y=c-p,x=1<<y;y+p<g&&(x-=R[y+p],!(x<=0));)y++,x<<=1;if(_+=1<<y,t===gc&&_>eg||t===sg&&_>ig)return 1;S=b&B,n[S]=m<<24|y<<16|D-r|0}}return b!==0&&(n[D+b]=c-p<<24|64<<16|0),l.bits=m,0},ni=ra,Uc=X0,Ti=G0,Gk=$k,kn=Xk,Zk=0,ov=1,lv=2,ng=4,Jk=5,Vr=6,ts=0,Qk=1,t9=2,yi=-2,cv=-3,uv=-4,e9=-5,rg=8,hv=1,og=2,lg=3,cg=4,ug=5,hg=6,fg=7,dg=8,gg=9,vg=10,po=11,Xi=12,vc=13,mg=14,mc=15,yg=16,pg=17,wg=18,bg=19,$r=20,jr=21,xg=22,_g=23,Eg=24,Ag=25,Cg=26,yc=27,kg=28,Fg=29,ne=30,fv=31,i9=32,a9=852,s9=592,n9=15,r9=n9;function Pg(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function o9(){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 ni.Buf16(320),this.work=new ni.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function dv(e){var t;return!e||!e.state?yi:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=hv,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new ni.Buf32(a9),t.distcode=t.distdyn=new ni.Buf32(s9),t.sane=1,t.back=-1,ts)}function gv(e){var t;return!e||!e.state?yi:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,dv(e))}function vv(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))?yi:(a.window!==null&&a.wbits!==t&&(a.window=null),a.wrap=i,a.wbits=t,gv(e))}function mv(e,t){var i,a;return e?(a=new o9,e.state=a,a.window=null,i=vv(e,t),i!==ts&&(e.state=null),i):yi}function l9(e){return mv(e,r9)}var Rg=!0,pc,wc;function c9(e){if(Rg){var t;for(pc=new ni.Buf32(512),wc=new ni.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(kn(ov,e.lens,0,288,pc,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;kn(lv,e.lens,0,32,wc,0,e.work,{bits:5}),Rg=!1}e.lencode=pc,e.lenbits=9,e.distcode=wc,e.distbits=5}function yv(e,t,i,a){var s,n=e.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new ni.Buf8(n.wsize)),a>=n.wsize?(ni.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),ni.arraySet(n.window,t,i-a,s,n.wnext),a-=s,a?(ni.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<n.wsize&&(n.whave+=s))),0}function u9(e,t){var i,a,s,n,r,o,l,u,c,d,f,g,m,y,p=0,x,_,b,C,P,S,B,D,V=new ni.Buf8(4),G,F,R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return yi;i=e.state,i.mode===Xi&&(i.mode=vc),r=e.next_out,s=e.output,l=e.avail_out,n=e.next_in,a=e.input,o=e.avail_in,u=i.hold,c=i.bits,d=o,f=l,D=ts;t:for(;;)switch(i.mode){case hv:if(i.wrap===0){i.mode=vc;break}for(;c<16;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if(i.wrap&2&&u===35615){i.check=0,V[0]=u&255,V[1]=u>>>8&255,i.check=Ti(i.check,V,2,0),u=0,c=0,i.mode=og;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)!==rg){e.msg="unknown compression method",i.mode=ne;break}if(u>>>=4,c-=4,B=(u&15)+8,i.wbits===0)i.wbits=B;else if(B>i.wbits){e.msg="invalid window size",i.mode=ne;break}i.dmax=1<<B,e.adler=i.check=1,i.mode=u&512?vg:Xi,u=0,c=0;break;case og:for(;c<16;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if(i.flags=u,(i.flags&255)!==rg){e.msg="unknown compression method",i.mode=ne;break}if(i.flags&57344){e.msg="unknown header flags set",i.mode=ne;break}i.head&&(i.head.text=u>>8&1),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,i.check=Ti(i.check,V,2,0)),u=0,c=0,i.mode=lg;case lg:for(;c<32;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}i.head&&(i.head.time=u),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,V[2]=u>>>16&255,V[3]=u>>>24&255,i.check=Ti(i.check,V,4,0)),u=0,c=0,i.mode=cg;case cg:for(;c<16;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}i.head&&(i.head.xflags=u&255,i.head.os=u>>8),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,i.check=Ti(i.check,V,2,0)),u=0,c=0,i.mode=ug;case ug:if(i.flags&1024){for(;c<16;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}i.length=u,i.head&&(i.head.extra_len=u),i.flags&512&&(V[0]=u&255,V[1]=u>>>8&255,i.check=Ti(i.check,V,2,0)),u=0,c=0}else i.head&&(i.head.extra=null);i.mode=hg;case hg:if(i.flags&1024&&(g=i.length,g>o&&(g=o),g&&(i.head&&(B=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),ni.arraySet(i.head.extra,a,n,g,B)),i.flags&512&&(i.check=Ti(i.check,a,g,n)),o-=g,n+=g,i.length-=g),i.length))break t;i.length=0,i.mode=fg;case fg:if(i.flags&2048){if(o===0)break t;g=0;do B=a[n+g++],i.head&&B&&i.length<65536&&(i.head.name+=String.fromCharCode(B));while(B&&g<o);if(i.flags&512&&(i.check=Ti(i.check,a,g,n)),o-=g,n+=g,B)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=dg;case dg:if(i.flags&4096){if(o===0)break t;g=0;do B=a[n+g++],i.head&&B&&i.length<65536&&(i.head.comment+=String.fromCharCode(B));while(B&&g<o);if(i.flags&512&&(i.check=Ti(i.check,a,g,n)),o-=g,n+=g,B)break t}else i.head&&(i.head.comment=null);i.mode=gg;case gg:if(i.flags&512){for(;c<16;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if(u!==(i.check&65535)){e.msg="header crc mismatch",i.mode=ne;break}u=0,c=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Xi;break;case vg:for(;c<32;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}e.adler=i.check=Pg(u),u=0,c=0,i.mode=po;case po:if(i.havedict===0)return e.next_out=r,e.avail_out=l,e.next_in=n,e.avail_in=o,i.hold=u,i.bits=c,t9;e.adler=i.check=1,i.mode=Xi;case Xi:if(t===Jk||t===Vr)break t;case vc:if(i.last){u>>>=c&7,c-=c&7,i.mode=yc;break}for(;c<3;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}switch(i.last=u&1,u>>>=1,c-=1,u&3){case 0:i.mode=mg;break;case 1:if(c9(i),i.mode=$r,t===Vr){u>>>=2,c-=2;break t}break;case 2:i.mode=pg;break;case 3:e.msg="invalid block type",i.mode=ne}u>>>=2,c-=2;break;case mg:for(u>>>=c&7,c-=c&7;c<32;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if((u&65535)!==(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=ne;break}if(i.length=u&65535,u=0,c=0,i.mode=mc,t===Vr)break t;case mc:i.mode=yg;case yg:if(g=i.length,g){if(g>o&&(g=o),g>l&&(g=l),g===0)break t;ni.arraySet(s,a,n,g,r),o-=g,n+=g,l-=g,r+=g,i.length-=g;break}i.mode=Xi;break;case pg:for(;c<14;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if(i.nlen=(u&31)+257,u>>>=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=wg;case wg:for(;i.have<i.ncode;){for(;c<3;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}i.lens[R[i.have++]]=u&7,u>>>=3,c-=3}for(;i.have<19;)i.lens[R[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,G={bits:i.lenbits},D=kn(Zk,i.lens,0,19,i.lencode,0,i.work,G),i.lenbits=G.bits,D){e.msg="invalid code lengths set",i.mode=ne;break}i.have=0,i.mode=bg;case bg:for(;i.have<i.nlen+i.ndist;){for(;p=i.lencode[u&(1<<i.lenbits)-1],x=p>>>24,_=p>>>16&255,b=p&65535,!(x<=c);){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if(b<16)u>>>=x,c-=x,i.lens[i.have++]=b;else{if(b===16){for(F=x+2;c<F;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if(u>>>=x,c-=x,i.have===0){e.msg="invalid bit length repeat",i.mode=ne;break}B=i.lens[i.have-1],g=3+(u&3),u>>>=2,c-=2}else if(b===17){for(F=x+3;c<F;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}u>>>=x,c-=x,B=0,g=3+(u&7),u>>>=3,c-=3}else{for(F=x+7;c<F;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}u>>>=x,c-=x,B=0,g=11+(u&127),u>>>=7,c-=7}if(i.have+g>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=ne;break}for(;g--;)i.lens[i.have++]=B}}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,G={bits:i.lenbits},D=kn(ov,i.lens,0,i.nlen,i.lencode,0,i.work,G),i.lenbits=G.bits,D){e.msg="invalid literal/lengths set",i.mode=ne;break}if(i.distbits=6,i.distcode=i.distdyn,G={bits:i.distbits},D=kn(lv,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,G),i.distbits=G.bits,D){e.msg="invalid distances set",i.mode=ne;break}if(i.mode=$r,t===Vr)break t;case $r:i.mode=jr;case jr:if(o>=6&&l>=258){e.next_out=r,e.avail_out=l,e.next_in=n,e.avail_in=o,i.hold=u,i.bits=c,Gk(e,f),r=e.next_out,s=e.output,l=e.avail_out,n=e.next_in,a=e.input,o=e.avail_in,u=i.hold,c=i.bits,i.mode===Xi&&(i.back=-1);break}for(i.back=0;p=i.lencode[u&(1<<i.lenbits)-1],x=p>>>24,_=p>>>16&255,b=p&65535,!(x<=c);){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if(_&&(_&240)===0){for(C=x,P=_,S=b;p=i.lencode[S+((u&(1<<C+P)-1)>>C)],x=p>>>24,_=p>>>16&255,b=p&65535,!(C+x<=c);){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}u>>>=C,c-=C,i.back+=C}if(u>>>=x,c-=x,i.back+=x,i.length=b,_===0){i.mode=Cg;break}if(_&32){i.back=-1,i.mode=Xi;break}if(_&64){e.msg="invalid literal/length code",i.mode=ne;break}i.extra=_&15,i.mode=xg;case xg:if(i.extra){for(F=i.extra;c<F;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,c-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=_g;case _g:for(;p=i.distcode[u&(1<<i.distbits)-1],x=p>>>24,_=p>>>16&255,b=p&65535,!(x<=c);){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if((_&240)===0){for(C=x,P=_,S=b;p=i.distcode[S+((u&(1<<C+P)-1)>>C)],x=p>>>24,_=p>>>16&255,b=p&65535,!(C+x<=c);){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}u>>>=C,c-=C,i.back+=C}if(u>>>=x,c-=x,i.back+=x,_&64){e.msg="invalid distance code",i.mode=ne;break}i.offset=b,i.extra=_&15,i.mode=Eg;case Eg:if(i.extra){for(F=i.extra;c<F;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}i.offset+=u&(1<<i.extra)-1,u>>>=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=Ag;case Ag:if(l===0)break t;if(g=f-l,i.offset>g){if(g=i.offset-g,g>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=ne;break}g>i.wnext?(g-=i.wnext,m=i.wsize-g):m=i.wnext-g,g>i.length&&(g=i.length),y=i.window}else y=s,m=r-i.offset,g=i.length;g>l&&(g=l),l-=g,i.length-=g;do s[r++]=y[m++];while(--g);i.length===0&&(i.mode=jr);break;case Cg:if(l===0)break t;s[r++]=i.length,l--,i.mode=jr;break;case yc:if(i.wrap){for(;c<32;){if(o===0)break t;o--,u|=a[n++]<<c,c+=8}if(f-=l,e.total_out+=f,i.total+=f,f&&(e.adler=i.check=i.flags?Ti(i.check,s,f,r-f):Uc(i.check,s,f,r-f)),f=l,(i.flags?u:Pg(u))!==i.check){e.msg="incorrect data check",i.mode=ne;break}u=0,c=0}i.mode=kg;case kg:if(i.wrap&&i.flags){for(;c<32;){if(o===0)break t;o--,u+=a[n++]<<c,c+=8}if(u!==(i.total&4294967295)){e.msg="incorrect length check",i.mode=ne;break}u=0,c=0}i.mode=Fg;case Fg:D=Qk;break t;case ne:D=cv;break t;case fv:return uv;case i9:default:return yi}return e.next_out=r,e.avail_out=l,e.next_in=n,e.avail_in=o,i.hold=u,i.bits=c,(i.wsize||f!==e.avail_out&&i.mode<ne&&(i.mode<yc||t!==ng))&&yv(e,e.output,e.next_out,f-e.avail_out),d-=e.avail_in,f-=e.avail_out,e.total_in+=d,e.total_out+=f,i.total+=f,i.wrap&&f&&(e.adler=i.check=i.flags?Ti(i.check,s,f,e.next_out-f):Uc(i.check,s,f,e.next_out-f)),e.data_type=i.bits+(i.last?64:0)+(i.mode===Xi?128:0)+(i.mode===$r||i.mode===mc?256:0),(d===0&&f===0||t===ng)&&D===ts&&(D=e9),D}function h9(e){if(!e||!e.state)return yi;var t=e.state;return t.window&&(t.window=null),e.state=null,ts}function f9(e,t){var i;return!e||!e.state||(i=e.state,(i.wrap&2)===0)?yi:(i.head=t,t.done=!1,ts)}function d9(e,t){var i=t.length,a,s,n;return!e||!e.state||(a=e.state,a.wrap!==0&&a.mode!==po)?yi:a.mode===po&&(s=1,s=Uc(s,t,i,0),s!==a.check)?cv:(n=yv(e,t,i,i),n?(a.mode=fv,uv):(a.havedict=1,ts))}Ci.inflateReset=gv;Ci.inflateReset2=vv;Ci.inflateResetKeep=dv;Ci.inflateInit=l9;Ci.inflateInit2=mv;Ci.inflate=u9;Ci.inflateEnd=h9;Ci.inflateGetHeader=f9;Ci.inflateSetDictionary=d9;Ci.inflateInfo="pako inflate (from Nodeca project)";var pv={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};function g9(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var v9=g9,Os=Ci,Fn=ra,Qr=as,ge=pv,Vc=hu,m9=nv,y9=v9,wv=Object.prototype.toString;function es(e){if(!(this instanceof es))return new es(e);this.options=Fn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=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 m9,this.strm.avail_out=0;var i=Os.inflateInit2(this.strm,t.windowBits);if(i!==ge.Z_OK)throw new Error(Vc[i]);if(this.header=new y9,Os.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Qr.string2buf(t.dictionary):wv.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=Os.inflateSetDictionary(this.strm,t.dictionary),i!==ge.Z_OK)))throw new Error(Vc[i])}es.prototype.push=function(e,t){var i=this.strm,a=this.options.chunkSize,s=this.options.dictionary,n,r,o,l,u,c=!1;if(this.ended)return!1;r=t===~~t?t:t===!0?ge.Z_FINISH:ge.Z_NO_FLUSH,typeof e=="string"?i.input=Qr.binstring2buf(e):wv.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 Fn.Buf8(a),i.next_out=0,i.avail_out=a),n=Os.inflate(i,ge.Z_NO_FLUSH),n===ge.Z_NEED_DICT&&s&&(n=Os.inflateSetDictionary(this.strm,s)),n===ge.Z_BUF_ERROR&&c===!0&&(n=ge.Z_OK,c=!1),n!==ge.Z_STREAM_END&&n!==ge.Z_OK)return this.onEnd(n),this.ended=!0,!1;i.next_out&&(i.avail_out===0||n===ge.Z_STREAM_END||i.avail_in===0&&(r===ge.Z_FINISH||r===ge.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Qr.utf8border(i.output,i.next_out),l=i.next_out-o,u=Qr.buf2string(i.output,o),i.next_out=l,i.avail_out=a-l,l&&Fn.arraySet(i.output,i.output,o,l,0),this.onData(u)):this.onData(Fn.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!==ge.Z_STREAM_END);return n===ge.Z_STREAM_END&&(r=ge.Z_FINISH),r===ge.Z_FINISH?(n=Os.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ge.Z_OK):(r===ge.Z_SYNC_FLUSH&&(this.onEnd(ge.Z_OK),i.avail_out=0),!0)};es.prototype.onData=function(e){this.chunks.push(e)};es.prototype.onEnd=function(e){e===ge.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Fn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function du(e,t){var i=new es(t);if(i.push(e,!0),i.err)throw i.msg||Vc[i.err];return i.result}function p9(e,t){return t=t||{},t.raw=!0,du(e,t)}Wn.Inflate=es;Wn.inflate=du;Wn.inflateRaw=p9;Wn.ungzip=du;var w9=ra.assign,b9=On,x9=Wn,_9=pv,bv={};w9(bv,b9,x9,_9);var $9=bv,$c={exports:{}};/**
  101. * @license
  102. * Lodash <https://lodash.com/>
  103. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  104. * Released under MIT license <https://lodash.com/license>
  105. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  106. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  107. */(function(e,t){(function(){var i,a="4.18.1",s=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",r="Expected a function",o="Invalid `variable` option passed into `_.template`",l="Invalid `imports` option passed into `_.template`",u="__lodash_hash_undefined__",c=500,d="__lodash_placeholder__",f=1,g=2,m=4,y=1,p=2,x=1,_=2,b=4,C=8,P=16,S=32,B=64,D=128,V=256,G=512,F=30,R="...",T=800,L=16,$=1,Z=2,at=3,q=1/0,W=9007199254740991,j=17976931348623157e292,K=0/0,U=4294967295,tt=U-1,st=U>>>1,it=[["ary",D],["bind",x],["bindKey",_],["curry",C],["curryRight",P],["flip",G],["partial",S],["partialRight",B],["rearg",V]],ht="[object Arguments]",lt="[object Array]",ut="[object AsyncFunction]",E="[object Boolean]",A="[object Date]",I="[object DOMException]",N="[object Error]",X="[object Function]",J="[object GeneratorFunction]",rt="[object Map]",yt="[object Number]",mt="[object Null]",Et="[object Object]",Ft="[object Promise]",Ge="[object Proxy]",we="[object RegExp]",oe="[object Set]",Vt="[object String]",Gt="[object Symbol]",ss="[object Undefined]",$s="[object WeakMap]",xv="[object WeakSet]",js="[object ArrayBuffer]",ns="[object DataView]",Po="[object Float32Array]",Ro="[object Float64Array]",So="[object Int8Array]",To="[object Int16Array]",Bo="[object Int32Array]",Io="[object Uint8Array]",Do="[object Uint8ClampedArray]",Mo="[object Uint16Array]",Lo="[object Uint32Array]",_v=/\b__p \+= '';/g,Ev=/\b(__p \+=) '' \+/g,Av=/(__e\(.*?\)|\b__t\)) \+\n'';/g,gu=/&(?:amp|lt|gt|quot|#39);/g,vu=/[&<>"']/g,Cv=RegExp(gu.source),kv=RegExp(vu.source),Fv=/<%-([\s\S]+?)%>/g,Pv=/<%([\s\S]+?)%>/g,mu=/<%=([\s\S]+?)%>/g,Rv=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Sv=/^\w*$/,Tv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Oo=/[\\^$.*+?()[\]{}|]/g,Bv=RegExp(Oo.source),No=/^\s+/,Iv=/\s/,Dv=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Mv=/\{\n\/\* \[wrapped with (.+)\] \*/,Lv=/,? & /,Ov=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,yu=/[()=,{}\[\]\/\s]/,Nv=/\\(\\)?/g,zv=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pu=/\w*$/,Wv=/^[-+]0x[0-9a-f]+$/i,Hv=/^0b[01]+$/i,Uv=/^\[object .+?Constructor\]$/,Vv=/^0o[0-7]+$/i,$v=/^(?:0|[1-9]\d*)$/,jv=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hn=/($^)/,qv=/['\n\r\u2028\u2029\\]/g,Un="\\ud800-\\udfff",Yv="\\u0300-\\u036f",Kv="\\ufe20-\\ufe2f",Xv="\\u20d0-\\u20ff",wu=Yv+Kv+Xv,bu="\\u2700-\\u27bf",xu="a-z\\xdf-\\xf6\\xf8-\\xff",Gv="\\xac\\xb1\\xd7\\xf7",Zv="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Jv="\\u2000-\\u206f",Qv=" \\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",_u="A-Z\\xc0-\\xd6\\xd8-\\xde",Eu="\\ufe0e\\ufe0f",Au=Gv+Zv+Jv+Qv,zo="['\u2019]",tm="["+Un+"]",Cu="["+Au+"]",Vn="["+wu+"]",ku="\\d+",em="["+bu+"]",Fu="["+xu+"]",Pu="[^"+Un+Au+ku+bu+xu+_u+"]",Wo="\\ud83c[\\udffb-\\udfff]",im="(?:"+Vn+"|"+Wo+")",Ru="[^"+Un+"]",Ho="(?:\\ud83c[\\udde6-\\uddff]){2}",Uo="[\\ud800-\\udbff][\\udc00-\\udfff]",rs="["+_u+"]",Su="\\u200d",Tu="(?:"+Fu+"|"+Pu+")",am="(?:"+rs+"|"+Pu+")",Bu="(?:"+zo+"(?:d|ll|m|re|s|t|ve))?",Iu="(?:"+zo+"(?:D|LL|M|RE|S|T|VE))?",Du=im+"?",Mu="["+Eu+"]?",sm="(?:"+Su+"(?:"+[Ru,Ho,Uo].join("|")+")"+Mu+Du+")*",nm="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rm="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lu=Mu+Du+sm,om="(?:"+[em,Ho,Uo].join("|")+")"+Lu,lm="(?:"+[Ru+Vn+"?",Vn,Ho,Uo,tm].join("|")+")",cm=RegExp(zo,"g"),um=RegExp(Vn,"g"),Vo=RegExp(Wo+"(?="+Wo+")|"+lm+Lu,"g"),hm=RegExp([rs+"?"+Fu+"+"+Bu+"(?="+[Cu,rs,"$"].join("|")+")",am+"+"+Iu+"(?="+[Cu,rs+Tu,"$"].join("|")+")",rs+"?"+Tu+"+"+Bu,rs+"+"+Iu,rm,nm,ku,om].join("|"),"g"),fm=RegExp("["+Su+Un+wu+Eu+"]"),dm=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,gm=["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"],vm=-1,ae={};ae[Po]=ae[Ro]=ae[So]=ae[To]=ae[Bo]=ae[Io]=ae[Do]=ae[Mo]=ae[Lo]=!0,ae[ht]=ae[lt]=ae[js]=ae[E]=ae[ns]=ae[A]=ae[N]=ae[X]=ae[rt]=ae[yt]=ae[Et]=ae[we]=ae[oe]=ae[Vt]=ae[$s]=!1;var ee={};ee[ht]=ee[lt]=ee[js]=ee[ns]=ee[E]=ee[A]=ee[Po]=ee[Ro]=ee[So]=ee[To]=ee[Bo]=ee[rt]=ee[yt]=ee[Et]=ee[we]=ee[oe]=ee[Vt]=ee[Gt]=ee[Io]=ee[Do]=ee[Mo]=ee[Lo]=!0,ee[N]=ee[X]=ee[$s]=!1;var mm={\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"},ym={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pm={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},wm={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},bm=parseFloat,xm=parseInt,Ou=typeof Oe=="object"&&Oe&&Oe.Object===Object&&Oe,_m=typeof self=="object"&&self&&self.Object===Object&&self,_e=Ou||_m||Function("return this")(),$o=t&&!t.nodeType&&t,Fa=$o&&!0&&e&&!e.nodeType&&e,Nu=Fa&&Fa.exports===$o,jo=Nu&&Ou.process,ri=function(){try{var et=Fa&&Fa.require&&Fa.require("util").types;return et||jo&&jo.binding&&jo.binding("util")}catch{}}(),zu=ri&&ri.isArrayBuffer,Wu=ri&&ri.isDate,Hu=ri&&ri.isMap,Uu=ri&&ri.isRegExp,Vu=ri&&ri.isSet,$u=ri&&ri.isTypedArray;function Ze(et,ft,ct){switch(ct.length){case 0:return et.call(ft);case 1:return et.call(ft,ct[0]);case 2:return et.call(ft,ct[0],ct[1]);case 3:return et.call(ft,ct[0],ct[1],ct[2])}return et.apply(ft,ct)}function Em(et,ft,ct,bt){for(var St=-1,qt=et==null?0:et.length;++St<qt;){var me=et[St];ft(bt,me,ct(me),et)}return bt}function Je(et,ft){for(var ct=-1,bt=et==null?0:et.length;++ct<bt&&ft(et[ct],ct,et)!==!1;);return et}function Am(et,ft){for(var ct=et==null?0:et.length;ct--&&ft(et[ct],ct,et)!==!1;);return et}function ju(et,ft){for(var ct=-1,bt=et==null?0:et.length;++ct<bt;)if(!ft(et[ct],ct,et))return!1;return!0}function oa(et,ft){for(var ct=-1,bt=et==null?0:et.length,St=0,qt=[];++ct<bt;){var me=et[ct];ft(me,ct,et)&&(qt[St++]=me)}return qt}function $n(et,ft){var ct=et==null?0:et.length;return!!ct&&os(et,ft,0)>-1}function qo(et,ft,ct){for(var bt=-1,St=et==null?0:et.length;++bt<St;)if(ct(ft,et[bt]))return!0;return!1}function se(et,ft){for(var ct=-1,bt=et==null?0:et.length,St=Array(bt);++ct<bt;)St[ct]=ft(et[ct],ct,et);return St}function la(et,ft){for(var ct=-1,bt=ft.length,St=et.length;++ct<bt;)et[St+ct]=ft[ct];return et}function Yo(et,ft,ct,bt){var St=-1,qt=et==null?0:et.length;for(bt&&qt&&(ct=et[++St]);++St<qt;)ct=ft(ct,et[St],St,et);return ct}function Cm(et,ft,ct,bt){var St=et==null?0:et.length;for(bt&&St&&(ct=et[--St]);St--;)ct=ft(ct,et[St],St,et);return ct}function Ko(et,ft){for(var ct=-1,bt=et==null?0:et.length;++ct<bt;)if(ft(et[ct],ct,et))return!0;return!1}var km=Xo("length");function Fm(et){return et.split("")}function Pm(et){return et.match(Ov)||[]}function qu(et,ft,ct){var bt;return ct(et,function(St,qt,me){if(ft(St,qt,me))return bt=qt,!1}),bt}function jn(et,ft,ct,bt){for(var St=et.length,qt=ct+(bt?1:-1);bt?qt--:++qt<St;)if(ft(et[qt],qt,et))return qt;return-1}function os(et,ft,ct){return ft===ft?Wm(et,ft,ct):jn(et,Yu,ct)}function Rm(et,ft,ct,bt){for(var St=ct-1,qt=et.length;++St<qt;)if(bt(et[St],ft))return St;return-1}function Yu(et){return et!==et}function Ku(et,ft){var ct=et==null?0:et.length;return ct?Zo(et,ft)/ct:K}function Xo(et){return function(ft){return ft==null?i:ft[et]}}function Go(et){return function(ft){return et==null?i:et[ft]}}function Xu(et,ft,ct,bt,St){return St(et,function(qt,me,Jt){ct=bt?(bt=!1,qt):ft(ct,qt,me,Jt)}),ct}function Sm(et,ft){var ct=et.length;for(et.sort(ft);ct--;)et[ct]=et[ct].value;return et}function Zo(et,ft){for(var ct,bt=-1,St=et.length;++bt<St;){var qt=ft(et[bt]);qt!==i&&(ct=ct===i?qt:ct+qt)}return ct}function Jo(et,ft){for(var ct=-1,bt=Array(et);++ct<et;)bt[ct]=ft(ct);return bt}function Tm(et,ft){return se(ft,function(ct){return[ct,et[ct]]})}function Gu(et){return et&&et.slice(0,th(et)+1).replace(No,"")}function Qe(et){return function(ft){return et(ft)}}function Qo(et,ft){return se(ft,function(ct){return et[ct]})}function qs(et,ft){return et.has(ft)}function Zu(et,ft){for(var ct=-1,bt=et.length;++ct<bt&&os(ft,et[ct],0)>-1;);return ct}function Ju(et,ft){for(var ct=et.length;ct--&&os(ft,et[ct],0)>-1;);return ct}function Bm(et,ft){for(var ct=et.length,bt=0;ct--;)et[ct]===ft&&++bt;return bt}var Im=Go(mm),Dm=Go(ym);function Mm(et){return"\\"+wm[et]}function Lm(et,ft){return et==null?i:et[ft]}function ls(et){return fm.test(et)}function Om(et){return dm.test(et)}function Nm(et){for(var ft,ct=[];!(ft=et.next()).done;)ct.push(ft.value);return ct}function tl(et){var ft=-1,ct=Array(et.size);return et.forEach(function(bt,St){ct[++ft]=[St,bt]}),ct}function Qu(et,ft){return function(ct){return et(ft(ct))}}function ca(et,ft){for(var ct=-1,bt=et.length,St=0,qt=[];++ct<bt;){var me=et[ct];(me===ft||me===d)&&(et[ct]=d,qt[St++]=ct)}return qt}function qn(et){var ft=-1,ct=Array(et.size);return et.forEach(function(bt){ct[++ft]=bt}),ct}function zm(et){var ft=-1,ct=Array(et.size);return et.forEach(function(bt){ct[++ft]=[bt,bt]}),ct}function Wm(et,ft,ct){for(var bt=ct-1,St=et.length;++bt<St;)if(et[bt]===ft)return bt;return-1}function Hm(et,ft,ct){for(var bt=ct+1;bt--;)if(et[bt]===ft)return bt;return bt}function cs(et){return ls(et)?Vm(et):km(et)}function pi(et){return ls(et)?$m(et):Fm(et)}function th(et){for(var ft=et.length;ft--&&Iv.test(et.charAt(ft)););return ft}var Um=Go(pm);function Vm(et){for(var ft=Vo.lastIndex=0;Vo.test(et);)++ft;return ft}function $m(et){return et.match(Vo)||[]}function jm(et){return et.match(hm)||[]}var qm=function et(ft){ft=ft==null?_e:us.defaults(_e.Object(),ft,us.pick(_e,gm));var ct=ft.Array,bt=ft.Date,St=ft.Error,qt=ft.Function,me=ft.Math,Jt=ft.Object,el=ft.RegExp,Ym=ft.String,oi=ft.TypeError,Yn=ct.prototype,Km=qt.prototype,hs=Jt.prototype,Kn=ft["__core-js_shared__"],Xn=Km.toString,Kt=hs.hasOwnProperty,Xm=0,eh=function(){var h=/[^.]+$/.exec(Kn&&Kn.keys&&Kn.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""}(),Gn=hs.toString,Gm=Xn.call(Jt),Zm=_e._,Jm=el("^"+Xn.call(Kt).replace(Oo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Zn=Nu?ft.Buffer:i,ua=ft.Symbol,Jn=ft.Uint8Array,ih=Zn?Zn.allocUnsafe:i,Qn=Qu(Jt.getPrototypeOf,Jt),ah=Jt.create,sh=hs.propertyIsEnumerable,tr=Yn.splice,nh=ua?ua.isConcatSpreadable:i,Ys=ua?ua.iterator:i,Pa=ua?ua.toStringTag:i,er=function(){try{var h=Ia(Jt,"defineProperty");return h({},"",{}),h}catch{}}(),Qm=ft.clearTimeout!==_e.clearTimeout&&ft.clearTimeout,ty=bt&&bt.now!==_e.Date.now&&bt.now,ey=ft.setTimeout!==_e.setTimeout&&ft.setTimeout,ir=me.ceil,ar=me.floor,il=Jt.getOwnPropertySymbols,iy=Zn?Zn.isBuffer:i,rh=ft.isFinite,ay=Yn.join,sy=Qu(Jt.keys,Jt),ye=me.max,Re=me.min,ny=bt.now,ry=ft.parseInt,oh=me.random,oy=Yn.reverse,al=Ia(ft,"DataView"),Ks=Ia(ft,"Map"),sl=Ia(ft,"Promise"),fs=Ia(ft,"Set"),Xs=Ia(ft,"WeakMap"),Gs=Ia(Jt,"create"),sr=Xs&&new Xs,ds={},ly=Da(al),cy=Da(Ks),uy=Da(sl),hy=Da(fs),fy=Da(Xs),nr=ua?ua.prototype:i,Zs=nr?nr.valueOf:i,lh=nr?nr.toString:i;function O(h){if(ue(h)&&!Bt(h)&&!(h instanceof Nt)){if(h instanceof li)return h;if(Kt.call(h,"__wrapped__"))return uf(h)}return new li(h)}var gs=function(){function h(){}return function(v){if(!le(v))return{};if(ah)return ah(v);h.prototype=v;var w=new h;return h.prototype=i,w}}();function rr(){}function li(h,v){this.__wrapped__=h,this.__actions__=[],this.__chain__=!!v,this.__index__=0,this.__values__=i}O.templateSettings={escape:Fv,evaluate:Pv,interpolate:mu,variable:"",imports:{_:O}},O.prototype=rr.prototype,O.prototype.constructor=O,li.prototype=gs(rr.prototype),li.prototype.constructor=li;function Nt(h){this.__wrapped__=h,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=U,this.__views__=[]}function dy(){var h=new Nt(this.__wrapped__);return h.__actions__=He(this.__actions__),h.__dir__=this.__dir__,h.__filtered__=this.__filtered__,h.__iteratees__=He(this.__iteratees__),h.__takeCount__=this.__takeCount__,h.__views__=He(this.__views__),h}function gy(){if(this.__filtered__){var h=new Nt(this);h.__dir__=-1,h.__filtered__=!0}else h=this.clone(),h.__dir__*=-1;return h}function vy(){var h=this.__wrapped__.value(),v=this.__dir__,w=Bt(h),k=v<0,M=w?h.length:0,z=Fp(0,M,this.__views__),Y=z.start,Q=z.end,nt=Q-Y,dt=k?Q:Y-1,gt=this.__iteratees__,vt=gt.length,pt=0,At=Re(nt,this.__takeCount__);if(!w||!k&&M==nt&&At==nt)return Bh(h,this.__actions__);var Pt=[];t:for(;nt--&&pt<At;){dt+=v;for(var Mt=-1,Ct=h[dt];++Mt<vt;){var Ot=gt[Mt],Wt=Ot.iteratee,ii=Ot.type,Me=Wt(Ct);if(ii==Z)Ct=Me;else if(!Me){if(ii==$)continue t;break t}}Pt[pt++]=Ct}return Pt}Nt.prototype=gs(rr.prototype),Nt.prototype.constructor=Nt;function Ra(h){var v=-1,w=h==null?0:h.length;for(this.clear();++v<w;){var k=h[v];this.set(k[0],k[1])}}function my(){this.__data__=Gs?Gs(null):{},this.size=0}function yy(h){var v=this.has(h)&&delete this.__data__[h];return this.size-=v?1:0,v}function py(h){var v=this.__data__;if(Gs){var w=v[h];return w===u?i:w}return Kt.call(v,h)?v[h]:i}function wy(h){var v=this.__data__;return Gs?v[h]!==i:Kt.call(v,h)}function by(h,v){var w=this.__data__;return this.size+=this.has(h)?0:1,w[h]=Gs&&v===i?u:v,this}Ra.prototype.clear=my,Ra.prototype.delete=yy,Ra.prototype.get=py,Ra.prototype.has=wy,Ra.prototype.set=by;function Hi(h){var v=-1,w=h==null?0:h.length;for(this.clear();++v<w;){var k=h[v];this.set(k[0],k[1])}}function xy(){this.__data__=[],this.size=0}function _y(h){var v=this.__data__,w=or(v,h);if(w<0)return!1;var k=v.length-1;return w==k?v.pop():tr.call(v,w,1),--this.size,!0}function Ey(h){var v=this.__data__,w=or(v,h);return w<0?i:v[w][1]}function Ay(h){return or(this.__data__,h)>-1}function Cy(h,v){var w=this.__data__,k=or(w,h);return k<0?(++this.size,w.push([h,v])):w[k][1]=v,this}Hi.prototype.clear=xy,Hi.prototype.delete=_y,Hi.prototype.get=Ey,Hi.prototype.has=Ay,Hi.prototype.set=Cy;function Ui(h){var v=-1,w=h==null?0:h.length;for(this.clear();++v<w;){var k=h[v];this.set(k[0],k[1])}}function ky(){this.size=0,this.__data__={hash:new Ra,map:new(Ks||Hi),string:new Ra}}function Fy(h){var v=wr(this,h).delete(h);return this.size-=v?1:0,v}function Py(h){return wr(this,h).get(h)}function Ry(h){return wr(this,h).has(h)}function Sy(h,v){var w=wr(this,h),k=w.size;return w.set(h,v),this.size+=w.size==k?0:1,this}Ui.prototype.clear=ky,Ui.prototype.delete=Fy,Ui.prototype.get=Py,Ui.prototype.has=Ry,Ui.prototype.set=Sy;function Sa(h){var v=-1,w=h==null?0:h.length;for(this.__data__=new Ui;++v<w;)this.add(h[v])}function Ty(h){return this.__data__.set(h,u),this}function By(h){return this.__data__.has(h)}Sa.prototype.add=Sa.prototype.push=Ty,Sa.prototype.has=By;function wi(h){var v=this.__data__=new Hi(h);this.size=v.size}function Iy(){this.__data__=new Hi,this.size=0}function Dy(h){var v=this.__data__,w=v.delete(h);return this.size=v.size,w}function My(h){return this.__data__.get(h)}function Ly(h){return this.__data__.has(h)}function Oy(h,v){var w=this.__data__;if(w instanceof Hi){var k=w.__data__;if(!Ks||k.length<s-1)return k.push([h,v]),this.size=++w.size,this;w=this.__data__=new Ui(k)}return w.set(h,v),this.size=w.size,this}wi.prototype.clear=Iy,wi.prototype.delete=Dy,wi.prototype.get=My,wi.prototype.has=Ly,wi.prototype.set=Oy;function ch(h,v){var w=Bt(h),k=!w&&Ma(h),M=!w&&!k&&va(h),z=!w&&!k&&!M&&ps(h),Y=w||k||M||z,Q=Y?Jo(h.length,Ym):[],nt=Q.length;for(var dt in h)(v||Kt.call(h,dt))&&!(Y&&(dt=="length"||M&&(dt=="offset"||dt=="parent")||z&&(dt=="buffer"||dt=="byteLength"||dt=="byteOffset")||ji(dt,nt)))&&Q.push(dt);return Q}function uh(h){var v=h.length;return v?h[vl(0,v-1)]:i}function Ny(h,v){return br(He(h),Ta(v,0,h.length))}function zy(h){return br(He(h))}function nl(h,v,w){(w!==i&&!xi(h[v],w)||w===i&&!(v in h))&&ki(h,v,w)}function Js(h,v,w){var k=h[v];(!(Kt.call(h,v)&&xi(k,w))||w===i&&!(v in h))&&ki(h,v,w)}function or(h,v){for(var w=h.length;w--;)if(xi(h[w][0],v))return w;return-1}function Wy(h,v,w,k){return ha(h,function(M,z,Y){v(k,M,w(M),Y)}),k}function hh(h,v){return h&&Pi(v,be(v),h)}function Hy(h,v){return h&&Pi(v,Ve(v),h)}function ki(h,v,w){v=="__proto__"&&er?er(h,v,{configurable:!0,enumerable:!0,value:w,writable:!0}):h[v]=w}function rl(h,v){for(var w=-1,k=v.length,M=ct(k),z=h==null;++w<k;)M[w]=z?i:Hl(h,v[w]);return M}function Ta(h,v,w){return h===h&&(w!==i&&(h=h<=w?h:w),v!==i&&(h=h>=v?h:v)),h}function ci(h,v,w,k,M,z){var Y,Q=v&f,nt=v&g,dt=v&m;if(w&&(Y=M?w(h,k,M,z):w(h)),Y!==i)return Y;if(!le(h))return h;var gt=Bt(h);if(gt){if(Y=Rp(h),!Q)return He(h,Y)}else{var vt=Se(h),pt=vt==X||vt==J;if(va(h))return Mh(h,Q);if(vt==Et||vt==ht||pt&&!M){if(Y=nt||pt?{}:tf(h),!Q)return nt?pp(h,Hy(Y,h)):yp(h,hh(Y,h))}else{if(!ee[vt])return M?h:{};Y=Sp(h,vt,Q)}}z||(z=new wi);var At=z.get(h);if(At)return At;z.set(h,Y),Sf(h)?h.forEach(function(Ct){Y.add(ci(Ct,v,w,Ct,h,z))}):Pf(h)&&h.forEach(function(Ct,Ot){Y.set(Ot,ci(Ct,v,w,Ot,h,z))});var Pt=dt?nt?kl:Cl:nt?Ve:be,Mt=gt?i:Pt(h);return Je(Mt||h,function(Ct,Ot){Mt&&(Ot=Ct,Ct=h[Ot]),Js(Y,Ot,ci(Ct,v,w,Ot,h,z))}),Y}function Uy(h){var v=be(h);return function(w){return fh(w,h,v)}}function fh(h,v,w){var k=w.length;if(h==null)return!k;for(h=Jt(h);k--;){var M=w[k],z=v[M],Y=h[M];if(Y===i&&!(M in h)||!z(Y))return!1}return!0}function dh(h,v,w){if(typeof h!="function")throw new oi(r);return rn(function(){h.apply(i,w)},v)}function Qs(h,v,w,k){var M=-1,z=$n,Y=!0,Q=h.length,nt=[],dt=v.length;if(!Q)return nt;w&&(v=se(v,Qe(w))),k?(z=qo,Y=!1):v.length>=s&&(z=qs,Y=!1,v=new Sa(v));t:for(;++M<Q;){var gt=h[M],vt=w==null?gt:w(gt);if(gt=k||gt!==0?gt:0,Y&&vt===vt){for(var pt=dt;pt--;)if(v[pt]===vt)continue t;nt.push(gt)}else z(v,vt,k)||nt.push(gt)}return nt}var ha=Wh(Fi),gh=Wh(ll,!0);function Vy(h,v){var w=!0;return ha(h,function(k,M,z){return w=!!v(k,M,z),w}),w}function lr(h,v,w){for(var k=-1,M=h.length;++k<M;){var z=h[k],Y=v(z);if(Y!=null&&(Q===i?Y===Y&&!ei(Y):w(Y,Q)))var Q=Y,nt=z}return nt}function $y(h,v,w,k){var M=h.length;for(w=Dt(w),w<0&&(w=-w>M?0:M+w),k=k===i||k>M?M:Dt(k),k<0&&(k+=M),k=w>k?0:Bf(k);w<k;)h[w++]=v;return h}function vh(h,v){var w=[];return ha(h,function(k,M,z){v(k,M,z)&&w.push(k)}),w}function Ee(h,v,w,k,M){var z=-1,Y=h.length;for(w||(w=Bp),M||(M=[]);++z<Y;){var Q=h[z];v>0&&w(Q)?v>1?Ee(Q,v-1,w,k,M):la(M,Q):k||(M[M.length]=Q)}return M}var ol=Hh(),mh=Hh(!0);function Fi(h,v){return h&&ol(h,v,be)}function ll(h,v){return h&&mh(h,v,be)}function cr(h,v){return oa(v,function(w){return qi(h[w])})}function Ba(h,v){v=da(v,h);for(var w=0,k=v.length;h!=null&&w<k;)h=h[bi(v[w++])];return w&&w==k?h:i}function yh(h,v,w){var k=v(h);return Bt(h)?k:la(k,w(h))}function Ie(h){return h==null?h===i?ss:mt:Pa&&Pa in Jt(h)?kp(h):zp(h)}function cl(h,v){return h>v}function jy(h,v){return h!=null&&Kt.call(h,v)}function qy(h,v){return h!=null&&v in Jt(h)}function Yy(h,v,w){return h>=Re(v,w)&&h<ye(v,w)}function ul(h,v,w){for(var k=w?qo:$n,M=h[0].length,z=h.length,Y=z,Q=ct(z),nt=1/0,dt=[];Y--;){var gt=h[Y];Y&&v&&(gt=se(gt,Qe(v))),nt=Re(gt.length,nt),Q[Y]=!w&&(v||M>=120&&gt.length>=120)?new Sa(Y&&gt):i}gt=h[0];var vt=-1,pt=Q[0];t:for(;++vt<M&&dt.length<nt;){var At=gt[vt],Pt=v?v(At):At;if(At=w||At!==0?At:0,!(pt?qs(pt,Pt):k(dt,Pt,w))){for(Y=z;--Y;){var Mt=Q[Y];if(!(Mt?qs(Mt,Pt):k(h[Y],Pt,w)))continue t}pt&&pt.push(Pt),dt.push(At)}}return dt}function Ky(h,v,w,k){return Fi(h,function(M,z,Y){v(k,w(M),z,Y)}),k}function tn(h,v,w){v=da(v,h),h=nf(h,v);var k=h==null?h:h[bi(hi(v))];return k==null?i:Ze(k,h,w)}function ph(h){return ue(h)&&Ie(h)==ht}function Xy(h){return ue(h)&&Ie(h)==js}function Gy(h){return ue(h)&&Ie(h)==A}function en(h,v,w,k,M){return h===v?!0:h==null||v==null||!ue(h)&&!ue(v)?h!==h&&v!==v:Zy(h,v,w,k,en,M)}function Zy(h,v,w,k,M,z){var Y=Bt(h),Q=Bt(v),nt=Y?lt:Se(h),dt=Q?lt:Se(v);nt=nt==ht?Et:nt,dt=dt==ht?Et:dt;var gt=nt==Et,vt=dt==Et,pt=nt==dt;if(pt&&va(h)){if(!va(v))return!1;Y=!0,gt=!1}if(pt&&!gt)return z||(z=new wi),Y||ps(h)?Zh(h,v,w,k,M,z):Ap(h,v,nt,w,k,M,z);if(!(w&y)){var At=gt&&Kt.call(h,"__wrapped__"),Pt=vt&&Kt.call(v,"__wrapped__");if(At||Pt){var Mt=At?h.value():h,Ct=Pt?v.value():v;return z||(z=new wi),M(Mt,Ct,w,k,z)}}return pt?(z||(z=new wi),Cp(h,v,w,k,M,z)):!1}function Jy(h){return ue(h)&&Se(h)==rt}function hl(h,v,w,k){var M=w.length,z=M,Y=!k;if(h==null)return!z;for(h=Jt(h);M--;){var Q=w[M];if(Y&&Q[2]?Q[1]!==h[Q[0]]:!(Q[0]in h))return!1}for(;++M<z;){Q=w[M];var nt=Q[0],dt=h[nt],gt=Q[1];if(Y&&Q[2]){if(dt===i&&!(nt in h))return!1}else{var vt=new wi;if(k)var pt=k(dt,gt,nt,h,v,vt);if(!(pt===i?en(gt,dt,y|p,k,vt):pt))return!1}}return!0}function wh(h){if(!le(h)||Dp(h))return!1;var v=qi(h)?Jm:Uv;return v.test(Da(h))}function Qy(h){return ue(h)&&Ie(h)==we}function tp(h){return ue(h)&&Se(h)==oe}function ep(h){return ue(h)&&kr(h.length)&&!!ae[Ie(h)]}function bh(h){return typeof h=="function"?h:h==null?$e:typeof h=="object"?Bt(h)?Eh(h[0],h[1]):_h(h):$f(h)}function fl(h){if(!nn(h))return sy(h);var v=[];for(var w in Jt(h))Kt.call(h,w)&&w!="constructor"&&v.push(w);return v}function ip(h){if(!le(h))return Np(h);var v=nn(h),w=[];for(var k in h)k=="constructor"&&(v||!Kt.call(h,k))||w.push(k);return w}function dl(h,v){return h<v}function xh(h,v){var w=-1,k=Ue(h)?ct(h.length):[];return ha(h,function(M,z,Y){k[++w]=v(M,z,Y)}),k}function _h(h){var v=Pl(h);return v.length==1&&v[0][2]?af(v[0][0],v[0][1]):function(w){return w===h||hl(w,h,v)}}function Eh(h,v){return Sl(h)&&ef(v)?af(bi(h),v):function(w){var k=Hl(w,h);return k===i&&k===v?Ul(w,h):en(v,k,y|p)}}function ur(h,v,w,k,M){h!==v&&ol(v,function(z,Y){if(M||(M=new wi),le(z))ap(h,v,Y,w,ur,k,M);else{var Q=k?k(Bl(h,Y),z,Y+"",h,v,M):i;Q===i&&(Q=z),nl(h,Y,Q)}},Ve)}function ap(h,v,w,k,M,z,Y){var Q=Bl(h,w),nt=Bl(v,w),dt=Y.get(nt);if(dt){nl(h,w,dt);return}var gt=z?z(Q,nt,w+"",h,v,Y):i,vt=gt===i;if(vt){var pt=Bt(nt),At=!pt&&va(nt),Pt=!pt&&!At&&ps(nt);gt=nt,pt||At||Pt?Bt(Q)?gt=Q:fe(Q)?gt=He(Q):At?(vt=!1,gt=Mh(nt,!0)):Pt?(vt=!1,gt=Lh(nt,!0)):gt=[]:on(nt)||Ma(nt)?(gt=Q,Ma(Q)?gt=If(Q):(!le(Q)||qi(Q))&&(gt=tf(nt))):vt=!1}vt&&(Y.set(nt,gt),M(gt,nt,k,z,Y),Y.delete(nt)),nl(h,w,gt)}function Ah(h,v){var w=h.length;if(!!w)return v+=v<0?w:0,ji(v,w)?h[v]:i}function Ch(h,v,w){v.length?v=se(v,function(z){return Bt(z)?function(Y){return Ba(Y,z.length===1?z[0]:z)}:z}):v=[$e];var k=-1;v=se(v,Qe(kt()));var M=xh(h,function(z,Y,Q){var nt=se(v,function(dt){return dt(z)});return{criteria:nt,index:++k,value:z}});return Sm(M,function(z,Y){return mp(z,Y,w)})}function sp(h,v){return kh(h,v,function(w,k){return Ul(h,k)})}function kh(h,v,w){for(var k=-1,M=v.length,z={};++k<M;){var Y=v[k],Q=Ba(h,Y);w(Q,Y)&&an(z,da(Y,h),Q)}return z}function np(h){return function(v){return Ba(v,h)}}function gl(h,v,w,k){var M=k?Rm:os,z=-1,Y=v.length,Q=h;for(h===v&&(v=He(v)),w&&(Q=se(h,Qe(w)));++z<Y;)for(var nt=0,dt=v[z],gt=w?w(dt):dt;(nt=M(Q,gt,nt,k))>-1;)Q!==h&&tr.call(Q,nt,1),tr.call(h,nt,1);return h}function Fh(h,v){for(var w=h?v.length:0,k=w-1;w--;){var M=v[w];if(w==k||M!==z){var z=M;ji(M)?tr.call(h,M,1):pl(h,M)}}return h}function vl(h,v){return h+ar(oh()*(v-h+1))}function rp(h,v,w,k){for(var M=-1,z=ye(ir((v-h)/(w||1)),0),Y=ct(z);z--;)Y[k?z:++M]=h,h+=w;return Y}function ml(h,v){var w="";if(!h||v<1||v>W)return w;do v%2&&(w+=h),v=ar(v/2),v&&(h+=h);while(v);return w}function Lt(h,v){return Il(sf(h,v,$e),h+"")}function op(h){return uh(ws(h))}function lp(h,v){var w=ws(h);return br(w,Ta(v,0,w.length))}function an(h,v,w,k){if(!le(h))return h;v=da(v,h);for(var M=-1,z=v.length,Y=z-1,Q=h;Q!=null&&++M<z;){var nt=bi(v[M]),dt=w;if(nt==="__proto__"||nt==="constructor"||nt==="prototype")return h;if(M!=Y){var gt=Q[nt];dt=k?k(gt,nt,Q):i,dt===i&&(dt=le(gt)?gt:ji(v[M+1])?[]:{})}Js(Q,nt,dt),Q=Q[nt]}return h}var Ph=sr?function(h,v){return sr.set(h,v),h}:$e,cp=er?function(h,v){return er(h,"toString",{configurable:!0,enumerable:!1,value:$l(v),writable:!0})}:$e;function up(h){return br(ws(h))}function ui(h,v,w){var k=-1,M=h.length;v<0&&(v=-v>M?0:M+v),w=w>M?M:w,w<0&&(w+=M),M=v>w?0:w-v>>>0,v>>>=0;for(var z=ct(M);++k<M;)z[k]=h[k+v];return z}function hp(h,v){var w;return ha(h,function(k,M,z){return w=v(k,M,z),!w}),!!w}function hr(h,v,w){var k=0,M=h==null?k:h.length;if(typeof v=="number"&&v===v&&M<=st){for(;k<M;){var z=k+M>>>1,Y=h[z];Y!==null&&!ei(Y)&&(w?Y<=v:Y<v)?k=z+1:M=z}return M}return yl(h,v,$e,w)}function yl(h,v,w,k){var M=0,z=h==null?0:h.length;if(z===0)return 0;v=w(v);for(var Y=v!==v,Q=v===null,nt=ei(v),dt=v===i;M<z;){var gt=ar((M+z)/2),vt=w(h[gt]),pt=vt!==i,At=vt===null,Pt=vt===vt,Mt=ei(vt);if(Y)var Ct=k||Pt;else dt?Ct=Pt&&(k||pt):Q?Ct=Pt&&pt&&(k||!At):nt?Ct=Pt&&pt&&!At&&(k||!Mt):At||Mt?Ct=!1:Ct=k?vt<=v:vt<v;Ct?M=gt+1:z=gt}return Re(z,tt)}function Rh(h,v){for(var w=-1,k=h.length,M=0,z=[];++w<k;){var Y=h[w],Q=v?v(Y):Y;if(!w||!xi(Q,nt)){var nt=Q;z[M++]=Y===0?0:Y}}return z}function Sh(h){return typeof h=="number"?h:ei(h)?K:+h}function ti(h){if(typeof h=="string")return h;if(Bt(h))return se(h,ti)+"";if(ei(h))return lh?lh.call(h):"";var v=h+"";return v=="0"&&1/h==-q?"-0":v}function fa(h,v,w){var k=-1,M=$n,z=h.length,Y=!0,Q=[],nt=Q;if(w)Y=!1,M=qo;else if(z>=s){var dt=v?null:_p(h);if(dt)return qn(dt);Y=!1,M=qs,nt=new Sa}else nt=v?[]:Q;t:for(;++k<z;){var gt=h[k],vt=v?v(gt):gt;if(gt=w||gt!==0?gt:0,Y&&vt===vt){for(var pt=nt.length;pt--;)if(nt[pt]===vt)continue t;v&&nt.push(vt),Q.push(gt)}else M(nt,vt,w)||(nt!==Q&&nt.push(vt),Q.push(gt))}return Q}function pl(h,v){v=da(v,h);var w=-1,k=v.length;if(!k)return!0;for(;++w<k;){var M=bi(v[w]);if(M==="__proto__"&&!Kt.call(h,"__proto__")||(M==="constructor"||M==="prototype")&&w<k-1)return!1}var z=nf(h,v);return z==null||delete z[bi(hi(v))]}function Th(h,v,w,k){return an(h,v,w(Ba(h,v)),k)}function fr(h,v,w,k){for(var M=h.length,z=k?M:-1;(k?z--:++z<M)&&v(h[z],z,h););return w?ui(h,k?0:z,k?z+1:M):ui(h,k?z+1:0,k?M:z)}function Bh(h,v){var w=h;return w instanceof Nt&&(w=w.value()),Yo(v,function(k,M){return M.func.apply(M.thisArg,la([k],M.args))},w)}function wl(h,v,w){var k=h.length;if(k<2)return k?fa(h[0]):[];for(var M=-1,z=ct(k);++M<k;)for(var Y=h[M],Q=-1;++Q<k;)Q!=M&&(z[M]=Qs(z[M]||Y,h[Q],v,w));return fa(Ee(z,1),v,w)}function Ih(h,v,w){for(var k=-1,M=h.length,z=v.length,Y={};++k<M;){var Q=k<z?v[k]:i;w(Y,h[k],Q)}return Y}function bl(h){return fe(h)?h:[]}function xl(h){return typeof h=="function"?h:$e}function da(h,v){return Bt(h)?h:Sl(h,v)?[h]:cf(Xt(h))}var fp=Lt;function ga(h,v,w){var k=h.length;return w=w===i?k:w,!v&&w>=k?h:ui(h,v,w)}var Dh=Qm||function(h){return _e.clearTimeout(h)};function Mh(h,v){if(v)return h.slice();var w=h.length,k=ih?ih(w):new h.constructor(w);return h.copy(k),k}function _l(h){var v=new h.constructor(h.byteLength);return new Jn(v).set(new Jn(h)),v}function dp(h,v){var w=v?_l(h.buffer):h.buffer;return new h.constructor(w,h.byteOffset,h.byteLength)}function gp(h){var v=new h.constructor(h.source,pu.exec(h));return v.lastIndex=h.lastIndex,v}function vp(h){return Zs?Jt(Zs.call(h)):{}}function Lh(h,v){var w=v?_l(h.buffer):h.buffer;return new h.constructor(w,h.byteOffset,h.length)}function Oh(h,v){if(h!==v){var w=h!==i,k=h===null,M=h===h,z=ei(h),Y=v!==i,Q=v===null,nt=v===v,dt=ei(v);if(!Q&&!dt&&!z&&h>v||z&&Y&&nt&&!Q&&!dt||k&&Y&&nt||!w&&nt||!M)return 1;if(!k&&!z&&!dt&&h<v||dt&&w&&M&&!k&&!z||Q&&w&&M||!Y&&M||!nt)return-1}return 0}function mp(h,v,w){for(var k=-1,M=h.criteria,z=v.criteria,Y=M.length,Q=w.length;++k<Y;){var nt=Oh(M[k],z[k]);if(nt){if(k>=Q)return nt;var dt=w[k];return nt*(dt=="desc"?-1:1)}}return h.index-v.index}function Nh(h,v,w,k){for(var M=-1,z=h.length,Y=w.length,Q=-1,nt=v.length,dt=ye(z-Y,0),gt=ct(nt+dt),vt=!k;++Q<nt;)gt[Q]=v[Q];for(;++M<Y;)(vt||M<z)&&(gt[w[M]]=h[M]);for(;dt--;)gt[Q++]=h[M++];return gt}function zh(h,v,w,k){for(var M=-1,z=h.length,Y=-1,Q=w.length,nt=-1,dt=v.length,gt=ye(z-Q,0),vt=ct(gt+dt),pt=!k;++M<gt;)vt[M]=h[M];for(var At=M;++nt<dt;)vt[At+nt]=v[nt];for(;++Y<Q;)(pt||M<z)&&(vt[At+w[Y]]=h[M++]);return vt}function He(h,v){var w=-1,k=h.length;for(v||(v=ct(k));++w<k;)v[w]=h[w];return v}function Pi(h,v,w,k){var M=!w;w||(w={});for(var z=-1,Y=v.length;++z<Y;){var Q=v[z],nt=k?k(w[Q],h[Q],Q,w,h):i;nt===i&&(nt=h[Q]),M?ki(w,Q,nt):Js(w,Q,nt)}return w}function yp(h,v){return Pi(h,Rl(h),v)}function pp(h,v){return Pi(h,Jh(h),v)}function dr(h,v){return function(w,k){var M=Bt(w)?Em:Wy,z=v?v():{};return M(w,h,kt(k,2),z)}}function vs(h){return Lt(function(v,w){var k=-1,M=w.length,z=M>1?w[M-1]:i,Y=M>2?w[2]:i;for(z=h.length>3&&typeof z=="function"?(M--,z):i,Y&&De(w[0],w[1],Y)&&(z=M<3?i:z,M=1),v=Jt(v);++k<M;){var Q=w[k];Q&&h(v,Q,k,z)}return v})}function Wh(h,v){return function(w,k){if(w==null)return w;if(!Ue(w))return h(w,k);for(var M=w.length,z=v?M:-1,Y=Jt(w);(v?z--:++z<M)&&k(Y[z],z,Y)!==!1;);return w}}function Hh(h){return function(v,w,k){for(var M=-1,z=Jt(v),Y=k(v),Q=Y.length;Q--;){var nt=Y[h?Q:++M];if(w(z[nt],nt,z)===!1)break}return v}}function wp(h,v,w){var k=v&x,M=sn(h);function z(){var Y=this&&this!==_e&&this instanceof z?M:h;return Y.apply(k?w:this,arguments)}return z}function Uh(h){return function(v){v=Xt(v);var w=ls(v)?pi(v):i,k=w?w[0]:v.charAt(0),M=w?ga(w,1).join(""):v.slice(1);return k[h]()+M}}function ms(h){return function(v){return Yo(Uf(Hf(v).replace(cm,"")),h,"")}}function sn(h){return function(){var v=arguments;switch(v.length){case 0:return new h;case 1:return new h(v[0]);case 2:return new h(v[0],v[1]);case 3:return new h(v[0],v[1],v[2]);case 4:return new h(v[0],v[1],v[2],v[3]);case 5:return new h(v[0],v[1],v[2],v[3],v[4]);case 6:return new h(v[0],v[1],v[2],v[3],v[4],v[5]);case 7:return new h(v[0],v[1],v[2],v[3],v[4],v[5],v[6])}var w=gs(h.prototype),k=h.apply(w,v);return le(k)?k:w}}function bp(h,v,w){var k=sn(h);function M(){for(var z=arguments.length,Y=ct(z),Q=z,nt=ys(M);Q--;)Y[Q]=arguments[Q];var dt=z<3&&Y[0]!==nt&&Y[z-1]!==nt?[]:ca(Y,nt);if(z-=dt.length,z<w)return Yh(h,v,gr,M.placeholder,i,Y,dt,i,i,w-z);var gt=this&&this!==_e&&this instanceof M?k:h;return Ze(gt,this,Y)}return M}function Vh(h){return function(v,w,k){var M=Jt(v);if(!Ue(v)){var z=kt(w,3);v=be(v),w=function(Q){return z(M[Q],Q,M)}}var Y=h(v,w,k);return Y>-1?M[z?v[Y]:Y]:i}}function $h(h){return $i(function(v){var w=v.length,k=w,M=li.prototype.thru;for(h&&v.reverse();k--;){var z=v[k];if(typeof z!="function")throw new oi(r);if(M&&!Y&&pr(z)=="wrapper")var Y=new li([],!0)}for(k=Y?k:w;++k<w;){z=v[k];var Q=pr(z),nt=Q=="wrapper"?Fl(z):i;nt&&Tl(nt[0])&&nt[1]==(D|C|S|V)&&!nt[4].length&&nt[9]==1?Y=Y[pr(nt[0])].apply(Y,nt[3]):Y=z.length==1&&Tl(z)?Y[Q]():Y.thru(z)}return function(){var dt=arguments,gt=dt[0];if(Y&&dt.length==1&&Bt(gt))return Y.plant(gt).value();for(var vt=0,pt=w?v[vt].apply(this,dt):gt;++vt<w;)pt=v[vt].call(this,pt);return pt}})}function gr(h,v,w,k,M,z,Y,Q,nt,dt){var gt=v&D,vt=v&x,pt=v&_,At=v&(C|P),Pt=v&G,Mt=pt?i:sn(h);function Ct(){for(var Ot=arguments.length,Wt=ct(Ot),ii=Ot;ii--;)Wt[ii]=arguments[ii];if(At)var Me=ys(Ct),ai=Bm(Wt,Me);if(k&&(Wt=Nh(Wt,k,M,At)),z&&(Wt=zh(Wt,z,Y,At)),Ot-=ai,At&&Ot<dt){var de=ca(Wt,Me);return Yh(h,v,gr,Ct.placeholder,w,Wt,de,Q,nt,dt-Ot)}var _i=vt?w:this,Ki=pt?_i[h]:h;return Ot=Wt.length,Q?Wt=Wp(Wt,Q):Pt&&Ot>1&&Wt.reverse(),gt&&nt<Ot&&(Wt.length=nt),this&&this!==_e&&this instanceof Ct&&(Ki=Mt||sn(Ki)),Ki.apply(_i,Wt)}return Ct}function jh(h,v){return function(w,k){return Ky(w,h,v(k),{})}}function vr(h,v){return function(w,k){var M;if(w===i&&k===i)return v;if(w!==i&&(M=w),k!==i){if(M===i)return k;typeof w=="string"||typeof k=="string"?(w=ti(w),k=ti(k)):(w=Sh(w),k=Sh(k)),M=h(w,k)}return M}}function El(h){return $i(function(v){return v=se(v,Qe(kt())),Lt(function(w){var k=this;return h(v,function(M){return Ze(M,k,w)})})})}function mr(h,v){v=v===i?" ":ti(v);var w=v.length;if(w<2)return w?ml(v,h):v;var k=ml(v,ir(h/cs(v)));return ls(v)?ga(pi(k),0,h).join(""):k.slice(0,h)}function xp(h,v,w,k){var M=v&x,z=sn(h);function Y(){for(var Q=-1,nt=arguments.length,dt=-1,gt=k.length,vt=ct(gt+nt),pt=this&&this!==_e&&this instanceof Y?z:h;++dt<gt;)vt[dt]=k[dt];for(;nt--;)vt[dt++]=arguments[++Q];return Ze(pt,M?w:this,vt)}return Y}function qh(h){return function(v,w,k){return k&&typeof k!="number"&&De(v,w,k)&&(w=k=i),v=Yi(v),w===i?(w=v,v=0):w=Yi(w),k=k===i?v<w?1:-1:Yi(k),rp(v,w,k,h)}}function yr(h){return function(v,w){return typeof v=="string"&&typeof w=="string"||(v=fi(v),w=fi(w)),h(v,w)}}function Yh(h,v,w,k,M,z,Y,Q,nt,dt){var gt=v&C,vt=gt?Y:i,pt=gt?i:Y,At=gt?z:i,Pt=gt?i:z;v|=gt?S:B,v&=~(gt?B:S),v&b||(v&=~(x|_));var Mt=[h,v,M,At,vt,Pt,pt,Q,nt,dt],Ct=w.apply(i,Mt);return Tl(h)&&rf(Ct,Mt),Ct.placeholder=k,of(Ct,h,v)}function Al(h){var v=me[h];return function(w,k){if(w=fi(w),k=k==null?0:Re(Dt(k),292),k&&rh(w)){var M=(Xt(w)+"e").split("e"),z=v(M[0]+"e"+(+M[1]+k));return M=(Xt(z)+"e").split("e"),+(M[0]+"e"+(+M[1]-k))}return v(w)}}var _p=fs&&1/qn(new fs([,-0]))[1]==q?function(h){return new fs(h)}:Yl;function Kh(h){return function(v){var w=Se(v);return w==rt?tl(v):w==oe?zm(v):Tm(v,h(v))}}function Vi(h,v,w,k,M,z,Y,Q){var nt=v&_;if(!nt&&typeof h!="function")throw new oi(r);var dt=k?k.length:0;if(dt||(v&=~(S|B),k=M=i),Y=Y===i?Y:ye(Dt(Y),0),Q=Q===i?Q:Dt(Q),dt-=M?M.length:0,v&B){var gt=k,vt=M;k=M=i}var pt=nt?i:Fl(h),At=[h,v,w,k,M,gt,vt,z,Y,Q];if(pt&&Op(At,pt),h=At[0],v=At[1],w=At[2],k=At[3],M=At[4],Q=At[9]=At[9]===i?nt?0:h.length:ye(At[9]-dt,0),!Q&&v&(C|P)&&(v&=~(C|P)),!v||v==x)var Pt=wp(h,v,w);else v==C||v==P?Pt=bp(h,v,Q):(v==S||v==(x|S))&&!M.length?Pt=xp(h,v,w,k):Pt=gr.apply(i,At);var Mt=pt?Ph:rf;return of(Mt(Pt,At),h,v)}function Xh(h,v,w,k){return h===i||xi(h,hs[w])&&!Kt.call(k,w)?v:h}function Gh(h,v,w,k,M,z){return le(h)&&le(v)&&(z.set(v,h),ur(h,v,i,Gh,z),z.delete(v)),h}function Ep(h){return on(h)?i:h}function Zh(h,v,w,k,M,z){var Y=w&y,Q=h.length,nt=v.length;if(Q!=nt&&!(Y&&nt>Q))return!1;var dt=z.get(h),gt=z.get(v);if(dt&&gt)return dt==v&&gt==h;var vt=-1,pt=!0,At=w&p?new Sa:i;for(z.set(h,v),z.set(v,h);++vt<Q;){var Pt=h[vt],Mt=v[vt];if(k)var Ct=Y?k(Mt,Pt,vt,v,h,z):k(Pt,Mt,vt,h,v,z);if(Ct!==i){if(Ct)continue;pt=!1;break}if(At){if(!Ko(v,function(Ot,Wt){if(!qs(At,Wt)&&(Pt===Ot||M(Pt,Ot,w,k,z)))return At.push(Wt)})){pt=!1;break}}else if(!(Pt===Mt||M(Pt,Mt,w,k,z))){pt=!1;break}}return z.delete(h),z.delete(v),pt}function Ap(h,v,w,k,M,z,Y){switch(w){case ns:if(h.byteLength!=v.byteLength||h.byteOffset!=v.byteOffset)return!1;h=h.buffer,v=v.buffer;case js:return!(h.byteLength!=v.byteLength||!z(new Jn(h),new Jn(v)));case E:case A:case yt:return xi(+h,+v);case N:return h.name==v.name&&h.message==v.message;case we:case Vt:return h==v+"";case rt:var Q=tl;case oe:var nt=k&y;if(Q||(Q=qn),h.size!=v.size&&!nt)return!1;var dt=Y.get(h);if(dt)return dt==v;k|=p,Y.set(h,v);var gt=Zh(Q(h),Q(v),k,M,z,Y);return Y.delete(h),gt;case Gt:if(Zs)return Zs.call(h)==Zs.call(v)}return!1}function Cp(h,v,w,k,M,z){var Y=w&y,Q=Cl(h),nt=Q.length,dt=Cl(v),gt=dt.length;if(nt!=gt&&!Y)return!1;for(var vt=nt;vt--;){var pt=Q[vt];if(!(Y?pt in v:Kt.call(v,pt)))return!1}var At=z.get(h),Pt=z.get(v);if(At&&Pt)return At==v&&Pt==h;var Mt=!0;z.set(h,v),z.set(v,h);for(var Ct=Y;++vt<nt;){pt=Q[vt];var Ot=h[pt],Wt=v[pt];if(k)var ii=Y?k(Wt,Ot,pt,v,h,z):k(Ot,Wt,pt,h,v,z);if(!(ii===i?Ot===Wt||M(Ot,Wt,w,k,z):ii)){Mt=!1;break}Ct||(Ct=pt=="constructor")}if(Mt&&!Ct){var Me=h.constructor,ai=v.constructor;Me!=ai&&"constructor"in h&&"constructor"in v&&!(typeof Me=="function"&&Me instanceof Me&&typeof ai=="function"&&ai instanceof ai)&&(Mt=!1)}return z.delete(h),z.delete(v),Mt}function $i(h){return Il(sf(h,i,df),h+"")}function Cl(h){return yh(h,be,Rl)}function kl(h){return yh(h,Ve,Jh)}var Fl=sr?function(h){return sr.get(h)}:Yl;function pr(h){for(var v=h.name+"",w=ds[v],k=Kt.call(ds,v)?w.length:0;k--;){var M=w[k],z=M.func;if(z==null||z==h)return M.name}return v}function ys(h){var v=Kt.call(O,"placeholder")?O:h;return v.placeholder}function kt(){var h=O.iteratee||jl;return h=h===jl?bh:h,arguments.length?h(arguments[0],arguments[1]):h}function wr(h,v){var w=h.__data__;return Ip(v)?w[typeof v=="string"?"string":"hash"]:w.map}function Pl(h){for(var v=be(h),w=v.length;w--;){var k=v[w],M=h[k];v[w]=[k,M,ef(M)]}return v}function Ia(h,v){var w=Lm(h,v);return wh(w)?w:i}function kp(h){var v=Kt.call(h,Pa),w=h[Pa];try{h[Pa]=i;var k=!0}catch{}var M=Gn.call(h);return k&&(v?h[Pa]=w:delete h[Pa]),M}var Rl=il?function(h){return h==null?[]:(h=Jt(h),oa(il(h),function(v){return sh.call(h,v)}))}:Kl,Jh=il?function(h){for(var v=[];h;)la(v,Rl(h)),h=Qn(h);return v}:Kl,Se=Ie;(al&&Se(new al(new ArrayBuffer(1)))!=ns||Ks&&Se(new Ks)!=rt||sl&&Se(sl.resolve())!=Ft||fs&&Se(new fs)!=oe||Xs&&Se(new Xs)!=$s)&&(Se=function(h){var v=Ie(h),w=v==Et?h.constructor:i,k=w?Da(w):"";if(k)switch(k){case ly:return ns;case cy:return rt;case uy:return Ft;case hy:return oe;case fy:return $s}return v});function Fp(h,v,w){for(var k=-1,M=w.length;++k<M;){var z=w[k],Y=z.size;switch(z.type){case"drop":h+=Y;break;case"dropRight":v-=Y;break;case"take":v=Re(v,h+Y);break;case"takeRight":h=ye(h,v-Y);break}}return{start:h,end:v}}function Pp(h){var v=h.match(Mv);return v?v[1].split(Lv):[]}function Qh(h,v,w){v=da(v,h);for(var k=-1,M=v.length,z=!1;++k<M;){var Y=bi(v[k]);if(!(z=h!=null&&w(h,Y)))break;h=h[Y]}return z||++k!=M?z:(M=h==null?0:h.length,!!M&&kr(M)&&ji(Y,M)&&(Bt(h)||Ma(h)))}function Rp(h){var v=h.length,w=new h.constructor(v);return v&&typeof h[0]=="string"&&Kt.call(h,"index")&&(w.index=h.index,w.input=h.input),w}function tf(h){return typeof h.constructor=="function"&&!nn(h)?gs(Qn(h)):{}}function Sp(h,v,w){var k=h.constructor;switch(v){case js:return _l(h);case E:case A:return new k(+h);case ns:return dp(h,w);case Po:case Ro:case So:case To:case Bo:case Io:case Do:case Mo:case Lo:return Lh(h,w);case rt:return new k;case yt:case Vt:return new k(h);case we:return gp(h);case oe:return new k;case Gt:return vp(h)}}function Tp(h,v){var w=v.length;if(!w)return h;var k=w-1;return v[k]=(w>1?"& ":"")+v[k],v=v.join(w>2?", ":" "),h.replace(Dv,`{
  108. /* [wrapped with `+v+`] */
  109. `)}function Bp(h){return Bt(h)||Ma(h)||!!(nh&&h&&h[nh])}function ji(h,v){var w=typeof h;return v=v==null?W:v,!!v&&(w=="number"||w!="symbol"&&$v.test(h))&&h>-1&&h%1==0&&h<v}function De(h,v,w){if(!le(w))return!1;var k=typeof v;return(k=="number"?Ue(w)&&ji(v,w.length):k=="string"&&v in w)?xi(w[v],h):!1}function Sl(h,v){if(Bt(h))return!1;var w=typeof h;return w=="number"||w=="symbol"||w=="boolean"||h==null||ei(h)?!0:Sv.test(h)||!Rv.test(h)||v!=null&&h in Jt(v)}function Ip(h){var v=typeof h;return v=="string"||v=="number"||v=="symbol"||v=="boolean"?h!=="__proto__":h===null}function Tl(h){var v=pr(h),w=O[v];if(typeof w!="function"||!(v in Nt.prototype))return!1;if(h===w)return!0;var k=Fl(w);return!!k&&h===k[0]}function Dp(h){return!!eh&&eh in h}var Mp=Kn?qi:Xl;function nn(h){var v=h&&h.constructor,w=typeof v=="function"&&v.prototype||hs;return h===w}function ef(h){return h===h&&!le(h)}function af(h,v){return function(w){return w==null?!1:w[h]===v&&(v!==i||h in Jt(w))}}function Lp(h){var v=Ar(h,function(k){return w.size===c&&w.clear(),k}),w=v.cache;return v}function Op(h,v){var w=h[1],k=v[1],M=w|k,z=M<(x|_|D),Y=k==D&&w==C||k==D&&w==V&&h[7].length<=v[8]||k==(D|V)&&v[7].length<=v[8]&&w==C;if(!(z||Y))return h;k&x&&(h[2]=v[2],M|=w&x?0:b);var Q=v[3];if(Q){var nt=h[3];h[3]=nt?Nh(nt,Q,v[4]):Q,h[4]=nt?ca(h[3],d):v[4]}return Q=v[5],Q&&(nt=h[5],h[5]=nt?zh(nt,Q,v[6]):Q,h[6]=nt?ca(h[5],d):v[6]),Q=v[7],Q&&(h[7]=Q),k&D&&(h[8]=h[8]==null?v[8]:Re(h[8],v[8])),h[9]==null&&(h[9]=v[9]),h[0]=v[0],h[1]=M,h}function Np(h){var v=[];if(h!=null)for(var w in Jt(h))v.push(w);return v}function zp(h){return Gn.call(h)}function sf(h,v,w){return v=ye(v===i?h.length-1:v,0),function(){for(var k=arguments,M=-1,z=ye(k.length-v,0),Y=ct(z);++M<z;)Y[M]=k[v+M];M=-1;for(var Q=ct(v+1);++M<v;)Q[M]=k[M];return Q[v]=w(Y),Ze(h,this,Q)}}function nf(h,v){return v.length<2?h:Ba(h,ui(v,0,-1))}function Wp(h,v){for(var w=h.length,k=Re(v.length,w),M=He(h);k--;){var z=v[k];h[k]=ji(z,w)?M[z]:i}return h}function Bl(h,v){if(!(v==="constructor"&&typeof h[v]=="function")&&v!="__proto__")return h[v]}var rf=lf(Ph),rn=ey||function(h,v){return _e.setTimeout(h,v)},Il=lf(cp);function of(h,v,w){var k=v+"";return Il(h,Tp(k,Hp(Pp(k),w)))}function lf(h){var v=0,w=0;return function(){var k=ny(),M=L-(k-w);if(w=k,M>0){if(++v>=T)return arguments[0]}else v=0;return h.apply(i,arguments)}}function br(h,v){var w=-1,k=h.length,M=k-1;for(v=v===i?k:v;++w<v;){var z=vl(w,M),Y=h[z];h[z]=h[w],h[w]=Y}return h.length=v,h}var cf=Lp(function(h){var v=[];return h.charCodeAt(0)===46&&v.push(""),h.replace(Tv,function(w,k,M,z){v.push(M?z.replace(Nv,"$1"):k||w)}),v});function bi(h){if(typeof h=="string"||ei(h))return h;var v=h+"";return v=="0"&&1/h==-q?"-0":v}function Da(h){if(h!=null){try{return Xn.call(h)}catch{}try{return h+""}catch{}}return""}function Hp(h,v){return Je(it,function(w){var k="_."+w[0];v&w[1]&&!$n(h,k)&&h.push(k)}),h.sort()}function uf(h){if(h instanceof Nt)return h.clone();var v=new li(h.__wrapped__,h.__chain__);return v.__actions__=He(h.__actions__),v.__index__=h.__index__,v.__values__=h.__values__,v}function Up(h,v,w){(w?De(h,v,w):v===i)?v=1:v=ye(Dt(v),0);var k=h==null?0:h.length;if(!k||v<1)return[];for(var M=0,z=0,Y=ct(ir(k/v));M<k;)Y[z++]=ui(h,M,M+=v);return Y}function Vp(h){for(var v=-1,w=h==null?0:h.length,k=0,M=[];++v<w;){var z=h[v];z&&(M[k++]=z)}return M}function $p(){var h=arguments.length;if(!h)return[];for(var v=ct(h-1),w=arguments[0],k=h;k--;)v[k-1]=arguments[k];return la(Bt(w)?He(w):[w],Ee(v,1))}var jp=Lt(function(h,v){return fe(h)?Qs(h,Ee(v,1,fe,!0)):[]}),qp=Lt(function(h,v){var w=hi(v);return fe(w)&&(w=i),fe(h)?Qs(h,Ee(v,1,fe,!0),kt(w,2)):[]}),Yp=Lt(function(h,v){var w=hi(v);return fe(w)&&(w=i),fe(h)?Qs(h,Ee(v,1,fe,!0),i,w):[]});function Kp(h,v,w){var k=h==null?0:h.length;return k?(v=w||v===i?1:Dt(v),ui(h,v<0?0:v,k)):[]}function Xp(h,v,w){var k=h==null?0:h.length;return k?(v=w||v===i?1:Dt(v),v=k-v,ui(h,0,v<0?0:v)):[]}function Gp(h,v){return h&&h.length?fr(h,kt(v,3),!0,!0):[]}function Zp(h,v){return h&&h.length?fr(h,kt(v,3),!0):[]}function Jp(h,v,w,k){var M=h==null?0:h.length;return M?(w&&typeof w!="number"&&De(h,v,w)&&(w=0,k=M),$y(h,v,w,k)):[]}function hf(h,v,w){var k=h==null?0:h.length;if(!k)return-1;var M=w==null?0:Dt(w);return M<0&&(M=ye(k+M,0)),jn(h,kt(v,3),M)}function ff(h,v,w){var k=h==null?0:h.length;if(!k)return-1;var M=k-1;return w!==i&&(M=Dt(w),M=w<0?ye(k+M,0):Re(M,k-1)),jn(h,kt(v,3),M,!0)}function df(h){var v=h==null?0:h.length;return v?Ee(h,1):[]}function Qp(h){var v=h==null?0:h.length;return v?Ee(h,q):[]}function tw(h,v){var w=h==null?0:h.length;return w?(v=v===i?1:Dt(v),Ee(h,v)):[]}function ew(h){for(var v=-1,w=h==null?0:h.length,k={};++v<w;){var M=h[v];ki(k,M[0],M[1])}return k}function gf(h){return h&&h.length?h[0]:i}function iw(h,v,w){var k=h==null?0:h.length;if(!k)return-1;var M=w==null?0:Dt(w);return M<0&&(M=ye(k+M,0)),os(h,v,M)}function aw(h){var v=h==null?0:h.length;return v?ui(h,0,-1):[]}var sw=Lt(function(h){var v=se(h,bl);return v.length&&v[0]===h[0]?ul(v):[]}),nw=Lt(function(h){var v=hi(h),w=se(h,bl);return v===hi(w)?v=i:w.pop(),w.length&&w[0]===h[0]?ul(w,kt(v,2)):[]}),rw=Lt(function(h){var v=hi(h),w=se(h,bl);return v=typeof v=="function"?v:i,v&&w.pop(),w.length&&w[0]===h[0]?ul(w,i,v):[]});function ow(h,v){return h==null?"":ay.call(h,v)}function hi(h){var v=h==null?0:h.length;return v?h[v-1]:i}function lw(h,v,w){var k=h==null?0:h.length;if(!k)return-1;var M=k;return w!==i&&(M=Dt(w),M=M<0?ye(k+M,0):Re(M,k-1)),v===v?Hm(h,v,M):jn(h,Yu,M,!0)}function cw(h,v){return h&&h.length?Ah(h,Dt(v)):i}var uw=Lt(vf);function vf(h,v){return h&&h.length&&v&&v.length?gl(h,v):h}function hw(h,v,w){return h&&h.length&&v&&v.length?gl(h,v,kt(w,2)):h}function fw(h,v,w){return h&&h.length&&v&&v.length?gl(h,v,i,w):h}var dw=$i(function(h,v){var w=h==null?0:h.length,k=rl(h,v);return Fh(h,se(v,function(M){return ji(M,w)?+M:M}).sort(Oh)),k});function gw(h,v){var w=[];if(!(h&&h.length))return w;var k=-1,M=[],z=h.length;for(v=kt(v,3);++k<z;){var Y=h[k];v(Y,k,h)&&(w.push(Y),M.push(k))}return Fh(h,M),w}function Dl(h){return h==null?h:oy.call(h)}function vw(h,v,w){var k=h==null?0:h.length;return k?(w&&typeof w!="number"&&De(h,v,w)?(v=0,w=k):(v=v==null?0:Dt(v),w=w===i?k:Dt(w)),ui(h,v,w)):[]}function mw(h,v){return hr(h,v)}function yw(h,v,w){return yl(h,v,kt(w,2))}function pw(h,v){var w=h==null?0:h.length;if(w){var k=hr(h,v);if(k<w&&xi(h[k],v))return k}return-1}function ww(h,v){return hr(h,v,!0)}function bw(h,v,w){return yl(h,v,kt(w,2),!0)}function xw(h,v){var w=h==null?0:h.length;if(w){var k=hr(h,v,!0)-1;if(xi(h[k],v))return k}return-1}function _w(h){return h&&h.length?Rh(h):[]}function Ew(h,v){return h&&h.length?Rh(h,kt(v,2)):[]}function Aw(h){var v=h==null?0:h.length;return v?ui(h,1,v):[]}function Cw(h,v,w){return h&&h.length?(v=w||v===i?1:Dt(v),ui(h,0,v<0?0:v)):[]}function kw(h,v,w){var k=h==null?0:h.length;return k?(v=w||v===i?1:Dt(v),v=k-v,ui(h,v<0?0:v,k)):[]}function Fw(h,v){return h&&h.length?fr(h,kt(v,3),!1,!0):[]}function Pw(h,v){return h&&h.length?fr(h,kt(v,3)):[]}var Rw=Lt(function(h){return fa(Ee(h,1,fe,!0))}),Sw=Lt(function(h){var v=hi(h);return fe(v)&&(v=i),fa(Ee(h,1,fe,!0),kt(v,2))}),Tw=Lt(function(h){var v=hi(h);return v=typeof v=="function"?v:i,fa(Ee(h,1,fe,!0),i,v)});function Bw(h){return h&&h.length?fa(h):[]}function Iw(h,v){return h&&h.length?fa(h,kt(v,2)):[]}function Dw(h,v){return v=typeof v=="function"?v:i,h&&h.length?fa(h,i,v):[]}function Ml(h){if(!(h&&h.length))return[];var v=0;return h=oa(h,function(w){if(fe(w))return v=ye(w.length,v),!0}),Jo(v,function(w){return se(h,Xo(w))})}function mf(h,v){if(!(h&&h.length))return[];var w=Ml(h);return v==null?w:se(w,function(k){return Ze(v,i,k)})}var Mw=Lt(function(h,v){return fe(h)?Qs(h,v):[]}),Lw=Lt(function(h){return wl(oa(h,fe))}),Ow=Lt(function(h){var v=hi(h);return fe(v)&&(v=i),wl(oa(h,fe),kt(v,2))}),Nw=Lt(function(h){var v=hi(h);return v=typeof v=="function"?v:i,wl(oa(h,fe),i,v)}),zw=Lt(Ml);function Ww(h,v){return Ih(h||[],v||[],Js)}function Hw(h,v){return Ih(h||[],v||[],an)}var Uw=Lt(function(h){var v=h.length,w=v>1?h[v-1]:i;return w=typeof w=="function"?(h.pop(),w):i,mf(h,w)});function yf(h){var v=O(h);return v.__chain__=!0,v}function Vw(h,v){return v(h),h}function xr(h,v){return v(h)}var $w=$i(function(h){var v=h.length,w=v?h[0]:0,k=this.__wrapped__,M=function(z){return rl(z,h)};return v>1||this.__actions__.length||!(k instanceof Nt)||!ji(w)?this.thru(M):(k=k.slice(w,+w+(v?1:0)),k.__actions__.push({func:xr,args:[M],thisArg:i}),new li(k,this.__chain__).thru(function(z){return v&&!z.length&&z.push(i),z}))});function jw(){return yf(this)}function qw(){return new li(this.value(),this.__chain__)}function Yw(){this.__values__===i&&(this.__values__=Tf(this.value()));var h=this.__index__>=this.__values__.length,v=h?i:this.__values__[this.__index__++];return{done:h,value:v}}function Kw(){return this}function Xw(h){for(var v,w=this;w instanceof rr;){var k=uf(w);k.__index__=0,k.__values__=i,v?M.__wrapped__=k:v=k;var M=k;w=w.__wrapped__}return M.__wrapped__=h,v}function Gw(){var h=this.__wrapped__;if(h instanceof Nt){var v=h;return this.__actions__.length&&(v=new Nt(this)),v=v.reverse(),v.__actions__.push({func:xr,args:[Dl],thisArg:i}),new li(v,this.__chain__)}return this.thru(Dl)}function Zw(){return Bh(this.__wrapped__,this.__actions__)}var Jw=dr(function(h,v,w){Kt.call(h,w)?++h[w]:ki(h,w,1)});function Qw(h,v,w){var k=Bt(h)?ju:Vy;return w&&De(h,v,w)&&(v=i),k(h,kt(v,3))}function t1(h,v){var w=Bt(h)?oa:vh;return w(h,kt(v,3))}var e1=Vh(hf),i1=Vh(ff);function a1(h,v){return Ee(_r(h,v),1)}function s1(h,v){return Ee(_r(h,v),q)}function n1(h,v,w){return w=w===i?1:Dt(w),Ee(_r(h,v),w)}function pf(h,v){var w=Bt(h)?Je:ha;return w(h,kt(v,3))}function wf(h,v){var w=Bt(h)?Am:gh;return w(h,kt(v,3))}var r1=dr(function(h,v,w){Kt.call(h,w)?h[w].push(v):ki(h,w,[v])});function o1(h,v,w,k){h=Ue(h)?h:ws(h),w=w&&!k?Dt(w):0;var M=h.length;return w<0&&(w=ye(M+w,0)),Fr(h)?w<=M&&h.indexOf(v,w)>-1:!!M&&os(h,v,w)>-1}var l1=Lt(function(h,v,w){var k=-1,M=typeof v=="function",z=Ue(h)?ct(h.length):[];return ha(h,function(Y){z[++k]=M?Ze(v,Y,w):tn(Y,v,w)}),z}),c1=dr(function(h,v,w){ki(h,w,v)});function _r(h,v){var w=Bt(h)?se:xh;return w(h,kt(v,3))}function u1(h,v,w,k){return h==null?[]:(Bt(v)||(v=v==null?[]:[v]),w=k?i:w,Bt(w)||(w=w==null?[]:[w]),Ch(h,v,w))}var h1=dr(function(h,v,w){h[w?0:1].push(v)},function(){return[[],[]]});function f1(h,v,w){var k=Bt(h)?Yo:Xu,M=arguments.length<3;return k(h,kt(v,4),w,M,ha)}function d1(h,v,w){var k=Bt(h)?Cm:Xu,M=arguments.length<3;return k(h,kt(v,4),w,M,gh)}function g1(h,v){var w=Bt(h)?oa:vh;return w(h,Cr(kt(v,3)))}function v1(h){var v=Bt(h)?uh:op;return v(h)}function m1(h,v,w){(w?De(h,v,w):v===i)?v=1:v=Dt(v);var k=Bt(h)?Ny:lp;return k(h,v)}function y1(h){var v=Bt(h)?zy:up;return v(h)}function p1(h){if(h==null)return 0;if(Ue(h))return Fr(h)?cs(h):h.length;var v=Se(h);return v==rt||v==oe?h.size:fl(h).length}function w1(h,v,w){var k=Bt(h)?Ko:hp;return w&&De(h,v,w)&&(v=i),k(h,kt(v,3))}var b1=Lt(function(h,v){if(h==null)return[];var w=v.length;return w>1&&De(h,v[0],v[1])?v=[]:w>2&&De(v[0],v[1],v[2])&&(v=[v[0]]),Ch(h,Ee(v,1),[])}),Er=ty||function(){return _e.Date.now()};function x1(h,v){if(typeof v!="function")throw new oi(r);return h=Dt(h),function(){if(--h<1)return v.apply(this,arguments)}}function bf(h,v,w){return v=w?i:v,v=h&&v==null?h.length:v,Vi(h,D,i,i,i,i,v)}function xf(h,v){var w;if(typeof v!="function")throw new oi(r);return h=Dt(h),function(){return--h>0&&(w=v.apply(this,arguments)),h<=1&&(v=i),w}}var Ll=Lt(function(h,v,w){var k=x;if(w.length){var M=ca(w,ys(Ll));k|=S}return Vi(h,k,v,w,M)}),_f=Lt(function(h,v,w){var k=x|_;if(w.length){var M=ca(w,ys(_f));k|=S}return Vi(v,k,h,w,M)});function Ef(h,v,w){v=w?i:v;var k=Vi(h,C,i,i,i,i,i,v);return k.placeholder=Ef.placeholder,k}function Af(h,v,w){v=w?i:v;var k=Vi(h,P,i,i,i,i,i,v);return k.placeholder=Af.placeholder,k}function Cf(h,v,w){var k,M,z,Y,Q,nt,dt=0,gt=!1,vt=!1,pt=!0;if(typeof h!="function")throw new oi(r);v=fi(v)||0,le(w)&&(gt=!!w.leading,vt="maxWait"in w,z=vt?ye(fi(w.maxWait)||0,v):z,pt="trailing"in w?!!w.trailing:pt);function At(de){var _i=k,Ki=M;return k=M=i,dt=de,Y=h.apply(Ki,_i),Y}function Pt(de){return dt=de,Q=rn(Ot,v),gt?At(de):Y}function Mt(de){var _i=de-nt,Ki=de-dt,jf=v-_i;return vt?Re(jf,z-Ki):jf}function Ct(de){var _i=de-nt,Ki=de-dt;return nt===i||_i>=v||_i<0||vt&&Ki>=z}function Ot(){var de=Er();if(Ct(de))return Wt(de);Q=rn(Ot,Mt(de))}function Wt(de){return Q=i,pt&&k?At(de):(k=M=i,Y)}function ii(){Q!==i&&Dh(Q),dt=0,k=nt=M=Q=i}function Me(){return Q===i?Y:Wt(Er())}function ai(){var de=Er(),_i=Ct(de);if(k=arguments,M=this,nt=de,_i){if(Q===i)return Pt(nt);if(vt)return Dh(Q),Q=rn(Ot,v),At(nt)}return Q===i&&(Q=rn(Ot,v)),Y}return ai.cancel=ii,ai.flush=Me,ai}var _1=Lt(function(h,v){return dh(h,1,v)}),E1=Lt(function(h,v,w){return dh(h,fi(v)||0,w)});function A1(h){return Vi(h,G)}function Ar(h,v){if(typeof h!="function"||v!=null&&typeof v!="function")throw new oi(r);var w=function(){var k=arguments,M=v?v.apply(this,k):k[0],z=w.cache;if(z.has(M))return z.get(M);var Y=h.apply(this,k);return w.cache=z.set(M,Y)||z,Y};return w.cache=new(Ar.Cache||Ui),w}Ar.Cache=Ui;function Cr(h){if(typeof h!="function")throw new oi(r);return function(){var v=arguments;switch(v.length){case 0:return!h.call(this);case 1:return!h.call(this,v[0]);case 2:return!h.call(this,v[0],v[1]);case 3:return!h.call(this,v[0],v[1],v[2])}return!h.apply(this,v)}}function C1(h){return xf(2,h)}var k1=fp(function(h,v){v=v.length==1&&Bt(v[0])?se(v[0],Qe(kt())):se(Ee(v,1),Qe(kt()));var w=v.length;return Lt(function(k){for(var M=-1,z=Re(k.length,w);++M<z;)k[M]=v[M].call(this,k[M]);return Ze(h,this,k)})}),Ol=Lt(function(h,v){var w=ca(v,ys(Ol));return Vi(h,S,i,v,w)}),kf=Lt(function(h,v){var w=ca(v,ys(kf));return Vi(h,B,i,v,w)}),F1=$i(function(h,v){return Vi(h,V,i,i,i,v)});function P1(h,v){if(typeof h!="function")throw new oi(r);return v=v===i?v:Dt(v),Lt(h,v)}function R1(h,v){if(typeof h!="function")throw new oi(r);return v=v==null?0:ye(Dt(v),0),Lt(function(w){var k=w[v],M=ga(w,0,v);return k&&la(M,k),Ze(h,this,M)})}function S1(h,v,w){var k=!0,M=!0;if(typeof h!="function")throw new oi(r);return le(w)&&(k="leading"in w?!!w.leading:k,M="trailing"in w?!!w.trailing:M),Cf(h,v,{leading:k,maxWait:v,trailing:M})}function T1(h){return bf(h,1)}function B1(h,v){return Ol(xl(v),h)}function I1(){if(!arguments.length)return[];var h=arguments[0];return Bt(h)?h:[h]}function D1(h){return ci(h,m)}function M1(h,v){return v=typeof v=="function"?v:i,ci(h,m,v)}function L1(h){return ci(h,f|m)}function O1(h,v){return v=typeof v=="function"?v:i,ci(h,f|m,v)}function N1(h,v){return v==null||fh(h,v,be(v))}function xi(h,v){return h===v||h!==h&&v!==v}var z1=yr(cl),W1=yr(function(h,v){return h>=v}),Ma=ph(function(){return arguments}())?ph:function(h){return ue(h)&&Kt.call(h,"callee")&&!sh.call(h,"callee")},Bt=ct.isArray,H1=zu?Qe(zu):Xy;function Ue(h){return h!=null&&kr(h.length)&&!qi(h)}function fe(h){return ue(h)&&Ue(h)}function U1(h){return h===!0||h===!1||ue(h)&&Ie(h)==E}var va=iy||Xl,V1=Wu?Qe(Wu):Gy;function $1(h){return ue(h)&&h.nodeType===1&&!on(h)}function j1(h){if(h==null)return!0;if(Ue(h)&&(Bt(h)||typeof h=="string"||typeof h.splice=="function"||va(h)||ps(h)||Ma(h)))return!h.length;var v=Se(h);if(v==rt||v==oe)return!h.size;if(nn(h))return!fl(h).length;for(var w in h)if(Kt.call(h,w))return!1;return!0}function q1(h,v){return en(h,v)}function Y1(h,v,w){w=typeof w=="function"?w:i;var k=w?w(h,v):i;return k===i?en(h,v,i,w):!!k}function Nl(h){if(!ue(h))return!1;var v=Ie(h);return v==N||v==I||typeof h.message=="string"&&typeof h.name=="string"&&!on(h)}function K1(h){return typeof h=="number"&&rh(h)}function qi(h){if(!le(h))return!1;var v=Ie(h);return v==X||v==J||v==ut||v==Ge}function Ff(h){return typeof h=="number"&&h==Dt(h)}function kr(h){return typeof h=="number"&&h>-1&&h%1==0&&h<=W}function le(h){var v=typeof h;return h!=null&&(v=="object"||v=="function")}function ue(h){return h!=null&&typeof h=="object"}var Pf=Hu?Qe(Hu):Jy;function X1(h,v){return h===v||hl(h,v,Pl(v))}function G1(h,v,w){return w=typeof w=="function"?w:i,hl(h,v,Pl(v),w)}function Z1(h){return Rf(h)&&h!=+h}function J1(h){if(Mp(h))throw new St(n);return wh(h)}function Q1(h){return h===null}function tb(h){return h==null}function Rf(h){return typeof h=="number"||ue(h)&&Ie(h)==yt}function on(h){if(!ue(h)||Ie(h)!=Et)return!1;var v=Qn(h);if(v===null)return!0;var w=Kt.call(v,"constructor")&&v.constructor;return typeof w=="function"&&w instanceof w&&Xn.call(w)==Gm}var zl=Uu?Qe(Uu):Qy;function eb(h){return Ff(h)&&h>=-W&&h<=W}var Sf=Vu?Qe(Vu):tp;function Fr(h){return typeof h=="string"||!Bt(h)&&ue(h)&&Ie(h)==Vt}function ei(h){return typeof h=="symbol"||ue(h)&&Ie(h)==Gt}var ps=$u?Qe($u):ep;function ib(h){return h===i}function ab(h){return ue(h)&&Se(h)==$s}function sb(h){return ue(h)&&Ie(h)==xv}var nb=yr(dl),rb=yr(function(h,v){return h<=v});function Tf(h){if(!h)return[];if(Ue(h))return Fr(h)?pi(h):He(h);if(Ys&&h[Ys])return Nm(h[Ys]());var v=Se(h),w=v==rt?tl:v==oe?qn:ws;return w(h)}function Yi(h){if(!h)return h===0?h:0;if(h=fi(h),h===q||h===-q){var v=h<0?-1:1;return v*j}return h===h?h:0}function Dt(h){var v=Yi(h),w=v%1;return v===v?w?v-w:v:0}function Bf(h){return h?Ta(Dt(h),0,U):0}function fi(h){if(typeof h=="number")return h;if(ei(h))return K;if(le(h)){var v=typeof h.valueOf=="function"?h.valueOf():h;h=le(v)?v+"":v}if(typeof h!="string")return h===0?h:+h;h=Gu(h);var w=Hv.test(h);return w||Vv.test(h)?xm(h.slice(2),w?2:8):Wv.test(h)?K:+h}function If(h){return Pi(h,Ve(h))}function ob(h){return h?Ta(Dt(h),-W,W):h===0?h:0}function Xt(h){return h==null?"":ti(h)}var lb=vs(function(h,v){if(nn(v)||Ue(v)){Pi(v,be(v),h);return}for(var w in v)Kt.call(v,w)&&Js(h,w,v[w])}),Df=vs(function(h,v){Pi(v,Ve(v),h)}),Mf=vs(function(h,v,w,k){Pi(v,Ve(v),h,k)}),Wl=vs(function(h,v,w,k){Pi(v,be(v),h,k)}),cb=$i(rl);function ub(h,v){var w=gs(h);return v==null?w:hh(w,v)}var hb=Lt(function(h,v){h=Jt(h);var w=-1,k=v.length,M=k>2?v[2]:i;for(M&&De(v[0],v[1],M)&&(k=1);++w<k;)for(var z=v[w],Y=Ve(z),Q=-1,nt=Y.length;++Q<nt;){var dt=Y[Q],gt=h[dt];(gt===i||xi(gt,hs[dt])&&!Kt.call(h,dt))&&(h[dt]=z[dt])}return h}),fb=Lt(function(h){return h.push(i,Gh),Ze(Lf,i,h)});function db(h,v){return qu(h,kt(v,3),Fi)}function gb(h,v){return qu(h,kt(v,3),ll)}function vb(h,v){return h==null?h:ol(h,kt(v,3),Ve)}function mb(h,v){return h==null?h:mh(h,kt(v,3),Ve)}function yb(h,v){return h&&Fi(h,kt(v,3))}function pb(h,v){return h&&ll(h,kt(v,3))}function wb(h){return h==null?[]:cr(h,be(h))}function bb(h){return h==null?[]:cr(h,Ve(h))}function Hl(h,v,w){var k=h==null?i:Ba(h,v);return k===i?w:k}function xb(h,v){return h!=null&&Qh(h,v,jy)}function Ul(h,v){return h!=null&&Qh(h,v,qy)}var _b=jh(function(h,v,w){v!=null&&typeof v.toString!="function"&&(v=Gn.call(v)),h[v]=w},$l($e)),Eb=jh(function(h,v,w){v!=null&&typeof v.toString!="function"&&(v=Gn.call(v)),Kt.call(h,v)?h[v].push(w):h[v]=[w]},kt),Ab=Lt(tn);function be(h){return Ue(h)?ch(h):fl(h)}function Ve(h){return Ue(h)?ch(h,!0):ip(h)}function Cb(h,v){var w={};return v=kt(v,3),Fi(h,function(k,M,z){ki(w,v(k,M,z),k)}),w}function kb(h,v){var w={};return v=kt(v,3),Fi(h,function(k,M,z){ki(w,M,v(k,M,z))}),w}var Fb=vs(function(h,v,w){ur(h,v,w)}),Lf=vs(function(h,v,w,k){ur(h,v,w,k)}),Pb=$i(function(h,v){var w={};if(h==null)return w;var k=!1;v=se(v,function(z){return z=da(z,h),k||(k=z.length>1),z}),Pi(h,kl(h),w),k&&(w=ci(w,f|g|m,Ep));for(var M=v.length;M--;)pl(w,v[M]);return w});function Rb(h,v){return Of(h,Cr(kt(v)))}var Sb=$i(function(h,v){return h==null?{}:sp(h,v)});function Of(h,v){if(h==null)return{};var w=se(kl(h),function(k){return[k]});return v=kt(v),kh(h,w,function(k,M){return v(k,M[0])})}function Tb(h,v,w){v=da(v,h);var k=-1,M=v.length;for(M||(M=1,h=i);++k<M;){var z=h==null?i:h[bi(v[k])];z===i&&(k=M,z=w),h=qi(z)?z.call(h):z}return h}function Bb(h,v,w){return h==null?h:an(h,v,w)}function Ib(h,v,w,k){return k=typeof k=="function"?k:i,h==null?h:an(h,v,w,k)}var Nf=Kh(be),zf=Kh(Ve);function Db(h,v,w){var k=Bt(h),M=k||va(h)||ps(h);if(v=kt(v,4),w==null){var z=h&&h.constructor;M?w=k?new z:[]:le(h)?w=qi(z)?gs(Qn(h)):{}:w={}}return(M?Je:Fi)(h,function(Y,Q,nt){return v(w,Y,Q,nt)}),w}function Mb(h,v){return h==null?!0:pl(h,v)}function Lb(h,v,w){return h==null?h:Th(h,v,xl(w))}function Ob(h,v,w,k){return k=typeof k=="function"?k:i,h==null?h:Th(h,v,xl(w),k)}function ws(h){return h==null?[]:Qo(h,be(h))}function Nb(h){return h==null?[]:Qo(h,Ve(h))}function zb(h,v,w){return w===i&&(w=v,v=i),w!==i&&(w=fi(w),w=w===w?w:0),v!==i&&(v=fi(v),v=v===v?v:0),Ta(fi(h),v,w)}function Wb(h,v,w){return v=Yi(v),w===i?(w=v,v=0):w=Yi(w),h=fi(h),Yy(h,v,w)}function Hb(h,v,w){if(w&&typeof w!="boolean"&&De(h,v,w)&&(v=w=i),w===i&&(typeof v=="boolean"?(w=v,v=i):typeof h=="boolean"&&(w=h,h=i)),h===i&&v===i?(h=0,v=1):(h=Yi(h),v===i?(v=h,h=0):v=Yi(v)),h>v){var k=h;h=v,v=k}if(w||h%1||v%1){var M=oh();return Re(h+M*(v-h+bm("1e-"+((M+"").length-1))),v)}return vl(h,v)}var Ub=ms(function(h,v,w){return v=v.toLowerCase(),h+(w?Wf(v):v)});function Wf(h){return Vl(Xt(h).toLowerCase())}function Hf(h){return h=Xt(h),h&&h.replace(jv,Im).replace(um,"")}function Vb(h,v,w){h=Xt(h),v=ti(v);var k=h.length;w=w===i?k:Ta(Dt(w),0,k);var M=w;return w-=v.length,w>=0&&h.slice(w,M)==v}function $b(h){return h=Xt(h),h&&kv.test(h)?h.replace(vu,Dm):h}function jb(h){return h=Xt(h),h&&Bv.test(h)?h.replace(Oo,"\\$&"):h}var qb=ms(function(h,v,w){return h+(w?"-":"")+v.toLowerCase()}),Yb=ms(function(h,v,w){return h+(w?" ":"")+v.toLowerCase()}),Kb=Uh("toLowerCase");function Xb(h,v,w){h=Xt(h),v=Dt(v);var k=v?cs(h):0;if(!v||k>=v)return h;var M=(v-k)/2;return mr(ar(M),w)+h+mr(ir(M),w)}function Gb(h,v,w){h=Xt(h),v=Dt(v);var k=v?cs(h):0;return v&&k<v?h+mr(v-k,w):h}function Zb(h,v,w){h=Xt(h),v=Dt(v);var k=v?cs(h):0;return v&&k<v?mr(v-k,w)+h:h}function Jb(h,v,w){return w||v==null?v=0:v&&(v=+v),ry(Xt(h).replace(No,""),v||0)}function Qb(h,v,w){return(w?De(h,v,w):v===i)?v=1:v=Dt(v),ml(Xt(h),v)}function tx(){var h=arguments,v=Xt(h[0]);return h.length<3?v:v.replace(h[1],h[2])}var ex=ms(function(h,v,w){return h+(w?"_":"")+v.toLowerCase()});function ix(h,v,w){return w&&typeof w!="number"&&De(h,v,w)&&(v=w=i),w=w===i?U:w>>>0,w?(h=Xt(h),h&&(typeof v=="string"||v!=null&&!zl(v))&&(v=ti(v),!v&&ls(h))?ga(pi(h),0,w):h.split(v,w)):[]}var ax=ms(function(h,v,w){return h+(w?" ":"")+Vl(v)});function sx(h,v,w){return h=Xt(h),w=w==null?0:Ta(Dt(w),0,h.length),v=ti(v),h.slice(w,w+v.length)==v}function nx(h,v,w){var k=O.templateSettings;w&&De(h,v,w)&&(v=i),h=Xt(h),v=Wl({},v,k,Xh);var M=Wl({},v.imports,k.imports,Xh),z=be(M),Y=Qo(M,z);Je(z,function(Ct){if(yu.test(Ct))throw new St(l)});var Q,nt,dt=0,gt=v.interpolate||Hn,vt="__p += '",pt=el((v.escape||Hn).source+"|"+gt.source+"|"+(gt===mu?zv:Hn).source+"|"+(v.evaluate||Hn).source+"|$","g"),At="//# sourceURL="+(Kt.call(v,"sourceURL")?(v.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++vm+"]")+`
  110. `;h.replace(pt,function(Ct,Ot,Wt,ii,Me,ai){return Wt||(Wt=ii),vt+=h.slice(dt,ai).replace(qv,Mm),Ot&&(Q=!0,vt+=`' +
  111. __e(`+Ot+`) +
  112. '`),Me&&(nt=!0,vt+=`';
  113. `+Me+`;
  114. __p += '`),Wt&&(vt+=`' +
  115. ((__t = (`+Wt+`)) == null ? '' : __t) +
  116. '`),dt=ai+Ct.length,Ct}),vt+=`';
  117. `;var Pt=Kt.call(v,"variable")&&v.variable;if(!Pt)vt=`with (obj) {
  118. `+vt+`
  119. }
  120. `;else if(yu.test(Pt))throw new St(o);vt=(nt?vt.replace(_v,""):vt).replace(Ev,"$1").replace(Av,"$1;"),vt="function("+(Pt||"obj")+`) {
  121. `+(Pt?"":`obj || (obj = {});
  122. `)+"var __t, __p = ''"+(Q?", __e = _.escape":"")+(nt?`, __j = Array.prototype.join;
  123. function print() { __p += __j.call(arguments, '') }
  124. `:`;
  125. `)+vt+`return __p
  126. }`;var Mt=Vf(function(){return qt(z,At+"return "+vt).apply(i,Y)});if(Mt.source=vt,Nl(Mt))throw Mt;return Mt}function rx(h){return Xt(h).toLowerCase()}function ox(h){return Xt(h).toUpperCase()}function lx(h,v,w){if(h=Xt(h),h&&(w||v===i))return Gu(h);if(!h||!(v=ti(v)))return h;var k=pi(h),M=pi(v),z=Zu(k,M),Y=Ju(k,M)+1;return ga(k,z,Y).join("")}function cx(h,v,w){if(h=Xt(h),h&&(w||v===i))return h.slice(0,th(h)+1);if(!h||!(v=ti(v)))return h;var k=pi(h),M=Ju(k,pi(v))+1;return ga(k,0,M).join("")}function ux(h,v,w){if(h=Xt(h),h&&(w||v===i))return h.replace(No,"");if(!h||!(v=ti(v)))return h;var k=pi(h),M=Zu(k,pi(v));return ga(k,M).join("")}function hx(h,v){var w=F,k=R;if(le(v)){var M="separator"in v?v.separator:M;w="length"in v?Dt(v.length):w,k="omission"in v?ti(v.omission):k}h=Xt(h);var z=h.length;if(ls(h)){var Y=pi(h);z=Y.length}if(w>=z)return h;var Q=w-cs(k);if(Q<1)return k;var nt=Y?ga(Y,0,Q).join(""):h.slice(0,Q);if(M===i)return nt+k;if(Y&&(Q+=nt.length-Q),zl(M)){if(h.slice(Q).search(M)){var dt,gt=nt;for(M.global||(M=el(M.source,Xt(pu.exec(M))+"g")),M.lastIndex=0;dt=M.exec(gt);)var vt=dt.index;nt=nt.slice(0,vt===i?Q:vt)}}else if(h.indexOf(ti(M),Q)!=Q){var pt=nt.lastIndexOf(M);pt>-1&&(nt=nt.slice(0,pt))}return nt+k}function fx(h){return h=Xt(h),h&&Cv.test(h)?h.replace(gu,Um):h}var dx=ms(function(h,v,w){return h+(w?" ":"")+v.toUpperCase()}),Vl=Uh("toUpperCase");function Uf(h,v,w){return h=Xt(h),v=w?i:v,v===i?Om(h)?jm(h):Pm(h):h.match(v)||[]}var Vf=Lt(function(h,v){try{return Ze(h,i,v)}catch(w){return Nl(w)?w:new St(w)}}),gx=$i(function(h,v){return Je(v,function(w){w=bi(w),ki(h,w,Ll(h[w],h))}),h});function vx(h){var v=h==null?0:h.length,w=kt();return h=v?se(h,function(k){if(typeof k[1]!="function")throw new oi(r);return[w(k[0]),k[1]]}):[],Lt(function(k){for(var M=-1;++M<v;){var z=h[M];if(Ze(z[0],this,k))return Ze(z[1],this,k)}})}function mx(h){return Uy(ci(h,f))}function $l(h){return function(){return h}}function yx(h,v){return h==null||h!==h?v:h}var px=$h(),bx=$h(!0);function $e(h){return h}function jl(h){return bh(typeof h=="function"?h:ci(h,f))}function xx(h){return _h(ci(h,f))}function _x(h,v){return Eh(h,ci(v,f))}var Ex=Lt(function(h,v){return function(w){return tn(w,h,v)}}),Ax=Lt(function(h,v){return function(w){return tn(h,w,v)}});function ql(h,v,w){var k=be(v),M=cr(v,k);w==null&&!(le(v)&&(M.length||!k.length))&&(w=v,v=h,h=this,M=cr(v,be(v)));var z=!(le(w)&&"chain"in w)||!!w.chain,Y=qi(h);return Je(M,function(Q){var nt=v[Q];h[Q]=nt,Y&&(h.prototype[Q]=function(){var dt=this.__chain__;if(z||dt){var gt=h(this.__wrapped__),vt=gt.__actions__=He(this.__actions__);return vt.push({func:nt,args:arguments,thisArg:h}),gt.__chain__=dt,gt}return nt.apply(h,la([this.value()],arguments))})}),h}function Cx(){return _e._===this&&(_e._=Zm),this}function Yl(){}function kx(h){return h=Dt(h),Lt(function(v){return Ah(v,h)})}var Fx=El(se),Px=El(ju),Rx=El(Ko);function $f(h){return Sl(h)?Xo(bi(h)):np(h)}function Sx(h){return function(v){return h==null?i:Ba(h,v)}}var Tx=qh(),Bx=qh(!0);function Kl(){return[]}function Xl(){return!1}function Ix(){return{}}function Dx(){return""}function Mx(){return!0}function Lx(h,v){if(h=Dt(h),h<1||h>W)return[];var w=U,k=Re(h,U);v=kt(v),h-=U;for(var M=Jo(k,v);++w<h;)v(w);return M}function Ox(h){return Bt(h)?se(h,bi):ei(h)?[h]:He(cf(Xt(h)))}function Nx(h){var v=++Xm;return Xt(h)+v}var zx=vr(function(h,v){return h+v},0),Wx=Al("ceil"),Hx=vr(function(h,v){return h/v},1),Ux=Al("floor");function Vx(h){return h&&h.length?lr(h,$e,cl):i}function $x(h,v){return h&&h.length?lr(h,kt(v,2),cl):i}function jx(h){return Ku(h,$e)}function qx(h,v){return Ku(h,kt(v,2))}function Yx(h){return h&&h.length?lr(h,$e,dl):i}function Kx(h,v){return h&&h.length?lr(h,kt(v,2),dl):i}var Xx=vr(function(h,v){return h*v},1),Gx=Al("round"),Zx=vr(function(h,v){return h-v},0);function Jx(h){return h&&h.length?Zo(h,$e):0}function Qx(h,v){return h&&h.length?Zo(h,kt(v,2)):0}return O.after=x1,O.ary=bf,O.assign=lb,O.assignIn=Df,O.assignInWith=Mf,O.assignWith=Wl,O.at=cb,O.before=xf,O.bind=Ll,O.bindAll=gx,O.bindKey=_f,O.castArray=I1,O.chain=yf,O.chunk=Up,O.compact=Vp,O.concat=$p,O.cond=vx,O.conforms=mx,O.constant=$l,O.countBy=Jw,O.create=ub,O.curry=Ef,O.curryRight=Af,O.debounce=Cf,O.defaults=hb,O.defaultsDeep=fb,O.defer=_1,O.delay=E1,O.difference=jp,O.differenceBy=qp,O.differenceWith=Yp,O.drop=Kp,O.dropRight=Xp,O.dropRightWhile=Gp,O.dropWhile=Zp,O.fill=Jp,O.filter=t1,O.flatMap=a1,O.flatMapDeep=s1,O.flatMapDepth=n1,O.flatten=df,O.flattenDeep=Qp,O.flattenDepth=tw,O.flip=A1,O.flow=px,O.flowRight=bx,O.fromPairs=ew,O.functions=wb,O.functionsIn=bb,O.groupBy=r1,O.initial=aw,O.intersection=sw,O.intersectionBy=nw,O.intersectionWith=rw,O.invert=_b,O.invertBy=Eb,O.invokeMap=l1,O.iteratee=jl,O.keyBy=c1,O.keys=be,O.keysIn=Ve,O.map=_r,O.mapKeys=Cb,O.mapValues=kb,O.matches=xx,O.matchesProperty=_x,O.memoize=Ar,O.merge=Fb,O.mergeWith=Lf,O.method=Ex,O.methodOf=Ax,O.mixin=ql,O.negate=Cr,O.nthArg=kx,O.omit=Pb,O.omitBy=Rb,O.once=C1,O.orderBy=u1,O.over=Fx,O.overArgs=k1,O.overEvery=Px,O.overSome=Rx,O.partial=Ol,O.partialRight=kf,O.partition=h1,O.pick=Sb,O.pickBy=Of,O.property=$f,O.propertyOf=Sx,O.pull=uw,O.pullAll=vf,O.pullAllBy=hw,O.pullAllWith=fw,O.pullAt=dw,O.range=Tx,O.rangeRight=Bx,O.rearg=F1,O.reject=g1,O.remove=gw,O.rest=P1,O.reverse=Dl,O.sampleSize=m1,O.set=Bb,O.setWith=Ib,O.shuffle=y1,O.slice=vw,O.sortBy=b1,O.sortedUniq=_w,O.sortedUniqBy=Ew,O.split=ix,O.spread=R1,O.tail=Aw,O.take=Cw,O.takeRight=kw,O.takeRightWhile=Fw,O.takeWhile=Pw,O.tap=Vw,O.throttle=S1,O.thru=xr,O.toArray=Tf,O.toPairs=Nf,O.toPairsIn=zf,O.toPath=Ox,O.toPlainObject=If,O.transform=Db,O.unary=T1,O.union=Rw,O.unionBy=Sw,O.unionWith=Tw,O.uniq=Bw,O.uniqBy=Iw,O.uniqWith=Dw,O.unset=Mb,O.unzip=Ml,O.unzipWith=mf,O.update=Lb,O.updateWith=Ob,O.values=ws,O.valuesIn=Nb,O.without=Mw,O.words=Uf,O.wrap=B1,O.xor=Lw,O.xorBy=Ow,O.xorWith=Nw,O.zip=zw,O.zipObject=Ww,O.zipObjectDeep=Hw,O.zipWith=Uw,O.entries=Nf,O.entriesIn=zf,O.extend=Df,O.extendWith=Mf,ql(O,O),O.add=zx,O.attempt=Vf,O.camelCase=Ub,O.capitalize=Wf,O.ceil=Wx,O.clamp=zb,O.clone=D1,O.cloneDeep=L1,O.cloneDeepWith=O1,O.cloneWith=M1,O.conformsTo=N1,O.deburr=Hf,O.defaultTo=yx,O.divide=Hx,O.endsWith=Vb,O.eq=xi,O.escape=$b,O.escapeRegExp=jb,O.every=Qw,O.find=e1,O.findIndex=hf,O.findKey=db,O.findLast=i1,O.findLastIndex=ff,O.findLastKey=gb,O.floor=Ux,O.forEach=pf,O.forEachRight=wf,O.forIn=vb,O.forInRight=mb,O.forOwn=yb,O.forOwnRight=pb,O.get=Hl,O.gt=z1,O.gte=W1,O.has=xb,O.hasIn=Ul,O.head=gf,O.identity=$e,O.includes=o1,O.indexOf=iw,O.inRange=Wb,O.invoke=Ab,O.isArguments=Ma,O.isArray=Bt,O.isArrayBuffer=H1,O.isArrayLike=Ue,O.isArrayLikeObject=fe,O.isBoolean=U1,O.isBuffer=va,O.isDate=V1,O.isElement=$1,O.isEmpty=j1,O.isEqual=q1,O.isEqualWith=Y1,O.isError=Nl,O.isFinite=K1,O.isFunction=qi,O.isInteger=Ff,O.isLength=kr,O.isMap=Pf,O.isMatch=X1,O.isMatchWith=G1,O.isNaN=Z1,O.isNative=J1,O.isNil=tb,O.isNull=Q1,O.isNumber=Rf,O.isObject=le,O.isObjectLike=ue,O.isPlainObject=on,O.isRegExp=zl,O.isSafeInteger=eb,O.isSet=Sf,O.isString=Fr,O.isSymbol=ei,O.isTypedArray=ps,O.isUndefined=ib,O.isWeakMap=ab,O.isWeakSet=sb,O.join=ow,O.kebabCase=qb,O.last=hi,O.lastIndexOf=lw,O.lowerCase=Yb,O.lowerFirst=Kb,O.lt=nb,O.lte=rb,O.max=Vx,O.maxBy=$x,O.mean=jx,O.meanBy=qx,O.min=Yx,O.minBy=Kx,O.stubArray=Kl,O.stubFalse=Xl,O.stubObject=Ix,O.stubString=Dx,O.stubTrue=Mx,O.multiply=Xx,O.nth=cw,O.noConflict=Cx,O.noop=Yl,O.now=Er,O.pad=Xb,O.padEnd=Gb,O.padStart=Zb,O.parseInt=Jb,O.random=Hb,O.reduce=f1,O.reduceRight=d1,O.repeat=Qb,O.replace=tx,O.result=Tb,O.round=Gx,O.runInContext=et,O.sample=v1,O.size=p1,O.snakeCase=ex,O.some=w1,O.sortedIndex=mw,O.sortedIndexBy=yw,O.sortedIndexOf=pw,O.sortedLastIndex=ww,O.sortedLastIndexBy=bw,O.sortedLastIndexOf=xw,O.startCase=ax,O.startsWith=sx,O.subtract=Zx,O.sum=Jx,O.sumBy=Qx,O.template=nx,O.times=Lx,O.toFinite=Yi,O.toInteger=Dt,O.toLength=Bf,O.toLower=rx,O.toNumber=fi,O.toSafeInteger=ob,O.toString=Xt,O.toUpper=ox,O.trim=lx,O.trimEnd=cx,O.trimStart=ux,O.truncate=hx,O.unescape=fx,O.uniqueId=Nx,O.upperCase=dx,O.upperFirst=Vl,O.each=pf,O.eachRight=wf,O.first=gf,ql(O,function(){var h={};return Fi(O,function(v,w){Kt.call(O.prototype,w)||(h[w]=v)}),h}(),{chain:!1}),O.VERSION=a,Je(["bind","bindKey","curry","curryRight","partial","partialRight"],function(h){O[h].placeholder=O}),Je(["drop","take"],function(h,v){Nt.prototype[h]=function(w){w=w===i?1:ye(Dt(w),0);var k=this.__filtered__&&!v?new Nt(this):this.clone();return k.__filtered__?k.__takeCount__=Re(w,k.__takeCount__):k.__views__.push({size:Re(w,U),type:h+(k.__dir__<0?"Right":"")}),k},Nt.prototype[h+"Right"]=function(w){return this.reverse()[h](w).reverse()}}),Je(["filter","map","takeWhile"],function(h,v){var w=v+1,k=w==$||w==at;Nt.prototype[h]=function(M){var z=this.clone();return z.__iteratees__.push({iteratee:kt(M,3),type:w}),z.__filtered__=z.__filtered__||k,z}}),Je(["head","last"],function(h,v){var w="take"+(v?"Right":"");Nt.prototype[h]=function(){return this[w](1).value()[0]}}),Je(["initial","tail"],function(h,v){var w="drop"+(v?"":"Right");Nt.prototype[h]=function(){return this.__filtered__?new Nt(this):this[w](1)}}),Nt.prototype.compact=function(){return this.filter($e)},Nt.prototype.find=function(h){return this.filter(h).head()},Nt.prototype.findLast=function(h){return this.reverse().find(h)},Nt.prototype.invokeMap=Lt(function(h,v){return typeof h=="function"?new Nt(this):this.map(function(w){return tn(w,h,v)})}),Nt.prototype.reject=function(h){return this.filter(Cr(kt(h)))},Nt.prototype.slice=function(h,v){h=Dt(h);var w=this;return w.__filtered__&&(h>0||v<0)?new Nt(w):(h<0?w=w.takeRight(-h):h&&(w=w.drop(h)),v!==i&&(v=Dt(v),w=v<0?w.dropRight(-v):w.take(v-h)),w)},Nt.prototype.takeRightWhile=function(h){return this.reverse().takeWhile(h).reverse()},Nt.prototype.toArray=function(){return this.take(U)},Fi(Nt.prototype,function(h,v){var w=/^(?:filter|find|map|reject)|While$/.test(v),k=/^(?:head|last)$/.test(v),M=O[k?"take"+(v=="last"?"Right":""):v],z=k||/^find/.test(v);!M||(O.prototype[v]=function(){var Y=this.__wrapped__,Q=k?[1]:arguments,nt=Y instanceof Nt,dt=Q[0],gt=nt||Bt(Y),vt=function(Ot){var Wt=M.apply(O,la([Ot],Q));return k&&pt?Wt[0]:Wt};gt&&w&&typeof dt=="function"&&dt.length!=1&&(nt=gt=!1);var pt=this.__chain__,At=!!this.__actions__.length,Pt=z&&!pt,Mt=nt&&!At;if(!z&&gt){Y=Mt?Y:new Nt(this);var Ct=h.apply(Y,Q);return Ct.__actions__.push({func:xr,args:[vt],thisArg:i}),new li(Ct,pt)}return Pt&&Mt?h.apply(this,Q):(Ct=this.thru(vt),Pt?k?Ct.value()[0]:Ct.value():Ct)})}),Je(["pop","push","shift","sort","splice","unshift"],function(h){var v=Yn[h],w=/^(?:push|sort|unshift)$/.test(h)?"tap":"thru",k=/^(?:pop|shift)$/.test(h);O.prototype[h]=function(){var M=arguments;if(k&&!this.__chain__){var z=this.value();return v.apply(Bt(z)?z:[],M)}return this[w](function(Y){return v.apply(Bt(Y)?Y:[],M)})}}),Fi(Nt.prototype,function(h,v){var w=O[v];if(w){var k=w.name+"";Kt.call(ds,k)||(ds[k]=[]),ds[k].push({name:v,func:w})}}),ds[gr(i,_).name]=[{name:"wrapper",func:i}],Nt.prototype.clone=dy,Nt.prototype.reverse=gy,Nt.prototype.value=vy,O.prototype.at=$w,O.prototype.chain=jw,O.prototype.commit=qw,O.prototype.next=Yw,O.prototype.plant=Xw,O.prototype.reverse=Gw,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=Zw,O.prototype.first=O.prototype.head,Ys&&(O.prototype[Ys]=Kw),O},us=qm();Fa?((Fa.exports=us)._=us,$o._=us):_e._=us}).call(Oe)})($c,$c.exports);const j9=$c.exports;export{EE as M,j9 as _,k9 as a,P9 as b,R9 as c,S9 as d,D9 as e,C9 as f,F9 as g,B9 as h,M9 as i,L9 as j,O9 as k,Tt as l,ot as m,xd as n,Mn as o,w5 as p,V9 as q,T9 as r,I9 as s,N9 as t,$9 as u,H9 as v,z9 as w,W9 as x,U9 as y};