@zhangqingcq/vgce 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
package/dist/vgce.umd.cjs CHANGED
@@ -204,7 +204,7 @@ echarts.use([`+Dt+"]);":"Unknown series "+Ve))}return}if(ae==="tooltip"){if(ze){
204
204
  if (customElements.get(tag) == null) {
205
205
  customElements.define(tag, EChartsElement);
206
206
  }
207
- `)("x-vue-echarts")}catch{return w=!1}return w=!0}(),U="ecTheme",S=vue.defineComponent({name:"echarts",props:O(O({option:Object,theme:{type:[Object,String]},initOptions:Object,updateOptions:Object,group:String,manualUpdate:Boolean},_),L),emits:{},inheritAttrs:!1,setup:function(i,n){var r=n.attrs,g=vue.shallowRef(),V=vue.shallowRef(),k=vue.shallowRef(),$=vue.inject("ecTheme",null),oe=vue.inject("ecInitOptions",null),re=vue.inject("ecUpdateOptions",null),Ce=vue.toRefs(i),ie=Ce.autoresize,ae=Ce.manualUpdate,le=Ce.loading,Ie=Ce.loadingOptions,ue=vue.computed(function(){return k.value||i.option||null}),de=vue.computed(function(){return i.theme||j($,{})}),Ne=vue.computed(function(){return i.initOptions||j(oe,{})}),he=vue.computed(function(){return i.updateOptions||j(re,{})}),pe=vue.computed(function(){return function($e){var Fe={};for(var Ue in $e)x(Ue)||(Fe[Ue]=$e[Ue]);return Fe}(r)}),ze=vue.getCurrentInstance().proxy.$listeners;function xe($e){if(g.value){var Fe=V.value=init(g.value,de.value,Ne.value);i.group&&(Fe.group=i.group);var Ue=ze;Ue||(Ue={},Object.keys(r).filter(function(Dt){return Dt.indexOf("on")===0&&Dt.length>2}).forEach(function(Dt){var qe=Dt.charAt(2).toLowerCase()+Dt.slice(3);qe.substring(qe.length-4)==="Once"&&(qe="~".concat(qe.substring(0,qe.length-4))),Ue[qe]=r[Dt]})),Object.keys(Ue).forEach(function(Dt){var qe=Ue[Dt];if(qe){var kt=Dt.toLowerCase();kt.charAt(0)==="~"&&(kt=kt.substring(1),qe.__once__=!0);var jt=Fe;if(kt.indexOf("zr:")===0&&(jt=Fe.getZr(),kt=kt.substring(3)),qe.__once__){delete qe.__once__;var Pt=qe;qe=function(){for(var ti=[],ei=0;ei<arguments.length;ei++)ti[ei]=arguments[ei];Pt.apply(void 0,ti),jt.off(kt,qe)}}jt.on(kt,qe)}}),ie.value?vue.nextTick(function(){Fe&&!Fe.isDisposed()&&Fe.resize(),Ve()}):Ve()}function Ve(){var Dt=$e||ue.value;Dt&&Fe.setOption(Dt,he.value)}}function Oe(){V.value&&(V.value.dispose(),V.value=void 0)}var _e=null;vue.watch(ae,function($e){typeof _e=="function"&&(_e(),_e=null),$e||(_e=vue.watch(function(){return i.option},function(Fe,Ue){Fe&&(V.value?V.value.setOption(Fe,O({notMerge:Fe.value!==(Ue==null?void 0:Ue.value)},he.value)):xe())},{deep:!0}))},{immediate:!0}),vue.watch([de,Ne],function(){Oe(),xe()},{deep:!0}),vue.watchEffect(function(){i.group&&V.value&&(V.value.group=i.group)});var At=y(V);return function($e,Fe,Ue){var Ve=vue.inject("ecLoadingOptions",{}),Dt=vue.computed(function(){return O(O({},j(Ve,{})),Ue==null?void 0:Ue.value)});vue.watchEffect(function(){var qe=$e.value;qe&&(Fe.value?qe.showLoading(Dt.value):qe.hideLoading())})}(V,le,Ie),function($e,Fe,Ue){var Ve=null;vue.watch([Ue,$e,Fe],function(Dt,qe,kt){var jt=Dt[0],Pt=Dt[1],ti=Dt[2];jt&&Pt&&ti&&(Ve=throttle$1(function(){Pt.resize()},100),addListener(jt,Ve)),kt(function(){Ve&&jt&&removeListener(jt,Ve)})})}(V,ie,g),vue.onMounted(function(){xe()}),vue.onBeforeUnmount(function(){T&&g.value?g.value.__dispose=Oe:Oe()}),O({chart:V,root:g,setOption:function($e,Fe){i.manualUpdate&&(k.value=$e),V.value?V.value.setOption($e,Fe||{}):xe($e)},nonEventAttrs:pe},At)},render:function(){var i=O({},this.nonEventAttrs);return i.ref="root",i.class=i.class?["echarts"].concat(i.class):"echarts",vue.h("x-vue-echarts",i)}});const _sfc_main$m=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(i){const n=i;use([install$7,install$6,install$3,install$4,install]),vue.provide(U,"dark");const r=vue.reactive({title:{text:n.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:n.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:n.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(n,g=>{r.title.text=g.title,r.series[0].name=g.seriesName,r.series[0].data=g.seriesData}),(g,V)=>(vue.openBlock(),vue.createBlock(vue.unref(S),{class:"chart",option:vue.unref(r),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_0a4c1b1f_lang="",_export_sfc=(i,n)=>{const r=i.__vccOpts||i;for(const[g,V]of n)r[g]=V;return r},PieCharts=_export_sfc(_sfc_main$m,[["__scopeId","data-v-0a4c1b1f"]]),_hoisted_1$g=["id"],_hoisted_2$e=["id"],_hoisted_3$c=["fill"],_hoisted_4$a=["fill"],_hoisted_5$8=["fill"],_hoisted_6$6=vue.createElementVNode("path",{d:"M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z",fill:"#2D4375"},null,-1),_hoisted_7$6=vue.createElementVNode("path",{d:"M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z",fill:"#1E2D4F"},null,-1),_hoisted_8$5=["fill-opacity"],_hoisted_9$5=["fill-opacity"],_hoisted_10$4=["fill-opacity"],_hoisted_11$4=vue.createElementVNode("path",{d:"M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z",fill:"#CEEFF6"},null,-1),_hoisted_12$3=vue.createElementVNode("path",{d:"M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z",fill:"#FFFFFF"},null,-1),_hoisted_13$3=vue.createElementVNode("path",{d:"M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z",fill:"#CEEFF6"},null,-1),_hoisted_14$3=["xlink:href"],_sfc_main$l=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1}},emits:["onChange"],setup(i,{emit:n}){const r=i;return vue.watch(()=>r.isOpen,()=>{n("onChange")}),(g,V)=>(vue.openBlock(),vue.createElementBlock("g",{id:r.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${r.id}light-121`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z",fill:r.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$c),vue.createElementVNode("path",{d:"M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z",fill:r.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$a),vue.createElementVNode("path",{d:"M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z",fill:r.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$6,_hoisted_7$6,vue.createElementVNode("path",{d:"M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z",fill:"#FDB813","fill-opacity":r.isOpen?1:0},null,8,_hoisted_8$5),vue.createElementVNode("path",{d:"M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z",fill:"#FDB813","fill-opacity":r.isOpen?1:0},null,8,_hoisted_9$5),vue.createElementVNode("path",{d:"M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z",fill:"#FDB813","fill-opacity":r.isOpen?1:0},null,8,_hoisted_10$4),_hoisted_11$4,_hoisted_12$3,_hoisted_13$3],8,_hoisted_2$e),vue.createElementVNode("use",{"xlink:href":`#${r.id}light-121`,width:"100",height:"100"},null,8,_hoisted_14$3)],8,_hoisted_1$g))}}),_hoisted_1$f=["id"],_hoisted_2$d=["id"],_hoisted_3$b=vue.createElementVNode("path",{d:"M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z",fill:"#429BCF"},null,-1),_hoisted_4$9=vue.createElementVNode("path",{d:"M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z",fill:"#FFFFFF"},null,-1),_hoisted_5$7={d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z",fill:"#2D416C"},_hoisted_6$5=["from","to"],_hoisted_7$5={d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z",fill:"#365087"},_hoisted_8$4=["from","to"],_hoisted_9$4=vue.createElementVNode("path",{d:"M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z",fill:"#365087"},null,-1),_hoisted_10$3=vue.createElementVNode("path",{d:"M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z",fill:"#2D416C"},null,-1),_hoisted_11$3={d:"M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z",fill:"#C11B16"},_hoisted_12$2=["from","to"],_hoisted_13$2=vue.createElementVNode("path",{d:"M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z",fill:"#fff"},null,-1),_hoisted_14$2=["xlink:href"],_sfc_main$k=vue.defineComponent({__name:"clock-a",props:{id:{default:""}},setup(i){const n=i,r=vue.ref(new Date),g=r.value.getSeconds(),V=r.value.getMinutes(),k=Math.floor((r.value.getHours()+(V+g/60)/60)*30);return($,oe)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id},[vue.createElementVNode("symbol",{id:`${n.id}clock-a-n`,viewBox:"0 0 1024 1024"},[_hoisted_3$b,_hoisted_4$9,vue.createElementVNode("path",_hoisted_5$7,[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${-45+vue.unref(k)} 512.3 506.3`,to:`${315+vue.unref(k)} 512.3 506.3`,dur:"43200s",repeatCount:"indefinite"},null,8,_hoisted_6$5)]),vue.createElementVNode("path",_hoisted_7$5,[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${45+vue.unref(V)*6} 512.3 506.3`,to:`${405+vue.unref(V)*6} 512.3 506.3`,dur:"3600s",repeatCount:"indefinite"},null,8,_hoisted_8$4)]),_hoisted_9$4,_hoisted_10$3,vue.createElementVNode("path",_hoisted_11$3,[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${135.5+vue.unref(g)*6} 512.3 506.3`,to:`${495.5+vue.unref(g)*6} 512.3 506.3`,dur:"60s",repeatCount:"indefinite"},null,8,_hoisted_12$2)]),_hoisted_13$2],8,_hoisted_2$d),vue.createElementVNode("use",{"xlink:href":`#${n.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$f))}}),vueComp={"svg-text":_sfc_main$p,"el-button":ElButton,"progress-a":_sfc_main$r,"el-tag":ElTag,"common-table":_sfc_main$o,"pie-charts":PieCharts,"switch-a":_sfc_main$q,"now-time":_sfc_main$n,"light-a":_sfc_main$l,"clock-a":_sfc_main$k},config=[...svg_config,...vue_config],useGlobalStore=pinia$1.defineStore("global-store",{state:()=>({config_center:config,intention:EGlobalStoreIntention.None,create_svg_info:null,done_json:[],mouse_info:{state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},handle_svg_info:null,scale_info:{type:EScaleInfoType.None,scale_times:{x:1,y:1},scale_item_info:{x:0,y:0},symmetric_point:{x:0,y:0}},rotate_info:{angle:0},connection_line_node_info:{init_pos:{x:0,y:0},point_index:0}}),actions:{setCreateInfo(i){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=i},setDoneJson(i){isOfType(i,"id")?(this.done_json.push(i),vue.nextTick(()=>{setSvgActualInfo(i)})):this.done_json=objectDeepClone(i),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(i,n){let r=n;i?(!r&&r!=0&&(r=this.done_json.findIndex(g=>g.id===i.id)??-1),this.handle_svg_info={info:i,index:r}):this.handle_svg_info=i},spliceDoneJson(i){const n=useGlobalStore(),g=n.done_json.splice(i,1)[0];unbindAnchors(g.id),useHistoryRecord(n.done_json)}}}),useSvgEditLayoutStore=pinia$1.defineStore("svg-edit-layout-store",{state:()=>({left_nav:!0,right_nav:!0,center_offset:{x:0,y:0},canvasInfo:{with:0,height:0,top:0,left:0}})}),randomString=i=>{i=i||10;const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length;let g="";for(let V=0;V<i;V++){let k=r;V===0&&(k=r-10),g+=n.charAt(Math.floor(Math.random()*k))}return g},isOfType=(i,n)=>i[n]!==void 0,getCoordinateOffset=(i,n)=>i/2*(n-1),angleToRadian=i=>i*Math.PI/180,calculateRotatedPointCoordinate=(i,n,r)=>({x:parseFloat(((i.x-n.x)*Math.cos(angleToRadian(r))-(i.y-n.y)*Math.sin(angleToRadian(r))+n.x).toFixed(1)),y:parseFloat(((i.x-n.x)*Math.sin(angleToRadian(r))+(i.y-n.y)*Math.cos(angleToRadian(r))+n.y).toFixed(1))}),getCenterPoint=(i,n)=>({x:i.x+(n.x-i.x)/2,y:i.y+(n.y-i.y)/2}),positionArrToPath=i=>{let n="";for(let r=0;r<i.length;r++)r===0?n+=`M ${i[r].x} ${i[r].y}`:n+=` L ${i[r].x} ${i[r].y}`;return n},getSvgNowPosition=(i,n,r)=>r+(n-i),objectDeepClone=(i,n={})=>i?JSON.parse(JSON.stringify(i)):n,setSvgActualInfo=(i,n)=>{const r=document.querySelector(`#${i.id}`),g=document.querySelector(`#rect${i.id}`);if(r){let V=0,k=0,$=0,oe=0;if(i.type!==EDoneJsonType.Vue){const re=r.getBBox();V=parseFloat(re.x.toFixed(0)),k=parseFloat(re.y.toFixed(0)),$=parseFloat(re.width.toFixed(0)),oe=parseFloat(re.height.toFixed(0))}else{$=r.offsetWidth,oe=r.offsetHeight,$=$===0?100:$,oe=oe===0?100:oe,V=50-$/2,k=50-oe/2;const re=document.querySelector(`#foreign-object${i.id}`);re&&re.getAttribute("x")==="0"&&re.getAttribute("y")==="0"&&re.getAttribute("width")==="0"&&re.getAttribute("height")==="0"&&(re.setAttribute("x",V.toString()),re.setAttribute("y",k.toString()),re.setAttribute("width",$.toString()),re.setAttribute("height",oe.toString()))}g&&g.getAttribute("x")==="0"&&g.getAttribute("y")==="0"&&g.getAttribute("width")==="0"&&g.getAttribute("height")==="0"&&(g.setAttribute("x",V.toString()),g.setAttribute("y",k.toString()),g.setAttribute("width",$.toString()),g.setAttribute("height",oe.toString())),(i.actual_bound.x===0&&i.actual_bound.y===0&&i.actual_bound.width===0&&i.actual_bound.height===0||n)&&(i.actual_bound={x:V,y:k,width:$,height:oe}),i.center_position={x:i.x+i.actual_bound.x+$/2,y:i.y+i.actual_bound.y+oe/2},i.point_coordinate.tl={x:i.center_position.x-$*i.scale_x/2,y:i.center_position.y-oe*i.scale_y/2},i.point_coordinate.tc={x:i.center_position.x,y:i.center_position.y-oe*i.scale_y/2},i.point_coordinate.tr={x:i.center_position.x+$*i.scale_x/2,y:i.center_position.y-oe*i.scale_y/2},i.point_coordinate.l={x:i.center_position.x-$*i.scale_x/2,y:i.center_position.y},i.point_coordinate.r={x:i.center_position.x+$*i.scale_x/2,y:i.center_position.y},i.point_coordinate.bl={x:i.center_position.x-$*i.scale_x/2,y:i.center_position.y+oe*i.scale_y/2},i.point_coordinate.bc={x:i.center_position.x,y:i.center_position.y+oe*i.scale_y/2},i.point_coordinate.br={x:i.center_position.x+$*i.scale_x/2,y:i.center_position.y+oe*i.scale_y/2},i.rotate!==0&&setAfterRotationPointCoordinate(i),moveAnchors(i)}},resetHandlePointOld=i=>{for(const n of Object.keys(i.point_coordinate))i.point_coordinate_old&&(i.point_coordinate_old[n].x=0,i.point_coordinate_old[n].y=0)},moveHandlePoint=(i,n,r)=>{const g=useGlobalStore(pinia),V=n??g.mouse_info.new_position_x-g.mouse_info.position_x,k=r??g.mouse_info.new_position_y-g.mouse_info.position_y;for(const $ of Object.keys(i.point_coordinate))n!==void 0&&r!==void 0?(i.point_coordinate[$].x+=V,i.point_coordinate[$].y+=k):i.point_coordinate_old&&(i.point_coordinate[$].x=i.point_coordinate_old[$].x+V,i.point_coordinate[$].y=i.point_coordinate_old[$].y+k)},moveAnchors=i=>{var r,g,V,k;const n=useGlobalStore(pinia);for(let $ of n.done_json)if($.type===EDoneJsonType.ConnectionLine){if(((g=(r=$.bind_anchors)==null?void 0:r.start)==null?void 0:g.target_id)===i.id){const oe=getAnchorPosByAnchorType($.bind_anchors.start.type,i);$.props.point_position.val[0]={x:oe.x-$.x,y:oe.y-$.y}}if(((k=(V=$.bind_anchors)==null?void 0:V.end)==null?void 0:k.target_id)===i.id){const oe=getAnchorPosByAnchorType($.bind_anchors.end.type,i);$.props.point_position.val[$.props.point_position.val.length-1]={x:oe.x-$.x,y:oe.y-$.y}}}},unbindAnchors=i=>{var r,g,V,k;const n=useGlobalStore(pinia);for(let $ of n.done_json)$.type===EDoneJsonType.ConnectionLine&&(((g=(r=$.bind_anchors)==null?void 0:r.start)==null?void 0:g.target_id)===i&&($.bind_anchors.start=null),((k=(V=$.bind_anchors)==null?void 0:V.end)==null?void 0:k.target_id)===i&&($.bind_anchors.end=null))},getAnchorPosByAnchorType=(i,n)=>i===ELineBindAnchors.BottomCenter?n.point_coordinate.bc:i===ELineBindAnchors.Left?n.point_coordinate.l:i===ELineBindAnchors.Right?n.point_coordinate.r:n.point_coordinate.tc,setAfterRotationPointCoordinate=i=>{i.point_coordinate={tl:calculateRotatedPointCoordinate(i.point_coordinate.tl,i.center_position,i.rotate),tc:calculateRotatedPointCoordinate(i.point_coordinate.tc,i.center_position,i.rotate),tr:calculateRotatedPointCoordinate(i.point_coordinate.tr,i.center_position,i.rotate),l:calculateRotatedPointCoordinate(i.point_coordinate.l,i.center_position,i.rotate),r:calculateRotatedPointCoordinate(i.point_coordinate.r,i.center_position,i.rotate),bl:calculateRotatedPointCoordinate(i.point_coordinate.bl,i.center_position,i.rotate),bc:calculateRotatedPointCoordinate(i.point_coordinate.bc,i.center_position,i.rotate),br:calculateRotatedPointCoordinate(i.point_coordinate.br,i.center_position,i.rotate)}},prosToVBind=i=>{var r,g,V,k;let n={};if(i.state){for(const $ in i.state)if($==="OnOff")for(const oe in(r=i.state[$])==null?void 0:r.props)n={...n,[oe]:(g=i.state[$])!=null&&g.default?(V=i.state[$])==null?void 0:V.props[oe].openVal:(k=i.state[$])==null?void 0:k.props[oe].closeVal}}for(const $ in i.props)n={...n,[$]:i.props[$].val};return n},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(i=>i.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=i=>!i.common_animations||!i.common_animations.val?"":`common-ani animate__animated animate__${i.common_animations.val} animate__${i.common_animations.speed} animate__${i.common_animations.repeat} animate__${i.common_animations.delay}`,numberArray=i=>{let n=[];for(let r=0;r<i;r++)n.push(r);return n},getStringWidth=(i,n=12)=>{if(i.length>0){let r=document.createElement("span");r.style.fontSize=n+"px",r.style.fontFamily="inherit",r.innerHTML=i,r.style.opacity="0",r.style.position="fixed",r.style.top="3000px",document.body.append(r);const g=r.clientWidth;return document.body.removeChild(r),g}return 0},valFormat=i=>/false|true/.test(i)?i!=="false":/^\d+(\.\d+)?$/.test(i)?Number(i):i,createLine=(i,n,r)=>{i.preventDefault();const g=useGlobalStore(pinia),V=useConfigStore(pinia),k=useSvgEditLayoutStore(pinia),{clientX:$,clientY:oe}=i;let re=objectDeepClone(V.connection_line),Ce=0,ie=0;if(n&&r){re.bind_anchors.start={type:n,target_id:r.id};let le=getAnchorPosByAnchorType(n,r);Ce=le.x,ie=le.y}else Ce=Math.round(($-k.canvasInfo.left)/V.svg.scale-k.center_offset.x),ie=Math.round((oe-k.canvasInfo.top)/V.svg.scale-k.center_offset.y);const ae={id:straight_line_system.name+randomString(),x:Ce,y:ie,client:{x:Ce,y:ie},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},...re};ae.props.point_position.val.push({x:0,y:0}),g.setDoneJson(ae),g.setHandleSvgInfo(ae,g.done_json.length-1),g.intention=EGlobalStoreIntention.Connection,g.mouse_info={state:EMouseInfoState.Down,position_x:Ce,position_y:ie,now_position_x:Ce,now_position_y:ie,new_position_x:0,new_position_y:0}};let l=localStorage.getItem("svg-editor-config"),s,t;if(l){let i=JSON.parse(l);t=i.connection_line,s=i.svg}else t=objectDeepClone(connection_line_system),s={background_color:"#fff",scale:1,grid:!0,grid_color:"#ebebeb",ruler:!0};const useConfigStore=pinia$1.defineStore("config-store",{state:()=>({svg:s,connection_line:t,net:{mqtt:{url:"",user:"",pwd:"",topics:""}}}),getters:{},actions:{}});var EContextMenuInfoType=(i=>(i.Copy="Copy",i.Delete="Delete",i.MoveUpOneLevel="MoveUpOneLevel",i.MoveDownOneLevel="MoveDownOneLevel",i.MoveUpTopLevel="MoveUpTopLevel",i.MoveDownTopLevel="MoveDownTopLevel",i))(EContextMenuInfoType||{});const useEditPrivateStore=pinia$1.defineStore("edit-private-store",{state:()=>({old_done_components:[],history_doneComponent:[],history_now_index:0,is_record_history:!0,max_record_times:10}),getters:{getTopBtnUndoStatus(i){return i.history_now_index>=1},getTopBtnRedoStatus(i){return i.history_now_index+1!=i.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])}}}),useContextMenuStore=pinia$1.defineStore("context-menu-store",{state:()=>({display:!1,info:{[EContextMenuInfoType.Copy]:{title:"复制",hot_key:"Ctrl+C",enable:!0},[EContextMenuInfoType.Delete]:{title:"删除",hot_key:"Delete",enable:!0},[EContextMenuInfoType.MoveUpTopLevel]:{title:"置于顶层",hot_key:"Ctrl+→",enable:!0},[EContextMenuInfoType.MoveDownTopLevel]:{title:"置于底层",hot_key:"Ctrl+←",enable:!0},[EContextMenuInfoType.MoveUpOneLevel]:{title:"置于上一层",hot_key:"Ctrl+↑",enable:!0},[EContextMenuInfoType.MoveDownOneLevel]:{title:"置于下一层",hot_key:"Ctrl+↓",enable:!0}}}),actions:{onContextMenuClick(i){const n=useGlobalStore();if(n.handle_svg_info)switch(n.intention=EGlobalStoreIntention.Select,i){case EContextMenuInfoType.Copy:const r=objectDeepClone(n.handle_svg_info.info);r.id=r.name+randomString(),r.title+="-copy",r.x+=10,r.y+=10,n.setDoneJson(r),this.display=!1,n.setHandleSvgInfo(r,n.done_json.length);break;case EContextMenuInfoType.Delete:n.spliceDoneJson(n.handle_svg_info.index),this.display=!1,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length-1)return;const g=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index+1],n.done_json[n.handle_svg_info.index+1]=g,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(g,n.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const V=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index-1],n.done_json[n.handle_svg_info.index-1]=V,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(V,n.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const k=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.unshift(k),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(k,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length)return;const $=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.push($),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo($,n.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=i=>{const n=useEditPrivateStore();n.is_record_history&&(n.history_now_index+1<n.history_doneComponent.length&&n.history_doneComponent.splice(n.history_now_index+1),n.history_doneComponent.push(i),n.history_now_index=n.history_doneComponent.length-1,n.history_doneComponent.length>n.max_record_times&&(n.history_doneComponent.shift(),n.history_now_index=n.history_doneComponent.length-1)),n.is_record_history=!0},useImportDataModel=i=>{try{const n=JSON.parse(i);if(!n.config||!n.layout_center||!n.done_json)return ElMessage.error("请导入正确的数据模型!"),!1;const r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=useConfigStore(pinia);return V.$state=n.config,g.center_offset=n.layout_center,r.setDoneJson(n.done_json),!0}catch(n){return ElMessage.error("请导入正确的数据模型!"),console.error(n),!1}},_hoisted_1$e={"aria-hidden":"true"},_hoisted_2$c=["xlink:href"],_sfc_main$j=vue.defineComponent({__name:"index",props:{name:{},props:{default:()=>({})}},setup(i){const n=i,r=vue.computed(()=>`#svg-${n.name}`);return(g,V)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$e,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(r)},n.props),null,16,_hoisted_2$c)]))}});var EVisibleConfKey=(i=>(i.ImportJson="ImportJson",i.ExportJson="ExportJson",i.ImportFile="ImportFile",i))(EVisibleConfKey||{});const _withScopeId$2=i=>(vue.pushScopeId("data-v-383da0a2"),i=i(),vue.popScopeId(),i),_hoisted_1$d={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$b={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$a=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$8={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$4={class:"flex items-center mr-20px"},_hoisted_7$4={class:"flex items-center",style:{width:"250px"}},_hoisted_8$3=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title",style:{"padding-top":"16px"}},"多选",-1)),_hoisted_9$3=_withScopeId$2(()=>vue.createElementVNode("div",null,"鼠标按住左键可以框选,也可以按住ctrl+鼠标左键点图形进行多选",-1)),_hoisted_10$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_11$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"拖动画布",-1)),_hoisted_12$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"右键画布然后拖动即可,右侧面板‘图纸’栏可微调或重置位置",-1)),_hoisted_13$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_14$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"画布缩放",-1)),_hoisted_15$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放",-1)),_hoisted_16$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18=_withScopeId$2(()=>vue.createElementVNode("div",null,"在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线",-1)),_hoisted_19=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_20=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"连线样式",-1)),_hoisted_21=_withScopeId$2(()=>vue.createElementVNode("div",null,"在右侧‘连线’栏可以统一配置连线样式,配置后先增加的线会应用新样式,之前的线样式不变,如需改变,可选中线手动更改或删除重画 ",-1)),_hoisted_22=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_23=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"横线和竖线",-1)),_hoisted_24=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null," 点击编辑器顶部连线按钮会进入连线状态,该状态下在画板点击鼠标左键即可开始画线,移动并再次点击左键创建新的节点,右键结束画线并退出连线状态;"),vue.createElementVNode("p",null,"画线的时候按住ctrl即可画竖线,按住shift即可画横线")],-1)),_hoisted_25=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_26=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"绑定锚点",-1)),_hoisted_27=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null,"组件在未选中时,鼠标经过组件时会出现锚点,鼠标悬浮在锚点上时,会有交互样式,点击左键即可以锚点为起点创建连线;"),vue.createElementVNode("p",null,"同样,在连线时鼠标经过锚点时,会出现锚点交互样式,点击左键即可以锚点为连线终点结束连线;"),vue.createElementVNode("p",null,"这两种情况下的连线会绑定组件上的锚点,如需解绑,参考下面的‘锚点解绑’;"),vue.createElementVNode("p",null,"同样,也可先画线,再选中连线绑定想要绑定的组件锚点(连线只有首尾节点可以绑定锚点)")],-1)),_hoisted_28=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_29=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"线段选中",-1)),_hoisted_30=_withScopeId$2(()=>vue.createElementVNode("div",null," 若线段绑定了锚点,移动线段,绑定的锚点不会移动。若是想将线段整体移动,需要先解绑,参考下面的‘锚点解绑’ ",-1)),_hoisted_31=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_32=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"锚点解绑",-1)),_hoisted_33=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$i=vue.defineComponent({__name:"index",emits:["changeVisible","onReturn","onPreview","onSave"],setup(i,{emit:n}){const r=useSvgEditLayoutStore(pinia),g=useGlobalStore(pinia),V=useEditPrivateStore(pinia),k=useConfigStore(pinia),$=()=>{g.done_json.length<=0||g.setDoneJson([]),g.intention=EGlobalStoreIntention.None},oe=ie=>{const ae={layout_center:r.center_offset,config:k.$state,done_json:g.done_json};n(ie,ae)},re=vue.ref(!1),Ce=vue.computed({get:()=>g.intention===EGlobalStoreIntention.Connection,set(ie){g.intention=ie?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,ie&&g.setHandleSvgInfo(null)}});return(ie,ae)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$d,[vue.createElementVNode("div",_hoisted_2$b,[_hoisted_3$a,vue.createVNode(vue.unref(ElIcon),{size:24,class:"bt-Icon",onClick:ae[0]||(ae[0]=le=>vue.unref(r).left_nav=!vue.unref(r).left_nav),title:vue.unref(r).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(r).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$j,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$j,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$8,[vue.createElementVNode("div",_hoisted_5$6,[vue.createVNode(vue.unref(ElIcon),{title:"撤销 ctrl+z",size:24,class:vue.normalizeClass(`${vue.unref(V).getTopBtnUndoStatus?"bt-Icon":"icon-disable"} ml-20px`),onClick:ae[1]||(ae[1]=()=>vue.unref(V).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:vue.unref(V).getTopBtnUndoStatus?"undo":"undo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(ElIcon),{title:"重做 ctrl+shift+z",class:vue.normalizeClass(`${vue.unref(V).getTopBtnRedoStatus?"bt-Icon":"icon-disable"} ml-5px`),size:24,onClick:ae[2]||(ae[2]=()=>vue.unref(V).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:vue.unref(V).getTopBtnRedoStatus?"redo":"redo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"清空 ctrl+delete",class:vue.normalizeClass(vue.unref(g).done_json.length>0?"bt-Icon":"icon-disable"),size:24,onClick:$},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:vue.unref(g).done_json.length>0?"delete":"delete-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"导入数据模型",class:"bt-Icon",size:24,onClick:ae[3]||(ae[3]=le=>n("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"import"})]),_:1}),vue.createVNode(vue.unref(ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:ae[4]||(ae[4]=le=>n("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"export"})]),_:1}),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"创建连线",class:vue.normalizeClass(["bt-Icon",{active:vue.unref(Ce)}]),size:24,onClick:ae[5]||(ae[5]=le=>Ce.value=!vue.unref(Ce))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:vue.unref(Ce)?"line-active":"line"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"说明",class:"bt-Icon",size:24,onClick:ae[6]||(ae[6]=le=>re.value=!vue.unref(re))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$4,[vue.createVNode(vue.unref(ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:ae[7]||(ae[7]=le=>oe("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"return"})]),_:1}),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:ae[8]||(ae[8]=le=>oe("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"save"})]),_:1}),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:ae[9]||(ae[9]=le=>oe("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$4,[vue.createVNode(vue.unref(ElIcon),{size:24,class:"bt-Icon",onClick:ae[10]||(ae[10]=le=>vue.unref(r).right_nav=!vue.unref(r).right_nav),title:vue.unref(r).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(r).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$j,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$j,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(ElDialog),{modelValue:vue.unref(re),"onUpdate:modelValue":ae[11]||(ae[11]=le=>vue.isRef(re)?re.value=le:null),title:"使用说明",width:"60%",class:"guide-dialog"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$3,_hoisted_9$3,_hoisted_10$2,_hoisted_11$2,_hoisted_12$1,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$1,_hoisted_17,_hoisted_18,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32,_hoisted_33]),_:1})]),_:1},8,["modelValue"])],64))}}),index_vue_vue_type_style_index_0_scoped_383da0a2_lang="",index_vue_vue_type_style_index_1_lang$1="",TopPanel=_export_sfc(_sfc_main$i,[["__scopeId","data-v-383da0a2"]]),_hoisted_1$c={class:"component-group flex flex-wrap"},_hoisted_2$a=["onDragstart","title"],_sfc_main$h=vue.defineComponent({__name:"index",props:{customToolbar:{}},setup(i){const n=i,r=useGlobalStore(pinia),g=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:r.config_center),V=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),k=oe=>{r.setCreateInfo(oe)},$=oe=>{var re;if(((re=oe.dataTransfer)==null?void 0:re.dropEffect)!=="copy"){ElMessage.warning("请将组件拖到画布中!"),r.intention=EGlobalStoreIntention.None;return}};return(oe,re)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(V),"onUpdate:modelValue":re[0]||(re[0]=Ce=>vue.isRef(V)?V.value=Ce:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),Ce=>(vue.openBlock(),vue.createBlock(vue.unref(ElCollapseItem),{name:Ce.groupType,key:Ce.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(Ce.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$c,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(Ce.list,ie=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:ie.name,draggable:"true",onDragstart:ae=>k(ie),onDragend:$,title:ie.title},[vue.createVNode(vue.unref(ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:ie.name,props:vue.unref(prosToVBind)(ie)},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$a))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),index_vue_vue_type_style_index_0_scoped_c7e50a4b_lang="",LeftPanel=_export_sfc(_sfc_main$h,[["__scopeId","data-v-c7e50a4b"]]),calculateLeftTop=(i,n,r)=>{const g=getCenterPoint(i,n),V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate(n,g,-r);return{width:k.x-V.x,height:k.y-V.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(i,n,r)=>{const g=getCenterPoint(i,n),V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate(n,g,-r);return{width:V.x-k.x,height:k.y-V.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(i,n,r)=>{const g=getCenterPoint(i,n),V=calculateRotatedPointCoordinate(n,g,-r),k=calculateRotatedPointCoordinate(i,g,-r);return{width:k.x-V.x,height:k.y-V.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(i,n,r)=>{const g=getCenterPoint(i,n),V=calculateRotatedPointCoordinate(n,g,-r),k=calculateRotatedPointCoordinate(i,g,-r);return{width:V.x-k.x,height:k.y-V.y,is_old_width:!1,is_old_height:!1}},calculateTop=(i,n,r,g)=>{const V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate({x:g.x,y:V.y},g,r),$=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);return{width:1,height:Math.round($),is_old_width:!0,is_old_height:!1}},calculateRight=(i,n,r,g)=>{const V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate({x:V.x,y:g.y},g,r),$=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);return{width:Math.round($),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(i,n,r,g)=>{const V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate({x:g.x,y:V.y},g,r),$=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);return{width:1,height:Math.round($),is_old_width:!0,is_old_height:!1}},calculateLeft=(i,n,r,g)=>{const V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate({x:V.x,y:g.y},g,r),$=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);return{width:Math.round($),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$b={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$9=["fill","x","y"],_hoisted_3$9=["cx","cy"],_hoisted_4$7=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$3=["fill","x","y"],_hoisted_7$3=["fill","x","y"],_hoisted_8$2=["fill","x","y"],_hoisted_9$2=["fill","x","y"],_hoisted_10$1=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$g=vue.defineComponent({__name:"index",props:{itemInfo:{}},setup(i){const n=i;vue.useCssVars(ae=>({"70f7dc54":vue.unref($)}));const r=useGlobalStore(pinia),g=useConfigStore(pinia),V=useSvgEditLayoutStore(pinia),k=vue.ref(4),$=vue.ref("#ab712e"),oe=[{start:338,end:23,cursor:"nw",type:EScaleInfoType.TopLeft},{start:23,end:68,cursor:"n",type:EScaleInfoType.TopCenter},{start:68,end:113,cursor:"ne",type:EScaleInfoType.TopRight},{start:293,end:338,cursor:"w",type:EScaleInfoType.Left},{start:113,end:158,cursor:"e",type:EScaleInfoType.Right},{start:248,end:293,cursor:"sw",type:EScaleInfoType.BottomLeft},{start:203,end:248,cursor:"s",type:EScaleInfoType.BottomCenter},{start:158,end:203,cursor:"se",type:EScaleInfoType.BottomRight}],re=(ae,le)=>{console.log("handMousedown",le);const{clientX:Ie,clientY:ue}=le;le.stopPropagation(),r.intention=EGlobalStoreIntention.Zoom;const de=Math.round((Ie-V.canvasInfo.left)/g.svg.scale-V.center_offset.x),Ne=Math.round((ue-V.canvasInfo.top)/g.svg.scale-V.center_offset.y);r.mouse_info={state:EMouseInfoState.Down,position_x:de,position_y:Ne,now_position_x:de,now_position_y:Ne,new_position_x:0,new_position_y:0},r.scale_info={type:ae,scale_times:{x:n.itemInfo.scale_x,y:n.itemInfo.scale_y},scale_item_info:{x:n.itemInfo.x,y:n.itemInfo.y},symmetric_point:{x:de+Math.abs(de-n.itemInfo.center_position.x)*2*(de>n.itemInfo.center_position.x?-1:1),y:Ne+Math.abs(Ne-n.itemInfo.center_position.y)*2*(Ne>n.itemInfo.center_position.y?-1:1)}}},Ce=ae=>{const{clientX:le,clientY:Ie}=ae,ue=Math.round((le-V.canvasInfo.left)/g.svg.scale-V.center_offset.x),de=Math.round((Ie-V.canvasInfo.top)/g.svg.scale-V.center_offset.y);ae.stopPropagation(),r.intention=EGlobalStoreIntention.Rotate,r.rotate_info={angle:n.itemInfo.rotate},r.mouse_info={state:EMouseInfoState.Down,position_x:ue,position_y:de,now_position_x:ue,now_position_y:de,new_position_x:0,new_position_y:0}},ie=ae=>{const le=(ae+n.itemInfo.rotate)%360,Ie=oe.find(ue=>ue.start<=le&&ue.end>le);return Ie?{cursor:Ie.cursor+"-resize",type:Ie.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(ae,le)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$b,[vue.createElementVNode("rect",{id:"resize_tl",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(0).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[0]||(le[0]=Ie=>re(vue.unref(EScaleInfoType).TopLeft,Ie))},null,44,_hoisted_2$9),vue.createElementVNode("circle",{cx:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,cy:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:Ce},null,40,_hoisted_3$9),vue.createElementVNode("line",{x1:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y1:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),x2:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y2:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref($),"stroke-width":2})},null,12,_hoisted_4$7),vue.createElementVNode("rect",{id:"resize_tc",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(45).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-vue.unref(k),y:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[1]||(le[1]=Ie=>re(vue.unref(EScaleInfoType).TopCenter,Ie))},null,44,_hoisted_5$5),vue.createElementVNode("rect",{id:"resize_tr",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(90).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width-vue.unref(k)+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[2]||(le[2]=Ie=>re(vue.unref(EScaleInfoType).TopRight,Ie))},null,44,_hoisted_6$3),vue.createElementVNode("rect",{id:"resize_l",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(315).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[3]||(le[3]=Ie=>re(vue.unref(EScaleInfoType).Left,Ie))},null,44,_hoisted_7$3),vue.createElementVNode("rect",{id:"resize_r",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(135).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[4]||(le[4]=Ie=>re(vue.unref(EScaleInfoType).Right,Ie))},null,44,_hoisted_8$2),vue.createElementVNode("rect",{id:"resize_bl",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(270).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[5]||(le[5]=Ie=>re(vue.unref(EScaleInfoType).BottomLeft,Ie))},null,44,_hoisted_9$2),vue.createElementVNode("rect",{id:"resize_bc",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(225).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)+n.itemInfo.actual_bound.width/2,y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[6]||(le[6]=Ie=>re(vue.unref(EScaleInfoType).BottomCenter,Ie))},null,44,_hoisted_10$1),vue.createElementVNode("rect",{id:"resize_br",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(180).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[7]||(le[7]=Ie=>re(vue.unref(EScaleInfoType).BottomRight,Ie))},null,44,_hoisted_11$1)]))}}),index_vue_vue_type_style_index_0_scoped_cbb58aff_lang="",HandlePanel=_export_sfc(_sfc_main$g,[["__scopeId","data-v-cbb58aff"]]),_hoisted_1$a=["fill"],_hoisted_2$8=["cx","cy","r"],_hoisted_3$8=["cx","cy","r"],_hoisted_4$6=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$2=["cx","cy","r"],_hoisted_7$2=["cx","cy","r"],_hoisted_8$1=["cx","cy","r"],_hoisted_9$1=["cx","cy","r"],_sfc_main$f=vue.defineComponent({__name:"index",props:{itemInfo:{}},setup(i){const n=i,r=vue.ref(4),g=vue.ref("#ab712e"),V=vue.ref(4),k=vue.ref(12),$=useGlobalStore(pinia),oe=vue.computed(()=>n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-r.value+V.value),re=vue.computed(()=>n.itemInfo.actual_bound.y-r.value-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+V.value),Ce=vue.computed(()=>n.itemInfo.actual_bound.x-r.value+n.itemInfo.actual_bound.width+getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+V.value),ie=vue.computed(()=>n.itemInfo.actual_bound.y-r.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+V.value),ae=vue.computed(()=>n.itemInfo.actual_bound.x-r.value+n.itemInfo.actual_bound.width/2+V.value),le=vue.computed(()=>n.itemInfo.actual_bound.y-r.value+n.itemInfo.actual_bound.height+getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+V.value),Ie=vue.computed(()=>n.itemInfo.actual_bound.x-r.value-getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+V.value),ue=vue.computed(()=>n.itemInfo.actual_bound.y-r.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+V.value),de=(he,pe)=>{var ze;$.intention===EGlobalStoreIntention.SetConnectionLineNode&&(he.stopPropagation(),(ze=$.handle_svg_info)!=null&&ze.info.bind_anchors&&$.connection_line_node_info&&($.connection_line_node_info.point_index===0?$.handle_svg_info.info.bind_anchors.start={type:pe,target_id:n.itemInfo.id}:$.connection_line_node_info.point_index===$.handle_svg_info.info.props.point_position.val.length-1&&($.handle_svg_info.info.bind_anchors.end={type:pe,target_id:n.itemInfo.id}),$.intention=EGlobalStoreIntention.None,$.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))},Ne=(he,pe)=>{var ze;$.intention===EGlobalStoreIntention.None?createLine(he,pe,n.itemInfo):$.intention===EGlobalStoreIntention.Connection&&(he.stopPropagation(),(ze=$.handle_svg_info)!=null&&ze.info.bind_anchors&&($.handle_svg_info.info.bind_anchors.end={type:pe,target_id:n.itemInfo.id},$.intention=EGlobalStoreIntention.None,$.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))};return(he,pe)=>(vue.openBlock(),vue.createElementBlock("g",{style:{"vector-effect":"non-scaling-stroke"},class:"connect-points",fill:vue.unref(g),"stroke-width":"2",stroke:"rgba(0,0,0,0)"},[vue.createElementVNode("g",{onMousedown:pe[0]||(pe[0]=ze=>Ne(ze,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:pe[1]||(pe[1]=ze=>de(ze,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(oe),cy:vue.unref(re),r:vue.unref(k),"fill-opacity":".3"},null,8,_hoisted_2$8),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(oe),cy:vue.unref(re),r:vue.unref(V),"pointer-events":"all"},null,8,_hoisted_3$8)],32),vue.createElementVNode("g",{onMousedown:pe[2]||(pe[2]=ze=>Ne(ze,vue.unref(ELineBindAnchors).Right)),onMouseup:pe[3]||(pe[3]=ze=>de(ze,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(Ce),cy:vue.unref(ie),r:vue.unref(k),"fill-opacity":".3"},null,8,_hoisted_4$6),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(Ce),cy:vue.unref(ie),r:vue.unref(V),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:pe[4]||(pe[4]=ze=>Ne(ze,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:pe[5]||(pe[5]=ze=>de(ze,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(ae),cy:vue.unref(le),r:vue.unref(k),"fill-opacity":".3"},null,8,_hoisted_6$2),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(ae),cy:vue.unref(le),r:vue.unref(V),"pointer-events":"all"},null,8,_hoisted_7$2)],32),vue.createElementVNode("g",{onMousedown:pe[6]||(pe[6]=ze=>Ne(ze,vue.unref(ELineBindAnchors).Left)),onMouseup:pe[7]||(pe[7]=ze=>de(ze,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(Ie),cy:vue.unref(ue),r:vue.unref(k),"fill-opacity":".3"},null,8,_hoisted_8$1),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(Ie),cy:vue.unref(ue),r:vue.unref(V),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$1)],32)],8,_hoisted_1$a))}}),index_vue_vue_type_style_index_0_scoped_bd67b211_lang="",ConnectionPanel=_export_sfc(_sfc_main$f,[["__scopeId","data-v-bd67b211"]]),_hoisted_1$9=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_2$7=["from","to","dur","repeatCount"],_hoisted_3$7=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$5=["from","to","dur","repeatCount"],_hoisted_5$3=["r","fill"],_hoisted_6$1=["path","dur","repeatCount"],_hoisted_7$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$e=vue.defineComponent({__name:"index",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(i){const n=i,r=useGlobalStore(pinia),g=useConfigStore(pinia),V=useSvgEditLayoutStore(pinia),k=($,oe,re,Ce)=>{if(r.intention===EGlobalStoreIntention.Connection)return;r.setHandleSvgInfo(n.itemInfo);const{clientX:ie,clientY:ae}=oe;oe.stopPropagation(),r.connection_line_node_info={init_pos:{x:re,y:Ce},point_index:$},r.intention=EGlobalStoreIntention.SetConnectionLineNode,r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((ae-V.canvasInfo.top)/g.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0}};return($,oe)=>{var re,Ce,ie,ae,le;return vue.openBlock(),vue.createElementBlock("g",null,[vue.createElementVNode("path",{id:n.itemInfo.id,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none",stroke:((re=n.itemInfo.animations)==null?void 0:re.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.animations.color.val:n.itemInfo.props.stroke.val,"stroke-width":n.itemInfo.props["stroke-width"].val,style:vue.normalizeStyle({cursor:vue.unref(r).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"}),"stroke-dashoffset":"0","stroke-dasharray":((Ce=n.itemInfo.animations)==null?void 0:Ce.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.props["stroke-width"].val*3:0},[((ie=n.itemInfo.animations)==null?void 0:ie.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_2$7)):vue.createCommentVNode("",!0)],12,_hoisted_1$9),((ae=n.itemInfo.animations)==null?void 0:ae.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:n.itemInfo.animations.color.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dasharray":n.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_4$5)],8,_hoisted_3$7)):((le=n.itemInfo.animations)==null?void 0:le.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:n.itemInfo.props["stroke-width"].val*2,fill:n.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(n.itemInfo.animations.reverse.val?[...n.itemInfo.props.point_position.val].reverse():n.itemInfo.props.point_position.val),dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_6$1)],8,_hoisted_5$3)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(Ie,ue)=>(vue.openBlock(),vue.createElementBlock("circle",{key:ue,cx:Ie.x,cy:Ie.y,r:n.itemInfo.props.point_r.val,"stroke-width":"1",stroke:n.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:de=>k(ue,de,Ie.x,Ie.y)},null,40,_hoisted_7$1))),128))])])}}}),_hoisted_1$8={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_2$6=["stroke"],_hoisted_3$6=["stroke"],_hoisted_4$4=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_7=["transform"],_hoisted_8=["transform"],_hoisted_9=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_10=["xlink:href","id","transform"],_hoisted_11=["id"],_hoisted_12=["id","x1","y1","x2","y2"],_hoisted_13=["id"],_hoisted_14=["x","y","height","width"],_hoisted_15=["onClick"],_hoisted_16={class:"shortcut"},_sfc_main$d=vue.defineComponent({__name:"index",setup(i){vue.useCssVars(ti=>({f379ff00:ie.value}));const n=vue.getCurrentInstance();Object.keys(vueComp).forEach(ti=>{var ei;Object.keys((ei=n==null?void 0:n.appContext)==null?void 0:ei.components).includes(ti)||n==null||n.appContext.app.component(ti,vueComp[ti])});const r=useGlobalStore(pinia),g=useConfigStore(pinia),V=useSvgEditLayoutStore(pinia),k=useEditPrivateStore(pinia),$=useContextMenuStore(pinia),oe=vue.ref(),re=vue.ref(),Ce={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},ie=vue.computed(()=>Object.keys(Ce).indexOf(r.intention)>-1?Ce[r.intention]:"default"),ae=vue.reactive({handle_panel:vue.computed(()=>r.intention===EGlobalStoreIntention.Select||r.intention===EGlobalStoreIntention.Zoom||r.intention===EGlobalStoreIntention.Rotate),connection_panel:!1,connection_line:!1,select_item:{info:null,index:-1}}),le=vue.ref({a:{x:0,y:0},b:{x:0,y:0}}),Ie=vue.computed(()=>r.intention===EGlobalStoreIntention.SelectArea&&le.value.b.x&&le.value.b.y?{with:Math.abs(le.value.b.x-le.value.a.x),height:Math.abs(le.value.b.y-le.value.a.y),x:le.value.a.x<le.value.b.x?le.value.a.x:le.value.b.x,y:le.value.a.y<le.value.b.y?le.value.a.y:le.value.b.y}:{with:0,height:0,x:0,y:0}),ue=vue.computed(()=>{let ti=0;for(let ei of r.done_json)ei.selected&&ti++;return ti>0});let de=!1,Ne=!1;const he=ti=>{var ei;if(r.intention!=EGlobalStoreIntention.None){if(r.intention==EGlobalStoreIntention.Create){if(!r.create_svg_info){console.error("要创建的数据获取失败");return}const Lt=Math.floor(ti.offsetX/g.svg.scale-V.center_offset.x),ni=Math.floor(ti.offsetY/g.svg.scale-V.center_offset.y),ri={id:randomString(),x:Lt,y:ni,client:{x:Lt,y:ni},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},selected:!1,...objectDeepClone(r.create_svg_info)};r.setDoneJson(ri),r.setHandleSvgInfo(ri,r.done_json.length),r.intention=EGlobalStoreIntention.None}(ei=re.value)==null||ei.focus()}},pe=ti=>{ti.preventDefault()},ze=ti=>{ti.preventDefault()},xe=(ti,ei,Lt)=>{var ni,ri;if((ni=re.value)==null||ni.focus(),r.intention!==EGlobalStoreIntention.Connection)if(Lt.preventDefault(),Lt.stopPropagation(),Lt.ctrlKey&&Lt.button===0)(ri=r.handle_svg_info)!=null&&ri.index&&(r.done_json[r.handle_svg_info.index].selected=!0,r.setHandleSvgInfo(null),ti.selected=!ti.selected);else if(ue.value){r.intention=EGlobalStoreIntention.GroupMove,r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Lt.clientX-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((Lt.clientY-V.canvasInfo.top)/g.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0};for(let Ii of r.done_json)Ii.selected&&(Ii.old_position={x:Ii.x,y:Ii.y},Ii.point_coordinate_old=objectDeepClone(Ii.point_coordinate))}else r.intention=EGlobalStoreIntention.Select,r.setHandleSvgInfo(ti,ei),r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Lt.clientX-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((Lt.clientY-V.canvasInfo.top)/g.svg.scale),now_position_x:ti.x,now_position_y:ti.y,new_position_x:0,new_position_y:0},ti.point_coordinate_old=objectDeepClone(ti.point_coordinate)},Oe=(ti,ei,Lt)=>{if(!(r.intention===EGlobalStoreIntention.Connection||r.mouse_info.state!=EMouseInfoState.Down)&&ue.value&&!de&&["SelectArea","Move","Select"].indexOf(r.intention)<0){for(let ni of r.done_json)ni.selected=!1,ni.old_position={x:0,y:0},resetHandlePointOld(ni);r.intention=EGlobalStoreIntention.Select,r.setHandleSvgInfo(ti,ei),r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Lt.clientX-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((Lt.clientY-V.canvasInfo.top)/g.svg.scale),now_position_x:ti.x,now_position_y:ti.y,new_position_x:0,new_position_y:0}}},_e=(ti,ei,Lt)=>{Lt.preventDefault(),Lt.stopPropagation(),ae.connection_panel=!0,ae.connection_line=!0,!((r.intention===EGlobalStoreIntention.Connection||r.intention===EGlobalStoreIntention.SetConnectionLineNode)&&ti.type===EDoneJsonType.ConnectionLine)&&(ae.select_item.info=ti,ae.select_item.index=ei)},At=(ti,ei,Lt)=>{Lt.preventDefault(),Lt.stopPropagation(),!((r.intention===EGlobalStoreIntention.Connection||r.intention===EGlobalStoreIntention.SetConnectionLineNode)&&ti.type===EDoneJsonType.ConnectionLine)&&(ae.connection_panel=!1,ae.connection_line=!1,ae.select_item.info=null,ae.select_item.index=-1)},$e=ti=>{var Ii,wi,ai,di,hi,ci,Ai,yi,ui,Ci,zi,Ni,Mi,mi,vi,bi;if(r.mouse_info.state!=EMouseInfoState.Down&&r.intention!==EGlobalStoreIntention.Connection)return;const{clientX:ei,clientY:Lt}=ti;r.mouse_info.new_position_x=Math.round((ei-V.canvasInfo.left)/g.svg.scale),r.mouse_info.new_position_y=Math.round((Lt-V.canvasInfo.top)/g.svg.scale);const ni=Math.round(r.mouse_info.new_position_x-r.mouse_info.position_x+r.mouse_info.now_position_x),ri=Math.round(r.mouse_info.new_position_y-r.mouse_info.position_y+r.mouse_info.now_position_y);if((Ii=r.handle_svg_info)!=null&&Ii.info&&(r.intention===EGlobalStoreIntention.Select||r.intention===EGlobalStoreIntention.Move)){if(r.handle_svg_info.info.x=ni,r.handle_svg_info.info.y=ri,r.handle_svg_info.info.client={x:ni,y:ri},r.intention=EGlobalStoreIntention.Move,moveHandlePoint(r.handle_svg_info.info),moveAnchors(r.handle_svg_info.info),r.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((wi=r.handle_svg_info.info.bind_anchors)!=null&&wi.start){let gi=null;for(let li of r.done_json)li.id===((di=(ai=r.handle_svg_info.info.bind_anchors)==null?void 0:ai.start)==null?void 0:di.target_id)&&(gi=li);gi&&moveAnchors(gi)}if((hi=r.handle_svg_info.info.bind_anchors)!=null&&hi.end){let gi=null;for(let li of r.done_json)li.id===((Ai=(ci=r.handle_svg_info.info.bind_anchors)==null?void 0:ci.end)==null?void 0:Ai.target_id)&&(gi=li);gi&&moveAnchors(gi)}}}else if(r.intention===EGlobalStoreIntention.MoveCanvas)V.center_offset.x=ni,V.center_offset.y=ri;else if(r.intention===EGlobalStoreIntention.SelectArea)le.value.b.x=r.mouse_info.new_position_x-V.center_offset.x,le.value.b.y=r.mouse_info.new_position_y-V.center_offset.y;else if(r.intention===EGlobalStoreIntention.GroupMove){de=!0;for(let gi of r.done_json)if(gi.selected&&gi.old_position){const li=Math.round(r.mouse_info.new_position_x-r.mouse_info.position_x+gi.old_position.x),oi=Math.round(r.mouse_info.new_position_y-r.mouse_info.position_y+gi.old_position.y);if(gi.x=li,gi.y=oi,gi.client={x:li,y:oi},moveHandlePoint(gi),moveAnchors(gi),gi.type===EDoneJsonType.ConnectionLine&&((yi=gi.bind_anchors)!=null&&yi.end)){let Et=null;for(let ii of r.done_json)ii.id===((Ci=(ui=gi.bind_anchors)==null?void 0:ui.end)==null?void 0:Ci.target_id)&&(Et=ii);Et&&moveAnchors(Et)}}}else if(r.intention===EGlobalStoreIntention.Zoom){if(!r.handle_svg_info)return;const gi={x:r.mouse_info.new_position_x-V.center_offset.x,y:r.mouse_info.new_position_y-V.center_offset.y};let li={width:0,height:0,is_old_width:!1,is_old_height:!1};if(r.scale_info.type===EScaleInfoType.TopLeft?li=calculateLeftTop(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate):r.scale_info.type===EScaleInfoType.TopRight?li=calculateRightTop(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate):r.scale_info.type===EScaleInfoType.BottomRight?li=calculateRightBottom(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate):r.scale_info.type===EScaleInfoType.BottomLeft?li=calculateLeftBottom(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate):r.scale_info.type===EScaleInfoType.TopCenter?li=calculateTop(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate,r.handle_svg_info.info.client):r.scale_info.type===EScaleInfoType.Right?li=calculateRight(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate,r.handle_svg_info.info.client):r.scale_info.type===EScaleInfoType.BottomCenter?li=calculateBottom(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate,r.handle_svg_info.info.client):r.scale_info.type===EScaleInfoType.Left&&(li=calculateLeft(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate,r.handle_svg_info.info.client)),r.handle_svg_info&&li.width>0&&li.height>0){const oi=li.is_old_width?1:parseFloat((li.width/r.handle_svg_info.info.actual_bound.width).toFixed(3)),Et=li.is_old_height?1:parseFloat((li.height/r.handle_svg_info.info.actual_bound.height).toFixed(3)),ii=getCenterPoint(gi,r.scale_info.symmetric_point);oi>0&&r.scale_info.type!==EScaleInfoType.TopCenter&&r.scale_info.type!==EScaleInfoType.BottomCenter&&(r.handle_svg_info.info.scale_x=oi,r.handle_svg_info.info.x=Math.round(getSvgNowPosition(r.handle_svg_info.info.center_position.x,ii.x,r.handle_svg_info.info.client.x))),Et>0&&r.scale_info.type!==EScaleInfoType.Left&&r.scale_info.type!==EScaleInfoType.Right&&(r.handle_svg_info.info.scale_y=Et,r.handle_svg_info.info.y=Math.round(getSvgNowPosition(r.handle_svg_info.info.center_position.y,ii.y,r.handle_svg_info.info.client.y)))}}else if(r.intention===EGlobalStoreIntention.Rotate){if(!r.handle_svg_info)return;const gi=Math.atan2(r.mouse_info.position_y-r.handle_svg_info.info.y,r.mouse_info.position_x-r.handle_svg_info.info.x)/(Math.PI/180),li=Math.atan2(r.mouse_info.new_position_y-V.center_offset.y-r.handle_svg_info.info.y,r.mouse_info.new_position_x-V.center_offset.x-r.handle_svg_info.info.x)/(Math.PI/180);r.handle_svg_info.info.rotate=parseFloat((r.rotate_info.angle+li-gi).toFixed(2))}else if(r.intention===EGlobalStoreIntention.Connection&&r.handle_svg_info){const gi=(zi=r.handle_svg_info)==null?void 0:zi.info.props.point_position.val.length,li=r.mouse_info.new_position_x-r.mouse_info.position_x-V.center_offset.x,oi=r.mouse_info.new_position_y-r.mouse_info.position_y-V.center_offset.y,Et=r.handle_svg_info.info.props.point_position.val[gi-2],ii=((Mi=(Ni=r.handle_svg_info)==null?void 0:Ni.info.props.point_r)==null?void 0:Mi.val)+2||4;let si=Et.x<li?-ii:Et.x>li?ii:0,fi=Et.y<oi?-ii:Et.y>oi?ii:0;ti.ctrlKey?r.handle_svg_info.info.props.point_position.val[gi-1]={x:Et.x,y:oi+fi}:ti.shiftKey?r.handle_svg_info.info.props.point_position.val[gi-1]={x:li+si,y:Et.y}:r.handle_svg_info.info.props.point_position.val[gi-1]={x:li+si,y:oi+fi}}else if(r.intention===EGlobalStoreIntention.SetConnectionLineNode&&r.handle_svg_info){!Ne&&(r.connection_line_node_info.point_index===r.handle_svg_info.info.props.point_position.val.length-1||r.connection_line_node_info.point_index===0)&&(Ne=!0);const gi=(mi=r.handle_svg_info)==null?void 0:mi.info.props.point_position.val.length,li=getSvgNowPosition(r.mouse_info.position_x,r.mouse_info.new_position_x,r.connection_line_node_info.init_pos.x),oi=getSvgNowPosition(r.mouse_info.position_y,r.mouse_info.new_position_y,r.connection_line_node_info.init_pos.y),Et=r.handle_svg_info.info.props.point_position.val[gi-2],ii=((bi=(vi=r.handle_svg_info)==null?void 0:vi.info.props.point_r)==null?void 0:bi.val)+2||4;let si=Et.x<li?-ii:Et.x>li?ii:0,fi=Et.y<oi?-ii:Et.y>oi?ii:0;r.handle_svg_info.info.props.point_position.val[r.connection_line_node_info.point_index]={x:li+si,y:oi+fi}}},Fe=()=>{var ti,ei,Lt,ni;if(r.mouse_info.state==EMouseInfoState.Down){if((ti=r.handle_svg_info)!=null&&ti.info&&r.intention==EGlobalStoreIntention.Move)setSvgActualInfo(r.done_json[r.handle_svg_info.index]),r.intention=EGlobalStoreIntention.None,r.setDoneJson(r.done_json);else if(r.intention==EGlobalStoreIntention.GroupMove)de&&(de=!1,r.intention=EGlobalStoreIntention.None);else if((ei=r.handle_svg_info)!=null&&ei.info&&r.intention==EGlobalStoreIntention.Zoom)r.handle_svg_info.info.client={x:r.handle_svg_info.info.x,y:r.handle_svg_info.info.y},r.intention=EGlobalStoreIntention.None,setSvgActualInfo(r.done_json[r.handle_svg_info.index]),r.setDoneJson(r.done_json);else if(r.intention===EGlobalStoreIntention.Rotate&&((Lt=r.handle_svg_info)!=null&&Lt.info))setSvgActualInfo(r.done_json[r.handle_svg_info.index]),r.setDoneJson(r.done_json),r.intention=EGlobalStoreIntention.None;else{if(r.intention===EGlobalStoreIntention.Connection)return;if(r.intention===EGlobalStoreIntention.SetConnectionLineNode)Ne&&((ni=r.handle_svg_info)!=null&&ni.info.bind_anchors)&&(r.connection_line_node_info.point_index===0?r.handle_svg_info.info.bind_anchors.start=null:r.handle_svg_info.info.bind_anchors.end=null),r.intention=EGlobalStoreIntention.None,Ne=!1;else if(r.intention===EGlobalStoreIntention.SelectArea){r.setHandleSvgInfo(null);for(let ri of r.done_json){const Ii=Ie.value;ri.selected=ri.x>Ii.x&&ri.x<Ii.x+Ii.with&&ri.y>Ii.y&&ri.y<Ii.y+Ii.height}r.intention=EGlobalStoreIntention.None}else r.intention!=EGlobalStoreIntention.Select&&(r.intention=EGlobalStoreIntention.None)}r.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},$.display=!1}},Ue=ti=>{const{clientX:ei,clientY:Lt}=ti;if(r.intention===EGlobalStoreIntention.Connection){r.handle_svg_info||createLine(ti),r.handle_svg_info&&(ti.button===0?r.handle_svg_info.info.props.point_position.val.length!==1?r.handle_svg_info.info.props.point_position.val.push({x:r.mouse_info.new_position_x-r.mouse_info.position_x-V.center_offset.x,y:r.mouse_info.new_position_y-r.mouse_info.position_y-V.center_offset.y}):r.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):ti.button===2&&(r.intention=EGlobalStoreIntention.None,setSvgActualInfo(r.done_json[r.handle_svg_info.index]),r.setHandleSvgInfo(null)));return}ti.button===0?(r.intention=EGlobalStoreIntention.SelectArea,r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ei-V.canvasInfo.left)/g.svg.scale-V.center_offset.x),position_y:Math.round((Lt-V.canvasInfo.top)/g.svg.scale-V.center_offset.y),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},le.value={a:{x:r.mouse_info.position_x,y:r.mouse_info.position_y},b:{x:0,y:0}}):ti.button===2&&(r.intention=EGlobalStoreIntention.MoveCanvas,r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ei-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((Lt-V.canvasInfo.top)/g.svg.scale),now_position_x:V.center_offset.x,now_position_y:V.center_offset.y,new_position_x:0,new_position_y:0})};function Ve(ti){ti!=null&&ti.wheelDelta&&(ti.wheelDelta>0?g.svg.scale=parseFloat((g.svg.scale+.1).toFixed(1)):g.svg.scale=parseFloat((g.svg.scale-.1).toFixed(1)))}const Dt=ti=>{ti.stopPropagation(),ti.preventDefault()},qe=(ti,ei,Lt)=>{r.intention!==EGlobalStoreIntention.Connection&&oe.value&&(r.intention=EGlobalStoreIntention.ContextMenu,r.setHandleSvgInfo(ti,ei),oe.value.style.left=Lt.pageX+"px",oe.value.style.top=Lt.pageY+"px",$.info.MoveUpOneLevel.enable=$.info.MoveUpTopLevel.enable=$.info.MoveDownOneLevel.enable=$.info.MoveDownTopLevel.enable=!0,ei===r.done_json.length-1&&($.info.MoveUpOneLevel.enable=$.info.MoveUpTopLevel.enable=!1),ei===0&&($.info.MoveDownOneLevel.enable=$.info.MoveDownTopLevel.enable=!1),$.display=!0)},kt=(ti,ei,Lt)=>({x:parseFloat((ti.x-ti.width/2*ei+ti.width/2).toFixed(1)),y:parseFloat((ti.y-ti.height/2*Lt+ti.height/2).toFixed(1)),width:parseFloat((ti.width*ei).toFixed(1)),height:parseFloat((ti.height*Lt).toFixed(1))}),jt=ti=>{ti.preventDefault();let ei=[];if(!ti.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(ti.key)>-1&&(ue.value?ei=r.done_json.map((Lt,ni)=>({selected:Lt.selected,i:ni})).filter(Lt=>Lt.selected).map(Lt=>Lt.i):r.handle_svg_info&&ei.push(r.handle_svg_info.index)),!ti.ctrlKey&&ti.key=="ArrowUp"){for(let Lt of ei)r.done_json[Lt].y-=1,r.done_json[Lt].client.y-=1,moveHandlePoint(r.done_json[Lt],0,-1),moveAnchors(r.done_json[Lt]);useHistoryRecord(r.done_json)}else if(!ti.ctrlKey&&ti.key=="ArrowDown"){for(let Lt of ei)r.done_json[Lt].y+=1,r.done_json[Lt].client.y+=1,moveHandlePoint(r.done_json[Lt],0,1),moveAnchors(r.done_json[Lt]);useHistoryRecord(r.done_json)}else if(!ti.ctrlKey&&ti.key=="ArrowLeft"){for(let Lt of ei)r.done_json[Lt].x-=1,r.done_json[Lt].client.x-=1,moveHandlePoint(r.done_json[Lt],-1,0),moveAnchors(r.done_json[Lt]);useHistoryRecord(r.done_json)}else if(!ti.ctrlKey&&ti.key=="ArrowRight"){for(let Lt of ei)r.done_json[Lt].x+=1,r.done_json[Lt].client.x+=1,moveHandlePoint(r.done_json[Lt],1,0),moveAnchors(r.done_json[Lt]);useHistoryRecord(r.done_json)}else ti.ctrlKey&&ti.key.toLowerCase()=="c"?$.onContextMenuClick(EContextMenuInfoType.Copy):!ti.ctrlKey&&ti.key=="Delete"?ue.value?(r.setDoneJson(r.done_json.filter(Lt=>!Lt.selected)),r.setHandleSvgInfo(r.done_json[r.done_json.length-1],r.done_json.length-1)):$.onContextMenuClick(EContextMenuInfoType.Delete):ti.ctrlKey&&ti.key=="ArrowUp"?$.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):ti.ctrlKey&&ti.key=="ArrowDown"?$.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):ti.ctrlKey&&ti.key=="ArrowLeft"?$.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):ti.ctrlKey&&ti.key=="ArrowRight"?$.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):ti.ctrlKey&&ti.shiftKey&&ti.key.toLowerCase()=="z"?k.topRedoBtnClick():ti.ctrlKey&&ti.key.toLowerCase()=="z"?k.topUndoBtnClick():ti.ctrlKey&&ti.key.toLowerCase()=="delete"&&(r.done_json.length<=0||r.setDoneJson([]))},Pt=()=>{setSvgActualInfo(r.done_json[r.handle_svg_info.index],!0)};return vue.onMounted(()=>{var ti;(ti=re.value)==null||ti.focus(),vue.nextTick(function(){var Lt;const ei=(Lt=re.value)==null?void 0:Lt.getBoundingClientRect();V.canvasInfo={height:(ei==null?void 0:ei.height)||0,with:(ei==null?void 0:ei.width)||0,top:(ei==null?void 0:ei.top)||0,left:(ei==null?void 0:ei.left)||0}})}),(ti,ei)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{class:"canvas",tabindex:"0",ref_key:"canvasRef",ref:re,onDrop:he,onDragenter:pe,onDragover:ze,onMousedown:Ue,onMousemove:$e,onMouseup:Fe,onContextmenu:Dt,onKeydown:jt,onMousewheel:Ve},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(g).svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_1$8,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(g).svg.grid_color},null,8,_hoisted_2$6),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(g).svg.grid_color},null,8,_hoisted_3$6),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(g).svg.grid_color},null,8,_hoisted_4$4),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(g).svg.grid_color},null,8,_hoisted_5$2)])]),vue.unref(g).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_6)):vue.createCommentVNode("",!0),vue.createElementVNode("g",{transform:`translate(${vue.unref(V).center_offset.x*vue.unref(g).svg.scale},${vue.unref(V).center_offset.y*vue.unref(g).svg.scale})rotate(0)scale(${vue.unref(g).svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).done_json,(Lt,ni)=>{var ri,Ii,wi,ai,di,hi;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:Lt.id,transform:`translate(${Lt.x},${Lt.y})rotate(0)scale(1)`},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(Lt)}`)},[vue.createElementVNode("g",{transform:`translate(${Lt.actual_bound.x+Lt.actual_bound.width/2},${Lt.actual_bound.y+Lt.actual_bound.height/2})rotate(${Lt.rotate}) scale(1) translate(${-(Lt.actual_bound.x+Lt.actual_bound.width/2)},${-(Lt.actual_bound.y+Lt.actual_bound.height/2)})`,onMousedown:ci=>xe(Lt,ni,ci),onMouseup:ci=>Oe(Lt,ni,ci),onMouseenter:ci=>_e(Lt,ni,ci),onMouseleave:ci=>At(Lt,ni,ci),onContextmenu:ci=>qe(Lt,ni,ci)},[Lt.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$e,{key:0,"item-info":Lt,"point-visible":vue.unref(ae).connection_line&&((ri=vue.unref(ae).select_item.info)==null?void 0:ri.id)==Lt.id},null,8,["item-info","point-visible"])):Lt.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${Lt.name}`},vue.unref(prosToVBind)(Lt),{width:"100",height:"100",id:Lt.id,transform:`translate(${Lt.actual_bound.x+Lt.actual_bound.width/2},${Lt.actual_bound.y+Lt.actual_bound.height/2}) scale(${Lt.scale_x},${Lt.scale_y}) translate(${-(Lt.actual_bound.x+Lt.actual_bound.width/2)},${-(Lt.actual_bound.y+Lt.actual_bound.height/2)})`}),null,16,_hoisted_10)):Lt.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Lt.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(Lt),{width:"100",height:"100",id:Lt.id,onResize:Pt,transform:`translate(${Lt.actual_bound.x+Lt.actual_bound.width/2},${Lt.actual_bound.y+Lt.actual_bound.height/2}) scale(${Lt.scale_x},${Lt.scale_y}) translate(${-(Lt.actual_bound.x+Lt.actual_bound.width/2)},${-(Lt.actual_bound.y+Lt.actual_bound.height/2)})`}),null,16,["id","transform"])):Lt.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},kt(Lt.actual_bound,Lt.scale_x,Lt.scale_y),{id:`foreign-object${Lt.id}`}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Lt.tag),vue.mergeProps(vue.unref(prosToVBind)(Lt),{id:Lt.id,transform:`translate(${Lt.actual_bound.x+Lt.actual_bound.width/2},${Lt.actual_bound.y+Lt.actual_bound.height/2}) scale(${Lt.scale_x},${Lt.scale_y}) translate(${-(Lt.actual_bound.x+Lt.actual_bound.width/2)},${-(Lt.actual_bound.y+Lt.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(Lt.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_11)):Lt.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:Lt.id,x1:Lt.props.start_x.val,y1:Lt.props.start_y.val,x2:Lt.props.end_x.val,y2:Lt.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_12)):vue.createCommentVNode("",!0),Lt.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${Lt.id}`,fill:"black","fill-opacity":"0"},kt(Lt.actual_bound,Lt.scale_x,Lt.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!Lt.selected&&(vue.unref(r).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Move&&((Ii=vue.unref(r).handle_svg_info)==null?void 0:Ii.info.id)==Lt.id,"svg-item-select":vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Select&&((wi=vue.unref(r).handle_svg_info)==null?void 0:wi.info.id)==Lt.id,"svg-item-in-group":Lt.selected}}),null,16,_hoisted_13)):vue.createCommentVNode("",!0),((ai=vue.unref(r).handle_svg_info)==null?void 0:ai.info.id)===Lt.id&&vue.unref(ae).handle_panel&&Lt.config.can_zoom?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":Lt},null,8,["item-info"])):vue.createCommentVNode("",!0),!Lt.selected&&((di=vue.unref(ae).select_item.info)==null?void 0:di.id)==Lt.id&&vue.unref(ae).connection_panel&&Lt.config.have_anchor&&vue.unref(r).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(r).intention!==vue.unref(EGlobalStoreIntention).Select||Lt.id!==((hi=vue.unref(r).handle_svg_info)==null?void 0:hi.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:Dt,"item-info":Lt},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_9)],2)],8,_hoisted_8)),[[vue.vShow,Lt.display]])}),128)),vue.createElementVNode("rect",{x:Ie.value.x,y:Ie.value.y,height:Ie.value.height,width:Ie.value.with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_14)],8,_hoisted_7)],4))],544),vue.withDirectives(vue.createElementVNode("ul",{ref_key:"contextMenuRef",ref:oe,class:"contextMenu"},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref($).info,(Lt,ni)=>(vue.openBlock(),vue.createElementBlock("li",{key:Lt.title,onClick:ri=>vue.unref($).onContextMenuClick(ni)},[vue.createElementVNode("p",{class:vue.normalizeClass(Lt.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(Lt.title)+" ",1),vue.createElementVNode("span",_hoisted_16,vue.toDisplayString(Lt.hot_key),1)],2)],8,_hoisted_15))),128))],512),[[vue.vShow,vue.unref($).display]])],64))}}),index_vue_vue_type_style_index_0_scoped_e433e349_lang="",CenterPanel=_export_sfc(_sfc_main$d,[["__scopeId","data-v-e433e349"]]);var ace$2={exports:{}};(function(i,n){(function(){var r="ace",g=function(){return this}();!g&&typeof window<"u"&&(g=window);var V=function(ie,ae,le){if(typeof ie!="string"){V.original?V.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(le=ae),V.modules[ie]||(V.payloads[ie]=le,V.modules[ie]=null)};V.modules={},V.payloads={};var k=function(ie,ae,le){if(typeof ae=="string"){var Ie=re(ie,ae);if(Ie!=null)return le&&le(),Ie}else if(Object.prototype.toString.call(ae)==="[object Array]"){for(var ue=[],de=0,Ne=ae.length;de<Ne;++de){var he=re(ie,ae[de]);if(he==null&&$.original)return;ue.push(he)}return le&&le.apply(null,ue)||!0}},$=function(ie,ae){var le=k("",ie,ae);return le==null&&$.original?$.original.apply(this,arguments):le},oe=function(ie,ae){if(ae.indexOf("!")!==-1){var le=ae.split("!");return oe(ie,le[0])+"!"+oe(ie,le[1])}if(ae.charAt(0)=="."){var Ie=ie.split("/").slice(0,-1).join("/");for(ae=Ie+"/"+ae;ae.indexOf(".")!==-1&&ue!=ae;){var ue=ae;ae=ae.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return ae},re=function(ie,ae){ae=oe(ie,ae);var le=V.modules[ae];if(!le){if(le=V.payloads[ae],typeof le=="function"){var Ie={},ue={id:ae,uri:"",exports:Ie,packaged:!0},de=function(he,pe){return k(ae,he,pe)},Ne=le(de,Ie,ue);Ie=Ne||ue.exports,V.modules[ae]=Ie,delete V.payloads[ae]}le=V.modules[ae]=Ie||le}return le};function Ce(ie){var ae=g;ie&&(g[ie]||(g[ie]={}),ae=g[ie]),(!ae.define||!ae.define.packaged)&&(V.original=ae.define,ae.define=V,ae.define.packaged=!0),(!ae.require||!ae.require.packaged)&&($.original=ae.require,ae.require=$,ae.require.packaged=!0)}Ce(r)})(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(r,g,V){function k($,oe,re){Object.defineProperty($,oe,{value:re,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||k(String.prototype,"startsWith",function($,oe){return oe=oe||0,this.lastIndexOf($,oe)===oe}),String.prototype.endsWith||k(String.prototype,"endsWith",function($,oe){var re=this;(oe===void 0||oe>re.length)&&(oe=re.length),oe-=$.length;var Ce=re.indexOf($,oe);return Ce!==-1&&Ce===oe}),String.prototype.repeat||k(String.prototype,"repeat",function($){for(var oe="",re=this;$>0;)$&1&&(oe+=re),($>>=1)&&(re+=re);return oe}),String.prototype.includes||k(String.prototype,"includes",function($,oe){return this.indexOf($,oe)!=-1}),Object.assign||(Object.assign=function($){if($==null)throw new TypeError("Cannot convert undefined or null to object");for(var oe=Object($),re=1;re<arguments.length;re++){var Ce=arguments[re];Ce!=null&&Object.keys(Ce).forEach(function(ie){oe[ie]=Ce[ie]})}return oe}),Object.values||(Object.values=function($){return Object.keys($).map(function(oe){return $[oe]})}),Array.prototype.find||k(Array.prototype,"find",function($){for(var oe=this.length,re=arguments[1],Ce=0;Ce<oe;Ce++){var ie=this[Ce];if($.call(re,ie,Ce,this))return ie}}),Array.prototype.findIndex||k(Array.prototype,"findIndex",function($){for(var oe=this.length,re=arguments[1],Ce=0;Ce<oe;Ce++){var ie=this[Ce];if($.call(re,ie,Ce,this))return Ce}}),Array.prototype.includes||k(Array.prototype,"includes",function($,oe){return this.indexOf($,oe)!=-1}),Array.prototype.fill||k(Array.prototype,"fill",function($){for(var oe=this,re=oe.length>>>0,Ce=arguments[1],ie=Ce>>0,ae=ie<0?Math.max(re+ie,0):Math.min(ie,re),le=arguments[2],Ie=le===void 0?re:le>>0,ue=Ie<0?Math.max(re+Ie,0):Math.min(Ie,re);ae<ue;)oe[ae]=$,ae++;return oe}),Array.of||k(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(r,g,V){r("./es6-shim")}),ace.define("ace/lib/lang",["require","exports","module"],function(r,g,V){g.last=function(oe){return oe[oe.length-1]},g.stringReverse=function(oe){return oe.split("").reverse().join("")},g.stringRepeat=function(oe,re){for(var Ce="";re>0;)re&1&&(Ce+=oe),(re>>=1)&&(oe+=oe);return Ce};var k=/^\s\s*/,$=/\s\s*$/;g.stringTrimLeft=function(oe){return oe.replace(k,"")},g.stringTrimRight=function(oe){return oe.replace($,"")},g.copyObject=function(oe){var re={};for(var Ce in oe)re[Ce]=oe[Ce];return re},g.copyArray=function(oe){for(var re=[],Ce=0,ie=oe.length;Ce<ie;Ce++)oe[Ce]&&typeof oe[Ce]=="object"?re[Ce]=this.copyObject(oe[Ce]):re[Ce]=oe[Ce];return re},g.deepCopy=function oe(re){if(typeof re!="object"||!re)return re;var Ce;if(Array.isArray(re)){Ce=[];for(var ie=0;ie<re.length;ie++)Ce[ie]=oe(re[ie]);return Ce}if(Object.prototype.toString.call(re)!=="[object Object]")return re;Ce={};for(var ie in re)Ce[ie]=oe(re[ie]);return Ce},g.arrayToMap=function(oe){for(var re={},Ce=0;Ce<oe.length;Ce++)re[oe[Ce]]=1;return re},g.createMap=function(oe){var re=Object.create(null);for(var Ce in oe)re[Ce]=oe[Ce];return re},g.arrayRemove=function(oe,re){for(var Ce=0;Ce<=oe.length;Ce++)re===oe[Ce]&&oe.splice(Ce,1)},g.escapeRegExp=function(oe){return oe.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},g.escapeHTML=function(oe){return(""+oe).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},g.getMatchOffsets=function(oe,re){var Ce=[];return oe.replace(re,function(ie){Ce.push({offset:arguments[arguments.length-2],length:ie.length})}),Ce},g.deferredCall=function(oe){var re=null,Ce=function(){re=null,oe()},ie=function(ae){return ie.cancel(),re=setTimeout(Ce,ae||0),ie};return ie.schedule=ie,ie.call=function(){return this.cancel(),oe(),ie},ie.cancel=function(){return clearTimeout(re),re=null,ie},ie.isPending=function(){return re},ie},g.delayedCall=function(oe,re){var Ce=null,ie=function(){Ce=null,oe()},ae=function(le){Ce==null&&(Ce=setTimeout(ie,le||re))};return ae.delay=function(le){Ce&&clearTimeout(Ce),Ce=setTimeout(ie,le||re)},ae.schedule=ae,ae.call=function(){this.cancel(),oe()},ae.cancel=function(){Ce&&clearTimeout(Ce),Ce=null},ae.isPending=function(){return Ce},ae}}),ace.define("ace/lib/oop",["require","exports","module"],function(r,g,V){g.inherits=function(k,$){k.super_=$,k.prototype=Object.create($.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}})},g.mixin=function(k,$){for(var oe in $)k[oe]=$[oe];return k},g.implement=function(k,$){g.mixin(k,$)}}),ace.define("ace/lib/useragent",["require","exports","module"],function(r,g,V){g.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},g.getOS=function(){return g.isMac?g.OS.MAC:g.isLinux?g.OS.LINUX:g.OS.WINDOWS};var k=typeof navigator=="object"?navigator:{},$=(/mac|win|linux/i.exec(k.platform)||["other"])[0].toLowerCase(),oe=k.userAgent||"",re=k.appName||"";g.isWin=$=="win",g.isMac=$=="mac",g.isLinux=$=="linux",g.isIE=re=="Microsoft Internet Explorer"||re.indexOf("MSAppHost")>=0?parseFloat((oe.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((oe.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),g.isOldIE=g.isIE&&g.isIE<9,g.isGecko=g.isMozilla=oe.match(/ Gecko\/\d+/),g.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",g.isWebKit=parseFloat(oe.split("WebKit/")[1])||void 0,g.isChrome=parseFloat(oe.split(" Chrome/")[1])||void 0,g.isEdge=parseFloat(oe.split(" Edge/")[1])||void 0,g.isAIR=oe.indexOf("AdobeAIR")>=0,g.isAndroid=oe.indexOf("Android")>=0,g.isChromeOS=oe.indexOf(" CrOS ")>=0,g.isIOS=/iPad|iPhone|iPod/.test(oe)&&!window.MSStream,g.isIOS&&(g.isMac=!0),g.isMobile=g.isIOS||g.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(r,g,V){var k=r("./useragent"),$="http://www.w3.org/1999/xhtml";g.buildDom=function le(Ie,ue,de){if(typeof Ie=="string"&&Ie){var Ne=document.createTextNode(Ie);return ue&&ue.appendChild(Ne),Ne}if(!Array.isArray(Ie))return Ie&&Ie.appendChild&&ue&&ue.appendChild(Ie),Ie;if(typeof Ie[0]!="string"||!Ie[0]){for(var he=[],pe=0;pe<Ie.length;pe++){var ze=le(Ie[pe],ue,de);ze&&he.push(ze)}return he}var xe=document.createElement(Ie[0]),Oe=Ie[1],_e=1;Oe&&typeof Oe=="object"&&!Array.isArray(Oe)&&(_e=2);for(var pe=_e;pe<Ie.length;pe++)le(Ie[pe],xe,de);return _e==2&&Object.keys(Oe).forEach(function(At){var $e=Oe[At];At==="class"?xe.className=Array.isArray($e)?$e.join(" "):$e:typeof $e=="function"||At=="value"||At[0]=="$"?xe[At]=$e:At==="ref"?de&&(de[$e]=xe):At==="style"?typeof $e=="string"&&(xe.style.cssText=$e):$e!=null&&xe.setAttribute(At,$e)}),ue&&ue.appendChild(xe),xe},g.getDocumentHead=function(le){return le||(le=document),le.head||le.getElementsByTagName("head")[0]||le.documentElement},g.createElement=function(le,Ie){return document.createElementNS?document.createElementNS(Ie||$,le):document.createElement(le)},g.removeChildren=function(le){le.innerHTML=""},g.createTextNode=function(le,Ie){var ue=Ie?Ie.ownerDocument:document;return ue.createTextNode(le)},g.createFragment=function(le){var Ie=le?le.ownerDocument:document;return Ie.createDocumentFragment()},g.hasCssClass=function(le,Ie){var ue=(le.className+"").split(/\s+/g);return ue.indexOf(Ie)!==-1},g.addCssClass=function(le,Ie){g.hasCssClass(le,Ie)||(le.className+=" "+Ie)},g.removeCssClass=function(le,Ie){for(var ue=le.className.split(/\s+/g);;){var de=ue.indexOf(Ie);if(de==-1)break;ue.splice(de,1)}le.className=ue.join(" ")},g.toggleCssClass=function(le,Ie){for(var ue=le.className.split(/\s+/g),de=!0;;){var Ne=ue.indexOf(Ie);if(Ne==-1)break;de=!1,ue.splice(Ne,1)}return de&&ue.push(Ie),le.className=ue.join(" "),de},g.setCssClass=function(le,Ie,ue){ue?g.addCssClass(le,Ie):g.removeCssClass(le,Ie)},g.hasCssString=function(le,Ie){var ue=0,de;if(Ie=Ie||document,de=Ie.querySelectorAll("style")){for(;ue<de.length;)if(de[ue++].id===le)return!0}},g.removeElementById=function(le,Ie){Ie=Ie||document,Ie.getElementById(le)&&Ie.getElementById(le).remove()};var oe,re=[];g.useStrictCSP=function(le){oe=le,le==!1?Ce():re||(re=[])};function Ce(){var le=re;re=null,le&&le.forEach(function(Ie){ie(Ie[0],Ie[1])})}function ie(le,Ie,ue){if(!(typeof document>"u")){if(re){if(ue)Ce();else if(ue===!1)return re.push([le,Ie])}if(!oe){var de=ue;!ue||!ue.getRootNode?de=document:(de=ue.getRootNode(),(!de||de==ue)&&(de=document));var Ne=de.ownerDocument||de;if(Ie&&g.hasCssString(Ie,de))return null;Ie&&(le+=`
207
+ `)("x-vue-echarts")}catch{return w=!1}return w=!0}(),U="ecTheme",S=vue.defineComponent({name:"echarts",props:O(O({option:Object,theme:{type:[Object,String]},initOptions:Object,updateOptions:Object,group:String,manualUpdate:Boolean},_),L),emits:{},inheritAttrs:!1,setup:function(i,n){var r=n.attrs,g=vue.shallowRef(),V=vue.shallowRef(),k=vue.shallowRef(),$=vue.inject("ecTheme",null),oe=vue.inject("ecInitOptions",null),re=vue.inject("ecUpdateOptions",null),Ce=vue.toRefs(i),ie=Ce.autoresize,ae=Ce.manualUpdate,le=Ce.loading,Ie=Ce.loadingOptions,ue=vue.computed(function(){return k.value||i.option||null}),de=vue.computed(function(){return i.theme||j($,{})}),Ne=vue.computed(function(){return i.initOptions||j(oe,{})}),he=vue.computed(function(){return i.updateOptions||j(re,{})}),pe=vue.computed(function(){return function($e){var Fe={};for(var Ue in $e)x(Ue)||(Fe[Ue]=$e[Ue]);return Fe}(r)}),ze=vue.getCurrentInstance().proxy.$listeners;function xe($e){if(g.value){var Fe=V.value=init(g.value,de.value,Ne.value);i.group&&(Fe.group=i.group);var Ue=ze;Ue||(Ue={},Object.keys(r).filter(function(Dt){return Dt.indexOf("on")===0&&Dt.length>2}).forEach(function(Dt){var qe=Dt.charAt(2).toLowerCase()+Dt.slice(3);qe.substring(qe.length-4)==="Once"&&(qe="~".concat(qe.substring(0,qe.length-4))),Ue[qe]=r[Dt]})),Object.keys(Ue).forEach(function(Dt){var qe=Ue[Dt];if(qe){var kt=Dt.toLowerCase();kt.charAt(0)==="~"&&(kt=kt.substring(1),qe.__once__=!0);var jt=Fe;if(kt.indexOf("zr:")===0&&(jt=Fe.getZr(),kt=kt.substring(3)),qe.__once__){delete qe.__once__;var Pt=qe;qe=function(){for(var ti=[],ei=0;ei<arguments.length;ei++)ti[ei]=arguments[ei];Pt.apply(void 0,ti),jt.off(kt,qe)}}jt.on(kt,qe)}}),ie.value?vue.nextTick(function(){Fe&&!Fe.isDisposed()&&Fe.resize(),Ve()}):Ve()}function Ve(){var Dt=$e||ue.value;Dt&&Fe.setOption(Dt,he.value)}}function Oe(){V.value&&(V.value.dispose(),V.value=void 0)}var _e=null;vue.watch(ae,function($e){typeof _e=="function"&&(_e(),_e=null),$e||(_e=vue.watch(function(){return i.option},function(Fe,Ue){Fe&&(V.value?V.value.setOption(Fe,O({notMerge:Fe.value!==(Ue==null?void 0:Ue.value)},he.value)):xe())},{deep:!0}))},{immediate:!0}),vue.watch([de,Ne],function(){Oe(),xe()},{deep:!0}),vue.watchEffect(function(){i.group&&V.value&&(V.value.group=i.group)});var At=y(V);return function($e,Fe,Ue){var Ve=vue.inject("ecLoadingOptions",{}),Dt=vue.computed(function(){return O(O({},j(Ve,{})),Ue==null?void 0:Ue.value)});vue.watchEffect(function(){var qe=$e.value;qe&&(Fe.value?qe.showLoading(Dt.value):qe.hideLoading())})}(V,le,Ie),function($e,Fe,Ue){var Ve=null;vue.watch([Ue,$e,Fe],function(Dt,qe,kt){var jt=Dt[0],Pt=Dt[1],ti=Dt[2];jt&&Pt&&ti&&(Ve=throttle$1(function(){Pt.resize()},100),addListener(jt,Ve)),kt(function(){Ve&&jt&&removeListener(jt,Ve)})})}(V,ie,g),vue.onMounted(function(){xe()}),vue.onBeforeUnmount(function(){T&&g.value?g.value.__dispose=Oe:Oe()}),O({chart:V,root:g,setOption:function($e,Fe){i.manualUpdate&&(k.value=$e),V.value?V.value.setOption($e,Fe||{}):xe($e)},nonEventAttrs:pe},At)},render:function(){var i=O({},this.nonEventAttrs);return i.ref="root",i.class=i.class?["echarts"].concat(i.class):"echarts",vue.h("x-vue-echarts",i)}});const _sfc_main$m=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(i){const n=i;use([install$7,install$6,install$3,install$4,install]),vue.provide(U,"dark");const r=vue.reactive({title:{text:n.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:n.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:n.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(n,g=>{r.title.text=g.title,r.series[0].name=g.seriesName,r.series[0].data=g.seriesData}),(g,V)=>(vue.openBlock(),vue.createBlock(vue.unref(S),{class:"chart",option:vue.unref(r),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_0a4c1b1f_lang="",_export_sfc=(i,n)=>{const r=i.__vccOpts||i;for(const[g,V]of n)r[g]=V;return r},PieCharts=_export_sfc(_sfc_main$m,[["__scopeId","data-v-0a4c1b1f"]]),_hoisted_1$g=["id"],_hoisted_2$e=["id"],_hoisted_3$c=["fill"],_hoisted_4$a=["fill"],_hoisted_5$8=["fill"],_hoisted_6$6=vue.createElementVNode("path",{d:"M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z",fill:"#2D4375"},null,-1),_hoisted_7$6=vue.createElementVNode("path",{d:"M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z",fill:"#1E2D4F"},null,-1),_hoisted_8$5=["fill-opacity"],_hoisted_9$5=["fill-opacity"],_hoisted_10$4=["fill-opacity"],_hoisted_11$4=vue.createElementVNode("path",{d:"M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z",fill:"#CEEFF6"},null,-1),_hoisted_12$3=vue.createElementVNode("path",{d:"M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z",fill:"#FFFFFF"},null,-1),_hoisted_13$3=vue.createElementVNode("path",{d:"M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z",fill:"#CEEFF6"},null,-1),_hoisted_14$3=["xlink:href"],_sfc_main$l=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1}},emits:["onChange"],setup(i,{emit:n}){const r=i;return vue.watch(()=>r.isOpen,()=>{n("onChange")}),(g,V)=>(vue.openBlock(),vue.createElementBlock("g",{id:r.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${r.id}light-121`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z",fill:r.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$c),vue.createElementVNode("path",{d:"M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z",fill:r.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$a),vue.createElementVNode("path",{d:"M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z",fill:r.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$6,_hoisted_7$6,vue.createElementVNode("path",{d:"M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z",fill:"#FDB813","fill-opacity":r.isOpen?1:0},null,8,_hoisted_8$5),vue.createElementVNode("path",{d:"M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z",fill:"#FDB813","fill-opacity":r.isOpen?1:0},null,8,_hoisted_9$5),vue.createElementVNode("path",{d:"M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z",fill:"#FDB813","fill-opacity":r.isOpen?1:0},null,8,_hoisted_10$4),_hoisted_11$4,_hoisted_12$3,_hoisted_13$3],8,_hoisted_2$e),vue.createElementVNode("use",{"xlink:href":`#${r.id}light-121`,width:"100",height:"100"},null,8,_hoisted_14$3)],8,_hoisted_1$g))}}),_hoisted_1$f=["id"],_hoisted_2$d=["id"],_hoisted_3$b=vue.createElementVNode("path",{d:"M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z",fill:"#429BCF"},null,-1),_hoisted_4$9=vue.createElementVNode("path",{d:"M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z",fill:"#FFFFFF"},null,-1),_hoisted_5$7={d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z",fill:"#2D416C"},_hoisted_6$5=["from","to"],_hoisted_7$5={d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z",fill:"#365087"},_hoisted_8$4=["from","to"],_hoisted_9$4=vue.createElementVNode("path",{d:"M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z",fill:"#365087"},null,-1),_hoisted_10$3=vue.createElementVNode("path",{d:"M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z",fill:"#2D416C"},null,-1),_hoisted_11$3={d:"M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z",fill:"#C11B16"},_hoisted_12$2=["from","to"],_hoisted_13$2=vue.createElementVNode("path",{d:"M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z",fill:"#fff"},null,-1),_hoisted_14$2=["xlink:href"],_sfc_main$k=vue.defineComponent({__name:"clock-a",props:{id:{default:""}},setup(i){const n=i,r=vue.ref(new Date),g=r.value.getSeconds(),V=r.value.getMinutes(),k=Math.floor((r.value.getHours()+(V+g/60)/60)*30);return($,oe)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id},[vue.createElementVNode("symbol",{id:`${n.id}clock-a-n`,viewBox:"0 0 1024 1024"},[_hoisted_3$b,_hoisted_4$9,vue.createElementVNode("path",_hoisted_5$7,[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${-45+vue.unref(k)} 512.3 506.3`,to:`${315+vue.unref(k)} 512.3 506.3`,dur:"43200s",repeatCount:"indefinite"},null,8,_hoisted_6$5)]),vue.createElementVNode("path",_hoisted_7$5,[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${45+vue.unref(V)*6} 512.3 506.3`,to:`${405+vue.unref(V)*6} 512.3 506.3`,dur:"3600s",repeatCount:"indefinite"},null,8,_hoisted_8$4)]),_hoisted_9$4,_hoisted_10$3,vue.createElementVNode("path",_hoisted_11$3,[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${135.5+vue.unref(g)*6} 512.3 506.3`,to:`${495.5+vue.unref(g)*6} 512.3 506.3`,dur:"60s",repeatCount:"indefinite"},null,8,_hoisted_12$2)]),_hoisted_13$2],8,_hoisted_2$d),vue.createElementVNode("use",{"xlink:href":`#${n.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$f))}}),vueComp={"svg-text":_sfc_main$p,"el-button":ElButton,"progress-a":_sfc_main$r,"el-tag":ElTag,"common-table":_sfc_main$o,"pie-charts":PieCharts,"switch-a":_sfc_main$q,"now-time":_sfc_main$n,"light-a":_sfc_main$l,"clock-a":_sfc_main$k},config=[...svg_config,...vue_config],useGlobalStore=pinia$1.defineStore("global-store",{state:()=>({config_center:config,intention:EGlobalStoreIntention.None,create_svg_info:null,done_json:[],mouse_info:{state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},handle_svg_info:null,scale_info:{type:EScaleInfoType.None,scale_times:{x:1,y:1},scale_item_info:{x:0,y:0},symmetric_point:{x:0,y:0}},rotate_info:{angle:0},connection_line_node_info:{init_pos:{x:0,y:0},point_index:0}}),actions:{setCreateInfo(i){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=i},setDoneJson(i){isOfType(i,"id")?(this.done_json.push(i),vue.nextTick(()=>{setSvgActualInfo(i)})):this.done_json=objectDeepClone(i),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(i,n){let r=n;i?(!r&&r!=0&&(r=this.done_json.findIndex(g=>g.id===i.id)??-1),this.handle_svg_info={info:i,index:r}):this.handle_svg_info=i},spliceDoneJson(i){const n=useGlobalStore(),g=n.done_json.splice(i,1)[0];unbindAnchors(g.id),useHistoryRecord(n.done_json)}}}),useSvgEditLayoutStore=pinia$1.defineStore("svg-edit-layout-store",{state:()=>({left_nav:!0,right_nav:!0,center_offset:{x:0,y:0},canvasInfo:{with:0,height:0,top:0,left:0}})}),randomString=i=>{i=i||10;const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length;let g="";for(let V=0;V<i;V++){let k=r;V===0&&(k=r-10),g+=n.charAt(Math.floor(Math.random()*k))}return g},isOfType=(i,n)=>i[n]!==void 0,getCoordinateOffset=(i,n)=>i/2*(n-1),angleToRadian=i=>i*Math.PI/180,calculateRotatedPointCoordinate=(i,n,r)=>({x:parseFloat(((i.x-n.x)*Math.cos(angleToRadian(r))-(i.y-n.y)*Math.sin(angleToRadian(r))+n.x).toFixed(1)),y:parseFloat(((i.x-n.x)*Math.sin(angleToRadian(r))+(i.y-n.y)*Math.cos(angleToRadian(r))+n.y).toFixed(1))}),getCenterPoint=(i,n)=>({x:i.x+(n.x-i.x)/2,y:i.y+(n.y-i.y)/2}),positionArrToPath=i=>{let n="";for(let r=0;r<i.length;r++)r===0?n+=`M ${i[r].x} ${i[r].y}`:n+=` L ${i[r].x} ${i[r].y}`;return n},getSvgNowPosition=(i,n,r)=>r+(n-i),objectDeepClone=(i,n={})=>i?JSON.parse(JSON.stringify(i)):n,setSvgActualInfo=(i,n)=>{const r=document.querySelector(`#${i.id}`),g=document.querySelector(`#rect${i.id}`);if(r){let V=0,k=0,$=0,oe=0;if(i.type!==EDoneJsonType.Vue){const re=r.getBBox();V=parseFloat(re.x.toFixed(0)),k=parseFloat(re.y.toFixed(0)),$=parseFloat(re.width.toFixed(0)),oe=parseFloat(re.height.toFixed(0))}else{$=r.offsetWidth,oe=r.offsetHeight,$=$===0?100:$,oe=oe===0?100:oe,V=50-$/2,k=50-oe/2;const re=document.querySelector(`#foreign-object${i.id}`);re&&re.getAttribute("x")==="0"&&re.getAttribute("y")==="0"&&re.getAttribute("width")==="0"&&re.getAttribute("height")==="0"&&(re.setAttribute("x",V.toString()),re.setAttribute("y",k.toString()),re.setAttribute("width",$.toString()),re.setAttribute("height",oe.toString()))}g&&g.getAttribute("x")==="0"&&g.getAttribute("y")==="0"&&g.getAttribute("width")==="0"&&g.getAttribute("height")==="0"&&(g.setAttribute("x",V.toString()),g.setAttribute("y",k.toString()),g.setAttribute("width",$.toString()),g.setAttribute("height",oe.toString())),(i.actual_bound.x===0&&i.actual_bound.y===0&&i.actual_bound.width===0&&i.actual_bound.height===0||n)&&(i.actual_bound={x:V,y:k,width:$,height:oe}),i.center_position={x:i.x+i.actual_bound.x+$/2,y:i.y+i.actual_bound.y+oe/2},i.point_coordinate.tl={x:i.center_position.x-$*i.scale_x/2,y:i.center_position.y-oe*i.scale_y/2},i.point_coordinate.tc={x:i.center_position.x,y:i.center_position.y-oe*i.scale_y/2},i.point_coordinate.tr={x:i.center_position.x+$*i.scale_x/2,y:i.center_position.y-oe*i.scale_y/2},i.point_coordinate.l={x:i.center_position.x-$*i.scale_x/2,y:i.center_position.y},i.point_coordinate.r={x:i.center_position.x+$*i.scale_x/2,y:i.center_position.y},i.point_coordinate.bl={x:i.center_position.x-$*i.scale_x/2,y:i.center_position.y+oe*i.scale_y/2},i.point_coordinate.bc={x:i.center_position.x,y:i.center_position.y+oe*i.scale_y/2},i.point_coordinate.br={x:i.center_position.x+$*i.scale_x/2,y:i.center_position.y+oe*i.scale_y/2},i.rotate!==0&&setAfterRotationPointCoordinate(i),moveAnchors(i)}},resetHandlePointOld=i=>{for(const n of Object.keys(i.point_coordinate))i.point_coordinate_old&&(i.point_coordinate_old[n].x=0,i.point_coordinate_old[n].y=0)},moveHandlePoint=(i,n,r)=>{const g=useGlobalStore(pinia),V=n??g.mouse_info.new_position_x-g.mouse_info.position_x,k=r??g.mouse_info.new_position_y-g.mouse_info.position_y;for(const $ of Object.keys(i.point_coordinate))n!==void 0&&r!==void 0?(i.point_coordinate[$].x+=V,i.point_coordinate[$].y+=k):i.point_coordinate_old&&(i.point_coordinate[$].x=i.point_coordinate_old[$].x+V,i.point_coordinate[$].y=i.point_coordinate_old[$].y+k)},moveAnchors=i=>{var r,g,V,k;const n=useGlobalStore(pinia);for(let $ of n.done_json)if($.type===EDoneJsonType.ConnectionLine){if(((g=(r=$.bind_anchors)==null?void 0:r.start)==null?void 0:g.target_id)===i.id){const oe=getAnchorPosByAnchorType($.bind_anchors.start.type,i);$.props.point_position.val[0]={x:oe.x-$.x,y:oe.y-$.y}}if(((k=(V=$.bind_anchors)==null?void 0:V.end)==null?void 0:k.target_id)===i.id){const oe=getAnchorPosByAnchorType($.bind_anchors.end.type,i);$.props.point_position.val[$.props.point_position.val.length-1]={x:oe.x-$.x,y:oe.y-$.y}}}},unbindAnchors=i=>{var r,g,V,k;const n=useGlobalStore(pinia);for(let $ of n.done_json)$.type===EDoneJsonType.ConnectionLine&&(((g=(r=$.bind_anchors)==null?void 0:r.start)==null?void 0:g.target_id)===i&&($.bind_anchors.start=null),((k=(V=$.bind_anchors)==null?void 0:V.end)==null?void 0:k.target_id)===i&&($.bind_anchors.end=null))},getAnchorPosByAnchorType=(i,n)=>i===ELineBindAnchors.BottomCenter?n.point_coordinate.bc:i===ELineBindAnchors.Left?n.point_coordinate.l:i===ELineBindAnchors.Right?n.point_coordinate.r:n.point_coordinate.tc,setAfterRotationPointCoordinate=i=>{i.point_coordinate={tl:calculateRotatedPointCoordinate(i.point_coordinate.tl,i.center_position,i.rotate),tc:calculateRotatedPointCoordinate(i.point_coordinate.tc,i.center_position,i.rotate),tr:calculateRotatedPointCoordinate(i.point_coordinate.tr,i.center_position,i.rotate),l:calculateRotatedPointCoordinate(i.point_coordinate.l,i.center_position,i.rotate),r:calculateRotatedPointCoordinate(i.point_coordinate.r,i.center_position,i.rotate),bl:calculateRotatedPointCoordinate(i.point_coordinate.bl,i.center_position,i.rotate),bc:calculateRotatedPointCoordinate(i.point_coordinate.bc,i.center_position,i.rotate),br:calculateRotatedPointCoordinate(i.point_coordinate.br,i.center_position,i.rotate)}},prosToVBind=i=>{var r,g,V,k;let n={};if(i.state){for(const $ in i.state)if($==="OnOff")for(const oe in(r=i.state[$])==null?void 0:r.props)n={...n,[oe]:(g=i.state[$])!=null&&g.default?(V=i.state[$])==null?void 0:V.props[oe].openVal:(k=i.state[$])==null?void 0:k.props[oe].closeVal}}for(const $ in i.props)n={...n,[$]:i.props[$].val};return n},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(i=>i.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=i=>!i.common_animations||!i.common_animations.val?"":`common-ani animate__animated animate__${i.common_animations.val} animate__${i.common_animations.speed} animate__${i.common_animations.repeat} animate__${i.common_animations.delay}`,numberArray=i=>{let n=[];for(let r=0;r<i;r++)n.push(r);return n},getStringWidth=(i,n=12)=>{if(i.length>0){let r=document.createElement("span");r.style.fontSize=n+"px",r.style.fontFamily="inherit",r.innerHTML=i,r.style.opacity="0",r.style.position="fixed",r.style.top="3000px",document.body.append(r);const g=r.clientWidth;return document.body.removeChild(r),g}return 0},valFormat=i=>/false|true/.test(i)?i!=="false":/^\d+(\.\d+)?$/.test(i)?Number(i):i,createLine=(i,n,r)=>{i.preventDefault();const g=useGlobalStore(pinia),V=useConfigStore(pinia),k=useSvgEditLayoutStore(pinia),{clientX:$,clientY:oe}=i;let re=objectDeepClone(V.connection_line),Ce=0,ie=0;if(n&&r){re.bind_anchors.start={type:n,target_id:r.id};let le=getAnchorPosByAnchorType(n,r);Ce=le.x,ie=le.y}else Ce=Math.round(($-k.canvasInfo.left)/V.svg.scale-k.center_offset.x),ie=Math.round((oe-k.canvasInfo.top)/V.svg.scale-k.center_offset.y);const ae={id:straight_line_system.name+randomString(),x:Ce,y:ie,client:{x:Ce,y:ie},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},...re};ae.props.point_position.val.push({x:0,y:0}),g.setDoneJson(ae),g.setHandleSvgInfo(ae,g.done_json.length-1),g.intention=EGlobalStoreIntention.Connection,g.mouse_info={state:EMouseInfoState.Down,position_x:Ce,position_y:ie,now_position_x:Ce,now_position_y:ie,new_position_x:0,new_position_y:0}};let l=localStorage.getItem("svg-editor-config"),s,t;if(l){let i=JSON.parse(l);t=i.connection_line,s=i.svg}else t=objectDeepClone(connection_line_system),s={background_color:"#fff",scale:1,grid:!0,grid_color:"#ebebeb",ruler:!0};const useConfigStore=pinia$1.defineStore("config-store",{state:()=>({svg:s,connection_line:t,net:{mqtt:{url:"",user:"",pwd:"",topics:""}}}),getters:{},actions:{}});var EContextMenuInfoType=(i=>(i.Copy="Copy",i.Delete="Delete",i.MoveUpOneLevel="MoveUpOneLevel",i.MoveDownOneLevel="MoveDownOneLevel",i.MoveUpTopLevel="MoveUpTopLevel",i.MoveDownTopLevel="MoveDownTopLevel",i))(EContextMenuInfoType||{});const useEditPrivateStore=pinia$1.defineStore("edit-private-store",{state:()=>({old_done_components:[],history_doneComponent:[],history_now_index:0,is_record_history:!0,max_record_times:10}),getters:{getTopBtnUndoStatus(i){return i.history_now_index>=1},getTopBtnRedoStatus(i){return i.history_now_index+1!=i.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])}}}),useContextMenuStore=pinia$1.defineStore("context-menu-store",{state:()=>({display:!1,info:{[EContextMenuInfoType.Copy]:{title:"复制",hot_key:"Ctrl+C",enable:!0},[EContextMenuInfoType.Delete]:{title:"删除",hot_key:"Delete",enable:!0},[EContextMenuInfoType.MoveUpTopLevel]:{title:"置于顶层",hot_key:"Ctrl+→",enable:!0},[EContextMenuInfoType.MoveDownTopLevel]:{title:"置于底层",hot_key:"Ctrl+←",enable:!0},[EContextMenuInfoType.MoveUpOneLevel]:{title:"置于上一层",hot_key:"Ctrl+↑",enable:!0},[EContextMenuInfoType.MoveDownOneLevel]:{title:"置于下一层",hot_key:"Ctrl+↓",enable:!0}}}),actions:{onContextMenuClick(i){const n=useGlobalStore();if(n.handle_svg_info)switch(n.intention=EGlobalStoreIntention.Select,i){case EContextMenuInfoType.Copy:const r=objectDeepClone(n.handle_svg_info.info);r.id=r.name+randomString(),r.title+="-copy",r.x+=10,r.y+=10,n.setDoneJson(r),this.display=!1,n.setHandleSvgInfo(r,n.done_json.length);break;case EContextMenuInfoType.Delete:n.spliceDoneJson(n.handle_svg_info.index),this.display=!1,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length-1)return;const g=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index+1],n.done_json[n.handle_svg_info.index+1]=g,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(g,n.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const V=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index-1],n.done_json[n.handle_svg_info.index-1]=V,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(V,n.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const k=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.unshift(k),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(k,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length)return;const $=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.push($),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo($,n.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=i=>{const n=useEditPrivateStore();n.is_record_history&&(n.history_now_index+1<n.history_doneComponent.length&&n.history_doneComponent.splice(n.history_now_index+1),n.history_doneComponent.push(i),n.history_now_index=n.history_doneComponent.length-1,n.history_doneComponent.length>n.max_record_times&&(n.history_doneComponent.shift(),n.history_now_index=n.history_doneComponent.length-1)),n.is_record_history=!0},useImportDataModel=i=>{try{const n=JSON.parse(i);if(!n.config||!n.layout_center||!n.done_json)return ElMessage.error("请导入正确的数据模型!"),!1;const r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=useConfigStore(pinia);return V.$state=n.config,g.center_offset=n.layout_center,r.setDoneJson(n.done_json),!0}catch(n){return ElMessage.error("请导入正确的数据模型!"),console.error(n),!1}},_hoisted_1$e={"aria-hidden":"true"},_hoisted_2$c=["xlink:href"],_sfc_main$j=vue.defineComponent({__name:"index",props:{name:{},props:{default:()=>({})}},setup(i){const n=i,r=vue.computed(()=>`#svg-${n.name}`);return(g,V)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$e,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(r)},n.props),null,16,_hoisted_2$c)]))}});var EVisibleConfKey=(i=>(i.ImportJson="ImportJson",i.ExportJson="ExportJson",i.ImportFile="ImportFile",i))(EVisibleConfKey||{});const _withScopeId$2=i=>(vue.pushScopeId("data-v-383da0a2"),i=i(),vue.popScopeId(),i),_hoisted_1$d={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$b={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$a=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$8={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$4={class:"flex items-center mr-20px"},_hoisted_7$4={class:"flex items-center",style:{width:"250px"}},_hoisted_8$3=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title",style:{"padding-top":"16px"}},"多选",-1)),_hoisted_9$3=_withScopeId$2(()=>vue.createElementVNode("div",null,"鼠标按住左键可以框选,也可以按住ctrl+鼠标左键点图形进行多选",-1)),_hoisted_10$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_11$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"拖动画布",-1)),_hoisted_12$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"右键画布然后拖动即可,右侧面板‘图纸’栏可微调或重置位置",-1)),_hoisted_13$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_14$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"画布缩放",-1)),_hoisted_15$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放",-1)),_hoisted_16$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18=_withScopeId$2(()=>vue.createElementVNode("div",null,"在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线",-1)),_hoisted_19=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_20=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"连线样式",-1)),_hoisted_21=_withScopeId$2(()=>vue.createElementVNode("div",null,"在右侧‘连线’栏可以统一配置连线样式,配置后先增加的线会应用新样式,之前的线样式不变,如需改变,可选中线手动更改或删除重画 ",-1)),_hoisted_22=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_23=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"横线和竖线",-1)),_hoisted_24=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null," 点击编辑器顶部连线按钮会进入连线状态,该状态下在画板点击鼠标左键即可开始画线,移动并再次点击左键创建新的节点,右键结束画线并退出连线状态;"),vue.createElementVNode("p",null,"画线的时候按住ctrl即可画竖线,按住shift即可画横线")],-1)),_hoisted_25=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_26=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"绑定锚点",-1)),_hoisted_27=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null,"组件在未选中时,鼠标经过组件时会出现锚点,鼠标悬浮在锚点上时,会有交互样式,点击左键即可以锚点为起点创建连线;"),vue.createElementVNode("p",null,"同样,在连线时鼠标经过锚点时,会出现锚点交互样式,点击左键即可以锚点为连线终点结束连线;"),vue.createElementVNode("p",null,"这两种情况下的连线会绑定组件上的锚点,如需解绑,参考下面的‘锚点解绑’;"),vue.createElementVNode("p",null,"同样,也可先画线,再选中连线绑定想要绑定的组件锚点(连线只有首尾节点可以绑定锚点)")],-1)),_hoisted_28=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_29=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"线段选中",-1)),_hoisted_30=_withScopeId$2(()=>vue.createElementVNode("div",null," 若线段绑定了锚点,移动线段,绑定的锚点不会移动。若是想将线段整体移动,需要先解绑,参考下面的‘锚点解绑’ ",-1)),_hoisted_31=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_32=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"锚点解绑",-1)),_hoisted_33=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$i=vue.defineComponent({__name:"index",emits:["changeVisible","onReturn","onPreview","onSave"],setup(i,{emit:n}){const r=useSvgEditLayoutStore(pinia),g=useGlobalStore(pinia),V=useEditPrivateStore(pinia),k=useConfigStore(pinia),$=()=>{g.done_json.length<=0||g.setDoneJson([]),g.intention=EGlobalStoreIntention.None},oe=ie=>{const ae={layout_center:r.center_offset,config:k.$state,done_json:g.done_json};n(ie,ae)},re=vue.ref(!1),Ce=vue.computed({get:()=>g.intention===EGlobalStoreIntention.Connection,set(ie){g.intention=ie?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,ie&&g.setHandleSvgInfo(null)}});return(ie,ae)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$d,[vue.createElementVNode("div",_hoisted_2$b,[_hoisted_3$a,vue.createVNode(vue.unref(ElIcon),{size:24,class:"bt-Icon",onClick:ae[0]||(ae[0]=le=>vue.unref(r).left_nav=!vue.unref(r).left_nav),title:vue.unref(r).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(r).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$j,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$j,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$8,[vue.createElementVNode("div",_hoisted_5$6,[vue.createVNode(vue.unref(ElIcon),{title:"撤销 ctrl+z",size:24,class:vue.normalizeClass(`${vue.unref(V).getTopBtnUndoStatus?"bt-Icon":"icon-disable"} ml-20px`),onClick:ae[1]||(ae[1]=()=>vue.unref(V).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:vue.unref(V).getTopBtnUndoStatus?"undo":"undo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(ElIcon),{title:"重做 ctrl+shift+z",class:vue.normalizeClass(`${vue.unref(V).getTopBtnRedoStatus?"bt-Icon":"icon-disable"} ml-5px`),size:24,onClick:ae[2]||(ae[2]=()=>vue.unref(V).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:vue.unref(V).getTopBtnRedoStatus?"redo":"redo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"清空 ctrl+delete",class:vue.normalizeClass(vue.unref(g).done_json.length>0?"bt-Icon":"icon-disable"),size:24,onClick:$},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:vue.unref(g).done_json.length>0?"delete":"delete-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"导入数据模型",class:"bt-Icon",size:24,onClick:ae[3]||(ae[3]=le=>n("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"import"})]),_:1}),vue.createVNode(vue.unref(ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:ae[4]||(ae[4]=le=>n("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"export"})]),_:1}),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"创建连线",class:vue.normalizeClass(["bt-Icon",{active:vue.unref(Ce)}]),size:24,onClick:ae[5]||(ae[5]=le=>Ce.value=!vue.unref(Ce))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:vue.unref(Ce)?"line-active":"line"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"说明",class:"bt-Icon",size:24,onClick:ae[6]||(ae[6]=le=>re.value=!vue.unref(re))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$4,[vue.createVNode(vue.unref(ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:ae[7]||(ae[7]=le=>oe("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"return"})]),_:1}),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:ae[8]||(ae[8]=le=>oe("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"save"})]),_:1}),vue.createVNode(vue.unref(ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:ae[9]||(ae[9]=le=>oe("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$4,[vue.createVNode(vue.unref(ElIcon),{size:24,class:"bt-Icon",onClick:ae[10]||(ae[10]=le=>vue.unref(r).right_nav=!vue.unref(r).right_nav),title:vue.unref(r).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(r).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$j,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$j,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(ElDialog),{modelValue:vue.unref(re),"onUpdate:modelValue":ae[11]||(ae[11]=le=>vue.isRef(re)?re.value=le:null),title:"使用说明",width:"60%",class:"guide-dialog"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$3,_hoisted_9$3,_hoisted_10$2,_hoisted_11$2,_hoisted_12$1,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$1,_hoisted_17,_hoisted_18,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32,_hoisted_33]),_:1})]),_:1},8,["modelValue"])],64))}}),index_vue_vue_type_style_index_0_scoped_383da0a2_lang="",index_vue_vue_type_style_index_1_lang$1="",TopPanel=_export_sfc(_sfc_main$i,[["__scopeId","data-v-383da0a2"]]),_hoisted_1$c={class:"component-group flex flex-wrap"},_hoisted_2$a=["onDragstart","title"],_sfc_main$h=vue.defineComponent({__name:"index",props:{customToolbar:{}},setup(i){const n=i,r=useGlobalStore(pinia),g=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:r.config_center),V=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),k=oe=>{r.setCreateInfo(oe)},$=oe=>{var re;if(((re=oe.dataTransfer)==null?void 0:re.dropEffect)!=="copy"){ElMessage.warning("请将组件拖到画布中!"),r.intention=EGlobalStoreIntention.None;return}};return(oe,re)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(V),"onUpdate:modelValue":re[0]||(re[0]=Ce=>vue.isRef(V)?V.value=Ce:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),Ce=>(vue.openBlock(),vue.createBlock(vue.unref(ElCollapseItem),{name:Ce.groupType,key:Ce.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(Ce.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$c,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(Ce.list,ie=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:ie.name,draggable:"true",onDragstart:ae=>k(ie),onDragend:$,title:ie.title},[vue.createVNode(vue.unref(ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:ie.name,props:vue.unref(prosToVBind)(ie)},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$a))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),index_vue_vue_type_style_index_0_scoped_c7e50a4b_lang="",LeftPanel=_export_sfc(_sfc_main$h,[["__scopeId","data-v-c7e50a4b"]]),calculateLeftTop=(i,n,r)=>{const g=getCenterPoint(i,n),V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate(n,g,-r);return{width:k.x-V.x,height:k.y-V.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(i,n,r)=>{const g=getCenterPoint(i,n),V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate(n,g,-r);return{width:V.x-k.x,height:k.y-V.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(i,n,r)=>{const g=getCenterPoint(i,n),V=calculateRotatedPointCoordinate(n,g,-r),k=calculateRotatedPointCoordinate(i,g,-r);return{width:k.x-V.x,height:k.y-V.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(i,n,r)=>{const g=getCenterPoint(i,n),V=calculateRotatedPointCoordinate(n,g,-r),k=calculateRotatedPointCoordinate(i,g,-r);return{width:V.x-k.x,height:k.y-V.y,is_old_width:!1,is_old_height:!1}},calculateTop=(i,n,r,g)=>{const V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate({x:g.x,y:V.y},g,r),$=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);return{width:1,height:Math.round($),is_old_width:!0,is_old_height:!1}},calculateRight=(i,n,r,g)=>{const V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate({x:V.x,y:g.y},g,r),$=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);return{width:Math.round($),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(i,n,r,g)=>{const V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate({x:g.x,y:V.y},g,r),$=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);return{width:1,height:Math.round($),is_old_width:!0,is_old_height:!1}},calculateLeft=(i,n,r,g)=>{const V=calculateRotatedPointCoordinate(i,g,-r),k=calculateRotatedPointCoordinate({x:V.x,y:g.y},g,r),$=Math.sqrt((k.x-n.x)**2+(k.y-n.y)**2);return{width:Math.round($),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$b={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$9=["fill","x","y"],_hoisted_3$9=["cx","cy"],_hoisted_4$7=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$3=["fill","x","y"],_hoisted_7$3=["fill","x","y"],_hoisted_8$2=["fill","x","y"],_hoisted_9$2=["fill","x","y"],_hoisted_10$1=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$g=vue.defineComponent({__name:"index",props:{itemInfo:{}},setup(i){const n=i;vue.useCssVars(ae=>({"70f7dc54":vue.unref($)}));const r=useGlobalStore(pinia),g=useConfigStore(pinia),V=useSvgEditLayoutStore(pinia),k=vue.ref(4),$=vue.ref("#ab712e"),oe=[{start:338,end:23,cursor:"nw",type:EScaleInfoType.TopLeft},{start:23,end:68,cursor:"n",type:EScaleInfoType.TopCenter},{start:68,end:113,cursor:"ne",type:EScaleInfoType.TopRight},{start:293,end:338,cursor:"w",type:EScaleInfoType.Left},{start:113,end:158,cursor:"e",type:EScaleInfoType.Right},{start:248,end:293,cursor:"sw",type:EScaleInfoType.BottomLeft},{start:203,end:248,cursor:"s",type:EScaleInfoType.BottomCenter},{start:158,end:203,cursor:"se",type:EScaleInfoType.BottomRight}],re=(ae,le)=>{console.log("handMousedown",le);const{clientX:Ie,clientY:ue}=le;le.stopPropagation(),r.intention=EGlobalStoreIntention.Zoom;const de=Math.round((Ie-V.canvasInfo.left)/g.svg.scale-V.center_offset.x),Ne=Math.round((ue-V.canvasInfo.top)/g.svg.scale-V.center_offset.y);r.mouse_info={state:EMouseInfoState.Down,position_x:de,position_y:Ne,now_position_x:de,now_position_y:Ne,new_position_x:0,new_position_y:0},r.scale_info={type:ae,scale_times:{x:n.itemInfo.scale_x,y:n.itemInfo.scale_y},scale_item_info:{x:n.itemInfo.x,y:n.itemInfo.y},symmetric_point:{x:de+Math.abs(de-n.itemInfo.center_position.x)*2*(de>n.itemInfo.center_position.x?-1:1),y:Ne+Math.abs(Ne-n.itemInfo.center_position.y)*2*(Ne>n.itemInfo.center_position.y?-1:1)}}},Ce=ae=>{const{clientX:le,clientY:Ie}=ae,ue=Math.round((le-V.canvasInfo.left)/g.svg.scale-V.center_offset.x),de=Math.round((Ie-V.canvasInfo.top)/g.svg.scale-V.center_offset.y);ae.stopPropagation(),r.intention=EGlobalStoreIntention.Rotate,r.rotate_info={angle:n.itemInfo.rotate},r.mouse_info={state:EMouseInfoState.Down,position_x:ue,position_y:de,now_position_x:ue,now_position_y:de,new_position_x:0,new_position_y:0}},ie=ae=>{const le=(ae+n.itemInfo.rotate)%360,Ie=oe.find(ue=>ue.start<=le&&ue.end>le);return Ie?{cursor:Ie.cursor+"-resize",type:Ie.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(ae,le)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$b,[vue.createElementVNode("rect",{id:"resize_tl",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(0).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[0]||(le[0]=Ie=>re(vue.unref(EScaleInfoType).TopLeft,Ie))},null,44,_hoisted_2$9),vue.createElementVNode("circle",{cx:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,cy:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:Ce},null,40,_hoisted_3$9),vue.createElementVNode("line",{x1:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y1:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),x2:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y2:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref($),"stroke-width":2})},null,12,_hoisted_4$7),vue.createElementVNode("rect",{id:"resize_tc",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(45).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-vue.unref(k),y:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[1]||(le[1]=Ie=>re(vue.unref(EScaleInfoType).TopCenter,Ie))},null,44,_hoisted_5$5),vue.createElementVNode("rect",{id:"resize_tr",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(90).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width-vue.unref(k)+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[2]||(le[2]=Ie=>re(vue.unref(EScaleInfoType).TopRight,Ie))},null,44,_hoisted_6$3),vue.createElementVNode("rect",{id:"resize_l",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(315).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[3]||(le[3]=Ie=>re(vue.unref(EScaleInfoType).Left,Ie))},null,44,_hoisted_7$3),vue.createElementVNode("rect",{id:"resize_r",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(135).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[4]||(le[4]=Ie=>re(vue.unref(EScaleInfoType).Right,Ie))},null,44,_hoisted_8$2),vue.createElementVNode("rect",{id:"resize_bl",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(270).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[5]||(le[5]=Ie=>re(vue.unref(EScaleInfoType).BottomLeft,Ie))},null,44,_hoisted_9$2),vue.createElementVNode("rect",{id:"resize_bc",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(225).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)+n.itemInfo.actual_bound.width/2,y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[6]||(le[6]=Ie=>re(vue.unref(EScaleInfoType).BottomCenter,Ie))},null,44,_hoisted_10$1),vue.createElementVNode("rect",{id:"resize_br",width:"8",height:"8",fill:vue.unref($),style:vue.normalizeStyle({cursor:ie(180).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(k)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(k)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:le[7]||(le[7]=Ie=>re(vue.unref(EScaleInfoType).BottomRight,Ie))},null,44,_hoisted_11$1)]))}}),index_vue_vue_type_style_index_0_scoped_cbb58aff_lang="",HandlePanel=_export_sfc(_sfc_main$g,[["__scopeId","data-v-cbb58aff"]]),_hoisted_1$a=["fill"],_hoisted_2$8=["cx","cy","r"],_hoisted_3$8=["cx","cy","r"],_hoisted_4$6=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$2=["cx","cy","r"],_hoisted_7$2=["cx","cy","r"],_hoisted_8$1=["cx","cy","r"],_hoisted_9$1=["cx","cy","r"],_sfc_main$f=vue.defineComponent({__name:"index",props:{itemInfo:{}},setup(i){const n=i,r=vue.ref(4),g=vue.ref("#ab712e"),V=vue.ref(4),k=vue.ref(12),$=useGlobalStore(pinia),oe=vue.computed(()=>n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-r.value+V.value),re=vue.computed(()=>n.itemInfo.actual_bound.y-r.value-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+V.value),Ce=vue.computed(()=>n.itemInfo.actual_bound.x-r.value+n.itemInfo.actual_bound.width+getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+V.value),ie=vue.computed(()=>n.itemInfo.actual_bound.y-r.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+V.value),ae=vue.computed(()=>n.itemInfo.actual_bound.x-r.value+n.itemInfo.actual_bound.width/2+V.value),le=vue.computed(()=>n.itemInfo.actual_bound.y-r.value+n.itemInfo.actual_bound.height+getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+V.value),Ie=vue.computed(()=>n.itemInfo.actual_bound.x-r.value-getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+V.value),ue=vue.computed(()=>n.itemInfo.actual_bound.y-r.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+V.value),de=(he,pe)=>{var ze;$.intention===EGlobalStoreIntention.SetConnectionLineNode&&(he.stopPropagation(),(ze=$.handle_svg_info)!=null&&ze.info.bind_anchors&&$.connection_line_node_info&&($.connection_line_node_info.point_index===0?$.handle_svg_info.info.bind_anchors.start={type:pe,target_id:n.itemInfo.id}:$.connection_line_node_info.point_index===$.handle_svg_info.info.props.point_position.val.length-1&&($.handle_svg_info.info.bind_anchors.end={type:pe,target_id:n.itemInfo.id}),$.intention=EGlobalStoreIntention.None,$.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))},Ne=(he,pe)=>{var ze;$.intention===EGlobalStoreIntention.None?createLine(he,pe,n.itemInfo):$.intention===EGlobalStoreIntention.Connection&&(he.stopPropagation(),(ze=$.handle_svg_info)!=null&&ze.info.bind_anchors&&($.handle_svg_info.info.bind_anchors.end={type:pe,target_id:n.itemInfo.id},$.intention=EGlobalStoreIntention.None,$.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))};return(he,pe)=>(vue.openBlock(),vue.createElementBlock("g",{style:{"vector-effect":"non-scaling-stroke"},class:"connect-points",fill:vue.unref(g),"stroke-width":"2",stroke:"rgba(0,0,0,0)"},[vue.createElementVNode("g",{onMousedown:pe[0]||(pe[0]=ze=>Ne(ze,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:pe[1]||(pe[1]=ze=>de(ze,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(oe),cy:vue.unref(re),r:vue.unref(k),"fill-opacity":".3"},null,8,_hoisted_2$8),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(oe),cy:vue.unref(re),r:vue.unref(V),"pointer-events":"all"},null,8,_hoisted_3$8)],32),vue.createElementVNode("g",{onMousedown:pe[2]||(pe[2]=ze=>Ne(ze,vue.unref(ELineBindAnchors).Right)),onMouseup:pe[3]||(pe[3]=ze=>de(ze,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(Ce),cy:vue.unref(ie),r:vue.unref(k),"fill-opacity":".3"},null,8,_hoisted_4$6),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(Ce),cy:vue.unref(ie),r:vue.unref(V),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:pe[4]||(pe[4]=ze=>Ne(ze,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:pe[5]||(pe[5]=ze=>de(ze,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(ae),cy:vue.unref(le),r:vue.unref(k),"fill-opacity":".3"},null,8,_hoisted_6$2),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(ae),cy:vue.unref(le),r:vue.unref(V),"pointer-events":"all"},null,8,_hoisted_7$2)],32),vue.createElementVNode("g",{onMousedown:pe[6]||(pe[6]=ze=>Ne(ze,vue.unref(ELineBindAnchors).Left)),onMouseup:pe[7]||(pe[7]=ze=>de(ze,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(Ie),cy:vue.unref(ue),r:vue.unref(k),"fill-opacity":".3"},null,8,_hoisted_8$1),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(Ie),cy:vue.unref(ue),r:vue.unref(V),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$1)],32)],8,_hoisted_1$a))}}),index_vue_vue_type_style_index_0_scoped_bd67b211_lang="",ConnectionPanel=_export_sfc(_sfc_main$f,[["__scopeId","data-v-bd67b211"]]),_hoisted_1$9=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_2$7=["from","to","dur","repeatCount"],_hoisted_3$7=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$5=["from","to","dur","repeatCount"],_hoisted_5$3=["r","fill"],_hoisted_6$1=["path","dur","repeatCount"],_hoisted_7$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$e=vue.defineComponent({__name:"index",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(i){const n=i,r=useGlobalStore(pinia),g=useConfigStore(pinia),V=useSvgEditLayoutStore(pinia),k=($,oe,re,Ce)=>{if(r.intention===EGlobalStoreIntention.Connection)return;r.setHandleSvgInfo(n.itemInfo);const{clientX:ie,clientY:ae}=oe;oe.stopPropagation(),r.connection_line_node_info={init_pos:{x:re,y:Ce},point_index:$},r.intention=EGlobalStoreIntention.SetConnectionLineNode,r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((ae-V.canvasInfo.top)/g.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0}};return($,oe)=>{var re,Ce,ie,ae,le;return vue.openBlock(),vue.createElementBlock("g",null,[vue.createElementVNode("path",{id:n.itemInfo.id,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none",stroke:((re=n.itemInfo.animations)==null?void 0:re.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.animations.color.val:n.itemInfo.props.stroke.val,"stroke-width":n.itemInfo.props["stroke-width"].val,style:vue.normalizeStyle({cursor:vue.unref(r).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"}),"stroke-dashoffset":"0","stroke-dasharray":((Ce=n.itemInfo.animations)==null?void 0:Ce.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.props["stroke-width"].val*3:0},[((ie=n.itemInfo.animations)==null?void 0:ie.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_2$7)):vue.createCommentVNode("",!0)],12,_hoisted_1$9),((ae=n.itemInfo.animations)==null?void 0:ae.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:n.itemInfo.animations.color.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dasharray":n.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_4$5)],8,_hoisted_3$7)):((le=n.itemInfo.animations)==null?void 0:le.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:n.itemInfo.props["stroke-width"].val*2,fill:n.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(n.itemInfo.animations.reverse.val?[...n.itemInfo.props.point_position.val].reverse():n.itemInfo.props.point_position.val),dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_6$1)],8,_hoisted_5$3)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(Ie,ue)=>(vue.openBlock(),vue.createElementBlock("circle",{key:ue,cx:Ie.x,cy:Ie.y,r:n.itemInfo.props.point_r.val,"stroke-width":"1",stroke:n.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:de=>k(ue,de,Ie.x,Ie.y)},null,40,_hoisted_7$1))),128))])])}}}),_hoisted_1$8={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_2$6=["stroke"],_hoisted_3$6=["stroke"],_hoisted_4$4=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_7=["transform"],_hoisted_8=["transform"],_hoisted_9=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_10=["xlink:href","id","transform"],_hoisted_11=["id"],_hoisted_12=["id","x1","y1","x2","y2"],_hoisted_13=["id"],_hoisted_14=["x","y","height","width"],_hoisted_15=["onClick"],_hoisted_16={class:"shortcut"},_sfc_main$d=vue.defineComponent({__name:"index",setup(i){vue.useCssVars(ti=>({"421a96ac":ie.value}));const n=vue.getCurrentInstance();Object.keys(vueComp).forEach(ti=>{var ei;Object.keys((ei=n==null?void 0:n.appContext)==null?void 0:ei.components).includes(ti)||n==null||n.appContext.app.component(ti,vueComp[ti])});const r=useGlobalStore(pinia),g=useConfigStore(pinia),V=useSvgEditLayoutStore(pinia),k=useEditPrivateStore(pinia),$=useContextMenuStore(pinia),oe=vue.ref(),re=vue.ref(),Ce={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},ie=vue.computed(()=>Object.keys(Ce).indexOf(r.intention)>-1?Ce[r.intention]:"default"),ae=vue.reactive({handle_panel:vue.computed(()=>r.intention===EGlobalStoreIntention.Select||r.intention===EGlobalStoreIntention.Zoom||r.intention===EGlobalStoreIntention.Rotate),connection_panel:!1,connection_line:!1,select_item:{info:null,index:-1}}),le=vue.ref({a:{x:0,y:0},b:{x:0,y:0}}),Ie=vue.computed(()=>r.intention===EGlobalStoreIntention.SelectArea&&le.value.b.x&&le.value.b.y?{with:Math.abs(le.value.b.x-le.value.a.x),height:Math.abs(le.value.b.y-le.value.a.y),x:le.value.a.x<le.value.b.x?le.value.a.x:le.value.b.x,y:le.value.a.y<le.value.b.y?le.value.a.y:le.value.b.y}:{with:0,height:0,x:0,y:0}),ue=vue.computed(()=>{let ti=0;for(let ei of r.done_json)ei.selected&&ti++;return ti>0});let de=!1,Ne=!1;const he=ti=>{var ei;if(r.intention!=EGlobalStoreIntention.None){if(r.intention==EGlobalStoreIntention.Create){if(!r.create_svg_info){console.error("要创建的数据获取失败");return}const Lt=Math.floor(ti.offsetX/g.svg.scale-V.center_offset.x),ni=Math.floor(ti.offsetY/g.svg.scale-V.center_offset.y),ri={id:randomString(),x:Lt,y:ni,client:{x:Lt,y:ni},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},selected:!1,...objectDeepClone(r.create_svg_info)};r.setDoneJson(ri),r.setHandleSvgInfo(ri,r.done_json.length),r.intention=EGlobalStoreIntention.None}(ei=re.value)==null||ei.focus()}},pe=ti=>{ti.preventDefault()},ze=ti=>{ti.preventDefault()},xe=(ti,ei,Lt)=>{var ni,ri;if((ni=re.value)==null||ni.focus(),r.intention!==EGlobalStoreIntention.Connection)if(Lt.preventDefault(),Lt.stopPropagation(),Lt.ctrlKey&&Lt.button===0)(ri=r.handle_svg_info)!=null&&ri.index&&(r.done_json[r.handle_svg_info.index].selected=!0,r.setHandleSvgInfo(null),ti.selected=!ti.selected);else if(ue.value){r.intention=EGlobalStoreIntention.GroupMove,r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Lt.clientX-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((Lt.clientY-V.canvasInfo.top)/g.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0};for(let Ii of r.done_json)Ii.selected&&(Ii.old_position={x:Ii.x,y:Ii.y},Ii.point_coordinate_old=objectDeepClone(Ii.point_coordinate))}else r.intention=EGlobalStoreIntention.Select,r.setHandleSvgInfo(ti,ei),r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Lt.clientX-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((Lt.clientY-V.canvasInfo.top)/g.svg.scale),now_position_x:ti.x,now_position_y:ti.y,new_position_x:0,new_position_y:0},ti.point_coordinate_old=objectDeepClone(ti.point_coordinate)},Oe=(ti,ei,Lt)=>{if(!(r.intention===EGlobalStoreIntention.Connection||r.mouse_info.state!=EMouseInfoState.Down)&&ue.value&&!de&&["SelectArea","Move","Select"].indexOf(r.intention)<0){for(let ni of r.done_json)ni.selected=!1,ni.old_position={x:0,y:0},resetHandlePointOld(ni);r.intention=EGlobalStoreIntention.Select,r.setHandleSvgInfo(ti,ei),r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Lt.clientX-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((Lt.clientY-V.canvasInfo.top)/g.svg.scale),now_position_x:ti.x,now_position_y:ti.y,new_position_x:0,new_position_y:0}}},_e=(ti,ei,Lt)=>{Lt.preventDefault(),Lt.stopPropagation(),ae.connection_panel=!0,ae.connection_line=!0,!((r.intention===EGlobalStoreIntention.Connection||r.intention===EGlobalStoreIntention.SetConnectionLineNode)&&ti.type===EDoneJsonType.ConnectionLine)&&(ae.select_item.info=ti,ae.select_item.index=ei)},At=(ti,ei,Lt)=>{Lt.preventDefault(),Lt.stopPropagation(),!((r.intention===EGlobalStoreIntention.Connection||r.intention===EGlobalStoreIntention.SetConnectionLineNode)&&ti.type===EDoneJsonType.ConnectionLine)&&(ae.connection_panel=!1,ae.connection_line=!1,ae.select_item.info=null,ae.select_item.index=-1)},$e=ti=>{var Ii,wi,ai,di,hi,ci,Ai,yi,ui,Ci,zi,Ni,Mi,mi,vi,bi;if(r.mouse_info.state!=EMouseInfoState.Down&&r.intention!==EGlobalStoreIntention.Connection)return;const{clientX:ei,clientY:Lt}=ti;r.mouse_info.new_position_x=Math.round((ei-V.canvasInfo.left)/g.svg.scale),r.mouse_info.new_position_y=Math.round((Lt-V.canvasInfo.top)/g.svg.scale);const ni=Math.round(r.mouse_info.new_position_x-r.mouse_info.position_x+r.mouse_info.now_position_x),ri=Math.round(r.mouse_info.new_position_y-r.mouse_info.position_y+r.mouse_info.now_position_y);if((Ii=r.handle_svg_info)!=null&&Ii.info&&(r.intention===EGlobalStoreIntention.Select||r.intention===EGlobalStoreIntention.Move)){if(r.handle_svg_info.info.x=ni,r.handle_svg_info.info.y=ri,r.handle_svg_info.info.client={x:ni,y:ri},r.intention=EGlobalStoreIntention.Move,moveHandlePoint(r.handle_svg_info.info),moveAnchors(r.handle_svg_info.info),r.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((wi=r.handle_svg_info.info.bind_anchors)!=null&&wi.start){let gi=null;for(let li of r.done_json)li.id===((di=(ai=r.handle_svg_info.info.bind_anchors)==null?void 0:ai.start)==null?void 0:di.target_id)&&(gi=li);gi&&moveAnchors(gi)}if((hi=r.handle_svg_info.info.bind_anchors)!=null&&hi.end){let gi=null;for(let li of r.done_json)li.id===((Ai=(ci=r.handle_svg_info.info.bind_anchors)==null?void 0:ci.end)==null?void 0:Ai.target_id)&&(gi=li);gi&&moveAnchors(gi)}}}else if(r.intention===EGlobalStoreIntention.MoveCanvas)V.center_offset.x=ni,V.center_offset.y=ri;else if(r.intention===EGlobalStoreIntention.SelectArea)le.value.b.x=r.mouse_info.new_position_x-V.center_offset.x,le.value.b.y=r.mouse_info.new_position_y-V.center_offset.y;else if(r.intention===EGlobalStoreIntention.GroupMove){de=!0;for(let gi of r.done_json)if(gi.selected&&gi.old_position){const li=Math.round(r.mouse_info.new_position_x-r.mouse_info.position_x+gi.old_position.x),oi=Math.round(r.mouse_info.new_position_y-r.mouse_info.position_y+gi.old_position.y);if(gi.x=li,gi.y=oi,gi.client={x:li,y:oi},moveHandlePoint(gi),moveAnchors(gi),gi.type===EDoneJsonType.ConnectionLine&&((yi=gi.bind_anchors)!=null&&yi.end)){let Et=null;for(let ii of r.done_json)ii.id===((Ci=(ui=gi.bind_anchors)==null?void 0:ui.end)==null?void 0:Ci.target_id)&&(Et=ii);Et&&moveAnchors(Et)}}}else if(r.intention===EGlobalStoreIntention.Zoom){if(!r.handle_svg_info)return;const gi={x:r.mouse_info.new_position_x-V.center_offset.x,y:r.mouse_info.new_position_y-V.center_offset.y};let li={width:0,height:0,is_old_width:!1,is_old_height:!1};if(r.scale_info.type===EScaleInfoType.TopLeft?li=calculateLeftTop(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate):r.scale_info.type===EScaleInfoType.TopRight?li=calculateRightTop(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate):r.scale_info.type===EScaleInfoType.BottomRight?li=calculateRightBottom(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate):r.scale_info.type===EScaleInfoType.BottomLeft?li=calculateLeftBottom(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate):r.scale_info.type===EScaleInfoType.TopCenter?li=calculateTop(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate,r.handle_svg_info.info.client):r.scale_info.type===EScaleInfoType.Right?li=calculateRight(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate,r.handle_svg_info.info.client):r.scale_info.type===EScaleInfoType.BottomCenter?li=calculateBottom(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate,r.handle_svg_info.info.client):r.scale_info.type===EScaleInfoType.Left&&(li=calculateLeft(gi,r.scale_info.symmetric_point,r.handle_svg_info.info.rotate,r.handle_svg_info.info.client)),r.handle_svg_info&&li.width>0&&li.height>0){const oi=li.is_old_width?1:parseFloat((li.width/r.handle_svg_info.info.actual_bound.width).toFixed(3)),Et=li.is_old_height?1:parseFloat((li.height/r.handle_svg_info.info.actual_bound.height).toFixed(3)),ii=getCenterPoint(gi,r.scale_info.symmetric_point);oi>0&&r.scale_info.type!==EScaleInfoType.TopCenter&&r.scale_info.type!==EScaleInfoType.BottomCenter&&(r.handle_svg_info.info.scale_x=oi,r.handle_svg_info.info.x=Math.round(getSvgNowPosition(r.handle_svg_info.info.center_position.x,ii.x,r.handle_svg_info.info.client.x))),Et>0&&r.scale_info.type!==EScaleInfoType.Left&&r.scale_info.type!==EScaleInfoType.Right&&(r.handle_svg_info.info.scale_y=Et,r.handle_svg_info.info.y=Math.round(getSvgNowPosition(r.handle_svg_info.info.center_position.y,ii.y,r.handle_svg_info.info.client.y)))}}else if(r.intention===EGlobalStoreIntention.Rotate){if(!r.handle_svg_info)return;const gi=Math.atan2(r.mouse_info.position_y-r.handle_svg_info.info.y,r.mouse_info.position_x-r.handle_svg_info.info.x)/(Math.PI/180),li=Math.atan2(r.mouse_info.new_position_y-V.center_offset.y-r.handle_svg_info.info.y,r.mouse_info.new_position_x-V.center_offset.x-r.handle_svg_info.info.x)/(Math.PI/180);r.handle_svg_info.info.rotate=parseFloat((r.rotate_info.angle+li-gi).toFixed(2))}else if(r.intention===EGlobalStoreIntention.Connection&&r.handle_svg_info){const gi=(zi=r.handle_svg_info)==null?void 0:zi.info.props.point_position.val.length,li=r.mouse_info.new_position_x-r.mouse_info.position_x-V.center_offset.x,oi=r.mouse_info.new_position_y-r.mouse_info.position_y-V.center_offset.y,Et=r.handle_svg_info.info.props.point_position.val[gi-2],ii=((Mi=(Ni=r.handle_svg_info)==null?void 0:Ni.info.props.point_r)==null?void 0:Mi.val)+2||4;let si=Et.x<li?-ii:Et.x>li?ii:0,fi=Et.y<oi?-ii:Et.y>oi?ii:0;ti.ctrlKey?r.handle_svg_info.info.props.point_position.val[gi-1]={x:Et.x,y:oi+fi}:ti.shiftKey?r.handle_svg_info.info.props.point_position.val[gi-1]={x:li+si,y:Et.y}:r.handle_svg_info.info.props.point_position.val[gi-1]={x:li+si,y:oi+fi}}else if(r.intention===EGlobalStoreIntention.SetConnectionLineNode&&r.handle_svg_info){!Ne&&(r.connection_line_node_info.point_index===r.handle_svg_info.info.props.point_position.val.length-1||r.connection_line_node_info.point_index===0)&&(Ne=!0);const gi=(mi=r.handle_svg_info)==null?void 0:mi.info.props.point_position.val.length,li=getSvgNowPosition(r.mouse_info.position_x,r.mouse_info.new_position_x,r.connection_line_node_info.init_pos.x),oi=getSvgNowPosition(r.mouse_info.position_y,r.mouse_info.new_position_y,r.connection_line_node_info.init_pos.y),Et=r.handle_svg_info.info.props.point_position.val[gi-2],ii=((bi=(vi=r.handle_svg_info)==null?void 0:vi.info.props.point_r)==null?void 0:bi.val)+2||4;let si=Et.x<li?-ii:Et.x>li?ii:0,fi=Et.y<oi?-ii:Et.y>oi?ii:0;r.handle_svg_info.info.props.point_position.val[r.connection_line_node_info.point_index]={x:li+si,y:oi+fi}}},Fe=()=>{var ti,ei,Lt,ni;if(r.mouse_info.state==EMouseInfoState.Down){if((ti=r.handle_svg_info)!=null&&ti.info&&r.intention==EGlobalStoreIntention.Move)setSvgActualInfo(r.done_json[r.handle_svg_info.index]),r.intention=EGlobalStoreIntention.None,r.setDoneJson(r.done_json);else if(r.intention==EGlobalStoreIntention.GroupMove)de&&(de=!1,r.intention=EGlobalStoreIntention.None);else if((ei=r.handle_svg_info)!=null&&ei.info&&r.intention==EGlobalStoreIntention.Zoom)r.handle_svg_info.info.client={x:r.handle_svg_info.info.x,y:r.handle_svg_info.info.y},r.intention=EGlobalStoreIntention.None,setSvgActualInfo(r.done_json[r.handle_svg_info.index]),r.setDoneJson(r.done_json);else if(r.intention===EGlobalStoreIntention.Rotate&&((Lt=r.handle_svg_info)!=null&&Lt.info))setSvgActualInfo(r.done_json[r.handle_svg_info.index]),r.setDoneJson(r.done_json),r.intention=EGlobalStoreIntention.None;else{if(r.intention===EGlobalStoreIntention.Connection)return;if(r.intention===EGlobalStoreIntention.SetConnectionLineNode)Ne&&((ni=r.handle_svg_info)!=null&&ni.info.bind_anchors)&&(r.connection_line_node_info.point_index===0?r.handle_svg_info.info.bind_anchors.start=null:r.handle_svg_info.info.bind_anchors.end=null),r.intention=EGlobalStoreIntention.None,Ne=!1;else if(r.intention===EGlobalStoreIntention.SelectArea){r.setHandleSvgInfo(null);for(let ri of r.done_json){const Ii=Ie.value;ri.selected=ri.x>Ii.x&&ri.x<Ii.x+Ii.with&&ri.y>Ii.y&&ri.y<Ii.y+Ii.height}r.intention=EGlobalStoreIntention.None}else r.intention!=EGlobalStoreIntention.Select&&(r.intention=EGlobalStoreIntention.None)}r.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},$.display=!1}},Ue=ti=>{const{clientX:ei,clientY:Lt}=ti;if(r.intention===EGlobalStoreIntention.Connection){r.handle_svg_info||createLine(ti),r.handle_svg_info&&(ti.button===0?r.handle_svg_info.info.props.point_position.val.length!==1?r.handle_svg_info.info.props.point_position.val.push({x:r.mouse_info.new_position_x-r.mouse_info.position_x-V.center_offset.x,y:r.mouse_info.new_position_y-r.mouse_info.position_y-V.center_offset.y}):r.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):ti.button===2&&(r.intention=EGlobalStoreIntention.None,setSvgActualInfo(r.done_json[r.handle_svg_info.index]),r.setHandleSvgInfo(null)));return}ti.button===0?(r.intention=EGlobalStoreIntention.SelectArea,r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ei-V.canvasInfo.left)/g.svg.scale-V.center_offset.x),position_y:Math.round((Lt-V.canvasInfo.top)/g.svg.scale-V.center_offset.y),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},le.value={a:{x:r.mouse_info.position_x,y:r.mouse_info.position_y},b:{x:0,y:0}}):ti.button===2&&(r.intention=EGlobalStoreIntention.MoveCanvas,r.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ei-V.canvasInfo.left)/g.svg.scale),position_y:Math.round((Lt-V.canvasInfo.top)/g.svg.scale),now_position_x:V.center_offset.x,now_position_y:V.center_offset.y,new_position_x:0,new_position_y:0})};function Ve(ti){ti!=null&&ti.wheelDelta&&(ti.wheelDelta>0?g.svg.scale=parseFloat((g.svg.scale+.1).toFixed(1)):g.svg.scale=parseFloat((g.svg.scale-.1).toFixed(1)))}const Dt=ti=>{ti.stopPropagation(),ti.preventDefault()},qe=(ti,ei,Lt)=>{r.intention!==EGlobalStoreIntention.Connection&&oe.value&&(r.intention=EGlobalStoreIntention.ContextMenu,r.setHandleSvgInfo(ti,ei),oe.value.style.left=Lt.pageX+"px",oe.value.style.top=Lt.pageY+"px",$.info.MoveUpOneLevel.enable=$.info.MoveUpTopLevel.enable=$.info.MoveDownOneLevel.enable=$.info.MoveDownTopLevel.enable=!0,ei===r.done_json.length-1&&($.info.MoveUpOneLevel.enable=$.info.MoveUpTopLevel.enable=!1),ei===0&&($.info.MoveDownOneLevel.enable=$.info.MoveDownTopLevel.enable=!1),$.display=!0)},kt=(ti,ei,Lt)=>({x:parseFloat((ti.x-ti.width/2*ei+ti.width/2).toFixed(1)),y:parseFloat((ti.y-ti.height/2*Lt+ti.height/2).toFixed(1)),width:parseFloat((ti.width*ei).toFixed(1)),height:parseFloat((ti.height*Lt).toFixed(1))}),jt=ti=>{ti.preventDefault();let ei=[];if(!ti.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(ti.key)>-1&&(ue.value?ei=r.done_json.map((Lt,ni)=>({selected:Lt.selected,i:ni})).filter(Lt=>Lt.selected).map(Lt=>Lt.i):r.handle_svg_info&&ei.push(r.handle_svg_info.index)),!ti.ctrlKey&&ti.key=="ArrowUp"){for(let Lt of ei)r.done_json[Lt].y-=1,r.done_json[Lt].client.y-=1,moveHandlePoint(r.done_json[Lt],0,-1),moveAnchors(r.done_json[Lt]);useHistoryRecord(r.done_json)}else if(!ti.ctrlKey&&ti.key=="ArrowDown"){for(let Lt of ei)r.done_json[Lt].y+=1,r.done_json[Lt].client.y+=1,moveHandlePoint(r.done_json[Lt],0,1),moveAnchors(r.done_json[Lt]);useHistoryRecord(r.done_json)}else if(!ti.ctrlKey&&ti.key=="ArrowLeft"){for(let Lt of ei)r.done_json[Lt].x-=1,r.done_json[Lt].client.x-=1,moveHandlePoint(r.done_json[Lt],-1,0),moveAnchors(r.done_json[Lt]);useHistoryRecord(r.done_json)}else if(!ti.ctrlKey&&ti.key=="ArrowRight"){for(let Lt of ei)r.done_json[Lt].x+=1,r.done_json[Lt].client.x+=1,moveHandlePoint(r.done_json[Lt],1,0),moveAnchors(r.done_json[Lt]);useHistoryRecord(r.done_json)}else ti.ctrlKey&&ti.key.toLowerCase()=="c"?$.onContextMenuClick(EContextMenuInfoType.Copy):!ti.ctrlKey&&ti.key=="Delete"?ue.value?(r.setDoneJson(r.done_json.filter(Lt=>!Lt.selected)),r.setHandleSvgInfo(r.done_json[r.done_json.length-1],r.done_json.length-1)):$.onContextMenuClick(EContextMenuInfoType.Delete):ti.ctrlKey&&ti.key=="ArrowUp"?$.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):ti.ctrlKey&&ti.key=="ArrowDown"?$.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):ti.ctrlKey&&ti.key=="ArrowLeft"?$.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):ti.ctrlKey&&ti.key=="ArrowRight"?$.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):ti.ctrlKey&&ti.shiftKey&&ti.key.toLowerCase()=="z"?k.topRedoBtnClick():ti.ctrlKey&&ti.key.toLowerCase()=="z"?k.topUndoBtnClick():ti.ctrlKey&&ti.key.toLowerCase()=="delete"&&(r.done_json.length<=0||r.setDoneJson([]))},Pt=()=>{setSvgActualInfo(r.done_json[r.handle_svg_info.index],!0)};return vue.onMounted(()=>{var ti;(ti=re.value)==null||ti.focus(),vue.nextTick(function(){var Lt;const ei=(Lt=re.value)==null?void 0:Lt.getBoundingClientRect();V.canvasInfo={height:(ei==null?void 0:ei.height)||0,with:(ei==null?void 0:ei.width)||0,top:(ei==null?void 0:ei.top)||0,left:(ei==null?void 0:ei.left)||0}})}),(ti,ei)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{class:"canvas",tabindex:"0",ref_key:"canvasRef",ref:re,onDrop:he,onDragenter:pe,onDragover:ze,onMousedown:Ue,onMousemove:$e,onMouseup:Fe,onContextmenu:Dt,onKeydown:jt,onMousewheel:Ve},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(g).svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_1$8,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(g).svg.grid_color},null,8,_hoisted_2$6),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(g).svg.grid_color},null,8,_hoisted_3$6),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(g).svg.grid_color},null,8,_hoisted_4$4),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(g).svg.grid_color},null,8,_hoisted_5$2)])]),vue.unref(g).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_6)):vue.createCommentVNode("",!0),vue.createElementVNode("g",{transform:`translate(${vue.unref(V).center_offset.x*vue.unref(g).svg.scale},${vue.unref(V).center_offset.y*vue.unref(g).svg.scale})rotate(0)scale(${vue.unref(g).svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).done_json,(Lt,ni)=>{var ri,Ii,wi,ai,di,hi;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:Lt.id,transform:`translate(${Lt.x},${Lt.y})rotate(0)scale(1)`},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(Lt)}`)},[vue.createElementVNode("g",{transform:`translate(${Lt.actual_bound.x+Lt.actual_bound.width/2},${Lt.actual_bound.y+Lt.actual_bound.height/2})rotate(${Lt.rotate}) scale(1) translate(${-(Lt.actual_bound.x+Lt.actual_bound.width/2)},${-(Lt.actual_bound.y+Lt.actual_bound.height/2)})`,onMousedown:ci=>xe(Lt,ni,ci),onMouseup:ci=>Oe(Lt,ni,ci),onMouseenter:ci=>_e(Lt,ni,ci),onMouseleave:ci=>At(Lt,ni,ci),onContextmenu:ci=>qe(Lt,ni,ci)},[Lt.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$e,{key:0,"item-info":Lt,"point-visible":vue.unref(ae).connection_line&&((ri=vue.unref(ae).select_item.info)==null?void 0:ri.id)==Lt.id},null,8,["item-info","point-visible"])):Lt.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${Lt.name}`},vue.unref(prosToVBind)(Lt),{width:"100",height:"100",id:Lt.id,transform:`translate(${Lt.actual_bound.x+Lt.actual_bound.width/2},${Lt.actual_bound.y+Lt.actual_bound.height/2}) scale(${Lt.scale_x},${Lt.scale_y}) translate(${-(Lt.actual_bound.x+Lt.actual_bound.width/2)},${-(Lt.actual_bound.y+Lt.actual_bound.height/2)})`}),null,16,_hoisted_10)):Lt.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Lt.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(Lt),{width:"100",height:"100",id:Lt.id,onResize:Pt,transform:`translate(${Lt.actual_bound.x+Lt.actual_bound.width/2},${Lt.actual_bound.y+Lt.actual_bound.height/2}) scale(${Lt.scale_x},${Lt.scale_y}) translate(${-(Lt.actual_bound.x+Lt.actual_bound.width/2)},${-(Lt.actual_bound.y+Lt.actual_bound.height/2)})`}),null,16,["id","transform"])):Lt.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},kt(Lt.actual_bound,Lt.scale_x,Lt.scale_y),{id:`foreign-object${Lt.id}`}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Lt.tag),vue.mergeProps(vue.unref(prosToVBind)(Lt),{id:Lt.id,transform:`translate(${Lt.actual_bound.x+Lt.actual_bound.width/2},${Lt.actual_bound.y+Lt.actual_bound.height/2}) scale(${Lt.scale_x},${Lt.scale_y}) translate(${-(Lt.actual_bound.x+Lt.actual_bound.width/2)},${-(Lt.actual_bound.y+Lt.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(Lt.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_11)):Lt.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:Lt.id,x1:Lt.props.start_x.val,y1:Lt.props.start_y.val,x2:Lt.props.end_x.val,y2:Lt.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_12)):vue.createCommentVNode("",!0),Lt.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${Lt.id}`,fill:"black","fill-opacity":"0"},kt(Lt.actual_bound,Lt.scale_x,Lt.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!Lt.selected&&(vue.unref(r).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Move&&((Ii=vue.unref(r).handle_svg_info)==null?void 0:Ii.info.id)==Lt.id,"svg-item-select":vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Select&&((wi=vue.unref(r).handle_svg_info)==null?void 0:wi.info.id)==Lt.id,"svg-item-in-group":Lt.selected}}),null,16,_hoisted_13)):vue.createCommentVNode("",!0),((ai=vue.unref(r).handle_svg_info)==null?void 0:ai.info.id)===Lt.id&&vue.unref(ae).handle_panel&&Lt.config.can_zoom?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":Lt},null,8,["item-info"])):vue.createCommentVNode("",!0),!Lt.selected&&((di=vue.unref(ae).select_item.info)==null?void 0:di.id)==Lt.id&&vue.unref(ae).connection_panel&&Lt.config.have_anchor&&vue.unref(r).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(r).intention!==vue.unref(EGlobalStoreIntention).Select||Lt.id!==((hi=vue.unref(r).handle_svg_info)==null?void 0:hi.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:Dt,"item-info":Lt},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_9)],2)],8,_hoisted_8)),[[vue.vShow,Lt.display]])}),128)),vue.createElementVNode("rect",{x:Ie.value.x,y:Ie.value.y,height:Ie.value.height,width:Ie.value.with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_14)],8,_hoisted_7)],4))],544),vue.withDirectives(vue.createElementVNode("ul",{ref_key:"contextMenuRef",ref:oe,class:"contextMenu"},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref($).info,(Lt,ni)=>(vue.openBlock(),vue.createElementBlock("li",{key:Lt.title,onClick:ri=>vue.unref($).onContextMenuClick(ni)},[vue.createElementVNode("p",{class:vue.normalizeClass(Lt.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(Lt.title)+" ",1),vue.createElementVNode("span",_hoisted_16,vue.toDisplayString(Lt.hot_key),1)],2)],8,_hoisted_15))),128))],512),[[vue.vShow,vue.unref($).display]])],64))}}),index_vue_vue_type_style_index_0_scoped_a6a55932_lang="",CenterPanel=_export_sfc(_sfc_main$d,[["__scopeId","data-v-a6a55932"]]);var ace$2={exports:{}};(function(i,n){(function(){var r="ace",g=function(){return this}();!g&&typeof window<"u"&&(g=window);var V=function(ie,ae,le){if(typeof ie!="string"){V.original?V.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(le=ae),V.modules[ie]||(V.payloads[ie]=le,V.modules[ie]=null)};V.modules={},V.payloads={};var k=function(ie,ae,le){if(typeof ae=="string"){var Ie=re(ie,ae);if(Ie!=null)return le&&le(),Ie}else if(Object.prototype.toString.call(ae)==="[object Array]"){for(var ue=[],de=0,Ne=ae.length;de<Ne;++de){var he=re(ie,ae[de]);if(he==null&&$.original)return;ue.push(he)}return le&&le.apply(null,ue)||!0}},$=function(ie,ae){var le=k("",ie,ae);return le==null&&$.original?$.original.apply(this,arguments):le},oe=function(ie,ae){if(ae.indexOf("!")!==-1){var le=ae.split("!");return oe(ie,le[0])+"!"+oe(ie,le[1])}if(ae.charAt(0)=="."){var Ie=ie.split("/").slice(0,-1).join("/");for(ae=Ie+"/"+ae;ae.indexOf(".")!==-1&&ue!=ae;){var ue=ae;ae=ae.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return ae},re=function(ie,ae){ae=oe(ie,ae);var le=V.modules[ae];if(!le){if(le=V.payloads[ae],typeof le=="function"){var Ie={},ue={id:ae,uri:"",exports:Ie,packaged:!0},de=function(he,pe){return k(ae,he,pe)},Ne=le(de,Ie,ue);Ie=Ne||ue.exports,V.modules[ae]=Ie,delete V.payloads[ae]}le=V.modules[ae]=Ie||le}return le};function Ce(ie){var ae=g;ie&&(g[ie]||(g[ie]={}),ae=g[ie]),(!ae.define||!ae.define.packaged)&&(V.original=ae.define,ae.define=V,ae.define.packaged=!0),(!ae.require||!ae.require.packaged)&&($.original=ae.require,ae.require=$,ae.require.packaged=!0)}Ce(r)})(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(r,g,V){function k($,oe,re){Object.defineProperty($,oe,{value:re,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||k(String.prototype,"startsWith",function($,oe){return oe=oe||0,this.lastIndexOf($,oe)===oe}),String.prototype.endsWith||k(String.prototype,"endsWith",function($,oe){var re=this;(oe===void 0||oe>re.length)&&(oe=re.length),oe-=$.length;var Ce=re.indexOf($,oe);return Ce!==-1&&Ce===oe}),String.prototype.repeat||k(String.prototype,"repeat",function($){for(var oe="",re=this;$>0;)$&1&&(oe+=re),($>>=1)&&(re+=re);return oe}),String.prototype.includes||k(String.prototype,"includes",function($,oe){return this.indexOf($,oe)!=-1}),Object.assign||(Object.assign=function($){if($==null)throw new TypeError("Cannot convert undefined or null to object");for(var oe=Object($),re=1;re<arguments.length;re++){var Ce=arguments[re];Ce!=null&&Object.keys(Ce).forEach(function(ie){oe[ie]=Ce[ie]})}return oe}),Object.values||(Object.values=function($){return Object.keys($).map(function(oe){return $[oe]})}),Array.prototype.find||k(Array.prototype,"find",function($){for(var oe=this.length,re=arguments[1],Ce=0;Ce<oe;Ce++){var ie=this[Ce];if($.call(re,ie,Ce,this))return ie}}),Array.prototype.findIndex||k(Array.prototype,"findIndex",function($){for(var oe=this.length,re=arguments[1],Ce=0;Ce<oe;Ce++){var ie=this[Ce];if($.call(re,ie,Ce,this))return Ce}}),Array.prototype.includes||k(Array.prototype,"includes",function($,oe){return this.indexOf($,oe)!=-1}),Array.prototype.fill||k(Array.prototype,"fill",function($){for(var oe=this,re=oe.length>>>0,Ce=arguments[1],ie=Ce>>0,ae=ie<0?Math.max(re+ie,0):Math.min(ie,re),le=arguments[2],Ie=le===void 0?re:le>>0,ue=Ie<0?Math.max(re+Ie,0):Math.min(Ie,re);ae<ue;)oe[ae]=$,ae++;return oe}),Array.of||k(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(r,g,V){r("./es6-shim")}),ace.define("ace/lib/lang",["require","exports","module"],function(r,g,V){g.last=function(oe){return oe[oe.length-1]},g.stringReverse=function(oe){return oe.split("").reverse().join("")},g.stringRepeat=function(oe,re){for(var Ce="";re>0;)re&1&&(Ce+=oe),(re>>=1)&&(oe+=oe);return Ce};var k=/^\s\s*/,$=/\s\s*$/;g.stringTrimLeft=function(oe){return oe.replace(k,"")},g.stringTrimRight=function(oe){return oe.replace($,"")},g.copyObject=function(oe){var re={};for(var Ce in oe)re[Ce]=oe[Ce];return re},g.copyArray=function(oe){for(var re=[],Ce=0,ie=oe.length;Ce<ie;Ce++)oe[Ce]&&typeof oe[Ce]=="object"?re[Ce]=this.copyObject(oe[Ce]):re[Ce]=oe[Ce];return re},g.deepCopy=function oe(re){if(typeof re!="object"||!re)return re;var Ce;if(Array.isArray(re)){Ce=[];for(var ie=0;ie<re.length;ie++)Ce[ie]=oe(re[ie]);return Ce}if(Object.prototype.toString.call(re)!=="[object Object]")return re;Ce={};for(var ie in re)Ce[ie]=oe(re[ie]);return Ce},g.arrayToMap=function(oe){for(var re={},Ce=0;Ce<oe.length;Ce++)re[oe[Ce]]=1;return re},g.createMap=function(oe){var re=Object.create(null);for(var Ce in oe)re[Ce]=oe[Ce];return re},g.arrayRemove=function(oe,re){for(var Ce=0;Ce<=oe.length;Ce++)re===oe[Ce]&&oe.splice(Ce,1)},g.escapeRegExp=function(oe){return oe.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},g.escapeHTML=function(oe){return(""+oe).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},g.getMatchOffsets=function(oe,re){var Ce=[];return oe.replace(re,function(ie){Ce.push({offset:arguments[arguments.length-2],length:ie.length})}),Ce},g.deferredCall=function(oe){var re=null,Ce=function(){re=null,oe()},ie=function(ae){return ie.cancel(),re=setTimeout(Ce,ae||0),ie};return ie.schedule=ie,ie.call=function(){return this.cancel(),oe(),ie},ie.cancel=function(){return clearTimeout(re),re=null,ie},ie.isPending=function(){return re},ie},g.delayedCall=function(oe,re){var Ce=null,ie=function(){Ce=null,oe()},ae=function(le){Ce==null&&(Ce=setTimeout(ie,le||re))};return ae.delay=function(le){Ce&&clearTimeout(Ce),Ce=setTimeout(ie,le||re)},ae.schedule=ae,ae.call=function(){this.cancel(),oe()},ae.cancel=function(){Ce&&clearTimeout(Ce),Ce=null},ae.isPending=function(){return Ce},ae}}),ace.define("ace/lib/oop",["require","exports","module"],function(r,g,V){g.inherits=function(k,$){k.super_=$,k.prototype=Object.create($.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}})},g.mixin=function(k,$){for(var oe in $)k[oe]=$[oe];return k},g.implement=function(k,$){g.mixin(k,$)}}),ace.define("ace/lib/useragent",["require","exports","module"],function(r,g,V){g.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},g.getOS=function(){return g.isMac?g.OS.MAC:g.isLinux?g.OS.LINUX:g.OS.WINDOWS};var k=typeof navigator=="object"?navigator:{},$=(/mac|win|linux/i.exec(k.platform)||["other"])[0].toLowerCase(),oe=k.userAgent||"",re=k.appName||"";g.isWin=$=="win",g.isMac=$=="mac",g.isLinux=$=="linux",g.isIE=re=="Microsoft Internet Explorer"||re.indexOf("MSAppHost")>=0?parseFloat((oe.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((oe.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),g.isOldIE=g.isIE&&g.isIE<9,g.isGecko=g.isMozilla=oe.match(/ Gecko\/\d+/),g.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",g.isWebKit=parseFloat(oe.split("WebKit/")[1])||void 0,g.isChrome=parseFloat(oe.split(" Chrome/")[1])||void 0,g.isEdge=parseFloat(oe.split(" Edge/")[1])||void 0,g.isAIR=oe.indexOf("AdobeAIR")>=0,g.isAndroid=oe.indexOf("Android")>=0,g.isChromeOS=oe.indexOf(" CrOS ")>=0,g.isIOS=/iPad|iPhone|iPod/.test(oe)&&!window.MSStream,g.isIOS&&(g.isMac=!0),g.isMobile=g.isIOS||g.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(r,g,V){var k=r("./useragent"),$="http://www.w3.org/1999/xhtml";g.buildDom=function le(Ie,ue,de){if(typeof Ie=="string"&&Ie){var Ne=document.createTextNode(Ie);return ue&&ue.appendChild(Ne),Ne}if(!Array.isArray(Ie))return Ie&&Ie.appendChild&&ue&&ue.appendChild(Ie),Ie;if(typeof Ie[0]!="string"||!Ie[0]){for(var he=[],pe=0;pe<Ie.length;pe++){var ze=le(Ie[pe],ue,de);ze&&he.push(ze)}return he}var xe=document.createElement(Ie[0]),Oe=Ie[1],_e=1;Oe&&typeof Oe=="object"&&!Array.isArray(Oe)&&(_e=2);for(var pe=_e;pe<Ie.length;pe++)le(Ie[pe],xe,de);return _e==2&&Object.keys(Oe).forEach(function(At){var $e=Oe[At];At==="class"?xe.className=Array.isArray($e)?$e.join(" "):$e:typeof $e=="function"||At=="value"||At[0]=="$"?xe[At]=$e:At==="ref"?de&&(de[$e]=xe):At==="style"?typeof $e=="string"&&(xe.style.cssText=$e):$e!=null&&xe.setAttribute(At,$e)}),ue&&ue.appendChild(xe),xe},g.getDocumentHead=function(le){return le||(le=document),le.head||le.getElementsByTagName("head")[0]||le.documentElement},g.createElement=function(le,Ie){return document.createElementNS?document.createElementNS(Ie||$,le):document.createElement(le)},g.removeChildren=function(le){le.innerHTML=""},g.createTextNode=function(le,Ie){var ue=Ie?Ie.ownerDocument:document;return ue.createTextNode(le)},g.createFragment=function(le){var Ie=le?le.ownerDocument:document;return Ie.createDocumentFragment()},g.hasCssClass=function(le,Ie){var ue=(le.className+"").split(/\s+/g);return ue.indexOf(Ie)!==-1},g.addCssClass=function(le,Ie){g.hasCssClass(le,Ie)||(le.className+=" "+Ie)},g.removeCssClass=function(le,Ie){for(var ue=le.className.split(/\s+/g);;){var de=ue.indexOf(Ie);if(de==-1)break;ue.splice(de,1)}le.className=ue.join(" ")},g.toggleCssClass=function(le,Ie){for(var ue=le.className.split(/\s+/g),de=!0;;){var Ne=ue.indexOf(Ie);if(Ne==-1)break;de=!1,ue.splice(Ne,1)}return de&&ue.push(Ie),le.className=ue.join(" "),de},g.setCssClass=function(le,Ie,ue){ue?g.addCssClass(le,Ie):g.removeCssClass(le,Ie)},g.hasCssString=function(le,Ie){var ue=0,de;if(Ie=Ie||document,de=Ie.querySelectorAll("style")){for(;ue<de.length;)if(de[ue++].id===le)return!0}},g.removeElementById=function(le,Ie){Ie=Ie||document,Ie.getElementById(le)&&Ie.getElementById(le).remove()};var oe,re=[];g.useStrictCSP=function(le){oe=le,le==!1?Ce():re||(re=[])};function Ce(){var le=re;re=null,le&&le.forEach(function(Ie){ie(Ie[0],Ie[1])})}function ie(le,Ie,ue){if(!(typeof document>"u")){if(re){if(ue)Ce();else if(ue===!1)return re.push([le,Ie])}if(!oe){var de=ue;!ue||!ue.getRootNode?de=document:(de=ue.getRootNode(),(!de||de==ue)&&(de=document));var Ne=de.ownerDocument||de;if(Ie&&g.hasCssString(Ie,de))return null;Ie&&(le+=`
208
208
  /*# sourceURL=ace/css/`+Ie+" */");var he=g.createElement("style");he.appendChild(Ne.createTextNode(le)),Ie&&(he.id=Ie),de==Ne&&(de=g.getDocumentHead(Ne)),de.insertBefore(he,de.firstChild)}}}if(g.importCssString=ie,g.importCssStylsheet=function(le,Ie){g.buildDom(["link",{rel:"stylesheet",href:le}],g.getDocumentHead(Ie))},g.scrollbarWidth=function(le){var Ie=g.createElement("ace_inner");Ie.style.width="100%",Ie.style.minWidth="0px",Ie.style.height="200px",Ie.style.display="block";var ue=g.createElement("ace_outer"),de=ue.style;de.position="absolute",de.left="-10000px",de.overflow="hidden",de.width="200px",de.minWidth="0px",de.height="150px",de.display="block",ue.appendChild(Ie);var Ne=le&&le.documentElement||document&&document.documentElement;if(!Ne)return 0;Ne.appendChild(ue);var he=Ie.offsetWidth;de.overflow="scroll";var pe=Ie.offsetWidth;return he===pe&&(pe=ue.clientWidth),Ne.removeChild(ue),he-pe},g.computedStyle=function(le,Ie){return window.getComputedStyle(le,"")||{}},g.setStyle=function(le,Ie,ue){le[Ie]!==ue&&(le[Ie]=ue)},g.HAS_CSS_ANIMATION=!1,g.HAS_CSS_TRANSFORMS=!1,g.HI_DPI=k.isWin?typeof window<"u"&&window.devicePixelRatio>=1.5:!0,k.isChromeOS&&(g.HI_DPI=!1),typeof document<"u"){var ae=document.createElement("div");g.HI_DPI&&ae.style.transform!==void 0&&(g.HAS_CSS_TRANSFORMS=!0),!k.isEdge&&typeof ae.style.animationName<"u"&&(g.HAS_CSS_ANIMATION=!0),ae=null}g.HAS_CSS_TRANSFORMS?g.translate=function(le,Ie,ue){le.style.transform="translate("+Math.round(Ie)+"px, "+Math.round(ue)+"px)"}:g.translate=function(le,Ie,ue){le.style.top=Math.round(ue)+"px",le.style.left=Math.round(Ie)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(r,g,V){/*
209
209
  * based on code from:
210
210
  *
@@ -1152,5 +1152,5 @@ styles.join("\\n")
1152
1152
  line-height: 1.4;
1153
1153
  background: #25282c;
1154
1154
  color: #c1c1c1;
1155
- }`,"autocompletion.css",!1),g.AcePopup=Ie,g.$singleLineEditor=le,g.getAriaId=ae}),ace.define("ace/autocomplete/util",["require","exports","module"],function(r,g,V){g.parForEach=function($,oe,re){var Ce=0,ie=$.length;ie===0&&re();for(var ae=0;ae<ie;ae++)oe($[ae],function(le,Ie){Ce++,Ce===ie&&re(le,Ie)})};var k=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;g.retrievePrecedingIdentifier=function($,oe,re){re=re||k;for(var Ce=[],ie=oe-1;ie>=0&&re.test($[ie]);ie--)Ce.push($[ie]);return Ce.reverse().join("")},g.retrieveFollowingIdentifier=function($,oe,re){re=re||k;for(var Ce=[],ie=oe;ie<$.length&&re.test($[ie]);ie++)Ce.push($[ie]);return Ce},g.getCompletionPrefix=function($){var oe=$.getCursorPosition(),re=$.session.getLine(oe.row),Ce;return $.completers.forEach(function(ie){ie.identifierRegexps&&ie.identifierRegexps.forEach(function(ae){!Ce&&ae&&(Ce=this.retrievePrecedingIdentifier(re,oe.column,ae))}.bind(this))}.bind(this)),Ce||this.retrievePrecedingIdentifier(re,oe.column)}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config"],function(r,g,V){var k=r("./keyboard/hash_handler").HashHandler,$=r("./autocomplete/popup").AcePopup,oe=r("./autocomplete/popup").getAriaId,re=r("./autocomplete/util"),Ce=r("./lib/lang"),ie=r("./lib/dom"),ae=r("./snippets").snippetManager,le=r("./config"),Ie=function(){this.autoInsert=!1,this.autoSelect=!0,this.exactMatch=!1,this.gatherCompletionsId=0,this.keyboardHandler=new k,this.keyboardHandler.bindKeys(this.commands),this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.changeTimer=Ce.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=Ce.delayedCall(this.updateDocTooltip.bind(this),50)};(function(){this.$init=function(){return this.popup=new $(document.body||document.documentElement),this.popup.on("click",function(de){this.insertMatch(),de.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.tooltipTimer.bind(null,null)),this.popup.on("select",this.tooltipTimer.bind(null,null)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup},this.getPopup=function(){return this.popup||this.$init()},this.openPopup=function(de,Ne,he){this.popup||this.$init(),this.popup.autoSelect=this.autoSelect,this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions({activeDescendant:oe(this.popup.getRow())}),de.keyBinding.addKeyboardHandler(this.keyboardHandler);var pe=de.renderer;if(this.popup.setRow(this.autoSelect?0:-1),he)he&&!Ne&&this.detach();else{this.popup.setTheme(de.getTheme()),this.popup.setFontSize(de.getFontSize());var ze=pe.layerConfig.lineHeight,xe=pe.$cursorLayer.getPixelPosition(this.base,!0);xe.left-=this.popup.getTextLeftOffset();var Oe=de.container.getBoundingClientRect();xe.top+=Oe.top-pe.layerConfig.offset,xe.left+=Oe.left-de.renderer.scrollLeft,xe.left+=pe.gutterWidth,this.popup.show(xe,ze)}this.changeTimer.cancel()},this.detach=function(){this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener),this.changeTimer.cancel(),this.hideDocTooltip(),this.gatherCompletionsId+=1,this.popup&&this.popup.isOpen&&this.popup.hide(),this.base&&this.base.detach(),this.activated=!1,this.completions=this.base=null},this.changeListener=function(de){var Ne=this.editor.selection.lead;(Ne.row!=this.base.row||Ne.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},this.blurListener=function(de){var Ne=document.activeElement,he=this.editor.textInput.getElement(),pe=de.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(de.relatedTarget),ze=this.popup&&this.popup.container;Ne!=he&&Ne.parentNode!=ze&&!pe&&Ne!=this.tooltipNode&&de.relatedTarget!=he&&this.detach()},this.mousedownListener=function(de){this.detach()},this.mousewheelListener=function(de){this.detach()},this.goTo=function(de){this.popup.goTo(de)},this.insertMatch=function(de,Ne){if(de||(de=this.popup.getData(this.popup.getRow())),!de)return!1;var he=this.completions;if(this.editor.startOperation({command:{name:"insertMatch"}}),de.completer&&de.completer.insertMatch)de.completer.insertMatch(this.editor,de);else{if(!he)return!1;if(he.filterText)for(var pe=this.editor.selection.getAllRanges(),ze=0,xe;xe=pe[ze];ze++)xe.start.column-=he.filterText.length,this.editor.session.remove(xe);de.snippet?ae.insertSnippet(this.editor,de.snippet):this.editor.execCommand("insertstring",de.value||de)}this.completions==he&&this.detach(),this.editor.endOperation()},this.commands={Up:function(de){de.completer.goTo("up")},Down:function(de){de.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(de){de.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(de){de.completer.goTo("end")},Esc:function(de){de.completer.detach()},Return:function(de){return de.completer.insertMatch()},"Shift-Return":function(de){de.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(de){var Ne=de.completer.insertMatch();if(!Ne&&!de.tabstopManager)de.completer.goTo("down");else return Ne},PageUp:function(de){de.completer.popup.gotoPageUp()},PageDown:function(de){de.completer.popup.gotoPageDown()}},this.gatherCompletions=function(de,Ne){var he=de.getSession(),pe=de.getCursorPosition(),ze=re.getCompletionPrefix(de);this.base=he.doc.createAnchor(pe.row,pe.column-ze.length),this.base.$insertRight=!0;var xe=[],Oe=de.completers.length;return de.completers.forEach(function(_e,At){_e.getCompletions(de,he,pe,ze,function($e,Fe){!$e&&Fe&&(xe=xe.concat(Fe)),Ne(null,{prefix:re.getCompletionPrefix(de),matches:xe,finished:--Oe===0})})}),!0},this.showPopup=function(de,Ne){this.editor&&this.detach(),this.activated=!0,this.editor=de,de.completer!=this&&(de.completer&&de.completer.detach(),de.completer=this),de.on("changeSelection",this.changeListener),de.on("blur",this.blurListener),de.on("mousedown",this.mousedownListener),de.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,Ne)},this.updateCompletions=function(de,Ne){if(de&&this.base&&this.completions){var he=this.editor.getCursorPosition(),pe=this.editor.session.getTextRange({start:this.base,end:he});if(pe==this.completions.filterText)return;if(this.completions.setFilter(pe),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==pe&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,pe,de);return}if(Ne&&Ne.matches){var he=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(he.row,he.column),this.base.$insertRight=!0,this.completions=new ue(Ne.matches),this.openPopup(this.editor,"",de)}var ze=this.gatherCompletionsId,xe=function(Fe){if(Fe.finished)return this.detach()}.bind(this),Oe=function(Fe){var Ue=Fe.prefix,Ve=Fe.matches;this.completions=new ue(Ve),this.exactMatch&&(this.completions.exactMatch=!0),this.completions.setFilter(Ue);var Dt=this.completions.filtered;if(!Dt.length||Dt.length==1&&Dt[0].value==Ue&&!Dt[0].snippet)return xe(Fe);if(this.autoInsert&&Dt.length==1&&Fe.finished)return this.insertMatch(Dt[0]);this.openPopup(this.editor,Ue,de)}.bind(this),_e=!0,At=null;if(this.gatherCompletions(this.editor,function(Fe,Ue){var Ve=Ue.prefix,Dt=Ue&&Ue.matches;if(!Dt||!Dt.length)return xe(Ue);if(!(Ve.indexOf(Ue.prefix)!==0||ze!=this.gatherCompletionsId)){if(_e){At=Ue;return}Oe(Ue)}}.bind(this)),_e=!1,At){var $e=At;At=null,Oe($e)}},this.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},this.updateDocTooltip=function(){var de=this.popup,Ne=de.data,he=Ne&&(Ne[de.getHoveredRow()]||Ne[de.getRow()]),pe=null;if(!he||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();if(this.editor.completers.some(function(ze){return ze.getDocTooltip&&(pe=ze.getDocTooltip(he)),pe}),!pe&&typeof he!="string"&&(pe=he),typeof pe=="string"&&(pe={docText:pe}),!pe||!(pe.docHTML||pe.docText))return this.hideDocTooltip();this.showDocTooltip(pe)},this.showDocTooltip=function(de){this.tooltipNode||(this.tooltipNode=ie.createElement("div"),this.tooltipNode.className="ace_tooltip ace_doc-tooltip",this.tooltipNode.style.margin=0,this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this));var Ne=this.tooltipNode;de.docHTML?Ne.innerHTML=de.docHTML:de.docText&&(Ne.textContent=de.docText),Ne.parentNode||document.body.appendChild(Ne);var he=this.popup,pe=he.container.getBoundingClientRect();Ne.style.top=he.container.style.top,Ne.style.bottom=he.container.style.bottom,Ne.style.display="block",window.innerWidth-pe.right<320?pe.left<320?he.isTopdown?(Ne.style.top=pe.bottom+"px",Ne.style.left=pe.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.top=he.container.offsetTop-Ne.offsetHeight+"px",Ne.style.left=pe.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.right=window.innerWidth-pe.left+"px",Ne.style.left=""):(Ne.style.left=pe.right+1+"px",Ne.style.right="")},this.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var de=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==de&&this.editor.focus(),this.tooltipNode=null,de.parentNode&&de.parentNode.removeChild(de)}},this.onTooltipClick=function(de){for(var Ne=de.target;Ne&&Ne!=this.tooltipNode;){if(Ne.nodeName=="A"&&Ne.href){Ne.rel="noreferrer",Ne.target="_blank";break}Ne=Ne.parentNode}},this.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var de=this.popup.container;de&&de.parentNode&&de.parentNode.removeChild(de)}this.editor&&this.editor.completer==this&&this.editor.completer==null,this.popup=null}}).call(Ie.prototype),Ie.for=function(de){return de.completer||(le.get("sharedPopups")?(Ie.$shared||(Ie.$sharedInstance=new Ie),de.completer=Ie.$sharedInstance):(de.completer=new Ie,de.once("destroy",function(Ne,he){he.completer.destroy()}))),de.completer},Ie.startCommand={name:"startAutocomplete",exec:function(de,Ne){var he=Ie.for(de);he.autoInsert=!1,he.autoSelect=!0,he.showPopup(de,Ne),he.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var ue=function(de,Ne){this.all=de,this.filtered=de,this.filterText=Ne||"",this.exactMatch=!1};(function(){this.setFilter=function(de){if(de.length>this.filterText&&de.lastIndexOf(this.filterText,0)===0)var Ne=this.filtered;else var Ne=this.all;this.filterText=de,Ne=this.filterCompletions(Ne,this.filterText),Ne=Ne.sort(function(pe,ze){return ze.exactMatch-pe.exactMatch||ze.$score-pe.$score||(pe.caption||pe.value).localeCompare(ze.caption||ze.value)});var he=null;Ne=Ne.filter(function(pe){var ze=pe.snippet||pe.caption||pe.value;return ze===he?!1:(he=ze,!0)}),this.filtered=Ne},this.filterCompletions=function(de,Ne){var he=[],pe=Ne.toUpperCase(),ze=Ne.toLowerCase();e:for(var xe=0,Oe;Oe=de[xe];xe++){var _e=Oe.caption||Oe.value||Oe.snippet;if(_e){var At=-1,$e=0,Fe=0,Ue,Ve;if(this.exactMatch){if(Ne!==_e.substr(0,Ne.length))continue e}else{var Dt=_e.toLowerCase().indexOf(ze);if(Dt>-1)Fe=Dt;else for(var qe=0;qe<Ne.length;qe++){var kt=_e.indexOf(ze[qe],At+1),jt=_e.indexOf(pe[qe],At+1);if(Ue=kt>=0&&(jt<0||kt<jt)?kt:jt,Ue<0)continue e;Ve=Ue-At-1,Ve>0&&(At===-1&&(Fe+=10),Fe+=Ve,$e=$e|1<<qe),At=Ue}}Oe.matchMask=$e,Oe.exactMatch=Fe?0:1,Oe.$score=(Oe.score||0)-Fe,he.push(Oe)}}return he}}).call(ue.prototype),g.Autocomplete=Ie,g.FilteredList=ue}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(r,g,V){var k=r("../range").Range,$=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function oe(Ce,ie){var ae=Ce.getTextRange(k.fromPoints({row:0,column:0},ie));return ae.split($).length-1}function re(Ce,ie){var ae=oe(Ce,ie),le=Ce.getValue().split($),Ie=Object.create(null),ue=le[ae];return le.forEach(function(de,Ne){if(!(!de||de===ue)){var he=Math.abs(ae-Ne),pe=le.length-he;Ie[de]?Ie[de]=Math.max(pe,Ie[de]):Ie[de]=pe}}),Ie}g.getCompletions=function(Ce,ie,ae,le,Ie){var ue=re(ie,ae),de=Object.keys(ue);Ie(null,de.map(function(Ne){return{caption:Ne,value:Ne,score:ue[Ne],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(r,g,V){var k=r("../snippets").snippetManager,$=r("../autocomplete").Autocomplete,oe=r("../config"),re=r("../lib/lang"),Ce=r("../autocomplete/util"),ie=r("../autocomplete/text_completer"),ae={getCompletions:function(Oe,_e,At,$e,Fe){if(_e.$mode.completer)return _e.$mode.completer.getCompletions(Oe,_e,At,$e,Fe);var Ue=Oe.session.getState(At.row),Ve=_e.$mode.getCompletions(Ue,_e,At,$e);Fe(null,Ve)}},le=function(Oe){var _e={};return Oe.replace(/\${(\d+)(:(.*?))?}/g,function(At,$e,Fe,Ue){return _e[$e]=Ue||""}).replace(/\$(\d+?)/g,function(At,$e){return _e[$e]})},Ie={getCompletions:function(Oe,_e,At,$e,Fe){var Ue=[],Ve=_e.getTokenAt(At.row,At.column);Ve&&Ve.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?Ue.push("html-tag"):Ue=k.getActiveScopes(Oe);var Dt=k.snippetMap,qe=[];Ue.forEach(function(kt){for(var jt=Dt[kt]||[],Pt=jt.length;Pt--;){var ti=jt[Pt],ei=ti.name||ti.tabTrigger;ei&&qe.push({caption:ei,snippet:ti.content,meta:ti.tabTrigger&&!ti.name?ti.tabTrigger+"⇥ ":"snippet",type:"snippet"})}},this),Fe(null,qe)},getDocTooltip:function(Oe){Oe.type=="snippet"&&!Oe.docHTML&&(Oe.docHTML=["<b>",re.escapeHTML(Oe.caption),"</b>","<hr></hr>",re.escapeHTML(le(Oe.snippet))].join(""))}},ue=[Ie,ie,ae];g.setCompleters=function(Oe){ue.length=0,Oe&&ue.push.apply(ue,Oe)},g.addCompleter=function(Oe){ue.push(Oe)},g.textCompleter=ie,g.keyWordCompleter=ae,g.snippetCompleter=Ie;var de={name:"expandSnippet",exec:function(Oe){return k.expandWithTab(Oe)},bindKey:"Tab"},Ne=function(Oe,_e){he(_e.session.$mode)},he=function(Oe){typeof Oe=="string"&&(Oe=oe.$modes[Oe]),Oe&&(k.files||(k.files={}),pe(Oe.$id,Oe.snippetFileId),Oe.modes&&Oe.modes.forEach(he))},pe=function(Oe,_e){!_e||!Oe||k.files[Oe]||(k.files[Oe]={},oe.loadModule(_e,function(At){At&&(k.files[Oe]=At,!At.snippets&&At.snippetText&&(At.snippets=k.parseSnippetFile(At.snippetText)),k.register(At.snippets||[],At.scope),At.includeScopes&&(k.snippetMap[At.scope].includeScopes=At.includeScopes,At.includeScopes.forEach(function($e){he("ace/mode/"+$e)})))}))},ze=function(Oe){var _e=Oe.editor,At=_e.completer&&_e.completer.activated;if(Oe.command.name==="backspace")At&&!Ce.getCompletionPrefix(_e)&&_e.completer.detach();else if(Oe.command.name==="insertstring"){var $e=Ce.getCompletionPrefix(_e);if($e&&!At){var Fe=$.for(_e);Fe.autoInsert=!1,Fe.showPopup(_e)}}},xe=r("../editor").Editor;r("../config").defineOptions(xe.prototype,"editor",{enableBasicAutocompletion:{set:function(Oe){Oe?(this.completers||(this.completers=Array.isArray(Oe)?Oe:ue),this.commands.addCommand($.startCommand)):this.commands.removeCommand($.startCommand)},value:!1},enableLiveAutocompletion:{set:function(Oe){Oe?(this.completers||(this.completers=Array.isArray(Oe)?Oe:ue),this.commands.on("afterExec",ze)):this.commands.removeListener("afterExec",ze)},value:!1},enableSnippets:{set:function(Oe){Oe?(this.commands.addCommand(de),this.on("changeMode",Ne),Ne(null,this)):(this.commands.removeCommand(de),this.off("changeMode",Ne))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(r){i&&(i.exports=r)})}()})(extLanguage_tools),ace$1.config.setModuleUrl("ace/theme/github",themeUrl),ace$1.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace$1.config.setModuleUrl("ace/mode/base",workerBaseUrl),ace$1.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace$1.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl),ace$1.config.setModuleUrl("ace/snippets/json",snippetsJsonUrl),ace$1.config.setModuleUrl("ace/mode/javascript",modeJavascriptUrl),ace$1.config.setModuleUrl("ace/mode/javascript_worker",workerJavascriptUrl),ace$1.config.setModuleUrl("ace/snippets/javascript",snippetsJavascriptUrl),ace$1.require("ace/ext/language_tools");const _sfc_main$c=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.ref(!1),V=vue.computed({get(){return r.lang==="json"?JSON.stringify(r.modelValue,null,2):r.modelValue},set(k){r.lang==="json"?n("update:modelValue",JSON.parse(k)):n("update:modelValue",k)}});return(k,$)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElButton),{onClick:$[0]||($[0]=oe=>g.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(g),"onUpdate:modelValue":$[2]||($[2]=oe=>vue.isRef(g)?g.value=oe:null),title:r.title,width:"60%"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(V),"onUpdate:value":$[1]||($[1]=oe=>vue.isRef(V)?V.value=oe:null),lang:r.lang,theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value","lang"])]),_:1},8,["modelValue","title"])]))}}),_hoisted_1$7={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$5={key:1},_hoisted_3$5={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$3={key:1},_sfc_main$b=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},setup(i){const n=i;return(r,g)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.objInfo,(V,k)=>(vue.openBlock(),vue.createElementBlock("div",{key:k},[n.code?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(k))>78?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:String(k),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(k),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(k),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(V.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:JSON.stringify(V.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$5,vue.toDisplayString(V.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString(V.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),n.hide.indexOf(String(k))<0?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:V.title,size:"small"},{default:vue.withCtx(()=>[V.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElSelect),{key:0,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,placeholder:"Select",size:"small",disabled:!!(V!=null&&V.disabled)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(V.options,$=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:$.value,label:$.label,value:$.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(ElInputNumber),{key:1,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:2,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:3,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,autosize:"",type:"textarea",disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(ElColorPicker),{key:4,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(ElSwitch),{key:5,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$c,{key:6,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_9e624fb4_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc(_sfc_main$b,[["__scopeId","data-v-9e624fb4"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$4=["onMouseenter","onClick"],_sfc_main$a=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:n}){const r=i,g=vue.ref(r.val),V=vue.ref(!1),k=vue.ref("进入"),$=vue.ref(null),oe=re=>{n("updateCommonAniVal",re),V.value=!1};return vue.watch(()=>r.val,re=>{g.value=re}),(re,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.unref(g)?(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:0,closable:"",onClose:Ce[0]||(Ce[0]=ie=>oe("")),onClick:Ce[1]||(Ce[1]=ie=>V.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var ie;return[vue.createTextVNode(vue.toDisplayString((ie=vue.unref(common_animate_list).map(ae=>ae.children).reduce((ae,le)=>ae.concat(le)).find(ae=>ae.value==vue.unref(g)))==null?void 0:ie.label)+" ",1),vue.createVNode(vue.unref(ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:Ce[2]||(Ce[2]=ie=>V.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(ElDrawer),{modelValue:vue.unref(V),"onUpdate:modelValue":Ce[5]||(Ce[5]=ie=>vue.isRef(V)?V.value=ie:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabs),{modelValue:vue.unref(k),"onUpdate:modelValue":Ce[4]||(Ce[4]=ie=>vue.isRef(k)?k.value=ie:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),ie=>(vue.openBlock(),vue.createBlock(vue.unref(ElTabPane),{label:ie.label,name:ie.label,key:ie.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(ie.children,(ae,le)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:le,onMouseenter:Ie=>$.value=le,onMouseleave:Ce[3]||(Ce[3]=Ie=>$.value=null),onClick:Ie=>oe(ae.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref($)==le?`animate__animated animate__${ae.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(ae.label),3)],40,_hoisted_3$4))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2807ad45_lang="",CommonAnimate=_export_sfc(_sfc_main$a,[["__scopeId","data-v-2807ad45"]]),_sfc_main$9=vue.defineComponent({__name:"index",setup(i){var k;const n=useGlobalStore(pinia),r=vue.ref(((k=n.handle_svg_info)==null?void 0:k.info.id)||""),g=$=>{for(let oe of n.done_json)oe.selected=!1,oe.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo($)},V={children:"children",label:"title"};return($,oe)=>(vue.openBlock(),vue.createBlock(vue.unref(ElTree),{data:vue.unref(n).done_json,props:V,onNodeClick:g,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!0,"node-key":"id","current-node-key":vue.unref(r)},null,8,["data","current-node-key"]))}}),_withScopeId$1=i=>(vue.pushScopeId("data-v-ecd64a91"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$3=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$8=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.computed({get(){return r.modelValue},set($){n("update:modelValue",$)}}),V=()=>{g.value.push({key:"",val:""})},k=$=>{g.value.splice($,1)};return($,oe)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$3,_hoisted_4$2,vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:V},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),(re,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:re.key,"onUpdate:modelValue":ie=>re.key=ie,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:re.val,"onUpdate:modelValue":ie=>re.val=ie,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:ie=>k(Ce)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_ecd64a91_lang="",List=_export_sfc(_sfc_main$8,[["__scopeId","data-v-ecd64a91"]]),_hoisted_1$4={class:"c-wall-d"},_sfc_main$7=vue.defineComponent({__name:"condition",props:{modelValue:{default:()=>({type:EConditionType.None})}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.computed({get(){return r.modelValue},set($){n("update:modelValue",$)}}),V=[{label:"大于",val:"greater"},{label:"大于等于",val:">="},{label:"小于",val:"<"},{label:"小于等于",val:"<="},{label:"等于",val:"=="},{label:"不等于",val:"!="},{label:"介于",val:">=,=<"},{label:"不介于",val:"<,>"}],k=$=>{$!=="None"&&(g.value.Relation={key:"",relation:"",val:"",val2:""}),n("update:modelValue",g)};return($,oe)=>{var re,Ce;return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$4,[vue.createVNode(vue.unref(ElFormItem),{label:"条件",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(g).type,"onUpdate:modelValue":oe[0]||(oe[0]=ie=>vue.unref(g).type=ie),onChange:k},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"None",label:"无"}),vue.createVNode(vue.unref(ElOption),{value:"Relation",label:"关系运算"})]),_:1},8,["modelValue"])]),_:1}),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"属性",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.key,"onUpdate:modelValue":oe[1]||(oe[1]=ie=>vue.unref(g).Relation.key=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"关系",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(g).Relation.relation,"onUpdate:modelValue":oe[2]||(oe[2]=ie=>vue.unref(g).Relation.relation=ie)},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(V,(ie,ae)=>vue.createVNode(vue.unref(ElOption),{value:ie.val,label:ie.label,key:"rop"+ae},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"值",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.val,"onUpdate:modelValue":oe[3]||(oe[3]=ie=>vue.unref(g).Relation.val=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"&&(((re=vue.unref(g).Relation)==null?void 0:re.relation)===">=,=<"||((Ce=vue.unref(g).Relation)==null?void 0:Ce.relation)==="<,>")?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:3,label:"值2",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.val2,"onUpdate:modelValue":oe[4]||(oe[4]=ie=>vue.unref(g).Relation.val2=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)])}}}),condition_vue_vue_type_style_index_0_scoped_f43f10e6_lang="",Condition=_export_sfc(_sfc_main$7,[["__scopeId","data-v-f43f10e6"]]),_sfc_main$6=vue.defineComponent({__name:"bind-anchor",props:{modelValue:{},title:{}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=useGlobalStore(pinia),V=vue.computed({get(){return r.modelValue!==null},set(ie){let ae=null;ie&&(ae={target_id:"",type:""}),n("update:modelValue",ae)}}),k=vue.computed({get(){var ie;return((ie=r.modelValue)==null?void 0:ie.target_id)??void 0},set(ie){let ae=null;V.value&&(ae={target_id:ie,type:$.value}),n("update:modelValue",ae)}}),$=vue.computed({get(){var ie;return((ie=r.modelValue)==null?void 0:ie.type)??void 0},set(ie){let ae=null;V.value&&(ae={target_id:k.value,type:ie}),n("update:modelValue",ae)}}),oe=vue.computed(()=>g.done_json.filter(ie=>ie.type!==EDoneJsonType.ConnectionLine).map(ie=>({label:ie.title,value:ie.id}))),re=[{label:"上锚点",value:ELineBindAnchors.TopCenter},{label:"右锚点",value:ELineBindAnchors.Right},{label:"下锚点",value:ELineBindAnchors.BottomCenter},{label:"左锚点",value:ELineBindAnchors.Left}];function Ce(){vue.nextTick(function(){var ie,ae;if(V.value&&((ie=r.modelValue)!=null&&ie.target_id)&&((ae=r.modelValue)!=null&&ae.type)&&g.handle_svg_info){let le=null;for(let Ie of g.done_json)Ie.id===r.modelValue.target_id&&(le=Ie);le&&(setSvgActualInfo(le),moveAnchors(le))}})}return(ie,ae)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(vue.unref(ElFormItem),{label:r.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(V),"onUpdate:modelValue":ae[0]||(ae[0]=le=>vue.isRef(V)?V.value=le:null),onChange:Ce},null,8,["modelValue"])]),_:1},8,["label"]),vue.unref(V)?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"绑定对象",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(k),"onUpdate:modelValue":ae[1]||(ae[1]=le=>vue.isRef(k)?k.value=le:null),onChange:Ce},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oe),le=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(V)?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"绑定位置",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref($),"onUpdate:modelValue":ae[2]||(ae[2]=le=>vue.isRef($)?$.value=le:null),onChange:Ce},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(re,le=>vue.createVNode(vue.unref(ElOption),{key:le.value,label:le.label,value:le.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)],64))}}),_withScopeId=i=>(vue.pushScopeId("data-v-ceb83558"),i=i(),vue.popScopeId(),i),_hoisted_1$3=_withScopeId(()=>vue.createElementVNode("span",{style:{"font-weight":"bold"}},"MQTT",-1)),_hoisted_2$2={key:1},_hoisted_3$2={class:"events-title"},_sfc_main$5=vue.defineComponent({__name:"index",setup(i){const n=useConfigStore(pinia),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=vue.ref("page"),k=vue.ref("style"),$=(ue,de)=>{ue!=null&&ue.common_animations&&(ue.common_animations.val=de)};n.$subscribe((ue,de)=>{ue.storeId==="config-store"&&localStorage.setItem("svg-editor-config",JSON.stringify(de))});const oe=vue.ref(numberArray(20)),re=vue.ref(["MQTT"]),Ce=vue.ref();Ce.value=()=>{var de,Ne;let ue={type:EEventType.Null,action:EEventAction.Null,target:"",scripts:"",condition:{type:EConditionType.None}};(Ne=(de=r.handle_svg_info)==null?void 0:de.info)==null||Ne.events.push(ue)};const ie=(ue,de)=>{ue==="ChangeAttr"?de.attrs=[{key:"",val:""}]:delete de.attrs},ae=ue=>{var de,Ne;(Ne=(de=r.handle_svg_info)==null?void 0:de.info)==null||Ne.events.splice(ue,1)},le=()=>{g.center_offset={x:0,y:0}},Ie=()=>{if(r.handle_svg_info){const ue=r.done_json[r.handle_svg_info.index];vue.nextTick(function(){setSvgActualInfo(ue),moveAnchors(ue)})}};return(ue,de)=>vue.unref(r).intention!=vue.unref(EGlobalStoreIntention).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:0,class:"mx-2 rightTabs",modelValue:vue.unref(V),"onUpdate:modelValue":de[13]||(de[13]=Ne=>vue.isRef(V)?V.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabPane),{label:"图纸",name:"page"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"背景色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElColorPicker),{modelValue:vue.unref(n).svg.background_color,"onUpdate:modelValue":de[0]||(de[0]=Ne=>vue.unref(n).svg.background_color=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"画布",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{size:"small",onClick:le,icon:vue.unref(aim_default)},{default:vue.withCtx(()=>[vue.createTextVNode("重置位置")]),_:1},8,["icon"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(g).center_offset.x,"onUpdate:modelValue":de[1]||(de[1]=Ne=>vue.unref(g).center_offset.x=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(g).center_offset.y,"onUpdate:modelValue":de[2]||(de[2]=Ne=>vue.unref(g).center_offset.y=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(n).svg.scale,"onUpdate:modelValue":de[3]||(de[3]=Ne=>vue.unref(n).svg.scale=Ne),step:.1,"step-strictly":""},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"标尺",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(n).svg.ruler,"onUpdate:modelValue":de[4]||(de[4]=Ne=>vue.unref(n).svg.ruler=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"网格",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(n).svg.grid,"onUpdate:modelValue":de[5]||(de[5]=Ne=>vue.unref(n).svg.grid=Ne)},null,8,["modelValue"])]),_:1}),vue.unref(n).svg.grid?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"网格颜色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElColorPicker),{modelValue:vue.unref(n).svg.grid_color,"onUpdate:modelValue":de[6]||(de[6]=Ne=>vue.unref(n).svg.grid_color=Ne)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"连线",name:"line"},{default:vue.withCtx(()=>[vue.unref(n).connection_line.props?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(n).connection_line.props,hide:["point_position"]},null,8,["obj-info"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(n).connection_line.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:vue.unref(n).connection_line.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(n).connection_line.animations.type.val,"onUpdate:modelValue":de[7]||(de[7]=Ne=>vue.unref(n).connection_line.animations.type.val=Ne),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).connection_line.animations.type.options,Ne=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:Ne.value,label:Ne.label,value:Ne.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),vue.unref(n).connection_line.animations.type.val!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:0,"obj-info":vue.unref(n).connection_line.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0)]),_:1})):vue.createCommentVNode("",!0)]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"通信",name:"net"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(re),"onUpdate:modelValue":de[12]||(de[12]=Ne=>vue.isRef(re)?re.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapseItem),{name:"MQTT"},{title:vue.withCtx(()=>[_hoisted_1$3]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"URL",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.url,"onUpdate:modelValue":de[8]||(de[8]=Ne=>vue.unref(n).net.mqtt.url=Ne),placeholder:"如 ws://127.0.0.1:4500"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"用户名",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.user,"onUpdate:modelValue":de[9]||(de[9]=Ne=>vue.unref(n).net.mqtt.user=Ne),placeholder:"username"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"密码",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.pwd,"onUpdate:modelValue":de[10]||(de[10]=Ne=>vue.unref(n).net.mqtt.pwd=Ne),placeholder:"password"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Topics",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.topics,"onUpdate:modelValue":de[11]||(de[11]=Ne=>vue.unref(n).net.mqtt.topics=Ne),placeholder:"topics"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$9)]),_:1})]),_:1},8,["modelValue"])):vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Select&&vue.unref(r).handle_svg_info?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:1,class:"mx-2 rightTabs",modelValue:vue.unref(k),"onUpdate:modelValue":de[32]||(de[32]=Ne=>vue.isRef(k)?k.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabPane),{label:"外观",name:"style"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"标题",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.title,"onUpdate:modelValue":de[14]||(de[14]=Ne=>vue.unref(r).handle_svg_info.info.title=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.x,"onUpdate:modelValue":de[15]||(de[15]=Ne=>vue.unref(r).handle_svg_info.info.x=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.y,"onUpdate:modelValue":de[16]||(de[16]=Ne=>vue.unref(r).handle_svg_info.info.y=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.scale_x,"onUpdate:modelValue":de[17]||(de[17]=Ne=>vue.unref(r).handle_svg_info.info.scale_x=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.scale_y,"onUpdate:modelValue":de[18]||(de[18]=Ne=>vue.unref(r).handle_svg_info.info.scale_y=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"旋转",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.rotate,"onUpdate:modelValue":de[19]||(de[19]=Ne=>vue.unref(r).handle_svg_info.info.rotate=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"显示",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(r).handle_svg_info.info.display,"onUpdate:modelValue":de[20]||(de[20]=Ne=>vue.unref(r).handle_svg_info.info.display=Ne)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"数据",name:"data"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>{var Ne,he,pe,ze;return[vue.createVNode(vue.unref(ElFormItem),{label:"ID",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.id,"onUpdate:modelValue":de[21]||(de[21]=xe=>vue.unref(r).handle_svg_info.info.id=xe)},null,8,["modelValue"])]),_:1}),vue.unref(r).handle_svg_info.info.state?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(vue.unref(r).handle_svg_info.info.state,(xe,Oe)=>{var _e;return vue.openBlock(),vue.createElementBlock("div",{key:"state"+String(Oe)},[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:String(Oe),size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(xe==null?void 0:xe.default),1)]),_:2},1032,["label"]),Oe==="OnOff"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:(_e=vue.unref(r).handle_svg_info.info.state)==null?void 0:_e.OnOff.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(r).handle_svg_info.info.state.OnOff.default,"onUpdate:modelValue":de[22]||(de[22]=At=>vue.unref(r).handle_svg_info.info.state.OnOff.default=At)},null,8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0)])}),128)):vue.createCommentVNode("",!0),(Ne=vue.unref(r).handle_svg_info.info)!=null&&Ne.hasOwnProperty("tag_slot")?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$2,[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:"tag_slot",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(r).handle_svg_info.info.tag_slot),1)]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"文字插槽",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.tag_slot,"onUpdate:modelValue":de[23]||(de[23]=xe=>vue.unref(r).handle_svg_info.info.tag_slot=xe)},null,8,["modelValue"])]),_:1})])):vue.createCommentVNode("",!0),vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.props,code:""},null,8,["obj-info"]),vue.unref(r).handle_svg_info.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:vue.unref(r).handle_svg_info.info.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.animations.type.val,"onUpdate:modelValue":de[24]||(de[24]=xe=>vue.unref(r).handle_svg_info.info.animations.type.val=xe),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.animations.type.options,xe=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:xe.value,label:xe.label,value:xe.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0),((he=vue.unref(r).handle_svg_info.info.animations)==null?void 0:he.type.val)!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:3,"obj-info":vue.unref(r).handle_svg_info.info.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0),((pe=vue.unref(r).handle_svg_info)==null?void 0:pe.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:4,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.start,"onUpdate:modelValue":de[25]||(de[25]=xe=>vue.unref(r).handle_svg_info.info.bind_anchors.start=xe),title:"绑定起点"},null,8,["modelValue"])):vue.createCommentVNode("",!0),((ze=vue.unref(r).handle_svg_info)==null?void 0:ze.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:5,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.end,"onUpdate:modelValue":de[26]||(de[26]=xe=>vue.unref(r).handle_svg_info.info.bind_anchors.end=xe),title:"绑定终点"},null,8,["modelValue"])):vue.createCommentVNode("",!0)]}),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"事件",name:"event"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{type:"primary",style:{width:"100%"},onClick:vue.unref(Ce)},{default:vue.withCtx(()=>[vue.createTextVNode("添加事件")]),_:1},8,["onClick"]),vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(oe),"onUpdate:modelValue":de[27]||(de[27]=Ne=>vue.isRef(oe)?oe.value=Ne:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.events,(Ne,he)=>(vue.openBlock(),vue.createBlock(vue.unref(ElCollapseItem),{name:he,key:"event"+he},{title:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$2,[vue.createElementVNode("span",null,"事件"+vue.toDisplayString(he+1),1),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:vue.withModifiers(pe=>ae(he),["stop"])},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"delete"})]),_:2},1032,["onClick"])])]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"类型",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:Ne.type,"onUpdate:modelValue":pe=>Ne.type=pe},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"Click",label:"点击"}),vue.createVNode(vue.unref(ElOption),{value:"Change",label:"值改变"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),vue.createVNode(vue.unref(ElFormItem),{label:"行为",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:Ne.action,"onUpdate:modelValue":pe=>Ne.action=pe,onChange:pe=>ie(pe,Ne)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"ChangeAttr",label:"改变属性"}),vue.createVNode(vue.unref(ElOption),{value:"JavaScript",label:"执行JavaScript"})]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),Ne.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"目标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:Ne.target,"onUpdate:modelValue":pe=>Ne.target=pe,placeholder:"默认自身"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),Ne.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(List,{key:1,modelValue:Ne.attrs,"onUpdate:modelValue":pe=>Ne.attrs=pe},null,8,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0),Ne.action==="JavaScript"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"JavaScript",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$c,{modelValue:Ne.scripts,"onUpdate:modelValue":pe=>Ne.scripts=pe,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:Ne.condition,"onUpdate:modelValue":pe=>Ne.condition=pe},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"动效",name:"animation"},{default:vue.withCtx(()=>{var Ne;return[(Ne=vue.unref(r).handle_svg_info)!=null&&Ne.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.animations},null,8,["obj-info"])]),_:1})):vue.unref(r).handle_svg_info.info.common_animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"动画效果",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(CommonAnimate,{onUpdateCommonAniVal:de[28]||(de[28]=he=>{var pe;return $((pe=vue.unref(r).handle_svg_info)==null?void 0:pe.info,he)}),val:vue.unref(r).handle_svg_info.info.common_animations.val},null,8,["val"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"延迟",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.delay,"onUpdate:modelValue":de[29]||(de[29]=he=>vue.unref(r).handle_svg_info.info.common_animations.delay=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"delay-0s",label:"无"}),vue.createVNode(vue.unref(ElOption),{value:"delay-1s",label:"1秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-2s",label:"2秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-3s",label:"3秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-4s",label:"4秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-5s",label:"5秒"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"动画速度",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.speed,"onUpdate:modelValue":de[30]||(de[30]=he=>vue.unref(r).handle_svg_info.info.common_animations.speed=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"slow",label:"慢"}),vue.createVNode(vue.unref(ElOption),{value:"slower",label:"最慢"}),vue.createVNode(vue.unref(ElOption),{value:"fast",label:"快"}),vue.createVNode(vue.unref(ElOption),{value:"faster",label:"最快"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"循环次数",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.repeat,"onUpdate:modelValue":de[31]||(de[31]=he=>vue.unref(r).handle_svg_info.info.common_animations.repeat=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"repeat-1",label:"一次"}),vue.createVNode(vue.unref(ElOption),{value:"repeat-2",label:"两次"}),vue.createVNode(vue.unref(ElOption),{value:"repeat-3",label:"三次"}),vue.createVNode(vue.unref(ElOption),{value:"infinite",label:"无限次"})]),_:1},8,["modelValue"])]),_:1})]),_:1})):vue.createCommentVNode("",!0)]}),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$9)]),_:1})]),_:1},8,["modelValue"])):vue.createCommentVNode("",!0)}}),index_vue_vue_type_style_index_0_scoped_ceb83558_lang="",index_vue_vue_type_style_index_1_lang="",RightPanel=_export_sfc(_sfc_main$5,[["__scopeId","data-v-ceb83558"]]),_sfc_main$4=vue.defineComponent({__name:"index",setup(i){const n=vue.ref(""),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=useConfigStore(pinia);return vue.onMounted(()=>{const k={layout_center:g.center_offset,config:V.$state,done_json:r.done_json};n.value=JSON.stringify(k,null,2)}),(k,$)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(n),"onUpdate:value":$[0]||($[0]=oe=>vue.isRef(n)?n.value=oe:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_sfc_main$3=vue.defineComponent({__name:"index",setup(i,{expose:n}){const r=vue.ref("");return n({setVal:k=>{r.value=k},onImportJson:()=>{useImportDataModel(r.value)&&ElMessage.success("导入成功")}}),(k,$)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(r),"onUpdate:value":$[0]||($[0]=oe=>vue.isRef(r)?r.value=oe:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_hoisted_1$2=["onMousedown"],_hoisted_2$1=["onMousedown"],_hoisted_3$1=["title","onMousedown"],_hoisted_4$1={class:"vue-ruler-content-mask"},_sfc_main$2=vue.defineComponent({__name:"index",props:{visible:{type:Boolean,default:!0},stepLength:{default:100}},setup(i){const n=i,r=useSvgEditLayoutStore(pinia),g=useConfigStore(pinia),V=function(){return function(ci,Ai,yi){ci&&Ai&&yi&&ci.addEventListener(Ai,yi,!1)}}(),k=function(){return function(ci,Ai,yi){ci&&Ai&&ci.removeEventListener(Ai,yi,!1)}}();let $=18,oe=vue.ref(0),re=vue.ref(0),Ce=vue.ref([]),ie=vue.ref([]);const ae=vue.ref([]);let le=vue.ref(!1),Ie="",ue=vue.ref(-999),de=vue.ref(-999),Ne=18,he=18,pe="";const ze=vue.ref(null),xe=vue.ref(null),Oe=vue.ref(null),_e=vue.ref(null),At=vue.computed(()=>({width:oe.value+"px",height:re.value+"px"})),$e=vue.computed(()=>({padding:$+"px 0px 0px "+$+"px"})),Fe=vue.computed(()=>{let ci=0,Ai=0;return ae.value.map(yi=>{const ui=yi.type==="h";return{id:`${yi.type}_${ui?ci++:Ai++}`,type:yi.type,title:yi.site.toFixed(0)+"px",[ui?"top":"left"]:yi.site*g.svg.scale+$+r.center_offset[ui?"y":"x"]*g.svg.scale}})});r.$subscribe(ci=>{var Ai,yi,ui,Ci;((yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("left_nav")||(Ci=(ui=ci.events)==null?void 0:ui.target)!=null&&Ci.hasOwnProperty("right_nav"))&&window.setTimeout(Ue,420)}),g.$subscribe(ci=>{var Ai,yi;(yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("scale")&&jt()}),vue.onMounted(()=>{V(document,"mousemove",ti),V(document,"mouseup",ni),Ue(),V(window,"resize",Ve)}),vue.onBeforeUnmount(()=>{k(document,"mousemove",ti),k(document,"mouseup",ni),k(window,"resize",Ve)});const Ue=()=>{kt(),jt()},Ve=()=>{Ce.value=[],ie.value=[],Ue()},Dt=({type:ci,top:Ai,left:yi})=>ci==="h"?{top:Ai+"px"}:{left:yi+"px"},qe=({type:ci,id:Ai})=>ci==="h"?di(Ai):hi(Ai),kt=()=>{const ci=window.getComputedStyle(xe.value.parentNode,null);oe.value=parseInt(ci.getPropertyValue("width")),re.value=parseInt(ci.getPropertyValue("height")),Ne=Oe.value.clientWidth,he=_e.value.clientHeight},jt=()=>{Pt(Ce.value,oe.value,r.center_offset.x),Pt(ie.value,re.value,r.center_offset.y)},Pt=(ci,Ai,yi)=>{if(ci.length===0)for(let ui=0;ui<Ai;ui+=n.stepLength)ui%n.stepLength===0&&ci.push({id:Number((ui/g.svg.scale-yi).toFixed(0))});else ci.forEach((ui,Ci)=>{ui.id=Number((Ci*n.stepLength/g.svg.scale-yi).toFixed(0))})},ti=ci=>{jt(),ei(ci)},ei=ci=>{if(!(ci.layerX===ci.x||ci.layerY===ci.y))switch(Ie){case"x":le.value&&(de.value=ci.layerY);break;case"y":le.value&&(ue.value=ci.layerX);break;case"h":le.value&&(de.value=ci.layerY);break;case"v":le.value&&(ue.value=ci.layerX);break}},Lt=ci=>{le.value=!0,Ie=ci},ni=ci=>{ri(ci)},ri=ci=>{if(le.value){switch(le.value=!1,Ie){case"x":const Ai=Math.round((ci.layerY-$)/g.svg.scale-r.center_offset.y);if(Ai<=0){de.value=-999;return}ae.value.push({type:"h",site:Ai});break;case"y":const yi=Math.round((ci.layerX-$)/g.svg.scale-r.center_offset.x);if(yi<=0){ue.value=-999;return}ae.value.push({type:"v",site:yi});break;case"h":Ii(ae.value,Math.round((ci.layerY-$)/g.svg.scale-r.center_offset.y),Math.round(he/g.svg.scale-r.center_offset.y),"h");break;case"v":Ii(ae.value,Math.round((ci.layerX-$)/g.svg.scale-r.center_offset.x),Math.round(Ne/g.svg.scale-r.center_offset.x),"v");break}de.value=ue.value=-999}},Ii=(ci,Ai,yi,ui)=>{if(Ai<yi){let Ci;Fe.value.forEach((zi,Ni)=>{zi.id===pe&&(Ci=Ni)}),ci.splice(Ci,1)}else{let Ci;Fe.value.forEach((zi,Ni)=>{zi.id===pe&&(Ci=Ni)}),ci.splice(Ci,1,{type:ui,site:Ai})}},wi=()=>{Lt("x")},ai=()=>{Lt("y")},di=ci=>{le.value=!0,Ie="h",pe=ci},hi=ci=>{le.value=!0,Ie="v",pe=ci};return(ci,Ai)=>(vue.openBlock(),vue.createElementBlock("div",{style:vue.normalizeStyle(vue.unref(At)),class:"vue-ruler-wrapper",onselectStart:"return false;",ref_key:"el",ref:xe},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref_key:"horizontalRuler",ref:_e,class:"vue-ruler-h",onMousedown:vue.withModifiers(wi,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Ce),(yi,ui)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({left:ui*ci.stepLength+"px"}),class:"n"},vue.toDisplayString(yi.id),5))),256))],40,_hoisted_1$2),vue.createElementVNode("div",{ref_key:"verticalRuler",ref:Oe,class:"vue-ruler-v",onMousedown:vue.withModifiers(ai,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(ie),(yi,ui)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({top:ui*ci.stepLength+"px"}),class:"n"},vue.toDisplayString(yi.id),5))),256))],40,_hoisted_2$1),vue.createElementVNode("div",{style:vue.normalizeStyle({top:vue.unref(de)+"px"}),class:"vue-ruler-ref-dot-h"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(de)-vue.unref(he))/vue.unref(g).svg.scale)),1)],4),vue.createElementVNode("div",{style:vue.normalizeStyle({left:vue.unref(ue)+"px"}),class:"vue-ruler-ref-dot-v"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(ue)-vue.unref(Ne))/vue.unref(g).svg.scale)),1)],4),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Fe),yi=>(vue.openBlock(),vue.createElementBlock("div",{title:yi.title,style:vue.normalizeStyle(Dt(yi)),key:yi.id,class:vue.normalizeClass(`vue-ruler-ref-line-${yi.type}`),onMousedown:ui=>qe(yi)},null,46,_hoisted_3$1))),128))],512),[[vue.vShow,n.visible]]),vue.createElementVNode("div",{ref_key:"content",ref:ze,class:"vue-ruler-content",style:vue.normalizeStyle(vue.unref($e))},[vue.renderSlot(ci.$slots,"default")],4),vue.withDirectives(vue.createElementVNode("div",_hoisted_4$1,null,512),[[vue.vShow,vue.unref(le)]])],4))}}),index_vue_vue_type_style_index_0_lang="";function fileWrite(i,n=new Date(Date.now()).toLocaleString()){const r=JSON.stringify(i),g=new Blob([r]);let V=document.createElement("a");V.download=n+".json",V.style.display="none",V.href=URL.createObjectURL(g),document.body.appendChild(V),V.click(),document.body.removeChild(V)}function fileRead(i){return new Promise((n,r)=>{let g=new FileReader;g.readAsText(i,"UTF-8"),g.onload=function(V){V&&V.target?n(V.target.result):r("文件读取错误")}})}const _hoisted_1$1={class:"canvas-main-pc"},_sfc_main$1=vue.defineComponent({__name:"index",props:{customToolbar:{},data:{},saveFile:{type:Boolean,default:!1}},emits:["onReturn","onPreview","onSave"],setup(i,{expose:n,emit:r}){const g=i,V=useGlobalStore(pinia),k=useSvgEditLayoutStore(pinia),$=useConfigStore(pinia),oe=useEditPrivateStore(pinia),re=vue.ref(),Ce=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),ie=(he,pe)=>{Ce[he]=pe},ae=vue.ref();ae.value=()=>{re.value.onImportJson(),ie(EVisibleConfKey.ImportJson,!1)};const le=he=>["text/plain","application/json"].indexOf(he.type)<0?(ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(he).then(pe=>{re.value.setVal(pe),ElMessage.success("文件读取成功!")}),!1),Ie=he=>{V.setDoneJson(he)};vue.onMounted(()=>{oe.history_doneComponent=[],oe.history_now_index=0,g.data?useImportDataModel(g.data):V.setDoneJson([]),V.intention=EGlobalStoreIntention.None});const{appContext:ue}=vue.getCurrentInstance();function de(he){r("onReturn",{data:he,isChange:oe.getTopBtnUndoStatus})}function Ne(he){g.saveFile?ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},ue).then(pe=>{fileWrite(he,pe.value.trim()),r("onSave",he)}).catch(pe=>{console.log(pe)}):r("onSave",he)}return n({setGraphNodeJson:Ie}),(he,pe)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElContainer),null,{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElHeader),{class:"top-el-header"},{default:vue.withCtx(()=>[vue.createVNode(TopPanel,{onChangeVisible:ie,onOnReturn:de,onOnPreview:pe[0]||(pe[0]=ze=>r("onPreview",ze)),onOnSave:Ne})]),_:1}),vue.createVNode(vue.unref(ElContainer),{class:"middle"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(k).left_nav?"show-nav":"hide-nav"]),style:{"border-right":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(LeftPanel,{class:"content-left","custom-toolbar":g.customToolbar},null,8,["custom-toolbar"])]),_:1})]),_:1},8,["class"]),vue.createVNode(vue.unref(ElMain),{class:"middle main"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$1,[vue.createVNode(_sfc_main$2,{class:"canvas-main-pc",visible:vue.unref($).svg.ruler},{default:vue.withCtx(()=>[vue.createVNode(CenterPanel)]),_:1},8,["visible"])])]),_:1}),vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(k).right_nav?"show-nav":"hide-nav"]),style:{"border-left":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(RightPanel)]),_:1})]),_:1},8,["class"])]),_:1})]),_:1}),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(Ce).ImportJson,"onUpdate:modelValue":pe[2]||(pe[2]=ze=>vue.unref(Ce).ImportJson=ze),title:"导入数据",width:"60%","destroy-on-close":""},{footer:vue.withCtx(()=>[vue.createVNode(vue.unref(ElUpload),{beforeUpload:le,style:{display:"inline-flex","margin-right":"12px"},multiple:!1,"show-file-list":!1,limit:1},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{onClick:pe[1]||(pe[1]=ze=>ie(vue.unref(EVisibleConfKey).ImportFile,!0))},{default:vue.withCtx(()=>[vue.createTextVNode("读取文件")]),_:1})]),_:1}),vue.createVNode(vue.unref(ElButton),{type:"primary",onClick:vue.unref(ae)},{default:vue.withCtx(()=>[vue.createTextVNode("导入数据")]),_:1},8,["onClick"])]),default:vue.withCtx(()=>[vue.createVNode(_sfc_main$3,{ref_key:"importJsonRef",ref:re},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(Ce).ExportJson,"onUpdate:modelValue":pe[3]||(pe[3]=ze=>vue.unref(Ce).ExportJson=ze),title:"导出",width:"60%","destroy-on-close":""},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$4)]),_:1},8,["modelValue"])]))}}),index_vue_vue_type_style_index_0_scoped_0e4bf78d_lang="",index$1=_export_sfc(_sfc_main$1,[["__scopeId","data-v-0e4bf78d"]]);function commonjsRequire(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var mqtt={exports:{}};(function(i,n){(function(r){i.exports=r()})(function(){return function(){function r(g,V,k){function $(Ce,ie){if(!V[Ce]){if(!g[Ce]){var ae=typeof commonjsRequire=="function"&&commonjsRequire;if(!ie&&ae)return ae(Ce,!0);if(oe)return oe(Ce,!0);var le=new Error("Cannot find module '"+Ce+"'");throw le.code="MODULE_NOT_FOUND",le}var Ie=V[Ce]={exports:{}};g[Ce][0].call(Ie.exports,function(ue){var de=g[Ce][1][ue];return $(de||ue)},Ie,Ie.exports,r,g,V,k)}return V[Ce].exports}for(var oe=typeof commonjsRequire=="function"&&commonjsRequire,re=0;re<k.length;re++)$(k[re]);return $}return r}()({1:[function(r,g,V){(function(k,$){(function(){const oe=r("events").EventEmitter,re=r("./store"),Ce=r("./topic-alias-recv"),ie=r("./topic-alias-send"),ae=r("mqtt-packet"),le=r("./default-message-id-provider"),Ie=r("readable-stream").Writable,ue=r("inherits"),de=r("reinterval"),Ne=r("rfdc/default"),he=r("./validations"),pe=r("xtend"),ze=r("debug")("mqttjs:client"),xe=k?k.nextTick:function(ei){setTimeout(ei,0)},Oe=$.setImmediate||function(ei){xe(ei)},_e={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},At=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],$e={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 Fe(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function Ue(ei,Lt){if(ei.options.protocolVersion===5&&Lt.cmd==="publish"){let ni;Lt.properties&&(ni=Lt.properties.topicAlias);const ri=Lt.topic.toString();if(ei.topicAliasSend)if(ni){if(ri.length!==0&&(ze("applyTopicAlias :: register topic: %s - alias: %d",ri,ni),!ei.topicAliasSend.put(ri,ni)))return ze("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}else ri.length!==0&&(ei.options.autoAssignTopicAlias?(ni=ei.topicAliasSend.getAliasByTopic(ri),ni?(Lt.topic="",Lt.properties={...Lt.properties,topicAlias:ni},ze("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",ri,ni)):(ni=ei.topicAliasSend.getLruAlias(),ei.topicAliasSend.put(ri,ni),Lt.properties={...Lt.properties,topicAlias:ni},ze("applyTopicAlias :: auto assign topic: %s - alias: %d",ri,ni))):ei.options.autoUseTopicAlias&&(ni=ei.topicAliasSend.getAliasByTopic(ri),ni&&(Lt.topic="",Lt.properties={...Lt.properties,topicAlias:ni},ze("applyTopicAlias :: auto use topic: %s - alias: %d",ri,ni))));else if(ni)return ze("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}}function Ve(ei,Lt){let ni;Lt.properties&&(ni=Lt.properties.topicAlias);let ri=Lt.topic.toString();if(ri.length===0){if(typeof ni>"u")return new Error("Unregistered Topic Alias");if(ri=ei.topicAliasSend.getTopicByAlias(ni),typeof ri>"u")return new Error("Unregistered Topic Alias");Lt.topic=ri}ni&&delete Lt.properties.topicAlias}function Dt(ei,Lt,ni){ze("sendPacket :: packet: %O",Lt),ze("sendPacket :: emitting `packetsend`"),ei.emit("packetsend",Lt),ze("sendPacket :: writing to stream");const ri=ae.writeToStream(Lt,ei.stream,ei.options);ze("sendPacket :: writeToStream result %s",ri),!ri&&ni&&ni!==Pt?(ze("sendPacket :: handle events on `drain` once through callback."),ei.stream.once("drain",ni)):ni&&(ze("sendPacket :: invoking cb"),ni())}function qe(ei){ei&&(ze("flush: queue exists? %b",!!ei),Object.keys(ei).forEach(function(Lt){typeof ei[Lt].cb=="function"&&(ei[Lt].cb(new Error("Connection closed")),delete ei[Lt])}))}function kt(ei){ei&&(ze("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(ei).forEach(function(Lt){ei[Lt].volatile&&typeof ei[Lt].cb=="function"&&(ei[Lt].cb(new Error("Connection closed")),delete ei[Lt])}))}function jt(ei,Lt,ni,ri){ze("storeAndSend :: store packet with cmd %s to outgoingStore",Lt.cmd);let Ii=Lt,wi;if(Ii.cmd==="publish"&&(Ii=Ne(Lt),wi=Ve(ei,Ii),wi))return ni&&ni(wi);ei.outgoingStore.put(Ii,function(di){if(di)return ni&&ni(di);ri(),Dt(ei,Lt,ni)})}function Pt(ei){ze("nop ::",ei)}function ti(ei,Lt){let ni;const ri=this;if(!(this instanceof ti))return new ti(ei,Lt);this.options=Lt||{};for(ni in _e)typeof this.options[ni]>"u"?this.options[ni]=_e[ni]:this.options[ni]=Lt[ni];ze("MqttClient :: options.protocol",Lt.protocol),ze("MqttClient :: options.protocolVersion",Lt.protocolVersion),ze("MqttClient :: options.username",Lt.username),ze("MqttClient :: options.keepalive",Lt.keepalive),ze("MqttClient :: options.reconnectPeriod",Lt.reconnectPeriod),ze("MqttClient :: options.rejectUnauthorized",Lt.rejectUnauthorized),ze("MqttClient :: options.topicAliasMaximum",Lt.topicAliasMaximum),this.options.clientId=typeof Lt.clientId=="string"?Lt.clientId:Fe(),ze("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=Lt.protocolVersion===5&&Lt.customHandleAcks?Lt.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=ei,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new le:this.options.messageIdProvider,this.outgoingStore=Lt.outgoingStore||new re,this.incomingStore=Lt.incomingStore||new re,this.queueQoSZero=Lt.queueQoSZero===void 0?!0:Lt.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,Lt.topicAliasMaximum>0&&(Lt.topicAliasMaximum>65535?ze("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new Ce(Lt.topicAliasMaximum)),this.on("connect",function(){const Ii=this.queue;function wi(){const ai=Ii.shift();ze("deliver :: entry %o",ai);let di=null;if(!ai){ri._resubscribe();return}di=ai.packet,ze("deliver :: call _sendPacket for %o",di);let hi=!0;di.messageId&&di.messageId!==0&&(ri.messageIdProvider.register(di.messageId)||(hi=!1)),hi?ri._sendPacket(di,function(ci){ai.cb&&ai.cb(ci),wi()}):(ze("messageId: %d has already used. The message is skipped and removed.",di.messageId),wi())}ze("connect :: sending queued packets"),wi()}),this.on("close",function(){ze("close :: connected set to `false`"),this.connected=!1,ze("close :: clearing connackTimer"),clearTimeout(this.connackTimer),ze("close :: clearing ping timer"),ri.pingTimer!==null&&(ri.pingTimer.clear(),ri.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),ze("close :: calling _setupReconnect"),this._setupReconnect()}),oe.call(this),ze("MqttClient :: setting up stream"),this._setupStream()}ue(ti,oe),ti.prototype._setupStream=function(){const ei=this,Lt=new Ie,ni=ae.parser(this.options);let ri=null;const Ii=[];ze("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),ze("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),ni.on("packet",function(ci){ze("parser :: on packet push to packets array."),Ii.push(ci)});function wi(){if(Ii.length)xe(ai);else{const ci=ri;ri=null,ci()}}function ai(){ze("work :: getting next packet in queue");const ci=Ii.shift();if(ci)ze("work :: packet pulled from queue"),ei._handlePacket(ci,wi);else{ze("work :: no packets in queue");const Ai=ri;ri=null,ze("work :: done flag is %s",!!Ai),Ai&&Ai()}}Lt._write=function(ci,Ai,yi){ri=yi,ze("writable stream :: parsing buffer"),ni.parse(ci),ai()};function di(ci){ze("streamErrorHandler :: error",ci.message),At.includes(ci.code)?(ze("streamErrorHandler :: emitting error"),ei.emit("error",ci)):Pt(ci)}ze("_setupStream :: pipe stream to writable stream"),this.stream.pipe(Lt),this.stream.on("error",di),this.stream.on("close",function(){ze("(%s)stream :: on close",ei.options.clientId),kt(ei.outgoing),ze("stream: emit close to MqttClient"),ei.emit("close")}),ze("_setupStream: sending packet `connect`");const hi=Object.create(this.options);if(hi.cmd="connect",this.topicAliasRecv&&(hi.properties||(hi.properties={}),this.topicAliasRecv&&(hi.properties.topicAliasMaximum=this.topicAliasRecv.max)),Dt(this,hi),ni.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return ei.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){const ci=pe({cmd:"auth",reasonCode:0},this.options.authPacket);Dt(this,ci)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){ze("!!connectTimeout hit!! Calling _cleanUp with force `true`"),ei._cleanUp(!0)},this.options.connectTimeout)},ti.prototype._handlePacket=function(ei,Lt){const ni=this.options;if(ni.protocolVersion===5&&ni.properties&&ni.properties.maximumPacketSize&&ni.properties.maximumPacketSize<ei.length)return this.emit("error",new Error("exceeding packets size "+ei.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(ze("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",ei),ei.cmd){case"publish":this._handlePublish(ei,Lt);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(ei),Lt();break;case"pubrel":this._handlePubrel(ei,Lt);break;case"connack":this._handleConnack(ei),Lt();break;case"auth":this._handleAuth(ei),Lt();break;case"pingresp":this._handlePingresp(ei),Lt();break;case"disconnect":this._handleDisconnect(ei),Lt();break}},ti.prototype._checkDisconnecting=function(ei){return this.disconnecting&&(ei&&ei!==Pt?ei(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},ti.prototype.publish=function(ei,Lt,ni,ri){ze("publish :: message `%s` to topic `%s`",Lt,ei);const Ii=this.options;if(typeof ni=="function"&&(ri=ni,ni=null),ni=pe({qos:0,retain:!1,dup:!1},ni),this._checkDisconnecting(ri))return this;const ai=this,di=function(){let hi=0;if((ni.qos===1||ni.qos===2)&&(hi=ai._nextId(),hi===null))return ze("No messageId left"),!1;const ci={cmd:"publish",topic:ei,payload:Lt,qos:ni.qos,retain:ni.retain,messageId:hi,dup:ni.dup};switch(Ii.protocolVersion===5&&(ci.properties=ni.properties),ze("publish :: qos",ni.qos),ni.qos){case 1:case 2:ai.outgoing[ci.messageId]={volatile:!1,cb:ri||Pt},ze("MqttClient:publish: packet cmd: %s",ci.cmd),ai._sendPacket(ci,void 0,ni.cbStorePut);break;default:ze("MqttClient:publish: packet cmd: %s",ci.cmd),ai._sendPacket(ci,ri,ni.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!di())&&this._storeProcessingQueue.push({invoke:di,cbStorePut:ni.cbStorePut,callback:ri}),this},ti.prototype.subscribe=function(){const ei=this,Lt=new Array(arguments.length);for(let yi=0;yi<arguments.length;yi++)Lt[yi]=arguments[yi];const ni=[];let ri=Lt.shift();const Ii=ri.resubscribe;let wi=Lt.pop()||Pt,ai=Lt.pop();const di=this.options.protocolVersion;delete ri.resubscribe,typeof ri=="string"&&(ri=[ri]),typeof wi!="function"&&(ai=wi,wi=Pt);const hi=he.validateTopics(ri);if(hi!==null)return Oe(wi,new Error("Invalid topic "+hi)),this;if(this._checkDisconnecting(wi))return ze("subscribe: discconecting true"),this;const ci={qos:0};if(di===5&&(ci.nl=!1,ci.rap=!1,ci.rh=0),ai=pe(ci,ai),Array.isArray(ri)?ri.forEach(function(yi){if(ze("subscribe: array topic %s",yi),!Object.prototype.hasOwnProperty.call(ei._resubscribeTopics,yi)||ei._resubscribeTopics[yi].qos<ai.qos||Ii){const ui={topic:yi,qos:ai.qos};di===5&&(ui.nl=ai.nl,ui.rap=ai.rap,ui.rh=ai.rh,ui.properties=ai.properties),ze("subscribe: pushing topic `%s` and qos `%s` to subs list",ui.topic,ui.qos),ni.push(ui)}}):Object.keys(ri).forEach(function(yi){if(ze("subscribe: object topic %s",yi),!Object.prototype.hasOwnProperty.call(ei._resubscribeTopics,yi)||ei._resubscribeTopics[yi].qos<ri[yi].qos||Ii){const ui={topic:yi,qos:ri[yi].qos};di===5&&(ui.nl=ri[yi].nl,ui.rap=ri[yi].rap,ui.rh=ri[yi].rh,ui.properties=ai.properties),ze("subscribe: pushing `%s` to subs list",ui),ni.push(ui)}}),!ni.length)return wi(null,[]),this;const Ai=function(){const yi=ei._nextId();if(yi===null)return ze("No messageId left"),!1;const ui={cmd:"subscribe",subscriptions:ni,qos:1,retain:!1,dup:!1,messageId:yi};if(ai.properties&&(ui.properties=ai.properties),ei.options.resubscribe){ze("subscribe :: resubscribe true");const Ci=[];ni.forEach(function(zi){if(ei.options.reconnectPeriod>0){const Ni={qos:zi.qos};di===5&&(Ni.nl=zi.nl||!1,Ni.rap=zi.rap||!1,Ni.rh=zi.rh||0,Ni.properties=zi.properties),ei._resubscribeTopics[zi.topic]=Ni,Ci.push(zi.topic)}}),ei.messageIdToTopic[ui.messageId]=Ci}return ei.outgoing[ui.messageId]={volatile:!0,cb:function(Ci,zi){if(!Ci){const Ni=zi.granted;for(let Mi=0;Mi<Ni.length;Mi+=1)ni[Mi].qos=Ni[Mi]}wi(Ci,ni)}},ze("subscribe :: call _sendPacket"),ei._sendPacket(ui),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Ai())&&this._storeProcessingQueue.push({invoke:Ai,callback:wi}),this},ti.prototype.unsubscribe=function(){const ei=this,Lt=new Array(arguments.length);for(let di=0;di<arguments.length;di++)Lt[di]=arguments[di];let ni=Lt.shift(),ri=Lt.pop()||Pt,Ii=Lt.pop();typeof ni=="string"&&(ni=[ni]),typeof ri!="function"&&(Ii=ri,ri=Pt);const wi=he.validateTopics(ni);if(wi!==null)return Oe(ri,new Error("Invalid topic "+wi)),this;if(ei._checkDisconnecting(ri))return this;const ai=function(){const di=ei._nextId();if(di===null)return ze("No messageId left"),!1;const hi={cmd:"unsubscribe",qos:1,messageId:di};return typeof ni=="string"?hi.unsubscriptions=[ni]:Array.isArray(ni)&&(hi.unsubscriptions=ni),ei.options.resubscribe&&hi.unsubscriptions.forEach(function(ci){delete ei._resubscribeTopics[ci]}),typeof Ii=="object"&&Ii.properties&&(hi.properties=Ii.properties),ei.outgoing[hi.messageId]={volatile:!0,cb:ri},ze("unsubscribe: call _sendPacket"),ei._sendPacket(hi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ai())&&this._storeProcessingQueue.push({invoke:ai,callback:ri}),this},ti.prototype.end=function(ei,Lt,ni){const ri=this;ze("end :: (%s)",this.options.clientId),(ei==null||typeof ei!="boolean")&&(ni=Lt||Pt,Lt=ei,ei=!1,typeof Lt!="object"&&(ni=Lt,Lt=null,typeof ni!="function"&&(ni=Pt))),typeof Lt!="object"&&(ni=Lt,Lt=null),ze("end :: cb? %s",!!ni),ni=ni||Pt;function Ii(){ze("end :: closeStores: closing incoming and outgoing stores"),ri.disconnected=!0,ri.incomingStore.close(function(ai){ri.outgoingStore.close(function(di){if(ze("end :: closeStores: emitting end"),ri.emit("end"),ni){const hi=ai||di;ze("end :: closeStores: invoking callback with args"),ni(hi)}})}),ri._deferredReconnect&&ri._deferredReconnect()}function wi(){ze("end :: (%s) :: finish :: calling _cleanUp with force %s",ri.options.clientId,ei),ri._cleanUp(ei,()=>{ze("end :: finish :: calling process.nextTick on closeStores"),xe(Ii.bind(ri))},Lt)}return this.disconnecting?(ni(),this):(this._clearReconnect(),this.disconnecting=!0,!ei&&Object.keys(this.outgoing).length>0?(ze("end :: (%s) :: calling finish in 10ms once outgoing is empty",ri.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,wi,10))):(ze("end :: (%s) :: immediately calling finish",ri.options.clientId),wi()),this)},ti.prototype.removeOutgoingMessage=function(ei){const Lt=this.outgoing[ei]?this.outgoing[ei].cb:null;return delete this.outgoing[ei],this.outgoingStore.del({messageId:ei},function(){Lt(new Error("Message removed"))}),this},ti.prototype.reconnect=function(ei){ze("client reconnect");const Lt=this,ni=function(){ei?(Lt.options.incomingStore=ei.incomingStore,Lt.options.outgoingStore=ei.outgoingStore):(Lt.options.incomingStore=null,Lt.options.outgoingStore=null),Lt.incomingStore=Lt.options.incomingStore||new re,Lt.outgoingStore=Lt.options.outgoingStore||new re,Lt.disconnecting=!1,Lt.disconnected=!1,Lt._deferredReconnect=null,Lt._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=ni:ni(),this},ti.prototype._reconnect=function(){ze("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),ze("client already connected. disconnecting first.")):(ze("_reconnect: calling _setupStream"),this._setupStream())},ti.prototype._setupReconnect=function(){const ei=this;!ei.disconnecting&&!ei.reconnectTimer&&ei.options.reconnectPeriod>0?(this.reconnecting||(ze("_setupReconnect :: emit `offline` state"),this.emit("offline"),ze("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),ze("_setupReconnect :: setting reconnectTimer for %d ms",ei.options.reconnectPeriod),ei.reconnectTimer=setInterval(function(){ze("reconnectTimer :: reconnect triggered!"),ei._reconnect()},ei.options.reconnectPeriod)):ze("_setupReconnect :: doing nothing...")},ti.prototype._clearReconnect=function(){ze("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},ti.prototype._cleanUp=function(ei,Lt){const ni=arguments[2];if(Lt&&(ze("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",Lt)),ze("_cleanUp :: forced? %s",ei),ei)this.options.reconnectPeriod===0&&this.options.clean&&qe(this.outgoing),ze("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const ri=pe({cmd:"disconnect"},ni);ze("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(ri,Oe.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(ze("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(ze("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),Lt&&!this.connected&&(ze("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",Lt),Lt())},ti.prototype._sendPacket=function(ei,Lt,ni){ze("_sendPacket :: (%s) :: start",this.options.clientId),ni=ni||Pt,Lt=Lt||Pt;const ri=Ue(this,ei);if(ri){Lt(ri);return}if(!this.connected){if(ei.cmd==="auth"){this._shiftPingInterval(),Dt(this,ei,Lt);return}ze("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(ei,Lt,ni);return}switch(this._shiftPingInterval(),ei.cmd){case"publish":break;case"pubrel":jt(this,ei,Lt,ni);return;default:Dt(this,ei,Lt);return}switch(ei.qos){case 2:case 1:jt(this,ei,Lt,ni);break;case 0:default:Dt(this,ei,Lt);break}ze("_sendPacket :: (%s) :: end",this.options.clientId)},ti.prototype._storePacket=function(ei,Lt,ni){ze("_storePacket :: packet: %o",ei),ze("_storePacket :: cb? %s",!!Lt),ni=ni||Pt;let ri=ei;if(ri.cmd==="publish"){ri=Ne(ei);const Ii=Ve(this,ri);if(Ii)return Lt&&Lt(Ii)}(ri.qos||0)===0&&this.queueQoSZero||ri.cmd!=="publish"?this.queue.push({packet:ri,cb:Lt}):ri.qos>0?(Lt=this.outgoing[ri.messageId]?this.outgoing[ri.messageId].cb:null,this.outgoingStore.put(ri,function(Ii){if(Ii)return Lt&&Lt(Ii);ni()})):Lt&&Lt(new Error("No connection to broker"))},ti.prototype._setupPingTimer=function(){ze("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const ei=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=de(function(){ei._checkPing()},this.options.keepalive*1e3))},ti.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)},ti.prototype._checkPing=function(){ze("_checkPing :: checking ping..."),this.pingResp?(ze("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(ze("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},ti.prototype._handlePingresp=function(){this.pingResp=!0},ti.prototype._handleConnack=function(ei){ze("_handleConnack");const Lt=this.options,ri=Lt.protocolVersion===5?ei.reasonCode:ei.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,ei.properties){if(ei.properties.topicAliasMaximum){if(ei.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}ei.properties.topicAliasMaximum>0&&(this.topicAliasSend=new ie(ei.properties.topicAliasMaximum))}ei.properties.serverKeepAlive&&Lt.keepalive&&(Lt.keepalive=ei.properties.serverKeepAlive,this._shiftPingInterval()),ei.properties.maximumPacketSize&&(Lt.properties||(Lt.properties={}),Lt.properties.maximumPacketSize=ei.properties.maximumPacketSize)}if(ri===0)this.reconnecting=!1,this._onConnect(ei);else if(ri>0){const Ii=new Error("Connection refused: "+$e[ri]);Ii.code=ri,this.emit("error",Ii)}},ti.prototype._handleAuth=function(ei){const ni=this.options.protocolVersion,ri=ni===5?ei.reasonCode:ei.returnCode;if(ni!==5){const wi=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+ni);wi.code=ri,this.emit("error",wi);return}const Ii=this;this.handleAuth(ei,function(wi,ai){if(wi){Ii.emit("error",wi);return}if(ri===24)Ii.reconnecting=!1,Ii._sendPacket(ai);else{const di=new Error("Connection refused: "+$e[ri]);wi.code=ri,Ii.emit("error",di)}})},ti.prototype.handleAuth=function(ei,Lt){Lt()},ti.prototype._handlePublish=function(ei,Lt){ze("_handlePublish: packet %o",ei),Lt=typeof Lt<"u"?Lt:Pt;let ni=ei.topic.toString();const ri=ei.payload,Ii=ei.qos,wi=ei.messageId,ai=this,di=this.options,hi=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let ci;if(ei.properties&&(ci=ei.properties.topicAlias),typeof ci<"u")if(ni.length===0)if(ci>0&&ci<=65535){const Ai=this.topicAliasRecv.getTopicByAlias(ci);if(Ai)ni=Ai,ze("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",ni,ci);else{ze("_handlePublish :: unregistered topic alias. alias: %d",ci),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{ze("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(ni,ci))ze("_handlePublish :: registered topic: %s - alias: %d",ni,ci);else{ze("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(ze("_handlePublish: qos %d",Ii),Ii){case 2:{di.customHandleAcks(ni,ri,ei,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return ai.emit("error",ci);if(hi.indexOf(Ai)===-1)return ai.emit("error",new Error("Wrong reason code for pubrec"));Ai?ai._sendPacket({cmd:"pubrec",messageId:wi,reasonCode:Ai},Lt):ai.incomingStore.put(ei,function(){ai._sendPacket({cmd:"pubrec",messageId:wi},Lt)})});break}case 1:{di.customHandleAcks(ni,ri,ei,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return ai.emit("error",ci);if(hi.indexOf(Ai)===-1)return ai.emit("error",new Error("Wrong reason code for puback"));Ai||ai.emit("message",ni,ri,ei),ai.handleMessage(ei,function(yi){if(yi)return Lt&&Lt(yi);ai._sendPacket({cmd:"puback",messageId:wi,reasonCode:Ai},Lt)})});break}case 0:this.emit("message",ni,ri,ei),this.handleMessage(ei,Lt);break;default:ze("_handlePublish: unknown QoS. Doing nothing.");break}},ti.prototype.handleMessage=function(ei,Lt){Lt()},ti.prototype._handleAck=function(ei){const Lt=ei.messageId,ni=ei.cmd;let ri=null;const Ii=this.outgoing[Lt]?this.outgoing[Lt].cb:null,wi=this;let ai;if(!Ii){ze("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(ze("_handleAck :: packet type",ni),ni){case"pubcomp":case"puback":{const di=ei.reasonCode;di&&di>0&&di!==16&&(ai=new Error("Publish error: "+$e[di]),ai.code=di,Ii(ai,ei)),delete this.outgoing[Lt],this.outgoingStore.del(ei,Ii),this.messageIdProvider.deallocate(Lt),this._invokeStoreProcessingQueue();break}case"pubrec":{ri={cmd:"pubrel",qos:2,messageId:Lt};const di=ei.reasonCode;di&&di>0&&di!==16?(ai=new Error("Publish error: "+$e[di]),ai.code=di,Ii(ai,ei)):this._sendPacket(ri);break}case"suback":{delete this.outgoing[Lt],this.messageIdProvider.deallocate(Lt);for(let di=0;di<ei.granted.length;di++)if(ei.granted[di]&128){const hi=this.messageIdToTopic[Lt];hi&&hi.forEach(function(ci){delete wi._resubscribeTopics[ci]})}this._invokeStoreProcessingQueue(),Ii(null,ei);break}case"unsuback":{delete this.outgoing[Lt],this.messageIdProvider.deallocate(Lt),this._invokeStoreProcessingQueue(),Ii(null);break}default:wi.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},ti.prototype._handlePubrel=function(ei,Lt){ze("handling pubrel packet"),Lt=typeof Lt<"u"?Lt:Pt;const ni=ei.messageId,ri=this,Ii={cmd:"pubcomp",messageId:ni};ri.incomingStore.get(ei,function(wi,ai){wi?ri._sendPacket(Ii,Lt):(ri.emit("message",ai.topic,ai.payload,ai),ri.handleMessage(ai,function(di){if(di)return Lt(di);ri.incomingStore.del(ai,Pt),ri._sendPacket(Ii,Lt)}))})},ti.prototype._handleDisconnect=function(ei){this.emit("disconnect",ei)},ti.prototype._nextId=function(){return this.messageIdProvider.allocate()},ti.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},ti.prototype._resubscribe=function(){ze("_resubscribe");const ei=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&ei.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){ze("_resubscribe: protocolVersion 5");for(let Lt=0;Lt<ei.length;Lt++){const ni={};ni[ei[Lt]]=this._resubscribeTopics[ei[Lt]],ni.resubscribe=!0,this.subscribe(ni,{properties:ni[ei[Lt]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},ti.prototype._onConnect=function(ei){if(this.disconnected){this.emit("connect",ei);return}const Lt=this;this.connackPacket=ei,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function ni(){let ri=Lt.outgoingStore.createStream();function Ii(){Lt._storeProcessing=!1,Lt._packetIdsDuringStoreProcessing={}}Lt.once("close",wi),ri.on("error",function(di){Ii(),Lt._flushStoreProcessingQueue(),Lt.removeListener("close",wi),Lt.emit("error",di)});function wi(){ri.destroy(),ri=null,Lt._flushStoreProcessingQueue(),Ii()}function ai(){if(!ri)return;Lt._storeProcessing=!0;const di=ri.read(1);let hi;if(!di){ri.once("readable",ai);return}if(Lt._packetIdsDuringStoreProcessing[di.messageId]){ai();return}!Lt.disconnecting&&!Lt.reconnectTimer?(hi=Lt.outgoing[di.messageId]?Lt.outgoing[di.messageId].cb:null,Lt.outgoing[di.messageId]={volatile:!1,cb:function(ci,Ai){hi&&hi(ci,Ai),ai()}},Lt._packetIdsDuringStoreProcessing[di.messageId]=!0,Lt.messageIdProvider.register(di.messageId)?Lt._sendPacket(di):ze("messageId: %d has already used.",di.messageId)):ri.destroy&&ri.destroy()}ri.on("end",function(){let di=!0;for(const hi in Lt._packetIdsDuringStoreProcessing)if(!Lt._packetIdsDuringStoreProcessing[hi]){di=!1;break}di?(Ii(),Lt.removeListener("close",wi),Lt._invokeAllStoreProcessingQueue(),Lt.emit("connect",ei)):ni()}),ai()}ni()},ti.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const ei=this._storeProcessingQueue[0];if(ei&&ei.invoke())return this._storeProcessingQueue.shift(),!0}return!1},ti.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},ti.prototype._flushStoreProcessingQueue=function(){for(const ei of this._storeProcessingQueue)ei.cbStorePut&&ei.cbStorePut(new Error("Connection closed")),ei.callback&&ei.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},g.exports=ti}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal: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(r,g,V){const{Buffer:k}=r("buffer"),$=r("readable-stream").Transform,oe=r("duplexify");let re,Ce,ie,ae=!1;function le(){const he=new $;return he._write=function(pe,ze,xe){re.sendSocketMessage({data:pe.buffer,success:function(){xe()},fail:function(){xe(new Error)}})},he._flush=function(ze){re.closeSocket({success:function(){ze()}})},he}function Ie(he){he.hostname||(he.hostname="localhost"),he.path||(he.path="/"),he.wsOptions||(he.wsOptions={})}function ue(he,pe){const ze=he.protocol==="alis"?"wss":"ws";let xe=ze+"://"+he.hostname+he.path;return he.port&&he.port!==80&&he.port!==443&&(xe=ze+"://"+he.hostname+":"+he.port+he.path),typeof he.transformWsUrl=="function"&&(xe=he.transformWsUrl(xe,he,pe)),xe}function de(){ae||(ae=!0,re.onSocketOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),re.onSocketMessage(function(he){if(typeof he.data=="string"){const pe=k.from(he.data,"base64");Ce.push(pe)}else{const pe=new FileReader;pe.addEventListener("load",function(){let ze=pe.result;ze instanceof ArrayBuffer?ze=k.from(ze):ze=k.from(ze,"utf8"),Ce.push(ze)}),pe.readAsArrayBuffer(he.data)}}),re.onSocketClose(function(){ie.end(),ie.destroy()}),re.onSocketError(function(he){ie.destroy(he)}))}function Ne(he,pe){if(pe.hostname=pe.hostname||pe.host,!pe.hostname)throw new Error("Could not determine host. Specify host manually.");const ze=pe.protocolId==="MQIsdp"&&pe.protocolVersion===3?"mqttv3.1":"mqtt";Ie(pe);const xe=ue(pe,he);return re=pe.my,re.connectSocket({url:xe,protocols:ze}),Ce=le(),ie=oe.obj(),de(),ie}g.exports=Ne},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(r,g,V){const k=r("net"),$=r("debug")("mqttjs:tcp");function oe(re,Ce){Ce.port=Ce.port||1883,Ce.hostname=Ce.hostname||Ce.host||"localhost";const ie=Ce.port,ae=Ce.hostname;return $("port %d and host %s",ie,ae),k.createConnection(ie,ae)}g.exports=oe},{debug:18,net:16}],4:[function(r,g,V){const k=r("tls"),$=r("net"),oe=r("debug")("mqttjs:tls");function re(Ce,ie){ie.port=ie.port||8883,ie.host=ie.hostname||ie.host||"localhost",$.isIP(ie.host)===0&&(ie.servername=ie.host),ie.rejectUnauthorized=ie.rejectUnauthorized!==!1,delete ie.path,oe("port %d host %s rejectUnauthorized %b",ie.port,ie.host,ie.rejectUnauthorized);const ae=k.connect(ie);ae.on("secureConnect",function(){ie.rejectUnauthorized&&!ae.authorized?ae.emit("error",new Error("TLS not authorized")):ae.removeListener("error",le)});function le(Ie){ie.rejectUnauthorized&&Ce.emit("error",Ie),ae.end()}return ae.on("error",le),ae}g.exports=re},{debug:18,net:16,tls:16}],5:[function(r,g,V){(function(k){(function(){const{Buffer:$}=r("buffer"),oe=r("ws"),re=r("debug")("mqttjs:ws"),Ce=r("duplexify"),ie=r("readable-stream").Transform,ae=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],le=typeof k<"u"&&k.title==="browser"||typeof __webpack_require__=="function";function Ie(xe,Oe){let _e=xe.protocol+"://"+xe.hostname+":"+xe.port+xe.path;return typeof xe.transformWsUrl=="function"&&(_e=xe.transformWsUrl(_e,xe,Oe)),_e}function ue(xe){const Oe=xe;return xe.hostname||(Oe.hostname="localhost"),xe.port||(xe.protocol==="wss"?Oe.port=443:Oe.port=80),xe.path||(Oe.path="/"),xe.wsOptions||(Oe.wsOptions={}),!le&&xe.protocol==="wss"&&ae.forEach(function(_e){Object.prototype.hasOwnProperty.call(xe,_e)&&!Object.prototype.hasOwnProperty.call(xe.wsOptions,_e)&&(Oe.wsOptions[_e]=xe[_e])}),Oe}function de(xe){const Oe=ue(xe);if(Oe.hostname||(Oe.hostname=Oe.host),!Oe.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const _e=new URL(document.URL);Oe.hostname=_e.hostname,Oe.port||(Oe.port=_e.port)}return Oe.objectMode===void 0&&(Oe.objectMode=!(Oe.binary===!0||Oe.binary===void 0)),Oe}function Ne(xe,Oe,_e){re("createWebSocket"),re("protocol: "+_e.protocolId+" "+_e.protocolVersion);const At=_e.protocolId==="MQIsdp"&&_e.protocolVersion===3?"mqttv3.1":"mqtt";return re("creating new Websocket for url: "+Oe+" and protocol: "+At),new oe(Oe,[At],_e.wsOptions)}function he(xe,Oe){const _e=Oe.protocolId==="MQIsdp"&&Oe.protocolVersion===3?"mqttv3.1":"mqtt",At=Ie(Oe,xe),$e=new WebSocket(At,[_e]);return $e.binaryType="arraybuffer",$e}function pe(xe,Oe){re("streamBuilder");const _e=ue(Oe),At=Ie(_e,xe),$e=Ne(xe,At,_e),Fe=oe.createWebSocketStream($e,_e.wsOptions);return Fe.url=At,$e.on("close",()=>{Fe.destroy()}),Fe}function ze(xe,Oe){re("browserStreamBuilder");let _e;const $e=de(Oe).browserBufferSize||1024*512,Fe=Oe.browserBufferTimeout||1e3,Ue=!Oe.objectMode,Ve=he(xe,Oe),Dt=kt(Oe,ni,ri);Oe.objectMode||(Dt._writev=Lt),Dt.on("close",()=>{Ve.close()});const qe=typeof Ve.addEventListener<"u";Ve.readyState===Ve.OPEN?_e=Dt:(_e=_e=Ce(void 0,void 0,Oe),Oe.objectMode||(_e._writev=Lt),qe?Ve.addEventListener("open",jt):Ve.onopen=jt),_e.socket=Ve,qe?(Ve.addEventListener("close",Pt),Ve.addEventListener("error",ti),Ve.addEventListener("message",ei)):(Ve.onclose=Pt,Ve.onerror=ti,Ve.onmessage=ei);function kt(Ii,wi,ai){const di=new ie({objectModeMode:Ii.objectMode});return di._write=wi,di._flush=ai,di}function jt(){_e.setReadable(Dt),_e.setWritable(Dt),_e.emit("connect")}function Pt(){_e.end(),_e.destroy()}function ti(Ii){_e.destroy(Ii)}function ei(Ii){let wi=Ii.data;wi instanceof ArrayBuffer?wi=$.from(wi):wi=$.from(wi,"utf8"),Dt.push(wi)}function Lt(Ii,wi){const ai=new Array(Ii.length);for(let di=0;di<Ii.length;di++)typeof Ii[di].chunk=="string"?ai[di]=$.from(Ii[di],"utf8"):ai[di]=Ii[di].chunk;this._write($.concat(ai),"binary",wi)}function ni(Ii,wi,ai){Ve.bufferedAmount>$e&&setTimeout(ni,Fe,Ii,wi,ai),Ue&&typeof Ii=="string"&&(Ii=$.from(Ii,"utf8"));try{Ve.send(Ii)}catch(di){return ai(di)}ai()}function ri(Ii){Ve.close(),Ii()}return _e}le?g.exports=ze:g.exports=pe}).call(this)}).call(this,r("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(r,g,V){const{Buffer:k}=r("buffer"),$=r("readable-stream").Transform,oe=r("duplexify");let re,Ce,ie;function ae(){const Ne=new $;return Ne._write=function(he,pe,ze){re.send({data:he.buffer,success:function(){ze()},fail:function(xe){ze(new Error(xe))}})},Ne._flush=function(pe){re.close({success:function(){pe()}})},Ne}function le(Ne){Ne.hostname||(Ne.hostname="localhost"),Ne.path||(Ne.path="/"),Ne.wsOptions||(Ne.wsOptions={})}function Ie(Ne,he){const pe=Ne.protocol==="wxs"?"wss":"ws";let ze=pe+"://"+Ne.hostname+Ne.path;return Ne.port&&Ne.port!==80&&Ne.port!==443&&(ze=pe+"://"+Ne.hostname+":"+Ne.port+Ne.path),typeof Ne.transformWsUrl=="function"&&(ze=Ne.transformWsUrl(ze,Ne,he)),ze}function ue(){re.onOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),re.onMessage(function(Ne){let he=Ne.data;he instanceof ArrayBuffer?he=k.from(he):he=k.from(he,"utf8"),Ce.push(he)}),re.onClose(function(){ie.end(),ie.destroy()}),re.onError(function(Ne){ie.destroy(new Error(Ne.errMsg))})}function de(Ne,he){if(he.hostname=he.hostname||he.host,!he.hostname)throw new Error("Could not determine host. Specify host manually.");const pe=he.protocolId==="MQIsdp"&&he.protocolVersion===3?"mqttv3.1":"mqtt";le(he);const ze=Ie(he,Ne);re=wx.connectSocket({url:ze,protocols:[pe]}),Ce=ae(),ie=oe.obj(),ie._destroy=function(Oe,_e){re.close({success:function(){_e&&_e(Oe)}})};const xe=ie.destroy;return ie.destroy=function(){ie.destroy=xe;const Oe=this;setTimeout(function(){re.close({fail:function(){Oe._destroy(new Error)}})},0)}.bind(ie),ue(),ie}g.exports=de},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(r,g,V){function k(){if(!(this instanceof k))return new k;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}k.prototype.allocate=function(){const $=this.nextId++;return this.nextId===65536&&(this.nextId=1),$},k.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},k.prototype.register=function($){return!0},k.prototype.deallocate=function($){},k.prototype.clear=function(){},g.exports=k},{}],8:[function(r,g,V){const k=r("xtend"),$=r("readable-stream").Readable,oe={objectMode:!0},re={clean:!0};function Ce(ie){if(!(this instanceof Ce))return new Ce(ie);this.options=ie||{},this.options=k(re,ie),this._inflights=new Map}Ce.prototype.put=function(ie,ae){return this._inflights.set(ie.messageId,ie),ae&&ae(),this},Ce.prototype.createStream=function(){const ie=new $(oe),ae=[];let le=!1,Ie=0;return this._inflights.forEach(function(ue,de){ae.push(ue)}),ie._read=function(){!le&&Ie<ae.length?this.push(ae[Ie++]):this.push(null)},ie.destroy=function(){if(le)return;const ue=this;le=!0,setTimeout(function(){ue.emit("close")},0)},ie},Ce.prototype.del=function(ie,ae){return ie=this._inflights.get(ie.messageId),ie?(this._inflights.delete(ie.messageId),ae(null,ie)):ae&&ae(new Error("missing packet")),this},Ce.prototype.get=function(ie,ae){return ie=this._inflights.get(ie.messageId),ie?ae(null,ie):ae&&ae(new Error("missing packet")),this},Ce.prototype.close=function(ie){this.options.clean&&(this._inflights=null),ie&&ie()},g.exports=Ce},{"readable-stream":69,xtend:81}],9:[function(r,g,V){function k($){if(!(this instanceof k))return new k($);this.aliasToTopic={},this.max=$}k.prototype.put=function($,oe){return oe===0||oe>this.max?!1:(this.aliasToTopic[oe]=$,this.length=Object.keys(this.aliasToTopic).length,!0)},k.prototype.getTopicByAlias=function($){return this.aliasToTopic[$]},k.prototype.clear=function(){this.aliasToTopic={}},g.exports=k},{}],10:[function(r,g,V){const k=r("lru-cache"),$=r("number-allocator").NumberAllocator;function oe(re){if(!(this instanceof oe))return new oe(re);re>0&&(this.aliasToTopic=new k({max:re}),this.topicToAlias={},this.numberAllocator=new $(1,re),this.max=re,this.length=0)}oe.prototype.put=function(re,Ce){if(Ce===0||Ce>this.max)return!1;const ie=this.aliasToTopic.get(Ce);return ie&&delete this.topicToAlias[ie],this.aliasToTopic.set(Ce,re),this.topicToAlias[re]=Ce,this.numberAllocator.use(Ce),this.length=this.aliasToTopic.length,!0},oe.prototype.getTopicByAlias=function(re){return this.aliasToTopic.get(re)},oe.prototype.getAliasByTopic=function(re){const Ce=this.topicToAlias[re];return typeof Ce<"u"&&this.aliasToTopic.get(Ce),Ce},oe.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},oe.prototype.getLruAlias=function(){const re=this.numberAllocator.firstVacant();return re||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},g.exports=oe},{"lru-cache":37,"number-allocator":46}],11:[function(r,g,V){function k(oe){const re=oe.split("/");for(let Ce=0;Ce<re.length;Ce++)if(re[Ce]!=="+"){if(re[Ce]==="#")return Ce===re.length-1;if(re[Ce].indexOf("+")!==-1||re[Ce].indexOf("#")!==-1)return!1}return!0}function $(oe){if(oe.length===0)return"empty_topic_list";for(let re=0;re<oe.length;re++)if(!k(oe[re]))return oe[re];return null}g.exports={validateTopics:$}},{}],12:[function(r,g,V){(function(k){(function(){const $=r("../client"),oe=r("../store"),re=r("url"),Ce=r("xtend"),ie=r("debug")("mqttjs"),ae={};typeof k<"u"&&k.title!=="browser"||typeof __webpack_require__!="function"?(ae.mqtt=r("./tcp"),ae.tcp=r("./tcp"),ae.ssl=r("./tls"),ae.tls=r("./tls"),ae.mqtts=r("./tls")):(ae.wx=r("./wx"),ae.wxs=r("./wx"),ae.ali=r("./ali"),ae.alis=r("./ali")),ae.ws=r("./ws"),ae.wss=r("./ws");function le(ue){let de;ue.auth&&(de=ue.auth.match(/^(.+):(.+)$/),de?(ue.username=de[1],ue.password=de[2]):ue.username=ue.auth)}function Ie(ue,de){if(ie("connecting to an MQTT broker..."),typeof ue=="object"&&!de&&(de=ue,ue=null),de=de||{},ue){const pe=re.parse(ue,!0);if(pe.port!=null&&(pe.port=Number(pe.port)),de=Ce(pe,de),de.protocol===null)throw new Error("Missing protocol");de.protocol=de.protocol.replace(/:$/,"")}if(le(de),de.query&&typeof de.query.clientId=="string"&&(de.clientId=de.query.clientId),de.cert&&de.key)if(de.protocol){if(["mqtts","wss","wxs","alis"].indexOf(de.protocol)===-1)switch(de.protocol){case"mqtt":de.protocol="mqtts";break;case"ws":de.protocol="wss";break;case"wx":de.protocol="wxs";break;case"ali":de.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+de.protocol+'"!')}}else throw new Error("Missing secure protocol key");if(!ae[de.protocol]){const pe=["mqtts","wss"].indexOf(de.protocol)!==-1;de.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(ze,xe){return pe&&xe%2===0?!1:typeof ae[ze]=="function"})[0]}if(de.clean===!1&&!de.clientId)throw new Error("Missing clientId for unclean clients");de.protocol&&(de.defaultProtocol=de.protocol);function Ne(pe){return de.servers&&((!pe._reconnectCount||pe._reconnectCount===de.servers.length)&&(pe._reconnectCount=0),de.host=de.servers[pe._reconnectCount].host,de.port=de.servers[pe._reconnectCount].port,de.protocol=de.servers[pe._reconnectCount].protocol?de.servers[pe._reconnectCount].protocol:de.defaultProtocol,de.hostname=de.host,pe._reconnectCount++),ie("calling streambuilder for",de.protocol),ae[de.protocol](pe,de)}const he=new $(Ne,de);return he.on("error",function(){}),he}g.exports=Ie,g.exports.connect=Ie,g.exports.MqttClient=$,g.exports.Store=oe}).call(this)}).call(this,r("_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(r,g,V){V.byteLength=le,V.toByteArray=ue,V.fromByteArray=he;for(var k=[],$=[],oe=typeof Uint8Array<"u"?Uint8Array:Array,re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ce=0,ie=re.length;Ce<ie;++Ce)k[Ce]=re[Ce],$[re.charCodeAt(Ce)]=Ce;$["-".charCodeAt(0)]=62,$["_".charCodeAt(0)]=63;function ae(pe){var ze=pe.length;if(ze%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var xe=pe.indexOf("=");xe===-1&&(xe=ze);var Oe=xe===ze?0:4-xe%4;return[xe,Oe]}function le(pe){var ze=ae(pe),xe=ze[0],Oe=ze[1];return(xe+Oe)*3/4-Oe}function Ie(pe,ze,xe){return(ze+xe)*3/4-xe}function ue(pe){var ze,xe=ae(pe),Oe=xe[0],_e=xe[1],At=new oe(Ie(pe,Oe,_e)),$e=0,Fe=_e>0?Oe-4:Oe,Ue;for(Ue=0;Ue<Fe;Ue+=4)ze=$[pe.charCodeAt(Ue)]<<18|$[pe.charCodeAt(Ue+1)]<<12|$[pe.charCodeAt(Ue+2)]<<6|$[pe.charCodeAt(Ue+3)],At[$e++]=ze>>16&255,At[$e++]=ze>>8&255,At[$e++]=ze&255;return _e===2&&(ze=$[pe.charCodeAt(Ue)]<<2|$[pe.charCodeAt(Ue+1)]>>4,At[$e++]=ze&255),_e===1&&(ze=$[pe.charCodeAt(Ue)]<<10|$[pe.charCodeAt(Ue+1)]<<4|$[pe.charCodeAt(Ue+2)]>>2,At[$e++]=ze>>8&255,At[$e++]=ze&255),At}function de(pe){return k[pe>>18&63]+k[pe>>12&63]+k[pe>>6&63]+k[pe&63]}function Ne(pe,ze,xe){for(var Oe,_e=[],At=ze;At<xe;At+=3)Oe=(pe[At]<<16&16711680)+(pe[At+1]<<8&65280)+(pe[At+2]&255),_e.push(de(Oe));return _e.join("")}function he(pe){for(var ze,xe=pe.length,Oe=xe%3,_e=[],At=16383,$e=0,Fe=xe-Oe;$e<Fe;$e+=At)_e.push(Ne(pe,$e,$e+At>Fe?Fe:$e+At));return Oe===1?(ze=pe[xe-1],_e.push(k[ze>>2]+k[ze<<4&63]+"==")):Oe===2&&(ze=(pe[xe-2]<<8)+pe[xe-1],_e.push(k[ze>>10]+k[ze>>4&63]+k[ze<<2&63]+"=")),_e.join("")}},{}],14:[function(r,g,V){const{Buffer:k}=r("buffer"),$=Symbol.for("BufferList");function oe(re){if(!(this instanceof oe))return new oe(re);oe._init.call(this,re)}oe._init=function(Ce){Object.defineProperty(this,$,{value:!0}),this._bufs=[],this.length=0,Ce&&this.append(Ce)},oe.prototype._new=function(Ce){return new oe(Ce)},oe.prototype._offset=function(Ce){if(Ce===0)return[0,0];let ie=0;for(let ae=0;ae<this._bufs.length;ae++){const le=ie+this._bufs[ae].length;if(Ce<le||ae===this._bufs.length-1)return[ae,Ce-ie];ie=le}},oe.prototype._reverseOffset=function(re){const Ce=re[0];let ie=re[1];for(let ae=0;ae<Ce;ae++)ie+=this._bufs[ae].length;return ie},oe.prototype.get=function(Ce){if(Ce>this.length||Ce<0)return;const ie=this._offset(Ce);return this._bufs[ie[0]][ie[1]]},oe.prototype.slice=function(Ce,ie){return typeof Ce=="number"&&Ce<0&&(Ce+=this.length),typeof ie=="number"&&ie<0&&(ie+=this.length),this.copy(null,0,Ce,ie)},oe.prototype.copy=function(Ce,ie,ae,le){if((typeof ae!="number"||ae<0)&&(ae=0),(typeof le!="number"||le>this.length)&&(le=this.length),ae>=this.length||le<=0)return Ce||k.alloc(0);const Ie=!!Ce,ue=this._offset(ae),de=le-ae;let Ne=de,he=Ie&&ie||0,pe=ue[1];if(ae===0&&le===this.length){if(!Ie)return this._bufs.length===1?this._bufs[0]:k.concat(this._bufs,this.length);for(let ze=0;ze<this._bufs.length;ze++)this._bufs[ze].copy(Ce,he),he+=this._bufs[ze].length;return Ce}if(Ne<=this._bufs[ue[0]].length-pe)return Ie?this._bufs[ue[0]].copy(Ce,ie,pe,pe+Ne):this._bufs[ue[0]].slice(pe,pe+Ne);Ie||(Ce=k.allocUnsafe(de));for(let ze=ue[0];ze<this._bufs.length;ze++){const xe=this._bufs[ze].length-pe;if(Ne>xe)this._bufs[ze].copy(Ce,he,pe),he+=xe;else{this._bufs[ze].copy(Ce,he,pe,pe+Ne),he+=xe;break}Ne-=xe,pe&&(pe=0)}return Ce.length>he?Ce.slice(0,he):Ce},oe.prototype.shallowSlice=function(Ce,ie){if(Ce=Ce||0,ie=typeof ie!="number"?this.length:ie,Ce<0&&(Ce+=this.length),ie<0&&(ie+=this.length),Ce===ie)return this._new();const ae=this._offset(Ce),le=this._offset(ie),Ie=this._bufs.slice(ae[0],le[0]+1);return le[1]===0?Ie.pop():Ie[Ie.length-1]=Ie[Ie.length-1].slice(0,le[1]),ae[1]!==0&&(Ie[0]=Ie[0].slice(ae[1])),this._new(Ie)},oe.prototype.toString=function(Ce,ie,ae){return this.slice(ie,ae).toString(Ce)},oe.prototype.consume=function(Ce){if(Ce=Math.trunc(Ce),Number.isNaN(Ce)||Ce<=0)return this;for(;this._bufs.length;)if(Ce>=this._bufs[0].length)Ce-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(Ce),this.length-=Ce;break}return this},oe.prototype.duplicate=function(){const Ce=this._new();for(let ie=0;ie<this._bufs.length;ie++)Ce.append(this._bufs[ie]);return Ce},oe.prototype.append=function(Ce){if(Ce==null)return this;if(Ce.buffer)this._appendBuffer(k.from(Ce.buffer,Ce.byteOffset,Ce.byteLength));else if(Array.isArray(Ce))for(let ie=0;ie<Ce.length;ie++)this.append(Ce[ie]);else if(this._isBufferList(Ce))for(let ie=0;ie<Ce._bufs.length;ie++)this.append(Ce._bufs[ie]);else typeof Ce=="number"&&(Ce=Ce.toString()),this._appendBuffer(k.from(Ce));return this},oe.prototype._appendBuffer=function(Ce){this._bufs.push(Ce),this.length+=Ce.length},oe.prototype.indexOf=function(re,Ce,ie){if(ie===void 0&&typeof Ce=="string"&&(ie=Ce,Ce=void 0),typeof re=="function"||Array.isArray(re))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof re=="number"?re=k.from([re]):typeof re=="string"?re=k.from(re,ie):this._isBufferList(re)?re=re.slice():Array.isArray(re.buffer)?re=k.from(re.buffer,re.byteOffset,re.byteLength):k.isBuffer(re)||(re=k.from(re)),Ce=Number(Ce||0),isNaN(Ce)&&(Ce=0),Ce<0&&(Ce=this.length+Ce),Ce<0&&(Ce=0),re.length===0)return Ce>this.length?this.length:Ce;const ae=this._offset(Ce);let le=ae[0],Ie=ae[1];for(;le<this._bufs.length;le++){const ue=this._bufs[le];for(;Ie<ue.length;)if(ue.length-Ie>=re.length){const Ne=ue.indexOf(re,Ie);if(Ne!==-1)return this._reverseOffset([le,Ne]);Ie=ue.length-re.length+1}else{const Ne=this._reverseOffset([le,Ie]);if(this._match(Ne,re))return Ne;Ie++}Ie=0}return-1},oe.prototype._match=function(re,Ce){if(this.length-re<Ce.length)return!1;for(let ie=0;ie<Ce.length;ie++)if(this.get(re+ie)!==Ce[ie])return!1;return!0},function(){const re={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 Ce in re)(function(ie){re[ie]===null?oe.prototype[ie]=function(ae,le){return this.slice(ae,ae+le)[ie](0,le)}:oe.prototype[ie]=function(ae=0){return this.slice(ae,ae+re[ie])[ie](0)}})(Ce)}(),oe.prototype._isBufferList=function(Ce){return Ce instanceof oe||oe.isBufferList(Ce)},oe.isBufferList=function(Ce){return Ce!=null&&Ce[$]},g.exports=oe},{buffer:17}],15:[function(r,g,V){const k=r("readable-stream").Duplex,$=r("inherits"),oe=r("./BufferList");function re(Ce){if(!(this instanceof re))return new re(Ce);if(typeof Ce=="function"){this._callback=Ce;const ie=function(le){this._callback&&(this._callback(le),this._callback=null)}.bind(this);this.on("pipe",function(le){le.on("error",ie)}),this.on("unpipe",function(le){le.removeListener("error",ie)}),Ce=null}oe._init.call(this,Ce),k.call(this)}$(re,k),Object.assign(re.prototype,oe.prototype),re.prototype._new=function(ie){return new re(ie)},re.prototype._write=function(ie,ae,le){this._appendBuffer(ie),typeof le=="function"&&le()},re.prototype._read=function(ie){if(!this.length)return this.push(null);ie=Math.min(ie,this.length),this.push(this.slice(0,ie)),this.consume(ie)},re.prototype.end=function(ie){k.prototype.end.call(this,ie),this._callback&&(this._callback(null,this.slice()),this._callback=null)},re.prototype._destroy=function(ie,ae){this._bufs.length=0,this.length=0,ae(ie)},re.prototype._isBufferList=function(ie){return ie instanceof re||ie instanceof oe||re.isBufferList(ie)},re.isBufferList=oe.isBufferList,g.exports=re,g.exports.BufferListStream=re,g.exports.BufferList=oe},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(r,g,V){},{}],17:[function(r,g,V){(function(k){(function(){var $=r("base64-js"),oe=r("ieee754");V.Buffer=ae,V.SlowBuffer=Oe,V.INSPECT_MAX_BYTES=50;var re=2147483647;V.kMaxLength=re,ae.TYPED_ARRAY_SUPPORT=Ce(),!ae.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.");function Ce(){try{var oi=new Uint8Array(1);return oi.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},oi.foo()===42}catch{return!1}}Object.defineProperty(ae.prototype,"parent",{enumerable:!0,get:function(){if(ae.isBuffer(this))return this.buffer}}),Object.defineProperty(ae.prototype,"offset",{enumerable:!0,get:function(){if(ae.isBuffer(this))return this.byteOffset}});function ie(oi){if(oi>re)throw new RangeError('The value "'+oi+'" is invalid for option "size"');var Et=new Uint8Array(oi);return Et.__proto__=ae.prototype,Et}function ae(oi,Et,ii){if(typeof oi=="number"){if(typeof Et=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return de(oi)}return le(oi,Et,ii)}typeof Symbol<"u"&&Symbol.species!=null&&ae[Symbol.species]===ae&&Object.defineProperty(ae,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),ae.poolSize=8192;function le(oi,Et,ii){if(typeof oi=="string")return Ne(oi,Et);if(ArrayBuffer.isView(oi))return he(oi);if(oi==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof oi);if(gi(oi,ArrayBuffer)||oi&&gi(oi.buffer,ArrayBuffer))return pe(oi,Et,ii);if(typeof oi=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var si=oi.valueOf&&oi.valueOf();if(si!=null&&si!==oi)return ae.from(si,Et,ii);var fi=ze(oi);if(fi)return fi;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof oi[Symbol.toPrimitive]=="function")return ae.from(oi[Symbol.toPrimitive]("string"),Et,ii);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof oi)}ae.from=function(oi,Et,ii){return le(oi,Et,ii)},ae.prototype.__proto__=Uint8Array.prototype,ae.__proto__=Uint8Array;function Ie(oi){if(typeof oi!="number")throw new TypeError('"size" argument must be of type number');if(oi<0)throw new RangeError('The value "'+oi+'" is invalid for option "size"')}function ue(oi,Et,ii){return Ie(oi),oi<=0?ie(oi):Et!==void 0?typeof ii=="string"?ie(oi).fill(Et,ii):ie(oi).fill(Et):ie(oi)}ae.alloc=function(oi,Et,ii){return ue(oi,Et,ii)};function de(oi){return Ie(oi),ie(oi<0?0:xe(oi)|0)}ae.allocUnsafe=function(oi){return de(oi)},ae.allocUnsafeSlow=function(oi){return de(oi)};function Ne(oi,Et){if((typeof Et!="string"||Et==="")&&(Et="utf8"),!ae.isEncoding(Et))throw new TypeError("Unknown encoding: "+Et);var ii=_e(oi,Et)|0,si=ie(ii),fi=si.write(oi,Et);return fi!==ii&&(si=si.slice(0,fi)),si}function he(oi){for(var Et=oi.length<0?0:xe(oi.length)|0,ii=ie(Et),si=0;si<Et;si+=1)ii[si]=oi[si]&255;return ii}function pe(oi,Et,ii){if(Et<0||oi.byteLength<Et)throw new RangeError('"offset" is outside of buffer bounds');if(oi.byteLength<Et+(ii||0))throw new RangeError('"length" is outside of buffer bounds');var si;return Et===void 0&&ii===void 0?si=new Uint8Array(oi):ii===void 0?si=new Uint8Array(oi,Et):si=new Uint8Array(oi,Et,ii),si.__proto__=ae.prototype,si}function ze(oi){if(ae.isBuffer(oi)){var Et=xe(oi.length)|0,ii=ie(Et);return ii.length===0||oi.copy(ii,0,0,Et),ii}if(oi.length!==void 0)return typeof oi.length!="number"||li(oi.length)?ie(0):he(oi);if(oi.type==="Buffer"&&Array.isArray(oi.data))return he(oi.data)}function xe(oi){if(oi>=re)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+re.toString(16)+" bytes");return oi|0}function Oe(oi){return+oi!=oi&&(oi=0),ae.alloc(+oi)}ae.isBuffer=function(Et){return Et!=null&&Et._isBuffer===!0&&Et!==ae.prototype},ae.compare=function(Et,ii){if(gi(Et,Uint8Array)&&(Et=ae.from(Et,Et.offset,Et.byteLength)),gi(ii,Uint8Array)&&(ii=ae.from(ii,ii.offset,ii.byteLength)),!ae.isBuffer(Et)||!ae.isBuffer(ii))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Et===ii)return 0;for(var si=Et.length,fi=ii.length,pi=0,Si=Math.min(si,fi);pi<Si;++pi)if(Et[pi]!==ii[pi]){si=Et[pi],fi=ii[pi];break}return si<fi?-1:fi<si?1:0},ae.isEncoding=function(Et){switch(String(Et).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}},ae.concat=function(Et,ii){if(!Array.isArray(Et))throw new TypeError('"list" argument must be an Array of Buffers');if(Et.length===0)return ae.alloc(0);var si;if(ii===void 0)for(ii=0,si=0;si<Et.length;++si)ii+=Et[si].length;var fi=ae.allocUnsafe(ii),pi=0;for(si=0;si<Et.length;++si){var Si=Et[si];if(gi(Si,Uint8Array)&&(Si=ae.from(Si)),!ae.isBuffer(Si))throw new TypeError('"list" argument must be an Array of Buffers');Si.copy(fi,pi),pi+=Si.length}return fi};function _e(oi,Et){if(ae.isBuffer(oi))return oi.length;if(ArrayBuffer.isView(oi)||gi(oi,ArrayBuffer))return oi.byteLength;if(typeof oi!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof oi);var ii=oi.length,si=arguments.length>2&&arguments[2]===!0;if(!si&&ii===0)return 0;for(var fi=!1;;)switch(Et){case"ascii":case"latin1":case"binary":return ii;case"utf8":case"utf-8":return Ni(oi).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ii*2;case"hex":return ii>>>1;case"base64":return vi(oi).length;default:if(fi)return si?-1:Ni(oi).length;Et=(""+Et).toLowerCase(),fi=!0}}ae.byteLength=_e;function At(oi,Et,ii){var si=!1;if((Et===void 0||Et<0)&&(Et=0),Et>this.length||((ii===void 0||ii>this.length)&&(ii=this.length),ii<=0)||(ii>>>=0,Et>>>=0,ii<=Et))return"";for(oi||(oi="utf8");;)switch(oi){case"hex":return wi(this,Et,ii);case"utf8":case"utf-8":return ei(this,Et,ii);case"ascii":return ri(this,Et,ii);case"latin1":case"binary":return Ii(this,Et,ii);case"base64":return ti(this,Et,ii);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ai(this,Et,ii);default:if(si)throw new TypeError("Unknown encoding: "+oi);oi=(oi+"").toLowerCase(),si=!0}}ae.prototype._isBuffer=!0;function $e(oi,Et,ii){var si=oi[Et];oi[Et]=oi[ii],oi[ii]=si}ae.prototype.swap16=function(){var Et=this.length;if(Et%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var ii=0;ii<Et;ii+=2)$e(this,ii,ii+1);return this},ae.prototype.swap32=function(){var Et=this.length;if(Et%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var ii=0;ii<Et;ii+=4)$e(this,ii,ii+3),$e(this,ii+1,ii+2);return this},ae.prototype.swap64=function(){var Et=this.length;if(Et%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var ii=0;ii<Et;ii+=8)$e(this,ii,ii+7),$e(this,ii+1,ii+6),$e(this,ii+2,ii+5),$e(this,ii+3,ii+4);return this},ae.prototype.toString=function(){var Et=this.length;return Et===0?"":arguments.length===0?ei(this,0,Et):At.apply(this,arguments)},ae.prototype.toLocaleString=ae.prototype.toString,ae.prototype.equals=function(Et){if(!ae.isBuffer(Et))throw new TypeError("Argument must be a Buffer");return this===Et?!0:ae.compare(this,Et)===0},ae.prototype.inspect=function(){var Et="",ii=V.INSPECT_MAX_BYTES;return Et=this.toString("hex",0,ii).replace(/(.{2})/g,"$1 ").trim(),this.length>ii&&(Et+=" ... "),"<Buffer "+Et+">"},ae.prototype.compare=function(Et,ii,si,fi,pi){if(gi(Et,Uint8Array)&&(Et=ae.from(Et,Et.offset,Et.byteLength)),!ae.isBuffer(Et))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Et);if(ii===void 0&&(ii=0),si===void 0&&(si=Et?Et.length:0),fi===void 0&&(fi=0),pi===void 0&&(pi=this.length),ii<0||si>Et.length||fi<0||pi>this.length)throw new RangeError("out of range index");if(fi>=pi&&ii>=si)return 0;if(fi>=pi)return-1;if(ii>=si)return 1;if(ii>>>=0,si>>>=0,fi>>>=0,pi>>>=0,this===Et)return 0;for(var Si=pi-fi,xi=si-ii,Gi=Math.min(Si,xi),Bi=this.slice(fi,pi),Oi=Et.slice(ii,si),Zi=0;Zi<Gi;++Zi)if(Bi[Zi]!==Oi[Zi]){Si=Bi[Zi],xi=Oi[Zi];break}return Si<xi?-1:xi<Si?1:0};function Fe(oi,Et,ii,si,fi){if(oi.length===0)return-1;if(typeof ii=="string"?(si=ii,ii=0):ii>2147483647?ii=2147483647:ii<-2147483648&&(ii=-2147483648),ii=+ii,li(ii)&&(ii=fi?0:oi.length-1),ii<0&&(ii=oi.length+ii),ii>=oi.length){if(fi)return-1;ii=oi.length-1}else if(ii<0)if(fi)ii=0;else return-1;if(typeof Et=="string"&&(Et=ae.from(Et,si)),ae.isBuffer(Et))return Et.length===0?-1:Ue(oi,Et,ii,si,fi);if(typeof Et=="number")return Et=Et&255,typeof Uint8Array.prototype.indexOf=="function"?fi?Uint8Array.prototype.indexOf.call(oi,Et,ii):Uint8Array.prototype.lastIndexOf.call(oi,Et,ii):Ue(oi,[Et],ii,si,fi);throw new TypeError("val must be string, number or Buffer")}function Ue(oi,Et,ii,si,fi){var pi=1,Si=oi.length,xi=Et.length;if(si!==void 0&&(si=String(si).toLowerCase(),si==="ucs2"||si==="ucs-2"||si==="utf16le"||si==="utf-16le")){if(oi.length<2||Et.length<2)return-1;pi=2,Si/=2,xi/=2,ii/=2}function Gi(Vi,ki){return pi===1?Vi[ki]:Vi.readUInt16BE(ki*pi)}var Bi;if(fi){var Oi=-1;for(Bi=ii;Bi<Si;Bi++)if(Gi(oi,Bi)===Gi(Et,Oi===-1?0:Bi-Oi)){if(Oi===-1&&(Oi=Bi),Bi-Oi+1===xi)return Oi*pi}else Oi!==-1&&(Bi-=Bi-Oi),Oi=-1}else for(ii+xi>Si&&(ii=Si-xi),Bi=ii;Bi>=0;Bi--){for(var Zi=!0,Wi=0;Wi<xi;Wi++)if(Gi(oi,Bi+Wi)!==Gi(Et,Wi)){Zi=!1;break}if(Zi)return Bi}return-1}ae.prototype.includes=function(Et,ii,si){return this.indexOf(Et,ii,si)!==-1},ae.prototype.indexOf=function(Et,ii,si){return Fe(this,Et,ii,si,!0)},ae.prototype.lastIndexOf=function(Et,ii,si){return Fe(this,Et,ii,si,!1)};function Ve(oi,Et,ii,si){ii=Number(ii)||0;var fi=oi.length-ii;si?(si=Number(si),si>fi&&(si=fi)):si=fi;var pi=Et.length;si>pi/2&&(si=pi/2);for(var Si=0;Si<si;++Si){var xi=parseInt(Et.substr(Si*2,2),16);if(li(xi))return Si;oi[ii+Si]=xi}return Si}function Dt(oi,Et,ii,si){return bi(Ni(Et,oi.length-ii),oi,ii,si)}function qe(oi,Et,ii,si){return bi(Mi(Et),oi,ii,si)}function kt(oi,Et,ii,si){return qe(oi,Et,ii,si)}function jt(oi,Et,ii,si){return bi(vi(Et),oi,ii,si)}function Pt(oi,Et,ii,si){return bi(mi(Et,oi.length-ii),oi,ii,si)}ae.prototype.write=function(Et,ii,si,fi){if(ii===void 0)fi="utf8",si=this.length,ii=0;else if(si===void 0&&typeof ii=="string")fi=ii,si=this.length,ii=0;else if(isFinite(ii))ii=ii>>>0,isFinite(si)?(si=si>>>0,fi===void 0&&(fi="utf8")):(fi=si,si=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var pi=this.length-ii;if((si===void 0||si>pi)&&(si=pi),Et.length>0&&(si<0||ii<0)||ii>this.length)throw new RangeError("Attempt to write outside buffer bounds");fi||(fi="utf8");for(var Si=!1;;)switch(fi){case"hex":return Ve(this,Et,ii,si);case"utf8":case"utf-8":return Dt(this,Et,ii,si);case"ascii":return qe(this,Et,ii,si);case"latin1":case"binary":return kt(this,Et,ii,si);case"base64":return jt(this,Et,ii,si);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pt(this,Et,ii,si);default:if(Si)throw new TypeError("Unknown encoding: "+fi);fi=(""+fi).toLowerCase(),Si=!0}},ae.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ti(oi,Et,ii){return Et===0&&ii===oi.length?$.fromByteArray(oi):$.fromByteArray(oi.slice(Et,ii))}function ei(oi,Et,ii){ii=Math.min(oi.length,ii);for(var si=[],fi=Et;fi<ii;){var pi=oi[fi],Si=null,xi=pi>239?4:pi>223?3:pi>191?2:1;if(fi+xi<=ii){var Gi,Bi,Oi,Zi;switch(xi){case 1:pi<128&&(Si=pi);break;case 2:Gi=oi[fi+1],(Gi&192)===128&&(Zi=(pi&31)<<6|Gi&63,Zi>127&&(Si=Zi));break;case 3:Gi=oi[fi+1],Bi=oi[fi+2],(Gi&192)===128&&(Bi&192)===128&&(Zi=(pi&15)<<12|(Gi&63)<<6|Bi&63,Zi>2047&&(Zi<55296||Zi>57343)&&(Si=Zi));break;case 4:Gi=oi[fi+1],Bi=oi[fi+2],Oi=oi[fi+3],(Gi&192)===128&&(Bi&192)===128&&(Oi&192)===128&&(Zi=(pi&15)<<18|(Gi&63)<<12|(Bi&63)<<6|Oi&63,Zi>65535&&Zi<1114112&&(Si=Zi))}}Si===null?(Si=65533,xi=1):Si>65535&&(Si-=65536,si.push(Si>>>10&1023|55296),Si=56320|Si&1023),si.push(Si),fi+=xi}return ni(si)}var Lt=4096;function ni(oi){var Et=oi.length;if(Et<=Lt)return String.fromCharCode.apply(String,oi);for(var ii="",si=0;si<Et;)ii+=String.fromCharCode.apply(String,oi.slice(si,si+=Lt));return ii}function ri(oi,Et,ii){var si="";ii=Math.min(oi.length,ii);for(var fi=Et;fi<ii;++fi)si+=String.fromCharCode(oi[fi]&127);return si}function Ii(oi,Et,ii){var si="";ii=Math.min(oi.length,ii);for(var fi=Et;fi<ii;++fi)si+=String.fromCharCode(oi[fi]);return si}function wi(oi,Et,ii){var si=oi.length;(!Et||Et<0)&&(Et=0),(!ii||ii<0||ii>si)&&(ii=si);for(var fi="",pi=Et;pi<ii;++pi)fi+=zi(oi[pi]);return fi}function ai(oi,Et,ii){for(var si=oi.slice(Et,ii),fi="",pi=0;pi<si.length;pi+=2)fi+=String.fromCharCode(si[pi]+si[pi+1]*256);return fi}ae.prototype.slice=function(Et,ii){var si=this.length;Et=~~Et,ii=ii===void 0?si:~~ii,Et<0?(Et+=si,Et<0&&(Et=0)):Et>si&&(Et=si),ii<0?(ii+=si,ii<0&&(ii=0)):ii>si&&(ii=si),ii<Et&&(ii=Et);var fi=this.subarray(Et,ii);return fi.__proto__=ae.prototype,fi};function di(oi,Et,ii){if(oi%1!==0||oi<0)throw new RangeError("offset is not uint");if(oi+Et>ii)throw new RangeError("Trying to access beyond buffer length")}ae.prototype.readUIntLE=function(Et,ii,si){Et=Et>>>0,ii=ii>>>0,si||di(Et,ii,this.length);for(var fi=this[Et],pi=1,Si=0;++Si<ii&&(pi*=256);)fi+=this[Et+Si]*pi;return fi},ae.prototype.readUIntBE=function(Et,ii,si){Et=Et>>>0,ii=ii>>>0,si||di(Et,ii,this.length);for(var fi=this[Et+--ii],pi=1;ii>0&&(pi*=256);)fi+=this[Et+--ii]*pi;return fi},ae.prototype.readUInt8=function(Et,ii){return Et=Et>>>0,ii||di(Et,1,this.length),this[Et]},ae.prototype.readUInt16LE=function(Et,ii){return Et=Et>>>0,ii||di(Et,2,this.length),this[Et]|this[Et+1]<<8},ae.prototype.readUInt16BE=function(Et,ii){return Et=Et>>>0,ii||di(Et,2,this.length),this[Et]<<8|this[Et+1]},ae.prototype.readUInt32LE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),(this[Et]|this[Et+1]<<8|this[Et+2]<<16)+this[Et+3]*16777216},ae.prototype.readUInt32BE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),this[Et]*16777216+(this[Et+1]<<16|this[Et+2]<<8|this[Et+3])},ae.prototype.readIntLE=function(Et,ii,si){Et=Et>>>0,ii=ii>>>0,si||di(Et,ii,this.length);for(var fi=this[Et],pi=1,Si=0;++Si<ii&&(pi*=256);)fi+=this[Et+Si]*pi;return pi*=128,fi>=pi&&(fi-=Math.pow(2,8*ii)),fi},ae.prototype.readIntBE=function(Et,ii,si){Et=Et>>>0,ii=ii>>>0,si||di(Et,ii,this.length);for(var fi=ii,pi=1,Si=this[Et+--fi];fi>0&&(pi*=256);)Si+=this[Et+--fi]*pi;return pi*=128,Si>=pi&&(Si-=Math.pow(2,8*ii)),Si},ae.prototype.readInt8=function(Et,ii){return Et=Et>>>0,ii||di(Et,1,this.length),this[Et]&128?(255-this[Et]+1)*-1:this[Et]},ae.prototype.readInt16LE=function(Et,ii){Et=Et>>>0,ii||di(Et,2,this.length);var si=this[Et]|this[Et+1]<<8;return si&32768?si|4294901760:si},ae.prototype.readInt16BE=function(Et,ii){Et=Et>>>0,ii||di(Et,2,this.length);var si=this[Et+1]|this[Et]<<8;return si&32768?si|4294901760:si},ae.prototype.readInt32LE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),this[Et]|this[Et+1]<<8|this[Et+2]<<16|this[Et+3]<<24},ae.prototype.readInt32BE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),this[Et]<<24|this[Et+1]<<16|this[Et+2]<<8|this[Et+3]},ae.prototype.readFloatLE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),oe.read(this,Et,!0,23,4)},ae.prototype.readFloatBE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),oe.read(this,Et,!1,23,4)},ae.prototype.readDoubleLE=function(Et,ii){return Et=Et>>>0,ii||di(Et,8,this.length),oe.read(this,Et,!0,52,8)},ae.prototype.readDoubleBE=function(Et,ii){return Et=Et>>>0,ii||di(Et,8,this.length),oe.read(this,Et,!1,52,8)};function hi(oi,Et,ii,si,fi,pi){if(!ae.isBuffer(oi))throw new TypeError('"buffer" argument must be a Buffer instance');if(Et>fi||Et<pi)throw new RangeError('"value" argument is out of bounds');if(ii+si>oi.length)throw new RangeError("Index out of range")}ae.prototype.writeUIntLE=function(Et,ii,si,fi){if(Et=+Et,ii=ii>>>0,si=si>>>0,!fi){var pi=Math.pow(2,8*si)-1;hi(this,Et,ii,si,pi,0)}var Si=1,xi=0;for(this[ii]=Et&255;++xi<si&&(Si*=256);)this[ii+xi]=Et/Si&255;return ii+si},ae.prototype.writeUIntBE=function(Et,ii,si,fi){if(Et=+Et,ii=ii>>>0,si=si>>>0,!fi){var pi=Math.pow(2,8*si)-1;hi(this,Et,ii,si,pi,0)}var Si=si-1,xi=1;for(this[ii+Si]=Et&255;--Si>=0&&(xi*=256);)this[ii+Si]=Et/xi&255;return ii+si},ae.prototype.writeUInt8=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,1,255,0),this[ii]=Et&255,ii+1},ae.prototype.writeUInt16LE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,2,65535,0),this[ii]=Et&255,this[ii+1]=Et>>>8,ii+2},ae.prototype.writeUInt16BE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,2,65535,0),this[ii]=Et>>>8,this[ii+1]=Et&255,ii+2},ae.prototype.writeUInt32LE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,4,4294967295,0),this[ii+3]=Et>>>24,this[ii+2]=Et>>>16,this[ii+1]=Et>>>8,this[ii]=Et&255,ii+4},ae.prototype.writeUInt32BE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,4,4294967295,0),this[ii]=Et>>>24,this[ii+1]=Et>>>16,this[ii+2]=Et>>>8,this[ii+3]=Et&255,ii+4},ae.prototype.writeIntLE=function(Et,ii,si,fi){if(Et=+Et,ii=ii>>>0,!fi){var pi=Math.pow(2,8*si-1);hi(this,Et,ii,si,pi-1,-pi)}var Si=0,xi=1,Gi=0;for(this[ii]=Et&255;++Si<si&&(xi*=256);)Et<0&&Gi===0&&this[ii+Si-1]!==0&&(Gi=1),this[ii+Si]=(Et/xi>>0)-Gi&255;return ii+si},ae.prototype.writeIntBE=function(Et,ii,si,fi){if(Et=+Et,ii=ii>>>0,!fi){var pi=Math.pow(2,8*si-1);hi(this,Et,ii,si,pi-1,-pi)}var Si=si-1,xi=1,Gi=0;for(this[ii+Si]=Et&255;--Si>=0&&(xi*=256);)Et<0&&Gi===0&&this[ii+Si+1]!==0&&(Gi=1),this[ii+Si]=(Et/xi>>0)-Gi&255;return ii+si},ae.prototype.writeInt8=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,1,127,-128),Et<0&&(Et=255+Et+1),this[ii]=Et&255,ii+1},ae.prototype.writeInt16LE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,2,32767,-32768),this[ii]=Et&255,this[ii+1]=Et>>>8,ii+2},ae.prototype.writeInt16BE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,2,32767,-32768),this[ii]=Et>>>8,this[ii+1]=Et&255,ii+2},ae.prototype.writeInt32LE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,4,2147483647,-2147483648),this[ii]=Et&255,this[ii+1]=Et>>>8,this[ii+2]=Et>>>16,this[ii+3]=Et>>>24,ii+4},ae.prototype.writeInt32BE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,4,2147483647,-2147483648),Et<0&&(Et=4294967295+Et+1),this[ii]=Et>>>24,this[ii+1]=Et>>>16,this[ii+2]=Et>>>8,this[ii+3]=Et&255,ii+4};function ci(oi,Et,ii,si,fi,pi){if(ii+si>oi.length)throw new RangeError("Index out of range");if(ii<0)throw new RangeError("Index out of range")}function Ai(oi,Et,ii,si,fi){return Et=+Et,ii=ii>>>0,fi||ci(oi,Et,ii,4),oe.write(oi,Et,ii,si,23,4),ii+4}ae.prototype.writeFloatLE=function(Et,ii,si){return Ai(this,Et,ii,!0,si)},ae.prototype.writeFloatBE=function(Et,ii,si){return Ai(this,Et,ii,!1,si)};function yi(oi,Et,ii,si,fi){return Et=+Et,ii=ii>>>0,fi||ci(oi,Et,ii,8),oe.write(oi,Et,ii,si,52,8),ii+8}ae.prototype.writeDoubleLE=function(Et,ii,si){return yi(this,Et,ii,!0,si)},ae.prototype.writeDoubleBE=function(Et,ii,si){return yi(this,Et,ii,!1,si)},ae.prototype.copy=function(Et,ii,si,fi){if(!ae.isBuffer(Et))throw new TypeError("argument should be a Buffer");if(si||(si=0),!fi&&fi!==0&&(fi=this.length),ii>=Et.length&&(ii=Et.length),ii||(ii=0),fi>0&&fi<si&&(fi=si),fi===si||Et.length===0||this.length===0)return 0;if(ii<0)throw new RangeError("targetStart out of bounds");if(si<0||si>=this.length)throw new RangeError("Index out of range");if(fi<0)throw new RangeError("sourceEnd out of bounds");fi>this.length&&(fi=this.length),Et.length-ii<fi-si&&(fi=Et.length-ii+si);var pi=fi-si;if(this===Et&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(ii,si,fi);else if(this===Et&&si<ii&&ii<fi)for(var Si=pi-1;Si>=0;--Si)Et[Si+ii]=this[Si+si];else Uint8Array.prototype.set.call(Et,this.subarray(si,fi),ii);return pi},ae.prototype.fill=function(Et,ii,si,fi){if(typeof Et=="string"){if(typeof ii=="string"?(fi=ii,ii=0,si=this.length):typeof si=="string"&&(fi=si,si=this.length),fi!==void 0&&typeof fi!="string")throw new TypeError("encoding must be a string");if(typeof fi=="string"&&!ae.isEncoding(fi))throw new TypeError("Unknown encoding: "+fi);if(Et.length===1){var pi=Et.charCodeAt(0);(fi==="utf8"&&pi<128||fi==="latin1")&&(Et=pi)}}else typeof Et=="number"&&(Et=Et&255);if(ii<0||this.length<ii||this.length<si)throw new RangeError("Out of range index");if(si<=ii)return this;ii=ii>>>0,si=si===void 0?this.length:si>>>0,Et||(Et=0);var Si;if(typeof Et=="number")for(Si=ii;Si<si;++Si)this[Si]=Et;else{var xi=ae.isBuffer(Et)?Et:ae.from(Et,fi),Gi=xi.length;if(Gi===0)throw new TypeError('The value "'+Et+'" is invalid for argument "value"');for(Si=0;Si<si-ii;++Si)this[Si+ii]=xi[Si%Gi]}return this};var ui=/[^+/0-9A-Za-z-_]/g;function Ci(oi){if(oi=oi.split("=")[0],oi=oi.trim().replace(ui,""),oi.length<2)return"";for(;oi.length%4!==0;)oi=oi+"=";return oi}function zi(oi){return oi<16?"0"+oi.toString(16):oi.toString(16)}function Ni(oi,Et){Et=Et||1/0;for(var ii,si=oi.length,fi=null,pi=[],Si=0;Si<si;++Si){if(ii=oi.charCodeAt(Si),ii>55295&&ii<57344){if(!fi){if(ii>56319){(Et-=3)>-1&&pi.push(239,191,189);continue}else if(Si+1===si){(Et-=3)>-1&&pi.push(239,191,189);continue}fi=ii;continue}if(ii<56320){(Et-=3)>-1&&pi.push(239,191,189),fi=ii;continue}ii=(fi-55296<<10|ii-56320)+65536}else fi&&(Et-=3)>-1&&pi.push(239,191,189);if(fi=null,ii<128){if((Et-=1)<0)break;pi.push(ii)}else if(ii<2048){if((Et-=2)<0)break;pi.push(ii>>6|192,ii&63|128)}else if(ii<65536){if((Et-=3)<0)break;pi.push(ii>>12|224,ii>>6&63|128,ii&63|128)}else if(ii<1114112){if((Et-=4)<0)break;pi.push(ii>>18|240,ii>>12&63|128,ii>>6&63|128,ii&63|128)}else throw new Error("Invalid code point")}return pi}function Mi(oi){for(var Et=[],ii=0;ii<oi.length;++ii)Et.push(oi.charCodeAt(ii)&255);return Et}function mi(oi,Et){for(var ii,si,fi,pi=[],Si=0;Si<oi.length&&!((Et-=2)<0);++Si)ii=oi.charCodeAt(Si),si=ii>>8,fi=ii%256,pi.push(fi),pi.push(si);return pi}function vi(oi){return $.toByteArray(Ci(oi))}function bi(oi,Et,ii,si){for(var fi=0;fi<si&&!(fi+ii>=Et.length||fi>=oi.length);++fi)Et[fi+ii]=oi[fi];return fi}function gi(oi,Et){return oi instanceof Et||oi!=null&&oi.constructor!=null&&oi.constructor.name!=null&&oi.constructor.name===Et.name}function li(oi){return oi!==oi}}).call(this)}).call(this,r("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(r,g,V){(function(k){(function(){V.formatArgs=oe,V.save=re,V.load=Ce,V.useColors=$,V.storage=ie(),V.destroy=(()=>{let le=!1;return()=>{le||(le=!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`."))}})(),V.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"];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+)/)}function oe(le){if(le[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+le[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;const Ie="color: "+this.color;le.splice(1,0,Ie,"color: inherit");let ue=0,de=0;le[0].replace(/%[a-zA-Z%]/g,Ne=>{Ne!=="%%"&&(ue++,Ne==="%c"&&(de=ue))}),le.splice(de,0,Ie)}V.log=console.debug||console.log||(()=>{});function re(le){try{le?V.storage.setItem("debug",le):V.storage.removeItem("debug")}catch{}}function Ce(){let le;try{le=V.storage.getItem("debug")}catch{}return!le&&typeof k<"u"&&"env"in k&&(le=k.env.DEBUG),le}function ie(){try{return localStorage}catch{}}g.exports=r("./common")(V);const{formatters:ae}=g.exports;ae.j=function(le){try{return JSON.stringify(le)}catch(Ie){return"[UnexpectedJSONParseError]: "+Ie.message}}}).call(this)}).call(this,r("_process"))},{"./common":19,_process:50}],19:[function(r,g,V){function k($){re.debug=re,re.default=re,re.coerce=ue,re.disable=ae,re.enable=ie,re.enabled=le,re.humanize=r("ms"),re.destroy=de,Object.keys($).forEach(Ne=>{re[Ne]=$[Ne]}),re.names=[],re.skips=[],re.formatters={};function oe(Ne){let he=0;for(let pe=0;pe<Ne.length;pe++)he=(he<<5)-he+Ne.charCodeAt(pe),he|=0;return re.colors[Math.abs(he)%re.colors.length]}re.selectColor=oe;function re(Ne){let he,pe=null,ze,xe;function Oe(..._e){if(!Oe.enabled)return;const At=Oe,$e=Number(new Date),Fe=$e-(he||$e);At.diff=Fe,At.prev=he,At.curr=$e,he=$e,_e[0]=re.coerce(_e[0]),typeof _e[0]!="string"&&_e.unshift("%O");let Ue=0;_e[0]=_e[0].replace(/%([a-zA-Z%])/g,(Dt,qe)=>{if(Dt==="%%")return"%";Ue++;const kt=re.formatters[qe];if(typeof kt=="function"){const jt=_e[Ue];Dt=kt.call(At,jt),_e.splice(Ue,1),Ue--}return Dt}),re.formatArgs.call(At,_e),(At.log||re.log).apply(At,_e)}return Oe.namespace=Ne,Oe.useColors=re.useColors(),Oe.color=re.selectColor(Ne),Oe.extend=Ce,Oe.destroy=re.destroy,Object.defineProperty(Oe,"enabled",{enumerable:!0,configurable:!1,get:()=>pe!==null?pe:(ze!==re.namespaces&&(ze=re.namespaces,xe=re.enabled(Ne)),xe),set:_e=>{pe=_e}}),typeof re.init=="function"&&re.init(Oe),Oe}function Ce(Ne,he){const pe=re(this.namespace+(typeof he>"u"?":":he)+Ne);return pe.log=this.log,pe}function ie(Ne){re.save(Ne),re.namespaces=Ne,re.names=[],re.skips=[];let he;const pe=(typeof Ne=="string"?Ne:"").split(/[\s,]+/),ze=pe.length;for(he=0;he<ze;he++)pe[he]&&(Ne=pe[he].replace(/\*/g,".*?"),Ne[0]==="-"?re.skips.push(new RegExp("^"+Ne.substr(1)+"$")):re.names.push(new RegExp("^"+Ne+"$")))}function ae(){const Ne=[...re.names.map(Ie),...re.skips.map(Ie).map(he=>"-"+he)].join(",");return re.enable(""),Ne}function le(Ne){if(Ne[Ne.length-1]==="*")return!0;let he,pe;for(he=0,pe=re.skips.length;he<pe;he++)if(re.skips[he].test(Ne))return!1;for(he=0,pe=re.names.length;he<pe;he++)if(re.names[he].test(Ne))return!0;return!1}function Ie(Ne){return Ne.toString().substring(2,Ne.toString().length-2).replace(/\.\*\?$/,"*")}function ue(Ne){return Ne instanceof Error?Ne.stack||Ne.message:Ne}function de(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return re.enable(re.load()),re}g.exports=k},{ms:45}],20:[function(r,g,V){(function(k,$){(function(){var oe=r("readable-stream"),re=r("end-of-stream"),Ce=r("inherits"),ie=r("stream-shift"),ae=$.from&&$.from!==Uint8Array.from?$.from([0]):new $([0]),le=function(ze,xe){ze._corked?ze.once("uncork",xe):xe()},Ie=function(ze,xe){ze._autoDestroy&&ze.destroy(xe)},ue=function(ze,xe){return function(Oe){Oe?Ie(ze,Oe.message==="premature close"?null:Oe):xe&&!ze._ended&&ze.end()}},de=function(ze,xe){if(!ze||ze._writableState&&ze._writableState.finished)return xe();if(ze._writableState)return ze.end(xe);ze.end(),xe()},Ne=function(){},he=function(ze){return new oe.Readable({objectMode:!0,highWaterMark:16}).wrap(ze)},pe=function(ze,xe,Oe){if(!(this instanceof pe))return new pe(ze,xe,Oe);oe.Duplex.call(this,Oe),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!Oe||Oe.autoDestroy!==!1,this._forwardDestroy=!Oe||Oe.destroy!==!1,this._forwardEnd=!Oe||Oe.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,ze&&this.setWritable(ze),xe&&this.setReadable(xe)};Ce(pe,oe.Duplex),pe.obj=function(ze,xe,Oe){return Oe||(Oe={}),Oe.objectMode=!0,Oe.highWaterMark=16,new pe(ze,xe,Oe)},pe.prototype.cork=function(){++this._corked===1&&this.emit("cork")},pe.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},pe.prototype.setWritable=function(ze){if(this._unwrite&&this._unwrite(),this.destroyed){ze&&ze.destroy&&ze.destroy();return}if(ze===null||ze===!1){this.end();return}var xe=this,Oe=re(ze,{writable:!0,readable:!1},ue(this,this._forwardEnd)),_e=function(){var $e=xe._ondrain;xe._ondrain=null,$e&&$e()},At=function(){xe._writable.removeListener("drain",_e),Oe()};this._unwrite&&k.nextTick(_e),this._writable=ze,this._writable.on("drain",_e),this._unwrite=At,this.uncork()},pe.prototype.setReadable=function(ze){if(this._unread&&this._unread(),this.destroyed){ze&&ze.destroy&&ze.destroy();return}if(ze===null||ze===!1){this.push(null),this.resume();return}var xe=this,Oe=re(ze,{writable:!1,readable:!0},ue(this)),_e=function(){xe._forward()},At=function(){xe.push(null)},$e=function(){xe._readable2.removeListener("readable",_e),xe._readable2.removeListener("end",At),Oe()};this._drained=!0,this._readable=ze,this._readable2=ze._readableState?ze:he(ze),this._readable2.on("readable",_e),this._readable2.on("end",At),this._unread=$e,this._forward()},pe.prototype._read=function(){this._drained=!0,this._forward()},pe.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var ze;this._drained&&(ze=ie(this._readable2))!==null;)this.destroyed||(this._drained=this.push(ze));this._forwarding=!1}},pe.prototype.destroy=function(ze,xe){if(xe||(xe=Ne),this.destroyed)return xe(null);this.destroyed=!0;var Oe=this;k.nextTick(function(){Oe._destroy(ze),xe(null)})},pe.prototype._destroy=function(ze){if(ze){var xe=this._ondrain;this._ondrain=null,xe?xe(ze):this.emit("error",ze)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},pe.prototype._write=function(ze,xe,Oe){if(!this.destroyed){if(this._corked)return le(this,this._write.bind(this,ze,xe,Oe));if(ze===ae)return this._finish(Oe);if(!this._writable)return Oe();this._writable.write(ze)===!1?this._ondrain=Oe:this.destroyed||Oe()}},pe.prototype._finish=function(ze){var xe=this;this.emit("preend"),le(this,function(){de(xe._forwardEnd&&xe._writable,function(){xe._writableState.prefinished===!1&&(xe._writableState.prefinished=!0),xe.emit("prefinish"),le(xe,ze)})})},pe.prototype.end=function(ze,xe,Oe){return typeof ze=="function"?this.end(null,null,ze):typeof xe=="function"?this.end(ze,null,xe):(this._ended=!0,ze&&this.write(ze),!this._writableState.ending&&!this._writableState.destroyed&&this.write(ae),oe.Writable.prototype.end.call(this,Oe))},g.exports=pe}).call(this)}).call(this,r("_process"),r("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(r,g,V){(function(k){(function(){var $=r("once"),oe=function(){},re=function(ae){return ae.setHeader&&typeof ae.abort=="function"},Ce=function(ae){return ae.stdio&&Array.isArray(ae.stdio)&&ae.stdio.length===3},ie=function(ae,le,Ie){if(typeof le=="function")return ie(ae,null,le);le||(le={}),Ie=$(Ie||oe);var ue=ae._writableState,de=ae._readableState,Ne=le.readable||le.readable!==!1&&ae.readable,he=le.writable||le.writable!==!1&&ae.writable,pe=!1,ze=function(){ae.writable||xe()},xe=function(){he=!1,Ne||Ie.call(ae)},Oe=function(){Ne=!1,he||Ie.call(ae)},_e=function(Ve){Ie.call(ae,Ve?new Error("exited with error code: "+Ve):null)},At=function(Ve){Ie.call(ae,Ve)},$e=function(){k.nextTick(Fe)},Fe=function(){if(!pe){if(Ne&&!(de&&de.ended&&!de.destroyed))return Ie.call(ae,new Error("premature close"));if(he&&!(ue&&ue.ended&&!ue.destroyed))return Ie.call(ae,new Error("premature close"))}},Ue=function(){ae.req.on("finish",xe)};return re(ae)?(ae.on("complete",xe),ae.on("abort",$e),ae.req?Ue():ae.on("request",Ue)):he&&!ue&&(ae.on("end",ze),ae.on("close",ze)),Ce(ae)&&ae.on("exit",_e),ae.on("end",Oe),ae.on("finish",xe),le.error!==!1&&ae.on("error",At),ae.on("close",$e),function(){pe=!0,ae.removeListener("complete",xe),ae.removeListener("abort",$e),ae.removeListener("request",Ue),ae.req&&ae.req.removeListener("finish",xe),ae.removeListener("end",ze),ae.removeListener("close",ze),ae.removeListener("finish",xe),ae.removeListener("exit",_e),ae.removeListener("end",Oe),ae.removeListener("error",At),ae.removeListener("close",$e)}};g.exports=ie}).call(this)}).call(this,r("_process"))},{_process:50,once:48}],22:[function(r,g,V){var k=Object.create||Ue,$=Object.keys||Ve,oe=Function.prototype.bind||Dt;function re(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=k(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}g.exports=re,re.EventEmitter=re,re.prototype._events=void 0,re.prototype._maxListeners=void 0;var Ce=10,ie;try{var ae={};Object.defineProperty&&Object.defineProperty(ae,"x",{value:0}),ie=ae.x===0}catch{ie=!1}ie?Object.defineProperty(re,"defaultMaxListeners",{enumerable:!0,get:function(){return Ce},set:function(qe){if(typeof qe!="number"||qe<0||qe!==qe)throw new TypeError('"defaultMaxListeners" must be a positive number');Ce=qe}}):re.defaultMaxListeners=Ce,re.prototype.setMaxListeners=function(kt){if(typeof kt!="number"||kt<0||isNaN(kt))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=kt,this};function le(qe){return qe._maxListeners===void 0?re.defaultMaxListeners:qe._maxListeners}re.prototype.getMaxListeners=function(){return le(this)};function Ie(qe,kt,jt){if(kt)qe.call(jt);else for(var Pt=qe.length,ti=$e(qe,Pt),ei=0;ei<Pt;++ei)ti[ei].call(jt)}function ue(qe,kt,jt,Pt){if(kt)qe.call(jt,Pt);else for(var ti=qe.length,ei=$e(qe,ti),Lt=0;Lt<ti;++Lt)ei[Lt].call(jt,Pt)}function de(qe,kt,jt,Pt,ti){if(kt)qe.call(jt,Pt,ti);else for(var ei=qe.length,Lt=$e(qe,ei),ni=0;ni<ei;++ni)Lt[ni].call(jt,Pt,ti)}function Ne(qe,kt,jt,Pt,ti,ei){if(kt)qe.call(jt,Pt,ti,ei);else for(var Lt=qe.length,ni=$e(qe,Lt),ri=0;ri<Lt;++ri)ni[ri].call(jt,Pt,ti,ei)}function he(qe,kt,jt,Pt){if(kt)qe.apply(jt,Pt);else for(var ti=qe.length,ei=$e(qe,ti),Lt=0;Lt<ti;++Lt)ei[Lt].apply(jt,Pt)}re.prototype.emit=function(kt){var jt,Pt,ti,ei,Lt,ni,ri=kt==="error";if(ni=this._events,ni)ri=ri&&ni.error==null;else if(!ri)return!1;if(ri){if(arguments.length>1&&(jt=arguments[1]),jt instanceof Error)throw jt;var Ii=new Error('Unhandled "error" event. ('+jt+")");throw Ii.context=jt,Ii}if(Pt=ni[kt],!Pt)return!1;var wi=typeof Pt=="function";switch(ti=arguments.length,ti){case 1:Ie(Pt,wi,this);break;case 2:ue(Pt,wi,this,arguments[1]);break;case 3:de(Pt,wi,this,arguments[1],arguments[2]);break;case 4:Ne(Pt,wi,this,arguments[1],arguments[2],arguments[3]);break;default:for(ei=new Array(ti-1),Lt=1;Lt<ti;Lt++)ei[Lt-1]=arguments[Lt];he(Pt,wi,this,ei)}return!0};function pe(qe,kt,jt,Pt){var ti,ei,Lt;if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');if(ei=qe._events,ei?(ei.newListener&&(qe.emit("newListener",kt,jt.listener?jt.listener:jt),ei=qe._events),Lt=ei[kt]):(ei=qe._events=k(null),qe._eventsCount=0),!Lt)Lt=ei[kt]=jt,++qe._eventsCount;else if(typeof Lt=="function"?Lt=ei[kt]=Pt?[jt,Lt]:[Lt,jt]:Pt?Lt.unshift(jt):Lt.push(jt),!Lt.warned&&(ti=le(qe),ti&&ti>0&&Lt.length>ti)){Lt.warned=!0;var ni=new Error("Possible EventEmitter memory leak detected. "+Lt.length+' "'+String(kt)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');ni.name="MaxListenersExceededWarning",ni.emitter=qe,ni.type=kt,ni.count=Lt.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",ni.name,ni.message)}return qe}re.prototype.addListener=function(kt,jt){return pe(this,kt,jt,!1)},re.prototype.on=re.prototype.addListener,re.prototype.prependListener=function(kt,jt){return pe(this,kt,jt,!0)};function ze(){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 qe=new Array(arguments.length),kt=0;kt<qe.length;++kt)qe[kt]=arguments[kt];this.listener.apply(this.target,qe)}}function xe(qe,kt,jt){var Pt={fired:!1,wrapFn:void 0,target:qe,type:kt,listener:jt},ti=oe.call(ze,Pt);return ti.listener=jt,Pt.wrapFn=ti,ti}re.prototype.once=function(kt,jt){if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');return this.on(kt,xe(this,kt,jt)),this},re.prototype.prependOnceListener=function(kt,jt){if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(kt,xe(this,kt,jt)),this},re.prototype.removeListener=function(kt,jt){var Pt,ti,ei,Lt,ni;if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');if(ti=this._events,!ti)return this;if(Pt=ti[kt],!Pt)return this;if(Pt===jt||Pt.listener===jt)--this._eventsCount===0?this._events=k(null):(delete ti[kt],ti.removeListener&&this.emit("removeListener",kt,Pt.listener||jt));else if(typeof Pt!="function"){for(ei=-1,Lt=Pt.length-1;Lt>=0;Lt--)if(Pt[Lt]===jt||Pt[Lt].listener===jt){ni=Pt[Lt].listener,ei=Lt;break}if(ei<0)return this;ei===0?Pt.shift():At(Pt,ei),Pt.length===1&&(ti[kt]=Pt[0]),ti.removeListener&&this.emit("removeListener",kt,ni||jt)}return this},re.prototype.removeAllListeners=function(kt){var jt,Pt,ti;if(Pt=this._events,!Pt)return this;if(!Pt.removeListener)return arguments.length===0?(this._events=k(null),this._eventsCount=0):Pt[kt]&&(--this._eventsCount===0?this._events=k(null):delete Pt[kt]),this;if(arguments.length===0){var ei=$(Pt),Lt;for(ti=0;ti<ei.length;++ti)Lt=ei[ti],Lt!=="removeListener"&&this.removeAllListeners(Lt);return this.removeAllListeners("removeListener"),this._events=k(null),this._eventsCount=0,this}if(jt=Pt[kt],typeof jt=="function")this.removeListener(kt,jt);else if(jt)for(ti=jt.length-1;ti>=0;ti--)this.removeListener(kt,jt[ti]);return this};function Oe(qe,kt,jt){var Pt=qe._events;if(!Pt)return[];var ti=Pt[kt];return ti?typeof ti=="function"?jt?[ti.listener||ti]:[ti]:jt?Fe(ti):$e(ti,ti.length):[]}re.prototype.listeners=function(kt){return Oe(this,kt,!0)},re.prototype.rawListeners=function(kt){return Oe(this,kt,!1)},re.listenerCount=function(qe,kt){return typeof qe.listenerCount=="function"?qe.listenerCount(kt):_e.call(qe,kt)},re.prototype.listenerCount=_e;function _e(qe){var kt=this._events;if(kt){var jt=kt[qe];if(typeof jt=="function")return 1;if(jt)return jt.length}return 0}re.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function At(qe,kt){for(var jt=kt,Pt=jt+1,ti=qe.length;Pt<ti;jt+=1,Pt+=1)qe[jt]=qe[Pt];qe.pop()}function $e(qe,kt){for(var jt=new Array(kt),Pt=0;Pt<kt;++Pt)jt[Pt]=qe[Pt];return jt}function Fe(qe){for(var kt=new Array(qe.length),jt=0;jt<kt.length;++jt)kt[jt]=qe[jt].listener||qe[jt];return kt}function Ue(qe){var kt=function(){};return kt.prototype=qe,new kt}function Ve(qe){for(var kt in qe)Object.prototype.hasOwnProperty.call(qe,kt);return kt}function Dt(qe){var kt=this;return function(){return kt.apply(qe,arguments)}}},{}],23:[function(r,g,V){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */V.read=function(k,$,oe,re,Ce){var ie,ae,le=Ce*8-re-1,Ie=(1<<le)-1,ue=Ie>>1,de=-7,Ne=oe?Ce-1:0,he=oe?-1:1,pe=k[$+Ne];for(Ne+=he,ie=pe&(1<<-de)-1,pe>>=-de,de+=le;de>0;ie=ie*256+k[$+Ne],Ne+=he,de-=8);for(ae=ie&(1<<-de)-1,ie>>=-de,de+=re;de>0;ae=ae*256+k[$+Ne],Ne+=he,de-=8);if(ie===0)ie=1-ue;else{if(ie===Ie)return ae?NaN:(pe?-1:1)*(1/0);ae=ae+Math.pow(2,re),ie=ie-ue}return(pe?-1:1)*ae*Math.pow(2,ie-re)},V.write=function(k,$,oe,re,Ce,ie){var ae,le,Ie,ue=ie*8-Ce-1,de=(1<<ue)-1,Ne=de>>1,he=Ce===23?Math.pow(2,-24)-Math.pow(2,-77):0,pe=re?0:ie-1,ze=re?1:-1,xe=$<0||$===0&&1/$<0?1:0;for($=Math.abs($),isNaN($)||$===1/0?(le=isNaN($)?1:0,ae=de):(ae=Math.floor(Math.log($)/Math.LN2),$*(Ie=Math.pow(2,-ae))<1&&(ae--,Ie*=2),ae+Ne>=1?$+=he/Ie:$+=he*Math.pow(2,1-Ne),$*Ie>=2&&(ae++,Ie/=2),ae+Ne>=de?(le=0,ae=de):ae+Ne>=1?(le=($*Ie-1)*Math.pow(2,Ce),ae=ae+Ne):(le=$*Math.pow(2,Ne-1)*Math.pow(2,Ce),ae=0));Ce>=8;k[oe+pe]=le&255,pe+=ze,le/=256,Ce-=8);for(ae=ae<<Ce|le,ue+=Ce;ue>0;k[oe+pe]=ae&255,pe+=ze,ae/=256,ue-=8);k[oe+pe-ze]|=xe*128}},{}],24:[function(r,g,V){typeof Object.create=="function"?g.exports=function($,oe){oe&&($.super_=oe,$.prototype=Object.create(oe.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}}))}:g.exports=function($,oe){if(oe){$.super_=oe;var re=function(){};re.prototype=oe.prototype,$.prototype=new re,$.prototype.constructor=$}}},{}],25:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=function(){function $(oe,re){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=oe,this.value=re}return $.prototype.rotateLeft=function(){var oe=this.parent,re=this.brother,Ce=this.leftChild,ie=this.rightChild;if(!ie)throw new Error("unknown error");var ae=ie.leftChild,le=ie.rightChild;return oe&&(oe.leftChild===this?oe.leftChild=ie:oe.rightChild===this&&(oe.rightChild=ie)),ie.parent=oe,ie.brother=re,ie.leftChild=this,ie.rightChild=le,re&&(re.brother=ie),this.parent=ie,this.brother=le,this.leftChild=Ce,this.rightChild=ae,le&&(le.parent=ie,le.brother=this),Ce&&(Ce.parent=this,Ce.brother=ae),ae&&(ae.parent=this,ae.brother=Ce),ie},$.prototype.rotateRight=function(){var oe=this.parent,re=this.brother,Ce=this.leftChild;if(!Ce)throw new Error("unknown error");var ie=this.rightChild,ae=Ce.leftChild,le=Ce.rightChild;return oe&&(oe.leftChild===this?oe.leftChild=Ce:oe.rightChild===this&&(oe.rightChild=Ce)),Ce.parent=oe,Ce.brother=re,Ce.leftChild=ae,Ce.rightChild=this,re&&(re.brother=Ce),ae&&(ae.parent=Ce,ae.brother=this),this.parent=Ce,this.brother=ae,this.leftChild=le,this.rightChild=ie,le&&(le.parent=this,le.brother=ie),ie&&(ie.parent=this,ie.brother=le),Ce},$.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},$.TreeNodeColorType={red:!0,black:!1},$}();Object.freeze(k),V.default=k},{}],26:[function(r,g,V){var k=this&&this.__generator||function(oe,re){var Ce={label:0,sent:function(){if(le[0]&1)throw le[1];return le[1]},trys:[],ops:[]},ie,ae,le,Ie;return Ie={next:ue(0),throw:ue(1),return:ue(2)},typeof Symbol=="function"&&(Ie[Symbol.iterator]=function(){return this}),Ie;function ue(Ne){return function(he){return de([Ne,he])}}function de(Ne){if(ie)throw new TypeError("Generator is already executing.");for(;Ce;)try{if(ie=1,ae&&(le=Ne[0]&2?ae.return:Ne[0]?ae.throw||((le=ae.return)&&le.call(ae),0):ae.next)&&!(le=le.call(ae,Ne[1])).done)return le;switch(ae=0,le&&(Ne=[Ne[0]&2,le.value]),Ne[0]){case 0:case 1:le=Ne;break;case 4:return Ce.label++,{value:Ne[1],done:!1};case 5:Ce.label++,ae=Ne[1],Ne=[0];continue;case 7:Ne=Ce.ops.pop(),Ce.trys.pop();continue;default:if(le=Ce.trys,!(le=le.length>0&&le[le.length-1])&&(Ne[0]===6||Ne[0]===2)){Ce=0;continue}if(Ne[0]===3&&(!le||Ne[1]>le[0]&&Ne[1]<le[3])){Ce.label=Ne[1];break}if(Ne[0]===6&&Ce.label<le[1]){Ce.label=le[1],le=Ne;break}if(le&&Ce.label<le[2]){Ce.label=le[2],Ce.ops.push(Ne);break}le[2]&&Ce.ops.pop(),Ce.trys.pop();continue}Ne=re.call(oe,Ce)}catch(he){Ne=[6,he],ae=0}finally{ie=le=0}if(Ne[0]&5)throw Ne[1];return{value:Ne[0]?Ne[1]:void 0,done:!0}}};Object.defineProperty(V,"__esModule",{value:!0}),$.sigma=3,$.bucketSize=5e3;function $(oe){var re=this;oe===void 0&&(oe=[]);var Ce=[],ie=0,ae=0,le=0,Ie=0,ue=0,de=0;this.size=function(){return de},this.empty=function(){return de===0},this.clear=function(){ie=le=ae=Ie=ue=de=0,he.call(this,$.bucketSize),de=0},this.front=function(){return Ce[ie][ae]},this.back=function(){return Ce[le][Ie]},this.forEach=function(pe){if(!this.empty()){var ze=0;if(ie===le){for(var xe=ae;xe<=Ie;++xe)pe(Ce[ie][xe],ze++);return}for(var xe=ae;xe<$.bucketSize;++xe)pe(Ce[ie][xe],ze++);for(var xe=ie+1;xe<le;++xe)for(var Oe=0;Oe<$.bucketSize;++Oe)pe(Ce[xe][Oe],ze++);for(var xe=0;xe<=Ie;++xe)pe(Ce[le][xe],ze++)}};var Ne=function(pe){var ze=ie*$.bucketSize+ae,xe=ze+pe,Oe=le*$.bucketSize+Ie;if(xe<ze||xe>Oe)throw new Error("pos should more than 0 and less than queue's size");var _e=Math.floor(xe/$.bucketSize),At=xe%$.bucketSize;return{curNodeBucketIndex:_e,curNodePointerIndex:At}};this.getElementByPos=function(pe){var ze=Ne(pe),xe=ze.curNodeBucketIndex,Oe=ze.curNodePointerIndex;return Ce[xe][Oe]},this.eraseElementByPos=function(pe){var ze=this;if(pe<0||pe>de)throw new Error("pos should more than 0 and less than queue's size");if(pe===0)this.popFront();else if(pe===this.size())this.popBack();else{for(var xe=[],Oe=pe+1;Oe<de;++Oe)xe.push(this.getElementByPos(Oe));this.cut(pe),this.popBack(),xe.forEach(function(_e){return ze.pushBack(_e)})}},this.eraseElementByValue=function(pe){if(!this.empty()){var ze=[];this.forEach(function(_e){_e!==pe&&ze.push(_e)});for(var xe=ze.length,Oe=0;Oe<xe;++Oe)this.setElementByPos(Oe,ze[Oe]);this.cut(xe-1)}};var he=function(pe){for(var ze=[],xe=pe*$.sigma,Oe=Math.max(Math.ceil(xe/$.bucketSize),2),_e=0;_e<Oe;++_e)ze.push(new Array($.bucketSize));var At=Math.ceil(pe/$.bucketSize),$e=Math.floor(Oe/2)-Math.floor(At/2),Fe=$e,Ue=0;if(this.size())for(var _e=0;_e<At;++_e){for(var Ve=0;Ve<$.bucketSize;++Ve)if(ze[$e+_e][Ve]=this.front(),this.popFront(),this.empty()){Fe=$e+_e,Ue=Ve;break}if(this.empty())break}Ce=ze,ie=$e,ae=0,le=Fe,Ie=Ue,ue=Oe,de=pe};this.pushBack=function(pe){this.empty()||(le===ue-1&&Ie===$.bucketSize-1&&he.call(this,this.size()),Ie<$.bucketSize-1?++Ie:le<ue-1&&(++le,Ie=0)),++de,Ce[le][Ie]=pe},this.popBack=function(){this.empty()||(this.size()!==1&&(Ie>0?--Ie:ie<le&&(--le,Ie=$.bucketSize-1)),de>0&&--de)},this.setElementByPos=function(pe,ze){var xe=Ne(pe),Oe=xe.curNodeBucketIndex,_e=xe.curNodePointerIndex;Ce[Oe][_e]=ze},this.insert=function(pe,ze,xe){var Oe=this;if(xe===void 0&&(xe=1),pe===0)for(;xe--;)this.pushFront(ze);else if(pe===this.size())for(;xe--;)this.pushBack(ze);else{for(var _e=[],At=pe;At<de;++At)_e.push(this.getElementByPos(At));this.cut(pe-1);for(var At=0;At<xe;++At)this.pushBack(ze);_e.forEach(function($e){return Oe.pushBack($e)})}},this.find=function(pe){if(ie===le){for(var ze=ae;ze<=Ie;++ze)if(Ce[ie][ze]===pe)return!0;return!1}for(var ze=ae;ze<$.bucketSize;++ze)if(Ce[ie][ze]===pe)return!0;for(var ze=ie+1;ze<le;++ze)for(var xe=0;xe<$.bucketSize;++xe)if(Ce[ze][xe]===pe)return!0;for(var ze=0;ze<=Ie;++ze)if(Ce[le][ze]===pe)return!0;return!1},this.reverse=function(){for(var pe=0,ze=de-1;pe<ze;){var xe=this.getElementByPos(pe);this.setElementByPos(pe,this.getElementByPos(ze)),this.setElementByPos(ze,xe),++pe,--ze}},this.unique=function(){if(!this.empty()){var pe=[],ze=this.front();this.forEach(function(Oe,_e){(_e===0||Oe!==ze)&&(pe.push(Oe),ze=Oe)});for(var xe=0;xe<de;++xe)this.setElementByPos(xe,pe[xe]);this.cut(pe.length-1)}},this.sort=function(pe){var ze=[];this.forEach(function(Oe){ze.push(Oe)}),ze.sort(pe);for(var xe=0;xe<de;++xe)this.setElementByPos(xe,ze[xe])},this.pushFront=function(pe){this.empty()||(ie===0&&ae===0&&he.call(this,this.size()),ae>0?--ae:ie>0&&(--ie,ae=$.bucketSize-1)),++de,Ce[ie][ae]=pe},this.popFront=function(){this.empty()||(this.size()!==1&&(ae<$.bucketSize-1?++ae:ie<le&&(++ie,ae=0)),de>0&&--de)},this.shrinkToFit=function(){var pe=this,ze=[];this.forEach(function(At){ze.push(At)});var xe=ze.length;Ce=[];for(var Oe=Math.ceil(xe/$.bucketSize),_e=0;_e<Oe;++_e)Ce.push(new Array($.bucketSize));this.clear(),ze.forEach(function(At){return pe.pushBack(At)})},this.cut=function(pe){if(pe<0){this.clear();return}var ze=Ne(pe),xe=ze.curNodeBucketIndex,Oe=ze.curNodePointerIndex;le=xe,Ie=Oe,de=pe+1},this[Symbol.iterator]=function(){return function(){var ze,ze,ze,pe,ze;return k(this,function(xe){switch(xe.label){case 0:if(de===0)return[2];if(ie!==le)return[3,5];ze=ae,xe.label=1;case 1:return ze<=Ie?[4,Ce[ie][ze]]:[3,4];case 2:xe.sent(),xe.label=3;case 3:return++ze,[3,1];case 4:return[2];case 5:ze=ae,xe.label=6;case 6:return ze<$.bucketSize?[4,Ce[ie][ze]]:[3,9];case 7:xe.sent(),xe.label=8;case 8:return++ze,[3,6];case 9:ze=ie+1,xe.label=10;case 10:if(!(ze<le))return[3,15];pe=0,xe.label=11;case 11:return pe<$.bucketSize?[4,Ce[ze][pe]]:[3,14];case 12:xe.sent(),xe.label=13;case 13:return++pe,[3,11];case 14:return++ze,[3,10];case 15:ze=0,xe.label=16;case 16:return ze<=Ie?[4,Ce[le][ze]]:[3,19];case 17:xe.sent(),xe.label=18;case 18:return++ze,[3,16];case 19:return[2]}})}()},function(){var pe=$.bucketSize;oe.size?pe=oe.size():oe.length&&(pe=oe.length);var ze=pe*$.sigma;ue=Math.ceil(ze/$.bucketSize),ue=Math.max(ue,3);for(var xe=0;xe<ue;++xe)Ce.push(new Array($.bucketSize));var Oe=Math.ceil(pe/$.bucketSize);ie=Math.floor(ue/2)-Math.floor(Oe/2),le=ie,oe.forEach(function(_e){return re.pushBack(_e)})}(),Object.freeze(this)}Object.freeze($),V.default=$},{}],27:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../LinkList/LinkList"),re=r("../Map/Map");Ce.initSize=16,Ce.maxSize=1<<30,Ce.sigma=.75,Ce.treeifyThreshold=8,Ce.untreeifyThreshold=6,Ce.minTreeifySize=64;function Ce(ie,ae,le){var Ie=this;if(ie===void 0&&(ie=[]),ae===void 0&&(ae=Ce.initSize),le=le||function(pe){var ze,xe,Oe=0,_e="";if(typeof pe=="number")Oe=Math.floor(pe),Oe=(Oe<<5)-Oe,Oe=Oe&Oe;else{typeof pe!="string"?_e=JSON.stringify(pe):_e=pe;try{for(var At=$(_e),$e=At.next();!$e.done;$e=At.next()){var Fe=$e.value,Ue=Fe.charCodeAt(0);Oe=(Oe<<5)-Oe+Ue,Oe=Oe&Oe}}catch(Ve){ze={error:Ve}}finally{try{$e&&!$e.done&&(xe=At.return)&&xe.call(At)}finally{if(ze)throw ze.error}}}return Oe^=Oe>>>16,Oe},ae&ae-1)throw new Error("initBucketNum must be 2 to the power of n");var ue=0,de=[],Ne=Math.max(Ce.initSize,Math.min(Ce.maxSize,ae));this.size=function(){return ue},this.empty=function(){return ue===0},this.clear=function(){ue=0,Ne=ae,de=[]},this.forEach=function(pe){var ze=0;de.forEach(function(xe){xe.forEach(function(Oe){pe(Oe,ze++)})})};var he=function(pe){if(!(pe>=Ce.maxSize)){Ne=pe*2;var ze=[];de.forEach(function(xe,Oe){if(!xe.empty()){if(xe instanceof oe.default&&xe.size()===1){var _e=xe.front(),At=_e.key,$e=_e.value;ze[le(At)&Ne-1]=new oe.default([{key:At,value:$e}])}else if(xe instanceof re.default){var Fe=new oe.default,Ue=new oe.default;xe.forEach(function(qe){var kt=le(qe.key);kt&pe?Ue.pushBack(qe):Fe.pushBack(qe)}),Fe.size()>Ce.untreeifyThreshold?ze[Oe]=new re.default(Fe):Fe.size()&&(ze[Oe]=Fe),Ue.size()>Ce.untreeifyThreshold?ze[Oe+pe]=new re.default(Ue):Ue.size()&&(ze[Oe+pe]=Ue)}else{var Ve=new oe.default,Dt=new oe.default;xe.forEach(function(qe){var kt=le(qe.key);kt&pe?Dt.pushBack(qe):Ve.pushBack(qe)}),Ve.size()&&(ze[Oe]=Ve),Dt.size()&&(ze[Oe+pe]=Dt)}de[Oe].clear()}}),de=ze}};this.setElement=function(pe,ze){var xe,Oe;if(pe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(ze==null){this.eraseElementByKey(pe);return}var _e=le(pe)&Ne-1;if(!de[_e])++ue,de[_e]=new oe.default([{key:pe,value:ze}]);else{var At=de[_e].size();if(de[_e]instanceof oe.default){try{for(var $e=$(de[_e]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(Ue.key===pe){Ue.value=ze;return}}}catch(Dt){xe={error:Dt}}finally{try{Fe&&!Fe.done&&(Oe=$e.return)&&Oe.call($e)}finally{if(xe)throw xe.error}}de[_e].pushBack({key:pe,value:ze}),de[_e].size()>=Ce.treeifyThreshold&&(de[_e]=new re.default(de[_e]))}else de[_e].setElement(pe,ze);var Ve=de[_e].size();ue+=Ve-At}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.getElementByKey=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(de[Oe]){if(de[Oe]instanceof re.default)return de[Oe].getElementByKey(pe);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===pe)return $e.value}}catch(Fe){ze={error:Fe}}finally{try{At&&!At.done&&(xe=_e.return)&&xe.call(_e)}finally{if(ze)throw ze.error}}}},this.eraseElementByKey=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(de[Oe]){var _e=de[Oe].size();if(de[Oe]instanceof re.default)de[Oe].eraseElementByKey(pe),de[Oe].size()<=Ce.untreeifyThreshold&&(de[Oe]=new oe.default(de[Oe]));else{var At=-1;try{for(var $e=$(de[Oe]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(++At,Ue.key===pe){de[Oe].eraseElementByPos(At);break}}}catch(Dt){ze={error:Dt}}finally{try{Fe&&!Fe.done&&(xe=$e.return)&&xe.call($e)}finally{if(ze)throw ze.error}}}var Ve=de[Oe].size();ue+=Ve-_e}},this.find=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(!de[Oe])return!1;if(de[Oe]instanceof re.default)return de[Oe].find(pe);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===pe)return!0}}catch(Fe){ze={error:Fe}}finally{try{At&&!At.done&&(xe=_e.return)&&xe.call(_e)}finally{if(ze)throw ze.error}}return!1},this[Symbol.iterator]=function(){return function(){var pe,ze,xe,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:pe=0,Fe.label=1;case 1:if(!(pe<Ne))return[3,10];for(;pe<Ne&&!de[pe];)++pe;if(pe>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),ze=(At=void 0,$(de[pe])),xe=ze.next(),Fe.label=3;case 3:return xe.done?[3,6]:(Oe=xe.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return xe=ze.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{xe&&!xe.done&&($e=ze.return)&&$e.call(ze)}finally{if(At)throw At.error}return[7];case 9:return++pe,[3,1];case 10:return[2]}})}()},ie.forEach(function(pe){var ze=pe.key,xe=pe.value;return Ie.setElement(ze,xe)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Set/Set"),re=r("../LinkList/LinkList");Ce.initSize=16,Ce.maxSize=1<<30,Ce.sigma=.75,Ce.treeifyThreshold=8,Ce.untreeifyThreshold=6,Ce.minTreeifySize=64;function Ce(ie,ae,le){var Ie=this;if(ie===void 0&&(ie=[]),ae===void 0&&(ae=Ce.initSize),le=le||function(pe){var ze=0,xe="";if(typeof pe=="number")ze=Math.floor(pe),ze=(ze<<5)-ze,ze=ze&ze;else{typeof pe!="string"?xe=JSON.stringify(pe):xe=pe;for(var Oe=0;Oe<xe.length;Oe++){var _e=xe.charCodeAt(Oe);ze=(ze<<5)-ze+_e,ze=ze&ze}}return ze^=ze>>>16,ze},ae&ae-1)throw new Error("initBucketNum must be 2 to the power of n");var ue=0,de=[],Ne=Math.max(Ce.initSize,Math.min(Ce.maxSize,ae));this.size=function(){return ue},this.empty=function(){return ue===0},this.clear=function(){ue=0,Ne=ae,de=[]},this.forEach=function(pe){var ze=0;de.forEach(function(xe){xe.forEach(function(Oe){pe(Oe,ze++)})})};var he=function(pe){if(!(pe>=Ce.maxSize)){Ne=pe*2;var ze=[];de.forEach(function(xe,Oe){if(!xe.empty()){if(xe instanceof re.default&&xe.size()===1){var _e=xe.front();if(_e===void 0)throw new Error("unknown error");ze[le(_e)&Ne-1]=new re.default([_e])}else if(xe instanceof oe.default){var At=new re.default,$e=new re.default;xe.forEach(function(Ve){var Dt=le(Ve);Dt&pe?$e.pushBack(Ve):At.pushBack(Ve)}),At.size()>Ce.untreeifyThreshold?ze[Oe]=new oe.default(At):At.size()&&(ze[Oe]=At),$e.size()>Ce.untreeifyThreshold?ze[Oe+pe]=new oe.default($e):$e.size()&&(ze[Oe+pe]=$e)}else{var Fe=new re.default,Ue=new re.default;xe.forEach(function(Ve){var Dt=le(Ve);Dt&pe?Ue.pushBack(Ve):Fe.pushBack(Ve)}),Fe.size()&&(ze[Oe]=Fe),Ue.size()&&(ze[Oe+pe]=Ue)}de[Oe].clear()}}),de=ze}};this.insert=function(pe){if(pe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var ze=le(pe)&Ne-1;if(!de[ze])de[ze]=new re.default([pe]),++ue;else{var xe=de[ze].size();if(de[ze]instanceof re.default){if(de[ze].find(pe))return;de[ze].pushBack(pe),de[ze].size()>=Ce.treeifyThreshold&&(de[ze]=new oe.default(de[ze]))}else de[ze].insert(pe);var Oe=de[ze].size();ue+=Oe-xe}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.eraseElementByValue=function(pe){var ze=le(pe)&Ne-1;if(de[ze]){var xe=de[ze].size();de[ze].eraseElementByValue(pe),de[ze]instanceof oe.default&&de[ze].size()<=Ce.untreeifyThreshold&&(de[ze]=new re.default(de[ze]));var Oe=de[ze].size();ue+=Oe-xe}},this.find=function(pe){var ze=le(pe)&Ne-1;return de[ze]?de[ze].find(pe):!1},this[Symbol.iterator]=function(){return function(){var pe,ze,xe,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:pe=0,Fe.label=1;case 1:if(!(pe<Ne))return[3,10];for(;pe<Ne&&!de[pe];)++pe;if(pe>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),ze=(At=void 0,$(de[pe])),xe=ze.next(),Fe.label=3;case 3:return xe.done?[3,6]:(Oe=xe.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return xe=ze.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{xe&&!xe.done&&($e=ze.return)&&$e.call(ze)}finally{if(At)throw At.error}return[7];case 9:return++pe,[3,1];case 10:return[2]}})}()},ie.forEach(function(pe){return Ie.insert(pe)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(r,g,V){var k=this&&this.__generator||function(re,Ce){var ie={label:0,sent:function(){if(Ie[0]&1)throw Ie[1];return Ie[1]},trys:[],ops:[]},ae,le,Ie,ue;return ue={next:de(0),throw:de(1),return:de(2)},typeof Symbol=="function"&&(ue[Symbol.iterator]=function(){return this}),ue;function de(he){return function(pe){return Ne([he,pe])}}function Ne(he){if(ae)throw new TypeError("Generator is already executing.");for(;ie;)try{if(ae=1,le&&(Ie=he[0]&2?le.return:he[0]?le.throw||((Ie=le.return)&&Ie.call(le),0):le.next)&&!(Ie=Ie.call(le,he[1])).done)return Ie;switch(le=0,Ie&&(he=[he[0]&2,Ie.value]),he[0]){case 0:case 1:Ie=he;break;case 4:return ie.label++,{value:he[1],done:!1};case 5:ie.label++,le=he[1],he=[0];continue;case 7:he=ie.ops.pop(),ie.trys.pop();continue;default:if(Ie=ie.trys,!(Ie=Ie.length>0&&Ie[Ie.length-1])&&(he[0]===6||he[0]===2)){ie=0;continue}if(he[0]===3&&(!Ie||he[1]>Ie[0]&&he[1]<Ie[3])){ie.label=he[1];break}if(he[0]===6&&ie.label<Ie[1]){ie.label=Ie[1],Ie=he;break}if(Ie&&ie.label<Ie[2]){ie.label=Ie[2],ie.ops.push(he);break}Ie[2]&&ie.ops.pop(),ie.trys.pop();continue}he=Ce.call(re,ie)}catch(pe){he=[6,pe],le=0}finally{ae=Ie=0}if(he[0]&5)throw he[1];return{value:he[0]?he[1]:void 0,done:!0}}};Object.defineProperty(V,"__esModule",{value:!0});var $=function(){function re(Ce){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=Ce}return re}();function oe(re){var Ce=this;re===void 0&&(re=[]);var ie=0,ae=void 0,le=void 0;this.size=function(){return ie},this.empty=function(){return ie===0},this.clear=function(){ae=le=void 0,ie=0},this.front=function(){return ae==null?void 0:ae.value},this.back=function(){return le==null?void 0:le.value},this.forEach=function(Ie){for(var ue=ae,de=0;ue;){if(ue.value===void 0)throw new Error("unknown error");Ie(ue.value,de++),ue=ue.next}},this.getElementByPos=function(Ie){if(Ie<0||Ie>=ie)throw new Error("pos must more then 0 and less then the list length");for(var ue=ae;Ie--&&ue;)ue=ue.next;if(!ue||ue.value===void 0)throw new Error("unknown error");return ue.value},this.eraseElementByPos=function(Ie){if(Ie<0||Ie>=ie)throw new Error("erase pos must more then 0 and less then the list length");if(Ie===0)this.popFront();else if(Ie===ie-1)this.popBack();else{for(var ue=ae;Ie--;){if(!(ue!=null&&ue.next))throw new Error("unknown error");ue=ue.next}if(!ue||!ue.pre||!ue.next)throw new Error("unknown error");var de=ue.pre,Ne=ue.next;Ne.pre=de,de.next=Ne,ie>0&&--ie}},this.eraseElementByValue=function(Ie){for(;ae&&ae.value===Ie;)this.popFront();for(;le&&le.value===Ie;)this.popBack();if(ae)for(var ue=ae;ue;){if(ue.value===Ie){var de=ue.pre,Ne=ue.next;Ne&&(Ne.pre=de),de&&(de.next=Ne),ie>0&&--ie}ue=ue.next}},this.pushBack=function(Ie){if(Ie==null)throw new Error("you can't push null or undefined here");++ie;var ue=new $(Ie);le?(le.next=ue,ue.pre=le,le=ue):ae=le=ue},this.popBack=function(){le&&(ie>0&&--ie,le&&(ae===le?ae=le=void 0:(le=le.pre,le&&(le.next=void 0))))},this.setElementByPos=function(Ie,ue){if(ue==null)throw new Error("you can't set null or undefined here");if(Ie<0||Ie>=ie)throw new Error("pos must more then 0 and less then the list length");for(var de=ae;Ie--;){if(!de)throw new Error("unknown error");de=de.next}de&&(de.value=ue)},this.insert=function(Ie,ue,de){if(de===void 0&&(de=1),ue==null)throw new Error("you can't insert null or undefined here");if(Ie<0||Ie>ie)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(de<0)throw new Error("insert size must more than 0");if(Ie===0)for(;de--;)this.pushFront(ue);else if(Ie===ie)for(;de--;)this.pushBack(ue);else{for(var Ne=ae,he=1;he<Ie;++he){if(!(Ne!=null&&Ne.next))throw new Error("unknown error");Ne=Ne==null?void 0:Ne.next}if(!Ne)throw new Error("unknown error");var pe=Ne.next;for(ie+=de;de--;)Ne.next=new $(ue),Ne.next.pre=Ne,Ne=Ne.next;Ne.next=pe,pe&&(pe.pre=Ne)}},this.find=function(Ie){for(var ue=ae;ue;){if(ue.value===Ie)return!0;ue=ue.next}return!1},this.reverse=function(){for(var Ie=ae,ue=le,de=0;Ie&&ue&&de*2<ie;){var Ne=Ie.value;Ie.value=ue.value,ue.value=Ne,Ie=Ie.next,ue=ue.pre,++de}},this.unique=function(){for(var Ie=ae;Ie;){for(var ue=Ie;ue&&ue.next&&ue.value===ue.next.value;)ue=ue.next,ie>0&&--ie;Ie.next=ue.next,Ie.next&&(Ie.next.pre=Ie),Ie=Ie.next}},this.sort=function(Ie){var ue=[];this.forEach(function(Ne){ue.push(Ne)}),ue.sort(Ie);var de=ae;ue.forEach(function(Ne){de&&(de.value=Ne,de=de.next)})},this.pushFront=function(Ie){if(Ie==null)throw new Error("you can't push null or undefined here");++ie;var ue=new $(Ie);ae?(ue.next=ae,ae.pre=ue,ae=ue):ae=le=ue},this.popFront=function(){ae&&(ie>0&&--ie,ae&&(ae===le?ae=le=void 0:(ae=ae.next,ae&&(ae.pre=void 0))))},this.merge=function(Ie){var ue=this,de=ae;Ie.forEach(function(Ne){for(;de&&de.value!==void 0&&de.value<=Ne;)de=de.next;if(de===void 0)ue.pushBack(Ne),de=le;else if(de===ae)ue.pushFront(Ne),de=ae;else{++ie;var he=de.pre;he&&(he.next=new $(Ne),he.next.pre=he,he.next.next=de,de&&(de.pre=he.next))}})},this[Symbol.iterator]=function(){return function(){var Ie;return k(this,function(ue){switch(ue.label){case 0:Ie=ae,ue.label=1;case 1:if(Ie===void 0)return[3,3];if(!Ie.value)throw new Error("unknown error");return[4,Ie.value];case 2:return ue.sent(),Ie=Ie.next,[3,1];case 3:return[2]}})}()},re.forEach(function(Ie){return Ce.pushBack(Ie)}),Object.freeze(this)}Object.freeze(oe),V.default=oe},{}],30:[function(r,g,V){var k=this&&this.__generator||function(Ce,ie){var ae={label:0,sent:function(){if(ue[0]&1)throw ue[1];return ue[1]},trys:[],ops:[]},le,Ie,ue,de;return de={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(de[Symbol.iterator]=function(){return this}),de;function Ne(pe){return function(ze){return he([pe,ze])}}function he(pe){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=pe[0]&2?Ie.return:pe[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,pe[1])).done)return ue;switch(Ie=0,ue&&(pe=[pe[0]&2,ue.value]),pe[0]){case 0:case 1:ue=pe;break;case 4:return ae.label++,{value:pe[1],done:!1};case 5:ae.label++,Ie=pe[1],pe=[0];continue;case 7:pe=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(pe[0]===6||pe[0]===2)){ae=0;continue}if(pe[0]===3&&(!ue||pe[1]>ue[0]&&pe[1]<ue[3])){ae.label=pe[1];break}if(pe[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=pe;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(pe);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}pe=ie.call(Ce,ae)}catch(ze){pe=[6,ze],Ie=0}finally{le=ue=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__values||function(Ce){var ie=typeof Symbol=="function"&&Symbol.iterator,ae=ie&&Ce[ie],le=0;if(ae)return ae.call(Ce);if(Ce&&typeof Ce.length=="number")return{next:function(){return Ce&&le>=Ce.length&&(Ce=void 0),{value:Ce&&Ce[le++],done:!Ce}}};throw new TypeError(ie?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(Ve,Dt){return Ve<Dt?-1:Ve>Dt?1:0};var le=0,Ie=new oe.default;Ie.color=oe.default.TreeNodeColorType.black,this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.key=Ie.value=void 0,Ie.leftChild=Ie.rightChild=Ie.brother=void 0};var ue=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.leftChild?ue(Ve.leftChild):Ve},de=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.rightChild?de(Ve.rightChild):Ve};this.front=function(){if(!this.empty()){var Ve=ue(Ie);if(Ve.key===void 0||Ve.value===void 0)throw new Error("unknown error");return{key:Ve.key,value:Ve.value}}},this.back=function(){if(!this.empty()){var Ve=de(Ie);if(Ve.key===void 0||Ve.value===void 0)throw new Error("unknown error");return{key:Ve.key,value:Ve.value}}},this.forEach=function(Ve){var Dt,qe,kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;Ve(ti,kt++)}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(Ve){var Dt,qe;if(Ve<0||Ve>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;if(kt===Ve)return ti;++kt}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}throw new Error("unknown Error")};var Ne=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe===0?{key:Ve.key,value:Ve.value}:qe<0?Ne(Ve.rightChild,Dt):Ne(Ve.leftChild,Dt)||{key:Ve.key,value:Ve.value}}};this.lowerBound=function(Ve){return Ne(Ie,Ve)};var he=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe<=0?he(Ve.rightChild,Dt):he(Ve.leftChild,Dt)||{key:Ve.key,value:Ve.value}}};this.upperBound=function(Ve){return he(Ie,Ve)};var pe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe===0?{key:Ve.key,value:Ve.value}:qe>0?pe(Ve.leftChild,Dt):pe(Ve.rightChild,Dt)||{key:Ve.key,value:Ve.value}}};this.reverseLowerBound=function(Ve){return pe(Ie,Ve)};var ze=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe>=0?ze(Ve.leftChild,Dt):ze(Ve.rightChild,Dt)||{key:Ve.key,value:Ve.value}}};this.reverseUpperBound=function(Ve){return ze(Ie,Ve)};var xe=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Ve.color===oe.default.TreeNodeColorType.red){Ve.color=oe.default.TreeNodeColorType.black;return}var qe=Ve.brother;if(!qe)throw new Error("unknown error");if(Ve===Dt.leftChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),xe(Ve)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ve.color=oe.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),xe(Ve)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,xe(Dt))}else if(Ve===Dt.rightChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),xe(Ve)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ve.color=oe.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),xe(Ve)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,xe(Dt))}},Oe=function(Ve){for(var Dt=Ve;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe;var kt=Ve.value;Ve.value=Dt.value,Dt.value=kt,Ve=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe;var kt=Ve.value;Ve.value=Dt.value,Dt.value=kt,Ve=Dt}}xe(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},_e=function(Ve,Dt){if(!Ve||Ve.key===void 0)return!1;var qe=_e(Ve.leftChild,Dt);return qe||Dt(Ve)?!0:_e(Ve.rightChild,Dt)};this.eraseElementByPos=function(Ve){if(Ve<0||Ve>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;_e(Ie,function(qe){return Ve===Dt?(Oe(qe),!0):(++Dt,!1)})},this.eraseElementByKey=function(Ve){if(!this.empty()){var Dt=Fe(Ie,Ve);Dt===void 0||Dt.key===void 0||ie(Dt.key,Ve)!==0||Oe(Dt)}};var At=function(Ve,Dt){if(!Ve||Ve.key===void 0)throw new Error("unknown error");var qe=ie(Dt,Ve.key);return qe<0?Ve.leftChild?At(Ve.leftChild,Dt):(Ve.leftChild=new oe.default,Ve.leftChild.parent=Ve,Ve.leftChild.brother=Ve.rightChild,Ve.rightChild&&(Ve.rightChild.brother=Ve.leftChild),Ve.leftChild):qe>0?Ve.rightChild?At(Ve.rightChild,Dt):(Ve.rightChild=new oe.default,Ve.rightChild.parent=Ve,Ve.rightChild.brother=Ve.leftChild,Ve.leftChild&&(Ve.leftChild.brother=Ve.rightChild),Ve.rightChild):Ve},$e=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Dt.color!==oe.default.TreeNodeColorType.black&&Dt.color===oe.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===oe.default.TreeNodeColorType.red)qe.color=Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red,$e(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(Ve===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var jt=kt.rotateRight();kt===Ie&&(Ie=jt)}else if(Ve===Dt.rightChild){var jt=Dt.rotateLeft();kt===Ie&&(Ie=jt),$e(Dt)}}else if(Dt===kt.rightChild){if(Ve===Dt.leftChild){var jt=Dt.rotateRight();kt===Ie&&(Ie=jt),$e(Dt)}else if(Ve===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var jt=kt.rotateLeft();kt===Ie&&(Ie=jt)}}}}};this.setElement=function(Ve,Dt){if(Ve==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(Dt==null){this.eraseElementByKey(Ve);return}if(this.empty()){++le,Ie.key=Ve,Ie.value=Dt,Ie.color=oe.default.TreeNodeColorType.black;return}var qe=At(Ie,Ve);if(qe.key!==void 0&&ie(qe.key,Ve)===0){qe.value=Dt;return}++le,qe.key=Ve,qe.value=Dt,$e(qe),Ie.color=oe.default.TreeNodeColorType.black};var Fe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Dt,Ve.key);return qe<0?Fe(Ve.leftChild,Dt):qe>0?Fe(Ve.rightChild,Dt):Ve}};this.find=function(Ve){return!!Fe(Ie,Ve)},this.getElementByKey=function(Ve){var Dt=Fe(Ie,Ve);if((Dt==null?void 0:Dt.key)===void 0||(Dt==null?void 0:Dt.value)===void 0)throw new Error("unknown error");return Dt.value},this.union=function(Ve){var Dt=this;Ve.forEach(function(qe){var kt=qe.key,jt=qe.value;return Dt.setElement(kt,jt)})},this.getHeight=function(){if(this.empty())return 0;var Ve=function(Dt){return Dt?Math.max(Ve(Dt.leftChild),Ve(Dt.rightChild))+1:1};return Ve(Ie)};var Ue=function(Ve){return k(this,function(Dt){switch(Dt.label){case 0:return!Ve||Ve.key===void 0||Ve.value===void 0?[2]:[5,$(Ue(Ve.leftChild))];case 1:return Dt.sent(),[4,{key:Ve.key,value:Ve.value}];case 2:return Dt.sent(),[5,$(Ue(Ve.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(Ve){var Dt=Ve.key,qe=Ve.value;return ae.setElement(Dt,qe)}),Object.freeze(this)}Object.freeze(re),V.default=re},{"../Base/TreeNode":25}],31:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($,oe){$===void 0&&($=[]),oe=oe||function(le,Ie){return le>Ie?-1:le<Ie?1:0};var re=[];$.forEach(function(le){return re.push(le)});var Ce=re.length,ie=function(le,Ie){if(le<0||le>=Ce)throw new Error("unknown error");if(Ie<0||Ie>=Ce)throw new Error("unknown error");var ue=re[le];re[le]=re[Ie],re[Ie]=ue},ae=function(le){if(le<0||le>=Ce)throw new Error("unknown error");var Ie=le*2+1,ue=le*2+2;Ie<Ce&&oe(re[le],re[Ie])>0&&ie(le,Ie),ue<Ce&&oe(re[le],re[ue])>0&&ie(le,ue)};(function(){for(var le=Math.floor((Ce-1)/2);le>=0;--le)for(var Ie=le,ue=Ie*2+1;ue<Ce;){var de=ue,Ne=de+1,he=de;if(Ne<Ce&&oe(re[de],re[Ne])>0&&(he=Ne),oe(re[Ie],re[he])<=0)break;ie(Ie,he),Ie=he,ue=Ie*2+1}})(),this.size=function(){return Ce},this.empty=function(){return Ce===0},this.clear=function(){Ce=0,re.length=0},this.push=function(le){if(re.push(le),++Ce,Ce!==1)for(var Ie=Ce-1;Ie>0;){var ue=Math.floor((Ie-1)/2);if(oe(re[ue],le)<=0)break;ae(ue),Ie=ue}},this.pop=function(){if(!this.empty()){if(this.size()===1){--Ce;return}var le=re[Ce-1];--Ce;for(var Ie=0;Ie<this.size();){var ue=Ie*2+1,de=Ie*2+2;if(ue>=this.size())break;var Ne=ue;if(de<this.size()&&oe(re[ue],re[de])>0&&(Ne=de),oe(re[Ne],le)>=0)break;re[Ie]=re[Ne],Ie=Ne}re[Ie]=le}},this.top=function(){return re[0]},Object.freeze(this)}Object.freeze(k),V.default=k},{}],32:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=r("../LinkList/LinkList");function $(oe){oe===void 0&&(oe=[]);var re=new k.default(oe);this.size=function(){return re.size()},this.empty=function(){return re.empty()},this.clear=function(){re.clear()},this.push=function(Ce){re.pushBack(Ce)},this.pop=function(){re.popFront()},this.front=function(){return re.front()},Object.freeze(this)}Object.freeze($),V.default=$},{"../LinkList/LinkList":29}],33:[function(r,g,V){var k=this&&this.__generator||function(Ce,ie){var ae={label:0,sent:function(){if(ue[0]&1)throw ue[1];return ue[1]},trys:[],ops:[]},le,Ie,ue,de;return de={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(de[Symbol.iterator]=function(){return this}),de;function Ne(pe){return function(ze){return he([pe,ze])}}function he(pe){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=pe[0]&2?Ie.return:pe[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,pe[1])).done)return ue;switch(Ie=0,ue&&(pe=[pe[0]&2,ue.value]),pe[0]){case 0:case 1:ue=pe;break;case 4:return ae.label++,{value:pe[1],done:!1};case 5:ae.label++,Ie=pe[1],pe=[0];continue;case 7:pe=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(pe[0]===6||pe[0]===2)){ae=0;continue}if(pe[0]===3&&(!ue||pe[1]>ue[0]&&pe[1]<ue[3])){ae.label=pe[1];break}if(pe[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=pe;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(pe);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}pe=ie.call(Ce,ae)}catch(ze){pe=[6,ze],Ie=0}finally{le=ue=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__values||function(Ce){var ie=typeof Symbol=="function"&&Symbol.iterator,ae=ie&&Ce[ie],le=0;if(ae)return ae.call(Ce);if(Ce&&typeof Ce.length=="number")return{next:function(){return Ce&&le>=Ce.length&&(Ce=void 0),{value:Ce&&Ce[le++],done:!Ce}}};throw new TypeError(ie?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(Ve,Dt){return Ve<Dt?-1:Ve>Dt?1:0};var le=0,Ie=new oe.default;Ie.color=oe.default.TreeNodeColorType.black,this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.key=void 0,Ie.leftChild=Ie.rightChild=Ie.brother=Ie.parent=void 0,Ie.color=oe.default.TreeNodeColorType.black};var ue=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.leftChild?ue(Ve.leftChild):Ve},de=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.rightChild?de(Ve.rightChild):Ve};this.front=function(){if(!this.empty()){var Ve=ue(Ie);return Ve.key}},this.back=function(){if(!this.empty()){var Ve=de(Ie);return Ve.key}},this.forEach=function(Ve){var Dt,qe,kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;Ve(ti,kt++)}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(Ve){var Dt,qe;if(Ve<0||Ve>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;if(kt===Ve)return ti;++kt}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}throw new Error("unknown error")};var Ne=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Ve.color===oe.default.TreeNodeColorType.red){Ve.color=oe.default.TreeNodeColorType.black;return}var qe=Ve.brother;if(!qe)throw new Error("unknown error");if(Ve===Dt.leftChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ne(Ve)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ve.color=oe.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),Ne(Ve)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ne(Dt))}else if(Ve===Dt.rightChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ne(Ve)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ve.color=oe.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),Ne(Ve)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ne(Dt))}},he=function(Ve){for(var Dt=Ve;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe,Ve=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe,Ve=Dt}}Ne(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},pe=function(Ve,Dt){if(!Ve||Ve.key===void 0)return!1;var qe=pe(Ve.leftChild,Dt);return qe||Dt(Ve)?!0:pe(Ve.rightChild,Dt)};this.eraseElementByPos=function(Ve){if(Ve<0||Ve>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;pe(Ie,function(qe){return Ve===Dt?(he(qe),!0):(++Dt,!1)})},this.eraseElementByValue=function(Ve){if(!this.empty()){var Dt=Oe(Ie,Ve);Dt===void 0||Dt.key===void 0||ie(Dt.key,Ve)!==0||he(Dt)}};var ze=function(Ve,Dt){if(!Ve||Ve.key===void 0)throw new Error("unknown error");var qe=ie(Dt,Ve.key);return qe<0?Ve.leftChild?ze(Ve.leftChild,Dt):(Ve.leftChild=new oe.default,Ve.leftChild.parent=Ve,Ve.leftChild.brother=Ve.rightChild,Ve.rightChild&&(Ve.rightChild.brother=Ve.leftChild),Ve.leftChild):qe>0?Ve.rightChild?ze(Ve.rightChild,Dt):(Ve.rightChild=new oe.default,Ve.rightChild.parent=Ve,Ve.rightChild.brother=Ve.leftChild,Ve.leftChild&&(Ve.leftChild.brother=Ve.rightChild),Ve.rightChild):Ve},xe=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Dt.color!==oe.default.TreeNodeColorType.black&&Dt.color===oe.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===oe.default.TreeNodeColorType.red)qe.color=Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red,xe(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(Ve===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var jt=kt.rotateRight();kt===Ie&&(Ie=jt)}else if(Ve===Dt.rightChild){var jt=Dt.rotateLeft();kt===Ie&&(Ie=jt),xe(Dt)}}else if(Dt===kt.rightChild){if(Ve===Dt.leftChild){var jt=Dt.rotateRight();kt===Ie&&(Ie=jt),xe(Dt)}else if(Ve===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var jt=kt.rotateLeft();kt===Ie&&(Ie=jt)}}}}};this.insert=function(Ve){if(Ve==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty()){++le,Ie.key=Ve,Ie.color=oe.default.TreeNodeColorType.black;return}var Dt=ze(Ie,Ve);Dt.key!==void 0&&ie(Dt.key,Ve)===0||(++le,Dt.key=Ve,xe(Dt),Ie.color=oe.default.TreeNodeColorType.black)};var Oe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Dt,Ve.key);return qe<0?Oe(Ve.leftChild,Dt):qe>0?Oe(Ve.rightChild,Dt):Ve}};this.find=function(Ve){var Dt=Oe(Ie,Ve);return Dt!==void 0&&Dt.key!==void 0&&ie(Dt.key,Ve)===0};var _e=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe===0)return Ve.key;if(qe<0)return _e(Ve.rightChild,Dt);var kt=_e(Ve.leftChild,Dt);return kt!==void 0?kt:Ve.key}};this.lowerBound=function(Ve){return _e(Ie,Ve)};var At=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe<=0)return At(Ve.rightChild,Dt);var kt=At(Ve.leftChild,Dt);return kt!==void 0?kt:Ve.key}};this.upperBound=function(Ve){return At(Ie,Ve)};var $e=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe===0)return Ve.key;if(qe>0)return $e(Ve.leftChild,Dt);var kt=$e(Ve.rightChild,Dt);return kt!==void 0?kt:Ve.key}};this.reverseLowerBound=function(Ve){return $e(Ie,Ve)};var Fe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe>=0)return Fe(Ve.leftChild,Dt);var kt=Fe(Ve.rightChild,Dt);return kt!==void 0?kt:Ve.key}};this.reverseUpperBound=function(Ve){return Fe(Ie,Ve)},this.union=function(Ve){var Dt=this;Ve.forEach(function(qe){return Dt.insert(qe)})},this.getHeight=function(){if(this.empty())return 0;var Ve=function(Dt){return Dt?Math.max(Ve(Dt.leftChild),Ve(Dt.rightChild))+1:1};return Ve(Ie)};var Ue=function(Ve){return k(this,function(Dt){switch(Dt.label){case 0:return!Ve||Ve.key===void 0?[2]:[5,$(Ue(Ve.leftChild))];case 1:return Dt.sent(),[4,Ve.key];case 2:return Dt.sent(),[5,$(Ue(Ve.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(Ve){return ae.insert(Ve)}),Object.freeze(this)}Object.freeze(re),V.default=re},{"../Base/TreeNode":25}],34:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($){var oe=this;$===void 0&&($=[]);var re=0,Ce=[];this.size=function(){return re},this.empty=function(){return re===0},this.clear=function(){re=0,Ce.length=0},this.push=function(ie){Ce.push(ie),++re},this.pop=function(){Ce.pop(),re>0&&--re},this.top=function(){return Ce[re-1]},$.forEach(function(ie){return oe.push(ie)}),Object.freeze(this)}Object.freeze(k),V.default=k},{}],35:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__read||function(ie,ae){var le=typeof Symbol=="function"&&ie[Symbol.iterator];if(!le)return ie;var Ie=le.call(ie),ue,de=[],Ne;try{for(;(ae===void 0||ae-- >0)&&!(ue=Ie.next()).done;)de.push(ue.value)}catch(he){Ne={error:he}}finally{try{ue&&!ue.done&&(le=Ie.return)&&le.call(Ie)}finally{if(Ne)throw Ne.error}}return de},oe=this&&this.__spreadArray||function(ie,ae,le){if(le||arguments.length===2)for(var Ie=0,ue=ae.length,de;Ie<ue;Ie++)(de||!(Ie in ae))&&(de||(de=Array.prototype.slice.call(ae,0,Ie)),de[Ie]=ae[Ie]);return ie.concat(de||Array.prototype.slice.call(ae))},re=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});function Ce(ie){var ae=this;ie===void 0&&(ie=[]);var le=0,Ie=[];this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.length=0},this.front=function(){if(!this.empty())return Ie[0]},this.back=function(){if(!this.empty())return Ie[le-1]},this.forEach=function(ue){Ie.forEach(ue)},this.getElementByPos=function(ue){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");return Ie[ue]},this.eraseElementByPos=function(ue){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");for(var de=ue;de<le-1;++de)Ie[de]=Ie[de+1];this.popBack()},this.eraseElementByValue=function(ue){var de=[];this.forEach(function(he){he!==ue&&de.push(he)}),de.forEach(function(he,pe){Ie[pe]=he});for(var Ne=de.length;le>Ne;)this.popBack()},this.pushBack=function(ue){Ie.push(ue),++le},this.popBack=function(){Ie.pop(),le>0&&--le},this.setElementByPos=function(ue,de){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");Ie[ue]=de},this.insert=function(ue,de,Ne){if(Ne===void 0&&(Ne=1),ue<0||ue>le)throw new Error("pos must more than 0 and less than or equal to vector's size");Ie.splice.apply(Ie,oe([ue,0],$(new Array(Ne).fill(de)),!1)),le+=Ne},this.find=function(ue){return Ie.includes(ue)},this.reverse=function(){Ie.reverse()},this.unique=function(){var ue,de=[];this.forEach(function(he,pe){(pe===0||he!==ue)&&(de.push(he),ue=he)}),de.forEach(function(he,pe){Ie[pe]=he});for(var Ne=de.length;le>Ne;)this.popBack()},this.sort=function(ue){Ie.sort(ue)},this[Symbol.iterator]=function(){return function(){return k(this,function(ue){switch(ue.label){case 0:return[5,re(Ie)];case 1:return[2,ue.sent()]}})}()},ie.forEach(function(ue){return ae.pushBack(ue)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{}],36:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0}),V.HashMap=V.HashSet=V.Map=V.Set=V.PriorityQueue=V.Deque=V.LinkList=V.Queue=V.Stack=V.Vector=void 0;var k=r("./Vector/Vector");V.Vector=k.default;var $=r("./Stack/Stack");V.Stack=$.default;var oe=r("./Queue/Queue");V.Queue=oe.default;var re=r("./LinkList/LinkList");V.LinkList=re.default;var Ce=r("./Deque/Deque");V.Deque=Ce.default;var ie=r("./PriorityQueue/PriorityQueue");V.PriorityQueue=ie.default;var ae=r("./Set/Set");V.Set=ae.default;var le=r("./Map/Map");V.Map=le.default;var Ie=r("./HashSet/HashSet");V.HashSet=Ie.default;var ue=r("./HashMap/HashMap");V.HashMap=ue.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(r,g,V){const k=r("yallist"),$=Symbol("max"),oe=Symbol("length"),re=Symbol("lengthCalculator"),Ce=Symbol("allowStale"),ie=Symbol("maxAge"),ae=Symbol("dispose"),le=Symbol("noDisposeOnSet"),Ie=Symbol("lruList"),ue=Symbol("cache"),de=Symbol("updateAgeOnGet"),Ne=()=>1;class he{constructor(Fe){if(typeof Fe=="number"&&(Fe={max:Fe}),Fe||(Fe={}),Fe.max&&(typeof Fe.max!="number"||Fe.max<0))throw new TypeError("max must be a non-negative number");this[$]=Fe.max||1/0;const Ue=Fe.length||Ne;if(this[re]=typeof Ue!="function"?Ne:Ue,this[Ce]=Fe.stale||!1,Fe.maxAge&&typeof Fe.maxAge!="number")throw new TypeError("maxAge must be a number");this[ie]=Fe.maxAge||0,this[ae]=Fe.dispose,this[le]=Fe.noDisposeOnSet||!1,this[de]=Fe.updateAgeOnGet||!1,this.reset()}set max(Fe){if(typeof Fe!="number"||Fe<0)throw new TypeError("max must be a non-negative number");this[$]=Fe||1/0,xe(this)}get max(){return this[$]}set allowStale(Fe){this[Ce]=!!Fe}get allowStale(){return this[Ce]}set maxAge(Fe){if(typeof Fe!="number")throw new TypeError("maxAge must be a non-negative number");this[ie]=Fe,xe(this)}get maxAge(){return this[ie]}set lengthCalculator(Fe){typeof Fe!="function"&&(Fe=Ne),Fe!==this[re]&&(this[re]=Fe,this[oe]=0,this[Ie].forEach(Ue=>{Ue.length=this[re](Ue.value,Ue.key),this[oe]+=Ue.length})),xe(this)}get lengthCalculator(){return this[re]}get length(){return this[oe]}get itemCount(){return this[Ie].length}rforEach(Fe,Ue){Ue=Ue||this;for(let Ve=this[Ie].tail;Ve!==null;){const Dt=Ve.prev;At(this,Fe,Ve,Ue),Ve=Dt}}forEach(Fe,Ue){Ue=Ue||this;for(let Ve=this[Ie].head;Ve!==null;){const Dt=Ve.next;At(this,Fe,Ve,Ue),Ve=Dt}}keys(){return this[Ie].toArray().map(Fe=>Fe.key)}values(){return this[Ie].toArray().map(Fe=>Fe.value)}reset(){this[ae]&&this[Ie]&&this[Ie].length&&this[Ie].forEach(Fe=>this[ae](Fe.key,Fe.value)),this[ue]=new Map,this[Ie]=new k,this[oe]=0}dump(){return this[Ie].map(Fe=>ze(this,Fe)?!1:{k:Fe.key,v:Fe.value,e:Fe.now+(Fe.maxAge||0)}).toArray().filter(Fe=>Fe)}dumpLru(){return this[Ie]}set(Fe,Ue,Ve){if(Ve=Ve||this[ie],Ve&&typeof Ve!="number")throw new TypeError("maxAge must be a number");const Dt=Ve?Date.now():0,qe=this[re](Ue,Fe);if(this[ue].has(Fe)){if(qe>this[$])return Oe(this,this[ue].get(Fe)),!1;const Pt=this[ue].get(Fe).value;return this[ae]&&(this[le]||this[ae](Fe,Pt.value)),Pt.now=Dt,Pt.maxAge=Ve,Pt.value=Ue,this[oe]+=qe-Pt.length,Pt.length=qe,this.get(Fe),xe(this),!0}const kt=new _e(Fe,Ue,qe,Dt,Ve);return kt.length>this[$]?(this[ae]&&this[ae](Fe,Ue),!1):(this[oe]+=kt.length,this[Ie].unshift(kt),this[ue].set(Fe,this[Ie].head),xe(this),!0)}has(Fe){if(!this[ue].has(Fe))return!1;const Ue=this[ue].get(Fe).value;return!ze(this,Ue)}get(Fe){return pe(this,Fe,!0)}peek(Fe){return pe(this,Fe,!1)}pop(){const Fe=this[Ie].tail;return Fe?(Oe(this,Fe),Fe.value):null}del(Fe){Oe(this,this[ue].get(Fe))}load(Fe){this.reset();const Ue=Date.now();for(let Ve=Fe.length-1;Ve>=0;Ve--){const Dt=Fe[Ve],qe=Dt.e||0;if(qe===0)this.set(Dt.k,Dt.v);else{const kt=qe-Ue;kt>0&&this.set(Dt.k,Dt.v,kt)}}}prune(){this[ue].forEach((Fe,Ue)=>pe(this,Ue,!1))}}const pe=($e,Fe,Ue)=>{const Ve=$e[ue].get(Fe);if(Ve){const Dt=Ve.value;if(ze($e,Dt)){if(Oe($e,Ve),!$e[Ce])return}else Ue&&($e[de]&&(Ve.value.now=Date.now()),$e[Ie].unshiftNode(Ve));return Dt.value}},ze=($e,Fe)=>{if(!Fe||!Fe.maxAge&&!$e[ie])return!1;const Ue=Date.now()-Fe.now;return Fe.maxAge?Ue>Fe.maxAge:$e[ie]&&Ue>$e[ie]},xe=$e=>{if($e[oe]>$e[$])for(let Fe=$e[Ie].tail;$e[oe]>$e[$]&&Fe!==null;){const Ue=Fe.prev;Oe($e,Fe),Fe=Ue}},Oe=($e,Fe)=>{if(Fe){const Ue=Fe.value;$e[ae]&&$e[ae](Ue.key,Ue.value),$e[oe]-=Ue.length,$e[ue].delete(Ue.key),$e[Ie].removeNode(Fe)}};class _e{constructor(Fe,Ue,Ve,Dt,qe){this.key=Fe,this.value=Ue,this.length=Ve,this.now=Dt,this.maxAge=qe||0}}const At=($e,Fe,Ue,Ve)=>{let Dt=Ue.value;ze($e,Dt)&&(Oe($e,Ue),$e[Ce]||(Dt=void 0)),Dt&&Fe.call(Ve,Dt.value,Dt.key,$e)};g.exports=he},{yallist:83}],38:[function(r,g,V){(function(k){(function(){const $=g.exports;$.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"},$.codes={};for(const re in $.types){const Ce=$.types[re];$.codes[Ce]=re}$.CMD_SHIFT=4,$.CMD_MASK=240,$.DUP_MASK=8,$.QOS_MASK=3,$.QOS_SHIFT=1,$.RETAIN_MASK=1,$.VARBYTEINT_MASK=127,$.VARBYTEINT_FIN_MASK=128,$.VARBYTEINT_MAX=268435455,$.SESSIONPRESENT_MASK=1,$.SESSIONPRESENT_HEADER=k.from([$.SESSIONPRESENT_MASK]),$.CONNACK_HEADER=k.from([$.codes.connack<<$.CMD_SHIFT]),$.USERNAME_MASK=128,$.PASSWORD_MASK=64,$.WILL_RETAIN_MASK=32,$.WILL_QOS_MASK=24,$.WILL_QOS_SHIFT=3,$.WILL_FLAG_MASK=4,$.CLEAN_SESSION_MASK=2,$.CONNECT_HEADER=k.from([$.codes.connect<<$.CMD_SHIFT]),$.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},$.propertiesCodes={};for(const re in $.properties){const Ce=$.properties[re];$.propertiesCodes[Ce]=re}$.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"};function oe(re){return[0,1,2].map(Ce=>[0,1].map(ie=>[0,1].map(ae=>{const le=k.alloc(1);return le.writeUInt8($.codes[re]<<$.CMD_SHIFT|(ie?$.DUP_MASK:0)|Ce<<$.QOS_SHIFT|ae,0,!0),le})))}$.PUBLISH_HEADER=oe("publish"),$.SUBSCRIBE_HEADER=oe("subscribe"),$.SUBSCRIBE_OPTIONS_QOS_MASK=3,$.SUBSCRIBE_OPTIONS_NL_MASK=1,$.SUBSCRIBE_OPTIONS_NL_SHIFT=2,$.SUBSCRIBE_OPTIONS_RAP_MASK=1,$.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,$.SUBSCRIBE_OPTIONS_RH_MASK=3,$.SUBSCRIBE_OPTIONS_RH_SHIFT=4,$.SUBSCRIBE_OPTIONS_RH=[0,16,32],$.SUBSCRIBE_OPTIONS_NL=4,$.SUBSCRIBE_OPTIONS_RAP=8,$.SUBSCRIBE_OPTIONS_QOS=[0,1,2],$.UNSUBSCRIBE_HEADER=oe("unsubscribe"),$.ACKS={unsuback:oe("unsuback"),puback:oe("puback"),pubcomp:oe("pubcomp"),pubrel:oe("pubrel"),pubrec:oe("pubrec")},$.SUBACK_HEADER=k.from([$.codes.suback<<$.CMD_SHIFT]),$.VERSION3=k.from([3]),$.VERSION4=k.from([4]),$.VERSION5=k.from([5]),$.VERSION131=k.from([131]),$.VERSION132=k.from([132]),$.QOS=[0,1,2].map(re=>k.from([re])),$.EMPTY={pingreq:k.from([$.codes.pingreq<<4,0]),pingresp:k.from([$.codes.pingresp<<4,0]),disconnect:k.from([$.codes.disconnect<<4,0])}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],39:[function(r,g,V){(function(k){(function(){const $=r("./writeToStream"),oe=r("events");function re(ie,ae){const le=new Ce;return $(ie,le,ae),le.concat()}class Ce extends oe{constructor(){super(),this._array=new Array(20),this._i=0}write(ae){return this._array[this._i++]=ae,!0}concat(){let ae=0;const le=new Array(this._array.length),Ie=this._array;let ue=0,de;for(de=0;de<Ie.length&&Ie[de]!==void 0;de++)typeof Ie[de]!="string"?le[de]=Ie[de].length:le[de]=k.byteLength(Ie[de]),ae+=le[de];const Ne=k.allocUnsafe(ae);for(de=0;de<Ie.length&&Ie[de]!==void 0;de++)typeof Ie[de]!="string"?(Ie[de].copy(Ne,ue),ue+=le[de]):(Ne.write(Ie[de],ue),ue+=le[de]);return Ne}}g.exports=re}).call(this)}).call(this,r("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(r,g,V){V.parser=r("./parser").parser,V.generate=r("./generate"),V.writeToStream=r("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(r,g,V){(function(k){(function(){const oe={},re=k.isBuffer(k.from([1,2]).subarray(0,1));function Ce(Ie){const ue=k.allocUnsafe(2);return ue.writeUInt8(Ie>>8,0),ue.writeUInt8(Ie&255,0+1),ue}function ie(){for(let Ie=0;Ie<65536;Ie++)oe[Ie]=Ce(Ie)}function ae(Ie){let de=0,Ne=0;const he=k.allocUnsafe(4);do de=Ie%128|0,Ie=Ie/128|0,Ie>0&&(de=de|128),he.writeUInt8(de,Ne++);while(Ie>0&&Ne<4);return Ie>0&&(Ne=0),re?he.subarray(0,Ne):he.slice(0,Ne)}function le(Ie){const ue=k.allocUnsafe(4);return ue.writeUInt32BE(Ie,0),ue}g.exports={cache:oe,generateCache:ie,generateNumber:Ce,genBufVariableByteInt:ae,generate4ByteBuffer:le}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],42:[function(r,g,V){class k{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}g.exports=k},{}],43:[function(r,g,V){const k=r("bl"),$=r("events"),oe=r("./packet"),re=r("./constants"),Ce=r("debug")("mqtt-packet:parser");class ie extends ${constructor(){super(),this.parser=this.constructor.parser}static parser(le){return this instanceof ie?(this.settings=le||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new ie().parser(le)}_resetState(){Ce("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new oe,this.error=null,this._list=k(),this._stateCounter=0}parse(le){for(this.error&&this._resetState(),this._list.append(le),Ce("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++,Ce("parse: state complete. _stateCounter is now: %d",this._stateCounter),Ce("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return Ce("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const le=this._list.readUInt8(0);return this.packet.cmd=re.types[le>>re.CMD_SHIFT],this.packet.retain=(le&re.RETAIN_MASK)!==0,this.packet.qos=le>>re.QOS_SHIFT&re.QOS_MASK,this.packet.dup=(le&re.DUP_MASK)!==0,Ce("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const le=this._parseVarByteNum(!0);return le&&(this.packet.length=le.value,this._list.consume(le.bytes)),Ce("_parseLength %d",le.value),!!le}_parsePayload(){Ce("_parsePayload: payload %O",this._list);let le=!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"))}le=!0}return Ce("_parsePayload complete result: %s",le),le}_parseConnect(){Ce("_parseConnect");let le,Ie,ue,de;const Ne={},he=this.packet,pe=this._parseString();if(pe===null)return this._emitError(new Error("Cannot parse protocolId"));if(pe!=="MQTT"&&pe!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(he.protocolId=pe,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(he.protocolVersion=this._list.readUInt8(this._pos),he.protocolVersion>=128&&(he.bridgeMode=!0,he.protocolVersion=he.protocolVersion-128),he.protocolVersion!==3&&he.protocolVersion!==4&&he.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(Ne.username=this._list.readUInt8(this._pos)&re.USERNAME_MASK,Ne.password=this._list.readUInt8(this._pos)&re.PASSWORD_MASK,Ne.will=this._list.readUInt8(this._pos)&re.WILL_FLAG_MASK,Ne.will&&(he.will={},he.will.retain=(this._list.readUInt8(this._pos)&re.WILL_RETAIN_MASK)!==0,he.will.qos=(this._list.readUInt8(this._pos)&re.WILL_QOS_MASK)>>re.WILL_QOS_SHIFT),he.clean=(this._list.readUInt8(this._pos)&re.CLEAN_SESSION_MASK)!==0,this._pos++,he.keepalive=this._parseNum(),he.keepalive===-1)return this._emitError(new Error("Packet too short"));if(he.protocolVersion===5){const xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(he.properties=xe)}const ze=this._parseString();if(ze===null)return this._emitError(new Error("Packet too short"));if(he.clientId=ze,Ce("_parseConnect: packet.clientId: %s",he.clientId),Ne.will){if(he.protocolVersion===5){const xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(he.will.properties=xe)}if(le=this._parseString(),le===null)return this._emitError(new Error("Cannot parse will topic"));if(he.will.topic=le,Ce("_parseConnect: packet.will.topic: %s",he.will.topic),Ie=this._parseBuffer(),Ie===null)return this._emitError(new Error("Cannot parse will payload"));he.will.payload=Ie,Ce("_parseConnect: packet.will.paylaod: %s",he.will.payload)}if(Ne.username){if(de=this._parseString(),de===null)return this._emitError(new Error("Cannot parse username"));he.username=de,Ce("_parseConnect: packet.username: %s",he.username)}if(Ne.password){if(ue=this._parseBuffer(),ue===null)return this._emitError(new Error("Cannot parse password"));he.password=ue}return this.settings=he,Ce("_parseConnect: complete"),he}_parseConnack(){Ce("_parseConnack");const le=this.packet;if(this._list.length<1)return null;if(le.sessionPresent=!!(this._list.readUInt8(this._pos++)&re.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?le.reasonCode=this._list.readUInt8(this._pos++):le.reasonCode=0;else{if(this._list.length<2)return null;le.returnCode=this._list.readUInt8(this._pos++)}if(le.returnCode===-1||le.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}Ce("_parseConnack: complete")}_parsePublish(){Ce("_parsePublish");const le=this.packet;if(le.topic=this._parseString(),le.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(le.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}le.payload=this._list.slice(this._pos,le.length),Ce("_parsePublish: payload from buffer list: %o",le.payload)}}_parseSubscribe(){Ce("_parseSubscribe");const le=this.packet;let Ie,ue,de,Ne,he,pe,ze;if(le.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(le.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(le.properties=xe)}for(;this._pos<le.length;){if(Ie=this._parseString(),Ie===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=le.length)return this._emitError(new Error("Malformed Subscribe Payload"));ue=this._parseByte(),de=ue&re.SUBSCRIBE_OPTIONS_QOS_MASK,pe=(ue>>re.SUBSCRIBE_OPTIONS_NL_SHIFT&re.SUBSCRIBE_OPTIONS_NL_MASK)!==0,he=(ue>>re.SUBSCRIBE_OPTIONS_RAP_SHIFT&re.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,Ne=ue>>re.SUBSCRIBE_OPTIONS_RH_SHIFT&re.SUBSCRIBE_OPTIONS_RH_MASK,ze={topic:Ie,qos:de},this.settings.protocolVersion===5?(ze.nl=pe,ze.rap=he,ze.rh=Ne):this.settings.bridgeMode&&(ze.rh=0,ze.rap=!0,ze.nl=!0),Ce("_parseSubscribe: push subscription `%s` to subscription",ze),le.subscriptions.push(ze)}}}_parseSuback(){Ce("_parseSuback");const le=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){Ce("_parseUnsubscribe");const le=this.packet;if(le.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}for(;this._pos<le.length;){const Ie=this._parseString();if(Ie===null)return this._emitError(new Error("Cannot parse topic"));Ce("_parseUnsubscribe: push topic `%s` to unsubscriptions",Ie),le.unsubscriptions.push(Ie)}}}_parseUnsuback(){Ce("_parseUnsuback");const le=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const Ie=this._parseProperties();for(Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie),le.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){Ce("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const le=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(le.length>2?(le.reasonCode=this._parseByte(),Ce("_parseConfirmation: packet.reasonCode `%d`",le.reasonCode)):le.reasonCode=0,le.length>3)){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}return!0}_parseDisconnect(){const le=this.packet;if(Ce("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?le.reasonCode=this._parseByte():le.reasonCode=0;const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}return Ce("_parseDisconnect result: true"),!0}_parseAuth(){Ce("_parseAuth");const le=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));le.reasonCode=this._parseByte();const Ie=this._parseProperties();return Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie),Ce("_parseAuth: result: true"),!0}_parseMessageId(){const le=this.packet;return le.messageId=this._parseNum(),le.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(Ce("_parseMessageId: packet.messageId %d",le.messageId),!0)}_parseString(le){const Ie=this._parseNum(),ue=Ie+this._pos;if(Ie===-1||ue>this._list.length||ue>this.packet.length)return null;const de=this._list.toString("utf8",this._pos,ue);return this._pos+=Ie,Ce("_parseString: result: %s",de),de}_parseStringPair(){return Ce("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const le=this._parseNum(),Ie=le+this._pos;if(le===-1||Ie>this._list.length||Ie>this.packet.length)return null;const ue=this._list.slice(this._pos,Ie);return this._pos+=le,Ce("_parseBuffer: result: %o",ue),ue}_parseNum(){if(this._list.length-this._pos<2)return-1;const le=this._list.readUInt16BE(this._pos);return this._pos+=2,Ce("_parseNum: result: %s",le),le}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const le=this._list.readUInt32BE(this._pos);return this._pos+=4,Ce("_parse4ByteNum: result: %s",le),le}_parseVarByteNum(le){Ce("_parseVarByteNum");const Ie=4;let ue=0,de=1,Ne=0,he=!1,pe;const ze=this._pos?this._pos:0;for(;ue<Ie&&ze+ue<this._list.length;){if(pe=this._list.readUInt8(ze+ue++),Ne+=de*(pe&re.VARBYTEINT_MASK),de*=128,!(pe&re.VARBYTEINT_FIN_MASK)){he=!0;break}if(this._list.length<=ue)break}return!he&&ue===Ie&&this._list.length>=ue&&this._emitError(new Error("Invalid variable byte integer")),ze&&(this._pos+=ue),he=he?le?{bytes:ue,value:Ne}:Ne:!1,Ce("_parseVarByteNum: result: %o",he),he}_parseByte(){let le;return this._pos<this._list.length&&(le=this._list.readUInt8(this._pos),this._pos++),Ce("_parseByte: result: %o",le),le}_parseByType(le){switch(Ce("_parseByType: type: %s",le),le){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(){Ce("_parseProperties");const le=this._parseVarByteNum(),ue=this._pos+le,de={};for(;this._pos<ue;){const Ne=this._parseByte();if(!Ne)return this._emitError(new Error("Cannot parse property code type")),!1;const he=re.propertiesCodes[Ne];if(!he)return this._emitError(new Error("Unknown property")),!1;if(he==="userProperties"){de[he]||(de[he]=Object.create(null));const pe=this._parseByType(re.propertiesTypes[he]);if(de[he][pe.name])if(Array.isArray(de[he][pe.name]))de[he][pe.name].push(pe.value);else{const ze=de[he][pe.name];de[he][pe.name]=[ze],de[he][pe.name].push(pe.value)}else de[he][pe.name]=pe.value;continue}de[he]?Array.isArray(de[he])?de[he].push(this._parseByType(re.propertiesTypes[he])):(de[he]=[de[he]],de[he].push(this._parseByType(re.propertiesTypes[he]))):de[he]=this._parseByType(re.propertiesTypes[he])}return de}_newPacket(){return Ce("_newPacket"),this.packet&&(this._list.consume(this.packet.length),Ce("_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)),Ce("_newPacket: new packet"),this.packet=new oe,this._pos=0,!0}_emitError(le){Ce("_emitError"),this.error=le,this.emit("error",le)}}g.exports=ie},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(r,g,V){(function(k){(function(){const $=r("./constants"),oe=k.allocUnsafe(0),re=k.from([0]),Ce=r("./numbers"),ie=r("process-nextick-args").nextTick,ae=r("debug")("mqtt-packet:writeToStream"),le=Ce.cache,Ie=Ce.generateNumber,ue=Ce.generateCache,de=Ce.genBufVariableByteInt,Ne=Ce.generate4ByteBuffer;let he=ni,pe=!0;function ze(ui,Ci,zi){switch(ae("generate called"),Ci.cork&&(Ci.cork(),ie(xe,Ci)),pe&&(pe=!1,ue()),ae("generate: packet.cmd: %s",ui.cmd),ui.cmd){case"connect":return Oe(ui,Ci);case"connack":return _e(ui,Ci,zi);case"publish":return At(ui,Ci,zi);case"puback":case"pubrec":case"pubrel":case"pubcomp":return $e(ui,Ci,zi);case"subscribe":return Fe(ui,Ci,zi);case"suback":return Ue(ui,Ci,zi);case"unsubscribe":return Ve(ui,Ci,zi);case"unsuback":return Dt(ui,Ci,zi);case"pingreq":case"pingresp":return qe(ui,Ci);case"disconnect":return kt(ui,Ci,zi);case"auth":return jt(ui,Ci,zi);default:return Ci.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(ze,"cacheNumbers",{get(){return he===ni},set(ui){ui?((!le||Object.keys(le).length===0)&&(pe=!0),he=ni):(pe=!1,he=ri)}});function xe(ui){ui.uncork()}function Oe(ui,Ci,zi){const Ni=ui||{},Mi=Ni.protocolId||"MQTT";let mi=Ni.protocolVersion||4;const vi=Ni.will;let bi=Ni.clean;const gi=Ni.keepalive||0,li=Ni.clientId||"",oi=Ni.username,Et=Ni.password,ii=Ni.properties;bi===void 0&&(bi=!0);let si=0;if(!Mi||typeof Mi!="string"&&!k.isBuffer(Mi))return Ci.emit("error",new Error("Invalid protocolId")),!1;if(si+=Mi.length+2,mi!==3&&mi!==4&&mi!==5)return Ci.emit("error",new Error("Invalid protocol version")),!1;if(si+=1,(typeof li=="string"||k.isBuffer(li))&&(li||mi>=4)&&(li||bi))si+=k.byteLength(li)+2;else{if(mi<4)return Ci.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(bi*1===0)return Ci.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof gi!="number"||gi<0||gi>65535||gi%1!==0)return Ci.emit("error",new Error("Invalid keepalive")),!1;if(si+=2,si+=1,mi===5){var fi=ai(Ci,ii);if(!fi)return!1;si+=fi.length}if(vi){if(typeof vi!="object")return Ci.emit("error",new Error("Invalid will")),!1;if(!vi.topic||typeof vi.topic!="string")return Ci.emit("error",new Error("Invalid will topic")),!1;if(si+=k.byteLength(vi.topic)+2,si+=2,vi.payload)if(vi.payload.length>=0)typeof vi.payload=="string"?si+=k.byteLength(vi.payload):si+=vi.payload.length;else return Ci.emit("error",new Error("Invalid will payload")),!1;var pi={};if(mi===5){if(pi=ai(Ci,vi.properties),!pi)return!1;si+=pi.length}}let Si=!1;if(oi!=null)if(yi(oi))Si=!0,si+=k.byteLength(oi)+2;else return Ci.emit("error",new Error("Invalid username")),!1;if(Et!=null){if(!Si)return Ci.emit("error",new Error("Username is required to use password")),!1;if(yi(Et))si+=Ai(Et)+2;else return Ci.emit("error",new Error("Invalid password")),!1}Ci.write($.CONNECT_HEADER),ti(Ci,si),wi(Ci,Mi),Ni.bridgeMode&&(mi+=128),Ci.write(mi===131?$.VERSION131:mi===132?$.VERSION132:mi===4?$.VERSION4:mi===5?$.VERSION5:$.VERSION3);let xi=0;return xi|=oi!=null?$.USERNAME_MASK:0,xi|=Et!=null?$.PASSWORD_MASK:0,xi|=vi&&vi.retain?$.WILL_RETAIN_MASK:0,xi|=vi&&vi.qos?vi.qos<<$.WILL_QOS_SHIFT:0,xi|=vi?$.WILL_FLAG_MASK:0,xi|=bi?$.CLEAN_SESSION_MASK:0,Ci.write(k.from([xi])),he(Ci,gi),mi===5&&fi.write(),wi(Ci,li),vi&&(mi===5&&pi.write(),ei(Ci,vi.topic),wi(Ci,vi.payload)),oi!=null&&wi(Ci,oi),Et!=null&&wi(Ci,Et),!0}function _e(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Ni===5?Mi.reasonCode:Mi.returnCode,vi=Mi.properties;let bi=2;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid return code")),!1;let gi=null;if(Ni===5){if(gi=ai(Ci,vi),!gi)return!1;bi+=gi.length}return Ci.write($.CONNACK_HEADER),ti(Ci,bi),Ci.write(Mi.sessionPresent?$.SESSIONPRESENT_HEADER:re),Ci.write(k.from([mi])),gi!=null&&gi.write(),!0}function At(ui,Ci,zi){ae("publish: packet: %o",ui);const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.qos||0,vi=Mi.retain?$.RETAIN_MASK:0,bi=Mi.topic,gi=Mi.payload||oe,li=Mi.messageId,oi=Mi.properties;let Et=0;if(typeof bi=="string")Et+=k.byteLength(bi)+2;else if(k.isBuffer(bi))Et+=bi.length+2;else return Ci.emit("error",new Error("Invalid topic")),!1;if(k.isBuffer(gi)?Et+=gi.length:Et+=k.byteLength(gi),mi&&typeof li!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;mi&&(Et+=2);let ii=null;if(Ni===5){if(ii=ai(Ci,oi),!ii)return!1;Et+=ii.length}return Ci.write($.PUBLISH_HEADER[mi][Mi.dup?1:0][vi?1:0]),ti(Ci,Et),he(Ci,Ai(bi)),Ci.write(bi),mi>0&&he(Ci,li),ii!=null&&ii.write(),ae("publish: payload: %o",gi),Ci.write(gi)}function $e(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.cmd||"puback",vi=Mi.messageId,bi=Mi.dup&&mi==="pubrel"?$.DUP_MASK:0;let gi=0;const li=Mi.reasonCode,oi=Mi.properties;let Et=Ni===5?3:2;if(mi==="pubrel"&&(gi=1),typeof vi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;let ii=null;if(Ni===5&&typeof oi=="object"){if(ii=di(Ci,oi,zi,Et),!ii)return!1;Et+=ii.length}return Ci.write($.ACKS[mi][gi][bi][0]),ti(Ci,Et),he(Ci,vi),Ni===5&&Ci.write(k.from([li])),ii!==null&&ii.write(),!0}function Fe(ui,Ci,zi){ae("subscribe: packet: ");const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.dup?$.DUP_MASK:0,vi=Mi.messageId,bi=Mi.subscriptions,gi=Mi.properties;let li=0;if(typeof vi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;li+=2;let oi=null;if(Ni===5){if(oi=ai(Ci,gi),!oi)return!1;li+=oi.length}if(typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){const si=bi[ii].topic,fi=bi[ii].qos;if(typeof si!="string")return Ci.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof fi!="number")return Ci.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Ni===5){if(typeof(bi[ii].nl||!1)!="boolean")return Ci.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(bi[ii].rap||!1)!="boolean")return Ci.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const xi=bi[ii].rh||0;if(typeof xi!="number"||xi>2)return Ci.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}li+=k.byteLength(si)+2+1}else return Ci.emit("error",new Error("Invalid subscriptions")),!1;ae("subscribe: writing to stream: %o",$.SUBSCRIBE_HEADER),Ci.write($.SUBSCRIBE_HEADER[1][mi?1:0][0]),ti(Ci,li),he(Ci,vi),oi!==null&&oi.write();let Et=!0;for(const ii of bi){const si=ii.topic,fi=ii.qos,pi=+ii.nl,Si=+ii.rap,xi=ii.rh;let Gi;ei(Ci,si),Gi=$.SUBSCRIBE_OPTIONS_QOS[fi],Ni===5&&(Gi|=pi?$.SUBSCRIBE_OPTIONS_NL:0,Gi|=Si?$.SUBSCRIBE_OPTIONS_RAP:0,Gi|=xi?$.SUBSCRIBE_OPTIONS_RH[xi]:0),Et=Ci.write(k.from([Gi]))}return Et}function Ue(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.messageId,vi=Mi.granted,bi=Mi.properties;let gi=0;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(gi+=2,typeof vi=="object"&&vi.length)for(let oi=0;oi<vi.length;oi+=1){if(typeof vi[oi]!="number")return Ci.emit("error",new Error("Invalid qos vector")),!1;gi+=1}else return Ci.emit("error",new Error("Invalid qos vector")),!1;let li=null;if(Ni===5){if(li=di(Ci,bi,zi,gi),!li)return!1;gi+=li.length}return Ci.write($.SUBACK_HEADER),ti(Ci,gi),he(Ci,mi),li!==null&&li.write(),Ci.write(k.from(vi))}function Ve(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.messageId,vi=Mi.dup?$.DUP_MASK:0,bi=Mi.unsubscriptions,gi=Mi.properties;let li=0;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(li+=2,typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){if(typeof bi[ii]!="string")return Ci.emit("error",new Error("Invalid unsubscriptions")),!1;li+=k.byteLength(bi[ii])+2}else return Ci.emit("error",new Error("Invalid unsubscriptions")),!1;let oi=null;if(Ni===5){if(oi=ai(Ci,gi),!oi)return!1;li+=oi.length}Ci.write($.UNSUBSCRIBE_HEADER[1][vi?1:0][0]),ti(Ci,li),he(Ci,mi),oi!==null&&oi.write();let Et=!0;for(let ii=0;ii<bi.length;ii++)Et=ei(Ci,bi[ii]);return Et}function Dt(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.messageId,vi=Mi.dup?$.DUP_MASK:0,bi=Mi.granted,gi=Mi.properties,li=Mi.cmd,oi=0;let Et=2;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(Ni===5)if(typeof bi=="object"&&bi.length)for(let si=0;si<bi.length;si+=1){if(typeof bi[si]!="number")return Ci.emit("error",new Error("Invalid qos vector")),!1;Et+=1}else return Ci.emit("error",new Error("Invalid qos vector")),!1;let ii=null;if(Ni===5){if(ii=di(Ci,gi,zi,Et),!ii)return!1;Et+=ii.length}return Ci.write($.ACKS[li][oi][vi][0]),ti(Ci,Et),he(Ci,mi),ii!==null&&ii.write(),Ni===5&&Ci.write(k.from(bi)),!0}function qe(ui,Ci,zi){return Ci.write($.EMPTY[ui.cmd])}function kt(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.reasonCode,vi=Mi.properties;let bi=Ni===5?1:0,gi=null;if(Ni===5){if(gi=di(Ci,vi,zi,bi),!gi)return!1;bi+=gi.length}return Ci.write(k.from([$.codes.disconnect<<4])),ti(Ci,bi),Ni===5&&Ci.write(k.from([mi])),gi!==null&&gi.write(),!0}function jt(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.reasonCode,vi=Mi.properties;let bi=Ni===5?1:0;Ni!==5&&Ci.emit("error",new Error("Invalid mqtt version for auth packet"));const gi=di(Ci,vi,zi,bi);return gi?(bi+=gi.length,Ci.write(k.from([$.codes.auth<<4])),ti(Ci,bi),Ci.write(k.from([mi])),gi!==null&&gi.write(),!0):!1}const Pt={};function ti(ui,Ci){if(Ci>$.VARBYTEINT_MAX)return ui.emit("error",new Error(`Invalid variable byte integer: ${Ci}`)),!1;let zi=Pt[Ci];return zi||(zi=de(Ci),Ci<16384&&(Pt[Ci]=zi)),ae("writeVarByteInt: writing to stream: %o",zi),ui.write(zi)}function ei(ui,Ci){const zi=k.byteLength(Ci);return he(ui,zi),ae("writeString: %s",Ci),ui.write(Ci,"utf8")}function Lt(ui,Ci,zi){ei(ui,Ci),ei(ui,zi)}function ni(ui,Ci){return ae("writeNumberCached: number: %d",Ci),ae("writeNumberCached: %o",le[Ci]),ui.write(le[Ci])}function ri(ui,Ci){const zi=Ie(Ci);return ae("writeNumberGenerated: %o",zi),ui.write(zi)}function Ii(ui,Ci){const zi=Ne(Ci);return ae("write4ByteNumber: %o",zi),ui.write(zi)}function wi(ui,Ci){typeof Ci=="string"?ei(ui,Ci):Ci?(he(ui,Ci.length),ui.write(Ci)):he(ui,0)}function ai(ui,Ci){if(typeof Ci!="object"||Ci.length!=null)return{length:1,write(){ci(ui,{},0)}};let zi=0;function Ni(mi,vi){const bi=$.propertiesTypes[mi];let gi=0;switch(bi){case"byte":{if(typeof vi!="boolean")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+1;break}case"int8":{if(typeof vi!="number"||vi<0||vi>255)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+1;break}case"binary":{if(vi&&vi===null)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+k.byteLength(vi)+2;break}case"int16":{if(typeof vi!="number"||vi<0||vi>65535)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+2;break}case"int32":{if(typeof vi!="number"||vi<0||vi>4294967295)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+4;break}case"var":{if(typeof vi!="number"||vi<0||vi>268435455)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+k.byteLength(de(vi));break}case"string":{if(typeof vi!="string")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+2+k.byteLength(vi.toString());break}case"pair":{if(typeof vi!="object")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=Object.getOwnPropertyNames(vi).reduce((li,oi)=>{const Et=vi[oi];return Array.isArray(Et)?li+=Et.reduce((ii,si)=>(ii+=1+2+k.byteLength(oi.toString())+2+k.byteLength(si.toString()),ii),0):li+=1+2+k.byteLength(oi.toString())+2+k.byteLength(vi[oi].toString()),li},0);break}default:return ui.emit("error",new Error(`Invalid property ${mi}: ${vi}`)),!1}return gi}if(Ci)for(const mi in Ci){let vi=0,bi=0;const gi=Ci[mi];if(Array.isArray(gi))for(let li=0;li<gi.length;li++){if(bi=Ni(mi,gi[li]),!bi)return!1;vi+=bi}else{if(bi=Ni(mi,gi),!bi)return!1;vi=bi}if(!vi)return!1;zi+=vi}return{length:k.byteLength(de(zi))+zi,write(){ci(ui,Ci,zi)}}}function di(ui,Ci,zi,Ni){const Mi=["reasonString","userProperties"],mi=zi&&zi.properties&&zi.properties.maximumPacketSize?zi.properties.maximumPacketSize:0;let vi=ai(ui,Ci);if(mi)for(;Ni+vi.length>mi;){const bi=Mi.shift();if(bi&&Ci[bi])delete Ci[bi],vi=ai(ui,Ci);else return!1}return vi}function hi(ui,Ci,zi){switch($.propertiesTypes[Ci]){case"byte":{ui.write(k.from([$.properties[Ci]])),ui.write(k.from([+zi]));break}case"int8":{ui.write(k.from([$.properties[Ci]])),ui.write(k.from([zi]));break}case"binary":{ui.write(k.from([$.properties[Ci]])),wi(ui,zi);break}case"int16":{ui.write(k.from([$.properties[Ci]])),he(ui,zi);break}case"int32":{ui.write(k.from([$.properties[Ci]])),Ii(ui,zi);break}case"var":{ui.write(k.from([$.properties[Ci]])),ti(ui,zi);break}case"string":{ui.write(k.from([$.properties[Ci]])),ei(ui,zi);break}case"pair":{Object.getOwnPropertyNames(zi).forEach(Mi=>{const mi=zi[Mi];Array.isArray(mi)?mi.forEach(vi=>{ui.write(k.from([$.properties[Ci]])),Lt(ui,Mi.toString(),vi.toString())}):(ui.write(k.from([$.properties[Ci]])),Lt(ui,Mi.toString(),mi.toString()))});break}default:return ui.emit("error",new Error(`Invalid property ${Ci} value: ${zi}`)),!1}}function ci(ui,Ci,zi){ti(ui,zi);for(const Ni in Ci)if(Object.prototype.hasOwnProperty.call(Ci,Ni)&&Ci[Ni]!==null){const Mi=Ci[Ni];if(Array.isArray(Mi))for(let mi=0;mi<Mi.length;mi++)hi(ui,Ni,Mi[mi]);else hi(ui,Ni,Mi)}}function Ai(ui){return ui?ui instanceof k?ui.length:k.byteLength(ui):0}function yi(ui){return typeof ui=="string"||ui instanceof k}g.exports=ze}).call(this)}).call(this,r("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(r,g,V){var k=1e3,$=k*60,oe=$*60,re=oe*24,Ce=re*7,ie=re*365.25;g.exports=function(de,Ne){Ne=Ne||{};var he=typeof de;if(he==="string"&&de.length>0)return ae(de);if(he==="number"&&isFinite(de))return Ne.long?Ie(de):le(de);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(de))};function ae(de){if(de=String(de),!(de.length>100)){var Ne=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(de);if(Ne){var he=parseFloat(Ne[1]),pe=(Ne[2]||"ms").toLowerCase();switch(pe){case"years":case"year":case"yrs":case"yr":case"y":return he*ie;case"weeks":case"week":case"w":return he*Ce;case"days":case"day":case"d":return he*re;case"hours":case"hour":case"hrs":case"hr":case"h":return he*oe;case"minutes":case"minute":case"mins":case"min":case"m":return he*$;case"seconds":case"second":case"secs":case"sec":case"s":return he*k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return he;default:return}}}}function le(de){var Ne=Math.abs(de);return Ne>=re?Math.round(de/re)+"d":Ne>=oe?Math.round(de/oe)+"h":Ne>=$?Math.round(de/$)+"m":Ne>=k?Math.round(de/k)+"s":de+"ms"}function Ie(de){var Ne=Math.abs(de);return Ne>=re?ue(de,Ne,re,"day"):Ne>=oe?ue(de,Ne,oe,"hour"):Ne>=$?ue(de,Ne,$,"minute"):Ne>=k?ue(de,Ne,k,"second"):de+" ms"}function ue(de,Ne,he,pe){var ze=Ne>=he*1.5;return Math.round(de/he)+" "+pe+(ze?"s":"")}},{}],46:[function(r,g,V){const k=r("./lib/number-allocator.js");g.exports.NumberAllocator=k},{"./lib/number-allocator.js":47}],47:[function(r,g,V){const k=r("js-sdsl").Set,$=r("debug")("number-allocator:trace"),oe=r("debug")("number-allocator:error");function re(ie,ae){this.low=ie,this.high=ae}re.prototype.equals=function(ie){return this.low===ie.low&&this.high===ie.high},re.prototype.compare=function(ie){return this.low<ie.low&&this.high<ie.low?-1:ie.low<this.low&&ie.high<this.low?1:0};function Ce(ie,ae){if(!(this instanceof Ce))return new Ce(ie,ae);this.min=ie,this.max=ae,this.ss=new k([],(le,Ie)=>le.compare(Ie)),$("Create"),this.clear()}Ce.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},Ce.prototype.alloc=function(){if(this.ss.size()===0)return $("alloc():empty"),null;const ie=this.ss.front(),ae=ie.low;return ae+1<=ie.high?++ie.low:this.ss.eraseElementByPos(0),$("alloc():"+ae),ae},Ce.prototype.use=function(ie){const ae=new re(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.equals(ae))return this.ss.eraseElementByValue(le),$("use():"+ie),!0;if(le.low>ie)return!1;if(le.low===ie)return++le.low,$("use():"+ie),!0;if(le.high===ie)return--le.high,$("use():"+ie),!0;const Ie=le.low;return le.low=ie+1,this.ss.insert(new re(Ie,ie-1)),$("use():"+ie),!0}return $("use():failed"),!1},Ce.prototype.free=function(ie){if(ie<this.min||ie>this.max){oe("free():"+ie+" is out of range");return}const ae=new re(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.low<=ie&&ie<=le.high){oe("free():"+ie+" has already been vacant");return}if(le===this.ss.front())ie+1===le.low?--le.low:this.ss.insert(ae);else{const Ie=this.ss.reverseLowerBound(ae);Ie.high+1===ie?ie+1===le.low?(this.ss.eraseElementByValue(Ie),le.low=Ie.low):Ie.high=ie:ie+1===le.low?le.low=ie:this.ss.insert(ae)}}else{if(le===this.ss.front()){this.ss.insert(ae);return}const Ie=this.ss.reverseLowerBound(ae);Ie.high+1===ie?Ie.high=ie:this.ss.insert(ae)}$("free():"+ie)},Ce.prototype.clear=function(){$("clear()"),this.ss.clear(),this.ss.insert(new re(this.min,this.max))},Ce.prototype.intervalCount=function(){return this.ss.size()},Ce.prototype.dump=function(){console.log("length:"+this.ss.size());for(const ie of this.ss)console.log(ie)},g.exports=Ce},{debug:18,"js-sdsl":36}],48:[function(r,g,V){var k=r("wrappy");g.exports=k($),g.exports.strict=k(oe),$.proto=$(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return $(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return oe(this)},configurable:!0})});function $(re){var Ce=function(){return Ce.called?Ce.value:(Ce.called=!0,Ce.value=re.apply(this,arguments))};return Ce.called=!1,Ce}function oe(re){var Ce=function(){if(Ce.called)throw new Error(Ce.onceError);return Ce.called=!0,Ce.value=re.apply(this,arguments)},ie=re.name||"Function wrapped with `once`";return Ce.onceError=ie+" shouldn't be called more than once",Ce.called=!1,Ce}},{wrappy:79}],49:[function(r,g,V){(function(k){(function(){typeof k>"u"||!k.version||k.version.indexOf("v0.")===0||k.version.indexOf("v1.")===0&&k.version.indexOf("v1.8.")!==0?g.exports={nextTick:$}:g.exports=k;function $(oe,re,Ce,ie){if(typeof oe!="function")throw new TypeError('"callback" argument must be a function');var ae=arguments.length,le,Ie;switch(ae){case 0:case 1:return k.nextTick(oe);case 2:return k.nextTick(function(){oe.call(null,re)});case 3:return k.nextTick(function(){oe.call(null,re,Ce)});case 4:return k.nextTick(function(){oe.call(null,re,Ce,ie)});default:for(le=new Array(ae-1),Ie=0;Ie<le.length;)le[Ie++]=arguments[Ie];return k.nextTick(function(){oe.apply(null,le)})}}}).call(this)}).call(this,r("_process"))},{_process:50}],50:[function(r,g,V){var k=g.exports={},$,oe;function re(){throw new Error("setTimeout has not been defined")}function Ce(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?$=setTimeout:$=re}catch{$=re}try{typeof clearTimeout=="function"?oe=clearTimeout:oe=Ce}catch{oe=Ce}})();function ie(xe){if($===setTimeout)return setTimeout(xe,0);if(($===re||!$)&&setTimeout)return $=setTimeout,setTimeout(xe,0);try{return $(xe,0)}catch{try{return $.call(null,xe,0)}catch{return $.call(this,xe,0)}}}function ae(xe){if(oe===clearTimeout)return clearTimeout(xe);if((oe===Ce||!oe)&&clearTimeout)return oe=clearTimeout,clearTimeout(xe);try{return oe(xe)}catch{try{return oe.call(null,xe)}catch{return oe.call(this,xe)}}}var le=[],Ie=!1,ue,de=-1;function Ne(){!Ie||!ue||(Ie=!1,ue.length?le=ue.concat(le):de=-1,le.length&&he())}function he(){if(!Ie){var xe=ie(Ne);Ie=!0;for(var Oe=le.length;Oe;){for(ue=le,le=[];++de<Oe;)ue&&ue[de].run();de=-1,Oe=le.length}ue=null,Ie=!1,ae(xe)}}k.nextTick=function(xe){var Oe=new Array(arguments.length-1);if(arguments.length>1)for(var _e=1;_e<arguments.length;_e++)Oe[_e-1]=arguments[_e];le.push(new pe(xe,Oe)),le.length===1&&!Ie&&ie(he)};function pe(xe,Oe){this.fun=xe,this.array=Oe}pe.prototype.run=function(){this.fun.apply(null,this.array)},k.title="browser",k.browser=!0,k.env={},k.argv=[],k.version="",k.versions={};function ze(){}k.on=ze,k.addListener=ze,k.once=ze,k.off=ze,k.removeListener=ze,k.removeAllListeners=ze,k.emit=ze,k.prependListener=ze,k.prependOnceListener=ze,k.listeners=function(xe){return[]},k.binding=function(xe){throw new Error("process.binding is not supported")},k.cwd=function(){return"/"},k.chdir=function(xe){throw new Error("process.chdir is not supported")},k.umask=function(){return 0}},{}],51:[function(r,g,V){(function(k){(function(){(function($){var oe=typeof V=="object"&&V&&!V.nodeType&&V,re=typeof g=="object"&&g&&!g.nodeType&&g,Ce=typeof k=="object"&&k;(Ce.global===Ce||Ce.window===Ce||Ce.self===Ce)&&($=Ce);var ie,ae=2147483647,le=36,Ie=1,ue=26,de=38,Ne=700,he=72,pe=128,ze="-",xe=/^xn--/,Oe=/[^\x20-\x7E]/,_e=/[\x2E\u3002\uFF0E\uFF61]/g,At={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$e=le-Ie,Fe=Math.floor,Ue=String.fromCharCode,Ve;function Dt(ai){throw new RangeError(At[ai])}function qe(ai,di){for(var hi=ai.length,ci=[];hi--;)ci[hi]=di(ai[hi]);return ci}function kt(ai,di){var hi=ai.split("@"),ci="";hi.length>1&&(ci=hi[0]+"@",ai=hi[1]),ai=ai.replace(_e,".");var Ai=ai.split("."),yi=qe(Ai,di).join(".");return ci+yi}function jt(ai){for(var di=[],hi=0,ci=ai.length,Ai,yi;hi<ci;)Ai=ai.charCodeAt(hi++),Ai>=55296&&Ai<=56319&&hi<ci?(yi=ai.charCodeAt(hi++),(yi&64512)==56320?di.push(((Ai&1023)<<10)+(yi&1023)+65536):(di.push(Ai),hi--)):di.push(Ai);return di}function Pt(ai){return qe(ai,function(di){var hi="";return di>65535&&(di-=65536,hi+=Ue(di>>>10&1023|55296),di=56320|di&1023),hi+=Ue(di),hi}).join("")}function ti(ai){return ai-48<10?ai-22:ai-65<26?ai-65:ai-97<26?ai-97:le}function ei(ai,di){return ai+22+75*(ai<26)-((di!=0)<<5)}function Lt(ai,di,hi){var ci=0;for(ai=hi?Fe(ai/Ne):ai>>1,ai+=Fe(ai/di);ai>$e*ue>>1;ci+=le)ai=Fe(ai/$e);return Fe(ci+($e+1)*ai/(ai+de))}function ni(ai){var di=[],hi=ai.length,ci,Ai=0,yi=pe,ui=he,Ci,zi,Ni,Mi,mi,vi,bi,gi,li;for(Ci=ai.lastIndexOf(ze),Ci<0&&(Ci=0),zi=0;zi<Ci;++zi)ai.charCodeAt(zi)>=128&&Dt("not-basic"),di.push(ai.charCodeAt(zi));for(Ni=Ci>0?Ci+1:0;Ni<hi;){for(Mi=Ai,mi=1,vi=le;Ni>=hi&&Dt("invalid-input"),bi=ti(ai.charCodeAt(Ni++)),(bi>=le||bi>Fe((ae-Ai)/mi))&&Dt("overflow"),Ai+=bi*mi,gi=vi<=ui?Ie:vi>=ui+ue?ue:vi-ui,!(bi<gi);vi+=le)li=le-gi,mi>Fe(ae/li)&&Dt("overflow"),mi*=li;ci=di.length+1,ui=Lt(Ai-Mi,ci,Mi==0),Fe(Ai/ci)>ae-yi&&Dt("overflow"),yi+=Fe(Ai/ci),Ai%=ci,di.splice(Ai++,0,yi)}return Pt(di)}function ri(ai){var di,hi,ci,Ai,yi,ui,Ci,zi,Ni,Mi,mi,vi=[],bi,gi,li,oi;for(ai=jt(ai),bi=ai.length,di=pe,hi=0,yi=he,ui=0;ui<bi;++ui)mi=ai[ui],mi<128&&vi.push(Ue(mi));for(ci=Ai=vi.length,Ai&&vi.push(ze);ci<bi;){for(Ci=ae,ui=0;ui<bi;++ui)mi=ai[ui],mi>=di&&mi<Ci&&(Ci=mi);for(gi=ci+1,Ci-di>Fe((ae-hi)/gi)&&Dt("overflow"),hi+=(Ci-di)*gi,di=Ci,ui=0;ui<bi;++ui)if(mi=ai[ui],mi<di&&++hi>ae&&Dt("overflow"),mi==di){for(zi=hi,Ni=le;Mi=Ni<=yi?Ie:Ni>=yi+ue?ue:Ni-yi,!(zi<Mi);Ni+=le)oi=zi-Mi,li=le-Mi,vi.push(Ue(ei(Mi+oi%li,0))),zi=Fe(oi/li);vi.push(Ue(ei(zi,0))),yi=Lt(hi,gi,ci==Ai),hi=0,++ci}++hi,++di}return vi.join("")}function Ii(ai){return kt(ai,function(di){return xe.test(di)?ni(di.slice(4).toLowerCase()):di})}function wi(ai){return kt(ai,function(di){return Oe.test(di)?"xn--"+ri(di):di})}if(ie={version:"1.4.1",ucs2:{decode:jt,encode:Pt},decode:ni,encode:ri,toASCII:wi,toUnicode:Ii},oe&&re)if(g.exports==oe)re.exports=ie;else for(Ve in ie)ie.hasOwnProperty(Ve)&&(oe[Ve]=ie[Ve]);else $.punycode=ie})(this)}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(r,g,V){function k(oe,re){return Object.prototype.hasOwnProperty.call(oe,re)}g.exports=function(oe,re,Ce,ie){re=re||"&",Ce=Ce||"=";var ae={};if(typeof oe!="string"||oe.length===0)return ae;var le=/\+/g;oe=oe.split(re);var Ie=1e3;ie&&typeof ie.maxKeys=="number"&&(Ie=ie.maxKeys);var ue=oe.length;Ie>0&&ue>Ie&&(ue=Ie);for(var de=0;de<ue;++de){var Ne=oe[de].replace(le,"%20"),he=Ne.indexOf(Ce),pe,ze,xe,Oe;he>=0?(pe=Ne.substr(0,he),ze=Ne.substr(he+1)):(pe=Ne,ze=""),xe=decodeURIComponent(pe),Oe=decodeURIComponent(ze),k(ae,xe)?$(ae[xe])?ae[xe].push(Oe):ae[xe]=[ae[xe],Oe]:ae[xe]=Oe}return ae};var $=Array.isArray||function(oe){return Object.prototype.toString.call(oe)==="[object Array]"}},{}],53:[function(r,g,V){var k=function(Ce){switch(typeof Ce){case"string":return Ce;case"boolean":return Ce?"true":"false";case"number":return isFinite(Ce)?Ce:"";default:return""}};g.exports=function(Ce,ie,ae,le){return ie=ie||"&",ae=ae||"=",Ce===null&&(Ce=void 0),typeof Ce=="object"?oe(re(Ce),function(Ie){var ue=encodeURIComponent(k(Ie))+ae;return $(Ce[Ie])?oe(Ce[Ie],function(de){return ue+encodeURIComponent(k(de))}).join(ie):ue+encodeURIComponent(k(Ce[Ie]))}).join(ie):le?encodeURIComponent(k(le))+ae+encodeURIComponent(k(Ce)):""};var $=Array.isArray||function(Ce){return Object.prototype.toString.call(Ce)==="[object Array]"};function oe(Ce,ie){if(Ce.map)return Ce.map(ie);for(var ae=[],le=0;le<Ce.length;le++)ae.push(ie(Ce[le],le));return ae}var re=Object.keys||function(Ce){var ie=[];for(var ae in Ce)Object.prototype.hasOwnProperty.call(Ce,ae)&&ie.push(ae);return ie}},{}],54:[function(r,g,V){V.decode=V.parse=r("./decode"),V.encode=V.stringify=r("./encode")},{"./decode":52,"./encode":53}],55:[function(r,g,V){function k(le,Ie){le.prototype=Object.create(Ie.prototype),le.prototype.constructor=le,le.__proto__=Ie}var $={};function oe(le,Ie,ue){ue||(ue=Error);function de(he,pe,ze){return typeof Ie=="string"?Ie:Ie(he,pe,ze)}var Ne=function(he){k(pe,he);function pe(ze,xe,Oe){return he.call(this,de(ze,xe,Oe))||this}return pe}(ue);Ne.prototype.name=ue.name,Ne.prototype.code=le,$[le]=Ne}function re(le,Ie){if(Array.isArray(le)){var ue=le.length;return le=le.map(function(de){return String(de)}),ue>2?"one of ".concat(Ie," ").concat(le.slice(0,ue-1).join(", "),", or ")+le[ue-1]:ue===2?"one of ".concat(Ie," ").concat(le[0]," or ").concat(le[1]):"of ".concat(Ie," ").concat(le[0])}else return"of ".concat(Ie," ").concat(String(le))}function Ce(le,Ie,ue){return le.substr(!ue||ue<0?0:+ue,Ie.length)===Ie}function ie(le,Ie,ue){return(ue===void 0||ue>le.length)&&(ue=le.length),le.substring(ue-Ie.length,ue)===Ie}function ae(le,Ie,ue){return typeof ue!="number"&&(ue=0),ue+Ie.length>le.length?!1:le.indexOf(Ie,ue)!==-1}oe("ERR_INVALID_OPT_VALUE",function(le,Ie){return'The value "'+Ie+'" is invalid for option "'+le+'"'},TypeError),oe("ERR_INVALID_ARG_TYPE",function(le,Ie,ue){var de;typeof Ie=="string"&&Ce(Ie,"not ")?(de="must not be",Ie=Ie.replace(/^not /,"")):de="must be";var Ne;if(ie(le," argument"))Ne="The ".concat(le," ").concat(de," ").concat(re(Ie,"type"));else{var he=ae(le,".")?"property":"argument";Ne='The "'.concat(le,'" ').concat(he," ").concat(de," ").concat(re(Ie,"type"))}return Ne+=". Received type ".concat(typeof ue),Ne},TypeError),oe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),oe("ERR_METHOD_NOT_IMPLEMENTED",function(le){return"The "+le+" method is not implemented"}),oe("ERR_STREAM_PREMATURE_CLOSE","Premature close"),oe("ERR_STREAM_DESTROYED",function(le){return"Cannot call "+le+" after a stream was destroyed"}),oe("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),oe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),oe("ERR_STREAM_WRITE_AFTER_END","write after end"),oe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),oe("ERR_UNKNOWN_ENCODING",function(le){return"Unknown encoding: "+le},TypeError),oe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),g.exports.codes=$},{}],56:[function(r,g,V){(function(k){(function(){var $=Object.keys||function(de){var Ne=[];for(var he in de)Ne.push(he);return Ne};g.exports=le;var oe=r("./_stream_readable"),re=r("./_stream_writable");r("inherits")(le,oe);for(var Ce=$(re.prototype),ie=0;ie<Ce.length;ie++){var ae=Ce[ie];le.prototype[ae]||(le.prototype[ae]=re.prototype[ae])}function le(de){if(!(this instanceof le))return new le(de);oe.call(this,de),re.call(this,de),this.allowHalfOpen=!0,de&&(de.readable===!1&&(this.readable=!1),de.writable===!1&&(this.writable=!1),de.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Ie)))}Object.defineProperty(le.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(le.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(le.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Ie(){this._writableState.ended||k.nextTick(ue,this)}function ue(de){de.end()}Object.defineProperty(le.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(Ne){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=Ne,this._writableState.destroyed=Ne)}})}).call(this)}).call(this,r("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(r,g,V){g.exports=$;var k=r("./_stream_transform");r("inherits")($,k);function $(oe){if(!(this instanceof $))return new $(oe);k.call(this,oe)}$.prototype._transform=function(oe,re,Ce){Ce(null,oe)}},{"./_stream_transform":59,inherits:24}],58:[function(r,g,V){(function(k,$){(function(){g.exports=Pt;var oe;Pt.ReadableState=jt,r("events").EventEmitter;var re=function(li,oi){return li.listeners(oi).length},Ce=r("./internal/streams/stream"),ie=r("buffer").Buffer,ae=$.Uint8Array||function(){};function le(gi){return ie.from(gi)}function Ie(gi){return ie.isBuffer(gi)||gi instanceof ae}var ue=r("util"),de;ue&&ue.debuglog?de=ue.debuglog("stream"):de=function(){};var Ne=r("./internal/streams/buffer_list"),he=r("./internal/streams/destroy"),pe=r("./internal/streams/state"),ze=pe.getHighWaterMark,xe=r("../errors").codes,Oe=xe.ERR_INVALID_ARG_TYPE,_e=xe.ERR_STREAM_PUSH_AFTER_EOF,At=xe.ERR_METHOD_NOT_IMPLEMENTED,$e=xe.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Fe,Ue,Ve;r("inherits")(Pt,Ce);var Dt=he.errorOrDestroy,qe=["error","close","destroy","pause","resume"];function kt(gi,li,oi){if(typeof gi.prependListener=="function")return gi.prependListener(li,oi);!gi._events||!gi._events[li]?gi.on(li,oi):Array.isArray(gi._events[li])?gi._events[li].unshift(oi):gi._events[li]=[oi,gi._events[li]]}function jt(gi,li,oi){oe=oe||r("./_stream_duplex"),gi=gi||{},typeof oi!="boolean"&&(oi=li instanceof oe),this.objectMode=!!gi.objectMode,oi&&(this.objectMode=this.objectMode||!!gi.readableObjectMode),this.highWaterMark=ze(this,gi,"readableHighWaterMark",oi),this.buffer=new Ne,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=gi.emitClose!==!1,this.autoDestroy=!!gi.autoDestroy,this.destroyed=!1,this.defaultEncoding=gi.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,gi.encoding&&(Fe||(Fe=r("string_decoder/").StringDecoder),this.decoder=new Fe(gi.encoding),this.encoding=gi.encoding)}function Pt(gi){if(oe=oe||r("./_stream_duplex"),!(this instanceof Pt))return new Pt(gi);var li=this instanceof oe;this._readableState=new jt(gi,this,li),this.readable=!0,gi&&(typeof gi.read=="function"&&(this._read=gi.read),typeof gi.destroy=="function"&&(this._destroy=gi.destroy)),Ce.call(this)}Object.defineProperty(Pt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(li){this._readableState&&(this._readableState.destroyed=li)}}),Pt.prototype.destroy=he.destroy,Pt.prototype._undestroy=he.undestroy,Pt.prototype._destroy=function(gi,li){li(gi)},Pt.prototype.push=function(gi,li){var oi=this._readableState,Et;return oi.objectMode?Et=!0:typeof gi=="string"&&(li=li||oi.defaultEncoding,li!==oi.encoding&&(gi=ie.from(gi,li),li=""),Et=!0),ti(this,gi,li,!1,Et)},Pt.prototype.unshift=function(gi){return ti(this,gi,null,!0,!1)};function ti(gi,li,oi,Et,ii){de("readableAddChunk",li);var si=gi._readableState;if(li===null)si.reading=!1,wi(gi,si);else{var fi;if(ii||(fi=Lt(si,li)),fi)Dt(gi,fi);else if(si.objectMode||li&&li.length>0)if(typeof li!="string"&&!si.objectMode&&Object.getPrototypeOf(li)!==ie.prototype&&(li=le(li)),Et)si.endEmitted?Dt(gi,new $e):ei(gi,si,li,!0);else if(si.ended)Dt(gi,new _e);else{if(si.destroyed)return!1;si.reading=!1,si.decoder&&!oi?(li=si.decoder.write(li),si.objectMode||li.length!==0?ei(gi,si,li,!1):hi(gi,si)):ei(gi,si,li,!1)}else Et||(si.reading=!1,hi(gi,si))}return!si.ended&&(si.length<si.highWaterMark||si.length===0)}function ei(gi,li,oi,Et){li.flowing&&li.length===0&&!li.sync?(li.awaitDrain=0,gi.emit("data",oi)):(li.length+=li.objectMode?1:oi.length,Et?li.buffer.unshift(oi):li.buffer.push(oi),li.needReadable&&ai(gi)),hi(gi,li)}function Lt(gi,li){var oi;return!Ie(li)&&typeof li!="string"&&li!==void 0&&!gi.objectMode&&(oi=new Oe("chunk",["string","Buffer","Uint8Array"],li)),oi}Pt.prototype.isPaused=function(){return this._readableState.flowing===!1},Pt.prototype.setEncoding=function(gi){Fe||(Fe=r("string_decoder/").StringDecoder);var li=new Fe(gi);this._readableState.decoder=li,this._readableState.encoding=this._readableState.decoder.encoding;for(var oi=this._readableState.buffer.head,Et="";oi!==null;)Et+=li.write(oi.data),oi=oi.next;return this._readableState.buffer.clear(),Et!==""&&this._readableState.buffer.push(Et),this._readableState.length=Et.length,this};var ni=1073741824;function ri(gi){return gi>=ni?gi=ni:(gi--,gi|=gi>>>1,gi|=gi>>>2,gi|=gi>>>4,gi|=gi>>>8,gi|=gi>>>16,gi++),gi}function Ii(gi,li){return gi<=0||li.length===0&&li.ended?0:li.objectMode?1:gi!==gi?li.flowing&&li.length?li.buffer.head.data.length:li.length:(gi>li.highWaterMark&&(li.highWaterMark=ri(gi)),gi<=li.length?gi:li.ended?li.length:(li.needReadable=!0,0))}Pt.prototype.read=function(gi){de("read",gi),gi=parseInt(gi,10);var li=this._readableState,oi=gi;if(gi!==0&&(li.emittedReadable=!1),gi===0&&li.needReadable&&((li.highWaterMark!==0?li.length>=li.highWaterMark:li.length>0)||li.ended))return de("read: emitReadable",li.length,li.ended),li.length===0&&li.ended?mi(this):ai(this),null;if(gi=Ii(gi,li),gi===0&&li.ended)return li.length===0&&mi(this),null;var Et=li.needReadable;de("need readable",Et),(li.length===0||li.length-gi<li.highWaterMark)&&(Et=!0,de("length less than watermark",Et)),li.ended||li.reading?(Et=!1,de("reading or ended",Et)):Et&&(de("do read"),li.reading=!0,li.sync=!0,li.length===0&&(li.needReadable=!0),this._read(li.highWaterMark),li.sync=!1,li.reading||(gi=Ii(oi,li)));var ii;return gi>0?ii=Mi(gi,li):ii=null,ii===null?(li.needReadable=li.length<=li.highWaterMark,gi=0):(li.length-=gi,li.awaitDrain=0),li.length===0&&(li.ended||(li.needReadable=!0),oi!==gi&&li.ended&&mi(this)),ii!==null&&this.emit("data",ii),ii};function wi(gi,li){if(de("onEofChunk"),!li.ended){if(li.decoder){var oi=li.decoder.end();oi&&oi.length&&(li.buffer.push(oi),li.length+=li.objectMode?1:oi.length)}li.ended=!0,li.sync?ai(gi):(li.needReadable=!1,li.emittedReadable||(li.emittedReadable=!0,di(gi)))}}function ai(gi){var li=gi._readableState;de("emitReadable",li.needReadable,li.emittedReadable),li.needReadable=!1,li.emittedReadable||(de("emitReadable",li.flowing),li.emittedReadable=!0,k.nextTick(di,gi))}function di(gi){var li=gi._readableState;de("emitReadable_",li.destroyed,li.length,li.ended),!li.destroyed&&(li.length||li.ended)&&(gi.emit("readable"),li.emittedReadable=!1),li.needReadable=!li.flowing&&!li.ended&&li.length<=li.highWaterMark,Ni(gi)}function hi(gi,li){li.readingMore||(li.readingMore=!0,k.nextTick(ci,gi,li))}function ci(gi,li){for(;!li.reading&&!li.ended&&(li.length<li.highWaterMark||li.flowing&&li.length===0);){var oi=li.length;if(de("maybeReadMore read 0"),gi.read(0),oi===li.length)break}li.readingMore=!1}Pt.prototype._read=function(gi){Dt(this,new At("_read()"))},Pt.prototype.pipe=function(gi,li){var oi=this,Et=this._readableState;switch(Et.pipesCount){case 0:Et.pipes=gi;break;case 1:Et.pipes=[Et.pipes,gi];break;default:Et.pipes.push(gi);break}Et.pipesCount+=1,de("pipe count=%d opts=%j",Et.pipesCount,li);var ii=(!li||li.end!==!1)&&gi!==k.stdout&&gi!==k.stderr,si=ii?pi:Vi;Et.endEmitted?k.nextTick(si):oi.once("end",si),gi.on("unpipe",fi);function fi(ki,Hi){de("onunpipe"),ki===oi&&Hi&&Hi.hasUnpiped===!1&&(Hi.hasUnpiped=!0,Gi())}function pi(){de("onend"),gi.end()}var Si=Ai(oi);gi.on("drain",Si);var xi=!1;function Gi(){de("cleanup"),gi.removeListener("close",Zi),gi.removeListener("finish",Wi),gi.removeListener("drain",Si),gi.removeListener("error",Oi),gi.removeListener("unpipe",fi),oi.removeListener("end",pi),oi.removeListener("end",Vi),oi.removeListener("data",Bi),xi=!0,Et.awaitDrain&&(!gi._writableState||gi._writableState.needDrain)&&Si()}oi.on("data",Bi);function Bi(ki){de("ondata");var Hi=gi.write(ki);de("dest.write",Hi),Hi===!1&&((Et.pipesCount===1&&Et.pipes===gi||Et.pipesCount>1&&bi(Et.pipes,gi)!==-1)&&!xi&&(de("false write response, pause",Et.awaitDrain),Et.awaitDrain++),oi.pause())}function Oi(ki){de("onerror",ki),Vi(),gi.removeListener("error",Oi),re(gi,"error")===0&&Dt(gi,ki)}kt(gi,"error",Oi);function Zi(){gi.removeListener("finish",Wi),Vi()}gi.once("close",Zi);function Wi(){de("onfinish"),gi.removeListener("close",Zi),Vi()}gi.once("finish",Wi);function Vi(){de("unpipe"),oi.unpipe(gi)}return gi.emit("pipe",oi),Et.flowing||(de("pipe resume"),oi.resume()),gi};function Ai(gi){return function(){var oi=gi._readableState;de("pipeOnDrain",oi.awaitDrain),oi.awaitDrain&&oi.awaitDrain--,oi.awaitDrain===0&&re(gi,"data")&&(oi.flowing=!0,Ni(gi))}}Pt.prototype.unpipe=function(gi){var li=this._readableState,oi={hasUnpiped:!1};if(li.pipesCount===0)return this;if(li.pipesCount===1)return gi&&gi!==li.pipes?this:(gi||(gi=li.pipes),li.pipes=null,li.pipesCount=0,li.flowing=!1,gi&&gi.emit("unpipe",this,oi),this);if(!gi){var Et=li.pipes,ii=li.pipesCount;li.pipes=null,li.pipesCount=0,li.flowing=!1;for(var si=0;si<ii;si++)Et[si].emit("unpipe",this,{hasUnpiped:!1});return this}var fi=bi(li.pipes,gi);return fi===-1?this:(li.pipes.splice(fi,1),li.pipesCount-=1,li.pipesCount===1&&(li.pipes=li.pipes[0]),gi.emit("unpipe",this,oi),this)},Pt.prototype.on=function(gi,li){var oi=Ce.prototype.on.call(this,gi,li),Et=this._readableState;return gi==="data"?(Et.readableListening=this.listenerCount("readable")>0,Et.flowing!==!1&&this.resume()):gi==="readable"&&!Et.endEmitted&&!Et.readableListening&&(Et.readableListening=Et.needReadable=!0,Et.flowing=!1,Et.emittedReadable=!1,de("on readable",Et.length,Et.reading),Et.length?ai(this):Et.reading||k.nextTick(ui,this)),oi},Pt.prototype.addListener=Pt.prototype.on,Pt.prototype.removeListener=function(gi,li){var oi=Ce.prototype.removeListener.call(this,gi,li);return gi==="readable"&&k.nextTick(yi,this),oi},Pt.prototype.removeAllListeners=function(gi){var li=Ce.prototype.removeAllListeners.apply(this,arguments);return(gi==="readable"||gi===void 0)&&k.nextTick(yi,this),li};function yi(gi){var li=gi._readableState;li.readableListening=gi.listenerCount("readable")>0,li.resumeScheduled&&!li.paused?li.flowing=!0:gi.listenerCount("data")>0&&gi.resume()}function ui(gi){de("readable nexttick read 0"),gi.read(0)}Pt.prototype.resume=function(){var gi=this._readableState;return gi.flowing||(de("resume"),gi.flowing=!gi.readableListening,Ci(this,gi)),gi.paused=!1,this};function Ci(gi,li){li.resumeScheduled||(li.resumeScheduled=!0,k.nextTick(zi,gi,li))}function zi(gi,li){de("resume",li.reading),li.reading||gi.read(0),li.resumeScheduled=!1,gi.emit("resume"),Ni(gi),li.flowing&&!li.reading&&gi.read(0)}Pt.prototype.pause=function(){return de("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(de("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Ni(gi){var li=gi._readableState;for(de("flow",li.flowing);li.flowing&&gi.read()!==null;);}Pt.prototype.wrap=function(gi){var li=this,oi=this._readableState,Et=!1;gi.on("end",function(){if(de("wrapped end"),oi.decoder&&!oi.ended){var fi=oi.decoder.end();fi&&fi.length&&li.push(fi)}li.push(null)}),gi.on("data",function(fi){if(de("wrapped data"),oi.decoder&&(fi=oi.decoder.write(fi)),!(oi.objectMode&&fi==null)&&!(!oi.objectMode&&(!fi||!fi.length))){var pi=li.push(fi);pi||(Et=!0,gi.pause())}});for(var ii in gi)this[ii]===void 0&&typeof gi[ii]=="function"&&(this[ii]=function(pi){return function(){return gi[pi].apply(gi,arguments)}}(ii));for(var si=0;si<qe.length;si++)gi.on(qe[si],this.emit.bind(this,qe[si]));return this._read=function(fi){de("wrapped _read",fi),Et&&(Et=!1,gi.resume())},this},typeof Symbol=="function"&&(Pt.prototype[Symbol.asyncIterator]=function(){return Ue===void 0&&(Ue=r("./internal/streams/async_iterator")),Ue(this)}),Object.defineProperty(Pt.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Pt.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Pt.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(li){this._readableState&&(this._readableState.flowing=li)}}),Pt._fromList=Mi,Object.defineProperty(Pt.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Mi(gi,li){if(li.length===0)return null;var oi;return li.objectMode?oi=li.buffer.shift():!gi||gi>=li.length?(li.decoder?oi=li.buffer.join(""):li.buffer.length===1?oi=li.buffer.first():oi=li.buffer.concat(li.length),li.buffer.clear()):oi=li.buffer.consume(gi,li.decoder),oi}function mi(gi){var li=gi._readableState;de("endReadable",li.endEmitted),li.endEmitted||(li.ended=!0,k.nextTick(vi,li,gi))}function vi(gi,li){if(de("endReadableNT",gi.endEmitted,gi.length),!gi.endEmitted&&gi.length===0&&(gi.endEmitted=!0,li.readable=!1,li.emit("end"),gi.autoDestroy)){var oi=li._writableState;(!oi||oi.autoDestroy&&oi.finished)&&li.destroy()}}typeof Symbol=="function"&&(Pt.from=function(gi,li){return Ve===void 0&&(Ve=r("./internal/streams/from")),Ve(Pt,gi,li)});function bi(gi,li){for(var oi=0,Et=gi.length;oi<Et;oi++)if(gi[oi]===li)return oi;return-1}}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal: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(r,g,V){g.exports=le;var k=r("../errors").codes,$=k.ERR_METHOD_NOT_IMPLEMENTED,oe=k.ERR_MULTIPLE_CALLBACK,re=k.ERR_TRANSFORM_ALREADY_TRANSFORMING,Ce=k.ERR_TRANSFORM_WITH_LENGTH_0,ie=r("./_stream_duplex");r("inherits")(le,ie);function ae(de,Ne){var he=this._transformState;he.transforming=!1;var pe=he.writecb;if(pe===null)return this.emit("error",new oe);he.writechunk=null,he.writecb=null,Ne!=null&&this.push(Ne),pe(de);var ze=this._readableState;ze.reading=!1,(ze.needReadable||ze.length<ze.highWaterMark)&&this._read(ze.highWaterMark)}function le(de){if(!(this instanceof le))return new le(de);ie.call(this,de),this._transformState={afterTransform:ae.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,de&&(typeof de.transform=="function"&&(this._transform=de.transform),typeof de.flush=="function"&&(this._flush=de.flush)),this.on("prefinish",Ie)}function Ie(){var de=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(Ne,he){ue(de,Ne,he)}):ue(this,null,null)}le.prototype.push=function(de,Ne){return this._transformState.needTransform=!1,ie.prototype.push.call(this,de,Ne)},le.prototype._transform=function(de,Ne,he){he(new $("_transform()"))},le.prototype._write=function(de,Ne,he){var pe=this._transformState;if(pe.writecb=he,pe.writechunk=de,pe.writeencoding=Ne,!pe.transforming){var ze=this._readableState;(pe.needTransform||ze.needReadable||ze.length<ze.highWaterMark)&&this._read(ze.highWaterMark)}},le.prototype._read=function(de){var Ne=this._transformState;Ne.writechunk!==null&&!Ne.transforming?(Ne.transforming=!0,this._transform(Ne.writechunk,Ne.writeencoding,Ne.afterTransform)):Ne.needTransform=!0},le.prototype._destroy=function(de,Ne){ie.prototype._destroy.call(this,de,function(he){Ne(he)})};function ue(de,Ne,he){if(Ne)return de.emit("error",Ne);if(he!=null&&de.push(he),de._writableState.length)throw new Ce;if(de._transformState.transforming)throw new re;return de.push(null)}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(r,g,V){(function(k,$){(function(){g.exports=jt;function oe(Ni){var Mi=this;this.next=null,this.entry=null,this.finish=function(){zi(Mi,Ni)}}var re;jt.WritableState=qe;var Ce={deprecate:r("util-deprecate")},ie=r("./internal/streams/stream"),ae=r("buffer").Buffer,le=$.Uint8Array||function(){};function Ie(Ni){return ae.from(Ni)}function ue(Ni){return ae.isBuffer(Ni)||Ni instanceof le}var de=r("./internal/streams/destroy"),Ne=r("./internal/streams/state"),he=Ne.getHighWaterMark,pe=r("../errors").codes,ze=pe.ERR_INVALID_ARG_TYPE,xe=pe.ERR_METHOD_NOT_IMPLEMENTED,Oe=pe.ERR_MULTIPLE_CALLBACK,_e=pe.ERR_STREAM_CANNOT_PIPE,At=pe.ERR_STREAM_DESTROYED,$e=pe.ERR_STREAM_NULL_VALUES,Fe=pe.ERR_STREAM_WRITE_AFTER_END,Ue=pe.ERR_UNKNOWN_ENCODING,Ve=de.errorOrDestroy;r("inherits")(jt,ie);function Dt(){}function qe(Ni,Mi,mi){re=re||r("./_stream_duplex"),Ni=Ni||{},typeof mi!="boolean"&&(mi=Mi instanceof re),this.objectMode=!!Ni.objectMode,mi&&(this.objectMode=this.objectMode||!!Ni.writableObjectMode),this.highWaterMark=he(this,Ni,"writableHighWaterMark",mi),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var vi=Ni.decodeStrings===!1;this.decodeStrings=!vi,this.defaultEncoding=Ni.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(bi){wi(Mi,bi)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Ni.emitClose!==!1,this.autoDestroy=!!Ni.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new oe(this)}qe.prototype.getBuffer=function(){for(var Mi=this.bufferedRequest,mi=[];Mi;)mi.push(Mi),Mi=Mi.next;return mi},function(){try{Object.defineProperty(qe.prototype,"buffer",{get:Ce.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var kt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(kt=Function.prototype[Symbol.hasInstance],Object.defineProperty(jt,Symbol.hasInstance,{value:function(Mi){return kt.call(this,Mi)?!0:this!==jt?!1:Mi&&Mi._writableState instanceof qe}})):kt=function(Mi){return Mi instanceof this};function jt(Ni){re=re||r("./_stream_duplex");var Mi=this instanceof re;if(!Mi&&!kt.call(jt,this))return new jt(Ni);this._writableState=new qe(Ni,this,Mi),this.writable=!0,Ni&&(typeof Ni.write=="function"&&(this._write=Ni.write),typeof Ni.writev=="function"&&(this._writev=Ni.writev),typeof Ni.destroy=="function"&&(this._destroy=Ni.destroy),typeof Ni.final=="function"&&(this._final=Ni.final)),ie.call(this)}jt.prototype.pipe=function(){Ve(this,new _e)};function Pt(Ni,Mi){var mi=new Fe;Ve(Ni,mi),k.nextTick(Mi,mi)}function ti(Ni,Mi,mi,vi){var bi;return mi===null?bi=new $e:typeof mi!="string"&&!Mi.objectMode&&(bi=new ze("chunk",["string","Buffer"],mi)),bi?(Ve(Ni,bi),k.nextTick(vi,bi),!1):!0}jt.prototype.write=function(Ni,Mi,mi){var vi=this._writableState,bi=!1,gi=!vi.objectMode&&ue(Ni);return gi&&!ae.isBuffer(Ni)&&(Ni=Ie(Ni)),typeof Mi=="function"&&(mi=Mi,Mi=null),gi?Mi="buffer":Mi||(Mi=vi.defaultEncoding),typeof mi!="function"&&(mi=Dt),vi.ending?Pt(this,mi):(gi||ti(this,vi,Ni,mi))&&(vi.pendingcb++,bi=Lt(this,vi,gi,Ni,Mi,mi)),bi},jt.prototype.cork=function(){this._writableState.corked++},jt.prototype.uncork=function(){var Ni=this._writableState;Ni.corked&&(Ni.corked--,!Ni.writing&&!Ni.corked&&!Ni.bufferProcessing&&Ni.bufferedRequest&&hi(this,Ni))},jt.prototype.setDefaultEncoding=function(Mi){if(typeof Mi=="string"&&(Mi=Mi.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Mi+"").toLowerCase())>-1))throw new Ue(Mi);return this._writableState.defaultEncoding=Mi,this},Object.defineProperty(jt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ei(Ni,Mi,mi){return!Ni.objectMode&&Ni.decodeStrings!==!1&&typeof Mi=="string"&&(Mi=ae.from(Mi,mi)),Mi}Object.defineProperty(jt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Lt(Ni,Mi,mi,vi,bi,gi){if(!mi){var li=ei(Mi,vi,bi);vi!==li&&(mi=!0,bi="buffer",vi=li)}var oi=Mi.objectMode?1:vi.length;Mi.length+=oi;var Et=Mi.length<Mi.highWaterMark;if(Et||(Mi.needDrain=!0),Mi.writing||Mi.corked){var ii=Mi.lastBufferedRequest;Mi.lastBufferedRequest={chunk:vi,encoding:bi,isBuf:mi,callback:gi,next:null},ii?ii.next=Mi.lastBufferedRequest:Mi.bufferedRequest=Mi.lastBufferedRequest,Mi.bufferedRequestCount+=1}else ni(Ni,Mi,!1,oi,vi,bi,gi);return Et}function ni(Ni,Mi,mi,vi,bi,gi,li){Mi.writelen=vi,Mi.writecb=li,Mi.writing=!0,Mi.sync=!0,Mi.destroyed?Mi.onwrite(new At("write")):mi?Ni._writev(bi,Mi.onwrite):Ni._write(bi,gi,Mi.onwrite),Mi.sync=!1}function ri(Ni,Mi,mi,vi,bi){--Mi.pendingcb,mi?(k.nextTick(bi,vi),k.nextTick(ui,Ni,Mi),Ni._writableState.errorEmitted=!0,Ve(Ni,vi)):(bi(vi),Ni._writableState.errorEmitted=!0,Ve(Ni,vi),ui(Ni,Mi))}function Ii(Ni){Ni.writing=!1,Ni.writecb=null,Ni.length-=Ni.writelen,Ni.writelen=0}function wi(Ni,Mi){var mi=Ni._writableState,vi=mi.sync,bi=mi.writecb;if(typeof bi!="function")throw new Oe;if(Ii(mi),Mi)ri(Ni,mi,vi,Mi,bi);else{var gi=ci(mi)||Ni.destroyed;!gi&&!mi.corked&&!mi.bufferProcessing&&mi.bufferedRequest&&hi(Ni,mi),vi?k.nextTick(ai,Ni,mi,gi,bi):ai(Ni,mi,gi,bi)}}function ai(Ni,Mi,mi,vi){mi||di(Ni,Mi),Mi.pendingcb--,vi(),ui(Ni,Mi)}function di(Ni,Mi){Mi.length===0&&Mi.needDrain&&(Mi.needDrain=!1,Ni.emit("drain"))}function hi(Ni,Mi){Mi.bufferProcessing=!0;var mi=Mi.bufferedRequest;if(Ni._writev&&mi&&mi.next){var vi=Mi.bufferedRequestCount,bi=new Array(vi),gi=Mi.corkedRequestsFree;gi.entry=mi;for(var li=0,oi=!0;mi;)bi[li]=mi,mi.isBuf||(oi=!1),mi=mi.next,li+=1;bi.allBuffers=oi,ni(Ni,Mi,!0,Mi.length,bi,"",gi.finish),Mi.pendingcb++,Mi.lastBufferedRequest=null,gi.next?(Mi.corkedRequestsFree=gi.next,gi.next=null):Mi.corkedRequestsFree=new oe(Mi),Mi.bufferedRequestCount=0}else{for(;mi;){var Et=mi.chunk,ii=mi.encoding,si=mi.callback,fi=Mi.objectMode?1:Et.length;if(ni(Ni,Mi,!1,fi,Et,ii,si),mi=mi.next,Mi.bufferedRequestCount--,Mi.writing)break}mi===null&&(Mi.lastBufferedRequest=null)}Mi.bufferedRequest=mi,Mi.bufferProcessing=!1}jt.prototype._write=function(Ni,Mi,mi){mi(new xe("_write()"))},jt.prototype._writev=null,jt.prototype.end=function(Ni,Mi,mi){var vi=this._writableState;return typeof Ni=="function"?(mi=Ni,Ni=null,Mi=null):typeof Mi=="function"&&(mi=Mi,Mi=null),Ni!=null&&this.write(Ni,Mi),vi.corked&&(vi.corked=1,this.uncork()),vi.ending||Ci(this,vi,mi),this},Object.defineProperty(jt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ci(Ni){return Ni.ending&&Ni.length===0&&Ni.bufferedRequest===null&&!Ni.finished&&!Ni.writing}function Ai(Ni,Mi){Ni._final(function(mi){Mi.pendingcb--,mi&&Ve(Ni,mi),Mi.prefinished=!0,Ni.emit("prefinish"),ui(Ni,Mi)})}function yi(Ni,Mi){!Mi.prefinished&&!Mi.finalCalled&&(typeof Ni._final=="function"&&!Mi.destroyed?(Mi.pendingcb++,Mi.finalCalled=!0,k.nextTick(Ai,Ni,Mi)):(Mi.prefinished=!0,Ni.emit("prefinish")))}function ui(Ni,Mi){var mi=ci(Mi);if(mi&&(yi(Ni,Mi),Mi.pendingcb===0&&(Mi.finished=!0,Ni.emit("finish"),Mi.autoDestroy))){var vi=Ni._readableState;(!vi||vi.autoDestroy&&vi.endEmitted)&&Ni.destroy()}return mi}function Ci(Ni,Mi,mi){Mi.ending=!0,ui(Ni,Mi),mi&&(Mi.finished?k.nextTick(mi):Ni.once("finish",mi)),Mi.ended=!0,Ni.writable=!1}function zi(Ni,Mi,mi){var vi=Ni.entry;for(Ni.entry=null;vi;){var bi=vi.callback;Mi.pendingcb--,bi(mi),vi=vi.next}Mi.corkedRequestsFree.next=Ni}Object.defineProperty(jt.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Mi){this._writableState&&(this._writableState.destroyed=Mi)}}),jt.prototype.destroy=de.destroy,jt.prototype._undestroy=de.undestroy,jt.prototype._destroy=function(Ni,Mi){Mi(Ni)}}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal: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(r,g,V){(function(k){(function(){var $;function oe(At,$e,Fe){return $e in At?Object.defineProperty(At,$e,{value:Fe,enumerable:!0,configurable:!0,writable:!0}):At[$e]=Fe,At}var re=r("./end-of-stream"),Ce=Symbol("lastResolve"),ie=Symbol("lastReject"),ae=Symbol("error"),le=Symbol("ended"),Ie=Symbol("lastPromise"),ue=Symbol("handlePromise"),de=Symbol("stream");function Ne(At,$e){return{value:At,done:$e}}function he(At){var $e=At[Ce];if($e!==null){var Fe=At[de].read();Fe!==null&&(At[Ie]=null,At[Ce]=null,At[ie]=null,$e(Ne(Fe,!1)))}}function pe(At){k.nextTick(he,At)}function ze(At,$e){return function(Fe,Ue){At.then(function(){if($e[le]){Fe(Ne(void 0,!0));return}$e[ue](Fe,Ue)},Ue)}}var xe=Object.getPrototypeOf(function(){}),Oe=Object.setPrototypeOf(($={get stream(){return this[de]},next:function(){var $e=this,Fe=this[ae];if(Fe!==null)return Promise.reject(Fe);if(this[le])return Promise.resolve(Ne(void 0,!0));if(this[de].destroyed)return new Promise(function(qe,kt){k.nextTick(function(){$e[ae]?kt($e[ae]):qe(Ne(void 0,!0))})});var Ue=this[Ie],Ve;if(Ue)Ve=new Promise(ze(Ue,this));else{var Dt=this[de].read();if(Dt!==null)return Promise.resolve(Ne(Dt,!1));Ve=new Promise(this[ue])}return this[Ie]=Ve,Ve}},oe($,Symbol.asyncIterator,function(){return this}),oe($,"return",function(){var $e=this;return new Promise(function(Fe,Ue){$e[de].destroy(null,function(Ve){if(Ve){Ue(Ve);return}Fe(Ne(void 0,!0))})})}),$),xe),_e=function($e){var Fe,Ue=Object.create(Oe,(Fe={},oe(Fe,de,{value:$e,writable:!0}),oe(Fe,Ce,{value:null,writable:!0}),oe(Fe,ie,{value:null,writable:!0}),oe(Fe,ae,{value:null,writable:!0}),oe(Fe,le,{value:$e._readableState.endEmitted,writable:!0}),oe(Fe,ue,{value:function(Dt,qe){var kt=Ue[de].read();kt?(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(Ne(kt,!1))):(Ue[Ce]=Dt,Ue[ie]=qe)},writable:!0}),Fe));return Ue[Ie]=null,re($e,function(Ve){if(Ve&&Ve.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Dt=Ue[ie];Dt!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(Ve)),Ue[ae]=Ve;return}var qe=Ue[Ce];qe!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,qe(Ne(void 0,!0))),Ue[le]=!0}),$e.on("readable",pe.bind(null,Ue)),Ue};g.exports=_e}).call(this)}).call(this,r("_process"))},{"./end-of-stream":64,_process:50}],62:[function(r,g,V){function k(he,pe){var ze=Object.keys(he);if(Object.getOwnPropertySymbols){var xe=Object.getOwnPropertySymbols(he);pe&&(xe=xe.filter(function(Oe){return Object.getOwnPropertyDescriptor(he,Oe).enumerable})),ze.push.apply(ze,xe)}return ze}function $(he){for(var pe=1;pe<arguments.length;pe++){var ze=arguments[pe]!=null?arguments[pe]:{};pe%2?k(Object(ze),!0).forEach(function(xe){oe(he,xe,ze[xe])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(ze)):k(Object(ze)).forEach(function(xe){Object.defineProperty(he,xe,Object.getOwnPropertyDescriptor(ze,xe))})}return he}function oe(he,pe,ze){return pe in he?Object.defineProperty(he,pe,{value:ze,enumerable:!0,configurable:!0,writable:!0}):he[pe]=ze,he}function re(he,pe){if(!(he instanceof pe))throw new TypeError("Cannot call a class as a function")}function Ce(he,pe){for(var ze=0;ze<pe.length;ze++){var xe=pe[ze];xe.enumerable=xe.enumerable||!1,xe.configurable=!0,"value"in xe&&(xe.writable=!0),Object.defineProperty(he,xe.key,xe)}}function ie(he,pe,ze){return pe&&Ce(he.prototype,pe),ze&&Ce(he,ze),he}var ae=r("buffer"),le=ae.Buffer,Ie=r("util"),ue=Ie.inspect,de=ue&&ue.custom||"inspect";function Ne(he,pe,ze){le.prototype.copy.call(he,pe,ze)}g.exports=function(){function he(){re(this,he),this.head=null,this.tail=null,this.length=0}return ie(he,[{key:"push",value:function(ze){var xe={data:ze,next:null};this.length>0?this.tail.next=xe:this.head=xe,this.tail=xe,++this.length}},{key:"unshift",value:function(ze){var xe={data:ze,next:this.head};this.length===0&&(this.tail=xe),this.head=xe,++this.length}},{key:"shift",value:function(){if(this.length!==0){var ze=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ze}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(ze){if(this.length===0)return"";for(var xe=this.head,Oe=""+xe.data;xe=xe.next;)Oe+=ze+xe.data;return Oe}},{key:"concat",value:function(ze){if(this.length===0)return le.alloc(0);for(var xe=le.allocUnsafe(ze>>>0),Oe=this.head,_e=0;Oe;)Ne(Oe.data,xe,_e),_e+=Oe.data.length,Oe=Oe.next;return xe}},{key:"consume",value:function(ze,xe){var Oe;return ze<this.head.data.length?(Oe=this.head.data.slice(0,ze),this.head.data=this.head.data.slice(ze)):ze===this.head.data.length?Oe=this.shift():Oe=xe?this._getString(ze):this._getBuffer(ze),Oe}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(ze){var xe=this.head,Oe=1,_e=xe.data;for(ze-=_e.length;xe=xe.next;){var At=xe.data,$e=ze>At.length?At.length:ze;if($e===At.length?_e+=At:_e+=At.slice(0,ze),ze-=$e,ze===0){$e===At.length?(++Oe,xe.next?this.head=xe.next:this.head=this.tail=null):(this.head=xe,xe.data=At.slice($e));break}++Oe}return this.length-=Oe,_e}},{key:"_getBuffer",value:function(ze){var xe=le.allocUnsafe(ze),Oe=this.head,_e=1;for(Oe.data.copy(xe),ze-=Oe.data.length;Oe=Oe.next;){var At=Oe.data,$e=ze>At.length?At.length:ze;if(At.copy(xe,xe.length-ze,0,$e),ze-=$e,ze===0){$e===At.length?(++_e,Oe.next?this.head=Oe.next:this.head=this.tail=null):(this.head=Oe,Oe.data=At.slice($e));break}++_e}return this.length-=_e,xe}},{key:de,value:function(ze,xe){return ue(this,$({},xe,{depth:0,customInspect:!1}))}}]),he}()},{buffer:17,util:16}],63:[function(r,g,V){(function(k){(function(){function $(le,Ie){var ue=this,de=this._readableState&&this._readableState.destroyed,Ne=this._writableState&&this._writableState.destroyed;return de||Ne?(Ie?Ie(le):le&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,k.nextTick(ie,this,le)):k.nextTick(ie,this,le)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(le||null,function(he){!Ie&&he?ue._writableState?ue._writableState.errorEmitted?k.nextTick(re,ue):(ue._writableState.errorEmitted=!0,k.nextTick(oe,ue,he)):k.nextTick(oe,ue,he):Ie?(k.nextTick(re,ue),Ie(he)):k.nextTick(re,ue)}),this)}function oe(le,Ie){ie(le,Ie),re(le)}function re(le){le._writableState&&!le._writableState.emitClose||le._readableState&&!le._readableState.emitClose||le.emit("close")}function Ce(){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)}function ie(le,Ie){le.emit("error",Ie)}function ae(le,Ie){var ue=le._readableState,de=le._writableState;ue&&ue.autoDestroy||de&&de.autoDestroy?le.destroy(Ie):le.emit("error",Ie)}g.exports={destroy:$,undestroy:Ce,errorOrDestroy:ae}}).call(this)}).call(this,r("_process"))},{_process:50}],64:[function(r,g,V){var k=r("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function $(ie){var ae=!1;return function(){if(!ae){ae=!0;for(var le=arguments.length,Ie=new Array(le),ue=0;ue<le;ue++)Ie[ue]=arguments[ue];ie.apply(this,Ie)}}}function oe(){}function re(ie){return ie.setHeader&&typeof ie.abort=="function"}function Ce(ie,ae,le){if(typeof ae=="function")return Ce(ie,null,ae);ae||(ae={}),le=$(le||oe);var Ie=ae.readable||ae.readable!==!1&&ie.readable,ue=ae.writable||ae.writable!==!1&&ie.writable,de=function(){ie.writable||he()},Ne=ie._writableState&&ie._writableState.finished,he=function(){ue=!1,Ne=!0,Ie||le.call(ie)},pe=ie._readableState&&ie._readableState.endEmitted,ze=function(){Ie=!1,pe=!0,ue||le.call(ie)},xe=function($e){le.call(ie,$e)},Oe=function(){var $e;if(Ie&&!pe)return(!ie._readableState||!ie._readableState.ended)&&($e=new k),le.call(ie,$e);if(ue&&!Ne)return(!ie._writableState||!ie._writableState.ended)&&($e=new k),le.call(ie,$e)},_e=function(){ie.req.on("finish",he)};return re(ie)?(ie.on("complete",he),ie.on("abort",Oe),ie.req?_e():ie.on("request",_e)):ue&&!ie._writableState&&(ie.on("end",de),ie.on("close",de)),ie.on("end",ze),ie.on("finish",he),ae.error!==!1&&ie.on("error",xe),ie.on("close",Oe),function(){ie.removeListener("complete",he),ie.removeListener("abort",Oe),ie.removeListener("request",_e),ie.req&&ie.req.removeListener("finish",he),ie.removeListener("end",de),ie.removeListener("close",de),ie.removeListener("finish",he),ie.removeListener("end",ze),ie.removeListener("error",xe),ie.removeListener("close",Oe)}}g.exports=Ce},{"../../../errors":55}],65:[function(r,g,V){g.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(r,g,V){var k;function $(he){var pe=!1;return function(){pe||(pe=!0,he.apply(void 0,arguments))}}var oe=r("../../../errors").codes,re=oe.ERR_MISSING_ARGS,Ce=oe.ERR_STREAM_DESTROYED;function ie(he){if(he)throw he}function ae(he){return he.setHeader&&typeof he.abort=="function"}function le(he,pe,ze,xe){xe=$(xe);var Oe=!1;he.on("close",function(){Oe=!0}),k===void 0&&(k=r("./end-of-stream")),k(he,{readable:pe,writable:ze},function(At){if(At)return xe(At);Oe=!0,xe()});var _e=!1;return function(At){if(!Oe&&!_e){if(_e=!0,ae(he))return he.abort();if(typeof he.destroy=="function")return he.destroy();xe(At||new Ce("pipe"))}}}function Ie(he){he()}function ue(he,pe){return he.pipe(pe)}function de(he){return!he.length||typeof he[he.length-1]!="function"?ie:he.pop()}function Ne(){for(var he=arguments.length,pe=new Array(he),ze=0;ze<he;ze++)pe[ze]=arguments[ze];var xe=de(pe);if(Array.isArray(pe[0])&&(pe=pe[0]),pe.length<2)throw new re("streams");var Oe,_e=pe.map(function(At,$e){var Fe=$e<pe.length-1,Ue=$e>0;return le(At,Fe,Ue,function(Ve){Oe||(Oe=Ve),Ve&&_e.forEach(Ie),!Fe&&(_e.forEach(Ie),xe(Oe))})});return pe.reduce(ue)}g.exports=Ne},{"../../../errors":55,"./end-of-stream":64}],67:[function(r,g,V){var k=r("../../../errors").codes.ERR_INVALID_OPT_VALUE;function $(re,Ce,ie){return re.highWaterMark!=null?re.highWaterMark:Ce?re[ie]:null}function oe(re,Ce,ie,ae){var le=$(Ce,ae,ie);if(le!=null){if(!(isFinite(le)&&Math.floor(le)===le)||le<0){var Ie=ae?ie:"highWaterMark";throw new k(Ie,le)}return Math.floor(le)}return re.objectMode?16:16*1024}g.exports={getHighWaterMark:oe}},{"../../../errors":55}],68:[function(r,g,V){g.exports=r("events").EventEmitter},{events:22}],69:[function(r,g,V){V=g.exports=r("./lib/_stream_readable.js"),V.Stream=V,V.Readable=V,V.Writable=r("./lib/_stream_writable.js"),V.Duplex=r("./lib/_stream_duplex.js"),V.Transform=r("./lib/_stream_transform.js"),V.PassThrough=r("./lib/_stream_passthrough.js"),V.finished=r("./lib/internal/streams/end-of-stream.js"),V.pipeline=r("./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(r,g,V){function k(oe,re,Ce){var ie=this;this._callback=oe,this._args=Ce,this._interval=setInterval(oe,re,this._args),this.reschedule=function(ae){ae||(ae=ie._interval),ie._interval&&clearInterval(ie._interval),ie._interval=setInterval(ie._callback,ae,ie._args)},this.clear=function(){ie._interval&&(clearInterval(ie._interval),ie._interval=void 0)},this.destroy=function(){ie._interval&&clearInterval(ie._interval),ie._callback=void 0,ie._interval=void 0,ie._args=void 0}}function $(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var oe;if(arguments.length>0){oe=new Array(arguments.length-2);for(var re=0;re<oe.length;re++)oe[re]=arguments[re+2]}return new k(arguments[0],arguments[1],oe)}g.exports=$},{}],71:[function(r,g,V){g.exports=r("./index.js")()},{"./index.js":72}],72:[function(r,g,V){(function(k){(function(){g.exports=oe;function $(Ce){return Ce instanceof k?k.from(Ce):new Ce.constructor(Ce.buffer.slice(),Ce.byteOffset,Ce.length)}function oe(Ce){if(Ce=Ce||{},Ce.circles)return re(Ce);return Ce.proto?le:ae;function ie(Ie,ue){for(var de=Object.keys(Ie),Ne=new Array(de.length),he=0;he<de.length;he++){var pe=de[he],ze=Ie[pe];typeof ze!="object"||ze===null?Ne[pe]=ze:ze instanceof Date?Ne[pe]=new Date(ze):ArrayBuffer.isView(ze)?Ne[pe]=$(ze):Ne[pe]=ue(ze)}return Ne}function ae(Ie){if(typeof Ie!="object"||Ie===null)return Ie;if(Ie instanceof Date)return new Date(Ie);if(Array.isArray(Ie))return ie(Ie,ae);if(Ie instanceof Map)return new Map(ie(Array.from(Ie),ae));if(Ie instanceof Set)return new Set(ie(Array.from(Ie),ae));var ue={};for(var de in Ie)if(Object.hasOwnProperty.call(Ie,de)!==!1){var Ne=Ie[de];typeof Ne!="object"||Ne===null?ue[de]=Ne:Ne instanceof Date?ue[de]=new Date(Ne):Ne instanceof Map?ue[de]=new Map(ie(Array.from(Ne),ae)):Ne instanceof Set?ue[de]=new Set(ie(Array.from(Ne),ae)):ArrayBuffer.isView(Ne)?ue[de]=$(Ne):ue[de]=ae(Ne)}return ue}function le(Ie){if(typeof Ie!="object"||Ie===null)return Ie;if(Ie instanceof Date)return new Date(Ie);if(Array.isArray(Ie))return ie(Ie,le);if(Ie instanceof Map)return new Map(ie(Array.from(Ie),le));if(Ie instanceof Set)return new Set(ie(Array.from(Ie),le));var ue={};for(var de in Ie){var Ne=Ie[de];typeof Ne!="object"||Ne===null?ue[de]=Ne:Ne instanceof Date?ue[de]=new Date(Ne):Ne instanceof Map?ue[de]=new Map(ie(Array.from(Ne),le)):Ne instanceof Set?ue[de]=new Set(ie(Array.from(Ne),le)):ArrayBuffer.isView(Ne)?ue[de]=$(Ne):ue[de]=le(Ne)}return ue}}function re(Ce){var ie=[],ae=[];return Ce.proto?ue:Ie;function le(de,Ne){for(var he=Object.keys(de),pe=new Array(he.length),ze=0;ze<he.length;ze++){var xe=he[ze],Oe=de[xe];if(typeof Oe!="object"||Oe===null)pe[xe]=Oe;else if(Oe instanceof Date)pe[xe]=new Date(Oe);else if(ArrayBuffer.isView(Oe))pe[xe]=$(Oe);else{var _e=ie.indexOf(Oe);_e!==-1?pe[xe]=ae[_e]:pe[xe]=Ne(Oe)}}return pe}function Ie(de){if(typeof de!="object"||de===null)return de;if(de instanceof Date)return new Date(de);if(Array.isArray(de))return le(de,Ie);if(de instanceof Map)return new Map(le(Array.from(de),Ie));if(de instanceof Set)return new Set(le(Array.from(de),Ie));var Ne={};ie.push(de),ae.push(Ne);for(var he in de)if(Object.hasOwnProperty.call(de,he)!==!1){var pe=de[he];if(typeof pe!="object"||pe===null)Ne[he]=pe;else if(pe instanceof Date)Ne[he]=new Date(pe);else if(pe instanceof Map)Ne[he]=new Map(le(Array.from(pe),Ie));else if(pe instanceof Set)Ne[he]=new Set(le(Array.from(pe),Ie));else if(ArrayBuffer.isView(pe))Ne[he]=$(pe);else{var ze=ie.indexOf(pe);ze!==-1?Ne[he]=ae[ze]:Ne[he]=Ie(pe)}}return ie.pop(),ae.pop(),Ne}function ue(de){if(typeof de!="object"||de===null)return de;if(de instanceof Date)return new Date(de);if(Array.isArray(de))return le(de,ue);if(de instanceof Map)return new Map(le(Array.from(de),ue));if(de instanceof Set)return new Set(le(Array.from(de),ue));var Ne={};ie.push(de),ae.push(Ne);for(var he in de){var pe=de[he];if(typeof pe!="object"||pe===null)Ne[he]=pe;else if(pe instanceof Date)Ne[he]=new Date(pe);else if(pe instanceof Map)Ne[he]=new Map(le(Array.from(pe),ue));else if(pe instanceof Set)Ne[he]=new Set(le(Array.from(pe),ue));else if(ArrayBuffer.isView(pe))Ne[he]=$(pe);else{var ze=ie.indexOf(pe);ze!==-1?Ne[he]=ae[ze]:Ne[he]=ue(pe)}}return ie.pop(),ae.pop(),Ne}}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],73:[function(r,g,V){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var k=r("buffer"),$=k.Buffer;function oe(Ce,ie){for(var ae in Ce)ie[ae]=Ce[ae]}$.from&&$.alloc&&$.allocUnsafe&&$.allocUnsafeSlow?g.exports=k:(oe(k,V),V.Buffer=re);function re(Ce,ie,ae){return $(Ce,ie,ae)}re.prototype=Object.create($.prototype),oe($,re),re.from=function(Ce,ie,ae){if(typeof Ce=="number")throw new TypeError("Argument must not be a number");return $(Ce,ie,ae)},re.alloc=function(Ce,ie,ae){if(typeof Ce!="number")throw new TypeError("Argument must be a number");var le=$(Ce);return ie!==void 0?typeof ae=="string"?le.fill(ie,ae):le.fill(ie):le.fill(0),le},re.allocUnsafe=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return $(Ce)},re.allocUnsafeSlow=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return k.SlowBuffer(Ce)}},{buffer:17}],74:[function(r,g,V){g.exports=k;function k(oe){var re=oe._readableState;return re?re.objectMode||typeof oe._duplexState=="number"?oe.read():oe.read($(re)):null}function $(oe){return oe.buffer.length?oe.buffer.head?oe.buffer.head.data.length:oe.buffer[0].length:oe.length}},{}],75:[function(r,g,V){var k=r("safe-buffer").Buffer,$=k.isEncoding||function(_e){switch(_e=""+_e,_e&&_e.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 oe(_e){if(!_e)return"utf8";for(var At;;)switch(_e){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 _e;default:if(At)return;_e=(""+_e).toLowerCase(),At=!0}}function re(_e){var At=oe(_e);if(typeof At!="string"&&(k.isEncoding===$||!$(_e)))throw new Error("Unknown encoding: "+_e);return At||_e}V.StringDecoder=Ce;function Ce(_e){this.encoding=re(_e);var At;switch(this.encoding){case"utf16le":this.text=Ne,this.end=he,At=4;break;case"utf8":this.fillLast=Ie,At=4;break;case"base64":this.text=pe,this.end=ze,At=3;break;default:this.write=xe,this.end=Oe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=k.allocUnsafe(At)}Ce.prototype.write=function(_e){if(_e.length===0)return"";var At,$e;if(this.lastNeed){if(At=this.fillLast(_e),At===void 0)return"";$e=this.lastNeed,this.lastNeed=0}else $e=0;return $e<_e.length?At?At+this.text(_e,$e):this.text(_e,$e):At||""},Ce.prototype.end=de,Ce.prototype.text=ue,Ce.prototype.fillLast=function(_e){if(this.lastNeed<=_e.length)return _e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_e.length),this.lastNeed-=_e.length};function ie(_e){return _e<=127?0:_e>>5===6?2:_e>>4===14?3:_e>>3===30?4:_e>>6===2?-1:-2}function ae(_e,At,$e){var Fe=At.length-1;if(Fe<$e)return 0;var Ue=ie(At[Fe]);return Ue>=0?(Ue>0&&(_e.lastNeed=Ue-1),Ue):--Fe<$e||Ue===-2?0:(Ue=ie(At[Fe]),Ue>=0?(Ue>0&&(_e.lastNeed=Ue-2),Ue):--Fe<$e||Ue===-2?0:(Ue=ie(At[Fe]),Ue>=0?(Ue>0&&(Ue===2?Ue=0:_e.lastNeed=Ue-3),Ue):0))}function le(_e,At,$e){if((At[0]&192)!==128)return _e.lastNeed=0,"�";if(_e.lastNeed>1&&At.length>1){if((At[1]&192)!==128)return _e.lastNeed=1,"�";if(_e.lastNeed>2&&At.length>2&&(At[2]&192)!==128)return _e.lastNeed=2,"�"}}function Ie(_e){var At=this.lastTotal-this.lastNeed,$e=le(this,_e);if($e!==void 0)return $e;if(this.lastNeed<=_e.length)return _e.copy(this.lastChar,At,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_e.copy(this.lastChar,At,0,_e.length),this.lastNeed-=_e.length}function ue(_e,At){var $e=ae(this,_e,At);if(!this.lastNeed)return _e.toString("utf8",At);this.lastTotal=$e;var Fe=_e.length-($e-this.lastNeed);return _e.copy(this.lastChar,0,Fe),_e.toString("utf8",At,Fe)}function de(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+"�":At}function Ne(_e,At){if((_e.length-At)%2===0){var $e=_e.toString("utf16le",At);if($e){var Fe=$e.charCodeAt($e.length-1);if(Fe>=55296&&Fe<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_e[_e.length-2],this.lastChar[1]=_e[_e.length-1],$e.slice(0,-1)}return $e}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_e[_e.length-1],_e.toString("utf16le",At,_e.length-1)}function he(_e){var At=_e&&_e.length?this.write(_e):"";if(this.lastNeed){var $e=this.lastTotal-this.lastNeed;return At+this.lastChar.toString("utf16le",0,$e)}return At}function pe(_e,At){var $e=(_e.length-At)%3;return $e===0?_e.toString("base64",At):(this.lastNeed=3-$e,this.lastTotal=3,$e===1?this.lastChar[0]=_e[_e.length-1]:(this.lastChar[0]=_e[_e.length-2],this.lastChar[1]=_e[_e.length-1]),_e.toString("base64",At,_e.length-$e))}function ze(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+this.lastChar.toString("base64",0,3-this.lastNeed):At}function xe(_e){return _e.toString(this.encoding)}function Oe(_e){return _e&&_e.length?this.write(_e):""}},{"safe-buffer":73}],76:[function(r,g,V){var k=r("punycode"),$=r("./util");V.parse=At,V.resolve=Fe,V.resolveObject=Ue,V.format=$e,V.Url=oe;function oe(){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}var re=/^([a-z0-9.+-]+:)/i,Ce=/:[0-9]*$/,ie=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ae=["<",">",'"',"`"," ","\r",`
1155
+ }`,"autocompletion.css",!1),g.AcePopup=Ie,g.$singleLineEditor=le,g.getAriaId=ae}),ace.define("ace/autocomplete/util",["require","exports","module"],function(r,g,V){g.parForEach=function($,oe,re){var Ce=0,ie=$.length;ie===0&&re();for(var ae=0;ae<ie;ae++)oe($[ae],function(le,Ie){Ce++,Ce===ie&&re(le,Ie)})};var k=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;g.retrievePrecedingIdentifier=function($,oe,re){re=re||k;for(var Ce=[],ie=oe-1;ie>=0&&re.test($[ie]);ie--)Ce.push($[ie]);return Ce.reverse().join("")},g.retrieveFollowingIdentifier=function($,oe,re){re=re||k;for(var Ce=[],ie=oe;ie<$.length&&re.test($[ie]);ie++)Ce.push($[ie]);return Ce},g.getCompletionPrefix=function($){var oe=$.getCursorPosition(),re=$.session.getLine(oe.row),Ce;return $.completers.forEach(function(ie){ie.identifierRegexps&&ie.identifierRegexps.forEach(function(ae){!Ce&&ae&&(Ce=this.retrievePrecedingIdentifier(re,oe.column,ae))}.bind(this))}.bind(this)),Ce||this.retrievePrecedingIdentifier(re,oe.column)}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config"],function(r,g,V){var k=r("./keyboard/hash_handler").HashHandler,$=r("./autocomplete/popup").AcePopup,oe=r("./autocomplete/popup").getAriaId,re=r("./autocomplete/util"),Ce=r("./lib/lang"),ie=r("./lib/dom"),ae=r("./snippets").snippetManager,le=r("./config"),Ie=function(){this.autoInsert=!1,this.autoSelect=!0,this.exactMatch=!1,this.gatherCompletionsId=0,this.keyboardHandler=new k,this.keyboardHandler.bindKeys(this.commands),this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.changeTimer=Ce.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=Ce.delayedCall(this.updateDocTooltip.bind(this),50)};(function(){this.$init=function(){return this.popup=new $(document.body||document.documentElement),this.popup.on("click",function(de){this.insertMatch(),de.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.tooltipTimer.bind(null,null)),this.popup.on("select",this.tooltipTimer.bind(null,null)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup},this.getPopup=function(){return this.popup||this.$init()},this.openPopup=function(de,Ne,he){this.popup||this.$init(),this.popup.autoSelect=this.autoSelect,this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions({activeDescendant:oe(this.popup.getRow())}),de.keyBinding.addKeyboardHandler(this.keyboardHandler);var pe=de.renderer;if(this.popup.setRow(this.autoSelect?0:-1),he)he&&!Ne&&this.detach();else{this.popup.setTheme(de.getTheme()),this.popup.setFontSize(de.getFontSize());var ze=pe.layerConfig.lineHeight,xe=pe.$cursorLayer.getPixelPosition(this.base,!0);xe.left-=this.popup.getTextLeftOffset();var Oe=de.container.getBoundingClientRect();xe.top+=Oe.top-pe.layerConfig.offset,xe.left+=Oe.left-de.renderer.scrollLeft,xe.left+=pe.gutterWidth,this.popup.show(xe,ze)}this.changeTimer.cancel()},this.detach=function(){this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener),this.changeTimer.cancel(),this.hideDocTooltip(),this.gatherCompletionsId+=1,this.popup&&this.popup.isOpen&&this.popup.hide(),this.base&&this.base.detach(),this.activated=!1,this.completions=this.base=null},this.changeListener=function(de){var Ne=this.editor.selection.lead;(Ne.row!=this.base.row||Ne.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},this.blurListener=function(de){var Ne=document.activeElement,he=this.editor.textInput.getElement(),pe=de.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(de.relatedTarget),ze=this.popup&&this.popup.container;Ne!=he&&Ne.parentNode!=ze&&!pe&&Ne!=this.tooltipNode&&de.relatedTarget!=he&&this.detach()},this.mousedownListener=function(de){this.detach()},this.mousewheelListener=function(de){this.detach()},this.goTo=function(de){this.popup.goTo(de)},this.insertMatch=function(de,Ne){if(de||(de=this.popup.getData(this.popup.getRow())),!de)return!1;var he=this.completions;if(this.editor.startOperation({command:{name:"insertMatch"}}),de.completer&&de.completer.insertMatch)de.completer.insertMatch(this.editor,de);else{if(!he)return!1;if(he.filterText)for(var pe=this.editor.selection.getAllRanges(),ze=0,xe;xe=pe[ze];ze++)xe.start.column-=he.filterText.length,this.editor.session.remove(xe);de.snippet?ae.insertSnippet(this.editor,de.snippet):this.editor.execCommand("insertstring",de.value||de)}this.completions==he&&this.detach(),this.editor.endOperation()},this.commands={Up:function(de){de.completer.goTo("up")},Down:function(de){de.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(de){de.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(de){de.completer.goTo("end")},Esc:function(de){de.completer.detach()},Return:function(de){return de.completer.insertMatch()},"Shift-Return":function(de){de.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(de){var Ne=de.completer.insertMatch();if(!Ne&&!de.tabstopManager)de.completer.goTo("down");else return Ne},PageUp:function(de){de.completer.popup.gotoPageUp()},PageDown:function(de){de.completer.popup.gotoPageDown()}},this.gatherCompletions=function(de,Ne){var he=de.getSession(),pe=de.getCursorPosition(),ze=re.getCompletionPrefix(de);this.base=he.doc.createAnchor(pe.row,pe.column-ze.length),this.base.$insertRight=!0;var xe=[],Oe=de.completers.length;return de.completers.forEach(function(_e,At){_e.getCompletions(de,he,pe,ze,function($e,Fe){!$e&&Fe&&(xe=xe.concat(Fe)),Ne(null,{prefix:re.getCompletionPrefix(de),matches:xe,finished:--Oe===0})})}),!0},this.showPopup=function(de,Ne){this.editor&&this.detach(),this.activated=!0,this.editor=de,de.completer!=this&&(de.completer&&de.completer.detach(),de.completer=this),de.on("changeSelection",this.changeListener),de.on("blur",this.blurListener),de.on("mousedown",this.mousedownListener),de.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,Ne)},this.updateCompletions=function(de,Ne){if(de&&this.base&&this.completions){var he=this.editor.getCursorPosition(),pe=this.editor.session.getTextRange({start:this.base,end:he});if(pe==this.completions.filterText)return;if(this.completions.setFilter(pe),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==pe&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,pe,de);return}if(Ne&&Ne.matches){var he=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(he.row,he.column),this.base.$insertRight=!0,this.completions=new ue(Ne.matches),this.openPopup(this.editor,"",de)}var ze=this.gatherCompletionsId,xe=function(Fe){if(Fe.finished)return this.detach()}.bind(this),Oe=function(Fe){var Ue=Fe.prefix,Ve=Fe.matches;this.completions=new ue(Ve),this.exactMatch&&(this.completions.exactMatch=!0),this.completions.setFilter(Ue);var Dt=this.completions.filtered;if(!Dt.length||Dt.length==1&&Dt[0].value==Ue&&!Dt[0].snippet)return xe(Fe);if(this.autoInsert&&Dt.length==1&&Fe.finished)return this.insertMatch(Dt[0]);this.openPopup(this.editor,Ue,de)}.bind(this),_e=!0,At=null;if(this.gatherCompletions(this.editor,function(Fe,Ue){var Ve=Ue.prefix,Dt=Ue&&Ue.matches;if(!Dt||!Dt.length)return xe(Ue);if(!(Ve.indexOf(Ue.prefix)!==0||ze!=this.gatherCompletionsId)){if(_e){At=Ue;return}Oe(Ue)}}.bind(this)),_e=!1,At){var $e=At;At=null,Oe($e)}},this.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},this.updateDocTooltip=function(){var de=this.popup,Ne=de.data,he=Ne&&(Ne[de.getHoveredRow()]||Ne[de.getRow()]),pe=null;if(!he||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();if(this.editor.completers.some(function(ze){return ze.getDocTooltip&&(pe=ze.getDocTooltip(he)),pe}),!pe&&typeof he!="string"&&(pe=he),typeof pe=="string"&&(pe={docText:pe}),!pe||!(pe.docHTML||pe.docText))return this.hideDocTooltip();this.showDocTooltip(pe)},this.showDocTooltip=function(de){this.tooltipNode||(this.tooltipNode=ie.createElement("div"),this.tooltipNode.className="ace_tooltip ace_doc-tooltip",this.tooltipNode.style.margin=0,this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this));var Ne=this.tooltipNode;de.docHTML?Ne.innerHTML=de.docHTML:de.docText&&(Ne.textContent=de.docText),Ne.parentNode||document.body.appendChild(Ne);var he=this.popup,pe=he.container.getBoundingClientRect();Ne.style.top=he.container.style.top,Ne.style.bottom=he.container.style.bottom,Ne.style.display="block",window.innerWidth-pe.right<320?pe.left<320?he.isTopdown?(Ne.style.top=pe.bottom+"px",Ne.style.left=pe.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.top=he.container.offsetTop-Ne.offsetHeight+"px",Ne.style.left=pe.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.right=window.innerWidth-pe.left+"px",Ne.style.left=""):(Ne.style.left=pe.right+1+"px",Ne.style.right="")},this.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var de=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==de&&this.editor.focus(),this.tooltipNode=null,de.parentNode&&de.parentNode.removeChild(de)}},this.onTooltipClick=function(de){for(var Ne=de.target;Ne&&Ne!=this.tooltipNode;){if(Ne.nodeName=="A"&&Ne.href){Ne.rel="noreferrer",Ne.target="_blank";break}Ne=Ne.parentNode}},this.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var de=this.popup.container;de&&de.parentNode&&de.parentNode.removeChild(de)}this.editor&&this.editor.completer==this&&this.editor.completer==null,this.popup=null}}).call(Ie.prototype),Ie.for=function(de){return de.completer||(le.get("sharedPopups")?(Ie.$shared||(Ie.$sharedInstance=new Ie),de.completer=Ie.$sharedInstance):(de.completer=new Ie,de.once("destroy",function(Ne,he){he.completer.destroy()}))),de.completer},Ie.startCommand={name:"startAutocomplete",exec:function(de,Ne){var he=Ie.for(de);he.autoInsert=!1,he.autoSelect=!0,he.showPopup(de,Ne),he.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var ue=function(de,Ne){this.all=de,this.filtered=de,this.filterText=Ne||"",this.exactMatch=!1};(function(){this.setFilter=function(de){if(de.length>this.filterText&&de.lastIndexOf(this.filterText,0)===0)var Ne=this.filtered;else var Ne=this.all;this.filterText=de,Ne=this.filterCompletions(Ne,this.filterText),Ne=Ne.sort(function(pe,ze){return ze.exactMatch-pe.exactMatch||ze.$score-pe.$score||(pe.caption||pe.value).localeCompare(ze.caption||ze.value)});var he=null;Ne=Ne.filter(function(pe){var ze=pe.snippet||pe.caption||pe.value;return ze===he?!1:(he=ze,!0)}),this.filtered=Ne},this.filterCompletions=function(de,Ne){var he=[],pe=Ne.toUpperCase(),ze=Ne.toLowerCase();e:for(var xe=0,Oe;Oe=de[xe];xe++){var _e=Oe.caption||Oe.value||Oe.snippet;if(_e){var At=-1,$e=0,Fe=0,Ue,Ve;if(this.exactMatch){if(Ne!==_e.substr(0,Ne.length))continue e}else{var Dt=_e.toLowerCase().indexOf(ze);if(Dt>-1)Fe=Dt;else for(var qe=0;qe<Ne.length;qe++){var kt=_e.indexOf(ze[qe],At+1),jt=_e.indexOf(pe[qe],At+1);if(Ue=kt>=0&&(jt<0||kt<jt)?kt:jt,Ue<0)continue e;Ve=Ue-At-1,Ve>0&&(At===-1&&(Fe+=10),Fe+=Ve,$e=$e|1<<qe),At=Ue}}Oe.matchMask=$e,Oe.exactMatch=Fe?0:1,Oe.$score=(Oe.score||0)-Fe,he.push(Oe)}}return he}}).call(ue.prototype),g.Autocomplete=Ie,g.FilteredList=ue}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(r,g,V){var k=r("../range").Range,$=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function oe(Ce,ie){var ae=Ce.getTextRange(k.fromPoints({row:0,column:0},ie));return ae.split($).length-1}function re(Ce,ie){var ae=oe(Ce,ie),le=Ce.getValue().split($),Ie=Object.create(null),ue=le[ae];return le.forEach(function(de,Ne){if(!(!de||de===ue)){var he=Math.abs(ae-Ne),pe=le.length-he;Ie[de]?Ie[de]=Math.max(pe,Ie[de]):Ie[de]=pe}}),Ie}g.getCompletions=function(Ce,ie,ae,le,Ie){var ue=re(ie,ae),de=Object.keys(ue);Ie(null,de.map(function(Ne){return{caption:Ne,value:Ne,score:ue[Ne],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(r,g,V){var k=r("../snippets").snippetManager,$=r("../autocomplete").Autocomplete,oe=r("../config"),re=r("../lib/lang"),Ce=r("../autocomplete/util"),ie=r("../autocomplete/text_completer"),ae={getCompletions:function(Oe,_e,At,$e,Fe){if(_e.$mode.completer)return _e.$mode.completer.getCompletions(Oe,_e,At,$e,Fe);var Ue=Oe.session.getState(At.row),Ve=_e.$mode.getCompletions(Ue,_e,At,$e);Fe(null,Ve)}},le=function(Oe){var _e={};return Oe.replace(/\${(\d+)(:(.*?))?}/g,function(At,$e,Fe,Ue){return _e[$e]=Ue||""}).replace(/\$(\d+?)/g,function(At,$e){return _e[$e]})},Ie={getCompletions:function(Oe,_e,At,$e,Fe){var Ue=[],Ve=_e.getTokenAt(At.row,At.column);Ve&&Ve.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?Ue.push("html-tag"):Ue=k.getActiveScopes(Oe);var Dt=k.snippetMap,qe=[];Ue.forEach(function(kt){for(var jt=Dt[kt]||[],Pt=jt.length;Pt--;){var ti=jt[Pt],ei=ti.name||ti.tabTrigger;ei&&qe.push({caption:ei,snippet:ti.content,meta:ti.tabTrigger&&!ti.name?ti.tabTrigger+"⇥ ":"snippet",type:"snippet"})}},this),Fe(null,qe)},getDocTooltip:function(Oe){Oe.type=="snippet"&&!Oe.docHTML&&(Oe.docHTML=["<b>",re.escapeHTML(Oe.caption),"</b>","<hr></hr>",re.escapeHTML(le(Oe.snippet))].join(""))}},ue=[Ie,ie,ae];g.setCompleters=function(Oe){ue.length=0,Oe&&ue.push.apply(ue,Oe)},g.addCompleter=function(Oe){ue.push(Oe)},g.textCompleter=ie,g.keyWordCompleter=ae,g.snippetCompleter=Ie;var de={name:"expandSnippet",exec:function(Oe){return k.expandWithTab(Oe)},bindKey:"Tab"},Ne=function(Oe,_e){he(_e.session.$mode)},he=function(Oe){typeof Oe=="string"&&(Oe=oe.$modes[Oe]),Oe&&(k.files||(k.files={}),pe(Oe.$id,Oe.snippetFileId),Oe.modes&&Oe.modes.forEach(he))},pe=function(Oe,_e){!_e||!Oe||k.files[Oe]||(k.files[Oe]={},oe.loadModule(_e,function(At){At&&(k.files[Oe]=At,!At.snippets&&At.snippetText&&(At.snippets=k.parseSnippetFile(At.snippetText)),k.register(At.snippets||[],At.scope),At.includeScopes&&(k.snippetMap[At.scope].includeScopes=At.includeScopes,At.includeScopes.forEach(function($e){he("ace/mode/"+$e)})))}))},ze=function(Oe){var _e=Oe.editor,At=_e.completer&&_e.completer.activated;if(Oe.command.name==="backspace")At&&!Ce.getCompletionPrefix(_e)&&_e.completer.detach();else if(Oe.command.name==="insertstring"){var $e=Ce.getCompletionPrefix(_e);if($e&&!At){var Fe=$.for(_e);Fe.autoInsert=!1,Fe.showPopup(_e)}}},xe=r("../editor").Editor;r("../config").defineOptions(xe.prototype,"editor",{enableBasicAutocompletion:{set:function(Oe){Oe?(this.completers||(this.completers=Array.isArray(Oe)?Oe:ue),this.commands.addCommand($.startCommand)):this.commands.removeCommand($.startCommand)},value:!1},enableLiveAutocompletion:{set:function(Oe){Oe?(this.completers||(this.completers=Array.isArray(Oe)?Oe:ue),this.commands.on("afterExec",ze)):this.commands.removeListener("afterExec",ze)},value:!1},enableSnippets:{set:function(Oe){Oe?(this.commands.addCommand(de),this.on("changeMode",Ne),Ne(null,this)):(this.commands.removeCommand(de),this.off("changeMode",Ne))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(r){i&&(i.exports=r)})}()})(extLanguage_tools),ace$1.config.setModuleUrl("ace/theme/github",themeUrl),ace$1.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace$1.config.setModuleUrl("ace/mode/base",workerBaseUrl),ace$1.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace$1.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl),ace$1.config.setModuleUrl("ace/snippets/json",snippetsJsonUrl),ace$1.config.setModuleUrl("ace/mode/javascript",modeJavascriptUrl),ace$1.config.setModuleUrl("ace/mode/javascript_worker",workerJavascriptUrl),ace$1.config.setModuleUrl("ace/snippets/javascript",snippetsJavascriptUrl),ace$1.require("ace/ext/language_tools");const _sfc_main$c=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.ref(!1),V=vue.computed({get(){return r.lang==="json"?JSON.stringify(r.modelValue,null,2):r.modelValue},set(k){r.lang==="json"?n("update:modelValue",JSON.parse(k)):n("update:modelValue",k)}});return(k,$)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElButton),{onClick:$[0]||($[0]=oe=>g.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(g),"onUpdate:modelValue":$[2]||($[2]=oe=>vue.isRef(g)?g.value=oe:null),title:r.title,width:"60%"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(V),"onUpdate:value":$[1]||($[1]=oe=>vue.isRef(V)?V.value=oe:null),lang:r.lang,theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value","lang"])]),_:1},8,["modelValue","title"])]))}}),_hoisted_1$7={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$5={key:1},_hoisted_3$5={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$3={key:1},_sfc_main$b=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},setup(i){const n=i;return(r,g)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.objInfo,(V,k)=>(vue.openBlock(),vue.createElementBlock("div",{key:k},[n.code?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(k))>78?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:String(k),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(k),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(k),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(V.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:JSON.stringify(V.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$5,vue.toDisplayString(V.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString(V.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),n.hide.indexOf(String(k))<0?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:V.title,size:"small"},{default:vue.withCtx(()=>[V.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElSelect),{key:0,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,placeholder:"Select",size:"small",disabled:!!(V!=null&&V.disabled)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(V.options,$=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:$.value,label:$.label,value:$.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(ElInputNumber),{key:1,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:2,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:3,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,autosize:"",type:"textarea",disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(ElColorPicker),{key:4,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(ElSwitch),{key:5,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$c,{key:6,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_9e624fb4_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc(_sfc_main$b,[["__scopeId","data-v-9e624fb4"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$4=["onMouseenter","onClick"],_sfc_main$a=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:n}){const r=i,g=vue.ref(r.val),V=vue.ref(!1),k=vue.ref("进入"),$=vue.ref(null),oe=re=>{n("updateCommonAniVal",re),V.value=!1};return vue.watch(()=>r.val,re=>{g.value=re}),(re,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.unref(g)?(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:0,closable:"",onClose:Ce[0]||(Ce[0]=ie=>oe("")),onClick:Ce[1]||(Ce[1]=ie=>V.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var ie;return[vue.createTextVNode(vue.toDisplayString((ie=vue.unref(common_animate_list).map(ae=>ae.children).reduce((ae,le)=>ae.concat(le)).find(ae=>ae.value==vue.unref(g)))==null?void 0:ie.label)+" ",1),vue.createVNode(vue.unref(ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:Ce[2]||(Ce[2]=ie=>V.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(ElDrawer),{modelValue:vue.unref(V),"onUpdate:modelValue":Ce[5]||(Ce[5]=ie=>vue.isRef(V)?V.value=ie:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabs),{modelValue:vue.unref(k),"onUpdate:modelValue":Ce[4]||(Ce[4]=ie=>vue.isRef(k)?k.value=ie:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),ie=>(vue.openBlock(),vue.createBlock(vue.unref(ElTabPane),{label:ie.label,name:ie.label,key:ie.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(ie.children,(ae,le)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:le,onMouseenter:Ie=>$.value=le,onMouseleave:Ce[3]||(Ce[3]=Ie=>$.value=null),onClick:Ie=>oe(ae.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref($)==le?`animate__animated animate__${ae.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(ae.label),3)],40,_hoisted_3$4))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2807ad45_lang="",CommonAnimate=_export_sfc(_sfc_main$a,[["__scopeId","data-v-2807ad45"]]),_sfc_main$9=vue.defineComponent({__name:"index",setup(i){var k;const n=useGlobalStore(pinia),r=vue.ref(((k=n.handle_svg_info)==null?void 0:k.info.id)||""),g=$=>{for(let oe of n.done_json)oe.selected=!1,oe.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo($)},V={children:"children",label:"title"};return($,oe)=>(vue.openBlock(),vue.createBlock(vue.unref(ElTree),{data:vue.unref(n).done_json,props:V,onNodeClick:g,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!0,"node-key":"id","current-node-key":vue.unref(r)},null,8,["data","current-node-key"]))}}),_withScopeId$1=i=>(vue.pushScopeId("data-v-ecd64a91"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$3=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$8=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.computed({get(){return r.modelValue},set($){n("update:modelValue",$)}}),V=()=>{g.value.push({key:"",val:""})},k=$=>{g.value.splice($,1)};return($,oe)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$3,_hoisted_4$2,vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:V},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),(re,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:re.key,"onUpdate:modelValue":ie=>re.key=ie,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:re.val,"onUpdate:modelValue":ie=>re.val=ie,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:ie=>k(Ce)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_ecd64a91_lang="",List=_export_sfc(_sfc_main$8,[["__scopeId","data-v-ecd64a91"]]),_hoisted_1$4={class:"c-wall-d"},_sfc_main$7=vue.defineComponent({__name:"condition",props:{modelValue:{default:()=>({type:EConditionType.None})}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.computed({get(){return r.modelValue},set($){n("update:modelValue",$)}}),V=[{label:"大于",val:"greater"},{label:"大于等于",val:">="},{label:"小于",val:"<"},{label:"小于等于",val:"<="},{label:"等于",val:"=="},{label:"不等于",val:"!="},{label:"介于",val:">=,=<"},{label:"不介于",val:"<,>"}],k=$=>{$!=="None"&&(g.value.Relation={key:"",relation:"",val:"",val2:""}),n("update:modelValue",g)};return($,oe)=>{var re,Ce;return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$4,[vue.createVNode(vue.unref(ElFormItem),{label:"条件",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(g).type,"onUpdate:modelValue":oe[0]||(oe[0]=ie=>vue.unref(g).type=ie),onChange:k},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"None",label:"无"}),vue.createVNode(vue.unref(ElOption),{value:"Relation",label:"关系运算"})]),_:1},8,["modelValue"])]),_:1}),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"属性",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.key,"onUpdate:modelValue":oe[1]||(oe[1]=ie=>vue.unref(g).Relation.key=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"关系",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(g).Relation.relation,"onUpdate:modelValue":oe[2]||(oe[2]=ie=>vue.unref(g).Relation.relation=ie)},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(V,(ie,ae)=>vue.createVNode(vue.unref(ElOption),{value:ie.val,label:ie.label,key:"rop"+ae},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"值",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.val,"onUpdate:modelValue":oe[3]||(oe[3]=ie=>vue.unref(g).Relation.val=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"&&(((re=vue.unref(g).Relation)==null?void 0:re.relation)===">=,=<"||((Ce=vue.unref(g).Relation)==null?void 0:Ce.relation)==="<,>")?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:3,label:"值2",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.val2,"onUpdate:modelValue":oe[4]||(oe[4]=ie=>vue.unref(g).Relation.val2=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)])}}}),condition_vue_vue_type_style_index_0_scoped_f43f10e6_lang="",Condition=_export_sfc(_sfc_main$7,[["__scopeId","data-v-f43f10e6"]]),_sfc_main$6=vue.defineComponent({__name:"bind-anchor",props:{modelValue:{},title:{}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=useGlobalStore(pinia),V=vue.computed({get(){return r.modelValue!==null},set(ie){let ae=null;ie&&(ae={target_id:"",type:""}),n("update:modelValue",ae)}}),k=vue.computed({get(){var ie;return((ie=r.modelValue)==null?void 0:ie.target_id)??void 0},set(ie){let ae=null;V.value&&(ae={target_id:ie,type:$.value}),n("update:modelValue",ae)}}),$=vue.computed({get(){var ie;return((ie=r.modelValue)==null?void 0:ie.type)??void 0},set(ie){let ae=null;V.value&&(ae={target_id:k.value,type:ie}),n("update:modelValue",ae)}}),oe=vue.computed(()=>g.done_json.filter(ie=>ie.type!==EDoneJsonType.ConnectionLine).map(ie=>({label:ie.title,value:ie.id}))),re=[{label:"上锚点",value:ELineBindAnchors.TopCenter},{label:"右锚点",value:ELineBindAnchors.Right},{label:"下锚点",value:ELineBindAnchors.BottomCenter},{label:"左锚点",value:ELineBindAnchors.Left}];function Ce(){vue.nextTick(function(){var ie,ae;if(V.value&&((ie=r.modelValue)!=null&&ie.target_id)&&((ae=r.modelValue)!=null&&ae.type)&&g.handle_svg_info){let le=null;for(let Ie of g.done_json)Ie.id===r.modelValue.target_id&&(le=Ie);le&&(setSvgActualInfo(le),moveAnchors(le))}})}return(ie,ae)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(vue.unref(ElFormItem),{label:r.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(V),"onUpdate:modelValue":ae[0]||(ae[0]=le=>vue.isRef(V)?V.value=le:null),onChange:Ce},null,8,["modelValue"])]),_:1},8,["label"]),vue.unref(V)?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"绑定对象",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(k),"onUpdate:modelValue":ae[1]||(ae[1]=le=>vue.isRef(k)?k.value=le:null),onChange:Ce},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oe),le=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(V)?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"绑定位置",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref($),"onUpdate:modelValue":ae[2]||(ae[2]=le=>vue.isRef($)?$.value=le:null),onChange:Ce},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(re,le=>vue.createVNode(vue.unref(ElOption),{key:le.value,label:le.label,value:le.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)],64))}}),_withScopeId=i=>(vue.pushScopeId("data-v-e838d4f0"),i=i(),vue.popScopeId(),i),_hoisted_1$3=_withScopeId(()=>vue.createElementVNode("span",{style:{"font-weight":"bold"}},"MQTT",-1)),_hoisted_2$2={key:1},_hoisted_3$2={class:"events-title"},_sfc_main$5=vue.defineComponent({__name:"index",setup(i){const n=useConfigStore(pinia),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=vue.ref("page"),k=vue.ref("style"),$=(ue,de)=>{ue!=null&&ue.common_animations&&(ue.common_animations.val=de)};n.$subscribe((ue,de)=>{ue.storeId==="config-store"&&localStorage.setItem("svg-editor-config",JSON.stringify(de))});const oe=vue.ref(numberArray(20)),re=vue.ref(["MQTT"]),Ce=vue.ref();Ce.value=()=>{var de,Ne;let ue={type:EEventType.Null,action:EEventAction.Null,target:"",scripts:"",condition:{type:EConditionType.None}};(Ne=(de=r.handle_svg_info)==null?void 0:de.info)==null||Ne.events.push(ue)};const ie=(ue,de)=>{ue==="ChangeAttr"?de.attrs=[{key:"",val:""}]:delete de.attrs},ae=ue=>{var de,Ne;(Ne=(de=r.handle_svg_info)==null?void 0:de.info)==null||Ne.events.splice(ue,1)},le=()=>{g.center_offset={x:0,y:0}},Ie=()=>{if(r.handle_svg_info){const ue=r.done_json[r.handle_svg_info.index];vue.nextTick(function(){setSvgActualInfo(ue),moveAnchors(ue)})}};return(ue,de)=>vue.unref(r).intention!=vue.unref(EGlobalStoreIntention).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:0,class:"mx-2 rightTabs",modelValue:vue.unref(V),"onUpdate:modelValue":de[13]||(de[13]=Ne=>vue.isRef(V)?V.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabPane),{label:"图纸",name:"page"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"背景色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElColorPicker),{modelValue:vue.unref(n).svg.background_color,"onUpdate:modelValue":de[0]||(de[0]=Ne=>vue.unref(n).svg.background_color=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"画布",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{size:"small",onClick:le,icon:vue.unref(aim_default)},{default:vue.withCtx(()=>[vue.createTextVNode("重置位置")]),_:1},8,["icon"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(g).center_offset.x,"onUpdate:modelValue":de[1]||(de[1]=Ne=>vue.unref(g).center_offset.x=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(g).center_offset.y,"onUpdate:modelValue":de[2]||(de[2]=Ne=>vue.unref(g).center_offset.y=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(n).svg.scale,"onUpdate:modelValue":de[3]||(de[3]=Ne=>vue.unref(n).svg.scale=Ne),step:.1,"step-strictly":""},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"标尺",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(n).svg.ruler,"onUpdate:modelValue":de[4]||(de[4]=Ne=>vue.unref(n).svg.ruler=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"网格",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(n).svg.grid,"onUpdate:modelValue":de[5]||(de[5]=Ne=>vue.unref(n).svg.grid=Ne)},null,8,["modelValue"])]),_:1}),vue.unref(n).svg.grid?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"网格颜色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElColorPicker),{modelValue:vue.unref(n).svg.grid_color,"onUpdate:modelValue":de[6]||(de[6]=Ne=>vue.unref(n).svg.grid_color=Ne)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"连线",name:"line"},{default:vue.withCtx(()=>[vue.unref(n).connection_line.props?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(n).connection_line.props,hide:["point_position"]},null,8,["obj-info"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(n).connection_line.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:vue.unref(n).connection_line.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(n).connection_line.animations.type.val,"onUpdate:modelValue":de[7]||(de[7]=Ne=>vue.unref(n).connection_line.animations.type.val=Ne),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).connection_line.animations.type.options,Ne=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:Ne.value,label:Ne.label,value:Ne.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),vue.unref(n).connection_line.animations.type.val!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:0,"obj-info":vue.unref(n).connection_line.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0)]),_:1})):vue.createCommentVNode("",!0)]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"通信",name:"net"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(re),"onUpdate:modelValue":de[12]||(de[12]=Ne=>vue.isRef(re)?re.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapseItem),{name:"MQTT"},{title:vue.withCtx(()=>[_hoisted_1$3]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"URL",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.url,"onUpdate:modelValue":de[8]||(de[8]=Ne=>vue.unref(n).net.mqtt.url=Ne),placeholder:"如 ws://127.0.0.1:4500"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"用户名",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.user,"onUpdate:modelValue":de[9]||(de[9]=Ne=>vue.unref(n).net.mqtt.user=Ne),placeholder:"username"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"密码",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.pwd,"onUpdate:modelValue":de[10]||(de[10]=Ne=>vue.unref(n).net.mqtt.pwd=Ne),placeholder:"password"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Topics",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.topics,"onUpdate:modelValue":de[11]||(de[11]=Ne=>vue.unref(n).net.mqtt.topics=Ne),placeholder:"topics"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$9)]),_:1})]),_:1},8,["modelValue"])):vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Select&&vue.unref(r).handle_svg_info?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:1,class:"mx-2 rightTabs",modelValue:vue.unref(k),"onUpdate:modelValue":de[32]||(de[32]=Ne=>vue.isRef(k)?k.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabPane),{label:"外观",name:"style"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"标题",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.title,"onUpdate:modelValue":de[14]||(de[14]=Ne=>vue.unref(r).handle_svg_info.info.title=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.x,"onUpdate:modelValue":de[15]||(de[15]=Ne=>vue.unref(r).handle_svg_info.info.x=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.y,"onUpdate:modelValue":de[16]||(de[16]=Ne=>vue.unref(r).handle_svg_info.info.y=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.scale_x,"onUpdate:modelValue":de[17]||(de[17]=Ne=>vue.unref(r).handle_svg_info.info.scale_x=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.scale_y,"onUpdate:modelValue":de[18]||(de[18]=Ne=>vue.unref(r).handle_svg_info.info.scale_y=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"旋转",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.rotate,"onUpdate:modelValue":de[19]||(de[19]=Ne=>vue.unref(r).handle_svg_info.info.rotate=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"显示",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(r).handle_svg_info.info.display,"onUpdate:modelValue":de[20]||(de[20]=Ne=>vue.unref(r).handle_svg_info.info.display=Ne)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"数据",name:"data"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>{var Ne,he,pe,ze;return[vue.createVNode(vue.unref(ElFormItem),{label:"ID",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.id,"onUpdate:modelValue":de[21]||(de[21]=xe=>vue.unref(r).handle_svg_info.info.id=xe)},null,8,["modelValue"])]),_:1}),vue.unref(r).handle_svg_info.info.state?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(vue.unref(r).handle_svg_info.info.state,(xe,Oe)=>{var _e;return vue.openBlock(),vue.createElementBlock("div",{key:"state"+String(Oe)},[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:String(Oe),size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(xe.default),1)]),_:2},1032,["label"]),Oe==="OnOff"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:(_e=vue.unref(r).handle_svg_info.info.state)==null?void 0:_e.OnOff.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(r).handle_svg_info.info.state.OnOff.default,"onUpdate:modelValue":de[22]||(de[22]=At=>vue.unref(r).handle_svg_info.info.state.OnOff.default=At)},null,8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0)])}),128)):vue.createCommentVNode("",!0),(Ne=vue.unref(r).handle_svg_info.info)!=null&&Ne.hasOwnProperty("tag_slot")?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$2,[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:"tag_slot",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(r).handle_svg_info.info.tag_slot),1)]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"文字插槽",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.tag_slot,"onUpdate:modelValue":de[23]||(de[23]=xe=>vue.unref(r).handle_svg_info.info.tag_slot=xe)},null,8,["modelValue"])]),_:1})])):vue.createCommentVNode("",!0),vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.props,code:""},null,8,["obj-info"]),vue.unref(r).handle_svg_info.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:vue.unref(r).handle_svg_info.info.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.animations.type.val,"onUpdate:modelValue":de[24]||(de[24]=xe=>vue.unref(r).handle_svg_info.info.animations.type.val=xe),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.animations.type.options,xe=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:xe.value,label:xe.label,value:xe.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0),((he=vue.unref(r).handle_svg_info.info.animations)==null?void 0:he.type.val)!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:3,"obj-info":vue.unref(r).handle_svg_info.info.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0),((pe=vue.unref(r).handle_svg_info)==null?void 0:pe.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:4,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.start,"onUpdate:modelValue":de[25]||(de[25]=xe=>vue.unref(r).handle_svg_info.info.bind_anchors.start=xe),title:"绑定起点"},null,8,["modelValue"])):vue.createCommentVNode("",!0),((ze=vue.unref(r).handle_svg_info)==null?void 0:ze.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:5,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.end,"onUpdate:modelValue":de[26]||(de[26]=xe=>vue.unref(r).handle_svg_info.info.bind_anchors.end=xe),title:"绑定终点"},null,8,["modelValue"])):vue.createCommentVNode("",!0)]}),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"事件",name:"event"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{type:"primary",style:{width:"100%"},onClick:vue.unref(Ce)},{default:vue.withCtx(()=>[vue.createTextVNode("添加事件")]),_:1},8,["onClick"]),vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(oe),"onUpdate:modelValue":de[27]||(de[27]=Ne=>vue.isRef(oe)?oe.value=Ne:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.events,(Ne,he)=>(vue.openBlock(),vue.createBlock(vue.unref(ElCollapseItem),{name:he,key:"event"+he},{title:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$2,[vue.createElementVNode("span",null,"事件"+vue.toDisplayString(he+1),1),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:vue.withModifiers(pe=>ae(he),["stop"])},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"delete"})]),_:2},1032,["onClick"])])]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"类型",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:Ne.type,"onUpdate:modelValue":pe=>Ne.type=pe},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"Click",label:"点击"}),vue.createVNode(vue.unref(ElOption),{value:"Change",label:"值改变"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),vue.createVNode(vue.unref(ElFormItem),{label:"行为",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:Ne.action,"onUpdate:modelValue":pe=>Ne.action=pe,onChange:pe=>ie(pe,Ne)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"ChangeAttr",label:"改变属性"}),vue.createVNode(vue.unref(ElOption),{value:"JavaScript",label:"执行JavaScript"})]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),Ne.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"目标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:Ne.target,"onUpdate:modelValue":pe=>Ne.target=pe,placeholder:"默认自身"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),Ne.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(List,{key:1,modelValue:Ne.attrs,"onUpdate:modelValue":pe=>Ne.attrs=pe},null,8,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0),Ne.action==="JavaScript"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"JavaScript",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$c,{modelValue:Ne.scripts,"onUpdate:modelValue":pe=>Ne.scripts=pe,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:Ne.condition,"onUpdate:modelValue":pe=>Ne.condition=pe},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"动效",name:"animation"},{default:vue.withCtx(()=>{var Ne;return[(Ne=vue.unref(r).handle_svg_info)!=null&&Ne.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.animations},null,8,["obj-info"])]),_:1})):vue.unref(r).handle_svg_info.info.common_animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"动画效果",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(CommonAnimate,{onUpdateCommonAniVal:de[28]||(de[28]=he=>{var pe;return $((pe=vue.unref(r).handle_svg_info)==null?void 0:pe.info,he)}),val:vue.unref(r).handle_svg_info.info.common_animations.val},null,8,["val"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"延迟",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.delay,"onUpdate:modelValue":de[29]||(de[29]=he=>vue.unref(r).handle_svg_info.info.common_animations.delay=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"delay-0s",label:"无"}),vue.createVNode(vue.unref(ElOption),{value:"delay-1s",label:"1秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-2s",label:"2秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-3s",label:"3秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-4s",label:"4秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-5s",label:"5秒"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"动画速度",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.speed,"onUpdate:modelValue":de[30]||(de[30]=he=>vue.unref(r).handle_svg_info.info.common_animations.speed=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"slow",label:"慢"}),vue.createVNode(vue.unref(ElOption),{value:"slower",label:"最慢"}),vue.createVNode(vue.unref(ElOption),{value:"fast",label:"快"}),vue.createVNode(vue.unref(ElOption),{value:"faster",label:"最快"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"循环次数",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.repeat,"onUpdate:modelValue":de[31]||(de[31]=he=>vue.unref(r).handle_svg_info.info.common_animations.repeat=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"repeat-1",label:"一次"}),vue.createVNode(vue.unref(ElOption),{value:"repeat-2",label:"两次"}),vue.createVNode(vue.unref(ElOption),{value:"repeat-3",label:"三次"}),vue.createVNode(vue.unref(ElOption),{value:"infinite",label:"无限次"})]),_:1},8,["modelValue"])]),_:1})]),_:1})):vue.createCommentVNode("",!0)]}),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$9)]),_:1})]),_:1},8,["modelValue"])):vue.createCommentVNode("",!0)}}),index_vue_vue_type_style_index_0_scoped_e838d4f0_lang="",index_vue_vue_type_style_index_1_lang="",RightPanel=_export_sfc(_sfc_main$5,[["__scopeId","data-v-e838d4f0"]]),_sfc_main$4=vue.defineComponent({__name:"index",setup(i){const n=vue.ref(""),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=useConfigStore(pinia);return vue.onMounted(()=>{const k={layout_center:g.center_offset,config:V.$state,done_json:r.done_json};n.value=JSON.stringify(k,null,2)}),(k,$)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(n),"onUpdate:value":$[0]||($[0]=oe=>vue.isRef(n)?n.value=oe:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_sfc_main$3=vue.defineComponent({__name:"index",setup(i,{expose:n}){const r=vue.ref("");return n({setVal:k=>{r.value=k},onImportJson:()=>{useImportDataModel(r.value)&&ElMessage.success("导入成功")}}),(k,$)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(r),"onUpdate:value":$[0]||($[0]=oe=>vue.isRef(r)?r.value=oe:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_hoisted_1$2=["onMousedown"],_hoisted_2$1=["onMousedown"],_hoisted_3$1=["title","onMousedown"],_hoisted_4$1={class:"vue-ruler-content-mask"},_sfc_main$2=vue.defineComponent({__name:"index",props:{visible:{type:Boolean,default:!0},stepLength:{default:100}},setup(i){const n=i,r=useSvgEditLayoutStore(pinia),g=useConfigStore(pinia),V=function(){return function(ci,Ai,yi){ci&&Ai&&yi&&ci.addEventListener(Ai,yi,!1)}}(),k=function(){return function(ci,Ai,yi){ci&&Ai&&ci.removeEventListener(Ai,yi,!1)}}();let $=18,oe=vue.ref(0),re=vue.ref(0),Ce=vue.ref([]),ie=vue.ref([]);const ae=vue.ref([]);let le=vue.ref(!1),Ie="",ue=vue.ref(-999),de=vue.ref(-999),Ne=18,he=18,pe="";const ze=vue.ref(null),xe=vue.ref(null),Oe=vue.ref(null),_e=vue.ref(null),At=vue.computed(()=>({width:oe.value+"px",height:re.value+"px"})),$e=vue.computed(()=>({padding:$+"px 0px 0px "+$+"px"})),Fe=vue.computed(()=>{let ci=0,Ai=0;return ae.value.map(yi=>{const ui=yi.type==="h";return{id:`${yi.type}_${ui?ci++:Ai++}`,type:yi.type,title:yi.site.toFixed(0)+"px",[ui?"top":"left"]:yi.site*g.svg.scale+$+r.center_offset[ui?"y":"x"]*g.svg.scale}})});r.$subscribe(ci=>{var Ai,yi,ui,Ci;((yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("left_nav")||(Ci=(ui=ci.events)==null?void 0:ui.target)!=null&&Ci.hasOwnProperty("right_nav"))&&window.setTimeout(Ue,420)}),g.$subscribe(ci=>{var Ai,yi;(yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("scale")&&jt()}),vue.onMounted(()=>{V(document,"mousemove",ti),V(document,"mouseup",ni),Ue(),V(window,"resize",Ve)}),vue.onBeforeUnmount(()=>{k(document,"mousemove",ti),k(document,"mouseup",ni),k(window,"resize",Ve)});const Ue=()=>{kt(),jt()},Ve=()=>{Ce.value=[],ie.value=[],Ue()},Dt=({type:ci,top:Ai,left:yi})=>ci==="h"?{top:Ai+"px"}:{left:yi+"px"},qe=({type:ci,id:Ai})=>ci==="h"?di(Ai):hi(Ai),kt=()=>{const ci=window.getComputedStyle(xe.value.parentNode,null);oe.value=parseInt(ci.getPropertyValue("width")),re.value=parseInt(ci.getPropertyValue("height")),Ne=Oe.value.clientWidth,he=_e.value.clientHeight},jt=()=>{Pt(Ce.value,oe.value,r.center_offset.x),Pt(ie.value,re.value,r.center_offset.y)},Pt=(ci,Ai,yi)=>{if(ci.length===0)for(let ui=0;ui<Ai;ui+=n.stepLength)ui%n.stepLength===0&&ci.push({id:Number((ui/g.svg.scale-yi).toFixed(0))});else ci.forEach((ui,Ci)=>{ui.id=Number((Ci*n.stepLength/g.svg.scale-yi).toFixed(0))})},ti=ci=>{jt(),ei(ci)},ei=ci=>{if(!(ci.layerX===ci.x||ci.layerY===ci.y))switch(Ie){case"x":le.value&&(de.value=ci.layerY);break;case"y":le.value&&(ue.value=ci.layerX);break;case"h":le.value&&(de.value=ci.layerY);break;case"v":le.value&&(ue.value=ci.layerX);break}},Lt=ci=>{le.value=!0,Ie=ci},ni=ci=>{ri(ci)},ri=ci=>{if(le.value){switch(le.value=!1,Ie){case"x":const Ai=Math.round((ci.layerY-$)/g.svg.scale-r.center_offset.y);if(Ai<=0){de.value=-999;return}ae.value.push({type:"h",site:Ai});break;case"y":const yi=Math.round((ci.layerX-$)/g.svg.scale-r.center_offset.x);if(yi<=0){ue.value=-999;return}ae.value.push({type:"v",site:yi});break;case"h":Ii(ae.value,Math.round((ci.layerY-$)/g.svg.scale-r.center_offset.y),Math.round(he/g.svg.scale-r.center_offset.y),"h");break;case"v":Ii(ae.value,Math.round((ci.layerX-$)/g.svg.scale-r.center_offset.x),Math.round(Ne/g.svg.scale-r.center_offset.x),"v");break}de.value=ue.value=-999}},Ii=(ci,Ai,yi,ui)=>{if(Ai<yi){let Ci;Fe.value.forEach((zi,Ni)=>{zi.id===pe&&(Ci=Ni)}),ci.splice(Ci,1)}else{let Ci;Fe.value.forEach((zi,Ni)=>{zi.id===pe&&(Ci=Ni)}),ci.splice(Ci,1,{type:ui,site:Ai})}},wi=()=>{Lt("x")},ai=()=>{Lt("y")},di=ci=>{le.value=!0,Ie="h",pe=ci},hi=ci=>{le.value=!0,Ie="v",pe=ci};return(ci,Ai)=>(vue.openBlock(),vue.createElementBlock("div",{style:vue.normalizeStyle(vue.unref(At)),class:"vue-ruler-wrapper",onselectStart:"return false;",ref_key:"el",ref:xe},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref_key:"horizontalRuler",ref:_e,class:"vue-ruler-h",onMousedown:vue.withModifiers(wi,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Ce),(yi,ui)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({left:ui*ci.stepLength+"px"}),class:"n"},vue.toDisplayString(yi.id),5))),256))],40,_hoisted_1$2),vue.createElementVNode("div",{ref_key:"verticalRuler",ref:Oe,class:"vue-ruler-v",onMousedown:vue.withModifiers(ai,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(ie),(yi,ui)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({top:ui*ci.stepLength+"px"}),class:"n"},vue.toDisplayString(yi.id),5))),256))],40,_hoisted_2$1),vue.createElementVNode("div",{style:vue.normalizeStyle({top:vue.unref(de)+"px"}),class:"vue-ruler-ref-dot-h"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(de)-vue.unref(he))/vue.unref(g).svg.scale)),1)],4),vue.createElementVNode("div",{style:vue.normalizeStyle({left:vue.unref(ue)+"px"}),class:"vue-ruler-ref-dot-v"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(ue)-vue.unref(Ne))/vue.unref(g).svg.scale)),1)],4),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Fe),yi=>(vue.openBlock(),vue.createElementBlock("div",{title:yi.title,style:vue.normalizeStyle(Dt(yi)),key:yi.id,class:vue.normalizeClass(`vue-ruler-ref-line-${yi.type}`),onMousedown:ui=>qe(yi)},null,46,_hoisted_3$1))),128))],512),[[vue.vShow,n.visible]]),vue.createElementVNode("div",{ref_key:"content",ref:ze,class:"vue-ruler-content",style:vue.normalizeStyle(vue.unref($e))},[vue.renderSlot(ci.$slots,"default")],4),vue.withDirectives(vue.createElementVNode("div",_hoisted_4$1,null,512),[[vue.vShow,vue.unref(le)]])],4))}}),index_vue_vue_type_style_index_0_lang="";function fileWrite(i,n=new Date(Date.now()).toLocaleString()){const r=JSON.stringify(i),g=new Blob([r]);let V=document.createElement("a");V.download=n+".json",V.style.display="none",V.href=URL.createObjectURL(g),document.body.appendChild(V),V.click(),document.body.removeChild(V)}function fileRead(i){return new Promise((n,r)=>{let g=new FileReader;g.readAsText(i,"UTF-8"),g.onload=function(V){V&&V.target?n(V.target.result):r("文件读取错误")}})}const _hoisted_1$1={class:"canvas-main-pc"},_sfc_main$1=vue.defineComponent({__name:"index",props:{customToolbar:{},data:{},saveFile:{type:Boolean,default:!1}},emits:["onReturn","onPreview","onSave"],setup(i,{expose:n,emit:r}){const g=i,V=useGlobalStore(pinia),k=useSvgEditLayoutStore(pinia),$=useConfigStore(pinia),oe=useEditPrivateStore(pinia),re=vue.ref(),Ce=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),ie=(he,pe)=>{Ce[he]=pe},ae=vue.ref();ae.value=()=>{re.value.onImportJson(),ie(EVisibleConfKey.ImportJson,!1)};const le=he=>["text/plain","application/json"].indexOf(he.type)<0?(ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(he).then(pe=>{re.value.setVal(pe),ElMessage.success("文件读取成功!")}),!1),Ie=he=>{V.setDoneJson(he)};vue.onMounted(()=>{oe.history_doneComponent=[],oe.history_now_index=0,g.data?useImportDataModel(g.data):V.setDoneJson([]),V.intention=EGlobalStoreIntention.None});const{appContext:ue}=vue.getCurrentInstance();function de(he){r("onReturn",{data:he,isChange:oe.getTopBtnUndoStatus})}function Ne(he){g.saveFile?ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},ue).then(pe=>{fileWrite(he,pe.value.trim()),r("onSave",he)}).catch(pe=>{console.log(pe)}):r("onSave",he)}return n({setGraphNodeJson:Ie}),(he,pe)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElContainer),null,{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElHeader),{class:"top-el-header"},{default:vue.withCtx(()=>[vue.createVNode(TopPanel,{onChangeVisible:ie,onOnReturn:de,onOnPreview:pe[0]||(pe[0]=ze=>r("onPreview",ze)),onOnSave:Ne})]),_:1}),vue.createVNode(vue.unref(ElContainer),{class:"middle"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(k).left_nav?"show-nav":"hide-nav"]),style:{"border-right":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(LeftPanel,{class:"content-left","custom-toolbar":g.customToolbar},null,8,["custom-toolbar"])]),_:1})]),_:1},8,["class"]),vue.createVNode(vue.unref(ElMain),{class:"middle main"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$1,[vue.createVNode(_sfc_main$2,{class:"canvas-main-pc",visible:vue.unref($).svg.ruler},{default:vue.withCtx(()=>[vue.createVNode(CenterPanel)]),_:1},8,["visible"])])]),_:1}),vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(k).right_nav?"show-nav":"hide-nav"]),style:{"border-left":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(RightPanel)]),_:1})]),_:1},8,["class"])]),_:1})]),_:1}),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(Ce).ImportJson,"onUpdate:modelValue":pe[2]||(pe[2]=ze=>vue.unref(Ce).ImportJson=ze),title:"导入数据",width:"60%","destroy-on-close":""},{footer:vue.withCtx(()=>[vue.createVNode(vue.unref(ElUpload),{beforeUpload:le,style:{display:"inline-flex","margin-right":"12px"},multiple:!1,"show-file-list":!1,limit:1},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{onClick:pe[1]||(pe[1]=ze=>ie(vue.unref(EVisibleConfKey).ImportFile,!0))},{default:vue.withCtx(()=>[vue.createTextVNode("读取文件")]),_:1})]),_:1}),vue.createVNode(vue.unref(ElButton),{type:"primary",onClick:vue.unref(ae)},{default:vue.withCtx(()=>[vue.createTextVNode("导入数据")]),_:1},8,["onClick"])]),default:vue.withCtx(()=>[vue.createVNode(_sfc_main$3,{ref_key:"importJsonRef",ref:re},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(Ce).ExportJson,"onUpdate:modelValue":pe[3]||(pe[3]=ze=>vue.unref(Ce).ExportJson=ze),title:"导出",width:"60%","destroy-on-close":""},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$4)]),_:1},8,["modelValue"])]))}}),index_vue_vue_type_style_index_0_scoped_0e4bf78d_lang="",index$1=_export_sfc(_sfc_main$1,[["__scopeId","data-v-0e4bf78d"]]);function commonjsRequire(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var mqtt={exports:{}};(function(i,n){(function(r){i.exports=r()})(function(){return function(){function r(g,V,k){function $(Ce,ie){if(!V[Ce]){if(!g[Ce]){var ae=typeof commonjsRequire=="function"&&commonjsRequire;if(!ie&&ae)return ae(Ce,!0);if(oe)return oe(Ce,!0);var le=new Error("Cannot find module '"+Ce+"'");throw le.code="MODULE_NOT_FOUND",le}var Ie=V[Ce]={exports:{}};g[Ce][0].call(Ie.exports,function(ue){var de=g[Ce][1][ue];return $(de||ue)},Ie,Ie.exports,r,g,V,k)}return V[Ce].exports}for(var oe=typeof commonjsRequire=="function"&&commonjsRequire,re=0;re<k.length;re++)$(k[re]);return $}return r}()({1:[function(r,g,V){(function(k,$){(function(){const oe=r("events").EventEmitter,re=r("./store"),Ce=r("./topic-alias-recv"),ie=r("./topic-alias-send"),ae=r("mqtt-packet"),le=r("./default-message-id-provider"),Ie=r("readable-stream").Writable,ue=r("inherits"),de=r("reinterval"),Ne=r("rfdc/default"),he=r("./validations"),pe=r("xtend"),ze=r("debug")("mqttjs:client"),xe=k?k.nextTick:function(ei){setTimeout(ei,0)},Oe=$.setImmediate||function(ei){xe(ei)},_e={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},At=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],$e={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 Fe(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function Ue(ei,Lt){if(ei.options.protocolVersion===5&&Lt.cmd==="publish"){let ni;Lt.properties&&(ni=Lt.properties.topicAlias);const ri=Lt.topic.toString();if(ei.topicAliasSend)if(ni){if(ri.length!==0&&(ze("applyTopicAlias :: register topic: %s - alias: %d",ri,ni),!ei.topicAliasSend.put(ri,ni)))return ze("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}else ri.length!==0&&(ei.options.autoAssignTopicAlias?(ni=ei.topicAliasSend.getAliasByTopic(ri),ni?(Lt.topic="",Lt.properties={...Lt.properties,topicAlias:ni},ze("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",ri,ni)):(ni=ei.topicAliasSend.getLruAlias(),ei.topicAliasSend.put(ri,ni),Lt.properties={...Lt.properties,topicAlias:ni},ze("applyTopicAlias :: auto assign topic: %s - alias: %d",ri,ni))):ei.options.autoUseTopicAlias&&(ni=ei.topicAliasSend.getAliasByTopic(ri),ni&&(Lt.topic="",Lt.properties={...Lt.properties,topicAlias:ni},ze("applyTopicAlias :: auto use topic: %s - alias: %d",ri,ni))));else if(ni)return ze("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}}function Ve(ei,Lt){let ni;Lt.properties&&(ni=Lt.properties.topicAlias);let ri=Lt.topic.toString();if(ri.length===0){if(typeof ni>"u")return new Error("Unregistered Topic Alias");if(ri=ei.topicAliasSend.getTopicByAlias(ni),typeof ri>"u")return new Error("Unregistered Topic Alias");Lt.topic=ri}ni&&delete Lt.properties.topicAlias}function Dt(ei,Lt,ni){ze("sendPacket :: packet: %O",Lt),ze("sendPacket :: emitting `packetsend`"),ei.emit("packetsend",Lt),ze("sendPacket :: writing to stream");const ri=ae.writeToStream(Lt,ei.stream,ei.options);ze("sendPacket :: writeToStream result %s",ri),!ri&&ni&&ni!==Pt?(ze("sendPacket :: handle events on `drain` once through callback."),ei.stream.once("drain",ni)):ni&&(ze("sendPacket :: invoking cb"),ni())}function qe(ei){ei&&(ze("flush: queue exists? %b",!!ei),Object.keys(ei).forEach(function(Lt){typeof ei[Lt].cb=="function"&&(ei[Lt].cb(new Error("Connection closed")),delete ei[Lt])}))}function kt(ei){ei&&(ze("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(ei).forEach(function(Lt){ei[Lt].volatile&&typeof ei[Lt].cb=="function"&&(ei[Lt].cb(new Error("Connection closed")),delete ei[Lt])}))}function jt(ei,Lt,ni,ri){ze("storeAndSend :: store packet with cmd %s to outgoingStore",Lt.cmd);let Ii=Lt,wi;if(Ii.cmd==="publish"&&(Ii=Ne(Lt),wi=Ve(ei,Ii),wi))return ni&&ni(wi);ei.outgoingStore.put(Ii,function(di){if(di)return ni&&ni(di);ri(),Dt(ei,Lt,ni)})}function Pt(ei){ze("nop ::",ei)}function ti(ei,Lt){let ni;const ri=this;if(!(this instanceof ti))return new ti(ei,Lt);this.options=Lt||{};for(ni in _e)typeof this.options[ni]>"u"?this.options[ni]=_e[ni]:this.options[ni]=Lt[ni];ze("MqttClient :: options.protocol",Lt.protocol),ze("MqttClient :: options.protocolVersion",Lt.protocolVersion),ze("MqttClient :: options.username",Lt.username),ze("MqttClient :: options.keepalive",Lt.keepalive),ze("MqttClient :: options.reconnectPeriod",Lt.reconnectPeriod),ze("MqttClient :: options.rejectUnauthorized",Lt.rejectUnauthorized),ze("MqttClient :: options.topicAliasMaximum",Lt.topicAliasMaximum),this.options.clientId=typeof Lt.clientId=="string"?Lt.clientId:Fe(),ze("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=Lt.protocolVersion===5&&Lt.customHandleAcks?Lt.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=ei,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new le:this.options.messageIdProvider,this.outgoingStore=Lt.outgoingStore||new re,this.incomingStore=Lt.incomingStore||new re,this.queueQoSZero=Lt.queueQoSZero===void 0?!0:Lt.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,Lt.topicAliasMaximum>0&&(Lt.topicAliasMaximum>65535?ze("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new Ce(Lt.topicAliasMaximum)),this.on("connect",function(){const Ii=this.queue;function wi(){const ai=Ii.shift();ze("deliver :: entry %o",ai);let di=null;if(!ai){ri._resubscribe();return}di=ai.packet,ze("deliver :: call _sendPacket for %o",di);let hi=!0;di.messageId&&di.messageId!==0&&(ri.messageIdProvider.register(di.messageId)||(hi=!1)),hi?ri._sendPacket(di,function(ci){ai.cb&&ai.cb(ci),wi()}):(ze("messageId: %d has already used. The message is skipped and removed.",di.messageId),wi())}ze("connect :: sending queued packets"),wi()}),this.on("close",function(){ze("close :: connected set to `false`"),this.connected=!1,ze("close :: clearing connackTimer"),clearTimeout(this.connackTimer),ze("close :: clearing ping timer"),ri.pingTimer!==null&&(ri.pingTimer.clear(),ri.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),ze("close :: calling _setupReconnect"),this._setupReconnect()}),oe.call(this),ze("MqttClient :: setting up stream"),this._setupStream()}ue(ti,oe),ti.prototype._setupStream=function(){const ei=this,Lt=new Ie,ni=ae.parser(this.options);let ri=null;const Ii=[];ze("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),ze("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),ni.on("packet",function(ci){ze("parser :: on packet push to packets array."),Ii.push(ci)});function wi(){if(Ii.length)xe(ai);else{const ci=ri;ri=null,ci()}}function ai(){ze("work :: getting next packet in queue");const ci=Ii.shift();if(ci)ze("work :: packet pulled from queue"),ei._handlePacket(ci,wi);else{ze("work :: no packets in queue");const Ai=ri;ri=null,ze("work :: done flag is %s",!!Ai),Ai&&Ai()}}Lt._write=function(ci,Ai,yi){ri=yi,ze("writable stream :: parsing buffer"),ni.parse(ci),ai()};function di(ci){ze("streamErrorHandler :: error",ci.message),At.includes(ci.code)?(ze("streamErrorHandler :: emitting error"),ei.emit("error",ci)):Pt(ci)}ze("_setupStream :: pipe stream to writable stream"),this.stream.pipe(Lt),this.stream.on("error",di),this.stream.on("close",function(){ze("(%s)stream :: on close",ei.options.clientId),kt(ei.outgoing),ze("stream: emit close to MqttClient"),ei.emit("close")}),ze("_setupStream: sending packet `connect`");const hi=Object.create(this.options);if(hi.cmd="connect",this.topicAliasRecv&&(hi.properties||(hi.properties={}),this.topicAliasRecv&&(hi.properties.topicAliasMaximum=this.topicAliasRecv.max)),Dt(this,hi),ni.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return ei.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){const ci=pe({cmd:"auth",reasonCode:0},this.options.authPacket);Dt(this,ci)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){ze("!!connectTimeout hit!! Calling _cleanUp with force `true`"),ei._cleanUp(!0)},this.options.connectTimeout)},ti.prototype._handlePacket=function(ei,Lt){const ni=this.options;if(ni.protocolVersion===5&&ni.properties&&ni.properties.maximumPacketSize&&ni.properties.maximumPacketSize<ei.length)return this.emit("error",new Error("exceeding packets size "+ei.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(ze("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",ei),ei.cmd){case"publish":this._handlePublish(ei,Lt);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(ei),Lt();break;case"pubrel":this._handlePubrel(ei,Lt);break;case"connack":this._handleConnack(ei),Lt();break;case"auth":this._handleAuth(ei),Lt();break;case"pingresp":this._handlePingresp(ei),Lt();break;case"disconnect":this._handleDisconnect(ei),Lt();break}},ti.prototype._checkDisconnecting=function(ei){return this.disconnecting&&(ei&&ei!==Pt?ei(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},ti.prototype.publish=function(ei,Lt,ni,ri){ze("publish :: message `%s` to topic `%s`",Lt,ei);const Ii=this.options;if(typeof ni=="function"&&(ri=ni,ni=null),ni=pe({qos:0,retain:!1,dup:!1},ni),this._checkDisconnecting(ri))return this;const ai=this,di=function(){let hi=0;if((ni.qos===1||ni.qos===2)&&(hi=ai._nextId(),hi===null))return ze("No messageId left"),!1;const ci={cmd:"publish",topic:ei,payload:Lt,qos:ni.qos,retain:ni.retain,messageId:hi,dup:ni.dup};switch(Ii.protocolVersion===5&&(ci.properties=ni.properties),ze("publish :: qos",ni.qos),ni.qos){case 1:case 2:ai.outgoing[ci.messageId]={volatile:!1,cb:ri||Pt},ze("MqttClient:publish: packet cmd: %s",ci.cmd),ai._sendPacket(ci,void 0,ni.cbStorePut);break;default:ze("MqttClient:publish: packet cmd: %s",ci.cmd),ai._sendPacket(ci,ri,ni.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!di())&&this._storeProcessingQueue.push({invoke:di,cbStorePut:ni.cbStorePut,callback:ri}),this},ti.prototype.subscribe=function(){const ei=this,Lt=new Array(arguments.length);for(let yi=0;yi<arguments.length;yi++)Lt[yi]=arguments[yi];const ni=[];let ri=Lt.shift();const Ii=ri.resubscribe;let wi=Lt.pop()||Pt,ai=Lt.pop();const di=this.options.protocolVersion;delete ri.resubscribe,typeof ri=="string"&&(ri=[ri]),typeof wi!="function"&&(ai=wi,wi=Pt);const hi=he.validateTopics(ri);if(hi!==null)return Oe(wi,new Error("Invalid topic "+hi)),this;if(this._checkDisconnecting(wi))return ze("subscribe: discconecting true"),this;const ci={qos:0};if(di===5&&(ci.nl=!1,ci.rap=!1,ci.rh=0),ai=pe(ci,ai),Array.isArray(ri)?ri.forEach(function(yi){if(ze("subscribe: array topic %s",yi),!Object.prototype.hasOwnProperty.call(ei._resubscribeTopics,yi)||ei._resubscribeTopics[yi].qos<ai.qos||Ii){const ui={topic:yi,qos:ai.qos};di===5&&(ui.nl=ai.nl,ui.rap=ai.rap,ui.rh=ai.rh,ui.properties=ai.properties),ze("subscribe: pushing topic `%s` and qos `%s` to subs list",ui.topic,ui.qos),ni.push(ui)}}):Object.keys(ri).forEach(function(yi){if(ze("subscribe: object topic %s",yi),!Object.prototype.hasOwnProperty.call(ei._resubscribeTopics,yi)||ei._resubscribeTopics[yi].qos<ri[yi].qos||Ii){const ui={topic:yi,qos:ri[yi].qos};di===5&&(ui.nl=ri[yi].nl,ui.rap=ri[yi].rap,ui.rh=ri[yi].rh,ui.properties=ai.properties),ze("subscribe: pushing `%s` to subs list",ui),ni.push(ui)}}),!ni.length)return wi(null,[]),this;const Ai=function(){const yi=ei._nextId();if(yi===null)return ze("No messageId left"),!1;const ui={cmd:"subscribe",subscriptions:ni,qos:1,retain:!1,dup:!1,messageId:yi};if(ai.properties&&(ui.properties=ai.properties),ei.options.resubscribe){ze("subscribe :: resubscribe true");const Ci=[];ni.forEach(function(zi){if(ei.options.reconnectPeriod>0){const Ni={qos:zi.qos};di===5&&(Ni.nl=zi.nl||!1,Ni.rap=zi.rap||!1,Ni.rh=zi.rh||0,Ni.properties=zi.properties),ei._resubscribeTopics[zi.topic]=Ni,Ci.push(zi.topic)}}),ei.messageIdToTopic[ui.messageId]=Ci}return ei.outgoing[ui.messageId]={volatile:!0,cb:function(Ci,zi){if(!Ci){const Ni=zi.granted;for(let Mi=0;Mi<Ni.length;Mi+=1)ni[Mi].qos=Ni[Mi]}wi(Ci,ni)}},ze("subscribe :: call _sendPacket"),ei._sendPacket(ui),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Ai())&&this._storeProcessingQueue.push({invoke:Ai,callback:wi}),this},ti.prototype.unsubscribe=function(){const ei=this,Lt=new Array(arguments.length);for(let di=0;di<arguments.length;di++)Lt[di]=arguments[di];let ni=Lt.shift(),ri=Lt.pop()||Pt,Ii=Lt.pop();typeof ni=="string"&&(ni=[ni]),typeof ri!="function"&&(Ii=ri,ri=Pt);const wi=he.validateTopics(ni);if(wi!==null)return Oe(ri,new Error("Invalid topic "+wi)),this;if(ei._checkDisconnecting(ri))return this;const ai=function(){const di=ei._nextId();if(di===null)return ze("No messageId left"),!1;const hi={cmd:"unsubscribe",qos:1,messageId:di};return typeof ni=="string"?hi.unsubscriptions=[ni]:Array.isArray(ni)&&(hi.unsubscriptions=ni),ei.options.resubscribe&&hi.unsubscriptions.forEach(function(ci){delete ei._resubscribeTopics[ci]}),typeof Ii=="object"&&Ii.properties&&(hi.properties=Ii.properties),ei.outgoing[hi.messageId]={volatile:!0,cb:ri},ze("unsubscribe: call _sendPacket"),ei._sendPacket(hi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ai())&&this._storeProcessingQueue.push({invoke:ai,callback:ri}),this},ti.prototype.end=function(ei,Lt,ni){const ri=this;ze("end :: (%s)",this.options.clientId),(ei==null||typeof ei!="boolean")&&(ni=Lt||Pt,Lt=ei,ei=!1,typeof Lt!="object"&&(ni=Lt,Lt=null,typeof ni!="function"&&(ni=Pt))),typeof Lt!="object"&&(ni=Lt,Lt=null),ze("end :: cb? %s",!!ni),ni=ni||Pt;function Ii(){ze("end :: closeStores: closing incoming and outgoing stores"),ri.disconnected=!0,ri.incomingStore.close(function(ai){ri.outgoingStore.close(function(di){if(ze("end :: closeStores: emitting end"),ri.emit("end"),ni){const hi=ai||di;ze("end :: closeStores: invoking callback with args"),ni(hi)}})}),ri._deferredReconnect&&ri._deferredReconnect()}function wi(){ze("end :: (%s) :: finish :: calling _cleanUp with force %s",ri.options.clientId,ei),ri._cleanUp(ei,()=>{ze("end :: finish :: calling process.nextTick on closeStores"),xe(Ii.bind(ri))},Lt)}return this.disconnecting?(ni(),this):(this._clearReconnect(),this.disconnecting=!0,!ei&&Object.keys(this.outgoing).length>0?(ze("end :: (%s) :: calling finish in 10ms once outgoing is empty",ri.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,wi,10))):(ze("end :: (%s) :: immediately calling finish",ri.options.clientId),wi()),this)},ti.prototype.removeOutgoingMessage=function(ei){const Lt=this.outgoing[ei]?this.outgoing[ei].cb:null;return delete this.outgoing[ei],this.outgoingStore.del({messageId:ei},function(){Lt(new Error("Message removed"))}),this},ti.prototype.reconnect=function(ei){ze("client reconnect");const Lt=this,ni=function(){ei?(Lt.options.incomingStore=ei.incomingStore,Lt.options.outgoingStore=ei.outgoingStore):(Lt.options.incomingStore=null,Lt.options.outgoingStore=null),Lt.incomingStore=Lt.options.incomingStore||new re,Lt.outgoingStore=Lt.options.outgoingStore||new re,Lt.disconnecting=!1,Lt.disconnected=!1,Lt._deferredReconnect=null,Lt._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=ni:ni(),this},ti.prototype._reconnect=function(){ze("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),ze("client already connected. disconnecting first.")):(ze("_reconnect: calling _setupStream"),this._setupStream())},ti.prototype._setupReconnect=function(){const ei=this;!ei.disconnecting&&!ei.reconnectTimer&&ei.options.reconnectPeriod>0?(this.reconnecting||(ze("_setupReconnect :: emit `offline` state"),this.emit("offline"),ze("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),ze("_setupReconnect :: setting reconnectTimer for %d ms",ei.options.reconnectPeriod),ei.reconnectTimer=setInterval(function(){ze("reconnectTimer :: reconnect triggered!"),ei._reconnect()},ei.options.reconnectPeriod)):ze("_setupReconnect :: doing nothing...")},ti.prototype._clearReconnect=function(){ze("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},ti.prototype._cleanUp=function(ei,Lt){const ni=arguments[2];if(Lt&&(ze("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",Lt)),ze("_cleanUp :: forced? %s",ei),ei)this.options.reconnectPeriod===0&&this.options.clean&&qe(this.outgoing),ze("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const ri=pe({cmd:"disconnect"},ni);ze("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(ri,Oe.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(ze("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(ze("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),Lt&&!this.connected&&(ze("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",Lt),Lt())},ti.prototype._sendPacket=function(ei,Lt,ni){ze("_sendPacket :: (%s) :: start",this.options.clientId),ni=ni||Pt,Lt=Lt||Pt;const ri=Ue(this,ei);if(ri){Lt(ri);return}if(!this.connected){if(ei.cmd==="auth"){this._shiftPingInterval(),Dt(this,ei,Lt);return}ze("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(ei,Lt,ni);return}switch(this._shiftPingInterval(),ei.cmd){case"publish":break;case"pubrel":jt(this,ei,Lt,ni);return;default:Dt(this,ei,Lt);return}switch(ei.qos){case 2:case 1:jt(this,ei,Lt,ni);break;case 0:default:Dt(this,ei,Lt);break}ze("_sendPacket :: (%s) :: end",this.options.clientId)},ti.prototype._storePacket=function(ei,Lt,ni){ze("_storePacket :: packet: %o",ei),ze("_storePacket :: cb? %s",!!Lt),ni=ni||Pt;let ri=ei;if(ri.cmd==="publish"){ri=Ne(ei);const Ii=Ve(this,ri);if(Ii)return Lt&&Lt(Ii)}(ri.qos||0)===0&&this.queueQoSZero||ri.cmd!=="publish"?this.queue.push({packet:ri,cb:Lt}):ri.qos>0?(Lt=this.outgoing[ri.messageId]?this.outgoing[ri.messageId].cb:null,this.outgoingStore.put(ri,function(Ii){if(Ii)return Lt&&Lt(Ii);ni()})):Lt&&Lt(new Error("No connection to broker"))},ti.prototype._setupPingTimer=function(){ze("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const ei=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=de(function(){ei._checkPing()},this.options.keepalive*1e3))},ti.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)},ti.prototype._checkPing=function(){ze("_checkPing :: checking ping..."),this.pingResp?(ze("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(ze("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},ti.prototype._handlePingresp=function(){this.pingResp=!0},ti.prototype._handleConnack=function(ei){ze("_handleConnack");const Lt=this.options,ri=Lt.protocolVersion===5?ei.reasonCode:ei.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,ei.properties){if(ei.properties.topicAliasMaximum){if(ei.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}ei.properties.topicAliasMaximum>0&&(this.topicAliasSend=new ie(ei.properties.topicAliasMaximum))}ei.properties.serverKeepAlive&&Lt.keepalive&&(Lt.keepalive=ei.properties.serverKeepAlive,this._shiftPingInterval()),ei.properties.maximumPacketSize&&(Lt.properties||(Lt.properties={}),Lt.properties.maximumPacketSize=ei.properties.maximumPacketSize)}if(ri===0)this.reconnecting=!1,this._onConnect(ei);else if(ri>0){const Ii=new Error("Connection refused: "+$e[ri]);Ii.code=ri,this.emit("error",Ii)}},ti.prototype._handleAuth=function(ei){const ni=this.options.protocolVersion,ri=ni===5?ei.reasonCode:ei.returnCode;if(ni!==5){const wi=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+ni);wi.code=ri,this.emit("error",wi);return}const Ii=this;this.handleAuth(ei,function(wi,ai){if(wi){Ii.emit("error",wi);return}if(ri===24)Ii.reconnecting=!1,Ii._sendPacket(ai);else{const di=new Error("Connection refused: "+$e[ri]);wi.code=ri,Ii.emit("error",di)}})},ti.prototype.handleAuth=function(ei,Lt){Lt()},ti.prototype._handlePublish=function(ei,Lt){ze("_handlePublish: packet %o",ei),Lt=typeof Lt<"u"?Lt:Pt;let ni=ei.topic.toString();const ri=ei.payload,Ii=ei.qos,wi=ei.messageId,ai=this,di=this.options,hi=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let ci;if(ei.properties&&(ci=ei.properties.topicAlias),typeof ci<"u")if(ni.length===0)if(ci>0&&ci<=65535){const Ai=this.topicAliasRecv.getTopicByAlias(ci);if(Ai)ni=Ai,ze("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",ni,ci);else{ze("_handlePublish :: unregistered topic alias. alias: %d",ci),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{ze("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(ni,ci))ze("_handlePublish :: registered topic: %s - alias: %d",ni,ci);else{ze("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(ze("_handlePublish: qos %d",Ii),Ii){case 2:{di.customHandleAcks(ni,ri,ei,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return ai.emit("error",ci);if(hi.indexOf(Ai)===-1)return ai.emit("error",new Error("Wrong reason code for pubrec"));Ai?ai._sendPacket({cmd:"pubrec",messageId:wi,reasonCode:Ai},Lt):ai.incomingStore.put(ei,function(){ai._sendPacket({cmd:"pubrec",messageId:wi},Lt)})});break}case 1:{di.customHandleAcks(ni,ri,ei,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return ai.emit("error",ci);if(hi.indexOf(Ai)===-1)return ai.emit("error",new Error("Wrong reason code for puback"));Ai||ai.emit("message",ni,ri,ei),ai.handleMessage(ei,function(yi){if(yi)return Lt&&Lt(yi);ai._sendPacket({cmd:"puback",messageId:wi,reasonCode:Ai},Lt)})});break}case 0:this.emit("message",ni,ri,ei),this.handleMessage(ei,Lt);break;default:ze("_handlePublish: unknown QoS. Doing nothing.");break}},ti.prototype.handleMessage=function(ei,Lt){Lt()},ti.prototype._handleAck=function(ei){const Lt=ei.messageId,ni=ei.cmd;let ri=null;const Ii=this.outgoing[Lt]?this.outgoing[Lt].cb:null,wi=this;let ai;if(!Ii){ze("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(ze("_handleAck :: packet type",ni),ni){case"pubcomp":case"puback":{const di=ei.reasonCode;di&&di>0&&di!==16&&(ai=new Error("Publish error: "+$e[di]),ai.code=di,Ii(ai,ei)),delete this.outgoing[Lt],this.outgoingStore.del(ei,Ii),this.messageIdProvider.deallocate(Lt),this._invokeStoreProcessingQueue();break}case"pubrec":{ri={cmd:"pubrel",qos:2,messageId:Lt};const di=ei.reasonCode;di&&di>0&&di!==16?(ai=new Error("Publish error: "+$e[di]),ai.code=di,Ii(ai,ei)):this._sendPacket(ri);break}case"suback":{delete this.outgoing[Lt],this.messageIdProvider.deallocate(Lt);for(let di=0;di<ei.granted.length;di++)if(ei.granted[di]&128){const hi=this.messageIdToTopic[Lt];hi&&hi.forEach(function(ci){delete wi._resubscribeTopics[ci]})}this._invokeStoreProcessingQueue(),Ii(null,ei);break}case"unsuback":{delete this.outgoing[Lt],this.messageIdProvider.deallocate(Lt),this._invokeStoreProcessingQueue(),Ii(null);break}default:wi.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},ti.prototype._handlePubrel=function(ei,Lt){ze("handling pubrel packet"),Lt=typeof Lt<"u"?Lt:Pt;const ni=ei.messageId,ri=this,Ii={cmd:"pubcomp",messageId:ni};ri.incomingStore.get(ei,function(wi,ai){wi?ri._sendPacket(Ii,Lt):(ri.emit("message",ai.topic,ai.payload,ai),ri.handleMessage(ai,function(di){if(di)return Lt(di);ri.incomingStore.del(ai,Pt),ri._sendPacket(Ii,Lt)}))})},ti.prototype._handleDisconnect=function(ei){this.emit("disconnect",ei)},ti.prototype._nextId=function(){return this.messageIdProvider.allocate()},ti.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},ti.prototype._resubscribe=function(){ze("_resubscribe");const ei=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&ei.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){ze("_resubscribe: protocolVersion 5");for(let Lt=0;Lt<ei.length;Lt++){const ni={};ni[ei[Lt]]=this._resubscribeTopics[ei[Lt]],ni.resubscribe=!0,this.subscribe(ni,{properties:ni[ei[Lt]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},ti.prototype._onConnect=function(ei){if(this.disconnected){this.emit("connect",ei);return}const Lt=this;this.connackPacket=ei,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function ni(){let ri=Lt.outgoingStore.createStream();function Ii(){Lt._storeProcessing=!1,Lt._packetIdsDuringStoreProcessing={}}Lt.once("close",wi),ri.on("error",function(di){Ii(),Lt._flushStoreProcessingQueue(),Lt.removeListener("close",wi),Lt.emit("error",di)});function wi(){ri.destroy(),ri=null,Lt._flushStoreProcessingQueue(),Ii()}function ai(){if(!ri)return;Lt._storeProcessing=!0;const di=ri.read(1);let hi;if(!di){ri.once("readable",ai);return}if(Lt._packetIdsDuringStoreProcessing[di.messageId]){ai();return}!Lt.disconnecting&&!Lt.reconnectTimer?(hi=Lt.outgoing[di.messageId]?Lt.outgoing[di.messageId].cb:null,Lt.outgoing[di.messageId]={volatile:!1,cb:function(ci,Ai){hi&&hi(ci,Ai),ai()}},Lt._packetIdsDuringStoreProcessing[di.messageId]=!0,Lt.messageIdProvider.register(di.messageId)?Lt._sendPacket(di):ze("messageId: %d has already used.",di.messageId)):ri.destroy&&ri.destroy()}ri.on("end",function(){let di=!0;for(const hi in Lt._packetIdsDuringStoreProcessing)if(!Lt._packetIdsDuringStoreProcessing[hi]){di=!1;break}di?(Ii(),Lt.removeListener("close",wi),Lt._invokeAllStoreProcessingQueue(),Lt.emit("connect",ei)):ni()}),ai()}ni()},ti.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const ei=this._storeProcessingQueue[0];if(ei&&ei.invoke())return this._storeProcessingQueue.shift(),!0}return!1},ti.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},ti.prototype._flushStoreProcessingQueue=function(){for(const ei of this._storeProcessingQueue)ei.cbStorePut&&ei.cbStorePut(new Error("Connection closed")),ei.callback&&ei.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},g.exports=ti}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal: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(r,g,V){const{Buffer:k}=r("buffer"),$=r("readable-stream").Transform,oe=r("duplexify");let re,Ce,ie,ae=!1;function le(){const he=new $;return he._write=function(pe,ze,xe){re.sendSocketMessage({data:pe.buffer,success:function(){xe()},fail:function(){xe(new Error)}})},he._flush=function(ze){re.closeSocket({success:function(){ze()}})},he}function Ie(he){he.hostname||(he.hostname="localhost"),he.path||(he.path="/"),he.wsOptions||(he.wsOptions={})}function ue(he,pe){const ze=he.protocol==="alis"?"wss":"ws";let xe=ze+"://"+he.hostname+he.path;return he.port&&he.port!==80&&he.port!==443&&(xe=ze+"://"+he.hostname+":"+he.port+he.path),typeof he.transformWsUrl=="function"&&(xe=he.transformWsUrl(xe,he,pe)),xe}function de(){ae||(ae=!0,re.onSocketOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),re.onSocketMessage(function(he){if(typeof he.data=="string"){const pe=k.from(he.data,"base64");Ce.push(pe)}else{const pe=new FileReader;pe.addEventListener("load",function(){let ze=pe.result;ze instanceof ArrayBuffer?ze=k.from(ze):ze=k.from(ze,"utf8"),Ce.push(ze)}),pe.readAsArrayBuffer(he.data)}}),re.onSocketClose(function(){ie.end(),ie.destroy()}),re.onSocketError(function(he){ie.destroy(he)}))}function Ne(he,pe){if(pe.hostname=pe.hostname||pe.host,!pe.hostname)throw new Error("Could not determine host. Specify host manually.");const ze=pe.protocolId==="MQIsdp"&&pe.protocolVersion===3?"mqttv3.1":"mqtt";Ie(pe);const xe=ue(pe,he);return re=pe.my,re.connectSocket({url:xe,protocols:ze}),Ce=le(),ie=oe.obj(),de(),ie}g.exports=Ne},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(r,g,V){const k=r("net"),$=r("debug")("mqttjs:tcp");function oe(re,Ce){Ce.port=Ce.port||1883,Ce.hostname=Ce.hostname||Ce.host||"localhost";const ie=Ce.port,ae=Ce.hostname;return $("port %d and host %s",ie,ae),k.createConnection(ie,ae)}g.exports=oe},{debug:18,net:16}],4:[function(r,g,V){const k=r("tls"),$=r("net"),oe=r("debug")("mqttjs:tls");function re(Ce,ie){ie.port=ie.port||8883,ie.host=ie.hostname||ie.host||"localhost",$.isIP(ie.host)===0&&(ie.servername=ie.host),ie.rejectUnauthorized=ie.rejectUnauthorized!==!1,delete ie.path,oe("port %d host %s rejectUnauthorized %b",ie.port,ie.host,ie.rejectUnauthorized);const ae=k.connect(ie);ae.on("secureConnect",function(){ie.rejectUnauthorized&&!ae.authorized?ae.emit("error",new Error("TLS not authorized")):ae.removeListener("error",le)});function le(Ie){ie.rejectUnauthorized&&Ce.emit("error",Ie),ae.end()}return ae.on("error",le),ae}g.exports=re},{debug:18,net:16,tls:16}],5:[function(r,g,V){(function(k){(function(){const{Buffer:$}=r("buffer"),oe=r("ws"),re=r("debug")("mqttjs:ws"),Ce=r("duplexify"),ie=r("readable-stream").Transform,ae=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],le=typeof k<"u"&&k.title==="browser"||typeof __webpack_require__=="function";function Ie(xe,Oe){let _e=xe.protocol+"://"+xe.hostname+":"+xe.port+xe.path;return typeof xe.transformWsUrl=="function"&&(_e=xe.transformWsUrl(_e,xe,Oe)),_e}function ue(xe){const Oe=xe;return xe.hostname||(Oe.hostname="localhost"),xe.port||(xe.protocol==="wss"?Oe.port=443:Oe.port=80),xe.path||(Oe.path="/"),xe.wsOptions||(Oe.wsOptions={}),!le&&xe.protocol==="wss"&&ae.forEach(function(_e){Object.prototype.hasOwnProperty.call(xe,_e)&&!Object.prototype.hasOwnProperty.call(xe.wsOptions,_e)&&(Oe.wsOptions[_e]=xe[_e])}),Oe}function de(xe){const Oe=ue(xe);if(Oe.hostname||(Oe.hostname=Oe.host),!Oe.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const _e=new URL(document.URL);Oe.hostname=_e.hostname,Oe.port||(Oe.port=_e.port)}return Oe.objectMode===void 0&&(Oe.objectMode=!(Oe.binary===!0||Oe.binary===void 0)),Oe}function Ne(xe,Oe,_e){re("createWebSocket"),re("protocol: "+_e.protocolId+" "+_e.protocolVersion);const At=_e.protocolId==="MQIsdp"&&_e.protocolVersion===3?"mqttv3.1":"mqtt";return re("creating new Websocket for url: "+Oe+" and protocol: "+At),new oe(Oe,[At],_e.wsOptions)}function he(xe,Oe){const _e=Oe.protocolId==="MQIsdp"&&Oe.protocolVersion===3?"mqttv3.1":"mqtt",At=Ie(Oe,xe),$e=new WebSocket(At,[_e]);return $e.binaryType="arraybuffer",$e}function pe(xe,Oe){re("streamBuilder");const _e=ue(Oe),At=Ie(_e,xe),$e=Ne(xe,At,_e),Fe=oe.createWebSocketStream($e,_e.wsOptions);return Fe.url=At,$e.on("close",()=>{Fe.destroy()}),Fe}function ze(xe,Oe){re("browserStreamBuilder");let _e;const $e=de(Oe).browserBufferSize||1024*512,Fe=Oe.browserBufferTimeout||1e3,Ue=!Oe.objectMode,Ve=he(xe,Oe),Dt=kt(Oe,ni,ri);Oe.objectMode||(Dt._writev=Lt),Dt.on("close",()=>{Ve.close()});const qe=typeof Ve.addEventListener<"u";Ve.readyState===Ve.OPEN?_e=Dt:(_e=_e=Ce(void 0,void 0,Oe),Oe.objectMode||(_e._writev=Lt),qe?Ve.addEventListener("open",jt):Ve.onopen=jt),_e.socket=Ve,qe?(Ve.addEventListener("close",Pt),Ve.addEventListener("error",ti),Ve.addEventListener("message",ei)):(Ve.onclose=Pt,Ve.onerror=ti,Ve.onmessage=ei);function kt(Ii,wi,ai){const di=new ie({objectModeMode:Ii.objectMode});return di._write=wi,di._flush=ai,di}function jt(){_e.setReadable(Dt),_e.setWritable(Dt),_e.emit("connect")}function Pt(){_e.end(),_e.destroy()}function ti(Ii){_e.destroy(Ii)}function ei(Ii){let wi=Ii.data;wi instanceof ArrayBuffer?wi=$.from(wi):wi=$.from(wi,"utf8"),Dt.push(wi)}function Lt(Ii,wi){const ai=new Array(Ii.length);for(let di=0;di<Ii.length;di++)typeof Ii[di].chunk=="string"?ai[di]=$.from(Ii[di],"utf8"):ai[di]=Ii[di].chunk;this._write($.concat(ai),"binary",wi)}function ni(Ii,wi,ai){Ve.bufferedAmount>$e&&setTimeout(ni,Fe,Ii,wi,ai),Ue&&typeof Ii=="string"&&(Ii=$.from(Ii,"utf8"));try{Ve.send(Ii)}catch(di){return ai(di)}ai()}function ri(Ii){Ve.close(),Ii()}return _e}le?g.exports=ze:g.exports=pe}).call(this)}).call(this,r("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(r,g,V){const{Buffer:k}=r("buffer"),$=r("readable-stream").Transform,oe=r("duplexify");let re,Ce,ie;function ae(){const Ne=new $;return Ne._write=function(he,pe,ze){re.send({data:he.buffer,success:function(){ze()},fail:function(xe){ze(new Error(xe))}})},Ne._flush=function(pe){re.close({success:function(){pe()}})},Ne}function le(Ne){Ne.hostname||(Ne.hostname="localhost"),Ne.path||(Ne.path="/"),Ne.wsOptions||(Ne.wsOptions={})}function Ie(Ne,he){const pe=Ne.protocol==="wxs"?"wss":"ws";let ze=pe+"://"+Ne.hostname+Ne.path;return Ne.port&&Ne.port!==80&&Ne.port!==443&&(ze=pe+"://"+Ne.hostname+":"+Ne.port+Ne.path),typeof Ne.transformWsUrl=="function"&&(ze=Ne.transformWsUrl(ze,Ne,he)),ze}function ue(){re.onOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),re.onMessage(function(Ne){let he=Ne.data;he instanceof ArrayBuffer?he=k.from(he):he=k.from(he,"utf8"),Ce.push(he)}),re.onClose(function(){ie.end(),ie.destroy()}),re.onError(function(Ne){ie.destroy(new Error(Ne.errMsg))})}function de(Ne,he){if(he.hostname=he.hostname||he.host,!he.hostname)throw new Error("Could not determine host. Specify host manually.");const pe=he.protocolId==="MQIsdp"&&he.protocolVersion===3?"mqttv3.1":"mqtt";le(he);const ze=Ie(he,Ne);re=wx.connectSocket({url:ze,protocols:[pe]}),Ce=ae(),ie=oe.obj(),ie._destroy=function(Oe,_e){re.close({success:function(){_e&&_e(Oe)}})};const xe=ie.destroy;return ie.destroy=function(){ie.destroy=xe;const Oe=this;setTimeout(function(){re.close({fail:function(){Oe._destroy(new Error)}})},0)}.bind(ie),ue(),ie}g.exports=de},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(r,g,V){function k(){if(!(this instanceof k))return new k;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}k.prototype.allocate=function(){const $=this.nextId++;return this.nextId===65536&&(this.nextId=1),$},k.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},k.prototype.register=function($){return!0},k.prototype.deallocate=function($){},k.prototype.clear=function(){},g.exports=k},{}],8:[function(r,g,V){const k=r("xtend"),$=r("readable-stream").Readable,oe={objectMode:!0},re={clean:!0};function Ce(ie){if(!(this instanceof Ce))return new Ce(ie);this.options=ie||{},this.options=k(re,ie),this._inflights=new Map}Ce.prototype.put=function(ie,ae){return this._inflights.set(ie.messageId,ie),ae&&ae(),this},Ce.prototype.createStream=function(){const ie=new $(oe),ae=[];let le=!1,Ie=0;return this._inflights.forEach(function(ue,de){ae.push(ue)}),ie._read=function(){!le&&Ie<ae.length?this.push(ae[Ie++]):this.push(null)},ie.destroy=function(){if(le)return;const ue=this;le=!0,setTimeout(function(){ue.emit("close")},0)},ie},Ce.prototype.del=function(ie,ae){return ie=this._inflights.get(ie.messageId),ie?(this._inflights.delete(ie.messageId),ae(null,ie)):ae&&ae(new Error("missing packet")),this},Ce.prototype.get=function(ie,ae){return ie=this._inflights.get(ie.messageId),ie?ae(null,ie):ae&&ae(new Error("missing packet")),this},Ce.prototype.close=function(ie){this.options.clean&&(this._inflights=null),ie&&ie()},g.exports=Ce},{"readable-stream":69,xtend:81}],9:[function(r,g,V){function k($){if(!(this instanceof k))return new k($);this.aliasToTopic={},this.max=$}k.prototype.put=function($,oe){return oe===0||oe>this.max?!1:(this.aliasToTopic[oe]=$,this.length=Object.keys(this.aliasToTopic).length,!0)},k.prototype.getTopicByAlias=function($){return this.aliasToTopic[$]},k.prototype.clear=function(){this.aliasToTopic={}},g.exports=k},{}],10:[function(r,g,V){const k=r("lru-cache"),$=r("number-allocator").NumberAllocator;function oe(re){if(!(this instanceof oe))return new oe(re);re>0&&(this.aliasToTopic=new k({max:re}),this.topicToAlias={},this.numberAllocator=new $(1,re),this.max=re,this.length=0)}oe.prototype.put=function(re,Ce){if(Ce===0||Ce>this.max)return!1;const ie=this.aliasToTopic.get(Ce);return ie&&delete this.topicToAlias[ie],this.aliasToTopic.set(Ce,re),this.topicToAlias[re]=Ce,this.numberAllocator.use(Ce),this.length=this.aliasToTopic.length,!0},oe.prototype.getTopicByAlias=function(re){return this.aliasToTopic.get(re)},oe.prototype.getAliasByTopic=function(re){const Ce=this.topicToAlias[re];return typeof Ce<"u"&&this.aliasToTopic.get(Ce),Ce},oe.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},oe.prototype.getLruAlias=function(){const re=this.numberAllocator.firstVacant();return re||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},g.exports=oe},{"lru-cache":37,"number-allocator":46}],11:[function(r,g,V){function k(oe){const re=oe.split("/");for(let Ce=0;Ce<re.length;Ce++)if(re[Ce]!=="+"){if(re[Ce]==="#")return Ce===re.length-1;if(re[Ce].indexOf("+")!==-1||re[Ce].indexOf("#")!==-1)return!1}return!0}function $(oe){if(oe.length===0)return"empty_topic_list";for(let re=0;re<oe.length;re++)if(!k(oe[re]))return oe[re];return null}g.exports={validateTopics:$}},{}],12:[function(r,g,V){(function(k){(function(){const $=r("../client"),oe=r("../store"),re=r("url"),Ce=r("xtend"),ie=r("debug")("mqttjs"),ae={};typeof k<"u"&&k.title!=="browser"||typeof __webpack_require__!="function"?(ae.mqtt=r("./tcp"),ae.tcp=r("./tcp"),ae.ssl=r("./tls"),ae.tls=r("./tls"),ae.mqtts=r("./tls")):(ae.wx=r("./wx"),ae.wxs=r("./wx"),ae.ali=r("./ali"),ae.alis=r("./ali")),ae.ws=r("./ws"),ae.wss=r("./ws");function le(ue){let de;ue.auth&&(de=ue.auth.match(/^(.+):(.+)$/),de?(ue.username=de[1],ue.password=de[2]):ue.username=ue.auth)}function Ie(ue,de){if(ie("connecting to an MQTT broker..."),typeof ue=="object"&&!de&&(de=ue,ue=null),de=de||{},ue){const pe=re.parse(ue,!0);if(pe.port!=null&&(pe.port=Number(pe.port)),de=Ce(pe,de),de.protocol===null)throw new Error("Missing protocol");de.protocol=de.protocol.replace(/:$/,"")}if(le(de),de.query&&typeof de.query.clientId=="string"&&(de.clientId=de.query.clientId),de.cert&&de.key)if(de.protocol){if(["mqtts","wss","wxs","alis"].indexOf(de.protocol)===-1)switch(de.protocol){case"mqtt":de.protocol="mqtts";break;case"ws":de.protocol="wss";break;case"wx":de.protocol="wxs";break;case"ali":de.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+de.protocol+'"!')}}else throw new Error("Missing secure protocol key");if(!ae[de.protocol]){const pe=["mqtts","wss"].indexOf(de.protocol)!==-1;de.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(ze,xe){return pe&&xe%2===0?!1:typeof ae[ze]=="function"})[0]}if(de.clean===!1&&!de.clientId)throw new Error("Missing clientId for unclean clients");de.protocol&&(de.defaultProtocol=de.protocol);function Ne(pe){return de.servers&&((!pe._reconnectCount||pe._reconnectCount===de.servers.length)&&(pe._reconnectCount=0),de.host=de.servers[pe._reconnectCount].host,de.port=de.servers[pe._reconnectCount].port,de.protocol=de.servers[pe._reconnectCount].protocol?de.servers[pe._reconnectCount].protocol:de.defaultProtocol,de.hostname=de.host,pe._reconnectCount++),ie("calling streambuilder for",de.protocol),ae[de.protocol](pe,de)}const he=new $(Ne,de);return he.on("error",function(){}),he}g.exports=Ie,g.exports.connect=Ie,g.exports.MqttClient=$,g.exports.Store=oe}).call(this)}).call(this,r("_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(r,g,V){V.byteLength=le,V.toByteArray=ue,V.fromByteArray=he;for(var k=[],$=[],oe=typeof Uint8Array<"u"?Uint8Array:Array,re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ce=0,ie=re.length;Ce<ie;++Ce)k[Ce]=re[Ce],$[re.charCodeAt(Ce)]=Ce;$["-".charCodeAt(0)]=62,$["_".charCodeAt(0)]=63;function ae(pe){var ze=pe.length;if(ze%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var xe=pe.indexOf("=");xe===-1&&(xe=ze);var Oe=xe===ze?0:4-xe%4;return[xe,Oe]}function le(pe){var ze=ae(pe),xe=ze[0],Oe=ze[1];return(xe+Oe)*3/4-Oe}function Ie(pe,ze,xe){return(ze+xe)*3/4-xe}function ue(pe){var ze,xe=ae(pe),Oe=xe[0],_e=xe[1],At=new oe(Ie(pe,Oe,_e)),$e=0,Fe=_e>0?Oe-4:Oe,Ue;for(Ue=0;Ue<Fe;Ue+=4)ze=$[pe.charCodeAt(Ue)]<<18|$[pe.charCodeAt(Ue+1)]<<12|$[pe.charCodeAt(Ue+2)]<<6|$[pe.charCodeAt(Ue+3)],At[$e++]=ze>>16&255,At[$e++]=ze>>8&255,At[$e++]=ze&255;return _e===2&&(ze=$[pe.charCodeAt(Ue)]<<2|$[pe.charCodeAt(Ue+1)]>>4,At[$e++]=ze&255),_e===1&&(ze=$[pe.charCodeAt(Ue)]<<10|$[pe.charCodeAt(Ue+1)]<<4|$[pe.charCodeAt(Ue+2)]>>2,At[$e++]=ze>>8&255,At[$e++]=ze&255),At}function de(pe){return k[pe>>18&63]+k[pe>>12&63]+k[pe>>6&63]+k[pe&63]}function Ne(pe,ze,xe){for(var Oe,_e=[],At=ze;At<xe;At+=3)Oe=(pe[At]<<16&16711680)+(pe[At+1]<<8&65280)+(pe[At+2]&255),_e.push(de(Oe));return _e.join("")}function he(pe){for(var ze,xe=pe.length,Oe=xe%3,_e=[],At=16383,$e=0,Fe=xe-Oe;$e<Fe;$e+=At)_e.push(Ne(pe,$e,$e+At>Fe?Fe:$e+At));return Oe===1?(ze=pe[xe-1],_e.push(k[ze>>2]+k[ze<<4&63]+"==")):Oe===2&&(ze=(pe[xe-2]<<8)+pe[xe-1],_e.push(k[ze>>10]+k[ze>>4&63]+k[ze<<2&63]+"=")),_e.join("")}},{}],14:[function(r,g,V){const{Buffer:k}=r("buffer"),$=Symbol.for("BufferList");function oe(re){if(!(this instanceof oe))return new oe(re);oe._init.call(this,re)}oe._init=function(Ce){Object.defineProperty(this,$,{value:!0}),this._bufs=[],this.length=0,Ce&&this.append(Ce)},oe.prototype._new=function(Ce){return new oe(Ce)},oe.prototype._offset=function(Ce){if(Ce===0)return[0,0];let ie=0;for(let ae=0;ae<this._bufs.length;ae++){const le=ie+this._bufs[ae].length;if(Ce<le||ae===this._bufs.length-1)return[ae,Ce-ie];ie=le}},oe.prototype._reverseOffset=function(re){const Ce=re[0];let ie=re[1];for(let ae=0;ae<Ce;ae++)ie+=this._bufs[ae].length;return ie},oe.prototype.get=function(Ce){if(Ce>this.length||Ce<0)return;const ie=this._offset(Ce);return this._bufs[ie[0]][ie[1]]},oe.prototype.slice=function(Ce,ie){return typeof Ce=="number"&&Ce<0&&(Ce+=this.length),typeof ie=="number"&&ie<0&&(ie+=this.length),this.copy(null,0,Ce,ie)},oe.prototype.copy=function(Ce,ie,ae,le){if((typeof ae!="number"||ae<0)&&(ae=0),(typeof le!="number"||le>this.length)&&(le=this.length),ae>=this.length||le<=0)return Ce||k.alloc(0);const Ie=!!Ce,ue=this._offset(ae),de=le-ae;let Ne=de,he=Ie&&ie||0,pe=ue[1];if(ae===0&&le===this.length){if(!Ie)return this._bufs.length===1?this._bufs[0]:k.concat(this._bufs,this.length);for(let ze=0;ze<this._bufs.length;ze++)this._bufs[ze].copy(Ce,he),he+=this._bufs[ze].length;return Ce}if(Ne<=this._bufs[ue[0]].length-pe)return Ie?this._bufs[ue[0]].copy(Ce,ie,pe,pe+Ne):this._bufs[ue[0]].slice(pe,pe+Ne);Ie||(Ce=k.allocUnsafe(de));for(let ze=ue[0];ze<this._bufs.length;ze++){const xe=this._bufs[ze].length-pe;if(Ne>xe)this._bufs[ze].copy(Ce,he,pe),he+=xe;else{this._bufs[ze].copy(Ce,he,pe,pe+Ne),he+=xe;break}Ne-=xe,pe&&(pe=0)}return Ce.length>he?Ce.slice(0,he):Ce},oe.prototype.shallowSlice=function(Ce,ie){if(Ce=Ce||0,ie=typeof ie!="number"?this.length:ie,Ce<0&&(Ce+=this.length),ie<0&&(ie+=this.length),Ce===ie)return this._new();const ae=this._offset(Ce),le=this._offset(ie),Ie=this._bufs.slice(ae[0],le[0]+1);return le[1]===0?Ie.pop():Ie[Ie.length-1]=Ie[Ie.length-1].slice(0,le[1]),ae[1]!==0&&(Ie[0]=Ie[0].slice(ae[1])),this._new(Ie)},oe.prototype.toString=function(Ce,ie,ae){return this.slice(ie,ae).toString(Ce)},oe.prototype.consume=function(Ce){if(Ce=Math.trunc(Ce),Number.isNaN(Ce)||Ce<=0)return this;for(;this._bufs.length;)if(Ce>=this._bufs[0].length)Ce-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(Ce),this.length-=Ce;break}return this},oe.prototype.duplicate=function(){const Ce=this._new();for(let ie=0;ie<this._bufs.length;ie++)Ce.append(this._bufs[ie]);return Ce},oe.prototype.append=function(Ce){if(Ce==null)return this;if(Ce.buffer)this._appendBuffer(k.from(Ce.buffer,Ce.byteOffset,Ce.byteLength));else if(Array.isArray(Ce))for(let ie=0;ie<Ce.length;ie++)this.append(Ce[ie]);else if(this._isBufferList(Ce))for(let ie=0;ie<Ce._bufs.length;ie++)this.append(Ce._bufs[ie]);else typeof Ce=="number"&&(Ce=Ce.toString()),this._appendBuffer(k.from(Ce));return this},oe.prototype._appendBuffer=function(Ce){this._bufs.push(Ce),this.length+=Ce.length},oe.prototype.indexOf=function(re,Ce,ie){if(ie===void 0&&typeof Ce=="string"&&(ie=Ce,Ce=void 0),typeof re=="function"||Array.isArray(re))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof re=="number"?re=k.from([re]):typeof re=="string"?re=k.from(re,ie):this._isBufferList(re)?re=re.slice():Array.isArray(re.buffer)?re=k.from(re.buffer,re.byteOffset,re.byteLength):k.isBuffer(re)||(re=k.from(re)),Ce=Number(Ce||0),isNaN(Ce)&&(Ce=0),Ce<0&&(Ce=this.length+Ce),Ce<0&&(Ce=0),re.length===0)return Ce>this.length?this.length:Ce;const ae=this._offset(Ce);let le=ae[0],Ie=ae[1];for(;le<this._bufs.length;le++){const ue=this._bufs[le];for(;Ie<ue.length;)if(ue.length-Ie>=re.length){const Ne=ue.indexOf(re,Ie);if(Ne!==-1)return this._reverseOffset([le,Ne]);Ie=ue.length-re.length+1}else{const Ne=this._reverseOffset([le,Ie]);if(this._match(Ne,re))return Ne;Ie++}Ie=0}return-1},oe.prototype._match=function(re,Ce){if(this.length-re<Ce.length)return!1;for(let ie=0;ie<Ce.length;ie++)if(this.get(re+ie)!==Ce[ie])return!1;return!0},function(){const re={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 Ce in re)(function(ie){re[ie]===null?oe.prototype[ie]=function(ae,le){return this.slice(ae,ae+le)[ie](0,le)}:oe.prototype[ie]=function(ae=0){return this.slice(ae,ae+re[ie])[ie](0)}})(Ce)}(),oe.prototype._isBufferList=function(Ce){return Ce instanceof oe||oe.isBufferList(Ce)},oe.isBufferList=function(Ce){return Ce!=null&&Ce[$]},g.exports=oe},{buffer:17}],15:[function(r,g,V){const k=r("readable-stream").Duplex,$=r("inherits"),oe=r("./BufferList");function re(Ce){if(!(this instanceof re))return new re(Ce);if(typeof Ce=="function"){this._callback=Ce;const ie=function(le){this._callback&&(this._callback(le),this._callback=null)}.bind(this);this.on("pipe",function(le){le.on("error",ie)}),this.on("unpipe",function(le){le.removeListener("error",ie)}),Ce=null}oe._init.call(this,Ce),k.call(this)}$(re,k),Object.assign(re.prototype,oe.prototype),re.prototype._new=function(ie){return new re(ie)},re.prototype._write=function(ie,ae,le){this._appendBuffer(ie),typeof le=="function"&&le()},re.prototype._read=function(ie){if(!this.length)return this.push(null);ie=Math.min(ie,this.length),this.push(this.slice(0,ie)),this.consume(ie)},re.prototype.end=function(ie){k.prototype.end.call(this,ie),this._callback&&(this._callback(null,this.slice()),this._callback=null)},re.prototype._destroy=function(ie,ae){this._bufs.length=0,this.length=0,ae(ie)},re.prototype._isBufferList=function(ie){return ie instanceof re||ie instanceof oe||re.isBufferList(ie)},re.isBufferList=oe.isBufferList,g.exports=re,g.exports.BufferListStream=re,g.exports.BufferList=oe},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(r,g,V){},{}],17:[function(r,g,V){(function(k){(function(){var $=r("base64-js"),oe=r("ieee754");V.Buffer=ae,V.SlowBuffer=Oe,V.INSPECT_MAX_BYTES=50;var re=2147483647;V.kMaxLength=re,ae.TYPED_ARRAY_SUPPORT=Ce(),!ae.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.");function Ce(){try{var oi=new Uint8Array(1);return oi.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},oi.foo()===42}catch{return!1}}Object.defineProperty(ae.prototype,"parent",{enumerable:!0,get:function(){if(ae.isBuffer(this))return this.buffer}}),Object.defineProperty(ae.prototype,"offset",{enumerable:!0,get:function(){if(ae.isBuffer(this))return this.byteOffset}});function ie(oi){if(oi>re)throw new RangeError('The value "'+oi+'" is invalid for option "size"');var Et=new Uint8Array(oi);return Et.__proto__=ae.prototype,Et}function ae(oi,Et,ii){if(typeof oi=="number"){if(typeof Et=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return de(oi)}return le(oi,Et,ii)}typeof Symbol<"u"&&Symbol.species!=null&&ae[Symbol.species]===ae&&Object.defineProperty(ae,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),ae.poolSize=8192;function le(oi,Et,ii){if(typeof oi=="string")return Ne(oi,Et);if(ArrayBuffer.isView(oi))return he(oi);if(oi==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof oi);if(gi(oi,ArrayBuffer)||oi&&gi(oi.buffer,ArrayBuffer))return pe(oi,Et,ii);if(typeof oi=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var si=oi.valueOf&&oi.valueOf();if(si!=null&&si!==oi)return ae.from(si,Et,ii);var fi=ze(oi);if(fi)return fi;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof oi[Symbol.toPrimitive]=="function")return ae.from(oi[Symbol.toPrimitive]("string"),Et,ii);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof oi)}ae.from=function(oi,Et,ii){return le(oi,Et,ii)},ae.prototype.__proto__=Uint8Array.prototype,ae.__proto__=Uint8Array;function Ie(oi){if(typeof oi!="number")throw new TypeError('"size" argument must be of type number');if(oi<0)throw new RangeError('The value "'+oi+'" is invalid for option "size"')}function ue(oi,Et,ii){return Ie(oi),oi<=0?ie(oi):Et!==void 0?typeof ii=="string"?ie(oi).fill(Et,ii):ie(oi).fill(Et):ie(oi)}ae.alloc=function(oi,Et,ii){return ue(oi,Et,ii)};function de(oi){return Ie(oi),ie(oi<0?0:xe(oi)|0)}ae.allocUnsafe=function(oi){return de(oi)},ae.allocUnsafeSlow=function(oi){return de(oi)};function Ne(oi,Et){if((typeof Et!="string"||Et==="")&&(Et="utf8"),!ae.isEncoding(Et))throw new TypeError("Unknown encoding: "+Et);var ii=_e(oi,Et)|0,si=ie(ii),fi=si.write(oi,Et);return fi!==ii&&(si=si.slice(0,fi)),si}function he(oi){for(var Et=oi.length<0?0:xe(oi.length)|0,ii=ie(Et),si=0;si<Et;si+=1)ii[si]=oi[si]&255;return ii}function pe(oi,Et,ii){if(Et<0||oi.byteLength<Et)throw new RangeError('"offset" is outside of buffer bounds');if(oi.byteLength<Et+(ii||0))throw new RangeError('"length" is outside of buffer bounds');var si;return Et===void 0&&ii===void 0?si=new Uint8Array(oi):ii===void 0?si=new Uint8Array(oi,Et):si=new Uint8Array(oi,Et,ii),si.__proto__=ae.prototype,si}function ze(oi){if(ae.isBuffer(oi)){var Et=xe(oi.length)|0,ii=ie(Et);return ii.length===0||oi.copy(ii,0,0,Et),ii}if(oi.length!==void 0)return typeof oi.length!="number"||li(oi.length)?ie(0):he(oi);if(oi.type==="Buffer"&&Array.isArray(oi.data))return he(oi.data)}function xe(oi){if(oi>=re)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+re.toString(16)+" bytes");return oi|0}function Oe(oi){return+oi!=oi&&(oi=0),ae.alloc(+oi)}ae.isBuffer=function(Et){return Et!=null&&Et._isBuffer===!0&&Et!==ae.prototype},ae.compare=function(Et,ii){if(gi(Et,Uint8Array)&&(Et=ae.from(Et,Et.offset,Et.byteLength)),gi(ii,Uint8Array)&&(ii=ae.from(ii,ii.offset,ii.byteLength)),!ae.isBuffer(Et)||!ae.isBuffer(ii))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Et===ii)return 0;for(var si=Et.length,fi=ii.length,pi=0,Si=Math.min(si,fi);pi<Si;++pi)if(Et[pi]!==ii[pi]){si=Et[pi],fi=ii[pi];break}return si<fi?-1:fi<si?1:0},ae.isEncoding=function(Et){switch(String(Et).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}},ae.concat=function(Et,ii){if(!Array.isArray(Et))throw new TypeError('"list" argument must be an Array of Buffers');if(Et.length===0)return ae.alloc(0);var si;if(ii===void 0)for(ii=0,si=0;si<Et.length;++si)ii+=Et[si].length;var fi=ae.allocUnsafe(ii),pi=0;for(si=0;si<Et.length;++si){var Si=Et[si];if(gi(Si,Uint8Array)&&(Si=ae.from(Si)),!ae.isBuffer(Si))throw new TypeError('"list" argument must be an Array of Buffers');Si.copy(fi,pi),pi+=Si.length}return fi};function _e(oi,Et){if(ae.isBuffer(oi))return oi.length;if(ArrayBuffer.isView(oi)||gi(oi,ArrayBuffer))return oi.byteLength;if(typeof oi!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof oi);var ii=oi.length,si=arguments.length>2&&arguments[2]===!0;if(!si&&ii===0)return 0;for(var fi=!1;;)switch(Et){case"ascii":case"latin1":case"binary":return ii;case"utf8":case"utf-8":return Ni(oi).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ii*2;case"hex":return ii>>>1;case"base64":return vi(oi).length;default:if(fi)return si?-1:Ni(oi).length;Et=(""+Et).toLowerCase(),fi=!0}}ae.byteLength=_e;function At(oi,Et,ii){var si=!1;if((Et===void 0||Et<0)&&(Et=0),Et>this.length||((ii===void 0||ii>this.length)&&(ii=this.length),ii<=0)||(ii>>>=0,Et>>>=0,ii<=Et))return"";for(oi||(oi="utf8");;)switch(oi){case"hex":return wi(this,Et,ii);case"utf8":case"utf-8":return ei(this,Et,ii);case"ascii":return ri(this,Et,ii);case"latin1":case"binary":return Ii(this,Et,ii);case"base64":return ti(this,Et,ii);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ai(this,Et,ii);default:if(si)throw new TypeError("Unknown encoding: "+oi);oi=(oi+"").toLowerCase(),si=!0}}ae.prototype._isBuffer=!0;function $e(oi,Et,ii){var si=oi[Et];oi[Et]=oi[ii],oi[ii]=si}ae.prototype.swap16=function(){var Et=this.length;if(Et%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var ii=0;ii<Et;ii+=2)$e(this,ii,ii+1);return this},ae.prototype.swap32=function(){var Et=this.length;if(Et%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var ii=0;ii<Et;ii+=4)$e(this,ii,ii+3),$e(this,ii+1,ii+2);return this},ae.prototype.swap64=function(){var Et=this.length;if(Et%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var ii=0;ii<Et;ii+=8)$e(this,ii,ii+7),$e(this,ii+1,ii+6),$e(this,ii+2,ii+5),$e(this,ii+3,ii+4);return this},ae.prototype.toString=function(){var Et=this.length;return Et===0?"":arguments.length===0?ei(this,0,Et):At.apply(this,arguments)},ae.prototype.toLocaleString=ae.prototype.toString,ae.prototype.equals=function(Et){if(!ae.isBuffer(Et))throw new TypeError("Argument must be a Buffer");return this===Et?!0:ae.compare(this,Et)===0},ae.prototype.inspect=function(){var Et="",ii=V.INSPECT_MAX_BYTES;return Et=this.toString("hex",0,ii).replace(/(.{2})/g,"$1 ").trim(),this.length>ii&&(Et+=" ... "),"<Buffer "+Et+">"},ae.prototype.compare=function(Et,ii,si,fi,pi){if(gi(Et,Uint8Array)&&(Et=ae.from(Et,Et.offset,Et.byteLength)),!ae.isBuffer(Et))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Et);if(ii===void 0&&(ii=0),si===void 0&&(si=Et?Et.length:0),fi===void 0&&(fi=0),pi===void 0&&(pi=this.length),ii<0||si>Et.length||fi<0||pi>this.length)throw new RangeError("out of range index");if(fi>=pi&&ii>=si)return 0;if(fi>=pi)return-1;if(ii>=si)return 1;if(ii>>>=0,si>>>=0,fi>>>=0,pi>>>=0,this===Et)return 0;for(var Si=pi-fi,xi=si-ii,Gi=Math.min(Si,xi),Bi=this.slice(fi,pi),Oi=Et.slice(ii,si),Zi=0;Zi<Gi;++Zi)if(Bi[Zi]!==Oi[Zi]){Si=Bi[Zi],xi=Oi[Zi];break}return Si<xi?-1:xi<Si?1:0};function Fe(oi,Et,ii,si,fi){if(oi.length===0)return-1;if(typeof ii=="string"?(si=ii,ii=0):ii>2147483647?ii=2147483647:ii<-2147483648&&(ii=-2147483648),ii=+ii,li(ii)&&(ii=fi?0:oi.length-1),ii<0&&(ii=oi.length+ii),ii>=oi.length){if(fi)return-1;ii=oi.length-1}else if(ii<0)if(fi)ii=0;else return-1;if(typeof Et=="string"&&(Et=ae.from(Et,si)),ae.isBuffer(Et))return Et.length===0?-1:Ue(oi,Et,ii,si,fi);if(typeof Et=="number")return Et=Et&255,typeof Uint8Array.prototype.indexOf=="function"?fi?Uint8Array.prototype.indexOf.call(oi,Et,ii):Uint8Array.prototype.lastIndexOf.call(oi,Et,ii):Ue(oi,[Et],ii,si,fi);throw new TypeError("val must be string, number or Buffer")}function Ue(oi,Et,ii,si,fi){var pi=1,Si=oi.length,xi=Et.length;if(si!==void 0&&(si=String(si).toLowerCase(),si==="ucs2"||si==="ucs-2"||si==="utf16le"||si==="utf-16le")){if(oi.length<2||Et.length<2)return-1;pi=2,Si/=2,xi/=2,ii/=2}function Gi(Vi,ki){return pi===1?Vi[ki]:Vi.readUInt16BE(ki*pi)}var Bi;if(fi){var Oi=-1;for(Bi=ii;Bi<Si;Bi++)if(Gi(oi,Bi)===Gi(Et,Oi===-1?0:Bi-Oi)){if(Oi===-1&&(Oi=Bi),Bi-Oi+1===xi)return Oi*pi}else Oi!==-1&&(Bi-=Bi-Oi),Oi=-1}else for(ii+xi>Si&&(ii=Si-xi),Bi=ii;Bi>=0;Bi--){for(var Zi=!0,Wi=0;Wi<xi;Wi++)if(Gi(oi,Bi+Wi)!==Gi(Et,Wi)){Zi=!1;break}if(Zi)return Bi}return-1}ae.prototype.includes=function(Et,ii,si){return this.indexOf(Et,ii,si)!==-1},ae.prototype.indexOf=function(Et,ii,si){return Fe(this,Et,ii,si,!0)},ae.prototype.lastIndexOf=function(Et,ii,si){return Fe(this,Et,ii,si,!1)};function Ve(oi,Et,ii,si){ii=Number(ii)||0;var fi=oi.length-ii;si?(si=Number(si),si>fi&&(si=fi)):si=fi;var pi=Et.length;si>pi/2&&(si=pi/2);for(var Si=0;Si<si;++Si){var xi=parseInt(Et.substr(Si*2,2),16);if(li(xi))return Si;oi[ii+Si]=xi}return Si}function Dt(oi,Et,ii,si){return bi(Ni(Et,oi.length-ii),oi,ii,si)}function qe(oi,Et,ii,si){return bi(Mi(Et),oi,ii,si)}function kt(oi,Et,ii,si){return qe(oi,Et,ii,si)}function jt(oi,Et,ii,si){return bi(vi(Et),oi,ii,si)}function Pt(oi,Et,ii,si){return bi(mi(Et,oi.length-ii),oi,ii,si)}ae.prototype.write=function(Et,ii,si,fi){if(ii===void 0)fi="utf8",si=this.length,ii=0;else if(si===void 0&&typeof ii=="string")fi=ii,si=this.length,ii=0;else if(isFinite(ii))ii=ii>>>0,isFinite(si)?(si=si>>>0,fi===void 0&&(fi="utf8")):(fi=si,si=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var pi=this.length-ii;if((si===void 0||si>pi)&&(si=pi),Et.length>0&&(si<0||ii<0)||ii>this.length)throw new RangeError("Attempt to write outside buffer bounds");fi||(fi="utf8");for(var Si=!1;;)switch(fi){case"hex":return Ve(this,Et,ii,si);case"utf8":case"utf-8":return Dt(this,Et,ii,si);case"ascii":return qe(this,Et,ii,si);case"latin1":case"binary":return kt(this,Et,ii,si);case"base64":return jt(this,Et,ii,si);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pt(this,Et,ii,si);default:if(Si)throw new TypeError("Unknown encoding: "+fi);fi=(""+fi).toLowerCase(),Si=!0}},ae.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ti(oi,Et,ii){return Et===0&&ii===oi.length?$.fromByteArray(oi):$.fromByteArray(oi.slice(Et,ii))}function ei(oi,Et,ii){ii=Math.min(oi.length,ii);for(var si=[],fi=Et;fi<ii;){var pi=oi[fi],Si=null,xi=pi>239?4:pi>223?3:pi>191?2:1;if(fi+xi<=ii){var Gi,Bi,Oi,Zi;switch(xi){case 1:pi<128&&(Si=pi);break;case 2:Gi=oi[fi+1],(Gi&192)===128&&(Zi=(pi&31)<<6|Gi&63,Zi>127&&(Si=Zi));break;case 3:Gi=oi[fi+1],Bi=oi[fi+2],(Gi&192)===128&&(Bi&192)===128&&(Zi=(pi&15)<<12|(Gi&63)<<6|Bi&63,Zi>2047&&(Zi<55296||Zi>57343)&&(Si=Zi));break;case 4:Gi=oi[fi+1],Bi=oi[fi+2],Oi=oi[fi+3],(Gi&192)===128&&(Bi&192)===128&&(Oi&192)===128&&(Zi=(pi&15)<<18|(Gi&63)<<12|(Bi&63)<<6|Oi&63,Zi>65535&&Zi<1114112&&(Si=Zi))}}Si===null?(Si=65533,xi=1):Si>65535&&(Si-=65536,si.push(Si>>>10&1023|55296),Si=56320|Si&1023),si.push(Si),fi+=xi}return ni(si)}var Lt=4096;function ni(oi){var Et=oi.length;if(Et<=Lt)return String.fromCharCode.apply(String,oi);for(var ii="",si=0;si<Et;)ii+=String.fromCharCode.apply(String,oi.slice(si,si+=Lt));return ii}function ri(oi,Et,ii){var si="";ii=Math.min(oi.length,ii);for(var fi=Et;fi<ii;++fi)si+=String.fromCharCode(oi[fi]&127);return si}function Ii(oi,Et,ii){var si="";ii=Math.min(oi.length,ii);for(var fi=Et;fi<ii;++fi)si+=String.fromCharCode(oi[fi]);return si}function wi(oi,Et,ii){var si=oi.length;(!Et||Et<0)&&(Et=0),(!ii||ii<0||ii>si)&&(ii=si);for(var fi="",pi=Et;pi<ii;++pi)fi+=zi(oi[pi]);return fi}function ai(oi,Et,ii){for(var si=oi.slice(Et,ii),fi="",pi=0;pi<si.length;pi+=2)fi+=String.fromCharCode(si[pi]+si[pi+1]*256);return fi}ae.prototype.slice=function(Et,ii){var si=this.length;Et=~~Et,ii=ii===void 0?si:~~ii,Et<0?(Et+=si,Et<0&&(Et=0)):Et>si&&(Et=si),ii<0?(ii+=si,ii<0&&(ii=0)):ii>si&&(ii=si),ii<Et&&(ii=Et);var fi=this.subarray(Et,ii);return fi.__proto__=ae.prototype,fi};function di(oi,Et,ii){if(oi%1!==0||oi<0)throw new RangeError("offset is not uint");if(oi+Et>ii)throw new RangeError("Trying to access beyond buffer length")}ae.prototype.readUIntLE=function(Et,ii,si){Et=Et>>>0,ii=ii>>>0,si||di(Et,ii,this.length);for(var fi=this[Et],pi=1,Si=0;++Si<ii&&(pi*=256);)fi+=this[Et+Si]*pi;return fi},ae.prototype.readUIntBE=function(Et,ii,si){Et=Et>>>0,ii=ii>>>0,si||di(Et,ii,this.length);for(var fi=this[Et+--ii],pi=1;ii>0&&(pi*=256);)fi+=this[Et+--ii]*pi;return fi},ae.prototype.readUInt8=function(Et,ii){return Et=Et>>>0,ii||di(Et,1,this.length),this[Et]},ae.prototype.readUInt16LE=function(Et,ii){return Et=Et>>>0,ii||di(Et,2,this.length),this[Et]|this[Et+1]<<8},ae.prototype.readUInt16BE=function(Et,ii){return Et=Et>>>0,ii||di(Et,2,this.length),this[Et]<<8|this[Et+1]},ae.prototype.readUInt32LE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),(this[Et]|this[Et+1]<<8|this[Et+2]<<16)+this[Et+3]*16777216},ae.prototype.readUInt32BE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),this[Et]*16777216+(this[Et+1]<<16|this[Et+2]<<8|this[Et+3])},ae.prototype.readIntLE=function(Et,ii,si){Et=Et>>>0,ii=ii>>>0,si||di(Et,ii,this.length);for(var fi=this[Et],pi=1,Si=0;++Si<ii&&(pi*=256);)fi+=this[Et+Si]*pi;return pi*=128,fi>=pi&&(fi-=Math.pow(2,8*ii)),fi},ae.prototype.readIntBE=function(Et,ii,si){Et=Et>>>0,ii=ii>>>0,si||di(Et,ii,this.length);for(var fi=ii,pi=1,Si=this[Et+--fi];fi>0&&(pi*=256);)Si+=this[Et+--fi]*pi;return pi*=128,Si>=pi&&(Si-=Math.pow(2,8*ii)),Si},ae.prototype.readInt8=function(Et,ii){return Et=Et>>>0,ii||di(Et,1,this.length),this[Et]&128?(255-this[Et]+1)*-1:this[Et]},ae.prototype.readInt16LE=function(Et,ii){Et=Et>>>0,ii||di(Et,2,this.length);var si=this[Et]|this[Et+1]<<8;return si&32768?si|4294901760:si},ae.prototype.readInt16BE=function(Et,ii){Et=Et>>>0,ii||di(Et,2,this.length);var si=this[Et+1]|this[Et]<<8;return si&32768?si|4294901760:si},ae.prototype.readInt32LE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),this[Et]|this[Et+1]<<8|this[Et+2]<<16|this[Et+3]<<24},ae.prototype.readInt32BE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),this[Et]<<24|this[Et+1]<<16|this[Et+2]<<8|this[Et+3]},ae.prototype.readFloatLE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),oe.read(this,Et,!0,23,4)},ae.prototype.readFloatBE=function(Et,ii){return Et=Et>>>0,ii||di(Et,4,this.length),oe.read(this,Et,!1,23,4)},ae.prototype.readDoubleLE=function(Et,ii){return Et=Et>>>0,ii||di(Et,8,this.length),oe.read(this,Et,!0,52,8)},ae.prototype.readDoubleBE=function(Et,ii){return Et=Et>>>0,ii||di(Et,8,this.length),oe.read(this,Et,!1,52,8)};function hi(oi,Et,ii,si,fi,pi){if(!ae.isBuffer(oi))throw new TypeError('"buffer" argument must be a Buffer instance');if(Et>fi||Et<pi)throw new RangeError('"value" argument is out of bounds');if(ii+si>oi.length)throw new RangeError("Index out of range")}ae.prototype.writeUIntLE=function(Et,ii,si,fi){if(Et=+Et,ii=ii>>>0,si=si>>>0,!fi){var pi=Math.pow(2,8*si)-1;hi(this,Et,ii,si,pi,0)}var Si=1,xi=0;for(this[ii]=Et&255;++xi<si&&(Si*=256);)this[ii+xi]=Et/Si&255;return ii+si},ae.prototype.writeUIntBE=function(Et,ii,si,fi){if(Et=+Et,ii=ii>>>0,si=si>>>0,!fi){var pi=Math.pow(2,8*si)-1;hi(this,Et,ii,si,pi,0)}var Si=si-1,xi=1;for(this[ii+Si]=Et&255;--Si>=0&&(xi*=256);)this[ii+Si]=Et/xi&255;return ii+si},ae.prototype.writeUInt8=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,1,255,0),this[ii]=Et&255,ii+1},ae.prototype.writeUInt16LE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,2,65535,0),this[ii]=Et&255,this[ii+1]=Et>>>8,ii+2},ae.prototype.writeUInt16BE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,2,65535,0),this[ii]=Et>>>8,this[ii+1]=Et&255,ii+2},ae.prototype.writeUInt32LE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,4,4294967295,0),this[ii+3]=Et>>>24,this[ii+2]=Et>>>16,this[ii+1]=Et>>>8,this[ii]=Et&255,ii+4},ae.prototype.writeUInt32BE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,4,4294967295,0),this[ii]=Et>>>24,this[ii+1]=Et>>>16,this[ii+2]=Et>>>8,this[ii+3]=Et&255,ii+4},ae.prototype.writeIntLE=function(Et,ii,si,fi){if(Et=+Et,ii=ii>>>0,!fi){var pi=Math.pow(2,8*si-1);hi(this,Et,ii,si,pi-1,-pi)}var Si=0,xi=1,Gi=0;for(this[ii]=Et&255;++Si<si&&(xi*=256);)Et<0&&Gi===0&&this[ii+Si-1]!==0&&(Gi=1),this[ii+Si]=(Et/xi>>0)-Gi&255;return ii+si},ae.prototype.writeIntBE=function(Et,ii,si,fi){if(Et=+Et,ii=ii>>>0,!fi){var pi=Math.pow(2,8*si-1);hi(this,Et,ii,si,pi-1,-pi)}var Si=si-1,xi=1,Gi=0;for(this[ii+Si]=Et&255;--Si>=0&&(xi*=256);)Et<0&&Gi===0&&this[ii+Si+1]!==0&&(Gi=1),this[ii+Si]=(Et/xi>>0)-Gi&255;return ii+si},ae.prototype.writeInt8=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,1,127,-128),Et<0&&(Et=255+Et+1),this[ii]=Et&255,ii+1},ae.prototype.writeInt16LE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,2,32767,-32768),this[ii]=Et&255,this[ii+1]=Et>>>8,ii+2},ae.prototype.writeInt16BE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,2,32767,-32768),this[ii]=Et>>>8,this[ii+1]=Et&255,ii+2},ae.prototype.writeInt32LE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,4,2147483647,-2147483648),this[ii]=Et&255,this[ii+1]=Et>>>8,this[ii+2]=Et>>>16,this[ii+3]=Et>>>24,ii+4},ae.prototype.writeInt32BE=function(Et,ii,si){return Et=+Et,ii=ii>>>0,si||hi(this,Et,ii,4,2147483647,-2147483648),Et<0&&(Et=4294967295+Et+1),this[ii]=Et>>>24,this[ii+1]=Et>>>16,this[ii+2]=Et>>>8,this[ii+3]=Et&255,ii+4};function ci(oi,Et,ii,si,fi,pi){if(ii+si>oi.length)throw new RangeError("Index out of range");if(ii<0)throw new RangeError("Index out of range")}function Ai(oi,Et,ii,si,fi){return Et=+Et,ii=ii>>>0,fi||ci(oi,Et,ii,4),oe.write(oi,Et,ii,si,23,4),ii+4}ae.prototype.writeFloatLE=function(Et,ii,si){return Ai(this,Et,ii,!0,si)},ae.prototype.writeFloatBE=function(Et,ii,si){return Ai(this,Et,ii,!1,si)};function yi(oi,Et,ii,si,fi){return Et=+Et,ii=ii>>>0,fi||ci(oi,Et,ii,8),oe.write(oi,Et,ii,si,52,8),ii+8}ae.prototype.writeDoubleLE=function(Et,ii,si){return yi(this,Et,ii,!0,si)},ae.prototype.writeDoubleBE=function(Et,ii,si){return yi(this,Et,ii,!1,si)},ae.prototype.copy=function(Et,ii,si,fi){if(!ae.isBuffer(Et))throw new TypeError("argument should be a Buffer");if(si||(si=0),!fi&&fi!==0&&(fi=this.length),ii>=Et.length&&(ii=Et.length),ii||(ii=0),fi>0&&fi<si&&(fi=si),fi===si||Et.length===0||this.length===0)return 0;if(ii<0)throw new RangeError("targetStart out of bounds");if(si<0||si>=this.length)throw new RangeError("Index out of range");if(fi<0)throw new RangeError("sourceEnd out of bounds");fi>this.length&&(fi=this.length),Et.length-ii<fi-si&&(fi=Et.length-ii+si);var pi=fi-si;if(this===Et&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(ii,si,fi);else if(this===Et&&si<ii&&ii<fi)for(var Si=pi-1;Si>=0;--Si)Et[Si+ii]=this[Si+si];else Uint8Array.prototype.set.call(Et,this.subarray(si,fi),ii);return pi},ae.prototype.fill=function(Et,ii,si,fi){if(typeof Et=="string"){if(typeof ii=="string"?(fi=ii,ii=0,si=this.length):typeof si=="string"&&(fi=si,si=this.length),fi!==void 0&&typeof fi!="string")throw new TypeError("encoding must be a string");if(typeof fi=="string"&&!ae.isEncoding(fi))throw new TypeError("Unknown encoding: "+fi);if(Et.length===1){var pi=Et.charCodeAt(0);(fi==="utf8"&&pi<128||fi==="latin1")&&(Et=pi)}}else typeof Et=="number"&&(Et=Et&255);if(ii<0||this.length<ii||this.length<si)throw new RangeError("Out of range index");if(si<=ii)return this;ii=ii>>>0,si=si===void 0?this.length:si>>>0,Et||(Et=0);var Si;if(typeof Et=="number")for(Si=ii;Si<si;++Si)this[Si]=Et;else{var xi=ae.isBuffer(Et)?Et:ae.from(Et,fi),Gi=xi.length;if(Gi===0)throw new TypeError('The value "'+Et+'" is invalid for argument "value"');for(Si=0;Si<si-ii;++Si)this[Si+ii]=xi[Si%Gi]}return this};var ui=/[^+/0-9A-Za-z-_]/g;function Ci(oi){if(oi=oi.split("=")[0],oi=oi.trim().replace(ui,""),oi.length<2)return"";for(;oi.length%4!==0;)oi=oi+"=";return oi}function zi(oi){return oi<16?"0"+oi.toString(16):oi.toString(16)}function Ni(oi,Et){Et=Et||1/0;for(var ii,si=oi.length,fi=null,pi=[],Si=0;Si<si;++Si){if(ii=oi.charCodeAt(Si),ii>55295&&ii<57344){if(!fi){if(ii>56319){(Et-=3)>-1&&pi.push(239,191,189);continue}else if(Si+1===si){(Et-=3)>-1&&pi.push(239,191,189);continue}fi=ii;continue}if(ii<56320){(Et-=3)>-1&&pi.push(239,191,189),fi=ii;continue}ii=(fi-55296<<10|ii-56320)+65536}else fi&&(Et-=3)>-1&&pi.push(239,191,189);if(fi=null,ii<128){if((Et-=1)<0)break;pi.push(ii)}else if(ii<2048){if((Et-=2)<0)break;pi.push(ii>>6|192,ii&63|128)}else if(ii<65536){if((Et-=3)<0)break;pi.push(ii>>12|224,ii>>6&63|128,ii&63|128)}else if(ii<1114112){if((Et-=4)<0)break;pi.push(ii>>18|240,ii>>12&63|128,ii>>6&63|128,ii&63|128)}else throw new Error("Invalid code point")}return pi}function Mi(oi){for(var Et=[],ii=0;ii<oi.length;++ii)Et.push(oi.charCodeAt(ii)&255);return Et}function mi(oi,Et){for(var ii,si,fi,pi=[],Si=0;Si<oi.length&&!((Et-=2)<0);++Si)ii=oi.charCodeAt(Si),si=ii>>8,fi=ii%256,pi.push(fi),pi.push(si);return pi}function vi(oi){return $.toByteArray(Ci(oi))}function bi(oi,Et,ii,si){for(var fi=0;fi<si&&!(fi+ii>=Et.length||fi>=oi.length);++fi)Et[fi+ii]=oi[fi];return fi}function gi(oi,Et){return oi instanceof Et||oi!=null&&oi.constructor!=null&&oi.constructor.name!=null&&oi.constructor.name===Et.name}function li(oi){return oi!==oi}}).call(this)}).call(this,r("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(r,g,V){(function(k){(function(){V.formatArgs=oe,V.save=re,V.load=Ce,V.useColors=$,V.storage=ie(),V.destroy=(()=>{let le=!1;return()=>{le||(le=!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`."))}})(),V.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"];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+)/)}function oe(le){if(le[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+le[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;const Ie="color: "+this.color;le.splice(1,0,Ie,"color: inherit");let ue=0,de=0;le[0].replace(/%[a-zA-Z%]/g,Ne=>{Ne!=="%%"&&(ue++,Ne==="%c"&&(de=ue))}),le.splice(de,0,Ie)}V.log=console.debug||console.log||(()=>{});function re(le){try{le?V.storage.setItem("debug",le):V.storage.removeItem("debug")}catch{}}function Ce(){let le;try{le=V.storage.getItem("debug")}catch{}return!le&&typeof k<"u"&&"env"in k&&(le=k.env.DEBUG),le}function ie(){try{return localStorage}catch{}}g.exports=r("./common")(V);const{formatters:ae}=g.exports;ae.j=function(le){try{return JSON.stringify(le)}catch(Ie){return"[UnexpectedJSONParseError]: "+Ie.message}}}).call(this)}).call(this,r("_process"))},{"./common":19,_process:50}],19:[function(r,g,V){function k($){re.debug=re,re.default=re,re.coerce=ue,re.disable=ae,re.enable=ie,re.enabled=le,re.humanize=r("ms"),re.destroy=de,Object.keys($).forEach(Ne=>{re[Ne]=$[Ne]}),re.names=[],re.skips=[],re.formatters={};function oe(Ne){let he=0;for(let pe=0;pe<Ne.length;pe++)he=(he<<5)-he+Ne.charCodeAt(pe),he|=0;return re.colors[Math.abs(he)%re.colors.length]}re.selectColor=oe;function re(Ne){let he,pe=null,ze,xe;function Oe(..._e){if(!Oe.enabled)return;const At=Oe,$e=Number(new Date),Fe=$e-(he||$e);At.diff=Fe,At.prev=he,At.curr=$e,he=$e,_e[0]=re.coerce(_e[0]),typeof _e[0]!="string"&&_e.unshift("%O");let Ue=0;_e[0]=_e[0].replace(/%([a-zA-Z%])/g,(Dt,qe)=>{if(Dt==="%%")return"%";Ue++;const kt=re.formatters[qe];if(typeof kt=="function"){const jt=_e[Ue];Dt=kt.call(At,jt),_e.splice(Ue,1),Ue--}return Dt}),re.formatArgs.call(At,_e),(At.log||re.log).apply(At,_e)}return Oe.namespace=Ne,Oe.useColors=re.useColors(),Oe.color=re.selectColor(Ne),Oe.extend=Ce,Oe.destroy=re.destroy,Object.defineProperty(Oe,"enabled",{enumerable:!0,configurable:!1,get:()=>pe!==null?pe:(ze!==re.namespaces&&(ze=re.namespaces,xe=re.enabled(Ne)),xe),set:_e=>{pe=_e}}),typeof re.init=="function"&&re.init(Oe),Oe}function Ce(Ne,he){const pe=re(this.namespace+(typeof he>"u"?":":he)+Ne);return pe.log=this.log,pe}function ie(Ne){re.save(Ne),re.namespaces=Ne,re.names=[],re.skips=[];let he;const pe=(typeof Ne=="string"?Ne:"").split(/[\s,]+/),ze=pe.length;for(he=0;he<ze;he++)pe[he]&&(Ne=pe[he].replace(/\*/g,".*?"),Ne[0]==="-"?re.skips.push(new RegExp("^"+Ne.substr(1)+"$")):re.names.push(new RegExp("^"+Ne+"$")))}function ae(){const Ne=[...re.names.map(Ie),...re.skips.map(Ie).map(he=>"-"+he)].join(",");return re.enable(""),Ne}function le(Ne){if(Ne[Ne.length-1]==="*")return!0;let he,pe;for(he=0,pe=re.skips.length;he<pe;he++)if(re.skips[he].test(Ne))return!1;for(he=0,pe=re.names.length;he<pe;he++)if(re.names[he].test(Ne))return!0;return!1}function Ie(Ne){return Ne.toString().substring(2,Ne.toString().length-2).replace(/\.\*\?$/,"*")}function ue(Ne){return Ne instanceof Error?Ne.stack||Ne.message:Ne}function de(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return re.enable(re.load()),re}g.exports=k},{ms:45}],20:[function(r,g,V){(function(k,$){(function(){var oe=r("readable-stream"),re=r("end-of-stream"),Ce=r("inherits"),ie=r("stream-shift"),ae=$.from&&$.from!==Uint8Array.from?$.from([0]):new $([0]),le=function(ze,xe){ze._corked?ze.once("uncork",xe):xe()},Ie=function(ze,xe){ze._autoDestroy&&ze.destroy(xe)},ue=function(ze,xe){return function(Oe){Oe?Ie(ze,Oe.message==="premature close"?null:Oe):xe&&!ze._ended&&ze.end()}},de=function(ze,xe){if(!ze||ze._writableState&&ze._writableState.finished)return xe();if(ze._writableState)return ze.end(xe);ze.end(),xe()},Ne=function(){},he=function(ze){return new oe.Readable({objectMode:!0,highWaterMark:16}).wrap(ze)},pe=function(ze,xe,Oe){if(!(this instanceof pe))return new pe(ze,xe,Oe);oe.Duplex.call(this,Oe),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!Oe||Oe.autoDestroy!==!1,this._forwardDestroy=!Oe||Oe.destroy!==!1,this._forwardEnd=!Oe||Oe.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,ze&&this.setWritable(ze),xe&&this.setReadable(xe)};Ce(pe,oe.Duplex),pe.obj=function(ze,xe,Oe){return Oe||(Oe={}),Oe.objectMode=!0,Oe.highWaterMark=16,new pe(ze,xe,Oe)},pe.prototype.cork=function(){++this._corked===1&&this.emit("cork")},pe.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},pe.prototype.setWritable=function(ze){if(this._unwrite&&this._unwrite(),this.destroyed){ze&&ze.destroy&&ze.destroy();return}if(ze===null||ze===!1){this.end();return}var xe=this,Oe=re(ze,{writable:!0,readable:!1},ue(this,this._forwardEnd)),_e=function(){var $e=xe._ondrain;xe._ondrain=null,$e&&$e()},At=function(){xe._writable.removeListener("drain",_e),Oe()};this._unwrite&&k.nextTick(_e),this._writable=ze,this._writable.on("drain",_e),this._unwrite=At,this.uncork()},pe.prototype.setReadable=function(ze){if(this._unread&&this._unread(),this.destroyed){ze&&ze.destroy&&ze.destroy();return}if(ze===null||ze===!1){this.push(null),this.resume();return}var xe=this,Oe=re(ze,{writable:!1,readable:!0},ue(this)),_e=function(){xe._forward()},At=function(){xe.push(null)},$e=function(){xe._readable2.removeListener("readable",_e),xe._readable2.removeListener("end",At),Oe()};this._drained=!0,this._readable=ze,this._readable2=ze._readableState?ze:he(ze),this._readable2.on("readable",_e),this._readable2.on("end",At),this._unread=$e,this._forward()},pe.prototype._read=function(){this._drained=!0,this._forward()},pe.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var ze;this._drained&&(ze=ie(this._readable2))!==null;)this.destroyed||(this._drained=this.push(ze));this._forwarding=!1}},pe.prototype.destroy=function(ze,xe){if(xe||(xe=Ne),this.destroyed)return xe(null);this.destroyed=!0;var Oe=this;k.nextTick(function(){Oe._destroy(ze),xe(null)})},pe.prototype._destroy=function(ze){if(ze){var xe=this._ondrain;this._ondrain=null,xe?xe(ze):this.emit("error",ze)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},pe.prototype._write=function(ze,xe,Oe){if(!this.destroyed){if(this._corked)return le(this,this._write.bind(this,ze,xe,Oe));if(ze===ae)return this._finish(Oe);if(!this._writable)return Oe();this._writable.write(ze)===!1?this._ondrain=Oe:this.destroyed||Oe()}},pe.prototype._finish=function(ze){var xe=this;this.emit("preend"),le(this,function(){de(xe._forwardEnd&&xe._writable,function(){xe._writableState.prefinished===!1&&(xe._writableState.prefinished=!0),xe.emit("prefinish"),le(xe,ze)})})},pe.prototype.end=function(ze,xe,Oe){return typeof ze=="function"?this.end(null,null,ze):typeof xe=="function"?this.end(ze,null,xe):(this._ended=!0,ze&&this.write(ze),!this._writableState.ending&&!this._writableState.destroyed&&this.write(ae),oe.Writable.prototype.end.call(this,Oe))},g.exports=pe}).call(this)}).call(this,r("_process"),r("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(r,g,V){(function(k){(function(){var $=r("once"),oe=function(){},re=function(ae){return ae.setHeader&&typeof ae.abort=="function"},Ce=function(ae){return ae.stdio&&Array.isArray(ae.stdio)&&ae.stdio.length===3},ie=function(ae,le,Ie){if(typeof le=="function")return ie(ae,null,le);le||(le={}),Ie=$(Ie||oe);var ue=ae._writableState,de=ae._readableState,Ne=le.readable||le.readable!==!1&&ae.readable,he=le.writable||le.writable!==!1&&ae.writable,pe=!1,ze=function(){ae.writable||xe()},xe=function(){he=!1,Ne||Ie.call(ae)},Oe=function(){Ne=!1,he||Ie.call(ae)},_e=function(Ve){Ie.call(ae,Ve?new Error("exited with error code: "+Ve):null)},At=function(Ve){Ie.call(ae,Ve)},$e=function(){k.nextTick(Fe)},Fe=function(){if(!pe){if(Ne&&!(de&&de.ended&&!de.destroyed))return Ie.call(ae,new Error("premature close"));if(he&&!(ue&&ue.ended&&!ue.destroyed))return Ie.call(ae,new Error("premature close"))}},Ue=function(){ae.req.on("finish",xe)};return re(ae)?(ae.on("complete",xe),ae.on("abort",$e),ae.req?Ue():ae.on("request",Ue)):he&&!ue&&(ae.on("end",ze),ae.on("close",ze)),Ce(ae)&&ae.on("exit",_e),ae.on("end",Oe),ae.on("finish",xe),le.error!==!1&&ae.on("error",At),ae.on("close",$e),function(){pe=!0,ae.removeListener("complete",xe),ae.removeListener("abort",$e),ae.removeListener("request",Ue),ae.req&&ae.req.removeListener("finish",xe),ae.removeListener("end",ze),ae.removeListener("close",ze),ae.removeListener("finish",xe),ae.removeListener("exit",_e),ae.removeListener("end",Oe),ae.removeListener("error",At),ae.removeListener("close",$e)}};g.exports=ie}).call(this)}).call(this,r("_process"))},{_process:50,once:48}],22:[function(r,g,V){var k=Object.create||Ue,$=Object.keys||Ve,oe=Function.prototype.bind||Dt;function re(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=k(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}g.exports=re,re.EventEmitter=re,re.prototype._events=void 0,re.prototype._maxListeners=void 0;var Ce=10,ie;try{var ae={};Object.defineProperty&&Object.defineProperty(ae,"x",{value:0}),ie=ae.x===0}catch{ie=!1}ie?Object.defineProperty(re,"defaultMaxListeners",{enumerable:!0,get:function(){return Ce},set:function(qe){if(typeof qe!="number"||qe<0||qe!==qe)throw new TypeError('"defaultMaxListeners" must be a positive number');Ce=qe}}):re.defaultMaxListeners=Ce,re.prototype.setMaxListeners=function(kt){if(typeof kt!="number"||kt<0||isNaN(kt))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=kt,this};function le(qe){return qe._maxListeners===void 0?re.defaultMaxListeners:qe._maxListeners}re.prototype.getMaxListeners=function(){return le(this)};function Ie(qe,kt,jt){if(kt)qe.call(jt);else for(var Pt=qe.length,ti=$e(qe,Pt),ei=0;ei<Pt;++ei)ti[ei].call(jt)}function ue(qe,kt,jt,Pt){if(kt)qe.call(jt,Pt);else for(var ti=qe.length,ei=$e(qe,ti),Lt=0;Lt<ti;++Lt)ei[Lt].call(jt,Pt)}function de(qe,kt,jt,Pt,ti){if(kt)qe.call(jt,Pt,ti);else for(var ei=qe.length,Lt=$e(qe,ei),ni=0;ni<ei;++ni)Lt[ni].call(jt,Pt,ti)}function Ne(qe,kt,jt,Pt,ti,ei){if(kt)qe.call(jt,Pt,ti,ei);else for(var Lt=qe.length,ni=$e(qe,Lt),ri=0;ri<Lt;++ri)ni[ri].call(jt,Pt,ti,ei)}function he(qe,kt,jt,Pt){if(kt)qe.apply(jt,Pt);else for(var ti=qe.length,ei=$e(qe,ti),Lt=0;Lt<ti;++Lt)ei[Lt].apply(jt,Pt)}re.prototype.emit=function(kt){var jt,Pt,ti,ei,Lt,ni,ri=kt==="error";if(ni=this._events,ni)ri=ri&&ni.error==null;else if(!ri)return!1;if(ri){if(arguments.length>1&&(jt=arguments[1]),jt instanceof Error)throw jt;var Ii=new Error('Unhandled "error" event. ('+jt+")");throw Ii.context=jt,Ii}if(Pt=ni[kt],!Pt)return!1;var wi=typeof Pt=="function";switch(ti=arguments.length,ti){case 1:Ie(Pt,wi,this);break;case 2:ue(Pt,wi,this,arguments[1]);break;case 3:de(Pt,wi,this,arguments[1],arguments[2]);break;case 4:Ne(Pt,wi,this,arguments[1],arguments[2],arguments[3]);break;default:for(ei=new Array(ti-1),Lt=1;Lt<ti;Lt++)ei[Lt-1]=arguments[Lt];he(Pt,wi,this,ei)}return!0};function pe(qe,kt,jt,Pt){var ti,ei,Lt;if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');if(ei=qe._events,ei?(ei.newListener&&(qe.emit("newListener",kt,jt.listener?jt.listener:jt),ei=qe._events),Lt=ei[kt]):(ei=qe._events=k(null),qe._eventsCount=0),!Lt)Lt=ei[kt]=jt,++qe._eventsCount;else if(typeof Lt=="function"?Lt=ei[kt]=Pt?[jt,Lt]:[Lt,jt]:Pt?Lt.unshift(jt):Lt.push(jt),!Lt.warned&&(ti=le(qe),ti&&ti>0&&Lt.length>ti)){Lt.warned=!0;var ni=new Error("Possible EventEmitter memory leak detected. "+Lt.length+' "'+String(kt)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');ni.name="MaxListenersExceededWarning",ni.emitter=qe,ni.type=kt,ni.count=Lt.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",ni.name,ni.message)}return qe}re.prototype.addListener=function(kt,jt){return pe(this,kt,jt,!1)},re.prototype.on=re.prototype.addListener,re.prototype.prependListener=function(kt,jt){return pe(this,kt,jt,!0)};function ze(){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 qe=new Array(arguments.length),kt=0;kt<qe.length;++kt)qe[kt]=arguments[kt];this.listener.apply(this.target,qe)}}function xe(qe,kt,jt){var Pt={fired:!1,wrapFn:void 0,target:qe,type:kt,listener:jt},ti=oe.call(ze,Pt);return ti.listener=jt,Pt.wrapFn=ti,ti}re.prototype.once=function(kt,jt){if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');return this.on(kt,xe(this,kt,jt)),this},re.prototype.prependOnceListener=function(kt,jt){if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(kt,xe(this,kt,jt)),this},re.prototype.removeListener=function(kt,jt){var Pt,ti,ei,Lt,ni;if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');if(ti=this._events,!ti)return this;if(Pt=ti[kt],!Pt)return this;if(Pt===jt||Pt.listener===jt)--this._eventsCount===0?this._events=k(null):(delete ti[kt],ti.removeListener&&this.emit("removeListener",kt,Pt.listener||jt));else if(typeof Pt!="function"){for(ei=-1,Lt=Pt.length-1;Lt>=0;Lt--)if(Pt[Lt]===jt||Pt[Lt].listener===jt){ni=Pt[Lt].listener,ei=Lt;break}if(ei<0)return this;ei===0?Pt.shift():At(Pt,ei),Pt.length===1&&(ti[kt]=Pt[0]),ti.removeListener&&this.emit("removeListener",kt,ni||jt)}return this},re.prototype.removeAllListeners=function(kt){var jt,Pt,ti;if(Pt=this._events,!Pt)return this;if(!Pt.removeListener)return arguments.length===0?(this._events=k(null),this._eventsCount=0):Pt[kt]&&(--this._eventsCount===0?this._events=k(null):delete Pt[kt]),this;if(arguments.length===0){var ei=$(Pt),Lt;for(ti=0;ti<ei.length;++ti)Lt=ei[ti],Lt!=="removeListener"&&this.removeAllListeners(Lt);return this.removeAllListeners("removeListener"),this._events=k(null),this._eventsCount=0,this}if(jt=Pt[kt],typeof jt=="function")this.removeListener(kt,jt);else if(jt)for(ti=jt.length-1;ti>=0;ti--)this.removeListener(kt,jt[ti]);return this};function Oe(qe,kt,jt){var Pt=qe._events;if(!Pt)return[];var ti=Pt[kt];return ti?typeof ti=="function"?jt?[ti.listener||ti]:[ti]:jt?Fe(ti):$e(ti,ti.length):[]}re.prototype.listeners=function(kt){return Oe(this,kt,!0)},re.prototype.rawListeners=function(kt){return Oe(this,kt,!1)},re.listenerCount=function(qe,kt){return typeof qe.listenerCount=="function"?qe.listenerCount(kt):_e.call(qe,kt)},re.prototype.listenerCount=_e;function _e(qe){var kt=this._events;if(kt){var jt=kt[qe];if(typeof jt=="function")return 1;if(jt)return jt.length}return 0}re.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function At(qe,kt){for(var jt=kt,Pt=jt+1,ti=qe.length;Pt<ti;jt+=1,Pt+=1)qe[jt]=qe[Pt];qe.pop()}function $e(qe,kt){for(var jt=new Array(kt),Pt=0;Pt<kt;++Pt)jt[Pt]=qe[Pt];return jt}function Fe(qe){for(var kt=new Array(qe.length),jt=0;jt<kt.length;++jt)kt[jt]=qe[jt].listener||qe[jt];return kt}function Ue(qe){var kt=function(){};return kt.prototype=qe,new kt}function Ve(qe){for(var kt in qe)Object.prototype.hasOwnProperty.call(qe,kt);return kt}function Dt(qe){var kt=this;return function(){return kt.apply(qe,arguments)}}},{}],23:[function(r,g,V){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */V.read=function(k,$,oe,re,Ce){var ie,ae,le=Ce*8-re-1,Ie=(1<<le)-1,ue=Ie>>1,de=-7,Ne=oe?Ce-1:0,he=oe?-1:1,pe=k[$+Ne];for(Ne+=he,ie=pe&(1<<-de)-1,pe>>=-de,de+=le;de>0;ie=ie*256+k[$+Ne],Ne+=he,de-=8);for(ae=ie&(1<<-de)-1,ie>>=-de,de+=re;de>0;ae=ae*256+k[$+Ne],Ne+=he,de-=8);if(ie===0)ie=1-ue;else{if(ie===Ie)return ae?NaN:(pe?-1:1)*(1/0);ae=ae+Math.pow(2,re),ie=ie-ue}return(pe?-1:1)*ae*Math.pow(2,ie-re)},V.write=function(k,$,oe,re,Ce,ie){var ae,le,Ie,ue=ie*8-Ce-1,de=(1<<ue)-1,Ne=de>>1,he=Ce===23?Math.pow(2,-24)-Math.pow(2,-77):0,pe=re?0:ie-1,ze=re?1:-1,xe=$<0||$===0&&1/$<0?1:0;for($=Math.abs($),isNaN($)||$===1/0?(le=isNaN($)?1:0,ae=de):(ae=Math.floor(Math.log($)/Math.LN2),$*(Ie=Math.pow(2,-ae))<1&&(ae--,Ie*=2),ae+Ne>=1?$+=he/Ie:$+=he*Math.pow(2,1-Ne),$*Ie>=2&&(ae++,Ie/=2),ae+Ne>=de?(le=0,ae=de):ae+Ne>=1?(le=($*Ie-1)*Math.pow(2,Ce),ae=ae+Ne):(le=$*Math.pow(2,Ne-1)*Math.pow(2,Ce),ae=0));Ce>=8;k[oe+pe]=le&255,pe+=ze,le/=256,Ce-=8);for(ae=ae<<Ce|le,ue+=Ce;ue>0;k[oe+pe]=ae&255,pe+=ze,ae/=256,ue-=8);k[oe+pe-ze]|=xe*128}},{}],24:[function(r,g,V){typeof Object.create=="function"?g.exports=function($,oe){oe&&($.super_=oe,$.prototype=Object.create(oe.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}}))}:g.exports=function($,oe){if(oe){$.super_=oe;var re=function(){};re.prototype=oe.prototype,$.prototype=new re,$.prototype.constructor=$}}},{}],25:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=function(){function $(oe,re){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=oe,this.value=re}return $.prototype.rotateLeft=function(){var oe=this.parent,re=this.brother,Ce=this.leftChild,ie=this.rightChild;if(!ie)throw new Error("unknown error");var ae=ie.leftChild,le=ie.rightChild;return oe&&(oe.leftChild===this?oe.leftChild=ie:oe.rightChild===this&&(oe.rightChild=ie)),ie.parent=oe,ie.brother=re,ie.leftChild=this,ie.rightChild=le,re&&(re.brother=ie),this.parent=ie,this.brother=le,this.leftChild=Ce,this.rightChild=ae,le&&(le.parent=ie,le.brother=this),Ce&&(Ce.parent=this,Ce.brother=ae),ae&&(ae.parent=this,ae.brother=Ce),ie},$.prototype.rotateRight=function(){var oe=this.parent,re=this.brother,Ce=this.leftChild;if(!Ce)throw new Error("unknown error");var ie=this.rightChild,ae=Ce.leftChild,le=Ce.rightChild;return oe&&(oe.leftChild===this?oe.leftChild=Ce:oe.rightChild===this&&(oe.rightChild=Ce)),Ce.parent=oe,Ce.brother=re,Ce.leftChild=ae,Ce.rightChild=this,re&&(re.brother=Ce),ae&&(ae.parent=Ce,ae.brother=this),this.parent=Ce,this.brother=ae,this.leftChild=le,this.rightChild=ie,le&&(le.parent=this,le.brother=ie),ie&&(ie.parent=this,ie.brother=le),Ce},$.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},$.TreeNodeColorType={red:!0,black:!1},$}();Object.freeze(k),V.default=k},{}],26:[function(r,g,V){var k=this&&this.__generator||function(oe,re){var Ce={label:0,sent:function(){if(le[0]&1)throw le[1];return le[1]},trys:[],ops:[]},ie,ae,le,Ie;return Ie={next:ue(0),throw:ue(1),return:ue(2)},typeof Symbol=="function"&&(Ie[Symbol.iterator]=function(){return this}),Ie;function ue(Ne){return function(he){return de([Ne,he])}}function de(Ne){if(ie)throw new TypeError("Generator is already executing.");for(;Ce;)try{if(ie=1,ae&&(le=Ne[0]&2?ae.return:Ne[0]?ae.throw||((le=ae.return)&&le.call(ae),0):ae.next)&&!(le=le.call(ae,Ne[1])).done)return le;switch(ae=0,le&&(Ne=[Ne[0]&2,le.value]),Ne[0]){case 0:case 1:le=Ne;break;case 4:return Ce.label++,{value:Ne[1],done:!1};case 5:Ce.label++,ae=Ne[1],Ne=[0];continue;case 7:Ne=Ce.ops.pop(),Ce.trys.pop();continue;default:if(le=Ce.trys,!(le=le.length>0&&le[le.length-1])&&(Ne[0]===6||Ne[0]===2)){Ce=0;continue}if(Ne[0]===3&&(!le||Ne[1]>le[0]&&Ne[1]<le[3])){Ce.label=Ne[1];break}if(Ne[0]===6&&Ce.label<le[1]){Ce.label=le[1],le=Ne;break}if(le&&Ce.label<le[2]){Ce.label=le[2],Ce.ops.push(Ne);break}le[2]&&Ce.ops.pop(),Ce.trys.pop();continue}Ne=re.call(oe,Ce)}catch(he){Ne=[6,he],ae=0}finally{ie=le=0}if(Ne[0]&5)throw Ne[1];return{value:Ne[0]?Ne[1]:void 0,done:!0}}};Object.defineProperty(V,"__esModule",{value:!0}),$.sigma=3,$.bucketSize=5e3;function $(oe){var re=this;oe===void 0&&(oe=[]);var Ce=[],ie=0,ae=0,le=0,Ie=0,ue=0,de=0;this.size=function(){return de},this.empty=function(){return de===0},this.clear=function(){ie=le=ae=Ie=ue=de=0,he.call(this,$.bucketSize),de=0},this.front=function(){return Ce[ie][ae]},this.back=function(){return Ce[le][Ie]},this.forEach=function(pe){if(!this.empty()){var ze=0;if(ie===le){for(var xe=ae;xe<=Ie;++xe)pe(Ce[ie][xe],ze++);return}for(var xe=ae;xe<$.bucketSize;++xe)pe(Ce[ie][xe],ze++);for(var xe=ie+1;xe<le;++xe)for(var Oe=0;Oe<$.bucketSize;++Oe)pe(Ce[xe][Oe],ze++);for(var xe=0;xe<=Ie;++xe)pe(Ce[le][xe],ze++)}};var Ne=function(pe){var ze=ie*$.bucketSize+ae,xe=ze+pe,Oe=le*$.bucketSize+Ie;if(xe<ze||xe>Oe)throw new Error("pos should more than 0 and less than queue's size");var _e=Math.floor(xe/$.bucketSize),At=xe%$.bucketSize;return{curNodeBucketIndex:_e,curNodePointerIndex:At}};this.getElementByPos=function(pe){var ze=Ne(pe),xe=ze.curNodeBucketIndex,Oe=ze.curNodePointerIndex;return Ce[xe][Oe]},this.eraseElementByPos=function(pe){var ze=this;if(pe<0||pe>de)throw new Error("pos should more than 0 and less than queue's size");if(pe===0)this.popFront();else if(pe===this.size())this.popBack();else{for(var xe=[],Oe=pe+1;Oe<de;++Oe)xe.push(this.getElementByPos(Oe));this.cut(pe),this.popBack(),xe.forEach(function(_e){return ze.pushBack(_e)})}},this.eraseElementByValue=function(pe){if(!this.empty()){var ze=[];this.forEach(function(_e){_e!==pe&&ze.push(_e)});for(var xe=ze.length,Oe=0;Oe<xe;++Oe)this.setElementByPos(Oe,ze[Oe]);this.cut(xe-1)}};var he=function(pe){for(var ze=[],xe=pe*$.sigma,Oe=Math.max(Math.ceil(xe/$.bucketSize),2),_e=0;_e<Oe;++_e)ze.push(new Array($.bucketSize));var At=Math.ceil(pe/$.bucketSize),$e=Math.floor(Oe/2)-Math.floor(At/2),Fe=$e,Ue=0;if(this.size())for(var _e=0;_e<At;++_e){for(var Ve=0;Ve<$.bucketSize;++Ve)if(ze[$e+_e][Ve]=this.front(),this.popFront(),this.empty()){Fe=$e+_e,Ue=Ve;break}if(this.empty())break}Ce=ze,ie=$e,ae=0,le=Fe,Ie=Ue,ue=Oe,de=pe};this.pushBack=function(pe){this.empty()||(le===ue-1&&Ie===$.bucketSize-1&&he.call(this,this.size()),Ie<$.bucketSize-1?++Ie:le<ue-1&&(++le,Ie=0)),++de,Ce[le][Ie]=pe},this.popBack=function(){this.empty()||(this.size()!==1&&(Ie>0?--Ie:ie<le&&(--le,Ie=$.bucketSize-1)),de>0&&--de)},this.setElementByPos=function(pe,ze){var xe=Ne(pe),Oe=xe.curNodeBucketIndex,_e=xe.curNodePointerIndex;Ce[Oe][_e]=ze},this.insert=function(pe,ze,xe){var Oe=this;if(xe===void 0&&(xe=1),pe===0)for(;xe--;)this.pushFront(ze);else if(pe===this.size())for(;xe--;)this.pushBack(ze);else{for(var _e=[],At=pe;At<de;++At)_e.push(this.getElementByPos(At));this.cut(pe-1);for(var At=0;At<xe;++At)this.pushBack(ze);_e.forEach(function($e){return Oe.pushBack($e)})}},this.find=function(pe){if(ie===le){for(var ze=ae;ze<=Ie;++ze)if(Ce[ie][ze]===pe)return!0;return!1}for(var ze=ae;ze<$.bucketSize;++ze)if(Ce[ie][ze]===pe)return!0;for(var ze=ie+1;ze<le;++ze)for(var xe=0;xe<$.bucketSize;++xe)if(Ce[ze][xe]===pe)return!0;for(var ze=0;ze<=Ie;++ze)if(Ce[le][ze]===pe)return!0;return!1},this.reverse=function(){for(var pe=0,ze=de-1;pe<ze;){var xe=this.getElementByPos(pe);this.setElementByPos(pe,this.getElementByPos(ze)),this.setElementByPos(ze,xe),++pe,--ze}},this.unique=function(){if(!this.empty()){var pe=[],ze=this.front();this.forEach(function(Oe,_e){(_e===0||Oe!==ze)&&(pe.push(Oe),ze=Oe)});for(var xe=0;xe<de;++xe)this.setElementByPos(xe,pe[xe]);this.cut(pe.length-1)}},this.sort=function(pe){var ze=[];this.forEach(function(Oe){ze.push(Oe)}),ze.sort(pe);for(var xe=0;xe<de;++xe)this.setElementByPos(xe,ze[xe])},this.pushFront=function(pe){this.empty()||(ie===0&&ae===0&&he.call(this,this.size()),ae>0?--ae:ie>0&&(--ie,ae=$.bucketSize-1)),++de,Ce[ie][ae]=pe},this.popFront=function(){this.empty()||(this.size()!==1&&(ae<$.bucketSize-1?++ae:ie<le&&(++ie,ae=0)),de>0&&--de)},this.shrinkToFit=function(){var pe=this,ze=[];this.forEach(function(At){ze.push(At)});var xe=ze.length;Ce=[];for(var Oe=Math.ceil(xe/$.bucketSize),_e=0;_e<Oe;++_e)Ce.push(new Array($.bucketSize));this.clear(),ze.forEach(function(At){return pe.pushBack(At)})},this.cut=function(pe){if(pe<0){this.clear();return}var ze=Ne(pe),xe=ze.curNodeBucketIndex,Oe=ze.curNodePointerIndex;le=xe,Ie=Oe,de=pe+1},this[Symbol.iterator]=function(){return function(){var ze,ze,ze,pe,ze;return k(this,function(xe){switch(xe.label){case 0:if(de===0)return[2];if(ie!==le)return[3,5];ze=ae,xe.label=1;case 1:return ze<=Ie?[4,Ce[ie][ze]]:[3,4];case 2:xe.sent(),xe.label=3;case 3:return++ze,[3,1];case 4:return[2];case 5:ze=ae,xe.label=6;case 6:return ze<$.bucketSize?[4,Ce[ie][ze]]:[3,9];case 7:xe.sent(),xe.label=8;case 8:return++ze,[3,6];case 9:ze=ie+1,xe.label=10;case 10:if(!(ze<le))return[3,15];pe=0,xe.label=11;case 11:return pe<$.bucketSize?[4,Ce[ze][pe]]:[3,14];case 12:xe.sent(),xe.label=13;case 13:return++pe,[3,11];case 14:return++ze,[3,10];case 15:ze=0,xe.label=16;case 16:return ze<=Ie?[4,Ce[le][ze]]:[3,19];case 17:xe.sent(),xe.label=18;case 18:return++ze,[3,16];case 19:return[2]}})}()},function(){var pe=$.bucketSize;oe.size?pe=oe.size():oe.length&&(pe=oe.length);var ze=pe*$.sigma;ue=Math.ceil(ze/$.bucketSize),ue=Math.max(ue,3);for(var xe=0;xe<ue;++xe)Ce.push(new Array($.bucketSize));var Oe=Math.ceil(pe/$.bucketSize);ie=Math.floor(ue/2)-Math.floor(Oe/2),le=ie,oe.forEach(function(_e){return re.pushBack(_e)})}(),Object.freeze(this)}Object.freeze($),V.default=$},{}],27:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../LinkList/LinkList"),re=r("../Map/Map");Ce.initSize=16,Ce.maxSize=1<<30,Ce.sigma=.75,Ce.treeifyThreshold=8,Ce.untreeifyThreshold=6,Ce.minTreeifySize=64;function Ce(ie,ae,le){var Ie=this;if(ie===void 0&&(ie=[]),ae===void 0&&(ae=Ce.initSize),le=le||function(pe){var ze,xe,Oe=0,_e="";if(typeof pe=="number")Oe=Math.floor(pe),Oe=(Oe<<5)-Oe,Oe=Oe&Oe;else{typeof pe!="string"?_e=JSON.stringify(pe):_e=pe;try{for(var At=$(_e),$e=At.next();!$e.done;$e=At.next()){var Fe=$e.value,Ue=Fe.charCodeAt(0);Oe=(Oe<<5)-Oe+Ue,Oe=Oe&Oe}}catch(Ve){ze={error:Ve}}finally{try{$e&&!$e.done&&(xe=At.return)&&xe.call(At)}finally{if(ze)throw ze.error}}}return Oe^=Oe>>>16,Oe},ae&ae-1)throw new Error("initBucketNum must be 2 to the power of n");var ue=0,de=[],Ne=Math.max(Ce.initSize,Math.min(Ce.maxSize,ae));this.size=function(){return ue},this.empty=function(){return ue===0},this.clear=function(){ue=0,Ne=ae,de=[]},this.forEach=function(pe){var ze=0;de.forEach(function(xe){xe.forEach(function(Oe){pe(Oe,ze++)})})};var he=function(pe){if(!(pe>=Ce.maxSize)){Ne=pe*2;var ze=[];de.forEach(function(xe,Oe){if(!xe.empty()){if(xe instanceof oe.default&&xe.size()===1){var _e=xe.front(),At=_e.key,$e=_e.value;ze[le(At)&Ne-1]=new oe.default([{key:At,value:$e}])}else if(xe instanceof re.default){var Fe=new oe.default,Ue=new oe.default;xe.forEach(function(qe){var kt=le(qe.key);kt&pe?Ue.pushBack(qe):Fe.pushBack(qe)}),Fe.size()>Ce.untreeifyThreshold?ze[Oe]=new re.default(Fe):Fe.size()&&(ze[Oe]=Fe),Ue.size()>Ce.untreeifyThreshold?ze[Oe+pe]=new re.default(Ue):Ue.size()&&(ze[Oe+pe]=Ue)}else{var Ve=new oe.default,Dt=new oe.default;xe.forEach(function(qe){var kt=le(qe.key);kt&pe?Dt.pushBack(qe):Ve.pushBack(qe)}),Ve.size()&&(ze[Oe]=Ve),Dt.size()&&(ze[Oe+pe]=Dt)}de[Oe].clear()}}),de=ze}};this.setElement=function(pe,ze){var xe,Oe;if(pe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(ze==null){this.eraseElementByKey(pe);return}var _e=le(pe)&Ne-1;if(!de[_e])++ue,de[_e]=new oe.default([{key:pe,value:ze}]);else{var At=de[_e].size();if(de[_e]instanceof oe.default){try{for(var $e=$(de[_e]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(Ue.key===pe){Ue.value=ze;return}}}catch(Dt){xe={error:Dt}}finally{try{Fe&&!Fe.done&&(Oe=$e.return)&&Oe.call($e)}finally{if(xe)throw xe.error}}de[_e].pushBack({key:pe,value:ze}),de[_e].size()>=Ce.treeifyThreshold&&(de[_e]=new re.default(de[_e]))}else de[_e].setElement(pe,ze);var Ve=de[_e].size();ue+=Ve-At}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.getElementByKey=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(de[Oe]){if(de[Oe]instanceof re.default)return de[Oe].getElementByKey(pe);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===pe)return $e.value}}catch(Fe){ze={error:Fe}}finally{try{At&&!At.done&&(xe=_e.return)&&xe.call(_e)}finally{if(ze)throw ze.error}}}},this.eraseElementByKey=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(de[Oe]){var _e=de[Oe].size();if(de[Oe]instanceof re.default)de[Oe].eraseElementByKey(pe),de[Oe].size()<=Ce.untreeifyThreshold&&(de[Oe]=new oe.default(de[Oe]));else{var At=-1;try{for(var $e=$(de[Oe]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(++At,Ue.key===pe){de[Oe].eraseElementByPos(At);break}}}catch(Dt){ze={error:Dt}}finally{try{Fe&&!Fe.done&&(xe=$e.return)&&xe.call($e)}finally{if(ze)throw ze.error}}}var Ve=de[Oe].size();ue+=Ve-_e}},this.find=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(!de[Oe])return!1;if(de[Oe]instanceof re.default)return de[Oe].find(pe);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===pe)return!0}}catch(Fe){ze={error:Fe}}finally{try{At&&!At.done&&(xe=_e.return)&&xe.call(_e)}finally{if(ze)throw ze.error}}return!1},this[Symbol.iterator]=function(){return function(){var pe,ze,xe,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:pe=0,Fe.label=1;case 1:if(!(pe<Ne))return[3,10];for(;pe<Ne&&!de[pe];)++pe;if(pe>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),ze=(At=void 0,$(de[pe])),xe=ze.next(),Fe.label=3;case 3:return xe.done?[3,6]:(Oe=xe.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return xe=ze.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{xe&&!xe.done&&($e=ze.return)&&$e.call(ze)}finally{if(At)throw At.error}return[7];case 9:return++pe,[3,1];case 10:return[2]}})}()},ie.forEach(function(pe){var ze=pe.key,xe=pe.value;return Ie.setElement(ze,xe)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Set/Set"),re=r("../LinkList/LinkList");Ce.initSize=16,Ce.maxSize=1<<30,Ce.sigma=.75,Ce.treeifyThreshold=8,Ce.untreeifyThreshold=6,Ce.minTreeifySize=64;function Ce(ie,ae,le){var Ie=this;if(ie===void 0&&(ie=[]),ae===void 0&&(ae=Ce.initSize),le=le||function(pe){var ze=0,xe="";if(typeof pe=="number")ze=Math.floor(pe),ze=(ze<<5)-ze,ze=ze&ze;else{typeof pe!="string"?xe=JSON.stringify(pe):xe=pe;for(var Oe=0;Oe<xe.length;Oe++){var _e=xe.charCodeAt(Oe);ze=(ze<<5)-ze+_e,ze=ze&ze}}return ze^=ze>>>16,ze},ae&ae-1)throw new Error("initBucketNum must be 2 to the power of n");var ue=0,de=[],Ne=Math.max(Ce.initSize,Math.min(Ce.maxSize,ae));this.size=function(){return ue},this.empty=function(){return ue===0},this.clear=function(){ue=0,Ne=ae,de=[]},this.forEach=function(pe){var ze=0;de.forEach(function(xe){xe.forEach(function(Oe){pe(Oe,ze++)})})};var he=function(pe){if(!(pe>=Ce.maxSize)){Ne=pe*2;var ze=[];de.forEach(function(xe,Oe){if(!xe.empty()){if(xe instanceof re.default&&xe.size()===1){var _e=xe.front();if(_e===void 0)throw new Error("unknown error");ze[le(_e)&Ne-1]=new re.default([_e])}else if(xe instanceof oe.default){var At=new re.default,$e=new re.default;xe.forEach(function(Ve){var Dt=le(Ve);Dt&pe?$e.pushBack(Ve):At.pushBack(Ve)}),At.size()>Ce.untreeifyThreshold?ze[Oe]=new oe.default(At):At.size()&&(ze[Oe]=At),$e.size()>Ce.untreeifyThreshold?ze[Oe+pe]=new oe.default($e):$e.size()&&(ze[Oe+pe]=$e)}else{var Fe=new re.default,Ue=new re.default;xe.forEach(function(Ve){var Dt=le(Ve);Dt&pe?Ue.pushBack(Ve):Fe.pushBack(Ve)}),Fe.size()&&(ze[Oe]=Fe),Ue.size()&&(ze[Oe+pe]=Ue)}de[Oe].clear()}}),de=ze}};this.insert=function(pe){if(pe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var ze=le(pe)&Ne-1;if(!de[ze])de[ze]=new re.default([pe]),++ue;else{var xe=de[ze].size();if(de[ze]instanceof re.default){if(de[ze].find(pe))return;de[ze].pushBack(pe),de[ze].size()>=Ce.treeifyThreshold&&(de[ze]=new oe.default(de[ze]))}else de[ze].insert(pe);var Oe=de[ze].size();ue+=Oe-xe}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.eraseElementByValue=function(pe){var ze=le(pe)&Ne-1;if(de[ze]){var xe=de[ze].size();de[ze].eraseElementByValue(pe),de[ze]instanceof oe.default&&de[ze].size()<=Ce.untreeifyThreshold&&(de[ze]=new re.default(de[ze]));var Oe=de[ze].size();ue+=Oe-xe}},this.find=function(pe){var ze=le(pe)&Ne-1;return de[ze]?de[ze].find(pe):!1},this[Symbol.iterator]=function(){return function(){var pe,ze,xe,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:pe=0,Fe.label=1;case 1:if(!(pe<Ne))return[3,10];for(;pe<Ne&&!de[pe];)++pe;if(pe>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),ze=(At=void 0,$(de[pe])),xe=ze.next(),Fe.label=3;case 3:return xe.done?[3,6]:(Oe=xe.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return xe=ze.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{xe&&!xe.done&&($e=ze.return)&&$e.call(ze)}finally{if(At)throw At.error}return[7];case 9:return++pe,[3,1];case 10:return[2]}})}()},ie.forEach(function(pe){return Ie.insert(pe)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(r,g,V){var k=this&&this.__generator||function(re,Ce){var ie={label:0,sent:function(){if(Ie[0]&1)throw Ie[1];return Ie[1]},trys:[],ops:[]},ae,le,Ie,ue;return ue={next:de(0),throw:de(1),return:de(2)},typeof Symbol=="function"&&(ue[Symbol.iterator]=function(){return this}),ue;function de(he){return function(pe){return Ne([he,pe])}}function Ne(he){if(ae)throw new TypeError("Generator is already executing.");for(;ie;)try{if(ae=1,le&&(Ie=he[0]&2?le.return:he[0]?le.throw||((Ie=le.return)&&Ie.call(le),0):le.next)&&!(Ie=Ie.call(le,he[1])).done)return Ie;switch(le=0,Ie&&(he=[he[0]&2,Ie.value]),he[0]){case 0:case 1:Ie=he;break;case 4:return ie.label++,{value:he[1],done:!1};case 5:ie.label++,le=he[1],he=[0];continue;case 7:he=ie.ops.pop(),ie.trys.pop();continue;default:if(Ie=ie.trys,!(Ie=Ie.length>0&&Ie[Ie.length-1])&&(he[0]===6||he[0]===2)){ie=0;continue}if(he[0]===3&&(!Ie||he[1]>Ie[0]&&he[1]<Ie[3])){ie.label=he[1];break}if(he[0]===6&&ie.label<Ie[1]){ie.label=Ie[1],Ie=he;break}if(Ie&&ie.label<Ie[2]){ie.label=Ie[2],ie.ops.push(he);break}Ie[2]&&ie.ops.pop(),ie.trys.pop();continue}he=Ce.call(re,ie)}catch(pe){he=[6,pe],le=0}finally{ae=Ie=0}if(he[0]&5)throw he[1];return{value:he[0]?he[1]:void 0,done:!0}}};Object.defineProperty(V,"__esModule",{value:!0});var $=function(){function re(Ce){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=Ce}return re}();function oe(re){var Ce=this;re===void 0&&(re=[]);var ie=0,ae=void 0,le=void 0;this.size=function(){return ie},this.empty=function(){return ie===0},this.clear=function(){ae=le=void 0,ie=0},this.front=function(){return ae==null?void 0:ae.value},this.back=function(){return le==null?void 0:le.value},this.forEach=function(Ie){for(var ue=ae,de=0;ue;){if(ue.value===void 0)throw new Error("unknown error");Ie(ue.value,de++),ue=ue.next}},this.getElementByPos=function(Ie){if(Ie<0||Ie>=ie)throw new Error("pos must more then 0 and less then the list length");for(var ue=ae;Ie--&&ue;)ue=ue.next;if(!ue||ue.value===void 0)throw new Error("unknown error");return ue.value},this.eraseElementByPos=function(Ie){if(Ie<0||Ie>=ie)throw new Error("erase pos must more then 0 and less then the list length");if(Ie===0)this.popFront();else if(Ie===ie-1)this.popBack();else{for(var ue=ae;Ie--;){if(!(ue!=null&&ue.next))throw new Error("unknown error");ue=ue.next}if(!ue||!ue.pre||!ue.next)throw new Error("unknown error");var de=ue.pre,Ne=ue.next;Ne.pre=de,de.next=Ne,ie>0&&--ie}},this.eraseElementByValue=function(Ie){for(;ae&&ae.value===Ie;)this.popFront();for(;le&&le.value===Ie;)this.popBack();if(ae)for(var ue=ae;ue;){if(ue.value===Ie){var de=ue.pre,Ne=ue.next;Ne&&(Ne.pre=de),de&&(de.next=Ne),ie>0&&--ie}ue=ue.next}},this.pushBack=function(Ie){if(Ie==null)throw new Error("you can't push null or undefined here");++ie;var ue=new $(Ie);le?(le.next=ue,ue.pre=le,le=ue):ae=le=ue},this.popBack=function(){le&&(ie>0&&--ie,le&&(ae===le?ae=le=void 0:(le=le.pre,le&&(le.next=void 0))))},this.setElementByPos=function(Ie,ue){if(ue==null)throw new Error("you can't set null or undefined here");if(Ie<0||Ie>=ie)throw new Error("pos must more then 0 and less then the list length");for(var de=ae;Ie--;){if(!de)throw new Error("unknown error");de=de.next}de&&(de.value=ue)},this.insert=function(Ie,ue,de){if(de===void 0&&(de=1),ue==null)throw new Error("you can't insert null or undefined here");if(Ie<0||Ie>ie)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(de<0)throw new Error("insert size must more than 0");if(Ie===0)for(;de--;)this.pushFront(ue);else if(Ie===ie)for(;de--;)this.pushBack(ue);else{for(var Ne=ae,he=1;he<Ie;++he){if(!(Ne!=null&&Ne.next))throw new Error("unknown error");Ne=Ne==null?void 0:Ne.next}if(!Ne)throw new Error("unknown error");var pe=Ne.next;for(ie+=de;de--;)Ne.next=new $(ue),Ne.next.pre=Ne,Ne=Ne.next;Ne.next=pe,pe&&(pe.pre=Ne)}},this.find=function(Ie){for(var ue=ae;ue;){if(ue.value===Ie)return!0;ue=ue.next}return!1},this.reverse=function(){for(var Ie=ae,ue=le,de=0;Ie&&ue&&de*2<ie;){var Ne=Ie.value;Ie.value=ue.value,ue.value=Ne,Ie=Ie.next,ue=ue.pre,++de}},this.unique=function(){for(var Ie=ae;Ie;){for(var ue=Ie;ue&&ue.next&&ue.value===ue.next.value;)ue=ue.next,ie>0&&--ie;Ie.next=ue.next,Ie.next&&(Ie.next.pre=Ie),Ie=Ie.next}},this.sort=function(Ie){var ue=[];this.forEach(function(Ne){ue.push(Ne)}),ue.sort(Ie);var de=ae;ue.forEach(function(Ne){de&&(de.value=Ne,de=de.next)})},this.pushFront=function(Ie){if(Ie==null)throw new Error("you can't push null or undefined here");++ie;var ue=new $(Ie);ae?(ue.next=ae,ae.pre=ue,ae=ue):ae=le=ue},this.popFront=function(){ae&&(ie>0&&--ie,ae&&(ae===le?ae=le=void 0:(ae=ae.next,ae&&(ae.pre=void 0))))},this.merge=function(Ie){var ue=this,de=ae;Ie.forEach(function(Ne){for(;de&&de.value!==void 0&&de.value<=Ne;)de=de.next;if(de===void 0)ue.pushBack(Ne),de=le;else if(de===ae)ue.pushFront(Ne),de=ae;else{++ie;var he=de.pre;he&&(he.next=new $(Ne),he.next.pre=he,he.next.next=de,de&&(de.pre=he.next))}})},this[Symbol.iterator]=function(){return function(){var Ie;return k(this,function(ue){switch(ue.label){case 0:Ie=ae,ue.label=1;case 1:if(Ie===void 0)return[3,3];if(!Ie.value)throw new Error("unknown error");return[4,Ie.value];case 2:return ue.sent(),Ie=Ie.next,[3,1];case 3:return[2]}})}()},re.forEach(function(Ie){return Ce.pushBack(Ie)}),Object.freeze(this)}Object.freeze(oe),V.default=oe},{}],30:[function(r,g,V){var k=this&&this.__generator||function(Ce,ie){var ae={label:0,sent:function(){if(ue[0]&1)throw ue[1];return ue[1]},trys:[],ops:[]},le,Ie,ue,de;return de={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(de[Symbol.iterator]=function(){return this}),de;function Ne(pe){return function(ze){return he([pe,ze])}}function he(pe){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=pe[0]&2?Ie.return:pe[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,pe[1])).done)return ue;switch(Ie=0,ue&&(pe=[pe[0]&2,ue.value]),pe[0]){case 0:case 1:ue=pe;break;case 4:return ae.label++,{value:pe[1],done:!1};case 5:ae.label++,Ie=pe[1],pe=[0];continue;case 7:pe=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(pe[0]===6||pe[0]===2)){ae=0;continue}if(pe[0]===3&&(!ue||pe[1]>ue[0]&&pe[1]<ue[3])){ae.label=pe[1];break}if(pe[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=pe;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(pe);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}pe=ie.call(Ce,ae)}catch(ze){pe=[6,ze],Ie=0}finally{le=ue=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__values||function(Ce){var ie=typeof Symbol=="function"&&Symbol.iterator,ae=ie&&Ce[ie],le=0;if(ae)return ae.call(Ce);if(Ce&&typeof Ce.length=="number")return{next:function(){return Ce&&le>=Ce.length&&(Ce=void 0),{value:Ce&&Ce[le++],done:!Ce}}};throw new TypeError(ie?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(Ve,Dt){return Ve<Dt?-1:Ve>Dt?1:0};var le=0,Ie=new oe.default;Ie.color=oe.default.TreeNodeColorType.black,this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.key=Ie.value=void 0,Ie.leftChild=Ie.rightChild=Ie.brother=void 0};var ue=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.leftChild?ue(Ve.leftChild):Ve},de=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.rightChild?de(Ve.rightChild):Ve};this.front=function(){if(!this.empty()){var Ve=ue(Ie);if(Ve.key===void 0||Ve.value===void 0)throw new Error("unknown error");return{key:Ve.key,value:Ve.value}}},this.back=function(){if(!this.empty()){var Ve=de(Ie);if(Ve.key===void 0||Ve.value===void 0)throw new Error("unknown error");return{key:Ve.key,value:Ve.value}}},this.forEach=function(Ve){var Dt,qe,kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;Ve(ti,kt++)}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(Ve){var Dt,qe;if(Ve<0||Ve>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;if(kt===Ve)return ti;++kt}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}throw new Error("unknown Error")};var Ne=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe===0?{key:Ve.key,value:Ve.value}:qe<0?Ne(Ve.rightChild,Dt):Ne(Ve.leftChild,Dt)||{key:Ve.key,value:Ve.value}}};this.lowerBound=function(Ve){return Ne(Ie,Ve)};var he=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe<=0?he(Ve.rightChild,Dt):he(Ve.leftChild,Dt)||{key:Ve.key,value:Ve.value}}};this.upperBound=function(Ve){return he(Ie,Ve)};var pe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe===0?{key:Ve.key,value:Ve.value}:qe>0?pe(Ve.leftChild,Dt):pe(Ve.rightChild,Dt)||{key:Ve.key,value:Ve.value}}};this.reverseLowerBound=function(Ve){return pe(Ie,Ve)};var ze=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe>=0?ze(Ve.leftChild,Dt):ze(Ve.rightChild,Dt)||{key:Ve.key,value:Ve.value}}};this.reverseUpperBound=function(Ve){return ze(Ie,Ve)};var xe=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Ve.color===oe.default.TreeNodeColorType.red){Ve.color=oe.default.TreeNodeColorType.black;return}var qe=Ve.brother;if(!qe)throw new Error("unknown error");if(Ve===Dt.leftChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),xe(Ve)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ve.color=oe.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),xe(Ve)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,xe(Dt))}else if(Ve===Dt.rightChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),xe(Ve)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ve.color=oe.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),xe(Ve)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,xe(Dt))}},Oe=function(Ve){for(var Dt=Ve;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe;var kt=Ve.value;Ve.value=Dt.value,Dt.value=kt,Ve=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe;var kt=Ve.value;Ve.value=Dt.value,Dt.value=kt,Ve=Dt}}xe(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},_e=function(Ve,Dt){if(!Ve||Ve.key===void 0)return!1;var qe=_e(Ve.leftChild,Dt);return qe||Dt(Ve)?!0:_e(Ve.rightChild,Dt)};this.eraseElementByPos=function(Ve){if(Ve<0||Ve>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;_e(Ie,function(qe){return Ve===Dt?(Oe(qe),!0):(++Dt,!1)})},this.eraseElementByKey=function(Ve){if(!this.empty()){var Dt=Fe(Ie,Ve);Dt===void 0||Dt.key===void 0||ie(Dt.key,Ve)!==0||Oe(Dt)}};var At=function(Ve,Dt){if(!Ve||Ve.key===void 0)throw new Error("unknown error");var qe=ie(Dt,Ve.key);return qe<0?Ve.leftChild?At(Ve.leftChild,Dt):(Ve.leftChild=new oe.default,Ve.leftChild.parent=Ve,Ve.leftChild.brother=Ve.rightChild,Ve.rightChild&&(Ve.rightChild.brother=Ve.leftChild),Ve.leftChild):qe>0?Ve.rightChild?At(Ve.rightChild,Dt):(Ve.rightChild=new oe.default,Ve.rightChild.parent=Ve,Ve.rightChild.brother=Ve.leftChild,Ve.leftChild&&(Ve.leftChild.brother=Ve.rightChild),Ve.rightChild):Ve},$e=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Dt.color!==oe.default.TreeNodeColorType.black&&Dt.color===oe.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===oe.default.TreeNodeColorType.red)qe.color=Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red,$e(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(Ve===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var jt=kt.rotateRight();kt===Ie&&(Ie=jt)}else if(Ve===Dt.rightChild){var jt=Dt.rotateLeft();kt===Ie&&(Ie=jt),$e(Dt)}}else if(Dt===kt.rightChild){if(Ve===Dt.leftChild){var jt=Dt.rotateRight();kt===Ie&&(Ie=jt),$e(Dt)}else if(Ve===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var jt=kt.rotateLeft();kt===Ie&&(Ie=jt)}}}}};this.setElement=function(Ve,Dt){if(Ve==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(Dt==null){this.eraseElementByKey(Ve);return}if(this.empty()){++le,Ie.key=Ve,Ie.value=Dt,Ie.color=oe.default.TreeNodeColorType.black;return}var qe=At(Ie,Ve);if(qe.key!==void 0&&ie(qe.key,Ve)===0){qe.value=Dt;return}++le,qe.key=Ve,qe.value=Dt,$e(qe),Ie.color=oe.default.TreeNodeColorType.black};var Fe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Dt,Ve.key);return qe<0?Fe(Ve.leftChild,Dt):qe>0?Fe(Ve.rightChild,Dt):Ve}};this.find=function(Ve){return!!Fe(Ie,Ve)},this.getElementByKey=function(Ve){var Dt=Fe(Ie,Ve);if((Dt==null?void 0:Dt.key)===void 0||(Dt==null?void 0:Dt.value)===void 0)throw new Error("unknown error");return Dt.value},this.union=function(Ve){var Dt=this;Ve.forEach(function(qe){var kt=qe.key,jt=qe.value;return Dt.setElement(kt,jt)})},this.getHeight=function(){if(this.empty())return 0;var Ve=function(Dt){return Dt?Math.max(Ve(Dt.leftChild),Ve(Dt.rightChild))+1:1};return Ve(Ie)};var Ue=function(Ve){return k(this,function(Dt){switch(Dt.label){case 0:return!Ve||Ve.key===void 0||Ve.value===void 0?[2]:[5,$(Ue(Ve.leftChild))];case 1:return Dt.sent(),[4,{key:Ve.key,value:Ve.value}];case 2:return Dt.sent(),[5,$(Ue(Ve.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(Ve){var Dt=Ve.key,qe=Ve.value;return ae.setElement(Dt,qe)}),Object.freeze(this)}Object.freeze(re),V.default=re},{"../Base/TreeNode":25}],31:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($,oe){$===void 0&&($=[]),oe=oe||function(le,Ie){return le>Ie?-1:le<Ie?1:0};var re=[];$.forEach(function(le){return re.push(le)});var Ce=re.length,ie=function(le,Ie){if(le<0||le>=Ce)throw new Error("unknown error");if(Ie<0||Ie>=Ce)throw new Error("unknown error");var ue=re[le];re[le]=re[Ie],re[Ie]=ue},ae=function(le){if(le<0||le>=Ce)throw new Error("unknown error");var Ie=le*2+1,ue=le*2+2;Ie<Ce&&oe(re[le],re[Ie])>0&&ie(le,Ie),ue<Ce&&oe(re[le],re[ue])>0&&ie(le,ue)};(function(){for(var le=Math.floor((Ce-1)/2);le>=0;--le)for(var Ie=le,ue=Ie*2+1;ue<Ce;){var de=ue,Ne=de+1,he=de;if(Ne<Ce&&oe(re[de],re[Ne])>0&&(he=Ne),oe(re[Ie],re[he])<=0)break;ie(Ie,he),Ie=he,ue=Ie*2+1}})(),this.size=function(){return Ce},this.empty=function(){return Ce===0},this.clear=function(){Ce=0,re.length=0},this.push=function(le){if(re.push(le),++Ce,Ce!==1)for(var Ie=Ce-1;Ie>0;){var ue=Math.floor((Ie-1)/2);if(oe(re[ue],le)<=0)break;ae(ue),Ie=ue}},this.pop=function(){if(!this.empty()){if(this.size()===1){--Ce;return}var le=re[Ce-1];--Ce;for(var Ie=0;Ie<this.size();){var ue=Ie*2+1,de=Ie*2+2;if(ue>=this.size())break;var Ne=ue;if(de<this.size()&&oe(re[ue],re[de])>0&&(Ne=de),oe(re[Ne],le)>=0)break;re[Ie]=re[Ne],Ie=Ne}re[Ie]=le}},this.top=function(){return re[0]},Object.freeze(this)}Object.freeze(k),V.default=k},{}],32:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=r("../LinkList/LinkList");function $(oe){oe===void 0&&(oe=[]);var re=new k.default(oe);this.size=function(){return re.size()},this.empty=function(){return re.empty()},this.clear=function(){re.clear()},this.push=function(Ce){re.pushBack(Ce)},this.pop=function(){re.popFront()},this.front=function(){return re.front()},Object.freeze(this)}Object.freeze($),V.default=$},{"../LinkList/LinkList":29}],33:[function(r,g,V){var k=this&&this.__generator||function(Ce,ie){var ae={label:0,sent:function(){if(ue[0]&1)throw ue[1];return ue[1]},trys:[],ops:[]},le,Ie,ue,de;return de={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(de[Symbol.iterator]=function(){return this}),de;function Ne(pe){return function(ze){return he([pe,ze])}}function he(pe){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=pe[0]&2?Ie.return:pe[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,pe[1])).done)return ue;switch(Ie=0,ue&&(pe=[pe[0]&2,ue.value]),pe[0]){case 0:case 1:ue=pe;break;case 4:return ae.label++,{value:pe[1],done:!1};case 5:ae.label++,Ie=pe[1],pe=[0];continue;case 7:pe=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(pe[0]===6||pe[0]===2)){ae=0;continue}if(pe[0]===3&&(!ue||pe[1]>ue[0]&&pe[1]<ue[3])){ae.label=pe[1];break}if(pe[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=pe;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(pe);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}pe=ie.call(Ce,ae)}catch(ze){pe=[6,ze],Ie=0}finally{le=ue=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__values||function(Ce){var ie=typeof Symbol=="function"&&Symbol.iterator,ae=ie&&Ce[ie],le=0;if(ae)return ae.call(Ce);if(Ce&&typeof Ce.length=="number")return{next:function(){return Ce&&le>=Ce.length&&(Ce=void 0),{value:Ce&&Ce[le++],done:!Ce}}};throw new TypeError(ie?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(Ve,Dt){return Ve<Dt?-1:Ve>Dt?1:0};var le=0,Ie=new oe.default;Ie.color=oe.default.TreeNodeColorType.black,this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.key=void 0,Ie.leftChild=Ie.rightChild=Ie.brother=Ie.parent=void 0,Ie.color=oe.default.TreeNodeColorType.black};var ue=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.leftChild?ue(Ve.leftChild):Ve},de=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.rightChild?de(Ve.rightChild):Ve};this.front=function(){if(!this.empty()){var Ve=ue(Ie);return Ve.key}},this.back=function(){if(!this.empty()){var Ve=de(Ie);return Ve.key}},this.forEach=function(Ve){var Dt,qe,kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;Ve(ti,kt++)}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(Ve){var Dt,qe;if(Ve<0||Ve>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;if(kt===Ve)return ti;++kt}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}throw new Error("unknown error")};var Ne=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Ve.color===oe.default.TreeNodeColorType.red){Ve.color=oe.default.TreeNodeColorType.black;return}var qe=Ve.brother;if(!qe)throw new Error("unknown error");if(Ve===Dt.leftChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ne(Ve)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ve.color=oe.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),Ne(Ve)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ne(Dt))}else if(Ve===Dt.rightChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ne(Ve)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ve.color=oe.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),Ne(Ve)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ne(Dt))}},he=function(Ve){for(var Dt=Ve;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe,Ve=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe,Ve=Dt}}Ne(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},pe=function(Ve,Dt){if(!Ve||Ve.key===void 0)return!1;var qe=pe(Ve.leftChild,Dt);return qe||Dt(Ve)?!0:pe(Ve.rightChild,Dt)};this.eraseElementByPos=function(Ve){if(Ve<0||Ve>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;pe(Ie,function(qe){return Ve===Dt?(he(qe),!0):(++Dt,!1)})},this.eraseElementByValue=function(Ve){if(!this.empty()){var Dt=Oe(Ie,Ve);Dt===void 0||Dt.key===void 0||ie(Dt.key,Ve)!==0||he(Dt)}};var ze=function(Ve,Dt){if(!Ve||Ve.key===void 0)throw new Error("unknown error");var qe=ie(Dt,Ve.key);return qe<0?Ve.leftChild?ze(Ve.leftChild,Dt):(Ve.leftChild=new oe.default,Ve.leftChild.parent=Ve,Ve.leftChild.brother=Ve.rightChild,Ve.rightChild&&(Ve.rightChild.brother=Ve.leftChild),Ve.leftChild):qe>0?Ve.rightChild?ze(Ve.rightChild,Dt):(Ve.rightChild=new oe.default,Ve.rightChild.parent=Ve,Ve.rightChild.brother=Ve.leftChild,Ve.leftChild&&(Ve.leftChild.brother=Ve.rightChild),Ve.rightChild):Ve},xe=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Dt.color!==oe.default.TreeNodeColorType.black&&Dt.color===oe.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===oe.default.TreeNodeColorType.red)qe.color=Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red,xe(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(Ve===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var jt=kt.rotateRight();kt===Ie&&(Ie=jt)}else if(Ve===Dt.rightChild){var jt=Dt.rotateLeft();kt===Ie&&(Ie=jt),xe(Dt)}}else if(Dt===kt.rightChild){if(Ve===Dt.leftChild){var jt=Dt.rotateRight();kt===Ie&&(Ie=jt),xe(Dt)}else if(Ve===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var jt=kt.rotateLeft();kt===Ie&&(Ie=jt)}}}}};this.insert=function(Ve){if(Ve==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty()){++le,Ie.key=Ve,Ie.color=oe.default.TreeNodeColorType.black;return}var Dt=ze(Ie,Ve);Dt.key!==void 0&&ie(Dt.key,Ve)===0||(++le,Dt.key=Ve,xe(Dt),Ie.color=oe.default.TreeNodeColorType.black)};var Oe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Dt,Ve.key);return qe<0?Oe(Ve.leftChild,Dt):qe>0?Oe(Ve.rightChild,Dt):Ve}};this.find=function(Ve){var Dt=Oe(Ie,Ve);return Dt!==void 0&&Dt.key!==void 0&&ie(Dt.key,Ve)===0};var _e=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe===0)return Ve.key;if(qe<0)return _e(Ve.rightChild,Dt);var kt=_e(Ve.leftChild,Dt);return kt!==void 0?kt:Ve.key}};this.lowerBound=function(Ve){return _e(Ie,Ve)};var At=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe<=0)return At(Ve.rightChild,Dt);var kt=At(Ve.leftChild,Dt);return kt!==void 0?kt:Ve.key}};this.upperBound=function(Ve){return At(Ie,Ve)};var $e=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe===0)return Ve.key;if(qe>0)return $e(Ve.leftChild,Dt);var kt=$e(Ve.rightChild,Dt);return kt!==void 0?kt:Ve.key}};this.reverseLowerBound=function(Ve){return $e(Ie,Ve)};var Fe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe>=0)return Fe(Ve.leftChild,Dt);var kt=Fe(Ve.rightChild,Dt);return kt!==void 0?kt:Ve.key}};this.reverseUpperBound=function(Ve){return Fe(Ie,Ve)},this.union=function(Ve){var Dt=this;Ve.forEach(function(qe){return Dt.insert(qe)})},this.getHeight=function(){if(this.empty())return 0;var Ve=function(Dt){return Dt?Math.max(Ve(Dt.leftChild),Ve(Dt.rightChild))+1:1};return Ve(Ie)};var Ue=function(Ve){return k(this,function(Dt){switch(Dt.label){case 0:return!Ve||Ve.key===void 0?[2]:[5,$(Ue(Ve.leftChild))];case 1:return Dt.sent(),[4,Ve.key];case 2:return Dt.sent(),[5,$(Ue(Ve.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(Ve){return ae.insert(Ve)}),Object.freeze(this)}Object.freeze(re),V.default=re},{"../Base/TreeNode":25}],34:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($){var oe=this;$===void 0&&($=[]);var re=0,Ce=[];this.size=function(){return re},this.empty=function(){return re===0},this.clear=function(){re=0,Ce.length=0},this.push=function(ie){Ce.push(ie),++re},this.pop=function(){Ce.pop(),re>0&&--re},this.top=function(){return Ce[re-1]},$.forEach(function(ie){return oe.push(ie)}),Object.freeze(this)}Object.freeze(k),V.default=k},{}],35:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__read||function(ie,ae){var le=typeof Symbol=="function"&&ie[Symbol.iterator];if(!le)return ie;var Ie=le.call(ie),ue,de=[],Ne;try{for(;(ae===void 0||ae-- >0)&&!(ue=Ie.next()).done;)de.push(ue.value)}catch(he){Ne={error:he}}finally{try{ue&&!ue.done&&(le=Ie.return)&&le.call(Ie)}finally{if(Ne)throw Ne.error}}return de},oe=this&&this.__spreadArray||function(ie,ae,le){if(le||arguments.length===2)for(var Ie=0,ue=ae.length,de;Ie<ue;Ie++)(de||!(Ie in ae))&&(de||(de=Array.prototype.slice.call(ae,0,Ie)),de[Ie]=ae[Ie]);return ie.concat(de||Array.prototype.slice.call(ae))},re=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});function Ce(ie){var ae=this;ie===void 0&&(ie=[]);var le=0,Ie=[];this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.length=0},this.front=function(){if(!this.empty())return Ie[0]},this.back=function(){if(!this.empty())return Ie[le-1]},this.forEach=function(ue){Ie.forEach(ue)},this.getElementByPos=function(ue){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");return Ie[ue]},this.eraseElementByPos=function(ue){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");for(var de=ue;de<le-1;++de)Ie[de]=Ie[de+1];this.popBack()},this.eraseElementByValue=function(ue){var de=[];this.forEach(function(he){he!==ue&&de.push(he)}),de.forEach(function(he,pe){Ie[pe]=he});for(var Ne=de.length;le>Ne;)this.popBack()},this.pushBack=function(ue){Ie.push(ue),++le},this.popBack=function(){Ie.pop(),le>0&&--le},this.setElementByPos=function(ue,de){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");Ie[ue]=de},this.insert=function(ue,de,Ne){if(Ne===void 0&&(Ne=1),ue<0||ue>le)throw new Error("pos must more than 0 and less than or equal to vector's size");Ie.splice.apply(Ie,oe([ue,0],$(new Array(Ne).fill(de)),!1)),le+=Ne},this.find=function(ue){return Ie.includes(ue)},this.reverse=function(){Ie.reverse()},this.unique=function(){var ue,de=[];this.forEach(function(he,pe){(pe===0||he!==ue)&&(de.push(he),ue=he)}),de.forEach(function(he,pe){Ie[pe]=he});for(var Ne=de.length;le>Ne;)this.popBack()},this.sort=function(ue){Ie.sort(ue)},this[Symbol.iterator]=function(){return function(){return k(this,function(ue){switch(ue.label){case 0:return[5,re(Ie)];case 1:return[2,ue.sent()]}})}()},ie.forEach(function(ue){return ae.pushBack(ue)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{}],36:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0}),V.HashMap=V.HashSet=V.Map=V.Set=V.PriorityQueue=V.Deque=V.LinkList=V.Queue=V.Stack=V.Vector=void 0;var k=r("./Vector/Vector");V.Vector=k.default;var $=r("./Stack/Stack");V.Stack=$.default;var oe=r("./Queue/Queue");V.Queue=oe.default;var re=r("./LinkList/LinkList");V.LinkList=re.default;var Ce=r("./Deque/Deque");V.Deque=Ce.default;var ie=r("./PriorityQueue/PriorityQueue");V.PriorityQueue=ie.default;var ae=r("./Set/Set");V.Set=ae.default;var le=r("./Map/Map");V.Map=le.default;var Ie=r("./HashSet/HashSet");V.HashSet=Ie.default;var ue=r("./HashMap/HashMap");V.HashMap=ue.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(r,g,V){const k=r("yallist"),$=Symbol("max"),oe=Symbol("length"),re=Symbol("lengthCalculator"),Ce=Symbol("allowStale"),ie=Symbol("maxAge"),ae=Symbol("dispose"),le=Symbol("noDisposeOnSet"),Ie=Symbol("lruList"),ue=Symbol("cache"),de=Symbol("updateAgeOnGet"),Ne=()=>1;class he{constructor(Fe){if(typeof Fe=="number"&&(Fe={max:Fe}),Fe||(Fe={}),Fe.max&&(typeof Fe.max!="number"||Fe.max<0))throw new TypeError("max must be a non-negative number");this[$]=Fe.max||1/0;const Ue=Fe.length||Ne;if(this[re]=typeof Ue!="function"?Ne:Ue,this[Ce]=Fe.stale||!1,Fe.maxAge&&typeof Fe.maxAge!="number")throw new TypeError("maxAge must be a number");this[ie]=Fe.maxAge||0,this[ae]=Fe.dispose,this[le]=Fe.noDisposeOnSet||!1,this[de]=Fe.updateAgeOnGet||!1,this.reset()}set max(Fe){if(typeof Fe!="number"||Fe<0)throw new TypeError("max must be a non-negative number");this[$]=Fe||1/0,xe(this)}get max(){return this[$]}set allowStale(Fe){this[Ce]=!!Fe}get allowStale(){return this[Ce]}set maxAge(Fe){if(typeof Fe!="number")throw new TypeError("maxAge must be a non-negative number");this[ie]=Fe,xe(this)}get maxAge(){return this[ie]}set lengthCalculator(Fe){typeof Fe!="function"&&(Fe=Ne),Fe!==this[re]&&(this[re]=Fe,this[oe]=0,this[Ie].forEach(Ue=>{Ue.length=this[re](Ue.value,Ue.key),this[oe]+=Ue.length})),xe(this)}get lengthCalculator(){return this[re]}get length(){return this[oe]}get itemCount(){return this[Ie].length}rforEach(Fe,Ue){Ue=Ue||this;for(let Ve=this[Ie].tail;Ve!==null;){const Dt=Ve.prev;At(this,Fe,Ve,Ue),Ve=Dt}}forEach(Fe,Ue){Ue=Ue||this;for(let Ve=this[Ie].head;Ve!==null;){const Dt=Ve.next;At(this,Fe,Ve,Ue),Ve=Dt}}keys(){return this[Ie].toArray().map(Fe=>Fe.key)}values(){return this[Ie].toArray().map(Fe=>Fe.value)}reset(){this[ae]&&this[Ie]&&this[Ie].length&&this[Ie].forEach(Fe=>this[ae](Fe.key,Fe.value)),this[ue]=new Map,this[Ie]=new k,this[oe]=0}dump(){return this[Ie].map(Fe=>ze(this,Fe)?!1:{k:Fe.key,v:Fe.value,e:Fe.now+(Fe.maxAge||0)}).toArray().filter(Fe=>Fe)}dumpLru(){return this[Ie]}set(Fe,Ue,Ve){if(Ve=Ve||this[ie],Ve&&typeof Ve!="number")throw new TypeError("maxAge must be a number");const Dt=Ve?Date.now():0,qe=this[re](Ue,Fe);if(this[ue].has(Fe)){if(qe>this[$])return Oe(this,this[ue].get(Fe)),!1;const Pt=this[ue].get(Fe).value;return this[ae]&&(this[le]||this[ae](Fe,Pt.value)),Pt.now=Dt,Pt.maxAge=Ve,Pt.value=Ue,this[oe]+=qe-Pt.length,Pt.length=qe,this.get(Fe),xe(this),!0}const kt=new _e(Fe,Ue,qe,Dt,Ve);return kt.length>this[$]?(this[ae]&&this[ae](Fe,Ue),!1):(this[oe]+=kt.length,this[Ie].unshift(kt),this[ue].set(Fe,this[Ie].head),xe(this),!0)}has(Fe){if(!this[ue].has(Fe))return!1;const Ue=this[ue].get(Fe).value;return!ze(this,Ue)}get(Fe){return pe(this,Fe,!0)}peek(Fe){return pe(this,Fe,!1)}pop(){const Fe=this[Ie].tail;return Fe?(Oe(this,Fe),Fe.value):null}del(Fe){Oe(this,this[ue].get(Fe))}load(Fe){this.reset();const Ue=Date.now();for(let Ve=Fe.length-1;Ve>=0;Ve--){const Dt=Fe[Ve],qe=Dt.e||0;if(qe===0)this.set(Dt.k,Dt.v);else{const kt=qe-Ue;kt>0&&this.set(Dt.k,Dt.v,kt)}}}prune(){this[ue].forEach((Fe,Ue)=>pe(this,Ue,!1))}}const pe=($e,Fe,Ue)=>{const Ve=$e[ue].get(Fe);if(Ve){const Dt=Ve.value;if(ze($e,Dt)){if(Oe($e,Ve),!$e[Ce])return}else Ue&&($e[de]&&(Ve.value.now=Date.now()),$e[Ie].unshiftNode(Ve));return Dt.value}},ze=($e,Fe)=>{if(!Fe||!Fe.maxAge&&!$e[ie])return!1;const Ue=Date.now()-Fe.now;return Fe.maxAge?Ue>Fe.maxAge:$e[ie]&&Ue>$e[ie]},xe=$e=>{if($e[oe]>$e[$])for(let Fe=$e[Ie].tail;$e[oe]>$e[$]&&Fe!==null;){const Ue=Fe.prev;Oe($e,Fe),Fe=Ue}},Oe=($e,Fe)=>{if(Fe){const Ue=Fe.value;$e[ae]&&$e[ae](Ue.key,Ue.value),$e[oe]-=Ue.length,$e[ue].delete(Ue.key),$e[Ie].removeNode(Fe)}};class _e{constructor(Fe,Ue,Ve,Dt,qe){this.key=Fe,this.value=Ue,this.length=Ve,this.now=Dt,this.maxAge=qe||0}}const At=($e,Fe,Ue,Ve)=>{let Dt=Ue.value;ze($e,Dt)&&(Oe($e,Ue),$e[Ce]||(Dt=void 0)),Dt&&Fe.call(Ve,Dt.value,Dt.key,$e)};g.exports=he},{yallist:83}],38:[function(r,g,V){(function(k){(function(){const $=g.exports;$.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"},$.codes={};for(const re in $.types){const Ce=$.types[re];$.codes[Ce]=re}$.CMD_SHIFT=4,$.CMD_MASK=240,$.DUP_MASK=8,$.QOS_MASK=3,$.QOS_SHIFT=1,$.RETAIN_MASK=1,$.VARBYTEINT_MASK=127,$.VARBYTEINT_FIN_MASK=128,$.VARBYTEINT_MAX=268435455,$.SESSIONPRESENT_MASK=1,$.SESSIONPRESENT_HEADER=k.from([$.SESSIONPRESENT_MASK]),$.CONNACK_HEADER=k.from([$.codes.connack<<$.CMD_SHIFT]),$.USERNAME_MASK=128,$.PASSWORD_MASK=64,$.WILL_RETAIN_MASK=32,$.WILL_QOS_MASK=24,$.WILL_QOS_SHIFT=3,$.WILL_FLAG_MASK=4,$.CLEAN_SESSION_MASK=2,$.CONNECT_HEADER=k.from([$.codes.connect<<$.CMD_SHIFT]),$.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},$.propertiesCodes={};for(const re in $.properties){const Ce=$.properties[re];$.propertiesCodes[Ce]=re}$.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"};function oe(re){return[0,1,2].map(Ce=>[0,1].map(ie=>[0,1].map(ae=>{const le=k.alloc(1);return le.writeUInt8($.codes[re]<<$.CMD_SHIFT|(ie?$.DUP_MASK:0)|Ce<<$.QOS_SHIFT|ae,0,!0),le})))}$.PUBLISH_HEADER=oe("publish"),$.SUBSCRIBE_HEADER=oe("subscribe"),$.SUBSCRIBE_OPTIONS_QOS_MASK=3,$.SUBSCRIBE_OPTIONS_NL_MASK=1,$.SUBSCRIBE_OPTIONS_NL_SHIFT=2,$.SUBSCRIBE_OPTIONS_RAP_MASK=1,$.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,$.SUBSCRIBE_OPTIONS_RH_MASK=3,$.SUBSCRIBE_OPTIONS_RH_SHIFT=4,$.SUBSCRIBE_OPTIONS_RH=[0,16,32],$.SUBSCRIBE_OPTIONS_NL=4,$.SUBSCRIBE_OPTIONS_RAP=8,$.SUBSCRIBE_OPTIONS_QOS=[0,1,2],$.UNSUBSCRIBE_HEADER=oe("unsubscribe"),$.ACKS={unsuback:oe("unsuback"),puback:oe("puback"),pubcomp:oe("pubcomp"),pubrel:oe("pubrel"),pubrec:oe("pubrec")},$.SUBACK_HEADER=k.from([$.codes.suback<<$.CMD_SHIFT]),$.VERSION3=k.from([3]),$.VERSION4=k.from([4]),$.VERSION5=k.from([5]),$.VERSION131=k.from([131]),$.VERSION132=k.from([132]),$.QOS=[0,1,2].map(re=>k.from([re])),$.EMPTY={pingreq:k.from([$.codes.pingreq<<4,0]),pingresp:k.from([$.codes.pingresp<<4,0]),disconnect:k.from([$.codes.disconnect<<4,0])}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],39:[function(r,g,V){(function(k){(function(){const $=r("./writeToStream"),oe=r("events");function re(ie,ae){const le=new Ce;return $(ie,le,ae),le.concat()}class Ce extends oe{constructor(){super(),this._array=new Array(20),this._i=0}write(ae){return this._array[this._i++]=ae,!0}concat(){let ae=0;const le=new Array(this._array.length),Ie=this._array;let ue=0,de;for(de=0;de<Ie.length&&Ie[de]!==void 0;de++)typeof Ie[de]!="string"?le[de]=Ie[de].length:le[de]=k.byteLength(Ie[de]),ae+=le[de];const Ne=k.allocUnsafe(ae);for(de=0;de<Ie.length&&Ie[de]!==void 0;de++)typeof Ie[de]!="string"?(Ie[de].copy(Ne,ue),ue+=le[de]):(Ne.write(Ie[de],ue),ue+=le[de]);return Ne}}g.exports=re}).call(this)}).call(this,r("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(r,g,V){V.parser=r("./parser").parser,V.generate=r("./generate"),V.writeToStream=r("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(r,g,V){(function(k){(function(){const oe={},re=k.isBuffer(k.from([1,2]).subarray(0,1));function Ce(Ie){const ue=k.allocUnsafe(2);return ue.writeUInt8(Ie>>8,0),ue.writeUInt8(Ie&255,0+1),ue}function ie(){for(let Ie=0;Ie<65536;Ie++)oe[Ie]=Ce(Ie)}function ae(Ie){let de=0,Ne=0;const he=k.allocUnsafe(4);do de=Ie%128|0,Ie=Ie/128|0,Ie>0&&(de=de|128),he.writeUInt8(de,Ne++);while(Ie>0&&Ne<4);return Ie>0&&(Ne=0),re?he.subarray(0,Ne):he.slice(0,Ne)}function le(Ie){const ue=k.allocUnsafe(4);return ue.writeUInt32BE(Ie,0),ue}g.exports={cache:oe,generateCache:ie,generateNumber:Ce,genBufVariableByteInt:ae,generate4ByteBuffer:le}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],42:[function(r,g,V){class k{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}g.exports=k},{}],43:[function(r,g,V){const k=r("bl"),$=r("events"),oe=r("./packet"),re=r("./constants"),Ce=r("debug")("mqtt-packet:parser");class ie extends ${constructor(){super(),this.parser=this.constructor.parser}static parser(le){return this instanceof ie?(this.settings=le||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new ie().parser(le)}_resetState(){Ce("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new oe,this.error=null,this._list=k(),this._stateCounter=0}parse(le){for(this.error&&this._resetState(),this._list.append(le),Ce("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++,Ce("parse: state complete. _stateCounter is now: %d",this._stateCounter),Ce("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return Ce("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const le=this._list.readUInt8(0);return this.packet.cmd=re.types[le>>re.CMD_SHIFT],this.packet.retain=(le&re.RETAIN_MASK)!==0,this.packet.qos=le>>re.QOS_SHIFT&re.QOS_MASK,this.packet.dup=(le&re.DUP_MASK)!==0,Ce("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const le=this._parseVarByteNum(!0);return le&&(this.packet.length=le.value,this._list.consume(le.bytes)),Ce("_parseLength %d",le.value),!!le}_parsePayload(){Ce("_parsePayload: payload %O",this._list);let le=!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"))}le=!0}return Ce("_parsePayload complete result: %s",le),le}_parseConnect(){Ce("_parseConnect");let le,Ie,ue,de;const Ne={},he=this.packet,pe=this._parseString();if(pe===null)return this._emitError(new Error("Cannot parse protocolId"));if(pe!=="MQTT"&&pe!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(he.protocolId=pe,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(he.protocolVersion=this._list.readUInt8(this._pos),he.protocolVersion>=128&&(he.bridgeMode=!0,he.protocolVersion=he.protocolVersion-128),he.protocolVersion!==3&&he.protocolVersion!==4&&he.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(Ne.username=this._list.readUInt8(this._pos)&re.USERNAME_MASK,Ne.password=this._list.readUInt8(this._pos)&re.PASSWORD_MASK,Ne.will=this._list.readUInt8(this._pos)&re.WILL_FLAG_MASK,Ne.will&&(he.will={},he.will.retain=(this._list.readUInt8(this._pos)&re.WILL_RETAIN_MASK)!==0,he.will.qos=(this._list.readUInt8(this._pos)&re.WILL_QOS_MASK)>>re.WILL_QOS_SHIFT),he.clean=(this._list.readUInt8(this._pos)&re.CLEAN_SESSION_MASK)!==0,this._pos++,he.keepalive=this._parseNum(),he.keepalive===-1)return this._emitError(new Error("Packet too short"));if(he.protocolVersion===5){const xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(he.properties=xe)}const ze=this._parseString();if(ze===null)return this._emitError(new Error("Packet too short"));if(he.clientId=ze,Ce("_parseConnect: packet.clientId: %s",he.clientId),Ne.will){if(he.protocolVersion===5){const xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(he.will.properties=xe)}if(le=this._parseString(),le===null)return this._emitError(new Error("Cannot parse will topic"));if(he.will.topic=le,Ce("_parseConnect: packet.will.topic: %s",he.will.topic),Ie=this._parseBuffer(),Ie===null)return this._emitError(new Error("Cannot parse will payload"));he.will.payload=Ie,Ce("_parseConnect: packet.will.paylaod: %s",he.will.payload)}if(Ne.username){if(de=this._parseString(),de===null)return this._emitError(new Error("Cannot parse username"));he.username=de,Ce("_parseConnect: packet.username: %s",he.username)}if(Ne.password){if(ue=this._parseBuffer(),ue===null)return this._emitError(new Error("Cannot parse password"));he.password=ue}return this.settings=he,Ce("_parseConnect: complete"),he}_parseConnack(){Ce("_parseConnack");const le=this.packet;if(this._list.length<1)return null;if(le.sessionPresent=!!(this._list.readUInt8(this._pos++)&re.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?le.reasonCode=this._list.readUInt8(this._pos++):le.reasonCode=0;else{if(this._list.length<2)return null;le.returnCode=this._list.readUInt8(this._pos++)}if(le.returnCode===-1||le.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}Ce("_parseConnack: complete")}_parsePublish(){Ce("_parsePublish");const le=this.packet;if(le.topic=this._parseString(),le.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(le.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}le.payload=this._list.slice(this._pos,le.length),Ce("_parsePublish: payload from buffer list: %o",le.payload)}}_parseSubscribe(){Ce("_parseSubscribe");const le=this.packet;let Ie,ue,de,Ne,he,pe,ze;if(le.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(le.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(le.properties=xe)}for(;this._pos<le.length;){if(Ie=this._parseString(),Ie===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=le.length)return this._emitError(new Error("Malformed Subscribe Payload"));ue=this._parseByte(),de=ue&re.SUBSCRIBE_OPTIONS_QOS_MASK,pe=(ue>>re.SUBSCRIBE_OPTIONS_NL_SHIFT&re.SUBSCRIBE_OPTIONS_NL_MASK)!==0,he=(ue>>re.SUBSCRIBE_OPTIONS_RAP_SHIFT&re.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,Ne=ue>>re.SUBSCRIBE_OPTIONS_RH_SHIFT&re.SUBSCRIBE_OPTIONS_RH_MASK,ze={topic:Ie,qos:de},this.settings.protocolVersion===5?(ze.nl=pe,ze.rap=he,ze.rh=Ne):this.settings.bridgeMode&&(ze.rh=0,ze.rap=!0,ze.nl=!0),Ce("_parseSubscribe: push subscription `%s` to subscription",ze),le.subscriptions.push(ze)}}}_parseSuback(){Ce("_parseSuback");const le=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){Ce("_parseUnsubscribe");const le=this.packet;if(le.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}for(;this._pos<le.length;){const Ie=this._parseString();if(Ie===null)return this._emitError(new Error("Cannot parse topic"));Ce("_parseUnsubscribe: push topic `%s` to unsubscriptions",Ie),le.unsubscriptions.push(Ie)}}}_parseUnsuback(){Ce("_parseUnsuback");const le=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const Ie=this._parseProperties();for(Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie),le.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){Ce("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const le=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(le.length>2?(le.reasonCode=this._parseByte(),Ce("_parseConfirmation: packet.reasonCode `%d`",le.reasonCode)):le.reasonCode=0,le.length>3)){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}return!0}_parseDisconnect(){const le=this.packet;if(Ce("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?le.reasonCode=this._parseByte():le.reasonCode=0;const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}return Ce("_parseDisconnect result: true"),!0}_parseAuth(){Ce("_parseAuth");const le=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));le.reasonCode=this._parseByte();const Ie=this._parseProperties();return Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie),Ce("_parseAuth: result: true"),!0}_parseMessageId(){const le=this.packet;return le.messageId=this._parseNum(),le.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(Ce("_parseMessageId: packet.messageId %d",le.messageId),!0)}_parseString(le){const Ie=this._parseNum(),ue=Ie+this._pos;if(Ie===-1||ue>this._list.length||ue>this.packet.length)return null;const de=this._list.toString("utf8",this._pos,ue);return this._pos+=Ie,Ce("_parseString: result: %s",de),de}_parseStringPair(){return Ce("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const le=this._parseNum(),Ie=le+this._pos;if(le===-1||Ie>this._list.length||Ie>this.packet.length)return null;const ue=this._list.slice(this._pos,Ie);return this._pos+=le,Ce("_parseBuffer: result: %o",ue),ue}_parseNum(){if(this._list.length-this._pos<2)return-1;const le=this._list.readUInt16BE(this._pos);return this._pos+=2,Ce("_parseNum: result: %s",le),le}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const le=this._list.readUInt32BE(this._pos);return this._pos+=4,Ce("_parse4ByteNum: result: %s",le),le}_parseVarByteNum(le){Ce("_parseVarByteNum");const Ie=4;let ue=0,de=1,Ne=0,he=!1,pe;const ze=this._pos?this._pos:0;for(;ue<Ie&&ze+ue<this._list.length;){if(pe=this._list.readUInt8(ze+ue++),Ne+=de*(pe&re.VARBYTEINT_MASK),de*=128,!(pe&re.VARBYTEINT_FIN_MASK)){he=!0;break}if(this._list.length<=ue)break}return!he&&ue===Ie&&this._list.length>=ue&&this._emitError(new Error("Invalid variable byte integer")),ze&&(this._pos+=ue),he=he?le?{bytes:ue,value:Ne}:Ne:!1,Ce("_parseVarByteNum: result: %o",he),he}_parseByte(){let le;return this._pos<this._list.length&&(le=this._list.readUInt8(this._pos),this._pos++),Ce("_parseByte: result: %o",le),le}_parseByType(le){switch(Ce("_parseByType: type: %s",le),le){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(){Ce("_parseProperties");const le=this._parseVarByteNum(),ue=this._pos+le,de={};for(;this._pos<ue;){const Ne=this._parseByte();if(!Ne)return this._emitError(new Error("Cannot parse property code type")),!1;const he=re.propertiesCodes[Ne];if(!he)return this._emitError(new Error("Unknown property")),!1;if(he==="userProperties"){de[he]||(de[he]=Object.create(null));const pe=this._parseByType(re.propertiesTypes[he]);if(de[he][pe.name])if(Array.isArray(de[he][pe.name]))de[he][pe.name].push(pe.value);else{const ze=de[he][pe.name];de[he][pe.name]=[ze],de[he][pe.name].push(pe.value)}else de[he][pe.name]=pe.value;continue}de[he]?Array.isArray(de[he])?de[he].push(this._parseByType(re.propertiesTypes[he])):(de[he]=[de[he]],de[he].push(this._parseByType(re.propertiesTypes[he]))):de[he]=this._parseByType(re.propertiesTypes[he])}return de}_newPacket(){return Ce("_newPacket"),this.packet&&(this._list.consume(this.packet.length),Ce("_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)),Ce("_newPacket: new packet"),this.packet=new oe,this._pos=0,!0}_emitError(le){Ce("_emitError"),this.error=le,this.emit("error",le)}}g.exports=ie},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(r,g,V){(function(k){(function(){const $=r("./constants"),oe=k.allocUnsafe(0),re=k.from([0]),Ce=r("./numbers"),ie=r("process-nextick-args").nextTick,ae=r("debug")("mqtt-packet:writeToStream"),le=Ce.cache,Ie=Ce.generateNumber,ue=Ce.generateCache,de=Ce.genBufVariableByteInt,Ne=Ce.generate4ByteBuffer;let he=ni,pe=!0;function ze(ui,Ci,zi){switch(ae("generate called"),Ci.cork&&(Ci.cork(),ie(xe,Ci)),pe&&(pe=!1,ue()),ae("generate: packet.cmd: %s",ui.cmd),ui.cmd){case"connect":return Oe(ui,Ci);case"connack":return _e(ui,Ci,zi);case"publish":return At(ui,Ci,zi);case"puback":case"pubrec":case"pubrel":case"pubcomp":return $e(ui,Ci,zi);case"subscribe":return Fe(ui,Ci,zi);case"suback":return Ue(ui,Ci,zi);case"unsubscribe":return Ve(ui,Ci,zi);case"unsuback":return Dt(ui,Ci,zi);case"pingreq":case"pingresp":return qe(ui,Ci);case"disconnect":return kt(ui,Ci,zi);case"auth":return jt(ui,Ci,zi);default:return Ci.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(ze,"cacheNumbers",{get(){return he===ni},set(ui){ui?((!le||Object.keys(le).length===0)&&(pe=!0),he=ni):(pe=!1,he=ri)}});function xe(ui){ui.uncork()}function Oe(ui,Ci,zi){const Ni=ui||{},Mi=Ni.protocolId||"MQTT";let mi=Ni.protocolVersion||4;const vi=Ni.will;let bi=Ni.clean;const gi=Ni.keepalive||0,li=Ni.clientId||"",oi=Ni.username,Et=Ni.password,ii=Ni.properties;bi===void 0&&(bi=!0);let si=0;if(!Mi||typeof Mi!="string"&&!k.isBuffer(Mi))return Ci.emit("error",new Error("Invalid protocolId")),!1;if(si+=Mi.length+2,mi!==3&&mi!==4&&mi!==5)return Ci.emit("error",new Error("Invalid protocol version")),!1;if(si+=1,(typeof li=="string"||k.isBuffer(li))&&(li||mi>=4)&&(li||bi))si+=k.byteLength(li)+2;else{if(mi<4)return Ci.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(bi*1===0)return Ci.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof gi!="number"||gi<0||gi>65535||gi%1!==0)return Ci.emit("error",new Error("Invalid keepalive")),!1;if(si+=2,si+=1,mi===5){var fi=ai(Ci,ii);if(!fi)return!1;si+=fi.length}if(vi){if(typeof vi!="object")return Ci.emit("error",new Error("Invalid will")),!1;if(!vi.topic||typeof vi.topic!="string")return Ci.emit("error",new Error("Invalid will topic")),!1;if(si+=k.byteLength(vi.topic)+2,si+=2,vi.payload)if(vi.payload.length>=0)typeof vi.payload=="string"?si+=k.byteLength(vi.payload):si+=vi.payload.length;else return Ci.emit("error",new Error("Invalid will payload")),!1;var pi={};if(mi===5){if(pi=ai(Ci,vi.properties),!pi)return!1;si+=pi.length}}let Si=!1;if(oi!=null)if(yi(oi))Si=!0,si+=k.byteLength(oi)+2;else return Ci.emit("error",new Error("Invalid username")),!1;if(Et!=null){if(!Si)return Ci.emit("error",new Error("Username is required to use password")),!1;if(yi(Et))si+=Ai(Et)+2;else return Ci.emit("error",new Error("Invalid password")),!1}Ci.write($.CONNECT_HEADER),ti(Ci,si),wi(Ci,Mi),Ni.bridgeMode&&(mi+=128),Ci.write(mi===131?$.VERSION131:mi===132?$.VERSION132:mi===4?$.VERSION4:mi===5?$.VERSION5:$.VERSION3);let xi=0;return xi|=oi!=null?$.USERNAME_MASK:0,xi|=Et!=null?$.PASSWORD_MASK:0,xi|=vi&&vi.retain?$.WILL_RETAIN_MASK:0,xi|=vi&&vi.qos?vi.qos<<$.WILL_QOS_SHIFT:0,xi|=vi?$.WILL_FLAG_MASK:0,xi|=bi?$.CLEAN_SESSION_MASK:0,Ci.write(k.from([xi])),he(Ci,gi),mi===5&&fi.write(),wi(Ci,li),vi&&(mi===5&&pi.write(),ei(Ci,vi.topic),wi(Ci,vi.payload)),oi!=null&&wi(Ci,oi),Et!=null&&wi(Ci,Et),!0}function _e(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Ni===5?Mi.reasonCode:Mi.returnCode,vi=Mi.properties;let bi=2;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid return code")),!1;let gi=null;if(Ni===5){if(gi=ai(Ci,vi),!gi)return!1;bi+=gi.length}return Ci.write($.CONNACK_HEADER),ti(Ci,bi),Ci.write(Mi.sessionPresent?$.SESSIONPRESENT_HEADER:re),Ci.write(k.from([mi])),gi!=null&&gi.write(),!0}function At(ui,Ci,zi){ae("publish: packet: %o",ui);const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.qos||0,vi=Mi.retain?$.RETAIN_MASK:0,bi=Mi.topic,gi=Mi.payload||oe,li=Mi.messageId,oi=Mi.properties;let Et=0;if(typeof bi=="string")Et+=k.byteLength(bi)+2;else if(k.isBuffer(bi))Et+=bi.length+2;else return Ci.emit("error",new Error("Invalid topic")),!1;if(k.isBuffer(gi)?Et+=gi.length:Et+=k.byteLength(gi),mi&&typeof li!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;mi&&(Et+=2);let ii=null;if(Ni===5){if(ii=ai(Ci,oi),!ii)return!1;Et+=ii.length}return Ci.write($.PUBLISH_HEADER[mi][Mi.dup?1:0][vi?1:0]),ti(Ci,Et),he(Ci,Ai(bi)),Ci.write(bi),mi>0&&he(Ci,li),ii!=null&&ii.write(),ae("publish: payload: %o",gi),Ci.write(gi)}function $e(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.cmd||"puback",vi=Mi.messageId,bi=Mi.dup&&mi==="pubrel"?$.DUP_MASK:0;let gi=0;const li=Mi.reasonCode,oi=Mi.properties;let Et=Ni===5?3:2;if(mi==="pubrel"&&(gi=1),typeof vi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;let ii=null;if(Ni===5&&typeof oi=="object"){if(ii=di(Ci,oi,zi,Et),!ii)return!1;Et+=ii.length}return Ci.write($.ACKS[mi][gi][bi][0]),ti(Ci,Et),he(Ci,vi),Ni===5&&Ci.write(k.from([li])),ii!==null&&ii.write(),!0}function Fe(ui,Ci,zi){ae("subscribe: packet: ");const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.dup?$.DUP_MASK:0,vi=Mi.messageId,bi=Mi.subscriptions,gi=Mi.properties;let li=0;if(typeof vi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;li+=2;let oi=null;if(Ni===5){if(oi=ai(Ci,gi),!oi)return!1;li+=oi.length}if(typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){const si=bi[ii].topic,fi=bi[ii].qos;if(typeof si!="string")return Ci.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof fi!="number")return Ci.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Ni===5){if(typeof(bi[ii].nl||!1)!="boolean")return Ci.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(bi[ii].rap||!1)!="boolean")return Ci.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const xi=bi[ii].rh||0;if(typeof xi!="number"||xi>2)return Ci.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}li+=k.byteLength(si)+2+1}else return Ci.emit("error",new Error("Invalid subscriptions")),!1;ae("subscribe: writing to stream: %o",$.SUBSCRIBE_HEADER),Ci.write($.SUBSCRIBE_HEADER[1][mi?1:0][0]),ti(Ci,li),he(Ci,vi),oi!==null&&oi.write();let Et=!0;for(const ii of bi){const si=ii.topic,fi=ii.qos,pi=+ii.nl,Si=+ii.rap,xi=ii.rh;let Gi;ei(Ci,si),Gi=$.SUBSCRIBE_OPTIONS_QOS[fi],Ni===5&&(Gi|=pi?$.SUBSCRIBE_OPTIONS_NL:0,Gi|=Si?$.SUBSCRIBE_OPTIONS_RAP:0,Gi|=xi?$.SUBSCRIBE_OPTIONS_RH[xi]:0),Et=Ci.write(k.from([Gi]))}return Et}function Ue(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.messageId,vi=Mi.granted,bi=Mi.properties;let gi=0;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(gi+=2,typeof vi=="object"&&vi.length)for(let oi=0;oi<vi.length;oi+=1){if(typeof vi[oi]!="number")return Ci.emit("error",new Error("Invalid qos vector")),!1;gi+=1}else return Ci.emit("error",new Error("Invalid qos vector")),!1;let li=null;if(Ni===5){if(li=di(Ci,bi,zi,gi),!li)return!1;gi+=li.length}return Ci.write($.SUBACK_HEADER),ti(Ci,gi),he(Ci,mi),li!==null&&li.write(),Ci.write(k.from(vi))}function Ve(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.messageId,vi=Mi.dup?$.DUP_MASK:0,bi=Mi.unsubscriptions,gi=Mi.properties;let li=0;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(li+=2,typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){if(typeof bi[ii]!="string")return Ci.emit("error",new Error("Invalid unsubscriptions")),!1;li+=k.byteLength(bi[ii])+2}else return Ci.emit("error",new Error("Invalid unsubscriptions")),!1;let oi=null;if(Ni===5){if(oi=ai(Ci,gi),!oi)return!1;li+=oi.length}Ci.write($.UNSUBSCRIBE_HEADER[1][vi?1:0][0]),ti(Ci,li),he(Ci,mi),oi!==null&&oi.write();let Et=!0;for(let ii=0;ii<bi.length;ii++)Et=ei(Ci,bi[ii]);return Et}function Dt(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.messageId,vi=Mi.dup?$.DUP_MASK:0,bi=Mi.granted,gi=Mi.properties,li=Mi.cmd,oi=0;let Et=2;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(Ni===5)if(typeof bi=="object"&&bi.length)for(let si=0;si<bi.length;si+=1){if(typeof bi[si]!="number")return Ci.emit("error",new Error("Invalid qos vector")),!1;Et+=1}else return Ci.emit("error",new Error("Invalid qos vector")),!1;let ii=null;if(Ni===5){if(ii=di(Ci,gi,zi,Et),!ii)return!1;Et+=ii.length}return Ci.write($.ACKS[li][oi][vi][0]),ti(Ci,Et),he(Ci,mi),ii!==null&&ii.write(),Ni===5&&Ci.write(k.from(bi)),!0}function qe(ui,Ci,zi){return Ci.write($.EMPTY[ui.cmd])}function kt(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.reasonCode,vi=Mi.properties;let bi=Ni===5?1:0,gi=null;if(Ni===5){if(gi=di(Ci,vi,zi,bi),!gi)return!1;bi+=gi.length}return Ci.write(k.from([$.codes.disconnect<<4])),ti(Ci,bi),Ni===5&&Ci.write(k.from([mi])),gi!==null&&gi.write(),!0}function jt(ui,Ci,zi){const Ni=zi?zi.protocolVersion:4,Mi=ui||{},mi=Mi.reasonCode,vi=Mi.properties;let bi=Ni===5?1:0;Ni!==5&&Ci.emit("error",new Error("Invalid mqtt version for auth packet"));const gi=di(Ci,vi,zi,bi);return gi?(bi+=gi.length,Ci.write(k.from([$.codes.auth<<4])),ti(Ci,bi),Ci.write(k.from([mi])),gi!==null&&gi.write(),!0):!1}const Pt={};function ti(ui,Ci){if(Ci>$.VARBYTEINT_MAX)return ui.emit("error",new Error(`Invalid variable byte integer: ${Ci}`)),!1;let zi=Pt[Ci];return zi||(zi=de(Ci),Ci<16384&&(Pt[Ci]=zi)),ae("writeVarByteInt: writing to stream: %o",zi),ui.write(zi)}function ei(ui,Ci){const zi=k.byteLength(Ci);return he(ui,zi),ae("writeString: %s",Ci),ui.write(Ci,"utf8")}function Lt(ui,Ci,zi){ei(ui,Ci),ei(ui,zi)}function ni(ui,Ci){return ae("writeNumberCached: number: %d",Ci),ae("writeNumberCached: %o",le[Ci]),ui.write(le[Ci])}function ri(ui,Ci){const zi=Ie(Ci);return ae("writeNumberGenerated: %o",zi),ui.write(zi)}function Ii(ui,Ci){const zi=Ne(Ci);return ae("write4ByteNumber: %o",zi),ui.write(zi)}function wi(ui,Ci){typeof Ci=="string"?ei(ui,Ci):Ci?(he(ui,Ci.length),ui.write(Ci)):he(ui,0)}function ai(ui,Ci){if(typeof Ci!="object"||Ci.length!=null)return{length:1,write(){ci(ui,{},0)}};let zi=0;function Ni(mi,vi){const bi=$.propertiesTypes[mi];let gi=0;switch(bi){case"byte":{if(typeof vi!="boolean")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+1;break}case"int8":{if(typeof vi!="number"||vi<0||vi>255)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+1;break}case"binary":{if(vi&&vi===null)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+k.byteLength(vi)+2;break}case"int16":{if(typeof vi!="number"||vi<0||vi>65535)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+2;break}case"int32":{if(typeof vi!="number"||vi<0||vi>4294967295)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+4;break}case"var":{if(typeof vi!="number"||vi<0||vi>268435455)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+k.byteLength(de(vi));break}case"string":{if(typeof vi!="string")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=1+2+k.byteLength(vi.toString());break}case"pair":{if(typeof vi!="object")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;gi+=Object.getOwnPropertyNames(vi).reduce((li,oi)=>{const Et=vi[oi];return Array.isArray(Et)?li+=Et.reduce((ii,si)=>(ii+=1+2+k.byteLength(oi.toString())+2+k.byteLength(si.toString()),ii),0):li+=1+2+k.byteLength(oi.toString())+2+k.byteLength(vi[oi].toString()),li},0);break}default:return ui.emit("error",new Error(`Invalid property ${mi}: ${vi}`)),!1}return gi}if(Ci)for(const mi in Ci){let vi=0,bi=0;const gi=Ci[mi];if(Array.isArray(gi))for(let li=0;li<gi.length;li++){if(bi=Ni(mi,gi[li]),!bi)return!1;vi+=bi}else{if(bi=Ni(mi,gi),!bi)return!1;vi=bi}if(!vi)return!1;zi+=vi}return{length:k.byteLength(de(zi))+zi,write(){ci(ui,Ci,zi)}}}function di(ui,Ci,zi,Ni){const Mi=["reasonString","userProperties"],mi=zi&&zi.properties&&zi.properties.maximumPacketSize?zi.properties.maximumPacketSize:0;let vi=ai(ui,Ci);if(mi)for(;Ni+vi.length>mi;){const bi=Mi.shift();if(bi&&Ci[bi])delete Ci[bi],vi=ai(ui,Ci);else return!1}return vi}function hi(ui,Ci,zi){switch($.propertiesTypes[Ci]){case"byte":{ui.write(k.from([$.properties[Ci]])),ui.write(k.from([+zi]));break}case"int8":{ui.write(k.from([$.properties[Ci]])),ui.write(k.from([zi]));break}case"binary":{ui.write(k.from([$.properties[Ci]])),wi(ui,zi);break}case"int16":{ui.write(k.from([$.properties[Ci]])),he(ui,zi);break}case"int32":{ui.write(k.from([$.properties[Ci]])),Ii(ui,zi);break}case"var":{ui.write(k.from([$.properties[Ci]])),ti(ui,zi);break}case"string":{ui.write(k.from([$.properties[Ci]])),ei(ui,zi);break}case"pair":{Object.getOwnPropertyNames(zi).forEach(Mi=>{const mi=zi[Mi];Array.isArray(mi)?mi.forEach(vi=>{ui.write(k.from([$.properties[Ci]])),Lt(ui,Mi.toString(),vi.toString())}):(ui.write(k.from([$.properties[Ci]])),Lt(ui,Mi.toString(),mi.toString()))});break}default:return ui.emit("error",new Error(`Invalid property ${Ci} value: ${zi}`)),!1}}function ci(ui,Ci,zi){ti(ui,zi);for(const Ni in Ci)if(Object.prototype.hasOwnProperty.call(Ci,Ni)&&Ci[Ni]!==null){const Mi=Ci[Ni];if(Array.isArray(Mi))for(let mi=0;mi<Mi.length;mi++)hi(ui,Ni,Mi[mi]);else hi(ui,Ni,Mi)}}function Ai(ui){return ui?ui instanceof k?ui.length:k.byteLength(ui):0}function yi(ui){return typeof ui=="string"||ui instanceof k}g.exports=ze}).call(this)}).call(this,r("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(r,g,V){var k=1e3,$=k*60,oe=$*60,re=oe*24,Ce=re*7,ie=re*365.25;g.exports=function(de,Ne){Ne=Ne||{};var he=typeof de;if(he==="string"&&de.length>0)return ae(de);if(he==="number"&&isFinite(de))return Ne.long?Ie(de):le(de);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(de))};function ae(de){if(de=String(de),!(de.length>100)){var Ne=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(de);if(Ne){var he=parseFloat(Ne[1]),pe=(Ne[2]||"ms").toLowerCase();switch(pe){case"years":case"year":case"yrs":case"yr":case"y":return he*ie;case"weeks":case"week":case"w":return he*Ce;case"days":case"day":case"d":return he*re;case"hours":case"hour":case"hrs":case"hr":case"h":return he*oe;case"minutes":case"minute":case"mins":case"min":case"m":return he*$;case"seconds":case"second":case"secs":case"sec":case"s":return he*k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return he;default:return}}}}function le(de){var Ne=Math.abs(de);return Ne>=re?Math.round(de/re)+"d":Ne>=oe?Math.round(de/oe)+"h":Ne>=$?Math.round(de/$)+"m":Ne>=k?Math.round(de/k)+"s":de+"ms"}function Ie(de){var Ne=Math.abs(de);return Ne>=re?ue(de,Ne,re,"day"):Ne>=oe?ue(de,Ne,oe,"hour"):Ne>=$?ue(de,Ne,$,"minute"):Ne>=k?ue(de,Ne,k,"second"):de+" ms"}function ue(de,Ne,he,pe){var ze=Ne>=he*1.5;return Math.round(de/he)+" "+pe+(ze?"s":"")}},{}],46:[function(r,g,V){const k=r("./lib/number-allocator.js");g.exports.NumberAllocator=k},{"./lib/number-allocator.js":47}],47:[function(r,g,V){const k=r("js-sdsl").Set,$=r("debug")("number-allocator:trace"),oe=r("debug")("number-allocator:error");function re(ie,ae){this.low=ie,this.high=ae}re.prototype.equals=function(ie){return this.low===ie.low&&this.high===ie.high},re.prototype.compare=function(ie){return this.low<ie.low&&this.high<ie.low?-1:ie.low<this.low&&ie.high<this.low?1:0};function Ce(ie,ae){if(!(this instanceof Ce))return new Ce(ie,ae);this.min=ie,this.max=ae,this.ss=new k([],(le,Ie)=>le.compare(Ie)),$("Create"),this.clear()}Ce.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},Ce.prototype.alloc=function(){if(this.ss.size()===0)return $("alloc():empty"),null;const ie=this.ss.front(),ae=ie.low;return ae+1<=ie.high?++ie.low:this.ss.eraseElementByPos(0),$("alloc():"+ae),ae},Ce.prototype.use=function(ie){const ae=new re(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.equals(ae))return this.ss.eraseElementByValue(le),$("use():"+ie),!0;if(le.low>ie)return!1;if(le.low===ie)return++le.low,$("use():"+ie),!0;if(le.high===ie)return--le.high,$("use():"+ie),!0;const Ie=le.low;return le.low=ie+1,this.ss.insert(new re(Ie,ie-1)),$("use():"+ie),!0}return $("use():failed"),!1},Ce.prototype.free=function(ie){if(ie<this.min||ie>this.max){oe("free():"+ie+" is out of range");return}const ae=new re(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.low<=ie&&ie<=le.high){oe("free():"+ie+" has already been vacant");return}if(le===this.ss.front())ie+1===le.low?--le.low:this.ss.insert(ae);else{const Ie=this.ss.reverseLowerBound(ae);Ie.high+1===ie?ie+1===le.low?(this.ss.eraseElementByValue(Ie),le.low=Ie.low):Ie.high=ie:ie+1===le.low?le.low=ie:this.ss.insert(ae)}}else{if(le===this.ss.front()){this.ss.insert(ae);return}const Ie=this.ss.reverseLowerBound(ae);Ie.high+1===ie?Ie.high=ie:this.ss.insert(ae)}$("free():"+ie)},Ce.prototype.clear=function(){$("clear()"),this.ss.clear(),this.ss.insert(new re(this.min,this.max))},Ce.prototype.intervalCount=function(){return this.ss.size()},Ce.prototype.dump=function(){console.log("length:"+this.ss.size());for(const ie of this.ss)console.log(ie)},g.exports=Ce},{debug:18,"js-sdsl":36}],48:[function(r,g,V){var k=r("wrappy");g.exports=k($),g.exports.strict=k(oe),$.proto=$(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return $(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return oe(this)},configurable:!0})});function $(re){var Ce=function(){return Ce.called?Ce.value:(Ce.called=!0,Ce.value=re.apply(this,arguments))};return Ce.called=!1,Ce}function oe(re){var Ce=function(){if(Ce.called)throw new Error(Ce.onceError);return Ce.called=!0,Ce.value=re.apply(this,arguments)},ie=re.name||"Function wrapped with `once`";return Ce.onceError=ie+" shouldn't be called more than once",Ce.called=!1,Ce}},{wrappy:79}],49:[function(r,g,V){(function(k){(function(){typeof k>"u"||!k.version||k.version.indexOf("v0.")===0||k.version.indexOf("v1.")===0&&k.version.indexOf("v1.8.")!==0?g.exports={nextTick:$}:g.exports=k;function $(oe,re,Ce,ie){if(typeof oe!="function")throw new TypeError('"callback" argument must be a function');var ae=arguments.length,le,Ie;switch(ae){case 0:case 1:return k.nextTick(oe);case 2:return k.nextTick(function(){oe.call(null,re)});case 3:return k.nextTick(function(){oe.call(null,re,Ce)});case 4:return k.nextTick(function(){oe.call(null,re,Ce,ie)});default:for(le=new Array(ae-1),Ie=0;Ie<le.length;)le[Ie++]=arguments[Ie];return k.nextTick(function(){oe.apply(null,le)})}}}).call(this)}).call(this,r("_process"))},{_process:50}],50:[function(r,g,V){var k=g.exports={},$,oe;function re(){throw new Error("setTimeout has not been defined")}function Ce(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?$=setTimeout:$=re}catch{$=re}try{typeof clearTimeout=="function"?oe=clearTimeout:oe=Ce}catch{oe=Ce}})();function ie(xe){if($===setTimeout)return setTimeout(xe,0);if(($===re||!$)&&setTimeout)return $=setTimeout,setTimeout(xe,0);try{return $(xe,0)}catch{try{return $.call(null,xe,0)}catch{return $.call(this,xe,0)}}}function ae(xe){if(oe===clearTimeout)return clearTimeout(xe);if((oe===Ce||!oe)&&clearTimeout)return oe=clearTimeout,clearTimeout(xe);try{return oe(xe)}catch{try{return oe.call(null,xe)}catch{return oe.call(this,xe)}}}var le=[],Ie=!1,ue,de=-1;function Ne(){!Ie||!ue||(Ie=!1,ue.length?le=ue.concat(le):de=-1,le.length&&he())}function he(){if(!Ie){var xe=ie(Ne);Ie=!0;for(var Oe=le.length;Oe;){for(ue=le,le=[];++de<Oe;)ue&&ue[de].run();de=-1,Oe=le.length}ue=null,Ie=!1,ae(xe)}}k.nextTick=function(xe){var Oe=new Array(arguments.length-1);if(arguments.length>1)for(var _e=1;_e<arguments.length;_e++)Oe[_e-1]=arguments[_e];le.push(new pe(xe,Oe)),le.length===1&&!Ie&&ie(he)};function pe(xe,Oe){this.fun=xe,this.array=Oe}pe.prototype.run=function(){this.fun.apply(null,this.array)},k.title="browser",k.browser=!0,k.env={},k.argv=[],k.version="",k.versions={};function ze(){}k.on=ze,k.addListener=ze,k.once=ze,k.off=ze,k.removeListener=ze,k.removeAllListeners=ze,k.emit=ze,k.prependListener=ze,k.prependOnceListener=ze,k.listeners=function(xe){return[]},k.binding=function(xe){throw new Error("process.binding is not supported")},k.cwd=function(){return"/"},k.chdir=function(xe){throw new Error("process.chdir is not supported")},k.umask=function(){return 0}},{}],51:[function(r,g,V){(function(k){(function(){(function($){var oe=typeof V=="object"&&V&&!V.nodeType&&V,re=typeof g=="object"&&g&&!g.nodeType&&g,Ce=typeof k=="object"&&k;(Ce.global===Ce||Ce.window===Ce||Ce.self===Ce)&&($=Ce);var ie,ae=2147483647,le=36,Ie=1,ue=26,de=38,Ne=700,he=72,pe=128,ze="-",xe=/^xn--/,Oe=/[^\x20-\x7E]/,_e=/[\x2E\u3002\uFF0E\uFF61]/g,At={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$e=le-Ie,Fe=Math.floor,Ue=String.fromCharCode,Ve;function Dt(ai){throw new RangeError(At[ai])}function qe(ai,di){for(var hi=ai.length,ci=[];hi--;)ci[hi]=di(ai[hi]);return ci}function kt(ai,di){var hi=ai.split("@"),ci="";hi.length>1&&(ci=hi[0]+"@",ai=hi[1]),ai=ai.replace(_e,".");var Ai=ai.split("."),yi=qe(Ai,di).join(".");return ci+yi}function jt(ai){for(var di=[],hi=0,ci=ai.length,Ai,yi;hi<ci;)Ai=ai.charCodeAt(hi++),Ai>=55296&&Ai<=56319&&hi<ci?(yi=ai.charCodeAt(hi++),(yi&64512)==56320?di.push(((Ai&1023)<<10)+(yi&1023)+65536):(di.push(Ai),hi--)):di.push(Ai);return di}function Pt(ai){return qe(ai,function(di){var hi="";return di>65535&&(di-=65536,hi+=Ue(di>>>10&1023|55296),di=56320|di&1023),hi+=Ue(di),hi}).join("")}function ti(ai){return ai-48<10?ai-22:ai-65<26?ai-65:ai-97<26?ai-97:le}function ei(ai,di){return ai+22+75*(ai<26)-((di!=0)<<5)}function Lt(ai,di,hi){var ci=0;for(ai=hi?Fe(ai/Ne):ai>>1,ai+=Fe(ai/di);ai>$e*ue>>1;ci+=le)ai=Fe(ai/$e);return Fe(ci+($e+1)*ai/(ai+de))}function ni(ai){var di=[],hi=ai.length,ci,Ai=0,yi=pe,ui=he,Ci,zi,Ni,Mi,mi,vi,bi,gi,li;for(Ci=ai.lastIndexOf(ze),Ci<0&&(Ci=0),zi=0;zi<Ci;++zi)ai.charCodeAt(zi)>=128&&Dt("not-basic"),di.push(ai.charCodeAt(zi));for(Ni=Ci>0?Ci+1:0;Ni<hi;){for(Mi=Ai,mi=1,vi=le;Ni>=hi&&Dt("invalid-input"),bi=ti(ai.charCodeAt(Ni++)),(bi>=le||bi>Fe((ae-Ai)/mi))&&Dt("overflow"),Ai+=bi*mi,gi=vi<=ui?Ie:vi>=ui+ue?ue:vi-ui,!(bi<gi);vi+=le)li=le-gi,mi>Fe(ae/li)&&Dt("overflow"),mi*=li;ci=di.length+1,ui=Lt(Ai-Mi,ci,Mi==0),Fe(Ai/ci)>ae-yi&&Dt("overflow"),yi+=Fe(Ai/ci),Ai%=ci,di.splice(Ai++,0,yi)}return Pt(di)}function ri(ai){var di,hi,ci,Ai,yi,ui,Ci,zi,Ni,Mi,mi,vi=[],bi,gi,li,oi;for(ai=jt(ai),bi=ai.length,di=pe,hi=0,yi=he,ui=0;ui<bi;++ui)mi=ai[ui],mi<128&&vi.push(Ue(mi));for(ci=Ai=vi.length,Ai&&vi.push(ze);ci<bi;){for(Ci=ae,ui=0;ui<bi;++ui)mi=ai[ui],mi>=di&&mi<Ci&&(Ci=mi);for(gi=ci+1,Ci-di>Fe((ae-hi)/gi)&&Dt("overflow"),hi+=(Ci-di)*gi,di=Ci,ui=0;ui<bi;++ui)if(mi=ai[ui],mi<di&&++hi>ae&&Dt("overflow"),mi==di){for(zi=hi,Ni=le;Mi=Ni<=yi?Ie:Ni>=yi+ue?ue:Ni-yi,!(zi<Mi);Ni+=le)oi=zi-Mi,li=le-Mi,vi.push(Ue(ei(Mi+oi%li,0))),zi=Fe(oi/li);vi.push(Ue(ei(zi,0))),yi=Lt(hi,gi,ci==Ai),hi=0,++ci}++hi,++di}return vi.join("")}function Ii(ai){return kt(ai,function(di){return xe.test(di)?ni(di.slice(4).toLowerCase()):di})}function wi(ai){return kt(ai,function(di){return Oe.test(di)?"xn--"+ri(di):di})}if(ie={version:"1.4.1",ucs2:{decode:jt,encode:Pt},decode:ni,encode:ri,toASCII:wi,toUnicode:Ii},oe&&re)if(g.exports==oe)re.exports=ie;else for(Ve in ie)ie.hasOwnProperty(Ve)&&(oe[Ve]=ie[Ve]);else $.punycode=ie})(this)}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(r,g,V){function k(oe,re){return Object.prototype.hasOwnProperty.call(oe,re)}g.exports=function(oe,re,Ce,ie){re=re||"&",Ce=Ce||"=";var ae={};if(typeof oe!="string"||oe.length===0)return ae;var le=/\+/g;oe=oe.split(re);var Ie=1e3;ie&&typeof ie.maxKeys=="number"&&(Ie=ie.maxKeys);var ue=oe.length;Ie>0&&ue>Ie&&(ue=Ie);for(var de=0;de<ue;++de){var Ne=oe[de].replace(le,"%20"),he=Ne.indexOf(Ce),pe,ze,xe,Oe;he>=0?(pe=Ne.substr(0,he),ze=Ne.substr(he+1)):(pe=Ne,ze=""),xe=decodeURIComponent(pe),Oe=decodeURIComponent(ze),k(ae,xe)?$(ae[xe])?ae[xe].push(Oe):ae[xe]=[ae[xe],Oe]:ae[xe]=Oe}return ae};var $=Array.isArray||function(oe){return Object.prototype.toString.call(oe)==="[object Array]"}},{}],53:[function(r,g,V){var k=function(Ce){switch(typeof Ce){case"string":return Ce;case"boolean":return Ce?"true":"false";case"number":return isFinite(Ce)?Ce:"";default:return""}};g.exports=function(Ce,ie,ae,le){return ie=ie||"&",ae=ae||"=",Ce===null&&(Ce=void 0),typeof Ce=="object"?oe(re(Ce),function(Ie){var ue=encodeURIComponent(k(Ie))+ae;return $(Ce[Ie])?oe(Ce[Ie],function(de){return ue+encodeURIComponent(k(de))}).join(ie):ue+encodeURIComponent(k(Ce[Ie]))}).join(ie):le?encodeURIComponent(k(le))+ae+encodeURIComponent(k(Ce)):""};var $=Array.isArray||function(Ce){return Object.prototype.toString.call(Ce)==="[object Array]"};function oe(Ce,ie){if(Ce.map)return Ce.map(ie);for(var ae=[],le=0;le<Ce.length;le++)ae.push(ie(Ce[le],le));return ae}var re=Object.keys||function(Ce){var ie=[];for(var ae in Ce)Object.prototype.hasOwnProperty.call(Ce,ae)&&ie.push(ae);return ie}},{}],54:[function(r,g,V){V.decode=V.parse=r("./decode"),V.encode=V.stringify=r("./encode")},{"./decode":52,"./encode":53}],55:[function(r,g,V){function k(le,Ie){le.prototype=Object.create(Ie.prototype),le.prototype.constructor=le,le.__proto__=Ie}var $={};function oe(le,Ie,ue){ue||(ue=Error);function de(he,pe,ze){return typeof Ie=="string"?Ie:Ie(he,pe,ze)}var Ne=function(he){k(pe,he);function pe(ze,xe,Oe){return he.call(this,de(ze,xe,Oe))||this}return pe}(ue);Ne.prototype.name=ue.name,Ne.prototype.code=le,$[le]=Ne}function re(le,Ie){if(Array.isArray(le)){var ue=le.length;return le=le.map(function(de){return String(de)}),ue>2?"one of ".concat(Ie," ").concat(le.slice(0,ue-1).join(", "),", or ")+le[ue-1]:ue===2?"one of ".concat(Ie," ").concat(le[0]," or ").concat(le[1]):"of ".concat(Ie," ").concat(le[0])}else return"of ".concat(Ie," ").concat(String(le))}function Ce(le,Ie,ue){return le.substr(!ue||ue<0?0:+ue,Ie.length)===Ie}function ie(le,Ie,ue){return(ue===void 0||ue>le.length)&&(ue=le.length),le.substring(ue-Ie.length,ue)===Ie}function ae(le,Ie,ue){return typeof ue!="number"&&(ue=0),ue+Ie.length>le.length?!1:le.indexOf(Ie,ue)!==-1}oe("ERR_INVALID_OPT_VALUE",function(le,Ie){return'The value "'+Ie+'" is invalid for option "'+le+'"'},TypeError),oe("ERR_INVALID_ARG_TYPE",function(le,Ie,ue){var de;typeof Ie=="string"&&Ce(Ie,"not ")?(de="must not be",Ie=Ie.replace(/^not /,"")):de="must be";var Ne;if(ie(le," argument"))Ne="The ".concat(le," ").concat(de," ").concat(re(Ie,"type"));else{var he=ae(le,".")?"property":"argument";Ne='The "'.concat(le,'" ').concat(he," ").concat(de," ").concat(re(Ie,"type"))}return Ne+=". Received type ".concat(typeof ue),Ne},TypeError),oe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),oe("ERR_METHOD_NOT_IMPLEMENTED",function(le){return"The "+le+" method is not implemented"}),oe("ERR_STREAM_PREMATURE_CLOSE","Premature close"),oe("ERR_STREAM_DESTROYED",function(le){return"Cannot call "+le+" after a stream was destroyed"}),oe("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),oe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),oe("ERR_STREAM_WRITE_AFTER_END","write after end"),oe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),oe("ERR_UNKNOWN_ENCODING",function(le){return"Unknown encoding: "+le},TypeError),oe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),g.exports.codes=$},{}],56:[function(r,g,V){(function(k){(function(){var $=Object.keys||function(de){var Ne=[];for(var he in de)Ne.push(he);return Ne};g.exports=le;var oe=r("./_stream_readable"),re=r("./_stream_writable");r("inherits")(le,oe);for(var Ce=$(re.prototype),ie=0;ie<Ce.length;ie++){var ae=Ce[ie];le.prototype[ae]||(le.prototype[ae]=re.prototype[ae])}function le(de){if(!(this instanceof le))return new le(de);oe.call(this,de),re.call(this,de),this.allowHalfOpen=!0,de&&(de.readable===!1&&(this.readable=!1),de.writable===!1&&(this.writable=!1),de.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Ie)))}Object.defineProperty(le.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(le.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(le.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Ie(){this._writableState.ended||k.nextTick(ue,this)}function ue(de){de.end()}Object.defineProperty(le.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(Ne){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=Ne,this._writableState.destroyed=Ne)}})}).call(this)}).call(this,r("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(r,g,V){g.exports=$;var k=r("./_stream_transform");r("inherits")($,k);function $(oe){if(!(this instanceof $))return new $(oe);k.call(this,oe)}$.prototype._transform=function(oe,re,Ce){Ce(null,oe)}},{"./_stream_transform":59,inherits:24}],58:[function(r,g,V){(function(k,$){(function(){g.exports=Pt;var oe;Pt.ReadableState=jt,r("events").EventEmitter;var re=function(li,oi){return li.listeners(oi).length},Ce=r("./internal/streams/stream"),ie=r("buffer").Buffer,ae=$.Uint8Array||function(){};function le(gi){return ie.from(gi)}function Ie(gi){return ie.isBuffer(gi)||gi instanceof ae}var ue=r("util"),de;ue&&ue.debuglog?de=ue.debuglog("stream"):de=function(){};var Ne=r("./internal/streams/buffer_list"),he=r("./internal/streams/destroy"),pe=r("./internal/streams/state"),ze=pe.getHighWaterMark,xe=r("../errors").codes,Oe=xe.ERR_INVALID_ARG_TYPE,_e=xe.ERR_STREAM_PUSH_AFTER_EOF,At=xe.ERR_METHOD_NOT_IMPLEMENTED,$e=xe.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Fe,Ue,Ve;r("inherits")(Pt,Ce);var Dt=he.errorOrDestroy,qe=["error","close","destroy","pause","resume"];function kt(gi,li,oi){if(typeof gi.prependListener=="function")return gi.prependListener(li,oi);!gi._events||!gi._events[li]?gi.on(li,oi):Array.isArray(gi._events[li])?gi._events[li].unshift(oi):gi._events[li]=[oi,gi._events[li]]}function jt(gi,li,oi){oe=oe||r("./_stream_duplex"),gi=gi||{},typeof oi!="boolean"&&(oi=li instanceof oe),this.objectMode=!!gi.objectMode,oi&&(this.objectMode=this.objectMode||!!gi.readableObjectMode),this.highWaterMark=ze(this,gi,"readableHighWaterMark",oi),this.buffer=new Ne,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=gi.emitClose!==!1,this.autoDestroy=!!gi.autoDestroy,this.destroyed=!1,this.defaultEncoding=gi.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,gi.encoding&&(Fe||(Fe=r("string_decoder/").StringDecoder),this.decoder=new Fe(gi.encoding),this.encoding=gi.encoding)}function Pt(gi){if(oe=oe||r("./_stream_duplex"),!(this instanceof Pt))return new Pt(gi);var li=this instanceof oe;this._readableState=new jt(gi,this,li),this.readable=!0,gi&&(typeof gi.read=="function"&&(this._read=gi.read),typeof gi.destroy=="function"&&(this._destroy=gi.destroy)),Ce.call(this)}Object.defineProperty(Pt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(li){this._readableState&&(this._readableState.destroyed=li)}}),Pt.prototype.destroy=he.destroy,Pt.prototype._undestroy=he.undestroy,Pt.prototype._destroy=function(gi,li){li(gi)},Pt.prototype.push=function(gi,li){var oi=this._readableState,Et;return oi.objectMode?Et=!0:typeof gi=="string"&&(li=li||oi.defaultEncoding,li!==oi.encoding&&(gi=ie.from(gi,li),li=""),Et=!0),ti(this,gi,li,!1,Et)},Pt.prototype.unshift=function(gi){return ti(this,gi,null,!0,!1)};function ti(gi,li,oi,Et,ii){de("readableAddChunk",li);var si=gi._readableState;if(li===null)si.reading=!1,wi(gi,si);else{var fi;if(ii||(fi=Lt(si,li)),fi)Dt(gi,fi);else if(si.objectMode||li&&li.length>0)if(typeof li!="string"&&!si.objectMode&&Object.getPrototypeOf(li)!==ie.prototype&&(li=le(li)),Et)si.endEmitted?Dt(gi,new $e):ei(gi,si,li,!0);else if(si.ended)Dt(gi,new _e);else{if(si.destroyed)return!1;si.reading=!1,si.decoder&&!oi?(li=si.decoder.write(li),si.objectMode||li.length!==0?ei(gi,si,li,!1):hi(gi,si)):ei(gi,si,li,!1)}else Et||(si.reading=!1,hi(gi,si))}return!si.ended&&(si.length<si.highWaterMark||si.length===0)}function ei(gi,li,oi,Et){li.flowing&&li.length===0&&!li.sync?(li.awaitDrain=0,gi.emit("data",oi)):(li.length+=li.objectMode?1:oi.length,Et?li.buffer.unshift(oi):li.buffer.push(oi),li.needReadable&&ai(gi)),hi(gi,li)}function Lt(gi,li){var oi;return!Ie(li)&&typeof li!="string"&&li!==void 0&&!gi.objectMode&&(oi=new Oe("chunk",["string","Buffer","Uint8Array"],li)),oi}Pt.prototype.isPaused=function(){return this._readableState.flowing===!1},Pt.prototype.setEncoding=function(gi){Fe||(Fe=r("string_decoder/").StringDecoder);var li=new Fe(gi);this._readableState.decoder=li,this._readableState.encoding=this._readableState.decoder.encoding;for(var oi=this._readableState.buffer.head,Et="";oi!==null;)Et+=li.write(oi.data),oi=oi.next;return this._readableState.buffer.clear(),Et!==""&&this._readableState.buffer.push(Et),this._readableState.length=Et.length,this};var ni=1073741824;function ri(gi){return gi>=ni?gi=ni:(gi--,gi|=gi>>>1,gi|=gi>>>2,gi|=gi>>>4,gi|=gi>>>8,gi|=gi>>>16,gi++),gi}function Ii(gi,li){return gi<=0||li.length===0&&li.ended?0:li.objectMode?1:gi!==gi?li.flowing&&li.length?li.buffer.head.data.length:li.length:(gi>li.highWaterMark&&(li.highWaterMark=ri(gi)),gi<=li.length?gi:li.ended?li.length:(li.needReadable=!0,0))}Pt.prototype.read=function(gi){de("read",gi),gi=parseInt(gi,10);var li=this._readableState,oi=gi;if(gi!==0&&(li.emittedReadable=!1),gi===0&&li.needReadable&&((li.highWaterMark!==0?li.length>=li.highWaterMark:li.length>0)||li.ended))return de("read: emitReadable",li.length,li.ended),li.length===0&&li.ended?mi(this):ai(this),null;if(gi=Ii(gi,li),gi===0&&li.ended)return li.length===0&&mi(this),null;var Et=li.needReadable;de("need readable",Et),(li.length===0||li.length-gi<li.highWaterMark)&&(Et=!0,de("length less than watermark",Et)),li.ended||li.reading?(Et=!1,de("reading or ended",Et)):Et&&(de("do read"),li.reading=!0,li.sync=!0,li.length===0&&(li.needReadable=!0),this._read(li.highWaterMark),li.sync=!1,li.reading||(gi=Ii(oi,li)));var ii;return gi>0?ii=Mi(gi,li):ii=null,ii===null?(li.needReadable=li.length<=li.highWaterMark,gi=0):(li.length-=gi,li.awaitDrain=0),li.length===0&&(li.ended||(li.needReadable=!0),oi!==gi&&li.ended&&mi(this)),ii!==null&&this.emit("data",ii),ii};function wi(gi,li){if(de("onEofChunk"),!li.ended){if(li.decoder){var oi=li.decoder.end();oi&&oi.length&&(li.buffer.push(oi),li.length+=li.objectMode?1:oi.length)}li.ended=!0,li.sync?ai(gi):(li.needReadable=!1,li.emittedReadable||(li.emittedReadable=!0,di(gi)))}}function ai(gi){var li=gi._readableState;de("emitReadable",li.needReadable,li.emittedReadable),li.needReadable=!1,li.emittedReadable||(de("emitReadable",li.flowing),li.emittedReadable=!0,k.nextTick(di,gi))}function di(gi){var li=gi._readableState;de("emitReadable_",li.destroyed,li.length,li.ended),!li.destroyed&&(li.length||li.ended)&&(gi.emit("readable"),li.emittedReadable=!1),li.needReadable=!li.flowing&&!li.ended&&li.length<=li.highWaterMark,Ni(gi)}function hi(gi,li){li.readingMore||(li.readingMore=!0,k.nextTick(ci,gi,li))}function ci(gi,li){for(;!li.reading&&!li.ended&&(li.length<li.highWaterMark||li.flowing&&li.length===0);){var oi=li.length;if(de("maybeReadMore read 0"),gi.read(0),oi===li.length)break}li.readingMore=!1}Pt.prototype._read=function(gi){Dt(this,new At("_read()"))},Pt.prototype.pipe=function(gi,li){var oi=this,Et=this._readableState;switch(Et.pipesCount){case 0:Et.pipes=gi;break;case 1:Et.pipes=[Et.pipes,gi];break;default:Et.pipes.push(gi);break}Et.pipesCount+=1,de("pipe count=%d opts=%j",Et.pipesCount,li);var ii=(!li||li.end!==!1)&&gi!==k.stdout&&gi!==k.stderr,si=ii?pi:Vi;Et.endEmitted?k.nextTick(si):oi.once("end",si),gi.on("unpipe",fi);function fi(ki,Hi){de("onunpipe"),ki===oi&&Hi&&Hi.hasUnpiped===!1&&(Hi.hasUnpiped=!0,Gi())}function pi(){de("onend"),gi.end()}var Si=Ai(oi);gi.on("drain",Si);var xi=!1;function Gi(){de("cleanup"),gi.removeListener("close",Zi),gi.removeListener("finish",Wi),gi.removeListener("drain",Si),gi.removeListener("error",Oi),gi.removeListener("unpipe",fi),oi.removeListener("end",pi),oi.removeListener("end",Vi),oi.removeListener("data",Bi),xi=!0,Et.awaitDrain&&(!gi._writableState||gi._writableState.needDrain)&&Si()}oi.on("data",Bi);function Bi(ki){de("ondata");var Hi=gi.write(ki);de("dest.write",Hi),Hi===!1&&((Et.pipesCount===1&&Et.pipes===gi||Et.pipesCount>1&&bi(Et.pipes,gi)!==-1)&&!xi&&(de("false write response, pause",Et.awaitDrain),Et.awaitDrain++),oi.pause())}function Oi(ki){de("onerror",ki),Vi(),gi.removeListener("error",Oi),re(gi,"error")===0&&Dt(gi,ki)}kt(gi,"error",Oi);function Zi(){gi.removeListener("finish",Wi),Vi()}gi.once("close",Zi);function Wi(){de("onfinish"),gi.removeListener("close",Zi),Vi()}gi.once("finish",Wi);function Vi(){de("unpipe"),oi.unpipe(gi)}return gi.emit("pipe",oi),Et.flowing||(de("pipe resume"),oi.resume()),gi};function Ai(gi){return function(){var oi=gi._readableState;de("pipeOnDrain",oi.awaitDrain),oi.awaitDrain&&oi.awaitDrain--,oi.awaitDrain===0&&re(gi,"data")&&(oi.flowing=!0,Ni(gi))}}Pt.prototype.unpipe=function(gi){var li=this._readableState,oi={hasUnpiped:!1};if(li.pipesCount===0)return this;if(li.pipesCount===1)return gi&&gi!==li.pipes?this:(gi||(gi=li.pipes),li.pipes=null,li.pipesCount=0,li.flowing=!1,gi&&gi.emit("unpipe",this,oi),this);if(!gi){var Et=li.pipes,ii=li.pipesCount;li.pipes=null,li.pipesCount=0,li.flowing=!1;for(var si=0;si<ii;si++)Et[si].emit("unpipe",this,{hasUnpiped:!1});return this}var fi=bi(li.pipes,gi);return fi===-1?this:(li.pipes.splice(fi,1),li.pipesCount-=1,li.pipesCount===1&&(li.pipes=li.pipes[0]),gi.emit("unpipe",this,oi),this)},Pt.prototype.on=function(gi,li){var oi=Ce.prototype.on.call(this,gi,li),Et=this._readableState;return gi==="data"?(Et.readableListening=this.listenerCount("readable")>0,Et.flowing!==!1&&this.resume()):gi==="readable"&&!Et.endEmitted&&!Et.readableListening&&(Et.readableListening=Et.needReadable=!0,Et.flowing=!1,Et.emittedReadable=!1,de("on readable",Et.length,Et.reading),Et.length?ai(this):Et.reading||k.nextTick(ui,this)),oi},Pt.prototype.addListener=Pt.prototype.on,Pt.prototype.removeListener=function(gi,li){var oi=Ce.prototype.removeListener.call(this,gi,li);return gi==="readable"&&k.nextTick(yi,this),oi},Pt.prototype.removeAllListeners=function(gi){var li=Ce.prototype.removeAllListeners.apply(this,arguments);return(gi==="readable"||gi===void 0)&&k.nextTick(yi,this),li};function yi(gi){var li=gi._readableState;li.readableListening=gi.listenerCount("readable")>0,li.resumeScheduled&&!li.paused?li.flowing=!0:gi.listenerCount("data")>0&&gi.resume()}function ui(gi){de("readable nexttick read 0"),gi.read(0)}Pt.prototype.resume=function(){var gi=this._readableState;return gi.flowing||(de("resume"),gi.flowing=!gi.readableListening,Ci(this,gi)),gi.paused=!1,this};function Ci(gi,li){li.resumeScheduled||(li.resumeScheduled=!0,k.nextTick(zi,gi,li))}function zi(gi,li){de("resume",li.reading),li.reading||gi.read(0),li.resumeScheduled=!1,gi.emit("resume"),Ni(gi),li.flowing&&!li.reading&&gi.read(0)}Pt.prototype.pause=function(){return de("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(de("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Ni(gi){var li=gi._readableState;for(de("flow",li.flowing);li.flowing&&gi.read()!==null;);}Pt.prototype.wrap=function(gi){var li=this,oi=this._readableState,Et=!1;gi.on("end",function(){if(de("wrapped end"),oi.decoder&&!oi.ended){var fi=oi.decoder.end();fi&&fi.length&&li.push(fi)}li.push(null)}),gi.on("data",function(fi){if(de("wrapped data"),oi.decoder&&(fi=oi.decoder.write(fi)),!(oi.objectMode&&fi==null)&&!(!oi.objectMode&&(!fi||!fi.length))){var pi=li.push(fi);pi||(Et=!0,gi.pause())}});for(var ii in gi)this[ii]===void 0&&typeof gi[ii]=="function"&&(this[ii]=function(pi){return function(){return gi[pi].apply(gi,arguments)}}(ii));for(var si=0;si<qe.length;si++)gi.on(qe[si],this.emit.bind(this,qe[si]));return this._read=function(fi){de("wrapped _read",fi),Et&&(Et=!1,gi.resume())},this},typeof Symbol=="function"&&(Pt.prototype[Symbol.asyncIterator]=function(){return Ue===void 0&&(Ue=r("./internal/streams/async_iterator")),Ue(this)}),Object.defineProperty(Pt.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Pt.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Pt.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(li){this._readableState&&(this._readableState.flowing=li)}}),Pt._fromList=Mi,Object.defineProperty(Pt.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Mi(gi,li){if(li.length===0)return null;var oi;return li.objectMode?oi=li.buffer.shift():!gi||gi>=li.length?(li.decoder?oi=li.buffer.join(""):li.buffer.length===1?oi=li.buffer.first():oi=li.buffer.concat(li.length),li.buffer.clear()):oi=li.buffer.consume(gi,li.decoder),oi}function mi(gi){var li=gi._readableState;de("endReadable",li.endEmitted),li.endEmitted||(li.ended=!0,k.nextTick(vi,li,gi))}function vi(gi,li){if(de("endReadableNT",gi.endEmitted,gi.length),!gi.endEmitted&&gi.length===0&&(gi.endEmitted=!0,li.readable=!1,li.emit("end"),gi.autoDestroy)){var oi=li._writableState;(!oi||oi.autoDestroy&&oi.finished)&&li.destroy()}}typeof Symbol=="function"&&(Pt.from=function(gi,li){return Ve===void 0&&(Ve=r("./internal/streams/from")),Ve(Pt,gi,li)});function bi(gi,li){for(var oi=0,Et=gi.length;oi<Et;oi++)if(gi[oi]===li)return oi;return-1}}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal: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(r,g,V){g.exports=le;var k=r("../errors").codes,$=k.ERR_METHOD_NOT_IMPLEMENTED,oe=k.ERR_MULTIPLE_CALLBACK,re=k.ERR_TRANSFORM_ALREADY_TRANSFORMING,Ce=k.ERR_TRANSFORM_WITH_LENGTH_0,ie=r("./_stream_duplex");r("inherits")(le,ie);function ae(de,Ne){var he=this._transformState;he.transforming=!1;var pe=he.writecb;if(pe===null)return this.emit("error",new oe);he.writechunk=null,he.writecb=null,Ne!=null&&this.push(Ne),pe(de);var ze=this._readableState;ze.reading=!1,(ze.needReadable||ze.length<ze.highWaterMark)&&this._read(ze.highWaterMark)}function le(de){if(!(this instanceof le))return new le(de);ie.call(this,de),this._transformState={afterTransform:ae.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,de&&(typeof de.transform=="function"&&(this._transform=de.transform),typeof de.flush=="function"&&(this._flush=de.flush)),this.on("prefinish",Ie)}function Ie(){var de=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(Ne,he){ue(de,Ne,he)}):ue(this,null,null)}le.prototype.push=function(de,Ne){return this._transformState.needTransform=!1,ie.prototype.push.call(this,de,Ne)},le.prototype._transform=function(de,Ne,he){he(new $("_transform()"))},le.prototype._write=function(de,Ne,he){var pe=this._transformState;if(pe.writecb=he,pe.writechunk=de,pe.writeencoding=Ne,!pe.transforming){var ze=this._readableState;(pe.needTransform||ze.needReadable||ze.length<ze.highWaterMark)&&this._read(ze.highWaterMark)}},le.prototype._read=function(de){var Ne=this._transformState;Ne.writechunk!==null&&!Ne.transforming?(Ne.transforming=!0,this._transform(Ne.writechunk,Ne.writeencoding,Ne.afterTransform)):Ne.needTransform=!0},le.prototype._destroy=function(de,Ne){ie.prototype._destroy.call(this,de,function(he){Ne(he)})};function ue(de,Ne,he){if(Ne)return de.emit("error",Ne);if(he!=null&&de.push(he),de._writableState.length)throw new Ce;if(de._transformState.transforming)throw new re;return de.push(null)}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(r,g,V){(function(k,$){(function(){g.exports=jt;function oe(Ni){var Mi=this;this.next=null,this.entry=null,this.finish=function(){zi(Mi,Ni)}}var re;jt.WritableState=qe;var Ce={deprecate:r("util-deprecate")},ie=r("./internal/streams/stream"),ae=r("buffer").Buffer,le=$.Uint8Array||function(){};function Ie(Ni){return ae.from(Ni)}function ue(Ni){return ae.isBuffer(Ni)||Ni instanceof le}var de=r("./internal/streams/destroy"),Ne=r("./internal/streams/state"),he=Ne.getHighWaterMark,pe=r("../errors").codes,ze=pe.ERR_INVALID_ARG_TYPE,xe=pe.ERR_METHOD_NOT_IMPLEMENTED,Oe=pe.ERR_MULTIPLE_CALLBACK,_e=pe.ERR_STREAM_CANNOT_PIPE,At=pe.ERR_STREAM_DESTROYED,$e=pe.ERR_STREAM_NULL_VALUES,Fe=pe.ERR_STREAM_WRITE_AFTER_END,Ue=pe.ERR_UNKNOWN_ENCODING,Ve=de.errorOrDestroy;r("inherits")(jt,ie);function Dt(){}function qe(Ni,Mi,mi){re=re||r("./_stream_duplex"),Ni=Ni||{},typeof mi!="boolean"&&(mi=Mi instanceof re),this.objectMode=!!Ni.objectMode,mi&&(this.objectMode=this.objectMode||!!Ni.writableObjectMode),this.highWaterMark=he(this,Ni,"writableHighWaterMark",mi),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var vi=Ni.decodeStrings===!1;this.decodeStrings=!vi,this.defaultEncoding=Ni.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(bi){wi(Mi,bi)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Ni.emitClose!==!1,this.autoDestroy=!!Ni.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new oe(this)}qe.prototype.getBuffer=function(){for(var Mi=this.bufferedRequest,mi=[];Mi;)mi.push(Mi),Mi=Mi.next;return mi},function(){try{Object.defineProperty(qe.prototype,"buffer",{get:Ce.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var kt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(kt=Function.prototype[Symbol.hasInstance],Object.defineProperty(jt,Symbol.hasInstance,{value:function(Mi){return kt.call(this,Mi)?!0:this!==jt?!1:Mi&&Mi._writableState instanceof qe}})):kt=function(Mi){return Mi instanceof this};function jt(Ni){re=re||r("./_stream_duplex");var Mi=this instanceof re;if(!Mi&&!kt.call(jt,this))return new jt(Ni);this._writableState=new qe(Ni,this,Mi),this.writable=!0,Ni&&(typeof Ni.write=="function"&&(this._write=Ni.write),typeof Ni.writev=="function"&&(this._writev=Ni.writev),typeof Ni.destroy=="function"&&(this._destroy=Ni.destroy),typeof Ni.final=="function"&&(this._final=Ni.final)),ie.call(this)}jt.prototype.pipe=function(){Ve(this,new _e)};function Pt(Ni,Mi){var mi=new Fe;Ve(Ni,mi),k.nextTick(Mi,mi)}function ti(Ni,Mi,mi,vi){var bi;return mi===null?bi=new $e:typeof mi!="string"&&!Mi.objectMode&&(bi=new ze("chunk",["string","Buffer"],mi)),bi?(Ve(Ni,bi),k.nextTick(vi,bi),!1):!0}jt.prototype.write=function(Ni,Mi,mi){var vi=this._writableState,bi=!1,gi=!vi.objectMode&&ue(Ni);return gi&&!ae.isBuffer(Ni)&&(Ni=Ie(Ni)),typeof Mi=="function"&&(mi=Mi,Mi=null),gi?Mi="buffer":Mi||(Mi=vi.defaultEncoding),typeof mi!="function"&&(mi=Dt),vi.ending?Pt(this,mi):(gi||ti(this,vi,Ni,mi))&&(vi.pendingcb++,bi=Lt(this,vi,gi,Ni,Mi,mi)),bi},jt.prototype.cork=function(){this._writableState.corked++},jt.prototype.uncork=function(){var Ni=this._writableState;Ni.corked&&(Ni.corked--,!Ni.writing&&!Ni.corked&&!Ni.bufferProcessing&&Ni.bufferedRequest&&hi(this,Ni))},jt.prototype.setDefaultEncoding=function(Mi){if(typeof Mi=="string"&&(Mi=Mi.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Mi+"").toLowerCase())>-1))throw new Ue(Mi);return this._writableState.defaultEncoding=Mi,this},Object.defineProperty(jt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ei(Ni,Mi,mi){return!Ni.objectMode&&Ni.decodeStrings!==!1&&typeof Mi=="string"&&(Mi=ae.from(Mi,mi)),Mi}Object.defineProperty(jt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Lt(Ni,Mi,mi,vi,bi,gi){if(!mi){var li=ei(Mi,vi,bi);vi!==li&&(mi=!0,bi="buffer",vi=li)}var oi=Mi.objectMode?1:vi.length;Mi.length+=oi;var Et=Mi.length<Mi.highWaterMark;if(Et||(Mi.needDrain=!0),Mi.writing||Mi.corked){var ii=Mi.lastBufferedRequest;Mi.lastBufferedRequest={chunk:vi,encoding:bi,isBuf:mi,callback:gi,next:null},ii?ii.next=Mi.lastBufferedRequest:Mi.bufferedRequest=Mi.lastBufferedRequest,Mi.bufferedRequestCount+=1}else ni(Ni,Mi,!1,oi,vi,bi,gi);return Et}function ni(Ni,Mi,mi,vi,bi,gi,li){Mi.writelen=vi,Mi.writecb=li,Mi.writing=!0,Mi.sync=!0,Mi.destroyed?Mi.onwrite(new At("write")):mi?Ni._writev(bi,Mi.onwrite):Ni._write(bi,gi,Mi.onwrite),Mi.sync=!1}function ri(Ni,Mi,mi,vi,bi){--Mi.pendingcb,mi?(k.nextTick(bi,vi),k.nextTick(ui,Ni,Mi),Ni._writableState.errorEmitted=!0,Ve(Ni,vi)):(bi(vi),Ni._writableState.errorEmitted=!0,Ve(Ni,vi),ui(Ni,Mi))}function Ii(Ni){Ni.writing=!1,Ni.writecb=null,Ni.length-=Ni.writelen,Ni.writelen=0}function wi(Ni,Mi){var mi=Ni._writableState,vi=mi.sync,bi=mi.writecb;if(typeof bi!="function")throw new Oe;if(Ii(mi),Mi)ri(Ni,mi,vi,Mi,bi);else{var gi=ci(mi)||Ni.destroyed;!gi&&!mi.corked&&!mi.bufferProcessing&&mi.bufferedRequest&&hi(Ni,mi),vi?k.nextTick(ai,Ni,mi,gi,bi):ai(Ni,mi,gi,bi)}}function ai(Ni,Mi,mi,vi){mi||di(Ni,Mi),Mi.pendingcb--,vi(),ui(Ni,Mi)}function di(Ni,Mi){Mi.length===0&&Mi.needDrain&&(Mi.needDrain=!1,Ni.emit("drain"))}function hi(Ni,Mi){Mi.bufferProcessing=!0;var mi=Mi.bufferedRequest;if(Ni._writev&&mi&&mi.next){var vi=Mi.bufferedRequestCount,bi=new Array(vi),gi=Mi.corkedRequestsFree;gi.entry=mi;for(var li=0,oi=!0;mi;)bi[li]=mi,mi.isBuf||(oi=!1),mi=mi.next,li+=1;bi.allBuffers=oi,ni(Ni,Mi,!0,Mi.length,bi,"",gi.finish),Mi.pendingcb++,Mi.lastBufferedRequest=null,gi.next?(Mi.corkedRequestsFree=gi.next,gi.next=null):Mi.corkedRequestsFree=new oe(Mi),Mi.bufferedRequestCount=0}else{for(;mi;){var Et=mi.chunk,ii=mi.encoding,si=mi.callback,fi=Mi.objectMode?1:Et.length;if(ni(Ni,Mi,!1,fi,Et,ii,si),mi=mi.next,Mi.bufferedRequestCount--,Mi.writing)break}mi===null&&(Mi.lastBufferedRequest=null)}Mi.bufferedRequest=mi,Mi.bufferProcessing=!1}jt.prototype._write=function(Ni,Mi,mi){mi(new xe("_write()"))},jt.prototype._writev=null,jt.prototype.end=function(Ni,Mi,mi){var vi=this._writableState;return typeof Ni=="function"?(mi=Ni,Ni=null,Mi=null):typeof Mi=="function"&&(mi=Mi,Mi=null),Ni!=null&&this.write(Ni,Mi),vi.corked&&(vi.corked=1,this.uncork()),vi.ending||Ci(this,vi,mi),this},Object.defineProperty(jt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ci(Ni){return Ni.ending&&Ni.length===0&&Ni.bufferedRequest===null&&!Ni.finished&&!Ni.writing}function Ai(Ni,Mi){Ni._final(function(mi){Mi.pendingcb--,mi&&Ve(Ni,mi),Mi.prefinished=!0,Ni.emit("prefinish"),ui(Ni,Mi)})}function yi(Ni,Mi){!Mi.prefinished&&!Mi.finalCalled&&(typeof Ni._final=="function"&&!Mi.destroyed?(Mi.pendingcb++,Mi.finalCalled=!0,k.nextTick(Ai,Ni,Mi)):(Mi.prefinished=!0,Ni.emit("prefinish")))}function ui(Ni,Mi){var mi=ci(Mi);if(mi&&(yi(Ni,Mi),Mi.pendingcb===0&&(Mi.finished=!0,Ni.emit("finish"),Mi.autoDestroy))){var vi=Ni._readableState;(!vi||vi.autoDestroy&&vi.endEmitted)&&Ni.destroy()}return mi}function Ci(Ni,Mi,mi){Mi.ending=!0,ui(Ni,Mi),mi&&(Mi.finished?k.nextTick(mi):Ni.once("finish",mi)),Mi.ended=!0,Ni.writable=!1}function zi(Ni,Mi,mi){var vi=Ni.entry;for(Ni.entry=null;vi;){var bi=vi.callback;Mi.pendingcb--,bi(mi),vi=vi.next}Mi.corkedRequestsFree.next=Ni}Object.defineProperty(jt.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Mi){this._writableState&&(this._writableState.destroyed=Mi)}}),jt.prototype.destroy=de.destroy,jt.prototype._undestroy=de.undestroy,jt.prototype._destroy=function(Ni,Mi){Mi(Ni)}}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal: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(r,g,V){(function(k){(function(){var $;function oe(At,$e,Fe){return $e in At?Object.defineProperty(At,$e,{value:Fe,enumerable:!0,configurable:!0,writable:!0}):At[$e]=Fe,At}var re=r("./end-of-stream"),Ce=Symbol("lastResolve"),ie=Symbol("lastReject"),ae=Symbol("error"),le=Symbol("ended"),Ie=Symbol("lastPromise"),ue=Symbol("handlePromise"),de=Symbol("stream");function Ne(At,$e){return{value:At,done:$e}}function he(At){var $e=At[Ce];if($e!==null){var Fe=At[de].read();Fe!==null&&(At[Ie]=null,At[Ce]=null,At[ie]=null,$e(Ne(Fe,!1)))}}function pe(At){k.nextTick(he,At)}function ze(At,$e){return function(Fe,Ue){At.then(function(){if($e[le]){Fe(Ne(void 0,!0));return}$e[ue](Fe,Ue)},Ue)}}var xe=Object.getPrototypeOf(function(){}),Oe=Object.setPrototypeOf(($={get stream(){return this[de]},next:function(){var $e=this,Fe=this[ae];if(Fe!==null)return Promise.reject(Fe);if(this[le])return Promise.resolve(Ne(void 0,!0));if(this[de].destroyed)return new Promise(function(qe,kt){k.nextTick(function(){$e[ae]?kt($e[ae]):qe(Ne(void 0,!0))})});var Ue=this[Ie],Ve;if(Ue)Ve=new Promise(ze(Ue,this));else{var Dt=this[de].read();if(Dt!==null)return Promise.resolve(Ne(Dt,!1));Ve=new Promise(this[ue])}return this[Ie]=Ve,Ve}},oe($,Symbol.asyncIterator,function(){return this}),oe($,"return",function(){var $e=this;return new Promise(function(Fe,Ue){$e[de].destroy(null,function(Ve){if(Ve){Ue(Ve);return}Fe(Ne(void 0,!0))})})}),$),xe),_e=function($e){var Fe,Ue=Object.create(Oe,(Fe={},oe(Fe,de,{value:$e,writable:!0}),oe(Fe,Ce,{value:null,writable:!0}),oe(Fe,ie,{value:null,writable:!0}),oe(Fe,ae,{value:null,writable:!0}),oe(Fe,le,{value:$e._readableState.endEmitted,writable:!0}),oe(Fe,ue,{value:function(Dt,qe){var kt=Ue[de].read();kt?(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(Ne(kt,!1))):(Ue[Ce]=Dt,Ue[ie]=qe)},writable:!0}),Fe));return Ue[Ie]=null,re($e,function(Ve){if(Ve&&Ve.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Dt=Ue[ie];Dt!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(Ve)),Ue[ae]=Ve;return}var qe=Ue[Ce];qe!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,qe(Ne(void 0,!0))),Ue[le]=!0}),$e.on("readable",pe.bind(null,Ue)),Ue};g.exports=_e}).call(this)}).call(this,r("_process"))},{"./end-of-stream":64,_process:50}],62:[function(r,g,V){function k(he,pe){var ze=Object.keys(he);if(Object.getOwnPropertySymbols){var xe=Object.getOwnPropertySymbols(he);pe&&(xe=xe.filter(function(Oe){return Object.getOwnPropertyDescriptor(he,Oe).enumerable})),ze.push.apply(ze,xe)}return ze}function $(he){for(var pe=1;pe<arguments.length;pe++){var ze=arguments[pe]!=null?arguments[pe]:{};pe%2?k(Object(ze),!0).forEach(function(xe){oe(he,xe,ze[xe])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(ze)):k(Object(ze)).forEach(function(xe){Object.defineProperty(he,xe,Object.getOwnPropertyDescriptor(ze,xe))})}return he}function oe(he,pe,ze){return pe in he?Object.defineProperty(he,pe,{value:ze,enumerable:!0,configurable:!0,writable:!0}):he[pe]=ze,he}function re(he,pe){if(!(he instanceof pe))throw new TypeError("Cannot call a class as a function")}function Ce(he,pe){for(var ze=0;ze<pe.length;ze++){var xe=pe[ze];xe.enumerable=xe.enumerable||!1,xe.configurable=!0,"value"in xe&&(xe.writable=!0),Object.defineProperty(he,xe.key,xe)}}function ie(he,pe,ze){return pe&&Ce(he.prototype,pe),ze&&Ce(he,ze),he}var ae=r("buffer"),le=ae.Buffer,Ie=r("util"),ue=Ie.inspect,de=ue&&ue.custom||"inspect";function Ne(he,pe,ze){le.prototype.copy.call(he,pe,ze)}g.exports=function(){function he(){re(this,he),this.head=null,this.tail=null,this.length=0}return ie(he,[{key:"push",value:function(ze){var xe={data:ze,next:null};this.length>0?this.tail.next=xe:this.head=xe,this.tail=xe,++this.length}},{key:"unshift",value:function(ze){var xe={data:ze,next:this.head};this.length===0&&(this.tail=xe),this.head=xe,++this.length}},{key:"shift",value:function(){if(this.length!==0){var ze=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ze}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(ze){if(this.length===0)return"";for(var xe=this.head,Oe=""+xe.data;xe=xe.next;)Oe+=ze+xe.data;return Oe}},{key:"concat",value:function(ze){if(this.length===0)return le.alloc(0);for(var xe=le.allocUnsafe(ze>>>0),Oe=this.head,_e=0;Oe;)Ne(Oe.data,xe,_e),_e+=Oe.data.length,Oe=Oe.next;return xe}},{key:"consume",value:function(ze,xe){var Oe;return ze<this.head.data.length?(Oe=this.head.data.slice(0,ze),this.head.data=this.head.data.slice(ze)):ze===this.head.data.length?Oe=this.shift():Oe=xe?this._getString(ze):this._getBuffer(ze),Oe}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(ze){var xe=this.head,Oe=1,_e=xe.data;for(ze-=_e.length;xe=xe.next;){var At=xe.data,$e=ze>At.length?At.length:ze;if($e===At.length?_e+=At:_e+=At.slice(0,ze),ze-=$e,ze===0){$e===At.length?(++Oe,xe.next?this.head=xe.next:this.head=this.tail=null):(this.head=xe,xe.data=At.slice($e));break}++Oe}return this.length-=Oe,_e}},{key:"_getBuffer",value:function(ze){var xe=le.allocUnsafe(ze),Oe=this.head,_e=1;for(Oe.data.copy(xe),ze-=Oe.data.length;Oe=Oe.next;){var At=Oe.data,$e=ze>At.length?At.length:ze;if(At.copy(xe,xe.length-ze,0,$e),ze-=$e,ze===0){$e===At.length?(++_e,Oe.next?this.head=Oe.next:this.head=this.tail=null):(this.head=Oe,Oe.data=At.slice($e));break}++_e}return this.length-=_e,xe}},{key:de,value:function(ze,xe){return ue(this,$({},xe,{depth:0,customInspect:!1}))}}]),he}()},{buffer:17,util:16}],63:[function(r,g,V){(function(k){(function(){function $(le,Ie){var ue=this,de=this._readableState&&this._readableState.destroyed,Ne=this._writableState&&this._writableState.destroyed;return de||Ne?(Ie?Ie(le):le&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,k.nextTick(ie,this,le)):k.nextTick(ie,this,le)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(le||null,function(he){!Ie&&he?ue._writableState?ue._writableState.errorEmitted?k.nextTick(re,ue):(ue._writableState.errorEmitted=!0,k.nextTick(oe,ue,he)):k.nextTick(oe,ue,he):Ie?(k.nextTick(re,ue),Ie(he)):k.nextTick(re,ue)}),this)}function oe(le,Ie){ie(le,Ie),re(le)}function re(le){le._writableState&&!le._writableState.emitClose||le._readableState&&!le._readableState.emitClose||le.emit("close")}function Ce(){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)}function ie(le,Ie){le.emit("error",Ie)}function ae(le,Ie){var ue=le._readableState,de=le._writableState;ue&&ue.autoDestroy||de&&de.autoDestroy?le.destroy(Ie):le.emit("error",Ie)}g.exports={destroy:$,undestroy:Ce,errorOrDestroy:ae}}).call(this)}).call(this,r("_process"))},{_process:50}],64:[function(r,g,V){var k=r("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function $(ie){var ae=!1;return function(){if(!ae){ae=!0;for(var le=arguments.length,Ie=new Array(le),ue=0;ue<le;ue++)Ie[ue]=arguments[ue];ie.apply(this,Ie)}}}function oe(){}function re(ie){return ie.setHeader&&typeof ie.abort=="function"}function Ce(ie,ae,le){if(typeof ae=="function")return Ce(ie,null,ae);ae||(ae={}),le=$(le||oe);var Ie=ae.readable||ae.readable!==!1&&ie.readable,ue=ae.writable||ae.writable!==!1&&ie.writable,de=function(){ie.writable||he()},Ne=ie._writableState&&ie._writableState.finished,he=function(){ue=!1,Ne=!0,Ie||le.call(ie)},pe=ie._readableState&&ie._readableState.endEmitted,ze=function(){Ie=!1,pe=!0,ue||le.call(ie)},xe=function($e){le.call(ie,$e)},Oe=function(){var $e;if(Ie&&!pe)return(!ie._readableState||!ie._readableState.ended)&&($e=new k),le.call(ie,$e);if(ue&&!Ne)return(!ie._writableState||!ie._writableState.ended)&&($e=new k),le.call(ie,$e)},_e=function(){ie.req.on("finish",he)};return re(ie)?(ie.on("complete",he),ie.on("abort",Oe),ie.req?_e():ie.on("request",_e)):ue&&!ie._writableState&&(ie.on("end",de),ie.on("close",de)),ie.on("end",ze),ie.on("finish",he),ae.error!==!1&&ie.on("error",xe),ie.on("close",Oe),function(){ie.removeListener("complete",he),ie.removeListener("abort",Oe),ie.removeListener("request",_e),ie.req&&ie.req.removeListener("finish",he),ie.removeListener("end",de),ie.removeListener("close",de),ie.removeListener("finish",he),ie.removeListener("end",ze),ie.removeListener("error",xe),ie.removeListener("close",Oe)}}g.exports=Ce},{"../../../errors":55}],65:[function(r,g,V){g.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(r,g,V){var k;function $(he){var pe=!1;return function(){pe||(pe=!0,he.apply(void 0,arguments))}}var oe=r("../../../errors").codes,re=oe.ERR_MISSING_ARGS,Ce=oe.ERR_STREAM_DESTROYED;function ie(he){if(he)throw he}function ae(he){return he.setHeader&&typeof he.abort=="function"}function le(he,pe,ze,xe){xe=$(xe);var Oe=!1;he.on("close",function(){Oe=!0}),k===void 0&&(k=r("./end-of-stream")),k(he,{readable:pe,writable:ze},function(At){if(At)return xe(At);Oe=!0,xe()});var _e=!1;return function(At){if(!Oe&&!_e){if(_e=!0,ae(he))return he.abort();if(typeof he.destroy=="function")return he.destroy();xe(At||new Ce("pipe"))}}}function Ie(he){he()}function ue(he,pe){return he.pipe(pe)}function de(he){return!he.length||typeof he[he.length-1]!="function"?ie:he.pop()}function Ne(){for(var he=arguments.length,pe=new Array(he),ze=0;ze<he;ze++)pe[ze]=arguments[ze];var xe=de(pe);if(Array.isArray(pe[0])&&(pe=pe[0]),pe.length<2)throw new re("streams");var Oe,_e=pe.map(function(At,$e){var Fe=$e<pe.length-1,Ue=$e>0;return le(At,Fe,Ue,function(Ve){Oe||(Oe=Ve),Ve&&_e.forEach(Ie),!Fe&&(_e.forEach(Ie),xe(Oe))})});return pe.reduce(ue)}g.exports=Ne},{"../../../errors":55,"./end-of-stream":64}],67:[function(r,g,V){var k=r("../../../errors").codes.ERR_INVALID_OPT_VALUE;function $(re,Ce,ie){return re.highWaterMark!=null?re.highWaterMark:Ce?re[ie]:null}function oe(re,Ce,ie,ae){var le=$(Ce,ae,ie);if(le!=null){if(!(isFinite(le)&&Math.floor(le)===le)||le<0){var Ie=ae?ie:"highWaterMark";throw new k(Ie,le)}return Math.floor(le)}return re.objectMode?16:16*1024}g.exports={getHighWaterMark:oe}},{"../../../errors":55}],68:[function(r,g,V){g.exports=r("events").EventEmitter},{events:22}],69:[function(r,g,V){V=g.exports=r("./lib/_stream_readable.js"),V.Stream=V,V.Readable=V,V.Writable=r("./lib/_stream_writable.js"),V.Duplex=r("./lib/_stream_duplex.js"),V.Transform=r("./lib/_stream_transform.js"),V.PassThrough=r("./lib/_stream_passthrough.js"),V.finished=r("./lib/internal/streams/end-of-stream.js"),V.pipeline=r("./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(r,g,V){function k(oe,re,Ce){var ie=this;this._callback=oe,this._args=Ce,this._interval=setInterval(oe,re,this._args),this.reschedule=function(ae){ae||(ae=ie._interval),ie._interval&&clearInterval(ie._interval),ie._interval=setInterval(ie._callback,ae,ie._args)},this.clear=function(){ie._interval&&(clearInterval(ie._interval),ie._interval=void 0)},this.destroy=function(){ie._interval&&clearInterval(ie._interval),ie._callback=void 0,ie._interval=void 0,ie._args=void 0}}function $(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var oe;if(arguments.length>0){oe=new Array(arguments.length-2);for(var re=0;re<oe.length;re++)oe[re]=arguments[re+2]}return new k(arguments[0],arguments[1],oe)}g.exports=$},{}],71:[function(r,g,V){g.exports=r("./index.js")()},{"./index.js":72}],72:[function(r,g,V){(function(k){(function(){g.exports=oe;function $(Ce){return Ce instanceof k?k.from(Ce):new Ce.constructor(Ce.buffer.slice(),Ce.byteOffset,Ce.length)}function oe(Ce){if(Ce=Ce||{},Ce.circles)return re(Ce);return Ce.proto?le:ae;function ie(Ie,ue){for(var de=Object.keys(Ie),Ne=new Array(de.length),he=0;he<de.length;he++){var pe=de[he],ze=Ie[pe];typeof ze!="object"||ze===null?Ne[pe]=ze:ze instanceof Date?Ne[pe]=new Date(ze):ArrayBuffer.isView(ze)?Ne[pe]=$(ze):Ne[pe]=ue(ze)}return Ne}function ae(Ie){if(typeof Ie!="object"||Ie===null)return Ie;if(Ie instanceof Date)return new Date(Ie);if(Array.isArray(Ie))return ie(Ie,ae);if(Ie instanceof Map)return new Map(ie(Array.from(Ie),ae));if(Ie instanceof Set)return new Set(ie(Array.from(Ie),ae));var ue={};for(var de in Ie)if(Object.hasOwnProperty.call(Ie,de)!==!1){var Ne=Ie[de];typeof Ne!="object"||Ne===null?ue[de]=Ne:Ne instanceof Date?ue[de]=new Date(Ne):Ne instanceof Map?ue[de]=new Map(ie(Array.from(Ne),ae)):Ne instanceof Set?ue[de]=new Set(ie(Array.from(Ne),ae)):ArrayBuffer.isView(Ne)?ue[de]=$(Ne):ue[de]=ae(Ne)}return ue}function le(Ie){if(typeof Ie!="object"||Ie===null)return Ie;if(Ie instanceof Date)return new Date(Ie);if(Array.isArray(Ie))return ie(Ie,le);if(Ie instanceof Map)return new Map(ie(Array.from(Ie),le));if(Ie instanceof Set)return new Set(ie(Array.from(Ie),le));var ue={};for(var de in Ie){var Ne=Ie[de];typeof Ne!="object"||Ne===null?ue[de]=Ne:Ne instanceof Date?ue[de]=new Date(Ne):Ne instanceof Map?ue[de]=new Map(ie(Array.from(Ne),le)):Ne instanceof Set?ue[de]=new Set(ie(Array.from(Ne),le)):ArrayBuffer.isView(Ne)?ue[de]=$(Ne):ue[de]=le(Ne)}return ue}}function re(Ce){var ie=[],ae=[];return Ce.proto?ue:Ie;function le(de,Ne){for(var he=Object.keys(de),pe=new Array(he.length),ze=0;ze<he.length;ze++){var xe=he[ze],Oe=de[xe];if(typeof Oe!="object"||Oe===null)pe[xe]=Oe;else if(Oe instanceof Date)pe[xe]=new Date(Oe);else if(ArrayBuffer.isView(Oe))pe[xe]=$(Oe);else{var _e=ie.indexOf(Oe);_e!==-1?pe[xe]=ae[_e]:pe[xe]=Ne(Oe)}}return pe}function Ie(de){if(typeof de!="object"||de===null)return de;if(de instanceof Date)return new Date(de);if(Array.isArray(de))return le(de,Ie);if(de instanceof Map)return new Map(le(Array.from(de),Ie));if(de instanceof Set)return new Set(le(Array.from(de),Ie));var Ne={};ie.push(de),ae.push(Ne);for(var he in de)if(Object.hasOwnProperty.call(de,he)!==!1){var pe=de[he];if(typeof pe!="object"||pe===null)Ne[he]=pe;else if(pe instanceof Date)Ne[he]=new Date(pe);else if(pe instanceof Map)Ne[he]=new Map(le(Array.from(pe),Ie));else if(pe instanceof Set)Ne[he]=new Set(le(Array.from(pe),Ie));else if(ArrayBuffer.isView(pe))Ne[he]=$(pe);else{var ze=ie.indexOf(pe);ze!==-1?Ne[he]=ae[ze]:Ne[he]=Ie(pe)}}return ie.pop(),ae.pop(),Ne}function ue(de){if(typeof de!="object"||de===null)return de;if(de instanceof Date)return new Date(de);if(Array.isArray(de))return le(de,ue);if(de instanceof Map)return new Map(le(Array.from(de),ue));if(de instanceof Set)return new Set(le(Array.from(de),ue));var Ne={};ie.push(de),ae.push(Ne);for(var he in de){var pe=de[he];if(typeof pe!="object"||pe===null)Ne[he]=pe;else if(pe instanceof Date)Ne[he]=new Date(pe);else if(pe instanceof Map)Ne[he]=new Map(le(Array.from(pe),ue));else if(pe instanceof Set)Ne[he]=new Set(le(Array.from(pe),ue));else if(ArrayBuffer.isView(pe))Ne[he]=$(pe);else{var ze=ie.indexOf(pe);ze!==-1?Ne[he]=ae[ze]:Ne[he]=ue(pe)}}return ie.pop(),ae.pop(),Ne}}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],73:[function(r,g,V){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var k=r("buffer"),$=k.Buffer;function oe(Ce,ie){for(var ae in Ce)ie[ae]=Ce[ae]}$.from&&$.alloc&&$.allocUnsafe&&$.allocUnsafeSlow?g.exports=k:(oe(k,V),V.Buffer=re);function re(Ce,ie,ae){return $(Ce,ie,ae)}re.prototype=Object.create($.prototype),oe($,re),re.from=function(Ce,ie,ae){if(typeof Ce=="number")throw new TypeError("Argument must not be a number");return $(Ce,ie,ae)},re.alloc=function(Ce,ie,ae){if(typeof Ce!="number")throw new TypeError("Argument must be a number");var le=$(Ce);return ie!==void 0?typeof ae=="string"?le.fill(ie,ae):le.fill(ie):le.fill(0),le},re.allocUnsafe=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return $(Ce)},re.allocUnsafeSlow=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return k.SlowBuffer(Ce)}},{buffer:17}],74:[function(r,g,V){g.exports=k;function k(oe){var re=oe._readableState;return re?re.objectMode||typeof oe._duplexState=="number"?oe.read():oe.read($(re)):null}function $(oe){return oe.buffer.length?oe.buffer.head?oe.buffer.head.data.length:oe.buffer[0].length:oe.length}},{}],75:[function(r,g,V){var k=r("safe-buffer").Buffer,$=k.isEncoding||function(_e){switch(_e=""+_e,_e&&_e.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 oe(_e){if(!_e)return"utf8";for(var At;;)switch(_e){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 _e;default:if(At)return;_e=(""+_e).toLowerCase(),At=!0}}function re(_e){var At=oe(_e);if(typeof At!="string"&&(k.isEncoding===$||!$(_e)))throw new Error("Unknown encoding: "+_e);return At||_e}V.StringDecoder=Ce;function Ce(_e){this.encoding=re(_e);var At;switch(this.encoding){case"utf16le":this.text=Ne,this.end=he,At=4;break;case"utf8":this.fillLast=Ie,At=4;break;case"base64":this.text=pe,this.end=ze,At=3;break;default:this.write=xe,this.end=Oe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=k.allocUnsafe(At)}Ce.prototype.write=function(_e){if(_e.length===0)return"";var At,$e;if(this.lastNeed){if(At=this.fillLast(_e),At===void 0)return"";$e=this.lastNeed,this.lastNeed=0}else $e=0;return $e<_e.length?At?At+this.text(_e,$e):this.text(_e,$e):At||""},Ce.prototype.end=de,Ce.prototype.text=ue,Ce.prototype.fillLast=function(_e){if(this.lastNeed<=_e.length)return _e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_e.length),this.lastNeed-=_e.length};function ie(_e){return _e<=127?0:_e>>5===6?2:_e>>4===14?3:_e>>3===30?4:_e>>6===2?-1:-2}function ae(_e,At,$e){var Fe=At.length-1;if(Fe<$e)return 0;var Ue=ie(At[Fe]);return Ue>=0?(Ue>0&&(_e.lastNeed=Ue-1),Ue):--Fe<$e||Ue===-2?0:(Ue=ie(At[Fe]),Ue>=0?(Ue>0&&(_e.lastNeed=Ue-2),Ue):--Fe<$e||Ue===-2?0:(Ue=ie(At[Fe]),Ue>=0?(Ue>0&&(Ue===2?Ue=0:_e.lastNeed=Ue-3),Ue):0))}function le(_e,At,$e){if((At[0]&192)!==128)return _e.lastNeed=0,"�";if(_e.lastNeed>1&&At.length>1){if((At[1]&192)!==128)return _e.lastNeed=1,"�";if(_e.lastNeed>2&&At.length>2&&(At[2]&192)!==128)return _e.lastNeed=2,"�"}}function Ie(_e){var At=this.lastTotal-this.lastNeed,$e=le(this,_e);if($e!==void 0)return $e;if(this.lastNeed<=_e.length)return _e.copy(this.lastChar,At,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_e.copy(this.lastChar,At,0,_e.length),this.lastNeed-=_e.length}function ue(_e,At){var $e=ae(this,_e,At);if(!this.lastNeed)return _e.toString("utf8",At);this.lastTotal=$e;var Fe=_e.length-($e-this.lastNeed);return _e.copy(this.lastChar,0,Fe),_e.toString("utf8",At,Fe)}function de(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+"�":At}function Ne(_e,At){if((_e.length-At)%2===0){var $e=_e.toString("utf16le",At);if($e){var Fe=$e.charCodeAt($e.length-1);if(Fe>=55296&&Fe<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_e[_e.length-2],this.lastChar[1]=_e[_e.length-1],$e.slice(0,-1)}return $e}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_e[_e.length-1],_e.toString("utf16le",At,_e.length-1)}function he(_e){var At=_e&&_e.length?this.write(_e):"";if(this.lastNeed){var $e=this.lastTotal-this.lastNeed;return At+this.lastChar.toString("utf16le",0,$e)}return At}function pe(_e,At){var $e=(_e.length-At)%3;return $e===0?_e.toString("base64",At):(this.lastNeed=3-$e,this.lastTotal=3,$e===1?this.lastChar[0]=_e[_e.length-1]:(this.lastChar[0]=_e[_e.length-2],this.lastChar[1]=_e[_e.length-1]),_e.toString("base64",At,_e.length-$e))}function ze(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+this.lastChar.toString("base64",0,3-this.lastNeed):At}function xe(_e){return _e.toString(this.encoding)}function Oe(_e){return _e&&_e.length?this.write(_e):""}},{"safe-buffer":73}],76:[function(r,g,V){var k=r("punycode"),$=r("./util");V.parse=At,V.resolve=Fe,V.resolveObject=Ue,V.format=$e,V.Url=oe;function oe(){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}var re=/^([a-z0-9.+-]+:)/i,Ce=/:[0-9]*$/,ie=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ae=["<",">",'"',"`"," ","\r",`
1156
1156
  `," "],le=["{","}","|","\\","^","`"].concat(ae),Ie=["'"].concat(le),ue=["%","/","?",";","#"].concat(Ie),de=["/","?","#"],Ne=255,he=/^[+a-z0-9A-Z_-]{0,63}$/,pe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ze={javascript:!0,"javascript:":!0},xe={javascript:!0,"javascript:":!0},Oe={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_e=r("querystring");function At(Ve,Dt,qe){if(Ve&&$.isObject(Ve)&&Ve instanceof oe)return Ve;var kt=new oe;return kt.parse(Ve,Dt,qe),kt}oe.prototype.parse=function(Ve,Dt,qe){if(!$.isString(Ve))throw new TypeError("Parameter 'url' must be a string, not "+typeof Ve);var kt=Ve.indexOf("?"),jt=kt!==-1&&kt<Ve.indexOf("#")?"?":"#",Pt=Ve.split(jt),ti=/\\/g;Pt[0]=Pt[0].replace(ti,"/"),Ve=Pt.join(jt);var ei=Ve;if(ei=ei.trim(),!qe&&Ve.split("#").length===1){var Lt=ie.exec(ei);if(Lt)return this.path=ei,this.href=ei,this.pathname=Lt[1],Lt[2]?(this.search=Lt[2],Dt?this.query=_e.parse(this.search.substr(1)):this.query=this.search.substr(1)):Dt&&(this.search="",this.query={}),this}var ni=re.exec(ei);if(ni){ni=ni[0];var ri=ni.toLowerCase();this.protocol=ri,ei=ei.substr(ni.length)}if(qe||ni||ei.match(/^\/\/[^@\/]+@[^@\/]+/)){var Ii=ei.substr(0,2)==="//";Ii&&!(ni&&xe[ni])&&(ei=ei.substr(2),this.slashes=!0)}if(!xe[ni]&&(Ii||ni&&!Oe[ni])){for(var wi=-1,ai=0;ai<de.length;ai++){var di=ei.indexOf(de[ai]);di!==-1&&(wi===-1||di<wi)&&(wi=di)}var hi,ci;wi===-1?ci=ei.lastIndexOf("@"):ci=ei.lastIndexOf("@",wi),ci!==-1&&(hi=ei.slice(0,ci),ei=ei.slice(ci+1),this.auth=decodeURIComponent(hi)),wi=-1;for(var ai=0;ai<ue.length;ai++){var di=ei.indexOf(ue[ai]);di!==-1&&(wi===-1||di<wi)&&(wi=di)}wi===-1&&(wi=ei.length),this.host=ei.slice(0,wi),ei=ei.slice(wi),this.parseHost(),this.hostname=this.hostname||"";var Ai=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!Ai)for(var yi=this.hostname.split(/\./),ai=0,ui=yi.length;ai<ui;ai++){var Ci=yi[ai];if(Ci&&!Ci.match(he)){for(var zi="",Ni=0,Mi=Ci.length;Ni<Mi;Ni++)Ci.charCodeAt(Ni)>127?zi+="x":zi+=Ci[Ni];if(!zi.match(he)){var mi=yi.slice(0,ai),vi=yi.slice(ai+1),bi=Ci.match(pe);bi&&(mi.push(bi[1]),vi.unshift(bi[2])),vi.length&&(ei="/"+vi.join(".")+ei),this.hostname=mi.join(".");break}}}this.hostname.length>Ne?this.hostname="":this.hostname=this.hostname.toLowerCase(),Ai||(this.hostname=k.toASCII(this.hostname));var gi=this.port?":"+this.port:"",li=this.hostname||"";this.host=li+gi,this.href+=this.host,Ai&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ei[0]!=="/"&&(ei="/"+ei))}if(!ze[ri])for(var ai=0,ui=Ie.length;ai<ui;ai++){var oi=Ie[ai];if(ei.indexOf(oi)!==-1){var Et=encodeURIComponent(oi);Et===oi&&(Et=escape(oi)),ei=ei.split(oi).join(Et)}}var ii=ei.indexOf("#");ii!==-1&&(this.hash=ei.substr(ii),ei=ei.slice(0,ii));var si=ei.indexOf("?");if(si!==-1?(this.search=ei.substr(si),this.query=ei.substr(si+1),Dt&&(this.query=_e.parse(this.query)),ei=ei.slice(0,si)):Dt&&(this.search="",this.query={}),ei&&(this.pathname=ei),Oe[ri]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var gi=this.pathname||"",fi=this.search||"";this.path=gi+fi}return this.href=this.format(),this};function $e(Ve){return $.isString(Ve)&&(Ve=At(Ve)),Ve instanceof oe?Ve.format():oe.prototype.format.call(Ve)}oe.prototype.format=function(){var Ve=this.auth||"";Ve&&(Ve=encodeURIComponent(Ve),Ve=Ve.replace(/%3A/i,":"),Ve+="@");var Dt=this.protocol||"",qe=this.pathname||"",kt=this.hash||"",jt=!1,Pt="";this.host?jt=Ve+this.host:this.hostname&&(jt=Ve+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(jt+=":"+this.port)),this.query&&$.isObject(this.query)&&Object.keys(this.query).length&&(Pt=_e.stringify(this.query));var ti=this.search||Pt&&"?"+Pt||"";return Dt&&Dt.substr(-1)!==":"&&(Dt+=":"),this.slashes||(!Dt||Oe[Dt])&&jt!==!1?(jt="//"+(jt||""),qe&&qe.charAt(0)!=="/"&&(qe="/"+qe)):jt||(jt=""),kt&&kt.charAt(0)!=="#"&&(kt="#"+kt),ti&&ti.charAt(0)!=="?"&&(ti="?"+ti),qe=qe.replace(/[?#]/g,function(ei){return encodeURIComponent(ei)}),ti=ti.replace("#","%23"),Dt+jt+qe+ti+kt};function Fe(Ve,Dt){return At(Ve,!1,!0).resolve(Dt)}oe.prototype.resolve=function(Ve){return this.resolveObject(At(Ve,!1,!0)).format()};function Ue(Ve,Dt){return Ve?At(Ve,!1,!0).resolveObject(Dt):Dt}oe.prototype.resolveObject=function(Ve){if($.isString(Ve)){var Dt=new oe;Dt.parse(Ve,!1,!0),Ve=Dt}for(var qe=new oe,kt=Object.keys(this),jt=0;jt<kt.length;jt++){var Pt=kt[jt];qe[Pt]=this[Pt]}if(qe.hash=Ve.hash,Ve.href==="")return qe.href=qe.format(),qe;if(Ve.slashes&&!Ve.protocol){for(var ti=Object.keys(Ve),ei=0;ei<ti.length;ei++){var Lt=ti[ei];Lt!=="protocol"&&(qe[Lt]=Ve[Lt])}return Oe[qe.protocol]&&qe.hostname&&!qe.pathname&&(qe.path=qe.pathname="/"),qe.href=qe.format(),qe}if(Ve.protocol&&Ve.protocol!==qe.protocol){if(!Oe[Ve.protocol]){for(var ni=Object.keys(Ve),ri=0;ri<ni.length;ri++){var Ii=ni[ri];qe[Ii]=Ve[Ii]}return qe.href=qe.format(),qe}if(qe.protocol=Ve.protocol,!Ve.host&&!xe[Ve.protocol]){for(var ui=(Ve.pathname||"").split("/");ui.length&&!(Ve.host=ui.shift()););Ve.host||(Ve.host=""),Ve.hostname||(Ve.hostname=""),ui[0]!==""&&ui.unshift(""),ui.length<2&&ui.unshift(""),qe.pathname=ui.join("/")}else qe.pathname=Ve.pathname;if(qe.search=Ve.search,qe.query=Ve.query,qe.host=Ve.host||"",qe.auth=Ve.auth,qe.hostname=Ve.hostname||Ve.host,qe.port=Ve.port,qe.pathname||qe.search){var wi=qe.pathname||"",ai=qe.search||"";qe.path=wi+ai}return qe.slashes=qe.slashes||Ve.slashes,qe.href=qe.format(),qe}var di=qe.pathname&&qe.pathname.charAt(0)==="/",hi=Ve.host||Ve.pathname&&Ve.pathname.charAt(0)==="/",ci=hi||di||qe.host&&Ve.pathname,Ai=ci,yi=qe.pathname&&qe.pathname.split("/")||[],ui=Ve.pathname&&Ve.pathname.split("/")||[],Ci=qe.protocol&&!Oe[qe.protocol];if(Ci&&(qe.hostname="",qe.port=null,qe.host&&(yi[0]===""?yi[0]=qe.host:yi.unshift(qe.host)),qe.host="",Ve.protocol&&(Ve.hostname=null,Ve.port=null,Ve.host&&(ui[0]===""?ui[0]=Ve.host:ui.unshift(Ve.host)),Ve.host=null),ci=ci&&(ui[0]===""||yi[0]==="")),hi)qe.host=Ve.host||Ve.host===""?Ve.host:qe.host,qe.hostname=Ve.hostname||Ve.hostname===""?Ve.hostname:qe.hostname,qe.search=Ve.search,qe.query=Ve.query,yi=ui;else if(ui.length)yi||(yi=[]),yi.pop(),yi=yi.concat(ui),qe.search=Ve.search,qe.query=Ve.query;else if(!$.isNullOrUndefined(Ve.search)){if(Ci){qe.hostname=qe.host=yi.shift();var zi=qe.host&&qe.host.indexOf("@")>0?qe.host.split("@"):!1;zi&&(qe.auth=zi.shift(),qe.host=qe.hostname=zi.shift())}return qe.search=Ve.search,qe.query=Ve.query,(!$.isNull(qe.pathname)||!$.isNull(qe.search))&&(qe.path=(qe.pathname?qe.pathname:"")+(qe.search?qe.search:"")),qe.href=qe.format(),qe}if(!yi.length)return qe.pathname=null,qe.search?qe.path="/"+qe.search:qe.path=null,qe.href=qe.format(),qe;for(var Ni=yi.slice(-1)[0],Mi=(qe.host||Ve.host||yi.length>1)&&(Ni==="."||Ni==="..")||Ni==="",mi=0,vi=yi.length;vi>=0;vi--)Ni=yi[vi],Ni==="."?yi.splice(vi,1):Ni===".."?(yi.splice(vi,1),mi++):mi&&(yi.splice(vi,1),mi--);if(!ci&&!Ai)for(;mi--;mi)yi.unshift("..");ci&&yi[0]!==""&&(!yi[0]||yi[0].charAt(0)!=="/")&&yi.unshift(""),Mi&&yi.join("/").substr(-1)!=="/"&&yi.push("");var bi=yi[0]===""||yi[0]&&yi[0].charAt(0)==="/";if(Ci){qe.hostname=qe.host=bi?"":yi.length?yi.shift():"";var zi=qe.host&&qe.host.indexOf("@")>0?qe.host.split("@"):!1;zi&&(qe.auth=zi.shift(),qe.host=qe.hostname=zi.shift())}return ci=ci||qe.host&&yi.length,ci&&!bi&&yi.unshift(""),yi.length?qe.pathname=yi.join("/"):(qe.pathname=null,qe.path=null),(!$.isNull(qe.pathname)||!$.isNull(qe.search))&&(qe.path=(qe.pathname?qe.pathname:"")+(qe.search?qe.search:"")),qe.auth=Ve.auth||qe.auth,qe.slashes=qe.slashes||Ve.slashes,qe.href=qe.format(),qe},oe.prototype.parseHost=function(){var Ve=this.host,Dt=Ce.exec(Ve);Dt&&(Dt=Dt[0],Dt!==":"&&(this.port=Dt.substr(1)),Ve=Ve.substr(0,Ve.length-Dt.length)),Ve&&(this.hostname=Ve)}},{"./util":77,punycode:51,querystring:54}],77:[function(r,g,V){g.exports={isString:function(k){return typeof k=="string"},isObject:function(k){return typeof k=="object"&&k!==null},isNull:function(k){return k===null},isNullOrUndefined:function(k){return k==null}}},{}],78:[function(r,g,V){(function(k){(function(){g.exports=$;function $(re,Ce){if(oe("noDeprecation"))return re;var ie=!1;function ae(){if(!ie){if(oe("throwDeprecation"))throw new Error(Ce);oe("traceDeprecation")?console.trace(Ce):console.warn(Ce),ie=!0}return re.apply(this,arguments)}return ae}function oe(re){try{if(!k.localStorage)return!1}catch{return!1}var Ce=k.localStorage[re];return Ce==null?!1:String(Ce).toLowerCase()==="true"}}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(r,g,V){g.exports=k;function k($,oe){if($&&oe)return k($)(oe);if(typeof $!="function")throw new TypeError("need wrapper function");return Object.keys($).forEach(function(Ce){re[Ce]=$[Ce]}),re;function re(){for(var Ce=new Array(arguments.length),ie=0;ie<Ce.length;ie++)Ce[ie]=arguments[ie];var ae=$.apply(this,Ce),le=Ce[Ce.length-1];return typeof ae=="function"&&ae!==le&&Object.keys(le).forEach(function(Ie){ae[Ie]=le[Ie]}),ae}}},{}],80:[function(r,g,V){g.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(r,g,V){g.exports=$;var k=Object.prototype.hasOwnProperty;function $(){for(var oe={},re=0;re<arguments.length;re++){var Ce=arguments[re];for(var ie in Ce)k.call(Ce,ie)&&(oe[ie]=Ce[ie])}return oe}},{}],82:[function(r,g,V){g.exports=function(k){k.prototype[Symbol.iterator]=function*(){for(let $=this.head;$;$=$.next)yield $.value}}},{}],83:[function(r,g,V){g.exports=k,k.Node=Ce,k.create=k;function k(ie){var ae=this;if(ae instanceof k||(ae=new k),ae.tail=null,ae.head=null,ae.length=0,ie&&typeof ie.forEach=="function")ie.forEach(function(ue){ae.push(ue)});else if(arguments.length>0)for(var le=0,Ie=arguments.length;le<Ie;le++)ae.push(arguments[le]);return ae}k.prototype.removeNode=function(ie){if(ie.list!==this)throw new Error("removing node which does not belong to this list");var ae=ie.next,le=ie.prev;return ae&&(ae.prev=le),le&&(le.next=ae),ie===this.head&&(this.head=ae),ie===this.tail&&(this.tail=le),ie.list.length--,ie.next=null,ie.prev=null,ie.list=null,ae},k.prototype.unshiftNode=function(ie){if(ie!==this.head){ie.list&&ie.list.removeNode(ie);var ae=this.head;ie.list=this,ie.next=ae,ae&&(ae.prev=ie),this.head=ie,this.tail||(this.tail=ie),this.length++}},k.prototype.pushNode=function(ie){if(ie!==this.tail){ie.list&&ie.list.removeNode(ie);var ae=this.tail;ie.list=this,ie.prev=ae,ae&&(ae.next=ie),this.tail=ie,this.head||(this.head=ie),this.length++}},k.prototype.push=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)oe(this,arguments[ie]);return this.length},k.prototype.unshift=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)re(this,arguments[ie]);return this.length},k.prototype.pop=function(){if(this.tail){var ie=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,ie}},k.prototype.shift=function(){if(this.head){var ie=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,ie}},k.prototype.forEach=function(ie,ae){ae=ae||this;for(var le=this.head,Ie=0;le!==null;Ie++)ie.call(ae,le.value,Ie,this),le=le.next},k.prototype.forEachReverse=function(ie,ae){ae=ae||this;for(var le=this.tail,Ie=this.length-1;le!==null;Ie--)ie.call(ae,le.value,Ie,this),le=le.prev},k.prototype.get=function(ie){for(var ae=0,le=this.head;le!==null&&ae<ie;ae++)le=le.next;if(ae===ie&&le!==null)return le.value},k.prototype.getReverse=function(ie){for(var ae=0,le=this.tail;le!==null&&ae<ie;ae++)le=le.prev;if(ae===ie&&le!==null)return le.value},k.prototype.map=function(ie,ae){ae=ae||this;for(var le=new k,Ie=this.head;Ie!==null;)le.push(ie.call(ae,Ie.value,this)),Ie=Ie.next;return le},k.prototype.mapReverse=function(ie,ae){ae=ae||this;for(var le=new k,Ie=this.tail;Ie!==null;)le.push(ie.call(ae,Ie.value,this)),Ie=Ie.prev;return le},k.prototype.reduce=function(ie,ae){var le,Ie=this.head;if(arguments.length>1)le=ae;else if(this.head)Ie=this.head.next,le=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var ue=0;Ie!==null;ue++)le=ie(le,Ie.value,ue),Ie=Ie.next;return le},k.prototype.reduceReverse=function(ie,ae){var le,Ie=this.tail;if(arguments.length>1)le=ae;else if(this.tail)Ie=this.tail.prev,le=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var ue=this.length-1;Ie!==null;ue--)le=ie(le,Ie.value,ue),Ie=Ie.prev;return le},k.prototype.toArray=function(){for(var ie=new Array(this.length),ae=0,le=this.head;le!==null;ae++)ie[ae]=le.value,le=le.next;return ie},k.prototype.toArrayReverse=function(){for(var ie=new Array(this.length),ae=0,le=this.tail;le!==null;ae++)ie[ae]=le.value,le=le.prev;return ie},k.prototype.slice=function(ie,ae){ae=ae||this.length,ae<0&&(ae+=this.length),ie=ie||0,ie<0&&(ie+=this.length);var le=new k;if(ae<ie||ae<0)return le;ie<0&&(ie=0),ae>this.length&&(ae=this.length);for(var Ie=0,ue=this.head;ue!==null&&Ie<ie;Ie++)ue=ue.next;for(;ue!==null&&Ie<ae;Ie++,ue=ue.next)le.push(ue.value);return le},k.prototype.sliceReverse=function(ie,ae){ae=ae||this.length,ae<0&&(ae+=this.length),ie=ie||0,ie<0&&(ie+=this.length);var le=new k;if(ae<ie||ae<0)return le;ie<0&&(ie=0),ae>this.length&&(ae=this.length);for(var Ie=this.length,ue=this.tail;ue!==null&&Ie>ae;Ie--)ue=ue.prev;for(;ue!==null&&Ie>ie;Ie--,ue=ue.prev)le.push(ue.value);return le},k.prototype.splice=function(ie,ae,...le){ie>this.length&&(ie=this.length-1),ie<0&&(ie=this.length+ie);for(var Ie=0,ue=this.head;ue!==null&&Ie<ie;Ie++)ue=ue.next;for(var de=[],Ie=0;ue&&Ie<ae;Ie++)de.push(ue.value),ue=this.removeNode(ue);ue===null&&(ue=this.tail),ue!==this.head&&ue!==this.tail&&(ue=ue.prev);for(var Ie=0;Ie<le.length;Ie++)ue=$(this,ue,le[Ie]);return de},k.prototype.reverse=function(){for(var ie=this.head,ae=this.tail,le=ie;le!==null;le=le.prev){var Ie=le.prev;le.prev=le.next,le.next=Ie}return this.head=ae,this.tail=ie,this};function $(ie,ae,le){var Ie=ae===ie.head?new Ce(le,null,ae,ie):new Ce(le,ae,ae.next,ie);return Ie.next===null&&(ie.tail=Ie),Ie.prev===null&&(ie.head=Ie),ie.length++,Ie}function oe(ie,ae){ie.tail=new Ce(ae,ie.tail,null,ie),ie.head||(ie.head=ie.tail),ie.length++}function re(ie,ae){ie.head=new Ce(ae,null,ie.head,ie),ie.tail||(ie.tail=ie.head),ie.length++}function Ce(ie,ae,le,Ie){if(!(this instanceof Ce))return new Ce(ie,ae,le,Ie);this.list=Ie,this.value=ie,ae?(ae.next=this,this.prev=ae):this.prev=null,le?(le.prev=this,this.next=le):this.next=null}try{r("./iterator.js")(k)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(i,n,r,g,V)=>{client=mqttExports.connect(i,{username:n,password:r}),client.on("connect",()=>{console.log("MQTT服务器连接成功"),console.log(client.options.clientId),client.subscribe(g,{qos:1})}),client.on("message",V)},close=()=>{client&&client.end&&client.end(!0,{},()=>{console.log("MQTT服务连接关闭")})},_hoisted_1=["transform"],_hoisted_2=["transform","onClick"],_hoisted_3=["transform"],_hoisted_4=["xlink:href","id","transform"],_hoisted_5=["id"],_sfc_main=vue.defineComponent({__name:"index",props:{data:{},canvasDrag:{type:Boolean,default:!0}},emits:["onMessage"],setup(i,{expose:n,emit:r}){const g=i;vue.useCssVars(pe=>({"036b5645":vue.unref(oe)}));const V=vue.getCurrentInstance();Object.keys(vueComp).forEach(pe=>{var ze;Object.keys((ze=V==null?void 0:V.appContext)==null?void 0:ze.components).includes(pe)||V==null||V.appContext.app.component(pe,vueComp[pe])});const k=vue.reactive(g.data??{layout_center:{x:0,y:0},config:{svg:{background_color:"#fff",scale:1,grid_color:"#ebebeb"},net:{mqtt:{url:"",user:"",pwd:"",topics:""}}},done_json:[]}),$=useGlobalStore(pinia),oe=vue.computed(()=>$.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),re=pe=>{if($.mouse_info.state!=EMouseInfoState.Down&&$.intention!==EGlobalStoreIntention.Connection||!g.canvasDrag)return;const{clientX:ze,clientY:xe}=pe;$.mouse_info.new_position_x=$.mouse_info.now_position_x+ze-$.mouse_info.position_x,$.mouse_info.new_position_y=$.mouse_info.now_position_y+xe-$.mouse_info.position_y,$.intention==EGlobalStoreIntention.MoveCanvas&&(k.layout_center.x=$.mouse_info.new_position_x,k.layout_center.y=$.mouse_info.new_position_y)},Ce=()=>{$.mouse_info.state==EMouseInfoState.Down&&($.intention!=EGlobalStoreIntention.Select&&($.intention=EGlobalStoreIntention.None),$.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0})},ie=pe=>{const{clientX:ze,clientY:xe}=pe;$.intention=EGlobalStoreIntention.MoveCanvas,$.mouse_info={state:EMouseInfoState.Down,position_x:ze,position_y:xe,now_position_x:k.layout_center.x,now_position_y:k.layout_center.y,new_position_x:k.layout_center.x,new_position_y:k.layout_center.y}};function ae(pe){pe!=null&&pe.wheelDelta&&(pe.wheelDelta>0?k.config.svg.scale=parseFloat((k.config.svg.scale+.1).toFixed(1)):k.config.svg.scale=parseFloat((k.config.svg.scale-.1).toFixed(1)))}const le=(pe,ze,xe)=>({x:pe.x-pe.width/2*ze+pe.width/2,y:pe.y-pe.height/2*xe+pe.height/2,width:pe.width*ze,height:pe.height*xe}),Ie=(pe,ze,xe)=>setArrItemByID(pe,ze,xe,k.done_json),ue=pe=>{var xe;let ze=!1;if(((xe=pe.events)==null?void 0:xe.length)>0){for(let Oe of pe.events)if(Oe.type===EEventType.Click){ze=!0;break}}return{cursor:ze?"pointer":"default"}},de=pe=>{var ze;if(((ze=pe.events)==null?void 0:ze.length)>0){for(let xe of pe.events)if(xe.type===EEventType.Click||xe.type===EEventType.Change){if(xe.condition&&xe.condition.type!=="None"&&xe.condition.type==="Relation"&&xe.condition.Relation&&xe.condition.Relation.relation){const Oe=xe.condition.Relation.key,_e=xe.condition.Relation.relation,At=valFormat(xe.condition.Relation.val),$e=valFormat(xe.condition.Relation.val2);if(pe.props.hasOwnProperty(Oe)){const Fe=pe.props[Oe].val;if(!Ne(Fe,_e,At,$e))continue}}if(xe.action===EEventAction.ChangeAttr){if(xe.attrs&&xe.attrs.length>0){let Oe;if(xe.target){for(let _e of $.done_json)if(_e.id===xe.target){Oe=_e;break}}else Oe=pe;if(!Oe)continue;for(let _e of xe.attrs)Oe.state&&Oe.state.hasOwnProperty(_e.key)?Oe.state[_e.key].default=valFormat(_e.val):Oe.props.hasOwnProperty(_e.key)&&(Oe.props[_e.key].val=valFormat(_e.val))}}else xe.action===EEventAction.JavaScript&&new Function(xe.scripts)()}}},Ne=(pe,ze,xe,Oe)=>{switch(ze){case">":return pe>xe;case">=":return pe>=xe;case"<":return pe<xe;case"<=":return pe<=xe;case"==":return pe==xe;case"!=":return pe!=xe;case">=,=<":return pe>=xe&&pe<=Oe;case"<,>":return pe<xe||pe>Oe}};vue.onMounted(()=>{he()}),vue.onBeforeUnmount(close);const he=()=>{const pe=k.config.net.mqtt;pe&&pe.url&&pe.user&&pe.pwd&&pe.topics&&sub(pe.url,pe.user,pe.pwd,pe.topics,(ze,xe)=>{console.log(ze),console.log(xe.toString()),r("onMessage",{topics:ze,message:xe})})};return n({setNodeAttrByID:Ie}),(pe,ze)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:ie,onMousemove:re,onMouseup:Ce,onMousewheel:ae},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(k).config.svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("g",{transform:`translate(${vue.unref(k).layout_center.x},${vue.unref(k).layout_center.y})rotate(0)scale(${vue.unref(k).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(k).done_json,xe=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:xe.id,transform:`translate(${xe.x},${xe.y})rotate(0)scale(1)`,style:vue.normalizeStyle(ue(xe)),onClick:Oe=>de(xe)},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(xe)}`)},[vue.createElementVNode("g",{transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2})rotate(${xe.rotate}) scale(1) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`},[xe.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$e,{key:0,"item-info":xe},null,8,["item-info"])):xe.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${xe.name}`},vue.unref(prosToVBind)(xe),{width:"100",height:"100",id:xe.id,transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),null,16,_hoisted_4)):xe.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(xe.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(xe),{width:"100",height:"100",id:xe.id,onOnChange:Oe=>de(xe),transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):xe.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},le(xe.actual_bound,xe.scale_x,xe.scale_y),{id:`foreign-object${xe.id}`}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(xe.tag),vue.mergeProps(vue.unref(prosToVBind)(xe),{id:xe.id,onOnChange:Oe=>de(xe),transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(xe.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],12,_hoisted_2)),[[vue.vShow,xe.display]])),128))],8,_hoisted_1)],4))],32))}}),index_vue_vue_type_style_index_0_scoped_1a362b59_lang="",index=_export_sfc(_sfc_main,[["__scopeId","data-v-1a362b59"]]);exports.SvgEditor=index$1,exports.SvgViewer=index,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});