@zhangqingcq/vgce 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -64
- package/dist/style.css +1 -1
- package/dist/vgce.js +33 -37
- package/dist/vgce.umd.cjs +1 -1
- package/package.json +12 -12
- package/src/components/svg-viewer/index.vue +94 -95
- package/src/utils/fetch.ts +2 -2
- package/types/index.d.ts +17 -5
package/dist/vgce.umd.cjs
CHANGED
@@ -1200,4 +1200,4 @@ styles.join("\\n")
|
|
1200
1200
|
background: #25282c;
|
1201
1201
|
color: #c1c1c1;
|
1202
1202
|
}`,"autocompletion.css",!1),g.AcePopup=Ie,g.$singleLineEditor=le,g.getAriaId=ae}),ace.define("ace/autocomplete/util",["require","exports","module"],function(r,g,k){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 V=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;g.retrievePrecedingIdentifier=function($,oe,re){re=re||V;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||V;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,k){var V=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 V,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,Fe=pe.$cursorLayer.getPixelPosition(this.base,!0);Fe.left-=this.popup.getTextLeftOffset();var xe=de.container.getBoundingClientRect();Fe.top+=xe.top-pe.layerConfig.offset,Fe.left+=xe.left-de.renderer.scrollLeft,Fe.left+=pe.gutterWidth,this.popup.show(Fe,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,Fe;Fe=pe[ze];ze++)Fe.start.column-=he.filterText.length,this.editor.session.remove(Fe);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 Fe=[],xe=de.completers.length;return de.completers.forEach(function(_e,At){_e.getCompletions(de,he,pe,ze,function($e,Ue){!$e&&Ue&&(Fe=Fe.concat(Ue)),Ne(null,{prefix:re.getCompletionPrefix(de),matches:Fe,finished:--xe===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,Fe=function(Ue){if(Ue.finished)return this.detach()}.bind(this),xe=function(Ue){var Ve=Ue.prefix,Oe=Ue.matches;this.completions=new ue(Oe),this.exactMatch&&(this.completions.exactMatch=!0),this.completions.setFilter(Ve);var Dt=this.completions.filtered;if(!Dt.length||Dt.length==1&&Dt[0].value==Ve&&!Dt[0].snippet)return Fe(Ue);if(this.autoInsert&&Dt.length==1&&Ue.finished)return this.insertMatch(Dt[0]);this.openPopup(this.editor,Ve,de)}.bind(this),_e=!0,At=null;if(this.gatherCompletions(this.editor,function(Ue,Ve){var Oe=Ve.prefix,Dt=Ve&&Ve.matches;if(!Dt||!Dt.length)return Fe(Ve);if(!(Oe.indexOf(Ve.prefix)!==0||ze!=this.gatherCompletionsId)){if(_e){At=Ve;return}xe(Ve)}}.bind(this)),_e=!1,At){var $e=At;At=null,xe($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 Fe=0,xe;xe=de[Fe];Fe++){var _e=xe.caption||xe.value||xe.snippet;if(_e){var At=-1,$e=0,Ue=0,Ve,Oe;if(this.exactMatch){if(Ne!==_e.substr(0,Ne.length))continue e}else{var Dt=_e.toLowerCase().indexOf(ze);if(Dt>-1)Ue=Dt;else for(var qe=0;qe<Ne.length;qe++){var kt=_e.indexOf(ze[qe],At+1),Lt=_e.indexOf(pe[qe],At+1);if(Ve=kt>=0&&(Lt<0||kt<Lt)?kt:Lt,Ve<0)continue e;Oe=Ve-At-1,Oe>0&&(At===-1&&(Ue+=10),Ue+=Oe,$e=$e|1<<qe),At=Ve}}xe.matchMask=$e,xe.exactMatch=Ue?0:1,xe.$score=(xe.score||0)-Ue,he.push(xe)}}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,k){var V=r("../range").Range,$=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function oe(Ce,ie){var ae=Ce.getTextRange(V.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,k){var V=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(xe,_e,At,$e,Ue){if(_e.$mode.completer)return _e.$mode.completer.getCompletions(xe,_e,At,$e,Ue);var Ve=xe.session.getState(At.row),Oe=_e.$mode.getCompletions(Ve,_e,At,$e);Ue(null,Oe)}},le=function(xe){var _e={};return xe.replace(/\${(\d+)(:(.*?))?}/g,function(At,$e,Ue,Ve){return _e[$e]=Ve||""}).replace(/\$(\d+?)/g,function(At,$e){return _e[$e]})},Ie={getCompletions:function(xe,_e,At,$e,Ue){var Ve=[],Oe=_e.getTokenAt(At.row,At.column);Oe&&Oe.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?Ve.push("html-tag"):Ve=V.getActiveScopes(xe);var Dt=V.snippetMap,qe=[];Ve.forEach(function(kt){for(var Lt=Dt[kt]||[],jt=Lt.length;jt--;){var ti=Lt[jt],ei=ti.name||ti.tabTrigger;ei&&qe.push({caption:ei,snippet:ti.content,meta:ti.tabTrigger&&!ti.name?ti.tabTrigger+"⇥ ":"snippet",type:"snippet"})}},this),Ue(null,qe)},getDocTooltip:function(xe){xe.type=="snippet"&&!xe.docHTML&&(xe.docHTML=["<b>",re.escapeHTML(xe.caption),"</b>","<hr></hr>",re.escapeHTML(le(xe.snippet))].join(""))}},ue=[Ie,ie,ae];g.setCompleters=function(xe){ue.length=0,xe&&ue.push.apply(ue,xe)},g.addCompleter=function(xe){ue.push(xe)},g.textCompleter=ie,g.keyWordCompleter=ae,g.snippetCompleter=Ie;var de={name:"expandSnippet",exec:function(xe){return V.expandWithTab(xe)},bindKey:"Tab"},Ne=function(xe,_e){he(_e.session.$mode)},he=function(xe){typeof xe=="string"&&(xe=oe.$modes[xe]),xe&&(V.files||(V.files={}),pe(xe.$id,xe.snippetFileId),xe.modes&&xe.modes.forEach(he))},pe=function(xe,_e){!_e||!xe||V.files[xe]||(V.files[xe]={},oe.loadModule(_e,function(At){At&&(V.files[xe]=At,!At.snippets&&At.snippetText&&(At.snippets=V.parseSnippetFile(At.snippetText)),V.register(At.snippets||[],At.scope),At.includeScopes&&(V.snippetMap[At.scope].includeScopes=At.includeScopes,At.includeScopes.forEach(function($e){he("ace/mode/"+$e)})))}))},ze=function(xe){var _e=xe.editor,At=_e.completer&&_e.completer.activated;if(xe.command.name==="backspace")At&&!Ce.getCompletionPrefix(_e)&&_e.completer.detach();else if(xe.command.name==="insertstring"){var $e=Ce.getCompletionPrefix(_e);if($e&&!At){var Ue=$.for(_e);Ue.autoInsert=!1,Ue.showPopup(_e)}}},Fe=r("../editor").Editor;r("../config").defineOptions(Fe.prototype,"editor",{enableBasicAutocompletion:{set:function(xe){xe?(this.completers||(this.completers=Array.isArray(xe)?xe:ue),this.commands.addCommand($.startCommand)):this.commands.removeCommand($.startCommand)},value:!1},enableLiveAutocompletion:{set:function(xe){xe?(this.completers||(this.completers=Array.isArray(xe)?xe:ue),this.commands.on("afterExec",ze)):this.commands.removeListener("afterExec",ze)},value:!1},enableSnippets:{set:function(xe){xe?(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$b=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),k=vue.computed({get(){return r.lang==="json"?JSON.stringify(r.modelValue,null,2):r.modelValue},set(V){r.lang==="json"?n("update:modelValue",JSON.parse(V)):n("update:modelValue",V)}});return(V,$)=>(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(k),"onUpdate:value":$[1]||($[1]=oe=>vue.isRef(k)?k.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$4={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$2={key:1},_sfc_main$a=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,(k,V)=>(vue.openBlock(),vue.createElementBlock("div",{key:V},[n.code?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(V))>78?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:String(V),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(V),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(V),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(k.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:k.val,placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$4,vue.toDisplayString(k.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$2,vue.toDisplayString(k.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),n.hide.indexOf(String(V))<0?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:k.title,size:"small"},{default:vue.withCtx(()=>[k.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElSelect),{key:0,modelValue:k.val,"onUpdate:modelValue":$=>k.val=$,placeholder:"Select",size:"small",disabled:!!(k!=null&&k.disabled)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(k.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"])):k.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(ElInputNumber),{key:1,modelValue:k.val,"onUpdate:modelValue":$=>k.val=$,disabled:!!(k!=null&&k.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):k.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:2,modelValue:k.val,"onUpdate:modelValue":$=>k.val=$,disabled:!!(k!=null&&k.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):k.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(ElColorPicker),{key:3,modelValue:k.val,"onUpdate:modelValue":$=>k.val=$,disabled:!!(k!=null&&k.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):k.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(ElSwitch),{key:4,modelValue:k.val,"onUpdate:modelValue":$=>k.val=$,disabled:!!(k!=null&&k.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):k.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$b,{key:5,modelValue:k.val,"onUpdate:modelValue":$=>k.val=$,disabled:!!(k!=null&&k.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_6c39ac5a_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc(_sfc_main$a,[["__scopeId","data-v-6c39ac5a"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$3=["onMouseenter","onClick"],_sfc_main$9=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:n}){const r=i,g=vue.ref(r.val),k=vue.ref(!1),V=vue.ref("进入"),$=vue.ref(null),oe=re=>{n("updateCommonAniVal",re),k.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=>k.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$i,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:Ce[2]||(Ce[2]=ie=>k.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(ElDrawer),{modelValue:vue.unref(k),"onUpdate:modelValue":Ce[5]||(Ce[5]=ie=>vue.isRef(k)?k.value=ie:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabs),{modelValue:vue.unref(V),"onUpdate:modelValue":Ce[4]||(Ce[4]=ie=>vue.isRef(V)?V.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$3))),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$9,[["__scopeId","data-v-2807ad45"]]),_sfc_main$8=vue.defineComponent({__name:"index",setup(i){var V;const n=useGlobalStore(pinia),r=vue.ref(((V=n.handle_svg_info)==null?void 0:V.info.id)||""),g=$=>{n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo($)},k={children:"children",label:"title"};return($,oe)=>(vue.openBlock(),vue.createBlock(vue.unref(ElTree),{data:vue.unref(n).done_json,props:k,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-c79cfc9b"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$1=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$7=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",$)}}),k=()=>{g.value.push({key:"",val:""})},V=$=>{g.value.splice($,1)};return($,oe)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$2,_hoisted_4$1,vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:k},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$i,{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=>V(Ce)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$i,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_c79cfc9b_lang="",List=_export_sfc(_sfc_main$7,[["__scopeId","data-v-c79cfc9b"]]),_hoisted_1$4={class:"c-wall-d"},_sfc_main$6=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",$)}}),k=[{label:"大于",val:"greater"},{label:"大于等于",val:">="},{label:"小于",val:"<"},{label:"小于等于",val:"<="},{label:"等于",val:"=="},{label:"不等于",val:"!="},{label:"介于",val:">=,=<"},{label:"不介于",val:"<,>"}],V=$=>{$!=="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:V},{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(k,(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$6,[["__scopeId","data-v-f43f10e6"]]),_withScopeId=i=>(vue.pushScopeId("data-v-94fe082a"),i=i(),vue.popScopeId(),i),_hoisted_1$3=_withScopeId(()=>vue.createElementVNode("span",{style:{"font-weight":"bold"}},"MQTT",-1)),_hoisted_2$2={class:"events-title"},_hoisted_3$1={key:1},_sfc_main$5=vue.defineComponent({__name:"index",setup(i){const n=useConfigStore(pinia),r=useGlobalStore(pinia),g=vue.ref("page"),k=vue.ref("style"),V=(ae,le)=>{ae!=null&&ae.common_animations&&(ae.common_animations.val=le)};n.$subscribe((ae,le)=>{ae.storeId==="config-store"&&localStorage.setItem("svg-editor-config",JSON.stringify(le))});const $=vue.ref(numberArray(20)),oe=vue.ref(["MQTT"]),re=vue.ref();re.value=()=>{var le,Ie;let ae={type:EEventType.Null,action:EEventAction.Null,target:"",scripts:"",condition:{type:EConditionType.None}};(Ie=(le=r.handle_svg_info)==null?void 0:le.info)==null||Ie.events.push(ae)};const Ce=(ae,le)=>{ae==="ChangeAttr"?le.attrs=[{key:"",val:""}]:delete le.attrs},ie=ae=>{var le,Ie;(Ie=(le=r.handle_svg_info)==null?void 0:le.info)==null||Ie.events.splice(ae,1)};return(ae,le)=>vue.unref(r).intention!=vue.unref(EGlobalStoreIntention).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:0,class:"mx-2 rightTabs",modelValue:vue.unref(g),"onUpdate:modelValue":le[11]||(le[11]=Ie=>vue.isRef(g)?g.value=Ie: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":le[0]||(le[0]=Ie=>vue.unref(n).svg.background_color=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(n).svg.position_center.x,"onUpdate:modelValue":le[1]||(le[1]=Ie=>vue.unref(n).svg.position_center.x=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(n).svg.position_center.y,"onUpdate:modelValue":le[2]||(le[2]=Ie=>vue.unref(n).svg.position_center.y=Ie)},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":le[3]||(le[3]=Ie=>vue.unref(n).svg.grid=Ie)},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":le[4]||(le[4]=Ie=>vue.unref(n).svg.ruler=Ie)},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":le[5]||(le[5]=Ie=>vue.unref(n).svg.scale=Ie),step:.1,"step-strictly":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"通信",name:"net"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(oe),"onUpdate:modelValue":le[10]||(le[10]=Ie=>vue.isRef(oe)?oe.value=Ie: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":le[6]||(le[6]=Ie=>vue.unref(n).net.mqtt.url=Ie),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":le[7]||(le[7]=Ie=>vue.unref(n).net.mqtt.user=Ie),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":le[8]||(le[8]=Ie=>vue.unref(n).net.mqtt.pwd=Ie),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":le[9]||(le[9]=Ie=>vue.unref(n).net.mqtt.topics=Ie),placeholder:"topics"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_: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(DynamicElFormItem,{"obj-info":vue.unref(n).connection_line.animations},null,8,["obj-info"])]),_:1})):vue.createCommentVNode("",!0)]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$8)]),_: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":le[24]||(le[24]=Ie=>vue.isRef(k)?k.value=Ie: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":le[12]||(le[12]=Ie=>vue.unref(r).handle_svg_info.info.title=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.x,"onUpdate:modelValue":le[13]||(le[13]=Ie=>vue.unref(r).handle_svg_info.info.x=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":le[14]||(le[14]=Ie=>vue.unref(r).handle_svg_info.info.y=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":le[15]||(le[15]=Ie=>vue.unref(r).handle_svg_info.info.display=Ie)},null,8,["modelValue"])]),_:1})]),_: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(re)},{default:vue.withCtx(()=>[vue.createTextVNode("添加事件")]),_:1},8,["onClick"]),vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref($),"onUpdate:modelValue":le[16]||(le[16]=Ie=>vue.isRef($)?$.value=Ie:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.events,(Ie,ue)=>(vue.openBlock(),vue.createBlock(vue.unref(ElCollapseItem),{name:ue,key:"event"+ue},{title:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$2,[vue.createElementVNode("span",null,"事件"+vue.toDisplayString(ue+1),1),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:vue.withModifiers(de=>ie(ue),["stop"])},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$i,{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:Ie.type,"onUpdate:modelValue":de=>Ie.type=de},{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:Ie.action,"onUpdate:modelValue":de=>Ie.action=de,onChange:de=>Ce(de,Ie)},{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),Ie.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"目标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:Ie.target,"onUpdate:modelValue":de=>Ie.target=de,placeholder:"默认自身"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),Ie.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(List,{key:1,modelValue:Ie.attrs,"onUpdate:modelValue":de=>Ie.attrs=de},null,8,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0),Ie.action==="JavaScript"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"JavaScript",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$b,{modelValue:Ie.scripts,"onUpdate:modelValue":de=>Ie.scripts=de,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:Ie.condition,"onUpdate:modelValue":de=>Ie.condition=de},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 Ie;return[(Ie=vue.unref(r).handle_svg_info)!=null&&Ie.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:le[17]||(le[17]=ue=>{var de;return V((de=vue.unref(r).handle_svg_info)==null?void 0:de.info,ue)}),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":le[18]||(le[18]=ue=>vue.unref(r).handle_svg_info.info.common_animations.delay=ue)},{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":le[19]||(le[19]=ue=>vue.unref(r).handle_svg_info.info.common_animations.speed=ue)},{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":le[20]||(le[20]=ue=>vue.unref(r).handle_svg_info.info.common_animations.repeat=ue)},{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:"data"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>{var Ie;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":le[21]||(le[21]=ue=>vue.unref(r).handle_svg_info.info.id=ue)},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,(ue,de)=>{var Ne;return vue.openBlock(),vue.createElementBlock("div",{key:"state"+String(de)},[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:String(de),size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(ue==null?void 0:ue.default),1)]),_:2},1032,["label"]),de==="OnOff"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:(Ne=vue.unref(r).handle_svg_info.info.state)==null?void 0:Ne.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":le[22]||(le[22]=he=>vue.unref(r).handle_svg_info.info.state.OnOff.default=he)},null,8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0)])}),128)):vue.createCommentVNode("",!0),(Ie=vue.unref(r).handle_svg_info.info)!=null&&Ie.hasOwnProperty("tag_slot")?(vue.openBlock(),vue.createElementBlock("div",_hoisted_3$1,[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":le[23]||(le[23]=ue=>vue.unref(r).handle_svg_info.info.tag_slot=ue)},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"])]}),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$8)]),_:1})]),_:1},8,["modelValue"])):vue.createCommentVNode("",!0)}}),index_vue_vue_type_style_index_0_scoped_94fe082a_lang="",index_vue_vue_type_style_index_1_lang="",RightPanel=_export_sfc(_sfc_main$5,[["__scopeId","data-v-94fe082a"]]),_sfc_main$4=vue.defineComponent({__name:"index",setup(i){const n=vue.ref(""),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),k=useConfigStore(pinia);return vue.onMounted(()=>{const V={layout_center:g.center_offset,config:k.$state,done_json:r.done_json};n.value=JSON.stringify(V,null,2)}),(V,$)=>(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:V=>{r.value=V},onImportJson:()=>{useImportDataModel(r.value)&&ElMessage.success("导入成功")}}),(V,$)=>(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"]))}}),_sfc_main$2=vue.defineComponent({name:"V3RulerComponent",props:{position:{type:String,default:"relative",validator:i=>["absolute","fixed","relative","static","inherit"].indexOf(i)!==-1},isHotKey:{type:Boolean,default:!0},isScaleRevise:{type:Boolean,default:!1},value:{type:Array,default:()=>[{type:"h",site:50},{type:"v",site:180}]},contentLayout:{type:Object,default:()=>({top:0,left:0})},parent:{type:Boolean,default:!1},visible:{type:Boolean,default:!0},stepLength:{type:Number,default:50,validator:i=>i%10===0}},emits:["input","update:visible"],setup(i,n){const r=useSvgEditLayoutStore(pinia),g=function(){return function(Ni,yi,wi){Ni&&yi&&wi&&Ni.addEventListener(yi,wi,!1)}}(),k=function(){return function(Ni,yi,wi){Ni&&yi&&Ni.removeEventListener(yi,wi,!1)}}(),V=17;let $=18,oe=vue.ref(0),re=vue.ref(0),Ce=vue.ref([{id:0}]),ie=vue.ref([{id:0}]),ae=0,le=0,Ie=vue.ref(!1),ue="",de=vue.ref(-999),Ne=vue.ref(-999),he=0,pe=0,ze="";const Fe=vue.ref(null),xe=vue.ref(null),_e=vue.ref(null),At=vue.ref(null),$e=vue.computed(()=>({width:oe.value+"px",height:re.value+"px",position:i.position})),Ue=vue.computed(()=>({left:i.contentLayout.left+"px",top:i.contentLayout.top+"px",padding:$+"px 0px 0px "+$+"px"})),Ve=vue.computed(()=>{let Ni=0,yi=0;return i.value.map(wi=>{const Ci=wi.type==="h";return{id:`${wi.type}_${Ci?Ni++:yi++}`,type:wi.type,title:wi.site.toFixed(2)+"px",[Ci?"top":"left"]:wi.site/(i.stepLength/50)+V}})});r.$subscribe(Ni=>{Ni.storeId==="svg-edit-layout-store"&&window.setTimeout(Oe,420)}),vue.onMounted(()=>{g(document,"mousemove",ri),g(document,"mouseup",ci),Oe(),g(window,"resize",Dt)}),vue.onBeforeUnmount(()=>{k(document,"mousemove",ri),k(document,"mouseup",ci),k(window,"resize",Dt)});const Oe=()=>{Lt(),ti()},Dt=()=>{Ce.value=[{id:0}],ie.value=[{id:0}],Oe()},qe=({type:Ni,top:yi,left:wi})=>Ni==="h"?{top:yi+"px"}:{left:wi+"px"},kt=({type:Ni,id:yi})=>Ni==="h"?hi(yi):Ai(yi),Lt=()=>{if(i.isScaleRevise){const Ni=Fe.value.offsetLeft,yi=Fe.value.offsetTop;Pt(Ce.value,Ni),Pt(ie.value,yi)}if(i.parent){const Ni=window.getComputedStyle(xe.value.parentNode,null);oe.value=parseInt(Ni.getPropertyValue("width"),10),re.value=parseInt(Ni.getPropertyValue("height"),10)}else oe.value=document.documentElement.clientWidth-le,re.value=document.documentElement.clientHeight-ae;he=_e.value.clientWidth,pe=At.value.clientHeight,jt()},jt=()=>{ae=At.value.getBoundingClientRect().y,le=_e.value.getBoundingClientRect().x},ti=()=>{ei(Ce.value,oe.value),ei(ie.value,re.value)},ei=(Ni,yi)=>{for(let wi=0;wi<yi*i.stepLength/50;wi+=i.stepLength)wi%i.stepLength===0&&wi!=0&&Ni.push({id:wi})},Pt=(Ni,yi)=>{for(let wi=0;wi<yi;wi+=1)wi%i.stepLength===0&&wi+i.stepLength<=yi&&Ni.push({id:wi})},ni=Ni=>{Ie.value=!0,ue=Ni},ri=Ni=>{switch(jt(),ue){case"x":Ie.value&&(Ne.value=Ni.pageY-ae);break;case"y":Ie.value&&(de.value=Ni.pageX-le);break;case"h":Ie.value&&(Ne.value=Ni.pageY-ae);break;case"v":Ie.value&&(de.value=Ni.pageX-le);break}},ci=Ni=>{if(jt(),Ie.value){Ie.value=!1;const yi=JSON.parse(JSON.stringify(i.value));switch(ue){case"x":yi.push({type:"h",site:(Ni.pageY-ae-V)*(i.stepLength/50)}),n.emit("input",yi);break;case"y":yi.push({type:"v",site:(Ni.pageX-le-V)*(i.stepLength/50)}),n.emit("input",yi);break;case"h":li(yi,Ni.pageY,ae,pe,"h"),n.emit("input",yi);break;case"v":li(yi,Ni.pageX,le,he,"v"),n.emit("input",yi);break}Ne.value=de.value=-10}},li=(Ni,yi,wi,Ci,zi)=>{if(yi-wi<Ci){let Mi;Ve.value.forEach((di,pi)=>{di.id===ze&&(Mi=pi)}),Ni.splice(Mi,1,{type:zi,site:-600})}else{let Mi;Ve.value.forEach((di,pi)=>{di.id===ze&&(Mi=pi)}),Ni.splice(Mi,1,{type:zi,site:(yi-wi-V)*(i.stepLength/50)})}},si=()=>{ni("x")},ui=()=>{ni("y")},hi=Ni=>{Ie.value=!0,ue="h",ze=Ni},Ai=Ni=>{Ie.value=!0,ue="v",ze=Ni};return{wrapperStyle:$e,horizontalDragRuler:si,xScale:Ce,verticalDragRuler:ui,yScale:ie,verticalDottedTop:Ne,horizontalDottedLeft:de,lineList:Ve,getLineStyle:qe,handleDragLine:kt,contentStyle:Ue,isDrag:Ie,content:Fe,el:xe,verticalRuler:_e,horizontalRuler:At}}}),index_vue_vue_type_style_index_0_lang="",_hoisted_1$2=["title","onMousedown"],_hoisted_2$1={class:"vue-ruler-content-mask"};function _sfc_render(i,n,r,g,k,V){return vue.openBlock(),vue.createElementBlock("div",{style:vue.normalizeStyle(i.wrapperStyle),class:"vue-ruler-wrapper",onselectStart:"return false;",ref:"el"},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref:"horizontalRuler",class:"vue-ruler-h",onMousedown:n[0]||(n[0]=vue.withModifiers((...$)=>i.horizontalDragRuler&&i.horizontalDragRuler(...$),["stop"]))},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.xScale,($,oe)=>(vue.openBlock(),vue.createElementBlock("span",{key:oe,style:vue.normalizeStyle({left:oe*50+2+"px"}),class:"n"},vue.toDisplayString($.id),5))),128))],544),vue.createElementVNode("div",{ref:"verticalRuler",class:"vue-ruler-v",onMousedown:n[1]||(n[1]=vue.withModifiers((...$)=>i.verticalDragRuler&&i.verticalDragRuler(...$),["stop"]))},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.yScale,($,oe)=>(vue.openBlock(),vue.createElementBlock("span",{key:oe,style:vue.normalizeStyle({top:oe*50+2+"px"}),class:"n"},vue.toDisplayString($.id),5))),128))],544),vue.createElementVNode("div",{style:vue.normalizeStyle({top:i.verticalDottedTop+"px"}),class:"vue-ruler-ref-dot-h"},null,4),vue.createElementVNode("div",{style:vue.normalizeStyle({left:i.horizontalDottedLeft+"px"}),class:"vue-ruler-ref-dot-v"},null,4),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.lineList,$=>(vue.openBlock(),vue.createElementBlock("div",{title:$.title,style:vue.normalizeStyle(i.getLineStyle($)),key:$.id,class:vue.normalizeClass(`vue-ruler-ref-line-${$.type}`),onMousedown:oe=>i.handleDragLine($)},null,46,_hoisted_1$2))),128))],512),[[vue.vShow,i.$props.visible]]),vue.createElementVNode("div",{ref:"content",class:"vue-ruler-content",style:vue.normalizeStyle(i.contentStyle)},[vue.renderSlot(i.$slots,"default")],4),vue.withDirectives(vue.createElementVNode("div",_hoisted_2$1,null,512),[[vue.vShow,i.isDrag]])],4)}const Vue3RulerTool=_export_sfc(_sfc_main$2,[["render",_sfc_render]]);function fileWrite(i,n=new Date(Date.now()).toLocaleString()){const r=JSON.stringify(i),g=new Blob([r]);let k=document.createElement("a");k.download=n+".json",k.style.display="none",k.href=URL.createObjectURL(g),document.body.appendChild(k),k.click(),document.body.removeChild(k)}function fileRead(i){return new Promise((n,r)=>{let g=new FileReader;g.readAsText(i,"UTF-8"),g.onload=function(k){k&&k.target?n(k.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,k=vue.ref([]),V=he=>{k.value=he},$=useGlobalStore(pinia),oe=useSvgEditLayoutStore(pinia),re=useConfigStore(pinia),Ce=vue.ref(),ie=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),ae=(he,pe)=>{ie[he]=pe},le=vue.ref();le.value=()=>{Ce.value.onImportJson(),ae(EVisibleConfKey.ImportJson,!1)};const Ie=he=>["text/plain","application/json"].indexOf(he.type)<0?(ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(he).then(pe=>{Ce.value.setVal(pe),ElMessage.success("文件读取成功!")}),!1),ue=he=>{$.setDoneJson(he)};vue.onMounted(()=>{g.data?useImportDataModel(g.data):$.setDoneJson([]),$.intention=EGlobalStoreIntention.None}),n({setGraphNodeJson:ue});const{appContext:de}=vue.getCurrentInstance();function Ne(he){g.saveFile?ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},de).then(pe=>{fileWrite(he,pe.value.trim()),r("onSave",he)}).catch(pe=>{console.log(pe)}):r("onSave",he)}return(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:ae,onOnReturn:pe[0]||(pe[0]=ze=>r("onReturn")),onOnPreview:pe[1]||(pe[1]=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(oe).left_nav?"show-nav":"hide-nav"])},{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(Vue3RulerTool,{class:"canvas-main-pc",value:vue.unref(k),"step-length":50,parent:!0,"is-scale-revise":!1,visible:vue.unref(re).svg.ruler,"onUpdate:visible":pe[2]||(pe[2]=ze=>vue.unref(re).svg.ruler=ze),onInput:V},{default:vue.withCtx(()=>[vue.createVNode(CenterPanel)]),_:1},8,["value","visible"])])]),_:1}),vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(oe).right_nav?"show-nav":"hide-nav"])},{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(ie).ImportJson,"onUpdate:modelValue":pe[4]||(pe[4]=ze=>vue.unref(ie).ImportJson=ze),title:"导入数据",width:"60%","destroy-on-close":""},{footer:vue.withCtx(()=>[vue.createVNode(vue.unref(ElUpload),{beforeUpload:Ie,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[3]||(pe[3]=ze=>ae(vue.unref(EVisibleConfKey).ImportFile,!0))},{default:vue.withCtx(()=>[vue.createTextVNode("读取文件")]),_:1})]),_:1}),vue.createVNode(vue.unref(ElButton),{type:"primary",onClick:vue.unref(le)},{default:vue.withCtx(()=>[vue.createTextVNode("导入数据")]),_:1},8,["onClick"])]),default:vue.withCtx(()=>[vue.createVNode(_sfc_main$3,{ref_key:"importJsonRef",ref:Ce},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(ie).ExportJson,"onUpdate:modelValue":pe[5]||(pe[5]=ze=>vue.unref(ie).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_239c472b_lang="",index$1=_export_sfc(_sfc_main$1,[["__scopeId","data-v-239c472b"]]);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,k,V){function $(Ce,ie){if(!k[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=k[Ce]={exports:{}};g[Ce][0].call(Ie.exports,function(ue){var de=g[Ce][1][ue];return $(de||ue)},Ie,Ie.exports,r,g,k,V)}return k[Ce].exports}for(var oe=typeof commonjsRequire=="function"&&commonjsRequire,re=0;re<V.length;re++)$(V[re]);return $}return r}()({1:[function(r,g,k){(function(V,$){(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"),Fe=V?V.nextTick:function(ei){setTimeout(ei,0)},xe=$.setImmediate||function(ei){Fe(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 Ue(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function Ve(ei,Pt){if(ei.options.protocolVersion===5&&Pt.cmd==="publish"){let ni;Pt.properties&&(ni=Pt.properties.topicAlias);const ri=Pt.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?(Pt.topic="",Pt.properties={...Pt.properties,topicAlias:ni},ze("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",ri,ni)):(ni=ei.topicAliasSend.getLruAlias(),ei.topicAliasSend.put(ri,ni),Pt.properties={...Pt.properties,topicAlias:ni},ze("applyTopicAlias :: auto assign topic: %s - alias: %d",ri,ni))):ei.options.autoUseTopicAlias&&(ni=ei.topicAliasSend.getAliasByTopic(ri),ni&&(Pt.topic="",Pt.properties={...Pt.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 Oe(ei,Pt){let ni;Pt.properties&&(ni=Pt.properties.topicAlias);let ri=Pt.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");Pt.topic=ri}ni&&delete Pt.properties.topicAlias}function Dt(ei,Pt,ni){ze("sendPacket :: packet: %O",Pt),ze("sendPacket :: emitting `packetsend`"),ei.emit("packetsend",Pt),ze("sendPacket :: writing to stream");const ri=ae.writeToStream(Pt,ei.stream,ei.options);ze("sendPacket :: writeToStream result %s",ri),!ri&&ni&&ni!==jt?(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(Pt){typeof ei[Pt].cb=="function"&&(ei[Pt].cb(new Error("Connection closed")),delete ei[Pt])}))}function kt(ei){ei&&(ze("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(ei).forEach(function(Pt){ei[Pt].volatile&&typeof ei[Pt].cb=="function"&&(ei[Pt].cb(new Error("Connection closed")),delete ei[Pt])}))}function Lt(ei,Pt,ni,ri){ze("storeAndSend :: store packet with cmd %s to outgoingStore",Pt.cmd);let ci=Pt,li;if(ci.cmd==="publish"&&(ci=Ne(Pt),li=Oe(ei,ci),li))return ni&&ni(li);ei.outgoingStore.put(ci,function(ui){if(ui)return ni&&ni(ui);ri(),Dt(ei,Pt,ni)})}function jt(ei){ze("nop ::",ei)}function ti(ei,Pt){let ni;const ri=this;if(!(this instanceof ti))return new ti(ei,Pt);this.options=Pt||{};for(ni in _e)typeof this.options[ni]>"u"?this.options[ni]=_e[ni]:this.options[ni]=Pt[ni];ze("MqttClient :: options.protocol",Pt.protocol),ze("MqttClient :: options.protocolVersion",Pt.protocolVersion),ze("MqttClient :: options.username",Pt.username),ze("MqttClient :: options.keepalive",Pt.keepalive),ze("MqttClient :: options.reconnectPeriod",Pt.reconnectPeriod),ze("MqttClient :: options.rejectUnauthorized",Pt.rejectUnauthorized),ze("MqttClient :: options.topicAliasMaximum",Pt.topicAliasMaximum),this.options.clientId=typeof Pt.clientId=="string"?Pt.clientId:Ue(),ze("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=Pt.protocolVersion===5&&Pt.customHandleAcks?Pt.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=ei,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new le:this.options.messageIdProvider,this.outgoingStore=Pt.outgoingStore||new re,this.incomingStore=Pt.incomingStore||new re,this.queueQoSZero=Pt.queueQoSZero===void 0?!0:Pt.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,Pt.topicAliasMaximum>0&&(Pt.topicAliasMaximum>65535?ze("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new Ce(Pt.topicAliasMaximum)),this.on("connect",function(){const ci=this.queue;function li(){const si=ci.shift();ze("deliver :: entry %o",si);let ui=null;if(!si){ri._resubscribe();return}ui=si.packet,ze("deliver :: call _sendPacket for %o",ui);let hi=!0;ui.messageId&&ui.messageId!==0&&(ri.messageIdProvider.register(ui.messageId)||(hi=!1)),hi?ri._sendPacket(ui,function(Ai){si.cb&&si.cb(Ai),li()}):(ze("messageId: %d has already used. The message is skipped and removed.",ui.messageId),li())}ze("connect :: sending queued packets"),li()}),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,Pt=new Ie,ni=ae.parser(this.options);let ri=null;const ci=[];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(Ai){ze("parser :: on packet push to packets array."),ci.push(Ai)});function li(){if(ci.length)Fe(si);else{const Ai=ri;ri=null,Ai()}}function si(){ze("work :: getting next packet in queue");const Ai=ci.shift();if(Ai)ze("work :: packet pulled from queue"),ei._handlePacket(Ai,li);else{ze("work :: no packets in queue");const Ni=ri;ri=null,ze("work :: done flag is %s",!!Ni),Ni&&Ni()}}Pt._write=function(Ai,Ni,yi){ri=yi,ze("writable stream :: parsing buffer"),ni.parse(Ai),si()};function ui(Ai){ze("streamErrorHandler :: error",Ai.message),At.includes(Ai.code)?(ze("streamErrorHandler :: emitting error"),ei.emit("error",Ai)):jt(Ai)}ze("_setupStream :: pipe stream to writable stream"),this.stream.pipe(Pt),this.stream.on("error",ui),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 Ai=pe({cmd:"auth",reasonCode:0},this.options.authPacket);Dt(this,Ai)}}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,Pt){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,Pt);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(ei),Pt();break;case"pubrel":this._handlePubrel(ei,Pt);break;case"connack":this._handleConnack(ei),Pt();break;case"auth":this._handleAuth(ei),Pt();break;case"pingresp":this._handlePingresp(ei),Pt();break;case"disconnect":this._handleDisconnect(ei),Pt();break}},ti.prototype._checkDisconnecting=function(ei){return this.disconnecting&&(ei&&ei!==jt?ei(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},ti.prototype.publish=function(ei,Pt,ni,ri){ze("publish :: message `%s` to topic `%s`",Pt,ei);const ci=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 si=this,ui=function(){let hi=0;if((ni.qos===1||ni.qos===2)&&(hi=si._nextId(),hi===null))return ze("No messageId left"),!1;const Ai={cmd:"publish",topic:ei,payload:Pt,qos:ni.qos,retain:ni.retain,messageId:hi,dup:ni.dup};switch(ci.protocolVersion===5&&(Ai.properties=ni.properties),ze("publish :: qos",ni.qos),ni.qos){case 1:case 2:si.outgoing[Ai.messageId]={volatile:!1,cb:ri||jt},ze("MqttClient:publish: packet cmd: %s",Ai.cmd),si._sendPacket(Ai,void 0,ni.cbStorePut);break;default:ze("MqttClient:publish: packet cmd: %s",Ai.cmd),si._sendPacket(Ai,ri,ni.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ui())&&this._storeProcessingQueue.push({invoke:ui,cbStorePut:ni.cbStorePut,callback:ri}),this},ti.prototype.subscribe=function(){const ei=this,Pt=new Array(arguments.length);for(let yi=0;yi<arguments.length;yi++)Pt[yi]=arguments[yi];const ni=[];let ri=Pt.shift();const ci=ri.resubscribe;let li=Pt.pop()||jt,si=Pt.pop();const ui=this.options.protocolVersion;delete ri.resubscribe,typeof ri=="string"&&(ri=[ri]),typeof li!="function"&&(si=li,li=jt);const hi=he.validateTopics(ri);if(hi!==null)return xe(li,new Error("Invalid topic "+hi)),this;if(this._checkDisconnecting(li))return ze("subscribe: discconecting true"),this;const Ai={qos:0};if(ui===5&&(Ai.nl=!1,Ai.rap=!1,Ai.rh=0),si=pe(Ai,si),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<si.qos||ci){const wi={topic:yi,qos:si.qos};ui===5&&(wi.nl=si.nl,wi.rap=si.rap,wi.rh=si.rh,wi.properties=si.properties),ze("subscribe: pushing topic `%s` and qos `%s` to subs list",wi.topic,wi.qos),ni.push(wi)}}):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||ci){const wi={topic:yi,qos:ri[yi].qos};ui===5&&(wi.nl=ri[yi].nl,wi.rap=ri[yi].rap,wi.rh=ri[yi].rh,wi.properties=si.properties),ze("subscribe: pushing `%s` to subs list",wi),ni.push(wi)}}),!ni.length)return li(null,[]),this;const Ni=function(){const yi=ei._nextId();if(yi===null)return ze("No messageId left"),!1;const wi={cmd:"subscribe",subscriptions:ni,qos:1,retain:!1,dup:!1,messageId:yi};if(si.properties&&(wi.properties=si.properties),ei.options.resubscribe){ze("subscribe :: resubscribe true");const Ci=[];ni.forEach(function(zi){if(ei.options.reconnectPeriod>0){const Mi={qos:zi.qos};ui===5&&(Mi.nl=zi.nl||!1,Mi.rap=zi.rap||!1,Mi.rh=zi.rh||0,Mi.properties=zi.properties),ei._resubscribeTopics[zi.topic]=Mi,Ci.push(zi.topic)}}),ei.messageIdToTopic[wi.messageId]=Ci}return ei.outgoing[wi.messageId]={volatile:!0,cb:function(Ci,zi){if(!Ci){const Mi=zi.granted;for(let di=0;di<Mi.length;di+=1)ni[di].qos=Mi[di]}li(Ci,ni)}},ze("subscribe :: call _sendPacket"),ei._sendPacket(wi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Ni())&&this._storeProcessingQueue.push({invoke:Ni,callback:li}),this},ti.prototype.unsubscribe=function(){const ei=this,Pt=new Array(arguments.length);for(let ui=0;ui<arguments.length;ui++)Pt[ui]=arguments[ui];let ni=Pt.shift(),ri=Pt.pop()||jt,ci=Pt.pop();typeof ni=="string"&&(ni=[ni]),typeof ri!="function"&&(ci=ri,ri=jt);const li=he.validateTopics(ni);if(li!==null)return xe(ri,new Error("Invalid topic "+li)),this;if(ei._checkDisconnecting(ri))return this;const si=function(){const ui=ei._nextId();if(ui===null)return ze("No messageId left"),!1;const hi={cmd:"unsubscribe",qos:1,messageId:ui};return typeof ni=="string"?hi.unsubscriptions=[ni]:Array.isArray(ni)&&(hi.unsubscriptions=ni),ei.options.resubscribe&&hi.unsubscriptions.forEach(function(Ai){delete ei._resubscribeTopics[Ai]}),typeof ci=="object"&&ci.properties&&(hi.properties=ci.properties),ei.outgoing[hi.messageId]={volatile:!0,cb:ri},ze("unsubscribe: call _sendPacket"),ei._sendPacket(hi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!si())&&this._storeProcessingQueue.push({invoke:si,callback:ri}),this},ti.prototype.end=function(ei,Pt,ni){const ri=this;ze("end :: (%s)",this.options.clientId),(ei==null||typeof ei!="boolean")&&(ni=Pt||jt,Pt=ei,ei=!1,typeof Pt!="object"&&(ni=Pt,Pt=null,typeof ni!="function"&&(ni=jt))),typeof Pt!="object"&&(ni=Pt,Pt=null),ze("end :: cb? %s",!!ni),ni=ni||jt;function ci(){ze("end :: closeStores: closing incoming and outgoing stores"),ri.disconnected=!0,ri.incomingStore.close(function(si){ri.outgoingStore.close(function(ui){if(ze("end :: closeStores: emitting end"),ri.emit("end"),ni){const hi=si||ui;ze("end :: closeStores: invoking callback with args"),ni(hi)}})}),ri._deferredReconnect&&ri._deferredReconnect()}function li(){ze("end :: (%s) :: finish :: calling _cleanUp with force %s",ri.options.clientId,ei),ri._cleanUp(ei,()=>{ze("end :: finish :: calling process.nextTick on closeStores"),Fe(ci.bind(ri))},Pt)}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,li,10))):(ze("end :: (%s) :: immediately calling finish",ri.options.clientId),li()),this)},ti.prototype.removeOutgoingMessage=function(ei){const Pt=this.outgoing[ei]?this.outgoing[ei].cb:null;return delete this.outgoing[ei],this.outgoingStore.del({messageId:ei},function(){Pt(new Error("Message removed"))}),this},ti.prototype.reconnect=function(ei){ze("client reconnect");const Pt=this,ni=function(){ei?(Pt.options.incomingStore=ei.incomingStore,Pt.options.outgoingStore=ei.outgoingStore):(Pt.options.incomingStore=null,Pt.options.outgoingStore=null),Pt.incomingStore=Pt.options.incomingStore||new re,Pt.outgoingStore=Pt.options.outgoingStore||new re,Pt.disconnecting=!1,Pt.disconnected=!1,Pt._deferredReconnect=null,Pt._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,Pt){const ni=arguments[2];if(Pt&&(ze("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",Pt)),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,xe.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),Pt&&!this.connected&&(ze("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",Pt),Pt())},ti.prototype._sendPacket=function(ei,Pt,ni){ze("_sendPacket :: (%s) :: start",this.options.clientId),ni=ni||jt,Pt=Pt||jt;const ri=Ve(this,ei);if(ri){Pt(ri);return}if(!this.connected){if(ei.cmd==="auth"){this._shiftPingInterval(),Dt(this,ei,Pt);return}ze("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(ei,Pt,ni);return}switch(this._shiftPingInterval(),ei.cmd){case"publish":break;case"pubrel":Lt(this,ei,Pt,ni);return;default:Dt(this,ei,Pt);return}switch(ei.qos){case 2:case 1:Lt(this,ei,Pt,ni);break;case 0:default:Dt(this,ei,Pt);break}ze("_sendPacket :: (%s) :: end",this.options.clientId)},ti.prototype._storePacket=function(ei,Pt,ni){ze("_storePacket :: packet: %o",ei),ze("_storePacket :: cb? %s",!!Pt),ni=ni||jt;let ri=ei;if(ri.cmd==="publish"){ri=Ne(ei);const ci=Oe(this,ri);if(ci)return Pt&&Pt(ci)}(ri.qos||0)===0&&this.queueQoSZero||ri.cmd!=="publish"?this.queue.push({packet:ri,cb:Pt}):ri.qos>0?(Pt=this.outgoing[ri.messageId]?this.outgoing[ri.messageId].cb:null,this.outgoingStore.put(ri,function(ci){if(ci)return Pt&&Pt(ci);ni()})):Pt&&Pt(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 Pt=this.options,ri=Pt.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&&Pt.keepalive&&(Pt.keepalive=ei.properties.serverKeepAlive,this._shiftPingInterval()),ei.properties.maximumPacketSize&&(Pt.properties||(Pt.properties={}),Pt.properties.maximumPacketSize=ei.properties.maximumPacketSize)}if(ri===0)this.reconnecting=!1,this._onConnect(ei);else if(ri>0){const ci=new Error("Connection refused: "+$e[ri]);ci.code=ri,this.emit("error",ci)}},ti.prototype._handleAuth=function(ei){const ni=this.options.protocolVersion,ri=ni===5?ei.reasonCode:ei.returnCode;if(ni!==5){const li=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+ni);li.code=ri,this.emit("error",li);return}const ci=this;this.handleAuth(ei,function(li,si){if(li){ci.emit("error",li);return}if(ri===24)ci.reconnecting=!1,ci._sendPacket(si);else{const ui=new Error("Connection refused: "+$e[ri]);li.code=ri,ci.emit("error",ui)}})},ti.prototype.handleAuth=function(ei,Pt){Pt()},ti.prototype._handlePublish=function(ei,Pt){ze("_handlePublish: packet %o",ei),Pt=typeof Pt<"u"?Pt:jt;let ni=ei.topic.toString();const ri=ei.payload,ci=ei.qos,li=ei.messageId,si=this,ui=this.options,hi=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let Ai;if(ei.properties&&(Ai=ei.properties.topicAlias),typeof Ai<"u")if(ni.length===0)if(Ai>0&&Ai<=65535){const Ni=this.topicAliasRecv.getTopicByAlias(Ai);if(Ni)ni=Ni,ze("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",ni,Ai);else{ze("_handlePublish :: unregistered topic alias. alias: %d",Ai),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{ze("_handlePublish :: topic alias out of range. alias: %d",Ai),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(ni,Ai))ze("_handlePublish :: registered topic: %s - alias: %d",ni,Ai);else{ze("_handlePublish :: topic alias out of range. alias: %d",Ai),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(ze("_handlePublish: qos %d",ci),ci){case 2:{ui.customHandleAcks(ni,ri,ei,function(Ai,Ni){if(Ai instanceof Error||(Ni=Ai,Ai=null),Ai)return si.emit("error",Ai);if(hi.indexOf(Ni)===-1)return si.emit("error",new Error("Wrong reason code for pubrec"));Ni?si._sendPacket({cmd:"pubrec",messageId:li,reasonCode:Ni},Pt):si.incomingStore.put(ei,function(){si._sendPacket({cmd:"pubrec",messageId:li},Pt)})});break}case 1:{ui.customHandleAcks(ni,ri,ei,function(Ai,Ni){if(Ai instanceof Error||(Ni=Ai,Ai=null),Ai)return si.emit("error",Ai);if(hi.indexOf(Ni)===-1)return si.emit("error",new Error("Wrong reason code for puback"));Ni||si.emit("message",ni,ri,ei),si.handleMessage(ei,function(yi){if(yi)return Pt&&Pt(yi);si._sendPacket({cmd:"puback",messageId:li,reasonCode:Ni},Pt)})});break}case 0:this.emit("message",ni,ri,ei),this.handleMessage(ei,Pt);break;default:ze("_handlePublish: unknown QoS. Doing nothing.");break}},ti.prototype.handleMessage=function(ei,Pt){Pt()},ti.prototype._handleAck=function(ei){const Pt=ei.messageId,ni=ei.cmd;let ri=null;const ci=this.outgoing[Pt]?this.outgoing[Pt].cb:null,li=this;let si;if(!ci){ze("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(ze("_handleAck :: packet type",ni),ni){case"pubcomp":case"puback":{const ui=ei.reasonCode;ui&&ui>0&&ui!==16&&(si=new Error("Publish error: "+$e[ui]),si.code=ui,ci(si,ei)),delete this.outgoing[Pt],this.outgoingStore.del(ei,ci),this.messageIdProvider.deallocate(Pt),this._invokeStoreProcessingQueue();break}case"pubrec":{ri={cmd:"pubrel",qos:2,messageId:Pt};const ui=ei.reasonCode;ui&&ui>0&&ui!==16?(si=new Error("Publish error: "+$e[ui]),si.code=ui,ci(si,ei)):this._sendPacket(ri);break}case"suback":{delete this.outgoing[Pt],this.messageIdProvider.deallocate(Pt);for(let ui=0;ui<ei.granted.length;ui++)if(ei.granted[ui]&128){const hi=this.messageIdToTopic[Pt];hi&&hi.forEach(function(Ai){delete li._resubscribeTopics[Ai]})}this._invokeStoreProcessingQueue(),ci(null,ei);break}case"unsuback":{delete this.outgoing[Pt],this.messageIdProvider.deallocate(Pt),this._invokeStoreProcessingQueue(),ci(null);break}default:li.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},ti.prototype._handlePubrel=function(ei,Pt){ze("handling pubrel packet"),Pt=typeof Pt<"u"?Pt:jt;const ni=ei.messageId,ri=this,ci={cmd:"pubcomp",messageId:ni};ri.incomingStore.get(ei,function(li,si){li?ri._sendPacket(ci,Pt):(ri.emit("message",si.topic,si.payload,si),ri.handleMessage(si,function(ui){if(ui)return Pt(ui);ri.incomingStore.del(si,jt),ri._sendPacket(ci,Pt)}))})},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 Pt=0;Pt<ei.length;Pt++){const ni={};ni[ei[Pt]]=this._resubscribeTopics[ei[Pt]],ni.resubscribe=!0,this.subscribe(ni,{properties:ni[ei[Pt]].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 Pt=this;this.connackPacket=ei,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function ni(){let ri=Pt.outgoingStore.createStream();function ci(){Pt._storeProcessing=!1,Pt._packetIdsDuringStoreProcessing={}}Pt.once("close",li),ri.on("error",function(ui){ci(),Pt._flushStoreProcessingQueue(),Pt.removeListener("close",li),Pt.emit("error",ui)});function li(){ri.destroy(),ri=null,Pt._flushStoreProcessingQueue(),ci()}function si(){if(!ri)return;Pt._storeProcessing=!0;const ui=ri.read(1);let hi;if(!ui){ri.once("readable",si);return}if(Pt._packetIdsDuringStoreProcessing[ui.messageId]){si();return}!Pt.disconnecting&&!Pt.reconnectTimer?(hi=Pt.outgoing[ui.messageId]?Pt.outgoing[ui.messageId].cb:null,Pt.outgoing[ui.messageId]={volatile:!1,cb:function(Ai,Ni){hi&&hi(Ai,Ni),si()}},Pt._packetIdsDuringStoreProcessing[ui.messageId]=!0,Pt.messageIdProvider.register(ui.messageId)?Pt._sendPacket(ui):ze("messageId: %d has already used.",ui.messageId)):ri.destroy&&ri.destroy()}ri.on("end",function(){let ui=!0;for(const hi in Pt._packetIdsDuringStoreProcessing)if(!Pt._packetIdsDuringStoreProcessing[hi]){ui=!1;break}ui?(ci(),Pt.removeListener("close",li),Pt._invokeAllStoreProcessingQueue(),Pt.emit("connect",ei)):ni()}),si()}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,k){const{Buffer:V}=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,Fe){re.sendSocketMessage({data:pe.buffer,success:function(){Fe()},fail:function(){Fe(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 Fe=ze+"://"+he.hostname+he.path;return he.port&&he.port!==80&&he.port!==443&&(Fe=ze+"://"+he.hostname+":"+he.port+he.path),typeof he.transformWsUrl=="function"&&(Fe=he.transformWsUrl(Fe,he,pe)),Fe}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=V.from(he.data,"base64");Ce.push(pe)}else{const pe=new FileReader;pe.addEventListener("load",function(){let ze=pe.result;ze instanceof ArrayBuffer?ze=V.from(ze):ze=V.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 Fe=ue(pe,he);return re=pe.my,re.connectSocket({url:Fe,protocols:ze}),Ce=le(),ie=oe.obj(),de(),ie}g.exports=Ne},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(r,g,k){const V=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),V.createConnection(ie,ae)}g.exports=oe},{debug:18,net:16}],4:[function(r,g,k){const V=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=V.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,k){(function(V){(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 V<"u"&&V.title==="browser"||typeof __webpack_require__=="function";function Ie(Fe,xe){let _e=Fe.protocol+"://"+Fe.hostname+":"+Fe.port+Fe.path;return typeof Fe.transformWsUrl=="function"&&(_e=Fe.transformWsUrl(_e,Fe,xe)),_e}function ue(Fe){const xe=Fe;return Fe.hostname||(xe.hostname="localhost"),Fe.port||(Fe.protocol==="wss"?xe.port=443:xe.port=80),Fe.path||(xe.path="/"),Fe.wsOptions||(xe.wsOptions={}),!le&&Fe.protocol==="wss"&&ae.forEach(function(_e){Object.prototype.hasOwnProperty.call(Fe,_e)&&!Object.prototype.hasOwnProperty.call(Fe.wsOptions,_e)&&(xe.wsOptions[_e]=Fe[_e])}),xe}function de(Fe){const xe=ue(Fe);if(xe.hostname||(xe.hostname=xe.host),!xe.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const _e=new URL(document.URL);xe.hostname=_e.hostname,xe.port||(xe.port=_e.port)}return xe.objectMode===void 0&&(xe.objectMode=!(xe.binary===!0||xe.binary===void 0)),xe}function Ne(Fe,xe,_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: "+xe+" and protocol: "+At),new oe(xe,[At],_e.wsOptions)}function he(Fe,xe){const _e=xe.protocolId==="MQIsdp"&&xe.protocolVersion===3?"mqttv3.1":"mqtt",At=Ie(xe,Fe),$e=new WebSocket(At,[_e]);return $e.binaryType="arraybuffer",$e}function pe(Fe,xe){re("streamBuilder");const _e=ue(xe),At=Ie(_e,Fe),$e=Ne(Fe,At,_e),Ue=oe.createWebSocketStream($e,_e.wsOptions);return Ue.url=At,$e.on("close",()=>{Ue.destroy()}),Ue}function ze(Fe,xe){re("browserStreamBuilder");let _e;const $e=de(xe).browserBufferSize||1024*512,Ue=xe.browserBufferTimeout||1e3,Ve=!xe.objectMode,Oe=he(Fe,xe),Dt=kt(xe,ni,ri);xe.objectMode||(Dt._writev=Pt),Dt.on("close",()=>{Oe.close()});const qe=typeof Oe.addEventListener<"u";Oe.readyState===Oe.OPEN?_e=Dt:(_e=_e=Ce(void 0,void 0,xe),xe.objectMode||(_e._writev=Pt),qe?Oe.addEventListener("open",Lt):Oe.onopen=Lt),_e.socket=Oe,qe?(Oe.addEventListener("close",jt),Oe.addEventListener("error",ti),Oe.addEventListener("message",ei)):(Oe.onclose=jt,Oe.onerror=ti,Oe.onmessage=ei);function kt(ci,li,si){const ui=new ie({objectModeMode:ci.objectMode});return ui._write=li,ui._flush=si,ui}function Lt(){_e.setReadable(Dt),_e.setWritable(Dt),_e.emit("connect")}function jt(){_e.end(),_e.destroy()}function ti(ci){_e.destroy(ci)}function ei(ci){let li=ci.data;li instanceof ArrayBuffer?li=$.from(li):li=$.from(li,"utf8"),Dt.push(li)}function Pt(ci,li){const si=new Array(ci.length);for(let ui=0;ui<ci.length;ui++)typeof ci[ui].chunk=="string"?si[ui]=$.from(ci[ui],"utf8"):si[ui]=ci[ui].chunk;this._write($.concat(si),"binary",li)}function ni(ci,li,si){Oe.bufferedAmount>$e&&setTimeout(ni,Ue,ci,li,si),Ve&&typeof ci=="string"&&(ci=$.from(ci,"utf8"));try{Oe.send(ci)}catch(ui){return si(ui)}si()}function ri(ci){Oe.close(),ci()}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,k){const{Buffer:V}=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(Fe){ze(new Error(Fe))}})},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=V.from(he):he=V.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(xe,_e){re.close({success:function(){_e&&_e(xe)}})};const Fe=ie.destroy;return ie.destroy=function(){ie.destroy=Fe;const xe=this;setTimeout(function(){re.close({fail:function(){xe._destroy(new Error)}})},0)}.bind(ie),ue(),ie}g.exports=de},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(r,g,k){function V(){if(!(this instanceof V))return new V;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}V.prototype.allocate=function(){const $=this.nextId++;return this.nextId===65536&&(this.nextId=1),$},V.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},V.prototype.register=function($){return!0},V.prototype.deallocate=function($){},V.prototype.clear=function(){},g.exports=V},{}],8:[function(r,g,k){const V=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=V(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,k){function V($){if(!(this instanceof V))return new V($);this.aliasToTopic={},this.max=$}V.prototype.put=function($,oe){return oe===0||oe>this.max?!1:(this.aliasToTopic[oe]=$,this.length=Object.keys(this.aliasToTopic).length,!0)},V.prototype.getTopicByAlias=function($){return this.aliasToTopic[$]},V.prototype.clear=function(){this.aliasToTopic={}},g.exports=V},{}],10:[function(r,g,k){const V=r("lru-cache"),$=r("number-allocator").NumberAllocator;function oe(re){if(!(this instanceof oe))return new oe(re);re>0&&(this.aliasToTopic=new V({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,k){function V(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(!V(oe[re]))return oe[re];return null}g.exports={validateTopics:$}},{}],12:[function(r,g,k){(function(V){(function(){const $=r("../client"),oe=r("../store"),re=r("url"),Ce=r("xtend"),ie=r("debug")("mqttjs"),ae={};typeof V<"u"&&V.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,Fe){return pe&&Fe%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,k){k.byteLength=le,k.toByteArray=ue,k.fromByteArray=he;for(var V=[],$=[],oe=typeof Uint8Array<"u"?Uint8Array:Array,re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ce=0,ie=re.length;Ce<ie;++Ce)V[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 Fe=pe.indexOf("=");Fe===-1&&(Fe=ze);var xe=Fe===ze?0:4-Fe%4;return[Fe,xe]}function le(pe){var ze=ae(pe),Fe=ze[0],xe=ze[1];return(Fe+xe)*3/4-xe}function Ie(pe,ze,Fe){return(ze+Fe)*3/4-Fe}function ue(pe){var ze,Fe=ae(pe),xe=Fe[0],_e=Fe[1],At=new oe(Ie(pe,xe,_e)),$e=0,Ue=_e>0?xe-4:xe,Ve;for(Ve=0;Ve<Ue;Ve+=4)ze=$[pe.charCodeAt(Ve)]<<18|$[pe.charCodeAt(Ve+1)]<<12|$[pe.charCodeAt(Ve+2)]<<6|$[pe.charCodeAt(Ve+3)],At[$e++]=ze>>16&255,At[$e++]=ze>>8&255,At[$e++]=ze&255;return _e===2&&(ze=$[pe.charCodeAt(Ve)]<<2|$[pe.charCodeAt(Ve+1)]>>4,At[$e++]=ze&255),_e===1&&(ze=$[pe.charCodeAt(Ve)]<<10|$[pe.charCodeAt(Ve+1)]<<4|$[pe.charCodeAt(Ve+2)]>>2,At[$e++]=ze>>8&255,At[$e++]=ze&255),At}function de(pe){return V[pe>>18&63]+V[pe>>12&63]+V[pe>>6&63]+V[pe&63]}function Ne(pe,ze,Fe){for(var xe,_e=[],At=ze;At<Fe;At+=3)xe=(pe[At]<<16&16711680)+(pe[At+1]<<8&65280)+(pe[At+2]&255),_e.push(de(xe));return _e.join("")}function he(pe){for(var ze,Fe=pe.length,xe=Fe%3,_e=[],At=16383,$e=0,Ue=Fe-xe;$e<Ue;$e+=At)_e.push(Ne(pe,$e,$e+At>Ue?Ue:$e+At));return xe===1?(ze=pe[Fe-1],_e.push(V[ze>>2]+V[ze<<4&63]+"==")):xe===2&&(ze=(pe[Fe-2]<<8)+pe[Fe-1],_e.push(V[ze>>10]+V[ze>>4&63]+V[ze<<2&63]+"=")),_e.join("")}},{}],14:[function(r,g,k){const{Buffer:V}=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||V.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]:V.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=V.allocUnsafe(de));for(let ze=ue[0];ze<this._bufs.length;ze++){const Fe=this._bufs[ze].length-pe;if(Ne>Fe)this._bufs[ze].copy(Ce,he,pe),he+=Fe;else{this._bufs[ze].copy(Ce,he,pe,pe+Ne),he+=Fe;break}Ne-=Fe,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(V.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(V.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=V.from([re]):typeof re=="string"?re=V.from(re,ie):this._isBufferList(re)?re=re.slice():Array.isArray(re.buffer)?re=V.from(re.buffer,re.byteOffset,re.byteLength):V.isBuffer(re)||(re=V.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,k){const V=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),V.call(this)}$(re,V),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){V.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,k){},{}],17:[function(r,g,k){(function(V){(function(){var $=r("base64-js"),oe=r("ieee754");k.Buffer=ae,k.SlowBuffer=xe,k.INSPECT_MAX_BYTES=50;var re=2147483647;k.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(ai(oi,ArrayBuffer)||oi&&ai(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 gi=oi.valueOf&&oi.valueOf();if(gi!=null&&gi!==oi)return ae.from(gi,Et,ii);var mi=ze(oi);if(mi)return mi;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:Fe(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,gi=ie(ii),mi=gi.write(oi,Et);return mi!==ii&&(gi=gi.slice(0,mi)),gi}function he(oi){for(var Et=oi.length<0?0:Fe(oi.length)|0,ii=ie(Et),gi=0;gi<Et;gi+=1)ii[gi]=oi[gi]&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 gi;return Et===void 0&&ii===void 0?gi=new Uint8Array(oi):ii===void 0?gi=new Uint8Array(oi,Et):gi=new Uint8Array(oi,Et,ii),gi.__proto__=ae.prototype,gi}function ze(oi){if(ae.isBuffer(oi)){var Et=Fe(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"||Ii(oi.length)?ie(0):he(oi);if(oi.type==="Buffer"&&Array.isArray(oi.data))return he(oi.data)}function Fe(oi){if(oi>=re)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+re.toString(16)+" bytes");return oi|0}function xe(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(ai(Et,Uint8Array)&&(Et=ae.from(Et,Et.offset,Et.byteLength)),ai(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 gi=Et.length,mi=ii.length,fi=0,vi=Math.min(gi,mi);fi<vi;++fi)if(Et[fi]!==ii[fi]){gi=Et[fi],mi=ii[fi];break}return gi<mi?-1:mi<gi?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 gi;if(ii===void 0)for(ii=0,gi=0;gi<Et.length;++gi)ii+=Et[gi].length;var mi=ae.allocUnsafe(ii),fi=0;for(gi=0;gi<Et.length;++gi){var vi=Et[gi];if(ai(vi,Uint8Array)&&(vi=ae.from(vi)),!ae.isBuffer(vi))throw new TypeError('"list" argument must be an Array of Buffers');vi.copy(mi,fi),fi+=vi.length}return mi};function _e(oi,Et){if(ae.isBuffer(oi))return oi.length;if(ArrayBuffer.isView(oi)||ai(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,gi=arguments.length>2&&arguments[2]===!0;if(!gi&&ii===0)return 0;for(var mi=!1;;)switch(Et){case"ascii":case"latin1":case"binary":return ii;case"utf8":case"utf-8":return Mi(oi).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ii*2;case"hex":return ii>>>1;case"base64":return Si(oi).length;default:if(mi)return gi?-1:Mi(oi).length;Et=(""+Et).toLowerCase(),mi=!0}}ae.byteLength=_e;function At(oi,Et,ii){var gi=!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 li(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 ci(this,Et,ii);case"base64":return ti(this,Et,ii);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return si(this,Et,ii);default:if(gi)throw new TypeError("Unknown encoding: "+oi);oi=(oi+"").toLowerCase(),gi=!0}}ae.prototype._isBuffer=!0;function $e(oi,Et,ii){var gi=oi[Et];oi[Et]=oi[ii],oi[ii]=gi}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=k.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,gi,mi,fi){if(ai(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),gi===void 0&&(gi=Et?Et.length:0),mi===void 0&&(mi=0),fi===void 0&&(fi=this.length),ii<0||gi>Et.length||mi<0||fi>this.length)throw new RangeError("out of range index");if(mi>=fi&&ii>=gi)return 0;if(mi>=fi)return-1;if(ii>=gi)return 1;if(ii>>>=0,gi>>>=0,mi>>>=0,fi>>>=0,this===Et)return 0;for(var vi=fi-mi,xi=gi-ii,Gi=Math.min(vi,xi),Bi=this.slice(mi,fi),Oi=Et.slice(ii,gi),Zi=0;Zi<Gi;++Zi)if(Bi[Zi]!==Oi[Zi]){vi=Bi[Zi],xi=Oi[Zi];break}return vi<xi?-1:xi<vi?1:0};function Ue(oi,Et,ii,gi,mi){if(oi.length===0)return-1;if(typeof ii=="string"?(gi=ii,ii=0):ii>2147483647?ii=2147483647:ii<-2147483648&&(ii=-2147483648),ii=+ii,Ii(ii)&&(ii=mi?0:oi.length-1),ii<0&&(ii=oi.length+ii),ii>=oi.length){if(mi)return-1;ii=oi.length-1}else if(ii<0)if(mi)ii=0;else return-1;if(typeof Et=="string"&&(Et=ae.from(Et,gi)),ae.isBuffer(Et))return Et.length===0?-1:Ve(oi,Et,ii,gi,mi);if(typeof Et=="number")return Et=Et&255,typeof Uint8Array.prototype.indexOf=="function"?mi?Uint8Array.prototype.indexOf.call(oi,Et,ii):Uint8Array.prototype.lastIndexOf.call(oi,Et,ii):Ve(oi,[Et],ii,gi,mi);throw new TypeError("val must be string, number or Buffer")}function Ve(oi,Et,ii,gi,mi){var fi=1,vi=oi.length,xi=Et.length;if(gi!==void 0&&(gi=String(gi).toLowerCase(),gi==="ucs2"||gi==="ucs-2"||gi==="utf16le"||gi==="utf-16le")){if(oi.length<2||Et.length<2)return-1;fi=2,vi/=2,xi/=2,ii/=2}function Gi(ki,Vi){return fi===1?ki[Vi]:ki.readUInt16BE(Vi*fi)}var Bi;if(mi){var Oi=-1;for(Bi=ii;Bi<vi;Bi++)if(Gi(oi,Bi)===Gi(Et,Oi===-1?0:Bi-Oi)){if(Oi===-1&&(Oi=Bi),Bi-Oi+1===xi)return Oi*fi}else Oi!==-1&&(Bi-=Bi-Oi),Oi=-1}else for(ii+xi>vi&&(ii=vi-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,gi){return this.indexOf(Et,ii,gi)!==-1},ae.prototype.indexOf=function(Et,ii,gi){return Ue(this,Et,ii,gi,!0)},ae.prototype.lastIndexOf=function(Et,ii,gi){return Ue(this,Et,ii,gi,!1)};function Oe(oi,Et,ii,gi){ii=Number(ii)||0;var mi=oi.length-ii;gi?(gi=Number(gi),gi>mi&&(gi=mi)):gi=mi;var fi=Et.length;gi>fi/2&&(gi=fi/2);for(var vi=0;vi<gi;++vi){var xi=parseInt(Et.substr(vi*2,2),16);if(Ii(xi))return vi;oi[ii+vi]=xi}return vi}function Dt(oi,Et,ii,gi){return bi(Mi(Et,oi.length-ii),oi,ii,gi)}function qe(oi,Et,ii,gi){return bi(di(Et),oi,ii,gi)}function kt(oi,Et,ii,gi){return qe(oi,Et,ii,gi)}function Lt(oi,Et,ii,gi){return bi(Si(Et),oi,ii,gi)}function jt(oi,Et,ii,gi){return bi(pi(Et,oi.length-ii),oi,ii,gi)}ae.prototype.write=function(Et,ii,gi,mi){if(ii===void 0)mi="utf8",gi=this.length,ii=0;else if(gi===void 0&&typeof ii=="string")mi=ii,gi=this.length,ii=0;else if(isFinite(ii))ii=ii>>>0,isFinite(gi)?(gi=gi>>>0,mi===void 0&&(mi="utf8")):(mi=gi,gi=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var fi=this.length-ii;if((gi===void 0||gi>fi)&&(gi=fi),Et.length>0&&(gi<0||ii<0)||ii>this.length)throw new RangeError("Attempt to write outside buffer bounds");mi||(mi="utf8");for(var vi=!1;;)switch(mi){case"hex":return Oe(this,Et,ii,gi);case"utf8":case"utf-8":return Dt(this,Et,ii,gi);case"ascii":return qe(this,Et,ii,gi);case"latin1":case"binary":return kt(this,Et,ii,gi);case"base64":return Lt(this,Et,ii,gi);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jt(this,Et,ii,gi);default:if(vi)throw new TypeError("Unknown encoding: "+mi);mi=(""+mi).toLowerCase(),vi=!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 gi=[],mi=Et;mi<ii;){var fi=oi[mi],vi=null,xi=fi>239?4:fi>223?3:fi>191?2:1;if(mi+xi<=ii){var Gi,Bi,Oi,Zi;switch(xi){case 1:fi<128&&(vi=fi);break;case 2:Gi=oi[mi+1],(Gi&192)===128&&(Zi=(fi&31)<<6|Gi&63,Zi>127&&(vi=Zi));break;case 3:Gi=oi[mi+1],Bi=oi[mi+2],(Gi&192)===128&&(Bi&192)===128&&(Zi=(fi&15)<<12|(Gi&63)<<6|Bi&63,Zi>2047&&(Zi<55296||Zi>57343)&&(vi=Zi));break;case 4:Gi=oi[mi+1],Bi=oi[mi+2],Oi=oi[mi+3],(Gi&192)===128&&(Bi&192)===128&&(Oi&192)===128&&(Zi=(fi&15)<<18|(Gi&63)<<12|(Bi&63)<<6|Oi&63,Zi>65535&&Zi<1114112&&(vi=Zi))}}vi===null?(vi=65533,xi=1):vi>65535&&(vi-=65536,gi.push(vi>>>10&1023|55296),vi=56320|vi&1023),gi.push(vi),mi+=xi}return ni(gi)}var Pt=4096;function ni(oi){var Et=oi.length;if(Et<=Pt)return String.fromCharCode.apply(String,oi);for(var ii="",gi=0;gi<Et;)ii+=String.fromCharCode.apply(String,oi.slice(gi,gi+=Pt));return ii}function ri(oi,Et,ii){var gi="";ii=Math.min(oi.length,ii);for(var mi=Et;mi<ii;++mi)gi+=String.fromCharCode(oi[mi]&127);return gi}function ci(oi,Et,ii){var gi="";ii=Math.min(oi.length,ii);for(var mi=Et;mi<ii;++mi)gi+=String.fromCharCode(oi[mi]);return gi}function li(oi,Et,ii){var gi=oi.length;(!Et||Et<0)&&(Et=0),(!ii||ii<0||ii>gi)&&(ii=gi);for(var mi="",fi=Et;fi<ii;++fi)mi+=zi(oi[fi]);return mi}function si(oi,Et,ii){for(var gi=oi.slice(Et,ii),mi="",fi=0;fi<gi.length;fi+=2)mi+=String.fromCharCode(gi[fi]+gi[fi+1]*256);return mi}ae.prototype.slice=function(Et,ii){var gi=this.length;Et=~~Et,ii=ii===void 0?gi:~~ii,Et<0?(Et+=gi,Et<0&&(Et=0)):Et>gi&&(Et=gi),ii<0?(ii+=gi,ii<0&&(ii=0)):ii>gi&&(ii=gi),ii<Et&&(ii=Et);var mi=this.subarray(Et,ii);return mi.__proto__=ae.prototype,mi};function ui(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,gi){Et=Et>>>0,ii=ii>>>0,gi||ui(Et,ii,this.length);for(var mi=this[Et],fi=1,vi=0;++vi<ii&&(fi*=256);)mi+=this[Et+vi]*fi;return mi},ae.prototype.readUIntBE=function(Et,ii,gi){Et=Et>>>0,ii=ii>>>0,gi||ui(Et,ii,this.length);for(var mi=this[Et+--ii],fi=1;ii>0&&(fi*=256);)mi+=this[Et+--ii]*fi;return mi},ae.prototype.readUInt8=function(Et,ii){return Et=Et>>>0,ii||ui(Et,1,this.length),this[Et]},ae.prototype.readUInt16LE=function(Et,ii){return Et=Et>>>0,ii||ui(Et,2,this.length),this[Et]|this[Et+1]<<8},ae.prototype.readUInt16BE=function(Et,ii){return Et=Et>>>0,ii||ui(Et,2,this.length),this[Et]<<8|this[Et+1]},ae.prototype.readUInt32LE=function(Et,ii){return Et=Et>>>0,ii||ui(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||ui(Et,4,this.length),this[Et]*16777216+(this[Et+1]<<16|this[Et+2]<<8|this[Et+3])},ae.prototype.readIntLE=function(Et,ii,gi){Et=Et>>>0,ii=ii>>>0,gi||ui(Et,ii,this.length);for(var mi=this[Et],fi=1,vi=0;++vi<ii&&(fi*=256);)mi+=this[Et+vi]*fi;return fi*=128,mi>=fi&&(mi-=Math.pow(2,8*ii)),mi},ae.prototype.readIntBE=function(Et,ii,gi){Et=Et>>>0,ii=ii>>>0,gi||ui(Et,ii,this.length);for(var mi=ii,fi=1,vi=this[Et+--mi];mi>0&&(fi*=256);)vi+=this[Et+--mi]*fi;return fi*=128,vi>=fi&&(vi-=Math.pow(2,8*ii)),vi},ae.prototype.readInt8=function(Et,ii){return Et=Et>>>0,ii||ui(Et,1,this.length),this[Et]&128?(255-this[Et]+1)*-1:this[Et]},ae.prototype.readInt16LE=function(Et,ii){Et=Et>>>0,ii||ui(Et,2,this.length);var gi=this[Et]|this[Et+1]<<8;return gi&32768?gi|4294901760:gi},ae.prototype.readInt16BE=function(Et,ii){Et=Et>>>0,ii||ui(Et,2,this.length);var gi=this[Et+1]|this[Et]<<8;return gi&32768?gi|4294901760:gi},ae.prototype.readInt32LE=function(Et,ii){return Et=Et>>>0,ii||ui(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||ui(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||ui(Et,4,this.length),oe.read(this,Et,!0,23,4)},ae.prototype.readFloatBE=function(Et,ii){return Et=Et>>>0,ii||ui(Et,4,this.length),oe.read(this,Et,!1,23,4)},ae.prototype.readDoubleLE=function(Et,ii){return Et=Et>>>0,ii||ui(Et,8,this.length),oe.read(this,Et,!0,52,8)},ae.prototype.readDoubleBE=function(Et,ii){return Et=Et>>>0,ii||ui(Et,8,this.length),oe.read(this,Et,!1,52,8)};function hi(oi,Et,ii,gi,mi,fi){if(!ae.isBuffer(oi))throw new TypeError('"buffer" argument must be a Buffer instance');if(Et>mi||Et<fi)throw new RangeError('"value" argument is out of bounds');if(ii+gi>oi.length)throw new RangeError("Index out of range")}ae.prototype.writeUIntLE=function(Et,ii,gi,mi){if(Et=+Et,ii=ii>>>0,gi=gi>>>0,!mi){var fi=Math.pow(2,8*gi)-1;hi(this,Et,ii,gi,fi,0)}var vi=1,xi=0;for(this[ii]=Et&255;++xi<gi&&(vi*=256);)this[ii+xi]=Et/vi&255;return ii+gi},ae.prototype.writeUIntBE=function(Et,ii,gi,mi){if(Et=+Et,ii=ii>>>0,gi=gi>>>0,!mi){var fi=Math.pow(2,8*gi)-1;hi(this,Et,ii,gi,fi,0)}var vi=gi-1,xi=1;for(this[ii+vi]=Et&255;--vi>=0&&(xi*=256);)this[ii+vi]=Et/xi&255;return ii+gi},ae.prototype.writeUInt8=function(Et,ii,gi){return Et=+Et,ii=ii>>>0,gi||hi(this,Et,ii,1,255,0),this[ii]=Et&255,ii+1},ae.prototype.writeUInt16LE=function(Et,ii,gi){return Et=+Et,ii=ii>>>0,gi||hi(this,Et,ii,2,65535,0),this[ii]=Et&255,this[ii+1]=Et>>>8,ii+2},ae.prototype.writeUInt16BE=function(Et,ii,gi){return Et=+Et,ii=ii>>>0,gi||hi(this,Et,ii,2,65535,0),this[ii]=Et>>>8,this[ii+1]=Et&255,ii+2},ae.prototype.writeUInt32LE=function(Et,ii,gi){return Et=+Et,ii=ii>>>0,gi||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,gi){return Et=+Et,ii=ii>>>0,gi||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,gi,mi){if(Et=+Et,ii=ii>>>0,!mi){var fi=Math.pow(2,8*gi-1);hi(this,Et,ii,gi,fi-1,-fi)}var vi=0,xi=1,Gi=0;for(this[ii]=Et&255;++vi<gi&&(xi*=256);)Et<0&&Gi===0&&this[ii+vi-1]!==0&&(Gi=1),this[ii+vi]=(Et/xi>>0)-Gi&255;return ii+gi},ae.prototype.writeIntBE=function(Et,ii,gi,mi){if(Et=+Et,ii=ii>>>0,!mi){var fi=Math.pow(2,8*gi-1);hi(this,Et,ii,gi,fi-1,-fi)}var vi=gi-1,xi=1,Gi=0;for(this[ii+vi]=Et&255;--vi>=0&&(xi*=256);)Et<0&&Gi===0&&this[ii+vi+1]!==0&&(Gi=1),this[ii+vi]=(Et/xi>>0)-Gi&255;return ii+gi},ae.prototype.writeInt8=function(Et,ii,gi){return Et=+Et,ii=ii>>>0,gi||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,gi){return Et=+Et,ii=ii>>>0,gi||hi(this,Et,ii,2,32767,-32768),this[ii]=Et&255,this[ii+1]=Et>>>8,ii+2},ae.prototype.writeInt16BE=function(Et,ii,gi){return Et=+Et,ii=ii>>>0,gi||hi(this,Et,ii,2,32767,-32768),this[ii]=Et>>>8,this[ii+1]=Et&255,ii+2},ae.prototype.writeInt32LE=function(Et,ii,gi){return Et=+Et,ii=ii>>>0,gi||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,gi){return Et=+Et,ii=ii>>>0,gi||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 Ai(oi,Et,ii,gi,mi,fi){if(ii+gi>oi.length)throw new RangeError("Index out of range");if(ii<0)throw new RangeError("Index out of range")}function Ni(oi,Et,ii,gi,mi){return Et=+Et,ii=ii>>>0,mi||Ai(oi,Et,ii,4),oe.write(oi,Et,ii,gi,23,4),ii+4}ae.prototype.writeFloatLE=function(Et,ii,gi){return Ni(this,Et,ii,!0,gi)},ae.prototype.writeFloatBE=function(Et,ii,gi){return Ni(this,Et,ii,!1,gi)};function yi(oi,Et,ii,gi,mi){return Et=+Et,ii=ii>>>0,mi||Ai(oi,Et,ii,8),oe.write(oi,Et,ii,gi,52,8),ii+8}ae.prototype.writeDoubleLE=function(Et,ii,gi){return yi(this,Et,ii,!0,gi)},ae.prototype.writeDoubleBE=function(Et,ii,gi){return yi(this,Et,ii,!1,gi)},ae.prototype.copy=function(Et,ii,gi,mi){if(!ae.isBuffer(Et))throw new TypeError("argument should be a Buffer");if(gi||(gi=0),!mi&&mi!==0&&(mi=this.length),ii>=Et.length&&(ii=Et.length),ii||(ii=0),mi>0&&mi<gi&&(mi=gi),mi===gi||Et.length===0||this.length===0)return 0;if(ii<0)throw new RangeError("targetStart out of bounds");if(gi<0||gi>=this.length)throw new RangeError("Index out of range");if(mi<0)throw new RangeError("sourceEnd out of bounds");mi>this.length&&(mi=this.length),Et.length-ii<mi-gi&&(mi=Et.length-ii+gi);var fi=mi-gi;if(this===Et&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(ii,gi,mi);else if(this===Et&&gi<ii&&ii<mi)for(var vi=fi-1;vi>=0;--vi)Et[vi+ii]=this[vi+gi];else Uint8Array.prototype.set.call(Et,this.subarray(gi,mi),ii);return fi},ae.prototype.fill=function(Et,ii,gi,mi){if(typeof Et=="string"){if(typeof ii=="string"?(mi=ii,ii=0,gi=this.length):typeof gi=="string"&&(mi=gi,gi=this.length),mi!==void 0&&typeof mi!="string")throw new TypeError("encoding must be a string");if(typeof mi=="string"&&!ae.isEncoding(mi))throw new TypeError("Unknown encoding: "+mi);if(Et.length===1){var fi=Et.charCodeAt(0);(mi==="utf8"&&fi<128||mi==="latin1")&&(Et=fi)}}else typeof Et=="number"&&(Et=Et&255);if(ii<0||this.length<ii||this.length<gi)throw new RangeError("Out of range index");if(gi<=ii)return this;ii=ii>>>0,gi=gi===void 0?this.length:gi>>>0,Et||(Et=0);var vi;if(typeof Et=="number")for(vi=ii;vi<gi;++vi)this[vi]=Et;else{var xi=ae.isBuffer(Et)?Et:ae.from(Et,mi),Gi=xi.length;if(Gi===0)throw new TypeError('The value "'+Et+'" is invalid for argument "value"');for(vi=0;vi<gi-ii;++vi)this[vi+ii]=xi[vi%Gi]}return this};var wi=/[^+/0-9A-Za-z-_]/g;function Ci(oi){if(oi=oi.split("=")[0],oi=oi.trim().replace(wi,""),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 Mi(oi,Et){Et=Et||1/0;for(var ii,gi=oi.length,mi=null,fi=[],vi=0;vi<gi;++vi){if(ii=oi.charCodeAt(vi),ii>55295&&ii<57344){if(!mi){if(ii>56319){(Et-=3)>-1&&fi.push(239,191,189);continue}else if(vi+1===gi){(Et-=3)>-1&&fi.push(239,191,189);continue}mi=ii;continue}if(ii<56320){(Et-=3)>-1&&fi.push(239,191,189),mi=ii;continue}ii=(mi-55296<<10|ii-56320)+65536}else mi&&(Et-=3)>-1&&fi.push(239,191,189);if(mi=null,ii<128){if((Et-=1)<0)break;fi.push(ii)}else if(ii<2048){if((Et-=2)<0)break;fi.push(ii>>6|192,ii&63|128)}else if(ii<65536){if((Et-=3)<0)break;fi.push(ii>>12|224,ii>>6&63|128,ii&63|128)}else if(ii<1114112){if((Et-=4)<0)break;fi.push(ii>>18|240,ii>>12&63|128,ii>>6&63|128,ii&63|128)}else throw new Error("Invalid code point")}return fi}function di(oi){for(var Et=[],ii=0;ii<oi.length;++ii)Et.push(oi.charCodeAt(ii)&255);return Et}function pi(oi,Et){for(var ii,gi,mi,fi=[],vi=0;vi<oi.length&&!((Et-=2)<0);++vi)ii=oi.charCodeAt(vi),gi=ii>>8,mi=ii%256,fi.push(mi),fi.push(gi);return fi}function Si(oi){return $.toByteArray(Ci(oi))}function bi(oi,Et,ii,gi){for(var mi=0;mi<gi&&!(mi+ii>=Et.length||mi>=oi.length);++mi)Et[mi+ii]=oi[mi];return mi}function ai(oi,Et){return oi instanceof Et||oi!=null&&oi.constructor!=null&&oi.constructor.name!=null&&oi.constructor.name===Et.name}function Ii(oi){return oi!==oi}}).call(this)}).call(this,r("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(r,g,k){(function(V){(function(){k.formatArgs=oe,k.save=re,k.load=Ce,k.useColors=$,k.storage=ie(),k.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`."))}})(),k.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)}k.log=console.debug||console.log||(()=>{});function re(le){try{le?k.storage.setItem("debug",le):k.storage.removeItem("debug")}catch{}}function Ce(){let le;try{le=k.storage.getItem("debug")}catch{}return!le&&typeof V<"u"&&"env"in V&&(le=V.env.DEBUG),le}function ie(){try{return localStorage}catch{}}g.exports=r("./common")(k);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,k){function V($){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,Fe;function xe(..._e){if(!xe.enabled)return;const At=xe,$e=Number(new Date),Ue=$e-(he||$e);At.diff=Ue,At.prev=he,At.curr=$e,he=$e,_e[0]=re.coerce(_e[0]),typeof _e[0]!="string"&&_e.unshift("%O");let Ve=0;_e[0]=_e[0].replace(/%([a-zA-Z%])/g,(Dt,qe)=>{if(Dt==="%%")return"%";Ve++;const kt=re.formatters[qe];if(typeof kt=="function"){const Lt=_e[Ve];Dt=kt.call(At,Lt),_e.splice(Ve,1),Ve--}return Dt}),re.formatArgs.call(At,_e),(At.log||re.log).apply(At,_e)}return xe.namespace=Ne,xe.useColors=re.useColors(),xe.color=re.selectColor(Ne),xe.extend=Ce,xe.destroy=re.destroy,Object.defineProperty(xe,"enabled",{enumerable:!0,configurable:!1,get:()=>pe!==null?pe:(ze!==re.namespaces&&(ze=re.namespaces,Fe=re.enabled(Ne)),Fe),set:_e=>{pe=_e}}),typeof re.init=="function"&&re.init(xe),xe}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=V},{ms:45}],20:[function(r,g,k){(function(V,$){(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,Fe){ze._corked?ze.once("uncork",Fe):Fe()},Ie=function(ze,Fe){ze._autoDestroy&&ze.destroy(Fe)},ue=function(ze,Fe){return function(xe){xe?Ie(ze,xe.message==="premature close"?null:xe):Fe&&!ze._ended&&ze.end()}},de=function(ze,Fe){if(!ze||ze._writableState&&ze._writableState.finished)return Fe();if(ze._writableState)return ze.end(Fe);ze.end(),Fe()},Ne=function(){},he=function(ze){return new oe.Readable({objectMode:!0,highWaterMark:16}).wrap(ze)},pe=function(ze,Fe,xe){if(!(this instanceof pe))return new pe(ze,Fe,xe);oe.Duplex.call(this,xe),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!xe||xe.autoDestroy!==!1,this._forwardDestroy=!xe||xe.destroy!==!1,this._forwardEnd=!xe||xe.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),Fe&&this.setReadable(Fe)};Ce(pe,oe.Duplex),pe.obj=function(ze,Fe,xe){return xe||(xe={}),xe.objectMode=!0,xe.highWaterMark=16,new pe(ze,Fe,xe)},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 Fe=this,xe=re(ze,{writable:!0,readable:!1},ue(this,this._forwardEnd)),_e=function(){var $e=Fe._ondrain;Fe._ondrain=null,$e&&$e()},At=function(){Fe._writable.removeListener("drain",_e),xe()};this._unwrite&&V.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 Fe=this,xe=re(ze,{writable:!1,readable:!0},ue(this)),_e=function(){Fe._forward()},At=function(){Fe.push(null)},$e=function(){Fe._readable2.removeListener("readable",_e),Fe._readable2.removeListener("end",At),xe()};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,Fe){if(Fe||(Fe=Ne),this.destroyed)return Fe(null);this.destroyed=!0;var xe=this;V.nextTick(function(){xe._destroy(ze),Fe(null)})},pe.prototype._destroy=function(ze){if(ze){var Fe=this._ondrain;this._ondrain=null,Fe?Fe(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,Fe,xe){if(!this.destroyed){if(this._corked)return le(this,this._write.bind(this,ze,Fe,xe));if(ze===ae)return this._finish(xe);if(!this._writable)return xe();this._writable.write(ze)===!1?this._ondrain=xe:this.destroyed||xe()}},pe.prototype._finish=function(ze){var Fe=this;this.emit("preend"),le(this,function(){de(Fe._forwardEnd&&Fe._writable,function(){Fe._writableState.prefinished===!1&&(Fe._writableState.prefinished=!0),Fe.emit("prefinish"),le(Fe,ze)})})},pe.prototype.end=function(ze,Fe,xe){return typeof ze=="function"?this.end(null,null,ze):typeof Fe=="function"?this.end(ze,null,Fe):(this._ended=!0,ze&&this.write(ze),!this._writableState.ending&&!this._writableState.destroyed&&this.write(ae),oe.Writable.prototype.end.call(this,xe))},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,k){(function(V){(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||Fe()},Fe=function(){he=!1,Ne||Ie.call(ae)},xe=function(){Ne=!1,he||Ie.call(ae)},_e=function(Oe){Ie.call(ae,Oe?new Error("exited with error code: "+Oe):null)},At=function(Oe){Ie.call(ae,Oe)},$e=function(){V.nextTick(Ue)},Ue=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"))}},Ve=function(){ae.req.on("finish",Fe)};return re(ae)?(ae.on("complete",Fe),ae.on("abort",$e),ae.req?Ve():ae.on("request",Ve)):he&&!ue&&(ae.on("end",ze),ae.on("close",ze)),Ce(ae)&&ae.on("exit",_e),ae.on("end",xe),ae.on("finish",Fe),le.error!==!1&&ae.on("error",At),ae.on("close",$e),function(){pe=!0,ae.removeListener("complete",Fe),ae.removeListener("abort",$e),ae.removeListener("request",Ve),ae.req&&ae.req.removeListener("finish",Fe),ae.removeListener("end",ze),ae.removeListener("close",ze),ae.removeListener("finish",Fe),ae.removeListener("exit",_e),ae.removeListener("end",xe),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,k){var V=Object.create||Ve,$=Object.keys||Oe,oe=Function.prototype.bind||Dt;function re(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=V(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,Lt){if(kt)qe.call(Lt);else for(var jt=qe.length,ti=$e(qe,jt),ei=0;ei<jt;++ei)ti[ei].call(Lt)}function ue(qe,kt,Lt,jt){if(kt)qe.call(Lt,jt);else for(var ti=qe.length,ei=$e(qe,ti),Pt=0;Pt<ti;++Pt)ei[Pt].call(Lt,jt)}function de(qe,kt,Lt,jt,ti){if(kt)qe.call(Lt,jt,ti);else for(var ei=qe.length,Pt=$e(qe,ei),ni=0;ni<ei;++ni)Pt[ni].call(Lt,jt,ti)}function Ne(qe,kt,Lt,jt,ti,ei){if(kt)qe.call(Lt,jt,ti,ei);else for(var Pt=qe.length,ni=$e(qe,Pt),ri=0;ri<Pt;++ri)ni[ri].call(Lt,jt,ti,ei)}function he(qe,kt,Lt,jt){if(kt)qe.apply(Lt,jt);else for(var ti=qe.length,ei=$e(qe,ti),Pt=0;Pt<ti;++Pt)ei[Pt].apply(Lt,jt)}re.prototype.emit=function(kt){var Lt,jt,ti,ei,Pt,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&&(Lt=arguments[1]),Lt instanceof Error)throw Lt;var ci=new Error('Unhandled "error" event. ('+Lt+")");throw ci.context=Lt,ci}if(jt=ni[kt],!jt)return!1;var li=typeof jt=="function";switch(ti=arguments.length,ti){case 1:Ie(jt,li,this);break;case 2:ue(jt,li,this,arguments[1]);break;case 3:de(jt,li,this,arguments[1],arguments[2]);break;case 4:Ne(jt,li,this,arguments[1],arguments[2],arguments[3]);break;default:for(ei=new Array(ti-1),Pt=1;Pt<ti;Pt++)ei[Pt-1]=arguments[Pt];he(jt,li,this,ei)}return!0};function pe(qe,kt,Lt,jt){var ti,ei,Pt;if(typeof Lt!="function")throw new TypeError('"listener" argument must be a function');if(ei=qe._events,ei?(ei.newListener&&(qe.emit("newListener",kt,Lt.listener?Lt.listener:Lt),ei=qe._events),Pt=ei[kt]):(ei=qe._events=V(null),qe._eventsCount=0),!Pt)Pt=ei[kt]=Lt,++qe._eventsCount;else if(typeof Pt=="function"?Pt=ei[kt]=jt?[Lt,Pt]:[Pt,Lt]:jt?Pt.unshift(Lt):Pt.push(Lt),!Pt.warned&&(ti=le(qe),ti&&ti>0&&Pt.length>ti)){Pt.warned=!0;var ni=new Error("Possible EventEmitter memory leak detected. "+Pt.length+' "'+String(kt)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');ni.name="MaxListenersExceededWarning",ni.emitter=qe,ni.type=kt,ni.count=Pt.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",ni.name,ni.message)}return qe}re.prototype.addListener=function(kt,Lt){return pe(this,kt,Lt,!1)},re.prototype.on=re.prototype.addListener,re.prototype.prependListener=function(kt,Lt){return pe(this,kt,Lt,!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 Fe(qe,kt,Lt){var jt={fired:!1,wrapFn:void 0,target:qe,type:kt,listener:Lt},ti=oe.call(ze,jt);return ti.listener=Lt,jt.wrapFn=ti,ti}re.prototype.once=function(kt,Lt){if(typeof Lt!="function")throw new TypeError('"listener" argument must be a function');return this.on(kt,Fe(this,kt,Lt)),this},re.prototype.prependOnceListener=function(kt,Lt){if(typeof Lt!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(kt,Fe(this,kt,Lt)),this},re.prototype.removeListener=function(kt,Lt){var jt,ti,ei,Pt,ni;if(typeof Lt!="function")throw new TypeError('"listener" argument must be a function');if(ti=this._events,!ti)return this;if(jt=ti[kt],!jt)return this;if(jt===Lt||jt.listener===Lt)--this._eventsCount===0?this._events=V(null):(delete ti[kt],ti.removeListener&&this.emit("removeListener",kt,jt.listener||Lt));else if(typeof jt!="function"){for(ei=-1,Pt=jt.length-1;Pt>=0;Pt--)if(jt[Pt]===Lt||jt[Pt].listener===Lt){ni=jt[Pt].listener,ei=Pt;break}if(ei<0)return this;ei===0?jt.shift():At(jt,ei),jt.length===1&&(ti[kt]=jt[0]),ti.removeListener&&this.emit("removeListener",kt,ni||Lt)}return this},re.prototype.removeAllListeners=function(kt){var Lt,jt,ti;if(jt=this._events,!jt)return this;if(!jt.removeListener)return arguments.length===0?(this._events=V(null),this._eventsCount=0):jt[kt]&&(--this._eventsCount===0?this._events=V(null):delete jt[kt]),this;if(arguments.length===0){var ei=$(jt),Pt;for(ti=0;ti<ei.length;++ti)Pt=ei[ti],Pt!=="removeListener"&&this.removeAllListeners(Pt);return this.removeAllListeners("removeListener"),this._events=V(null),this._eventsCount=0,this}if(Lt=jt[kt],typeof Lt=="function")this.removeListener(kt,Lt);else if(Lt)for(ti=Lt.length-1;ti>=0;ti--)this.removeListener(kt,Lt[ti]);return this};function xe(qe,kt,Lt){var jt=qe._events;if(!jt)return[];var ti=jt[kt];return ti?typeof ti=="function"?Lt?[ti.listener||ti]:[ti]:Lt?Ue(ti):$e(ti,ti.length):[]}re.prototype.listeners=function(kt){return xe(this,kt,!0)},re.prototype.rawListeners=function(kt){return xe(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 Lt=kt[qe];if(typeof Lt=="function")return 1;if(Lt)return Lt.length}return 0}re.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function At(qe,kt){for(var Lt=kt,jt=Lt+1,ti=qe.length;jt<ti;Lt+=1,jt+=1)qe[Lt]=qe[jt];qe.pop()}function $e(qe,kt){for(var Lt=new Array(kt),jt=0;jt<kt;++jt)Lt[jt]=qe[jt];return Lt}function Ue(qe){for(var kt=new Array(qe.length),Lt=0;Lt<kt.length;++Lt)kt[Lt]=qe[Lt].listener||qe[Lt];return kt}function Ve(qe){var kt=function(){};return kt.prototype=qe,new kt}function Oe(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,k){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */k.read=function(V,$,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=V[$+Ne];for(Ne+=he,ie=pe&(1<<-de)-1,pe>>=-de,de+=le;de>0;ie=ie*256+V[$+Ne],Ne+=he,de-=8);for(ae=ie&(1<<-de)-1,ie>>=-de,de+=re;de>0;ae=ae*256+V[$+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)},k.write=function(V,$,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,Fe=$<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;V[oe+pe]=le&255,pe+=ze,le/=256,Ce-=8);for(ae=ae<<Ce|le,ue+=Ce;ue>0;V[oe+pe]=ae&255,pe+=ze,ae/=256,ue-=8);V[oe+pe-ze]|=Fe*128}},{}],24:[function(r,g,k){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,k){Object.defineProperty(k,"__esModule",{value:!0});var V=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(V),k.default=V},{}],26:[function(r,g,k){var V=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(k,"__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 Fe=ae;Fe<=Ie;++Fe)pe(Ce[ie][Fe],ze++);return}for(var Fe=ae;Fe<$.bucketSize;++Fe)pe(Ce[ie][Fe],ze++);for(var Fe=ie+1;Fe<le;++Fe)for(var xe=0;xe<$.bucketSize;++xe)pe(Ce[Fe][xe],ze++);for(var Fe=0;Fe<=Ie;++Fe)pe(Ce[le][Fe],ze++)}};var Ne=function(pe){var ze=ie*$.bucketSize+ae,Fe=ze+pe,xe=le*$.bucketSize+Ie;if(Fe<ze||Fe>xe)throw new Error("pos should more than 0 and less than queue's size");var _e=Math.floor(Fe/$.bucketSize),At=Fe%$.bucketSize;return{curNodeBucketIndex:_e,curNodePointerIndex:At}};this.getElementByPos=function(pe){var ze=Ne(pe),Fe=ze.curNodeBucketIndex,xe=ze.curNodePointerIndex;return Ce[Fe][xe]},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 Fe=[],xe=pe+1;xe<de;++xe)Fe.push(this.getElementByPos(xe));this.cut(pe),this.popBack(),Fe.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 Fe=ze.length,xe=0;xe<Fe;++xe)this.setElementByPos(xe,ze[xe]);this.cut(Fe-1)}};var he=function(pe){for(var ze=[],Fe=pe*$.sigma,xe=Math.max(Math.ceil(Fe/$.bucketSize),2),_e=0;_e<xe;++_e)ze.push(new Array($.bucketSize));var At=Math.ceil(pe/$.bucketSize),$e=Math.floor(xe/2)-Math.floor(At/2),Ue=$e,Ve=0;if(this.size())for(var _e=0;_e<At;++_e){for(var Oe=0;Oe<$.bucketSize;++Oe)if(ze[$e+_e][Oe]=this.front(),this.popFront(),this.empty()){Ue=$e+_e,Ve=Oe;break}if(this.empty())break}Ce=ze,ie=$e,ae=0,le=Ue,Ie=Ve,ue=xe,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 Fe=Ne(pe),xe=Fe.curNodeBucketIndex,_e=Fe.curNodePointerIndex;Ce[xe][_e]=ze},this.insert=function(pe,ze,Fe){var xe=this;if(Fe===void 0&&(Fe=1),pe===0)for(;Fe--;)this.pushFront(ze);else if(pe===this.size())for(;Fe--;)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<Fe;++At)this.pushBack(ze);_e.forEach(function($e){return xe.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 Fe=0;Fe<$.bucketSize;++Fe)if(Ce[ze][Fe]===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 Fe=this.getElementByPos(pe);this.setElementByPos(pe,this.getElementByPos(ze)),this.setElementByPos(ze,Fe),++pe,--ze}},this.unique=function(){if(!this.empty()){var pe=[],ze=this.front();this.forEach(function(xe,_e){(_e===0||xe!==ze)&&(pe.push(xe),ze=xe)});for(var Fe=0;Fe<de;++Fe)this.setElementByPos(Fe,pe[Fe]);this.cut(pe.length-1)}},this.sort=function(pe){var ze=[];this.forEach(function(xe){ze.push(xe)}),ze.sort(pe);for(var Fe=0;Fe<de;++Fe)this.setElementByPos(Fe,ze[Fe])},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 Fe=ze.length;Ce=[];for(var xe=Math.ceil(Fe/$.bucketSize),_e=0;_e<xe;++_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),Fe=ze.curNodeBucketIndex,xe=ze.curNodePointerIndex;le=Fe,Ie=xe,de=pe+1},this[Symbol.iterator]=function(){return function(){var ze,ze,ze,pe,ze;return V(this,function(Fe){switch(Fe.label){case 0:if(de===0)return[2];if(ie!==le)return[3,5];ze=ae,Fe.label=1;case 1:return ze<=Ie?[4,Ce[ie][ze]]:[3,4];case 2:Fe.sent(),Fe.label=3;case 3:return++ze,[3,1];case 4:return[2];case 5:ze=ae,Fe.label=6;case 6:return ze<$.bucketSize?[4,Ce[ie][ze]]:[3,9];case 7:Fe.sent(),Fe.label=8;case 8:return++ze,[3,6];case 9:ze=ie+1,Fe.label=10;case 10:if(!(ze<le))return[3,15];pe=0,Fe.label=11;case 11:return pe<$.bucketSize?[4,Ce[ze][pe]]:[3,14];case 12:Fe.sent(),Fe.label=13;case 13:return++pe,[3,11];case 14:return++ze,[3,10];case 15:ze=0,Fe.label=16;case 16:return ze<=Ie?[4,Ce[le][ze]]:[3,19];case 17:Fe.sent(),Fe.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 Fe=0;Fe<ue;++Fe)Ce.push(new Array($.bucketSize));var xe=Math.ceil(pe/$.bucketSize);ie=Math.floor(ue/2)-Math.floor(xe/2),le=ie,oe.forEach(function(_e){return re.pushBack(_e)})}(),Object.freeze(this)}Object.freeze($),k.default=$},{}],27:[function(r,g,k){var V=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(Fe){return pe([ze,Fe])}}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(Fe){ze=[6,Fe],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(k,"__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,Fe,xe=0,_e="";if(typeof pe=="number")xe=Math.floor(pe),xe=(xe<<5)-xe,xe=xe&xe;else{typeof pe!="string"?_e=JSON.stringify(pe):_e=pe;try{for(var At=$(_e),$e=At.next();!$e.done;$e=At.next()){var Ue=$e.value,Ve=Ue.charCodeAt(0);xe=(xe<<5)-xe+Ve,xe=xe&xe}}catch(Oe){ze={error:Oe}}finally{try{$e&&!$e.done&&(Fe=At.return)&&Fe.call(At)}finally{if(ze)throw ze.error}}}return xe^=xe>>>16,xe},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(Fe){Fe.forEach(function(xe){pe(xe,ze++)})})};var he=function(pe){if(!(pe>=Ce.maxSize)){Ne=pe*2;var ze=[];de.forEach(function(Fe,xe){if(!Fe.empty()){if(Fe instanceof oe.default&&Fe.size()===1){var _e=Fe.front(),At=_e.key,$e=_e.value;ze[le(At)&Ne-1]=new oe.default([{key:At,value:$e}])}else if(Fe instanceof re.default){var Ue=new oe.default,Ve=new oe.default;Fe.forEach(function(qe){var kt=le(qe.key);kt&pe?Ve.pushBack(qe):Ue.pushBack(qe)}),Ue.size()>Ce.untreeifyThreshold?ze[xe]=new re.default(Ue):Ue.size()&&(ze[xe]=Ue),Ve.size()>Ce.untreeifyThreshold?ze[xe+pe]=new re.default(Ve):Ve.size()&&(ze[xe+pe]=Ve)}else{var Oe=new oe.default,Dt=new oe.default;Fe.forEach(function(qe){var kt=le(qe.key);kt&pe?Dt.pushBack(qe):Oe.pushBack(qe)}),Oe.size()&&(ze[xe]=Oe),Dt.size()&&(ze[xe+pe]=Dt)}de[xe].clear()}}),de=ze}};this.setElement=function(pe,ze){var Fe,xe;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]),Ue=$e.next();!Ue.done;Ue=$e.next()){var Ve=Ue.value;if(Ve.key===pe){Ve.value=ze;return}}}catch(Dt){Fe={error:Dt}}finally{try{Ue&&!Ue.done&&(xe=$e.return)&&xe.call($e)}finally{if(Fe)throw Fe.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 Oe=de[_e].size();ue+=Oe-At}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.getElementByKey=function(pe){var ze,Fe,xe=le(pe)&Ne-1;if(de[xe]){if(de[xe]instanceof re.default)return de[xe].getElementByKey(pe);try{for(var _e=$(de[xe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===pe)return $e.value}}catch(Ue){ze={error:Ue}}finally{try{At&&!At.done&&(Fe=_e.return)&&Fe.call(_e)}finally{if(ze)throw ze.error}}}},this.eraseElementByKey=function(pe){var ze,Fe,xe=le(pe)&Ne-1;if(de[xe]){var _e=de[xe].size();if(de[xe]instanceof re.default)de[xe].eraseElementByKey(pe),de[xe].size()<=Ce.untreeifyThreshold&&(de[xe]=new oe.default(de[xe]));else{var At=-1;try{for(var $e=$(de[xe]),Ue=$e.next();!Ue.done;Ue=$e.next()){var Ve=Ue.value;if(++At,Ve.key===pe){de[xe].eraseElementByPos(At);break}}}catch(Dt){ze={error:Dt}}finally{try{Ue&&!Ue.done&&(Fe=$e.return)&&Fe.call($e)}finally{if(ze)throw ze.error}}}var Oe=de[xe].size();ue+=Oe-_e}},this.find=function(pe){var ze,Fe,xe=le(pe)&Ne-1;if(!de[xe])return!1;if(de[xe]instanceof re.default)return de[xe].find(pe);try{for(var _e=$(de[xe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===pe)return!0}}catch(Ue){ze={error:Ue}}finally{try{At&&!At.done&&(Fe=_e.return)&&Fe.call(_e)}finally{if(ze)throw ze.error}}return!1},this[Symbol.iterator]=function(){return function(){var pe,ze,Fe,xe,_e,At,$e;return V(this,function(Ue){switch(Ue.label){case 0:pe=0,Ue.label=1;case 1:if(!(pe<Ne))return[3,10];for(;pe<Ne&&!de[pe];)++pe;if(pe>=Ne)return[3,10];Ue.label=2;case 2:Ue.trys.push([2,7,8,9]),ze=(At=void 0,$(de[pe])),Fe=ze.next(),Ue.label=3;case 3:return Fe.done?[3,6]:(xe=Fe.value,[4,xe]);case 4:Ue.sent(),Ue.label=5;case 5:return Fe=ze.next(),[3,3];case 6:return[3,9];case 7:return _e=Ue.sent(),At={error:_e},[3,9];case 8:try{Fe&&!Fe.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,Fe=pe.value;return Ie.setElement(ze,Fe)}),Object.freeze(this)}Object.freeze(Ce),k.default=Ce},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(r,g,k){var V=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(Fe){return pe([ze,Fe])}}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(Fe){ze=[6,Fe],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(k,"__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,Fe="";if(typeof pe=="number")ze=Math.floor(pe),ze=(ze<<5)-ze,ze=ze&ze;else{typeof pe!="string"?Fe=JSON.stringify(pe):Fe=pe;for(var xe=0;xe<Fe.length;xe++){var _e=Fe.charCodeAt(xe);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(Fe){Fe.forEach(function(xe){pe(xe,ze++)})})};var he=function(pe){if(!(pe>=Ce.maxSize)){Ne=pe*2;var ze=[];de.forEach(function(Fe,xe){if(!Fe.empty()){if(Fe instanceof re.default&&Fe.size()===1){var _e=Fe.front();if(_e===void 0)throw new Error("unknown error");ze[le(_e)&Ne-1]=new re.default([_e])}else if(Fe instanceof oe.default){var At=new re.default,$e=new re.default;Fe.forEach(function(Oe){var Dt=le(Oe);Dt&pe?$e.pushBack(Oe):At.pushBack(Oe)}),At.size()>Ce.untreeifyThreshold?ze[xe]=new oe.default(At):At.size()&&(ze[xe]=At),$e.size()>Ce.untreeifyThreshold?ze[xe+pe]=new oe.default($e):$e.size()&&(ze[xe+pe]=$e)}else{var Ue=new re.default,Ve=new re.default;Fe.forEach(function(Oe){var Dt=le(Oe);Dt&pe?Ve.pushBack(Oe):Ue.pushBack(Oe)}),Ue.size()&&(ze[xe]=Ue),Ve.size()&&(ze[xe+pe]=Ve)}de[xe].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 Fe=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 xe=de[ze].size();ue+=xe-Fe}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.eraseElementByValue=function(pe){var ze=le(pe)&Ne-1;if(de[ze]){var Fe=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 xe=de[ze].size();ue+=xe-Fe}},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,Fe,xe,_e,At,$e;return V(this,function(Ue){switch(Ue.label){case 0:pe=0,Ue.label=1;case 1:if(!(pe<Ne))return[3,10];for(;pe<Ne&&!de[pe];)++pe;if(pe>=Ne)return[3,10];Ue.label=2;case 2:Ue.trys.push([2,7,8,9]),ze=(At=void 0,$(de[pe])),Fe=ze.next(),Ue.label=3;case 3:return Fe.done?[3,6]:(xe=Fe.value,[4,xe]);case 4:Ue.sent(),Ue.label=5;case 5:return Fe=ze.next(),[3,3];case 6:return[3,9];case 7:return _e=Ue.sent(),At={error:_e},[3,9];case 8:try{Fe&&!Fe.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),k.default=Ce},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(r,g,k){var V=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(k,"__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 V(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),k.default=oe},{}],30:[function(r,g,k){var V=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(k,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(Oe,Dt){return Oe<Dt?-1:Oe>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(Oe){if(!Oe||Oe.key===void 0)throw new Error("unknown error");return Oe.leftChild?ue(Oe.leftChild):Oe},de=function(Oe){if(!Oe||Oe.key===void 0)throw new Error("unknown error");return Oe.rightChild?de(Oe.rightChild):Oe};this.front=function(){if(!this.empty()){var Oe=ue(Ie);if(Oe.key===void 0||Oe.value===void 0)throw new Error("unknown error");return{key:Oe.key,value:Oe.value}}},this.back=function(){if(!this.empty()){var Oe=de(Ie);if(Oe.key===void 0||Oe.value===void 0)throw new Error("unknown error");return{key:Oe.key,value:Oe.value}}},this.forEach=function(Oe){var Dt,qe,kt=0;try{for(var Lt=$(this),jt=Lt.next();!jt.done;jt=Lt.next()){var ti=jt.value;Oe(ti,kt++)}}catch(ei){Dt={error:ei}}finally{try{jt&&!jt.done&&(qe=Lt.return)&&qe.call(Lt)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(Oe){var Dt,qe;if(Oe<0||Oe>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var Lt=$(this),jt=Lt.next();!jt.done;jt=Lt.next()){var ti=jt.value;if(kt===Oe)return ti;++kt}}catch(ei){Dt={error:ei}}finally{try{jt&&!jt.done&&(qe=Lt.return)&&qe.call(Lt)}finally{if(Dt)throw Dt.error}}throw new Error("unknown Error")};var Ne=function(Oe,Dt){if(!(!Oe||Oe.key===void 0||Oe.value===void 0)){var qe=ie(Oe.key,Dt);return qe===0?{key:Oe.key,value:Oe.value}:qe<0?Ne(Oe.rightChild,Dt):Ne(Oe.leftChild,Dt)||{key:Oe.key,value:Oe.value}}};this.lowerBound=function(Oe){return Ne(Ie,Oe)};var he=function(Oe,Dt){if(!(!Oe||Oe.key===void 0||Oe.value===void 0)){var qe=ie(Oe.key,Dt);return qe<=0?he(Oe.rightChild,Dt):he(Oe.leftChild,Dt)||{key:Oe.key,value:Oe.value}}};this.upperBound=function(Oe){return he(Ie,Oe)};var pe=function(Oe,Dt){if(!(!Oe||Oe.key===void 0||Oe.value===void 0)){var qe=ie(Oe.key,Dt);return qe===0?{key:Oe.key,value:Oe.value}:qe>0?pe(Oe.leftChild,Dt):pe(Oe.rightChild,Dt)||{key:Oe.key,value:Oe.value}}};this.reverseLowerBound=function(Oe){return pe(Ie,Oe)};var ze=function(Oe,Dt){if(!(!Oe||Oe.key===void 0||Oe.value===void 0)){var qe=ie(Oe.key,Dt);return qe>=0?ze(Oe.leftChild,Dt):ze(Oe.rightChild,Dt)||{key:Oe.key,value:Oe.value}}};this.reverseUpperBound=function(Oe){return ze(Ie,Oe)};var Fe=function(Oe){var Dt=Oe.parent;if(!Dt){if(Oe===Ie)return;throw new Error("unknown error")}if(Oe.color===oe.default.TreeNodeColorType.red){Oe.color=oe.default.TreeNodeColorType.black;return}var qe=Oe.brother;if(!qe)throw new Error("unknown error");if(Oe===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),Fe(Oe)}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),Oe.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),Fe(Oe)}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,Fe(Dt))}else if(Oe===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),Fe(Oe)}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),Oe.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),Fe(Oe)}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,Fe(Dt))}},xe=function(Oe){for(var Dt=Oe;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=Oe.key;Oe.key=Dt.key,Dt.key=qe;var kt=Oe.value;Oe.value=Dt.value,Dt.value=kt,Oe=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=Oe.key;Oe.key=Dt.key,Dt.key=qe;var kt=Oe.value;Oe.value=Dt.value,Dt.value=kt,Oe=Dt}}Fe(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},_e=function(Oe,Dt){if(!Oe||Oe.key===void 0)return!1;var qe=_e(Oe.leftChild,Dt);return qe||Dt(Oe)?!0:_e(Oe.rightChild,Dt)};this.eraseElementByPos=function(Oe){if(Oe<0||Oe>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;_e(Ie,function(qe){return Oe===Dt?(xe(qe),!0):(++Dt,!1)})},this.eraseElementByKey=function(Oe){if(!this.empty()){var Dt=Ue(Ie,Oe);Dt===void 0||Dt.key===void 0||ie(Dt.key,Oe)!==0||xe(Dt)}};var At=function(Oe,Dt){if(!Oe||Oe.key===void 0)throw new Error("unknown error");var qe=ie(Dt,Oe.key);return qe<0?Oe.leftChild?At(Oe.leftChild,Dt):(Oe.leftChild=new oe.default,Oe.leftChild.parent=Oe,Oe.leftChild.brother=Oe.rightChild,Oe.rightChild&&(Oe.rightChild.brother=Oe.leftChild),Oe.leftChild):qe>0?Oe.rightChild?At(Oe.rightChild,Dt):(Oe.rightChild=new oe.default,Oe.rightChild.parent=Oe,Oe.rightChild.brother=Oe.leftChild,Oe.leftChild&&(Oe.leftChild.brother=Oe.rightChild),Oe.rightChild):Oe},$e=function(Oe){var Dt=Oe.parent;if(!Dt){if(Oe===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(Oe===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Lt=kt.rotateRight();kt===Ie&&(Ie=Lt)}else if(Oe===Dt.rightChild){var Lt=Dt.rotateLeft();kt===Ie&&(Ie=Lt),$e(Dt)}}else if(Dt===kt.rightChild){if(Oe===Dt.leftChild){var Lt=Dt.rotateRight();kt===Ie&&(Ie=Lt),$e(Dt)}else if(Oe===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Lt=kt.rotateLeft();kt===Ie&&(Ie=Lt)}}}}};this.setElement=function(Oe,Dt){if(Oe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(Dt==null){this.eraseElementByKey(Oe);return}if(this.empty()){++le,Ie.key=Oe,Ie.value=Dt,Ie.color=oe.default.TreeNodeColorType.black;return}var qe=At(Ie,Oe);if(qe.key!==void 0&&ie(qe.key,Oe)===0){qe.value=Dt;return}++le,qe.key=Oe,qe.value=Dt,$e(qe),Ie.color=oe.default.TreeNodeColorType.black};var Ue=function(Oe,Dt){if(!(!Oe||Oe.key===void 0)){var qe=ie(Dt,Oe.key);return qe<0?Ue(Oe.leftChild,Dt):qe>0?Ue(Oe.rightChild,Dt):Oe}};this.find=function(Oe){return!!Ue(Ie,Oe)},this.getElementByKey=function(Oe){var Dt=Ue(Ie,Oe);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(Oe){var Dt=this;Oe.forEach(function(qe){var kt=qe.key,Lt=qe.value;return Dt.setElement(kt,Lt)})},this.getHeight=function(){if(this.empty())return 0;var Oe=function(Dt){return Dt?Math.max(Oe(Dt.leftChild),Oe(Dt.rightChild))+1:1};return Oe(Ie)};var Ve=function(Oe){return V(this,function(Dt){switch(Dt.label){case 0:return!Oe||Oe.key===void 0||Oe.value===void 0?[2]:[5,$(Ve(Oe.leftChild))];case 1:return Dt.sent(),[4,{key:Oe.key,value:Oe.value}];case 2:return Dt.sent(),[5,$(Ve(Oe.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ve(Ie)},Ce.forEach(function(Oe){var Dt=Oe.key,qe=Oe.value;return ae.setElement(Dt,qe)}),Object.freeze(this)}Object.freeze(re),k.default=re},{"../Base/TreeNode":25}],31:[function(r,g,k){Object.defineProperty(k,"__esModule",{value:!0});function V($,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(V),k.default=V},{}],32:[function(r,g,k){Object.defineProperty(k,"__esModule",{value:!0});var V=r("../LinkList/LinkList");function $(oe){oe===void 0&&(oe=[]);var re=new V.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($),k.default=$},{"../LinkList/LinkList":29}],33:[function(r,g,k){var V=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(k,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(Oe,Dt){return Oe<Dt?-1:Oe>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(Oe){if(!Oe||Oe.key===void 0)throw new Error("unknown error");return Oe.leftChild?ue(Oe.leftChild):Oe},de=function(Oe){if(!Oe||Oe.key===void 0)throw new Error("unknown error");return Oe.rightChild?de(Oe.rightChild):Oe};this.front=function(){if(!this.empty()){var Oe=ue(Ie);return Oe.key}},this.back=function(){if(!this.empty()){var Oe=de(Ie);return Oe.key}},this.forEach=function(Oe){var Dt,qe,kt=0;try{for(var Lt=$(this),jt=Lt.next();!jt.done;jt=Lt.next()){var ti=jt.value;Oe(ti,kt++)}}catch(ei){Dt={error:ei}}finally{try{jt&&!jt.done&&(qe=Lt.return)&&qe.call(Lt)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(Oe){var Dt,qe;if(Oe<0||Oe>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var Lt=$(this),jt=Lt.next();!jt.done;jt=Lt.next()){var ti=jt.value;if(kt===Oe)return ti;++kt}}catch(ei){Dt={error:ei}}finally{try{jt&&!jt.done&&(qe=Lt.return)&&qe.call(Lt)}finally{if(Dt)throw Dt.error}}throw new Error("unknown error")};var Ne=function(Oe){var Dt=Oe.parent;if(!Dt){if(Oe===Ie)return;throw new Error("unknown error")}if(Oe.color===oe.default.TreeNodeColorType.red){Oe.color=oe.default.TreeNodeColorType.black;return}var qe=Oe.brother;if(!qe)throw new Error("unknown error");if(Oe===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(Oe)}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),Oe.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(Oe)}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(Oe===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(Oe)}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),Oe.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(Oe)}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(Oe){for(var Dt=Oe;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=Oe.key;Oe.key=Dt.key,Dt.key=qe,Oe=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=Oe.key;Oe.key=Dt.key,Dt.key=qe,Oe=Dt}}Ne(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},pe=function(Oe,Dt){if(!Oe||Oe.key===void 0)return!1;var qe=pe(Oe.leftChild,Dt);return qe||Dt(Oe)?!0:pe(Oe.rightChild,Dt)};this.eraseElementByPos=function(Oe){if(Oe<0||Oe>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;pe(Ie,function(qe){return Oe===Dt?(he(qe),!0):(++Dt,!1)})},this.eraseElementByValue=function(Oe){if(!this.empty()){var Dt=xe(Ie,Oe);Dt===void 0||Dt.key===void 0||ie(Dt.key,Oe)!==0||he(Dt)}};var ze=function(Oe,Dt){if(!Oe||Oe.key===void 0)throw new Error("unknown error");var qe=ie(Dt,Oe.key);return qe<0?Oe.leftChild?ze(Oe.leftChild,Dt):(Oe.leftChild=new oe.default,Oe.leftChild.parent=Oe,Oe.leftChild.brother=Oe.rightChild,Oe.rightChild&&(Oe.rightChild.brother=Oe.leftChild),Oe.leftChild):qe>0?Oe.rightChild?ze(Oe.rightChild,Dt):(Oe.rightChild=new oe.default,Oe.rightChild.parent=Oe,Oe.rightChild.brother=Oe.leftChild,Oe.leftChild&&(Oe.leftChild.brother=Oe.rightChild),Oe.rightChild):Oe},Fe=function(Oe){var Dt=Oe.parent;if(!Dt){if(Oe===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,Fe(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(Oe===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Lt=kt.rotateRight();kt===Ie&&(Ie=Lt)}else if(Oe===Dt.rightChild){var Lt=Dt.rotateLeft();kt===Ie&&(Ie=Lt),Fe(Dt)}}else if(Dt===kt.rightChild){if(Oe===Dt.leftChild){var Lt=Dt.rotateRight();kt===Ie&&(Ie=Lt),Fe(Dt)}else if(Oe===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Lt=kt.rotateLeft();kt===Ie&&(Ie=Lt)}}}}};this.insert=function(Oe){if(Oe==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=Oe,Ie.color=oe.default.TreeNodeColorType.black;return}var Dt=ze(Ie,Oe);Dt.key!==void 0&&ie(Dt.key,Oe)===0||(++le,Dt.key=Oe,Fe(Dt),Ie.color=oe.default.TreeNodeColorType.black)};var xe=function(Oe,Dt){if(!(!Oe||Oe.key===void 0)){var qe=ie(Dt,Oe.key);return qe<0?xe(Oe.leftChild,Dt):qe>0?xe(Oe.rightChild,Dt):Oe}};this.find=function(Oe){var Dt=xe(Ie,Oe);return Dt!==void 0&&Dt.key!==void 0&&ie(Dt.key,Oe)===0};var _e=function(Oe,Dt){if(!(!Oe||Oe.key===void 0)){var qe=ie(Oe.key,Dt);if(qe===0)return Oe.key;if(qe<0)return _e(Oe.rightChild,Dt);var kt=_e(Oe.leftChild,Dt);return kt!==void 0?kt:Oe.key}};this.lowerBound=function(Oe){return _e(Ie,Oe)};var At=function(Oe,Dt){if(!(!Oe||Oe.key===void 0)){var qe=ie(Oe.key,Dt);if(qe<=0)return At(Oe.rightChild,Dt);var kt=At(Oe.leftChild,Dt);return kt!==void 0?kt:Oe.key}};this.upperBound=function(Oe){return At(Ie,Oe)};var $e=function(Oe,Dt){if(!(!Oe||Oe.key===void 0)){var qe=ie(Oe.key,Dt);if(qe===0)return Oe.key;if(qe>0)return $e(Oe.leftChild,Dt);var kt=$e(Oe.rightChild,Dt);return kt!==void 0?kt:Oe.key}};this.reverseLowerBound=function(Oe){return $e(Ie,Oe)};var Ue=function(Oe,Dt){if(!(!Oe||Oe.key===void 0)){var qe=ie(Oe.key,Dt);if(qe>=0)return Ue(Oe.leftChild,Dt);var kt=Ue(Oe.rightChild,Dt);return kt!==void 0?kt:Oe.key}};this.reverseUpperBound=function(Oe){return Ue(Ie,Oe)},this.union=function(Oe){var Dt=this;Oe.forEach(function(qe){return Dt.insert(qe)})},this.getHeight=function(){if(this.empty())return 0;var Oe=function(Dt){return Dt?Math.max(Oe(Dt.leftChild),Oe(Dt.rightChild))+1:1};return Oe(Ie)};var Ve=function(Oe){return V(this,function(Dt){switch(Dt.label){case 0:return!Oe||Oe.key===void 0?[2]:[5,$(Ve(Oe.leftChild))];case 1:return Dt.sent(),[4,Oe.key];case 2:return Dt.sent(),[5,$(Ve(Oe.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ve(Ie)},Ce.forEach(function(Oe){return ae.insert(Oe)}),Object.freeze(this)}Object.freeze(re),k.default=re},{"../Base/TreeNode":25}],34:[function(r,g,k){Object.defineProperty(k,"__esModule",{value:!0});function V($){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(V),k.default=V},{}],35:[function(r,g,k){var V=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(Fe){return pe([ze,Fe])}}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(Fe){ze=[6,Fe],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(k,"__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 V(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),k.default=Ce},{}],36:[function(r,g,k){Object.defineProperty(k,"__esModule",{value:!0}),k.HashMap=k.HashSet=k.Map=k.Set=k.PriorityQueue=k.Deque=k.LinkList=k.Queue=k.Stack=k.Vector=void 0;var V=r("./Vector/Vector");k.Vector=V.default;var $=r("./Stack/Stack");k.Stack=$.default;var oe=r("./Queue/Queue");k.Queue=oe.default;var re=r("./LinkList/LinkList");k.LinkList=re.default;var Ce=r("./Deque/Deque");k.Deque=Ce.default;var ie=r("./PriorityQueue/PriorityQueue");k.PriorityQueue=ie.default;var ae=r("./Set/Set");k.Set=ae.default;var le=r("./Map/Map");k.Map=le.default;var Ie=r("./HashSet/HashSet");k.HashSet=Ie.default;var ue=r("./HashMap/HashMap");k.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,k){const V=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(Ue){if(typeof Ue=="number"&&(Ue={max:Ue}),Ue||(Ue={}),Ue.max&&(typeof Ue.max!="number"||Ue.max<0))throw new TypeError("max must be a non-negative number");this[$]=Ue.max||1/0;const Ve=Ue.length||Ne;if(this[re]=typeof Ve!="function"?Ne:Ve,this[Ce]=Ue.stale||!1,Ue.maxAge&&typeof Ue.maxAge!="number")throw new TypeError("maxAge must be a number");this[ie]=Ue.maxAge||0,this[ae]=Ue.dispose,this[le]=Ue.noDisposeOnSet||!1,this[de]=Ue.updateAgeOnGet||!1,this.reset()}set max(Ue){if(typeof Ue!="number"||Ue<0)throw new TypeError("max must be a non-negative number");this[$]=Ue||1/0,Fe(this)}get max(){return this[$]}set allowStale(Ue){this[Ce]=!!Ue}get allowStale(){return this[Ce]}set maxAge(Ue){if(typeof Ue!="number")throw new TypeError("maxAge must be a non-negative number");this[ie]=Ue,Fe(this)}get maxAge(){return this[ie]}set lengthCalculator(Ue){typeof Ue!="function"&&(Ue=Ne),Ue!==this[re]&&(this[re]=Ue,this[oe]=0,this[Ie].forEach(Ve=>{Ve.length=this[re](Ve.value,Ve.key),this[oe]+=Ve.length})),Fe(this)}get lengthCalculator(){return this[re]}get length(){return this[oe]}get itemCount(){return this[Ie].length}rforEach(Ue,Ve){Ve=Ve||this;for(let Oe=this[Ie].tail;Oe!==null;){const Dt=Oe.prev;At(this,Ue,Oe,Ve),Oe=Dt}}forEach(Ue,Ve){Ve=Ve||this;for(let Oe=this[Ie].head;Oe!==null;){const Dt=Oe.next;At(this,Ue,Oe,Ve),Oe=Dt}}keys(){return this[Ie].toArray().map(Ue=>Ue.key)}values(){return this[Ie].toArray().map(Ue=>Ue.value)}reset(){this[ae]&&this[Ie]&&this[Ie].length&&this[Ie].forEach(Ue=>this[ae](Ue.key,Ue.value)),this[ue]=new Map,this[Ie]=new V,this[oe]=0}dump(){return this[Ie].map(Ue=>ze(this,Ue)?!1:{k:Ue.key,v:Ue.value,e:Ue.now+(Ue.maxAge||0)}).toArray().filter(Ue=>Ue)}dumpLru(){return this[Ie]}set(Ue,Ve,Oe){if(Oe=Oe||this[ie],Oe&&typeof Oe!="number")throw new TypeError("maxAge must be a number");const Dt=Oe?Date.now():0,qe=this[re](Ve,Ue);if(this[ue].has(Ue)){if(qe>this[$])return xe(this,this[ue].get(Ue)),!1;const jt=this[ue].get(Ue).value;return this[ae]&&(this[le]||this[ae](Ue,jt.value)),jt.now=Dt,jt.maxAge=Oe,jt.value=Ve,this[oe]+=qe-jt.length,jt.length=qe,this.get(Ue),Fe(this),!0}const kt=new _e(Ue,Ve,qe,Dt,Oe);return kt.length>this[$]?(this[ae]&&this[ae](Ue,Ve),!1):(this[oe]+=kt.length,this[Ie].unshift(kt),this[ue].set(Ue,this[Ie].head),Fe(this),!0)}has(Ue){if(!this[ue].has(Ue))return!1;const Ve=this[ue].get(Ue).value;return!ze(this,Ve)}get(Ue){return pe(this,Ue,!0)}peek(Ue){return pe(this,Ue,!1)}pop(){const Ue=this[Ie].tail;return Ue?(xe(this,Ue),Ue.value):null}del(Ue){xe(this,this[ue].get(Ue))}load(Ue){this.reset();const Ve=Date.now();for(let Oe=Ue.length-1;Oe>=0;Oe--){const Dt=Ue[Oe],qe=Dt.e||0;if(qe===0)this.set(Dt.k,Dt.v);else{const kt=qe-Ve;kt>0&&this.set(Dt.k,Dt.v,kt)}}}prune(){this[ue].forEach((Ue,Ve)=>pe(this,Ve,!1))}}const pe=($e,Ue,Ve)=>{const Oe=$e[ue].get(Ue);if(Oe){const Dt=Oe.value;if(ze($e,Dt)){if(xe($e,Oe),!$e[Ce])return}else Ve&&($e[de]&&(Oe.value.now=Date.now()),$e[Ie].unshiftNode(Oe));return Dt.value}},ze=($e,Ue)=>{if(!Ue||!Ue.maxAge&&!$e[ie])return!1;const Ve=Date.now()-Ue.now;return Ue.maxAge?Ve>Ue.maxAge:$e[ie]&&Ve>$e[ie]},Fe=$e=>{if($e[oe]>$e[$])for(let Ue=$e[Ie].tail;$e[oe]>$e[$]&&Ue!==null;){const Ve=Ue.prev;xe($e,Ue),Ue=Ve}},xe=($e,Ue)=>{if(Ue){const Ve=Ue.value;$e[ae]&&$e[ae](Ve.key,Ve.value),$e[oe]-=Ve.length,$e[ue].delete(Ve.key),$e[Ie].removeNode(Ue)}};class _e{constructor(Ue,Ve,Oe,Dt,qe){this.key=Ue,this.value=Ve,this.length=Oe,this.now=Dt,this.maxAge=qe||0}}const At=($e,Ue,Ve,Oe)=>{let Dt=Ve.value;ze($e,Dt)&&(xe($e,Ve),$e[Ce]||(Dt=void 0)),Dt&&Ue.call(Oe,Dt.value,Dt.key,$e)};g.exports=he},{yallist:83}],38:[function(r,g,k){(function(V){(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=V.from([$.SESSIONPRESENT_MASK]),$.CONNACK_HEADER=V.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=V.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=V.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=V.from([$.codes.suback<<$.CMD_SHIFT]),$.VERSION3=V.from([3]),$.VERSION4=V.from([4]),$.VERSION5=V.from([5]),$.VERSION131=V.from([131]),$.VERSION132=V.from([132]),$.QOS=[0,1,2].map(re=>V.from([re])),$.EMPTY={pingreq:V.from([$.codes.pingreq<<4,0]),pingresp:V.from([$.codes.pingresp<<4,0]),disconnect:V.from([$.codes.disconnect<<4,0])}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],39:[function(r,g,k){(function(V){(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]=V.byteLength(Ie[de]),ae+=le[de];const Ne=V.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,k){k.parser=r("./parser").parser,k.generate=r("./generate"),k.writeToStream=r("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(r,g,k){(function(V){(function(){const oe={},re=V.isBuffer(V.from([1,2]).subarray(0,1));function Ce(Ie){const ue=V.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=V.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=V.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,k){class V{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}g.exports=V},{}],43:[function(r,g,k){const V=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=V(),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 Fe=this._parseProperties();Object.getOwnPropertyNames(Fe).length&&(he.properties=Fe)}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 Fe=this._parseProperties();Object.getOwnPropertyNames(Fe).length&&(he.will.properties=Fe)}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 Fe=this._parseProperties();Object.getOwnPropertyNames(Fe).length&&(le.properties=Fe)}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,k){(function(V){(function(){const $=r("./constants"),oe=V.allocUnsafe(0),re=V.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(wi,Ci,zi){switch(ae("generate called"),Ci.cork&&(Ci.cork(),ie(Fe,Ci)),pe&&(pe=!1,ue()),ae("generate: packet.cmd: %s",wi.cmd),wi.cmd){case"connect":return xe(wi,Ci);case"connack":return _e(wi,Ci,zi);case"publish":return At(wi,Ci,zi);case"puback":case"pubrec":case"pubrel":case"pubcomp":return $e(wi,Ci,zi);case"subscribe":return Ue(wi,Ci,zi);case"suback":return Ve(wi,Ci,zi);case"unsubscribe":return Oe(wi,Ci,zi);case"unsuback":return Dt(wi,Ci,zi);case"pingreq":case"pingresp":return qe(wi,Ci);case"disconnect":return kt(wi,Ci,zi);case"auth":return Lt(wi,Ci,zi);default:return Ci.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(ze,"cacheNumbers",{get(){return he===ni},set(wi){wi?((!le||Object.keys(le).length===0)&&(pe=!0),he=ni):(pe=!1,he=ri)}});function Fe(wi){wi.uncork()}function xe(wi,Ci,zi){const Mi=wi||{},di=Mi.protocolId||"MQTT";let pi=Mi.protocolVersion||4;const Si=Mi.will;let bi=Mi.clean;const ai=Mi.keepalive||0,Ii=Mi.clientId||"",oi=Mi.username,Et=Mi.password,ii=Mi.properties;bi===void 0&&(bi=!0);let gi=0;if(!di||typeof di!="string"&&!V.isBuffer(di))return Ci.emit("error",new Error("Invalid protocolId")),!1;if(gi+=di.length+2,pi!==3&&pi!==4&&pi!==5)return Ci.emit("error",new Error("Invalid protocol version")),!1;if(gi+=1,(typeof Ii=="string"||V.isBuffer(Ii))&&(Ii||pi>=4)&&(Ii||bi))gi+=V.byteLength(Ii)+2;else{if(pi<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 ai!="number"||ai<0||ai>65535||ai%1!==0)return Ci.emit("error",new Error("Invalid keepalive")),!1;if(gi+=2,gi+=1,pi===5){var mi=si(Ci,ii);if(!mi)return!1;gi+=mi.length}if(Si){if(typeof Si!="object")return Ci.emit("error",new Error("Invalid will")),!1;if(!Si.topic||typeof Si.topic!="string")return Ci.emit("error",new Error("Invalid will topic")),!1;if(gi+=V.byteLength(Si.topic)+2,gi+=2,Si.payload)if(Si.payload.length>=0)typeof Si.payload=="string"?gi+=V.byteLength(Si.payload):gi+=Si.payload.length;else return Ci.emit("error",new Error("Invalid will payload")),!1;var fi={};if(pi===5){if(fi=si(Ci,Si.properties),!fi)return!1;gi+=fi.length}}let vi=!1;if(oi!=null)if(yi(oi))vi=!0,gi+=V.byteLength(oi)+2;else return Ci.emit("error",new Error("Invalid username")),!1;if(Et!=null){if(!vi)return Ci.emit("error",new Error("Username is required to use password")),!1;if(yi(Et))gi+=Ni(Et)+2;else return Ci.emit("error",new Error("Invalid password")),!1}Ci.write($.CONNECT_HEADER),ti(Ci,gi),li(Ci,di),Mi.bridgeMode&&(pi+=128),Ci.write(pi===131?$.VERSION131:pi===132?$.VERSION132:pi===4?$.VERSION4:pi===5?$.VERSION5:$.VERSION3);let xi=0;return xi|=oi!=null?$.USERNAME_MASK:0,xi|=Et!=null?$.PASSWORD_MASK:0,xi|=Si&&Si.retain?$.WILL_RETAIN_MASK:0,xi|=Si&&Si.qos?Si.qos<<$.WILL_QOS_SHIFT:0,xi|=Si?$.WILL_FLAG_MASK:0,xi|=bi?$.CLEAN_SESSION_MASK:0,Ci.write(V.from([xi])),he(Ci,ai),pi===5&&mi.write(),li(Ci,Ii),Si&&(pi===5&&fi.write(),ei(Ci,Si.topic),li(Ci,Si.payload)),oi!=null&&li(Ci,oi),Et!=null&&li(Ci,Et),!0}function _e(wi,Ci,zi){const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=Mi===5?di.reasonCode:di.returnCode,Si=di.properties;let bi=2;if(typeof pi!="number")return Ci.emit("error",new Error("Invalid return code")),!1;let ai=null;if(Mi===5){if(ai=si(Ci,Si),!ai)return!1;bi+=ai.length}return Ci.write($.CONNACK_HEADER),ti(Ci,bi),Ci.write(di.sessionPresent?$.SESSIONPRESENT_HEADER:re),Ci.write(V.from([pi])),ai!=null&&ai.write(),!0}function At(wi,Ci,zi){ae("publish: packet: %o",wi);const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=di.qos||0,Si=di.retain?$.RETAIN_MASK:0,bi=di.topic,ai=di.payload||oe,Ii=di.messageId,oi=di.properties;let Et=0;if(typeof bi=="string")Et+=V.byteLength(bi)+2;else if(V.isBuffer(bi))Et+=bi.length+2;else return Ci.emit("error",new Error("Invalid topic")),!1;if(V.isBuffer(ai)?Et+=ai.length:Et+=V.byteLength(ai),pi&&typeof Ii!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;pi&&(Et+=2);let ii=null;if(Mi===5){if(ii=si(Ci,oi),!ii)return!1;Et+=ii.length}return Ci.write($.PUBLISH_HEADER[pi][di.dup?1:0][Si?1:0]),ti(Ci,Et),he(Ci,Ni(bi)),Ci.write(bi),pi>0&&he(Ci,Ii),ii!=null&&ii.write(),ae("publish: payload: %o",ai),Ci.write(ai)}function $e(wi,Ci,zi){const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=di.cmd||"puback",Si=di.messageId,bi=di.dup&&pi==="pubrel"?$.DUP_MASK:0;let ai=0;const Ii=di.reasonCode,oi=di.properties;let Et=Mi===5?3:2;if(pi==="pubrel"&&(ai=1),typeof Si!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;let ii=null;if(Mi===5&&typeof oi=="object"){if(ii=ui(Ci,oi,zi,Et),!ii)return!1;Et+=ii.length}return Ci.write($.ACKS[pi][ai][bi][0]),ti(Ci,Et),he(Ci,Si),Mi===5&&Ci.write(V.from([Ii])),ii!==null&&ii.write(),!0}function Ue(wi,Ci,zi){ae("subscribe: packet: ");const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=di.dup?$.DUP_MASK:0,Si=di.messageId,bi=di.subscriptions,ai=di.properties;let Ii=0;if(typeof Si!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;Ii+=2;let oi=null;if(Mi===5){if(oi=si(Ci,ai),!oi)return!1;Ii+=oi.length}if(typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){const gi=bi[ii].topic,mi=bi[ii].qos;if(typeof gi!="string")return Ci.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Mi===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}Ii+=V.byteLength(gi)+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][pi?1:0][0]),ti(Ci,Ii),he(Ci,Si),oi!==null&&oi.write();let Et=!0;for(const ii of bi){const gi=ii.topic,mi=ii.qos,fi=+ii.nl,vi=+ii.rap,xi=ii.rh;let Gi;ei(Ci,gi),Gi=$.SUBSCRIBE_OPTIONS_QOS[mi],Mi===5&&(Gi|=fi?$.SUBSCRIBE_OPTIONS_NL:0,Gi|=vi?$.SUBSCRIBE_OPTIONS_RAP:0,Gi|=xi?$.SUBSCRIBE_OPTIONS_RH[xi]:0),Et=Ci.write(V.from([Gi]))}return Et}function Ve(wi,Ci,zi){const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=di.messageId,Si=di.granted,bi=di.properties;let ai=0;if(typeof pi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(ai+=2,typeof Si=="object"&&Si.length)for(let oi=0;oi<Si.length;oi+=1){if(typeof Si[oi]!="number")return Ci.emit("error",new Error("Invalid qos vector")),!1;ai+=1}else return Ci.emit("error",new Error("Invalid qos vector")),!1;let Ii=null;if(Mi===5){if(Ii=ui(Ci,bi,zi,ai),!Ii)return!1;ai+=Ii.length}return Ci.write($.SUBACK_HEADER),ti(Ci,ai),he(Ci,pi),Ii!==null&&Ii.write(),Ci.write(V.from(Si))}function Oe(wi,Ci,zi){const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=di.messageId,Si=di.dup?$.DUP_MASK:0,bi=di.unsubscriptions,ai=di.properties;let Ii=0;if(typeof pi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(Ii+=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;Ii+=V.byteLength(bi[ii])+2}else return Ci.emit("error",new Error("Invalid unsubscriptions")),!1;let oi=null;if(Mi===5){if(oi=si(Ci,ai),!oi)return!1;Ii+=oi.length}Ci.write($.UNSUBSCRIBE_HEADER[1][Si?1:0][0]),ti(Ci,Ii),he(Ci,pi),oi!==null&&oi.write();let Et=!0;for(let ii=0;ii<bi.length;ii++)Et=ei(Ci,bi[ii]);return Et}function Dt(wi,Ci,zi){const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=di.messageId,Si=di.dup?$.DUP_MASK:0,bi=di.granted,ai=di.properties,Ii=di.cmd,oi=0;let Et=2;if(typeof pi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(Mi===5)if(typeof bi=="object"&&bi.length)for(let gi=0;gi<bi.length;gi+=1){if(typeof bi[gi]!="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(Mi===5){if(ii=ui(Ci,ai,zi,Et),!ii)return!1;Et+=ii.length}return Ci.write($.ACKS[Ii][oi][Si][0]),ti(Ci,Et),he(Ci,pi),ii!==null&&ii.write(),Mi===5&&Ci.write(V.from(bi)),!0}function qe(wi,Ci,zi){return Ci.write($.EMPTY[wi.cmd])}function kt(wi,Ci,zi){const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=di.reasonCode,Si=di.properties;let bi=Mi===5?1:0,ai=null;if(Mi===5){if(ai=ui(Ci,Si,zi,bi),!ai)return!1;bi+=ai.length}return Ci.write(V.from([$.codes.disconnect<<4])),ti(Ci,bi),Mi===5&&Ci.write(V.from([pi])),ai!==null&&ai.write(),!0}function Lt(wi,Ci,zi){const Mi=zi?zi.protocolVersion:4,di=wi||{},pi=di.reasonCode,Si=di.properties;let bi=Mi===5?1:0;Mi!==5&&Ci.emit("error",new Error("Invalid mqtt version for auth packet"));const ai=ui(Ci,Si,zi,bi);return ai?(bi+=ai.length,Ci.write(V.from([$.codes.auth<<4])),ti(Ci,bi),Ci.write(V.from([pi])),ai!==null&&ai.write(),!0):!1}const jt={};function ti(wi,Ci){if(Ci>$.VARBYTEINT_MAX)return wi.emit("error",new Error(`Invalid variable byte integer: ${Ci}`)),!1;let zi=jt[Ci];return zi||(zi=de(Ci),Ci<16384&&(jt[Ci]=zi)),ae("writeVarByteInt: writing to stream: %o",zi),wi.write(zi)}function ei(wi,Ci){const zi=V.byteLength(Ci);return he(wi,zi),ae("writeString: %s",Ci),wi.write(Ci,"utf8")}function Pt(wi,Ci,zi){ei(wi,Ci),ei(wi,zi)}function ni(wi,Ci){return ae("writeNumberCached: number: %d",Ci),ae("writeNumberCached: %o",le[Ci]),wi.write(le[Ci])}function ri(wi,Ci){const zi=Ie(Ci);return ae("writeNumberGenerated: %o",zi),wi.write(zi)}function ci(wi,Ci){const zi=Ne(Ci);return ae("write4ByteNumber: %o",zi),wi.write(zi)}function li(wi,Ci){typeof Ci=="string"?ei(wi,Ci):Ci?(he(wi,Ci.length),wi.write(Ci)):he(wi,0)}function si(wi,Ci){if(typeof Ci!="object"||Ci.length!=null)return{length:1,write(){Ai(wi,{},0)}};let zi=0;function Mi(pi,Si){const bi=$.propertiesTypes[pi];let ai=0;switch(bi){case"byte":{if(typeof Si!="boolean")return wi.emit("error",new Error(`Invalid ${pi}: ${Si}`)),!1;ai+=1+1;break}case"int8":{if(typeof Si!="number"||Si<0||Si>255)return wi.emit("error",new Error(`Invalid ${pi}: ${Si}`)),!1;ai+=1+1;break}case"binary":{if(Si&&Si===null)return wi.emit("error",new Error(`Invalid ${pi}: ${Si}`)),!1;ai+=1+V.byteLength(Si)+2;break}case"int16":{if(typeof Si!="number"||Si<0||Si>65535)return wi.emit("error",new Error(`Invalid ${pi}: ${Si}`)),!1;ai+=1+2;break}case"int32":{if(typeof Si!="number"||Si<0||Si>4294967295)return wi.emit("error",new Error(`Invalid ${pi}: ${Si}`)),!1;ai+=1+4;break}case"var":{if(typeof Si!="number"||Si<0||Si>268435455)return wi.emit("error",new Error(`Invalid ${pi}: ${Si}`)),!1;ai+=1+V.byteLength(de(Si));break}case"string":{if(typeof Si!="string")return wi.emit("error",new Error(`Invalid ${pi}: ${Si}`)),!1;ai+=1+2+V.byteLength(Si.toString());break}case"pair":{if(typeof Si!="object")return wi.emit("error",new Error(`Invalid ${pi}: ${Si}`)),!1;ai+=Object.getOwnPropertyNames(Si).reduce((Ii,oi)=>{const Et=Si[oi];return Array.isArray(Et)?Ii+=Et.reduce((ii,gi)=>(ii+=1+2+V.byteLength(oi.toString())+2+V.byteLength(gi.toString()),ii),0):Ii+=1+2+V.byteLength(oi.toString())+2+V.byteLength(Si[oi].toString()),Ii},0);break}default:return wi.emit("error",new Error(`Invalid property ${pi}: ${Si}`)),!1}return ai}if(Ci)for(const pi in Ci){let Si=0,bi=0;const ai=Ci[pi];if(Array.isArray(ai))for(let Ii=0;Ii<ai.length;Ii++){if(bi=Mi(pi,ai[Ii]),!bi)return!1;Si+=bi}else{if(bi=Mi(pi,ai),!bi)return!1;Si=bi}if(!Si)return!1;zi+=Si}return{length:V.byteLength(de(zi))+zi,write(){Ai(wi,Ci,zi)}}}function ui(wi,Ci,zi,Mi){const di=["reasonString","userProperties"],pi=zi&&zi.properties&&zi.properties.maximumPacketSize?zi.properties.maximumPacketSize:0;let Si=si(wi,Ci);if(pi)for(;Mi+Si.length>pi;){const bi=di.shift();if(bi&&Ci[bi])delete Ci[bi],Si=si(wi,Ci);else return!1}return Si}function hi(wi,Ci,zi){switch($.propertiesTypes[Ci]){case"byte":{wi.write(V.from([$.properties[Ci]])),wi.write(V.from([+zi]));break}case"int8":{wi.write(V.from([$.properties[Ci]])),wi.write(V.from([zi]));break}case"binary":{wi.write(V.from([$.properties[Ci]])),li(wi,zi);break}case"int16":{wi.write(V.from([$.properties[Ci]])),he(wi,zi);break}case"int32":{wi.write(V.from([$.properties[Ci]])),ci(wi,zi);break}case"var":{wi.write(V.from([$.properties[Ci]])),ti(wi,zi);break}case"string":{wi.write(V.from([$.properties[Ci]])),ei(wi,zi);break}case"pair":{Object.getOwnPropertyNames(zi).forEach(di=>{const pi=zi[di];Array.isArray(pi)?pi.forEach(Si=>{wi.write(V.from([$.properties[Ci]])),Pt(wi,di.toString(),Si.toString())}):(wi.write(V.from([$.properties[Ci]])),Pt(wi,di.toString(),pi.toString()))});break}default:return wi.emit("error",new Error(`Invalid property ${Ci} value: ${zi}`)),!1}}function Ai(wi,Ci,zi){ti(wi,zi);for(const Mi in Ci)if(Object.prototype.hasOwnProperty.call(Ci,Mi)&&Ci[Mi]!==null){const di=Ci[Mi];if(Array.isArray(di))for(let pi=0;pi<di.length;pi++)hi(wi,Mi,di[pi]);else hi(wi,Mi,di)}}function Ni(wi){return wi?wi instanceof V?wi.length:V.byteLength(wi):0}function yi(wi){return typeof wi=="string"||wi instanceof V}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,k){var V=1e3,$=V*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*V;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>=V?Math.round(de/V)+"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>=V?ue(de,Ne,V,"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,k){const V=r("./lib/number-allocator.js");g.exports.NumberAllocator=V},{"./lib/number-allocator.js":47}],47:[function(r,g,k){const V=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 V([],(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,k){var V=r("wrappy");g.exports=V($),g.exports.strict=V(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,k){(function(V){(function(){typeof V>"u"||!V.version||V.version.indexOf("v0.")===0||V.version.indexOf("v1.")===0&&V.version.indexOf("v1.8.")!==0?g.exports={nextTick:$}:g.exports=V;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 V.nextTick(oe);case 2:return V.nextTick(function(){oe.call(null,re)});case 3:return V.nextTick(function(){oe.call(null,re,Ce)});case 4:return V.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 V.nextTick(function(){oe.apply(null,le)})}}}).call(this)}).call(this,r("_process"))},{_process:50}],50:[function(r,g,k){var V=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(Fe){if($===setTimeout)return setTimeout(Fe,0);if(($===re||!$)&&setTimeout)return $=setTimeout,setTimeout(Fe,0);try{return $(Fe,0)}catch{try{return $.call(null,Fe,0)}catch{return $.call(this,Fe,0)}}}function ae(Fe){if(oe===clearTimeout)return clearTimeout(Fe);if((oe===Ce||!oe)&&clearTimeout)return oe=clearTimeout,clearTimeout(Fe);try{return oe(Fe)}catch{try{return oe.call(null,Fe)}catch{return oe.call(this,Fe)}}}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 Fe=ie(Ne);Ie=!0;for(var xe=le.length;xe;){for(ue=le,le=[];++de<xe;)ue&&ue[de].run();de=-1,xe=le.length}ue=null,Ie=!1,ae(Fe)}}V.nextTick=function(Fe){var xe=new Array(arguments.length-1);if(arguments.length>1)for(var _e=1;_e<arguments.length;_e++)xe[_e-1]=arguments[_e];le.push(new pe(Fe,xe)),le.length===1&&!Ie&&ie(he)};function pe(Fe,xe){this.fun=Fe,this.array=xe}pe.prototype.run=function(){this.fun.apply(null,this.array)},V.title="browser",V.browser=!0,V.env={},V.argv=[],V.version="",V.versions={};function ze(){}V.on=ze,V.addListener=ze,V.once=ze,V.off=ze,V.removeListener=ze,V.removeAllListeners=ze,V.emit=ze,V.prependListener=ze,V.prependOnceListener=ze,V.listeners=function(Fe){return[]},V.binding=function(Fe){throw new Error("process.binding is not supported")},V.cwd=function(){return"/"},V.chdir=function(Fe){throw new Error("process.chdir is not supported")},V.umask=function(){return 0}},{}],51:[function(r,g,k){(function(V){(function(){(function($){var oe=typeof k=="object"&&k&&!k.nodeType&&k,re=typeof g=="object"&&g&&!g.nodeType&&g,Ce=typeof V=="object"&&V;(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="-",Fe=/^xn--/,xe=/[^\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,Ue=Math.floor,Ve=String.fromCharCode,Oe;function Dt(si){throw new RangeError(At[si])}function qe(si,ui){for(var hi=si.length,Ai=[];hi--;)Ai[hi]=ui(si[hi]);return Ai}function kt(si,ui){var hi=si.split("@"),Ai="";hi.length>1&&(Ai=hi[0]+"@",si=hi[1]),si=si.replace(_e,".");var Ni=si.split("."),yi=qe(Ni,ui).join(".");return Ai+yi}function Lt(si){for(var ui=[],hi=0,Ai=si.length,Ni,yi;hi<Ai;)Ni=si.charCodeAt(hi++),Ni>=55296&&Ni<=56319&&hi<Ai?(yi=si.charCodeAt(hi++),(yi&64512)==56320?ui.push(((Ni&1023)<<10)+(yi&1023)+65536):(ui.push(Ni),hi--)):ui.push(Ni);return ui}function jt(si){return qe(si,function(ui){var hi="";return ui>65535&&(ui-=65536,hi+=Ve(ui>>>10&1023|55296),ui=56320|ui&1023),hi+=Ve(ui),hi}).join("")}function ti(si){return si-48<10?si-22:si-65<26?si-65:si-97<26?si-97:le}function ei(si,ui){return si+22+75*(si<26)-((ui!=0)<<5)}function Pt(si,ui,hi){var Ai=0;for(si=hi?Ue(si/Ne):si>>1,si+=Ue(si/ui);si>$e*ue>>1;Ai+=le)si=Ue(si/$e);return Ue(Ai+($e+1)*si/(si+de))}function ni(si){var ui=[],hi=si.length,Ai,Ni=0,yi=pe,wi=he,Ci,zi,Mi,di,pi,Si,bi,ai,Ii;for(Ci=si.lastIndexOf(ze),Ci<0&&(Ci=0),zi=0;zi<Ci;++zi)si.charCodeAt(zi)>=128&&Dt("not-basic"),ui.push(si.charCodeAt(zi));for(Mi=Ci>0?Ci+1:0;Mi<hi;){for(di=Ni,pi=1,Si=le;Mi>=hi&&Dt("invalid-input"),bi=ti(si.charCodeAt(Mi++)),(bi>=le||bi>Ue((ae-Ni)/pi))&&Dt("overflow"),Ni+=bi*pi,ai=Si<=wi?Ie:Si>=wi+ue?ue:Si-wi,!(bi<ai);Si+=le)Ii=le-ai,pi>Ue(ae/Ii)&&Dt("overflow"),pi*=Ii;Ai=ui.length+1,wi=Pt(Ni-di,Ai,di==0),Ue(Ni/Ai)>ae-yi&&Dt("overflow"),yi+=Ue(Ni/Ai),Ni%=Ai,ui.splice(Ni++,0,yi)}return jt(ui)}function ri(si){var ui,hi,Ai,Ni,yi,wi,Ci,zi,Mi,di,pi,Si=[],bi,ai,Ii,oi;for(si=Lt(si),bi=si.length,ui=pe,hi=0,yi=he,wi=0;wi<bi;++wi)pi=si[wi],pi<128&&Si.push(Ve(pi));for(Ai=Ni=Si.length,Ni&&Si.push(ze);Ai<bi;){for(Ci=ae,wi=0;wi<bi;++wi)pi=si[wi],pi>=ui&&pi<Ci&&(Ci=pi);for(ai=Ai+1,Ci-ui>Ue((ae-hi)/ai)&&Dt("overflow"),hi+=(Ci-ui)*ai,ui=Ci,wi=0;wi<bi;++wi)if(pi=si[wi],pi<ui&&++hi>ae&&Dt("overflow"),pi==ui){for(zi=hi,Mi=le;di=Mi<=yi?Ie:Mi>=yi+ue?ue:Mi-yi,!(zi<di);Mi+=le)oi=zi-di,Ii=le-di,Si.push(Ve(ei(di+oi%Ii,0))),zi=Ue(oi/Ii);Si.push(Ve(ei(zi,0))),yi=Pt(hi,ai,Ai==Ni),hi=0,++Ai}++hi,++ui}return Si.join("")}function ci(si){return kt(si,function(ui){return Fe.test(ui)?ni(ui.slice(4).toLowerCase()):ui})}function li(si){return kt(si,function(ui){return xe.test(ui)?"xn--"+ri(ui):ui})}if(ie={version:"1.4.1",ucs2:{decode:Lt,encode:jt},decode:ni,encode:ri,toASCII:li,toUnicode:ci},oe&&re)if(g.exports==oe)re.exports=ie;else for(Oe in ie)ie.hasOwnProperty(Oe)&&(oe[Oe]=ie[Oe]);else $.punycode=ie})(this)}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(r,g,k){function V(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,Fe,xe;he>=0?(pe=Ne.substr(0,he),ze=Ne.substr(he+1)):(pe=Ne,ze=""),Fe=decodeURIComponent(pe),xe=decodeURIComponent(ze),V(ae,Fe)?$(ae[Fe])?ae[Fe].push(xe):ae[Fe]=[ae[Fe],xe]:ae[Fe]=xe}return ae};var $=Array.isArray||function(oe){return Object.prototype.toString.call(oe)==="[object Array]"}},{}],53:[function(r,g,k){var V=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(V(Ie))+ae;return $(Ce[Ie])?oe(Ce[Ie],function(de){return ue+encodeURIComponent(V(de))}).join(ie):ue+encodeURIComponent(V(Ce[Ie]))}).join(ie):le?encodeURIComponent(V(le))+ae+encodeURIComponent(V(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,k){k.decode=k.parse=r("./decode"),k.encode=k.stringify=r("./encode")},{"./decode":52,"./encode":53}],55:[function(r,g,k){function V(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){V(pe,he);function pe(ze,Fe,xe){return he.call(this,de(ze,Fe,xe))||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,k){(function(V){(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||V.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,k){g.exports=$;var V=r("./_stream_transform");r("inherits")($,V);function $(oe){if(!(this instanceof $))return new $(oe);V.call(this,oe)}$.prototype._transform=function(oe,re,Ce){Ce(null,oe)}},{"./_stream_transform":59,inherits:24}],58:[function(r,g,k){(function(V,$){(function(){g.exports=jt;var oe;jt.ReadableState=Lt,r("events").EventEmitter;var re=function(Ii,oi){return Ii.listeners(oi).length},Ce=r("./internal/streams/stream"),ie=r("buffer").Buffer,ae=$.Uint8Array||function(){};function le(ai){return ie.from(ai)}function Ie(ai){return ie.isBuffer(ai)||ai 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,Fe=r("../errors").codes,xe=Fe.ERR_INVALID_ARG_TYPE,_e=Fe.ERR_STREAM_PUSH_AFTER_EOF,At=Fe.ERR_METHOD_NOT_IMPLEMENTED,$e=Fe.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Ue,Ve,Oe;r("inherits")(jt,Ce);var Dt=he.errorOrDestroy,qe=["error","close","destroy","pause","resume"];function kt(ai,Ii,oi){if(typeof ai.prependListener=="function")return ai.prependListener(Ii,oi);!ai._events||!ai._events[Ii]?ai.on(Ii,oi):Array.isArray(ai._events[Ii])?ai._events[Ii].unshift(oi):ai._events[Ii]=[oi,ai._events[Ii]]}function Lt(ai,Ii,oi){oe=oe||r("./_stream_duplex"),ai=ai||{},typeof oi!="boolean"&&(oi=Ii instanceof oe),this.objectMode=!!ai.objectMode,oi&&(this.objectMode=this.objectMode||!!ai.readableObjectMode),this.highWaterMark=ze(this,ai,"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=ai.emitClose!==!1,this.autoDestroy=!!ai.autoDestroy,this.destroyed=!1,this.defaultEncoding=ai.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,ai.encoding&&(Ue||(Ue=r("string_decoder/").StringDecoder),this.decoder=new Ue(ai.encoding),this.encoding=ai.encoding)}function jt(ai){if(oe=oe||r("./_stream_duplex"),!(this instanceof jt))return new jt(ai);var Ii=this instanceof oe;this._readableState=new Lt(ai,this,Ii),this.readable=!0,ai&&(typeof ai.read=="function"&&(this._read=ai.read),typeof ai.destroy=="function"&&(this._destroy=ai.destroy)),Ce.call(this)}Object.defineProperty(jt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Ii){this._readableState&&(this._readableState.destroyed=Ii)}}),jt.prototype.destroy=he.destroy,jt.prototype._undestroy=he.undestroy,jt.prototype._destroy=function(ai,Ii){Ii(ai)},jt.prototype.push=function(ai,Ii){var oi=this._readableState,Et;return oi.objectMode?Et=!0:typeof ai=="string"&&(Ii=Ii||oi.defaultEncoding,Ii!==oi.encoding&&(ai=ie.from(ai,Ii),Ii=""),Et=!0),ti(this,ai,Ii,!1,Et)},jt.prototype.unshift=function(ai){return ti(this,ai,null,!0,!1)};function ti(ai,Ii,oi,Et,ii){de("readableAddChunk",Ii);var gi=ai._readableState;if(Ii===null)gi.reading=!1,li(ai,gi);else{var mi;if(ii||(mi=Pt(gi,Ii)),mi)Dt(ai,mi);else if(gi.objectMode||Ii&&Ii.length>0)if(typeof Ii!="string"&&!gi.objectMode&&Object.getPrototypeOf(Ii)!==ie.prototype&&(Ii=le(Ii)),Et)gi.endEmitted?Dt(ai,new $e):ei(ai,gi,Ii,!0);else if(gi.ended)Dt(ai,new _e);else{if(gi.destroyed)return!1;gi.reading=!1,gi.decoder&&!oi?(Ii=gi.decoder.write(Ii),gi.objectMode||Ii.length!==0?ei(ai,gi,Ii,!1):hi(ai,gi)):ei(ai,gi,Ii,!1)}else Et||(gi.reading=!1,hi(ai,gi))}return!gi.ended&&(gi.length<gi.highWaterMark||gi.length===0)}function ei(ai,Ii,oi,Et){Ii.flowing&&Ii.length===0&&!Ii.sync?(Ii.awaitDrain=0,ai.emit("data",oi)):(Ii.length+=Ii.objectMode?1:oi.length,Et?Ii.buffer.unshift(oi):Ii.buffer.push(oi),Ii.needReadable&&si(ai)),hi(ai,Ii)}function Pt(ai,Ii){var oi;return!Ie(Ii)&&typeof Ii!="string"&&Ii!==void 0&&!ai.objectMode&&(oi=new xe("chunk",["string","Buffer","Uint8Array"],Ii)),oi}jt.prototype.isPaused=function(){return this._readableState.flowing===!1},jt.prototype.setEncoding=function(ai){Ue||(Ue=r("string_decoder/").StringDecoder);var Ii=new Ue(ai);this._readableState.decoder=Ii,this._readableState.encoding=this._readableState.decoder.encoding;for(var oi=this._readableState.buffer.head,Et="";oi!==null;)Et+=Ii.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(ai){return ai>=ni?ai=ni:(ai--,ai|=ai>>>1,ai|=ai>>>2,ai|=ai>>>4,ai|=ai>>>8,ai|=ai>>>16,ai++),ai}function ci(ai,Ii){return ai<=0||Ii.length===0&&Ii.ended?0:Ii.objectMode?1:ai!==ai?Ii.flowing&&Ii.length?Ii.buffer.head.data.length:Ii.length:(ai>Ii.highWaterMark&&(Ii.highWaterMark=ri(ai)),ai<=Ii.length?ai:Ii.ended?Ii.length:(Ii.needReadable=!0,0))}jt.prototype.read=function(ai){de("read",ai),ai=parseInt(ai,10);var Ii=this._readableState,oi=ai;if(ai!==0&&(Ii.emittedReadable=!1),ai===0&&Ii.needReadable&&((Ii.highWaterMark!==0?Ii.length>=Ii.highWaterMark:Ii.length>0)||Ii.ended))return de("read: emitReadable",Ii.length,Ii.ended),Ii.length===0&&Ii.ended?pi(this):si(this),null;if(ai=ci(ai,Ii),ai===0&&Ii.ended)return Ii.length===0&&pi(this),null;var Et=Ii.needReadable;de("need readable",Et),(Ii.length===0||Ii.length-ai<Ii.highWaterMark)&&(Et=!0,de("length less than watermark",Et)),Ii.ended||Ii.reading?(Et=!1,de("reading or ended",Et)):Et&&(de("do read"),Ii.reading=!0,Ii.sync=!0,Ii.length===0&&(Ii.needReadable=!0),this._read(Ii.highWaterMark),Ii.sync=!1,Ii.reading||(ai=ci(oi,Ii)));var ii;return ai>0?ii=di(ai,Ii):ii=null,ii===null?(Ii.needReadable=Ii.length<=Ii.highWaterMark,ai=0):(Ii.length-=ai,Ii.awaitDrain=0),Ii.length===0&&(Ii.ended||(Ii.needReadable=!0),oi!==ai&&Ii.ended&&pi(this)),ii!==null&&this.emit("data",ii),ii};function li(ai,Ii){if(de("onEofChunk"),!Ii.ended){if(Ii.decoder){var oi=Ii.decoder.end();oi&&oi.length&&(Ii.buffer.push(oi),Ii.length+=Ii.objectMode?1:oi.length)}Ii.ended=!0,Ii.sync?si(ai):(Ii.needReadable=!1,Ii.emittedReadable||(Ii.emittedReadable=!0,ui(ai)))}}function si(ai){var Ii=ai._readableState;de("emitReadable",Ii.needReadable,Ii.emittedReadable),Ii.needReadable=!1,Ii.emittedReadable||(de("emitReadable",Ii.flowing),Ii.emittedReadable=!0,V.nextTick(ui,ai))}function ui(ai){var Ii=ai._readableState;de("emitReadable_",Ii.destroyed,Ii.length,Ii.ended),!Ii.destroyed&&(Ii.length||Ii.ended)&&(ai.emit("readable"),Ii.emittedReadable=!1),Ii.needReadable=!Ii.flowing&&!Ii.ended&&Ii.length<=Ii.highWaterMark,Mi(ai)}function hi(ai,Ii){Ii.readingMore||(Ii.readingMore=!0,V.nextTick(Ai,ai,Ii))}function Ai(ai,Ii){for(;!Ii.reading&&!Ii.ended&&(Ii.length<Ii.highWaterMark||Ii.flowing&&Ii.length===0);){var oi=Ii.length;if(de("maybeReadMore read 0"),ai.read(0),oi===Ii.length)break}Ii.readingMore=!1}jt.prototype._read=function(ai){Dt(this,new At("_read()"))},jt.prototype.pipe=function(ai,Ii){var oi=this,Et=this._readableState;switch(Et.pipesCount){case 0:Et.pipes=ai;break;case 1:Et.pipes=[Et.pipes,ai];break;default:Et.pipes.push(ai);break}Et.pipesCount+=1,de("pipe count=%d opts=%j",Et.pipesCount,Ii);var ii=(!Ii||Ii.end!==!1)&&ai!==V.stdout&&ai!==V.stderr,gi=ii?fi:ki;Et.endEmitted?V.nextTick(gi):oi.once("end",gi),ai.on("unpipe",mi);function mi(Vi,Hi){de("onunpipe"),Vi===oi&&Hi&&Hi.hasUnpiped===!1&&(Hi.hasUnpiped=!0,Gi())}function fi(){de("onend"),ai.end()}var vi=Ni(oi);ai.on("drain",vi);var xi=!1;function Gi(){de("cleanup"),ai.removeListener("close",Zi),ai.removeListener("finish",Wi),ai.removeListener("drain",vi),ai.removeListener("error",Oi),ai.removeListener("unpipe",mi),oi.removeListener("end",fi),oi.removeListener("end",ki),oi.removeListener("data",Bi),xi=!0,Et.awaitDrain&&(!ai._writableState||ai._writableState.needDrain)&&vi()}oi.on("data",Bi);function Bi(Vi){de("ondata");var Hi=ai.write(Vi);de("dest.write",Hi),Hi===!1&&((Et.pipesCount===1&&Et.pipes===ai||Et.pipesCount>1&&bi(Et.pipes,ai)!==-1)&&!xi&&(de("false write response, pause",Et.awaitDrain),Et.awaitDrain++),oi.pause())}function Oi(Vi){de("onerror",Vi),ki(),ai.removeListener("error",Oi),re(ai,"error")===0&&Dt(ai,Vi)}kt(ai,"error",Oi);function Zi(){ai.removeListener("finish",Wi),ki()}ai.once("close",Zi);function Wi(){de("onfinish"),ai.removeListener("close",Zi),ki()}ai.once("finish",Wi);function ki(){de("unpipe"),oi.unpipe(ai)}return ai.emit("pipe",oi),Et.flowing||(de("pipe resume"),oi.resume()),ai};function Ni(ai){return function(){var oi=ai._readableState;de("pipeOnDrain",oi.awaitDrain),oi.awaitDrain&&oi.awaitDrain--,oi.awaitDrain===0&&re(ai,"data")&&(oi.flowing=!0,Mi(ai))}}jt.prototype.unpipe=function(ai){var Ii=this._readableState,oi={hasUnpiped:!1};if(Ii.pipesCount===0)return this;if(Ii.pipesCount===1)return ai&&ai!==Ii.pipes?this:(ai||(ai=Ii.pipes),Ii.pipes=null,Ii.pipesCount=0,Ii.flowing=!1,ai&&ai.emit("unpipe",this,oi),this);if(!ai){var Et=Ii.pipes,ii=Ii.pipesCount;Ii.pipes=null,Ii.pipesCount=0,Ii.flowing=!1;for(var gi=0;gi<ii;gi++)Et[gi].emit("unpipe",this,{hasUnpiped:!1});return this}var mi=bi(Ii.pipes,ai);return mi===-1?this:(Ii.pipes.splice(mi,1),Ii.pipesCount-=1,Ii.pipesCount===1&&(Ii.pipes=Ii.pipes[0]),ai.emit("unpipe",this,oi),this)},jt.prototype.on=function(ai,Ii){var oi=Ce.prototype.on.call(this,ai,Ii),Et=this._readableState;return ai==="data"?(Et.readableListening=this.listenerCount("readable")>0,Et.flowing!==!1&&this.resume()):ai==="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?si(this):Et.reading||V.nextTick(wi,this)),oi},jt.prototype.addListener=jt.prototype.on,jt.prototype.removeListener=function(ai,Ii){var oi=Ce.prototype.removeListener.call(this,ai,Ii);return ai==="readable"&&V.nextTick(yi,this),oi},jt.prototype.removeAllListeners=function(ai){var Ii=Ce.prototype.removeAllListeners.apply(this,arguments);return(ai==="readable"||ai===void 0)&&V.nextTick(yi,this),Ii};function yi(ai){var Ii=ai._readableState;Ii.readableListening=ai.listenerCount("readable")>0,Ii.resumeScheduled&&!Ii.paused?Ii.flowing=!0:ai.listenerCount("data")>0&&ai.resume()}function wi(ai){de("readable nexttick read 0"),ai.read(0)}jt.prototype.resume=function(){var ai=this._readableState;return ai.flowing||(de("resume"),ai.flowing=!ai.readableListening,Ci(this,ai)),ai.paused=!1,this};function Ci(ai,Ii){Ii.resumeScheduled||(Ii.resumeScheduled=!0,V.nextTick(zi,ai,Ii))}function zi(ai,Ii){de("resume",Ii.reading),Ii.reading||ai.read(0),Ii.resumeScheduled=!1,ai.emit("resume"),Mi(ai),Ii.flowing&&!Ii.reading&&ai.read(0)}jt.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 Mi(ai){var Ii=ai._readableState;for(de("flow",Ii.flowing);Ii.flowing&&ai.read()!==null;);}jt.prototype.wrap=function(ai){var Ii=this,oi=this._readableState,Et=!1;ai.on("end",function(){if(de("wrapped end"),oi.decoder&&!oi.ended){var mi=oi.decoder.end();mi&&mi.length&&Ii.push(mi)}Ii.push(null)}),ai.on("data",function(mi){if(de("wrapped data"),oi.decoder&&(mi=oi.decoder.write(mi)),!(oi.objectMode&&mi==null)&&!(!oi.objectMode&&(!mi||!mi.length))){var fi=Ii.push(mi);fi||(Et=!0,ai.pause())}});for(var ii in ai)this[ii]===void 0&&typeof ai[ii]=="function"&&(this[ii]=function(fi){return function(){return ai[fi].apply(ai,arguments)}}(ii));for(var gi=0;gi<qe.length;gi++)ai.on(qe[gi],this.emit.bind(this,qe[gi]));return this._read=function(mi){de("wrapped _read",mi),Et&&(Et=!1,ai.resume())},this},typeof Symbol=="function"&&(jt.prototype[Symbol.asyncIterator]=function(){return Ve===void 0&&(Ve=r("./internal/streams/async_iterator")),Ve(this)}),Object.defineProperty(jt.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(jt.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(jt.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(Ii){this._readableState&&(this._readableState.flowing=Ii)}}),jt._fromList=di,Object.defineProperty(jt.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function di(ai,Ii){if(Ii.length===0)return null;var oi;return Ii.objectMode?oi=Ii.buffer.shift():!ai||ai>=Ii.length?(Ii.decoder?oi=Ii.buffer.join(""):Ii.buffer.length===1?oi=Ii.buffer.first():oi=Ii.buffer.concat(Ii.length),Ii.buffer.clear()):oi=Ii.buffer.consume(ai,Ii.decoder),oi}function pi(ai){var Ii=ai._readableState;de("endReadable",Ii.endEmitted),Ii.endEmitted||(Ii.ended=!0,V.nextTick(Si,Ii,ai))}function Si(ai,Ii){if(de("endReadableNT",ai.endEmitted,ai.length),!ai.endEmitted&&ai.length===0&&(ai.endEmitted=!0,Ii.readable=!1,Ii.emit("end"),ai.autoDestroy)){var oi=Ii._writableState;(!oi||oi.autoDestroy&&oi.finished)&&Ii.destroy()}}typeof Symbol=="function"&&(jt.from=function(ai,Ii){return Oe===void 0&&(Oe=r("./internal/streams/from")),Oe(jt,ai,Ii)});function bi(ai,Ii){for(var oi=0,Et=ai.length;oi<Et;oi++)if(ai[oi]===Ii)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,k){g.exports=le;var V=r("../errors").codes,$=V.ERR_METHOD_NOT_IMPLEMENTED,oe=V.ERR_MULTIPLE_CALLBACK,re=V.ERR_TRANSFORM_ALREADY_TRANSFORMING,Ce=V.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,k){(function(V,$){(function(){g.exports=Lt;function oe(Mi){var di=this;this.next=null,this.entry=null,this.finish=function(){zi(di,Mi)}}var re;Lt.WritableState=qe;var Ce={deprecate:r("util-deprecate")},ie=r("./internal/streams/stream"),ae=r("buffer").Buffer,le=$.Uint8Array||function(){};function Ie(Mi){return ae.from(Mi)}function ue(Mi){return ae.isBuffer(Mi)||Mi 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,Fe=pe.ERR_METHOD_NOT_IMPLEMENTED,xe=pe.ERR_MULTIPLE_CALLBACK,_e=pe.ERR_STREAM_CANNOT_PIPE,At=pe.ERR_STREAM_DESTROYED,$e=pe.ERR_STREAM_NULL_VALUES,Ue=pe.ERR_STREAM_WRITE_AFTER_END,Ve=pe.ERR_UNKNOWN_ENCODING,Oe=de.errorOrDestroy;r("inherits")(Lt,ie);function Dt(){}function qe(Mi,di,pi){re=re||r("./_stream_duplex"),Mi=Mi||{},typeof pi!="boolean"&&(pi=di instanceof re),this.objectMode=!!Mi.objectMode,pi&&(this.objectMode=this.objectMode||!!Mi.writableObjectMode),this.highWaterMark=he(this,Mi,"writableHighWaterMark",pi),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Si=Mi.decodeStrings===!1;this.decodeStrings=!Si,this.defaultEncoding=Mi.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(bi){li(di,bi)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Mi.emitClose!==!1,this.autoDestroy=!!Mi.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new oe(this)}qe.prototype.getBuffer=function(){for(var di=this.bufferedRequest,pi=[];di;)pi.push(di),di=di.next;return pi},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(Lt,Symbol.hasInstance,{value:function(di){return kt.call(this,di)?!0:this!==Lt?!1:di&&di._writableState instanceof qe}})):kt=function(di){return di instanceof this};function Lt(Mi){re=re||r("./_stream_duplex");var di=this instanceof re;if(!di&&!kt.call(Lt,this))return new Lt(Mi);this._writableState=new qe(Mi,this,di),this.writable=!0,Mi&&(typeof Mi.write=="function"&&(this._write=Mi.write),typeof Mi.writev=="function"&&(this._writev=Mi.writev),typeof Mi.destroy=="function"&&(this._destroy=Mi.destroy),typeof Mi.final=="function"&&(this._final=Mi.final)),ie.call(this)}Lt.prototype.pipe=function(){Oe(this,new _e)};function jt(Mi,di){var pi=new Ue;Oe(Mi,pi),V.nextTick(di,pi)}function ti(Mi,di,pi,Si){var bi;return pi===null?bi=new $e:typeof pi!="string"&&!di.objectMode&&(bi=new ze("chunk",["string","Buffer"],pi)),bi?(Oe(Mi,bi),V.nextTick(Si,bi),!1):!0}Lt.prototype.write=function(Mi,di,pi){var Si=this._writableState,bi=!1,ai=!Si.objectMode&&ue(Mi);return ai&&!ae.isBuffer(Mi)&&(Mi=Ie(Mi)),typeof di=="function"&&(pi=di,di=null),ai?di="buffer":di||(di=Si.defaultEncoding),typeof pi!="function"&&(pi=Dt),Si.ending?jt(this,pi):(ai||ti(this,Si,Mi,pi))&&(Si.pendingcb++,bi=Pt(this,Si,ai,Mi,di,pi)),bi},Lt.prototype.cork=function(){this._writableState.corked++},Lt.prototype.uncork=function(){var Mi=this._writableState;Mi.corked&&(Mi.corked--,!Mi.writing&&!Mi.corked&&!Mi.bufferProcessing&&Mi.bufferedRequest&&hi(this,Mi))},Lt.prototype.setDefaultEncoding=function(di){if(typeof di=="string"&&(di=di.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((di+"").toLowerCase())>-1))throw new Ve(di);return this._writableState.defaultEncoding=di,this},Object.defineProperty(Lt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ei(Mi,di,pi){return!Mi.objectMode&&Mi.decodeStrings!==!1&&typeof di=="string"&&(di=ae.from(di,pi)),di}Object.defineProperty(Lt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Pt(Mi,di,pi,Si,bi,ai){if(!pi){var Ii=ei(di,Si,bi);Si!==Ii&&(pi=!0,bi="buffer",Si=Ii)}var oi=di.objectMode?1:Si.length;di.length+=oi;var Et=di.length<di.highWaterMark;if(Et||(di.needDrain=!0),di.writing||di.corked){var ii=di.lastBufferedRequest;di.lastBufferedRequest={chunk:Si,encoding:bi,isBuf:pi,callback:ai,next:null},ii?ii.next=di.lastBufferedRequest:di.bufferedRequest=di.lastBufferedRequest,di.bufferedRequestCount+=1}else ni(Mi,di,!1,oi,Si,bi,ai);return Et}function ni(Mi,di,pi,Si,bi,ai,Ii){di.writelen=Si,di.writecb=Ii,di.writing=!0,di.sync=!0,di.destroyed?di.onwrite(new At("write")):pi?Mi._writev(bi,di.onwrite):Mi._write(bi,ai,di.onwrite),di.sync=!1}function ri(Mi,di,pi,Si,bi){--di.pendingcb,pi?(V.nextTick(bi,Si),V.nextTick(wi,Mi,di),Mi._writableState.errorEmitted=!0,Oe(Mi,Si)):(bi(Si),Mi._writableState.errorEmitted=!0,Oe(Mi,Si),wi(Mi,di))}function ci(Mi){Mi.writing=!1,Mi.writecb=null,Mi.length-=Mi.writelen,Mi.writelen=0}function li(Mi,di){var pi=Mi._writableState,Si=pi.sync,bi=pi.writecb;if(typeof bi!="function")throw new xe;if(ci(pi),di)ri(Mi,pi,Si,di,bi);else{var ai=Ai(pi)||Mi.destroyed;!ai&&!pi.corked&&!pi.bufferProcessing&&pi.bufferedRequest&&hi(Mi,pi),Si?V.nextTick(si,Mi,pi,ai,bi):si(Mi,pi,ai,bi)}}function si(Mi,di,pi,Si){pi||ui(Mi,di),di.pendingcb--,Si(),wi(Mi,di)}function ui(Mi,di){di.length===0&&di.needDrain&&(di.needDrain=!1,Mi.emit("drain"))}function hi(Mi,di){di.bufferProcessing=!0;var pi=di.bufferedRequest;if(Mi._writev&&pi&&pi.next){var Si=di.bufferedRequestCount,bi=new Array(Si),ai=di.corkedRequestsFree;ai.entry=pi;for(var Ii=0,oi=!0;pi;)bi[Ii]=pi,pi.isBuf||(oi=!1),pi=pi.next,Ii+=1;bi.allBuffers=oi,ni(Mi,di,!0,di.length,bi,"",ai.finish),di.pendingcb++,di.lastBufferedRequest=null,ai.next?(di.corkedRequestsFree=ai.next,ai.next=null):di.corkedRequestsFree=new oe(di),di.bufferedRequestCount=0}else{for(;pi;){var Et=pi.chunk,ii=pi.encoding,gi=pi.callback,mi=di.objectMode?1:Et.length;if(ni(Mi,di,!1,mi,Et,ii,gi),pi=pi.next,di.bufferedRequestCount--,di.writing)break}pi===null&&(di.lastBufferedRequest=null)}di.bufferedRequest=pi,di.bufferProcessing=!1}Lt.prototype._write=function(Mi,di,pi){pi(new Fe("_write()"))},Lt.prototype._writev=null,Lt.prototype.end=function(Mi,di,pi){var Si=this._writableState;return typeof Mi=="function"?(pi=Mi,Mi=null,di=null):typeof di=="function"&&(pi=di,di=null),Mi!=null&&this.write(Mi,di),Si.corked&&(Si.corked=1,this.uncork()),Si.ending||Ci(this,Si,pi),this},Object.defineProperty(Lt.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Ai(Mi){return Mi.ending&&Mi.length===0&&Mi.bufferedRequest===null&&!Mi.finished&&!Mi.writing}function Ni(Mi,di){Mi._final(function(pi){di.pendingcb--,pi&&Oe(Mi,pi),di.prefinished=!0,Mi.emit("prefinish"),wi(Mi,di)})}function yi(Mi,di){!di.prefinished&&!di.finalCalled&&(typeof Mi._final=="function"&&!di.destroyed?(di.pendingcb++,di.finalCalled=!0,V.nextTick(Ni,Mi,di)):(di.prefinished=!0,Mi.emit("prefinish")))}function wi(Mi,di){var pi=Ai(di);if(pi&&(yi(Mi,di),di.pendingcb===0&&(di.finished=!0,Mi.emit("finish"),di.autoDestroy))){var Si=Mi._readableState;(!Si||Si.autoDestroy&&Si.endEmitted)&&Mi.destroy()}return pi}function Ci(Mi,di,pi){di.ending=!0,wi(Mi,di),pi&&(di.finished?V.nextTick(pi):Mi.once("finish",pi)),di.ended=!0,Mi.writable=!1}function zi(Mi,di,pi){var Si=Mi.entry;for(Mi.entry=null;Si;){var bi=Si.callback;di.pendingcb--,bi(pi),Si=Si.next}di.corkedRequestsFree.next=Mi}Object.defineProperty(Lt.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(di){this._writableState&&(this._writableState.destroyed=di)}}),Lt.prototype.destroy=de.destroy,Lt.prototype._undestroy=de.undestroy,Lt.prototype._destroy=function(Mi,di){di(Mi)}}).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,k){(function(V){(function(){var $;function oe(At,$e,Ue){return $e in At?Object.defineProperty(At,$e,{value:Ue,enumerable:!0,configurable:!0,writable:!0}):At[$e]=Ue,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 Ue=At[de].read();Ue!==null&&(At[Ie]=null,At[Ce]=null,At[ie]=null,$e(Ne(Ue,!1)))}}function pe(At){V.nextTick(he,At)}function ze(At,$e){return function(Ue,Ve){At.then(function(){if($e[le]){Ue(Ne(void 0,!0));return}$e[ue](Ue,Ve)},Ve)}}var Fe=Object.getPrototypeOf(function(){}),xe=Object.setPrototypeOf(($={get stream(){return this[de]},next:function(){var $e=this,Ue=this[ae];if(Ue!==null)return Promise.reject(Ue);if(this[le])return Promise.resolve(Ne(void 0,!0));if(this[de].destroyed)return new Promise(function(qe,kt){V.nextTick(function(){$e[ae]?kt($e[ae]):qe(Ne(void 0,!0))})});var Ve=this[Ie],Oe;if(Ve)Oe=new Promise(ze(Ve,this));else{var Dt=this[de].read();if(Dt!==null)return Promise.resolve(Ne(Dt,!1));Oe=new Promise(this[ue])}return this[Ie]=Oe,Oe}},oe($,Symbol.asyncIterator,function(){return this}),oe($,"return",function(){var $e=this;return new Promise(function(Ue,Ve){$e[de].destroy(null,function(Oe){if(Oe){Ve(Oe);return}Ue(Ne(void 0,!0))})})}),$),Fe),_e=function($e){var Ue,Ve=Object.create(xe,(Ue={},oe(Ue,de,{value:$e,writable:!0}),oe(Ue,Ce,{value:null,writable:!0}),oe(Ue,ie,{value:null,writable:!0}),oe(Ue,ae,{value:null,writable:!0}),oe(Ue,le,{value:$e._readableState.endEmitted,writable:!0}),oe(Ue,ue,{value:function(Dt,qe){var kt=Ve[de].read();kt?(Ve[Ie]=null,Ve[Ce]=null,Ve[ie]=null,Dt(Ne(kt,!1))):(Ve[Ce]=Dt,Ve[ie]=qe)},writable:!0}),Ue));return Ve[Ie]=null,re($e,function(Oe){if(Oe&&Oe.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Dt=Ve[ie];Dt!==null&&(Ve[Ie]=null,Ve[Ce]=null,Ve[ie]=null,Dt(Oe)),Ve[ae]=Oe;return}var qe=Ve[Ce];qe!==null&&(Ve[Ie]=null,Ve[Ce]=null,Ve[ie]=null,qe(Ne(void 0,!0))),Ve[le]=!0}),$e.on("readable",pe.bind(null,Ve)),Ve};g.exports=_e}).call(this)}).call(this,r("_process"))},{"./end-of-stream":64,_process:50}],62:[function(r,g,k){function V(he,pe){var ze=Object.keys(he);if(Object.getOwnPropertySymbols){var Fe=Object.getOwnPropertySymbols(he);pe&&(Fe=Fe.filter(function(xe){return Object.getOwnPropertyDescriptor(he,xe).enumerable})),ze.push.apply(ze,Fe)}return ze}function $(he){for(var pe=1;pe<arguments.length;pe++){var ze=arguments[pe]!=null?arguments[pe]:{};pe%2?V(Object(ze),!0).forEach(function(Fe){oe(he,Fe,ze[Fe])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(ze)):V(Object(ze)).forEach(function(Fe){Object.defineProperty(he,Fe,Object.getOwnPropertyDescriptor(ze,Fe))})}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 Fe=pe[ze];Fe.enumerable=Fe.enumerable||!1,Fe.configurable=!0,"value"in Fe&&(Fe.writable=!0),Object.defineProperty(he,Fe.key,Fe)}}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 Fe={data:ze,next:null};this.length>0?this.tail.next=Fe:this.head=Fe,this.tail=Fe,++this.length}},{key:"unshift",value:function(ze){var Fe={data:ze,next:this.head};this.length===0&&(this.tail=Fe),this.head=Fe,++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 Fe=this.head,xe=""+Fe.data;Fe=Fe.next;)xe+=ze+Fe.data;return xe}},{key:"concat",value:function(ze){if(this.length===0)return le.alloc(0);for(var Fe=le.allocUnsafe(ze>>>0),xe=this.head,_e=0;xe;)Ne(xe.data,Fe,_e),_e+=xe.data.length,xe=xe.next;return Fe}},{key:"consume",value:function(ze,Fe){var xe;return ze<this.head.data.length?(xe=this.head.data.slice(0,ze),this.head.data=this.head.data.slice(ze)):ze===this.head.data.length?xe=this.shift():xe=Fe?this._getString(ze):this._getBuffer(ze),xe}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(ze){var Fe=this.head,xe=1,_e=Fe.data;for(ze-=_e.length;Fe=Fe.next;){var At=Fe.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?(++xe,Fe.next?this.head=Fe.next:this.head=this.tail=null):(this.head=Fe,Fe.data=At.slice($e));break}++xe}return this.length-=xe,_e}},{key:"_getBuffer",value:function(ze){var Fe=le.allocUnsafe(ze),xe=this.head,_e=1;for(xe.data.copy(Fe),ze-=xe.data.length;xe=xe.next;){var At=xe.data,$e=ze>At.length?At.length:ze;if(At.copy(Fe,Fe.length-ze,0,$e),ze-=$e,ze===0){$e===At.length?(++_e,xe.next?this.head=xe.next:this.head=this.tail=null):(this.head=xe,xe.data=At.slice($e));break}++_e}return this.length-=_e,Fe}},{key:de,value:function(ze,Fe){return ue(this,$({},Fe,{depth:0,customInspect:!1}))}}]),he}()},{buffer:17,util:16}],63:[function(r,g,k){(function(V){(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,V.nextTick(ie,this,le)):V.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?V.nextTick(re,ue):(ue._writableState.errorEmitted=!0,V.nextTick(oe,ue,he)):V.nextTick(oe,ue,he):Ie?(V.nextTick(re,ue),Ie(he)):V.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,k){var V=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)},Fe=function($e){le.call(ie,$e)},xe=function(){var $e;if(Ie&&!pe)return(!ie._readableState||!ie._readableState.ended)&&($e=new V),le.call(ie,$e);if(ue&&!Ne)return(!ie._writableState||!ie._writableState.ended)&&($e=new V),le.call(ie,$e)},_e=function(){ie.req.on("finish",he)};return re(ie)?(ie.on("complete",he),ie.on("abort",xe),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",Fe),ie.on("close",xe),function(){ie.removeListener("complete",he),ie.removeListener("abort",xe),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",Fe),ie.removeListener("close",xe)}}g.exports=Ce},{"../../../errors":55}],65:[function(r,g,k){g.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(r,g,k){var V;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,Fe){Fe=$(Fe);var xe=!1;he.on("close",function(){xe=!0}),V===void 0&&(V=r("./end-of-stream")),V(he,{readable:pe,writable:ze},function(At){if(At)return Fe(At);xe=!0,Fe()});var _e=!1;return function(At){if(!xe&&!_e){if(_e=!0,ae(he))return he.abort();if(typeof he.destroy=="function")return he.destroy();Fe(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 Fe=de(pe);if(Array.isArray(pe[0])&&(pe=pe[0]),pe.length<2)throw new re("streams");var xe,_e=pe.map(function(At,$e){var Ue=$e<pe.length-1,Ve=$e>0;return le(At,Ue,Ve,function(Oe){xe||(xe=Oe),Oe&&_e.forEach(Ie),!Ue&&(_e.forEach(Ie),Fe(xe))})});return pe.reduce(ue)}g.exports=Ne},{"../../../errors":55,"./end-of-stream":64}],67:[function(r,g,k){var V=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 V(Ie,le)}return Math.floor(le)}return re.objectMode?16:16*1024}g.exports={getHighWaterMark:oe}},{"../../../errors":55}],68:[function(r,g,k){g.exports=r("events").EventEmitter},{events:22}],69:[function(r,g,k){k=g.exports=r("./lib/_stream_readable.js"),k.Stream=k,k.Readable=k,k.Writable=r("./lib/_stream_writable.js"),k.Duplex=r("./lib/_stream_duplex.js"),k.Transform=r("./lib/_stream_transform.js"),k.PassThrough=r("./lib/_stream_passthrough.js"),k.finished=r("./lib/internal/streams/end-of-stream.js"),k.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,k){function V(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 V(arguments[0],arguments[1],oe)}g.exports=$},{}],71:[function(r,g,k){g.exports=r("./index.js")()},{"./index.js":72}],72:[function(r,g,k){(function(V){(function(){g.exports=oe;function $(Ce){return Ce instanceof V?V.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 Fe=he[ze],xe=de[Fe];if(typeof xe!="object"||xe===null)pe[Fe]=xe;else if(xe instanceof Date)pe[Fe]=new Date(xe);else if(ArrayBuffer.isView(xe))pe[Fe]=$(xe);else{var _e=ie.indexOf(xe);_e!==-1?pe[Fe]=ae[_e]:pe[Fe]=Ne(xe)}}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,k){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var V=r("buffer"),$=V.Buffer;function oe(Ce,ie){for(var ae in Ce)ie[ae]=Ce[ae]}$.from&&$.alloc&&$.allocUnsafe&&$.allocUnsafeSlow?g.exports=V:(oe(V,k),k.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 V.SlowBuffer(Ce)}},{buffer:17}],74:[function(r,g,k){g.exports=V;function V(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,k){var V=r("safe-buffer").Buffer,$=V.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"&&(V.isEncoding===$||!$(_e)))throw new Error("Unknown encoding: "+_e);return At||_e}k.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=Fe,this.end=xe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=V.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 Ue=At.length-1;if(Ue<$e)return 0;var Ve=ie(At[Ue]);return Ve>=0?(Ve>0&&(_e.lastNeed=Ve-1),Ve):--Ue<$e||Ve===-2?0:(Ve=ie(At[Ue]),Ve>=0?(Ve>0&&(_e.lastNeed=Ve-2),Ve):--Ue<$e||Ve===-2?0:(Ve=ie(At[Ue]),Ve>=0?(Ve>0&&(Ve===2?Ve=0:_e.lastNeed=Ve-3),Ve):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 Ue=_e.length-($e-this.lastNeed);return _e.copy(this.lastChar,0,Ue),_e.toString("utf8",At,Ue)}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 Ue=$e.charCodeAt($e.length-1);if(Ue>=55296&&Ue<=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 Fe(_e){return _e.toString(this.encoding)}function xe(_e){return _e&&_e.length?this.write(_e):""}},{"safe-buffer":73}],76:[function(r,g,k){var V=r("punycode"),$=r("./util");k.parse=At,k.resolve=Ue,k.resolveObject=Ve,k.format=$e,k.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",`
|
1203
|
-
`," "],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},Fe={javascript:!0,"javascript:":!0},xe={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(Oe,Dt,qe){if(Oe&&$.isObject(Oe)&&Oe instanceof oe)return Oe;var kt=new oe;return kt.parse(Oe,Dt,qe),kt}oe.prototype.parse=function(Oe,Dt,qe){if(!$.isString(Oe))throw new TypeError("Parameter 'url' must be a string, not "+typeof Oe);var kt=Oe.indexOf("?"),Lt=kt!==-1&&kt<Oe.indexOf("#")?"?":"#",jt=Oe.split(Lt),ti=/\\/g;jt[0]=jt[0].replace(ti,"/"),Oe=jt.join(Lt);var ei=Oe;if(ei=ei.trim(),!qe&&Oe.split("#").length===1){var Pt=ie.exec(ei);if(Pt)return this.path=ei,this.href=ei,this.pathname=Pt[1],Pt[2]?(this.search=Pt[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 ci=ei.substr(0,2)==="//";ci&&!(ni&&Fe[ni])&&(ei=ei.substr(2),this.slashes=!0)}if(!Fe[ni]&&(ci||ni&&!xe[ni])){for(var li=-1,si=0;si<de.length;si++){var ui=ei.indexOf(de[si]);ui!==-1&&(li===-1||ui<li)&&(li=ui)}var hi,Ai;li===-1?Ai=ei.lastIndexOf("@"):Ai=ei.lastIndexOf("@",li),Ai!==-1&&(hi=ei.slice(0,Ai),ei=ei.slice(Ai+1),this.auth=decodeURIComponent(hi)),li=-1;for(var si=0;si<ue.length;si++){var ui=ei.indexOf(ue[si]);ui!==-1&&(li===-1||ui<li)&&(li=ui)}li===-1&&(li=ei.length),this.host=ei.slice(0,li),ei=ei.slice(li),this.parseHost(),this.hostname=this.hostname||"";var Ni=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!Ni)for(var yi=this.hostname.split(/\./),si=0,wi=yi.length;si<wi;si++){var Ci=yi[si];if(Ci&&!Ci.match(he)){for(var zi="",Mi=0,di=Ci.length;Mi<di;Mi++)Ci.charCodeAt(Mi)>127?zi+="x":zi+=Ci[Mi];if(!zi.match(he)){var pi=yi.slice(0,si),Si=yi.slice(si+1),bi=Ci.match(pe);bi&&(pi.push(bi[1]),Si.unshift(bi[2])),Si.length&&(ei="/"+Si.join(".")+ei),this.hostname=pi.join(".");break}}}this.hostname.length>Ne?this.hostname="":this.hostname=this.hostname.toLowerCase(),Ni||(this.hostname=V.toASCII(this.hostname));var ai=this.port?":"+this.port:"",Ii=this.hostname||"";this.host=Ii+ai,this.href+=this.host,Ni&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ei[0]!=="/"&&(ei="/"+ei))}if(!ze[ri])for(var si=0,wi=Ie.length;si<wi;si++){var oi=Ie[si];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 gi=ei.indexOf("?");if(gi!==-1?(this.search=ei.substr(gi),this.query=ei.substr(gi+1),Dt&&(this.query=_e.parse(this.query)),ei=ei.slice(0,gi)):Dt&&(this.search="",this.query={}),ei&&(this.pathname=ei),xe[ri]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ai=this.pathname||"",mi=this.search||"";this.path=ai+mi}return this.href=this.format(),this};function $e(Oe){return $.isString(Oe)&&(Oe=At(Oe)),Oe instanceof oe?Oe.format():oe.prototype.format.call(Oe)}oe.prototype.format=function(){var Oe=this.auth||"";Oe&&(Oe=encodeURIComponent(Oe),Oe=Oe.replace(/%3A/i,":"),Oe+="@");var Dt=this.protocol||"",qe=this.pathname||"",kt=this.hash||"",Lt=!1,jt="";this.host?Lt=Oe+this.host:this.hostname&&(Lt=Oe+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(Lt+=":"+this.port)),this.query&&$.isObject(this.query)&&Object.keys(this.query).length&&(jt=_e.stringify(this.query));var ti=this.search||jt&&"?"+jt||"";return Dt&&Dt.substr(-1)!==":"&&(Dt+=":"),this.slashes||(!Dt||xe[Dt])&&Lt!==!1?(Lt="//"+(Lt||""),qe&&qe.charAt(0)!=="/"&&(qe="/"+qe)):Lt||(Lt=""),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+Lt+qe+ti+kt};function Ue(Oe,Dt){return At(Oe,!1,!0).resolve(Dt)}oe.prototype.resolve=function(Oe){return this.resolveObject(At(Oe,!1,!0)).format()};function Ve(Oe,Dt){return Oe?At(Oe,!1,!0).resolveObject(Dt):Dt}oe.prototype.resolveObject=function(Oe){if($.isString(Oe)){var Dt=new oe;Dt.parse(Oe,!1,!0),Oe=Dt}for(var qe=new oe,kt=Object.keys(this),Lt=0;Lt<kt.length;Lt++){var jt=kt[Lt];qe[jt]=this[jt]}if(qe.hash=Oe.hash,Oe.href==="")return qe.href=qe.format(),qe;if(Oe.slashes&&!Oe.protocol){for(var ti=Object.keys(Oe),ei=0;ei<ti.length;ei++){var Pt=ti[ei];Pt!=="protocol"&&(qe[Pt]=Oe[Pt])}return xe[qe.protocol]&&qe.hostname&&!qe.pathname&&(qe.path=qe.pathname="/"),qe.href=qe.format(),qe}if(Oe.protocol&&Oe.protocol!==qe.protocol){if(!xe[Oe.protocol]){for(var ni=Object.keys(Oe),ri=0;ri<ni.length;ri++){var ci=ni[ri];qe[ci]=Oe[ci]}return qe.href=qe.format(),qe}if(qe.protocol=Oe.protocol,!Oe.host&&!Fe[Oe.protocol]){for(var wi=(Oe.pathname||"").split("/");wi.length&&!(Oe.host=wi.shift()););Oe.host||(Oe.host=""),Oe.hostname||(Oe.hostname=""),wi[0]!==""&&wi.unshift(""),wi.length<2&&wi.unshift(""),qe.pathname=wi.join("/")}else qe.pathname=Oe.pathname;if(qe.search=Oe.search,qe.query=Oe.query,qe.host=Oe.host||"",qe.auth=Oe.auth,qe.hostname=Oe.hostname||Oe.host,qe.port=Oe.port,qe.pathname||qe.search){var li=qe.pathname||"",si=qe.search||"";qe.path=li+si}return qe.slashes=qe.slashes||Oe.slashes,qe.href=qe.format(),qe}var ui=qe.pathname&&qe.pathname.charAt(0)==="/",hi=Oe.host||Oe.pathname&&Oe.pathname.charAt(0)==="/",Ai=hi||ui||qe.host&&Oe.pathname,Ni=Ai,yi=qe.pathname&&qe.pathname.split("/")||[],wi=Oe.pathname&&Oe.pathname.split("/")||[],Ci=qe.protocol&&!xe[qe.protocol];if(Ci&&(qe.hostname="",qe.port=null,qe.host&&(yi[0]===""?yi[0]=qe.host:yi.unshift(qe.host)),qe.host="",Oe.protocol&&(Oe.hostname=null,Oe.port=null,Oe.host&&(wi[0]===""?wi[0]=Oe.host:wi.unshift(Oe.host)),Oe.host=null),Ai=Ai&&(wi[0]===""||yi[0]==="")),hi)qe.host=Oe.host||Oe.host===""?Oe.host:qe.host,qe.hostname=Oe.hostname||Oe.hostname===""?Oe.hostname:qe.hostname,qe.search=Oe.search,qe.query=Oe.query,yi=wi;else if(wi.length)yi||(yi=[]),yi.pop(),yi=yi.concat(wi),qe.search=Oe.search,qe.query=Oe.query;else if(!$.isNullOrUndefined(Oe.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=Oe.search,qe.query=Oe.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 Mi=yi.slice(-1)[0],di=(qe.host||Oe.host||yi.length>1)&&(Mi==="."||Mi==="..")||Mi==="",pi=0,Si=yi.length;Si>=0;Si--)Mi=yi[Si],Mi==="."?yi.splice(Si,1):Mi===".."?(yi.splice(Si,1),pi++):pi&&(yi.splice(Si,1),pi--);if(!Ai&&!Ni)for(;pi--;pi)yi.unshift("..");Ai&&yi[0]!==""&&(!yi[0]||yi[0].charAt(0)!=="/")&&yi.unshift(""),di&&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 Ai=Ai||qe.host&&yi.length,Ai&&!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=Oe.auth||qe.auth,qe.slashes=qe.slashes||Oe.slashes,qe.href=qe.format(),qe},oe.prototype.parseHost=function(){var Oe=this.host,Dt=Ce.exec(Oe);Dt&&(Dt=Dt[0],Dt!==":"&&(this.port=Dt.substr(1)),Oe=Oe.substr(0,Oe.length-Dt.length)),Oe&&(this.hostname=Oe)}},{"./util":77,punycode:51,querystring:54}],77:[function(r,g,k){g.exports={isString:function(V){return typeof V=="string"},isObject:function(V){return typeof V=="object"&&V!==null},isNull:function(V){return V===null},isNullOrUndefined:function(V){return V==null}}},{}],78:[function(r,g,k){(function(V){(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(!V.localStorage)return!1}catch{return!1}var Ce=V.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,k){g.exports=V;function V($,oe){if($&&oe)return V($)(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,k){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,k){g.exports=$;var V=Object.prototype.hasOwnProperty;function $(){for(var oe={},re=0;re<arguments.length;re++){var Ce=arguments[re];for(var ie in Ce)V.call(Ce,ie)&&(oe[ie]=Ce[ie])}return oe}},{}],82:[function(r,g,k){g.exports=function(V){V.prototype[Symbol.iterator]=function*(){for(let $=this.head;$;$=$.next)yield $.value}}},{}],83:[function(r,g,k){g.exports=V,V.Node=Ce,V.create=V;function V(ie){var ae=this;if(ae instanceof V||(ae=new V),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}V.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},V.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++}},V.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++}},V.prototype.push=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)oe(this,arguments[ie]);return this.length},V.prototype.unshift=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)re(this,arguments[ie]);return this.length},V.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}},V.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}},V.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},V.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},V.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},V.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},V.prototype.map=function(ie,ae){ae=ae||this;for(var le=new V,Ie=this.head;Ie!==null;)le.push(ie.call(ae,Ie.value,this)),Ie=Ie.next;return le},V.prototype.mapReverse=function(ie,ae){ae=ae||this;for(var le=new V,Ie=this.tail;Ie!==null;)le.push(ie.call(ae,Ie.value,this)),Ie=Ie.prev;return le},V.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},V.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},V.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},V.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},V.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 V;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},V.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 V;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},V.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},V.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")(V)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(i,n,r,g,k)=>{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",k)},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:["on-message"],setup(i,{expose:n,emit:r}){const g=i,k=vue.getCurrentInstance();Object.keys(vueComp).forEach(de=>{var Ne;Object.keys((Ne=k==null?void 0:k.appContext)==null?void 0:Ne.components).includes(de)||k==null||k.appContext.app.component(de,vueComp[de])});const V=vue.reactive(g.data??{layout_center:{x:0,y:0},config:{svg:{background_color:"#fff",scale:1,position_center:{x:-333,y:-113},svg_position_center:{x:50,y:50}},net:{mqtt:{url:"",user:"",pwd:"",topics:""}}},done_json:[]}),$=useGlobalStore(pinia),oe=de=>{if($.mouse_info.state!=EMouseInfoState.Down&&$.intention!==EGlobalStoreIntention.Connection)return;if(!g.canvasDrag){console.log(g.canvasDrag);return}const{clientX:Ne,clientY:he}=de;$.mouse_info.new_position_x=$.mouse_info.now_position_x+Ne-$.mouse_info.position_x,$.mouse_info.new_position_y=$.mouse_info.now_position_y+he-$.mouse_info.position_y,$.intention==EGlobalStoreIntention.MoveCanvas&&(V.layout_center.x=$.mouse_info.new_position_x,V.layout_center.y=$.mouse_info.new_position_y)},re=()=>{$.mouse_info.state==EMouseInfoState.Down&&($.intention!=EGlobalStoreIntention.Select&&($.intention=EGlobalStoreIntention.None),$.setMouseInfo({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}))},Ce=de=>{console.log("onCanvasMouseDown",de);const{clientX:Ne,clientY:he}=de;$.intention=EGlobalStoreIntention.MoveCanvas,$.setMouseInfo({state:EMouseInfoState.Down,position_x:Ne,position_y:he,now_position_x:V.layout_center.x,now_position_y:V.layout_center.y,new_position_x:V.layout_center.x,new_position_y:V.layout_center.y})},ie=(de,Ne,he)=>({x:de.x-de.width/2*Ne+de.width/2,y:de.y-de.height/2*he+de.height/2,width:de.width*Ne,height:de.height*he}),ae=(de,Ne,he)=>setArrItemByID(de,Ne,he,V.done_json),le=de=>{var Ne;if(((Ne=de.events)==null?void 0:Ne.length)>0){for(let he of de.events)if(he.type===EEventType.Click||he.type===EEventType.Change){if(he.condition&&he.condition.type!=="None"&&he.condition.type==="Relation"&&he.condition.Relation&&he.condition.Relation.relation){const pe=he.condition.Relation.key,ze=he.condition.Relation.relation,Fe=valFormat(he.condition.Relation.val),xe=valFormat(he.condition.Relation.val2);if(de.props.hasOwnProperty(pe)){const _e=de.props[pe].val;if(!Ie(_e,ze,Fe,xe))continue}}if(he.action===EEventAction.ChangeAttr){if(he.attrs&&he.attrs.length>0){let pe;if(he.target){for(let ze of $.done_json)if(ze.id===he.target){pe=ze;break}}else pe=de;if(!pe)continue;for(let ze of he.attrs)pe.state&&pe.state.hasOwnProperty(ze.key)?pe.state[ze.key].default=valFormat(ze.val):pe.props.hasOwnProperty(ze.key)&&(pe.props[ze.key].val=valFormat(ze.val))}}else he.action===EEventAction.JavaScript&&new Function(he.scripts)()}}},Ie=(de,Ne,he,pe)=>{switch(Ne){case">":return de>he;case">=":return de>=he;case"<":return de<he;case"<=":return de<=he;case"==":return de==he;case"!=":return de!=he;case">=,=<":return de>=he&&de<=pe;case"<,>":return de<he||de>pe}};vue.onMounted(()=>{ue()}),vue.onBeforeUnmount(close);const ue=()=>{const de=V.config.net.mqtt;de&&de.url&&de.user&&de.pwd&&de.topics&&sub(de.url,de.user,de.pwd,de.topics,(Ne,he)=>{console.log(Ne),console.log(he.toString()),r("on-message",{topics:Ne,message:he})})};return n({setNodeAttrByID:ae}),(de,Ne)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:Ce,onMousemove:oe,onMouseup:re},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(V).config.svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("g",{transform:`translate(${vue.unref(V).config.svg.position_center.x+vue.unref(V).layout_center.x},${vue.unref(V).config.svg.position_center.y+vue.unref(V).layout_center.y})rotate(0)scale(${vue.unref(V).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(V).done_json,he=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:he.id,transform:`translate(${he.x},${he.y})rotate(0)scale(1)`,onClick:pe=>le(he)},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(he)}`)},[vue.createElementVNode("g",{transform:`translate(${he.actual_bound.x+he.actual_bound.width/2},${he.actual_bound.y+he.actual_bound.height/2})rotate(${he.rotate}) scale(1) translate(${-(he.actual_bound.x+he.actual_bound.width/2)},${-(he.actual_bound.y+he.actual_bound.height/2)})`},[he.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$d,{key:0,"item-info":he},null,8,["item-info"])):he.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${he.name}`},vue.unref(prosToVBind)(he),{width:"100",height:"100",id:he.id,transform:`translate(${he.actual_bound.x+he.actual_bound.width/2},${he.actual_bound.y+he.actual_bound.height/2}) scale(${he.scale_x},${he.scale_y}) translate(${-(he.actual_bound.x+he.actual_bound.width/2)},${-(he.actual_bound.y+he.actual_bound.height/2)})`}),null,16,_hoisted_4)):he.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(he.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(he),{width:"100",height:"100",id:he.id,onOnChange:pe=>le(he),transform:`translate(${he.actual_bound.x+he.actual_bound.width/2},${he.actual_bound.y+he.actual_bound.height/2}) scale(${he.scale_x},${he.scale_y}) translate(${-(he.actual_bound.x+he.actual_bound.width/2)},${-(he.actual_bound.y+he.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):he.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},ie(he.actual_bound,he.scale_x,he.scale_y),{id:`foreign-object${he.id}`}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(he.tag),vue.mergeProps(vue.unref(prosToVBind)(he),{id:he.id,onOnChange:pe=>le(he),transform:`translate(${he.actual_bound.x+he.actual_bound.width/2},${he.actual_bound.y+he.actual_bound.height/2}) scale(${he.scale_x},${he.scale_y}) translate(${-(he.actual_bound.x+he.actual_bound.width/2)},${-(he.actual_bound.y+he.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(he.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],8,_hoisted_2)),[[vue.vShow,he.display]])),128))],8,_hoisted_1)],4))],32))}}),index_vue_vue_type_style_index_0_scoped_33e19188_lang="",index=_export_sfc(_sfc_main,[["__scopeId","data-v-33e19188"]]);exports.SvgEditor=index$1,exports.SvgViewer=index,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
1203
|
+
`," "],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},Fe={javascript:!0,"javascript:":!0},xe={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(Oe,Dt,qe){if(Oe&&$.isObject(Oe)&&Oe instanceof oe)return Oe;var kt=new oe;return kt.parse(Oe,Dt,qe),kt}oe.prototype.parse=function(Oe,Dt,qe){if(!$.isString(Oe))throw new TypeError("Parameter 'url' must be a string, not "+typeof Oe);var kt=Oe.indexOf("?"),Lt=kt!==-1&&kt<Oe.indexOf("#")?"?":"#",jt=Oe.split(Lt),ti=/\\/g;jt[0]=jt[0].replace(ti,"/"),Oe=jt.join(Lt);var ei=Oe;if(ei=ei.trim(),!qe&&Oe.split("#").length===1){var Pt=ie.exec(ei);if(Pt)return this.path=ei,this.href=ei,this.pathname=Pt[1],Pt[2]?(this.search=Pt[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 ci=ei.substr(0,2)==="//";ci&&!(ni&&Fe[ni])&&(ei=ei.substr(2),this.slashes=!0)}if(!Fe[ni]&&(ci||ni&&!xe[ni])){for(var li=-1,si=0;si<de.length;si++){var ui=ei.indexOf(de[si]);ui!==-1&&(li===-1||ui<li)&&(li=ui)}var hi,Ai;li===-1?Ai=ei.lastIndexOf("@"):Ai=ei.lastIndexOf("@",li),Ai!==-1&&(hi=ei.slice(0,Ai),ei=ei.slice(Ai+1),this.auth=decodeURIComponent(hi)),li=-1;for(var si=0;si<ue.length;si++){var ui=ei.indexOf(ue[si]);ui!==-1&&(li===-1||ui<li)&&(li=ui)}li===-1&&(li=ei.length),this.host=ei.slice(0,li),ei=ei.slice(li),this.parseHost(),this.hostname=this.hostname||"";var Ni=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!Ni)for(var yi=this.hostname.split(/\./),si=0,wi=yi.length;si<wi;si++){var Ci=yi[si];if(Ci&&!Ci.match(he)){for(var zi="",Mi=0,di=Ci.length;Mi<di;Mi++)Ci.charCodeAt(Mi)>127?zi+="x":zi+=Ci[Mi];if(!zi.match(he)){var pi=yi.slice(0,si),Si=yi.slice(si+1),bi=Ci.match(pe);bi&&(pi.push(bi[1]),Si.unshift(bi[2])),Si.length&&(ei="/"+Si.join(".")+ei),this.hostname=pi.join(".");break}}}this.hostname.length>Ne?this.hostname="":this.hostname=this.hostname.toLowerCase(),Ni||(this.hostname=V.toASCII(this.hostname));var ai=this.port?":"+this.port:"",Ii=this.hostname||"";this.host=Ii+ai,this.href+=this.host,Ni&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ei[0]!=="/"&&(ei="/"+ei))}if(!ze[ri])for(var si=0,wi=Ie.length;si<wi;si++){var oi=Ie[si];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 gi=ei.indexOf("?");if(gi!==-1?(this.search=ei.substr(gi),this.query=ei.substr(gi+1),Dt&&(this.query=_e.parse(this.query)),ei=ei.slice(0,gi)):Dt&&(this.search="",this.query={}),ei&&(this.pathname=ei),xe[ri]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ai=this.pathname||"",mi=this.search||"";this.path=ai+mi}return this.href=this.format(),this};function $e(Oe){return $.isString(Oe)&&(Oe=At(Oe)),Oe instanceof oe?Oe.format():oe.prototype.format.call(Oe)}oe.prototype.format=function(){var Oe=this.auth||"";Oe&&(Oe=encodeURIComponent(Oe),Oe=Oe.replace(/%3A/i,":"),Oe+="@");var Dt=this.protocol||"",qe=this.pathname||"",kt=this.hash||"",Lt=!1,jt="";this.host?Lt=Oe+this.host:this.hostname&&(Lt=Oe+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(Lt+=":"+this.port)),this.query&&$.isObject(this.query)&&Object.keys(this.query).length&&(jt=_e.stringify(this.query));var ti=this.search||jt&&"?"+jt||"";return Dt&&Dt.substr(-1)!==":"&&(Dt+=":"),this.slashes||(!Dt||xe[Dt])&&Lt!==!1?(Lt="//"+(Lt||""),qe&&qe.charAt(0)!=="/"&&(qe="/"+qe)):Lt||(Lt=""),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+Lt+qe+ti+kt};function Ue(Oe,Dt){return At(Oe,!1,!0).resolve(Dt)}oe.prototype.resolve=function(Oe){return this.resolveObject(At(Oe,!1,!0)).format()};function Ve(Oe,Dt){return Oe?At(Oe,!1,!0).resolveObject(Dt):Dt}oe.prototype.resolveObject=function(Oe){if($.isString(Oe)){var Dt=new oe;Dt.parse(Oe,!1,!0),Oe=Dt}for(var qe=new oe,kt=Object.keys(this),Lt=0;Lt<kt.length;Lt++){var jt=kt[Lt];qe[jt]=this[jt]}if(qe.hash=Oe.hash,Oe.href==="")return qe.href=qe.format(),qe;if(Oe.slashes&&!Oe.protocol){for(var ti=Object.keys(Oe),ei=0;ei<ti.length;ei++){var Pt=ti[ei];Pt!=="protocol"&&(qe[Pt]=Oe[Pt])}return xe[qe.protocol]&&qe.hostname&&!qe.pathname&&(qe.path=qe.pathname="/"),qe.href=qe.format(),qe}if(Oe.protocol&&Oe.protocol!==qe.protocol){if(!xe[Oe.protocol]){for(var ni=Object.keys(Oe),ri=0;ri<ni.length;ri++){var ci=ni[ri];qe[ci]=Oe[ci]}return qe.href=qe.format(),qe}if(qe.protocol=Oe.protocol,!Oe.host&&!Fe[Oe.protocol]){for(var wi=(Oe.pathname||"").split("/");wi.length&&!(Oe.host=wi.shift()););Oe.host||(Oe.host=""),Oe.hostname||(Oe.hostname=""),wi[0]!==""&&wi.unshift(""),wi.length<2&&wi.unshift(""),qe.pathname=wi.join("/")}else qe.pathname=Oe.pathname;if(qe.search=Oe.search,qe.query=Oe.query,qe.host=Oe.host||"",qe.auth=Oe.auth,qe.hostname=Oe.hostname||Oe.host,qe.port=Oe.port,qe.pathname||qe.search){var li=qe.pathname||"",si=qe.search||"";qe.path=li+si}return qe.slashes=qe.slashes||Oe.slashes,qe.href=qe.format(),qe}var ui=qe.pathname&&qe.pathname.charAt(0)==="/",hi=Oe.host||Oe.pathname&&Oe.pathname.charAt(0)==="/",Ai=hi||ui||qe.host&&Oe.pathname,Ni=Ai,yi=qe.pathname&&qe.pathname.split("/")||[],wi=Oe.pathname&&Oe.pathname.split("/")||[],Ci=qe.protocol&&!xe[qe.protocol];if(Ci&&(qe.hostname="",qe.port=null,qe.host&&(yi[0]===""?yi[0]=qe.host:yi.unshift(qe.host)),qe.host="",Oe.protocol&&(Oe.hostname=null,Oe.port=null,Oe.host&&(wi[0]===""?wi[0]=Oe.host:wi.unshift(Oe.host)),Oe.host=null),Ai=Ai&&(wi[0]===""||yi[0]==="")),hi)qe.host=Oe.host||Oe.host===""?Oe.host:qe.host,qe.hostname=Oe.hostname||Oe.hostname===""?Oe.hostname:qe.hostname,qe.search=Oe.search,qe.query=Oe.query,yi=wi;else if(wi.length)yi||(yi=[]),yi.pop(),yi=yi.concat(wi),qe.search=Oe.search,qe.query=Oe.query;else if(!$.isNullOrUndefined(Oe.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=Oe.search,qe.query=Oe.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 Mi=yi.slice(-1)[0],di=(qe.host||Oe.host||yi.length>1)&&(Mi==="."||Mi==="..")||Mi==="",pi=0,Si=yi.length;Si>=0;Si--)Mi=yi[Si],Mi==="."?yi.splice(Si,1):Mi===".."?(yi.splice(Si,1),pi++):pi&&(yi.splice(Si,1),pi--);if(!Ai&&!Ni)for(;pi--;pi)yi.unshift("..");Ai&&yi[0]!==""&&(!yi[0]||yi[0].charAt(0)!=="/")&&yi.unshift(""),di&&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 Ai=Ai||qe.host&&yi.length,Ai&&!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=Oe.auth||qe.auth,qe.slashes=qe.slashes||Oe.slashes,qe.href=qe.format(),qe},oe.prototype.parseHost=function(){var Oe=this.host,Dt=Ce.exec(Oe);Dt&&(Dt=Dt[0],Dt!==":"&&(this.port=Dt.substr(1)),Oe=Oe.substr(0,Oe.length-Dt.length)),Oe&&(this.hostname=Oe)}},{"./util":77,punycode:51,querystring:54}],77:[function(r,g,k){g.exports={isString:function(V){return typeof V=="string"},isObject:function(V){return typeof V=="object"&&V!==null},isNull:function(V){return V===null},isNullOrUndefined:function(V){return V==null}}},{}],78:[function(r,g,k){(function(V){(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(!V.localStorage)return!1}catch{return!1}var Ce=V.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,k){g.exports=V;function V($,oe){if($&&oe)return V($)(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,k){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,k){g.exports=$;var V=Object.prototype.hasOwnProperty;function $(){for(var oe={},re=0;re<arguments.length;re++){var Ce=arguments[re];for(var ie in Ce)V.call(Ce,ie)&&(oe[ie]=Ce[ie])}return oe}},{}],82:[function(r,g,k){g.exports=function(V){V.prototype[Symbol.iterator]=function*(){for(let $=this.head;$;$=$.next)yield $.value}}},{}],83:[function(r,g,k){g.exports=V,V.Node=Ce,V.create=V;function V(ie){var ae=this;if(ae instanceof V||(ae=new V),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}V.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},V.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++}},V.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++}},V.prototype.push=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)oe(this,arguments[ie]);return this.length},V.prototype.unshift=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)re(this,arguments[ie]);return this.length},V.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}},V.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}},V.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},V.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},V.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},V.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},V.prototype.map=function(ie,ae){ae=ae||this;for(var le=new V,Ie=this.head;Ie!==null;)le.push(ie.call(ae,Ie.value,this)),Ie=Ie.next;return le},V.prototype.mapReverse=function(ie,ae){ae=ae||this;for(var le=new V,Ie=this.tail;Ie!==null;)le.push(ie.call(ae,Ie.value,this)),Ie=Ie.prev;return le},V.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},V.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},V.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},V.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},V.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 V;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},V.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 V;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},V.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},V.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")(V)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(i,n,r,g,k)=>{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",k)},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,k=vue.getCurrentInstance();Object.keys(vueComp).forEach(de=>{var Ne;Object.keys((Ne=k==null?void 0:k.appContext)==null?void 0:Ne.components).includes(de)||k==null||k.appContext.app.component(de,vueComp[de])});const V=vue.reactive(g.data??{layout_center:{x:0,y:0},config:{svg:{background_color:"#fff",scale:1,position_center:{x:-333,y:-113},svg_position_center:{x:50,y:50}},net:{mqtt:{url:"",user:"",pwd:"",topics:""}}},done_json:[]}),$=useGlobalStore(pinia),oe=de=>{if($.mouse_info.state!=EMouseInfoState.Down&&$.intention!==EGlobalStoreIntention.Connection)return;if(!g.canvasDrag){console.log(g.canvasDrag);return}const{clientX:Ne,clientY:he}=de;$.mouse_info.new_position_x=$.mouse_info.now_position_x+Ne-$.mouse_info.position_x,$.mouse_info.new_position_y=$.mouse_info.now_position_y+he-$.mouse_info.position_y,$.intention==EGlobalStoreIntention.MoveCanvas&&(V.layout_center.x=$.mouse_info.new_position_x,V.layout_center.y=$.mouse_info.new_position_y)},re=()=>{$.mouse_info.state==EMouseInfoState.Down&&($.intention!=EGlobalStoreIntention.Select&&($.intention=EGlobalStoreIntention.None),$.setMouseInfo({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}))},Ce=de=>{console.log("onCanvasMouseDown",de);const{clientX:Ne,clientY:he}=de;$.intention=EGlobalStoreIntention.MoveCanvas,$.setMouseInfo({state:EMouseInfoState.Down,position_x:Ne,position_y:he,now_position_x:V.layout_center.x,now_position_y:V.layout_center.y,new_position_x:V.layout_center.x,new_position_y:V.layout_center.y})},ie=(de,Ne,he)=>({x:de.x-de.width/2*Ne+de.width/2,y:de.y-de.height/2*he+de.height/2,width:de.width*Ne,height:de.height*he}),ae=(de,Ne,he)=>setArrItemByID(de,Ne,he,V.done_json),le=de=>{var Ne;if(((Ne=de.events)==null?void 0:Ne.length)>0){for(let he of de.events)if(he.type===EEventType.Click||he.type===EEventType.Change){if(he.condition&&he.condition.type!=="None"&&he.condition.type==="Relation"&&he.condition.Relation&&he.condition.Relation.relation){const pe=he.condition.Relation.key,ze=he.condition.Relation.relation,Fe=valFormat(he.condition.Relation.val),xe=valFormat(he.condition.Relation.val2);if(de.props.hasOwnProperty(pe)){const _e=de.props[pe].val;if(!Ie(_e,ze,Fe,xe))continue}}if(he.action===EEventAction.ChangeAttr){if(he.attrs&&he.attrs.length>0){let pe;if(he.target){for(let ze of $.done_json)if(ze.id===he.target){pe=ze;break}}else pe=de;if(!pe)continue;for(let ze of he.attrs)pe.state&&pe.state.hasOwnProperty(ze.key)?pe.state[ze.key].default=valFormat(ze.val):pe.props.hasOwnProperty(ze.key)&&(pe.props[ze.key].val=valFormat(ze.val))}}else he.action===EEventAction.JavaScript&&new Function(he.scripts)()}}},Ie=(de,Ne,he,pe)=>{switch(Ne){case">":return de>he;case">=":return de>=he;case"<":return de<he;case"<=":return de<=he;case"==":return de==he;case"!=":return de!=he;case">=,=<":return de>=he&&de<=pe;case"<,>":return de<he||de>pe}};vue.onMounted(()=>{ue()}),vue.onBeforeUnmount(close);const ue=()=>{const de=V.config.net.mqtt;de&&de.url&&de.user&&de.pwd&&de.topics&&sub(de.url,de.user,de.pwd,de.topics,(Ne,he)=>{console.log(Ne),console.log(he.toString()),r("onMessage",{topics:Ne,message:he})})};return n({setNodeAttrByID:ae}),(de,Ne)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:Ce,onMousemove:oe,onMouseup:re},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(V).config.svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("g",{transform:`translate(${vue.unref(V).config.svg.position_center.x+vue.unref(V).layout_center.x},${vue.unref(V).config.svg.position_center.y+vue.unref(V).layout_center.y})rotate(0)scale(${vue.unref(V).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(V).done_json,he=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:he.id,transform:`translate(${he.x},${he.y})rotate(0)scale(1)`,onClick:pe=>le(he)},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(he)}`)},[vue.createElementVNode("g",{transform:`translate(${he.actual_bound.x+he.actual_bound.width/2},${he.actual_bound.y+he.actual_bound.height/2})rotate(${he.rotate}) scale(1) translate(${-(he.actual_bound.x+he.actual_bound.width/2)},${-(he.actual_bound.y+he.actual_bound.height/2)})`},[he.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$d,{key:0,"item-info":he},null,8,["item-info"])):he.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${he.name}`},vue.unref(prosToVBind)(he),{width:"100",height:"100",id:he.id,transform:`translate(${he.actual_bound.x+he.actual_bound.width/2},${he.actual_bound.y+he.actual_bound.height/2}) scale(${he.scale_x},${he.scale_y}) translate(${-(he.actual_bound.x+he.actual_bound.width/2)},${-(he.actual_bound.y+he.actual_bound.height/2)})`}),null,16,_hoisted_4)):he.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(he.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(he),{width:"100",height:"100",id:he.id,onOnChange:pe=>le(he),transform:`translate(${he.actual_bound.x+he.actual_bound.width/2},${he.actual_bound.y+he.actual_bound.height/2}) scale(${he.scale_x},${he.scale_y}) translate(${-(he.actual_bound.x+he.actual_bound.width/2)},${-(he.actual_bound.y+he.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):he.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},ie(he.actual_bound,he.scale_x,he.scale_y),{id:`foreign-object${he.id}`}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(he.tag),vue.mergeProps(vue.unref(prosToVBind)(he),{id:he.id,onOnChange:pe=>le(he),transform:`translate(${he.actual_bound.x+he.actual_bound.width/2},${he.actual_bound.y+he.actual_bound.height/2}) scale(${he.scale_x},${he.scale_y}) translate(${-(he.actual_bound.x+he.actual_bound.width/2)},${-(he.actual_bound.y+he.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(he.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],8,_hoisted_2)),[[vue.vShow,he.display]])),128))],8,_hoisted_1)],4))],32))}}),index_vue_vue_type_style_index_0_scoped_fad321b8_lang="",index=_export_sfc(_sfc_main,[["__scopeId","data-v-fad321b8"]]);exports.SvgEditor=index$1,exports.SvgViewer=index,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|