@zhangqingcq/vgce 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/vgce.umd.cjs CHANGED
@@ -248,7 +248,7 @@ echarts.use([`+F+"]);":"Unknown series "+L))}return}if(g==="tooltip"){if(w){proc
248
248
 
249
249
  `:"<br/>",b=g.join(S);this._showOrMove(f,function(){this._updateContentNotChangedOnAxis(i,p)?this._updatePosition(f,y,c[0],c[1],this._tooltipContent,p):this._showTooltipContent(f,b,p,Math.random()+"",c[0],c[1],y,null,v)})},n.prototype._showSeriesItemTooltip=function(i,o,a){var u=this._ecModel,c=getECData(o),f=c.seriesIndex,d=u.getSeriesByIndex(f),p=c.dataModel||d,h=c.dataIndex,g=c.dataType,v=p.getData(g),y=this._renderMode,A=i.positionDefault,_=buildTooltipModel([v.getItemModel(h),p,d&&(d.coordinateSystem||{}).model],this._tooltipModel,A?{position:A}:null),S=_.get("trigger");if(!(S!=null&&S!=="item")){var b=p.getDataParams(h,g),T=new TooltipMarkupStyleCreator;b.marker=T.makeTooltipMarker("item",convertToColorString(b.color),y);var w=normalizeTooltipFormatResult(p.formatTooltip(h,!1,g)),x=_.get("order"),k=_.get("valueFormatter"),M=w.frag,D=M?buildTooltipMarkup(k?extend({valueFormatter:k},M):M,T,y,x,u.get("useUTC"),_.get("textStyle")):w.text,z="item_"+p.name+"_"+h;this._showOrMove(_,function(){this._showTooltipContent(_,D,b,z,i.offsetX,i.offsetY,i.position,i.target,T)}),a({type:"showTip",dataIndexInside:h,dataIndex:v.getRawIndex(h),seriesIndex:f,from:this.uid})}},n.prototype._showComponentItemTooltip=function(i,o,a){var u=getECData(o),c=u.tooltipConfig,f=c.option||{};if(isString$2(f)){var d=f;f={content:d,formatter:d}}var p=[f],h=this._ecModel.getComponent(u.componentMainType,u.componentIndex);h&&p.push(h),p.push({formatter:f.content});var g=i.positionDefault,v=buildTooltipModel(p,this._tooltipModel,g?{position:g}:null),y=v.get("content"),A=Math.random()+"",_=new TooltipMarkupStyleCreator;this._showOrMove(v,function(){var S=clone$2(v.get("formatterParams")||{});this._showTooltipContent(v,y,S,A,i.offsetX,i.offsetY,i.position,o,_)}),a({type:"showTip",from:this.uid})},n.prototype._showTooltipContent=function(i,o,a,u,c,f,d,p,h){if(this._ticket="",!(!i.get("showContent")||!i.get("show"))){var g=this._tooltipContent;g.setEnterable(i.get("enterable"));var v=i.get("formatter");d=d||i.get("position");var y=o,A=this._getNearestPoint([c,f],a,i.get("trigger"),i.get("borderColor")),_=A.color;if(v)if(isString$2(v)){var S=i.ecModel.get("useUTC"),b=isArray$1(a)?a[0]:a,T=b&&b.axisType&&b.axisType.indexOf("time")>=0;y=v,T&&(y=format$1(b.axisValue,y,S)),y=formatTpl(y,a,!0)}else if(isFunction$1(v)){var w=bind$1(function(x,k){x===this._ticket&&(g.setContent(k,h,i,_,d),this._updatePosition(i,d,c,f,g,a,p))},this);this._ticket=u,y=v(a,u,w)}else y=v;g.setContent(y,h,i,_,d),g.show(i,_),this._updatePosition(i,d,c,f,g,a,p)}},n.prototype._getNearestPoint=function(i,o,a,u){if(a==="axis"||isArray$1(o))return{color:u||(this._renderMode==="html"?"#fff":"none")};if(!isArray$1(o))return{color:u||o.color||o.borderColor}},n.prototype._updatePosition=function(i,o,a,u,c,f,d){var p=this._api.getWidth(),h=this._api.getHeight();o=o||i.get("position");var g=c.getSize(),v=i.get("align"),y=i.get("verticalAlign"),A=d&&d.getBoundingRect().clone();if(d&&A.applyTransform(d.transform),isFunction$1(o)&&(o=o([a,u],f,c.el,A,{viewSize:[p,h],contentSize:g.slice()})),isArray$1(o))a=parsePercent(o[0],p),u=parsePercent(o[1],h);else if(isObject$3(o)){var _=o;_.width=g[0],_.height=g[1];var S=getLayoutRect(_,{width:p,height:h});a=S.x,u=S.y,v=null,y=null}else if(isString$2(o)&&d){var b=calcTooltipPosition(o,A,g,i.get("borderWidth"));a=b[0],u=b[1]}else{var b=refixTooltipPosition(a,u,c,p,h,v?null:20,y?null:20);a=b[0],u=b[1]}if(v&&(a-=isCenterAlign(v)?g[0]/2:v==="right"?g[0]:0),y&&(u-=isCenterAlign(y)?g[1]/2:y==="bottom"?g[1]:0),shouldTooltipConfine(i)){var b=confineTooltipPosition(a,u,c,p,h);a=b[0],u=b[1]}c.moveTo(a,u)},n.prototype._updateContentNotChangedOnAxis=function(i,o){var a=this._lastDataByCoordSys,u=this._cbParamsList,c=!!a&&a.length===i.length;return c&&each$4(a,function(f,d){var p=f.dataByAxis||[],h=i[d]||{},g=h.dataByAxis||[];c=c&&p.length===g.length,c&&each$4(p,function(v,y){var A=g[y]||{},_=v.seriesDataIndices||[],S=A.seriesDataIndices||[];c=c&&v.value===A.value&&v.axisType===A.axisType&&v.axisId===A.axisId&&_.length===S.length,c&&each$4(_,function(b,T){var w=S[T];c=c&&b.seriesIndex===w.seriesIndex&&b.dataIndex===w.dataIndex}),u&&each$4(v.seriesDataIndices,function(b){var T=b.seriesIndex,w=o[T],x=u[T];w&&x&&x.data!==w.data&&(c=!1)})})}),this._lastDataByCoordSys=i,this._cbParamsList=o,!!c},n.prototype._hide=function(i){this._lastDataByCoordSys=null,i({type:"hideTip",from:this.uid})},n.prototype.dispose=function(i,o){env$1.node||!o.getDom()||(clear(this,"_updatePosition"),this._tooltipContent.dispose(),unregister("itemTooltip",o))},n.type="tooltip",n}(ComponentView$1);function buildTooltipModel(r,n,i){var o=n.ecModel,a;i?(a=new Model$1(i,o,o),a=new Model$1(n.option,a,o)):a=n;for(var u=r.length-1;u>=0;u--){var c=r[u];c&&(c instanceof Model$1&&(c=c.get("tooltip",!0)),isString$2(c)&&(c={formatter:c}),c&&(a=new Model$1(c,a,o)))}return a}function makeDispatchAction(r,n){return r.dispatchAction||bind$1(n.dispatchAction,n)}function refixTooltipPosition(r,n,i,o,a,u,c){var f=i.getSize(),d=f[0],p=f[1];return u!=null&&(r+d+u+2>o?r-=d+u:r+=u),c!=null&&(n+p+c>a?n-=p+c:n+=c),[r,n]}function confineTooltipPosition(r,n,i,o,a){var u=i.getSize(),c=u[0],f=u[1];return r=Math.min(r+c,o)-c,n=Math.min(n+f,a)-f,r=Math.max(r,0),n=Math.max(n,0),[r,n]}function calcTooltipPosition(r,n,i,o){var a=i[0],u=i[1],c=Math.ceil(Math.SQRT2*o)+8,f=0,d=0,p=n.width,h=n.height;switch(r){case"inside":f=n.x+p/2-a/2,d=n.y+h/2-u/2;break;case"top":f=n.x+p/2-a/2,d=n.y-u-c;break;case"bottom":f=n.x+p/2-a/2,d=n.y+h+c;break;case"left":f=n.x-a-c,d=n.y+h/2-u/2;break;case"right":f=n.x+p+c,d=n.y+h/2-u/2}return[f,d]}function isCenterAlign(r){return r==="center"||r==="middle"}function findComponentReference(r,n,i){var o=preParseFinder(r).queryOptionMap,a=o.keys()[0];if(!(!a||a==="series")){var u=queryReferringComponents(n,a,o.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),c=u.models[0];if(c){var f=i.getViewOfComponentModel(c),d;if(f.group.traverse(function(p){var h=getECData(p).tooltipConfig;if(h&&h.name===r.name)return d=p,!0}),d)return{componentMainType:a,componentIndex:c.componentIndex,el:d}}}}const TooltipView$1=TooltipView;function install$4(r){use(install$5),r.registerComponentModel(TooltipModel$1),r.registerComponentView(TooltipView$1),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},noop$1),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},noop$1)}var TitleModel=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.layoutMode={type:"box",ignoreSize:!0},i}return n.type="title",n.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},n}(ComponentModel$1),TitleView=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i}return n.prototype.render=function(i,o,a){if(this.group.removeAll(),!!i.get("show")){var u=this.group,c=i.getModel("textStyle"),f=i.getModel("subtextStyle"),d=i.get("textAlign"),p=retrieve2(i.get("textBaseline"),i.get("textVerticalAlign")),h=new ZRText$1({style:createTextStyle(c,{text:i.get("text"),fill:c.getTextColor()},{disableBox:!0}),z2:10}),g=h.getBoundingRect(),v=i.get("subtext"),y=new ZRText$1({style:createTextStyle(f,{text:v,fill:f.getTextColor(),y:g.height+i.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),A=i.get("link"),_=i.get("sublink"),S=i.get("triggerEvent",!0);h.silent=!A&&!S,y.silent=!_&&!S,A&&h.on("click",function(){windowOpen(A,"_"+i.get("target"))}),_&&y.on("click",function(){windowOpen(_,"_"+i.get("subtarget"))}),getECData(h).eventData=getECData(y).eventData=S?{componentType:"title",componentIndex:i.componentIndex}:null,u.add(h),v&&u.add(y);var b=u.getBoundingRect(),T=i.getBoxLayoutParams();T.width=b.width,T.height=b.height;var w=getLayoutRect(T,{width:a.getWidth(),height:a.getHeight()},i.get("padding"));d||(d=i.get("left")||i.get("right"),d==="middle"&&(d="center"),d==="right"?w.x+=w.width:d==="center"&&(w.x+=w.width/2)),p||(p=i.get("top")||i.get("bottom"),p==="center"&&(p="middle"),p==="bottom"?w.y+=w.height:p==="middle"&&(w.y+=w.height/2),p=p||"top"),u.x=w.x,u.y=w.y,u.markRedraw();var x={align:d,verticalAlign:p};h.setStyle(x),y.setStyle(x),b=u.getBoundingRect();var k=w.margin,M=i.getItemStyle(["color","opacity"]);M.fill=i.get("backgroundColor");var D=new Rect$1({shape:{x:b.x-k[3],y:b.y-k[0],width:b.width+k[1]+k[3],height:b.height+k[0]+k[2],r:i.get("borderRadius")},style:M,subPixelOptimize:!0,silent:!0});u.add(D)}},n.type="title",n}(ComponentView$1);function install$3(r){r.registerComponentModel(TitleModel),r.registerComponentView(TitleView)}var getDefaultSelectorOptions=function(r,n){if(n==="all")return{type:"all",title:r.getLocaleModel().get(["legend","selector","all"])};if(n==="inverse")return{type:"inverse",title:r.getLocaleModel().get(["legend","selector","inverse"])}},LegendModel=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.layoutMode={type:"box",ignoreSize:!0},i}return n.prototype.init=function(i,o,a){this.mergeDefaultAndTheme(i,a),i.selected=i.selected||{},this._updateSelector(i)},n.prototype.mergeOption=function(i,o){r.prototype.mergeOption.call(this,i,o),this._updateSelector(i)},n.prototype._updateSelector=function(i){var o=i.selector,a=this.ecModel;o===!0&&(o=i.selector=["all","inverse"]),isArray$1(o)&&each$4(o,function(u,c){isString$2(u)&&(u={type:u}),o[c]=merge(u,getDefaultSelectorOptions(a,u.type))})},n.prototype.optionUpdated=function(){this._updateData(this.ecModel);var i=this._data;if(i[0]&&this.get("selectedMode")==="single"){for(var o=!1,a=0;a<i.length;a++){var u=i[a].get("name");if(this.isSelected(u)){this.select(u),o=!0;break}}!o&&this.select(i[0].get("name"))}},n.prototype._updateData=function(i){var o=[],a=[];i.eachRawSeries(function(d){var p=d.name;a.push(p);var h;if(d.legendVisualProvider){var g=d.legendVisualProvider,v=g.getAllNames();i.isSeriesFiltered(d)||(a=a.concat(v)),v.length?o=o.concat(v):h=!0}else h=!0;h&&isNameSpecified(d)&&o.push(d.name)}),this._availableNames=a;var u=this.get("data")||o,c=createHashMap(),f=map$1(u,function(d){return(isString$2(d)||isNumber$1(d))&&(d={name:d}),c.get(d.name)?null:(c.set(d.name,!0),new Model$1(d,this,this.ecModel))},this);this._data=filter(f,function(d){return!!d})},n.prototype.getData=function(){return this._data},n.prototype.select=function(i){var o=this.option.selected,a=this.get("selectedMode");if(a==="single"){var u=this._data;each$4(u,function(c){o[c.get("name")]=!1})}o[i]=!0},n.prototype.unSelect=function(i){this.get("selectedMode")!=="single"&&(this.option.selected[i]=!1)},n.prototype.toggleSelected=function(i){var o=this.option.selected;o.hasOwnProperty(i)||(o[i]=!0),this[o[i]?"unSelect":"select"](i)},n.prototype.allSelect=function(){var i=this._data,o=this.option.selected;each$4(i,function(a){o[a.get("name",!0)]=!0})},n.prototype.inverseSelect=function(){var i=this._data,o=this.option.selected;each$4(i,function(a){var u=a.get("name",!0);o.hasOwnProperty(u)||(o[u]=!0),o[u]=!o[u]})},n.prototype.isSelected=function(i){var o=this.option.selected;return!(o.hasOwnProperty(i)&&!o[i])&&indexOf(this._availableNames,i)>=0},n.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},n.type="legend.plain",n.dependencies=["series"],n.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},n}(ComponentModel$1);const LegendModel$1=LegendModel;var curry=curry$1,each=each$4,Group$1=Group$3,LegendView=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.newlineDisabled=!1,i}return n.prototype.init=function(){this.group.add(this._contentGroup=new Group$1),this.group.add(this._selectorGroup=new Group$1),this._isFirstRender=!0},n.prototype.getContentGroup=function(){return this._contentGroup},n.prototype.getSelectorGroup=function(){return this._selectorGroup},n.prototype.render=function(i,o,a){var u=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!i.get("show",!0)){var c=i.get("align"),f=i.get("orient");(!c||c==="auto")&&(c=i.get("left")==="right"&&f==="vertical"?"right":"left");var d=i.get("selector",!0),p=i.get("selectorPosition",!0);d&&(!p||p==="auto")&&(p=f==="horizontal"?"end":"start"),this.renderInner(c,i,o,a,d,f,p);var h=i.getBoxLayoutParams(),g={width:a.getWidth(),height:a.getHeight()},v=i.get("padding"),y=getLayoutRect(h,g,v),A=this.layoutInner(i,c,y,u,d,p),_=getLayoutRect(defaults({width:A.width,height:A.height},h),g,v);this.group.x=_.x-A.x,this.group.y=_.y-A.y,this.group.markRedraw(),this.group.add(this._backgroundEl=makeBackground(A,i))}},n.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},n.prototype.renderInner=function(i,o,a,u,c,f,d){var p=this.getContentGroup(),h=createHashMap(),g=o.get("selectedMode"),v=[];a.eachRawSeries(function(y){!y.get("legendHoverLink")&&v.push(y.id)}),each(o.getData(),function(y,A){var _=y.get("name");if(!this.newlineDisabled&&(_===""||_===`
250
250
  `)){var S=new Group$1;S.newline=!0,p.add(S);return}var b=a.getSeriesByName(_)[0];if(!h.get(_)){if(b){var T=b.getData(),w=T.getVisual("legendLineStyle")||{},x=T.getVisual("legendIcon"),k=T.getVisual("style"),M=this._createItem(b,_,A,y,o,i,w,k,x,g,u);M.on("click",curry(dispatchSelectAction,_,null,u,v)).on("mouseover",curry(dispatchHighlightAction,b.name,null,u,v)).on("mouseout",curry(dispatchDownplayAction,b.name,null,u,v)),h.set(_,!0)}else a.eachRawSeries(function(D){if(!h.get(_)&&D.legendVisualProvider){var z=D.legendVisualProvider;if(!z.containName(_))return;var j=z.indexOfName(_),oe=z.getItemVisual(j,"style"),L=z.getItemVisual(j,"legendIcon"),F=parse(oe.fill);F&&F[3]===0&&(F[3]=.2,oe=extend(extend({},oe),{fill:stringify(F,"rgba")}));var O=this._createItem(D,_,A,y,o,i,{},oe,L,g,u);O.on("click",curry(dispatchSelectAction,null,_,u,v)).on("mouseover",curry(dispatchHighlightAction,null,_,u,v)).on("mouseout",curry(dispatchDownplayAction,null,_,u,v)),h.set(_,!0)}},this);process.env.NODE_ENV!=="production"&&(h.get(_)||console.warn(_+" series not exists. Legend data should be same with series name or data name."))}},this),c&&this._createSelector(c,o,u,f,d)},n.prototype._createSelector=function(i,o,a,u,c){var f=this.getSelectorGroup();each(i,function(p){var h=p.type,g=new ZRText$1({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:h==="all"?"legendAllSelect":"legendInverseSelect"})}});f.add(g);var v=o.getModel("selectorLabel"),y=o.getModel(["emphasis","selectorLabel"]);setLabelStyle(g,{normal:v,emphasis:y},{defaultText:p.title}),enableHoverEmphasis(g)})},n.prototype._createItem=function(i,o,a,u,c,f,d,p,h,g,v){var y=i.visualDrawType,A=c.get("itemWidth"),_=c.get("itemHeight"),S=c.isSelected(o),b=u.get("symbolRotate"),T=u.get("symbolKeepAspect"),w=u.get("icon");h=w||h||"roundRect";var x=getLegendStyle(h,u,d,p,y,S,v),k=new Group$1,M=u.getModel("textStyle");if(isFunction$1(i.getLegendIcon)&&(!w||w==="inherit"))k.add(i.getLegendIcon({itemWidth:A,itemHeight:_,icon:h,iconRotate:b,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:T}));else{var D=w==="inherit"&&i.getData().getVisual("symbol")?b==="inherit"?i.getData().getVisual("symbolRotate"):b:0;k.add(getDefaultLegendIcon({itemWidth:A,itemHeight:_,icon:h,iconRotate:D,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:T}))}var z=f==="left"?A+5:-5,j=f,oe=c.get("formatter"),L=o;isString$2(oe)&&oe?L=oe.replace("{name}",o??""):isFunction$1(oe)&&(L=oe(o));var F=u.get("inactiveColor");k.add(new ZRText$1({style:createTextStyle(M,{text:L,x:z,y:_/2,fill:S?M.getTextColor():F,align:j,verticalAlign:"middle"})}));var O=new Rect$1({shape:k.getBoundingRect(),invisible:!0}),ue=u.getModel("tooltip");return ue.get("show")&&setTooltipConfig({el:O,componentModel:c,itemName:o,itemTooltipOption:ue.option}),k.add(O),k.eachChild(function(_e){_e.silent=!0}),O.silent=!g,this.getContentGroup().add(k),enableHoverEmphasis(k),k.__legendDataIndex=a,k},n.prototype.layoutInner=function(i,o,a,u,c,f){var d=this.getContentGroup(),p=this.getSelectorGroup();box(i.get("orient"),d,i.get("itemGap"),a.width,a.height);var h=d.getBoundingRect(),g=[-h.x,-h.y];if(p.markRedraw(),d.markRedraw(),c){box("horizontal",p,i.get("selectorItemGap",!0));var v=p.getBoundingRect(),y=[-v.x,-v.y],A=i.get("selectorButtonGap",!0),_=i.getOrient().index,S=_===0?"width":"height",b=_===0?"height":"width",T=_===0?"y":"x";f==="end"?y[_]+=h[S]+A:g[_]+=v[S]+A,y[1-_]+=h[b]/2-v[b]/2,p.x=y[0],p.y=y[1],d.x=g[0],d.y=g[1];var w={x:0,y:0};return w[S]=h[S]+A+v[S],w[b]=Math.max(h[b],v[b]),w[T]=Math.min(0,v[T]+y[1-_]),w}else return d.x=g[0],d.y=g[1],this.group.getBoundingRect()},n.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},n.type="legend.plain",n}(ComponentView$1);function getLegendStyle(r,n,i,o,a,u,c){function f(S,b){S.lineWidth==="auto"&&(S.lineWidth=b.lineWidth>0?2:0),each(S,function(T,w){S[w]==="inherit"&&(S[w]=b[w])})}var d=n.getModel("itemStyle"),p=d.getItemStyle(),h=r.lastIndexOf("empty",0)===0?"fill":"stroke",g=d.getShallow("decal");p.decal=!g||g==="inherit"?o.decal:createOrUpdatePatternFromDecal(g,c),p.fill==="inherit"&&(p.fill=o[a]),p.stroke==="inherit"&&(p.stroke=o[h]),p.opacity==="inherit"&&(p.opacity=(a==="fill"?o:i).opacity),f(p,o);var v=n.getModel("lineStyle"),y=v.getLineStyle();if(f(y,i),p.fill==="auto"&&(p.fill=o.fill),p.stroke==="auto"&&(p.stroke=o.fill),y.stroke==="auto"&&(y.stroke=o.fill),!u){var A=n.get("inactiveBorderWidth"),_=p[h];p.lineWidth=A==="auto"?o.lineWidth>0&&_?2:0:p.lineWidth,p.fill=n.get("inactiveColor"),p.stroke=n.get("inactiveBorderColor"),y.stroke=v.get("inactiveColor"),y.lineWidth=v.get("inactiveWidth")}return{itemStyle:p,lineStyle:y}}function getDefaultLegendIcon(r){var n=r.icon||"roundRect",i=createSymbol(n,0,0,r.itemWidth,r.itemHeight,r.itemStyle.fill,r.symbolKeepAspect);return i.setStyle(r.itemStyle),i.rotation=(r.iconRotate||0)*Math.PI/180,i.setOrigin([r.itemWidth/2,r.itemHeight/2]),n.indexOf("empty")>-1&&(i.style.stroke=i.style.fill,i.style.fill="#fff",i.style.lineWidth=2),i}function dispatchSelectAction(r,n,i,o){dispatchDownplayAction(r,n,i,o),i.dispatchAction({type:"legendToggleSelect",name:r??n}),dispatchHighlightAction(r,n,i,o)}function isUseHoverLayer(r){for(var n=r.getZr().storage.getDisplayList(),i,o=0,a=n.length;o<a&&!(i=n[o].states.emphasis);)o++;return i&&i.hoverLayer}function dispatchHighlightAction(r,n,i,o){isUseHoverLayer(i)||i.dispatchAction({type:"highlight",seriesName:r,name:n,excludeSeriesId:o})}function dispatchDownplayAction(r,n,i,o){isUseHoverLayer(i)||i.dispatchAction({type:"downplay",seriesName:r,name:n,excludeSeriesId:o})}const LegendView$1=LegendView;function legendFilter(r){var n=r.findComponents({mainType:"legend"});n&&n.length&&r.filterSeries(function(i){for(var o=0;o<n.length;o++)if(!n[o].isSelected(i.name))return!1;return!0})}function legendSelectActionHandler(r,n,i){var o={},a=r==="toggleSelected",u;return i.eachComponent("legend",function(c){a&&u!=null?c[u?"select":"unSelect"](n.name):r==="allSelect"||r==="inverseSelect"?c[r]():(c[r](n.name),u=c.isSelected(n.name));var f=c.getData();each$4(f,function(d){var p=d.get("name");if(!(p===`
251
- `||p==="")){var h=c.isSelected(p);o.hasOwnProperty(p)?o[p]=o[p]&&h:o[p]=h}})}),r==="allSelect"||r==="inverseSelect"?{selected:o}:{name:n.name,selected:o}}function installLegendAction(r){r.registerAction("legendToggleSelect","legendselectchanged",curry$1(legendSelectActionHandler,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",curry$1(legendSelectActionHandler,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",curry$1(legendSelectActionHandler,"inverseSelect")),r.registerAction("legendSelect","legendselected",curry$1(legendSelectActionHandler,"select")),r.registerAction("legendUnSelect","legendunselected",curry$1(legendSelectActionHandler,"unSelect"))}function install$2(r){r.registerComponentModel(LegendModel$1),r.registerComponentView(LegendView$1),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,legendFilter),r.registerSubTypeDefaulter("legend",function(){return"plain"}),installLegendAction(r)}var ScrollableLegendModel=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i}return n.prototype.setScrollDataIndex=function(i){this.option.scrollDataIndex=i},n.prototype.init=function(i,o,a){var u=getLayoutParams(i);r.prototype.init.call(this,i,o,a),mergeAndNormalizeLayoutParams(this,i,u)},n.prototype.mergeOption=function(i,o){r.prototype.mergeOption.call(this,i,o),mergeAndNormalizeLayoutParams(this,this.option,i)},n.type="legend.scroll",n.defaultOption=inheritDefaultOption(LegendModel$1.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),n}(LegendModel$1);function mergeAndNormalizeLayoutParams(r,n,i){var o=r.getOrient(),a=[1,1];a[o.index]=0,mergeLayoutParam(n,i,{type:"box",ignoreSize:!!a})}const ScrollableLegendModel$1=ScrollableLegendModel;var Group=Group$3,WH=["width","height"],XY=["x","y"],ScrollableLegendView=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.newlineDisabled=!0,i._currentIndex=0,i}return n.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new Group),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Group)},n.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},n.prototype.renderInner=function(i,o,a,u,c,f,d){var p=this;r.prototype.renderInner.call(this,i,o,a,u,c,f,d);var h=this._controllerGroup,g=o.get("pageIconSize",!0),v=isArray$1(g)?g:[g,g];A("pagePrev",0);var y=o.getModel("pageTextStyle");h.add(new ZRText$1({name:"pageText",style:{text:"xx/xx",fill:y.getTextColor(),font:y.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),A("pageNext",1);function A(_,S){var b=_+"DataIndex",T=createIcon(o.get("pageIcons",!0)[o.getOrient().name][S],{onclick:bind$1(p._pageGo,p,b,o,u)},{x:-v[0]/2,y:-v[1]/2,width:v[0],height:v[1]});T.name=_,h.add(T)}},n.prototype.layoutInner=function(i,o,a,u,c,f){var d=this.getSelectorGroup(),p=i.getOrient().index,h=WH[p],g=XY[p],v=WH[1-p],y=XY[1-p];c&&box("horizontal",d,i.get("selectorItemGap",!0));var A=i.get("selectorButtonGap",!0),_=d.getBoundingRect(),S=[-_.x,-_.y],b=clone$2(a);c&&(b[h]=a[h]-_[h]-A);var T=this._layoutContentAndController(i,u,b,p,h,v,y,g);if(c){if(f==="end")S[p]+=T[h]+A;else{var w=_[h]+A;S[p]-=w,T[g]-=w}T[h]+=_[h]+A,S[1-p]+=T[y]+T[v]/2-_[v]/2,T[v]=Math.max(T[v],_[v]),T[y]=Math.min(T[y],_[y]+S[1-p]),d.x=S[0],d.y=S[1],d.markRedraw()}return T},n.prototype._layoutContentAndController=function(i,o,a,u,c,f,d,p){var h=this.getContentGroup(),g=this._containerGroup,v=this._controllerGroup;box(i.get("orient"),h,i.get("itemGap"),u?a.width:null,u?null:a.height),box("horizontal",v,i.get("pageButtonItemGap",!0));var y=h.getBoundingRect(),A=v.getBoundingRect(),_=this._showController=y[c]>a[c],S=[-y.x,-y.y];o||(S[u]=h[p]);var b=[0,0],T=[-A.x,-A.y],w=retrieve2(i.get("pageButtonGap",!0),i.get("itemGap",!0));if(_){var x=i.get("pageButtonPosition",!0);x==="end"?T[u]+=a[c]-A[c]:b[u]+=A[c]+w}T[1-u]+=y[f]/2-A[f]/2,h.setPosition(S),g.setPosition(b),v.setPosition(T);var k={x:0,y:0};if(k[c]=_?a[c]:y[c],k[f]=Math.max(y[f],A[f]),k[d]=Math.min(0,A[d]+T[1-u]),g.__rectSize=a[c],_){var M={x:0,y:0};M[c]=Math.max(a[c]-A[c]-w,0),M[f]=k[f],g.setClipPath(new Rect$1({shape:M})),g.__rectSize=M[c]}else v.eachChild(function(z){z.attr({invisible:!0,silent:!0})});var D=this._getPageInfo(i);return D.pageIndex!=null&&updateProps$1(h,{x:D.contentPosition[0],y:D.contentPosition[1]},_?i:null),this._updatePageInfoView(i,D),k},n.prototype._pageGo=function(i,o,a){var u=this._getPageInfo(o)[i];u!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:u,legendId:o.id})},n.prototype._updatePageInfoView=function(i,o){var a=this._controllerGroup;each$4(["pagePrev","pageNext"],function(h){var g=h+"DataIndex",v=o[g]!=null,y=a.childOfName(h);y&&(y.setStyle("fill",v?i.get("pageIconColor",!0):i.get("pageIconInactiveColor",!0)),y.cursor=v?"pointer":"default")});var u=a.childOfName("pageText"),c=i.get("pageFormatter"),f=o.pageIndex,d=f!=null?f+1:0,p=o.pageCount;u&&c&&u.setStyle("text",isString$2(c)?c.replace("{current}",d==null?"":d+"").replace("{total}",p==null?"":p+""):c({current:d,total:p}))},n.prototype._getPageInfo=function(i){var o=i.get("scrollDataIndex",!0),a=this.getContentGroup(),u=this._containerGroup.__rectSize,c=i.getOrient().index,f=WH[c],d=XY[c],p=this._findTargetItemIndex(o),h=a.children(),g=h[p],v=h.length,y=v?1:0,A={contentPosition:[a.x,a.y],pageCount:y,pageIndex:y-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!g)return A;var _=x(g);A.contentPosition[c]=-_.s;for(var S=p+1,b=_,T=_,w=null;S<=v;++S)w=x(h[S]),(!w&&T.e>b.s+u||w&&!k(w,b.s))&&(T.i>b.i?b=T:b=w,b&&(A.pageNextDataIndex==null&&(A.pageNextDataIndex=b.i),++A.pageCount)),T=w;for(var S=p-1,b=_,T=_,w=null;S>=-1;--S)w=x(h[S]),(!w||!k(T,w.s))&&b.i<T.i&&(T=b,A.pagePrevDataIndex==null&&(A.pagePrevDataIndex=b.i),++A.pageCount,++A.pageIndex),b=w;return A;function x(M){if(M){var D=M.getBoundingRect(),z=D[d]+M[d];return{s:z,e:z+D[f],i:M.__legendDataIndex}}}function k(M,D){return M.e>=D&&M.s<=D+u}},n.prototype._findTargetItemIndex=function(i){if(!this._showController)return 0;var o,a=this.getContentGroup(),u;return a.eachChild(function(c,f){var d=c.__legendDataIndex;u==null&&d!=null&&(u=f),d===i&&(o=f)}),o??u},n.type="legend.scroll",n}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(r){r.registerAction("legendScroll","legendscroll",function(n,i){var o=n.scrollDataIndex;o!=null&&i.eachComponent({mainType:"legend",subType:"scroll",query:n},function(a){a.setScrollDataIndex(o)})})}function install$1(r){use(install$2),r.registerComponentModel(ScrollableLegendModel$1),r.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(r)}function install(r){use(install$2),use(install$1)}const _sfc_main$G=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(r){const n=r;use([install$7,install$6,install$3,install$4,install]),vue.provide(VChart.THEME_KEY,"dark");const i=vue.reactive({title:{text:n.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:n.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:n.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(n,o=>{i.title.text=o.title,i.series[0].name=o.seriesName,i.series[0].data=o.seriesData}),(o,a)=>(vue.openBlock(),vue.createBlock(vue.unref(VChart),{class:"chart",option:vue.unref(i),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_fec2cbf2_lang="",PieCharts=_export_sfc$1(_sfc_main$G,[["__scopeId","data-v-fec2cbf2"]]),_hoisted_1$k=["id"],_hoisted_2$h=["id"],_hoisted_3$e=["fill"],_hoisted_4$a=["fill"],_hoisted_5$8=["fill"],_hoisted_6$6=vue.createElementVNode("path",{d:"M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z",fill:"#2D4375"},null,-1),_hoisted_7$6=vue.createElementVNode("path",{d:"M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z",fill:"#1E2D4F"},null,-1),_hoisted_8$6=["fill-opacity"],_hoisted_9$6=["fill-opacity"],_hoisted_10$5=["fill-opacity"],_hoisted_11$4=vue.createElementVNode("path",{d:"M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z",fill:"#CEEFF6"},null,-1),_hoisted_12$4=vue.createElementVNode("path",{d:"M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z",fill:"#FFFFFF"},null,-1),_hoisted_13$3=vue.createElementVNode("path",{d:"M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z",fill:"#CEEFF6"},null,-1),_hoisted_14$3=["xlink:href"],_sfc_main$F=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1}},emits:["onChange"],setup(r,{emit:n}){const i=r;return vue.watch(()=>i.isOpen,()=>{n("onChange")}),(o,a)=>(vue.openBlock(),vue.createElementBlock("g",{id:i.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${i.id}light-121`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z",fill:i.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$e),vue.createElementVNode("path",{d:"M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z",fill:i.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$a),vue.createElementVNode("path",{d:"M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z",fill:i.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$6,_hoisted_7$6,vue.createElementVNode("path",{d:"M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z",fill:"#FDB813","fill-opacity":i.isOpen?1:0},null,8,_hoisted_8$6),vue.createElementVNode("path",{d:"M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z",fill:"#FDB813","fill-opacity":i.isOpen?1:0},null,8,_hoisted_9$6),vue.createElementVNode("path",{d:"M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z",fill:"#FDB813","fill-opacity":i.isOpen?1:0},null,8,_hoisted_10$5),_hoisted_11$4,_hoisted_12$4,_hoisted_13$3],8,_hoisted_2$h),vue.createElementVNode("use",{"xlink:href":`#${i.id}light-121`,width:"100",height:"100"},null,8,_hoisted_14$3)],8,_hoisted_1$k))}}),_hoisted_1$j=["id"],_hoisted_2$g=["id"],_hoisted_3$d=["fill"],_hoisted_4$9=["fill"],_hoisted_5$7=["fill"],_hoisted_6$5=["from","to"],_hoisted_7$5=["fill"],_hoisted_8$5=["from","to"],_hoisted_9$5=["fill"],_hoisted_10$4=["fill"],_hoisted_11$3=["fill"],_hoisted_12$3=["from","to"],_hoisted_13$2=["fill"],_hoisted_14$2=["xlink:href"],_sfc_main$E=vue.defineComponent({__name:"clock-a",props:{id:{default:""},centerColor:{default:"#EBF257"},secondsColor:{default:"#E83E24"},circleColor:{default:"#F45AFC"},minutesColor:{default:"#50E68E"},hoursColor:{default:"#9A36E7"},scaleColor:{default:"#4942CF"},backgroundColor:{default:"#ffffff"},borderColor:{default:"#B3A7FF"}},setup(r){const n=r,i=new Date(Number(window.sessionStorage.getItem("editorLoadTime")||"0")),o=i.getSeconds()+1,a=i.getMinutes(),u=Math.floor((i.getHours()+(a+o/60)/60)*30);return(c,f)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id},[vue.createElementVNode("symbol",{id:`${n.id}clock-a-n`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z",fill:n.borderColor},null,8,_hoisted_3$d),vue.createElementVNode("path",{d:"M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z",fill:n.backgroundColor},null,8,_hoisted_4$9),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z",fill:n.minutesColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${45+vue.unref(a)*6} 512.3 506.3`,to:`${405+vue.unref(a)*6} 512.3 506.3`,dur:"3600s",repeatCount:"indefinite"},null,8,_hoisted_6$5)],8,_hoisted_5$7),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z",fill:n.hoursColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${-45+vue.unref(u)} 512.3 506.3`,to:`${315+vue.unref(u)} 512.3 506.3`,dur:"43200s",repeatCount:"indefinite"},null,8,_hoisted_8$5)],8,_hoisted_7$5),vue.createElementVNode("path",{d:"M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z",fill:n.circleColor},null,8,_hoisted_9$5),vue.createElementVNode("path",{d:"M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z",fill:n.scaleColor},null,8,_hoisted_10$4),vue.createElementVNode("path",{d:"M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z",fill:n.secondsColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${135.5+o*6} 512.3 506.3`,to:`${495.5+o*6} 512.3 506.3`,dur:"60s",repeatCount:"indefinite"},null,8,_hoisted_12$3)],8,_hoisted_11$3),vue.createElementVNode("path",{d:"M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z",fill:n.centerColor},null,8,_hoisted_13$2)],8,_hoisted_2$g),vue.createElementVNode("use",{"xlink:href":`#${n.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$j))}}),vueComp={"svg-text":_sfc_main$J,"el-button":elementPlus.ElButton,"progress-a":_sfc_main$L,"el-tag":elementPlus.ElTag,"common-table":_sfc_main$I,"pie-charts":PieCharts,"switch-r":_sfc_main$K,"now-time":NowTime,"light-a":_sfc_main$F,"clock-a":_sfc_main$E},config=[...svg_config,...vue_config],useGlobalStore=pinia$1.defineStore("global-store",{state:()=>({config_center:config,intention:EGlobalStoreIntention.None,create_svg_info:null,done_json:[],mouse_info:{state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},handle_svg_info:null,scale_info:{type:EScaleInfoType.None,scale_times:{x:1,y:1},scale_item_info:{x:0,y:0},symmetric_point:{x:0,y:0}},rotate_info:{angle:0},connection_line_node_info:{init_pos:{x:0,y:0},point_index:0}}),actions:{setCreateInfo(r){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=r},setDoneJson(r){isOfType(r,"id")?(this.done_json.push(r),vue.nextTick(()=>{setSvgActualInfo(r)})):this.done_json=objectDeepClone(r),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(r,n){let i=n;r?(!i&&i!=0&&(i=this.done_json.findIndex(o=>o.id===r.id)??-1),this.handle_svg_info={info:r,index:i}):this.handle_svg_info=r},spliceDoneJson(r){const n=useGlobalStore(),o=n.done_json.splice(r,1)[0];unbindAnchors(o.id),useHistoryRecord(n.done_json)}}}),useSvgEditLayoutStore=pinia$1.defineStore("svg-edit-layout-store",{state:()=>({left_nav:!0,right_nav:!0,center_offset:{x:0,y:0},canvasInfo:{with:0,height:0,top:0,left:0}})}),stopEvent=r=>{r.stopPropagation()},preventDefault=r=>{r.preventDefault()};function componentsRegister(){var n,i;const r=vue.getCurrentInstance();for(let o in vueComp)!((n=r==null?void 0:r.appContext)!=null&&n.components.hasOwnProperty(o))&&vueComp.hasOwnProperty(o)&&((i=r==null?void 0:r.appContext)==null||i.app.component(o,vueComp[o]))}function setEditorLoadTime(){window.sessionStorage.setItem("editorLoadTime",new Date().getTime().toString())}const randomString=r=>{r=r||10;const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=n.length;let o="";for(let a=0;a<r;a++){let u=i;a===0&&(u=i-10),o+=n.charAt(Math.floor(Math.random()*u))}return o},isOfType=(r,n)=>r[n]!==void 0,getCoordinateOffset=(r,n)=>r/2*(n-1),angleToRadian=r=>r*Math.PI/180,calculateRotatedPointCoordinate=(r,n,i)=>({x:parseFloat(((r.x-n.x)*Math.cos(angleToRadian(i))-(r.y-n.y)*Math.sin(angleToRadian(i))+n.x).toFixed(1)),y:parseFloat(((r.x-n.x)*Math.sin(angleToRadian(i))+(r.y-n.y)*Math.cos(angleToRadian(i))+n.y).toFixed(1))}),getCenterPoint=(r,n)=>({x:r.x+(n.x-r.x)/2,y:r.y+(n.y-r.y)/2}),positionArrToPath=r=>{let n="";for(let i=0;i<r.length;i++)i===0?n+=`M ${r[i].x} ${r[i].y}`:n+=` L ${r[i].x} ${r[i].y}`;return n},getSvgNowPosition=(r,n,i)=>i+(n-r),objectDeepClone=(r,n={})=>r?JSON.parse(JSON.stringify(r)):n,setSvgActualInfo=(r,n)=>{var a,u;const i=document.querySelector(`#${r.id}`),o=document.querySelector(`#rect${r.id}`);if(i){let c=0,f=0,d=0,p=0;if(r.type===EDoneJsonType.Vue){d=((a=r.props.width)==null?void 0:a.val)||i.offsetWidth||100,p=((u=r.props.height)==null?void 0:u.val)||i.offsetHeight||100,c=50-d/2,f=50-p/2;const h=document.querySelector(`#foreign-object${r.id}`);h&&(h.getAttribute("x")==="0"&&h.getAttribute("y")==="0"&&h.getAttribute("width")==="0"&&h.getAttribute("height")==="0"||n)&&(h.setAttribute("x",c.toString()),h.setAttribute("y",f.toString()),h.setAttribute("width",d.toString()),h.setAttribute("height",p.toString()))}else{const h=i.getBBox();c=parseFloat(h.x.toFixed(0)),f=parseFloat(h.y.toFixed(0)),d=parseFloat(h.width.toFixed(0)),p=parseFloat(h.height.toFixed(0))}o&&(o.getAttribute("x")==="0"&&o.getAttribute("y")==="0"&&o.getAttribute("width")==="0"&&o.getAttribute("height")==="0"||n)&&(o.setAttribute("x",c.toString()),o.setAttribute("y",f.toString()),o.setAttribute("width",d.toString()),o.setAttribute("height",p.toString())),(r.actual_bound.x===0&&r.actual_bound.y===0&&r.actual_bound.width===0&&r.actual_bound.height===0||n)&&(r.actual_bound={x:c,y:f,width:d,height:p}),r.center_position={x:r.x+r.actual_bound.x+d/2,y:r.y+r.actual_bound.y+p/2},r.point_coordinate.tl={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.tc={x:r.center_position.x,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.tr={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.l={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y},r.point_coordinate.r={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y},r.point_coordinate.bl={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y+p*r.scale_y/2},r.point_coordinate.bc={x:r.center_position.x,y:r.center_position.y+p*r.scale_y/2},r.point_coordinate.br={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y+p*r.scale_y/2},r.rotate!==0&&setAfterRotationPointCoordinate(r),moveAnchors(r)}},resetHandlePointOld=r=>{for(const n of Object.keys(r.point_coordinate))r.point_coordinate_old&&(r.point_coordinate_old[n].x=0,r.point_coordinate_old[n].y=0)},moveHandlePoint=(r,n,i)=>{const o=useGlobalStore(pinia),a=n??o.mouse_info.new_position_x-o.mouse_info.position_x,u=i??o.mouse_info.new_position_y-o.mouse_info.position_y;for(const c of Object.keys(r.point_coordinate))n!==void 0&&i!==void 0?(r.point_coordinate[c].x+=a,r.point_coordinate[c].y+=u):r.point_coordinate_old&&(r.point_coordinate[c].x=r.point_coordinate_old[c].x+a,r.point_coordinate[c].y=r.point_coordinate_old[c].y+u)},moveAnchors=r=>{var i,o,a,u;const n=useGlobalStore(pinia);for(let c of n.done_json)if(c.type===EDoneJsonType.ConnectionLine){if(((o=(i=c.bind_anchors)==null?void 0:i.start)==null?void 0:o.target_id)===r.id){const f=getAnchorPosByAnchorType(c.bind_anchors.start.type,r);c.props.point_position.val[0]={x:f.x-c.x,y:f.y-c.y}}if(((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===r.id){const f=getAnchorPosByAnchorType(c.bind_anchors.end.type,r);c.props.point_position.val[c.props.point_position.val.length-1]={x:f.x-c.x,y:f.y-c.y}}}},unbindAnchors=r=>{var i,o,a,u;const n=useGlobalStore(pinia);for(let c of n.done_json)c.type===EDoneJsonType.ConnectionLine&&(((o=(i=c.bind_anchors)==null?void 0:i.start)==null?void 0:o.target_id)===r&&(c.bind_anchors.start=null),((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===r&&(c.bind_anchors.end=null))},getAnchorPosByAnchorType=(r,n)=>r===ELineBindAnchors.BottomCenter?n.point_coordinate.bc:r===ELineBindAnchors.Left?n.point_coordinate.l:r===ELineBindAnchors.Right?n.point_coordinate.r:n.point_coordinate.tc,setAfterRotationPointCoordinate=r=>{r.point_coordinate={tl:calculateRotatedPointCoordinate(r.point_coordinate.tl,r.center_position,r.rotate),tc:calculateRotatedPointCoordinate(r.point_coordinate.tc,r.center_position,r.rotate),tr:calculateRotatedPointCoordinate(r.point_coordinate.tr,r.center_position,r.rotate),l:calculateRotatedPointCoordinate(r.point_coordinate.l,r.center_position,r.rotate),r:calculateRotatedPointCoordinate(r.point_coordinate.r,r.center_position,r.rotate),bl:calculateRotatedPointCoordinate(r.point_coordinate.bl,r.center_position,r.rotate),bc:calculateRotatedPointCoordinate(r.point_coordinate.bc,r.center_position,r.rotate),br:calculateRotatedPointCoordinate(r.point_coordinate.br,r.center_position,r.rotate)}},prosToVBind=(r,n=[])=>{let i={};if(r.state){for(const o in r.state)if(r.state.hasOwnProperty(o)&&o===r.defaultState){for(let a in r.state[o])a!=="label"&&(i[lodashEs.kebabCase(a)]=r.state[o][a]);break}}for(const o in r.props)n.indexOf(o)<0&&(i[lodashEs.kebabCase(o)]=r.props[o].val);return i},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(r=>r.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=r=>!r.common_animations||!r.common_animations.val?"":`common-ani animate__animated animate__${r.common_animations.val} animate__${r.common_animations.speed} animate__${r.common_animations.repeat} animate__${r.common_animations.delay}`,numberArray=r=>{let n=[];for(let i=0;i<r;i++)n.push(i);return n},getStringWidth=(r,n=12)=>{if(r.length>0){let i=document.createElement("span");i.style.fontSize=n+"px",i.style.fontFamily="inherit",i.innerHTML=r,i.style.opacity="0",i.style.position="fixed",i.style.top="3000px",document.body.append(i);const o=i.clientWidth;return document.body.removeChild(i),o}return 0},valFormat=r=>/false|true/.test(r)?r!=="false":/^\d+(\.\d+)?$/.test(r)?Number(r):r,createLine=(r,n,i)=>{r.preventDefault();const o=useGlobalStore(pinia),a=useConfigStore(pinia),u=useSvgEditLayoutStore(pinia),{clientX:c,clientY:f}=r;let d=objectDeepClone(a.connection_line),p=0,h=0;if(n&&i){d.bind_anchors.start={type:n,target_id:i.id};let v=getAnchorPosByAnchorType(n,i);p=v.x,h=v.y}else p=Math.round((c-u.canvasInfo.left)/a.svg.scale-u.center_offset.x),h=Math.round((f-u.canvasInfo.top)/a.svg.scale-u.center_offset.y);const g={id:randomString(),x:p,y:h,client:{x:p,y:h},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},...d};g.props.point_position.val.push({x:0,y:0}),o.setDoneJson(g),o.setHandleSvgInfo(g,o.done_json.length-1),o.intention=EGlobalStoreIntention.Connection,o.mouse_info={state:EMouseInfoState.Down,position_x:p,position_y:h,now_position_x:p,now_position_y:h,new_position_x:0,new_position_y:0}};Object.seal({name:"straight-line",title:"直线",type:EDoneJsonType.StraightLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{fill:{title:"填充色",type:EConfigItemPropsType.Color,val:"#ff0000"},start_x:{title:"起点x坐标",type:EConfigItemPropsType.InputNumber,val:0},start_y:{title:"起点y坐标",type:EConfigItemPropsType.InputNumber,val:0},end_x:{title:"终点x坐标",type:EConfigItemPropsType.InputNumber,val:0},end_y:{title:"终点y坐标",type:EConfigItemPropsType.InputNumber,val:0}},bind_anchors:{start:null,end:null},events:[]});const connection_line_system={name:"connection_line",title:"连接线",type:EDoneJsonType.ConnectionLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{stroke:{title:"线条颜色",type:EConfigItemPropsType.Color,val:"#ff0000"},"stroke-width":{title:"线条宽度",type:EConfigItemPropsType.InputNumber,val:2},point_r:{title:"节点半径",type:EConfigItemPropsType.InputNumber,val:4},point_position:{title:"点坐标",type:EConfigItemPropsType.JsonEdit,val:[]}},animations:{type:{title:"动画类型",type:EConfigItemPropsType.Select,val:EConfigAnimationsType.None,options:[{label:"无",value:EConfigAnimationsType.None},{label:"电流",value:EConfigAnimationsType.Electricity},{label:"轨迹",value:EConfigAnimationsType.Track},{label:"水珠",value:EConfigAnimationsType.WaterDrop}]},dur:{title:"持续时间",type:EConfigItemPropsType.InputNumber,val:20},repeatCount:{title:"循环次数",type:EConfigItemPropsType.Input,val:"indefinite",disabled:!0},color:{title:"颜色",type:EConfigItemPropsType.Color,val:"#0a7ae2"},reverse:{title:"反转动画",type:EConfigItemPropsType.Switch,val:!1}},bind_anchors:{start:null,end:null},events:[]},common_animate_list=[{label:"进入",children:[{label:"渐显",value:"fadeIn"},{label:"向右进入",value:"fadeInLeft"},{label:"向左进入",value:"fadeInRight"},{label:"向上进入",value:"fadeInUp"},{label:"向下进入",value:"fadeInDown"},{label:"向右长距进入",value:"fadeInLeftBig"},{label:"向左长距进入",value:"fadeInRightBig"},{label:"向上长距进入",value:"fadeInUpBig"},{label:"向下长距进入",value:"fadeInDownBig"},{label:"旋转进入",value:"rotateIn"},{label:"左顺时针旋转",value:"rotateInDownLeft"},{label:"右逆时针旋转",value:"rotateInDownRight"},{label:"左逆时针旋转",value:"rotateInUpLeft"},{label:"右逆时针旋转",value:"rotateInUpRight"},{label:"弹入",value:"bounceIn"},{label:"向右弹入",value:"bounceInLeft"},{label:"向左弹入",value:"bounceInRight"},{label:"向上弹入",value:"bounceInUp"},{label:"向下弹入",value:"bounceInDown"},{label:"光速从右进入",value:"lightSpeedInRight"},{label:"光速从左进入",value:"lightSpeedInLeft"},{label:"光速从右退出",value:"lightSpeedOutRight"},{label:"光速从左退出",value:"lightSpeedOutLeft"},{label:"Y轴旋转",value:"flip"},{label:"中心X轴旋转",value:"flipInX"},{label:"中心Y轴旋转",value:"flipInY"},{label:"左长半径旋转",value:"rollIn"},{label:"由小变大进入",value:"zoomIn"},{label:"左变大进入",value:"zoomInLeft"},{label:"右变大进入",value:"zoomInRight"},{label:"向上变大进入",value:"zoomInUp"},{label:"向下变大进入",value:"zoomInDown"},{label:"向右滑动展开",value:"slideInLeft"},{label:"向左滑动展开",value:"slideInRight"},{label:"向上滑动展开",value:"slideInUp"},{label:"向下滑动展开",value:"slideInDown"}]},{label:"强调",children:[{label:"弹跳",value:"bounce"},{label:"闪烁",value:"flash"},{label:"放大缩小",value:"pulse"},{label:"放大缩小弹簧",value:"rubberBand"},{label:"左右晃动",value:"headShake"},{label:"左右扇形摇摆",value:"swing"},{label:"放大晃动缩小",value:"tada"},{label:"扇形摇摆",value:"wobble"},{label:"左右上下晃动",value:"jello"},{label:"Y轴旋转",value:"flip"}]},{label:"退出",children:[{label:"渐隐",value:"fadeOut"},{label:"向左退出",value:"fadeOutLeft"},{label:"向右退出",value:"fadeOutRight"},{label:"向上退出",value:"fadeOutUp"},{label:"向下退出",value:"fadeOutDown"},{label:"向左长距退出",value:"fadeOutLeftBig"},{label:"向右长距退出",value:"fadeOutRightBig"},{label:"向上长距退出",value:"fadeOutUpBig"},{label:"向下长距退出",value:"fadeOutDownBig"},{label:"旋转退出",value:"rotateOut"},{label:"左顺时针旋转",value:"rotateOutDownLeft"},{label:"右逆时针旋转",value:"rotateOutDownRight"},{label:"左逆时针旋转",value:"rotateOutUpLeft"},{label:"右逆时针旋转",value:"rotateOutUpRight"},{label:"弹出",value:"bounceOut"},{label:"向左弹出",value:"bounceOutLeft"},{label:"向右弹出",value:"bounceOutRight"},{label:"向上弹出",value:"bounceOutUp"},{label:"向下弹出",value:"bounceOutDown"},{label:"中心X轴旋转",value:"flipOutX"},{label:"中心Y轴旋转",value:"flipOutY"},{label:"左长半径旋转",value:"rollOut"},{label:"由小变大退出",value:"zoomOut"},{label:"左变大退出",value:"zoomOutLeft"},{label:"右变大退出",value:"zoomOutRight"},{label:"向上变大退出",value:"zoomOutUp"},{label:"向下变大退出",value:"zoomOutDown"},{label:"向左滑动收起",value:"slideOutLeft"},{label:"向右滑动收起",value:"slideOutRight"},{label:"向上滑动收起",value:"slideOutUp"},{label:"向下滑动收起",value:"slideOutDown"}]}];let l=localStorage.getItem("svg-editor-config"),s,t;if(l){let r=JSON.parse(l);t=r.connection_line,s=r.svg}else t=objectDeepClone(connection_line_system),s={background_color:"#fff",scale:1,grid:!0,grid_color:"#ebebeb",ruler:!0};const useConfigStore=pinia$1.defineStore("config-store",{state:()=>({svg:s,connection_line:t,net:{mqtt:{url:"",user:"",pwd:"",topics:""}}}),getters:{},actions:{}});var EContextMenuInfoType=(r=>(r.Copy="Copy",r.Delete="Delete",r.MoveUpOneLevel="MoveUpOneLevel",r.MoveDownOneLevel="MoveDownOneLevel",r.MoveUpTopLevel="MoveUpTopLevel",r.MoveDownTopLevel="MoveDownTopLevel",r))(EContextMenuInfoType||{});const useEditPrivateStore=pinia$1.defineStore("edit-private-store",{state:()=>({old_done_components:[],history_doneComponent:[],history_now_index:0,is_record_history:!0,max_record_times:10}),getters:{getTopBtnUndoStatus(r){return r.history_now_index>=1},getTopBtnRedoStatus(r){return r.history_now_index+1!=r.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const r=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,r.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const r=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,r.setDoneJson(this.history_doneComponent[this.history_now_index])}}}),useContextMenuStore=pinia$1.defineStore("context-menu-store",{state:()=>({display:!1,info:{[EContextMenuInfoType.Copy]:{title:"复制",hot_key:"Ctrl + c",enable:!0},[EContextMenuInfoType.Delete]:{title:"删除",hot_key:"Delete",enable:!0},[EContextMenuInfoType.MoveUpTopLevel]:{title:"置于顶层",hot_key:"Ctrl + →",enable:!0},[EContextMenuInfoType.MoveDownTopLevel]:{title:"置于底层",hot_key:"Ctrl + ←",enable:!0},[EContextMenuInfoType.MoveUpOneLevel]:{title:"置于上一层",hot_key:"Ctrl + ↑",enable:!0},[EContextMenuInfoType.MoveDownOneLevel]:{title:"置于下一层",hot_key:"Ctrl + ↓",enable:!0}}}),actions:{onContextMenuClick(r){const n=useGlobalStore();if(n.handle_svg_info)switch(n.intention=EGlobalStoreIntention.Select,r){case EContextMenuInfoType.Copy:const i=objectDeepClone(n.handle_svg_info.info);i.id=randomString(),i.title+="-copy",i.x+=10,i.y+=10,n.setDoneJson(i),this.display=!1,n.setHandleSvgInfo(i,n.done_json.length);break;case EContextMenuInfoType.Delete:n.spliceDoneJson(n.handle_svg_info.index),this.display=!1,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length-1)return;const o=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index+1],n.done_json[n.handle_svg_info.index+1]=o,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(o,n.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const a=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index-1],n.done_json[n.handle_svg_info.index-1]=a,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(a,n.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const u=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.unshift(u),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(u,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length)return;const c=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.push(c),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(c,n.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=r=>{const n=useEditPrivateStore();n.is_record_history&&(n.history_now_index+1<n.history_doneComponent.length&&n.history_doneComponent.splice(n.history_now_index+1),n.history_doneComponent.push(r),n.history_now_index=n.history_doneComponent.length-1,n.history_doneComponent.length>n.max_record_times&&(n.history_doneComponent.shift(),n.history_now_index=n.history_doneComponent.length-1)),n.is_record_history=!0},useImportDataModel=r=>{try{const n=JSON.parse(r);if(!n.config||!n.layout_center||!n.done_json)return elementPlus.ElMessage.error("请导入正确的数据模型!"),!1;const i=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return a.$state=n.config,o.center_offset=n.layout_center,i.setDoneJson(n.done_json),!0}catch(n){return elementPlus.ElMessage.error("请导入正确的数据模型!"),console.error(n),!1}},_hoisted_1$i={"aria-hidden":"true"},_hoisted_2$f=["xlink:href"],_sfc_main$D=vue.defineComponent({__name:"svg-analysis",props:{name:{},props:{default:()=>({})}},setup(r){const n=r,i=vue.computed(()=>`#svg-${n.name}`);return(o,a)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$i,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(i)},n.props),null,16,_hoisted_2$f)]))}});var EVisibleConfKey=(r=>(r.ImportJson="ImportJson",r.ExportJson="ExportJson",r.ImportFile="ImportFile",r))(EVisibleConfKey||{});const _withScopeId$2=r=>(vue.pushScopeId("data-v-62907637"),r=r(),vue.popScopeId(),r),_hoisted_1$h={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$e={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$c=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$8={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$4={class:"flex items-center mr-20px"},_hoisted_7$4={class:"flex items-center",style:{width:"250px"}},_hoisted_8$4=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title",style:{"padding-top":"16px"}},"多选",-1)),_hoisted_9$4=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住鼠标左键可以框选(图形坐标在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选",-1)),_hoisted_10$3=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_11$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"拖动画布",-1)),_hoisted_12$2=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住右键可拖动画布,右侧面板‘图纸’栏可微调或重置位置",-1)),_hoisted_13$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_14$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"画布缩放",-1)),_hoisted_15$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放",-1)),_hoisted_16$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18=_withScopeId$2(()=>vue.createElementVNode("div",null,"在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线",-1)),_hoisted_19=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_20=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"组件尺寸",-1)),_hoisted_21=_withScopeId$2(()=>vue.createElementVNode("div",null,[vue.createElementVNode("p",null," 大多数组件可以通过选中组件然后拖动交互点或在右侧‘外观’栏改变外形尺寸,或通过右侧‘数据’栏直接或间接改变外形尺寸;"),vue.createElementVNode("p",null,"少数特殊组件仅可通过右侧'数据'栏直接或间接改变外形尺寸")],-1)),_hoisted_22$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_23=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"连线样式",-1)),_hoisted_24=_withScopeId$2(()=>vue.createElementVNode("div",null,"在右侧‘连线’栏可以统一配置连线样式,配置后先增加的线会应用新样式,之前的线样式不变,如需改变,可选中线手动更改或删除重画 ",-1)),_hoisted_25=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_26$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"横线和竖线",-1)),_hoisted_27=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null," 点击编辑器顶部连线按钮会进入连线状态,该状态下在画板点击鼠标左键即可开始画线,移动并再次点击左键创建新的节点,右键结束画线并退出连线状态;"),vue.createElementVNode("p",null,"画线的时候按住ctrl即可画竖线,按住shift即可画横线")],-1)),_hoisted_28=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_29=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"绑定锚点",-1)),_hoisted_30=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null,"组件在未选中时,鼠标经过组件时会出现锚点,鼠标悬浮在锚点上时,会有交互样式,点击左键即可以锚点为起点创建连线;"),vue.createElementVNode("p",null,"同样,在连线时鼠标经过锚点时,会出现锚点交互样式,点击左键即可以锚点为连线终点结束连线;"),vue.createElementVNode("p",null,"这两种情况下的连线会绑定组件上的锚点,如需解绑,参考下面的‘锚点解绑’;"),vue.createElementVNode("p",null,"同样,也可先画线,再选中连线绑定想要绑定的组件锚点(连线只有首尾节点可以绑定锚点)")],-1)),_hoisted_31=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_32$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"线段选中",-1)),_hoisted_33=_withScopeId$2(()=>vue.createElementVNode("div",null," 若线段绑定了锚点,移动线段,绑定的锚点不会移动。若是想将线段整体移动,需要先解绑,参考下面的‘锚点解绑’ ",-1)),_hoisted_34=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_35=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"锚点解绑",-1)),_hoisted_36$1=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$C=vue.defineComponent({__name:"top-panel",emits:["changeVisible","onReturn","onPreview","onSave"],setup(r,{emit:n}){const i=useSvgEditLayoutStore(pinia),o=useGlobalStore(pinia),a=useEditPrivateStore(pinia),u=useConfigStore(pinia),c=()=>{o.done_json.length<=0||o.setDoneJson([]),o.intention=EGlobalStoreIntention.None},f=h=>{const g={layout_center:i.center_offset,config:u.$state,done_json:o.done_json};n(h,g)},d=vue.ref(!1),p=vue.computed({get:()=>o.intention===EGlobalStoreIntention.Connection,set(h){o.intention=h?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,h&&o.setHandleSvgInfo(null)}});return(h,g)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$h,[vue.createElementVNode("div",_hoisted_2$e,[_hoisted_3$c,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:g[0]||(g[0]=v=>vue.unref(i).left_nav=!vue.unref(i).left_nav),title:vue.unref(i).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(i).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$8,[vue.createElementVNode("div",_hoisted_5$6,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"撤销 ctrl+z",size:24,class:vue.normalizeClass(`${vue.unref(a).getTopBtnUndoStatus?"bt-Icon":"icon-disable"} ml-20px`),onClick:g[1]||(g[1]=()=>vue.unref(a).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(a).getTopBtnUndoStatus?"undo":"undo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"重做 ctrl+shift+z",class:vue.normalizeClass(`${vue.unref(a).getTopBtnRedoStatus?"bt-Icon":"icon-disable"} ml-5px`),size:24,onClick:g[2]||(g[2]=()=>vue.unref(a).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(a).getTopBtnRedoStatus?"redo":"redo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"清空 ctrl+delete",class:vue.normalizeClass(vue.unref(o).done_json.length>0?"bt-Icon":"icon-disable"),size:24,onClick:c},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(o).done_json.length>0?"delete":"delete-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导入数据模型",class:"bt-Icon",size:24,onClick:g[3]||(g[3]=v=>n("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"import"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:g[4]||(g[4]=v=>n("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"export"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"创建连线",class:vue.normalizeClass(["bt-Icon",{active:vue.unref(p)}]),size:24,onClick:g[5]||(g[5]=v=>p.value=!vue.unref(p))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(p)?"line-active":"line"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"说明",class:"bt-Icon",size:24,onClick:g[6]||(g[6]=v=>d.value=!vue.unref(d))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$4,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:g[7]||(g[7]=v=>f("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"return"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:g[8]||(g[8]=v=>f("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"save"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:g[9]||(g[9]=v=>f("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$4,[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:g[10]||(g[10]=v=>vue.unref(i).right_nav=!vue.unref(i).right_nav),title:vue.unref(i).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(i).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(elementPlus.ElDialog),{modelValue:vue.unref(d),"onUpdate:modelValue":g[11]||(g[11]=v=>vue.isRef(d)?d.value=v:null),title:"使用说明",width:"60%",class:"guide-dialog"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$4,_hoisted_9$4,_hoisted_10$3,_hoisted_11$2,_hoisted_12$2,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$2,_hoisted_17,_hoisted_18,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22$1,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26$1,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32$1,_hoisted_33,_hoisted_34,_hoisted_35,_hoisted_36$1]),_:1})]),_:1},8,["modelValue"])],64))}}),topPanel_vue_vue_type_style_index_0_scoped_62907637_lang="",topPanel_vue_vue_type_style_index_1_lang="",TopPanel=_export_sfc$1(_sfc_main$C,[["__scopeId","data-v-62907637"]]),_hoisted_1$g={class:"component-group flex flex-wrap"},_hoisted_2$d=["onDragstart","title"],_sfc_main$B=vue.defineComponent({__name:"left-panel",props:{customToolbar:{}},setup(r){const n=r,i=useGlobalStore(pinia),o=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:i.config_center),a=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),u=f=>{i.setCreateInfo(f)},c=f=>{var d;if(((d=f.dataTransfer)==null?void 0:d.dropEffect)!=="copy"){elementPlus.ElMessage.warning("请将组件拖到画布中!"),i.intention=EGlobalStoreIntention.None;return}};return(f,d)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(a),"onUpdate:modelValue":d[0]||(d[0]=p=>vue.isRef(a)?a.value=p:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),p=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:p.groupType,key:p.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(p.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$g,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(p.list,h=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:h.name,draggable:"true",onDragstart:g=>u(h),onDragend:c,title:h.title},[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:h.name,props:vue.unref(prosToVBind)(h,["width","height","maxHeight"])},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$d))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),leftPanel_vue_vue_type_style_index_0_scoped_d7403cfd_lang="",LeftPanel=_export_sfc$1(_sfc_main$B,[["__scopeId","data-v-d7403cfd"]]),calculateLeftTop=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate(n,o,-i);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate(n,o,-i);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(n,o,-i),u=calculateRotatedPointCoordinate(r,o,-i);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(n,o,-i),u=calculateRotatedPointCoordinate(r,o,-i);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateTop=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateRight=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateLeft=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$f={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$c=["fill","x","y"],_hoisted_3$b=["cx","cy"],_hoisted_4$7=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$3=["fill","x","y"],_hoisted_7$3=["fill","x","y"],_hoisted_8$3=["fill","x","y"],_hoisted_9$3=["fill","x","y"],_hoisted_10$2=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$A=vue.defineComponent({__name:"handle-panel",props:{itemInfo:{}},setup(r){const n=r;vue.useCssVars(v=>({"5c831aea":vue.unref(c)}));const i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=vue.ref(4),c=vue.ref("#ab712e"),f=[{start:338,end:23,cursor:"nw",type:EScaleInfoType.TopLeft},{start:23,end:68,cursor:"n",type:EScaleInfoType.TopCenter},{start:68,end:113,cursor:"ne",type:EScaleInfoType.TopRight},{start:293,end:338,cursor:"w",type:EScaleInfoType.Left},{start:113,end:158,cursor:"e",type:EScaleInfoType.Right},{start:248,end:293,cursor:"sw",type:EScaleInfoType.BottomLeft},{start:203,end:248,cursor:"s",type:EScaleInfoType.BottomCenter},{start:158,end:203,cursor:"se",type:EScaleInfoType.BottomRight}],d=vue.computed(()=>n.itemInfo.config.can_zoom),p=(v,y)=>{console.log("handMousedown",y);const{clientX:A,clientY:_}=y;y.stopPropagation(),i.intention=EGlobalStoreIntention.Zoom;const S=Math.round((A-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),b=Math.round((_-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);i.mouse_info={state:EMouseInfoState.Down,position_x:S,position_y:b,now_position_x:S,now_position_y:b,new_position_x:0,new_position_y:0},i.scale_info={type:v,scale_times:{x:n.itemInfo.scale_x,y:n.itemInfo.scale_y},scale_item_info:{x:n.itemInfo.x,y:n.itemInfo.y},symmetric_point:{x:S+Math.abs(S-n.itemInfo.center_position.x)*2*(S>n.itemInfo.center_position.x?-1:1),y:b+Math.abs(b-n.itemInfo.center_position.y)*2*(b>n.itemInfo.center_position.y?-1:1)}}},h=v=>{const{clientX:y,clientY:A}=v,_=Math.round((y-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),S=Math.round((A-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);v.stopPropagation(),i.intention=EGlobalStoreIntention.Rotate,i.rotate_info={angle:n.itemInfo.rotate},i.mouse_info={state:EMouseInfoState.Down,position_x:_,position_y:S,now_position_x:_,now_position_y:S,new_position_x:0,new_position_y:0}},g=v=>{const y=(v+n.itemInfo.rotate)%360,A=f.find(_=>_.start<=y&&_.end>y);return A?{cursor:A.cursor+"-resize",type:A.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(v,y)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$f,[vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(0).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[0]||(y[0]=A=>p(vue.unref(EScaleInfoType).TopLeft,A))},null,44,_hoisted_2$c),[[vue.vShow,vue.unref(d)]]),vue.createElementVNode("circle",{cx:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,cy:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:h},null,40,_hoisted_3$b),vue.createElementVNode("line",{x1:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y1:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),x2:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y2:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref(c),"stroke-width":2})},null,12,_hoisted_4$7),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(45).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-vue.unref(u),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[1]||(y[1]=A=>p(vue.unref(EScaleInfoType).TopCenter,A))},null,44,_hoisted_5$5),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tr",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(90).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width-vue.unref(u)+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[2]||(y[2]=A=>p(vue.unref(EScaleInfoType).TopRight,A))},null,44,_hoisted_6$3),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_l",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(315).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[3]||(y[3]=A=>p(vue.unref(EScaleInfoType).Left,A))},null,44,_hoisted_7$3),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_r",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(135).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[4]||(y[4]=A=>p(vue.unref(EScaleInfoType).Right,A))},null,44,_hoisted_8$3),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(270).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[5]||(y[5]=A=>p(vue.unref(EScaleInfoType).BottomLeft,A))},null,44,_hoisted_9$3),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(225).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width/2,y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[6]||(y[6]=A=>p(vue.unref(EScaleInfoType).BottomCenter,A))},null,44,_hoisted_10$2),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_br",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(180).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[7]||(y[7]=A=>p(vue.unref(EScaleInfoType).BottomRight,A))},null,44,_hoisted_11$1),[[vue.vShow,vue.unref(d)]])]))}}),handlePanel_vue_vue_type_style_index_0_scoped_e6622df8_lang="",HandlePanel=_export_sfc$1(_sfc_main$A,[["__scopeId","data-v-e6622df8"]]),_hoisted_1$e=["fill"],_hoisted_2$b=["cx","cy","r"],_hoisted_3$a=["cx","cy","r"],_hoisted_4$6=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$2=["cx","cy","r"],_hoisted_7$2=["cx","cy","r"],_hoisted_8$2=["cx","cy","r"],_hoisted_9$2=["cx","cy","r"],_sfc_main$z=vue.defineComponent({__name:"connection-panel",props:{itemInfo:{}},setup(r){const n=r,i=vue.ref(4),o=vue.ref("#ab712e"),a=vue.ref(4),u=vue.ref(12),c=useGlobalStore(pinia),f=useSvgEditLayoutStore(pinia),d=vue.computed(()=>n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-i.value+a.value),p=vue.computed(()=>n.itemInfo.actual_bound.y-i.value-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),h=vue.computed(()=>n.itemInfo.actual_bound.x-i.value+n.itemInfo.actual_bound.width+getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+a.value),g=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),v=vue.computed(()=>n.itemInfo.actual_bound.x-i.value+n.itemInfo.actual_bound.width/2+a.value),y=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height+getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),A=vue.computed(()=>n.itemInfo.actual_bound.x-i.value-getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+a.value),_=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),S=(T,w)=>{var x;c.intention===EGlobalStoreIntention.SetConnectionLineNode&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&c.connection_line_node_info&&(c.connection_line_node_info.point_index===0?c.handle_svg_info.info.bind_anchors.start={type:w,target_id:n.itemInfo.id}:c.connection_line_node_info.point_index===c.handle_svg_info.info.props.point_position.val.length-1&&(c.handle_svg_info.info.bind_anchors.end={type:w,target_id:n.itemInfo.id}),c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))},b=(T,w)=>{var x;c.intention===EGlobalStoreIntention.None?(createLine(T,w,n.itemInfo),c.handle_svg_info&&(c.handle_svg_info.info.props.point_position.val.length!==1?c.handle_svg_info.info.props.point_position.val.push({x:c.mouse_info.new_position_x-c.mouse_info.position_x-f.center_offset.x,y:c.mouse_info.new_position_y-c.mouse_info.position_y-f.center_offset.y}):c.handle_svg_info.info.props.point_position.val.push({x:0,y:0}))):c.intention===EGlobalStoreIntention.Connection&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&(c.handle_svg_info.info.bind_anchors.end={type:w,target_id:n.itemInfo.id},c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))};return(T,w)=>(vue.openBlock(),vue.createElementBlock("g",{style:{"vector-effect":"non-scaling-stroke"},class:"connect-points",fill:vue.unref(o),"stroke-width":"2",stroke:"rgba(0,0,0,0)"},[vue.createElementVNode("g",{onMousedown:w[0]||(w[0]=x=>b(x,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:w[1]||(w[1]=x=>S(x,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(d),cy:vue.unref(p),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_2$b),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(d),cy:vue.unref(p),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_3$a)],32),vue.createElementVNode("g",{onMousedown:w[2]||(w[2]=x=>b(x,vue.unref(ELineBindAnchors).Right)),onMouseup:w[3]||(w[3]=x=>S(x,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(h),cy:vue.unref(g),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_4$6),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(h),cy:vue.unref(g),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:w[4]||(w[4]=x=>b(x,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:w[5]||(w[5]=x=>S(x,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(v),cy:vue.unref(y),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_6$2),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(v),cy:vue.unref(y),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_7$2)],32),vue.createElementVNode("g",{onMousedown:w[6]||(w[6]=x=>b(x,vue.unref(ELineBindAnchors).Left)),onMouseup:w[7]||(w[7]=x=>S(x,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(A),cy:vue.unref(_),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_8$2),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(A),cy:vue.unref(_),r:vue.unref(a),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$2)],32)],8,_hoisted_1$e))}}),connectionPanel_vue_vue_type_style_index_0_scoped_fb729c7a_lang="",ConnectionPanel=_export_sfc$1(_sfc_main$z,[["__scopeId","data-v-fb729c7a"]]),_hoisted_1$d=["d","stroke-width"],_hoisted_2$a=["d","stroke-width"],_hoisted_3$9=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$5=["from","to","dur","repeatCount"],_hoisted_5$3=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_6$1=["from","to","dur","repeatCount"],_hoisted_7$1=["r","fill"],_hoisted_8$1=["path","dur","repeatCount"],_hoisted_9$1=["cx","cy","r"],_hoisted_10$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$y=vue.defineComponent({__name:"connection-line",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(r){const n=r,i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=(c,f,d,p)=>{if(i.intention===EGlobalStoreIntention.Connection)return;i.setHandleSvgInfo(n.itemInfo);const{clientX:h,clientY:g}=f;f.stopPropagation(),i.connection_line_node_info={init_pos:{x:d,y:p},point_index:c},i.intention=EGlobalStoreIntention.SetConnectionLineNode,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((h-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((g-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0}};return(c,f)=>{var d,p,h,g,v,y;return vue.openBlock(),vue.createElementBlock("g",{style:vue.normalizeStyle({cursor:vue.unref(i).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"})},[vue.withDirectives(vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#DE4517","stroke-width":n.itemInfo.props["stroke-width"].val+1,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_1$d),[[vue.vShow,n.itemInfo.selected||n.itemInfo.id===((d=vue.unref(i).handle_svg_info)==null?void 0:d.info.id)]]),vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#fff","stroke-opacity":".01","stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_2$a),vue.createElementVNode("path",{id:n.itemInfo.id,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none",stroke:((p=n.itemInfo.animations)==null?void 0:p.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.animations.color.val:n.itemInfo.props.stroke.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dashoffset":"0","stroke-dasharray":((h=n.itemInfo.animations)==null?void 0:h.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.props["stroke-width"].val*3:0,"stroke-linejoin":"round"},[((g=n.itemInfo.animations)==null?void 0:g.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_4$5)):vue.createCommentVNode("",!0)],8,_hoisted_3$9),((v=n.itemInfo.animations)==null?void 0:v.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:n.itemInfo.animations.color.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dasharray":n.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_6$1)],8,_hoisted_5$3)):((y=n.itemInfo.animations)==null?void 0:y.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:Math.ceil(n.itemInfo.props["stroke-width"].val*.6)+2,fill:n.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(n.itemInfo.animations.reverse.val?[...n.itemInfo.props.point_position.val].reverse():n.itemInfo.props.point_position.val),dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_8$1)],8,_hoisted_7$1)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(A,_)=>{var S;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("circle",{key:_,cx:A.x,cy:A.y,r:n.itemInfo.props.point_r.val+1,fill:"none","fill-opacity":"0","stroke-width":"1",stroke:"#DE4517"},null,8,_hoisted_9$1)),[[vue.vShow,n.itemInfo.selected||n.itemInfo.id===((S=vue.unref(i).handle_svg_info)==null?void 0:S.info.id)]])}),128)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(A,_)=>(vue.openBlock(),vue.createElementBlock("circle",{key:_,cx:A.x,cy:A.y,r:n.itemInfo.props.point_r.val,"stroke-width":"1",stroke:n.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:S=>u(_,S,A.x,A.y)},null,40,_hoisted_10$1))),128))])],4)}}}),_hoisted_1$c={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_2$9=["stroke"],_hoisted_3$8=["stroke"],_hoisted_4$4=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_7=["transform"],_hoisted_8=["transform"],_hoisted_9=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_10=["xlink:href","id","transform"],_hoisted_11=["id"],_hoisted_12$1=["id","x1","y1","x2","y2"],_hoisted_13=["id"],_hoisted_14=["x","y","height","width"],_hoisted_15=["onClick"],_hoisted_16$1={class:"shortcut"},_sfc_main$x=vue.defineComponent({__name:"center-panel",setup(r,{expose:n}){vue.useCssVars(de=>({"49c79b5f":vue.unref(h)}));const i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=useEditPrivateStore(pinia),c=useContextMenuStore(pinia);componentsRegister();const f=vue.ref(),d=vue.ref(),p={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},h=vue.computed(()=>Object.keys(p).indexOf(i.intention)>-1?p[i.intention]:"default"),g=vue.reactive({handle_panel:vue.computed(()=>i.intention===EGlobalStoreIntention.Select||i.intention===EGlobalStoreIntention.Zoom||i.intention===EGlobalStoreIntention.Rotate),connection_panel:!1,connection_line:!1,select_item:{info:null,index:-1}}),v=vue.ref({a:{x:0,y:0},b:{x:0,y:0}}),y=vue.computed(()=>i.intention===EGlobalStoreIntention.SelectArea&&v.value.b.x&&v.value.b.y?{with:Math.abs(v.value.b.x-v.value.a.x),height:Math.abs(v.value.b.y-v.value.a.y),x:v.value.a.x<v.value.b.x?v.value.a.x:v.value.b.x,y:v.value.a.y<v.value.b.y?v.value.a.y:v.value.b.y}:{with:0,height:0,x:0,y:0}),A=vue.computed(()=>{let de=0;for(let ie of i.done_json)ie.selected&&de++;return de>0});let _=!1,S=!1;const b=de=>{var ie;if(i.intention!=EGlobalStoreIntention.None){if(i.intention==EGlobalStoreIntention.Create){if(!i.create_svg_info){console.error("要创建的数据获取失败");return}const Y=Math.floor(de.offsetX/o.svg.scale-a.center_offset.x),Ie=Math.floor(de.offsetY/o.svg.scale-a.center_offset.y),Oe={id:randomString(),x:Y,y:Ie,client:{x:Y,y:Ie},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},selected:!1,...objectDeepClone(i.create_svg_info)};i.setDoneJson(Oe),i.setHandleSvgInfo(Oe,i.done_json.length),i.intention=EGlobalStoreIntention.None}(ie=d.value)==null||ie.focus()}},T=de=>{de.preventDefault()},w=de=>{de.preventDefault()},x=(de,ie,Y)=>{var Ie,Oe,kt;if((Ie=d.value)==null||Ie.focus(),i.intention===EGlobalStoreIntention.Connection){Y.stopPropagation();return}if(Y.preventDefault(),Y.stopPropagation(),Y.ctrlKey&&Y.button===0)((Oe=i.handle_svg_info)!=null&&Oe.index||((kt=i.handle_svg_info)==null?void 0:kt.index)===0)&&(i.done_json[i.handle_svg_info.index].selected=!0,i.setHandleSvgInfo(null),i.intention=EGlobalStoreIntention.None),de.selected=!de.selected;else if(A.value){i.intention=EGlobalStoreIntention.GroupMove,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0};for(let Dt of i.done_json)Dt.selected&&(Dt.old_position={x:Dt.x,y:Dt.y},Dt.point_coordinate_old=objectDeepClone(Dt.point_coordinate))}else i.intention=EGlobalStoreIntention.Select,i.setHandleSvgInfo(de,ie),i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:de.x,now_position_y:de.y,new_position_x:0,new_position_y:0},de.point_coordinate_old=objectDeepClone(de.point_coordinate)},k=(de,ie,Y)=>{if(!(i.intention===EGlobalStoreIntention.Connection||i.mouse_info.state!=EMouseInfoState.Down)&&A.value&&!_&&["SelectArea","Move","Select"].indexOf(i.intention)<0){for(let Ie of i.done_json)Ie.selected=!1,Ie.old_position={x:0,y:0},resetHandlePointOld(Ie);i.intention=EGlobalStoreIntention.Select,i.setHandleSvgInfo(de,ie),i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:de.x,now_position_y:de.y,new_position_x:0,new_position_y:0}}},M=(de,ie,Y)=>{Y.preventDefault(),Y.stopPropagation(),g.connection_panel=!0,g.connection_line=!0,!((i.intention===EGlobalStoreIntention.Connection||i.intention===EGlobalStoreIntention.SetConnectionLineNode)&&de.type===EDoneJsonType.ConnectionLine)&&(g.select_item.info=de,g.select_item.index=ie)},D=(de,ie,Y)=>{Y.preventDefault(),Y.stopPropagation(),!((i.intention===EGlobalStoreIntention.Connection||i.intention===EGlobalStoreIntention.SetConnectionLineNode)&&de.type===EDoneJsonType.ConnectionLine)&&(g.connection_panel=!1,g.connection_line=!1,g.select_item.info=null,g.select_item.index=-1)},z=de=>{var kt,Dt,Fe,$e,Cn,Lt,In,Et,Ne,pe,At,Ve,xe,ze,Pt,hn;if(i.mouse_info.state!=EMouseInfoState.Down&&i.intention!==EGlobalStoreIntention.Connection)return;const{clientX:ie,clientY:Y}=de;i.mouse_info.new_position_x=Math.round((ie-a.canvasInfo.left)/o.svg.scale),i.mouse_info.new_position_y=Math.round((Y-a.canvasInfo.top)/o.svg.scale);const Ie=Math.round(i.mouse_info.new_position_x-i.mouse_info.position_x+i.mouse_info.now_position_x),Oe=Math.round(i.mouse_info.new_position_y-i.mouse_info.position_y+i.mouse_info.now_position_y);if((kt=i.handle_svg_info)!=null&&kt.info&&(i.intention===EGlobalStoreIntention.Select||i.intention===EGlobalStoreIntention.Move)){if(i.handle_svg_info.info.x=Ie,i.handle_svg_info.info.y=Oe,i.handle_svg_info.info.client={x:Ie,y:Oe},i.intention=EGlobalStoreIntention.Move,moveHandlePoint(i.handle_svg_info.info),moveAnchors(i.handle_svg_info.info),i.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((Dt=i.handle_svg_info.info.bind_anchors)!=null&&Dt.start){let ae=null;for(let le of i.done_json)le.id===(($e=(Fe=i.handle_svg_info.info.bind_anchors)==null?void 0:Fe.start)==null?void 0:$e.target_id)&&(ae=le);ae&&moveAnchors(ae)}if((Cn=i.handle_svg_info.info.bind_anchors)!=null&&Cn.end){let ae=null;for(let le of i.done_json)le.id===((In=(Lt=i.handle_svg_info.info.bind_anchors)==null?void 0:Lt.end)==null?void 0:In.target_id)&&(ae=le);ae&&moveAnchors(ae)}}}else if(i.intention===EGlobalStoreIntention.MoveCanvas)a.center_offset.x=Ie,a.center_offset.y=Oe;else if(i.intention===EGlobalStoreIntention.SelectArea)v.value.b.x=i.mouse_info.new_position_x-a.center_offset.x,v.value.b.y=i.mouse_info.new_position_y-a.center_offset.y;else if(i.intention===EGlobalStoreIntention.GroupMove){_=!0;for(let ae of i.done_json)if(ae.selected&&ae.old_position){const le=Math.round(i.mouse_info.new_position_x-i.mouse_info.position_x+ae.old_position.x),re=Math.round(i.mouse_info.new_position_y-i.mouse_info.position_y+ae.old_position.y);if(ae.x=le,ae.y=re,ae.client={x:le,y:re},moveHandlePoint(ae),moveAnchors(ae),ae.type===EDoneJsonType.ConnectionLine&&((Et=ae.bind_anchors)!=null&&Et.end)){let V=null;for(let $ of i.done_json)$.id===((pe=(Ne=ae.bind_anchors)==null?void 0:Ne.end)==null?void 0:pe.target_id)&&(V=$);V&&moveAnchors(V)}}}else if(i.intention===EGlobalStoreIntention.Zoom){if(!i.handle_svg_info)return;const ae={x:i.mouse_info.new_position_x-a.center_offset.x,y:i.mouse_info.new_position_y-a.center_offset.y};let le={width:0,height:0,is_old_width:!1,is_old_height:!1};if(i.scale_info.type===EScaleInfoType.TopLeft?le=calculateLeftTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.TopRight?le=calculateRightTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.BottomRight?le=calculateRightBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.BottomLeft?le=calculateLeftBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.TopCenter?le=calculateTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.Right?le=calculateRight(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.BottomCenter?le=calculateBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.Left&&(le=calculateLeft(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client)),i.handle_svg_info&&le.width>0&&le.height>0){const re=le.is_old_width?1:parseFloat((le.width/i.handle_svg_info.info.actual_bound.width).toFixed(3)),V=le.is_old_height?1:parseFloat((le.height/i.handle_svg_info.info.actual_bound.height).toFixed(3)),$=getCenterPoint(ae,i.scale_info.symmetric_point);re>0&&i.scale_info.type!==EScaleInfoType.TopCenter&&i.scale_info.type!==EScaleInfoType.BottomCenter&&(i.handle_svg_info.info.scale_x=re,i.handle_svg_info.info.x=Math.round(getSvgNowPosition(i.handle_svg_info.info.center_position.x,$.x,i.handle_svg_info.info.client.x))),V>0&&i.scale_info.type!==EScaleInfoType.Left&&i.scale_info.type!==EScaleInfoType.Right&&(i.handle_svg_info.info.scale_y=V,i.handle_svg_info.info.y=Math.round(getSvgNowPosition(i.handle_svg_info.info.center_position.y,$.y,i.handle_svg_info.info.client.y)))}}else if(i.intention===EGlobalStoreIntention.Rotate){if(!i.handle_svg_info)return;const ae=Math.atan2(i.mouse_info.position_y-i.handle_svg_info.info.y,i.mouse_info.position_x-i.handle_svg_info.info.x)/(Math.PI/180),le=Math.atan2(i.mouse_info.new_position_y-a.center_offset.y-i.handle_svg_info.info.y,i.mouse_info.new_position_x-a.center_offset.x-i.handle_svg_info.info.x)/(Math.PI/180);i.handle_svg_info.info.rotate=parseFloat((i.rotate_info.angle+le-ae).toFixed(2))}else if(i.intention===EGlobalStoreIntention.Connection&&i.handle_svg_info){const ae=(At=i.handle_svg_info)==null?void 0:At.info.props.point_position.val.length,le=i.mouse_info.new_position_x-i.mouse_info.position_x-a.center_offset.x,re=i.mouse_info.new_position_y-i.mouse_info.position_y-a.center_offset.y,V=i.handle_svg_info.info.props.point_position.val[ae-2],$=((xe=(Ve=i.handle_svg_info)==null?void 0:Ve.info.props.point_r)==null?void 0:xe.val)+2||4;let he=V.x<le?-$:V.x>le?$:0,Ue=V.y<re?-$:V.y>re?$:0;de.ctrlKey?i.handle_svg_info.info.props.point_position.val[ae-1]={x:V.x,y:re+Ue}:de.shiftKey?i.handle_svg_info.info.props.point_position.val[ae-1]={x:le+he,y:V.y}:i.handle_svg_info.info.props.point_position.val[ae-1]={x:le+he,y:re+Ue}}else if(i.intention===EGlobalStoreIntention.SetConnectionLineNode&&i.handle_svg_info){!S&&(i.connection_line_node_info.point_index===i.handle_svg_info.info.props.point_position.val.length-1||i.connection_line_node_info.point_index===0)&&(S=!0);const ae=(ze=i.handle_svg_info)==null?void 0:ze.info.props.point_position.val.length,le=getSvgNowPosition(i.mouse_info.position_x,i.mouse_info.new_position_x,i.connection_line_node_info.init_pos.x),re=getSvgNowPosition(i.mouse_info.position_y,i.mouse_info.new_position_y,i.connection_line_node_info.init_pos.y),V=i.handle_svg_info.info.props.point_position.val[ae-2],$=((hn=(Pt=i.handle_svg_info)==null?void 0:Pt.info.props.point_r)==null?void 0:hn.val)+2||4;let he=V.x<le?-$:V.x>le?$:0,Ue=V.y<re?-$:V.y>re?$:0;i.handle_svg_info.info.props.point_position.val[i.connection_line_node_info.point_index]={x:le+he,y:re+Ue}}},j=()=>{var de,ie,Y,Ie;if(i.mouse_info.state==EMouseInfoState.Down){if((de=i.handle_svg_info)!=null&&de.info&&i.intention==EGlobalStoreIntention.Move)setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.intention=EGlobalStoreIntention.None,i.setDoneJson(i.done_json);else if(i.intention==EGlobalStoreIntention.GroupMove)_&&(_=!1,i.intention=EGlobalStoreIntention.None);else if((ie=i.handle_svg_info)!=null&&ie.info&&i.intention==EGlobalStoreIntention.Zoom)i.handle_svg_info.info.client={x:i.handle_svg_info.info.x,y:i.handle_svg_info.info.y},i.intention=EGlobalStoreIntention.None,setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setDoneJson(i.done_json);else if(i.intention===EGlobalStoreIntention.Rotate&&((Y=i.handle_svg_info)!=null&&Y.info))setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setDoneJson(i.done_json),i.intention=EGlobalStoreIntention.None;else{if(i.intention===EGlobalStoreIntention.Connection)return;if(i.intention===EGlobalStoreIntention.SetConnectionLineNode)S&&((Ie=i.handle_svg_info)!=null&&Ie.info.bind_anchors)&&(i.connection_line_node_info.point_index===0?i.handle_svg_info.info.bind_anchors.start=null:i.handle_svg_info.info.bind_anchors.end=null),i.intention=EGlobalStoreIntention.None,S=!1;else if(i.intention===EGlobalStoreIntention.SelectArea){i.setHandleSvgInfo(null);for(let Oe of i.done_json){const kt=y.value;Oe.selected=Oe.x>kt.x&&Oe.x<kt.x+kt.with&&Oe.y>kt.y&&Oe.y<kt.y+kt.height}i.intention=EGlobalStoreIntention.None}else i.intention!=EGlobalStoreIntention.Select&&(i.intention=EGlobalStoreIntention.None)}i.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},c.display=!1}},oe=de=>{const{clientX:ie,clientY:Y}=de;if(i.intention===EGlobalStoreIntention.Connection){i.handle_svg_info||createLine(de),i.handle_svg_info&&(de.button===0?i.handle_svg_info.info.props.point_position.val.length!==1?i.handle_svg_info.info.props.point_position.val.push({x:i.mouse_info.new_position_x-i.mouse_info.position_x-a.center_offset.x,y:i.mouse_info.new_position_y-i.mouse_info.position_y-a.center_offset.y}):i.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):de.button===2&&(i.intention=EGlobalStoreIntention.None,setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setHandleSvgInfo(null)));return}de.button===0?(i.intention=EGlobalStoreIntention.SelectArea,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),position_y:Math.round((Y-a.canvasInfo.top)/o.svg.scale-a.center_offset.y),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},v.value={a:{x:i.mouse_info.position_x,y:i.mouse_info.position_y},b:{x:0,y:0}}):de.button===2&&(i.intention=EGlobalStoreIntention.MoveCanvas,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y-a.canvasInfo.top)/o.svg.scale),now_position_x:a.center_offset.x,now_position_y:a.center_offset.y,new_position_x:0,new_position_y:0})};function L(de){de!=null&&de.wheelDelta&&(de.wheelDelta>0?o.svg.scale=parseFloat((o.svg.scale+.1).toFixed(1)):o.svg.scale=parseFloat((o.svg.scale-.1).toFixed(1)))}const F=de=>{de.stopPropagation(),de.preventDefault()},O=(de,ie,Y)=>{i.intention!==EGlobalStoreIntention.Connection&&f.value&&(i.intention=EGlobalStoreIntention.ContextMenu,i.setHandleSvgInfo(de,ie),f.value.style.left=Y.pageX+"px",f.value.style.top=Y.pageY+"px",c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!0,ie===i.done_json.length-1&&(c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=!1),ie===0&&(c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!1),c.display=!0)},ue=(de,ie,Y)=>({x:parseFloat((de.x-de.width/2*ie+de.width/2).toFixed(1)),y:parseFloat((de.y-de.height/2*Y+de.height/2).toFixed(1)),width:parseFloat((de.width*ie).toFixed(1)),height:parseFloat((de.height*Y).toFixed(1))}),_e=de=>{de.preventDefault();let ie=[];if(!de.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(de.key)>-1&&(A.value?ie=i.done_json.map((Y,Ie)=>({selected:Y.selected,i:Ie})).filter(Y=>Y.selected).map(Y=>Y.i):i.handle_svg_info&&ie.push(i.handle_svg_info.index)),!de.ctrlKey&&de.key=="ArrowUp"){for(let Y of ie)i.done_json[Y].y-=1,i.done_json[Y].client.y-=1,moveHandlePoint(i.done_json[Y],0,-1),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowDown"){for(let Y of ie)i.done_json[Y].y+=1,i.done_json[Y].client.y+=1,moveHandlePoint(i.done_json[Y],0,1),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowLeft"){for(let Y of ie)i.done_json[Y].x-=1,i.done_json[Y].client.x-=1,moveHandlePoint(i.done_json[Y],-1,0),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowRight"){for(let Y of ie)i.done_json[Y].x+=1,i.done_json[Y].client.x+=1,moveHandlePoint(i.done_json[Y],1,0),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else de.ctrlKey&&de.key.toLowerCase()=="c"?c.onContextMenuClick(EContextMenuInfoType.Copy):!de.ctrlKey&&de.key=="Delete"?A.value?(i.setDoneJson(i.done_json.filter(Y=>!Y.selected)),i.setHandleSvgInfo(i.done_json[i.done_json.length-1],i.done_json.length-1)):c.onContextMenuClick(EContextMenuInfoType.Delete):de.ctrlKey&&de.key=="ArrowUp"?c.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):de.ctrlKey&&de.key=="ArrowDown"?c.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):de.ctrlKey&&de.key=="ArrowLeft"?c.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):de.ctrlKey&&de.key=="ArrowRight"?c.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):de.ctrlKey&&de.shiftKey&&de.key.toLowerCase()=="z"?u.topRedoBtnClick():de.ctrlKey&&de.key.toLowerCase()=="z"?u.topUndoBtnClick():de.ctrlKey&&de.key.toLowerCase()=="delete"&&(i.done_json.length<=0||i.setDoneJson([]))},Ce=()=>{setSvgActualInfo(i.done_json[i.handle_svg_info.index],!0)};return vue.onMounted(()=>{var de;(de=d.value)==null||de.focus(),vue.nextTick(function(){var Y;const ie=(Y=d.value)==null?void 0:Y.getBoundingClientRect();a.canvasInfo={height:(ie==null?void 0:ie.height)||0,with:(ie==null?void 0:ie.width)||0,top:(ie==null?void 0:ie.top)||0,left:(ie==null?void 0:ie.left)||0}})}),n({onCanvasMouseUp:j}),(de,ie)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{class:"canvas",tabindex:"0",ref_key:"canvasRef",ref:d,onDrop:b,onDragenter:T,onDragover:w,onMousedown:oe,onMousemove:z,onMouseup:j,onContextmenu:F,onKeydown:_e,onMousewheel:L},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(o).svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_1$c,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_2$9),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_3$8),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_4$4),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_5$2)])]),vue.unref(o).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_6)):vue.createCommentVNode("",!0),vue.createElementVNode("g",{transform:`translate(${vue.unref(a).center_offset.x*vue.unref(o).svg.scale},${vue.unref(a).center_offset.y*vue.unref(o).svg.scale})rotate(0)scale(${vue.unref(o).svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(i).done_json,(Y,Ie)=>{var Oe,kt,Dt,Fe,$e,Cn;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:Y.id,transform:`translate(${Y.x},${Y.y})rotate(0)scale(1)`,onMousewheel:ie[0]||(ie[0]=(...Lt)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...Lt))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(Y)}`)},[vue.createElementVNode("g",{transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2})rotate(${Y.rotate}) scale(1) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`,onMousedown:Lt=>x(Y,Ie,Lt),onMouseup:Lt=>k(Y,Ie,Lt),onMouseenter:Lt=>M(Y,Ie,Lt),onMouseleave:Lt=>D(Y,Ie,Lt),onContextmenu:Lt=>O(Y,Ie,Lt)},[Y.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$y,{key:0,"item-info":Y,"point-visible":vue.unref(g).connection_line&&((Oe=vue.unref(g).select_item.info)==null?void 0:Oe.id)==Y.id},null,8,["item-info","point-visible"])):Y.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${Y.name}`},vue.unref(prosToVBind)(Y),{width:"100",height:"100",id:Y.id,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),null,16,_hoisted_10)):Y.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Y.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(Y),{width:"100",height:"100",id:Y.id,onResize:Ce,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),null,16,["id","transform"])):Y.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},ue(Y.actual_bound,Y.scale_x,Y.scale_y),{id:`foreign-object${Y.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Y.tag),vue.mergeProps(vue.unref(prosToVBind)(Y),{id:Y.id,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(Y.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_11)):Y.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:Y.id,x1:Y.props.start_x.val,y1:Y.props.start_y.val,x2:Y.props.end_x.val,y2:Y.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_12$1)):vue.createCommentVNode("",!0),Y.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${Y.id}`,fill:"black","fill-opacity":"0"},ue(Y.actual_bound,Y.scale_x,Y.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!Y.selected&&(vue.unref(i).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Move&&((kt=vue.unref(i).handle_svg_info)==null?void 0:kt.info.id)==Y.id,"svg-item-select":vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select&&((Dt=vue.unref(i).handle_svg_info)==null?void 0:Dt.info.id)==Y.id,"svg-item-in-group":Y.selected}}),null,16,_hoisted_13)):vue.createCommentVNode("",!0),((Fe=vue.unref(i).handle_svg_info)==null?void 0:Fe.info.id)===Y.id&&vue.unref(g).handle_panel&&Y.type!==vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":Y},null,8,["item-info"])):vue.createCommentVNode("",!0),!Y.selected&&(($e=vue.unref(g).select_item.info)==null?void 0:$e.id)==Y.id&&vue.unref(g).connection_panel&&Y.config.have_anchor&&vue.unref(i).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(i).intention!==vue.unref(EGlobalStoreIntention).Select||Y.id!==((Cn=vue.unref(i).handle_svg_info)==null?void 0:Cn.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:F,"item-info":Y},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_9)],2)],40,_hoisted_8)),[[vue.vShow,Y.display]])}),128)),vue.createElementVNode("rect",{x:vue.unref(y).x,y:vue.unref(y).y,height:vue.unref(y).height,width:vue.unref(y).with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_14)],8,_hoisted_7)],4))],544),vue.withDirectives(vue.createElementVNode("ul",{ref_key:"contextMenuRef",ref:f,class:"contextMenu"},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(c).info,(Y,Ie)=>(vue.openBlock(),vue.createElementBlock("li",{key:Y.title,onClick:Oe=>vue.unref(c).onContextMenuClick(Ie)},[vue.createElementVNode("p",{class:vue.normalizeClass(Y.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(Y.title)+" ",1),vue.createElementVNode("span",_hoisted_16$1,vue.toDisplayString(Y.hot_key),1)],2)],8,_hoisted_15))),128))],512),[[vue.vShow,vue.unref(c).display]])],64))}}),centerPanel_vue_vue_type_style_index_0_scoped_97a3211c_lang="",CenterPanel=_export_sfc$1(_sfc_main$x,[["__scopeId","data-v-97a3211c"]]);/*! Element Plus Icons Vue v2.1.0 */var export_helper_default=(r,n)=>{let i=r.__vccOpts||r;for(let[o,a]of n)i[o]=a;return i},aim_vue_vue_type_script_lang_default={name:"Aim"},_hoisted_12={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_22=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_32=vue.createElementVNode("path",{fill:"currentColor",d:"M512 96a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V128a32 32 0 0 1 32-32zm0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32zM96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32zm576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32z"},null,-1),_hoisted_42=[_hoisted_22,_hoisted_32];function _sfc_render2(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_12,_hoisted_42)}var aim_default=export_helper_default(aim_vue_vue_type_script_lang_default,[["render",_sfc_render2],["__file","aim.vue"]]),arrow_down_vue_vue_type_script_lang_default={name:"ArrowDown"},_hoisted_16={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_26=vue.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"},null,-1),_hoisted_36=[_hoisted_26];function _sfc_render6(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_16,_hoisted_36)}var arrow_down_default=export_helper_default(arrow_down_vue_vue_type_script_lang_default,[["render",_sfc_render6],["__file","arrow-down.vue"]]),circle_check_vue_vue_type_script_lang_default={name:"CircleCheck"},_hoisted_149={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_249=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_348=vue.createElementVNode("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"},null,-1),_hoisted_415=[_hoisted_249,_hoisted_348];function _sfc_render49(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_149,_hoisted_415)}var circle_check_default=export_helper_default(circle_check_vue_vue_type_script_lang_default,[["render",_sfc_render49],["__file","circle-check.vue"]]),circle_close_vue_vue_type_script_lang_default={name:"CircleClose"},_hoisted_151={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_251=vue.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"},null,-1),_hoisted_350=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_416=[_hoisted_251,_hoisted_350];function _sfc_render51(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_151,_hoisted_416)}var circle_close_default=export_helper_default(circle_close_vue_vue_type_script_lang_default,[["render",_sfc_render51],["__file","circle-close.vue"]]),close_vue_vue_type_script_lang_default={name:"Close"},_hoisted_156={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_256=vue.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"},null,-1),_hoisted_355=[_hoisted_256];function _sfc_render56(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_156,_hoisted_355)}var close_default=export_helper_default(close_vue_vue_type_script_lang_default,[["render",_sfc_render56],["__file","close.vue"]]),hide_vue_vue_type_script_lang_default={name:"Hide"},_hoisted_1133={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2133=vue.createElementVNode("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"},null,-1),_hoisted_3132=vue.createElementVNode("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"},null,-1),_hoisted_438=[_hoisted_2133,_hoisted_3132];function _sfc_render133(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1133,_hoisted_438)}var hide_default=export_helper_default(hide_vue_vue_type_script_lang_default,[["render",_sfc_render133],["__file","hide.vue"]]),loading_vue_vue_type_script_lang_default={name:"Loading"},_hoisted_1150={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2150=vue.createElementVNode("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"},null,-1),_hoisted_3149=[_hoisted_2150];function _sfc_render150(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1150,_hoisted_3149)}var loading_default=export_helper_default(loading_vue_vue_type_script_lang_default,[["render",_sfc_render150],["__file","loading.vue"]]),view_vue_vue_type_script_lang_default={name:"View"},_hoisted_1283={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2283=vue.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1),_hoisted_3282=[_hoisted_2283];function _sfc_render283(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1283,_hoisted_3282)}var view_default=export_helper_default(view_vue_vue_type_script_lang_default,[["render",_sfc_render283],["__file","view.vue"]]),MapShim=function(){if(typeof Map<"u")return Map;function r(n,i){var o=-1;return n.some(function(a,u){return a[0]===i?(o=u,!0):!1}),o}return function(){function n(){this.__entries__=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),n.prototype.get=function(i){var o=r(this.__entries__,i),a=this.__entries__[o];return a&&a[1]},n.prototype.set=function(i,o){var a=r(this.__entries__,i);~a?this.__entries__[a][1]=o:this.__entries__.push([i,o])},n.prototype.delete=function(i){var o=this.__entries__,a=r(o,i);~a&&o.splice(a,1)},n.prototype.has=function(i){return!!~r(this.__entries__,i)},n.prototype.clear=function(){this.__entries__.splice(0)},n.prototype.forEach=function(i,o){o===void 0&&(o=null);for(var a=0,u=this.__entries__;a<u.length;a++){var c=u[a];i.call(o,c[1],c[0])}},n}()}(),isBrowser=typeof window<"u"&&typeof document<"u"&&window.document===document,global$1=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),requestAnimationFrame$1=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(global$1):function(r){return setTimeout(function(){return r(Date.now())},1e3/60)}}(),trailingTimeout=2;function throttle(r,n){var i=!1,o=!1,a=0;function u(){i&&(i=!1,r()),o&&f()}function c(){requestAnimationFrame$1(u)}function f(){var d=Date.now();if(i){if(d-a<trailingTimeout)return;o=!0}else i=!0,o=!1,setTimeout(c,n);a=d}return f}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported=typeof MutationObserver<"u",ResizeObserverController=function(){function r(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=throttle(this.refresh.bind(this),REFRESH_DELAY)}return r.prototype.addObserver=function(n){~this.observers_.indexOf(n)||this.observers_.push(n),this.connected_||this.connect_()},r.prototype.removeObserver=function(n){var i=this.observers_,o=i.indexOf(n);~o&&i.splice(o,1),!i.length&&this.connected_&&this.disconnect_()},r.prototype.refresh=function(){var n=this.updateObservers_();n&&this.refresh()},r.prototype.updateObservers_=function(){var n=this.observers_.filter(function(i){return i.gatherActive(),i.hasActive()});return n.forEach(function(i){return i.broadcastActive()}),n.length>0},r.prototype.connect_=function(){!isBrowser||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},r.prototype.disconnect_=function(){!isBrowser||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},r.prototype.onTransitionEnd_=function(n){var i=n.propertyName,o=i===void 0?"":i,a=transitionKeys.some(function(u){return!!~o.indexOf(u)});a&&this.refresh()},r.getInstance=function(){return this.instance_||(this.instance_=new r),this.instance_},r.instance_=null,r}(),defineConfigurable=function(r,n){for(var i=0,o=Object.keys(n);i<o.length;i++){var a=o[i];Object.defineProperty(r,a,{value:n[a],enumerable:!1,writable:!1,configurable:!0})}return r},getWindowOf=function(r){var n=r&&r.ownerDocument&&r.ownerDocument.defaultView;return n||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(r){return parseFloat(r)||0}function getBordersSize(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return n.reduce(function(o,a){var u=r["border-"+a+"-width"];return o+toFloat(u)},0)}function getPaddings(r){for(var n=["top","right","bottom","left"],i={},o=0,a=n;o<a.length;o++){var u=a[o],c=r["padding-"+u];i[u]=toFloat(c)}return i}function getSVGContentRect(r){var n=r.getBBox();return createRectInit(0,0,n.width,n.height)}function getHTMLElementContentRect(r){var n=r.clientWidth,i=r.clientHeight;if(!n&&!i)return emptyRect;var o=getWindowOf(r).getComputedStyle(r),a=getPaddings(o),u=a.left+a.right,c=a.top+a.bottom,f=toFloat(o.width),d=toFloat(o.height);if(o.boxSizing==="border-box"&&(Math.round(f+u)!==n&&(f-=getBordersSize(o,"left","right")+u),Math.round(d+c)!==i&&(d-=getBordersSize(o,"top","bottom")+c)),!isDocumentElement(r)){var p=Math.round(f+u)-n,h=Math.round(d+c)-i;Math.abs(p)!==1&&(f-=p),Math.abs(h)!==1&&(d-=h)}return createRectInit(a.left,a.top,f,d)}var isSVGGraphicsElement=function(){return typeof SVGGraphicsElement<"u"?function(r){return r instanceof getWindowOf(r).SVGGraphicsElement}:function(r){return r instanceof getWindowOf(r).SVGElement&&typeof r.getBBox=="function"}}();function isDocumentElement(r){return r===getWindowOf(r).document.documentElement}function getContentRect(r){return isBrowser?isSVGGraphicsElement(r)?getSVGContentRect(r):getHTMLElementContentRect(r):emptyRect}function createReadOnlyRect(r){var n=r.x,i=r.y,o=r.width,a=r.height,u=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(u.prototype);return defineConfigurable(c,{x:n,y:i,width:o,height:a,top:i,right:n+o,bottom:a+i,left:n}),c}function createRectInit(r,n,i,o){return{x:r,y:n,width:i,height:o}}var ResizeObservation=function(){function r(n){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=n}return r.prototype.isActive=function(){var n=getContentRect(this.target);return this.contentRect_=n,n.width!==this.broadcastWidth||n.height!==this.broadcastHeight},r.prototype.broadcastRect=function(){var n=this.contentRect_;return this.broadcastWidth=n.width,this.broadcastHeight=n.height,n},r}(),ResizeObserverEntry=function(){function r(n,i){var o=createReadOnlyRect(i);defineConfigurable(this,{target:n,contentRect:o})}return r}(),ResizeObserverSPI=function(){function r(n,i,o){if(this.activeObservations_=[],this.observations_=new MapShim,typeof n!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=n,this.controller_=i,this.callbackCtx_=o}return r.prototype.observe=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof getWindowOf(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var i=this.observations_;i.has(n)||(i.set(n,new ResizeObservation(n)),this.controller_.addObserver(this),this.controller_.refresh())}},r.prototype.unobserve=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof getWindowOf(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var i=this.observations_;i.has(n)&&(i.delete(n),i.size||this.controller_.removeObserver(this))}},r.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},r.prototype.gatherActive=function(){var n=this;this.clearActive(),this.observations_.forEach(function(i){i.isActive()&&n.activeObservations_.push(i)})},r.prototype.broadcastActive=function(){if(this.hasActive()){var n=this.callbackCtx_,i=this.activeObservations_.map(function(o){return new ResizeObserverEntry(o.target,o.broadcastRect())});this.callback_.call(n,i,n),this.clearActive()}},r.prototype.clearActive=function(){this.activeObservations_.splice(0)},r.prototype.hasActive=function(){return this.activeObservations_.length>0},r}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function r(n){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=ResizeObserverController.getInstance(),o=new ResizeObserverSPI(n,i,this);observers.set(this,o)}return r}();["observe","unobserve","disconnect"].forEach(function(r){ResizeObserver$1.prototype[r]=function(){var n;return(n=observers.get(this))[r].apply(n,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}();const Events=["blur","input","change","changeSelectionStyle","changeSession","copy","focus","paste"],VAceEditor=vue.defineComponent({props:{value:{type:String,required:!0},lang:{type:String,default:"text"},theme:{type:String,default:"chrome"},options:Object,placeholder:String,readonly:Boolean,wrap:Boolean,printMargin:{type:[Boolean,Number],default:!0},minLines:Number,maxLines:Number},emits:["update:value","init",...Events],render(){return vue.h("div")},mounted(){const r=this._editor=vue.markRaw(ace.edit(this.$el,{placeholder:this.placeholder,readOnly:this.readonly,value:this.value,mode:"ace/mode/"+this.lang,theme:"ace/theme/"+this.theme,wrap:this.wrap,printMargin:this.printMargin,useWorker:!1,minLines:this.minLines,maxLines:this.maxLines,...this.options}));this._contentBackup=this.value,this._isSettingContent=!1,r.on("change",()=>{if(this._isSettingContent)return;const n=r.getValue();this._contentBackup=n,this.$emit("update:value",n)}),Events.forEach(n=>{const i="on"+vue.capitalize(n);typeof this.$.vnode.props[i]=="function"&&r.on(n,this.$emit.bind(this,n))}),this._ro=new index$1(()=>r.resize()),this._ro.observe(this.$el),this.$emit("init",r)},beforeUnmount(){var r,n;(r=this._ro)===null||r===void 0||r.disconnect(),(n=this._editor)===null||n===void 0||n.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()}},watch:{value(r){if(this._contentBackup!==r){try{this._isSettingContent=!0,this._editor.setValue(r,1)}finally{this._isSettingContent=!1}this._contentBackup=r}},theme(r){this._editor.setTheme("ace/theme/"+r)},options(r){this._editor.setOptions(r)},readonly(r){this._editor.setReadOnly(r)},placeholder(r){this._editor.setOption("placeholder",r)},wrap(r){this._editor.setWrapBehavioursEnabled(r)},printMargin(r){this._editor.setOption("printMargin",r)},lang(r){this._editor.setOption("mode","ace/mode/"+r)},minLines(r){this._editor.setOption("minLines",r)},maxLines(r){this._editor.setOption("maxLines",r)}}}),themeUrl2="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL3RoZW1lL2tyX3RoZW1lLmNzcyIsWyJyZXF1aXJlIiwiZXhwb3J0cyIsIm1vZHVsZSJdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpe21vZHVsZS5leHBvcnRzID0gIi5hY2Uta3ItdGhlbWUgLmFjZV9ndXR0ZXIge1xuICBiYWNrZ3JvdW5kOiAjMWMxOTE3O1xuICBjb2xvcjogI0ZDRkZFMFxufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfcHJpbnQtbWFyZ2luIHtcbiAgd2lkdGg6IDFweDtcbiAgYmFja2dyb3VuZDogIzFjMTkxN1xufVxuXG4uYWNlLWtyLXRoZW1lIHtcbiAgYmFja2dyb3VuZC1jb2xvcjogIzBCMEEwOTtcbiAgY29sb3I6ICNGQ0ZGRTBcbn1cblxuLmFjZS1rci10aGVtZSAuYWNlX2N1cnNvciB7XG4gIGNvbG9yOiAjRkY5OTAwXG59XG5cbi5hY2Uta3ItdGhlbWUgLmFjZV9tYXJrZXItbGF5ZXIgLmFjZV9zZWxlY3Rpb24ge1xuICBiYWNrZ3JvdW5kOiByZ2JhKDE3MCwgMCwgMjU1LCAwLjQ1KVxufVxuXG4uYWNlLWtyLXRoZW1lLmFjZV9tdWx0aXNlbGVjdCAuYWNlX3NlbGVjdGlvbi5hY2Vfc3RhcnQge1xuICBib3gtc2hhZG93OiAwIDAgM3B4IDBweCAjMEIwQTA5O1xufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfbWFya2VyLWxheWVyIC5hY2Vfc3RlcCB7XG4gIGJhY2tncm91bmQ6IHJnYigxMDIsIDgyLCAwKVxufVxuXG4uYWNlLWtyLXRoZ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zIik7CnZhciBkb20gPSByZXF1aXJlKCIuLi9saWIvZG9tIik7CmRvbS5pbXBvcnRDc3NTdHJpbmcoZXhwb3J0cy5jc3NUZXh0LCBleHBvcnRzLmNzc0NsYXNzLCBmYWxzZSk7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL3RoZW1lL2tyX3RoZW1lIl0sIGZ1bmN0aW9uKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBtb2R1bGUgPT0gIm9iamVjdCIgJiYgdHlwZW9mIGV4cG9ydHMgPT0gIm9iamVjdCIgJiYgbW9kdWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIA==",modeJsonUrl="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvbGliL29vcCIsImFjZS9tb2RlL3RleHRfaGlnaGxpZ2h0X3J1bGVzIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7InVzZSBzdHJpY3QiOwp2YXIgb29wID0gcmVxdWlyZSgiLi4vbGliL29vcCIpOwp2YXIgVGV4dEhpZ2hsaWdodFJ1bGVzID0gcmVxdWlyZSgiLi90ZXh0X2hpZ2hsaWdodF9ydWxlcyIpLlRleHRIaWdobGlnaHRSdWxlczsKdmFyIEpzb25IaWdobGlnaHRSdWxlcyA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuJHJ1bGVzID0gewogICAgICAgICJzdGFydCI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdG9rZW46ICJ2YXJpYWJsZSIsCiAgICAgICAgICAgICAgICByZWdleDogJ1siXSg/Oig/OlxcXFwuKXwoPzpbXiJcXFxcXSkpKj9bIl1cXHMqKD89OiknCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAnIicsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RyaW5nIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lm51bWVyaWMiLAogICAgICAgICAgICAgICAgcmVnZXg6ICIwW3hYXVswLTlhLWZBLUZdK1xcYiIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJjb25zdGFudC5udW1lcmljIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAiWystXT9cXGQrKD86KD86XFwuXFxkKik/KD86W2VFXVsrLV0/XFxkKyk/KT9cXGIiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29uc3RhbnQubGFuZ3VhZ2UuYm9vbGVhbiIsCiAgICAgICAgICAgICAgICByZWdleDogIig/OnRydWV8ZmFsc2UpXFxiIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbJ10oPzooPzpcXFxcLil8KD86W14nXFxcXF0pKSo/WyddIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbW1lbnQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXC9cXC8uKiQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5zdGFydCIsCiAgICAgICAgICAgICAgICByZWdleDogIlxcL1xcKiIsCiAgICAgICAgICAgICAgICBuZXh0OiAiY29tbWVudCIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5scGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbWyh7XSIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5ycGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbXFxdKX1dIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInB1bmN0dWF0aW9uLm9wZXJhdG9yIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAvWyxdLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXHMrIgogICAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAic3RyaW5nIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lmxhbmd1YWdlLmVzY2FwZSIsCiAgICAgICAgICAgICAgICByZWdleDogL1xcKD86eFswLTlhLWZBLUZdezJ9fHVbMC05YS1mQS1GXXs0fXxbIlxcXC9iZm5ydF0pLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInN0cmluZyIsCiAgICAgICAgICAgICAgICByZWdleDogJyJ8JCcsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RhcnQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIGRlZmF1bHRUb2tlbjogInN0cmluZyIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImNvbW1lbnQiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5lbmQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXCpcXC8iLAogICAgICAgICAgICAgICAgbmV4dDogInN0YXJ0IgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBkZWZhdWx0VG9rZW46ICJjb21tZW50IgogICAgICAgICAgICB9CiAgICAgICAgXQogIC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hbmdlLmlzTXVsdGlMaW5lKCkpIHsKICAgICAgICAgICAgICAgIGlmIChmb3JjZU11bHRpbGluZSkgewogICAgICAgICAgICAgICAgICAgIHJhbmdlID0gdGhpcy5nZXRTZWN0aW9uUmFuZ2Uoc2Vzc2lvbiwgcm93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZvbGRTdHlsZSAhPSAiYWxsIikKICAgICAgICAgICAgICAgICAgICByYW5nZSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgICAgIH0KICAgICAgICBpZiAoZm9sZFN0eWxlID09PSAibWFya2JlZ2luIikKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIHZhciBtYXRjaCA9IGxpbmUubWF0Y2godGhpcy5mb2xkaW5nU3RvcE1hcmtlcik7CiAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgIHZhciBpID0gbWF0Y2guaW5kZXggKyBtYXRjaFswXS5sZW5ndGg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsb3NpbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmdldENvbW1lbnRGb2xkUmFuZ2Uocm93LCBpLCAtMSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuZ2V0U2VjdGlvblJhbmdlID0gZnVuY3Rpb24gKHNlc3Npb24sIHJvdykgewogICAgICAgIHZhciBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgdmFyIHN0YXJ0SW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgdmFyIHN0YXJ0Um93ID0gcm93OwogICAgICAgIHZhciBzdGFydENvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIHJvdyA9IHJvdyArIDE7CiAgICAgICAgdmFyIGVuZFJvdyA9IHJvdzsKICAgICAgICB2YXIgbWF4Um93ID0gc2Vzc2lvbi5nZXRMZW5ndGgoKTsKICAgICAgICB3aGlsZSAoKytyb3cgPCBtYXhSb3cpIHsKICAgICAgICAgICAgbGluZSA9IHNlc3Npb24uZ2V0TGluZShyb3cpOwogICAgICAgICAgICB2YXIgaW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgICAgIGlmIChpbmRlbnQgPT09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChzdGFydEluZGVudCA+IGluZGVudCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB2YXIgc3ViUmFuZ2UgPSB0aGlzLmdldEZvbGRXaWRnZXRSYW5nZShzZXNzaW9uLCAiYWxsIiwgcm93KTsKICAgICAgICAgICAgaWYgKHN1YlJhbmdlKSB7CiAgICAgICAgICAgICAgICBpZiAoc3ViUmFuZ2Uuc3RhcnQucm93IDw9IHN0YXJ0Um93KSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJSYW5nZS5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgcm93ID0gc3ViUmFuZ2UuZW5kLnJvdzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0SW5kZW50ID09IGluZGVudCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVuZFJvdyA9IHJvdzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgc2Vzc2lvbi5nZXRMaW5lKGVuZFJvdykubGVuZ3RoKTsKICAgIH07CiAgICB0aGlzLmdldENvbW1lbnRSZWdpb25CbG9jayA9IGZ1bmN0aW9uIChzZXNzaW9uLCBsaW5lLCByb3cpIHsKICAgICAgICB2YXIgc3RhcnRDb2x1bW4gPSBsaW5lLnNlYXJjaCgvXHMqJC8pOwogICAgICAgIHZhciBtYXhSb3cgPSBzZXNzaW9uLmdldExlbmd0aCgpOwogICAgICAgIHZhciBzdGFydFJvdyA9IHJvdzsKICAgICAgICB2YXIgcmUgPSAvXlxzKig/OlwvXCp8XC9cL3wtLSkjPyhlbmQpP3JlZ2lvblxiLzsKICAgICAgICB2YXIgZGVwdGggPSAxOwogICAgICAgIHdoaWxlICgrK3JvdyA8IG1heFJvdykgewogICAgICAgICAgICBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgICAgIHZhciBtID0gcmUuZXhlYyhsaW5lKTsKICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChtWzFdKQogICAgICAgICAgICAgICAgZGVwdGgtLTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgZGVwdGgrKzsKICAgICAgICAgICAgaWYgKCFkZXB0aCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICB2YXIgZW5kUm93ID0gcm93OwogICAgICAgIGlmIChlbmRSb3cgPiBzdGFydFJvdykgewogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlKHN0YXJ0Um93LCBzdGFydENvbHVtbiwgZW5kUm93LCBsaW5lLmxlbmd0aCk7CiAgICAgICAgfQogICAgfTsKfSkuY2FsbChGb2xkTW9kZS5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uIixbInJlcXVpcmUiLCJleHBvcnRzIiwibW9kdWxlIiwiYWNlL2xpYi9vb3AiLCJhY2UvbW9kZS90ZXh0IiwiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLCJhY2Uvb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Kb29wLmluaGVyaXRzKE1vZGUsIFRleHRNb2RlKTsKKGZ1bmN0aW9uICgpIHsKICAgIHRoaXMubGluZUNvbW1lbnRTdGFydCA9ICIvLyI7CiAgICB0aGlzLmJsb2NrQ29tbWVudCA9IHsgc3RhcnQ6ICIvKiIsIGVuZDogIiovIiB9OwogICAgdGhpcy5nZXROZXh0TGluZUluZGVudCA9IGZ1bmN0aW9uIChzdGF0ZSwgbGluZSwgdGFiKSB7CiAgICAgICAgdmFyIGluZGVudCA9IHRoaXMuJGdldEluZGVudChsaW5lKTsKICAgICAgICBpZiAoc3RhdGUgPT0gInN0YXJ0IikgewogICAgICAgICAgICB2YXIgbWF0Y2ggPSBsaW5lLm1hdGNoKC9eLipbXHtcKFxbXVxzKiQvKTsKICAgICAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgICAgICBpbmRlbnQgKz0gdGFiOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBpbmRlbnQ7CiAgICB9OwogICAgdGhpcy5jaGVja091dGRlbnQgPSBmdW5jdGlvbiAoc3RhdGUsIGxpbmUsIGlucHV0KSB7CiAgICAgICAgcmV0dXJuIHRoaXMuJG91dGRlbnQuY2hlY2tPdXRkZW50KGxpbmUsIGlucHV0KTsKICAgIH07CiAgICB0aGlzLmF1dG9PdXRkZW50ID0gZnVuY3Rpb24gKHN0YXRlLCBkb2MsIHJvdykgewogICAgICAgIHRoaXMuJG91dGRlbnQuYXV0b091dGRlbnQoZG9jLCByb3cpOwogICAgfTsKICAgIHRoaXMuY3JlYXRlV29ya2VyID0gZnVuY3Rpb24gKHNlc3Npb24pIHsKICAgICAgICB2YXIgd29ya2VyID0gbmV3IFdvcmtlckNsaWVudChbImFjZSJdLCAiYWNlL21vZGUvanNvbl93b3JrZXIiLCAiSnNvbldvcmtlciIpOwogICAgICAgIHdvcmtlci5hdHRhY2hUb0RvY3VtZW50KHNlc3Npb24uZ2V0RG9jdW1lbnQoKSk7CiAgICAgICAgd29ya2VyLm9uKCJhbm5vdGF0ZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHNlc3Npb24uc2V0QW5ub3RhdGlvbnMoZS5kYXRhKTsKICAgICAgICB9KTsKICAgICAgICB3b3JrZXIub24oInRlcm1pbmF0ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgc2Vzc2lvbi5jbGVhckFubm90YXRpb25zKCk7CiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHdvcmtlcjsKICAgIH07CiAgICB0aGlzLiRpZCA9ICJhY2UvbW9kZS9qc29uIjsKfSkuY2FsbChNb2RlLnByb3RvdHlwZSk7CmV4cG9ydHMuTW9kZSA9IE1vZGU7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL21vZGUvanNvbiJdLCBmdW5jdGlvbihtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbW9kdWxlID09ICJvYmplY3QiICYmIHR5cGVvZiBleHBvcnRzID09ICJvYmplY3QiICYmIG1vZHVsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICA=",workerJsonUrl="data:application/javascript;base64,Im5vIHVzZSBzdHJpY3QiOwohKGZ1bmN0aW9uKHdpbmRvdykgewppZiAodHlwZW9mIHdpbmRvdy53aW5kb3cgIT0gInVuZGVmaW5lZCIgJiYgd2luZG93LmRvY3VtZW50KQogICAgcmV0dXJuOwppZiAod2luZG93LnJlcXVpcmUgJiYgd2luZG93LmRlZmluZSkKICAgIHJldHVybjsKCmlmICghd2luZG93LmNvbnNvbGUpIHsKICAgIHdpbmRvdy5jb25zb2xlID0gZnVuY3Rpb24oKSB7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FzLm1haW4gfHwgYWxpYXMubmFtZSk7CiAgICAgICAgfSBlbHNlIGlmIChhbGlhcyA9PT0gZmFsc2UpIHsKICAgICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICB2YXIgaSA9IHRlc3RQYXRoLmxhc3RJbmRleE9mKCIvIik7CiAgICAgICAgaWYgKGkgPT09IC0xKSBicmVhazsKICAgICAgICB0YWlsID0gdGVzdFBhdGguc3Vic3RyKGkpICsgdGFpbDsKICAgICAgICB0ZXN0UGF0aCA9IHRlc3RQYXRoLnNsaWNlKDAsIGkpOwogICAgfQogICAgcmV0dXJuIGlkOwp9CndpbmRvdy5yZXF1aXJlLm1vZHVsZXMgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9OwoKd2luZG93LmRlZmluZSA9IGZ1bmN0aW9uKGlkLCBkZXBzLCBmYWN0b3J5KSB7CiAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PSAyKSB7CiAgICAgICAgZmFjdG9yeSA9IGRlcHM7CiAgICAgICAgaWYgKHR5cGVvZiBpZCAhPSAic3RyaW5nIikgewogICAgICAgICAgICBkZXBzID0gaWQ7CiAgICAgICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICAgICAgfQogICAgfSBlbHNlIGlmIChhcmd1bWVudHMubGVuZ3RoID09IDEpIHsKICAgICAgICBmYWN0b3J5ID0gaWQ7CiAgICAgICAgZGVwcyA9IFtdOwogICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICB9CiAgICAKICAgIGlmICh0eXBlb2YgZmFjdG9yeSAhPSAiZnVuY3Rpb24iKSB7CiAgICAgICAgd2luZG93LnJlcXVpcmUubW9kdWxlc1tpZF0gPSB7CiAgICAgICAgICAgIGV4cG9ydHM6IGZhY3RvcnksCiAgICAgICAgICAgIGluaXRpYWxpemVkOiB0cnVlCiAgICAgICAgfTsKICAgICAgICByZXR1cm47CiAgICB9CgogICAgaWYgKCFkZXBz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xlOwogICAgICAgICAgICAgICAgICAgIC8vIEJ1dCBmb3IgYWxsIG90aGVyIGRlcGVuZGVuY2llcywgd2UgY2FuIGp1c3QgZ28gYWhlYWQgYW5kCiAgICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSB0aGVtLgogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICByZXR1cm4gcmVxKGRlcCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgaWYgKHJldHVybkV4cG9ydHMpCiAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IHJldHVybkV4cG9ydHM7CiAgICAgICAgICAgIHJldHVybiBtb2R1bGU7CiAgICAgICAgfQogICAgfTsKfTsKd2luZG93LmRlZmluZS5hbWQgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9Owp3aW5kb3cuaW5pdEJhc2VVcmxzICA9IGZ1bmN0aW9uIGluaXRCYXNlVXJscyh0b3BMZXZlbE5hbWVzcGFjZXMpIHsKICAgIGZvciAodmFyIGkgaW4gdG9wTGV2ZWxOYW1lc3BhY2VzKQogICAgICAgIHRoaXMucmVxdWlyZS50bG5zW2ldID0gdG9wTGV2ZWxOYW1lc3BhY2VzW2ldOwp9OwoKd2luZG93LmluaXRTZW5kZXIgPSBmdW5jdGlvbiBpbml0U2VuZGVyKCkgewoKICAgIHZhciBFdmVudEVtaXR0ZXIgPSB3aW5kb3cucmVxdWlyZSgiYWNlL2xpYi9ldmVudF9lbWl0dGVyIikuRXZlbnRFbWl0dGVyOwogICAgdmFyIG9vcCA9IHdpbmRvdy5yZXF1aXJlKCJhY2UvbGliL29vcCIpOwogICAgCiAgICB2YXIgU2VuZGVyID0gZnVuY3Rpb24oKSB7fTsKICAgIAogICAgKGZ1bmN0aW9uKCkgewogICAgICAgIAogICAgICAgIG9vcC5pbXBsZW1lbnQodGhpcywgRXZlbnRFbWl0dGVyKTsKICAgICAgICAgICAgICAgIAogICAgICAgIHRoaXMuY2FsbGJhY2sgPSBmdW5jdGlvbihkYXRhLCBjYWxsYmFja0lkKSB7CiAgICAgICAgICAgIHBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIHR5cGU6ICJjYWxsIiwKICAgICAgICAgICAgICAgIGlkOiBjYWxsYmFja0lkLAogICAgICAgICAgICAgICAgZGF0YTogZGF0YQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgCiAgICAgICAgdGhpcy5lbWl0ID0gZnVuY3Rpb24obmFtZSwgZGF0YSkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiZXZlbnQiLAogICAgICAgICAgICAgICAgbmFtZTogbmFtZSwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICAKICAgIH0pLmNhbGwoU2VuZGVyLnByb3RvdHlwZSk7CiAgICAKICAgIHJldHVybiBuZXcgU2VuZGVyKCk7Cn07Cgp2YXIgbWFpbiA9IHdpbmRvdy5tYWluID0gbnVsbDsKdmFyIHNlbmRlciA9IHdpbmRvdy5zZW5kZXIgPSBudWxsOwoKd2luZG93Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKGUpIHsKICAgIHZhciBtc2cgPSBlLmRhdGE7CiAgICBpZiAobXNnLmV2ZW50ICYmIHNlbmRlcikgewogICAgICAgIHNlbmRlci5fc2lnbmFsKG1zZy5ldmVudCwgbXNnLmRhdGEpOwogICAgfQogICAgZWxzZSBpZiAobXNnLmNvbW1hbmQpIHsKICAgICAgICBpZiAobWFpblttc2cuY29tbWFuZF0pCiAgICAgICAgICAgIG1haW5bbXNnLmNvbW1hbmRdLmFwcGx5KG1haW4sIG1zZy5hcmdzKTsKICAgICAgICBlbHNlIGlmICh3aW5kb3dbbXNnLmNvbW1hbmRdKQogICAgICAgICAgICB3aW5kb3dbbXNnLmNvbW1hbmRdLmFwcGx5KHdpbmRvdywgbXNnLmFyZ3MpOwogICAgICAgIGVsc2UKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJVbmtub3duIGNvbW1hbmQ6IiArIG1zZy5jb21tYW5kKTsKICAgIH0KICAgIGVsc2UgaWYgKG1zZy5pbml0KSB7CiAgICAgICAgd2luZG93LmluaXRCYXNlVXJscyhtc2cudGxucyk7CiAgICAgICAgc2VuZGVyID0gd2luZG93LnNlbmRlciA9IHdpbmRvdy5pbml0U2VuZGVyKCk7CiAgICAgICAgdmFyIGNsYXp6ID0gdGhpcy5yZXF1aXJlKG1zZy5tb2R1bGUpW21zZy5jbGFzc25hbWVdOwogICAgICAgIG1haW4gPSB3aW5kb3cubWFpbiA9IG5ldyBjbGF6eihzZW5kZXIpOwogICAgfQp9Owp9KSh0aGlzKTsKCmFjZS5kZWZpbmUoImFjZS9saWIvb29wIixbXSwgZnVuY3Rpb24ocmVxdWlyZSwgZXhwb3J0cywgbW9kdWxlKXsidXNlIHN0cmljdCI7CmV4cG9ydHMuaW5oZXJpdHMgPSBmdW5jdGlvbiAoY3Rvciwgc3VwZXJDdG9yKSB7CiAgICBjdG9yLnN1cGVyXyA9IHN1cGVyQ3RvcjsKICAgIGN0b3IucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShzdXBlckN0b3IucHJvdG90eXBlLCB7CiAgICAgICAgY29uc3RydWN0b3I6IHsKICAgICAgICAgICAgdmFsdWU6IGN0b3IsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgfQogICAgfSk7Cn07CmV4cG9ydHMubWl4aW4gPSBmdW5jdGlvbiAob2JqLCBtaXhpbikgewogICAgZm9yICh2YXIga2V5IGluIG1peGluKSB7CiAgICAgICAgb2JqW2tleV0gPSBtaXhpbltrZXldOwogICAgfQogICAgcmV0dXJuIG9iajsKfTsKZXhwb3J0cy5pbXB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0YS5zdGFydC5yb3c7CiAgICB2YXIgc3RhcnRDb2x1bW4gPSBkZWx0YS5zdGFydC5jb2x1bW47CiAgICB2YXIgbGluZSA9IGRvY0xpbmVzW3Jvd10gfHwgIiI7CiAgICBzd2l0Y2ggKGRlbHRhLmFjdGlvbikgewogICAgICAgIGNhc2UgImluc2VydCI6CiAgICAgICAgICAgIHZhciBsaW5lcyA9IGRlbHRhLmxpbmVzOwogICAgICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3ddID0gbGluZS5zdWJzdHJpbmcoMCwgc3RhcnRDb2x1bW4pICsgZGVsdGEubGluZXNbMF0gKyBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgYXJncyA9IFtyb3csIDFdLmNvbmNhdChkZWx0YS5saW5lcyk7CiAgICAgICAgICAgICAgICBkb2NMaW5lcy5zcGxpY2UuYXBwbHkoZG9jTGluZXMsIGFyZ3MpOwogICAgICAgICAgICAgICAgZG9jTGluZXNbcm93XSA9IGxpbmUuc3Vic3RyaW5nKDAsIHN0YXJ0Q29sdW1uKSArIGRvY0xpbmVzW3Jvd107CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3cgKyBkZWx0YS5saW5lcy5sZW5ndGggLSAxXSArPSBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAicmVtb3ZlIjoKICAgICAgICAgICAgdmFyIGVuZENvbHVtbiA9IGRlbHRhLmVuZC5jb2x1bW47CiAgICAgICAgICAgIHZhciBlbmRSb3cgPSBkZWx0YS5lbmQucm93OwogICAgICAgICAgICBpZiAocm93ID09PSBlbmRSb3cpIHsKICAgICAgICAgICAgICAgIGRvY0xpbmVzW3Jvd10gPSBsaW5lLnN1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HRoaXMudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgcmV0dXJuICgiUmFuZ2U6IFsiICsgdGhpcy5zdGFydC5yb3cgKyAiLyIgKyB0aGlzLnN0YXJ0LmNvbHVtbiArCiAgICAgICAgICAgICJdIC0+IFsiICsgdGhpcy5lbmQucm93ICsgIi8iICsgdGhpcy5lbmQuY29sdW1uICsgIl0iKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMDsKICAgIH07CiAgICB0aGlzLmNvbXBhcmVSYW5nZSA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAsIGVuZCA9IHJhbmdlLmVuZCwgc3RhcnQgPSByYW5nZS5zdGFydDsKICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoZW5kLnJvdywgZW5kLmNvbHVtbik7CiAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiAoY21wID09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gLTEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlUG9pbnQgPSBmdW5jdGlvbiAocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbiAocmFuZ2UpIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlUG9pbnQocmFuZ2Uuc3RhcnQpID09IDAgJiYgdGhpcy5jb21wYXJlUG9pbnQocmFuZ2UuZW5kKSA9PSAwOwogICAgfTsKICAgIHRoaXMuaW50ZXJzZWN0cyA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmVSYW5nZShyYW5nZSk7CiAgICAgICAgcmV0dXJuIChjbXAgPT0gLTEgfHwgY21wID09IDAgfHwgY21wID09IDEpOwogICAgfTsKICAgIHRoaXMuaXNFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiB0aGlzLnN0YXJ0LnJvdyA9PSByb3cgJiYgdGhpcy5zdGFydC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuc2V0U3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IHJvdy5jb2x1bW47CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93LnJvdzsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5zZXRFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3cucm93OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSBjb2x1bW47CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuaW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc0VuZChyb3csIGNvbHVtbikgfHwgdGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlU3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuY29tcGFyZSA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICghdGhpcy5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgIGlmIChyb3cgPT09IHRoaXMuc3RhcnQucm93KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uIDwgdGhpcy5zdGFydC5jb2x1bW4gPyAtMSA6IChjb2x1bW4gPiB0aGlzLmVuZC5jb2x1bW4gPyAxIDogMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuc3RhcnQucm93KQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPj0gdGhpcy5zdGFydC5jb2x1bW4gPyAwIDogLTE7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uIDw9IHRoaXMuZW5kLmNvbHVtbiA/IDAgOiAxOwogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPT0gcm93ICYmIHRoaXMuZW5kLmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jbGlwUm93cyA9IGZ1bmN0aW9uIChmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLmVuZC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIGVuZCA9IHsgcm93OiBmaXJzdFJvdywgY29sdW1uOiAwIH07CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLnN0YXJ0LnJvdyA8IGZpcnN0Um93KQogICAgICAgICAgICB2YXIgc3RhcnQgPSB7IHJvdzogZmlyc3RSb3csIGNvbHVtbjogMCB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICB2YXIgY21wID0gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICBpZiAoY21wID09IDApCiAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKGNtcCA9PSAtMSkKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHZhciBlbmQgPSB7IHJvdzogc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IG1vdmVJZkVxdWFsKSkgewogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgcm93OiBwb2ludC5yb3csCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbiwgbm9DbGlwKSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBpZiAobm9DbGlwKSB7CiAgICAgICAgICAgIHBvcyA9IHsKICAgICAgICAgICAgICAgIHJvdzogcm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBjb2x1bW4KICAgICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvcyA9IHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQocm93LCBjb2x1bW4pOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5yb3cgPT0gcG9zLnJvdyAmJiB0aGlzLmNvbHVtbiA9PSBwb3MuY29sdW1uKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdmFyIG9sZCA9IHsKICAgICAgICAgICAgcm93OiB0aGlz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RleHQubWF0Y2goL14uKj8oXHJcbnxccnxcbikvbSk7CiAgICAgICAgdGhpcy4kYXV0b05ld0xpbmUgPSBtYXRjaCA/IG1hdGNoWzFdIDogIlxuIjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgIHN3aXRjaCAodGhpcy4kbmV3TGluZU1vZGUpIHsKICAgICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgICAgICByZXR1cm4gIlxyXG4iOwogICAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgICAgIHJldHVybiAiXG4iOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJGF1dG9OZXdMaW5lIHx8ICJcbiI7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbiAobmV3TGluZU1vZGUpIHsKICAgICAgICBpZiAodGhpcy4kbmV3TGluZU1vZGUgPT09IG5ld0xpbmVNb2RlKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZXdMaW5lTW9kZTsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lTW9kZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICByZXR1cm4gdGhpcy4kbmV3TGluZU1vZGU7CiAgICB9OwogICAgdGhpcy5pc05ld0xpbmUgPSBmdW5jdGlvbiAodGV4dCkgewogICAgICAgIHJldHVybiAodGV4dCA9PSAiXHJcbiIgfHwgdGV4dCA9PSAiXHIiIH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5lcyhwb3NpdGlvbiwgWycnLCAnJ10pIGluc3RlYWQuIik7CiAgICAgICAgcmV0dXJuIHRoaXMuaW5zZXJ0TWVyZ2VkTGluZXMocG9zaXRpb24sIFsiIiwgIiJdKTsKICAgIH07CiAgICB0aGlzLmluc2VydCA9IGZ1bmN0aW9uIChwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIGlmICh0aGlzLmdldExlbmd0aCgpIDw9IDEpCiAgICAgICAgICAgIHRoaXMuJGRldGVjdE5ld0xpbmUodGV4dCk7CiAgICAgICAgcmV0dXJuIHRoaXMuaW5zZXJ0TWVyZ2VkTGluZXMocG9zaXRpb24sIHRoaXMuJHNwbGl0KHRleHQpKTsKICAgIH07CiAgICB0aGlzLmluc2VydEluTGluZSA9IGZ1bmN0aW9uIChwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHRoaXMucG9zKHBvc2l0aW9uLnJvdywgcG9zaXRpb24uY29sdW1uICsgdGV4dC5sZW5ndGgpOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogImluc2VydCIsCiAgICAgICAgICAgIGxpbmVzOiBbdGV4dF0KICAgICAgICB9LCB0cnVlKTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMuY2xpcHBlZFBvcyA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHZhciBsZW5ndGggPSB0aGlzLmdldExlbmd0aCgpOwogICAgICAgIGlmIChyb3cgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcm93ID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24gKHBvcykgewogICAgICAgIHJldHVybiB7IHJvdzogcG9zLnJvdywgY29sdW1uOiBwb3MuY29sdW1uIH07CiAgICB9OwogICAgdGhpcy5wb3MgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLiRjbGlwUG9zaXRpb24gPSBmdW5jdGlvbiAocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbmd0aCAtIDEpLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvc2l0aW9uLnJvdyA9IE1hdGgubWF4KDAsIHBvc2l0aW9uLnJvdyk7CiAgICAgICAgICAgIHBvc2l0aW9uLmNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KHBvc2l0aW9uLmNvbHVtbiwgMCksIHRoaXMuZ2V0TGluZShwb3NpdGlvbi5yb3cpLmxlbmd0aCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3NpdGlvbjsKICAgIH07CiAgICB0aGlzLmluc2VydEZ1bGxMaW5lcyA9IGZ1bmN0aW9uIChyb3csIGxpbmVzKSB7CiAgICAgICAgcm93ID0gTWF0aC5taW4oTWF0aC5tYXgocm93LCAwKSwgdGhpcy5nZXRMZW5ndGgoKSk7CiAgICAgICAgdmFyIGNvbHVtbiA9IDA7CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgbGluZXMgPSBsaW5lcy5jb25jYXQoWyIiXSk7CiAgICAgICAgICAgIGNvbHVtbiA9IDA7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBsaW5lcyA9IFsiIl0uY29uY2F0KGxpbmVzKTsKICAgICAgICAgICAgcm93LS07CiAgICAgICAgICAgIGNvbHVtbiA9IHRoaXMuJGxpbmVzW3Jvd10ubGVuZ3RoOwogICAgICAgIH0KICAgICAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzKHsgcm93OiByb3csIGNvbHVtbjogY29sdW1uIH0sIGxpbmVzKTsKICAgIH07CiAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzID0gZnVuY3Rpb24gKHBvc2l0aW9uLCBsaW5lcykgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHsKICAgICAgICAgICAgcm93OiBzdGFydC5yb3cgKyBsaW5lcy5sZW5ndGggLSAxLAogICAgICAgICAgICBjb2x1bW46IChsaW5lcy5sZW5ndGggPT0gM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CiAgICAgICAgdmFyIHJvdyA9IGRlbHRhLnN0YXJ0LnJvdzsKICAgICAgICB2YXIgY29sdW1uID0gZGVsdGEuc3RhcnQuY29sdW1uOwogICAgICAgIGZvciAodmFyIGZyb20gPSAwLCB0byA9IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogICAgfTsKICAgIHRoaXMucmV2ZXJ0RGVsdGEgPSBmdW5jdGlvbiAoZGVsdGEpIHsKICAgICAgICB0aGlzLiRzYWZlQXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiB0aGlzLmNsb25lUG9zKGRlbHRhLnN0YXJ0KSwKICAgICAgICAgICAgZW5kOiB0aGlzLmNsb25lUG9zKGRlbHRhLmVuZCksCiAgICAgICAgICAgIGFjdGlvbjogKGRlbHRhLmFjdGlvbiA9PSAiaW5zZXJ0IiA/ICJyZW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9ydHMuc3RyaW5nVHJpbVJpZ2h0ID0gZnVuY3Rpb24gKHN0cmluZykgewogICAgcmV0dXJuIHN0cmluZy5yZXBsYWNlKHRyaW1FbmRSZWdleHAsICcnKTsKfTsKZXhwb3J0cy5jb3B5T2JqZWN0ID0gZnVuY3Rpb24gKG9iaikgewogICAgdmFyIGNvcHkgPSB7fTsKICAgIGZvciAodmFyIGtleSBpbiBvYmopIHsKICAgICAgICBjb3B5W2tleV0gPSBvYmpba2V5XTsKICAgIH0KICAgIHJldHVybiBjb3B5Owp9OwpleHBvcnRzLmNvcHlBcnJheSA9IGZ1bmN0aW9uIChhcnJheSkgewogICAgdmFyIGNvcHkgPSBbXTsKICAgIGZvciAodmFyIGkgPSAwLCBsID0gYXJyYXkubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgaWYgKGFycmF5W2ldICYmIHR5cGVvZiBhcnJheVtpXSA9PSAib2JqZWN0IikKICAgICAgICAgICAgY29weVtpXSA9IHRoaXMuY29weU9iamVjdChhcnJheVtpXSk7CiAgICAgICAgZWxzZQogICAgICAgICAgICBjb3B5W2ldID0gYXJyYXlbaV07CiAgICB9CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5kZWVwQ29weSA9IGZ1bmN0aW9uIGRlZXBDb3B5KG9iaikgewogICAgaWYgKHR5cGVvZiBvYmogIT09ICJvYmplY3QiIHx8ICFvYmopCiAgICAgICAgcmV0dXJuIG9iajsKICAgIHZhciBjb3B5OwogICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgewogICAgICAgIGNvcHkgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgPSAwOyBrZXkgPCBvYmoubGVuZ3RoOyBrZXkrKykgewogICAgICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjb3B5OwogICAgfQogICAgaWYgKE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChv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9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZiAoKGQuYWN0aW9uID09ICJpbnNlcnQiID8gZC5zdGFydCA6IGQuZW5kKS5yb3cgPj0gZG9jLiRsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBlcnIgPSBuZXcgRXJyb3IoIkludmFsaWQgZGVsdGEiKTsKICAgICAgICAgICAgICAgICAgICBlcnIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogX3NlbGYuJHBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzTGVuZ3RoOiBkb2MuJGxpbmVzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGQuc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogZC5lbmQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IGVycjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBkb2MuYXBwbHlEZWx0YShkLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoX3NlbGYuJHRpbWVvdXQpCiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZShfc2VsZi4kdGltZW91dCk7CiAgICAgICAgX3NlbGYub25VcGRhdGUoKTsKICAgIH0pOwp9OwoKKGZ1bmN0aW9uKCkgewogICAgCiAgICB0aGlzLiR0aW1lb3V0ID0gNTAwOwogICAgCiAgICB0aGlzLnNldFRpbWVvdXQgPSBmdW5jdGlvbih0aW1lb3V0KSB7CiAgICAgICAgdGhpcy4kdGltZW91dCA9IHRpbWVvdXQ7CiAgICB9OwogICAgCiAgICB0aGlzLnNldFZhbHVlID0gZnVuY3Rpb24odmFsdWUpIHsKICAgICAgICB0aGlzLmRvYy5zZXRWYWx1ZSh2YWx1ZSk7CiAgICAgICAgdGhpcy5kZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZSh0aGlzLiR0aW1lb3V0KTsKICAgIH07CiAgICAKICAgIHRoaXMuZ2V0VmFsdWUgPSBmdW5jdGlvbihjYWxsYmFja0lkKSB7CiAgICAgICAgdGhpcy5zZW5kZXIuY2FsbGJhY2sodGhpcy5kb2MuZ2V0VmFsdWUoKSwgY2FsbGJhY2tJZCk7CiAgICB9OwogICAgCiAgICB0aGlzLm9uVXBkYXRlID0gZnVuY3Rpb24oKSB7CiAgICB9OwogICAgCiAgICB0aGlzLmlzUGVuZGluZyA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLmRlZmVycmVkVXBkYXRlLmlzUGVuZGluZygpOwogICAgfTsKICAgIAp9KS5jYWxsKE1pcnJvci5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uL2pzb25fcGFyc2UiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKICAgIHZhciBhdCwgICAgIC8vIFRoZSBpbmRleCBvZiB0aGUgY3VycmVudCBjaGFyYWN0ZXIKICAgICAgICBjaCwgICAgIC8vIFRoZSBjdXJyZW50IGNoYXJhY3RlcgogICAgICAgIGVzY2FwZWUgPSB7CiAgICAgICAgICAgICciJzogICciJywKICAgICAgICAgICAgJ1xcJzogJ1xcJywKICAgICAgICAgICAgJy8nOiAgJy8nLAogICAgICAgICAgICBiOiAgICAnXGInLAogICAgICAgICAgICBmOiAgICAnXGYnLAogICAgICAgICAgICBuOiAgICAnXG4nLAogICAgICAgICAgICByOiAgICAnXHInLAogICAgICAgICAgICB0OiAgICAnXHQnCiAgICAgICAgfSwKICAgICAgICB0ZXh0LAoKICAgICAgICBlcnJvciA9IGZ1bmN0aW9uIChtKSB7CgogICAgICAgICAgICB0aHJvdyB7CiAgICAgICAgICAgICAgICBuYW1lOiAgICAnU3ludGF4RXJyb3InLAogICAgICAgICAgICAgICAgbWVzc2FnZTogbSwKICAgICAgICAgICAgICAgIGF0OiAgICAgIGF0LAogICAgICAgICAgICAgICAgdGV4dDogICAgdGV4dAogICAgICAgICAgICB9OwogICAgICAgIH0sCgogICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgewoKICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJFeHBlY3RlZCAnIiArIGMgKyAiJyBpbnN0ZWFkIG9mICciICsgY2ggKyAiJyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBjaCA9IHRleHQuY2hhckF0KGF0KTsKICAgICAgICAgICAgYXQgKz0gMTsKICAgICAgICAgICAgcmV0dXJuIGNoOwogICAgICAgIH0sCgogICAgICAgIG51bWJlciA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBudW1iZXIsCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJzsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJy0nKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnLSc7CiAgICAgICAgICAgICAgICBuZXh0KCctJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9ICcuJzsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkgJiYgY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBudW1iZXIgPSArc3RyaW5nOwogICAgICAgICAgICBpZiAoaXNOYU4obnVtYmVyKSkgewogICAgICAgICAgICAgICAgZXJyb3IoIkJhZCBudW1iZXIiKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiBudW1iZXI7CiAgICAgICAgICAgIH0KICAgICAgICB9LAoKICAgICAgICBzdHJpbmcgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB2YXIgaGV4LAogICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgIHN0cmluZyA9ICcnLAogICAgICAgICAgICAgICAgdWZmZmY7CgogICAgICAgICAgICBpZiAoY2ggPT09ICciJykgewogICAgICAgICAgICAgICAgd2hpbGUgKG5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJyInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0cmluZzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFwnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBwYXJzZUludChuZXh0KCksIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKGhleCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gdWZmZmYgKiAxNiArIGhleDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHVmZmZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZXNjYXBlZVtjaF0gPT09ICdzdHJpbmcnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gZXNjYXBlZVtjaF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gIlxuIiB8fCBjaCA9PSAiXHIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBzdHJpbmciKTsKICAgICAgICB9LAoKICAgICAgICB3aGl0ZSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHdoaWxlIChjaCAmJiBjaCA8PSAnICcpIHsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgIH0sCgogICAgICAgIHdvcmQgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICBzd2l0Y2ggKGNoKSB7CiAgICAgICAgICAgIGNhc2UgJ3QnOgogICAgICAgICAgICAgICAgbmV4dCgndCcpOwogICAgICAgICAgICAgICAgbmV4dCgncicpOwogICAgICAgICAgICAgICAgbmV4dCgndScpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIGNhc2UgJ2YnOgogICAgICAgICAgICAgICAgbmV4dCgnZicpOwogICAgICAgICAgICAgICAgbmV4dCgnYScpOwogICAgICAgICAgICAgICAgbmV4dCgnbCcpOwogICAgICAgICAgICAgICAgbmV4dCgncycpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICBjYXNlICduJzoKICAgICAgICAgICAgICAgIG5leHQoJ24nKTsKICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJVbmV4cGVjdGVkICciICsgY2ggKyAiJyIpOwogICAgICAgIH0sCgogICAgICAgIHZhbHVlLCAgLy8gUGxhY2UgaG9sZGVyIGZvciB0aGUgdmFsdWUgZnVuY3Rpb24uCgogICAgICAgIGFycmF5ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGFycmF5ID0gW107CgogICAgICAgICAgICBpZiAoY2ggPT09ICdbJykgewogICAgICAgICAgICAgICAgbmV4dCgnWycpOwogICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnXScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheTsgICAvLyBlbXB0eSBhcnJheQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyYXkucHVzaCh2YWx1ZSgpKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuZXh0KCcsJyk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvcigiQmFkIGFycmF5Iik7CiAgICAgICAgfSwKCiAgICAgICAgb2JqZWN0ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGtleSwKICAgICAgICAgICAgICAgIG9iamVjdCA9IHt9OwoKICAgICAgICAgICAgaWYgKGNoID09PSAneycpIHsKICAgICAgICAgICAgICAgIG5leHQoJ3snKTsKICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd9JykgewogICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OyAgIC8vIGVtcHR5IG9iamVjdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAga2V5ID0gc3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBuZXh0KCc6Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkgewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcignRHVwbGljYXRlIGtleSAiJyArIGtleSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG9iamVjdFtrZXldID0gdmFsdWUoKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ30nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBvYmplY3QiKTsKICAgICAgICB9OwoKICAgIHZhbHVlID0gZnVuY3Rpb24gKCkgewoKICAgICAgICB3aGl0ZSgpOwogICAgICAgIHN3aXRjaCAoY2gpIHsKICAgICAgICBjYXNlICd7JzoKICAgICAgICAgICAgcmV0dXJuIG9iamVjdCgpOwogICAgICAgIGNhc2UgJ1snOgogICAgICAgICAgICByZXR1cm4gYXJyYXkoKTsKICAgICAgICBjYXNlICciJzoKICAgICAgICAgICAgcmV0dXJuIHN0cmluZygpOwogICAgICAgIGNhc2UgJy0nOgogICAgICAgICAgICByZXR1cm4gbnVtYmVyKCk7CiAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGNoID49ICcwJyAmJiBjaCA8PSAnOScgPyBudW1iZXIoKSA6IHdvcmQoKTsKICAgICAgICB9CiAgICB9OwoKICAgIHJldHVybiBmdW5jdGlvbiAoc291cmNlLCByZXZpdmVyKSB7CiAgICAgICAgdmFyIHJlc3VsdDsKCiAgICAgICAgdGV4dCA9IHNvdXJjZTsKICAgICAgICBhdCA9IDA7CiAgICAgICAgY2ggPSAnICc7CiAgICAgICAgcmVzdWx0ID0gdmFsdWUoKTsKICAgICAgICB3aGl0ZSgpOwogICAgICAgIGlmIChjaCkgewogICAgICAgICAgICBlcnJvcigiU3ludGF4IGVycm9yIik7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHlwZW9mIHJldml2ZXIgPT09ICdmdW5jdGlvbicgPyBmdW5jdGlvbiB3YWxrKGhvbGRlciwga2V5KSB7CiAgICAgICAgICAgIHZhciBrLCB2LCB2YWx1ZSA9IGhvbGRlcltrZXldOwogICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JykgewogICAgICAgICAgICAgICAgZm9yIChrIGluIHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gd2Fsayh2YWx1ZSwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ICE9PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB2YWx1ZVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmV2aXZlci5jYWxsKGhvbGRlciwga2V5LCB2YWx1ZSk7CiAgICAgICAgfSh7Jyc6IHJlc3VsdH0sICcnKSA6IHJlc3VsdDsKICAgIH07Cn0pOwoKYWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl93b3JrZXIiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKdmFyIG9vcCA9IHJlcXVpcmUoIi4uL2xpYi9vb3AiKTsKdmFyIE1pcnJvciA9IHJlcXVpcmUoIi4uL3dvcmtlci9taXJyb3IiKS5NaXJyb3I7CnZhciBwYXJzZSA9IHJlcXVpcmUoIi4vanNvbi9qc29uX3BhcnNlIik7Cgp2YXIgSnNvbldvcmtlciA9IGV4cG9ydHMuSnNvbldvcmtlciA9IGZ1bmN0aW9uKHNlbmRlcikgewogICAgTWlycm9yLmNhbGwodGhpcywgc2VuZGVyKTsKICAgIHRoaXMuc2V0VGltZW91dCgyMDApOwp9OwoKb29wLmluaGVyaXRzKEpzb25Xb3JrZXIsIE1pcnJvcik7CgooZnVuY3Rpb24oKSB7CgogICAgdGhpcy5vblVwZGF0ZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIHZhciB2YWx1ZSA9IHRoaXMuZG9jLmdldFZhbHVlKCk7CiAgICAgICAgdmFyIGVycm9ycyA9IFtdOwogICAgICAgIHRyeSB7CiAgICAgICAgICAgIGlmICh2YWx1ZSkKICAgICAgICAgICAgICAgIHBhcnNlKHZhbHVlKTsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIHZhciBwb3MgPSB0aGlzLmRvYy5pbmRleFRvUG9zaXRpb24oZS5hdC0xKTsKICAgICAgICAgICAgZXJyb3JzLnB1c2goewogICAgICAgICAgICAgICAgcm93OiBwb3Mucm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBwb3MuY29sdW1uLAogICAgICAgICAgICAgICAgdGV4dDogZS5tZXNzYWdlLAogICAgICAgICAgICAgICAgdHlwZTogImVycm9yIgogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgdGhpcy5zZW5kZXIuZW1pdCgiYW5ub3RhdGUiLCBlcnJvcnMpOwogICAgfTsKCn0pLmNhbGwoSnNvbldvcmtlci5wcm90b3R5cGUpOwoKfSk7Cg==";ace.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl);const _sfc_main$w=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue","close"],setup(r,{emit:n}){const i=r,o=vue.ref(!1),a=vue.computed({get(){return i.lang==="json"?JSON.stringify(i.modelValue,null,2):i.modelValue},set(u){i.lang==="json"?n("update:modelValue",JSON.parse(u)):n("update:modelValue",u)}});return(u,c)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:c[0]||(c[0]=f=>o.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(o),"onUpdate:modelValue":c[2]||(c[2]=f=>vue.isRef(o)?o.value=f:null),title:i.title,width:"60%",onClose:c[3]||(c[3]=f=>n("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(a),"onUpdate:value":c[1]||(c[1]=f=>vue.isRef(a)?a.value=f:null),lang:i.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$b={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$8={key:1},_hoisted_3$7={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$3={key:1},_sfc_main$v=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},emits:["change"],setup(r,{emit:n}){const i=r;function o(a){let u=window.setTimeout(function(){n("change",a),clearTimeout(u),u=null},200)}return(a,u)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.objInfo,(c,f)=>(vue.openBlock(),vue.createElementBlock("div",{key:f},[i.code?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f))>78?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:String(f),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$b,vue.toDisplayString(f),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$8,vue.toDisplayString(f),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(c.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:JSON.stringify(c.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$7,vue.toDisplayString(c.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString(c.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),i.hide.indexOf(String(f))<0?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:c.title,size:"small"},{default:vue.withCtx(()=>[c.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSelect),{key:0,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,placeholder:"Select",size:"small",disabled:!!(c!=null&&c.disabled),onChange:o},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(c.options,d=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInputNumber),{key:1,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:2,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:3,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,autosize:"",type:"textarea",disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElColorPicker),{key:4,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSwitch),{key:5,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$w,{key:6,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onClose:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_df8be28f_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc$1(_sfc_main$v,[["__scopeId","data-v-df8be28f"]]),_hoisted_1$a={style:{height:"100%"}},_hoisted_2$7={class:"flex flex-wrap"},_hoisted_3$6=["onMouseenter","onClick"],_sfc_main$u=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(r,{emit:n}){const i=r,o=vue.ref(i.val),a=vue.ref(!1),u=vue.ref("进入"),c=vue.ref(null),f=d=>{n("updateCommonAniVal",d),a.value=!1};return vue.watch(()=>i.val,d=>{o.value=d}),(d,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$a,[vue.unref(o)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:0,closable:"",onClose:p[0]||(p[0]=h=>f("")),onClick:p[1]||(p[1]=h=>a.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var h;return[vue.createTextVNode(vue.toDisplayString((h=vue.unref(common_animate_list).map(g=>g.children).reduce((g,v)=>g.concat(v)).find(g=>g.value==vue.unref(o)))==null?void 0:h.label)+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:p[2]||(p[2]=h=>a.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(elementPlus.ElDrawer),{modelValue:vue.unref(a),"onUpdate:modelValue":p[5]||(p[5]=h=>vue.isRef(a)?a.value=h:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabs),{modelValue:vue.unref(u),"onUpdate:modelValue":p[4]||(p[4]=h=>vue.isRef(u)?u.value=h:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),h=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabPane),{label:h.label,name:h.label,key:h.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$7,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(h.children,(g,v)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:v,onMouseenter:y=>c.value=v,onMouseleave:p[3]||(p[3]=y=>c.value=null),onClick:y=>f(g.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref(c)==v?`animate__animated animate__${g.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(g.label),3)],40,_hoisted_3$6))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2668f60c_lang="",CommonAnimate=_export_sfc$1(_sfc_main$u,[["__scopeId","data-v-2668f60c"]]),_sfc_main$t=vue.defineComponent({__name:"component-tree",setup(r){const n=useGlobalStore(pinia),i=vue.computed(()=>{var u;return((u=n.handle_svg_info)==null?void 0:u.info.id)??""}),o=u=>{for(let c of n.done_json)c.selected=!1,c.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(u)},a={children:"children",label:"title"};return(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTree),{class:"tree-v",data:vue.unref(n).done_json,props:a,onNodeClick:o,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!!vue.unref(i),"node-key":"id","current-node-key":vue.unref(i)},null,8,["data","highlight-current","current-node-key"]))}}),_withScopeId$1=r=>(vue.pushScopeId("data-v-98320511"),r=r(),vue.popScopeId(),r),_hoisted_1$9={class:"wall-l"},_hoisted_2$6={class:"head-l"},_hoisted_3$5=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$s=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(r,{emit:n}){const i=r,o=vue.computed({get(){return i.modelValue},set(c){n("update:modelValue",c)}}),a=()=>{o.value.push({key:"",val:""})},u=c=>{o.value.splice(c,1)};return(c,f)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[vue.createElementVNode("div",_hoisted_2$6,[_hoisted_3$5,_hoisted_4$2,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:a},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),(d,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:d.key,"onUpdate:modelValue":h=>d.key=h,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:d.val,"onUpdate:modelValue":h=>d.val=h,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:h=>u(p)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_98320511_lang="",List=_export_sfc$1(_sfc_main$s,[["__scopeId","data-v-98320511"]]),composeEventHandlers=(r,n,{checkForDefaultPrevented:i=!0}={})=>a=>{const u=r==null?void 0:r(a);if(i===!1||!u)return n==null?void 0:n(a)};var _a;const isClient=typeof window<"u",isString$1=r=>typeof r=="string",noop=()=>{},isIOS=isClient&&((_a=window==null?void 0:window.navigator)==null?void 0:_a.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function resolveUnref(r){return typeof r=="function"?r():vue.unref(r)}function createFilterWrapper(r,n){function i(...o){return new Promise((a,u)=>{Promise.resolve(r(()=>n.apply(this,o),{fn:n,thisArg:this,args:o})).then(a).catch(u)})}return i}function debounceFilter(r,n={}){let i,o,a=noop;const u=f=>{clearTimeout(f),a(),a=noop};return f=>{const d=resolveUnref(r),p=resolveUnref(n.maxWait);return i&&u(i),d<=0||p!==void 0&&p<=0?(o&&(u(o),o=null),Promise.resolve(f())):new Promise((h,g)=>{a=n.rejectOnCancel?g:h,p&&!o&&(o=setTimeout(()=>{i&&u(i),o=null,h(f())},p)),i=setTimeout(()=>{o&&u(o),o=null,h(f())},d)})}}function identity(r){return r}function tryOnScopeDispose(r){return vue.getCurrentScope()?(vue.onScopeDispose(r),!0):!1}function useDebounceFn(r,n=200,i={}){return createFilterWrapper(debounceFilter(n,i),r)}function refDebounced(r,n=200,i={}){const o=vue.ref(r.value),a=useDebounceFn(()=>{o.value=r.value},n,i);return vue.watch(r,()=>a()),o}function tryOnMounted(r,n=!0){vue.getCurrentInstance()?vue.onMounted(r):n?r():vue.nextTick(r)}function unrefElement(r){var n;const i=resolveUnref(r);return(n=i==null?void 0:i.$el)!=null?n:i}const defaultWindow=isClient?window:void 0;function useEventListener(...r){let n,i,o,a;if(isString$1(r[0])||Array.isArray(r[0])?([i,o,a]=r,n=defaultWindow):[n,i,o,a]=r,!n)return noop;Array.isArray(i)||(i=[i]),Array.isArray(o)||(o=[o]);const u=[],c=()=>{u.forEach(h=>h()),u.length=0},f=(h,g,v,y)=>(h.addEventListener(g,v,y),()=>h.removeEventListener(g,v,y)),d=vue.watch(()=>[unrefElement(n),resolveUnref(a)],([h,g])=>{c(),h&&u.push(...i.flatMap(v=>o.map(y=>f(h,v,y,g))))},{immediate:!0,flush:"post"}),p=()=>{d(),c()};return tryOnScopeDispose(p),p}let _iOSWorkaround=!1;function onClickOutside(r,n,i={}){const{window:o=defaultWindow,ignore:a=[],capture:u=!0,detectIframe:c=!1}=i;if(!o)return;isIOS&&!_iOSWorkaround&&(_iOSWorkaround=!0,Array.from(o.document.body.children).forEach(v=>v.addEventListener("click",noop)));let f=!0;const d=v=>a.some(y=>{if(typeof y=="string")return Array.from(o.document.querySelectorAll(y)).some(A=>A===v.target||v.composedPath().includes(A));{const A=unrefElement(y);return A&&(v.target===A||v.composedPath().includes(A))}}),h=[useEventListener(o,"click",v=>{const y=unrefElement(r);if(!(!y||y===v.target||v.composedPath().includes(y))){if(v.detail===0&&(f=!d(v)),!f){f=!0;return}n(v)}},{passive:!0,capture:u}),useEventListener(o,"pointerdown",v=>{const y=unrefElement(r);y&&(f=!v.composedPath().includes(y)&&!d(v))},{passive:!0}),c&&useEventListener(o,"blur",v=>{var y;const A=unrefElement(r);((y=o.document.activeElement)==null?void 0:y.tagName)==="IFRAME"&&!(A!=null&&A.contains(o.document.activeElement))&&n(v)})].filter(Boolean);return()=>h.forEach(v=>v())}function useSupported(r,n=!1){const i=vue.ref(),o=()=>i.value=!!r();return o(),tryOnMounted(o,n),i}const _global=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},globalKey="__vueuse_ssr_handlers__";_global[globalKey]=_global[globalKey]||{};var __getOwnPropSymbols$g=Object.getOwnPropertySymbols,__hasOwnProp$g=Object.prototype.hasOwnProperty,__propIsEnum$g=Object.prototype.propertyIsEnumerable,__objRest$2=(r,n)=>{var i={};for(var o in r)__hasOwnProp$g.call(r,o)&&n.indexOf(o)<0&&(i[o]=r[o]);if(r!=null&&__getOwnPropSymbols$g)for(var o of __getOwnPropSymbols$g(r))n.indexOf(o)<0&&__propIsEnum$g.call(r,o)&&(i[o]=r[o]);return i};function useResizeObserver(r,n,i={}){const o=i,{window:a=defaultWindow}=o,u=__objRest$2(o,["window"]);let c;const f=useSupported(()=>a&&"ResizeObserver"in a),d=()=>{c&&(c.disconnect(),c=void 0)},p=vue.watch(()=>unrefElement(r),g=>{d(),f.value&&a&&g&&(c=new ResizeObserver(n),c.observe(g,u))},{immediate:!0,flush:"post"}),h=()=>{d(),p()};return tryOnScopeDispose(h),{isSupported:f,stop:h}}var SwipeDirection;(function(r){r.UP="UP",r.RIGHT="RIGHT",r.DOWN="DOWN",r.LEFT="LEFT",r.NONE="NONE"})(SwipeDirection||(SwipeDirection={}));var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,n,i)=>n in r?__defProp(r,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[n]=i,__spreadValues=(r,n)=>{for(var i in n||(n={}))__hasOwnProp.call(n,i)&&__defNormalProp(r,i,n[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(n))__propIsEnum.call(n,i)&&__defNormalProp(r,i,n[i]);return r};const _TransitionPresets={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};__spreadValues({linear:identity},_TransitionPresets);const isFirefox=()=>isClient&&/firefox/i.test(window.navigator.userAgent);process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const NOOP=()=>{},hasOwnProperty=Object.prototype.hasOwnProperty,hasOwn=(r,n)=>hasOwnProperty.call(r,n),isArray=Array.isArray,isFunction=r=>typeof r=="function",isString=r=>typeof r=="string",isObject=r=>r!==null&&typeof r=="object",objectToString=Object.prototype.toString,toTypeString=r=>objectToString.call(r),toRawType=r=>toTypeString(r).slice(8,-1),isUndefined=r=>r===void 0,isBoolean=r=>typeof r=="boolean",isNumber=r=>typeof r=="number",isElement=r=>typeof Element>"u"?!1:r instanceof Element,isStringNumber=r=>isString(r)?!Number.isNaN(Number(r)):!1,escapeStringRegexp=(r="")=>r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),getProp=(r,n,i)=>({get value(){return lodashEs.get(r,n,i)},set value(o){lodashEs.set(r,n,o)}});class ElementPlusError extends Error{constructor(n){super(n),this.name="ElementPlusError"}}function throwError(r,n){throw new ElementPlusError(`[${r}] ${n}`)}function debugWarn(r,n){if(process.env.NODE_ENV!=="production"){const i=isString(r)?new ElementPlusError(`[${r}] ${n}`):r;console.warn(i)}}const SCOPE$1="utils/dom/style";function addUnit(r,n="px"){if(!r)return"";if(isNumber(r)||isStringNumber(r))return`${r}${n}`;if(isString(r))return r;debugWarn(SCOPE$1,"binding value must be a string or number")}function scrollIntoView(r,n){if(!isClient)return;if(!n){r.scrollTop=0;return}const i=[];let o=n.offsetParent;for(;o!==null&&r!==o&&r.contains(o);)i.push(o),o=o.offsetParent;const a=n.offsetTop+i.reduce((d,p)=>d+p.offsetTop,0),u=a+n.offsetHeight,c=r.scrollTop,f=c+r.clientHeight;a<c?r.scrollTop=a:u>f&&(r.scrollTop=u-r.clientHeight)}const epPropKey="__epPropKey",definePropType=r=>r,isEpProp=r=>isObject(r)&&!!r[epPropKey],buildProp=(r,n)=>{if(!isObject(r)||isEpProp(r))return r;const{values:i,required:o,default:a,type:u,validator:c}=r,d={type:u,required:!!o,validator:i||c?p=>{let h=!1,g=[];if(i&&(g=Array.from(i),hasOwn(r,"default")&&g.push(a),h||(h=g.includes(p))),c&&(h||(h=c(p))),!h&&g.length>0){const v=[...new Set(g)].map(y=>JSON.stringify(y)).join(", ");vue.warn(`Invalid prop: validation failed${n?` for prop "${n}"`:""}. Expected one of [${v}], got value ${JSON.stringify(p)}.`)}return h}:void 0,[epPropKey]:!0};return hasOwn(r,"default")&&(d.default=a),d},buildProps=r=>lodashEs.fromPairs(Object.entries(r).map(([n,i])=>[n,buildProp(i,n)])),iconPropType=definePropType([String,Object,Function]),ValidateComponentsMap={validating:loading_default,success:circle_check_default,error:circle_close_default},withInstall=(r,n)=>{if(r.install=i=>{for(const o of[r,...Object.values(n??{})])i.component(o.name,o)},n)for(const[i,o]of Object.entries(n))r[i]=o;return r},withNoopInstall=r=>(r.install=NOOP,r),EVENT_CODE={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},UPDATE_MODEL_EVENT="update:modelValue",CHANGE_EVENT="change",componentSizes=["","default","small","large"],componentSizeMap={large:40,default:32,small:24},getComponentSize=r=>componentSizeMap[r||"default"],isValidComponentSize=r=>["",...componentSizes].includes(r),isKorean=r=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(r),mutable=r=>r,DEFAULT_EXCLUDE_KEYS=["class","style"],LISTENER_PREFIX=/^on[A-Z]/,useAttrs=(r={})=>{const{excludeListeners:n=!1,excludeKeys:i}=r,o=vue.computed(()=>((i==null?void 0:i.value)||[]).concat(DEFAULT_EXCLUDE_KEYS)),a=vue.getCurrentInstance();return a?vue.computed(()=>{var u;return lodashEs.fromPairs(Object.entries((u=a.proxy)==null?void 0:u.$attrs).filter(([c])=>!o.value.includes(c)&&!(n&&LISTENER_PREFIX.test(c))))}):(debugWarn("use-attrs","getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"),vue.computed(()=>({})))},useDeprecated=({from:r,replacement:n,scope:i,version:o,ref:a,type:u="API"},c)=>{vue.watch(()=>vue.unref(c),f=>{f&&debugWarn(i,`[${u}] ${r} is about to be deprecated in version ${o}, please use ${n} instead.
251
+ `||p==="")){var h=c.isSelected(p);o.hasOwnProperty(p)?o[p]=o[p]&&h:o[p]=h}})}),r==="allSelect"||r==="inverseSelect"?{selected:o}:{name:n.name,selected:o}}function installLegendAction(r){r.registerAction("legendToggleSelect","legendselectchanged",curry$1(legendSelectActionHandler,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",curry$1(legendSelectActionHandler,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",curry$1(legendSelectActionHandler,"inverseSelect")),r.registerAction("legendSelect","legendselected",curry$1(legendSelectActionHandler,"select")),r.registerAction("legendUnSelect","legendunselected",curry$1(legendSelectActionHandler,"unSelect"))}function install$2(r){r.registerComponentModel(LegendModel$1),r.registerComponentView(LegendView$1),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,legendFilter),r.registerSubTypeDefaulter("legend",function(){return"plain"}),installLegendAction(r)}var ScrollableLegendModel=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i}return n.prototype.setScrollDataIndex=function(i){this.option.scrollDataIndex=i},n.prototype.init=function(i,o,a){var u=getLayoutParams(i);r.prototype.init.call(this,i,o,a),mergeAndNormalizeLayoutParams(this,i,u)},n.prototype.mergeOption=function(i,o){r.prototype.mergeOption.call(this,i,o),mergeAndNormalizeLayoutParams(this,this.option,i)},n.type="legend.scroll",n.defaultOption=inheritDefaultOption(LegendModel$1.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),n}(LegendModel$1);function mergeAndNormalizeLayoutParams(r,n,i){var o=r.getOrient(),a=[1,1];a[o.index]=0,mergeLayoutParam(n,i,{type:"box",ignoreSize:!!a})}const ScrollableLegendModel$1=ScrollableLegendModel;var Group=Group$3,WH=["width","height"],XY=["x","y"],ScrollableLegendView=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.newlineDisabled=!0,i._currentIndex=0,i}return n.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new Group),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Group)},n.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},n.prototype.renderInner=function(i,o,a,u,c,f,d){var p=this;r.prototype.renderInner.call(this,i,o,a,u,c,f,d);var h=this._controllerGroup,g=o.get("pageIconSize",!0),v=isArray$1(g)?g:[g,g];A("pagePrev",0);var y=o.getModel("pageTextStyle");h.add(new ZRText$1({name:"pageText",style:{text:"xx/xx",fill:y.getTextColor(),font:y.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),A("pageNext",1);function A(_,S){var b=_+"DataIndex",T=createIcon(o.get("pageIcons",!0)[o.getOrient().name][S],{onclick:bind$1(p._pageGo,p,b,o,u)},{x:-v[0]/2,y:-v[1]/2,width:v[0],height:v[1]});T.name=_,h.add(T)}},n.prototype.layoutInner=function(i,o,a,u,c,f){var d=this.getSelectorGroup(),p=i.getOrient().index,h=WH[p],g=XY[p],v=WH[1-p],y=XY[1-p];c&&box("horizontal",d,i.get("selectorItemGap",!0));var A=i.get("selectorButtonGap",!0),_=d.getBoundingRect(),S=[-_.x,-_.y],b=clone$2(a);c&&(b[h]=a[h]-_[h]-A);var T=this._layoutContentAndController(i,u,b,p,h,v,y,g);if(c){if(f==="end")S[p]+=T[h]+A;else{var w=_[h]+A;S[p]-=w,T[g]-=w}T[h]+=_[h]+A,S[1-p]+=T[y]+T[v]/2-_[v]/2,T[v]=Math.max(T[v],_[v]),T[y]=Math.min(T[y],_[y]+S[1-p]),d.x=S[0],d.y=S[1],d.markRedraw()}return T},n.prototype._layoutContentAndController=function(i,o,a,u,c,f,d,p){var h=this.getContentGroup(),g=this._containerGroup,v=this._controllerGroup;box(i.get("orient"),h,i.get("itemGap"),u?a.width:null,u?null:a.height),box("horizontal",v,i.get("pageButtonItemGap",!0));var y=h.getBoundingRect(),A=v.getBoundingRect(),_=this._showController=y[c]>a[c],S=[-y.x,-y.y];o||(S[u]=h[p]);var b=[0,0],T=[-A.x,-A.y],w=retrieve2(i.get("pageButtonGap",!0),i.get("itemGap",!0));if(_){var x=i.get("pageButtonPosition",!0);x==="end"?T[u]+=a[c]-A[c]:b[u]+=A[c]+w}T[1-u]+=y[f]/2-A[f]/2,h.setPosition(S),g.setPosition(b),v.setPosition(T);var k={x:0,y:0};if(k[c]=_?a[c]:y[c],k[f]=Math.max(y[f],A[f]),k[d]=Math.min(0,A[d]+T[1-u]),g.__rectSize=a[c],_){var M={x:0,y:0};M[c]=Math.max(a[c]-A[c]-w,0),M[f]=k[f],g.setClipPath(new Rect$1({shape:M})),g.__rectSize=M[c]}else v.eachChild(function(z){z.attr({invisible:!0,silent:!0})});var D=this._getPageInfo(i);return D.pageIndex!=null&&updateProps$1(h,{x:D.contentPosition[0],y:D.contentPosition[1]},_?i:null),this._updatePageInfoView(i,D),k},n.prototype._pageGo=function(i,o,a){var u=this._getPageInfo(o)[i];u!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:u,legendId:o.id})},n.prototype._updatePageInfoView=function(i,o){var a=this._controllerGroup;each$4(["pagePrev","pageNext"],function(h){var g=h+"DataIndex",v=o[g]!=null,y=a.childOfName(h);y&&(y.setStyle("fill",v?i.get("pageIconColor",!0):i.get("pageIconInactiveColor",!0)),y.cursor=v?"pointer":"default")});var u=a.childOfName("pageText"),c=i.get("pageFormatter"),f=o.pageIndex,d=f!=null?f+1:0,p=o.pageCount;u&&c&&u.setStyle("text",isString$2(c)?c.replace("{current}",d==null?"":d+"").replace("{total}",p==null?"":p+""):c({current:d,total:p}))},n.prototype._getPageInfo=function(i){var o=i.get("scrollDataIndex",!0),a=this.getContentGroup(),u=this._containerGroup.__rectSize,c=i.getOrient().index,f=WH[c],d=XY[c],p=this._findTargetItemIndex(o),h=a.children(),g=h[p],v=h.length,y=v?1:0,A={contentPosition:[a.x,a.y],pageCount:y,pageIndex:y-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!g)return A;var _=x(g);A.contentPosition[c]=-_.s;for(var S=p+1,b=_,T=_,w=null;S<=v;++S)w=x(h[S]),(!w&&T.e>b.s+u||w&&!k(w,b.s))&&(T.i>b.i?b=T:b=w,b&&(A.pageNextDataIndex==null&&(A.pageNextDataIndex=b.i),++A.pageCount)),T=w;for(var S=p-1,b=_,T=_,w=null;S>=-1;--S)w=x(h[S]),(!w||!k(T,w.s))&&b.i<T.i&&(T=b,A.pagePrevDataIndex==null&&(A.pagePrevDataIndex=b.i),++A.pageCount,++A.pageIndex),b=w;return A;function x(M){if(M){var D=M.getBoundingRect(),z=D[d]+M[d];return{s:z,e:z+D[f],i:M.__legendDataIndex}}}function k(M,D){return M.e>=D&&M.s<=D+u}},n.prototype._findTargetItemIndex=function(i){if(!this._showController)return 0;var o,a=this.getContentGroup(),u;return a.eachChild(function(c,f){var d=c.__legendDataIndex;u==null&&d!=null&&(u=f),d===i&&(o=f)}),o??u},n.type="legend.scroll",n}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(r){r.registerAction("legendScroll","legendscroll",function(n,i){var o=n.scrollDataIndex;o!=null&&i.eachComponent({mainType:"legend",subType:"scroll",query:n},function(a){a.setScrollDataIndex(o)})})}function install$1(r){use(install$2),r.registerComponentModel(ScrollableLegendModel$1),r.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(r)}function install(r){use(install$2),use(install$1)}const _sfc_main$G=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(r){const n=r;use([install$7,install$6,install$3,install$4,install]),vue.provide(VChart.THEME_KEY,"dark");const i=vue.reactive({title:{text:n.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:n.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:n.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(n,o=>{i.title.text=o.title,i.series[0].name=o.seriesName,i.series[0].data=o.seriesData}),(o,a)=>(vue.openBlock(),vue.createBlock(vue.unref(VChart),{class:"chart",option:vue.unref(i),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_fec2cbf2_lang="",PieCharts=_export_sfc$1(_sfc_main$G,[["__scopeId","data-v-fec2cbf2"]]),_hoisted_1$k=["id"],_hoisted_2$h=["id"],_hoisted_3$e=["fill"],_hoisted_4$a=["fill"],_hoisted_5$8=["fill"],_hoisted_6$6=vue.createElementVNode("path",{d:"M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z",fill:"#2D4375"},null,-1),_hoisted_7$6=vue.createElementVNode("path",{d:"M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z",fill:"#1E2D4F"},null,-1),_hoisted_8$6=["fill-opacity"],_hoisted_9$6=["fill-opacity"],_hoisted_10$5=["fill-opacity"],_hoisted_11$4=vue.createElementVNode("path",{d:"M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z",fill:"#CEEFF6"},null,-1),_hoisted_12$4=vue.createElementVNode("path",{d:"M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z",fill:"#FFFFFF"},null,-1),_hoisted_13$3=vue.createElementVNode("path",{d:"M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z",fill:"#CEEFF6"},null,-1),_hoisted_14$3=["xlink:href"],_sfc_main$F=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1}},emits:["onChange"],setup(r,{emit:n}){const i=r;return vue.watch(()=>i.isOpen,()=>{n("onChange")}),(o,a)=>(vue.openBlock(),vue.createElementBlock("g",{id:i.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${i.id}light-121`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z",fill:i.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$e),vue.createElementVNode("path",{d:"M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z",fill:i.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$a),vue.createElementVNode("path",{d:"M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z",fill:i.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$6,_hoisted_7$6,vue.createElementVNode("path",{d:"M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z",fill:"#FDB813","fill-opacity":i.isOpen?1:0},null,8,_hoisted_8$6),vue.createElementVNode("path",{d:"M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z",fill:"#FDB813","fill-opacity":i.isOpen?1:0},null,8,_hoisted_9$6),vue.createElementVNode("path",{d:"M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z",fill:"#FDB813","fill-opacity":i.isOpen?1:0},null,8,_hoisted_10$5),_hoisted_11$4,_hoisted_12$4,_hoisted_13$3],8,_hoisted_2$h),vue.createElementVNode("use",{"xlink:href":`#${i.id}light-121`,width:"100",height:"100"},null,8,_hoisted_14$3)],8,_hoisted_1$k))}}),_hoisted_1$j=["id"],_hoisted_2$g=["id"],_hoisted_3$d=["fill"],_hoisted_4$9=["fill"],_hoisted_5$7=["fill"],_hoisted_6$5=["from","to"],_hoisted_7$5=["fill"],_hoisted_8$5=["from","to"],_hoisted_9$5=["fill"],_hoisted_10$4=["fill"],_hoisted_11$3=["fill"],_hoisted_12$3=["from","to"],_hoisted_13$2=["fill"],_hoisted_14$2=["xlink:href"],_sfc_main$E=vue.defineComponent({__name:"clock-a",props:{id:{default:""},centerColor:{default:"#EBF257"},secondsColor:{default:"#E83E24"},circleColor:{default:"#F45AFC"},minutesColor:{default:"#50E68E"},hoursColor:{default:"#9A36E7"},scaleColor:{default:"#4942CF"},backgroundColor:{default:"#ffffff"},borderColor:{default:"#B3A7FF"}},setup(r){const n=r,i=new Date(Number(window.sessionStorage.getItem("editorLoadTime")||"0")),o=i.getSeconds()+1,a=i.getMinutes(),u=Math.floor((i.getHours()+(a+o/60)/60)*30);return(c,f)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id},[vue.createElementVNode("symbol",{id:`${n.id}clock-a-n`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z",fill:n.borderColor},null,8,_hoisted_3$d),vue.createElementVNode("path",{d:"M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z",fill:n.backgroundColor},null,8,_hoisted_4$9),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z",fill:n.minutesColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${45+vue.unref(a)*6} 512.3 506.3`,to:`${405+vue.unref(a)*6} 512.3 506.3`,dur:"3600s",repeatCount:"indefinite"},null,8,_hoisted_6$5)],8,_hoisted_5$7),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z",fill:n.hoursColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${-45+vue.unref(u)} 512.3 506.3`,to:`${315+vue.unref(u)} 512.3 506.3`,dur:"43200s",repeatCount:"indefinite"},null,8,_hoisted_8$5)],8,_hoisted_7$5),vue.createElementVNode("path",{d:"M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z",fill:n.circleColor},null,8,_hoisted_9$5),vue.createElementVNode("path",{d:"M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z",fill:n.scaleColor},null,8,_hoisted_10$4),vue.createElementVNode("path",{d:"M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z",fill:n.secondsColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${135.5+o*6} 512.3 506.3`,to:`${495.5+o*6} 512.3 506.3`,dur:"60s",repeatCount:"indefinite"},null,8,_hoisted_12$3)],8,_hoisted_11$3),vue.createElementVNode("path",{d:"M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z",fill:n.centerColor},null,8,_hoisted_13$2)],8,_hoisted_2$g),vue.createElementVNode("use",{"xlink:href":`#${n.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$j))}}),vueComp={"svg-text":_sfc_main$J,"el-button":elementPlus.ElButton,"progress-a":_sfc_main$L,"el-tag":elementPlus.ElTag,"common-table":_sfc_main$I,"pie-charts":PieCharts,"switch-r":_sfc_main$K,"now-time":NowTime,"light-a":_sfc_main$F,"clock-a":_sfc_main$E},config=[...svg_config,...vue_config],useGlobalStore=pinia$1.defineStore("global-store",{state:()=>({config_center:config,intention:EGlobalStoreIntention.None,create_svg_info:null,done_json:[],mouse_info:{state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},handle_svg_info:null,scale_info:{type:EScaleInfoType.None,scale_times:{x:1,y:1},scale_item_info:{x:0,y:0},symmetric_point:{x:0,y:0}},rotate_info:{angle:0},connection_line_node_info:{init_pos:{x:0,y:0},point_index:0}}),actions:{setCreateInfo(r){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=r},setDoneJson(r){isOfType(r,"id")?(this.done_json.push(r),vue.nextTick(()=>{setSvgActualInfo(r)})):this.done_json=objectDeepClone(r),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(r,n){let i=n;r?(!i&&i!=0&&(i=this.done_json.findIndex(o=>o.id===r.id)??-1),this.handle_svg_info={info:r,index:i}):this.handle_svg_info=r},spliceDoneJson(r){const n=useGlobalStore(),o=n.done_json.splice(r,1)[0];unbindAnchors(o.id),useHistoryRecord(n.done_json)}}}),useSvgEditLayoutStore=pinia$1.defineStore("svg-edit-layout-store",{state:()=>({left_nav:!0,right_nav:!0,center_offset:{x:0,y:0},canvasInfo:{with:0,height:0,top:0,left:0}})}),stopEvent=r=>{r.stopPropagation()},preventDefault=r=>{r.preventDefault()};function componentsRegister(){var n,i;const r=vue.getCurrentInstance();for(let o in vueComp)!((n=r==null?void 0:r.appContext)!=null&&n.components.hasOwnProperty(o))&&vueComp.hasOwnProperty(o)&&((i=r==null?void 0:r.appContext)==null||i.app.component(o,vueComp[o]))}function setEditorLoadTime(){window.sessionStorage.setItem("editorLoadTime",new Date().getTime().toString())}const randomString=r=>{r=r||10;const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=n.length;let o="";for(let a=0;a<r;a++){let u=i;a===0&&(u=i-10),o+=n.charAt(Math.floor(Math.random()*u))}return o},isOfType=(r,n)=>r[n]!==void 0,getCoordinateOffset=(r,n)=>r/2*(n-1),angleToRadian=r=>r*Math.PI/180,calculateRotatedPointCoordinate=(r,n,i)=>({x:parseFloat(((r.x-n.x)*Math.cos(angleToRadian(i))-(r.y-n.y)*Math.sin(angleToRadian(i))+n.x).toFixed(1)),y:parseFloat(((r.x-n.x)*Math.sin(angleToRadian(i))+(r.y-n.y)*Math.cos(angleToRadian(i))+n.y).toFixed(1))}),getCenterPoint=(r,n)=>({x:r.x+(n.x-r.x)/2,y:r.y+(n.y-r.y)/2}),positionArrToPath=r=>{let n="";for(let i=0;i<r.length;i++)i===0?n+=`M ${r[i].x} ${r[i].y}`:n+=` L ${r[i].x} ${r[i].y}`;return n},getSvgNowPosition=(r,n,i)=>i+(n-r),objectDeepClone=(r,n={})=>r?JSON.parse(JSON.stringify(r)):n,setSvgActualInfo=(r,n)=>{var a,u;const i=document.querySelector(`#${r.id}`),o=document.querySelector(`#rect${r.id}`);if(i){let c=0,f=0,d=0,p=0;if(r.type===EDoneJsonType.Vue){d=((a=r.props.width)==null?void 0:a.val)||i.offsetWidth||100,p=((u=r.props.height)==null?void 0:u.val)||i.offsetHeight||100,c=50-d/2,f=50-p/2;const h=document.querySelector(`#foreign-object${r.id}`);h&&(h.getAttribute("x")==="0"&&h.getAttribute("y")==="0"&&h.getAttribute("width")==="0"&&h.getAttribute("height")==="0"||n)&&(h.setAttribute("x",c.toString()),h.setAttribute("y",f.toString()),h.setAttribute("width",d.toString()),h.setAttribute("height",p.toString()))}else{const h=i.getBBox();c=parseFloat(h.x.toFixed(0)),f=parseFloat(h.y.toFixed(0)),d=parseFloat(h.width.toFixed(0)),p=parseFloat(h.height.toFixed(0))}o&&(o.getAttribute("x")==="0"&&o.getAttribute("y")==="0"&&o.getAttribute("width")==="0"&&o.getAttribute("height")==="0"||n)&&(o.setAttribute("x",c.toString()),o.setAttribute("y",f.toString()),o.setAttribute("width",d.toString()),o.setAttribute("height",p.toString())),(r.actual_bound.x===0&&r.actual_bound.y===0&&r.actual_bound.width===0&&r.actual_bound.height===0||n)&&(r.actual_bound={x:c,y:f,width:d,height:p}),r.center_position={x:r.x+r.actual_bound.x+d/2,y:r.y+r.actual_bound.y+p/2},r.point_coordinate.tl={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.tc={x:r.center_position.x,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.tr={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.l={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y},r.point_coordinate.r={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y},r.point_coordinate.bl={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y+p*r.scale_y/2},r.point_coordinate.bc={x:r.center_position.x,y:r.center_position.y+p*r.scale_y/2},r.point_coordinate.br={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y+p*r.scale_y/2},r.rotate!==0&&setAfterRotationPointCoordinate(r),moveAnchors(r)}},resetHandlePointOld=r=>{for(const n of Object.keys(r.point_coordinate))r.point_coordinate_old&&(r.point_coordinate_old[n].x=0,r.point_coordinate_old[n].y=0)},moveHandlePoint=(r,n,i)=>{const o=useGlobalStore(pinia),a=n??o.mouse_info.new_position_x-o.mouse_info.position_x,u=i??o.mouse_info.new_position_y-o.mouse_info.position_y;for(const c of Object.keys(r.point_coordinate))n!==void 0&&i!==void 0?(r.point_coordinate[c].x+=a,r.point_coordinate[c].y+=u):r.point_coordinate_old&&(r.point_coordinate[c].x=r.point_coordinate_old[c].x+a,r.point_coordinate[c].y=r.point_coordinate_old[c].y+u)},moveAnchors=r=>{var i,o,a,u;const n=useGlobalStore(pinia);for(let c of n.done_json)if(c.type===EDoneJsonType.ConnectionLine){if(((o=(i=c.bind_anchors)==null?void 0:i.start)==null?void 0:o.target_id)===r.id){const f=getAnchorPosByAnchorType(c.bind_anchors.start.type,r);c.props.point_position.val[0]={x:f.x-c.x,y:f.y-c.y}}if(((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===r.id){const f=getAnchorPosByAnchorType(c.bind_anchors.end.type,r);c.props.point_position.val[c.props.point_position.val.length-1]={x:f.x-c.x,y:f.y-c.y}}}},unbindAnchors=r=>{var i,o,a,u;const n=useGlobalStore(pinia);for(let c of n.done_json)c.type===EDoneJsonType.ConnectionLine&&(((o=(i=c.bind_anchors)==null?void 0:i.start)==null?void 0:o.target_id)===r&&(c.bind_anchors.start=null),((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===r&&(c.bind_anchors.end=null))},getAnchorPosByAnchorType=(r,n)=>r===ELineBindAnchors.BottomCenter?n.point_coordinate.bc:r===ELineBindAnchors.Left?n.point_coordinate.l:r===ELineBindAnchors.Right?n.point_coordinate.r:n.point_coordinate.tc,setAfterRotationPointCoordinate=r=>{r.point_coordinate={tl:calculateRotatedPointCoordinate(r.point_coordinate.tl,r.center_position,r.rotate),tc:calculateRotatedPointCoordinate(r.point_coordinate.tc,r.center_position,r.rotate),tr:calculateRotatedPointCoordinate(r.point_coordinate.tr,r.center_position,r.rotate),l:calculateRotatedPointCoordinate(r.point_coordinate.l,r.center_position,r.rotate),r:calculateRotatedPointCoordinate(r.point_coordinate.r,r.center_position,r.rotate),bl:calculateRotatedPointCoordinate(r.point_coordinate.bl,r.center_position,r.rotate),bc:calculateRotatedPointCoordinate(r.point_coordinate.bc,r.center_position,r.rotate),br:calculateRotatedPointCoordinate(r.point_coordinate.br,r.center_position,r.rotate)}},prosToVBind=(r,n=[])=>{let i={};if(r.state){for(const o in r.state)if(r.state.hasOwnProperty(o)&&o===r.defaultState){for(let a in r.state[o])a!=="label"&&(i[lodashEs.kebabCase(a)]=r.state[o][a]);break}}for(const o in r.props)n.indexOf(o)<0&&(i[lodashEs.kebabCase(o)]=r.props[o].val);return i},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(r=>r.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=r=>!r.common_animations||!r.common_animations.val?"":`common-ani animate__animated animate__${r.common_animations.val} animate__${r.common_animations.speed} animate__${r.common_animations.repeat} animate__${r.common_animations.delay}`,numberArray=r=>{let n=[];for(let i=0;i<r;i++)n.push(i);return n},getStringWidth=(r,n=12)=>{if(r.length>0){let i=document.createElement("span");i.style.fontSize=n+"px",i.style.fontFamily="inherit",i.innerHTML=r,i.style.opacity="0",i.style.position="fixed",i.style.top="3000px",document.body.append(i);const o=i.clientWidth;return document.body.removeChild(i),o}return 0},valFormat=r=>/false|true/.test(r)?r!=="false":/^\d+(\.\d+)?$/.test(r)?Number(r):r,createLine=(r,n,i)=>{r.preventDefault();const o=useGlobalStore(pinia),a=useConfigStore(pinia),u=useSvgEditLayoutStore(pinia),{clientX:c,clientY:f}=r;let d=objectDeepClone(a.connection_line),p=0,h=0;if(n&&i){d.bind_anchors.start={type:n,target_id:i.id};let v=getAnchorPosByAnchorType(n,i);p=v.x,h=v.y}else p=Math.round((c-u.canvasInfo.left)/a.svg.scale-u.center_offset.x),h=Math.round((f-u.canvasInfo.top)/a.svg.scale-u.center_offset.y);const g={id:randomString(),x:p,y:h,client:{x:p,y:h},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},...d};g.props.point_position.val.push({x:0,y:0}),o.setDoneJson(g),o.setHandleSvgInfo(g,o.done_json.length-1),o.intention=EGlobalStoreIntention.Connection,o.mouse_info={state:EMouseInfoState.Down,position_x:p,position_y:h,now_position_x:p,now_position_y:h,new_position_x:0,new_position_y:0}};Object.seal({name:"straight-line",title:"直线",type:EDoneJsonType.StraightLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{fill:{title:"填充色",type:EConfigItemPropsType.Color,val:"#ff0000"},start_x:{title:"起点x坐标",type:EConfigItemPropsType.InputNumber,val:0},start_y:{title:"起点y坐标",type:EConfigItemPropsType.InputNumber,val:0},end_x:{title:"终点x坐标",type:EConfigItemPropsType.InputNumber,val:0},end_y:{title:"终点y坐标",type:EConfigItemPropsType.InputNumber,val:0}},bind_anchors:{start:null,end:null},events:[]});const connection_line_system={name:"connection_line",title:"连接线",type:EDoneJsonType.ConnectionLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{stroke:{title:"线条颜色",type:EConfigItemPropsType.Color,val:"#ff0000"},"stroke-width":{title:"线条宽度",type:EConfigItemPropsType.InputNumber,val:2},point_r:{title:"节点半径",type:EConfigItemPropsType.InputNumber,val:4},point_position:{title:"点坐标",type:EConfigItemPropsType.JsonEdit,val:[]}},animations:{type:{title:"动画类型",type:EConfigItemPropsType.Select,val:EConfigAnimationsType.None,options:[{label:"无",value:EConfigAnimationsType.None},{label:"电流",value:EConfigAnimationsType.Electricity},{label:"轨迹",value:EConfigAnimationsType.Track},{label:"水珠",value:EConfigAnimationsType.WaterDrop}]},dur:{title:"持续时间",type:EConfigItemPropsType.InputNumber,val:20},repeatCount:{title:"循环次数",type:EConfigItemPropsType.Input,val:"indefinite",disabled:!0},color:{title:"颜色",type:EConfigItemPropsType.Color,val:"#602a00"},reverse:{title:"反转动画",type:EConfigItemPropsType.Switch,val:!1}},bind_anchors:{start:null,end:null},events:[]},common_animate_list=[{label:"进入",children:[{label:"渐显",value:"fadeIn"},{label:"向右进入",value:"fadeInLeft"},{label:"向左进入",value:"fadeInRight"},{label:"向上进入",value:"fadeInUp"},{label:"向下进入",value:"fadeInDown"},{label:"向右长距进入",value:"fadeInLeftBig"},{label:"向左长距进入",value:"fadeInRightBig"},{label:"向上长距进入",value:"fadeInUpBig"},{label:"向下长距进入",value:"fadeInDownBig"},{label:"旋转进入",value:"rotateIn"},{label:"左顺时针旋转",value:"rotateInDownLeft"},{label:"右逆时针旋转",value:"rotateInDownRight"},{label:"左逆时针旋转",value:"rotateInUpLeft"},{label:"右逆时针旋转",value:"rotateInUpRight"},{label:"弹入",value:"bounceIn"},{label:"向右弹入",value:"bounceInLeft"},{label:"向左弹入",value:"bounceInRight"},{label:"向上弹入",value:"bounceInUp"},{label:"向下弹入",value:"bounceInDown"},{label:"光速从右进入",value:"lightSpeedInRight"},{label:"光速从左进入",value:"lightSpeedInLeft"},{label:"光速从右退出",value:"lightSpeedOutRight"},{label:"光速从左退出",value:"lightSpeedOutLeft"},{label:"Y轴旋转",value:"flip"},{label:"中心X轴旋转",value:"flipInX"},{label:"中心Y轴旋转",value:"flipInY"},{label:"左长半径旋转",value:"rollIn"},{label:"由小变大进入",value:"zoomIn"},{label:"左变大进入",value:"zoomInLeft"},{label:"右变大进入",value:"zoomInRight"},{label:"向上变大进入",value:"zoomInUp"},{label:"向下变大进入",value:"zoomInDown"},{label:"向右滑动展开",value:"slideInLeft"},{label:"向左滑动展开",value:"slideInRight"},{label:"向上滑动展开",value:"slideInUp"},{label:"向下滑动展开",value:"slideInDown"}]},{label:"强调",children:[{label:"弹跳",value:"bounce"},{label:"闪烁",value:"flash"},{label:"放大缩小",value:"pulse"},{label:"放大缩小弹簧",value:"rubberBand"},{label:"左右晃动",value:"headShake"},{label:"左右扇形摇摆",value:"swing"},{label:"放大晃动缩小",value:"tada"},{label:"扇形摇摆",value:"wobble"},{label:"左右上下晃动",value:"jello"},{label:"Y轴旋转",value:"flip"}]},{label:"退出",children:[{label:"渐隐",value:"fadeOut"},{label:"向左退出",value:"fadeOutLeft"},{label:"向右退出",value:"fadeOutRight"},{label:"向上退出",value:"fadeOutUp"},{label:"向下退出",value:"fadeOutDown"},{label:"向左长距退出",value:"fadeOutLeftBig"},{label:"向右长距退出",value:"fadeOutRightBig"},{label:"向上长距退出",value:"fadeOutUpBig"},{label:"向下长距退出",value:"fadeOutDownBig"},{label:"旋转退出",value:"rotateOut"},{label:"左顺时针旋转",value:"rotateOutDownLeft"},{label:"右逆时针旋转",value:"rotateOutDownRight"},{label:"左逆时针旋转",value:"rotateOutUpLeft"},{label:"右逆时针旋转",value:"rotateOutUpRight"},{label:"弹出",value:"bounceOut"},{label:"向左弹出",value:"bounceOutLeft"},{label:"向右弹出",value:"bounceOutRight"},{label:"向上弹出",value:"bounceOutUp"},{label:"向下弹出",value:"bounceOutDown"},{label:"中心X轴旋转",value:"flipOutX"},{label:"中心Y轴旋转",value:"flipOutY"},{label:"左长半径旋转",value:"rollOut"},{label:"由小变大退出",value:"zoomOut"},{label:"左变大退出",value:"zoomOutLeft"},{label:"右变大退出",value:"zoomOutRight"},{label:"向上变大退出",value:"zoomOutUp"},{label:"向下变大退出",value:"zoomOutDown"},{label:"向左滑动收起",value:"slideOutLeft"},{label:"向右滑动收起",value:"slideOutRight"},{label:"向上滑动收起",value:"slideOutUp"},{label:"向下滑动收起",value:"slideOutDown"}]}];let l=localStorage.getItem("svg-editor-config"),s,t;if(l){let r=JSON.parse(l);t=r.connection_line,s=r.svg}else t=objectDeepClone(connection_line_system),s={background_color:"#fff",scale:1,grid:!0,grid_color:"#ebebeb",ruler:!0};const useConfigStore=pinia$1.defineStore("config-store",{state:()=>({svg:s,connection_line:t,net:{mqtt:{url:"",user:"",pwd:"",topics:""}}}),getters:{},actions:{}});var EContextMenuInfoType=(r=>(r.Copy="Copy",r.Delete="Delete",r.MoveUpOneLevel="MoveUpOneLevel",r.MoveDownOneLevel="MoveDownOneLevel",r.MoveUpTopLevel="MoveUpTopLevel",r.MoveDownTopLevel="MoveDownTopLevel",r))(EContextMenuInfoType||{});const useEditPrivateStore=pinia$1.defineStore("edit-private-store",{state:()=>({old_done_components:[],history_doneComponent:[],history_now_index:0,is_record_history:!0,max_record_times:10}),getters:{getTopBtnUndoStatus(r){return r.history_now_index>=1},getTopBtnRedoStatus(r){return r.history_now_index+1!=r.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const r=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,r.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const r=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,r.setDoneJson(this.history_doneComponent[this.history_now_index])}}}),useContextMenuStore=pinia$1.defineStore("context-menu-store",{state:()=>({display:!1,info:{[EContextMenuInfoType.Copy]:{title:"复制",hot_key:"Ctrl + c",enable:!0},[EContextMenuInfoType.Delete]:{title:"删除",hot_key:"Delete",enable:!0},[EContextMenuInfoType.MoveUpTopLevel]:{title:"置于顶层",hot_key:"Ctrl + →",enable:!0},[EContextMenuInfoType.MoveDownTopLevel]:{title:"置于底层",hot_key:"Ctrl + ←",enable:!0},[EContextMenuInfoType.MoveUpOneLevel]:{title:"置于上一层",hot_key:"Ctrl + ↑",enable:!0},[EContextMenuInfoType.MoveDownOneLevel]:{title:"置于下一层",hot_key:"Ctrl + ↓",enable:!0}}}),actions:{onContextMenuClick(r){const n=useGlobalStore();if(n.handle_svg_info)switch(n.intention=EGlobalStoreIntention.Select,r){case EContextMenuInfoType.Copy:const i=objectDeepClone(n.handle_svg_info.info);i.id=randomString(),i.title+="-copy",i.x+=10,i.y+=10,n.setDoneJson(i),this.display=!1,n.setHandleSvgInfo(i,n.done_json.length);break;case EContextMenuInfoType.Delete:n.spliceDoneJson(n.handle_svg_info.index),this.display=!1,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length-1)return;const o=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index+1],n.done_json[n.handle_svg_info.index+1]=o,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(o,n.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const a=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index-1],n.done_json[n.handle_svg_info.index-1]=a,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(a,n.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const u=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.unshift(u),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(u,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length)return;const c=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.push(c),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(c,n.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=r=>{const n=useEditPrivateStore();n.is_record_history&&(n.history_now_index+1<n.history_doneComponent.length&&n.history_doneComponent.splice(n.history_now_index+1),n.history_doneComponent.push(r),n.history_now_index=n.history_doneComponent.length-1,n.history_doneComponent.length>n.max_record_times&&(n.history_doneComponent.shift(),n.history_now_index=n.history_doneComponent.length-1)),n.is_record_history=!0},useImportDataModel=r=>{try{const n=JSON.parse(r);if(!n.config||!n.layout_center||!n.done_json)return elementPlus.ElMessage.error("请导入正确的数据模型!"),!1;const i=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return a.$state=n.config,o.center_offset=n.layout_center,i.setDoneJson(n.done_json),!0}catch(n){return elementPlus.ElMessage.error("请导入正确的数据模型!"),console.error(n),!1}},_hoisted_1$i={"aria-hidden":"true"},_hoisted_2$f=["xlink:href"],_sfc_main$D=vue.defineComponent({__name:"svg-analysis",props:{name:{},props:{default:()=>({})}},setup(r){const n=r,i=vue.computed(()=>`#svg-${n.name}`);return(o,a)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$i,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(i)},n.props),null,16,_hoisted_2$f)]))}});var EVisibleConfKey=(r=>(r.ImportJson="ImportJson",r.ExportJson="ExportJson",r.ImportFile="ImportFile",r))(EVisibleConfKey||{});const _withScopeId$2=r=>(vue.pushScopeId("data-v-62907637"),r=r(),vue.popScopeId(),r),_hoisted_1$h={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$e={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$c=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$8={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$4={class:"flex items-center mr-20px"},_hoisted_7$4={class:"flex items-center",style:{width:"250px"}},_hoisted_8$4=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title",style:{"padding-top":"16px"}},"多选",-1)),_hoisted_9$4=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住鼠标左键可以框选(图形坐标在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选",-1)),_hoisted_10$3=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_11$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"拖动画布",-1)),_hoisted_12$2=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住右键可拖动画布,右侧面板‘图纸’栏可微调或重置位置",-1)),_hoisted_13$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_14$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"画布缩放",-1)),_hoisted_15$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放",-1)),_hoisted_16$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18=_withScopeId$2(()=>vue.createElementVNode("div",null,"在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线",-1)),_hoisted_19=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_20=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"组件尺寸",-1)),_hoisted_21=_withScopeId$2(()=>vue.createElementVNode("div",null,[vue.createElementVNode("p",null," 大多数组件可以通过选中组件然后拖动交互点或在右侧‘外观’栏改变外形尺寸,或通过右侧‘数据’栏直接或间接改变外形尺寸;"),vue.createElementVNode("p",null,"少数特殊组件仅可通过右侧'数据'栏直接或间接改变外形尺寸")],-1)),_hoisted_22$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_23=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"连线样式",-1)),_hoisted_24=_withScopeId$2(()=>vue.createElementVNode("div",null,"在右侧‘连线’栏可以统一配置连线样式,配置后先增加的线会应用新样式,之前的线样式不变,如需改变,可选中线手动更改或删除重画 ",-1)),_hoisted_25=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_26$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"横线和竖线",-1)),_hoisted_27=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null," 点击编辑器顶部连线按钮会进入连线状态,该状态下在画板点击鼠标左键即可开始画线,移动并再次点击左键创建新的节点,右键结束画线并退出连线状态;"),vue.createElementVNode("p",null,"画线的时候按住ctrl即可画竖线,按住shift即可画横线")],-1)),_hoisted_28=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_29=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"绑定锚点",-1)),_hoisted_30=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null,"组件在未选中时,鼠标经过组件时会出现锚点,鼠标悬浮在锚点上时,会有交互样式,点击左键即可以锚点为起点创建连线;"),vue.createElementVNode("p",null,"同样,在连线时鼠标经过锚点时,会出现锚点交互样式,点击左键即可以锚点为连线终点结束连线;"),vue.createElementVNode("p",null,"这两种情况下的连线会绑定组件上的锚点,如需解绑,参考下面的‘锚点解绑’;"),vue.createElementVNode("p",null,"同样,也可先画线,再选中连线绑定想要绑定的组件锚点(连线只有首尾节点可以绑定锚点)")],-1)),_hoisted_31=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_32$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"线段选中",-1)),_hoisted_33=_withScopeId$2(()=>vue.createElementVNode("div",null," 若线段绑定了锚点,移动线段,绑定的锚点不会移动。若是想将线段整体移动,需要先解绑,参考下面的‘锚点解绑’ ",-1)),_hoisted_34=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_35=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"锚点解绑",-1)),_hoisted_36$1=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$C=vue.defineComponent({__name:"top-panel",emits:["changeVisible","onReturn","onPreview","onSave"],setup(r,{emit:n}){const i=useSvgEditLayoutStore(pinia),o=useGlobalStore(pinia),a=useEditPrivateStore(pinia),u=useConfigStore(pinia),c=()=>{o.done_json.length<=0||o.setDoneJson([]),o.intention=EGlobalStoreIntention.None},f=h=>{const g={layout_center:i.center_offset,config:u.$state,done_json:o.done_json};n(h,g)},d=vue.ref(!1),p=vue.computed({get:()=>o.intention===EGlobalStoreIntention.Connection,set(h){o.intention=h?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,h&&o.setHandleSvgInfo(null)}});return(h,g)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$h,[vue.createElementVNode("div",_hoisted_2$e,[_hoisted_3$c,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:g[0]||(g[0]=v=>vue.unref(i).left_nav=!vue.unref(i).left_nav),title:vue.unref(i).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(i).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$8,[vue.createElementVNode("div",_hoisted_5$6,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"撤销 ctrl+z",size:24,class:vue.normalizeClass(`${vue.unref(a).getTopBtnUndoStatus?"bt-Icon":"icon-disable"} ml-20px`),onClick:g[1]||(g[1]=()=>vue.unref(a).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(a).getTopBtnUndoStatus?"undo":"undo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"重做 ctrl+shift+z",class:vue.normalizeClass(`${vue.unref(a).getTopBtnRedoStatus?"bt-Icon":"icon-disable"} ml-5px`),size:24,onClick:g[2]||(g[2]=()=>vue.unref(a).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(a).getTopBtnRedoStatus?"redo":"redo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"清空 ctrl+delete",class:vue.normalizeClass(vue.unref(o).done_json.length>0?"bt-Icon":"icon-disable"),size:24,onClick:c},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(o).done_json.length>0?"delete":"delete-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导入数据模型",class:"bt-Icon",size:24,onClick:g[3]||(g[3]=v=>n("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"import"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:g[4]||(g[4]=v=>n("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"export"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"创建连线",class:vue.normalizeClass(["bt-Icon",{active:vue.unref(p)}]),size:24,onClick:g[5]||(g[5]=v=>p.value=!vue.unref(p))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(p)?"line-active":"line"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"说明",class:"bt-Icon",size:24,onClick:g[6]||(g[6]=v=>d.value=!vue.unref(d))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$4,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:g[7]||(g[7]=v=>f("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"return"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:g[8]||(g[8]=v=>f("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"save"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:g[9]||(g[9]=v=>f("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$4,[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:g[10]||(g[10]=v=>vue.unref(i).right_nav=!vue.unref(i).right_nav),title:vue.unref(i).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(i).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(elementPlus.ElDialog),{modelValue:vue.unref(d),"onUpdate:modelValue":g[11]||(g[11]=v=>vue.isRef(d)?d.value=v:null),title:"使用说明",width:"60%",class:"guide-dialog"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$4,_hoisted_9$4,_hoisted_10$3,_hoisted_11$2,_hoisted_12$2,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$2,_hoisted_17,_hoisted_18,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22$1,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26$1,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32$1,_hoisted_33,_hoisted_34,_hoisted_35,_hoisted_36$1]),_:1})]),_:1},8,["modelValue"])],64))}}),topPanel_vue_vue_type_style_index_0_scoped_62907637_lang="",topPanel_vue_vue_type_style_index_1_lang="",TopPanel=_export_sfc$1(_sfc_main$C,[["__scopeId","data-v-62907637"]]),_hoisted_1$g={class:"component-group flex flex-wrap"},_hoisted_2$d=["onDragstart","title"],_sfc_main$B=vue.defineComponent({__name:"left-panel",props:{customToolbar:{}},setup(r){const n=r,i=useGlobalStore(pinia),o=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:i.config_center),a=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),u=f=>{i.setCreateInfo(f)},c=f=>{var d;if(((d=f.dataTransfer)==null?void 0:d.dropEffect)!=="copy"){elementPlus.ElMessage.warning("请将组件拖到画布中!"),i.intention=EGlobalStoreIntention.None;return}};return(f,d)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(a),"onUpdate:modelValue":d[0]||(d[0]=p=>vue.isRef(a)?a.value=p:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),p=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:p.groupType,key:p.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(p.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$g,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(p.list,h=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:h.name,draggable:"true",onDragstart:g=>u(h),onDragend:c,title:h.title},[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:h.name,props:vue.unref(prosToVBind)(h,["width","height","maxHeight"])},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$d))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),leftPanel_vue_vue_type_style_index_0_scoped_d7403cfd_lang="",LeftPanel=_export_sfc$1(_sfc_main$B,[["__scopeId","data-v-d7403cfd"]]),calculateLeftTop=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate(n,o,-i);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate(n,o,-i);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(n,o,-i),u=calculateRotatedPointCoordinate(r,o,-i);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(n,o,-i),u=calculateRotatedPointCoordinate(r,o,-i);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateTop=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateRight=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateLeft=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$f={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$c=["fill","x","y"],_hoisted_3$b=["cx","cy"],_hoisted_4$7=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$3=["fill","x","y"],_hoisted_7$3=["fill","x","y"],_hoisted_8$3=["fill","x","y"],_hoisted_9$3=["fill","x","y"],_hoisted_10$2=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$A=vue.defineComponent({__name:"handle-panel",props:{itemInfo:{}},setup(r){const n=r;vue.useCssVars(v=>({"5c831aea":vue.unref(c)}));const i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=vue.ref(4),c=vue.ref("#ab712e"),f=[{start:338,end:23,cursor:"nw",type:EScaleInfoType.TopLeft},{start:23,end:68,cursor:"n",type:EScaleInfoType.TopCenter},{start:68,end:113,cursor:"ne",type:EScaleInfoType.TopRight},{start:293,end:338,cursor:"w",type:EScaleInfoType.Left},{start:113,end:158,cursor:"e",type:EScaleInfoType.Right},{start:248,end:293,cursor:"sw",type:EScaleInfoType.BottomLeft},{start:203,end:248,cursor:"s",type:EScaleInfoType.BottomCenter},{start:158,end:203,cursor:"se",type:EScaleInfoType.BottomRight}],d=vue.computed(()=>n.itemInfo.config.can_zoom),p=(v,y)=>{console.log("handMousedown",y);const{clientX:A,clientY:_}=y;y.stopPropagation(),i.intention=EGlobalStoreIntention.Zoom;const S=Math.round((A-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),b=Math.round((_-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);i.mouse_info={state:EMouseInfoState.Down,position_x:S,position_y:b,now_position_x:S,now_position_y:b,new_position_x:0,new_position_y:0},i.scale_info={type:v,scale_times:{x:n.itemInfo.scale_x,y:n.itemInfo.scale_y},scale_item_info:{x:n.itemInfo.x,y:n.itemInfo.y},symmetric_point:{x:S+Math.abs(S-n.itemInfo.center_position.x)*2*(S>n.itemInfo.center_position.x?-1:1),y:b+Math.abs(b-n.itemInfo.center_position.y)*2*(b>n.itemInfo.center_position.y?-1:1)}}},h=v=>{const{clientX:y,clientY:A}=v,_=Math.round((y-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),S=Math.round((A-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);v.stopPropagation(),i.intention=EGlobalStoreIntention.Rotate,i.rotate_info={angle:n.itemInfo.rotate},i.mouse_info={state:EMouseInfoState.Down,position_x:_,position_y:S,now_position_x:_,now_position_y:S,new_position_x:0,new_position_y:0}},g=v=>{const y=(v+n.itemInfo.rotate)%360,A=f.find(_=>_.start<=y&&_.end>y);return A?{cursor:A.cursor+"-resize",type:A.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(v,y)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$f,[vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(0).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[0]||(y[0]=A=>p(vue.unref(EScaleInfoType).TopLeft,A))},null,44,_hoisted_2$c),[[vue.vShow,vue.unref(d)]]),vue.createElementVNode("circle",{cx:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,cy:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:h},null,40,_hoisted_3$b),vue.createElementVNode("line",{x1:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y1:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),x2:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y2:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref(c),"stroke-width":2})},null,12,_hoisted_4$7),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(45).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-vue.unref(u),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[1]||(y[1]=A=>p(vue.unref(EScaleInfoType).TopCenter,A))},null,44,_hoisted_5$5),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tr",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(90).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width-vue.unref(u)+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[2]||(y[2]=A=>p(vue.unref(EScaleInfoType).TopRight,A))},null,44,_hoisted_6$3),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_l",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(315).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[3]||(y[3]=A=>p(vue.unref(EScaleInfoType).Left,A))},null,44,_hoisted_7$3),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_r",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(135).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[4]||(y[4]=A=>p(vue.unref(EScaleInfoType).Right,A))},null,44,_hoisted_8$3),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(270).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[5]||(y[5]=A=>p(vue.unref(EScaleInfoType).BottomLeft,A))},null,44,_hoisted_9$3),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(225).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width/2,y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[6]||(y[6]=A=>p(vue.unref(EScaleInfoType).BottomCenter,A))},null,44,_hoisted_10$2),[[vue.vShow,vue.unref(d)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_br",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(180).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[7]||(y[7]=A=>p(vue.unref(EScaleInfoType).BottomRight,A))},null,44,_hoisted_11$1),[[vue.vShow,vue.unref(d)]])]))}}),handlePanel_vue_vue_type_style_index_0_scoped_e6622df8_lang="",HandlePanel=_export_sfc$1(_sfc_main$A,[["__scopeId","data-v-e6622df8"]]),_hoisted_1$e=["fill"],_hoisted_2$b=["cx","cy","r"],_hoisted_3$a=["cx","cy","r"],_hoisted_4$6=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$2=["cx","cy","r"],_hoisted_7$2=["cx","cy","r"],_hoisted_8$2=["cx","cy","r"],_hoisted_9$2=["cx","cy","r"],_sfc_main$z=vue.defineComponent({__name:"connection-panel",props:{itemInfo:{}},setup(r){const n=r,i=vue.ref(4),o=vue.ref("#ab712e"),a=vue.ref(4),u=vue.ref(12),c=useGlobalStore(pinia),f=useSvgEditLayoutStore(pinia),d=vue.computed(()=>n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-i.value+a.value),p=vue.computed(()=>n.itemInfo.actual_bound.y-i.value-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),h=vue.computed(()=>n.itemInfo.actual_bound.x-i.value+n.itemInfo.actual_bound.width+getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+a.value),g=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),v=vue.computed(()=>n.itemInfo.actual_bound.x-i.value+n.itemInfo.actual_bound.width/2+a.value),y=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height+getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),A=vue.computed(()=>n.itemInfo.actual_bound.x-i.value-getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+a.value),_=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),S=(T,w)=>{var x;c.intention===EGlobalStoreIntention.SetConnectionLineNode&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&c.connection_line_node_info&&(c.connection_line_node_info.point_index===0?c.handle_svg_info.info.bind_anchors.start={type:w,target_id:n.itemInfo.id}:c.connection_line_node_info.point_index===c.handle_svg_info.info.props.point_position.val.length-1&&(c.handle_svg_info.info.bind_anchors.end={type:w,target_id:n.itemInfo.id}),c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))},b=(T,w)=>{var x;c.intention===EGlobalStoreIntention.None?(createLine(T,w,n.itemInfo),c.handle_svg_info&&(c.handle_svg_info.info.props.point_position.val.length!==1?c.handle_svg_info.info.props.point_position.val.push({x:c.mouse_info.new_position_x-c.mouse_info.position_x-f.center_offset.x,y:c.mouse_info.new_position_y-c.mouse_info.position_y-f.center_offset.y}):c.handle_svg_info.info.props.point_position.val.push({x:0,y:0}))):c.intention===EGlobalStoreIntention.Connection&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&(c.handle_svg_info.info.bind_anchors.end={type:w,target_id:n.itemInfo.id},c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))};return(T,w)=>(vue.openBlock(),vue.createElementBlock("g",{style:{"vector-effect":"non-scaling-stroke"},class:"connect-points",fill:vue.unref(o),"stroke-width":"2",stroke:"rgba(0,0,0,0)"},[vue.createElementVNode("g",{onMousedown:w[0]||(w[0]=x=>b(x,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:w[1]||(w[1]=x=>S(x,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(d),cy:vue.unref(p),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_2$b),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(d),cy:vue.unref(p),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_3$a)],32),vue.createElementVNode("g",{onMousedown:w[2]||(w[2]=x=>b(x,vue.unref(ELineBindAnchors).Right)),onMouseup:w[3]||(w[3]=x=>S(x,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(h),cy:vue.unref(g),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_4$6),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(h),cy:vue.unref(g),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:w[4]||(w[4]=x=>b(x,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:w[5]||(w[5]=x=>S(x,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(v),cy:vue.unref(y),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_6$2),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(v),cy:vue.unref(y),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_7$2)],32),vue.createElementVNode("g",{onMousedown:w[6]||(w[6]=x=>b(x,vue.unref(ELineBindAnchors).Left)),onMouseup:w[7]||(w[7]=x=>S(x,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(A),cy:vue.unref(_),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_8$2),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(A),cy:vue.unref(_),r:vue.unref(a),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$2)],32)],8,_hoisted_1$e))}}),connectionPanel_vue_vue_type_style_index_0_scoped_fb729c7a_lang="",ConnectionPanel=_export_sfc$1(_sfc_main$z,[["__scopeId","data-v-fb729c7a"]]),_hoisted_1$d=["d","stroke-width"],_hoisted_2$a=["d","stroke-width"],_hoisted_3$9=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$5=["from","to","dur","repeatCount"],_hoisted_5$3=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_6$1=["from","to","dur","repeatCount"],_hoisted_7$1=["r","fill"],_hoisted_8$1=["path","dur","repeatCount"],_hoisted_9$1=["cx","cy","r","stroke-width"],_hoisted_10$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$y=vue.defineComponent({__name:"connection-line",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(r){const n=r,i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=(c,f,d,p)=>{if(i.intention===EGlobalStoreIntention.Connection)return;i.setHandleSvgInfo(n.itemInfo);const{clientX:h,clientY:g}=f;f.stopPropagation(),i.connection_line_node_info={init_pos:{x:d,y:p},point_index:c},i.intention=EGlobalStoreIntention.SetConnectionLineNode,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((h-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((g-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0}};return(c,f)=>{var d,p,h,g,v,y;return vue.openBlock(),vue.createElementBlock("g",{style:vue.normalizeStyle({cursor:vue.unref(i).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"})},[vue.withDirectives(vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#DE4517","stroke-width":Math.ceil(n.itemInfo.props["stroke-width"].val*1.2)+1,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_1$d),[[vue.vShow,n.itemInfo.selected||n.itemInfo.id===((d=vue.unref(i).handle_svg_info)==null?void 0:d.info.id)]]),vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#fff","stroke-opacity":".01","stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_2$a),vue.createElementVNode("path",{id:n.itemInfo.id,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none",stroke:((p=n.itemInfo.animations)==null?void 0:p.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.animations.color.val:n.itemInfo.props.stroke.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dashoffset":"0","stroke-dasharray":((h=n.itemInfo.animations)==null?void 0:h.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.props["stroke-width"].val*3:0,"stroke-linejoin":"round"},[((g=n.itemInfo.animations)==null?void 0:g.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_4$5)):vue.createCommentVNode("",!0)],8,_hoisted_3$9),((v=n.itemInfo.animations)==null?void 0:v.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:n.itemInfo.animations.color.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dasharray":n.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_6$1)],8,_hoisted_5$3)):((y=n.itemInfo.animations)==null?void 0:y.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:Math.ceil(n.itemInfo.props["stroke-width"].val*.6)+2,fill:n.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(n.itemInfo.animations.reverse.val?[...n.itemInfo.props.point_position.val].reverse():n.itemInfo.props.point_position.val),dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_8$1)],8,_hoisted_7$1)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(A,_)=>{var S;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("circle",{key:_,cx:A.x,cy:A.y,r:n.itemInfo.props.point_r.val+1,fill:"none","fill-opacity":"0","stroke-width":Math.ceil(n.itemInfo.props.point_r.val*.2)+1,stroke:"#DE4517"},null,8,_hoisted_9$1)),[[vue.vShow,n.itemInfo.selected||n.itemInfo.id===((S=vue.unref(i).handle_svg_info)==null?void 0:S.info.id)]])}),128)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(A,_)=>(vue.openBlock(),vue.createElementBlock("circle",{key:_,cx:A.x,cy:A.y,r:n.itemInfo.props.point_r.val,"stroke-width":"1",stroke:n.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:S=>u(_,S,A.x,A.y)},null,40,_hoisted_10$1))),128))])],4)}}}),_hoisted_1$c={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_2$9=["stroke"],_hoisted_3$8=["stroke"],_hoisted_4$4=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_7=["transform"],_hoisted_8=["transform"],_hoisted_9=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_10=["xlink:href","id","transform"],_hoisted_11=["id"],_hoisted_12$1=["id","x1","y1","x2","y2"],_hoisted_13=["id"],_hoisted_14=["x","y","height","width"],_hoisted_15=["onClick"],_hoisted_16$1={class:"shortcut"},_sfc_main$x=vue.defineComponent({__name:"center-panel",setup(r,{expose:n}){vue.useCssVars(de=>({"49c79b5f":vue.unref(h)}));const i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=useEditPrivateStore(pinia),c=useContextMenuStore(pinia);componentsRegister();const f=vue.ref(),d=vue.ref(),p={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},h=vue.computed(()=>Object.keys(p).indexOf(i.intention)>-1?p[i.intention]:"default"),g=vue.reactive({handle_panel:vue.computed(()=>i.intention===EGlobalStoreIntention.Select||i.intention===EGlobalStoreIntention.Zoom||i.intention===EGlobalStoreIntention.Rotate),connection_panel:!1,connection_line:!1,select_item:{info:null,index:-1}}),v=vue.ref({a:{x:0,y:0},b:{x:0,y:0}}),y=vue.computed(()=>i.intention===EGlobalStoreIntention.SelectArea&&v.value.b.x&&v.value.b.y?{with:Math.abs(v.value.b.x-v.value.a.x),height:Math.abs(v.value.b.y-v.value.a.y),x:v.value.a.x<v.value.b.x?v.value.a.x:v.value.b.x,y:v.value.a.y<v.value.b.y?v.value.a.y:v.value.b.y}:{with:0,height:0,x:0,y:0}),A=vue.computed(()=>{let de=0;for(let ie of i.done_json)ie.selected&&de++;return de>0});let _=!1,S=!1;const b=de=>{var ie;if(i.intention!=EGlobalStoreIntention.None){if(i.intention==EGlobalStoreIntention.Create){if(!i.create_svg_info){console.error("要创建的数据获取失败");return}const Y=Math.floor(de.offsetX/o.svg.scale-a.center_offset.x),Ie=Math.floor(de.offsetY/o.svg.scale-a.center_offset.y),Oe={id:randomString(),x:Y,y:Ie,client:{x:Y,y:Ie},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},selected:!1,...objectDeepClone(i.create_svg_info)};i.setDoneJson(Oe),i.setHandleSvgInfo(Oe,i.done_json.length),i.intention=EGlobalStoreIntention.None}(ie=d.value)==null||ie.focus()}},T=de=>{de.preventDefault()},w=de=>{de.preventDefault()},x=(de,ie,Y)=>{var Ie,Oe,kt;if((Ie=d.value)==null||Ie.focus(),i.intention===EGlobalStoreIntention.Connection){Y.stopPropagation();return}if(Y.preventDefault(),Y.stopPropagation(),Y.ctrlKey&&Y.button===0)((Oe=i.handle_svg_info)!=null&&Oe.index||((kt=i.handle_svg_info)==null?void 0:kt.index)===0)&&(i.done_json[i.handle_svg_info.index].selected=!0,i.setHandleSvgInfo(null),i.intention=EGlobalStoreIntention.None),de.selected=!de.selected;else if(A.value){i.intention=EGlobalStoreIntention.GroupMove,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0};for(let Dt of i.done_json)Dt.selected&&(Dt.old_position={x:Dt.x,y:Dt.y},Dt.point_coordinate_old=objectDeepClone(Dt.point_coordinate))}else i.intention=EGlobalStoreIntention.Select,i.setHandleSvgInfo(de,ie),i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:de.x,now_position_y:de.y,new_position_x:0,new_position_y:0},de.point_coordinate_old=objectDeepClone(de.point_coordinate)},k=(de,ie,Y)=>{if(!(i.intention===EGlobalStoreIntention.Connection||i.mouse_info.state!=EMouseInfoState.Down)&&A.value&&!_&&["SelectArea","Move","Select"].indexOf(i.intention)<0){for(let Ie of i.done_json)Ie.selected=!1,Ie.old_position={x:0,y:0},resetHandlePointOld(Ie);i.intention=EGlobalStoreIntention.Select,i.setHandleSvgInfo(de,ie),i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:de.x,now_position_y:de.y,new_position_x:0,new_position_y:0}}},M=(de,ie,Y)=>{Y.preventDefault(),Y.stopPropagation(),g.connection_panel=!0,g.connection_line=!0,!((i.intention===EGlobalStoreIntention.Connection||i.intention===EGlobalStoreIntention.SetConnectionLineNode)&&de.type===EDoneJsonType.ConnectionLine)&&(g.select_item.info=de,g.select_item.index=ie)},D=(de,ie,Y)=>{Y.preventDefault(),Y.stopPropagation(),!((i.intention===EGlobalStoreIntention.Connection||i.intention===EGlobalStoreIntention.SetConnectionLineNode)&&de.type===EDoneJsonType.ConnectionLine)&&(g.connection_panel=!1,g.connection_line=!1,g.select_item.info=null,g.select_item.index=-1)},z=de=>{var kt,Dt,Fe,$e,Cn,Lt,In,Et,Ne,pe,At,Ve,xe,ze,Pt,hn;if(i.mouse_info.state!=EMouseInfoState.Down&&i.intention!==EGlobalStoreIntention.Connection)return;const{clientX:ie,clientY:Y}=de;i.mouse_info.new_position_x=Math.round((ie-a.canvasInfo.left)/o.svg.scale),i.mouse_info.new_position_y=Math.round((Y-a.canvasInfo.top)/o.svg.scale);const Ie=Math.round(i.mouse_info.new_position_x-i.mouse_info.position_x+i.mouse_info.now_position_x),Oe=Math.round(i.mouse_info.new_position_y-i.mouse_info.position_y+i.mouse_info.now_position_y);if((kt=i.handle_svg_info)!=null&&kt.info&&(i.intention===EGlobalStoreIntention.Select||i.intention===EGlobalStoreIntention.Move)){if(i.handle_svg_info.info.x=Ie,i.handle_svg_info.info.y=Oe,i.handle_svg_info.info.client={x:Ie,y:Oe},i.intention=EGlobalStoreIntention.Move,moveHandlePoint(i.handle_svg_info.info),moveAnchors(i.handle_svg_info.info),i.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((Dt=i.handle_svg_info.info.bind_anchors)!=null&&Dt.start){let ae=null;for(let le of i.done_json)le.id===(($e=(Fe=i.handle_svg_info.info.bind_anchors)==null?void 0:Fe.start)==null?void 0:$e.target_id)&&(ae=le);ae&&moveAnchors(ae)}if((Cn=i.handle_svg_info.info.bind_anchors)!=null&&Cn.end){let ae=null;for(let le of i.done_json)le.id===((In=(Lt=i.handle_svg_info.info.bind_anchors)==null?void 0:Lt.end)==null?void 0:In.target_id)&&(ae=le);ae&&moveAnchors(ae)}}}else if(i.intention===EGlobalStoreIntention.MoveCanvas)a.center_offset.x=Ie,a.center_offset.y=Oe;else if(i.intention===EGlobalStoreIntention.SelectArea)v.value.b.x=i.mouse_info.new_position_x-a.center_offset.x,v.value.b.y=i.mouse_info.new_position_y-a.center_offset.y;else if(i.intention===EGlobalStoreIntention.GroupMove){_=!0;for(let ae of i.done_json)if(ae.selected&&ae.old_position){const le=Math.round(i.mouse_info.new_position_x-i.mouse_info.position_x+ae.old_position.x),re=Math.round(i.mouse_info.new_position_y-i.mouse_info.position_y+ae.old_position.y);if(ae.x=le,ae.y=re,ae.client={x:le,y:re},moveHandlePoint(ae),moveAnchors(ae),ae.type===EDoneJsonType.ConnectionLine&&((Et=ae.bind_anchors)!=null&&Et.end)){let V=null;for(let $ of i.done_json)$.id===((pe=(Ne=ae.bind_anchors)==null?void 0:Ne.end)==null?void 0:pe.target_id)&&(V=$);V&&moveAnchors(V)}}}else if(i.intention===EGlobalStoreIntention.Zoom){if(!i.handle_svg_info)return;const ae={x:i.mouse_info.new_position_x-a.center_offset.x,y:i.mouse_info.new_position_y-a.center_offset.y};let le={width:0,height:0,is_old_width:!1,is_old_height:!1};if(i.scale_info.type===EScaleInfoType.TopLeft?le=calculateLeftTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.TopRight?le=calculateRightTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.BottomRight?le=calculateRightBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.BottomLeft?le=calculateLeftBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.TopCenter?le=calculateTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.Right?le=calculateRight(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.BottomCenter?le=calculateBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.Left&&(le=calculateLeft(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client)),i.handle_svg_info&&le.width>0&&le.height>0){const re=le.is_old_width?1:parseFloat((le.width/i.handle_svg_info.info.actual_bound.width).toFixed(3)),V=le.is_old_height?1:parseFloat((le.height/i.handle_svg_info.info.actual_bound.height).toFixed(3)),$=getCenterPoint(ae,i.scale_info.symmetric_point);re>0&&i.scale_info.type!==EScaleInfoType.TopCenter&&i.scale_info.type!==EScaleInfoType.BottomCenter&&(i.handle_svg_info.info.scale_x=re,i.handle_svg_info.info.x=Math.round(getSvgNowPosition(i.handle_svg_info.info.center_position.x,$.x,i.handle_svg_info.info.client.x))),V>0&&i.scale_info.type!==EScaleInfoType.Left&&i.scale_info.type!==EScaleInfoType.Right&&(i.handle_svg_info.info.scale_y=V,i.handle_svg_info.info.y=Math.round(getSvgNowPosition(i.handle_svg_info.info.center_position.y,$.y,i.handle_svg_info.info.client.y)))}}else if(i.intention===EGlobalStoreIntention.Rotate){if(!i.handle_svg_info)return;const ae=Math.atan2(i.mouse_info.position_y-i.handle_svg_info.info.y,i.mouse_info.position_x-i.handle_svg_info.info.x)/(Math.PI/180),le=Math.atan2(i.mouse_info.new_position_y-a.center_offset.y-i.handle_svg_info.info.y,i.mouse_info.new_position_x-a.center_offset.x-i.handle_svg_info.info.x)/(Math.PI/180);i.handle_svg_info.info.rotate=parseFloat((i.rotate_info.angle+le-ae).toFixed(2))}else if(i.intention===EGlobalStoreIntention.Connection&&i.handle_svg_info){const ae=(At=i.handle_svg_info)==null?void 0:At.info.props.point_position.val.length,le=i.mouse_info.new_position_x-i.mouse_info.position_x-a.center_offset.x,re=i.mouse_info.new_position_y-i.mouse_info.position_y-a.center_offset.y,V=i.handle_svg_info.info.props.point_position.val[ae-2],$=((xe=(Ve=i.handle_svg_info)==null?void 0:Ve.info.props.point_r)==null?void 0:xe.val)+2||4;let he=V.x<le?-$:V.x>le?$:0,Ue=V.y<re?-$:V.y>re?$:0;de.ctrlKey?i.handle_svg_info.info.props.point_position.val[ae-1]={x:V.x,y:re+Ue}:de.shiftKey?i.handle_svg_info.info.props.point_position.val[ae-1]={x:le+he,y:V.y}:i.handle_svg_info.info.props.point_position.val[ae-1]={x:le+he,y:re+Ue}}else if(i.intention===EGlobalStoreIntention.SetConnectionLineNode&&i.handle_svg_info){!S&&(i.connection_line_node_info.point_index===i.handle_svg_info.info.props.point_position.val.length-1||i.connection_line_node_info.point_index===0)&&(S=!0);const ae=(ze=i.handle_svg_info)==null?void 0:ze.info.props.point_position.val.length,le=getSvgNowPosition(i.mouse_info.position_x,i.mouse_info.new_position_x,i.connection_line_node_info.init_pos.x),re=getSvgNowPosition(i.mouse_info.position_y,i.mouse_info.new_position_y,i.connection_line_node_info.init_pos.y),V=i.handle_svg_info.info.props.point_position.val[ae-2],$=((hn=(Pt=i.handle_svg_info)==null?void 0:Pt.info.props.point_r)==null?void 0:hn.val)+2||4;let he=V.x<le?-$:V.x>le?$:0,Ue=V.y<re?-$:V.y>re?$:0;i.handle_svg_info.info.props.point_position.val[i.connection_line_node_info.point_index]={x:le+he,y:re+Ue}}},j=()=>{var de,ie,Y,Ie;if(i.mouse_info.state==EMouseInfoState.Down){if((de=i.handle_svg_info)!=null&&de.info&&i.intention==EGlobalStoreIntention.Move)setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.intention=EGlobalStoreIntention.None,i.setDoneJson(i.done_json);else if(i.intention==EGlobalStoreIntention.GroupMove)_&&(_=!1,i.intention=EGlobalStoreIntention.None);else if((ie=i.handle_svg_info)!=null&&ie.info&&i.intention==EGlobalStoreIntention.Zoom)i.handle_svg_info.info.client={x:i.handle_svg_info.info.x,y:i.handle_svg_info.info.y},i.intention=EGlobalStoreIntention.None,setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setDoneJson(i.done_json);else if(i.intention===EGlobalStoreIntention.Rotate&&((Y=i.handle_svg_info)!=null&&Y.info))setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setDoneJson(i.done_json),i.intention=EGlobalStoreIntention.None;else{if(i.intention===EGlobalStoreIntention.Connection)return;if(i.intention===EGlobalStoreIntention.SetConnectionLineNode)S&&((Ie=i.handle_svg_info)!=null&&Ie.info.bind_anchors)&&(i.connection_line_node_info.point_index===0?i.handle_svg_info.info.bind_anchors.start=null:i.handle_svg_info.info.bind_anchors.end=null),i.intention=EGlobalStoreIntention.None,S=!1;else if(i.intention===EGlobalStoreIntention.SelectArea){i.setHandleSvgInfo(null);for(let Oe of i.done_json){const kt=y.value;Oe.selected=Oe.x>kt.x&&Oe.x<kt.x+kt.with&&Oe.y>kt.y&&Oe.y<kt.y+kt.height}i.intention=EGlobalStoreIntention.None}else i.intention!=EGlobalStoreIntention.Select&&(i.intention=EGlobalStoreIntention.None)}i.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},c.display=!1}},oe=de=>{const{clientX:ie,clientY:Y}=de;if(i.intention===EGlobalStoreIntention.Connection){i.handle_svg_info||createLine(de),i.handle_svg_info&&(de.button===0?i.handle_svg_info.info.props.point_position.val.length!==1?i.handle_svg_info.info.props.point_position.val.push({x:i.mouse_info.new_position_x-i.mouse_info.position_x-a.center_offset.x,y:i.mouse_info.new_position_y-i.mouse_info.position_y-a.center_offset.y}):i.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):de.button===2&&(i.intention=EGlobalStoreIntention.None,setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setHandleSvgInfo(null)));return}de.button===0?(i.intention=EGlobalStoreIntention.SelectArea,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),position_y:Math.round((Y-a.canvasInfo.top)/o.svg.scale-a.center_offset.y),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},v.value={a:{x:i.mouse_info.position_x,y:i.mouse_info.position_y},b:{x:0,y:0}}):de.button===2&&(i.intention=EGlobalStoreIntention.MoveCanvas,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y-a.canvasInfo.top)/o.svg.scale),now_position_x:a.center_offset.x,now_position_y:a.center_offset.y,new_position_x:0,new_position_y:0})};function L(de){de!=null&&de.wheelDelta&&(de.wheelDelta>0?o.svg.scale=parseFloat((o.svg.scale+.1).toFixed(1)):o.svg.scale=parseFloat((o.svg.scale-.1).toFixed(1)))}const F=de=>{de.stopPropagation(),de.preventDefault()},O=(de,ie,Y)=>{i.intention!==EGlobalStoreIntention.Connection&&f.value&&(i.intention=EGlobalStoreIntention.ContextMenu,i.setHandleSvgInfo(de,ie),f.value.style.left=Y.pageX+"px",f.value.style.top=Y.pageY+"px",c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!0,ie===i.done_json.length-1&&(c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=!1),ie===0&&(c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!1),c.display=!0)},ue=(de,ie,Y)=>({x:parseFloat((de.x-de.width/2*ie+de.width/2).toFixed(1)),y:parseFloat((de.y-de.height/2*Y+de.height/2).toFixed(1)),width:parseFloat((de.width*ie).toFixed(1)),height:parseFloat((de.height*Y).toFixed(1))}),_e=de=>{de.preventDefault();let ie=[];if(!de.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(de.key)>-1&&(A.value?ie=i.done_json.map((Y,Ie)=>({selected:Y.selected,i:Ie})).filter(Y=>Y.selected).map(Y=>Y.i):i.handle_svg_info&&ie.push(i.handle_svg_info.index)),!de.ctrlKey&&de.key=="ArrowUp"){for(let Y of ie)i.done_json[Y].y-=1,i.done_json[Y].client.y-=1,moveHandlePoint(i.done_json[Y],0,-1),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowDown"){for(let Y of ie)i.done_json[Y].y+=1,i.done_json[Y].client.y+=1,moveHandlePoint(i.done_json[Y],0,1),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowLeft"){for(let Y of ie)i.done_json[Y].x-=1,i.done_json[Y].client.x-=1,moveHandlePoint(i.done_json[Y],-1,0),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowRight"){for(let Y of ie)i.done_json[Y].x+=1,i.done_json[Y].client.x+=1,moveHandlePoint(i.done_json[Y],1,0),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else de.ctrlKey&&de.key.toLowerCase()=="c"?c.onContextMenuClick(EContextMenuInfoType.Copy):!de.ctrlKey&&de.key=="Delete"?A.value?(i.setDoneJson(i.done_json.filter(Y=>!Y.selected)),i.setHandleSvgInfo(i.done_json[i.done_json.length-1],i.done_json.length-1)):c.onContextMenuClick(EContextMenuInfoType.Delete):de.ctrlKey&&de.key=="ArrowUp"?c.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):de.ctrlKey&&de.key=="ArrowDown"?c.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):de.ctrlKey&&de.key=="ArrowLeft"?c.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):de.ctrlKey&&de.key=="ArrowRight"?c.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):de.ctrlKey&&de.shiftKey&&de.key.toLowerCase()=="z"?u.topRedoBtnClick():de.ctrlKey&&de.key.toLowerCase()=="z"?u.topUndoBtnClick():de.ctrlKey&&de.key.toLowerCase()=="delete"&&(i.done_json.length<=0||i.setDoneJson([]))},Ce=()=>{setSvgActualInfo(i.done_json[i.handle_svg_info.index],!0)};return vue.onMounted(()=>{var de;(de=d.value)==null||de.focus(),vue.nextTick(function(){var Y;const ie=(Y=d.value)==null?void 0:Y.getBoundingClientRect();a.canvasInfo={height:(ie==null?void 0:ie.height)||0,with:(ie==null?void 0:ie.width)||0,top:(ie==null?void 0:ie.top)||0,left:(ie==null?void 0:ie.left)||0}})}),n({onCanvasMouseUp:j}),(de,ie)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{class:"canvas",tabindex:"0",ref_key:"canvasRef",ref:d,onDrop:b,onDragenter:T,onDragover:w,onMousedown:oe,onMousemove:z,onMouseup:j,onContextmenu:F,onKeydown:_e,onMousewheel:L},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(o).svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_1$c,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_2$9),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_3$8),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_4$4),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_5$2)])]),vue.unref(o).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_6)):vue.createCommentVNode("",!0),vue.createElementVNode("g",{transform:`translate(${vue.unref(a).center_offset.x*vue.unref(o).svg.scale},${vue.unref(a).center_offset.y*vue.unref(o).svg.scale})rotate(0)scale(${vue.unref(o).svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(i).done_json,(Y,Ie)=>{var Oe,kt,Dt,Fe,$e,Cn;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:Y.id,transform:`translate(${Y.x},${Y.y})rotate(0)scale(1)`,onMousewheel:ie[0]||(ie[0]=(...Lt)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...Lt))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(Y)}`)},[vue.createElementVNode("g",{transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2})rotate(${Y.rotate}) scale(1) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`,onMousedown:Lt=>x(Y,Ie,Lt),onMouseup:Lt=>k(Y,Ie,Lt),onMouseenter:Lt=>M(Y,Ie,Lt),onMouseleave:Lt=>D(Y,Ie,Lt),onContextmenu:Lt=>O(Y,Ie,Lt)},[Y.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$y,{key:0,"item-info":Y,"point-visible":vue.unref(g).connection_line&&((Oe=vue.unref(g).select_item.info)==null?void 0:Oe.id)==Y.id},null,8,["item-info","point-visible"])):Y.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${Y.name}`},vue.unref(prosToVBind)(Y),{width:"100",height:"100",id:Y.id,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),null,16,_hoisted_10)):Y.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Y.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(Y),{width:"100",height:"100",id:Y.id,onResize:Ce,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),null,16,["id","transform"])):Y.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},ue(Y.actual_bound,Y.scale_x,Y.scale_y),{id:`foreign-object${Y.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Y.tag),vue.mergeProps(vue.unref(prosToVBind)(Y),{id:Y.id,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(Y.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_11)):Y.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:Y.id,x1:Y.props.start_x.val,y1:Y.props.start_y.val,x2:Y.props.end_x.val,y2:Y.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_12$1)):vue.createCommentVNode("",!0),Y.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${Y.id}`,fill:"black","fill-opacity":"0"},ue(Y.actual_bound,Y.scale_x,Y.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!Y.selected&&(vue.unref(i).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Move&&((kt=vue.unref(i).handle_svg_info)==null?void 0:kt.info.id)==Y.id,"svg-item-select":vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select&&((Dt=vue.unref(i).handle_svg_info)==null?void 0:Dt.info.id)==Y.id,"svg-item-in-group":Y.selected}}),null,16,_hoisted_13)):vue.createCommentVNode("",!0),((Fe=vue.unref(i).handle_svg_info)==null?void 0:Fe.info.id)===Y.id&&vue.unref(g).handle_panel&&Y.type!==vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":Y},null,8,["item-info"])):vue.createCommentVNode("",!0),!Y.selected&&(($e=vue.unref(g).select_item.info)==null?void 0:$e.id)==Y.id&&vue.unref(g).connection_panel&&Y.config.have_anchor&&vue.unref(i).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(i).intention!==vue.unref(EGlobalStoreIntention).Select||Y.id!==((Cn=vue.unref(i).handle_svg_info)==null?void 0:Cn.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:F,"item-info":Y},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_9)],2)],40,_hoisted_8)),[[vue.vShow,Y.display]])}),128)),vue.createElementVNode("rect",{x:vue.unref(y).x,y:vue.unref(y).y,height:vue.unref(y).height,width:vue.unref(y).with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_14)],8,_hoisted_7)],4))],544),vue.withDirectives(vue.createElementVNode("ul",{ref_key:"contextMenuRef",ref:f,class:"contextMenu"},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(c).info,(Y,Ie)=>(vue.openBlock(),vue.createElementBlock("li",{key:Y.title,onClick:Oe=>vue.unref(c).onContextMenuClick(Ie)},[vue.createElementVNode("p",{class:vue.normalizeClass(Y.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(Y.title)+" ",1),vue.createElementVNode("span",_hoisted_16$1,vue.toDisplayString(Y.hot_key),1)],2)],8,_hoisted_15))),128))],512),[[vue.vShow,vue.unref(c).display]])],64))}}),centerPanel_vue_vue_type_style_index_0_scoped_97a3211c_lang="",CenterPanel=_export_sfc$1(_sfc_main$x,[["__scopeId","data-v-97a3211c"]]);/*! Element Plus Icons Vue v2.1.0 */var export_helper_default=(r,n)=>{let i=r.__vccOpts||r;for(let[o,a]of n)i[o]=a;return i},aim_vue_vue_type_script_lang_default={name:"Aim"},_hoisted_12={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_22=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_32=vue.createElementVNode("path",{fill:"currentColor",d:"M512 96a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V128a32 32 0 0 1 32-32zm0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32zM96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32zm576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32z"},null,-1),_hoisted_42=[_hoisted_22,_hoisted_32];function _sfc_render2(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_12,_hoisted_42)}var aim_default=export_helper_default(aim_vue_vue_type_script_lang_default,[["render",_sfc_render2],["__file","aim.vue"]]),arrow_down_vue_vue_type_script_lang_default={name:"ArrowDown"},_hoisted_16={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_26=vue.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"},null,-1),_hoisted_36=[_hoisted_26];function _sfc_render6(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_16,_hoisted_36)}var arrow_down_default=export_helper_default(arrow_down_vue_vue_type_script_lang_default,[["render",_sfc_render6],["__file","arrow-down.vue"]]),circle_check_vue_vue_type_script_lang_default={name:"CircleCheck"},_hoisted_149={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_249=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_348=vue.createElementVNode("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"},null,-1),_hoisted_415=[_hoisted_249,_hoisted_348];function _sfc_render49(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_149,_hoisted_415)}var circle_check_default=export_helper_default(circle_check_vue_vue_type_script_lang_default,[["render",_sfc_render49],["__file","circle-check.vue"]]),circle_close_vue_vue_type_script_lang_default={name:"CircleClose"},_hoisted_151={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_251=vue.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"},null,-1),_hoisted_350=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_416=[_hoisted_251,_hoisted_350];function _sfc_render51(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_151,_hoisted_416)}var circle_close_default=export_helper_default(circle_close_vue_vue_type_script_lang_default,[["render",_sfc_render51],["__file","circle-close.vue"]]),close_vue_vue_type_script_lang_default={name:"Close"},_hoisted_156={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_256=vue.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"},null,-1),_hoisted_355=[_hoisted_256];function _sfc_render56(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_156,_hoisted_355)}var close_default=export_helper_default(close_vue_vue_type_script_lang_default,[["render",_sfc_render56],["__file","close.vue"]]),hide_vue_vue_type_script_lang_default={name:"Hide"},_hoisted_1133={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2133=vue.createElementVNode("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"},null,-1),_hoisted_3132=vue.createElementVNode("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"},null,-1),_hoisted_438=[_hoisted_2133,_hoisted_3132];function _sfc_render133(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1133,_hoisted_438)}var hide_default=export_helper_default(hide_vue_vue_type_script_lang_default,[["render",_sfc_render133],["__file","hide.vue"]]),loading_vue_vue_type_script_lang_default={name:"Loading"},_hoisted_1150={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2150=vue.createElementVNode("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"},null,-1),_hoisted_3149=[_hoisted_2150];function _sfc_render150(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1150,_hoisted_3149)}var loading_default=export_helper_default(loading_vue_vue_type_script_lang_default,[["render",_sfc_render150],["__file","loading.vue"]]),view_vue_vue_type_script_lang_default={name:"View"},_hoisted_1283={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2283=vue.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1),_hoisted_3282=[_hoisted_2283];function _sfc_render283(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1283,_hoisted_3282)}var view_default=export_helper_default(view_vue_vue_type_script_lang_default,[["render",_sfc_render283],["__file","view.vue"]]),MapShim=function(){if(typeof Map<"u")return Map;function r(n,i){var o=-1;return n.some(function(a,u){return a[0]===i?(o=u,!0):!1}),o}return function(){function n(){this.__entries__=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),n.prototype.get=function(i){var o=r(this.__entries__,i),a=this.__entries__[o];return a&&a[1]},n.prototype.set=function(i,o){var a=r(this.__entries__,i);~a?this.__entries__[a][1]=o:this.__entries__.push([i,o])},n.prototype.delete=function(i){var o=this.__entries__,a=r(o,i);~a&&o.splice(a,1)},n.prototype.has=function(i){return!!~r(this.__entries__,i)},n.prototype.clear=function(){this.__entries__.splice(0)},n.prototype.forEach=function(i,o){o===void 0&&(o=null);for(var a=0,u=this.__entries__;a<u.length;a++){var c=u[a];i.call(o,c[1],c[0])}},n}()}(),isBrowser=typeof window<"u"&&typeof document<"u"&&window.document===document,global$1=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),requestAnimationFrame$1=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(global$1):function(r){return setTimeout(function(){return r(Date.now())},1e3/60)}}(),trailingTimeout=2;function throttle(r,n){var i=!1,o=!1,a=0;function u(){i&&(i=!1,r()),o&&f()}function c(){requestAnimationFrame$1(u)}function f(){var d=Date.now();if(i){if(d-a<trailingTimeout)return;o=!0}else i=!0,o=!1,setTimeout(c,n);a=d}return f}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported=typeof MutationObserver<"u",ResizeObserverController=function(){function r(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=throttle(this.refresh.bind(this),REFRESH_DELAY)}return r.prototype.addObserver=function(n){~this.observers_.indexOf(n)||this.observers_.push(n),this.connected_||this.connect_()},r.prototype.removeObserver=function(n){var i=this.observers_,o=i.indexOf(n);~o&&i.splice(o,1),!i.length&&this.connected_&&this.disconnect_()},r.prototype.refresh=function(){var n=this.updateObservers_();n&&this.refresh()},r.prototype.updateObservers_=function(){var n=this.observers_.filter(function(i){return i.gatherActive(),i.hasActive()});return n.forEach(function(i){return i.broadcastActive()}),n.length>0},r.prototype.connect_=function(){!isBrowser||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},r.prototype.disconnect_=function(){!isBrowser||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},r.prototype.onTransitionEnd_=function(n){var i=n.propertyName,o=i===void 0?"":i,a=transitionKeys.some(function(u){return!!~o.indexOf(u)});a&&this.refresh()},r.getInstance=function(){return this.instance_||(this.instance_=new r),this.instance_},r.instance_=null,r}(),defineConfigurable=function(r,n){for(var i=0,o=Object.keys(n);i<o.length;i++){var a=o[i];Object.defineProperty(r,a,{value:n[a],enumerable:!1,writable:!1,configurable:!0})}return r},getWindowOf=function(r){var n=r&&r.ownerDocument&&r.ownerDocument.defaultView;return n||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(r){return parseFloat(r)||0}function getBordersSize(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return n.reduce(function(o,a){var u=r["border-"+a+"-width"];return o+toFloat(u)},0)}function getPaddings(r){for(var n=["top","right","bottom","left"],i={},o=0,a=n;o<a.length;o++){var u=a[o],c=r["padding-"+u];i[u]=toFloat(c)}return i}function getSVGContentRect(r){var n=r.getBBox();return createRectInit(0,0,n.width,n.height)}function getHTMLElementContentRect(r){var n=r.clientWidth,i=r.clientHeight;if(!n&&!i)return emptyRect;var o=getWindowOf(r).getComputedStyle(r),a=getPaddings(o),u=a.left+a.right,c=a.top+a.bottom,f=toFloat(o.width),d=toFloat(o.height);if(o.boxSizing==="border-box"&&(Math.round(f+u)!==n&&(f-=getBordersSize(o,"left","right")+u),Math.round(d+c)!==i&&(d-=getBordersSize(o,"top","bottom")+c)),!isDocumentElement(r)){var p=Math.round(f+u)-n,h=Math.round(d+c)-i;Math.abs(p)!==1&&(f-=p),Math.abs(h)!==1&&(d-=h)}return createRectInit(a.left,a.top,f,d)}var isSVGGraphicsElement=function(){return typeof SVGGraphicsElement<"u"?function(r){return r instanceof getWindowOf(r).SVGGraphicsElement}:function(r){return r instanceof getWindowOf(r).SVGElement&&typeof r.getBBox=="function"}}();function isDocumentElement(r){return r===getWindowOf(r).document.documentElement}function getContentRect(r){return isBrowser?isSVGGraphicsElement(r)?getSVGContentRect(r):getHTMLElementContentRect(r):emptyRect}function createReadOnlyRect(r){var n=r.x,i=r.y,o=r.width,a=r.height,u=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(u.prototype);return defineConfigurable(c,{x:n,y:i,width:o,height:a,top:i,right:n+o,bottom:a+i,left:n}),c}function createRectInit(r,n,i,o){return{x:r,y:n,width:i,height:o}}var ResizeObservation=function(){function r(n){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=n}return r.prototype.isActive=function(){var n=getContentRect(this.target);return this.contentRect_=n,n.width!==this.broadcastWidth||n.height!==this.broadcastHeight},r.prototype.broadcastRect=function(){var n=this.contentRect_;return this.broadcastWidth=n.width,this.broadcastHeight=n.height,n},r}(),ResizeObserverEntry=function(){function r(n,i){var o=createReadOnlyRect(i);defineConfigurable(this,{target:n,contentRect:o})}return r}(),ResizeObserverSPI=function(){function r(n,i,o){if(this.activeObservations_=[],this.observations_=new MapShim,typeof n!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=n,this.controller_=i,this.callbackCtx_=o}return r.prototype.observe=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof getWindowOf(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var i=this.observations_;i.has(n)||(i.set(n,new ResizeObservation(n)),this.controller_.addObserver(this),this.controller_.refresh())}},r.prototype.unobserve=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof getWindowOf(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var i=this.observations_;i.has(n)&&(i.delete(n),i.size||this.controller_.removeObserver(this))}},r.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},r.prototype.gatherActive=function(){var n=this;this.clearActive(),this.observations_.forEach(function(i){i.isActive()&&n.activeObservations_.push(i)})},r.prototype.broadcastActive=function(){if(this.hasActive()){var n=this.callbackCtx_,i=this.activeObservations_.map(function(o){return new ResizeObserverEntry(o.target,o.broadcastRect())});this.callback_.call(n,i,n),this.clearActive()}},r.prototype.clearActive=function(){this.activeObservations_.splice(0)},r.prototype.hasActive=function(){return this.activeObservations_.length>0},r}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function r(n){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=ResizeObserverController.getInstance(),o=new ResizeObserverSPI(n,i,this);observers.set(this,o)}return r}();["observe","unobserve","disconnect"].forEach(function(r){ResizeObserver$1.prototype[r]=function(){var n;return(n=observers.get(this))[r].apply(n,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}();const Events=["blur","input","change","changeSelectionStyle","changeSession","copy","focus","paste"],VAceEditor=vue.defineComponent({props:{value:{type:String,required:!0},lang:{type:String,default:"text"},theme:{type:String,default:"chrome"},options:Object,placeholder:String,readonly:Boolean,wrap:Boolean,printMargin:{type:[Boolean,Number],default:!0},minLines:Number,maxLines:Number},emits:["update:value","init",...Events],render(){return vue.h("div")},mounted(){const r=this._editor=vue.markRaw(ace.edit(this.$el,{placeholder:this.placeholder,readOnly:this.readonly,value:this.value,mode:"ace/mode/"+this.lang,theme:"ace/theme/"+this.theme,wrap:this.wrap,printMargin:this.printMargin,useWorker:!1,minLines:this.minLines,maxLines:this.maxLines,...this.options}));this._contentBackup=this.value,this._isSettingContent=!1,r.on("change",()=>{if(this._isSettingContent)return;const n=r.getValue();this._contentBackup=n,this.$emit("update:value",n)}),Events.forEach(n=>{const i="on"+vue.capitalize(n);typeof this.$.vnode.props[i]=="function"&&r.on(n,this.$emit.bind(this,n))}),this._ro=new index$1(()=>r.resize()),this._ro.observe(this.$el),this.$emit("init",r)},beforeUnmount(){var r,n;(r=this._ro)===null||r===void 0||r.disconnect(),(n=this._editor)===null||n===void 0||n.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()}},watch:{value(r){if(this._contentBackup!==r){try{this._isSettingContent=!0,this._editor.setValue(r,1)}finally{this._isSettingContent=!1}this._contentBackup=r}},theme(r){this._editor.setTheme("ace/theme/"+r)},options(r){this._editor.setOptions(r)},readonly(r){this._editor.setReadOnly(r)},placeholder(r){this._editor.setOption("placeholder",r)},wrap(r){this._editor.setWrapBehavioursEnabled(r)},printMargin(r){this._editor.setOption("printMargin",r)},lang(r){this._editor.setOption("mode","ace/mode/"+r)},minLines(r){this._editor.setOption("minLines",r)},maxLines(r){this._editor.setOption("maxLines",r)}}}),themeUrl2="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL3RoZW1lL2tyX3RoZW1lLmNzcyIsWyJyZXF1aXJlIiwiZXhwb3J0cyIsIm1vZHVsZSJdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpe21vZHVsZS5leHBvcnRzID0gIi5hY2Uta3ItdGhlbWUgLmFjZV9ndXR0ZXIge1xuICBiYWNrZ3JvdW5kOiAjMWMxOTE3O1xuICBjb2xvcjogI0ZDRkZFMFxufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfcHJpbnQtbWFyZ2luIHtcbiAgd2lkdGg6IDFweDtcbiAgYmFja2dyb3VuZDogIzFjMTkxN1xufVxuXG4uYWNlLWtyLXRoZW1lIHtcbiAgYmFja2dyb3VuZC1jb2xvcjogIzBCMEEwOTtcbiAgY29sb3I6ICNGQ0ZGRTBcbn1cblxuLmFjZS1rci10aGVtZSAuYWNlX2N1cnNvciB7XG4gIGNvbG9yOiAjRkY5OTAwXG59XG5cbi5hY2Uta3ItdGhlbWUgLmFjZV9tYXJrZXItbGF5ZXIgLmFjZV9zZWxlY3Rpb24ge1xuICBiYWNrZ3JvdW5kOiByZ2JhKDE3MCwgMCwgMjU1LCAwLjQ1KVxufVxuXG4uYWNlLWtyLXRoZW1lLmFjZV9tdWx0aXNlbGVjdCAuYWNlX3NlbGVjdGlvbi5hY2Vfc3RhcnQge1xuICBib3gtc2hhZG93OiAwIDAgM3B4IDBweCAjMEIwQTA5O1xufVxuXG4uYWNlLWtyLXRoZW1lIC5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lOwpleHBvcnRzLmNzc0NsYXNzID0gImFjZS1rci10aGVtZSI7CmV4cG9ydHMuY3NzVGV4dCA9IHJlcXVpcmUoIi4va3JfdGhlbWUuY3NzIik7CnZhciBkb20gPSByZXF1aXJlKCIuLi9saWIvZG9tIik7CmRvbS5pbXBvcnRDc3NTdHJpbmcoZXhwb3J0cy5jc3NUZXh0LCBleHBvcnRzLmNzc0NsYXNzLCBmYWxzZSk7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL3RoZW1lL2tyX3RoZW1lIl0sIGZ1bmN0aW9uKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBtb2R1bGUgPT0gIm9iamVjdCIgJiYgdHlwZW9mIGV4cG9ydHMgPT0gIm9iamVjdCIgJiYgbW9kdWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIA==",modeJsonUrl="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvbGliL29vcCIsImFjZS9tb2RlL3RleHRfaGlnaGxpZ2h0X3J1bGVzIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7InVzZSBzdHJpY3QiOwp2YXIgb29wID0gcmVxdWlyZSgiLi4vbGliL29vcCIpOwp2YXIgVGV4dEhpZ2hsaWdodFJ1bGVzID0gcmVxdWlyZSgiLi90ZXh0X2hpZ2hsaWdodF9ydWxlcyIpLlRleHRIaWdobGlnaHRSdWxlczsKdmFyIEpzb25IaWdobGlnaHRSdWxlcyA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuJHJ1bGVzID0gewogICAgICAgICJzdGFydCI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdG9rZW46ICJ2YXJpYWJsZSIsCiAgICAgICAgICAgICAgICByZWdleDogJ1siXSg/Oig/OlxcXFwuKXwoPzpbXiJcXFxcXSkpKj9bIl1cXHMqKD89OiknCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAnIicsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RyaW5nIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lm51bWVyaWMiLAogICAgICAgICAgICAgICAgcmVnZXg6ICIwW3hYXVswLTlhLWZBLUZdK1xcYiIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJjb25zdGFudC5udW1lcmljIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAiWystXT9cXGQrKD86KD86XFwuXFxkKik/KD86W2VFXVsrLV0/XFxkKyk/KT9cXGIiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29uc3RhbnQubGFuZ3VhZ2UuYm9vbGVhbiIsCiAgICAgICAgICAgICAgICByZWdleDogIig/OnRydWV8ZmFsc2UpXFxiIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbJ10oPzooPzpcXFxcLil8KD86W14nXFxcXF0pKSo/WyddIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbW1lbnQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXC9cXC8uKiQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5zdGFydCIsCiAgICAgICAgICAgICAgICByZWdleDogIlxcL1xcKiIsCiAgICAgICAgICAgICAgICBuZXh0OiAiY29tbWVudCIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5scGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbWyh7XSIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5ycGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbXFxdKX1dIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInB1bmN0dWF0aW9uLm9wZXJhdG9yIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAvWyxdLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXHMrIgogICAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAic3RyaW5nIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lmxhbmd1YWdlLmVzY2FwZSIsCiAgICAgICAgICAgICAgICByZWdleDogL1xcKD86eFswLTlhLWZBLUZdezJ9fHVbMC05YS1mQS1GXXs0fXxbIlxcXC9iZm5ydF0pLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInN0cmluZyIsCiAgICAgICAgICAgICAgICByZWdleDogJyJ8JCcsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RhcnQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIGRlZmF1bHRUb2tlbjogInN0cmluZyIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImNvbW1lbnQiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5lbmQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXCpcXC8iLAogICAgICAgICAgICAgICAgbmV4dDogInN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b24uZ2V0Q29tbWVudEZvbGRSYW5nZShyb3csIGkgKyBtYXRjaFswXS5sZW5ndGgsIDEpOwogICAgICAgICAgICBpZiAocmFuZ2UgJiYgIXJhbmdlLmlzTXVsdGlMaW5lKCkpIHsKICAgICAgICAgICAgICAgIGlmIChmb3JjZU11bHRpbGluZSkgewogICAgICAgICAgICAgICAgICAgIHJhbmdlID0gdGhpcy5nZXRTZWN0aW9uUmFuZ2Uoc2Vzc2lvbiwgcm93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZvbGRTdHlsZSAhPSAiYWxsIikKICAgICAgICAgICAgICAgICAgICByYW5nZSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgICAgIH0KICAgICAgICBpZiAoZm9sZFN0eWxlID09PSAibWFya2JlZ2luIikKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIHZhciBtYXRjaCA9IGxpbmUubWF0Y2godGhpcy5mb2xkaW5nU3RvcE1hcmtlcik7CiAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgIHZhciBpID0gbWF0Y2guaW5kZXggKyBtYXRjaFswXS5sZW5ndGg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsb3NpbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmdldENvbW1lbnRGb2xkUmFuZ2Uocm93LCBpLCAtMSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuZ2V0U2VjdGlvblJhbmdlID0gZnVuY3Rpb24gKHNlc3Npb24sIHJvdykgewogICAgICAgIHZhciBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgdmFyIHN0YXJ0SW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgdmFyIHN0YXJ0Um93ID0gcm93OwogICAgICAgIHZhciBzdGFydENvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIHJvdyA9IHJvdyArIDE7CiAgICAgICAgdmFyIGVuZFJvdyA9IHJvdzsKICAgICAgICB2YXIgbWF4Um93ID0gc2Vzc2lvbi5nZXRMZW5ndGgoKTsKICAgICAgICB3aGlsZSAoKytyb3cgPCBtYXhSb3cpIHsKICAgICAgICAgICAgbGluZSA9IHNlc3Npb24uZ2V0TGluZShyb3cpOwogICAgICAgICAgICB2YXIgaW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgICAgIGlmIChpbmRlbnQgPT09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChzdGFydEluZGVudCA+IGluZGVudCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB2YXIgc3ViUmFuZ2UgPSB0aGlzLmdldEZvbGRXaWRnZXRSYW5nZShzZXNzaW9uLCAiYWxsIiwgcm93KTsKICAgICAgICAgICAgaWYgKHN1YlJhbmdlKSB7CiAgICAgICAgICAgICAgICBpZiAoc3ViUmFuZ2Uuc3RhcnQucm93IDw9IHN0YXJ0Um93KSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJSYW5nZS5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgcm93ID0gc3ViUmFuZ2UuZW5kLnJvdzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0SW5kZW50ID09IGluZGVudCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVuZFJvdyA9IHJvdzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgc2Vzc2lvbi5nZXRMaW5lKGVuZFJvdykubGVuZ3RoKTsKICAgIH07CiAgICB0aGlzLmdldENvbW1lbnRSZWdpb25CbG9jayA9IGZ1bmN0aW9uIChzZXNzaW9uLCBsaW5lLCByb3cpIHsKICAgICAgICB2YXIgc3RhcnRDb2x1bW4gPSBsaW5lLnNlYXJjaCgvXHMqJC8pOwogICAgICAgIHZhciBtYXhSb3cgPSBzZXNzaW9uLmdldExlbmd0aCgpOwogICAgICAgIHZhciBzdGFydFJvdyA9IHJvdzsKICAgICAgICB2YXIgcmUgPSAvXlxzKig/OlwvXCp8XC9cL3wtLSkjPyhlbmQpP3JlZ2lvblxiLzsKICAgICAgICB2YXIgZGVwdGggPSAxOwogICAgICAgIHdoaWxlICgrK3JvdyA8IG1heFJvdykgewogICAgICAgICAgICBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgICAgIHZhciBtID0gcmUuZXhlYyhsaW5lKTsKICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChtWzFdKQogICAgICAgICAgICAgICAgZGVwdGgtLTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgZGVwdGgrKzsKICAgICAgICAgICAgaWYgKCFkZXB0aCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICB2YXIgZW5kUm93ID0gcm93OwogICAgICAgIGlmIChlbmRSb3cgPiBzdGFydFJvdykgewogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlKHN0YXJ0Um93LCBzdGFydENvbHVtbiwgZW5kUm93LCBsaW5lLmxlbmd0aCk7CiAgICAgICAgfQogICAgfTsKfSkuY2FsbChGb2xkTW9kZS5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uIixbInJlcXVpcmUiLCJleHBvcnRzIiw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IiLCAiSnNvbldvcmtlciIpOwogICAgICAgIHdvcmtlci5hdHRhY2hUb0RvY3VtZW50KHNlc3Npb24uZ2V0RG9jdW1lbnQoKSk7CiAgICAgICAgd29ya2VyLm9uKCJhbm5vdGF0ZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHNlc3Npb24uc2V0QW5ub3RhdGlvbnMoZS5kYXRhKTsKICAgICAgICB9KTsKICAgICAgICB3b3JrZXIub24oInRlcm1pbmF0ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgc2Vzc2lvbi5jbGVhckFubm90YXRpb25zKCk7CiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHdvcmtlcjsKICAgIH07CiAgICB0aGlzLiRpZCA9ICJhY2UvbW9kZS9qc29uIjsKfSkuY2FsbChNb2RlLnByb3RvdHlwZSk7CmV4cG9ydHMuTW9kZSA9IE1vZGU7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL21vZGUvanNvbiJdLCBmdW5jdGlvbihtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbW9kdWxlID09ICJvYmplY3QiICYmIHR5cGVvZiBleHBvcnRzID09ICJvYmplY3QiICYmIG1vZHVsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICA=",workerJsonUrl="data:application/javascript;base64,Im5vIHVzZSBzdHJpY3QiOwohKGZ1bmN0aW9uKHdpbmRvdykgewppZiAodHlwZW9mIHdpbmRvdy53aW5kb3cgIT0gInVuZGVmaW5lZCIgJiYgd2luZG93LmRvY3VtZW50KQogICAgcmV0dXJuOwppZiAod2luZG93LnJlcXVpcmUgJiYgd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ZhY3RvcnksCiAgICAgICAgICAgIGluaXRpYWxpemVkOiB0cnVlCiAgICAgICAgfTsKICAgICAgICByZXR1cm47CiAgICB9CgogICAgaWYgKCFkZXBzLmxlbmd0aCkKICAgICAgICAvLyBJZiB0aGVyZSBpcyBubyBkZXBlbmRlbmNpZXMsIHdlIGluamVjdCAicmVxdWlyZSIsICJleHBvcnRzIiBhbmQKICAgICAgICAvLyAibW9kdWxlIiBhcyBkZXBlbmRlbmNpZXMsIHRvIHByb3ZpZGUgQ29tbW9uSlMgY29tcGF0aWJpbGl0eS4KICAgICAgICBkZXBzID0gWyJyZXF1aXJlIiwgImV4cG9ydHMiLCAibW9kdWxlIl07CgogICAgdmFyIHJlcSA9IGZ1bmN0aW9uKGNoaWxkSWQpIHsKICAgICAgICByZXR1cm4gd2luZG93LnJlcXVpcmUoaWQsIGNoaWxkSWQpOwogICAgfTsKCiAgICB3aW5kb3cucmVxdWlyZS5tb2R1bGVzW2lkXSA9IHsKICAgICAgICBleHBvcnRzOiB7fSwKICAgICAgICBmYWN0b3J5OiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIG1vZHVsZSA9IHRoaXM7CiAgICAgICAgICAgIHZhciByZXR1cm5FeHBvcnRzID0gZmFjdG9yeS5hcHBseSh0aGlzLCBkZXBzLnNsaWNlKDAsIGZhY3RvcnkubGVuZ3RoKS5tYXAoZnVuY3Rpb24oZGVwKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKGRlcCkgewogICAgICAgICAgICAgICAgICAgIC8vIEJlY2F1c2UgInJlcXVpcmUiLCAiZXhwb3J0cyIgYW5kICJtb2R1bGUiIGFyZW4ndCBhY3R1YWwKICAgICAgICAgICAgICAgICAgICAvLyBkZXBlbmRlbmNpZXMsIHdlIG11c3QgaGFuZGxlIHRoZW0gc2VwZXJhdGVseS4KICAgICAgICAgICAgICAgICAgICBjYXNlICJyZXF1aXJlIjogcmV0dXJuIHJlcTsKICAgICAgICAgICAgICAgICAgICBjYXNlICJleHBvcnRzIjogcmV0dXJuIG1vZHVsZS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgIGNhc2UgIm1vZHVsZSI6ICByZXR1cm4gbW9kdWxlOwogICAgICAgICAgICAgICAgICAgIC8vIEJ1dCBmb3IgYWxsIG90aGVyIGRlcGVuZGVuY2llcywgd2UgY2FuIGp1c3QgZ28gYWhlYWQgYW5kCiAgICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSB0aGVtLgogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICByZXR1cm4gcmVxKGRlcCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgaWYgKHJldHVybkV4cG9ydHMpCiAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IHJldHVybkV4cG9ydHM7CiAgICAgICAgICAgIHJldHVybiBtb2R1bGU7CiAgICAgICAgfQogICAgfTsKfTsKd2luZG93LmRlZmluZS5hbWQgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9Owp3aW5kb3cuaW5pdEJhc2VVcmxzICA9IGZ1bmN0aW9uIGluaXRCYXNlVXJscyh0b3BMZXZlbE5hbWVzcGFjZXMpIHsKICAgIGZvciAodmFyIGkgaW4gdG9wTGV2ZWxOYW1lc3BhY2VzKQogICAgICAgIHRoaXMucmVxdWlyZS50bG5zW2ldID0gdG9wTGV2ZWxOYW1lc3BhY2VzW2ldOwp9OwoKd2luZG93LmluaXRTZW5kZXIgPSBmdW5jdGlvbiBpbml0U2VuZGVyKCkgewoKICAgIHZhciBFdmVudEVtaXR0ZXIgPSB3aW5kb3cucmVxdWlyZSgiYWNlL2xpYi9ldmVudF9lbWl0dGVyIikuRXZlbnRFbWl0dGVyOwogICAgdmFyIG9vcCA9IHdpbmRvdy5yZXF1aXJlKCJhY2UvbGliL29vcCIpOwogICAgCiAgICB2YXIgU2VuZGVyID0gZnVuY3Rpb24oKSB7fTsKICAgIAogICAgKGZ1bmN0aW9uKCkgewogICAgICAgIAogICAgICAgIG9vcC5pbXBsZW1lbnQodGhpcywgRXZlbnRFbWl0dGVyKTsKICAgICAgICAgICAgICAgIAogICAgICAgIHRoaXMuY2FsbGJhY2sgPSBmdW5jdGlvbihkYXRhLCBjYWxsYmFja0lkKSB7CiAgICAgICAgICAgIHBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIHR5cGU6ICJjYWxsIiwKICAgICAgICAgICAgICAgIGlkOiBjYWxsYmFja0lkLAogICAgICAgICAgICAgICAgZGF0YTogZGF0YQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgCiAgICAgICAgdGhpcy5lbWl0ID0gZnVuY3Rpb24obmFtZSwgZGF0YSkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiZXZlbnQiLAogICAgICAgICAgICAgICAgbmFtZTogbmFtZSwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICAKICAgIH0pLmNhbGwoU2VuZGVyLnByb3RvdHlwZSk7CiAgICAKICAgIHJldHVybiBuZXcgU2VuZGVyKCk7Cn07Cgp2YXIgbWFpbiA9IHdpbmRvdy5tYWluID0gbnVsbDsKdmFyIHNlbmRlciA9IHdpbmRvdy5zZW5kZXIgPSBudWxsOwoKd2luZG93Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKGUpIHsKICAgIHZhciBtc2cgPSBlLmRhdGE7CiAgICBpZiAobXNnLmV2ZW50ICYmIHNlbmRlcikgewogICAgICAgIHNlbmRlci5fc2lnbmFsKG1zZy5ldmVudCwgbXNnLmRhdGEpOwogICAgfQogICAgZWxzZSBpZiAobXNnLmNvbW1hbmQpIHsKICAgICAgICBpZiAobWFpblttc2cuY29tbWFuZF0pCiAgICAgICAgICAgIG1haW5bbXNnLmNvbW1hbmRdLmFwcGx5KG1haW4sIG1zZy5hcmdzKTsKICAgICAgICB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ydHMuYXBwbHlEZWx0YSA9IGZ1bmN0aW9uIChkb2NMaW5lcywgZGVsdGEsIGRvTm90VmFsaWRhdGUpIHsKICAgIHZhciByb3cgPSBkZWx0YS5zdGFydC5yb3c7CiAgICB2YXIgc3RhcnRDb2x1bW4gPSBkZWx0YS5zdGFydC5jb2x1bW47CiAgICB2YXIgbGluZSA9IGRvY0xpbmVzW3Jvd10gfHwgIiI7CiAgICBzd2l0Y2ggKGRlbHRhLmFjdGlvbikgewogICAgICAgIGNhc2UgImluc2VydCI6CiAgICAgICAgICAgIHZhciBsaW5lcyA9IGRlbHRhLmxpbmVzOwogICAgICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3ddID0gbGluZS5zdWJzdHJpbmcoMCwgc3RhcnRDb2x1bW4pICsgZGVsdGEubGluZXNbMF0gKyBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgYXJncyA9IFtyb3csIDFdLmNvbmNhdChkZWx0YS5saW5lcyk7CiAgICAgICAgICAgICAgICBkb2NMaW5lcy5zcGxpY2UuYXBwbHkoZG9jTGluZXMsIGFyZ3MpOwogICAgICAgICAgICAgICAgZG9jTGluZXNbcm93XSA9IGxpbmUuc3Vic3RyaW5nKDAsIHN0YXJ0Q29sdW1uKSArIGRvY0xpbmVzW3Jvd107CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3cgKyBkZWx0YS5saW5lcy5sZW5ndGggLSAxXSArPSBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAicmVtb3ZlIjoKICAgICAgICAgICAgdmFyIGVuZENvbHVtbiA9IGRlbHRhLmVuZC5jb2x1bW47CiAgICAgICAgICAgIHZhciBlbmRSb3cgPSBkZWx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HRoaXMuX2V2ZW50UmVnaXN0cnkgfHwge307CiAgICAgICAgdmFyIGxpc3RlbmVycyA9IHRoaXMuX2V2ZW50UmVnaXN0cnlbZXZlbnROYW1lXTsKICAgICAgICBpZiAoIWxpc3RlbmVycykKICAgICAgICAgICAgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdID0gW107CiAgICAgICAgaWYgKGxpc3RlbmVycy5pbmRleE9mKGNhbGxiYWNrKSA9PSAtMSkKICAgICAgICAgICAgbGlzdGVuZXJzW2NhcHR1cmluZyA/ICJ1bnNoaWZ0IiA6ICJwdXNoIl0oY2FsbGJhY2spOwogICAgICAgIHJldHVybiBjYWxsYmFjazsKICAgIH07CkV2ZW50RW1pdHRlci5vZmYgPQogICAgRXZlbnRFbWl0dGVyLnJlbW92ZUxpc3RlbmVyID0KICAgICAgICBFdmVudEVtaXR0ZXIucmVtb3ZlRXZlbnRMaXN0ZW5lciA9IGZ1bmN0aW9uIChldmVudE5hbWUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIHRoaXMuX2V2ZW50UmVnaXN0cnkgPSB0aGlzLl9ldmVudFJlZ2lzdHJ5IHx8IHt9OwogICAgICAgICAgICB2YXIgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdOwogICAgICAgICAgICBpZiAoIWxpc3RlbmVycykKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgdmFyIGluZGV4ID0gbGlzdGVuZXJzLmluZGV4T2YoY2FsbGJhY2spOwogICAgICAgICAgICBpZiAoaW5kZXggIT09IC0xKQogICAgICAgICAgICAgICAgbGlzdGVuZXJzLnNwbGljZShpbmRleCwgMSk7CiAgICAgICAgfTsKRXZlbnRFbWl0dGVyLnJlbW92ZUFsbExpc3RlbmVycyA9IGZ1bmN0aW9uIChldmVudE5hbWUpIHsKICAgIGlmICghZXZlbnROYW1lKQogICAgICAgIHRoaXMuX2V2ZW50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SByYW5nZS5zdGFydC5jb2x1bW4gJiYKICAgICAgICAgICAgdGhpcy5lbmQuY29sdW1uID09PSByYW5nZS5lbmQuY29sdW1uOwogICAgfTsKICAgIHRoaXMudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgcmV0dXJuICgiUmFuZ2U6IFsiICsgdGhpcy5zdGFydC5yb3cgKyAiLyIgKyB0aGlzLnN0YXJ0LmNvbHVtbiArCiAgICAgICAgICAgICJdIC0+IFsiICsgdGhpcy5lbmQucm93ICsgIi8iICsgdGhpcy5lbmQuY29sdW1uICsgIl0iKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMDsKICAgIH07CiAgICB0aGlzLmNvbXBhcmVSYW5nZSA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAsIGVuZCA9IHJhbmdlLmVuZCwgc3RhcnQgPSByYW5nZS5zdGFydDsKICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoZW5kLnJvdywgZW5kLmNvbHVtbik7CiAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiAoY21wID09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gLTEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlUG9pbnQgPSBmdW5jdGlvbiAocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbiAocmFuZ2UpIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlUG9pbnQocmFuZ2Uuc3RhcnQpID09IDAgJiYgdGhpcy5jb21wYXJlUG9pbnQocmFuZ2UuZW5kKSA9PSAwOwogICAgfTsKICAgIHRoaXMuaW50ZXJzZWN0cyA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmVSYW5nZShyYW5nZSk7CiAgICAgICAgcmV0dXJuIChjbXAgPT0gLTEgfHwgY21wID09IDAgfHwgY21wID09IDEpOwogICAgfTsKICAgIHRoaXMuaXNFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiB0aGlzLnN0YXJ0LnJvdyA9PSByb3cgJiYgdGhpcy5zdGFydC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuc2V0U3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IHJvdy5jb2x1bW47CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93LnJvdzsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5zZXRFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3cucm93OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSBjb2x1bW47CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuaW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc0VuZChyb3csIGNvbHVtbikgfHwgdGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlU3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuY29tcGFyZSA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICghdGhpcy5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgIGlmIChyb3cgPT09IHRoaXMuc3RhcnQucm93KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uIDwgdGhpcy5zdGFydC5jb2x1bW4gPyAtMSA6IChjb2x1bW4gPiB0aGlzLmVuZC5jb2x1bW4gPyAxIDogMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuc3RhcnQucm93KQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPj0gdGhpcy5zdGFydC5jb2x1bW4gPyAwIDogLTE7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uIDw9IHRoaXMuZW5kLmNvbHVtbiA/IDAgOiAxOwogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPT0gcm93ICYmIHRoaXMuZW5kLmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jbGlwUm93cyA9IGZ1bmN0aW9uIChmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLmVuZC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIGVuZCA9IHsgcm93OiBmaXJzdFJvdywgY29sdW1uOiAwIH07CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLnN0YXJ0LnJvdyA8IGZpcnN0Um93KQogICAgICAgICAgICB2YXIgc3RhcnQgPSB7IHJvdzogZmlyc3RSb3csIGNvbHVtbjogMCB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICB2YXIgY21wID0gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICBpZiAoY21wID09IDApCiAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKGNtcCA9PSAtMSkKICAgICAgICAgICAgdmFy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Wx0YS5lbmQ7IC8vIENvbGxhcHNlIGluc2VydCByYW5nZS4KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIocG9pbnQsIGRlbHRhU3RhcnQsIG1vdmVJZkVxdWFsKSkgewogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgcm93OiBwb2ludC5yb3csCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbiwgbm9DbGlwKSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBpZiAobm9DbGlwKSB7CiAgICAgICAgICAgIHBvcyA9IHsKICAgICAgICAgICAgICAgIHJvdzogcm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBjb2x1bW4KICAgICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvcyA9IHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQocm93LCBjb2x1bW4pOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5yb3cgPT0gcG9zLnJvdyAmJiB0aGl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iAgICAgICAgfTsKICAgIH0KICAgIHRoaXMuJGRldGVjdE5ld0xpbmUgPSBmdW5jdGlvbiAodGV4dCkgewogICAgICAgIHZhciBtYXRjaCA9IHRleHQubWF0Y2goL14uKj8oXHJcbnxccnxcbikvbSk7CiAgICAgICAgdGhpcy4kYXV0b05ld0xpbmUgPSBtYXRjaCA/IG1hdGNoWzFdIDogIlxuIjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgIHN3aXRjaCAodGhpcy4kbmV3TGluZU1vZGUpIHsKICAgICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgICAgICByZXR1cm4gIlxyXG4iOwogICAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgICAgIHJldHVybiAiXG4iOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJGF1dG9OZXdMaW5lIHx8ICJcbiI7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbiAobmV3TGluZU1vZGUpIHsKICAgICAgICBpZiAodGhpcy4kbmV3TGluZU1vZGUgPT09IG5ld0xpbmVNb2RlKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZXdMaW5lTW9kZTsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lTW9kZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICByZXR1cm4gdGhpcy4kbmV3TGluZU1vZGU7CiAgICB9OwogICAgdGh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CgpOwogICAgICAgIGlmIChyb3cgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcm93ID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24gKHBvcykgewogICAgICAgIHJldHVybiB7IHJvdzogcG9zLnJvdywgY29sdW1uOiBwb3MuY29sdW1uIH07CiAgICB9OwogICAgdGhpcy5wb3MgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLiRjbGlwUG9zaXRpb24gPSBmdW5jdGlvbiAocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbm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ICAgICAgICAgICAgcm93OiBzdGFydC5yb3cgKyBsaW5lcy5sZW5ndGggLSAxLAogICAgICAgICAgICBjb2x1bW46IChsaW5lcy5sZW5ndGggPT0gMSA/IHN0YXJ0LmNvbHVtbiA6IDApICsgbGluZXNbbGluZXMubGVuZ3RoIC0gMV0ubGVuZ3RoCiAgICAgICAgfTsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoewogICAgICAgICAgICBzdGFydDogc3RhcnQsCiAgICAgICAgICAgIGVuZDogZW5kLAogICAgICAgICAgICBhY3Rpb246ICJpbnNlcnQiLAogICAgICAgICAgICBsaW5lczogbGluZXMKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlID0gZnVuY3Rpb24gKHJhbmdlKSB7CiAgICAgICAgdmFyIHN0YXJ0ID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLnN0YXJ0LnJvdywgcmFuZ2Uuc3RhcnQuY29sdW1uKTsKICAgICAgICB2YXIgZW5kID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLmVuZC5yb3csIHJhbmdlLmVuZC5jb2x1bW4pOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogInJlbW92ZSIsCiAgICAgICAgICAgIGxpbmVzOiB0aGlzLmdldExpbmVzRm9yUmFuZ2UoeyBzdGFydDogc3RhcnQsIGVuZDogZW5kIH0pCiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHRoaXMuY2xvbmVQb3Moc3RhcnQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlSW5MaW5lID0gZnVuY3Rpb24gKHJvdywgc3RhcnRDb2x1bW4sIGVuZENvbHVtbikgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhyb3cs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LCBNQVgpIHsKICAgICAgICB2YXIgbGluZXMgPSBkZWx0YS5saW5lczsKICAgICAgICB2YXIgbCA9IGxpbmVzLmxlbmd0aCAtIE1BWCArIDE7CiAgICAgICAgdmFyIHJvdyA9IGRlbHRhLnN0YXJ0LnJvdzsKICAgICAgICB2YXIgY29sdW1uID0gZGVsdGEuc3RhcnQuY29sdW1uOwogICAgICAgIGZvciAodmFyIGZyb20gPSAwLCB0byA9IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogICAgfTsKICAgIHRoaXMucmV2ZXJ0RGVsdGEgPSBmdW5jdGlvbiAoZGVsdGEpIHsKICAgICAgICB0aGlzLiRzYWZlQXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiB0aGlzLmNsb25lUG9zKGRlbHRhLnN0YXJ0KSwKICAgICAgICAgICAgZW5kOiB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SBmdW5jdGlvbiAoc3RyaW5nKSB7CiAgICByZXR1cm4gc3RyaW5nLnJlcGxhY2UodHJpbUJlZ2luUmVnZXhwLCAnJyk7Cn07CmV4cG9ydHMuc3RyaW5nVHJpbVJpZ2h0ID0gZnVuY3Rpb24gKHN0cmluZykgewogICAgcmV0dXJuIHN0cmluZy5yZXBsYWNlKHRyaW1FbmRSZWdleHAsICcnKTsKfTsKZXhwb3J0cy5jb3B5T2JqZWN0ID0gZnVuY3Rpb24gKG9iaikgewogICAgdmFyIGNvcHkgPSB7fTsKICAgIGZvciAodmFyIGtleSBpbiBvYmopIHsKICAgICAgICBjb3B5W2tleV0gPSBvYmpba2V5XTsKICAgIH0KICAgIHJldHVybiBjb3B5Owp9OwpleHBvcnRzLmNvcHlBcnJheSA9IGZ1bmN0aW9uIChhcnJheSkgewogICAgdmFyIGNvcHkgPSBbXTsKICAgIGZvciAodmFyIGkgPSAwLCBsID0gYXJyYXkubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgaWYgKGFycmF5W2ldICYmIHR5cGVvZiBhcnJheVtpXSA9PSAib2JqZWN0IikKICAgICAgICAgICAgY29weVtpXSA9IHRoaXMuY29weU9iamVjdChhcnJheVtpXSk7CiAgICAgICAgZWxzZQogICAgICAgICAgICBjb3B5W2ldID0gYXJyYXlbaV07CiAgICB9CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5kZWVwQ29weSA9IGZ1bmN0aW9uIGRlZXBDb3B5KG9iaikgewogICAgaWYgKHR5cGVvZiBvYmogIT09ICJvYmplY3QiIHx8ICFvYmopCiAgICAgICAgcmV0dXJuIG9iajsKICAgIHZhciBjb3B5OwogICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgewogICAgICAgIGNvcHkgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgPSAwOyBrZXkgPCBvYmoubGVuZ3RoOyBrZXkrKykgewogICAgICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjb3B5OwogICAgfQogICAgaWYgKE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChvYmopICE9PSAiW29iamVjdCBPYmplY3RdIikKICAgICAgICByZXR1cm4gb2JqOwogICAgY29weSA9IHt9OwogICAgZm9yICh2YXIga2V5IGluIG9iaikKICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5hcnJheVRvTWFwID0gZnVuY3Rpb24gKGFycikgewogICAgdmFyIG1hcCA9IHt9OwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHsKICAgICAgICBtYXBbYXJyW2ldXSA9IDE7CiAgICB9CiAgICByZXR1cm4gbWFwOwp9OwpleHBvcnRzLmNyZWF0ZU1hcCA9IGZ1bmN0aW9uIChwcm9wcykgewogICAgdmFyIG1hcCA9IE9iamVjdC5jcmVhdGUobnVsbCk7CiAgICBmb3IgKHZhciBpIGluIHByb3BzKSB7CiAgICAgICAgbWFwW2ldID0gcHJvcHNbaV07CiAgICB9CiAgICByZXR1cm4gbWFwOwp9OwpleHBvcnRzLmFycmF5UmVtb3ZlID0gZnVuY3Rpb24gKGFycmF5LCB2YWx1ZSkgewogICAgZm9yICh2YXIgaSA9IDA7IGkgPD0gYXJyYXkubGVuZ3RoOyBpKyspIHsKICAgICAgICBpZiAodmFsdWUgPT09IGFycmF5W2ldKSB7CiAgICAgICAgICAgIGFycmF5LnNwbGljZShpLCAxKTsKICAgICAgICB9CiAgICB9Cn07CmV4cG9ydHMuZXNjYXBlUmVnRXhwID0gZnVuY3Rpb24gKHN0cikgewogICAgcmV0dXJuIHN0ci5yZXBsYWNlKC8oWy4qKz9eJHt9KCl8W1xdXC9cXF0pL2csICdcXCQxJyk7Cn07CmV4cG9ydHMuZXNjYXBlSFRNTCA9IGZ1bmN0aW9uIChzdHIpI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HN0YXJ0OiBkYXRhW2ldLCBsaW5lczogZGF0YVtpKzFdfTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZiAoKGQuYWN0aW9uID09ICJpbnNlcnQiID8gZC5zdGFydCA6IGQuZW5kKS5yb3cgPj0gZG9jLiRsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBlcnIgPSBuZXcgRXJyb3IoIkludmFsaWQgZGVsdGEiKTsKICAgICAgICAgICAgICAgICAgICBlcnIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogX3NlbGYuJHBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzTGVuZ3RoOiBkb2MuJGxpbmVzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGQuc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogZC5lbmQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IGVycjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBkb2MuYXBwbHlEZWx0YShkLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoX3NlbGYuJHRpbWVvdXQpCiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZShfc2VsZi4kdGltZW91dCk7CiAgICAgICAgX3NlbGYub25VcGRhdGUoKTsKICAgIH0pOwp9OwoKKGZ1bmN0aW9uKCkgewogICAgCiAgICB0aGlzLiR0aW1lb3V0ID0gNTAwOwogICAgCiAgICB0aGlzLnNldFRpbWVvdXQgPSBmdW5jdGlvbih0aW1lb3V0KSB7CiAgICAgICAgdGhpcy4kdGltZW91dCA9IHRpbWVvdXQ7CiAgICB9OwogICAgCiAgICB0aGlzLnNldFZhbHVlID0gZnVuY3Rpb24odmFsdWUpIHsKICAgICAgICB0aGlzLmRvYy5zZXRWYWx1ZSh2YWx1ZSk7CiAgICAgICAgdGhpcy5kZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZSh0aGlzLiR0aW1lb3V0KTsKICAgIH07CiAgICAKICAgIHRoaXMuZ2V0VmFsdWUgPSBmdW5jdGlvbihjYWxsYmFja0lkKSB7CiAgICAgICAgdGhpcy5zZW5kZXIuY2FsbGJhY2sodGhpcy5kb2MuZ2V0VmFsdWUoKSwgY2FsbGJhY2tJZCk7CiAgICB9OwogICAgCiAgICB0aGlzLm9uVXBkYXRlID0gZnVuY3Rpb24oKSB7CiAgICB9OwogICAgCiAgICB0aGlzLmlzUGVuZGluZyA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLmRlZmVycmVkVXBkYXRlLmlzUGVuZGluZygpOwogICAgfTsKICAgIAp9KS5jYWxsKE1pcnJvci5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uL2pzb25fcGFyc2UiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKICAgIHZhciBhdCwgICAgIC8vIFRoZSBpbmRleCBvZiB0aGUgY3VycmVudCBjaGFyYWN0ZXIKICAgICAgICBjaCwgICAgIC8vIFRoZSBjdXJyZW50IGNoYXJhY3RlcgogICAgICAgIGVzY2FwZWUgPSB7CiAgICAgICAgICAgICciJzogICciJywKICAgICAgICAgICAgJ1xcJzogJ1xcJywKICAgICAgICAgICAgJy8nOiAgJy8nLAogICAgICAgICAgICBiOiAgICAnXGInLAogICAgICAgICAgICBmOiAgICAnXGYnLAogICAgICAgICAgICBuOiAgICAnXG4nLAogICAgICAgICAgICByOiAgICAnXHInLAogICAgICAgICAgICB0OiAgICAnXHQnCiAgICAgICAgfSwKICAgICAgICB0ZXh0LAoKICAgICAgICBlcnJvciA9IGZ1bmN0aW9uIChtKSB7CgogICAgICAgICAgICB0aHJvdyB7CiAgICAgICAgICAgICAgICBuYW1lOiAgICAnU3ludGF4RXJyb3InLAogICAgICAgICAgICAgICAgbWVzc2FnZTogbSwKICAgICAgICAgICAgICAgIGF0OiAgICAgIGF0LAogICAgICAgICAgICAgICAgdGV4dDogICAgdGV4dAogICAgICAgICAgICB9OwogICAgICAgIH0sCgogICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgewoKICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJFeHBlY3RlZCAnIiArIGMgKyAiJyBpbnN0ZWFkIG9mICciICsgY2ggKyAiJyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBjaCA9IHRleHQuY2hhckF0KGF0KTsKICAgICAgICAgICAgYXQgKz0gMTsKICAgICAgICAgICAgcmV0dXJuIGNoOwogICAgICAgIH0sCgogICAgICAgIG51bWJlciA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBudW1iZXIsCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJzsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJy0nKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnLSc7CiAgICAgICAgICAgICAgICBuZXh0KCctJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9ICcuJzsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkgJiYgY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBudW1iZXIgPSArc3RyaW5nOwogICAgICAgICAgICBpZiAoaXNOYU4obnVtYmVyKSkgewogICAgICAgICAgICAgICAgZXJyb3IoIkJhZCBudW1iZXIiKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiBudW1iZXI7CiAgICAgICAgICAgIH0KICAgICAgICB9LAoKICAgICAgICBzdHJpbmcgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB2YXIgaGV4LAogICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgIHN0cmluZyA9ICcnLAogICAgICAgICAgICAgICAgdWZmZmY7CgogICAgICAgICAgICBpZiAoY2ggPT09ICciJykgewogICAgICAgICAgICAgICAgd2hpbGUgKG5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJyInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0cmluZzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFwnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBwYXJzZUludChuZXh0KCksIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKGhleCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gdWZmZmYgKiAxNiArIGhleDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHVmZmZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZXNjYXBlZVtjaF0gPT09ICdzdHJpbmcnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gZXNjYXBlZVtjaF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gIlxuIiB8fCBjaCA9PSAiXHIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBzdHJpbmciKTsKICAgICAgICB9LAoKICAgICAgICB3aGl0ZSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHdoaWxlIChjaCAmJiBjaCA8PSAnICcpIHsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgIH0sCgogICAgICAgIHdvcmQgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICBzd2l0Y2ggKGNoKSB7CiAgICAgICAgICAgIGNhc2UgJ3QnOgogICAgICAgICAgICAgICAgbmV4dCgndCcpOwogICAgICAgICAgICAgICAgbmV4dCgncicpOwogICAgICAgICAgICAgICAgbmV4dCgndScpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIGNhc2UgJ2YnOgogICAgICAgICAgICAgICAgbmV4dCgnZicpOwogICAgICAgICAgICAgICAgbmV4dCgnYScpOwogICAgICAgICAgICAgICAgbmV4dCgnbCcpOwogICAgICAgICAgICAgICAgbmV4dCgncycpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICBjYXNlICduJzoKICAgICAgICAgICAgICAgIG5leHQoJ24nKTsKICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJVbmV4cGVjdGVkICciICsgY2ggKyAiJyIpOwogICAgICAgIH0sCgogICAgICAgIHZhbHVlLCAgLy8gUGxhY2UgaG9sZGVyIGZvciB0aGUgdmFsdWUgZnVuY3Rpb24uCgogICAgICAgIGFycmF5ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGFycmF5ID0gW107CgogICAgICAgICAgICBpZiAoY2ggPT09ICdbJykgewogICAgICAgICAgICAgICAgbmV4dCgnWycpOwogICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnXScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheTsgICAvLyBlbXB0eSBhcnJheQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyYXkucHVzaCh2YWx1ZSgpKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuZXh0KCcsJyk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvcigiQmFkIGFycmF5Iik7CiAgICAgICAgfSwKCiAgICAgICAgb2JqZWN0ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGtleSwKICAgICAgICAgICAgICAgIG9iamVjdCA9IHt9OwoKICAgICAgICAgICAgaWYgKGNoID09PSAneycpIHsKICAgICAgICAgICAgICAgIG5leHQoJ3snKTsKICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd9JykgewogICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OyAgIC8vIGVtcHR5IG9iamVjdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAga2V5ID0gc3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBuZXh0KCc6Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkgewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcignRHVwbGljYXRlIGtleSAiJyArIGtleSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG9iamVjdFtrZXldID0gdmFsdWUoKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ30nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBvYmplY3QiKTsKICAgICAgICB9OwoKICAgIHZhbHVlID0gZnVuY3Rpb24gKCkgewoKICAgICAgICB3aGl0ZSgpOwogICAgICAgIHN3aXRjaCAoY2gpIHsKICAgICAgICBjYXNlICd7JzoKICAgICAgICAgICAgcmV0dXJuIG9iamVjdCgpOwogICAgICAgIGNhc2UgJ1snOgogICAgICAgICAgICByZXR1cm4gYXJyYXkoKTsKICAgICAgICBjYXNlICciJzoKICAgICAgICAgICAgcmV0dXJuIHN0cmluZygpOwogICAgICAgIGNhc2UgJy0nOgogICAgICAgICAgICByZXR1cm4gbnVtYmVyKCk7CiAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGNoID49ICcwJyAmJiBjaCA8PSAnOScgPyBudW1iZXIoKSA6IHdvcmQoKTsKICAgICAgICB9CiAgICB9OwoKICAgIHJldHVybiBmdW5jdGlvbiAoc291cmNlLCByZXZpdmVyKSB7CiAgICAgICAgdmFyIHJlc3VsdDsKCiAgICAgICAgdGV4dCA9IHNvdXJjZTsKICAgICAgICBhdCA9IDA7CiAgICAgICAgY2ggPSAnICc7CiAgICAgICAgcmVzdWx0ID0gdmFsdWUoKTsKICAgICAgICB3aGl0ZSgpOwogICAgICAgIGlmIChjaCkgewogICAgICAgICAgICBlcnJvcigiU3ludGF4IGVycm9yIik7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHlwZW9mIHJldml2ZXIgPT09ICdmdW5jdGlvbicgPyBmdW5jdGlvbiB3YWxrKGhvbGRlciwga2V5KSB7CiAgICAgICAgICAgIHZhciBrLCB2LCB2YWx1ZSA9IGhvbGRlcltrZXldOwogICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JykgewogICAgICAgICAgICAgICAgZm9yIChrIGluIHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gd2Fsayh2YWx1ZSwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ICE9PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB2YWx1ZVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAg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dDogZS5tZXNzYWdlLAogICAgICAgICAgICAgICAgdHlwZTogImVycm9yIgogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgdGhpcy5zZW5kZXIuZW1pdCgiYW5ub3RhdGUiLCBlcnJvcnMpOwogICAgfTsKCn0pLmNhbGwoSnNvbldvcmtlci5wcm90b3R5cGUpOwoKfSk7Cg==";ace.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl);const _sfc_main$w=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue","close"],setup(r,{emit:n}){const i=r,o=vue.ref(!1),a=vue.computed({get(){return i.lang==="json"?JSON.stringify(i.modelValue,null,2):i.modelValue},set(u){i.lang==="json"?n("update:modelValue",JSON.parse(u)):n("update:modelValue",u)}});return(u,c)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:c[0]||(c[0]=f=>o.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(o),"onUpdate:modelValue":c[2]||(c[2]=f=>vue.isRef(o)?o.value=f:null),title:i.title,width:"60%",onClose:c[3]||(c[3]=f=>n("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(a),"onUpdate:value":c[1]||(c[1]=f=>vue.isRef(a)?a.value=f:null),lang:i.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$b={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$8={key:1},_hoisted_3$7={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$3={key:1},_sfc_main$v=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},emits:["change"],setup(r,{emit:n}){const i=r;function o(a){let u=window.setTimeout(function(){n("change",a),clearTimeout(u),u=null},200)}return(a,u)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.objInfo,(c,f)=>(vue.openBlock(),vue.createElementBlock("div",{key:f},[i.code?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f))>78?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:String(f),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$b,vue.toDisplayString(f),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$8,vue.toDisplayString(f),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(c.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:JSON.stringify(c.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$7,vue.toDisplayString(c.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString(c.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),i.hide.indexOf(String(f))<0?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:c.title,size:"small"},{default:vue.withCtx(()=>[c.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSelect),{key:0,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,placeholder:"Select",size:"small",disabled:!!(c!=null&&c.disabled),onChange:o},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(c.options,d=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInputNumber),{key:1,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:2,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:3,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,autosize:"",type:"textarea",disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElColorPicker),{key:4,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSwitch),{key:5,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$w,{key:6,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onClose:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_df8be28f_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc$1(_sfc_main$v,[["__scopeId","data-v-df8be28f"]]),_hoisted_1$a={style:{height:"100%"}},_hoisted_2$7={class:"flex flex-wrap"},_hoisted_3$6=["onMouseenter","onClick"],_sfc_main$u=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(r,{emit:n}){const i=r,o=vue.ref(i.val),a=vue.ref(!1),u=vue.ref("进入"),c=vue.ref(null),f=d=>{n("updateCommonAniVal",d),a.value=!1};return vue.watch(()=>i.val,d=>{o.value=d}),(d,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$a,[vue.unref(o)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:0,closable:"",onClose:p[0]||(p[0]=h=>f("")),onClick:p[1]||(p[1]=h=>a.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var h;return[vue.createTextVNode(vue.toDisplayString((h=vue.unref(common_animate_list).map(g=>g.children).reduce((g,v)=>g.concat(v)).find(g=>g.value==vue.unref(o)))==null?void 0:h.label)+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:p[2]||(p[2]=h=>a.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(elementPlus.ElDrawer),{modelValue:vue.unref(a),"onUpdate:modelValue":p[5]||(p[5]=h=>vue.isRef(a)?a.value=h:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabs),{modelValue:vue.unref(u),"onUpdate:modelValue":p[4]||(p[4]=h=>vue.isRef(u)?u.value=h:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),h=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabPane),{label:h.label,name:h.label,key:h.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$7,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(h.children,(g,v)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:v,onMouseenter:y=>c.value=v,onMouseleave:p[3]||(p[3]=y=>c.value=null),onClick:y=>f(g.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref(c)==v?`animate__animated animate__${g.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(g.label),3)],40,_hoisted_3$6))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2668f60c_lang="",CommonAnimate=_export_sfc$1(_sfc_main$u,[["__scopeId","data-v-2668f60c"]]),_sfc_main$t=vue.defineComponent({__name:"component-tree",setup(r){const n=useGlobalStore(pinia),i=vue.computed(()=>{var u;return((u=n.handle_svg_info)==null?void 0:u.info.id)??""}),o=u=>{for(let c of n.done_json)c.selected=!1,c.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(u)},a={children:"children",label:"title"};return(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTree),{class:"tree-v",data:vue.unref(n).done_json,props:a,onNodeClick:o,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!!vue.unref(i),"node-key":"id","current-node-key":vue.unref(i)},null,8,["data","highlight-current","current-node-key"]))}}),_withScopeId$1=r=>(vue.pushScopeId("data-v-98320511"),r=r(),vue.popScopeId(),r),_hoisted_1$9={class:"wall-l"},_hoisted_2$6={class:"head-l"},_hoisted_3$5=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$s=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(r,{emit:n}){const i=r,o=vue.computed({get(){return i.modelValue},set(c){n("update:modelValue",c)}}),a=()=>{o.value.push({key:"",val:""})},u=c=>{o.value.splice(c,1)};return(c,f)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[vue.createElementVNode("div",_hoisted_2$6,[_hoisted_3$5,_hoisted_4$2,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:a},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),(d,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:d.key,"onUpdate:modelValue":h=>d.key=h,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:d.val,"onUpdate:modelValue":h=>d.val=h,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:h=>u(p)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_98320511_lang="",List=_export_sfc$1(_sfc_main$s,[["__scopeId","data-v-98320511"]]),composeEventHandlers=(r,n,{checkForDefaultPrevented:i=!0}={})=>a=>{const u=r==null?void 0:r(a);if(i===!1||!u)return n==null?void 0:n(a)};var _a;const isClient=typeof window<"u",isString$1=r=>typeof r=="string",noop=()=>{},isIOS=isClient&&((_a=window==null?void 0:window.navigator)==null?void 0:_a.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function resolveUnref(r){return typeof r=="function"?r():vue.unref(r)}function createFilterWrapper(r,n){function i(...o){return new Promise((a,u)=>{Promise.resolve(r(()=>n.apply(this,o),{fn:n,thisArg:this,args:o})).then(a).catch(u)})}return i}function debounceFilter(r,n={}){let i,o,a=noop;const u=f=>{clearTimeout(f),a(),a=noop};return f=>{const d=resolveUnref(r),p=resolveUnref(n.maxWait);return i&&u(i),d<=0||p!==void 0&&p<=0?(o&&(u(o),o=null),Promise.resolve(f())):new Promise((h,g)=>{a=n.rejectOnCancel?g:h,p&&!o&&(o=setTimeout(()=>{i&&u(i),o=null,h(f())},p)),i=setTimeout(()=>{o&&u(o),o=null,h(f())},d)})}}function identity(r){return r}function tryOnScopeDispose(r){return vue.getCurrentScope()?(vue.onScopeDispose(r),!0):!1}function useDebounceFn(r,n=200,i={}){return createFilterWrapper(debounceFilter(n,i),r)}function refDebounced(r,n=200,i={}){const o=vue.ref(r.value),a=useDebounceFn(()=>{o.value=r.value},n,i);return vue.watch(r,()=>a()),o}function tryOnMounted(r,n=!0){vue.getCurrentInstance()?vue.onMounted(r):n?r():vue.nextTick(r)}function unrefElement(r){var n;const i=resolveUnref(r);return(n=i==null?void 0:i.$el)!=null?n:i}const defaultWindow=isClient?window:void 0;function useEventListener(...r){let n,i,o,a;if(isString$1(r[0])||Array.isArray(r[0])?([i,o,a]=r,n=defaultWindow):[n,i,o,a]=r,!n)return noop;Array.isArray(i)||(i=[i]),Array.isArray(o)||(o=[o]);const u=[],c=()=>{u.forEach(h=>h()),u.length=0},f=(h,g,v,y)=>(h.addEventListener(g,v,y),()=>h.removeEventListener(g,v,y)),d=vue.watch(()=>[unrefElement(n),resolveUnref(a)],([h,g])=>{c(),h&&u.push(...i.flatMap(v=>o.map(y=>f(h,v,y,g))))},{immediate:!0,flush:"post"}),p=()=>{d(),c()};return tryOnScopeDispose(p),p}let _iOSWorkaround=!1;function onClickOutside(r,n,i={}){const{window:o=defaultWindow,ignore:a=[],capture:u=!0,detectIframe:c=!1}=i;if(!o)return;isIOS&&!_iOSWorkaround&&(_iOSWorkaround=!0,Array.from(o.document.body.children).forEach(v=>v.addEventListener("click",noop)));let f=!0;const d=v=>a.some(y=>{if(typeof y=="string")return Array.from(o.document.querySelectorAll(y)).some(A=>A===v.target||v.composedPath().includes(A));{const A=unrefElement(y);return A&&(v.target===A||v.composedPath().includes(A))}}),h=[useEventListener(o,"click",v=>{const y=unrefElement(r);if(!(!y||y===v.target||v.composedPath().includes(y))){if(v.detail===0&&(f=!d(v)),!f){f=!0;return}n(v)}},{passive:!0,capture:u}),useEventListener(o,"pointerdown",v=>{const y=unrefElement(r);y&&(f=!v.composedPath().includes(y)&&!d(v))},{passive:!0}),c&&useEventListener(o,"blur",v=>{var y;const A=unrefElement(r);((y=o.document.activeElement)==null?void 0:y.tagName)==="IFRAME"&&!(A!=null&&A.contains(o.document.activeElement))&&n(v)})].filter(Boolean);return()=>h.forEach(v=>v())}function useSupported(r,n=!1){const i=vue.ref(),o=()=>i.value=!!r();return o(),tryOnMounted(o,n),i}const _global=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},globalKey="__vueuse_ssr_handlers__";_global[globalKey]=_global[globalKey]||{};var __getOwnPropSymbols$g=Object.getOwnPropertySymbols,__hasOwnProp$g=Object.prototype.hasOwnProperty,__propIsEnum$g=Object.prototype.propertyIsEnumerable,__objRest$2=(r,n)=>{var i={};for(var o in r)__hasOwnProp$g.call(r,o)&&n.indexOf(o)<0&&(i[o]=r[o]);if(r!=null&&__getOwnPropSymbols$g)for(var o of __getOwnPropSymbols$g(r))n.indexOf(o)<0&&__propIsEnum$g.call(r,o)&&(i[o]=r[o]);return i};function useResizeObserver(r,n,i={}){const o=i,{window:a=defaultWindow}=o,u=__objRest$2(o,["window"]);let c;const f=useSupported(()=>a&&"ResizeObserver"in a),d=()=>{c&&(c.disconnect(),c=void 0)},p=vue.watch(()=>unrefElement(r),g=>{d(),f.value&&a&&g&&(c=new ResizeObserver(n),c.observe(g,u))},{immediate:!0,flush:"post"}),h=()=>{d(),p()};return tryOnScopeDispose(h),{isSupported:f,stop:h}}var SwipeDirection;(function(r){r.UP="UP",r.RIGHT="RIGHT",r.DOWN="DOWN",r.LEFT="LEFT",r.NONE="NONE"})(SwipeDirection||(SwipeDirection={}));var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,n,i)=>n in r?__defProp(r,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[n]=i,__spreadValues=(r,n)=>{for(var i in n||(n={}))__hasOwnProp.call(n,i)&&__defNormalProp(r,i,n[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(n))__propIsEnum.call(n,i)&&__defNormalProp(r,i,n[i]);return r};const _TransitionPresets={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};__spreadValues({linear:identity},_TransitionPresets);const isFirefox=()=>isClient&&/firefox/i.test(window.navigator.userAgent);process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const NOOP=()=>{},hasOwnProperty=Object.prototype.hasOwnProperty,hasOwn=(r,n)=>hasOwnProperty.call(r,n),isArray=Array.isArray,isFunction=r=>typeof r=="function",isString=r=>typeof r=="string",isObject=r=>r!==null&&typeof r=="object",objectToString=Object.prototype.toString,toTypeString=r=>objectToString.call(r),toRawType=r=>toTypeString(r).slice(8,-1),isUndefined=r=>r===void 0,isBoolean=r=>typeof r=="boolean",isNumber=r=>typeof r=="number",isElement=r=>typeof Element>"u"?!1:r instanceof Element,isStringNumber=r=>isString(r)?!Number.isNaN(Number(r)):!1,escapeStringRegexp=(r="")=>r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),getProp=(r,n,i)=>({get value(){return lodashEs.get(r,n,i)},set value(o){lodashEs.set(r,n,o)}});class ElementPlusError extends Error{constructor(n){super(n),this.name="ElementPlusError"}}function throwError(r,n){throw new ElementPlusError(`[${r}] ${n}`)}function debugWarn(r,n){if(process.env.NODE_ENV!=="production"){const i=isString(r)?new ElementPlusError(`[${r}] ${n}`):r;console.warn(i)}}const SCOPE$1="utils/dom/style";function addUnit(r,n="px"){if(!r)return"";if(isNumber(r)||isStringNumber(r))return`${r}${n}`;if(isString(r))return r;debugWarn(SCOPE$1,"binding value must be a string or number")}function scrollIntoView(r,n){if(!isClient)return;if(!n){r.scrollTop=0;return}const i=[];let o=n.offsetParent;for(;o!==null&&r!==o&&r.contains(o);)i.push(o),o=o.offsetParent;const a=n.offsetTop+i.reduce((d,p)=>d+p.offsetTop,0),u=a+n.offsetHeight,c=r.scrollTop,f=c+r.clientHeight;a<c?r.scrollTop=a:u>f&&(r.scrollTop=u-r.clientHeight)}const epPropKey="__epPropKey",definePropType=r=>r,isEpProp=r=>isObject(r)&&!!r[epPropKey],buildProp=(r,n)=>{if(!isObject(r)||isEpProp(r))return r;const{values:i,required:o,default:a,type:u,validator:c}=r,d={type:u,required:!!o,validator:i||c?p=>{let h=!1,g=[];if(i&&(g=Array.from(i),hasOwn(r,"default")&&g.push(a),h||(h=g.includes(p))),c&&(h||(h=c(p))),!h&&g.length>0){const v=[...new Set(g)].map(y=>JSON.stringify(y)).join(", ");vue.warn(`Invalid prop: validation failed${n?` for prop "${n}"`:""}. Expected one of [${v}], got value ${JSON.stringify(p)}.`)}return h}:void 0,[epPropKey]:!0};return hasOwn(r,"default")&&(d.default=a),d},buildProps=r=>lodashEs.fromPairs(Object.entries(r).map(([n,i])=>[n,buildProp(i,n)])),iconPropType=definePropType([String,Object,Function]),ValidateComponentsMap={validating:loading_default,success:circle_check_default,error:circle_close_default},withInstall=(r,n)=>{if(r.install=i=>{for(const o of[r,...Object.values(n??{})])i.component(o.name,o)},n)for(const[i,o]of Object.entries(n))r[i]=o;return r},withNoopInstall=r=>(r.install=NOOP,r),EVENT_CODE={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},UPDATE_MODEL_EVENT="update:modelValue",CHANGE_EVENT="change",componentSizes=["","default","small","large"],componentSizeMap={large:40,default:32,small:24},getComponentSize=r=>componentSizeMap[r||"default"],isValidComponentSize=r=>["",...componentSizes].includes(r),isKorean=r=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(r),mutable=r=>r,DEFAULT_EXCLUDE_KEYS=["class","style"],LISTENER_PREFIX=/^on[A-Z]/,useAttrs=(r={})=>{const{excludeListeners:n=!1,excludeKeys:i}=r,o=vue.computed(()=>((i==null?void 0:i.value)||[]).concat(DEFAULT_EXCLUDE_KEYS)),a=vue.getCurrentInstance();return a?vue.computed(()=>{var u;return lodashEs.fromPairs(Object.entries((u=a.proxy)==null?void 0:u.$attrs).filter(([c])=>!o.value.includes(c)&&!(n&&LISTENER_PREFIX.test(c))))}):(debugWarn("use-attrs","getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"),vue.computed(()=>({})))},useDeprecated=({from:r,replacement:n,scope:i,version:o,ref:a,type:u="API"},c)=>{vue.watch(()=>vue.unref(c),f=>{f&&debugWarn(i,`[${u}] ${r} is about to be deprecated in version ${o}, please use ${n} instead.
252
252
  For more detail, please visit: ${a}
253
253
  `)},{immediate:!0})},useFocus=r=>({focus:()=>{var n,i;(i=(n=r.value)==null?void 0:n.focus)==null||i.call(n)}});var English={name:"en",el:{colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color."},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",week:"week",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"}}};const buildTranslator=r=>(n,i)=>translate(n,i,vue.unref(r)),translate=(r,n,i)=>lodashEs.get(i,r,r).replace(/\{(\w+)\}/g,(o,a)=>{var u;return`${(u=n==null?void 0:n[a])!=null?u:`{${a}}`}`}),buildLocaleContext=r=>{const n=vue.computed(()=>vue.unref(r).name),i=vue.isRef(r)?r:vue.ref(r);return{lang:n,locale:i,t:buildTranslator(r)}},localeContextKey=Symbol("localeContextKey"),useLocale=r=>{const n=r||vue.inject(localeContextKey,vue.ref());return buildLocaleContext(vue.computed(()=>n.value||English))},defaultNamespace="el",statePrefix="is-",_bem=(r,n,i,o,a)=>{let u=`${r}-${n}`;return i&&(u+=`-${i}`),o&&(u+=`__${o}`),a&&(u+=`--${a}`),u},namespaceContextKey=Symbol("namespaceContextKey"),useGetDerivedNamespace=r=>{const n=r||vue.inject(namespaceContextKey,vue.ref(defaultNamespace));return vue.computed(()=>vue.unref(n)||defaultNamespace)},useNamespace=(r,n)=>{const i=useGetDerivedNamespace(n);return{namespace:i,b:(_="")=>_bem(i.value,r,_,"",""),e:_=>_?_bem(i.value,r,"",_,""):"",m:_=>_?_bem(i.value,r,"","",_):"",be:(_,S)=>_&&S?_bem(i.value,r,_,S,""):"",em:(_,S)=>_&&S?_bem(i.value,r,"",_,S):"",bm:(_,S)=>_&&S?_bem(i.value,r,_,"",S):"",bem:(_,S,b)=>_&&S&&b?_bem(i.value,r,_,S,b):"",is:(_,...S)=>{const b=S.length>=1?S[0]:!0;return _&&b?`${statePrefix}${_}`:""},cssVar:_=>{const S={};for(const b in _)_[b]&&(S[`--${i.value}-${b}`]=_[b]);return S},cssVarName:_=>`--${i.value}-${_}`,cssVarBlock:_=>{const S={};for(const b in _)_[b]&&(S[`--${i.value}-${r}-${b}`]=_[b]);return S},cssVarBlockName:_=>`--${i.value}-${r}-${_}`}},_prop=buildProp({type:definePropType(Boolean),default:null}),_event=buildProp({type:definePropType(Function)}),createModelToggleComposable=r=>{const n=`update:${r}`,i=`onUpdate:${r}`,o=[n],a={[r]:_prop,[i]:_event};return{useModelToggle:({indicator:c,toggleReason:f,shouldHideWhenRouteChanges:d,shouldProceed:p,onShow:h,onHide:g})=>{const v=vue.getCurrentInstance(),{emit:y}=v,A=v.props,_=vue.computed(()=>isFunction(A[i])),S=vue.computed(()=>A[r]===null),b=D=>{c.value!==!0&&(c.value=!0,f&&(f.value=D),isFunction(h)&&h(D))},T=D=>{c.value!==!1&&(c.value=!1,f&&(f.value=D),isFunction(g)&&g(D))},w=D=>{if(A.disabled===!0||isFunction(p)&&!p())return;const z=_.value&&isClient;z&&y(n,!0),(S.value||!z)&&b(D)},x=D=>{if(A.disabled===!0||!isClient)return;const z=_.value&&isClient;z&&y(n,!1),(S.value||!z)&&T(D)},k=D=>{isBoolean(D)&&(A.disabled&&D?_.value&&y(n,!1):c.value!==D&&(D?b():T()))},M=()=>{c.value?x():w()};return vue.watch(()=>A[r],k),d&&v.appContext.config.globalProperties.$route!==void 0&&vue.watch(()=>({...v.proxy.$route}),()=>{d.value&&c.value&&x()}),vue.onMounted(()=>{k(A[r])}),{hide:x,show:w,toggle:M,hasUpdateHandler:_}},useModelToggleProps:a,useModelToggleEmits:o}};createModelToggleComposable("modelValue");const useProp=r=>{const n=vue.getCurrentInstance();return vue.computed(()=>{var i,o;return(o=(i=n==null?void 0:n.proxy)==null?void 0:i.$props)==null?void 0:o[r]})};var E="top",R="bottom",W="right",P="left",me="auto",G=[E,R,W,P],U="start",J="end",Xe="clippingParents",je="viewport",K="popper",Ye="reference",De=G.reduce(function(r,n){return r.concat([n+"-"+U,n+"-"+J])},[]),Ee=[].concat(G,[me]).reduce(function(r,n){return r.concat([n,n+"-"+U,n+"-"+J])},[]),Ge="beforeRead",Je="read",Ke="afterRead",Qe="beforeMain",Ze="main",et="afterMain",tt="beforeWrite",nt="write",rt="afterWrite",ot=[Ge,Je,Ke,Qe,Ze,et,tt,nt,rt];function C(r){return r?(r.nodeName||"").toLowerCase():null}function H(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var n=r.ownerDocument;return n&&n.defaultView||window}return r}function Q(r){var n=H(r).Element;return r instanceof n||r instanceof Element}function B(r){var n=H(r).HTMLElement;return r instanceof n||r instanceof HTMLElement}function Pe(r){if(typeof ShadowRoot>"u")return!1;var n=H(r).ShadowRoot;return r instanceof n||r instanceof ShadowRoot}function Mt(r){var n=r.state;Object.keys(n.elements).forEach(function(i){var o=n.styles[i]||{},a=n.attributes[i]||{},u=n.elements[i];!B(u)||!C(u)||(Object.assign(u.style,o),Object.keys(a).forEach(function(c){var f=a[c];f===!1?u.removeAttribute(c):u.setAttribute(c,f===!0?"":f)}))})}function Rt(r){var n=r.state,i={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,i.popper),n.styles=i,n.elements.arrow&&Object.assign(n.elements.arrow.style,i.arrow),function(){Object.keys(n.elements).forEach(function(o){var a=n.elements[o],u=n.attributes[o]||{},c=Object.keys(n.styles.hasOwnProperty(o)?n.styles[o]:i[o]),f=c.reduce(function(d,p){return d[p]="",d},{});!B(a)||!C(a)||(Object.assign(a.style,f),Object.keys(u).forEach(function(d){a.removeAttribute(d)}))})}}var Ae={name:"applyStyles",enabled:!0,phase:"write",fn:Mt,effect:Rt,requires:["computeStyles"]};function q(r){return r.split("-")[0]}var X=Math.max,ve=Math.min,Z=Math.round;function ee(r,n){n===void 0&&(n=!1);var i=r.getBoundingClientRect(),o=1,a=1;if(B(r)&&n){var u=r.offsetHeight,c=r.offsetWidth;c>0&&(o=Z(i.width)/c||1),u>0&&(a=Z(i.height)/u||1)}return{width:i.width/o,height:i.height/a,top:i.top/a,right:i.right/o,bottom:i.bottom/a,left:i.left/o,x:i.left/o,y:i.top/a}}function ke(r){var n=ee(r),i=r.offsetWidth,o=r.offsetHeight;return Math.abs(n.width-i)<=1&&(i=n.width),Math.abs(n.height-o)<=1&&(o=n.height),{x:r.offsetLeft,y:r.offsetTop,width:i,height:o}}function it(r,n){var i=n.getRootNode&&n.getRootNode();if(r.contains(n))return!0;if(i&&Pe(i)){var o=n;do{if(o&&r.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function N(r){return H(r).getComputedStyle(r)}function Wt(r){return["table","td","th"].indexOf(C(r))>=0}function I(r){return((Q(r)?r.ownerDocument:r.document)||window.document).documentElement}function ge(r){return C(r)==="html"?r:r.assignedSlot||r.parentNode||(Pe(r)?r.host:null)||I(r)}function at(r){return!B(r)||N(r).position==="fixed"?null:r.offsetParent}function Bt(r){var n=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,i=navigator.userAgent.indexOf("Trident")!==-1;if(i&&B(r)){var o=N(r);if(o.position==="fixed")return null}var a=ge(r);for(Pe(a)&&(a=a.host);B(a)&&["html","body"].indexOf(C(a))<0;){var u=N(a);if(u.transform!=="none"||u.perspective!=="none"||u.contain==="paint"||["transform","perspective"].indexOf(u.willChange)!==-1||n&&u.willChange==="filter"||n&&u.filter&&u.filter!=="none")return a;a=a.parentNode}return null}function se(r){for(var n=H(r),i=at(r);i&&Wt(i)&&N(i).position==="static";)i=at(i);return i&&(C(i)==="html"||C(i)==="body"&&N(i).position==="static")?n:i||Bt(r)||n}function Le(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function fe(r,n,i){return X(r,ve(n,i))}function St(r,n,i){var o=fe(r,n,i);return o>i?i:o}function st(){return{top:0,right:0,bottom:0,left:0}}function ft(r){return Object.assign({},st(),r)}function ct(r,n){return n.reduce(function(i,o){return i[o]=r,i},{})}var Tt=function(r,n){return r=typeof r=="function"?r(Object.assign({},n.rects,{placement:n.placement})):r,ft(typeof r!="number"?r:ct(r,G))};function Ht(r){var n,i=r.state,o=r.name,a=r.options,u=i.elements.arrow,c=i.modifiersData.popperOffsets,f=q(i.placement),d=Le(f),p=[P,W].indexOf(f)>=0,h=p?"height":"width";if(!(!u||!c)){var g=Tt(a.padding,i),v=ke(u),y=d==="y"?E:P,A=d==="y"?R:W,_=i.rects.reference[h]+i.rects.reference[d]-c[d]-i.rects.popper[h],S=c[d]-i.rects.reference[d],b=se(u),T=b?d==="y"?b.clientHeight||0:b.clientWidth||0:0,w=_/2-S/2,x=g[y],k=T-v[h]-g[A],M=T/2-v[h]/2+w,D=fe(x,M,k),z=d;i.modifiersData[o]=(n={},n[z]=D,n.centerOffset=D-M,n)}}function Ct(r){var n=r.state,i=r.options,o=i.element,a=o===void 0?"[data-popper-arrow]":o;a!=null&&(typeof a=="string"&&(a=n.elements.popper.querySelector(a),!a)||!it(n.elements.popper,a)||(n.elements.arrow=a))}var pt={name:"arrow",enabled:!0,phase:"main",fn:Ht,effect:Ct,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function te(r){return r.split("-")[1]}var qt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Vt(r){var n=r.x,i=r.y,o=window,a=o.devicePixelRatio||1;return{x:Z(n*a)/a||0,y:Z(i*a)/a||0}}function ut(r){var n,i=r.popper,o=r.popperRect,a=r.placement,u=r.variation,c=r.offsets,f=r.position,d=r.gpuAcceleration,p=r.adaptive,h=r.roundOffsets,g=r.isFixed,v=c.x,y=v===void 0?0:v,A=c.y,_=A===void 0?0:A,S=typeof h=="function"?h({x:y,y:_}):{x:y,y:_};y=S.x,_=S.y;var b=c.hasOwnProperty("x"),T=c.hasOwnProperty("y"),w=P,x=E,k=window;if(p){var M=se(i),D="clientHeight",z="clientWidth";if(M===H(i)&&(M=I(i),N(M).position!=="static"&&f==="absolute"&&(D="scrollHeight",z="scrollWidth")),M=M,a===E||(a===P||a===W)&&u===J){x=R;var j=g&&M===k&&k.visualViewport?k.visualViewport.height:M[D];_-=j-o.height,_*=d?1:-1}if(a===P||(a===E||a===R)&&u===J){w=W;var oe=g&&M===k&&k.visualViewport?k.visualViewport.width:M[z];y-=oe-o.width,y*=d?1:-1}}var L=Object.assign({position:f},p&&qt),F=h===!0?Vt({x:y,y:_}):{x:y,y:_};if(y=F.x,_=F.y,d){var O;return Object.assign({},L,(O={},O[x]=T?"0":"",O[w]=b?"0":"",O.transform=(k.devicePixelRatio||1)<=1?"translate("+y+"px, "+_+"px)":"translate3d("+y+"px, "+_+"px, 0)",O))}return Object.assign({},L,(n={},n[x]=T?_+"px":"",n[w]=b?y+"px":"",n.transform="",n))}function Nt(r){var n=r.state,i=r.options,o=i.gpuAcceleration,a=o===void 0?!0:o,u=i.adaptive,c=u===void 0?!0:u,f=i.roundOffsets,d=f===void 0?!0:f,p={placement:q(n.placement),variation:te(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:a,isFixed:n.options.strategy==="fixed"};n.modifiersData.popperOffsets!=null&&(n.styles.popper=Object.assign({},n.styles.popper,ut(Object.assign({},p,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:c,roundOffsets:d})))),n.modifiersData.arrow!=null&&(n.styles.arrow=Object.assign({},n.styles.arrow,ut(Object.assign({},p,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})}var Me={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Nt,data:{}},ye={passive:!0};function It(r){var n=r.state,i=r.instance,o=r.options,a=o.scroll,u=a===void 0?!0:a,c=o.resize,f=c===void 0?!0:c,d=H(n.elements.popper),p=[].concat(n.scrollParents.reference,n.scrollParents.popper);return u&&p.forEach(function(h){h.addEventListener("scroll",i.update,ye)}),f&&d.addEventListener("resize",i.update,ye),function(){u&&p.forEach(function(h){h.removeEventListener("scroll",i.update,ye)}),f&&d.removeEventListener("resize",i.update,ye)}}var Re={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:It,data:{}},_t={left:"right",right:"left",bottom:"top",top:"bottom"};function be(r){return r.replace(/left|right|bottom|top/g,function(n){return _t[n]})}var zt={start:"end",end:"start"};function lt(r){return r.replace(/start|end/g,function(n){return zt[n]})}function We(r){var n=H(r),i=n.pageXOffset,o=n.pageYOffset;return{scrollLeft:i,scrollTop:o}}function Be(r){return ee(I(r)).left+We(r).scrollLeft}function Ft(r){var n=H(r),i=I(r),o=n.visualViewport,a=i.clientWidth,u=i.clientHeight,c=0,f=0;return o&&(a=o.width,u=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(c=o.offsetLeft,f=o.offsetTop)),{width:a,height:u,x:c+Be(r),y:f}}function Ut(r){var n,i=I(r),o=We(r),a=(n=r.ownerDocument)==null?void 0:n.body,u=X(i.scrollWidth,i.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),c=X(i.scrollHeight,i.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),f=-o.scrollLeft+Be(r),d=-o.scrollTop;return N(a||i).direction==="rtl"&&(f+=X(i.clientWidth,a?a.clientWidth:0)-u),{width:u,height:c,x:f,y:d}}function Se(r){var n=N(r),i=n.overflow,o=n.overflowX,a=n.overflowY;return/auto|scroll|overlay|hidden/.test(i+a+o)}function dt(r){return["html","body","#document"].indexOf(C(r))>=0?r.ownerDocument.body:B(r)&&Se(r)?r:dt(ge(r))}function ce(r,n){var i;n===void 0&&(n=[]);var o=dt(r),a=o===((i=r.ownerDocument)==null?void 0:i.body),u=H(o),c=a?[u].concat(u.visualViewport||[],Se(o)?o:[]):o,f=n.concat(c);return a?f:f.concat(ce(ge(c)))}function Te(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function Xt(r){var n=ee(r);return n.top=n.top+r.clientTop,n.left=n.left+r.clientLeft,n.bottom=n.top+r.clientHeight,n.right=n.left+r.clientWidth,n.width=r.clientWidth,n.height=r.clientHeight,n.x=n.left,n.y=n.top,n}function ht(r,n){return n===je?Te(Ft(r)):Q(n)?Xt(n):Te(Ut(I(r)))}function Yt(r){var n=ce(ge(r)),i=["absolute","fixed"].indexOf(N(r).position)>=0,o=i&&B(r)?se(r):r;return Q(o)?n.filter(function(a){return Q(a)&&it(a,o)&&C(a)!=="body"}):[]}function Gt(r,n,i){var o=n==="clippingParents"?Yt(r):[].concat(n),a=[].concat(o,[i]),u=a[0],c=a.reduce(function(f,d){var p=ht(r,d);return f.top=X(p.top,f.top),f.right=ve(p.right,f.right),f.bottom=ve(p.bottom,f.bottom),f.left=X(p.left,f.left),f},ht(r,u));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function mt(r){var n=r.reference,i=r.element,o=r.placement,a=o?q(o):null,u=o?te(o):null,c=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,d;switch(a){case E:d={x:c,y:n.y-i.height};break;case R:d={x:c,y:n.y+n.height};break;case W:d={x:n.x+n.width,y:f};break;case P:d={x:n.x-i.width,y:f};break;default:d={x:n.x,y:n.y}}var p=a?Le(a):null;if(p!=null){var h=p==="y"?"height":"width";switch(u){case U:d[p]=d[p]-(n[h]/2-i[h]/2);break;case J:d[p]=d[p]+(n[h]/2-i[h]/2);break}}return d}function ne(r,n){n===void 0&&(n={});var i=n,o=i.placement,a=o===void 0?r.placement:o,u=i.boundary,c=u===void 0?Xe:u,f=i.rootBoundary,d=f===void 0?je:f,p=i.elementContext,h=p===void 0?K:p,g=i.altBoundary,v=g===void 0?!1:g,y=i.padding,A=y===void 0?0:y,_=ft(typeof A!="number"?A:ct(A,G)),S=h===K?Ye:K,b=r.rects.popper,T=r.elements[v?S:h],w=Gt(Q(T)?T:T.contextElement||I(r.elements.popper),c,d),x=ee(r.elements.reference),k=mt({reference:x,element:b,strategy:"absolute",placement:a}),M=Te(Object.assign({},b,k)),D=h===K?M:x,z={top:w.top-D.top+_.top,bottom:D.bottom-w.bottom+_.bottom,left:w.left-D.left+_.left,right:D.right-w.right+_.right},j=r.modifiersData.offset;if(h===K&&j){var oe=j[a];Object.keys(z).forEach(function(L){var F=[W,R].indexOf(L)>=0?1:-1,O=[E,R].indexOf(L)>=0?"y":"x";z[L]+=oe[O]*F})}return z}function Jt(r,n){n===void 0&&(n={});var i=n,o=i.placement,a=i.boundary,u=i.rootBoundary,c=i.padding,f=i.flipVariations,d=i.allowedAutoPlacements,p=d===void 0?Ee:d,h=te(o),g=h?f?De:De.filter(function(A){return te(A)===h}):G,v=g.filter(function(A){return p.indexOf(A)>=0});v.length===0&&(v=g);var y=v.reduce(function(A,_){return A[_]=ne(r,{placement:_,boundary:a,rootBoundary:u,padding:c})[q(_)],A},{});return Object.keys(y).sort(function(A,_){return y[A]-y[_]})}function Kt(r){if(q(r)===me)return[];var n=be(r);return[lt(r),n,lt(n)]}function Qt(r){var n=r.state,i=r.options,o=r.name;if(!n.modifiersData[o]._skip){for(var a=i.mainAxis,u=a===void 0?!0:a,c=i.altAxis,f=c===void 0?!0:c,d=i.fallbackPlacements,p=i.padding,h=i.boundary,g=i.rootBoundary,v=i.altBoundary,y=i.flipVariations,A=y===void 0?!0:y,_=i.allowedAutoPlacements,S=n.options.placement,b=q(S),T=b===S,w=d||(T||!A?[be(S)]:Kt(S)),x=[S].concat(w).reduce(function(Fe,$e){return Fe.concat(q($e)===me?Jt(n,{placement:$e,boundary:h,rootBoundary:g,padding:p,flipVariations:A,allowedAutoPlacements:_}):$e)},[]),k=n.rects.reference,M=n.rects.popper,D=new Map,z=!0,j=x[0],oe=0;oe<x.length;oe++){var L=x[oe],F=q(L),O=te(L)===U,ue=[E,R].indexOf(F)>=0,_e=ue?"width":"height",Ce=ne(n,{placement:L,boundary:h,rootBoundary:g,altBoundary:v,padding:p}),de=ue?O?W:P:O?R:E;k[_e]>M[_e]&&(de=be(de));var ie=be(de),Y=[];if(u&&Y.push(Ce[F]<=0),f&&Y.push(Ce[de]<=0,Ce[ie]<=0),Y.every(function(Fe){return Fe})){j=L,z=!1;break}D.set(L,Y)}if(z)for(var Ie=A?3:1,Oe=function(Fe){var $e=x.find(function(Cn){var Lt=D.get(Cn);if(Lt)return Lt.slice(0,Fe).every(function(In){return In})});if($e)return j=$e,"break"},kt=Ie;kt>0;kt--){var Dt=Oe(kt);if(Dt==="break")break}n.placement!==j&&(n.modifiersData[o]._skip=!0,n.placement=j,n.reset=!0)}}var vt={name:"flip",enabled:!0,phase:"main",fn:Qt,requiresIfExists:["offset"],data:{_skip:!1}};function gt(r,n,i){return i===void 0&&(i={x:0,y:0}),{top:r.top-n.height-i.y,right:r.right-n.width+i.x,bottom:r.bottom-n.height+i.y,left:r.left-n.width-i.x}}function yt(r){return[E,W,R,P].some(function(n){return r[n]>=0})}function Zt(r){var n=r.state,i=r.name,o=n.rects.reference,a=n.rects.popper,u=n.modifiersData.preventOverflow,c=ne(n,{elementContext:"reference"}),f=ne(n,{altBoundary:!0}),d=gt(c,o),p=gt(f,a,u),h=yt(d),g=yt(p);n.modifiersData[i]={referenceClippingOffsets:d,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:g},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":g})}var bt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Zt};function en(r,n,i){var o=q(r),a=[P,E].indexOf(o)>=0?-1:1,u=typeof i=="function"?i(Object.assign({},n,{placement:r})):i,c=u[0],f=u[1];return c=c||0,f=(f||0)*a,[P,W].indexOf(o)>=0?{x:f,y:c}:{x:c,y:f}}function tn(r){var n=r.state,i=r.options,o=r.name,a=i.offset,u=a===void 0?[0,0]:a,c=Ee.reduce(function(h,g){return h[g]=en(g,n.rects,u),h},{}),f=c[n.placement],d=f.x,p=f.y;n.modifiersData.popperOffsets!=null&&(n.modifiersData.popperOffsets.x+=d,n.modifiersData.popperOffsets.y+=p),n.modifiersData[o]=c}var wt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tn};function nn(r){var n=r.state,i=r.name;n.modifiersData[i]=mt({reference:n.rects.reference,element:n.rects.popper,strategy:"absolute",placement:n.placement})}var He={name:"popperOffsets",enabled:!0,phase:"read",fn:nn,data:{}};function rn(r){return r==="x"?"y":"x"}function on(r){var n=r.state,i=r.options,o=r.name,a=i.mainAxis,u=a===void 0?!0:a,c=i.altAxis,f=c===void 0?!1:c,d=i.boundary,p=i.rootBoundary,h=i.altBoundary,g=i.padding,v=i.tether,y=v===void 0?!0:v,A=i.tetherOffset,_=A===void 0?0:A,S=ne(n,{boundary:d,rootBoundary:p,padding:g,altBoundary:h}),b=q(n.placement),T=te(n.placement),w=!T,x=Le(b),k=rn(x),M=n.modifiersData.popperOffsets,D=n.rects.reference,z=n.rects.popper,j=typeof _=="function"?_(Object.assign({},n.rects,{placement:n.placement})):_,oe=typeof j=="number"?{mainAxis:j,altAxis:j}:Object.assign({mainAxis:0,altAxis:0},j),L=n.modifiersData.offset?n.modifiersData.offset[n.placement]:null,F={x:0,y:0};if(M){if(u){var O,ue=x==="y"?E:P,_e=x==="y"?R:W,Ce=x==="y"?"height":"width",de=M[x],ie=de+S[ue],Y=de-S[_e],Ie=y?-z[Ce]/2:0,Oe=T===U?D[Ce]:z[Ce],kt=T===U?-z[Ce]:-D[Ce],Dt=n.elements.arrow,Fe=y&&Dt?ke(Dt):{width:0,height:0},$e=n.modifiersData["arrow#persistent"]?n.modifiersData["arrow#persistent"].padding:st(),Cn=$e[ue],Lt=$e[_e],In=fe(0,D[Ce],Fe[Ce]),Et=w?D[Ce]/2-Ie-In-Cn-oe.mainAxis:Oe-In-Cn-oe.mainAxis,Ne=w?-D[Ce]/2+Ie+In+Lt+oe.mainAxis:kt+In+Lt+oe.mainAxis,pe=n.elements.arrow&&se(n.elements.arrow),At=pe?x==="y"?pe.clientTop||0:pe.clientLeft||0:0,Ve=(O=L==null?void 0:L[x])!=null?O:0,xe=de+Et-Ve-At,ze=de+Ne-Ve,Pt=fe(y?ve(ie,xe):ie,de,y?X(Y,ze):Y);M[x]=Pt,F[x]=Pt-de}if(f){var hn,ae=x==="x"?E:P,le=x==="x"?R:W,re=M[k],V=k==="y"?"height":"width",$=re+S[ae],he=re-S[le],Ue=[E,P].indexOf(b)!==-1,qe=(hn=L==null?void 0:L[k])!=null?hn:0,jt=Ue?$:re-D[V]-z[V]-qe+oe.altAxis,An=Ue?re+D[V]+z[V]-qe-oe.altAxis:he,wn=y&&Ue?St(jt,re,An):fe(y?jt:$,re,y?An:he);M[k]=wn,F[k]=wn-re}n.modifiersData[o]=F}}var xt={name:"preventOverflow",enabled:!0,phase:"main",fn:on,requiresIfExists:["offset"]};function an(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function sn(r){return r===H(r)||!B(r)?We(r):an(r)}function fn(r){var n=r.getBoundingClientRect(),i=Z(n.width)/r.offsetWidth||1,o=Z(n.height)/r.offsetHeight||1;return i!==1||o!==1}function cn(r,n,i){i===void 0&&(i=!1);var o=B(n),a=B(n)&&fn(n),u=I(n),c=ee(r,a),f={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(o||!o&&!i)&&((C(n)!=="body"||Se(u))&&(f=sn(n)),B(n)?(d=ee(n,!0),d.x+=n.clientLeft,d.y+=n.clientTop):u&&(d.x=Be(u))),{x:c.left+f.scrollLeft-d.x,y:c.top+f.scrollTop-d.y,width:c.width,height:c.height}}function pn(r){var n=new Map,i=new Set,o=[];r.forEach(function(u){n.set(u.name,u)});function a(u){i.add(u.name);var c=[].concat(u.requires||[],u.requiresIfExists||[]);c.forEach(function(f){if(!i.has(f)){var d=n.get(f);d&&a(d)}}),o.push(u)}return r.forEach(function(u){i.has(u.name)||a(u)}),o}function un(r){var n=pn(r);return ot.reduce(function(i,o){return i.concat(n.filter(function(a){return a.phase===o}))},[])}function ln(r){var n;return function(){return n||(n=new Promise(function(i){Promise.resolve().then(function(){n=void 0,i(r())})})),n}}function dn(r){var n=r.reduce(function(i,o){var a=i[o.name];return i[o.name]=a?Object.assign({},a,o,{options:Object.assign({},a.options,o.options),data:Object.assign({},a.data,o.data)}):o,i},{});return Object.keys(n).map(function(i){return n[i]})}var Ot={placement:"bottom",modifiers:[],strategy:"absolute"};function $t(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return!n.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function we(r){r===void 0&&(r={});var n=r,i=n.defaultModifiers,o=i===void 0?[]:i,a=n.defaultOptions,u=a===void 0?Ot:a;return function(c,f,d){d===void 0&&(d=u);var p={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ot,u),modifiersData:{},elements:{reference:c,popper:f},attributes:{},styles:{}},h=[],g=!1,v={state:p,setOptions:function(_){var S=typeof _=="function"?_(p.options):_;A(),p.options=Object.assign({},u,p.options,S),p.scrollParents={reference:Q(c)?ce(c):c.contextElement?ce(c.contextElement):[],popper:ce(f)};var b=un(dn([].concat(o,p.options.modifiers)));return p.orderedModifiers=b.filter(function(T){return T.enabled}),y(),v.update()},forceUpdate:function(){if(!g){var _=p.elements,S=_.reference,b=_.popper;if($t(S,b)){p.rects={reference:cn(S,se(b),p.options.strategy==="fixed"),popper:ke(b)},p.reset=!1,p.placement=p.options.placement,p.orderedModifiers.forEach(function(z){return p.modifiersData[z.name]=Object.assign({},z.data)});for(var T=0;T<p.orderedModifiers.length;T++){if(p.reset===!0){p.reset=!1,T=-1;continue}var w=p.orderedModifiers[T],x=w.fn,k=w.options,M=k===void 0?{}:k,D=w.name;typeof x=="function"&&(p=x({state:p,options:M,name:D,instance:v})||p)}}}},update:ln(function(){return new Promise(function(_){v.forceUpdate(),_(p)})}),destroy:function(){A(),g=!0}};if(!$t(c,f))return v;v.setOptions(d).then(function(_){!g&&d.onFirstUpdate&&d.onFirstUpdate(_)});function y(){p.orderedModifiers.forEach(function(_){var S=_.name,b=_.options,T=b===void 0?{}:b,w=_.effect;if(typeof w=="function"){var x=w({state:p,name:S,instance:v,options:T}),k=function(){};h.push(x||k)}})}function A(){h.forEach(function(_){return _()}),h=[]}return v}}we();var mn=[Re,He,Me,Ae];we({defaultModifiers:mn});var gn=[Re,He,Me,Ae,wt,vt,xt,pt,bt],yn=we({defaultModifiers:gn});const usePopper=(r,n,i={})=>{const o={name:"updateState",enabled:!0,phase:"write",fn:({state:d})=>{const p=deriveState(d);Object.assign(c.value,p)},requires:["computeStyles"]},a=vue.computed(()=>{const{onFirstUpdate:d,placement:p,strategy:h,modifiers:g}=vue.unref(i);return{onFirstUpdate:d,placement:p||"bottom",strategy:h||"absolute",modifiers:[...g||[],o,{name:"applyStyles",enabled:!1}]}}),u=vue.shallowRef(),c=vue.ref({styles:{popper:{position:vue.unref(a).strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),f=()=>{u.value&&(u.value.destroy(),u.value=void 0)};return vue.watch(a,d=>{const p=vue.unref(u);p&&p.setOptions(d)},{deep:!0}),vue.watch([r,n],([d,p])=>{f(),!(!d||!p)&&(u.value=yn(d,p,vue.unref(a)))}),vue.onBeforeUnmount(()=>{f()}),{state:vue.computed(()=>{var d;return{...((d=vue.unref(u))==null?void 0:d.state)||{}}}),styles:vue.computed(()=>vue.unref(c).styles),attributes:vue.computed(()=>vue.unref(c).attributes),update:()=>{var d;return(d=vue.unref(u))==null?void 0:d.update()},forceUpdate:()=>{var d;return(d=vue.unref(u))==null?void 0:d.forceUpdate()},instanceRef:vue.computed(()=>vue.unref(u))}};function deriveState(r){const n=Object.keys(r.elements),i=lodashEs.fromPairs(n.map(a=>[a,r.styles[a]||{}])),o=lodashEs.fromPairs(n.map(a=>[a,r.attributes[a]]));return{styles:i,attributes:o}}function useTimeout(){let r;const n=(o,a)=>{i(),r=window.setTimeout(o,a)},i=()=>window.clearTimeout(r);return tryOnScopeDispose(()=>i()),{registerTimeout:n,cancelTimeout:i}}const defaultIdInjection={prefix:Math.floor(Math.random()*1e4),current:0},ID_INJECTION_KEY=Symbol("elIdInjection"),useIdInjection=()=>vue.getCurrentInstance()?vue.inject(ID_INJECTION_KEY,defaultIdInjection):defaultIdInjection,useId=r=>{const n=useIdInjection();!isClient&&n===defaultIdInjection&&debugWarn("IdInjection",`Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
254
254
  usage: app.provide(ID_INJECTION_KEY, {
@@ -274,4 +274,4 @@ usage: app.provide(ID_INJECTION_KEY, {
274
274
  top:0 !important;
275
275
  right:0 !important;
276
276
  `,CONTEXT_STYLE=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function calculateNodeStyling(r){const n=window.getComputedStyle(r),i=n.getPropertyValue("box-sizing"),o=Number.parseFloat(n.getPropertyValue("padding-bottom"))+Number.parseFloat(n.getPropertyValue("padding-top")),a=Number.parseFloat(n.getPropertyValue("border-bottom-width"))+Number.parseFloat(n.getPropertyValue("border-top-width"));return{contextStyle:CONTEXT_STYLE.map(c=>`${c}:${n.getPropertyValue(c)}`).join(";"),paddingSize:o,borderSize:a,boxSizing:i}}function calcTextareaHeight(r,n=1,i){var o;hiddenTextarea||(hiddenTextarea=document.createElement("textarea"),document.body.appendChild(hiddenTextarea));const{paddingSize:a,borderSize:u,boxSizing:c,contextStyle:f}=calculateNodeStyling(r);hiddenTextarea.setAttribute("style",`${f};${HIDDEN_STYLE}`),hiddenTextarea.value=r.value||r.placeholder||"";let d=hiddenTextarea.scrollHeight;const p={};c==="border-box"?d=d+u:c==="content-box"&&(d=d-a),hiddenTextarea.value="";const h=hiddenTextarea.scrollHeight-a;if(isNumber(n)){let g=h*n;c==="border-box"&&(g=g+a+u),d=Math.max(g,d),p.minHeight=`${g}px`}if(isNumber(i)){let g=h*i;c==="border-box"&&(g=g+a+u),d=Math.min(g,d)}return p.height=`${d}px`,(o=hiddenTextarea.parentNode)==null||o.removeChild(hiddenTextarea),hiddenTextarea=void 0,p}const inputProps=buildProps({id:{type:String,default:void 0},size:useSizeProp,disabled:Boolean,modelValue:{type:definePropType([String,Number,Object]),default:""},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:definePropType([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},suffixIcon:{type:iconPropType},prefixIcon:{type:iconPropType},containerRole:{type:String,default:void 0},label:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:definePropType([Object,Array,String]),default:()=>mutable({})}}),inputEmits={[UPDATE_MODEL_EVENT]:r=>isString(r),input:r=>isString(r),change:r=>isString(r),focus:r=>r instanceof FocusEvent,blur:r=>r instanceof FocusEvent,clear:()=>!0,mouseleave:r=>r instanceof MouseEvent,mouseenter:r=>r instanceof MouseEvent,keydown:r=>r instanceof Event,compositionstart:r=>r instanceof CompositionEvent,compositionupdate:r=>r instanceof CompositionEvent,compositionend:r=>r instanceof CompositionEvent},_hoisted_1$7=["role"],_hoisted_2$5=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],_hoisted_3$4=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],__default__$9=vue.defineComponent({name:"ElInput",inheritAttrs:!1}),_sfc_main$o=vue.defineComponent({...__default__$9,props:inputProps,emits:inputEmits,setup(r,{expose:n,emit:i}){const o=r,a=vue.useAttrs(),u=vue.useSlots(),c=vue.computed(()=>{const qe={};return o.containerRole==="combobox"&&(qe["aria-haspopup"]=a["aria-haspopup"],qe["aria-owns"]=a["aria-owns"],qe["aria-expanded"]=a["aria-expanded"]),qe}),f=vue.computed(()=>[o.type==="textarea"?S.b():_.b(),_.m(y.value),_.is("disabled",A.value),_.is("exceed",Fe.value),{[_.b("group")]:u.prepend||u.append,[_.bm("group","append")]:u.append,[_.bm("group","prepend")]:u.prepend,[_.m("prefix")]:u.prefix||o.prefixIcon,[_.m("suffix")]:u.suffix||o.suffixIcon||o.clearable||o.showPassword,[_.bm("suffix","password-clear")]:Ie.value&&Oe.value},a.class]),d=vue.computed(()=>[_.e("wrapper"),_.is("focus",oe.value)]),p=useAttrs({excludeKeys:vue.computed(()=>Object.keys(c.value))}),{form:h,formItem:g}=useFormItem(),{inputId:v}=useFormItemInputId(o,{formItemContext:g}),y=useFormSize(),A=useFormDisabled(),_=useNamespace("input"),S=useNamespace("textarea"),b=vue.shallowRef(),T=vue.shallowRef(),w=vue.ref(!1),x=vue.ref(!1),k=vue.ref(!1),M=vue.ref(),D=vue.shallowRef(o.inputStyle),z=vue.computed(()=>b.value||T.value),{wrapperRef:j,isFocused:oe,handleFocus:L,handleBlur:F}=useFocusController(z,{afterBlur(){var qe;o.validateEvent&&((qe=g==null?void 0:g.validate)==null||qe.call(g,"blur").catch(jt=>debugWarn(jt)))}}),O=vue.computed(()=>{var qe;return(qe=h==null?void 0:h.statusIcon)!=null?qe:!1}),ue=vue.computed(()=>(g==null?void 0:g.validateState)||""),_e=vue.computed(()=>ue.value&&ValidateComponentsMap[ue.value]),Ce=vue.computed(()=>k.value?view_default:hide_default),de=vue.computed(()=>[a.style,o.inputStyle]),ie=vue.computed(()=>[o.inputStyle,D.value,{resize:o.resize}]),Y=vue.computed(()=>lodashEs.isNil(o.modelValue)?"":String(o.modelValue)),Ie=vue.computed(()=>o.clearable&&!A.value&&!o.readonly&&!!Y.value&&(oe.value||w.value)),Oe=vue.computed(()=>o.showPassword&&!A.value&&!o.readonly&&!!Y.value&&(!!Y.value||oe.value)),kt=vue.computed(()=>o.showWordLimit&&!!p.value.maxlength&&(o.type==="text"||o.type==="textarea")&&!A.value&&!o.readonly&&!o.showPassword),Dt=vue.computed(()=>Y.value.length),Fe=vue.computed(()=>!!kt.value&&Dt.value>Number(p.value.maxlength)),$e=vue.computed(()=>!!u.suffix||!!o.suffixIcon||Ie.value||o.showPassword||kt.value||!!ue.value&&O.value),[Cn,Lt]=useCursor(b);useResizeObserver(T,qe=>{if(Ne(),!kt.value||o.resize!=="both")return;const jt=qe[0],{width:An}=jt.contentRect;M.value={right:`calc(100% - ${An+15+6}px)`}});const In=()=>{const{type:qe,autosize:jt}=o;if(!(!isClient||qe!=="textarea"||!T.value))if(jt){const An=isObject(jt)?jt.minRows:void 0,wn=isObject(jt)?jt.maxRows:void 0,En=calcTextareaHeight(T.value,An,wn);D.value={overflowY:"hidden",...En},vue.nextTick(()=>{T.value.offsetHeight,D.value=En})}else D.value={minHeight:calcTextareaHeight(T.value).minHeight}},Ne=(qe=>{let jt=!1;return()=>{var An;if(jt||!o.autosize)return;((An=T.value)==null?void 0:An.offsetParent)===null||(qe(),jt=!0)}})(In),pe=()=>{const qe=z.value,jt=o.formatter?o.formatter(Y.value):Y.value;!qe||qe.value===jt||(qe.value=jt)},At=async qe=>{Cn();let{value:jt}=qe.target;if(o.formatter&&(jt=o.parser?o.parser(jt):jt),!x.value){if(jt===Y.value){pe();return}i(UPDATE_MODEL_EVENT,jt),i("input",jt),await vue.nextTick(),pe(),Lt()}},Ve=qe=>{i("change",qe.target.value)},xe=qe=>{i("compositionstart",qe),x.value=!0},ze=qe=>{var jt;i("compositionupdate",qe);const An=(jt=qe.target)==null?void 0:jt.value,wn=An[An.length-1]||"";x.value=!isKorean(wn)},Pt=qe=>{i("compositionend",qe),x.value&&(x.value=!1,At(qe))},hn=()=>{k.value=!k.value,ae()},ae=async()=>{var qe;await vue.nextTick(),(qe=z.value)==null||qe.focus()},le=()=>{var qe;return(qe=z.value)==null?void 0:qe.blur()},re=qe=>{w.value=!1,i("mouseleave",qe)},V=qe=>{w.value=!0,i("mouseenter",qe)},$=qe=>{i("keydown",qe)},he=()=>{var qe;(qe=z.value)==null||qe.select()},Ue=()=>{i(UPDATE_MODEL_EVENT,""),i("change",""),i("clear"),i("input","")};return vue.watch(()=>o.modelValue,()=>{var qe;vue.nextTick(()=>In()),o.validateEvent&&((qe=g==null?void 0:g.validate)==null||qe.call(g,"change").catch(jt=>debugWarn(jt)))}),vue.watch(Y,()=>pe()),vue.watch(()=>o.type,async()=>{await vue.nextTick(),pe(),In()}),vue.onMounted(()=>{!o.formatter&&o.parser&&debugWarn("ElInput","If you set the parser, you also need to set the formatter."),pe(),vue.nextTick(In)}),n({input:b,textarea:T,ref:z,textareaStyle:ie,autosize:vue.toRef(o,"autosize"),focus:ae,blur:le,select:he,clear:Ue,resizeTextarea:In}),(qe,jt)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",vue.mergeProps(vue.unref(c),{class:vue.unref(f),style:vue.unref(de),role:qe.containerRole,onMouseenter:V,onMouseleave:re}),[vue.createCommentVNode(" input "),qe.type!=="textarea"?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[vue.createCommentVNode(" prepend slot "),qe.$slots.prepend?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(vue.unref(_).be("group","prepend"))},[vue.renderSlot(qe.$slots,"prepend")],2)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("div",{ref_key:"wrapperRef",ref:j,class:vue.normalizeClass(vue.unref(d))},[vue.createCommentVNode(" prefix slot "),qe.$slots.prefix||qe.prefixIcon?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:vue.normalizeClass(vue.unref(_).e("prefix"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(_).e("prefix-inner"))},[vue.renderSlot(qe.$slots,"prefix"),qe.prefixIcon?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(_).e("icon"))},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(qe.prefixIcon)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],2)],2)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("input",vue.mergeProps({id:vue.unref(v),ref_key:"input",ref:b,class:vue.unref(_).e("inner")},vue.unref(p),{type:qe.showPassword?k.value?"text":"password":qe.type,disabled:vue.unref(A),formatter:qe.formatter,parser:qe.parser,readonly:qe.readonly,autocomplete:qe.autocomplete,tabindex:qe.tabindex,"aria-label":qe.label,placeholder:qe.placeholder,style:qe.inputStyle,form:o.form,onCompositionstart:xe,onCompositionupdate:ze,onCompositionend:Pt,onInput:At,onFocus:jt[0]||(jt[0]=(...An)=>vue.unref(L)&&vue.unref(L)(...An)),onBlur:jt[1]||(jt[1]=(...An)=>vue.unref(F)&&vue.unref(F)(...An)),onChange:Ve,onKeydown:$}),null,16,_hoisted_2$5),vue.createCommentVNode(" suffix slot "),vue.unref($e)?(vue.openBlock(),vue.createElementBlock("span",{key:1,class:vue.normalizeClass(vue.unref(_).e("suffix"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(_).e("suffix-inner"))},[!vue.unref(Ie)||!vue.unref(Oe)||!vue.unref(kt)?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[vue.renderSlot(qe.$slots,"suffix"),qe.suffixIcon?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(_).e("icon"))},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(qe.suffixIcon)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],64)):vue.createCommentVNode("v-if",!0),vue.unref(Ie)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:1,class:vue.normalizeClass([vue.unref(_).e("icon"),vue.unref(_).e("clear")]),onMousedown:vue.withModifiers(vue.unref(NOOP),["prevent"]),onClick:Ue},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(circle_close_default))]),_:1},8,["class","onMousedown"])):vue.createCommentVNode("v-if",!0),vue.unref(Oe)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:2,class:vue.normalizeClass([vue.unref(_).e("icon"),vue.unref(_).e("password")]),onClick:hn},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(Ce))))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0),vue.unref(kt)?(vue.openBlock(),vue.createElementBlock("span",{key:3,class:vue.normalizeClass(vue.unref(_).e("count"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(_).e("count-inner"))},vue.toDisplayString(vue.unref(Dt))+" / "+vue.toDisplayString(vue.unref(p).maxlength),3)],2)):vue.createCommentVNode("v-if",!0),vue.unref(ue)&&vue.unref(_e)&&vue.unref(O)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:4,class:vue.normalizeClass([vue.unref(_).e("icon"),vue.unref(_).e("validateIcon"),vue.unref(_).is("loading",vue.unref(ue)==="validating")])},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(_e))))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],2)],2)):vue.createCommentVNode("v-if",!0)],2),vue.createCommentVNode(" append slot "),qe.$slots.append?(vue.openBlock(),vue.createElementBlock("div",{key:1,class:vue.normalizeClass(vue.unref(_).be("group","append"))},[vue.renderSlot(qe.$slots,"append")],2)):vue.createCommentVNode("v-if",!0)],64)):(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.createCommentVNode(" textarea "),vue.createElementVNode("textarea",vue.mergeProps({id:vue.unref(v),ref_key:"textarea",ref:T,class:vue.unref(S).e("inner")},vue.unref(p),{tabindex:qe.tabindex,disabled:vue.unref(A),readonly:qe.readonly,autocomplete:qe.autocomplete,style:vue.unref(ie),"aria-label":qe.label,placeholder:qe.placeholder,form:o.form,onCompositionstart:xe,onCompositionupdate:ze,onCompositionend:Pt,onInput:At,onFocus:jt[2]||(jt[2]=(...An)=>vue.unref(L)&&vue.unref(L)(...An)),onBlur:jt[3]||(jt[3]=(...An)=>vue.unref(F)&&vue.unref(F)(...An)),onChange:Ve,onKeydown:$}),null,16,_hoisted_3$4),vue.unref(kt)?(vue.openBlock(),vue.createElementBlock("span",{key:0,style:vue.normalizeStyle(M.value),class:vue.normalizeClass(vue.unref(_).e("count"))},vue.toDisplayString(vue.unref(Dt))+" / "+vue.toDisplayString(vue.unref(p).maxlength),7)):vue.createCommentVNode("v-if",!0)],64))],16,_hoisted_1$7)),[[vue.vShow,qe.type!=="hidden"]])}});var Input=_export_sfc(_sfc_main$o,[["__file","/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);const ElInput=withInstall(Input),GAP=4,BAR_MAP={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},renderThumbStyle=({move:r,size:n,bar:i})=>({[i.size]:n,transform:`translate${i.axis}(${r}%)`}),scrollbarContextKey=Symbol("scrollbarContextKey"),thumbProps=buildProps({vertical:Boolean,size:String,move:Number,ratio:{type:Number,required:!0},always:Boolean}),COMPONENT_NAME$2="Thumb",_sfc_main$n=vue.defineComponent({__name:"thumb",props:thumbProps,setup(r){const n=r,i=vue.inject(scrollbarContextKey),o=useNamespace("scrollbar");i||throwError(COMPONENT_NAME$2,"can not inject scrollbar context");const a=vue.ref(),u=vue.ref(),c=vue.ref({}),f=vue.ref(!1);let d=!1,p=!1,h=isClient?document.onselectstart:null;const g=vue.computed(()=>BAR_MAP[n.vertical?"vertical":"horizontal"]),v=vue.computed(()=>renderThumbStyle({size:n.size,move:n.move,bar:g.value})),y=vue.computed(()=>a.value[g.value.offset]**2/i.wrapElement[g.value.scrollSize]/n.ratio/u.value[g.value.offset]),A=M=>{var D;if(M.stopPropagation(),M.ctrlKey||[1,2].includes(M.button))return;(D=window.getSelection())==null||D.removeAllRanges(),S(M);const z=M.currentTarget;z&&(c.value[g.value.axis]=z[g.value.offset]-(M[g.value.client]-z.getBoundingClientRect()[g.value.direction]))},_=M=>{if(!u.value||!a.value||!i.wrapElement)return;const D=Math.abs(M.target.getBoundingClientRect()[g.value.direction]-M[g.value.client]),z=u.value[g.value.offset]/2,j=(D-z)*100*y.value/a.value[g.value.offset];i.wrapElement[g.value.scroll]=j*i.wrapElement[g.value.scrollSize]/100},S=M=>{M.stopImmediatePropagation(),d=!0,document.addEventListener("mousemove",b),document.addEventListener("mouseup",T),h=document.onselectstart,document.onselectstart=()=>!1},b=M=>{if(!a.value||!u.value||d===!1)return;const D=c.value[g.value.axis];if(!D)return;const z=(a.value.getBoundingClientRect()[g.value.direction]-M[g.value.client])*-1,j=u.value[g.value.offset]-D,oe=(z-j)*100*y.value/a.value[g.value.offset];i.wrapElement[g.value.scroll]=oe*i.wrapElement[g.value.scrollSize]/100},T=()=>{d=!1,c.value[g.value.axis]=0,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",T),k(),p&&(f.value=!1)},w=()=>{p=!1,f.value=!!n.size},x=()=>{p=!0,f.value=d};vue.onBeforeUnmount(()=>{k(),document.removeEventListener("mouseup",T)});const k=()=>{document.onselectstart!==h&&(document.onselectstart=h)};return useEventListener(vue.toRef(i,"scrollbarElement"),"mousemove",w),useEventListener(vue.toRef(i,"scrollbarElement"),"mouseleave",x),(M,D)=>(vue.openBlock(),vue.createBlock(vue.Transition,{name:vue.unref(o).b("fade"),persisted:""},{default:vue.withCtx(()=>[vue.withDirectives(vue.createElementVNode("div",{ref_key:"instance",ref:a,class:vue.normalizeClass([vue.unref(o).e("bar"),vue.unref(o).is(vue.unref(g).key)]),onMousedown:_},[vue.createElementVNode("div",{ref_key:"thumb",ref:u,class:vue.normalizeClass(vue.unref(o).e("thumb")),style:vue.normalizeStyle(vue.unref(v)),onMousedown:A},null,38)],34),[[vue.vShow,M.always||f.value]])]),_:1},8,["name"]))}});var Thumb=_export_sfc(_sfc_main$n,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);const barProps=buildProps({always:{type:Boolean,default:!0},width:String,height:String,ratioX:{type:Number,default:1},ratioY:{type:Number,default:1}}),_sfc_main$m=vue.defineComponent({__name:"bar",props:barProps,setup(r,{expose:n}){const i=r,o=vue.ref(0),a=vue.ref(0);return n({handleScroll:c=>{if(c){const f=c.offsetHeight-GAP,d=c.offsetWidth-GAP;a.value=c.scrollTop*100/f*i.ratioY,o.value=c.scrollLeft*100/d*i.ratioX}}}),(c,f)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(Thumb,{move:o.value,ratio:c.ratioX,size:c.width,always:c.always},null,8,["move","ratio","size","always"]),vue.createVNode(Thumb,{move:a.value,ratio:c.ratioY,size:c.height,vertical:"",always:c.always},null,8,["move","ratio","size","always"])],64))}});var Bar=_export_sfc(_sfc_main$m,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);const scrollbarProps=buildProps({height:{type:[String,Number],default:""},maxHeight:{type:[String,Number],default:""},native:{type:Boolean,default:!1},wrapStyle:{type:definePropType([String,Object,Array]),default:""},wrapClass:{type:[String,Array],default:""},viewClass:{type:[String,Array],default:""},viewStyle:{type:[String,Array,Object],default:""},noresize:Boolean,tag:{type:String,default:"div"},always:Boolean,minSize:{type:Number,default:20}}),scrollbarEmits={scroll:({scrollTop:r,scrollLeft:n})=>[r,n].every(isNumber)},COMPONENT_NAME$1="ElScrollbar",__default__$8=vue.defineComponent({name:COMPONENT_NAME$1}),_sfc_main$l=vue.defineComponent({...__default__$8,props:scrollbarProps,emits:scrollbarEmits,setup(r,{expose:n,emit:i}){const o=r,a=useNamespace("scrollbar");let u,c;const f=vue.ref(),d=vue.ref(),p=vue.ref(),h=vue.ref("0"),g=vue.ref("0"),v=vue.ref(),y=vue.ref(1),A=vue.ref(1),_=vue.computed(()=>{const D={};return o.height&&(D.height=addUnit(o.height)),o.maxHeight&&(D.maxHeight=addUnit(o.maxHeight)),[o.wrapStyle,D]}),S=vue.computed(()=>[o.wrapClass,a.e("wrap"),{[a.em("wrap","hidden-default")]:!o.native}]),b=vue.computed(()=>[a.e("view"),o.viewClass]),T=()=>{var D;d.value&&((D=v.value)==null||D.handleScroll(d.value),i("scroll",{scrollTop:d.value.scrollTop,scrollLeft:d.value.scrollLeft}))};function w(D,z){isObject(D)?d.value.scrollTo(D):isNumber(D)&&isNumber(z)&&d.value.scrollTo(D,z)}const x=D=>{if(!isNumber(D)){debugWarn(COMPONENT_NAME$1,"value must be a number");return}d.value.scrollTop=D},k=D=>{if(!isNumber(D)){debugWarn(COMPONENT_NAME$1,"value must be a number");return}d.value.scrollLeft=D},M=()=>{if(!d.value)return;const D=d.value.offsetHeight-GAP,z=d.value.offsetWidth-GAP,j=D**2/d.value.scrollHeight,oe=z**2/d.value.scrollWidth,L=Math.max(j,o.minSize),F=Math.max(oe,o.minSize);y.value=j/(D-j)/(L/(D-L)),A.value=oe/(z-oe)/(F/(z-F)),g.value=L+GAP<D?`${L}px`:"",h.value=F+GAP<z?`${F}px`:""};return vue.watch(()=>o.noresize,D=>{D?(u==null||u(),c==null||c()):({stop:u}=useResizeObserver(p,M),c=useEventListener("resize",M))},{immediate:!0}),vue.watch(()=>[o.maxHeight,o.height],()=>{o.native||vue.nextTick(()=>{var D;M(),d.value&&((D=v.value)==null||D.handleScroll(d.value))})}),vue.provide(scrollbarContextKey,vue.reactive({scrollbarElement:f,wrapElement:d})),vue.onMounted(()=>{o.native||vue.nextTick(()=>{M()})}),vue.onUpdated(()=>M()),n({wrapRef:d,update:M,scrollTo:w,setScrollTop:x,setScrollLeft:k,handleScroll:T}),(D,z)=>(vue.openBlock(),vue.createElementBlock("div",{ref_key:"scrollbarRef",ref:f,class:vue.normalizeClass(vue.unref(a).b())},[vue.createElementVNode("div",{ref_key:"wrapRef",ref:d,class:vue.normalizeClass(vue.unref(S)),style:vue.normalizeStyle(vue.unref(_)),onScroll:T},[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(D.tag),{ref_key:"resizeRef",ref:p,class:vue.normalizeClass(vue.unref(b)),style:vue.normalizeStyle(D.viewStyle)},{default:vue.withCtx(()=>[vue.renderSlot(D.$slots,"default")]),_:3},8,["class","style"]))],38),D.native?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createBlock(Bar,{key:0,ref_key:"barRef",ref:v,height:g.value,width:h.value,always:D.always,"ratio-x":A.value,"ratio-y":y.value},null,8,["height","width","always","ratio-x","ratio-y"]))],2))}});var Scrollbar=_export_sfc(_sfc_main$l,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);const ElScrollbar=withInstall(Scrollbar),POPPER_INJECTION_KEY=Symbol("popper"),POPPER_CONTENT_INJECTION_KEY=Symbol("popperContent"),roleTypes=["dialog","grid","group","listbox","menu","navigation","tooltip","tree"],popperProps=buildProps({role:{type:String,values:roleTypes,default:"tooltip"}}),__default__$7=vue.defineComponent({name:"ElPopper",inheritAttrs:!1}),_sfc_main$k=vue.defineComponent({...__default__$7,props:popperProps,setup(r,{expose:n}){const i=r,o=vue.ref(),a=vue.ref(),u=vue.ref(),c=vue.ref(),f=vue.computed(()=>i.role),d={triggerRef:o,popperInstanceRef:a,contentRef:u,referenceRef:c,role:f};return n(d),vue.provide(POPPER_INJECTION_KEY,d),(p,h)=>vue.renderSlot(p.$slots,"default")}});var Popper=_export_sfc(_sfc_main$k,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);const popperArrowProps=buildProps({arrowOffset:{type:Number,default:5}}),__default__$6=vue.defineComponent({name:"ElPopperArrow",inheritAttrs:!1}),_sfc_main$j=vue.defineComponent({...__default__$6,props:popperArrowProps,setup(r,{expose:n}){const i=r,o=useNamespace("popper"),{arrowOffset:a,arrowRef:u,arrowStyle:c}=vue.inject(POPPER_CONTENT_INJECTION_KEY,void 0);return vue.watch(()=>i.arrowOffset,f=>{a.value=f}),vue.onBeforeUnmount(()=>{u.value=void 0}),n({arrowRef:u}),(f,d)=>(vue.openBlock(),vue.createElementBlock("span",{ref_key:"arrowRef",ref:u,class:vue.normalizeClass(vue.unref(o).e("arrow")),style:vue.normalizeStyle(vue.unref(c)),"data-popper-arrow":""},null,6))}});var ElPopperArrow=_export_sfc(_sfc_main$j,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);const NAME="ElOnlyChild",OnlyChild=vue.defineComponent({name:NAME,setup(r,{slots:n,attrs:i}){var o;const a=vue.inject(FORWARD_REF_INJECTION_KEY),u=useForwardRefDirective((o=a==null?void 0:a.setForwardRef)!=null?o:NOOP);return()=>{var c;const f=(c=n.default)==null?void 0:c.call(n,i);if(!f)return null;if(f.length>1)return debugWarn(NAME,"requires exact only one valid child."),null;const d=findFirstLegitChild(f);return d?vue.withDirectives(vue.cloneVNode(d,i),[[u]]):(debugWarn(NAME,"no valid child node found"),null)}}});function findFirstLegitChild(r){if(!r)return null;const n=r;for(const i of n){if(isObject(i))switch(i.type){case vue.Comment:continue;case vue.Text:case"svg":return wrapTextContent(i);case vue.Fragment:return findFirstLegitChild(i.children);default:return i}return wrapTextContent(i)}return null}function wrapTextContent(r){const n=useNamespace("only-child");return vue.createVNode("span",{class:n.e("content")},[r])}const popperTriggerProps=buildProps({virtualRef:{type:definePropType(Object)},virtualTriggering:Boolean,onMouseenter:{type:definePropType(Function)},onMouseleave:{type:definePropType(Function)},onClick:{type:definePropType(Function)},onKeydown:{type:definePropType(Function)},onFocus:{type:definePropType(Function)},onBlur:{type:definePropType(Function)},onContextmenu:{type:definePropType(Function)},id:String,open:Boolean}),__default__$5=vue.defineComponent({name:"ElPopperTrigger",inheritAttrs:!1}),_sfc_main$i=vue.defineComponent({...__default__$5,props:popperTriggerProps,setup(r,{expose:n}){const i=r,{role:o,triggerRef:a}=vue.inject(POPPER_INJECTION_KEY,void 0);useForwardRef(a);const u=vue.computed(()=>f.value?i.id:void 0),c=vue.computed(()=>{if(o&&o.value==="tooltip")return i.open&&i.id?i.id:void 0}),f=vue.computed(()=>{if(o&&o.value!=="tooltip")return o.value}),d=vue.computed(()=>f.value?`${i.open}`:void 0);let p;return vue.onMounted(()=>{vue.watch(()=>i.virtualRef,h=>{h&&(a.value=unrefElement(h))},{immediate:!0}),vue.watch(a,(h,g)=>{p==null||p(),p=void 0,isElement(h)&&(["onMouseenter","onMouseleave","onClick","onKeydown","onFocus","onBlur","onContextmenu"].forEach(v=>{var y;const A=i[v];A&&(h.addEventListener(v.slice(2).toLowerCase(),A),(y=g==null?void 0:g.removeEventListener)==null||y.call(g,v.slice(2).toLowerCase(),A))}),p=vue.watch([u,c,f,d],v=>{["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach((y,A)=>{lodashEs.isNil(v[A])?h.removeAttribute(y):h.setAttribute(y,v[A])})},{immediate:!0})),isElement(g)&&["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach(v=>g.removeAttribute(v))},{immediate:!0})}),vue.onBeforeUnmount(()=>{p==null||p(),p=void 0}),n({triggerRef:a}),(h,g)=>h.virtualTriggering?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createBlock(vue.unref(OnlyChild),vue.mergeProps({key:0},h.$attrs,{"aria-controls":vue.unref(u),"aria-describedby":vue.unref(c),"aria-expanded":vue.unref(d),"aria-haspopup":vue.unref(f)}),{default:vue.withCtx(()=>[vue.renderSlot(h.$slots,"default")]),_:3},16,["aria-controls","aria-describedby","aria-expanded","aria-haspopup"]))}});var ElPopperTrigger=_export_sfc(_sfc_main$i,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);const FOCUS_AFTER_TRAPPED="focus-trap.focus-after-trapped",FOCUS_AFTER_RELEASED="focus-trap.focus-after-released",FOCUSOUT_PREVENTED="focus-trap.focusout-prevented",FOCUS_AFTER_TRAPPED_OPTS={cancelable:!0,bubbles:!1},FOCUSOUT_PREVENTED_OPTS={cancelable:!0,bubbles:!1},ON_TRAP_FOCUS_EVT="focusAfterTrapped",ON_RELEASE_FOCUS_EVT="focusAfterReleased",FOCUS_TRAP_INJECTION_KEY=Symbol("elFocusTrap"),focusReason=vue.ref(),lastUserFocusTimestamp=vue.ref(0),lastAutomatedFocusTimestamp=vue.ref(0);let focusReasonUserCount=0;const obtainAllFocusableElements=r=>{const n=[],i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?NodeFilter.FILTER_SKIP:o.tabIndex>=0||o===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)n.push(i.currentNode);return n},getVisibleElement=(r,n)=>{for(const i of r)if(!isHidden(i,n))return i},isHidden=(r,n)=>{if(process.env.NODE_ENV==="test")return!1;if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(n&&r===n)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1},getEdges=r=>{const n=obtainAllFocusableElements(r),i=getVisibleElement(n,r),o=getVisibleElement(n.reverse(),r);return[i,o]},isSelectable=r=>r instanceof HTMLInputElement&&"select"in r,tryFocus=(r,n)=>{if(r&&r.focus){const i=document.activeElement;r.focus({preventScroll:!0}),lastAutomatedFocusTimestamp.value=window.performance.now(),r!==i&&isSelectable(r)&&n&&r.select()}};function removeFromStack(r,n){const i=[...r],o=r.indexOf(n);return o!==-1&&i.splice(o,1),i}const createFocusableStack=()=>{let r=[];return{push:o=>{const a=r[0];a&&o!==a&&a.pause(),r=removeFromStack(r,o),r.unshift(o)},remove:o=>{var a,u;r=removeFromStack(r,o),(u=(a=r[0])==null?void 0:a.resume)==null||u.call(a)}}},focusFirstDescendant=(r,n=!1)=>{const i=document.activeElement;for(const o of r)if(tryFocus(o,n),document.activeElement!==i)return},focusableStack=createFocusableStack(),isFocusCausedByUserEvent=()=>lastUserFocusTimestamp.value>lastAutomatedFocusTimestamp.value,notifyFocusReasonPointer=()=>{focusReason.value="pointer",lastUserFocusTimestamp.value=window.performance.now()},notifyFocusReasonKeydown=()=>{focusReason.value="keyboard",lastUserFocusTimestamp.value=window.performance.now()},useFocusReason=()=>(vue.onMounted(()=>{focusReasonUserCount===0&&(document.addEventListener("mousedown",notifyFocusReasonPointer),document.addEventListener("touchstart",notifyFocusReasonPointer),document.addEventListener("keydown",notifyFocusReasonKeydown)),focusReasonUserCount++}),vue.onBeforeUnmount(()=>{focusReasonUserCount--,focusReasonUserCount<=0&&(document.removeEventListener("mousedown",notifyFocusReasonPointer),document.removeEventListener("touchstart",notifyFocusReasonPointer),document.removeEventListener("keydown",notifyFocusReasonKeydown))}),{focusReason,lastUserFocusTimestamp,lastAutomatedFocusTimestamp}),createFocusOutPreventedEvent=r=>new CustomEvent(FOCUSOUT_PREVENTED,{...FOCUSOUT_PREVENTED_OPTS,detail:r}),_sfc_main$h=vue.defineComponent({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[ON_TRAP_FOCUS_EVT,ON_RELEASE_FOCUS_EVT,"focusin","focusout","focusout-prevented","release-requested"],setup(r,{emit:n}){const i=vue.ref();let o,a;const{focusReason:u}=useFocusReason();useEscapeKeydown(A=>{r.trapped&&!c.paused&&n("release-requested",A)});const c={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},f=A=>{if(!r.loop&&!r.trapped||c.paused)return;const{key:_,altKey:S,ctrlKey:b,metaKey:T,currentTarget:w,shiftKey:x}=A,{loop:k}=r,M=_===EVENT_CODE.tab&&!S&&!b&&!T,D=document.activeElement;if(M&&D){const z=w,[j,oe]=getEdges(z);if(j&&oe){if(!x&&D===oe){const F=createFocusOutPreventedEvent({focusReason:u.value});n("focusout-prevented",F),F.defaultPrevented||(A.preventDefault(),k&&tryFocus(j,!0))}else if(x&&[j,z].includes(D)){const F=createFocusOutPreventedEvent({focusReason:u.value});n("focusout-prevented",F),F.defaultPrevented||(A.preventDefault(),k&&tryFocus(oe,!0))}}else if(D===z){const F=createFocusOutPreventedEvent({focusReason:u.value});n("focusout-prevented",F),F.defaultPrevented||A.preventDefault()}}};vue.provide(FOCUS_TRAP_INJECTION_KEY,{focusTrapRef:i,onKeydown:f}),vue.watch(()=>r.focusTrapEl,A=>{A&&(i.value=A)},{immediate:!0}),vue.watch([i],([A],[_])=>{A&&(A.addEventListener("keydown",f),A.addEventListener("focusin",h),A.addEventListener("focusout",g)),_&&(_.removeEventListener("keydown",f),_.removeEventListener("focusin",h),_.removeEventListener("focusout",g))});const d=A=>{n(ON_TRAP_FOCUS_EVT,A)},p=A=>n(ON_RELEASE_FOCUS_EVT,A),h=A=>{const _=vue.unref(i);if(!_)return;const S=A.target,b=A.relatedTarget,T=S&&_.contains(S);r.trapped||b&&_.contains(b)||(o=b),T&&n("focusin",A),!c.paused&&r.trapped&&(T?a=S:tryFocus(a,!0))},g=A=>{const _=vue.unref(i);if(!(c.paused||!_))if(r.trapped){const S=A.relatedTarget;!lodashEs.isNil(S)&&!_.contains(S)&&setTimeout(()=>{if(!c.paused&&r.trapped){const b=createFocusOutPreventedEvent({focusReason:u.value});n("focusout-prevented",b),b.defaultPrevented||tryFocus(a,!0)}},0)}else{const S=A.target;S&&_.contains(S)||n("focusout",A)}};async function v(){await vue.nextTick();const A=vue.unref(i);if(A){focusableStack.push(c);const _=A.contains(document.activeElement)?o:document.activeElement;if(o=_,!A.contains(_)){const b=new Event(FOCUS_AFTER_TRAPPED,FOCUS_AFTER_TRAPPED_OPTS);A.addEventListener(FOCUS_AFTER_TRAPPED,d),A.dispatchEvent(b),b.defaultPrevented||vue.nextTick(()=>{let T=r.focusStartEl;isString(T)||(tryFocus(T),document.activeElement!==T&&(T="first")),T==="first"&&focusFirstDescendant(obtainAllFocusableElements(A),!0),(document.activeElement===_||T==="container")&&tryFocus(A)})}}}function y(){const A=vue.unref(i);if(A){A.removeEventListener(FOCUS_AFTER_TRAPPED,d);const _=new CustomEvent(FOCUS_AFTER_RELEASED,{...FOCUS_AFTER_TRAPPED_OPTS,detail:{focusReason:u.value}});A.addEventListener(FOCUS_AFTER_RELEASED,p),A.dispatchEvent(_),!_.defaultPrevented&&(u.value=="keyboard"||!isFocusCausedByUserEvent()||A.contains(document.activeElement))&&tryFocus(o??document.body),A.removeEventListener(FOCUS_AFTER_RELEASED,d),focusableStack.remove(c)}}return vue.onMounted(()=>{r.trapped&&v(),vue.watch(()=>r.trapped,A=>{A?v():y()})}),vue.onBeforeUnmount(()=>{r.trapped&&y()}),{onKeydown:f}}});function _sfc_render$4(r,n,i,o,a,u){return vue.renderSlot(r.$slots,"default",{handleKeydown:r.onKeydown})}var ElFocusTrap=_export_sfc(_sfc_main$h,[["render",_sfc_render$4],["__file","/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);const POSITIONING_STRATEGIES=["fixed","absolute"],popperCoreConfigProps=buildProps({boundariesPadding:{type:Number,default:0},fallbackPlacements:{type:definePropType(Array),default:void 0},gpuAcceleration:{type:Boolean,default:!0},offset:{type:Number,default:12},placement:{type:String,values:Ee,default:"bottom"},popperOptions:{type:definePropType(Object),default:()=>({})},strategy:{type:String,values:POSITIONING_STRATEGIES,default:"absolute"}}),popperContentProps=buildProps({...popperCoreConfigProps,id:String,style:{type:definePropType([String,Array,Object])},className:{type:definePropType([String,Array,Object])},effect:{type:String,default:"dark"},visible:Boolean,enterable:{type:Boolean,default:!0},pure:Boolean,focusOnShow:{type:Boolean,default:!1},trapping:{type:Boolean,default:!1},popperClass:{type:definePropType([String,Array,Object])},popperStyle:{type:definePropType([String,Array,Object])},referenceEl:{type:definePropType(Object)},triggerTargetEl:{type:definePropType(Object)},stopPopperMouseEvent:{type:Boolean,default:!0},ariaLabel:{type:String,default:void 0},virtualTriggering:Boolean,zIndex:Number}),popperContentEmits={mouseenter:r=>r instanceof MouseEvent,mouseleave:r=>r instanceof MouseEvent,focus:()=>!0,blur:()=>!0,close:()=>!0},buildPopperOptions=(r,n=[])=>{const{placement:i,strategy:o,popperOptions:a}=r,u={placement:i,strategy:o,...a,modifiers:[...genModifiers(r),...n]};return deriveExtraModifiers(u,a==null?void 0:a.modifiers),u},unwrapMeasurableEl=r=>{if(isClient)return unrefElement(r)};function genModifiers(r){const{offset:n,gpuAcceleration:i,fallbackPlacements:o}=r;return[{name:"offset",options:{offset:[0,n??12]}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5,fallbackPlacements:o}},{name:"computeStyles",options:{gpuAcceleration:i}}]}function deriveExtraModifiers(r,n){n&&(r.modifiers=[...r.modifiers,...n??[]])}const DEFAULT_ARROW_OFFSET=0,usePopperContent=r=>{const{popperInstanceRef:n,contentRef:i,triggerRef:o,role:a}=vue.inject(POPPER_INJECTION_KEY,void 0),u=vue.ref(),c=vue.ref(),f=vue.computed(()=>({name:"eventListeners",enabled:!!r.visible})),d=vue.computed(()=>{var b;const T=vue.unref(u),w=(b=vue.unref(c))!=null?b:DEFAULT_ARROW_OFFSET;return{name:"arrow",enabled:!lodashEs.isUndefined(T),options:{element:T,padding:w}}}),p=vue.computed(()=>({onFirstUpdate:()=>{A()},...buildPopperOptions(r,[vue.unref(d),vue.unref(f)])})),h=vue.computed(()=>unwrapMeasurableEl(r.referenceEl)||vue.unref(o)),{attributes:g,state:v,styles:y,update:A,forceUpdate:_,instanceRef:S}=usePopper(h,i,p);return vue.watch(S,b=>n.value=b),vue.onMounted(()=>{vue.watch(()=>{var b;return(b=vue.unref(h))==null?void 0:b.getBoundingClientRect()},()=>{A()})}),{attributes:g,arrowRef:u,contentRef:i,instanceRef:S,state:v,styles:y,role:a,forceUpdate:_,update:A}},usePopperContentDOM=(r,{attributes:n,styles:i,role:o})=>{const{nextZIndex:a}=useZIndex(),u=useNamespace("popper"),c=vue.computed(()=>vue.unref(n).popper),f=vue.ref(r.zIndex||a()),d=vue.computed(()=>[u.b(),u.is("pure",r.pure),u.is(r.effect),r.popperClass]),p=vue.computed(()=>[{zIndex:vue.unref(f)},vue.unref(i).popper,r.popperStyle||{}]),h=vue.computed(()=>o.value==="dialog"?"false":void 0),g=vue.computed(()=>vue.unref(i).arrow||{});return{ariaModal:h,arrowStyle:g,contentAttrs:c,contentClass:d,contentStyle:p,contentZIndex:f,updateZIndex:()=>{f.value=r.zIndex||a()}}},usePopperContentFocusTrap=(r,n)=>{const i=vue.ref(!1),o=vue.ref();return{focusStartRef:o,trapped:i,onFocusAfterReleased:p=>{var h;((h=p.detail)==null?void 0:h.focusReason)!=="pointer"&&(o.value="first",n("blur"))},onFocusAfterTrapped:()=>{n("focus")},onFocusInTrap:p=>{r.visible&&!i.value&&(p.target&&(o.value=p.target),i.value=!0)},onFocusoutPrevented:p=>{r.trapping||(p.detail.focusReason==="pointer"&&p.preventDefault(),i.value=!1)},onReleaseRequested:()=>{i.value=!1,n("close")}}},__default__$4=vue.defineComponent({name:"ElPopperContent"}),_sfc_main$g=vue.defineComponent({...__default__$4,props:popperContentProps,emits:popperContentEmits,setup(r,{expose:n,emit:i}){const o=r,{focusStartRef:a,trapped:u,onFocusAfterReleased:c,onFocusAfterTrapped:f,onFocusInTrap:d,onFocusoutPrevented:p,onReleaseRequested:h}=usePopperContentFocusTrap(o,i),{attributes:g,arrowRef:v,contentRef:y,styles:A,instanceRef:_,role:S,update:b}=usePopperContent(o),{ariaModal:T,arrowStyle:w,contentAttrs:x,contentClass:k,contentStyle:M,updateZIndex:D}=usePopperContentDOM(o,{styles:A,attributes:g,role:S}),z=vue.inject(formItemContextKey,void 0),j=vue.ref();vue.provide(POPPER_CONTENT_INJECTION_KEY,{arrowStyle:w,arrowRef:v,arrowOffset:j}),z&&(z.addInputId||z.removeInputId)&&vue.provide(formItemContextKey,{...z,addInputId:NOOP,removeInputId:NOOP});let oe;const L=(O=!0)=>{b(),O&&D()},F=()=>{L(!1),o.visible&&o.focusOnShow?u.value=!0:o.visible===!1&&(u.value=!1)};return vue.onMounted(()=>{vue.watch(()=>o.triggerTargetEl,(O,ue)=>{oe==null||oe(),oe=void 0;const _e=vue.unref(O||y.value),Ce=vue.unref(ue||y.value);isElement(_e)&&(oe=vue.watch([S,()=>o.ariaLabel,T,()=>o.id],de=>{["role","aria-label","aria-modal","id"].forEach((ie,Y)=>{lodashEs.isNil(de[Y])?_e.removeAttribute(ie):_e.setAttribute(ie,de[Y])})},{immediate:!0})),Ce!==_e&&isElement(Ce)&&["role","aria-label","aria-modal","id"].forEach(de=>{Ce.removeAttribute(de)})},{immediate:!0}),vue.watch(()=>o.visible,F,{immediate:!0})}),vue.onBeforeUnmount(()=>{oe==null||oe(),oe=void 0}),n({popperContentRef:y,popperInstanceRef:_,updatePopper:L,contentStyle:M}),(O,ue)=>(vue.openBlock(),vue.createElementBlock("div",vue.mergeProps({ref_key:"contentRef",ref:y},vue.unref(x),{style:vue.unref(M),class:vue.unref(k),tabindex:"-1",onMouseenter:ue[0]||(ue[0]=_e=>O.$emit("mouseenter",_e)),onMouseleave:ue[1]||(ue[1]=_e=>O.$emit("mouseleave",_e))}),[vue.createVNode(vue.unref(ElFocusTrap),{trapped:vue.unref(u),"trap-on-focus-in":!0,"focus-trap-el":vue.unref(y),"focus-start-el":vue.unref(a),onFocusAfterTrapped:vue.unref(f),onFocusAfterReleased:vue.unref(c),onFocusin:vue.unref(d),onFocusoutPrevented:vue.unref(p),onReleaseRequested:vue.unref(h)},{default:vue.withCtx(()=>[vue.renderSlot(O.$slots,"default")]),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusin","onFocusoutPrevented","onReleaseRequested"])],16))}});var ElPopperContent=_export_sfc(_sfc_main$g,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);const ElPopper=withInstall(Popper),TOOLTIP_INJECTION_KEY=Symbol("elTooltip"),useTooltipContentProps=buildProps({...useDelayedToggleProps,...popperContentProps,appendTo:{type:definePropType([String,Object])},content:{type:String,default:""},rawContent:{type:Boolean,default:!1},persistent:Boolean,ariaLabel:String,visible:{type:definePropType(Boolean),default:null},transition:String,teleported:{type:Boolean,default:!0},disabled:Boolean}),useTooltipTriggerProps=buildProps({...popperTriggerProps,disabled:Boolean,trigger:{type:definePropType([String,Array]),default:"hover"},triggerKeys:{type:definePropType(Array),default:()=>[EVENT_CODE.enter,EVENT_CODE.space]}}),{useModelToggleProps:useTooltipModelToggleProps,useModelToggleEmits:useTooltipModelToggleEmits,useModelToggle:useTooltipModelToggle}=createModelToggleComposable("visible"),useTooltipProps=buildProps({...popperProps,...useTooltipModelToggleProps,...useTooltipContentProps,...useTooltipTriggerProps,...popperArrowProps,showArrow:{type:Boolean,default:!0}}),tooltipEmits=[...useTooltipModelToggleEmits,"before-show","before-hide","show","hide","open","close"],isTriggerType=(r,n)=>isArray(r)?r.includes(n):r===n,whenTrigger=(r,n,i)=>o=>{isTriggerType(vue.unref(r),n)&&i(o)},__default__$3=vue.defineComponent({name:"ElTooltipTrigger"}),_sfc_main$f=vue.defineComponent({...__default__$3,props:useTooltipTriggerProps,setup(r,{expose:n}){const i=r,o=useNamespace("tooltip"),{controlled:a,id:u,open:c,onOpen:f,onClose:d,onToggle:p}=vue.inject(TOOLTIP_INJECTION_KEY,void 0),h=vue.ref(null),g=()=>{if(vue.unref(a)||i.disabled)return!0},v=vue.toRef(i,"trigger"),y=composeEventHandlers(g,whenTrigger(v,"hover",f)),A=composeEventHandlers(g,whenTrigger(v,"hover",d)),_=composeEventHandlers(g,whenTrigger(v,"click",x=>{x.button===0&&p(x)})),S=composeEventHandlers(g,whenTrigger(v,"focus",f)),b=composeEventHandlers(g,whenTrigger(v,"focus",d)),T=composeEventHandlers(g,whenTrigger(v,"contextmenu",x=>{x.preventDefault(),p(x)})),w=composeEventHandlers(g,x=>{const{code:k}=x;i.triggerKeys.includes(k)&&(x.preventDefault(),p(x))});return n({triggerRef:h}),(x,k)=>(vue.openBlock(),vue.createBlock(vue.unref(ElPopperTrigger),{id:vue.unref(u),"virtual-ref":x.virtualRef,open:vue.unref(c),"virtual-triggering":x.virtualTriggering,class:vue.normalizeClass(vue.unref(o).e("trigger")),onBlur:vue.unref(b),onClick:vue.unref(_),onContextmenu:vue.unref(T),onFocus:vue.unref(S),onMouseenter:vue.unref(y),onMouseleave:vue.unref(A),onKeydown:vue.unref(w)},{default:vue.withCtx(()=>[vue.renderSlot(x.$slots,"default")]),_:3},8,["id","virtual-ref","open","virtual-triggering","class","onBlur","onClick","onContextmenu","onFocus","onMouseenter","onMouseleave","onKeydown"]))}});var ElTooltipTrigger=_export_sfc(_sfc_main$f,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);const __default__$2=vue.defineComponent({name:"ElTooltipContent",inheritAttrs:!1}),_sfc_main$e=vue.defineComponent({...__default__$2,props:useTooltipContentProps,setup(r,{expose:n}){const i=r,{selector:o}=usePopperContainerId(),a=useNamespace("tooltip"),u=vue.ref(null),c=vue.ref(!1),{controlled:f,id:d,open:p,trigger:h,onClose:g,onOpen:v,onShow:y,onHide:A,onBeforeShow:_,onBeforeHide:S}=vue.inject(TOOLTIP_INJECTION_KEY,void 0),b=vue.computed(()=>i.transition||`${a.namespace.value}-fade-in-linear`),T=vue.computed(()=>process.env.NODE_ENV==="test"?!0:i.persistent);vue.onBeforeUnmount(()=>{c.value=!0});const w=vue.computed(()=>vue.unref(T)?!0:vue.unref(p)),x=vue.computed(()=>i.disabled?!1:vue.unref(p)),k=vue.computed(()=>i.appendTo||o.value),M=vue.computed(()=>{var de;return(de=i.style)!=null?de:{}}),D=vue.computed(()=>!vue.unref(p)),z=()=>{A()},j=()=>{if(vue.unref(f))return!0},oe=composeEventHandlers(j,()=>{i.enterable&&vue.unref(h)==="hover"&&v()}),L=composeEventHandlers(j,()=>{vue.unref(h)==="hover"&&g()}),F=()=>{var de,ie;(ie=(de=u.value)==null?void 0:de.updatePopper)==null||ie.call(de),_==null||_()},O=()=>{S==null||S()},ue=()=>{y(),Ce=onClickOutside(vue.computed(()=>{var de;return(de=u.value)==null?void 0:de.popperContentRef}),()=>{if(vue.unref(f))return;vue.unref(h)!=="hover"&&g()})},_e=()=>{i.virtualTriggering||g()};let Ce;return vue.watch(()=>vue.unref(p),de=>{de||Ce==null||Ce()},{flush:"post"}),vue.watch(()=>i.content,()=>{var de,ie;(ie=(de=u.value)==null?void 0:de.updatePopper)==null||ie.call(de)}),n({contentRef:u}),(de,ie)=>(vue.openBlock(),vue.createBlock(vue.Teleport,{disabled:!de.teleported,to:vue.unref(k)},[vue.createVNode(vue.Transition,{name:vue.unref(b),onAfterLeave:z,onBeforeEnter:F,onAfterEnter:ue,onBeforeLeave:O},{default:vue.withCtx(()=>[vue.unref(w)?vue.withDirectives((vue.openBlock(),vue.createBlock(vue.unref(ElPopperContent),vue.mergeProps({key:0,id:vue.unref(d),ref_key:"contentRef",ref:u},de.$attrs,{"aria-label":de.ariaLabel,"aria-hidden":vue.unref(D),"boundaries-padding":de.boundariesPadding,"fallback-placements":de.fallbackPlacements,"gpu-acceleration":de.gpuAcceleration,offset:de.offset,placement:de.placement,"popper-options":de.popperOptions,strategy:de.strategy,effect:de.effect,enterable:de.enterable,pure:de.pure,"popper-class":de.popperClass,"popper-style":[de.popperStyle,vue.unref(M)],"reference-el":de.referenceEl,"trigger-target-el":de.triggerTargetEl,visible:vue.unref(x),"z-index":de.zIndex,onMouseenter:vue.unref(oe),onMouseleave:vue.unref(L),onBlur:_e,onClose:vue.unref(g)}),{default:vue.withCtx(()=>[c.value?vue.createCommentVNode("v-if",!0):vue.renderSlot(de.$slots,"default",{key:0})]),_:3},16,["id","aria-label","aria-hidden","boundaries-padding","fallback-placements","gpu-acceleration","offset","placement","popper-options","strategy","effect","enterable","pure","popper-class","popper-style","reference-el","trigger-target-el","visible","z-index","onMouseenter","onMouseleave","onClose"])),[[vue.vShow,vue.unref(x)]]):vue.createCommentVNode("v-if",!0)]),_:3},8,["name"])],8,["disabled","to"]))}});var ElTooltipContent=_export_sfc(_sfc_main$e,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);const _hoisted_1$6=["innerHTML"],_hoisted_2$4={key:1},__default__$1=vue.defineComponent({name:"ElTooltip"}),_sfc_main$d=vue.defineComponent({...__default__$1,props:useTooltipProps,emits:tooltipEmits,setup(r,{expose:n,emit:i}){const o=r;usePopperContainer();const a=useId(),u=vue.ref(),c=vue.ref(),f=()=>{var b;const T=vue.unref(u);T&&((b=T.popperInstanceRef)==null||b.update())},d=vue.ref(!1),p=vue.ref(),{show:h,hide:g,hasUpdateHandler:v}=useTooltipModelToggle({indicator:d,toggleReason:p}),{onOpen:y,onClose:A}=useDelayedToggle({showAfter:vue.toRef(o,"showAfter"),hideAfter:vue.toRef(o,"hideAfter"),autoClose:vue.toRef(o,"autoClose"),open:h,close:g}),_=vue.computed(()=>isBoolean(o.visible)&&!v.value);vue.provide(TOOLTIP_INJECTION_KEY,{controlled:_,id:a,open:vue.readonly(d),trigger:vue.toRef(o,"trigger"),onOpen:b=>{y(b)},onClose:b=>{A(b)},onToggle:b=>{vue.unref(d)?A(b):y(b)},onShow:()=>{i("show",p.value)},onHide:()=>{i("hide",p.value)},onBeforeShow:()=>{i("before-show",p.value)},onBeforeHide:()=>{i("before-hide",p.value)},updatePopper:f}),vue.watch(()=>o.disabled,b=>{b&&d.value&&(d.value=!1)});const S=()=>{var b,T;const w=(T=(b=c.value)==null?void 0:b.contentRef)==null?void 0:T.popperContentRef;return w&&w.contains(document.activeElement)};return vue.onDeactivated(()=>d.value&&g()),n({popperRef:u,contentRef:c,isFocusInsideContent:S,updatePopper:f,onOpen:y,onClose:A,hide:g}),(b,T)=>(vue.openBlock(),vue.createBlock(vue.unref(ElPopper),{ref_key:"popperRef",ref:u,role:b.role},{default:vue.withCtx(()=>[vue.createVNode(ElTooltipTrigger,{disabled:b.disabled,trigger:b.trigger,"trigger-keys":b.triggerKeys,"virtual-ref":b.virtualRef,"virtual-triggering":b.virtualTriggering},{default:vue.withCtx(()=>[b.$slots.default?vue.renderSlot(b.$slots,"default",{key:0}):vue.createCommentVNode("v-if",!0)]),_:3},8,["disabled","trigger","trigger-keys","virtual-ref","virtual-triggering"]),vue.createVNode(ElTooltipContent,{ref_key:"contentRef",ref:c,"aria-label":b.ariaLabel,"boundaries-padding":b.boundariesPadding,content:b.content,disabled:b.disabled,effect:b.effect,enterable:b.enterable,"fallback-placements":b.fallbackPlacements,"hide-after":b.hideAfter,"gpu-acceleration":b.gpuAcceleration,offset:b.offset,persistent:b.persistent,"popper-class":b.popperClass,"popper-style":b.popperStyle,placement:b.placement,"popper-options":b.popperOptions,pure:b.pure,"raw-content":b.rawContent,"reference-el":b.referenceEl,"trigger-target-el":b.triggerTargetEl,"show-after":b.showAfter,strategy:b.strategy,teleported:b.teleported,transition:b.transition,"virtual-triggering":b.virtualTriggering,"z-index":b.zIndex,"append-to":b.appendTo},{default:vue.withCtx(()=>[vue.renderSlot(b.$slots,"content",{},()=>[b.rawContent?(vue.openBlock(),vue.createElementBlock("span",{key:0,innerHTML:b.content},null,8,_hoisted_1$6)):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$4,vue.toDisplayString(b.content),1))]),b.showArrow?(vue.openBlock(),vue.createBlock(vue.unref(ElPopperArrow),{key:0,"arrow-offset":b.arrowOffset},null,8,["arrow-offset"])):vue.createCommentVNode("v-if",!0)]),_:3},8,["aria-label","boundaries-padding","content","disabled","effect","enterable","fallback-placements","hide-after","gpu-acceleration","offset","persistent","popper-class","popper-style","placement","popper-options","pure","raw-content","reference-el","trigger-target-el","show-after","strategy","teleported","transition","virtual-triggering","z-index","append-to"])]),_:3},8,["role"]))}});var Tooltip=_export_sfc(_sfc_main$d,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);const ElTooltip=withInstall(Tooltip);var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const nodeList=new Map;let startClick;isClient&&(document.addEventListener("mousedown",r=>startClick=r),document.addEventListener("mouseup",r=>{for(const n of nodeList.values())for(const{documentHandler:i}of n)i(r,startClick)}));function createDocumentHandler(r,n){let i=[];return Array.isArray(n.arg)?i=n.arg:isElement(n.arg)&&i.push(n.arg),function(o,a){const u=n.instance.popperRef,c=o.target,f=a==null?void 0:a.target,d=!n||!n.instance,p=!c||!f,h=r.contains(c)||r.contains(f),g=r===c,v=i.length&&i.some(A=>A==null?void 0:A.contains(c))||i.length&&i.includes(f),y=u&&(u.contains(c)||u.contains(f));d||p||h||g||v||y||n.value(o,a)}}const ClickOutside={beforeMount(r,n){nodeList.has(r)||nodeList.set(r,[]),nodeList.get(r).push({documentHandler:createDocumentHandler(r,n),bindingFn:n.value})},updated(r,n){nodeList.has(r)||nodeList.set(r,[]);const i=nodeList.get(r),o=i.findIndex(u=>u.bindingFn===n.oldValue),a={documentHandler:createDocumentHandler(r,n),bindingFn:n.value};o>=0?i.splice(o,1,a):i.push(a)},unmounted(r){nodeList.delete(r)}},tagProps=buildProps({type:{type:String,values:["success","info","warning","danger",""],default:""},closable:Boolean,disableTransitions:Boolean,hit:Boolean,color:{type:String,default:""},size:{type:String,values:componentSizes,default:""},effect:{type:String,values:["dark","light","plain"],default:"light"},round:Boolean}),tagEmits={close:r=>r instanceof MouseEvent,click:r=>r instanceof MouseEvent},__default__=vue.defineComponent({name:"ElTag"}),_sfc_main$c=vue.defineComponent({...__default__,props:tagProps,emits:tagEmits,setup(r,{emit:n}){const i=r,o=useFormSize(),a=useNamespace("tag"),u=vue.computed(()=>{const{type:d,hit:p,effect:h,closable:g,round:v}=i;return[a.b(),a.is("closable",g),a.m(d),a.m(o.value),a.m(h),a.is("hit",p),a.is("round",v)]}),c=d=>{n("close",d)},f=d=>{n("click",d)};return(d,p)=>d.disableTransitions?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:vue.normalizeClass(vue.unref(u)),style:vue.normalizeStyle({backgroundColor:d.color}),onClick:f},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(a).e("content"))},[vue.renderSlot(d.$slots,"default")],2),d.closable?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(a).e("close")),onClick:vue.withModifiers(c,["stop"])},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(close_default))]),_:1},8,["class","onClick"])):vue.createCommentVNode("v-if",!0)],6)):(vue.openBlock(),vue.createBlock(vue.Transition,{key:1,name:`${vue.unref(a).namespace.value}-zoom-in-center`,appear:""},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(u)),style:vue.normalizeStyle({backgroundColor:d.color}),onClick:f},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(a).e("content"))},[vue.renderSlot(d.$slots,"default")],2),d.closable?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(a).e("close")),onClick:vue.withModifiers(c,["stop"])},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(close_default))]),_:1},8,["class","onClick"])):vue.createCommentVNode("v-if",!0)],6)]),_:3},8,["name"]))}});var Tag=_export_sfc(_sfc_main$c,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);const ElTag=withInstall(Tag),selectGroupKey=Symbol("ElSelectGroup"),selectKey=Symbol("ElSelect");function useOption(r,n){const i=vue.inject(selectKey),o=vue.inject(selectGroupKey,{disabled:!1}),a=vue.computed(()=>Object.prototype.toString.call(r.value).toLowerCase()==="[object object]"),u=vue.computed(()=>i.props.multiple?g(i.props.modelValue,r.value):v(r.value,i.props.modelValue)),c=vue.computed(()=>{if(i.props.multiple){const _=i.props.modelValue||[];return!u.value&&_.length>=i.props.multipleLimit&&i.props.multipleLimit>0}else return!1}),f=vue.computed(()=>r.label||(a.value?"":r.value)),d=vue.computed(()=>r.value||r.label||""),p=vue.computed(()=>r.disabled||n.groupDisabled||c.value),h=vue.getCurrentInstance(),g=(_=[],S)=>{if(a.value){const b=i.props.valueKey;return _&&_.some(T=>vue.toRaw(lodashEs.get(T,b))===lodashEs.get(S,b))}else return _&&_.includes(S)},v=(_,S)=>{if(a.value){const{valueKey:b}=i.props;return lodashEs.get(_,b)===lodashEs.get(S,b)}else return _===S},y=()=>{!r.disabled&&!o.disabled&&(i.hoverIndex=i.optionsArray.indexOf(h.proxy))};vue.watch(()=>f.value,()=>{!r.created&&!i.props.remote&&i.setSelected()}),vue.watch(()=>r.value,(_,S)=>{const{remote:b,valueKey:T}=i.props;if(Object.is(_,S)||(i.onOptionDestroy(S,h.proxy),i.onOptionCreate(h.proxy)),!r.created&&!b){if(T&&typeof _=="object"&&typeof S=="object"&&_[T]===S[T])return;i.setSelected()}}),vue.watch(()=>o.disabled,()=>{n.groupDisabled=o.disabled},{immediate:!0});const{queryChange:A}=vue.toRaw(i);return vue.watch(A,_=>{const{query:S}=vue.unref(_),b=new RegExp(escapeStringRegexp(S),"i");n.visible=b.test(f.value)||r.created,n.visible||i.filteredOptionsCount--},{immediate:!0}),{select:i,currentLabel:f,currentValue:d,itemSelected:u,isDisabled:p,hoverItem:y}}const _sfc_main$b=vue.defineComponent({name:"ElOption",componentName:"ElOption",props:{value:{required:!0,type:[String,Number,Boolean,Object]},label:[String,Number],created:Boolean,disabled:{type:Boolean,default:!1}},setup(r){const n=useNamespace("select"),i=vue.computed(()=>[n.be("dropdown","item"),n.is("disabled",vue.unref(c)),{selected:vue.unref(u),hover:vue.unref(h)}]),o=vue.reactive({index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}),{currentLabel:a,itemSelected:u,isDisabled:c,select:f,hoverItem:d}=useOption(r,o),{visible:p,hover:h}=vue.toRefs(o),g=vue.getCurrentInstance().proxy;f.onOptionCreate(g),vue.onBeforeUnmount(()=>{const y=g.value,{selected:A}=f,S=(f.props.multiple?A:[A]).some(b=>b.value===g.value);vue.nextTick(()=>{f.cachedOptions.get(y)===g&&!S&&f.cachedOptions.delete(y)}),f.onOptionDestroy(y,g)});function v(){r.disabled!==!0&&o.groupDisabled!==!0&&f.handleOptionSelect(g)}return{ns:n,containerKls:i,currentLabel:a,itemSelected:u,isDisabled:c,select:f,hoverItem:d,visible:p,hover:h,selectOptionClick:v,states:o}}});function _sfc_render$3(r,n,i,o,a,u){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("li",{class:vue.normalizeClass(r.containerKls),onMouseenter:n[0]||(n[0]=(...c)=>r.hoverItem&&r.hoverItem(...c)),onClick:n[1]||(n[1]=vue.withModifiers((...c)=>r.selectOptionClick&&r.selectOptionClick(...c),["stop"]))},[vue.renderSlot(r.$slots,"default",{},()=>[vue.createElementVNode("span",null,vue.toDisplayString(r.currentLabel),1)])],34)),[[vue.vShow,r.visible]])}var Option=_export_sfc(_sfc_main$b,[["render",_sfc_render$3],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);const _sfc_main$a=vue.defineComponent({name:"ElSelectDropdown",componentName:"ElSelectDropdown",setup(){const r=vue.inject(selectKey),n=useNamespace("select"),i=vue.computed(()=>r.props.popperClass),o=vue.computed(()=>r.props.multiple),a=vue.computed(()=>r.props.fitInputWidth),u=vue.ref("");function c(){var f;u.value=`${(f=r.selectWrapper)==null?void 0:f.offsetWidth}px`}return vue.onMounted(()=>{c(),useResizeObserver(r.selectWrapper,c)}),{ns:n,minWidth:u,popperClass:i,isMultiple:o,isFitInputWidth:a}}});function _sfc_render$2(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass([r.ns.b("dropdown"),r.ns.is("multiple",r.isMultiple),r.popperClass]),style:vue.normalizeStyle({[r.isFitInputWidth?"width":"minWidth"]:r.minWidth})},[vue.renderSlot(r.$slots,"default")],6)}var ElSelectMenu=_export_sfc(_sfc_main$a,[["render",_sfc_render$2],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);function useSelectStates(r){const{t:n}=useLocale();return vue.reactive({options:new Map,cachedOptions:new Map,createdLabel:null,createdSelected:!1,selected:r.multiple?[]:{},inputLength:20,inputWidth:0,optionsCount:0,filteredOptionsCount:0,visible:!1,selectedLabel:"",hoverIndex:-1,query:"",previousQuery:null,inputHovering:!1,cachedPlaceHolder:"",currentPlaceholder:n("el.select.placeholder"),menuVisibleOnFocus:!1,isOnComposition:!1,prefixWidth:11,mouseEnter:!1})}let ignoreFocusEvent=!1;const useSelect=(r,n,i)=>{const{t:o}=useLocale(),a=useNamespace("select");useDeprecated({from:"suffixTransition",replacement:"override style scheme",version:"2.3.0",scope:"props",ref:"https://element-plus.org/en-US/component/select.html#select-attributes"},vue.computed(()=>r.suffixTransition===!1));const u=vue.ref(null),c=vue.ref(null),f=vue.ref(null),d=vue.ref(null),p=vue.ref(null),h=vue.ref(null),g=vue.ref(null),v=vue.ref(null),y=vue.ref(-1),A=vue.shallowRef({query:""}),_=vue.shallowRef(""),S=vue.ref([]);let b=0;const{form:T,formItem:w}=useFormItem(),x=vue.computed(()=>!r.filterable||r.multiple||!n.visible),k=vue.computed(()=>r.disabled||(T==null?void 0:T.disabled)),M=vue.computed(()=>{const vn=r.multiple?Array.isArray(r.modelValue)&&r.modelValue.length>0:r.modelValue!==void 0&&r.modelValue!==null&&r.modelValue!=="";return r.clearable&&!k.value&&n.inputHovering&&vn}),D=vue.computed(()=>r.remote&&r.filterable&&!r.remoteShowSuffix?"":r.suffixIcon),z=vue.computed(()=>a.is("reverse",D.value&&n.visible&&r.suffixTransition)),j=vue.computed(()=>r.remote?300:0),oe=vue.computed(()=>r.loading?r.loadingText||o("el.select.loading"):r.remote&&n.query===""&&n.options.size===0?!1:r.filterable&&n.query&&n.options.size>0&&n.filteredOptionsCount===0?r.noMatchText||o("el.select.noMatch"):n.options.size===0?r.noDataText||o("el.select.noData"):null),L=vue.computed(()=>{const vn=Array.from(n.options.values()),_n=[];return S.value.forEach(bn=>{const Sn=vn.findIndex(Ln=>Ln.currentLabel===bn);Sn>-1&&_n.push(vn[Sn])}),_n.length?_n:vn}),F=vue.computed(()=>Array.from(n.cachedOptions.values())),O=vue.computed(()=>{const vn=L.value.filter(_n=>!_n.created).some(_n=>_n.currentLabel===n.query);return r.filterable&&r.allowCreate&&n.query!==""&&!vn}),ue=useFormSize(),_e=vue.computed(()=>["small"].includes(ue.value)?"small":"default"),Ce=vue.computed({get(){return n.visible&&oe.value!==!1},set(vn){n.visible=vn}});vue.watch([()=>k.value,()=>ue.value,()=>T==null?void 0:T.size],()=>{vue.nextTick(()=>{de()})}),vue.watch(()=>r.placeholder,vn=>{n.cachedPlaceHolder=n.currentPlaceholder=vn,r.multiple&&Array.isArray(r.modelValue)&&r.modelValue.length>0&&(n.currentPlaceholder="")}),vue.watch(()=>r.modelValue,(vn,_n)=>{r.multiple&&(de(),vn&&vn.length>0||c.value&&n.query!==""?n.currentPlaceholder="":n.currentPlaceholder=n.cachedPlaceHolder,r.filterable&&!r.reserveKeyword&&(n.query="",ie(n.query))),Oe(),r.filterable&&!r.multiple&&(n.inputLength=20),!lodashEs.isEqual(vn,_n)&&r.validateEvent&&(w==null||w.validate("change").catch(bn=>debugWarn(bn)))},{flush:"post",deep:!0}),vue.watch(()=>n.visible,vn=>{var _n,bn,Sn,Ln,Bn;vn?((bn=(_n=d.value)==null?void 0:_n.updatePopper)==null||bn.call(_n),r.filterable&&(n.filteredOptionsCount=n.optionsCount,n.query=r.remote?"":n.selectedLabel,(Ln=(Sn=f.value)==null?void 0:Sn.focus)==null||Ln.call(Sn),r.multiple?(Bn=c.value)==null||Bn.focus():n.selectedLabel&&(n.currentPlaceholder=`${n.selectedLabel}`,n.selectedLabel=""),ie(n.query),!r.multiple&&!r.remote&&(A.value.query="",vue.triggerRef(A),vue.triggerRef(_)))):(r.filterable&&(isFunction(r.filterMethod)&&r.filterMethod(""),isFunction(r.remoteMethod)&&r.remoteMethod("")),c.value&&c.value.blur(),n.query="",n.previousQuery=null,n.selectedLabel="",n.inputLength=20,n.menuVisibleOnFocus=!1,Dt(),vue.nextTick(()=>{c.value&&c.value.value===""&&n.selected.length===0&&(n.currentPlaceholder=n.cachedPlaceHolder)}),r.multiple||(n.selected&&(r.filterable&&r.allowCreate&&n.createdSelected&&n.createdLabel?n.selectedLabel=n.createdLabel:n.selectedLabel=n.selected.currentLabel,r.filterable&&(n.query=n.selectedLabel)),r.filterable&&(n.currentPlaceholder=n.cachedPlaceHolder))),i.emit("visible-change",vn)}),vue.watch(()=>n.options.entries(),()=>{var vn,_n,bn;if(!isClient)return;(_n=(vn=d.value)==null?void 0:vn.updatePopper)==null||_n.call(vn),r.multiple&&de();const Sn=((bn=g.value)==null?void 0:bn.querySelectorAll("input"))||[];Array.from(Sn).includes(document.activeElement)||Oe(),r.defaultFirstOption&&(r.filterable||r.remote)&&n.filteredOptionsCount&&Ie()},{flush:"post"}),vue.watch(()=>n.hoverIndex,vn=>{isNumber(vn)&&vn>-1?y.value=L.value[vn]||{}:y.value={},L.value.forEach(_n=>{_n.hover=y.value===_n})});const de=()=>{vue.nextTick(()=>{var vn,_n;if(!u.value)return;const bn=u.value.$el.querySelector("input");b=b||(bn.clientHeight>0?bn.clientHeight+2:0);const Sn=h.value,Ln=getComponentSize(ue.value||(T==null?void 0:T.size)),Bn=ue.value||Ln===b||b<=0?Ln:b;!(bn.offsetParent===null)&&(bn.style.height=`${(n.selected.length===0?Bn:Math.max(Sn?Sn.clientHeight+(Sn.clientHeight>Bn?6:0):0,Bn))-2}px`),n.visible&&oe.value!==!1&&((_n=(vn=d.value)==null?void 0:vn.updatePopper)==null||_n.call(vn))})},ie=async vn=>{if(!(n.previousQuery===vn||n.isOnComposition)){if(n.previousQuery===null&&(isFunction(r.filterMethod)||isFunction(r.remoteMethod))){n.previousQuery=vn;return}n.previousQuery=vn,vue.nextTick(()=>{var _n,bn;n.visible&&((bn=(_n=d.value)==null?void 0:_n.updatePopper)==null||bn.call(_n))}),n.hoverIndex=-1,r.multiple&&r.filterable&&vue.nextTick(()=>{const _n=c.value.value.length*15+20;n.inputLength=r.collapseTags?Math.min(50,_n):_n,Y(),de()}),r.remote&&isFunction(r.remoteMethod)?(n.hoverIndex=-1,r.remoteMethod(vn)):isFunction(r.filterMethod)?(r.filterMethod(vn),vue.triggerRef(_)):(n.filteredOptionsCount=n.optionsCount,A.value.query=vn,vue.triggerRef(A),vue.triggerRef(_)),r.defaultFirstOption&&(r.filterable||r.remote)&&n.filteredOptionsCount&&(await vue.nextTick(),Ie())}},Y=()=>{n.currentPlaceholder!==""&&(n.currentPlaceholder=c.value.value?"":n.cachedPlaceHolder)},Ie=()=>{const vn=L.value.filter(Sn=>Sn.visible&&!Sn.disabled&&!Sn.states.groupDisabled),_n=vn.find(Sn=>Sn.created),bn=vn[0];n.hoverIndex=xe(L.value,_n||bn)},Oe=()=>{var vn;if(r.multiple)n.selectedLabel="";else{const bn=kt(r.modelValue);(vn=bn.props)!=null&&vn.created?(n.createdLabel=bn.props.value,n.createdSelected=!0):n.createdSelected=!1,n.selectedLabel=bn.currentLabel,n.selected=bn,r.filterable&&(n.query=n.selectedLabel);return}const _n=[];Array.isArray(r.modelValue)&&r.modelValue.forEach(bn=>{_n.push(kt(bn))}),n.selected=_n,vue.nextTick(()=>{de()})},kt=vn=>{let _n;const bn=toRawType(vn).toLowerCase()==="object",Sn=toRawType(vn).toLowerCase()==="null",Ln=toRawType(vn).toLowerCase()==="undefined";for(let Dn=n.cachedOptions.size-1;Dn>=0;Dn--){const Vn=F.value[Dn];if(bn?lodashEs.get(Vn.value,r.valueKey)===lodashEs.get(vn,r.valueKey):Vn.value===vn){_n={value:vn,currentLabel:Vn.currentLabel,isDisabled:Vn.isDisabled};break}}if(_n)return _n;const Bn=bn?vn.label:!Sn&&!Ln?vn:"",On={value:vn,currentLabel:Bn};return r.multiple&&(On.hitState=!1),On},Dt=()=>{setTimeout(()=>{const vn=r.valueKey;r.multiple?n.selected.length>0?n.hoverIndex=Math.min.apply(null,n.selected.map(_n=>L.value.findIndex(bn=>lodashEs.get(bn,vn)===lodashEs.get(_n,vn)))):n.hoverIndex=-1:n.hoverIndex=L.value.findIndex(_n=>Tn(_n)===Tn(n.selected))},300)},Fe=()=>{var vn,_n;$e(),(_n=(vn=d.value)==null?void 0:vn.updatePopper)==null||_n.call(vn),r.multiple&&de()},$e=()=>{var vn;n.inputWidth=(vn=u.value)==null?void 0:vn.$el.offsetWidth},Cn=()=>{r.filterable&&n.query!==n.selectedLabel&&(n.query=n.selectedLabel,ie(n.query))},Lt=lodashEs.debounce(()=>{Cn()},j.value),In=lodashEs.debounce(vn=>{ie(vn.target.value)},j.value),Et=vn=>{lodashEs.isEqual(r.modelValue,vn)||i.emit(CHANGE_EVENT,vn)},Ne=vn=>{if(vn.code!==EVENT_CODE.delete){if(vn.target.value.length<=0&&!re()){const _n=r.modelValue.slice();_n.pop(),i.emit(UPDATE_MODEL_EVENT,_n),Et(_n)}vn.target.value.length===1&&r.modelValue.length===0&&(n.currentPlaceholder=n.cachedPlaceHolder)}},pe=(vn,_n)=>{const bn=n.selected.indexOf(_n);if(bn>-1&&!k.value){const Sn=r.modelValue.slice();Sn.splice(bn,1),i.emit(UPDATE_MODEL_EVENT,Sn),Et(Sn),i.emit("remove-tag",_n.value)}vn.stopPropagation()},At=vn=>{vn.stopPropagation();const _n=r.multiple?[]:"";if(!isString(_n))for(const bn of n.selected)bn.isDisabled&&_n.push(bn.value);i.emit(UPDATE_MODEL_EVENT,_n),Et(_n),n.hoverIndex=-1,n.visible=!1,i.emit("clear")},Ve=vn=>{var _n;if(r.multiple){const bn=(r.modelValue||[]).slice(),Sn=xe(bn,vn.value);Sn>-1?bn.splice(Sn,1):(r.multipleLimit<=0||bn.length<r.multipleLimit)&&bn.push(vn.value),i.emit(UPDATE_MODEL_EVENT,bn),Et(bn),vn.created&&(n.query="",ie(""),n.inputLength=20),r.filterable&&((_n=c.value)==null||_n.focus())}else i.emit(UPDATE_MODEL_EVENT,vn.value),Et(vn.value),n.visible=!1;ze(),!n.visible&&vue.nextTick(()=>{Pt(vn)})},xe=(vn=[],_n)=>{if(!isObject(_n))return vn.indexOf(_n);const bn=r.valueKey;let Sn=-1;return vn.some((Ln,Bn)=>vue.toRaw(lodashEs.get(Ln,bn))===lodashEs.get(_n,bn)?(Sn=Bn,!0):!1),Sn},ze=()=>{const vn=c.value||u.value;vn&&(vn==null||vn.focus())},Pt=vn=>{var _n,bn,Sn,Ln,Bn;const On=Array.isArray(vn)?vn[0]:vn;let Dn=null;if(On!=null&&On.value){const Vn=L.value.filter(Zn=>Zn.value===On.value);Vn.length>0&&(Dn=Vn[0].$el)}if(d.value&&Dn){const Vn=(Ln=(Sn=(bn=(_n=d.value)==null?void 0:_n.popperRef)==null?void 0:bn.contentRef)==null?void 0:Sn.querySelector)==null?void 0:Ln.call(Sn,`.${a.be("dropdown","wrap")}`);Vn&&scrollIntoView(Vn,Dn)}(Bn=v.value)==null||Bn.handleScroll()},hn=vn=>{n.optionsCount++,n.filteredOptionsCount++,n.options.set(vn.value,vn),n.cachedOptions.set(vn.value,vn)},ae=(vn,_n)=>{n.options.get(vn)===_n&&(n.optionsCount--,n.filteredOptionsCount--,n.options.delete(vn))},le=vn=>{vn.code!==EVENT_CODE.backspace&&re(!1),n.inputLength=c.value.value.length*15+20,de()},re=vn=>{if(!Array.isArray(n.selected))return;const _n=n.selected[n.selected.length-1];if(_n)return vn===!0||vn===!1?(_n.hitState=vn,vn):(_n.hitState=!_n.hitState,_n.hitState)},V=vn=>{const _n=vn.target.value;if(vn.type==="compositionend")n.isOnComposition=!1,vue.nextTick(()=>ie(_n));else{const bn=_n[_n.length-1]||"";n.isOnComposition=!isKorean(bn)}},$=()=>{vue.nextTick(()=>Pt(n.selected))},he=vn=>{ignoreFocusEvent?ignoreFocusEvent=!1:((r.automaticDropdown||r.filterable)&&(r.filterable&&!n.visible&&(n.menuVisibleOnFocus=!0),n.visible=!0),i.emit("focus",vn))},Ue=()=>{var vn,_n,bn;n.visible=!1,(vn=u.value)==null||vn.blur(),(bn=(_n=f.value)==null?void 0:_n.blur)==null||bn.call(_n)},qe=vn=>{setTimeout(()=>{var _n;if((_n=d.value)!=null&&_n.isFocusInsideContent()){ignoreFocusEvent=!0;return}n.visible&&An(),i.emit("blur",vn)})},jt=vn=>{At(vn)},An=()=>{n.visible=!1},wn=vn=>{n.visible&&(vn.preventDefault(),vn.stopPropagation(),n.visible=!1)},En=vn=>{var _n;vn&&!n.mouseEnter||k.value||(n.menuVisibleOnFocus?n.menuVisibleOnFocus=!1:(!d.value||!d.value.isFocusInsideContent())&&(n.visible=!n.visible),n.visible&&((_n=c.value||u.value)==null||_n.focus()))},xn=()=>{n.visible?L.value[n.hoverIndex]&&Ve(L.value[n.hoverIndex]):En()},Tn=vn=>isObject(vn.value)?lodashEs.get(vn.value,r.valueKey):vn.value,Pn=vue.computed(()=>L.value.filter(vn=>vn.visible).every(vn=>vn.disabled)),kn=vue.computed(()=>n.selected.slice(0,r.maxCollapseTags)),Rn=vue.computed(()=>n.selected.slice(r.maxCollapseTags)),Nn=vn=>{if(!n.visible){n.visible=!0;return}if(!(n.options.size===0||n.filteredOptionsCount===0)&&!n.isOnComposition&&!Pn.value){vn==="next"?(n.hoverIndex++,n.hoverIndex===n.options.size&&(n.hoverIndex=0)):vn==="prev"&&(n.hoverIndex--,n.hoverIndex<0&&(n.hoverIndex=n.options.size-1));const _n=L.value[n.hoverIndex];(_n.disabled===!0||_n.states.groupDisabled===!0||!_n.visible)&&Nn(vn),vue.nextTick(()=>Pt(y.value))}};return{optionList:S,optionsArray:L,selectSize:ue,handleResize:Fe,debouncedOnInputChange:Lt,debouncedQueryChange:In,deletePrevTag:Ne,deleteTag:pe,deleteSelected:At,handleOptionSelect:Ve,scrollToOption:Pt,readonly:x,resetInputHeight:de,showClose:M,iconComponent:D,iconReverse:z,showNewOption:O,collapseTagSize:_e,setSelected:Oe,managePlaceholder:Y,selectDisabled:k,emptyText:oe,toggleLastOptionHitState:re,resetInputState:le,handleComposition:V,onOptionCreate:hn,onOptionDestroy:ae,handleMenuEnter:$,handleFocus:he,blur:Ue,handleBlur:qe,handleClearClick:jt,handleClose:An,handleKeydownEscape:wn,toggleMenu:En,selectOption:xn,getValueKey:Tn,navigateOptions:Nn,handleDeleteTooltipTag:(vn,_n)=>{var bn,Sn;pe(vn,_n),(Sn=(bn=p.value)==null?void 0:bn.updatePopper)==null||Sn.call(bn)},dropMenuVisible:Ce,queryChange:A,groupQueryChange:_,showTagList:kn,collapseTagList:Rn,reference:u,input:c,iOSInput:f,tooltipRef:d,tagTooltipRef:p,tags:h,selectWrapper:g,scrollbar:v,handleMouseEnter:()=>{n.mouseEnter=!0},handleMouseLeave:()=>{n.mouseEnter=!1}}};var ElOptions=vue.defineComponent({name:"ElOptions",emits:["update-options"],setup(r,{slots:n,emit:i}){let o=[];function a(u,c){if(u.length!==c.length)return!1;for(const[f]of u.entries())if(u[f]!=c[f])return!1;return!0}return()=>{var u,c;const f=(u=n.default)==null?void 0:u.call(n),d=[];function p(h){Array.isArray(h)&&h.forEach(g=>{var v,y,A,_;const S=(v=(g==null?void 0:g.type)||{})==null?void 0:v.name;S==="ElOptionGroup"?p(!isString(g.children)&&!Array.isArray(g.children)&&isFunction((y=g.children)==null?void 0:y.default)?(A=g.children)==null?void 0:A.default():g.children):S==="ElOption"?d.push((_=g.props)==null?void 0:_.label):Array.isArray(g.children)&&p(g.children)})}return f.length&&p((c=f[0])==null?void 0:c.children),a(d,o)||(o=d,i("update-options",d)),f}}});const COMPONENT_NAME="ElSelect",_sfc_main$9=vue.defineComponent({name:COMPONENT_NAME,componentName:COMPONENT_NAME,components:{ElInput,ElSelectMenu,ElOption:Option,ElOptions,ElTag,ElScrollbar,ElTooltip,ElIcon},directives:{ClickOutside},props:{name:String,id:String,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},autocomplete:{type:String,default:"off"},automaticDropdown:Boolean,size:{type:String,validator:isValidComponentSize},effect:{type:String,default:"light"},disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:{type:String,default:""},popperOptions:{type:Object,default:()=>({})},remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String},defaultFirstOption:Boolean,reserveKeyword:{type:Boolean,default:!0},valueKey:{type:String,default:"value"},collapseTags:Boolean,collapseTagsTooltip:{type:Boolean,default:!1},maxCollapseTags:{type:Number,default:1},teleported:useTooltipContentProps.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:iconPropType,default:circle_close_default},fitInputWidth:{type:Boolean,default:!1},suffixIcon:{type:iconPropType,default:arrow_down_default},tagType:{...tagProps.type,default:"info"},validateEvent:{type:Boolean,default:!0},remoteShowSuffix:{type:Boolean,default:!1},suffixTransition:{type:Boolean,default:!0},placement:{type:String,values:Ee,default:"bottom-start"}},emits:[UPDATE_MODEL_EVENT,CHANGE_EVENT,"remove-tag","clear","visible-change","focus","blur"],setup(r,n){const i=useNamespace("select"),o=useNamespace("input"),{t:a}=useLocale(),u=useSelectStates(r),{optionList:c,optionsArray:f,selectSize:d,readonly:p,handleResize:h,collapseTagSize:g,debouncedOnInputChange:v,debouncedQueryChange:y,deletePrevTag:A,deleteTag:_,deleteSelected:S,handleOptionSelect:b,scrollToOption:T,setSelected:w,resetInputHeight:x,managePlaceholder:k,showClose:M,selectDisabled:D,iconComponent:z,iconReverse:j,showNewOption:oe,emptyText:L,toggleLastOptionHitState:F,resetInputState:O,handleComposition:ue,onOptionCreate:_e,onOptionDestroy:Ce,handleMenuEnter:de,handleFocus:ie,blur:Y,handleBlur:Ie,handleClearClick:Oe,handleClose:kt,handleKeydownEscape:Dt,toggleMenu:Fe,selectOption:$e,getValueKey:Cn,navigateOptions:Lt,handleDeleteTooltipTag:In,dropMenuVisible:Et,reference:Ne,input:pe,iOSInput:At,tooltipRef:Ve,tagTooltipRef:xe,tags:ze,selectWrapper:Pt,scrollbar:hn,queryChange:ae,groupQueryChange:le,handleMouseEnter:re,handleMouseLeave:V,showTagList:$,collapseTagList:he}=useSelect(r,u,n),{focus:Ue}=useFocus(Ne),{inputWidth:qe,selected:jt,inputLength:An,filteredOptionsCount:wn,visible:En,selectedLabel:xn,hoverIndex:Tn,query:Pn,inputHovering:kn,currentPlaceholder:Rn,menuVisibleOnFocus:Nn,isOnComposition:$n,options:Fn,cachedOptions:Wn,optionsCount:vn,prefixWidth:_n}=vue.toRefs(u),bn=vue.computed(()=>{const Mn=[i.b()],Gn=vue.unref(d);return Gn&&Mn.push(i.m(Gn)),r.disabled&&Mn.push(i.m("disabled")),Mn}),Sn=vue.computed(()=>[i.e("tags"),i.is("disabled",vue.unref(D))]),Ln=vue.computed(()=>[i.b("tags-wrapper"),{"has-prefix":vue.unref(_n)&&vue.unref(jt).length}]),Bn=vue.computed(()=>[i.e("input"),i.is(vue.unref(d)),i.is("disabled",vue.unref(D))]),On=vue.computed(()=>[i.e("input"),i.is(vue.unref(d)),i.em("input","iOS")]),Dn=vue.computed(()=>[i.is("empty",!r.allowCreate&&!!vue.unref(Pn)&&vue.unref(wn)===0)]),Vn=vue.computed(()=>({maxWidth:`${vue.unref(qe)-32}px`,width:"100%"})),Zn=vue.computed(()=>({maxWidth:`${vue.unref(qe)>123?vue.unref(qe)-123:vue.unref(qe)-75}px`})),Hn=vue.computed(()=>({marginLeft:`${vue.unref(_n)}px`,flexGrow:1,width:`${vue.unref(An)/(vue.unref(qe)-32)}%`,maxWidth:`${vue.unref(qe)-42}px`}));vue.provide(selectKey,vue.reactive({props:r,options:Fn,optionsArray:f,cachedOptions:Wn,optionsCount:vn,filteredOptionsCount:wn,hoverIndex:Tn,handleOptionSelect:b,onOptionCreate:_e,onOptionDestroy:Ce,selectWrapper:Pt,selected:jt,setSelected:w,queryChange:ae,groupQueryChange:le})),vue.onMounted(()=>{u.cachedPlaceHolder=Rn.value=r.placeholder||(()=>a("el.select.placeholder")),r.multiple&&Array.isArray(r.modelValue)&&r.modelValue.length>0&&(Rn.value=""),useResizeObserver(Pt,h),r.remote&&r.multiple&&x(),vue.nextTick(()=>{const Mn=Ne.value&&Ne.value.$el;if(Mn&&(qe.value=Mn.getBoundingClientRect().width,n.slots.prefix)){const Gn=Mn.querySelector(`.${o.e("prefix")}`);_n.value=Math.max(Gn.getBoundingClientRect().width+11,30)}}),w()}),r.multiple&&!Array.isArray(r.modelValue)&&n.emit(UPDATE_MODEL_EVENT,[]),!r.multiple&&Array.isArray(r.modelValue)&&n.emit(UPDATE_MODEL_EVENT,"");const zn=vue.computed(()=>{var Mn,Gn;return(Gn=(Mn=Ve.value)==null?void 0:Mn.popperRef)==null?void 0:Gn.contentRef});return{isIOS,onOptionsRendered:Mn=>{c.value=Mn},prefixWidth:_n,selectSize:d,readonly:p,handleResize:h,collapseTagSize:g,debouncedOnInputChange:v,debouncedQueryChange:y,deletePrevTag:A,deleteTag:_,handleDeleteTooltipTag:In,deleteSelected:S,handleOptionSelect:b,scrollToOption:T,inputWidth:qe,selected:jt,inputLength:An,filteredOptionsCount:wn,visible:En,selectedLabel:xn,hoverIndex:Tn,query:Pn,inputHovering:kn,currentPlaceholder:Rn,menuVisibleOnFocus:Nn,isOnComposition:$n,options:Fn,resetInputHeight:x,managePlaceholder:k,showClose:M,selectDisabled:D,iconComponent:z,iconReverse:j,showNewOption:oe,emptyText:L,toggleLastOptionHitState:F,resetInputState:O,handleComposition:ue,handleMenuEnter:de,handleFocus:ie,blur:Y,handleBlur:Ie,handleClearClick:Oe,handleClose:kt,handleKeydownEscape:Dt,toggleMenu:Fe,selectOption:$e,getValueKey:Cn,navigateOptions:Lt,dropMenuVisible:Et,focus:Ue,reference:Ne,input:pe,iOSInput:At,tooltipRef:Ve,popperPaneRef:zn,tags:ze,selectWrapper:Pt,scrollbar:hn,wrapperKls:bn,tagsKls:Sn,tagWrapperKls:Ln,inputKls:Bn,iOSInputKls:On,scrollbarKls:Dn,selectTagsStyle:Vn,nsSelect:i,tagTextStyle:Zn,inputStyle:Hn,handleMouseEnter:re,handleMouseLeave:V,showTagList:$,collapseTagList:he,tagTooltipRef:xe}}}),_hoisted_1$5=["disabled","autocomplete"],_hoisted_2$3=["disabled"],_hoisted_3$3={style:{height:"100%",display:"flex","justify-content":"center","align-items":"center"}};function _sfc_render$1(r,n,i,o,a,u){const c=vue.resolveComponent("el-tag"),f=vue.resolveComponent("el-tooltip"),d=vue.resolveComponent("el-icon"),p=vue.resolveComponent("el-input"),h=vue.resolveComponent("el-option"),g=vue.resolveComponent("el-options"),v=vue.resolveComponent("el-scrollbar"),y=vue.resolveComponent("el-select-menu"),A=vue.resolveDirective("click-outside");return vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",{ref:"selectWrapper",class:vue.normalizeClass(r.wrapperKls),onMouseenter:n[21]||(n[21]=(..._)=>r.handleMouseEnter&&r.handleMouseEnter(..._)),onMouseleave:n[22]||(n[22]=(..._)=>r.handleMouseLeave&&r.handleMouseLeave(..._)),onClick:n[23]||(n[23]=vue.withModifiers((..._)=>r.toggleMenu&&r.toggleMenu(..._),["stop"]))},[vue.createVNode(f,{ref:"tooltipRef",visible:r.dropMenuVisible,placement:r.placement,teleported:r.teleported,"popper-class":[r.nsSelect.e("popper"),r.popperClass],"popper-options":r.popperOptions,"fallback-placements":["bottom-start","top-start","right","left"],effect:r.effect,pure:"",trigger:"click",transition:`${r.nsSelect.namespace.value}-zoom-in-top`,"stop-popper-mouse-event":!1,"gpu-acceleration":!1,persistent:r.persistent,onShow:r.handleMenuEnter},{default:vue.withCtx(()=>[vue.createElementVNode("div",{class:"select-trigger",onMouseenter:n[19]||(n[19]=_=>r.inputHovering=!0),onMouseleave:n[20]||(n[20]=_=>r.inputHovering=!1)},[r.multiple?(vue.openBlock(),vue.createElementBlock("div",{key:0,ref:"tags",class:vue.normalizeClass(r.tagsKls),style:vue.normalizeStyle(r.selectTagsStyle)},[r.collapseTags&&r.selected.length?(vue.openBlock(),vue.createBlock(vue.Transition,{key:0,onAfterLeave:r.resetInputHeight},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.tagWrapperKls)},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.showTagList,_=>(vue.openBlock(),vue.createBlock(c,{key:r.getValueKey(_),closable:!r.selectDisabled&&!_.isDisabled,size:r.collapseTagSize,hit:_.hitState,type:r.tagType,"disable-transitions":"",onClose:S=>r.deleteTag(S,_)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.nsSelect.e("tags-text")),style:vue.normalizeStyle(r.tagTextStyle)},vue.toDisplayString(_.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"]))),128)),r.selected.length>r.maxCollapseTags?(vue.openBlock(),vue.createBlock(c,{key:0,closable:!1,size:r.collapseTagSize,type:r.tagType,"disable-transitions":""},{default:vue.withCtx(()=>[r.collapseTagsTooltip?(vue.openBlock(),vue.createBlock(f,{key:0,ref:"tagTooltipRef",disabled:r.dropMenuVisible,"fallback-placements":["bottom","top","right","left"],effect:r.effect,placement:"bottom",teleported:r.teleported},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.nsSelect.e("tags-text"))},"+ "+vue.toDisplayString(r.selected.length-r.maxCollapseTags),3)]),content:vue.withCtx(()=>[vue.createElementVNode("div",{class:vue.normalizeClass(r.nsSelect.e("collapse-tags"))},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.collapseTagList,_=>(vue.openBlock(),vue.createElementBlock("div",{key:r.getValueKey(_),class:vue.normalizeClass(r.nsSelect.e("collapse-tag"))},[vue.createVNode(c,{class:"in-tooltip",closable:!r.selectDisabled&&!_.isDisabled,size:r.collapseTagSize,hit:_.hitState,type:r.tagType,"disable-transitions":"",style:{margin:"2px"},onClose:S=>r.handleDeleteTooltipTag(S,_)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.nsSelect.e("tags-text")),style:vue.normalizeStyle({maxWidth:r.inputWidth-75+"px"})},vue.toDisplayString(_.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"])],2))),128))],2)]),_:1},8,["disabled","effect","teleported"])):(vue.openBlock(),vue.createElementBlock("span",{key:1,class:vue.normalizeClass(r.nsSelect.e("tags-text"))},"+ "+vue.toDisplayString(r.selected.length-r.maxCollapseTags),3))]),_:1},8,["size","type"])):vue.createCommentVNode("v-if",!0)],2)]),_:1},8,["onAfterLeave"])):vue.createCommentVNode("v-if",!0),r.collapseTags?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createBlock(vue.Transition,{key:1,onAfterLeave:r.resetInputHeight},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.tagWrapperKls),style:vue.normalizeStyle(r.prefixWidth&&r.selected.length?{marginLeft:`${r.prefixWidth}px`}:"")},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.selected,_=>(vue.openBlock(),vue.createBlock(c,{key:r.getValueKey(_),closable:!r.selectDisabled&&!_.isDisabled,size:r.collapseTagSize,hit:_.hitState,type:r.tagType,"disable-transitions":"",onClose:S=>r.deleteTag(S,_)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.nsSelect.e("tags-text")),style:vue.normalizeStyle({maxWidth:r.inputWidth-75+"px"})},vue.toDisplayString(_.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"]))),128))],6)]),_:1},8,["onAfterLeave"])),r.filterable&&!r.selectDisabled?vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{key:2,ref:"input","onUpdate:modelValue":n[0]||(n[0]=_=>r.query=_),type:"text",class:vue.normalizeClass(r.inputKls),disabled:r.selectDisabled,autocomplete:r.autocomplete,style:vue.normalizeStyle(r.inputStyle),onFocus:n[1]||(n[1]=(..._)=>r.handleFocus&&r.handleFocus(..._)),onBlur:n[2]||(n[2]=(..._)=>r.handleBlur&&r.handleBlur(..._)),onKeyup:n[3]||(n[3]=(..._)=>r.managePlaceholder&&r.managePlaceholder(..._)),onKeydown:[n[4]||(n[4]=(..._)=>r.resetInputState&&r.resetInputState(..._)),n[5]||(n[5]=vue.withKeys(vue.withModifiers(_=>r.navigateOptions("next"),["prevent"]),["down"])),n[6]||(n[6]=vue.withKeys(vue.withModifiers(_=>r.navigateOptions("prev"),["prevent"]),["up"])),n[7]||(n[7]=vue.withKeys((..._)=>r.handleKeydownEscape&&r.handleKeydownEscape(..._),["esc"])),n[8]||(n[8]=vue.withKeys(vue.withModifiers((..._)=>r.selectOption&&r.selectOption(..._),["stop","prevent"]),["enter"])),n[9]||(n[9]=vue.withKeys((..._)=>r.deletePrevTag&&r.deletePrevTag(..._),["delete"])),n[10]||(n[10]=vue.withKeys(_=>r.visible=!1,["tab"]))],onCompositionstart:n[11]||(n[11]=(..._)=>r.handleComposition&&r.handleComposition(..._)),onCompositionupdate:n[12]||(n[12]=(..._)=>r.handleComposition&&r.handleComposition(..._)),onCompositionend:n[13]||(n[13]=(..._)=>r.handleComposition&&r.handleComposition(..._)),onInput:n[14]||(n[14]=(..._)=>r.debouncedQueryChange&&r.debouncedQueryChange(..._))},null,46,_hoisted_1$5)),[[vue.vModelText,r.query]]):vue.createCommentVNode("v-if",!0)],6)):vue.createCommentVNode("v-if",!0),vue.createCommentVNode(" fix: https://github.com/element-plus/element-plus/issues/11415 "),r.isIOS&&!r.multiple&&r.filterable&&r.readonly?(vue.openBlock(),vue.createElementBlock("input",{key:1,ref:"iOSInput",class:vue.normalizeClass(r.iOSInputKls),disabled:r.selectDisabled,type:"text"},null,10,_hoisted_2$3)):vue.createCommentVNode("v-if",!0),vue.createVNode(p,{id:r.id,ref:"reference",modelValue:r.selectedLabel,"onUpdate:modelValue":n[15]||(n[15]=_=>r.selectedLabel=_),type:"text",placeholder:typeof r.currentPlaceholder=="function"?r.currentPlaceholder():r.currentPlaceholder,name:r.name,autocomplete:r.autocomplete,size:r.selectSize,disabled:r.selectDisabled,readonly:r.readonly,"validate-event":!1,class:vue.normalizeClass([r.nsSelect.is("focus",r.visible)]),tabindex:r.multiple&&r.filterable?-1:void 0,onFocus:r.handleFocus,onBlur:r.handleBlur,onInput:r.debouncedOnInputChange,onPaste:r.debouncedOnInputChange,onCompositionstart:r.handleComposition,onCompositionupdate:r.handleComposition,onCompositionend:r.handleComposition,onKeydown:[n[16]||(n[16]=vue.withKeys(vue.withModifiers(_=>r.navigateOptions("next"),["stop","prevent"]),["down"])),n[17]||(n[17]=vue.withKeys(vue.withModifiers(_=>r.navigateOptions("prev"),["stop","prevent"]),["up"])),vue.withKeys(vue.withModifiers(r.selectOption,["stop","prevent"]),["enter"]),vue.withKeys(r.handleKeydownEscape,["esc"]),n[18]||(n[18]=vue.withKeys(_=>r.visible=!1,["tab"]))]},vue.createSlots({suffix:vue.withCtx(()=>[r.iconComponent&&!r.showClose?(vue.openBlock(),vue.createBlock(d,{key:0,class:vue.normalizeClass([r.nsSelect.e("caret"),r.nsSelect.e("icon"),r.iconReverse])},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(r.iconComponent)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0),r.showClose&&r.clearIcon?(vue.openBlock(),vue.createBlock(d,{key:1,class:vue.normalizeClass([r.nsSelect.e("caret"),r.nsSelect.e("icon")]),onClick:r.handleClearClick},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(r.clearIcon)))]),_:1},8,["class","onClick"])):vue.createCommentVNode("v-if",!0)]),_:2},[r.$slots.prefix?{name:"prefix",fn:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$3,[vue.renderSlot(r.$slots,"prefix")])])}:void 0]),1032,["id","modelValue","placeholder","name","autocomplete","size","disabled","readonly","class","tabindex","onFocus","onBlur","onInput","onPaste","onCompositionstart","onCompositionupdate","onCompositionend","onKeydown"])],32)]),content:vue.withCtx(()=>[vue.createVNode(y,null,{default:vue.withCtx(()=>[vue.withDirectives(vue.createVNode(v,{ref:"scrollbar",tag:"ul","wrap-class":r.nsSelect.be("dropdown","wrap"),"view-class":r.nsSelect.be("dropdown","list"),class:vue.normalizeClass(r.scrollbarKls)},{default:vue.withCtx(()=>[r.showNewOption?(vue.openBlock(),vue.createBlock(h,{key:0,value:r.query,created:!0},null,8,["value"])):vue.createCommentVNode("v-if",!0),vue.createVNode(g,{onUpdateOptions:r.onOptionsRendered},{default:vue.withCtx(()=>[vue.renderSlot(r.$slots,"default")]),_:3},8,["onUpdateOptions"])]),_:3},8,["wrap-class","view-class","class"]),[[vue.vShow,r.options.size>0&&!r.loading]]),r.emptyText&&(!r.allowCreate||r.loading||r.allowCreate&&r.options.size===0)?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[r.$slots.empty?vue.renderSlot(r.$slots,"empty",{key:0}):(vue.openBlock(),vue.createElementBlock("p",{key:1,class:vue.normalizeClass(r.nsSelect.be("dropdown","empty"))},vue.toDisplayString(r.emptyText),3))],64)):vue.createCommentVNode("v-if",!0)]),_:3})]),_:3},8,["visible","placement","teleported","popper-class","popper-options","effect","transition","persistent","onShow"])],34)),[[A,r.handleClose,r.popperPaneRef]])}var Select=_export_sfc(_sfc_main$9,[["render",_sfc_render$1],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);const _sfc_main$8=vue.defineComponent({name:"ElOptionGroup",componentName:"ElOptionGroup",props:{label:String,disabled:{type:Boolean,default:!1}},setup(r){const n=useNamespace("select"),i=vue.ref(!0),o=vue.getCurrentInstance(),a=vue.ref([]);vue.provide(selectGroupKey,vue.reactive({...vue.toRefs(r)}));const u=vue.inject(selectKey);vue.onMounted(()=>{a.value=c(o.subTree)});const c=d=>{const p=[];return Array.isArray(d.children)&&d.children.forEach(h=>{var g;h.type&&h.type.name==="ElOption"&&h.component&&h.component.proxy?p.push(h.component.proxy):(g=h.children)!=null&&g.length&&p.push(...c(h))}),p},{groupQueryChange:f}=vue.toRaw(u);return vue.watch(f,()=>{i.value=a.value.some(d=>d.visible===!0)},{flush:"post"}),{visible:i,ns:n}}});function _sfc_render(r,n,i,o,a,u){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("ul",{class:vue.normalizeClass(r.ns.be("group","wrap"))},[vue.createElementVNode("li",{class:vue.normalizeClass(r.ns.be("group","title"))},vue.toDisplayString(r.label),3),vue.createElementVNode("li",null,[vue.createElementVNode("ul",{class:vue.normalizeClass(r.ns.b("group"))},[vue.renderSlot(r.$slots,"default")],2)])],2)),[[vue.vShow,r.visible]])}var OptionGroup=_export_sfc(_sfc_main$8,[["render",_sfc_render],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);const ElSelect=withInstall(Select,{Option,OptionGroup}),ElOption=withNoopInstall(Option);withNoopInstall(OptionGroup);const _hoisted_1$4={class:"c-wall-d"},_sfc_main$7=vue.defineComponent({__name:"condition",props:{modelValue:{default:()=>({type:EConditionType.None})}},emits:["update:modelValue"],setup(r,{emit:n}){const i=r,o=vue.computed({get(){return i.modelValue},set(c){n("update:modelValue",c)}}),a=[{label:"大于",val:"greater"},{label:"大于等于",val:">="},{label:"小于",val:"<"},{label:"小于等于",val:"<="},{label:"等于",val:"=="},{label:"不等于",val:"!="},{label:"介于",val:">=,=<"},{label:"不介于",val:"<,>"}],u=c=>{c!=="None"&&(o.value.Relation={key:"",relation:"",val:"",val2:""}),n("update:modelValue",o)};return(c,f)=>{var d,p;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(o).type,"onUpdate:modelValue":f[0]||(f[0]=h=>vue.unref(o).type=h),onChange:u},{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(o).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(o).Relation.key,"onUpdate:modelValue":f[1]||(f[1]=h=>vue.unref(o).Relation.key=h)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(o).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(o).Relation.relation,"onUpdate:modelValue":f[2]||(f[2]=h=>vue.unref(o).Relation.relation=h)},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(a,(h,g)=>vue.createVNode(vue.unref(ElOption),{value:h.val,label:h.label,key:"rop"+g},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(o).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(o).Relation.val,"onUpdate:modelValue":f[3]||(f[3]=h=>vue.unref(o).Relation.val=h)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(o).type==="Relation"&&(((d=vue.unref(o).Relation)==null?void 0:d.relation)===">=,=<"||((p=vue.unref(o).Relation)==null?void 0:p.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(o).Relation.val2,"onUpdate:modelValue":f[4]||(f[4]=h=>vue.unref(o).Relation.val2=h)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)])}}}),condition_vue_vue_type_style_index_0_scoped_f43f10e6_lang="",Condition=_export_sfc$1(_sfc_main$7,[["__scopeId","data-v-f43f10e6"]]),_sfc_main$6=vue.defineComponent({__name:"bind-anchor",props:{modelValue:{},title:{}},emits:["update:modelValue"],setup(r,{emit:n}){const i=r,o=useGlobalStore(pinia),a=vue.computed({get(){return i.modelValue!==null},set(h){let g=null;h&&(g={target_id:"",type:""}),n("update:modelValue",g)}}),u=vue.computed({get(){var h;return((h=i.modelValue)==null?void 0:h.target_id)??void 0},set(h){let g=null;a.value&&(g={target_id:h,type:c.value}),n("update:modelValue",g)}}),c=vue.computed({get(){var h;return((h=i.modelValue)==null?void 0:h.type)??void 0},set(h){let g=null;a.value&&(g={target_id:u.value,type:h}),n("update:modelValue",g)}}),f=vue.computed(()=>o.done_json.filter(h=>h.type!==EDoneJsonType.ConnectionLine).map(h=>({label:h.title,value:h.id}))),d=[{label:"上锚点",value:ELineBindAnchors.TopCenter},{label:"右锚点",value:ELineBindAnchors.Right},{label:"下锚点",value:ELineBindAnchors.BottomCenter},{label:"左锚点",value:ELineBindAnchors.Left}];function p(){vue.nextTick(function(){var h,g;if(a.value&&((h=i.modelValue)!=null&&h.target_id)&&((g=i.modelValue)!=null&&g.type)&&o.handle_svg_info){let v=null;for(let y of o.done_json)y.id===i.modelValue.target_id&&(v=y);v&&(setSvgActualInfo(v),moveAnchors(v))}})}return(h,g)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:i.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(a),"onUpdate:modelValue":g[0]||(g[0]=v=>vue.isRef(a)?a.value=v:null),onChange:p},null,8,["modelValue"])]),_:1},8,["label"]),vue.unref(a)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,label:"绑定对象",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(u),"onUpdate:modelValue":g[1]||(g[1]=v=>vue.isRef(u)?u.value=v:null),onChange:p},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(f),v=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:v.value,label:v.label,value:v.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(a)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:"绑定位置",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(c),"onUpdate:modelValue":g[2]||(g[2]=v=>vue.isRef(c)?c.value=v:null),onChange:p},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(d,v=>vue.createVNode(vue.unref(elementPlus.ElOption),{key:v.value,label:v.label,value:v.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)],64))}}),_withScopeId=r=>(vue.pushScopeId("data-v-9b4c5da1"),r=r(),vue.popScopeId(),r),_hoisted_1$3=_withScopeId(()=>vue.createElementVNode("span",{style:{"font-weight":"bold"}},"MQTT",-1)),_hoisted_2$2={key:2},_hoisted_3$2={class:"events-title"},_sfc_main$5=vue.defineComponent({__name:"right-panel",setup(r){const n=useConfigStore(pinia),i=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=vue.ref("page"),u=vue.ref("style"),c=(A,_)=>{A!=null&&A.common_animations&&(A.common_animations.val=_)};n.$subscribe((A,_)=>{A.storeId==="config-store"&&localStorage.setItem("svg-editor-config",JSON.stringify(_))});const f=vue.ref(numberArray(20)),d=vue.ref(["MQTT"]),p=vue.ref();p.value=()=>{var _,S;let A={type:EEventType.Null,action:EEventAction.Null,target:"",scripts:"",condition:{type:EConditionType.None}};(S=(_=i.handle_svg_info)==null?void 0:_.info)==null||S.events.push(A)};const h=(A,_)=>{A==="ChangeAttr"?_.attrs=[{key:"",val:""}]:delete _.attrs},g=A=>{var _,S;(S=(_=i.handle_svg_info)==null?void 0:_.info)==null||S.events.splice(A,1)},v=()=>{o.center_offset={x:0,y:0}},y=(A,_,S)=>{vue.nextTick(function(){if(i.handle_svg_info){const b=i.done_json[i.handle_svg_info.index];S?setSvgActualInfo(b,S):setSvgActualInfo(b),moveAnchors(b)}})};return(A,_)=>vue.unref(i).intention!=vue.unref(EGlobalStoreIntention).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabs),{key:0,class:"mx-2 rightTabs",modelValue:vue.unref(a),"onUpdate:modelValue":_[13]||(_[13]=S=>vue.isRef(a)?a.value=S:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"图纸",name:"page"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"背景色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElColorPicker),{modelValue:vue.unref(n).svg.background_color,"onUpdate:modelValue":_[0]||(_[0]=S=>vue.unref(n).svg.background_color=S)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"画布",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElButton),{size:"small",onClick:v,icon:vue.unref(aim_default)},{default:vue.withCtx(()=>[vue.createTextVNode("重置位置")]),_:1},8,["icon"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"X轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(o).center_offset.x,"onUpdate:modelValue":_[1]||(_[1]=S=>vue.unref(o).center_offset.x=S)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"Y轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(o).center_offset.y,"onUpdate:modelValue":_[2]||(_[2]=S=>vue.unref(o).center_offset.y=S)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(n).svg.scale,"onUpdate:modelValue":_[3]||(_[3]=S=>vue.unref(n).svg.scale=S),step:.1,"step-strictly":""},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"标尺",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(n).svg.ruler,"onUpdate:modelValue":_[4]||(_[4]=S=>vue.unref(n).svg.ruler=S)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"网格",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(n).svg.grid,"onUpdate:modelValue":_[5]||(_[5]=S=>vue.unref(n).svg.grid=S)},null,8,["modelValue"])]),_:1}),vue.unref(n).svg.grid?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,label:"网格颜色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElColorPicker),{modelValue:vue.unref(n).svg.grid_color,"onUpdate:modelValue":_[6]||(_[6]=S=>vue.unref(n).svg.grid_color=S)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)]),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"连线",name:"line"},{default:vue.withCtx(()=>[vue.unref(n).connection_line.props?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.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(elementPlus.ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:vue.unref(n).connection_line.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(n).connection_line.animations.type.val,"onUpdate:modelValue":_[7]||(_[7]=S=>vue.unref(n).connection_line.animations.type.val=S),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).connection_line.animations.type.options,S=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),vue.unref(n).connection_line.animations.type.val!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:0,"obj-info":vue.unref(n).connection_line.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0)]),_:1})):vue.createCommentVNode("",!0)]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"通信",name:"net"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(d),"onUpdate:modelValue":_[12]||(_[12]=S=>vue.isRef(d)?d.value=S:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElCollapseItem),{name:"MQTT"},{title:vue.withCtx(()=>[_hoisted_1$3]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"URL",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).net.mqtt.url,"onUpdate:modelValue":_[8]||(_[8]=S=>vue.unref(n).net.mqtt.url=S),placeholder:"如 ws://127.0.0.1:4500"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"用户名",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).net.mqtt.user,"onUpdate:modelValue":_[9]||(_[9]=S=>vue.unref(n).net.mqtt.user=S),placeholder:"username"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"密码",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).net.mqtt.pwd,"onUpdate:modelValue":_[10]||(_[10]=S=>vue.unref(n).net.mqtt.pwd=S),placeholder:"password"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"Topics",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).net.mqtt.topics,"onUpdate:modelValue":_[11]||(_[11]=S=>vue.unref(n).net.mqtt.topics=S),placeholder:"topics"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$t)]),_:1})]),_:1},8,["modelValue"])):vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select&&vue.unref(i).handle_svg_info?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabs),{key:1,class:"mx-2 rightTabs",modelValue:vue.unref(u),"onUpdate:modelValue":_[34]||(_[34]=S=>vue.isRef(u)?u.value=S:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"外观",name:"style"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>{var S,b,T,w;return[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"标题",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(i).handle_svg_info.info.title,"onUpdate:modelValue":_[14]||(_[14]=x=>vue.unref(i).handle_svg_info.info.title=x)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"X坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.x,"onUpdate:modelValue":_[15]||(_[15]=x=>vue.unref(i).handle_svg_info.info.x=x),onChange:y},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"Y坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.y,"onUpdate:modelValue":_[16]||(_[16]=x=>vue.unref(i).handle_svg_info.info.y=x),onChange:y},null,8,["modelValue"])]),_:1}),vue.withDirectives(vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"X缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.scale_x,"onUpdate:modelValue":_[17]||(_[17]=x=>vue.unref(i).handle_svg_info.info.scale_x=x),onChange:y},null,8,["modelValue"])]),_:1},512),[[vue.vShow,(b=(S=vue.unref(i).handle_svg_info)==null?void 0:S.info)==null?void 0:b.config.can_zoom]]),vue.withDirectives(vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"Y缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.scale_y,"onUpdate:modelValue":_[18]||(_[18]=x=>vue.unref(i).handle_svg_info.info.scale_y=x),onChange:y},null,8,["modelValue"])]),_:1},512),[[vue.vShow,(w=(T=vue.unref(i).handle_svg_info)==null?void 0:T.info)==null?void 0:w.config.can_zoom]]),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"旋转",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.rotate,"onUpdate:modelValue":_[19]||(_[19]=x=>vue.unref(i).handle_svg_info.info.rotate=x),onChange:y},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"显示",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(i).handle_svg_info.info.display,"onUpdate:modelValue":_[20]||(_[20]=x=>vue.unref(i).handle_svg_info.info.display=x)},null,8,["modelValue"])]),_:1})]}),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"数据",name:"data"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>{var S,b,T,w,x,k,M,D;return[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"ID",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(i).handle_svg_info.info.id,"onUpdate:modelValue":_[21]||(_[21]=z=>vue.unref(i).handle_svg_info.info.id=z)},null,8,["modelValue"])]),_:1}),(b=(S=vue.unref(i).handle_svg_info)==null?void 0:S.info)!=null&&b.state?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",label:"state",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(i).handle_svg_info.info.defaultState),1)]),_:1})):vue.createCommentVNode("",!0),(w=(T=vue.unref(i).handle_svg_info)==null?void 0:T.info)!=null&&w.state?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:"状态",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.defaultState,"onUpdate:modelValue":_[22]||(_[22]=z=>vue.unref(i).handle_svg_info.info.defaultState=z),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(i).handle_svg_info.info.state,(z,j)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:"state"+String(j),label:z.label,value:j},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),(x=vue.unref(i).handle_svg_info.info)!=null&&x.hasOwnProperty("tag_slot")?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$2,[vue.createVNode(vue.unref(elementPlus.ElFormItem),{class:"props-row",label:"tag_slot",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(i).handle_svg_info.info.tag_slot),1)]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"文字插槽",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(i).handle_svg_info.info.tag_slot,"onUpdate:modelValue":_[23]||(_[23]=z=>vue.unref(i).handle_svg_info.info.tag_slot=z),onInput:_[24]||(_[24]=z=>y(z,null,!0))},null,8,["modelValue"])]),_:1})])):vue.createCommentVNode("",!0),vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(i).handle_svg_info.info.props,code:"",onChange:_[25]||(_[25]=z=>y(z,null,!0))},null,8,["obj-info"]),vue.unref(i).handle_svg_info.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:3,label:vue.unref(i).handle_svg_info.info.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.animations.type.val,"onUpdate:modelValue":_[26]||(_[26]=z=>vue.unref(i).handle_svg_info.info.animations.type.val=z),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(i).handle_svg_info.info.animations.type.options,z=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:z.value,label:z.label,value:z.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0),((k=vue.unref(i).handle_svg_info.info.animations)==null?void 0:k.type.val)!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:4,"obj-info":vue.unref(i).handle_svg_info.info.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0),((M=vue.unref(i).handle_svg_info)==null?void 0:M.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:5,modelValue:vue.unref(i).handle_svg_info.info.bind_anchors.start,"onUpdate:modelValue":_[27]||(_[27]=z=>vue.unref(i).handle_svg_info.info.bind_anchors.start=z),title:"绑定起点"},null,8,["modelValue"])):vue.createCommentVNode("",!0),((D=vue.unref(i).handle_svg_info)==null?void 0:D.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:6,modelValue:vue.unref(i).handle_svg_info.info.bind_anchors.end,"onUpdate:modelValue":_[28]||(_[28]=z=>vue.unref(i).handle_svg_info.info.bind_anchors.end=z),title:"绑定终点"},null,8,["modelValue"])):vue.createCommentVNode("",!0)]}),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"事件",name:"event"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElButton),{type:"primary",style:{width:"100%"},onClick:vue.unref(p)},{default:vue.withCtx(()=>[vue.createTextVNode("添加事件")]),_:1},8,["onClick"]),vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(f),"onUpdate:modelValue":_[29]||(_[29]=S=>vue.isRef(f)?f.value=S:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(i).handle_svg_info.info.events,(S,b)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:b,key:"event"+b},{title:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$2,[vue.createElementVNode("span",null,"事件"+vue.toDisplayString(b+1),1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:vue.withModifiers(T=>g(b),["stop"])},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"delete"})]),_:2},1032,["onClick"])])]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"类型",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:S.type,"onUpdate:modelValue":T=>S.type=T},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"Click",label:"点击"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"Change",label:"值改变"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"行为",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:S.action,"onUpdate:modelValue":T=>S.action=T,onChange:T=>h(T,S)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"ChangeAttr",label:"改变属性"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"JavaScript",label:"执行JavaScript"})]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),S.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,label:"目标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:S.target,"onUpdate:modelValue":T=>S.target=T,placeholder:"默认自身"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),S.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(List,{key:1,modelValue:S.attrs,"onUpdate:modelValue":T=>S.attrs=T},null,8,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0),S.action==="JavaScript"?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:2,label:"JavaScript",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$w,{modelValue:S.scripts,"onUpdate:modelValue":T=>S.scripts=T,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:S.condition,"onUpdate:modelValue":T=>S.condition=T},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"动效",name:"animation"},{default:vue.withCtx(()=>{var S;return[(S=vue.unref(i).handle_svg_info)!=null&&S.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(i).handle_svg_info.info.animations},null,8,["obj-info"])]),_:1})):vue.unref(i).handle_svg_info.info.common_animations?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"动画效果",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(CommonAnimate,{onUpdateCommonAniVal:_[30]||(_[30]=b=>{var T;return c((T=vue.unref(i).handle_svg_info)==null?void 0:T.info,b)}),val:vue.unref(i).handle_svg_info.info.common_animations.val},null,8,["val"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"延迟",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.common_animations.delay,"onUpdate:modelValue":_[31]||(_[31]=b=>vue.unref(i).handle_svg_info.info.common_animations.delay=b)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-0s",label:"无"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-1s",label:"1秒"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-2s",label:"2秒"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-3s",label:"3秒"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-4s",label:"4秒"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-5s",label:"5秒"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"动画速度",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.common_animations.speed,"onUpdate:modelValue":_[32]||(_[32]=b=>vue.unref(i).handle_svg_info.info.common_animations.speed=b)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"slow",label:"慢"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"slower",label:"最慢"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"fast",label:"快"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"faster",label:"最快"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"循环次数",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.common_animations.repeat,"onUpdate:modelValue":_[33]||(_[33]=b=>vue.unref(i).handle_svg_info.info.common_animations.repeat=b)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"repeat-1",label:"一次"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"repeat-2",label:"两次"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"repeat-3",label:"三次"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"infinite",label:"无限次"})]),_:1},8,["modelValue"])]),_:1})]),_:1})):vue.createCommentVNode("",!0)]}),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$t)]),_:1})]),_:1},8,["modelValue"])):vue.createCommentVNode("",!0)}}),rightPanel_vue_vue_type_style_index_0_scoped_9b4c5da1_lang="",rightPanel_vue_vue_type_style_index_1_lang="",RightPanel=_export_sfc$1(_sfc_main$5,[["__scopeId","data-v-9b4c5da1"]]),_sfc_main$4=vue.defineComponent({__name:"export-json",setup(r){const n=vue.ref(""),i=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return vue.onMounted(()=>{const u={layout_center:o.center_offset,config:a.$state,done_json:i.done_json};n.value=JSON.stringify(u,null,2)}),(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(n),"onUpdate:value":c[0]||(c[0]=f=>vue.isRef(n)?n.value=f: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:"import-json",setup(r,{expose:n}){const i=vue.ref("");return n({setVal:u=>{i.value=u},onImportJson:()=>{useImportDataModel(i.value)&&elementPlus.ElMessage.success("导入成功")}}),(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(i),"onUpdate:value":c[0]||(c[0]=f=>vue.isRef(i)?i.value=f:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_hoisted_1$2=["onMousedown"],_hoisted_2$1=["onMousedown"],_hoisted_3$1=["title","onMousedown"],_hoisted_4$1={class:"vue-ruler-content-mask"},_sfc_main$2=vue.defineComponent({__name:"vue3-ruler-tool",props:{visible:{type:Boolean,default:!0},stepLength:{default:100}},emits:["onLineMouseUp"],setup(r,{emit:n}){const i=r,o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia),u=function(){return function(Et,Ne,pe){Et&&Ne&&pe&&Et.addEventListener(Ne,pe,!1)}}(),c=function(){return function(Et,Ne,pe){Et&&Ne&&Et.removeEventListener(Ne,pe,!1)}}();let f=18,d=vue.ref(0),p=vue.ref(0),h=vue.ref([]),g=vue.ref([]);const v=vue.ref([]);let y=vue.ref(!1),A="",_=vue.ref(-999),S=vue.ref(-999),b=18,T=18,w="";const x=vue.ref(null),k=vue.ref(null),M=vue.ref(null),D=vue.ref(null),z=vue.computed(()=>({width:d.value+"px",height:p.value+"px"})),j=vue.computed(()=>({padding:f+"px 0px 0px "+f+"px"})),oe=vue.computed(()=>{let Et=0,Ne=0;return v.value.map(pe=>{const At=pe.type==="h";return{id:`${pe.type}_${At?Et++:Ne++}`,type:pe.type,title:pe.site.toFixed(0)+"px",[At?"top":"left"]:pe.site*a.svg.scale+f+o.center_offset[At?"y":"x"]*a.svg.scale}})});o.$subscribe(Et=>{var Ne,pe,At,Ve;((pe=(Ne=Et.events)==null?void 0:Ne.target)!=null&&pe.hasOwnProperty("left_nav")||(Ve=(At=Et.events)==null?void 0:At.target)!=null&&Ve.hasOwnProperty("right_nav"))&&window.setTimeout(L,420)}),a.$subscribe(Et=>{var Ne,pe;(pe=(Ne=Et.events)==null?void 0:Ne.target)!=null&&pe.hasOwnProperty("scale")&&Ce()}),vue.onMounted(()=>{u(document,"mousemove",ie),u(document,"mouseup",Oe),L(),u(window,"resize",F)}),vue.onBeforeUnmount(()=>{c(document,"mousemove",ie),c(document,"mouseup",Oe),c(window,"resize",F)});const L=()=>{_e(),Ce()},F=()=>{h.value=[],g.value=[],L()},O=({type:Et,top:Ne,left:pe})=>Et==="h"?{top:Ne+"px"}:{left:pe+"px"},ue=({type:Et,id:Ne})=>Et==="h"?Cn(Ne):Lt(Ne),_e=()=>{const Et=window.getComputedStyle(k.value.parentNode,null);d.value=parseInt(Et.getPropertyValue("width")),p.value=parseInt(Et.getPropertyValue("height")),b=M.value.clientWidth,T=D.value.clientHeight},Ce=()=>{de(h.value,d.value,o.center_offset.x),de(g.value,p.value,o.center_offset.y)},de=(Et,Ne,pe)=>{if(Et.length===0)for(let At=0;At<Ne;At+=i.stepLength)At%i.stepLength===0&&Et.push({id:Number((At/a.svg.scale-pe).toFixed(0))});else Et.forEach((At,Ve)=>{At.id=Number((Ve*i.stepLength/a.svg.scale-pe).toFixed(0))})},ie=Et=>{Ce(),Y(Et)},Y=Et=>{if(!(Et.layerX===Et.x||Et.layerY===Et.y))switch(A){case"x":y.value&&(S.value=Et.layerY);break;case"y":y.value&&(_.value=Et.layerX);break;case"h":y.value&&(S.value=Et.layerY);break;case"v":y.value&&(_.value=Et.layerX);break}},Ie=Et=>{y.value=!0,A=Et},Oe=Et=>{kt(Et)},kt=Et=>{if(y.value){switch(y.value=!1,A){case"x":const Ne=Math.round((Et.layerY-f)/a.svg.scale-o.center_offset.y);if(Ne<=0){S.value=-999;return}v.value.push({type:"h",site:Ne});break;case"y":const pe=Math.round((Et.layerX-f)/a.svg.scale-o.center_offset.x);if(pe<=0){_.value=-999;return}v.value.push({type:"v",site:pe});break;case"h":Dt(v.value,Math.round((Et.layerY-f)/a.svg.scale-o.center_offset.y),Math.round(T/a.svg.scale-o.center_offset.y),"h");break;case"v":Dt(v.value,Math.round((Et.layerX-f)/a.svg.scale-o.center_offset.x),Math.round(b/a.svg.scale-o.center_offset.x),"v");break}S.value=_.value=-999}},Dt=(Et,Ne,pe,At)=>{if(Ne<pe){let Ve;oe.value.forEach((xe,ze)=>{xe.id===w&&(Ve=ze)}),Et.splice(Ve,1)}else{let Ve;oe.value.forEach((xe,ze)=>{xe.id===w&&(Ve=ze)}),Et.splice(Ve,1,{type:At,site:Ne})}},Fe=()=>{Ie("x")},$e=()=>{Ie("y")},Cn=Et=>{y.value=!0,A="h",w=Et},Lt=Et=>{y.value=!0,A="v",w=Et},In=()=>{n("onLineMouseUp")};return(Et,Ne)=>(vue.openBlock(),vue.createElementBlock("div",{style:vue.normalizeStyle(vue.unref(z)),class:"vue-ruler-wrapper",onselectStart:"return false;",ref_key:"el",ref:k},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref_key:"horizontalRuler",ref:D,class:"vue-ruler-h",onMousedown:vue.withModifiers(Fe,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(h),(pe,At)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({left:At*Et.stepLength+"px"}),class:"n"},vue.toDisplayString(pe.id),5))),256))],40,_hoisted_1$2),vue.createElementVNode("div",{ref_key:"verticalRuler",ref:M,class:"vue-ruler-v",onMousedown:vue.withModifiers($e,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),(pe,At)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({top:At*Et.stepLength+"px"}),class:"n"},vue.toDisplayString(pe.id),5))),256))],40,_hoisted_2$1),vue.createElementVNode("div",{style:vue.normalizeStyle({top:vue.unref(S)+"px"}),class:"vue-ruler-ref-dot-h"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(S)-vue.unref(T))/vue.unref(a).svg.scale)),1)],4),vue.createElementVNode("div",{style:vue.normalizeStyle({left:vue.unref(_)+"px"}),class:"vue-ruler-ref-dot-v"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(_)-vue.unref(b))/vue.unref(a).svg.scale)),1)],4),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oe),pe=>(vue.openBlock(),vue.createElementBlock("div",{title:pe.title,style:vue.normalizeStyle(O(pe)),key:pe.id,class:vue.normalizeClass(`vue-ruler-ref-line-${pe.type}`),onMousedown:At=>ue(pe),onMouseup:In,onContextmenu:Ne[0]||(Ne[0]=(...At)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...At))},null,46,_hoisted_3$1))),128))],512),[[vue.vShow,i.visible]]),vue.createElementVNode("div",{ref_key:"content",ref:x,class:"vue-ruler-content",style:vue.normalizeStyle(vue.unref(j))},[vue.renderSlot(Et.$slots,"default")],4),vue.withDirectives(vue.createElementVNode("div",_hoisted_4$1,null,512),[[vue.vShow,vue.unref(y)]])],4))}}),vue3RulerTool_vue_vue_type_style_index_0_lang="";function fileWrite(r,n=new Date(Date.now()).toLocaleString()){const i=JSON.stringify(r),o=new Blob([i]);let a=document.createElement("a");a.download=n+".json",a.style.display="none",a.href=URL.createObjectURL(o),document.body.appendChild(a),a.click(),document.body.removeChild(a)}function fileRead(r){return new Promise((n,i)=>{let o=new FileReader;o.readAsText(r,"UTF-8"),o.onload=function(a){a&&a.target?n(a.target.result):i("文件读取错误")}})}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(r,{expose:n,emit:i}){const o=r;setEditorLoadTime();const a=useGlobalStore(pinia),u=useSvgEditLayoutStore(pinia),c=useConfigStore(pinia),f=useEditPrivateStore(pinia),d=vue.ref(),p=vue.ref(),h=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),g=(w,x)=>{h[w]=x},v=vue.ref();v.value=()=>{p.value.onImportJson(),g(EVisibleConfKey.ImportJson,!1)};const y=w=>["text/plain","application/json"].indexOf(w.type)<0?(elementPlus.ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(w).then(x=>{p.value.setVal(x),elementPlus.ElMessage.success("文件读取成功!")}),!1),A=w=>{a.setDoneJson(w)};vue.onMounted(()=>{f.history_doneComponent=[],f.history_now_index=0,o.data?useImportDataModel(o.data):a.setDoneJson([]),a.intention=EGlobalStoreIntention.None});const{appContext:_}=vue.getCurrentInstance();function S(w){i("onReturn",{data:w,isChange:f.getTopBtnUndoStatus})}function b(w){o.saveFile?elementPlus.ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},_).then(x=>{fileWrite(w,x.value.trim()),i("onSave",w)}).catch(x=>{console.log(x)}):i("onSave",w)}function T(){d.value.onCanvasMouseUp()}return n({setGraphNodeJson:A}),(w,x)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElContainer),null,{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElHeader),{class:"top-el-header"},{default:vue.withCtx(()=>[vue.createVNode(TopPanel,{onChangeVisible:g,onOnReturn:S,onOnPreview:x[0]||(x[0]=k=>i("onPreview",k)),onOnSave:b})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElContainer),{class:"middle"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(u).left_nav?"show-nav":"hide-nav"]),style:{"border-right":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(LeftPanel,{class:"content-left","custom-toolbar":o.customToolbar},null,8,["custom-toolbar"])]),_:1})]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElMain),{class:"middle main"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$1,[vue.createVNode(_sfc_main$2,{class:"canvas-main-pc",visible:vue.unref(c).svg.ruler,onOnLineMouseUp:T},{default:vue.withCtx(()=>[vue.createVNode(CenterPanel,{ref_key:"centerRef",ref:d},null,512)]),_:1},8,["visible"])])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(u).right_nav?"show-nav":"hide-nav"]),style:{"border-left":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(RightPanel)]),_:1})]),_:1},8,["class"])]),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(h).ImportJson,"onUpdate:modelValue":x[2]||(x[2]=k=>vue.unref(h).ImportJson=k),title:"导入数据",width:"60%","destroy-on-close":""},{footer:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElUpload),{beforeUpload:y,style:{display:"inline-flex","margin-right":"12px"},multiple:!1,"show-file-list":!1,limit:1},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:x[1]||(x[1]=k=>g(vue.unref(EVisibleConfKey).ImportFile,!0))},{default:vue.withCtx(()=>[vue.createTextVNode("读取文件")]),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElButton),{type:"primary",onClick:vue.unref(v)},{default:vue.withCtx(()=>[vue.createTextVNode("导入数据")]),_:1},8,["onClick"])]),default:vue.withCtx(()=>[vue.createVNode(_sfc_main$3,{ref_key:"importJsonRef",ref:p},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(h).ExportJson,"onUpdate:modelValue":x[3]||(x[3]=k=>vue.unref(h).ExportJson=k),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_01ceb0c4_lang="",index=_export_sfc$1(_sfc_main$1,[["__scopeId","data-v-01ceb0c4"]]);function commonjsRequire(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var mqtt={exports:{}};(function(r,n){(function(i){r.exports=i()})(function(){return function(){function i(o,a,u){function c(p,h){if(!a[p]){if(!o[p]){var g=typeof commonjsRequire=="function"&&commonjsRequire;if(!h&&g)return g(p,!0);if(f)return f(p,!0);var v=new Error("Cannot find module '"+p+"'");throw v.code="MODULE_NOT_FOUND",v}var y=a[p]={exports:{}};o[p][0].call(y.exports,function(A){var _=o[p][1][A];return c(_||A)},y,y.exports,i,o,a,u)}return a[p].exports}for(var f=typeof commonjsRequire=="function"&&commonjsRequire,d=0;d<u.length;d++)c(u[d]);return c}return i}()({1:[function(i,o,a){(function(u,c){(function(){const f=i("events").EventEmitter,d=i("./store"),p=i("./topic-alias-recv"),h=i("./topic-alias-send"),g=i("mqtt-packet"),v=i("./default-message-id-provider"),y=i("readable-stream").Writable,A=i("inherits"),_=i("reinterval"),S=i("rfdc/default"),b=i("./validations"),T=i("xtend"),w=i("debug")("mqttjs:client"),x=u?u.nextTick:function(ie){setTimeout(ie,0)},k=c.setImmediate||function(ie){x(ie)},M={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},D=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],z={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 j(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function oe(ie,Y){if(ie.options.protocolVersion===5&&Y.cmd==="publish"){let Ie;Y.properties&&(Ie=Y.properties.topicAlias);const Oe=Y.topic.toString();if(ie.topicAliasSend)if(Ie){if(Oe.length!==0&&(w("applyTopicAlias :: register topic: %s - alias: %d",Oe,Ie),!ie.topicAliasSend.put(Oe,Ie)))return w("applyTopicAlias :: error out of range. topic: %s - alias: %d",Oe,Ie),new Error("Sending Topic Alias out of range")}else Oe.length!==0&&(ie.options.autoAssignTopicAlias?(Ie=ie.topicAliasSend.getAliasByTopic(Oe),Ie?(Y.topic="",Y.properties={...Y.properties,topicAlias:Ie},w("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",Oe,Ie)):(Ie=ie.topicAliasSend.getLruAlias(),ie.topicAliasSend.put(Oe,Ie),Y.properties={...Y.properties,topicAlias:Ie},w("applyTopicAlias :: auto assign topic: %s - alias: %d",Oe,Ie))):ie.options.autoUseTopicAlias&&(Ie=ie.topicAliasSend.getAliasByTopic(Oe),Ie&&(Y.topic="",Y.properties={...Y.properties,topicAlias:Ie},w("applyTopicAlias :: auto use topic: %s - alias: %d",Oe,Ie))));else if(Ie)return w("applyTopicAlias :: error out of range. topic: %s - alias: %d",Oe,Ie),new Error("Sending Topic Alias out of range")}}function L(ie,Y){let Ie;Y.properties&&(Ie=Y.properties.topicAlias);let Oe=Y.topic.toString();if(Oe.length===0){if(typeof Ie>"u")return new Error("Unregistered Topic Alias");if(Oe=ie.topicAliasSend.getTopicByAlias(Ie),typeof Oe>"u")return new Error("Unregistered Topic Alias");Y.topic=Oe}Ie&&delete Y.properties.topicAlias}function F(ie,Y,Ie){w("sendPacket :: packet: %O",Y),w("sendPacket :: emitting `packetsend`"),ie.emit("packetsend",Y),w("sendPacket :: writing to stream");const Oe=g.writeToStream(Y,ie.stream,ie.options);w("sendPacket :: writeToStream result %s",Oe),!Oe&&Ie&&Ie!==Ce?(w("sendPacket :: handle events on `drain` once through callback."),ie.stream.once("drain",Ie)):Ie&&(w("sendPacket :: invoking cb"),Ie())}function O(ie){ie&&(w("flush: queue exists? %b",!!ie),Object.keys(ie).forEach(function(Y){typeof ie[Y].cb=="function"&&(ie[Y].cb(new Error("Connection closed")),delete ie[Y])}))}function ue(ie){ie&&(w("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(ie).forEach(function(Y){ie[Y].volatile&&typeof ie[Y].cb=="function"&&(ie[Y].cb(new Error("Connection closed")),delete ie[Y])}))}function _e(ie,Y,Ie,Oe){w("storeAndSend :: store packet with cmd %s to outgoingStore",Y.cmd);let kt=Y,Dt;if(kt.cmd==="publish"&&(kt=S(Y),Dt=L(ie,kt),Dt))return Ie&&Ie(Dt);ie.outgoingStore.put(kt,function($e){if($e)return Ie&&Ie($e);Oe(),F(ie,Y,Ie)})}function Ce(ie){w("nop ::",ie)}function de(ie,Y){let Ie;const Oe=this;if(!(this instanceof de))return new de(ie,Y);this.options=Y||{};for(Ie in M)typeof this.options[Ie]>"u"?this.options[Ie]=M[Ie]:this.options[Ie]=Y[Ie];w("MqttClient :: options.protocol",Y.protocol),w("MqttClient :: options.protocolVersion",Y.protocolVersion),w("MqttClient :: options.username",Y.username),w("MqttClient :: options.keepalive",Y.keepalive),w("MqttClient :: options.reconnectPeriod",Y.reconnectPeriod),w("MqttClient :: options.rejectUnauthorized",Y.rejectUnauthorized),w("MqttClient :: options.topicAliasMaximum",Y.topicAliasMaximum),this.options.clientId=typeof Y.clientId=="string"?Y.clientId:j(),w("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=Y.protocolVersion===5&&Y.customHandleAcks?Y.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=ie,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new v:this.options.messageIdProvider,this.outgoingStore=Y.outgoingStore||new d,this.incomingStore=Y.incomingStore||new d,this.queueQoSZero=Y.queueQoSZero===void 0?!0:Y.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,Y.topicAliasMaximum>0&&(Y.topicAliasMaximum>65535?w("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new p(Y.topicAliasMaximum)),this.on("connect",function(){const kt=this.queue;function Dt(){const Fe=kt.shift();w("deliver :: entry %o",Fe);let $e=null;if(!Fe){Oe._resubscribe();return}$e=Fe.packet,w("deliver :: call _sendPacket for %o",$e);let Cn=!0;$e.messageId&&$e.messageId!==0&&(Oe.messageIdProvider.register($e.messageId)||(Cn=!1)),Cn?Oe._sendPacket($e,function(Lt){Fe.cb&&Fe.cb(Lt),Dt()}):(w("messageId: %d has already used. The message is skipped and removed.",$e.messageId),Dt())}w("connect :: sending queued packets"),Dt()}),this.on("close",function(){w("close :: connected set to `false`"),this.connected=!1,w("close :: clearing connackTimer"),clearTimeout(this.connackTimer),w("close :: clearing ping timer"),Oe.pingTimer!==null&&(Oe.pingTimer.clear(),Oe.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),w("close :: calling _setupReconnect"),this._setupReconnect()}),f.call(this),w("MqttClient :: setting up stream"),this._setupStream()}A(de,f),de.prototype._setupStream=function(){const ie=this,Y=new y,Ie=g.parser(this.options);let Oe=null;const kt=[];w("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),w("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),Ie.on("packet",function(Lt){w("parser :: on packet push to packets array."),kt.push(Lt)});function Dt(){if(kt.length)x(Fe);else{const Lt=Oe;Oe=null,Lt()}}function Fe(){w("work :: getting next packet in queue");const Lt=kt.shift();if(Lt)w("work :: packet pulled from queue"),ie._handlePacket(Lt,Dt);else{w("work :: no packets in queue");const In=Oe;Oe=null,w("work :: done flag is %s",!!In),In&&In()}}Y._write=function(Lt,In,Et){Oe=Et,w("writable stream :: parsing buffer"),Ie.parse(Lt),Fe()};function $e(Lt){w("streamErrorHandler :: error",Lt.message),D.includes(Lt.code)?(w("streamErrorHandler :: emitting error"),ie.emit("error",Lt)):Ce(Lt)}w("_setupStream :: pipe stream to writable stream"),this.stream.pipe(Y),this.stream.on("error",$e),this.stream.on("close",function(){w("(%s)stream :: on close",ie.options.clientId),ue(ie.outgoing),w("stream: emit close to MqttClient"),ie.emit("close")}),w("_setupStream: sending packet `connect`");const Cn=Object.create(this.options);if(Cn.cmd="connect",this.topicAliasRecv&&(Cn.properties||(Cn.properties={}),this.topicAliasRecv&&(Cn.properties.topicAliasMaximum=this.topicAliasRecv.max)),F(this,Cn),Ie.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return ie.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 Lt=T({cmd:"auth",reasonCode:0},this.options.authPacket);F(this,Lt)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){w("!!connectTimeout hit!! Calling _cleanUp with force `true`"),ie._cleanUp(!0)},this.options.connectTimeout)},de.prototype._handlePacket=function(ie,Y){const Ie=this.options;if(Ie.protocolVersion===5&&Ie.properties&&Ie.properties.maximumPacketSize&&Ie.properties.maximumPacketSize<ie.length)return this.emit("error",new Error("exceeding packets size "+ie.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(w("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",ie),ie.cmd){case"publish":this._handlePublish(ie,Y);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(ie),Y();break;case"pubrel":this._handlePubrel(ie,Y);break;case"connack":this._handleConnack(ie),Y();break;case"auth":this._handleAuth(ie),Y();break;case"pingresp":this._handlePingresp(ie),Y();break;case"disconnect":this._handleDisconnect(ie),Y();break}},de.prototype._checkDisconnecting=function(ie){return this.disconnecting&&(ie&&ie!==Ce?ie(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},de.prototype.publish=function(ie,Y,Ie,Oe){w("publish :: message `%s` to topic `%s`",Y,ie);const kt=this.options;if(typeof Ie=="function"&&(Oe=Ie,Ie=null),Ie=T({qos:0,retain:!1,dup:!1},Ie),this._checkDisconnecting(Oe))return this;const Fe=this,$e=function(){let Cn=0;if((Ie.qos===1||Ie.qos===2)&&(Cn=Fe._nextId(),Cn===null))return w("No messageId left"),!1;const Lt={cmd:"publish",topic:ie,payload:Y,qos:Ie.qos,retain:Ie.retain,messageId:Cn,dup:Ie.dup};switch(kt.protocolVersion===5&&(Lt.properties=Ie.properties),w("publish :: qos",Ie.qos),Ie.qos){case 1:case 2:Fe.outgoing[Lt.messageId]={volatile:!1,cb:Oe||Ce},w("MqttClient:publish: packet cmd: %s",Lt.cmd),Fe._sendPacket(Lt,void 0,Ie.cbStorePut);break;default:w("MqttClient:publish: packet cmd: %s",Lt.cmd),Fe._sendPacket(Lt,Oe,Ie.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!$e())&&this._storeProcessingQueue.push({invoke:$e,cbStorePut:Ie.cbStorePut,callback:Oe}),this},de.prototype.subscribe=function(){const ie=this,Y=new Array(arguments.length);for(let Et=0;Et<arguments.length;Et++)Y[Et]=arguments[Et];const Ie=[];let Oe=Y.shift();const kt=Oe.resubscribe;let Dt=Y.pop()||Ce,Fe=Y.pop();const $e=this.options.protocolVersion;delete Oe.resubscribe,typeof Oe=="string"&&(Oe=[Oe]),typeof Dt!="function"&&(Fe=Dt,Dt=Ce);const Cn=b.validateTopics(Oe);if(Cn!==null)return k(Dt,new Error("Invalid topic "+Cn)),this;if(this._checkDisconnecting(Dt))return w("subscribe: discconecting true"),this;const Lt={qos:0};if($e===5&&(Lt.nl=!1,Lt.rap=!1,Lt.rh=0),Fe=T(Lt,Fe),Array.isArray(Oe)?Oe.forEach(function(Et){if(w("subscribe: array topic %s",Et),!Object.prototype.hasOwnProperty.call(ie._resubscribeTopics,Et)||ie._resubscribeTopics[Et].qos<Fe.qos||kt){const Ne={topic:Et,qos:Fe.qos};$e===5&&(Ne.nl=Fe.nl,Ne.rap=Fe.rap,Ne.rh=Fe.rh,Ne.properties=Fe.properties),w("subscribe: pushing topic `%s` and qos `%s` to subs list",Ne.topic,Ne.qos),Ie.push(Ne)}}):Object.keys(Oe).forEach(function(Et){if(w("subscribe: object topic %s",Et),!Object.prototype.hasOwnProperty.call(ie._resubscribeTopics,Et)||ie._resubscribeTopics[Et].qos<Oe[Et].qos||kt){const Ne={topic:Et,qos:Oe[Et].qos};$e===5&&(Ne.nl=Oe[Et].nl,Ne.rap=Oe[Et].rap,Ne.rh=Oe[Et].rh,Ne.properties=Fe.properties),w("subscribe: pushing `%s` to subs list",Ne),Ie.push(Ne)}}),!Ie.length)return Dt(null,[]),this;const In=function(){const Et=ie._nextId();if(Et===null)return w("No messageId left"),!1;const Ne={cmd:"subscribe",subscriptions:Ie,qos:1,retain:!1,dup:!1,messageId:Et};if(Fe.properties&&(Ne.properties=Fe.properties),ie.options.resubscribe){w("subscribe :: resubscribe true");const pe=[];Ie.forEach(function(At){if(ie.options.reconnectPeriod>0){const Ve={qos:At.qos};$e===5&&(Ve.nl=At.nl||!1,Ve.rap=At.rap||!1,Ve.rh=At.rh||0,Ve.properties=At.properties),ie._resubscribeTopics[At.topic]=Ve,pe.push(At.topic)}}),ie.messageIdToTopic[Ne.messageId]=pe}return ie.outgoing[Ne.messageId]={volatile:!0,cb:function(pe,At){if(!pe){const Ve=At.granted;for(let xe=0;xe<Ve.length;xe+=1)Ie[xe].qos=Ve[xe]}Dt(pe,Ie)}},w("subscribe :: call _sendPacket"),ie._sendPacket(Ne),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!In())&&this._storeProcessingQueue.push({invoke:In,callback:Dt}),this},de.prototype.unsubscribe=function(){const ie=this,Y=new Array(arguments.length);for(let $e=0;$e<arguments.length;$e++)Y[$e]=arguments[$e];let Ie=Y.shift(),Oe=Y.pop()||Ce,kt=Y.pop();typeof Ie=="string"&&(Ie=[Ie]),typeof Oe!="function"&&(kt=Oe,Oe=Ce);const Dt=b.validateTopics(Ie);if(Dt!==null)return k(Oe,new Error("Invalid topic "+Dt)),this;if(ie._checkDisconnecting(Oe))return this;const Fe=function(){const $e=ie._nextId();if($e===null)return w("No messageId left"),!1;const Cn={cmd:"unsubscribe",qos:1,messageId:$e};return typeof Ie=="string"?Cn.unsubscriptions=[Ie]:Array.isArray(Ie)&&(Cn.unsubscriptions=Ie),ie.options.resubscribe&&Cn.unsubscriptions.forEach(function(Lt){delete ie._resubscribeTopics[Lt]}),typeof kt=="object"&&kt.properties&&(Cn.properties=kt.properties),ie.outgoing[Cn.messageId]={volatile:!0,cb:Oe},w("unsubscribe: call _sendPacket"),ie._sendPacket(Cn),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Fe())&&this._storeProcessingQueue.push({invoke:Fe,callback:Oe}),this},de.prototype.end=function(ie,Y,Ie){const Oe=this;w("end :: (%s)",this.options.clientId),(ie==null||typeof ie!="boolean")&&(Ie=Y||Ce,Y=ie,ie=!1,typeof Y!="object"&&(Ie=Y,Y=null,typeof Ie!="function"&&(Ie=Ce))),typeof Y!="object"&&(Ie=Y,Y=null),w("end :: cb? %s",!!Ie),Ie=Ie||Ce;function kt(){w("end :: closeStores: closing incoming and outgoing stores"),Oe.disconnected=!0,Oe.incomingStore.close(function(Fe){Oe.outgoingStore.close(function($e){if(w("end :: closeStores: emitting end"),Oe.emit("end"),Ie){const Cn=Fe||$e;w("end :: closeStores: invoking callback with args"),Ie(Cn)}})}),Oe._deferredReconnect&&Oe._deferredReconnect()}function Dt(){w("end :: (%s) :: finish :: calling _cleanUp with force %s",Oe.options.clientId,ie),Oe._cleanUp(ie,()=>{w("end :: finish :: calling process.nextTick on closeStores"),x(kt.bind(Oe))},Y)}return this.disconnecting?(Ie(),this):(this._clearReconnect(),this.disconnecting=!0,!ie&&Object.keys(this.outgoing).length>0?(w("end :: (%s) :: calling finish in 10ms once outgoing is empty",Oe.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,Dt,10))):(w("end :: (%s) :: immediately calling finish",Oe.options.clientId),Dt()),this)},de.prototype.removeOutgoingMessage=function(ie){const Y=this.outgoing[ie]?this.outgoing[ie].cb:null;return delete this.outgoing[ie],this.outgoingStore.del({messageId:ie},function(){Y(new Error("Message removed"))}),this},de.prototype.reconnect=function(ie){w("client reconnect");const Y=this,Ie=function(){ie?(Y.options.incomingStore=ie.incomingStore,Y.options.outgoingStore=ie.outgoingStore):(Y.options.incomingStore=null,Y.options.outgoingStore=null),Y.incomingStore=Y.options.incomingStore||new d,Y.outgoingStore=Y.options.outgoingStore||new d,Y.disconnecting=!1,Y.disconnected=!1,Y._deferredReconnect=null,Y._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=Ie:Ie(),this},de.prototype._reconnect=function(){w("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),w("client already connected. disconnecting first.")):(w("_reconnect: calling _setupStream"),this._setupStream())},de.prototype._setupReconnect=function(){const ie=this;!ie.disconnecting&&!ie.reconnectTimer&&ie.options.reconnectPeriod>0?(this.reconnecting||(w("_setupReconnect :: emit `offline` state"),this.emit("offline"),w("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),w("_setupReconnect :: setting reconnectTimer for %d ms",ie.options.reconnectPeriod),ie.reconnectTimer=setInterval(function(){w("reconnectTimer :: reconnect triggered!"),ie._reconnect()},ie.options.reconnectPeriod)):w("_setupReconnect :: doing nothing...")},de.prototype._clearReconnect=function(){w("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},de.prototype._cleanUp=function(ie,Y){const Ie=arguments[2];if(Y&&(w("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",Y)),w("_cleanUp :: forced? %s",ie),ie)this.options.reconnectPeriod===0&&this.options.clean&&O(this.outgoing),w("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const Oe=T({cmd:"disconnect"},Ie);w("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(Oe,k.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(w("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(w("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),Y&&!this.connected&&(w("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",Y),Y())},de.prototype._sendPacket=function(ie,Y,Ie){w("_sendPacket :: (%s) :: start",this.options.clientId),Ie=Ie||Ce,Y=Y||Ce;const Oe=oe(this,ie);if(Oe){Y(Oe);return}if(!this.connected){if(ie.cmd==="auth"){this._shiftPingInterval(),F(this,ie,Y);return}w("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(ie,Y,Ie);return}switch(this._shiftPingInterval(),ie.cmd){case"publish":break;case"pubrel":_e(this,ie,Y,Ie);return;default:F(this,ie,Y);return}switch(ie.qos){case 2:case 1:_e(this,ie,Y,Ie);break;case 0:default:F(this,ie,Y);break}w("_sendPacket :: (%s) :: end",this.options.clientId)},de.prototype._storePacket=function(ie,Y,Ie){w("_storePacket :: packet: %o",ie),w("_storePacket :: cb? %s",!!Y),Ie=Ie||Ce;let Oe=ie;if(Oe.cmd==="publish"){Oe=S(ie);const kt=L(this,Oe);if(kt)return Y&&Y(kt)}(Oe.qos||0)===0&&this.queueQoSZero||Oe.cmd!=="publish"?this.queue.push({packet:Oe,cb:Y}):Oe.qos>0?(Y=this.outgoing[Oe.messageId]?this.outgoing[Oe.messageId].cb:null,this.outgoingStore.put(Oe,function(kt){if(kt)return Y&&Y(kt);Ie()})):Y&&Y(new Error("No connection to broker"))},de.prototype._setupPingTimer=function(){w("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const ie=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=_(function(){ie._checkPing()},this.options.keepalive*1e3))},de.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)},de.prototype._checkPing=function(){w("_checkPing :: checking ping..."),this.pingResp?(w("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(w("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},de.prototype._handlePingresp=function(){this.pingResp=!0},de.prototype._handleConnack=function(ie){w("_handleConnack");const Y=this.options,Oe=Y.protocolVersion===5?ie.reasonCode:ie.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,ie.properties){if(ie.properties.topicAliasMaximum){if(ie.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}ie.properties.topicAliasMaximum>0&&(this.topicAliasSend=new h(ie.properties.topicAliasMaximum))}ie.properties.serverKeepAlive&&Y.keepalive&&(Y.keepalive=ie.properties.serverKeepAlive,this._shiftPingInterval()),ie.properties.maximumPacketSize&&(Y.properties||(Y.properties={}),Y.properties.maximumPacketSize=ie.properties.maximumPacketSize)}if(Oe===0)this.reconnecting=!1,this._onConnect(ie);else if(Oe>0){const kt=new Error("Connection refused: "+z[Oe]);kt.code=Oe,this.emit("error",kt)}},de.prototype._handleAuth=function(ie){const Ie=this.options.protocolVersion,Oe=Ie===5?ie.reasonCode:ie.returnCode;if(Ie!==5){const Dt=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+Ie);Dt.code=Oe,this.emit("error",Dt);return}const kt=this;this.handleAuth(ie,function(Dt,Fe){if(Dt){kt.emit("error",Dt);return}if(Oe===24)kt.reconnecting=!1,kt._sendPacket(Fe);else{const $e=new Error("Connection refused: "+z[Oe]);Dt.code=Oe,kt.emit("error",$e)}})},de.prototype.handleAuth=function(ie,Y){Y()},de.prototype._handlePublish=function(ie,Y){w("_handlePublish: packet %o",ie),Y=typeof Y<"u"?Y:Ce;let Ie=ie.topic.toString();const Oe=ie.payload,kt=ie.qos,Dt=ie.messageId,Fe=this,$e=this.options,Cn=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let Lt;if(ie.properties&&(Lt=ie.properties.topicAlias),typeof Lt<"u")if(Ie.length===0)if(Lt>0&&Lt<=65535){const In=this.topicAliasRecv.getTopicByAlias(Lt);if(In)Ie=In,w("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",Ie,Lt);else{w("_handlePublish :: unregistered topic alias. alias: %d",Lt),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{w("_handlePublish :: topic alias out of range. alias: %d",Lt),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(Ie,Lt))w("_handlePublish :: registered topic: %s - alias: %d",Ie,Lt);else{w("_handlePublish :: topic alias out of range. alias: %d",Lt),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(w("_handlePublish: qos %d",kt),kt){case 2:{$e.customHandleAcks(Ie,Oe,ie,function(Lt,In){if(Lt instanceof Error||(In=Lt,Lt=null),Lt)return Fe.emit("error",Lt);if(Cn.indexOf(In)===-1)return Fe.emit("error",new Error("Wrong reason code for pubrec"));In?Fe._sendPacket({cmd:"pubrec",messageId:Dt,reasonCode:In},Y):Fe.incomingStore.put(ie,function(){Fe._sendPacket({cmd:"pubrec",messageId:Dt},Y)})});break}case 1:{$e.customHandleAcks(Ie,Oe,ie,function(Lt,In){if(Lt instanceof Error||(In=Lt,Lt=null),Lt)return Fe.emit("error",Lt);if(Cn.indexOf(In)===-1)return Fe.emit("error",new Error("Wrong reason code for puback"));In||Fe.emit("message",Ie,Oe,ie),Fe.handleMessage(ie,function(Et){if(Et)return Y&&Y(Et);Fe._sendPacket({cmd:"puback",messageId:Dt,reasonCode:In},Y)})});break}case 0:this.emit("message",Ie,Oe,ie),this.handleMessage(ie,Y);break;default:w("_handlePublish: unknown QoS. Doing nothing.");break}},de.prototype.handleMessage=function(ie,Y){Y()},de.prototype._handleAck=function(ie){const Y=ie.messageId,Ie=ie.cmd;let Oe=null;const kt=this.outgoing[Y]?this.outgoing[Y].cb:null,Dt=this;let Fe;if(!kt){w("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(w("_handleAck :: packet type",Ie),Ie){case"pubcomp":case"puback":{const $e=ie.reasonCode;$e&&$e>0&&$e!==16&&(Fe=new Error("Publish error: "+z[$e]),Fe.code=$e,kt(Fe,ie)),delete this.outgoing[Y],this.outgoingStore.del(ie,kt),this.messageIdProvider.deallocate(Y),this._invokeStoreProcessingQueue();break}case"pubrec":{Oe={cmd:"pubrel",qos:2,messageId:Y};const $e=ie.reasonCode;$e&&$e>0&&$e!==16?(Fe=new Error("Publish error: "+z[$e]),Fe.code=$e,kt(Fe,ie)):this._sendPacket(Oe);break}case"suback":{delete this.outgoing[Y],this.messageIdProvider.deallocate(Y);for(let $e=0;$e<ie.granted.length;$e++)if(ie.granted[$e]&128){const Cn=this.messageIdToTopic[Y];Cn&&Cn.forEach(function(Lt){delete Dt._resubscribeTopics[Lt]})}this._invokeStoreProcessingQueue(),kt(null,ie);break}case"unsuback":{delete this.outgoing[Y],this.messageIdProvider.deallocate(Y),this._invokeStoreProcessingQueue(),kt(null);break}default:Dt.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},de.prototype._handlePubrel=function(ie,Y){w("handling pubrel packet"),Y=typeof Y<"u"?Y:Ce;const Ie=ie.messageId,Oe=this,kt={cmd:"pubcomp",messageId:Ie};Oe.incomingStore.get(ie,function(Dt,Fe){Dt?Oe._sendPacket(kt,Y):(Oe.emit("message",Fe.topic,Fe.payload,Fe),Oe.handleMessage(Fe,function($e){if($e)return Y($e);Oe.incomingStore.del(Fe,Ce),Oe._sendPacket(kt,Y)}))})},de.prototype._handleDisconnect=function(ie){this.emit("disconnect",ie)},de.prototype._nextId=function(){return this.messageIdProvider.allocate()},de.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},de.prototype._resubscribe=function(){w("_resubscribe");const ie=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&ie.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){w("_resubscribe: protocolVersion 5");for(let Y=0;Y<ie.length;Y++){const Ie={};Ie[ie[Y]]=this._resubscribeTopics[ie[Y]],Ie.resubscribe=!0,this.subscribe(Ie,{properties:Ie[ie[Y]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},de.prototype._onConnect=function(ie){if(this.disconnected){this.emit("connect",ie);return}const Y=this;this.connackPacket=ie,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function Ie(){let Oe=Y.outgoingStore.createStream();function kt(){Y._storeProcessing=!1,Y._packetIdsDuringStoreProcessing={}}Y.once("close",Dt),Oe.on("error",function($e){kt(),Y._flushStoreProcessingQueue(),Y.removeListener("close",Dt),Y.emit("error",$e)});function Dt(){Oe.destroy(),Oe=null,Y._flushStoreProcessingQueue(),kt()}function Fe(){if(!Oe)return;Y._storeProcessing=!0;const $e=Oe.read(1);let Cn;if(!$e){Oe.once("readable",Fe);return}if(Y._packetIdsDuringStoreProcessing[$e.messageId]){Fe();return}!Y.disconnecting&&!Y.reconnectTimer?(Cn=Y.outgoing[$e.messageId]?Y.outgoing[$e.messageId].cb:null,Y.outgoing[$e.messageId]={volatile:!1,cb:function(Lt,In){Cn&&Cn(Lt,In),Fe()}},Y._packetIdsDuringStoreProcessing[$e.messageId]=!0,Y.messageIdProvider.register($e.messageId)?Y._sendPacket($e):w("messageId: %d has already used.",$e.messageId)):Oe.destroy&&Oe.destroy()}Oe.on("end",function(){let $e=!0;for(const Cn in Y._packetIdsDuringStoreProcessing)if(!Y._packetIdsDuringStoreProcessing[Cn]){$e=!1;break}$e?(kt(),Y.removeListener("close",Dt),Y._invokeAllStoreProcessingQueue(),Y.emit("connect",ie)):Ie()}),Fe()}Ie()},de.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const ie=this._storeProcessingQueue[0];if(ie&&ie.invoke())return this._storeProcessingQueue.shift(),!0}return!1},de.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},de.prototype._flushStoreProcessingQueue=function(){for(const ie of this._storeProcessingQueue)ie.cbStorePut&&ie.cbStorePut(new Error("Connection closed")),ie.callback&&ie.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},o.exports=de}).call(this)}).call(this,i("_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(i,o,a){const{Buffer:u}=i("buffer"),c=i("readable-stream").Transform,f=i("duplexify");let d,p,h,g=!1;function v(){const b=new c;return b._write=function(T,w,x){d.sendSocketMessage({data:T.buffer,success:function(){x()},fail:function(){x(new Error)}})},b._flush=function(w){d.closeSocket({success:function(){w()}})},b}function y(b){b.hostname||(b.hostname="localhost"),b.path||(b.path="/"),b.wsOptions||(b.wsOptions={})}function A(b,T){const w=b.protocol==="alis"?"wss":"ws";let x=w+"://"+b.hostname+b.path;return b.port&&b.port!==80&&b.port!==443&&(x=w+"://"+b.hostname+":"+b.port+b.path),typeof b.transformWsUrl=="function"&&(x=b.transformWsUrl(x,b,T)),x}function _(){g||(g=!0,d.onSocketOpen(function(){h.setReadable(p),h.setWritable(p),h.emit("connect")}),d.onSocketMessage(function(b){if(typeof b.data=="string"){const T=u.from(b.data,"base64");p.push(T)}else{const T=new FileReader;T.addEventListener("load",function(){let w=T.result;w instanceof ArrayBuffer?w=u.from(w):w=u.from(w,"utf8"),p.push(w)}),T.readAsArrayBuffer(b.data)}}),d.onSocketClose(function(){h.end(),h.destroy()}),d.onSocketError(function(b){h.destroy(b)}))}function S(b,T){if(T.hostname=T.hostname||T.host,!T.hostname)throw new Error("Could not determine host. Specify host manually.");const w=T.protocolId==="MQIsdp"&&T.protocolVersion===3?"mqttv3.1":"mqtt";y(T);const x=A(T,b);return d=T.my,d.connectSocket({url:x,protocols:w}),p=v(),h=f.obj(),_(),h}o.exports=S},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(i,o,a){const u=i("net"),c=i("debug")("mqttjs:tcp");function f(d,p){p.port=p.port||1883,p.hostname=p.hostname||p.host||"localhost";const h=p.port,g=p.hostname;return c("port %d and host %s",h,g),u.createConnection(h,g)}o.exports=f},{debug:18,net:16}],4:[function(i,o,a){const u=i("tls"),c=i("net"),f=i("debug")("mqttjs:tls");function d(p,h){h.port=h.port||8883,h.host=h.hostname||h.host||"localhost",c.isIP(h.host)===0&&(h.servername=h.host),h.rejectUnauthorized=h.rejectUnauthorized!==!1,delete h.path,f("port %d host %s rejectUnauthorized %b",h.port,h.host,h.rejectUnauthorized);const g=u.connect(h);g.on("secureConnect",function(){h.rejectUnauthorized&&!g.authorized?g.emit("error",new Error("TLS not authorized")):g.removeListener("error",v)});function v(y){h.rejectUnauthorized&&p.emit("error",y),g.end()}return g.on("error",v),g}o.exports=d},{debug:18,net:16,tls:16}],5:[function(i,o,a){(function(u){(function(){const{Buffer:c}=i("buffer"),f=i("ws"),d=i("debug")("mqttjs:ws"),p=i("duplexify"),h=i("readable-stream").Transform,g=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],v=typeof u<"u"&&u.title==="browser"||typeof __webpack_require__=="function";function y(x,k){let M=x.protocol+"://"+x.hostname+":"+x.port+x.path;return typeof x.transformWsUrl=="function"&&(M=x.transformWsUrl(M,x,k)),M}function A(x){const k=x;return x.hostname||(k.hostname="localhost"),x.port||(x.protocol==="wss"?k.port=443:k.port=80),x.path||(k.path="/"),x.wsOptions||(k.wsOptions={}),!v&&x.protocol==="wss"&&g.forEach(function(M){Object.prototype.hasOwnProperty.call(x,M)&&!Object.prototype.hasOwnProperty.call(x.wsOptions,M)&&(k.wsOptions[M]=x[M])}),k}function _(x){const k=A(x);if(k.hostname||(k.hostname=k.host),!k.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const M=new URL(document.URL);k.hostname=M.hostname,k.port||(k.port=M.port)}return k.objectMode===void 0&&(k.objectMode=!(k.binary===!0||k.binary===void 0)),k}function S(x,k,M){d("createWebSocket"),d("protocol: "+M.protocolId+" "+M.protocolVersion);const D=M.protocolId==="MQIsdp"&&M.protocolVersion===3?"mqttv3.1":"mqtt";return d("creating new Websocket for url: "+k+" and protocol: "+D),new f(k,[D],M.wsOptions)}function b(x,k){const M=k.protocolId==="MQIsdp"&&k.protocolVersion===3?"mqttv3.1":"mqtt",D=y(k,x),z=new WebSocket(D,[M]);return z.binaryType="arraybuffer",z}function T(x,k){d("streamBuilder");const M=A(k),D=y(M,x),z=S(x,D,M),j=f.createWebSocketStream(z,M.wsOptions);return j.url=D,z.on("close",()=>{j.destroy()}),j}function w(x,k){d("browserStreamBuilder");let M;const z=_(k).browserBufferSize||1024*512,j=k.browserBufferTimeout||1e3,oe=!k.objectMode,L=b(x,k),F=ue(k,Ie,Oe);k.objectMode||(F._writev=Y),F.on("close",()=>{L.close()});const O=typeof L.addEventListener<"u";L.readyState===L.OPEN?M=F:(M=M=p(void 0,void 0,k),k.objectMode||(M._writev=Y),O?L.addEventListener("open",_e):L.onopen=_e),M.socket=L,O?(L.addEventListener("close",Ce),L.addEventListener("error",de),L.addEventListener("message",ie)):(L.onclose=Ce,L.onerror=de,L.onmessage=ie);function ue(kt,Dt,Fe){const $e=new h({objectModeMode:kt.objectMode});return $e._write=Dt,$e._flush=Fe,$e}function _e(){M.setReadable(F),M.setWritable(F),M.emit("connect")}function Ce(){M.end(),M.destroy()}function de(kt){M.destroy(kt)}function ie(kt){let Dt=kt.data;Dt instanceof ArrayBuffer?Dt=c.from(Dt):Dt=c.from(Dt,"utf8"),F.push(Dt)}function Y(kt,Dt){const Fe=new Array(kt.length);for(let $e=0;$e<kt.length;$e++)typeof kt[$e].chunk=="string"?Fe[$e]=c.from(kt[$e],"utf8"):Fe[$e]=kt[$e].chunk;this._write(c.concat(Fe),"binary",Dt)}function Ie(kt,Dt,Fe){L.bufferedAmount>z&&setTimeout(Ie,j,kt,Dt,Fe),oe&&typeof kt=="string"&&(kt=c.from(kt,"utf8"));try{L.send(kt)}catch($e){return Fe($e)}Fe()}function Oe(kt){L.close(),kt()}return M}v?o.exports=w:o.exports=T}).call(this)}).call(this,i("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(i,o,a){const{Buffer:u}=i("buffer"),c=i("readable-stream").Transform,f=i("duplexify");let d,p,h;function g(){const S=new c;return S._write=function(b,T,w){d.send({data:b.buffer,success:function(){w()},fail:function(x){w(new Error(x))}})},S._flush=function(T){d.close({success:function(){T()}})},S}function v(S){S.hostname||(S.hostname="localhost"),S.path||(S.path="/"),S.wsOptions||(S.wsOptions={})}function y(S,b){const T=S.protocol==="wxs"?"wss":"ws";let w=T+"://"+S.hostname+S.path;return S.port&&S.port!==80&&S.port!==443&&(w=T+"://"+S.hostname+":"+S.port+S.path),typeof S.transformWsUrl=="function"&&(w=S.transformWsUrl(w,S,b)),w}function A(){d.onOpen(function(){h.setReadable(p),h.setWritable(p),h.emit("connect")}),d.onMessage(function(S){let b=S.data;b instanceof ArrayBuffer?b=u.from(b):b=u.from(b,"utf8"),p.push(b)}),d.onClose(function(){h.end(),h.destroy()}),d.onError(function(S){h.destroy(new Error(S.errMsg))})}function _(S,b){if(b.hostname=b.hostname||b.host,!b.hostname)throw new Error("Could not determine host. Specify host manually.");const T=b.protocolId==="MQIsdp"&&b.protocolVersion===3?"mqttv3.1":"mqtt";v(b);const w=y(b,S);d=wx.connectSocket({url:w,protocols:[T]}),p=g(),h=f.obj(),h._destroy=function(k,M){d.close({success:function(){M&&M(k)}})};const x=h.destroy;return h.destroy=function(){h.destroy=x;const k=this;setTimeout(function(){d.close({fail:function(){k._destroy(new Error)}})},0)}.bind(h),A(),h}o.exports=_},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(i,o,a){function u(){if(!(this instanceof u))return new u;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}u.prototype.allocate=function(){const c=this.nextId++;return this.nextId===65536&&(this.nextId=1),c},u.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},u.prototype.register=function(c){return!0},u.prototype.deallocate=function(c){},u.prototype.clear=function(){},o.exports=u},{}],8:[function(i,o,a){const u=i("xtend"),c=i("readable-stream").Readable,f={objectMode:!0},d={clean:!0};function p(h){if(!(this instanceof p))return new p(h);this.options=h||{},this.options=u(d,h),this._inflights=new Map}p.prototype.put=function(h,g){return this._inflights.set(h.messageId,h),g&&g(),this},p.prototype.createStream=function(){const h=new c(f),g=[];let v=!1,y=0;return this._inflights.forEach(function(A,_){g.push(A)}),h._read=function(){!v&&y<g.length?this.push(g[y++]):this.push(null)},h.destroy=function(){if(v)return;const A=this;v=!0,setTimeout(function(){A.emit("close")},0)},h},p.prototype.del=function(h,g){return h=this._inflights.get(h.messageId),h?(this._inflights.delete(h.messageId),g(null,h)):g&&g(new Error("missing packet")),this},p.prototype.get=function(h,g){return h=this._inflights.get(h.messageId),h?g(null,h):g&&g(new Error("missing packet")),this},p.prototype.close=function(h){this.options.clean&&(this._inflights=null),h&&h()},o.exports=p},{"readable-stream":69,xtend:81}],9:[function(i,o,a){function u(c){if(!(this instanceof u))return new u(c);this.aliasToTopic={},this.max=c}u.prototype.put=function(c,f){return f===0||f>this.max?!1:(this.aliasToTopic[f]=c,this.length=Object.keys(this.aliasToTopic).length,!0)},u.prototype.getTopicByAlias=function(c){return this.aliasToTopic[c]},u.prototype.clear=function(){this.aliasToTopic={}},o.exports=u},{}],10:[function(i,o,a){const u=i("lru-cache"),c=i("number-allocator").NumberAllocator;function f(d){if(!(this instanceof f))return new f(d);d>0&&(this.aliasToTopic=new u({max:d}),this.topicToAlias={},this.numberAllocator=new c(1,d),this.max=d,this.length=0)}f.prototype.put=function(d,p){if(p===0||p>this.max)return!1;const h=this.aliasToTopic.get(p);return h&&delete this.topicToAlias[h],this.aliasToTopic.set(p,d),this.topicToAlias[d]=p,this.numberAllocator.use(p),this.length=this.aliasToTopic.length,!0},f.prototype.getTopicByAlias=function(d){return this.aliasToTopic.get(d)},f.prototype.getAliasByTopic=function(d){const p=this.topicToAlias[d];return typeof p<"u"&&this.aliasToTopic.get(p),p},f.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},f.prototype.getLruAlias=function(){const d=this.numberAllocator.firstVacant();return d||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},o.exports=f},{"lru-cache":37,"number-allocator":46}],11:[function(i,o,a){function u(f){const d=f.split("/");for(let p=0;p<d.length;p++)if(d[p]!=="+"){if(d[p]==="#")return p===d.length-1;if(d[p].indexOf("+")!==-1||d[p].indexOf("#")!==-1)return!1}return!0}function c(f){if(f.length===0)return"empty_topic_list";for(let d=0;d<f.length;d++)if(!u(f[d]))return f[d];return null}o.exports={validateTopics:c}},{}],12:[function(i,o,a){(function(u){(function(){const c=i("../client"),f=i("../store"),d=i("url"),p=i("xtend"),h=i("debug")("mqttjs"),g={};typeof u<"u"&&u.title!=="browser"||typeof __webpack_require__!="function"?(g.mqtt=i("./tcp"),g.tcp=i("./tcp"),g.ssl=i("./tls"),g.tls=i("./tls"),g.mqtts=i("./tls")):(g.wx=i("./wx"),g.wxs=i("./wx"),g.ali=i("./ali"),g.alis=i("./ali")),g.ws=i("./ws"),g.wss=i("./ws");function v(A){let _;A.auth&&(_=A.auth.match(/^(.+):(.+)$/),_?(A.username=_[1],A.password=_[2]):A.username=A.auth)}function y(A,_){if(h("connecting to an MQTT broker..."),typeof A=="object"&&!_&&(_=A,A=null),_=_||{},A){const T=d.parse(A,!0);if(T.port!=null&&(T.port=Number(T.port)),_=p(T,_),_.protocol===null)throw new Error("Missing protocol");_.protocol=_.protocol.replace(/:$/,"")}if(v(_),_.query&&typeof _.query.clientId=="string"&&(_.clientId=_.query.clientId),_.cert&&_.key)if(_.protocol){if(["mqtts","wss","wxs","alis"].indexOf(_.protocol)===-1)switch(_.protocol){case"mqtt":_.protocol="mqtts";break;case"ws":_.protocol="wss";break;case"wx":_.protocol="wxs";break;case"ali":_.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+_.protocol+'"!')}}else throw new Error("Missing secure protocol key");if(!g[_.protocol]){const T=["mqtts","wss"].indexOf(_.protocol)!==-1;_.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(w,x){return T&&x%2===0?!1:typeof g[w]=="function"})[0]}if(_.clean===!1&&!_.clientId)throw new Error("Missing clientId for unclean clients");_.protocol&&(_.defaultProtocol=_.protocol);function S(T){return _.servers&&((!T._reconnectCount||T._reconnectCount===_.servers.length)&&(T._reconnectCount=0),_.host=_.servers[T._reconnectCount].host,_.port=_.servers[T._reconnectCount].port,_.protocol=_.servers[T._reconnectCount].protocol?_.servers[T._reconnectCount].protocol:_.defaultProtocol,_.hostname=_.host,T._reconnectCount++),h("calling streambuilder for",_.protocol),g[_.protocol](T,_)}const b=new c(S,_);return b.on("error",function(){}),b}o.exports=y,o.exports.connect=y,o.exports.MqttClient=c,o.exports.Store=f}).call(this)}).call(this,i("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(i,o,a){a.byteLength=v,a.toByteArray=A,a.fromByteArray=b;for(var u=[],c=[],f=typeof Uint8Array<"u"?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,h=d.length;p<h;++p)u[p]=d[p],c[d.charCodeAt(p)]=p;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63;function g(T){var w=T.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var x=T.indexOf("=");x===-1&&(x=w);var k=x===w?0:4-x%4;return[x,k]}function v(T){var w=g(T),x=w[0],k=w[1];return(x+k)*3/4-k}function y(T,w,x){return(w+x)*3/4-x}function A(T){var w,x=g(T),k=x[0],M=x[1],D=new f(y(T,k,M)),z=0,j=M>0?k-4:k,oe;for(oe=0;oe<j;oe+=4)w=c[T.charCodeAt(oe)]<<18|c[T.charCodeAt(oe+1)]<<12|c[T.charCodeAt(oe+2)]<<6|c[T.charCodeAt(oe+3)],D[z++]=w>>16&255,D[z++]=w>>8&255,D[z++]=w&255;return M===2&&(w=c[T.charCodeAt(oe)]<<2|c[T.charCodeAt(oe+1)]>>4,D[z++]=w&255),M===1&&(w=c[T.charCodeAt(oe)]<<10|c[T.charCodeAt(oe+1)]<<4|c[T.charCodeAt(oe+2)]>>2,D[z++]=w>>8&255,D[z++]=w&255),D}function _(T){return u[T>>18&63]+u[T>>12&63]+u[T>>6&63]+u[T&63]}function S(T,w,x){for(var k,M=[],D=w;D<x;D+=3)k=(T[D]<<16&16711680)+(T[D+1]<<8&65280)+(T[D+2]&255),M.push(_(k));return M.join("")}function b(T){for(var w,x=T.length,k=x%3,M=[],D=16383,z=0,j=x-k;z<j;z+=D)M.push(S(T,z,z+D>j?j:z+D));return k===1?(w=T[x-1],M.push(u[w>>2]+u[w<<4&63]+"==")):k===2&&(w=(T[x-2]<<8)+T[x-1],M.push(u[w>>10]+u[w>>4&63]+u[w<<2&63]+"=")),M.join("")}},{}],14:[function(i,o,a){const{Buffer:u}=i("buffer"),c=Symbol.for("BufferList");function f(d){if(!(this instanceof f))return new f(d);f._init.call(this,d)}f._init=function(p){Object.defineProperty(this,c,{value:!0}),this._bufs=[],this.length=0,p&&this.append(p)},f.prototype._new=function(p){return new f(p)},f.prototype._offset=function(p){if(p===0)return[0,0];let h=0;for(let g=0;g<this._bufs.length;g++){const v=h+this._bufs[g].length;if(p<v||g===this._bufs.length-1)return[g,p-h];h=v}},f.prototype._reverseOffset=function(d){const p=d[0];let h=d[1];for(let g=0;g<p;g++)h+=this._bufs[g].length;return h},f.prototype.get=function(p){if(p>this.length||p<0)return;const h=this._offset(p);return this._bufs[h[0]][h[1]]},f.prototype.slice=function(p,h){return typeof p=="number"&&p<0&&(p+=this.length),typeof h=="number"&&h<0&&(h+=this.length),this.copy(null,0,p,h)},f.prototype.copy=function(p,h,g,v){if((typeof g!="number"||g<0)&&(g=0),(typeof v!="number"||v>this.length)&&(v=this.length),g>=this.length||v<=0)return p||u.alloc(0);const y=!!p,A=this._offset(g),_=v-g;let S=_,b=y&&h||0,T=A[1];if(g===0&&v===this.length){if(!y)return this._bufs.length===1?this._bufs[0]:u.concat(this._bufs,this.length);for(let w=0;w<this._bufs.length;w++)this._bufs[w].copy(p,b),b+=this._bufs[w].length;return p}if(S<=this._bufs[A[0]].length-T)return y?this._bufs[A[0]].copy(p,h,T,T+S):this._bufs[A[0]].slice(T,T+S);y||(p=u.allocUnsafe(_));for(let w=A[0];w<this._bufs.length;w++){const x=this._bufs[w].length-T;if(S>x)this._bufs[w].copy(p,b,T),b+=x;else{this._bufs[w].copy(p,b,T,T+S),b+=x;break}S-=x,T&&(T=0)}return p.length>b?p.slice(0,b):p},f.prototype.shallowSlice=function(p,h){if(p=p||0,h=typeof h!="number"?this.length:h,p<0&&(p+=this.length),h<0&&(h+=this.length),p===h)return this._new();const g=this._offset(p),v=this._offset(h),y=this._bufs.slice(g[0],v[0]+1);return v[1]===0?y.pop():y[y.length-1]=y[y.length-1].slice(0,v[1]),g[1]!==0&&(y[0]=y[0].slice(g[1])),this._new(y)},f.prototype.toString=function(p,h,g){return this.slice(h,g).toString(p)},f.prototype.consume=function(p){if(p=Math.trunc(p),Number.isNaN(p)||p<=0)return this;for(;this._bufs.length;)if(p>=this._bufs[0].length)p-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(p),this.length-=p;break}return this},f.prototype.duplicate=function(){const p=this._new();for(let h=0;h<this._bufs.length;h++)p.append(this._bufs[h]);return p},f.prototype.append=function(p){if(p==null)return this;if(p.buffer)this._appendBuffer(u.from(p.buffer,p.byteOffset,p.byteLength));else if(Array.isArray(p))for(let h=0;h<p.length;h++)this.append(p[h]);else if(this._isBufferList(p))for(let h=0;h<p._bufs.length;h++)this.append(p._bufs[h]);else typeof p=="number"&&(p=p.toString()),this._appendBuffer(u.from(p));return this},f.prototype._appendBuffer=function(p){this._bufs.push(p),this.length+=p.length},f.prototype.indexOf=function(d,p,h){if(h===void 0&&typeof p=="string"&&(h=p,p=void 0),typeof d=="function"||Array.isArray(d))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof d=="number"?d=u.from([d]):typeof d=="string"?d=u.from(d,h):this._isBufferList(d)?d=d.slice():Array.isArray(d.buffer)?d=u.from(d.buffer,d.byteOffset,d.byteLength):u.isBuffer(d)||(d=u.from(d)),p=Number(p||0),isNaN(p)&&(p=0),p<0&&(p=this.length+p),p<0&&(p=0),d.length===0)return p>this.length?this.length:p;const g=this._offset(p);let v=g[0],y=g[1];for(;v<this._bufs.length;v++){const A=this._bufs[v];for(;y<A.length;)if(A.length-y>=d.length){const S=A.indexOf(d,y);if(S!==-1)return this._reverseOffset([v,S]);y=A.length-d.length+1}else{const S=this._reverseOffset([v,y]);if(this._match(S,d))return S;y++}y=0}return-1},f.prototype._match=function(d,p){if(this.length-d<p.length)return!1;for(let h=0;h<p.length;h++)if(this.get(d+h)!==p[h])return!1;return!0},function(){const d={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 p in d)(function(h){d[h]===null?f.prototype[h]=function(g,v){return this.slice(g,g+v)[h](0,v)}:f.prototype[h]=function(g=0){return this.slice(g,g+d[h])[h](0)}})(p)}(),f.prototype._isBufferList=function(p){return p instanceof f||f.isBufferList(p)},f.isBufferList=function(p){return p!=null&&p[c]},o.exports=f},{buffer:17}],15:[function(i,o,a){const u=i("readable-stream").Duplex,c=i("inherits"),f=i("./BufferList");function d(p){if(!(this instanceof d))return new d(p);if(typeof p=="function"){this._callback=p;const h=function(v){this._callback&&(this._callback(v),this._callback=null)}.bind(this);this.on("pipe",function(v){v.on("error",h)}),this.on("unpipe",function(v){v.removeListener("error",h)}),p=null}f._init.call(this,p),u.call(this)}c(d,u),Object.assign(d.prototype,f.prototype),d.prototype._new=function(h){return new d(h)},d.prototype._write=function(h,g,v){this._appendBuffer(h),typeof v=="function"&&v()},d.prototype._read=function(h){if(!this.length)return this.push(null);h=Math.min(h,this.length),this.push(this.slice(0,h)),this.consume(h)},d.prototype.end=function(h){u.prototype.end.call(this,h),this._callback&&(this._callback(null,this.slice()),this._callback=null)},d.prototype._destroy=function(h,g){this._bufs.length=0,this.length=0,g(h)},d.prototype._isBufferList=function(h){return h instanceof d||h instanceof f||d.isBufferList(h)},d.isBufferList=f.isBufferList,o.exports=d,o.exports.BufferListStream=d,o.exports.BufferList=f},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(i,o,a){},{}],17:[function(i,o,a){(function(u){(function(){var c=i("base64-js"),f=i("ieee754");a.Buffer=g,a.SlowBuffer=k,a.INSPECT_MAX_BYTES=50;var d=2147483647;a.kMaxLength=d,g.TYPED_ARRAY_SUPPORT=p(),!g.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 p(){try{var re=new Uint8Array(1);return re.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},re.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}}),Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function h(re){if(re>d)throw new RangeError('The value "'+re+'" is invalid for option "size"');var V=new Uint8Array(re);return V.__proto__=g.prototype,V}function g(re,V,$){if(typeof re=="number"){if(typeof V=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _(re)}return v(re,V,$)}typeof Symbol<"u"&&Symbol.species!=null&&g[Symbol.species]===g&&Object.defineProperty(g,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),g.poolSize=8192;function v(re,V,$){if(typeof re=="string")return S(re,V);if(ArrayBuffer.isView(re))return b(re);if(re==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof re);if(ae(re,ArrayBuffer)||re&&ae(re.buffer,ArrayBuffer))return T(re,V,$);if(typeof re=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var he=re.valueOf&&re.valueOf();if(he!=null&&he!==re)return g.from(he,V,$);var Ue=w(re);if(Ue)return Ue;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof re[Symbol.toPrimitive]=="function")return g.from(re[Symbol.toPrimitive]("string"),V,$);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof re)}g.from=function(re,V,$){return v(re,V,$)},g.prototype.__proto__=Uint8Array.prototype,g.__proto__=Uint8Array;function y(re){if(typeof re!="number")throw new TypeError('"size" argument must be of type number');if(re<0)throw new RangeError('The value "'+re+'" is invalid for option "size"')}function A(re,V,$){return y(re),re<=0?h(re):V!==void 0?typeof $=="string"?h(re).fill(V,$):h(re).fill(V):h(re)}g.alloc=function(re,V,$){return A(re,V,$)};function _(re){return y(re),h(re<0?0:x(re)|0)}g.allocUnsafe=function(re){return _(re)},g.allocUnsafeSlow=function(re){return _(re)};function S(re,V){if((typeof V!="string"||V==="")&&(V="utf8"),!g.isEncoding(V))throw new TypeError("Unknown encoding: "+V);var $=M(re,V)|0,he=h($),Ue=he.write(re,V);return Ue!==$&&(he=he.slice(0,Ue)),he}function b(re){for(var V=re.length<0?0:x(re.length)|0,$=h(V),he=0;he<V;he+=1)$[he]=re[he]&255;return $}function T(re,V,$){if(V<0||re.byteLength<V)throw new RangeError('"offset" is outside of buffer bounds');if(re.byteLength<V+($||0))throw new RangeError('"length" is outside of buffer bounds');var he;return V===void 0&&$===void 0?he=new Uint8Array(re):$===void 0?he=new Uint8Array(re,V):he=new Uint8Array(re,V,$),he.__proto__=g.prototype,he}function w(re){if(g.isBuffer(re)){var V=x(re.length)|0,$=h(V);return $.length===0||re.copy($,0,0,V),$}if(re.length!==void 0)return typeof re.length!="number"||le(re.length)?h(0):b(re);if(re.type==="Buffer"&&Array.isArray(re.data))return b(re.data)}function x(re){if(re>=d)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d.toString(16)+" bytes");return re|0}function k(re){return+re!=re&&(re=0),g.alloc(+re)}g.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==g.prototype},g.compare=function(V,$){if(ae(V,Uint8Array)&&(V=g.from(V,V.offset,V.byteLength)),ae($,Uint8Array)&&($=g.from($,$.offset,$.byteLength)),!g.isBuffer(V)||!g.isBuffer($))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===$)return 0;for(var he=V.length,Ue=$.length,qe=0,jt=Math.min(he,Ue);qe<jt;++qe)if(V[qe]!==$[qe]){he=V[qe],Ue=$[qe];break}return he<Ue?-1:Ue<he?1:0},g.isEncoding=function(V){switch(String(V).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}},g.concat=function(V,$){if(!Array.isArray(V))throw new TypeError('"list" argument must be an Array of Buffers');if(V.length===0)return g.alloc(0);var he;if($===void 0)for($=0,he=0;he<V.length;++he)$+=V[he].length;var Ue=g.allocUnsafe($),qe=0;for(he=0;he<V.length;++he){var jt=V[he];if(ae(jt,Uint8Array)&&(jt=g.from(jt)),!g.isBuffer(jt))throw new TypeError('"list" argument must be an Array of Buffers');jt.copy(Ue,qe),qe+=jt.length}return Ue};function M(re,V){if(g.isBuffer(re))return re.length;if(ArrayBuffer.isView(re)||ae(re,ArrayBuffer))return re.byteLength;if(typeof re!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof re);var $=re.length,he=arguments.length>2&&arguments[2]===!0;if(!he&&$===0)return 0;for(var Ue=!1;;)switch(V){case"ascii":case"latin1":case"binary":return $;case"utf8":case"utf-8":return Ve(re).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $*2;case"hex":return $>>>1;case"base64":return Pt(re).length;default:if(Ue)return he?-1:Ve(re).length;V=(""+V).toLowerCase(),Ue=!0}}g.byteLength=M;function D(re,V,$){var he=!1;if((V===void 0||V<0)&&(V=0),V>this.length||(($===void 0||$>this.length)&&($=this.length),$<=0)||($>>>=0,V>>>=0,$<=V))return"";for(re||(re="utf8");;)switch(re){case"hex":return Dt(this,V,$);case"utf8":case"utf-8":return ie(this,V,$);case"ascii":return Oe(this,V,$);case"latin1":case"binary":return kt(this,V,$);case"base64":return de(this,V,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fe(this,V,$);default:if(he)throw new TypeError("Unknown encoding: "+re);re=(re+"").toLowerCase(),he=!0}}g.prototype._isBuffer=!0;function z(re,V,$){var he=re[V];re[V]=re[$],re[$]=he}g.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var $=0;$<V;$+=2)z(this,$,$+1);return this},g.prototype.swap32=function(){var V=this.length;if(V%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var $=0;$<V;$+=4)z(this,$,$+3),z(this,$+1,$+2);return this},g.prototype.swap64=function(){var V=this.length;if(V%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var $=0;$<V;$+=8)z(this,$,$+7),z(this,$+1,$+6),z(this,$+2,$+5),z(this,$+3,$+4);return this},g.prototype.toString=function(){var V=this.length;return V===0?"":arguments.length===0?ie(this,0,V):D.apply(this,arguments)},g.prototype.toLocaleString=g.prototype.toString,g.prototype.equals=function(V){if(!g.isBuffer(V))throw new TypeError("Argument must be a Buffer");return this===V?!0:g.compare(this,V)===0},g.prototype.inspect=function(){var V="",$=a.INSPECT_MAX_BYTES;return V=this.toString("hex",0,$).replace(/(.{2})/g,"$1 ").trim(),this.length>$&&(V+=" ... "),"<Buffer "+V+">"},g.prototype.compare=function(V,$,he,Ue,qe){if(ae(V,Uint8Array)&&(V=g.from(V,V.offset,V.byteLength)),!g.isBuffer(V))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if($===void 0&&($=0),he===void 0&&(he=V?V.length:0),Ue===void 0&&(Ue=0),qe===void 0&&(qe=this.length),$<0||he>V.length||Ue<0||qe>this.length)throw new RangeError("out of range index");if(Ue>=qe&&$>=he)return 0;if(Ue>=qe)return-1;if($>=he)return 1;if($>>>=0,he>>>=0,Ue>>>=0,qe>>>=0,this===V)return 0;for(var jt=qe-Ue,An=he-$,wn=Math.min(jt,An),En=this.slice(Ue,qe),xn=V.slice($,he),Tn=0;Tn<wn;++Tn)if(En[Tn]!==xn[Tn]){jt=En[Tn],An=xn[Tn];break}return jt<An?-1:An<jt?1:0};function j(re,V,$,he,Ue){if(re.length===0)return-1;if(typeof $=="string"?(he=$,$=0):$>2147483647?$=2147483647:$<-2147483648&&($=-2147483648),$=+$,le($)&&($=Ue?0:re.length-1),$<0&&($=re.length+$),$>=re.length){if(Ue)return-1;$=re.length-1}else if($<0)if(Ue)$=0;else return-1;if(typeof V=="string"&&(V=g.from(V,he)),g.isBuffer(V))return V.length===0?-1:oe(re,V,$,he,Ue);if(typeof V=="number")return V=V&255,typeof Uint8Array.prototype.indexOf=="function"?Ue?Uint8Array.prototype.indexOf.call(re,V,$):Uint8Array.prototype.lastIndexOf.call(re,V,$):oe(re,[V],$,he,Ue);throw new TypeError("val must be string, number or Buffer")}function oe(re,V,$,he,Ue){var qe=1,jt=re.length,An=V.length;if(he!==void 0&&(he=String(he).toLowerCase(),he==="ucs2"||he==="ucs-2"||he==="utf16le"||he==="utf-16le")){if(re.length<2||V.length<2)return-1;qe=2,jt/=2,An/=2,$/=2}function wn(kn,Rn){return qe===1?kn[Rn]:kn.readUInt16BE(Rn*qe)}var En;if(Ue){var xn=-1;for(En=$;En<jt;En++)if(wn(re,En)===wn(V,xn===-1?0:En-xn)){if(xn===-1&&(xn=En),En-xn+1===An)return xn*qe}else xn!==-1&&(En-=En-xn),xn=-1}else for($+An>jt&&($=jt-An),En=$;En>=0;En--){for(var Tn=!0,Pn=0;Pn<An;Pn++)if(wn(re,En+Pn)!==wn(V,Pn)){Tn=!1;break}if(Tn)return En}return-1}g.prototype.includes=function(V,$,he){return this.indexOf(V,$,he)!==-1},g.prototype.indexOf=function(V,$,he){return j(this,V,$,he,!0)},g.prototype.lastIndexOf=function(V,$,he){return j(this,V,$,he,!1)};function L(re,V,$,he){$=Number($)||0;var Ue=re.length-$;he?(he=Number(he),he>Ue&&(he=Ue)):he=Ue;var qe=V.length;he>qe/2&&(he=qe/2);for(var jt=0;jt<he;++jt){var An=parseInt(V.substr(jt*2,2),16);if(le(An))return jt;re[$+jt]=An}return jt}function F(re,V,$,he){return hn(Ve(V,re.length-$),re,$,he)}function O(re,V,$,he){return hn(xe(V),re,$,he)}function ue(re,V,$,he){return O(re,V,$,he)}function _e(re,V,$,he){return hn(Pt(V),re,$,he)}function Ce(re,V,$,he){return hn(ze(V,re.length-$),re,$,he)}g.prototype.write=function(V,$,he,Ue){if($===void 0)Ue="utf8",he=this.length,$=0;else if(he===void 0&&typeof $=="string")Ue=$,he=this.length,$=0;else if(isFinite($))$=$>>>0,isFinite(he)?(he=he>>>0,Ue===void 0&&(Ue="utf8")):(Ue=he,he=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var qe=this.length-$;if((he===void 0||he>qe)&&(he=qe),V.length>0&&(he<0||$<0)||$>this.length)throw new RangeError("Attempt to write outside buffer bounds");Ue||(Ue="utf8");for(var jt=!1;;)switch(Ue){case"hex":return L(this,V,$,he);case"utf8":case"utf-8":return F(this,V,$,he);case"ascii":return O(this,V,$,he);case"latin1":case"binary":return ue(this,V,$,he);case"base64":return _e(this,V,$,he);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ce(this,V,$,he);default:if(jt)throw new TypeError("Unknown encoding: "+Ue);Ue=(""+Ue).toLowerCase(),jt=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function de(re,V,$){return V===0&&$===re.length?c.fromByteArray(re):c.fromByteArray(re.slice(V,$))}function ie(re,V,$){$=Math.min(re.length,$);for(var he=[],Ue=V;Ue<$;){var qe=re[Ue],jt=null,An=qe>239?4:qe>223?3:qe>191?2:1;if(Ue+An<=$){var wn,En,xn,Tn;switch(An){case 1:qe<128&&(jt=qe);break;case 2:wn=re[Ue+1],(wn&192)===128&&(Tn=(qe&31)<<6|wn&63,Tn>127&&(jt=Tn));break;case 3:wn=re[Ue+1],En=re[Ue+2],(wn&192)===128&&(En&192)===128&&(Tn=(qe&15)<<12|(wn&63)<<6|En&63,Tn>2047&&(Tn<55296||Tn>57343)&&(jt=Tn));break;case 4:wn=re[Ue+1],En=re[Ue+2],xn=re[Ue+3],(wn&192)===128&&(En&192)===128&&(xn&192)===128&&(Tn=(qe&15)<<18|(wn&63)<<12|(En&63)<<6|xn&63,Tn>65535&&Tn<1114112&&(jt=Tn))}}jt===null?(jt=65533,An=1):jt>65535&&(jt-=65536,he.push(jt>>>10&1023|55296),jt=56320|jt&1023),he.push(jt),Ue+=An}return Ie(he)}var Y=4096;function Ie(re){var V=re.length;if(V<=Y)return String.fromCharCode.apply(String,re);for(var $="",he=0;he<V;)$+=String.fromCharCode.apply(String,re.slice(he,he+=Y));return $}function Oe(re,V,$){var he="";$=Math.min(re.length,$);for(var Ue=V;Ue<$;++Ue)he+=String.fromCharCode(re[Ue]&127);return he}function kt(re,V,$){var he="";$=Math.min(re.length,$);for(var Ue=V;Ue<$;++Ue)he+=String.fromCharCode(re[Ue]);return he}function Dt(re,V,$){var he=re.length;(!V||V<0)&&(V=0),(!$||$<0||$>he)&&($=he);for(var Ue="",qe=V;qe<$;++qe)Ue+=At(re[qe]);return Ue}function Fe(re,V,$){for(var he=re.slice(V,$),Ue="",qe=0;qe<he.length;qe+=2)Ue+=String.fromCharCode(he[qe]+he[qe+1]*256);return Ue}g.prototype.slice=function(V,$){var he=this.length;V=~~V,$=$===void 0?he:~~$,V<0?(V+=he,V<0&&(V=0)):V>he&&(V=he),$<0?($+=he,$<0&&($=0)):$>he&&($=he),$<V&&($=V);var Ue=this.subarray(V,$);return Ue.__proto__=g.prototype,Ue};function $e(re,V,$){if(re%1!==0||re<0)throw new RangeError("offset is not uint");if(re+V>$)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUIntLE=function(V,$,he){V=V>>>0,$=$>>>0,he||$e(V,$,this.length);for(var Ue=this[V],qe=1,jt=0;++jt<$&&(qe*=256);)Ue+=this[V+jt]*qe;return Ue},g.prototype.readUIntBE=function(V,$,he){V=V>>>0,$=$>>>0,he||$e(V,$,this.length);for(var Ue=this[V+--$],qe=1;$>0&&(qe*=256);)Ue+=this[V+--$]*qe;return Ue},g.prototype.readUInt8=function(V,$){return V=V>>>0,$||$e(V,1,this.length),this[V]},g.prototype.readUInt16LE=function(V,$){return V=V>>>0,$||$e(V,2,this.length),this[V]|this[V+1]<<8},g.prototype.readUInt16BE=function(V,$){return V=V>>>0,$||$e(V,2,this.length),this[V]<<8|this[V+1]},g.prototype.readUInt32LE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},g.prototype.readUInt32BE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},g.prototype.readIntLE=function(V,$,he){V=V>>>0,$=$>>>0,he||$e(V,$,this.length);for(var Ue=this[V],qe=1,jt=0;++jt<$&&(qe*=256);)Ue+=this[V+jt]*qe;return qe*=128,Ue>=qe&&(Ue-=Math.pow(2,8*$)),Ue},g.prototype.readIntBE=function(V,$,he){V=V>>>0,$=$>>>0,he||$e(V,$,this.length);for(var Ue=$,qe=1,jt=this[V+--Ue];Ue>0&&(qe*=256);)jt+=this[V+--Ue]*qe;return qe*=128,jt>=qe&&(jt-=Math.pow(2,8*$)),jt},g.prototype.readInt8=function(V,$){return V=V>>>0,$||$e(V,1,this.length),this[V]&128?(255-this[V]+1)*-1:this[V]},g.prototype.readInt16LE=function(V,$){V=V>>>0,$||$e(V,2,this.length);var he=this[V]|this[V+1]<<8;return he&32768?he|4294901760:he},g.prototype.readInt16BE=function(V,$){V=V>>>0,$||$e(V,2,this.length);var he=this[V+1]|this[V]<<8;return he&32768?he|4294901760:he},g.prototype.readInt32LE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},g.prototype.readInt32BE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},g.prototype.readFloatLE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),f.read(this,V,!0,23,4)},g.prototype.readFloatBE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),f.read(this,V,!1,23,4)},g.prototype.readDoubleLE=function(V,$){return V=V>>>0,$||$e(V,8,this.length),f.read(this,V,!0,52,8)},g.prototype.readDoubleBE=function(V,$){return V=V>>>0,$||$e(V,8,this.length),f.read(this,V,!1,52,8)};function Cn(re,V,$,he,Ue,qe){if(!g.isBuffer(re))throw new TypeError('"buffer" argument must be a Buffer instance');if(V>Ue||V<qe)throw new RangeError('"value" argument is out of bounds');if($+he>re.length)throw new RangeError("Index out of range")}g.prototype.writeUIntLE=function(V,$,he,Ue){if(V=+V,$=$>>>0,he=he>>>0,!Ue){var qe=Math.pow(2,8*he)-1;Cn(this,V,$,he,qe,0)}var jt=1,An=0;for(this[$]=V&255;++An<he&&(jt*=256);)this[$+An]=V/jt&255;return $+he},g.prototype.writeUIntBE=function(V,$,he,Ue){if(V=+V,$=$>>>0,he=he>>>0,!Ue){var qe=Math.pow(2,8*he)-1;Cn(this,V,$,he,qe,0)}var jt=he-1,An=1;for(this[$+jt]=V&255;--jt>=0&&(An*=256);)this[$+jt]=V/An&255;return $+he},g.prototype.writeUInt8=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,1,255,0),this[$]=V&255,$+1},g.prototype.writeUInt16LE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,2,65535,0),this[$]=V&255,this[$+1]=V>>>8,$+2},g.prototype.writeUInt16BE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,2,65535,0),this[$]=V>>>8,this[$+1]=V&255,$+2},g.prototype.writeUInt32LE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,4,4294967295,0),this[$+3]=V>>>24,this[$+2]=V>>>16,this[$+1]=V>>>8,this[$]=V&255,$+4},g.prototype.writeUInt32BE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,4,4294967295,0),this[$]=V>>>24,this[$+1]=V>>>16,this[$+2]=V>>>8,this[$+3]=V&255,$+4},g.prototype.writeIntLE=function(V,$,he,Ue){if(V=+V,$=$>>>0,!Ue){var qe=Math.pow(2,8*he-1);Cn(this,V,$,he,qe-1,-qe)}var jt=0,An=1,wn=0;for(this[$]=V&255;++jt<he&&(An*=256);)V<0&&wn===0&&this[$+jt-1]!==0&&(wn=1),this[$+jt]=(V/An>>0)-wn&255;return $+he},g.prototype.writeIntBE=function(V,$,he,Ue){if(V=+V,$=$>>>0,!Ue){var qe=Math.pow(2,8*he-1);Cn(this,V,$,he,qe-1,-qe)}var jt=he-1,An=1,wn=0;for(this[$+jt]=V&255;--jt>=0&&(An*=256);)V<0&&wn===0&&this[$+jt+1]!==0&&(wn=1),this[$+jt]=(V/An>>0)-wn&255;return $+he},g.prototype.writeInt8=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,1,127,-128),V<0&&(V=255+V+1),this[$]=V&255,$+1},g.prototype.writeInt16LE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,2,32767,-32768),this[$]=V&255,this[$+1]=V>>>8,$+2},g.prototype.writeInt16BE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,2,32767,-32768),this[$]=V>>>8,this[$+1]=V&255,$+2},g.prototype.writeInt32LE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,4,2147483647,-2147483648),this[$]=V&255,this[$+1]=V>>>8,this[$+2]=V>>>16,this[$+3]=V>>>24,$+4},g.prototype.writeInt32BE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,4,2147483647,-2147483648),V<0&&(V=4294967295+V+1),this[$]=V>>>24,this[$+1]=V>>>16,this[$+2]=V>>>8,this[$+3]=V&255,$+4};function Lt(re,V,$,he,Ue,qe){if($+he>re.length)throw new RangeError("Index out of range");if($<0)throw new RangeError("Index out of range")}function In(re,V,$,he,Ue){return V=+V,$=$>>>0,Ue||Lt(re,V,$,4),f.write(re,V,$,he,23,4),$+4}g.prototype.writeFloatLE=function(V,$,he){return In(this,V,$,!0,he)},g.prototype.writeFloatBE=function(V,$,he){return In(this,V,$,!1,he)};function Et(re,V,$,he,Ue){return V=+V,$=$>>>0,Ue||Lt(re,V,$,8),f.write(re,V,$,he,52,8),$+8}g.prototype.writeDoubleLE=function(V,$,he){return Et(this,V,$,!0,he)},g.prototype.writeDoubleBE=function(V,$,he){return Et(this,V,$,!1,he)},g.prototype.copy=function(V,$,he,Ue){if(!g.isBuffer(V))throw new TypeError("argument should be a Buffer");if(he||(he=0),!Ue&&Ue!==0&&(Ue=this.length),$>=V.length&&($=V.length),$||($=0),Ue>0&&Ue<he&&(Ue=he),Ue===he||V.length===0||this.length===0)return 0;if($<0)throw new RangeError("targetStart out of bounds");if(he<0||he>=this.length)throw new RangeError("Index out of range");if(Ue<0)throw new RangeError("sourceEnd out of bounds");Ue>this.length&&(Ue=this.length),V.length-$<Ue-he&&(Ue=V.length-$+he);var qe=Ue-he;if(this===V&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin($,he,Ue);else if(this===V&&he<$&&$<Ue)for(var jt=qe-1;jt>=0;--jt)V[jt+$]=this[jt+he];else Uint8Array.prototype.set.call(V,this.subarray(he,Ue),$);return qe},g.prototype.fill=function(V,$,he,Ue){if(typeof V=="string"){if(typeof $=="string"?(Ue=$,$=0,he=this.length):typeof he=="string"&&(Ue=he,he=this.length),Ue!==void 0&&typeof Ue!="string")throw new TypeError("encoding must be a string");if(typeof Ue=="string"&&!g.isEncoding(Ue))throw new TypeError("Unknown encoding: "+Ue);if(V.length===1){var qe=V.charCodeAt(0);(Ue==="utf8"&&qe<128||Ue==="latin1")&&(V=qe)}}else typeof V=="number"&&(V=V&255);if($<0||this.length<$||this.length<he)throw new RangeError("Out of range index");if(he<=$)return this;$=$>>>0,he=he===void 0?this.length:he>>>0,V||(V=0);var jt;if(typeof V=="number")for(jt=$;jt<he;++jt)this[jt]=V;else{var An=g.isBuffer(V)?V:g.from(V,Ue),wn=An.length;if(wn===0)throw new TypeError('The value "'+V+'" is invalid for argument "value"');for(jt=0;jt<he-$;++jt)this[jt+$]=An[jt%wn]}return this};var Ne=/[^+/0-9A-Za-z-_]/g;function pe(re){if(re=re.split("=")[0],re=re.trim().replace(Ne,""),re.length<2)return"";for(;re.length%4!==0;)re=re+"=";return re}function At(re){return re<16?"0"+re.toString(16):re.toString(16)}function Ve(re,V){V=V||1/0;for(var $,he=re.length,Ue=null,qe=[],jt=0;jt<he;++jt){if($=re.charCodeAt(jt),$>55295&&$<57344){if(!Ue){if($>56319){(V-=3)>-1&&qe.push(239,191,189);continue}else if(jt+1===he){(V-=3)>-1&&qe.push(239,191,189);continue}Ue=$;continue}if($<56320){(V-=3)>-1&&qe.push(239,191,189),Ue=$;continue}$=(Ue-55296<<10|$-56320)+65536}else Ue&&(V-=3)>-1&&qe.push(239,191,189);if(Ue=null,$<128){if((V-=1)<0)break;qe.push($)}else if($<2048){if((V-=2)<0)break;qe.push($>>6|192,$&63|128)}else if($<65536){if((V-=3)<0)break;qe.push($>>12|224,$>>6&63|128,$&63|128)}else if($<1114112){if((V-=4)<0)break;qe.push($>>18|240,$>>12&63|128,$>>6&63|128,$&63|128)}else throw new Error("Invalid code point")}return qe}function xe(re){for(var V=[],$=0;$<re.length;++$)V.push(re.charCodeAt($)&255);return V}function ze(re,V){for(var $,he,Ue,qe=[],jt=0;jt<re.length&&!((V-=2)<0);++jt)$=re.charCodeAt(jt),he=$>>8,Ue=$%256,qe.push(Ue),qe.push(he);return qe}function Pt(re){return c.toByteArray(pe(re))}function hn(re,V,$,he){for(var Ue=0;Ue<he&&!(Ue+$>=V.length||Ue>=re.length);++Ue)V[Ue+$]=re[Ue];return Ue}function ae(re,V){return re instanceof V||re!=null&&re.constructor!=null&&re.constructor.name!=null&&re.constructor.name===V.name}function le(re){return re!==re}}).call(this)}).call(this,i("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(i,o,a){(function(u){(function(){a.formatArgs=f,a.save=d,a.load=p,a.useColors=c,a.storage=h(),a.destroy=(()=>{let v=!1;return()=>{v||(v=!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`."))}})(),a.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 c(){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 f(v){if(v[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+v[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const y="color: "+this.color;v.splice(1,0,y,"color: inherit");let A=0,_=0;v[0].replace(/%[a-zA-Z%]/g,S=>{S!=="%%"&&(A++,S==="%c"&&(_=A))}),v.splice(_,0,y)}a.log=console.debug||console.log||(()=>{});function d(v){try{v?a.storage.setItem("debug",v):a.storage.removeItem("debug")}catch{}}function p(){let v;try{v=a.storage.getItem("debug")}catch{}return!v&&typeof u<"u"&&"env"in u&&(v=u.env.DEBUG),v}function h(){try{return localStorage}catch{}}o.exports=i("./common")(a);const{formatters:g}=o.exports;g.j=function(v){try{return JSON.stringify(v)}catch(y){return"[UnexpectedJSONParseError]: "+y.message}}}).call(this)}).call(this,i("_process"))},{"./common":19,_process:50}],19:[function(i,o,a){function u(c){d.debug=d,d.default=d,d.coerce=A,d.disable=g,d.enable=h,d.enabled=v,d.humanize=i("ms"),d.destroy=_,Object.keys(c).forEach(S=>{d[S]=c[S]}),d.names=[],d.skips=[],d.formatters={};function f(S){let b=0;for(let T=0;T<S.length;T++)b=(b<<5)-b+S.charCodeAt(T),b|=0;return d.colors[Math.abs(b)%d.colors.length]}d.selectColor=f;function d(S){let b,T=null,w,x;function k(...M){if(!k.enabled)return;const D=k,z=Number(new Date),j=z-(b||z);D.diff=j,D.prev=b,D.curr=z,b=z,M[0]=d.coerce(M[0]),typeof M[0]!="string"&&M.unshift("%O");let oe=0;M[0]=M[0].replace(/%([a-zA-Z%])/g,(F,O)=>{if(F==="%%")return"%";oe++;const ue=d.formatters[O];if(typeof ue=="function"){const _e=M[oe];F=ue.call(D,_e),M.splice(oe,1),oe--}return F}),d.formatArgs.call(D,M),(D.log||d.log).apply(D,M)}return k.namespace=S,k.useColors=d.useColors(),k.color=d.selectColor(S),k.extend=p,k.destroy=d.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>T!==null?T:(w!==d.namespaces&&(w=d.namespaces,x=d.enabled(S)),x),set:M=>{T=M}}),typeof d.init=="function"&&d.init(k),k}function p(S,b){const T=d(this.namespace+(typeof b>"u"?":":b)+S);return T.log=this.log,T}function h(S){d.save(S),d.namespaces=S,d.names=[],d.skips=[];let b;const T=(typeof S=="string"?S:"").split(/[\s,]+/),w=T.length;for(b=0;b<w;b++)T[b]&&(S=T[b].replace(/\*/g,".*?"),S[0]==="-"?d.skips.push(new RegExp("^"+S.substr(1)+"$")):d.names.push(new RegExp("^"+S+"$")))}function g(){const S=[...d.names.map(y),...d.skips.map(y).map(b=>"-"+b)].join(",");return d.enable(""),S}function v(S){if(S[S.length-1]==="*")return!0;let b,T;for(b=0,T=d.skips.length;b<T;b++)if(d.skips[b].test(S))return!1;for(b=0,T=d.names.length;b<T;b++)if(d.names[b].test(S))return!0;return!1}function y(S){return S.toString().substring(2,S.toString().length-2).replace(/\.\*\?$/,"*")}function A(S){return S instanceof Error?S.stack||S.message:S}function _(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return d.enable(d.load()),d}o.exports=u},{ms:45}],20:[function(i,o,a){(function(u,c){(function(){var f=i("readable-stream"),d=i("end-of-stream"),p=i("inherits"),h=i("stream-shift"),g=c.from&&c.from!==Uint8Array.from?c.from([0]):new c([0]),v=function(w,x){w._corked?w.once("uncork",x):x()},y=function(w,x){w._autoDestroy&&w.destroy(x)},A=function(w,x){return function(k){k?y(w,k.message==="premature close"?null:k):x&&!w._ended&&w.end()}},_=function(w,x){if(!w||w._writableState&&w._writableState.finished)return x();if(w._writableState)return w.end(x);w.end(),x()},S=function(){},b=function(w){return new f.Readable({objectMode:!0,highWaterMark:16}).wrap(w)},T=function(w,x,k){if(!(this instanceof T))return new T(w,x,k);f.Duplex.call(this,k),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!k||k.autoDestroy!==!1,this._forwardDestroy=!k||k.destroy!==!1,this._forwardEnd=!k||k.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,w&&this.setWritable(w),x&&this.setReadable(x)};p(T,f.Duplex),T.obj=function(w,x,k){return k||(k={}),k.objectMode=!0,k.highWaterMark=16,new T(w,x,k)},T.prototype.cork=function(){++this._corked===1&&this.emit("cork")},T.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},T.prototype.setWritable=function(w){if(this._unwrite&&this._unwrite(),this.destroyed){w&&w.destroy&&w.destroy();return}if(w===null||w===!1){this.end();return}var x=this,k=d(w,{writable:!0,readable:!1},A(this,this._forwardEnd)),M=function(){var z=x._ondrain;x._ondrain=null,z&&z()},D=function(){x._writable.removeListener("drain",M),k()};this._unwrite&&u.nextTick(M),this._writable=w,this._writable.on("drain",M),this._unwrite=D,this.uncork()},T.prototype.setReadable=function(w){if(this._unread&&this._unread(),this.destroyed){w&&w.destroy&&w.destroy();return}if(w===null||w===!1){this.push(null),this.resume();return}var x=this,k=d(w,{writable:!1,readable:!0},A(this)),M=function(){x._forward()},D=function(){x.push(null)},z=function(){x._readable2.removeListener("readable",M),x._readable2.removeListener("end",D),k()};this._drained=!0,this._readable=w,this._readable2=w._readableState?w:b(w),this._readable2.on("readable",M),this._readable2.on("end",D),this._unread=z,this._forward()},T.prototype._read=function(){this._drained=!0,this._forward()},T.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var w;this._drained&&(w=h(this._readable2))!==null;)this.destroyed||(this._drained=this.push(w));this._forwarding=!1}},T.prototype.destroy=function(w,x){if(x||(x=S),this.destroyed)return x(null);this.destroyed=!0;var k=this;u.nextTick(function(){k._destroy(w),x(null)})},T.prototype._destroy=function(w){if(w){var x=this._ondrain;this._ondrain=null,x?x(w):this.emit("error",w)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},T.prototype._write=function(w,x,k){if(!this.destroyed){if(this._corked)return v(this,this._write.bind(this,w,x,k));if(w===g)return this._finish(k);if(!this._writable)return k();this._writable.write(w)===!1?this._ondrain=k:this.destroyed||k()}},T.prototype._finish=function(w){var x=this;this.emit("preend"),v(this,function(){_(x._forwardEnd&&x._writable,function(){x._writableState.prefinished===!1&&(x._writableState.prefinished=!0),x.emit("prefinish"),v(x,w)})})},T.prototype.end=function(w,x,k){return typeof w=="function"?this.end(null,null,w):typeof x=="function"?this.end(w,null,x):(this._ended=!0,w&&this.write(w),!this._writableState.ending&&!this._writableState.destroyed&&this.write(g),f.Writable.prototype.end.call(this,k))},o.exports=T}).call(this)}).call(this,i("_process"),i("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(i,o,a){(function(u){(function(){var c=i("once"),f=function(){},d=function(g){return g.setHeader&&typeof g.abort=="function"},p=function(g){return g.stdio&&Array.isArray(g.stdio)&&g.stdio.length===3},h=function(g,v,y){if(typeof v=="function")return h(g,null,v);v||(v={}),y=c(y||f);var A=g._writableState,_=g._readableState,S=v.readable||v.readable!==!1&&g.readable,b=v.writable||v.writable!==!1&&g.writable,T=!1,w=function(){g.writable||x()},x=function(){b=!1,S||y.call(g)},k=function(){S=!1,b||y.call(g)},M=function(L){y.call(g,L?new Error("exited with error code: "+L):null)},D=function(L){y.call(g,L)},z=function(){u.nextTick(j)},j=function(){if(!T){if(S&&!(_&&_.ended&&!_.destroyed))return y.call(g,new Error("premature close"));if(b&&!(A&&A.ended&&!A.destroyed))return y.call(g,new Error("premature close"))}},oe=function(){g.req.on("finish",x)};return d(g)?(g.on("complete",x),g.on("abort",z),g.req?oe():g.on("request",oe)):b&&!A&&(g.on("end",w),g.on("close",w)),p(g)&&g.on("exit",M),g.on("end",k),g.on("finish",x),v.error!==!1&&g.on("error",D),g.on("close",z),function(){T=!0,g.removeListener("complete",x),g.removeListener("abort",z),g.removeListener("request",oe),g.req&&g.req.removeListener("finish",x),g.removeListener("end",w),g.removeListener("close",w),g.removeListener("finish",x),g.removeListener("exit",M),g.removeListener("end",k),g.removeListener("error",D),g.removeListener("close",z)}};o.exports=h}).call(this)}).call(this,i("_process"))},{_process:50,once:48}],22:[function(i,o,a){var u=Object.create||oe,c=Object.keys||L,f=Function.prototype.bind||F;function d(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=u(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}o.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0;var p=10,h;try{var g={};Object.defineProperty&&Object.defineProperty(g,"x",{value:0}),h=g.x===0}catch{h=!1}h?Object.defineProperty(d,"defaultMaxListeners",{enumerable:!0,get:function(){return p},set:function(O){if(typeof O!="number"||O<0||O!==O)throw new TypeError('"defaultMaxListeners" must be a positive number');p=O}}):d.defaultMaxListeners=p,d.prototype.setMaxListeners=function(ue){if(typeof ue!="number"||ue<0||isNaN(ue))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=ue,this};function v(O){return O._maxListeners===void 0?d.defaultMaxListeners:O._maxListeners}d.prototype.getMaxListeners=function(){return v(this)};function y(O,ue,_e){if(ue)O.call(_e);else for(var Ce=O.length,de=z(O,Ce),ie=0;ie<Ce;++ie)de[ie].call(_e)}function A(O,ue,_e,Ce){if(ue)O.call(_e,Ce);else for(var de=O.length,ie=z(O,de),Y=0;Y<de;++Y)ie[Y].call(_e,Ce)}function _(O,ue,_e,Ce,de){if(ue)O.call(_e,Ce,de);else for(var ie=O.length,Y=z(O,ie),Ie=0;Ie<ie;++Ie)Y[Ie].call(_e,Ce,de)}function S(O,ue,_e,Ce,de,ie){if(ue)O.call(_e,Ce,de,ie);else for(var Y=O.length,Ie=z(O,Y),Oe=0;Oe<Y;++Oe)Ie[Oe].call(_e,Ce,de,ie)}function b(O,ue,_e,Ce){if(ue)O.apply(_e,Ce);else for(var de=O.length,ie=z(O,de),Y=0;Y<de;++Y)ie[Y].apply(_e,Ce)}d.prototype.emit=function(ue){var _e,Ce,de,ie,Y,Ie,Oe=ue==="error";if(Ie=this._events,Ie)Oe=Oe&&Ie.error==null;else if(!Oe)return!1;if(Oe){if(arguments.length>1&&(_e=arguments[1]),_e instanceof Error)throw _e;var kt=new Error('Unhandled "error" event. ('+_e+")");throw kt.context=_e,kt}if(Ce=Ie[ue],!Ce)return!1;var Dt=typeof Ce=="function";switch(de=arguments.length,de){case 1:y(Ce,Dt,this);break;case 2:A(Ce,Dt,this,arguments[1]);break;case 3:_(Ce,Dt,this,arguments[1],arguments[2]);break;case 4:S(Ce,Dt,this,arguments[1],arguments[2],arguments[3]);break;default:for(ie=new Array(de-1),Y=1;Y<de;Y++)ie[Y-1]=arguments[Y];b(Ce,Dt,this,ie)}return!0};function T(O,ue,_e,Ce){var de,ie,Y;if(typeof _e!="function")throw new TypeError('"listener" argument must be a function');if(ie=O._events,ie?(ie.newListener&&(O.emit("newListener",ue,_e.listener?_e.listener:_e),ie=O._events),Y=ie[ue]):(ie=O._events=u(null),O._eventsCount=0),!Y)Y=ie[ue]=_e,++O._eventsCount;else if(typeof Y=="function"?Y=ie[ue]=Ce?[_e,Y]:[Y,_e]:Ce?Y.unshift(_e):Y.push(_e),!Y.warned&&(de=v(O),de&&de>0&&Y.length>de)){Y.warned=!0;var Ie=new Error("Possible EventEmitter memory leak detected. "+Y.length+' "'+String(ue)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');Ie.name="MaxListenersExceededWarning",Ie.emitter=O,Ie.type=ue,Ie.count=Y.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",Ie.name,Ie.message)}return O}d.prototype.addListener=function(ue,_e){return T(this,ue,_e,!1)},d.prototype.on=d.prototype.addListener,d.prototype.prependListener=function(ue,_e){return T(this,ue,_e,!0)};function w(){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 O=new Array(arguments.length),ue=0;ue<O.length;++ue)O[ue]=arguments[ue];this.listener.apply(this.target,O)}}function x(O,ue,_e){var Ce={fired:!1,wrapFn:void 0,target:O,type:ue,listener:_e},de=f.call(w,Ce);return de.listener=_e,Ce.wrapFn=de,de}d.prototype.once=function(ue,_e){if(typeof _e!="function")throw new TypeError('"listener" argument must be a function');return this.on(ue,x(this,ue,_e)),this},d.prototype.prependOnceListener=function(ue,_e){if(typeof _e!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(ue,x(this,ue,_e)),this},d.prototype.removeListener=function(ue,_e){var Ce,de,ie,Y,Ie;if(typeof _e!="function")throw new TypeError('"listener" argument must be a function');if(de=this._events,!de)return this;if(Ce=de[ue],!Ce)return this;if(Ce===_e||Ce.listener===_e)--this._eventsCount===0?this._events=u(null):(delete de[ue],de.removeListener&&this.emit("removeListener",ue,Ce.listener||_e));else if(typeof Ce!="function"){for(ie=-1,Y=Ce.length-1;Y>=0;Y--)if(Ce[Y]===_e||Ce[Y].listener===_e){Ie=Ce[Y].listener,ie=Y;break}if(ie<0)return this;ie===0?Ce.shift():D(Ce,ie),Ce.length===1&&(de[ue]=Ce[0]),de.removeListener&&this.emit("removeListener",ue,Ie||_e)}return this},d.prototype.removeAllListeners=function(ue){var _e,Ce,de;if(Ce=this._events,!Ce)return this;if(!Ce.removeListener)return arguments.length===0?(this._events=u(null),this._eventsCount=0):Ce[ue]&&(--this._eventsCount===0?this._events=u(null):delete Ce[ue]),this;if(arguments.length===0){var ie=c(Ce),Y;for(de=0;de<ie.length;++de)Y=ie[de],Y!=="removeListener"&&this.removeAllListeners(Y);return this.removeAllListeners("removeListener"),this._events=u(null),this._eventsCount=0,this}if(_e=Ce[ue],typeof _e=="function")this.removeListener(ue,_e);else if(_e)for(de=_e.length-1;de>=0;de--)this.removeListener(ue,_e[de]);return this};function k(O,ue,_e){var Ce=O._events;if(!Ce)return[];var de=Ce[ue];return de?typeof de=="function"?_e?[de.listener||de]:[de]:_e?j(de):z(de,de.length):[]}d.prototype.listeners=function(ue){return k(this,ue,!0)},d.prototype.rawListeners=function(ue){return k(this,ue,!1)},d.listenerCount=function(O,ue){return typeof O.listenerCount=="function"?O.listenerCount(ue):M.call(O,ue)},d.prototype.listenerCount=M;function M(O){var ue=this._events;if(ue){var _e=ue[O];if(typeof _e=="function")return 1;if(_e)return _e.length}return 0}d.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function D(O,ue){for(var _e=ue,Ce=_e+1,de=O.length;Ce<de;_e+=1,Ce+=1)O[_e]=O[Ce];O.pop()}function z(O,ue){for(var _e=new Array(ue),Ce=0;Ce<ue;++Ce)_e[Ce]=O[Ce];return _e}function j(O){for(var ue=new Array(O.length),_e=0;_e<ue.length;++_e)ue[_e]=O[_e].listener||O[_e];return ue}function oe(O){var ue=function(){};return ue.prototype=O,new ue}function L(O){for(var ue in O)Object.prototype.hasOwnProperty.call(O,ue);return ue}function F(O){var ue=this;return function(){return ue.apply(O,arguments)}}},{}],23:[function(i,o,a){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */a.read=function(u,c,f,d,p){var h,g,v=p*8-d-1,y=(1<<v)-1,A=y>>1,_=-7,S=f?p-1:0,b=f?-1:1,T=u[c+S];for(S+=b,h=T&(1<<-_)-1,T>>=-_,_+=v;_>0;h=h*256+u[c+S],S+=b,_-=8);for(g=h&(1<<-_)-1,h>>=-_,_+=d;_>0;g=g*256+u[c+S],S+=b,_-=8);if(h===0)h=1-A;else{if(h===y)return g?NaN:(T?-1:1)*(1/0);g=g+Math.pow(2,d),h=h-A}return(T?-1:1)*g*Math.pow(2,h-d)},a.write=function(u,c,f,d,p,h){var g,v,y,A=h*8-p-1,_=(1<<A)-1,S=_>>1,b=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=d?0:h-1,w=d?1:-1,x=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(v=isNaN(c)?1:0,g=_):(g=Math.floor(Math.log(c)/Math.LN2),c*(y=Math.pow(2,-g))<1&&(g--,y*=2),g+S>=1?c+=b/y:c+=b*Math.pow(2,1-S),c*y>=2&&(g++,y/=2),g+S>=_?(v=0,g=_):g+S>=1?(v=(c*y-1)*Math.pow(2,p),g=g+S):(v=c*Math.pow(2,S-1)*Math.pow(2,p),g=0));p>=8;u[f+T]=v&255,T+=w,v/=256,p-=8);for(g=g<<p|v,A+=p;A>0;u[f+T]=g&255,T+=w,g/=256,A-=8);u[f+T-w]|=x*128}},{}],24:[function(i,o,a){typeof Object.create=="function"?o.exports=function(c,f){f&&(c.super_=f,c.prototype=Object.create(f.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}))}:o.exports=function(c,f){if(f){c.super_=f;var d=function(){};d.prototype=f.prototype,c.prototype=new d,c.prototype.constructor=c}}},{}],25:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0});var u=function(){function c(f,d){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=f,this.value=d}return c.prototype.rotateLeft=function(){var f=this.parent,d=this.brother,p=this.leftChild,h=this.rightChild;if(!h)throw new Error("unknown error");var g=h.leftChild,v=h.rightChild;return f&&(f.leftChild===this?f.leftChild=h:f.rightChild===this&&(f.rightChild=h)),h.parent=f,h.brother=d,h.leftChild=this,h.rightChild=v,d&&(d.brother=h),this.parent=h,this.brother=v,this.leftChild=p,this.rightChild=g,v&&(v.parent=h,v.brother=this),p&&(p.parent=this,p.brother=g),g&&(g.parent=this,g.brother=p),h},c.prototype.rotateRight=function(){var f=this.parent,d=this.brother,p=this.leftChild;if(!p)throw new Error("unknown error");var h=this.rightChild,g=p.leftChild,v=p.rightChild;return f&&(f.leftChild===this?f.leftChild=p:f.rightChild===this&&(f.rightChild=p)),p.parent=f,p.brother=d,p.leftChild=g,p.rightChild=this,d&&(d.brother=p),g&&(g.parent=p,g.brother=this),this.parent=p,this.brother=g,this.leftChild=v,this.rightChild=h,v&&(v.parent=this,v.brother=h),h&&(h.parent=this,h.brother=v),p},c.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},c.TreeNodeColorType={red:!0,black:!1},c}();Object.freeze(u),a.default=u},{}],26:[function(i,o,a){var u=this&&this.__generator||function(f,d){var p={label:0,sent:function(){if(v[0]&1)throw v[1];return v[1]},trys:[],ops:[]},h,g,v,y;return y={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function A(S){return function(b){return _([S,b])}}function _(S){if(h)throw new TypeError("Generator is already executing.");for(;p;)try{if(h=1,g&&(v=S[0]&2?g.return:S[0]?g.throw||((v=g.return)&&v.call(g),0):g.next)&&!(v=v.call(g,S[1])).done)return v;switch(g=0,v&&(S=[S[0]&2,v.value]),S[0]){case 0:case 1:v=S;break;case 4:return p.label++,{value:S[1],done:!1};case 5:p.label++,g=S[1],S=[0];continue;case 7:S=p.ops.pop(),p.trys.pop();continue;default:if(v=p.trys,!(v=v.length>0&&v[v.length-1])&&(S[0]===6||S[0]===2)){p=0;continue}if(S[0]===3&&(!v||S[1]>v[0]&&S[1]<v[3])){p.label=S[1];break}if(S[0]===6&&p.label<v[1]){p.label=v[1],v=S;break}if(v&&p.label<v[2]){p.label=v[2],p.ops.push(S);break}v[2]&&p.ops.pop(),p.trys.pop();continue}S=d.call(f,p)}catch(b){S=[6,b],g=0}finally{h=v=0}if(S[0]&5)throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}};Object.defineProperty(a,"__esModule",{value:!0}),c.sigma=3,c.bucketSize=5e3;function c(f){var d=this;f===void 0&&(f=[]);var p=[],h=0,g=0,v=0,y=0,A=0,_=0;this.size=function(){return _},this.empty=function(){return _===0},this.clear=function(){h=v=g=y=A=_=0,b.call(this,c.bucketSize),_=0},this.front=function(){return p[h][g]},this.back=function(){return p[v][y]},this.forEach=function(T){if(!this.empty()){var w=0;if(h===v){for(var x=g;x<=y;++x)T(p[h][x],w++);return}for(var x=g;x<c.bucketSize;++x)T(p[h][x],w++);for(var x=h+1;x<v;++x)for(var k=0;k<c.bucketSize;++k)T(p[x][k],w++);for(var x=0;x<=y;++x)T(p[v][x],w++)}};var S=function(T){var w=h*c.bucketSize+g,x=w+T,k=v*c.bucketSize+y;if(x<w||x>k)throw new Error("pos should more than 0 and less than queue's size");var M=Math.floor(x/c.bucketSize),D=x%c.bucketSize;return{curNodeBucketIndex:M,curNodePointerIndex:D}};this.getElementByPos=function(T){var w=S(T),x=w.curNodeBucketIndex,k=w.curNodePointerIndex;return p[x][k]},this.eraseElementByPos=function(T){var w=this;if(T<0||T>_)throw new Error("pos should more than 0 and less than queue's size");if(T===0)this.popFront();else if(T===this.size())this.popBack();else{for(var x=[],k=T+1;k<_;++k)x.push(this.getElementByPos(k));this.cut(T),this.popBack(),x.forEach(function(M){return w.pushBack(M)})}},this.eraseElementByValue=function(T){if(!this.empty()){var w=[];this.forEach(function(M){M!==T&&w.push(M)});for(var x=w.length,k=0;k<x;++k)this.setElementByPos(k,w[k]);this.cut(x-1)}};var b=function(T){for(var w=[],x=T*c.sigma,k=Math.max(Math.ceil(x/c.bucketSize),2),M=0;M<k;++M)w.push(new Array(c.bucketSize));var D=Math.ceil(T/c.bucketSize),z=Math.floor(k/2)-Math.floor(D/2),j=z,oe=0;if(this.size())for(var M=0;M<D;++M){for(var L=0;L<c.bucketSize;++L)if(w[z+M][L]=this.front(),this.popFront(),this.empty()){j=z+M,oe=L;break}if(this.empty())break}p=w,h=z,g=0,v=j,y=oe,A=k,_=T};this.pushBack=function(T){this.empty()||(v===A-1&&y===c.bucketSize-1&&b.call(this,this.size()),y<c.bucketSize-1?++y:v<A-1&&(++v,y=0)),++_,p[v][y]=T},this.popBack=function(){this.empty()||(this.size()!==1&&(y>0?--y:h<v&&(--v,y=c.bucketSize-1)),_>0&&--_)},this.setElementByPos=function(T,w){var x=S(T),k=x.curNodeBucketIndex,M=x.curNodePointerIndex;p[k][M]=w},this.insert=function(T,w,x){var k=this;if(x===void 0&&(x=1),T===0)for(;x--;)this.pushFront(w);else if(T===this.size())for(;x--;)this.pushBack(w);else{for(var M=[],D=T;D<_;++D)M.push(this.getElementByPos(D));this.cut(T-1);for(var D=0;D<x;++D)this.pushBack(w);M.forEach(function(z){return k.pushBack(z)})}},this.find=function(T){if(h===v){for(var w=g;w<=y;++w)if(p[h][w]===T)return!0;return!1}for(var w=g;w<c.bucketSize;++w)if(p[h][w]===T)return!0;for(var w=h+1;w<v;++w)for(var x=0;x<c.bucketSize;++x)if(p[w][x]===T)return!0;for(var w=0;w<=y;++w)if(p[v][w]===T)return!0;return!1},this.reverse=function(){for(var T=0,w=_-1;T<w;){var x=this.getElementByPos(T);this.setElementByPos(T,this.getElementByPos(w)),this.setElementByPos(w,x),++T,--w}},this.unique=function(){if(!this.empty()){var T=[],w=this.front();this.forEach(function(k,M){(M===0||k!==w)&&(T.push(k),w=k)});for(var x=0;x<_;++x)this.setElementByPos(x,T[x]);this.cut(T.length-1)}},this.sort=function(T){var w=[];this.forEach(function(k){w.push(k)}),w.sort(T);for(var x=0;x<_;++x)this.setElementByPos(x,w[x])},this.pushFront=function(T){this.empty()||(h===0&&g===0&&b.call(this,this.size()),g>0?--g:h>0&&(--h,g=c.bucketSize-1)),++_,p[h][g]=T},this.popFront=function(){this.empty()||(this.size()!==1&&(g<c.bucketSize-1?++g:h<v&&(++h,g=0)),_>0&&--_)},this.shrinkToFit=function(){var T=this,w=[];this.forEach(function(D){w.push(D)});var x=w.length;p=[];for(var k=Math.ceil(x/c.bucketSize),M=0;M<k;++M)p.push(new Array(c.bucketSize));this.clear(),w.forEach(function(D){return T.pushBack(D)})},this.cut=function(T){if(T<0){this.clear();return}var w=S(T),x=w.curNodeBucketIndex,k=w.curNodePointerIndex;v=x,y=k,_=T+1},this[Symbol.iterator]=function(){return function(){var w,w,w,T,w;return u(this,function(x){switch(x.label){case 0:if(_===0)return[2];if(h!==v)return[3,5];w=g,x.label=1;case 1:return w<=y?[4,p[h][w]]:[3,4];case 2:x.sent(),x.label=3;case 3:return++w,[3,1];case 4:return[2];case 5:w=g,x.label=6;case 6:return w<c.bucketSize?[4,p[h][w]]:[3,9];case 7:x.sent(),x.label=8;case 8:return++w,[3,6];case 9:w=h+1,x.label=10;case 10:if(!(w<v))return[3,15];T=0,x.label=11;case 11:return T<c.bucketSize?[4,p[w][T]]:[3,14];case 12:x.sent(),x.label=13;case 13:return++T,[3,11];case 14:return++w,[3,10];case 15:w=0,x.label=16;case 16:return w<=y?[4,p[v][w]]:[3,19];case 17:x.sent(),x.label=18;case 18:return++w,[3,16];case 19:return[2]}})}()},function(){var T=c.bucketSize;f.size?T=f.size():f.length&&(T=f.length);var w=T*c.sigma;A=Math.ceil(w/c.bucketSize),A=Math.max(A,3);for(var x=0;x<A;++x)p.push(new Array(c.bucketSize));var k=Math.ceil(T/c.bucketSize);h=Math.floor(A/2)-Math.floor(k/2),v=h,f.forEach(function(M){return d.pushBack(M)})}(),Object.freeze(this)}Object.freeze(c),a.default=c},{}],27:[function(i,o,a){var u=this&&this.__generator||function(h,g){var v={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},y,A,_,S;return S={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function b(w){return function(x){return T([w,x])}}function T(w){if(y)throw new TypeError("Generator is already executing.");for(;v;)try{if(y=1,A&&(_=w[0]&2?A.return:w[0]?A.throw||((_=A.return)&&_.call(A),0):A.next)&&!(_=_.call(A,w[1])).done)return _;switch(A=0,_&&(w=[w[0]&2,_.value]),w[0]){case 0:case 1:_=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,A=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(_=v.trys,!(_=_.length>0&&_[_.length-1])&&(w[0]===6||w[0]===2)){v=0;continue}if(w[0]===3&&(!_||w[1]>_[0]&&w[1]<_[3])){v.label=w[1];break}if(w[0]===6&&v.label<_[1]){v.label=_[1],_=w;break}if(_&&v.label<_[2]){v.label=_[2],v.ops.push(w);break}_[2]&&v.ops.pop(),v.trys.pop();continue}w=g.call(h,v)}catch(x){w=[6,x],A=0}finally{y=_=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},c=this&&this.__values||function(h){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&h[g],y=0;if(v)return v.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&y>=h.length&&(h=void 0),{value:h&&h[y++],done:!h}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});var f=i("../LinkList/LinkList"),d=i("../Map/Map");p.initSize=16,p.maxSize=1<<30,p.sigma=.75,p.treeifyThreshold=8,p.untreeifyThreshold=6,p.minTreeifySize=64;function p(h,g,v){var y=this;if(h===void 0&&(h=[]),g===void 0&&(g=p.initSize),v=v||function(T){var w,x,k=0,M="";if(typeof T=="number")k=Math.floor(T),k=(k<<5)-k,k=k&k;else{typeof T!="string"?M=JSON.stringify(T):M=T;try{for(var D=c(M),z=D.next();!z.done;z=D.next()){var j=z.value,oe=j.charCodeAt(0);k=(k<<5)-k+oe,k=k&k}}catch(L){w={error:L}}finally{try{z&&!z.done&&(x=D.return)&&x.call(D)}finally{if(w)throw w.error}}}return k^=k>>>16,k},g&g-1)throw new Error("initBucketNum must be 2 to the power of n");var A=0,_=[],S=Math.max(p.initSize,Math.min(p.maxSize,g));this.size=function(){return A},this.empty=function(){return A===0},this.clear=function(){A=0,S=g,_=[]},this.forEach=function(T){var w=0;_.forEach(function(x){x.forEach(function(k){T(k,w++)})})};var b=function(T){if(!(T>=p.maxSize)){S=T*2;var w=[];_.forEach(function(x,k){if(!x.empty()){if(x instanceof f.default&&x.size()===1){var M=x.front(),D=M.key,z=M.value;w[v(D)&S-1]=new f.default([{key:D,value:z}])}else if(x instanceof d.default){var j=new f.default,oe=new f.default;x.forEach(function(O){var ue=v(O.key);ue&T?oe.pushBack(O):j.pushBack(O)}),j.size()>p.untreeifyThreshold?w[k]=new d.default(j):j.size()&&(w[k]=j),oe.size()>p.untreeifyThreshold?w[k+T]=new d.default(oe):oe.size()&&(w[k+T]=oe)}else{var L=new f.default,F=new f.default;x.forEach(function(O){var ue=v(O.key);ue&T?F.pushBack(O):L.pushBack(O)}),L.size()&&(w[k]=L),F.size()&&(w[k+T]=F)}_[k].clear()}}),_=w}};this.setElement=function(T,w){var x,k;if(T==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(w==null){this.eraseElementByKey(T);return}var M=v(T)&S-1;if(!_[M])++A,_[M]=new f.default([{key:T,value:w}]);else{var D=_[M].size();if(_[M]instanceof f.default){try{for(var z=c(_[M]),j=z.next();!j.done;j=z.next()){var oe=j.value;if(oe.key===T){oe.value=w;return}}}catch(F){x={error:F}}finally{try{j&&!j.done&&(k=z.return)&&k.call(z)}finally{if(x)throw x.error}}_[M].pushBack({key:T,value:w}),_[M].size()>=p.treeifyThreshold&&(_[M]=new d.default(_[M]))}else _[M].setElement(T,w);var L=_[M].size();A+=L-D}A>S*p.sigma&&b.call(this,S)},this.getElementByKey=function(T){var w,x,k=v(T)&S-1;if(_[k]){if(_[k]instanceof d.default)return _[k].getElementByKey(T);try{for(var M=c(_[k]),D=M.next();!D.done;D=M.next()){var z=D.value;if(z.key===T)return z.value}}catch(j){w={error:j}}finally{try{D&&!D.done&&(x=M.return)&&x.call(M)}finally{if(w)throw w.error}}}},this.eraseElementByKey=function(T){var w,x,k=v(T)&S-1;if(_[k]){var M=_[k].size();if(_[k]instanceof d.default)_[k].eraseElementByKey(T),_[k].size()<=p.untreeifyThreshold&&(_[k]=new f.default(_[k]));else{var D=-1;try{for(var z=c(_[k]),j=z.next();!j.done;j=z.next()){var oe=j.value;if(++D,oe.key===T){_[k].eraseElementByPos(D);break}}}catch(F){w={error:F}}finally{try{j&&!j.done&&(x=z.return)&&x.call(z)}finally{if(w)throw w.error}}}var L=_[k].size();A+=L-M}},this.find=function(T){var w,x,k=v(T)&S-1;if(!_[k])return!1;if(_[k]instanceof d.default)return _[k].find(T);try{for(var M=c(_[k]),D=M.next();!D.done;D=M.next()){var z=D.value;if(z.key===T)return!0}}catch(j){w={error:j}}finally{try{D&&!D.done&&(x=M.return)&&x.call(M)}finally{if(w)throw w.error}}return!1},this[Symbol.iterator]=function(){return function(){var T,w,x,k,M,D,z;return u(this,function(j){switch(j.label){case 0:T=0,j.label=1;case 1:if(!(T<S))return[3,10];for(;T<S&&!_[T];)++T;if(T>=S)return[3,10];j.label=2;case 2:j.trys.push([2,7,8,9]),w=(D=void 0,c(_[T])),x=w.next(),j.label=3;case 3:return x.done?[3,6]:(k=x.value,[4,k]);case 4:j.sent(),j.label=5;case 5:return x=w.next(),[3,3];case 6:return[3,9];case 7:return M=j.sent(),D={error:M},[3,9];case 8:try{x&&!x.done&&(z=w.return)&&z.call(w)}finally{if(D)throw D.error}return[7];case 9:return++T,[3,1];case 10:return[2]}})}()},h.forEach(function(T){var w=T.key,x=T.value;return y.setElement(w,x)}),Object.freeze(this)}Object.freeze(p),a.default=p},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(i,o,a){var u=this&&this.__generator||function(h,g){var v={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},y,A,_,S;return S={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function b(w){return function(x){return T([w,x])}}function T(w){if(y)throw new TypeError("Generator is already executing.");for(;v;)try{if(y=1,A&&(_=w[0]&2?A.return:w[0]?A.throw||((_=A.return)&&_.call(A),0):A.next)&&!(_=_.call(A,w[1])).done)return _;switch(A=0,_&&(w=[w[0]&2,_.value]),w[0]){case 0:case 1:_=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,A=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(_=v.trys,!(_=_.length>0&&_[_.length-1])&&(w[0]===6||w[0]===2)){v=0;continue}if(w[0]===3&&(!_||w[1]>_[0]&&w[1]<_[3])){v.label=w[1];break}if(w[0]===6&&v.label<_[1]){v.label=_[1],_=w;break}if(_&&v.label<_[2]){v.label=_[2],v.ops.push(w);break}_[2]&&v.ops.pop(),v.trys.pop();continue}w=g.call(h,v)}catch(x){w=[6,x],A=0}finally{y=_=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},c=this&&this.__values||function(h){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&h[g],y=0;if(v)return v.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&y>=h.length&&(h=void 0),{value:h&&h[y++],done:!h}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});var f=i("../Set/Set"),d=i("../LinkList/LinkList");p.initSize=16,p.maxSize=1<<30,p.sigma=.75,p.treeifyThreshold=8,p.untreeifyThreshold=6,p.minTreeifySize=64;function p(h,g,v){var y=this;if(h===void 0&&(h=[]),g===void 0&&(g=p.initSize),v=v||function(T){var w=0,x="";if(typeof T=="number")w=Math.floor(T),w=(w<<5)-w,w=w&w;else{typeof T!="string"?x=JSON.stringify(T):x=T;for(var k=0;k<x.length;k++){var M=x.charCodeAt(k);w=(w<<5)-w+M,w=w&w}}return w^=w>>>16,w},g&g-1)throw new Error("initBucketNum must be 2 to the power of n");var A=0,_=[],S=Math.max(p.initSize,Math.min(p.maxSize,g));this.size=function(){return A},this.empty=function(){return A===0},this.clear=function(){A=0,S=g,_=[]},this.forEach=function(T){var w=0;_.forEach(function(x){x.forEach(function(k){T(k,w++)})})};var b=function(T){if(!(T>=p.maxSize)){S=T*2;var w=[];_.forEach(function(x,k){if(!x.empty()){if(x instanceof d.default&&x.size()===1){var M=x.front();if(M===void 0)throw new Error("unknown error");w[v(M)&S-1]=new d.default([M])}else if(x instanceof f.default){var D=new d.default,z=new d.default;x.forEach(function(L){var F=v(L);F&T?z.pushBack(L):D.pushBack(L)}),D.size()>p.untreeifyThreshold?w[k]=new f.default(D):D.size()&&(w[k]=D),z.size()>p.untreeifyThreshold?w[k+T]=new f.default(z):z.size()&&(w[k+T]=z)}else{var j=new d.default,oe=new d.default;x.forEach(function(L){var F=v(L);F&T?oe.pushBack(L):j.pushBack(L)}),j.size()&&(w[k]=j),oe.size()&&(w[k+T]=oe)}_[k].clear()}}),_=w}};this.insert=function(T){if(T==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var w=v(T)&S-1;if(!_[w])_[w]=new d.default([T]),++A;else{var x=_[w].size();if(_[w]instanceof d.default){if(_[w].find(T))return;_[w].pushBack(T),_[w].size()>=p.treeifyThreshold&&(_[w]=new f.default(_[w]))}else _[w].insert(T);var k=_[w].size();A+=k-x}A>S*p.sigma&&b.call(this,S)},this.eraseElementByValue=function(T){var w=v(T)&S-1;if(_[w]){var x=_[w].size();_[w].eraseElementByValue(T),_[w]instanceof f.default&&_[w].size()<=p.untreeifyThreshold&&(_[w]=new d.default(_[w]));var k=_[w].size();A+=k-x}},this.find=function(T){var w=v(T)&S-1;return _[w]?_[w].find(T):!1},this[Symbol.iterator]=function(){return function(){var T,w,x,k,M,D,z;return u(this,function(j){switch(j.label){case 0:T=0,j.label=1;case 1:if(!(T<S))return[3,10];for(;T<S&&!_[T];)++T;if(T>=S)return[3,10];j.label=2;case 2:j.trys.push([2,7,8,9]),w=(D=void 0,c(_[T])),x=w.next(),j.label=3;case 3:return x.done?[3,6]:(k=x.value,[4,k]);case 4:j.sent(),j.label=5;case 5:return x=w.next(),[3,3];case 6:return[3,9];case 7:return M=j.sent(),D={error:M},[3,9];case 8:try{x&&!x.done&&(z=w.return)&&z.call(w)}finally{if(D)throw D.error}return[7];case 9:return++T,[3,1];case 10:return[2]}})}()},h.forEach(function(T){return y.insert(T)}),Object.freeze(this)}Object.freeze(p),a.default=p},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(i,o,a){var u=this&&this.__generator||function(d,p){var h={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},g,v,y,A;return A={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function _(b){return function(T){return S([b,T])}}function S(b){if(g)throw new TypeError("Generator is already executing.");for(;h;)try{if(g=1,v&&(y=b[0]&2?v.return:b[0]?v.throw||((y=v.return)&&y.call(v),0):v.next)&&!(y=y.call(v,b[1])).done)return y;switch(v=0,y&&(b=[b[0]&2,y.value]),b[0]){case 0:case 1:y=b;break;case 4:return h.label++,{value:b[1],done:!1};case 5:h.label++,v=b[1],b=[0];continue;case 7:b=h.ops.pop(),h.trys.pop();continue;default:if(y=h.trys,!(y=y.length>0&&y[y.length-1])&&(b[0]===6||b[0]===2)){h=0;continue}if(b[0]===3&&(!y||b[1]>y[0]&&b[1]<y[3])){h.label=b[1];break}if(b[0]===6&&h.label<y[1]){h.label=y[1],y=b;break}if(y&&h.label<y[2]){h.label=y[2],h.ops.push(b);break}y[2]&&h.ops.pop(),h.trys.pop();continue}b=p.call(d,h)}catch(T){b=[6,T],v=0}finally{g=y=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}};Object.defineProperty(a,"__esModule",{value:!0});var c=function(){function d(p){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=p}return d}();function f(d){var p=this;d===void 0&&(d=[]);var h=0,g=void 0,v=void 0;this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){g=v=void 0,h=0},this.front=function(){return g==null?void 0:g.value},this.back=function(){return v==null?void 0:v.value},this.forEach=function(y){for(var A=g,_=0;A;){if(A.value===void 0)throw new Error("unknown error");y(A.value,_++),A=A.next}},this.getElementByPos=function(y){if(y<0||y>=h)throw new Error("pos must more then 0 and less then the list length");for(var A=g;y--&&A;)A=A.next;if(!A||A.value===void 0)throw new Error("unknown error");return A.value},this.eraseElementByPos=function(y){if(y<0||y>=h)throw new Error("erase pos must more then 0 and less then the list length");if(y===0)this.popFront();else if(y===h-1)this.popBack();else{for(var A=g;y--;){if(!(A!=null&&A.next))throw new Error("unknown error");A=A.next}if(!A||!A.pre||!A.next)throw new Error("unknown error");var _=A.pre,S=A.next;S.pre=_,_.next=S,h>0&&--h}},this.eraseElementByValue=function(y){for(;g&&g.value===y;)this.popFront();for(;v&&v.value===y;)this.popBack();if(g)for(var A=g;A;){if(A.value===y){var _=A.pre,S=A.next;S&&(S.pre=_),_&&(_.next=S),h>0&&--h}A=A.next}},this.pushBack=function(y){if(y==null)throw new Error("you can't push null or undefined here");++h;var A=new c(y);v?(v.next=A,A.pre=v,v=A):g=v=A},this.popBack=function(){v&&(h>0&&--h,v&&(g===v?g=v=void 0:(v=v.pre,v&&(v.next=void 0))))},this.setElementByPos=function(y,A){if(A==null)throw new Error("you can't set null or undefined here");if(y<0||y>=h)throw new Error("pos must more then 0 and less then the list length");for(var _=g;y--;){if(!_)throw new Error("unknown error");_=_.next}_&&(_.value=A)},this.insert=function(y,A,_){if(_===void 0&&(_=1),A==null)throw new Error("you can't insert null or undefined here");if(y<0||y>h)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(_<0)throw new Error("insert size must more than 0");if(y===0)for(;_--;)this.pushFront(A);else if(y===h)for(;_--;)this.pushBack(A);else{for(var S=g,b=1;b<y;++b){if(!(S!=null&&S.next))throw new Error("unknown error");S=S==null?void 0:S.next}if(!S)throw new Error("unknown error");var T=S.next;for(h+=_;_--;)S.next=new c(A),S.next.pre=S,S=S.next;S.next=T,T&&(T.pre=S)}},this.find=function(y){for(var A=g;A;){if(A.value===y)return!0;A=A.next}return!1},this.reverse=function(){for(var y=g,A=v,_=0;y&&A&&_*2<h;){var S=y.value;y.value=A.value,A.value=S,y=y.next,A=A.pre,++_}},this.unique=function(){for(var y=g;y;){for(var A=y;A&&A.next&&A.value===A.next.value;)A=A.next,h>0&&--h;y.next=A.next,y.next&&(y.next.pre=y),y=y.next}},this.sort=function(y){var A=[];this.forEach(function(S){A.push(S)}),A.sort(y);var _=g;A.forEach(function(S){_&&(_.value=S,_=_.next)})},this.pushFront=function(y){if(y==null)throw new Error("you can't push null or undefined here");++h;var A=new c(y);g?(A.next=g,g.pre=A,g=A):g=v=A},this.popFront=function(){g&&(h>0&&--h,g&&(g===v?g=v=void 0:(g=g.next,g&&(g.pre=void 0))))},this.merge=function(y){var A=this,_=g;y.forEach(function(S){for(;_&&_.value!==void 0&&_.value<=S;)_=_.next;if(_===void 0)A.pushBack(S),_=v;else if(_===g)A.pushFront(S),_=g;else{++h;var b=_.pre;b&&(b.next=new c(S),b.next.pre=b,b.next.next=_,_&&(_.pre=b.next))}})},this[Symbol.iterator]=function(){return function(){var y;return u(this,function(A){switch(A.label){case 0:y=g,A.label=1;case 1:if(y===void 0)return[3,3];if(!y.value)throw new Error("unknown error");return[4,y.value];case 2:return A.sent(),y=y.next,[3,1];case 3:return[2]}})}()},d.forEach(function(y){return p.pushBack(y)}),Object.freeze(this)}Object.freeze(f),a.default=f},{}],30:[function(i,o,a){var u=this&&this.__generator||function(p,h){var g={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},v,y,A,_;return _={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function S(T){return function(w){return b([T,w])}}function b(T){if(v)throw new TypeError("Generator is already executing.");for(;g;)try{if(v=1,y&&(A=T[0]&2?y.return:T[0]?y.throw||((A=y.return)&&A.call(y),0):y.next)&&!(A=A.call(y,T[1])).done)return A;switch(y=0,A&&(T=[T[0]&2,A.value]),T[0]){case 0:case 1:A=T;break;case 4:return g.label++,{value:T[1],done:!1};case 5:g.label++,y=T[1],T=[0];continue;case 7:T=g.ops.pop(),g.trys.pop();continue;default:if(A=g.trys,!(A=A.length>0&&A[A.length-1])&&(T[0]===6||T[0]===2)){g=0;continue}if(T[0]===3&&(!A||T[1]>A[0]&&T[1]<A[3])){g.label=T[1];break}if(T[0]===6&&g.label<A[1]){g.label=A[1],A=T;break}if(A&&g.label<A[2]){g.label=A[2],g.ops.push(T);break}A[2]&&g.ops.pop(),g.trys.pop();continue}T=h.call(p,g)}catch(w){T=[6,w],y=0}finally{v=A=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},c=this&&this.__values||function(p){var h=typeof Symbol=="function"&&Symbol.iterator,g=h&&p[h],v=0;if(g)return g.call(p);if(p&&typeof p.length=="number")return{next:function(){return p&&v>=p.length&&(p=void 0),{value:p&&p[v++],done:!p}}};throw new TypeError(h?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});var f=i("../Base/TreeNode");function d(p,h){var g=this;p===void 0&&(p=[]),h=h||function(L,F){return L<F?-1:L>F?1:0};var v=0,y=new f.default;y.color=f.default.TreeNodeColorType.black,this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,y.key=y.value=void 0,y.leftChild=y.rightChild=y.brother=void 0};var A=function(L){if(!L||L.key===void 0)throw new Error("unknown error");return L.leftChild?A(L.leftChild):L},_=function(L){if(!L||L.key===void 0)throw new Error("unknown error");return L.rightChild?_(L.rightChild):L};this.front=function(){if(!this.empty()){var L=A(y);if(L.key===void 0||L.value===void 0)throw new Error("unknown error");return{key:L.key,value:L.value}}},this.back=function(){if(!this.empty()){var L=_(y);if(L.key===void 0||L.value===void 0)throw new Error("unknown error");return{key:L.key,value:L.value}}},this.forEach=function(L){var F,O,ue=0;try{for(var _e=c(this),Ce=_e.next();!Ce.done;Ce=_e.next()){var de=Ce.value;L(de,ue++)}}catch(ie){F={error:ie}}finally{try{Ce&&!Ce.done&&(O=_e.return)&&O.call(_e)}finally{if(F)throw F.error}}},this.getElementByPos=function(L){var F,O;if(L<0||L>=this.size())throw new Error("pos must more than 0 and less than set's size");var ue=0;try{for(var _e=c(this),Ce=_e.next();!Ce.done;Ce=_e.next()){var de=Ce.value;if(ue===L)return de;++ue}}catch(ie){F={error:ie}}finally{try{Ce&&!Ce.done&&(O=_e.return)&&O.call(_e)}finally{if(F)throw F.error}}throw new Error("unknown Error")};var S=function(L,F){if(!(!L||L.key===void 0||L.value===void 0)){var O=h(L.key,F);return O===0?{key:L.key,value:L.value}:O<0?S(L.rightChild,F):S(L.leftChild,F)||{key:L.key,value:L.value}}};this.lowerBound=function(L){return S(y,L)};var b=function(L,F){if(!(!L||L.key===void 0||L.value===void 0)){var O=h(L.key,F);return O<=0?b(L.rightChild,F):b(L.leftChild,F)||{key:L.key,value:L.value}}};this.upperBound=function(L){return b(y,L)};var T=function(L,F){if(!(!L||L.key===void 0||L.value===void 0)){var O=h(L.key,F);return O===0?{key:L.key,value:L.value}:O>0?T(L.leftChild,F):T(L.rightChild,F)||{key:L.key,value:L.value}}};this.reverseLowerBound=function(L){return T(y,L)};var w=function(L,F){if(!(!L||L.key===void 0||L.value===void 0)){var O=h(L.key,F);return O>=0?w(L.leftChild,F):w(L.rightChild,F)||{key:L.key,value:L.value}}};this.reverseUpperBound=function(L){return w(y,L)};var x=function(L){var F=L.parent;if(!F){if(L===y)return;throw new Error("unknown error")}if(L.color===f.default.TreeNodeColorType.red){L.color=f.default.TreeNodeColorType.black;return}var O=L.brother;if(!O)throw new Error("unknown error");if(L===F.leftChild){if(O.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.black,F.color=f.default.TreeNodeColorType.red;var ue=F.rotateLeft();y===F&&(y=ue),x(L)}else if(O.color===f.default.TreeNodeColorType.black)if(O.rightChild&&O.rightChild.color===f.default.TreeNodeColorType.red){O.color=F.color,F.color=f.default.TreeNodeColorType.black,O.rightChild&&(O.rightChild.color=f.default.TreeNodeColorType.black);var ue=F.rotateLeft();y===F&&(y=ue),L.color=f.default.TreeNodeColorType.black}else if((!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&O.leftChild&&O.leftChild.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.red,O.leftChild&&(O.leftChild.color=f.default.TreeNodeColorType.black);var ue=O.rotateRight();y===O&&(y=ue),x(L)}else(!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&(!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&(O.color=f.default.TreeNodeColorType.red,x(F))}else if(L===F.rightChild){if(O.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.black,F.color=f.default.TreeNodeColorType.red;var ue=F.rotateRight();y===F&&(y=ue),x(L)}else if(O.color===f.default.TreeNodeColorType.black)if(O.leftChild&&O.leftChild.color===f.default.TreeNodeColorType.red){O.color=F.color,F.color=f.default.TreeNodeColorType.black,O.leftChild&&(O.leftChild.color=f.default.TreeNodeColorType.black);var ue=F.rotateRight();y===F&&(y=ue),L.color=f.default.TreeNodeColorType.black}else if((!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&O.rightChild&&O.rightChild.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.red,O.rightChild&&(O.rightChild.color=f.default.TreeNodeColorType.black);var ue=O.rotateLeft();y===O&&(y=ue),x(L)}else(!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&(!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&(O.color=f.default.TreeNodeColorType.red,x(F))}},k=function(L){for(var F=L;F.leftChild||F.rightChild;){if(F.rightChild){F=A(F.rightChild);var O=L.key;L.key=F.key,F.key=O;var ue=L.value;L.value=F.value,F.value=ue,L=F}if(F.leftChild){F=_(F.leftChild);var O=L.key;L.key=F.key,F.key=O;var ue=L.value;L.value=F.value,F.value=ue,L=F}}x(F),F&&F.remove(),--v,y.color=f.default.TreeNodeColorType.black},M=function(L,F){if(!L||L.key===void 0)return!1;var O=M(L.leftChild,F);return O||F(L)?!0:M(L.rightChild,F)};this.eraseElementByPos=function(L){if(L<0||L>=v)throw new Error("pos must more than 0 and less than set's size");var F=0;M(y,function(O){return L===F?(k(O),!0):(++F,!1)})},this.eraseElementByKey=function(L){if(!this.empty()){var F=j(y,L);F===void 0||F.key===void 0||h(F.key,L)!==0||k(F)}};var D=function(L,F){if(!L||L.key===void 0)throw new Error("unknown error");var O=h(F,L.key);return O<0?L.leftChild?D(L.leftChild,F):(L.leftChild=new f.default,L.leftChild.parent=L,L.leftChild.brother=L.rightChild,L.rightChild&&(L.rightChild.brother=L.leftChild),L.leftChild):O>0?L.rightChild?D(L.rightChild,F):(L.rightChild=new f.default,L.rightChild.parent=L,L.rightChild.brother=L.leftChild,L.leftChild&&(L.leftChild.brother=L.rightChild),L.rightChild):L},z=function(L){var F=L.parent;if(!F){if(L===y)return;throw new Error("unknown error")}if(F.color!==f.default.TreeNodeColorType.black&&F.color===f.default.TreeNodeColorType.red){var O=F.brother,ue=F.parent;if(!ue)throw new Error("unknown error");if(O&&O.color===f.default.TreeNodeColorType.red)O.color=F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red,z(ue);else if(!O||O.color===f.default.TreeNodeColorType.black){if(F===ue.leftChild){if(L===F.leftChild){F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red;var _e=ue.rotateRight();ue===y&&(y=_e)}else if(L===F.rightChild){var _e=F.rotateLeft();ue===y&&(y=_e),z(F)}}else if(F===ue.rightChild){if(L===F.leftChild){var _e=F.rotateRight();ue===y&&(y=_e),z(F)}else if(L===F.rightChild){F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red;var _e=ue.rotateLeft();ue===y&&(y=_e)}}}}};this.setElement=function(L,F){if(L==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(F==null){this.eraseElementByKey(L);return}if(this.empty()){++v,y.key=L,y.value=F,y.color=f.default.TreeNodeColorType.black;return}var O=D(y,L);if(O.key!==void 0&&h(O.key,L)===0){O.value=F;return}++v,O.key=L,O.value=F,z(O),y.color=f.default.TreeNodeColorType.black};var j=function(L,F){if(!(!L||L.key===void 0)){var O=h(F,L.key);return O<0?j(L.leftChild,F):O>0?j(L.rightChild,F):L}};this.find=function(L){return!!j(y,L)},this.getElementByKey=function(L){var F=j(y,L);if((F==null?void 0:F.key)===void 0||(F==null?void 0:F.value)===void 0)throw new Error("unknown error");return F.value},this.union=function(L){var F=this;L.forEach(function(O){var ue=O.key,_e=O.value;return F.setElement(ue,_e)})},this.getHeight=function(){if(this.empty())return 0;var L=function(F){return F?Math.max(L(F.leftChild),L(F.rightChild))+1:1};return L(y)};var oe=function(L){return u(this,function(F){switch(F.label){case 0:return!L||L.key===void 0||L.value===void 0?[2]:[5,c(oe(L.leftChild))];case 1:return F.sent(),[4,{key:L.key,value:L.value}];case 2:return F.sent(),[5,c(oe(L.rightChild))];case 3:return F.sent(),[2]}})};this[Symbol.iterator]=function(){return oe(y)},p.forEach(function(L){var F=L.key,O=L.value;return g.setElement(F,O)}),Object.freeze(this)}Object.freeze(d),a.default=d},{"../Base/TreeNode":25}],31:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0});function u(c,f){c===void 0&&(c=[]),f=f||function(v,y){return v>y?-1:v<y?1:0};var d=[];c.forEach(function(v){return d.push(v)});var p=d.length,h=function(v,y){if(v<0||v>=p)throw new Error("unknown error");if(y<0||y>=p)throw new Error("unknown error");var A=d[v];d[v]=d[y],d[y]=A},g=function(v){if(v<0||v>=p)throw new Error("unknown error");var y=v*2+1,A=v*2+2;y<p&&f(d[v],d[y])>0&&h(v,y),A<p&&f(d[v],d[A])>0&&h(v,A)};(function(){for(var v=Math.floor((p-1)/2);v>=0;--v)for(var y=v,A=y*2+1;A<p;){var _=A,S=_+1,b=_;if(S<p&&f(d[_],d[S])>0&&(b=S),f(d[y],d[b])<=0)break;h(y,b),y=b,A=y*2+1}})(),this.size=function(){return p},this.empty=function(){return p===0},this.clear=function(){p=0,d.length=0},this.push=function(v){if(d.push(v),++p,p!==1)for(var y=p-1;y>0;){var A=Math.floor((y-1)/2);if(f(d[A],v)<=0)break;g(A),y=A}},this.pop=function(){if(!this.empty()){if(this.size()===1){--p;return}var v=d[p-1];--p;for(var y=0;y<this.size();){var A=y*2+1,_=y*2+2;if(A>=this.size())break;var S=A;if(_<this.size()&&f(d[A],d[_])>0&&(S=_),f(d[S],v)>=0)break;d[y]=d[S],y=S}d[y]=v}},this.top=function(){return d[0]},Object.freeze(this)}Object.freeze(u),a.default=u},{}],32:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0});var u=i("../LinkList/LinkList");function c(f){f===void 0&&(f=[]);var d=new u.default(f);this.size=function(){return d.size()},this.empty=function(){return d.empty()},this.clear=function(){d.clear()},this.push=function(p){d.pushBack(p)},this.pop=function(){d.popFront()},this.front=function(){return d.front()},Object.freeze(this)}Object.freeze(c),a.default=c},{"../LinkList/LinkList":29}],33:[function(i,o,a){var u=this&&this.__generator||function(p,h){var g={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},v,y,A,_;return _={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function S(T){return function(w){return b([T,w])}}function b(T){if(v)throw new TypeError("Generator is already executing.");for(;g;)try{if(v=1,y&&(A=T[0]&2?y.return:T[0]?y.throw||((A=y.return)&&A.call(y),0):y.next)&&!(A=A.call(y,T[1])).done)return A;switch(y=0,A&&(T=[T[0]&2,A.value]),T[0]){case 0:case 1:A=T;break;case 4:return g.label++,{value:T[1],done:!1};case 5:g.label++,y=T[1],T=[0];continue;case 7:T=g.ops.pop(),g.trys.pop();continue;default:if(A=g.trys,!(A=A.length>0&&A[A.length-1])&&(T[0]===6||T[0]===2)){g=0;continue}if(T[0]===3&&(!A||T[1]>A[0]&&T[1]<A[3])){g.label=T[1];break}if(T[0]===6&&g.label<A[1]){g.label=A[1],A=T;break}if(A&&g.label<A[2]){g.label=A[2],g.ops.push(T);break}A[2]&&g.ops.pop(),g.trys.pop();continue}T=h.call(p,g)}catch(w){T=[6,w],y=0}finally{v=A=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},c=this&&this.__values||function(p){var h=typeof Symbol=="function"&&Symbol.iterator,g=h&&p[h],v=0;if(g)return g.call(p);if(p&&typeof p.length=="number")return{next:function(){return p&&v>=p.length&&(p=void 0),{value:p&&p[v++],done:!p}}};throw new TypeError(h?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});var f=i("../Base/TreeNode");function d(p,h){var g=this;p===void 0&&(p=[]),h=h||function(L,F){return L<F?-1:L>F?1:0};var v=0,y=new f.default;y.color=f.default.TreeNodeColorType.black,this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,y.key=void 0,y.leftChild=y.rightChild=y.brother=y.parent=void 0,y.color=f.default.TreeNodeColorType.black};var A=function(L){if(!L||L.key===void 0)throw new Error("unknown error");return L.leftChild?A(L.leftChild):L},_=function(L){if(!L||L.key===void 0)throw new Error("unknown error");return L.rightChild?_(L.rightChild):L};this.front=function(){if(!this.empty()){var L=A(y);return L.key}},this.back=function(){if(!this.empty()){var L=_(y);return L.key}},this.forEach=function(L){var F,O,ue=0;try{for(var _e=c(this),Ce=_e.next();!Ce.done;Ce=_e.next()){var de=Ce.value;L(de,ue++)}}catch(ie){F={error:ie}}finally{try{Ce&&!Ce.done&&(O=_e.return)&&O.call(_e)}finally{if(F)throw F.error}}},this.getElementByPos=function(L){var F,O;if(L<0||L>=this.size())throw new Error("pos must more than 0 and less than set's size");var ue=0;try{for(var _e=c(this),Ce=_e.next();!Ce.done;Ce=_e.next()){var de=Ce.value;if(ue===L)return de;++ue}}catch(ie){F={error:ie}}finally{try{Ce&&!Ce.done&&(O=_e.return)&&O.call(_e)}finally{if(F)throw F.error}}throw new Error("unknown error")};var S=function(L){var F=L.parent;if(!F){if(L===y)return;throw new Error("unknown error")}if(L.color===f.default.TreeNodeColorType.red){L.color=f.default.TreeNodeColorType.black;return}var O=L.brother;if(!O)throw new Error("unknown error");if(L===F.leftChild){if(O.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.black,F.color=f.default.TreeNodeColorType.red;var ue=F.rotateLeft();y===F&&(y=ue),S(L)}else if(O.color===f.default.TreeNodeColorType.black)if(O.rightChild&&O.rightChild.color===f.default.TreeNodeColorType.red){O.color=F.color,F.color=f.default.TreeNodeColorType.black,O.rightChild&&(O.rightChild.color=f.default.TreeNodeColorType.black);var ue=F.rotateLeft();y===F&&(y=ue),L.color=f.default.TreeNodeColorType.black}else if((!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&O.leftChild&&O.leftChild.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.red,O.leftChild&&(O.leftChild.color=f.default.TreeNodeColorType.black);var ue=O.rotateRight();y===O&&(y=ue),S(L)}else(!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&(!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&(O.color=f.default.TreeNodeColorType.red,S(F))}else if(L===F.rightChild){if(O.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.black,F.color=f.default.TreeNodeColorType.red;var ue=F.rotateRight();y===F&&(y=ue),S(L)}else if(O.color===f.default.TreeNodeColorType.black)if(O.leftChild&&O.leftChild.color===f.default.TreeNodeColorType.red){O.color=F.color,F.color=f.default.TreeNodeColorType.black,O.leftChild&&(O.leftChild.color=f.default.TreeNodeColorType.black);var ue=F.rotateRight();y===F&&(y=ue),L.color=f.default.TreeNodeColorType.black}else if((!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&O.rightChild&&O.rightChild.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.red,O.rightChild&&(O.rightChild.color=f.default.TreeNodeColorType.black);var ue=O.rotateLeft();y===O&&(y=ue),S(L)}else(!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&(!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&(O.color=f.default.TreeNodeColorType.red,S(F))}},b=function(L){for(var F=L;F.leftChild||F.rightChild;){if(F.rightChild){F=A(F.rightChild);var O=L.key;L.key=F.key,F.key=O,L=F}if(F.leftChild){F=_(F.leftChild);var O=L.key;L.key=F.key,F.key=O,L=F}}S(F),F&&F.remove(),--v,y.color=f.default.TreeNodeColorType.black},T=function(L,F){if(!L||L.key===void 0)return!1;var O=T(L.leftChild,F);return O||F(L)?!0:T(L.rightChild,F)};this.eraseElementByPos=function(L){if(L<0||L>=v)throw new Error("pos must more than 0 and less than set's size");var F=0;T(y,function(O){return L===F?(b(O),!0):(++F,!1)})},this.eraseElementByValue=function(L){if(!this.empty()){var F=k(y,L);F===void 0||F.key===void 0||h(F.key,L)!==0||b(F)}};var w=function(L,F){if(!L||L.key===void 0)throw new Error("unknown error");var O=h(F,L.key);return O<0?L.leftChild?w(L.leftChild,F):(L.leftChild=new f.default,L.leftChild.parent=L,L.leftChild.brother=L.rightChild,L.rightChild&&(L.rightChild.brother=L.leftChild),L.leftChild):O>0?L.rightChild?w(L.rightChild,F):(L.rightChild=new f.default,L.rightChild.parent=L,L.rightChild.brother=L.leftChild,L.leftChild&&(L.leftChild.brother=L.rightChild),L.rightChild):L},x=function(L){var F=L.parent;if(!F){if(L===y)return;throw new Error("unknown error")}if(F.color!==f.default.TreeNodeColorType.black&&F.color===f.default.TreeNodeColorType.red){var O=F.brother,ue=F.parent;if(!ue)throw new Error("unknown error");if(O&&O.color===f.default.TreeNodeColorType.red)O.color=F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red,x(ue);else if(!O||O.color===f.default.TreeNodeColorType.black){if(F===ue.leftChild){if(L===F.leftChild){F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red;var _e=ue.rotateRight();ue===y&&(y=_e)}else if(L===F.rightChild){var _e=F.rotateLeft();ue===y&&(y=_e),x(F)}}else if(F===ue.rightChild){if(L===F.leftChild){var _e=F.rotateRight();ue===y&&(y=_e),x(F)}else if(L===F.rightChild){F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red;var _e=ue.rotateLeft();ue===y&&(y=_e)}}}}};this.insert=function(L){if(L==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty()){++v,y.key=L,y.color=f.default.TreeNodeColorType.black;return}var F=w(y,L);F.key!==void 0&&h(F.key,L)===0||(++v,F.key=L,x(F),y.color=f.default.TreeNodeColorType.black)};var k=function(L,F){if(!(!L||L.key===void 0)){var O=h(F,L.key);return O<0?k(L.leftChild,F):O>0?k(L.rightChild,F):L}};this.find=function(L){var F=k(y,L);return F!==void 0&&F.key!==void 0&&h(F.key,L)===0};var M=function(L,F){if(!(!L||L.key===void 0)){var O=h(L.key,F);if(O===0)return L.key;if(O<0)return M(L.rightChild,F);var ue=M(L.leftChild,F);return ue!==void 0?ue:L.key}};this.lowerBound=function(L){return M(y,L)};var D=function(L,F){if(!(!L||L.key===void 0)){var O=h(L.key,F);if(O<=0)return D(L.rightChild,F);var ue=D(L.leftChild,F);return ue!==void 0?ue:L.key}};this.upperBound=function(L){return D(y,L)};var z=function(L,F){if(!(!L||L.key===void 0)){var O=h(L.key,F);if(O===0)return L.key;if(O>0)return z(L.leftChild,F);var ue=z(L.rightChild,F);return ue!==void 0?ue:L.key}};this.reverseLowerBound=function(L){return z(y,L)};var j=function(L,F){if(!(!L||L.key===void 0)){var O=h(L.key,F);if(O>=0)return j(L.leftChild,F);var ue=j(L.rightChild,F);return ue!==void 0?ue:L.key}};this.reverseUpperBound=function(L){return j(y,L)},this.union=function(L){var F=this;L.forEach(function(O){return F.insert(O)})},this.getHeight=function(){if(this.empty())return 0;var L=function(F){return F?Math.max(L(F.leftChild),L(F.rightChild))+1:1};return L(y)};var oe=function(L){return u(this,function(F){switch(F.label){case 0:return!L||L.key===void 0?[2]:[5,c(oe(L.leftChild))];case 1:return F.sent(),[4,L.key];case 2:return F.sent(),[5,c(oe(L.rightChild))];case 3:return F.sent(),[2]}})};this[Symbol.iterator]=function(){return oe(y)},p.forEach(function(L){return g.insert(L)}),Object.freeze(this)}Object.freeze(d),a.default=d},{"../Base/TreeNode":25}],34:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0});function u(c){var f=this;c===void 0&&(c=[]);var d=0,p=[];this.size=function(){return d},this.empty=function(){return d===0},this.clear=function(){d=0,p.length=0},this.push=function(h){p.push(h),++d},this.pop=function(){p.pop(),d>0&&--d},this.top=function(){return p[d-1]},c.forEach(function(h){return f.push(h)}),Object.freeze(this)}Object.freeze(u),a.default=u},{}],35:[function(i,o,a){var u=this&&this.__generator||function(h,g){var v={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},y,A,_,S;return S={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function b(w){return function(x){return T([w,x])}}function T(w){if(y)throw new TypeError("Generator is already executing.");for(;v;)try{if(y=1,A&&(_=w[0]&2?A.return:w[0]?A.throw||((_=A.return)&&_.call(A),0):A.next)&&!(_=_.call(A,w[1])).done)return _;switch(A=0,_&&(w=[w[0]&2,_.value]),w[0]){case 0:case 1:_=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,A=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(_=v.trys,!(_=_.length>0&&_[_.length-1])&&(w[0]===6||w[0]===2)){v=0;continue}if(w[0]===3&&(!_||w[1]>_[0]&&w[1]<_[3])){v.label=w[1];break}if(w[0]===6&&v.label<_[1]){v.label=_[1],_=w;break}if(_&&v.label<_[2]){v.label=_[2],v.ops.push(w);break}_[2]&&v.ops.pop(),v.trys.pop();continue}w=g.call(h,v)}catch(x){w=[6,x],A=0}finally{y=_=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},c=this&&this.__read||function(h,g){var v=typeof Symbol=="function"&&h[Symbol.iterator];if(!v)return h;var y=v.call(h),A,_=[],S;try{for(;(g===void 0||g-- >0)&&!(A=y.next()).done;)_.push(A.value)}catch(b){S={error:b}}finally{try{A&&!A.done&&(v=y.return)&&v.call(y)}finally{if(S)throw S.error}}return _},f=this&&this.__spreadArray||function(h,g,v){if(v||arguments.length===2)for(var y=0,A=g.length,_;y<A;y++)(_||!(y in g))&&(_||(_=Array.prototype.slice.call(g,0,y)),_[y]=g[y]);return h.concat(_||Array.prototype.slice.call(g))},d=this&&this.__values||function(h){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&h[g],y=0;if(v)return v.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&y>=h.length&&(h=void 0),{value:h&&h[y++],done:!h}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});function p(h){var g=this;h===void 0&&(h=[]);var v=0,y=[];this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,y.length=0},this.front=function(){if(!this.empty())return y[0]},this.back=function(){if(!this.empty())return y[v-1]},this.forEach=function(A){y.forEach(A)},this.getElementByPos=function(A){if(A<0||A>=v)throw new Error("pos must more than 0 and less than vector's size");return y[A]},this.eraseElementByPos=function(A){if(A<0||A>=v)throw new Error("pos must more than 0 and less than vector's size");for(var _=A;_<v-1;++_)y[_]=y[_+1];this.popBack()},this.eraseElementByValue=function(A){var _=[];this.forEach(function(b){b!==A&&_.push(b)}),_.forEach(function(b,T){y[T]=b});for(var S=_.length;v>S;)this.popBack()},this.pushBack=function(A){y.push(A),++v},this.popBack=function(){y.pop(),v>0&&--v},this.setElementByPos=function(A,_){if(A<0||A>=v)throw new Error("pos must more than 0 and less than vector's size");y[A]=_},this.insert=function(A,_,S){if(S===void 0&&(S=1),A<0||A>v)throw new Error("pos must more than 0 and less than or equal to vector's size");y.splice.apply(y,f([A,0],c(new Array(S).fill(_)),!1)),v+=S},this.find=function(A){return y.includes(A)},this.reverse=function(){y.reverse()},this.unique=function(){var A,_=[];this.forEach(function(b,T){(T===0||b!==A)&&(_.push(b),A=b)}),_.forEach(function(b,T){y[T]=b});for(var S=_.length;v>S;)this.popBack()},this.sort=function(A){y.sort(A)},this[Symbol.iterator]=function(){return function(){return u(this,function(A){switch(A.label){case 0:return[5,d(y)];case 1:return[2,A.sent()]}})}()},h.forEach(function(A){return g.pushBack(A)}),Object.freeze(this)}Object.freeze(p),a.default=p},{}],36:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0}),a.HashMap=a.HashSet=a.Map=a.Set=a.PriorityQueue=a.Deque=a.LinkList=a.Queue=a.Stack=a.Vector=void 0;var u=i("./Vector/Vector");a.Vector=u.default;var c=i("./Stack/Stack");a.Stack=c.default;var f=i("./Queue/Queue");a.Queue=f.default;var d=i("./LinkList/LinkList");a.LinkList=d.default;var p=i("./Deque/Deque");a.Deque=p.default;var h=i("./PriorityQueue/PriorityQueue");a.PriorityQueue=h.default;var g=i("./Set/Set");a.Set=g.default;var v=i("./Map/Map");a.Map=v.default;var y=i("./HashSet/HashSet");a.HashSet=y.default;var A=i("./HashMap/HashMap");a.HashMap=A.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(i,o,a){const u=i("yallist"),c=Symbol("max"),f=Symbol("length"),d=Symbol("lengthCalculator"),p=Symbol("allowStale"),h=Symbol("maxAge"),g=Symbol("dispose"),v=Symbol("noDisposeOnSet"),y=Symbol("lruList"),A=Symbol("cache"),_=Symbol("updateAgeOnGet"),S=()=>1;class b{constructor(j){if(typeof j=="number"&&(j={max:j}),j||(j={}),j.max&&(typeof j.max!="number"||j.max<0))throw new TypeError("max must be a non-negative number");this[c]=j.max||1/0;const oe=j.length||S;if(this[d]=typeof oe!="function"?S:oe,this[p]=j.stale||!1,j.maxAge&&typeof j.maxAge!="number")throw new TypeError("maxAge must be a number");this[h]=j.maxAge||0,this[g]=j.dispose,this[v]=j.noDisposeOnSet||!1,this[_]=j.updateAgeOnGet||!1,this.reset()}set max(j){if(typeof j!="number"||j<0)throw new TypeError("max must be a non-negative number");this[c]=j||1/0,x(this)}get max(){return this[c]}set allowStale(j){this[p]=!!j}get allowStale(){return this[p]}set maxAge(j){if(typeof j!="number")throw new TypeError("maxAge must be a non-negative number");this[h]=j,x(this)}get maxAge(){return this[h]}set lengthCalculator(j){typeof j!="function"&&(j=S),j!==this[d]&&(this[d]=j,this[f]=0,this[y].forEach(oe=>{oe.length=this[d](oe.value,oe.key),this[f]+=oe.length})),x(this)}get lengthCalculator(){return this[d]}get length(){return this[f]}get itemCount(){return this[y].length}rforEach(j,oe){oe=oe||this;for(let L=this[y].tail;L!==null;){const F=L.prev;D(this,j,L,oe),L=F}}forEach(j,oe){oe=oe||this;for(let L=this[y].head;L!==null;){const F=L.next;D(this,j,L,oe),L=F}}keys(){return this[y].toArray().map(j=>j.key)}values(){return this[y].toArray().map(j=>j.value)}reset(){this[g]&&this[y]&&this[y].length&&this[y].forEach(j=>this[g](j.key,j.value)),this[A]=new Map,this[y]=new u,this[f]=0}dump(){return this[y].map(j=>w(this,j)?!1:{k:j.key,v:j.value,e:j.now+(j.maxAge||0)}).toArray().filter(j=>j)}dumpLru(){return this[y]}set(j,oe,L){if(L=L||this[h],L&&typeof L!="number")throw new TypeError("maxAge must be a number");const F=L?Date.now():0,O=this[d](oe,j);if(this[A].has(j)){if(O>this[c])return k(this,this[A].get(j)),!1;const Ce=this[A].get(j).value;return this[g]&&(this[v]||this[g](j,Ce.value)),Ce.now=F,Ce.maxAge=L,Ce.value=oe,this[f]+=O-Ce.length,Ce.length=O,this.get(j),x(this),!0}const ue=new M(j,oe,O,F,L);return ue.length>this[c]?(this[g]&&this[g](j,oe),!1):(this[f]+=ue.length,this[y].unshift(ue),this[A].set(j,this[y].head),x(this),!0)}has(j){if(!this[A].has(j))return!1;const oe=this[A].get(j).value;return!w(this,oe)}get(j){return T(this,j,!0)}peek(j){return T(this,j,!1)}pop(){const j=this[y].tail;return j?(k(this,j),j.value):null}del(j){k(this,this[A].get(j))}load(j){this.reset();const oe=Date.now();for(let L=j.length-1;L>=0;L--){const F=j[L],O=F.e||0;if(O===0)this.set(F.k,F.v);else{const ue=O-oe;ue>0&&this.set(F.k,F.v,ue)}}}prune(){this[A].forEach((j,oe)=>T(this,oe,!1))}}const T=(z,j,oe)=>{const L=z[A].get(j);if(L){const F=L.value;if(w(z,F)){if(k(z,L),!z[p])return}else oe&&(z[_]&&(L.value.now=Date.now()),z[y].unshiftNode(L));return F.value}},w=(z,j)=>{if(!j||!j.maxAge&&!z[h])return!1;const oe=Date.now()-j.now;return j.maxAge?oe>j.maxAge:z[h]&&oe>z[h]},x=z=>{if(z[f]>z[c])for(let j=z[y].tail;z[f]>z[c]&&j!==null;){const oe=j.prev;k(z,j),j=oe}},k=(z,j)=>{if(j){const oe=j.value;z[g]&&z[g](oe.key,oe.value),z[f]-=oe.length,z[A].delete(oe.key),z[y].removeNode(j)}};class M{constructor(j,oe,L,F,O){this.key=j,this.value=oe,this.length=L,this.now=F,this.maxAge=O||0}}const D=(z,j,oe,L)=>{let F=oe.value;w(z,F)&&(k(z,oe),z[p]||(F=void 0)),F&&j.call(L,F.value,F.key,z)};o.exports=b},{yallist:83}],38:[function(i,o,a){(function(u){(function(){const c=o.exports;c.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"},c.codes={};for(const d in c.types){const p=c.types[d];c.codes[p]=d}c.CMD_SHIFT=4,c.CMD_MASK=240,c.DUP_MASK=8,c.QOS_MASK=3,c.QOS_SHIFT=1,c.RETAIN_MASK=1,c.VARBYTEINT_MASK=127,c.VARBYTEINT_FIN_MASK=128,c.VARBYTEINT_MAX=268435455,c.SESSIONPRESENT_MASK=1,c.SESSIONPRESENT_HEADER=u.from([c.SESSIONPRESENT_MASK]),c.CONNACK_HEADER=u.from([c.codes.connack<<c.CMD_SHIFT]),c.USERNAME_MASK=128,c.PASSWORD_MASK=64,c.WILL_RETAIN_MASK=32,c.WILL_QOS_MASK=24,c.WILL_QOS_SHIFT=3,c.WILL_FLAG_MASK=4,c.CLEAN_SESSION_MASK=2,c.CONNECT_HEADER=u.from([c.codes.connect<<c.CMD_SHIFT]),c.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},c.propertiesCodes={};for(const d in c.properties){const p=c.properties[d];c.propertiesCodes[p]=d}c.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 f(d){return[0,1,2].map(p=>[0,1].map(h=>[0,1].map(g=>{const v=u.alloc(1);return v.writeUInt8(c.codes[d]<<c.CMD_SHIFT|(h?c.DUP_MASK:0)|p<<c.QOS_SHIFT|g,0,!0),v})))}c.PUBLISH_HEADER=f("publish"),c.SUBSCRIBE_HEADER=f("subscribe"),c.SUBSCRIBE_OPTIONS_QOS_MASK=3,c.SUBSCRIBE_OPTIONS_NL_MASK=1,c.SUBSCRIBE_OPTIONS_NL_SHIFT=2,c.SUBSCRIBE_OPTIONS_RAP_MASK=1,c.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,c.SUBSCRIBE_OPTIONS_RH_MASK=3,c.SUBSCRIBE_OPTIONS_RH_SHIFT=4,c.SUBSCRIBE_OPTIONS_RH=[0,16,32],c.SUBSCRIBE_OPTIONS_NL=4,c.SUBSCRIBE_OPTIONS_RAP=8,c.SUBSCRIBE_OPTIONS_QOS=[0,1,2],c.UNSUBSCRIBE_HEADER=f("unsubscribe"),c.ACKS={unsuback:f("unsuback"),puback:f("puback"),pubcomp:f("pubcomp"),pubrel:f("pubrel"),pubrec:f("pubrec")},c.SUBACK_HEADER=u.from([c.codes.suback<<c.CMD_SHIFT]),c.VERSION3=u.from([3]),c.VERSION4=u.from([4]),c.VERSION5=u.from([5]),c.VERSION131=u.from([131]),c.VERSION132=u.from([132]),c.QOS=[0,1,2].map(d=>u.from([d])),c.EMPTY={pingreq:u.from([c.codes.pingreq<<4,0]),pingresp:u.from([c.codes.pingresp<<4,0]),disconnect:u.from([c.codes.disconnect<<4,0])}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],39:[function(i,o,a){(function(u){(function(){const c=i("./writeToStream"),f=i("events");function d(h,g){const v=new p;return c(h,v,g),v.concat()}class p extends f{constructor(){super(),this._array=new Array(20),this._i=0}write(g){return this._array[this._i++]=g,!0}concat(){let g=0;const v=new Array(this._array.length),y=this._array;let A=0,_;for(_=0;_<y.length&&y[_]!==void 0;_++)typeof y[_]!="string"?v[_]=y[_].length:v[_]=u.byteLength(y[_]),g+=v[_];const S=u.allocUnsafe(g);for(_=0;_<y.length&&y[_]!==void 0;_++)typeof y[_]!="string"?(y[_].copy(S,A),A+=v[_]):(S.write(y[_],A),A+=v[_]);return S}}o.exports=d}).call(this)}).call(this,i("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(i,o,a){a.parser=i("./parser").parser,a.generate=i("./generate"),a.writeToStream=i("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(i,o,a){(function(u){(function(){const f={},d=u.isBuffer(u.from([1,2]).subarray(0,1));function p(y){const A=u.allocUnsafe(2);return A.writeUInt8(y>>8,0),A.writeUInt8(y&255,0+1),A}function h(){for(let y=0;y<65536;y++)f[y]=p(y)}function g(y){let _=0,S=0;const b=u.allocUnsafe(4);do _=y%128|0,y=y/128|0,y>0&&(_=_|128),b.writeUInt8(_,S++);while(y>0&&S<4);return y>0&&(S=0),d?b.subarray(0,S):b.slice(0,S)}function v(y){const A=u.allocUnsafe(4);return A.writeUInt32BE(y,0),A}o.exports={cache:f,generateCache:h,generateNumber:p,genBufVariableByteInt:g,generate4ByteBuffer:v}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],42:[function(i,o,a){class u{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}o.exports=u},{}],43:[function(i,o,a){const u=i("bl"),c=i("events"),f=i("./packet"),d=i("./constants"),p=i("debug")("mqtt-packet:parser");class h extends c{constructor(){super(),this.parser=this.constructor.parser}static parser(v){return this instanceof h?(this.settings=v||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new h().parser(v)}_resetState(){p("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new f,this.error=null,this._list=u(),this._stateCounter=0}parse(v){for(this.error&&this._resetState(),this._list.append(v),p("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++,p("parse: state complete. _stateCounter is now: %d",this._stateCounter),p("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return p("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const v=this._list.readUInt8(0);return this.packet.cmd=d.types[v>>d.CMD_SHIFT],this.packet.retain=(v&d.RETAIN_MASK)!==0,this.packet.qos=v>>d.QOS_SHIFT&d.QOS_MASK,this.packet.dup=(v&d.DUP_MASK)!==0,p("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const v=this._parseVarByteNum(!0);return v&&(this.packet.length=v.value,this._list.consume(v.bytes)),p("_parseLength %d",v.value),!!v}_parsePayload(){p("_parsePayload: payload %O",this._list);let v=!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"))}v=!0}return p("_parsePayload complete result: %s",v),v}_parseConnect(){p("_parseConnect");let v,y,A,_;const S={},b=this.packet,T=this._parseString();if(T===null)return this._emitError(new Error("Cannot parse protocolId"));if(T!=="MQTT"&&T!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(b.protocolId=T,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(b.protocolVersion=this._list.readUInt8(this._pos),b.protocolVersion>=128&&(b.bridgeMode=!0,b.protocolVersion=b.protocolVersion-128),b.protocolVersion!==3&&b.protocolVersion!==4&&b.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(S.username=this._list.readUInt8(this._pos)&d.USERNAME_MASK,S.password=this._list.readUInt8(this._pos)&d.PASSWORD_MASK,S.will=this._list.readUInt8(this._pos)&d.WILL_FLAG_MASK,S.will&&(b.will={},b.will.retain=(this._list.readUInt8(this._pos)&d.WILL_RETAIN_MASK)!==0,b.will.qos=(this._list.readUInt8(this._pos)&d.WILL_QOS_MASK)>>d.WILL_QOS_SHIFT),b.clean=(this._list.readUInt8(this._pos)&d.CLEAN_SESSION_MASK)!==0,this._pos++,b.keepalive=this._parseNum(),b.keepalive===-1)return this._emitError(new Error("Packet too short"));if(b.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(b.properties=x)}const w=this._parseString();if(w===null)return this._emitError(new Error("Packet too short"));if(b.clientId=w,p("_parseConnect: packet.clientId: %s",b.clientId),S.will){if(b.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(b.will.properties=x)}if(v=this._parseString(),v===null)return this._emitError(new Error("Cannot parse will topic"));if(b.will.topic=v,p("_parseConnect: packet.will.topic: %s",b.will.topic),y=this._parseBuffer(),y===null)return this._emitError(new Error("Cannot parse will payload"));b.will.payload=y,p("_parseConnect: packet.will.paylaod: %s",b.will.payload)}if(S.username){if(_=this._parseString(),_===null)return this._emitError(new Error("Cannot parse username"));b.username=_,p("_parseConnect: packet.username: %s",b.username)}if(S.password){if(A=this._parseBuffer(),A===null)return this._emitError(new Error("Cannot parse password"));b.password=A}return this.settings=b,p("_parseConnect: complete"),b}_parseConnack(){p("_parseConnack");const v=this.packet;if(this._list.length<1)return null;if(v.sessionPresent=!!(this._list.readUInt8(this._pos++)&d.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?v.reasonCode=this._list.readUInt8(this._pos++):v.reasonCode=0;else{if(this._list.length<2)return null;v.returnCode=this._list.readUInt8(this._pos++)}if(v.returnCode===-1||v.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}p("_parseConnack: complete")}_parsePublish(){p("_parsePublish");const v=this.packet;if(v.topic=this._parseString(),v.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(v.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}v.payload=this._list.slice(this._pos,v.length),p("_parsePublish: payload from buffer list: %o",v.payload)}}_parseSubscribe(){p("_parseSubscribe");const v=this.packet;let y,A,_,S,b,T,w;if(v.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(v.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(v.properties=x)}for(;this._pos<v.length;){if(y=this._parseString(),y===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=v.length)return this._emitError(new Error("Malformed Subscribe Payload"));A=this._parseByte(),_=A&d.SUBSCRIBE_OPTIONS_QOS_MASK,T=(A>>d.SUBSCRIBE_OPTIONS_NL_SHIFT&d.SUBSCRIBE_OPTIONS_NL_MASK)!==0,b=(A>>d.SUBSCRIBE_OPTIONS_RAP_SHIFT&d.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,S=A>>d.SUBSCRIBE_OPTIONS_RH_SHIFT&d.SUBSCRIBE_OPTIONS_RH_MASK,w={topic:y,qos:_},this.settings.protocolVersion===5?(w.nl=T,w.rap=b,w.rh=S):this.settings.bridgeMode&&(w.rh=0,w.rap=!0,w.nl=!0),p("_parseSubscribe: push subscription `%s` to subscription",w),v.subscriptions.push(w)}}}_parseSuback(){p("_parseSuback");const v=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){p("_parseUnsubscribe");const v=this.packet;if(v.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}for(;this._pos<v.length;){const y=this._parseString();if(y===null)return this._emitError(new Error("Cannot parse topic"));p("_parseUnsubscribe: push topic `%s` to unsubscriptions",y),v.unsubscriptions.push(y)}}}_parseUnsuback(){p("_parseUnsuback");const v=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const y=this._parseProperties();for(Object.getOwnPropertyNames(y).length&&(v.properties=y),v.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){p("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const v=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(v.length>2?(v.reasonCode=this._parseByte(),p("_parseConfirmation: packet.reasonCode `%d`",v.reasonCode)):v.reasonCode=0,v.length>3)){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}return!0}_parseDisconnect(){const v=this.packet;if(p("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?v.reasonCode=this._parseByte():v.reasonCode=0;const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}return p("_parseDisconnect result: true"),!0}_parseAuth(){p("_parseAuth");const v=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));v.reasonCode=this._parseByte();const y=this._parseProperties();return Object.getOwnPropertyNames(y).length&&(v.properties=y),p("_parseAuth: result: true"),!0}_parseMessageId(){const v=this.packet;return v.messageId=this._parseNum(),v.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(p("_parseMessageId: packet.messageId %d",v.messageId),!0)}_parseString(v){const y=this._parseNum(),A=y+this._pos;if(y===-1||A>this._list.length||A>this.packet.length)return null;const _=this._list.toString("utf8",this._pos,A);return this._pos+=y,p("_parseString: result: %s",_),_}_parseStringPair(){return p("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const v=this._parseNum(),y=v+this._pos;if(v===-1||y>this._list.length||y>this.packet.length)return null;const A=this._list.slice(this._pos,y);return this._pos+=v,p("_parseBuffer: result: %o",A),A}_parseNum(){if(this._list.length-this._pos<2)return-1;const v=this._list.readUInt16BE(this._pos);return this._pos+=2,p("_parseNum: result: %s",v),v}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const v=this._list.readUInt32BE(this._pos);return this._pos+=4,p("_parse4ByteNum: result: %s",v),v}_parseVarByteNum(v){p("_parseVarByteNum");const y=4;let A=0,_=1,S=0,b=!1,T;const w=this._pos?this._pos:0;for(;A<y&&w+A<this._list.length;){if(T=this._list.readUInt8(w+A++),S+=_*(T&d.VARBYTEINT_MASK),_*=128,!(T&d.VARBYTEINT_FIN_MASK)){b=!0;break}if(this._list.length<=A)break}return!b&&A===y&&this._list.length>=A&&this._emitError(new Error("Invalid variable byte integer")),w&&(this._pos+=A),b=b?v?{bytes:A,value:S}:S:!1,p("_parseVarByteNum: result: %o",b),b}_parseByte(){let v;return this._pos<this._list.length&&(v=this._list.readUInt8(this._pos),this._pos++),p("_parseByte: result: %o",v),v}_parseByType(v){switch(p("_parseByType: type: %s",v),v){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(){p("_parseProperties");const v=this._parseVarByteNum(),A=this._pos+v,_={};for(;this._pos<A;){const S=this._parseByte();if(!S)return this._emitError(new Error("Cannot parse property code type")),!1;const b=d.propertiesCodes[S];if(!b)return this._emitError(new Error("Unknown property")),!1;if(b==="userProperties"){_[b]||(_[b]=Object.create(null));const T=this._parseByType(d.propertiesTypes[b]);if(_[b][T.name])if(Array.isArray(_[b][T.name]))_[b][T.name].push(T.value);else{const w=_[b][T.name];_[b][T.name]=[w],_[b][T.name].push(T.value)}else _[b][T.name]=T.value;continue}_[b]?Array.isArray(_[b])?_[b].push(this._parseByType(d.propertiesTypes[b])):(_[b]=[_[b]],_[b].push(this._parseByType(d.propertiesTypes[b]))):_[b]=this._parseByType(d.propertiesTypes[b])}return _}_newPacket(){return p("_newPacket"),this.packet&&(this._list.consume(this.packet.length),p("_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)),p("_newPacket: new packet"),this.packet=new f,this._pos=0,!0}_emitError(v){p("_emitError"),this.error=v,this.emit("error",v)}}o.exports=h},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(i,o,a){(function(u){(function(){const c=i("./constants"),f=u.allocUnsafe(0),d=u.from([0]),p=i("./numbers"),h=i("process-nextick-args").nextTick,g=i("debug")("mqtt-packet:writeToStream"),v=p.cache,y=p.generateNumber,A=p.generateCache,_=p.genBufVariableByteInt,S=p.generate4ByteBuffer;let b=Ie,T=!0;function w(Ne,pe,At){switch(g("generate called"),pe.cork&&(pe.cork(),h(x,pe)),T&&(T=!1,A()),g("generate: packet.cmd: %s",Ne.cmd),Ne.cmd){case"connect":return k(Ne,pe);case"connack":return M(Ne,pe,At);case"publish":return D(Ne,pe,At);case"puback":case"pubrec":case"pubrel":case"pubcomp":return z(Ne,pe,At);case"subscribe":return j(Ne,pe,At);case"suback":return oe(Ne,pe,At);case"unsubscribe":return L(Ne,pe,At);case"unsuback":return F(Ne,pe,At);case"pingreq":case"pingresp":return O(Ne,pe);case"disconnect":return ue(Ne,pe,At);case"auth":return _e(Ne,pe,At);default:return pe.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(w,"cacheNumbers",{get(){return b===Ie},set(Ne){Ne?((!v||Object.keys(v).length===0)&&(T=!0),b=Ie):(T=!1,b=Oe)}});function x(Ne){Ne.uncork()}function k(Ne,pe,At){const Ve=Ne||{},xe=Ve.protocolId||"MQTT";let ze=Ve.protocolVersion||4;const Pt=Ve.will;let hn=Ve.clean;const ae=Ve.keepalive||0,le=Ve.clientId||"",re=Ve.username,V=Ve.password,$=Ve.properties;hn===void 0&&(hn=!0);let he=0;if(!xe||typeof xe!="string"&&!u.isBuffer(xe))return pe.emit("error",new Error("Invalid protocolId")),!1;if(he+=xe.length+2,ze!==3&&ze!==4&&ze!==5)return pe.emit("error",new Error("Invalid protocol version")),!1;if(he+=1,(typeof le=="string"||u.isBuffer(le))&&(le||ze>=4)&&(le||hn))he+=u.byteLength(le)+2;else{if(ze<4)return pe.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(hn*1===0)return pe.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof ae!="number"||ae<0||ae>65535||ae%1!==0)return pe.emit("error",new Error("Invalid keepalive")),!1;if(he+=2,he+=1,ze===5){var Ue=Fe(pe,$);if(!Ue)return!1;he+=Ue.length}if(Pt){if(typeof Pt!="object")return pe.emit("error",new Error("Invalid will")),!1;if(!Pt.topic||typeof Pt.topic!="string")return pe.emit("error",new Error("Invalid will topic")),!1;if(he+=u.byteLength(Pt.topic)+2,he+=2,Pt.payload)if(Pt.payload.length>=0)typeof Pt.payload=="string"?he+=u.byteLength(Pt.payload):he+=Pt.payload.length;else return pe.emit("error",new Error("Invalid will payload")),!1;var qe={};if(ze===5){if(qe=Fe(pe,Pt.properties),!qe)return!1;he+=qe.length}}let jt=!1;if(re!=null)if(Et(re))jt=!0,he+=u.byteLength(re)+2;else return pe.emit("error",new Error("Invalid username")),!1;if(V!=null){if(!jt)return pe.emit("error",new Error("Username is required to use password")),!1;if(Et(V))he+=In(V)+2;else return pe.emit("error",new Error("Invalid password")),!1}pe.write(c.CONNECT_HEADER),de(pe,he),Dt(pe,xe),Ve.bridgeMode&&(ze+=128),pe.write(ze===131?c.VERSION131:ze===132?c.VERSION132:ze===4?c.VERSION4:ze===5?c.VERSION5:c.VERSION3);let An=0;return An|=re!=null?c.USERNAME_MASK:0,An|=V!=null?c.PASSWORD_MASK:0,An|=Pt&&Pt.retain?c.WILL_RETAIN_MASK:0,An|=Pt&&Pt.qos?Pt.qos<<c.WILL_QOS_SHIFT:0,An|=Pt?c.WILL_FLAG_MASK:0,An|=hn?c.CLEAN_SESSION_MASK:0,pe.write(u.from([An])),b(pe,ae),ze===5&&Ue.write(),Dt(pe,le),Pt&&(ze===5&&qe.write(),ie(pe,Pt.topic),Dt(pe,Pt.payload)),re!=null&&Dt(pe,re),V!=null&&Dt(pe,V),!0}function M(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=Ve===5?xe.reasonCode:xe.returnCode,Pt=xe.properties;let hn=2;if(typeof ze!="number")return pe.emit("error",new Error("Invalid return code")),!1;let ae=null;if(Ve===5){if(ae=Fe(pe,Pt),!ae)return!1;hn+=ae.length}return pe.write(c.CONNACK_HEADER),de(pe,hn),pe.write(xe.sessionPresent?c.SESSIONPRESENT_HEADER:d),pe.write(u.from([ze])),ae!=null&&ae.write(),!0}function D(Ne,pe,At){g("publish: packet: %o",Ne);const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.qos||0,Pt=xe.retain?c.RETAIN_MASK:0,hn=xe.topic,ae=xe.payload||f,le=xe.messageId,re=xe.properties;let V=0;if(typeof hn=="string")V+=u.byteLength(hn)+2;else if(u.isBuffer(hn))V+=hn.length+2;else return pe.emit("error",new Error("Invalid topic")),!1;if(u.isBuffer(ae)?V+=ae.length:V+=u.byteLength(ae),ze&&typeof le!="number")return pe.emit("error",new Error("Invalid messageId")),!1;ze&&(V+=2);let $=null;if(Ve===5){if($=Fe(pe,re),!$)return!1;V+=$.length}return pe.write(c.PUBLISH_HEADER[ze][xe.dup?1:0][Pt?1:0]),de(pe,V),b(pe,In(hn)),pe.write(hn),ze>0&&b(pe,le),$!=null&&$.write(),g("publish: payload: %o",ae),pe.write(ae)}function z(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.cmd||"puback",Pt=xe.messageId,hn=xe.dup&&ze==="pubrel"?c.DUP_MASK:0;let ae=0;const le=xe.reasonCode,re=xe.properties;let V=Ve===5?3:2;if(ze==="pubrel"&&(ae=1),typeof Pt!="number")return pe.emit("error",new Error("Invalid messageId")),!1;let $=null;if(Ve===5&&typeof re=="object"){if($=$e(pe,re,At,V),!$)return!1;V+=$.length}return pe.write(c.ACKS[ze][ae][hn][0]),de(pe,V),b(pe,Pt),Ve===5&&pe.write(u.from([le])),$!==null&&$.write(),!0}function j(Ne,pe,At){g("subscribe: packet: ");const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.dup?c.DUP_MASK:0,Pt=xe.messageId,hn=xe.subscriptions,ae=xe.properties;let le=0;if(typeof Pt!="number")return pe.emit("error",new Error("Invalid messageId")),!1;le+=2;let re=null;if(Ve===5){if(re=Fe(pe,ae),!re)return!1;le+=re.length}if(typeof hn=="object"&&hn.length)for(let $=0;$<hn.length;$+=1){const he=hn[$].topic,Ue=hn[$].qos;if(typeof he!="string")return pe.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof Ue!="number")return pe.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Ve===5){if(typeof(hn[$].nl||!1)!="boolean")return pe.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(hn[$].rap||!1)!="boolean")return pe.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const An=hn[$].rh||0;if(typeof An!="number"||An>2)return pe.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}le+=u.byteLength(he)+2+1}else return pe.emit("error",new Error("Invalid subscriptions")),!1;g("subscribe: writing to stream: %o",c.SUBSCRIBE_HEADER),pe.write(c.SUBSCRIBE_HEADER[1][ze?1:0][0]),de(pe,le),b(pe,Pt),re!==null&&re.write();let V=!0;for(const $ of hn){const he=$.topic,Ue=$.qos,qe=+$.nl,jt=+$.rap,An=$.rh;let wn;ie(pe,he),wn=c.SUBSCRIBE_OPTIONS_QOS[Ue],Ve===5&&(wn|=qe?c.SUBSCRIBE_OPTIONS_NL:0,wn|=jt?c.SUBSCRIBE_OPTIONS_RAP:0,wn|=An?c.SUBSCRIBE_OPTIONS_RH[An]:0),V=pe.write(u.from([wn]))}return V}function oe(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.messageId,Pt=xe.granted,hn=xe.properties;let ae=0;if(typeof ze!="number")return pe.emit("error",new Error("Invalid messageId")),!1;if(ae+=2,typeof Pt=="object"&&Pt.length)for(let re=0;re<Pt.length;re+=1){if(typeof Pt[re]!="number")return pe.emit("error",new Error("Invalid qos vector")),!1;ae+=1}else return pe.emit("error",new Error("Invalid qos vector")),!1;let le=null;if(Ve===5){if(le=$e(pe,hn,At,ae),!le)return!1;ae+=le.length}return pe.write(c.SUBACK_HEADER),de(pe,ae),b(pe,ze),le!==null&&le.write(),pe.write(u.from(Pt))}function L(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.messageId,Pt=xe.dup?c.DUP_MASK:0,hn=xe.unsubscriptions,ae=xe.properties;let le=0;if(typeof ze!="number")return pe.emit("error",new Error("Invalid messageId")),!1;if(le+=2,typeof hn=="object"&&hn.length)for(let $=0;$<hn.length;$+=1){if(typeof hn[$]!="string")return pe.emit("error",new Error("Invalid unsubscriptions")),!1;le+=u.byteLength(hn[$])+2}else return pe.emit("error",new Error("Invalid unsubscriptions")),!1;let re=null;if(Ve===5){if(re=Fe(pe,ae),!re)return!1;le+=re.length}pe.write(c.UNSUBSCRIBE_HEADER[1][Pt?1:0][0]),de(pe,le),b(pe,ze),re!==null&&re.write();let V=!0;for(let $=0;$<hn.length;$++)V=ie(pe,hn[$]);return V}function F(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.messageId,Pt=xe.dup?c.DUP_MASK:0,hn=xe.granted,ae=xe.properties,le=xe.cmd,re=0;let V=2;if(typeof ze!="number")return pe.emit("error",new Error("Invalid messageId")),!1;if(Ve===5)if(typeof hn=="object"&&hn.length)for(let he=0;he<hn.length;he+=1){if(typeof hn[he]!="number")return pe.emit("error",new Error("Invalid qos vector")),!1;V+=1}else return pe.emit("error",new Error("Invalid qos vector")),!1;let $=null;if(Ve===5){if($=$e(pe,ae,At,V),!$)return!1;V+=$.length}return pe.write(c.ACKS[le][re][Pt][0]),de(pe,V),b(pe,ze),$!==null&&$.write(),Ve===5&&pe.write(u.from(hn)),!0}function O(Ne,pe,At){return pe.write(c.EMPTY[Ne.cmd])}function ue(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.reasonCode,Pt=xe.properties;let hn=Ve===5?1:0,ae=null;if(Ve===5){if(ae=$e(pe,Pt,At,hn),!ae)return!1;hn+=ae.length}return pe.write(u.from([c.codes.disconnect<<4])),de(pe,hn),Ve===5&&pe.write(u.from([ze])),ae!==null&&ae.write(),!0}function _e(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.reasonCode,Pt=xe.properties;let hn=Ve===5?1:0;Ve!==5&&pe.emit("error",new Error("Invalid mqtt version for auth packet"));const ae=$e(pe,Pt,At,hn);return ae?(hn+=ae.length,pe.write(u.from([c.codes.auth<<4])),de(pe,hn),pe.write(u.from([ze])),ae!==null&&ae.write(),!0):!1}const Ce={};function de(Ne,pe){if(pe>c.VARBYTEINT_MAX)return Ne.emit("error",new Error(`Invalid variable byte integer: ${pe}`)),!1;let At=Ce[pe];return At||(At=_(pe),pe<16384&&(Ce[pe]=At)),g("writeVarByteInt: writing to stream: %o",At),Ne.write(At)}function ie(Ne,pe){const At=u.byteLength(pe);return b(Ne,At),g("writeString: %s",pe),Ne.write(pe,"utf8")}function Y(Ne,pe,At){ie(Ne,pe),ie(Ne,At)}function Ie(Ne,pe){return g("writeNumberCached: number: %d",pe),g("writeNumberCached: %o",v[pe]),Ne.write(v[pe])}function Oe(Ne,pe){const At=y(pe);return g("writeNumberGenerated: %o",At),Ne.write(At)}function kt(Ne,pe){const At=S(pe);return g("write4ByteNumber: %o",At),Ne.write(At)}function Dt(Ne,pe){typeof pe=="string"?ie(Ne,pe):pe?(b(Ne,pe.length),Ne.write(pe)):b(Ne,0)}function Fe(Ne,pe){if(typeof pe!="object"||pe.length!=null)return{length:1,write(){Lt(Ne,{},0)}};let At=0;function Ve(ze,Pt){const hn=c.propertiesTypes[ze];let ae=0;switch(hn){case"byte":{if(typeof Pt!="boolean")return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+1;break}case"int8":{if(typeof Pt!="number"||Pt<0||Pt>255)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+1;break}case"binary":{if(Pt&&Pt===null)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+u.byteLength(Pt)+2;break}case"int16":{if(typeof Pt!="number"||Pt<0||Pt>65535)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+2;break}case"int32":{if(typeof Pt!="number"||Pt<0||Pt>4294967295)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+4;break}case"var":{if(typeof Pt!="number"||Pt<0||Pt>268435455)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+u.byteLength(_(Pt));break}case"string":{if(typeof Pt!="string")return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+2+u.byteLength(Pt.toString());break}case"pair":{if(typeof Pt!="object")return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=Object.getOwnPropertyNames(Pt).reduce((le,re)=>{const V=Pt[re];return Array.isArray(V)?le+=V.reduce(($,he)=>($+=1+2+u.byteLength(re.toString())+2+u.byteLength(he.toString()),$),0):le+=1+2+u.byteLength(re.toString())+2+u.byteLength(Pt[re].toString()),le},0);break}default:return Ne.emit("error",new Error(`Invalid property ${ze}: ${Pt}`)),!1}return ae}if(pe)for(const ze in pe){let Pt=0,hn=0;const ae=pe[ze];if(Array.isArray(ae))for(let le=0;le<ae.length;le++){if(hn=Ve(ze,ae[le]),!hn)return!1;Pt+=hn}else{if(hn=Ve(ze,ae),!hn)return!1;Pt=hn}if(!Pt)return!1;At+=Pt}return{length:u.byteLength(_(At))+At,write(){Lt(Ne,pe,At)}}}function $e(Ne,pe,At,Ve){const xe=["reasonString","userProperties"],ze=At&&At.properties&&At.properties.maximumPacketSize?At.properties.maximumPacketSize:0;let Pt=Fe(Ne,pe);if(ze)for(;Ve+Pt.length>ze;){const hn=xe.shift();if(hn&&pe[hn])delete pe[hn],Pt=Fe(Ne,pe);else return!1}return Pt}function Cn(Ne,pe,At){switch(c.propertiesTypes[pe]){case"byte":{Ne.write(u.from([c.properties[pe]])),Ne.write(u.from([+At]));break}case"int8":{Ne.write(u.from([c.properties[pe]])),Ne.write(u.from([At]));break}case"binary":{Ne.write(u.from([c.properties[pe]])),Dt(Ne,At);break}case"int16":{Ne.write(u.from([c.properties[pe]])),b(Ne,At);break}case"int32":{Ne.write(u.from([c.properties[pe]])),kt(Ne,At);break}case"var":{Ne.write(u.from([c.properties[pe]])),de(Ne,At);break}case"string":{Ne.write(u.from([c.properties[pe]])),ie(Ne,At);break}case"pair":{Object.getOwnPropertyNames(At).forEach(xe=>{const ze=At[xe];Array.isArray(ze)?ze.forEach(Pt=>{Ne.write(u.from([c.properties[pe]])),Y(Ne,xe.toString(),Pt.toString())}):(Ne.write(u.from([c.properties[pe]])),Y(Ne,xe.toString(),ze.toString()))});break}default:return Ne.emit("error",new Error(`Invalid property ${pe} value: ${At}`)),!1}}function Lt(Ne,pe,At){de(Ne,At);for(const Ve in pe)if(Object.prototype.hasOwnProperty.call(pe,Ve)&&pe[Ve]!==null){const xe=pe[Ve];if(Array.isArray(xe))for(let ze=0;ze<xe.length;ze++)Cn(Ne,Ve,xe[ze]);else Cn(Ne,Ve,xe)}}function In(Ne){return Ne?Ne instanceof u?Ne.length:u.byteLength(Ne):0}function Et(Ne){return typeof Ne=="string"||Ne instanceof u}o.exports=w}).call(this)}).call(this,i("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(i,o,a){var u=1e3,c=u*60,f=c*60,d=f*24,p=d*7,h=d*365.25;o.exports=function(_,S){S=S||{};var b=typeof _;if(b==="string"&&_.length>0)return g(_);if(b==="number"&&isFinite(_))return S.long?y(_):v(_);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function g(_){if(_=String(_),!(_.length>100)){var S=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(S){var b=parseFloat(S[1]),T=(S[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return b*h;case"weeks":case"week":case"w":return b*p;case"days":case"day":case"d":return b*d;case"hours":case"hour":case"hrs":case"hr":case"h":return b*f;case"minutes":case"minute":case"mins":case"min":case"m":return b*c;case"seconds":case"second":case"secs":case"sec":case"s":return b*u;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return b;default:return}}}}function v(_){var S=Math.abs(_);return S>=d?Math.round(_/d)+"d":S>=f?Math.round(_/f)+"h":S>=c?Math.round(_/c)+"m":S>=u?Math.round(_/u)+"s":_+"ms"}function y(_){var S=Math.abs(_);return S>=d?A(_,S,d,"day"):S>=f?A(_,S,f,"hour"):S>=c?A(_,S,c,"minute"):S>=u?A(_,S,u,"second"):_+" ms"}function A(_,S,b,T){var w=S>=b*1.5;return Math.round(_/b)+" "+T+(w?"s":"")}},{}],46:[function(i,o,a){const u=i("./lib/number-allocator.js");o.exports.NumberAllocator=u},{"./lib/number-allocator.js":47}],47:[function(i,o,a){const u=i("js-sdsl").Set,c=i("debug")("number-allocator:trace"),f=i("debug")("number-allocator:error");function d(h,g){this.low=h,this.high=g}d.prototype.equals=function(h){return this.low===h.low&&this.high===h.high},d.prototype.compare=function(h){return this.low<h.low&&this.high<h.low?-1:h.low<this.low&&h.high<this.low?1:0};function p(h,g){if(!(this instanceof p))return new p(h,g);this.min=h,this.max=g,this.ss=new u([],(v,y)=>v.compare(y)),c("Create"),this.clear()}p.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},p.prototype.alloc=function(){if(this.ss.size()===0)return c("alloc():empty"),null;const h=this.ss.front(),g=h.low;return g+1<=h.high?++h.low:this.ss.eraseElementByPos(0),c("alloc():"+g),g},p.prototype.use=function(h){const g=new d(h,h),v=this.ss.lowerBound(g);if(v){if(v.equals(g))return this.ss.eraseElementByValue(v),c("use():"+h),!0;if(v.low>h)return!1;if(v.low===h)return++v.low,c("use():"+h),!0;if(v.high===h)return--v.high,c("use():"+h),!0;const y=v.low;return v.low=h+1,this.ss.insert(new d(y,h-1)),c("use():"+h),!0}return c("use():failed"),!1},p.prototype.free=function(h){if(h<this.min||h>this.max){f("free():"+h+" is out of range");return}const g=new d(h,h),v=this.ss.lowerBound(g);if(v){if(v.low<=h&&h<=v.high){f("free():"+h+" has already been vacant");return}if(v===this.ss.front())h+1===v.low?--v.low:this.ss.insert(g);else{const y=this.ss.reverseLowerBound(g);y.high+1===h?h+1===v.low?(this.ss.eraseElementByValue(y),v.low=y.low):y.high=h:h+1===v.low?v.low=h:this.ss.insert(g)}}else{if(v===this.ss.front()){this.ss.insert(g);return}const y=this.ss.reverseLowerBound(g);y.high+1===h?y.high=h:this.ss.insert(g)}c("free():"+h)},p.prototype.clear=function(){c("clear()"),this.ss.clear(),this.ss.insert(new d(this.min,this.max))},p.prototype.intervalCount=function(){return this.ss.size()},p.prototype.dump=function(){console.log("length:"+this.ss.size());for(const h of this.ss)console.log(h)},o.exports=p},{debug:18,"js-sdsl":36}],48:[function(i,o,a){var u=i("wrappy");o.exports=u(c),o.exports.strict=u(f),c.proto=c(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return c(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return f(this)},configurable:!0})});function c(d){var p=function(){return p.called?p.value:(p.called=!0,p.value=d.apply(this,arguments))};return p.called=!1,p}function f(d){var p=function(){if(p.called)throw new Error(p.onceError);return p.called=!0,p.value=d.apply(this,arguments)},h=d.name||"Function wrapped with `once`";return p.onceError=h+" shouldn't be called more than once",p.called=!1,p}},{wrappy:79}],49:[function(i,o,a){(function(u){(function(){typeof u>"u"||!u.version||u.version.indexOf("v0.")===0||u.version.indexOf("v1.")===0&&u.version.indexOf("v1.8.")!==0?o.exports={nextTick:c}:o.exports=u;function c(f,d,p,h){if(typeof f!="function")throw new TypeError('"callback" argument must be a function');var g=arguments.length,v,y;switch(g){case 0:case 1:return u.nextTick(f);case 2:return u.nextTick(function(){f.call(null,d)});case 3:return u.nextTick(function(){f.call(null,d,p)});case 4:return u.nextTick(function(){f.call(null,d,p,h)});default:for(v=new Array(g-1),y=0;y<v.length;)v[y++]=arguments[y];return u.nextTick(function(){f.apply(null,v)})}}}).call(this)}).call(this,i("_process"))},{_process:50}],50:[function(i,o,a){var u=o.exports={},c,f;function d(){throw new Error("setTimeout has not been defined")}function p(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?c=setTimeout:c=d}catch{c=d}try{typeof clearTimeout=="function"?f=clearTimeout:f=p}catch{f=p}})();function h(x){if(c===setTimeout)return setTimeout(x,0);if((c===d||!c)&&setTimeout)return c=setTimeout,setTimeout(x,0);try{return c(x,0)}catch{try{return c.call(null,x,0)}catch{return c.call(this,x,0)}}}function g(x){if(f===clearTimeout)return clearTimeout(x);if((f===p||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(x);try{return f(x)}catch{try{return f.call(null,x)}catch{return f.call(this,x)}}}var v=[],y=!1,A,_=-1;function S(){!y||!A||(y=!1,A.length?v=A.concat(v):_=-1,v.length&&b())}function b(){if(!y){var x=h(S);y=!0;for(var k=v.length;k;){for(A=v,v=[];++_<k;)A&&A[_].run();_=-1,k=v.length}A=null,y=!1,g(x)}}u.nextTick=function(x){var k=new Array(arguments.length-1);if(arguments.length>1)for(var M=1;M<arguments.length;M++)k[M-1]=arguments[M];v.push(new T(x,k)),v.length===1&&!y&&h(b)};function T(x,k){this.fun=x,this.array=k}T.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={};function w(){}u.on=w,u.addListener=w,u.once=w,u.off=w,u.removeListener=w,u.removeAllListeners=w,u.emit=w,u.prependListener=w,u.prependOnceListener=w,u.listeners=function(x){return[]},u.binding=function(x){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(x){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],51:[function(i,o,a){(function(u){(function(){(function(c){var f=typeof a=="object"&&a&&!a.nodeType&&a,d=typeof o=="object"&&o&&!o.nodeType&&o,p=typeof u=="object"&&u;(p.global===p||p.window===p||p.self===p)&&(c=p);var h,g=2147483647,v=36,y=1,A=26,_=38,S=700,b=72,T=128,w="-",x=/^xn--/,k=/[^\x20-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,D={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=v-y,j=Math.floor,oe=String.fromCharCode,L;function F(Fe){throw new RangeError(D[Fe])}function O(Fe,$e){for(var Cn=Fe.length,Lt=[];Cn--;)Lt[Cn]=$e(Fe[Cn]);return Lt}function ue(Fe,$e){var Cn=Fe.split("@"),Lt="";Cn.length>1&&(Lt=Cn[0]+"@",Fe=Cn[1]),Fe=Fe.replace(M,".");var In=Fe.split("."),Et=O(In,$e).join(".");return Lt+Et}function _e(Fe){for(var $e=[],Cn=0,Lt=Fe.length,In,Et;Cn<Lt;)In=Fe.charCodeAt(Cn++),In>=55296&&In<=56319&&Cn<Lt?(Et=Fe.charCodeAt(Cn++),(Et&64512)==56320?$e.push(((In&1023)<<10)+(Et&1023)+65536):($e.push(In),Cn--)):$e.push(In);return $e}function Ce(Fe){return O(Fe,function($e){var Cn="";return $e>65535&&($e-=65536,Cn+=oe($e>>>10&1023|55296),$e=56320|$e&1023),Cn+=oe($e),Cn}).join("")}function de(Fe){return Fe-48<10?Fe-22:Fe-65<26?Fe-65:Fe-97<26?Fe-97:v}function ie(Fe,$e){return Fe+22+75*(Fe<26)-(($e!=0)<<5)}function Y(Fe,$e,Cn){var Lt=0;for(Fe=Cn?j(Fe/S):Fe>>1,Fe+=j(Fe/$e);Fe>z*A>>1;Lt+=v)Fe=j(Fe/z);return j(Lt+(z+1)*Fe/(Fe+_))}function Ie(Fe){var $e=[],Cn=Fe.length,Lt,In=0,Et=T,Ne=b,pe,At,Ve,xe,ze,Pt,hn,ae,le;for(pe=Fe.lastIndexOf(w),pe<0&&(pe=0),At=0;At<pe;++At)Fe.charCodeAt(At)>=128&&F("not-basic"),$e.push(Fe.charCodeAt(At));for(Ve=pe>0?pe+1:0;Ve<Cn;){for(xe=In,ze=1,Pt=v;Ve>=Cn&&F("invalid-input"),hn=de(Fe.charCodeAt(Ve++)),(hn>=v||hn>j((g-In)/ze))&&F("overflow"),In+=hn*ze,ae=Pt<=Ne?y:Pt>=Ne+A?A:Pt-Ne,!(hn<ae);Pt+=v)le=v-ae,ze>j(g/le)&&F("overflow"),ze*=le;Lt=$e.length+1,Ne=Y(In-xe,Lt,xe==0),j(In/Lt)>g-Et&&F("overflow"),Et+=j(In/Lt),In%=Lt,$e.splice(In++,0,Et)}return Ce($e)}function Oe(Fe){var $e,Cn,Lt,In,Et,Ne,pe,At,Ve,xe,ze,Pt=[],hn,ae,le,re;for(Fe=_e(Fe),hn=Fe.length,$e=T,Cn=0,Et=b,Ne=0;Ne<hn;++Ne)ze=Fe[Ne],ze<128&&Pt.push(oe(ze));for(Lt=In=Pt.length,In&&Pt.push(w);Lt<hn;){for(pe=g,Ne=0;Ne<hn;++Ne)ze=Fe[Ne],ze>=$e&&ze<pe&&(pe=ze);for(ae=Lt+1,pe-$e>j((g-Cn)/ae)&&F("overflow"),Cn+=(pe-$e)*ae,$e=pe,Ne=0;Ne<hn;++Ne)if(ze=Fe[Ne],ze<$e&&++Cn>g&&F("overflow"),ze==$e){for(At=Cn,Ve=v;xe=Ve<=Et?y:Ve>=Et+A?A:Ve-Et,!(At<xe);Ve+=v)re=At-xe,le=v-xe,Pt.push(oe(ie(xe+re%le,0))),At=j(re/le);Pt.push(oe(ie(At,0))),Et=Y(Cn,ae,Lt==In),Cn=0,++Lt}++Cn,++$e}return Pt.join("")}function kt(Fe){return ue(Fe,function($e){return x.test($e)?Ie($e.slice(4).toLowerCase()):$e})}function Dt(Fe){return ue(Fe,function($e){return k.test($e)?"xn--"+Oe($e):$e})}if(h={version:"1.4.1",ucs2:{decode:_e,encode:Ce},decode:Ie,encode:Oe,toASCII:Dt,toUnicode:kt},f&&d)if(o.exports==f)d.exports=h;else for(L in h)h.hasOwnProperty(L)&&(f[L]=h[L]);else c.punycode=h})(this)}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(i,o,a){function u(f,d){return Object.prototype.hasOwnProperty.call(f,d)}o.exports=function(f,d,p,h){d=d||"&",p=p||"=";var g={};if(typeof f!="string"||f.length===0)return g;var v=/\+/g;f=f.split(d);var y=1e3;h&&typeof h.maxKeys=="number"&&(y=h.maxKeys);var A=f.length;y>0&&A>y&&(A=y);for(var _=0;_<A;++_){var S=f[_].replace(v,"%20"),b=S.indexOf(p),T,w,x,k;b>=0?(T=S.substr(0,b),w=S.substr(b+1)):(T=S,w=""),x=decodeURIComponent(T),k=decodeURIComponent(w),u(g,x)?c(g[x])?g[x].push(k):g[x]=[g[x],k]:g[x]=k}return g};var c=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"}},{}],53:[function(i,o,a){var u=function(p){switch(typeof p){case"string":return p;case"boolean":return p?"true":"false";case"number":return isFinite(p)?p:"";default:return""}};o.exports=function(p,h,g,v){return h=h||"&",g=g||"=",p===null&&(p=void 0),typeof p=="object"?f(d(p),function(y){var A=encodeURIComponent(u(y))+g;return c(p[y])?f(p[y],function(_){return A+encodeURIComponent(u(_))}).join(h):A+encodeURIComponent(u(p[y]))}).join(h):v?encodeURIComponent(u(v))+g+encodeURIComponent(u(p)):""};var c=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"};function f(p,h){if(p.map)return p.map(h);for(var g=[],v=0;v<p.length;v++)g.push(h(p[v],v));return g}var d=Object.keys||function(p){var h=[];for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&h.push(g);return h}},{}],54:[function(i,o,a){a.decode=a.parse=i("./decode"),a.encode=a.stringify=i("./encode")},{"./decode":52,"./encode":53}],55:[function(i,o,a){function u(v,y){v.prototype=Object.create(y.prototype),v.prototype.constructor=v,v.__proto__=y}var c={};function f(v,y,A){A||(A=Error);function _(b,T,w){return typeof y=="string"?y:y(b,T,w)}var S=function(b){u(T,b);function T(w,x,k){return b.call(this,_(w,x,k))||this}return T}(A);S.prototype.name=A.name,S.prototype.code=v,c[v]=S}function d(v,y){if(Array.isArray(v)){var A=v.length;return v=v.map(function(_){return String(_)}),A>2?"one of ".concat(y," ").concat(v.slice(0,A-1).join(", "),", or ")+v[A-1]:A===2?"one of ".concat(y," ").concat(v[0]," or ").concat(v[1]):"of ".concat(y," ").concat(v[0])}else return"of ".concat(y," ").concat(String(v))}function p(v,y,A){return v.substr(!A||A<0?0:+A,y.length)===y}function h(v,y,A){return(A===void 0||A>v.length)&&(A=v.length),v.substring(A-y.length,A)===y}function g(v,y,A){return typeof A!="number"&&(A=0),A+y.length>v.length?!1:v.indexOf(y,A)!==-1}f("ERR_INVALID_OPT_VALUE",function(v,y){return'The value "'+y+'" is invalid for option "'+v+'"'},TypeError),f("ERR_INVALID_ARG_TYPE",function(v,y,A){var _;typeof y=="string"&&p(y,"not ")?(_="must not be",y=y.replace(/^not /,"")):_="must be";var S;if(h(v," argument"))S="The ".concat(v," ").concat(_," ").concat(d(y,"type"));else{var b=g(v,".")?"property":"argument";S='The "'.concat(v,'" ').concat(b," ").concat(_," ").concat(d(y,"type"))}return S+=". Received type ".concat(typeof A),S},TypeError),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),f("ERR_METHOD_NOT_IMPLEMENTED",function(v){return"The "+v+" method is not implemented"}),f("ERR_STREAM_PREMATURE_CLOSE","Premature close"),f("ERR_STREAM_DESTROYED",function(v){return"Cannot call "+v+" after a stream was destroyed"}),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),f("ERR_STREAM_WRITE_AFTER_END","write after end"),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_UNKNOWN_ENCODING",function(v){return"Unknown encoding: "+v},TypeError),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),o.exports.codes=c},{}],56:[function(i,o,a){(function(u){(function(){var c=Object.keys||function(_){var S=[];for(var b in _)S.push(b);return S};o.exports=v;var f=i("./_stream_readable"),d=i("./_stream_writable");i("inherits")(v,f);for(var p=c(d.prototype),h=0;h<p.length;h++){var g=p[h];v.prototype[g]||(v.prototype[g]=d.prototype[g])}function v(_){if(!(this instanceof v))return new v(_);f.call(this,_),d.call(this,_),this.allowHalfOpen=!0,_&&(_.readable===!1&&(this.readable=!1),_.writable===!1&&(this.writable=!1),_.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",y)))}Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(v.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(v.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function y(){this._writableState.ended||u.nextTick(A,this)}function A(_){_.end()}Object.defineProperty(v.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=S,this._writableState.destroyed=S)}})}).call(this)}).call(this,i("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(i,o,a){o.exports=c;var u=i("./_stream_transform");i("inherits")(c,u);function c(f){if(!(this instanceof c))return new c(f);u.call(this,f)}c.prototype._transform=function(f,d,p){p(null,f)}},{"./_stream_transform":59,inherits:24}],58:[function(i,o,a){(function(u,c){(function(){o.exports=Ce;var f;Ce.ReadableState=_e,i("events").EventEmitter;var d=function(le,re){return le.listeners(re).length},p=i("./internal/streams/stream"),h=i("buffer").Buffer,g=c.Uint8Array||function(){};function v(ae){return h.from(ae)}function y(ae){return h.isBuffer(ae)||ae instanceof g}var A=i("util"),_;A&&A.debuglog?_=A.debuglog("stream"):_=function(){};var S=i("./internal/streams/buffer_list"),b=i("./internal/streams/destroy"),T=i("./internal/streams/state"),w=T.getHighWaterMark,x=i("../errors").codes,k=x.ERR_INVALID_ARG_TYPE,M=x.ERR_STREAM_PUSH_AFTER_EOF,D=x.ERR_METHOD_NOT_IMPLEMENTED,z=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,j,oe,L;i("inherits")(Ce,p);var F=b.errorOrDestroy,O=["error","close","destroy","pause","resume"];function ue(ae,le,re){if(typeof ae.prependListener=="function")return ae.prependListener(le,re);!ae._events||!ae._events[le]?ae.on(le,re):Array.isArray(ae._events[le])?ae._events[le].unshift(re):ae._events[le]=[re,ae._events[le]]}function _e(ae,le,re){f=f||i("./_stream_duplex"),ae=ae||{},typeof re!="boolean"&&(re=le instanceof f),this.objectMode=!!ae.objectMode,re&&(this.objectMode=this.objectMode||!!ae.readableObjectMode),this.highWaterMark=w(this,ae,"readableHighWaterMark",re),this.buffer=new S,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=ae.emitClose!==!1,this.autoDestroy=!!ae.autoDestroy,this.destroyed=!1,this.defaultEncoding=ae.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,ae.encoding&&(j||(j=i("string_decoder/").StringDecoder),this.decoder=new j(ae.encoding),this.encoding=ae.encoding)}function Ce(ae){if(f=f||i("./_stream_duplex"),!(this instanceof Ce))return new Ce(ae);var le=this instanceof f;this._readableState=new _e(ae,this,le),this.readable=!0,ae&&(typeof ae.read=="function"&&(this._read=ae.read),typeof ae.destroy=="function"&&(this._destroy=ae.destroy)),p.call(this)}Object.defineProperty(Ce.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(le){this._readableState&&(this._readableState.destroyed=le)}}),Ce.prototype.destroy=b.destroy,Ce.prototype._undestroy=b.undestroy,Ce.prototype._destroy=function(ae,le){le(ae)},Ce.prototype.push=function(ae,le){var re=this._readableState,V;return re.objectMode?V=!0:typeof ae=="string"&&(le=le||re.defaultEncoding,le!==re.encoding&&(ae=h.from(ae,le),le=""),V=!0),de(this,ae,le,!1,V)},Ce.prototype.unshift=function(ae){return de(this,ae,null,!0,!1)};function de(ae,le,re,V,$){_("readableAddChunk",le);var he=ae._readableState;if(le===null)he.reading=!1,Dt(ae,he);else{var Ue;if($||(Ue=Y(he,le)),Ue)F(ae,Ue);else if(he.objectMode||le&&le.length>0)if(typeof le!="string"&&!he.objectMode&&Object.getPrototypeOf(le)!==h.prototype&&(le=v(le)),V)he.endEmitted?F(ae,new z):ie(ae,he,le,!0);else if(he.ended)F(ae,new M);else{if(he.destroyed)return!1;he.reading=!1,he.decoder&&!re?(le=he.decoder.write(le),he.objectMode||le.length!==0?ie(ae,he,le,!1):Cn(ae,he)):ie(ae,he,le,!1)}else V||(he.reading=!1,Cn(ae,he))}return!he.ended&&(he.length<he.highWaterMark||he.length===0)}function ie(ae,le,re,V){le.flowing&&le.length===0&&!le.sync?(le.awaitDrain=0,ae.emit("data",re)):(le.length+=le.objectMode?1:re.length,V?le.buffer.unshift(re):le.buffer.push(re),le.needReadable&&Fe(ae)),Cn(ae,le)}function Y(ae,le){var re;return!y(le)&&typeof le!="string"&&le!==void 0&&!ae.objectMode&&(re=new k("chunk",["string","Buffer","Uint8Array"],le)),re}Ce.prototype.isPaused=function(){return this._readableState.flowing===!1},Ce.prototype.setEncoding=function(ae){j||(j=i("string_decoder/").StringDecoder);var le=new j(ae);this._readableState.decoder=le,this._readableState.encoding=this._readableState.decoder.encoding;for(var re=this._readableState.buffer.head,V="";re!==null;)V+=le.write(re.data),re=re.next;return this._readableState.buffer.clear(),V!==""&&this._readableState.buffer.push(V),this._readableState.length=V.length,this};var Ie=1073741824;function Oe(ae){return ae>=Ie?ae=Ie:(ae--,ae|=ae>>>1,ae|=ae>>>2,ae|=ae>>>4,ae|=ae>>>8,ae|=ae>>>16,ae++),ae}function kt(ae,le){return ae<=0||le.length===0&&le.ended?0:le.objectMode?1:ae!==ae?le.flowing&&le.length?le.buffer.head.data.length:le.length:(ae>le.highWaterMark&&(le.highWaterMark=Oe(ae)),ae<=le.length?ae:le.ended?le.length:(le.needReadable=!0,0))}Ce.prototype.read=function(ae){_("read",ae),ae=parseInt(ae,10);var le=this._readableState,re=ae;if(ae!==0&&(le.emittedReadable=!1),ae===0&&le.needReadable&&((le.highWaterMark!==0?le.length>=le.highWaterMark:le.length>0)||le.ended))return _("read: emitReadable",le.length,le.ended),le.length===0&&le.ended?ze(this):Fe(this),null;if(ae=kt(ae,le),ae===0&&le.ended)return le.length===0&&ze(this),null;var V=le.needReadable;_("need readable",V),(le.length===0||le.length-ae<le.highWaterMark)&&(V=!0,_("length less than watermark",V)),le.ended||le.reading?(V=!1,_("reading or ended",V)):V&&(_("do read"),le.reading=!0,le.sync=!0,le.length===0&&(le.needReadable=!0),this._read(le.highWaterMark),le.sync=!1,le.reading||(ae=kt(re,le)));var $;return ae>0?$=xe(ae,le):$=null,$===null?(le.needReadable=le.length<=le.highWaterMark,ae=0):(le.length-=ae,le.awaitDrain=0),le.length===0&&(le.ended||(le.needReadable=!0),re!==ae&&le.ended&&ze(this)),$!==null&&this.emit("data",$),$};function Dt(ae,le){if(_("onEofChunk"),!le.ended){if(le.decoder){var re=le.decoder.end();re&&re.length&&(le.buffer.push(re),le.length+=le.objectMode?1:re.length)}le.ended=!0,le.sync?Fe(ae):(le.needReadable=!1,le.emittedReadable||(le.emittedReadable=!0,$e(ae)))}}function Fe(ae){var le=ae._readableState;_("emitReadable",le.needReadable,le.emittedReadable),le.needReadable=!1,le.emittedReadable||(_("emitReadable",le.flowing),le.emittedReadable=!0,u.nextTick($e,ae))}function $e(ae){var le=ae._readableState;_("emitReadable_",le.destroyed,le.length,le.ended),!le.destroyed&&(le.length||le.ended)&&(ae.emit("readable"),le.emittedReadable=!1),le.needReadable=!le.flowing&&!le.ended&&le.length<=le.highWaterMark,Ve(ae)}function Cn(ae,le){le.readingMore||(le.readingMore=!0,u.nextTick(Lt,ae,le))}function Lt(ae,le){for(;!le.reading&&!le.ended&&(le.length<le.highWaterMark||le.flowing&&le.length===0);){var re=le.length;if(_("maybeReadMore read 0"),ae.read(0),re===le.length)break}le.readingMore=!1}Ce.prototype._read=function(ae){F(this,new D("_read()"))},Ce.prototype.pipe=function(ae,le){var re=this,V=this._readableState;switch(V.pipesCount){case 0:V.pipes=ae;break;case 1:V.pipes=[V.pipes,ae];break;default:V.pipes.push(ae);break}V.pipesCount+=1,_("pipe count=%d opts=%j",V.pipesCount,le);var $=(!le||le.end!==!1)&&ae!==u.stdout&&ae!==u.stderr,he=$?qe:kn;V.endEmitted?u.nextTick(he):re.once("end",he),ae.on("unpipe",Ue);function Ue(Rn,Nn){_("onunpipe"),Rn===re&&Nn&&Nn.hasUnpiped===!1&&(Nn.hasUnpiped=!0,wn())}function qe(){_("onend"),ae.end()}var jt=In(re);ae.on("drain",jt);var An=!1;function wn(){_("cleanup"),ae.removeListener("close",Tn),ae.removeListener("finish",Pn),ae.removeListener("drain",jt),ae.removeListener("error",xn),ae.removeListener("unpipe",Ue),re.removeListener("end",qe),re.removeListener("end",kn),re.removeListener("data",En),An=!0,V.awaitDrain&&(!ae._writableState||ae._writableState.needDrain)&&jt()}re.on("data",En);function En(Rn){_("ondata");var Nn=ae.write(Rn);_("dest.write",Nn),Nn===!1&&((V.pipesCount===1&&V.pipes===ae||V.pipesCount>1&&hn(V.pipes,ae)!==-1)&&!An&&(_("false write response, pause",V.awaitDrain),V.awaitDrain++),re.pause())}function xn(Rn){_("onerror",Rn),kn(),ae.removeListener("error",xn),d(ae,"error")===0&&F(ae,Rn)}ue(ae,"error",xn);function Tn(){ae.removeListener("finish",Pn),kn()}ae.once("close",Tn);function Pn(){_("onfinish"),ae.removeListener("close",Tn),kn()}ae.once("finish",Pn);function kn(){_("unpipe"),re.unpipe(ae)}return ae.emit("pipe",re),V.flowing||(_("pipe resume"),re.resume()),ae};function In(ae){return function(){var re=ae._readableState;_("pipeOnDrain",re.awaitDrain),re.awaitDrain&&re.awaitDrain--,re.awaitDrain===0&&d(ae,"data")&&(re.flowing=!0,Ve(ae))}}Ce.prototype.unpipe=function(ae){var le=this._readableState,re={hasUnpiped:!1};if(le.pipesCount===0)return this;if(le.pipesCount===1)return ae&&ae!==le.pipes?this:(ae||(ae=le.pipes),le.pipes=null,le.pipesCount=0,le.flowing=!1,ae&&ae.emit("unpipe",this,re),this);if(!ae){var V=le.pipes,$=le.pipesCount;le.pipes=null,le.pipesCount=0,le.flowing=!1;for(var he=0;he<$;he++)V[he].emit("unpipe",this,{hasUnpiped:!1});return this}var Ue=hn(le.pipes,ae);return Ue===-1?this:(le.pipes.splice(Ue,1),le.pipesCount-=1,le.pipesCount===1&&(le.pipes=le.pipes[0]),ae.emit("unpipe",this,re),this)},Ce.prototype.on=function(ae,le){var re=p.prototype.on.call(this,ae,le),V=this._readableState;return ae==="data"?(V.readableListening=this.listenerCount("readable")>0,V.flowing!==!1&&this.resume()):ae==="readable"&&!V.endEmitted&&!V.readableListening&&(V.readableListening=V.needReadable=!0,V.flowing=!1,V.emittedReadable=!1,_("on readable",V.length,V.reading),V.length?Fe(this):V.reading||u.nextTick(Ne,this)),re},Ce.prototype.addListener=Ce.prototype.on,Ce.prototype.removeListener=function(ae,le){var re=p.prototype.removeListener.call(this,ae,le);return ae==="readable"&&u.nextTick(Et,this),re},Ce.prototype.removeAllListeners=function(ae){var le=p.prototype.removeAllListeners.apply(this,arguments);return(ae==="readable"||ae===void 0)&&u.nextTick(Et,this),le};function Et(ae){var le=ae._readableState;le.readableListening=ae.listenerCount("readable")>0,le.resumeScheduled&&!le.paused?le.flowing=!0:ae.listenerCount("data")>0&&ae.resume()}function Ne(ae){_("readable nexttick read 0"),ae.read(0)}Ce.prototype.resume=function(){var ae=this._readableState;return ae.flowing||(_("resume"),ae.flowing=!ae.readableListening,pe(this,ae)),ae.paused=!1,this};function pe(ae,le){le.resumeScheduled||(le.resumeScheduled=!0,u.nextTick(At,ae,le))}function At(ae,le){_("resume",le.reading),le.reading||ae.read(0),le.resumeScheduled=!1,ae.emit("resume"),Ve(ae),le.flowing&&!le.reading&&ae.read(0)}Ce.prototype.pause=function(){return _("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(_("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Ve(ae){var le=ae._readableState;for(_("flow",le.flowing);le.flowing&&ae.read()!==null;);}Ce.prototype.wrap=function(ae){var le=this,re=this._readableState,V=!1;ae.on("end",function(){if(_("wrapped end"),re.decoder&&!re.ended){var Ue=re.decoder.end();Ue&&Ue.length&&le.push(Ue)}le.push(null)}),ae.on("data",function(Ue){if(_("wrapped data"),re.decoder&&(Ue=re.decoder.write(Ue)),!(re.objectMode&&Ue==null)&&!(!re.objectMode&&(!Ue||!Ue.length))){var qe=le.push(Ue);qe||(V=!0,ae.pause())}});for(var $ in ae)this[$]===void 0&&typeof ae[$]=="function"&&(this[$]=function(qe){return function(){return ae[qe].apply(ae,arguments)}}($));for(var he=0;he<O.length;he++)ae.on(O[he],this.emit.bind(this,O[he]));return this._read=function(Ue){_("wrapped _read",Ue),V&&(V=!1,ae.resume())},this},typeof Symbol=="function"&&(Ce.prototype[Symbol.asyncIterator]=function(){return oe===void 0&&(oe=i("./internal/streams/async_iterator")),oe(this)}),Object.defineProperty(Ce.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Ce.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Ce.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(le){this._readableState&&(this._readableState.flowing=le)}}),Ce._fromList=xe,Object.defineProperty(Ce.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function xe(ae,le){if(le.length===0)return null;var re;return le.objectMode?re=le.buffer.shift():!ae||ae>=le.length?(le.decoder?re=le.buffer.join(""):le.buffer.length===1?re=le.buffer.first():re=le.buffer.concat(le.length),le.buffer.clear()):re=le.buffer.consume(ae,le.decoder),re}function ze(ae){var le=ae._readableState;_("endReadable",le.endEmitted),le.endEmitted||(le.ended=!0,u.nextTick(Pt,le,ae))}function Pt(ae,le){if(_("endReadableNT",ae.endEmitted,ae.length),!ae.endEmitted&&ae.length===0&&(ae.endEmitted=!0,le.readable=!1,le.emit("end"),ae.autoDestroy)){var re=le._writableState;(!re||re.autoDestroy&&re.finished)&&le.destroy()}}typeof Symbol=="function"&&(Ce.from=function(ae,le){return L===void 0&&(L=i("./internal/streams/from")),L(Ce,ae,le)});function hn(ae,le){for(var re=0,V=ae.length;re<V;re++)if(ae[re]===le)return re;return-1}}).call(this)}).call(this,i("_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(i,o,a){o.exports=v;var u=i("../errors").codes,c=u.ERR_METHOD_NOT_IMPLEMENTED,f=u.ERR_MULTIPLE_CALLBACK,d=u.ERR_TRANSFORM_ALREADY_TRANSFORMING,p=u.ERR_TRANSFORM_WITH_LENGTH_0,h=i("./_stream_duplex");i("inherits")(v,h);function g(_,S){var b=this._transformState;b.transforming=!1;var T=b.writecb;if(T===null)return this.emit("error",new f);b.writechunk=null,b.writecb=null,S!=null&&this.push(S),T(_);var w=this._readableState;w.reading=!1,(w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}function v(_){if(!(this instanceof v))return new v(_);h.call(this,_),this._transformState={afterTransform:g.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,_&&(typeof _.transform=="function"&&(this._transform=_.transform),typeof _.flush=="function"&&(this._flush=_.flush)),this.on("prefinish",y)}function y(){var _=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(S,b){A(_,S,b)}):A(this,null,null)}v.prototype.push=function(_,S){return this._transformState.needTransform=!1,h.prototype.push.call(this,_,S)},v.prototype._transform=function(_,S,b){b(new c("_transform()"))},v.prototype._write=function(_,S,b){var T=this._transformState;if(T.writecb=b,T.writechunk=_,T.writeencoding=S,!T.transforming){var w=this._readableState;(T.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},v.prototype._read=function(_){var S=this._transformState;S.writechunk!==null&&!S.transforming?(S.transforming=!0,this._transform(S.writechunk,S.writeencoding,S.afterTransform)):S.needTransform=!0},v.prototype._destroy=function(_,S){h.prototype._destroy.call(this,_,function(b){S(b)})};function A(_,S,b){if(S)return _.emit("error",S);if(b!=null&&_.push(b),_._writableState.length)throw new p;if(_._transformState.transforming)throw new d;return _.push(null)}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(i,o,a){(function(u,c){(function(){o.exports=_e;function f(Ve){var xe=this;this.next=null,this.entry=null,this.finish=function(){At(xe,Ve)}}var d;_e.WritableState=O;var p={deprecate:i("util-deprecate")},h=i("./internal/streams/stream"),g=i("buffer").Buffer,v=c.Uint8Array||function(){};function y(Ve){return g.from(Ve)}function A(Ve){return g.isBuffer(Ve)||Ve instanceof v}var _=i("./internal/streams/destroy"),S=i("./internal/streams/state"),b=S.getHighWaterMark,T=i("../errors").codes,w=T.ERR_INVALID_ARG_TYPE,x=T.ERR_METHOD_NOT_IMPLEMENTED,k=T.ERR_MULTIPLE_CALLBACK,M=T.ERR_STREAM_CANNOT_PIPE,D=T.ERR_STREAM_DESTROYED,z=T.ERR_STREAM_NULL_VALUES,j=T.ERR_STREAM_WRITE_AFTER_END,oe=T.ERR_UNKNOWN_ENCODING,L=_.errorOrDestroy;i("inherits")(_e,h);function F(){}function O(Ve,xe,ze){d=d||i("./_stream_duplex"),Ve=Ve||{},typeof ze!="boolean"&&(ze=xe instanceof d),this.objectMode=!!Ve.objectMode,ze&&(this.objectMode=this.objectMode||!!Ve.writableObjectMode),this.highWaterMark=b(this,Ve,"writableHighWaterMark",ze),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Pt=Ve.decodeStrings===!1;this.decodeStrings=!Pt,this.defaultEncoding=Ve.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(hn){Dt(xe,hn)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Ve.emitClose!==!1,this.autoDestroy=!!Ve.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new f(this)}O.prototype.getBuffer=function(){for(var xe=this.bufferedRequest,ze=[];xe;)ze.push(xe),xe=xe.next;return ze},function(){try{Object.defineProperty(O.prototype,"buffer",{get:p.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var ue;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ue=Function.prototype[Symbol.hasInstance],Object.defineProperty(_e,Symbol.hasInstance,{value:function(xe){return ue.call(this,xe)?!0:this!==_e?!1:xe&&xe._writableState instanceof O}})):ue=function(xe){return xe instanceof this};function _e(Ve){d=d||i("./_stream_duplex");var xe=this instanceof d;if(!xe&&!ue.call(_e,this))return new _e(Ve);this._writableState=new O(Ve,this,xe),this.writable=!0,Ve&&(typeof Ve.write=="function"&&(this._write=Ve.write),typeof Ve.writev=="function"&&(this._writev=Ve.writev),typeof Ve.destroy=="function"&&(this._destroy=Ve.destroy),typeof Ve.final=="function"&&(this._final=Ve.final)),h.call(this)}_e.prototype.pipe=function(){L(this,new M)};function Ce(Ve,xe){var ze=new j;L(Ve,ze),u.nextTick(xe,ze)}function de(Ve,xe,ze,Pt){var hn;return ze===null?hn=new z:typeof ze!="string"&&!xe.objectMode&&(hn=new w("chunk",["string","Buffer"],ze)),hn?(L(Ve,hn),u.nextTick(Pt,hn),!1):!0}_e.prototype.write=function(Ve,xe,ze){var Pt=this._writableState,hn=!1,ae=!Pt.objectMode&&A(Ve);return ae&&!g.isBuffer(Ve)&&(Ve=y(Ve)),typeof xe=="function"&&(ze=xe,xe=null),ae?xe="buffer":xe||(xe=Pt.defaultEncoding),typeof ze!="function"&&(ze=F),Pt.ending?Ce(this,ze):(ae||de(this,Pt,Ve,ze))&&(Pt.pendingcb++,hn=Y(this,Pt,ae,Ve,xe,ze)),hn},_e.prototype.cork=function(){this._writableState.corked++},_e.prototype.uncork=function(){var Ve=this._writableState;Ve.corked&&(Ve.corked--,!Ve.writing&&!Ve.corked&&!Ve.bufferProcessing&&Ve.bufferedRequest&&Cn(this,Ve))},_e.prototype.setDefaultEncoding=function(xe){if(typeof xe=="string"&&(xe=xe.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((xe+"").toLowerCase())>-1))throw new oe(xe);return this._writableState.defaultEncoding=xe,this},Object.defineProperty(_e.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ie(Ve,xe,ze){return!Ve.objectMode&&Ve.decodeStrings!==!1&&typeof xe=="string"&&(xe=g.from(xe,ze)),xe}Object.defineProperty(_e.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Y(Ve,xe,ze,Pt,hn,ae){if(!ze){var le=ie(xe,Pt,hn);Pt!==le&&(ze=!0,hn="buffer",Pt=le)}var re=xe.objectMode?1:Pt.length;xe.length+=re;var V=xe.length<xe.highWaterMark;if(V||(xe.needDrain=!0),xe.writing||xe.corked){var $=xe.lastBufferedRequest;xe.lastBufferedRequest={chunk:Pt,encoding:hn,isBuf:ze,callback:ae,next:null},$?$.next=xe.lastBufferedRequest:xe.bufferedRequest=xe.lastBufferedRequest,xe.bufferedRequestCount+=1}else Ie(Ve,xe,!1,re,Pt,hn,ae);return V}function Ie(Ve,xe,ze,Pt,hn,ae,le){xe.writelen=Pt,xe.writecb=le,xe.writing=!0,xe.sync=!0,xe.destroyed?xe.onwrite(new D("write")):ze?Ve._writev(hn,xe.onwrite):Ve._write(hn,ae,xe.onwrite),xe.sync=!1}function Oe(Ve,xe,ze,Pt,hn){--xe.pendingcb,ze?(u.nextTick(hn,Pt),u.nextTick(Ne,Ve,xe),Ve._writableState.errorEmitted=!0,L(Ve,Pt)):(hn(Pt),Ve._writableState.errorEmitted=!0,L(Ve,Pt),Ne(Ve,xe))}function kt(Ve){Ve.writing=!1,Ve.writecb=null,Ve.length-=Ve.writelen,Ve.writelen=0}function Dt(Ve,xe){var ze=Ve._writableState,Pt=ze.sync,hn=ze.writecb;if(typeof hn!="function")throw new k;if(kt(ze),xe)Oe(Ve,ze,Pt,xe,hn);else{var ae=Lt(ze)||Ve.destroyed;!ae&&!ze.corked&&!ze.bufferProcessing&&ze.bufferedRequest&&Cn(Ve,ze),Pt?u.nextTick(Fe,Ve,ze,ae,hn):Fe(Ve,ze,ae,hn)}}function Fe(Ve,xe,ze,Pt){ze||$e(Ve,xe),xe.pendingcb--,Pt(),Ne(Ve,xe)}function $e(Ve,xe){xe.length===0&&xe.needDrain&&(xe.needDrain=!1,Ve.emit("drain"))}function Cn(Ve,xe){xe.bufferProcessing=!0;var ze=xe.bufferedRequest;if(Ve._writev&&ze&&ze.next){var Pt=xe.bufferedRequestCount,hn=new Array(Pt),ae=xe.corkedRequestsFree;ae.entry=ze;for(var le=0,re=!0;ze;)hn[le]=ze,ze.isBuf||(re=!1),ze=ze.next,le+=1;hn.allBuffers=re,Ie(Ve,xe,!0,xe.length,hn,"",ae.finish),xe.pendingcb++,xe.lastBufferedRequest=null,ae.next?(xe.corkedRequestsFree=ae.next,ae.next=null):xe.corkedRequestsFree=new f(xe),xe.bufferedRequestCount=0}else{for(;ze;){var V=ze.chunk,$=ze.encoding,he=ze.callback,Ue=xe.objectMode?1:V.length;if(Ie(Ve,xe,!1,Ue,V,$,he),ze=ze.next,xe.bufferedRequestCount--,xe.writing)break}ze===null&&(xe.lastBufferedRequest=null)}xe.bufferedRequest=ze,xe.bufferProcessing=!1}_e.prototype._write=function(Ve,xe,ze){ze(new x("_write()"))},_e.prototype._writev=null,_e.prototype.end=function(Ve,xe,ze){var Pt=this._writableState;return typeof Ve=="function"?(ze=Ve,Ve=null,xe=null):typeof xe=="function"&&(ze=xe,xe=null),Ve!=null&&this.write(Ve,xe),Pt.corked&&(Pt.corked=1,this.uncork()),Pt.ending||pe(this,Pt,ze),this},Object.defineProperty(_e.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Lt(Ve){return Ve.ending&&Ve.length===0&&Ve.bufferedRequest===null&&!Ve.finished&&!Ve.writing}function In(Ve,xe){Ve._final(function(ze){xe.pendingcb--,ze&&L(Ve,ze),xe.prefinished=!0,Ve.emit("prefinish"),Ne(Ve,xe)})}function Et(Ve,xe){!xe.prefinished&&!xe.finalCalled&&(typeof Ve._final=="function"&&!xe.destroyed?(xe.pendingcb++,xe.finalCalled=!0,u.nextTick(In,Ve,xe)):(xe.prefinished=!0,Ve.emit("prefinish")))}function Ne(Ve,xe){var ze=Lt(xe);if(ze&&(Et(Ve,xe),xe.pendingcb===0&&(xe.finished=!0,Ve.emit("finish"),xe.autoDestroy))){var Pt=Ve._readableState;(!Pt||Pt.autoDestroy&&Pt.endEmitted)&&Ve.destroy()}return ze}function pe(Ve,xe,ze){xe.ending=!0,Ne(Ve,xe),ze&&(xe.finished?u.nextTick(ze):Ve.once("finish",ze)),xe.ended=!0,Ve.writable=!1}function At(Ve,xe,ze){var Pt=Ve.entry;for(Ve.entry=null;Pt;){var hn=Pt.callback;xe.pendingcb--,hn(ze),Pt=Pt.next}xe.corkedRequestsFree.next=Ve}Object.defineProperty(_e.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(xe){this._writableState&&(this._writableState.destroyed=xe)}}),_e.prototype.destroy=_.destroy,_e.prototype._undestroy=_.undestroy,_e.prototype._destroy=function(Ve,xe){xe(Ve)}}).call(this)}).call(this,i("_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(i,o,a){(function(u){(function(){var c;function f(D,z,j){return z in D?Object.defineProperty(D,z,{value:j,enumerable:!0,configurable:!0,writable:!0}):D[z]=j,D}var d=i("./end-of-stream"),p=Symbol("lastResolve"),h=Symbol("lastReject"),g=Symbol("error"),v=Symbol("ended"),y=Symbol("lastPromise"),A=Symbol("handlePromise"),_=Symbol("stream");function S(D,z){return{value:D,done:z}}function b(D){var z=D[p];if(z!==null){var j=D[_].read();j!==null&&(D[y]=null,D[p]=null,D[h]=null,z(S(j,!1)))}}function T(D){u.nextTick(b,D)}function w(D,z){return function(j,oe){D.then(function(){if(z[v]){j(S(void 0,!0));return}z[A](j,oe)},oe)}}var x=Object.getPrototypeOf(function(){}),k=Object.setPrototypeOf((c={get stream(){return this[_]},next:function(){var z=this,j=this[g];if(j!==null)return Promise.reject(j);if(this[v])return Promise.resolve(S(void 0,!0));if(this[_].destroyed)return new Promise(function(O,ue){u.nextTick(function(){z[g]?ue(z[g]):O(S(void 0,!0))})});var oe=this[y],L;if(oe)L=new Promise(w(oe,this));else{var F=this[_].read();if(F!==null)return Promise.resolve(S(F,!1));L=new Promise(this[A])}return this[y]=L,L}},f(c,Symbol.asyncIterator,function(){return this}),f(c,"return",function(){var z=this;return new Promise(function(j,oe){z[_].destroy(null,function(L){if(L){oe(L);return}j(S(void 0,!0))})})}),c),x),M=function(z){var j,oe=Object.create(k,(j={},f(j,_,{value:z,writable:!0}),f(j,p,{value:null,writable:!0}),f(j,h,{value:null,writable:!0}),f(j,g,{value:null,writable:!0}),f(j,v,{value:z._readableState.endEmitted,writable:!0}),f(j,A,{value:function(F,O){var ue=oe[_].read();ue?(oe[y]=null,oe[p]=null,oe[h]=null,F(S(ue,!1))):(oe[p]=F,oe[h]=O)},writable:!0}),j));return oe[y]=null,d(z,function(L){if(L&&L.code!=="ERR_STREAM_PREMATURE_CLOSE"){var F=oe[h];F!==null&&(oe[y]=null,oe[p]=null,oe[h]=null,F(L)),oe[g]=L;return}var O=oe[p];O!==null&&(oe[y]=null,oe[p]=null,oe[h]=null,O(S(void 0,!0))),oe[v]=!0}),z.on("readable",T.bind(null,oe)),oe};o.exports=M}).call(this)}).call(this,i("_process"))},{"./end-of-stream":64,_process:50}],62:[function(i,o,a){function u(b,T){var w=Object.keys(b);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(b);T&&(x=x.filter(function(k){return Object.getOwnPropertyDescriptor(b,k).enumerable})),w.push.apply(w,x)}return w}function c(b){for(var T=1;T<arguments.length;T++){var w=arguments[T]!=null?arguments[T]:{};T%2?u(Object(w),!0).forEach(function(x){f(b,x,w[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(w)):u(Object(w)).forEach(function(x){Object.defineProperty(b,x,Object.getOwnPropertyDescriptor(w,x))})}return b}function f(b,T,w){return T in b?Object.defineProperty(b,T,{value:w,enumerable:!0,configurable:!0,writable:!0}):b[T]=w,b}function d(b,T){if(!(b instanceof T))throw new TypeError("Cannot call a class as a function")}function p(b,T){for(var w=0;w<T.length;w++){var x=T[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(b,x.key,x)}}function h(b,T,w){return T&&p(b.prototype,T),w&&p(b,w),b}var g=i("buffer"),v=g.Buffer,y=i("util"),A=y.inspect,_=A&&A.custom||"inspect";function S(b,T,w){v.prototype.copy.call(b,T,w)}o.exports=function(){function b(){d(this,b),this.head=null,this.tail=null,this.length=0}return h(b,[{key:"push",value:function(w){var x={data:w,next:null};this.length>0?this.tail.next=x:this.head=x,this.tail=x,++this.length}},{key:"unshift",value:function(w){var x={data:w,next:this.head};this.length===0&&(this.tail=x),this.head=x,++this.length}},{key:"shift",value:function(){if(this.length!==0){var w=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,w}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(w){if(this.length===0)return"";for(var x=this.head,k=""+x.data;x=x.next;)k+=w+x.data;return k}},{key:"concat",value:function(w){if(this.length===0)return v.alloc(0);for(var x=v.allocUnsafe(w>>>0),k=this.head,M=0;k;)S(k.data,x,M),M+=k.data.length,k=k.next;return x}},{key:"consume",value:function(w,x){var k;return w<this.head.data.length?(k=this.head.data.slice(0,w),this.head.data=this.head.data.slice(w)):w===this.head.data.length?k=this.shift():k=x?this._getString(w):this._getBuffer(w),k}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(w){var x=this.head,k=1,M=x.data;for(w-=M.length;x=x.next;){var D=x.data,z=w>D.length?D.length:w;if(z===D.length?M+=D:M+=D.slice(0,w),w-=z,w===0){z===D.length?(++k,x.next?this.head=x.next:this.head=this.tail=null):(this.head=x,x.data=D.slice(z));break}++k}return this.length-=k,M}},{key:"_getBuffer",value:function(w){var x=v.allocUnsafe(w),k=this.head,M=1;for(k.data.copy(x),w-=k.data.length;k=k.next;){var D=k.data,z=w>D.length?D.length:w;if(D.copy(x,x.length-w,0,z),w-=z,w===0){z===D.length?(++M,k.next?this.head=k.next:this.head=this.tail=null):(this.head=k,k.data=D.slice(z));break}++M}return this.length-=M,x}},{key:_,value:function(w,x){return A(this,c({},x,{depth:0,customInspect:!1}))}}]),b}()},{buffer:17,util:16}],63:[function(i,o,a){(function(u){(function(){function c(v,y){var A=this,_=this._readableState&&this._readableState.destroyed,S=this._writableState&&this._writableState.destroyed;return _||S?(y?y(v):v&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,u.nextTick(h,this,v)):u.nextTick(h,this,v)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(v||null,function(b){!y&&b?A._writableState?A._writableState.errorEmitted?u.nextTick(d,A):(A._writableState.errorEmitted=!0,u.nextTick(f,A,b)):u.nextTick(f,A,b):y?(u.nextTick(d,A),y(b)):u.nextTick(d,A)}),this)}function f(v,y){h(v,y),d(v)}function d(v){v._writableState&&!v._writableState.emitClose||v._readableState&&!v._readableState.emitClose||v.emit("close")}function p(){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 h(v,y){v.emit("error",y)}function g(v,y){var A=v._readableState,_=v._writableState;A&&A.autoDestroy||_&&_.autoDestroy?v.destroy(y):v.emit("error",y)}o.exports={destroy:c,undestroy:p,errorOrDestroy:g}}).call(this)}).call(this,i("_process"))},{_process:50}],64:[function(i,o,a){var u=i("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function c(h){var g=!1;return function(){if(!g){g=!0;for(var v=arguments.length,y=new Array(v),A=0;A<v;A++)y[A]=arguments[A];h.apply(this,y)}}}function f(){}function d(h){return h.setHeader&&typeof h.abort=="function"}function p(h,g,v){if(typeof g=="function")return p(h,null,g);g||(g={}),v=c(v||f);var y=g.readable||g.readable!==!1&&h.readable,A=g.writable||g.writable!==!1&&h.writable,_=function(){h.writable||b()},S=h._writableState&&h._writableState.finished,b=function(){A=!1,S=!0,y||v.call(h)},T=h._readableState&&h._readableState.endEmitted,w=function(){y=!1,T=!0,A||v.call(h)},x=function(z){v.call(h,z)},k=function(){var z;if(y&&!T)return(!h._readableState||!h._readableState.ended)&&(z=new u),v.call(h,z);if(A&&!S)return(!h._writableState||!h._writableState.ended)&&(z=new u),v.call(h,z)},M=function(){h.req.on("finish",b)};return d(h)?(h.on("complete",b),h.on("abort",k),h.req?M():h.on("request",M)):A&&!h._writableState&&(h.on("end",_),h.on("close",_)),h.on("end",w),h.on("finish",b),g.error!==!1&&h.on("error",x),h.on("close",k),function(){h.removeListener("complete",b),h.removeListener("abort",k),h.removeListener("request",M),h.req&&h.req.removeListener("finish",b),h.removeListener("end",_),h.removeListener("close",_),h.removeListener("finish",b),h.removeListener("end",w),h.removeListener("error",x),h.removeListener("close",k)}}o.exports=p},{"../../../errors":55}],65:[function(i,o,a){o.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(i,o,a){var u;function c(b){var T=!1;return function(){T||(T=!0,b.apply(void 0,arguments))}}var f=i("../../../errors").codes,d=f.ERR_MISSING_ARGS,p=f.ERR_STREAM_DESTROYED;function h(b){if(b)throw b}function g(b){return b.setHeader&&typeof b.abort=="function"}function v(b,T,w,x){x=c(x);var k=!1;b.on("close",function(){k=!0}),u===void 0&&(u=i("./end-of-stream")),u(b,{readable:T,writable:w},function(D){if(D)return x(D);k=!0,x()});var M=!1;return function(D){if(!k&&!M){if(M=!0,g(b))return b.abort();if(typeof b.destroy=="function")return b.destroy();x(D||new p("pipe"))}}}function y(b){b()}function A(b,T){return b.pipe(T)}function _(b){return!b.length||typeof b[b.length-1]!="function"?h:b.pop()}function S(){for(var b=arguments.length,T=new Array(b),w=0;w<b;w++)T[w]=arguments[w];var x=_(T);if(Array.isArray(T[0])&&(T=T[0]),T.length<2)throw new d("streams");var k,M=T.map(function(D,z){var j=z<T.length-1,oe=z>0;return v(D,j,oe,function(L){k||(k=L),L&&M.forEach(y),!j&&(M.forEach(y),x(k))})});return T.reduce(A)}o.exports=S},{"../../../errors":55,"./end-of-stream":64}],67:[function(i,o,a){var u=i("../../../errors").codes.ERR_INVALID_OPT_VALUE;function c(d,p,h){return d.highWaterMark!=null?d.highWaterMark:p?d[h]:null}function f(d,p,h,g){var v=c(p,g,h);if(v!=null){if(!(isFinite(v)&&Math.floor(v)===v)||v<0){var y=g?h:"highWaterMark";throw new u(y,v)}return Math.floor(v)}return d.objectMode?16:16*1024}o.exports={getHighWaterMark:f}},{"../../../errors":55}],68:[function(i,o,a){o.exports=i("events").EventEmitter},{events:22}],69:[function(i,o,a){a=o.exports=i("./lib/_stream_readable.js"),a.Stream=a,a.Readable=a,a.Writable=i("./lib/_stream_writable.js"),a.Duplex=i("./lib/_stream_duplex.js"),a.Transform=i("./lib/_stream_transform.js"),a.PassThrough=i("./lib/_stream_passthrough.js"),a.finished=i("./lib/internal/streams/end-of-stream.js"),a.pipeline=i("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(i,o,a){function u(f,d,p){var h=this;this._callback=f,this._args=p,this._interval=setInterval(f,d,this._args),this.reschedule=function(g){g||(g=h._interval),h._interval&&clearInterval(h._interval),h._interval=setInterval(h._callback,g,h._args)},this.clear=function(){h._interval&&(clearInterval(h._interval),h._interval=void 0)},this.destroy=function(){h._interval&&clearInterval(h._interval),h._callback=void 0,h._interval=void 0,h._args=void 0}}function c(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var f;if(arguments.length>0){f=new Array(arguments.length-2);for(var d=0;d<f.length;d++)f[d]=arguments[d+2]}return new u(arguments[0],arguments[1],f)}o.exports=c},{}],71:[function(i,o,a){o.exports=i("./index.js")()},{"./index.js":72}],72:[function(i,o,a){(function(u){(function(){o.exports=f;function c(p){return p instanceof u?u.from(p):new p.constructor(p.buffer.slice(),p.byteOffset,p.length)}function f(p){if(p=p||{},p.circles)return d(p);return p.proto?v:g;function h(y,A){for(var _=Object.keys(y),S=new Array(_.length),b=0;b<_.length;b++){var T=_[b],w=y[T];typeof w!="object"||w===null?S[T]=w:w instanceof Date?S[T]=new Date(w):ArrayBuffer.isView(w)?S[T]=c(w):S[T]=A(w)}return S}function g(y){if(typeof y!="object"||y===null)return y;if(y instanceof Date)return new Date(y);if(Array.isArray(y))return h(y,g);if(y instanceof Map)return new Map(h(Array.from(y),g));if(y instanceof Set)return new Set(h(Array.from(y),g));var A={};for(var _ in y)if(Object.hasOwnProperty.call(y,_)!==!1){var S=y[_];typeof S!="object"||S===null?A[_]=S:S instanceof Date?A[_]=new Date(S):S instanceof Map?A[_]=new Map(h(Array.from(S),g)):S instanceof Set?A[_]=new Set(h(Array.from(S),g)):ArrayBuffer.isView(S)?A[_]=c(S):A[_]=g(S)}return A}function v(y){if(typeof y!="object"||y===null)return y;if(y instanceof Date)return new Date(y);if(Array.isArray(y))return h(y,v);if(y instanceof Map)return new Map(h(Array.from(y),v));if(y instanceof Set)return new Set(h(Array.from(y),v));var A={};for(var _ in y){var S=y[_];typeof S!="object"||S===null?A[_]=S:S instanceof Date?A[_]=new Date(S):S instanceof Map?A[_]=new Map(h(Array.from(S),v)):S instanceof Set?A[_]=new Set(h(Array.from(S),v)):ArrayBuffer.isView(S)?A[_]=c(S):A[_]=v(S)}return A}}function d(p){var h=[],g=[];return p.proto?A:y;function v(_,S){for(var b=Object.keys(_),T=new Array(b.length),w=0;w<b.length;w++){var x=b[w],k=_[x];if(typeof k!="object"||k===null)T[x]=k;else if(k instanceof Date)T[x]=new Date(k);else if(ArrayBuffer.isView(k))T[x]=c(k);else{var M=h.indexOf(k);M!==-1?T[x]=g[M]:T[x]=S(k)}}return T}function y(_){if(typeof _!="object"||_===null)return _;if(_ instanceof Date)return new Date(_);if(Array.isArray(_))return v(_,y);if(_ instanceof Map)return new Map(v(Array.from(_),y));if(_ instanceof Set)return new Set(v(Array.from(_),y));var S={};h.push(_),g.push(S);for(var b in _)if(Object.hasOwnProperty.call(_,b)!==!1){var T=_[b];if(typeof T!="object"||T===null)S[b]=T;else if(T instanceof Date)S[b]=new Date(T);else if(T instanceof Map)S[b]=new Map(v(Array.from(T),y));else if(T instanceof Set)S[b]=new Set(v(Array.from(T),y));else if(ArrayBuffer.isView(T))S[b]=c(T);else{var w=h.indexOf(T);w!==-1?S[b]=g[w]:S[b]=y(T)}}return h.pop(),g.pop(),S}function A(_){if(typeof _!="object"||_===null)return _;if(_ instanceof Date)return new Date(_);if(Array.isArray(_))return v(_,A);if(_ instanceof Map)return new Map(v(Array.from(_),A));if(_ instanceof Set)return new Set(v(Array.from(_),A));var S={};h.push(_),g.push(S);for(var b in _){var T=_[b];if(typeof T!="object"||T===null)S[b]=T;else if(T instanceof Date)S[b]=new Date(T);else if(T instanceof Map)S[b]=new Map(v(Array.from(T),A));else if(T instanceof Set)S[b]=new Set(v(Array.from(T),A));else if(ArrayBuffer.isView(T))S[b]=c(T);else{var w=h.indexOf(T);w!==-1?S[b]=g[w]:S[b]=A(T)}}return h.pop(),g.pop(),S}}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],73:[function(i,o,a){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var u=i("buffer"),c=u.Buffer;function f(p,h){for(var g in p)h[g]=p[g]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?o.exports=u:(f(u,a),a.Buffer=d);function d(p,h,g){return c(p,h,g)}d.prototype=Object.create(c.prototype),f(c,d),d.from=function(p,h,g){if(typeof p=="number")throw new TypeError("Argument must not be a number");return c(p,h,g)},d.alloc=function(p,h,g){if(typeof p!="number")throw new TypeError("Argument must be a number");var v=c(p);return h!==void 0?typeof g=="string"?v.fill(h,g):v.fill(h):v.fill(0),v},d.allocUnsafe=function(p){if(typeof p!="number")throw new TypeError("Argument must be a number");return c(p)},d.allocUnsafeSlow=function(p){if(typeof p!="number")throw new TypeError("Argument must be a number");return u.SlowBuffer(p)}},{buffer:17}],74:[function(i,o,a){o.exports=u;function u(f){var d=f._readableState;return d?d.objectMode||typeof f._duplexState=="number"?f.read():f.read(c(d)):null}function c(f){return f.buffer.length?f.buffer.head?f.buffer.head.data.length:f.buffer[0].length:f.length}},{}],75:[function(i,o,a){var u=i("safe-buffer").Buffer,c=u.isEncoding||function(M){switch(M=""+M,M&&M.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 f(M){if(!M)return"utf8";for(var D;;)switch(M){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 M;default:if(D)return;M=(""+M).toLowerCase(),D=!0}}function d(M){var D=f(M);if(typeof D!="string"&&(u.isEncoding===c||!c(M)))throw new Error("Unknown encoding: "+M);return D||M}a.StringDecoder=p;function p(M){this.encoding=d(M);var D;switch(this.encoding){case"utf16le":this.text=S,this.end=b,D=4;break;case"utf8":this.fillLast=y,D=4;break;case"base64":this.text=T,this.end=w,D=3;break;default:this.write=x,this.end=k;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=u.allocUnsafe(D)}p.prototype.write=function(M){if(M.length===0)return"";var D,z;if(this.lastNeed){if(D=this.fillLast(M),D===void 0)return"";z=this.lastNeed,this.lastNeed=0}else z=0;return z<M.length?D?D+this.text(M,z):this.text(M,z):D||""},p.prototype.end=_,p.prototype.text=A,p.prototype.fillLast=function(M){if(this.lastNeed<=M.length)return M.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,this.lastTotal-this.lastNeed,0,M.length),this.lastNeed-=M.length};function h(M){return M<=127?0:M>>5===6?2:M>>4===14?3:M>>3===30?4:M>>6===2?-1:-2}function g(M,D,z){var j=D.length-1;if(j<z)return 0;var oe=h(D[j]);return oe>=0?(oe>0&&(M.lastNeed=oe-1),oe):--j<z||oe===-2?0:(oe=h(D[j]),oe>=0?(oe>0&&(M.lastNeed=oe-2),oe):--j<z||oe===-2?0:(oe=h(D[j]),oe>=0?(oe>0&&(oe===2?oe=0:M.lastNeed=oe-3),oe):0))}function v(M,D,z){if((D[0]&192)!==128)return M.lastNeed=0,"�";if(M.lastNeed>1&&D.length>1){if((D[1]&192)!==128)return M.lastNeed=1,"�";if(M.lastNeed>2&&D.length>2&&(D[2]&192)!==128)return M.lastNeed=2,"�"}}function y(M){var D=this.lastTotal-this.lastNeed,z=v(this,M);if(z!==void 0)return z;if(this.lastNeed<=M.length)return M.copy(this.lastChar,D,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,D,0,M.length),this.lastNeed-=M.length}function A(M,D){var z=g(this,M,D);if(!this.lastNeed)return M.toString("utf8",D);this.lastTotal=z;var j=M.length-(z-this.lastNeed);return M.copy(this.lastChar,0,j),M.toString("utf8",D,j)}function _(M){var D=M&&M.length?this.write(M):"";return this.lastNeed?D+"�":D}function S(M,D){if((M.length-D)%2===0){var z=M.toString("utf16le",D);if(z){var j=z.charCodeAt(z.length-1);if(j>=55296&&j<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1],z.slice(0,-1)}return z}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=M[M.length-1],M.toString("utf16le",D,M.length-1)}function b(M){var D=M&&M.length?this.write(M):"";if(this.lastNeed){var z=this.lastTotal-this.lastNeed;return D+this.lastChar.toString("utf16le",0,z)}return D}function T(M,D){var z=(M.length-D)%3;return z===0?M.toString("base64",D):(this.lastNeed=3-z,this.lastTotal=3,z===1?this.lastChar[0]=M[M.length-1]:(this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1]),M.toString("base64",D,M.length-z))}function w(M){var D=M&&M.length?this.write(M):"";return this.lastNeed?D+this.lastChar.toString("base64",0,3-this.lastNeed):D}function x(M){return M.toString(this.encoding)}function k(M){return M&&M.length?this.write(M):""}},{"safe-buffer":73}],76:[function(i,o,a){var u=i("punycode"),c=i("./util");a.parse=D,a.resolve=j,a.resolveObject=oe,a.format=z,a.Url=f;function f(){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 d=/^([a-z0-9.+-]+:)/i,p=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,g=["<",">",'"',"`"," ","\r",`
277
- `," "],v=["{","}","|","\\","^","`"].concat(g),y=["'"].concat(v),A=["%","/","?",";","#"].concat(y),_=["/","?","#"],S=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},k={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=i("querystring");function D(L,F,O){if(L&&c.isObject(L)&&L instanceof f)return L;var ue=new f;return ue.parse(L,F,O),ue}f.prototype.parse=function(L,F,O){if(!c.isString(L))throw new TypeError("Parameter 'url' must be a string, not "+typeof L);var ue=L.indexOf("?"),_e=ue!==-1&&ue<L.indexOf("#")?"?":"#",Ce=L.split(_e),de=/\\/g;Ce[0]=Ce[0].replace(de,"/"),L=Ce.join(_e);var ie=L;if(ie=ie.trim(),!O&&L.split("#").length===1){var Y=h.exec(ie);if(Y)return this.path=ie,this.href=ie,this.pathname=Y[1],Y[2]?(this.search=Y[2],F?this.query=M.parse(this.search.substr(1)):this.query=this.search.substr(1)):F&&(this.search="",this.query={}),this}var Ie=d.exec(ie);if(Ie){Ie=Ie[0];var Oe=Ie.toLowerCase();this.protocol=Oe,ie=ie.substr(Ie.length)}if(O||Ie||ie.match(/^\/\/[^@\/]+@[^@\/]+/)){var kt=ie.substr(0,2)==="//";kt&&!(Ie&&x[Ie])&&(ie=ie.substr(2),this.slashes=!0)}if(!x[Ie]&&(kt||Ie&&!k[Ie])){for(var Dt=-1,Fe=0;Fe<_.length;Fe++){var $e=ie.indexOf(_[Fe]);$e!==-1&&(Dt===-1||$e<Dt)&&(Dt=$e)}var Cn,Lt;Dt===-1?Lt=ie.lastIndexOf("@"):Lt=ie.lastIndexOf("@",Dt),Lt!==-1&&(Cn=ie.slice(0,Lt),ie=ie.slice(Lt+1),this.auth=decodeURIComponent(Cn)),Dt=-1;for(var Fe=0;Fe<A.length;Fe++){var $e=ie.indexOf(A[Fe]);$e!==-1&&(Dt===-1||$e<Dt)&&(Dt=$e)}Dt===-1&&(Dt=ie.length),this.host=ie.slice(0,Dt),ie=ie.slice(Dt),this.parseHost(),this.hostname=this.hostname||"";var In=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!In)for(var Et=this.hostname.split(/\./),Fe=0,Ne=Et.length;Fe<Ne;Fe++){var pe=Et[Fe];if(pe&&!pe.match(b)){for(var At="",Ve=0,xe=pe.length;Ve<xe;Ve++)pe.charCodeAt(Ve)>127?At+="x":At+=pe[Ve];if(!At.match(b)){var ze=Et.slice(0,Fe),Pt=Et.slice(Fe+1),hn=pe.match(T);hn&&(ze.push(hn[1]),Pt.unshift(hn[2])),Pt.length&&(ie="/"+Pt.join(".")+ie),this.hostname=ze.join(".");break}}}this.hostname.length>S?this.hostname="":this.hostname=this.hostname.toLowerCase(),In||(this.hostname=u.toASCII(this.hostname));var ae=this.port?":"+this.port:"",le=this.hostname||"";this.host=le+ae,this.href+=this.host,In&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ie[0]!=="/"&&(ie="/"+ie))}if(!w[Oe])for(var Fe=0,Ne=y.length;Fe<Ne;Fe++){var re=y[Fe];if(ie.indexOf(re)!==-1){var V=encodeURIComponent(re);V===re&&(V=escape(re)),ie=ie.split(re).join(V)}}var $=ie.indexOf("#");$!==-1&&(this.hash=ie.substr($),ie=ie.slice(0,$));var he=ie.indexOf("?");if(he!==-1?(this.search=ie.substr(he),this.query=ie.substr(he+1),F&&(this.query=M.parse(this.query)),ie=ie.slice(0,he)):F&&(this.search="",this.query={}),ie&&(this.pathname=ie),k[Oe]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ae=this.pathname||"",Ue=this.search||"";this.path=ae+Ue}return this.href=this.format(),this};function z(L){return c.isString(L)&&(L=D(L)),L instanceof f?L.format():f.prototype.format.call(L)}f.prototype.format=function(){var L=this.auth||"";L&&(L=encodeURIComponent(L),L=L.replace(/%3A/i,":"),L+="@");var F=this.protocol||"",O=this.pathname||"",ue=this.hash||"",_e=!1,Ce="";this.host?_e=L+this.host:this.hostname&&(_e=L+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(_e+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(Ce=M.stringify(this.query));var de=this.search||Ce&&"?"+Ce||"";return F&&F.substr(-1)!==":"&&(F+=":"),this.slashes||(!F||k[F])&&_e!==!1?(_e="//"+(_e||""),O&&O.charAt(0)!=="/"&&(O="/"+O)):_e||(_e=""),ue&&ue.charAt(0)!=="#"&&(ue="#"+ue),de&&de.charAt(0)!=="?"&&(de="?"+de),O=O.replace(/[?#]/g,function(ie){return encodeURIComponent(ie)}),de=de.replace("#","%23"),F+_e+O+de+ue};function j(L,F){return D(L,!1,!0).resolve(F)}f.prototype.resolve=function(L){return this.resolveObject(D(L,!1,!0)).format()};function oe(L,F){return L?D(L,!1,!0).resolveObject(F):F}f.prototype.resolveObject=function(L){if(c.isString(L)){var F=new f;F.parse(L,!1,!0),L=F}for(var O=new f,ue=Object.keys(this),_e=0;_e<ue.length;_e++){var Ce=ue[_e];O[Ce]=this[Ce]}if(O.hash=L.hash,L.href==="")return O.href=O.format(),O;if(L.slashes&&!L.protocol){for(var de=Object.keys(L),ie=0;ie<de.length;ie++){var Y=de[ie];Y!=="protocol"&&(O[Y]=L[Y])}return k[O.protocol]&&O.hostname&&!O.pathname&&(O.path=O.pathname="/"),O.href=O.format(),O}if(L.protocol&&L.protocol!==O.protocol){if(!k[L.protocol]){for(var Ie=Object.keys(L),Oe=0;Oe<Ie.length;Oe++){var kt=Ie[Oe];O[kt]=L[kt]}return O.href=O.format(),O}if(O.protocol=L.protocol,!L.host&&!x[L.protocol]){for(var Ne=(L.pathname||"").split("/");Ne.length&&!(L.host=Ne.shift()););L.host||(L.host=""),L.hostname||(L.hostname=""),Ne[0]!==""&&Ne.unshift(""),Ne.length<2&&Ne.unshift(""),O.pathname=Ne.join("/")}else O.pathname=L.pathname;if(O.search=L.search,O.query=L.query,O.host=L.host||"",O.auth=L.auth,O.hostname=L.hostname||L.host,O.port=L.port,O.pathname||O.search){var Dt=O.pathname||"",Fe=O.search||"";O.path=Dt+Fe}return O.slashes=O.slashes||L.slashes,O.href=O.format(),O}var $e=O.pathname&&O.pathname.charAt(0)==="/",Cn=L.host||L.pathname&&L.pathname.charAt(0)==="/",Lt=Cn||$e||O.host&&L.pathname,In=Lt,Et=O.pathname&&O.pathname.split("/")||[],Ne=L.pathname&&L.pathname.split("/")||[],pe=O.protocol&&!k[O.protocol];if(pe&&(O.hostname="",O.port=null,O.host&&(Et[0]===""?Et[0]=O.host:Et.unshift(O.host)),O.host="",L.protocol&&(L.hostname=null,L.port=null,L.host&&(Ne[0]===""?Ne[0]=L.host:Ne.unshift(L.host)),L.host=null),Lt=Lt&&(Ne[0]===""||Et[0]==="")),Cn)O.host=L.host||L.host===""?L.host:O.host,O.hostname=L.hostname||L.hostname===""?L.hostname:O.hostname,O.search=L.search,O.query=L.query,Et=Ne;else if(Ne.length)Et||(Et=[]),Et.pop(),Et=Et.concat(Ne),O.search=L.search,O.query=L.query;else if(!c.isNullOrUndefined(L.search)){if(pe){O.hostname=O.host=Et.shift();var At=O.host&&O.host.indexOf("@")>0?O.host.split("@"):!1;At&&(O.auth=At.shift(),O.host=O.hostname=At.shift())}return O.search=L.search,O.query=L.query,(!c.isNull(O.pathname)||!c.isNull(O.search))&&(O.path=(O.pathname?O.pathname:"")+(O.search?O.search:"")),O.href=O.format(),O}if(!Et.length)return O.pathname=null,O.search?O.path="/"+O.search:O.path=null,O.href=O.format(),O;for(var Ve=Et.slice(-1)[0],xe=(O.host||L.host||Et.length>1)&&(Ve==="."||Ve==="..")||Ve==="",ze=0,Pt=Et.length;Pt>=0;Pt--)Ve=Et[Pt],Ve==="."?Et.splice(Pt,1):Ve===".."?(Et.splice(Pt,1),ze++):ze&&(Et.splice(Pt,1),ze--);if(!Lt&&!In)for(;ze--;ze)Et.unshift("..");Lt&&Et[0]!==""&&(!Et[0]||Et[0].charAt(0)!=="/")&&Et.unshift(""),xe&&Et.join("/").substr(-1)!=="/"&&Et.push("");var hn=Et[0]===""||Et[0]&&Et[0].charAt(0)==="/";if(pe){O.hostname=O.host=hn?"":Et.length?Et.shift():"";var At=O.host&&O.host.indexOf("@")>0?O.host.split("@"):!1;At&&(O.auth=At.shift(),O.host=O.hostname=At.shift())}return Lt=Lt||O.host&&Et.length,Lt&&!hn&&Et.unshift(""),Et.length?O.pathname=Et.join("/"):(O.pathname=null,O.path=null),(!c.isNull(O.pathname)||!c.isNull(O.search))&&(O.path=(O.pathname?O.pathname:"")+(O.search?O.search:"")),O.auth=L.auth||O.auth,O.slashes=O.slashes||L.slashes,O.href=O.format(),O},f.prototype.parseHost=function(){var L=this.host,F=p.exec(L);F&&(F=F[0],F!==":"&&(this.port=F.substr(1)),L=L.substr(0,L.length-F.length)),L&&(this.hostname=L)}},{"./util":77,punycode:51,querystring:54}],77:[function(i,o,a){o.exports={isString:function(u){return typeof u=="string"},isObject:function(u){return typeof u=="object"&&u!==null},isNull:function(u){return u===null},isNullOrUndefined:function(u){return u==null}}},{}],78:[function(i,o,a){(function(u){(function(){o.exports=c;function c(d,p){if(f("noDeprecation"))return d;var h=!1;function g(){if(!h){if(f("throwDeprecation"))throw new Error(p);f("traceDeprecation")?console.trace(p):console.warn(p),h=!0}return d.apply(this,arguments)}return g}function f(d){try{if(!u.localStorage)return!1}catch{return!1}var p=u.localStorage[d];return p==null?!1:String(p).toLowerCase()==="true"}}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,o,a){o.exports=u;function u(c,f){if(c&&f)return u(c)(f);if(typeof c!="function")throw new TypeError("need wrapper function");return Object.keys(c).forEach(function(p){d[p]=c[p]}),d;function d(){for(var p=new Array(arguments.length),h=0;h<p.length;h++)p[h]=arguments[h];var g=c.apply(this,p),v=p[p.length-1];return typeof g=="function"&&g!==v&&Object.keys(v).forEach(function(y){g[y]=v[y]}),g}}},{}],80:[function(i,o,a){o.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(i,o,a){o.exports=c;var u=Object.prototype.hasOwnProperty;function c(){for(var f={},d=0;d<arguments.length;d++){var p=arguments[d];for(var h in p)u.call(p,h)&&(f[h]=p[h])}return f}},{}],82:[function(i,o,a){o.exports=function(u){u.prototype[Symbol.iterator]=function*(){for(let c=this.head;c;c=c.next)yield c.value}}},{}],83:[function(i,o,a){o.exports=u,u.Node=p,u.create=u;function u(h){var g=this;if(g instanceof u||(g=new u),g.tail=null,g.head=null,g.length=0,h&&typeof h.forEach=="function")h.forEach(function(A){g.push(A)});else if(arguments.length>0)for(var v=0,y=arguments.length;v<y;v++)g.push(arguments[v]);return g}u.prototype.removeNode=function(h){if(h.list!==this)throw new Error("removing node which does not belong to this list");var g=h.next,v=h.prev;return g&&(g.prev=v),v&&(v.next=g),h===this.head&&(this.head=g),h===this.tail&&(this.tail=v),h.list.length--,h.next=null,h.prev=null,h.list=null,g},u.prototype.unshiftNode=function(h){if(h!==this.head){h.list&&h.list.removeNode(h);var g=this.head;h.list=this,h.next=g,g&&(g.prev=h),this.head=h,this.tail||(this.tail=h),this.length++}},u.prototype.pushNode=function(h){if(h!==this.tail){h.list&&h.list.removeNode(h);var g=this.tail;h.list=this,h.prev=g,g&&(g.next=h),this.tail=h,this.head||(this.head=h),this.length++}},u.prototype.push=function(){for(var h=0,g=arguments.length;h<g;h++)f(this,arguments[h]);return this.length},u.prototype.unshift=function(){for(var h=0,g=arguments.length;h<g;h++)d(this,arguments[h]);return this.length},u.prototype.pop=function(){if(this.tail){var h=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,h}},u.prototype.shift=function(){if(this.head){var h=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,h}},u.prototype.forEach=function(h,g){g=g||this;for(var v=this.head,y=0;v!==null;y++)h.call(g,v.value,y,this),v=v.next},u.prototype.forEachReverse=function(h,g){g=g||this;for(var v=this.tail,y=this.length-1;v!==null;y--)h.call(g,v.value,y,this),v=v.prev},u.prototype.get=function(h){for(var g=0,v=this.head;v!==null&&g<h;g++)v=v.next;if(g===h&&v!==null)return v.value},u.prototype.getReverse=function(h){for(var g=0,v=this.tail;v!==null&&g<h;g++)v=v.prev;if(g===h&&v!==null)return v.value},u.prototype.map=function(h,g){g=g||this;for(var v=new u,y=this.head;y!==null;)v.push(h.call(g,y.value,this)),y=y.next;return v},u.prototype.mapReverse=function(h,g){g=g||this;for(var v=new u,y=this.tail;y!==null;)v.push(h.call(g,y.value,this)),y=y.prev;return v},u.prototype.reduce=function(h,g){var v,y=this.head;if(arguments.length>1)v=g;else if(this.head)y=this.head.next,v=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var A=0;y!==null;A++)v=h(v,y.value,A),y=y.next;return v},u.prototype.reduceReverse=function(h,g){var v,y=this.tail;if(arguments.length>1)v=g;else if(this.tail)y=this.tail.prev,v=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var A=this.length-1;y!==null;A--)v=h(v,y.value,A),y=y.prev;return v},u.prototype.toArray=function(){for(var h=new Array(this.length),g=0,v=this.head;v!==null;g++)h[g]=v.value,v=v.next;return h},u.prototype.toArrayReverse=function(){for(var h=new Array(this.length),g=0,v=this.tail;v!==null;g++)h[g]=v.value,v=v.prev;return h},u.prototype.slice=function(h,g){g=g||this.length,g<0&&(g+=this.length),h=h||0,h<0&&(h+=this.length);var v=new u;if(g<h||g<0)return v;h<0&&(h=0),g>this.length&&(g=this.length);for(var y=0,A=this.head;A!==null&&y<h;y++)A=A.next;for(;A!==null&&y<g;y++,A=A.next)v.push(A.value);return v},u.prototype.sliceReverse=function(h,g){g=g||this.length,g<0&&(g+=this.length),h=h||0,h<0&&(h+=this.length);var v=new u;if(g<h||g<0)return v;h<0&&(h=0),g>this.length&&(g=this.length);for(var y=this.length,A=this.tail;A!==null&&y>g;y--)A=A.prev;for(;A!==null&&y>h;y--,A=A.prev)v.push(A.value);return v},u.prototype.splice=function(h,g,...v){h>this.length&&(h=this.length-1),h<0&&(h=this.length+h);for(var y=0,A=this.head;A!==null&&y<h;y++)A=A.next;for(var _=[],y=0;A&&y<g;y++)_.push(A.value),A=this.removeNode(A);A===null&&(A=this.tail),A!==this.head&&A!==this.tail&&(A=A.prev);for(var y=0;y<v.length;y++)A=c(this,A,v[y]);return _},u.prototype.reverse=function(){for(var h=this.head,g=this.tail,v=h;v!==null;v=v.prev){var y=v.prev;v.prev=v.next,v.next=y}return this.head=g,this.tail=h,this};function c(h,g,v){var y=g===h.head?new p(v,null,g,h):new p(v,g,g.next,h);return y.next===null&&(h.tail=y),y.prev===null&&(h.head=y),h.length++,y}function f(h,g){h.tail=new p(g,h.tail,null,h),h.head||(h.head=h.tail),h.length++}function d(h,g){h.head=new p(g,null,h.head,h),h.tail||(h.tail=h.head),h.length++}function p(h,g,v,y){if(!(this instanceof p))return new p(h,g,v,y);this.list=y,this.value=h,g?(g.next=this,this.prev=g):this.prev=null,v?(v.prev=this,this.next=v):this.next=null}try{i("./iterator.js")(u)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(r,n,i,o,a)=>{client=mqttExports.connect(r,{username:n,password:i}),client.on("connect",()=>{console.log("MQTT服务器连接成功"),console.log(client.options.clientId),client.subscribe(o,{qos:1})}),client.on("message",a)},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:"svg-viewer",props:{data:{},canvasDrag:{type:Boolean,default:!0}},emits:["onMessage"],setup(r,{expose:n,emit:i}){const o=r;vue.useCssVars(b=>({eb9e007c:vue.unref(c)})),setEditorLoadTime();const a=useGlobalStore(pinia);componentsRegister();const u=vue.reactive(o.data??{layout_center:{x:0,y:0},config:{svg:{background_color:"#fff",scale:1,grid_color:"#ebebeb"},net:{mqtt:{url:"",user:"",pwd:"",topics:""}}},done_json:[]}),c=vue.computed(()=>a.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),f=b=>{if(a.mouse_info.state!=EMouseInfoState.Down&&a.intention!==EGlobalStoreIntention.Connection||!o.canvasDrag)return;const{clientX:T,clientY:w}=b;a.mouse_info.new_position_x=a.mouse_info.now_position_x+T-a.mouse_info.position_x,a.mouse_info.new_position_y=a.mouse_info.now_position_y+w-a.mouse_info.position_y,a.intention==EGlobalStoreIntention.MoveCanvas&&(u.layout_center.x=a.mouse_info.new_position_x,u.layout_center.y=a.mouse_info.new_position_y)},d=()=>{a.mouse_info.state==EMouseInfoState.Down&&(a.intention!=EGlobalStoreIntention.Select&&(a.intention=EGlobalStoreIntention.None),a.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0})},p=b=>{const{clientX:T,clientY:w}=b;a.intention=EGlobalStoreIntention.MoveCanvas,a.mouse_info={state:EMouseInfoState.Down,position_x:T,position_y:w,now_position_x:u.layout_center.x,now_position_y:u.layout_center.y,new_position_x:u.layout_center.x,new_position_y:u.layout_center.y}};function h(b){b!=null&&b.wheelDelta&&(b.wheelDelta>0?u.config.svg.scale=parseFloat((u.config.svg.scale+.1).toFixed(1)):u.config.svg.scale=parseFloat((u.config.svg.scale-.1).toFixed(1)))}const g=(b,T,w)=>({x:b.x-b.width/2*T+b.width/2,y:b.y-b.height/2*w+b.height/2,width:b.width*T,height:b.height*w}),v=b=>{var w;let T=!1;if(((w=b.events)==null?void 0:w.length)>0){for(let x of b.events)if(x.type===EEventType.Click){T=!0;break}}return{cursor:T?"pointer":"default"}},y=(b,T)=>{var w;if(console.log(b.events,T),((w=b.events)==null?void 0:w.length)>0){for(let x of b.events)if(x.type===T){if(x.condition&&x.condition.type!=="None"&&x.condition.type==="Relation"&&x.condition.Relation&&x.condition.Relation.relation){const k=x.condition.Relation.key,M=x.condition.Relation.relation,D=valFormat(x.condition.Relation.val),z=valFormat(x.condition.Relation.val2);if(b.props.hasOwnProperty(k)){const j=b.props[k].val;if(!A(j,M,D,z))continue}}if(x.action===EEventAction.ChangeAttr){if(x.attrs&&x.attrs.length>0){let k;if(x.target){for(let M of u.done_json)if(M.id===x.target){k=M;break}}else k=b;if(!k)continue;for(let M of x.attrs)M.key==="state"?k.defaultState=valFormat(M.val):k.props.hasOwnProperty(M.key)&&(k.props[M.key].val=valFormat(M.val))}}else x.action===EEventAction.JavaScript&&new Function(x.scripts)()}}},A=(b,T,w,x)=>{switch(T){case">":return b>w;case">=":return b>=w;case"<":return b<w;case"<=":return b<=w;case"==":return b==w;case"!=":return b!=w;case">=,=<":return b>=w&&b<=x;case"<,>":return b<w||b>x}},_=()=>{const b=u.config.net.mqtt;b&&b.url&&b.user&&b.pwd&&b.topics&&sub(b.url,b.user,b.pwd,b.topics,(T,w)=>{console.log(T),console.log(w.toString()),i("onMessage",{topics:T,message:w})})},S=(b,T,w)=>setArrItemByID(b,T,w,u.done_json);return vue.onMounted(()=>{_()}),vue.onBeforeUnmount(close),n({setNodeAttrByID:S}),(b,T)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:p,onMousemove:f,onMouseup:d,onMousewheel:h,onContextmenu:T[4]||(T[4]=(...w)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...w))},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(u).config.svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("g",{transform:`translate(${vue.unref(u).layout_center.x},${vue.unref(u).layout_center.y})rotate(0)scale(${vue.unref(u).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(u).done_json,w=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:w.id,transform:`translate(${w.x},${w.y})rotate(0)scale(1)`,style:vue.normalizeStyle(v(w)),onClick:x=>y(w,vue.unref(EEventType).Click),onMousedown:T[0]||(T[0]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMousemove:T[1]||(T[1]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMouseup:T[2]||(T[2]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMousewheel:T[3]||(T[3]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(w)}`)},[vue.createElementVNode("g",{transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2})rotate(${w.rotate}) scale(1) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`},[w.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$y,{key:0,"item-info":w},null,8,["item-info"])):w.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${w.name}`},vue.unref(prosToVBind)(w),{width:"100",height:"100",id:w.id,transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),null,16,_hoisted_4)):w.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(w.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(w),{width:"100",height:"100",id:w.id,onOnChange:x=>y(w,vue.unref(EEventType).Change),transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):w.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},g(w.actual_bound,w.scale_x,w.scale_y),{id:`foreign-object${w.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(w.tag),vue.mergeProps(vue.unref(prosToVBind)(w),{id:w.id,onOnChange:x=>y(w,vue.unref(EEventType).Change),transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(w.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],44,_hoisted_2)),[[vue.vShow,w.display]])),128))],8,_hoisted_1)],4))],32))}}),svgViewer_vue_vue_type_style_index_0_scoped_7cd79a96_lang="",svgViewer=_export_sfc$1(_sfc_main,[["__scopeId","data-v-7cd79a96"]]);exports.SvgEditor=index,exports.SvgViewer=svgViewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
277
+ `," "],v=["{","}","|","\\","^","`"].concat(g),y=["'"].concat(v),A=["%","/","?",";","#"].concat(y),_=["/","?","#"],S=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},k={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=i("querystring");function D(L,F,O){if(L&&c.isObject(L)&&L instanceof f)return L;var ue=new f;return ue.parse(L,F,O),ue}f.prototype.parse=function(L,F,O){if(!c.isString(L))throw new TypeError("Parameter 'url' must be a string, not "+typeof L);var ue=L.indexOf("?"),_e=ue!==-1&&ue<L.indexOf("#")?"?":"#",Ce=L.split(_e),de=/\\/g;Ce[0]=Ce[0].replace(de,"/"),L=Ce.join(_e);var ie=L;if(ie=ie.trim(),!O&&L.split("#").length===1){var Y=h.exec(ie);if(Y)return this.path=ie,this.href=ie,this.pathname=Y[1],Y[2]?(this.search=Y[2],F?this.query=M.parse(this.search.substr(1)):this.query=this.search.substr(1)):F&&(this.search="",this.query={}),this}var Ie=d.exec(ie);if(Ie){Ie=Ie[0];var Oe=Ie.toLowerCase();this.protocol=Oe,ie=ie.substr(Ie.length)}if(O||Ie||ie.match(/^\/\/[^@\/]+@[^@\/]+/)){var kt=ie.substr(0,2)==="//";kt&&!(Ie&&x[Ie])&&(ie=ie.substr(2),this.slashes=!0)}if(!x[Ie]&&(kt||Ie&&!k[Ie])){for(var Dt=-1,Fe=0;Fe<_.length;Fe++){var $e=ie.indexOf(_[Fe]);$e!==-1&&(Dt===-1||$e<Dt)&&(Dt=$e)}var Cn,Lt;Dt===-1?Lt=ie.lastIndexOf("@"):Lt=ie.lastIndexOf("@",Dt),Lt!==-1&&(Cn=ie.slice(0,Lt),ie=ie.slice(Lt+1),this.auth=decodeURIComponent(Cn)),Dt=-1;for(var Fe=0;Fe<A.length;Fe++){var $e=ie.indexOf(A[Fe]);$e!==-1&&(Dt===-1||$e<Dt)&&(Dt=$e)}Dt===-1&&(Dt=ie.length),this.host=ie.slice(0,Dt),ie=ie.slice(Dt),this.parseHost(),this.hostname=this.hostname||"";var In=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!In)for(var Et=this.hostname.split(/\./),Fe=0,Ne=Et.length;Fe<Ne;Fe++){var pe=Et[Fe];if(pe&&!pe.match(b)){for(var At="",Ve=0,xe=pe.length;Ve<xe;Ve++)pe.charCodeAt(Ve)>127?At+="x":At+=pe[Ve];if(!At.match(b)){var ze=Et.slice(0,Fe),Pt=Et.slice(Fe+1),hn=pe.match(T);hn&&(ze.push(hn[1]),Pt.unshift(hn[2])),Pt.length&&(ie="/"+Pt.join(".")+ie),this.hostname=ze.join(".");break}}}this.hostname.length>S?this.hostname="":this.hostname=this.hostname.toLowerCase(),In||(this.hostname=u.toASCII(this.hostname));var ae=this.port?":"+this.port:"",le=this.hostname||"";this.host=le+ae,this.href+=this.host,In&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ie[0]!=="/"&&(ie="/"+ie))}if(!w[Oe])for(var Fe=0,Ne=y.length;Fe<Ne;Fe++){var re=y[Fe];if(ie.indexOf(re)!==-1){var V=encodeURIComponent(re);V===re&&(V=escape(re)),ie=ie.split(re).join(V)}}var $=ie.indexOf("#");$!==-1&&(this.hash=ie.substr($),ie=ie.slice(0,$));var he=ie.indexOf("?");if(he!==-1?(this.search=ie.substr(he),this.query=ie.substr(he+1),F&&(this.query=M.parse(this.query)),ie=ie.slice(0,he)):F&&(this.search="",this.query={}),ie&&(this.pathname=ie),k[Oe]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ae=this.pathname||"",Ue=this.search||"";this.path=ae+Ue}return this.href=this.format(),this};function z(L){return c.isString(L)&&(L=D(L)),L instanceof f?L.format():f.prototype.format.call(L)}f.prototype.format=function(){var L=this.auth||"";L&&(L=encodeURIComponent(L),L=L.replace(/%3A/i,":"),L+="@");var F=this.protocol||"",O=this.pathname||"",ue=this.hash||"",_e=!1,Ce="";this.host?_e=L+this.host:this.hostname&&(_e=L+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(_e+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(Ce=M.stringify(this.query));var de=this.search||Ce&&"?"+Ce||"";return F&&F.substr(-1)!==":"&&(F+=":"),this.slashes||(!F||k[F])&&_e!==!1?(_e="//"+(_e||""),O&&O.charAt(0)!=="/"&&(O="/"+O)):_e||(_e=""),ue&&ue.charAt(0)!=="#"&&(ue="#"+ue),de&&de.charAt(0)!=="?"&&(de="?"+de),O=O.replace(/[?#]/g,function(ie){return encodeURIComponent(ie)}),de=de.replace("#","%23"),F+_e+O+de+ue};function j(L,F){return D(L,!1,!0).resolve(F)}f.prototype.resolve=function(L){return this.resolveObject(D(L,!1,!0)).format()};function oe(L,F){return L?D(L,!1,!0).resolveObject(F):F}f.prototype.resolveObject=function(L){if(c.isString(L)){var F=new f;F.parse(L,!1,!0),L=F}for(var O=new f,ue=Object.keys(this),_e=0;_e<ue.length;_e++){var Ce=ue[_e];O[Ce]=this[Ce]}if(O.hash=L.hash,L.href==="")return O.href=O.format(),O;if(L.slashes&&!L.protocol){for(var de=Object.keys(L),ie=0;ie<de.length;ie++){var Y=de[ie];Y!=="protocol"&&(O[Y]=L[Y])}return k[O.protocol]&&O.hostname&&!O.pathname&&(O.path=O.pathname="/"),O.href=O.format(),O}if(L.protocol&&L.protocol!==O.protocol){if(!k[L.protocol]){for(var Ie=Object.keys(L),Oe=0;Oe<Ie.length;Oe++){var kt=Ie[Oe];O[kt]=L[kt]}return O.href=O.format(),O}if(O.protocol=L.protocol,!L.host&&!x[L.protocol]){for(var Ne=(L.pathname||"").split("/");Ne.length&&!(L.host=Ne.shift()););L.host||(L.host=""),L.hostname||(L.hostname=""),Ne[0]!==""&&Ne.unshift(""),Ne.length<2&&Ne.unshift(""),O.pathname=Ne.join("/")}else O.pathname=L.pathname;if(O.search=L.search,O.query=L.query,O.host=L.host||"",O.auth=L.auth,O.hostname=L.hostname||L.host,O.port=L.port,O.pathname||O.search){var Dt=O.pathname||"",Fe=O.search||"";O.path=Dt+Fe}return O.slashes=O.slashes||L.slashes,O.href=O.format(),O}var $e=O.pathname&&O.pathname.charAt(0)==="/",Cn=L.host||L.pathname&&L.pathname.charAt(0)==="/",Lt=Cn||$e||O.host&&L.pathname,In=Lt,Et=O.pathname&&O.pathname.split("/")||[],Ne=L.pathname&&L.pathname.split("/")||[],pe=O.protocol&&!k[O.protocol];if(pe&&(O.hostname="",O.port=null,O.host&&(Et[0]===""?Et[0]=O.host:Et.unshift(O.host)),O.host="",L.protocol&&(L.hostname=null,L.port=null,L.host&&(Ne[0]===""?Ne[0]=L.host:Ne.unshift(L.host)),L.host=null),Lt=Lt&&(Ne[0]===""||Et[0]==="")),Cn)O.host=L.host||L.host===""?L.host:O.host,O.hostname=L.hostname||L.hostname===""?L.hostname:O.hostname,O.search=L.search,O.query=L.query,Et=Ne;else if(Ne.length)Et||(Et=[]),Et.pop(),Et=Et.concat(Ne),O.search=L.search,O.query=L.query;else if(!c.isNullOrUndefined(L.search)){if(pe){O.hostname=O.host=Et.shift();var At=O.host&&O.host.indexOf("@")>0?O.host.split("@"):!1;At&&(O.auth=At.shift(),O.host=O.hostname=At.shift())}return O.search=L.search,O.query=L.query,(!c.isNull(O.pathname)||!c.isNull(O.search))&&(O.path=(O.pathname?O.pathname:"")+(O.search?O.search:"")),O.href=O.format(),O}if(!Et.length)return O.pathname=null,O.search?O.path="/"+O.search:O.path=null,O.href=O.format(),O;for(var Ve=Et.slice(-1)[0],xe=(O.host||L.host||Et.length>1)&&(Ve==="."||Ve==="..")||Ve==="",ze=0,Pt=Et.length;Pt>=0;Pt--)Ve=Et[Pt],Ve==="."?Et.splice(Pt,1):Ve===".."?(Et.splice(Pt,1),ze++):ze&&(Et.splice(Pt,1),ze--);if(!Lt&&!In)for(;ze--;ze)Et.unshift("..");Lt&&Et[0]!==""&&(!Et[0]||Et[0].charAt(0)!=="/")&&Et.unshift(""),xe&&Et.join("/").substr(-1)!=="/"&&Et.push("");var hn=Et[0]===""||Et[0]&&Et[0].charAt(0)==="/";if(pe){O.hostname=O.host=hn?"":Et.length?Et.shift():"";var At=O.host&&O.host.indexOf("@")>0?O.host.split("@"):!1;At&&(O.auth=At.shift(),O.host=O.hostname=At.shift())}return Lt=Lt||O.host&&Et.length,Lt&&!hn&&Et.unshift(""),Et.length?O.pathname=Et.join("/"):(O.pathname=null,O.path=null),(!c.isNull(O.pathname)||!c.isNull(O.search))&&(O.path=(O.pathname?O.pathname:"")+(O.search?O.search:"")),O.auth=L.auth||O.auth,O.slashes=O.slashes||L.slashes,O.href=O.format(),O},f.prototype.parseHost=function(){var L=this.host,F=p.exec(L);F&&(F=F[0],F!==":"&&(this.port=F.substr(1)),L=L.substr(0,L.length-F.length)),L&&(this.hostname=L)}},{"./util":77,punycode:51,querystring:54}],77:[function(i,o,a){o.exports={isString:function(u){return typeof u=="string"},isObject:function(u){return typeof u=="object"&&u!==null},isNull:function(u){return u===null},isNullOrUndefined:function(u){return u==null}}},{}],78:[function(i,o,a){(function(u){(function(){o.exports=c;function c(d,p){if(f("noDeprecation"))return d;var h=!1;function g(){if(!h){if(f("throwDeprecation"))throw new Error(p);f("traceDeprecation")?console.trace(p):console.warn(p),h=!0}return d.apply(this,arguments)}return g}function f(d){try{if(!u.localStorage)return!1}catch{return!1}var p=u.localStorage[d];return p==null?!1:String(p).toLowerCase()==="true"}}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,o,a){o.exports=u;function u(c,f){if(c&&f)return u(c)(f);if(typeof c!="function")throw new TypeError("need wrapper function");return Object.keys(c).forEach(function(p){d[p]=c[p]}),d;function d(){for(var p=new Array(arguments.length),h=0;h<p.length;h++)p[h]=arguments[h];var g=c.apply(this,p),v=p[p.length-1];return typeof g=="function"&&g!==v&&Object.keys(v).forEach(function(y){g[y]=v[y]}),g}}},{}],80:[function(i,o,a){o.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(i,o,a){o.exports=c;var u=Object.prototype.hasOwnProperty;function c(){for(var f={},d=0;d<arguments.length;d++){var p=arguments[d];for(var h in p)u.call(p,h)&&(f[h]=p[h])}return f}},{}],82:[function(i,o,a){o.exports=function(u){u.prototype[Symbol.iterator]=function*(){for(let c=this.head;c;c=c.next)yield c.value}}},{}],83:[function(i,o,a){o.exports=u,u.Node=p,u.create=u;function u(h){var g=this;if(g instanceof u||(g=new u),g.tail=null,g.head=null,g.length=0,h&&typeof h.forEach=="function")h.forEach(function(A){g.push(A)});else if(arguments.length>0)for(var v=0,y=arguments.length;v<y;v++)g.push(arguments[v]);return g}u.prototype.removeNode=function(h){if(h.list!==this)throw new Error("removing node which does not belong to this list");var g=h.next,v=h.prev;return g&&(g.prev=v),v&&(v.next=g),h===this.head&&(this.head=g),h===this.tail&&(this.tail=v),h.list.length--,h.next=null,h.prev=null,h.list=null,g},u.prototype.unshiftNode=function(h){if(h!==this.head){h.list&&h.list.removeNode(h);var g=this.head;h.list=this,h.next=g,g&&(g.prev=h),this.head=h,this.tail||(this.tail=h),this.length++}},u.prototype.pushNode=function(h){if(h!==this.tail){h.list&&h.list.removeNode(h);var g=this.tail;h.list=this,h.prev=g,g&&(g.next=h),this.tail=h,this.head||(this.head=h),this.length++}},u.prototype.push=function(){for(var h=0,g=arguments.length;h<g;h++)f(this,arguments[h]);return this.length},u.prototype.unshift=function(){for(var h=0,g=arguments.length;h<g;h++)d(this,arguments[h]);return this.length},u.prototype.pop=function(){if(this.tail){var h=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,h}},u.prototype.shift=function(){if(this.head){var h=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,h}},u.prototype.forEach=function(h,g){g=g||this;for(var v=this.head,y=0;v!==null;y++)h.call(g,v.value,y,this),v=v.next},u.prototype.forEachReverse=function(h,g){g=g||this;for(var v=this.tail,y=this.length-1;v!==null;y--)h.call(g,v.value,y,this),v=v.prev},u.prototype.get=function(h){for(var g=0,v=this.head;v!==null&&g<h;g++)v=v.next;if(g===h&&v!==null)return v.value},u.prototype.getReverse=function(h){for(var g=0,v=this.tail;v!==null&&g<h;g++)v=v.prev;if(g===h&&v!==null)return v.value},u.prototype.map=function(h,g){g=g||this;for(var v=new u,y=this.head;y!==null;)v.push(h.call(g,y.value,this)),y=y.next;return v},u.prototype.mapReverse=function(h,g){g=g||this;for(var v=new u,y=this.tail;y!==null;)v.push(h.call(g,y.value,this)),y=y.prev;return v},u.prototype.reduce=function(h,g){var v,y=this.head;if(arguments.length>1)v=g;else if(this.head)y=this.head.next,v=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var A=0;y!==null;A++)v=h(v,y.value,A),y=y.next;return v},u.prototype.reduceReverse=function(h,g){var v,y=this.tail;if(arguments.length>1)v=g;else if(this.tail)y=this.tail.prev,v=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var A=this.length-1;y!==null;A--)v=h(v,y.value,A),y=y.prev;return v},u.prototype.toArray=function(){for(var h=new Array(this.length),g=0,v=this.head;v!==null;g++)h[g]=v.value,v=v.next;return h},u.prototype.toArrayReverse=function(){for(var h=new Array(this.length),g=0,v=this.tail;v!==null;g++)h[g]=v.value,v=v.prev;return h},u.prototype.slice=function(h,g){g=g||this.length,g<0&&(g+=this.length),h=h||0,h<0&&(h+=this.length);var v=new u;if(g<h||g<0)return v;h<0&&(h=0),g>this.length&&(g=this.length);for(var y=0,A=this.head;A!==null&&y<h;y++)A=A.next;for(;A!==null&&y<g;y++,A=A.next)v.push(A.value);return v},u.prototype.sliceReverse=function(h,g){g=g||this.length,g<0&&(g+=this.length),h=h||0,h<0&&(h+=this.length);var v=new u;if(g<h||g<0)return v;h<0&&(h=0),g>this.length&&(g=this.length);for(var y=this.length,A=this.tail;A!==null&&y>g;y--)A=A.prev;for(;A!==null&&y>h;y--,A=A.prev)v.push(A.value);return v},u.prototype.splice=function(h,g,...v){h>this.length&&(h=this.length-1),h<0&&(h=this.length+h);for(var y=0,A=this.head;A!==null&&y<h;y++)A=A.next;for(var _=[],y=0;A&&y<g;y++)_.push(A.value),A=this.removeNode(A);A===null&&(A=this.tail),A!==this.head&&A!==this.tail&&(A=A.prev);for(var y=0;y<v.length;y++)A=c(this,A,v[y]);return _},u.prototype.reverse=function(){for(var h=this.head,g=this.tail,v=h;v!==null;v=v.prev){var y=v.prev;v.prev=v.next,v.next=y}return this.head=g,this.tail=h,this};function c(h,g,v){var y=g===h.head?new p(v,null,g,h):new p(v,g,g.next,h);return y.next===null&&(h.tail=y),y.prev===null&&(h.head=y),h.length++,y}function f(h,g){h.tail=new p(g,h.tail,null,h),h.head||(h.head=h.tail),h.length++}function d(h,g){h.head=new p(g,null,h.head,h),h.tail||(h.tail=h.head),h.length++}function p(h,g,v,y){if(!(this instanceof p))return new p(h,g,v,y);this.list=y,this.value=h,g?(g.next=this,this.prev=g):this.prev=null,v?(v.prev=this,this.next=v):this.next=null}try{i("./iterator.js")(u)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(r,n,i,o,a)=>{client=mqttExports.connect(r,{username:n,password:i,reconnectPeriod:6e5}),client.on("connect",()=>{console.log("MQTT服务器连接成功"),console.log(client.options.clientId),client.subscribe(o,{qos:1})}),client.on("message",a)},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:"svg-viewer",props:{data:{},canvasDrag:{type:Boolean,default:!0}},emits:["onMessage"],setup(r,{expose:n,emit:i}){const o=r;vue.useCssVars(b=>({"2560e28f":vue.unref(c)})),setEditorLoadTime();const a=useGlobalStore(pinia);componentsRegister();const u=vue.reactive(o.data??{layout_center:{x:0,y:0},config:{svg:{background_color:"#fff",scale:1,grid_color:"#ebebeb"},net:{mqtt:{url:"",user:"",pwd:"",topics:""}}},done_json:[]}),c=vue.computed(()=>a.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),f=b=>{if(a.mouse_info.state!=EMouseInfoState.Down&&a.intention!==EGlobalStoreIntention.Connection||!o.canvasDrag)return;const{clientX:T,clientY:w}=b;a.mouse_info.new_position_x=a.mouse_info.now_position_x+T-a.mouse_info.position_x,a.mouse_info.new_position_y=a.mouse_info.now_position_y+w-a.mouse_info.position_y,a.intention==EGlobalStoreIntention.MoveCanvas&&(u.layout_center.x=a.mouse_info.new_position_x,u.layout_center.y=a.mouse_info.new_position_y)},d=()=>{a.mouse_info.state==EMouseInfoState.Down&&(a.intention!=EGlobalStoreIntention.Select&&(a.intention=EGlobalStoreIntention.None),a.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0})},p=b=>{const{clientX:T,clientY:w}=b;a.intention=EGlobalStoreIntention.MoveCanvas,a.mouse_info={state:EMouseInfoState.Down,position_x:T,position_y:w,now_position_x:u.layout_center.x,now_position_y:u.layout_center.y,new_position_x:u.layout_center.x,new_position_y:u.layout_center.y}};function h(b){b!=null&&b.wheelDelta&&(b.wheelDelta>0?u.config.svg.scale=parseFloat((u.config.svg.scale+.1).toFixed(1)):u.config.svg.scale=parseFloat((u.config.svg.scale-.1).toFixed(1)))}const g=(b,T,w)=>({x:b.x-b.width/2*T+b.width/2,y:b.y-b.height/2*w+b.height/2,width:b.width*T,height:b.height*w}),v=b=>{var w;let T=!1;if(((w=b.events)==null?void 0:w.length)>0){for(let x of b.events)if(x.type===EEventType.Click){T=!0;break}}return{cursor:T?"pointer":"default"}},y=(b,T)=>{var w;if(console.log(b.events,T),((w=b.events)==null?void 0:w.length)>0){for(let x of b.events)if(x.type===T){if(x.condition&&x.condition.type!=="None"&&x.condition.type==="Relation"&&x.condition.Relation&&x.condition.Relation.relation){const k=x.condition.Relation.key,M=x.condition.Relation.relation,D=valFormat(x.condition.Relation.val),z=valFormat(x.condition.Relation.val2);if(b.props.hasOwnProperty(k)){const j=b.props[k].val;if(!A(j,M,D,z))continue}}if(x.action===EEventAction.ChangeAttr){if(x.attrs&&x.attrs.length>0){let k;if(x.target){for(let M of u.done_json)if(M.id===x.target){k=M;break}}else k=b;if(!k)continue;for(let M of x.attrs)M.key==="state"?k.defaultState=valFormat(M.val):k.props.hasOwnProperty(M.key)&&(k.props[M.key].val=valFormat(M.val))}}else x.action===EEventAction.JavaScript&&new Function(x.scripts)()}}},A=(b,T,w,x)=>{switch(T){case">":return b>w;case">=":return b>=w;case"<":return b<w;case"<=":return b<=w;case"==":return b==w;case"!=":return b!=w;case">=,=<":return b>=w&&b<=x;case"<,>":return b<w||b>x}},_=()=>{const b=u.config.net.mqtt;b&&b.url&&b.user&&b.pwd&&b.topics&&sub(b.url,b.user,b.pwd,b.topics,(T,w)=>{console.log(T),console.log(w.toString()),i("onMessage",{topics:T,message:w})})},S=(b,T,w)=>setArrItemByID(b,T,w,u.done_json);return vue.onMounted(()=>{_()}),vue.onBeforeUnmount(close),n({setNodeAttrByID:S}),(b,T)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:p,onMousemove:f,onMouseup:d,onMousewheel:h,onContextmenu:T[4]||(T[4]=(...w)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...w))},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(u).config.svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("g",{transform:`translate(${vue.unref(u).layout_center.x},${vue.unref(u).layout_center.y})rotate(0)scale(${vue.unref(u).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(u).done_json,w=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:w.id,transform:`translate(${w.x},${w.y})rotate(0)scale(1)`,style:vue.normalizeStyle(v(w)),onClick:x=>y(w,vue.unref(EEventType).Click),onMousedown:T[0]||(T[0]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMousemove:T[1]||(T[1]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMouseup:T[2]||(T[2]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMousewheel:T[3]||(T[3]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(w)}`)},[vue.createElementVNode("g",{transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2})rotate(${w.rotate}) scale(1) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`},[w.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$y,{key:0,"item-info":w},null,8,["item-info"])):w.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${w.name}`},vue.unref(prosToVBind)(w),{width:"100",height:"100",id:w.id,transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),null,16,_hoisted_4)):w.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(w.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(w),{width:"100",height:"100",id:w.id,onOnChange:x=>y(w,vue.unref(EEventType).Change),transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):w.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},g(w.actual_bound,w.scale_x,w.scale_y),{id:`foreign-object${w.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(w.tag),vue.mergeProps(vue.unref(prosToVBind)(w),{id:w.id,onOnChange:x=>y(w,vue.unref(EEventType).Change),transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(w.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],44,_hoisted_2)),[[vue.vShow,w.display]])),128))],8,_hoisted_1)],4))],32))}}),svgViewer_vue_vue_type_style_index_0_scoped_5171fc53_lang="",svgViewer=_export_sfc$1(_sfc_main,[["__scopeId","data-v-5171fc53"]]);exports.SvgEditor=index,exports.SvgViewer=svgViewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});