mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-12-05 02:37:50 +00:00
1957 lines
1.3 MiB
Plaintext
1957 lines
1.3 MiB
Plaintext
(()=>{var Sj=Object.create;var KE=Object.defineProperty;var _j=Object.getOwnPropertyDescriptor;var Cj=Object.getOwnPropertyNames;var Dj=Object.getPrototypeOf,Fj=Object.prototype.hasOwnProperty;var Yo=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bj=(e,t)=>{for(var r in t)KE(e,r,{get:t[r],enumerable:!0})},Ij=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Cj(t))!Fj.call(e,s)&&s!==r&&KE(e,s,{get:()=>t[s],enumerable:!(n=_j(t,s))||n.enumerable});return e};var F=(e,t,r)=>(r=e!=null?Sj(Dj(e)):{},Ij(t||!e||!e.__esModule?KE(r,"default",{value:e,enumerable:!0}):r,e));var ci=be((VE,l8)=>{"use strict";var Lle=F(I()),Rp=function(e){return e&&e.Math===Math&&e};l8.exports=Rp(typeof globalThis=="object"&&globalThis)||Rp(typeof window=="object"&&window)||Rp(typeof self=="object"&&self)||Rp(typeof global=="object"&&global)||Rp(typeof VE=="object"&&VE)||(function(){return this})()||Function("return this")()});var Ja=be((Ule,f8)=>{"use strict";var Hle=F(I());f8.exports=function(e){try{return!!e()}catch{return!0}}});var dc=be((Mle,d8)=>{"use strict";var qle=F(I()),$j=Ja();d8.exports=!$j(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var GE=be((jle,h8)=>{"use strict";var Kle=F(I()),xj=Ja();h8.exports=!xj(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")})});var tg=be((Vle,p8)=>{"use strict";var Gle=F(I()),Rj=GE(),eg=Function.prototype.call;p8.exports=Rj?eg.bind(eg):function(){return eg.apply(eg,arguments)}});var w8=be(v8=>{"use strict";var Yle=F(I()),m8={}.propertyIsEnumerable,g8=Object.getOwnPropertyDescriptor,Tj=g8&&!m8.call({1:2},1);v8.f=Tj?function(t){var r=g8(this,t);return!!r&&r.enumerable}:m8});var zE=be((Wle,y8)=>{"use strict";var Xle=F(I());y8.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}});var Wo=be((Jle,A8)=>{"use strict";var Zle=F(I()),E8=GE(),b8=Function.prototype,YE=b8.call,kj=E8&&b8.bind.bind(YE,YE);A8.exports=E8?kj:function(e){return function(){return YE.apply(e,arguments)}}});var C8=be((Qle,_8)=>{"use strict";var efe=F(I()),S8=Wo(),Pj=S8({}.toString),Oj=S8("".slice);_8.exports=function(e){return Oj(Pj(e),8,-1)}});var F8=be((tfe,D8)=>{"use strict";var rfe=F(I()),Nj=Wo(),Lj=Ja(),Uj=C8(),WE=Object,Hj=Nj("".split);D8.exports=Lj(function(){return!WE("z").propertyIsEnumerable(0)})?function(e){return Uj(e)==="String"?Hj(e,""):WE(e)}:WE});var XE=be((nfe,B8)=>{"use strict";var sfe=F(I());B8.exports=function(e){return e==null}});var JE=be((ife,I8)=>{"use strict";var ofe=F(I()),Mj=XE(),qj=TypeError;I8.exports=function(e){if(Mj(e))throw new qj("Can't call method on "+e);return e}});var rg=be((afe,$8)=>{"use strict";var ufe=F(I()),jj=F8(),Kj=JE();$8.exports=function(e){return jj(Kj(e))}});var co=be((cfe,x8)=>{"use strict";var lfe=F(I()),ZE=typeof document=="object"&&document.all;x8.exports=typeof ZE>"u"&&ZE!==void 0?function(e){return typeof e=="function"||e===ZE}:function(e){return typeof e=="function"}});var nd=be((ffe,R8)=>{"use strict";var dfe=F(I()),Vj=co();R8.exports=function(e){return typeof e=="object"?e!==null:Vj(e)}});var eb=be((hfe,T8)=>{"use strict";var pfe=F(I()),QE=ci(),Gj=co(),zj=function(e){return Gj(e)?e:void 0};T8.exports=function(e,t){return arguments.length<2?zj(QE[e]):QE[e]&&QE[e][t]}});var P8=be((mfe,k8)=>{"use strict";var gfe=F(I()),Yj=Wo();k8.exports=Yj({}.isPrototypeOf)});var U8=be((vfe,L8)=>{"use strict";var wfe=F(I()),Wj=ci(),O8=Wj.navigator,N8=O8&&O8.userAgent;L8.exports=N8?String(N8):""});var G8=be((yfe,V8)=>{"use strict";var Efe=F(I()),K8=ci(),tb=U8(),H8=K8.process,M8=K8.Deno,q8=H8&&H8.versions||M8&&M8.version,j8=q8&&q8.v8,lo,ng;j8&&(lo=j8.split("."),ng=lo[0]>0&&lo[0]<4?1:+(lo[0]+lo[1]));!ng&&tb&&(lo=tb.match(/Edge\/(\d+)/),(!lo||lo[1]>=74)&&(lo=tb.match(/Chrome\/(\d+)/),lo&&(ng=+lo[1])));V8.exports=ng});var rb=be((bfe,Y8)=>{"use strict";var Afe=F(I()),z8=G8(),Xj=Ja(),Jj=ci(),Zj=Jj.String;Y8.exports=!!Object.getOwnPropertySymbols&&!Xj(function(){var e=Symbol("symbol detection");return!Zj(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&z8&&z8<41})});var nb=be((Sfe,W8)=>{"use strict";var _fe=F(I()),Qj=rb();W8.exports=Qj&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var sb=be((Cfe,X8)=>{"use strict";var Dfe=F(I()),eK=eb(),tK=co(),rK=P8(),nK=nb(),sK=Object;X8.exports=nK?function(e){return typeof e=="symbol"}:function(e){var t=eK("Symbol");return tK(t)&&rK(t.prototype,sK(e))}});var Z8=be((Ffe,J8)=>{"use strict";var Bfe=F(I()),iK=String;J8.exports=function(e){try{return iK(e)}catch{return"Object"}}});var eD=be((Ife,Q8)=>{"use strict";var $fe=F(I()),oK=co(),aK=Z8(),uK=TypeError;Q8.exports=function(e){if(oK(e))return e;throw new uK(aK(e)+" is not a function")}});var rD=be((xfe,tD)=>{"use strict";var Rfe=F(I()),cK=eD(),lK=XE();tD.exports=function(e,t){var r=e[t];return lK(r)?void 0:cK(r)}});var sD=be((Tfe,nD)=>{"use strict";var kfe=F(I()),ib=tg(),ob=co(),ab=nd(),fK=TypeError;nD.exports=function(e,t){var r,n;if(t==="string"&&ob(r=e.toString)&&!ab(n=ib(r,e))||ob(r=e.valueOf)&&!ab(n=ib(r,e))||t!=="string"&&ob(r=e.toString)&&!ab(n=ib(r,e)))return n;throw new fK("Can't convert object to primitive value")}});var oD=be((Pfe,iD)=>{"use strict";var Ofe=F(I());iD.exports=!1});var sg=be((Nfe,uD)=>{"use strict";var Lfe=F(I()),aD=ci(),dK=Object.defineProperty;uD.exports=function(e,t){try{dK(aD,e,{value:t,configurable:!0,writable:!0})}catch{aD[e]=t}return t}});var ig=be((Ufe,fD)=>{"use strict";var Hfe=F(I()),hK=oD(),pK=ci(),mK=sg(),cD="__core-js_shared__",lD=fD.exports=pK[cD]||mK(cD,{});(lD.versions||(lD.versions=[])).push({version:"3.49.0",mode:hK?"pure":"global",copyright:"\xA9 2013\u20132025 Denis Pushkarev (zloirock.ru), 2025\u20132026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var ub=be((Mfe,hD)=>{"use strict";var qfe=F(I()),dD=ig();hD.exports=function(e,t){return dD[e]||(dD[e]=t||{})}});var mD=be((jfe,pD)=>{"use strict";var Kfe=F(I()),gK=JE(),vK=Object;pD.exports=function(e){return vK(gK(e))}});var Za=be((Vfe,gD)=>{"use strict";var Gfe=F(I()),wK=Wo(),yK=mD(),EK=wK({}.hasOwnProperty);gD.exports=Object.hasOwn||function(t,r){return EK(yK(t),r)}});var cb=be((zfe,vD)=>{"use strict";var Yfe=F(I()),bK=Wo(),AK=0,SK=Math.random(),_K=bK(1.1.toString);vD.exports=function(e){return"Symbol("+(e===void 0?"":e)+")_"+_K(++AK+SK,36)}});var ED=be((Wfe,yD)=>{"use strict";var Xfe=F(I()),CK=ci(),DK=ub(),wD=Za(),FK=cb(),BK=rb(),IK=nb(),sd=CK.Symbol,lb=DK("wks"),$K=IK?sd.for||sd:sd&&sd.withoutSetter||FK;yD.exports=function(e){return wD(lb,e)||(lb[e]=BK&&wD(sd,e)?sd[e]:$K("Symbol."+e)),lb[e]}});var _D=be((Jfe,SD)=>{"use strict";var Zfe=F(I()),xK=tg(),bD=nd(),AD=sb(),RK=rD(),TK=sD(),kK=ED(),PK=TypeError,OK=kK("toPrimitive");SD.exports=function(e,t){if(!bD(e)||AD(e))return e;var r=RK(e,OK),n;if(r){if(t===void 0&&(t="default"),n=xK(r,e,t),!bD(n)||AD(n))return n;throw new PK("Can't convert object to primitive value")}return t===void 0&&(t="number"),TK(e,t)}});var fb=be((Qfe,CD)=>{"use strict";var ede=F(I()),NK=_D(),LK=sb();CD.exports=function(e){var t=NK(e,"string");return LK(t)?t:t+""}});var BD=be((tde,FD)=>{"use strict";var rde=F(I()),UK=ci(),DD=nd(),db=UK.document,HK=DD(db)&&DD(db.createElement);FD.exports=function(e){return HK?db.createElement(e):{}}});var hb=be((nde,ID)=>{"use strict";var sde=F(I()),MK=dc(),qK=Ja(),jK=BD();ID.exports=!MK&&!qK(function(){return Object.defineProperty(jK("div"),"a",{get:function(){return 7}}).a!==7})});var pb=be(xD=>{"use strict";var ode=F(I()),KK=dc(),VK=tg(),GK=w8(),zK=zE(),YK=rg(),WK=fb(),XK=Za(),JK=hb(),$D=Object.getOwnPropertyDescriptor;xD.f=KK?$D:function(t,r){if(t=YK(t),r=WK(r),JK)try{return $D(t,r)}catch{}if(XK(t,r))return zK(!VK(GK.f,t,r),t[r])}});var TD=be((ade,RD)=>{"use strict";var ude=F(I()),ZK=dc(),QK=Ja();RD.exports=ZK&&QK(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var mb=be((cde,kD)=>{"use strict";var lde=F(I()),eV=nd(),tV=String,rV=TypeError;kD.exports=function(e){if(eV(e))return e;throw new rV(tV(e)+" is not an object")}});var ag=be(OD=>{"use strict";var dde=F(I()),nV=dc(),sV=hb(),iV=TD(),og=mb(),PD=fb(),oV=TypeError,gb=Object.defineProperty,aV=Object.getOwnPropertyDescriptor,vb="enumerable",wb="configurable",yb="writable";OD.f=nV?iV?function(t,r,n){if(og(t),r=PD(r),og(n),typeof t=="function"&&r==="prototype"&&"value"in n&&yb in n&&!n[yb]){var s=aV(t,r);s&&s[yb]&&(t[r]=n.value,n={configurable:wb in n?n[wb]:s[wb],enumerable:vb in n?n[vb]:s[vb],writable:!1})}return gb(t,r,n)}:gb:function(t,r,n){if(og(t),r=PD(r),og(n),sV)try{return gb(t,r,n)}catch{}if("get"in n||"set"in n)throw new oV("Accessors not supported");return"value"in n&&(t[r]=n.value),t}});var Eb=be((hde,ND)=>{"use strict";var pde=F(I()),uV=dc(),cV=ag(),lV=zE();ND.exports=uV?function(e,t,r){return cV.f(e,t,lV(1,r))}:function(e,t,r){return e[t]=r,e}});var HD=be((mde,UD)=>{"use strict";var gde=F(I()),bb=dc(),fV=Za(),LD=Function.prototype,dV=bb&&Object.getOwnPropertyDescriptor,Ab=fV(LD,"name"),hV=Ab&&function(){}.name==="something",pV=Ab&&(!bb||bb&&dV(LD,"name").configurable);UD.exports={EXISTS:Ab,PROPER:hV,CONFIGURABLE:pV}});var qD=be((vde,MD)=>{"use strict";var wde=F(I()),mV=Wo(),gV=co(),Sb=ig(),vV=mV(Function.toString);gV(Sb.inspectSource)||(Sb.inspectSource=function(e){return vV(e)});MD.exports=Sb.inspectSource});var VD=be((yde,KD)=>{"use strict";var Ede=F(I()),wV=ci(),yV=co(),jD=wV.WeakMap;KD.exports=yV(jD)&&/native code/.test(String(jD))});var YD=be((bde,zD)=>{"use strict";var Ade=F(I()),EV=ub(),bV=cb(),GD=EV("keys");zD.exports=function(e){return GD[e]||(GD[e]=bV(e))}});var _b=be((Sde,WD)=>{"use strict";var _de=F(I());WD.exports={}});var QD=be((Cde,ZD)=>{"use strict";var Dde=F(I()),AV=VD(),JD=ci(),SV=nd(),_V=Eb(),Cb=Za(),Db=ig(),CV=YD(),DV=_b(),XD="Object already initialized",Fb=JD.TypeError,FV=JD.WeakMap,ug,Tp,cg,BV=function(e){return cg(e)?Tp(e):ug(e,{})},IV=function(e){return function(t){var r;if(!SV(t)||(r=Tp(t)).type!==e)throw new Fb("Incompatible receiver, "+e+" required");return r}};AV||Db.state?(fo=Db.state||(Db.state=new FV),fo.get=fo.get,fo.has=fo.has,fo.set=fo.set,ug=function(e,t){if(fo.has(e))throw new Fb(XD);return t.facade=e,fo.set(e,t),t},Tp=function(e){return fo.get(e)||{}},cg=function(e){return fo.has(e)}):(Bl=CV("state"),DV[Bl]=!0,ug=function(e,t){if(Cb(e,Bl))throw new Fb(XD);return t.facade=e,_V(e,Bl,t),t},Tp=function(e){return Cb(e,Bl)?e[Bl]:{}},cg=function(e){return Cb(e,Bl)});var fo,Bl;ZD.exports={set:ug,get:Tp,has:cg,enforce:BV,getterFor:IV}});var nF=be((Fde,rF)=>{"use strict";var Bde=F(I()),Ib=Wo(),$V=Ja(),xV=co(),lg=Za(),Bb=dc(),RV=HD().CONFIGURABLE,TV=qD(),tF=QD(),kV=tF.enforce,PV=tF.get,eF=String,fg=Object.defineProperty,OV=Ib("".slice),NV=Ib("".replace),LV=Ib([].join),UV=Bb&&!$V(function(){return fg(function(){},"length",{value:8}).length!==8}),HV=String(String).split("String"),MV=rF.exports=function(e,t,r){OV(eF(t),0,7)==="Symbol("&&(t="["+NV(eF(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!lg(e,"name")||RV&&e.name!==t)&&(Bb?fg(e,"name",{value:t,configurable:!0}):e.name=t),UV&&r&&lg(r,"arity")&&e.length!==r.arity&&fg(e,"length",{value:r.arity});try{r&&lg(r,"constructor")&&r.constructor?Bb&&fg(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=kV(e);return lg(n,"source")||(n.source=LV(HV,typeof t=="string"?t:"")),e};Function.prototype.toString=MV(function(){return xV(this)&&PV(this).source||TV(this)},"toString")});var iF=be((Ide,sF)=>{"use strict";var $de=F(I()),qV=co(),jV=ag(),KV=nF(),VV=sg();sF.exports=function(e,t,r,n){n||(n={});var s=n.enumerable,o=n.name!==void 0?n.name:t;if(qV(r)&&KV(r,o,n),n.global)s?e[t]=r:VV(t,r);else{try{n.unsafe?e[t]&&(s=!0):delete e[t]}catch{}s?e[t]=r:jV.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e}});var aF=be((xde,oF)=>{"use strict";var Rde=F(I()),GV=Math.ceil,zV=Math.floor;oF.exports=Math.trunc||function(t){var r=+t;return(r>0?zV:GV)(r)}});var $b=be((Tde,uF)=>{"use strict";var kde=F(I()),YV=aF();uF.exports=function(e){var t=+e;return t!==t||t===0?0:YV(t)}});var lF=be((Pde,cF)=>{"use strict";var Ode=F(I()),WV=$b(),XV=Math.max,JV=Math.min;cF.exports=function(e,t){var r=WV(e);return r<0?XV(r+t,0):JV(r,t)}});var dF=be((Nde,fF)=>{"use strict";var Lde=F(I()),ZV=$b(),QV=Math.min;fF.exports=function(e){var t=ZV(e);return t>0?QV(t,9007199254740991):0}});var pF=be((Ude,hF)=>{"use strict";var Hde=F(I()),eG=dF();hF.exports=function(e){return eG(e.length)}});var vF=be((Mde,gF)=>{"use strict";var qde=F(I()),tG=rg(),rG=lF(),nG=pF(),mF=function(e){return function(t,r,n){var s=tG(t),o=nG(s);if(o===0)return!e&&-1;var i=rG(n,o),a;if(e&&r!==r){for(;o>i;)if(a=s[i++],a!==a)return!0}else for(;o>i;i++)if((e||i in s)&&s[i]===r)return e||i||0;return!e&&-1}};gF.exports={includes:mF(!0),indexOf:mF(!1)}});var EF=be((jde,yF)=>{"use strict";var Kde=F(I()),sG=Wo(),xb=Za(),iG=rg(),oG=vF().indexOf,aG=_b(),wF=sG([].push);yF.exports=function(e,t){var r=iG(e),n=0,s=[],o;for(o in r)!xb(aG,o)&&xb(r,o)&&wF(s,o);for(;t.length>n;)xb(r,o=t[n++])&&(~oG(s,o)||wF(s,o));return s}});var AF=be((Vde,bF)=>{"use strict";var Gde=F(I());bF.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var _F=be(SF=>{"use strict";var Yde=F(I()),uG=EF(),cG=AF(),lG=cG.concat("length","prototype");SF.f=Object.getOwnPropertyNames||function(t){return uG(t,lG)}});var DF=be(CF=>{"use strict";var Xde=F(I());CF.f=Object.getOwnPropertySymbols});var BF=be((Jde,FF)=>{"use strict";var Zde=F(I()),fG=eb(),dG=Wo(),hG=_F(),pG=DF(),mG=mb(),gG=dG([].concat);FF.exports=fG("Reflect","ownKeys")||function(t){var r=hG.f(mG(t)),n=pG.f;return n?gG(r,n(t)):r}});var xF=be((Qde,$F)=>{"use strict";var ehe=F(I()),IF=Za(),vG=BF(),wG=pb(),yG=ag();$F.exports=function(e,t,r){for(var n=vG(t),s=yG.f,o=wG.f,i=0;i<n.length;i++){var a=n[i];!IF(e,a)&&!(r&&IF(r,a))&&s(e,a,o(t,a))}}});var TF=be((the,RF)=>{"use strict";var rhe=F(I()),EG=Ja(),bG=co(),AG=/#|\.prototype\./,kp=function(e,t){var r=_G[SG(e)];return r===DG?!0:r===CG?!1:bG(t)?EG(t):!!t},SG=kp.normalize=function(e){return String(e).replace(AG,".").toLowerCase()},_G=kp.data={},CG=kp.NATIVE="N",DG=kp.POLYFILL="P";RF.exports=kp});var PF=be((nhe,kF)=>{"use strict";var she=F(I()),dg=ci(),FG=pb().f,BG=Eb(),IG=iF(),$G=sg(),xG=xF(),RG=TF();kF.exports=function(e,t){var r=e.target,n=e.global,s=e.stat,o,i,a,u,l,f;if(n?i=dg:s?i=dg[r]||$G(r,{}):i=dg[r]&&dg[r].prototype,i)for(a in t){if(l=t[a],e.dontCallGetSet?(f=FG(i,a),u=f&&f.value):u=i[a],o=RG(n?a:r+(s?".":"#")+a,e.forced),!o&&u!==void 0){if(typeof l==typeof u)continue;xG(l,u)}(e.sham||u&&u.sham)&&BG(l,"sham",!0),IG(i,a,l,e)}}});var OF=be(()=>{"use strict";var ahe=F(I()),TG=PF(),kG=Za();TG({target:"Object",stat:!0},{hasOwn:kG})});var LF=be((uhe,NF)=>{"use strict";var che=F(I()),PG=ci();NF.exports=PG});var HF=be((lhe,UF)=>{"use strict";var fhe=F(I());OF();var OG=LF();UF.exports=OG.Object.hasOwn});var qF=be((dhe,MF)=>{"use strict";var hhe=F(I()),NG=HF();MF.exports=NG});var I=be((phe,jF)=>{"use strict";var LG=qF();jF.exports=LG});var hg,Rb=re(()=>{hg="2.44.32"});var VF=be(KF=>{"use strict";var vhe=F(I());(function(e){function t(){}function r(){}var n=String.fromCharCode,s={}.toString,o=s.call(e.SharedArrayBuffer),i=s(),a=e.Uint8Array,u=a||Array,l=a?ArrayBuffer:u,f=l.isView||function(v){return v&&"length"in v},m=s.call(l.prototype);l=r.prototype;var p=e.TextEncoder,d=new(a?Uint16Array:u)(32);t.prototype.decode=function(v){if(!f(v)){var g=s.call(v);if(g!==m&&g!==o&&g!==i)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");v=a?new u(v):v||[]}for(var y=g="",w=0,E=v.length|0,S=E-32|0,C,D,H=0,K=0,_,x=0,j=-1;w<E;){for(C=w<=S?32:E-w|0;x<C;w=w+1|0,x=x+1|0){switch(D=v[w]&255,D>>4){case 15:if(_=v[w=w+1|0]&255,_>>6!==2||247<D){w=w-1|0;break}H=(D&7)<<6|_&63,K=5,D=256;case 14:_=v[w=w+1|0]&255,H<<=6,H|=(D&15)<<6|_&63,K=_>>6===2?K+4|0:24,D=D+256&768;case 13:case 12:_=v[w=w+1|0]&255,H<<=6,H|=(D&31)<<6|_&63,K=K+7|0,w<E&&_>>6===2&&H>>K&&1114112>H?(D=H,H=H-65536|0,0<=H&&(j=(H>>10)+55296|0,D=(H&1023)+56320|0,31>x?(d[x]=j,x=x+1|0,j=-1):(_=j,j=D,D=_))):(D>>=8,w=w-D-1|0,D=65533),H=K=0,C=w<=S?32:E-w|0;default:d[x]=D;continue;case 11:case 10:case 9:case 8:}d[x]=65533}if(y+=n(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15],d[16],d[17],d[18],d[19],d[20],d[21],d[22],d[23],d[24],d[25],d[26],d[27],d[28],d[29],d[30],d[31]),32>x&&(y=y.slice(0,x-32|0)),w<E){if(d[0]=j,x=~j>>>31,j=-1,y.length<g.length)continue}else j!==-1&&(y+=n(j));g+=y,y=""}return g},l.encode=function(v){v=v===void 0?"":""+v;var g=v.length|0,y=new u((g<<1)+8|0),w,E=0,S=!a;for(w=0;w<g;w=w+1|0,E=E+1|0){var C=v.charCodeAt(w)|0;if(127>=C)y[E]=C;else{if(2047>=C)y[E]=192|C>>6;else{e:{if(55296<=C)if(56319>=C){var D=v.charCodeAt(w=w+1|0)|0;if(56320<=D&&57343>=D){if(C=(C<<10)+D-56613888|0,65535<C){y[E]=240|C>>18,y[E=E+1|0]=128|C>>12&63,y[E=E+1|0]=128|C>>6&63,y[E=E+1|0]=128|C&63;continue}break e}C=65533}else 57343>=C&&(C=65533);!S&&w<<1<E&&w<<1<(E-7|0)&&(S=!0,D=new u(3*g),D.set(y),y=D)}y[E]=224|C>>12,y[E=E+1|0]=128|C>>6&63}y[E=E+1|0]=128|C&63}}return a?y.subarray(0,E):y.slice(0,E)},p||(e.TextDecoder=t,e.TextEncoder=r)})(typeof global>"u"?typeof self>"u"?KF:self:global)});var yhe,Tb,pt,Gt,zt,Lt,zn,$t,Pp,Yr,pg,GF,Op,zF,Il,$l,xl,Rl,kb,dr=re(()=>{yhe=F(I()),Tb="schemaVersion",pt="settings",Gt="subs",zt="collections",Lt="files",zn="modules",$t="artifacts",Pp="rules",Yr="tokens",pg="archives",GF="Auto Generated Sub-Store Backup",Op="Sub-Store",zF=["ask","overwrite","keep"],Il="Sub-Store Artifacts Repository",$l="#sub-store-cached-resource",xl="#sub-store-cached-headers-resource",Rl="#sub-store-cached-script-resource",kb="#sub-store-logs"});function KG(e,{isNode:t}={}){let r=Array.from(e||[]);if(!t)return r;let n=new Date().toLocaleString();if(typeof r[0]=="string"){let[o,...i]=r;return[`${i.length?QF(n):n} ${o}`,...i]}return[r.length?QF(n):n,...r]}function QF(e){return`${e}`.replace(/%/g,"%%")}function VG(e,t=WF){let r=eB(t,WF,mg);return eB(e,r,mg)}function oB(e,t=0){let r=tB(t,0,mg);return tB(e,r,mg)}function GG(e){return Array.from(e||[]).map(rz).join(" ")}function aB(e){try{let t=e.read(kb);if(!t)return[];let r=typeof t=="string"?JSON.parse(t):t;return Array.isArray(r)?r.filter(nz):[]}catch{return[]}}function gg(e,t){e.write(JSON.stringify(Array.isArray(t)?t:[]),kb)}function zG(e,t,r){try{let n=YG(e);if(n===0)return;let s=GG(r);if(hB(s))return;let o=aB(e),i=dB(t);o.push({id:sz(),time:Date.now(),level:i,message:WG(s,i)}),gg(e,o.slice(-n))}catch{}}function uB(){Np=null,Ob=0}function cB(e,t={}){let r=e.read(pt)||{},n=oB(r.logsMaxCount);if(n===0)return{logs:[],total:0,maxCount:n};let s=VG(t.limit,n),o=`${t.keyword||""}`.trim(),i=rB(t.regex),a=rB(t.ignoreCase),u=XG(o,{isRegex:i,ignoreCase:a}),l=aB(e),f=l.filter(p=>!ZG(p)),m=f.length!==l.length;return l=f,l.length>n?(l=l.slice(-n),gg(e,l)):m&&gg(e,l),u&&(l=l.filter(p=>u(JG(p)))),{logs:l.slice(-s).reverse(),total:l.length,maxCount:n}}function lB(e){gg(e,[])}function fB(e){ZF||typeof console>"u"||(ZF=!0,nB.forEach(t=>{let r=console[t];typeof r=="function"&&(console[t]=function(...n){if(r.apply(console,KG(n,{isNode:e.env.isNode})),!Pb)try{Pb=!0,zG(e,t,n)}finally{Pb=!1}})}))}function eB(e,t,r){let n=Number(e);return!isFinite(n)||n<=0?t:Math.min(Math.floor(n),r)}function YG(e){let t=Date.now();if(Np!==null&&t<Ob)return Np;let r=e.read(pt)||{};return Np=oB(r.logsMaxCount),Ob=t+HG,Np}function tB(e,t,r){if(e==null||e==="")return t;let n=Number(e);return!isFinite(n)||n<0?t:Math.min(Math.floor(n),r)}function rB(e){return e===!0||e===1||e==="1"||e==="true"||e==="on"}function dB(e){return nB.includes(e)?e:"log"}function WG(e,t){let r=`${e||""}`;if(iB.test(r))return r;let n=dB(t).toUpperCase(),s=r.match(qG);if(s){let o=s[1].trim()||XF,i=r.slice(s[0].length).trimStart();return`[${o}] ${n}: ${i}`}return`[${XF}] ${n}: ${r}`}function XG(e,{isRegex:t,ignoreCase:r}){if(!e)return null;if(t){let s=new RegExp(e,r?"i":"");return o=>s.test(o)}let n=r?e.toLowerCase():e;return s=>(r?s.toLowerCase():s).includes(n)}function JG(e){return`${e.level||""}
|
||
${e.message||""}`}function ZG(e){return hB(e.message)}function hB(e){let t=QG(e);return t.length===1?sB.test(t[0])||tz(t[0]):ez(t)}function QG(e){let t=`${e||""}`.split(/\r?\n/).map(n=>n.trim()).filter(Boolean);if(t.length===0)return t;let r=t[0].replace(iB,"").trim();return r!==t[0]&&(r?t[0]=r:t.shift()),t}function ez(e){return e.length<3||!JF.test(e[0])||!JF.test(e[e.length-1])?!1:e.slice(1,-1).some(t=>sB.test(t))}function tz(e){let t=e.replace(MG,"");return jG.some(r=>r.test(t))}function rz(e){if(e instanceof Error)return e.stack||e.message||String(e);if(typeof e=="string")return e;if(e==null)return String(e);if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function nz(e){return e&&typeof e=="object"&&typeof e.id=="string"&&typeof e.time=="number"&&typeof e.level=="string"&&typeof e.message=="string"}function sz(){return`${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var Ahe,WF,mg,HG,nB,XF,sB,JF,MG,iB,qG,jG,ZF,Pb,Np,Ob,vg=re(()=>{Ahe=F(I());dr();WF=200,mg=1e4,HG=1e3,nB=["log","info","warn","error","debug"],XF="unknown",sB=/^Sub-Store\s+--\s+v\d+(?:\.\d+){0,3}$/,JF=/^\u2505{8,}$/,MG=/^\[sub-store\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/,iB=/^\[[^\]\r\n]+\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/i,qG=/^\[([^\]\r\n]+)\]\s*/,jG=[/^(?:.+\sParser|Rule parser \[.+\]) is activated!?$/,/^Pre-processor \[.+\] activated!?$/,/^Fallback Base64 Pre-processor error: decoded line does not start with protocol$/,/^\[CORS\] allowed origins: .+$/],ZF=!1,Pb=!1,Np=null,Ob=0});function Us(e){if(hr().isNode)try{return e()}catch{return}}var Che,hc=re(()=>{Che=F(I());li()});function Pi(){return Us(()=>Yo("fs"))}var Bhe,od=re(()=>{Bhe=F(I());hc()});var $he,yB,iz,ud,pB,mB,oz,Lp,wg,az,Bn,gB,EB,bB,AB,Ub,Nb,yg,uz,cz,SB,vB,ad,wB,lz,fz,_B,CB,Hb,DB,FB,dz,BB,Lb,hz,IB,$B,xB,pz,mt,Xo=re(()=>{$he=F(I(),1),yB="3.7.8",iz=yB,ud=typeof Buffer=="function",pB=typeof TextDecoder=="function"?new TextDecoder:void 0,mB=typeof TextEncoder=="function"?new TextEncoder:void 0,oz="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Lp=Array.prototype.slice.call(oz),wg=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(Lp),az=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Bn=String.fromCharCode.bind(String),gB=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),EB=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),bB=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),AB=e=>{let t,r,n,s,o="",i=e.length%3;for(let a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255||(s=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|s,o+=Lp[t>>18&63]+Lp[t>>12&63]+Lp[t>>6&63]+Lp[t&63]}return i?o.slice(0,i-3)+"===".substring(i):o},Ub=typeof btoa=="function"?e=>btoa(e):ud?e=>Buffer.from(e,"binary").toString("base64"):AB,Nb=ud?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,s=e.length;n<s;n+=4096)r.push(Bn.apply(null,e.subarray(n,n+4096)));return Ub(r.join(""))},yg=(e,t=!1)=>t?EB(Nb(e)):Nb(e),uz=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?Bn(192|t>>>6)+Bn(128|t&63):Bn(224|t>>>12&15)+Bn(128|t>>>6&63)+Bn(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return Bn(240|t>>>18&7)+Bn(128|t>>>12&63)+Bn(128|t>>>6&63)+Bn(128|t&63)}},cz=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,SB=e=>e.replace(cz,uz),vB=ud?e=>Buffer.from(e,"utf8").toString("base64"):mB?e=>Nb(mB.encode(e)):e=>Ub(SB(e)),ad=(e,t=!1)=>t?EB(vB(e)):vB(e),wB=e=>ad(e,!0),lz=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,fz=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return Bn((r>>>10)+55296)+Bn((r&1023)+56320);case 3:return Bn((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Bn((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},_B=e=>e.replace(lz,fz),CB=e=>{if(e=e.replace(/\s+/g,""),!az.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r,n,s=[];for(let o=0;o<e.length;)t=wg[e.charAt(o++)]<<18|wg[e.charAt(o++)]<<12|(r=wg[e.charAt(o++)])<<6|(n=wg[e.charAt(o++)]),r===64?s.push(Bn(t>>16&255)):n===64?s.push(Bn(t>>16&255,t>>8&255)):s.push(Bn(t>>16&255,t>>8&255,t&255));return s.join("")},Hb=typeof atob=="function"?e=>atob(bB(e)):ud?e=>Buffer.from(e,"base64").toString("binary"):CB,DB=ud?e=>gB(Buffer.from(e,"base64")):e=>gB(Hb(e).split("").map(t=>t.charCodeAt(0))),FB=e=>DB(BB(e)),dz=ud?e=>Buffer.from(e,"base64").toString("utf8"):pB?e=>pB.decode(DB(e)):e=>_B(Hb(e)),BB=e=>bB(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Lb=e=>dz(BB(e)),hz=e=>{if(typeof e!="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},IB=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),$B=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,IB(r));e("fromBase64",function(){return Lb(this)}),e("toBase64",function(t){return ad(this,t)}),e("toBase64URI",function(){return ad(this,!0)}),e("toBase64URL",function(){return ad(this,!0)}),e("toUint8Array",function(){return FB(this)})},xB=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,IB(r));e("toBase64",function(t){return yg(this,t)}),e("toBase64URI",function(){return yg(this,!0)}),e("toBase64URL",function(){return yg(this,!0)})},pz=()=>{$B(),xB()},mt={version:yB,VERSION:iz,atob:Hb,atobPolyfill:CB,btoa:Ub,btoaPolyfill:AB,fromBase64:Lb,toBase64:ad,encode:ad,encodeURI:wB,encodeURL:wB,utob:SB,btou:_B,decode:Lb,isValid:hz,fromUint8Array:yg,toUint8Array:FB,extendString:$B,extendUint8Array:xB,extendBuiltins:pz}});function Eg(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function vz(e){let[t,r,n,s,o,i,a]=e.match(/^socks5:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(o)o=parseInt(o,10);else throw $.error(`port is not present in line: ${e}`),new Error(`port is not present in line: ${e}`);return{type:5,host:s,port:o,userId:r!=null?decodeURIComponent(r):void 0,password:n!=null?decodeURIComponent(n):void 0}}function wz(e){let t=[],r=!1;for(let[n,s]of Object.entries(e||{})){let o=n.toLowerCase();o==="accept"&&(r=!0,s==null)||t.push([o,s])}return r||t.push(["accept","*/*"]),Object.fromEntries(t)}function hr(){return{isQX:pc,isLoon:Zo,isSurge:mc,isNode:Jo,isStash:RB,isShadowRocket:TB,isEgern:Qa,isLanceX:mz,isGUIforCores:gc,isSubsCheckPro:gz}}function yz(e){return async(t,r={})=>{let n=r.body;if(n!=null&&typeof n!="string"&&!(n instanceof Uint8Array)&&!(n instanceof ArrayBuffer))throw new Error("unsupported notification request body");let s=Object.fromEntries(new Headers(r.headers).entries()),o=await e.request({url:t,method:r.method||"GET",headers:s,body:n instanceof ArrayBuffer?new Uint8Array(n):n,encoding:null,timeout:8e3});return new Response([204,205,304].includes(o.statusCode)?null:o.body,{status:o.statusCode})}}function Oi(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores,isEgern}=hr(),methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],URL_REGEX=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,requestIdCounter=0;function generateRequestId(){return`${Date.now()}-${++requestIdCounter}`}async function send(method,options){options=typeof options=="string"?{url:options}:options;let baseURL=defaultOptions.baseURL;baseURL&&!URL_REGEX.test(options.url||"")&&(options.url=baseURL?baseURL+options.url:options.url),options={...defaultOptions,...options};let timeout=options.timeout,requestId=options.requestId||generateRequestId(),events={onRequest:()=>{},onResponse:e=>e,onTimeout:()=>{},...options.events};if(events.onRequest(method,options),options.node&&isSurge){let e=$environment["surge-build"];e&&parseInt(e)>=2407&&(options["policy-descriptor"]=options.node,delete options.node)}let worker;return isQX?worker=$task.fetch({method,url:options.url,headers:options.headers,body:options.body,opts:options.opts}):isLoon||isSurge||isNode||isEgern?worker=new Promise((resolve,reject)=>{let body=options.body,opts=JSON.parse(JSON.stringify(options));if(opts.body=body,opts.timeout=Number(opts.timeout)||8e3,isNode){let undici=require('undici'),{socksDispatcher}=require('fetch-socks'),defaultMaxHeaderSize=32*1024,parsedMaxHeaderSize=Number.parseInt(eval("process.env.SUB_STORE_MAX_HEADER_SIZE"),10),maxHeaderSize=Number.isInteger(parsedMaxHeaderSize)&&parsedMaxHeaderSize>0?parsedMaxHeaderSize:defaultMaxHeaderSize,{ProxyAgent,EnvHttpProxyAgent,request,interceptors}=undici,allowH2=opts.allowH2!==!1,agentOpts={connect:{rejectUnauthorized:!(opts.strictSSL===!1||opts.insecure===!0||opts.rejectUnauthorized===!1),allowH2},bodyTimeout:opts.timeout,headersTimeout:opts.timeout,maxHeaderSize,allowH2},tlsOptions={rejectUnauthorized:agentOpts.connect.rejectUnauthorized,allowH2};opts.tls={...opts.tls||{},...tlsOptions};try{let url=new URL(opts.url);(url.username||url.password)&&(opts.headers={...opts.headers||{},Authorization:`Basic ${Buffer.from(`${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`).toString("base64")}`}),opts.headers=wz(opts.headers);let dispatcher;if(!opts.proxy){let allProxy=eval("process.env.all_proxy")||eval("process.env.ALL_PROXY");allProxy&&/^socks5:\/\//.test(allProxy)&&(opts.proxy=allProxy)}opts.proxy?/^socks5:\/\//.test(opts.proxy)?dispatcher=socksDispatcher(vz(opts.proxy),{...agentOpts,requestTls:tlsOptions}):dispatcher=new ProxyAgent({...agentOpts,uri:opts.proxy,requestTls:tlsOptions,proxyTunnel:opts.proxyTunnel}):dispatcher=new EnvHttpProxyAgent({...agentOpts,requestTls:tlsOptions,proxyTunnel:opts.proxyTunnel}),request(opts.url,{...opts,method:method.toUpperCase(),dispatcher:dispatcher.compose(interceptors.redirect({maxRedirections:3,throwOnMaxRedirect:!0}),interceptors.decompress({skipErrorResponses:!1}))}).then(async e=>{let t=opts.encoding===null?await e.body.arrayBuffer():await e.body.text();resolve({statusCode:e.statusCode,headers:e.headers,body:t,requestId})}).catch(reject)}catch(e){reject(e)}}else{(isSurge||isEgern||RB||TB)&&(opts.timeout=Math.ceil(opts.timeout/1e3));try{$httpClient[method.toLowerCase()](opts,(e,t,r)=>{if(e){reject(e);return}resolve({statusCode:t?.status||t?.statusCode,headers:t?.headers||{},body:r,requestId})})}catch(e){reject(e)}}}):isGUIforCores&&(worker=new Promise(async(e,t)=>{try{let r=await $Plugins.Requests({method,url:options.url,headers:options.headers,body:options.body,autoTransformBody:!1,options:{Proxy:options.proxy,Timeout:options.timeout?options.timeout/1e3:15}});e({statusCode:r.status,headers:r.headers,body:r.body,requestId})}catch(r){t(r)}})),new Promise((e,t)=>{let r=!1,n=!1,s=null,o=()=>{s!==null&&(clearTimeout(s),s=null)},i=async u=>{if(!(r||n)){n=!0;try{if(await Promise.resolve(events.onResponse(u)),r)return;r=!0,o(),e({...u,requestId})}catch(l){if(r)return;r=!0,o(),t(l)}}},a=u=>{r||(r=!0,o(),t(u))};worker.then(async u=>{await i(u)},u=>{a(u)}),timeout&&(s=setTimeout(()=>{if(!r){try{events.onTimeout()}catch{}a(new Error(`${method} URL: ${options.url} exceeds the timeout ${timeout} ms`))}},timeout))})}let http={request:e=>send(e.method||"GET",e)};return methods.forEach(e=>http[e.toLowerCase()]=t=>send(e,t)),http}var Phe,pc,Zo,Qa,mc,Jo,RB,TB,mz,gc,gz,bg,li=re(()=>{Phe=F(I());vg();od();Xo();pc=typeof $task<"u",Zo=typeof $loon<"u",Qa=typeof Egern<"u",mc=typeof $httpClient<"u"&&!Zo&&!Qa,Jo=eval('typeof process !== "undefined"'),RB=typeof $environment<"u"&&$environment["stash-version"],TB=typeof $rocket<"u",mz=typeof $native<"u",gc=typeof $Plugins<"u",gz=Zo&&typeof $loon=="object"&&$loon!==null&&$loon.isSubsCheckPro===!0;bg=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=Oi(),this.env=hr(),Jo){let dotenv=require("dotenv");dotenv.config()}this.node=Jo?{fs:Pi()}:null,this.initCache(),fB(this);let delay=(e,t)=>new Promise(function(r){setTimeout(r.bind(null,t),e)});Promise.prototype.delay=async function(e){let t=await this;return await delay(e,t)}}initCache(){if(pc&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(Zo||mc||Qa)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),gc&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),Jo){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".",rootPath=`${basePath}/root.json`,backupRootPath=`${basePath}/root_${Date.now()}.json`;if(this.log(`Root path: ${rootPath}`),this.node.fs.existsSync(rootPath))try{this.root=JSON.parse(this.node.fs.readFileSync(`${rootPath}`))}catch(e){this.node.fs.copyFileSync(rootPath,backupRootPath),this.error(`Failed to parse ${rootPath}: ${e.message}. Backup created at ${backupRootPath}`)}Eg(this.root)||(this.node.fs.writeFileSync(rootPath,JSON.stringify({}),{flag:"w"}),this.root={});let fpath=`${basePath}/${this.name}.json`,backupPath=`${basePath}/${this.name}_${Date.now()}.json`;if(this.log(`Data path: ${fpath}`),this.node.fs.existsSync(fpath))try{if(this.cache=JSON.parse(this.node.fs.readFileSync(`${fpath}`,"utf-8")),!Eg(this.cache))throw new Error("Invalid Data")}catch{try{let t=mt.decode(this.node.fs.readFileSync(`${fpath}`,"utf-8"));if(this.cache=JSON.parse(t),this.node.fs.writeFileSync(fpath,t,{flag:"w"}),!Eg(this.cache))throw new Error("Invalid Data")}catch(t){this.node.fs.copyFileSync(fpath,backupPath),this.error(`Failed to parse ${fpath}: ${t.message}. Backup created at ${backupPath}`)}}Eg(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(pc&&$prefs.setValueForKey(data,this.name),(Zo||mc||Qa)&&$persistentStore.write(data,this.name),gc&&$Plugins.SubStoreCache.set(this.name,data),Jo){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".";this.node.fs.writeFileSync(`${basePath}/${this.name}.json`,data,{flag:"w"},e=>console.log(e)),this.node.fs.writeFileSync(`${basePath}/root.json`,JSON.stringify(this.root,null,2),{flag:"w"},e=>console.log(e))}}write(e,t){if(this.log(`SET ${t}`),t.indexOf("#")!==-1){if(t=t.substr(1),mc||Zo||Qa)return $persistentStore.write(e,t);if(pc)return $prefs.setValueForKey(e,t);if(Jo&&(this.root[t]=e),gc)return $Plugins.SubStoreCache.set(t,e)}else this.cache[t]=e;this.persistCache()}read(e){if(this.log(`READ ${e}`),e.indexOf("#")!==-1){if(e=e.substr(1),mc||Zo||Qa)return $persistentStore.read(e);if(pc)return $prefs.valueForKey(e);if(Jo)return this.root[e];if(gc)return $Plugins.SubStoreCache.get(e)}else return this.cache[e]}delete(e){if(this.log(`DELETE ${e}`),e.indexOf("#")!==-1){if(e=e.substr(1),mc||Zo||Qa)return $persistentStore.write(null,e);if(pc)return $prefs.removeValueForKey(e);if(Jo&&delete this.root[e],gc)return $Plugins.SubStoreCache.remove(e)}else delete this.cache[e];this.persistCache()}notify(title,subtitle="",content="",options={}){let openURL=options["open-url"],mediaURL=options["media-url"];if(pc&&$notify(title,subtitle,content,options),(mc||Qa)&&$notification.post(title,subtitle,content+`${mediaURL?`
|
||
\u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),Zo){let e={};openURL&&(e.openUrl=openURL),mediaURL&&(e.mediaUrl=mediaURL),JSON.stringify(e)==="{}"?$notification.post(title,subtitle,content):$notification.post(title,subtitle,content,e)}if(Jo){let content_=content+(openURL?`
|
||
\u70B9\u51FB\u8DF3\u8F6C: ${openURL}`:"")+(mediaURL?`
|
||
\u591A\u5A92\u4F53: ${mediaURL}`:"");console.log(`[Notify] ${title}
|
||
${subtitle}
|
||
${content_}
|
||
|
||
`);let push=eval("process.env.SUB_STORE_PUSH_SERVICE");if(push)if(/^https?:\/\//.test(push)){let e=push.replace("[\u63A8\u9001\u6807\u9898]",encodeURIComponent(title||"Sub-Store")).replace("[\u63A8\u9001\u5185\u5BB9]",encodeURIComponent([subtitle,content_].map(r=>r).join(`
|
||
`)));Oi().get({url:e}).then(r=>{console.log(`[Push Service] URL: ${e}
|
||
RES: ${r.statusCode} ${r.body}`)}).catch(r=>{console.log(`[Push Service] URL: ${e}
|
||
ERROR: ${r}`)})}else import("shoutrrr-ts").then(({send:e})=>e(push,`${title}
|
||
${subtitle}
|
||
${content_}`,{transport:yz(Oi())}).then(()=>console.log("[Push Service] RES: sent"),t=>console.log(`[Push Service] ERROR: ${t.message}`))).catch(()=>console.log("[Push Service] ERROR: notification delivery failed"))}gc&&$Plugins.Notify(title,subtitle+`
|
||
`+content)}log(e){this.debug&&console.log(`[${this.name}] LOG: ${e}`)}info(e){console.log(`[${this.name}] INFO: ${e}`)}warn(e){console.log(`[${this.name}] WARN: ${e}`)}error(e){console.log(`[${this.name}] ERROR: ${e}`)}wait(e){return new Promise(t=>setTimeout(t,e))}done(e={}){pc||Zo||mc||gc||Qa?$done(e):Jo&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}}});var Uhe,Ohe,Ez,R,gt=re(()=>{Uhe=F(I()),Ohe=F(VF());li();Ez=new bg("sub-store"),R=Ez});function Mb(){return Us(()=>Yo("node:worker_threads"))}var qhe,kB=re(()=>{qhe=F(I());hc()});function vc(){bz()}function bz(){let e=R.read(Tb);e||Az(),e!=="2.0"&&R.write("2.0",Tb)}function Az(){R.info("Start migrating...");let e=R.read(Gt)||{},t=Object.values(e).map(v=>(v.source=v.source||"remote",p(v),d(v),v));R.write(t,Gt);let r=R.read(zt)||{},n=Object.values(r).map(v=>(delete v.ua,p(v),d(v),v));R.write(n,zt);let s=R.read($t)||{},o=Object.values(s);R.write(o,$t);let i=R.read(Pp)||{},a=Object.values(i);R.write(a,Pp);let u=R.read(Lt)||{},l=Object.values(u);R.write(l,Lt);let f=R.read(Yr)||{},m=Object.values(f);R.write(m,Yr),delete R.cache.builtin,R.info("Migration complete!");function p(v){let g=v["display-name"];g&&(v.displayName=g,delete v["display-name"])}function d(v){let g=v.process;if(!g||g.length===0)return;let y=[],w={type:"Quick Setting Operator",args:{udp:"DEFAULT",tfo:"DEFAULT",scert:"DEFAULT","vmess aead":"DEFAULT",useless:"DEFAULT"}};for(let E of g)if(E.type){if(E.type==="Useless Filter")w.args.useless="ENABLED";else if(E.type==="Set Property Operator"){let{key:S,value:C}=E.args;switch(S){case"udp":w.args.udp=C?"ENABLED":"DISABLED";break;case"tfo":w.args.tfo=C?"ENABLED":"DISABLED";break;case"skip-cert-verify":w.args.scert=C?"ENABLED":"DISABLED";break;case"aead":w.args["vmess aead"]=C?"ENABLED":"DISABLED";break}}else if(E.type.indexOf("Keyword")===-1)if(E.type==="Flag Operator"){let S=typeof E.args>"u"?!0:E.args;E.args={mode:S?"add":"remove"},y.push(E)}else y.push(E)}y.unshift(w),v.process=y}}var Ghe,Ag=re(()=>{Ghe=F(I());dr();gt()});var ho=be((cd,Up)=>{var zhe=F(I());(function(){var e,t="4.18.1",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",o="Invalid `variable` option passed into `_.template`",i="Invalid `imports` option passed into `_.template`",a="__lodash_hash_undefined__",u=500,l="__lodash_placeholder__",f=1,m=2,p=4,d=1,v=2,g=1,y=2,w=4,E=8,S=16,C=32,D=64,H=128,K=256,_=512,x=30,j="...",U=800,k=16,N=1,O=2,L=3,T=1/0,M=9007199254740991,W=17976931348623157e292,G=NaN,J=4294967295,te=J-1,ie=J>>>1,ge=[["ary",H],["bind",g],["bindKey",y],["curry",E],["curryRight",S],["flip",_],["partial",C],["partialRight",D],["rearg",K]],he="[object Arguments]",Fe="[object Array]",ke="[object AsyncFunction]",$e="[object Boolean]",oe="[object Date]",me="[object DOMException]",Be="[object Error]",Ue="[object Function]",We="[object GeneratorFunction]",He="[object Map]",St="[object Number]",st="[object Null]",wt="[object Object]",Mn="[object Promise]",Rr="[object Proxy]",Tr="[object RegExp]",yt="[object Set]",Zr="[object String]",$s="[object Symbol]",to="[object Undefined]",Ot="[object WeakMap]",rt="[object WeakSet]",Ne="[object ArrayBuffer]",Ar="[object DataView]",ls="[object Float32Array]",_t="[object Float64Array]",pl="[object Int8Array]",ds="[object Int16Array]",_e="[object Int32Array]",Wu="[object Uint8Array]",Qt="[object Uint8ClampedArray]",qn="[object Uint16Array]",Uo="[object Uint32Array]",Of=/\b__p \+= '';/g,Xu=/\b(__p \+=) '' \+/g,Gh=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ju=/&(?:amp|lt|gt|quot|#39);/g,Ho=/[&<>"']/g,sr=RegExp(Ju.source),Fi=RegExp(Ho.source),Nf=/<%-([\s\S]+?)%>/g,zh=/<%([\s\S]+?)%>/g,ml=/<%=([\s\S]+?)%>/g,Zu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Yh=/^\w*$/,Lf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gl=/[\\^$.*+?()[\]{}|]/g,Wh=RegExp(gl.source),ae=/^\s+/,ye=/\s/,ze=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ve=/\{\n\/\* \[wrapped with (.+)\] \*/,it=/,? & /,Ct=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Bt=/[()=,{}\[\]\/\s]/,Qr=/\\(\\)?/g,Sr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Bi=/\w*$/,Mo=/^[-+]0x[0-9a-f]+$/i,hs=/^0b[01]+$/i,xs=/^\[object .+?Constructor\]$/,Vr=/^0o[0-7]+$/i,ps=/^(?:0|[1-9]\d*)$/,Qu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ec=/($^)/,Xh=/['\n\r\u2028\u2029\\]/g,jn="\\ud800-\\udfff",er="\\u0300-\\u036f",Gr="\\ufe20-\\ufe2f",ht="\\u20d0-\\u20ff",_r=er+Gr+ht,Kn="\\u2700-\\u27bf",yr="a-z\\xdf-\\xf6\\xf8-\\xff",Rs="\\xac\\xb1\\xd7\\xf7",ni="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ii="\\u2000-\\u206f",ro=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",qo="A-Z\\xc0-\\xd6\\xd8-\\xde",Uf="\\ufe0e\\ufe0f",Z1=Rs+ni+Ii+ro,Jh="['\u2019]",my="["+jn+"]",Q1="["+Z1+"]",Hf="["+_r+"]",em="\\d+",gy="["+Kn+"]",Zh="["+yr+"]",Qh="[^"+jn+Z1+em+Kn+yr+qo+"]",ep="\\ud83c[\\udffb-\\udfff]",vy="(?:"+Hf+"|"+ep+")",tm="[^"+jn+"]",tp="(?:\\ud83c[\\udde6-\\uddff]){2}",tc="[\\ud800-\\udbff][\\udc00-\\udfff]",rc="["+qo+"]",rm="\\u200d",nm="(?:"+Zh+"|"+Qh+")",wy="(?:"+rc+"|"+Qh+")",sm="(?:"+Jh+"(?:d|ll|m|re|s|t|ve))?",im="(?:"+Jh+"(?:D|LL|M|RE|S|T|VE))?",om=vy+"?",am="["+Uf+"]?",yy="(?:"+rm+"(?:"+[tm,tp,tc].join("|")+")"+am+om+")*",Ey="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",by="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",um=am+om+yy,Ay="(?:"+[gy,tp,tc].join("|")+")"+um,Sy="(?:"+[tm+Hf+"?",Hf,tp,tc,my].join("|")+")",_y=RegExp(Jh,"g"),Cy=RegExp(Hf,"g"),rp=RegExp(ep+"(?="+ep+")|"+Sy+um,"g"),Dy=RegExp([rc+"?"+Zh+"+"+sm+"(?="+[Q1,rc,"$"].join("|")+")",wy+"+"+im+"(?="+[Q1,rc+nm,"$"].join("|")+")",rc+"?"+nm+"+"+sm,rc+"+"+im,by,Ey,em,Ay].join("|"),"g"),Fy=RegExp("["+rm+jn+_r+Uf+"]"),By=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Iy=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$y=-1,gr={};gr[ls]=gr[_t]=gr[pl]=gr[ds]=gr[_e]=gr[Wu]=gr[Qt]=gr[qn]=gr[Uo]=!0,gr[he]=gr[Fe]=gr[Ne]=gr[$e]=gr[Ar]=gr[oe]=gr[Be]=gr[Ue]=gr[He]=gr[St]=gr[wt]=gr[Tr]=gr[yt]=gr[Zr]=gr[Ot]=!1;var fr={};fr[he]=fr[Fe]=fr[Ne]=fr[Ar]=fr[$e]=fr[oe]=fr[ls]=fr[_t]=fr[pl]=fr[ds]=fr[_e]=fr[He]=fr[St]=fr[wt]=fr[Tr]=fr[yt]=fr[Zr]=fr[$s]=fr[Wu]=fr[Qt]=fr[qn]=fr[Uo]=!0,fr[Be]=fr[Ue]=fr[Ot]=!1;var xy={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ry={"&":"&","<":"<",">":">",'"':""","'":"'"},Ty={"&":"&","<":"<",">":">",""":'"',"'":"'"},ky={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Py=parseFloat,Oy=parseInt,cm=typeof global=="object"&&global&&global.Object===Object&&global,Ny=typeof self=="object"&&self&&self.Object===Object&&self,zr=cm||Ny||Function("return this")(),np=typeof cd=="object"&&cd&&!cd.nodeType&&cd,Na=np&&typeof Up=="object"&&Up&&!Up.nodeType&&Up,lm=Na&&Na.exports===np,sp=lm&&cm.process,Ts=(function(){try{var ue=Na&&Na.require&&Na.require("util").types;return ue||sp&&sp.binding&&sp.binding("util")}catch{}})(),fm=Ts&&Ts.isArrayBuffer,dm=Ts&&Ts.isDate,hm=Ts&&Ts.isMap,pm=Ts&&Ts.isRegExp,mm=Ts&&Ts.isSet,gm=Ts&&Ts.isTypedArray;function ms(ue,Ee,pe){switch(pe.length){case 0:return ue.call(Ee);case 1:return ue.call(Ee,pe[0]);case 2:return ue.call(Ee,pe[0],pe[1]);case 3:return ue.call(Ee,pe[0],pe[1],pe[2])}return ue.apply(Ee,pe)}function Ly(ue,Ee,pe,Ke){for(var ft=-1,Mt=ue==null?0:ue.length;++ft<Mt;){var kr=ue[ft];Ee(Ke,kr,pe(kr),ue)}return Ke}function q(ue,Ee){for(var pe=-1,Ke=ue==null?0:ue.length;++pe<Ke&&Ee(ue[pe],pe,ue)!==!1;);return ue}function Et(ue,Ee){for(var pe=ue==null?0:ue.length;pe--&&Ee(ue[pe],pe,ue)!==!1;);return ue}function vl(ue,Ee){for(var pe=-1,Ke=ue==null?0:ue.length;++pe<Ke;)if(!Ee(ue[pe],pe,ue))return!1;return!0}function en(ue,Ee){for(var pe=-1,Ke=ue==null?0:ue.length,ft=0,Mt=[];++pe<Ke;){var kr=ue[pe];Ee(kr,pe,ue)&&(Mt[ft++]=kr)}return Mt}function nc(ue,Ee){var pe=ue==null?0:ue.length;return!!pe&&sc(ue,Ee,0)>-1}function le(ue,Ee,pe){for(var Ke=-1,ft=ue==null?0:ue.length;++Ke<ft;)if(pe(Ee,ue[Ke]))return!0;return!1}function ur(ue,Ee){for(var pe=-1,Ke=ue==null?0:ue.length,ft=Array(Ke);++pe<Ke;)ft[pe]=Ee(ue[pe],pe,ue);return ft}function jo(ue,Ee){for(var pe=-1,Ke=Ee.length,ft=ue.length;++pe<Ke;)ue[ft+pe]=Ee[pe];return ue}function vm(ue,Ee,pe,Ke){var ft=-1,Mt=ue==null?0:ue.length;for(Ke&&Mt&&(pe=ue[++ft]);++ft<Mt;)pe=Ee(pe,ue[ft],ft,ue);return pe}function S5(ue,Ee,pe,Ke){var ft=ue==null?0:ue.length;for(Ke&&ft&&(pe=ue[--ft]);ft--;)pe=Ee(pe,ue[ft],ft,ue);return pe}function vr(ue,Ee){for(var pe=-1,Ke=ue==null?0:ue.length;++pe<Ke;)if(Ee(ue[pe],pe,ue))return!0;return!1}var _5=Se("length");function ip(ue){return ue.split("")}function at(ue){return ue.match(Ct)||[]}function dn(ue,Ee,pe){var Ke;return pe(ue,function(ft,Mt,kr){if(Ee(ft,Mt,kr))return Ke=Mt,!1}),Ke}function Mf(ue,Ee,pe,Ke){for(var ft=ue.length,Mt=pe+(Ke?1:-1);Ke?Mt--:++Mt<ft;)if(Ee(ue[Mt],Mt,ue))return Mt;return-1}function sc(ue,Ee,pe){return Ee===Ee?jy(ue,Ee,pe):Mf(ue,op,pe)}function no(ue,Ee,pe,Ke){for(var ft=pe-1,Mt=ue.length;++ft<Mt;)if(Ke(ue[ft],Ee))return ft;return-1}function op(ue){return ue!==ue}function ic(ue,Ee){var pe=ue==null?0:ue.length;return pe?cp(ue,Ee)/pe:G}function Se(ue){return function(Ee){return Ee==null?e:Ee[ue]}}function ap(ue){return function(Ee){return ue==null?e:ue[Ee]}}function up(ue,Ee,pe,Ke,ft){return ft(ue,function(Mt,kr,ir){pe=Ke?(Ke=!1,Mt):Ee(pe,Mt,kr,ir)}),pe}function wm(ue,Ee){var pe=ue.length;for(ue.sort(Ee);pe--;)ue[pe]=ue[pe].value;return ue}function cp(ue,Ee){for(var pe,Ke=-1,ft=ue.length;++Ke<ft;){var Mt=Ee(ue[Ke]);Mt!==e&&(pe=pe===e?Mt:pe+Mt)}return pe}function lp(ue,Ee){for(var pe=-1,Ke=Array(ue);++pe<ue;)Ke[pe]=Ee(pe);return Ke}function ym(ue,Ee){return ur(Ee,function(pe){return[pe,ue[pe]]})}function fp(ue){return ue&&ue.slice(0,mp(ue)+1).replace(ae,"")}function Cn(ue){return function(Ee){return ue(Ee)}}function dp(ue,Ee){return ur(Ee,function(pe){return ue[pe]})}function La(ue,Ee){return ue.has(Ee)}function Em(ue,Ee){for(var pe=-1,Ke=ue.length;++pe<Ke&&sc(Ee,ue[pe],0)>-1;);return pe}function hp(ue,Ee){for(var pe=ue.length;pe--&&sc(Ee,ue[pe],0)>-1;);return pe}function pp(ue,Ee){for(var pe=ue.length,Ke=0;pe--;)ue[pe]===Ee&&++Ke;return Ke}var Uy=ap(xy),bm=ap(Ry);function Hy(ue){return"\\"+ky[ue]}function Am(ue,Ee){return ue==null?e:ue[Ee]}function oc(ue){return Fy.test(ue)}function My(ue){return By.test(ue)}function qy(ue){for(var Ee,pe=[];!(Ee=ue.next()).done;)pe.push(Ee.value);return pe}function hn(ue){var Ee=-1,pe=Array(ue.size);return ue.forEach(function(Ke,ft){pe[++Ee]=[ft,Ke]}),pe}function wl(ue,Ee){return function(pe){return ue(Ee(pe))}}function Dn(ue,Ee){for(var pe=-1,Ke=ue.length,ft=0,Mt=[];++pe<Ke;){var kr=ue[pe];(kr===Ee||kr===l)&&(ue[pe]=l,Mt[ft++]=pe)}return Mt}function Ua(ue){var Ee=-1,pe=Array(ue.size);return ue.forEach(function(Ke){pe[++Ee]=Ke}),pe}function Sm(ue){var Ee=-1,pe=Array(ue.size);return ue.forEach(function(Ke){pe[++Ee]=[Ke,Ke]}),pe}function jy(ue,Ee,pe){for(var Ke=pe-1,ft=ue.length;++Ke<ft;)if(ue[Ke]===Ee)return Ke;return-1}function _m(ue,Ee,pe){for(var Ke=pe+1;Ke--;)if(ue[Ke]===Ee)return Ke;return Ke}function Ha(ue){return oc(ue)?Ky(ue):_5(ue)}function gs(ue){return oc(ue)?Vy(ue):ip(ue)}function mp(ue){for(var Ee=ue.length;Ee--&&ye.test(ue.charAt(Ee)););return Ee}var Cm=ap(Ty);function Ky(ue){for(var Ee=rp.lastIndex=0;rp.test(ue);)++Ee;return Ee}function Vy(ue){return ue.match(rp)||[]}function Gy(ue){return ue.match(Dy)||[]}var gp=(function ue(Ee){Ee=Ee==null?zr:so.defaults(zr.Object(),Ee,so.pick(zr,Iy));var pe=Ee.Array,Ke=Ee.Date,ft=Ee.Error,Mt=Ee.Function,kr=Ee.Math,ir=Ee.Object,vp=Ee.RegExp,zy=Ee.String,ks=Ee.TypeError,yl=pe.prototype,Dm=Mt.prototype,si=ir.prototype,qf=Ee["__core-js_shared__"],Ma=Dm.toString,Xt=si.hasOwnProperty,wp=0,Fm=(function(){var c=/[^.]+$/.exec(qf&&qf.keys&&qf.keys.IE_PROTO||"");return c?"Symbol(src)_1."+c:""})(),jf=si.toString,Yy=Ma.call(ir),Wy=zr._,Xy=vp("^"+Ma.call(Xt).replace(gl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kf=lm?Ee.Buffer:e,Ko=Ee.Symbol,Vf=Ee.Uint8Array,Bm=Kf?Kf.allocUnsafe:e,Gf=wl(ir.getPrototypeOf,ir),Im=ir.create,cr=si.propertyIsEnumerable,zf=yl.splice,Yf=Ko?Ko.isConcatSpreadable:e,El=Ko?Ko.iterator:e,qa=Ko?Ko.toStringTag:e,B=(function(){try{var c=Cl(ir,"defineProperty");return c({},"",{}),c}catch{}})(),z=Ee.clearTimeout!==zr.clearTimeout&&Ee.clearTimeout,ee=Ke&&Ke.now!==zr.Date.now&&Ke.now,Z=Ee.setTimeout!==zr.setTimeout&&Ee.setTimeout,de=kr.ceil,ve=kr.floor,tr=ir.getOwnPropertySymbols,Pr=Kf?Kf.isBuffer:e,C5=Ee.isFinite,FN=yl.join,BN=wl(ir.keys,ir),tn=kr.max,Vn=kr.min,IN=Ke.now,$N=Ee.parseInt,D5=kr.random,xN=yl.reverse,Jy=Cl(Ee,"DataView"),yp=Cl(Ee,"Map"),Zy=Cl(Ee,"Promise"),Wf=Cl(Ee,"Set"),Ep=Cl(Ee,"WeakMap"),bp=Cl(ir,"create"),$m=Ep&&new Ep,Xf={},RN=Dl(Jy),TN=Dl(yp),kN=Dl(Zy),PN=Dl(Wf),ON=Dl(Ep),xm=Ko?Ko.prototype:e,Ap=xm?xm.valueOf:e,F5=xm?xm.toString:e;function Y(c){if(Br(c)&&!bt(c)&&!(c instanceof Ut)){if(c instanceof $i)return c;if(Xt.call(c,"__wrapped__"))return B3(c)}return new $i(c)}var Jf=(function(){function c(){}return function(h){if(!Cr(h))return{};if(Im)return Im(h);c.prototype=h;var b=new c;return c.prototype=e,b}})();function Rm(){}function $i(c,h){this.__wrapped__=c,this.__actions__=[],this.__chain__=!!h,this.__index__=0,this.__values__=e}Y.templateSettings={escape:Nf,evaluate:zh,interpolate:ml,variable:"",imports:{_:Y}},Y.prototype=Rm.prototype,Y.prototype.constructor=Y,$i.prototype=Jf(Rm.prototype),$i.prototype.constructor=$i;function Ut(c){this.__wrapped__=c,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=J,this.__views__=[]}function NN(){var c=new Ut(this.__wrapped__);return c.__actions__=Ps(this.__actions__),c.__dir__=this.__dir__,c.__filtered__=this.__filtered__,c.__iteratees__=Ps(this.__iteratees__),c.__takeCount__=this.__takeCount__,c.__views__=Ps(this.__views__),c}function LN(){if(this.__filtered__){var c=new Ut(this);c.__dir__=-1,c.__filtered__=!0}else c=this.clone(),c.__dir__*=-1;return c}function UN(){var c=this.__wrapped__.value(),h=this.__dir__,b=bt(c),P=h<0,V=b?c.length:0,X=JL(0,V,this.__views__),Q=X.start,ne=X.end,ce=ne-Q,Ce=P?ne:Q-1,De=this.__iteratees__,Ie=De.length,Me=0,Xe=Vn(ce,this.__takeCount__);if(!b||!P&&V==ce&&Xe==ce)return J5(c,this.__actions__);var lt=[];e:for(;ce--&&Me<Xe;){Ce+=h;for(var xt=-1,ut=c[Ce];++xt<Ie;){var Nt=De[xt],qt=Nt.iteratee,ai=Nt.type,ys=qt(ut);if(ai==O)ut=ys;else if(!ys){if(ai==N)continue e;break e}}lt[Me++]=ut}return lt}Ut.prototype=Jf(Rm.prototype),Ut.prototype.constructor=Ut;function bl(c){var h=-1,b=c==null?0:c.length;for(this.clear();++h<b;){var P=c[h];this.set(P[0],P[1])}}function HN(){this.__data__=bp?bp(null):{},this.size=0}function MN(c){var h=this.has(c)&&delete this.__data__[c];return this.size-=h?1:0,h}function qN(c){var h=this.__data__;if(bp){var b=h[c];return b===a?e:b}return Xt.call(h,c)?h[c]:e}function jN(c){var h=this.__data__;return bp?h[c]!==e:Xt.call(h,c)}function KN(c,h){var b=this.__data__;return this.size+=this.has(c)?0:1,b[c]=bp&&h===e?a:h,this}bl.prototype.clear=HN,bl.prototype.delete=MN,bl.prototype.get=qN,bl.prototype.has=jN,bl.prototype.set=KN;function ja(c){var h=-1,b=c==null?0:c.length;for(this.clear();++h<b;){var P=c[h];this.set(P[0],P[1])}}function VN(){this.__data__=[],this.size=0}function GN(c){var h=this.__data__,b=Tm(h,c);if(b<0)return!1;var P=h.length-1;return b==P?h.pop():zf.call(h,b,1),--this.size,!0}function zN(c){var h=this.__data__,b=Tm(h,c);return b<0?e:h[b][1]}function YN(c){return Tm(this.__data__,c)>-1}function WN(c,h){var b=this.__data__,P=Tm(b,c);return P<0?(++this.size,b.push([c,h])):b[P][1]=h,this}ja.prototype.clear=VN,ja.prototype.delete=GN,ja.prototype.get=zN,ja.prototype.has=YN,ja.prototype.set=WN;function Ka(c){var h=-1,b=c==null?0:c.length;for(this.clear();++h<b;){var P=c[h];this.set(P[0],P[1])}}function XN(){this.size=0,this.__data__={hash:new bl,map:new(yp||ja),string:new bl}}function JN(c){var h=Vm(this,c).delete(c);return this.size-=h?1:0,h}function ZN(c){return Vm(this,c).get(c)}function QN(c){return Vm(this,c).has(c)}function eL(c,h){var b=Vm(this,c),P=b.size;return b.set(c,h),this.size+=b.size==P?0:1,this}Ka.prototype.clear=XN,Ka.prototype.delete=JN,Ka.prototype.get=ZN,Ka.prototype.has=QN,Ka.prototype.set=eL;function Al(c){var h=-1,b=c==null?0:c.length;for(this.__data__=new Ka;++h<b;)this.add(c[h])}function tL(c){return this.__data__.set(c,a),this}function rL(c){return this.__data__.has(c)}Al.prototype.add=Al.prototype.push=tL,Al.prototype.has=rL;function io(c){var h=this.__data__=new ja(c);this.size=h.size}function nL(){this.__data__=new ja,this.size=0}function sL(c){var h=this.__data__,b=h.delete(c);return this.size=h.size,b}function iL(c){return this.__data__.get(c)}function oL(c){return this.__data__.has(c)}function aL(c,h){var b=this.__data__;if(b instanceof ja){var P=b.__data__;if(!yp||P.length<r-1)return P.push([c,h]),this.size=++b.size,this;b=this.__data__=new Ka(P)}return b.set(c,h),this.size=b.size,this}io.prototype.clear=nL,io.prototype.delete=sL,io.prototype.get=iL,io.prototype.has=oL,io.prototype.set=aL;function B5(c,h){var b=bt(c),P=!b&&Fl(c),V=!b&&!P&&fc(c),X=!b&&!P&&!V&&td(c),Q=b||P||V||X,ne=Q?lp(c.length,zy):[],ce=ne.length;for(var Ce in c)(h||Xt.call(c,Ce))&&!(Q&&(Ce=="length"||V&&(Ce=="offset"||Ce=="parent")||X&&(Ce=="buffer"||Ce=="byteLength"||Ce=="byteOffset")||za(Ce,ce)))&&ne.push(Ce);return ne}function I5(c){var h=c.length;return h?c[cE(0,h-1)]:e}function uL(c,h){return Gm(Ps(c),Sl(h,0,c.length))}function cL(c){return Gm(Ps(c))}function Qy(c,h,b){(b!==e&&!ao(c[h],b)||b===e&&!(h in c))&&Vo(c,h,b)}function Sp(c,h,b){var P=c[h];(!(Xt.call(c,h)&&ao(P,b))||b===e&&!(h in c))&&Vo(c,h,b)}function Tm(c,h){for(var b=c.length;b--;)if(ao(c[b][0],h))return b;return-1}function lL(c,h,b,P){return ac(c,function(V,X,Q){h(P,V,b(V),Q)}),P}function $5(c,h){return c&&zo(h,pn(h),c)}function fL(c,h){return c&&zo(h,Ns(h),c)}function Vo(c,h,b){h=="__proto__"&&B?B(c,h,{configurable:!0,enumerable:!0,value:b,writable:!0}):c[h]=b}function eE(c,h){for(var b=-1,P=h.length,V=pe(P),X=c==null;++b<P;)V[b]=X?e:PE(c,h[b]);return V}function Sl(c,h,b){return c===c&&(b!==e&&(c=c<=b?c:b),h!==e&&(c=c>=h?c:h)),c}function xi(c,h,b,P,V,X){var Q,ne=h&f,ce=h&m,Ce=h&p;if(b&&(Q=V?b(c,P,V,X):b(c)),Q!==e)return Q;if(!Cr(c))return c;var De=bt(c);if(De){if(Q=QL(c),!ne)return Ps(c,Q)}else{var Ie=Gn(c),Me=Ie==Ue||Ie==We;if(fc(c))return e3(c,ne);if(Ie==wt||Ie==he||Me&&!V){if(Q=ce||Me?{}:y3(c),!ne)return ce?qL(c,fL(Q,c)):ML(c,$5(Q,c))}else{if(!fr[Ie])return V?c:{};Q=eU(c,Ie,ne)}}X||(X=new io);var Xe=X.get(c);if(Xe)return Xe;X.set(c,Q),Y3(c)?c.forEach(function(ut){Q.add(xi(ut,h,b,ut,c,X))}):G3(c)&&c.forEach(function(ut,Nt){Q.set(Nt,xi(ut,h,b,Nt,c,X))});var lt=Ce?ce?EE:yE:ce?Ns:pn,xt=De?e:lt(c);return q(xt||c,function(ut,Nt){xt&&(Nt=ut,ut=c[Nt]),Sp(Q,Nt,xi(ut,h,b,Nt,c,X))}),Q}function dL(c){var h=pn(c);return function(b){return x5(b,c,h)}}function x5(c,h,b){var P=b.length;if(c==null)return!P;for(c=ir(c);P--;){var V=b[P],X=h[V],Q=c[V];if(Q===e&&!(V in c)||!X(Q))return!1}return!0}function R5(c,h,b){if(typeof c!="function")throw new ks(s);return $p(function(){c.apply(e,b)},h)}function _p(c,h,b,P){var V=-1,X=nc,Q=!0,ne=c.length,ce=[],Ce=h.length;if(!ne)return ce;b&&(h=ur(h,Cn(b))),P?(X=le,Q=!1):h.length>=r&&(X=La,Q=!1,h=new Al(h));e:for(;++V<ne;){var De=c[V],Ie=b==null?De:b(De);if(De=P||De!==0?De:0,Q&&Ie===Ie){for(var Me=Ce;Me--;)if(h[Me]===Ie)continue e;ce.push(De)}else X(h,Ie,P)||ce.push(De)}return ce}var ac=i3(Go),T5=i3(rE,!0);function hL(c,h){var b=!0;return ac(c,function(P,V,X){return b=!!h(P,V,X),b}),b}function km(c,h,b){for(var P=-1,V=c.length;++P<V;){var X=c[P],Q=h(X);if(Q!=null&&(ne===e?Q===Q&&!oi(Q):b(Q,ne)))var ne=Q,ce=X}return ce}function pL(c,h,b,P){var V=c.length;for(b=It(b),b<0&&(b=-b>V?0:V+b),P=P===e||P>V?V:It(P),P<0&&(P+=V),P=b>P?0:X3(P);b<P;)c[b++]=h;return c}function k5(c,h){var b=[];return ac(c,function(P,V,X){h(P,V,X)&&b.push(P)}),b}function Fn(c,h,b,P,V){var X=-1,Q=c.length;for(b||(b=rU),V||(V=[]);++X<Q;){var ne=c[X];h>0&&b(ne)?h>1?Fn(ne,h-1,b,P,V):jo(V,ne):P||(V[V.length]=ne)}return V}var tE=o3(),P5=o3(!0);function Go(c,h){return c&&tE(c,h,pn)}function rE(c,h){return c&&P5(c,h,pn)}function Pm(c,h){return en(h,function(b){return Ya(c[b])})}function _l(c,h){h=cc(h,c);for(var b=0,P=h.length;c!=null&&b<P;)c=c[oo(h[b++])];return b&&b==P?c:e}function O5(c,h,b){var P=h(c);return bt(c)?P:jo(P,b(c))}function vs(c){return c==null?c===e?to:st:qa&&qa in ir(c)?XL(c):cU(c)}function nE(c,h){return c>h}function mL(c,h){return c!=null&&Xt.call(c,h)}function gL(c,h){return c!=null&&h in ir(c)}function vL(c,h,b){return c>=Vn(h,b)&&c<tn(h,b)}function sE(c,h,b){for(var P=b?le:nc,V=c[0].length,X=c.length,Q=X,ne=pe(X),ce=1/0,Ce=[];Q--;){var De=c[Q];Q&&h&&(De=ur(De,Cn(h))),ce=Vn(De.length,ce),ne[Q]=!b&&(h||V>=120&&De.length>=120)?new Al(Q&&De):e}De=c[0];var Ie=-1,Me=ne[0];e:for(;++Ie<V&&Ce.length<ce;){var Xe=De[Ie],lt=h?h(Xe):Xe;if(Xe=b||Xe!==0?Xe:0,!(Me?La(Me,lt):P(Ce,lt,b))){for(Q=X;--Q;){var xt=ne[Q];if(!(xt?La(xt,lt):P(c[Q],lt,b)))continue e}Me&&Me.push(lt),Ce.push(Xe)}}return Ce}function wL(c,h,b,P){return Go(c,function(V,X,Q){h(P,b(V),X,Q)}),P}function Cp(c,h,b){h=cc(h,c),c=S3(c,h);var P=c==null?c:c[oo(Ti(h))];return P==null?e:ms(P,c,b)}function N5(c){return Br(c)&&vs(c)==he}function yL(c){return Br(c)&&vs(c)==Ne}function EL(c){return Br(c)&&vs(c)==oe}function Dp(c,h,b,P,V){return c===h?!0:c==null||h==null||!Br(c)&&!Br(h)?c!==c&&h!==h:bL(c,h,b,P,Dp,V)}function bL(c,h,b,P,V,X){var Q=bt(c),ne=bt(h),ce=Q?Fe:Gn(c),Ce=ne?Fe:Gn(h);ce=ce==he?wt:ce,Ce=Ce==he?wt:Ce;var De=ce==wt,Ie=Ce==wt,Me=ce==Ce;if(Me&&fc(c)){if(!fc(h))return!1;Q=!0,De=!1}if(Me&&!De)return X||(X=new io),Q||td(c)?g3(c,h,b,P,V,X):YL(c,h,ce,b,P,V,X);if(!(b&d)){var Xe=De&&Xt.call(c,"__wrapped__"),lt=Ie&&Xt.call(h,"__wrapped__");if(Xe||lt){var xt=Xe?c.value():c,ut=lt?h.value():h;return X||(X=new io),V(xt,ut,b,P,X)}}return Me?(X||(X=new io),WL(c,h,b,P,V,X)):!1}function AL(c){return Br(c)&&Gn(c)==He}function iE(c,h,b,P){var V=b.length,X=V,Q=!P;if(c==null)return!X;for(c=ir(c);V--;){var ne=b[V];if(Q&&ne[2]?ne[1]!==c[ne[0]]:!(ne[0]in c))return!1}for(;++V<X;){ne=b[V];var ce=ne[0],Ce=c[ce],De=ne[1];if(Q&&ne[2]){if(Ce===e&&!(ce in c))return!1}else{var Ie=new io;if(P)var Me=P(Ce,De,ce,c,h,Ie);if(!(Me===e?Dp(De,Ce,d|v,P,Ie):Me))return!1}}return!0}function L5(c){if(!Cr(c)||sU(c))return!1;var h=Ya(c)?Xy:xs;return h.test(Dl(c))}function SL(c){return Br(c)&&vs(c)==Tr}function _L(c){return Br(c)&&Gn(c)==yt}function CL(c){return Br(c)&&Zm(c.length)&&!!gr[vs(c)]}function U5(c){return typeof c=="function"?c:c==null?Ls:typeof c=="object"?bt(c)?q5(c[0],c[1]):M5(c):u8(c)}function oE(c){if(!Ip(c))return BN(c);var h=[];for(var b in ir(c))Xt.call(c,b)&&b!="constructor"&&h.push(b);return h}function DL(c){if(!Cr(c))return uU(c);var h=Ip(c),b=[];for(var P in c)P=="constructor"&&(h||!Xt.call(c,P))||b.push(P);return b}function aE(c,h){return c<h}function H5(c,h){var b=-1,P=Os(c)?pe(c.length):[];return ac(c,function(V,X,Q){P[++b]=h(V,X,Q)}),P}function M5(c){var h=AE(c);return h.length==1&&h[0][2]?b3(h[0][0],h[0][1]):function(b){return b===c||iE(b,c,h)}}function q5(c,h){return _E(c)&&E3(h)?b3(oo(c),h):function(b){var P=PE(b,c);return P===e&&P===h?OE(b,c):Dp(h,P,d|v)}}function Om(c,h,b,P,V){c!==h&&tE(h,function(X,Q){if(V||(V=new io),Cr(X))FL(c,h,Q,b,Om,P,V);else{var ne=P?P(DE(c,Q),X,Q+"",c,h,V):e;ne===e&&(ne=X),Qy(c,Q,ne)}},Ns)}function FL(c,h,b,P,V,X,Q){var ne=DE(c,b),ce=DE(h,b),Ce=Q.get(ce);if(Ce){Qy(c,b,Ce);return}var De=X?X(ne,ce,b+"",c,h,Q):e,Ie=De===e;if(Ie){var Me=bt(ce),Xe=!Me&&fc(ce),lt=!Me&&!Xe&&td(ce);De=ce,Me||Xe||lt?bt(ne)?De=ne:Or(ne)?De=Ps(ne):Xe?(Ie=!1,De=e3(ce,!0)):lt?(Ie=!1,De=t3(ce,!0)):De=[]:xp(ce)||Fl(ce)?(De=ne,Fl(ne)?De=J3(ne):(!Cr(ne)||Ya(ne))&&(De=y3(ce))):Ie=!1}Ie&&(Q.set(ce,De),V(De,ce,P,X,Q),Q.delete(ce)),Qy(c,b,De)}function j5(c,h){var b=c.length;if(b)return h+=h<0?b:0,za(h,b)?c[h]:e}function K5(c,h,b){h.length?h=ur(h,function(X){return bt(X)?function(Q){return _l(Q,X.length===1?X[0]:X)}:X}):h=[Ls];var P=-1;h=ur(h,Cn(ct()));var V=H5(c,function(X,Q,ne){var ce=ur(h,function(Ce){return Ce(X)});return{criteria:ce,index:++P,value:X}});return wm(V,function(X,Q){return HL(X,Q,b)})}function BL(c,h){return V5(c,h,function(b,P){return OE(c,P)})}function V5(c,h,b){for(var P=-1,V=h.length,X={};++P<V;){var Q=h[P],ne=_l(c,Q);b(ne,Q)&&Fp(X,cc(Q,c),ne)}return X}function IL(c){return function(h){return _l(h,c)}}function uE(c,h,b,P){var V=P?no:sc,X=-1,Q=h.length,ne=c;for(c===h&&(h=Ps(h)),b&&(ne=ur(c,Cn(b)));++X<Q;)for(var ce=0,Ce=h[X],De=b?b(Ce):Ce;(ce=V(ne,De,ce,P))>-1;)ne!==c&&zf.call(ne,ce,1),zf.call(c,ce,1);return c}function G5(c,h){for(var b=c?h.length:0,P=b-1;b--;){var V=h[b];if(b==P||V!==X){var X=V;za(V)?zf.call(c,V,1):dE(c,V)}}return c}function cE(c,h){return c+ve(D5()*(h-c+1))}function $L(c,h,b,P){for(var V=-1,X=tn(de((h-c)/(b||1)),0),Q=pe(X);X--;)Q[P?X:++V]=c,c+=b;return Q}function lE(c,h){var b="";if(!c||h<1||h>M)return b;do h%2&&(b+=c),h=ve(h/2),h&&(c+=c);while(h);return b}function Rt(c,h){return FE(A3(c,h,Ls),c+"")}function xL(c){return I5(rd(c))}function RL(c,h){var b=rd(c);return Gm(b,Sl(h,0,b.length))}function Fp(c,h,b,P){if(!Cr(c))return c;h=cc(h,c);for(var V=-1,X=h.length,Q=X-1,ne=c;ne!=null&&++V<X;){var ce=oo(h[V]),Ce=b;if(ce==="__proto__"||ce==="constructor"||ce==="prototype")return c;if(V!=Q){var De=ne[ce];Ce=P?P(De,ce,ne):e,Ce===e&&(Ce=Cr(De)?De:za(h[V+1])?[]:{})}Sp(ne,ce,Ce),ne=ne[ce]}return c}var z5=$m?function(c,h){return $m.set(c,h),c}:Ls,TL=B?function(c,h){return B(c,"toString",{configurable:!0,enumerable:!1,value:LE(h),writable:!0})}:Ls;function kL(c){return Gm(rd(c))}function Ri(c,h,b){var P=-1,V=c.length;h<0&&(h=-h>V?0:V+h),b=b>V?V:b,b<0&&(b+=V),V=h>b?0:b-h>>>0,h>>>=0;for(var X=pe(V);++P<V;)X[P]=c[P+h];return X}function PL(c,h){var b;return ac(c,function(P,V,X){return b=h(P,V,X),!b}),!!b}function Nm(c,h,b){var P=0,V=c==null?P:c.length;if(typeof h=="number"&&h===h&&V<=ie){for(;P<V;){var X=P+V>>>1,Q=c[X];Q!==null&&!oi(Q)&&(b?Q<=h:Q<h)?P=X+1:V=X}return V}return fE(c,h,Ls,b)}function fE(c,h,b,P){var V=0,X=c==null?0:c.length;if(X===0)return 0;h=b(h);for(var Q=h!==h,ne=h===null,ce=oi(h),Ce=h===e;V<X;){var De=ve((V+X)/2),Ie=b(c[De]),Me=Ie!==e,Xe=Ie===null,lt=Ie===Ie,xt=oi(Ie);if(Q)var ut=P||lt;else Ce?ut=lt&&(P||Me):ne?ut=lt&&Me&&(P||!Xe):ce?ut=lt&&Me&&!Xe&&(P||!xt):Xe||xt?ut=!1:ut=P?Ie<=h:Ie<h;ut?V=De+1:X=De}return Vn(X,te)}function Y5(c,h){for(var b=-1,P=c.length,V=0,X=[];++b<P;){var Q=c[b],ne=h?h(Q):Q;if(!b||!ao(ne,ce)){var ce=ne;X[V++]=Q===0?0:Q}}return X}function W5(c){return typeof c=="number"?c:oi(c)?G:+c}function ii(c){if(typeof c=="string")return c;if(bt(c))return ur(c,ii)+"";if(oi(c))return F5?F5.call(c):"";var h=c+"";return h=="0"&&1/c==-T?"-0":h}function uc(c,h,b){var P=-1,V=nc,X=c.length,Q=!0,ne=[],ce=ne;if(b)Q=!1,V=le;else if(X>=r){var Ce=h?null:GL(c);if(Ce)return Ua(Ce);Q=!1,V=La,ce=new Al}else ce=h?[]:ne;e:for(;++P<X;){var De=c[P],Ie=h?h(De):De;if(De=b||De!==0?De:0,Q&&Ie===Ie){for(var Me=ce.length;Me--;)if(ce[Me]===Ie)continue e;h&&ce.push(Ie),ne.push(De)}else V(ce,Ie,b)||(ce!==ne&&ce.push(Ie),ne.push(De))}return ne}function dE(c,h){h=cc(h,c);var b=-1,P=h.length;if(!P)return!0;for(;++b<P;){var V=oo(h[b]);if(V==="__proto__"&&!Xt.call(c,"__proto__")||(V==="constructor"||V==="prototype")&&b<P-1)return!1}var X=S3(c,h);return X==null||delete X[oo(Ti(h))]}function X5(c,h,b,P){return Fp(c,h,b(_l(c,h)),P)}function Lm(c,h,b,P){for(var V=c.length,X=P?V:-1;(P?X--:++X<V)&&h(c[X],X,c););return b?Ri(c,P?0:X,P?X+1:V):Ri(c,P?X+1:0,P?V:X)}function J5(c,h){var b=c;return b instanceof Ut&&(b=b.value()),vm(h,function(P,V){return V.func.apply(V.thisArg,jo([P],V.args))},b)}function hE(c,h,b){var P=c.length;if(P<2)return P?uc(c[0]):[];for(var V=-1,X=pe(P);++V<P;)for(var Q=c[V],ne=-1;++ne<P;)ne!=V&&(X[V]=_p(X[V]||Q,c[ne],h,b));return uc(Fn(X,1),h,b)}function Z5(c,h,b){for(var P=-1,V=c.length,X=h.length,Q={};++P<V;){var ne=P<X?h[P]:e;b(Q,c[P],ne)}return Q}function pE(c){return Or(c)?c:[]}function mE(c){return typeof c=="function"?c:Ls}function cc(c,h){return bt(c)?c:_E(c,h)?[c]:F3(or(c))}var OL=Rt;function lc(c,h,b){var P=c.length;return b=b===e?P:b,!h&&b>=P?c:Ri(c,h,b)}var Q5=z||function(c){return zr.clearTimeout(c)};function e3(c,h){if(h)return c.slice();var b=c.length,P=Bm?Bm(b):new c.constructor(b);return c.copy(P),P}function gE(c){var h=new c.constructor(c.byteLength);return new Vf(h).set(new Vf(c)),h}function NL(c,h){var b=h?gE(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.byteLength)}function LL(c){var h=new c.constructor(c.source,Bi.exec(c));return h.lastIndex=c.lastIndex,h}function UL(c){return Ap?ir(Ap.call(c)):{}}function t3(c,h){var b=h?gE(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.length)}function r3(c,h){if(c!==h){var b=c!==e,P=c===null,V=c===c,X=oi(c),Q=h!==e,ne=h===null,ce=h===h,Ce=oi(h);if(!ne&&!Ce&&!X&&c>h||X&&Q&&ce&&!ne&&!Ce||P&&Q&&ce||!b&&ce||!V)return 1;if(!P&&!X&&!Ce&&c<h||Ce&&b&&V&&!P&&!X||ne&&b&&V||!Q&&V||!ce)return-1}return 0}function HL(c,h,b){for(var P=-1,V=c.criteria,X=h.criteria,Q=V.length,ne=b.length;++P<Q;){var ce=r3(V[P],X[P]);if(ce){if(P>=ne)return ce;var Ce=b[P];return ce*(Ce=="desc"?-1:1)}}return c.index-h.index}function n3(c,h,b,P){for(var V=-1,X=c.length,Q=b.length,ne=-1,ce=h.length,Ce=tn(X-Q,0),De=pe(ce+Ce),Ie=!P;++ne<ce;)De[ne]=h[ne];for(;++V<Q;)(Ie||V<X)&&(De[b[V]]=c[V]);for(;Ce--;)De[ne++]=c[V++];return De}function s3(c,h,b,P){for(var V=-1,X=c.length,Q=-1,ne=b.length,ce=-1,Ce=h.length,De=tn(X-ne,0),Ie=pe(De+Ce),Me=!P;++V<De;)Ie[V]=c[V];for(var Xe=V;++ce<Ce;)Ie[Xe+ce]=h[ce];for(;++Q<ne;)(Me||V<X)&&(Ie[Xe+b[Q]]=c[V++]);return Ie}function Ps(c,h){var b=-1,P=c.length;for(h||(h=pe(P));++b<P;)h[b]=c[b];return h}function zo(c,h,b,P){var V=!b;b||(b={});for(var X=-1,Q=h.length;++X<Q;){var ne=h[X],ce=P?P(b[ne],c[ne],ne,b,c):e;ce===e&&(ce=c[ne]),V?Vo(b,ne,ce):Sp(b,ne,ce)}return b}function ML(c,h){return zo(c,SE(c),h)}function qL(c,h){return zo(c,v3(c),h)}function Um(c,h){return function(b,P){var V=bt(b)?Ly:lL,X=h?h():{};return V(b,c,ct(P,2),X)}}function Zf(c){return Rt(function(h,b){var P=-1,V=b.length,X=V>1?b[V-1]:e,Q=V>2?b[2]:e;for(X=c.length>3&&typeof X=="function"?(V--,X):e,Q&&ws(b[0],b[1],Q)&&(X=V<3?e:X,V=1),h=ir(h);++P<V;){var ne=b[P];ne&&c(h,ne,P,X)}return h})}function i3(c,h){return function(b,P){if(b==null)return b;if(!Os(b))return c(b,P);for(var V=b.length,X=h?V:-1,Q=ir(b);(h?X--:++X<V)&&P(Q[X],X,Q)!==!1;);return b}}function o3(c){return function(h,b,P){for(var V=-1,X=ir(h),Q=P(h),ne=Q.length;ne--;){var ce=Q[c?ne:++V];if(b(X[ce],ce,X)===!1)break}return h}}function jL(c,h,b){var P=h&g,V=Bp(c);function X(){var Q=this&&this!==zr&&this instanceof X?V:c;return Q.apply(P?b:this,arguments)}return X}function a3(c){return function(h){h=or(h);var b=oc(h)?gs(h):e,P=b?b[0]:h.charAt(0),V=b?lc(b,1).join(""):h.slice(1);return P[c]()+V}}function Qf(c){return function(h){return vm(o8(i8(h).replace(_y,"")),c,"")}}function Bp(c){return function(){var h=arguments;switch(h.length){case 0:return new c;case 1:return new c(h[0]);case 2:return new c(h[0],h[1]);case 3:return new c(h[0],h[1],h[2]);case 4:return new c(h[0],h[1],h[2],h[3]);case 5:return new c(h[0],h[1],h[2],h[3],h[4]);case 6:return new c(h[0],h[1],h[2],h[3],h[4],h[5]);case 7:return new c(h[0],h[1],h[2],h[3],h[4],h[5],h[6])}var b=Jf(c.prototype),P=c.apply(b,h);return Cr(P)?P:b}}function KL(c,h,b){var P=Bp(c);function V(){for(var X=arguments.length,Q=pe(X),ne=X,ce=ed(V);ne--;)Q[ne]=arguments[ne];var Ce=X<3&&Q[0]!==ce&&Q[X-1]!==ce?[]:Dn(Q,ce);if(X-=Ce.length,X<b)return d3(c,h,Hm,V.placeholder,e,Q,Ce,e,e,b-X);var De=this&&this!==zr&&this instanceof V?P:c;return ms(De,this,Q)}return V}function u3(c){return function(h,b,P){var V=ir(h);if(!Os(h)){var X=ct(b,3);h=pn(h),b=function(ne){return X(V[ne],ne,V)}}var Q=c(h,b,P);return Q>-1?V[X?h[Q]:Q]:e}}function c3(c){return Ga(function(h){var b=h.length,P=b,V=$i.prototype.thru;for(c&&h.reverse();P--;){var X=h[P];if(typeof X!="function")throw new ks(s);if(V&&!Q&&Km(X)=="wrapper")var Q=new $i([],!0)}for(P=Q?P:b;++P<b;){X=h[P];var ne=Km(X),ce=ne=="wrapper"?bE(X):e;ce&&CE(ce[0])&&ce[1]==(H|E|C|K)&&!ce[4].length&&ce[9]==1?Q=Q[Km(ce[0])].apply(Q,ce[3]):Q=X.length==1&&CE(X)?Q[ne]():Q.thru(X)}return function(){var Ce=arguments,De=Ce[0];if(Q&&Ce.length==1&&bt(De))return Q.plant(De).value();for(var Ie=0,Me=b?h[Ie].apply(this,Ce):De;++Ie<b;)Me=h[Ie].call(this,Me);return Me}})}function Hm(c,h,b,P,V,X,Q,ne,ce,Ce){var De=h&H,Ie=h&g,Me=h&y,Xe=h&(E|S),lt=h&_,xt=Me?e:Bp(c);function ut(){for(var Nt=arguments.length,qt=pe(Nt),ai=Nt;ai--;)qt[ai]=arguments[ai];if(Xe)var ys=ed(ut),ui=pp(qt,ys);if(P&&(qt=n3(qt,P,V,Xe)),X&&(qt=s3(qt,X,Q,Xe)),Nt-=ui,Xe&&Nt<Ce){var Nr=Dn(qt,ys);return d3(c,h,Hm,ut.placeholder,b,qt,Nr,ne,ce,Ce-Nt)}var uo=Ie?b:this,Xa=Me?uo[c]:c;return Nt=qt.length,ne?qt=lU(qt,ne):lt&&Nt>1&&qt.reverse(),De&&ce<Nt&&(qt.length=ce),this&&this!==zr&&this instanceof ut&&(Xa=xt||Bp(Xa)),Xa.apply(uo,qt)}return ut}function l3(c,h){return function(b,P){return wL(b,c,h(P),{})}}function Mm(c,h){return function(b,P){var V;if(b===e&&P===e)return h;if(b!==e&&(V=b),P!==e){if(V===e)return P;typeof b=="string"||typeof P=="string"?(b=ii(b),P=ii(P)):(b=W5(b),P=W5(P)),V=c(b,P)}return V}}function vE(c){return Ga(function(h){return h=ur(h,Cn(ct())),Rt(function(b){var P=this;return c(h,function(V){return ms(V,P,b)})})})}function qm(c,h){h=h===e?" ":ii(h);var b=h.length;if(b<2)return b?lE(h,c):h;var P=lE(h,de(c/Ha(h)));return oc(h)?lc(gs(P),0,c).join(""):P.slice(0,c)}function VL(c,h,b,P){var V=h&g,X=Bp(c);function Q(){for(var ne=-1,ce=arguments.length,Ce=-1,De=P.length,Ie=pe(De+ce),Me=this&&this!==zr&&this instanceof Q?X:c;++Ce<De;)Ie[Ce]=P[Ce];for(;ce--;)Ie[Ce++]=arguments[++ne];return ms(Me,V?b:this,Ie)}return Q}function f3(c){return function(h,b,P){return P&&typeof P!="number"&&ws(h,b,P)&&(b=P=e),h=Wa(h),b===e?(b=h,h=0):b=Wa(b),P=P===e?h<b?1:-1:Wa(P),$L(h,b,P,c)}}function jm(c){return function(h,b){return typeof h=="string"&&typeof b=="string"||(h=ki(h),b=ki(b)),c(h,b)}}function d3(c,h,b,P,V,X,Q,ne,ce,Ce){var De=h&E,Ie=De?Q:e,Me=De?e:Q,Xe=De?X:e,lt=De?e:X;h|=De?C:D,h&=~(De?D:C),h&w||(h&=~(g|y));var xt=[c,h,V,Xe,Ie,lt,Me,ne,ce,Ce],ut=b.apply(e,xt);return CE(c)&&_3(ut,xt),ut.placeholder=P,C3(ut,c,h)}function wE(c){var h=kr[c];return function(b,P){if(b=ki(b),P=P==null?0:Vn(It(P),292),P&&C5(b)){var V=(or(b)+"e").split("e"),X=h(V[0]+"e"+(+V[1]+P));return V=(or(X)+"e").split("e"),+(V[0]+"e"+(+V[1]-P))}return h(b)}}var GL=Wf&&1/Ua(new Wf([,-0]))[1]==T?function(c){return new Wf(c)}:ME;function h3(c){return function(h){var b=Gn(h);return b==He?hn(h):b==yt?Sm(h):ym(h,c(h))}}function Va(c,h,b,P,V,X,Q,ne){var ce=h&y;if(!ce&&typeof c!="function")throw new ks(s);var Ce=P?P.length:0;if(Ce||(h&=~(C|D),P=V=e),Q=Q===e?Q:tn(It(Q),0),ne=ne===e?ne:It(ne),Ce-=V?V.length:0,h&D){var De=P,Ie=V;P=V=e}var Me=ce?e:bE(c),Xe=[c,h,b,P,V,De,Ie,X,Q,ne];if(Me&&aU(Xe,Me),c=Xe[0],h=Xe[1],b=Xe[2],P=Xe[3],V=Xe[4],ne=Xe[9]=Xe[9]===e?ce?0:c.length:tn(Xe[9]-Ce,0),!ne&&h&(E|S)&&(h&=~(E|S)),!h||h==g)var lt=jL(c,h,b);else h==E||h==S?lt=KL(c,h,ne):(h==C||h==(g|C))&&!V.length?lt=VL(c,h,b,P):lt=Hm.apply(e,Xe);var xt=Me?z5:_3;return C3(xt(lt,Xe),c,h)}function p3(c,h,b,P){return c===e||ao(c,si[b])&&!Xt.call(P,b)?h:c}function m3(c,h,b,P,V,X){return Cr(c)&&Cr(h)&&(X.set(h,c),Om(c,h,e,m3,X),X.delete(h)),c}function zL(c){return xp(c)?e:c}function g3(c,h,b,P,V,X){var Q=b&d,ne=c.length,ce=h.length;if(ne!=ce&&!(Q&&ce>ne))return!1;var Ce=X.get(c),De=X.get(h);if(Ce&&De)return Ce==h&&De==c;var Ie=-1,Me=!0,Xe=b&v?new Al:e;for(X.set(c,h),X.set(h,c);++Ie<ne;){var lt=c[Ie],xt=h[Ie];if(P)var ut=Q?P(xt,lt,Ie,h,c,X):P(lt,xt,Ie,c,h,X);if(ut!==e){if(ut)continue;Me=!1;break}if(Xe){if(!vr(h,function(Nt,qt){if(!La(Xe,qt)&&(lt===Nt||V(lt,Nt,b,P,X)))return Xe.push(qt)})){Me=!1;break}}else if(!(lt===xt||V(lt,xt,b,P,X))){Me=!1;break}}return X.delete(c),X.delete(h),Me}function YL(c,h,b,P,V,X,Q){switch(b){case Ar:if(c.byteLength!=h.byteLength||c.byteOffset!=h.byteOffset)return!1;c=c.buffer,h=h.buffer;case Ne:return!(c.byteLength!=h.byteLength||!X(new Vf(c),new Vf(h)));case $e:case oe:case St:return ao(+c,+h);case Be:return c.name==h.name&&c.message==h.message;case Tr:case Zr:return c==h+"";case He:var ne=hn;case yt:var ce=P&d;if(ne||(ne=Ua),c.size!=h.size&&!ce)return!1;var Ce=Q.get(c);if(Ce)return Ce==h;P|=v,Q.set(c,h);var De=g3(ne(c),ne(h),P,V,X,Q);return Q.delete(c),De;case $s:if(Ap)return Ap.call(c)==Ap.call(h)}return!1}function WL(c,h,b,P,V,X){var Q=b&d,ne=yE(c),ce=ne.length,Ce=yE(h),De=Ce.length;if(ce!=De&&!Q)return!1;for(var Ie=ce;Ie--;){var Me=ne[Ie];if(!(Q?Me in h:Xt.call(h,Me)))return!1}var Xe=X.get(c),lt=X.get(h);if(Xe&<)return Xe==h&<==c;var xt=!0;X.set(c,h),X.set(h,c);for(var ut=Q;++Ie<ce;){Me=ne[Ie];var Nt=c[Me],qt=h[Me];if(P)var ai=Q?P(qt,Nt,Me,h,c,X):P(Nt,qt,Me,c,h,X);if(!(ai===e?Nt===qt||V(Nt,qt,b,P,X):ai)){xt=!1;break}ut||(ut=Me=="constructor")}if(xt&&!ut){var ys=c.constructor,ui=h.constructor;ys!=ui&&"constructor"in c&&"constructor"in h&&!(typeof ys=="function"&&ys instanceof ys&&typeof ui=="function"&&ui instanceof ui)&&(xt=!1)}return X.delete(c),X.delete(h),xt}function Ga(c){return FE(A3(c,e,x3),c+"")}function yE(c){return O5(c,pn,SE)}function EE(c){return O5(c,Ns,v3)}var bE=$m?function(c){return $m.get(c)}:ME;function Km(c){for(var h=c.name+"",b=Xf[h],P=Xt.call(Xf,h)?b.length:0;P--;){var V=b[P],X=V.func;if(X==null||X==c)return V.name}return h}function ed(c){var h=Xt.call(Y,"placeholder")?Y:c;return h.placeholder}function ct(){var c=Y.iteratee||UE;return c=c===UE?U5:c,arguments.length?c(arguments[0],arguments[1]):c}function Vm(c,h){var b=c.__data__;return nU(h)?b[typeof h=="string"?"string":"hash"]:b.map}function AE(c){for(var h=pn(c),b=h.length;b--;){var P=h[b],V=c[P];h[b]=[P,V,E3(V)]}return h}function Cl(c,h){var b=Am(c,h);return L5(b)?b:e}function XL(c){var h=Xt.call(c,qa),b=c[qa];try{c[qa]=e;var P=!0}catch{}var V=jf.call(c);return P&&(h?c[qa]=b:delete c[qa]),V}var SE=tr?function(c){return c==null?[]:(c=ir(c),en(tr(c),function(h){return cr.call(c,h)}))}:qE,v3=tr?function(c){for(var h=[];c;)jo(h,SE(c)),c=Gf(c);return h}:qE,Gn=vs;(Jy&&Gn(new Jy(new ArrayBuffer(1)))!=Ar||yp&&Gn(new yp)!=He||Zy&&Gn(Zy.resolve())!=Mn||Wf&&Gn(new Wf)!=yt||Ep&&Gn(new Ep)!=Ot)&&(Gn=function(c){var h=vs(c),b=h==wt?c.constructor:e,P=b?Dl(b):"";if(P)switch(P){case RN:return Ar;case TN:return He;case kN:return Mn;case PN:return yt;case ON:return Ot}return h});function JL(c,h,b){for(var P=-1,V=b.length;++P<V;){var X=b[P],Q=X.size;switch(X.type){case"drop":c+=Q;break;case"dropRight":h-=Q;break;case"take":h=Vn(h,c+Q);break;case"takeRight":c=tn(c,h-Q);break}}return{start:c,end:h}}function ZL(c){var h=c.match(Ve);return h?h[1].split(it):[]}function w3(c,h,b){h=cc(h,c);for(var P=-1,V=h.length,X=!1;++P<V;){var Q=oo(h[P]);if(!(X=c!=null&&b(c,Q)))break;c=c[Q]}return X||++P!=V?X:(V=c==null?0:c.length,!!V&&Zm(V)&&za(Q,V)&&(bt(c)||Fl(c)))}function QL(c){var h=c.length,b=new c.constructor(h);return h&&typeof c[0]=="string"&&Xt.call(c,"index")&&(b.index=c.index,b.input=c.input),b}function y3(c){return typeof c.constructor=="function"&&!Ip(c)?Jf(Gf(c)):{}}function eU(c,h,b){var P=c.constructor;switch(h){case Ne:return gE(c);case $e:case oe:return new P(+c);case Ar:return NL(c,b);case ls:case _t:case pl:case ds:case _e:case Wu:case Qt:case qn:case Uo:return t3(c,b);case He:return new P;case St:case Zr:return new P(c);case Tr:return LL(c);case yt:return new P;case $s:return UL(c)}}function tU(c,h){var b=h.length;if(!b)return c;var P=b-1;return h[P]=(b>1?"& ":"")+h[P],h=h.join(b>2?", ":" "),c.replace(ze,`{
|
||
/* [wrapped with `+h+`] */
|
||
`)}function rU(c){return bt(c)||Fl(c)||!!(Yf&&c&&c[Yf])}function za(c,h){var b=typeof c;return h=h??M,!!h&&(b=="number"||b!="symbol"&&ps.test(c))&&c>-1&&c%1==0&&c<h}function ws(c,h,b){if(!Cr(b))return!1;var P=typeof h;return(P=="number"?Os(b)&&za(h,b.length):P=="string"&&h in b)?ao(b[h],c):!1}function _E(c,h){if(bt(c))return!1;var b=typeof c;return b=="number"||b=="symbol"||b=="boolean"||c==null||oi(c)?!0:Yh.test(c)||!Zu.test(c)||h!=null&&c in ir(h)}function nU(c){var h=typeof c;return h=="string"||h=="number"||h=="symbol"||h=="boolean"?c!=="__proto__":c===null}function CE(c){var h=Km(c),b=Y[h];if(typeof b!="function"||!(h in Ut.prototype))return!1;if(c===b)return!0;var P=bE(b);return!!P&&c===P[0]}function sU(c){return!!Fm&&Fm in c}var iU=qf?Ya:jE;function Ip(c){var h=c&&c.constructor,b=typeof h=="function"&&h.prototype||si;return c===b}function E3(c){return c===c&&!Cr(c)}function b3(c,h){return function(b){return b==null?!1:b[c]===h&&(h!==e||c in ir(b))}}function oU(c){var h=Xm(c,function(P){return b.size===u&&b.clear(),P}),b=h.cache;return h}function aU(c,h){var b=c[1],P=h[1],V=b|P,X=V<(g|y|H),Q=P==H&&b==E||P==H&&b==K&&c[7].length<=h[8]||P==(H|K)&&h[7].length<=h[8]&&b==E;if(!(X||Q))return c;P&g&&(c[2]=h[2],V|=b&g?0:w);var ne=h[3];if(ne){var ce=c[3];c[3]=ce?n3(ce,ne,h[4]):ne,c[4]=ce?Dn(c[3],l):h[4]}return ne=h[5],ne&&(ce=c[5],c[5]=ce?s3(ce,ne,h[6]):ne,c[6]=ce?Dn(c[5],l):h[6]),ne=h[7],ne&&(c[7]=ne),P&H&&(c[8]=c[8]==null?h[8]:Vn(c[8],h[8])),c[9]==null&&(c[9]=h[9]),c[0]=h[0],c[1]=V,c}function uU(c){var h=[];if(c!=null)for(var b in ir(c))h.push(b);return h}function cU(c){return jf.call(c)}function A3(c,h,b){return h=tn(h===e?c.length-1:h,0),function(){for(var P=arguments,V=-1,X=tn(P.length-h,0),Q=pe(X);++V<X;)Q[V]=P[h+V];V=-1;for(var ne=pe(h+1);++V<h;)ne[V]=P[V];return ne[h]=b(Q),ms(c,this,ne)}}function S3(c,h){return h.length<2?c:_l(c,Ri(h,0,-1))}function lU(c,h){for(var b=c.length,P=Vn(h.length,b),V=Ps(c);P--;){var X=h[P];c[P]=za(X,b)?V[X]:e}return c}function DE(c,h){if(!(h==="constructor"&&typeof c[h]=="function")&&h!="__proto__")return c[h]}var _3=D3(z5),$p=Z||function(c,h){return zr.setTimeout(c,h)},FE=D3(TL);function C3(c,h,b){var P=h+"";return FE(c,tU(P,fU(ZL(P),b)))}function D3(c){var h=0,b=0;return function(){var P=IN(),V=k-(P-b);if(b=P,V>0){if(++h>=U)return arguments[0]}else h=0;return c.apply(e,arguments)}}function Gm(c,h){var b=-1,P=c.length,V=P-1;for(h=h===e?P:h;++b<h;){var X=cE(b,V),Q=c[X];c[X]=c[b],c[b]=Q}return c.length=h,c}var F3=oU(function(c){var h=[];return c.charCodeAt(0)===46&&h.push(""),c.replace(Lf,function(b,P,V,X){h.push(V?X.replace(Qr,"$1"):P||b)}),h});function oo(c){if(typeof c=="string"||oi(c))return c;var h=c+"";return h=="0"&&1/c==-T?"-0":h}function Dl(c){if(c!=null){try{return Ma.call(c)}catch{}try{return c+""}catch{}}return""}function fU(c,h){return q(ge,function(b){var P="_."+b[0];h&b[1]&&!nc(c,P)&&c.push(P)}),c.sort()}function B3(c){if(c instanceof Ut)return c.clone();var h=new $i(c.__wrapped__,c.__chain__);return h.__actions__=Ps(c.__actions__),h.__index__=c.__index__,h.__values__=c.__values__,h}function dU(c,h,b){(b?ws(c,h,b):h===e)?h=1:h=tn(It(h),0);var P=c==null?0:c.length;if(!P||h<1)return[];for(var V=0,X=0,Q=pe(de(P/h));V<P;)Q[X++]=Ri(c,V,V+=h);return Q}function hU(c){for(var h=-1,b=c==null?0:c.length,P=0,V=[];++h<b;){var X=c[h];X&&(V[P++]=X)}return V}function pU(){var c=arguments.length;if(!c)return[];for(var h=pe(c-1),b=arguments[0],P=c;P--;)h[P-1]=arguments[P];return jo(bt(b)?Ps(b):[b],Fn(h,1))}var mU=Rt(function(c,h){return Or(c)?_p(c,Fn(h,1,Or,!0)):[]}),gU=Rt(function(c,h){var b=Ti(h);return Or(b)&&(b=e),Or(c)?_p(c,Fn(h,1,Or,!0),ct(b,2)):[]}),vU=Rt(function(c,h){var b=Ti(h);return Or(b)&&(b=e),Or(c)?_p(c,Fn(h,1,Or,!0),e,b):[]});function wU(c,h,b){var P=c==null?0:c.length;return P?(h=b||h===e?1:It(h),Ri(c,h<0?0:h,P)):[]}function yU(c,h,b){var P=c==null?0:c.length;return P?(h=b||h===e?1:It(h),h=P-h,Ri(c,0,h<0?0:h)):[]}function EU(c,h){return c&&c.length?Lm(c,ct(h,3),!0,!0):[]}function bU(c,h){return c&&c.length?Lm(c,ct(h,3),!0):[]}function AU(c,h,b,P){var V=c==null?0:c.length;return V?(b&&typeof b!="number"&&ws(c,h,b)&&(b=0,P=V),pL(c,h,b,P)):[]}function I3(c,h,b){var P=c==null?0:c.length;if(!P)return-1;var V=b==null?0:It(b);return V<0&&(V=tn(P+V,0)),Mf(c,ct(h,3),V)}function $3(c,h,b){var P=c==null?0:c.length;if(!P)return-1;var V=P-1;return b!==e&&(V=It(b),V=b<0?tn(P+V,0):Vn(V,P-1)),Mf(c,ct(h,3),V,!0)}function x3(c){var h=c==null?0:c.length;return h?Fn(c,1):[]}function SU(c){var h=c==null?0:c.length;return h?Fn(c,T):[]}function _U(c,h){var b=c==null?0:c.length;return b?(h=h===e?1:It(h),Fn(c,h)):[]}function CU(c){for(var h=-1,b=c==null?0:c.length,P={};++h<b;){var V=c[h];Vo(P,V[0],V[1])}return P}function R3(c){return c&&c.length?c[0]:e}function DU(c,h,b){var P=c==null?0:c.length;if(!P)return-1;var V=b==null?0:It(b);return V<0&&(V=tn(P+V,0)),sc(c,h,V)}function FU(c){var h=c==null?0:c.length;return h?Ri(c,0,-1):[]}var BU=Rt(function(c){var h=ur(c,pE);return h.length&&h[0]===c[0]?sE(h):[]}),IU=Rt(function(c){var h=Ti(c),b=ur(c,pE);return h===Ti(b)?h=e:b.pop(),b.length&&b[0]===c[0]?sE(b,ct(h,2)):[]}),$U=Rt(function(c){var h=Ti(c),b=ur(c,pE);return h=typeof h=="function"?h:e,h&&b.pop(),b.length&&b[0]===c[0]?sE(b,e,h):[]});function xU(c,h){return c==null?"":FN.call(c,h)}function Ti(c){var h=c==null?0:c.length;return h?c[h-1]:e}function RU(c,h,b){var P=c==null?0:c.length;if(!P)return-1;var V=P;return b!==e&&(V=It(b),V=V<0?tn(P+V,0):Vn(V,P-1)),h===h?_m(c,h,V):Mf(c,op,V,!0)}function TU(c,h){return c&&c.length?j5(c,It(h)):e}var kU=Rt(T3);function T3(c,h){return c&&c.length&&h&&h.length?uE(c,h):c}function PU(c,h,b){return c&&c.length&&h&&h.length?uE(c,h,ct(b,2)):c}function OU(c,h,b){return c&&c.length&&h&&h.length?uE(c,h,e,b):c}var NU=Ga(function(c,h){var b=c==null?0:c.length,P=eE(c,h);return G5(c,ur(h,function(V){return za(V,b)?+V:V}).sort(r3)),P});function LU(c,h){var b=[];if(!(c&&c.length))return b;var P=-1,V=[],X=c.length;for(h=ct(h,3);++P<X;){var Q=c[P];h(Q,P,c)&&(b.push(Q),V.push(P))}return G5(c,V),b}function BE(c){return c==null?c:xN.call(c)}function UU(c,h,b){var P=c==null?0:c.length;return P?(b&&typeof b!="number"&&ws(c,h,b)?(h=0,b=P):(h=h==null?0:It(h),b=b===e?P:It(b)),Ri(c,h,b)):[]}function HU(c,h){return Nm(c,h)}function MU(c,h,b){return fE(c,h,ct(b,2))}function qU(c,h){var b=c==null?0:c.length;if(b){var P=Nm(c,h);if(P<b&&ao(c[P],h))return P}return-1}function jU(c,h){return Nm(c,h,!0)}function KU(c,h,b){return fE(c,h,ct(b,2),!0)}function VU(c,h){var b=c==null?0:c.length;if(b){var P=Nm(c,h,!0)-1;if(ao(c[P],h))return P}return-1}function GU(c){return c&&c.length?Y5(c):[]}function zU(c,h){return c&&c.length?Y5(c,ct(h,2)):[]}function YU(c){var h=c==null?0:c.length;return h?Ri(c,1,h):[]}function WU(c,h,b){return c&&c.length?(h=b||h===e?1:It(h),Ri(c,0,h<0?0:h)):[]}function XU(c,h,b){var P=c==null?0:c.length;return P?(h=b||h===e?1:It(h),h=P-h,Ri(c,h<0?0:h,P)):[]}function JU(c,h){return c&&c.length?Lm(c,ct(h,3),!1,!0):[]}function ZU(c,h){return c&&c.length?Lm(c,ct(h,3)):[]}var QU=Rt(function(c){return uc(Fn(c,1,Or,!0))}),eH=Rt(function(c){var h=Ti(c);return Or(h)&&(h=e),uc(Fn(c,1,Or,!0),ct(h,2))}),tH=Rt(function(c){var h=Ti(c);return h=typeof h=="function"?h:e,uc(Fn(c,1,Or,!0),e,h)});function rH(c){return c&&c.length?uc(c):[]}function nH(c,h){return c&&c.length?uc(c,ct(h,2)):[]}function sH(c,h){return h=typeof h=="function"?h:e,c&&c.length?uc(c,e,h):[]}function IE(c){if(!(c&&c.length))return[];var h=0;return c=en(c,function(b){if(Or(b))return h=tn(b.length,h),!0}),lp(h,function(b){return ur(c,Se(b))})}function k3(c,h){if(!(c&&c.length))return[];var b=IE(c);return h==null?b:ur(b,function(P){return ms(h,e,P)})}var iH=Rt(function(c,h){return Or(c)?_p(c,h):[]}),oH=Rt(function(c){return hE(en(c,Or))}),aH=Rt(function(c){var h=Ti(c);return Or(h)&&(h=e),hE(en(c,Or),ct(h,2))}),uH=Rt(function(c){var h=Ti(c);return h=typeof h=="function"?h:e,hE(en(c,Or),e,h)}),cH=Rt(IE);function lH(c,h){return Z5(c||[],h||[],Sp)}function fH(c,h){return Z5(c||[],h||[],Fp)}var dH=Rt(function(c){var h=c.length,b=h>1?c[h-1]:e;return b=typeof b=="function"?(c.pop(),b):e,k3(c,b)});function P3(c){var h=Y(c);return h.__chain__=!0,h}function hH(c,h){return h(c),c}function zm(c,h){return h(c)}var pH=Ga(function(c){var h=c.length,b=h?c[0]:0,P=this.__wrapped__,V=function(X){return eE(X,c)};return h>1||this.__actions__.length||!(P instanceof Ut)||!za(b)?this.thru(V):(P=P.slice(b,+b+(h?1:0)),P.__actions__.push({func:zm,args:[V],thisArg:e}),new $i(P,this.__chain__).thru(function(X){return h&&!X.length&&X.push(e),X}))});function mH(){return P3(this)}function gH(){return new $i(this.value(),this.__chain__)}function vH(){this.__values__===e&&(this.__values__=W3(this.value()));var c=this.__index__>=this.__values__.length,h=c?e:this.__values__[this.__index__++];return{done:c,value:h}}function wH(){return this}function yH(c){for(var h,b=this;b instanceof Rm;){var P=B3(b);P.__index__=0,P.__values__=e,h?V.__wrapped__=P:h=P;var V=P;b=b.__wrapped__}return V.__wrapped__=c,h}function EH(){var c=this.__wrapped__;if(c instanceof Ut){var h=c;return this.__actions__.length&&(h=new Ut(this)),h=h.reverse(),h.__actions__.push({func:zm,args:[BE],thisArg:e}),new $i(h,this.__chain__)}return this.thru(BE)}function bH(){return J5(this.__wrapped__,this.__actions__)}var AH=Um(function(c,h,b){Xt.call(c,b)?++c[b]:Vo(c,b,1)});function SH(c,h,b){var P=bt(c)?vl:hL;return b&&ws(c,h,b)&&(h=e),P(c,ct(h,3))}function _H(c,h){var b=bt(c)?en:k5;return b(c,ct(h,3))}var CH=u3(I3),DH=u3($3);function FH(c,h){return Fn(Ym(c,h),1)}function BH(c,h){return Fn(Ym(c,h),T)}function IH(c,h,b){return b=b===e?1:It(b),Fn(Ym(c,h),b)}function O3(c,h){var b=bt(c)?q:ac;return b(c,ct(h,3))}function N3(c,h){var b=bt(c)?Et:T5;return b(c,ct(h,3))}var $H=Um(function(c,h,b){Xt.call(c,b)?c[b].push(h):Vo(c,b,[h])});function xH(c,h,b,P){c=Os(c)?c:rd(c),b=b&&!P?It(b):0;var V=c.length;return b<0&&(b=tn(V+b,0)),Qm(c)?b<=V&&c.indexOf(h,b)>-1:!!V&&sc(c,h,b)>-1}var RH=Rt(function(c,h,b){var P=-1,V=typeof h=="function",X=Os(c)?pe(c.length):[];return ac(c,function(Q){X[++P]=V?ms(h,Q,b):Cp(Q,h,b)}),X}),TH=Um(function(c,h,b){Vo(c,b,h)});function Ym(c,h){var b=bt(c)?ur:H5;return b(c,ct(h,3))}function kH(c,h,b,P){return c==null?[]:(bt(h)||(h=h==null?[]:[h]),b=P?e:b,bt(b)||(b=b==null?[]:[b]),K5(c,h,b))}var PH=Um(function(c,h,b){c[b?0:1].push(h)},function(){return[[],[]]});function OH(c,h,b){var P=bt(c)?vm:up,V=arguments.length<3;return P(c,ct(h,4),b,V,ac)}function NH(c,h,b){var P=bt(c)?S5:up,V=arguments.length<3;return P(c,ct(h,4),b,V,T5)}function LH(c,h){var b=bt(c)?en:k5;return b(c,Jm(ct(h,3)))}function UH(c){var h=bt(c)?I5:xL;return h(c)}function HH(c,h,b){(b?ws(c,h,b):h===e)?h=1:h=It(h);var P=bt(c)?uL:RL;return P(c,h)}function MH(c){var h=bt(c)?cL:kL;return h(c)}function qH(c){if(c==null)return 0;if(Os(c))return Qm(c)?Ha(c):c.length;var h=Gn(c);return h==He||h==yt?c.size:oE(c).length}function jH(c,h,b){var P=bt(c)?vr:PL;return b&&ws(c,h,b)&&(h=e),P(c,ct(h,3))}var KH=Rt(function(c,h){if(c==null)return[];var b=h.length;return b>1&&ws(c,h[0],h[1])?h=[]:b>2&&ws(h[0],h[1],h[2])&&(h=[h[0]]),K5(c,Fn(h,1),[])}),Wm=ee||function(){return zr.Date.now()};function VH(c,h){if(typeof h!="function")throw new ks(s);return c=It(c),function(){if(--c<1)return h.apply(this,arguments)}}function L3(c,h,b){return h=b?e:h,h=c&&h==null?c.length:h,Va(c,H,e,e,e,e,h)}function U3(c,h){var b;if(typeof h!="function")throw new ks(s);return c=It(c),function(){return--c>0&&(b=h.apply(this,arguments)),c<=1&&(h=e),b}}var $E=Rt(function(c,h,b){var P=g;if(b.length){var V=Dn(b,ed($E));P|=C}return Va(c,P,h,b,V)}),H3=Rt(function(c,h,b){var P=g|y;if(b.length){var V=Dn(b,ed(H3));P|=C}return Va(h,P,c,b,V)});function M3(c,h,b){h=b?e:h;var P=Va(c,E,e,e,e,e,e,h);return P.placeholder=M3.placeholder,P}function q3(c,h,b){h=b?e:h;var P=Va(c,S,e,e,e,e,e,h);return P.placeholder=q3.placeholder,P}function j3(c,h,b){var P,V,X,Q,ne,ce,Ce=0,De=!1,Ie=!1,Me=!0;if(typeof c!="function")throw new ks(s);h=ki(h)||0,Cr(b)&&(De=!!b.leading,Ie="maxWait"in b,X=Ie?tn(ki(b.maxWait)||0,h):X,Me="trailing"in b?!!b.trailing:Me);function Xe(Nr){var uo=P,Xa=V;return P=V=e,Ce=Nr,Q=c.apply(Xa,uo),Q}function lt(Nr){return Ce=Nr,ne=$p(Nt,h),De?Xe(Nr):Q}function xt(Nr){var uo=Nr-ce,Xa=Nr-Ce,c8=h-uo;return Ie?Vn(c8,X-Xa):c8}function ut(Nr){var uo=Nr-ce,Xa=Nr-Ce;return ce===e||uo>=h||uo<0||Ie&&Xa>=X}function Nt(){var Nr=Wm();if(ut(Nr))return qt(Nr);ne=$p(Nt,xt(Nr))}function qt(Nr){return ne=e,Me&&P?Xe(Nr):(P=V=e,Q)}function ai(){ne!==e&&Q5(ne),Ce=0,P=ce=V=ne=e}function ys(){return ne===e?Q:qt(Wm())}function ui(){var Nr=Wm(),uo=ut(Nr);if(P=arguments,V=this,ce=Nr,uo){if(ne===e)return lt(ce);if(Ie)return Q5(ne),ne=$p(Nt,h),Xe(ce)}return ne===e&&(ne=$p(Nt,h)),Q}return ui.cancel=ai,ui.flush=ys,ui}var GH=Rt(function(c,h){return R5(c,1,h)}),zH=Rt(function(c,h,b){return R5(c,ki(h)||0,b)});function YH(c){return Va(c,_)}function Xm(c,h){if(typeof c!="function"||h!=null&&typeof h!="function")throw new ks(s);var b=function(){var P=arguments,V=h?h.apply(this,P):P[0],X=b.cache;if(X.has(V))return X.get(V);var Q=c.apply(this,P);return b.cache=X.set(V,Q)||X,Q};return b.cache=new(Xm.Cache||Ka),b}Xm.Cache=Ka;function Jm(c){if(typeof c!="function")throw new ks(s);return function(){var h=arguments;switch(h.length){case 0:return!c.call(this);case 1:return!c.call(this,h[0]);case 2:return!c.call(this,h[0],h[1]);case 3:return!c.call(this,h[0],h[1],h[2])}return!c.apply(this,h)}}function WH(c){return U3(2,c)}var XH=OL(function(c,h){h=h.length==1&&bt(h[0])?ur(h[0],Cn(ct())):ur(Fn(h,1),Cn(ct()));var b=h.length;return Rt(function(P){for(var V=-1,X=Vn(P.length,b);++V<X;)P[V]=h[V].call(this,P[V]);return ms(c,this,P)})}),xE=Rt(function(c,h){var b=Dn(h,ed(xE));return Va(c,C,e,h,b)}),K3=Rt(function(c,h){var b=Dn(h,ed(K3));return Va(c,D,e,h,b)}),JH=Ga(function(c,h){return Va(c,K,e,e,e,h)});function ZH(c,h){if(typeof c!="function")throw new ks(s);return h=h===e?h:It(h),Rt(c,h)}function QH(c,h){if(typeof c!="function")throw new ks(s);return h=h==null?0:tn(It(h),0),Rt(function(b){var P=b[h],V=lc(b,0,h);return P&&jo(V,P),ms(c,this,V)})}function eM(c,h,b){var P=!0,V=!0;if(typeof c!="function")throw new ks(s);return Cr(b)&&(P="leading"in b?!!b.leading:P,V="trailing"in b?!!b.trailing:V),j3(c,h,{leading:P,maxWait:h,trailing:V})}function tM(c){return L3(c,1)}function rM(c,h){return xE(mE(h),c)}function nM(){if(!arguments.length)return[];var c=arguments[0];return bt(c)?c:[c]}function sM(c){return xi(c,p)}function iM(c,h){return h=typeof h=="function"?h:e,xi(c,p,h)}function oM(c){return xi(c,f|p)}function aM(c,h){return h=typeof h=="function"?h:e,xi(c,f|p,h)}function uM(c,h){return h==null||x5(c,h,pn(h))}function ao(c,h){return c===h||c!==c&&h!==h}var cM=jm(nE),lM=jm(function(c,h){return c>=h}),Fl=N5((function(){return arguments})())?N5:function(c){return Br(c)&&Xt.call(c,"callee")&&!cr.call(c,"callee")},bt=pe.isArray,fM=fm?Cn(fm):yL;function Os(c){return c!=null&&Zm(c.length)&&!Ya(c)}function Or(c){return Br(c)&&Os(c)}function dM(c){return c===!0||c===!1||Br(c)&&vs(c)==$e}var fc=Pr||jE,hM=dm?Cn(dm):EL;function pM(c){return Br(c)&&c.nodeType===1&&!xp(c)}function mM(c){if(c==null)return!0;if(Os(c)&&(bt(c)||typeof c=="string"||typeof c.splice=="function"||fc(c)||td(c)||Fl(c)))return!c.length;var h=Gn(c);if(h==He||h==yt)return!c.size;if(Ip(c))return!oE(c).length;for(var b in c)if(Xt.call(c,b))return!1;return!0}function gM(c,h){return Dp(c,h)}function vM(c,h,b){b=typeof b=="function"?b:e;var P=b?b(c,h):e;return P===e?Dp(c,h,e,b):!!P}function RE(c){if(!Br(c))return!1;var h=vs(c);return h==Be||h==me||typeof c.message=="string"&&typeof c.name=="string"&&!xp(c)}function wM(c){return typeof c=="number"&&C5(c)}function Ya(c){if(!Cr(c))return!1;var h=vs(c);return h==Ue||h==We||h==ke||h==Rr}function V3(c){return typeof c=="number"&&c==It(c)}function Zm(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=M}function Cr(c){var h=typeof c;return c!=null&&(h=="object"||h=="function")}function Br(c){return c!=null&&typeof c=="object"}var G3=hm?Cn(hm):AL;function yM(c,h){return c===h||iE(c,h,AE(h))}function EM(c,h,b){return b=typeof b=="function"?b:e,iE(c,h,AE(h),b)}function bM(c){return z3(c)&&c!=+c}function AM(c){if(iU(c))throw new ft(n);return L5(c)}function SM(c){return c===null}function _M(c){return c==null}function z3(c){return typeof c=="number"||Br(c)&&vs(c)==St}function xp(c){if(!Br(c)||vs(c)!=wt)return!1;var h=Gf(c);if(h===null)return!0;var b=Xt.call(h,"constructor")&&h.constructor;return typeof b=="function"&&b instanceof b&&Ma.call(b)==Yy}var TE=pm?Cn(pm):SL;function CM(c){return V3(c)&&c>=-M&&c<=M}var Y3=mm?Cn(mm):_L;function Qm(c){return typeof c=="string"||!bt(c)&&Br(c)&&vs(c)==Zr}function oi(c){return typeof c=="symbol"||Br(c)&&vs(c)==$s}var td=gm?Cn(gm):CL;function DM(c){return c===e}function FM(c){return Br(c)&&Gn(c)==Ot}function BM(c){return Br(c)&&vs(c)==rt}var IM=jm(aE),$M=jm(function(c,h){return c<=h});function W3(c){if(!c)return[];if(Os(c))return Qm(c)?gs(c):Ps(c);if(El&&c[El])return qy(c[El]());var h=Gn(c),b=h==He?hn:h==yt?Ua:rd;return b(c)}function Wa(c){if(!c)return c===0?c:0;if(c=ki(c),c===T||c===-T){var h=c<0?-1:1;return h*W}return c===c?c:0}function It(c){var h=Wa(c),b=h%1;return h===h?b?h-b:h:0}function X3(c){return c?Sl(It(c),0,J):0}function ki(c){if(typeof c=="number")return c;if(oi(c))return G;if(Cr(c)){var h=typeof c.valueOf=="function"?c.valueOf():c;c=Cr(h)?h+"":h}if(typeof c!="string")return c===0?c:+c;c=fp(c);var b=hs.test(c);return b||Vr.test(c)?Oy(c.slice(2),b?2:8):Mo.test(c)?G:+c}function J3(c){return zo(c,Ns(c))}function xM(c){return c?Sl(It(c),-M,M):c===0?c:0}function or(c){return c==null?"":ii(c)}var RM=Zf(function(c,h){if(Ip(h)||Os(h)){zo(h,pn(h),c);return}for(var b in h)Xt.call(h,b)&&Sp(c,b,h[b])}),Z3=Zf(function(c,h){zo(h,Ns(h),c)}),Q3=Zf(function(c,h,b,P){zo(h,Ns(h),c,P)}),kE=Zf(function(c,h,b,P){zo(h,pn(h),c,P)}),TM=Ga(eE);function kM(c,h){var b=Jf(c);return h==null?b:$5(b,h)}var PM=Rt(function(c,h){c=ir(c);var b=-1,P=h.length,V=P>2?h[2]:e;for(V&&ws(h[0],h[1],V)&&(P=1);++b<P;)for(var X=h[b],Q=Ns(X),ne=-1,ce=Q.length;++ne<ce;){var Ce=Q[ne],De=c[Ce];(De===e||ao(De,si[Ce])&&!Xt.call(c,Ce))&&(c[Ce]=X[Ce])}return c}),OM=Rt(function(c){return c.push(e,m3),ms(e8,e,c)});function NM(c,h){return dn(c,ct(h,3),Go)}function LM(c,h){return dn(c,ct(h,3),rE)}function UM(c,h){return c==null?c:tE(c,ct(h,3),Ns)}function HM(c,h){return c==null?c:P5(c,ct(h,3),Ns)}function MM(c,h){return c&&Go(c,ct(h,3))}function qM(c,h){return c&&rE(c,ct(h,3))}function jM(c){return c==null?[]:Pm(c,pn(c))}function KM(c){return c==null?[]:Pm(c,Ns(c))}function PE(c,h,b){var P=c==null?e:_l(c,h);return P===e?b:P}function VM(c,h){return c!=null&&w3(c,h,mL)}function OE(c,h){return c!=null&&w3(c,h,gL)}var GM=l3(function(c,h,b){h!=null&&typeof h.toString!="function"&&(h=jf.call(h)),c[h]=b},LE(Ls)),zM=l3(function(c,h,b){h!=null&&typeof h.toString!="function"&&(h=jf.call(h)),Xt.call(c,h)?c[h].push(b):c[h]=[b]},ct),YM=Rt(Cp);function pn(c){return Os(c)?B5(c):oE(c)}function Ns(c){return Os(c)?B5(c,!0):DL(c)}function WM(c,h){var b={};return h=ct(h,3),Go(c,function(P,V,X){Vo(b,h(P,V,X),P)}),b}function XM(c,h){var b={};return h=ct(h,3),Go(c,function(P,V,X){Vo(b,V,h(P,V,X))}),b}var JM=Zf(function(c,h,b){Om(c,h,b)}),e8=Zf(function(c,h,b,P){Om(c,h,b,P)}),ZM=Ga(function(c,h){var b={};if(c==null)return b;var P=!1;h=ur(h,function(X){return X=cc(X,c),P||(P=X.length>1),X}),zo(c,EE(c),b),P&&(b=xi(b,f|m|p,zL));for(var V=h.length;V--;)dE(b,h[V]);return b});function QM(c,h){return t8(c,Jm(ct(h)))}var eq=Ga(function(c,h){return c==null?{}:BL(c,h)});function t8(c,h){if(c==null)return{};var b=ur(EE(c),function(P){return[P]});return h=ct(h),V5(c,b,function(P,V){return h(P,V[0])})}function tq(c,h,b){h=cc(h,c);var P=-1,V=h.length;for(V||(V=1,c=e);++P<V;){var X=c==null?e:c[oo(h[P])];X===e&&(P=V,X=b),c=Ya(X)?X.call(c):X}return c}function rq(c,h,b){return c==null?c:Fp(c,h,b)}function nq(c,h,b,P){return P=typeof P=="function"?P:e,c==null?c:Fp(c,h,b,P)}var r8=h3(pn),n8=h3(Ns);function sq(c,h,b){var P=bt(c),V=P||fc(c)||td(c);if(h=ct(h,4),b==null){var X=c&&c.constructor;V?b=P?new X:[]:Cr(c)?b=Ya(X)?Jf(Gf(c)):{}:b={}}return(V?q:Go)(c,function(Q,ne,ce){return h(b,Q,ne,ce)}),b}function iq(c,h){return c==null?!0:dE(c,h)}function oq(c,h,b){return c==null?c:X5(c,h,mE(b))}function aq(c,h,b,P){return P=typeof P=="function"?P:e,c==null?c:X5(c,h,mE(b),P)}function rd(c){return c==null?[]:dp(c,pn(c))}function uq(c){return c==null?[]:dp(c,Ns(c))}function cq(c,h,b){return b===e&&(b=h,h=e),b!==e&&(b=ki(b),b=b===b?b:0),h!==e&&(h=ki(h),h=h===h?h:0),Sl(ki(c),h,b)}function lq(c,h,b){return h=Wa(h),b===e?(b=h,h=0):b=Wa(b),c=ki(c),vL(c,h,b)}function fq(c,h,b){if(b&&typeof b!="boolean"&&ws(c,h,b)&&(h=b=e),b===e&&(typeof h=="boolean"?(b=h,h=e):typeof c=="boolean"&&(b=c,c=e)),c===e&&h===e?(c=0,h=1):(c=Wa(c),h===e?(h=c,c=0):h=Wa(h)),c>h){var P=c;c=h,h=P}if(b||c%1||h%1){var V=D5();return Vn(c+V*(h-c+Py("1e-"+((V+"").length-1))),h)}return cE(c,h)}var dq=Qf(function(c,h,b){return h=h.toLowerCase(),c+(b?s8(h):h)});function s8(c){return NE(or(c).toLowerCase())}function i8(c){return c=or(c),c&&c.replace(Qu,Uy).replace(Cy,"")}function hq(c,h,b){c=or(c),h=ii(h);var P=c.length;b=b===e?P:Sl(It(b),0,P);var V=b;return b-=h.length,b>=0&&c.slice(b,V)==h}function pq(c){return c=or(c),c&&Fi.test(c)?c.replace(Ho,bm):c}function mq(c){return c=or(c),c&&Wh.test(c)?c.replace(gl,"\\$&"):c}var gq=Qf(function(c,h,b){return c+(b?"-":"")+h.toLowerCase()}),vq=Qf(function(c,h,b){return c+(b?" ":"")+h.toLowerCase()}),wq=a3("toLowerCase");function yq(c,h,b){c=or(c),h=It(h);var P=h?Ha(c):0;if(!h||P>=h)return c;var V=(h-P)/2;return qm(ve(V),b)+c+qm(de(V),b)}function Eq(c,h,b){c=or(c),h=It(h);var P=h?Ha(c):0;return h&&P<h?c+qm(h-P,b):c}function bq(c,h,b){c=or(c),h=It(h);var P=h?Ha(c):0;return h&&P<h?qm(h-P,b)+c:c}function Aq(c,h,b){return b||h==null?h=0:h&&(h=+h),$N(or(c).replace(ae,""),h||0)}function Sq(c,h,b){return(b?ws(c,h,b):h===e)?h=1:h=It(h),lE(or(c),h)}function _q(){var c=arguments,h=or(c[0]);return c.length<3?h:h.replace(c[1],c[2])}var Cq=Qf(function(c,h,b){return c+(b?"_":"")+h.toLowerCase()});function Dq(c,h,b){return b&&typeof b!="number"&&ws(c,h,b)&&(h=b=e),b=b===e?J:b>>>0,b?(c=or(c),c&&(typeof h=="string"||h!=null&&!TE(h))&&(h=ii(h),!h&&oc(c))?lc(gs(c),0,b):c.split(h,b)):[]}var Fq=Qf(function(c,h,b){return c+(b?" ":"")+NE(h)});function Bq(c,h,b){return c=or(c),b=b==null?0:Sl(It(b),0,c.length),h=ii(h),c.slice(b,b+h.length)==h}function Iq(c,h,b){var P=Y.templateSettings;b&&ws(c,h,b)&&(h=e),c=or(c),h=kE({},h,P,p3);var V=kE({},h.imports,P.imports,p3),X=pn(V),Q=dp(V,X);q(X,function(ut){if(Bt.test(ut))throw new ft(i)});var ne,ce,Ce=0,De=h.interpolate||ec,Ie="__p += '",Me=vp((h.escape||ec).source+"|"+De.source+"|"+(De===ml?Sr:ec).source+"|"+(h.evaluate||ec).source+"|$","g"),Xe="//# sourceURL="+(Xt.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++$y+"]")+`
|
||
`;c.replace(Me,function(ut,Nt,qt,ai,ys,ui){return qt||(qt=ai),Ie+=c.slice(Ce,ui).replace(Xh,Hy),Nt&&(ne=!0,Ie+=`' +
|
||
__e(`+Nt+`) +
|
||
'`),ys&&(ce=!0,Ie+=`';
|
||
`+ys+`;
|
||
__p += '`),qt&&(Ie+=`' +
|
||
((__t = (`+qt+`)) == null ? '' : __t) +
|
||
'`),Ce=ui+ut.length,ut}),Ie+=`';
|
||
`;var lt=Xt.call(h,"variable")&&h.variable;if(!lt)Ie=`with (obj) {
|
||
`+Ie+`
|
||
}
|
||
`;else if(Bt.test(lt))throw new ft(o);Ie=(ce?Ie.replace(Of,""):Ie).replace(Xu,"$1").replace(Gh,"$1;"),Ie="function("+(lt||"obj")+`) {
|
||
`+(lt?"":`obj || (obj = {});
|
||
`)+"var __t, __p = ''"+(ne?", __e = _.escape":"")+(ce?`, __j = Array.prototype.join;
|
||
function print() { __p += __j.call(arguments, '') }
|
||
`:`;
|
||
`)+Ie+`return __p
|
||
}`;var xt=a8(function(){return Mt(X,Xe+"return "+Ie).apply(e,Q)});if(xt.source=Ie,RE(xt))throw xt;return xt}function $q(c){return or(c).toLowerCase()}function xq(c){return or(c).toUpperCase()}function Rq(c,h,b){if(c=or(c),c&&(b||h===e))return fp(c);if(!c||!(h=ii(h)))return c;var P=gs(c),V=gs(h),X=Em(P,V),Q=hp(P,V)+1;return lc(P,X,Q).join("")}function Tq(c,h,b){if(c=or(c),c&&(b||h===e))return c.slice(0,mp(c)+1);if(!c||!(h=ii(h)))return c;var P=gs(c),V=hp(P,gs(h))+1;return lc(P,0,V).join("")}function kq(c,h,b){if(c=or(c),c&&(b||h===e))return c.replace(ae,"");if(!c||!(h=ii(h)))return c;var P=gs(c),V=Em(P,gs(h));return lc(P,V).join("")}function Pq(c,h){var b=x,P=j;if(Cr(h)){var V="separator"in h?h.separator:V;b="length"in h?It(h.length):b,P="omission"in h?ii(h.omission):P}c=or(c);var X=c.length;if(oc(c)){var Q=gs(c);X=Q.length}if(b>=X)return c;var ne=b-Ha(P);if(ne<1)return P;var ce=Q?lc(Q,0,ne).join(""):c.slice(0,ne);if(V===e)return ce+P;if(Q&&(ne+=ce.length-ne),TE(V)){if(c.slice(ne).search(V)){var Ce,De=ce;for(V.global||(V=vp(V.source,or(Bi.exec(V))+"g")),V.lastIndex=0;Ce=V.exec(De);)var Ie=Ce.index;ce=ce.slice(0,Ie===e?ne:Ie)}}else if(c.indexOf(ii(V),ne)!=ne){var Me=ce.lastIndexOf(V);Me>-1&&(ce=ce.slice(0,Me))}return ce+P}function Oq(c){return c=or(c),c&&sr.test(c)?c.replace(Ju,Cm):c}var Nq=Qf(function(c,h,b){return c+(b?" ":"")+h.toUpperCase()}),NE=a3("toUpperCase");function o8(c,h,b){return c=or(c),h=b?e:h,h===e?My(c)?Gy(c):at(c):c.match(h)||[]}var a8=Rt(function(c,h){try{return ms(c,e,h)}catch(b){return RE(b)?b:new ft(b)}}),Lq=Ga(function(c,h){return q(h,function(b){b=oo(b),Vo(c,b,$E(c[b],c))}),c});function Uq(c){var h=c==null?0:c.length,b=ct();return c=h?ur(c,function(P){if(typeof P[1]!="function")throw new ks(s);return[b(P[0]),P[1]]}):[],Rt(function(P){for(var V=-1;++V<h;){var X=c[V];if(ms(X[0],this,P))return ms(X[1],this,P)}})}function Hq(c){return dL(xi(c,f))}function LE(c){return function(){return c}}function Mq(c,h){return c==null||c!==c?h:c}var qq=c3(),jq=c3(!0);function Ls(c){return c}function UE(c){return U5(typeof c=="function"?c:xi(c,f))}function Kq(c){return M5(xi(c,f))}function Vq(c,h){return q5(c,xi(h,f))}var Gq=Rt(function(c,h){return function(b){return Cp(b,c,h)}}),zq=Rt(function(c,h){return function(b){return Cp(c,b,h)}});function HE(c,h,b){var P=pn(h),V=Pm(h,P);b==null&&!(Cr(h)&&(V.length||!P.length))&&(b=h,h=c,c=this,V=Pm(h,pn(h)));var X=!(Cr(b)&&"chain"in b)||!!b.chain,Q=Ya(c);return q(V,function(ne){var ce=h[ne];c[ne]=ce,Q&&(c.prototype[ne]=function(){var Ce=this.__chain__;if(X||Ce){var De=c(this.__wrapped__),Ie=De.__actions__=Ps(this.__actions__);return Ie.push({func:ce,args:arguments,thisArg:c}),De.__chain__=Ce,De}return ce.apply(c,jo([this.value()],arguments))})}),c}function Yq(){return zr._===this&&(zr._=Wy),this}function ME(){}function Wq(c){return c=It(c),Rt(function(h){return j5(h,c)})}var Xq=vE(ur),Jq=vE(vl),Zq=vE(vr);function u8(c){return _E(c)?Se(oo(c)):IL(c)}function Qq(c){return function(h){return c==null?e:_l(c,h)}}var ej=f3(),tj=f3(!0);function qE(){return[]}function jE(){return!1}function rj(){return{}}function nj(){return""}function sj(){return!0}function ij(c,h){if(c=It(c),c<1||c>M)return[];var b=J,P=Vn(c,J);h=ct(h),c-=J;for(var V=lp(P,h);++b<c;)h(b);return V}function oj(c){return bt(c)?ur(c,oo):oi(c)?[c]:Ps(F3(or(c)))}function aj(c){var h=++wp;return or(c)+h}var uj=Mm(function(c,h){return c+h},0),cj=wE("ceil"),lj=Mm(function(c,h){return c/h},1),fj=wE("floor");function dj(c){return c&&c.length?km(c,Ls,nE):e}function hj(c,h){return c&&c.length?km(c,ct(h,2),nE):e}function pj(c){return ic(c,Ls)}function mj(c,h){return ic(c,ct(h,2))}function gj(c){return c&&c.length?km(c,Ls,aE):e}function vj(c,h){return c&&c.length?km(c,ct(h,2),aE):e}var wj=Mm(function(c,h){return c*h},1),yj=wE("round"),Ej=Mm(function(c,h){return c-h},0);function bj(c){return c&&c.length?cp(c,Ls):0}function Aj(c,h){return c&&c.length?cp(c,ct(h,2)):0}return Y.after=VH,Y.ary=L3,Y.assign=RM,Y.assignIn=Z3,Y.assignInWith=Q3,Y.assignWith=kE,Y.at=TM,Y.before=U3,Y.bind=$E,Y.bindAll=Lq,Y.bindKey=H3,Y.castArray=nM,Y.chain=P3,Y.chunk=dU,Y.compact=hU,Y.concat=pU,Y.cond=Uq,Y.conforms=Hq,Y.constant=LE,Y.countBy=AH,Y.create=kM,Y.curry=M3,Y.curryRight=q3,Y.debounce=j3,Y.defaults=PM,Y.defaultsDeep=OM,Y.defer=GH,Y.delay=zH,Y.difference=mU,Y.differenceBy=gU,Y.differenceWith=vU,Y.drop=wU,Y.dropRight=yU,Y.dropRightWhile=EU,Y.dropWhile=bU,Y.fill=AU,Y.filter=_H,Y.flatMap=FH,Y.flatMapDeep=BH,Y.flatMapDepth=IH,Y.flatten=x3,Y.flattenDeep=SU,Y.flattenDepth=_U,Y.flip=YH,Y.flow=qq,Y.flowRight=jq,Y.fromPairs=CU,Y.functions=jM,Y.functionsIn=KM,Y.groupBy=$H,Y.initial=FU,Y.intersection=BU,Y.intersectionBy=IU,Y.intersectionWith=$U,Y.invert=GM,Y.invertBy=zM,Y.invokeMap=RH,Y.iteratee=UE,Y.keyBy=TH,Y.keys=pn,Y.keysIn=Ns,Y.map=Ym,Y.mapKeys=WM,Y.mapValues=XM,Y.matches=Kq,Y.matchesProperty=Vq,Y.memoize=Xm,Y.merge=JM,Y.mergeWith=e8,Y.method=Gq,Y.methodOf=zq,Y.mixin=HE,Y.negate=Jm,Y.nthArg=Wq,Y.omit=ZM,Y.omitBy=QM,Y.once=WH,Y.orderBy=kH,Y.over=Xq,Y.overArgs=XH,Y.overEvery=Jq,Y.overSome=Zq,Y.partial=xE,Y.partialRight=K3,Y.partition=PH,Y.pick=eq,Y.pickBy=t8,Y.property=u8,Y.propertyOf=Qq,Y.pull=kU,Y.pullAll=T3,Y.pullAllBy=PU,Y.pullAllWith=OU,Y.pullAt=NU,Y.range=ej,Y.rangeRight=tj,Y.rearg=JH,Y.reject=LH,Y.remove=LU,Y.rest=ZH,Y.reverse=BE,Y.sampleSize=HH,Y.set=rq,Y.setWith=nq,Y.shuffle=MH,Y.slice=UU,Y.sortBy=KH,Y.sortedUniq=GU,Y.sortedUniqBy=zU,Y.split=Dq,Y.spread=QH,Y.tail=YU,Y.take=WU,Y.takeRight=XU,Y.takeRightWhile=JU,Y.takeWhile=ZU,Y.tap=hH,Y.throttle=eM,Y.thru=zm,Y.toArray=W3,Y.toPairs=r8,Y.toPairsIn=n8,Y.toPath=oj,Y.toPlainObject=J3,Y.transform=sq,Y.unary=tM,Y.union=QU,Y.unionBy=eH,Y.unionWith=tH,Y.uniq=rH,Y.uniqBy=nH,Y.uniqWith=sH,Y.unset=iq,Y.unzip=IE,Y.unzipWith=k3,Y.update=oq,Y.updateWith=aq,Y.values=rd,Y.valuesIn=uq,Y.without=iH,Y.words=o8,Y.wrap=rM,Y.xor=oH,Y.xorBy=aH,Y.xorWith=uH,Y.zip=cH,Y.zipObject=lH,Y.zipObjectDeep=fH,Y.zipWith=dH,Y.entries=r8,Y.entriesIn=n8,Y.extend=Z3,Y.extendWith=Q3,HE(Y,Y),Y.add=uj,Y.attempt=a8,Y.camelCase=dq,Y.capitalize=s8,Y.ceil=cj,Y.clamp=cq,Y.clone=sM,Y.cloneDeep=oM,Y.cloneDeepWith=aM,Y.cloneWith=iM,Y.conformsTo=uM,Y.deburr=i8,Y.defaultTo=Mq,Y.divide=lj,Y.endsWith=hq,Y.eq=ao,Y.escape=pq,Y.escapeRegExp=mq,Y.every=SH,Y.find=CH,Y.findIndex=I3,Y.findKey=NM,Y.findLast=DH,Y.findLastIndex=$3,Y.findLastKey=LM,Y.floor=fj,Y.forEach=O3,Y.forEachRight=N3,Y.forIn=UM,Y.forInRight=HM,Y.forOwn=MM,Y.forOwnRight=qM,Y.get=PE,Y.gt=cM,Y.gte=lM,Y.has=VM,Y.hasIn=OE,Y.head=R3,Y.identity=Ls,Y.includes=xH,Y.indexOf=DU,Y.inRange=lq,Y.invoke=YM,Y.isArguments=Fl,Y.isArray=bt,Y.isArrayBuffer=fM,Y.isArrayLike=Os,Y.isArrayLikeObject=Or,Y.isBoolean=dM,Y.isBuffer=fc,Y.isDate=hM,Y.isElement=pM,Y.isEmpty=mM,Y.isEqual=gM,Y.isEqualWith=vM,Y.isError=RE,Y.isFinite=wM,Y.isFunction=Ya,Y.isInteger=V3,Y.isLength=Zm,Y.isMap=G3,Y.isMatch=yM,Y.isMatchWith=EM,Y.isNaN=bM,Y.isNative=AM,Y.isNil=_M,Y.isNull=SM,Y.isNumber=z3,Y.isObject=Cr,Y.isObjectLike=Br,Y.isPlainObject=xp,Y.isRegExp=TE,Y.isSafeInteger=CM,Y.isSet=Y3,Y.isString=Qm,Y.isSymbol=oi,Y.isTypedArray=td,Y.isUndefined=DM,Y.isWeakMap=FM,Y.isWeakSet=BM,Y.join=xU,Y.kebabCase=gq,Y.last=Ti,Y.lastIndexOf=RU,Y.lowerCase=vq,Y.lowerFirst=wq,Y.lt=IM,Y.lte=$M,Y.max=dj,Y.maxBy=hj,Y.mean=pj,Y.meanBy=mj,Y.min=gj,Y.minBy=vj,Y.stubArray=qE,Y.stubFalse=jE,Y.stubObject=rj,Y.stubString=nj,Y.stubTrue=sj,Y.multiply=wj,Y.nth=TU,Y.noConflict=Yq,Y.noop=ME,Y.now=Wm,Y.pad=yq,Y.padEnd=Eq,Y.padStart=bq,Y.parseInt=Aq,Y.random=fq,Y.reduce=OH,Y.reduceRight=NH,Y.repeat=Sq,Y.replace=_q,Y.result=tq,Y.round=yj,Y.runInContext=ue,Y.sample=UH,Y.size=qH,Y.snakeCase=Cq,Y.some=jH,Y.sortedIndex=HU,Y.sortedIndexBy=MU,Y.sortedIndexOf=qU,Y.sortedLastIndex=jU,Y.sortedLastIndexBy=KU,Y.sortedLastIndexOf=VU,Y.startCase=Fq,Y.startsWith=Bq,Y.subtract=Ej,Y.sum=bj,Y.sumBy=Aj,Y.template=Iq,Y.times=ij,Y.toFinite=Wa,Y.toInteger=It,Y.toLength=X3,Y.toLower=$q,Y.toNumber=ki,Y.toSafeInteger=xM,Y.toString=or,Y.toUpper=xq,Y.trim=Rq,Y.trimEnd=Tq,Y.trimStart=kq,Y.truncate=Pq,Y.unescape=Oq,Y.uniqueId=aj,Y.upperCase=Nq,Y.upperFirst=NE,Y.each=O3,Y.eachRight=N3,Y.first=R3,HE(Y,(function(){var c={};return Go(Y,function(h,b){Xt.call(Y.prototype,b)||(c[b]=h)}),c})(),{chain:!1}),Y.VERSION=t,q(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){Y[c].placeholder=Y}),q(["drop","take"],function(c,h){Ut.prototype[c]=function(b){b=b===e?1:tn(It(b),0);var P=this.__filtered__&&!h?new Ut(this):this.clone();return P.__filtered__?P.__takeCount__=Vn(b,P.__takeCount__):P.__views__.push({size:Vn(b,J),type:c+(P.__dir__<0?"Right":"")}),P},Ut.prototype[c+"Right"]=function(b){return this.reverse()[c](b).reverse()}}),q(["filter","map","takeWhile"],function(c,h){var b=h+1,P=b==N||b==L;Ut.prototype[c]=function(V){var X=this.clone();return X.__iteratees__.push({iteratee:ct(V,3),type:b}),X.__filtered__=X.__filtered__||P,X}}),q(["head","last"],function(c,h){var b="take"+(h?"Right":"");Ut.prototype[c]=function(){return this[b](1).value()[0]}}),q(["initial","tail"],function(c,h){var b="drop"+(h?"":"Right");Ut.prototype[c]=function(){return this.__filtered__?new Ut(this):this[b](1)}}),Ut.prototype.compact=function(){return this.filter(Ls)},Ut.prototype.find=function(c){return this.filter(c).head()},Ut.prototype.findLast=function(c){return this.reverse().find(c)},Ut.prototype.invokeMap=Rt(function(c,h){return typeof c=="function"?new Ut(this):this.map(function(b){return Cp(b,c,h)})}),Ut.prototype.reject=function(c){return this.filter(Jm(ct(c)))},Ut.prototype.slice=function(c,h){c=It(c);var b=this;return b.__filtered__&&(c>0||h<0)?new Ut(b):(c<0?b=b.takeRight(-c):c&&(b=b.drop(c)),h!==e&&(h=It(h),b=h<0?b.dropRight(-h):b.take(h-c)),b)},Ut.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},Ut.prototype.toArray=function(){return this.take(J)},Go(Ut.prototype,function(c,h){var b=/^(?:filter|find|map|reject)|While$/.test(h),P=/^(?:head|last)$/.test(h),V=Y[P?"take"+(h=="last"?"Right":""):h],X=P||/^find/.test(h);V&&(Y.prototype[h]=function(){var Q=this.__wrapped__,ne=P?[1]:arguments,ce=Q instanceof Ut,Ce=ne[0],De=ce||bt(Q),Ie=function(Nt){var qt=V.apply(Y,jo([Nt],ne));return P&&Me?qt[0]:qt};De&&b&&typeof Ce=="function"&&Ce.length!=1&&(ce=De=!1);var Me=this.__chain__,Xe=!!this.__actions__.length,lt=X&&!Me,xt=ce&&!Xe;if(!X&&De){Q=xt?Q:new Ut(this);var ut=c.apply(Q,ne);return ut.__actions__.push({func:zm,args:[Ie],thisArg:e}),new $i(ut,Me)}return lt&&xt?c.apply(this,ne):(ut=this.thru(Ie),lt?P?ut.value()[0]:ut.value():ut)})}),q(["pop","push","shift","sort","splice","unshift"],function(c){var h=yl[c],b=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",P=/^(?:pop|shift)$/.test(c);Y.prototype[c]=function(){var V=arguments;if(P&&!this.__chain__){var X=this.value();return h.apply(bt(X)?X:[],V)}return this[b](function(Q){return h.apply(bt(Q)?Q:[],V)})}}),Go(Ut.prototype,function(c,h){var b=Y[h];if(b){var P=b.name+"";Xt.call(Xf,P)||(Xf[P]=[]),Xf[P].push({name:h,func:b})}}),Xf[Hm(e,y).name]=[{name:"wrapper",func:e}],Ut.prototype.clone=NN,Ut.prototype.reverse=LN,Ut.prototype.value=UN,Y.prototype.at=pH,Y.prototype.chain=mH,Y.prototype.commit=gH,Y.prototype.next=vH,Y.prototype.plant=yH,Y.prototype.reverse=EH,Y.prototype.toJSON=Y.prototype.valueOf=Y.prototype.value=bH,Y.prototype.first=Y.prototype.head,El&&(Y.prototype[El]=wH),Y}),so=gp();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(zr._=so,define(function(){return so})):Na?((Na.exports=so)._=so,np._=so):zr._=so}).call(cd)});function _z(e){if(e==null||e==="")return{};if(typeof e=="object")return e;let t=Sg(`${e}`.trim());return Object.fromEntries(t.split("&").filter(Boolean).map(r=>{let[n,...s]=r.split("=");return[Sg(LB(n).trim()),Sg(LB(s.join("=").trim()))]}))}function Cz({isNode:e,envValue:t,argument:r,customBackendName:n}={}){let s=e?Sz:UB,o=e?t:_z(r)?.[PB],i=o!=null&&`${o}`.trim()!=="",a=i?o:s,u=i?e?`env:${_g}`:`argument:${PB}`:e?"default:node":"default:non-node",l=OB(a,u),f=!l.wildcard&&l.origins.length===0?OB(s,e?"default:node":"default:non-node"):l;return e&&n&&f.source==="default:node"?{...f,allowLocalOrigins:!0}:f}function MB({isNode:e}={}){return Cz({isNode:e,envValue:e?NB(_g):void 0,argument:e?void 0:Fz(),customBackendName:e?NB("SUB_STORE_BACKEND_CUSTOM_NAME"):void 0})}function qb(e,t){if(!t||e?.wildcard)return!0;let r=jb(t);return e?.allowLocalOrigins&&Dz(r)?!0:e?.origins?.includes(r)}function qB(e,t){return e?.wildcard?{"Access-Control-Allow-Origin":ld}:!t||!qb(e,t)?{}:{"Access-Control-Allow-Origin":jb(t),Vary:"Origin"}}function jB(e){return`${(e?.wildcard?[ld]:[...e?.origins||[],...e?.allowLocalOrigins?HB.map(r=>`http://${r}:<any-port>`):[]]).join(",")} (${e?.source})`}function OB(e,t){let r=`${e}`.split(/[,,\s]+/).map(s=>s.trim()).filter(Boolean);if(r.includes(ld))return{wildcard:!0,origins:[],source:t,value:ld};let n=[...new Set(r.map(jb))];return{wildcard:!1,origins:n,source:t,value:n.join(",")}}function jb(e){let t=Sg(`${e}`.trim());if(t===ld)return ld;try{return new URL(t).origin}catch{return t}}function Dz(e){try{let t=new URL(e);return t.protocol==="http:"&&HB.includes(t.hostname)}catch{return!1}}function NB(name){try{return eval("process.env")[name]}catch{return}}function Fz(){try{if(typeof $argument<"u")return $argument}catch{return}}function LB(e){try{return decodeURIComponent(e)}catch{return e}}function Sg(e){return e.replace(/^["']|["']$/g,"")}var Whe,_g,UB,Sz,PB,ld,HB,KB=re(()=>{Whe=F(I()),_g="SUB_STORE_CORS_ALLOWED_ORIGINS",UB="https://sub-store.vercel.app,http://substore.stash,https://substore.stash,https://sub.xream.eu.org",Sz=UB,PB="cors",ld="*",HB=["localhost","127.0.0.1"]});function Kb({substore:$,port,host}){let{isNode}=hr(),corsPolicy=MB({isNode});$.info(isNode&&corsPolicy.source==="default:node"&&!corsPolicy.wildcard&&!corsPolicy.allowLocalOrigins?`[CORS] ${_g} is not set; using default allowed origins: ${corsPolicy.value}`:`[CORS] allowed origins: ${jB(corsPolicy)}`);let DEFAULT_HEADERS={"Content-Type":"text/plain;charset=UTF-8","Access-Control-Allow-Methods":"POST,GET,OPTIONS,PATCH,PUT,DELETE","Access-Control-Allow-Headers":"Origin, X-Requested-With, Content-Type, Accept","X-Powered-By":isNode&&eval("process.env.SUB_STORE_X_POWERED_BY")||"Sub-Store"};if(isNode){let express_=require("express"),bodyParser=require("body-parser"),app=express_(),limit=eval("process.env.SUB_STORE_BODY_JSON_LIMIT")||"1mb";return $.info(`[BACKEND] body JSON limit: ${limit}`),app.use((e,t,r)=>{let n=t.setHeader.bind(t);t.setHeader=function(s,o){function i(a){if(typeof a!="string")return a;if(["profile-web-page-url"].includes(s.toLowerCase()))try{return new URL(a).href}catch{return a}return a}try{return Array.isArray(o)?o=o.map(i):o=i(o),n(s,o)}catch{return console.log(`Invalid header ignored
|
||
${s}: ${o}`),this}},r()}),app.use((e,t,r)=>{let n=applyCors(e.headers?.origin,e.method);if(t.set({...DEFAULT_HEADERS,...n.headers}),!n.allowed){t.status(403).end("CORS origin not allowed");return}if(n.preflight){t.status(200).end();return}r()}),app.use(bodyParser.json({verify:rawBodySaver,limit})),app.use(bodyParser.urlencoded({verify:rawBodySaver,extended:!0})),app.use(bodyParser.raw({verify:rawBodySaver,type:"*/*"})),app.start=()=>{app.get("*",function(t,r){r.status(404).end()});let e=app.listen(port,host,()=>{let{address:t,port:r}=e.address();$.info(`[BACKEND] listening on ${t}:${r}`)})},app}let handlers=[],METHODS_NAMES=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD'","ALL"],dispatch=(e,t=0)=>{let{method:r,url:n,headers:s,body:o}=e;s=Bz(s),/json/i.test(s["content-type"])&&(o=JSON.parse(o)),r=r.toUpperCase();let{path:i,query:a}=$z(n),u=applyCors(s.origin,r);if(!u.allowed){Response().status(403).send("CORS origin not allowed");return}if(u.preflight){Response(u.headers).status(200).end();return}let l=null,f,m=0;for(f=t;f<handlers.length;f++)if(handlers[f].method==="ALL"||r===handlers[f].method){let{pattern:p}=handlers[f];Iz(p,i)&&p.split("/").length>m&&(l=handlers[f],m=p.split("/").length)}if(l){let p=()=>{dispatch(r,n,f)},d={method:r,url:n,path:i,query:a,params:VB(l.pattern,i),headers:s,body:o},v=Response(u.headers),g=l.callback,y=w=>{v.status(500).json({status:"failed",message:`Internal Server Error: ${w}`})};if(g.constructor.name==="AsyncFunction")g(d,v,p).catch(y);else try{g(d,v,p)}catch(w){y(w)}}else Response(u.headers).status(404).json({status:"failed",message:"ERROR: 404 not found"})},app={};return METHODS_NAMES.forEach(e=>{app[e.toLowerCase()]=(t,r)=>{handlers.push({method:e,pattern:t,callback:r})}}),app.route=e=>{let t={};return METHODS_NAMES.forEach(r=>{t[r.toLowerCase()]=n=>(handlers.push({method:r,pattern:e,callback:n}),t)}),t},app.start=()=>{dispatch($request)},app;function rawBodySaver(e,t,r,n){r&&r.length&&(e.rawBody=r.toString(n||"utf8"))}function Response(e={}){let t=200,{isQX:r,isLoon:n,isSurge:s,isGUIforCores:o,isEgern:i}=hr(),a={...DEFAULT_HEADERS,...e},u={200:"HTTP/1.1 200 OK",201:"HTTP/1.1 201 Created",302:"HTTP/1.1 302 Found",307:"HTTP/1.1 307 Temporary Redirect",308:"HTTP/1.1 308 Permanent Redirect",403:"HTTP/1.1 403 Forbidden",404:"HTTP/1.1 404 Not Found",500:"HTTP/1.1 500 Internal Server Error"};return new class{status(l){return t=l,this}send(l=""){let f={status:r?u[t]:t,body:l,headers:a};r||o?$done(f):(n||s||i)&&$done({response:f})}end(){this.send()}html(l){this.set("Content-Type","text/html;charset=UTF-8"),this.send(l)}json(l){this.set("Content-Type","application/json;charset=UTF-8"),this.send(JSON.stringify(l))}set(l,f){return a[l]=f,this}removeHeader(l){return delete a[l],this}}}function applyCors(e,t){let r=qb(corsPolicy,e);return{allowed:r,preflight:!!e&&r&&t?.toUpperCase()==="OPTIONS",headers:r?qB(corsPolicy,e):{}}}}function Bz(e){let t={};for(let r of Object.keys(e))t[r.toLowerCase()]=e[r];return t}function Iz(e,t){if(e instanceof RegExp&&e.test(t))return!0;if(e==="/")return!0;if(e.indexOf(":")===-1){let r=t.split("/"),n=e.split("/");for(let s=0;s<n.length;s++)if(r[s]!==n[s])return!1;return!0}else if(VB(e,t))return!0;return!1}function $z(e){let r=(e.match(/https?:\/\/[^/]+(\/[^?]*)/)||[])[1]||"/",n=e.indexOf("?"),s={};if(n!==-1){let o=e.slice(e.indexOf("?")+1).split("&");for(let i=0;i<o.length;i++){let a=o[i].split("=");s[a[0]]=decodeURIComponent(a[1])}}return{path:r,query:s}}function VB(e,t){if(e.indexOf(":")===-1)return null;{let r={};for(let n=0,s=0;n<e.length;n++,s++)if(e[n]===":"){let o=[],i=[];for(;e[++n]!=="/"&&n<e.length;)o.push(e[n]);for(;t[s]!=="/"&&s<t.length;)i.push(t[s++]);r[o.join("")]=decodeURIComponent(i.join(""))}else if(e[n]!==t[s])return null;return r}}var Qhe,GB=re(()=>{Qhe=F(I());li();KB()});function Lr(e){return Rz(xz(Tz(e)))}function xz(e){return Pz(Oz(kz(e),e.length*8))}function Rz(e){for(var t=zB?"0123456789ABCDEF":"0123456789abcdef",r="",n,s=0;s<e.length;s++)n=e.charCodeAt(s),r+=t.charAt(n>>>4&15)+t.charAt(n&15);return r}function Tz(e){for(var t="",r=-1,n,s;++r<e.length;)n=e.charCodeAt(r),s=r+1<e.length?e.charCodeAt(r+1):0,55296<=n&&n<=56319&&56320<=s&&s<=57343&&(n=65536+((n&1023)<<10)+(s&1023),r++),n<=127?t+=String.fromCharCode(n):n<=2047?t+=String.fromCharCode(192|n>>>6&31,128|n&63):n<=65535?t+=String.fromCharCode(224|n>>>12&15,128|n>>>6&63,128|n&63):n<=2097151&&(t+=String.fromCharCode(240|n>>>18&7,128|n>>>12&63,128|n>>>6&63,128|n&63));return t}function kz(e){for(var t=Array(e.length>>2),r=0;r<t.length;r++)t[r]=0;for(var r=0;r<e.length*8;r+=8)t[r>>5]|=(e.charCodeAt(r/8)&255)<<r%32;return t}function Pz(e){for(var t="",r=0;r<e.length*32;r+=8)t+=String.fromCharCode(e[r>>5]>>>r%32&255);return t}function Oz(e,t){e[t>>5]|=128<<t%32,e[(t+64>>>9<<4)+14]=t;for(var r=1732584193,n=-271733879,s=-1732584194,o=271733878,i=0;i<e.length;i+=16){var a=r,u=n,l=s,f=o;r=Yn(r,n,s,o,e[i+0],7,-680876936),o=Yn(o,r,n,s,e[i+1],12,-389564586),s=Yn(s,o,r,n,e[i+2],17,606105819),n=Yn(n,s,o,r,e[i+3],22,-1044525330),r=Yn(r,n,s,o,e[i+4],7,-176418897),o=Yn(o,r,n,s,e[i+5],12,1200080426),s=Yn(s,o,r,n,e[i+6],17,-1473231341),n=Yn(n,s,o,r,e[i+7],22,-45705983),r=Yn(r,n,s,o,e[i+8],7,1770035416),o=Yn(o,r,n,s,e[i+9],12,-1958414417),s=Yn(s,o,r,n,e[i+10],17,-42063),n=Yn(n,s,o,r,e[i+11],22,-1990404162),r=Yn(r,n,s,o,e[i+12],7,1804603682),o=Yn(o,r,n,s,e[i+13],12,-40341101),s=Yn(s,o,r,n,e[i+14],17,-1502002290),n=Yn(n,s,o,r,e[i+15],22,1236535329),r=Wn(r,n,s,o,e[i+1],5,-165796510),o=Wn(o,r,n,s,e[i+6],9,-1069501632),s=Wn(s,o,r,n,e[i+11],14,643717713),n=Wn(n,s,o,r,e[i+0],20,-373897302),r=Wn(r,n,s,o,e[i+5],5,-701558691),o=Wn(o,r,n,s,e[i+10],9,38016083),s=Wn(s,o,r,n,e[i+15],14,-660478335),n=Wn(n,s,o,r,e[i+4],20,-405537848),r=Wn(r,n,s,o,e[i+9],5,568446438),o=Wn(o,r,n,s,e[i+14],9,-1019803690),s=Wn(s,o,r,n,e[i+3],14,-187363961),n=Wn(n,s,o,r,e[i+8],20,1163531501),r=Wn(r,n,s,o,e[i+13],5,-1444681467),o=Wn(o,r,n,s,e[i+2],9,-51403784),s=Wn(s,o,r,n,e[i+7],14,1735328473),n=Wn(n,s,o,r,e[i+12],20,-1926607734),r=Xn(r,n,s,o,e[i+5],4,-378558),o=Xn(o,r,n,s,e[i+8],11,-2022574463),s=Xn(s,o,r,n,e[i+11],16,1839030562),n=Xn(n,s,o,r,e[i+14],23,-35309556),r=Xn(r,n,s,o,e[i+1],4,-1530992060),o=Xn(o,r,n,s,e[i+4],11,1272893353),s=Xn(s,o,r,n,e[i+7],16,-155497632),n=Xn(n,s,o,r,e[i+10],23,-1094730640),r=Xn(r,n,s,o,e[i+13],4,681279174),o=Xn(o,r,n,s,e[i+0],11,-358537222),s=Xn(s,o,r,n,e[i+3],16,-722521979),n=Xn(n,s,o,r,e[i+6],23,76029189),r=Xn(r,n,s,o,e[i+9],4,-640364487),o=Xn(o,r,n,s,e[i+12],11,-421815835),s=Xn(s,o,r,n,e[i+15],16,530742520),n=Xn(n,s,o,r,e[i+2],23,-995338651),r=Jn(r,n,s,o,e[i+0],6,-198630844),o=Jn(o,r,n,s,e[i+7],10,1126891415),s=Jn(s,o,r,n,e[i+14],15,-1416354905),n=Jn(n,s,o,r,e[i+5],21,-57434055),r=Jn(r,n,s,o,e[i+12],6,1700485571),o=Jn(o,r,n,s,e[i+3],10,-1894986606),s=Jn(s,o,r,n,e[i+10],15,-1051523),n=Jn(n,s,o,r,e[i+1],21,-2054922799),r=Jn(r,n,s,o,e[i+8],6,1873313359),o=Jn(o,r,n,s,e[i+15],10,-30611744),s=Jn(s,o,r,n,e[i+6],15,-1560198380),n=Jn(n,s,o,r,e[i+13],21,1309151649),r=Jn(r,n,s,o,e[i+4],6,-145523070),o=Jn(o,r,n,s,e[i+11],10,-1120210379),s=Jn(s,o,r,n,e[i+2],15,718787259),n=Jn(n,s,o,r,e[i+9],21,-343485551),r=wc(r,a),n=wc(n,u),s=wc(s,l),o=wc(o,f)}return Array(r,n,s,o)}function Cg(e,t,r,n,s,o){return wc(Nz(wc(wc(t,e),wc(n,o)),s),r)}function Yn(e,t,r,n,s,o,i){return Cg(t&r|~t&n,e,t,s,o,i)}function Wn(e,t,r,n,s,o,i){return Cg(t&n|r&~n,e,t,s,o,i)}function Xn(e,t,r,n,s,o,i){return Cg(t^r^n,e,t,s,o,i)}function Jn(e,t,r,n,s,o,i){return Cg(r^(t|~n),e,t,s,o,i)}function wc(e,t){var r=(e&65535)+(t&65535),n=(e>>16)+(t>>16)+(r>>16);return n<<16|r&65535}function Nz(e,t){return e<<t|e>>>32-t}var rpe,zB,fd=re(()=>{rpe=F(I()),zB=0});var Hp=be(Dg=>{"use strict";var spe=F(I());Object.defineProperty(Dg,"__esModule",{value:!0});Dg.AddressError=void 0;var Vb=class extends Error{constructor(t,r){super(t),this.name="AddressError",this.parseMessage=r}};Dg.AddressError=Vb});var Fg=be(Ni=>{"use strict";var ope=F(I());Object.defineProperty(Ni,"__esModule",{value:!0});Ni.isInSubnet=Lz;Ni.isHostInSubnet=Gb;Ni.isGloballyReachable=Uz;Ni.offsetBigInt=Hz;Ni.isCorrect=Mz;Ni.prefixLengthFromMask=qz;Ni.assertByteArray=jz;Ni.numberToPaddedHex=YB;Ni.stringToPaddedHex=Kz;Ni.testBit=Vz;var Tl=Hp();function Lz(e){return this.subnetMask<e.subnetMask?!1:Gb.call(this,e)}function Gb(e){return this.binaryZeroPad().length!==e.binaryZeroPad().length?!1:this.mask(e.subnetMask)===e.mask()}function Uz(e){let t=null;for(let r=0;r<e.length;r++){let n=e[r];n.reachable!==null&&Gb.call(this,n.subnet)&&(t===null||n.subnet.subnetMask>t.subnet.subnetMask)&&(t=n)}return t===null?!0:t.reachable}function Hz(e,t,r,n){if(typeof t=="number"&&!Number.isSafeInteger(t))throw new Tl.AddressError(`${n} offset must be an integer`);if(typeof t!="number"&&typeof t!="bigint")throw new Tl.AddressError(`${n} offset must be an integer`);let s=e+BigInt(t);if(s<BigInt(0)||s>(BigInt(1)<<BigInt(r))-BigInt(1))throw new Tl.AddressError(`${n} offset leaves the address space`);return s}function Mz(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}function qz(e,t){let r=e.toString(2).padStart(t,"0");if(r.length>t)throw new Tl.AddressError("Invalid subnet mask.");let n=r.indexOf("0");if(n===-1)return t;if(r.slice(n).includes("1"))throw new Tl.AddressError("Invalid subnet mask.");return n}function jz(e,t,r,n){if(e.length!==t)throw new Tl.AddressError(`${r} addresses require exactly ${t} bytes`);for(let s=0;s<e.length;s++)if(!Number.isInteger(e[s])||e[s]<n||e[s]>255)throw new Tl.AddressError(`All bytes must be integers between ${n} and 255`)}function YB(e){return e.toString(16).padStart(2,"0")}function Kz(e){return YB(parseInt(e,10))}function Vz(e,t){let{length:r}=e;if(t>=r)return!1;let n=r-t-1;return e.substring(n,n+1)==="1"}});var zb=be(Li=>{"use strict";var upe=F(I());Object.defineProperty(Li,"__esModule",{value:!0});Li.SPECIAL_PURPOSE=Li.RE_SUBNET_STRING=Li.RE_ADDRESS=Li.GROUPS=Li.BITS=void 0;Li.BITS=32;Li.GROUPS=4;Li.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/g;Li.RE_SUBNET_STRING=/\/\d{1,2}$/;Li.SPECIAL_PURPOSE=[["0.0.0.0/8","This network",!1],["0.0.0.0/32","This host on this network",!1],["10.0.0.0/8","Private-Use",!1],["100.64.0.0/10","Shared Address Space",!1],["127.0.0.0/8","Loopback",!1],["169.254.0.0/16","Link Local",!1],["172.16.0.0/12","Private-Use",!1],["192.0.0.0/24","IETF Protocol Assignments",!1],["192.0.0.0/29","IPv4 Service Continuity Prefix",!1],["192.0.0.8/32","IPv4 dummy address",!1],["192.0.0.9/32","Port Control Protocol Anycast",!0],["192.0.0.10/32","Traversal Using Relays around NAT Anycast",!0],["192.0.0.170/32","NAT64/DNS64 Discovery",!1],["192.0.0.171/32","NAT64/DNS64 Discovery",!1],["192.0.2.0/24","Documentation (TEST-NET-1)",!1],["192.31.196.0/24","AS112-v4",!0],["192.52.193.0/24","AMT",!0],["192.88.99.0/24","Deprecated (6to4 Relay Anycast)",null],["192.88.99.2/32","6a44-relay anycast address",!1],["192.168.0.0/16","Private-Use",!1],["192.175.48.0/24","Direct Delegation AS112 Service",!0],["198.18.0.0/15","Benchmarking",!1],["198.51.100.0/24","Documentation (TEST-NET-2)",!1],["203.0.113.0/24","Documentation (TEST-NET-3)",!1],["240.0.0.0/4","Reserved",!1],["255.255.255.255/32","Limited Broadcast",!1]]});var Yb=be(Qo=>{"use strict";var lpe=F(I()),Gz=Qo&&Qo.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),zz=Qo&&Qo.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),WB=Qo&&Qo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Gz(t,e,r);return zz(t,e),t};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.Address4=void 0;var fi=WB(Fg()),Dr=WB(zb()),po=Hp(),Yz=fi.isCorrect(Dr.BITS),mn=class e{constructor(t){this.addressMinusSuffix="",this.groups=Dr.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=Yz,this.isInSubnet=fi.isInSubnet,this.isHostInSubnet=fi.isHostInSubnet,this.address=t;let r=Dr.RE_SUBNET_STRING.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>Dr.BITS)throw new po.AddressError("Invalid subnet mask.");t=t.replace(Dr.RE_SUBNET_STRING,"")}let n=Dr.GROUPS*4-1;if(t.length>n)throw new po.AddressError(`IPv4 addresses are at most ${n} characters.`);this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let r=t.split(".");if(r.some(n=>/^0\d/.test(n)))throw new po.AddressError("IPv4 addresses can't have leading zeroes.");if(!t.match(Dr.RE_ADDRESS))throw new po.AddressError("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromAddressAndMask(t,r){let n=fi.prefixLengthFromMask(new e(r).bigInt(),Dr.BITS);return new e(`${t}/${n}`)}static fromAddressAndWildcardMask(t,r){let n=new e(r).bigInt(),s=(BigInt(1)<<BigInt(Dr.BITS))-BigInt(1),o=n^s,i=fi.prefixLengthFromMask(o,Dr.BITS);return new e(`${t}/${i}`)}static fromWildcard(t){let r=t.split(".");if(r.length!==Dr.GROUPS)throw new po.AddressError("Wildcard pattern must have 4 octets");let n=-1;for(let a=0;a<r.length;a++)if(r[a]==="*")n===-1&&(n=a);else if(n!==-1)throw new po.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)");let s=n===-1?0:r.length-n,o=r.map(a=>a==="*"?"0":a),i=Dr.BITS-s*8;return new e(`${o.join(".")}/${i}`)}static fromHex(t){let r=t.replace(/:/g,"");if(!/^[0-9a-fA-F]{8}$/.test(r))throw new po.AddressError("IPv4 hex must be exactly 8 hex digits");let n=[];for(let s=0;s<8;s+=2)n.push(parseInt(r.slice(s,s+2),16));return new e(n.join("."))}static fromInteger(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new po.AddressError("IPv4 integer must be in the range 0 to 2**32 - 1");return e.fromHex(t.toString(16).padStart(8,"0"))}static fromArpa(t){let r=Dr.GROUPS*4-1+3+14;if(t.length>r)throw new po.AddressError(`in-addr.arpa names are at most ${r} characters.`);let s=t.replace(/(\.in-addr\.arpa)?\.?$/i,"").split(".").reverse().join(".");return new e(s)}toHex(){return this.parsedAddress.map(t=>fi.stringToPaddedHex(t)).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r<Dr.GROUPS;r+=2)t.push(`${fi.stringToPaddedHex(this.parsedAddress[r])}${fi.stringToPaddedHex(this.parsedAddress[r+1])}`);return t.join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(t=>fi.stringToPaddedHex(t)).join("")}`)}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(Dr.BITS-this.subnetMask)}`)}startAddress(){return e.fromBigInt(this._startAddress())}startAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._startAddress()+t)}offset(t){return e.fromBigInt(fi.offsetBigInt(this.bigInt(),t,Dr.BITS,"IPv4")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(fi.offsetBigInt(this._endAddress(),1,Dr.BITS,"IPv4")).withSubnetMask(this.subnetMask)}withSubnetMask(t){return new e(`${this.correctForm()}/${t}`)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(Dr.BITS-this.subnetMask)}`)}endAddress(){return e.fromBigInt(this._endAddress())}endAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._endAddress()-t)}subnetMaskAddress(){return e.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(Dr.BITS-this.subnetMask)}`))}wildcardMask(){return e.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(Dr.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}static fromBigInt(t){if(t<BigInt(0)||t>BigInt(4294967295))throw new po.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");return e.fromHex(t.toString(16).padStart(8,"0"))}static fromByteArray(t){return fi.assertByteArray(t,4,"IPv4",0),this.fromUnsignedByteArray(t)}static fromUnsignedByteArray(t){if(t.length!==4)throw new po.AddressError("IPv4 addresses require exactly 4 bytes");let r=t.join(".");return new e(r)}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}reverseForm(t){t||(t={});let r=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?r:`${r}.in-addr.arpa.`}isMulticast(){return this.isHostInSubnet(Wz)}isPrivate(){return Xz.some(t=>this.isHostInSubnet(t))}isLoopback(){return this.isHostInSubnet(Jz)}isLinkLocal(){return this.isHostInSubnet(Zz)}isUnspecified(){return this.isHostInSubnet(Qz)}isBroadcast(){return this.isHostInSubnet(eY)}isCGNAT(){return this.isHostInSubnet(tY)}isDocumentation(){return rY.some(t=>this.isHostInSubnet(t))}isBenchmarking(){return this.isHostInSubnet(nY)}isReserved(){return this.isHostInSubnet(sY)}isGlobal(){return!this.isMulticast()&&fi.isGloballyReachable.call(this,iY)}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(Dr.BITS,"0")),this._binaryZeroPad}groupForV6(){let t=this.parsedAddress;return this.correctForm().replace(Dr.RE_ADDRESS,`<span class="hover-group group-v4 group-6">${t.slice(0,2).join(".")}</span>.<span class="hover-group group-v4 group-7">${t.slice(2,4).join(".")}</span>`)}};Qo.Address4=mn;var Wz=new mn("224.0.0.0/4"),Xz=[new mn("10.0.0.0/8"),new mn("172.16.0.0/12"),new mn("192.168.0.0/16")],Jz=new mn("127.0.0.0/8"),Zz=new mn("169.254.0.0/16"),Qz=new mn("0.0.0.0/32"),eY=new mn("255.255.255.255/32"),tY=new mn("100.64.0.0/10"),rY=[new mn("192.0.2.0/24"),new mn("198.51.100.0/24"),new mn("203.0.113.0/24")],nY=new mn("198.18.0.0/15"),sY=new mn("240.0.0.0/4"),iY=Dr.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new mn(e),reachable:t}))});var Wb=be(Er=>{"use strict";var dpe=F(I());Object.defineProperty(Er,"__esModule",{value:!0});Er.SPECIAL_PURPOSE=Er.RE_URL_WITH_PORT=Er.RE_URL=Er.RE_ZONE_STRING=Er.RE_SUBNET_STRING=Er.RE_BAD_ADDRESS=Er.RE_BAD_CHARACTERS=Er.TYPES=Er.SCOPES=Er.GROUPS=Er.BITS=void 0;Er.BITS=128;Er.GROUPS=8;Er.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};Er.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","::ffff:0:0/96":"IPv4-mapped","ff00::/8":"Multicast","fe80::/10":"Link-local unicast","fc00::/7":"Unique local","2001::/32":"Teredo","2001:2::/48":"Benchmarking","2002::/16":"6to4","2001:db8::/32":"Documentation","3fff::/20":"Documentation","100::/64":"Discard-only","fec0::/10":"Site-local unicast (deprecated)","::/96":"IPv4-compatible (deprecated)","64:ff9b::/96":"NAT64 (well-known)","64:ff9b:1::/48":"NAT64 (local-use)"};Er.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;Er.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;Er.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;Er.RE_ZONE_STRING=/%.*$/;Er.RE_URL=/^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;Er.RE_URL_WITH_PORT=/^\[([0-9a-f:.]+)\]:([0-9]{1,5})(?:[/?#].*)?$/i;Er.SPECIAL_PURPOSE=[["::1/128","Loopback Address",!1],["::/128","Unspecified Address",!1],["::ffff:0:0/96","IPv4-mapped Address",!1],["64:ff9b::/96","IPv4-IPv6 Translat.",!0],["64:ff9b:1::/48","IPv4-IPv6 Translat.",!1],["100::/64","Discard-Only Address Block",!1],["100:0:0:1::/64","Dummy IPv6 Prefix",!1],["2001::/23","IETF Protocol Assignments",!1],["2001::/32","TEREDO",!1],["2001:1::1/128","Port Control Protocol Anycast",!0],["2001:1::2/128","Traversal Using Relays around NAT Anycast",!0],["2001:1::3/128","DNS-SD Service Registration Protocol Anycast",!0],["2001:2::/48","Benchmarking",!1],["2001:3::/32","AMT",!0],["2001:4:112::/48","AS112-v6",!0],["2001:10::/28","Deprecated (previously ORCHID)",null],["2001:20::/28","ORCHIDv2",!0],["2001:30::/28","Drone Remote ID Protocol Entity Tags (DETs) Prefix",!0],["2001:db8::/32","Documentation",!1],["2002::/16","6to4",!1],["2620:4f:8000::/48","Direct Delegation AS112 Service",!0],["3fff::/20","Documentation",!1],["5f00::/16","Segment Routing (SRv6) SIDs",!1],["fc00::/7","Unique-Local",!1],["fe80::/10","Link-Local Unicast",!1]]});var Xb=be(kl=>{"use strict";var ppe=F(I());Object.defineProperty(kl,"__esModule",{value:!0});kl.escapeHtml=Bg;kl.spanAllZeroes=XB;kl.spanAll=oY;kl.spanLeadingZeroes=aY;kl.simpleGroup=uY;function Bg(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function XB(e){return Bg(e).replace(/(0+)/g,'<span class="zero">$1</span>')}function oY(e,t=0){return e.split("").map((n,s)=>`<span class="digit value-${Bg(n)} position-${s+t}">${XB(n)}</span>`).join("")}function JB(e){return Bg(e).replace(/^(0+)/,'<span class="zero">$1</span>')}function aY(e){return e.split(":").map(r=>JB(r)).join(":")}function uY(e,t=0){return e.split(":").map((n,s)=>/group-v4/.test(n)?n:`<span class="hover-group group-${s+t}">${JB(n)}</span>`)}});var ZB=be(Hs=>{"use strict";var gpe=F(I()),cY=Hs&&Hs.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),lY=Hs&&Hs.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),fY=Hs&&Hs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&cY(t,e,r);return lY(t,e),t};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.ADDRESS_BOUNDARY=void 0;Hs.groupPossibilities=$g;Hs.padGroup=Ig;Hs.simpleRegularExpression=hY;Hs.possibleElisions=pY;var dY=fY(Wb());function $g(e){return`(${e.join("|")})`}function Ig(e){return e.length<4?`0{0,${4-e.length}}${e}`:e}Hs.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function hY(e){let t=[];e.forEach((n,s)=>{parseInt(n,16)===0&&t.push(s)});let r=t.map(n=>e.map((s,o)=>{if(o===n){let i=o===0||o===dY.GROUPS-1?":":"";return $g([Ig(s),i])}return Ig(s)}).join(":"));return r.push(e.map(Ig).join(":")),$g(r)}function pY(e,t,r){let n=t?"":":",s=r?"":":",o=[];!t&&!r&&o.push("::"),t&&r&&o.push(""),(r&&!t||!r&&t)&&o.push(":"),o.push(`${n}(:0{1,4}){1,${e-1}}`),o.push(`(0{1,4}:){1,${e-1}}${s}`),o.push(`(0{1,4}:){${e-1}}0{1,4}`);for(let i=1;i<e-1;i++)for(let a=1;a<e-i;a++)o.push(`(0{1,4}:){${a}}:(0{1,4}:){${e-a-i-1}}0{1,4}`);return $g(o)}});var rI=be(ra=>{"use strict";var wpe=F(I()),mY=ra&&ra.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),gY=ra&&ra.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Tg=ra&&ra.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&mY(t,e,r);return gY(t,e),t};Object.defineProperty(ra,"__esModule",{value:!0});ra.Address6=void 0;var ta=Tg(Fg()),Jb=Tg(zb()),kt=Tg(Wb()),Pl=Tg(Xb()),ea=Yb(),Ol=ZB(),gn=Hp(),xg=Fg(),vY=ta.isCorrect(kt.BITS);function Rg(e){if(!e)throw new Error("Assertion failed.")}function wY(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function yY(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),e=e.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),e}function EY(e,t){let r=[],n=[],s;for(s=0;s<e.length;s++)s<t[0]?r.push(e[s]):s>t[1]&&n.push(e[s]);return r.concat(["compact"]).concat(n)}function QB(e){return parseInt(e,16).toString(16).padStart(4,"0")}function eI(e){return e&255}var Zn=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=ta.isInSubnet,this.isHostInSubnet=ta.isHostInSubnet,this.isCorrect=vY,r===void 0?this.groups=kt.GROUPS:this.groups=r,this.address=t;let n=kt.RE_SUBNET_STRING.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>kt.BITS)throw new gn.AddressError("Invalid subnet mask.");t=t.replace(kt.RE_SUBNET_STRING,"")}if(/\//.test(t))throw new gn.AddressError("Invalid subnet mask.");let s=t.indexOf("%");s!==-1&&/^.*$/.test(t.slice(s))&&(this.zone=t.slice(s),t=t.slice(0,s));let o=this.groups*5+5;if(t.length>o)throw new gn.AddressError(`IPv6 addresses are at most ${o} characters.`);this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInt(t){if(t<BigInt(0)||t>(BigInt(1)<<BigInt(kt.BITS))-BigInt(1))throw new gn.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");let r=t.toString(16).padStart(32,"0"),n=[];for(let s=0;s<kt.GROUPS;s++)n.push(r.slice(s*4,(s+1)*4));return new e(n.join(":"))}static fromURL(t){var r;let n,s=null,o,i,a=t.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"");if(a.indexOf("[")!==-1&&a.indexOf("]:")!==-1){if(i="failed to parse address with port",o=kt.RE_URL_WITH_PORT.exec(a),o===null)return{error:i,address:null,port:null};n=o[1],s=o[2]}else{if(i="failed to parse address from URL",o=kt.RE_URL.exec(a),o===null)return{error:i,address:null,port:null};n=(r=o[1])!==null&&r!==void 0?r:o[2]}s?(s=parseInt(s,10),(s<0||s>65535)&&(s=null)):s=null;let u;try{u=new e(n)}catch{return{error:i,address:null,port:null}}return{address:u,port:s}}static fromAddressAndMask(t,r){let n=ta.prefixLengthFromMask(new e(r).bigInt(),kt.BITS);return new e(`${t}/${n}`)}static fromAddressAndWildcardMask(t,r){let n=new e(r).bigInt(),s=(BigInt(1)<<BigInt(kt.BITS))-BigInt(1),o=n^s,i=ta.prefixLengthFromMask(o,kt.BITS);return new e(`${t}/${i}`)}static fromWildcard(t){if(t.includes("%")||t.includes("/"))throw new gn.AddressError("Wildcard pattern must not include a zone or CIDR suffix");let r=t.split("::");if(r.length>2)throw new gn.AddressError("Wildcard pattern cannot contain more than one '::'");let n;if(r.length===2){let u=r[0]===""?[]:r[0].split(":"),l=r[1]===""?[]:r[1].split(":"),f=kt.GROUPS-u.length-l.length;if(f<1)throw new gn.AddressError("Wildcard pattern with '::' has too many groups");n=[...u,...new Array(f).fill("0"),...l]}else n=t.split(":");if(n.length!==kt.GROUPS)throw new gn.AddressError("Wildcard pattern must have 8 groups");let s=-1;for(let u=0;u<n.length;u++)if(n[u]==="*")s===-1&&(s=u);else if(s!==-1)throw new gn.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)");let o=s===-1?0:n.length-s,i=n.map(u=>u==="*"?"0":u),a=kt.BITS-o*16;return new e(`${i.join(":")}/${a}`)}static fromAddress4(t){let r=new ea.Address4(t),n=kt.BITS-(Jb.BITS-r.subnetMask);return new e(`::ffff:${r.correctForm()}/${n}`)}static fromArpa(t){let r=t.replace(/(\.ip6\.arpa)?\.?$/i,"");if(!/^[0-9a-f](\.[0-9a-f]){0,31}$/i.test(r))throw new gn.AddressError("Invalid 'ip6.arpa' form.");let n=r.split(".").reverse(),s=n.length*4,o=n.join("").padEnd(32,"0"),i=[];for(let a=0;a<kt.GROUPS;a++)i.push(o.slice(a*4,(a+1)*4));return new e(`${i.join(":")}/${s}`)}microsoftTranscription(){return`${this.correctForm().replace(/:/g,"-")}.ipv6-literal.net`}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=kt.BITS-this.subnetMask,n=Math.abs(t-kt.BITS),s=r-n;return s<0?"0":wY((BigInt("2")**BigInt(s)).toString(10))}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(kt.BITS-this.subnetMask)}`)}startAddress(){return e.fromBigInt(this._startAddress())}startAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._startAddress()+t)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(kt.BITS-this.subnetMask)}`)}endAddress(){return e.fromBigInt(this._endAddress())}endAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._endAddress()-t)}offset(t){return e.fromBigInt(ta.offsetBigInt(this.bigInt(),t,kt.BITS,"IPv6")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(ta.offsetBigInt(this._endAddress(),1,kt.BITS,"IPv6")).withSubnetMask(this.subnetMask)}withSubnetMask(t){return new e(`${this.correctForm()}/${t}`)}subnetMaskAddress(){return e.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(kt.BITS-this.subnetMask)}`))}wildcardMask(){return e.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(kt.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}getScope(){let t=this.getType();return t==="Multicast"||t.startsWith("Multicast ")?kt.SCOPES[parseInt(this.getBits(12,16).toString(10),10)]||"Unknown":t==="Link-local unicast"||t==="Loopback"?"Link local":t==="Unspecified"?"Unknown":"Global"}getType(){for(let t=0;t<tI.length;t++){let r=tI[t];if(this.isHostInSubnet(r[0]))return r[1]}return"Global unicast"}getBits(t,r){return BigInt(`0b${this.getBitsBase2(t,r)}`)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}getBitsBase16(t,r){let n=r-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,r).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,kt.BITS)}reverseForm(t){t||(t={});let r=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?t.omitSuffix?n:`${n}.ip6.arpa.`:t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,s=[];for(t=0;t<this.parsedAddress.length;t++){let a=parseInt(this.parsedAddress[t],16);a===0&&n++,a!==0&&n>0&&(n>1&&s.push([t-n,t-1]),n=0)}n>1&&s.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let o=s.map(a=>a[1]-a[0]+1);if(s.length>0){let a=o.indexOf(Math.max(...o));r=EY(this.parsedAddress,s[a])}else r=this.parsedAddress;for(t=0;t<r.length;t++)r[t]!=="compact"&&(r[t]=parseInt(r[t],16).toString(16));let i=r.join(":");return i=i.replace(/^compact$/,"::"),i=i.replace(/(^compact)|(compact$)/,":"),i=i.replace(/compact/,""),i}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(kt.BITS,"0")),this._binaryZeroPad}parse4in6(t){if(t.indexOf(".")===-1)return t;let r=t.split(":"),n=r.slice(-1)[0],s=n.split(".");if(s.length===Jb.GROUPS&&s.every(i=>/^\d{1,3}$/.test(i))&&s.some(i=>/^0\d/.test(i))){let i=s.map(yY).join("."),a=r.slice(0,-1).map(Pl.escapeHtml).join(":"),u=r.length>1?":":"";throw new gn.AddressError("IPv4 addresses can't have leading zeroes.",`${a}${u}${i}`)}let o=n.match(Jb.RE_ADDRESS);if(o){this.parsedAddress4=o[0];let i=this.subnetMask>=96?`/${this.subnetMask-96}`:"";this.address4=new ea.Address4(`${this.parsedAddress4}${i}`),this.v4=!0,r[r.length-1]=this.address4.toGroup6(),t=r.join(":")}return t}parse(t){t=this.parse4in6(t);let r=t.match(kt.RE_BAD_CHARACTERS);if(r)throw new gn.AddressError(`Bad character${r.length>1?"s":""} detected in address: ${r.join("")}`,t.replace(kt.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));let n=t.match(kt.RE_BAD_ADDRESS);if(n)throw new gn.AddressError(`Address failed regex: ${n.join("")}`,t.replace(kt.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let s=[],o=t.split("::");if(o.length===2){let i=o[0].split(":"),a=o[1].split(":");i.length===1&&i[0]===""&&(i=[]),a.length===1&&a[0]===""&&(a=[]);let u=this.groups-(i.length+a.length);if(!u)throw new gn.AddressError("Error parsing groups");this.elidedGroups=u,this.elisionBegin=i.length,this.elisionEnd=i.length+this.elidedGroups,s=s.concat(i);for(let l=0;l<u;l++)s.push("0");s=s.concat(a)}else if(o.length===1)s=t.split(":"),this.elidedGroups=0;else throw new gn.AddressError("Too many :: groups found");if(s=s.map(i=>parseInt(i,16).toString(16)),s.length!==this.groups)throw new gn.AddressError("Incorrect number of groups found");return s}canonicalForm(){return this.parsedAddress.map(QB).join(":")}decimal(){return this.parsedAddress.map(t=>parseInt(t,16).toString(10).padStart(5,"0")).join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(QB).join("")}`)}to4(){let t=this.binaryZeroPad().split(""),r=BigInt(`0b${t.slice(96,128).join("")}`).toString(16).padStart(8,"0");if(this.subnetMask>=96){let n=this.subnetMask-96,s=[];for(let o=0;o<8;o+=2)s.push(parseInt(r.slice(o,o+2),16));return new ea.Address4(`${s.join(".")}/${n}`)}return ea.Address4.fromHex(r)}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),s="";return/:$/.test(n)||(s=":"),n+s+t.correctForm()}inspectTeredo(){let t=this.getBitsBase16(0,32),n=(this.getBits(80,96)^BigInt("0xffff")).toString(),s=ea.Address4.fromHex(this.getBitsBase16(32,64)),o=this.getBits(96,128),i=ea.Address4.fromHex((o^BigInt("0xffffffff")).toString(16).padStart(8,"0")),a=this.getBitsBase2(64,80),u=(0,xg.testBit)(a,15),l=(0,xg.testBit)(a,14),f=(0,xg.testBit)(a,8),m=(0,xg.testBit)(a,9),p=BigInt(`0b${a.slice(2,6)+a.slice(8,16)}`).toString(10);return{prefix:`${t.slice(0,4)}:${t.slice(4,8)}`,server4:s.address,client4:i.address,flags:a,coneNat:u,microsoft:{reserved:l,universalLocal:m,groupIndividual:f,nonce:p},udpPort:n}}inspect6to4(){let t=this.getBitsBase16(0,16),r=ea.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:t.slice(0,4),gateway:r.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new e(t)}static fromAddress4Nat64(t,r="64:ff9b::/96"){let n=new ea.Address4(t),s=new e(r),o=s.subnetMask;if(o!==32&&o!==40&&o!==48&&o!==56&&o!==64&&o!==96)throw new gn.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");let i=s.binaryZeroPad(),a=n.binaryZeroPad(),u;if(o===96)u=i.slice(0,96)+a;else{let m=64-o;u=[i.slice(0,o),a.slice(0,m),"00000000",a.slice(m),"0".repeat(56-(32-m))].join("")}let l=BigInt(`0b${u}`).toString(16).padStart(32,"0"),f=[];for(let m=0;m<8;m++)f.push(l.slice(m*4,(m+1)*4));return new e(f.join(":"))}toAddress4Nat64(t="64:ff9b::/96"){let r=new e(t),n=r.subnetMask;if(n!==32&&n!==40&&n!==48&&n!==56&&n!==64&&n!==96)throw new gn.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");if(!this.isHostInSubnet(r))return null;let s=this.binaryZeroPad(),o;if(n===96)o=s.slice(96,128);else{let a=64-n;o=s.slice(n,n+a)+s.slice(72,72+(32-a))}let i=[];for(let a=0;a<4;a++)i.push(parseInt(o.slice(a*8,(a+1)*8),2).toString());return new ea.Address4(i.join("."))}toByteArray(){let t=this.bigInt().toString(16).padStart(kt.BITS/4,"0"),r=[];for(let n=0,s=t.length;n<s;n+=2)r.push(parseInt(t.substring(n,n+2),16));return r}toUnsignedByteArray(){return this.toByteArray().map(eI)}static fromByteArray(t){return ta.assertByteArray(t,16,"IPv6",-128),this.fromUnsignedByteArray(t.map(eI))}static fromUnsignedByteArray(t){ta.assertByteArray(t,16,"IPv6",0);let r=BigInt("256"),n=BigInt("0"),s=BigInt("1");for(let o=t.length-1;o>=0;o--)n+=s*BigInt(t[o].toString(10)),s*=r;return e.fromBigInt(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){let t=this.embeddedIPv4();return t?t.isLinkLocal():this.isHostInSubnet(_Y)}isMulticast(){let t=this.embeddedIPv4();if(t)return t.isMulticast();let r=this.getType();return r==="Multicast"||r.startsWith("Multicast ")}is4(){return this.v4}isMapped4(){return this.isHostInSubnet(IY)}embeddedIPv4(){return this.isMapped4()||this.isHostInSubnet($Y)?this.to4():null}isTeredo(){return this.isHostInSubnet(bY)}is6to4(){return this.isHostInSubnet(AY)}isLoopback(){let t=this.embeddedIPv4();return t?t.isLoopback():this.getType()==="Loopback"}isULA(){return this.isHostInSubnet(SY)}isPrivate(){let t=this.embeddedIPv4();return t?t.isPrivate():this.isULA()||this.isHostInSubnet(xY)}isCGNAT(){let t=this.embeddedIPv4();return t?t.isCGNAT():!1}isBroadcast(){let t=this.embeddedIPv4();return t?t.isBroadcast():!1}isUnspecified(){let t=this.embeddedIPv4();return t?t.isUnspecified():this.getType()==="Unspecified"}isDocumentation(){return CY.some(t=>this.isHostInSubnet(t))}isBenchmarking(){let t=this.embeddedIPv4();return t?t.isBenchmarking():this.isHostInSubnet(DY)}isGlobal(){let t=this.embeddedIPv4();return t?t.isGlobal():this.isHostInSubnet(FY)&&ta.isGloballyReachable.call(this,BY)}href(t){return t===void 0?t="":t=`:${t}`,`http://[${this.correctForm()}]${t}/`}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let r=this.correctForm;t.v4&&(r=this.to4in6);let n=r.call(this),s=Pl.escapeHtml(`${t.prefix}${n}`),o=Pl.escapeHtml(n);if(t.className){let i=Pl.escapeHtml(t.className);return`<a href="${s}" class="${i}">${o}</a>`}return`<a href="${s}">${o}</a>`}group(){if(this.elidedGroups===0)return Pl.simpleGroup(this.addressMinusSuffix).join(":");Rg(typeof this.elidedGroups=="number"),Rg(typeof this.elisionBegin=="number");let t=[],[r,n]=this.addressMinusSuffix.split("::");r.length?t.push(...Pl.simpleGroup(r)):t.push("");let s=["hover-group"];for(let o=this.elisionBegin;o<this.elisionBegin+this.elidedGroups;o++)s.push(`group-${o}`);return t.push(`<span class="${s.join(" ")}"></span>`),n.length?t.push(...Pl.simpleGroup(n,this.elisionEnd)):t.push(""),this.is4()&&(Rg(this.address4 instanceof ea.Address4),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let r=[],n=new e(this.correctForm());if(n.elidedGroups===0)r.push((0,Ol.simpleRegularExpression)(n.parsedAddress));else if(n.elidedGroups===kt.GROUPS)r.push((0,Ol.possibleElisions)(kt.GROUPS));else{let s=n.address.split("::");s[0].length&&r.push((0,Ol.simpleRegularExpression)(s[0].split(":"))),Rg(typeof n.elidedGroups=="number"),r.push((0,Ol.possibleElisions)(n.elidedGroups,s[0].length!==0,s[1].length!==0)),s[1].length&&r.push((0,Ol.simpleRegularExpression)(s[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Ol.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Ol.ADDRESS_BOUNDARY,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};ra.Address6=Zn;var tI=Object.keys(kt.TYPES).map(e=>[new Zn(e),kt.TYPES[e]]),bY=new Zn("2001::/32"),AY=new Zn("2002::/16"),SY=new Zn("fc00::/7"),_Y=new Zn("fe80::/10"),CY=[new Zn("2001:db8::/32"),new Zn("3fff::/20")],DY=new Zn("2001:2::/48"),FY=new Zn("2000::/3"),BY=kt.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new Zn(e),reachable:t})),IY=new Zn("::ffff:0:0/96"),$Y=new Zn("64:ff9b::/96"),xY=new Zn("64:ff9b:1::/48")});var nI=be(Qn=>{"use strict";var Epe=F(I()),RY=Qn&&Qn.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),TY=Qn&&Qn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),kY=Qn&&Qn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&RY(t,e,r);return TY(t,e),t};Object.defineProperty(Qn,"__esModule",{value:!0});Qn.v6=Qn.AddressError=Qn.Address6=Qn.Address4=void 0;var PY=Yb();Object.defineProperty(Qn,"Address4",{enumerable:!0,get:function(){return PY.Address4}});var OY=rI();Object.defineProperty(Qn,"Address6",{enumerable:!0,get:function(){return OY.Address6}});var NY=Hp();Object.defineProperty(Qn,"AddressError",{enumerable:!0,get:function(){return NY.AddressError}});var LY=kY(Xb());Qn.v6={helpers:LY}});function Ur(e){return UY.test(e)}function lr(e){return HY.test(e)}function sI(e){return/^((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([0-5]{0,5})|([0-9]{1,4}))$/.test(e)}function Ge(e){return typeof e=="string"&&e.trim().length>0}function Dt(e,t){return Ge(e)?e:t}function dd(e){return typeof e<"u"&&e!==null}function eu(e,t){return dd(e)?e:t}function tu(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function MY(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function Mp(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,s]=r.split("-").map(Number);return MY(n,s)}else return Number(r)}function iI(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function Pg(e){return typeof e=="string"&&/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}function yc(e,t="YYYY-MM-DD_HH-mm-ss"){let r=e instanceof Date?e:new Date(e);if(isNaN(r.getTime()))return"";let n=o=>String(o).padStart(2,"0"),s={YYYY:r.getFullYear(),MM:n(r.getMonth()+1),DD:n(r.getDate()),HH:n(r.getHours()),mm:n(r.getMinutes()),ss:n(r.getSeconds())};return t.replace(/YYYY|MM|DD|HH|mm|ss/g,o=>s[o])}function Ze(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}var Ape,kg,UY,HY,Ir=re(()=>{Ape=F(I()),kg=F(nI()),UY=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,HY=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/});function Zb(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function jY(){let t=(R.read(pt)||{})?.resourceCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:36e5}var Dpe,Qb,Hr,Og=re(()=>{Dpe=F(I());gt();dr();Qb=class{constructor(){R.read($l)||R.write("{}",$l);try{this.resourceCache=JSON.parse(R.read($l))}catch(t){R.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${$l} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},R.write("{}",$l)}this._cleanup()}_cleanup(t,r){let n=Zb(r)??0,s=!1,o=Date.now();Object.entries(this.resourceCache).forEach(i=>{let[a,u]=i;(!u.time||u.time<o+n)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],s=!0)}),s&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){R.write(JSON.stringify(this.resourceCache),$l)}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()<=r?this.resourceCache[t].time:null}get(t,r,n){let s=Zb(r)??0,o=this.resourceCache[t],i=o&&o.time;if(i){if(Date.now()+s<=i)return o.data;n&&(delete this.resourceCache[t],this._persist())}return null}set(t,r,n){let s=Zb(n)??jY();this.resourceCache[t]={time:Date.now()+s,data:r},this._persist()}};Hr=new Qb});function eA(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function VY(){let t=(R.read(pt)||{})?.headersCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:6e4}var $pe,tA,Nl,Ng=re(()=>{$pe=F(I());gt();dr();tA=class{constructor(){R.read(xl)||R.write("{}",xl);try{this.resourceCache=JSON.parse(R.read(xl))}catch(t){R.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${xl} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},R.write("{}",xl)}this._cleanup()}_cleanup(t,r){let n=eA(r)??0,s=!1,o=Date.now();Object.entries(this.resourceCache).forEach(i=>{let[a,u]=i;(!u.time||u.time<o+n)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],s=!0)}),s&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){R.write(JSON.stringify(this.resourceCache),xl)}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()<=r?this.resourceCache[t].time:null}get(t,r,n){let s=eA(r)??0,o=this.resourceCache[t],i=o&&o.time;if(i){if(Date.now()+s<=i)return o.data;n&&(delete this.resourceCache[t],this._persist())}return null}set(t,r,n){let s=eA(n)??VY();this.resourceCache[t]={time:Date.now()+s,data:r},this._persist()}};Nl=new tA});function GY(e){return new Promise(t=>setTimeout(t,e))}function zY(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return oI;let t=Number(e);return!Number.isInteger(t)||t<1?oI:t}function YY(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return aI;let t=Number(e);return!Number.isInteger(t)||t<0?aI:t}function rA(){let e=R.read(pt)||{};return zY(e[jp])}function nA(){let e=R.read(pt)||{};return YY(e[Kp])}function WY(e,t){return`active=${qp}, pending=${sA.length}, limit=${e}, waitTime=${t}ms`}function Lg(e,t,r,n){R.log(`[Backend Request Concurrency] ${e}: ${t} (${WY(r,n)})`)}function XY(){let e=sA.shift();e&&e()}async function JY(e){let t=rA(),r=nA();for(;qp>=t;)Lg("queued",e,t,r),await new Promise(n=>{sA.push(n)}),t=rA(),r=nA();qp+=1,Lg("acquired",e,t,r),r>0&&(Lg("waiting before request",e,t,r),await GY(r))}function ZY(e){qp=Math.max(0,qp-1),Lg("released",e,rA(),nA()),XY()}async function hd(e,t="request"){await JY(t);try{return await e()}finally{ZY(t)}}var kpe,oI,jp,aI,Kp,qp,sA,Ug=re(()=>{kpe=F(I());dr();gt();oI=10,jp="backendRequestConcurrency",aI=0,Kp="backendRequestConcurrencyWaitTime",qp=0,sA=[]});function Ll(e){let t=Object.keys(e),r="",n="",s="";for(let o of t){let i=o.toLowerCase();i==="subscription-userinfo"?r=e[o]:i==="profile-web-page-url"?n=e[o]:i==="plan-name"&&(s=e[o])}return`${r||""}${n?`; app_url=${encodeURIComponent(n)}`:""}${s?`; plan_name=${encodeURIComponent(s)}`:""}`}async function es(rawUrl,ua,timeout,customProxy,flowUrl,flowHeaders){let url=flowUrl||rawUrl||"",$arguments={},rawArgs=url.split("#");if(url=url.split("#")[0],rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}if($arguments?.noFlow||!/^https?/.test(url))return;let{isStash,isLoon,isShadowRocket,isQX}=hr(),insecure=$arguments?.insecure?R.env.isNode?{strictSSL:!1}:{insecure:!0}:void 0,{defaultProxy,defaultFlowUserAgent,defaultTimeout}=R.read(pt)||{},proxy=customProxy||defaultProxy;R.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultFlowUserAgent||"clash.meta/v1.19.34",requestTimeout=timeout||defaultTimeout||8e3,customHeaders,customHeadersArg=flowHeaders||$arguments?.flowHeaders||$arguments?.headers;if(customHeadersArg)try{let e=typeof customHeadersArg=="string"?JSON.parse(customHeadersArg):customHeadersArg;if(e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0){let t={"user-agent":userAgent};for(let r in e)t[r.toLowerCase()]=e[r];customHeaders=t}}catch(e){R.error(`\u89E3\u6790\u81EA\u5B9A\u4E49 ${flowHeaders||$arguments?.flowHeaders?"flowHeaders":"headers"} \u5931\u8D25: ${e}`)}let id=Lr(`${customHeaders?JSON.stringify(customHeaders):userAgent}${url}`),cached=Nl.get(id),flowInfo;if(!$arguments?.noCache&&cached)R.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${customHeaders?JSON.stringify(customHeaders):userAgent}`),flowInfo=cached;else{let e=Oi();if(flowUrl){let t;try{R.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u4F53\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:r,body:n,statusCode:s}=await hd(()=>e.get({url,headers:customHeaders||{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?tu(proxy):{},...insecure||{}}),"flow body GET");if(s<200||s>=400)throw new Error(`statusCode: ${s}`);t=r;let o=ru(n);if(Number.isFinite(o?.total)&&Number.isFinite(o?.usage?.download)&&Number.isFinite(o?.usage?.upload))flowInfo=n;else throw new Error("\u54CD\u5E94\u4F53\u4E2D\u672A\u5305\u542B\u5408\u6CD5\u7684\u6D41\u91CF\u4FE1\u606F")}catch(r){if(R.error(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u4F53\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${r.message??r}`),t)try{let n=Ll(t),s=ru(n);if(Number.isFinite(s?.total)&&Number.isFinite(s?.usage?.download)&&Number.isFinite(s?.usage?.upload))R.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u6210\u529F: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`),flowInfo=n;else throw new Error("\u54CD\u5E94\u4F53\u4E2D\u672A\u5305\u542B\u5408\u6CD5\u7684\u6D41\u91CF\u4FE1\u606F")}catch(n){R.error(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${n.message??n}`)}}}else{try{R.info(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await hd(()=>e.head({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{...customHeaders||{"User-Agent":userAgent},...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?tu(proxy):{},...insecure||{}}),"flow headers HEAD");flowInfo=Ll(t)}catch(t){R.error(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${url}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${t.message??t}`)}if(!flowInfo){R.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await hd(()=>e.get({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{...customHeaders||{"User-Agent":userAgent},...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?tu(proxy):{},...insecure||{}}),"flow headers GET");flowInfo=Ll(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&Nl.set(id,flowInfo,$arguments?.headersCacheTtl?$arguments?.headersCacheTtl*1e3:void 0)}return flowInfo}function ru(e){if(!e)return;let t=e.match(/upload=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),r=t==null?0:Number(t[1]+t[2]),n=e.match(/download=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),s=Number(n[1]+n[2]),o=e.match(/total=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),i=Number(o[1]+o[2]),a=e.match(/expire=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),u=a?Number(a[1]+a[2]):void 0,l=e.match(/reset_day=([0-9]+)/),f=l?Number(l[1]):void 0,m=e.match(/app_url=(.*?)\s*?(;|$)/),p=m?decodeURIComponent(m[1]):void 0,d=e.match(/plan_name=(.*?)\s*?(;|$)/),v=d?decodeURIComponent(d[1]):void 0;return{expires:u,total:i,usage:{upload:r,download:s},remainingDays:f,appUrl:p,planName:v}}function Vp(e,t="B"){let r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=r.indexOf(t);return e<1024||n===r.length-1?{value:(Math.round(e*100)/100).toString(),unit:t}:Vp(e/1024,r[++n])}function Hg(e){if(!e)throw new Error("\u6CA1\u6709\u6D41\u91CF\u4FE1\u606F");if(e?.expires&&e.expires*1e3<Date.now()){let t=new Date(e.expires*1e3).toLocaleDateString();throw new Error(`\u8BA2\u9605\u5DF2\u8FC7\u671F: ${t}`)}if(e?.total){let t=e.usage?.upload||0,r=e.usage?.download||0;if(e.total-t-r<=0){let n=t+r,s=Vp(Math.abs(n));s.value=n<0?"-"+s.value:s.value;let o=Vp(e.total);throw new Error(`\u6D41\u91CF\u5DF2\u7528\u5B8C: ${s.value} ${s.unit} / ${o.value} ${o.unit}`)}}}function Mg(e={}){try{let{resetDay:t,startDate:r,cycleDays:n}=e;if(["string","number"].includes(typeof e)&&(t=e),r&&n){if(n=parseInt(n),isNaN(n)||n<=0)throw new Error("\u91CD\u7F6E\u5468\u671F\u5E94\u4E3A\u6B63\u6574\u6570");if(!r||!Date.parse(r))throw new Error("\u5F00\u59CB\u65E5\u671F\u4E0D\u5408\u6CD5");let s=new Date(r),o=new Date;if(s.setHours(0,0,0,0),o.setHours(0,0,0,0),s.getTime()>o.getTime())throw new Error("\u5F00\u59CB\u65E5\u671F\u5E94\u65E9\u4E8E\u73B0\u5728");let i=new Date(r);for(i.setDate(i.getDate()+n);i<o;)i.setDate(i.getDate()+n);i.setHours(0,0,0,0);let a=i.getTime()-o.getTime();return Math.ceil(a/(1e3*3600*24))}else{if(!t)return;if(t=parseInt(t),isNaN(t)||t<=0||t>31)throw new Error("\u6708\u91CD\u7F6E\u65E5\u5E94\u4E3A 1-31 \u4E4B\u95F4\u7684\u6574\u6570");let s=new Date,o=s.getDate(),i=s.getMonth(),a=s.getFullYear(),u;return t>o?u=0:u=new Date(a,i+1,0).getDate(),u-o+t}}catch(t){R.error(`getRmainingDays failed: ${t.message??t}`)}}function Ec(e,t){try{let r=new Map;e.split(";").map(o=>o.trim()).filter(Boolean).forEach(o=>{let i=o.indexOf("=");if(i===-1)return;let a=o.slice(0,i).trim(),u=o.slice(i+1).trim();if(!r.has(a))try{let l=decodeURIComponent(u);if(["upload","download","total","expire","reset_day"].includes(a))try{l=Number(l),["expire","reset_day"].includes(a)&&(l<=0||!Number.isFinite(l))?l="":["upload","download","total"].includes(a)&&!Number.isFinite(l)?l=0:l=l.toFixed(0)}catch(f){R.error(`Failed to convert value for key "${a}=${u}": ${f.message??f}`)}r.set(a,l)}catch{r.set(a,u)}});let n={},s={"subscription-userinfo":"","profile-web-page-url":"","plan-name":""};return r.forEach((o,i)=>{t&&i==="app_url"?s["profile-web-page-url"]=o:t&&i==="plan_name"?s["plan-name"]=o:n[i]=o}),Object.keys(n).length>0&&(s["subscription-userinfo"]=Object.entries(n).map(([o,i])=>`${o}=${encodeURIComponent(i)}`).join("; ")),t?s:s["subscription-userinfo"]}catch(r){return R.error(`normalizeFlowHeader failed: ${r.message??r}`),t?{"subscription-userinfo":e}:e}}var jpe,pd=re(()=>{jpe=F(I());dr();li();fd();Ir();gt();Ng();Ug()});function Qe(e,t,r="name"){return e.find(n=>n[r]===t)}function uI(e,t,r="name"){return e.findIndex(n=>n[r]===t)}function na(e,t,r="name"){let n=uI(e,t,r);e.splice(n,1)}function di(e,t,r,n="name"){let s=uI(e,t,n);e[s]=r}function sa(e,t,r="bottom"){if(r==="top"){e.unshift(t);return}e.push(t)}var Vpe,hi=re(()=>{Vpe=F(I())});function Le(e,t,r){e.status(r||200).json({status:"success",data:t})}function Re(e,t,r){e.status(r||500).json({status:"failed",error:{code:t.code,type:t.type,message:t.message,details:e.req?.route?.path?.startsWith("/share/")?"\u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7":t.details}})}var zpe,vn=re(()=>{zpe=F(I())});var Wpe,md,Jt,Pe,vt,gd,wn=re(()=>{Wpe=F(I()),md=class{constructor(t,r,n){this.code=t,this.message=r,this.details=n}},Jt=class extends md{constructor(t,r,n){super(t,r,n),this.type="InternalServerError"}},Pe=class extends md{constructor(t,r,n){super(t,r,n),this.type="RequestInvalidError"}},vt=class extends md{constructor(t,r,n){super(t,r,n),this.type="ResourceNotFoundError"}},gd=class extends md{constructor(t,r,n){super(t,r,n),this.type="NetworkError"}}});function uA(e){return e?.cron==null?"":`${e.cron}`.trim()}function cI(e){return uA(e).length>0}function QY(e){let t=e?.displayName??e?.["display-name"];return t==null?"":`${t}`.trim()}function nu(e){if(!e||typeof e!="object")return`${e}`;let t=e.name==null?"":`${e.name}`,r=QY(e);return!r||r===t?t:`${t} (${r})`}function lI(e){return!cI(e)}function eW(cron){if(!(!cron||!R.env.isNode))try{let{CronTime}=require("cron");new CronTime(cron)}catch(e){throw new Pe("INVALID_ARTIFACT_CRON",`Artifact cron ${cron} is invalid.`,`Reason: ${e.message??e}`)}}function qg(e){if(!e||typeof e!="object")return e;let t=uA(e);return t?(eW(t),e.cron=t,e):(delete e.cron,e)}function tW(){oA.forEach(e=>e.stop()),oA.clear()}async function rW(e,t,r){if(iA.has(e)){R.info(`[ARTIFACT CRON] ${t} ${r} skipped: previous run is still running`);return}iA.add(e);try{R.info(`[ARTIFACT CRON] ${t} ${r} started`),await aA(e),R.info(`[ARTIFACT CRON] ${t} ${r} finished`)}catch(n){R.error(`[ARTIFACT CRON] ${t} ${r} error: ${n.message??n}`)}finally{iA.delete(e)}}function nW(artifact){let cron=uA(artifact),name=artifact.name,logName=nu(artifact),{CronJob}=require("cron");try{let e=new CronJob(cron,async function(){await rW(name,logName,cron)},null,!0);oA.set(name,e),R.info(`[ARTIFACT CRON] ${logName} ${cron} scheduled`)}catch(e){R.error(`[ARTIFACT CRON] ${logName} ${cron} schedule error: ${e.message??e}`)}}function Ul(){if(!R.env.isNode||!aA)return;tW();let e=R.read($t);(Array.isArray(e)?e:[]).filter(r=>r.sync&&r.source).filter(cI).forEach(nW)}function fI(e){R.env.isNode&&(aA=e,Ul())}var e0e,oA,iA,aA,jg=re(()=>{e0e=F(I());gt();dr();wn();oA=new Map,iA=new Set});var pI=be(Kg=>{"use strict";var r0e=F(I());Kg.byteLength=iW;Kg.toByteArray=aW;Kg.fromByteArray=lW;var ia=[],Ui=[],sW=typeof Uint8Array<"u"?Uint8Array:Array,cA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Hl=0,dI=cA.length;Hl<dI;++Hl)ia[Hl]=cA[Hl],Ui[cA.charCodeAt(Hl)]=Hl;var Hl,dI;Ui[45]=62;Ui[95]=63;function hI(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function iW(e){var t=hI(e),r=t[0],n=t[1];return(r+n)*3/4-n}function oW(e,t,r){return(t+r)*3/4-r}function aW(e){var t,r=hI(e),n=r[0],s=r[1],o=new sW(oW(e,n,s)),i=0,a=s>0?n-4:n,u;for(u=0;u<a;u+=4)t=Ui[e.charCodeAt(u)]<<18|Ui[e.charCodeAt(u+1)]<<12|Ui[e.charCodeAt(u+2)]<<6|Ui[e.charCodeAt(u+3)],o[i++]=t>>16&255,o[i++]=t>>8&255,o[i++]=t&255;return s===2&&(t=Ui[e.charCodeAt(u)]<<2|Ui[e.charCodeAt(u+1)]>>4,o[i++]=t&255),s===1&&(t=Ui[e.charCodeAt(u)]<<10|Ui[e.charCodeAt(u+1)]<<4|Ui[e.charCodeAt(u+2)]>>2,o[i++]=t>>8&255,o[i++]=t&255),o}function uW(e){return ia[e>>18&63]+ia[e>>12&63]+ia[e>>6&63]+ia[e&63]}function cW(e,t,r){for(var n,s=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),s.push(uW(n));return s.join("")}function lW(e){for(var t,r=e.length,n=r%3,s=[],o=16383,i=0,a=r-n;i<a;i+=o)s.push(cW(e,i,i+o>a?a:i+o));return n===1?(t=e[r-1],s.push(ia[t>>2]+ia[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],s.push(ia[t>>10]+ia[t>>4&63]+ia[t<<2&63]+"=")),s.join("")}});var mI=be(lA=>{var s0e=F(I());lA.read=function(e,t,r,n,s){var o,i,a=s*8-n-1,u=(1<<a)-1,l=u>>1,f=-7,m=r?s-1:0,p=r?-1:1,d=e[t+m];for(m+=p,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+e[t+m],m+=p,f-=8);for(i=o&(1<<-f)-1,o>>=-f,f+=n;f>0;i=i*256+e[t+m],m+=p,f-=8);if(o===0)o=1-l;else{if(o===u)return i?NaN:(d?-1:1)*(1/0);i=i+Math.pow(2,n),o=o-l}return(d?-1:1)*i*Math.pow(2,o-n)};lA.write=function(e,t,r,n,s,o){var i,a,u,l=o*8-s-1,f=(1<<l)-1,m=f>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,v=n?1:-1,g=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=f):(i=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-i))<1&&(i--,u*=2),i+m>=1?t+=p/u:t+=p*Math.pow(2,1-m),t*u>=2&&(i++,u/=2),i+m>=f?(a=0,i=f):i+m>=1?(a=(t*u-1)*Math.pow(2,s),i=i+m):(a=t*Math.pow(2,m-1)*Math.pow(2,s),i=0));s>=8;e[r+d]=a&255,d+=v,a/=256,s-=8);for(i=i<<s|a,l+=s;l>0;e[r+d]=i&255,d+=v,i/=256,l-=8);e[r+d-v]|=g*128}});var iu=be(Ed=>{"use strict";var a0e=F(I());var fA=pI(),wd=mI(),gI=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ed.Buffer=we;Ed.SlowBuffer=gW;Ed.INSPECT_MAX_BYTES=50;var Vg=2147483647;Ed.kMaxLength=Vg;we.TYPED_ARRAY_SUPPORT=fW();!we.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 fW(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(we.prototype,"parent",{enumerable:!0,get:function(){if(we.isBuffer(this))return this.buffer}});Object.defineProperty(we.prototype,"offset",{enumerable:!0,get:function(){if(we.isBuffer(this))return this.byteOffset}});function su(e){if(e>Vg)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,we.prototype),t}function we(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return mA(e)}return EI(e,t,r)}we.poolSize=8192;function EI(e,t,r){if(typeof e=="string")return hW(e,t);if(ArrayBuffer.isView(e))return pW(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(oa(e,ArrayBuffer)||e&&oa(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(oa(e,SharedArrayBuffer)||e&&oa(e.buffer,SharedArrayBuffer)))return hA(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return we.from(n,t,r);let s=mW(e);if(s)return s;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return we.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}we.from=function(e,t,r){return EI(e,t,r)};Object.setPrototypeOf(we.prototype,Uint8Array.prototype);Object.setPrototypeOf(we,Uint8Array);function bI(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function dW(e,t,r){return bI(e),e<=0?su(e):t!==void 0?typeof r=="string"?su(e).fill(t,r):su(e).fill(t):su(e)}we.alloc=function(e,t,r){return dW(e,t,r)};function mA(e){return bI(e),su(e<0?0:gA(e)|0)}we.allocUnsafe=function(e){return mA(e)};we.allocUnsafeSlow=function(e){return mA(e)};function hW(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!we.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=AI(e,t)|0,n=su(r),s=n.write(e,t);return s!==r&&(n=n.slice(0,s)),n}function dA(e){let t=e.length<0?0:gA(e.length)|0,r=su(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function pW(e){if(oa(e,Uint8Array)){let t=new Uint8Array(e);return hA(t.buffer,t.byteOffset,t.byteLength)}return dA(e)}function hA(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,we.prototype),n}function mW(e){if(we.isBuffer(e)){let t=gA(e.length)|0,r=su(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||wA(e.length)?su(0):dA(e);if(e.type==="Buffer"&&Array.isArray(e.data))return dA(e.data)}function gA(e){if(e>=Vg)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Vg.toString(16)+" bytes");return e|0}function gW(e){return+e!=e&&(e=0),we.alloc(+e)}we.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==we.prototype};we.compare=function(t,r){if(oa(t,Uint8Array)&&(t=we.from(t,t.offset,t.byteLength)),oa(r,Uint8Array)&&(r=we.from(r,r.offset,r.byteLength)),!we.isBuffer(t)||!we.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,s=r.length;for(let o=0,i=Math.min(n,s);o<i;++o)if(t[o]!==r[o]){n=t[o],s=r[o];break}return n<s?-1:s<n?1:0};we.isEncoding=function(t){switch(String(t).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}};we.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return we.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let s=we.allocUnsafe(r),o=0;for(n=0;n<t.length;++n){let i=t[n];if(oa(i,Uint8Array))o+i.length>s.length?(we.isBuffer(i)||(i=we.from(i)),i.copy(s,o)):Uint8Array.prototype.set.call(s,i,o);else if(we.isBuffer(i))i.copy(s,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=i.length}return s};function AI(e,t){if(we.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||oa(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let s=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return pA(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return xI(e).length;default:if(s)return n?-1:pA(e).length;t=(""+t).toLowerCase(),s=!0}}we.byteLength=AI;function vW(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return FW(this,t,r);case"utf8":case"utf-8":return _I(this,t,r);case"ascii":return CW(this,t,r);case"latin1":case"binary":return DW(this,t,r);case"base64":return SW(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return BW(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}we.prototype._isBuffer=!0;function Ml(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}we.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)Ml(this,r,r+1);return this};we.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)Ml(this,r,r+3),Ml(this,r+1,r+2);return this};we.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)Ml(this,r,r+7),Ml(this,r+1,r+6),Ml(this,r+2,r+5),Ml(this,r+3,r+4);return this};we.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?_I(this,0,t):vW.apply(this,arguments)};we.prototype.toLocaleString=we.prototype.toString;we.prototype.equals=function(t){if(!we.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:we.compare(this,t)===0};we.prototype.inspect=function(){let t="",r=Ed.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};gI&&(we.prototype[gI]=we.prototype.inspect);we.prototype.compare=function(t,r,n,s,o){if(oa(t,Uint8Array)&&(t=we.from(t,t.offset,t.byteLength)),!we.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),s===void 0&&(s=0),o===void 0&&(o=this.length),r<0||n>t.length||s<0||o>this.length)throw new RangeError("out of range index");if(s>=o&&r>=n)return 0;if(s>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,s>>>=0,o>>>=0,this===t)return 0;let i=o-s,a=n-r,u=Math.min(i,a),l=this.slice(s,o),f=t.slice(r,n);for(let m=0;m<u;++m)if(l[m]!==f[m]){i=l[m],a=f[m];break}return i<a?-1:a<i?1:0};function SI(e,t,r,n,s){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,wA(r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0)if(s)r=0;else return-1;if(typeof t=="string"&&(t=we.from(t,n)),we.isBuffer(t))return t.length===0?-1:vI(e,t,r,n,s);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):vI(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function vI(e,t,r,n,s){let o=1,i=e.length,a=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,i/=2,a/=2,r/=2}function u(f,m){return o===1?f[m]:f.readUInt16BE(m*o)}let l;if(s){let f=-1;for(l=r;l<i;l++)if(u(e,l)===u(t,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===a)return f*o}else f!==-1&&(l-=l-f),f=-1}else for(r+a>i&&(r=i-a),l=r;l>=0;l--){let f=!0;for(let m=0;m<a;m++)if(u(e,l+m)!==u(t,m)){f=!1;break}if(f)return l}return-1}we.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};we.prototype.indexOf=function(t,r,n){return SI(this,t,r,n,!0)};we.prototype.lastIndexOf=function(t,r,n){return SI(this,t,r,n,!1)};function wW(e,t,r,n){r=Number(r)||0;let s=e.length-r;n?(n=Number(n),n>s&&(n=s)):n=s;let o=t.length;n>o/2&&(n=o/2);let i;for(i=0;i<n;++i){let a=parseInt(t.substr(i*2,2),16);if(wA(a))return i;e[r+i]=a}return i}function yW(e,t,r,n){return Gg(pA(t,e.length-r),e,r,n)}function EW(e,t,r,n){return Gg(RW(t),e,r,n)}function bW(e,t,r,n){return Gg(xI(t),e,r,n)}function AW(e,t,r,n){return Gg(TW(t,e.length-r),e,r,n)}we.prototype.write=function(t,r,n,s){if(r===void 0)s="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")s=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,s===void 0&&(s="utf8")):(s=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((n===void 0||n>o)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");let i=!1;for(;;)switch(s){case"hex":return wW(this,t,r,n);case"utf8":case"utf-8":return yW(this,t,r,n);case"ascii":case"latin1":case"binary":return EW(this,t,r,n);case"base64":return bW(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return AW(this,t,r,n);default:if(i)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),i=!0}};we.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function SW(e,t,r){return t===0&&r===e.length?fA.fromByteArray(e):fA.fromByteArray(e.slice(t,r))}function _I(e,t,r){r=Math.min(e.length,r);let n=[],s=t;for(;s<r;){let o=e[s],i=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a<=r){let u,l,f,m;switch(a){case 1:o<128&&(i=o);break;case 2:u=e[s+1],(u&192)===128&&(m=(o&31)<<6|u&63,m>127&&(i=m));break;case 3:u=e[s+1],l=e[s+2],(u&192)===128&&(l&192)===128&&(m=(o&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(i=m));break;case 4:u=e[s+1],l=e[s+2],f=e[s+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(m=(o&15)<<18|(u&63)<<12|(l&63)<<6|f&63,m>65535&&m<1114112&&(i=m))}}i===null?(i=65533,a=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),s+=a}return _W(n)}var wI=4096;function _W(e){let t=e.length;if(t<=wI)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=wI));return r}function CW(e,t,r){let n="";r=Math.min(e.length,r);for(let s=t;s<r;++s)n+=String.fromCharCode(e[s]&127);return n}function DW(e,t,r){let n="";r=Math.min(e.length,r);for(let s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}function FW(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let s="";for(let o=t;o<r;++o)s+=kW[e[o]];return s}function BW(e,t,r){let n=e.slice(t,r),s="";for(let o=0;o<n.length-1;o+=2)s+=String.fromCharCode(n[o]+n[o+1]*256);return s}we.prototype.slice=function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let s=this.subarray(t,r);return Object.setPrototypeOf(s,we.prototype),s};function yn(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}we.prototype.readUintLE=we.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||yn(t,r,this.length);let s=this[t],o=1,i=0;for(;++i<r&&(o*=256);)s+=this[t+i]*o;return s};we.prototype.readUintBE=we.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||yn(t,r,this.length);let s=this[t+--r],o=1;for(;r>0&&(o*=256);)s+=this[t+--r]*o;return s};we.prototype.readUint8=we.prototype.readUInt8=function(t,r){return t=t>>>0,r||yn(t,1,this.length),this[t]};we.prototype.readUint16LE=we.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||yn(t,2,this.length),this[t]|this[t+1]<<8};we.prototype.readUint16BE=we.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||yn(t,2,this.length),this[t]<<8|this[t+1]};we.prototype.readUint32LE=we.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||yn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};we.prototype.readUint32BE=we.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||yn(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};we.prototype.readBigUInt64LE=bc(function(t){t=t>>>0,yd(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Gp(t,this.length-8);let s=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(s)+(BigInt(o)<<BigInt(32))});we.prototype.readBigUInt64BE=bc(function(t){t=t>>>0,yd(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Gp(t,this.length-8);let s=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(s)<<BigInt(32))+BigInt(o)});we.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||yn(t,r,this.length);let s=this[t],o=1,i=0;for(;++i<r&&(o*=256);)s+=this[t+i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};we.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||yn(t,r,this.length);let s=r,o=1,i=this[t+--s];for(;s>0&&(o*=256);)i+=this[t+--s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};we.prototype.readInt8=function(t,r){return t=t>>>0,r||yn(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};we.prototype.readInt16LE=function(t,r){t=t>>>0,r||yn(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};we.prototype.readInt16BE=function(t,r){t=t>>>0,r||yn(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};we.prototype.readInt32LE=function(t,r){return t=t>>>0,r||yn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};we.prototype.readInt32BE=function(t,r){return t=t>>>0,r||yn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};we.prototype.readBigInt64LE=bc(function(t){t=t>>>0,yd(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Gp(t,this.length-8);let s=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(s)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});we.prototype.readBigInt64BE=bc(function(t){t=t>>>0,yd(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Gp(t,this.length-8);let s=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(s)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});we.prototype.readFloatLE=function(t,r){return t=t>>>0,r||yn(t,4,this.length),wd.read(this,t,!0,23,4)};we.prototype.readFloatBE=function(t,r){return t=t>>>0,r||yn(t,4,this.length),wd.read(this,t,!1,23,4)};we.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||yn(t,8,this.length),wd.read(this,t,!0,52,8)};we.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||yn(t,8,this.length),wd.read(this,t,!1,52,8)};function Ms(e,t,r,n,s,o){if(!we.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}we.prototype.writeUintLE=we.prototype.writeUIntLE=function(t,r,n,s){if(t=+t,r=r>>>0,n=n>>>0,!s){let a=Math.pow(2,8*n)-1;Ms(this,t,r,n,a,0)}let o=1,i=0;for(this[r]=t&255;++i<n&&(o*=256);)this[r+i]=t/o&255;return r+n};we.prototype.writeUintBE=we.prototype.writeUIntBE=function(t,r,n,s){if(t=+t,r=r>>>0,n=n>>>0,!s){let a=Math.pow(2,8*n)-1;Ms(this,t,r,n,a,0)}let o=n-1,i=1;for(this[r+o]=t&255;--o>=0&&(i*=256);)this[r+o]=t/i&255;return r+n};we.prototype.writeUint8=we.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,1,255,0),this[r]=t&255,r+1};we.prototype.writeUint16LE=we.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};we.prototype.writeUint16BE=we.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};we.prototype.writeUint32LE=we.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};we.prototype.writeUint32BE=we.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function CI(e,t,r,n,s){$I(t,n,s,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=i,i=i>>8,e[r++]=i,i=i>>8,e[r++]=i,i=i>>8,e[r++]=i,r}function DI(e,t,r,n,s){$I(t,n,s,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=i,i=i>>8,e[r+2]=i,i=i>>8,e[r+1]=i,i=i>>8,e[r]=i,r+8}we.prototype.writeBigUInt64LE=bc(function(t,r=0){return CI(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});we.prototype.writeBigUInt64BE=bc(function(t,r=0){return DI(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});we.prototype.writeIntLE=function(t,r,n,s){if(t=+t,r=r>>>0,!s){let u=Math.pow(2,8*n-1);Ms(this,t,r,n,u-1,-u)}let o=0,i=1,a=0;for(this[r]=t&255;++o<n&&(i*=256);)t<0&&a===0&&this[r+o-1]!==0&&(a=1),this[r+o]=(t/i>>0)-a&255;return r+n};we.prototype.writeIntBE=function(t,r,n,s){if(t=+t,r=r>>>0,!s){let u=Math.pow(2,8*n-1);Ms(this,t,r,n,u-1,-u)}let o=n-1,i=1,a=0;for(this[r+o]=t&255;--o>=0&&(i*=256);)t<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(t/i>>0)-a&255;return r+n};we.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};we.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};we.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};we.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};we.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||Ms(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};we.prototype.writeBigInt64LE=bc(function(t,r=0){return CI(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});we.prototype.writeBigInt64BE=bc(function(t,r=0){return DI(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function FI(e,t,r,n,s,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function BI(e,t,r,n,s){return t=+t,r=r>>>0,s||FI(e,t,r,4,34028234663852886e22,-34028234663852886e22),wd.write(e,t,r,n,23,4),r+4}we.prototype.writeFloatLE=function(t,r,n){return BI(this,t,r,!0,n)};we.prototype.writeFloatBE=function(t,r,n){return BI(this,t,r,!1,n)};function II(e,t,r,n,s){return t=+t,r=r>>>0,s||FI(e,t,r,8,17976931348623157e292,-17976931348623157e292),wd.write(e,t,r,n,52,8),r+8}we.prototype.writeDoubleLE=function(t,r,n){return II(this,t,r,!0,n)};we.prototype.writeDoubleBE=function(t,r,n){return II(this,t,r,!1,n)};we.prototype.copy=function(t,r,n,s){if(!we.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!s&&s!==0&&(s=this.length),r>=t.length&&(r=t.length),r||(r=0),s>0&&s<n&&(s=n),s===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),t.length-r<s-n&&(s=t.length-r+n);let o=s-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,s):Uint8Array.prototype.set.call(t,this.subarray(n,s),r),o};we.prototype.fill=function(t,r,n,s){if(typeof t=="string"){if(typeof r=="string"?(s=r,r=0,n=this.length):typeof n=="string"&&(s=n,n=this.length),s!==void 0&&typeof s!="string")throw new TypeError("encoding must be a string");if(typeof s=="string"&&!we.isEncoding(s))throw new TypeError("Unknown encoding: "+s);if(t.length===1){let i=t.charCodeAt(0);(s==="utf8"&&i<128||s==="latin1")&&(t=i)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let o;if(typeof t=="number")for(o=r;o<n;++o)this[o]=t;else{let i=we.isBuffer(t)?t:we.from(t,s),a=i.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-r;++o)this[o+r]=i[o%a]}return this};var vd={};function vA(e,t,r){vd[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(s){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:s,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}vA("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);vA("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);vA("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,s=r;return Number.isInteger(r)&&Math.abs(r)>2**32?s=yI(String(r)):typeof r=="bigint"&&(s=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(s=yI(s)),s+="n"),n+=` It must be ${t}. Received ${s}`,n},RangeError);function yI(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function IW(e,t,r){yd(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Gp(t,e.length-(r+1))}function $I(e,t,r,n,s,o){if(e>r||e<t){let i=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${i} and < 2${i} ** ${(o+1)*8}${i}`:a=`>= -(2${i} ** ${(o+1)*8-1}${i}) and < 2 ** ${(o+1)*8-1}${i}`:a=`>= ${t}${i} and <= ${r}${i}`,new vd.ERR_OUT_OF_RANGE("value",a,e)}IW(n,s,o)}function yd(e,t){if(typeof e!="number")throw new vd.ERR_INVALID_ARG_TYPE(t,"number",e)}function Gp(e,t,r){throw Math.floor(e)!==e?(yd(e,r),new vd.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new vd.ERR_BUFFER_OUT_OF_BOUNDS:new vd.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var $W=/[^+/0-9A-Za-z-_]/g;function xW(e){if(e=e.split("=")[0],e=e.trim().replace($W,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function pA(e,t){t=t||1/0;let r,n=e.length,s=null,o=[];for(let i=0;i<n;++i){if(r=e.charCodeAt(i),r>55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(i+1===n){(t-=3)>-1&&o.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&(t-=3)>-1&&o.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function RW(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function TW(e,t){let r,n,s,o=[];for(let i=0;i<e.length&&!((t-=2)<0);++i)r=e.charCodeAt(i),n=r>>8,s=r%256,o.push(s),o.push(n);return o}function xI(e){return fA.toByteArray(xW(e))}function Gg(e,t,r,n){let s;for(s=0;s<n&&!(s+r>=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function oa(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function wA(e){return e!==e}var kW=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let s=0;s<16;++s)t[n+s]=e[r]+e[s]}return t})();function bc(e){return typeof BigInt>"u"?PW:e}function PW(){throw new Error("BigInt not supported")}});var n$=be(Te=>{var l0e=F(I()),Yp={};Yp.userAgent=!1;var bd={},OW="11.1.3",NW="jsrsasign(all) 11.1.3 (2026-04-18) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var Oe=Oe||(function(e,t){var r={},n=r.lib={},s=n.Base=(function(){function d(){}return{extend:function(v){d.prototype=this;var g=new d;return v&&g.mixIn(v),g.hasOwnProperty("init")||(g.init=function(){g.$super.init.apply(this,arguments)}),g.init.prototype=g,g.$super=this,g},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var g in v)v.hasOwnProperty(g)&&(this[g]=v[g]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),o=n.WordArray=s.extend({init:function(d,v){d=this.words=d||[],v!=t?this.sigBytes=v:this.sigBytes=d.length*4},toString:function(d){return(d||a).stringify(this)},concat:function(d){var v=this.words,g=d.words,y=this.sigBytes,w=d.sigBytes;if(this.clamp(),y%4)for(var E=0;E<w;E++){var S=g[E>>>2]>>>24-E%4*8&255;v[y+E>>>2]|=S<<24-(y+E)%4*8}else for(var E=0;E<w;E+=4)v[y+E>>>2]=g[E>>>2];return this.sigBytes+=w,this},clamp:function(){var d=this.words,v=this.sigBytes;d[v>>>2]&=4294967295<<32-v%4*8,d.length=e.ceil(v/4)},clone:function(){var d=s.clone.call(this);return d.words=this.words.slice(0),d},random:function(d){for(var v=[],g=0;g<d;g+=4)v.push(e.random()*4294967296|0);return new o.init(v,d)}}),i=r.enc={},a=i.Hex={stringify:function(d){for(var v=d.words,g=d.sigBytes,y=[],w=0;w<g;w++){var E=v[w>>>2]>>>24-w%4*8&255;y.push((E>>>4).toString(16)),y.push((E&15).toString(16))}return y.join("")},parse:function(d){for(var v=d.length,g=[],y=0;y<v;y+=2)g[y>>>3]|=parseInt(d.substr(y,2),16)<<24-y%8*4;return new o.init(g,v/2)}},u=i.Latin1={stringify:function(d){for(var v=d.words,g=d.sigBytes,y=[],w=0;w<g;w++){var E=v[w>>>2]>>>24-w%4*8&255;y.push(String.fromCharCode(E))}return y.join("")},parse:function(d){for(var v=d.length,g=[],y=0;y<v;y++)g[y>>>2]|=(d.charCodeAt(y)&255)<<24-y%4*8;return new o.init(g,v)}},l=i.Utf8={stringify:function(d){try{return decodeURIComponent(escape(u.stringify(d)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(d){return u.parse(unescape(encodeURIComponent(d)))}},f=n.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(d){typeof d=="string"&&(d=l.parse(d)),this._data.concat(d),this._nDataBytes+=d.sigBytes},_process:function(d){var v=this._data,g=v.words,y=v.sigBytes,w=this.blockSize,E=w*4,S=y/E;d?S=e.ceil(S):S=e.max((S|0)-this._minBufferSize,0);var C=S*w,D=e.min(C*4,y);if(C){for(var H=0;H<C;H+=w)this._doProcessBlock(g,H);var K=g.splice(0,C);v.sigBytes-=D}return new o.init(K,D)},clone:function(){var d=s.clone.call(this);return d._data=this._data.clone(),d},_minBufferSize:0}),m=n.Hasher=f.extend({cfg:s.extend(),init:function(d){this.cfg=this.cfg.extend(d),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(d){return this._append(d),this._process(),this},finalize:function(d){d&&this._append(d);var v=this._doFinalize();return v},blockSize:512/32,_createHelper:function(d){return function(v,g){return new d.init(g).finalize(v)}},_createHmacHelper:function(d){return function(v,g){return new p.HMAC.init(d,g).finalize(v)}}}),p=r.algo={};return r})(Math);(function(e){var s=Oe,t=s.lib,r=t.Base,n=t.WordArray,s=s.x64={};s.Word=r.extend({init:function(o,i){this.high=o,this.low=i}}),s.WordArray=r.extend({init:function(o,i){o=this.words=o||[],this.sigBytes=i!=e?i:8*o.length},toX32:function(){for(var o=this.words,i=o.length,a=[],u=0;u<i;u++){var l=o[u];a.push(l.high),a.push(l.low)}return n.create(a,this.sigBytes)},clone:function(){for(var o=r.clone.call(this),i=o.words=this.words.slice(0),a=i.length,u=0;u<a;u++)i[u]=i[u].clone();return o}})})();Oe.lib.Cipher||(function(e){var d=Oe,t=d.lib,r=t.Base,n=t.WordArray,s=t.BufferedBlockAlgorithm,o=d.enc.Base64,i=d.algo.EvpKDF,a=t.Cipher=s.extend({cfg:r.extend(),createEncryptor:function(g,y){return this.create(this._ENC_XFORM_MODE,g,y)},createDecryptor:function(g,y){return this.create(this._DEC_XFORM_MODE,g,y)},init:function(g,y,w){this.cfg=this.cfg.extend(w),this._xformMode=g,this._key=y,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(g){return this._append(g),this._process()},finalize:function(g){return g&&this._append(g),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(g){return{encrypt:function(y,w,E){return(typeof w=="string"?v:p).encrypt(g,y,w,E)},decrypt:function(y,w,E){return(typeof w=="string"?v:p).decrypt(g,y,w,E)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var m=d.mode={},u=function(g,y,w){var E=this._iv;E?this._iv=e:E=this._prevBlock;for(var S=0;S<w;S++)g[y+S]^=E[S]},l=(t.BlockCipherMode=r.extend({createEncryptor:function(g,y){return this.Encryptor.create(g,y)},createDecryptor:function(g,y){return this.Decryptor.create(g,y)},init:function(g,y){this._cipher=g,this._iv=y}})).extend();l.Encryptor=l.extend({processBlock:function(g,y){var w=this._cipher,E=w.blockSize;u.call(this,g,y,E),w.encryptBlock(g,y),this._prevBlock=g.slice(y,y+E)}}),l.Decryptor=l.extend({processBlock:function(g,y){var w=this._cipher,E=w.blockSize,S=g.slice(y,y+E);w.decryptBlock(g,y),u.call(this,g,y,E),this._prevBlock=S}}),m=m.CBC=l,l=(d.pad={}).Pkcs7={pad:function(g,y){for(var w=4*y,w=w-g.sigBytes%w,E=w<<24|w<<16|w<<8|w,S=[],C=0;C<w;C+=4)S.push(E);w=n.create(S,w),g.concat(w)},unpad:function(g){g.sigBytes-=g.words[g.sigBytes-1>>>2]&255}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:m,padding:l}),reset:function(){a.reset.call(this);var y=this.cfg,g=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var w=y.createEncryptor;else w=y.createDecryptor,this._minBufferSize=1;this._mode=w.call(y,this,g&&g.words)},_doProcessBlock:function(g,y){this._mode.processBlock(g,y)},_doFinalize:function(){var g=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){g.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),g.unpad(y);return y},blockSize:4});var f=t.CipherParams=r.extend({init:function(g){this.mixIn(g)},toString:function(g){return(g||this.formatter).stringify(this)}}),m=(d.format={}).OpenSSL={stringify:function(g){var y=g.ciphertext;return g=g.salt,(g?n.create([1398893684,1701076831]).concat(g).concat(y):y).toString(o)},parse:function(g){g=o.parse(g);var y=g.words;if(y[0]==1398893684&&y[1]==1701076831){var w=n.create(y.slice(2,4));y.splice(0,4),g.sigBytes-=16}return f.create({ciphertext:g,salt:w})}},p=t.SerializableCipher=r.extend({cfg:r.extend({format:m}),encrypt:function(g,y,w,E){E=this.cfg.extend(E);var S=g.createEncryptor(w,E);return y=S.finalize(y),S=S.cfg,f.create({ciphertext:y,key:w,iv:S.iv,algorithm:g,mode:S.mode,padding:S.padding,blockSize:g.blockSize,formatter:E.format})},decrypt:function(g,y,w,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),g.createDecryptor(w,E).finalize(y.ciphertext)},_parse:function(g,y){return typeof g=="string"?y.parse(g,this):g}}),d=(d.kdf={}).OpenSSL={execute:function(g,y,w,E){return E||(E=n.random(8)),g=i.create({keySize:y+w}).compute(g,E),w=n.create(g.words.slice(y),4*w),g.sigBytes=4*y,f.create({key:g,iv:w,salt:E})}},v=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:d}),encrypt:function(g,y,w,E){return E=this.cfg.extend(E),w=E.kdf.execute(w,g.keySize,g.ivSize),E.iv=w.iv,g=p.encrypt.call(this,g,y,w.key,E),g.mixIn(w),g},decrypt:function(g,y,w,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),w=E.kdf.execute(w,g.keySize,g.ivSize,y.salt),E.iv=w.iv,p.decrypt.call(this,g,y,w.key,E)}})})();(function(){for(var e=Oe,t=e.lib.BlockCipher,H=e.algo,r=[],n=[],s=[],o=[],i=[],a=[],u=[],l=[],f=[],m=[],p=[],d=0;256>d;d++)p[d]=128>d?d<<1:d<<1^283;for(var v=0,g=0,d=0;256>d;d++){var y=g^g<<1^g<<2^g<<3^g<<4,y=y>>>8^y&255^99;r[v]=y,n[y]=v;var w=p[v],E=p[w],S=p[E],C=257*p[y]^16843008*y;s[v]=C<<24|C>>>8,o[v]=C<<16|C>>>16,i[v]=C<<8|C>>>24,a[v]=C,C=16843009*S^65537*E^257*w^16843008*v,u[y]=C<<24|C>>>8,l[y]=C<<16|C>>>16,f[y]=C<<8|C>>>24,m[y]=C,v?(v=w^p[p[p[S^w]]],g^=p[p[g]]):v=g=1}var D=[0,1,2,4,8,16,32,64,128,27,54],H=H.AES=t.extend({_doReset:function(){for(var x=this._key,K=x.words,_=x.sigBytes/4,x=4*((this._nRounds=_+6)+1),j=this._keySchedule=[],U=0;U<x;U++)if(U<_)j[U]=K[U];else{var k=j[U-1];U%_?6<_&&U%_==4&&(k=r[k>>>24]<<24|r[k>>>16&255]<<16|r[k>>>8&255]<<8|r[k&255]):(k=k<<8|k>>>24,k=r[k>>>24]<<24|r[k>>>16&255]<<16|r[k>>>8&255]<<8|r[k&255],k^=D[U/_|0]<<24),j[U]=j[U-_]^k}for(K=this._invKeySchedule=[],_=0;_<x;_++)U=x-_,k=_%4?j[U]:j[U-4],K[_]=4>_||4>=U?k:u[r[k>>>24]]^l[r[k>>>16&255]]^f[r[k>>>8&255]]^m[r[k&255]]},encryptBlock:function(K,_){this._doCryptBlock(K,_,this._keySchedule,s,o,i,a,r)},decryptBlock:function(K,_){var x=K[_+1];K[_+1]=K[_+3],K[_+3]=x,this._doCryptBlock(K,_,this._invKeySchedule,u,l,f,m,n),x=K[_+1],K[_+1]=K[_+3],K[_+3]=x},_doCryptBlock:function(K,_,x,j,U,k,N,O){for(var L=this._nRounds,ie=K[_]^x[0],ge=K[_+1]^x[1],he=K[_+2]^x[2],te=K[_+3]^x[3],T=4,M=1;M<L;M++)var W=j[ie>>>24]^U[ge>>>16&255]^k[he>>>8&255]^N[te&255]^x[T++],G=j[ge>>>24]^U[he>>>16&255]^k[te>>>8&255]^N[ie&255]^x[T++],J=j[he>>>24]^U[te>>>16&255]^k[ie>>>8&255]^N[ge&255]^x[T++],te=j[te>>>24]^U[ie>>>16&255]^k[ge>>>8&255]^N[he&255]^x[T++],ie=W,ge=G,he=J;W=(O[ie>>>24]<<24|O[ge>>>16&255]<<16|O[he>>>8&255]<<8|O[te&255])^x[T++],G=(O[ge>>>24]<<24|O[he>>>16&255]<<16|O[te>>>8&255]<<8|O[ie&255])^x[T++],J=(O[he>>>24]<<24|O[te>>>16&255]<<16|O[ie>>>8&255]<<8|O[ge&255])^x[T++],te=(O[te>>>24]<<24|O[ie>>>16&255]<<16|O[ge>>>8&255]<<8|O[he&255])^x[T++],K[_]=W,K[_+1]=G,K[_+2]=J,K[_+3]=te},keySize:8});e.AES=t._createHelper(H)})();(function(){function e(p,d){var v=(this._lBlock>>>p^this._rBlock)&d;this._rBlock^=v,this._lBlock^=v<<p}function t(p,d){var v=(this._rBlock>>>p^this._lBlock)&d;this._lBlock^=v,this._rBlock^=v<<p}var r=Oe,s=r.lib,n=s.WordArray,s=s.BlockCipher,o=r.algo,i=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],m=o.DES=s.extend({_doReset:function(){for(var p=this._key.words,d=[],v=0;56>v;v++){var g=i[v]-1;d[v]=p[g>>>5]>>>31-g%32&1}for(p=this._subKeys=[],g=0;16>g;g++){for(var y=p[g]=[],w=u[g],v=0;24>v;v++)y[v/6|0]|=d[(a[v]-1+w)%28]<<31-v%6,y[4+(v/6|0)]|=d[28+(a[v+24]-1+w)%28]<<31-v%6;for(y[0]=y[0]<<1|y[0]>>>31,v=1;7>v;v++)y[v]>>>=4*(v-1)+3;y[7]=y[7]<<5|y[7]>>>27}for(d=this._invSubKeys=[],v=0;16>v;v++)d[v]=p[15-v]},encryptBlock:function(p,d){this._doCryptBlock(p,d,this._subKeys)},decryptBlock:function(p,d){this._doCryptBlock(p,d,this._invSubKeys)},_doCryptBlock:function(p,d,v){this._lBlock=p[d],this._rBlock=p[d+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var g=0;16>g;g++){for(var y=v[g],w=this._lBlock,E=this._rBlock,S=0,C=0;8>C;C++)S|=l[C][((E^y[C])&f[C])>>>0];this._lBlock=E,this._rBlock=w^S}v=this._lBlock,this._lBlock=this._rBlock,this._rBlock=v,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),p[d]=this._lBlock,p[d+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=s._createHelper(m),o=o.TripleDES=s.extend({_doReset:function(){var p=this._key.words;this._des1=m.createEncryptor(n.create(p.slice(0,2))),this._des2=m.createEncryptor(n.create(p.slice(2,4))),this._des3=m.createEncryptor(n.create(p.slice(4,6)))},encryptBlock:function(p,d){this._des1.encryptBlock(p,d),this._des2.decryptBlock(p,d),this._des3.encryptBlock(p,d)},decryptBlock:function(p,d){this._des3.decryptBlock(p,d),this._des2.encryptBlock(p,d),this._des1.decryptBlock(p,d)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=s._createHelper(o)})();(function(){var e=Oe,t=e.lib.WordArray;e.enc.Base64={stringify:function(r){var n=r.words,s=r.sigBytes,o=this._map;r.clamp(),r=[];for(var i=0;i<s;i+=3)for(var a=(n[i>>>2]>>>24-8*(i%4)&255)<<16|(n[i+1>>>2]>>>24-8*((i+1)%4)&255)<<8|n[i+2>>>2]>>>24-8*((i+2)%4)&255,u=0;4>u&&i+.75*u<s;u++)r.push(o.charAt(a>>>6*(3-u)&63));if(n=o.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,s=this._map,o=s.charAt(64);o&&(o=r.indexOf(o),o!=-1&&(n=o));for(var o=[],i=0,a=0;a<n;a++)if(a%4){var u=s.indexOf(r.charAt(a-1))<<2*(a%4),l=s.indexOf(r.charAt(a))>>>6-2*(a%4);o[i>>>2]|=(u|l)<<24-8*(i%4),i++}return t.create(o,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(e){function t(m,p,d,v,g,y,w){return m=m+(p&d|~p&v)+g+w,(m<<y|m>>>32-y)+p}function r(m,p,d,v,g,y,w){return m=m+(p&v|d&~v)+g+w,(m<<y|m>>>32-y)+p}function n(m,p,d,v,g,y,w){return m=m+(p^d^v)+g+w,(m<<y|m>>>32-y)+p}function s(m,p,d,v,g,y,w){return m=m+(d^(p|~v))+g+w,(m<<y|m>>>32-y)+p}for(var o=Oe,u=o.lib,i=u.WordArray,a=u.Hasher,u=o.algo,l=[],f=0;64>f;f++)l[f]=4294967296*e.abs(e.sin(f+1))|0;u=u.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,p){for(var d=0;16>d;d++){var v=p+d,g=m[v];m[v]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var d=this._hash.words,v=m[p+0],g=m[p+1],y=m[p+2],w=m[p+3],E=m[p+4],S=m[p+5],C=m[p+6],D=m[p+7],H=m[p+8],K=m[p+9],_=m[p+10],x=m[p+11],j=m[p+12],U=m[p+13],k=m[p+14],N=m[p+15],O=d[0],M=d[1],T=d[2],L=d[3],O=t(O,M,T,L,v,7,l[0]),L=t(L,O,M,T,g,12,l[1]),T=t(T,L,O,M,y,17,l[2]),M=t(M,T,L,O,w,22,l[3]),O=t(O,M,T,L,E,7,l[4]),L=t(L,O,M,T,S,12,l[5]),T=t(T,L,O,M,C,17,l[6]),M=t(M,T,L,O,D,22,l[7]),O=t(O,M,T,L,H,7,l[8]),L=t(L,O,M,T,K,12,l[9]),T=t(T,L,O,M,_,17,l[10]),M=t(M,T,L,O,x,22,l[11]),O=t(O,M,T,L,j,7,l[12]),L=t(L,O,M,T,U,12,l[13]),T=t(T,L,O,M,k,17,l[14]),M=t(M,T,L,O,N,22,l[15]),O=r(O,M,T,L,g,5,l[16]),L=r(L,O,M,T,C,9,l[17]),T=r(T,L,O,M,x,14,l[18]),M=r(M,T,L,O,v,20,l[19]),O=r(O,M,T,L,S,5,l[20]),L=r(L,O,M,T,_,9,l[21]),T=r(T,L,O,M,N,14,l[22]),M=r(M,T,L,O,E,20,l[23]),O=r(O,M,T,L,K,5,l[24]),L=r(L,O,M,T,k,9,l[25]),T=r(T,L,O,M,w,14,l[26]),M=r(M,T,L,O,H,20,l[27]),O=r(O,M,T,L,U,5,l[28]),L=r(L,O,M,T,y,9,l[29]),T=r(T,L,O,M,D,14,l[30]),M=r(M,T,L,O,j,20,l[31]),O=n(O,M,T,L,S,4,l[32]),L=n(L,O,M,T,H,11,l[33]),T=n(T,L,O,M,x,16,l[34]),M=n(M,T,L,O,k,23,l[35]),O=n(O,M,T,L,g,4,l[36]),L=n(L,O,M,T,E,11,l[37]),T=n(T,L,O,M,D,16,l[38]),M=n(M,T,L,O,_,23,l[39]),O=n(O,M,T,L,U,4,l[40]),L=n(L,O,M,T,v,11,l[41]),T=n(T,L,O,M,w,16,l[42]),M=n(M,T,L,O,C,23,l[43]),O=n(O,M,T,L,K,4,l[44]),L=n(L,O,M,T,j,11,l[45]),T=n(T,L,O,M,N,16,l[46]),M=n(M,T,L,O,y,23,l[47]),O=s(O,M,T,L,v,6,l[48]),L=s(L,O,M,T,D,10,l[49]),T=s(T,L,O,M,k,15,l[50]),M=s(M,T,L,O,S,21,l[51]),O=s(O,M,T,L,j,6,l[52]),L=s(L,O,M,T,w,10,l[53]),T=s(T,L,O,M,_,15,l[54]),M=s(M,T,L,O,g,21,l[55]),O=s(O,M,T,L,H,6,l[56]),L=s(L,O,M,T,N,10,l[57]),T=s(T,L,O,M,C,15,l[58]),M=s(M,T,L,O,U,21,l[59]),O=s(O,M,T,L,E,6,l[60]),L=s(L,O,M,T,x,10,l[61]),T=s(T,L,O,M,y,15,l[62]),M=s(M,T,L,O,K,21,l[63]);d[0]=d[0]+O|0,d[1]=d[1]+M|0,d[2]=d[2]+T|0,d[3]=d[3]+L|0},_doFinalize:function(){var m=this._data,p=m.words,d=8*this._nDataBytes,v=8*m.sigBytes;p[v>>>5]|=128<<24-v%32;var g=e.floor(d/4294967296);for(p[(v+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,p[(v+64>>>9<<4)+14]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360,m.sigBytes=4*(p.length+1),this._process(),m=this._hash,p=m.words,d=0;4>d;d++)v=p[d],p[d]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360;return m},clone:function(){var m=a.clone.call(this);return m._hash=this._hash.clone(),m}}),o.MD5=a._createHelper(u),o.HmacMD5=a._createHmacHelper(u)})(Math);(function(){var e=Oe,s=e.lib,t=s.WordArray,r=s.Hasher,n=[],s=e.algo.SHA1=r.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(o,i){for(var a=this._hash.words,u=a[0],l=a[1],f=a[2],m=a[3],p=a[4],d=0;80>d;d++){if(16>d)n[d]=o[i+d]|0;else{var v=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=v<<1|v>>>31}v=(u<<5|u>>>27)+p+n[d],v=20>d?v+((l&f|~l&m)+1518500249):40>d?v+((l^f^m)+1859775393):60>d?v+((l&f|l&m|f&m)-1894007588):v+((l^f^m)-899497514),p=m,m=f,f=l<<30|l>>>2,l=u,u=v}a[0]=a[0]+u|0,a[1]=a[1]+l|0,a[2]=a[2]+f|0,a[3]=a[3]+m|0,a[4]=a[4]+p|0},_doFinalize:function(){var o=this._data,i=o.words,a=8*this._nDataBytes,u=8*o.sigBytes;return i[u>>>5]|=128<<24-u%32,i[(u+64>>>9<<4)+14]=Math.floor(a/4294967296),i[(u+64>>>9<<4)+15]=a,o.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var o=r.clone.call(this);return o._hash=this._hash.clone(),o}});e.SHA1=r._createHelper(s),e.HmacSHA1=r._createHmacHelper(s)})();(function(e){for(var t=Oe,d=t.lib,r=d.WordArray,n=d.Hasher,d=t.algo,s=[],o=[],i=function(g){return 4294967296*(g-(g|0))|0},a=2,u=0;64>u;){var l;e:{l=a;for(var f=e.sqrt(l),m=2;m<=f;m++)if(!(l%m)){l=!1;break e}l=!0}l&&(8>u&&(s[u]=i(e.pow(a,.5))),o[u]=i(e.pow(a,1/3)),u++),a++}var p=[],d=d.SHA256=n.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(v,g){for(var y=this._hash.words,w=y[0],E=y[1],S=y[2],C=y[3],D=y[4],H=y[5],K=y[6],_=y[7],x=0;64>x;x++){if(16>x)p[x]=v[g+x]|0;else{var j=p[x-15],U=p[x-2];p[x]=((j<<25|j>>>7)^(j<<14|j>>>18)^j>>>3)+p[x-7]+((U<<15|U>>>17)^(U<<13|U>>>19)^U>>>10)+p[x-16]}j=_+((D<<26|D>>>6)^(D<<21|D>>>11)^(D<<7|D>>>25))+(D&H^~D&K)+o[x]+p[x],U=((w<<30|w>>>2)^(w<<19|w>>>13)^(w<<10|w>>>22))+(w&E^w&S^E&S),_=K,K=H,H=D,D=C+j|0,C=S,S=E,E=w,w=j+U|0}y[0]=y[0]+w|0,y[1]=y[1]+E|0,y[2]=y[2]+S|0,y[3]=y[3]+C|0,y[4]=y[4]+D|0,y[5]=y[5]+H|0,y[6]=y[6]+K|0,y[7]=y[7]+_|0},_doFinalize:function(){var v=this._data,g=v.words,y=8*this._nDataBytes,w=8*v.sigBytes;return g[w>>>5]|=128<<24-w%32,g[(w+64>>>9<<4)+14]=e.floor(y/4294967296),g[(w+64>>>9<<4)+15]=y,v.sigBytes=4*g.length,this._process(),this._hash},clone:function(){var v=n.clone.call(this);return v._hash=this._hash.clone(),v}});t.SHA256=n._createHelper(d),t.HmacSHA256=n._createHmacHelper(d)})(Math);(function(){var e=Oe,t=e.lib.WordArray,n=e.algo,r=n.SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var s=r._doFinalize.call(this);return s.sigBytes-=4,s}});e.SHA224=r._createHelper(n),e.HmacSHA224=r._createHmacHelper(n)})();(function(){function e(){return n.create.apply(n,arguments)}for(var t=Oe,r=t.lib.Hasher,o=t.x64,n=o.Word,s=o.WordArray,o=t.algo,i=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=e();o=o.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(l,f){for(var E=this._hash.words,m=E[0],p=E[1],d=E[2],v=E[3],g=E[4],y=E[5],w=E[6],E=E[7],S=m.high,C=m.low,D=p.high,H=p.low,K=d.high,_=d.low,x=v.high,j=v.low,U=g.high,k=g.low,N=y.high,O=y.low,L=w.high,T=w.low,M=E.high,W=E.low,G=S,J=C,te=D,ie=H,ge=K,he=_,Fe=x,ke=j,$e=U,oe=k,me=N,Be=O,Ue=L,We=T,He=M,St=W,st=0;80>st;st++){var Ar=a[st];if(16>st)var wt=Ar.high=l[f+2*st]|0,Ne=Ar.low=l[f+2*st+1]|0;else{var wt=a[st-15],Ne=wt.high,yt=wt.low,wt=(Ne>>>1|yt<<31)^(Ne>>>8|yt<<24)^Ne>>>7,yt=(yt>>>1|Ne<<31)^(yt>>>8|Ne<<24)^(yt>>>7|Ne<<25),Zr=a[st-2],Ne=Zr.high,Ot=Zr.low,Zr=(Ne>>>19|Ot<<13)^(Ne<<3|Ot>>>29)^Ne>>>6,Ot=(Ot>>>19|Ne<<13)^(Ot<<3|Ne>>>29)^(Ot>>>6|Ne<<26),Ne=a[st-7],Mn=Ne.high,Rr=a[st-16],rt=Rr.high,Rr=Rr.low,Ne=yt+Ne.low,wt=wt+Mn+(Ne>>>0<yt>>>0?1:0),Ne=Ne+Ot,wt=wt+Zr+(Ne>>>0<Ot>>>0?1:0),Ne=Ne+Rr,wt=wt+rt+(Ne>>>0<Rr>>>0?1:0);Ar.high=wt,Ar.low=Ne}var Mn=$e&me^~$e&Ue,Rr=oe&Be^~oe&We,Ar=G&te^G&ge^te&ge,Tr=J&ie^J&he^ie&he,yt=(G>>>28|J<<4)^(G<<30|J>>>2)^(G<<25|J>>>7),Zr=(J>>>28|G<<4)^(J<<30|G>>>2)^(J<<25|G>>>7),Ot=i[st],$s=Ot.high,to=Ot.low,Ot=St+((oe>>>14|$e<<18)^(oe>>>18|$e<<14)^(oe<<23|$e>>>9)),rt=He+(($e>>>14|oe<<18)^($e>>>18|oe<<14)^($e<<23|oe>>>9))+(Ot>>>0<St>>>0?1:0),Ot=Ot+Rr,rt=rt+Mn+(Ot>>>0<Rr>>>0?1:0),Ot=Ot+to,rt=rt+$s+(Ot>>>0<to>>>0?1:0),Ot=Ot+Ne,rt=rt+wt+(Ot>>>0<Ne>>>0?1:0),Ne=Zr+Tr,Ar=yt+Ar+(Ne>>>0<Zr>>>0?1:0),He=Ue,St=We,Ue=me,We=Be,me=$e,Be=oe,oe=ke+Ot|0,$e=Fe+rt+(oe>>>0<ke>>>0?1:0)|0,Fe=ge,ke=he,ge=te,he=ie,te=G,ie=J,J=Ot+Ne|0,G=rt+Ar+(J>>>0<Ot>>>0?1:0)|0}C=m.low=C+J,m.high=S+G+(C>>>0<J>>>0?1:0),H=p.low=H+ie,p.high=D+te+(H>>>0<ie>>>0?1:0),_=d.low=_+he,d.high=K+ge+(_>>>0<he>>>0?1:0),j=v.low=j+ke,v.high=x+Fe+(j>>>0<ke>>>0?1:0),k=g.low=k+oe,g.high=U+$e+(k>>>0<oe>>>0?1:0),O=y.low=O+Be,y.high=N+me+(O>>>0<Be>>>0?1:0),T=w.low=T+We,w.high=L+Ue+(T>>>0<We>>>0?1:0),W=E.low=W+St,E.high=M+He+(W>>>0<St>>>0?1:0)},_doFinalize:function(){var l=this._data,f=l.words,m=8*this._nDataBytes,p=8*l.sigBytes;return f[p>>>5]|=128<<24-p%32,f[(p+128>>>10<<5)+30]=Math.floor(m/4294967296),f[(p+128>>>10<<5)+31]=m,l.sigBytes=4*f.length,this._process(),this._hash.toX32()},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l},blockSize:32}),t.SHA512=r._createHelper(o),t.HmacSHA512=r._createHmacHelper(o)})();(function(){var e=Oe,s=e.x64,t=s.Word,r=s.WordArray,s=e.algo,n=s.SHA512,s=s.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var o=n._doFinalize.call(this);return o.sigBytes-=16,o}});e.SHA384=n._createHelper(s),e.HmacSHA384=n._createHmacHelper(s)})();(function(){var e=Oe,l=e.lib,t=l.WordArray,r=l.Hasher,l=e.algo,n=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=t.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),o=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),i=t.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),a=t.create([0,1518500249,1859775393,2400959708,2840853838]),u=t.create([1352829926,1548603684,1836072691,2053994217,0]),l=l.RIPEMD160=r.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(f,m){for(var p=0;16>p;p++){var d=m+p,v=f[d];f[d]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var d=this._hash.words,v=a.words,g=u.words,y=n.words,w=s.words,E=o.words,S=i.words,C,D,H,K,_,x,j,U,k,N;x=C=d[0],j=D=d[1],U=H=d[2],k=K=d[3],N=_=d[4];for(var O,p=0;80>p;p+=1)O=C+f[m+y[p]]|0,O=16>p?O+((D^H^K)+v[0]):32>p?O+((D&H|~D&K)+v[1]):48>p?O+(((D|~H)^K)+v[2]):64>p?O+((D&K|H&~K)+v[3]):O+((D^(H|~K))+v[4]),O|=0,O=O<<E[p]|O>>>32-E[p],O=O+_|0,C=_,_=K,K=H<<10|H>>>22,H=D,D=O,O=x+f[m+w[p]]|0,O=16>p?O+((j^(U|~k))+g[0]):32>p?O+((j&k|U&~k)+g[1]):48>p?O+(((j|~U)^k)+g[2]):64>p?O+((j&U|~j&k)+g[3]):O+((j^U^k)+g[4]),O|=0,O=O<<S[p]|O>>>32-S[p],O=O+N|0,x=N,N=k,k=U<<10|U>>>22,U=j,j=O;O=d[1]+H+k|0,d[1]=d[2]+K+N|0,d[2]=d[3]+_+x|0,d[3]=d[4]+C+j|0,d[4]=d[0]+D+U|0,d[0]=O},_doFinalize:function(){var f=this._data,m=f.words,p=8*this._nDataBytes,d=8*f.sigBytes;for(m[d>>>5]|=128<<24-d%32,m[(d+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,f.sigBytes=4*(m.length+1),this._process(),f=this._hash,m=f.words,p=0;5>p;p++)d=m[p],m[p]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;return f},clone:function(){var f=r.clone.call(this);return f._hash=this._hash.clone(),f}});e.RIPEMD160=r._createHelper(l),e.HmacRIPEMD160=r._createHmacHelper(l)})(Math);(function(){var e=Oe,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(r,n){r=this._hasher=new r.init,typeof n=="string"&&(n=t.parse(n));var s=r.blockSize,o=4*s;n.sigBytes>o&&(n=r.finalize(n)),n.clamp();for(var i=this._oKey=n.clone(),a=this._iKey=n.clone(),u=i.words,l=a.words,f=0;f<s;f++)u[f]^=1549556828,l[f]^=909522486;i.sigBytes=a.sigBytes=o,this.reset()},reset:function(){var r=this._hasher;r.reset(),r.update(this._iKey)},update:function(r){return this._hasher.update(r),this},finalize:function(r){var n=this._hasher;return r=n.finalize(r),n.reset(),n.finalize(this._oKey.clone().concat(r))}})})();(function(){var e=Oe,n=e.lib,t=n.Base,r=n.WordArray,n=e.algo,s=n.HMAC,o=n.PBKDF2=t.extend({cfg:t.extend({keySize:4,hasher:n.SHA1,iterations:1}),init:function(i){this.cfg=this.cfg.extend(i)},compute:function(i,a){for(var v=this.cfg,u=s.create(v.hasher,i),l=r.create(),f=r.create([1]),m=l.words,p=f.words,d=v.keySize,v=v.iterations;m.length<d;){var g=u.update(a).finalize(f);u.reset();for(var y=g.words,w=y.length,E=g,S=1;S<v;S++){E=u.finalize(E),u.reset();for(var C=E.words,D=0;D<w;D++)y[D]^=C[D]}l.concat(g),p[0]++}return l.sigBytes=4*d,l}});e.PBKDF2=function(i,a,u){return o.create(u).compute(i,a)}})();var Ad="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bA="=";function uu(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=Ad.charAt(r>>6)+Ad.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=Ad.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=Ad.charAt(r>>2)+Ad.charAt((r&3)<<4)),bA)for(;(n.length&3)>0;)n+=bA;return n}function _d(e){var t="",r,n=0,s,o;for(r=0;r<e.length&&e.charAt(r)!=bA;++r)o=Ad.indexOf(e.charAt(r)),!(o<0)&&(n==0?(t+=ou(o>>2),s=o&3,n=1):n==1?(t+=ou(s<<2|o>>4),s=o&15,n=2):n==2?(t+=ou(s),t+=ou(o>>2),s=o&3,n=3):(t+=ou(s<<2|o>>4),t+=ou(o&15),n=0));return n==1&&(t+=ou(s<<2)),t}function PI(e){var t=_d(e),r,n=new Array;for(r=0;2*r<t.length;++r)n[r]=parseInt(t.substring(2*r,2*r+2),16);return n}var Sc,LW=0xdeadbeefcafe,RI=(LW&16777215)==15715070;function se(e,t,r){e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function jt(){return new se(null)}function UW(e,t,r,n,s,o){for(;--o>=0;){var i=t*this[e++]+r[n]+s;s=Math.floor(i/67108864),r[n++]=i&67108863}return s}function HW(e,t,r,n,s,o){for(var i=t&32767,a=t>>15;--o>=0;){var u=this[e]&32767,l=this[e++]>>15,f=a*u+l*i;u=i*u+((f&32767)<<15)+r[n]+(s&1073741823),s=(u>>>30)+(f>>>15)+a*l+(s>>>30),r[n++]=u&1073741823}return s}function MW(e,t,r,n,s,o){for(var i=t&16383,a=t>>14;--o>=0;){var u=this[e]&16383,l=this[e++]>>14,f=a*u+l*i;u=i*u+((f&16383)<<14)+r[n]+s,s=(u>>28)+(f>>14)+a*l,r[n++]=u&268435455}return s}RI&&Yp.appName=="Microsoft Internet Explorer"?(se.prototype.am=HW,Sc=30):RI&&Yp.appName!="Netscape"?(se.prototype.am=UW,Sc=26):(se.prototype.am=MW,Sc=28);se.prototype.DB=Sc;se.prototype.DM=(1<<Sc)-1;se.prototype.DV=1<<Sc;var CA=52;se.prototype.FV=Math.pow(2,CA);se.prototype.F1=CA-Sc;se.prototype.F2=2*Sc-CA;var qW="0123456789abcdefghijklmnopqrstuvwxyz",Zg=new Array,Cd,Hi;Cd=48;for(Hi=0;Hi<=9;++Hi)Zg[Cd++]=Hi;Cd=97;for(Hi=10;Hi<36;++Hi)Zg[Cd++]=Hi;Cd=65;for(Hi=10;Hi<36;++Hi)Zg[Cd++]=Hi;function ou(e){return qW.charAt(e)}function OI(e,t){var r=Zg[e.charCodeAt(t)];return r??-1}function jW(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function KW(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function Ac(e){var t=jt();return t.fromInt(e),t}function VW(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,s=!1,o=0;--n>=0;){var i=r==8?e[n]&255:OI(e,n);if(i<0){e.charAt(n)=="-"&&(s=!0);continue}s=!1,o==0?this[this.t++]=i:o+r>this.DB?(this[this.t-1]|=(i&(1<<this.DB-o)-1)<<o,this[this.t++]=i>>this.DB-o):this[this.t-1]|=i<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&(e[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&se.ZERO.subTo(this,this)}function GW(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function zW(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,n,s=!1,o="",i=this.t,a=this.DB-i*this.DB%t;if(i-- >0)for(a<this.DB&&(n=this[i]>>a)>0&&(s=!0,o=ou(n));i>=0;)a<t?(n=(this[i]&(1<<a)-1)<<t-a,n|=this[--i]>>(a+=this.DB-t)):(n=this[i]>>(a-=t)&r,a<=0&&(a+=this.DB,--i)),n>0&&(s=!0),s&&(o+=ou(n));return s?o:"0"}function YW(){var e=jt();return se.ZERO.subTo(this,e),e}function WW(){return this.s<0?this.negate():this}function XW(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this[r]-e[r])!=0)return t;return 0}function Qg(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function JW(){return this.t<=0?0:this.DB*(this.t-1)+Qg(this[this.t-1]^this.s&this.DM)}function ZW(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function QW(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function eX(e,t){var r=e%this.DB,n=this.DB-r,s=(1<<n)-1,o=Math.floor(e/this.DB),i=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)t[a+o+1]=this[a]>>n|i,i=(this[a]&s)<<r;for(a=o-1;a>=0;--a)t[a]=0;t[o]=i,t.t=this.t+o+1,t.s=this.s,t.clamp()}function tX(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,s=this.DB-n,o=(1<<n)-1;t[0]=this[r]>>n;for(var i=r+1;i<this.t;++i)t[i-r-1]|=(this[i]&o)<<s,t[i-r]=this[i]>>n;n>0&&(t[this.t-r-1]|=(this.s&o)<<s),t.t=this.t-r,t.clamp()}function rX(e,t){for(var r=0,n=0,s=Math.min(e.t,this.t);r<s;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function nX(e,t){var r=this.abs(),n=e.abs(),s=r.t;for(t.t=s+n.t;--s>=0;)t[s]=0;for(s=0;s<n.t;++s)t[s+r.t]=r.am(0,n[s],t,s,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&se.ZERO.subTo(t,t)}function sX(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function iX(e,t,r){var n=e.abs();if(n.t<=0)throw"BigInteger divide by zero";var s=this.abs();if(s.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=jt());var o=jt(),i=this.s,a=e.s,u=this.DB-Qg(n[n.t-1]);u>0?(n.lShiftTo(u,o),s.lShiftTo(u,r)):(n.copyTo(o),s.copyTo(r));var l=o.t,f=o[l-1];if(f!=0){var m=f*(1<<this.F1)+(l>1?o[l-2]>>this.F2:0),p=this.FV/m,d=(1<<this.F1)/m,v=1<<this.F2,g=r.t,y=g-l,w=t??jt();for(o.dlShiftTo(y,w),r.compareTo(w)>=0&&(r[r.t++]=1,r.subTo(w,r)),se.ONE.dlShiftTo(l,w),w.subTo(o,o);o.t<l;)o[o.t++]=0;for(;--y>=0;){var E=r[--g]==f?this.DM:Math.floor(r[g]*p+(r[g-1]+v)*d);if((r[g]+=o.am(0,E,r,y,0,l))<E)for(o.dlShiftTo(y,w),r.subTo(w,r);r[g]<--E;)r.subTo(w,r)}t!=null&&(r.drShiftTo(l,t),i!=a&&se.ZERO.subTo(t,t)),r.t=l,r.clamp(),u>0&&r.rShiftTo(u,r),i<0&&se.ZERO.subTo(r,r)}}function oX(e){var t=jt();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(se.ZERO)>0&&e.subTo(t,t),t}function ql(e){this.m=e}function aX(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function uX(e){return e}function cX(e){e.divRemTo(this.m,null,e)}function lX(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function fX(e,t){e.squareTo(t),this.reduce(t)}ql.prototype.convert=aX;ql.prototype.revert=uX;ql.prototype.reduce=cX;ql.prototype.mulTo=lX;ql.prototype.sqrTo=fX;function dX(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function jl(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function hX(e){var t=jt();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(se.ZERO)>0&&this.m.subTo(t,t),t}function pX(e){var t=jt();return e.copyTo(t),this.reduce(t),t}function mX(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e[t]&32767,n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function gX(e,t){e.squareTo(t),this.reduce(t)}function vX(e,t,r){e.multiplyTo(t,r),this.reduce(r)}jl.prototype.convert=hX;jl.prototype.revert=pX;jl.prototype.reduce=mX;jl.prototype.mulTo=vX;jl.prototype.sqrTo=gX;function wX(){return(this.t>0?this[0]&1:this.s)==0}function yX(e,t){if(e>4294967295||e<1)return se.ONE;var r=jt(),n=jt(),s=t.convert(this),o=Qg(e)-1;for(s.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,s,r);else{var i=r;r=n,n=i}return t.revert(r)}function EX(e,t){var r;return e<256||t.isEven()?r=new ql(t):r=new jl(t),this.exp(e,r)}se.prototype.copyTo=jW;se.prototype.fromInt=KW;se.prototype.fromString=VW;se.prototype.clamp=GW;se.prototype.dlShiftTo=ZW;se.prototype.drShiftTo=QW;se.prototype.lShiftTo=eX;se.prototype.rShiftTo=tX;se.prototype.subTo=rX;se.prototype.multiplyTo=nX;se.prototype.squareTo=sX;se.prototype.divRemTo=iX;se.prototype.invDigit=dX;se.prototype.isEven=wX;se.prototype.exp=yX;se.prototype.toString=zW;se.prototype.negate=YW;se.prototype.abs=WW;se.prototype.compareTo=XW;se.prototype.bitLength=JW;se.prototype.mod=oX;se.prototype.modPowInt=EX;se.ZERO=Ac(0);se.ONE=Ac(1);function bX(){var e=jt();return this.copyTo(e),e}function AX(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function SX(){return this.t==0?this.s:this[0]<<24>>24}function _X(){return this.t==0?this.s:this[0]<<16>>16}function CX(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function DX(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function FX(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Ac(r),s=jt(),o=jt(),i="";for(this.divRemTo(n,s,o);s.signum()>0;)i=(r+o.intValue()).toString(e).substr(1)+i,s.divRemTo(n,s,o);return o.intValue().toString(e)+i}function BX(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),s=!1,o=0,i=0,a=0;a<e.length;++a){var u=OI(e,a);if(u<0){e.charAt(a)=="-"&&this.signum()==0&&(s=!0);continue}i=t*i+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(i,0),o=0,i=0)}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(i,0)),s&&se.ZERO.subTo(this,this)}function IX(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(se.ONE.shiftLeft(e-1),DA,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(se.ONE.shiftLeft(e-1),this);else{var n=new Array,s=e&7;n.length=(e>>3)+1,t.nextBytes(n),s>0?n[0]&=(1<<s)-1:n[0]=0,this.fromString(n,256)}}function $X(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,s=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[s++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),(n&128)!=0&&(n|=-256),s==0&&(this.s&128)!=(n&128)&&++s,(s>0||n!=this.s)&&(t[s++]=n);return t}function xX(e){return this.compareTo(e)==0}function RX(e){return this.compareTo(e)<0?this:e}function TX(e){return this.compareTo(e)>0?this:e}function kX(e,t,r){var n,s,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(s=e.s&this.DM,n=o;n<this.t;++n)r[n]=t(this[n],s);r.t=this.t}else{for(s=this.s&this.DM,n=o;n<e.t;++n)r[n]=t(s,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function PX(e,t){return e&t}function OX(e){var t=jt();return this.bitwiseTo(e,PX,t),t}function DA(e,t){return e|t}function NX(e){var t=jt();return this.bitwiseTo(e,DA,t),t}function NI(e,t){return e^t}function LX(e){var t=jt();return this.bitwiseTo(e,NI,t),t}function LI(e,t){return e&~t}function UX(e){var t=jt();return this.bitwiseTo(e,LI,t),t}function HX(){for(var e=jt(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function MX(e){var t=jt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function qX(e){var t=jt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function jX(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function KX(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+jX(this[e]);return this.s<0?this.t*this.DB:-1}function VX(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function GX(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=VX(this[r]^t);return e}function zX(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function YX(e,t){var r=se.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function WX(e){return this.changeBit(e,DA)}function XX(e){return this.changeBit(e,LI)}function JX(e){return this.changeBit(e,NI)}function ZX(e,t){for(var r=0,n=0,s=Math.min(e.t,this.t);r<s;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function QX(e){var t=jt();return this.addTo(e,t),t}function eJ(e){var t=jt();return this.subTo(e,t),t}function tJ(e){var t=jt();return this.multiplyTo(e,t),t}function rJ(){var e=jt();return this.squareTo(e),e}function nJ(e){var t=jt();return this.divRemTo(e,t,null),t}function sJ(e){var t=jt();return this.divRemTo(e,null,t),t}function iJ(e){var t=jt(),r=jt();return this.divRemTo(e,t,r),new Array(t,r)}function oJ(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function aJ(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function Xp(){}function UI(e){return e}function uJ(e,t,r){e.multiplyTo(t,r)}function cJ(e,t){e.squareTo(t)}Xp.prototype.convert=UI;Xp.prototype.revert=UI;Xp.prototype.mulTo=uJ;Xp.prototype.sqrTo=cJ;function lJ(e){return this.exp(e,new Xp)}function fJ(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;var s;for(s=r.t-this.t;n<s;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(s=Math.min(e.t,t);n<s;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function dJ(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Dd(e){this.r2=jt(),this.q3=jt(),se.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function hJ(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=jt();return e.copyTo(t),this.reduce(t),t}function pJ(e){return e}function mJ(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function gJ(e,t){e.squareTo(t),this.reduce(t)}function vJ(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Dd.prototype.convert=hJ;Dd.prototype.revert=pJ;Dd.prototype.reduce=mJ;Dd.prototype.mulTo=vJ;Dd.prototype.sqrTo=gJ;function wJ(e,t){if(e.signum()<0)return this.modInverse(t).modPow(e.negate(),t);var r=e.bitLength(),n,s=Ac(1),o;if(r<=0)return s;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?o=new ql(t):t.isEven()?o=new Dd(t):o=new jl(t);var i=new Array,a=3,u=n-1,l=(1<<n)-1;if(i[1]=o.convert(this),n>1){var f=jt();for(o.sqrTo(i[1],f);a<=l;)i[a]=jt(),o.mulTo(f,i[a-2],i[a]),a+=2}var m=e.t-1,p,d=!0,v=jt(),g;for(r=Qg(e[m])-1;m>=0;){for(r>=u?p=e[m]>>r-u&l:(p=(e[m]&(1<<r+1)-1)<<u-r,m>0&&(p|=e[m-1]>>this.DB+r-u)),a=n;(p&1)==0;)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--m),d)i[p].copyTo(s),d=!1;else{for(;a>1;)o.sqrTo(s,v),o.sqrTo(v,s),a-=2;a>0?o.sqrTo(s,v):(g=s,s=v,v=g),o.mulTo(v,i[p],s)}for(;m>=0&&(e[m]&1<<r)==0;)o.sqrTo(s,v),g=s,s=v,v=g,--r<0&&(r=this.DB-1,--m)}return o.revert(s)}function yJ(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var s=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(s<o&&(o=s),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(s=t.getLowestSetBit())>0&&t.rShiftTo(s,t),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function EJ(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function bJ(e){if(e.signum()==0)return se.ZERO;var t=this.mod(e),r=e.isEven();if(t.isEven()&&r||t.signum()==0)return se.ZERO;for(var n=e.clone(),s=t.clone(),o=Ac(1),i=Ac(0),a=Ac(0),u=Ac(1);n.signum()!=0;){for(;n.isEven();)n.rShiftTo(1,n),r?((!o.isEven()||!i.isEven())&&(o.addTo(t,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;s.isEven();)s.rShiftTo(1,s),r?((!a.isEven()||!u.isEven())&&(a.addTo(t,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(s)>=0?(n.subTo(s,n),r&&o.subTo(a,o),i.subTo(u,i)):(s.subTo(n,s),r&&a.subTo(o,a),u.subTo(i,u))}if(s.compareTo(se.ONE)!=0)return se.ZERO;if(u.compareTo(e)>=0)return u.subtract(e);if(u.signum()<0)u.addTo(e,u);else return u;return u.signum()<0?u.add(e):u}var Es=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],AJ=(1<<26)/Es[Es.length-1];function SJ(e){if(this.signum()<=0)return!1;var t,r=this.abs();if(r.t==1&&r[0]<=Es[Es.length-1]){for(t=0;t<Es.length;++t)if(r[0]==Es[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Es.length;){for(var n=Es[t],s=t+1;s<Es.length&&n<AJ;)n*=Es[s++];for(n=r.modInt(n);t<s;)if(n%Es[t++]==0)return!1}return r.millerRabin(e)}function _J(e){if(this.signum()<=0)return!1;var t=this.subtract(se.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);e=e+1>>1,e>Es.length&&(e=Es.length);for(var s=jt(),o=0;o<e;++o){s.fromInt(Es[Math.floor(Math.random()*Es.length)]);var i=s.modPow(n,this);if(i.compareTo(se.ONE)!=0&&i.compareTo(t)!=0){for(var a=1;a++<r&&i.compareTo(t)!=0;)if(i=i.modPowInt(2,this),i.compareTo(se.ONE)==0)return!1;if(i.compareTo(t)!=0)return!1}}return!0}se.prototype.chunkSize=CX;se.prototype.toRadix=FX;se.prototype.fromRadix=BX;se.prototype.fromNumber=IX;se.prototype.bitwiseTo=kX;se.prototype.changeBit=YX;se.prototype.addTo=ZX;se.prototype.dMultiply=oJ;se.prototype.dAddOffset=aJ;se.prototype.multiplyLowerTo=fJ;se.prototype.multiplyUpperTo=dJ;se.prototype.modInt=EJ;se.prototype.millerRabin=_J;se.prototype.clone=bX;se.prototype.intValue=AX;se.prototype.byteValue=SX;se.prototype.shortValue=_X;se.prototype.signum=DX;se.prototype.toByteArray=$X;se.prototype.equals=xX;se.prototype.min=RX;se.prototype.max=TX;se.prototype.and=OX;se.prototype.or=NX;se.prototype.xor=LX;se.prototype.andNot=UX;se.prototype.not=HX;se.prototype.shiftLeft=MX;se.prototype.shiftRight=qX;se.prototype.getLowestSetBit=KX;se.prototype.bitCount=GX;se.prototype.testBit=zX;se.prototype.setBit=WX;se.prototype.clearBit=XX;se.prototype.flipBit=JX;se.prototype.add=QX;se.prototype.subtract=eJ;se.prototype.multiply=tJ;se.prototype.divide=nJ;se.prototype.remainder=sJ;se.prototype.divideAndRemainder=iJ;se.prototype.modPow=wJ;se.prototype.modInverse=bJ;se.prototype.pow=lJ;se.prototype.gcd=yJ;se.prototype.isProbablePrime=SJ;se.prototype.square=rJ;se.prototype.sqrt=function(){for(var e=se.ZERO.setBit(this.bitLength()/2),t=e;;){var r=e.add(this.divide(e)).shiftRight(1);if(r.equals(e)||r.equals(t))return r;t=e,e=r}};function FA(){this.i=0,this.j=0,this.S=new Array}function CJ(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}function DJ(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}FA.prototype.init=CJ;FA.prototype.next=DJ;function FJ(){return new FA}var zp=256;var zg,qs,Mr;function BJ(e){qs[Mr++]^=e&255,qs[Mr++]^=e>>8&255,qs[Mr++]^=e>>16&255,qs[Mr++]^=e>>24&255,Mr>=zp&&(Mr-=zp)}function BA(){BJ(new Date().getTime())}if(qs==null){if(qs=new Array,Mr=0,typeof bd<"u"&&(bd.crypto!==void 0||bd.msCrypto!==void 0)){if(au=bd.crypto||bd.msCrypto,au.getRandomValues)for(yA=new Uint8Array(32),au.getRandomValues(yA),ts=0;ts<32;++ts)qs[Mr++]=yA[ts];else if(Yp.appName=="Netscape"&&Yp.appVersion<"5")for(EA=bd.crypto.random(32),ts=0;ts<EA.length;++ts)qs[Mr++]=EA.charCodeAt(ts)&255}if(Mr<zp&&typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues)for(Yg=new Uint8Array(zp-Mr),globalThis.crypto.getRandomValues(Yg),ts=0;ts<Yg.length;++ts)qs[Mr++]=Yg[ts];for(;Mr<zp;)ts=Math.floor(65536*Math.random()),qs[Mr++]=ts>>>8,qs[Mr++]=ts&255;Mr=0,BA()}var ts,au,yA,EA,Yg;function IJ(){if(zg==null){for(BA(),zg=FJ(),zg.init(qs),Mr=0;Mr<qs.length;++Mr)qs[Mr]=0;Mr=0}return zg.next()}function $J(e){var t;for(t=0;t<e.length;++t)e[t]=IJ()}function Fd(){}Fd.prototype.nextBytes=$J;function js(e,t){return new se(e,t)}function dt(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function xJ(e,t){if(this.isPublic=!0,this.isPrivate=!1,typeof e!="string")this.n=e,this.e=t;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=js(e,16),this.e=parseInt(t,16);else throw"Invalid RSA public key";if(this.n==null||typeof this.n.compareTo!="function"||this.n.compareTo(se.ONE)<=0||this.e==null||isNaN(this.e)||this.e<=0)throw"Invalid RSA public key"}function RJ(e){return e.modPowInt(this.e,this.n)}dt.prototype.doPublic=RJ;dt.prototype.setPublic=xJ;dt.prototype.type="RSA";function TJ(e,t,r){if(this.isPrivate=!0,typeof e!="string")this.n=e,this.e=t,this.d=r;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=js(e,16),this.e=parseInt(t,16),this.d=js(r,16);else throw"Invalid RSA private key"}function kJ(e,t,r,n,s,o,i,a){if(this.isPrivate=!0,this.isPublic=!1,e==null)throw"RSASetPrivateEx N == null";if(t==null)throw"RSASetPrivateEx E == null";if(e.length==0)throw"RSASetPrivateEx N.length == 0";if(t.length==0)throw"RSASetPrivateEx E.length == 0";if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=js(e,16),this.e=parseInt(t,16),this.d=js(r,16),this.p=js(n,16),this.q=js(s,16),this.dmp1=js(o,16),this.dmq1=js(i,16),this.coeff=js(a,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function PJ(e,t){var r=new Fd,n=e>>1;this.e=parseInt(t,16);for(var s=new se(t,16),o=e/2-100,i=se.ONE.shiftLeft(o);;){for(;this.p=new se(e-n,1,r),!(this.p.subtract(se.ONE).gcd(s).compareTo(se.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new se(n,1,r),!(this.q.subtract(se.ONE).gcd(s).compareTo(se.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var u=this.q.subtract(this.p).abs();if(!(u.bitLength()<o||u.compareTo(i)<=0)){var l=this.p.subtract(se.ONE),f=this.q.subtract(se.ONE),m=l.multiply(f);if(m.gcd(s).compareTo(se.ONE)==0&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=s.modInverse(m),this.dmp1=this.d.mod(l),this.dmq1=this.d.mod(f),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0}function OJ(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}dt.prototype.doPrivate=OJ;dt.prototype.setPrivate=TJ;dt.prototype.setPrivateEx=kJ;dt.prototype.generate=PJ;function nn(e,t){this.x=t,this.q=e}function NJ(e){return e==this?!0:this.q.equals(e.q)&&this.x.equals(e.x)}function LJ(){return this.x}function UJ(){return new nn(this.q,this.x.negate().mod(this.q))}function HJ(e){return new nn(this.q,this.x.add(e.toBigInteger()).mod(this.q))}function MJ(e){return new nn(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}function qJ(e){return new nn(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}function jJ(){return new nn(this.q,this.x.square().mod(this.q))}function KJ(e){return new nn(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}nn.prototype.equals=NJ;nn.prototype.toBigInteger=LJ;nn.prototype.negate=UJ;nn.prototype.add=HJ;nn.prototype.subtract=MJ;nn.prototype.multiply=qJ;nn.prototype.square=jJ;nn.prototype.divide=KJ;nn.prototype.sqrt=function(){return new nn(this.q,this.x.sqrt().mod(this.q))};function Zt(e,t,r,n){this.curve=e,this.x=t,this.y=r,n==null?this.z=se.ONE:this.z=n,this.zinv=null}function VJ(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function GJ(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function zJ(e){if(e==this)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return this.isInfinity();var t,r;return t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),t.equals(se.ZERO)?(r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q),r.equals(se.ZERO)):!1}function YJ(){return this.x==null&&this.y==null?!0:this.z.equals(se.ZERO)&&!this.y.toBigInteger().equals(se.ZERO)}function WJ(){return new Zt(this.curve,this.x,this.y.negate(),this.z)}function XJ(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(se.ZERO.equals(r))return se.ZERO.equals(t)?this.twice():this.curve.getInfinity();var n=new se("3"),s=this.x.toBigInteger(),o=this.y.toBigInteger(),i=e.x.toBigInteger(),a=e.y.toBigInteger(),u=r.square(),l=u.multiply(r),f=s.multiply(u),m=t.square().multiply(this.z),p=m.subtract(f.shiftLeft(1)).multiply(e.z).subtract(l).multiply(r).mod(this.curve.q),d=f.multiply(n).multiply(t).subtract(o.multiply(l)).subtract(m.multiply(t)).multiply(e.z).add(t.multiply(l)).mod(this.curve.q),v=l.multiply(this.z).multiply(e.z).mod(this.curve.q);return new Zt(this.curve,this.curve.fromBigInteger(p),this.curve.fromBigInteger(d),v)}function JJ(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=new se("3"),t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),s=n.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),i=t.square().multiply(e);se.ZERO.equals(o)||(i=i.add(this.z.square().multiply(o))),i=i.mod(this.curve.q);var a=i.square().subtract(t.shiftLeft(3).multiply(s)).shiftLeft(1).multiply(n).mod(this.curve.q),u=i.multiply(e).multiply(t).subtract(s.shiftLeft(1)).shiftLeft(2).multiply(s).subtract(i.square().multiply(i)).mod(this.curve.q),l=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new Zt(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),l)}function ZJ(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,r=t.multiply(new se("3")),n=this.negate(),s=this,o=this.curve.q.subtract(e),i=o.multiply(new se("3")),a=new Zt(this.curve,this.x,this.y),u=a.negate(),l;for(l=r.bitLength()-2;l>0;--l){s=s.twice();var f=r.testBit(l),m=t.testBit(l);f!=m&&(s=s.add(f?this:n))}for(l=i.bitLength()-2;l>0;--l){a=a.twice();var p=i.testBit(l),d=o.testBit(l);p!=d&&(a=a.add(p?a:u))}return s}function QJ(e,t,r){var n;e.bitLength()>r.bitLength()?n=e.bitLength()-1:n=r.bitLength()-1;for(var s=this.curve.getInfinity(),o=this.add(t);n>=0;)s=s.twice(),e.testBit(n)?r.testBit(n)?s=s.add(o):s=s.add(this):r.testBit(n)&&(s=s.add(t)),--n;return s}Zt.prototype.getX=VJ;Zt.prototype.getY=GJ;Zt.prototype.equals=zJ;Zt.prototype.isInfinity=YJ;Zt.prototype.negate=WJ;Zt.prototype.add=XJ;Zt.prototype.twice=JJ;Zt.prototype.multiply=ZJ;Zt.prototype.multiplyTwo=QJ;function cu(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new Zt(this,null,null)}function eZ(){return this.q}function tZ(){return this.a}function rZ(){return this.b}function nZ(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function sZ(){return this.infinity}function iZ(e){return new nn(this.q,e)}function oZ(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=e.substr(0,2),r=e.substr(2),n=this.fromBigInteger(new se(l,16)),s=this.getA(),o=this.getB(),i=n.square().add(s).multiply(n).add(o),a=i.sqrt();return t=="03"&&(a=a.negate()),new Zt(this,n,a);case 4:case 6:case 7:var u=(e.length-2)/2,l=e.substr(2,u),f=e.substr(u+2,u);return new Zt(this,this.fromBigInteger(new se(l,16)),this.fromBigInteger(new se(f,16)));default:return null}}cu.prototype.getQ=eZ;cu.prototype.getA=tZ;cu.prototype.getB=rZ;cu.prototype.equals=nZ;cu.prototype.getInfinity=sZ;cu.prototype.fromBigInteger=iZ;cu.prototype.decodePointHex=oZ;nn.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};Zt.prototype.getEncoded=function(e){var t=function(o,i){var a=o.toByteArrayUnsigned();if(i<a.length)a=a.slice(a.length-i);else for(;i>a.length;)a.unshift(0);return a},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),s=t(r,32);return e?n.isEven()?s.unshift(2):s.unshift(3):(s.unshift(4),s=s.concat(t(n,32))),s};Zt.decodeFrom=function(e,t){var r=t[0],n=t.length-1,s=t.slice(1,1+n/2),o=t.slice(1+n/2,1+n);s.unshift(0),o.unshift(0);var i=new se(s),a=new se(o);return new Zt(e,e.fromBigInteger(i),e.fromBigInteger(a))};Zt.decodeFromHex=function(e,t){var r=t.substr(0,2),n=t.length-2,s=t.substr(2,n/2),o=t.substr(2+n/2,n/2),i=new se(s,16),a=new se(o,16);return new Zt(e,e.fromBigInteger(i),e.fromBigInteger(a))};Zt.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),r=e.y.subtract(this.y),n=r.divide(t),s=n.square().subtract(this.x).subtract(e.x),o=n.multiply(this.x.subtract(s)).subtract(this.y);return new Zt(this.curve,s,o)};Zt.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=this.curve.fromBigInteger(se.valueOf(2)),t=this.curve.fromBigInteger(se.valueOf(3)),r=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),n=r.square().subtract(this.x.multiply(e)),s=r.multiply(this.x.subtract(n)).subtract(this.y);return new Zt(this.curve,n,s)};Zt.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,r=t.multiply(new se("3")),n=this.negate(),s=this,o;for(o=r.bitLength()-2;o>0;--o){s=s.twice();var i=r.testBit(o),a=t.testBit(o);i!=a&&(s=s.add2D(i?this:n))}return s};Zt.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),s=this.curve.getQ(),o=t.multiply(t).mod(s),i=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(s);return o.equals(i)};Zt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};Zt.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(t.compareTo(se.ONE)<0||t.compareTo(e.subtract(se.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(se.ONE)<0||r.compareTo(e.subtract(se.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var HI=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",t='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',r='(?:"'+t+'*")',n=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+r+")","g"),s=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),o={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
|
||
`,r:"\r",t:" "};function i(m,p,d){return p?o[p]:String.fromCharCode(parseInt(d,16))}var a=new String(""),u="\\",l={"{":Object,"[":Array},f=Object.hasOwnProperty;return function(m,p){var d=m.match(n),v,g=d[0],y=!1;g==="{"?v={}:g==="["?v=[]:(v=[],y=!0);for(var w,E=[v],S=1-y,C=d.length;S<C;++S){g=d[S];var D;switch(g.charCodeAt(0)){default:D=E[0],D[w||D.length]=+g,w=void 0;break;case 34:if(g=g.substring(1,g.length-1),g.indexOf(u)!==-1&&(g=g.replace(s,i)),D=E[0],!w)if(D instanceof Array)w=D.length;else{w=g||a;break}D[w]=g,w=void 0;break;case 91:D=E[0],E.unshift(D[w||D.length]=[]),w=void 0;break;case 93:E.shift();break;case 102:D=E[0],D[w||D.length]=!1,w=void 0;break;case 110:D=E[0],D[w||D.length]=null,w=void 0;break;case 116:D=E[0],D[w||D.length]=!0,w=void 0;break;case 123:D=E[0],E.unshift(D[w||D.length]={}),w=void 0;break;case 125:E.shift();break}}if(y){if(E.length!==1)throw new Error;v=v[0]}else if(E.length)throw new Error;if(p){var H=function(K,_){var x=K[_];if(x&&typeof x=="object"){var j=null;for(var U in x)if(f.call(x,U)&&x!==K){var k=H(x,U);k!==void 0?x[U]=k:(j||(j=[]),j.push(U))}if(j)for(var N=j.length;--N>=0;)delete x[j[N]]}return p.call(K,_,x)};v=H({"":v},"")}return v}})();(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});A.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){return Zp(e)},this.getPEMStringFromHex=function(e,t){return rs(e,t)},this.newObject=function(e){var t=A,r=t.asn1,n=r.ASN1Object,s=r.DERBoolean,o=r.DERInteger,i=r.DERBitString,a=r.DEROctetString,u=r.DERNull,l=r.DERObjectIdentifier,f=r.DEREnumerated,m=r.DERUTF8String,p=r.DERNumericString,d=r.DERPrintableString,v=r.DERTeletexString,g=r.DERIA5String,y=r.DERUTCTime,w=r.DERGeneralizedTime,E=r.DERVisibleString,S=r.DERBMPString,C=r.DERSequence,D=r.DERSet,H=r.DERTaggedObject,K=r.ASN1Util.newObject;if(e instanceof r.ASN1Object)return e;var _=Object.keys(e);if(_.length!=1)throw new Error("key of param shall be only one.");var x=_[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+x+":")==-1)throw new Error("undefined key: "+x);if(x=="bool")return new s(e[x]);if(x=="int")return new o(e[x]);if(x=="bitstr")return new i(e[x]);if(x=="octstr")return new a(e[x]);if(x=="null")return new u(e[x]);if(x=="oid")return new l(e[x]);if(x=="enum")return new f(e[x]);if(x=="utf8str")return new m(e[x]);if(x=="numstr")return new p(e[x]);if(x=="prnstr")return new d(e[x]);if(x=="telstr")return new v(e[x]);if(x=="ia5str")return new g(e[x]);if(x=="utctime")return new y(e[x]);if(x=="gentime")return new w(e[x]);if(x=="visstr")return new E(e[x]);if(x=="bmpstr")return new S(e[x]);if(x=="asn1")return new n(e[x]);if(x=="seq"){for(var j=e[x],U=[],k=0;k<j.length;k++){var N=K(j[k]);U.push(N)}return new C({array:U})}if(x=="set"){for(var j=e[x],U=[],k=0;k<j.length;k++){var N=K(j[k]);U.push(N)}return new D({array:U})}if(x=="tag"){var O=e[x];if(Object.prototype.toString.call(O)==="[object Array]"&&O.length==3){var L=K(O[2]);return new H({tag:O[0],explicit:O[1],obj:L})}else return new H(O)}},this.jsonToASN1HEX=function(e){var t=this.newObject(e);return t.tohex()}};A.asn1.ASN1Util.oidHexToInt=function(e){for(var s="",t=parseInt(e.substr(0,2),16),r=Math.floor(t/40),n=t%40,s=r+"."+n,o="",i=2;i<e.length;i+=2){var a=parseInt(e.substr(i,2),16),u=("00000000"+a.toString(2)).slice(-8);if(o=o+u.substr(1,7),u.substr(0,1)=="0"){var l=new se(o,2);s=s+"."+l.toString(10),o=""}}return s};A.asn1.ASN1Util.oidIntToHex=function(e){var t=function(a){var u=a.toString(16);return u.length==1&&(u="0"+u),u},r=function(a){var u="",l=new se(a,10),f=l.toString(2),m=7-f.length%7;m==7&&(m=0);for(var p="",d=0;d<m;d++)p+="0";f=p+f;for(var d=0;d<f.length-1;d+=7){var v=f.substr(d,7);d!=f.length-7&&(v="1"+v),u+=t(parseInt(v,2))}return u};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",s=e.split("."),o=parseInt(s[0])*40+parseInt(s[1]);n+=t(o),s.splice(0,2);for(var i=0;i<s.length;i++)n+=r(s[i]);return n};A.asn1.ASN1Object=function(e){var t=!0,r=null,n="00",s="00",o="";this.params=null,this.getLengthHexFromValue=function(){if(typeof this.hV>"u"||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+o.length+",v="+this.hV);var i=this.hV.length/2,a=i.toString(16);if(a.length%2==1&&(a="0"+a),i<128)return a;var u=a.length/2;if(u>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+i.toString(16));var l=128+u;return l.toString(16)+a},this.tohex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(i){this.params=i},e!=null&&e.tlv!=null&&(this.hTLV=e.tlv,this.isModified=!1)};A.asn1.DERAbstractString=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null,r=null;this.getString=function(){return this.s},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.s=n,this.hV=t2(this.s).toLowerCase()},this.setStringHex=function(n){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e=="string"?this.setString(e):typeof e.str<"u"?this.setString(e.str):typeof e.hex<"u"&&this.setStringHex(e.hex))};Ae(A.asn1.DERAbstractString,A.asn1.ASN1Object);A.asn1.DERAbstractTime=function(e){A.asn1.DERAbstractTime.superclass.constructor.call(this);var t=null,r=null;this.localDateToUTC=function(n){var s=n.getTime()+n.getTimezoneOffset()*6e4,o=new Date(s);return o},this.formatDate=function(n,s,o){var i=this.zeroPadding,a=this.localDateToUTC(n),u=String(a.getFullYear());s=="utc"&&(u=u.substr(2,2));var l=i(String(a.getMonth()+1),2),f=i(String(a.getDate()),2),m=i(String(a.getHours()),2),p=i(String(a.getMinutes()),2),d=i(String(a.getSeconds()),2),v=u+l+f+m+p+d;if(o===!0){var g=a.getMilliseconds();if(g!=0){var y=i(String(g),3);y=y.replace(/[0]+$/,""),v=v+"."+y}}return v+"Z"},this.zeroPadding=function(n,s){return n.length>=s?n:new Array(s-n.length+1).join("0")+n},this.setByParam=function(n){this.hV=null,this.hTLV=null,this.params=n},this.getString=function(){},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.str=n},this.setByDate=function(n){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.date=n},this.setByDateValue=function(n,s,o,i,a,u){var l=new Date(Date.UTC(n,s-1,o,i,a,u,0));this.setByDate(l)},this.getFreshValueHex=function(){return this.hV}};Ae(A.asn1.DERAbstractTime,A.asn1.ASN1Object);A.asn1.DERAbstractStructured=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null;this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof e<"u"&&typeof e.array<"u"&&(this.asn1Array=e.array)};Ae(A.asn1.DERAbstractStructured,A.asn1.ASN1Object);A.asn1.DERBoolean=function(e){A.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",e==!1?this.hTLV="010100":this.hTLV="0101ff"};Ae(A.asn1.DERBoolean,A.asn1.ASN1Object);A.asn1.DERInteger=function(e){A.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=Zp;this.setByBigInteger=function(r){this.isModified=!0,this.params={bigint:r}},this.setByInteger=function(r){this.isModified=!0,this.params=r},this.setValueHex=function(r){this.isModified=!0,this.params={hex:r}},this.getFreshValueHex=function(){var r=this.params,n=null;if(r==null)throw new Error("value not set");if(typeof r=="object"&&r.hex!=null)return this.hV=r.hex,this.hV;if(typeof r=="number")n=new se(String(r),10);else if(r.int!=null)n=new se(String(r.int),10);else if(r.bigint!=null)n=r.bigint;else throw new Error("wrong parameter");return this.hV=t(n),this.hV},e!=null&&(this.params=e)};Ae(A.asn1.DERInteger,A.asn1.ASN1Object);A.asn1.DERBitString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=A.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}A.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7<r)throw"unused bits shall be from 0 to 7: u = "+r;var s="0"+r;this.hTLV=null,this.isModified=!0,this.hV=s+n},this.setByBinaryString=function(r){r=r.replace(/0+$/,"");var n=8-r.length%8;n==8&&(n=0),r+="0000000".substr(0,n);for(var s="",o=0;o<r.length-1;o+=8){var i=r.substr(o,8),a=parseInt(i,2).toString(16);a.length==1&&(a="0"+a),s+=a}this.hTLV=null,this.isModified=!0,this.hV="0"+n+s},this.setByBooleanArray=function(r){for(var n="",s=0;s<r.length;s++)r[s]==!0?n+="1":n+="0";this.setByBinaryString(n)},this.newFalseArray=function(r){for(var n=new Array(r),s=0;s<r;s++)n[s]=!1;return n},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e=="string"&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):typeof e.hex<"u"?this.setHexValueIncludingUnusedBits(e.hex):typeof e.bin<"u"?this.setByBinaryString(e.bin):typeof e.array<"u"&&this.setByBooleanArray(e.array))};Ae(A.asn1.DERBitString,A.asn1.ASN1Object);A.asn1.DEROctetString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=A.asn1.ASN1Util.newObject(e.obj);e.hex=t.tohex()}A.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"};Ae(A.asn1.DEROctetString,A.asn1.DERAbstractString);A.asn1.DERNull=function(){A.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};Ae(A.asn1.DERNull,A.asn1.ASN1Object);A.asn1.DERObjectIdentifier=function(e){A.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var r=WI(t);if(r==null)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){var r=A.asn1.x509.OID.name2oid(t);if(r!=="")this.setValueOidString(r);else throw new Error("DERObjectIdentifier oidName undefined: "+t)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){typeof t=="string"?this.setValueNameOrOid(t):t.oid!==void 0?this.setValueNameOrOid(t.oid):t.name!==void 0?this.setValueNameOrOid(t.name):t.hex!==void 0&&this.setValueHex(t.hex)},e!==void 0&&this.setByParam(e)};Ae(A.asn1.DERObjectIdentifier,A.asn1.ASN1Object);A.asn1.DEREnumerated=function(e){A.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Zp(t)},this.setByInteger=function(t){var r=new se(String(t),10);this.setByBigInteger(r)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e.int<"u"?this.setByInteger(e.int):typeof e=="number"?this.setByInteger(e):typeof e.hex<"u"&&this.setValueHex(e.hex))};Ae(A.asn1.DEREnumerated,A.asn1.ASN1Object);A.asn1.DERUTF8String=function(e){A.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"};Ae(A.asn1.DERUTF8String,A.asn1.DERAbstractString);A.asn1.DERNumericString=function(e){A.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"};Ae(A.asn1.DERNumericString,A.asn1.DERAbstractString);A.asn1.DERPrintableString=function(e){A.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"};Ae(A.asn1.DERPrintableString,A.asn1.DERAbstractString);A.asn1.DERTeletexString=function(e){A.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"};Ae(A.asn1.DERTeletexString,A.asn1.DERAbstractString);A.asn1.DERIA5String=function(e){A.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"};Ae(A.asn1.DERIA5String,A.asn1.DERAbstractString);A.asn1.DERVisibleString=function(e){A.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"};Ae(A.asn1.DERVisibleString,A.asn1.DERAbstractString);A.asn1.DERBMPString=function(e){A.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"};Ae(A.asn1.DERBMPString,A.asn1.DERAbstractString);A.asn1.DERUTCTime=function(e){A.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.params=void 0,this.getFreshValueHex=function(){var t=this.params;if(this.params==null&&(t={date:new Date}),typeof t=="string")if(t.match(/^[0-9]{12}Z$/)||t.match(/^[0-9]{12}\.[0-9]+Z$/))this.hV=Ks(t);else throw new Error("malformed string for UTCTime: "+t);else if(t.str!=null)this.hV=Ks(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=Ks(this.formatDate(r,"utc",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=Ks(this.formatDate(t.date,"utc",n))}else t instanceof Date&&(this.hV=Ks(this.formatDate(t,"utc")));if(this.hV==null)throw new Error("parameter not specified properly for UTCTime");return this.hV},e!=null&&this.setByParam(e)};Ae(A.asn1.DERUTCTime,A.asn1.DERAbstractTime);A.asn1.DERGeneralizedTime=function(e){A.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.params=e,this.getFreshValueHex=function(){var t=this.params;if(this.params==null&&(t={date:new Date}),typeof t=="string")if(t.match(/^[0-9]{14}Z$/)||t.match(/^[0-9]{14}\.[0-9]+Z$/))this.hV=Ks(t);else throw new Error("malformed string for GeneralizedTime: "+t);else if(t.str!=null)this.hV=Ks(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=Ks(this.formatDate(r,"gen",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=Ks(this.formatDate(t.date,"gen",n))}else t instanceof Date&&(this.hV=Ks(this.formatDate(t,"gen")));if(this.hV==null)throw new Error("parameter not specified properly for GeneralizedTime");return this.hV},e!=null&&this.setByParam(e)};Ae(A.asn1.DERGeneralizedTime,A.asn1.DERAbstractTime);A.asn1.DERSequence=function(e){A.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var t="",r=0;r<this.asn1Array.length;r++){var n=this.asn1Array[r];t+=n.tohex()}return this.hV=t,this.hV}};Ae(A.asn1.DERSequence,A.asn1.DERAbstractStructured);A.asn1.DERSet=function(e){A.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,r=0;r<this.asn1Array.length;r++){var n=this.asn1Array[r];t.push(n.tohex())}return this.sortFlag==!0&&t.sort(),this.hV=t.join(""),this.hV},typeof e<"u"&&typeof e.sortflag<"u"&&e.sortflag==!1&&(this.sortFlag=!1)};Ae(A.asn1.DERSet,A.asn1.DERAbstractStructured);A.asn1.DERTaggedObject=function(e){A.asn1.DERTaggedObject.superclass.constructor.call(this);var t=A.asn1,r=xe,n=r.getV,s=r.isASN1HEX,o=t.ASN1Util.newObject;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(i,a,u){this.params={tag:a,explicit:i,obj:u}},this.getFreshValueHex=function(){var i=this.params;if(i.explicit==null&&(i.explicit=!0),i.tage!=null&&(i.tag=i.tage,i.explicit=!0),i.tagi!=null&&(i.tag=i.tagi,i.explicit=!1),i.str!=null)this.hV=t2(i.str);else if(i.hex!=null)this.hV=i.hex;else if(i.obj!=null){var a;i.obj instanceof t.ASN1Object?a=i.obj.tohex():typeof i.obj=="object"&&(a=o(i.obj).tohex()),i.explicit?this.hV=a:this.hV=n(a,0)}else throw new Error("str, hex nor obj not specified");return i.tag==null&&(i.tag="a0"),this.hT=i.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(i){this.params=i},e!==void 0&&this.setByParam(e)};Ae(A.asn1.DERTaggedObject,A.asn1.ASN1Object);var xe=new function(){};xe.getLblen=function(e,t){if(e.substr(t+2,1)!="8")return 1;var r=parseInt(e.substr(t+3,1));return r==0?-1:0<r&&r<10?r+1:-2};xe.getL=function(e,t){var r=xe.getLblen(e,t);return r<1?"":e.substr(t+2,r*2)};xe.getVblen=function(e,t){var r,n;return r=xe.getL(e,t),r==""?-1:(r.substr(0,1)==="8"?n=new se(r.substr(2),16):n=new se(r,16),n.intValue())};xe.getVidx=function(e,t){var r=xe.getLblen(e,t);return r<0?r:t+(r+1)*2};xe.getV=function(e,t){var r=xe.getVidx(e,t),n=xe.getVblen(e,t);return e.substr(r,n*2)};xe.getTLV=function(e,t){return e.substr(t,2)+xe.getL(e,t)+xe.getV(e,t)};xe.getTLVblen=function(e,t){return 2+xe.getLblen(e,t)*2+xe.getVblen(e,t)*2};xe.getNextSiblingIdx=function(e,t){var r=xe.getVidx(e,t),n=xe.getVblen(e,t);return r+n*2};xe.getChildIdx=function(e,t){var r=xe,n=[],s,o,i;if(s=r.getVidx(e,t),o=r.getVblen(e,t)*2,s+o>e.length)throw new Error("too short ASN.1 value");e.substr(t,2)=="03"&&(s+=2,o-=2),i=0;for(var a=s;i<=o;){var u=r.getTLVblen(e,a);if(u<=0)throw new Error("malformed ASN.1: invalid TLV length");if(i+=u,i<=o&&n.push(a),a+=u,i>=o)break}return n};xe.getNthChildIdx=function(e,t,r){var n=xe.getChildIdx(e,t);return n[r]};xe.getIdxbyList=function(e,t,r,n){var s=xe,o,i;return r.length==0?n!==void 0&&e.substr(t,2)!==n?-1:t:(o=r.shift(),i=s.getChildIdx(e,t),o>=i.length?-1:s.getIdxbyList(e,i[o],r,n))};xe.getIdxbyListEx=function(e,t,r,n){var s=xe,o,i;if(r.length==0)return n!==void 0&&e.substr(t,2)!==n?-1:t;o=r.shift(),i=s.getChildIdx(e,t);for(var a=0,u=0;u<i.length;u++){var l=e.substr(i[u],2);if(typeof o=="number"&&!s.isContextTag(l)&&a==o||typeof o=="string"&&s.isContextTag(l,o))return s.getIdxbyListEx(e,i[u],r,n);s.isContextTag(l)||a++}return-1};xe.getTLVbyList=function(e,t,r,n){var s=xe,o=s.getIdxbyList(e,t,r,n);return o==-1||o>=e.length?null:s.getTLV(e,o)};xe.getTLVbyListEx=function(e,t,r,n){var s=xe,o=s.getIdxbyListEx(e,t,r,n);return o==-1?null:s.getTLV(e,o)};xe.getVbyList=function(e,t,r,n,s){var o=xe,i,a;return i=o.getIdxbyList(e,t,r,n),i==-1||i>=e.length?null:(a=o.getV(e,i),s===!0&&(a=a.substr(2)),a)};xe.getVbyListEx=function(e,t,r,n,s){var o=xe,i,a,u;return i=o.getIdxbyListEx(e,t,r,n),i==-1?null:(u=o.getV(e,i),e.substr(i,2)=="03"&&s!==!1&&(u=u.substr(2)),u)};xe.getInt=function(e,t,r){r==null&&(r=-1);try{var n=e.substr(t,2);if(n!="02"&&n!="03")return r;var s=xe.getV(e,t);return n=="02"?parseInt(s,16):JI(s)}catch{return r}};xe.getOID=function(e,t,r){r==null&&(r=null);try{if(e.substr(t,2)!="06")return r;var n=xe.getV(e,t);return o2(n)}catch{return r}};xe.getOIDName=function(e,t,r){r==null&&(r=null);try{var n=xe.getOID(e,t,r);if(n==r)return r;var s=A.asn1.x509.OID.oid2name(n);return s==""?n:s}catch{return r}};xe.getString=function(e,t,r){r==null&&(r=null);try{var n=xe.getV(e,t);return Vs(n)}catch{return r}};xe.hextooidstr=function(e){var t=function(m,p){return m.length>=p?m:new Array(p-m.length+1).join("0")+m},r=[],n=e.substr(0,2),s=parseInt(n,16);r[0]=new String(Math.floor(s/40)),r[1]=new String(s%40);for(var o=e.substr(2),i=[],a=0;a<o.length/2;a++)i.push(parseInt(o.substr(a*2,2),16));for(var u=[],l="",a=0;a<i.length;a++)i[a]&128?l=l+t((i[a]&127).toString(2),7):(l=l+t((i[a]&127).toString(2),7),u.push(new String(parseInt(l,2))),l="");var f=r.join(".");return u.length>0&&(f=f+"."+u.join(".")),f};xe.dump=function(e,t,r,n){var s=xe,o=s.getV,i=s.dump,a=s.getChildIdx,u=e;e instanceof A.asn1.ASN1Object&&(u=e.tohex());var l=function(K,_){if(K.length<=_*2)return K;var x=K.substr(0,_)+"..(total "+K.length/2+"bytes).."+K.substr(K.length-_,_);return x};t===void 0&&(t={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var f=t.ommit_long_octet,D=u.substr(r,2);if(D=="01"){var m=o(u,r);return m=="00"?n+`BOOLEAN FALSE
|
||
`:n+`BOOLEAN TRUE
|
||
`}if(D=="02"){var m=o(u,r);return n+"INTEGER "+l(m,f)+`
|
||
`}if(D=="03"){var m=o(u,r);if(s.isASN1HEX(m.substr(2))){var p=n+`BITSTRING, encapsulates
|
||
`;return p=p+i(m.substr(2),t,0,n+" "),p}else return n+"BITSTRING "+l(m,f)+`
|
||
`}if(D=="04"){var m=o(u,r);if(s.isASN1HEX(m)){var p=n+`OCTETSTRING, encapsulates
|
||
`;return p=p+i(m,t,0,n+" "),p}else return n+"OCTETSTRING "+l(m,f)+`
|
||
`}if(D=="05")return n+`NULL
|
||
`;if(D=="06"){var d=o(u,r),v=A.asn1.ASN1Util.oidHexToInt(d),g=A.asn1.x509.OID.oid2name(v),y=v.replace(/\./g," ");return g!=""?n+"ObjectIdentifier "+g+" ("+y+`)
|
||
`:n+"ObjectIdentifier ("+y+`)
|
||
`}if(D=="0a")return n+"ENUMERATED "+parseInt(o(u,r))+`
|
||
`;if(D=="0c")return n+"UTF8String '"+ar(o(u,r))+`'
|
||
`;if(D=="13")return n+"PrintableString '"+ar(o(u,r))+`'
|
||
`;if(D=="14")return n+"TeletexString '"+ar(o(u,r))+`'
|
||
`;if(D=="16")return n+"IA5String '"+ar(o(u,r))+`'
|
||
`;if(D=="17")return n+"UTCTime "+ar(o(u,r))+`
|
||
`;if(D=="18")return n+"GeneralizedTime "+ar(o(u,r))+`
|
||
`;if(D=="1a")return n+"VisualString '"+ar(o(u,r))+`'
|
||
`;if(D=="1e")return n+"BMPString '"+RA(o(u,r))+`'
|
||
`;if(D=="30"){if(u.substr(r,4)=="3000")return n+`SEQUENCE {}
|
||
`;var p=n+`SEQUENCE
|
||
`,w=a(u,r),E=t;if((w.length==2||w.length==3)&&u.substr(w[0],2)=="06"&&u.substr(w[w.length-1],2)=="04"){var g=s.oidname(o(u,w[0])),S=JSON.parse(JSON.stringify(t));S.x509ExtName=g,E=S}for(var C=0;C<w.length;C++)p=p+i(u,E,w[C],n+" ");return p}if(D=="31"){for(var p=n+`SET
|
||
`,w=a(u,r),C=0;C<w.length;C++)p=p+i(u,t,w[C],n+" ");return p}var D=parseInt(D,16);if((D&128)!=0){var H=D&31;if((D&32)!=0){for(var p=n+"["+H+`]
|
||
`,w=a(u,r),C=0;C<w.length;C++)p=p+i(u,t,w[C],n+" ");return p}else{var m=o(u,r);if(xe.isASN1HEX(m)){var p=n+"["+H+`]
|
||
`;return p=p+i(m,t,0,n+" "),p}else(m.substr(0,8)=="68747470"||t.x509ExtName==="subjectAltName"&&H==2)&&(m=ar(m));var p=n+"["+H+"] "+m+`
|
||
`;return p}}return n+"UNKNOWN("+D+") "+o(u,r)+`
|
||
`};xe.parse=function(e){var t=xe,r=t.parse,n=t.isASN1HEX,s=t.getV,o=t.getTLV,i=t.getChildIdx,a=A.asn1,u=a.ASN1Util.oidHexToInt,l=a.x509.OID.oid2name,f=ar,m=RA,p=dZ,d={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},v=function(x){for(var j=[],U=i(x,0),k=0;k<U.length;k++){var N=U[k],O=o(x,N),L=r(O);j.push(L)}return j},g=e.substr(0,2),y={},w=s(e,0);if(g=="01")return e=="0101ff"?{bool:!0}:{bool:!1};if(g=="02")return{int:{hex:w}};if(g=="03")try{if(w.substr(0,2)!="00")throw"not encap";var E=w.substr(2);if(!n(E))throw"not encap";return{bitstr:{obj:r(E)}}}catch{var S=null;return w.length<=10&&(S=QI(w)),S==null?{bitstr:{hex:w}}:{bitstr:{bin:S}}}else if(g=="04")try{if(!n(w))throw"not encap";return{octstr:{obj:r(w)}}}catch{return{octstr:{hex:w}}}else{if(g=="05")return{null:""};if(g=="06"){var C=u(w),D=l(C);return D==""?{oid:C}:{oid:D}}else{if(g=="0a")return w.length>4?{enum:{hex:w}}:{enum:parseInt(w,16)};if(g=="30"||g=="31")return y[d[g]]=v(e),y;if(g=="14"){var H=p(w);return y[d[g]]={str:H},y}else if(g=="1e"){var H=m(w);return y[d[g]]={str:H},y}else if(":0c:12:13:16:17:18:1a:".indexOf(g)!=-1){var H=f(w);return y[d[g]]={str:H},y}else if(g.match(/^8[0-9]$/)){var H=f(w);return H==null|H==""?{tag:{tag:g,explicit:!1,hex:w}}:H.match(/[\x00-\x1F\x7F-\x9F]/)!=null||H.match(/[\u0000-\u001F\u0080–\u009F]/)!=null?{tag:{tag:g,explicit:!1,hex:w}}:{tag:{tag:g,explicit:!1,str:H}}}else if(g.match(/^a[0-9]$/))try{if(!n(w))throw new Error("not encap");return{tag:{tag:g,explicit:!0,obj:r(w)}}}catch{return{tag:{tag:g,explicit:!0,hex:w}}}else{var K=new A.asn1.ASN1Object;K.hV=w;var _=K.getLengthHexFromValue();return{asn1:{tlv:g+_+w}}}}}};xe.isContextTag=function(e,t){e=e.toLowerCase();var r,n;try{r=parseInt(e,16)}catch{return-1}if(t===void 0)return(r&192)==128;try{var s=t.match(/^\[[0-9]+\]$/);return s==null||(n=parseInt(t.substr(1,t.length-1),10),n>31)?!1:(r&192)==128&&(r&31)==n}catch{return!1}};xe.isASN1HEX=function(e){var t=xe;if(e.length%2==1)return!1;var r=t.getVblen(e,0),n=e.substr(0,2),s=t.getL(e,0),o=e.length-n.length-s.length;return o==r*2};xe.checkStrictDER=function(e,t,r,n,s){var o=xe;if(r===void 0){if(typeof e!="string")throw new Error("not hex string");if(e=e.toLowerCase(),!A.lang.String.isHex(e))throw new Error("not hex string");r=e.length,n=e.length/2,n<128?s=1:s=Math.ceil(n.toString(16))+1}var i=o.getL(e,t);if(i.length>s*2)throw new Error("L of TLV too long: idx="+t);var a=o.getVblen(e,t);if(a>n)throw new Error("value of L too long than hex: idx="+t);var u=o.getTLV(e,t),l=u.length-2-o.getL(e,t).length;if(l!==a*2)throw new Error("V string length and L's value not the same:"+l+"/"+a*2);if(t===0&&e.length!=u.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+u.length);var f=e.substr(t,2);if(f==="02"){var m=o.getVidx(e,t);if(e.substr(m,2)=="00"&&e.charCodeAt(m+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(f,16)&32){for(var p=o.getVblen(e,t),d=0,v=o.getChildIdx(e,t),g=0;g<v.length;g++){var y=o.getTLV(e,v[g]);d+=y.length,o.checkStrictDER(e,v[g],r,n,s)}if(p*2!=d)throw new Error("sum of children's TLV length and L unmatch: "+p*2+"!="+d)}};xe.oidname=function(e){var t=A.asn1;A.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var r=t.x509.OID.oid2name(e);return r===""&&(r=e),r};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.x509>"u"||!A.asn1.x509)&&(A.asn1.x509={});A.asn1.x509.Certificate=function(e){A.asn1.x509.Certificate.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERBitString,s=r.DERSequence,o=r.x509,i=o.TBSCertificate,a=o.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(u){this.params=u},this.sign=function(){var u=this.params,l=u.sigalg;u.sigalg.name!=null&&(l=u.sigalg.name);var f=u.tbsobj.tohex(),m=new A.crypto.Signature({alg:l});m.init(u.cakey),m.updateHex(f),u.sighex=m.sign()},this.getPEM=function(){return rs(this.tohex(),"CERTIFICATE")},this.tohex=function(){var u=this.params;if((u.tbsobj==null||u.tbsobj==null)&&(u.tbsobj=new i(u)),u.sighex==null&&u.cakey!=null&&this.sign(),u.sighex==null)throw new Error("sighex or cakey parameter not defined");var l=[];l.push(u.tbsobj),l.push(new a({name:u.sigalg})),l.push(new n({hex:"00"+u.sighex}));var f=new s({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};Ae(A.asn1.x509.Certificate,A.asn1.ASN1Object);A.asn1.x509.TBSCertificate=function(e){A.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.x509,s=r.DERTaggedObject,o=r.DERInteger,i=r.DERSequence,a=n.AlgorithmIdentifier,u=n.Time,l=n.X500Name,f=n.Extensions,m=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(p){this.params=p},this.tohex=function(){var p=[],d=this.params;if(d.version!=null||d.version!=1){var v=2;d.version!=null&&(v=d.version-1);var g=new s({obj:new o({int:v})});p.push(g)}p.push(new o(d.serial)),p.push(new a({name:d.sigalg})),p.push(new l(d.issuer)),p.push(new i({array:[new u(d.notbefore),new u(d.notafter)]})),p.push(new l(d.subject)),p.push(new m(Pt.getKey(d.sbjpubkey))),d.ext!==void 0&&d.ext.length>0&&p.push(new s({tag:"a3",obj:new f(d.ext)}));var y=new A.asn1.DERSequence({array:p});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.TBSCertificate,A.asn1.ASN1Object);A.asn1.x509.Extensions=function(e){A.asn1.x509.Extensions.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERSequence,s=r.x509;this.aParam=[],this.setByParam=function(o){this.aParam=o},this.tohex=function(){for(var o=[],i=0;i<this.aParam.length;i++){var a=this.aParam[i],u=a.extname,l=null;if(a.extn!=null)l=new s.PrivateExtension(a);else if(u=="subjectKeyIdentifier")l=new s.SubjectKeyIdentifier(a);else if(u=="keyUsage")l=new s.KeyUsage(a);else if(u=="subjectAltName")l=new s.SubjectAltName(a);else if(u=="issuerAltName")l=new s.IssuerAltName(a);else if(u=="basicConstraints")l=new s.BasicConstraints(a);else if(u=="nameConstraints")l=new s.NameConstraints(a);else if(u=="cRLDistributionPoints")l=new s.CRLDistributionPoints(a);else if(u=="certificatePolicies")l=new s.CertificatePolicies(a);else if(u=="policyMappings")l=new s.PolicyMappings(a);else if(u=="policyConstraints")l=new s.PolicyConstraints(a);else if(u=="inhibitAnyPolicy")l=new s.InhibitAnyPolicy(a);else if(u=="authorityKeyIdentifier")l=new s.AuthorityKeyIdentifier(a);else if(u=="extKeyUsage")l=new s.ExtKeyUsage(a);else if(u=="authorityInfoAccess")l=new s.AuthorityInfoAccess(a);else if(u=="cRLNumber")l=new s.CRLNumber(a);else if(u=="cRLReason")l=new s.CRLReason(a);else if(u=="ocspNonce")l=new s.OCSPNonce(a);else if(u=="ocspNoCheck")l=new s.OCSPNoCheck(a);else if(u=="adobeTimeStamp")l=new s.AdobeTimeStamp(a);else if(u=="subjectDirectoryAttributes")l=new s.SubjectDirectoryAttributes(a);else throw new Error("extension not supported:"+JSON.stringify(a));l!=null&&o.push(l)}var f=new n({array:o});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.x509.Extensions,A.asn1.ASN1Object);A.asn1.x509.Extension=function(e){A.asn1.x509.Extension.superclass.constructor.call(this);var t=null,r=A,n=r.asn1,s=n.DERObjectIdentifier,o=n.DEROctetString,i=n.DERBitString,a=n.DERBoolean,u=n.DERSequence;this.tohex=function(){var l=new s({oid:this.oid}),f=new o({hex:this.getExtnValueHex()}),m=new Array;m.push(l),this.critical&&m.push(new a),m.push(f);var p=new u({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,e!==void 0&&e.critical!==void 0&&(this.critical=e.critical)};Ae(A.asn1.x509.Extension,A.asn1.ASN1Object);A.asn1.x509.KeyUsage=function(e){A.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Error,r={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var n=this.getBinValue();return this.asn1ExtnValue=new A.asn1.DERBitString({bin:n}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var n=this.params;if(typeof n!="object"||typeof n.names!="object"&&typeof n.bin!="string")throw new t("parameter not yet set");if(n.names!=null)return Jg(n.names,r);if(n.bin!=null)return n.bin;throw new t("parameter not set properly")},this.oid="2.5.29.15",e!==void 0&&(this.params=e)};Ae(A.asn1.x509.KeyUsage,A.asn1.x509.Extension);A.asn1.x509.BasicConstraints=function(e){A.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERBoolean,n=t.DERInteger,s=t.DERSequence,o=!1,i=-1;this.getExtnValueHex=function(){var a=new Array;this.cA&&a.push(new r),this.pathLen>-1&&a.push(new n({int:this.pathLen}));var u=new s({array:a});return this.asn1ExtnValue=u,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,e!==void 0&&(e.cA!==void 0&&(this.cA=e.cA),e.pathLen!==void 0&&(this.pathLen=e.pathLen))};Ae(A.asn1.x509.BasicConstraints,A.asn1.x509.Extension);A.asn1.x509.CRLDistributionPoints=function(e){A.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(s){for(var o=[],i=0;i<s.length;i++)if(s[i]instanceof A.asn1.ASN1Object)o.push(s[i]);else{var a=new n.DistributionPoint(s[i]);o.push(a)}this.asn1ExtnValue=new r.DERSequence({array:o})},this.setByOneURI=function(s){var o=new n.DistributionPoint({fulluri:s});this.setByDPArray([o])},this.oid="2.5.29.31",e!==void 0&&(e.array!==void 0?this.setByDPArray(e.array):e.uri!==void 0&&this.setByOneURI(e.uri))};Ae(A.asn1.x509.CRLDistributionPoints,A.asn1.x509.Extension);A.asn1.x509.DistributionPoint=function(e){A.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=null,r=A,n=r.asn1,s=n.x509.DistributionPointName;this.tohex=function(){var o=new n.DERSequence;if(this.asn1DP!=null){var i=new n.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});o.appendASN1Object(i)}return this.hTLV=o.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(e.dpobj!==void 0?this.asn1DP=e.dpobj:e.dpname!==void 0?this.asn1DP=new s(e.dpname):e.fulluri!==void 0&&(this.asn1DP=new s({full:[{uri:e.fulluri}]})))};Ae(A.asn1.x509.DistributionPoint,A.asn1.ASN1Object);A.asn1.x509.DistributionPointName=function(e){A.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=null,r=null,n=null,s=null,o=A,i=o.asn1,a=i.DERTaggedObject;if(this.tohex=function(){if(this.type!="full")throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new a({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0)if(i.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else if(e.full!==void 0)this.type="full",this.tag="a0",this.asn1V=new i.x509.GeneralNames(e.full);else throw new Error("This class supports GeneralNames only as argument")};Ae(A.asn1.x509.DistributionPointName,A.asn1.ASN1Object);A.asn1.x509.CertificatePolicies=function(e){A.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,s=r.DERSequence,o=n.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var i=[],a=0;a<this.params.array.length;a++)i.push(new o(this.params.array[a]));var u=new s({array:i});return this.asn1ExtnValue=u,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",e!==void 0&&(this.params=e)};Ae(A.asn1.x509.CertificatePolicies,A.asn1.x509.Extension);A.asn1.x509.PolicyInformation=function(e){A.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERSequence,n=t.DERObjectIdentifier,s=t.x509.PolicyQualifierInfo;this.params=null,this.tohex=function(){if(this.params.policyoid===void 0&&this.params.array===void 0)throw new Error("parameter oid and array missing");var o=[new n(this.params.policyoid)];if(this.params.array!==void 0){for(var i=[],a=0;a<this.params.array.length;a++)i.push(new s(this.params.array[a]));i.length>0&&o.push(new r({array:i}))}var u=new r({array:o});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ae(A.asn1.x509.PolicyInformation,A.asn1.ASN1Object);A.asn1.x509.PolicyQualifierInfo=function(e){A.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERSequence,n=t.DERIA5String,s=t.DERObjectIdentifier,o=t.x509.UserNotice;this.params=null,this.tohex=function(){if(this.params.cps!==void 0){var i=new r({array:[new s({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]});return i.tohex()}if(this.params.unotice!=null){var i=new r({array:[new s({oid:"1.3.6.1.5.5.7.2.2"}),new o(this.params.unotice)]});return i.tohex()}},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ae(A.asn1.x509.PolicyQualifierInfo,A.asn1.ASN1Object);A.asn1.x509.UserNotice=function(e){A.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=A.asn1.DERSequence,r=A.asn1.DERInteger,n=A.asn1.x509.DisplayText,s=A.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var o=[];this.params.noticeref!==void 0&&o.push(new s(this.params.noticeref)),this.params.exptext!==void 0&&o.push(new n(this.params.exptext));var i=new t({array:o});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ae(A.asn1.x509.UserNotice,A.asn1.ASN1Object);A.asn1.x509.NoticeReference=function(e){A.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=A.asn1.DERSequence,r=A.asn1.DERInteger,n=A.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var s=[];if(this.params.org!==void 0&&s.push(new n(this.params.org)),this.params.noticenum!==void 0){for(var o=[],i=this.params.noticenum,a=0;a<i.length;a++)o.push(new r(i[a]));s.push(new t({array:o}))}if(s.length==0)throw new Error("parameter is empty");var u=new t({array:s});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ae(A.asn1.x509.NoticeReference,A.asn1.ASN1Object);A.asn1.x509.DisplayText=function(e){A.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",e!==void 0&&(e.type==="ia5"?this.hT="16":e.type==="vis"?this.hT="1a":e.type==="bmp"&&(this.hT="1e"))};Ae(A.asn1.x509.DisplayText,A.asn1.DERAbstractString);A.asn1.x509.PolicyMappings=function(e){A.asn1.x509.PolicyMappings.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,s=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){for(var o=this.params,i=[],a=0;a<o.array.length;a++){var u=o.array[a];i.push({seq:[{oid:u[0]},{oid:u[1]}]})}return this.asn1ExtnValue=s({seq:i}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",e!==void 0&&(this.params=e)};Ae(A.asn1.x509.PolicyMappings,A.asn1.x509.Extension);A.asn1.x509.PolicyConstraints=function(e){A.asn1.x509.PolicyConstraints.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,s=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){var o=this.params,i=[];return o.reqexp!=null&&i.push({tag:{tagi:"80",obj:{int:o.reqexp}}}),o.inhibit!=null&&i.push({tag:{tagi:"81",obj:{int:o.inhibit}}}),this.asn1ExtnValue=s({seq:i}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",e!==void 0&&(this.params=e)};Ae(A.asn1.x509.PolicyConstraints,A.asn1.x509.Extension);A.asn1.x509.InhibitAnyPolicy=function(e){A.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,s=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=s({int:this.params.skip}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.54",e!==void 0&&(this.params=e)};Ae(A.asn1.x509.InhibitAnyPolicy,A.asn1.x509.Extension);A.asn1.x509.NameConstraints=function(e){A.asn1.x509.NameConstraints.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,s=r.ASN1Util.newObject,o=n.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var i=this.params,a=[];if(i.permit!=null&&i.permit.length!=null){for(var u=[],l=0;l<i.permit.length;l++)u.push(new o(i.permit[l]));a.push({tag:{tagi:"a0",obj:{seq:u}}})}if(i.exclude!=null&&i.exclude.length!=null){for(var f=[],l=0;l<i.exclude.length;l++)f.push(new o(i.exclude[l]));a.push({tag:{tagi:"a1",obj:{seq:f}}})}return this.asn1ExtnValue=s({seq:a}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",e!==void 0&&(this.params=e)};Ae(A.asn1.x509.NameConstraints,A.asn1.x509.Extension);A.asn1.x509.GeneralSubtree=function(e){A.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var t=A.asn1,r=t.x509,n=r.GeneralName,s=t.ASN1Util.newObject;this.params=null,this.setByParam=function(o){this.params=o},this.tohex=function(){var o=this.params,i=[new n(o)];o.min!=null&&i.push({tag:{tagi:"80",obj:{int:o.min}}}),o.max!=null&&i.push({tag:{tagi:"81",obj:{int:o.max}}});var a=s({seq:i});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.GeneralSubtree,A.asn1.ASN1Object);A.asn1.x509.ExtKeyUsage=function(e){A.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=A,r=t.asn1;this.setPurposeArray=function(n){this.asn1ExtnValue=new r.DERSequence;for(var s=0;s<n.length;s++){var o=new r.DERObjectIdentifier(n[s]);this.asn1ExtnValue.appendASN1Object(o)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",e!==void 0&&e.array!==void 0&&this.setPurposeArray(e.array)};Ae(A.asn1.x509.ExtKeyUsage,A.asn1.x509.Extension);A.asn1.x509.AuthorityKeyIdentifier=function(e){A.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.DERTaggedObject,s=r.x509.GeneralNames,o=t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var i=new Array;this.asn1KID&&i.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&i.push(new n({explicit:!1,tag:"a1",obj:new s([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&i.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var a=new r.DERSequence({array:i});return this.asn1ExtnValue=a,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(i){if(i.str!==void 0||i.hex!==void 0)this.asn1KID=new A.asn1.DEROctetString(i);else if(typeof i=="object"&&A.crypto.Util.isKey(i)||typeof i=="string"&&i.indexOf("BEGIN ")!=-1){var a=i;typeof i=="string"&&(a=Pt.getKey(i));var u=Pt.getKeyID(a);this.asn1KID=new A.asn1.DEROctetString({hex:u})}},this.setCertIssuerByParam=function(i){i.str!==void 0||i.ldapstr!==void 0||i.hex!==void 0||i.certsubject!==void 0||i.certissuer!==void 0?this.asn1CertIssuer=new A.asn1.x509.X500Name(i):typeof i=="string"&&i.indexOf("BEGIN ")!=-1&&i.indexOf("CERTIFICATE")!=-1&&(this.asn1CertIssuer=new A.asn1.x509.X500Name({certissuer:i}))},this.setCertSNByParam=function(i){if(i.str!==void 0||i.bigint!==void 0||i.hex!==void 0)this.asn1CertSN=new A.asn1.DERInteger(i);else if(typeof i=="string"&&i.indexOf("BEGIN ")!=-1&&i.indexOf("CERTIFICATE")){var a=new ot;a.readCertPEM(i);var u=a.getSerialNumberHex();this.asn1CertSN=new A.asn1.DERInteger({hex:u})}},this.oid="2.5.29.35",e!==void 0&&(e.kid!==void 0&&this.setKIDByParam(e.kid),e.issuer!==void 0&&this.setCertIssuerByParam(e.issuer),e.sn!==void 0&&this.setCertSNByParam(e.sn),e.issuersn!==void 0&&typeof e.issuersn=="string"&&e.issuersn.indexOf("BEGIN ")!=-1&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))};Ae(A.asn1.x509.AuthorityKeyIdentifier,A.asn1.x509.Extension);A.asn1.x509.SubjectKeyIdentifier=function(e){A.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(s){if(s.str!==void 0||s.hex!==void 0)this.asn1KID=new n(s);else if(typeof s=="object"&&A.crypto.Util.isKey(s)||typeof s=="string"&&s.indexOf("BEGIN")!=-1){var o=s;typeof s=="string"&&(o=Pt.getKey(s));var i=Pt.getKeyID(o);this.asn1KID=new A.asn1.DEROctetString({hex:i})}},this.oid="2.5.29.14",e!==void 0&&e.kid!==void 0&&this.setKIDByParam(e.kid)};Ae(A.asn1.x509.SubjectKeyIdentifier,A.asn1.x509.Extension);A.asn1.x509.AuthorityInfoAccess=function(e){A.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(t){for(var r=new Array,n=A,s=n.asn1,o=s.DERSequence,i=s.DERObjectIdentifier,a=s.x509.GeneralName,u=0;u<t.length;u++){var l,f=t[u];if(f.ocsp!==void 0)l=new o({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new a({uri:f.ocsp})]});else if(f.caissuer!==void 0)l=new o({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new a({uri:f.caissuer})]});else throw new Error("unknown AccessMethod parameter: "+JSON.stringify(f));r.push(l)}this.asn1ExtnValue=new o({array:r})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",e!==void 0&&e.array!==void 0&&this.setAccessDescriptionArray(e.array)};Ae(A.asn1.x509.AuthorityInfoAccess,A.asn1.x509.Extension);A.asn1.x509.SubjectAltName=function(e){A.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(t){this.asn1ExtnValue=new A.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.17",e!==void 0&&e.array!==void 0&&this.setNameArray(e.array)};Ae(A.asn1.x509.SubjectAltName,A.asn1.x509.Extension);A.asn1.x509.IssuerAltName=function(e){A.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(t){this.asn1ExtnValue=new A.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.18",e!==void 0&&e.array!==void 0&&this.setNameArray(e.array)};Ae(A.asn1.x509.IssuerAltName,A.asn1.x509.Extension);A.asn1.x509.SubjectDirectoryAttributes=function(e){A.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERSequence,n=t.ASN1Util.newObject,s=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var o=[],i=0;i<this.params.array.length;i++){var a=this.params.array[i];if(a.attr!=null&&a.array!=null){var u={seq:[{oid:a.attr},{set:a.array}]};o.push(n(u));continue}var l={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if(a.attr=="dateOfBirth")l.seq[0].oid=s(a.attr),l.seq[1].set[0]={gentime:a.str};else if(a.attr=="placeOfBirth")l.seq[0].oid=s(a.attr),l.seq[1].set[0]={utf8str:a.str};else if(a.attr=="gender")l.seq[0].oid=s(a.attr),l.seq[1].set[0]={prnstr:a.str};else if(a.attr=="countryOfCitizenship")l.seq[0].oid=s(a.attr),l.seq[1].set[0]={prnstr:a.str};else if(a.attr=="countryOfResidence")l.seq[0].oid=s(a.attr),l.seq[1].set[0]={prnstr:a.str};else throw new Error("unsupported attribute: "+a.attr);o.push(new n(l))}var f=new r({array:o});return this.asn1ExtnValue=f,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",e!==void 0&&(this.params=e)};Ae(A.asn1.x509.SubjectDirectoryAttributes,A.asn1.x509.Extension);A.asn1.x509.PrivateExtension=function(e){A.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=A,r=t.lang.String.isHex,n=t.asn1,s=n.x509.OID.name2oid,o=n.ASN1Util.newObject;this.params=null,this.setByParam=function(i){this.oid=s(i.extname),this.params=i},this.getExtnValueHex=function(){if(this.params.extname==null||this.params.extn==null)throw new Error("extname or extnhex not specified");var i=this.params.extn;if(typeof i=="string"&&r(i))return i;if(typeof i=="object")try{return o(i).tohex()}catch{}throw new Error("unsupported extn value")},e!=null&&this.setByParam(e)};Ae(A.asn1.x509.PrivateExtension,A.asn1.x509.Extension);A.asn1.x509.CRL=function(e){A.asn1.x509.CRL.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERSequence,s=r.DERBitString,o=r.x509,i=o.AlgorithmIdentifier,a=o.TBSCertList;this.params=void 0,this.setByParam=function(u){this.params=u},this.sign=function(){var u=new a(this.params).tohex(),l=new A.crypto.Signature({alg:this.params.sigalg});l.init(this.params.cakey),l.updateHex(u);var f=l.sign();this.params.sighex=f},this.getPEM=function(){return rs(this.tohex(),"X509 CRL")},this.tohex=function(){var u=this.params;if(u.tbsobj==null&&(u.tbsobj=new a(u)),u.sighex==null&&u.cakey!=null&&this.sign(),u.sighex==null)throw new Error("sighex or cakey parameter not defined");var l=[];l.push(u.tbsobj),l.push(new i({name:u.sigalg})),l.push(new s({hex:"00"+u.sighex}));var f=new n({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};Ae(A.asn1.x509.CRL,A.asn1.ASN1Object);A.asn1.x509.TBSCertList=function(e){A.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERInteger,s=r.DERSequence,o=r.DERTaggedObject,i=r.DERObjectIdentifier,a=r.x509,u=a.AlgorithmIdentifier,l=a.Time,f=a.Extensions,m=a.X500Name;this.params=null,this.setByParam=function(p){this.params=p},this.getRevCertSequence=function(){for(var p=[],d=this.params.revcert,v=0;v<d.length;v++){var g=[new n(d[v].sn),new l(d[v].date)];d[v].ext!=null&&g.push(new f(d[v].ext)),p.push(new s({array:g}))}return new s({array:p})},this.tohex=function(){var p=[],d=this.params;if(d.version!=null){var v=d.version-1,g=new n({int:v});p.push(g)}if(p.push(new u({name:d.sigalg})),p.push(new m(d.issuer)),p.push(new l(d.thisupdate)),d.nextupdate!=null&&p.push(new l(d.nextupdate)),d.revcert!=null&&p.push(this.getRevCertSequence()),d.ext!=null){var y=new f(d.ext);p.push(new o({tag:"a0",explicit:!0,obj:y}))}var w=new s({array:p});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.TBSCertList,A.asn1.ASN1Object);A.asn1.x509.CRLEntry=function(e){A.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=null,r=null,n=A,s=n.asn1;this.setCertSerial=function(o){this.sn=new s.DERInteger(o)},this.setRevocationDate=function(o){this.time=new s.x509.Time(o)},this.tohex=function(){var o=new s.DERSequence({array:[this.sn,this.time]});return this.TLV=o.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(e.time!==void 0&&this.setRevocationDate(e.time),e.sn!==void 0&&this.setCertSerial(e.sn))};Ae(A.asn1.x509.CRLEntry,A.asn1.ASN1Object);A.asn1.x509.CRLNumber=function(e){A.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new A.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",e!=null&&(this.params=e)};Ae(A.asn1.x509.CRLNumber,A.asn1.x509.Extension);A.asn1.x509.CRLReason=function(e){A.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new A.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",e!=null&&(this.params=e)};Ae(A.asn1.x509.CRLReason,A.asn1.x509.Extension);A.asn1.x509.OCSPNonce=function(e){A.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new A.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",e!=null&&(this.params=e)};Ae(A.asn1.x509.OCSPNonce,A.asn1.x509.Extension);A.asn1.x509.OCSPNoCheck=function(e){A.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new A.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",e!=null&&(this.params=e)};Ae(A.asn1.x509.OCSPNoCheck,A.asn1.x509.Extension);A.asn1.x509.AdobeTimeStamp=function(e){A.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.DERInteger,s=r.DERBoolean,o=r.DERSequence,i=r.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var a=this.params,u=[new n(1)];return u.push(new i({uri:a.uri})),a.reqauth!=null&&u.push(new s(a.reqauth)),this.asn1ExtnValue=new o({array:u}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.AdobeTimeStamp,A.asn1.x509.Extension);A.asn1.x509.X500Name=function(e){A.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=A,r=t.asn1,n=r.x509,s=n.RDN,o=Fr;this.setByString=function(i,a){a!==void 0&&(this.sRule=a);var u=i.split("/");u.shift();for(var l=[],f=0;f<u.length;f++)if(u[f].match(/^[^=]+=.+$/))l.push(u[f]);else{var m=l.length-1;l[m]=l[m]+"/"+u[f]}for(var f=0;f<l.length;f++)this.asn1Array.push(new s({str:l[f],rule:this.sRule}))},this.setByLdapString=function(i,a){a!==void 0&&(this.sRule=a);var u=n.X500Name.ldapToCompat(i);this.setByString(u,a)},this.setByObject=function(i,a){a!==void 0&&(this.sRule=a);for(var u in i)if(i.hasOwnProperty(u)){var l=new s({str:u+"="+i[u],rule:this.sRule});this.asn1Array?this.asn1Array.push(l):this.asn1Array=[l]}},this.setByParam=function(i){if(i.rule!==void 0&&(this.sRule=i.rule),i.array!==void 0)this.paramArray=i.array;else if(i.str!==void 0)this.setByString(i.str);else if(i.ldapstr!==void 0)this.setByLdapString(i.ldapstr);else if(i.hex!==void 0)this.hTLV=i.hex;else if(i.certissuer!==void 0){var a=new ot;a.readCertPEM(i.certissuer),this.hTLV=a.getIssuerHex()}else if(i.certsubject!==void 0){var a=new ot;a.readCertPEM(i.certsubject),this.hTLV=a.getSubjectHex()}else typeof i=="object"&&i.certsubject===void 0&&i.certissuer===void 0&&this.setByObject(i)},this.tohex=function(){if(typeof this.hTLV=="string")return this.hTLV;if(this.asn1Array.length==0&&this.paramArray.length>0)for(var i=0;i<this.paramArray.length;i++){var a={array:this.paramArray[i]};this.sRule!="utf8"&&(a.rule=this.sRule);var u=new s(a);this.asn1Array.push(u)}var l=new r.DERSequence({array:this.asn1Array});return this.hTLV=l.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.X500Name,A.asn1.ASN1Object);A.asn1.x509.X500Name.compatToLDAP=function(e){if(e.substr(0,1)!=="/")throw"malformed input";var t="";e=e.substr(1);var r=e.split("/");return r.reverse(),r=r.map(function(n){return n.replace(/,/,"\\,")}),r.join(",")};A.asn1.x509.X500Name.onelineToLDAP=function(e){return A.asn1.x509.X500Name.compatToLDAP(e)};A.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),r=!1,n=[],s=0;t.length>0;s++){var o=t.shift();if(r===!0){var i=n.pop(),a=(i+","+o).replace(/\\,/g,",");n.push(a),r=!1}else n.push(o);o.substr(-1,1)==="\\"&&(r=!0)}return n=n.map(function(u){return u.replace("/","\\/")}),n.reverse(),"/"+n.join("/")};A.asn1.x509.X500Name.ldapToOneline=function(e){return A.asn1.x509.X500Name.ldapToCompat(e)};A.asn1.x509.RDN=function(e){A.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=A.asn1.x509.AttributeTypeAndValue;this.setByParam=function(r){r.rule!==void 0&&(this.sRule=r.rule),r.str!==void 0&&this.addByMultiValuedString(r.str),r.array!==void 0&&(this.paramArray=r.array)},this.addByString=function(r){this.asn1Array.push(new A.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=A.asn1.x509.RDN.parseString(r),s=0;s<n.length;s++)this.addByString(n[s])},this.tohex=function(){if(this.asn1Array.length==0&&this.paramArray.length>0)for(var r=0;r<this.paramArray.length;r++){var n=this.paramArray[r];n.rule!==void 0&&this.sRule!="utf8"&&(n.rule=this.sRule);var s=new t(n);this.asn1Array.push(s)}var o=new A.asn1.DERSet({array:this.asn1Array});return this.TLV=o.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.RDN,A.asn1.ASN1Object);A.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),r=!1,n=[],s=0;t.length>0;s++){var o=t.shift();if(r===!0){var i=n.pop(),a=(i+"+"+o).replace(/\\\+/g,"+");n.push(a),r=!1}else n.push(o);o.substr(-1,1)==="\\"&&(r=!0)}for(var u=!1,l=[],s=0;n.length>0;s++){var o=n.shift();if(u===!0){var f=l.pop();if(o.match(/"$/)){var a=(f+"+"+o).replace(/^([^=]+)="(.*)"$/,"$1=$2");l.push(a),u=!1}else l.push(f+"+"+o)}else l.push(o);o.match(/^[^=]+="/)&&(u=!0)}return l};A.asn1.x509.AttributeTypeAndValue=function(e){A.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=A,r=t.asn1,n=r.DERSequence,s=r.DERUTF8String,o=r.DERPrintableString,i=r.DERTeletexString,a=r.DERIA5String,u=r.DERVisibleString,l=r.DERBMPString,f=t.lang.String.isMail,m=t.lang.String.isPrintable;this.setByParam=function(p){if(p.rule!==void 0&&(this.sRule=p.rule),p.ds!==void 0&&(this.dsType=p.ds),p.value===void 0&&p.str!==void 0){var d=p.str,v=d.match(/^([^=]+)=(.+)$/);if(v)this.sType=v[1],this.sValue=v[2];else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)}else this.sType=p.type,this.sValue=p.value},this.setByString=function(p,d){d!==void 0&&(this.sRule=d);var v=p.match(/^([^=]+)=(.+)$/);if(v)this.setByAttrTypeAndValueStr(v[1],v[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var p=this.sType,d=this.sValue,v=this.sRule;return v==="prn"?p=="CN"&&f(d)?"ia5":m(d)?"prn":"utf8":v==="utf8"?p=="CN"&&f(d)?"ia5":p=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(p,d,v){v!==void 0&&(this.sRule=v),this.sType=p,this.sValue=d},this.getValueObj=function(p,d){if(p=="utf8")return new s({str:d});if(p=="prn")return new o({str:d});if(p=="tel")return new i({str:d});if(p=="ia5")return new a({str:d});if(p=="vis")return new u({str:d});if(p=="bmp")return new l({str:d});throw new Error("unsupported directory string type: type="+p+" value="+d)},this.tohex=function(){this.dsType==null&&(this.dsType=this._getDsType());var p=A.asn1.x509.OID.atype2obj(this.sType),d=this.getValueObj(this.dsType,this.sValue),v=new n({array:[p,d]});return this.TLV=v.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.AttributeTypeAndValue,A.asn1.ASN1Object);A.asn1.x509.SubjectPublicKeyInfo=function(e){A.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=null,r=null,n=A,s=n.asn1,o=s.DERInteger,i=s.DERBitString,a=s.DERObjectIdentifier,u=s.DERSequence,l=s.ASN1Util.newObject,f=s.x509,m=f.AlgorithmIdentifier,p=n.crypto,d=p.ECDSA,v=p.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var g=new u({array:[this.asn1AlgId,this.asn1SubjPKey]});return g},this.tohex=function(){var g=this.getASN1Object();return this.hTLV=g.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(g){try{if(g instanceof dt){var y=l({seq:[{int:{bigint:g.n}},{int:{int:g.e}}]}),w=y.tohex();this.asn1AlgId=new m({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+w})}}catch{}try{if(g instanceof A.crypto.ECDSA){var E=new a({name:g.curveName});this.asn1AlgId=new m({name:"ecPublicKey",asn1params:E}),this.asn1SubjPKey=new i({hex:"00"+g.pubKeyHex})}}catch{}try{if(g instanceof A.crypto.DSA){var E=new l({seq:[{int:{bigint:g.p}},{int:{bigint:g.q}},{int:{bigint:g.g}}]});this.asn1AlgId=new m({name:"dsa",asn1params:E});var S=new o({bigint:g.y});this.asn1SubjPKey=new i({hex:"00"+S.tohex()})}}catch{}},e!==void 0&&this.setPubKey(e)};Ae(A.asn1.x509.SubjectPublicKeyInfo,A.asn1.ASN1Object);A.asn1.x509.Time=function(e){A.asn1.x509.Time.superclass.constructor.call(this);var t=null,r=null,n=A,s=n.asn1,o=s.DERUTCTime,i=s.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(a){this.timeParams=a},this.setByParam=function(a){this.params=a},this.getType=function(a){return a.match(/^[0-9]{12}Z$/)?"utc":a.match(/^[0-9]{14}Z$/)?"gen":a.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":a.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var a=this.params,u=null;if(typeof a=="string"&&(a={str:a}),a!=null&&a.str&&(a.type==null||a.type==null)&&(a.type=this.getType(a.str)),a!=null&&a.str?(a.type=="utc"&&(u=new o(a.str)),a.type=="gen"&&(u=new i(a.str))):this.type=="gen"?u=new i:u=new o,u==null)throw new Error("wrong setting for Time");return this.TLV=u.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};A.asn1.x509.Time_bak=function(e){A.asn1.x509.Time_bak.superclass.constructor.call(this);var t=null,r=null,n=A,s=n.asn1,o=s.DERUTCTime,i=s.DERGeneralizedTime;this.setTimeParams=function(a){this.timeParams=a},this.tohex=function(){var a=null;return this.timeParams!=null?this.type=="utc"?a=new o(this.timeParams):a=new i(this.timeParams):this.type=="utc"?a=new o:a=new i,this.TLV=a.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",e!==void 0&&(e.type!==void 0?this.type=e.type:e.str!==void 0&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)};Ae(A.asn1.x509.Time,A.asn1.ASN1Object);A.asn1.x509.AlgorithmIdentifier=function(e){A.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=A,r=t.asn1,n=r.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(this.nameAlg===null&&this.asn1Alg===null)throw new Error("algorithm not specified");if(this.nameAlg!==null){var o=null;for(var i in n)i===this.nameAlg&&(o=n[i]);if(o!==null)return this.hTLV=o,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=r.x509.OID.name2obj(this.nameAlg));var a=[this.asn1Alg];this.asn1Params!==null&&a.push(this.asn1Params);var u=new r.DERSequence({array:a});return this.hTLV=u.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(e.name!==void 0&&(this.nameAlg=e.name),e.asn1params!==void 0&&(this.asn1Params=e.asn1params),e.paramempty!==void 0&&(this.paramEmpty=e.paramempty)),this.asn1Params===null&&this.paramEmpty===!1&&this.nameAlg!==null){this.nameAlg.name!==void 0&&(this.nameAlg=this.nameAlg.name);var s=this.nameAlg.toLowerCase();s.substr(-7,7)!=="withdsa"&&s.substr(-9,9)!=="withecdsa"&&(this.asn1Params=new r.DERNull)}};Ae(A.asn1.x509.AlgorithmIdentifier,A.asn1.ASN1Object);A.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};A.asn1.x509.GeneralName=function(e){A.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87",otherName:"a0"},r=A,n=r.asn1,s=n.x509,o=s.X500Name,i=s.OtherName,a=n.DERIA5String,u=n.DERPrintableString,l=n.DEROctetString,f=n.DERTaggedObject,m=n.ASN1Object,p=Error;this.params=null,this.setByParam=function(d){this.params=d},this.tohex=function(){var d=this.params,v,y,g,y=!1;if(d.other!==void 0)v="a0",g=new i(d.other);else if(d.rfc822!==void 0)v="81",g=new a({str:d.rfc822});else if(d.dns!==void 0)v="82",g=new a({str:d.dns});else if(d.dn!==void 0)v="a4",y=!0,typeof d.dn=="string"?g=new o({str:d.dn}):d.dn instanceof A.asn1.x509.X500Name?g=d.dn:g=new o(d.dn);else if(d.ldapdn!==void 0)v="a4",y=!0,g=new o({ldapstr:d.ldapdn});else if(d.certissuer!==void 0||d.certsubj!==void 0){v="a4",y=!0;var w,E,S=null;if(d.certsubj!==void 0?(w=!1,E=d.certsubj):(w=!0,E=d.certissuer),E.match(/^[0-9A-Fa-f]+$/)&&S==E,E.indexOf("-----BEGIN ")!=-1&&(S=Fr(E)),S==null)throw new Error("certsubj/certissuer not cert");var C=new ot;C.hex=S;var D;w?D=C.getIssuerHex():D=C.getSubjectHex(),g=new m,g.hTLV=D}else if(d.uri!==void 0)v="86",g=new a({str:d.uri});else if(d.ip!==void 0){v="87";var H,K=d.ip;try{if(K.match(/^[0-9a-f]+$/)){var _=K.length;if(_==8||_==16||_==32||_==64)H=K;else throw"err"}else H=xA(K)}catch(j){throw new p("malformed IP address: "+d.ip+":"+j.message)}g=new l({hex:H})}else throw new p("improper params");var x=new f({tag:v,explicit:y,obj:g});return x.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.GeneralName,A.asn1.ASN1Object);A.asn1.x509.GeneralNames=function(e){A.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,r=A,n=r.asn1;this.setByParamArray=function(s){for(var o=0;o<s.length;o++){var i=new n.x509.GeneralName(s[o]);this.asn1Array.push(i)}},this.tohex=function(){var s=new n.DERSequence({array:this.asn1Array});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,typeof e<"u"&&this.setByParamArray(e)};Ae(A.asn1.x509.GeneralNames,A.asn1.ASN1Object);A.asn1.x509.OtherName=function(e){A.asn1.x509.OtherName.superclass.constructor.call(this);var t=null,r=null,n=A,s=n.asn1,o=s.DERObjectIdentifier,i=s.DERSequence,a=s.ASN1Util.newObject;this.params=null,this.setByParam=function(u){this.params=u},this.tohex=function(){var u=this.params;if(u.oid==null||u.value==null)throw new Error("oid or value not specified");var l=new o({oid:u.oid}),f=a({tag:{tag:"a0",explicit:!0,obj:u.value}}),m=new i({array:[l,f]});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.x509.OtherName,A.asn1.ASN1Object);A.asn1.x509.OID=new function(){var e=A.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(t){if(typeof this.objCache[t]<"u")return this.objCache[t];if(typeof this.name2oidList[t]>"u")throw"Name of ObjectIdentifier not defined: "+t;var r=this.name2oidList[t],n=new e({oid:r});return this.objCache[t]=n,n},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var r;if(t.match(/^\d+\.\d+\.[0-9.]+$/))r=t;else if(this.atype2oidList[t]!==void 0)r=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)r=this.name2oidList[t];else throw new Error("AttributeType name undefined: "+t);var n=new e({oid:r});return this.objCache[t]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var r in t)this.name2oidList[r]=t[r]},this.checkOIDs=function(t){try{var r=Object.keys(t);return r.length==0?!1:(r.map(function(n,s,o){var i=this[n];if(!i.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch{return!1}}};A.asn1.x509.OID.oid2name=function(e){var t=A.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""};A.asn1.x509.OID.oid2atype=function(e){var t=A.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e};A.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=A.asn1.x509.OID.name2oidList;return t[e]===void 0?"":t[e]};A.asn1.x509.X509Util={};A.asn1.x509.X509Util.newCertPEM=function(e){var t=A.asn1.x509,r=t.TBSCertificate,n=t.Certificate,s=new n(e);return s.getPEM()};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cms>"u"||!A.asn1.cms)&&(A.asn1.cms={});A.asn1.cms.Attribute=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.DERSet,i=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(a){this.params=a},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var a=new i({oid:this.typeOid}),u=new o({array:this.getValueArray()}),l=new s({array:[a,u]});return l.tohex()},this.getEncodedHex=function(){return this.tohex()}};Ae(A.asn1.cms.Attribute,A.asn1.ASN1Object);A.asn1.cms.ContentType=function(e){var t=A,r=t.asn1;r.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var n=new r.DERObjectIdentifier(this.params.type);return[n]},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.ContentType,A.asn1.cms.Attribute);A.asn1.cms.MessageDigest=function(e){var t=A,r=t.asn1,n=r.DEROctetString,s=r.cms;s.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var o=new n(this.params);return[o]},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.MessageDigest,A.asn1.cms.Attribute);A.asn1.cms.SigningTime=function(e){var t=A,r=t.asn1;r.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var n=new r.x509.Time(this.params);return[n]},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.SigningTime,A.asn1.cms.Attribute);A.asn1.cms.SigningCertificate=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.cms,i=o.ESSCertID,a=r.crypto;o.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new t("parameter 'array' not specified");for(var u=this.params.array,l=[],f=0;f<u.length;f++){var m=u[f];e.hasis==!1&&typeof m=="string"&&(m.indexOf("-----BEGIN")!=-1||xe.isASN1HEX(m))&&(m={cert:m}),m.hasis!=!1&&e.hasis==!1&&(m.hasis=!1),l.push(new i(m))}var p=new s({array:l}),d=new s({array:[p]});return[d]},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.SigningCertificate,A.asn1.cms.Attribute);A.asn1.cms.ESSCertID=function(e){A.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,s=n.DEROctetString,o=n.DERSequence,i=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(a,u){if(a.hash!=null)return a.hash;if(typeof a=="string"&&a.indexOf("-----BEGIN")==-1&&!xe.isASN1HEX(a))return a;var l;if(typeof a=="string")l=a;else if(a.cert!=null)l=a.cert;else throw new t("hash nor cert unspecified");var f;l.indexOf("-----BEGIN")!=-1?f=Fr(l):f=l,typeof a=="string"&&(a.indexOf("-----BEGIN")!=-1?f=Fr(a):xe.isASN1HEX(a)&&(f=a));var m;if(a.alg!=null)m=a.alg;else if(u!=null)m=u;else throw new t("hash alg unspecified");return r.crypto.Util.hashHex(f,m)},this.tohex=function(){var a=this.params,u=this.getCertHash(a,"sha1"),l=[];l.push(new s({hex:u})),(typeof a=="string"&&a.indexOf("-----BEGIN")!=-1||a.cert!=null&&a.hasis!=!1||a.issuer!=null&&a.serial!=null)&&l.push(new i(a));var f=new o({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.ESSCertID,A.asn1.ASN1Object);A.asn1.cms.SigningCertificateV2=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.x509,i=n.cms,a=i.ESSCertIDv2,u=r.crypto;i.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new t("parameter 'array' not specified");for(var l=this.params.array,f=[],m=0;m<l.length;m++){var p=l[m];(e.alg!=null||e.hasis==!1)&&typeof p=="string"&&(p.indexOf("-----BEGIN")!=-1||xe.isASN1HEX(p))&&(p={cert:p}),p.alg==null&&e.alg!=null&&(p.alg=e.alg),p.hasis!=!1&&e.hasis==!1&&(p.hasis=!1),f.push(new a(p))}var d=new s({array:f}),v=new s({array:[d]});return[v]},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.SigningCertificateV2,A.asn1.cms.Attribute);A.asn1.cms.ESSCertIDv2=function(e){A.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,s=n.DEROctetString,o=n.DERSequence,i=n.cms.IssuerSerial,a=n.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var u=this.params,l=this.getCertHash(u,"sha256"),f=[];u.alg!=null&&u.alg!="sha256"&&f.push(new a({name:u.alg})),f.push(new s({hex:l})),(typeof u=="string"&&u.indexOf("-----BEGIN")!=-1||u.cert!=null&&u.hasis!=!1||u.issuer!=null&&u.serial!=null)&&f.push(new i(u));var m=new o({array:f});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.ESSCertIDv2,A.asn1.cms.ESSCertID);A.asn1.cms.IssuerSerial=function(e){var t=Error,r=A,n=r.asn1,s=n.DERInteger,o=n.DERSequence,i=n.cms,a=n.x509,u=a.GeneralNames,l=ot;i.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(f){this.params=f},this.tohex=function(){var f=this.params,m,p;if(typeof f=="string"&&f.indexOf("-----BEGIN")!=-1||f.cert!=null){var d;f.cert!=null?d=f.cert:d=f;var v=new l;v.readCertPEM(d),m=v.getIssuer(),p={hex:v.getSerialNumberHex()}}else if(f.issuer!=null&&f.serial)m=f.issuer,p=f.serial;else throw new t("cert or issuer and serial parameter not specified");var g=new u([{dn:m}]),y=new s(p),w=new o({array:[g,y]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.IssuerSerial,A.asn1.ASN1Object);A.asn1.cms.SignerIdentifier=function(e){var t=A,r=t.asn1,n=r.DERInteger,s=r.DERSequence,o=r.cms,i=o.IssuerAndSerialNumber,a=o.SubjectKeyIdentifier,u=r.x509,l=u.X500Name,f=ot,m=Error;o.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params;if(p.type=="isssn"){var d=new i(p);return d.tohex()}else if(p.type=="skid"){var v=new a(p);return v.tohex()}else throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.SignerIdentifier,A.asn1.ASN1Object);A.asn1.cms.IssuerAndSerialNumber=function(e){var t=A,r=t.asn1,n=r.DERInteger,s=r.DERSequence,o=r.cms,i=r.x509,a=i.X500Name,u=ot,l=Error;o.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params,m,p;if(typeof f=="string"&&f.indexOf("-----BEGIN")!=-1||f.cert!=null){var d;f.cert!=null?d=f.cert:d=f;var v=new u;v.readCertPEM(d),m=v.getIssuer(),p={hex:v.getSerialNumberHex()}}else if(f.issuer!=null&&f.serial)m=f.issuer,p=f.serial;else throw new l("cert or issuer and serial parameter not specified");var g=new a(m),y=new n(p),w=new s({array:[g,y]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(f){this.params=f},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.IssuerAndSerialNumber,A.asn1.ASN1Object);A.asn1.cms.SubjectKeyIdentifier=function(e){var t=A,r=t.asn1,n=r.DERInteger,s=r.DERSequence,o=r.ASN1Util.newObject,i=r.cms,a=i.IssuerAndSerialName,u=i.SubjectKeyIdentifier,l=r.x509,f=l.X500Name,m=ot,p=Error;i.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var d=this.params;if(d.cert==null&&d.skid==null)throw new p("property cert nor skid undefined");var v;if(d.cert!=null){var g=new m(d.cert),y=g.getExtSubjectKeyIdentifier();v=y.kid.hex}else d.skid!=null&&(v=d.skid);var w=o({tag:{tage:"a0",obj:{octstr:{hex:v}}}});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.SubjectKeyIdentifier,A.asn1.ASN1Object);A.asn1.cms.AttributeList=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSet,o=n.cms;o.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(i){this.params=i},this.tohex=function(){var i=this.params;if(this.hTLV!=null)return this.hTLV;var a=!0;i.sortflag!=null&&(a=i.sortflag);for(var u=i.array,l=[],f=0;f<u.length;f++){var m=u[f],p=m.attr;if(p=="contentType")l.push(new o.ContentType(m));else if(p=="messageDigest")l.push(new o.MessageDigest(m));else if(p=="signingTime")l.push(new o.SigningTime(m));else if(p=="signingCertificate")l.push(new o.SigningCertificate(m));else if(p=="signingCertificateV2")l.push(new o.SigningCertificateV2(m));else if(p=="signaturePolicyIdentifier")l.push(new A.asn1.cades.SignaturePolicyIdentifier(m));else if(p=="signatureTimeStamp"||p=="timeStampToken")l.push(new A.asn1.cades.SignatureTimeStamp(m));else throw new t("unknown attr: "+p)}var d=new s({array:l,sortflag:a});return this.hTLV=d.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.AttributeList,A.asn1.ASN1Object);A.asn1.cms.SignerInfo=function(e){var t=Error,r=A,n=r.asn1,s=n.DERInteger,o=n.DEROctetString,i=n.DERSequence,a=n.DERTaggedObject,u=n.cms,l=u.SignerIdentifier,f=u.AttributeList,m=u.ContentType,p=u.EncapsulatedContentInfo,d=u.MessageDigest,v=u.SignedData,g=n.x509,y=g.AlgorithmIdentifier,w=r.crypto,E=Pt;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var S=this.params,C=S.sigalg,D=new f(S.sattrs).tohex(),H=E.getKey(S.signkey),K=new w.Signature({alg:C});K.init(H),K.updateHex(D);var _=K.sign();S.sighex=_},this.tohex=function(){var S=this.params,C=[];if(C.push(new s({int:S.version})),C.push(new l(S.id)),C.push(new y({name:S.hashalg})),S.sattrs!=null){var D=new f(S.sattrs);try{C.push(new a({tag:"a0",explicit:!1,obj:D}))}catch(K){throw new t("si sattr error: "+K)}}if(S.sigalgfield!=null?C.push(new y({name:S.sigalgfield})):C.push(new y({name:S.sigalg})),S.sighex==null&&S.signkey!=null&&this.sign(),C.push(new o({hex:S.sighex})),S.uattrs!=null){var D=new f(S.uattrs);try{C.push(new a({tag:"a1",explicit:!1,obj:D}))}catch(_){throw new t("si uattr error: "+_)}}var H=new i({array:C});return H.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.SignerInfo,A.asn1.ASN1Object);A.asn1.cms.EncapsulatedContentInfo=function(e){var t=A,r=t.asn1,n=r.DERTaggedObject,s=r.DERSequence,o=r.DERObjectIdentifier,i=r.DEROctetString,a=r.cms;a.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];if(l.push(new o(u.type)),u.content!=null&&(u.content.hex!=null||u.content.str!=null)&&u.isDetached!=!0){var f=new i(u.content),m=new n({tag:"a0",explicit:!0,obj:f});l.push(m)}var p=new s({array:l});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.EncapsulatedContentInfo,A.asn1.ASN1Object);A.asn1.cms.ContentInfo=function(e){var t=A,r=t.asn1,n=r.DERTaggedObject,s=r.DERSequence,o=r.DERObjectIdentifier,i=r.x509,a=i.OID.name2obj;A.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];l.push(new o(u.type));var f=new n({tag:"a0",explicit:!0,obj:u.obj});l.push(f);var m=new s({array:l});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.ContentInfo,A.asn1.ASN1Object);A.asn1.cms.SignedData=function(e){var t=Error,r=A,n=r.asn1,s=n.ASN1Object,o=n.DERInteger,i=n.DERSet,a=n.DERSequence,u=n.DERTaggedObject,l=n.cms,f=l.EncapsulatedContentInfo,m=l.SignerInfo,p=l.ContentInfo,d=l.CertificateSet,v=l.RevocationInfoChoices,g=n.x509,y=g.AlgorithmIdentifier;A.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var w=this.params;this._setDigestAlgs(w),this._setContentTypeByEContent(w),this._setMessageDigestByEContent(w),this._setSignerInfoVersion(w),this._setSignedDataVersion(w)},this._setDigestAlgs=function(w){for(var E={},S=w.sinfos,C=0;C<S.length;C++){var D=S[C];E[D.hashalg]=1}w.hashalgs=Object.keys(E).sort()},this._setContentTypeByEContent=function(w){for(var E=w.econtent.type,S=w.sinfos,C=0;C<S.length;C++){var D=S[C],H=this._getAttrParamByName(D,"contentType");H.type=E}},this._setMessageDigestByEContent=function(w){var E=w.econtent,S=w.econtent.type,C=E.content.hex;C==null&&E.type=="data"&&E.content.str!=null&&(C=aa(E.content.str));for(var D=w.sinfos,H=0;H<D.length;H++){var K=D[H],_=K.hashalg,x=this._getAttrParamByName(K,"messageDigest"),j=A.crypto.Util.hashHex(C,_);x.hex=j}},this._getAttrParamByName=function(w,E){for(var S=w.sattrs.array,C=0;C<S.length;C++)if(S[C].attr==E)return S[C]},this._setSignerInfoVersion=function(w){for(var E=w.sinfos,S=0;S<E.length;S++){var C=E[S],D=1;C.id.type=="skid"&&(D=3),C.version=D}},this._setSignedDataVersion=function(w){var E=this._getSignedDataVersion(w);w.version=E},this._getSignedDataVersion=function(w){if(w.revinfos!=null)for(var E=w.revinfos,S=0;S<E.length;S++){var C=E[S];if(C.ocsp!=null)return 5}for(var D=w.sinfos,S=0;S<D.length;S++){var H=w.sinfos[S];if(H.version==3)return 3}return w.econtent.type!="data"?3:1},this.tohex=function(){var w=this.params;this.getEncodedHexPrepare!=null&&this.getEncodedHexPrepare(),w.fixed!=!0&&this.checkAndFixParam();var E=[];E.push(new o({int:w.version}));for(var S=[],C=0;C<w.hashalgs.length;C++){var D=w.hashalgs[C];S.push(new y({name:D}))}E.push(new i({array:S})),E.push(new f(w.econtent)),w.certs!=null&&E.push(new d(w.certs)),w.revinfos!=null&&E.push(new v(w.revinfos));for(var H=[],C=0;C<w.sinfos.length;C++){var K=w.sinfos[C];H.push(new m(K))}E.push(new i({array:H}));var _=new a({array:E});return _.tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){var w=new p({type:"signed-data",obj:this});return w},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.SignedData,A.asn1.ASN1Object);A.asn1.cms.CertificateSet=function(e){A.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.DERTaggedObject,s=r.DERSet,o=r.ASN1Object;this.params=null,this.tohex=function(){var i=this.params,a=[],u;if(i instanceof Array)u=i;else if(i.array!=null)u=i.array;else throw new t("cert array not specified");for(var l=0;l<u.length;l++){var f=u[l],m=Fr(f),p=new o;p.hTLV=m,a.push(p)}var d={array:a};i.sortflag==!1&&(d.sortflag=!1);var v=new s(d),g=new n({tag:"a0",explicit:!1,obj:v});return g.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.CertificateSet,A.asn1.ASN1Object);A.asn1.cms.RevocationInfoChoices=function(e){A.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new Error("params is not array");for(var r=[],n=0;n<t.length;n++)r.push(new A.asn1.cms.RevocationInfoChoice(t[n]));var s=A.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:r}}});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.RevocationInfoChoices,A.asn1.ASN1Object);A.asn1.cms.RevocationInfoChoice=function(e){A.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(t.crl!=null&&typeof t.crl=="string"){var r=t.crl;return t.crl.indexOf("-----BEGIN")!=-1&&(r=Fr(t.crl)),r}else if(t.ocsp!=null){var n=A.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new A.asn1.cms.OtherRevocationFormat(t)}});return n.tohex()}else throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.RevocationInfoChoice,A.asn1.ASN1Object);A.asn1.cms.OtherRevocationFormat=function(e){A.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,s=n.ASN1Util.newObject,o=r.lang.String.isHex;this.params=null,this.tohex=function(){var i=this.params;if(i.ocsp==null)throw new t("property ocsp not specified");if(!o(i.ocsp)||!xe.isASN1HEX(i.ocsp))throw new t("ocsp value not ASN.1 hex string");var a=s({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:i.ocsp}}]});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cms.OtherRevocationFormat,A.asn1.ASN1Object);A.asn1.cms.CMSUtil=new function(){};A.asn1.cms.CMSUtil.newSignedData=function(e){return new A.asn1.cms.SignedData(e)};A.asn1.cms.CMSUtil.verifySignedData=function(e){var t=A,r=t.asn1,n=r.cms,s=n.SignerInfo,o=n.SignedData,i=n.SigningTime,a=n.SigningCertificate,u=n.SigningCertificateV2,l=r.cades,f=l.SignaturePolicyIdentifier,m=t.lang.String.isHex,p=xe,d=p.getVbyList,v=p.getTLVbyList,g=p.getIdxbyList,y=p.getChildIdx,w=p.getTLV,E=p.oidname,S=t.crypto.Util.hashHex;e.cms===void 0&&m(e.cms);var C=e.cms,D=function(L,T){for(var M,W=3;W<6;W++)if(M=g(L,0,[1,0,W]),M!==void 0){var G=L.substr(M,2);G==="a0"&&(T.certsIdx=M),G==="a1"&&(T.revinfosIdx=M),G==="31"&&(T.signerinfosIdx=M)}},H=function(L,T){var M=T.signerinfosIdx;if(M!==void 0){var W=y(L,M);T.signerInfoIdxList=W;for(var G=0;G<W.length;G++){var J=W[G],te={idx:J};K(L,te),T.signerInfos.push(te)}}},K=function(L,T){var M=T.idx;T.signerid_issuer1=v(L,M,[1,0],"30"),T.signerid_serial1=d(L,M,[1,1],"02"),T.hashalg=E(d(L,M,[2,0],"06"));var W=g(L,M,[3],"a0");T.idxSignedAttrs=W,_(L,T,W);var G=y(L,M),J=G.length;if(J<6)throw"malformed SignerInfo";T.sigalg=E(d(L,M,[J-2,0],"06")),T.sigval=d(L,M,[J-1],"04")},_=function(L,T,M){var W=y(L,M);T.signedAttrIdxList=W;for(var G=0;G<W.length;G++){var J=W[G],te=d(L,J,[0],"06"),ie;te==="2a864886f70d010905"?(ie=ar(d(L,J,[1,0])),T.saSigningTime=ie):te==="2a864886f70d010904"&&(ie=d(L,J,[1,0],"04"),T.saMessageDigest=ie)}},x=function(L,T){if(d(L,0,[0],"06")!=="2a864886f70d010702")return T;T.cmsType="signedData",T.econtent=d(L,0,[1,0,2,1,0]),D(L,T),T.signerInfos=[],H(L,T)},j=function(L,T){for(var M=T.parse.signerInfos,W=M.length,G=!0,J=0;J<W;J++){var te=M[J];k(L,T,te,J),te.isValid||(G=!1)}T.isValid=G},U=function(L,T,M,W){var G=T.parse.certsIdx,J;if(T.certs===void 0){J=[],T.certkeys=[];for(var te=y(L,G),ie=0;ie<te.length;ie++){var ge=w(L,te[ie]),he=new ot;he.readCertHex(ge),J[ie]=he,T.certkeys[ie]=he.getPublicKey()}T.certs=J}else J=T.certs;T.cccc=J.length,T.cccci=te.length;for(var ie=0;ie<J.length;ie++){var Fe=he.getIssuerHex(),ke=he.getSerialNumberHex();M.signerid_issuer1===Fe&&M.signerid_serial1===ke&&(M.certkey_idx=ie)}},k=function(L,T,M,W){M.verifyDetail={};var G=M.verifyDetail,J=T.parse.econtent,te=M.hashalg,ie=M.saMessageDigest;G.validMessageDigest=!1,S(J,te)===ie&&(G.validMessageDigest=!0),U(L,T,M,W),G.validSignatureValue=!1;var ge=M.sigalg,he="31"+w(L,M.idxSignedAttrs).substr(2);M.signedattrshex=he;var Fe=T.certs[M.certkey_idx].getPublicKey(),ke=new A.crypto.Signature({alg:ge});ke.init(Fe),ke.updateHex(he);var $e=ke.verify(M.sigval);G.validSignatureValue_isValid=$e,$e===!0&&(G.validSignatureValue=!0),M.isValid=!1,G.validMessageDigest&&G.validSignatureValue&&(M.isValid=!0)},N=function(){},O={isValid:!1,parse:{}};return x(C,O.parse),j(C,O),O};A.asn1.cms.CMSParser=function(){var e=Error,t=ot,r=new t,n=xe,s=n.getV,o=n.getTLV,i=n.getIdxbyList,a=n.getTLVbyList,u=n.getTLVbyListEx,l=n.getVbyList,f=n.getVbyListEx,m=n.getChildIdx;this.getCMSSignedData=function(p){var d=a(p,0,[1,0]),v=this.getSignedData(d);return v},this.getSignedData=function(p){var d=m(p,0),v={},g=s(p,d[0]),y=parseInt(g,16);v.version=y;var w=o(p,d[1]);v.hashalgs=this.getHashAlgArray(w);var E=o(p,d[2]);v.econtent=this.getEContent(E);var S=u(p,0,["[0]"]);S!=null&&(v.certs=this.getCertificateSet(S));var C=u(p,0,["[1]"]);C!=null;var D=u(p,0,[3]);return v.sinfos=this.getSignerInfos(D),v},this.getHashAlgArray=function(p){for(var d=m(p,0),v=new t,g=[],y=0;y<d.length;y++){var w=o(p,d[y]),E=v.getAlgorithmIdentifierName(w);g.push(E)}return g},this.getEContent=function(p){var d={},v=l(p,0,[0]),g=l(p,0,[1,0]);return d.type=A.asn1.x509.OID.oid2name(xe.hextooidstr(v)),d.content={hex:g},d},this.getSignerInfos=function(p){for(var d=[],v=m(p,0),g=0;g<v.length;g++){var y=o(p,v[g]),w=this.getSignerInfo(y);d.push(w)}return d},this.getSignerInfo=function(p){var d={},v=m(p,0),g=n.getInt(p,v[0],-1);g!=-1&&(d.version=g);var y=o(p,v[1]),w=this.getIssuerAndSerialNumber(y);d.id=w;var E=o(p,v[2]),S=r.getAlgorithmIdentifierName(E);d.hashalg=S;var C=u(p,0,["[0]"]);if(C!=null){var D=this.getAttributeList(C);d.sattrs=D}var H=u(p,0,[3]),K=r.getAlgorithmIdentifierName(H);d.sigalg=K;var _=f(p,0,[4]);d.sighex=_;var x=u(p,0,["[1]"]);if(x!=null){var j=this.getAttributeList(x);d.uattrs=j}return d},this.getSignerIdentifier=function(p){if(p.substr(0,2)=="30")return this.getIssuerAndSerialNumber(p);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(p){var d={type:"isssn"},v=m(p,0),g=o(p,v[0]);d.issuer=r.getX500Name(g);var y=s(p,v[1]);return d.serial={hex:y},d},this.getAttributeList=function(p){for(var d=[],v=m(p,0),g=0;g<v.length;g++){var y=o(p,v[g]),w=this.getAttribute(y);d.push(w)}return{array:d}},this.getAttribute=function(p){var d={},v=m(p,0),g=n.getOID(p,v[0]),y=A.asn1.x509.OID.oid2name(g);d.attr=y;var w=o(p,v[1]),E=m(w,0);if(E.length==1)d.valhex=o(w,E[0]);else{for(var S=[],C=0;C<E.length;C++)S.push(o(w,E[C]));d.valhex=S}return y=="contentType"?this.setContentType(d):y=="messageDigest"?this.setMessageDigest(d):y=="signingTime"?this.setSigningTime(d):y=="signingCertificate"?this.setSigningCertificate(d):y=="signingCertificateV2"?this.setSigningCertificateV2(d):y=="signaturePolicyIdentifier"&&this.setSignaturePolicyIdentifier(d),d},this.setContentType=function(p){var d=n.getOIDName(p.valhex,0,null);d!=null&&(p.type=d,delete p.valhex)},this.setSigningTime=function(p){var d=s(p.valhex,0),v=ar(d);p.str=v,delete p.valhex},this.setMessageDigest=function(p){var d=s(p.valhex,0);p.hex=d,delete p.valhex},this.setSigningCertificate=function(p){var d=m(p.valhex,0);if(d.length>0){for(var v=o(p.valhex,d[0]),g=m(v,0),y=[],w=0;w<g.length;w++){var E=o(v,g[w]),S=this.getESSCertID(E);y.push(S)}p.array=y}if(d.length>1){var C=o(p.valhex,d[1]);p.polhex=C}delete p.valhex},this.setSignaturePolicyIdentifier=function(p){var d=m(p.valhex,0);if(d.length>0){var v=n.getOID(p.valhex,d[0]);p.oid=v}if(d.length>1){var g=new t,y=m(p.valhex,d[1]),w=o(p.valhex,y[0]),E=g.getAlgorithmIdentifierName(w);p.alg=E;var S=s(p.valhex,y[1]);p.hash=S}delete p.valhex},this.setSigningCertificateV2=function(p){var d=m(p.valhex,0);if(d.length>0){for(var v=o(p.valhex,d[0]),g=m(v,0),y=[],w=0;w<g.length;w++){var E=o(v,g[w]),S=this.getESSCertIDv2(E);y.push(S)}p.array=y}if(d.length>1){var C=o(p.valhex,d[1]);p.polhex=C}delete p.valhex},this.getESSCertID=function(p){var d={},v=m(p,0);if(v.length>0){var g=s(p,v[0]);d.hash=g}if(v.length>1){var y=o(p,v[1]),w=this.getIssuerSerial(y);w.serial!=null&&(d.serial=w.serial),w.issuer!=null&&(d.issuer=w.issuer)}return d},this.getESSCertIDv2=function(p){var d={},v=m(p,0);if(v.length<1||3<v.length)throw new e("wrong number of elements");var g=0;if(p.substr(v[0],2)=="30"){var y=o(p,v[0]);d.alg=r.getAlgorithmIdentifierName(y),g++}else d.alg="sha256";var w=s(p,v[g]);if(d.hash=w,v.length>g+1){var E=o(p,v[g+1]),S=this.getIssuerSerial(E);d.issuer=S.issuer,d.serial=S.serial}return d},this.getIssuerSerial=function(p){var d={},v=m(p,0),g=o(p,v[0]),y=r.getGeneralNames(g),w=y[0].dn;d.issuer=w;var E=s(p,v[1]);return d.serial={hex:E},d},this.getCertificateSet=function(p){for(var d=m(p,0),v=[],g=0;g<d.length;g++){var y=o(p,d[g]);if(y.substr(0,2)=="30"){var w=rs(y,"CERTIFICATE");v.push(w)}}return{array:v,sortflag:!1}}};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.tsp>"u"||!A.asn1.tsp)&&(A.asn1.tsp={});A.asn1.tsp.TimeStampToken=function(e){var t=A,r=t.asn1,n=r.tsp;n.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var s=new n.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=s.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.tsp.TimeStampToken,A.asn1.cms.SignedData);A.asn1.tsp.TSTInfo=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.DERInteger,i=n.DERBoolean,a=n.DERGeneralizedTime,u=n.DERObjectIdentifier,l=n.DERTaggedObject,f=n.tsp,m=f.MessageImprint,p=f.Accuracy,d=n.x509.X500Name,v=n.x509.GeneralName;if(f.TSTInfo.superclass.constructor.call(this),this.dVersion=new o({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var g=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(g.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(g.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(g.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");g.push(this.dGenTime),this.dAccuracy!=null&&g.push(this.dAccuracy),this.dOrdering!=null&&g.push(this.dOrdering),this.dNonce!=null&&g.push(this.dNonce),this.dTsa!=null&&g.push(this.dTsa);var y=new s({array:g});return this.hTLV=y.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0){if(typeof e.policy=="string"){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new u({oid:e.policy})}e.messageImprint!==void 0&&(this.dMessageImprint=new m(e.messageImprint)),e.serial!==void 0&&(this.dSerial=new o(e.serial)),e.genTime!==void 0&&(this.dGenTime=new a(e.genTime)),e.accuracy!==void 0&&(this.dAccuracy=new p(e.accuracy)),e.ordering!==void 0&&e.ordering==!0&&(this.dOrdering=new i),e.nonce!==void 0&&(this.dNonce=new o(e.nonce)),e.tsa!==void 0&&(this.dTsa=new l({tag:"a0",explicit:!0,obj:new v({dn:e.tsa})}))}};Ae(A.asn1.tsp.TSTInfo,A.asn1.ASN1Object);A.asn1.tsp.Accuracy=function(e){var t=A,r=t.asn1,n=r.ASN1Util.newObject;r.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var s=this.params,o=[];return s.seconds!=null&&typeof s.seconds=="number"&&o.push({int:s.seconds}),s.millis!=null&&typeof s.millis=="number"&&o.push({tag:{tagi:"80",obj:{int:s.millis}}}),s.micros!=null&&typeof s.micros=="number"&&o.push({tag:{tagi:"81",obj:{int:s.micros}}}),n({seq:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.tsp.Accuracy,A.asn1.ASN1Object);A.asn1.tsp.MessageImprint=function(e){var t=A,r=t.asn1,n=r.DERSequence,s=r.DEROctetString,o=r.x509,i=o.AlgorithmIdentifier;r.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params,u=new i({name:a.alg}),l=new s({hex:a.hash}),f=new n({array:[u,l]});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.tsp.MessageImprint,A.asn1.ASN1Object);A.asn1.tsp.TimeStampReq=function(e){var t=A,r=t.asn1,n=r.DERSequence,s=r.DERInteger,o=r.DERBoolean,i=r.ASN1Object,a=r.DERObjectIdentifier,u=r.tsp,l=u.MessageImprint;u.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params,m=[];m.push(new s({int:1})),f.messageImprint instanceof A.asn1.ASN1Object?m.push(f.messageImprint):m.push(new l(f.messageImprint)),f.policy!=null&&m.push(new a(f.policy)),f.nonce!=null&&m.push(new s(f.nonce)),f.certreq==!0&&m.push(new o);var p=new n({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.tsp.TimeStampReq,A.asn1.ASN1Object);A.asn1.tsp.TimeStampResp=function(e){var t=A,r=t.asn1,n=r.DERSequence,s=r.ASN1Object,o=r.tsp,i=o.PKIStatusInfo;o.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params,u=[];if(a.econtent!=null||a.tst!=null)if(a.statusinfo!=null?u.push(new i(a.statusinfo)):u.push(new i("granted")),a.econtent!=null)u.push(new o.TimeStampToken(a).getContentInfo());else if(a.tst instanceof r.ASN1Object)u.push(a.tst);else throw new Error("improper member tst value");else if(a.statusinfo!=null)u.push(new i(a.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var l=new n({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.tsp.TimeStampResp,A.asn1.ASN1Object);A.asn1.tsp.PKIStatusInfo=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.tsp,i=o.PKIStatus,a=o.PKIFreeText,u=o.PKIFailureInfo;o.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params,f=[];if(typeof l=="string")f.push(new i(l));else{if(l.status==null)throw new t("property 'status' unspecified");f.push(new i(l.status)),l.statusstr!=null&&f.push(new a(l.statusstr)),l.failinfo!=null&&f.push(new u(l.failinfo))}var m=new s({array:f});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.tsp.PKIStatusInfo,A.asn1.ASN1Object);A.asn1.tsp.PKIStatus=function(e){var t=Error,r=A,n=r.asn1,s=n.DERInteger,o=n.tsp;o.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var a=this.params,u,l;if(typeof a=="string")try{l=i[a]}catch{throw new t("undefined name: "+a)}else if(typeof a=="number")l=a;else throw new t("unsupported params");return new s({int:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.tsp.PKIStatus,A.asn1.ASN1Object);A.asn1.tsp.PKIFreeText=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.DERUTF8String,i=n.tsp;i.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params;if(!(a instanceof Array))throw new t("wrong params: not array");for(var u=[],l=0;l<a.length;l++)u.push(new o({str:a[l]}));var f=new s({array:u});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.tsp.PKIFreeText,A.asn1.ASN1Object);A.asn1.tsp.PKIFailureInfo=function(e){var t=Error,r=A,n=r.asn1,s=n.DERBitString,o=n.tsp,i=o.PKIFailureInfo,a={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getBinValue=function(){var u=this.params,l=0;if(typeof u=="number"&&0<=u&&u<=25){l|=1<<u;for(var f=l.toString(2),m="",p=f.length-1;p>=0;p--)m+=f[p];return m}else{if(typeof u=="string"&&a[u]!=null)return Jg([u],a);if(typeof u=="object"&&u.length!=null)return Jg(u,a);throw new t("wrong params")}},this.tohex=function(){var u=this.params,l=this.getBinValue();return new s({bin:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.tsp.PKIFailureInfo,A.asn1.ASN1Object);A.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(t,r){throw"not implemented yet"}};A.asn1.tsp.SimpleTSAAdapter=function(e){var t=A,r=t.asn1,n=r.tsp,s=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(o,i){var a=s(o,i);this.params.econtent.content.messageImprint={alg:i,hash:a},this.params.econtent.content.serial={int:this.serial++};var u=Math.floor(Math.random()*1e9);this.params.econtent.content.nonce={int:u};var l=new n.TimeStampToken(this.params);return l.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};Ae(A.asn1.tsp.SimpleTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.FixedTSAAdapter=function(e){var t=A,r=t.asn1,n=r.tsp,s=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(o,i){var a=s(o,i);this.params.econtent.content.messageImprint={alg:i,hash:a};var u=new n.TimeStampToken(this.params);return u.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};Ae(A.asn1.tsp.FixedTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.TSPUtil=new function(){};A.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new A.asn1.tsp.TimeStampToken(e)};A.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=new A.asn1.tsp.TSPParser;return t.getTimeStampReq(e)};A.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=new A.asn1.tsp.TSPParser;return t.getMessageImprint(e)};A.asn1.tsp.TSPParser=function(){var e=Error,t=ot,r=new t,n=xe,s=n.getV,o=n.getTLV,i=n.getIdxbyList,a=n.getTLVbyListEx,u=n.getChildIdx,l=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],f={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(m){var p=u(m,0);if(p.length==1)return this.getPKIStatusInfo(o(m,p[0]));if(p.length>1){var d=this.getPKIStatusInfo(o(m,p[0])),v=o(m,p[1]),g=this.getToken(v);return g.statusinfo=d,g}},this.getToken=function(m){var p=new A.asn1.cms.CMSParser,d=p.getCMSSignedData(m);return this.setTSTInfo(d),d},this.setTSTInfo=function(m){var p=m.econtent;if(p.type=="tstinfo"){var d=p.content.hex,v=this.getTSTInfo(d);p.content=v}},this.getTSTInfo=function(m){var p={},d=u(m,0),v=s(m,d[1]);p.policy=o2(v);var g=o(m,d[2]);p.messageImprint=this.getMessageImprint(g);var y=s(m,d[3]);p.serial={hex:y};var w=s(m,d[4]);p.genTime={str:ar(w)};var E=0;if(d.length>5&&m.substr(d[5],2)=="30"){var S=o(m,d[5]);p.accuracy=this.getAccuracy(S),E++}if(d.length>5+E&&m.substr(d[5+E],2)=="01"){var C=s(m,d[5+E]);C=="ff"&&(p.ordering=!0),E++}if(d.length>5+E&&m.substr(d[5+E],2)=="02"){var D=s(m,d[5+E]);p.nonce={hex:D},E++}if(d.length>5+E&&m.substr(d[5+E],2)=="a0"){var H=o(m,d[5+E]);H="30"+H.substr(2),pGeneralNames=r.getGeneralNames(H);var K=pGeneralNames[0].dn;p.tsa=K,E++}if(d.length>5+E&&m.substr(d[5+E],2)=="a1"){var _=o(m,d[5+E]);_="30"+_.substr(2);var x=r.getExtParamArray(_);p.ext=x,E++}return p},this.getAccuracy=function(m){for(var p={},d=u(m,0),v=0;v<d.length;v++){var g=m.substr(d[v],2),y=s(m,d[v]),w=parseInt(y,16);g=="02"?p.seconds=w:g=="80"?p.millis=w:g=="81"&&(p.micros=w)}return p},this.getMessageImprint=function(m){if(m.substr(0,2)!="30")throw new Error("head of messageImprint hex shall be x30");var p={},d=u(m,0),v=i(m,0,[0,0]),g=s(m,v),y=n.hextooidstr(g),w=A.asn1.x509.OID.oid2name(y);if(w=="")throw new Error("hashAlg name undefined: "+y);var E=w,S=i(m,0,[1]);return p.alg=E,p.hash=s(m,S),p},this.getPKIStatusInfo=function(m){var p={},d=u(m,0),v=0;try{var g=s(m,d[0]),y=parseInt(g,16);p.status=l[y]}catch{}if(d.length>1&&m.substr(d[1],2)=="30"){var w=o(m,d[1]);p.statusstr=this.getPKIFreeText(w),v++}if(d.length>v&&m.substr(d[1+v],2)=="03"){var E=o(m,d[1+v]);p.failinfo=this.getPKIFailureInfo(E)}return p},this.getPKIFreeText=function(m){for(var p=[],d=u(m,0),v=0;v<d.length;v++)p.push(n.getString(m,d[v]));return p},this.getPKIFailureInfo=function(m){var p=n.getInt(m,0);return f[p]!=null?f[p]:p},this.getTimeStampReq=function(m){var p={};p.certreq=!1;var d=u(m,0);if(d.length<2)throw new Error("TimeStampReq must have at least 2 items");var v=o(m,d[1]);p.messageImprint=A.asn1.tsp.TSPUtil.parseMessageImprint(v);for(var g=2;g<d.length;g++){var y=d[g],w=m.substr(y,2);if(w=="06"){var E=s(m,y);p.policy=n.hextooidstr(E)}w=="02"&&(p.nonce=s(m,y)),w=="01"&&(p.certreq=!0)}return p}};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cades>"u"||!A.asn1.cades)&&(A.asn1.cades={});A.asn1.cades.SignaturePolicyIdentifier=function(e){var t=A,r=t.asn1,n=r.cades,s=n.SignaturePolicyId;n.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new s(this.params)]},this.setByParam=function(o){this.params=o},e!=null&&this.setByParam(e)};Ae(A.asn1.cades.SignaturePolicyIdentifier,A.asn1.cms.Attribute);A.asn1.cades.SignaturePolicyId=function(e){var t=A,r=t.asn1,n=r.DERSequence,s=r.DERObjectIdentifier,o=r.x509,i=o.AlgorithmIdentifier,a=r.cades,u=a.SignaturePolicyId,l=a.OtherHashAlgAndValue;u.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params,m=[];m.push(new s(f.oid)),m.push(new l(f));var p=new n({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(f){this.params=f},e!=null&&this.setByParam(e)};Ae(A.asn1.cades.SignaturePolicyId,A.asn1.ASN1Object);A.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.DEROctetString,i=n.x509,a=i.AlgorithmIdentifier,u=n.cades,l=u.OtherHashAlgAndValue;l.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params;if(f.alg==null)throw new t("property 'alg' not specified");if(f.hash==null&&f.cert==null)throw new t("property 'hash' nor 'cert' not specified");var m=null;if(f.hash!=null)m=f.hash;else if(f.cert!=null){if(typeof f.cert!="string")throw new t("cert not string");var p=f.cert;f.cert.indexOf("-----BEGIN")!=-1&&(p=Fr(f.cert)),m=A.crypto.Util.hashHex(p,f.alg)}var d=[];d.push(new a({name:f.alg})),d.push(new o({hex:m}));var v=new s({array:d});return v.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cades.OtherHashAlgAndValue,A.asn1.ASN1Object);A.asn1.cades.OtherHashValue=function(e){A.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,r=A,n=r.lang.String.isHex,s=r.asn1,o=s.DEROctetString,i=r.crypto.Util.hashHex;this.params=null,this.tohex=function(){var a=this.params;if(a.hash==null&&a.cert==null)throw new t("hash or cert not specified");var u=null;if(a.hash!=null)u=a.hash;else if(a.cert!=null){if(typeof a.cert!="string")throw new t("cert not string");var l=a.cert;a.cert.indexOf("-----BEGIN")!=-1&&(l=Fr(a.cert)),u=A.crypto.Util.hashHex(l,"sha1")}return new o({hex:u}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cades.OtherHashValue,A.asn1.ASN1Object);A.asn1.cades.SignatureTimeStamp=function(e){var t=Error,r=A,n=r.lang.String.isHex,s=r.asn1,o=s.ASN1Object,i=s.x509,a=s.cades;a.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var u=this.params;if(u.tst!=null)if(n(u.tst)){var l=new o;return l.hTLV=u.tst,[l]}else{if(u.tst instanceof o)return[u.tst];throw new t("params.tst has wrong value")}else if(u.res!=null){var f=u.res;if(f instanceof o&&(f=f.tohex()),typeof f!="string"||!n(f))throw new t("params.res has wrong value");var m=xe.getTLVbyList(f,0,[1]),l=new o;return l.hTLV=u.tst,[l]}},e!=null&&this.setByParam(e)};Ae(A.asn1.cades.SignatureTimeStamp,A.asn1.cms.Attribute);A.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.cades,i=o.OtherCertID,a=r.lang.String.isHex;o.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var u=this.params,l=[],f=0;f<u.array.length;f++){var m=u.array[f];if(typeof m=="string")if(m.indexOf("-----BEGIN")!=-1)m={cert:m};else if(a(m))m={hash:m};else throw new t("unsupported value: "+m);u.alg!=null&&m.alg==null&&(m.alg=u.alg),u.hasis!=null&&m.hasis==null&&(m.hasis=u.hasis);var p=new i(m);l.push(p)}var d=new s({array:l});return[d]},e!=null&&this.setByParam(e)};Ae(A.asn1.cades.CompleteCertificateRefs,A.asn1.cms.Attribute);A.asn1.cades.OtherCertID=function(e){var t=A,r=t.asn1,n=r.DERSequence,s=r.cms,o=s.IssuerSerial,i=r.cades,a=i.OtherHashValue,u=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=e,this.tohex=function(){var l=this.params;typeof l=="string"&&(l.indexOf("-----BEGIN")!=-1?l={cert:l}:_isHex(l)&&(l={hash:l}));var f=[],m=null;if(l.alg!=null?m=new u(l):m=new a(l),f.push(m),l.cert!=null&&l.hasis==!0||l.issuer!=null&&l.serial!=null){var p=new o(l);f.push(p)}var d=new n({array:f});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cades.OtherCertID,A.asn1.ASN1Object);A.asn1.cades.OtherHash=function(e){var t=Error,r=A,n=r.asn1,s=n.cms,o=n.cades,i=o.OtherHashAlgAndValue,a=o.OtherHashValue,u=r.crypto.Util.hashHex,l=r.lang.String.isHex;o.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params;typeof f=="string"&&(f.indexOf("-----BEGIN")!=-1?f={cert:f}:l(f)&&(f={hash:f}));var m=null;return f.alg!=null?m=new i(f):m=new a(f),m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ae(A.asn1.cades.OtherHash,A.asn1.ASN1Object);A.asn1.cades.CAdESUtil=new function(){};A.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){var t=new A.asn1.cms.CMSParser,r=t.getCMSSignedData(e);return r};A.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,r){var n=xe,s=n.getChildIdx,o=n.getTLV,i=n.getV,a=A,u=a.asn1,l=u.ASN1Object,f=u.cms,m=f.AttributeList,p=f.SignerInfo,d={},v=s(e,t);if(v.length!=6)throw"not supported items for SignerInfo (!=6)";var g=v.shift();d.version=o(e,g);var y=v.shift();d.si=o(e,y);var w=v.shift();d.digalg=o(e,w);var E=v.shift();d.sattrs=o(e,E);var S=v.shift();d.sigalg=o(e,S);var C=v.shift();d.sig=o(e,C),d.sigval=i(e,C);var D=null;return d.obj=new p,D=new l,D.hTLV=d.version,d.obj.dCMSVersion=D,D=new l,D.hTLV=d.si,d.obj.dSignerIdentifier=D,D=new l,D.hTLV=d.digalg,d.obj.dDigestAlgorithm=D,D=new l,D.hTLV=d.sattrs,d.obj.dSignedAttrs=D,D=new l,D.hTLV=d.sigalg,d.obj.dSigAlg=D,D=new l,D.hTLV=d.sig,d.obj.dSig=D,d.obj.dUnsignedAttrs=new m,d};(typeof A.asn1.csr>"u"||!A.asn1.csr)&&(A.asn1.csr={});A.asn1.csr.CertificationRequest=function(e){var t=A,r=t.asn1,n=r.DERBitString,s=r.DERSequence,o=r.csr,i=r.x509,a=o.CertificationRequestInfo;o.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(u){this.params=u},this.sign=function(){var u=new a(this.params).tohex(),l=new A.crypto.Signature({alg:this.params.sigalg});l.init(this.params.sbjprvkey),l.updateHex(u);var f=l.sign();this.params.sighex=f},this.getPEM=function(){return rs(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var u=this.params,l=new A.asn1.csr.CertificationRequestInfo(this.params),f=new A.asn1.x509.AlgorithmIdentifier({name:u.sigalg});if(u.sighex==null&&u.sbjprvkey!=null&&this.sign(),u.sighex==null)throw new Error("sighex or sbjprvkey parameter not defined");var m=new n({hex:"00"+u.sighex}),p=new s({array:[l,f,m]});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.csr.CertificationRequest,A.asn1.ASN1Object);A.asn1.csr.CertificationRequestInfo=function(e){var t=A,r=t.asn1,n=r.DERBitString,s=r.DERSequence,o=r.DERInteger,i=r.DERUTF8String,a=r.DERTaggedObject,u=r.ASN1Util.newObject,l=r.csr,f=r.x509,m=f.X500Name,p=f.Extensions,d=f.SubjectPublicKeyInfo,v=l.AttributeList;l.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(y){y!=null&&(this.params=y)},this.tohex=function(){var y=this.params,w=[];if(w.push(new o({int:0})),w.push(new m(y.subject)),w.push(new d(Pt.getKey(y.sbjpubkey))),y.attrs!=null){var E=g(y.attrs),S=u({tag:{tage:"a0",obj:E}});w.push(S)}else if(y.extreq!=null){var C=new p(y.extreq),S=u({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[C]}]}}});w.push(S)}else w.push(new a({tag:"a0",explicit:!1,obj:new i({str:""})}));var D=new s({array:w});return D.tohex()},this.getEncodedHex=function(){return this.tohex()};function g(y){for(var w=Error,E=A.asn1.x509.Extensions,S=[],C=0;C<y.length;C++){var D=y[C],H=D.attr;if(H=="extensionRequest"){var K=new E(D.ext),_={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[K]}]};S.push(_)}else if(H=="unstructuredName"){var _={seq:[{oid:"1.2.840.113549.1.9.2"},{set:D.names}]};S.push(_)}else if(H=="challengePassword"){var _={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:D.password}]}]};S.push(_)}else throw new w("unknown CSR attribute")}return{set:S}}e!=null&&this.setByParam(e)};Ae(A.asn1.csr.CertificationRequestInfo,A.asn1.ASN1Object);A.asn1.csr.AttributeList=function(e){function t(r){}};Ae(A.asn1.csr.AttributeList,A.asn1.ASN1Object);A.asn1.csr.CSRUtil=new function(){};A.asn1.csr.CSRUtil.newCSRPEM=function(e){var t=Pt,r=A.asn1.csr,n=new r.CertificationRequest(e),s=n.getPEM();return s};A.asn1.csr.CSRUtil.getParam=function(e,t){var r=xe,n=r.getV,s=r.getIdxbyList,o=r.getTLVbyList,i=r.getTLVbyListEx,a=r.getVbyListEx,u=function(E){var S=s(E,0,[0,3,0,0],"06");return n(E,S)!="2a864886f70d01090e"?null:o(E,0,[0,3,0,1,0],"30")},l={};if(e.indexOf("-----BEGIN CERTIFICATE REQUEST")==-1)throw new Error("argument is not PEM file");var f=Fr(e,"CERTIFICATE REQUEST");t&&(l.tbs=o(f,0,[0]));try{var m=i(f,0,[0,1]);if(m=="3000")l.subject={};else{var g=new ot;l.subject=g.getX500Name(m)}}catch{}var p=i(f,0,[0,2]),d=Pt.getKey(p,null,"pkcs8pub");l.sbjpubkey=Pt.getPEM(d,"PKCS8PUB");var v=u(f),g=new ot;v!=null&&(l.extreq=g.getExtParamArray(v));try{var y=i(f,0,[1],"30"),g=new ot;l.sigalg=g.getAlgorithmIdentifierName(y)}catch{}try{var w=a(f,0,[2]);l.sighex=w}catch{}return l};A.asn1.csr.CSRUtil.verifySignature=function(e){try{var t=null;if(typeof e=="string"&&e.indexOf("-----BEGIN CERTIFICATE REQUEST")!=-1?t=A.asn1.csr.CSRUtil.getParam(e,!0):typeof e=="object"&&e.sbjpubkey!=null&&e.sigalg!=null&&e.sighex!=null&&e.tbs!=null&&(t=e),t==null)return!1;var r=new A.crypto.Signature({alg:t.sigalg});return r.init(t.sbjpubkey),r.updateHex(t.tbs),r.verify(t.sighex)}catch(n){return alert(n),!1}};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.ocsp>"u"||!A.asn1.ocsp)&&(A.asn1.ocsp={});A.asn1.ocsp.DEFAULT_HASH="sha1";A.asn1.ocsp.OCSPResponse=function(e){A.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);var t=A.asn1.DEREnumerated,r=A.asn1.ASN1Util.newObject,n=A.asn1.ocsp.ResponseBytes,s=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var o=this.params.resstatus;return typeof o=="number"?o:typeof o!="string"?-1:s.indexOf(o)},this.setByParam=function(o){this.params=o},this.tohex=function(){var o=this.params,i=this._getStatusCode();if(i==-1)throw new Error("responseStatus not supported: "+o.resstatus);if(i!=0)return r({seq:[{enum:{int:i}}]}).tohex();var a=new n(o);return r({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:a}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.OCSPResponse,A.asn1.ASN1Object);A.asn1.ocsp.ResponseBytes=function(e){A.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=A.asn1,r=t.DERSequence,n=t.DERObjectIdentifier,s=t.DEROctetString,o=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(i){this.params=i},this.tohex=function(){var i=this.params;if(i.restype!="ocspBasic")throw new Error("not supported responseType: "+i.restype);var a=new o(i),u=[];u.push(new n({name:"ocspBasic"})),u.push(new s({hex:a.tohex()}));var l=new r({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.ResponseBytes,A.asn1.ASN1Object);A.asn1.ocsp.BasicOCSPResponse=function(e){A.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.ASN1Object,s=r.DERSequence,o=r.DERGeneralizedTime,i=r.DERTaggedObject,a=r.DERBitString,u=r.x509.Extensions,l=r.x509.AlgorithmIdentifier,f=r.ocsp,m=f.ResponderID;_SingleResponseList=f.SingleResponseList,_ResponseData=f.ResponseData,this.params=null,this.setByParam=function(p){this.params=p},this.sign=function(){var p=this.params,d=p.tbsresp.tohex(),v=new A.crypto.Signature({alg:p.sigalg});v.init(p.reskey),v.updateHex(d),p.sighex=v.sign()},this.tohex=function(){var p=this.params;p.tbsresp==null&&(p.tbsresp=new _ResponseData(p)),p.sighex==null&&p.reskey!=null&&this.sign();var d=[];if(d.push(p.tbsresp),d.push(new l({name:p.sigalg})),d.push(new a({hex:"00"+p.sighex})),p.certs!=null&&p.certs.length!=null){for(var v=[],g=0;g<p.certs.length;g++){var y=p.certs[g],w=null;if(xe.isASN1HEX(y))w=y;else if(y.match(/-----BEGIN/))w=Fr(y);else throw new t("certs["+g+"] not hex or PEM");v.push(new n({tlv:w}))}var E=new s({array:v});d.push(new i({tag:"a0",explicit:!0,obj:E}))}var S=new s({array:d});return S.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.BasicOCSPResponse,A.asn1.ASN1Object);A.asn1.ocsp.ResponseData=function(e){A.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.DERSequence,s=r.DERGeneralizedTime,o=r.DERTaggedObject,i=r.x509.Extensions,a=r.ocsp,u=a.ResponderID;_SingleResponseList=a.SingleResponseList,this.params=null,this.tohex=function(){var l=this.params;l.respid!=null&&new t("respid not specified"),l.prodat!=null&&new t("prodat not specified"),l.array!=null&&new t("array not specified");var f=[];if(f.push(new u(l.respid)),f.push(new s(l.prodat)),f.push(new _SingleResponseList(l.array)),l.ext!=null){var m=new i(l.ext);f.push(new o({tag:"a1",explicit:!0,obj:m}))}var p=new n({array:f});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(l){this.params=l},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.ResponseData,A.asn1.ASN1Object);A.asn1.ocsp.ResponderID=function(e){A.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.ASN1Util.newObject,s=r.x509.X500Name,o=t.lang.String.isHex,i=Error;this.params=null,this.tohex=function(){var a=this.params;if(a.key!=null){var u=null;if(typeof a.key=="string"){if(o(a.key)&&(u=a.key),a.key.match(/-----BEGIN CERTIFICATE/)){var l=new ot(a.key),f=l.getExtSubjectKeyIdentifier();f!=null&&(u=f.kid.hex)}}else if(a.key instanceof ot){var f=a.key.getExtSubjectKeyIdentifier();f!=null&&(u=f.kid.hex)}if(u==null)throw new i("wrong key member value");var m=n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:u}}}});return m.tohex()}else if(a.name!=null){var p=null;if(typeof a.name=="string"&&a.name.match(/-----BEGIN CERTIFICATE/)){var l=new ot(a.name);p=l.getSubject()}else a.name instanceof ot?p=a.name.getSubject():typeof a.name=="object"&&(a.name.array!=null||a.name.str!=null)&&(p=a.name);if(p==null)throw new i("wrong name member value");var m=n({tag:{tag:"a1",explicit:!0,obj:new s(p)}});return m.tohex()}throw new i("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(a){this.params=a},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.ResponderID,A.asn1.ASN1Object);A.asn1.ocsp.SingleResponseList=function(e){A.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=A.asn1,r=t.DERSequence,n=t.ocsp.SingleResponse;this.params=null,this.tohex=function(){var s=this.params;if(typeof s!="object"||s.length==null)throw new Error("params not specified properly");for(var o=[],i=0;i<s.length;i++)o.push(new n(s[i]));var a=new r({array:o});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(s){this.params=s},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.SingleResponseList,A.asn1.ASN1Object);A.asn1.ocsp.SingleResponse=function(e){var t=Error,r=A,n=r.asn1,s=n.DERSequence,o=n.DERGeneralizedTime,i=n.DERTaggedObject,a=n.ocsp,u=a.CertID,l=a.CertStatus,f=n.x509,m=f.Extensions;a.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params,d=[];if(p.certid==null)throw new t("certid unspecified");if(p.status==null)throw new t("status unspecified");if(p.thisupdate==null)throw new t("thisupdate unspecified");if(d.push(new u(p.certid)),d.push(new l(p.status)),d.push(new o(p.thisupdate)),p.nextupdate!=null){var v=new o(p.nextupdate);d.push(new i({tag:"a0",explicit:!0,obj:v}))}if(p.ext!=null){var g=new m(p.ext);d.push(new i({tag:"a1",explicit:!0,obj:g}))}var y=new s({array:d});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(p){this.params=p},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.SingleResponse,A.asn1.ASN1Object);A.asn1.ocsp.CertID=function(e){var t=A,r=t.asn1,n=r.DEROctetString,s=r.DERInteger,o=r.DERSequence,i=r.x509,a=i.AlgorithmIdentifier,u=r.ocsp,l=u.DEFAULT_HASH,f=t.crypto,m=f.Util.hashHex,p=ot,d=xe,v=d.getVbyList;u.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(g,y,w,E){E==null&&(E=this.DEFAULT_HASH),this.params={alg:E,issname:g,isskey:y,sbjsn:w}},this.setByCert=function(g,y,w){w==null&&(w=this.DEFAULT_HASH),this.params={alg:w,issuerCert:g,subjectCert:y}},this.getParamByCerts=function(g,y,w){w==null&&(w=this.DEFAULT_HASH);var E=new p(g),S=new p(y),C=m(E.getSubjectHex(),w),D=E.getPublicKeyHex(),H=m(v(D,0,[1],"03",!0),w),K=S.getSerialNumberHex(),_={alg:w,issname:C,isskey:H,sbjsn:K};return _},this.tohex=function(){if(typeof this.params!="object")throw new Error("params not set");var g=this.params,y,w,E,S;if(g.alg==null?S=this.DEFAULT_HASH:S=g.alg,g.issuerCert!=null&&g.subjectCert!=null){var C=this.getParamByCerts(g.issuerCert,g.subjectCert,S);y=C.issname,w=C.isskey,E=C.sbjsn}else if(g.issname!=null&&g.isskey!=null&&g.sbjsn!=null)y=g.issname,w=g.isskey,E=g.sbjsn;else throw new Error("required param members not defined");var D=new a({name:S}),H=new n({hex:y}),K=new n({hex:w}),_=new s({hex:E}),x=new o({array:[D,H,K,_]});return this.hTLV=x.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.CertID,A.asn1.ASN1Object);A.asn1.ocsp.CertStatus=function(e){A.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(t.status=="good")return"8000";if(t.status=="unknown")return"8200";if(t.status=="revoked"){var r=[{gentime:{str:t.time}}];t.reason!=null&&r.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:t.reason}}}});var n={tag:"a1",explicit:!1,obj:{seq:r}};return A.asn1.ASN1Util.newObject({tag:n}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},e!==void 0&&this.setByParam(e)};Ae(A.asn1.ocsp.CertStatus,A.asn1.ASN1Object);A.asn1.ocsp.Request=function(e){var t=A,r=t.asn1,n=r.DERSequence,s=r.ocsp;if(s.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var i=[];if(this.dReqCert===null)throw"reqCert not set";i.push(this.dReqCert);var a=new n({array:i});return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},typeof e<"u"){var o=new s.CertID(e);this.dReqCert=o}};Ae(A.asn1.ocsp.Request,A.asn1.ASN1Object);A.asn1.ocsp.TBSRequest=function(e){var t=A,r=t.asn1,n=r.DERSequence,s=r.ocsp;s.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(o){for(var i=[],a=0;a<o.length;a++){var u=new s.Request(o[0]);i.push(u)}this.dRequestList=i},this.tohex=function(){var o=[];if(this.version!==0)throw"not supported version: "+this.version;if(this.dRequestorName!==null)throw"requestorName not supported";var i=new n({array:this.dRequestList});if(o.push(i),this.dRequestExt!==null)throw"requestExtensions not supported";var a=new n({array:o});return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0&&this.setRequestListByParam(e.reqList)};Ae(A.asn1.ocsp.TBSRequest,A.asn1.ASN1Object);A.asn1.ocsp.OCSPRequest=function(e){var t=A,r=t.asn1,n=r.DERSequence,s=r.ocsp;if(s.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var i=[];if(this.dTbsRequest!==null)i.push(this.dTbsRequest);else throw"tbsRequest not set";if(this.dOptionalSignature!==null)throw"optionalSignature not supported";var a=new n({array:i});return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0){var o=new s.TBSRequest(e);this.dTbsRequest=o}};Ae(A.asn1.ocsp.OCSPRequest,A.asn1.ASN1Object);A.asn1.ocsp.OCSPUtil={};A.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,r){var n=A,s=n.asn1,o=s.ocsp;r===void 0&&(r=o.DEFAULT_HASH);var i={alg:r,issuerCert:e,subjectCert:t},a=new o.OCSPRequest({reqList:[i]});return a.tohex()};A.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=xe,r=t.getVbyList,n=t.getVbyListEx,s=t.getIdxbyList,o=t.getIdxbyListEx,i=t.getV,a={};try{var u=n(e,0,[0],"0a");a.responseStatus=parseInt(u,16)}catch{}if(a.responseStatus!==0)return a;try{var l=s(e,0,[1,0,1,0,0,2,0,1]);e.substr(l,2)==="80"?a.certStatus="good":e.substr(l,2)==="a1"?(a.certStatus="revoked",a.revocationTime=ar(r(e,l,[0]))):e.substr(l,2)==="82"&&(a.certStatus="unknown")}catch{}try{var f=s(e,0,[1,0,1,0,0,2,0,2]);a.thisUpdate=ar(i(e,f))}catch{}try{var m=s(e,0,[1,0,1,0,0,2,0,3]);e.substr(m,2)==="a0"&&(a.nextUpdate=ar(r(e,m,[0])))}catch{}return a};A.asn1.ocsp.OCSPParser=function(){var e=Error,t=ot,r=new t,n=xe,s=n.getV,o=n.getTLV,i=n.getIdxbyList,a=n.getVbyList,u=n.getTLVbyList,l=n.getVbyListEx,f=n.getTLVbyListEx,m=n.getChildIdx;this.getOCSPRequest=function(p){var d=m(p,0);if(d.length!=1&&d.length!=2)throw new e("wrong number elements: "+d.length);var v=this.getTBSRequest(o(p,d[0]));return v},this.getTBSRequest=function(p){var d={},v=f(p,0,[0],"30");d.array=this.getRequestList(v);var g=f(p,0,["[2]",0],"30");return g!=null&&(d.ext=r.getExtParamArray(g)),d},this.getRequestList=function(p){for(var d=[],v=m(p,0),g=0;g<v.length;g++){var p=o(p,v[g]);d.push(this.getRequest(p))}return d},this.getRequest=function(p){var d=m(p,0);if(d.length!=1&&d.length!=2)throw new e("wrong number elements: "+d.length);var v=this.getCertID(o(p,d[0]));if(d.length==2){var g=i(p,0,[1,0]);v.ext=r.getExtParamArray(o(p,g))}return v},this.getCertID=function(p){var d=m(p,0);if(d.length!=4)throw new e("wrong number elements: "+d.length);var v=new t,g={};return g.alg=v.getAlgorithmIdentifierName(o(p,d[0])),g.issname=s(p,d[1]),g.isskey=s(p,d[2]),g.sbjsn=s(p,d[3]),g},this.getOCSPResponse=function(p){var d=m(p,0),v,g=s(p,d[0]),y=parseInt(g);if(d.length==1)return{resstatus:y};var w=u(p,0,[1,0]);return v=this.getResponseBytes(w),v.resstatus=y,v},this.getResponseBytes=function(p){var d=m(p,0),v,g=u(p,0,[1,0]);v=this.getBasicOCSPResponse(g);var y=s(p,d[0]);return v.restype=A.asn1.x509.OID.oid2name(o2(y)),v},this.getBasicOCSPResponse=function(p){var d=m(p,0),v;v=this.getResponseData(o(p,d[0]));var g=new ot;v.alg=g.getAlgorithmIdentifierName(o(p,d[1]));var y=s(p,d[2]);v.sighex=y.substr(2);var w=l(p,0,["[0]"]);if(w!=null){for(var E=m(w,0),S=[],C=0;C<E.length;C++){var D=o(w,E[C]);S.push(D)}v.certs=S}return v},this.getResponseData=function(p){var d=m(p,0),v=d.length,g={},y=0;p.substr(d[0],2)=="a0"&&y++,g.respid=this.getResponderID(o(p,d[y++]));var w=s(p,d[y++]);if(g.prodat=ar(w),g.array=this.getSingleResponseList(o(p,d[y++])),p.substr(d[v-1],2)=="a1"){var E=u(p,d[v-1],[0]),S=new ot;g.ext=S.getExtParamArray(E)}return g},this.getResponderID=function(p){var d={};if(p.substr(0,2)=="a2"){var v=a(p,0,[0]);d.key=v}if(p.substr(0,2)=="a1"){var g=u(p,0,[0]),y=new ot;d.name=y.getX500Name(g)}return d},this.getSingleResponseList=function(p){for(var d=m(p,0),v=[],g=0;g<d.length;g++){var y=this.getSingleResponse(o(p,d[g]));v.push(y)}return v},this.getSingleResponse=function(p){var d=m(p,0),v={},g=this.getCertID(o(p,d[0]));v.certid=g;var y=this.getCertStatus(o(p,d[1]));if(v.status=y,p.substr(d[2],2)=="18"){var w=s(p,d[2]);v.thisupdate=ar(w)}for(var E=3;E<d.length;E++){if(p.substr(d[E],2)=="a0"){var S=a(p,d[E],[0],"18");v.nextupdate=ar(S)}if(p.substr(d[E],2)=="a1"){var C=new ot,D=u(p,0,[E,0]);v.ext=C.getExtParamArray(D)}}return v},this.getCertStatus=function(p){var d={};if(p=="8000")return{status:"good"};if(p=="8200")return{status:"unknown"};if(p.substr(0,2)=="a1"){d.status="revoked";var v=a(p,0,[0]),g=ar(v);d.time=g}return d}};var A;(typeof A>"u"||!A)&&(A={});(typeof A.lang>"u"||!A.lang)&&(A.lang={});A.lang.String=function(){};function MI(e){for(var t=new Array,r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function qI(e){for(var t="",r=0;r<e.length;r++)t=t+String.fromCharCode(e[r]);return t}function e2(e){for(var t="",r=0;r<e.length;r++){var n=e[r].toString(16);n.length==1&&(n="0"+n),t=t+n}return t}function Ks(e){return e2(MI(e))}function aZ(e){return uu(Ks(e))}function uZ(e){return Sd(uu(Ks(e)))}function cZ(e){return qI(PI(Jp(e)))}function Sd(e){return e=e.replace(/\=/g,""),e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e}function Jp(e){return e.length%4==2?e=e+"==":e.length%4==3&&(e=e+"="),e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/"),e}function rn(e){return e.length%2==1&&(e="0"+e),Sd(uu(e))}function wr(e){return _d(Jp(e))}var Wp,mo;typeof Buffer=="function"?(Wp=function(e){return Sd(Buffer.from(e,"utf8").toString("base64"))},mo=function(e){return Buffer.from(Jp(e),"base64").toString("utf8")}):(Wp=function(e){return rn(n2(i2(e)))},mo=function(e){return decodeURIComponent(s2(wr(e)))});function lZ(e){return uu(n2(i2(e)))}function fZ(e){return decodeURIComponent(s2(_d(e)))}function t2(e){return n2(i2(e)).toLowerCase()}function ar(e){try{return decodeURIComponent(s2(e))}catch{return null}}function dZ(e){return ar(hZ(e))}function hZ(e){for(var t=e.match(/.{1,2}/g),r=[],n=0;n<t.length;n++){var s=parseInt(t[n],16);161<=s&&s<=191?(r.push("c2"),r.push(t[n])):192<=s&&s<=255?(r.push("c3"),r.push((s-64).toString(16))):r.push(t[n])}return r.join("")}function Vs(e){for(var t="",r=0;r<e.length-1;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t}function aa(e){for(var t="",r=0;r<e.length;r++)t+=("0"+e.charCodeAt(r).toString(16)).slice(-2);return t}function IA(e){return uu(e)}function pZ(e){return r2(IA(e),64)}function r2(e,t){return e=e.replace(new RegExp("(.{"+t+"})","g"),`$1\r
|
||
`),e=e.replace(/\s+$/,""),e}function jI(e){var t=e.replace(/[^0-9A-Za-z\/+=]*/g,""),r=_d(t);return r}function mZ(e,t){return"-----BEGIN "+t+`-----\r
|
||
`+r2(e,64)+`\r
|
||
-----END `+t+`-----\r
|
||
`}function rs(e,t){return"-----BEGIN "+t+`-----\r
|
||
`+r2(IA(e),64)+`\r
|
||
-----END `+t+`-----\r
|
||
`}function Fr(e,t){if(e.indexOf("-----BEGIN ")==-1)throw new Error("can't find PEM header");return t!==void 0?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),""),e=e.replace(new RegExp("-----END "+t+"-----[^]*$"),"")):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,""),e=e.replace(/-----END [^-]+-----[^]*$/,"")),jI(e)}function gZ(e){return e.indexOf("-----BEGIN ")==-1||e.indexOf("-----END ")==-1?null:(e=e.replace(/^[\s\S]*?-----BEGIN [^-]+-----/m,""),e=e.replace(/-----END [\s\S]+$/m,""),e=e.replace(/\s+/g,""),e.match(/^[0-9a-zA-Z+/=]+$/)?e:null)}function vZ(e){if(e.length%2!=0)throw"input is not even length";if(e.match(/^[0-9A-Fa-f]+$/)==null)throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),r=new DataView(t),n=0;n<e.length/2;n++)r.setUint8(n,parseInt(e.substr(n*2,2),16));return t}function wZ(e){for(var t="",r=new DataView(e),n=0;n<e.byteLength;n++)t+=("00"+r.getUint8(n).toString(16)).slice(-2);return t}function $A(e){var t,r,n,s,o,i,a,u,l,f,m,p;if(e=VI(e),p=e.match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/),p)return t=parseInt(p[1]),r=parseInt(p[2])-1,n=parseInt(p[3]),s=parseInt(p[4]),o=parseInt(p[5]),i=parseInt(p[6]),a=0,f=p[7],f!==""&&(m=(f.substr(1)+"00").substr(0,3),a=parseInt(m)),Date.UTC(t,r,n,s,o,i,a);throw new Error("unsupported zulu format: "+e)}function yZ(e){var t=new Date(e),r=("0000"+t.getUTCFullYear()).slice(-4),n=("00"+(t.getUTCMonth()+1)).slice(-2),s=("00"+t.getUTCDate()).slice(-2),o=("00"+t.getUTCHours()).slice(-2),i=("00"+t.getUTCMinutes()).slice(-2),a=("00"+t.getUTCSeconds()).slice(-2),u=("000"+t.getUTCMilliseconds()).slice(-3);return u=u.replace(/0+$/,""),u=u!=""?"."+u:u,r+n+s+o+i+a+u+"Z"}function KI(e){return Math.round($A(e)/1e3)}function EZ(e){return new Date($A(e))}function bZ(e,t,r){var n,s=e.getUTCFullYear();if(t){if(s<1950||2049<s)throw"not proper year for UTCTime: "+s;n=(""+s).slice(-2)}else n=("000"+s).slice(-4);if(n+=("0"+(e.getUTCMonth()+1)).slice(-2),n+=("0"+e.getUTCDate()).slice(-2),n+=("0"+e.getUTCHours()).slice(-2),n+=("0"+e.getUTCMinutes()).slice(-2),n+=("0"+e.getUTCSeconds()).slice(-2),r){var o=e.getUTCMilliseconds();o!==0&&(o=("00"+o).slice(-3),o=o.replace(/0+$/g,""),n+="."+o)}return n+="Z",n}function VI(e){return e.match(/^[0-9]{12}Z$/)||e.match(/^[0-9]{12}[.][0-9]*Z$/)?e.match(/^[0-4]/)?"20"+e:"19"+e:e}function n2(e){return e.replace(/%/g,"")}function s2(e){return e.replace(/(..)/g,"%$1")}function AA(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;e=e.toLowerCase();var r=e.split(":").length-1;if(r<2)throw t;var n=":".repeat(7-r+2);e=e.replace("::",n);var s=e.split(":");if(s.length!=8)throw t;for(var o=0;o<8;o++)s[o]=("0000"+s[o]).slice(-4);return s.join("")}function SA(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw new Error("malformed IPv6 address: "+e);e=e.toLowerCase();var t=e.match(/.{1,4}/g);t=t.map(function(s){return s.replace(/^0+/,"")}),t=t.map(function(s){return s==""?"0":s}),e=":"+t.join(":")+":";var r=e.match(/:(0:){2,}/g);if(r==null)return e.slice(1,-1);var n=r.sort().slice(-1)[0];return e=e.replace(n.substr(0,n.length-1),":"),e.substr(0,2)!="::"&&(e=e.substr(1)),e.substr(-2,2)!="::"&&(e=e.substr(0,e.length-1)),e}function Wg(e){var t=new Error("malformed hex value");if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(e.length==8){var r;try{return r=parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16),r}catch{throw t}}else if(e.length==16)try{return Wg(e.substr(0,8))+"/"+TI(e.substr(8))}catch{throw t}else{if(e.length==32)return SA(e);if(e.length==64){try{return SA(e.substr(0,32))+"/"+TI(e.substr(32))}catch{throw t}return}else return e}}function TI(e){var t=new Error("malformed mask"),r;try{r=new se(e,16).toString(2)}catch{throw t}if(!r.match(/^1*0*$/))throw t;return r.replace(/0+$/,"").length}function xA(e){var t=new Error("malformed IP address");if(e=e.toLowerCase(e),!e.match(/^[0-9a-f.:/]+$/))throw t;if(e.match(/^[0-9.]+$/)){var r=e.split(".");if(r.length!==4)throw t;var n="";try{for(var s=0;s<4;s++){var o=parseInt(r[s]);n+=("0"+o.toString(16)).slice(-2)}return n}catch{throw t}}else if(e.match(/^[0-9.]+\/[0-9]+$/)){var i=e.split("/");return xA(i[0])+kI(parseInt(i[1]),32)}else{if(e.match(/^[0-9a-f:]+$/)&&e.indexOf(":")!==-1)return AA(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&e.indexOf(":")!==-1){var i=e.split("/");return AA(i[0])+kI(parseInt(i[1]),128)}else throw t}}function kI(e,t){if(t==32&&e==0)return"00000000";if(t==128&&e==0)return"00000000000000000000000000000000";var r=Array(e+1).join("1")+Array(t-e+1).join("0");return new se(r,2).toString(16)}function RA(e){function t(s){var o=parseInt(s.substr(0,2),16),i=parseInt(s.substr(2),16);if(o==0&i<128)return String.fromCharCode(i);if(o<8){var a=192|(o&7)<<3|(i&192)>>6,u=128|i&63;return ar(a.toString(16)+u.toString(16))}var a=224|(o&240)>>4,u=128|(o&15)<<2|(i&192)>>6,l=128|i&63;return ar(a.toString(16)+u.toString(16)+l.toString(16))}var r=e.match(/.{4}/g),n=r.map(t);return n.join("")}function i2(e){for(var t=encodeURIComponent(e),r="",n=0;n<t.length;n++)t[n]=="%"?(r=r+t.substr(n,3),n=n+2):r=r+"%"+Ks(t[n]);return r}function AZ(e){return e=e.replace(/\r\n/mg,`
|
||
`),e}function SZ(e){return e=e.replace(/\r\n/mg,`
|
||
`),e=e.replace(/\n/mg,`\r
|
||
`),e}A.lang.String.isInteger=function(e){return e.match(/^[0-9]+$/)?!0:!!e.match(/^-[0-9]+$/)};A.lang.String.isHex=function(e){return GI(e)};function GI(e){return!!(e.length%2==0&&(e.match(/^[0-9a-f]+$/)||e.match(/^[0-9A-F]+$/)))}A.lang.String.isBase64=function(e){return e=e.replace(/\s+/g,""),!!(e.match(/^[0-9A-Za-z+\/]+={0,3}$/)&&e.length%4==0)};A.lang.String.isBase64URL=function(e){return e.match(/[+/=]/)?!1:(e=Jp(e),A.lang.String.isBase64(e))};function TA(e){return!!e.match(/^[0-9A-Za-z-_.]+$/)}A.lang.String.isIntegerArray=function(e){return e=e.replace(/\s+/g,""),!!e.match(/^\[[0-9,]+\]$/)};A.lang.String.isPrintable=function(e){return e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)!==null};A.lang.String.isIA5=function(e){return e.match(/^[\x20-\x21\x23-\x7f]*$/)!==null};A.lang.String.isMail=function(e){return e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)!==null};function _A(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function _Z(e){e=e.replace(/^\s*\[\s*/,""),e=e.replace(/\s*\]\s*$/,""),e=e.replace(/\s*/g,"");try{var t=e.split(/,/).map(function(r,n,s){var o=parseInt(r);if(o<0||255<o)throw"integer not in range 0-255";var i=("00"+o.toString(16)).slice(-2);return i}).join("");return t}catch(r){throw"malformed integer array string: "+r}}var CZ=function(e,t){var r=e.length;e.length>t.length&&(r=t.length);for(var n=0;n<r;n++)if(e.charCodeAt(n)!=t.charCodeAt(n))return n;return e.length!=t.length?r:-1};function zI(e,t){if(typeof e!="string"||typeof t!="string")throw new Error("arguments shall be string");if(e.length!==t.length)throw new Error("input strings must have the same length");if(typeof Buffer=="function"&&typeof au<"u"){if(au.timingSafeEqual!==void 0)return au.timingSafeEqual(Buffer.from(e),Buffer.from(t));if(au.subtle!==void 0&&au.subtle.timingSafeEqual)return au.subtle.timingSafeEqual(Buffer.from(e),Buffer.from(t))}return YI(e,t)}function YI(e,t){if(typeof e!="string"||typeof t!="string")throw new Error("arguments shall be string");if(e.length!==t.length)throw new Error("input strings must have the same length");let r=t.slice();for(var n=0,s=0;s<e.length;s++)n|=e.charCodeAt(s)^r.charCodeAt(s);return n===0}function WI(e){var t=function(a){var u=a.toString(16);return u.length==1&&(u="0"+u),u},r=function(a){var u="",l=parseInt(a,10),f=l.toString(2),m=7-f.length%7;m==7&&(m=0);for(var p="",d=0;d<m;d++)p+="0";f=p+f;for(var d=0;d<f.length-1;d+=7){var v=f.substr(d,7);d!=f.length-7&&(v="1"+v),u+=t(parseInt(v,2))}return u};try{if(!e.match(/^[0-9.]+$/))return null;var n="",s=e.split("."),o=parseInt(s[0],10)*40+parseInt(s[1],10);n+=t(o),s.splice(0,2);for(var i=0;i<s.length;i++)n+=r(s[i]);return n}catch{return null}}function o2(e){if(!GI(e))return null;try{var t=[],r=e.substr(0,2),n=parseInt(r,16);t[0]=new String(Math.floor(n/40)),t[1]=new String(n%40);for(var s=e.substr(2),o=[],i=0;i<s.length/2;i++)o.push(parseInt(s.substr(i*2,2),16));for(var a=[],u="",i=0;i<o.length;i++)o[i]&128?u=u+Xg((o[i]&127).toString(2),7):(u=u+Xg((o[i]&127).toString(2),7),a.push(new String(parseInt(u,2))),u="");var l=t.join(".");return a.length>0&&(l=l+"."+a.join(".")),l}catch{return null}}function XI(e){var t=new se(String(e),10);return Zp(t)}function Zp(e){var t=e.toString(16);if(t.substr(0,1)!="-")return t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t),t;var r=t.substr(1),n=r.length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var s="",o=0;o<n;o++)s+="f";var i=new se(s,16),a=i.xor(e).add(se.ONE);return t=a.toString(16).replace(/^-/,""),t}var Xg=function(e,t,r){return r==null&&(r="0"),e.length>=t?e:new Array(t-e.length+1).join(r)+e};function JI(e){if(e.length%2!=0||(e=e.toLowerCase(),e.match(/^[0-9a-f]+$/)==null))return-1;try{var t=e.substr(0,2);if(t=="00")return parseInt(e.substr(2),16);var r=parseInt(t,16);if(r>7)return-1;var n=e.substr(2),s=parseInt(n,16).toString(2);s=="0"&&(s="00000000"),s=s.slice(0,0-r);var o=parseInt(s,2);return o==NaN?-1:o}catch{return-1}}function ZI(e){if(typeof e!="number"||e<0)return null;var t=Number(e).toString(2),r=8-t.length%8;r==8&&(r=0),t=t+Xg("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var s="0"+r;return s+n}function QI(e){if(typeof e!="string"||e.length%2!=0||!e.match(/^[0-9a-f]+$/))return null;try{var t=parseInt(e.substr(0,2),16);if(t<0||7<t)return null;for(var r=e.substr(2),n="",s=0;s<r.length;s+=2){var o=r.substr(s,2),i=parseInt(o,16).toString(2);i=("0000000"+i).slice(-8),n+=i}return n.substr(0,n.length-t)}catch{return null}}function DZ(e){if(typeof e!="string"||e.match(/^[01]+$/)==null)return null;try{var t=parseInt(e,2);return ZI(t)}catch{return null}}function Jg(e,t){for(var r=0,n=0;n<e.length;n++)r|=1<<t[e[n]];for(var s=r.toString(2),o="",n=s.length-1;n>=0;n--)o+=s[n];return o}function pr(e,n,r){if(typeof e=="object"){for(var n=String(n).split("."),s=0;s<n.length&&e;s++){var o=n[s];o.match(/^[0-9]+$/)&&(o=parseInt(o)),e=e[o]}return e||e===!1?e:r}}function Ae(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:Oe.algo.MD5,sha1:Oe.algo.SHA1,sha224:Oe.algo.SHA224,sha256:Oe.algo.SHA256,sha384:Oe.algo.SHA384,sha512:Oe.algo.SHA512,ripemd160:Oe.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(typeof this.DIGESTINFOHEAD[t]>"u")throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,r){var n=this.getDigestInfoHex(e,t),s=r/4;if(n.length+22>s)throw"key is too short for SigAlg: keylen="+r+","+t;for(var o="0001",i="00"+n,a="",u=s-o.length-i.length,l=0;l<u;l+=2)a+="ff";var f=o+a+i;return f},this.hashString=function(e,t){var r=new A.crypto.MessageDigest({alg:t});return r.digestString(e)},this.hashHex=function(e,t){var r=new A.crypto.MessageDigest({alg:t});return r.digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof dt||e instanceof A.crypto.DSA||e instanceof A.crypto.ECDSA}};A.crypto.Util.md5=function(e){var t=new A.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return t.digestString(e)};A.crypto.Util.ripemd160=function(e){var t=new A.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return t.digestString(e)};A.crypto.Util.SECURERANDOMGEN=new Fd;A.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return A.crypto.Util.SECURERANDOMGEN.nextBytes(t),e2(t)};A.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new se(A.crypto.Util.getRandomHexOfNbytes(e),16)};A.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,r=(e-t)/8,n=new Array(r+1);return A.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<t&255^255)&n[0],e2(n)};A.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new se(A.crypto.Util.getRandomHexOfNbits(e),16)};A.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var r=A.crypto.Util.getRandomBigIntegerOfNbits(t);if(e.compareTo(r)>=0)return r}};A.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var r=e.compareTo(t);if(r>0)throw"biMin is greater than biMax";if(r==0)return e;var n=t.subtract(e),s=A.crypto.Util.getRandomBigIntegerZeroToMax(n);return s.add(e)};A.crypto.MessageDigest=function(e){var t=null,r=null,n=null;this.setAlgAndProvider=function(s,o){if(s=A.crypto.MessageDigest.getCanonicalAlgName(s),s!==null&&o===void 0&&(o=A.crypto.Util.DEFAULTPROVIDER[s]),":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(s)!=-1&&o=="cryptojs"){try{this.md=A.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[s].create()}catch(i){throw"setAlgAndProvider hash alg set fail alg="+s+"/"+i}this.updateString=function(i){this.md.update(i)},this.updateHex=function(i){var a=Oe.enc.Hex.parse(i);this.md.update(a)},this.digest=function(){var i=this.md.finalize();return i.toString(Oe.enc.Hex)},this.digestString=function(i){return this.updateString(i),this.digest()},this.digestHex=function(i){return this.updateHex(i),this.digest()}}if(":sha256:".indexOf(s)!=-1&&o=="sjcl"){try{this.md=new sjcl.hash.sha256}catch(i){throw"setAlgAndProvider hash alg set fail alg="+s+"/"+i}this.updateString=function(i){this.md.update(i)},this.updateHex=function(i){var a=sjcl.codec.hex.toBits(i);this.md.update(a)},this.digest=function(){var i=this.md.finalize();return sjcl.codec.hex.fromBits(i)},this.digestString=function(i){return this.updateString(i),this.digest()},this.digestHex=function(i){return this.updateHex(i),this.digest()}}},this.updateString=function(s){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(s){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(s){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(s){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},e!==void 0&&e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0&&(this.provName=A.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))};A.crypto.MessageDigest.getCanonicalAlgName=function(e){return typeof e=="string"&&(e=e.toLowerCase(),e=e.replace(/-/,"")),e};A.crypto.MessageDigest.getHashLength=function(e){var t=A.crypto.MessageDigest,r=t.getCanonicalAlgName(e);if(t.HASHLENGTH[r]===void 0)throw"not supported algorithm: "+e;return t.HASHLENGTH[r]};A.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20};A.crypto.Mac=function(e){var t=null,r=null,n=null,s=null,o=null;this.setAlgAndProvider=function(i,a){if(i=i.toLowerCase(),i==null&&(i="hmacsha1"),i=i.toLowerCase(),i.substr(0,4)!="hmac")throw"setAlgAndProvider unsupported HMAC alg: "+i;a===void 0&&(a=A.crypto.Util.DEFAULTPROVIDER[i]),this.algProv=i+"/"+a;var u=i.substr(4);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(u)!=-1&&a=="cryptojs"){try{var l=A.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[u];this.mac=Oe.algo.HMAC.create(l,this.pass)}catch(f){throw"setAlgAndProvider hash alg set fail hashAlg="+u+"/"+f}this.updateString=function(f){this.mac.update(f)},this.updateHex=function(f){var m=Oe.enc.Hex.parse(f);this.mac.update(m)},this.doFinal=function(){var f=this.mac.finalize();return f.toString(Oe.enc.Hex)},this.doFinalString=function(f){return this.updateString(f),this.doFinal()},this.doFinalHex=function(f){return this.updateHex(f),this.doFinal()}}},this.updateString=function(i){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(i){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(i){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(i){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(i){if(typeof i=="string"){var a=i;(i.length%2==1||!i.match(/^[0-9A-Fa-f]+$/))&&(a=aa(i)),this.pass=Oe.enc.Hex.parse(a);return}if(typeof i!="object")throw"KJUR.crypto.Mac unsupported password type: "+i;var a=null;if(i.hex!==void 0){if(i.hex.length%2!=0||!i.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+i.hex;a=i.hex}if(i.utf8!==void 0&&(a=t2(i.utf8)),i.rstr!==void 0&&(a=aa(i.rstr)),i.b64!==void 0&&(a=_d(i.b64)),i.b64u!==void 0&&(a=wr(i.b64u)),a==null)throw"KJUR.crypto.Mac unsupported password type: "+i;this.pass=Oe.enc.Hex.parse(a)},e!==void 0&&(e.pass!==void 0&&this.setPassword(e.pass),e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0&&(this.provName=A.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))};A.crypto.Signature=function(e){var t=null,r=null,n=null,s=null,o=null,i=null,a=null,u=null,l=null,f=null,m=-1,p=null,d=null,v=null,g=null,y=null;if(this._setAlgNames=function(){var w=this.algName.match(/^(.+)with(.+)$/);w&&(this.mdAlgName=w[1].toLowerCase(),this.pubkeyAlgName=w[2].toLowerCase(),this.pubkeyAlgName=="rsaandmgf1"&&this.mdAlgName=="sha"&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(w,E){for(var S="",C=E/4-w.length,D=0;D<C;D++)S=S+"0";return S+w},this.setAlgAndProvider=function(w,E){if(this._setAlgNames(),E!="cryptojs/jsrsa")throw new Error("provider not supported: "+E);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)!=-1){try{this.md=new A.crypto.MessageDigest({alg:this.mdAlgName})}catch(S){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+S)}this.init=function(S,C){var D=null;try{C===void 0?D=Pt.getKey(S):D=Pt.getKey(S,C)}catch(H){throw"init failed:"+H}if(D.isPrivate===!0)this.prvKey=D,this.state="SIGN";else if(D.isPublic===!0)this.pubKey=D,this.state="VERIFY";else throw"init failed.:"+D},this.updateString=function(S){this.md.updateString(S)},this.updateHex=function(S){this.md.updateHex(S)},this.sign=function(){if(this.sHashHex=this.md.digest(),this.prvKey===void 0&&this.ecprvhex!==void 0&&this.eccurvename!==void 0&&A.crypto.ECDSA!==void 0&&(this.prvKey=new A.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof dt&&this.pubkeyAlgName==="rsaandmgf1")this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof dt&&this.pubkeyAlgName==="rsa")this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof A.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else if(this.prvKey instanceof A.crypto.DSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;return this.hSign},this.signString=function(S){return this.updateString(S),this.sign()},this.signHex=function(S){return this.updateHex(S),this.sign()},this.verify=function(S){if(this.sHashHex=this.md.digest(),this.pubKey===void 0&&this.ecpubhex!==void 0&&this.eccurvename!==void 0&&A.crypto.ECDSA!==void 0&&(this.pubKey=new A.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof dt&&this.pubkeyAlgName==="rsaandmgf1")return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,S,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof dt&&this.pubkeyAlgName==="rsa")return this.pubKey.verifyWithMessageHash(this.sHashHex,S);if(A.crypto.ECDSA!==void 0&&this.pubKey instanceof A.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,S);if(A.crypto.DSA!==void 0&&this.pubKey instanceof A.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,S);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(w,E){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(w){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(w){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(w){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(w){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(w){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,e!==void 0&&(e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0?this.provName=A.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),e.psssaltlen!==void 0&&(this.pssSaltLen=e.psssaltlen),e.prvkeypem!==void 0)){if(e.prvkeypas!==void 0)throw"both prvkeypem and prvkeypas parameters not supported";try{var t=Pt.getKey(e.prvkeypem);this.init(t)}catch(w){throw"fatal error to load pem private key: "+w}}};A.crypto.Cipher=function(e){};A.crypto.Cipher.encrypt=function(e,t,r,n){if(pr(n,"enclag")!=null&&(r=n.encalg),typeof r=="string"&&r.substr(-4)=="-CBC"){var s=t,o=e;pr(n,"key")!=null&&(s=n.key),pr(n,"enc")!=null&&(hEnc=n.enc);var i=Oe.enc.Hex.parse(s),a=Oe.enc.Hex.parse(o),u=Oe.enc.Hex.parse(n.iv),l;if(r=="des-EDE3-CBC")l=Oe.TripleDES.encrypt(a,i,{iv:u});else if(r=="aes128-CBC"||r=="aes256-CBC")l=Oe.AES.encrypt(a,i,{iv:u});else throw new Error("unsupported algorithm: "+r);return l+""}else throw new Error("Cipher.encrypt: unsupported key or algorithm")};A.crypto.Cipher.decrypt=function(e,t,r,n){if(pr(n,"enclag")!=null&&(r=n.encalg),typeof r=="string"&&r.substr(-4)=="-CBC"){var s=t,o=e;pr(n,"key")!=null&&(s=n.key),pr(n,"enc")!=null&&(o=n.enc);var i=Oe.enc.Hex.parse(s),a=Oe.enc.Hex.parse(o),u=Oe.enc.Hex.parse(n.iv),l;if(r=="des-EDE3-CBC")l=Oe.TripleDES.decrypt({ciphertext:a},i,{iv:u});else if(r=="aes128-CBC"||r=="aes256-CBC")l=Oe.AES.decrypt({ciphertext:a},i,{iv:u});else throw new Error("unsupported algorithm: "+r);return Oe.enc.Hex.stringify(l)}else throw new Error("Cipher.decrypt: unsupported key or algorithm")};A.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040022":"secp384r1","2b81040023":"secp521r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECDSA=function(e){var t="secp256r1",r=null,n=null,s=null,o=Error,i=se,a=Zt,u=A.crypto.ECDSA,l=A.crypto.ECParameterDB,f=u.getName,m=xe,p=m.getVbyListEx,d=m.isASN1HEX,v=new Fd,g=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function y(w,E,S,C){for(var D=Math.max(E.bitLength(),C.bitLength()),H=w.add2D(S),K=w.curve.getInfinity(),_=D-1;_>=0;--_)K=K.twice2D(),K.z=i.ONE,E.testBit(_)?C.testBit(_)?K=K.add2D(H):K=K.add2D(w):C.testBit(_)&&(K=K.add2D(S));return K}this.getBigRandom=function(w){return new i(w.bitLength(),v).mod(w.subtract(i.ONE)).add(i.ONE)},this.setNamedCurve=function(w){this.ecparams=l.getByName(w),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=w},this.setPrivateKeyHex=function(w){this.isPrivate=!0,this.prvKeyHex=w},this.setPublicKeyHex=function(w){this.isPublic=!0,this.pubKeyHex=w},this.getPublicKeyXYHex=function(){var w=this.pubKeyHex;if(w.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var E=this.ecparams.keycharlen;if(w.length!==2+E*2)throw"malformed public key hex length";var S={};return S.x=w.substr(2,E),S.y=w.substr(2+E),S},this.getShortNISTPCurveName=function(){var w=this.curveName;return w==="secp256r1"||w==="NIST P-256"||w==="P-256"||w==="prime256v1"?"P-256":w==="secp384r1"||w==="NIST P-384"||w==="P-384"?"P-384":w==="secp521r1"||w==="NIST P-521"||w==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var w=this.ecparams.n,E=this.getBigRandom(w),S=this.ecparams.keycharlen,C=("0000000000"+E.toString(16)).slice(-S);this.setPrivateKeyHex(C);var D=this.generatePublicKeyHex();return{ecprvhex:C,ecpubhex:D}},this.generatePublicKeyHex=function(){var w=new i(this.prvKeyHex,16),E=this.ecparams.G.multiply(w),S=E.getX().toBigInteger(),C=E.getY().toBigInteger(),D=this.ecparams.keycharlen,H=("0000000000"+S.toString(16)).slice(-D),K=("0000000000"+C.toString(16)).slice(-D),_="04"+H+K;return this.setPublicKeyHex(_),_},this.signWithMessageHash=function(w){return this.signHex(w,this.prvKeyHex)},this.signHex=function(w,E){var S=new i(E,16),C=this.ecparams.n,D=new i(w.substring(0,this.ecparams.keycharlen),16);do var H=this.getBigRandom(C),K=this.ecparams.G,_=K.multiply(H),x=_.getX().toBigInteger().mod(C);while(x.compareTo(i.ZERO)<=0);var j=H.modInverse(C).multiply(D.add(S.multiply(x))).mod(C);return u.biRSSigToASN1Sig(x,j)},this.sign=function(w,E){var S=E,C=this.ecparams.n,D=i.fromByteArrayUnsigned(w);do var H=this.getBigRandom(C),K=this.ecparams.G,_=K.multiply(H),x=_.getX().toBigInteger().mod(C);while(x.compareTo(se.ZERO)<=0);var j=H.modInverse(C).multiply(D.add(S.multiply(x))).mod(C);return this.serializeSig(x,j)},this.verifyWithMessageHash=function(w,E){return this.verifyHex(w,E,this.pubKeyHex)},this.verifyHex=function(w,E,S){try{var C,D,H=u.parseSigHex(E);C=H.r,D=H.s;var K=a.decodeFromHex(this.ecparams.curve,S),_=new i(w.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(_,C,D,K)}catch{return!1}},this.verify=function(w,E,S){var C,D;if(Bitcoin.Util.isArray(E)){var H=this.parseSig(E);C=H.r,D=H.s}else if(typeof E=="object"&&E.r&&E.s)C=E.r,D=E.s;else throw"Invalid value for signature";var K;if(S instanceof Zt)K=S;else if(Bitcoin.Util.isArray(S))K=a.decodeFrom(this.ecparams.curve,S);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var _=i.fromByteArrayUnsigned(w);return this.verifyRaw(_,C,D,K)},this.verifyRaw=function(w,E,S,C){var D=this.ecparams.n,H=this.ecparams.G;if(E.compareTo(i.ONE)<0||E.compareTo(D)>=0||S.compareTo(i.ONE)<0||S.compareTo(D)>=0)return!1;var K=S.modInverse(D),_=w.multiply(K).mod(D),x=E.multiply(K).mod(D),j=H.multiply(_).add(C.multiply(x)),U=j.getX().toBigInteger().mod(D);return U.equals(E)},this.serializeSig=function(w,E){var S=w.toByteArraySigned(),C=E.toByteArraySigned(),D=[];return D.push(2),D.push(S.length),D=D.concat(S),D.push(2),D.push(C.length),D=D.concat(C),D.unshift(D.length),D.unshift(48),D},this.parseSig=function(w){var E;if(w[0]!=48)throw new Error("Signature not a valid DERSequence");if(E=2,w[E]!=2)throw new Error("First element in signature must be a DERInteger");var S=w.slice(E+2,E+2+w[E+1]);if(E+=2+w[E+1],w[E]!=2)throw new Error("Second element in signature must be a DERInteger");var C=w.slice(E+2,E+2+w[E+1]);E+=2+w[E+1];var D=i.fromByteArrayUnsigned(S),H=i.fromByteArrayUnsigned(C);return{r:D,s:H}},this.parseSigCompact=function(w){if(w.length!==65)throw"Signature has the wrong length";var E=w[0]-27;if(E<0||E>7)throw"Invalid signature type";var S=this.ecparams.n,C=i.fromByteArrayUnsigned(w.slice(1,33)).mod(S),D=i.fromByteArrayUnsigned(w.slice(33,65)).mod(S);return{r:C,s:D,i:E}},this.readPKCS5PrvKeyHex=function(w){if(d(w)===!1)throw new Error("not ASN.1 hex string");var E,S,C;try{E=p(w,0,["[0]",0],"06"),S=p(w,0,[1],"04");try{C=p(w,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=f(E),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(C),this.setPrivateKeyHex(S),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(w){if(d(w)===!1)throw new o("not ASN.1 hex string");var E,S,C,D;try{E=p(w,0,[1,0],"06"),S=p(w,0,[1,1],"06"),C=p(w,0,[2,0,1],"04");try{D=p(w,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new o("malformed PKCS#8 plain ECC private key")}if(this.curveName=f(S),this.curveName===void 0)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(D),this.setPrivateKeyHex(C),this.isPublic=!1},this.readPKCS8PubKeyHex=function(w){if(d(w)===!1)throw new o("not ASN.1 hex string");var E,S,C;try{E=p(w,0,[0,0],"06"),S=p(w,0,[0,1],"06"),C=p(w,0,[1],"03")}catch{throw new o("malformed PKCS#8 ECC public key")}if(this.curveName=f(S),this.curveName===null)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(C)},this.readCertPubKeyHex=function(w,E){if(d(w)===!1)throw new o("not ASN.1 hex string");var S,C;try{S=p(w,0,[0,5,0,1],"06"),C=p(w,0,[0,5,1],"03")}catch{throw new o("malformed X.509 certificate ECC public key")}if(this.curveName=f(S),this.curveName===null)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(C)},e!==void 0&&e.curve!==void 0&&(this.curveName=e.curve),this.curveName===void 0&&(this.curveName=t),this.setNamedCurve(this.curveName),e!==void 0&&(e.prv!==void 0&&this.setPrivateKeyHex(e.prv),e.pub!==void 0&&this.setPublicKeyHex(e.pub))};A.crypto.ECDSA.parseSigHex=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=new se(t.r,16),n=new se(t.s,16);return{r,s:n}};A.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=xe,r=t.getChildIdx,n=t.getV;if(t.checkStrictDER(e,0),e.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var s=r(e,0);if(s.length!=2)throw new Error("signature shall have two elements");var o=s[0],i=s[1];if(e.substr(o,2)!="02")throw new Error("1st item not ASN.1 integer");if(e.substr(i,2)!="02")throw new Error("2nd item not ASN.1 integer");var a=n(e,o),u=n(e,i);return{r:a,s:u}};A.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=t.r,n=t.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");r.substr(0,2)=="00"&&(r=r.substr(2)),n.substr(0,2)=="00"&&(n=n.substr(2));var s=Math.max(r.length,n.length);return r=("000000"+r).slice(-s),n=("000000"+n).slice(-s),r+n}if(r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n};A.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var t=e.substr(0,e.length/2),r=e.substr(e.length/2);return A.crypto.ECDSA.hexRSSigToASN1Sig(t,r)};A.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new se(e,16),n=new se(t,16);return A.crypto.ECDSA.biRSSigToASN1Sig(r,n)};A.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=A.asn1,n=new r.DERInteger({bigint:e}),s=new r.DERInteger({bigint:t}),o=new r.DERSequence({array:[n,s]});return o.tohex()};A.crypto.ECDSA.getName=function(e){return e==="2b8104001f"?"secp192k1":e==="2a8648ce3d030107"?"secp256r1":e==="2b8104000a"?"secp256k1":e==="2b81040021"?"secp224r1":e==="2b81040022"?"secp384r1":e==="2b81040023"?"secp521r1":"|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)!==-1?"secp256r1":"|secp256k1|".indexOf(e)!==-1?"secp256k1":"|secp224r1|NIST P-224|P-224|".indexOf(e)!==-1?"secp224r1":"|secp384r1|NIST P-384|P-384|".indexOf(e)!==-1?"secp384r1":"|secp521r1|NIST P-521|P-521|".indexOf(e)!==-1?"secp521r1":null};(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECParameterDB=new function(){var e={},t={};function r(n){return new se(n,16)}this.getByName=function(n){var s=n;if(typeof t[s]<"u"&&(s=t[n]),typeof e[s]<"u")return e[s];throw"unregistered EC curve name: "+s},this.regist=function(n,s,o,i,a,u,l,f,m,p,d,v){e[n]={};var g=r(o),y=r(i),w=r(a),E=r(u),S=r(l),C=new cu(g,y,w),D=C.decodePointHex("04"+f+m);e[n].name=n,e[n].keylen=s,e[n].keycharlen=Math.ceil(s/8)*2,e[n].curve=C,e[n].G=D,e[n].n=E,e[n].h=S,e[n].oid=d,e[n].info=v;for(var H=0;H<p.length;H++)t[p[H]]=n}};A.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field");A.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field");A.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field");A.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]);A.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]);A.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]);A.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]);A.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]);A.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]);A.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.DSA=function(){var e=xe,t=e.getVbyList,r=e.getVbyListEx,n=e.isASN1HEX,s=se,o=se.ONE,i=function(a,u,l,f){if(a==null||u==null||l==null||f==null)throw new Error("invalid DSA public key");if(o.compareTo(u)>=0||u.compareTo(a)>=0)throw new Error("invalid DSA public key");if(o.compareTo(l)>=0||l.compareTo(a)>=0)throw new Error("invalid DSA public key");if(o.compareTo(f)>=0||f.compareTo(a)>=0)throw new Error("invalid DSA public key");if(l.modPow(u,a).compareTo(o)!=0)throw new Error("invalid DSA public key")};this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(a,u,l,f,m){this.isPrivate=!0,this.p=a,this.q=u,this.g=l,this.y=f,this.x=m},this.setPrivateHex=function(a,u,l,f,m){var p,d,v,g,y;p=new se(a,16),d=new se(u,16),v=new se(l,16),typeof f=="string"&&f.length>1?g=new se(f,16):g=null,y=new se(m,16),this.setPrivate(p,d,v,g,y)},this.setPublic=function(a,u,l,f){i(a,u,l,f),this.isPublic=!0,this.p=a,this.q=u,this.g=l,this.y=f,this.x=null},this.setPublicHex=function(a,u,l,f){var m,p,d,v;m=new se(a,16),p=new se(u,16),d=new se(l,16),v=new se(f,16),this.setPublic(m,p,d,v)},this.signWithMessageHash=function(a){var u=this.p,l=this.q,f=this.g,m=this.y,p=this.x,d=a.substr(0,l.bitLength()/4),v=new se(d,16),g,y,w;do g=A.crypto.Util.getRandomBigIntegerMinToMax(se.ONE.add(se.ONE),l.subtract(se.ONE)),y=f.modPow(g,u).mod(l),w=g.modInverse(l).multiply(v.add(p.multiply(y))).mod(l);while(y.compareTo(se.ZERO)==0||w.compareTo(se.ZERO)==0);var E=A.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:y}},{int:{bigint:w}}]});return E},this.verifyWithMessageHash=function(a,u){var l=this.p,f=this.q,m=this.g,p=this.y,d=this.parseASN1Signature(u),v=d[0],g=d[1],y=a.substr(0,f.bitLength()/4),w=new se(y,16);if(se.ZERO.compareTo(v)>=0||v.compareTo(f)>=0||se.ZERO.compareTo(g)>=0||g.compareTo(f)>=0)throw"invalid DSA signature";var E=g.modInverse(f),S=w.multiply(E).mod(f),C=v.multiply(E).mod(f),D=m.modPow(S,l).multiply(p.modPow(C,l)).mod(l).mod(f);return D.compareTo(v)==0},this.parseASN1Signature=function(a){try{var u=new s(r(a,0,[0],"02"),16),l=new s(r(a,0,[1],"02"),16);return[u,l]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(a){var u,l,f,m,p;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[1],"02"),l=r(a,0,[2],"02"),f=r(a,0,[3],"02"),m=r(a,0,[4],"02"),p=r(a,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(u,l,f,m,p)},this.readPKCS8PrvKeyHex=function(a){var u,l,f,m;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[1,1,0],"02"),l=r(a,0,[1,1,1],"02"),f=r(a,0,[1,1,2],"02"),m=r(a,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(u,l,f,null,m)},this.readPKCS8PubKeyHex=function(a){var u,l,f,m;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[0,1,0],"02"),l=r(a,0,[0,1,1],"02"),f=r(a,0,[0,1,2],"02"),m=r(a,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(u,l,f,m)},this.readCertPubKeyHex=function(a,u){var l,f,m,p;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{l=r(a,0,[0,5,0,1,0],"02"),f=r(a,0,[0,5,0,1,1],"02"),m=r(a,0,[0,5,0,1,2],"02"),p=r(a,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(l,f,m,p)}};var Pt=(function(){var e=function(g,y,w){return n(Oe.AES,g,y,w)},t=function(g,y,w){return n(Oe.TripleDES,g,y,w)},r=function(g,y,w){return n(Oe.DES,g,y,w)},n=function(g,y,w,E){var S=Oe.enc.Hex.parse(y),C=Oe.enc.Hex.parse(w),D=Oe.enc.Hex.parse(E),H={};H.key=C,H.iv=D,H.ciphertext=S;var K=g.decrypt(H,C,{iv:D});return Oe.enc.Hex.stringify(K)},s=function(g,y,w){return a(Oe.AES,g,y,w)},o=function(g,y,w){return a(Oe.TripleDES,g,y,w)},i=function(g,y,w){return a(Oe.DES,g,y,w)},a=function(g,y,w,E){var S=Oe.enc.Hex.parse(y),C=Oe.enc.Hex.parse(w),D=Oe.enc.Hex.parse(E),H=g.encrypt(S,C,{iv:D}),K=Oe.enc.Hex.parse(H.toString()),_=Oe.enc.Base64.stringify(K);return _},u={"AES-256-CBC":{proc:e,eproc:s,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:s,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:s,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:t,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:i,keylen:8,ivlen:8}},l=function(g){return u[g].proc},f=function(g){var y=Oe.lib.WordArray.random(g),w=Oe.enc.Hex.stringify(y);return w},m=function(g){var y={},w=g.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));w&&(y.cipher=w[1],y.ivsalt=w[2]);var E=g.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));E&&(y.type=E[1]);var S=-1,C=0;g.indexOf(`\r
|
||
\r
|
||
`)!=-1&&(S=g.indexOf(`\r
|
||
\r
|
||
`),C=2),g.indexOf(`
|
||
|
||
`)!=-1&&(S=g.indexOf(`
|
||
|
||
`),C=1);var D=g.indexOf("-----END");if(S!=-1&&D!=-1){var H=g.substring(S+C*2,D-C);H=H.replace(/\s+/g,""),y.data=H}return y},p=function(g,y,w){for(var E=w.substring(0,16),S=Oe.enc.Hex.parse(E),C=Oe.enc.Utf8.parse(y),D=u[g].keylen+u[g].ivlen,H="",K=null;;){var _=Oe.algo.MD5.create();if(K!=null&&_.update(K),_.update(C),_.update(S),K=_.finalize(),H=H+Oe.enc.Hex.stringify(K),H.length>=D*2)break}var x={};return x.keyhex=H.substr(0,u[g].keylen*2),x.ivhex=H.substr(u[g].keylen*2,u[g].ivlen*2),x},d=function(g,y,w,E){var S=Oe.enc.Base64.parse(g),C=Oe.enc.Hex.stringify(S),D=u[y].proc,H=D(C,w,E);return H},v=function(g,y,w,E){var S=u[y].eproc,C=S(g,w,E);return C};return{version:"1.0.0",parsePKCS5PEM:function(g){return m(g)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(g,y,w){return p(g,y,w)},decryptKeyB64:function(g,y,w,E){return d(g,y,w,E)},getDecryptedKeyHex:function(g,y){var w=m(g),E=w.type,S=w.cipher,C=w.ivsalt,D=w.data,H=p(S,y,C),K=H.keyhex,_=d(D,S,K,C);return _},getEncryptedPKCS5PEMFromPrvKeyHex:function(g,y,w,E,S){var j="";if((typeof E>"u"||E==null)&&(E="AES-256-CBC"),typeof u[E]>"u")throw new Error("KEYUTIL unsupported algorithm: "+E);if(typeof S>"u"||S==null){var C=u[E].ivlen,D=f(C);S=D.toUpperCase()}var H=p(E,w,S),K=H.keyhex,_=v(y,E,K,S),x=_.replace(/(.{64})/g,`$1\r
|
||
`),j="-----BEGIN "+g+` PRIVATE KEY-----\r
|
||
`;return j+=`Proc-Type: 4,ENCRYPTED\r
|
||
`,j+="DEK-Info: "+E+","+S+`\r
|
||
`,j+=`\r
|
||
`,j+=x,j+=`\r
|
||
-----END `+g+` PRIVATE KEY-----\r
|
||
`,j},getEncryptedPKCS8PEM:function(g,y,w){var E=this.getEncryptedPKCS8Hex(g,y,w);return rs(E,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(g,y,w){var E;w==null||w==null?E={}:E=JSON.parse(JSON.stringify(w)),E.plain=g,this.initPBES2Param(E),this.encryptPBES2Param(E,y);var S=this.generatePBES2ASN1Param(E);return A.asn1.ASN1Util.newObject(S).tohex()},initPBES2Param:function(g){if(pr(g,"encalg")==null&&(g.encalg="aes256-CBC"),pr(g,"iter")==null&&(g.iter=2048),pr(g,"prf")==null&&(g.prf="hmacWithSHA256"),pr(g,"salt")==null&&(g.salt=Oe.enc.Hex.stringify(Oe.lib.WordArray.random(8))),pr(g,"enciv")==null){var y;g.encalg=="des-EDE3-CBC"&&(y=8),g.encalg=="aes128-CBC"&&(y=16),g.encalg=="aes256-CBC"&&(y=16),g.enciv=Oe.enc.Hex.stringify(Oe.lib.WordArray.random(y))}},encryptPBES2Param:function(g,y){var w=Pt.getDKFromPBES2Param(g,y);try{var E=A.crypto.Cipher.encrypt(g.plain,w,g.encalg,{iv:g.enciv})}catch{throw new Error("encrypt error: "+g.plain+" "+w+" "+g.encalg+" "+g.enciv)}g.enc=E},generatePBES2ASN1Param:function(g){var y={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:g.salt}},{int:{hex:XI(g.iter)}}]}]},{seq:[{oid:g.encalg},{octstr:{hex:g.enciv}}]}]}]},{octstr:{hex:g.enc}}]};return g.prf!="hmacWithSHA1"&&y.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:g.prf},{null:""}]}),y},parseHexOfEncryptedPKCS8:function(g){var y=xe,w=y.getChildIdx,E=y.getV,S={},C=w(g,0);if(C.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+C.length);S.ciphertext=E(g,C[1]);var D=w(g,C[0]);if(D.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+D.length);if(E(g,D[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var H=w(g,D[1]);if(D.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+H.length);var K=w(g,H[1]);if(K.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+K.length);if(E(g,K[0])!="2a864886f70d0307")throw"this only supports TripleDES";S.encryptionSchemeAlg="TripleDES",S.encryptionSchemeIV=E(g,K[1]);var _=w(g,H[0]);if(_.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+_.length);if(E(g,_[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var x=w(g,_[1]);if(x.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length);S.pbkdf2Salt=E(g,x[0]);var j=E(g,x[1]);try{S.pbkdf2Iter=parseInt(j,16)}catch{throw new Error("malformed format pbkdf2Iter: "+j)}return S},getPBKDF2KeyHexFromParam:function(g,y){var w=Oe.enc.Hex.parse(g.pbkdf2Salt),E=g.pbkdf2Iter,S=Oe.PBKDF2(y,w,{keySize:192/32,iterations:E}),C=Oe.enc.Hex.stringify(S);return C},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(g,y){var w=Fr(g,"ENCRYPTED PRIVATE KEY"),E=this.parseHexOfEncryptedPKCS8(w),S=Pt.getPBKDF2KeyHexFromParam(E,y),C={};C.ciphertext=Oe.enc.Hex.parse(E.ciphertext);var D=Oe.enc.Hex.parse(S),H=Oe.enc.Hex.parse(E.encryptionSchemeIV),K=Oe.TripleDES.decrypt(C,D,{iv:H}),_=Oe.enc.Hex.stringify(K);return _},parsePBES2:function(g){var y=xe.parse(g);if(pr(y,"seq.0.seq.0.oid")!="pkcs5PBES2"||pr(y,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var w=pr(y,"seq.0.seq.1.seq.0.seq.1.seq");if(w==null)throw new Error("PBKDF2 parameter not found");var E=pr(w,"0.octstr.hex"),S=pr(w,"1.int.hex"),C=pr(w,"2.seq.0.oid","hmacWithSHA1"),D=-1;try{D=parseInt(S,16)}catch{throw new Error("iter not proper value")}var H=pr(y,"seq.0.seq.1.seq.1.seq.0.oid"),K=pr(y,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),_=pr(y,"seq.1.octstr.hex");if(H==null||K==null||_==null)throw new Error("encalg, enciv or enc is undefined");var x={salt:E,iter:D,prf:C,encalg:H,enciv:K,enc:_};return x},getDKFromPBES2Param:function(g,y){var w={hmacWithSHA1:Oe.algo.SHA1,hmacWithSHA224:Oe.algo.SHA224,hmacWithSHA256:Oe.algo.SHA256,hmacWithSHA384:Oe.algo.SHA384,hmacWithSHA512:Oe.algo.SHA512},E={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},S=w[g.prf];if(S==null)throw new Error("unsupported prf");var C=E[g.encalg];if(C==null)throw new Error("unsupported encalg");var D=Oe.enc.Hex.parse(g.salt),H=g.iter;try{var K=Oe.PBKDF2(y,D,{keySize:C,iterations:H,hasher:S});return Oe.enc.Hex.stringify(K)}catch(_){throw new Error("PBKDF2 error: "+_+" "+JSON.stringify(g)+" "+y)}},getPlainHexFromEncryptedPKCS8PEM:function(g,y){if(g.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var w=Fr(g),E;try{E=Pt.parsePBES2(w)}catch(C){throw new Error("malformed PBES2 format: "+C.message)}var S=Pt.getDKFromPBES2Param(E,y);return A.crypto.Cipher.decrypt(E.enc,S,E.encalg,{iv:E.enciv})},getKeyFromEncryptedPKCS8PEM:function(g,y){var w=this.getPlainHexFromEncryptedPKCS8PEM(g,y),E=this.getKeyFromPlainPrivatePKCS8Hex(w);return E},parsePlainPrivatePKCS8Hex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,S={};if(S.algparam=null,g.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var C=w(g,0);if(C.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(g.substr(C[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var D=w(g,C[1]);if(D.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(g.substr(D[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(S.algoid=E(g,D[0]),g.substr(D[1],2)=="06"&&(S.algparam=E(g,D[1])),g.substr(C[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return S.keyidx=y.getVidx(g,C[2]),S},getKeyFromPlainPrivatePKCS8PEM:function(g){var y=Fr(g,"PRIVATE KEY"),w=this.getKeyFromPlainPrivatePKCS8Hex(y);return w},getKeyFromPlainPrivatePKCS8Hex:function(g){var y=this.parsePlainPrivatePKCS8Hex(g),w;if(y.algoid=="2a864886f70d010101")w=new dt;else if(y.algoid=="2a8648ce380401")w=new A.crypto.DSA;else if(y.algoid=="2a8648ce3d0201")w=new A.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return w.readPKCS8PrvKeyHex(g),w},_getKeyFromPublicPKCS8Hex:function(g){var y,w=xe.getVbyList(g,0,[0,0],"06");if(w==="2a864886f70d010101")y=new dt;else if(w==="2a8648ce380401")y=new A.crypto.DSA;else if(w==="2a8648ce3d0201")y=new A.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return y.readPKCS8PubKeyHex(g),y},parsePublicRawRSAKeyHex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,S={};if(g.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var C=w(g,0);if(C.length!=2)throw new Error("malformed RSA key(code:002)");if(g.substr(C[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(S.n=E(g,C[0]),g.substr(C[1],2)!="02")throw new Error("malformed RSA key(code:004)");return S.e=E(g,C[1]),S},parsePublicPKCS8Hex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,S={};S.algparam=null;var C=w(g,0);if(C.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+C.length);var D=C[0];if(g.substr(D,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var H=w(g,D);if(H.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(g.substr(H[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(S.algoid=E(g,H[0]),g.substr(H[1],2)=="06"?S.algparam=E(g,H[1]):g.substr(H[1],2)=="30"&&(S.algparam={},S.algparam.p=y.getVbyList(g,H[1],[0],"02"),S.algparam.q=y.getVbyList(g,H[1],[1],"02"),S.algparam.g=y.getVbyList(g,H[1],[2],"02")),g.substr(C[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return S.key=E(g,C[1]).substr(2),S}}})();Pt.getKey=function(e,t,r){var n=xe,s=n.getChildIdx,o=n.getV,i=n.getVbyList,a=A.crypto,u=a.ECDSA,l=a.DSA,f=dt,m=Fr,p=Pt;if(typeof f<"u"&&e instanceof f||typeof u<"u"&&e instanceof u||typeof l<"u"&&e instanceof l)return e;if(e.curve!==void 0&&e.xy!==void 0&&e.d===void 0)return new u({pub:e.xy,curve:e.curve});if(e.curve!==void 0&&e.d!==void 0)return new u({prv:e.d,curve:e.curve});if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var d=new f;return d.setPublic(e.n,e.e),d}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p!==void 0&&e.q!==void 0&&e.dp!==void 0&&e.dq!==void 0&&e.co!==void 0&&e.qi===void 0){var d=new f;return d.setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),d}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p===void 0){var d=new f;return d.setPrivate(e.n,e.e,e.d),d}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x===void 0){var d=new l;return d.setPublic(e.p,e.q,e.g,e.y),d}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x!==void 0){var d=new l;return d.setPrivate(e.p,e.q,e.g,e.y,e.x),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var d=new f;return d.setPublic(wr(e.n),wr(e.e)),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p!==void 0&&e.q!==void 0&&e.dp!==void 0&&e.dq!==void 0&&e.qi!==void 0){var d=new f;return d.setPrivateEx(wr(e.n),wr(e.e),wr(e.d),wr(e.p),wr(e.q),wr(e.dp),wr(e.dq),wr(e.qi)),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var d=new f;return d.setPrivate(wr(e.n),wr(e.e),wr(e.d)),d}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var v=new u({curve:e.crv}),g=v.ecparams.keycharlen,y=("0000000000"+wr(e.x)).slice(-g),w=("0000000000"+wr(e.y)).slice(-g),E="04"+y+w;return v.setPublicKeyHex(E),v}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var v=new u({curve:e.crv}),g=v.ecparams.keycharlen,y=("0000000000"+wr(e.x)).slice(-g),w=("0000000000"+wr(e.y)).slice(-g),E="04"+y+w,S=("0000000000"+wr(e.d)).slice(-g);return v.setPublicKeyHex(E),v.setPrivateKeyHex(S),v}if(r==="pkcs5prv"){var C=e,n=xe,D,d;if(D=s(C,0),D.length===9)d=new f,d.readPKCS5PrvKeyHex(C);else if(D.length===6)d=new l,d.readPKCS5PrvKeyHex(C);else if(D.length>2&&C.substr(D[1],2)==="04")d=new u,d.readPKCS5PrvKeyHex(C);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return d}if(r==="pkcs8prv"){var d=p.getKeyFromPlainPrivatePKCS8Hex(e);return d}if(r==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(e);if(r==="x509pub")return ot.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return ot.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var H=Fr(e,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(H)}if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var K=m(e,"RSA PRIVATE KEY");return p.getKey(K,null,"pkcs5prv")}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var _=m(e,"DSA PRIVATE KEY"),x=i(_,0,[1],"02"),j=i(_,0,[2],"02"),U=i(_,0,[3],"02"),k=i(_,0,[4],"02"),N=i(_,0,[5],"02"),d=new l;return d.setPrivate(new se(x,16),new se(j,16),new se(U,16),new se(k,16),new se(N,16)),d}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var K=m(e,"EC PRIVATE KEY");return p.getKey(K,null,"pkcs5prv")}if(e.indexOf("-END PRIVATE KEY-")!=-1)return p.getKeyFromPlainPrivatePKCS8PEM(e);if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var O=p.getDecryptedKeyHex(e,t),L=new dt;return L.readPKCS5PrvKeyHex(O),L}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var _=p.getDecryptedKeyHex(e,t),d=i(_,0,[1],"04"),T=i(_,0,[2,0],"06"),M=i(_,0,[3,0],"03").substr(2),W="";if(A.crypto.OID.oidhex2name[T]!==void 0)W=A.crypto.OID.oidhex2name[T];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+T);var v=new u({curve:W});return v.setPublicKeyHex(M),v.setPrivateKeyHex(d),v.isPublic=!1,v}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var _=p.getDecryptedKeyHex(e,t),x=i(_,0,[1],"02"),j=i(_,0,[2],"02"),U=i(_,0,[3],"02"),k=i(_,0,[4],"02"),N=i(_,0,[5],"02"),d=new l;return d.setPrivate(new se(x,16),new se(j,16),new se(U,16),new se(k,16),new se(N,16)),d}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};Pt.generateKeypair=function(e,t){if(e=="RSA"){var r=t,n=new dt;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var s=new dt,o=n.n.toString(16),i=n.e.toString(16);s.setPublic(o,i),s.isPrivate=!1,s.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=s,a}else if(e=="EC"){var u=t,l=new A.crypto.ECDSA({curve:u}),f=l.generateKeyPairHex(),n=new A.crypto.ECDSA({curve:u});n.setPublicKeyHex(f.ecpubhex),n.setPrivateKeyHex(f.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var s=new A.crypto.ECDSA({curve:u});s.setPublicKeyHex(f.ecpubhex),s.isPrivate=!1,s.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=s,a}else throw new Error("unknown algorithm: "+e)};Pt.getPEM=function(e,t,r,n,s,o){var i=A,a=i.asn1,u=a.DERObjectIdentifier,l=a.DERInteger,f=a.ASN1Util.newObject,m=a.x509,p=m.SubjectPublicKeyInfo,d=i.crypto,v=d.DSA,g=d.ECDSA,y=dt;function w(L){var T=f({seq:[{int:0},{int:{bigint:L.n}},{int:L.e},{int:{bigint:L.d}},{int:{bigint:L.p}},{int:{bigint:L.q}},{int:{bigint:L.dmp1}},{int:{bigint:L.dmq1}},{int:{bigint:L.coeff}}]});return T}function E(L){var T=f({seq:[{int:1},{octstr:{hex:L.prvKeyHex}},{tag:["a0",!0,{oid:{name:L.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+L.pubKeyHex}}]}]});return T}function S(L){var T=f({seq:[{int:0},{int:{bigint:L.p}},{int:{bigint:L.q}},{int:{bigint:L.g}},{int:{bigint:L.y}},{int:{bigint:L.x}}]});return T}if((y!==void 0&&e instanceof y||v!==void 0&&e instanceof v||g!==void 0&&e instanceof g)&&e.isPublic==!0&&(t===void 0||t=="PKCS8PUB")){var C=new p(e),D=C.tohex();return rs(D,"PUBLIC KEY")}if(t=="PKCS1PRV"&&y!==void 0&&e instanceof y&&(r===void 0||r==null)&&e.isPrivate==!0){var C=w(e),D=C.tohex();return rs(D,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&g!==void 0&&e instanceof g&&(r===void 0||r==null)&&e.isPrivate==!0){var H=new u({name:e.curveName}),K=H.tohex(),_=E(e),x=_.tohex(),j="";return j+=rs(K,"EC PARAMETERS"),j+=rs(x,"EC PRIVATE KEY"),j}if(t=="PKCS1PRV"&&v!==void 0&&e instanceof v&&(r===void 0||r==null)&&e.isPrivate==!0){var C=S(e),D=C.tohex();return rs(D,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&y!==void 0&&e instanceof y&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=w(e),D=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",D,r,n,o)}if(t=="PKCS5PRV"&&g!==void 0&&e instanceof g&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=E(e),D=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",D,r,n,o)}if(t=="PKCS5PRV"&&v!==void 0&&e instanceof v&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=S(e),D=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",D,r,n,o)}var U=function(L,T){if(typeof T=="string")return Pt.getEncryptedPKCS8PEM(L,T);if(typeof T=="object"&&pr(T,"passcode")!=null){var M=JSON.parse(JSON.stringify(T)),W=M.passcode;return delete M.passcode,Pt.getEncryptedPKCS8PEM(L,W,M)}};if(t=="PKCS8PRV"&&y!=null&&e instanceof y&&e.isPrivate==!0){var k=w(e),N=k.tohex(),C=f({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:N}}]}),D=C.tohex();return r===void 0||r==null?rs(D,"PRIVATE KEY"):U(D,r)}if(t=="PKCS8PRV"&&g!==void 0&&e instanceof g&&e.isPrivate==!0){var O={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&O.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var k=new f(O),N=k.tohex(),C=f({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:N}}]}),D=C.tohex();return r===void 0||r==null?rs(D,"PRIVATE KEY"):U(D,r)}if(t=="PKCS8PRV"&&v!==void 0&&e instanceof v&&e.isPrivate==!0){var k=new l({bigint:e.x}),N=k.tohex(),C=f({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:N}}]}),D=C.tohex();return r===void 0||r==null?rs(D,"PRIVATE KEY"):U(D,r)}throw new Error("unsupported object nor format")};Pt.getKeyFromCSRPEM=function(e){var t=Fr(e,"CERTIFICATE REQUEST"),r=Pt.getKeyFromCSRHex(t);return r};Pt.getKeyFromCSRHex=function(e){var t=Pt.parseCSRHex(e),r=Pt.getKey(t.p8pubkeyhex,null,"pkcs8pub");return r};Pt.parseCSRHex=function(e){var t=xe,r=t.getChildIdx,n=t.getTLV,s={},o=e;if(o.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var i=r(o,0);if(i.length<1)throw new Error("malformed CSR(code:002)");if(o.substr(i[0],2)!="30")throw new Error("malformed CSR(code:003)");var a=r(o,i[0]);if(a.length<3)throw new Error("malformed CSR(code:004)");return s.p8pubkeyhex=n(o,a[2]),s};Pt.getKeyID=function(e){var t=Pt,r=xe;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var n=Fr(t.getPEM(e)),s=r.getIdxbyList(n,0,[1]),o=r.getV(n,s).substring(2);return A.crypto.Util.hashHex(o,"sha1")};Pt.getJWK=function(e,t,r,n,s){var o,i={},a,u=A.crypto.Util.hashHex;if(typeof e=="string")o=Pt.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(a=Fr(e));else if(typeof e=="object")e instanceof ot?(o=e.getPublicKey(),a=e.hex):o=e;else throw new Error("unsupported keyinfo type");if(o instanceof dt&&o.isPrivate)i.kty="RSA",i.n=rn(o.n.toString(16)),i.e=rn(o.e.toString(16)),i.d=rn(o.d.toString(16)),i.p=rn(o.p.toString(16)),i.q=rn(o.q.toString(16)),i.dp=rn(o.dmp1.toString(16)),i.dq=rn(o.dmq1.toString(16)),i.qi=rn(o.coeff.toString(16));else if(o instanceof dt&&o.isPublic)i.kty="RSA",i.n=rn(o.n.toString(16)),i.e=rn(o.e.toString(16));else if(o instanceof A.crypto.ECDSA&&o.isPrivate){var l=o.getShortNISTPCurveName();if(l!=="P-256"&&l!=="P-384"&&l!=="P-521")throw new Error("unsupported curve name for JWT: "+l);var f=o.getPublicKeyXYHex();i.kty="EC",i.crv=l,i.x=rn(f.x),i.y=rn(f.y),i.d=rn(o.prvKeyHex)}else if(o instanceof A.crypto.ECDSA&&o.isPublic){var l=o.getShortNISTPCurveName();if(l!=="P-256"&&l!=="P-384"&&l!=="P-521")throw new Error("unsupported curve name for JWT: "+l);var f=o.getPublicKeyXYHex();i.kty="EC",i.crv=l,i.x=rn(f.x),i.y=rn(f.y)}if(i.kty==null)throw new Error("unsupported keyinfo");return!o.isPrivate&&t!=!0&&(i.kid=A.jws.JWS.getJWKthumbprint(i)),a!=null&&r!=!0&&(i.x5c=[uu(a)]),a!=null&&n!=!0&&(i.x5t=Sd(uu(u(a,"sha1")))),a!=null&&s!=!0&&(i["x5t#S256"]=Sd(uu(u(a,"sha256")))),i};Pt.getJWKFromKey=function(e){return Pt.getJWK(e,!0,!0,!0,!0)};dt.getPosArrayOfChildrenFromHex=function(e){return xe.getChildIdx(e,0)};dt.getHexValueArrayOfChildrenFromHex=function(e){var t=xe,r=t.getV,p=dt.getPosArrayOfChildrenFromHex(e),n=r(e,p[0]),s=r(e,p[1]),o=r(e,p[2]),i=r(e,p[3]),a=r(e,p[4]),u=r(e,p[5]),l=r(e,p[6]),f=r(e,p[7]),m=r(e,p[8]),p=new Array;return p.push(n,s,o,i,a,u,l,f,m),p};dt.prototype.readPrivateKeyFromPEMString=function(e){var t=Fr(e),r=dt.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};dt.prototype.readPKCS5PrvKeyHex=function(e){var t=dt.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])};dt.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,s,o,i,a,u,l=xe,f=l.getVbyListEx;if(l.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");try{t=f(e,0,[2,0,1],"02"),r=f(e,0,[2,0,2],"02"),n=f(e,0,[2,0,3],"02"),s=f(e,0,[2,0,4],"02"),o=f(e,0,[2,0,5],"02"),i=f(e,0,[2,0,6],"02"),a=f(e,0,[2,0,7],"02"),u=f(e,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,r,n,s,o,i,a,u)};dt.prototype.readPKCS5PubKeyHex=function(e){var t=xe,r=t.getV;if(t.isASN1HEX(e)===!1)throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(n.length!==2||e.substr(n[0],2)!=="02"||e.substr(n[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var s=r(e,n[0]),o=r(e,n[1]);this.setPublic(s,o)};dt.prototype.readPKCS8PubKeyHex=function(e){var t=xe;if(t.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");if(t.getTLVbyListEx(e,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var r=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(r)};dt.prototype.readCertPubKeyHex=function(e,t){var r,n;r=new ot,r.readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};var u0e=new RegExp("[^0-9a-f]","gi");function e$(e,t){for(var r="",n=t/4-e.length,s=0;s<n;s++)r=r+"0";return r+e}dt.prototype.sign=function(e,t){var r=function(s){return A.crypto.Util.hashString(s,t)},n=r(e);return this.signWithMessageHash(n,t)};dt.prototype.signWithMessageHash=function(e,t){var r=A.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),n=js(r,16),s=this.doPrivate(n),o=s.toString(16);return e$(o,this.n.bitLength())};function t$(e,t,r){for(var n="",s=0;n.length<t;)n+=Vs(r(aa(e+String.fromCharCode.apply(String,[(s&4278190080)>>24,(s&16711680)>>16,(s&65280)>>8,s&255])))),s+=1;return n}dt.prototype.signPSS=function(e,t,r){var n=function(o){return A.crypto.Util.hashHex(o,t)},s=n(aa(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(s,t,r)};dt.prototype.signWithMessageHashPSS=function(e,t,r){var n=Vs(e),s=n.length,o=this.n.bitLength()-1,i=Math.ceil(o/8),a,u=function(y){return A.crypto.Util.hashHex(y,t)};if(r===-1||r===void 0)r=s;else if(r===-2)r=i-s-2;else if(r<-2)throw new Error("invalid salt length");if(i<s+r+2)throw new Error("data too long");var l="";r>0&&(l=new Array(r),new Fd().nextBytes(l),l=String.fromCharCode.apply(String,l));var f=Vs(u(aa("\0\0\0\0\0\0\0\0"+n+l))),m=[];for(a=0;a<i-r-s-2;a+=1)m[a]=0;var p=String.fromCharCode.apply(String,m)+""+l,d=t$(f,p.length,u),v=[];for(a=0;a<p.length;a+=1)v[a]=p.charCodeAt(a)^d.charCodeAt(a);var g=65280>>8*i-o&255;for(v[0]&=~g,a=0;a<s;a++)v.push(f.charCodeAt(a));return v.push(188),e$(this.doPrivate(new se(v)).toString(16),this.n.bitLength())};function r$(e){for(var t in A.crypto.Util.DIGESTINFOHEAD){var r=A.crypto.Util.DIGESTINFOHEAD[t],n=r.length;if(e.substring(0,n)==r){var s=[t,e.substring(n)];return s}}return[]}dt.prototype.verify=function(e,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var r=js(t,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var s=this.doPublic(r),o=s.toString(16);if(o.length+3!=n/4)return!1;var i=o.replace(/^1f+00/,""),a=r$(i);if(a.length==0)return!1;var u=a[0],l=a[1],f=function(p){return A.crypto.Util.hashString(p,u)},m=f(e);return l==m};dt.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=js(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),s=n.toString(16).replace(/^1f+00/,""),o=r$(s);if(o.length==0)return!1;var i=o[0],a=o[1];return a==e};dt.prototype.verifyPSS=function(e,t,r,n){var s=function(i){return A.crypto.Util.hashHex(i,r)},o=s(aa(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(o,t,r,n)};dt.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var s=new se(t,16),o=function(E){return A.crypto.Util.hashHex(E,r)},i=Vs(e),a=i.length,u=this.n.bitLength()-1,l=Math.ceil(u/8),f;if(n===-1||n===void 0)n=a;else if(n===-2)n=l-a-2;else if(n<-2)throw new Error("invalid salt length");if(l<a+n+2)throw new Error("data too long");var m=this.doPublic(s).toByteArray();for(f=0;f<m.length;f+=1)m[f]&=255;for(;m.length<l;)m.unshift(0);if(m[l-1]!==188)throw new Error("encoded message does not end in 0xbc");m=String.fromCharCode.apply(String,m);var p=m.substr(0,l-a-1),d=m.substr(p.length,a),v=65280>>8*l-u&255;if((p.charCodeAt(0)&v)!==0)throw new Error("bits beyond keysize not zero");var g=t$(d,p.length,o),y=[];for(f=0;f<p.length;f+=1)y[f]=p.charCodeAt(f)^g.charCodeAt(f);y[0]&=~v;var w=l-a-n-2;for(f=0;f<w;f+=1)if(y[f]!==0)throw new Error("leftmost octets not zero");if(y[w]!==1)throw new Error("0x01 marker not found");return d===Vs(o(aa("\0\0\0\0\0\0\0\0"+i+String.fromCharCode.apply(String,y.slice(-n)))))};dt.SALT_LEN_HLEN=-1;dt.SALT_LEN_MAX=-2;dt.SALT_LEN_RECOVER=-2;function ot(e){var t=xe,r=t.getChildIdx,n=t.getV,s=t.dump,o=t.parse,i=t.getTLV,a=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,f=t.getTLVbyListEx,m=t.getIdxbyList,p=t.getIdxbyListEx,d=t.getVidx,v=t.getInt,g=t.oidname,y=t.hextooidstr,w=ot,E=Fr,S,C=Error;try{S=A.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch{}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(this.hex===null||this.version!==0)return this.version;var _=l(this.hex,0,[0,0]);if(_.substr(0,2)=="a0"){var x=l(_,0,[0]),j=v(x,0);if(j<0||2<j)throw new Error("malformed version field");return this.version=j+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var _=f(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(_)},this.getAlgorithmIdentifierName=function(_){for(var x in S)if(_===S[x])return x;return g(u(_,0,[0],"06"))},this.getIssuer=function(_,x){return this.getX500Name(this.getIssuerHex(),_,x)},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var _=this.getIssuer();return _.str},this.getSubject=function(_,x){return this.getX500Name(this.getSubjectHex(),_,x)},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var _=this.getSubject();return _.str},this.getNotBefore=function(){var _=a(this.hex,0,[0,4+this.foffset,0]);return _=_.replace(/(..)/g,"%$1"),_=decodeURIComponent(_),_},this.getNotAfter=function(){var _=a(this.hex,0,[0,4+this.foffset,1]);return _=_.replace(/(..)/g,"%$1"),_=decodeURIComponent(_),_},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var _=this.getSPKI();return _==null?null:a(_,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return m(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var _=this.getPublicKeyIdx();return m(this.hex,_,[1,0],"30")},this.getPublicKey=function(){return Pt.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var _=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(_)},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(_){var x=this.getSignatureAlgorithmField(),j=this.getSignatureValueHex(),U=l(this.hex,0,[0],"30"),k=new A.crypto.Signature({alg:x});return k.init(_),k.updateHex(U),k.verify(j)},this.parseExt=function(_){var x,j,U;if(_===void 0){if(U=this.hex,this.version!==3)return-1;x=m(U,0,[0,7,0],"30"),j=r(U,x)}else{U=Fr(_);var k=m(U,0,[0,3,0,0],"06");if(n(U,k)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}x=m(U,0,[0,3,0,1,0],"30"),j=r(U,x),this.hex=U}this.aExtInfo=new Array;for(var N=0;N<j.length;N++){var O={};O.critical=!1;var L=r(U,j[N]),T=0;L.length===3&&(O.critical=!0,T=1),O.oid=t.hextooidstr(a(U,j[N],[0],"06"));var M=m(U,j[N],[1+T]);O.vidx=d(U,M),this.aExtInfo.push(O)}},this.getExtInfo=function(_){var x=this.aExtInfo,j=_;if(_.match(/^[0-9.]+$/)||(j=A.asn1.x509.OID.name2oid(_)),j!==""){for(var U=0;U<x.length;U++)if(x[U].oid===j)return x[U]}},this.getCriticalExtV=function(_,x,j){if(x!=null)return[x,j];var U=this.getExtInfo(_);return U==null?[null,null]:[i(this.hex,U.vidx),U.critical]},this.getExtBasicConstraints=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("basicConstraints");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"basicConstraints"};if(x&&(U.critical=!0),_==="3000")return U;if(_==="30030101ff")return U.cA=!0,U;if(_.substr(0,12)==="30060101ff02"){var k=n(_,10),N=parseInt(k,16);return U.cA=!0,U.pathLen=N,U}throw new Error("hExtV parse error: "+_)},this.getExtNameConstraints=function(_,x){var j=this.getCriticalExtV("nameConstraints",_,x);if(_=j[0],x=j[1],_!=null){var U={extname:"nameConstraints"};x&&(U.critical=!0);for(var k=r(_,0),N=0;N<k.length;N++){for(var O=[],L=r(_,k[N]),T=0;T<L.length;T++){var M=i(_,L[T]),W=this.getGeneralSubtree(M);O.push(W)}var G=_.substr(k[N],2);G=="a0"?U.permit=O:G=="a1"&&(U.exclude=O)}return U}},this.getGeneralSubtree=function(_){var x=r(_,0),j=x.length;if(j<1||2<j)throw new Error("wrong num elements");for(var U=this.getGeneralName(i(_,x[0])),k=1;k<j;k++){var N=_.substr(x[k],2),O=n(_,x[k]),L=parseInt(O,16);N=="80"&&(U.min=L),N=="81"&&(U.max=L)}return U},this.getExtKeyUsage=function(_,x){var j=this.getCriticalExtV("keyUsage",_,x);if(_=j[0],x=j[1],_!=null){var U={extname:"keyUsage"};return x&&(U.critical=!0),U.names=this.getExtKeyUsageString(_).split(","),U}},this.getExtKeyUsageBin=function(_){if(_===void 0){var x=this.getExtInfo("keyUsage");if(x===void 0)return"";_=i(this.hex,x.vidx)}if(_.length!=8&&_.length!=10)throw new Error("malformed key usage value: "+_);var j="000000000000000"+parseInt(_.substr(6),16).toString(2);return _.length==8&&(j=j.slice(-8)),_.length==10&&(j=j.slice(-16)),j=j.replace(/0+$/,""),j==""&&(j="0"),j},this.getExtKeyUsageString=function(_){for(var x=this.getExtKeyUsageBin(_),j=new Array,U=0;U<x.length;U++)x.substr(U,1)=="1"&&j.push(ot.KEYUSAGE_NAME[U]);return j.join(",")},this.getExtSubjectKeyIdentifier=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("subjectKeyIdentifier");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"subjectKeyIdentifier"};x&&(U.critical=!0);var k=n(_,0);return U.kid={hex:k},U},this.getExtAuthorityKeyIdentifier=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("authorityKeyIdentifier");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"authorityKeyIdentifier"};x&&(U.critical=!0);for(var k=r(_,0),N=0;N<k.length;N++){var O=_.substr(k[N],2);if(O==="80"&&(U.kid={hex:n(_,k[N])}),O==="a1"){var L=i(_,k[N]),T=this.getGeneralNames(L);U.issuer=T[0].dn}O==="82"&&(U.sn={hex:n(_,k[N])})}return U},this.getExtExtKeyUsage=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("extKeyUsage");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"extKeyUsage",array:[]};x&&(U.critical=!0);for(var k=r(_,0),N=0;N<k.length;N++)U.array.push(g(n(_,k[N])));return U},this.getExtExtKeyUsageName=function(){var _=this.getExtInfo("extKeyUsage");if(_===void 0)return _;var x=new Array,j=i(this.hex,_.vidx);if(j==="")return x;for(var U=r(j,0),k=0;k<U.length;k++)x.push(g(n(j,U[k])));return x},this.getExtSubjectAltName=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("subjectAltName");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"subjectAltName",array:[]};return x&&(U.critical=!0),U.array=this.getGeneralNames(_),U},this.getExtIssuerAltName=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("issuerAltName");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"issuerAltName",array:[]};return x&&(U.critical=!0),U.array=this.getGeneralNames(_),U},this.getGeneralNames=function(_){for(var x=r(_,0),j=[],U=0;U<x.length;U++){var k=this.getGeneralName(i(_,x[U]));k!==void 0&&j.push(k)}return j},this.getGeneralName=function(_){var x=_.substr(0,2),j=n(_,0),U=Vs(j);if(x=="81")return{rfc822:U};if(x=="82")return{dns:U};if(x=="86")return{uri:U};if(x=="87")return{ip:Wg(j)};if(x=="a4")return{dn:this.getX500Name(j)};if(x=="a0")return{other:this.getOtherName(_)}},this.getExtSubjectAltName2=function(){var _,x,j,U=this.getExtInfo("subjectAltName");if(U===void 0)return U;for(var k=new Array,N=i(this.hex,U.vidx),O=r(N,0),L=0;L<O.length;L++)j=N.substr(O[L],2),_=n(N,O[L]),j==="81"&&(x=ar(_),k.push(["MAIL",x])),j==="82"&&(x=ar(_),k.push(["DNS",x])),j==="84"&&(x=ot.hex2dn(_,0),k.push(["DN",x])),j==="86"&&(x=ar(_),k.push(["URI",x])),j==="87"&&(x=Wg(_),k.push(["IP",x]));return k},this.getExtCRLDistributionPoints=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("cRLDistributionPoints");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"cRLDistributionPoints",array:[]};x&&(U.critical=!0);for(var k=r(_,0),N=0;N<k.length;N++){var O=i(_,k[N]);U.array.push(this.getDistributionPoint(O))}return U},this.getDistributionPoint=function(_){for(var x={},j=r(_,0),U=0;U<j.length;U++){var k=_.substr(j[U],2),N=i(_,j[U]);k=="a0"&&(x.dpname=this.getDistributionPointName(N))}return x},this.getDistributionPointName=function(_){for(var x={},j=r(_,0),U=0;U<j.length;U++){var k=_.substr(j[U],2),N=i(_,j[U]);k=="a0"&&(x.full=this.getGeneralNames(N))}return x},this.getExtCRLDistributionPointsURI=function(){var _=this.getExtCRLDistributionPoints();if(_==null)return _;for(var x=_.array,j=[],U=0;U<x.length;U++)try{x[U].dpname.full[0].uri!=null&&j.push(x[U].dpname.full[0].uri)}catch{}return j},this.getExtAIAInfo=function(){var _=this.getExtInfo("authorityInfoAccess");if(_===void 0)return _;for(var x={ocsp:[],caissuer:[]},j=r(this.hex,_.vidx),U=0;U<j.length;U++){var k=a(this.hex,j[U],[0],"06"),N=a(this.hex,j[U],[1],"86");k==="2b06010505073001"&&x.ocsp.push(ar(N)),k==="2b06010505073002"&&x.caissuer.push(ar(N))}return x},this.getExtAuthorityInfoAccess=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("authorityInfoAccess");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"authorityInfoAccess",array:[]};x&&(U.critical=!0);for(var k=r(_,0),N=0;N<k.length;N++){var O=u(_,k[N],[0],"06"),L=a(_,k[N],[1],"86"),T=ar(L);if(O=="2b06010505073001")U.array.push({ocsp:T});else if(O=="2b06010505073002")U.array.push({caissuer:T});else throw new Error("unknown method: "+O)}return U},this.getExtCertificatePolicies=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("certificatePolicies");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"certificatePolicies",array:[]};x&&(U.critical=!0);for(var k=r(_,0),N=0;N<k.length;N++){var O=i(_,k[N]),L=this.getPolicyInformation(O);U.array.push(L)}return U},this.getPolicyInformation=function(_){var x={},j=a(_,0,[0],"06");x.policyoid=g(j);var U=p(_,0,[1],"30");if(U!=-1){x.array=[];for(var k=r(_,U),N=0;N<k.length;N++){var O=i(_,k[N]),L=this.getPolicyQualifierInfo(O);x.array.push(L)}}return x},this.getOtherName=function(_){var x={},j=r(_,0),U=a(_,j[0],[],"06"),k=a(_,j[1],[]);return x.oid=g(U),x.value=o(k),x},this.getPolicyQualifierInfo=function(_){var x={},j=a(_,0,[0],"06");if(j==="2b06010505070201"){var U=u(_,0,[1],"16");x.cps=Vs(U)}else if(j==="2b06010505070202"){var k=l(_,0,[1],"30");x.unotice=this.getUserNotice(k)}return x},this.getUserNotice=function(_){var x=null,j={};try{x=t.parse(_);var U=this._asn1ToUnotice(x);return U}catch{return}},this._asn1ToUnotice=function(_){try{for(var x={},j=pr(_,"seq"),U=0;U<j.length;U++){var k=this._asn1ToNoticeRef(j[U]);k!=null&&(x.noticeref=k);var N=this.asn1ToDisplayText(j[U]);N!=null&&(x.exptext=N)}return Object.keys(x).length>0?x:void 0}catch{return}},this._asn1ToNoticeRef=function(_){try{for(var x={},j=pr(_,"seq"),U=0;U<j.length;U++){var k=this._asn1ToNoticeNum(j[U]);k!=null&&(x.noticenum=k);var N=this.asn1ToDisplayText(j[U]);N!=null&&(x.org=N)}return Object.keys(x).length>0?x:void 0}catch{return}},this._asn1ToNoticeNum=function(_){try{for(var x=pr(_,"seq"),j=[],U=0;U<x.length;U++){var k=x[U];j.push(parseInt(pr(k,"int.hex"),16))}return j}catch{return}},this.getDisplayText=function(_){var x={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},j={};return j.type=x[_.substr(0,2)],j.str=Vs(n(_,0)),j},this.asn1ToDisplayText=function(_){if(_.utf8str!=null)return{type:"utf8",str:_.utf8str.str};if(_.ia5str!=null)return{type:"ia5",str:_.ia5str.str};if(_.visstr!=null)return{type:"vis",str:_.visstr.str};if(_.bmpstr!=null)return{type:"bmp",str:_.bmpstr.str};if(_.prnstr!=null)return{type:"prn",str:_.prnstr.str}},this.getExtPolicyMappings=function(_,x){var j=this.getCriticalExtV("policyMappings",_,x);if(_=j[0],x=j[1],_!=null){var U={extname:"policyMappings"};x&&(U.critical=!0);try{for(var k=o(_),N=k.seq,O=[],L=0;L<N.length;L++){var T=N[L].seq;O.push([T[0].oid,T[1].oid])}U.array=O}catch{throw new C("malformed policyMappings")}return U}},this.getExtPolicyConstraints=function(_,x){var j=this.getCriticalExtV("policyConstraints",_,x);if(_=j[0],x=j[1],_!=null){var U={extname:"policyConstraints"};x&&(U.critical=!0);var k=o(_);try{for(var N=k.seq,O=0;O<N.length;O++){var L=N[O].tag;L.explicit==!1&&(L.tag=="80"&&(U.reqexp=parseInt(L.hex,16)),L.tag=="81"&&(U.inhibit=parseInt(L.hex,16)))}}catch{return new C("malformed policyConstraints value")}return U}},this.getExtInhibitAnyPolicy=function(_,x){var j=this.getCriticalExtV("inhibitAnyPolicy",_,x);if(_=j[0],x=j[1],_!=null){var U={extname:"inhibitAnyPolicy"};x&&(U.critical=!0);var k=v(_,0);return k==-1?new C("wrong value"):(U.skip=k,U)}},this.getExtCRLNumber=function(_,x){var j={extname:"cRLNumber"};if(x&&(j.critical=!0),_.substr(0,2)=="02")return j.num={hex:n(_,0)},j;throw new C("hExtV parse error: "+_)},this.getExtCRLReason=function(_,x){var j={extname:"cRLReason"};if(x&&(j.critical=!0),_.substr(0,2)=="0a")return j.code=parseInt(n(_,0),16),j;throw new Error("hExtV parse error: "+_)},this.getExtOcspNonce=function(_,x){var j={extname:"ocspNonce"};x&&(j.critical=!0);var U=n(_,0);return j.hex=U,j},this.getExtOcspNoCheck=function(_,x){var j={extname:"ocspNoCheck"};return x&&(j.critical=!0),j},this.getExtAdobeTimeStamp=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("adobeTimeStamp");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"adobeTimeStamp"};x&&(U.critical=!0);var k=r(_,0);if(k.length>1){var N=i(_,k[1]),O=this.getGeneralName(N);O.uri!=null&&(U.uri=O.uri)}if(k.length>2){var L=i(_,k[2]);L=="0101ff"&&(U.reqauth=!0),L=="010100"&&(U.reqauth=!1)}return U},this.getExtSubjectDirectoryAttributes=function(_,x){if(_===void 0&&x===void 0){var j=this.getExtInfo("subjectDirectoryAttributes");if(j===void 0)return;_=i(this.hex,j.vidx),x=j.critical}var U={extname:"subjectDirectoryAttributes"};x&&(U.critical=!0);try{for(var k=o(_),N=[],O=0;O<k.seq.length;O++){var L=k.seq[O],T=pr(L,"seq.0.oid"),M=pr(L,"seq.1.set");if(T==null||M==null)throw"error";N.push({attr:T,array:M})}return U.array=N,U}catch{throw new Error("malformed subjectDirectoryAttributes extension value")}};var D=function(_){var x={};try{var j=_.seq[0].oid,U=A.asn1.x509.OID.name2oid(j);x.type=A.asn1.x509.OID.oid2atype(U);var k=_.seq[1];if(k.utf8str!=null)x.ds="utf8",x.value=k.utf8str.str;else if(k.numstr!=null)x.ds="num",x.value=k.numstr.str;else if(k.telstr!=null)x.ds="tel",x.value=k.telstr.str;else if(k.prnstr!=null)x.ds="prn",x.value=k.prnstr.str;else if(k.ia5str!=null)x.ds="ia5",x.value=k.ia5str.str;else if(k.visstr!=null)x.ds="vis",x.value=k.visstr.str;else if(k.bmpstr!=null)x.ds="bmp",x.value=k.bmpstr.str;else throw"error";return x}catch{throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},H=function(_){try{return _.set.map(function(x){return D(x)})}catch(x){throw new Error("improper ASN.1 parsed RDN: "+x)}},K=function(_){try{return _.seq.map(function(x){return H(x)})}catch(x){throw new Error("improper ASN.1 parsed X500Name: "+x)}};this.getX500NameRule=function(_){for(var x=!0,j=!0,U=!1,k="",N="",O=null,L=[],T=0;T<_.length;T++)for(var M=_[T],W=0;W<M.length;W++)L.push(M[W]);for(var T=0;T<L.length;T++){var G=L[T],J=G.ds,te=G.value,ie=G.type;if(k+=":"+J,J!="prn"&&J!="utf8"&&J!="ia5")return"mixed";if(J=="ia5"){if(ie!="CN")return"mixed";if(A.lang.String.isMail(te))continue;return"mixed"}if(ie=="C"){if(J=="prn")continue;return"mixed"}if(N+=":"+J,O==null)O=J;else if(O!==J)return"mixed"}return O??"prn"},this.getAttrTypeAndValue=function(_){var x=o(_);return D(x)},this.getRDN=function(_){var x=o(_);return H(x)},this.getX500NameArray=function(_){var x=o(_);return K(x)},this.getX500Name=function(_,x,j){var U=this.getX500NameArray(_),k=this.dnarraytostr(U),N={str:k};return N.array=U,j==!0&&(N.hex=_),x==!0&&(N.canon=this.c14nRDNArray(U)),N},this.readCertPEM=function(_){this.readCertHex(E(_))},this.readCertHex=function(_){this.hex=_,this.getVersion();try{m(this.hex,0,[0,7],"a3"),this.parseExt()}catch{}},this.getParam=function(_){var x={};return _==null&&(_={}),x.version=this.getVersion(),x.serial={hex:this.getSerialNumberHex()},x.sigalg=this.getSignatureAlgorithmField(),x.issuer=this.getIssuer(_.dncanon,_.dnhex),x.notbefore=this.getNotBefore(),x.notafter=this.getNotAfter(),x.subject=this.getSubject(_.dncanon,_.dnhex),x.sbjpubkey=rs(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo!=null&&this.aExtInfo.length>0&&(x.ext=this.getExtParamArray()),x.sighex=this.getSignatureValueHex(),_.tbshex==!0&&(x.tbshex=l(this.hex,0,[0])),_.nodnarray==!0&&(delete x.issuer.array,delete x.subject.array),x},this.getExtParamArray=function(_){if(_==null){var x=p(this.hex,0,[0,"[3]"]);x!=-1&&(_=f(this.hex,0,[0,"[3]",0],"30"))}for(var j=[],U=r(_,0),k=0;k<U.length;k++){var N=i(_,U[k]),O=this.getExtParam(N);O!=null&&j.push(O)}return j},this.getExtParam=function(_){var x={},j=r(_,0),U=j.length;if(U!=2&&U!=3)throw new Error("wrong number elements in Extension: "+U+" "+_);var k=y(a(_,0,[0],"06")),N=!1;U==3&&l(_,0,[1])=="0101ff"&&(N=!0);var O=l(_,0,[U-1,0]),L=void 0;if(k=="2.5.29.14"?L=this.getExtSubjectKeyIdentifier(O,N):k=="2.5.29.15"?L=this.getExtKeyUsage(O,N):k=="2.5.29.17"?L=this.getExtSubjectAltName(O,N):k=="2.5.29.18"?L=this.getExtIssuerAltName(O,N):k=="2.5.29.19"?L=this.getExtBasicConstraints(O,N):k=="2.5.29.30"?L=this.getExtNameConstraints(O,N):k=="2.5.29.31"?L=this.getExtCRLDistributionPoints(O,N):k=="2.5.29.32"?L=this.getExtCertificatePolicies(O,N):k=="2.5.29.33"?L=this.getExtPolicyMappings(O,N):k=="2.5.29.35"?L=this.getExtAuthorityKeyIdentifier(O,N):k=="2.5.29.36"?L=this.getExtPolicyConstraints(O,N):k=="2.5.29.37"?L=this.getExtExtKeyUsage(O,N):k=="2.5.29.54"?L=this.getExtInhibitAnyPolicy(O,N):k=="1.3.6.1.5.5.7.1.1"?L=this.getExtAuthorityInfoAccess(O,N):k=="2.5.29.20"?L=this.getExtCRLNumber(O,N):k=="2.5.29.21"?L=this.getExtCRLReason(O,N):k=="2.5.29.9"?L=this.getExtSubjectDirectoryAttributes(O,N):k=="1.3.6.1.5.5.7.48.1.2"?L=this.getExtOcspNonce(O,N):k=="1.3.6.1.5.5.7.48.1.5"?L=this.getExtOcspNoCheck(O,N):k=="1.2.840.113583.1.1.9.1"?L=this.getExtAdobeTimeStamp(O,N):ot.EXT_PARSER[k]!=null&&(L=ot.EXT_PARSER[k](k,N,O)),L!=null)return L;var T={extname:k,extn:O};try{T.extn=o(O)}catch{}return N&&(T.critical=!0),T},this.findExt=function(_,x){for(var j=0;j<_.length;j++)if(_[j].extname==x)return _[j];return null},this.updateExtCDPFullURI=function(_,x){var j=this.findExt(_,"cRLDistributionPoints");if(j!=null&&j.array!=null){for(var U=j.array,k=0;k<U.length;k++)if(U[k].dpname!=null&&U[k].dpname.full!=null)for(var N=U[k].dpname.full,O=0;O<N.length;O++){var L=N[k];L.uri!=null&&(L.uri=x)}}},this.updateExtAIAOCSP=function(_,x){var j=this.findExt(_,"authorityInfoAccess");if(j!=null&&j.array!=null)for(var U=j.array,k=0;k<U.length;k++)U[k].ocsp!=null&&(U[k].ocsp=x)},this.updateExtAIACAIssuer=function(_,x){var j=this.findExt(_,"authorityInfoAccess");if(j!=null&&j.array!=null)for(var U=j.array,k=0;k<U.length;k++)U[k].caissuer!=null&&(U[k].caissuer=x)},this.dnarraytostr=function(_){function x(U){return U.map(function(k){return j(k).replace(/\+/,"\\+")}).join("+")}function j(U){return U.type+"="+U.value}return"/"+_.map(function(U){return x(U).replace(/\//,"\\/")}).join("/")},this.setCanonicalizedDN=function(_){var x;if(_.str!=null&&_.array==null){var j=new A.asn1.x509.X500Name({str:_.str}),U=j.tohex();x=this.getX500NameArray(U)}else x=_.array;_.canon==null&&(_.canon=this.c14nRDNArray(x))},this.c14nRDNArray=function(_){for(var x=[],j=0;j<_.length;j++){for(var U=_[j],k=[],N=0;N<U.length;N++){var O=U[N],L=O.value;L=L.replace(/^\s*/,""),L=L.replace(/\s*$/,""),L=L.replace(/\s+/g," "),L=L.toLowerCase(),k.push(O.type.toLowerCase()+"="+L)}x.push(k.join("+"))}return"/"+x.join("/")},this.getInfo=function(){var _=function(me){for(var Be="",Ue=" ",We=`
|
||
`,He=me.array,St=0;St<He.length;St++){var st=He[St];if(st.dn!=null&&(Be+=Ue+"dn: "+st.dn.str+We),st.ip!=null&&(Be+=Ue+"ip: "+st.ip+We),st.rfc822!=null&&(Be+=Ue+"rfc822: "+st.rfc822+We),st.dns!=null&&(Be+=Ue+"dns: "+st.dns+We),st.uri!=null&&(Be+=Ue+"uri: "+st.uri+We),st.other!=null){var wt=st.other.oid,Mn=JSON.stringify(st.other.value).replace(/\"/g,"");Be+=Ue+"other: "+wt+"="+Mn+We}}return Be=Be.replace(/\n$/,""),Be},x=function(me){for(var Be="",Ue=me.array,We=0;We<Ue.length;We++){var He=Ue[We];if(Be+=" policy oid: "+He.policyoid+`
|
||
`,He.array!==void 0)for(var St=0;St<He.array.length;St++){var st=He.array[St];st.cps!==void 0&&(Be+=" cps: "+st.cps+`
|
||
`)}}return Be},j=function(me){for(var Be="",Ue=me.array,We=0;We<Ue.length;We++){var He=Ue[We];try{He.dpname.full[0].uri!==void 0&&(Be+=" "+He.dpname.full[0].uri+`
|
||
`)}catch{}try{He.dname.full[0].dn.hex!==void 0&&(Be+=" "+ot.hex2dn(He.dpname.full[0].dn.hex)+`
|
||
`)}catch{}}return Be},U=function(me){for(var Be="",Ue=me.array,We=0;We<Ue.length;We++){var He=Ue[We];He.caissuer!==void 0&&(Be+=" caissuer: "+He.caissuer+`
|
||
`),He.ocsp!==void 0&&(Be+=" ocsp: "+He.ocsp+`
|
||
`)}return Be},k=ot,N,O,L;if(N=`Basic Fields
|
||
`,N+=" serial number: "+this.getSerialNumberHex()+`
|
||
`,N+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
|
||
`,N+=" issuer: "+this.getIssuerString()+`
|
||
`,N+=" notBefore: "+this.getNotBefore()+`
|
||
`,N+=" notAfter: "+this.getNotAfter()+`
|
||
`,N+=" subject: "+this.getSubjectString()+`
|
||
`,N+=` subject public key info:
|
||
`,O=this.getPublicKey(),N+=" key algorithm: "+O.type+`
|
||
`,O.type==="RSA"&&(N+=" n="+_A(O.n.toString(16)).substr(0,16)+`...
|
||
`,N+=" e="+_A(O.e.toString(16))+`
|
||
`),L=this.aExtInfo,L!=null){N+=`X509v3 Extensions:
|
||
`;for(var T=0;T<L.length;T++){var M=L[T],W=A.asn1.x509.OID.oid2name(M.oid);W===""&&(W=M.oid);var G="";if(M.critical===!0&&(G="CRITICAL"),N+=" "+W+" "+G+`:
|
||
`,W==="basicConstraints"){var J=this.getExtBasicConstraints();J.cA===void 0?N+=` {}
|
||
`:(N+=" cA=true",J.pathLen!==void 0&&(N+=", pathLen="+J.pathLen),N+=`
|
||
`)}else if(W=="policyMappings"){var te=this.getExtPolicyMappings().array,ie=te.map(function(me){var Be=me;return Be[0]+":"+Be[1]}).join(", ");N+=" "+ie+`
|
||
`}else if(W=="policyConstraints"){var ge=this.getExtPolicyConstraints();N+=" ",ge.reqexp!=null&&(N+=" reqexp="+ge.reqexp),ge.inhibit!=null&&(N+=" inhibit="+ge.inhibit),N+=`
|
||
`}else if(W=="inhibitAnyPolicy"){var ge=this.getExtInhibitAnyPolicy();N+=" skip="+ge.skip+`
|
||
`}else if(W=="keyUsage")N+=" "+this.getExtKeyUsageString()+`
|
||
`;else if(W=="subjectKeyIdentifier")N+=" "+this.getExtSubjectKeyIdentifier().kid.hex+`
|
||
`;else if(W=="authorityKeyIdentifier"){var he=this.getExtAuthorityKeyIdentifier();he.kid!==void 0&&(N+=" kid="+he.kid.hex+`
|
||
`)}else if(W=="extKeyUsage"){var Fe=this.getExtExtKeyUsage().array;N+=" "+Fe.join(", ")+`
|
||
`}else if(W=="subjectAltName"){var ke=_(this.getExtSubjectAltName());N+=ke+`
|
||
`}else if(W=="cRLDistributionPoints"){var $e=this.getExtCRLDistributionPoints();N+=j($e)}else if(W=="authorityInfoAccess"){var oe=this.getExtAuthorityInfoAccess();N+=U(oe)}else W=="certificatePolicies"&&(N+=x(this.getExtCertificatePolicies()))}}return N+="signature algorithm: "+this.getSignatureAlgorithmName()+`
|
||
`,N+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
|
||
`,N},typeof e=="string"&&(e.indexOf("-----BEGIN")!=-1?this.readCertPEM(e):A.lang.String.isHex(e)&&this.readCertHex(e))}ot.EXT_PARSER={};ot.registExtParser=function(e,t){ot.EXT_PARSER[e]=t};ot.hex2dn=function(e,t){t===void 0&&(t=0);var r=new ot,n=xe.getTLV(e,t),s=r.getX500Name(e);return s.str};ot.hex2rdn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="31")throw new Error("malformed RDN");for(var r=new Array,n=xe.getChildIdx(e,t),s=0;s<n.length;s++)r.push(ot.hex2attrTypeValue(e,n[s]));return r=r.map(function(o){return o.replace("+","\\+")}),r.join("+")};ot.hex2attrTypeValue=function(e,t){var r=xe,n=r.getV;if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var s=r.getChildIdx(e,t);s.length!==2||e.substr(s[0],2);var o=n(e,s[0]),i=A.asn1.ASN1Util.oidHexToInt(o),a=A.asn1.x509.OID.oid2atype(i),u=n(e,s[1]),l=Vs(u);return a+"="+l};ot.getPublicKeyFromCertHex=function(e){var t=new ot;return t.readCertHex(e),t.getPublicKey()};ot.getPublicKeyFromCertPEM=function(e){var t=new ot;return t.readCertPEM(e),t.getPublicKey()};ot.getPublicKeyInfoPropOfCertPEM=function(e){var t=xe,r=t.getVbyList,n={},s,o,i;return n.algparam=null,s=new ot,s.readCertPEM(e),o=s.getPublicKeyHex(),n.keyhex=r(o,0,[1],"03").substr(2),n.algoid=r(o,0,[0,0],"06"),n.algoid==="2a8648ce3d0201"&&(n.algparam=r(o,0,[0,1],"06")),n};ot.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var FZ=function(e){var t=A,r=t.lang.String.isHex,n=xe,s=n.getV,o=n.getTLV,i=n.getVbyList,a=n.getTLVbyList,u=n.getTLVbyListEx,l=n.getIdxbyList,f=n.getIdxbyListEx,m=n.getChildIdx,p=new ot;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this.parsed=null,this._setPos=function(){var d=l(this.hex,0,[0,0]),v=this.hex.substr(d,2);if(v=="02")this.posSigAlg=1;else if(v=="30")this.posSigAlg=0;else throw new Error("malformed 1st item of TBSCertList: "+v);var g=l(this.hex,0,[0,this.posSigAlg+3]),y=this.hex.substr(g,2);if(y=="17"||y=="18"){var w,E;w=l(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,w!=-1&&(E=this.hex.substr(w,2),E=="30"&&(this.posRevCert=this.posSigAlg+4))}else if(y=="30")this.posRevCert=this.posSigAlg+3;else if(y=="a0")this.posRevCert=null;else throw new Error("malformed nextUpdate or revCert tag: "+y)},this.getVersion=function(){return this.posSigAlg==0?null:parseInt(i(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var d=a(this.hex,0,[0,this.posSigAlg],"30");return p.getAlgorithmIdentifierName(d)},this.getIssuer=function(){return p.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return a(this.hex,0,[0,this.posSigAlg+1],"30")},this.getThisUpdate=function(){var d=i(this.hex,0,[0,this.posSigAlg+2]);return result=Vs(d)},this.getNextUpdate=function(){var d=l(this.hex,0,[0,this.posSigAlg+3]),v=this.hex.substr(d,2);return v!="17"&&v!="18"?null:Vs(s(this.hex,d))},this.getRevCertArray=function(){if(this.posRevCert==null)return null;for(var d=[],v=l(this.hex,0,[0,this.posRevCert]),g=m(this.hex,v),y=0;y<g.length;y++){var w=o(this.hex,g[y]);d.push(this.getRevCert(w))}return d},this.getRevCert=function(d){var v={},g=m(d,0);return v.sn={hex:i(d,0,[0],"02")},v.date=Vs(i(d,0,[1])),g.length==3&&(v.ext=p.getExtParamArray(a(d,0,[2]))),v},this.findRevCert=function(d){var v=new ot(d),g=v.getSerialNumberHex();return this.findRevCertBySN(g)},this.findRevCertBySN=function(d){if(this.parsed==null&&this.getParam(),this.parsed.revcert==null)return null;for(var v=this.parsed.revcert,g=0;g<v.length;g++)if(d==v[g].sn.hex)return v[g];return null},this.getSignatureValueHex=function(){return i(this.hex,0,[2],"03",!0)},this.verifySignature=function(d){var v=this.getSignatureAlgorithmField(),g=this.getSignatureValueHex(),y=a(this.hex,0,[0],"30"),w=new A.crypto.Signature({alg:v});return w.init(d),w.updateHex(y),w.verify(g)},this.getParam=function(d){var v={},g=this.getVersion();g!=null&&(v.version=g),v.sigalg=this.getSignatureAlgorithmField(),v.issuer=this.getIssuer(),v.thisupdate=this.getThisUpdate();var y=this.getNextUpdate();y!=null&&(v.nextupdate=y);var w=this.getRevCertArray();w!=null&&(v.revcert=w);var E=f(this.hex,0,[0,"[0]"]);if(E!=-1){var S=u(this.hex,0,[0,"[0]",0]);v.ext=p.getExtParamArray(S)}return v.sighex=this.getSignatureValueHex(),this.parsed=v,typeof d=="object"&&(d.tbshex==!0&&(v.tbshex=a(this.hex,0,[0])),d.nodnarray==!0&&delete v.issuer.array),v},typeof e=="string"&&(r(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=Fr(e)),this._setPos())};(typeof A>"u"||!A)&&(A={});(typeof A.jws>"u"||!A.jws)&&(A.jws={});A.jws.JWS=function(){var e=A,t=e.jws.JWS,r=t.isSafeJSONString;this.parseJWS=function(n,s){if(!(this.parsedJWS!==void 0&&(s||this.parsedJWS.sigvalH!==void 0))){var o=n.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(o==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=o[1],a=o[2],u=o[3],l=i+"."+a;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=a,this.parsedJWS.sigvalB64U=u,this.parsedJWS.si=l,!s){var f=wr(u),m=js(f,16);this.parsedJWS.sigvalH=f,this.parsedJWS.sigvalBI=m}var p=mo(i),d=mo(a);if(this.parsedJWS.headS=p,this.parsedJWS.payloadS=d,!r(p,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+p}}};A.jws.JWS.sign=function(e,t,r,n,s){var o=A,i=o.jws,a=i.JWS,u=a.readSafeJSONString,l=a.isSafeJSONString,f=o.crypto,m=f.ECDSA,p=f.Mac,d=f.Signature,v=JSON,g,y,w;if(typeof t!="string"&&typeof t!="object")throw"spHeader must be JSON string or object: "+t;if(typeof t=="object"&&(y=t,g=v.stringify(y)),typeof t=="string"){if(g=t,!l(g))throw"JWS Head is not safe JSON string: "+g;y=u(g)}if(w=r,typeof r=="object"&&(w=v.stringify(r)),(e==""||e==null)&&y.alg!==void 0&&(e=y.alg),e!=""&&e!=null&&y.alg===void 0&&(y.alg=e,g=v.stringify(y)),e!==y.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+y.alg;var E=null;if(a.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;E=a.jwsalg2sigalg[e];var S=Wp(g),C=Wp(w),D=S+"."+C,H="";if(E.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var K=new p({alg:E,prov:"cryptojs",pass:n});K.updateString(D),H=K.doFinal()}else if(E.indexOf("withECDSA")!=-1){var _=new d({alg:E});_.init(n,s),_.updateString(D);var x=_.sign();H=A.crypto.ECDSA.asn1SigToConcatSig(x)}else if(E!="none"){var _=new d({alg:E});_.init(n,s),_.updateString(D),H=_.sign()}var j=rn(H);return D+"."+j};A.jws.JWS.verify=function(e,t,r){var n=A,s=n.jws,o=s.JWS,i=o.readSafeJSONString,a=n.crypto,u=a.ECDSA,l=a.Mac,f=a.Signature,m;if(typeof dt!==void 0&&(m=dt),!TA(e))return!1;var p=e.split(".");if(p.length!==3)return!1;var d=p[0],v=p[1],g=d+"."+v,y=wr(p[2]),w=i(mo(p[0])),E=null,S=null;if(w.alg===void 0)throw"algorithm not specified in header";if(E=w.alg,S=E.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var C=":"+r.join(":")+":";if(C.indexOf(":"+E+":")==-1)throw"algorithm '"+E+"' not accepted in the list"}if(E!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=Pt.getKey(t)),(S=="RS"||S=="PS")&&!(t instanceof m))throw"key shall be a RSAKey obj for RS* and PS* algs";if(S=="ES"&&!(t instanceof u))throw"key shall be a ECDSA obj for ES* algs";E=="none";var D=null;if(o.jwsalg2sigalg[w.alg]===void 0)throw new Error("unsupported alg name: "+E);if(D=o.jwsalg2sigalg[E],w.crit!==void 0){if(!Array.isArray(w.crit)||w.crit.length===0)throw new Error("wrong critical header");for(var H=0;H<w.crit.length;H++){var K=w.crit[H];if(typeof K!="string"||K.length===0)throw new Error("wrong critical header");if(w[K]===void 0)throw new Error("critical header '"+K+"' missing")}}if(D=="none")throw new Error("not supported");if(D.substr(0,4)=="Hmac"){var _=null;if(t===void 0)throw new Error("hexadecimal key shall be specified for HMAC");var x=new l({alg:D,pass:t});return x.updateString(g),_=x.doFinal(),zI(y,_)}else if(D.indexOf("withECDSA")!=-1){var j=null;try{j=u.concatSigToASN1Sig(y)}catch{return!1}var U=new f({alg:D});return U.init(t),U.updateString(g),U.verify(j)}else{var U=new f({alg:D});return U.init(t),U.updateString(g),U.verify(y)}};A.jws.JWS.parse=function(e){var t=e.split("."),r={},n,s,o;if(t.length!=2&&t.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return n=t[0],s=t[1],t.length==3&&(o=t[2]),r.headerObj=A.jws.JWS.readSafeJSONString(mo(n)),r.payloadObj=A.jws.JWS.readSafeJSONString(mo(s)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=mo(s):r.payloadPP=JSON.stringify(r.payloadObj,null," "),o!==void 0&&(r.sigHex=wr(o)),r};A.jws.JWS.verifyJWT=function(e,t,r){var n=A,s=n.jws,o=s.JWS,i=o.readSafeJSONString,a=o.inArray,u=o.includedArray;if(!TA(e))return!1;var l=e.split(".");if(l.length!=3)return!1;var f=l[0],m=l[1],p=f+"."+m,d=wr(l[2]),v=i(mo(f)),g=i(mo(m));if(v.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!a(v.alg,r.alg)||g.iss!==void 0&&typeof r.iss=="object"&&!a(g.iss,r.iss)||g.sub!==void 0&&typeof r.sub=="object"&&!a(g.sub,r.sub))return!1;if(g.aud!==void 0&&typeof r.aud=="object"){if(typeof g.aud=="string"){if(!a(g.aud,r.aud))return!1}else if(typeof g.aud=="object"&&!u(g.aud,r.aud))return!1}var y=s.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(y=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(g.exp!==void 0&&typeof g.exp=="number"&&g.exp+r.gracePeriod<y||g.nbf!==void 0&&typeof g.nbf=="number"&&y<g.nbf-r.gracePeriod||g.iat!==void 0&&typeof g.iat=="number"&&y<g.iat-r.gracePeriod||g.jti!==void 0&&r.jti!==void 0&&g.jti!==r.jti||!o.verify(e,t,r.alg))};A.jws.JWS.includedArray=function(e,t){var r=A.jws.JWS.inArray;if(e===null||typeof e!="object"||typeof e.length!="number")return!1;for(var n=0;n<e.length;n++)if(!r(e[n],t))return!1;return!0};A.jws.JWS.inArray=function(e,t){if(t===null||typeof t!="object"||typeof t.length!="number")return!1;for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1};A.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",ES512:"SHA512withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"};A.jws.JWS.isSafeJSONString=function(e,t,r){var n=null;try{return n=HI(e),typeof n!="object"||n.constructor===Array?0:(t&&(t[r]=n),1)}catch{return 0}};A.jws.JWS.readSafeJSONString=function(e){var t=null;try{return t=HI(e),typeof t!="object"||t.constructor===Array?null:t}catch{return null}};A.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(t==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]};A.jws.JWS.getJWKthumbprint=function(e){if(e.kty!=="RSA"&&e.kty!=="EC"&&e.kty!=="oct")throw new Error("unsupported algorithm for JWK Thumprint");var t="{";if(e.kty==="RSA"){if(typeof e.n!="string"||typeof e.e!="string")throw new Error("wrong n and e value for RSA key");t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if(e.kty==="EC"){if(typeof e.crv!="string"||typeof e.x!="string"||typeof e.y!="string")throw new Error("wrong crv, x and y value for EC key");t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if(e.kty==="oct"){if(typeof e.k!="string")throw new Error("wrong k value for oct(symmetric) key");t+='"k":"'+e.k+'",',t+='"kty":"'+e.kty+'"}'}var r=aa(t),n=A.crypto.Util.hashHex(r,"sha256"),s=rn(n);return s};A.jws.IntDate={};A.jws.IntDate.get=function(e){var t=A.jws.IntDate,r=t.getNow,n=t.getZulu;if(e=="now")return r();if(e=="now + 1hour")return r()+3600;if(e=="now + 1day")return r()+3600*24;if(e=="now + 1month")return r()+3600*24*30;if(e=="now + 1year")return r()+3600*24*365;if(e.match(/Z$/))return n(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e};A.jws.IntDate.getZulu=function(e){return KI(e)};A.jws.IntDate.getNow=function(){var e=~~(new Date/1e3);return e};A.jws.IntDate.intDate2UTCString=function(e){var t=new Date(e*1e3);return t.toUTCString()};A.jws.IntDate.intDate2Zulu=function(e){var t=new Date(e*1e3),r=("0000"+t.getUTCFullYear()).slice(-4),n=("00"+(t.getUTCMonth()+1)).slice(-2),s=("00"+t.getUTCDate()).slice(-2),o=("00"+t.getUTCHours()).slice(-2),i=("00"+t.getUTCMinutes()).slice(-2),a=("00"+t.getUTCSeconds()).slice(-2);return r+n+s+o+i+a+"Z"};(typeof A>"u"||!A)&&(A={});(typeof A.jws>"u"||!A.jws)&&(A.jws={});A.jws.JWSJS=function(){var e=A,t=e.jws,r=t.JWS,n=r.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(s){this.init();var o=s.split(".");if(o.length!=3)throw"malformed input JWS";this.aHeader.push(o[0]),this.sPayload=o[1],this.aSignature.push(o[2])},this.addSignature=function(s,o,i,a){if(this.sPayload===void 0||this.sPayload===null)throw"there's no JSON-JS signature to add.";var u=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var l=A.jws.JWS.sign(s,o,this.sPayload,i,a),f=l.split("."),m=f[0],p=f[2];this.aHeader.push(f[0]),this.aSignature.push(f[2])}catch(d){throw this.aHeader.length>u&&this.aHeader.pop(),this.aSignature.length>u&&this.aSignature.pop(),"addSignature failed: "+d}},this.verifyAll=function(s){if(this.aHeader.length!==s.length||this.aSignature.length!==s.length)return!1;for(var o=0;o<s.length;o++){var i=s[o];if(i.length!==2)return!1;var a=this.verifyNth(o,i[0],i[1]);if(a===!1)return!1}return!0},this.verifyNth=function(s,o,i){if(this.aHeader.length<=s||this.aSignature.length<=s)return!1;var a=this.aHeader[s],u=this.aSignature[s],l=a+"."+this.sPayload+"."+u,f=!1;try{f=r.verify(l,o,i)}catch{return!1}return f},this.readJWSJS=function(s){if(typeof s=="string"){var o=n(s);if(o==null)throw"argument is not safe JSON object string";this.aHeader=o.headers,this.sPayload=o.payload,this.aSignature=o.signatures}else try{if(s.headers.length>0)this.aHeader=s.headers;else throw"malformed header";if(typeof s.payload=="string")this.sPayload=s.payload;else throw"malformed signatures";if(s.signatures.length>0)this.aSignature=s.signatures;else throw"malformed signatures"}catch(i){throw"malformed JWS-JS JSON object: "+i}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return this.aHeader.length==0?1:0}};Te.SecureRandom=Fd;Te.rng_seed_time=BA;Te.BigInteger=se;Te.RSAKey=dt;Te.ECDSA=A.crypto.ECDSA;Te.DSA=A.crypto.DSA;Te.Signature=A.crypto.Signature;Te.MessageDigest=A.crypto.MessageDigest;Te.Mac=A.crypto.Mac;Te.KEYUTIL=Pt;Te.ASN1HEX=xe;Te.X509=ot;Te.X509CRL=FZ;Te.CryptoJS=Oe;Te.b64tohex=_d;Te.b64toBA=PI;Te.ECFieldElementFp=nn;Te.ECPointFp=Zt;Te.ECCurveFp=cu;Te.stoBA=MI;Te.BAtos=qI;Te.BAtohex=e2;Te.stohex=Ks;Te.stob64=aZ;Te.stob64u=uZ;Te.b64utos=cZ;Te.b64tob64u=Sd;Te.b64utob64=Jp;Te.hex2b64=uu;Te.hextob64u=rn;Te.b64utohex=wr;Te.utf8tob64u=Wp;Te.b64utoutf8=mo;Te.utf8tob64=lZ;Te.b64toutf8=fZ;Te.utf8tohex=t2;Te.hextoutf8=ar;Te.hextorstr=Vs;Te.rstrtohex=aa;Te.hextob64=IA;Te.hextob64nl=pZ;Te.b64nltohex=jI;Te.hextopem=rs;Te.pemtohex=Fr;Te.hextoArrayBuffer=vZ;Te.ArrayBuffertohex=wZ;Te.zulutomsec=$A;Te.msectozulu=yZ;Te.zulutosec=KI;Te.zulutodate=EZ;Te.datetozulu=bZ;Te.uricmptohex=n2;Te.hextouricmp=s2;Te.ipv6tohex=AA;Te.hextoipv6=SA;Te.hextoip=Wg;Te.iptohex=xA;Te.ucs2hextoutf8=RA;Te.encodeURIComponentAll=i2;Te.newline_toUnix=AZ;Te.newline_toDos=SZ;Te.hextoposhex=_A;Te.intarystrtohex=_Z;Te.strdiffidx=CZ;Te.oidtohex=WI;Te.hextooid=o2;Te.strpad=Xg;Te.bitstrtoint=JI;Te.inttobitstr=ZI;Te.bitstrtobinstr=QI;Te.binstrtobitstr=DZ;Te.isBase64URLDot=TA;Te.namearraytobinstr=Jg;Te.extendClass=Ae;Te.foldnl=r2;Te.b64topem=mZ;Te.pemtob64=gZ;Te.timeogen=VI;Te.aryval=pr;Te.inttohex=XI;Te.twoscompl=Zp;Te.timingSafeEqual=zI;Te.timingSafeEqualImpl=YI;Te.KJUR=A;Te.crypto=A.crypto;Te.asn1=A.asn1;Te.jws=A.jws;Te.lang=A.lang;Te.VERSION=OW;Te.VERSION_FULL=NW});function BZ(e){let t=kA.default.pemtohex(e);return kA.default.KJUR.crypto.Util.hashHex(t,"sha256").match(/.{2}/g).join(":").toUpperCase()}var d0e,kA,s$,i$=re(()=>{d0e=F(I()),kA=F(n$());s$={generateFingerprint:BZ}});function rr(e){if(e&&typeof e=="object")switch(e[bs]){case go:case lu:return!0}return!1}function Kt(e){if(e&&typeof e=="object")switch(e[bs]){case a2:case go:case pi:case lu:return!0}return!1}var p0e,a2,u2,go,PA,pi,lu,bs,Gs,vo,wo,Ht,At,mi,c2,Vt=re(()=>{p0e=F(I(),1),a2=Symbol.for("yaml.alias"),u2=Symbol.for("yaml.document"),go=Symbol.for("yaml.map"),PA=Symbol.for("yaml.pair"),pi=Symbol.for("yaml.scalar"),lu=Symbol.for("yaml.seq"),bs=Symbol.for("yaml.node.type"),Gs=e=>!!e&&typeof e=="object"&&e[bs]===a2,vo=e=>!!e&&typeof e=="object"&&e[bs]===u2,wo=e=>!!e&&typeof e=="object"&&e[bs]===go,Ht=e=>!!e&&typeof e=="object"&&e[bs]===PA,At=e=>!!e&&typeof e=="object"&&e[bs]===pi,mi=e=>!!e&&typeof e=="object"&&e[bs]===lu;c2=e=>(At(e)||rr(e))&&!!e.anchor});function Ys(e,t){let r=a$(t);vo(e)?Bd(null,e.contents,r,Object.freeze([e]))===ca&&(e.contents=null):Bd(null,e,r,Object.freeze([]))}function Bd(e,t,r,n){let s=u$(e,t,r,n);if(Kt(s)||Ht(s))return c$(e,n,s),Bd(e,s,r,n);if(typeof s!="symbol"){if(rr(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let i=Bd(o,t.items[o],r,n);if(typeof i=="number")o=i-1;else{if(i===zs)return zs;i===ca&&(t.items.splice(o,1),o-=1)}}}else if(Ht(t)){n=Object.freeze(n.concat(t));let o=Bd("key",t.key,r,n);if(o===zs)return zs;o===ca&&(t.key=null);let i=Bd("value",t.value,r,n);if(i===zs)return zs;i===ca&&(t.value=null)}}return s}async function l2(e,t){let r=a$(t);vo(e)?await Id(null,e.contents,r,Object.freeze([e]))===ca&&(e.contents=null):await Id(null,e,r,Object.freeze([]))}async function Id(e,t,r,n){let s=await u$(e,t,r,n);if(Kt(s)||Ht(s))return c$(e,n,s),Id(e,s,r,n);if(typeof s!="symbol"){if(rr(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let i=await Id(o,t.items[o],r,n);if(typeof i=="number")o=i-1;else{if(i===zs)return zs;i===ca&&(t.items.splice(o,1),o-=1)}}}else if(Ht(t)){n=Object.freeze(n.concat(t));let o=await Id("key",t.key,r,n);if(o===zs)return zs;o===ca&&(t.key=null);let i=await Id("value",t.value,r,n);if(i===zs)return zs;i===ca&&(t.value=null)}}return s}function a$(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function u$(e,t,r,n){if(typeof r=="function")return r(e,t,n);if(wo(t))return r.Map?.(e,t,n);if(mi(t))return r.Seq?.(e,t,n);if(Ht(t))return r.Pair?.(e,t,n);if(At(t))return r.Scalar?.(e,t,n);if(Gs(t))return r.Alias?.(e,t,n)}function c$(e,t,r){let n=t[t.length-1];if(rr(n))n.items[e]=r;else if(Ht(n))e==="key"?n.key=r:n.value=r;else if(vo(n))n.contents=r;else{let s=Gs(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}var v0e,zs,o$,ca,Qp=re(()=>{v0e=F(I(),1);Vt();zs=Symbol("break visit"),o$=Symbol("skip children"),ca=Symbol("remove node");Ys.BREAK=zs;Ys.SKIP=o$;Ys.REMOVE=ca;l2.BREAK=zs;l2.SKIP=o$;l2.REMOVE=ca});var b0e,IZ,$Z,la,OA=re(()=>{b0e=F(I(),1);Vt();Qp();IZ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},$Z=e=>e.replace(/[!,[\]{}]/g,t=>IZ[t]),la=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let n=t.trim().split(/[ \t]+/),s=n.shift();switch(s){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,i]=n;return this.tags[o]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let i=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,i),!1}}default:return r(0,`Unknown directive ${s}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let i=t.slice(2,-1);return i==="!"||i==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),i)}let[,n,s]=t.match(/^(.*!)([^!]*)$/s);s||r(`The ${t} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(s)}catch(i){return r(String(i)),null}return n==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,n]of Object.entries(this.tags))if(t.startsWith(n))return r+$Z(t.substring(n.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),s;if(t&&n.length>0&&Kt(t.contents)){let o={};Ys(t.contents,(i,a)=>{Kt(a)&&a.tag&&(o[a.tag]=!0)}),s=Object.keys(o)}else s=[];for(let[o,i]of n)o==="!!"&&i==="tag:yaml.org,2002:"||(!t||s.some(a=>a.startsWith(i)))&&r.push(`%TAG ${o} ${i}`);return r.join(`
|
||
`)}};la.defaultYaml={explicit:!1,version:"1.2"};la.defaultTags={"!!":"tag:yaml.org,2002:"}});function f2(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function NA(e){let t=new Set;return Ys(e,{Value(r,n){n.anchor&&t.add(n.anchor)}}),t}function LA(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function l$(e,t){let r=[],n=new Map,s=null;return{onAnchor:o=>{r.push(o),s??(s=NA(e));let i=LA(t,s);return s.add(i),i},setAnchors:()=>{for(let o of r){let i=n.get(o);if(typeof i=="object"&&i.anchor&&(At(i.node)||rr(i.node)))i.node.anchor=i.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}var C0e,d2=re(()=>{C0e=F(I(),1);Vt();Qp()});function _c(e,t,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let s=0,o=n.length;s<o;++s){let i=n[s],a=_c(e,n,String(s),i);a===void 0?delete n[s]:a!==i&&(n[s]=a)}else if(n instanceof Map)for(let s of Array.from(n.keys())){let o=n.get(s),i=_c(e,n,s,o);i===void 0?n.delete(s):i!==o&&n.set(s,i)}else if(n instanceof Set)for(let s of Array.from(n)){let o=_c(e,n,s,s);o===void 0?n.delete(s):o!==s&&(n.delete(s),n.add(o))}else for(let[s,o]of Object.entries(n)){let i=_c(e,n,s,o);i===void 0?delete n[s]:i!==o&&(n[s]=i)}return e.call(t,r,n)}var F0e,UA=re(()=>{F0e=F(I(),1)});function sn(e,t,r){if(Array.isArray(e))return e.map((n,s)=>sn(n,String(s),r));if(e&&typeof e.toJSON=="function"){if(!r||!c2(e))return e.toJSON(t,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(e,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let s=e.toJSON(t,r);return r.onCreate&&r.onCreate(s),s}return typeof e=="bigint"&&!r?.keep?Number(e):e}var $0e,Cc=re(()=>{$0e=F(I(),1);Vt()});var P0e,Dc,h2=re(()=>{P0e=F(I(),1);UA();Vt();Cc();Dc=class{constructor(t){Object.defineProperty(this,bs,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:n,onAnchor:s,reviver:o}={}){if(!vo(t))throw new TypeError("A document argument is required");let i={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=sn(this,"",i);if(typeof s=="function")for(let{count:u,res:l}of i.anchors.values())s(l,u);return typeof o=="function"?_c(o,{"":a},"",a):a}}});function p2(e,t,r){if(Gs(t)){let n=t.resolve(e),s=r&&n&&r.get(n);return s?s.count*s.aliasCount:0}else if(rr(t)){let n=0;for(let s of t.items){let o=p2(e,s,r);o>n&&(n=o)}return n}else if(Ht(t)){let n=p2(e,t.key,r),s=p2(e,t.value,r);return Math.max(n,s)}return 1}var q0e,fu,e0=re(()=>{q0e=F(I(),1);d2();Qp();Vt();h2();Cc();fu=class extends Dc{constructor(t){super(a2),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],Ys(t,{Node:(o,i)=>{(Gs(i)||c2(i))&&n.push(i)}}),r&&(r.aliasResolveCache=n));let s;for(let o of n){if(o===this)break;o.anchor===this.source&&(s=o)}return s}toJSON(t,r){if(!r)return{source:this.source};let{anchors:n,doc:s,maxAliasCount:o}=r,i=this.resolve(s,r);if(!i){let u=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(u)}let a=n.get(i);if(a||(sn(i,null,r),a=n.get(i)),a?.res===void 0){let u="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(u)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=p2(s,i,n)),a.count*a.aliasCount>o)){let u="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(u)}return a.res}toString(t,r,n){let s=`*${this.source}`;if(t){if(f2(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(t.implicitKey)return`${s} `}return s}}});var z0e,m2,Ye,Wr=re(()=>{z0e=F(I(),1);Vt();h2();Cc();m2=e=>!e||typeof e!="function"&&typeof e!="object",Ye=class extends Dc{constructor(t){super(pi),this.value=t}toJSON(t,r){return r?.keep?this.value:sn(this.value,t,r)}toString(){return String(this.value)}};Ye.BLOCK_FOLDED="BLOCK_FOLDED";Ye.BLOCK_LITERAL="BLOCK_LITERAL";Ye.PLAIN="PLAIN";Ye.QUOTE_DOUBLE="QUOTE_DOUBLE";Ye.QUOTE_SINGLE="QUOTE_SINGLE"});function RZ(e,t,r){if(t){let n=r.filter(o=>o.tag===t),s=n.find(o=>!o.format)??n[0];if(!s)throw new Error(`Tag ${t} not found`);return s}return r.find(n=>n.identify?.(e)&&!n.format)}function du(e,t,r){if(vo(e)&&(e=e.contents),Kt(e))return e;if(Ht(e)){let m=r.schema[go].createNode?.(r.schema,null,r);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:n,onAnchor:s,onTagObj:o,schema:i,sourceObjects:a}=r,u;if(n&&e&&typeof e=="object"){if(u=a.get(e),u)return u.anchor??(u.anchor=s(e)),new fu(u.anchor);u={anchor:null,node:null},a.set(e,u)}t?.startsWith("!!")&&(t=xZ+t.slice(2));let l=RZ(e,t,i.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let m=new Ye(e);return u&&(u.node=m),m}l=e instanceof Map?i[go]:Symbol.iterator in Object(e)?i[lu]:i[go]}o&&(o(l),delete r.onTagObj);let f=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,e,r):new Ye(e);return t?f.tag=t:l.default||(f.tag=l.tag),u&&(u.node=f),f}var Z0e,xZ,t0=re(()=>{Z0e=F(I(),1);e0();Vt();Wr();xZ="tag:yaml.org,2002:"});function r0(e,t,r){let n=r;for(let s=t.length-1;s>=0;--s){let o=t[s];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let i=[];i[o]=n,n=i}else n=new Map([[o,n]])}return du(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var n1e,xd,$d,g2=re(()=>{n1e=F(I(),1);t0();Vt();h2();xd=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,$d=class extends Dc{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(n=>Kt(n)||Ht(n)?n.clone(t):n),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(xd(t))this.add(r);else{let[n,...s]=t,o=this.get(n,!0);if(rr(o))o.addIn(s,r);else if(o===void 0&&this.schema)this.set(n,r0(this.schema,s,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}deleteIn(t){let[r,...n]=t;if(n.length===0)return this.delete(r);let s=this.get(r,!0);if(rr(s))return s.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(t,r){let[n,...s]=t,o=this.get(n,!0);return s.length===0?!r&&At(o)?o.value:o:rr(o)?o.getIn(s,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!Ht(r))return!1;let n=r.value;return n==null||t&&At(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(t){let[r,...n]=t;if(n.length===0)return this.has(r);let s=this.get(r,!0);return rr(s)?s.hasIn(n):!1}setIn(t,r){let[n,...s]=t;if(s.length===0)this.set(n,r);else{let o=this.get(n,!0);if(rr(o))o.setIn(s,r);else if(o===void 0&&this.schema)this.set(n,r0(this.schema,s,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}}});function Mi(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var i1e,f$,fa,n0=re(()=>{i1e=F(I(),1),f$=e=>e.replace(/^(?!$)(?: $)?/gm,"#");fa=(e,t,r)=>e.endsWith(`
|
||
`)?Mi(r,t):r.includes(`
|
||
`)?`
|
||
`+Mi(r,t):(e.endsWith(" ")?"":" ")+r});function i0(e,t,r="flow",{indentAtStart:n,lineWidth:s=80,minContentWidth:o=20,onFold:i,onOverflow:a}={}){if(!s||s<0)return e;s<o&&(o=0);let u=Math.max(1+o,1+s-t.length);if(e.length<=u)return e;let l=[],f={},m=s-t.length;typeof n=="number"&&(n>s-Math.max(2,o)?l.push(0):m=s-n);let p,d,v=!1,g=-1,y=-1,w=-1;r===v2&&(g=d$(e,g,t.length),g!==-1&&(m=g+u));for(let S;S=e[g+=1];){if(r===s0&&S==="\\"){switch(y=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}w=g}if(S===`
|
||
`)r===v2&&(g=d$(e,g,t.length)),m=g+t.length+u,p=void 0;else{if(S===" "&&d&&d!==" "&&d!==`
|
||
`&&d!==" "){let C=e[g+1];C&&C!==" "&&C!==`
|
||
`&&C!==" "&&(p=g)}if(g>=m)if(p)l.push(p),m=p+u,p=void 0;else if(r===s0){for(;d===" "||d===" ";)d=S,S=e[g+=1],v=!0;let C=g>w+1?g-2:y-1;if(f[C])return e;l.push(C),f[C]=!0,m=C+u,p=void 0}else v=!0}d=S}if(v&&a&&a(),l.length===0)return e;i&&i();let E=e.slice(0,l[0]);for(let S=0;S<l.length;++S){let C=l[S],D=l[S+1]||e.length;C===0?E=`
|
||
${t}${e.slice(0,D)}`:(r===s0&&f[C]&&(E+=`${e[C]}\\`),E+=`
|
||
${t}${e.slice(C+1,D)}`)}return E}function d$(e,t,r){let n=t,s=t+1,o=e[s];for(;o===" "||o===" ";)if(t<s+r)o=e[++t];else{do o=e[++t];while(o&&o!==`
|
||
`);n=t,s=t+1,o=e[s]}return n}var a1e,HA,v2,s0,h$=re(()=>{a1e=F(I(),1),HA="flow",v2="block",s0="quoted"});function TZ(e,t,r){if(!t||t<0)return!1;let n=t-r,s=e.length;if(s<=n)return!1;for(let o=0,i=0;o<s;++o)if(e[o]===`
|
||
`){if(o-i>n)return!0;if(i=o+1,s-i<=n)return!1}return!0}function o0(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=t,s=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(E2(e)?" ":""),i="",a=0;for(let u=0,l=r[u];l;l=r[++u])if(l===" "&&r[u+1]==="\\"&&r[u+2]==="n"&&(i+=r.slice(a,u)+"\\ ",u+=1,a=u,l="\\"),l==="\\")switch(r[u+1]){case"u":{i+=r.slice(a,u);let f=r.substr(u+2,4);switch(f){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:f.substr(0,2)==="00"?i+="\\x"+f.substr(2):i+=r.substr(u,6)}u+=5,a=u+1}break;case"n":if(n||r[u+2]==='"'||r.length<s)u+=1;else{for(i+=r.slice(a,u)+`
|
||
|
||
`;r[u+2]==="\\"&&r[u+3]==="n"&&r[u+4]!=='"';)i+=`
|
||
`,u+=2;i+=o,r[u+2]===" "&&(i+="\\"),u+=1,a=u+1}break;default:u+=1}return i=a?i+r.slice(a):r,n?i:i0(i,o,s0,y2(t,!1))}function MA(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
||
`)||/[ \t]\n|\n[ \t]/.test(e))return o0(e,t);let r=t.indent||(E2(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
||
${r}`)+"'";return t.implicitKey?n:i0(n,r,HA,y2(t,!1))}function Rd(e,t){let{singleQuote:r}=t.options,n;if(r===!1)n=o0;else{let s=e.includes('"'),o=e.includes("'");s&&!o?n=MA:o&&!s?n=o0:n=r?MA:o0}return n(e,t)}function w2({comment:e,type:t,value:r},n,s,o){let{blockQuote:i,commentString:a,lineWidth:u}=n.options;if(!i||/\n[\t ]+$/.test(r))return Rd(r,n);let l=n.indent||(n.forceBlockIndent||E2(r)?" ":""),f=i==="literal"?!0:i==="folded"||t===Ye.BLOCK_FOLDED?!1:t===Ye.BLOCK_LITERAL?!0:!TZ(r,u,l.length);if(!r)return f?`|
|
||
`:`>
|
||
`;let m,p;for(p=r.length;p>0;--p){let D=r[p-1];if(D!==`
|
||
`&&D!==" "&&D!==" ")break}let d=r.substring(p),v=d.indexOf(`
|
||
`);v===-1?m="-":r===d||v!==d.length-1?(m="+",o&&o()):m="",d&&(r=r.slice(0,-d.length),d[d.length-1]===`
|
||
`&&(d=d.slice(0,-1)),d=d.replace(qA,`$&${l}`));let g=!1,y,w=-1;for(y=0;y<r.length;++y){let D=r[y];if(D===" ")g=!0;else if(D===`
|
||
`)w=y;else break}let E=r.substring(0,w<y?w+1:y);E&&(r=r.substring(E.length),E=E.replace(/\n+/g,`$&${l}`));let C=(g?l?"2":"1":"")+m;if(e&&(C+=" "+a(e.replace(/ ?[\r\n]+/g," ")),s&&s()),!f){let D=r.replace(/\n+/g,`
|
||
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),H=!1,K=y2(n,!0);i!=="folded"&&t!==Ye.BLOCK_FOLDED&&(K.onOverflow=()=>{H=!0});let _=i0(`${E}${D}${d}`,l,v2,K);if(!H)return`>${C}
|
||
${l}${_}`}return r=r.replace(/\n+/g,`$&${l}`),`|${C}
|
||
${l}${E}${r}${d}`}function kZ(e,t,r,n){let{type:s,value:o}=e,{actualString:i,implicitKey:a,indent:u,indentStep:l,inFlow:f}=t;if(a&&o.includes(`
|
||
`)||f&&/[[\]{},]/.test(o))return Rd(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||f||!o.includes(`
|
||
`)?Rd(o,t):w2(e,t,r,n);if(!a&&!f&&s!==Ye.PLAIN&&o.includes(`
|
||
`))return w2(e,t,r,n);if(E2(o)){if(u==="")return t.forceBlockIndent=!0,w2(e,t,r,n);if(a&&u===l)return Rd(o,t)}let m=o.replace(/\n+/g,`$&
|
||
${u}`);if(i){let p=g=>g.default&&g.tag!=="tag:yaml.org,2002:str"&&g.test?.test(m),{compat:d,tags:v}=t.doc.schema;if(v.some(p)||d?.some(p))return Rd(o,t)}return a?m:i0(m,u,HA,y2(t,!1))}function Kl(e,t,r,n){let{implicitKey:s,inFlow:o}=t,i=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==Ye.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value)&&(a=Ye.QUOTE_DOUBLE);let u=f=>{switch(f){case Ye.BLOCK_FOLDED:case Ye.BLOCK_LITERAL:return s||o?Rd(i.value,t):w2(i,t,r,n);case Ye.QUOTE_DOUBLE:return o0(i.value,t);case Ye.QUOTE_SINGLE:return MA(i.value,t);case Ye.PLAIN:return kZ(i,t,r,n);default:return null}},l=u(a);if(l===null){let{defaultKeyType:f,defaultStringType:m}=t.options,p=s&&f||m;if(l=u(p),l===null)throw new Error(`Unsupported default string type ${p}`)}return l}var f1e,y2,E2,qA,a0=re(()=>{f1e=F(I(),1);Wr();h$();y2=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),E2=e=>/^(%|---|\.\.\.)/m.test(e);try{qA=new RegExp(`(^|(?<!
|
||
))
|
||
+(?!
|
||
|$)`,"g")}catch{qA=/\n+(?!\n|$)/g}});function b2(e,t){let r=Object.assign({blockQuote:!0,commentString:f$,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function PZ(e,t){if(t.tag){let s=e.filter(o=>o.tag===t.tag);if(s.length>0)return s.find(o=>o.format===t.format)??s[0]}let r,n;if(At(t)){n=t.value;let s=e.filter(o=>o.identify?.(n));if(s.length>1){let o=s.filter(i=>i.test);o.length>0&&(s=o)}r=s.find(o=>o.format===t.format)??s.find(o=>!o.format)}else n=t,r=e.find(s=>s.nodeClass&&n instanceof s.nodeClass);if(!r){let s=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${s} value`)}return r}function OZ(e,t,{anchors:r,doc:n}){if(!n.directives)return"";let s=[],o=(At(e)||rr(e))&&e.anchor;o&&f2(o)&&(r.add(o),s.push(`&${o}`));let i=e.tag??(t.default?null:t.tag);return i&&s.push(n.directives.tagString(i)),s.join(" ")}function hu(e,t,r,n){if(Ht(e))return e.toString(t,r,n);if(Gs(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let s,o=Kt(e)?e:t.doc.createNode(e,{onTagObj:u=>s=u});s??(s=PZ(t.doc.schema.tags,o));let i=OZ(o,s,t);i.length>0&&(t.indentAtStart=(t.indentAtStart??0)+i.length+1);let a=typeof s.stringify=="function"?s.stringify(o,t,r,n):At(o)?Kl(o,t,r,n):o.toString(t,r,n);return i?At(o)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
|
||
${t.indent}${a}`:a}var v1e,u0=re(()=>{v1e=F(I(),1);d2();Vt();n0();a0()});function p$({key:e,value:t},r,n,s){let{allNullValues:o,doc:i,indent:a,indentStep:u,options:{commentString:l,indentSeq:f,simpleKeys:m}}=r,p=Kt(e)&&e.comment||null;if(m){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(rr(e)||!Kt(e)&&typeof e=="object"){let K="With simple keys, collection cannot be used as a key value";throw new Error(K)}}let d=!m&&(!e||p&&t==null&&!r.inFlow||rr(e)||(At(e)?e.type===Ye.BLOCK_FOLDED||e.type===Ye.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!d&&(m||!o),indent:a+u});let v=!1,g=!1,y=hu(e,r,()=>v=!0,()=>g=!0);if(!d&&!r.inFlow&&y.length>1024){if(m)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(r.inFlow){if(o||t==null)return v&&n&&n(),y===""?"?":d?`? ${y}`:y}else if(o&&!m||t==null&&d)return y=`? ${y}`,p&&!v?y+=fa(y,r.indent,l(p)):g&&s&&s(),y;v&&(p=null),d?(p&&(y+=fa(y,r.indent,l(p))),y=`? ${y}
|
||
${a}:`):(y=`${y}:`,p&&(y+=fa(y,r.indent,l(p))));let w,E,S;Kt(t)?(w=!!t.spaceBefore,E=t.commentBefore,S=t.comment):(w=!1,E=null,S=null,t&&typeof t=="object"&&(t=i.createNode(t))),r.implicitKey=!1,!d&&!p&&At(t)&&(r.indentAtStart=y.length+1),g=!1,!f&&u.length>=2&&!r.inFlow&&!d&&mi(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let C=!1,D=hu(t,r,()=>C=!0,()=>g=!0),H=" ";if(p||w||E){if(H=w?`
|
||
`:"",E){let K=l(E);H+=`
|
||
${Mi(K,r.indent)}`}D===""&&!r.inFlow?H===`
|
||
`&&S&&(H=`
|
||
|
||
`):H+=`
|
||
${r.indent}`}else if(!d&&rr(t)){let K=D[0],_=D.indexOf(`
|
||
`),x=_!==-1,j=r.inFlow??t.flow??t.items.length===0;if(x||!j){let U=!1;if(x&&(K==="&"||K==="!")){let k=D.indexOf(" ");K==="&"&&k!==-1&&k<_&&D[k+1]==="!"&&(k=D.indexOf(" ",k+1)),(k===-1||_<k)&&(U=!0)}U||(H=`
|
||
${r.indent}`)}}else(D===""||D[0]===`
|
||
`)&&(H="");return y+=H+D,r.inFlow?C&&n&&n():S&&!C?y+=fa(y,r.indent,l(S)):g&&s&&s(),y}var S1e,m$=re(()=>{S1e=F(I(),1);Vt();Wr();u0();n0()});function A2(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var C1e,jA=re(()=>{C1e=F(I(),1)});function VA(e,t,r){let n=v$(e,r);if(mi(n))for(let s of n.items)KA(e,t,s);else if(Array.isArray(n))for(let s of n)KA(e,t,s);else KA(e,t,n)}function KA(e,t,r){let n=v$(e,r);if(!wo(n))throw new Error("Merge sources must be maps or map aliases");let s=n.toJSON(null,e,Map);for(let[o,i]of s)t instanceof Map?t.has(o)||t.set(o,i):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:i,writable:!0,enumerable:!0,configurable:!0});return t}function v$(e,t){return e&&Gs(t)?t.resolve(e.doc,e):t}var I1e,S2,yo,g$,_2=re(()=>{I1e=F(I(),1);Vt();Wr();S2="<<",yo={identify:e=>e===S2||typeof e=="symbol"&&e.description===S2,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ye(Symbol(S2)),{addToJSMap:VA}),stringify:()=>S2},g$=(e,t)=>(yo.identify(t)||At(t)&&(!t.type||t.type===Ye.PLAIN)&&yo.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===yo.tag&&r.default)});function C2(e,t,{key:r,value:n}){if(Kt(r)&&r.addToJSMap)r.addToJSMap(e,t,n);else if(g$(e,r))VA(e,t,n);else{let s=sn(r,"",e);if(t instanceof Map)t.set(s,sn(n,s,e));else if(t instanceof Set)t.add(s);else{let o=NZ(r,s,e),i=sn(n,o,e);o in t?Object.defineProperty(t,o,{value:i,writable:!0,enumerable:!0,configurable:!0}):t[o]=i}}return t}function NZ(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(Kt(e)&&r?.doc){let n=b2(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let s=e.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(s);o.length>40&&(o=o.substring(0,36)+'..."'),A2(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return s}return JSON.stringify(t)}var O1e,GA=re(()=>{O1e=F(I(),1);jA();_2();u0();Vt();Cc()});function Td(e,t,r){let n=du(e,void 0,r),s=du(t,void 0,r);return new $r(n,s)}var q1e,$r,Fc=re(()=>{q1e=F(I(),1);t0();m$();GA();Vt();$r=class e{constructor(t,r=null){Object.defineProperty(this,bs,{value:PA}),this.key=t,this.value=r}clone(t){let{key:r,value:n}=this;return Kt(r)&&(r=r.clone(t)),Kt(n)&&(n=n.clone(t)),new e(r,n)}toJSON(t,r){let n=r?.mapAsMap?new Map:{};return C2(r,n,this)}toString(t,r,n){return t?.doc?p$(this,t,r,n):JSON.stringify(this)}}});function F2(e,t,r){return(t.inFlow??e.flow?UZ:LZ)(e,t,r)}function LZ({comment:e,items:t},r,{blockItemPrefix:n,flowChars:s,itemIndent:o,onChompKeep:i,onComment:a}){let{indent:u,options:{commentString:l}}=r,f=Object.assign({},r,{indent:o,type:null}),m=!1,p=[];for(let v=0;v<t.length;++v){let g=t[v],y=null;if(Kt(g))!m&&g.spaceBefore&&p.push(""),D2(r,p,g.commentBefore,m),g.comment&&(y=g.comment);else if(Ht(g)){let E=Kt(g.key)?g.key:null;E&&(!m&&E.spaceBefore&&p.push(""),D2(r,p,E.commentBefore,m))}m=!1;let w=hu(g,f,()=>y=null,()=>m=!0);y&&(w+=fa(w,o,l(y))),m&&y&&(m=!1),p.push(n+w)}let d;if(p.length===0)d=s.start+s.end;else{d=p[0];for(let v=1;v<p.length;++v){let g=p[v];d+=g?`
|
||
${u}${g}`:`
|
||
`}}return e?(d+=`
|
||
`+Mi(l(e),u),a&&a()):m&&i&&i(),d}function UZ({items:e},t,{flowChars:r,itemIndent:n}){let{indent:s,indentStep:o,flowCollectionPadding:i,options:{commentString:a}}=t;n+=o;let u=Object.assign({},t,{indent:n,inFlow:!0,type:null}),l=!1,f=0,m=[];for(let v=0;v<e.length;++v){let g=e[v],y=null;if(Kt(g))g.spaceBefore&&m.push(""),D2(t,m,g.commentBefore,!1),g.comment&&(y=g.comment);else if(Ht(g)){let E=Kt(g.key)?g.key:null;E&&(E.spaceBefore&&m.push(""),D2(t,m,E.commentBefore,!1),E.comment&&(l=!0));let S=Kt(g.value)?g.value:null;S?(S.comment&&(y=S.comment),S.commentBefore&&(l=!0)):g.value==null&&E?.comment&&(y=E.comment)}y&&(l=!0);let w=hu(g,u,()=>y=null);l||(l=m.length>f||w.includes(`
|
||
`)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=m.reduce((E,S)=>E+S.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),y&&(w+=fa(w,n,a(y))),m.push(w),f=m.length}let{start:p,end:d}=r;if(m.length===0)return p+d;if(!l){let v=m.reduce((g,y)=>g+y.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=p;for(let g of m)v+=g?`
|
||
${o}${s}${g}`:`
|
||
`;return`${v}
|
||
${s}${d}`}else return`${p}${i}${m.join(" ")}${i}${d}`}function D2({indent:e,options:{commentString:t}},r,n,s){if(n&&s&&(n=n.replace(/^\n+/,"")),n){let o=Mi(t(n),e);r.push(o.trimStart())}}var z1e,zA=re(()=>{z1e=F(I(),1);Vt();u0();n0()});function Bc(e,t){let r=At(t)?t.value:t;for(let n of e)if(Ht(n)&&(n.key===t||n.key===r||At(n.key)&&n.key.value===r))return n}var tme,qr,Ic=re(()=>{tme=F(I(),1);zA();GA();g2();Vt();Fc();Wr();qr=class extends $d{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(go,t),this.items=[]}static from(t,r,n){let{keepUndefined:s,replacer:o}=n,i=new this(t),a=(u,l)=>{if(typeof o=="function")l=o.call(r,u,l);else if(Array.isArray(o)&&!o.includes(u))return;(l!==void 0||s)&&i.items.push(Td(u,l,n))};if(r instanceof Map)for(let[u,l]of r)a(u,l);else if(r&&typeof r=="object")for(let u of Object.keys(r))a(u,r[u]);return typeof t.sortMapEntries=="function"&&i.items.sort(t.sortMapEntries),i}add(t,r){let n;Ht(t)?n=t:!t||typeof t!="object"||!("key"in t)?n=new $r(t,t?.value):n=new $r(t.key,t.value);let s=Bc(this.items,n.key),o=this.schema?.sortMapEntries;if(s){if(!r)throw new Error(`Key ${n.key} already set`);At(s.value)&&m2(n.value)?s.value.value=n.value:s.value=n.value}else if(o){let i=this.items.findIndex(a=>o(n,a)<0);i===-1?this.items.push(n):this.items.splice(i,0,n)}else this.items.push(n)}delete(t){let r=Bc(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let s=Bc(this.items,t)?.value;return(!r&&At(s)?s.value:s)??void 0}has(t){return!!Bc(this.items,t)}set(t,r){this.add(new $r(t,r),!0)}toJSON(t,r,n){let s=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(s);for(let o of this.items)C2(r,s,o);return s}toString(t,r,n){if(!t)return JSON.stringify(this);for(let s of this.items)if(!Ht(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),F2(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:n,onComment:r})}}});var ime,Eo,kd=re(()=>{ime=F(I(),1);Vt();Ic();Eo={collection:"map",default:!0,nodeClass:qr,tag:"tag:yaml.org,2002:map",resolve(e,t){return wo(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>qr.from(e,t,r)}});function B2(e){let t=At(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var hme,ns,$c=re(()=>{hme=F(I(),1);t0();zA();g2();Vt();Wr();Cc();ns=class extends $d{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(lu,t),this.items=[]}add(t){this.items.push(t)}delete(t){let r=B2(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let n=B2(t);if(typeof n!="number")return;let s=this.items[n];return!r&&At(s)?s.value:s}has(t){let r=B2(t);return typeof r=="number"&&r<this.items.length}set(t,r){let n=B2(t);if(typeof n!="number")throw new Error(`Expected a valid index, not ${t}.`);let s=this.items[n];At(s)&&m2(r)?s.value=r:this.items[n]=r}toJSON(t,r){let n=[];r?.onCreate&&r.onCreate(n);let s=0;for(let o of this.items)n.push(sn(o,String(s++),r));return n}toString(t,r,n){return t?F2(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(t,r,n){let{replacer:s}=n,o=new this(t);if(r&&Symbol.iterator in Object(r)){let i=0;for(let a of r){if(typeof s=="function"){let u=r instanceof Set?a:String(i++);a=s.call(r,u,a)}o.items.push(du(a,void 0,n))}}return o}}});var vme,bo,Pd=re(()=>{vme=F(I(),1);Vt();$c();bo={collection:"seq",default:!0,nodeClass:ns,tag:"tag:yaml.org,2002:seq",resolve(e,t){return mi(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>ns.from(e,t,r)}});var Eme,xc,c0=re(()=>{Eme=F(I(),1);a0();xc={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,r,n){return t=Object.assign({actualString:!0},t),Kl(e,t,r,n)}}});var Sme,Vl,I2=re(()=>{Sme=F(I(),1);Wr();Vl={identify:e=>e==null,createNode:()=>new Ye(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ye(null),stringify:({source:e},t)=>typeof e=="string"&&Vl.test.test(e)?e:t.options.nullStr}});var Dme,l0,YA=re(()=>{Dme=F(I(),1);Wr();l0={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Ye(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&l0.test.test(e)){let n=e[0]==="t"||e[0]==="T";if(t===n)return e}return t?r.options.trueStr:r.options.falseStr}}});function ss({format:e,minFractionDigits:t,tag:r,value:n}){if(typeof n=="bigint")return String(n);let s=typeof n=="number"?n:Number(n);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let i=o.indexOf(".");i<0&&(i=o.length,o+=".");let a=t-(o.length-i-1);for(;a-- >0;)o+="0"}return o}var Bme,Od=re(()=>{Bme=F(I(),1)});var Rme,$2,x2,R2,WA=re(()=>{Rme=F(I(),1);Wr();Od();$2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ss},x2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ss(e)}},R2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Ye(parseFloat(e)),r=e.indexOf(".");return r!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-r-1),t},stringify:ss}});function w$(e,t,r){let{value:n}=e;return T2(n)&&n>=0?r+n.toString(t):ss(e)}var Pme,T2,XA,k2,P2,O2,JA=re(()=>{Pme=F(I(),1);Od();T2=e=>typeof e=="bigint"||Number.isInteger(e),XA=(e,t,r,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),r);k2={identify:e=>T2(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>XA(e,2,8,r),stringify:e=>w$(e,8,"0o")},P2={identify:T2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>XA(e,0,10,r),stringify:ss},O2={identify:e=>T2(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>XA(e,2,16,r),stringify:e=>w$(e,16,"0x")}});var Kme,y$,E$=re(()=>{Kme=F(I(),1);kd();I2();Pd();c0();YA();WA();JA();y$=[Eo,bo,xc,Vl,l0,k2,P2,O2,$2,x2,R2]});function b$(e){return typeof e=="bigint"||Number.isInteger(e)}var Wme,N2,HZ,MZ,A$,S$=re(()=>{Wme=F(I(),1);Wr();kd();Pd();N2=({value:e})=>JSON.stringify(e),HZ=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:N2},{identify:e=>e==null,createNode:()=>new Ye(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:N2},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:N2},{identify:b$,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>b$(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:N2}],MZ={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},A$=[Eo,bo].concat(HZ,MZ)});var Qme,f0,ZA=re(()=>{Qme=F(I(),1);Wr();a0();f0={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){let r=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let s=0;s<r.length;++s)n[s]=r.charCodeAt(s);return n}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},n,s,o){if(!r)return"";let i=r,a;if(typeof btoa=="function"){let u="";for(let l=0;l<i.length;++l)u+=String.fromCharCode(i[l]);a=btoa(u)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Ye.BLOCK_LITERAL),t!==Ye.QUOTE_DOUBLE){let u=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/u),f=new Array(l);for(let m=0,p=0;m<l;++m,p+=u)f[m]=a.substr(p,u);a=f.join(t===Ye.BLOCK_LITERAL?`
|
||
`:" ")}return Kl({comment:e,type:t,value:a},n,s,o)}}});function QA(e,t){if(mi(e))for(let r=0;r<e.items.length;++r){let n=e.items[r];if(!Ht(n)){if(wo(n)){n.items.length>1&&t("Each pair must have its own sequence indicator");let s=n.items[0]||new $r(new Ye(null));if(n.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${n.commentBefore}
|
||
${s.key.commentBefore}`:n.commentBefore),n.comment){let o=s.value??s.key;o.comment=o.comment?`${n.comment}
|
||
${o.comment}`:n.comment}n=s}e.items[r]=Ht(n)?n:new $r(n)}}else t("Expected a sequence for this tag");return e}function eS(e,t,r){let{replacer:n}=r,s=new ns(e);s.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let i of t){typeof n=="function"&&(i=n.call(t,String(o++),i));let a,u;if(Array.isArray(i))if(i.length===2)a=i[0],u=i[1];else throw new TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let l=Object.keys(i);if(l.length===1)a=l[0],u=i[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=i;s.items.push(Td(a,u,r))}return s}var ige,d0,L2=re(()=>{ige=F(I(),1);Vt();Fc();Wr();$c();d0={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:QA,createNode:eS}});var dge,Nd,h0,tS=re(()=>{dge=F(I(),1);Vt();Cc();Ic();$c();L2();Nd=class e extends ns{constructor(){super(),this.add=qr.prototype.add.bind(this),this.delete=qr.prototype.delete.bind(this),this.get=qr.prototype.get.bind(this),this.has=qr.prototype.has.bind(this),this.set=qr.prototype.set.bind(this),this.tag=e.tag}toJSON(t,r){if(!r)return super.toJSON(t);let n=new Map;r?.onCreate&&r.onCreate(n);for(let s of this.items){let o,i;if(Ht(s)?(o=sn(s.key,"",r),i=sn(s.value,o,r)):o=sn(s,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,i)}return n}static from(t,r,n){let s=eS(t,r,n),o=new this;return o.items=s.items,o}};Nd.tag="tag:yaml.org,2002:omap";h0={collection:"seq",identify:e=>e instanceof Map,nodeClass:Nd,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=QA(e,t),n=[];for(let{key:s}of r.items)At(s)&&(n.includes(s.value)?t(`Ordered maps must not include duplicate keys: ${s.value}`):n.push(s.value));return Object.assign(new Nd,r)},createNode:(e,t,r)=>Nd.from(e,t,r)}});function _$({value:e,source:t},r){return t&&(e?rS:nS).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var mge,rS,nS,C$=re(()=>{mge=F(I(),1);Wr();rS={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ye(!0),stringify:_$},nS={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ye(!1),stringify:_$}});var yge,D$,F$,B$,I$=re(()=>{yge=F(I(),1);Wr();Od();D$={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ss},F$={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():ss(e)}},B$={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Ye(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let n=e.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(t.minFractionDigits=n.length)}return t},stringify:ss}});function U2(e,t,r,{intAsBigInt:n}){let s=e[0];if((s==="-"||s==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),n){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let i=BigInt(e);return s==="-"?BigInt(-1)*i:i}let o=parseInt(e,r);return s==="-"?-1*o:o}function sS(e,t,r){let{value:n}=e;if(p0(n)){let s=n.toString(t);return n<0?"-"+r+s.substr(1):r+s}return ss(e)}var Age,p0,$$,x$,R$,T$,k$=re(()=>{Age=F(I(),1);Od();p0=e=>typeof e=="bigint"||Number.isInteger(e);$$={identify:p0,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>U2(e,2,2,r),stringify:e=>sS(e,2,"0b")},x$={identify:p0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>U2(e,1,8,r),stringify:e=>sS(e,8,"0")},R$={identify:p0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>U2(e,0,10,r),stringify:ss},T$={identify:p0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>U2(e,2,16,r),stringify:e=>sS(e,16,"0x")}});var Fge,Ld,m0,iS=re(()=>{Fge=F(I(),1);Vt();Fc();Ic();Ld=class e extends qr{constructor(t){super(t),this.tag=e.tag}add(t){let r;Ht(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new $r(t.key,null):r=new $r(t,null),Bc(this.items,r.key)||this.items.push(r)}get(t,r){let n=Bc(this.items,t);return!r&&Ht(n)?At(n.key)?n.key.value:n.key:n}set(t,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Bc(this.items,t);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new $r(t))}toJSON(t,r){return super.toJSON(t,r,Set)}toString(t,r,n){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(t,r,n){let{replacer:s}=n,o=new this(t);if(r&&Symbol.iterator in Object(r))for(let i of r)typeof s=="function"&&(i=s.call(r,i,i)),o.items.push(Td(i,null,n));return o}};Ld.tag="tag:yaml.org,2002:set";m0={collection:"map",identify:e=>e instanceof Set,nodeClass:Ld,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>Ld.from(e,t,r),resolve(e,t){if(wo(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ld,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}}});function oS(e,t){let r=e[0],n=r==="-"||r==="+"?e.substring(1):e,s=i=>t?BigInt(i):Number(i),o=n.replace(/_/g,"").split(":").reduce((i,a)=>i*s(60)+s(a),s(0));return r==="-"?s(-1)*o:o}function P$(e){let{value:t}=e,r=i=>i;if(typeof t=="bigint")r=i=>BigInt(i);else if(isNaN(t)||!isFinite(t))return ss(e);let n="";t<0&&(n="-",t*=r(-1));let s=r(60),o=[t%s];return t<60?o.unshift(0):(t=(t-o[0])/s,o.unshift(t%s),t>=60&&(t=(t-o[0])/s,o.unshift(t))),n+o.map(i=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var $ge,H2,M2,Ud,aS=re(()=>{$ge=F(I(),1);Od();H2={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>oS(e,r),stringify:P$},M2={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>oS(e,!1),stringify:P$},Ud={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Ud.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,s,o,i,a]=t.map(Number),u=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,s,o||0,i||0,a||0,u),f=t[8];if(f&&f!=="Z"){let m=oS(f,!1);Math.abs(m)<30&&(m*=60),l-=6e4*m}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""}});var Vge,uS,O$=re(()=>{Vge=F(I(),1);kd();I2();Pd();c0();ZA();C$();I$();k$();_2();tS();L2();iS();aS();uS=[Eo,bo,xc,Vl,rS,nS,$$,x$,R$,T$,D$,F$,B$,f0,yo,h0,d0,m0,H2,M2,Ud]});function q2(e,t,r){let n=N$.get(t);if(n&&!e)return r&&!n.includes(yo)?n.concat(yo):n.slice();let s=n;if(!s)if(Array.isArray(e))s=[];else{let o=Array.from(N$.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)s=s.concat(o);else typeof e=="function"&&(s=e(s.slice()));return r&&(s=s.concat(yo)),s.reduce((o,i)=>{let a=typeof i=="string"?L$[i]:i;if(!a){let u=JSON.stringify(i),l=Object.keys(L$).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${u}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}var c2e,N$,L$,U$,H$=re(()=>{c2e=F(I(),1);kd();I2();Pd();c0();YA();WA();JA();E$();S$();ZA();_2();tS();L2();O$();iS();aS();N$=new Map([["core",y$],["failsafe",[Eo,bo,xc]],["json",A$],["yaml11",uS],["yaml-1.1",uS]]),L$={binary:f0,bool:l0,float:R2,floatExp:x2,floatNaN:$2,floatTime:M2,int:P2,intHex:O2,intOct:k2,intTime:H2,map:Eo,merge:yo,null:Vl,omap:h0,pairs:d0,seq:bo,set:m0,timestamp:Ud},U$={"tag:yaml.org,2002:binary":f0,"tag:yaml.org,2002:merge":yo,"tag:yaml.org,2002:omap":h0,"tag:yaml.org,2002:pairs":d0,"tag:yaml.org,2002:set":m0,"tag:yaml.org,2002:timestamp":Ud}});var g2e,qZ,g0,cS=re(()=>{g2e=F(I(),1);Vt();kd();Pd();c0();H$();qZ=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,g0=class e{constructor({compat:t,customTags:r,merge:n,resolveKnownTags:s,schema:o,sortMapEntries:i,toStringDefaults:a}){this.compat=Array.isArray(t)?q2(t,"compat"):t?q2(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=s?U$:{},this.tags=q2(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,go,{value:Eo}),Object.defineProperty(this,pi,{value:xc}),Object.defineProperty(this,lu,{value:bo}),this.sortMapEntries=typeof i=="function"?i:i===!0?qZ:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}});function M$(e,t){let r=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let u=e.directives.toString(e);u?(r.push(u),n=!0):e.directives.docStart&&(n=!0)}n&&r.push("---");let s=b2(e,t),{commentString:o}=s.options;if(e.commentBefore){r.length!==1&&r.unshift("");let u=o(e.commentBefore);r.unshift(Mi(u,""))}let i=!1,a=null;if(e.contents){if(Kt(e.contents)){if(e.contents.spaceBefore&&n&&r.push(""),e.contents.commentBefore){let f=o(e.contents.commentBefore);r.push(Mi(f,""))}s.forceBlockIndent=!!e.comment,a=e.contents.comment}let u=a?void 0:()=>i=!0,l=hu(e.contents,s,()=>a=null,u);a&&(l+=fa(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(hu(e.contents,s));if(e.directives?.docEnd)if(e.comment){let u=o(e.comment);u.includes(`
|
||
`)?(r.push("..."),r.push(Mi(u,""))):r.push(`... ${u}`)}else r.push("...");else{let u=e.comment;u&&i&&(u=u.replace(/^\n+/,"")),u&&((!i||a)&&r[r.length-1]!==""&&r.push(""),r.push(Mi(o(u),"")))}return r.join(`
|
||
`)+`
|
||
`}var b2e,q$=re(()=>{b2e=F(I(),1);Vt();u0();n0()});function Hd(e){if(rr(e))return!0;throw new Error("Expected a YAML collection as document contents")}var k2e,pu,v0=re(()=>{k2e=F(I(),1);e0();g2();Vt();Fc();Cc();cS();q$();d2();UA();t0();OA();pu=class e{constructor(t,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,bs,{value:u2});let s=null;typeof r=="function"||Array.isArray(r)?s=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:i}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(i=this.directives.yaml.version)):this.directives=new la({version:i}),this.setSchema(i,n),this.contents=t===void 0?null:this.createNode(t,s,n)}clone(){let t=Object.create(e.prototype,{[bs]:{value:u2}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Kt(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Hd(this.contents)&&this.contents.add(t)}addIn(t,r){Hd(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let n=NA(this);t.anchor=!r||n.has(r)?LA(r||"a",n):r}return new fu(t.anchor)}createNode(t,r,n){let s;if(typeof r=="function")t=r.call({"":t},"",t),s=r;else if(Array.isArray(r)){let y=E=>typeof E=="number"||E instanceof String||E instanceof Number,w=r.filter(y).map(String);w.length>0&&(r=r.concat(w)),s=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:i,flow:a,keepUndefined:u,onTagObj:l,tag:f}=n??{},{onAnchor:m,setAnchors:p,sourceObjects:d}=l$(this,i||"a"),v={aliasDuplicateObjects:o??!0,keepUndefined:u??!1,onAnchor:m,onTagObj:l,replacer:s,schema:this.schema,sourceObjects:d},g=du(t,f,v);return a&&rr(g)&&(g.flow=!0),p(),g}createPair(t,r,n={}){let s=this.createNode(t,null,n),o=this.createNode(r,null,n);return new $r(s,o)}delete(t){return Hd(this.contents)?this.contents.delete(t):!1}deleteIn(t){return xd(t)?this.contents==null?!1:(this.contents=null,!0):Hd(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return rr(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return xd(t)?!r&&At(this.contents)?this.contents.value:this.contents:rr(this.contents)?this.contents.getIn(t,r):void 0}has(t){return rr(this.contents)?this.contents.has(t):!1}hasIn(t){return xd(t)?this.contents!==void 0:rr(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=r0(this.schema,[t],r):Hd(this.contents)&&this.contents.set(t,r)}setIn(t,r){xd(t)?this.contents=r:this.contents==null?this.contents=r0(this.schema,Array.from(t),r):Hd(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let n;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new la({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new la({version:t}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let s=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new g0(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:r,mapAsMap:n,maxAliasCount:s,onAnchor:o,reviver:i}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},u=sn(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:f}of a.anchors.values())o(f,l);return typeof i=="function"?_c(i,{"":u},"",u):u}toJSON(t,r){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:r})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let r=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return M$(this,t)}}});var O2e,w0,Ao,y0,lS,E0=re(()=>{O2e=F(I(),1),w0=class extends Error{constructor(t,r,n,s){super(),this.name=t,this.code=n,this.message=s,this.pos=r}},Ao=class extends w0{constructor(t,r,n){super("YAMLParseError",t,r,n)}},y0=class extends w0{constructor(t,r,n){super("YAMLWarning",t,r,n)}},lS=(e,t)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>t.linePos(a));let{line:n,col:s}=r.linePos[0];r.message+=` at line ${n}, column ${s}`;let o=s-1,i=e.substring(t.lineStarts[n-1],t.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&i.length>80){let a=Math.min(o-39,i.length-79);i="\u2026"+i.substring(a),o-=a-1}if(i.length>80&&(i=i.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(i.substring(0,o))){let a=e.substring(t.lineStarts[n-2],t.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
||
`),i=a+i}if(/[^ ]/.test(i)){let a=1,u=r.linePos[1];u?.line===n&&u.col>s&&(a=Math.max(1,Math.min(u.col-s,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`:
|
||
|
||
${i}
|
||
${l}
|
||
`}}});function da(e,{flow:t,indicator:r,next:n,offset:s,onError:o,parentIndent:i,startOnNewline:a}){let u=!1,l=a,f=a,m="",p="",d=!1,v=!1,g=null,y=null,w=null,E=null,S=null,C=null,D=null;for(let _ of e)switch(v&&(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma"&&o(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),g&&(l&&_.type!=="comment"&&_.type!=="newline"&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),_.type){case"space":!t&&(r!=="doc-start"||n?.type!=="flow-collection")&&_.source.includes(" ")&&(g=_),f=!0;break;case"comment":{f||o(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let x=_.source.substring(1)||" ";m?m+=p+x:m=x,p="",l=!1;break}case"newline":l?m?m+=_.source:(!C||r!=="seq-item-ind")&&(u=!0):p+=_.source,l=!0,d=!0,(y||w)&&(E=_),f=!0;break;case"anchor":y&&o(_,"MULTIPLE_ANCHORS","A node can have at most one anchor"),_.source.endsWith(":")&&o(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=_,D??(D=_.offset),l=!1,f=!1,v=!0;break;case"tag":{w&&o(_,"MULTIPLE_TAGS","A node can have at most one tag"),w=_,D??(D=_.offset),l=!1,f=!1,v=!0;break}case r:(y||w)&&o(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`),C&&o(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${t??"collection"}`),C=_,l=r==="seq-item-ind"||r==="explicit-key-ind",f=!1;break;case"comma":if(t){S&&o(_,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),S=_,l=!1,f=!1;break}default:o(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),l=!1,f=!1}let H=e[e.length-1],K=H?H.offset+H.source.length:s;return v&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(l&&g.indent<=i||n?.type==="block-map"||n?.type==="block-seq")&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:C,spaceBefore:u,comment:m,hasNewline:d,anchor:y,tag:w,newlineAfterProp:E,end:K,start:D??K}}var L2e,b0=re(()=>{L2e=F(I(),1)});function Rc(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
||
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(Rc(t.key)||Rc(t.value))return!0}return!1;default:return!0}}var H2e,j2=re(()=>{H2e=F(I(),1)});function A0(e,t,r){if(t?.type==="flow-collection"){let n=t.end[0];n.indent===e&&(n.source==="]"||n.source==="}")&&Rc(t)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}var j2e,fS=re(()=>{j2e=F(I(),1);j2()});function K2(e,t,r){let{uniqueKeys:n}=e.options;if(n===!1)return!1;let s=typeof n=="function"?n:(o,i)=>o===i||At(o)&&At(i)&&o.value===i.value;return t.some(o=>s(o.key,r))}var G2e,dS=re(()=>{G2e=F(I(),1);Vt()});function K$({composeNode:e,composeEmptyNode:t},r,n,s,o){let i=o?.nodeClass??qr,a=new i(r.schema);r.atRoot&&(r.atRoot=!1);let u=n.offset,l=null;for(let f of n.items){let{start:m,key:p,sep:d,value:v}=f,g=da(m,{indicator:"explicit-key-ind",next:p??d?.[0],offset:u,onError:s,parentIndent:n.indent,startOnNewline:!0}),y=!g.found;if(y){if(p&&(p.type==="block-seq"?s(u,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==n.indent&&s(u,"BAD_INDENT",j$)),!g.anchor&&!g.tag&&!d){l=g.end,g.comment&&(a.comment?a.comment+=`
|
||
`+g.comment:a.comment=g.comment);continue}(g.newlineAfterProp||Rc(p))&&s(p??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else g.found?.indent!==n.indent&&s(u,"BAD_INDENT",j$);r.atKey=!0;let w=g.end,E=p?e(r,p,g,s):t(r,w,m,null,g,s);r.schema.compat&&A0(n.indent,p,s),r.atKey=!1,K2(r,a.items,E)&&s(w,"DUPLICATE_KEY","Map keys must be unique");let S=da(d??[],{indicator:"map-value-ind",next:v,offset:E.range[2],onError:s,parentIndent:n.indent,startOnNewline:!p||p.type==="block-scalar"});if(u=S.end,S.found){y&&(v?.type==="block-map"&&!S.hasNewline&&s(u,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&g.start<S.found.offset-1024&&s(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=v?e(r,v,S,s):t(r,u,d,null,S,s);r.schema.compat&&A0(n.indent,v,s),u=C.range[2];let D=new $r(E,C);r.options.keepSourceTokens&&(D.srcToken=f),a.items.push(D)}else{y&&s(E.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(E.comment?E.comment+=`
|
||
`+S.comment:E.comment=S.comment);let C=new $r(E);r.options.keepSourceTokens&&(C.srcToken=f),a.items.push(C)}}return l&&l<u&&s(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,u,l??u],a}var eve,j$,V$=re(()=>{eve=F(I(),1);Fc();Ic();b0();j2();fS();dS();j$="All mapping items must start at the same column"});function G$({composeNode:e,composeEmptyNode:t},r,n,s,o){let i=o?.nodeClass??ns,a=new i(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let u=n.offset,l=null;for(let{start:f,value:m}of n.items){let p=da(f,{indicator:"seq-item-ind",next:m,offset:u,onError:s,parentIndent:n.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||m)m?.type==="block-seq"?s(p.end,"BAD_INDENT","All sequence items must start at the same column"):s(u,"MISSING_CHAR","Sequence item without - indicator");else{l=p.end,p.comment&&(a.comment=p.comment);continue}let d=m?e(r,m,p,s):t(r,p.end,f,null,p,s);r.schema.compat&&A0(n.indent,m,s),u=d.range[2],a.items.push(d)}return a.range=[n.offset,u,l??u],a}var ive,z$=re(()=>{ive=F(I(),1);$c();b0();fS()});function ha(e,t,r,n){let s="";if(e){let o=!1,i="";for(let a of e){let{source:u,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=u.substring(1)||" ";s?s+=i+f:s=f,i="";break}case"newline":s&&(i+=u),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=u.length}}return{comment:s,offset:t}}var ave,Md=re(()=>{ave=F(I(),1)});function Y$({composeNode:e,composeEmptyNode:t},r,n,s,o){let i=n.start.source==="{",a=i?"flow map":"flow sequence",u=o?.nodeClass??(i?qr:ns),l=new u(r.schema);l.flow=!0;let f=r.atRoot;f&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let m=n.offset+n.start.source.length;for(let y=0;y<n.items.length;++y){let w=n.items[y],{start:E,key:S,sep:C,value:D}=w,H=da(E,{flow:a,indicator:"explicit-key-ind",next:S??C?.[0],offset:m,onError:s,parentIndent:n.indent,startOnNewline:!1});if(!H.found){if(!H.anchor&&!H.tag&&!C&&!D){y===0&&H.comma?s(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<n.items.length-1&&s(H.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),H.comment&&(l.comment?l.comment+=`
|
||
`+H.comment:l.comment=H.comment),m=H.end;continue}!i&&r.options.strict&&Rc(S)&&s(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)H.comma&&s(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(H.comma||s(H.start,"MISSING_CHAR",`Missing , between ${a} items`),H.comment){let K="";e:for(let _ of E)switch(_.type){case"comma":case"space":break;case"comment":K=_.source.substring(1);break e;default:break e}if(K){let _=l.items[l.items.length-1];Ht(_)&&(_=_.value??_.key),_.comment?_.comment+=`
|
||
`+K:_.comment=K,H.comment=H.comment.substring(K.length+1)}}if(!i&&!C&&!H.found){let K=D?e(r,D,H,s):t(r,H.end,C,null,H,s);l.items.push(K),m=K.range[2],pS(D)&&s(K.range,"BLOCK_IN_FLOW",hS)}else{r.atKey=!0;let K=H.end,_=S?e(r,S,H,s):t(r,K,E,null,H,s);pS(S)&&s(_.range,"BLOCK_IN_FLOW",hS),r.atKey=!1;let x=da(C??[],{flow:a,indicator:"map-value-ind",next:D,offset:_.range[2],onError:s,parentIndent:n.indent,startOnNewline:!1});if(x.found){if(!i&&!H.found&&r.options.strict){if(C)for(let k of C){if(k===x.found)break;if(k.type==="newline"){s(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}H.start<x.found.offset-1024&&s(x.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else D&&("source"in D&&D.source?.[0]===":"?s(D,"MISSING_CHAR",`Missing space after : in ${a}`):s(x.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let j=D?e(r,D,x,s):x.found?t(r,x.end,C,null,x,s):null;j?pS(D)&&s(j.range,"BLOCK_IN_FLOW",hS):x.comment&&(_.comment?_.comment+=`
|
||
`+x.comment:_.comment=x.comment);let U=new $r(_,j);if(r.options.keepSourceTokens&&(U.srcToken=w),i){let k=l;K2(r,k.items,_)&&s(K,"DUPLICATE_KEY","Map keys must be unique"),k.items.push(U)}else{let k=new qr(r.schema);k.flow=!0,k.items.push(U);let N=(j??_).range;k.range=[_.range[0],N[1],N[2]],l.items.push(k)}m=j?j.range[2]:x.end}}let p=i?"}":"]",[d,...v]=n.end,g=m;if(d?.source===p)g=d.offset+d.source.length;else{let y=a[0].toUpperCase()+a.substring(1),w=f?`${y} must end with a ${p}`:`${y} in block collection must be sufficiently indented and end with a ${p}`;s(m,f?"MISSING_CHAR":"BAD_INDENT",w),d&&d.source.length!==1&&v.unshift(d)}if(v.length>0){let y=ha(v,g,r.options.strict,s);y.comment&&(l.comment?l.comment+=`
|
||
`+y.comment:l.comment=y.comment),l.range=[n.offset,g,y.offset]}else l.range=[n.offset,g,g];return l}var vve,hS,pS,W$=re(()=>{vve=F(I(),1);Vt();Fc();Ic();$c();Md();b0();j2();dS();hS="Block collections are not allowed within flow collections",pS=e=>e&&(e.type==="block-map"||e.type==="block-seq")});function mS(e,t,r,n,s,o){let i=r.type==="block-map"?K$(e,t,r,n,o):r.type==="block-seq"?G$(e,t,r,n,o):Y$(e,t,r,n,o),a=i.constructor;return s==="!"||s===a.tagName?(i.tag=a.tagName,i):(s&&(i.tag=s),i)}function X$(e,t,r,n,s){let o=n.tag,i=o?t.directives.tagName(o.source,p=>s(o,"TAG_RESOLVE_FAILED",p)):null;if(r.type==="block-seq"){let{anchor:p,newlineAfterProp:d}=n,v=p&&o?p.offset>o.offset?p:o:p??o;v&&(!d||d.offset<v.offset)&&s(v,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!i||i==="!"||i===qr.tagName&&a==="map"||i===ns.tagName&&a==="seq")return mS(e,t,r,s,i);let u=t.schema.tags.find(p=>p.tag===i&&p.collection===a);if(!u){let p=t.schema.knownTags[i];if(p?.collection===a)t.schema.tags.push(Object.assign({},p,{default:!1})),u=p;else return p?s(o,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):s(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),mS(e,t,r,s,i)}let l=mS(e,t,r,s,i,u),f=u.resolve?.(l,p=>s(o,"TAG_RESOLVE_FAILED",p),t.options)??l,m=Kt(f)?f:new Ye(f);return m.range=l.range,m.tag=i,u?.format&&(m.format=u.format),m}var Dve,J$=re(()=>{Dve=F(I(),1);Vt();Wr();Ic();$c();V$();z$();W$()});function gS(e,t,r){let n=t.offset,s=jZ(t,e.options.strict,r);if(!s)return{value:"",type:null,comment:"",range:[n,n,n]};let o=s.mode===">"?Ye.BLOCK_FOLDED:Ye.BLOCK_LITERAL,i=t.source?KZ(t.source):[],a=i.length;for(let g=i.length-1;g>=0;--g){let y=i[g][1];if(y===""||y==="\r")a=g;else break}if(a===0){let g=s.chomp==="+"&&i.length>0?`
|
||
`.repeat(Math.max(1,i.length-1)):"",y=n+s.length;return t.source&&(y+=t.source.length),{value:g,type:o,comment:s.comment,range:[n,y,y]}}let u=t.indent+s.indent,l=t.offset+s.length,f=0;for(let g=0;g<a;++g){let[y,w]=i[g];if(w===""||w==="\r")s.indent===0&&y.length>u&&(u=y.length);else{y.length<u&&r(l+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(u=y.length),f=g,u===0&&!e.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=y.length+w.length+1}for(let g=i.length-1;g>=a;--g)i[g][0].length>u&&(a=g+1);let m="",p="",d=!1;for(let g=0;g<f;++g)m+=i[g][0].slice(u)+`
|
||
`;for(let g=f;g<a;++g){let[y,w]=i[g];l+=y.length+w.length+1;let E=w[w.length-1]==="\r";if(E&&(w=w.slice(0,-1)),w&&y.length<u){let C=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;r(l-w.length-(E?2:1),"BAD_INDENT",C),y=""}o===Ye.BLOCK_LITERAL?(m+=p+y.slice(u)+w,p=`
|
||
`):y.length>u||w[0]===" "?(p===" "?p=`
|
||
`:!d&&p===`
|
||
`&&(p=`
|
||
|
||
`),m+=p+y.slice(u)+w,p=`
|
||
`,d=!0):w===""?p===`
|
||
`?m+=`
|
||
`:p=`
|
||
`:(m+=p+w,p=" ",d=!1)}switch(s.chomp){case"-":break;case"+":for(let g=a;g<i.length;++g)m+=`
|
||
`+i[g][0].slice(u);m[m.length-1]!==`
|
||
`&&(m+=`
|
||
`);break;default:m+=`
|
||
`}let v=n+s.length+t.source.length;return{value:m,type:o,comment:s.comment,range:[n,v,v]}}function jZ({offset:e,props:t},r,n){if(t[0].type!=="block-scalar-header")return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=t[0],o=s[0],i=0,a="",u=-1;for(let p=1;p<s.length;++p){let d=s[p];if(!a&&(d==="-"||d==="+"))a=d;else{let v=Number(d);!i&&v?i=v:u===-1&&(u=e+p)}}u!==-1&&n(u,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let l=!1,f="",m=s.length;for(let p=1;p<t.length;++p){let d=t[p];switch(d.type){case"space":l=!0;case"newline":m+=d.source.length;break;case"comment":r&&!l&&n(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=d.source.length,f=d.source.substring(1);break;case"error":n(d,"UNEXPECTED_TOKEN",d.message),m+=d.source.length;break;default:{let v=`Unexpected token in block scalar header: ${d.type}`;n(d,"UNEXPECTED_TOKEN",v);let g=d.source;g&&typeof g=="string"&&(m+=g.length)}}}return{mode:o,indent:i,chomp:a,comment:f,length:m}}function KZ(e){let t=e.split(/\n( *)/),r=t[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let i=1;i<t.length;i+=2)o.push([t[i],t[i+1]]);return o}var Ive,vS=re(()=>{Ive=F(I(),1);Wr()});function wS(e,t,r){let{offset:n,type:s,source:o,end:i}=e,a,u,l=(p,d,v)=>r(n+p,d,v);switch(s){case"scalar":a=Ye.PLAIN,u=VZ(o,l);break;case"single-quoted-scalar":a=Ye.QUOTE_SINGLE,u=GZ(o,l);break;case"double-quoted-scalar":a=Ye.QUOTE_DOUBLE,u=zZ(o,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let f=n+o.length,m=ha(i,f,t,r);return{value:u,type:a,comment:m.comment,range:[n,f,m.offset]}}function VZ(e,t){let r="";switch(e[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}return r&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),Z$(e)}function GZ(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Z$(e.slice(1,-1)).replace(/''/g,"'")}function Z$(e){let t,r;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
||
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
||
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=t.exec(e);if(!n)return e;let s=n[1],o=" ",i=t.lastIndex;for(r.lastIndex=i;n=r.exec(e);)n[1]===""?o===`
|
||
`?s+=o:o=`
|
||
`:(s+=o+n[1],o=" "),i=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=i,n=a.exec(e),s+o+(n?.[1]??"")}function zZ(e,t){let r="";for(let n=1;n<e.length-1;++n){let s=e[n];if(!(s==="\r"&&e[n+1]===`
|
||
`))if(s===`
|
||
`){let{fold:o,offset:i}=YZ(e,n);r+=o,n=i}else if(s==="\\"){let o=e[++n],i=WZ[o];if(i)r+=i;else if(o===`
|
||
`)for(o=e[n+1];o===" "||o===" ";)o=e[++n+1];else if(o==="\r"&&e[n+1]===`
|
||
`)for(o=e[++n+1];o===" "||o===" ";)o=e[++n+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=XZ(e,n+1,a,t),n+=a}else{let a=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(s===" "||s===" "){let o=n,i=e[n+1];for(;i===" "||i===" ";)i=e[++n+1];i!==`
|
||
`&&!(i==="\r"&&e[n+2]===`
|
||
`)&&(r+=n>o?e.slice(o,n+1):s)}else r+=s}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),r}function YZ(e,t){let r="",n=e[t+1];for(;(n===" "||n===" "||n===`
|
||
`||n==="\r")&&!(n==="\r"&&e[t+2]!==`
|
||
`);)n===`
|
||
`&&(r+=`
|
||
`),t+=1,n=e[t+1];return r||(r=" "),{fold:r,offset:t}}function XZ(e,t,r,n){let s=e.substr(t,r),i=s.length===r&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(i)}catch{let a=e.substr(t-2,r+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}var Tve,WZ,yS=re(()=>{Tve=F(I(),1);Wr();Md();WZ={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
||
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "}});function ES(e,t,r,n){let{value:s,type:o,comment:i,range:a}=t.type==="block-scalar"?gS(e,t,n):wS(t,e.options.strict,n),u=r?e.directives.tagName(r.source,m=>n(r,"TAG_RESOLVE_FAILED",m)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[pi]:u?l=JZ(e.schema,s,u,r,n):t.type==="scalar"?l=ZZ(e,s,t,n):l=e.schema[pi];let f;try{let m=l.resolve(s,p=>n(r??t,"TAG_RESOLVE_FAILED",p),e.options);f=At(m)?m:new Ye(m)}catch(m){let p=m instanceof Error?m.message:String(m);n(r??t,"TAG_RESOLVE_FAILED",p),f=new Ye(s)}return f.range=a,f.source=s,o&&(f.type=o),u&&(f.tag=u),l.format&&(f.format=l.format),i&&(f.comment=i),f}function JZ(e,t,r,n,s){if(r==="!")return e[pi];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let i=e.knownTags[r];return i&&!i.collection?(e.tags.push(Object.assign({},i,{default:!1,test:void 0})),i):(s(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[pi])}function ZZ({atKey:e,directives:t,schema:r},n,s,o){let i=r.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(n))||r[pi];if(r.compat){let a=r.compat.find(u=>u.default&&u.test?.test(n))??r[pi];if(i.tag!==a.tag){let u=t.tagString(i.tag),l=t.tagString(a.tag),f=`Value may be parsed as either ${u} or ${l}`;o(s,"TAG_RESOLVE_FAILED",f,!0)}}return i}var Uve,Q$=re(()=>{Uve=F(I(),1);Vt();Wr();vS();yS()});function e9(e,t,r){if(t){r??(r=t.length);for(let n=r-1;n>=0;--n){let s=t[n];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++n];s?.type==="space";)e+=s.source.length,s=t[++n];break}}return e}var Mve,t9=re(()=>{Mve=F(I(),1)});function bS(e,t,r,n){let s=e.atKey,{spaceBefore:o,comment:i,anchor:a,tag:u}=r,l,f=!0;switch(t.type){case"alias":l=eQ(e,t,n),(a||u)&&n(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=ES(e,t,u,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=X$(QZ,e,t,r,n),a&&(l.anchor=a.source.substring(1))}catch(m){let p=m instanceof Error?m.message:String(m);n(t,"RESOURCE_EXHAUSTION",p)}break;default:{let m=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;n(t,"UNEXPECTED_TOKEN",m),f=!1}}return l??(l=V2(e,t.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!At(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(u??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),i&&(t.type==="scalar"&&t.source===""?l.comment=i:l.commentBefore=i),e.options.keepSourceTokens&&f&&(l.srcToken=t),l}function V2(e,t,r,n,{spaceBefore:s,comment:o,anchor:i,tag:a,end:u},l){let f={type:"scalar",offset:e9(t,r,n),indent:-1,source:""},m=ES(e,f,a,l);return i&&(m.anchor=i.source.substring(1),m.anchor===""&&l(i,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(m.spaceBefore=!0),o&&(m.comment=o,m.range[2]=u),m}function eQ({options:e},{offset:t,source:r,end:n},s){let o=new fu(r.substring(1));o.source===""&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&s(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=t+r.length,a=ha(n,i,e.strict,s);return o.range=[t,i,a.offset],a.comment&&(o.comment=a.comment),o}var Wve,QZ,r9=re(()=>{Wve=F(I(),1);e0();Vt();J$();Q$();Md();t9();QZ={composeNode:bS,composeEmptyNode:V2}});function n9(e,t,{offset:r,start:n,value:s,end:o},i){let a=Object.assign({_directives:t},e),u=new pu(void 0,a),l={atKey:!1,atRoot:!0,directives:u.directives,options:u.options,schema:u.schema},f=da(n,{indicator:"doc-start",next:s??o?.[0],offset:r,onError:i,parentIndent:0,startOnNewline:!0});f.found&&(u.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!f.hasNewline&&i(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),u.contents=s?bS(l,s,f,i):V2(l,f.end,n,null,f,i);let m=u.contents.range[2],p=ha(o,m,!1,i);return p.comment&&(u.comment=p.comment),u.range=[r,m,p.offset],u}var twe,s9=re(()=>{twe=F(I(),1);v0();r9();Md();b0()});function S0(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r=="string"?r.length:1)]}function i9(e){let t="",r=!1,n=!1;for(let s=0;s<e.length;++s){let o=e[s];switch(o[0]){case"#":t+=(t===""?"":n?`
|
||
|
||
`:`
|
||
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":e[s+1]?.[0]!=="#"&&(s+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:t,afterEmptyLine:n}}var cwe,_0,AS=re(()=>{cwe=F(I(),1);OA();v0();E0();Vt();s9();Md();_0=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,s,o)=>{let i=S0(r);o?this.warnings.push(new y0(i,n,s)):this.errors.push(new Ao(i,n,s))},this.directives=new la({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:n,afterEmptyLine:s}=i9(this.prelude);if(n){let o=t.contents;if(r)t.comment=t.comment?`${t.comment}
|
||
${n}`:n;else if(s||t.directives.docStart||!o)t.commentBefore=n;else if(rr(o)&&!o.flow&&o.items.length>0){let i=o.items[0];Ht(i)&&(i=i.key);let a=i.commentBefore;i.commentBefore=a?`${n}
|
||
${a}`:n}else{let i=o.commentBefore;o.commentBefore=i?`${n}
|
||
${i}`:n}}if(r){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:i9(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,r=!1,n=-1){for(let s of t)yield*this.next(s);yield*this.end(r,n)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(r,n,s)=>{let o=S0(t);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,s)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=n9(this.options,this.directives,t,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let r=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,n=new Ao(S0(t),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Ao(S0(t),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=ha(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
||
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Ao(S0(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let n=Object.assign({_directives:this.directives},this.options),s=new pu(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,r,r],this.decorate(s,!1),yield s}}}});var mwe,o9=re(()=>{mwe=F(I(),1);vS();yS();E0();a0()});var vwe,a9=re(()=>{vwe=F(I(),1)});function Gl(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),c9(Object.freeze([]),e,t)}function c9(e,t,r){let n=r(t,e);if(typeof n=="symbol")return n;for(let s of["key","value"]){let o=t[s];if(o&&"items"in o){for(let i=0;i<o.items.length;++i){let a=c9(Object.freeze(e.concat([[s,i]])),o.items[i],r);if(typeof a=="number")i=a-1;else{if(a===SS)return SS;a===u9&&(o.items.splice(i,1),i-=1)}}typeof n=="function"&&s==="key"&&(n=n(t,e))}}return typeof n=="function"?n(t,e):n}var ywe,SS,tQ,u9,l9=re(()=>{ywe=F(I(),1),SS=Symbol("break visit"),tQ=Symbol("skip children"),u9=Symbol("remove item");Gl.BREAK=SS;Gl.SKIP=tQ;Gl.REMOVE=u9;Gl.itemAtPath=(e,t)=>{let r=e;for(let[n,s]of t){let o=r?.[n];if(o&&"items"in o)r=o.items[s];else return}return r};Gl.parentCollection=(e,t)=>{let r=Gl.itemAtPath(e,t.slice(0,-1)),n=t[t.length-1][0],s=r?.[n];if(s&&"items"in s)return s;throw new Error("Parent collection not found")}});function f9(e){switch(e){case _S:return"byte-order-mark";case CS:return"doc-mode";case DS:return"flow-error-end";case G2:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
||
`:case`\r
|
||
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}var _we,_S,CS,DS,G2,z2=re(()=>{_we=F(I(),1);o9();a9();l9();_S="\uFEFF",CS="",DS="",G2=""});function So(e){switch(e){case void 0:case" ":case`
|
||
`:case"\r":case" ":return!0;default:return!1}}var $we,d9,nQ,Y2,sQ,FS,C0,BS=re(()=>{$we=F(I(),1);z2();d9=new Set("0123456789ABCDEFabcdef"),nQ=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Y2=new Set(",[]{}"),sQ=new Set(` ,[]{}
|
||
\r `),FS=e=>!e||sQ.has(e),C0=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,r=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let t=this.pos,r=this.buffer[t];for(;r===" "||r===" ";)r=this.buffer[++t];return!r||r==="#"||r===`
|
||
`?!0:r==="\r"?this.buffer[t+1]===`
|
||
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let r=this.buffer[t];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+t];if(r==="\r"){let s=this.buffer[n+t+1];if(s===`
|
||
`||!s&&!this.atEnd)return t+n+1}return r===`
|
||
`||n>=this.indentNext||!r&&!this.atEnd?t+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(t,3);if((n==="---"||n==="...")&&So(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
||
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===_S&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let r=t.length,n=t.indexOf("#");for(;n!==-1;){let o=t[n-1];if(o===" "||o===" "){r=n-1;break}else n=t.indexOf("#",n+1)}for(;;){let o=t[r-1];if(o===" "||o===" ")r-=1;else break}let s=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-r),yield*this.pushNewline(),"stream"}return yield CS,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&So(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!So(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&So(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(t[r]){case"#":yield*this.pushCount(t.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(FS),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,r,n=-1;do t=yield*this.pushNewline(),t>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(t+r>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&s[0]!=="#"||n===0&&(s.startsWith("---")||s.startsWith("..."))&&So(s[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield DS,yield*this.parseLineStart();let o=0;for(;s[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),s[o]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(FS),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let i=this.charAt(1);if(this.flowKey||So(i)||i===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),r=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),s=n.indexOf(`
|
||
`,this.pos);if(s!==-1){for(;s!==-1;){let o=this.continueScalar(s+1);if(o===-1)break;s=n.indexOf(`
|
||
`,o)}s!==-1&&(r=s-(n[s-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let r=this.buffer[++t];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>So(r)||r==="#")}*parseBlockScalar(){let t=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case`
|
||
`:t=o,r=0;break;case"\r":{let i=this.buffer[o+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===`
|
||
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(t+1);if(o===-1)break;t=this.buffer.indexOf(`
|
||
`,o)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let s=t+1;for(n=this.buffer[s];n===" ";)n=this.buffer[++s];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
||
`;)n=this.buffer[++s];t=s-1}else if(!this.blockScalarKeep)do{let o=t-1,i=this.buffer[o];i==="\r"&&(i=this.buffer[--o]);let a=o;for(;i===" ";)i=this.buffer[--o];if(i===`
|
||
`&&o>=this.pos&&o+1+r>a)t=o;else break}while(!0);return yield G2,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,r=this.pos-1,n=this.pos-1,s;for(;s=this.buffer[++n];)if(s===":"){let o=this.buffer[n+1];if(So(o)||t&&Y2.has(o))break;r=n}else if(So(s)){let o=this.buffer[n+1];if(s==="\r"&&(o===`
|
||
`?(n+=1,s=`
|
||
`,o=this.buffer[n+1]):r=n),o==="#"||t&&Y2.has(o))break;if(s===`
|
||
`){let i=this.continueScalar(n+1);if(i===-1)break;n=Math.max(n,i-2)}}else{if(t&&Y2.has(s))break;r=n}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield G2,yield*this.pushToIndex(r+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,r){let n=this.buffer.slice(this.pos,t);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(FS),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(So(n)||r&&Y2.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,r=this.buffer[t];for(;!So(r)&&r!==">";)r=this.buffer[++t];return yield*this.pushToIndex(r===">"?t+1:t,!1)}else{let t=this.pos+1,r=this.buffer[t];for(;r;)if(nQ.has(r))r=this.buffer[++t];else if(r==="%"&&d9.has(this.buffer[t+1])&&d9.has(this.buffer[t+2]))r=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
||
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
||
`?yield*this.pushCount(2):0}*pushSpaces(t){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||t&&n===" ");let s=r-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=r),s}*pushUntil(t){let r=this.pos,n=this.buffer[r];for(;!t(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}}});var Rwe,D0,IS=re(()=>{Rwe=F(I(),1),D0=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let r=0,n=this.lineStarts.length;for(;r<n;){let o=r+n>>1;this.lineStarts[o]<t?r=o+1:n=o}if(this.lineStarts[r]===t)return{line:r+1,col:1};if(r===0)return{line:0,col:t};let s=this.lineStarts[r-1];return{line:r,col:t-s+1}}}}});function Tc(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function h9(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function m9(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function W2(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function qd(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function X2(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function p9(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Tc(t.start,"explicit-key-ind")&&!Tc(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,m9(t.value)?t.value.end?X2(t.value.end,t.sep):t.value.end=t.sep:X2(t.start,t.sep),delete t.sep)}var Owe,F0,$S=re(()=>{Owe=F(I(),1);z2();BS();F0=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new C0,this.onNewLine=t}*parse(t,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(t,r))yield*this.next(n);r||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let r=f9(t);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let n=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let r=t??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&p9(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let s=n.items[n.items.length-1];if(s.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=r;else{Object.assign(s,{key:r,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=n.items[n.items.length-1];s.value?n.items.push({start:[],value:r}):s.value=r;break}case"flow-collection":{let s=n.items[n.items.length-1];!s||s.value?n.items.push({start:[],key:r,sep:[]}):s.sep?s.value=r:Object.assign(s,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let s=r.items[r.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&h9(s.start)===-1&&(r.indent===0||s.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(n.type==="document"?n.end=s.start:n.items.push({start:s.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{h9(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let r=W2(this.peek(2)),n=qd(r),s;t.end?(s=t.end,s.push(this.sourceToken),delete t.end):s=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:n,key:t,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
||
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
||
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,t.indent)){let s=t.items[t.items.length-2]?.value?.end;if(Array.isArray(s)){X2(s,r.start),s.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let n=!this.onKeyLine&&this.indent===t.indent,s=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(s&&r.sep&&!r.value){let i=[];for(let a=0;a<r.sep.length;++a){let u=r.sep[a];switch(u.type){case"newline":i.push(a);break;case"space":break;case"comment":u.indent>t.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(o=r.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":s||r.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):s||r.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Tc(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(m9(r.key)&&!Tc(r.sep,"newline")){let i=qd(r.start),a=r.key,u=r.sep;u.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:a,sep:u}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Tc(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let i=qd(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||s?t.items.push({start:o,key:null,sep:[this.sourceToken]}):Tc(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);s||r.value?(t.items.push({start:o,key:i,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(i):(Object.assign(r,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{let i=this.startBlockValue(t);if(i){if(i.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Tc(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&t.items.push({start:o});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,t.indent)){let s=t.items[t.items.length-2]?.value?.end;if(Array.isArray(s)){X2(s,r.start),s.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=t.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;r.value||Tc(r.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>t.indent){let n=this.startBlockValue(t);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?t.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:s,sep:[]}):r.sep?this.stack.push(s):Object.assign(r,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===t.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let s=W2(n),o=qd(s);p9(t);let i=t.end.splice(1,t.end.length);i.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
|
||
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
||
`,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=W2(t),n=qd(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=W2(t),n=qd(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}});function iQ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new D0||null,prettyErrors:t}}function B0(e,t={}){let{lineCounter:r,prettyErrors:n}=iQ(t),s=new F0(r?.addNewLine),o=new _0(t),i=null;for(let a of o.compose(s.parse(e),!0,e.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new Ao(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(i.errors.forEach(lS(e,r)),i.warnings.forEach(lS(e,r))),i}function xS(e,t,r){let n;typeof t=="function"?n=t:r===void 0&&t&&typeof t=="object"&&(r=t);let s=B0(e,r);if(!s)return null;if(s.warnings.forEach(o=>A2(s.options.logLevel,o)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:n},r))}function RS(e,t,r){let n=null;if(typeof t=="function"||Array.isArray(t)?n=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(e===void 0){let{keepUndefined:s}=r??t??{};if(!s)return}return vo(e)&&!n?e.toString(r):new pu(e,n,r).toString(r)}var Vwe,g9=re(()=>{Vwe=F(I(),1);AS();v0();E0();jA();Vt();IS();$S()});var zwe,TS=re(()=>{zwe=F(I(),1);AS();v0();cS();E0();e0();Vt();Fc();Wr();Ic();$c();z2();BS();IS();$S();g9();Qp()});var lye,kS=re(()=>{lye=F(I(),1);TS();TS()});function w9(e,t,...r){try{return e(t,...r)}catch{return e(b9(e(t.replace(/!<str>\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function J2(e){return JSON.parse(JSON.stringify(e))}function uQ(e){return{...aQ,...e||{}}}function cQ(e={}){let{forceQuotes:t,lineWidth:r,noArrayIndent:n,noRefs:s,quotingType:o,sortKeys:i,...a}=e||{},u={...a};return typeof r=="number"&&(u.lineWidth=r<=0?0:r),typeof n=="boolean"&&(u.indentSeq=!n),typeof s=="boolean"&&(u.aliasDuplicateObjects=!s),typeof i<"u"&&(u.sortMapEntries=i),o==="'"?u.singleQuote=!0:o==='"'&&(u.singleQuote=!1),t&&(u.defaultStringType=o==="'"?"QUOTE_SINGLE":"QUOTE_DOUBLE"),u}function y9(e,t){return xS(e,uQ(t))}function E9(e,t){return RS(e,cQ(t))}function jd(e,...t){return w9(y9,J2(e),...t)}function lQ(e,...t){return w9(y9,J2(e),...t)}function v9(e,...t){return E9(J2(e),...t)}function b9(e,...t){return E9(J2(e),...t)}var pye,aQ,gi,zl=re(()=>{pye=F(I());kS();aQ={logLevel:"error",merge:!0};gi={safeLoad:jd,load:lQ,safeDump:v9,dump:b9,parse:jd,stringify:v9}});function PS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function jr(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new RangeError(`${r}expected integer >= 0, got ${e}`)}}function In(e,t,r=""){let n=PS(e),s=e?.length,o=t!==void 0;if(!n||o&&s!==t){let i=r&&`"${r}" `,a=o?` of length ${t}`:"",u=n?`length=${s}`:`type=${typeof e}`,l=i+"expected Uint8Array"+a+", got "+u;throw n?new RangeError(l):new TypeError(l)}return e}function gu(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(jr(e.outputLen),jr(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Kd(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Z2(e,t){In(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function Q2(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function As(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Vd(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function _o(e,t){return e<<32-t|e>>>t}function Yt(e,t){return e<<t|e>>>32-t>>>0}function dQ(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function hQ(e){for(let t=0;t<e.length;t++)e[t]=dQ(e[t]);return e}function ev(e){if(In(e),S9)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=pQ[e[r]];return t}function A9(e){if(e>=mu._0&&e<=mu._9)return e-mu._0;if(e>=mu.A&&e<=mu.F)return e-(mu.A-10);if(e>=mu.a&&e<=mu.f)return e-(mu.a-10)}function I0(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(S9)try{return Uint8Array.fromHex(e)}catch(s){throw s instanceof SyntaxError?new RangeError(s.message):s}let t=e.length,r=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let s=0,o=0;s<r;s++,o+=2){let i=A9(e.charCodeAt(o)),a=A9(e.charCodeAt(o+1));if(i===void 0||a===void 0){let u=e[o]+e[o+1];throw new RangeError('hex string expected, got non-hex character "'+u+'" at index '+o)}n[s]=i*16+a}return n}function mQ(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function NS(e,t=""){return typeof e=="string"?mQ(e):In(e,void 0,t)}function LS(...e){let t=0;for(let n=0;n<e.length;n++){let s=e[n];In(s),t+=s.length}let r=new Uint8Array(t);for(let n=0,s=0;n<e.length;n++){let o=e[n];r.set(o,s),s+=o.length}return r}function tv(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new TypeError("options must be object or undefined");return Object.assign(e,t)}function US(e,t={}){let r=(s,o)=>e(o).update(s).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=s=>e(s),Object.assign(r,t),Object.freeze(r)}function pa(e=32){jr(e,"bytesLength");let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var gye,fQ,OS,S9,pQ,mu,HS,qi=re(()=>{gye=F(I(),1);fQ=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;OS=fQ?e=>e:hQ,S9=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",pQ=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));mu={_0:48,_9:57,A:65,F:70,a:97,f:102};HS=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])})});var yye,rv,ma,$0=re(()=>{yye=F(I(),1);qi();rv=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if(gu(t),In(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),As(s)}update(t){return Kd(this),this.iHash.update(t),this}digestInto(t){Kd(this),Z2(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:s,destroyed:o,blockLen:i,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=o,t.blockLen=i,t.outputLen=a,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},ma=(()=>{let e=((t,r,n)=>new rv(t,r).update(n).digest());return e.create=(t,r)=>new rv(t,r),e})()});function x0(e,t,r){return gu(e),r===void 0&&(r=new Uint8Array(e.outputLen)),ma(e,r,t)}function qS(e,t,r,n=32){gu(e),jr(n,"length"),In(t,void 0,"prk");let s=e.outputLen;if(t.length<s)throw new Error('"prk" must be at least HashLen octets');if(n>255*s)throw new Error("Length must be <= 255*HashLen");let o=Math.ceil(n/s);r===void 0?r=_9:In(r,void 0,"info");let i=new Uint8Array(o*s),a=ma.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let f=0;f<o;f++)MS[0]=f+1,u.update(f===0?_9:l).update(r).update(MS).digestInto(l),i.set(l,s*f),a._cloneInto(u);return a.destroy(),u.destroy(),As(l,MS),i.slice(0,n)}var Sye,MS,_9,kc,jS=re(()=>{Sye=F(I(),1);$0();qi();MS=Uint8Array.of(0),_9=Uint8Array.of();kc=(e,t,r,n,s)=>qS(e,x0(e,t,r),n,s)});function C9(e,t,r){return e&t^~e&r}function D9(e,t,r){return e&t^e&r^t&r}var Dye,R0,vu,$n,F9=re(()=>{Dye=F(I(),1);qi();R0=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,s){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=s,this.buffer=new Uint8Array(t),this.view=Vd(this.buffer)}update(t){Kd(this),In(t);let{view:r,buffer:n,blockLen:s}=this,o=t.length;for(let i=0;i<o;){let a=Math.min(s-this.pos,o-i);if(a===s){let u=Vd(t);for(;s<=o-i;i+=s)this.process(u,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Kd(this),Z2(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:s,isLE:o}=this,{pos:i}=this;r[i++]=128,As(this.buffer.subarray(i)),this.padOffset>s-i&&(this.process(n,0),i=0);for(let m=i;m<s;m++)r[m]=0;n.setBigUint64(s-8,BigInt(this.length*8),o),this.process(n,0);let a=Vd(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=u/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)a.setUint32(4*m,f[m],o)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:r,buffer:n,length:s,finished:o,destroyed:i,pos:a}=this;return t.destroyed=i,t.finished=o,t.length=s,t.pos=a,s%r&&t.buffer.set(n),t}clone(){return this._cloneInto()}},vu=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),$n=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function gQ(e,t=!1){return t?{h:Number(e&nv),l:Number(e>>B9&nv)}:{h:Number(e>>B9&nv)|0,l:Number(e&nv)|0}}function I9(e,t=!1){let r=e.length,n=new Uint32Array(r),s=new Uint32Array(r);for(let o=0;o<r;o++){let{h:i,l:a}=gQ(e[o],t);[n[o],s[o]]=[i,a]}return[n,s]}function ga(e,t,r,n){let s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:s|0}}var Fye,nv,B9,KS,VS,Yl,Wl,T0,k0,$9,x9,R9,T9,k9,P9,O9=re(()=>{Fye=F(I(),1),nv=BigInt(4294967295),B9=BigInt(32);KS=(e,t,r)=>e>>>r,VS=(e,t,r)=>e<<32-r|t>>>r,Yl=(e,t,r)=>e>>>r|t<<32-r,Wl=(e,t,r)=>e<<32-r|t>>>r,T0=(e,t,r)=>e<<64-r|t>>>r-32,k0=(e,t,r)=>e>>>r-32|t<<64-r;$9=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),x9=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,R9=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),T9=(e,t,r,n,s)=>t+r+n+s+(e/2**32|0)|0,k9=(e,t,r,n,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(s>>>0),P9=(e,t,r,n,s,o)=>t+r+n+s+o+(e/2**32|0)|0});var Tye,wQ,Pc,GS,zS,N9,yQ,EQ,Oc,Nc,YS,WS,Kr,sv,Gd=re(()=>{Tye=F(I(),1);F9();O9();qi();wQ=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Pc=new Uint32Array(64),GS=class extends R0{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:r,C:n,D:s,E:o,F:i,G:a,H:u}=this;return[t,r,n,s,o,i,a,u]}set(t,r,n,s,o,i,a,u){this.A=t|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=o|0,this.F=i|0,this.G=a|0,this.H=u|0}process(t,r){for(let m=0;m<16;m++,r+=4)Pc[m]=t.getUint32(r,!1);for(let m=16;m<64;m++){let p=Pc[m-15],d=Pc[m-2],v=_o(p,7)^_o(p,18)^p>>>3,g=_o(d,17)^_o(d,19)^d>>>10;Pc[m]=g+Pc[m-7]+v+Pc[m-16]|0}let{A:n,B:s,C:o,D:i,E:a,F:u,G:l,H:f}=this;for(let m=0;m<64;m++){let p=_o(a,6)^_o(a,11)^_o(a,25),d=f+p+C9(a,u,l)+wQ[m]+Pc[m]|0,g=(_o(n,2)^_o(n,13)^_o(n,22))+D9(n,s,o)|0;f=l,l=u,u=a,a=i+d|0,i=o,o=s,s=n,n=d+g|0}n=n+this.A|0,s=s+this.B|0,o=o+this.C|0,i=i+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(n,s,o,i,a,u,l,f)}roundClean(){As(Pc)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),As(this.buffer)}},zS=class extends GS{A=vu[0]|0;B=vu[1]|0;C=vu[2]|0;D=vu[3]|0;E=vu[4]|0;F=vu[5]|0;G=vu[6]|0;H=vu[7]|0;constructor(){super(32)}},N9=I9(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),yQ=N9[0],EQ=N9[1],Oc=new Uint32Array(80),Nc=new Uint32Array(80),YS=class extends R0{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:r,Bh:n,Bl:s,Ch:o,Cl:i,Dh:a,Dl:u,Eh:l,El:f,Fh:m,Fl:p,Gh:d,Gl:v,Hh:g,Hl:y}=this;return[t,r,n,s,o,i,a,u,l,f,m,p,d,v,g,y]}set(t,r,n,s,o,i,a,u,l,f,m,p,d,v,g,y){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=s|0,this.Ch=o|0,this.Cl=i|0,this.Dh=a|0,this.Dl=u|0,this.Eh=l|0,this.El=f|0,this.Fh=m|0,this.Fl=p|0,this.Gh=d|0,this.Gl=v|0,this.Hh=g|0,this.Hl=y|0}process(t,r){for(let S=0;S<16;S++,r+=4)Oc[S]=t.getUint32(r),Nc[S]=t.getUint32(r+=4);for(let S=16;S<80;S++){let C=Oc[S-15]|0,D=Nc[S-15]|0,H=Yl(C,D,1)^Yl(C,D,8)^KS(C,D,7),K=Wl(C,D,1)^Wl(C,D,8)^VS(C,D,7),_=Oc[S-2]|0,x=Nc[S-2]|0,j=Yl(_,x,19)^T0(_,x,61)^KS(_,x,6),U=Wl(_,x,19)^k0(_,x,61)^VS(_,x,6),k=R9(K,U,Nc[S-7],Nc[S-16]),N=T9(k,H,j,Oc[S-7],Oc[S-16]);Oc[S]=N|0,Nc[S]=k|0}let{Ah:n,Al:s,Bh:o,Bl:i,Ch:a,Cl:u,Dh:l,Dl:f,Eh:m,El:p,Fh:d,Fl:v,Gh:g,Gl:y,Hh:w,Hl:E}=this;for(let S=0;S<80;S++){let C=Yl(m,p,14)^Yl(m,p,18)^T0(m,p,41),D=Wl(m,p,14)^Wl(m,p,18)^k0(m,p,41),H=m&d^~m&g,K=p&v^~p&y,_=k9(E,D,K,EQ[S],Nc[S]),x=P9(_,w,C,H,yQ[S],Oc[S]),j=_|0,U=Yl(n,s,28)^T0(n,s,34)^T0(n,s,39),k=Wl(n,s,28)^k0(n,s,34)^k0(n,s,39),N=n&o^n&a^o&a,O=s&i^s&u^i&u;w=g|0,E=y|0,g=d|0,y=v|0,d=m|0,v=p|0,{h:m,l:p}=ga(l|0,f|0,x|0,j|0),l=a|0,f=u|0,a=o|0,u=i|0,o=n|0,i=s|0;let L=$9(j,k,O);n=x9(L,x,U,N),s=L|0}({h:n,l:s}=ga(this.Ah|0,this.Al|0,n|0,s|0)),{h:o,l:i}=ga(this.Bh|0,this.Bl|0,o|0,i|0),{h:a,l:u}=ga(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:f}=ga(this.Dh|0,this.Dl|0,l|0,f|0),{h:m,l:p}=ga(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=ga(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=ga(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=ga(this.Hh|0,this.Hl|0,w|0,E|0),this.set(n,s,o,i,a,u,l,f,m,p,d,v,g,y,w,E)}roundClean(){As(Oc,Nc)}destroy(){this.destroyed=!0,As(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},WS=class extends YS{Ah=$n[0]|0;Al=$n[1]|0;Bh=$n[2]|0;Bl=$n[3]|0;Ch=$n[4]|0;Cl=$n[5]|0;Dh=$n[6]|0;Dl=$n[7]|0;Eh=$n[8]|0;El=$n[9]|0;Fh=$n[10]|0;Fl=$n[11]|0;Gh=$n[12]|0;Gl=$n[13]|0;Hh=$n[14]|0;Hl=$n[15]|0;constructor(){super(64)}},Kr=US(()=>new zS,HS(1)),sv=US(()=>new WS,HS(3))});function QS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function bQ(e){if(!QS(e))throw new TypeError("Uint8Array expected")}function M9(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(r=>typeof r=="string"):t.every(r=>Number.isSafeInteger(r)):!1}function AQ(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function Xl(e,t){if(typeof t!="string")throw new TypeError(`${e}: string expected`);return!0}function e_(e){if(typeof e!="number")throw new TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function XS(e){if(!Array.isArray(e))throw new TypeError("array expected")}function ov(e,t){if(!M9(!0,t))throw new TypeError(`${e}: array of strings expected`)}function q9(e,t){if(!M9(!1,t))throw new TypeError(`${e}: array of numbers expected`)}function t_(...e){let t=o=>o,r=(o,i)=>a=>o(i(a)),n=e.map(o=>o.encode).reduceRight(r,t),s=e.map(o=>o.decode).reduce(r,t);return{encode:n,decode:s}}function r_(e){let t=typeof e=="string"?e.split(""):e,r=t.length;ov("alphabet",t);let n=new Map(t.map((s,o)=>[s,o]));return{encode:s=>(XS(s),s.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:s=>(XS(s),s.map(o=>{Xl("alphabet.decode",o);let i=n.get(o);if(i===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return i}))}}function n_(e=""){return Xl("join",e),{encode:t=>(ov("join.decode",t),t.join(e)),decode:t=>(Xl("join.decode",t),t.split(e))}}function SQ(e,t="="){return e_(e),Xl("padding",t),{encode(r){for(ov("padding.encode",r);r.length*e%8;)r.push(t);return r},decode(r){ov("padding.decode",r);let n=r.length;if(n*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if((n-1)*e%8===0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,n)}}}function JS(e,t,r,n){if(XS(e),t<=0||t>32)throw new RangeError(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new RangeError(`convertRadix2: wrong to=${r}`);if(av(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${av(t,r)}`);let s=0,o=0,i=iv[t],a=iv[r]-1,u=[];for(let l of e){if(e_(l),l>=i)throw new Error(`convertRadix2: invalid data word=${l} from=${t}`);if(s=s<<t|l,o+t>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=r;o-=r)u.push((s>>o-r&a)>>>0);let f=iv[o];if(f===void 0)throw new Error("invalid carry");s&=f-1}if(s=s<<r-o&a,!n&&o>=t)throw new Error("Excess padding");if(!n&&s>0)throw new Error(`Non-zero padding: ${s}`);return n&&o>0&&u.push(s>>>0),u}function s_(e,t=!1){if(e_(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(av(8,e)>32||av(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:r=>{if(!QS(r))throw new TypeError("radix2.encode input should be Uint8Array");return JS(Array.from(r),8,e,!t)},decode:r=>(q9("radix2.decode",r),Uint8Array.from(JS(r,e,8,t)))}}function L9(e){return AQ(e),function(...t){try{return e.apply(null,t)}catch{}}}function P0(e){let t=e>>25,r=(e&33554431)<<5;for(let n=0;n<U9.length;n++)(t>>n&1)===1&&(r^=U9[n]);return r}function H9(e,t,r=1){let n=e.length,s=1;for(let o=0;o<n;o++){let i=e.charCodeAt(o);if(i<33||i>126)throw new Error(`Invalid prefix (${e})`);s=P0(s)^i>>5}s=P0(s);for(let o=0;o<n;o++)s=P0(s)^e.charCodeAt(o)&31;for(let o of t)s=P0(s)^o;for(let o=0;o<6;o++)s=P0(s);return s^=r,ZS.encode(JS([s%iv[30]],30,5,!1))}function FQ(e){let t=e==="bech32"?1:734539939,r=s_(5),n=r.decode,s=r.encode,o=L9(n);function i(m,p,d=90){Xl("bech32.encode prefix",m),QS(p)&&(p=Array.from(p)),q9("bech32.encode",p);let v=m.length;if(v===0)throw new TypeError(`Invalid prefix length ${v}`);let g=v+7+p.length;if(d!==!1&&g>d)throw new TypeError(`Length ${g} exceeds limit ${d}`);let y=m.toLowerCase(),w=H9(y,p,t);return`${y}1${ZS.encode(p)}${w}`}function a(m,p=90){Xl("bech32.decode input",m);let d=m.length;if(d<8||p!==!1&&d>p)throw new TypeError(`invalid string length: ${d} (${m}). Expected (8..${p})`);let v=m.toLowerCase();if(m!==v&&m!==m.toUpperCase())throw new Error("String must be lowercase or uppercase");let g=v.lastIndexOf("1");if(g===0||g===-1)throw new Error('Letter "1" must be present between prefix and data only');let y=v.slice(0,g),w=v.slice(g+1);if(w.length<6)throw new Error("Data must be at least 6 characters long");let E=ZS.decode(w).slice(0,-6),S=H9(y,E,t);if(!w.endsWith(S))throw new Error(`Invalid checksum in ${m}: expected "${S}"`);return{prefix:y,words:E}}let u=L9(a);function l(m){let{prefix:p,words:d}=a(m,!1);return{prefix:p,words:d,bytes:n(d)}}function f(m,p){return i(m,s(p))}return{encode:i,decode:a,encodeFromBytes:f,decodeToBytes:l,decodeUnsafe:u,fromWords:n,fromWordsUnsafe:o,toWords:s}}var Pye,j9,av,iv,_Q,CQ,DQ,i_,is,ZS,U9,Ws,O0=re(()=>{Pye=F(I(),1);j9=(e,t)=>t===0?e:j9(t,e%t),av=(e,t)=>e+(t-j9(e,t)),iv=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();_Q=typeof Uint8Array.from([]).toBase64=="function"&&typeof Uint8Array.fromBase64=="function",CQ=/[\t\n\f\r ]/,DQ=(e,t)=>{Xl("base64",e);let r=t?"base64url":"base64";if(e.length>0&&CQ.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},i_=Object.freeze(_Q?{encode(e){return bQ(e),e.toBase64()},decode(e){return DQ(e,!1)}}:t_(s_(6),r_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),SQ(6),n_(""))),is=Object.freeze(t_(s_(6),r_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),n_(""))),ZS=t_(r_("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),n_("")),U9=[996825010,642813549,513874426,1027748829,705979059];Ws=Object.freeze(FQ("bech32"))});function IQ(e,t,r,n){gu(e);let s=tv({dkLen:32,asyncTick:10},n),{c:o,dkLen:i,asyncTick:a}=s;if(jr(o,"c"),jr(i,"dkLen"),jr(a,"asyncTick"),o<1)throw new Error("iterations (c) must be >= 1");if(i<1)throw new Error('"dkLen" must be >= 1');if(i>(2**32-1)*e.outputLen)throw new Error("derived key too long");let u=NS(t,"password"),l=NS(r,"salt"),f=new Uint8Array(i),m=ma.create(e,u),p=m._cloneInto().update(l);return{c:o,dkLen:i,asyncTick:a,DK:f,PRF:m,PRFSalt:p}}function $Q(e,t,r,n,s){return e.destroy(),t.destroy(),n&&n.destroy(),As(s),r}function o_(e,t,r,n){let{c:s,dkLen:o,DK:i,PRF:a,PRFSalt:u}=IQ(e,t,r,n),l,f=new Uint8Array(4),m=Vd(f),p=new Uint8Array(a.outputLen);for(let d=1,v=0;v<o;d++,v+=a.outputLen){let g=i.subarray(v,v+a.outputLen);m.setInt32(0,d,!1),(l=u._cloneInto(l)).update(f).digestInto(p),g.set(p.subarray(0,g.length));for(let y=1;y<s;y++){a._cloneInto(l).update(p).digestInto(p);for(let w=0;w<g.length;w++)g[w]^=p[w]}}return $Q(a,u,i,l,p)}var Uye,K9=re(()=>{Uye=F(I(),1);$0();qi()});function V9(e,t,r,n,s,o){let i=e[t++]^r[n++],a=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],f=e[t++]^r[n++],m=e[t++]^r[n++],p=e[t++]^r[n++],d=e[t++]^r[n++],v=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],w=e[t++]^r[n++],E=e[t++]^r[n++],S=e[t++]^r[n++],C=e[t++]^r[n++],D=e[t++]^r[n++],H=i,K=a,_=u,x=l,j=f,U=m,k=p,N=d,O=v,L=g,T=y,M=w,W=E,G=S,J=C,te=D;for(let ie=0;ie<8;ie+=2)j^=Yt(H+W|0,7),O^=Yt(j+H|0,9),W^=Yt(O+j|0,13),H^=Yt(W+O|0,18),L^=Yt(U+K|0,7),G^=Yt(L+U|0,9),K^=Yt(G+L|0,13),U^=Yt(K+G|0,18),J^=Yt(T+k|0,7),_^=Yt(J+T|0,9),k^=Yt(_+J|0,13),T^=Yt(k+_|0,18),x^=Yt(te+M|0,7),N^=Yt(x+te|0,9),M^=Yt(N+x|0,13),te^=Yt(M+N|0,18),K^=Yt(H+x|0,7),_^=Yt(K+H|0,9),x^=Yt(_+K|0,13),H^=Yt(x+_|0,18),k^=Yt(U+j|0,7),N^=Yt(k+U|0,9),j^=Yt(N+k|0,13),U^=Yt(j+N|0,18),M^=Yt(T+L|0,7),O^=Yt(M+T|0,9),L^=Yt(O+M|0,13),T^=Yt(L+O|0,18),W^=Yt(te+J|0,7),G^=Yt(W+te|0,9),J^=Yt(G+W|0,13),te^=Yt(J+G|0,18);s[o++]=i+H|0,s[o++]=a+K|0,s[o++]=u+_|0,s[o++]=l+x|0,s[o++]=f+j|0,s[o++]=m+U|0,s[o++]=p+k|0,s[o++]=d+N|0,s[o++]=v+O|0,s[o++]=g+L|0,s[o++]=y+T|0,s[o++]=w+M|0,s[o++]=E+W|0,s[o++]=S+G|0,s[o++]=C+J|0,s[o++]=D+te|0}function a_(e,t,r,n,s){let o=n+0,i=n+16*s;for(let a=0;a<16;a++)r[i+a]=e[t+(2*s-1)*16+a];for(let a=0;a<s;a++,o+=16,t+=16)V9(r,i,e,t,r,o),a>0&&(i+=16),V9(r,o,e,t+=16,r,i)}function xQ(e,t,r){let n=tv({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:s,r:o,p:i,dkLen:a,asyncTick:u,maxmem:l,onProgress:f}=n;if(jr(s,"N"),jr(o,"r"),jr(i,"p"),jr(a,"dkLen"),jr(u,"asyncTick"),jr(l,"maxmem"),f!==void 0&&typeof f!="function")throw new Error("progressCb must be a function");let m=128*o,p=m/4,d=Math.pow(2,32);if(s<=1||(s&s-1)!==0||s>d)throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');if(i<1||i>(d-1)*32/m)throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');if(a<1||a>(d-1)*32)throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32');let v=m*(s+i+1);if(v>l)throw new Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))='+v+", maxmem="+l);let g=o_(Kr,e,t,{c:1,dkLen:m*i}),y=Q2(g),w=Q2(new Uint8Array(m*s)),E=Q2(new Uint8Array(m)),S=()=>{};if(f){let C=2*s*i,D=Math.max(Math.floor(C/1e4),1),H=0;S=()=>{H++,f&&(!(H%D)||H===C)&&f(H/C)}}return{N:s,r:o,p:i,dkLen:a,blockSize32:p,V:w,B32:y,B:g,tmp:E,blockMixCb:S,asyncTick:u}}function RQ(e,t,r,n,s){let o=o_(Kr,e,r,{c:1,dkLen:t});return As(r,n,s),o}function u_(e,t,r){let{N:n,r:s,p:o,dkLen:i,blockSize32:a,V:u,B32:l,B:f,tmp:m,blockMixCb:p}=xQ(e,t,r);OS(l);for(let d=0;d<o;d++){let v=a*d;for(let g=0;g<a;g++)u[g]=l[v+g];for(let g=0,y=0;g<n-1;g++)a_(u,y,u,y+=a,s),p();a_(u,(n-1)*a,l,v,s),p();for(let g=0;g<n;g++){let y=(l[v+a-16]&n-1)>>>0;for(let w=0;w<a;w++)m[w]=l[v+w]^u[y*a+w];a_(m,0,l,v,s),p()}}return OS(l),RQ(e,i,f,u,m)}var Kye,G9=re(()=>{Kye=F(I(),1);K9();Gd();qi()});function TQ(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function uv(e){if(typeof e!="boolean")throw new TypeError(`boolean expected, not ${e}`)}function zd(e){if(typeof e!="number")throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError("positive integer expected, got "+e)}function on(e,t,r=""){let n=TQ(e),s=e?.length,o=t!==void 0;if(!n||o&&s!==t){let i=r&&`"${r}" `,a=o?` of length ${t}`:"",u=n?`length=${s}`:`type=${typeof e}`,l=i+"expected Uint8Array"+a+", got "+u;throw n?new RangeError(l):new TypeError(l)}return e}function c_(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function z9(e,t,r=!1){on(e,void 0,"output");let n=t.outputLen;if(e.length<n)throw new RangeError("digestInto() expects output buffer of length at least "+n);if(r&&!Yd(e))throw new Error("invalid output, must be aligned")}function va(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Co(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function kQ(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Y9(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function W9(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function X9(e,t,r){let n=t,s=r||(()=>[]),o=(a,u)=>n(u,...s(a)).update(a).digest(),i=n(new Uint8Array(e),...s(new Uint8Array(0)));return o.outputLen=i.outputLen,o.blockLen=i.blockLen,o.create=(a,...u)=>n(a,...u),o}function N0(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if(on(t,void 0,"output"),t.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(r&&!Yd(t))throw new Error("invalid output, must be aligned");return t}function Z9(e,t,r){zd(e),zd(t),uv(r);let n=new Uint8Array(16),s=kQ(n);return s.setBigUint64(0,BigInt(t),r),s.setBigUint64(8,BigInt(e),r),n}function Yd(e){return e.byteOffset%4===0}function Wd(e){return Uint8Array.from(on(e))}var Gye,Jl,PQ,OQ,wu,J9,cv=re(()=>{Gye=F(I(),1);Jl=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,PQ=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,OQ=e=>{for(let t=0;t<e.length;t++)e[t]=PQ(e[t]);return e},wu=Jl?e=>e:OQ;J9=(e,t)=>{function r(n,...s){if(on(n,void 0,"key"),e.nonceLength!==void 0){let f=s[0];on(f,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let o=e.tagLength;o&&s[1]!==void 0&&on(s[1],void 0,"AAD");let i=t(n,...s),a=(f,m)=>{if(m!==void 0){if(f!==2)throw new Error("cipher output not supported");on(m,void 0,"output")}},u=!1;return{encrypt(f,m){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,on(f),a(i.encrypt.length,m),i.encrypt(f,m)},decrypt(f,m){if(on(f),o&&f.length<o)throw new Error('"ciphertext" expected length bigger than tagLength='+o);return a(i.decrypt.length,m),i.decrypt(f,m)}}}return Object.assign(r,e),r}});function Wt(e,t){return e<<t|e>>>32-t}function HQ(e,t,r,n,s,o,i,a){let u=s.length,l=new Uint8Array(L0),f=va(l),m=Jl&&Yd(s)&&Yd(o),p=m?va(s):Q9,d=m?va(o):Q9;if(!Jl){for(let v=0;v<u;i++){if(e(t,r,n,f,i,a),wu(f),i>=l_)throw new Error("arx: counter overflow");let g=Math.min(L0,u-v);for(let y=0,w;y<g;y++)w=v+y,o[w]=s[w]^l[y];v+=g}return}for(let v=0;v<u;i++){if(e(t,r,n,f,i,a),i>=l_)throw new Error("arx: counter overflow");let g=Math.min(L0,u-v);if(m&&g===L0){let y=v/4;if(v%4!==0)throw new Error("arx: invalid block position");for(let w=0,E;w<UQ;w++)E=y+w,d[E]=p[E]^f[w];v+=L0;continue}for(let y=0,w;y<g;y++)w=v+y,o[w]=s[w]^l[y];v+=g}}function tx(e,t){let{allowShortKeys:r,extendNonceFn:n,counterLength:s,counterRight:o,rounds:i}=Y9({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return zd(s),zd(i),uv(o),uv(r),(a,u,l,f,m=0)=>{on(a,void 0,"key"),on(u,void 0,"nonce"),on(l,void 0,"data");let p=l.length;if(f=N0(p,f,!1),zd(m),m<0||m>=l_)throw new Error("arx: counter overflow");let d=[],v=a.length,g,y;if(v===32)d.push(g=Wd(a)),y=LQ;else if(v===16&&r)g=new Uint8Array(32),g.set(a),g.set(a,16),y=NQ,d.push(g);else throw on(a,32,"arx key"),new Error("invalid key size");(!Jl||!Yd(u))&&d.push(u=Wd(u));let w=va(g);if(n){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let C=u.subarray(0,16);if(Jl)n(y,w,va(C),w);else{let D=wu(Uint32Array.from(y));n(D,w,va(C),w),Co(D),wu(w)}u=u.subarray(16)}else Jl||wu(w);let E=16-s;if(E!==u.length)throw new Error(`arx: nonce must be ${E} or 16 bytes`);if(E!==12){let C=new Uint8Array(12);C.set(u,o?0:12-u.length),u=C,d.push(u)}let S=wu(va(u));try{return HQ(e,y,w,S,l,f,m,i),f}finally{Co(...d)}}}var Xye,ex,NQ,LQ,L0,UQ,l_,Q9,rx=re(()=>{Xye=F(I(),1);cv();ex=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),NQ=wu(va(ex("expand 16-byte k"))),LQ=wu(va(ex("expand 32-byte k")));L0=64,UQ=16,l_=2**32-1,Q9=Uint32Array.of()});function xn(e,t){return e[t++]&255|(e[t++]&255)<<8}var nEe,f_,nx,sx=re(()=>{nEe=F(I(),1);cv();f_=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(t){t=Wd(on(t,32,"key"));let r=xn(t,0),n=xn(t,2),s=xn(t,4),o=xn(t,6),i=xn(t,8),a=xn(t,10),u=xn(t,12),l=xn(t,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|s<<6)&7939,this.r[3]=(s>>>7|o<<9)&8191,this.r[4]=(o>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|a<<2)&8191,this.r[7]=(a>>>11|u<<5)&8065,this.r[8]=(u>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let f=0;f<8;f++)this.pad[f]=xn(t,16+2*f)}process(t,r,n=!1){let s=n?0:2048,{h:o,r:i}=this,a=i[0],u=i[1],l=i[2],f=i[3],m=i[4],p=i[5],d=i[6],v=i[7],g=i[8],y=i[9],w=xn(t,r+0),E=xn(t,r+2),S=xn(t,r+4),C=xn(t,r+6),D=xn(t,r+8),H=xn(t,r+10),K=xn(t,r+12),_=xn(t,r+14),x=o[0]+(w&8191),j=o[1]+((w>>>13|E<<3)&8191),U=o[2]+((E>>>10|S<<6)&8191),k=o[3]+((S>>>7|C<<9)&8191),N=o[4]+((C>>>4|D<<12)&8191),O=o[5]+(D>>>1&8191),L=o[6]+((D>>>14|H<<2)&8191),T=o[7]+((H>>>11|K<<5)&8191),M=o[8]+((K>>>8|_<<8)&8191),W=o[9]+(_>>>5|s),G=0,J=G+x*a+j*(5*y)+U*(5*g)+k*(5*v)+N*(5*d);G=J>>>13,J&=8191,J+=O*(5*p)+L*(5*m)+T*(5*f)+M*(5*l)+W*(5*u),G+=J>>>13,J&=8191;let te=G+x*u+j*a+U*(5*y)+k*(5*g)+N*(5*v);G=te>>>13,te&=8191,te+=O*(5*d)+L*(5*p)+T*(5*m)+M*(5*f)+W*(5*l),G+=te>>>13,te&=8191;let ie=G+x*l+j*u+U*a+k*(5*y)+N*(5*g);G=ie>>>13,ie&=8191,ie+=O*(5*v)+L*(5*d)+T*(5*p)+M*(5*m)+W*(5*f),G+=ie>>>13,ie&=8191;let ge=G+x*f+j*l+U*u+k*a+N*(5*y);G=ge>>>13,ge&=8191,ge+=O*(5*g)+L*(5*v)+T*(5*d)+M*(5*p)+W*(5*m),G+=ge>>>13,ge&=8191;let he=G+x*m+j*f+U*l+k*u+N*a;G=he>>>13,he&=8191,he+=O*(5*y)+L*(5*g)+T*(5*v)+M*(5*d)+W*(5*p),G+=he>>>13,he&=8191;let Fe=G+x*p+j*m+U*f+k*l+N*u;G=Fe>>>13,Fe&=8191,Fe+=O*a+L*(5*y)+T*(5*g)+M*(5*v)+W*(5*d),G+=Fe>>>13,Fe&=8191;let ke=G+x*d+j*p+U*m+k*f+N*l;G=ke>>>13,ke&=8191,ke+=O*u+L*a+T*(5*y)+M*(5*g)+W*(5*v),G+=ke>>>13,ke&=8191;let $e=G+x*v+j*d+U*p+k*m+N*f;G=$e>>>13,$e&=8191,$e+=O*l+L*u+T*a+M*(5*y)+W*(5*g),G+=$e>>>13,$e&=8191;let oe=G+x*g+j*v+U*d+k*p+N*m;G=oe>>>13,oe&=8191,oe+=O*f+L*l+T*u+M*a+W*(5*y),G+=oe>>>13,oe&=8191;let me=G+x*y+j*g+U*v+k*d+N*p;G=me>>>13,me&=8191,me+=O*m+L*f+T*l+M*u+W*a,G+=me>>>13,me&=8191,G=(G<<2)+G|0,G=G+J|0,J=G&8191,G=G>>>13,te+=G,o[0]=J,o[1]=te,o[2]=ie,o[3]=ge,o[4]=he,o[5]=Fe,o[6]=ke,o[7]=$e,o[8]=oe,o[9]=me}finalize(){let{h:t,pad:r}=this,n=new Uint16Array(10),s=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=s,s=t[a]>>>13,t[a]&=8191;t[0]+=s*5,s=t[0]>>>13,t[0]&=8191,t[1]+=s,s=t[1]>>>13,t[1]&=8191,t[2]+=s,n[0]=t[0]+5,s=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=t[a]+s,s=n[a]>>>13,n[a]&=8191;n[9]-=8192;let o=(s^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)t[a]=t[a]&o|n[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let i=t[0]+r[0];t[0]=i&65535;for(let a=1;a<8;a++)i=(t[a]+r[a]|0)+(i>>>16)|0,t[a]=i&65535;Co(n)}update(t){c_(this),on(t),t=Wd(t);let{buffer:r,blockLen:n}=this,s=t.length;for(let o=0;o<s;){let i=Math.min(n-this.pos,s-o);if(i===n){for(;n<=s-o;o+=n)this.process(t,o);continue}r.set(t.subarray(o,o+i),this.pos),this.pos+=i,o+=i,this.pos===n&&(this.process(r,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,Co(this.h,this.r,this.buffer,this.pad)}digestInto(t){c_(this),z9(t,this),this.finished=!0;let{buffer:r,h:n}=this,{pos:s}=this;if(s){for(r[s++]=1;s<16;s++)r[s]=0;this.process(r,0,!0)}this.finalize();let o=0;for(let i=0;i<8;i++)t[o++]=n[i]>>>0,t[o++]=n[i]>>>8}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}},nx=X9(32,e=>new f_(e))});function MQ(e,t,r,n,s,o=20){let i=e[0],a=e[1],u=e[2],l=e[3],f=t[0],m=t[1],p=t[2],d=t[3],v=t[4],g=t[5],y=t[6],w=t[7],E=s,S=r[0],C=r[1],D=r[2],H=i,K=a,_=u,x=l,j=f,U=m,k=p,N=d,O=v,L=g,T=y,M=w,W=E,G=S,J=C,te=D;for(let ge=0;ge<o;ge+=2)H=H+j|0,W=Wt(W^H,16),O=O+W|0,j=Wt(j^O,12),H=H+j|0,W=Wt(W^H,8),O=O+W|0,j=Wt(j^O,7),K=K+U|0,G=Wt(G^K,16),L=L+G|0,U=Wt(U^L,12),K=K+U|0,G=Wt(G^K,8),L=L+G|0,U=Wt(U^L,7),_=_+k|0,J=Wt(J^_,16),T=T+J|0,k=Wt(k^T,12),_=_+k|0,J=Wt(J^_,8),T=T+J|0,k=Wt(k^T,7),x=x+N|0,te=Wt(te^x,16),M=M+te|0,N=Wt(N^M,12),x=x+N|0,te=Wt(te^x,8),M=M+te|0,N=Wt(N^M,7),H=H+U|0,te=Wt(te^H,16),T=T+te|0,U=Wt(U^T,12),H=H+U|0,te=Wt(te^H,8),T=T+te|0,U=Wt(U^T,7),K=K+k|0,W=Wt(W^K,16),M=M+W|0,k=Wt(k^M,12),K=K+k|0,W=Wt(W^K,8),M=M+W|0,k=Wt(k^M,7),_=_+N|0,G=Wt(G^_,16),O=O+G|0,N=Wt(N^O,12),_=_+N|0,G=Wt(G^_,8),O=O+G|0,N=Wt(N^O,7),x=x+j|0,J=Wt(J^x,16),L=L+J|0,j=Wt(j^L,12),x=x+j|0,J=Wt(J^x,8),L=L+J|0,j=Wt(j^L,7);let ie=0;n[ie++]=i+H|0,n[ie++]=a+K|0,n[ie++]=u+_|0,n[ie++]=l+x|0,n[ie++]=f+j|0,n[ie++]=m+U|0,n[ie++]=p+k|0,n[ie++]=d+N|0,n[ie++]=v+O|0,n[ie++]=g+L|0,n[ie++]=y+T|0,n[ie++]=w+M|0,n[ie++]=E+W|0,n[ie++]=S+G|0,n[ie++]=C+J|0,n[ie++]=D+te|0}function ox(e,t,r,n,s){s!==void 0&&on(s,void 0,"AAD");let o=e(t,r,KQ),i=Z9(n.length,s?s.length:0,!0),a=nx.create(o);s&&ix(a,s),ix(a,n),a.update(i);let u=a.digest();return Co(o,i),u}var lEe,qQ,jQ,ix,KQ,VQ,ji,d_=re(()=>{lEe=F(I(),1);rx();sx();cv();qQ=tx(MQ,{counterRight:!1,counterLength:4,allowShortKeys:!1}),jQ=new Uint8Array(16),ix=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(jQ.subarray(r))},KQ=new Uint8Array(32);VQ=e=>(t,r,n)=>({encrypt(o,i){let a=o.length;i=N0(a+16,i,!1),i.set(o);let u=i.subarray(0,-16);e(t,r,u,u,1);let l=ox(e,t,r,u,n);return i.set(l,a),Co(l),i},decrypt(o,i){i=N0(o.length-16,i,!1);let a=o.subarray(0,-16),u=o.subarray(-16),l=ox(e,t,r,a,n);if(!W9(u,l))throw Co(l),new Error("invalid tag");return i.set(o.subarray(0,-16)),e(t,r,i,i,1),Co(l),i}}),ji=J9({blockSize:64,nonceLength:12,tagLength:16},VQ(qQ))});function Xd(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function En(e,t=""){if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new Error(`${r}expected integer >0, got ${e}`)}}function nt(e,t,r=""){let n=Xd(e),s=e?.length,o=t!==void 0;if(!n||o&&s!==t){let i=r&&`"${r}" `,a=o?` of length ${t}`:"",u=n?`length=${s}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+a+", got "+u)}return e}function Ki(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash must wrapped by utils.createHasher");En(e.outputLen),En(e.blockLen)}function Eu(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function lv(e,t){nt(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function fv(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Xs(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function dv(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Do(e,t){return e<<32-t|e>>>t}function zQ(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function YQ(e){for(let t=0;t<e.length;t++)e[t]=zQ(e[t]);return e}function Zl(e){if(nt(e),ux)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=WQ[e[r]];return t}function ax(e){if(e>=yu._0&&e<=yu._9)return e-yu._0;if(e>=yu.A&&e<=yu.F)return e-(yu.A-10);if(e>=yu.a&&e<=yu.f)return e-(yu.a-10)}function Ql(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(ux)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let s=0,o=0;s<r;s++,o+=2){let i=ax(e.charCodeAt(o)),a=ax(e.charCodeAt(o+1));if(i===void 0||a===void 0){let u=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+o)}n[s]=i*16+a}return n}function Xr(...e){let t=0;for(let n=0;n<e.length;n++){let s=e[n];nt(s),t+=s.length}let r=new Uint8Array(t);for(let n=0,s=0;n<e.length;n++){let o=e[n];r.set(o,s),s+=o.length}return r}function Jd(e,t={}){let r=(s,o)=>e(o).update(s).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=s=>e(s),Object.assign(r,t),Object.freeze(r)}function Lc(e=32){let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}var dEe,GQ,h_,ux,WQ,yu,Uc,vi=re(()=>{dEe=F(I(),1);GQ=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;h_=GQ?e=>e:YQ,ux=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",WQ=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));yu={_0:48,_9:57,A:65,F:70,a:97,f:102};Uc=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])})});function U0(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new Error(r+"expected boolean, got type="+typeof e)}return e}function cx(e){if(typeof e=="bigint"){if(!hv(e))throw new Error("positive bigint expected, got "+e)}else En(e);return e}function H0(e){let t=cx(e).toString(16);return t.length&1?"0"+t:t}function lx(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?m_:BigInt("0x"+e)}function Hc(e){return lx(Zl(e))}function Mc(e){return lx(Zl(pv(nt(e)).reverse()))}function Zd(e,t){En(t),e=cx(e);let r=Ql(e.toString(16).padStart(t*2,"0"));if(r.length!==t)throw new Error("number too large");return r}function M0(e,t){return Zd(e,t).reverse()}function pv(e){return Uint8Array.from(e)}function qc(e){return Uint8Array.from(e,(t,r)=>{let n=t.charCodeAt(0);if(t.length!==1||n>127)throw new Error(`string contains non-ASCII character "${e[r]}" with code ${n} at position ${r}`);return n})}function XQ(e,t,r){return hv(e)&&hv(t)&&hv(r)&&t<=e&&e<r}function q0(e,t,r,n){if(!XQ(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function g_(e){let t;for(t=0;e>m_;e>>=p_,t+=1);return t}function fx(e,t,r){if(En(e,"hashLen"),En(t,"qByteLen"),typeof r!="function")throw new Error("hmacFn must be a function");let n=y=>new Uint8Array(y),s=Uint8Array.of(),o=Uint8Array.of(0),i=Uint8Array.of(1),a=1e3,u=n(e),l=n(e),f=0,m=()=>{u.fill(1),l.fill(0),f=0},p=(...y)=>r(l,Xr(u,...y)),d=(y=s)=>{l=p(o,y),u=p(),y.length!==0&&(l=p(i,y),u=p())},v=()=>{if(f++>=a)throw new Error("drbg: tried max amount of iterations");let y=0,w=[];for(;y<t;){u=p();let E=u.slice();w.push(E),y+=u.length}return Xr(...w)};return(y,w)=>{m(),d(y);let E;for(;!(E=w(v()));)d();return m(),E}}function ef(e,t={},r={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function n(o,i,a){let u=e[o];if(a&&u===void 0)return;let l=typeof u;if(l!==i||u===null)throw new Error(`param "${o}" is invalid: expected ${i}, got ${l}`)}let s=(o,i)=>Object.entries(o).forEach(([a,u])=>n(a,u,i));s(t,!1),s(r,!0)}function v_(e){let t=new WeakMap;return(r,...n)=>{let s=t.get(r);if(s!==void 0)return s;let o=e(r,...n);return t.set(r,o),o}}var mEe,m_,p_,hv,j0,Qd=re(()=>{mEe=F(I(),1);vi();vi();m_=BigInt(0),p_=BigInt(1);hv=e=>typeof e=="bigint"&&m_<=e;j0=e=>(p_<<BigInt(e))-p_});function Ss(e,t){let r=e%t;return r>=_s?r:t+r}function Vi(e,t,r){let n=e;for(;t-- >_s;)n*=n,n%=r;return n}function dx(e,t){if(e===_s)throw new Error("invert: expected non-zero number");if(t<=_s)throw new Error("invert: expected positive modulus, got "+t);let r=Ss(e,t),n=t,s=_s,o=os,i=os,a=_s;for(;r!==_s;){let l=n/r,f=n%r,m=s-i*l,p=o-a*l;n=r,r=f,s=i,o=a,i=m,a=p}if(n!==os)throw new Error("invert: does not exist");return Ss(s,t)}function y_(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function yx(e,t){let r=(e.ORDER+os)/mx,n=e.pow(t,r);return y_(e,n,t),n}function QQ(e,t){let r=(e.ORDER-gx)/vx,n=e.mul(t,tf),s=e.pow(n,r),o=e.mul(t,s),i=e.mul(e.mul(o,tf),s),a=e.mul(o,e.sub(i,e.ONE));return y_(e,a,t),a}function eee(e){let t=mv(e),r=Ex(e),n=r(t,t.neg(t.ONE)),s=r(t,n),o=r(t,t.neg(n)),i=(e+JQ)/wx;return(a,u)=>{let l=a.pow(u,i),f=a.mul(l,n),m=a.mul(l,s),p=a.mul(l,o),d=a.eql(a.sqr(f),u),v=a.eql(a.sqr(m),u);l=a.cmov(l,f,d),f=a.cmov(p,m,v);let g=a.eql(a.sqr(f),u),y=a.cmov(l,f,g);return y_(a,y,u),y}}function Ex(e){if(e<px)throw new Error("sqrt is not defined for small field");let t=e-os,r=0;for(;t%tf===_s;)t/=tf,r++;let n=tf,s=mv(e);for(;hx(s,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return yx;let o=s.pow(n,t),i=(t+os)/tf;return function(u,l){if(u.is0(l))return l;if(hx(u,l)!==1)throw new Error("Cannot find square root");let f=r,m=u.mul(u.ONE,o),p=u.pow(l,t),d=u.pow(l,i);for(;!u.eql(p,u.ONE);){if(u.is0(p))return u.ZERO;let v=1,g=u.sqr(p);for(;!u.eql(g,u.ONE);)if(v++,g=u.sqr(g),v===f)throw new Error("Cannot find square root");let y=os<<BigInt(f-v-1),w=u.pow(m,y);f=v,m=u.sqr(w),p=u.mul(p,m),d=u.mul(d,w)}return d}}function tee(e){return e%mx===px?yx:e%vx===gx?QQ:e%wx===ZQ?eee(e):Ex(e)}function E_(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=ree.reduce((n,s)=>(n[s]="function",n),t);return ef(e,r),e}function nee(e,t,r){if(r<_s)throw new Error("invalid exponent, negatives unsupported");if(r===_s)return e.ONE;if(r===os)return t;let n=e.ONE,s=t;for(;r>_s;)r&os&&(n=e.mul(n,s)),s=e.sqr(s),r>>=os;return n}function K0(e,t,r=!1){let n=new Array(t.length).fill(r?e.ZERO:void 0),s=t.reduce((i,a,u)=>e.is0(a)?i:(n[u]=i,e.mul(i,a)),e.ONE),o=e.inv(s);return t.reduceRight((i,a,u)=>e.is0(a)?i:(n[u]=e.mul(i,n[u]),e.mul(i,a)),o),n}function hx(e,t){let r=(e.ORDER-os)/tf,n=e.pow(t,r),s=e.eql(n,e.ONE),o=e.eql(n,e.ZERO),i=e.eql(n,e.neg(e.ONE));if(!s&&!o&&!i)throw new Error("invalid Legendre symbol result");return s?1:o?0:-1}function see(e,t){t!==void 0&&En(t);let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function mv(e,t={}){return new w_(e,t)}function bx(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function b_(e){let t=bx(e);return t+Math.ceil(t/2)}function Ax(e,t,r=!1){nt(e);let n=e.length,s=bx(t),o=b_(t);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let i=r?Mc(e):Hc(e),a=Ss(i,t-os)+os;return r?M0(a,s):Zd(a,s)}var yEe,_s,os,tf,px,mx,gx,JQ,vx,ZQ,wx,ree,w_,V0=re(()=>{yEe=F(I(),1);Qd();_s=BigInt(0),os=BigInt(1),tf=BigInt(2),px=BigInt(3),mx=BigInt(4),gx=BigInt(5),JQ=BigInt(7),vx=BigInt(8),ZQ=BigInt(9),wx=BigInt(16);ree=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];w_=class{ORDER;BITS;BYTES;isLE;ZERO=_s;ONE=os;_lengths;_sqrt;_mod;constructor(t,r={}){if(t<=_s)throw new Error("invalid field: expected ORDER > 0, got "+t);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&(this.sqrt=r.sqrt),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=r.allowedLengths?.slice()),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:s,nByteLength:o}=see(t,n);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=s,this.BYTES=o,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return Ss(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return _s<=t&&t<this.ORDER}is0(t){return t===_s}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&os)===os}neg(t){return Ss(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return Ss(t*t,this.ORDER)}add(t,r){return Ss(t+r,this.ORDER)}sub(t,r){return Ss(t-r,this.ORDER)}mul(t,r){return Ss(t*r,this.ORDER)}pow(t,r){return nee(this,t,r)}div(t,r){return Ss(t*dx(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return dx(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=tee(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?M0(t,this.BYTES):Zd(t,this.BYTES)}fromBytes(t,r=!1){nt(t);let{_lengths:n,BYTES:s,isLE:o,ORDER:i,_mod:a}=this;if(n){if(!n.includes(t.length)||t.length>s)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let l=new Uint8Array(s);l.set(t,o?0:l.length-t.length),t=l}if(t.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+t.length);let u=o?Mc(t):Hc(t);if(a&&(u=Ss(u,i)),!r&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(t){return K0(this,t)}cmov(t,r,n){return n?r:t}}});function G0(e,t){let r=t.negate();return e?r:t}function C_(e,t){let r=K0(e.Fp,t.map(n=>n.Z));return t.map((n,s)=>e.fromAffine(n.toAffine(r[s])))}function Dx(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function A_(e,t){Dx(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),s=2**e,o=j0(e),i=BigInt(e);return{windows:r,windowSize:n,mask:o,maxNumber:s,shiftBy:i}}function Sx(e,t,r){let{windowSize:n,mask:s,maxNumber:o,shiftBy:i}=r,a=Number(e&s),u=e>>i;a>n&&(a-=o,u+=rf);let l=t*n,f=l+Math.abs(a)-1,m=a===0,p=a<0,d=t%2!==0;return{nextN:u,offset:f,isZero:m,isNeg:p,isNegF:d,offsetF:l}}function __(e){return Fx.get(e)||1}function _x(e){if(e!==eh)throw new Error("invalid wNAF")}function Bx(e,t,r,n){let s=t,o=e.ZERO,i=e.ZERO;for(;r>eh||n>eh;)r&rf&&(o=o.add(s)),n&rf&&(i=i.add(s)),s=s.double(),r>>=rf,n>>=rf;return{p1:o,p2:i}}function Cx(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return E_(t),t}else return mv(e,{isLE:r})}function Ix(e,t,r={},n){if(n===void 0&&(n=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(let u of["p","n","h"]){let l=t[u];if(!(typeof l=="bigint"&&l>eh))throw new Error(`CURVE.${u} must be positive bigint`)}let s=Cx(t.p,r.Fp,n),o=Cx(t.n,r.Fn,n),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let u of a)if(!s.isValid(t[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:s,Fn:o}}function vv(e,t){return function(n){let s=e(n);return{secretKey:s,publicKey:t(s)}}}var SEe,eh,rf,S_,Fx,gv,D_=re(()=>{SEe=F(I(),1);Qd();V0();eh=BigInt(0),rf=BigInt(1);S_=new WeakMap,Fx=new WeakMap;gv=class{BASE;ZERO;Fn;bits;constructor(t,r){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=r}_unsafeLadder(t,r,n=this.ZERO){let s=t;for(;r>eh;)r&rf&&(n=n.add(s)),s=s.double(),r>>=rf;return n}precomputeWindow(t,r){let{windows:n,windowSize:s}=A_(r,this.bits),o=[],i=t,a=i;for(let u=0;u<n;u++){a=i,o.push(a);for(let l=1;l<s;l++)a=a.add(i),o.push(a);i=a.double()}return o}wNAF(t,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let s=this.ZERO,o=this.BASE,i=A_(t,this.bits);for(let a=0;a<i.windows;a++){let{nextN:u,offset:l,isZero:f,isNeg:m,isNegF:p,offsetF:d}=Sx(n,a,i);n=u,f?o=o.add(G0(p,r[d])):s=s.add(G0(m,r[l]))}return _x(n),{p:s,f:o}}wNAFUnsafe(t,r,n,s=this.ZERO){let o=A_(t,this.bits);for(let i=0;i<o.windows&&n!==eh;i++){let{nextN:a,offset:u,isZero:l,isNeg:f}=Sx(n,i,o);if(n=a,!l){let m=r[u];s=s.add(f?m.negate():m)}}return _x(n),s}getPrecomputes(t,r,n){let s=S_.get(r);return s||(s=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(s=n(s)),S_.set(r,s))),s}cached(t,r,n){let s=__(t);return this.wNAF(s,this.getPrecomputes(s,t,n),r)}unsafe(t,r,n,s){let o=__(t);return o===1?this._unsafeLadder(t,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),r,s)}createCache(t,r){Dx(r,this.bits),Fx.set(t,r),S_.delete(t)}hasCache(t){return __(t)!==1}}});function iee(e){return ef(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function $x(e){let t=iee(e),{P:r,type:n,adjustScalarBytes:s,powPminus2:o,randomBytes:i}=t,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");let u=i||Lc,l=a?255:448,f=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?wv**BigInt(254):wv**BigInt(447),v=a?BigInt(8)*wv**BigInt(251)-th:BigInt(4)*wv**BigInt(445)-th,g=d+v+th,y=O=>Ss(O,r),w=E(m);function E(O){return M0(y(O),f)}function S(O){let L=pv(nt(O,f,"uCoordinate"));return a&&(L[31]&=127),y(Mc(L))}function C(O){return Mc(s(pv(nt(O,f,"scalar"))))}function D(O,L){let T=j(S(L),C(O));if(T===z0)throw new Error("invalid private or public key received");return E(T)}function H(O){return D(O,w)}let K=H,_=D;function x(O,L,T){let M=y(O*(L-T));return L=y(L-M),T=y(T+M),{x_2:L,x_3:T}}function j(O,L){q0("u",O,z0,r),q0("scalar",L,d,g);let T=L,M=O,W=th,G=z0,J=O,te=th,ie=z0;for(let he=BigInt(l-1);he>=z0;he--){let Fe=T>>he&th;ie^=Fe,{x_2:W,x_3:J}=x(ie,W,J),{x_2:G,x_3:te}=x(ie,G,te),ie=Fe;let ke=W+G,$e=y(ke*ke),oe=W-G,me=y(oe*oe),Be=$e-me,Ue=J+te,We=J-te,He=y(We*ke),St=y(Ue*oe),st=He+St,wt=He-St;J=y(st*st),te=y(M*y(wt*wt)),W=y($e*me),G=y(Be*($e+y(p*Be)))}({x_2:W,x_3:J}=x(ie,W,J)),{x_2:G,x_3:te}=x(ie,G,te);let ge=o(G);return y(W*ge)}let U={secretKey:f,publicKey:f,seed:f},k=(O=u(f))=>(nt(O,U.seed,"seed"),O),N={randomSecretKey:k};return Object.freeze({keygen:vv(k,K),getSharedSecret:_,getPublicKey:K,scalarMult:D,scalarMultBase:H,utils:N,GuBytes:w.slice(),lengths:U})}var BEe,z0,th,wv,xx=re(()=>{BEe=F(I(),1);Qd();D_();V0();z0=BigInt(0),th=BigInt(1),wv=BigInt(2)});var xEe,yv,rh,F_=re(()=>{xEe=F(I(),1);vi();yv=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,r){if(Ki(t),nt(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),Xs(s)}update(t){return Eu(this),this.iHash.update(t),this}digestInto(t){Eu(this),nt(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:s,destroyed:o,blockLen:i,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=o,t.blockLen=i,t.outputLen=a,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},rh=(e,t,r)=>new yv(e,t).update(r).digest();rh.create=(e,t)=>new yv(e,t)});function oee(e,t,r){let[[n,s],[o,i]]=t,a=Rx(i*e,r),u=Rx(-s*e,r),l=e-a*n-u*o,f=-a*s-u*i,m=l<bu,p=f<bu;m&&(l=-l),p&&(f=-f);let d=j0(Math.ceil(g_(r)/2))+nh;if(l<bu||l>=d||f<bu||f>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:m,k1:l,k2neg:p,k2:f}}function I_(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function B_(e,t){let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return U0(r.lowS,"lowS"),U0(r.prehash,"prehash"),r.format!==void 0&&I_(r.format),r}function x_(e,t={}){let r=Ix("weierstrass",e,t),{Fp:n,Fn:s}=r,o=r.CURVE,{h:i,n:a}=o;ef(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:u}=t;if(u&&(!n.is0(o.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let l=Px(n,s);function f(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function m(k,N,O){let{x:L,y:T}=N.toAffine(),M=n.toBytes(L);if(U0(O,"isCompressed"),O){f();let W=!n.isOdd(T);return Xr(kx(W),M)}else return Xr(Uint8Array.of(4),M,n.toBytes(T))}function p(k){nt(k,void 0,"Point");let{publicKey:N,publicKeyUncompressed:O}=l,L=k.length,T=k[0],M=k.subarray(1);if(L===N&&(T===2||T===3)){let W=n.fromBytes(M);if(!n.isValid(W))throw new Error("bad point: is not on curve, wrong x");let G=g(W),J;try{J=n.sqrt(G)}catch(ge){let he=ge instanceof Error?": "+ge.message:"";throw new Error("bad point: is not on curve, sqrt error"+he)}f();let te=n.isOdd(J);return(T&1)===1!==te&&(J=n.neg(J)),{x:W,y:J}}else if(L===O&&T===4){let W=n.BYTES,G=n.fromBytes(M.subarray(0,W)),J=n.fromBytes(M.subarray(W,W*2));if(!y(G,J))throw new Error("bad point: is not on curve");return{x:G,y:J}}else throw new Error(`bad point: got length ${L}, expected compressed=${N} or uncompressed=${O}`)}let d=t.toBytes||m,v=t.fromBytes||p;function g(k){let N=n.sqr(k),O=n.mul(N,k);return n.add(n.add(O,n.mul(k,o.a)),o.b)}function y(k,N){let O=n.sqr(N),L=g(k);return n.eql(O,L)}if(!y(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let w=n.mul(n.pow(o.a,Ev),aee),E=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(w,E)))throw new Error("bad curve params: a or b");function S(k,N,O=!1){if(!n.isValid(N)||O&&n.is0(N))throw new Error(`bad point coordinate ${k}`);return N}function C(k){if(!(k instanceof x))throw new Error("Weierstrass Point expected")}function D(k){if(!u||!u.basises)throw new Error("no endo");return oee(k,u.basises,s.ORDER)}let H=v_((k,N)=>{let{X:O,Y:L,Z:T}=k;if(n.eql(T,n.ONE))return{x:O,y:L};let M=k.is0();N==null&&(N=M?n.ONE:n.inv(T));let W=n.mul(O,N),G=n.mul(L,N),J=n.mul(T,N);if(M)return{x:n.ZERO,y:n.ZERO};if(!n.eql(J,n.ONE))throw new Error("invZ was invalid");return{x:W,y:G}}),K=v_(k=>{if(k.is0()){if(t.allowInfinityPoint&&!n.is0(k.Y))return;throw new Error("bad point: ZERO")}let{x:N,y:O}=k.toAffine();if(!n.isValid(N)||!n.isValid(O))throw new Error("bad point: x or y not field elements");if(!y(N,O))throw new Error("bad point: equation left != right");if(!k.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function _(k,N,O,L,T){return O=new x(n.mul(O.X,k),O.Y,O.Z),N=G0(L,N),O=G0(T,O),N.add(O)}class x{static BASE=new x(o.Gx,o.Gy,n.ONE);static ZERO=new x(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=s;X;Y;Z;constructor(N,O,L){this.X=S("x",N),this.Y=S("y",O,!0),this.Z=S("z",L),Object.freeze(this)}static CURVE(){return o}static fromAffine(N){let{x:O,y:L}=N||{};if(!N||!n.isValid(O)||!n.isValid(L))throw new Error("invalid affine point");if(N instanceof x)throw new Error("projective point not allowed");return n.is0(O)&&n.is0(L)?x.ZERO:new x(O,L,n.ONE)}static fromBytes(N){let O=x.fromAffine(v(nt(N,void 0,"point")));return O.assertValidity(),O}static fromHex(N){return x.fromBytes(Ql(N))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(N=8,O=!0){return U.createCache(this,N),O||this.multiply(Ev),this}assertValidity(){K(this)}hasEvenY(){let{y:N}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(N)}equals(N){C(N);let{X:O,Y:L,Z:T}=this,{X:M,Y:W,Z:G}=N,J=n.eql(n.mul(O,G),n.mul(M,T)),te=n.eql(n.mul(L,G),n.mul(W,T));return J&&te}negate(){return new x(this.X,n.neg(this.Y),this.Z)}double(){let{a:N,b:O}=o,L=n.mul(O,Ev),{X:T,Y:M,Z:W}=this,G=n.ZERO,J=n.ZERO,te=n.ZERO,ie=n.mul(T,T),ge=n.mul(M,M),he=n.mul(W,W),Fe=n.mul(T,M);return Fe=n.add(Fe,Fe),te=n.mul(T,W),te=n.add(te,te),G=n.mul(N,te),J=n.mul(L,he),J=n.add(G,J),G=n.sub(ge,J),J=n.add(ge,J),J=n.mul(G,J),G=n.mul(Fe,G),te=n.mul(L,te),he=n.mul(N,he),Fe=n.sub(ie,he),Fe=n.mul(N,Fe),Fe=n.add(Fe,te),te=n.add(ie,ie),ie=n.add(te,ie),ie=n.add(ie,he),ie=n.mul(ie,Fe),J=n.add(J,ie),he=n.mul(M,W),he=n.add(he,he),ie=n.mul(he,Fe),G=n.sub(G,ie),te=n.mul(he,ge),te=n.add(te,te),te=n.add(te,te),new x(G,J,te)}add(N){C(N);let{X:O,Y:L,Z:T}=this,{X:M,Y:W,Z:G}=N,J=n.ZERO,te=n.ZERO,ie=n.ZERO,ge=o.a,he=n.mul(o.b,Ev),Fe=n.mul(O,M),ke=n.mul(L,W),$e=n.mul(T,G),oe=n.add(O,L),me=n.add(M,W);oe=n.mul(oe,me),me=n.add(Fe,ke),oe=n.sub(oe,me),me=n.add(O,T);let Be=n.add(M,G);return me=n.mul(me,Be),Be=n.add(Fe,$e),me=n.sub(me,Be),Be=n.add(L,T),J=n.add(W,G),Be=n.mul(Be,J),J=n.add(ke,$e),Be=n.sub(Be,J),ie=n.mul(ge,me),J=n.mul(he,$e),ie=n.add(J,ie),J=n.sub(ke,ie),ie=n.add(ke,ie),te=n.mul(J,ie),ke=n.add(Fe,Fe),ke=n.add(ke,Fe),$e=n.mul(ge,$e),me=n.mul(he,me),ke=n.add(ke,$e),$e=n.sub(Fe,$e),$e=n.mul(ge,$e),me=n.add(me,$e),Fe=n.mul(ke,me),te=n.add(te,Fe),Fe=n.mul(Be,me),J=n.mul(oe,J),J=n.sub(J,Fe),Fe=n.mul(oe,ke),ie=n.mul(Be,ie),ie=n.add(ie,Fe),new x(J,te,ie)}subtract(N){return this.add(N.negate())}is0(){return this.equals(x.ZERO)}multiply(N){let{endo:O}=t;if(!s.isValidNot0(N))throw new Error("invalid scalar: out of range");let L,T,M=W=>U.cached(this,W,G=>C_(x,G));if(O){let{k1neg:W,k1:G,k2neg:J,k2:te}=D(N),{p:ie,f:ge}=M(G),{p:he,f:Fe}=M(te);T=ge.add(Fe),L=_(O.beta,ie,he,W,J)}else{let{p:W,f:G}=M(N);L=W,T=G}return C_(x,[L,T])[0]}multiplyUnsafe(N){let{endo:O}=t,L=this;if(!s.isValid(N))throw new Error("invalid scalar: out of range");if(N===bu||L.is0())return x.ZERO;if(N===nh)return L;if(U.hasCache(this))return this.multiply(N);if(O){let{k1neg:T,k1:M,k2neg:W,k2:G}=D(N),{p1:J,p2:te}=Bx(x,L,M,G);return _(O.beta,J,te,T,W)}else return U.unsafe(L,N)}toAffine(N){return H(this,N)}isTorsionFree(){let{isTorsionFree:N}=t;return i===nh?!0:N?N(x,this):U.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:N}=t;return i===nh?this:N?N(x,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(N=!0){return U0(N,"isCompressed"),this.assertValidity(),d(x,this,N)}toHex(N=!0){return Zl(this.toBytes(N))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let j=s.BITS,U=new gv(x,t.endo?Math.ceil(j/2):j);return x.BASE.precompute(8),x}function kx(e){return Uint8Array.of(e?2:3)}function Px(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function uee(e,t={}){let{Fn:r}=e,n=t.randomBytes||Lc,s=Object.assign(Px(e.Fp,r),{seed:b_(r.ORDER)});function o(d){try{let v=r.fromBytes(d);return r.isValidNot0(v)}catch{return!1}}function i(d,v){let{publicKey:g,publicKeyUncompressed:y}=s;try{let w=d.length;return v===!0&&w!==g||v===!1&&w!==y?!1:!!e.fromBytes(d)}catch{return!1}}function a(d=n(s.seed)){return Ax(nt(d,s.seed,"seed"),r.ORDER)}function u(d,v=!0){return e.BASE.multiply(r.fromBytes(d)).toBytes(v)}function l(d){let{secretKey:v,publicKey:g,publicKeyUncompressed:y}=s;if(!Xd(d)||"_lengths"in r&&r._lengths||v===g)return;let w=nt(d,void 0,"key").length;return w===g||w===y}function f(d,v,g=!0){if(l(d)===!0)throw new Error("first arg must be private key");if(l(v)===!1)throw new Error("second arg must be public key");let y=r.fromBytes(d);return e.fromBytes(v).multiply(y).toBytes(g)}let m={isValidSecretKey:o,isValidPublicKey:i,randomSecretKey:a},p=vv(a,u);return Object.freeze({getPublicKey:u,getSharedSecret:f,keygen:p,Point:e,utils:m,lengths:s})}function R_(e,t,r={}){Ki(t),ef(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes||Lc,s=r.hmac||((O,L)=>rh(t,O,L)),{Fp:o,Fn:i}=e,{ORDER:a,BITS:u}=i,{keygen:l,getPublicKey:f,getSharedSecret:m,utils:p,lengths:d}=uee(e,r),v={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},g=a*Tx<o.ORDER;function y(O){let L=a>>nh;return O>L}function w(O,L){if(!i.isValidNot0(L))throw new Error(`invalid signature ${O}: out of range 1..Point.Fn.ORDER`);return L}function E(){if(g)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function S(O,L){I_(L);let T=d.signature,M=L==="compact"?T:L==="recovered"?T+1:void 0;return nt(O,M)}class C{r;s;recovery;constructor(L,T,M){if(this.r=w("r",L),this.s=w("s",T),M!=null){if(E(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(L,T=v.format){S(L,T);let M;if(T==="der"){let{r:te,s:ie}=jc.toSig(nt(L));return new C(te,ie)}T==="recovered"&&(M=L[0],T="compact",L=L.subarray(1));let W=d.signature/2,G=L.subarray(0,W),J=L.subarray(W,W*2);return new C(i.fromBytes(G),i.fromBytes(J),M)}static fromHex(L,T){return this.fromBytes(Ql(L),T)}assertRecovery(){let{recovery:L}=this;if(L==null)throw new Error("invalid recovery id: must be present");return L}addRecoveryBit(L){return new C(this.r,this.s,L)}recoverPublicKey(L){let{r:T,s:M}=this,W=this.assertRecovery(),G=W===2||W===3?T+a:T;if(!o.isValid(G))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let J=o.toBytes(G),te=e.fromBytes(Xr(kx((W&1)===0),J)),ie=i.inv(G),ge=H(nt(L,void 0,"msgHash")),he=i.create(-ge*ie),Fe=i.create(M*ie),ke=e.BASE.multiplyUnsafe(he).add(te.multiplyUnsafe(Fe));if(ke.is0())throw new Error("invalid recovery: point at infinify");return ke.assertValidity(),ke}hasHighS(){return y(this.s)}toBytes(L=v.format){if(I_(L),L==="der")return Ql(jc.hexFromSig(this));let{r:T,s:M}=this,W=i.toBytes(T),G=i.toBytes(M);return L==="recovered"?(E(),Xr(Uint8Array.of(this.assertRecovery()),W,G)):Xr(W,G)}toHex(L){return Zl(this.toBytes(L))}}let D=r.bits2int||function(L){if(L.length>8192)throw new Error("input is too large");let T=Hc(L),M=L.length*8-u;return M>0?T>>BigInt(M):T},H=r.bits2int_modN||function(L){return i.create(D(L))},K=j0(u);function _(O){return q0("num < 2^"+u,O,bu,K),i.toBytes(O)}function x(O,L){return nt(O,void 0,"message"),L?nt(t(O),void 0,"prehashed message"):O}function j(O,L,T){let{lowS:M,prehash:W,extraEntropy:G}=B_(T,v);O=x(O,W);let J=H(O),te=i.fromBytes(L);if(!i.isValidNot0(te))throw new Error("invalid private key");let ie=[_(te),_(J)];if(G!=null&&G!==!1){let ke=G===!0?n(d.secretKey):G;ie.push(nt(ke,void 0,"extraEntropy"))}let ge=Xr(...ie),he=J;function Fe(ke){let $e=D(ke);if(!i.isValidNot0($e))return;let oe=i.inv($e),me=e.BASE.multiply($e).toAffine(),Be=i.create(me.x);if(Be===bu)return;let Ue=i.create(oe*i.create(he+Be*te));if(Ue===bu)return;let We=(me.x===Be?0:2)|Number(me.y&nh),He=Ue;return M&&y(Ue)&&(He=i.neg(Ue),We^=1),new C(Be,He,g?void 0:We)}return{seed:ge,k2sig:Fe}}function U(O,L,T={}){let{seed:M,k2sig:W}=j(O,L,T);return fx(t.outputLen,i.BYTES,s)(M,W).toBytes(T.format)}function k(O,L,T,M={}){let{lowS:W,prehash:G,format:J}=B_(M,v);if(T=nt(T,void 0,"publicKey"),L=x(L,G),!Xd(O)){let te=O instanceof C?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}S(O,J);try{let te=C.fromBytes(O,J),ie=e.fromBytes(T);if(W&&te.hasHighS())return!1;let{r:ge,s:he}=te,Fe=H(L),ke=i.inv(he),$e=i.create(Fe*ke),oe=i.create(ge*ke),me=e.BASE.multiplyUnsafe($e).add(ie.multiplyUnsafe(oe));return me.is0()?!1:i.create(me.x)===ge}catch{return!1}}function N(O,L,T={}){let{prehash:M}=B_(T,v);return L=x(L,M),C.fromBytes(O,"recovered").recoverPublicKey(L).toBytes()}return Object.freeze({keygen:l,getPublicKey:f,getSharedSecret:m,utils:p,lengths:d,Point:e,sign:U,verify:k,recoverPublicKey:N,Signature:C,hash:t})}var LEe,Rx,$_,jc,bu,nh,Tx,Ev,aee,Ox=re(()=>{LEe=F(I(),1);F_();vi();Qd();D_();V0();Rx=(e,t)=>(e+(e>=0?t:-t)/Tx)/t;$_=class extends Error{constructor(t=""){super(t)}},jc={Err:$_,_tlv:{encode:(e,t)=>{let{Err:r}=jc;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,s=H0(n);if(s.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?H0(s.length/2|128):"";return H0(e)+o+s+t},decode(e,t){let{Err:r}=jc,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let s=t[n++],o=!!(s&128),i=0;if(!o)i=s;else{let u=s&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");let l=t.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of l)i=i<<8|f;if(n+=u,i<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+i);if(a.length!==i)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+i)}}},_int:{encode(e){let{Err:t}=jc;if(e<bu)throw new t("integer: negative integers are not allowed");let r=H0(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=jc;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Hc(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=jc,s=nt(e,void 0,"signature"),{v:o,l:i}=n.decode(48,s);if(i.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:u}=n.decode(2,o),{v:l,l:f}=n.decode(2,u);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=jc,n=t.encode(2,r.encode(e.r)),s=t.encode(2,r.encode(e.s)),o=n+s;return t.encode(48,o)}},bu=BigInt(0),nh=BigInt(1),Tx=BigInt(2),Ev=BigInt(3),aee=BigInt(4)});function Nx(e,t,r){return e&t^~e&r}function Lx(e,t,r){return e&t^e&r^t&r}var MEe,Y0,Au,Rn,Ux=re(()=>{MEe=F(I(),1);vi();Y0=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,s){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=s,this.buffer=new Uint8Array(t),this.view=dv(this.buffer)}update(t){Eu(this),nt(t);let{view:r,buffer:n,blockLen:s}=this,o=t.length;for(let i=0;i<o;){let a=Math.min(s-this.pos,o-i);if(a===s){let u=dv(t);for(;s<=o-i;i+=s)this.process(u,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Eu(this),lv(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:s,isLE:o}=this,{pos:i}=this;r[i++]=128,Xs(this.buffer.subarray(i)),this.padOffset>s-i&&(this.process(n,0),i=0);for(let m=i;m<s;m++)r[m]=0;n.setBigUint64(s-8,BigInt(this.length*8),o),this.process(n,0);let a=dv(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=u/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)a.setUint32(4*m,f[m],o)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:r,buffer:n,length:s,finished:o,destroyed:i,pos:a}=this;return t.destroyed=i,t.finished=o,t.length=s,t.pos=a,s%r&&t.buffer.set(n),t}clone(){return this._cloneInto()}},Au=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Rn=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])});function cee(e,t=!1){return t?{h:Number(e&bv),l:Number(e>>Hx&bv)}:{h:Number(e>>Hx&bv)|0,l:Number(e&bv)|0}}function Av(e,t=!1){let r=e.length,n=new Uint32Array(r),s=new Uint32Array(r);for(let o=0;o<r;o++){let{h:i,l:a}=cee(e[o],t);[n[o],s[o]]=[i,a]}return[n,s]}function wa(e,t,r,n){let s=(t>>>0)+(n>>>0);return{h:e+r+(s/2**32|0)|0,l:s|0}}var qEe,bv,Hx,T_,k_,nf,sf,W0,X0,Mx,qx,jx,Kx,Vx,Gx,zx,Yx,Wx,Xx,P_=re(()=>{qEe=F(I(),1),bv=BigInt(4294967295),Hx=BigInt(32);T_=(e,t,r)=>e>>>r,k_=(e,t,r)=>e<<32-r|t>>>r,nf=(e,t,r)=>e>>>r|t<<32-r,sf=(e,t,r)=>e<<32-r|t>>>r,W0=(e,t,r)=>e<<64-r|t>>>r-32,X0=(e,t,r)=>e>>>r-32|t<<64-r,Mx=(e,t,r)=>e<<r|t>>>32-r,qx=(e,t,r)=>t<<r|e>>>32-r,jx=(e,t,r)=>t<<r-32|e>>>64-r,Kx=(e,t,r)=>e<<r-32|t>>>64-r;Vx=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),Gx=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,zx=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),Yx=(e,t,r,n,s)=>t+r+n+s+(e/2**32|0)|0,Wx=(e,t,r,n,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(s>>>0),Xx=(e,t,r,n,s,o)=>t+r+n+s+o+(e/2**32|0)|0});var YEe,fee,Kc,O_,N_,Jx,dee,hee,Vc,Gc,L_,U_,Sv,Zx,H_=re(()=>{YEe=F(I(),1);Ux();P_();vi();fee=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Kc=new Uint32Array(64),O_=class extends Y0{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:r,C:n,D:s,E:o,F:i,G:a,H:u}=this;return[t,r,n,s,o,i,a,u]}set(t,r,n,s,o,i,a,u){this.A=t|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=o|0,this.F=i|0,this.G=a|0,this.H=u|0}process(t,r){for(let m=0;m<16;m++,r+=4)Kc[m]=t.getUint32(r,!1);for(let m=16;m<64;m++){let p=Kc[m-15],d=Kc[m-2],v=Do(p,7)^Do(p,18)^p>>>3,g=Do(d,17)^Do(d,19)^d>>>10;Kc[m]=g+Kc[m-7]+v+Kc[m-16]|0}let{A:n,B:s,C:o,D:i,E:a,F:u,G:l,H:f}=this;for(let m=0;m<64;m++){let p=Do(a,6)^Do(a,11)^Do(a,25),d=f+p+Nx(a,u,l)+fee[m]+Kc[m]|0,g=(Do(n,2)^Do(n,13)^Do(n,22))+Lx(n,s,o)|0;f=l,l=u,u=a,a=i+d|0,i=o,o=s,s=n,n=d+g|0}n=n+this.A|0,s=s+this.B|0,o=o+this.C|0,i=i+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(n,s,o,i,a,u,l,f)}roundClean(){Xs(Kc)}destroy(){this.set(0,0,0,0,0,0,0,0),Xs(this.buffer)}},N_=class extends O_{A=Au[0]|0;B=Au[1]|0;C=Au[2]|0;D=Au[3]|0;E=Au[4]|0;F=Au[5]|0;G=Au[6]|0;H=Au[7]|0;constructor(){super(32)}},Jx=Av(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),dee=Jx[0],hee=Jx[1],Vc=new Uint32Array(80),Gc=new Uint32Array(80),L_=class extends Y0{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:r,Bh:n,Bl:s,Ch:o,Cl:i,Dh:a,Dl:u,Eh:l,El:f,Fh:m,Fl:p,Gh:d,Gl:v,Hh:g,Hl:y}=this;return[t,r,n,s,o,i,a,u,l,f,m,p,d,v,g,y]}set(t,r,n,s,o,i,a,u,l,f,m,p,d,v,g,y){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=s|0,this.Ch=o|0,this.Cl=i|0,this.Dh=a|0,this.Dl=u|0,this.Eh=l|0,this.El=f|0,this.Fh=m|0,this.Fl=p|0,this.Gh=d|0,this.Gl=v|0,this.Hh=g|0,this.Hl=y|0}process(t,r){for(let S=0;S<16;S++,r+=4)Vc[S]=t.getUint32(r),Gc[S]=t.getUint32(r+=4);for(let S=16;S<80;S++){let C=Vc[S-15]|0,D=Gc[S-15]|0,H=nf(C,D,1)^nf(C,D,8)^T_(C,D,7),K=sf(C,D,1)^sf(C,D,8)^k_(C,D,7),_=Vc[S-2]|0,x=Gc[S-2]|0,j=nf(_,x,19)^W0(_,x,61)^T_(_,x,6),U=sf(_,x,19)^X0(_,x,61)^k_(_,x,6),k=zx(K,U,Gc[S-7],Gc[S-16]),N=Yx(k,H,j,Vc[S-7],Vc[S-16]);Vc[S]=N|0,Gc[S]=k|0}let{Ah:n,Al:s,Bh:o,Bl:i,Ch:a,Cl:u,Dh:l,Dl:f,Eh:m,El:p,Fh:d,Fl:v,Gh:g,Gl:y,Hh:w,Hl:E}=this;for(let S=0;S<80;S++){let C=nf(m,p,14)^nf(m,p,18)^W0(m,p,41),D=sf(m,p,14)^sf(m,p,18)^X0(m,p,41),H=m&d^~m&g,K=p&v^~p&y,_=Wx(E,D,K,hee[S],Gc[S]),x=Xx(_,w,C,H,dee[S],Vc[S]),j=_|0,U=nf(n,s,28)^W0(n,s,34)^W0(n,s,39),k=sf(n,s,28)^X0(n,s,34)^X0(n,s,39),N=n&o^n&a^o&a,O=s&i^s&u^i&u;w=g|0,E=y|0,g=d|0,y=v|0,d=m|0,v=p|0,{h:m,l:p}=wa(l|0,f|0,x|0,j|0),l=a|0,f=u|0,a=o|0,u=i|0,o=n|0,i=s|0;let L=Vx(j,k,O);n=Gx(L,x,U,N),s=L|0}({h:n,l:s}=wa(this.Ah|0,this.Al|0,n|0,s|0)),{h:o,l:i}=wa(this.Bh|0,this.Bl|0,o|0,i|0),{h:a,l:u}=wa(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:f}=wa(this.Dh|0,this.Dl|0,l|0,f|0),{h:m,l:p}=wa(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=wa(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=wa(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=wa(this.Hh|0,this.Hl|0,w|0,E|0),this.set(n,s,o,i,a,u,l,f,m,p,d,v,g,y,w,E)}roundClean(){Xs(Vc,Gc)}destroy(){Xs(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},U_=class extends L_{Ah=Rn[0]|0;Al=Rn[1]|0;Bh=Rn[2]|0;Bl=Rn[3]|0;Ch=Rn[4]|0;Cl=Rn[5]|0;Dh=Rn[6]|0;Dl=Rn[7]|0;Eh=Rn[8]|0;El=Rn[9]|0;Fh=Rn[10]|0;Fl=Rn[11]|0;Gh=Rn[12]|0;Gl=Rn[13]|0;Hh=Rn[14]|0;Hl=Rn[15]|0;constructor(){super(48)}},Sv=Jd(()=>new N_,Uc(1)),Zx=Jd(()=>new U_,Uc(2))});function vee(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),s=BigInt(80),o=eR,a=e*e%o*e%o,u=Vi(a,Qx,o)*a%o,l=Vi(u,pee,o)*e%o,f=Vi(l,gee,o)*l%o,m=Vi(f,t,o)*f%o,p=Vi(m,r,o)*m%o,d=Vi(p,n,o)*p%o,v=Vi(d,s,o)*d%o,g=Vi(v,s,o)*d%o,y=Vi(g,t,o)*f%o;return{pow_p_5_8:Vi(y,Qx,o)*e%o,b2:a}}function wee(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var tbe,pee,Qx,mee,gee,QEe,eR,tR,rR=re(()=>{tbe=F(I(),1);V0();xx();pee=BigInt(1),Qx=BigInt(2),mee=BigInt(3),gee=BigInt(5),QEe=BigInt(8),eR=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");tR=(()=>{let e=eR;return $x({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=vee(t);return Ss(Vi(r,mee,e)*n,e)},adjustScalarBytes:wee})})()});var abe,yee,Eee,bee,M_,Aee,nR,sR=re(()=>{abe=F(I(),1);H_();Ox();yee={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Eee={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},bee=x_(yee),M_=R_(bee,Sv),Aee=x_(Eee),nR=R_(Aee,Zx)});function oR(e,t,r){return Ki(e),r===void 0&&(r=new Uint8Array(e.outputLen)),rh(e,r,t)}function aR(e,t,r,n=32){Ki(e),En(n,"length");let s=e.outputLen;if(n>255*s)throw new Error("Length must be <= 255*HashLen");let o=Math.ceil(n/s);r===void 0?r=iR:nt(r,void 0,"info");let i=new Uint8Array(o*s),a=rh.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let f=0;f<o;f++)q_[0]=f+1,u.update(f===0?iR:l).update(r).update(q_).digestInto(l),i.set(l,s*f),a._cloneInto(u);return a.destroy(),u.destroy(),Xs(l,q_),i.slice(0,n)}var fbe,q_,iR,uR=re(()=>{fbe=F(I(),1);F_();vi();q_=Uint8Array.of(0),iR=Uint8Array.of()});function $ee(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let i=0;i<10;i++)r[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){let a=(i+8)%10,u=(i+2)%10,l=r[u],f=r[u+1],m=cR(l,f,1)^r[a],p=lR(l,f,1)^r[a+1];for(let d=0;d<50;d+=10)e[i+d]^=m,e[i+d+1]^=p}let s=e[2],o=e[3];for(let i=0;i<24;i++){let a=dR[i],u=cR(s,o,a),l=lR(s,o,a),f=fR[i];s=e[f],o=e[f+1],e[f]=u,e[f+1]=l}for(let i=0;i<50;i+=10){for(let a=0;a<10;a++)r[a]=e[i+a];for(let a=0;a<10;a++)e[i+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=Bee[n],e[1]^=Iee[n]}Xs(r)}var mbe,See,J0,_ee,Cee,Dee,Fee,fR,dR,hR,pR,Bee,Iee,cR,lR,_v,mR,of,gR,vR,wR,ya,Cv=re(()=>{mbe=F(I(),1);P_();vi();See=BigInt(0),J0=BigInt(1),_ee=BigInt(2),Cee=BigInt(7),Dee=BigInt(256),Fee=BigInt(113),fR=[],dR=[],hR=[];for(let e=0,t=J0,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],fR.push(2*(5*n+r)),dR.push((e+1)*(e+2)/2%64);let s=See;for(let o=0;o<7;o++)t=(t<<J0^(t>>Cee)*Fee)%Dee,t&_ee&&(s^=J0<<(J0<<BigInt(o))-J0);hR.push(s)}pR=Av(hR,!0),Bee=pR[0],Iee=pR[1],cR=(e,t,r)=>r>32?jx(e,t,r):Mx(e,t,r),lR=(e,t,r)=>r>32?Kx(e,t,r):qx(e,t,r);_v=class e{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(t,r,n,s=!1,o=24){if(this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=s,this.rounds=o,En(n,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=fv(this.state)}clone(){return this._cloneInto()}keccak(){h_(this.state32),$ee(this.state32,this.rounds),h_(this.state32),this.posOut=0,this.pos=0}update(t){Eu(this),nt(t);let{blockLen:r,state:n}=this,s=t.length;for(let o=0;o<s;){let i=Math.min(r-this.pos,s-o);for(let a=0;a<i;a++)n[this.pos++]^=t[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:s}=this;t[n]^=r,(r&128)!==0&&n===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Eu(this,!1),nt(t),this.finish();let r=this.state,{blockLen:n}=this;for(let s=0,o=t.length;s<o;){this.posOut>=n&&this.keccak();let i=Math.min(n-this.posOut,o-s);t.set(r.subarray(this.posOut,this.posOut+i),s),this.posOut+=i,s+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return En(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(lv(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Xs(this.state)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:s,rounds:o,enableXOF:i}=this;return t||=new e(r,n,s,i,o),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=s,t.enableXOF=i,t.destroyed=this.destroyed,t}},mR=(e,t,r,n={})=>Jd(()=>new _v(t,e,r),n),of=mR(6,136,32,Uc(8)),gR=mR(6,72,64,Uc(10)),vR=(e,t,r,n={})=>Jd((s={})=>new _v(t,e,s.dkLen===void 0?r:s.dkLen,!0),n),wR=vR(31,168,16,Uc(11)),ya=vR(31,136,32,Uc(12))});function j_(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error("wrong u32 integer:"+e);return e}function ER(e){return j_(e),(e&e-1)===0&&e!==0}function K_(e,t){j_(e);let r=0;for(let n=0;n<t;n++,e>>>=1)r=r<<1|e&1;return r}function bR(e){return j_(e),31-Math.clz32(e)}function yR(e){let t=e.length;if(t<2||!ER(t))throw new Error("n must be a power of 2 and greater than 1. Got "+t);let r=bR(t);for(let n=0;n<t;n++){let s=K_(n,r);if(n<s){let o=e[n];e[n]=e[s],e[s]=o}}return e}var vbe,V_,AR=re(()=>{vbe=F(I(),1);V_=(e,t)=>{let{N:r,roots:n,dit:s,invertButterflies:o=!1,skipStages:i=0,brp:a=!0}=t,u=bR(r);if(!ER(r))throw new Error("FFT: Polynomial size should be power of two");let l=s!==o;return f=>{if(f.length!==r)throw new Error("FFT: wrong Polynomial length");s&&a&&yR(f);for(let m=0,p=1;m<u-i;m++){let d=s?m+1+i:u-m,v=1<<d,g=v>>1,y=r>>d;for(let w=0;w<r;w+=v)for(let E=0,S=p++;E<g;E++){let C=o?s?r-S:S:E*y,D=w+E,H=w+E+g,K=n[C],_=f[H],x=f[D];if(l){let j=e.mul(_,K);f[D]=e.add(x,j),f[H]=e.sub(x,j)}else o?(f[D]=e.add(_,x),f[H]=e.mul(e.sub(_,x),K)):(f[D]=e.add(x,_),f[H]=e.mul(e.sub(x,_),K))}}return!s&&a&&yR(f),f}}});function Dv(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function SR(e){return Uint8Array.from(e)}function af(e,...t){let r=s=>typeof s=="number"?s:s.bytesLen,n=t.reduce((s,o)=>s+r(o),0);return{bytesLen:n,encode:s=>{let o=new Uint8Array(n);for(let i=0,a=0;i<t.length;i++){let u=t[i],l=r(u),f=typeof u=="number"?s[i]:u.encode(s[i]);nt(f,l,e),o.set(f,a),typeof u!="number"&&f.fill(0),a+=l}return o},decode:s=>{nt(s,n,e);let o=[];for(let i of t){let a=r(i),u=s.subarray(0,a);o.push(typeof i=="number"?u:i.decode(u)),s=s.subarray(a)}return o}}}function Fv(e,t){let r=t*e.bytesLen;return{bytesLen:r,encode:n=>{if(n.length!==t)throw new Error(`vecCoder.encode: wrong length=${n.length}. Expected: ${t}`);let s=new Uint8Array(r);for(let o=0,i=0;o<n.length;o++){let a=e.encode(n[o]);s.set(a,i),a.fill(0),i+=a.length}return s},decode:n=>{nt(n,r);let s=[];for(let o=0;o<n.length;o+=e.bytesLen)s.push(e.decode(n.subarray(o,o+e.bytesLen)));return s}}}function an(...e){for(let t of e)if(Array.isArray(t))for(let r of t)r.fill(0);else t.fill(0)}function G_(e){return(1<<e)-1}var bbe,Ea,ybe,Bv=re(()=>{bbe=F(I(),1);vi();vi();Ea=Lc;ybe=Uint8Array.of()});var Fbe,_R,xee,CR,DR=re(()=>{Fbe=F(I(),1);AR();Cv();Bv();_R=e=>{let{newPoly:t,N:r,Q:n,F:s,ROOT_OF_UNITY:o,brvBits:i,isKyber:a}=e,u=(E,S=n)=>{let C=E%S|0;return(C>=0?C|0:S+C|0)|0},l=(E,S=n)=>{let C=u(E,S)|0;return(C>S>>1?C-S|0:C)|0};function f(){let E=t(r);for(let S=0;S<r;S++){let C=K_(S,i),D=BigInt(o)**BigInt(C)%BigInt(n);E[S]=Number(D)|0}return E}let m=f(),p={add:(E,S)=>u((E|0)+(S|0))|0,sub:(E,S)=>u((E|0)-(S|0))|0,mul:(E,S)=>u((E|0)*(S|0))|0,inv:E=>{throw new Error("not implemented")}},d={N:r,roots:m,invertButterflies:!0,skipStages:a?1:0,brp:!1},v=V_(p,{dit:!1,...d}),g=V_(p,{dit:!0,...d});return{mod:u,smod:l,nttZetas:m,NTT:{encode:E=>v(E),decode:E=>{g(E);for(let S=0;S<E.length;S++)E[S]=u(s*E[S]);return E}},bitsCoder:(E,S)=>{let C=G_(E),D=E*(r/8);return{bytesLen:D,encode:H=>{let K=new Uint8Array(D);for(let _=0,x=0,j=0,U=0;_<H.length;_++)for(x|=(S.encode(H[_])&C)<<j,j+=E;j>=8;j-=8,x>>=8)K[U++]=x&G_(j);return K},decode:H=>{let K=t(r);for(let _=0,x=0,j=0,U=0;_<H.length;_++)for(x|=H[_]<<j,j+=8;j>=E;j-=E,x>>=E)K[U++]=S.decode(x&C);return K}}}}},xee=e=>(t,r)=>{r||(r=e.blockLen);let n=new Uint8Array(t.length+2);n.set(t);let s=t.length,o=new Uint8Array(r),i=e.create({}),a=0,u=0;return{stats:()=>({calls:a,xofs:u}),get:(l,f)=>(n[s+0]=l,n[s+1]=f,i.destroy(),i=e.create({}).update(n),a++,()=>(u++,i.xofInto(o))),clean:()=>{i.destroy(),an(o,n)}}},CR=xee(wR)});function cf(e,t){for(let r=0;r<as;r++)e[r]=e1(e[r]+t[r])}function Nee(e,t){for(let r=0;r<as;r++)e[r]=e1(e[r]-t[r])}function Lee(e,t,r,n,s){let o=e1(t*n*s+e*r),i=e1(e*n+t*r);return{c0:o,c1:i}}function Iv(e,t){for(let r=0;r<as/2;r++){let n=kee[64+(r>>1)];r&1&&(n=-n);let{c0:s,c1:o}=Lee(e[2*r+0],e[2*r+1],t[2*r+0],t[2*r+1],n);e[2*r+0]=s,e[2*r+1]=o}return e}function FR(e){let t=new Uint16Array(as);for(let r=0;r<as;){let n=e();if(n.length%3)throw new Error("SampleNTT: unaligned block");for(let s=0;r<as&&s+3<=n.length;s+=3){let o=(n[s+0]>>0|n[s+1]<<8)&4095,i=(n[s+1]>>4|n[s+2]<<4)&4095;o<Su&&(t[r++]=o),r<as&&i<Su&&(t[r++]=i)}}return t}function Q0(e,t,r,n){let s=e(n*as/4,t,r),o=new Uint16Array(as),i=fv(s),a=0;for(let u=0,l=0,f=0,m=0;u<i.length;u++){let p=i[u];for(let d=0;d<32;d++)f+=p&1,p>>=1,a+=1,a===n?(m=f,f=0):a===2*n&&(o[l++]=e1(m-f),f=0,a=0)}if(a)throw new Error(`sampleCBD: leftover bits: ${a}`);return o}function Y_(e){let t=Uee(e),{HASH256:r,HASH512:n,KDF:s}=e,{secretCoder:o,lengths:i}=t,a=af("secretKey",i.secretKey,i.publicKey,32,32),u=32,l=64;return{info:{type:"ml-kem"},lengths:{...i,seed:64,msg:u,msgRand:u,secretKey:a.bytesLen},keygen:(f=Ea(l))=>{nt(f,l,"seed");let{publicKey:m,secretKey:p}=t.keygen(f.subarray(0,32)),d=r(m),v=a.encode([p,m,d,f.subarray(32)]);return an(p,d),{publicKey:m,secretKey:v}},getPublicKey:f=>{let[m,p,d,v]=a.decode(f);return Uint8Array.from(p)},encapsulate:(f,m=Ea(u))=>{nt(f,i.publicKey,"publicKey"),nt(m,u,"message");let p=f.subarray(0,384*e.K),d=o.encode(o.decode(SR(p)));if(!Dv(d,p))throw an(d),new Error("ML-KEM.encapsulate: wrong publicKey modulus");an(d);let v=n.create().update(m).update(r(f)).digest(),g=t.encrypt(f,m,v.subarray(32,64));return an(v.subarray(32)),{cipherText:g,sharedSecret:v.subarray(0,32)}},decapsulate:(f,m)=>{nt(m,a.bytesLen,"secretKey"),nt(f,i.cipherText,"cipherText");let p=a.bytesLen-96,d=p+32,v=r(m.subarray(p/2,d));if(!Dv(v,m.subarray(d,d+32)))throw new Error("invalid secretKey: hash check failed");let[g,y,w,E]=a.decode(m),S=t.decrypt(f,g),C=n.create().update(S).update(w).digest(),D=C.subarray(0,32),H=t.encrypt(y,S,C.subarray(32,64)),K=Dv(f,H),_=s.create({dkLen:32}).update(E).update(f).digest();return an(S,H,K?_:D),K?D:_}}}function Hee(e,t,r){return ya.create({dkLen:e}).update(t).update(new Uint8Array([r])).digest()}var kbe,as,Su,Ree,Tee,e1,kee,uf,Pee,z_,Oee,Z0,Uee,W_,Rbe,t1,BR,IR=re(()=>{kbe=F(I(),1);Cv();vi();DR();Bv();as=256,Su=3329,Ree=3303,Tee=17,{mod:e1,nttZetas:kee,NTT:uf,bitsCoder:Pee}=_R({N:as,Q:Su,F:Ree,ROOT_OF_UNITY:Tee,newPoly:e=>new Uint16Array(e),brvBits:7,isKyber:!0}),z_={512:{N:as,Q:Su,K:2,ETA1:3,ETA2:2,du:10,dv:4,RBGstrength:128},768:{N:as,Q:Su,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192},1024:{N:as,Q:Su,K:4,ETA1:2,ETA2:2,du:11,dv:5,RBGstrength:256}},Oee=e=>{if(e>=12)return{encode:r=>r,decode:r=>r};let t=2**(e-1);return{encode:r=>((r<<e)+Su/2)/Su,decode:r=>r*Su+t>>>e}},Z0=e=>Pee(e,Oee(e));Uee=e=>{let{K:t,PRF:r,XOF:n,HASH512:s,ETA1:o,ETA2:i,du:a,dv:u}=e,l=Z0(1),f=Z0(u),m=Z0(a),p=af("publicKey",Fv(Z0(12),t),32),d=Fv(Z0(12),t),v=af("ciphertext",Fv(m,t),f),g=af("seed",32,32);return{secretCoder:d,lengths:{secretKey:d.bytesLen,publicKey:p.bytesLen,cipherText:v.bytesLen},keygen:y=>{nt(y,32,"seed");let w=new Uint8Array(33);w.set(y),w[32]=t;let E=s(w),[S,C]=g.decode(E),D=[],H=[];for(let x=0;x<t;x++)D.push(uf.encode(Q0(r,C,x,o)));let K=n(S);for(let x=0;x<t;x++){let j=uf.encode(Q0(r,C,t+x,o));for(let U=0;U<t;U++){let k=FR(K.get(U,x));cf(j,Iv(k,D[U]))}H.push(j)}K.clean();let _={publicKey:p.encode([H,S]),secretKey:d.encode(D)};return an(S,C,D,H,w,E),_},encrypt:(y,w,E)=>{let[S,C]=p.decode(y),D=[];for(let U=0;U<t;U++)D.push(uf.encode(Q0(r,E,U,o)));let H=n(C),K=new Uint16Array(as),_=[];for(let U=0;U<t;U++){let k=Q0(r,E,t+U,i),N=new Uint16Array(as);for(let O=0;O<t;O++){let L=FR(H.get(U,O));cf(N,Iv(L,D[O]))}cf(k,uf.decode(N)),_.push(k),cf(K,Iv(S[U],D[U])),an(N)}H.clean();let x=Q0(r,E,2*t,i);cf(x,uf.decode(K));let j=l.decode(w);return cf(j,x),an(S,D,K,x),v.encode([_,j])},decrypt:(y,w)=>{let[E,S]=v.decode(y),C=d.decode(w),D=new Uint16Array(as);for(let H=0;H<t;H++)cf(D,Iv(C[H],uf.encode(E[H])));return Nee(S,uf.decode(D)),an(D,C,E),l.encode(S)}}};W_={HASH256:of,HASH512:gR,KDF:ya,XOF:CR,PRF:Hee},Rbe=Y_({...W_,...z_[512]}),t1=Y_({...W_,...z_[768]}),BR=Y_({...W_,...z_[1024]})});function Mee(e,t=!1){let r=e.lengths,n=e.keygen;if(t){let o=e.Point.Fn;if(!o)throw new Error("No Point.Fn");n=(i=Ea(r.seed))=>{nt(i,r.seed,"seed");let a=o.isLE?Mc(i):Hc(i),u=o.toBytes(o.create(a));return{secretKey:u,publicKey:e.getPublicKey(u)}}}return{lengths:{secretKey:r.secretKey,publicKey:r.publicKey,seed:r.seed},keygen:n,getPublicKey:s=>e.getPublicKey(s)}}function X_(e,t=!1){let r=Mee(e,t);if(!e.getSharedSecret)throw new Error("wrong curve");return{lengths:{...r.lengths,msg:r.lengths.seed,cipherText:r.lengths.publicKey},keygen:r.keygen,getPublicKey:r.getPublicKey,encapsulate(n,s=Ea(e.lengths.seed)){let o=this.keygen(s).secretKey,i=this.decapsulate(n,o),a=e.getPublicKey(o);return an(o),{sharedSecret:i,cipherText:a}},decapsulate(n,s){let o=e.getSharedSecret(s,n);return e.lengths.publicKeyHasPrefix?o.subarray(1):o}}}function r1(e,t){return af(t,...e.map(r=>{if(typeof r.lengths[t]!="number")throw new Error("wrong length: "+t);return r.lengths[t]}))}function J_(e){return(t,r)=>e(t,{dkLen:r})}function qee(e,t,...r){let n=r1(r,"seed"),s=r1(r,"publicKey");e===void 0&&(e=n.bytesLen),En(e);function o(i){nt(i,e);let a=n.decode(t(i,n.bytesLen)),u=r.map((m,p)=>m.keygen(a[p])),l=u.map(m=>m.secretKey),f=u.map(m=>m.publicKey);return{secretKey:l,publicKey:f}}return{info:{lengths:{seed:e,publicKey:s.bytesLen,secretKey:e}},getPublicKey(i){return this.keygen(i).publicKey},keygen(i=Ea(e)){let{publicKey:a,secretKey:u}=o(i),l=s.encode(a);return an(a),an(u),{secretKey:i,publicKey:l}},expandDecapsulationKey:o,realSeedLen:e}}function $v(e,t,r,n,...s){let o=qee(e,r,...s),i=r1(s,"cipherText"),a=r1(s,"publicKey"),u=r1(s,"msg");return t===void 0&&(t=u.bytesLen),En(t),{lengths:{...o.info.lengths,msg:t,msgRand:u.bytesLen,cipherText:i.bytesLen},getPublicKey:o.getPublicKey,keygen:o.keygen,encapsulate(l,f=Ea(u.bytesLen)){let m=a.decode(l),p=u.decode(f),d=s.map((w,E)=>w.encapsulate(m[E],p[E])),v=d.map(w=>w.sharedSecret),g=d.map(w=>w.cipherText),y={sharedSecret:n(m,g,v),cipherText:i.encode(g)};return an(v,g),y},decapsulate(l,f){let m=i.decode(l),{publicKey:p,secretKey:d}=o.expandDecapsulationKey(f),v=s.map((g,y)=>g.decapsulate(m[y],d[y]));return n(p,m,v)}}}function $R(e,t,r,n,s){return Ki(n),Ki(s),$v(32,32,J_(n),(o,i,a)=>s(Xr(a[0],a[1],i[1],o[1],qc(e))),t,r)}function jee(e,t,r,n,s){return Ki(n),Ki(s),$v(32,32,J_(n),(o,i,a)=>{let u=Xr(a[0],a[1],i[0],o[0],i[1],o[1],qc(e)),l=32,f=Xr(qc("hybrid_prk"),u),m=oR(s,f),p=Xr(Zd(l,2),qc("shared_secret"),qc("")),d=aR(s,m,p,l);return an(m,p,f,u),d},t,r)}function Vee(e,t,r,n){let s=e.Point.Fn;if(!s)throw new Error("no Point.Fn");function o(i){let a;for(let f=0,m=t;;f=m,m+=t){if(m>i.length)throw new Error("rejection sampling failed");if(a=s.fromBytes(i.subarray(f,m),!0),s.isValidNot0(a))break}let u=s.toBytes(s.create(a)),l=e.getPublicKey(u,!1);return{secretKey:u,publicKey:l}}return{lengths:{secretKey:t,publicKey:r,seed:n,msg:n,cipherText:r},keygen(i=Ea(n)){return nt(i,n,"seed"),o(i)},getPublicKey(i){return e.getPublicKey(i,!1)},encapsulate(i,a=Ea(n)){nt(a,n,"rand");let{secretKey:u}=o(a),l=this.decapsulate(i,u),f=e.getPublicKey(u,!1);return an(u),{sharedSecret:l,cipherText:f}},decapsulate(i,a){return e.getSharedSecret(a,i).subarray(1)}}}function Gee(e,t,r,n){let{secretKey:s,publicKeyUncompressed:o}=r.lengths;if(!s||!o)throw new Error("wrong curve");let i=Vee(r,s,o,n),a=64,u=a+n;return $v(32,32,l=>{nt(l,32);let f=ya(l,{dkLen:u}),m=f.subarray(0,a),p=f.subarray(a,u);return Xr(m,p)},(l,f,m)=>of(Xr(m[0],m[1],f[1],l[1],qc(e))),t,i)}var Ybe,Kbe,Vbe,xR,Gbe,Kee,zee,xv,RR,TR=re(()=>{Ybe=F(I(),1);rR();sR();Qd();uR();H_();Cv();vi();IR();Bv();Kbe=$R("QSF-KEM(ML-KEM-768,P-256)-XOF(SHAKE256)-KDF(SHA3-256)",t1,X_(M_,!0),ya,of),Vbe=$R("QSF-KEM(ML-KEM-1024,P-384)-XOF(SHAKE256)-KDF(SHA3-256)",BR,X_(nR,!0),ya,of);xR=X_(tR),Gbe=jee("KitchenSink-KEM(ML-KEM-768,X25519)-XOF(SHAKE256)-KDF(HKDF-SHA-256)",t1,xR,ya,Sv),Kee=$v(32,32,J_(ya),(e,t,r)=>of(Xr(r[0],r[1],t[1],e[1],qc("\\.//^\\"))),t1,xR);zee=Gee("MLKEM768-P256",t1,M_,128),xv=Kee,RR=zee});function _u(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new TypeError(r+"expected boolean, got type="+typeof e)}return e}function kv(e){if(typeof e=="bigint"){if(!Rv(e))throw new RangeError("positive bigint expected, got "+e)}else Q_(e);return e}function ba(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(r+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let r=t&&`"${t}" `;throw new RangeError(r+"expected safe integer, got "+e)}}function n1(e){let t=kv(e).toString(16);return t.length&1?"0"+t:t}function kR(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Tv:BigInt("0x"+e)}function lf(e){return kR(ev(e))}function Fo(e){return kR(ev(zc(In(e)).reverse()))}function Pv(e,t){if(jr(t),t===0)throw new RangeError("zero length");e=kv(e);let r=e.toString(16);if(r.length>t*2)throw new RangeError("number too large");return I0(r.padStart(t*2,"0"))}function s1(e,t){return Pv(e,t).reverse()}function PR(e,t){if(e=mr(e),t=mr(t),e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function zc(e){return Uint8Array.from(mr(e))}function Ov(e){if(typeof e!="string")throw new TypeError("ascii string expected, got "+typeof e);return Uint8Array.from(e,(t,r)=>{let n=t.charCodeAt(0);if(t.length!==1||n>127)throw new RangeError(`string contains non-ASCII character "${e[r]}" with code ${n} at position ${r}`);return n})}function Yee(e,t,r){return Rv(e)&&Rv(t)&&Rv(r)&&t<=e&&e<r}function Cu(e,t,r,n){if(!Yee(t,r,n))throw new RangeError("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function uh(e){if(e<Tv)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Tv;e>>=Z_,t+=1);return t}function OR(e,t,r){if(jr(e,"hashLen"),jr(t,"qByteLen"),typeof r!="function")throw new TypeError("hmacFn must be a function");let n=y=>new Uint8Array(y),s=Uint8Array.of(),o=Uint8Array.of(0),i=Uint8Array.of(1),a=1e3,u=n(e),l=n(e),f=0,m=()=>{u.fill(1),l.fill(0),f=0},p=(...y)=>r(l,Tn(u,...y)),d=(y=s)=>{l=p(o,y),u=p(),y.length!==0&&(l=p(i,y),u=p())},v=()=>{if(f++>=a)throw new Error("drbg: tried max amount of iterations");let y=0,w=[];for(;y<t;){u=p();let E=u.slice();w.push(E),y+=u.length}return Tn(...w)};return(y,w)=>{m(),d(y);let E;for(;(E=w(v()))===void 0;)d();return m(),E}}function Gi(e,t={},r={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function n(o,i,a){if(!a&&i!=="function"&&!Object.hasOwn(e,o))throw new TypeError(`param "${o}" is invalid: expected own property`);let u=e[o];if(a&&u===void 0)return;let l=typeof u;if(l!==i||u===null)throw new TypeError(`param "${o}" is invalid: expected ${i}, got ${l}`)}let s=(o,i)=>Object.entries(o).forEach(([a,u])=>n(a,u,i));s(t,!1),s(r,!0)}var Jbe,mr,Q_,sh,Tn,ih,oh,ah,Tv,Z_,Rv,i1,e6,Yc=re(()=>{Jbe=F(I(),1);qi();mr=(e,t,r)=>In(e,t,r),Q_=jr,sh=ev,Tn=(...e)=>LS(...e),ih=e=>I0(e),oh=PS,ah=e=>pa(e),Tv=BigInt(0),Z_=BigInt(1);Rv=e=>typeof e=="bigint"&&Tv<=e;i1=e=>(Z_<<BigInt(e))-Z_;e6=()=>{throw new Error("not implemented")}});function br(e,t){if(t<=kn)throw new Error("mod: expected positive modulus, got "+t);let r=e%t;return r>=kn?r:t+r}function zi(e,t,r){if(t<kn)throw new Error("pow2: expected non-negative exponent, got "+t);let n=e;for(;t-- >kn;)n*=n,n%=r;return n}function NR(e,t){if(e===kn)throw new Error("invert: expected non-zero number");if(t<=kn)throw new Error("invert: expected positive modulus, got "+t);let r=br(e,t),n=t,s=kn,o=xr,i=xr,a=kn;for(;r!==kn;){let l=n/r,f=n-r*l,m=s-i*l,p=o-a*l;n=r,r=f,s=i,o=a,i=m,a=p}if(n!==xr)throw new Error("invert: does not exist");return br(s,t)}function t6(e,t,r){let n=e;if(!n.eql(n.sqr(t),r))throw new Error("Cannot find square root")}function VR(e,t){let r=e,n=(r.ORDER+xr)/MR,s=r.pow(t,n);return t6(r,s,t),s}function Jee(e,t){let r=e,n=(r.ORDER-qR)/jR,s=r.mul(t,ff),o=r.pow(s,n),i=r.mul(t,o),a=r.mul(r.mul(i,ff),o),u=r.mul(i,r.sub(a,r.ONE));return t6(r,u,t),u}function Zee(e){let t=Lv(e),r=GR(e),n=r(t,t.neg(t.ONE)),s=r(t,n),o=r(t,t.neg(n)),i=(e+Wee)/KR;return((a,u)=>{let l=a,f=l.pow(u,i),m=l.mul(f,n),p=l.mul(f,s),d=l.mul(f,o),v=l.eql(l.sqr(m),u),g=l.eql(l.sqr(p),u);f=l.cmov(f,m,v),m=l.cmov(d,p,g);let y=l.eql(l.sqr(m),u),w=l.cmov(f,m,y);return t6(l,w,u),w})}function GR(e){if(e<HR)throw new Error("sqrt is not defined for small field");let t=e-xr,r=0;for(;t%ff===kn;)t/=ff,r++;let n=ff,s=Lv(e);for(;LR(s,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return VR;let o=s.pow(n,t),i=(t+xr)/ff;return function(u,l){let f=u;if(f.is0(l))return l;if(LR(f,l)!==1)throw new Error("Cannot find square root");let m=r,p=f.mul(f.ONE,o),d=f.pow(l,t),v=f.pow(l,i);for(;!f.eql(d,f.ONE);){if(f.is0(d))return f.ZERO;let g=1,y=f.sqr(d);for(;!f.eql(y,f.ONE);)if(g++,y=f.sqr(y),g===m)throw new Error("Cannot find square root");let w=xr<<BigInt(m-g-1),E=f.pow(p,w);m=g,p=f.sqr(E),d=f.mul(d,p),v=f.mul(v,E)}return v}}function Qee(e){return e%MR===HR?VR:e%jR===qR?Jee:e%KR===Xee?Zee(e):GR(e)}function r6(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=ete.reduce((n,s)=>(n[s]="function",n),t);if(Gi(e,r),ba(e.BYTES,"BYTES"),ba(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=xr)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function tte(e,t,r){let n=e;if(r<kn)throw new Error("invalid exponent, negatives unsupported");if(r===kn)return n.ONE;if(r===xr)return t;let s=n.ONE,o=t;for(;r>kn;)r&xr&&(s=n.mul(s,o)),o=n.sqr(o),r>>=xr;return s}function o1(e,t,r=!1){let n=e,s=new Array(t.length).fill(r?n.ZERO:void 0),o=t.reduce((a,u,l)=>n.is0(u)?a:(s[l]=a,n.mul(a,u)),n.ONE),i=n.inv(o);return t.reduceRight((a,u,l)=>n.is0(u)?a:(s[l]=n.mul(a,s[l]),n.mul(a,u)),i),s}function LR(e,t){let r=e,n=(r.ORDER-xr)/ff,s=r.pow(t,n),o=r.eql(s,r.ONE),i=r.eql(s,r.ZERO),a=r.eql(s,r.neg(r.ONE));if(!o&&!i&&!a)throw new Error("invalid Legendre symbol result");return o?1:i?0:-1}function rte(e,t){if(t!==void 0&&Q_(t),e<=kn)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);let r=uh(e);if(t!==void 0&&t<r)throw new Error(`invalid n length: expected bit length (${r}) >= n.length (${t})`);let n=t!==void 0?t:r,s=Math.ceil(n/8);return{nBitLength:n,nByteLength:s}}function Lv(e,t={}){return new Nv(e,t)}function zR(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=xr)throw new Error("field order must be greater than 1");let t=uh(e-xr);return Math.ceil(t/8)}function n6(e){let t=zR(e);return t+Math.ceil(t/2)}function YR(e,t,r=!1){mr(e);let n=e.length,s=zR(t),o=Math.max(n6(t),16);if(n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let i=r?Fo(e):lf(e),a=br(i,t-xr)+xr;return r?s1(a,s):Pv(a,s)}var eAe,kn,xr,ff,HR,MR,qR,Wee,jR,Xee,KR,Du,ete,UR,Nv,a1=re(()=>{eAe=F(I(),1);Yc();kn=BigInt(0),xr=BigInt(1),ff=BigInt(2),HR=BigInt(3),MR=BigInt(4),qR=BigInt(5),Wee=BigInt(7),jR=BigInt(8),Xee=BigInt(9),KR=BigInt(16);Du=(e,t)=>(br(e,t)&xr)===xr,ete=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];UR=new WeakMap,Nv=class{ORDER;BITS;BYTES;isLE;ZERO=kn;ONE=xr;_lengths;_mod;constructor(t,r={}){if(t<=xr)throw new Error("invalid field: expected ORDER > 1, got "+t);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:r.sqrt,enumerable:!0}),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=Object.freeze(r.allowedLengths.slice())),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:s,nByteLength:o}=rte(t,n);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=s,this.BYTES=o,Object.freeze(this)}create(t){return br(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return kn<=t&&t<this.ORDER}is0(t){return t===kn}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&xr)===xr}neg(t){return br(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return br(t*t,this.ORDER)}add(t,r){return br(t+r,this.ORDER)}sub(t,r){return br(t-r,this.ORDER)}mul(t,r){return br(t*r,this.ORDER)}pow(t,r){return tte(this,t,r)}div(t,r){return br(t*NR(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return NR(t,this.ORDER)}sqrt(t){let r=UR.get(this);return r||UR.set(this,r=Qee(this.ORDER)),r(this,t)}toBytes(t){return this.isLE?s1(t,this.BYTES):Pv(t,this.BYTES)}fromBytes(t,r=!1){mr(t);let{_lengths:n,BYTES:s,isLE:o,ORDER:i,_mod:a}=this;if(n){if(t.length<1||!n.includes(t.length)||t.length>s)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let l=new Uint8Array(s);l.set(t,o?0:l.length-t.length),t=l}if(t.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+t.length);let u=o?Fo(t):lf(t);if(a&&(u=br(u,i)),!r&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(t){return o1(this,t)}cmov(t,r,n){return _u(n,"condition"),n?r:t}};Object.freeze(Nv.prototype)});function u1(e,t){let r=t.negate();return e?r:t}function hf(e,t){let r=o1(e.Fp,t.map(n=>n.Z));return t.map((n,s)=>e.fromAffine(n.toAffine(r[s])))}function ZR(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function s6(e,t){ZR(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),s=2**e,o=i1(e),i=BigInt(e);return{windows:r,windowSize:n,mask:o,maxNumber:s,shiftBy:i}}function WR(e,t,r){let{windowSize:n,mask:s,maxNumber:o,shiftBy:i}=r,a=Number(e&s),u=e>>i;a>n&&(a-=o,u+=df);let l=t*n,f=l+Math.abs(a)-1,m=a===0,p=a<0,d=t%2!==0;return{nextN:u,offset:f,isZero:m,isNeg:p,isNegF:d,offsetF:l}}function o6(e){return QR.get(e)||1}function XR(e){if(e!==ch)throw new Error("invalid wNAF")}function eT(e,t,r,n){let s=t,o=e.ZERO,i=e.ZERO;for(;r>ch||n>ch;)r&df&&(o=o.add(s)),n&df&&(i=i.add(s)),s=s.double(),r>>=df,n>>=df;return{p1:o,p2:i}}function JR(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return r6(t),t}else return Lv(e,{isLE:r})}function Uv(e,t,r={},n){if(n===void 0&&(n=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(let u of["p","n","h"]){let l=t[u];if(!(typeof l=="bigint"&&l>ch))throw new Error(`CURVE.${u} must be positive bigint`)}let s=JR(t.p,r.Fp,n),o=JR(t.n,r.Fn,n),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let u of a)if(!s.isValid(t[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:s,Fn:o}}function c1(e,t){return function(n){let s=e(n);return{secretKey:s,publicKey:t(s)}}}var sAe,ch,df,i6,QR,lh,Hv=re(()=>{sAe=F(I(),1);Yc();a1();ch=BigInt(0),df=BigInt(1);i6=new WeakMap,QR=new WeakMap;lh=class{BASE;ZERO;Fn;bits;constructor(t,r){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=r}_unsafeLadder(t,r,n=this.ZERO){let s=t;for(;r>ch;)r&df&&(n=n.add(s)),s=s.double(),r>>=df;return n}precomputeWindow(t,r){let{windows:n,windowSize:s}=s6(r,this.bits),o=[],i=t,a=i;for(let u=0;u<n;u++){a=i,o.push(a);for(let l=1;l<s;l++)a=a.add(i),o.push(a);i=a.double()}return o}wNAF(t,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let s=this.ZERO,o=this.BASE,i=s6(t,this.bits);for(let a=0;a<i.windows;a++){let{nextN:u,offset:l,isZero:f,isNeg:m,isNegF:p,offsetF:d}=WR(n,a,i);n=u,f?o=o.add(u1(p,r[d])):s=s.add(u1(m,r[l]))}return XR(n),{p:s,f:o}}wNAFUnsafe(t,r,n,s=this.ZERO){let o=s6(t,this.bits);for(let i=0;i<o.windows&&n!==ch;i++){let{nextN:a,offset:u,isZero:l,isNeg:f}=WR(n,i,o);if(n=a,!l){let m=r[u];s=s.add(f?m.negate():m)}}return XR(n),s}getPrecomputes(t,r,n){let s=i6.get(r);return s||(s=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(s=n(s)),i6.set(r,s))),s}cached(t,r,n){let s=o6(t);return this.wNAF(s,this.getPrecomputes(s,t,n),r)}unsafe(t,r,n,s){let o=o6(t);return o===1?this._unsafeLadder(t,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),r,s)}createCache(t,r){ZR(r,this.bits),QR.set(t,r),i6.delete(t)}hasCache(t){return o6(t)!==1}}});function l1(e,t){if(ba(e),ba(t),t<0||t>4)throw new Error("invalid I2OSP length: "+t);if(e<0||e>2**(8*t)-1)throw new Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=e&255,e>>>=8;return new Uint8Array(r)}function nte(e,t){let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}function ste(e){if(!oh(e)&&typeof e!="string")throw new Error("DST must be Uint8Array or ascii string");let t=typeof e=="string"?Ov(e):e;if(t.length===0)throw new Error("DST must be non-empty");return t}function a6(e,t,r,n){mr(e),ba(r),t=ste(t),t.length>255&&(t=n(Tn(Ov("H2C-OVERSIZE-DST-"),t)));let{outputLen:s,blockLen:o}=n,i=Math.ceil(r/s);if(r>65535||i>255)throw new Error("expand_message_xmd: invalid lenInBytes");let a=Tn(t,l1(t.length,1)),u=new Uint8Array(o),l=l1(r,2),f=new Array(i),m=n(Tn(u,e,l,l1(0,1),a));f[0]=n(Tn(m,l1(1,1),a));for(let d=1;d<i;d++){let v=[nte(m,f[d-1]),l1(d+1,1),a];f[d]=n(Tn(...v))}return Tn(...f).slice(0,r)}var aAe,tT,rT=re(()=>{aAe=F(I(),1);Yc();tT="HashToScalar-"});function ite(e,t,r){Cu("scalar",e,Aa,r);let[[n,s],[o,i]]=t,a=nT(i*e,r),u=nT(-s*e,r),l=e-a*n-u*o,f=-a*s-u*i,m=l<Aa,p=f<Aa;m&&(l=-l),p&&(f=-f);let d=i1(Math.ceil(uh(r)/2))+Wc;if(l<Aa||l>=d||f<Aa||f>=d)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:l,k2neg:p,k2:f}}function c6(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function u6(e,t){Gi(e);let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return _u(r.lowS,"lowS"),_u(r.prehash,"prehash"),r.format!==void 0&&c6(r.format),r}function iT(e,t={}){let r=Uv("weierstrass",e,t),n=r.Fp,s=r.Fn,o=r.CURVE,{h:i,n:a}=o;Gi(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:u,allowInfinityPoint:l}=t;if(u&&(!n.is0(o.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let f=aT(n,s);function m(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function p(U,k,N){if(l&&k.is0())return Uint8Array.of(0);let{x:O,y:L}=k.toAffine(),T=n.toBytes(O);if(_u(N,"isCompressed"),N){m();let M=!n.isOdd(L);return Tn(oT(M),T)}else return Tn(Uint8Array.of(4),T,n.toBytes(L))}function d(U){mr(U,void 0,"Point");let{publicKey:k,publicKeyUncompressed:N}=f,O=U.length,L=U[0],T=U.subarray(1);if(l&&O===1&&L===0)return{x:n.ZERO,y:n.ZERO};if(O===k&&(L===2||L===3)){let M=n.fromBytes(T);if(!n.isValid(M))throw new Error("bad point: is not on curve, wrong x");let W=y(M),G;try{G=n.sqrt(W)}catch(ie){let ge=ie instanceof Error?": "+ie.message:"";throw new Error("bad point: is not on curve, sqrt error"+ge)}m();let J=n.isOdd(G);return(L&1)===1!==J&&(G=n.neg(G)),{x:M,y:G}}else if(O===N&&L===4){let M=n.BYTES,W=n.fromBytes(T.subarray(0,M)),G=n.fromBytes(T.subarray(M,M*2));if(!w(W,G))throw new Error("bad point: is not on curve");return{x:W,y:G}}else throw new Error(`bad point: got length ${O}, expected compressed=${k} or uncompressed=${N}`)}let v=t.toBytes===void 0?p:t.toBytes,g=t.fromBytes===void 0?d:t.fromBytes;function y(U){let k=n.sqr(U),N=n.mul(k,U);return n.add(n.add(N,n.mul(U,o.a)),o.b)}function w(U,k){let N=n.sqr(k),O=y(U);return n.eql(N,O)}if(!w(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let E=n.mul(n.pow(o.a,Mv),ote),S=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(E,S)))throw new Error("bad curve params: a or b");function C(U,k,N=!1){if(!n.isValid(k)||N&&n.is0(k))throw new Error(`bad point coordinate ${U}`);return k}function D(U){if(!(U instanceof _))throw new Error("Weierstrass Point expected")}function H(U){if(!u||!u.basises)throw new Error("no endo");return ite(U,u.basises,s.ORDER)}function K(U,k,N,O,L){return N=new _(n.mul(N.X,U),N.Y,N.Z),k=u1(O,k),N=u1(L,N),k.add(N)}class _{static BASE=new _(o.Gx,o.Gy,n.ONE);static ZERO=new _(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=s;X;Y;Z;constructor(k,N,O){this.X=C("x",k),this.Y=C("y",N,!0),this.Z=C("z",O),Object.freeze(this)}static CURVE(){return o}static fromAffine(k){let{x:N,y:O}=k||{};if(!k||!n.isValid(N)||!n.isValid(O))throw new Error("invalid affine point");if(k instanceof _)throw new Error("projective point not allowed");return n.is0(N)&&n.is0(O)?_.ZERO:new _(N,O,n.ONE)}static fromBytes(k){let N=_.fromAffine(g(mr(k,void 0,"point")));return N.assertValidity(),N}static fromHex(k){return _.fromBytes(ih(k))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(k=8,N=!0){return j.createCache(this,k),N||this.multiply(Mv),this}assertValidity(){let k=this;if(k.is0()){if(t.allowInfinityPoint&&n.is0(k.X)&&n.eql(k.Y,n.ONE)&&n.is0(k.Z))return;throw new Error("bad point: ZERO")}let{x:N,y:O}=k.toAffine();if(!n.isValid(N)||!n.isValid(O))throw new Error("bad point: x or y not field elements");if(!w(N,O))throw new Error("bad point: equation left != right");if(!k.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:k}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(k)}equals(k){D(k);let{X:N,Y:O,Z:L}=this,{X:T,Y:M,Z:W}=k,G=n.eql(n.mul(N,W),n.mul(T,L)),J=n.eql(n.mul(O,W),n.mul(M,L));return G&&J}negate(){return new _(this.X,n.neg(this.Y),this.Z)}double(){let{a:k,b:N}=o,O=n.mul(N,Mv),{X:L,Y:T,Z:M}=this,W=n.ZERO,G=n.ZERO,J=n.ZERO,te=n.mul(L,L),ie=n.mul(T,T),ge=n.mul(M,M),he=n.mul(L,T);return he=n.add(he,he),J=n.mul(L,M),J=n.add(J,J),W=n.mul(k,J),G=n.mul(O,ge),G=n.add(W,G),W=n.sub(ie,G),G=n.add(ie,G),G=n.mul(W,G),W=n.mul(he,W),J=n.mul(O,J),ge=n.mul(k,ge),he=n.sub(te,ge),he=n.mul(k,he),he=n.add(he,J),J=n.add(te,te),te=n.add(J,te),te=n.add(te,ge),te=n.mul(te,he),G=n.add(G,te),ge=n.mul(T,M),ge=n.add(ge,ge),te=n.mul(ge,he),W=n.sub(W,te),J=n.mul(ge,ie),J=n.add(J,J),J=n.add(J,J),new _(W,G,J)}add(k){D(k);let{X:N,Y:O,Z:L}=this,{X:T,Y:M,Z:W}=k,G=n.ZERO,J=n.ZERO,te=n.ZERO,ie=o.a,ge=n.mul(o.b,Mv),he=n.mul(N,T),Fe=n.mul(O,M),ke=n.mul(L,W),$e=n.add(N,O),oe=n.add(T,M);$e=n.mul($e,oe),oe=n.add(he,Fe),$e=n.sub($e,oe),oe=n.add(N,L);let me=n.add(T,W);return oe=n.mul(oe,me),me=n.add(he,ke),oe=n.sub(oe,me),me=n.add(O,L),G=n.add(M,W),me=n.mul(me,G),G=n.add(Fe,ke),me=n.sub(me,G),te=n.mul(ie,oe),G=n.mul(ge,ke),te=n.add(G,te),G=n.sub(Fe,te),te=n.add(Fe,te),J=n.mul(G,te),Fe=n.add(he,he),Fe=n.add(Fe,he),ke=n.mul(ie,ke),oe=n.mul(ge,oe),Fe=n.add(Fe,ke),ke=n.sub(he,ke),ke=n.mul(ie,ke),oe=n.add(oe,ke),he=n.mul(Fe,oe),J=n.add(J,he),he=n.mul(me,oe),G=n.mul($e,G),G=n.sub(G,he),he=n.mul($e,Fe),te=n.mul(me,te),te=n.add(te,he),new _(G,J,te)}subtract(k){return D(k),this.add(k.negate())}is0(){return this.equals(_.ZERO)}multiply(k){let{endo:N}=t;if(!s.isValidNot0(k))throw new RangeError("invalid scalar: out of range");let O,L,T=M=>j.cached(this,M,W=>hf(_,W));if(N){let{k1neg:M,k1:W,k2neg:G,k2:J}=H(k),{p:te,f:ie}=T(W),{p:ge,f:he}=T(J);L=ie.add(he),O=K(N.beta,te,ge,M,G)}else{let{p:M,f:W}=T(k);O=M,L=W}return hf(_,[O,L])[0]}multiplyUnsafe(k){let{endo:N}=t,O=this,L=k;if(!s.isValid(L))throw new RangeError("invalid scalar: out of range");if(L===Aa||O.is0())return _.ZERO;if(L===Wc)return O;if(j.hasCache(this))return this.multiply(L);if(N){let{k1neg:T,k1:M,k2neg:W,k2:G}=H(L),{p1:J,p2:te}=eT(_,O,M,G);return K(N.beta,J,te,T,W)}else return j.unsafe(O,L)}toAffine(k){let N=this,O=k,{X:L,Y:T,Z:M}=N;if(n.eql(M,n.ONE))return{x:L,y:T};let W=N.is0();O==null&&(O=W?n.ONE:n.inv(M));let G=n.mul(L,O),J=n.mul(T,O),te=n.mul(M,O);if(W)return{x:n.ZERO,y:n.ZERO};if(!n.eql(te,n.ONE))throw new Error("invZ was invalid");return{x:G,y:J}}isTorsionFree(){let{isTorsionFree:k}=t;return i===Wc?!0:k?k(_,this):j.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:k}=t;return i===Wc?this:k?k(_,this):this.multiplyUnsafe(i)}isSmallOrder(){return i===Wc?this.is0():this.clearCofactor().is0()}toBytes(k=!0){return _u(k,"isCompressed"),this.assertValidity(),v(_,this,k)}toHex(k=!0){return sh(this.toBytes(k))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let x=s.BITS,j=new lh(_,t.endo?Math.ceil(x/2):x);return x>=8&&_.BASE.precompute(8),Object.freeze(_.prototype),Object.freeze(_),_}function oT(e){return Uint8Array.of(e?2:3)}function aT(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function ate(e,t={}){let{Fn:r}=e,n=t.randomBytes===void 0?ah:t.randomBytes,s=Object.assign(aT(e.Fp,r),{seed:Math.max(n6(r.ORDER),16)});function o(d){try{let v=r.fromBytes(d);return r.isValidNot0(v)}catch{return!1}}function i(d,v){let{publicKey:g,publicKeyUncompressed:y}=s;try{let w=d.length;return v===!0&&w!==g||v===!1&&w!==y?!1:!!e.fromBytes(d)}catch{return!1}}function a(d){return d=d===void 0?n(s.seed):d,YR(mr(d,s.seed,"seed"),r.ORDER)}function u(d,v=!0){return e.BASE.multiply(r.fromBytes(d)).toBytes(v)}function l(d){let{secretKey:v,publicKey:g,publicKeyUncompressed:y}=s,w=r._lengths;if(!oh(d))return;let E=mr(d,void 0,"key").length,S=E===g||E===y,C=E===v||!!w?.includes(E);if(!(S&&C))return S}function f(d,v,g=!0){if(l(d)===!0)throw new Error("first arg must be private key");if(l(v)===!1)throw new Error("second arg must be public key");let y=r.fromBytes(d);return e.fromBytes(v).multiply(y).toBytes(g)}let m={isValidSecretKey:o,isValidPublicKey:i,randomSecretKey:a},p=c1(a,u);return Object.freeze(m),Object.freeze(s),Object.freeze({getPublicKey:u,getSharedSecret:f,keygen:p,Point:e,utils:m,lengths:s})}function uT(e,t,r={}){let n=t;gu(n),Gi(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let s=r.randomBytes===void 0?ah:r.randomBytes,o=r.hmac===void 0?(L,T)=>ma(n,L,T):r.hmac,{Fp:i,Fn:a}=e,{ORDER:u,BITS:l}=a,{keygen:f,getPublicKey:m,getSharedSecret:p,utils:d,lengths:v}=ate(e,r),g={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},y=u*sT+Wc<i.ORDER;function w(L){let T=u>>Wc;return L>T}function E(L,T){if(!a.isValidNot0(T))throw new Error(`invalid signature ${L}: out of range 1..Point.Fn.ORDER`);return T}function S(){if(y)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function C(L,T){c6(T);let M=v.signature,W=T==="compact"?M:T==="recovered"?M+1:void 0;return mr(L,W)}class D{r;s;recovery;constructor(T,M,W){if(this.r=E("r",T),this.s=E("s",M),W!=null){if(S(),![0,1,2,3].includes(W))throw new Error("invalid recovery id");this.recovery=W}Object.freeze(this)}static fromBytes(T,M=g.format){C(T,M);let W;if(M==="der"){let{r:ie,s:ge}=Bo.toSig(mr(T));return new D(ie,ge)}M==="recovered"&&(W=T[0],M="compact",T=T.subarray(1));let G=v.signature/2,J=T.subarray(0,G),te=T.subarray(G,G*2);return new D(a.fromBytes(J),a.fromBytes(te),W)}static fromHex(T,M){return this.fromBytes(ih(T),M)}assertRecovery(){let{recovery:T}=this;if(T==null)throw new Error("invalid recovery id: must be present");return T}addRecoveryBit(T){return new D(this.r,this.s,T)}recoverPublicKey(T){let{r:M,s:W}=this,G=this.assertRecovery(),J=G===2||G===3?M+u:M;if(!i.isValid(J))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let te=i.toBytes(J),ie=e.fromBytes(Tn(oT((G&1)===0),te)),ge=a.inv(J),he=K(mr(T,void 0,"msgHash")),Fe=a.create(-he*ge),ke=a.create(W*ge),$e=e.BASE.multiplyUnsafe(Fe).add(ie.multiplyUnsafe(ke));if($e.is0())throw new Error("invalid recovery: point at infinify");return $e.assertValidity(),$e}hasHighS(){return w(this.s)}toBytes(T=g.format){if(c6(T),T==="der")return ih(Bo.hexFromSig(this));let{r:M,s:W}=this,G=a.toBytes(M),J=a.toBytes(W);return T==="recovered"?(S(),Tn(Uint8Array.of(this.assertRecovery()),G,J)):Tn(G,J)}toHex(T){return sh(this.toBytes(T))}}Object.freeze(D.prototype),Object.freeze(D);let H=r.bits2int===void 0?function(T){if(T.length>8192)throw new Error("input is too large");let M=lf(T),W=T.length*8-l;return W>0?M>>BigInt(W):M}:r.bits2int,K=r.bits2int_modN===void 0?function(T){return a.create(H(T))}:r.bits2int_modN,_=i1(l);function x(L){return Cu("num < 2^"+l,L,Aa,_),a.toBytes(L)}function j(L,T){return mr(L,void 0,"message"),T?mr(n(L),void 0,"prehashed message"):L}function U(L,T,M){let{lowS:W,prehash:G,extraEntropy:J}=u6(M,g);L=j(L,G);let te=K(L),ie=a.fromBytes(T);if(!a.isValidNot0(ie))throw new Error("invalid private key");let ge=[x(ie),x(te)];if(J!=null&&J!==!1){let $e=J===!0?s(v.secretKey):J;ge.push(mr($e,void 0,"extraEntropy"))}let he=Tn(...ge),Fe=te;function ke($e){let oe=H($e);if(!a.isValidNot0(oe))return;let me=a.inv(oe),Be=e.BASE.multiply(oe).toAffine(),Ue=a.create(Be.x);if(Ue===Aa)return;let We=a.create(me*a.create(Fe+Ue*ie));if(We===Aa)return;let He=(Be.x===Ue?0:2)|Number(Be.y&Wc),St=We;return W&&w(We)&&(St=a.neg(We),He^=1),new D(Ue,St,y?void 0:He)}return{seed:he,k2sig:ke}}function k(L,T,M={}){let{seed:W,k2sig:G}=U(L,T,M);return OR(n.outputLen,a.BYTES,o)(W,G).toBytes(M.format)}function N(L,T,M,W={}){let{lowS:G,prehash:J,format:te}=u6(W,g);if(M=mr(M,void 0,"publicKey"),T=j(T,J),!oh(L)){let ie=L instanceof D?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+ie)}C(L,te);try{let ie=D.fromBytes(L,te),ge=e.fromBytes(M);if(G&&ie.hasHighS())return!1;let{r:he,s:Fe}=ie,ke=K(T),$e=a.inv(Fe),oe=a.create(ke*$e),me=a.create(he*$e),Be=e.BASE.multiplyUnsafe(oe).add(ge.multiplyUnsafe(me));return Be.is0()?!1:a.create(Be.x)===he}catch{return!1}}function O(L,T,M={}){let{prehash:W}=u6(M,g);return T=j(T,W),D.fromBytes(L,"recovered").recoverPublicKey(T).toBytes()}return Object.freeze({keygen:f,getPublicKey:m,getSharedSecret:p,utils:d,lengths:v,Point:e,sign:k,verify:N,recoverPublicKey:O,Signature:D,hash:n})}var mAe,nT,l6,Bo,Aa,Wc,sT,Mv,ote,cT=re(()=>{mAe=F(I(),1);$0();qi();Yc();Hv();a1();nT=(e,t)=>(e+(e>=0?t:-t)/sT)/t;l6=class extends Error{constructor(t=""){super(t)}},Bo={Err:l6,_tlv:{encode:(e,t)=>{let{Err:r}=Bo;if(ba(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,s=n1(n);if(s.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?n1(s.length/2|128):"";return n1(e)+o+s+t},decode(e,t){let{Err:r}=Bo;t=mr(t,void 0,"DER data");let n=0;if(e<0||e>255)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let s=t[n++],o=!!(s&128),i=0;if(!o)i=s;else{let u=s&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");let l=t.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of l)i=i<<8|f;if(n+=u,i<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+i);if(a.length!==i)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+i)}}},_int:{encode(e){let{Err:t}=Bo;if(kv(e),e<Aa)throw new t("integer: negative integers are not allowed");let r=n1(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=Bo;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return lf(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=Bo,s=mr(e,void 0,"signature"),{v:o,l:i}=n.decode(48,s);if(i.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:u}=n.decode(2,o),{v:l,l:f}=n.decode(2,u);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=Bo,n=t.encode(2,r.encode(e.r)),s=t.encode(2,r.encode(e.s)),o=n+s;return t.encode(48,o)}};Object.freeze(Bo._tlv);Object.freeze(Bo._int);Object.freeze(Bo);Aa=BigInt(0),Wc=BigInt(1),sT=BigInt(2),Mv=BigInt(3),ote=BigInt(4)});var bAe,ute,cte,fh,lT=re(()=>{bAe=F(I(),1);Gd();cT();ute={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},cte=iT(ute),fh=uT(cte,Kr)});function fte(e,t,r,n){let s=e.sqr(r),o=e.sqr(n),i=e.add(e.mul(t.a,s),o),a=e.add(e.ONE,e.mul(t.d,e.mul(s,o)));return e.eql(i,a)}function fT(e,t={}){let r=t,n=Uv("edwards",e,r,r.FpFnLE),{Fp:s,Fn:o}=n,i=n.CURVE,{h:a}=i;Gi(r,{},{uvRatio:"function"});let u=f6<<BigInt(o.BYTES*8)-Js,l=g=>s.create(g),f=r.uvRatio===void 0?(g,y)=>{try{return{isValid:!0,value:s.sqrt(s.div(g,y))}}catch{return{isValid:!1,value:Xc}}}:r.uvRatio;if(!fte(s,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function m(g,y,w=!1){let E=w?Js:Xc;return Cu("coordinate "+g,y,E,u),y}function p(g){if(!(g instanceof d))throw new Error("EdwardsPoint expected")}class d{static BASE=new d(i.Gx,i.Gy,Js,l(i.Gx*i.Gy));static ZERO=new d(Xc,Js,Js,Xc);static Fp=s;static Fn=o;X;Y;Z;T;constructor(y,w,E,S){this.X=m("x",y),this.Y=m("y",w),this.Z=m("z",E,!0),this.T=m("t",S),Object.freeze(this)}static CURVE(){return i}static fromAffine(y){if(y instanceof d)throw new Error("extended point not allowed");let{x:w,y:E}=y||{};return m("x",w),m("y",E),new d(w,E,Js,l(w*E))}static fromBytes(y,w=!1){let E=s.BYTES,{a:S,d:C}=i;y=zc(mr(y,E,"point")),_u(w,"zip215");let D=zc(y),H=y[E-1];D[E-1]=H&-129;let K=Fo(D),_=w?u:s.ORDER;Cu("point.y",K,Xc,_);let x=l(K*K),j=l(x-Js),U=l(C*x-S),{isValid:k,value:N}=f(j,U);if(!k)throw new Error("bad point: invalid y coordinate");let O=(N&Js)===Js,L=(H&128)!==0;if(!w&&N===Xc&&L)throw new Error("bad point: x=0 and x_0=1");return L!==O&&(N=l(-N)),d.fromAffine({x:N,y:K})}static fromHex(y,w=!1){return d.fromBytes(ih(y),w)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,w=!0){return v.createCache(this,y),w||this.multiply(f6),this}assertValidity(){let y=this,{a:w,d:E}=i;if(y.is0())throw new Error("bad point: ZERO");let{X:S,Y:C,Z:D,T:H}=y,K=l(S*S),_=l(C*C),x=l(D*D),j=l(x*x),U=l(K*w),k=l(x*l(U+_)),N=l(j+l(E*l(K*_)));if(k!==N)throw new Error("bad point: equation left != right (1)");let O=l(S*C),L=l(D*H);if(O!==L)throw new Error("bad point: equation left != right (2)")}equals(y){p(y);let{X:w,Y:E,Z:S}=this,{X:C,Y:D,Z:H}=y,K=l(w*H),_=l(C*S),x=l(E*H),j=l(D*S);return K===_&&x===j}is0(){return this.equals(d.ZERO)}negate(){return new d(l(-this.X),this.Y,this.Z,l(-this.T))}double(){let{a:y}=i,{X:w,Y:E,Z:S}=this,C=l(w*w),D=l(E*E),H=l(f6*l(S*S)),K=l(y*C),_=w+E,x=l(l(_*_)-C-D),j=K+D,U=j-H,k=K-D,N=l(x*U),O=l(j*k),L=l(x*k),T=l(U*j);return new d(N,O,T,L)}add(y){p(y);let{a:w,d:E}=i,{X:S,Y:C,Z:D,T:H}=this,{X:K,Y:_,Z:x,T:j}=y,U=l(S*K),k=l(C*_),N=l(H*E*j),O=l(D*x),L=l((S+C)*(K+_)-U-k),T=O-N,M=O+N,W=l(k-w*U),G=l(L*T),J=l(M*W),te=l(L*W),ie=l(T*M);return new d(G,J,ie,te)}subtract(y){return p(y),this.add(y.negate())}multiply(y){if(!o.isValidNot0(y))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:w,f:E}=v.cached(this,y,S=>hf(d,S));return hf(d,[w,E])[0]}multiplyUnsafe(y){if(!o.isValid(y))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return y===Xc?d.ZERO:this.is0()||y===Js?this:v.unsafe(this,y,w=>hf(d,w))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return v.unsafe(this,i.n).is0()}toAffine(y){let w=this,E=y,{X:S,Y:C,Z:D}=w,H=w.is0();E==null&&(E=H?lte:s.inv(D));let K=l(S*E),_=l(C*E),x=s.mul(D,E);if(H)return{x:Xc,y:Js};if(x!==Js)throw new Error("invZ was invalid");return{x:K,y:_}}clearCofactor(){return a===Js?this:this.multiplyUnsafe(a)}toBytes(){let{x:y,y:w}=this.toAffine(),E=s.toBytes(w);return E[E.length-1]|=y&Js?128:0,E}toHex(){return sh(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let v=new lh(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}var CAe,Xc,Js,f6,lte,qv,dT=re(()=>{CAe=F(I(),1);Yc();Hv();Xc=BigInt(0),Js=BigInt(1),f6=BigInt(2),lte=BigInt(8);qv=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(t){this.ep=t}static fromBytes(t){e6()}static fromHex(t){e6()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return sh(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,r){return this.ep.precompute(t,r),this}}});function dte(e){return Gi(e,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...e})}function hT(e){let t=dte(e),{P:r,type:n,adjustScalarBytes:s,powPminus2:o,randomBytes:i}=t,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");let u=i===void 0?ah:i,l=a?255:448,f=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?jv**BigInt(254):jv**BigInt(447),v=a?BigInt(8)*jv**BigInt(251)-dh:BigInt(4)*jv**BigInt(445)-dh,g=d+v+dh,y=O=>br(O,r),w=E(m);function E(O){return s1(y(O),f)}function S(O){let L=zc(mr(O,f,"uCoordinate"));return a&&(L[31]&=127),y(Fo(L))}function C(O){return Fo(s(zc(mr(O,f,"scalar"))))}function D(O,L){let T=j(S(L),C(O));if(T===f1)throw new Error("invalid private or public key received");return E(T)}function H(O){return D(O,w)}let K=H,_=D;function x(O,L,T){let M=y(O*(L-T));return L=y(L-M),T=y(T+M),{x_2:L,x_3:T}}function j(O,L){Cu("u",O,f1,r),Cu("scalar",L,d,g);let T=L,M=O,W=dh,G=f1,J=O,te=dh,ie=f1;for(let he=BigInt(l-1);he>=f1;he--){let Fe=T>>he&dh;ie^=Fe,{x_2:W,x_3:J}=x(ie,W,J),{x_2:G,x_3:te}=x(ie,G,te),ie=Fe;let ke=W+G,$e=y(ke*ke),oe=W-G,me=y(oe*oe),Be=$e-me,Ue=J+te,We=J-te,He=y(We*ke),St=y(Ue*oe),st=He+St,wt=He-St;J=y(st*st),te=y(M*y(wt*wt)),W=y($e*me),G=y(Be*($e+y(p*Be)))}({x_2:W,x_3:J}=x(ie,W,J)),{x_2:G,x_3:te}=x(ie,G,te);let ge=o(G);return y(W*ge)}let U={secretKey:f,publicKey:f,seed:f},k=O=>(O=O===void 0?u(f):O,mr(O,U.seed,"seed"),O),N={randomSecretKey:k};return Object.freeze(U),Object.freeze(N),Object.freeze({keygen:c1(k,K),getSharedSecret:_,getPublicKey:K,scalarMult:D,scalarMultBase:H,utils:N,GuBytes:w.slice(),lengths:U})}var $Ae,f1,dh,jv,pT=re(()=>{$Ae=F(I(),1);Yc();Hv();a1();f1=BigInt(0),dh=BigInt(1),jv=BigInt(2)});function wT(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),s=BigInt(80),o=mf,a=e*e%o*e%o,u=zi(a,mT,o)*a%o,l=zi(u,Fu,o)*e%o,f=zi(l,mte,o)*l%o,m=zi(f,t,o)*f%o,p=zi(m,r,o)*m%o,d=zi(p,n,o)*p%o,v=zi(d,s,o)*d%o,g=zi(v,s,o)*d%o,y=zi(g,t,o)*f%o;return{pow_p_5_8:zi(y,mT,o)*e%o,b2:a}}function vte(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function g6(e,t){let r=mf,n=br(t*t*t,r),s=br(n*n*t,r),o=wT(e*s).pow_p_5_8,i=br(e*n*o,r),a=br(t*i*i,r),u=i,l=br(i*d6,r),f=a===e,m=a===br(-e,r),p=a===br(-e*d6,r);return f&&(i=u),(m||p)&&(i=l),Du(i,r)&&(i=br(-i,r)),{isValid:f||m,value:i}}function vT(e){let{d:t}=m6,r=mf,n=w=>Jc.create(w),s=n(h6*e*e),o=n((s+Fu)*Ete),i=BigInt(-1),a=n((i-t*s)*n(s+t)),{isValid:u,value:l}=g6(o,a),f=n(l*e);Du(f,r)||(f=n(-f)),u||(l=f),u||(i=s);let m=n(i*(s-Fu)*bte-a),p=l*l,d=n((l+l)*a),v=n(m*wte),g=n(Fu-p),y=n(Fu+p);return new pf(n(d*y),n(g*v),n(v*y),n(d*g))}var qAe,hte,Fu,mT,pte,mte,gte,mf,m6,d6,pf,Jc,yT,Kv,h6,wte,yte,Ete,bte,gT,Ate,p6,Zc,Ste,ET=re(()=>{qAe=F(I(),1);Gd();qi();dT();rT();a1();pT();Yc();hte=BigInt(0),Fu=BigInt(1),mT=BigInt(2),pte=BigInt(3),mte=BigInt(5),gte=BigInt(8),mf=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),m6={p:mf,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:gte,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};d6=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");pf=fT(m6,{uvRatio:g6}),Jc=pf.Fp,yT=pf.Fn,Kv=(()=>{let e=mf;return hT({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=wT(t);return br(zi(r,pte,e)*n,e)},adjustScalarBytes:vte})})(),h6=d6,wte=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),yte=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Ete=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),bte=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),gT=e=>g6(Fu,e),Ate=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),p6=e=>Jc.create(Fo(e)&Ate);Zc=class e extends qv{static BASE=new e(pf.BASE);static ZERO=new e(pf.ZERO);static Fp=Jc;static Fn=yT;constructor(t){super(t)}static fromAffine(t){return new e(pf.fromAffine(t))}assertSame(t){if(!(t instanceof e))throw new Error("RistrettoPoint expected")}init(t){return new e(t)}static fromBytes(t){In(t,32);let{a:r,d:n}=m6,s=mf,o=C=>Jc.create(C),i=p6(t);if(!PR(Jc.toBytes(i),t)||Du(i,s))throw new Error("invalid ristretto255 encoding 1");let a=o(i*i),u=o(Fu+r*a),l=o(Fu-r*a),f=o(u*u),m=o(l*l),p=o(r*n*f-m),{isValid:d,value:v}=gT(o(p*m)),g=o(v*l),y=o(v*g*p),w=o((i+i)*g);Du(w,s)&&(w=o(-w));let E=o(u*y),S=o(w*E);if(!d||Du(S,s)||E===hte)throw new Error("invalid ristretto255 encoding 2");return new e(new pf(w,E,Fu,S))}static fromHex(t){return e.fromBytes(I0(t))}toBytes(){let{X:t,Y:r,Z:n,T:s}=this.ep,o=mf,i=y=>Jc.create(y),a=i(i(n+r)*i(n-r)),u=i(t*r),l=i(u*u),{value:f}=gT(i(a*l)),m=i(f*a),p=i(f*u),d=i(m*p*s),v;if(Du(s*d,o)){let y=i(r*h6),w=i(t*h6);t=y,r=w,v=i(m*yte)}else v=p;Du(t*d,o)&&(r=i(-r));let g=i((n-r)*v);return Du(g,o)&&(g=i(-g)),Jc.toBytes(g)}equals(t){this.assertSame(t);let{X:r,Y:n}=this.ep,{X:s,Y:o}=t.ep,i=l=>Jc.create(l),a=i(r*o)===i(n*s),u=i(n*o)===i(r*s);return a||u}is0(){return this.equals(e.ZERO)}};Object.freeze(Zc.BASE);Object.freeze(Zc.ZERO);Object.freeze(Zc.prototype);Object.freeze(Zc);Ste=Object.freeze({Point:Zc,hashToCurve(e,t){let r=t?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":t.DST,n=a6(e,r,64,sv);return Ste.deriveToCurve(n)},hashToScalar(e,t={DST:tT}){let r=a6(e,t.DST,64,sv);return yT.create(Fo(r))},deriveToCurve(e){In(e,64);let t=p6(e.subarray(0,32)),r=vT(t),n=p6(e.subarray(32,64)),s=vT(n);return new Zc(r.add(s))}})});async function AT(e,t){if(_te)return await t();try{return await e()}catch(r){if(r instanceof ReferenceError||r instanceof DOMException&&r.name==="NotSupportedError")return await t();throw r}}async function Vv(e,t){return await AT(async()=>{let r=v6(e)?e:await Dte(e),n=await crypto.subtle.importKey("raw",t,{name:"X25519"},bT,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:n},r,256))},()=>{if(v6(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return Kv.scalarMult(e,t)})}async function d1(e){return await AT(async()=>Vv(e,Kv.GuBytes),()=>{if(v6(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return Kv.scalarMultBase(e)})}async function Dte(e){if(e.length!==32)throw new Error("X25519 private key must be 32 bytes");let t=new Uint8Array([...Cte,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},bT,["deriveBits"])}function v6(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var KAe,bT,_te,Cte,ST=re(()=>{KAe=F(I(),1);ET();bT=!1,_te=!1;Cte=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32])});function Bte(e){return e.forEach(t=>{if(t<32||t>126)throw Error("invalid non-ASCII byte in header")}),new TextDecoder().decode(e)}function gf(e){let t=e.reduce(((s,o)=>s+o.length),0),r=new Uint8Array(t),n=0;for(let s of e)r.set(s,n),n+=s.length;return r}function hh(e,...t){return e.pipeThrough(new TransformStream({start(r){for(let n of t)r.enqueue(n)}}))}function zv(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function w6(e){if(!(e instanceof ReadableStream))throw new Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function _T(e){if(!(e instanceof ReadableStream))throw new Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function CT(e,t){let r=e.getReader(),n=[],s=0;for(;s<t;){let{done:u,value:l}=await r.read();if(u)throw Error("stream ended before reading "+t.toString()+" bytes");n.push(l),s+=l.length}r.releaseLock();let o=gf(n),i=o.subarray(0,t),a=hh(e,o.subarray(t));return{data:i,rest:a}}var GAe,Gv,y6=re(()=>{GAe=F(I(),1),Gv=class{s;transcript=[];buf=new Uint8Array(0);constructor(t){this.s=t.getReader()}async readLine(){let t=[];for(;;){let r=this.buf.indexOf(10);if(r>=0)return t.push(this.buf.subarray(0,r)),this.transcript.push(this.buf.subarray(0,r+1)),this.buf=this.buf.subarray(r+1),Bte(gf(t));this.buf.length>0&&(t.push(this.buf),this.transcript.push(this.buf));let n=await this.s.read();if(n.done)return this.buf=gf(t),null;this.buf=n.value}}close(){return this.s.releaseLock(),{rest:this.buf,transcript:gf(this.transcript)}}}});async function Ite(e){let t=await e.readLine();if(t===null)throw Error("invalid stanza");let r=t.split(" ");if(r.length<2||r.shift()!=="->")return{next:t};for(let o of r)if(o.length===0)throw Error("invalid stanza");let n=[];for(;;){let o=await e.readLine();if(o===null)throw Error("invalid stanza");let i=is.decode(o);if(i.length>48)throw Error("invalid stanza");if(n.push(i),i.length<48)break}let s=gf(n);return{s:new Io(r,s)}}async function DT(e){let t=new Gv(e),r=await t.readLine();if(r!=="age-encryption.org/v1")throw Error("invalid version "+(r??"line"));let n=[];for(;;){let{s,next:o}=await Ite(t);if(s!==void 0){n.push(s);continue}if(!o.startsWith("--- "))throw Error("invalid header");let i=is.decode(o.slice(4)),{rest:a,transcript:u}=t.close(),l=u.slice(0,u.length-1-o.length+3);return{stanzas:n,headerNoMAC:l,MAC:i,headerSize:u.length,rest:hh(e,a)}}}function E6(e){let t=[];t.push(`age-encryption.org/v1
|
||
`);for(let r of e){t.push("-> "+r.args.join(" ")+`
|
||
`);for(let n=0;n<r.body.length;n+=48){let s=n+48;s>r.body.length&&(s=r.body.length),t.push(is.encode(r.body.subarray(n,s))+`
|
||
`)}r.body.length%48===0&&t.push(`
|
||
`)}return t.push("---"),new TextEncoder().encode(t.join(""))}function FT(e,t){return gf([E6(e),new TextEncoder().encode(" "+is.encode(t)+`
|
||
`)])}var XAe,Io,Yv=re(()=>{XAe=F(I(),1);O0();y6();Io=class{args;body;constructor(t,r){this.args=t,this.body=r}}});function S6(){let e=pa(32),t=Ws.encodeFromBytes("AGE-SECRET-KEY-",e).toUpperCase();return Promise.resolve(t)}function _6(){let e=pa(32),t=Ws.encodeFromBytes("AGE-SECRET-KEY-PQ-",e).toUpperCase();return Promise.resolve(t)}async function nw(e){let t;if(IT(e))t=e;else if(e.startsWith("AGE-SECRET-KEY-PQ-1")){let n=Ws.decodeToBytes(e);if(n.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||n.bytes.length!==32)throw Error("invalid identity");let s=xv.getPublicKey(n.bytes);return Ws.encode("age1pq",Ws.toWords(s),!1)}else{let n=Ws.decodeToBytes(e);if(!e.startsWith("AGE-SECRET-KEY-1")||n.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||n.bytes.length!==32)throw Error("invalid identity");t=n.bytes}let r=await d1(t);return Ws.encodeFromBytes("age",r)}function sw(e,t,r){let n=xte(e),s=Wv(n,void 0,"psk_id_hash",new Uint8Array(0)),o=Wv(n,void 0,"info_hash",r),i=new Uint8Array(1+s.length+o.length);i[0]=0,i.set(s,1),i.set(o,1+s.length);let a=Wv(n,t,"secret",new Uint8Array(0)),u=A6(n,a,"key",i,32),l=A6(n,a,"base_nonce",i,12);return{key:u,nonce:l}}function xte(e){let t=new Uint8Array(10);return t.set(new TextEncoder().encode("HPKE"),0),t[4]=e>>8&255,t[5]=e&255,t[6]=0,t[7]=1,t[8]=0,t[9]=3,t}function Wv(e,t,r,n){let s=new Uint8Array(7+e.length+r.length+n.length),o=0;return s.set(new TextEncoder().encode("HPKE-v1"),o),o+=7,s.set(e,o),o+=e.length,s.set(new TextEncoder().encode(r),o),o+=r.length,s.set(n,o),x0(Kr,s,t)}function A6(e,t,r,n,s){let o=new Uint8Array(9+e.length+r.length+n.length),i=0;return o[i]=s>>8&255,o[i+1]=s&255,i+=2,o.set(new TextEncoder().encode("HPKE-v1"),i),i+=7,o.set(e,i),i+=e.length,o.set(new TextEncoder().encode(r),i),i+=r.length,o.set(n,i),qS(Kr,t,o,s)}function Rte(e){e.length!==fh.lengths.publicKeyUncompressed&&(e=fh.Point.fromBytes(e).toBytes(!1));let t=fh.utils.randomSecretKey(),r=fh.getPublicKey(t,!1),n=fh.getSharedSecret(t,e,!0).subarray(1),s=new Uint8Array(r.length+e.length);s.set(r,0),s.set(e,r.length);let o=new Uint8Array(5);o.set(new TextEncoder().encode("KEM"),0),o[3]=b6>>8,o[4]=b6&255;let i=Wv(o,void 0,"eae_prk",n),a=A6(o,i,"shared_secret",s,32);return{encapsulatedKey:r,sharedSecret:a}}function C6(e,t){let r=new Uint8Array(12);return ji(t,r).encrypt(e)}function D6(e,t){if(e.length!==32)throw Error("invalid stanza");let r=new Uint8Array(12);try{return ji(t,r).decrypt(e)}catch{return null}}function IT(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var cSe,Xv,Jv,BT,$te,b6,Zv,Qv,ew,h1,tw,rw,vf=re(()=>{cSe=F(I(),1);O0();jS();Gd();G9();d_();TR();lT();qi();O0();ST();Yv();ph();Xv=class{recipient;constructor(t){let r=Ws.decodeToBytes(t);if(!t.startsWith("age1pq1")||r.prefix.toLowerCase()!=="age1pq"||r.bytes.length!==1216)throw Error("invalid recipient");this.recipient=r.bytes}wrapFileKey(t){let{cipherText:r,sharedSecret:n}=xv.encapsulate(this.recipient),s=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:o,nonce:i}=sw(BT,n,s),a=ji(o,i).encrypt(t);return[new Io(["mlkem768x25519",is.encode(r)],a)]}},Jv=class{identity;constructor(t){let r=Ws.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-PQ-1")||r.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||r.bytes.length!==32)throw Error("invalid identity");this.identity=r.bytes}unwrapFileKey(t){for(let r of t){if(r.args.length<1||r.args[0]!=="mlkem768x25519")continue;if(r.args.length!==2)throw Error("invalid mlkem768x25519 stanza");let n=is.decode(r.args[1]);if(n.length!==1120||r.body.length!==32)throw Error("invalid mlkem768x25519 stanza");let s=xv.decapsulate(n,this.identity),o=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:i,nonce:a}=sw(BT,s,o);try{return ji(i,a).decrypt(r.body)}catch{continue}}return null}},BT=25722,$te=80,b6=16;Zv=class{recipient;constructor(t){let r=Ws.decodeToBytes(t);if(!t.startsWith("age1tag1")||r.prefix.toLowerCase()!=="age1tag"||r.bytes.length!==33)throw Error("invalid recipient");this.recipient=r.bytes}wrapFileKey(t){let{encapsulatedKey:r,sharedSecret:n}=Rte(this.recipient),s=new TextEncoder().encode("age-encryption.org/p256tag"),o=(()=>{let l=Kr(this.recipient).subarray(0,4),f=new Uint8Array(r.length+l.length);return f.set(r,0),f.set(l,r.length),x0(Kr,f,s).subarray(0,4)})(),{key:i,nonce:a}=sw(b6,n,s),u=ji(i,a).encrypt(t);return[new Io(["p256tag",is.encode(o),is.encode(r)],u)]}},Qv=class{recipient;constructor(t){let r=Ws.decodeToBytes(t);if(!t.startsWith("age1tagpq1")||r.prefix.toLowerCase()!=="age1tagpq"||r.bytes.length!==1249)throw Error("invalid recipient");this.recipient=r.bytes}wrapFileKey(t){let{cipherText:r,sharedSecret:n}=RR.encapsulate(this.recipient),s=new TextEncoder().encode("age-encryption.org/mlkem768p256tag"),o=(()=>{let l=Kr(this.recipient.subarray(1184)).subarray(0,4),f=new Uint8Array(r.length+l.length);return f.set(r,0),f.set(l,r.length),x0(Kr,f,s).subarray(0,4)})(),{key:i,nonce:a}=sw($te,n,s),u=ji(i,a).encrypt(t);return[new Io(["mlkem768p256tag",is.encode(o),is.encode(r)],u)]}},ew=class{recipient;constructor(t){let r=Ws.decodeToBytes(t);if(!t.startsWith("age1")||r.prefix.toLowerCase()!=="age"||r.bytes.length!==32)throw Error("invalid recipient");this.recipient=r.bytes}async wrapFileKey(t){let r=pa(32),n=await d1(r),s=await Vv(r,this.recipient),o=new Uint8Array(n.length+this.recipient.length);o.set(n),o.set(this.recipient,n.length);let i=new TextEncoder().encode("age-encryption.org/v1/X25519"),a=kc(Kr,s,o,i,32);return[new Io(["X25519",is.encode(n)],C6(t,a))]}},h1=class{identity;recipient;constructor(t){if(IT(t)){this.identity=t,this.recipient=d1(t);return}let r=Ws.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-1")||r.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||r.bytes.length!==32)throw Error("invalid identity");this.identity=r.bytes,this.recipient=d1(r.bytes)}async unwrapFileKey(t){for(let r of t){if(r.args.length<1||r.args[0]!=="X25519")continue;if(r.args.length!==2)throw Error("invalid X25519 stanza");let n=is.decode(r.args[1]);if(n.length!==32)throw Error("invalid X25519 stanza");let s=await Vv(this.identity,n),o=await this.recipient,i=new Uint8Array(n.length+o.length);i.set(n),i.set(o,n.length);let a=new TextEncoder().encode("age-encryption.org/v1/X25519"),u=kc(Kr,s,i,a,32),l=D6(r.body,u);if(l!==null)return l}return null}},tw=class{passphrase;logN;constructor(t,r){this.passphrase=t,this.logN=r}wrapFileKey(t){let r=pa(16),n="age-encryption.org/v1/scrypt",s=new Uint8Array(n.length+16);s.set(new TextEncoder().encode(n)),s.set(r,n.length);let o=u_(this.passphrase,s,{N:2**this.logN,r:8,p:1,dkLen:32});return[new Io(["scrypt",is.encode(r),this.logN.toString()],C6(t,o))]}},rw=class{passphrase;constructor(t){this.passphrase=t}unwrapFileKey(t){for(let r of t){if(r.args.length<1||r.args[0]!=="scrypt")continue;if(t.length!==1)throw Error("scrypt recipient is not the only one in the header");if(r.args.length!==3||!/^[1-9][0-9]*$/.test(r.args[2]))throw Error("invalid scrypt stanza");let n=is.decode(r.args[1]);if(n.length!==16)throw Error("invalid scrypt stanza");let s=Number(r.args[2]);if(s>20)throw Error("scrypt work factor is too high");let o="age-encryption.org/v1/scrypt",i=new Uint8Array(o.length+16);i.set(new TextEncoder().encode(o)),i.set(n,o.length);let a=u_(this.passphrase,i,{N:2**s,r:8,p:1,dkLen:32}),u=D6(r.body,a);if(u!==null)return u}return null}}});function $T(e){let t=new Uint8Array(12),r=()=>{for(let i=t.length-2;i>=0&&(t[i]++,t[i]===0);i--);},n=!0,s=new Uint8Array(F6),o=0;return new TransformStream({transform(i,a){for(;i.length>0;){if(o===s.length){let l=ji(e,t).decrypt(s);a.enqueue(l),r(),o=0,n=!1}let u=Math.min(s.length-o,i.length);s.set(i.subarray(0,u),o),o+=u,i=i.subarray(u)}},flush(i){t[11]=1;let a=ji(e,t).decrypt(s.subarray(0,o));if(!n&&a.length===0)throw new Error("final chunk is empty");i.enqueue(a)}})}function xT(e){if(e<wf)throw Error("ciphertext is too small");if(e===wf)return 0;let t=Math.floor(e/F6),r=e%F6;if(0<r&&r<=wf)throw Error("ciphertext size is invalid");let n=e;return n-=t*wf,n-=r>0?wf:0,n}function RT(e){let t=new Uint8Array(12),r=()=>{for(let o=t.length-2;o>=0&&(t[o]++,t[o]===0);o--);},n=new Uint8Array(B6),s=0;return new TransformStream({transform(o,i){for(;o.length>0;){if(s===n.length){let u=ji(e,t).encrypt(n);i.enqueue(u),r(),s=0}let a=Math.min(n.length-s,o.length);n.set(o.subarray(0,a),s),s+=a,o=o.subarray(a)}},flush(o){t[11]=1;let i=ji(e,t).encrypt(n.subarray(0,s));o.enqueue(i)}})}function TT(e){let t=Math.max(1,Math.ceil(e/B6));return e+wf*t}var dSe,wf,B6,F6,kT=re(()=>{dSe=F(I(),1);d_();wf=16,B6=64*1024,F6=B6+wf});var p1={};Bj(p1,{decode:()=>kte,encode:()=>Tte});function Tte(e){let t=[];t.push(`-----BEGIN AGE ENCRYPTED FILE-----
|
||
`);for(let r=0;r<e.length;r+=48){let n=r+48;n>e.length&&(n=e.length),t.push(i_.encode(e.subarray(r,n))+`
|
||
`)}return t.push(`-----END AGE ENCRYPTED FILE-----
|
||
`),t.join("")}function kte(e){let t=e.trim().replaceAll(`\r
|
||
`,`
|
||
`).split(`
|
||
`);if(t.shift()!=="-----BEGIN AGE ENCRYPTED FILE-----")throw Error("invalid header");if(t.pop()!=="-----END AGE ENCRYPTED FILE-----")throw Error("invalid footer");function r(n,s){return n===t.length-1?s.length>0&&s.length<=64&&s.length%4===0:s.length===64}if(!t.every((n,s)=>r(s,n)))throw Error("invalid line length");if(!t.every(n=>/^[A-Za-z0-9+/=]+$/.test(n)))throw Error("invalid base64");return i_.decode(t.join(""))}var mSe,PT=re(()=>{mSe=F(I(),1);O0();ph()});var gSe,OT=re(()=>{gSe=F(I(),1)});var ISe,NT=re(()=>{ISe=F(I(),1);ph();Yv();vf();OT();ph()});function Nte(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function Lte(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var qSe,m1,iw,ph=re(()=>{qSe=F(I(),1);$0();jS();Gd();qi();vf();vf();vf();vf();Yv();kT();y6();PT();NT();vf();m1=class{passphrase=null;scryptWorkFactor=18;recipients=[];setPassphrase(t){if(this.passphrase!==null)throw new Error("can encrypt to at most one passphrase");if(this.recipients.length!==0)throw new Error("can't encrypt to both recipients and passphrases");this.passphrase=t}setScryptWorkFactor(t){this.scryptWorkFactor=t}addRecipient(t){if(this.passphrase!==null)throw new Error("can't encrypt to both recipients and passphrases");if(typeof t=="string")if(t.startsWith("age1pq1"))this.recipients.push(new Xv(t));else if(t.startsWith("age1tag1"))this.recipients.push(new Zv(t));else if(t.startsWith("age1tagpq1"))this.recipients.push(new Qv(t));else if(t.startsWith("age1"))this.recipients.push(new ew(t));else throw new Error("unrecognized recipient type");else this.recipients.push(t)}async encrypt(t){let r=pa(16),n=[],s=this.recipients;this.passphrase!==null&&(s=[new tw(this.passphrase,this.scryptWorkFactor)]);for(let d of s)n.push(...await d.wrapFileKey(r));let o=new TextEncoder().encode("header"),i=kc(Kr,r,void 0,o,32),a=ma(Kr,i,E6(n)),u=FT(n,a),l=pa(16),f=new TextEncoder().encode("payload"),m=kc(Kr,r,l,f,32),p=RT(m);return t instanceof ReadableStream?Object.assign(hh(t.pipeThrough(p),u,l),{size:d=>TT(d)+u.length+l.length}):(typeof t=="string"&&(t=new TextEncoder().encode(t)),await w6(hh(zv(t).pipeThrough(p),u,l)))}},iw=class{identities=[];addPassphrase(t){this.identities.push(new rw(t))}addIdentity(t){if(Lte(t))this.identities.push(new h1(t));else if(typeof t=="string")if(t.startsWith("AGE-SECRET-KEY-1"))this.identities.push(new h1(t));else if(t.startsWith("AGE-SECRET-KEY-PQ-1"))this.identities.push(new Jv(t));else throw new Error("unrecognized identity type");else this.identities.push(t)}async decrypt(t,r){let n=t instanceof ReadableStream?t:zv(t),{fileKey:s,headerSize:o,rest:i}=await this.decryptHeaderInternal(n),{data:a,rest:u}=await CT(i,16),l=new TextEncoder().encode("payload"),f=kc(Kr,s,a,l,32),m=$T(f),p=u.pipeThrough(m),d=Object.assign(p,{size:v=>xT(v-o-a.length)});return t instanceof ReadableStream?d:r==="text"?await _T(p):await w6(p)}async decryptHeader(t){return(await this.decryptHeaderInternal(zv(t))).fileKey}async decryptHeaderInternal(t){let r=await DT(t),n=await this.unwrapFileKey(r.stanzas);if(n===null)throw Error("no identity matched any of the file's recipients");let s=new TextEncoder().encode("header"),o=kc(Kr,n,void 0,s,32),i=ma(Kr,o,r.headerNoMAC);if(!Nte(r.MAC,i))throw Error("invalid header HMAC");return{fileKey:n,headerSize:r.headerSize,rest:r.rest}}async unwrapFileKey(t){for(let r of this.identities){let n=await r.unwrapFileKey(t);if(n!==null)return n}return null}}});function g1(e){return String(e??"").trim()}function bn(e){if(!e||typeof e!="object")return e;let t=g1(e[Cs]);return t?e[Cs]=$6(t):delete e[Cs],e}async function jT(e){if(!e||typeof e!="object")return e;let t=g1(e[un]);return t?e[un]=await x6(t):delete e[un],e}function jte(e){return e.startsWith("age1")&&!e.startsWith("age1pq1")&&!e.startsWith("age1tag1")&&!e.startsWith("age1tagpq1")}function Kte(e){return e.startsWith("age1pq1")}function Vte(e){return e.startsWith("AGE-SECRET-KEY-1")}function Gte(e){return e.startsWith("AGE-SECRET-KEY-PQ-1")}function LT(){return new Pe("INVALID_AGE_PUBLIC_KEY","age-public-key \u4EC5\u652F\u6301 X25519(age1...) \u6216 MLKEM768-X25519(age1pq1...) \u516C\u94A5")}function UT(){return new Pe("INVALID_AGE_SECRET_KEY","age-secret-key \u4EC5\u652F\u6301 X25519(AGE-SECRET-KEY-1...) \u6216 MLKEM768-X25519(AGE-SECRET-KEY-PQ-1...) \u79C1\u94A5")}function aw(e=globalThis){let t=Mte.filter(s=>typeof e?.[s]>"u"),r=e?.crypto;if(r&&typeof r.getRandomValues=="function"||t.push("crypto.getRandomValues"),t.length>0)throw new Error(`\u5F53\u524D\u8FD0\u884C\u73AF\u5883\u7F3A\u5C11 age \u52A0\u89E3\u5BC6\u6240\u9700 Web API: ${t.join(", ")}`);Jte(e)}function ow(){return typeof DOMException<"u"?new DOMException("X25519 WebCrypto is not available","NotSupportedError"):new ReferenceError("X25519 WebCrypto is not available")}function zte(){let e={importKey(){throw ow()},deriveBits(){throw ow()}};return e[I6]=!0,e}function Yte(e){return typeof e=="string"?e:e?.name}function HT(e){return String(Yte(e)||"").toUpperCase()==="X25519"}function Wte(e){let t=String(e?.message||e||"");return/x25519|algorithm|not\s+supported|unsupported|unrecognized|unknown/i.test(t)}function MT(e){return e instanceof TypeError||e instanceof ReferenceError||e?.name==="TypeError"||e?.name==="ReferenceError"||e?.name==="NotSupportedError"||e?.name==="Error"&&Wte(e)||typeof DOMException<"u"&&e instanceof DOMException&&e.name==="NotSupportedError"}function Xte(e){let t=Object.create(e);return Object.defineProperty(t,I6,{configurable:!0,value:!0}),Object.defineProperty(t,"importKey",{configurable:!0,value:async(...r)=>{try{return await e.importKey.apply(e,r)}catch(n){throw HT(r[2])&&MT(n)?ow():n}}}),Object.defineProperty(t,"deriveBits",{configurable:!0,value:async(...r)=>{try{return await e.deriveBits.apply(e,r)}catch(n){throw HT(r[0])&&MT(n)?ow():n}}}),t}function qT(e,t,r){try{if(t.subtle=r,t.subtle===r)return!0}catch{}try{if(Object.defineProperty(t,"subtle",{configurable:!0,value:r}),t.subtle===r)return!0}catch{}try{let n=Object.create(t);return Object.defineProperty(n,"subtle",{configurable:!0,value:r}),typeof t.getRandomValues=="function"&&Object.defineProperty(n,"getRandomValues",{configurable:!0,value:t.getRandomValues.bind(t)}),e.crypto=n,e.crypto?.subtle===r}catch{return!1}}function Jte(e=globalThis){let t=e?.crypto,r=t?.subtle;if(!(!t||r?.[I6])){if(!r||typeof r.importKey!="function"||typeof r.deriveBits!="function"){qT(e,t,zte());return}typeof process>"u"&&qT(e,t,Xte(r))}}function $6(e){let t=g1(e);if(!t||!jte(t)&&!Kte(t))throw LT();try{new m1().addRecipient(t)}catch{throw LT()}return t}async function x6(e){let t=g1(e);if(!t||!Vte(t)&&!Gte(t))throw UT();try{await nw(t)}catch{throw UT()}return t}async function KT(e=mh.X25519){aw();let t;if(e===mh.X25519)t=await S6();else if(e===mh.HYBRID)t=await _6();else throw new Error(`\u4E0D\u652F\u6301\u7684 age key \u7C7B\u578B: ${e}. \u652F\u6301: ${Object.values(mh).join(", ")}`);let r=await yf(t);return{type:e,[un]:t,[Cs]:r}}async function yf(e){aw();let t=await x6(e),r=await nw(t);return $6(r)}async function gh(e,t){aw();let r=$6(t),n=new m1;n.addRecipient(r);let s=await n.encrypt(e??"");return p1.encode(s)}function uw(e){return g1(e).startsWith(Hte)}async function vh(e,t){let r=e??"",n=typeof r=="string"?r:new TextDecoder().decode(r);if(!uw(n))return r;aw();let s=await x6(t),o=new iw;o.addIdentity(s);try{let i=p1.decode(n);return await o.decrypt(i,"text")}catch(i){throw new Error(`age \u89E3\u5BC6\u5931\u8D25: ${i?.message??i}`)}}function Zte(e){return String(e??"").replace(qte,t=>`${t.startsWith("AGE-SECRET-KEY-PQ-1")?"AGE-SECRET-KEY-PQ-1":"AGE-SECRET-KEY-1"}...${t.slice(-6)}`)}function An(e){return Zte(String(e??"").replace(/([?#&]age-secret-key=)[^&#\s]+/gi,"$1***"))}var GSe,Hte,Cs,un,mh,Mte,qte,I6,us=re(()=>{GSe=F(I());ph();wn();Hte="-----BEGIN AGE ENCRYPTED FILE-----",Cs="age-public-key",un="age-secret-key",mh=Object.freeze({X25519:"x25519",HYBRID:"mlkem768-x25519"}),Mte=["TextEncoder","TextDecoder","ReadableStream","TransformStream","Response","Uint8Array"],qte=/\bAGE-SECRET-KEY(?:-PQ)?-1[023456789ACDEFGHJKLMNPQRSTUVWXYZ]+\b/g,I6="__subStoreAgeX25519Fallback"});function R6(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function ere(){let t=(R.read(pt)||{})?.scriptCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:1728e5}var XSe,T6,v1,k6=re(()=>{XSe=F(I());gt();dr();T6=class{constructor(){R.read(Rl)||R.write("{}",Rl);try{this.resourceCache=JSON.parse(R.read(Rl))}catch(t){R.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Rl} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},R.write("{}",Rl)}this._cleanup()}_cleanup(t,r){let n=R6(r)??0,s=!1,o=Date.now();Object.entries(this.resourceCache).forEach(i=>{let[a,u]=i;(!u.time||u.time<o+n)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],s=!0)}),s&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){R.write(JSON.stringify(this.resourceCache),Rl)}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()<=r?this.resourceCache[t].time:null}get(t,r,n){let s=R6(r)??0,o=this.resourceCache[t],i=o&&o.time;if(i){if(Date.now()+s<=i)return o.data;n&&(delete this.resourceCache[t],this._persist())}return null}set(t,r,n){let s=R6(n)??ere();this.resourceCache[t]={time:Date.now()+s,data:r},this._persist()}};v1=new T6});function cw(e,t){return[...Array(e).keys()].map(()=>t)}var ZSe,VT=re(()=>{ZSe=F(I())});function wh(e){let t={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["\u6D41\u91CF","\u65F6\u95F4","\u8FC7\u671F","Bandwidth","Expire"],"\u{1F1E6}\u{1F1F8}":["\u7F8E\u5C5E\u8428\u6469\u4E9A"],"\u{1F1E6}\u{1F1F4}":["\u5B89\u54E5\u62C9"],"\u{1F1E7}\u{1F1F8}":["\u5DF4\u54C8\u9A6C"],"\u{1F1E7}\u{1F1E7}":["\u5DF4\u5DF4\u591A\u65AF"],"\u{1F1E7}\u{1F1F2}":["\u767E\u6155\u5927"],"\u{1F1E7}\u{1F1FC}":["\u535A\u8328\u74E6\u7EB3"],"\u{1F1E7}\u{1F1FB}":["\u5E03\u97E6\u5C9B"],"\u{1F1E7}\u{1F1FF}":["\u4F2F\u5229\u5179"],"\u{1F1EE}\u{1F1F4}":["\u82F1\u5C5E\u5370\u5EA6\u6D0B\u9886\u5730"],"\u{1F1F8}\u{1F1E7}":["\u6240\u7F57\u95E8\u7FA4\u5C9B"],"\u{1F1FB}\u{1F1EC}":["\u82F1\u5C5E\u7EF4\u5C14\u4EAC\u7FA4\u5C9B"],"\u{1F1E7}\u{1F1EE}":["\u5E03\u9686\u8FEA"],"\u{1F1E8}\u{1F1F2}":["\u5580\u9EA6\u9686"],"\u{1F1E8}\u{1F1FB}":["\u4F5B\u5F97\u89D2"],"\u{1F1F0}\u{1F1FE}":["\u5F00\u66FC\u7FA4\u5C9B"],"\u{1F1F9}\u{1F1E9}":["\u4E4D\u5F97"],"\u{1F1E8}\u{1F1FD}":["\u5723\u8BDE\u5C9B"],"\u{1F1E8}\u{1F1E8}":["\u79D1\u79D1\u65AF\uFF08\u57FA\u6797\uFF09\u7FA4\u5C9B"],"\u{1F1F0}\u{1F1F2}":["\u79D1\u6469\u7F57"],"\u{1F1FE}\u{1F1F9}":["\u9A6C\u7EA6\u7279"],"\u{1F1E8}\u{1F1EC}":["\u521A\u679C\uFF08\u5E03\uFF09"],"\u{1F1E8}\u{1F1E9}":["\u521A\u679C\uFF08\u91D1\uFF09"],"\u{1F1E8}\u{1F1F0}":["\u5E93\u514B\u7FA4\u5C9B"],"\u{1F1E8}\u{1F1FA}":["\u53E4\u5DF4"],"\u{1F1E7}\u{1F1EF}":["\u8D1D\u5B81"],"\u{1F1E9}\u{1F1F2}":["\u591A\u7C73\u5C3C\u514B"],"\u{1F1E9}\u{1F1F4}":["\u591A\u7C73\u5C3C\u52A0"],"\u{1F1F8}\u{1F1FB}":["\u8428\u5C14\u74E6\u591A"],"\u{1F1EC}\u{1F1F6}":["\u8D64\u9053\u51E0\u5185\u4E9A"],"\u{1F1EA}\u{1F1F9}":["\u57C3\u585E\u4FC4\u6BD4\u4E9A"],"\u{1F1EA}\u{1F1F7}":["\u5384\u7ACB\u7279\u91CC\u4E9A"],"\u{1F1EB}\u{1F1F4}":["\u6CD5\u7F57\u7FA4\u5C9B"],"\u{1F1EB}\u{1F1F0}":["\u798F\u514B\u5170\u7FA4\u5C9B"],"\u{1F1EC}\u{1F1F8}":["\u5357\u4E54\u6CBB\u4E9A\u548C\u5357\u6851\u5A01\u5947\u7FA4\u5C9B"],"\u{1F1EB}\u{1F1EF}":["\u6590\u6D4E"],"\u{1F1E6}\u{1F1FD}":["\u5965\u5170\u7FA4\u5C9B"],"\u{1F1EB}\u{1F1FD}":["\u6CD5\u56FD\u672C\u571F"],"\u{1F1EC}\u{1F1EB}":["\u6CD5\u5C5E\u572D\u4E9A\u90A3"],"\u{1F1F5}\u{1F1EB}":["\u6CD5\u5C5E\u6CE2\u5229\u5C3C\u897F\u4E9A"],"\u{1F1F9}\u{1F1EB}":["\u6CD5\u5C5E\u5357\u90E8\u548C\u5357\u6781\u9886\u5730"],"\u{1F1E9}\u{1F1EF}":["\u5409\u5E03\u63D0"],"\u{1F1EC}\u{1F1E6}":["\u52A0\u84EC"],"\u{1F1EC}\u{1F1F2}":["\u5188\u6BD4\u4E9A"],"\u{1F1F5}\u{1F1F8}":["\u5DF4\u52D2\u65AF\u5766"],"\u{1F1EC}\u{1F1ED}":["\u52A0\u7EB3"],"\u{1F1EC}\u{1F1EE}":["\u76F4\u5E03\u7F57\u9640"],"\u{1F1F0}\u{1F1EE}":["\u57FA\u91CC\u5DF4\u65AF"],"\u{1F1EC}\u{1F1E9}":["\u683C\u6797\u7EB3\u8FBE"],"\u{1F1EC}\u{1F1F5}":["\u74DC\u5FB7\u7F57\u666E"],"\u{1F1EC}\u{1F1FE}":["\u572D\u4E9A\u90A3"],"\u{1F1ED}\u{1F1F9}":["\u6D77\u5730"],"\u{1F1ED}\u{1F1F2}":["\u8D6B\u5FB7\u5C9B\u548C\u9EA6\u514B\u5510\u7EB3\u7FA4\u5C9B"],"\u{1F1ED}\u{1F1F3}":["\u6D2A\u90FD\u62C9\u65AF"],"\u{1F1E8}\u{1F1EE}":["\u79D1\u7279\u8FEA\u74E6"],"\u{1F1EF}\u{1F1F2}":["\u7259\u4E70\u52A0"],"\u{1F1F0}\u{1F1FC}":["\u79D1\u5A01\u7279"],"\u{1F1F1}\u{1F1E7}":["\u9ECE\u5DF4\u5AE9"],"\u{1F1F1}\u{1F1F7}":["\u5229\u6BD4\u91CC\u4E9A"],"\u{1F1F1}\u{1F1FE}":["\u5229\u6BD4\u4E9A"],"\u{1F1F1}\u{1F1EE}":["\u5217\u652F\u6566\u58EB\u767B"],"\u{1F1F2}\u{1F1EC}":["\u9A6C\u8FBE\u52A0\u65AF\u52A0"],"\u{1F1F2}\u{1F1FC}":["\u9A6C\u62C9\u7EF4"],"\u{1F1F2}\u{1F1FB}":["\u9A6C\u5C14\u4EE3\u592B"],"\u{1F1F2}\u{1F1F6}":["\u9A6C\u63D0\u5C3C\u514B"],"\u{1F1F2}\u{1F1F7}":["\u6BDB\u91CC\u5854\u5C3C\u4E9A"],"\u{1F1F2}\u{1F1FA}":["\u6BDB\u91CC\u6C42\u65AF"],"\u{1F1F2}\u{1F1E8}":["\u6469\u7EB3\u54E5"],"\u{1F1F2}\u{1F1EA}":["\u9ED1\u5C71"],"\u{1F1F2}\u{1F1F8}":["\u8499\u7279\u585E\u62C9\u7279"],"\u{1F1F2}\u{1F1FF}":["\u83AB\u6851\u6BD4\u514B"],"\u{1F1F3}\u{1F1E6}":["\u7EB3\u7C73\u6BD4\u4E9A"],"\u{1F1F3}\u{1F1F7}":["\u7459\u9C81"],"\u{1F1E8}\u{1F1FC}":["\u5E93\u62C9\u7D22"],"\u{1F1F8}\u{1F1FD}":["\u8377\u5C5E\u5723\u9A6C\u4E01"],"\u{1F1E7}\u{1F1F6}":["\u8377\u5170\u52A0\u52D2\u6BD4\u533A"],"\u{1F1F3}\u{1F1E8}":["\u65B0\u5580\u91CC\u591A\u5C3C\u4E9A"],"\u{1F1FB}\u{1F1FA}":["\u74E6\u52AA\u963F\u56FE"],"\u{1F1F3}\u{1F1EE}":["\u5C3C\u52A0\u62C9\u74DC"],"\u{1F1F3}\u{1F1EA}":["\u5C3C\u65E5\u5C14"],"\u{1F1F3}\u{1F1FA}":["\u7EBD\u57C3"],"\u{1F1F3}\u{1F1EB}":["\u8BFA\u798F\u514B\u5C9B"],"\u{1F1FA}\u{1F1F2}":["\u7F8E\u56FD\u672C\u571F\u5916\u5C0F\u5C9B\u5C7F"],"\u{1F1EB}\u{1F1F2}":["\u5BC6\u514B\u7F57\u5C3C\u897F\u4E9A\u8054\u90A6"],"\u{1F1F2}\u{1F1ED}":["\u9A6C\u7ECD\u5C14\u7FA4\u5C9B"],"\u{1F1F5}\u{1F1FC}":["\u5E15\u52B3"],"\u{1F1F5}\u{1F1F3}":["\u76AE\u7279\u51EF\u6069\u7FA4\u5C9B"],"\u{1F1F9}\u{1F1F1}":["\u4E1C\u5E1D\u6C76"],"\u{1F1F7}\u{1F1FC}":["\u5362\u65FA\u8FBE"],"\u{1F1E7}\u{1F1F1}":["\u5723\u5DF4\u6CF0\u52D2\u7C73"],"\u{1F1F8}\u{1F1ED}":["\u5723\u8D6B\u52D2\u62FF"],"\u{1F1F0}\u{1F1F3}":["\u5723\u57FA\u8328\u548C\u5C3C\u7EF4\u65AF"],"\u{1F1E6}\u{1F1EE}":["\u5B89\u572D\u62C9"],"\u{1F1F1}\u{1F1E8}":["\u5723\u5362\u897F\u4E9A"],"\u{1F1F2}\u{1F1EB}":["\u6CD5\u5C5E\u5723\u9A6C\u4E01"],"\u{1F1F5}\u{1F1F2}":["\u5723\u76AE\u57C3\u5C14\u548C\u5BC6\u514B\u9686"],"\u{1F1FB}\u{1F1E8}":["\u5723\u6587\u68EE\u7279\u548C\u683C\u6797\u7EB3\u4E01\u65AF"],"\u{1F1F8}\u{1F1F2}":["\u5723\u9A6C\u529B\u8BFA"],"\u{1F1F8}\u{1F1F9}":["\u5723\u591A\u7F8E\u548C\u666E\u6797\u897F\u6BD4"],"\u{1F1F8}\u{1F1F3}":["\u585E\u5185\u52A0\u5C14"],"\u{1F1F8}\u{1F1E8}":["\u585E\u820C\u5C14"],"\u{1F1F8}\u{1F1F8}":["\u5357\u82CF\u4E39"],"\u{1F1F8}\u{1F1E9}":["\u82CF\u4E39"],"\u{1F1EA}\u{1F1ED}":["\u897F\u6492\u54C8\u62C9"],"\u{1F1F8}\u{1F1F7}":["\u82CF\u91CC\u5357"],"\u{1F1F8}\u{1F1EF}":["\u65AF\u74E6\u5C14\u5DF4\u548C\u626C\u9A6C\u5EF6"],"\u{1F1F8}\u{1F1FF}":["\u65AF\u5A01\u58EB\u5170"],"\u{1F1F8}\u{1F1FE}":["\u53D9\u5229\u4E9A"],"\u{1F1F9}\u{1F1EF}":["\u5854\u5409\u514B\u65AF\u5766"],"\u{1F1F9}\u{1F1F0}":["\u6258\u514B\u52B3"],"\u{1F1F9}\u{1F1F4}":["\u6C64\u52A0"],"\u{1F1F9}\u{1F1F9}":["\u7279\u7ACB\u5C3C\u8FBE\u548C\u591A\u5DF4\u54E5"],"\u{1F1F9}\u{1F1F2}":["\u571F\u5E93\u66FC\u65AF\u5766"],"\u{1F1F9}\u{1F1E8}":["\u7279\u514B\u65AF\u548C\u51EF\u79D1\u65AF\u7FA4\u5C9B"],"\u{1F1F9}\u{1F1FB}":["\u56FE\u74E6\u5362"],"\u{1F1FA}\u{1F1EC}":["\u4E4C\u5E72\u8FBE"],"\u{1F1EC}\u{1F1EC}":["\u6839\u897F\u5C9B"],"\u{1F1EF}\u{1F1EA}":["\u6CFD\u897F\u5C9B"],"\u{1F1F9}\u{1F1FF}":["\u5766\u6851\u5C3C\u4E9A"],"\u{1F1E7}\u{1F1EB}":["\u5E03\u57FA\u7EB3\u6CD5\u7D22"],"\u{1F1FA}\u{1F1FF}":["\u4E4C\u5179\u522B\u514B\u65AF\u5766"],"\u{1F1FC}\u{1F1EB}":["\u74E6\u5229\u65AF\u548C\u5BCC\u56FE\u7EB3"],"\u{1F1FE}\u{1F1EA}":["\u4E5F\u95E8"],"\u{1F1FF}\u{1F1F2}":["\u8D5E\u6BD4\u4E9A"],"\u{1F1FD}\u{1F1F0}":["\u79D1\u7D22\u6C83"],"\u{1F1FA}\u{1F1F3}":["\u8054\u5408\u56FD"],"\u{1F1F8}\u{1F1F1}":["\u585E\u62C9\u5229\u6602"],"\u{1F1F2}\u{1F1F5}":["\u5317\u9A6C\u91CC\u4E9A\u7EB3","Northern Mariana Islands","Saipan","\u585E\u73ED"],"\u{1F1F8}\u{1F1F4}":["Somalia","\u7D22\u9A6C\u91CC","\u6469\u52A0\u8FEA\u6C99","Mogadishu"],"\u{1F1E6}\u{1F1F6}":["Antarctica","\u5357\u6781\u6D32","\u5357\u6781"],"\u{1F1E6}\u{1F1EC}":["Antigua and Barbuda","\u5B89\u63D0\u74DC\u548C\u5DF4\u5E03\u8FBE"],"\u{1F1EC}\u{1F1F1}":["Greenland","\u683C\u9675\u5170\u5C9B","\u683C\u9675\u5170"],"\u{1F1FF}\u{1F1FC}":["Zimbabwe","\u6D25\u5DF4\u5E03\u97E6"],"\u{1F1E6}\u{1F1FC}":["Aruba","\u963F\u9C81\u5DF4"],"\u{1F1F2}\u{1F1F1}":["Mali","\u9A6C\u91CC"],"\u{1F1E6}\u{1F1E9}":["Andorra","\u5B89\u9053\u5C14"],"\u{1F1E6}\u{1F1EA}":["United Arab Emirates","\u963F\u8054\u914B","\u8FEA\u62DC","Dubai"],"\u{1F1E6}\u{1F1EB}":["Afghanistan","\u963F\u5BCC\u6C57"],"\u{1F1E6}\u{1F1F1}":["Albania","\u963F\u5C14\u5DF4\u5C3C\u4E9A","\u963F\u723E\u5DF4\u5C3C\u4E9E"],"\u{1F1E6}\u{1F1F2}":["Armenia","\u4E9A\u7F8E\u5C3C\u4E9A"],"\u{1F1E6}\u{1F1F7}":["Argentina","\u963F\u6839\u5EF7"],"\u{1F1E6}\u{1F1F9}":["Austria","\u5965\u5730\u5229","\u5967\u5730\u5229","\u7EF4\u4E5F\u7EB3"],"\u{1F1FC}\u{1F1F8}":["Samoa","\u8428\u6469\u4E9A","\u85A9\u6469\u4E9E"],"\u{1F1E6}\u{1F1FA}":["Australia","\u6FB3\u5927\u5229\u4E9A","\u6FB3\u6D32","\u58A8\u5C14\u672C","\u6089\u5C3C","\u571F\u6FB3","\u4EAC\u6FB3","\u5EE3\u6FB3","\u6EEC\u6FB3","\u6CAA\u6FB3","\u5E7F\u6FB3","Sydney"],"\u{1F1E6}\u{1F1FF}":["Azerbaijan","\u963F\u585E\u62DC\u7586"],"\u{1F1E7}\u{1F1E6}":["Bosnia and Herzegovina","\u6CE2\u9ED1\u5171\u548C\u56FD","\u6CE2\u9ED1"],"\u{1F1E7}\u{1F1E9}":["Bangladesh","\u5B5F\u52A0\u62C9\u56FD","\u5B5F\u52A0\u62C9"],"\u{1F1E7}\u{1F1EA}":["Belgium","\u6BD4\u5229\u65F6","\u6BD4\u5229\u6642"],"\u{1F1E7}\u{1F1EC}":["Bulgaria","\u4FDD\u52A0\u5229\u4E9A","\u4FDD\u52A0\u5229\u4E9E"],"\u{1F1E7}\u{1F1ED}":["Bahrain","\u5DF4\u6797"],"\u{1F1E7}\u{1F1F7}":["Brazil","\u5DF4\u897F","\u5723\u4FDD\u7F57"],"\u{1F1E7}\u{1F1F3}":["Brunei","\u6587\u83B1","\u6C76\u840A"],"\u{1F1E7}\u{1F1FE}":["Belarus","\u767D\u4FC4\u7F57\u65AF","\u767D\u4FC4"],"\u{1F1E7}\u{1F1F4}":["Bolivia","\u73BB\u5229\u7EF4\u4E9A"],"\u{1F1E7}\u{1F1F9}":["Bhutan","\u4E0D\u4E39","\u4E0D\u4E39\u738B\u56FD"],"\u{1F1E8}\u{1F1E6}":["Canada","\u52A0\u62FF\u5927","\u8499\u7279\u5229\u5C14","\u6E29\u54E5\u534E","\u6953\u8449","\u67AB\u53F6","\u6ED1\u94C1\u5362","\u591A\u4F26\u591A","Waterloo","Toronto"],"\u{1F1E8}\u{1F1EB}":["Central African Republic","\u4E2D\u975E\u5171\u548C\u56FD","\u4E2D\u975E"],"\u{1F1E8}\u{1F1ED}":["Switzerland","\u745E\u58EB","\u82CF\u9ECE\u4E16","Zurich"],"\u{1F1E8}\u{1F1F1}":["Chile","\u667A\u5229"],"\u{1F1E8}\u{1F1F4}":["Colombia","\u54E5\u4F26\u6BD4\u4E9A"],"\u{1F1E8}\u{1F1F7}":["Costa Rica","\u54E5\u65AF\u8FBE\u9ECE\u52A0"],"\u{1F1E8}\u{1F1FE}":["Cyprus","\u585E\u6D66\u8DEF\u65AF"],"\u{1F1E8}\u{1F1FF}":["Czechia","\u6377\u514B","Czech","Czech Republic"],"\u{1F1E9}\u{1F1EA}":["German","\u5FB7\u56FD","\u5FB7\u570B","\u4EAC\u5FB7","\u6EEC\u5FB7","\u5EE3\u5FB7","\u6CAA\u5FB7","\u5E7F\u5FB7","\u6CD5\u5170\u514B\u798F","Frankfurt","\u5FB7\u610F\u5FD7"],"\u{1F1E9}\u{1F1F0}":["Denmark","\u4E39\u9EA6","\u4E39\u9EA5"],"\u{1F1E9}\u{1F1FF}":["Algeria","\u963F\u5C14\u53CA\u5229\u4E9A","\u963F\u723E\u53CA\u5229\u4E9E"],"\u{1F1EA}\u{1F1E8}":["Ecuador","\u5384\u74DC\u591A\u5C14"],"\u{1F1EA}\u{1F1EA}":["Estonia","\u7231\u6C99\u5C3C\u4E9A"],"\u{1F1EA}\u{1F1EC}":["Egypt","\u57C3\u53CA"],"\u{1F1EA}\u{1F1F8}":["Spain","\u897F\u73ED\u7259"],"\u{1F1EA}\u{1F1FA}":["European Union","\u6B27\u76DF","\u6B27\u7F57\u5DF4","\u6B27\u6D32\u8054\u76DF"],"\u{1F1EB}\u{1F1EE}":["Finland","\u82AC\u5170","\u82AC\u862D","\u8D6B\u5C14\u8F9B\u57FA"],"\u{1F1EB}\u{1F1F7}":["France","\u6CD5\u56FD","\u6CD5\u570B","\u5DF4\u9ECE"],"\u{1F1EC}\u{1F1E7}":["Great Britain","\u82F1\u56FD","England","United Kingdom","\u4F26\u6566","\u82F1","London"],"\u{1F1EC}\u{1F1EA}":["Georgia","\u683C\u9C81\u5409\u4E9A","\u683C\u9B6F\u5409\u4E9E"],"\u{1F1EC}\u{1F1F7}":["Greece","\u5E0C\u814A","\u5E0C\u81D8"],"\u{1F1EC}\u{1F1FA}":["Guam","\u5173\u5C9B","\u95DC\u5CF6"],"\u{1F1EC}\u{1F1F9}":["Guatemala","\u5371\u5730\u9A6C\u62C9"],"\u{1F1ED}\u{1F1F0}":["Hongkong","\u9999\u6E2F","Hong Kong","HongKong","HONG KONG","\u6DF1\u6E2F","\u6CAA\u6E2F","\u547C\u6E2F","\u7A57\u6E2F","\u4EAC\u6E2F","\u6E2F"],"\u{1F1ED}\u{1F1F7}":["Croatia","\u514B\u7F57\u5730\u4E9A","\u514B\u7F85\u5730\u4E9E"],"\u{1F1ED}\u{1F1FA}":["Hungary","\u5308\u7259\u5229"],"\u{1F1EE}\u{1F1F6}":["Iraq","\u4F0A\u62C9\u514B","\u5DF4\u683C\u8FBE","Baghdad"],"\u{1F1EF}\u{1F1F4}":["Jordan","\u7EA6\u65E6"],"\u{1F1EF}\u{1F1F5}":["Japan","\u65E5\u672C","\u4E1C\u4EAC","\u5927\u962A","\u57FC\u7389","\u6CAA\u65E5","\u7A57\u65E5","\u5DDD\u65E5","\u4E2D\u65E5","\u6CC9\u65E5","\u676D\u65E5","\u6DF1\u65E5","\u8FBD\u65E5","\u5E7F\u65E5","\u5927\u5742","Osaka","Tokyo"],"\u{1F1F0}\u{1F1EA}":["Kenya","\u80AF\u5C3C\u4E9A"],"\u{1F1F0}\u{1F1EC}":["Kyrgyzstan","\u5409\u5C14\u5409\u65AF\u65AF\u5766"],"\u{1F1F0}\u{1F1ED}":["Cambodia","\u67EC\u57D4\u5BE8"],"\u{1F1F0}\u{1F1F5}":["North Korea","\u671D\u9C9C"],"\u{1F1F0}\u{1F1F7}":["Korea","\u97E9\u56FD","\u97D3\u570B","\u97E9","\u97D3","\u9996\u5C14","\u6625\u5DDD","Chuncheon","Seoul"],"\u{1F1F0}\u{1F1FF}":["Kazakhstan","\u54C8\u8428\u514B\u65AF\u5766","\u54C8\u8428\u514B"],"\u{1F1EE}\u{1F1E9}":["Indonesia","\u5370\u5C3C","\u5370\u5EA6\u5C3C\u897F\u4E9A","\u96C5\u52A0\u8FBE"],"\u{1F1EE}\u{1F1EA}":["Ireland","\u7231\u5C14\u5170","\u611B\u723E\u862D","\u90FD\u67CF\u6797"],"\u{1F1EE}\u{1F1F1}":["Israel","\u4EE5\u8272\u5217"],"\u{1F1EE}\u{1F1F2}":["Isle of Man","\u9A6C\u6069\u5C9B","\u99AC\u6069\u5CF6"],"\u{1F1EE}\u{1F1F3}":["India","\u5370\u5EA6","\u5B5F\u4E70","MFumbai","Mumbai"],"\u{1F1EE}\u{1F1F7}":["Iran","\u4F0A\u6717"],"\u{1F1EE}\u{1F1F8}":["Iceland","\u51B0\u5C9B","\u51B0\u5CF6"],"\u{1F1EE}\u{1F1F9}":["Italy","\u610F\u5927\u5229","\u7FA9\u5927\u5229","\u7C73\u5170","Nachash"],"\u{1F1F1}\u{1F1F0}":["Sri Lanka","\u65AF\u91CC\u5170\u5361","\u65AF\u91CC\u862D\u5361"],"\u{1F1F1}\u{1F1E6}":["Laos","\u8001\u631D","\u8001\u64BE"],"\u{1F1F1}\u{1F1F8}":["Lesotho","\u83B1\u7D22\u6258"],"\u{1F1F1}\u{1F1F9}":["Lithuania","\u7ACB\u9676\u5B9B"],"\u{1F1F1}\u{1F1FA}":["Luxembourg","\u5362\u68EE\u5821"],"\u{1F1F1}\u{1F1FB}":["Latvia","\u62C9\u8131\u7EF4\u4E9A","Latvija"],"\u{1F1F2}\u{1F1E6}":["Morocco","\u6469\u6D1B\u54E5"],"\u{1F1F2}\u{1F1E9}":["Moldova","\u6469\u5C14\u591A\u74E6","\u6469\u723E\u591A\u74E6"],"\u{1F1F2}\u{1F1F2}":["Myanmar","\u7F05\u7538","\u7DEC\u7538"],"\u{1F1F3}\u{1F1EC}":["Nigeria","\u5C3C\u65E5\u5229\u4E9A","\u5C3C\u65E5\u5229\u4E9E"],"\u{1F1F2}\u{1F1F0}":["Macedonia","\u9A6C\u5176\u987F","\u99AC\u5176\u9813"],"\u{1F1F2}\u{1F1F3}":["Mongolia","\u8499\u53E4"],"\u{1F1F2}\u{1F1F4}":["Macao","\u6FB3\u95E8","\u6FB3\u9580","CTM"],"\u{1F1F2}\u{1F1F9}":["Malta","\u9A6C\u8033\u4ED6"],"\u{1F1F2}\u{1F1FD}":["Mexico","\u58A8\u897F\u54E5"],"\u{1F1F2}\u{1F1FE}":["Malaysia","\u9A6C\u6765","\u99AC\u4F86","\u5409\u9686\u5761","\u5927\u99AC"],"\u{1F1F3}\u{1F1F1}":["Netherlands","\u8377\u5170","\u8377\u862D","\u5C3C\u5FB7\u862D","\u963F\u59C6\u65AF\u7279\u4E39","Amsterdam"],"\u{1F1F3}\u{1F1F4}":["Norway","\u632A\u5A01"],"\u{1F1F3}\u{1F1F5}":["Nepal","\u5C3C\u6CCA\u5C14"],"\u{1F1F3}\u{1F1FF}":["New Zealand","\u65B0\u897F\u5170","\u65B0\u897F\u862D"],"\u{1F1F4}\u{1F1F2}":["Oman","\u963F\u66FC","\u9A6C\u65AF\u5580\u7279"],"\u{1F1F5}\u{1F1E6}":["Panama","\u5DF4\u62FF\u9A6C"],"\u{1F1F5}\u{1F1EA}":["Peru","\u79D8\u9C81","\u7955\u9B6F"],"\u{1F1F5}\u{1F1ED}":["Philippines","\u83F2\u5F8B\u5BBE","\u83F2\u5F8B\u8CD3"],"\u{1F1F5}\u{1F1F0}":["Pakistan","\u5DF4\u57FA\u65AF\u5766"],"\u{1F1F5}\u{1F1F1}":["Poland","\u6CE2\u5170","\u6CE2\u862D","\u534E\u6C99","Warsaw"],"\u{1F1F5}\u{1F1F7}":["Puerto Rico","\u6CE2\u591A\u9ECE\u5404"],"\u{1F1F5}\u{1F1F9}":["Portugal","\u8461\u8404\u7259"],"\u{1F1F5}\u{1F1EC}":["Papua New Guinea","\u5DF4\u5E03\u4E9A\u65B0\u51E0\u5185\u4E9A"],"\u{1F1EC}\u{1F1FC}":["\u51E0\u5185\u4E9A\u6BD4\u7ECD"],"\u{1F1EC}\u{1F1F3}":["\u51E0\u5185\u4E9A"],"\u{1F1F5}\u{1F1FE}":["Paraguay","\u5DF4\u62C9\u572D"],"\u{1F1F6}\u{1F1E6}":["Qatar","\u5361\u5854\u5C14","\u5361\u5854\u723E"],"\u{1F1F7}\u{1F1F4}":["Romania","\u7F57\u9A6C\u5C3C\u4E9A"],"\u{1F1F7}\u{1F1F8}":["Serbia","\u585E\u5C14\u7EF4\u4E9A"],"\u{1F1F7}\u{1F1EA}":["R\xE9union","\u7559\u5C3C\u6C6A","\u6CD5\u5C5E\u7559\u5C3C\u6C6A"],"\u{1F1F7}\u{1F1FA}":["Russia","\u4FC4\u7F57\u65AF","\u4FC4\u56FD","\u4FC4\u7F85\u65AF","\u4F2F\u529B","\u83AB\u65AF\u79D1","\u5723\u5F7C\u5F97\u5821","\u897F\u4F2F\u5229\u4E9A","\u4EAC\u4FC4","\u676D\u4FC4","\u5EE3\u4FC4","\u6EEC\u4FC4","\u5E7F\u4FC4","\u6CAA\u4FC4","Moscow"],"\u{1F1F8}\u{1F1E6}":["Saudi","\u6C99\u7279\u963F\u62C9\u4F2F","\u6C99\u7279","Riyadh","\u5229\u96C5\u5F97"],"\u{1F1F8}\u{1F1EA}":["Sweden","\u745E\u5178","\u65AF\u5FB7\u54E5\u5C14\u6469","Stockholm"],"\u{1F1F8}\u{1F1EC}":["Singapore","\u65B0\u52A0\u5761","\u72EE\u57CE","\u6CAA\u65B0","\u4EAC\u65B0","\u4E2D\u65B0","\u6CC9\u65B0","\u7A57\u65B0","\u6DF1\u65B0","\u676D\u65B0","\u5E7F\u65B0","\u5EE3\u65B0","\u6EEC\u65B0"],"\u{1F1F8}\u{1F1EE}":["Slovenia","\u65AF\u6D1B\u6587\u5C3C\u4E9A"],"\u{1F1F8}\u{1F1F0}":["Slovakia","\u65AF\u6D1B\u4F10\u514B"],"\u{1F1F9}\u{1F1EC}":["Togo","\u591A\u54E5","\u6D1B\u7F8E","Lom\xE9","Lome"],"\u{1F1F9}\u{1F1ED}":["Thailand","\u6CF0\u56FD","\u6CF0\u570B","\u66FC\u8C37"],"\u{1F1F9}\u{1F1F3}":["Tunisia","\u7A81\u5C3C\u65AF"],"\u{1F1F9}\u{1F1F7}":["Turkey","\u571F\u8033\u5176","\u4F0A\u65AF\u5766\u5E03\u5C14","Istanbul"],"\u{1F1F9}\u{1F1FC}":["Taiwan","\u53F0\u6E7E","\u81FA\u7063","\u53F0\u7063","\u4E2D\u83EF\u6C11\u570B","\u4E2D\u534E\u6C11\u56FD","\u53F0\u5317","\u53F0\u4E2D","\u65B0\u5317","\u5F70\u5316","\u53F0","\u81FA","Taipei","Tai Wan"],"\u{1F1FA}\u{1F1E6}":["Ukraine","\u4E4C\u514B\u5170","\u70CF\u514B\u862D"],"\u{1F1FB}\u{1F1EE}":["United States Virgin Islands","US Virgin Islands","USVI","\u7F8E\u5C5E\u7EF4\u5C14\u4EAC\u7FA4\u5C9B","\u7F8E\u5C6C\u7DAD\u723E\u4EAC\u7FA4\u5CF6"],"\u{1F1FA}\u{1F1F8}":["United States","\u7F8E\u56FD","America","\u7F8E","\u4EAC\u7F8E","\u6CE2\u7279\u5170","\u8FBE\u62C9\u65AF","\u4FC4\u52D2\u5188","Oregon","\u51E4\u51F0\u57CE","\u8D39\u5229\u8499","\u7845\u8C37","\u77FD\u8C37","\u62C9\u65AF\u7EF4\u52A0\u65AF","\u6D1B\u6749\u77F6","\u5723\u4F55\u585E","\u5723\u514B\u62C9\u62C9","\u897F\u96C5\u56FE","\u829D\u52A0\u54E5","\u6CAA\u7F8E","\u54E5\u4F26\u5E03","\u7EBD\u7EA6","New York","Los Angeles","San Jose","Sillicon Valley","Michigan","\u4FC4\u4EA5\u4FC4","Ohio","\u9A6C\u7EB3\u8428\u65AF","Manassas","\u5F17\u5409\u5C3C\u4E9A","Virginia"],"\u{1F1FA}\u{1F1FE}":["Uruguay","\u4E4C\u62C9\u572D"],"\u{1F1FB}\u{1F1E6}":["Vatican","Vatican City","Holy See","\u68B5\u8482\u5188","\u68B5\u8482\u5CA1"],"\u{1F1FB}\u{1F1EA}":["Venezuela","\u59D4\u5185\u745E\u62C9"],"\u{1F1FB}\u{1F1F3}":["Vietnam","\u8D8A\u5357","\u80E1\u5FD7\u660E"],"\u{1F1FF}\u{1F1E6}":["South Africa","\u5357\u975E"],"\u{1F1E8}\u{1F1F3}":["China","\u4E2D\u56FD","\u4E2D\u570B","\u56DE\u56FD","\u56DE\u570B","\u56FD\u5185","\u570B\u5167","\u534E\u4E1C","\u534E\u897F","\u534E\u5357","\u534E\u5317","\u534E\u4E2D","\u6C5F\u82CF","\u5317\u4EAC","\u4E0A\u6D77","\u5E7F\u5DDE","\u6DF1\u5733","\u676D\u5DDE","\u5F90\u5DDE","\u9752\u5C9B","\u5B81\u6CE2","\u9547\u6C5F"]},r=e.match(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/)?.[0]||"\u{1F3F4}\u200D\u2620\uFE0F";for(let n of Object.keys(t))if(t[n].some(o=>RegExp(`${o}`,"i").test(e)))return/内蒙古/.test(e)&&["\u{1F1F2}\u{1F1F3}"].includes(n)?r="\u{1F1E8}\u{1F1F3}":r=n;for(let n of Object.keys(P6))if(P6[n].some(o=>RegExp(`(^|[^a-zA-Z])${o}([^a-zA-Z]|$)`).test(e))&&!(n=="\u{1F1E8}\u{1F1F3}"&&RegExp("(^|[^a-zA-Z])CN2([^a-zA-Z]|$)").test(e)))return r=n;return r}function GT(e){return P6[wh(e)]?.[0]}function w1(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴☠️|🏳️🌈/g,"").trim()}var r_e,P6,lw,O6=re(()=>{r_e=F(I());gt();od();P6={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["EXP","BAND"],"\u{1F1E6}\u{1F1F8}":["AS","ASM"],"\u{1F1E6}\u{1F1F4}":["AO","AGO"],"\u{1F1E7}\u{1F1F8}":["BS","BHS"],"\u{1F1E7}\u{1F1E7}":["BB","BRB"],"\u{1F1E7}\u{1F1F2}":["BM","BMU"],"\u{1F1E7}\u{1F1FC}":["BW","BWA"],"\u{1F1E7}\u{1F1FB}":["BV","BVT"],"\u{1F1E7}\u{1F1FF}":["BZ","BLZ"],"\u{1F1EE}\u{1F1F4}":["IO","IOT"],"\u{1F1F8}\u{1F1E7}":["SB","SLB"],"\u{1F1FB}\u{1F1EC}":["VG","VGB"],"\u{1F1E7}\u{1F1EE}":["BI","BDI"],"\u{1F1E8}\u{1F1F2}":["CM","CMR"],"\u{1F1E8}\u{1F1FB}":["CV","CPV"],"\u{1F1F0}\u{1F1FE}":["KY","CYM"],"\u{1F1F9}\u{1F1E9}":["TD","TCD"],"\u{1F1E8}\u{1F1FD}":["CX","CXR"],"\u{1F1E8}\u{1F1E8}":["CC","CCK"],"\u{1F1F0}\u{1F1F2}":["KM","COM"],"\u{1F1FE}\u{1F1F9}":["YT","MYT"],"\u{1F1E8}\u{1F1EC}":["CG","COG"],"\u{1F1E8}\u{1F1E9}":["CD","COD"],"\u{1F1E8}\u{1F1F0}":["CK","COK"],"\u{1F1E8}\u{1F1FA}":["CU","CUB"],"\u{1F1E7}\u{1F1EF}":["BJ","BEN"],"\u{1F1E9}\u{1F1F2}":["DM","DMA"],"\u{1F1E9}\u{1F1F4}":["DO","DOM"],"\u{1F1F8}\u{1F1FB}":["SV","SLV"],"\u{1F1EC}\u{1F1F6}":["GQ","GNQ"],"\u{1F1EA}\u{1F1F9}":["ET","ETH"],"\u{1F1EA}\u{1F1F7}":["ER","ERI"],"\u{1F1EB}\u{1F1F4}":["FO","FRO"],"\u{1F1EB}\u{1F1F0}":["FK","FLK"],"\u{1F1EC}\u{1F1F8}":["GS","SGS"],"\u{1F1EB}\u{1F1EF}":["FJ","FJI"],"\u{1F1E6}\u{1F1FD}":["AX","ALA"],"\u{1F1EB}\u{1F1FD}":["FX"],"\u{1F1EC}\u{1F1EB}":["GF","GUF"],"\u{1F1F5}\u{1F1EB}":["PF","PYF"],"\u{1F1F9}\u{1F1EB}":["TF","ATF"],"\u{1F1E9}\u{1F1EF}":["DJ","DJI"],"\u{1F1EC}\u{1F1E6}":["GA","GAB"],"\u{1F1EC}\u{1F1F2}":["GM","GMB"],"\u{1F1F5}\u{1F1F8}":["PS","PSE"],"\u{1F1EC}\u{1F1ED}":["GH","GHA"],"\u{1F1EC}\u{1F1EE}":["GI","GIB"],"\u{1F1F0}\u{1F1EE}":["KI","KIR"],"\u{1F1EC}\u{1F1E9}":["GD","GRD"],"\u{1F1EC}\u{1F1F5}":["GP","GLP"],"\u{1F1EC}\u{1F1FC}":["GW","GNB"],"\u{1F1EC}\u{1F1F3}":["GN","GIN"],"\u{1F1EC}\u{1F1FE}":["GY","GUY"],"\u{1F1ED}\u{1F1F9}":["HT","HTI"],"\u{1F1ED}\u{1F1F2}":["HM","HMD"],"\u{1F1ED}\u{1F1F3}":["HN","HND"],"\u{1F1E8}\u{1F1EE}":["CI","CIV"],"\u{1F1EF}\u{1F1F2}":["JM","JAM"],"\u{1F1F0}\u{1F1FC}":["KW","KWT"],"\u{1F1F1}\u{1F1E7}":["LB","LBN"],"\u{1F1F1}\u{1F1F7}":["LR","LBR"],"\u{1F1F1}\u{1F1FE}":["LY","LBY"],"\u{1F1F1}\u{1F1EE}":["LI","LIE"],"\u{1F1F2}\u{1F1EC}":["MG","MDG"],"\u{1F1F2}\u{1F1FC}":["MW","MWI"],"\u{1F1F2}\u{1F1FB}":["MV","MDV"],"\u{1F1F2}\u{1F1F6}":["MQ","MTQ"],"\u{1F1F2}\u{1F1F7}":["MR","MRT"],"\u{1F1F2}\u{1F1FA}":["MU","MUS"],"\u{1F1F2}\u{1F1E8}":["MC","MCO"],"\u{1F1F2}\u{1F1EA}":["ME","MNE"],"\u{1F1F2}\u{1F1F8}":["MS","MSR"],"\u{1F1F2}\u{1F1FF}":["MZ","MOZ"],"\u{1F1F3}\u{1F1E6}":["NA","NAM"],"\u{1F1F3}\u{1F1F7}":["NR","NRU"],"\u{1F1E8}\u{1F1FC}":["CW","CUW"],"\u{1F1F8}\u{1F1FD}":["SX","SXM"],"\u{1F1E7}\u{1F1F6}":["BQ","BES"],"\u{1F1F3}\u{1F1E8}":["NC","NCL"],"\u{1F1FB}\u{1F1FA}":["VU","VUT"],"\u{1F1F3}\u{1F1EE}":["NI","NIC"],"\u{1F1F3}\u{1F1EA}":["NE","NER"],"\u{1F1F3}\u{1F1FA}":["NU","NIU"],"\u{1F1F3}\u{1F1EB}":["NF","NFK"],"\u{1F1FA}\u{1F1F2}":["UM","UMI"],"\u{1F1EB}\u{1F1F2}":["FM","FSM"],"\u{1F1F2}\u{1F1ED}":["MH","MHL"],"\u{1F1F5}\u{1F1FC}":["PW","PLW"],"\u{1F1F5}\u{1F1F3}":["PN","PCN"],"\u{1F1F9}\u{1F1F1}":["TL","TLS"],"\u{1F1F7}\u{1F1FC}":["RW","RWA"],"\u{1F1E7}\u{1F1F1}":["BL","BLM"],"\u{1F1F8}\u{1F1ED}":["SH","SHN"],"\u{1F1F0}\u{1F1F3}":["KN","KNA"],"\u{1F1E6}\u{1F1EE}":["AI","AIA"],"\u{1F1F1}\u{1F1E8}":["LC","LCA"],"\u{1F1F2}\u{1F1EB}":["MF","MAF"],"\u{1F1F5}\u{1F1F2}":["PM","SPM"],"\u{1F1FB}\u{1F1E8}":["VC","VCT"],"\u{1F1F8}\u{1F1F2}":["SM","SMR"],"\u{1F1F8}\u{1F1F9}":["ST","STP"],"\u{1F1F8}\u{1F1F3}":["SN","SEN"],"\u{1F1F8}\u{1F1E8}":["SC","SYC"],"\u{1F1F8}\u{1F1F8}":["SS","SSD"],"\u{1F1F8}\u{1F1E9}":["SD","SDN"],"\u{1F1EA}\u{1F1ED}":["EH","ESH"],"\u{1F1F8}\u{1F1F7}":["SR","SUR"],"\u{1F1F8}\u{1F1EF}":["SJ","SJM"],"\u{1F1F8}\u{1F1FF}":["SZ","SWZ"],"\u{1F1F8}\u{1F1FE}":["SY","SYR"],"\u{1F1F9}\u{1F1EF}":["TJ","TJK"],"\u{1F1F9}\u{1F1F0}":["TK","TKL"],"\u{1F1F9}\u{1F1F4}":["TO","TON"],"\u{1F1F9}\u{1F1F9}":["TT","TTO"],"\u{1F1F9}\u{1F1F2}":["TM","TKM"],"\u{1F1F9}\u{1F1E8}":["TC","TCA"],"\u{1F1F9}\u{1F1FB}":["TV","TUV"],"\u{1F1FA}\u{1F1EC}":["UG","UGA"],"\u{1F1EC}\u{1F1EC}":["GG","GGY"],"\u{1F1EF}\u{1F1EA}":["JE","JEY"],"\u{1F1F9}\u{1F1FF}":["TZ","TZA"],"\u{1F1E7}\u{1F1EB}":["BF","BFA"],"\u{1F1FA}\u{1F1FF}":["UZ","UZB"],"\u{1F1FC}\u{1F1EB}":["WF","WLF"],"\u{1F1FE}\u{1F1EA}":["YE","YEM"],"\u{1F1FF}\u{1F1F2}":["ZM","ZMB"],"\u{1F1FD}\u{1F1F0}":["XK"],"\u{1F1FA}\u{1F1F3}":["UN"],"\u{1F1F8}\u{1F1F1}":["SL","SLE"],"\u{1F1F2}\u{1F1F5}":["MP","MNP"],"\u{1F1F8}\u{1F1F4}":["SO","SOM"],"\u{1F1E6}\u{1F1F6}":["AQ","ATA"],"\u{1F1E6}\u{1F1EC}":["AG","ATG"],"\u{1F1EC}\u{1F1F1}":["GL","GRL"],"\u{1F1FF}\u{1F1FC}":["ZW","ZWE"],"\u{1F1E6}\u{1F1FC}":["AW","ABW"],"\u{1F1F2}\u{1F1F1}":["ML","MLI"],"\u{1F1E6}\u{1F1E9}":["AD","AND"],"\u{1F1E6}\u{1F1EA}":["AE","ARE"],"\u{1F1E6}\u{1F1EB}":["AF","AFG"],"\u{1F1E6}\u{1F1F1}":["AL","ALB"],"\u{1F1E6}\u{1F1F2}":["AM","ARM"],"\u{1F1E6}\u{1F1F7}":["AR","ARG"],"\u{1F1E6}\u{1F1F9}":["AT","AUT"],"\u{1F1E6}\u{1F1FA}":["AU","AUS"],"\u{1F1E6}\u{1F1FF}":["AZ","AZE"],"\u{1F1E7}\u{1F1E6}":["BA","BIH"],"\u{1F1E7}\u{1F1E9}":["BD","BGD"],"\u{1F1E7}\u{1F1EA}":["BE","BEL"],"\u{1F1E7}\u{1F1EC}":["BG","BGR"],"\u{1F1E7}\u{1F1ED}":["BH","BHR"],"\u{1F1E7}\u{1F1F4}":["BO","BOL"],"\u{1F1E7}\u{1F1F3}":["BN","BRN"],"\u{1F1E7}\u{1F1F7}":["BR","BRA"],"\u{1F1E7}\u{1F1F9}":["BT","BTN"],"\u{1F1E7}\u{1F1FE}":["BY","BLR"],"\u{1F1E8}\u{1F1E6}":["CA","CAN"],"\u{1F1E8}\u{1F1EB}":["CF","CAF"],"\u{1F1E8}\u{1F1ED}":["CH","CHE"],"\u{1F1E8}\u{1F1F1}":["CL","CHL"],"\u{1F1E8}\u{1F1F4}":["CO","COL"],"\u{1F1E8}\u{1F1F7}":["CR","CRI"],"\u{1F1E8}\u{1F1FE}":["CY","CYP"],"\u{1F1E8}\u{1F1FF}":["CZ","CZE"],"\u{1F1E9}\u{1F1EA}":["DE","DEU"],"\u{1F1E9}\u{1F1F0}":["DK","DNK"],"\u{1F1E9}\u{1F1FF}":["DZ","DZA"],"\u{1F1EA}\u{1F1E8}":["EC","ECU"],"\u{1F1EA}\u{1F1EA}":["EE","EST"],"\u{1F1EA}\u{1F1EC}":["EG","EGY"],"\u{1F1EA}\u{1F1F8}":["ES","ESP"],"\u{1F1EA}\u{1F1FA}":["EU"],"\u{1F1EB}\u{1F1EE}":["FI","FIN"],"\u{1F1EB}\u{1F1F7}":["FR","FRA"],"\u{1F1EC}\u{1F1E7}":["GB","GBR","UK"],"\u{1F1EC}\u{1F1EA}":["GE","GEO"],"\u{1F1EC}\u{1F1F7}":["GR","GRC"],"\u{1F1EC}\u{1F1F9}":["GT","GTM"],"\u{1F1EC}\u{1F1FA}":["GU","GUM"],"\u{1F1ED}\u{1F1F0}":["HK","HKG","HKT","HKBN","HGC","WTT","CMI"],"\u{1F1ED}\u{1F1F7}":["HR","HRV"],"\u{1F1ED}\u{1F1FA}":["HU","HUN"],"\u{1F1EE}\u{1F1F6}":["IQ","IRQ"],"\u{1F1EF}\u{1F1F4}":["JO","JOR"],"\u{1F1EF}\u{1F1F5}":["JP","JPN","TYO"],"\u{1F1F0}\u{1F1EA}":["KE","KEN"],"\u{1F1F0}\u{1F1EC}":["KG","KGZ"],"\u{1F1F0}\u{1F1ED}":["KH","KHM"],"\u{1F1F0}\u{1F1F5}":["KP","PRK"],"\u{1F1F0}\u{1F1F7}":["KR","KOR","SEL"],"\u{1F1F0}\u{1F1FF}":["KZ","KAZ"],"\u{1F1EE}\u{1F1E9}":["ID","IDN"],"\u{1F1EE}\u{1F1EA}":["IE","IRL"],"\u{1F1EE}\u{1F1F1}":["IL","ISR"],"\u{1F1EE}\u{1F1F2}":["IM","IMN"],"\u{1F1EE}\u{1F1F3}":["IN","IND"],"\u{1F1EE}\u{1F1F7}":["IR","IRN"],"\u{1F1EE}\u{1F1F8}":["IS","ISL"],"\u{1F1EE}\u{1F1F9}":["IT","ITA"],"\u{1F1F1}\u{1F1E6}":["LA","LAO"],"\u{1F1F1}\u{1F1F0}":["LK","LKA"],"\u{1F1F1}\u{1F1F8}":["LS","LSO"],"\u{1F1F1}\u{1F1F9}":["LT","LTU"],"\u{1F1F1}\u{1F1FA}":["LU","LUX"],"\u{1F1F1}\u{1F1FB}":["LV","LVA"],"\u{1F1F2}\u{1F1E6}":["MA","MAR"],"\u{1F1F2}\u{1F1E9}":["MD","MDA"],"\u{1F1F3}\u{1F1EC}":["NG","NGA"],"\u{1F1F2}\u{1F1F2}":["MM","MMR"],"\u{1F1F2}\u{1F1F0}":["MK","MKD"],"\u{1F1F2}\u{1F1F3}":["MN","MNG"],"\u{1F1F2}\u{1F1F4}":["MO","MAC","CTM"],"\u{1F1F2}\u{1F1F9}":["MT","MLT"],"\u{1F1F2}\u{1F1FD}":["MX","MEX"],"\u{1F1F2}\u{1F1FE}":["MY","MYS"],"\u{1F1F3}\u{1F1F1}":["NL","NLD","AMS"],"\u{1F1F3}\u{1F1F4}":["NO","NOR"],"\u{1F1F3}\u{1F1F5}":["NP","NPL"],"\u{1F1F3}\u{1F1FF}":["NZ","NZL"],"\u{1F1F4}\u{1F1F2}":["OM","OMN"],"\u{1F1F5}\u{1F1E6}":["PA","PAN"],"\u{1F1F5}\u{1F1EA}":["PE","PER"],"\u{1F1F5}\u{1F1ED}":["PH","PHL"],"\u{1F1F5}\u{1F1F0}":["PK","PAK"],"\u{1F1F5}\u{1F1F1}":["PL","POL"],"\u{1F1F5}\u{1F1F7}":["PR","PRI"],"\u{1F1F5}\u{1F1F9}":["PT","PRT"],"\u{1F1F5}\u{1F1FE}":["PY","PRY"],"\u{1F1F5}\u{1F1EC}":["PG","PNG"],"\u{1F1F6}\u{1F1E6}":["QA","QAT"],"\u{1F1F7}\u{1F1F4}":["RO","ROU"],"\u{1F1F7}\u{1F1F8}":["RS","SRB"],"\u{1F1F7}\u{1F1EA}":["RE","REU"],"\u{1F1F7}\u{1F1FA}":["RU","RUS"],"\u{1F1F8}\u{1F1E6}":["SA","SAU"],"\u{1F1FC}\u{1F1F8}":["WS","WSM"],"\u{1F1F8}\u{1F1EA}":["SE","SWE"],"\u{1F1F8}\u{1F1EC}":["SG","SGP"],"\u{1F1F8}\u{1F1EE}":["SI","SVN"],"\u{1F1F8}\u{1F1F0}":["SK","SVK"],"\u{1F1F9}\u{1F1EC}":["TG","TGO"],"\u{1F1F9}\u{1F1ED}":["TH","THA"],"\u{1F1F9}\u{1F1F3}":["TN","TUN"],"\u{1F1F9}\u{1F1F7}":["TR","TUR"],"\u{1F1F9}\u{1F1FC}":["TW","TWN","CHT","HINET","ROC"],"\u{1F1FA}\u{1F1E6}":["UA","UKR"],"\u{1F1FA}\u{1F1F8}":["US","USA","LAX","SFO","SJC"],"\u{1F1FA}\u{1F1FE}":["UY","URY"],"\u{1F1FB}\u{1F1E6}":["VA","VAT"],"\u{1F1FB}\u{1F1EA}":["VE","VEN"],"\u{1F1FB}\u{1F1EE}":["VI","VIR"],"\u{1F1FB}\u{1F1F3}":["VN","VNM"],"\u{1F1FF}\u{1F1E6}":["ZA","ZAF","JNB"],"\u{1F1E8}\u{1F1F3}":["CN","CHN","BACK"]};lw=class{constructor({country,asn}={}){if(R.env.isNode){let Reader=require("@maxmind/geoip2-node").Reader,fs=Pi(),countryFile=country||eval("process.env.SUB_STORE_MMDB_COUNTRY_PATH"),asnFile=asn||eval("process.env.SUB_STORE_MMDB_ASN_PATH");if(countryFile&&(this.countryReader=Reader.openBuffer(fs.readFileSync(countryFile))),asnFile){if(!fs.existsSync(asnFile))throw new Error("GeoLite2 ASN MMDB does not exist");this.asnReader=Reader.openBuffer(fs.readFileSync(asnFile))}}}geoip(e){return this.countryReader?.country(e)?.country?.isoCode}ipaso(e){return this.asnReader?.asn(e)?.autonomousSystemOrganization}ipasn(e){return this.asnReader?.asn(e)?.autonomousSystemNumber}}});var zT=be(N6=>{"use strict";var s_e=F(I());N6.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e};N6.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}});var YT=be(L6=>{"use strict";var o_e=F(I());L6.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e};L6.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var WT=be(U6=>{"use strict";var u_e=F(I());U6.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e};U6.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var XT=be(H6=>{"use strict";var l_e=F(I());H6.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e};H6.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var JT=be(M6=>{"use strict";var d_e=F(I());M6.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`};M6.toCode=function(e){if(typeof e=="number")return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}});var e7=be((QT,q6)=>{var h_e=F(I()),ZT=(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=m,e.encode=f,e.familyOf=l,e.name=void 0,e.sizeOf=u,e.v6=e.v4=void 0;let t=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,s=16,o={name:"v4",size:r,isFormat:p=>t.test(p),encode(p,d,v){v=~~v,d=d||new Uint8Array(v+r);let g=p.length,y=0;for(let w=0;w<g;){let E=p.charCodeAt(w++);E===46?(d[v++]=y,y=0):y=y*10+(E-48)}return d[v]=y,d},decode(p,d){return d=~~d,`${p[d++]}.${p[d++]}.${p[d++]}.${p[d]}`}};e.v4=o;let i={name:"v6",size:s,isFormat:p=>p.length>0&&n.test(p),encode(p,d,v){v=~~v;let g=v+s,y=-1,w=0,E=0,S=!0,C=!1;d=d||new Uint8Array(v+s);for(let D=0;D<p.length;D++){let H=p.charCodeAt(D);H===58?(S?y!==-1?(v<g&&(d[v]=0),v<g-1&&(d[v+1]=0),v+=2):v<g&&(y=v):(C===!0?(v<g&&(d[v]=E),v++):(v<g&&(d[v]=w>>8),v<g-1&&(d[v+1]=w&255),v+=2),w=0,E=0),S=!0,C=!1):H===46?(v<g&&(d[v]=E),v++,E=0,w=0,S=!1,C=!0):(S=!1,H>=97?H-=87:H>=65?H-=55:(H-=48,E=E*10+H),w=(w<<4)+H)}if(S===!1)C===!0?(v<g&&(d[v]=E),v++):(v<g&&(d[v]=w>>8),v<g-1&&(d[v+1]=w&255),v+=2);else if(y===0)v<g&&(d[v]=0),v<g-1&&(d[v+1]=0),v+=2;else if(y!==-1){v+=2;for(let D=Math.min(v-1,g-1);D>=y+2;D--)d[D]=d[D-2];d[y]=0,d[y+1]=0,y=v}if(y!==v&&y!==-1)for(v>g-2&&(v=g-2);g>y;)d[--g]=v<g&&v>y?d[--v]:0;else for(;v<g;)d[v++]=0;return d},decode(p,d){d=~~d;let v="";for(let g=0;g<s;g+=2)g!==0&&(v+=":"),v+=(p[d+g]<<8|p[d+g+1]).toString(16);return v.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};e.v6=i;let a="ip";e.name=a;function u(p){if(o.isFormat(p))return o.size;if(i.isFormat(p))return i.size;throw Error(`Invalid ip address: ${p}`)}function l(p){return u(p)===o.size?1:2}function f(p,d,v){v=~~v;let g=u(p);return typeof d=="function"&&(d=d(v+g)),g===o.size?o.encode(p,d,v):i.encode(p,d,v)}function m(p,d,v){if(d=~~d,v=v||p.length-d,v===o.size)return o.decode(p,d,v);if(v===i.size)return i.decode(p,d,v);throw Error(`Invalid buffer size needs to be ${o.size} for v4 or ${i.size} for v6.`)}return"default"in e?e.default:e})({});typeof define=="function"&&define.amd?define([],function(){return ZT}):typeof q6=="object"&&typeof QT=="object"&&(q6.exports=ZT)});var n7=be(et=>{"use strict";var m_e=F(I()),tt=iu().Buffer,Nu=zT(),tre=YT(),rre=WT(),dw=XT(),j6=JT(),Ef=e7(),nre=0,t7=32768,K6=32768,sre=~K6,r7=32768,ire=~r7,qe=et.name={};qe.encode=function(e,t,r,{mail:n=!1}={}){t||(t=tt.alloc(qe.encodingLength(e))),r||(r=0);let s=r,o=e.replace(/^\.|\.$/gm,"");if(o.length){let i=[];if(n){let a="";o.split(".").forEach(u=>{u.endsWith("\\")?a+=(a.length?".":"")+u.slice(0,-1):i.length===0&&a.length?i.push(a+"."+u):i.push(u)})}else i=o.split(".");for(let a=0;a<i.length;a++){let u=t.write(i[a],r+1);t[r]=u,r+=u+1}}return t[r++]=0,qe.encode.bytes=r-s,t};qe.encode.bytes=0;qe.decode=function(e,t,{mail:r=!1}={}){t||(t=0);let n=[],s=t,o=0,i=0,a=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");let u=e[t++];if(i+=a?0:1,u===0)break;if((u&192)===0){if(t+u>e.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=u+1,o>254)throw new Error("Cannot decode name (name too long)");let l=e.toString("utf-8",t,t+u);r&&(l=l.replace(/\./g,"\\.")),n.push(l),t+=u,i+=a?0:u}else if((u&192)===192){if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");let l=e.readUInt16BE(t-1)-49152;if(l>=s)throw new Error("Cannot decode name (bad pointer)");t=l,s=l,i+=a?0:1,a=!0}else throw new Error("Cannot decode name (bad label)")}return qe.decode.bytes=i,n.length===0?".":n.join(".")};qe.decode.bytes=0;qe.encodingLength=function(e){return e==="."||e===".."?1:tt.byteLength(e.replace(/^\.|\.$/gm,""))+2};var Tt={};Tt.encode=function(e,t,r){t||(t=tt.alloc(Tt.encodingLength(e))),r||(r=0);let n=t.write(e,r+1);return t[r]=n,Tt.encode.bytes=n+1,t};Tt.encode.bytes=0;Tt.decode=function(e,t){t||(t=0);let r=e[t],n=e.toString("utf-8",t+1,t+1+r);return Tt.decode.bytes=r+1,n};Tt.decode.bytes=0;Tt.encodingLength=function(e){return tt.byteLength(e)+1};var Ro={};Ro.encode=function(e,t,r){t||(t=Ro.encodingLength(e)),r||(r=0);let n=(e.flags||0)&32767,s=e.type==="response"?t7:nre;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(n|s,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t};Ro.encode.bytes=12;Ro.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");let r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:r&t7?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:rre.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:tre.toString(r&15),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}};Ro.decode.bytes=12;Ro.encodingLength=function(){return 12};var Bu=et.unknown={};Bu.encode=function(e,t,r){return t||(t=tt.alloc(Bu.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),Bu.encode.bytes=e.length+2,t};Bu.encode.bytes=0;Bu.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return Bu.decode.bytes=r+2,n};Bu.decode.bytes=0;Bu.encodingLength=function(e){return e.length+2};var Iu=et.ns={};Iu.encode=function(e,t,r){return t||(t=tt.alloc(Iu.encodingLength(e))),r||(r=0),qe.encode(e,t,r+2),t.writeUInt16BE(qe.encode.bytes,r),Iu.encode.bytes=qe.encode.bytes+2,t};Iu.encode.bytes=0;Iu.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=qe.decode(e,t+2);return Iu.decode.bytes=r+2,n};Iu.decode.bytes=0;Iu.encodingLength=function(e){return qe.encodingLength(e)+2};var $u=et.soa={};$u.encode=function(e,t,r){t||(t=tt.alloc($u.encodingLength(e))),r||(r=0);let n=r;return r+=2,qe.encode(e.mname,t,r),r+=qe.encode.bytes,qe.encode(e.rname,t,r,{mail:!0}),r+=qe.encode.bytes,t.writeUInt32BE(e.serial||0,r),r+=4,t.writeUInt32BE(e.refresh||0,r),r+=4,t.writeUInt32BE(e.retry||0,r),r+=4,t.writeUInt32BE(e.expire||0,r),r+=4,t.writeUInt32BE(e.minimum||0,r),r+=4,t.writeUInt16BE(r-n-2,n),$u.encode.bytes=r-n,t};$u.encode.bytes=0;$u.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mname=qe.decode(e,t),t+=qe.decode.bytes,n.rname=qe.decode(e,t,{mail:!0}),t+=qe.decode.bytes,n.serial=e.readUInt32BE(t),t+=4,n.refresh=e.readUInt32BE(t),t+=4,n.retry=e.readUInt32BE(t),t+=4,n.expire=e.readUInt32BE(t),t+=4,n.minimum=e.readUInt32BE(t),t+=4,$u.decode.bytes=t-r,n};$u.decode.bytes=0;$u.encodingLength=function(e){return 22+qe.encodingLength(e.mname)+qe.encodingLength(e.rname)};var xu=et.txt={};xu.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let s=0;s<e.length;s++)if(typeof e[s]=="string"&&(e[s]=tt.from(e[s])),!tt.isBuffer(e[s]))throw new Error("Must be a Buffer");t||(t=tt.alloc(xu.encodingLength(e))),r||(r=0);let n=r;return r+=2,e.forEach(function(s){t[r++]=s.length,s.copy(t,r,0,s.length),r+=s.length}),t.writeUInt16BE(r-n-2,n),xu.encode.bytes=r-n,t};xu.encode.bytes=0;xu.decode=function(e,t){t||(t=0);let r=t,n=e.readUInt16BE(t);t+=2;let s=[];for(;n>0;){let o=e[t++];if(--n,n<o)throw new Error("Buffer overflow");s.push(e.slice(t,t+o)),t+=o,n-=o}return xu.decode.bytes=t-r,s};xu.decode.bytes=0;xu.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(r){typeof r=="string"?t+=tt.byteLength(r)+1:t+=r.length+1}),t};var Ru=et.null={};Ru.encode=function(e,t,r){t||(t=tt.alloc(Ru.encodingLength(e))),r||(r=0),typeof e=="string"&&(e=tt.from(e)),e||(e=tt.alloc(0));let n=r;r+=2;let s=e.length;return e.copy(t,r,0,s),r+=s,t.writeUInt16BE(r-n-2,n),Ru.encode.bytes=r-n,t};Ru.encode.bytes=0;Ru.decode=function(e,t){t||(t=0);let r=t,n=e.readUInt16BE(t);t+=2;let s=e.slice(t,t+n);return t+=n,Ru.decode.bytes=t-r,s};Ru.decode.bytes=0;Ru.encodingLength=function(e){return e?(tt.isBuffer(e)?e.length:tt.byteLength(e))+2:2};var Tu=et.hinfo={};Tu.encode=function(e,t,r){t||(t=tt.alloc(Tu.encodingLength(e))),r||(r=0);let n=r;return r+=2,Tt.encode(e.cpu,t,r),r+=Tt.encode.bytes,Tt.encode(e.os,t,r),r+=Tt.encode.bytes,t.writeUInt16BE(r-n-2,n),Tu.encode.bytes=r-n,t};Tu.encode.bytes=0;Tu.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.cpu=Tt.decode(e,t),t+=Tt.decode.bytes,n.os=Tt.decode(e,t),t+=Tt.decode.bytes,Tu.decode.bytes=t-r,n};Tu.decode.bytes=0;Tu.encodingLength=function(e){return Tt.encodingLength(e.cpu)+Tt.encodingLength(e.os)+2};var $o=et.ptr={},ore=et.cname=$o,are=et.dname=$o;$o.encode=function(e,t,r){return t||(t=tt.alloc($o.encodingLength(e))),r||(r=0),qe.encode(e,t,r+2),t.writeUInt16BE(qe.encode.bytes,r),$o.encode.bytes=qe.encode.bytes+2,t};$o.encode.bytes=0;$o.decode=function(e,t){t||(t=0);let r=qe.decode(e,t+2);return $o.decode.bytes=qe.decode.bytes+2,r};$o.decode.bytes=0;$o.encodingLength=function(e){return qe.encodingLength(e)+2};var ku=et.srv={};ku.encode=function(e,t,r){t||(t=tt.alloc(ku.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.priority||0,r+2),t.writeUInt16BE(e.weight||0,r+4),t.writeUInt16BE(e.port||0,r+6),qe.encode(e.target,t,r+8);let n=qe.encode.bytes+6;return t.writeUInt16BE(n,r),ku.encode.bytes=n+2,t};ku.encode.bytes=0;ku.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n={};return n.priority=e.readUInt16BE(t+2),n.weight=e.readUInt16BE(t+4),n.port=e.readUInt16BE(t+6),n.target=qe.decode(e,t+8),ku.decode.bytes=r+2,n};ku.decode.bytes=0;ku.encodingLength=function(e){return 8+qe.encodingLength(e.target)};var wi=et.caa={};wi.ISSUER_CRITICAL=128;wi.encode=function(e,t,r){let n=wi.encodingLength(e);return t||(t=tt.alloc(wi.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=wi.ISSUER_CRITICAL),t.writeUInt16BE(n-2,r),r+=2,t.writeUInt8(e.flags||0,r),r+=1,Tt.encode(e.tag,t,r),r+=Tt.encode.bytes,t.write(e.value,r),r+=tt.byteLength(e.value),wi.encode.bytes=n,t};wi.encode.bytes=0;wi.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t);t+=2;let n=t,s={};return s.flags=e.readUInt8(t),t+=1,s.tag=Tt.decode(e,t),t+=Tt.decode.bytes,s.value=e.toString("utf-8",t,n+r),s.issuerCritical=!!(s.flags&wi.ISSUER_CRITICAL),wi.decode.bytes=r+2,s};wi.decode.bytes=0;wi.encodingLength=function(e){return Tt.encodingLength(e.tag)+Tt.encodingLength(e.value)+2};var Qc=et.mx={};Qc.encode=function(e,t,r){t||(t=tt.alloc(Qc.encodingLength(e))),r||(r=0);let n=r;return r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,qe.encode(e.exchange,t,r),r+=qe.encode.bytes,t.writeUInt16BE(r-n-2,n),Qc.encode.bytes=r-n,t};Qc.encode.bytes=0;Qc.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.preference=e.readUInt16BE(t),t+=2,n.exchange=qe.decode(e,t),t+=qe.decode.bytes,Qc.decode.bytes=t-r,n};Qc.encodingLength=function(e){return 4+qe.encodingLength(e.exchange)};var Pu=et.a={};Pu.encode=function(e,t,r){return t||(t=tt.alloc(Pu.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,Ef.v4.encode(e,t,r),Pu.encode.bytes=6,t};Pu.encode.bytes=0;Pu.decode=function(e,t){t||(t=0),t+=2;let r=Ef.v4.decode(e,t);return Pu.decode.bytes=6,r};Pu.decode.bytes=0;Pu.encodingLength=function(){return 6};var Ou=et.aaaa={};Ou.encode=function(e,t,r){return t||(t=tt.alloc(Ou.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,Ef.v6.encode(e,t,r),Ou.encode.bytes=18,t};Ou.encode.bytes=0;Ou.decode=function(e,t){t||(t=0),t+=2;let r=Ef.v6.decode(e,t);return Ou.decode.bytes=18,r};Ou.decode.bytes=0;Ou.encodingLength=function(){return 18};var Zs=et.option={};Zs.encode=function(e,t,r){t||(t=tt.alloc(Zs.encodingLength(e))),r||(r=0);let n=r,s=j6.toCode(e.code);if(t.writeUInt16BE(s,r),r+=2,e.data)t.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(t,r),r+=e.data.length;else switch(s){case 8:let o=e.sourcePrefixLength||0,i=e.family||Ef.familyOf(e.ip),a=Ef.encode(e.ip,tt.alloc),u=Math.ceil(o/8);t.writeUInt16BE(u+4,r),r+=2,t.writeUInt16BE(i,r),r+=2,t.writeUInt8(o,r++),t.writeUInt8(e.scopePrefixLength||0,r++),a.copy(t,r,0,u),r+=u;break;case 11:e.timeout?(t.writeUInt16BE(2,r),r+=2,t.writeUInt16BE(e.timeout,r),r+=2):(t.writeUInt16BE(0,r),r+=2);break;case 12:let l=e.length||0;t.writeUInt16BE(l,r),r+=2,t.fill(0,r,r+l),r+=l;break;case 14:let f=e.tags.length*2;t.writeUInt16BE(f,r),r+=2;for(let m of e.tags)t.writeUInt16BE(m,r),r+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return Zs.encode.bytes=r-n,t};Zs.encode.bytes=0;Zs.decode=function(e,t){t||(t=0);let r={};r.code=e.readUInt16BE(t),r.type=j6.toString(r.code),t+=2;let n=e.readUInt16BE(t);switch(t+=2,r.data=e.slice(t,t+n),r.code){case 8:r.family=e.readUInt16BE(t),t+=2,r.sourcePrefixLength=e.readUInt8(t++),r.scopePrefixLength=e.readUInt8(t++);let s=tt.alloc(r.family===1?4:16);e.copy(s,0,t,t+n-4),r.ip=Ef.decode(s);break;case 11:n>0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let o=0;o<n;o+=2)r.tags.push(e.readUInt16BE(t)),t+=2}return Zs.decode.bytes=n+4,r};Zs.decode.bytes=0;Zs.encodingLength=function(e){if(e.data)return e.data.length+4;switch(j6.toCode(e.code)){case 8:let r=e.sourcePrefixLength||0;return Math.ceil(r/8)+8;case 11:return typeof e.timeout=="number"?6:4;case 12:return e.length+4;case 14:return 4+e.tags.length*2}throw new Error(`Unknown roption code: ${e.code}`)};var Ei=et.opt={};Ei.encode=function(e,t,r){t||(t=tt.alloc(Ei.encodingLength(e))),r||(r=0);let n=r,s=yh(e,Zs);return t.writeUInt16BE(s,r),r=y1(e,Zs,t,r+2),Ei.encode.bytes=r-n,t};Ei.encode.bytes=0;Ei.decode=function(e,t){t||(t=0);let r=t,n=[],s=e.readUInt16BE(t);t+=2;let o=0;for(;s>0;)n[o++]=Zs.decode(e,t),t+=Zs.decode.bytes,s-=Zs.decode.bytes;return Ei.decode.bytes=t-r,n};Ei.decode.bytes=0;Ei.encodingLength=function(e){return 2+yh(e||[],Zs)};var Ds=et.dnskey={};Ds.PROTOCOL_DNSSEC=3;Ds.ZONE_KEY=128;Ds.SECURE_ENTRYPOINT=32768;Ds.encode=function(e,t,r){t||(t=tt.alloc(Ds.encodingLength(e))),r||(r=0);let n=r,s=e.key;if(!tt.isBuffer(s))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(Ds.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,s.copy(t,r,0,s.length),r+=s.length,Ds.encode.bytes=r-n,t.writeUInt16BE(Ds.encode.bytes-2,n),t};Ds.encode.bytes=0;Ds.decode=function(e,t){t||(t=0);let r=t;var n={},s=e.readUInt16BE(t);if(t+=2,n.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==Ds.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,n.algorithm=e.readUInt8(t),t+=1,n.key=e.slice(t,r+s+2),t+=n.key.length,Ds.decode.bytes=t-r,n};Ds.decode.bytes=0;Ds.encodingLength=function(e){return 6+tt.byteLength(e.key)};var Sa=et.rrsig={};Sa.encode=function(e,t,r){t||(t=tt.alloc(Sa.encodingLength(e))),r||(r=0);let n=r,s=e.signature;if(!tt.isBuffer(s))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(Nu.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,qe.encode(e.signersName,t,r),r+=qe.encode.bytes,s.copy(t,r,0,s.length),r+=s.length,Sa.encode.bytes=r-n,t.writeUInt16BE(Sa.encode.bytes-2,n),t};Sa.encode.bytes=0;Sa.decode=function(e,t){t||(t=0);let r=t;var n={},s=e.readUInt16BE(t);return t+=2,n.typeCovered=Nu.toString(e.readUInt16BE(t)),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.labels=e.readUInt8(t),t+=1,n.originalTTL=e.readUInt32BE(t),t+=4,n.expiration=e.readUInt32BE(t),t+=4,n.inception=e.readUInt32BE(t),t+=4,n.keyTag=e.readUInt16BE(t),t+=2,n.signersName=qe.decode(e,t),t+=qe.decode.bytes,n.signature=e.slice(t,r+s+2),t+=n.signature.length,Sa.decode.bytes=t-r,n};Sa.decode.bytes=0;Sa.encodingLength=function(e){return 20+qe.encodingLength(e.signersName)+tt.byteLength(e.signature)};var _a=et.rp={};_a.encode=function(e,t,r){t||(t=tt.alloc(_a.encodingLength(e))),r||(r=0);let n=r;return r+=2,qe.encode(e.mbox||".",t,r,{mail:!0}),r+=qe.encode.bytes,qe.encode(e.txt||".",t,r),r+=qe.encode.bytes,_a.encode.bytes=r-n,t.writeUInt16BE(_a.encode.bytes-2,n),t};_a.encode.bytes=0;_a.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=qe.decode(e,t,{mail:!0})||".",t+=qe.decode.bytes,n.txt=qe.decode(e,t)||".",t+=qe.decode.bytes,_a.decode.bytes=t-r,n};_a.decode.bytes=0;_a.encodingLength=function(e){return 2+qe.encodingLength(e.mbox||".")+qe.encodingLength(e.txt||".")};var Sn={};Sn.encode=function(e,t,r){t||(t=tt.alloc(Sn.encodingLength(e))),r||(r=0);let n=r;for(var s=[],o=0;o<e.length;o++){var i=Nu.toType(e[o]);s[i>>8]===void 0&&(s[i>>8]=[]),s[i>>8][i>>3&31]|=1<<7-(i&7)}for(o=0;o<s.length;o++)if(s[o]!==void 0){var a=tt.from(s[o]);t.writeUInt8(o,r),r+=1,t.writeUInt8(a.length,r),r+=1,a.copy(t,r),r+=a.length}return Sn.encode.bytes=r-n,t};Sn.encode.bytes=0;Sn.decode=function(e,t,r){t||(t=0);let n=t;for(var s=[];t-n<r;){var o=e.readUInt8(t);t+=1;var i=e.readUInt8(t);t+=1;for(var a=0;a<i;a++)for(var u=e.readUInt8(t+a),l=0;l<8;l++)if(u&1<<7-l){var f=Nu.toString(o<<8|a<<3|l);s.push(f)}t+=i}return Sn.decode.bytes=t-n,s};Sn.decode.bytes=0;Sn.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var n=Nu.toType(e[r]);t[n>>8]=Math.max(t[n>>8]||0,n&255)}var s=0;for(r=0;r<t.length;r++)t[r]!==void 0&&(s+=2+Math.ceil((t[r]+1)/8));return s};var Ca=et.nsec={};Ca.encode=function(e,t,r){t||(t=tt.alloc(Ca.encodingLength(e))),r||(r=0);let n=r;return r+=2,qe.encode(e.nextDomain,t,r),r+=qe.encode.bytes,Sn.encode(e.rrtypes,t,r),r+=Sn.encode.bytes,Ca.encode.bytes=r-n,t.writeUInt16BE(Ca.encode.bytes-2,n),t};Ca.encode.bytes=0;Ca.decode=function(e,t){t||(t=0);let r=t;var n={},s=e.readUInt16BE(t);return t+=2,n.nextDomain=qe.decode(e,t),t+=qe.decode.bytes,n.rrtypes=Sn.decode(e,t,s-(t-r)),t+=Sn.decode.bytes,Ca.decode.bytes=t-r,n};Ca.decode.bytes=0;Ca.encodingLength=function(e){return 2+qe.encodingLength(e.nextDomain)+Sn.encodingLength(e.rrtypes)};var Da=et.nsec3={};Da.encode=function(e,t,r){t||(t=tt.alloc(Da.encodingLength(e))),r||(r=0);let n=r,s=e.salt;if(!tt.isBuffer(s))throw new Error("salt must be a Buffer");let o=e.nextDomain;if(!tt.isBuffer(o))throw new Error("nextDomain must be a Buffer");return r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.flags,r),r+=1,t.writeUInt16BE(e.iterations,r),r+=2,t.writeUInt8(s.length,r),r+=1,s.copy(t,r,0,s.length),r+=s.length,t.writeUInt8(o.length,r),r+=1,o.copy(t,r,0,o.length),r+=o.length,Sn.encode(e.rrtypes,t,r),r+=Sn.encode.bytes,Da.encode.bytes=r-n,t.writeUInt16BE(Da.encode.bytes-2,n),t};Da.encode.bytes=0;Da.decode=function(e,t){t||(t=0);let r=t;var n={},s=e.readUInt16BE(t);t+=2,n.algorithm=e.readUInt8(t),t+=1,n.flags=e.readUInt8(t),t+=1,n.iterations=e.readUInt16BE(t),t+=2;let o=e.readUInt8(t);t+=1,n.salt=e.slice(t,t+o),t+=o;let i=e.readUInt8(t);return t+=1,n.nextDomain=e.slice(t,t+i),t+=i,n.rrtypes=Sn.decode(e,t,s-(t-r)),t+=Sn.decode.bytes,Da.decode.bytes=t-r,n};Da.decode.bytes=0;Da.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+Sn.encodingLength(e.rrtypes)};var Fa=et.ds={};Fa.encode=function(e,t,r){t||(t=tt.alloc(Fa.encodingLength(e))),r||(r=0);let n=r,s=e.digest;if(!tt.isBuffer(s))throw new Error("Digest must be a Buffer");return r+=2,t.writeUInt16BE(e.keyTag,r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.digestType,r),r+=1,s.copy(t,r,0,s.length),r+=s.length,Fa.encode.bytes=r-n,t.writeUInt16BE(Fa.encode.bytes-2,n),t};Fa.encode.bytes=0;Fa.decode=function(e,t){t||(t=0);let r=t;var n={},s=e.readUInt16BE(t);return t+=2,n.keyTag=e.readUInt16BE(t),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.digestType=e.readUInt8(t),t+=1,n.digest=e.slice(t,r+s+2),t+=n.digest.length,Fa.decode.bytes=t-r,n};Fa.decode.bytes=0;Fa.encodingLength=function(e){return 6+tt.byteLength(e.digest)};var yi=et.sshfp={};yi.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};yi.encode=function(t,r,n){r||(r=tt.alloc(yi.encodingLength(t))),n||(n=0);let s=n;n+=2,r[n]=t.algorithm,n+=1,r[n]=t.hash,n+=1;let o=tt.from(t.fingerprint.toUpperCase(),"hex");if(o.length!==yi.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return o.copy(r,n),n+=o.byteLength,yi.encode.bytes=n-s,r.writeUInt16BE(yi.encode.bytes-2,s),r};yi.encode.bytes=0;yi.decode=function(t,r){r||(r=0);let n=r,s={};r+=2,s.algorithm=t[r],r+=1,s.hash=t[r],r+=1;let o=yi.getFingerprintLengthForHashType(s.hash);return s.fingerprint=t.slice(r,r+o).toString("hex").toUpperCase(),r+=o,yi.decode.bytes=r-n,s};yi.decode.bytes=0;yi.encodingLength=function(e){return 4+tt.from(e.fingerprint,"hex").byteLength};var Ba=et.naptr={};Ba.encode=function(e,t,r){t||(t=tt.alloc(Ba.encodingLength(e))),r||(r=0);let n=r;return r+=2,t.writeUInt16BE(e.order||0,r),r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,Tt.encode(e.flags,t,r),r+=Tt.encode.bytes,Tt.encode(e.services,t,r),r+=Tt.encode.bytes,Tt.encode(e.regexp,t,r),r+=Tt.encode.bytes,qe.encode(e.replacement,t,r),r+=qe.encode.bytes,Ba.encode.bytes=r-n,t.writeUInt16BE(Ba.encode.bytes-2,n),t};Ba.encode.bytes=0;Ba.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.order=e.readUInt16BE(t),t+=2,n.preference=e.readUInt16BE(t),t+=2,n.flags=Tt.decode(e,t),t+=Tt.decode.bytes,n.services=Tt.decode(e,t),t+=Tt.decode.bytes,n.regexp=Tt.decode(e,t),t+=Tt.decode.bytes,n.replacement=qe.decode(e,t),t+=qe.decode.bytes,Ba.decode.bytes=t-r,n};Ba.decode.bytes=0;Ba.encodingLength=function(e){return Tt.encodingLength(e.flags)+Tt.encodingLength(e.services)+Tt.encodingLength(e.regexp)+qe.encodingLength(e.replacement)+6};var Ia=et.tlsa={};Ia.encode=function(e,t,r){t||(t=tt.alloc(Ia.encodingLength(e))),r||(r=0);let n=r,s=e.certificate;if(!tt.isBuffer(s))throw new Error("Certificate must be a Buffer");return r+=2,t.writeUInt8(e.usage,r),r+=1,t.writeUInt8(e.selector,r),r+=1,t.writeUInt8(e.matchingType,r),r+=1,s.copy(t,r,0,s.length),r+=s.length,Ia.encode.bytes=r-n,t.writeUInt16BE(Ia.encode.bytes-2,n),t};Ia.encode.bytes=0;Ia.decode=function(e,t){t||(t=0);let r=t,n={},s=e.readUInt16BE(t);return t+=2,n.usage=e.readUInt8(t),t+=1,n.selector=e.readUInt8(t),t+=1,n.matchingType=e.readUInt8(t),t+=1,n.certificate=e.slice(t,r+s+2),t+=n.certificate.length,Ia.decode.bytes=t-r,n};Ia.decode.bytes=0;Ia.encodingLength=function(e){return 5+tt.byteLength(e.certificate)};var V6=et.record=function(e){switch(e.toUpperCase()){case"A":return Pu;case"PTR":return $o;case"CNAME":return ore;case"DNAME":return are;case"TXT":return xu;case"NULL":return Ru;case"AAAA":return Ou;case"SRV":return ku;case"HINFO":return Tu;case"CAA":return wi;case"NS":return Iu;case"SOA":return $u;case"MX":return Qc;case"OPT":return Ei;case"DNSKEY":return Ds;case"RRSIG":return Sa;case"RP":return _a;case"NSEC":return Ca;case"NSEC3":return Da;case"SSHFP":return yi;case"DS":return Fa;case"NAPTR":return Ba;case"TLSA":return Ia}return Bu},Pn=et.answer={};Pn.encode=function(e,t,r){t||(t=tt.alloc(Pn.encodingLength(e))),r||(r=0);let n=r;if(qe.encode(e.name,t,r),r+=qe.encode.bytes,t.writeUInt16BE(Nu.toType(e.type),r),e.type.toUpperCase()==="OPT"){if(e.name!==".")throw new Error("OPT name must be root.");t.writeUInt16BE(e.udpPayloadSize||4096,r+2),t.writeUInt8(e.extendedRcode||0,r+4),t.writeUInt8(e.ednsVersion||0,r+5),t.writeUInt16BE(e.flags||0,r+6),r+=8,Ei.encode(e.options||[],t,r),r+=Ei.encode.bytes}else{let s=dw.toClass(e.class===void 0?"IN":e.class);e.flush&&(s|=K6),t.writeUInt16BE(s,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;let o=V6(e.type);o.encode(e.data,t,r),r+=o.encode.bytes}return Pn.encode.bytes=r-n,t};Pn.encode.bytes=0;Pn.decode=function(e,t){t||(t=0);let r={},n=t;if(r.name=qe.decode(e,t),t+=qe.decode.bytes,r.type=Nu.toString(e.readUInt16BE(t)),r.type==="OPT")r.udpPayloadSize=e.readUInt16BE(t+2),r.extendedRcode=e.readUInt8(t+4),r.ednsVersion=e.readUInt8(t+5),r.flags=e.readUInt16BE(t+6),r.flag_do=(r.flags>>15&1)===1,r.options=Ei.decode(e,t+8),t+=8+Ei.decode.bytes;else{let s=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=dw.toString(s&sre),r.flush=!!(s&K6);let o=V6(r.type);r.data=o.decode(e,t+8),t+=8+o.decode.bytes}return Pn.decode.bytes=t-n,r};Pn.decode.bytes=0;Pn.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return qe.encodingLength(e.name)+8+V6(e.type).encodingLength(t)};var xo=et.question={};xo.encode=function(e,t,r){t||(t=tt.alloc(xo.encodingLength(e))),r||(r=0);let n=r;return qe.encode(e.name,t,r),r+=qe.encode.bytes,t.writeUInt16BE(Nu.toType(e.type),r),r+=2,t.writeUInt16BE(dw.toClass(e.class===void 0?"IN":e.class),r),r+=2,xo.encode.bytes=r-n,e};xo.encode.bytes=0;xo.decode=function(e,t){t||(t=0);let r=t,n={};return n.name=qe.decode(e,t),t+=qe.decode.bytes,n.type=Nu.toString(e.readUInt16BE(t)),t+=2,n.class=dw.toString(e.readUInt16BE(t)),t+=2,!!(n.class&r7)&&(n.class&=ire),xo.decode.bytes=t-r,n};xo.decode.bytes=0;xo.encodingLength=function(e){return qe.encodingLength(e.name)+4};et.AUTHORITATIVE_ANSWER=1024;et.TRUNCATED_RESPONSE=512;et.RECURSION_DESIRED=256;et.RECURSION_AVAILABLE=128;et.AUTHENTIC_DATA=32;et.CHECKING_DISABLED=16;et.DNSSEC_OK=32768;et.encode=function(e,t,r){let n=!t;n&&(t=tt.alloc(et.encodingLength(e))),r||(r=0);let s=r;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),Ro.encode(e,t,r),r+=Ro.encode.bytes,r=y1(e.questions,xo,t,r),r=y1(e.answers,Pn,t,r),r=y1(e.authorities,Pn,t,r),r=y1(e.additionals,Pn,t,r),et.encode.bytes=r-s,n&&et.encode.bytes!==t.length?t.slice(0,et.encode.bytes):t};et.encode.bytes=0;et.decode=function(e,t){t||(t=0);let r=t,n=Ro.decode(e,t);return t+=Ro.decode.bytes,t=fw(n.questions,xo,e,t),t=fw(n.answers,Pn,e,t),t=fw(n.authorities,Pn,e,t),t=fw(n.additionals,Pn,e,t),et.decode.bytes=t-r,n};et.decode.bytes=0;et.encodingLength=function(e){return Ro.encodingLength(e)+yh(e.questions||[],xo)+yh(e.answers||[],Pn)+yh(e.authorities||[],Pn)+yh(e.additionals||[],Pn)};et.streamEncode=function(e){let t=et.encode(e),r=tt.alloc(2);r.writeUInt16BE(t.byteLength);let n=tt.concat([r,t]);return et.streamEncode.bytes=n.byteLength,n};et.streamEncode.bytes=0;et.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;let r=et.decode(e.slice(2));return et.streamDecode.bytes=et.decode.bytes,r};et.streamDecode.bytes=0;function yh(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function y1(e,t,r,n){for(let s=0;s<e.length;s++)t.encode(e[s],r,n),n+=t.encode.bytes;return n}function fw(e,t,r,n){for(let s=0;s<e.length;s++)e[s]=t.decode(r,n),n+=t.decode.bytes;return n}});function G6(){return Us(()=>Yo("dgram"))}var w_e,s7=re(()=>{w_e=F(I());hc()});function z6(){return Us(()=>Yo("net"))}var b_e,i7=re(()=>{b_e=F(I());hc()});function Y6(){return Us(()=>Yo("tls"))}var C_e,o7=re(()=>{C_e=F(I());hc()});function W6({domain:e,type:t="A",edns:r}){let n=[];return r&&n.push({type:"OPT",name:".",udpPayloadSize:4096,flags:0,options:[{code:"CLIENT_SUBNET",ip:r,sourcePrefixLength:Ur(r)?24:56,scopePrefixLength:0}]}),Eh.default.encode({type:"query",id:0,flags:Eh.default.RECURSION_DESIRED,questions:[{type:t,name:e}],additionals:n})}function X6(e){return e||8e3}function cre(e){return e?.replace(/^\[(.*)\]$/,"$1")}function lre(e){return Ur(e)||lr(e)}function fre(e,t=a7){if(!e)return t;let r=Number(e);if(!Number.isInteger(r)||r<1||r>65535)throw new Error("\u81EA\u5B9A\u4E49 DNS \u7AEF\u53E3\u53F7\u5E94\u4E3A 1-65535 \u7684\u6574\u6570");return r}function dre(e,t){if(e.username||e.password||e.pathname&&e.pathname!=="/"||e.search||e.hash)throw new Error(`\u81EA\u5B9A\u4E49 DNS \u5730\u5740\u683C\u5F0F\u65E0\u6548: ${t}`)}function hre(e,t){try{let r=t?e:`udp://${lr(e)?`[${e}]`:e}`,n=new URL(r);dre(n,e);let s=cre(n.hostname);if(!s)throw new Error(`\u81EA\u5B9A\u4E49 DNS \u5730\u5740\u683C\u5F0F\u65E0\u6548: ${e}`);return{protocol:t||"udp",host:s,port:fre(n.port,t==="tls"?ure:a7)}}catch(r){throw r?.message?.includes("\u81EA\u5B9A\u4E49 DNS")?r:new Error(`\u81EA\u5B9A\u4E49 DNS \u5730\u5740\u683C\u5F0F\u65E0\u6548: ${e}`)}}function pre(e){let t=`${e||""}`.trim();if(!t)throw new Error("\u81EA\u5B9A\u4E49 DNS \u4E0D\u80FD\u4E3A\u7A7A");if(/^https?:\/\//i.test(t))return{protocol:"doh",url:t};let r=t.match(/^([a-z][a-z\d+.-]*):\/\//i)?.[1],n=r?.toLowerCase();if(n&&!["udp","tcp","tls"].includes(n))throw new Error(`\u81EA\u5B9A\u4E49 DNS \u4E0D\u652F\u6301 ${r} \u534F\u8BAE`);return hre(t,n)}async function J6({url:e,domain:t,type:r="A",timeout:n,edns:s,skipCertVerify:o}){let i=W6({domain:t,type:r,edns:s}),u=bf.Buffer.from(i).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),l=await R.http.get({url:`${e}?dns=${encodeURIComponent(u)}`,headers:{Accept:"application/dns-message"},"binary-mode":!0,encoding:null,timeout:n,insecure:o===!0});return Eh.default.decode(bf.Buffer.from(R.env.isQX?l.bodyBytes:l.body))}async function mre({server:e,domain:t,type:r="A",timeout:n,edns:s}){let o=G6(),i=W6({domain:t,type:r,edns:s});return new Promise((a,u)=>{let l=!1,f=o.createSocket(lr(e.host)?"udp6":"udp4"),m=setTimeout(()=>{d(new Error("DNS UDP query timeout"))},X6(n));function p(){clearTimeout(m),f.removeAllListeners();try{f.close()}catch{}}function d(v,g){l||(l=!0,p(),v?u(v):a(g))}f.on("error",v=>d(v)),f.on("message",v=>{try{d(null,Eh.default.decode(v))}catch(g){d(g)}}),f.send(i,e.port,e.host,v=>{v&&d(v)})})}async function gre({server:e,domain:t,type:r="A",timeout:n,edns:s,skipCertVerify:o}){let i=e.protocol==="tls"?Y6():z6(),a=e.protocol==="tls"?"TLS":"TCP",u=W6({domain:t,type:r,edns:s}),l=bf.Buffer.alloc(E1);l.writeUInt16BE(u.length,0);let f=bf.Buffer.concat([l,u]);return new Promise((m,p)=>{let d=!1,v=bf.Buffer.alloc(0),g,y=e.protocol==="tls"?i.connect({host:e.host,port:e.port,servername:lre(e.host)?void 0:e.host,rejectUnauthorized:o===!0?!1:void 0}):i.createConnection({host:e.host,port:e.port});function w(){y.removeAllListeners(),y.destroy()}function E(S,C){d||(d=!0,w(),S?p(S):m(C))}y.setTimeout(X6(n),()=>{E(new Error(`DNS ${a} query timeout`))}),y.on(e.protocol==="tls"?"secureConnect":"connect",()=>{y.write(f)}),y.on("error",S=>E(S)),y.on("end",()=>{E(new Error(`DNS ${a} connection ended before response`))}),y.on("data",S=>{try{if(v=bf.Buffer.concat([v,S]),g==null&&v.length>=E1&&(g=v.readUInt16BE(0)),g!=null&&v.length>=g+E1){let C=v.slice(E1,g+E1);E(null,Eh.default.decode(C))}}catch(C){E(C)}})})}async function hw({url:e,domain:t,type:r="A",timeout:n,edns:s,skipCertVerify:o}){let i=`${e||""}`.trim(),a=i.match(/^([a-z][a-z\d+.-]*):\/\//i)?.[1].toLowerCase(),u=["http","https"].includes(a);if(!R.env.isLoon&&(["auto","system"].includes(i.toLowerCase())||["h3","quic"].includes(a)))throw new Error("auto/system \u548C DoH3/DoQ \u4EC5\u652F\u6301 Loon Build \u2265 988");if(R.env.isLoon&&i&&(!a||["udp","h3","quic"].includes(a))){if(typeof $dns>"u"||typeof $dns?.query!="function")throw new Error("Loon DNS API \u9700\u8981 Loon Build \u2265 988");let f=i.replace(/^udp:\/\//i,""),m=await new Promise((p,d)=>{$dns.query({domain:t,...i.toLowerCase()==="auto"?{}:{server:f},timeout:X6(n)},(v,g)=>{v?d(Object.assign(new Error(v.message),v)):p(g)})});return{...m,answers:m.answers?.map(({value:p,...d})=>({...d,data:p}))}}if(i&&!R.env.isNode&&!u&&(!a||["udp","tcp","tls"].includes(a)))throw new Error("DoT \u548C TCP DNS \u4EC5\u652F\u6301 Node.js; UDP DNS \u652F\u6301 Node.js \u6216 Loon Build \u2265 988");let l=pre(e);if(l.protocol==="doh")return J6({url:l.url,domain:t,type:r,timeout:n,edns:s,skipCertVerify:o});if(!R.env.isNode)throw new Error("DoT \u548C TCP DNS \u4EC5\u652F\u6301 Node.js; UDP DNS \u652F\u6301 Node.js \u6216 Loon Build \u2265 988");return["tcp","tls"].includes(l.protocol)?gre({server:l,domain:t,type:r,timeout:n,edns:s,skipCertVerify:o}):mre({server:l,domain:t,type:r,timeout:n,edns:s})}var R_e,Eh,bf,a7,ure,E1,Z6=re(()=>{R_e=F(I());gt();Eh=F(n7());s7();i7();o7();bf=F(iu());Ir();a7=53,ure=853,E1=2});function bi(e){let t=typeof e=="string"?e:e?.type;return wre.includes(t)}function u7(e){return bi(e)?pw:e}function el(e){return!e||!bi(e)||e.type===pw?e:{...e,type:pw}}var k_e,pw,vre,wre,b1=re(()=>{k_e=F(I()),pw="mihomoConfig",vre="mihomoProfile",wre=[pw,vre]});var L_e,c7,yre,Ere,bre,Are,Sre,_re,Cre,Dre,$a,Af,Fre,xa,Q6=re(()=>{L_e=F(I());Rb();li();({isNode:c7,isQX:yre,isLoon:Ere,isSurge:bre,isStash:Are,isShadowRocket:Sre,isLanceX:_re,isEgern:Cre,isGUIforCores:Dre}=hr()),$a="Node";c7?$a="Node":yre?$a="QX":Ere?$a="Loon":Are?$a="Stash":Sre?$a="Shadowrocket":Cre?$a="Egern":bre?$a="Surge":_re?$a="LanceX":Dre&&($a="GUI.for.Cores");Af={},Fre={};try{if(typeof $environment<"u"&&(Af.env=$environment),typeof $loon<"u"&&(Af.loon=$loon),typeof $script<"u"&&(Af.script=$script),typeof $Plugin<"u"&&(Af.plugin=$Plugin),c7){Af.node={version:eval("process.version"),argv:eval("process.argv"),filename:eval("__filename"),dirname:eval("__dirname"),env:{}};let env=eval("process.env");for(let e in env)/^SUB_STORE_/.test(e)&&(Af.node.env[e]=env[e])}}catch(e){}xa={backend:$a,version:hg,feature:Fre,meta:Af}});function sC(e){return e===nC}function A1(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function h7(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(Ze(r[n]))if(n.endsWith("!")){let s=A1(n.slice(0,-1));e[s]=r[n]}else{let s=A1(n);e[s]||Object.assign(e,{[s]:{}}),h7(e[s],r[s])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let s=A1(n.slice(1));e[s]||Object.assign(e,{[s]:[]}),e[s]=[...r[n],...e[s]]}else if(n.endsWith("+")){let s=A1(n.slice(0,-1));e[s]||Object.assign(e,{[s]:[]}),e[s]=[...e[s],...r[n]]}else{let s=A1(n);Object.assign(e,{[s]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function Bre({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>mw(e,r))}}function mw(e,t){if(!e.operator)switch(e.proposition){case"IN":return e.value.indexOf(t[e.attr])!==-1;case"CONTAINS":return typeof t[e.attr]!="string"?!1:t[e.attr].indexOf(e.value)!==-1;case"EQUALS":return t[e.attr]===e.value;case"EXISTS":return t[e.attr]!==null||typeof t[e.attr]<"u";default:throw new Error(`Unknown proposition: ${e.proposition}`)}switch(e.operator){case"AND":return e.child.every(r=>mw(r,t));case"OR":return e.child.some(r=>mw(r,t));case"NOT":return!mw(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function Ire(e){return{name:"Quick Setting Operator",func:s=>{if(t(e.useless)){let a=E7().func(s);s=s.filter((u,l)=>a[l]&&u.port>0&&u.port<=65535)}let o=r(e.ecn,t(e.ecn));return s.map(i=>(i.udp=t(e.udp,i.udp),i.tfo=t(e.tfo,i.tfo),i["fast-open"]=t(e.tfo,i["fast-open"]),i["skip-cert-verify"]=t(e.scert,i["skip-cert-verify"]),i.type==="vmess"&&(i.aead=t(e["vmess aead"],i.aead)),["snell","anytls","trusttunnel"].includes(i.type)&&(i.reuse=t(e.reuse,i.reuse)),o!==void 0&&i.type!=="direct"&&i.type!=="external"&&(i.ecn=o),i["block-quic"]=r(e["block-quic"],i["block-quic"]),i["ip-version"]=n(e["ip-version"],i["ip-version"]),i))}};function t(s,o){switch(s){case"ENABLED":return!0;case"DISABLED":return!1;default:return o}}function r(s,o){switch(s){case"auto":case"on":case"off":return s;default:return o}}function n(s,o){switch(s){case void 0:case null:case"":case"DEFAULT":return o;default:return s}}}function $re({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=w1(n.name);else{let s=wh(n.name);n.name=w1(n.name),n.name=s+" "+n.name,t=="ws"?n.name=n.name.replace(/🇹🇼/g,"\u{1F1FC}\u{1F1F8}"):t=="tw"||(n.name=n.name.replace(/🇹🇼/g,"\u{1F1E8}\u{1F1F3}"))}return n})}}function xre(e){let{action:t,template:r,link:n,position:s,field:o}={action:"rename",template:"0 1 2 3 4 5 6 7 8 9",link:"-",position:"back",field:["name"],...e};return{name:"Handle Duplicate Operator",func:i=>{if(t==="delete"){let a={};return i.filter(u=>{let l=o.map(f=>bh.default.get(u,f,"-")).join("_");return a[l]?!1:(a[l]=!0,!0)})}else if(t==="rename"){let a=r.split(" "),u={},l=0;i.forEach(m=>{let p=o.map(d=>bh.default.get(m,d,"-")).join("_");typeof u[p]>"u"?u[p]=1:u[p]++,l=Math.max(u[p].toString().length,l)});let f={};return i.map(m=>{let p=o.map(d=>bh.default.get(m,d,"-")).join("_");if(u[p]>1){typeof f[p]>"u"&&(f[p]=1);let d="",v=f[p]++,g=0;for(;v>0;)d=a[v%10]+d,v=parseInt(v/10),g++;for(;g++<l;)d=a[0]+d;s==="front"?m.name=d+n+m.name:s==="back"&&(m.name=m.name+n+d)}return m})}}}}function Rre(e="asc"){return{name:"Sort Operator",func:t=>{switch(e){case"asc":case"desc":return t.sort((r,n)=>{let s=r.name>n.name?1:-1;return s*=e==="desc"?-1:1,s});case"random":return sne(t);default:throw new Error("Unknown sort option: "+e)}}}}function Tre(e){let t=e.order||"asc",r=e.expressions;return Array.isArray(e)&&(r=e),Array.isArray(r)||(r=[]),{name:"Regex Sort Operator",func:n=>{let s=r.map(i=>oC(i)),o=new Map;return n.sort((i,a)=>{let u=l7(s,i.name,o),l=l7(s,a.name,o);return u&&!l?-1:l&&!u?1:u&&l?u<l?-1:1:t==="original"?0:t==="desc"?i.name<a.name?1:-1:i.name<a.name?-1:1})}}}function l7(e,t,r){if(e.length===0)return null;let n=r.get(t);if(n!==void 0)return n;let s=null;for(let o=0;o<e.length;o++)if(e[o].test(t)){s=o+1;break}return typeof t=="string"&&r.set(t,s),s}function p7(e){return{name:"Regex Rename Operator",func:t=>t.map(r=>{for(let{expr:n,now:s}of e)r.name=r.name.replace(oC(n,"g"),s).trim();return r})}}function kre(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:p7(t).func}}function Pre(e,t,r,n,s,o){return o.source=n,o.env=xa,{name:"Script Operator",func:async i=>{let a=i;if(bi(a?.$file))try{let u=gi.safeLoad(e),l;if(a?.$content)try{l=gi.safeLoad(a?.$content)}catch(f){R.error(f.message??f)}if(typeof u!="object")throw new Error("patch is not an object");return a.$content=Ft.yaml.safeDump(h7(l||{},u)),a}catch{}return await(async function(){a=Ah("operator",e,r,s)(i,t,o)})(),a},nodeFunc:async i=>{let a=i;return await(async function(){a=Ah("operator",`async function operator(input = [], targetPlatform, context) {
|
||
if (input && (input.$files || input.$content)) {
|
||
let { $content, $files, $options, $file } = input
|
||
if (['mihomoConfig', 'mihomoProfile'].includes($file?.type)) {
|
||
${e}
|
||
if(typeof main === 'function') {
|
||
let config;
|
||
if ($content) {
|
||
try {
|
||
config = ProxyUtils.yaml.safeLoad($content);
|
||
} catch (e) {
|
||
console.log(e.message ?? e);
|
||
}
|
||
}
|
||
$content = ProxyUtils.yaml.safeDump(await main(config || {}))
|
||
}
|
||
} else {
|
||
${e}
|
||
}
|
||
return { $content, $files, $options, $file }
|
||
} else {
|
||
let proxies = input
|
||
let list = []
|
||
for await (let $server of proxies) {
|
||
${e}
|
||
list.push($server)
|
||
}
|
||
return list
|
||
}
|
||
}`,r,s)(i,t,o)})(),a}}}function Ore(e){if(!e)return{};let t=gi.safeLoad(e);return Ze(t)?t:{}}function Nre(e){return Array.isArray(e?.proxies)?e.proxies:[]}function Lre({sourceType:e="subscription",sourceName:t,includeUnsupportedProxy:r,position:n="replace"}={},s={}){let o=async i=>{if(!bi(i?.$file))return i;let a=Ore(i.$content),u=Nre(a),l=await _n({type:e,name:t,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0,"include-unsupported-proxy":r},noFlow:s.noFlow});switch(n){case"front":a.proxies=[...l,...u];break;case"back":a.proxies=[...u,...l];break;case"replace":default:a.proxies=l;break}return i.$content=Ft.yaml.safeDump(a),i};return{name:m7,func:o,nodeFunc:o}}function Ure(e){let t,r;try{let n=e.split(":");r=parseInt(n[2],16);let s=parseInt(n[3],16),o=parseInt(n[4],16),i=s>>8,a=s&255,u=o>>8,l=o&255;if(t=`${i}.${a}.${u}.${l}`,r<=0||r>65535)throw new Error(`Invalid port number: ${r}`);if(!Ur(t))throw new Error(`Invalid IP address: ${t}`)}catch(n){R.error(`IP4P \u89E3\u6790\u5931\u8D25: ${n}`)}return{server:t,port:r}}function qre(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return Hre;let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Error("\u57DF\u540D\u89E3\u6790\u5E76\u53D1\u6570\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return t}function g7(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return Mre;let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Error("\u591A DNS \u5E76\u53D1\u6570\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return t}function jre(e,t){if(!(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")){let s=Number(e);if(!Number.isInteger(s)||s<1)throw new Error("DNS \u8D85\u65F6\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return s}if(typeof t>"u"||t===null||typeof t=="string"&&t.trim()==="")return 8e3;let n=Number(t);return!isFinite(n)||n<=0?8e3:n}function Kre(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return;let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Error("\u57DF\u540D\u89E3\u6790\u7F13\u5B58\u65F6\u957F\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return t*1e3}function iC(e){let t=`${e||""}`.split(/\r?\n/).map(r=>r.trim()).filter(r=>r);if(t.length===0)throw new Error("\u81EA\u5B9A\u4E49 DNS \u4E0D\u80FD\u4E3A\u7A7A");return t}function Vre(e){return iC(e).join(`
|
||
`)}async function Gre(e,t,r){let n=0,s=Math.min(t,e.length),o=Array.from({length:s},async()=>{for(;n<e.length;){let i=e[n];n+=1,await r(i)}});await Promise.all(o)}async function zre(e,t,r){return new Promise((n,s)=>{let o=0,i=0,a=0,u=!1,l=[],f=Math.min(t,e.length);function m(){!u&&a===e.length&&s(new Error(l.length>0?l.join("; "):"No answers"))}function p(){if(!u){for(;i<f&&o<e.length;){let d=e[o];o+=1,i+=1,Promise.resolve().then(()=>r(d)).then(v=>{i-=1,a+=1,!u&&(u=!0,n({result:v,resolverUrl:d}))}).catch(v=>{i-=1,a+=1,l.push(`${d}: ${v}`),p(),m()})}m()}}p()})}function rC(e,t,r,n,s){switch(e){case"Custom":return Lr(`CUSTOM:${s?"INSECURE:":""}${n}:${t}:${r}`);case"Google":return Lr(`GOOGLE:${t}:${r}`);case"IP-API":return Lr(`IP-API:${t}`);case"Cloudflare":return Lr(`CLOUDFLARE:${t}:${r}`);case"Ali":return Lr(`ALI:${t}:${r}`);case"Tencent":return Lr(`TENCENT:${t}:${r}`)}}function Yre(e,t,r,n,s,o){if(n==="disabled")return null;let i=rC(e,t,r,s,o),a=i?Hr.get(i):null;return e==="Custom"?w7(a):a}function eC(e,t){if(e!=="Custom"||!t)return"";let r=`${t}`.split(/\r?\n/).map(n=>n.trim()).filter(n=>n);return r.length<=1?` via ${t}`:` via ${r.length} custom DNS`}function Wre(e,t){if(e!=="Custom"||!t)return t||"";let r=`${t}`.split(/\r?\n/).map(n=>n.trim()).filter(n=>n);return r.length<=1?t:`${r.length} custom DNS`}function v7(e,t){return e&&typeof e=="object"&&Object.defineProperty(e,"_resolverUrl",{value:t,enumerable:!1,configurable:!0}),e}function Xre(e,t){return{result:e,resolverUrl:t}}function w7(e){return e&&typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.result)?v7(e.result,e.resolverUrl):e}function d7(e){return e&&typeof e=="object"?e._resolverUrl:null}function y7({provider:e,type:t,filter:r,cache:n,url:s,tlsSkipCertVerify:o,timeout:i,cacheTtl:a,edns:u,concurrency:l,dnsConcurrency:f}){if(["IPv6","IP4P"].includes(t)&&["IP-API"].includes(e))throw new Error(`\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9 ${e} \u4E0D\u652F\u6301 ${t}`);let{defaultTimeout:m}=R.read(pt)||{},p=jre(i,m),d=Kre(a),v=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",g=gw[e];if(!g)throw new Error(`\u627E\u4E0D\u5230\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9: ${e}`);let y=u||"223.6.6.6";if(!Sf(y))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");let w=qre(l),E=e==="Custom"?Vre(s):s,S=e==="Custom"?iC(E).length:1,C=e==="Custom"?g7(f):1,D=w*Math.min(C,S),H=e==="Custom"&&(o===!0||o==="enabled");return D>f7&&R.warn(`\u57DF\u540D\u89E3\u6790\u603B\u5E76\u53D1\u6570\u4E0A\u9650 ${D} \u8D85\u8FC7\u5EFA\u8BAE\u503C ${f7}, \u53EF\u80FD\u5BFC\u81F4\u4EE3\u7406 App TCP \u8FDE\u63A5\u6570\u6FC0\u589E`),R.info(`Domain Resolver: [${t}] ${e} ${y||""} ${Wre(e,E)}${H?" tlsSkipCertVerify=enabled":""} concurrency=${w}${e==="Custom"?` dnsConcurrency=${C}`:""}`),{name:"Resolve Domain Operator",func:async K=>{K.forEach((U,k)=>{!U["_no-resolve"]&&U["no-resolve"]&&(K[k]["_no-resolve"]=U["no-resolve"])});let _={},x=[...new Map(K.filter(U=>!Sf(U.server)&&!U["_no-resolve"]).map(U=>{let k=rC(e,U.server,v,E,H);return[k,{id:k,domain:U.server}]})).values()],j=[];return x.forEach(({id:U,domain:k})=>{let N=Yre(e,k,v,n,E,H);if(N){_[U]=N;let O=e==="Custom"&&d7(N)||E;R.info(`Using cached resolved domain: ${k}${eC(e,O)} \u279F ${N}`)}else j.push({id:U,domain:k})}),await Gre(j,w,async({id:U,domain:k})=>{try{let N=await g(k,v,n==="disabled",p,y,E,H,C,d);_[U]=N;let O=e==="Custom"&&d7(N)||E;R.info(`Successfully resolved domain: ${k}${eC(e,O)} \u279F ${N}`)}catch(N){R.error(`Failed to resolve domain: ${k}${eC(e,E)} with resolver [${e}]: ${N}`)}}),K.forEach(U=>{if(!U["_no-resolve"]){let k=rC(e,U.server,v,E,H);if(k&&_[k]){U._resolved_ips=_[k];let N=Array.isArray(_[k])?_[k][Math.floor(Math.random()*_[k].length)]:_[k];if(v==="IPv6"&&lr(N)){try{N=new kg.Address6(N).correctForm()}catch(O){R.error(`Failed to parse IPv6 address: ${N}: ${O}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(N)){U._IP4P=N;let{server:O,port:L}=Ure(N);O&&L?(U._domain=U.server,U.server=O,U.port=L,U.resolved=!0,U._IPv4=U.server,Sf(U._IP)||(U._IP=U.server)):U.resolved||(U.resolved=!1)}else U._domain=U.server,U.server=N,U.resolved=!0,U[`_${v}`]=U.server,Sf(U._IP)||(U._IP=U.server)}else U._domain=U.server,U.server=N,U.resolved=!0,U[`_${v}`]=U.server,Sf(U._IP)||(U._IP=U.server)}else U.resolved||(U.resolved=!1)}}),K.filter(U=>r==="removeFailed"?Sf(U.server)||U["_no-resolve"]||U.resolved:r==="IPOnly"?Sf(U.server):r==="IPv4Only"?Ur(U.server):r==="IPv6Only"?lr(U.server):!0)}}}function Sf(e){return Ur(e)||lr(e)}function tC(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function E7(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!tC(t.cipher))return!1;if(t.password&&!tC(t.password))return!1;if(t.network){let r=t[`${t.network}-opts`]?.headers?.Host||t[`${t.network}-opts`]?.headers?.host;if(r=Array.isArray(r)?r:[r],r.some(n=>n&&!tC(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function Jre(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let r=e?.keep??!0,n={HK:"\u{1F1ED}\u{1F1F0}",TW:"\u{1F1F9}\u{1F1FC}",US:"\u{1F1FA}\u{1F1F8}",SG:"\u{1F1F8}\u{1F1EC}",JP:"\u{1F1EF}\u{1F1F5}",UK:"\u{1F1EC}\u{1F1E7}",DE:"\u{1F1E9}\u{1F1EA}",KR:"\u{1F1F0}\u{1F1F7}"};return{name:"Region Filter",func:s=>s.map(o=>{let i=wh(o.name),a=t.some(u=>n[u]===i);return r?a:!a})}}function Zre({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let s=e.some(o=>oC(o).test(n.name));return t?s:!s})}}function oC(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function Qre(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let r=e?.keep??!0;return{name:"Type Filter",func:n=>n.map(s=>{let o=t.some(i=>s.type===i);return r?o:!o})}}function ene(e,t,r,n,s,o){return o.source=n,o.env=xa,{name:"Script Filter",func:async i=>{let a=cw(i.length,!0);return await(async function(){a=Ah("filter",e,r,s)(i,t,o)})(),a},nodeFunc:async i=>{let a=cw(i.length,!0);return await(async function(){a=Ah("filter",`async function filter(input = [], targetPlatform, context) {
|
||
let proxies = input
|
||
let list = []
|
||
const fn = async ($server) => {
|
||
${e}
|
||
}
|
||
for await (let $server of proxies) {
|
||
list.push(await fn($server))
|
||
}
|
||
return list
|
||
}`,r,s)(i,t,o)})(),a}}}function tne(e,t,r,n,s,o){return o.source=n,o.env=xa,{name:nC,func:async i=>{let a=i;return await(async function(){a=Ah("transformFunction",e,r,s)(i,o)})(),a},shortcutFunc:async i=>{let a=i;return await(async function(){a=Ah("transformFunction",`async function transformFunction(res = {}, context) {
|
||
let $res = res
|
||
${e}
|
||
return $res
|
||
}`,r,s)(i,o)})(),a}}}async function b7(e,t){let r=t;try{let n=await e.func(r);n&&(r=n)}catch(n){let s="",o=`${n.message??n}`;o.includes("$res is not defined")||(R.error(`Cannot apply ${e.name}(function transformFunction)! Reason: ${n}`),s=`\u6267\u884C function transformFunction \u5931\u8D25 ${o}; `);try{let i=await e.shortcutFunc(r);i&&(r=i)}catch(i){R.error(`Cannot apply ${e.name}(shortcut script)! Reason: ${i}`);let a="",u=`${i.message??i}`;throw s&&u===o?(a="",s=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u811A\u672C\u5931\u8D25 ${u}`,new Error(`\u54CD\u5E94\u4FEE\u6539 ${s}${a}`)}}return r}async function rne(e,t){let r=cw(t.length,!0);try{r=await e.func(t)}catch(n){let s="",o=`${n.message??n}`;o.includes("$server is not defined")?s="":(R.error(`Cannot apply filter ${e.name}(function filter)! Reason: ${n}`),s=`\u6267\u884C function filter \u5931\u8D25 ${o}; `);try{r=await e.nodeFunc(t)}catch(i){R.error(`Cannot apply filter ${e.name}(shortcut script)! Reason: ${i}`);let a="",u=`${i.message??i}`;throw s&&u===o?(a="",s=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u8FC7\u6EE4\u811A\u672C \u5931\u8D25 ${u}`,new Error(`\u811A\u672C\u8FC7\u6EE4 ${s}${a}`)}}return t.filter((n,s)=>r[s])}async function nne(e,t){let r=ine(t);try{let n=await e.func(r);n&&(r=n)}catch(n){let s="",o=`${n.message??n}`;o.includes("$server is not defined")||o.includes("$content is not defined")||o.includes("$files is not defined")||r?.$files||r?.$content?s="":(R.error(`Cannot apply operator ${e.name}(function operator)! Reason: ${n}`),s=`\u6267\u884C function operator \u5931\u8D25 ${o}; `);try{let i=await e.nodeFunc(r);i&&(r=i)}catch(i){R.error(`Cannot apply operator ${e.name}(shortcut script)! Reason: ${i}`);let a="",u=`${i.message??i}`;throw s&&u===o?(a="",s=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u811A\u672C \u5931\u8D25 ${u}`,new Error(`\u811A\u672C\u64CD\u4F5C ${s}${a}`)}}return r}async function A7(e,t){if(e.name.indexOf("Filter")!==-1)return rne(e,t);if(e.name.indexOf("Operator")!==-1)return nne(e,t)}function sne(e){let t=e.length,r,n;for(;t!==0;)n=Math.floor(Math.random()*t),t-=1,r=e[t],e[t]=e[n],e[n]=r;return e}function ine(e){return JSON.parse(JSON.stringify(e))}function Ah(name,script,$arguments,$options){let flowUtils={getFlowField:Ll,getFlowHeaders:es,parseFlowHeaders:ru,flowTransfer:Vp,validCheck:Hg,getRmainingDays:Mg,normalizeFlowHeader:Ec};return R.env.isLoon?new Function("$arguments","$options","$substore","lodash","$persistentStore","$httpClient","$notification","ProxyUtils","yaml","Buffer","b64d","b64e","DOMAIN_RESOLVERS","scriptResourceCache","flowUtils","produceArtifact","require",`${script}
|
||
return ${name}`)($arguments,$options,R,bh.default,$persistentStore,$httpClient,$notification,Ft,Ft.yaml,Ft.Buffer,Ft.Base64.decode,Ft.Base64.encode,gw,v1,flowUtils,_n,eval('typeof require !== "undefined"')?Yo:void 0):new Function("$arguments","$options","$substore","lodash","ProxyUtils","yaml","Buffer","b64d","b64e","DOMAIN_RESOLVERS","scriptResourceCache","flowUtils","produceArtifact","require",`${script}
|
||
return ${name}`)($arguments,$options,R,bh.default,Ft,Ft.yaml,Ft.Buffer,Ft.Base64.decode,Ft.Base64.encode,gw,v1,flowUtils,_n,eval('typeof require !== "undefined"')?Yo:void 0)}var t6e,bh,nC,m7,Hre,Mre,f7,gw,S1,S7=re(()=>{t6e=F(I());Og();k6();Ir();VT();O6();Z6();bh=F(ho());gt();fd();tl();Lu();b1();dr();zl();Q6();pd();nC="Response Transformer";m7="Add Proxies From Subscription Operator";Hre=10,Mre=2,f7=20;gw={Custom:async function(e,t,r,n,s,o,i,a,u){let l=iC(o),f=l.join(`
|
||
`),m=g7(a),p=Lr(`CUSTOM:${i?"INSECURE:":""}${f}:${e}:${t}`),d=w7(Hr.get(p));if(!r&&d)return d;let v=t==="IPv6"?"AAAA":"A",g=async E=>{let S=await hw({url:E,domain:e,type:v,timeout:n,edns:s,skipCertVerify:i}),{answers:C}=S;if(!Array.isArray(C)||C.length===0)throw new Error("No answers");let D=C.filter(H=>H?.type===v).map(H=>H?.data).filter(H=>H);if(D.length===0)throw new Error("No answers");return D},{result:y,resolverUrl:w}=l.length===1?{result:await g(l[0]),resolverUrl:l[0]}:await zre(l,m,g);return Hr.set(p,Xre(y,w),u),v7(y,w)},Google:async function(e,t,r,n,s,o,i,a,u){let l=Lr(`GOOGLE:${e}:${t}`),f=Hr.get(l);if(!r&&f)return f;let m=t==="IPv6"?"AAAA":"A",p=await hw({url:"https://8.8.4.4/dns-query",domain:e,type:m,timeout:n,edns:s}),{answers:d}=p;if(!Array.isArray(d)||d.length===0)throw new Error("No answers");let v=d.filter(g=>g?.type===m).map(g=>g?.data).filter(g=>g);if(v.length===0)throw new Error("No answers");return Hr.set(l,v,u),v},"IP-API":async function(e,t,r,n,s,o,i,a,u){if(["IPv6"].includes(t))throw new Error(`\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9 IP-API \u4E0D\u652F\u6301 ${t}`);let l=Lr(`IP-API:${e}`),f=Hr.get(l);if(!r&&f)return f;let m=await R.http.get({url:`http://ip-api.com/json/${encodeURIComponent(e)}?lang=zh-CN`,timeout:n}),p=JSON.parse(m.body);if(p.status!=="success")throw new Error(`Status is ${p.status}`);if(!p.query||p.query===0)throw new Error("No answers");let d=[p.query];if(d.length===0)throw new Error("No answers");return Hr.set(l,d,u),d},Cloudflare:async function(e,t,r,n,s,o,i,a,u){let l=Lr(`CLOUDFLARE:${e}:${t}`),f=Hr.get(l);if(!r&&f)return f;let m=t==="IPv6"?"AAAA":"A",p=await hw({url:"https://1.0.0.1/dns-query",domain:e,type:m,timeout:n,edns:s}),{answers:d}=p;if(!Array.isArray(d)||d.length===0)throw new Error("No answers");let v=d.filter(g=>g?.type===m).map(g=>g?.data).filter(g=>g);if(v.length===0)throw new Error("No answers");return Hr.set(l,v,u),v},Ali:async function(e,t,r,n,s,o,i,a,u){let l=Lr(`ALI:${e}:${t}`),f=Hr.get(l);if(!r&&f)return f;let m=await R.http.get({url:`http://223.6.6.6/resolve?edns_client_subnet=${s}/${Ur(s)?24:56}&name=${encodeURIComponent(e)}&type=${t==="IPv6"?"AAAA":"A"}&short=1`,headers:{accept:"application/dns-json"},timeout:n}),p=JSON.parse(m.body);if(!Array.isArray(p)||p.length===0)throw new Error("No answers");let d=p;if(d.length===0)throw new Error("No answers");return Hr.set(l,d,u),d},Tencent:async function(e,t,r,n,s,o,i,a,u){let l=Lr(`TENCENT:${e}:${t}`),f=Hr.get(l);if(!r&&f)return f;let p=(await R.http.get({url:`http://119.28.28.28/d?ip=${s}&type=${t==="IPv6"?"AAAA":"A"}&dn=${encodeURIComponent(e)}`,headers:{accept:"application/dns-json"},timeout:n})).body.split(";").map(v=>v.split(",")[0]);if(p.length===0||String(p)==="0")throw new Error("No answers");let d=p;if(d.length===0)throw new Error("No answers");return Hr.set(l,d,u),d}};y7.resolver=gw;S1={"Useless Filter":E7,"Region Filter":Jre,"Regex Filter":Zre,"Type Filter":Qre,"Script Filter":ene,"Conditional Filter":Bre,"Quick Setting Operator":Ire,"Flag Operator":$re,"Sort Operator":Rre,"Regex Sort Operator":Tre,"Regex Rename Operator":p7,"Regex Delete Operator":kre,"Script Operator":Pre,[m7]:Lre,[nC]:tne,"Handle Duplicate Operator":xre,"Resolve Domain Operator":y7}});function C7(e){return typeof e=="string"&&e.includes("short-id")}function Sh(e){if(!C7(e))return e;try{let t=B0(e,_7);return D7(e,t)}catch{return e}}function D7(e,t,r){let n=new Map,s=new Map;Ys(t,{Node(p,d){Gs(d)?s.set(d.range[0],n.get(d.source)):d.anchor&&n.set(d.anchor,d)}});let o=p=>Gs(p)?s.get(p.range[0]):p,i=p=>At(p)&&typeof p.value!="string"&&p.value!==null&&!p.tag&&p.source,a=new Set;Ys(t,{Pair(p,{key:d,value:v}){let g=o(d)?.value;["reality-opts","reality-config"].includes(g)&&a.add(v)}});let u=new Set;for(let p of a)Ys(p,{Alias(d,v){a.add(o(v))},Pair(d,{key:v,value:g}){o(v)?.value==="short-id"&&u.add(g)}});let l=new Map;for(let p of u){let d=o(p);if(mi(d))for(let v of d.items)u.add(v);else i(d)&&l.set(d,JSON.stringify(d.source))}if(l.size===0||(r===void 0&&(r=t.errors.length>0?jd(e):t.toJS()),![r?.proxies,r?.listeners].some(p=>Array.isArray(p)&&p.length>0)))return e;let f=[],m=0;for(let[p,d]of[...l].sort(([v],[g])=>v.range[0]-g.range[0]))f.push(e.slice(m,p.range[0]),d),m=p.range[1];return f.join("")+e.slice(m)}function one(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function ane(){let e="Base64 Pre-processor",t=["dm1lc3M","c3NyOi8v","c29ja3M6Ly","dHJvamFu","c3M6Ly","c3NkOi8v","c2hhZG93","aHR0c","dmxlc3M=","aHlzdGVyaWEy","aHkyOi8v","d2lyZWd1YXJkOi8v","d2c6Ly8=","dHVpYzovLw=="];return{name:e,test:function(s){return mt.isValid(s)&&!/^\w+:\/\/\w+/im.test(s)&&t.some(o=>s.indexOf(o)!==-1)},parse:function(s){let o=mt.decode(s);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(o)?o:(R.error("Base64 Pre-processor error: decoded line does not start with protocol"),s)}}}function une(){return{name:"Fallback Base64 Pre-processor",test:function(n){return mt.isValid(n)},parse:function(n){let s=mt.decode(n);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(s)?s:(R.error("Fallback Base64 Pre-processor error: decoded line does not start with protocol"),n)}}}function cne(){let e="Clash Pre-processor",t=function(s,o){if(o&&!/proxies/.test(s))return!1;let i,a;if(C7(s))try{i=B0(s,_7),i.errors.length===0&&(a=i.toJS())}catch{i=void 0}if(a===void 0&&(a=jd(s)),o&&!Array.isArray(a.proxies)&&!Array.isArray(a["proxy-groups"]))return!1;if(i){let u=D7(s,i,a);if(u!==s)return{normalized:u}}return{content:a}};return{name:e,test:s=>t(s,!0),parse:function(s,o,i=t(s)){let{proxies:a}=i.normalized===void 0?i.content:jd(i.normalized);return(o?`proxies:
|
||
`:"")+(Array.isArray(a)?a:[]).map(u=>`${o?" - ":""}${JSON.stringify(u)}
|
||
`).join("")}}}function lne(){return{name:"SSD Pre-processor",test:function(n){return n.indexOf("ssd://")===0},parse:function(n){let s=[],o=JSON.parse(mt.decode(n.split("ssd://")[1])),i=o.port,a=o.encryption,u=o.password,l=o.servers;for(let f=0;f<l.length;f++){let m=l[f];a=m.encryption?m.encryption:a,u=m.password?m.password:u;let p=mt.encode(a+":"+u),d=m.server;i=m.port?m.port:i;let v=m.remarks?m.remarks:f,g=m.plugin_options?"/?plugin="+encodeURIComponent(m.plugin+";"+m.plugin_options):"";s[f]="ss://"+p+"@"+d+":"+i+g+"#"+v}return s.join(`
|
||
`)}}}function fne(){return{name:"Full Config Preprocessor",test:function(n){return/^(\[server_local\]|\[Proxy\])/gm.test(n)},parse:function(n){return n.match(/^\[server_local|Proxy\]([\s\S]+?)^\[.+?\](\r?\n|$)/im)?.[1]||n}}}var u6e,_7,vw,_h=re(()=>{u6e=F(I());zl();Xo();kS();gt();_7={merge:!0,logLevel:"error"};vw=[one(),cne(),ane(),lne(),fne(),une()]});function fe(e,t){let r=I7.default.get(e,t);return typeof r<"u"&&r!==null}function To(e){return`"${String(e).replace(/["\\]/g,"\\$&")}"`}function ww(e){let{network:t,flow:r,encryption:n}=e,s=e["reality-opts"],o=!!(e.tls||s);return t==="ws"&&s?!1:t==="grpc"?o&&!r:r?Ge(n)&&n.trim()!=="none"||o&&!["ws","xhttp"].includes(t):!0}function yw(e,t){return e.type!=="trusttunnel"||!fe(e,"client-random-auth-key")||["surge","surgemac","json"].includes(t.toLowerCase())?!0:(R.error(`Target platform ${t} does not support client-random-auth-key for TrustTunnel proxy ${e.name||`${e.server}:${e.port}`}. Proxy has been filtered.`),!1)}function Ch(e){let t=typeof e?.network=="string"?e.network.trim().toLowerCase():e?.network;return e?.type==="ss"&&e?.tls===!0&&!fe(e,"plugin")&&(!fe(e,"network")||t==="tcp")}function _1(e){if(typeof e=="boolean")return Number(e);if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true")return 1;if(t==="false")return 0;if(/^\d+$/.test(t))return parseInt(t,10)}return e}function $7(e){return!!_1(e)}function Dh(e,t){if(e?.type!=="ss"||e?.plugin!=="v2ray-plugin")return!0;let r=typeof e?.["plugin-opts"]?.mode=="string"?e["plugin-opts"].mode.trim().toLowerCase():e?.["plugin-opts"]?.mode;return t.includes(r)}function F7(e,t){if(e?.plugin!=="shadow-tls"||!e["plugin-opts"])return;let r=e["plugin-opts"],n=!!r.password||r.version!=null&&Number(r.version)!==0;return e["shadow-tls-opts"]={password:r.password,version:r.version},r.host!=null&&(e[t]=r.host),r.alpn!=null&&(e.alpn=r.alpn),delete e.plugin,delete e["plugin-opts"],n}function Ew(e){if(["vmess","vless","trojan","anytls"].includes(e.type)&&F7(e,"sni")&&["vmess","vless"].includes(e.type)&&(e.tls=!0),e.type==="vless"&&e.network==="xhttp"){let t=e["xhttp-opts"]?.["download-settings"];F7(t,"servername")&&(t.tls=!0)}}function aC(e,t){if(e==null)return;let r=`${e}`.trim();if(!/^\d+$/.test(r))return;let n=parseInt(r,10);if(!(n<0||n>t))return n}function x7(e,t){if(e==null)return null;let r=`${e}`.trim();if(!r)return null;let[,n=r,s]=/^(.*?)(?:\/(\d+))?$/.exec(r)||[],o=`${n}`.trim().replace(/^\[/,"").replace(/\]$/,""),i=t==="ipv4";return(i?Ur(o):lr(o))?{address:o,cidr:aC(s,i?32:128)}:null}function B7(e,t){let{addressKey:r,cidrKey:n,family:s,defaultCIDR:o}=t,i=x7(e[r],s);if(!i){(e[r]==null||`${e[r]}`.trim().length===0)&&delete e[n];return}e[r]=i.address;let a=aC(e[n],o);e[n]=a??i.cidr??o}function C1(e={}){return B7(e,{addressKey:"ip",cidrKey:"ip-cidr",family:"ipv4",defaultCIDR:32}),B7(e,{addressKey:"ipv6",cidrKey:"ipv6-cidr",family:"ipv6",defaultCIDR:128}),e}function Qs(e={},t="ipv4"){let r=t==="ipv6"?{addressKey:"ipv6",cidrKey:"ipv6-cidr",defaultCIDR:128}:{addressKey:"ip",cidrKey:"ip-cidr",defaultCIDR:32},n=x7(e[r.addressKey],t);if(!n)return;let s=aC(e[r.cidrKey],r.defaultCIDR);return`${n.address}/${s??n.cidr??r.defaultCIDR}`}function Ra(e,t,r={}){return e=e.map(n=>{if(!Object.hasOwn(n,"ecn"))return n;let s={...n};return delete s.ecn,s}),t==="internal"?e:r.prettyYaml||r["pretty-yaml"]?Sh(gi.safeDump({proxies:e},{lineWidth:-1})):`proxies:
|
||
`+e.map(n=>" - "+JSON.stringify(n)+`
|
||
`).join("")}var p6e,I7,Je,ei=re(()=>{p6e=F(I()),I7=F(ho());gt();zl();Ir();_h();Je=class{constructor(t){this.proxy=t,this.output=[]}append(t){if(typeof t>"u")throw new Error("required field is missing");this.output.push(t)}appendIfPresent(t,r){fe(this.proxy,r)&&this.append(t)}toString(){return this.output.join("")}}});function bw(e){if(typeof e!="string")return;let t=/^([A-Za-z0-9+/]+|[A-Za-z0-9_-]+)(={0,2})$/.exec(e.trim());if(!t)return;let[,r,n]=t,s=(4-r.length%4)%4;if(!(s===3||n&&n.length!==s))return r.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat(s)}function T7(e){if(!Ge(e))return;if(!e.includes("://"))return{type:"config",config:e};let t=e.split("+");if(t.length===1&&Ge(t[0]))return{type:"dns",dns:t[0]};if(t.length===2&&Ge(t[0])&&Ge(t[1]))return{type:"dns",queryServerName:t[0],dns:t[1]}}function lC(e){return T7(e)!=null}function Aw(e){return["none","half","full"].includes(e)}function fC(e){return typeof e=="boolean"?e:typeof e=="number"&&Number.isInteger(e)&&e!==0}function Sw({echConfigList:e,echForceQuery:t,echSockopt:r}={}){let n=T7(e);if(!n)return;let s={enable:!0};return n.type==="config"?s.config=n.config:(s[_f]=n.dns,n.queryServerName&&(s["query-server-name"]=n.queryServerName)),Aw(t)&&(s[uC]=t),Ze(r)&&(s[cC]=r),s}function dC(e,t,{dnsFieldPath:r="ech-opts._dns",warnDefaultDns:n}={}){let s={};if(Ze(e)){if(!fC(e.enable))return s;let o=e["query-server-name"];return Ge(e.config)?s.echConfigList=e.config:Ge(e[_f])?s.echConfigList=Ge(o)?`${o}+${e[_f]}`:e[_f]:Ge(o)&&(s.echConfigList=`${o}+${R7}`,n?.({defaultDns:R7,dnsFieldPath:r,queryServerName:o})),s.echConfigList&&Aw(e[uC])&&(s.echForceQuery=e[uC]),s.echConfigList&&Ze(e[cC])&&(s.echSockopt=e[cC]),s}return Ge(t)&&(s.echConfigList=t),s}function hC(e,t,r){return dC(e,t,r).echConfigList}var v6e,_f,uC,cC,R7,Fh=re(()=>{v6e=F(I());Ir();_f="_dns",uC="_force-query",cC="_sockopt",R7="https://dns.alidns.com/dns-query"});function pC(e,{allowZeroLowerBound:t=!0,allowZeroUpperBound:r=!0}={}){if(typeof e!="string"&&typeof e!="number")return;let n=f=>{let m=f.trim();if(!/^\+?\d+$/.test(m))return;let p=parseInt(m,10);return Number.isSafeInteger(p)?p:void 0},o=`${e}`.trim().split("-"),i=t?0:1,a=r?0:1;if(o.length===1){let f=n(o[0]),m=Math.max(i,a);return f>=m?{lowerBound:f,upperBound:f}:void 0}if(o.length!==2)return;let u=n(o[0]),l=n(o[1]);if(!(u==null||l==null))return u>=i&&l>=a&&l>=u?{lowerBound:u,upperBound:l}:void 0}function dne(e){return pC(e,{allowZeroUpperBound:!1})}function k7(e){return pC(e,{allowZeroLowerBound:!1,allowZeroUpperBound:!1})}function Ta(e){let t=dne(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Bh(e){let t=k7(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?`${n}`:`${r}-${n}`}function Cf(e){let t=k7(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Ai(e){let t=pC(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Fs(e,{allowNegative:t=!0}={}){if(typeof e=="number"&&Number.isFinite(e)&&Number.isSafeInteger(e))return!t&&e<0?void 0:e;if(typeof e!="string")return;let r=e.trim();if(!(t?/^[+-]?\d+$/:/^\+?\d+$/).test(r))return;let s=parseInt(r,10);if(Number.isSafeInteger(s)&&!(!t&&s<0))return s}var y6e,Ih=re(()=>{y6e=F(I())});function O7(e,t,r){if(!Object.prototype.hasOwnProperty.call($h,t))return;let n=$h[t],s=r;switch(t){case"padding-obfs":case"no-grpc-header":if(r!=="true"&&r!=="false")return;s=r==="true";break;case"uplink-chunk-size":s=Ai(r)??r;break;case"max-each-post-bytes":s=Cf(r)??r;break;case"min-posts-interval":s=Ta(r)??r;break;case"xmux-keep-alive":s=Fs(r)??r;break}P7.default.set(e,n,s)}var A6e,P7,$h,_w=re(()=>{A6e=F(I()),P7=F(ho());Ih();$h={path:"path",host:"host",mode:"mode","padding-bytes":"x-padding-bytes","padding-obfs":"x-padding-obfs-mode","padding-key":"x-padding-key","padding-header":"x-padding-header","padding-placement":"x-padding-placement","padding-method":"x-padding-method","uplink-method":"uplink-http-method","session-placement":"session-placement","session-key":"session-key","session-table":"session-table","session-length":"session-length","seq-placement":"seq-placement","seq-key":"seq-key","uplink-data-placement":"uplink-data-placement","uplink-data-key":"uplink-data-key","uplink-chunk-size":"uplink-chunk-size","no-grpc-header":"no-grpc-header","max-each-post-bytes":"sc-max-each-post-bytes","min-posts-interval":"sc-min-posts-interval-ms","xmux-max-concurrency":"reuse-settings.max-concurrency","xmux-max-connections":"reuse-settings.max-connections","xmux-max-reuse-times":"reuse-settings.c-max-reuse-times","xmux-max-request-times":"reuse-settings.h-max-request-times","xmux-max-reusable-secs":"reuse-settings.h-max-reusable-secs","xmux-keep-alive":"reuse-settings.h-keep-alive-period"}});function N7(e){return e==null?"":`${e}`.trim().toLowerCase()}function mC(e){return gne[e]||e}function cn(e,t=hne,{acceptAliases:r=!0,fallback:n=xh}={}){let s=N7(e);if(!s)return n;let o=t.map(N7);if(o.includes(s))return mC(s);let i=mC(s),a=o.map(mC);return r&&a.includes(i)?i:n}function D1(e){return cn(e,pne)}function L7(e){return cn(e,mne,{fallback:"chacha20-poly1305"})}function U7(e){let t=D1(e);return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}function Cw(e){let t=cn(e,["aes-128-gcm","chacha20-poly1305"]);if(t!==xh)return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}var _6e,xh,hne,pne,mne,gne,Si=re(()=>{_6e=F(I()),xh="auto",hne=[xh,"none","zero","aes-128-gcm","chacha20-poly1305"],pne=[xh,"aes-128-gcm","chacha20-poly1305","none"],mne=["none","chacha20-poly1305"],gne={"chacha20-ietf-poly1305":"chacha20-poly1305"}});function cs(e){return new Rh(e)}function ka(e){if(typeof e!="string")return e;let t=e.trim(),r=t[0];return(r==='"'||r==="'")&&t[t.length-1]===r?t.slice(1,-1):t}function ko(e){return`"${String(ka(e))}"`}function Df(e){return e!=null&&`${e}`.trim().length>0}function On(e,t){let r=t.type==="direct",n=!["wireguard","wireguard-surge"].includes(t.type),s=t["ip-version"],o=ka(t.tos);if(o!=null&&(!/^(?:\d+|0x[\da-f]+)$/i.test(o)||Number(o)>255))throw new Error("Surge tos must be an integer between 0 and 255");let i={"ip-version":vne[s]??s,"no-error-alert":r?void 0:t["no-error-alert"],tfo:t.tfo??t["fast-open"],"test-url":t["test-url"],"test-timeout":t["test-timeout"],"test-udp":t["test-udp"],hybrid:t.hybrid,tos:o,"allow-other-interface":n?t["allow-other-interface"]:void 0,interface:n?t.interface??t["interface-name"]:void 0,"dns-follow-interface":n?t["dns-follow-interface"]:void 0,"block-quic":t["block-quic"],ecn:r?void 0:t.ecn,"underlying-proxy":r?void 0:t["underlying-proxy"]};for(let[a,u]of Object.entries(i)){if(u==null)continue;let l=typeof u=="string"&&u.includes(",")?ko(u):u;e.append(`,${a}=${l}`)}}function gC(e,t){if(Df(t.ports)){if(Df(ka(t["underlying-proxy"])))throw new Error("Surge port-hopping cannot be combined with underlying-proxy");e.append(`,port-hopping="${String(t.ports).replace(/,/g,";")}"`)}Df(t["hop-interval"])&&e.append(`,port-hopping-interval=${t["hop-interval"]}`)}function M7(e){return(Array.isArray(e)?e:ka(`${e||""}`).split(",")).filter(r=>r!=null).map(r=>String(ka(r)).trim()).filter(r=>r!=="").join(",")}function q7(e,t){let r=M7(t.alpn);r&&e.append(`,alpn="${r}"`)}function j7(e,t){if(t.network==="h3"||["tuic","hysteria2","masque-surge"].includes(t.type))return;let r=t._surge_client_fingerprint??t["client-fingerprint"];if(typeof r!="string")return;let n=r.trim().toLowerCase();if(!["auto","none","apple-26","chromium-155"].includes(n)){let s=n.replace(/^hello/,"").split(/[-_]/,1)[0].replace(/([a-z])\d+$/,"$1");if(["chrome","edge","android","360","qq"].includes(s))n="chromium-155";else if(["safari","ios"].includes(s))n="apple-26";else if(["firefox","golang","random","randomized","randomizedalpn","randomizednoalpn"].includes(s))n="auto";else return}e.append(`,client-fingerprint=${n}`)}function wne(e){return M7(e?.["plugin-opts"]?.alpn??e?.alpn)}function Uu(e,t,r=!1){if(t.plugin!=="shadow-tls"||!t["plugin-opts"])return;let n=t["plugin-opts"].password,s=t["plugin-opts"].host,o=t["plugin-opts"].version;if(!n)return;if(e.append(`,shadow-tls-password="${n}"`),s&&e.append(`,shadow-tls-sni=${s}`),o){if(o<2)throw cs(`shadow-tls version ${o} is not supported`);e.append(`,shadow-tls-version=${o}`)}let i=wne(t);i&&e.append(`,alpn="${i}"`),r&&e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function Po(e,t,r=!0){if(!r)return;e.appendIfPresent(`,server-cert-fingerprint-sha256=${t["tls-fingerprint"]}`,"tls-fingerprint"),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),e.appendIfPresent(`,server-cert-verify-name=${ko(t["name-cert-verify"])}`,"name-cert-verify"),t.plugin!=="shadow-tls"&&q7(e,t),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify");let n=fe(t,"keystore-client-cert")?t["keystore-client-cert"]:t["client-cert"];(fe(t,"keystore-client-cert")||fe(t,"client-cert"))&&e.append(`,client-cert=${ko(n)}`),j7(e,t);let s=Ze(t["ech-opts"])?t["ech-opts"]:void 0;if((s?fC(s.enable):Ge(t._echConfigList))&&!t["reality-opts"]){let i=bw(s?s.config:t._echConfigList);if(!i)throw cs("Surge ECH requires an inline ECHConfigList in base64 or base64url");e.append(`,ech-config=${i}`)}}function yne(e,t){let r=fe(t,"keystore-private-key")?t["keystore-private-key"]:t["private-key"];(fe(t,"keystore-private-key")||fe(t,"private-key"))&&e.append(`,private-key=${ko(r)}`)}function K7(e){if(!fe(e,"max-streams"))return;let t=Number(ka(e["max-streams"]));!Number.isInteger(t)||t<=3||R.warn(`Surge ${e.type} proxy ${e.name}: max-streams=${t} is greater than 3. Too many streams sharing one TCP connection may hurt performance.`)}function Ene(e){return fe(e,"obfs-opts.mode")||fe(e,"obfs-opts.host")||fe(e,"obfs-opts.path")}function bne(e){return Number(e.version)===6&&Ene(e)}function Th(){return{produce:(t,r,n={})=>{if(t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"]&&!["vmess","trojan","vless"].includes(t.type))throw cs(`Platform ${Dw} does not support network ${t.network} with http upgrade`);switch(t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return Ane(t);case"trojan":return Sne(t);case"vmess":case"vless":return Bne(t,n["include-unsupported-proxy"]);case"http":return Rne(t);case"h2-connect":return Fne(t);case"direct":return Tne(t);case"socks5":return kne(t);case"snell":return One(t);case"tuic":return Nne(t);case"wireguard-surge":return V7(t);case"hysteria2":return Une(t);case"ssh":return xne(t);case"trusttunnel":return Cne(t);case"masque-surge":return Dne(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return Lne(t);if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw cs(`Platform ${Dw} does not support proxy type ${t.type} with network or REALITY`);return _ne(t)}throw cs(`Platform ${Dw} does not support proxy type: ${t.type}`)}}}function Ane(e){let t=new Je(e);if(t.append(`${e.name}=${e.type},${e.server},${e.port}`),e.cipher||(e.cipher="none"),!["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","none","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw cs(`cipher ${e.cipher} is not supported`);if(t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password"),fe(e,"plugin")){if(e.plugin==="obfs")t.append(`,obfs=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else if(!["shadow-tls"].includes(e.plugin))throw cs(`plugin ${e.plugin} is not supported`)}return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Uu(t,e,!0),On(t,e),t.toString()}function Sne(e){let t=new Je(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),yC(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),Po(t,e),Uu(t,e),On(t,e),t.toString()}function _ne(e){let t=new Je(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),Po(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),On(t,e),t.toString()}function Cne(e){let t=new Je(e);if(t.append(`${e.name}=trust-tunnel,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),fe(e,"client-random-auth-key")){let r=ka(e["client-random-auth-key"]);if(typeof r!="string"||!/^[0-9a-f]+$/i.test(r))throw new Error("TrustTunnel client-random-auth-key must be a hex string");t.append(`,client-random-auth-key=${r}`)}return vC(t,e),K7(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),e.network==="h3"&&t.append(",h3=true"),Po(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),On(t,e),t.toString()}function Dne(e){let t=new Je(e);return t.append(`${e.name}=masque,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),gC(t,e),Po(t,e),On(t,e),t.toString()}function Fne(e){let t=new Je(e);return t.append(`${e.name}=h2-connect,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),vC(t,e),K7(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),Po(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Uu(t,e),On(t,e),t.toString()}function Bne(e,t){let r=e.type==="vless",n=new Je(e);if(n.append(`${e.name}=${e.type},${e.server},${e.port}`),n.appendIfPresent(`,username=${e.uuid}`,"uuid"),!r){let s=Cw(e.cipher);s&&n.append(`,encrypt-method=${s}`)}if(r)Ine(n,e);else{yC(n,e,t);let s=fe(e,"aead")?e.aead:e.alterId===0;n.append(`,vmess-aead=${s}`),n.appendIfPresent(`,tls=${e.tls}`,"tls"),Po(n,e,!!e.tls)}return Uu(n,e),On(n,e),n.toString()}function Ine(e,t){let r=t.network??"tcp",n=t["reality-opts"],s=t.tls||n;if(!["tcp","raw","none","ws","grpc","xhttp"].includes(r))throw cs(`VLESS network ${r} is unsupported`);if(t.encryption&&/[,\r\n"']/.test(t.encryption))throw cs("VLESS encryption contains unsupported characters");if(!ww(t))throw cs("Unsupported VLESS transport, TLS or flow combination");if(r==="ws")yC(e,t);else if(r==="grpc"){e.append(",grpc=true");let o=t["grpc-opts"];for(let[i,a]of[["grpc-service-name",o?.["grpc-service-name"]],["grpc-mode",o?.["_grpc-type"]],["grpc-authority",o?.["_grpc-authority"]]])a&&e.append(`,${i}=${a}`)}else r==="xhttp"&&$ne(e,t);t.flow&&e.append(`,flow=${t.flow}`),t.encryption&&e.append(`,encryption=${t.encryption}`),n?(e.append(`,reality-public-key=${n["public-key"]}`),n["short-id"]&&e.append(`,reality-short-id=${n["short-id"]}`),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),q7(e,t),j7(e,t)):(e.appendIfPresent(`,tls=${t.tls}`,"tls"),Po(e,t,!!s))}function $ne(e,t){let r=t["xhttp-opts"];if(r?.["download-settings"])throw cs("VLESS XHTTP download-settings are unsupported");e.append(",xhttp=true");let n=Ze(r?.headers)?Object.entries(r.headers):[],s=r?.host??n.find(([a])=>/^host$/i.test(a))?.[1];for(let[a,u]of Object.entries($h)){let l=a==="host"?s:H7.default.get(r,u);if(l==null)continue;let f=String(l),m=ka(f);if(!m&&a!=="session-table")continue;if(/[\r\n]/.test(f)||m.includes('"'))throw cs(`VLESS xhttp-${a} contains unsupported characters`);let p=!m||/[,'\s]/.test(m)?ko(m):m;e.append(`,xhttp-${a}=${p}`)}let o=n.filter(([a])=>!/^host$/i.test(a));if(o.some(([a,u])=>/[,="':|\r\n]/.test(a)||/[\r\n]/.test(String(u))))throw cs("VLESS xhttp-headers contain unsupported characters");let i=wC(Object.fromEntries(o),"|");i&&e.append(`,xhttp-headers=${ko(i)}`)}function xne(e){let t=new Je(e);return t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),yne(t,e),t.appendIfPresent(`,idle-timeout=${e["idle-timeout"]}`,"idle-timeout"),t.appendIfPresent(`,server-fingerprint="${e["server-fingerprint"]}"`,"server-fingerprint"),On(t,e),t.toString()}function Rne(e){let t=new Je(e),r=e.tls?"https":"http";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),vC(t,e),Po(t,e,!!e.tls),Uu(t,e),On(t,e),t.toString()}function Tne(e){let t=new Je(e);return t.append(`${e.name}=direct`),On(t,e),t.toString()}function kne(e){let t=new Je(e),r=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),Po(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Uu(t,e),On(t,e),t.toString()}function vC(e,t){let r=Pne(t.headers);Ge(r)&&e.append(`,headers=${ko(r)}`)}function Pne(e){return wC(e,";")}function wC(e,t){return!e||typeof e!="object"?"":Object.entries(e).filter(([r,n])=>Ge(r)&&n!=null).map(([r,n])=>`${r}:${ko(n)}`).join(t)}function One(e){if(bne(e))return R.error(`Platform ${Dw} does not support Snell version ${e.version} with obfs`),"";let t=new Je(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk="${e.psk}"`,"psk"),Number(e.version)===6&&t.appendIfPresent(`,mode=${e.mode}`,"mode"),t.appendIfPresent(`,obfs=${e["obfs-opts"]?.mode}`,"obfs-opts.mode"),t.appendIfPresent(`,obfs-host=${e["obfs-opts"]?.host}`,"obfs-opts.host"),t.appendIfPresent(`,obfs-uri=${e["obfs-opts"]?.path}`,"obfs-opts.path"),Uu(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),On(t,e),t.toString()}function Nne(e){let t=new Je(e),r=e.type;return(!e.token||e.token.length===0)&&(r="tuic-v5"),t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,token=${e.token}`,"token"),gC(t,e),Po(t,e),Uu(t,e),On(t,e),t.toString()}function Lne(e){let t=Array.isArray(e.peers)&&e.peers.length>0?e.peers:[e],{ip:r,ipv6:n}=C1({ip:e["self-ip"]??e.ip??t[0].ip,ipv6:e["self-ip-v6"]??e.ipv6??t[0].ipv6}),s=Ge(e["private-key-keystore-name"])?"private-key-keystore-name":"private-key",o=e[s];if(!Df(o)||!r&&!n)throw new Error("Surge WireGuard requires a local address and either private-key or private-key-keystore-name");let i=e["listen-port"];if(i!=null&&(!/^\d+$/.test(`${i}`.trim())||i<1||i>65535))throw new Error("Surge WireGuard listen-port must be between 1 and 65535");let a=Dt(e["section-name"],e.name).trim(),u=V7({...e,"section-name":a,"underlying-proxy":i==null?e["underlying-proxy"]:void 0}),l=new Je(e);l.append(`# > WireGuard Proxy ${e.name}
|
||
# ${u}
|
||
# > WireGuard Section ${e.name}
|
||
[WireGuard ${a}]
|
||
${s} = ${o}`),r&&l.append(`
|
||
self-ip = ${r}`),n&&l.append(`
|
||
self-ip-v6 = ${n}`);let f=e["dns-server"]??e.dns,m=Array.isArray(f)?f.join(", "):f;Ge(m)&&l.append(`
|
||
dns-server = ${m}`),l.appendIfPresent(`
|
||
mtu = ${e.mtu}`,"mtu"),fe(e,"prefer-ipv6")?l.append(`
|
||
prefer-ipv6 = ${e["prefer-ipv6"]}`):["ipv6-prefer","prefer-v6"].includes(e["ip-version"])&&l.append(`
|
||
prefer-ipv6 = true`);let p=e["allow-peer-access"]??e["accept-incoming"];i==null&&p!=null&&l.append(`
|
||
allow-peer-access = ${p}`),l.appendIfPresent(`
|
||
listen-port = ${i}`,"listen-port");let d=t.length===1?e:{},v=t.length===1&&i==null&&(p==null||/^false$/i.test(`${p}`.trim()))?[r&&"0.0.0.0/0",n&&"::/0"].filter(Boolean).join(","):void 0;for(let g of t){let y=g["allowed-ips"]??d["allowed-ips"],w=ka(Array.isArray(y)?y.join(","):y)||v;if(!Df(g["public-key"])||!w)throw new Error("Surge WireGuard peers require public-key and allowed-ips");let E=g.endpoint;if(!Ge(E)&&Ge(g.server)&&Df(g.port)){let H=g.server.trim();E=`${lr(H)?`[${H}]`:H}:${g.port}`}if(!Ge(E)&&i==null)throw new Error("Surge WireGuard peers require endpoint without listen-port");let S=ka(g["client-id"]??g.reserved);Array.isArray(S)?S=S.join("/"):/^[\da-f]{6}$/i.test(S)&&(S=`0x${S}`);let C={"public-key":g["public-key"],"allowed-ips":ko(w),endpoint:E,keepalive:g["persistent-keepalive"]??g.keepalive??g["persistent-keepalive-interval"]??e["persistent-keepalive"]??e.keepalive,"client-id":S,"preshared-key":g["preshared-key"]??g["pre-shared-key"]??d["preshared-key"]??d["pre-shared-key"]},D=Object.entries(C).filter(([,H])=>Df(H)).map(([H,K])=>`${H} = ${K}`).join(", ");l.append(`
|
||
peer = (${D})`)}return l.toString()}function V7(e){let t=Dt(e["section-name"])?.trim();if(!t)throw new Error("Surge WireGuard requires section-name");let r=t.includes(",")?ko(t):t,n=new Je(e);return n.append(`${e.name}=wireguard,section-name=${r}`),On(n,e),n.toString()}function Une(e){let t={salamander:"salamander-password",gecko:"gecko-password"}[e.obfs];if(e["obfs-password"]&&!t)throw cs("only salamander and gecko obfs are supported");let r=new Je(e);return r.append(`${e.name}=hysteria2,${e.server},${e.port}`),r.appendIfPresent(`,password="${e.password}"`,"password"),gC(r,e),e["obfs-password"]&&t&&r.append(`,${t}=${To(e["obfs-password"])}`),Po(r,e),Uu(r,e),r.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),On(r,e),r.toString()}function yC(e,t,r){if(fe(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),fe(t,"ws-opts")&&(t["ws-opts"]["v2ray-http-upgrade"]&&e.append(",ws-http-upgrade=true"),e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),fe(t,"ws-opts.headers"))){let n=t["ws-opts"].headers,s=wC(n,"|");Ge(s)&&e.append(`,ws-headers=${ko(s)}`)}}else if(r&&["http"].includes(t.network))R.info(`Include Unsupported Proxy: network ${t.network} -> tcp`);else{if(["tcp"].includes(t.network)&&t["reality-opts"])throw cs("reality is unsupported");if(!["tcp"].includes(t.network))throw cs(`network ${t.network} is unsupported`)}}var R6e,H7,Dw,Rh,vne,EC=re(()=>{R6e=F(I()),H7=F(ho());ei();Ir();gt();Fh();_w();Si();Dw="Surge",Rh=class extends Error{constructor(t){super(t),this.name="SurgeUnsupportedProxyError"}};vne={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"}});function bC(e){try{return decodeURIComponent(`${e}`.replace(/\+/g,"%20"))}catch{return e}}function Fw(e){let t=e.indexOf("=");return t===-1?{key:bC(e),value:""}:{key:bC(e.slice(0,t)),value:bC(e.slice(t+1))}}function Yi(e){if(!/^\d+$/.test(`${e}`))return null;let t=parseInt(`${e}`,10);return Number.isSafeInteger(t)?t:null}function ti(e,t){let r=e==null?"":`${e}`,n=r.indexOf("?");if(n===-1)return{path:r,value:""};let s=r.slice(0,n),o=r.slice(n+1),i=[],a="";for(let u of o.split("&")){if(u==="")continue;let l=Fw(u);if(l.key===t){a===""&&l.value!==""&&(a=l.value);continue}i.push(u)}return{path:i.length>0?`${s}?${i.join("&")}`:s,value:a}}function Ff(e,t){let r=e==null?"":`${e}`,n=r.indexOf("?");if(n===-1)return"";let s=r.slice(n+1);for(let o of s.split("&")){if(o==="")continue;let i=Fw(o);if(i.key===t&&i.value!=="")return i.value}return""}function AC(e,t){let r=Ff(e,t),n=Yi(r);return n==null?{value:"",parsed:null}:{value:r,parsed:n}}function Hne(e,t,r){let n=e.includes("?")?e.endsWith("?")||e.endsWith("&")?"":"&":"?";return`${e}${n}${encodeURIComponent(t)}=${encodeURIComponent(`${r}`)}`}function SC(e,t,r){let n=e==null||e===""?"/":`${e}`,{path:s}=ti(n,t);return Hne(s,t,r)}function rl(e){let t=e?.path;if(!e)return;let{value:r,parsed:n}=AC(t,"ed");if(e["v2ray-http-upgrade"]){r!==""&&(e.path=ti(t,"ed").path,e["v2ray-http-upgrade-fast-open"]=!0,(e["_v2ray-http-upgrade-ed"]==null||`${e["_v2ray-http-upgrade-ed"]}`=="")&&(e["_v2ray-http-upgrade-ed"]=r)),delete e["early-data-header-name"],delete e["max-early-data"];return}r!==""&&(e.path=ti(t,"ed").path,e["early-data-header-name"]==null&&(e["early-data-header-name"]="Sec-WebSocket-Protocol"),e["max-early-data"]==null&&(e["max-early-data"]=n))}function nl(e){e&&delete e["_v2ray-http-upgrade-ed"]}var k6e,Hu=re(()=>{k6e=F(I())});function G7(e,t,r){if(!Ze(t)||!Ge(t[_f]))return;let n=Ge(t["query-server-name"])?t["query-server-name"]:"\u8FD9\u91CC\u662F query-server-name";R.warn(`mihomo \u4E0D\u652F\u6301\u5728 ech-opts \u4E2D\u914D\u7F6E ECH DNS. \u5982\u9700\u8DDF\u8282\u70B9 ECH \u914D\u7F6E\u4E00\u81F4, \u8BF7\u5728 mihomo \u914D\u7F6E\u6587\u4EF6\u91CC\u8BBE\u7F6E dns["nameserver-policy"]["${n}"] = ["${t[_f]}"].`)}function qne(e,t){t!=="internal"&&(G7(e,e["ech-opts"],"ech-opts"),G7(e,e["xhttp-opts"]?.["download-settings"]?.["ech-opts"],"xhttp-opts.download-settings.ech-opts"))}function _i(){return{type:"ALL",produce:(r,n,s={})=>{let o=r.filter(i=>{if(!yw(i,"Mihomo"))return!1;if(s["include-unsupported-proxy"])return!0;if(i.type==="h2-connect")return R.error(`mihomo does not support HTTP/2 CONNECT proxy type. Proxy ${i.name} has been filtered.`),!1;if(i.type==="masque-surge")return R.error(`mihomo does not support Surge MASQUE proxy type. Proxy ${i.name} has been filtered.`),!1;if(jne(i)&&i.type==="trusttunnel")return R.error(`mihomo does not support headers for TrustTunnel proxy ${i.name}. Proxy has been filtered.`),!1;if(Dh(i,["websocket"])){if(i.type==="snell"&&!Kne(i))return!1;if(z7(i)&&(!["ss","snell","vmess","vless","trojan","anytls"].includes(i.type)||!_C(Y7(i),["ss","snell"].includes(i.type)?[1,2,3]:[0,1,2,3])))return!1;if(i.type==="vless"&&i.network==="xhttp"&&z7(i["xhttp-opts"]?.["download-settings"])&&!_C(Y7(i["xhttp-opts"]["download-settings"]),[0,1,2,3]))return!1;if(Vne(i))return R.error(`Platform Mihomo does not support Snell shadow-tls with obfs for proxy ${i.name}. Proxy has been filtered.`),!1;if(["juicity","naive"].includes(i.type))return!1;if(["ss"].includes(i.type)&&!["aes-128-ctr","aes-192-ctr","aes-256-ctr","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-ccm","aes-192-ccm","aes-256-ccm","aes-128-gcm-siv","aes-256-gcm-siv","chacha20-ietf","chacha20","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","chacha8-ietf-poly1305","xchacha8-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm","2022-blake3-chacha20-poly1305","lea-128-gcm","lea-192-gcm","lea-256-gcm","rabbit128-poly1305","aegis-128l","aegis-256","aez-384","deoxys-ii-256-128","rc4-md5","none"].includes(i.cipher))return!1;if(["anytls"].includes(i.type)&&i.network&&(!["tcp"].includes(i.network)||["tcp"].includes(i.network)&&i["reality-opts"]))return!1;if(!["vless"].includes(i.type)&&["xhttp"].includes(i.network))return!1}else return!1;return!0}).map(i=>{if(qne(i,n),Ew(i),i["reality-opts"]&&!i["client-fingerprint"]&&(i["client-fingerprint"]="chrome"),i.type==="vmess")fe(i,"aead")&&(i.aead&&(i.alterId=0),delete i.aead),fe(i,"sni")&&(i.servername=i.sni,delete i.sni),i.cipher=cn(i.cipher);else if(i.type==="tuic")fe(i,"alpn")&&(i.alpn=Array.isArray(i.alpn)?i.alpn:[i.alpn]),fe(i,"tfo")&&!fe(i,"fast-open")&&(i["fast-open"]=i.tfo),(!i.token||i.token.length===0)&&!fe(i,"version")&&(i.version=5);else if(i.type==="hysteria")fe(i,"auth_str")&&!fe(i,"auth-str")&&(i["auth-str"]=i.auth_str),fe(i,"alpn")&&(i.alpn=Array.isArray(i.alpn)?i.alpn:[i.alpn]),fe(i,"tfo")&&!fe(i,"fast-open")&&(i["fast-open"]=i.tfo);else if(i.type==="wireguard")i.keepalive=i.keepalive??i["persistent-keepalive"],i["persistent-keepalive"]=i.keepalive,i["preshared-key"]=i["preshared-key"]??i["pre-shared-key"],i["pre-shared-key"]=i["preshared-key"],i.ip=Qs(i,"ipv4"),i.ipv6=Qs(i,"ipv6");else if(i.type==="vless"){if(fe(i,"sni")&&(i.servername=i.sni,delete i.sni),i.network==="xhttp"&&i["xhttp-opts"]?.["download-settings"]){let a=i["xhttp-opts"]["download-settings"];i.tls&&a.tls&&i["reality-opts"]&&!a["reality-opts"]&&(a["reality-opts"]={"public-key":""})}}else["anytls"].includes(i.type)&&i.reuse!=null&&!i.reuse&&(i["disable-reuse"]=!0,delete i.reuse);if(fe(i,"plugin-opts.mux")&&(i["plugin-opts"].mux=$7(i["plugin-opts"].mux)),i.type==="snell"){let a=Number(i.version??1);i.version!=null&&Number.isInteger(a)&&(i.version=a),a<3&&delete i.udp,a<6&&delete i.mode;let u=CC(i);u&&(i["obfs-opts"]={...u,mode:"shadow-tls"},delete i.plugin,delete i["plugin-opts"])}if(["vmess","vless"].includes(i.type)&&i.network==="http"){let a=i["http-opts"]?.path;fe(i,"http-opts.path")&&!Array.isArray(a)&&(i["http-opts"].path=[a]);let u=i["http-opts"]?.headers?.Host;fe(i,"http-opts.headers.Host")&&!Array.isArray(u)&&(i["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(i.type)&&i.network==="h2"){let a=i["h2-opts"]?.path;fe(i,"h2-opts.path")&&Array.isArray(a)&&(i["h2-opts"].path=a[0]);let u=i["h2-opts"]?.host??i["h2-opts"]?.headers?.host??i["h2-opts"]?.headers?.Host;(fe(i,"h2-opts.host")||fe(i,"h2-opts.headers.host")||fe(i,"h2-opts.headers.Host"))&&(i["h2-opts"].host=Array.isArray(u)?u:[u]),i["h2-opts"]?.headers&&(delete i["h2-opts"].headers.host,delete i["h2-opts"].headers.Host,Object.keys(i["h2-opts"].headers).length===0&&delete i["h2-opts"].headers)}if(["ws"].includes(i.network)){let a=`${i.network}-opts`;i[a]=i[a]||{},i[a].path||(i[a].path="/"),rl(i[a])}if(i["plugin-opts"]?.tls&&fe(i,"skip-cert-verify")&&(i["plugin-opts"]["skip-cert-verify"]=i["plugin-opts"]["skip-cert-verify"]||i["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive","masque","shadowquic"].includes(i.type)&&delete i.tls,i["tls-fingerprint"]&&(i.fingerprint=i["tls-fingerprint"]),delete i["tls-fingerprint"],i["underlying-proxy"]&&(i["dialer-proxy"]=i["underlying-proxy"]),delete i["underlying-proxy"],fe(i,"tls")&&typeof i.tls!="boolean"&&delete i.tls,delete i.subName,delete i.collectionName,delete i.id,delete i.resolved,delete i["no-resolve"],delete i["ip-cidr"],delete i["ipv6-cidr"],n!=="internal"||s["delete-underscore-fields"]){for(let a in i)(i[a]==null||/^_/i.test(a))&&delete i[a];nl(i[`${i.network}-opts`])}return["grpc"].includes(i.network)&&i[`${i.network}-opts`]&&(delete i[`${i.network}-opts`]["_grpc-type"],delete i[`${i.network}-opts`]["_grpc-authority"]),i["ip-version"]&&(i["ip-version"]=Mne[i["ip-version"]]||i["ip-version"]),i});return Ra(o,n,s)}}}function jne(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function _C(e,t){if(e==null)return!0;let r=typeof e=="string"?e.trim():`${e}`;if(!r)return!1;let n=Number(r);return Number.isInteger(n)&&t.includes(n)}function Kne(e){if(!_C(e.version,[0,1,2,3,4,5,6]))return!1;let t=Number(e.version)===6,{psk:r,mode:n,"obfs-opts":s}=e,o=["","shadow-tls","restls","jls"];t||o.push("http","tls");let i;if(typeof r!="string"&&!Number.isFinite(r))i="missing or invalid PSK";else if(s!=null&&!Ze(s))i="obfs-opts must be a mapping";else if(!o.includes(s?.mode??""))i="unsupported obfs-opts.mode";else if(t){let a=W7.Buffer.byteLength(String(r),"utf8");a<12||a>255?i="PSK must be 12 to 255 UTF-8 bytes":["","default","unshaped","unsafe-raw"].includes(n??"")||(i="unsupported mode")}return i?(R.error(`Mihomo Snell proxy ${e.name} has been filtered. ${i}.`),!1):!0}function z7(e){return!!CC(e)}function Vne(e){return e?.type==="snell"&&e?.plugin==="shadow-tls"&&(fe(e,"obfs-opts.mode")||fe(e,"obfs-opts.host")||fe(e,"obfs-opts.path"))}function Y7(e){return CC(e)?.version}function CC(e){if(e?.plugin==="shadow-tls"&&e?.["plugin-opts"])return e["plugin-opts"];if(e?.type==="snell"&&e?.["obfs-opts"]?.mode==="shadow-tls")return e["obfs-opts"]}var q6e,W7,Mne,Bw=re(()=>{q6e=F(I()),W7=F(iu());ei();Ir();Hu();Fh();gt();Si();Mne={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"}});function F1(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return Q7(t);default:{if(n.mihomoExternal||t._mihomoExternal)return X7(t,r,n)||"";try{return Z7.produce(t,r,n)}catch(s){if(n.useMihomoExternal&&s instanceof Rh){let o=X7(t,r,n)||"";if(!o)throw s;return R.log(`${t.name} is not supported on ${J7}, try to use mihomo(SurgeMac - External Proxy Program) instead`),o}throw s instanceof Rh?new Error(`${s.message}. Surge for macOS \u53EF\u624B\u52A8\u6307\u5B9A\u94FE\u63A5\u53C2\u6570 target=SurgeMac \u6216\u5728 \u540C\u6B65\u914D\u7F6E \u4E2D\u6307\u5B9A SurgeMac \u6765\u542F\u7528 mihomo \u652F\u63F4 Surge \u672C\u8EAB\u4E0D\u652F\u6301\u7684\u534F\u8BAE`):s}}}}}}function Q7(e){let t=new Je(e);if(!e.exec||!e["local-port"])throw new Error(`${e.type}: exec and local-port are required`);return t.append(`${e.name}=external,exec="${e.exec}",local-port=${e["local-port"]}`),Array.isArray(e.args)&&e.args.map(r=>{t.append(`,args="${r}"`)}),Array.isArray(e.addresses)&&e.addresses.map(r=>{t.append(`,addresses=${r}`)}),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),On(t,e),t.toString()}function X7(e,t,r){let n=_i().produce([e],"internal")?.[0];if(n){let s=r?.localPort||e._localPort||65535,o=!["ipv4","v4-only"].includes(e["ip-version"]),i={enable:!0,ipv6:o,"default-nameserver":r?.defaultNameserver||e._defaultNameserver||["180.76.76.76","52.80.52.52","119.28.28.28","223.6.6.6"],nameserver:r?.nameserver||e._nameserver||["https://doh.pub/dns-query","https://dns.alidns.com/dns-query","https://doh-pure.onedns.net/dns-query"]},a=r?.merge||e._merge,u;if(a){let l={name:e.name,type:"socks5",server:"127.0.0.1",port:s,udp:!0};u=Z7.produce(l,"socks5",r),r._merged=r._merged||{name:r?.mergeName||e._mergeName||"mihomo merged",exec:r?.exec||e._exec||"/usr/local/bin/mihomo",config:{ipv6:o,mode:"global",dns:i,proxies:[],"proxy-groups":[{name:"GLOBAL",type:"fallback",proxies:[]}],listeners:[]}};let f=`${s}`;r._merged.config.listeners.push({name:`socks5-${s}`,type:"socks",port:s,listen:"127.0.0.1",udp:!0,proxy:f}),r._merged.config["proxy-groups"][0].proxies.push(f),r._merged.config.proxies.push({...n,name:f});let m=r?.config||e._config;m&&(r._merged.configOverride={...r._merged.configOverride||{},...m})}else{let l={name:e.name,type:"external",udp:!0,exec:r?.exec||e._exec||"/usr/local/bin/mihomo","local-port":s,args:["-config",mt.encode(JSON.stringify({"mixed-port":s,ipv6:o,mode:"global",dns:i,proxies:[{...n,name:"proxy"}],"proxy-groups":[{name:"GLOBAL",type:"select",proxies:["proxy"]}],...r?.config||e._config||{}}))],addresses:[]};Gne(e.server)?l.addresses.push(e.server):R.warn(`Platform ${J7}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),u=Q7(l)}return r.localPort=s-1,u}}function Gne(e){return Ur(e)||lr(e)}var X6e,J7,Z7,DC=re(()=>{X6e=F(I());Xo();ei();EC();Bw();Ir();gt();J7="SurgeMac",Z7=Th()});function Iw(){return{type:"ALL",produce:(r,n,s={})=>{let o=r.filter(i=>s["include-unsupported-proxy"]?!0:!["ss","ssr","vmess","vless","socks5","http","snell","trojan","wireguard"].includes(i.type)||i.type==="ss"&&!["aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","rc4-md5","chacha20-ietf","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305"].includes(i.cipher)||i.type==="snell"&&i.version>=4||i.type==="vless"&&(typeof i.flow<"u"||i["reality-opts"])||["ws"].includes(i.network)&&i["ws-opts"]?.["v2ray-http-upgrade"]?!1:i["underlying-proxy"]||i["dialer-proxy"]?(R.error(`Clash \u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${i.name}`),!1):!0).map(i=>{if(i.type==="vmess"?(fe(i,"aead")&&(i.aead&&(i.alterId=0),delete i.aead),fe(i,"sni")&&(i.servername=i.sni,delete i.sni),i.cipher=D1(i.cipher)):i.type==="wireguard"?(i.keepalive=i.keepalive??i["persistent-keepalive"],i["persistent-keepalive"]=i.keepalive,i["preshared-key"]=i["preshared-key"]??i["pre-shared-key"],i["pre-shared-key"]=i["preshared-key"]):i.type==="snell"&&i.version<3?delete i.udp:i.type==="vless"&&fe(i,"sni")&&(i.servername=i.sni,delete i.sni),["vmess","vless"].includes(i.type)&&i.network==="http"){let a=i["http-opts"]?.path;fe(i,"http-opts.path")&&!Array.isArray(a)&&(i["http-opts"].path=[a]);let u=i["http-opts"]?.headers?.Host;fe(i,"http-opts.headers.Host")&&!Array.isArray(u)&&(i["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(i.type)&&i.network==="h2"){let a=i["h2-opts"]?.path;fe(i,"h2-opts.path")&&Array.isArray(a)&&(i["h2-opts"].path=a[0]);let u=i["h2-opts"]?.host??i["h2-opts"]?.headers?.host??i["h2-opts"]?.headers?.Host;(fe(i,"h2-opts.host")||fe(i,"h2-opts.headers.host")||fe(i,"h2-opts.headers.Host"))&&(i["h2-opts"].host=Array.isArray(u)?u:[u]),i["h2-opts"]?.headers&&(delete i["h2-opts"].headers.host,delete i["h2-opts"].headers.Host,Object.keys(i["h2-opts"].headers).length===0&&delete i["h2-opts"].headers)}if(["ws"].includes(i.network)){let a=`${i.network}-opts`;i[a]=i[a]||{},i[a].path||(i[a].path="/"),rl(i[a])}if(i["plugin-opts"]?.tls&&fe(i,"skip-cert-verify")&&(i["plugin-opts"]["skip-cert-verify"]=i["plugin-opts"]["skip-cert-verify"]||i["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].includes(i.type)&&delete i.tls,i["tls-fingerprint"]&&(i.fingerprint=i["tls-fingerprint"]),delete i["tls-fingerprint"],fe(i,"tls")&&typeof i.tls!="boolean"&&delete i.tls,delete i.subName,delete i.collectionName,delete i.id,delete i.resolved,delete i["no-resolve"],delete i["ip-cidr"],delete i["ipv6-cidr"],n!=="internal"){for(let a in i)(i[a]==null||/^_/i.test(a))&&delete i[a];nl(i[`${i.network}-opts`])}return["grpc"].includes(i.network)&&i[`${i.network}-opts`]&&(delete i[`${i.network}-opts`]["_grpc-type"],delete i[`${i.network}-opts`]["_grpc-authority"]),i});return Ra(o,n,s)}}}var rCe,ek=re(()=>{rCe=F(I());ei();Si();Hu();gt()});function $w(){return{type:"ALL",produce:(r,n,s={})=>{let o=r.filter(i=>{if(s["include-unsupported-proxy"])return!0;if(!["ss","ssr","vmess","socks5","http","snell","trojan","tuic","vless","wireguard","hysteria","hysteria2","ssh","juicity","anytls","tailscale","trusttunnel","masque","mieru"].includes(i.type)||i.type==="ss"&&!["aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","rc4-md5","chacha20-ietf","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(i.cipher)||i.type==="snell"&&i.version>6)return!1;if(Dh(i,["websocket"])){if(["vless"].includes(i.type)&&i["reality-opts"]&&i.network&&!["tcp"].includes(i.network))return!1;if(["anytls"].includes(i.type)&&i.network&&(!["tcp"].includes(i.network)||["tcp"].includes(i.network)&&i["reality-opts"]))return!1;if(!["vless"].includes(i.type)&&["xhttp"].includes(i.network))return!1;if(["ws"].includes(i.network)&&i["ws-opts"]?.["v2ray-http-upgrade"])return!1}else return!1;return!0}).map(i=>{if(i.type==="vmess"?(fe(i,"aead")&&(i.aead&&(i.alterId=0),delete i.aead),fe(i,"sni")&&(i.servername=i.sni,delete i.sni),i.cipher=D1(i.cipher)):i.type==="tuic"?(fe(i,"alpn")?i.alpn=Array.isArray(i.alpn)?i.alpn:[i.alpn]:i.alpn=["h3"],fe(i,"tfo")&&!fe(i,"fast-open")&&(i["fast-open"]=i.tfo,delete i.tfo),(!i.token||i.token.length===0)&&!fe(i,"version")&&(i.version=5)):i.type==="hysteria"?(fe(i,"auth_str")&&!fe(i,"auth-str")&&(i["auth-str"]=i.auth_str),fe(i,"alpn")&&(i.alpn=Array.isArray(i.alpn)?i.alpn:[i.alpn]),fe(i,"tfo")&&!fe(i,"fast-open")&&(i["fast-open"]=i.tfo,delete i.tfo),fe(i,"down")&&!fe(i,"down-speed")&&(i["down-speed"]=i.down,delete i.down),fe(i,"up")&&!fe(i,"up-speed")&&(i["up-speed"]=i.up,delete i.up),fe(i,"down-speed")&&(i["down-speed"]=`${i["down-speed"]}`.match(/\d+/)?.[0]||0),fe(i,"up-speed")&&(i["up-speed"]=`${i["up-speed"]}`.match(/\d+/)?.[0]||0)):i.type==="hysteria2"?(fe(i,"password")&&!fe(i,"auth")&&(i.auth=i.password,delete i.password),fe(i,"tfo")&&!fe(i,"fast-open")&&(i["fast-open"]=i.tfo,delete i.tfo),fe(i,"down")&&!fe(i,"down-speed")&&(i["down-speed"]=i.down,delete i.down),fe(i,"up")&&!fe(i,"up-speed")&&(i["up-speed"]=i.up,delete i.up),fe(i,"down-speed")&&(i["down-speed"]=`${i["down-speed"]}`.match(/\d+/)?.[0]||0),fe(i,"up-speed")&&(i["up-speed"]=`${i["up-speed"]}`.match(/\d+/)?.[0]||0)):i.type==="wireguard"?(i.keepalive=i.keepalive??i["persistent-keepalive"],i["persistent-keepalive"]=i.keepalive,i["preshared-key"]=i["preshared-key"]??i["pre-shared-key"],i["pre-shared-key"]=i["preshared-key"]):i.type==="snell"&&i.version<3?delete i.udp:i.type==="vless"&&fe(i,"sni")&&(i.servername=i.sni,delete i.sni),["vmess","vless"].includes(i.type)&&i.network==="http"){let a=i["http-opts"]?.path;fe(i,"http-opts.path")&&!Array.isArray(a)&&(i["http-opts"].path=[a]);let u=i["http-opts"]?.headers?.Host;fe(i,"http-opts.headers.Host")&&!Array.isArray(u)&&(i["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(i.type)&&i.network==="h2"){let a=i["h2-opts"]?.path;fe(i,"h2-opts.path")&&Array.isArray(a)&&(i["h2-opts"].path=a[0]);let u=i["h2-opts"]?.host??i["h2-opts"]?.headers?.host??i["h2-opts"]?.headers?.Host;(fe(i,"h2-opts.host")||fe(i,"h2-opts.headers.host")||fe(i,"h2-opts.headers.Host"))&&(i["h2-opts"].host=Array.isArray(u)?u:[u]),i["h2-opts"]?.headers&&(delete i["h2-opts"].headers.host,delete i["h2-opts"].headers.Host,Object.keys(i["h2-opts"].headers).length===0&&delete i["h2-opts"].headers)}if(["ws"].includes(i.network)){let a=`${i.network}-opts`;i[a]=i[a]||{},i[a].path||(i[a].path="/"),rl(i[a])}if(i["plugin-opts"]?.tls&&fe(i,"skip-cert-verify")&&(i["plugin-opts"]["skip-cert-verify"]=i["plugin-opts"]["skip-cert-verify"]||i["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].includes(i.type)&&delete i.tls,i["tls-fingerprint"]&&(i["server-cert-fingerprint"]=i["tls-fingerprint"]),delete i["tls-fingerprint"],i["underlying-proxy"]&&(i["dialer-proxy"]=i["underlying-proxy"]),delete i["underlying-proxy"],fe(i,"tls")&&typeof i.tls!="boolean"&&delete i.tls,i["test-url"]&&(i["benchmark-url"]=i["test-url"],delete i["test-url"]),i["test-timeout"]&&(i["benchmark-timeout"]=i["test-timeout"],delete i["test-timeout"]),delete i.subName,delete i.collectionName,delete i.id,delete i.resolved,delete i["no-resolve"],delete i["ip-cidr"],delete i["ipv6-cidr"],n!=="internal"){for(let a in i)(i[a]==null||/^_/i.test(a))&&delete i[a];nl(i[`${i.network}-opts`])}return["grpc"].includes(i.network)&&i[`${i.network}-opts`]&&(delete i[`${i.network}-opts`]["_grpc-type"],delete i[`${i.network}-opts`]["_grpc-authority"]),i});return Ra(o,n,s)}}}var cCe,tk=re(()=>{cCe=F(I());ei();Si();Hu();gt()});function sk(e){if(e)for(let t of["","download-"]){let r=o=>FC.default.get(e,B1[`${t}${o}`]);for(let o of Object.keys(BC)){let i=r(o);if(i==null)continue;let a=o==="xmux-http-keepalive-secs",u=a?Fs(i):Ai(i);if(u==null||a&&u<-1){let l=a?"an integer of at least -1":"a non-negative integer or a valid non-negative integer range";throw new Error(`Loon xhttp-${t}${o} must be ${l}`)}}let n=r("xmux-max-concurrency"),s=r("xmux-max-connections");if(Ta(n)!=null&&Ta(s)!=null){let o=`xhttp-${t}xmux`;throw new Error(`Loon ${o}-max-concurrency and ${o}-max-connections cannot both be positive`)}}}function ik(e,t,r){if(t==="header"||t==="download-header"){let n=r.indexOf(":");if(n<=0)return;let s=r.slice(0,n).trim();if(!s||/^host$/i.test(s))return;let o=t==="header"?e:e["download-settings"]??={};o.headers={...o.headers,[s]:r.slice(n+1).trim()};return}if(Object.prototype.hasOwnProperty.call(B1,t)){switch(t.replace(/^download-/,"")){case"padding-obfs-mode":case"no-grpc-header":case"over-tls":case"skip-cert-verify":if(r!=="true"&&r!=="false")return;r=r==="true";break;case"min-post-interval-ms":case"max-post-bytes":case"uplink-chunk-size":r=Ai(r)??r;break;case"port":case"xmux-http-keepalive-secs":r=Fs(r)??r;break;case"alpn":r=[r];break}FC.default.set(e,B1[t],r)}}var dCe,FC,rk,nk,BC,zne,B1,IC=re(()=>{dCe=F(I()),FC=F(ho());Ih();rk={"padding-bytes":"x-padding-bytes","padding-obfs-mode":"x-padding-obfs-mode","padding-placement":"x-padding-placement","padding-key":"x-padding-key","padding-header":"x-padding-header","padding-method":"x-padding-method"},nk={"session-id-placement":"session-placement","session-id-key":"session-key"},BC={"xmux-max-concurrency":"reuse-settings.max-concurrency","xmux-max-connections":"reuse-settings.max-connections","xmux-max-reuse-times":"reuse-settings.c-max-reuse-times","xmux-http-max-requests":"reuse-settings.h-max-request-times","xmux-http-max-reusable-secs":"reuse-settings.h-max-reusable-secs","xmux-http-keepalive-secs":"reuse-settings.h-keep-alive-period"},zne={server:"server",port:"port",host:"host",path:"path",alpn:"alpn","over-tls":"tls",sni:"servername","skip-cert-verify":"skip-cert-verify","tls-profile":"_loon_tls_profile","tls-cert-sha256":"fingerprint","tls-pubkey-sha256":"tls-pubkey-sha256","public-key":"reality-opts.public-key","short-id":"reality-opts.short-id",...BC,...rk,...nk},B1={mode:"mode","uplink-method":"uplink-http-method","min-post-interval-ms":"sc-min-posts-interval-ms","max-post-bytes":"sc-max-each-post-bytes","uplink-data-placement":"uplink-data-placement","uplink-data-key":"uplink-data-key","uplink-chunk-size":"uplink-chunk-size",...rk,"no-grpc-header":"no-grpc-header",...nk,"session-id-table":"session-table","session-id-length":"session-length","seq-placement":"seq-placement","seq-key":"seq-key",...BC,...Object.fromEntries(Object.entries(zne).map(([e,t])=>[`download-${e}`,`download-settings.${t}`]))}});function $C(){let e=(t,r,n={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${I1} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return Wne(t);case"ssr":return Xne(t);case"snell":return Jne(t);case"trojan":return Zne(t);case"vmess":return ese(t,n["include-unsupported-proxy"]);case"vless":return rse(t,n["include-unsupported-proxy"]);case"http":return nse(t);case"socks5":return sse(t);case"wireguard":return ose(t);case"tailscale":return ise(t);case"hysteria2":return use(t);case"mieru":return ase(t)}if(t.type==="anytls"){if(t.network&&!["tcp"].includes(t.network))throw new Error(`Platform ${I1} does not support proxy type ${t.type} with network ${t.network}`);return Qne(t)}throw new Error(`Platform ${I1} does not support proxy type: ${t.type}`)};return{produce:(t,r,n={})=>{let s=e(t,r,n),o=t["server-dns"];return Array.isArray(o)&&o.length>0?`${s},server-dns="${o.join(",")}"`:s}}}function sl(e,t){let r=dk(t);r&&e.append(`,tls-profile=${r}`)}function Bf(e,t,r=!1){let n=r?fk(t):lk(t);n&&e.append(`,alpn="${n}"`)}function Mu(e,t=!1){let r=String(e);if(/["\r\n]/.test(r))throw new Error("Unsupported characters in Loon option");return t||!r||/[,\s]/.test(r)?`"${r}"`:r}function xC(e,t){let r=t["xhttp-opts"],n=r?.["download-settings"];if(n?.plugin||n?.["shadow-tls-opts"])throw new Error("Loon XHTTP download-settings do not support plugins");sk(r);let s=r;if(n){let o=Dt(n.server)??Dt(t.server);if(o==null)throw new Error("Loon xhttp-download-server requires a server address");let i=Fs(n.port??t.port);if(i==null||i<1||i>65535)throw new Error("Loon xhttp-download-port must be an integer from 1 to 65535");let a=n["reality-opts"],u=!!Dt(a?.["public-key"]);if(a&&!u)throw new Error("Loon XHTTP download REALITY requires a non-blank public-key");if(u&&[!1,"false"].includes(n.tls))throw new Error("Loon XHTTP download REALITY conflicts with xhttp-download-over-tls=false");let l=fk(n,!0),f=n.fingerprint??n["tls-fingerprint"],m=n["tls-pubkey-sha256"],p=n["skip-cert-verify"];if(u&&(f||m||[!0,"true"].includes(p)))throw new Error("Loon XHTTP download REALITY conflicts with skip-cert-verify=true or TLS certificate fingerprints");s={...r,"download-settings":{...n,server:o.trim(),port:i,host:ok(n),alpn:l||void 0,servername:n.servername??n.sni,fingerprint:u?void 0:f,"tls-pubkey-sha256":u?void 0:m,"skip-cert-verify":u?void 0:p,_loon_tls_profile:dk(n)}}}e.append(",transport=xhttp");for(let[o,i]of[["path",r?.path],["host",ok(r)]])i!=null&&e.append(`,${o}=${Mu(i)}`);for(let[o,i]of Object.entries(B1)){let a=uk.default.get(s,i);a!=null&&e.append(`,xhttp-${o}=${Mu(a)}`)}for(let[o,i]of[["xhttp-header",r?.headers],["xhttp-download-header",n?.headers]])if(Ze(i))for(let[a,u]of Object.entries(i))/^host$/i.test(a)||u==null||e.append(`,${o}=${Mu(`${a}: ${u}`,!0)}`)}function ok(e){if(e?.host!=null)return e.host;if(Ze(e?.headers))return Object.entries(e.headers).find(([t])=>/^host$/i.test(t))?.[1]}function Yne(e){let t=e?.["plugin-opts"]?.alpn??e?.alpn;return(Array.isArray(t)?t:`${t||""}`.split(",")).map(n=>`${n}`.trim()).filter(n=>n!=="").join(",")}function ck(e,t){if(t.plugin!=="shadow-tls"||!t["plugin-opts"])return;let r=t["plugin-opts"].password,n=t["plugin-opts"].host,s=t["plugin-opts"].version;if(!r)return;if(e.append(`,shadow-tls-password=${r}`),n&&e.append(`,shadow-tls-sni=${n}`),s){if(s<2)throw new Error(`shadow-tls version ${s} is not supported`);e.append(`,shadow-tls-version=${s}`)}sl(e,t);let o=Yne(t);o&&e.append(`,alpn="${o}"`),e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function xw(e,t){e.appendIfPresent(`,sni=${t.sni}`,"sni"),e.appendIfPresent(`,public-key="${t["reality-opts"]["public-key"]}"`,"reality-opts.public-key"),e.appendIfPresent(`,short-id=${t["reality-opts"]["short-id"]}`,"reality-opts.short-id")}function lk(e){return(Array.isArray(e.alpn)?e.alpn:`${e.alpn||""}`.split(",")).map(r=>`${r}`.trim()).filter(r=>r!=="").join(",")}function fk(e,t=!1){let r=lk(e);if(!r)return r;if(r.includes(",")){let i=t?" download":"";throw new Error(`Loon XHTTP${i} supports only a single ALPN`)}let n=!!e["reality-opts"]?.["public-key"],s=!t&&e.type==="trojan"||[!0,"true"].includes(e.tls),o=n?["h2"]:s?["http/1.1","h2","h3"]:["http/1.1"];if(!o.includes(r)){let i=t?"xhttp-download-alpn":"XHTTP alpn";throw new Error(`Loon ${i} must be ${o.join(" or ")} for the configured security`)}return r}function dk(e){let t=`${e._loon_tls_profile||""}`.trim();if(["global","default","safari-ios18","safari-ios-26","chrome","chrome147"].includes(t))return t;let r=`${e["client-fingerprint"]||""}`.trim();if(e["reality-opts"]?.["support-x25519mlkem768"])return["safari","ios"].includes(r)?"safari-ios-26":"chrome147";switch(r){case"chrome":return"chrome";case"safari":case"ios":return"safari-ios18"}}function Wne(e){let t=new Je(e);if(!["rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","salsa20","chacha20","chacha20-ietf","aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(t.append(`${e.name}=shadowsocks,${e.server},${e.port},${e.cipher},"${e.password}"`),fe(e,"plugin")){if(e.plugin==="obfs")t.append(`,obfs-name=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else if(!["shadow-tls"].includes(e.plugin))throw new Error(`plugin ${e.plugin} is not supported`)}ck(t,e),e["udp-over-tcp"]&&(e["udp-over-tcp-version"]===2?e.plugin==="obfs"?R.error(`Platform ${I1} shadowsocks udp-over-tcp does not support obfs`):t.append(",udp-over-tcp=true"):R.error(`Platform ${I1} shadowsocks only supports udp-over-tcp-version 2`)),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Ci[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function Xne(e){let t=new Je(e);t.append(`${e.name}=shadowsocksr,${e.server},${e.port},${e.cipher},"${e.password}"`),t.append(`,protocol=${e.protocol}`),t.appendIfPresent(`,protocol-param=${e["protocol-param"]}`,"protocol-param"),t.appendIfPresent(`,obfs=${e.obfs}`,"obfs"),t.appendIfPresent(`,obfs-param=${e["obfs-param"]}`,"obfs-param"),ck(t,e),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Ci[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function Jne(e){let t=Number(e.version);if(![4,5].includes(t))throw new Error(`Loon does not support Snell version ${e.version??1}`);if(e.psk==null||e.psk==="")throw new Error("Missing Snell PSK");let r=e["obfs-opts"];if(e.plugin||r?.mode&&!["none","http"].includes(r.mode))throw new Error("Loon Snell only supports HTTP obfs");let n=new Je(e);n.append(`${e.name}=snell,${e.server},${e.port},${Mu(e.psk,!0)},version=${t}`),r?.mode==="http"&&(n.append(",obfs=http"),r.host!=null&&n.append(`,obfs-host=${Mu(r.host)}`),r.path!=null&&n.append(`,obfs-uri=${Mu(r.path)}`)),n.appendIfPresent(`,udp=${e.udp}`,"udp");let s=e["block-quic"];(s==="on"||s==="off")&&n.append(`,block-quic=${s==="on"}`);let o=Ci[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${o}`,"ip-version"),n.toString()}function Zne(e){let t=!!e["reality-opts"],r=e.network==="xhttp",n=new Je(e);if(n.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,fe(e,"network"))if(e.network==="ws")n.append(",transport=ws"),n.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),n.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(r)xC(n,e);else throw new Error(`network ${e.network} is unsupported`);n.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),sl(n,e),Bf(n,e,r),t?xw(n,e):(n.appendIfPresent(`,${r?"sni":"tls-name"}=${e.sni}`,"sni"),n.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),n.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?n.append(",block-quic=true"):e["block-quic"]==="off"&&n.append(",block-quic=false"),e.udp&&n.append(",udp=true");let s=Ci[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${s}`,"ip-version"),n.toString()}function Qne(e){let t=!!e["reality-opts"],r=new Je(e);r.append(`${e.name}=anytls,${e.server},${e.port},"${e.password}"`);for(let s of["idle-session-timeout","max-stream-count"])fe(e,s)&&Number.isInteger(e[s])&&r.append(`,${s}=${e[s]}`);r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),sl(r,e),Bf(r,e),t?xw(r,e):(r.appendIfPresent(`,tls-name=${e.sni}`,"sni"),r.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),r.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),r.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?r.append(",block-quic=true"):e["block-quic"]==="off"&&r.append(",block-quic=false"),e.udp&&r.append(",udp=true");let n=Ci[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${n}`,"ip-version"),r.toString()}function ese(e){let t=!!e["reality-opts"],r=e.network==="xhttp",n=U7(e.cipher),s=new Je(e);if(s.append(`${e.name}=vmess,${e.server},${e.port},${n},"${e.uuid}"`),e.network==="tcp"&&delete e.network,fe(e,"network"))if(e.network==="ws")s.append(",transport=ws"),s.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),s.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){s.append(",transport=http");let a=e["http-opts"]?.path,u=e["http-opts"]?.headers?.Host;s.appendIfPresent(`,path=${Array.isArray(a)?a[0]:a}`,"http-opts.path"),s.appendIfPresent(`,host=${Array.isArray(u)?u[0]:u}`,"http-opts.headers.Host")}else if(r)xC(s,e);else throw new Error(`network ${e.network} is unsupported`);else s.append(",transport=tcp");s.appendIfPresent(`,over-tls=${e.tls}`,"tls"),s.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),(e.tls||t)&&sl(s,e),(e.tls||t||r)&&Bf(s,e,r),t?xw(s,e):(s.appendIfPresent(`,${r?"sni":"tls-name"}=${e.sni}`,"sni"),s.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),s.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"));let o=e.alterId;if(fe(e,"aead")&&(o=e.aead?0:1),r&&(o??=0,Number(o)!==0))throw new Error("VMess XHTTP requires AEAD");s.append(`,alterId=${o}`),s.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?s.append(",block-quic=true"):e["block-quic"]==="off"&&s.append(",block-quic=false"),e.udp&&s.append(",udp=true");let i=Ci[e["ip-version"]]||e["ip-version"];return s.appendIfPresent(`,ip-mode=${i}`,"ip-version"),s.toString()}function tse(e,t){if(!t||t==="none")return;let[r,n,s,...o]=t.split("."),i=/^(-?\d+)-(-?\d+)-(-?\d+)$/,a=o.findIndex(f=>!i.test(f));if(r!=="mlkem768x25519plus"||!["native","xorpub","random"].includes(n)||!["0rtt","1rtt"].includes(s)||!o[a])throw new Error("Unsupported VLESS encryption format");let u=o.slice(0,a);for(let[f,m]of u.entries()){let[,p,d,v]=i.exec(m).map(Number);if(f===0&&(p!==100||d<35||v<35))throw new Error("Loon VLESS encryption-padding first group requires probability 100 and lengths of at least 35");if(p<0||p>100||d<0||d>v||!Number.isSafeInteger(v))throw new Error("Loon VLESS encryption-padding requires probabilities from 0 to 100 and ordered non-negative integer bounds")}let l=o.slice(a).join(".");e.append(`,encryption-mode=${n},encryption-rtt=${s}`),e.append(`,encryption-public-keys=${Mu(l)}`),u.length&&e.append(`,encryption-padding=${Mu(u.join("."))}`)}function rse(e){let t=!!e.flow,r=e["reality-opts"],n=!!Dt(r?.["public-key"]),s=e.network==="xhttp",o=(e.network??"tcp")==="tcp",i=n||[!0,"true"].includes(e.tls),a=e.encryption&&e.encryption!=="none";if(r&&!n)throw new Error("Loon VLESS REALITY requires a non-blank public-key");if(t&&!["xtls-rprx-vision","xtls-rprx-vision-udp443"].includes(e.flow))throw new Error(`VLESS flow(${e.flow}) is not supported`);if(t&&!a&&(!o||!i))throw new Error("Loon VLESS Vision without encryption requires TCP with TLS or REALITY");let u=new Je(e);if(u.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,fe(e,"network"))if(e.network==="ws")u.append(",transport=ws"),u.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),u.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){u.append(",transport=http");let f=e["http-opts"]?.path,m=e["http-opts"]?.headers?.Host;u.appendIfPresent(`,path=${Array.isArray(f)?f[0]:f}`,"http-opts.path"),u.appendIfPresent(`,host=${Array.isArray(m)?m[0]:m}`,"http-opts.headers.Host")}else if(s)xC(u,e);else throw new Error(`network ${e.network} is unsupported`);else u.append(",transport=tcp");u.appendIfPresent(`,over-tls=${e.tls}`,"tls"),u.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),(e.tls||n||t)&&sl(u,e),(e.tls||n||t||s)&&Bf(u,e,s),tse(u,e.encryption),t&&u.append(`,flow=${e.flow}`),n?xw(u,e):(u.appendIfPresent(`,${s?"sni":"tls-name"}=${e.sni}`,"sni"),u.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),u.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),u.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?u.append(",block-quic=true"):e["block-quic"]==="off"&&u.append(",block-quic=false"),e.udp&&u.append(",udp=true");let l=Ci[e["ip-version"]]||e["ip-version"];return u.appendIfPresent(`,ip-mode=${l}`,"ip-version"),u.toString()}function nse(e){let t=new Je(e),r=e.tls?"https":"http";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e.tls&&(sl(t,e),Bf(t,e)),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false");let n=Ci[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function sse(e){let t=new Je(e);t.append(`${e.name}=socks5,${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,over-tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e.tls&&(sl(t,e),Bf(t,e)),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Ci[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function ise(e){let t=new Je(e);t.append(`${e.name}=tailscale`);let r=e["exit-node"];r==="auto:any"&&(r="auto"),r===""&&(r="none");let n={"control-url":e["control-url"],"auth-key":e["auth-key"],hostname:e.hostname,"exit-node":r};for(let[i,a]of Object.entries(n)){if(!a)continue;let u=i==="control-url"||i==="auth-key"||/[,\s]/.test(a);t.append(`,${i}=${u?`"${a}"`:a}`)}for(let i of["accept-routes","accept-dns","magic-dns","path-mode","mtu","idle-session-timeout","udp"])t.appendIfPresent(`,${i}=${e[i]}`,i);let s=Ci[e["ip-version"]]||e["ip-version"];t.appendIfPresent(`,ip-mode=${s}`,"ip-version");let o=e["block-quic"];return(o==="on"||o==="off")&&t.append(`,block-quic=${o==="on"}`),t.toString()}function ose(e){Array.isArray(e.peers)&&e.peers.length>0&&(e.server=e.peers[0].server,e.port=e.peers[0].port,e.ip=e.peers[0].ip,e.ipv6=e.peers[0].ipv6,e["public-key"]=e.peers[0]["public-key"],e["preshared-key"]=e.peers[0]["pre-shared-key"],e["allowed-ips"]=e.peers[0]["allowed-ips"],e.reserved=e.peers[0].reserved);let t=new Je(e);if(t.append(`${e.name}=wireguard`),t.appendIfPresent(`,interface-ip=${e.ip}`,"ip"),t.appendIfPresent(`,interface-ipv6=${e.ipv6}`,"ipv6"),t.appendIfPresent(`,private-key="${e["private-key"]}"`,"private-key"),t.appendIfPresent(`,mtu=${e.mtu}`,"mtu"),e.dns&&Array.isArray(e.dns)){e.dnsv6=e.dns.find(a=>lr(a));let i=e.dns.find(a=>Ur(a));i||(i=e.dns.find(a=>!Ur(a)&&!lr(a))),e.dns=i}t.appendIfPresent(`,dns=${e.dns}`,"dns"),t.appendIfPresent(`,dnsv6=${e.dnsv6}`,"dnsv6"),t.appendIfPresent(`,keepalive=${e["persistent-keepalive"]}`,"persistent-keepalive"),t.appendIfPresent(`,keepalive=${e.keepalive}`,"keepalive");let r=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],n=Array.isArray(e.reserved)?e.reserved.join(","):e.reserved;n&&(n=`,reserved=[${n}]`);let s=e["preshared-key"]??e["pre-shared-key"];s&&(s=`,preshared-key="${s}"`),t.append(`,peers=[{public-key="${e["public-key"]}",allowed-ips="${r??"0.0.0.0/0,::/0"}",endpoint=${e.server}:${e.port}${n??""}${s??""}}]`);let o=Ci[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${o}`,"ip-version"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),t.toString()}function ase(e){if(e.transport&&String(e.transport).toUpperCase()!=="TCP")throw new Error("Loon Mieru requires TCP transport");if(e.tls||e["reality-opts"])throw new Error("Loon Mieru does not support TLS or REALITY");let t=Dt(e.server)?.trim();if(!t)throw new Error("Loon Mieru requires a server");let r=String(e.port??"").trim(),n=Number(r);if(!/^\d+$/.test(r)||n<1||n>65535)throw new Error("Loon Mieru port must be an integer from 1 to 65535");let s=[e.username,e.password].map(m=>String(m??""));if(s.some(m=>!m||ak.Buffer.byteLength(m,"utf8")>64))throw new Error("Loon Mieru username and password must each be 1-64 UTF-8 bytes");let o=new Je(e),i=lr(t)?`[${t}]`:t,[a,u]=s.map(m=>Mu(m,!0));o.append(`${e.name}=mieru,${i},${n},${a},${u}`),e.udp&&o.append(",udp=true");let l=e["block-quic"];["on","off",!0,!1].includes(l)&&o.append(`,block-quic=${l==="on"||l===!0}`);let f=Ci[e["ip-version"]]||e["ip-version"];return o.appendIfPresent(`,ip-mode=${f}`,"ip-version"),o.toString()}function use(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new Je(e);t.append(`${e.name}=Hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,"${e.password}"`,"password"),fe(e,"ports")&&`${e.ports}`.trim().length>0&&t.append(`,server-ports="${e.ports}"`),fe(e,"hop-interval")&&`${e["hop-interval"]}`.trim().length>0&&t.append(`,hop-interval=${e["hop-interval"]}`),t.appendIfPresent(`,tls-name=${e.sni}`,"sni"),t.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),sl(t,e),Bf(t,e),e["obfs-password"]&&e.obfs=="salamander"&&t.append(`,salamander-password=${e["obfs-password"]}`),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true"),t.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),[!0,"true","on"].includes(e.ecn)?t.append(",ecn=true"):[!1,"false","off"].includes(e.ecn)&&t.append(",ecn=false");let r=Ci[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}var ECe,ak,uk,I1,Ci,hk=re(()=>{ECe=F(I()),ak=F(iu()),uk=F(ho());ei();Ir();gt();IC();Si();Ih();I1="Loon",Ci={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"}});function cse(e,{excludeHost:t=!1}={}){if(!Ze(e))return;let r={};for(let[n,s]of Object.entries(e))typeof s=="string"&&(t&&/^host$/i.test(n)||(r[n]=s));return Object.keys(r).length>0?r:void 0}function lse(e,t){let r=Tw(e?.["_v2ray-http-upgrade-ed"]);if(r!=="")return r;let n=Tw(ti(t||"/","ed").value);return n!==""?n:2560}function Rw(e,t){return t?.["v2ray-http-upgrade-fast-open"]?SC(e||"/","ed",lse(t,e)):e}function RC(e,t){let r=t?.["max-early-data"],n=Tw(r);if(n==="")return r!=null&&`${r}`!=""?e==null?e:ti(e,"ed").path:e;let s=t?.["early-data-header-name"];return s&&s!=="Sec-WebSocket-Protocol"?e==null?e:ti(e,"ed").path:SC(e||"/","ed",n)}function Tw(e){return e==null||`${e}`==""||Yi(e)==null?"":`${e}`}function fse(e){return Fs(e)}function dse(e){return Ai(e)}function pk({defaultDns:e,dnsFieldPath:t,echOptsPath:r,proxyName:n,queryServerName:s}){let o=n||"\u672A\u547D\u540D\u8282\u70B9";R.warn(`URI ECH: \u8282\u70B9 "${o}" \u7684 ${r} \u5DF2\u5F00\u542F\u4E14\u8BBE\u7F6E query-server-name="${s}", \u4F46\u672A\u8BBE\u7F6E ${t}; \u5DF2\u4F7F\u7528\u9ED8\u8BA4 DNS ${e}. \u5982\u9700\u81EA\u5B9A\u4E49, \u8BF7\u8BBE\u7F6E ${t}.`)}function kw(e,t={}){return e==="h2"?t.host??t.headers?.host??t.headers?.Host:e==="xhttp"?t.host??t.headers?.Host??t.headers?.host:t.headers?.Host??t.headers?.host??t.host}function hse(e){if(!Ze(e))return;let t={},r={"max-connections":"maxConnections","max-concurrency":"maxConcurrency","c-max-reuse-times":"cMaxReuseTimes","h-max-request-times":"hMaxRequestTimes","h-max-reusable-secs":"hMaxReusableSecs"};for(let[s,o]of Object.entries(r)){let i=Ai(e[s]);i!=null&&(t[o]=typeof i=="number"?`${i}`:i)}let n=fse(e["h-keep-alive-period"]);return n!=null&&(t.hKeepAlivePeriod=n),Object.keys(t).length>0?t:void 0}function mk(e,t,{excludeHostHeader:r=!0,xmuxTarget:n="root"}={}){if(!Ze(e)||!Ze(t))return;let s=cse(t.headers,{excludeHost:r});if(s&&(e.headers=s),t["no-grpc-header"]===!0&&(e.noGRPCHeader=!0),t["x-padding-bytes"]&&(e.xPaddingBytes=t["x-padding-bytes"]),t["x-padding-obfs-mode"]===!0&&(e.xPaddingObfsMode=!0),t["x-padding-key"]&&(e.xPaddingKey=t["x-padding-key"]),t["x-padding-header"]&&(e.xPaddingHeader=t["x-padding-header"]),t["x-padding-placement"]&&(e.xPaddingPlacement=t["x-padding-placement"]),t["x-padding-method"]&&(e.xPaddingMethod=t["x-padding-method"]),t["uplink-http-method"]&&(e.uplinkHTTPMethod=t["uplink-http-method"]),t["session-placement"]&&(e.sessionIDPlacement=t["session-placement"]),t["session-key"]&&(e.sessionIDKey=t["session-key"]),typeof t["session-table"]=="string"&&(e.sessionIDTable=t["session-table"]),t["session-length"]!=null){let a=Cf(t["session-length"]);a!=null&&(e.sessionIDLength=a)}t["seq-placement"]&&(e.seqPlacement=t["seq-placement"]),t["seq-key"]&&(e.seqKey=t["seq-key"]),t["uplink-data-placement"]&&(e.uplinkDataPlacement=t["uplink-data-placement"]),t["uplink-data-key"]&&(e.uplinkDataKey=t["uplink-data-key"]);let o=dse(t["uplink-chunk-size"]);if(o!=null&&(e.uplinkChunkSize=o),t["sc-max-each-post-bytes"]!=null){let a=Cf(t["sc-max-each-post-bytes"]);a!=null&&(e.scMaxEachPostBytes=a)}if(t["sc-min-posts-interval-ms"]!=null){let a=Ta(t["sc-min-posts-interval-ms"]);a!=null&&(e.scMinPostsIntervalMs=a)}let i=hse(t["reuse-settings"]);i&&(n==="extra"?e.extra={...Ze(e.extra)?e.extra:{},xmux:i}:e.xmux=i)}function pse(e,t={},r={}){if(!Ze(e))return;let n=typeof e.network=="string"?e.network.toLowerCase():"",s=n==="xhttp"||n==="splithttp"?"xhttp":void 0,o={};e.server&&(o.address=e.server);let i=Fs(e.port,{allowNegative:!1});i!=null&&(o.port=i);let a=Ze(e["reality-opts"])?e["reality-opts"]:void 0;a?o.security="reality":e.tls&&(o.security="tls");let u={};e.servername&&(u.serverName=e.servername),e["client-fingerprint"]&&(u.fingerprint=e["client-fingerprint"]),e["skip-cert-verify"]&&(u.allowInsecure=!0),e.alpn&&(u.alpn=Array.isArray(e.alpn)?e.alpn:[e.alpn]);let l=dC(e["ech-opts"],void 0,{dnsFieldPath:"xhttp-opts.download-settings.ech-opts._dns",warnDefaultDns:v=>pk({...v,echOptsPath:"xhttp-opts.download-settings.ech-opts",proxyName:r.name})});if(l.echConfigList&&(u.echConfigList=l.echConfigList),l.echForceQuery&&(u.echForceQuery=l.echForceQuery),l.echSockopt&&(u.echSockopt=il(l.echSockopt)),Object.keys(u).length>0&&(o.tlsSettings=u),a){let v={};e.servername&&(v.serverName=e.servername),e["client-fingerprint"]&&(v.fingerprint=e["client-fingerprint"]),a["public-key"]&&(v.publicKey=a["public-key"]),a["short-id"]&&(v.shortId=a["short-id"]),Object.keys(v).length>0&&(o.realitySettings=v)}let f={},m=e.path??t.path;m&&(f.path=m);let p=kw("xhttp",e)??kw("xhttp",t);p&&(f.host=p);let d=e.mode??t.mode;if(d&&(f.mode=d),mk(f,e,{excludeHostHeader:!0,xmuxTarget:"extra"}),Object.keys(f).length>0&&(o.xhttpSettings=f),!(Object.keys(o).length===0&&s==null))return{...o.address!=null?{address:o.address}:{},network:s||"xhttp",...o.port!=null?{port:o.port}:{},...o.security!=null?{security:o.security}:{},...o.tlsSettings!=null?{tlsSettings:o.tlsSettings}:{},...o.realitySettings!=null?{realitySettings:o.realitySettings}:{},...o.xhttpSettings!=null?{xhttpSettings:o.xhttpSettings}:{}}}function mse(e){let t=e["xhttp-opts"]||{},r={};mk(r,t,{excludeHostHeader:!0,xmuxTarget:"root"});let n=pse(t["download-settings"],t,e);return n&&(r.downloadSettings=n),Object.keys(r).length>0?r:void 0}function il(e){if(Array.isArray(e))return e.map(il);if(Ze(e)){let t={};for(let[r,n]of Object.entries(e))t[r]=il(n);return t}return e}function gse(e,t){return e==null?il(t):Array.isArray(e)||Array.isArray(t)?il(e):Ze(e)&&Ze(t)?gk(e,t):il(e)}function gk(e,t){let r=Ze(e)?il(e):{};if(!Ze(t))return r;for(let[n,s]of Object.entries(t)){if(!Object.prototype.hasOwnProperty.call(r,n)){r[n]=il(s);continue}r[n]=gse(r[n],s)}return r}function vk(e){if(typeof e=="string")return e;if(Ze(e))return JSON.stringify(e)}function vse(e){let t=vk(e._extra);if(t!=null)return t;if(e.network!=="xhttp")return e._extra||"";let r=mse(e),n=gk(r,e._extra_unsupported);return Object.keys(n).length>0?JSON.stringify(n):""}function TC(e){let t="none",r=e["reality-opts"],n="",s="",o="";if(r){t="reality";let G=e["reality-opts"]?.["public-key"];if(G){s=`&pbk=${encodeURIComponent(G)}`;let ie=e["reality-opts"]["support-x25519mlkem768"];ie&&(s+=`&support-x25519mlkem768=${encodeURIComponent(ie)}`)}let J=e["reality-opts"]?.["short-id"];J&&(n=`&sid=${encodeURIComponent(J)}`);let te=e["reality-opts"]?.["_spider-x"];te&&(o=`&spx=${encodeURIComponent(te)}`)}else e.tls&&(t="tls");let i="";e.alpn&&(i=`&alpn=${encodeURIComponent(Array.isArray(e.alpn)?e.alpn:e.alpn.join(","))}`);let a="";e["skip-cert-verify"]&&(a="&allowInsecure=1");let u="";e._h2&&(u="&h2=1");let l="";e["tls-fingerprint"]&&(l=`&pcs=${encodeURIComponent(e["tls-fingerprint"])}`);let f="",m=Array.isArray(e._vcn)?e._vcn.join(","):e["name-cert-verify"];(Array.isArray(e._vcn)||m)&&(f=`&vcn=${encodeURIComponent(m)}`);let p="",d=hC(e["ech-opts"],e._echConfigList,{dnsFieldPath:"ech-opts._dns",warnDefaultDns:G=>pk({...G,echOptsPath:"ech-opts",proxyName:e.name})});d&&(p=`&ech=${encodeURIComponent(d)}`);let v="";e.sni&&(v=`&sni=${encodeURIComponent(e.sni)}`);let g="";e["client-fingerprint"]&&(g=`&fp=${encodeURIComponent(e["client-fingerprint"])}`);let y="";e.flow&&(y=`&flow=${encodeURIComponent(e.flow)}`);let w="",E=vse(e);E&&(w=`&extra=${encodeURIComponent(E)}`);let S="",C=vk(e._finalmask);C&&(S=`&fm=${encodeURIComponent(C)}`);let D="";["xhttp"].includes(e.network)&&e[`${e.network}-opts`]?.mode?D=`&mode=${encodeURIComponent(e[`${e.network}-opts`].mode)}`:e._mode&&(D=`&mode=${encodeURIComponent(e._mode)}`);let H="";e._pqv&&(H=`&pqv=${encodeURIComponent(e._pqv)}`);let K="";e.encryption&&(K=`&encryption=${encodeURIComponent(e.encryption)}`);let _=e.network;e.network==="ws"&&e["ws-opts"]?.["v2ray-http-upgrade"]?_="httpupgrade":e.network==="http"?_="tcp":e.network==="h2"&&(_="http");let x=`&type=${encodeURIComponent(_)}`;if(e.network==="http"&&(x+="&headerType=http"),["grpc"].includes(e.network)){x+=`&mode=${encodeURIComponent(e[`${e.network}-opts`]?.["_grpc-type"]||"gun")}`;let G=e[`${e.network}-opts`]?.["_grpc-authority"];G&&(x+=`&authority=${encodeURIComponent(G)}`)}let j=e[`${e.network}-opts`]||{},U=e.network==="ws"&&j?.["v2ray-http-upgrade"],k=j?.[`${e.network}-service-name`],N=j?.path,O=kw(e.network,j),L=Tw(e["ws-opts"]?.["max-early-data"]);Array.isArray(N)&&(N=N[0]),U&&j?.["v2ray-http-upgrade-fast-open"]?N=Rw(N,j):e.network==="ws"&&e["ws-opts"]?.["max-early-data"]!=null&&N&&(N=ti(N,"ed").path),N&&(x+=`&path=${encodeURIComponent(N)}`),O&&(x+=`&host=${encodeURIComponent(Array.isArray(O)?O[0]:O)}`),k&&(x+=`&serviceName=${encodeURIComponent(k)}`),e.network==="http"&&e["http-opts"]?.method&&(x+=`&method=${encodeURIComponent(e["http-opts"].method)}`),e.network==="kcp"&&(e.seed&&(x+=`&seed=${encodeURIComponent(e.seed)}`),e.headerType&&(x+=`&headerType=${encodeURIComponent(e.headerType)}`)),e.network==="ws"&&!U&&L!==""&&(x+=`&ed=${encodeURIComponent(L)}`);let T=e["ws-opts"]?.["early-data-header-name"];T&&(U||e["ws-opts"]?.["max-early-data"]==null||T!=="Sec-WebSocket-Protocol")&&(x+=`&eh=${encodeURIComponent(T)}`);let M="",W;switch(e["packet-encoding"]!=null?W=`${e["packet-encoding"]}`.trim().toLowerCase():e.xudp?W="xudp":e["packet-addr"]?W="packetaddr":e.udp===!0&&(W=""),W){case"":M="&packetEncoding=none";break;case"packetaddr":M="&packetEncoding=packet";break;case"xudp":M="&packetEncoding=xudp";break}return`vless://${e.uuid}@${e.server}:${e.port}?security=${encodeURIComponent(t)}${x}${M}${i}${a}${l}${f}${p}${u}${v}${g}${y}${n}${o}${s}${D}${w}${S}${H}${K}#${encodeURIComponent(e.name)}`}function kh(){return{type:"SINGLE",produce:r=>{let n="";delete r.subName,delete r.collectionName,delete r.id,delete r.resolved,delete r["no-resolve"];for(let s in r)r[s]==null&&delete r[s];switch(["tuic","hysteria","hysteria2","juicity","trusttunnel"].includes(r.type)&&delete r.tls,!["vmess"].includes(r.type)&&r.server&&lr(r.server)&&(r.server=`[${r.server}]`),r.type){case"socks5":n=`socks://${encodeURIComponent(mt.encode(`${r.username??""}:${r.password??""}`))}@${r.server}:${r.port}#${r.name}`;break;case"ss":let s=`${r.cipher}:${r.password}`;n=`ss://${r.cipher?.startsWith("2022-blake3-")?`${encodeURIComponent(r.cipher)}:${encodeURIComponent(r.password)}`:mt.encode(s)}@${r.server}:${r.port}${r.plugin?"/":""}`;let o="";if(r.plugin){o+="&plugin=";let oe=r["plugin-opts"];switch(r.plugin){case"obfs":o+=encodeURIComponent(`simple-obfs;obfs=${oe.mode}${oe.host?";obfs-host="+oe.host:""}`);break;case"v2ray-plugin":let me=_1(oe.mux);o+=encodeURIComponent(`v2ray-plugin;obfs=${oe.mode};mode=${oe.mode}${oe.host?";obfs-host="+oe.host:""}${oe.host?";host="+oe.host:""}${oe.path?";path="+oe.path:""}${oe.tls?";tls":""}${oe.sni?";sni="+oe.sni:""}${oe["skip-cert-verify"]?";skip-cert-verify="+oe["skip-cert-verify"]:""}${me!=null?";mux="+me:""}`);break;case"shadow-tls":o+=encodeURIComponent(`shadow-tls;host=${oe.host};password=${oe.password};version=${oe.version}`);break;default:throw new Error(`Unsupported plugin option: ${r.plugin}`)}}r["udp-over-tcp"]&&(o+="&uot=1"),r.tfo&&(o+="&tfo=1"),o+=`&udp=${r.udp?1:0}`;let i="";if(r.network){let oe=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(oe="httpupgrade"),i=`&type=${encodeURIComponent(oe)}`,["grpc"].includes(r.network)){let He=r[`${r.network}-opts`]?.[`${r.network}-service-name`],St=r[`${r.network}-opts`]?.["_grpc-authority"];He&&(i+=`&serviceName=${encodeURIComponent(He)}`),St&&(i+=`&authority=${encodeURIComponent(St)}`),i+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let me=r[`${r.network}-opts`]||{},Be=r.network==="ws"&&me?.["v2ray-http-upgrade"],Ue=me?.path,We=me?.headers?.Host;Array.isArray(Ue)&&(Ue=Ue[0]),Be?Ue=Rw(Ue,me):r.network==="ws"&&(Ue=RC(Ue,me)),Ue&&(i+=`&path=${encodeURIComponent(Ue)}`),We&&(i+=`&host=${encodeURIComponent(Array.isArray(We)?We[0]:We)}`)}let a="";r["client-fingerprint"]&&(a=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let u="";r.alpn&&(u=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let l=r["reality-opts"],f="",m="",p="",d=r.tls?"&security=tls":"",v="",g=r._extra&&(l||r.network==="xhttp")?`&extra=${encodeURIComponent(r._extra)}`:"";if(l){d="&security=reality";let oe=r["reality-opts"]?.["public-key"];oe&&(m=`&pbk=${encodeURIComponent(oe)}`);let me=r["reality-opts"]?.["short-id"];me&&(f=`&sid=${encodeURIComponent(me)}`);let Be=r["reality-opts"]?.["_spider-x"];Be&&(p=`&spx=${encodeURIComponent(Be)}`),r._mode&&(v=`&mode=${encodeURIComponent(r._mode)}`)}r.tls&&(o+=`&sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}`),o+=`${i}${u}${a}${d}${f}${m}${p}${v}${g}#${encodeURIComponent(r.name)}`,n+=o.replace(/^&/,"?");break;case"ssr":n=`${r.server}:${r.port}:${r.protocol}:${r.cipher}:${r.obfs}:${mt.encode(r.password)}/`,n+=`?remarks=${mt.encode(r.name)}${r["obfs-param"]?"&obfsparam="+mt.encode(r["obfs-param"]):""}${r["protocol-param"]?"&protoparam="+mt.encode(r["protocol-param"]):""}`,n="ssr://"+mt.encode(n);break;case"vmess":if(r["reality-opts"]||r._finalmask){if(r.aead===!1||r.aead!==!0&&Number(r.alterId||0)!==0)throw new Error("VMess query URI format cannot represent non-AEAD authentication (alterId must be 0)");n=TC({...r,server:lr(r.server)?`[${r.server}]`:r.server,network:r.network||"tcp",encryption:cn(r.cipher),flow:void 0}).replace(/^vless:\/\//,"vmess://");break}let y="",w=r.network||"tcp";if(r.network==="http"?(w="tcp",y="http"):r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(w="httpupgrade"),n={v:"2",ps:r.name,add:r.server,port:`${r.port}`,id:r.uuid,aid:`${r.alterId||0}`,scy:cn(r.cipher),net:w,type:y,tls:r.tls?"tls":"",alpn:Array.isArray(r.alpn)?r.alpn.join(","):r.alpn,fp:r["client-fingerprint"]},r.tls&&r.sni&&(n.sni=r.sni),r.network){let oe=r[`${r.network}-opts`]||{},me=r.network==="ws"&&oe?.["v2ray-http-upgrade"],Be=oe?.path,Ue=kw(r.network,oe);["grpc"].includes(r.network)?(n.path=r[`${r.network}-opts`]?.["grpc-service-name"],n.type=r[`${r.network}-opts`]?.["_grpc-type"]||"gun",n.host=r[`${r.network}-opts`]?.["_grpc-authority"]):["kcp","quic"].includes(r.network)?(n.type=r[`${r.network}-opts`]?.[`_${r.network}-type`]||"none",n.host=r[`${r.network}-opts`]?.[`_${r.network}-host`],n.path=r[`${r.network}-opts`]?.[`_${r.network}-path`]):(Array.isArray(Be)&&(Be=Be[0]),me?Be=Rw(Be,oe):r.network==="ws"&&(Be=RC(Be,oe)),Be&&(n.path=Be),Ue&&(n.host=Array.isArray(Ue)?r.network==="h2"?Ue.join(","):Ue[0]:Ue))}n="vmess://"+mt.encode(JSON.stringify(n));break;case"vless":n=TC(r);break;case"trojan":let E="";if(r.network){let oe=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(oe="httpupgrade"),E=`&type=${encodeURIComponent(oe)}`,["grpc"].includes(r.network)){let He=r[`${r.network}-opts`]?.[`${r.network}-service-name`],St=r[`${r.network}-opts`]?.["_grpc-authority"];He&&(E+=`&serviceName=${encodeURIComponent(He)}`),St&&(E+=`&authority=${encodeURIComponent(St)}`),E+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let me=r[`${r.network}-opts`]||{},Be=r.network==="ws"&&me?.["v2ray-http-upgrade"],Ue=me?.path,We=me?.headers?.Host;Array.isArray(Ue)&&(Ue=Ue[0]),Be?Ue=Rw(Ue,me):r.network==="ws"&&(Ue=RC(Ue,me)),Ue&&(E+=`&path=${encodeURIComponent(Ue)}`),We&&(E+=`&host=${encodeURIComponent(Array.isArray(We)?We[0]:We)}`)}let S="";r["client-fingerprint"]&&(S=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let C="";r["tls-fingerprint"]&&(C=`&pcs=${encodeURIComponent(r["tls-fingerprint"])}`);let D="",H=Array.isArray(r._vcn)?r._vcn.join(","):r["name-cert-verify"];(Array.isArray(r._vcn)||H)&&(D=`&vcn=${encodeURIComponent(H)}`);let K="";r.alpn&&(K=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let _=r["reality-opts"],x="",j="",U="",k="",N="",O="";if(_){k="&security=reality";let oe=r["reality-opts"]?.["public-key"];oe&&(j=`&pbk=${encodeURIComponent(oe)}`);let me=r["reality-opts"]?.["short-id"];me&&(x=`&sid=${encodeURIComponent(me)}`);let Be=r["reality-opts"]?.["_spider-x"];Be&&(U=`&spx=${encodeURIComponent(Be)}`),r._extra&&(O=`&extra=${encodeURIComponent(r._extra)}`),r._mode&&(N=`&mode=${encodeURIComponent(r._mode)}`)}n=`trojan://${encodeURIComponent(r.password)}@${r.server}:${r.port}?sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}${E}${K}${S}${C}${D}${k}${x}${j}${U}${N}${O}#${encodeURIComponent(r.name)}`;break;case"hysteria2":let L=[];r["hop-interval"]&&L.push(`hop-interval=${r["hop-interval"]}`),r.keepalive&&L.push(`keepalive=${r.keepalive}`),r["skip-cert-verify"]&&L.push("insecure=1"),r.obfs&&(L.push(`obfs=${encodeURIComponent(r.obfs)}`),r["obfs-password"]&&L.push(`obfs-password=${encodeURIComponent(r["obfs-password"])}`)),r.sni&&L.push(`sni=${encodeURIComponent(r.sni)}`),r.ports&&L.push(`mport=${r.ports}`),r["tls-fingerprint"]&&L.push(`pinSHA256=${encodeURIComponent(r["tls-fingerprint"])}`),r.tfo&&L.push("fastopen=1");let T=hC(r["ech-opts"]);T&&L.push(`ech=${encodeURIComponent(T)}`),n=`hysteria2://${encodeURIComponent(r.password)}@${r.server}:${r.port}?${L.join("&")}#${encodeURIComponent(r.name)}`;break;case"hysteria":let M=[];Object.keys(r).forEach(oe=>{if(!["name","type","server","port"].includes(oe)){let me=oe.replace(/-/,"_");["alpn"].includes(oe)?r[oe]&&M.push(`${me}=${encodeURIComponent(Array.isArray(r[oe])?r[oe][0]:r[oe])}`):["skip-cert-verify"].includes(oe)?r[oe]&&M.push("insecure=1"):["tfo","fast-open"].includes(oe)?r[oe]&&!M.includes("fastopen=1")&&M.push("fastopen=1"):["ports"].includes(oe)?M.push(`mport=${r[oe]}`):["auth-str"].includes(oe)?M.push(`auth=${r[oe]}`):["up"].includes(oe)?M.push(`upmbps=${r[oe]}`):["down"].includes(oe)?M.push(`downmbps=${r[oe]}`):["_obfs"].includes(oe)?M.push(`obfs=${r[oe]}`):["obfs"].includes(oe)?M.push(`obfsParam=${r[oe]}`):["sni"].includes(oe)?M.push(`peer=${r[oe]}`):r[oe]&&!/^_/i.test(oe)&&M.push(`${me}=${encodeURIComponent(r[oe])}`)}}),n=`hysteria://${r.server}:${r.port}?${M.join("&")}#${encodeURIComponent(r.name)}`;break;case"tuic":if(!r.token||r.token.length===0){let oe=[];Object.keys(r).forEach(me=>{if(!["name","type","uuid","password","server","port","tls"].includes(me)){let Be=me.replace(/-/,"_");["alpn"].includes(me)?r[me]&&oe.push(`${Be}=${encodeURIComponent(Array.isArray(r[me])?r[me][0]:r[me])}`):["skip-cert-verify"].includes(me)?r[me]&&oe.push("allow_insecure=1"):["tfo","fast-open"].includes(me)?r[me]&&!oe.includes("fast_open=1")&&oe.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(me)&&r[me]?oe.push(`${Be.replace(/-/g,"_")}=1`):["congestion-controller"].includes(me)?oe.push(`congestion_control=${r[me]}`):r[me]&&!/^_/i.test(me)&&oe.push(`${Be.replace(/-/g,"_")}=${encodeURIComponent(r[me])}`)}}),n=`tuic://${encodeURIComponent(r.uuid)}:${encodeURIComponent(r.password)}@${r.server}:${r.port}?${oe.join("&")}#${encodeURIComponent(r.name)}`}break;case"anytls":n=TC({...r,uuid:encodeURIComponent(r.password),network:r.network||"tcp"}).replace("vless","anytls");let W=[];Object.keys(r).forEach(oe=>{if(!["name","type","password","server","port","tls"].includes(oe)){let me=oe.replace(/-/,"_");["alpn"].includes(oe)?r[oe]&&W.push(`${me}=${encodeURIComponent(Array.isArray(r[oe])?r[oe][0]:r[oe])}`):["skip-cert-verify"].includes(oe)?r[oe]&&W.push("insecure=1"):["udp"].includes(oe)?r[oe]&&W.push("udp=1"):r[oe]&&!/^_|client-fingerprint/i.test(oe)&&["number","string","boolean"].includes(typeof r[oe])&&W.push(`${me.replace(/-/g,"_")}=${encodeURIComponent(r[oe])}`)}});let G=n.split("?"),J=G[0],te={};G.length>1&&G[1].split("#")[0].split("&").forEach(Be=>{let[Ue,We]=Be.split("=");Ue&&(te[Ue]=We)}),W.forEach(oe=>{let[me,Be]=oe.split("=");me&&(te[me]=Be)});let ie=Object.keys(te).map(oe=>`${oe}=${te[oe]}`).join("&"),ge=n.match(/#(.*)$/),he=ge?`#${ge[1]}`:"";n=`${J}?${ie}${he}`;break;case"mieru":{let oe=r["port-range"]||r.port,me=encodeURIComponent(r.username??""),Be=encodeURIComponent(r.password??"");if(!r.server||!oe||!me||!Be)throw new Error("Mieru URI requires a server, port and credentials");let Ue=[`port=${encodeURIComponent(oe)}`,`protocol=${encodeURIComponent(r.transport||"TCP")}`,`profile=${encodeURIComponent(r.name||r.server)}`];for(let We of["multiplexing","handshake-mode","traffic-pattern"])r[We]&&Ue.push(`${We}=${encodeURIComponent(r[We])}`);n=`mierus://${me}:${Be}@${r.server}?${Ue.join("&")}`;break}case"wireguard":let Fe=[];Object.keys(r).forEach(oe=>{["name","type","server","port","ip","ipv6","ip-cidr","ipv6-cidr","private-key"].includes(oe)||(["public-key"].includes(oe)?Fe.push(`publickey=${encodeURIComponent(r[oe])}`):["udp"].includes(oe)?r[oe]&&Fe.push(`${oe}=1`):r[oe]&&!/^_/i.test(oe)&&Fe.push(`${oe}=${encodeURIComponent(r[oe])}`))});let ke=Qs(r,"ipv4"),$e=Qs(r,"ipv6");ke&&$e?Fe.push(`address=${encodeURIComponent(`${ke},${$e}`)}`):ke?Fe.push(`address=${encodeURIComponent(ke)}`):$e&&Fe.push(`address=${encodeURIComponent($e)}`),n=`wireguard://${encodeURIComponent(r["private-key"])}@${r.server}:${r.port}/?${Fe.join("&")}#${encodeURIComponent(r.name)}`;break}return n}}}var $Ce,kC=re(()=>{$Ce=F(I());Xo();gt();Ir();ei();Ih();Hu();Fh();Si()});function $1(){return{type:"ALL",produce:r=>{let n=[];return r.map(s=>{try{n.push(wse.produce(s))}catch(o){R.error(`Cannot produce proxy: ${s.name}
|
||
Reason: ${o}`)}}),mt.encode(n.join(`
|
||
`))}}}var PCe,wse,wk=re(()=>{PCe=F(I());Xo();kC();gt();wse=kh()});function yse(e){return(Array.isArray(e)?e:`${e}`.split(",")).map(r=>`${r}`.trim()).filter(Boolean).map(r=>{let n=PC.Buffer.from(r,"utf8");if(n.length>255)throw new Error("QX ALPN protocol exceeds 255 bytes");return`${n.length.toString(16).padStart(2,"0")}${n.toString("hex")}`}).join("")||void 0}function qu(e,t){if(fe(t,"tls-alpn")){e.append(`,tls-alpn=${t["tls-alpn"]}`);return}let r=fe(t,"alpn")&&yse(t.alpn);r&&e.append(`,tls-alpn=${r}`)}function x1(){let e=(t,r,n={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${Pw} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return Ese(t);case"ssr":return bse(t);case"trojan":return Ase(t);case"vmess":return Sse(t);case"http":return Fse(t);case"socks5":return Bse(t);case"vless":return _se(t);case"anytls":return Cse(t);case"hysteria2":return Dse(t);case"mieru":return Ise(t)}throw new Error(`Platform ${Pw} does not support proxy type: ${t.type}`)};return{produce:(t,r,n={})=>{let s=e(t,r,n);if(t.flow&&t.flow!=="xtls-rprx-vision")throw new Error(`Platform ${Pw} does not support flow ${t.flow}`);return t["reality-opts"]&&(t["reality-opts"]["public-key"]&&(s=`${s},reality-base64-pubkey=${t["reality-opts"]["public-key"]}`),t["reality-opts"]["short-id"]&&(s=`${s},reality-hex-shortid=${t["reality-opts"]["short-id"]}`)),s}}}function OC(e){return["http","vmess-http","vemss-http","shadowsocks-http"].includes(e._qx_obfs_http)?e._qx_obfs_http:"http"}function ju(e,t){let r=fe(t,"name-cert-verify")?"name-cert-verify":"skip-cert-verify";e.appendIfPresent(`,tls-verification=${t["name-cert-verify"]??!t["skip-cert-verify"]}`,r)}function Ese(e){let t=new Je(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t),s=Ch(e);if(e.cipher||(e.cipher="none"),!["none","rc4-md5","rc4-md5-6","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","cast5-cfb","des-cfb","rc2-cfb","salsa20","chacha20","chacha20-ietf","aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),Bs(e)&&(e.tls=!0),s)r(",obfs=over-tls"),fe(e,"sni")?r(`,obfs-host=${e.sni}`):n(`,obfs-host=${e.servername}`,"servername");else if(fe(e,"plugin")){if(e.plugin==="obfs"){let o=e["plugin-opts"];o.mode==="http"?r(`,obfs=${OC(e)}`):r(`,obfs=${o.mode}`)}else if(e.plugin==="v2ray-plugin"&&e["plugin-opts"].mode==="websocket")e["plugin-opts"].tls?r(",obfs=wss"):r(",obfs=ws");else throw new Error("plugin is not supported");n(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),n(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path")}return(Bs(e)||e.plugin==="v2ray-plugin"&&e["plugin-opts"]?.tls)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(t,e),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(t,e),s||n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),e._ssr_python_uot?r(",udp-over-tcp=true"):e["udp-over-tcp"]&&(!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?r(",udp-over-tcp=sp.v1"):e["udp-over-tcp-version"]===2&&r(",udp-over-tcp=sp.v2")),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function bse(e){let t=new Je(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),r(`,ssr-protocol=${e.protocol}`),n(`,ssr-protocol-param=${e["protocol-param"]}`,"protocol-param"),n(`,obfs=${e.obfs}`,"obfs"),n(`,obfs-host=${e["obfs-param"]}`,"obfs-param"),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function Ase(e){let t=new Je(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`trojan=${e.server}:${e.port}`),r(`,password=${e.password}`),fe(e,"network")){if(e.network==="ws")Bs(e)?r(",obfs=wss"):r(",obfs=ws"),n(`,obfs-uri=${e["ws-opts"]?.path}`,"ws-opts.path"),n(`,obfs-host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`)}return e.network!=="ws"&&Bs(e)&&r(",over-tls=true"),Bs(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(t,e),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(t,e),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function Sse(e){let t=new Je(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);r(`vmess=${e.server}:${e.port}`);let s=L7(e.cipher);if(r(`,method=${s}`),r(`,password=${e.uuid}`),Bs(e)&&(e.tls=!0),fe(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(`,obfs=${OC(e)}`);else if(["tcp"].includes(e.network))e.tls&&r(",obfs=over-tls");else if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`);let o=e[`${e.network}-opts`]?.path,i=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(o)?o[0]:o}`,`${e.network}-opts.path`),n(`,obfs-host=${Array.isArray(i)?i[0]:i}`,`${e.network}-opts.headers.Host`)}else e.tls&&r(",obfs=over-tls");return Bs(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(t,e),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(t,e),n(`,tls-host=${e.sni}`,"sni")),fe(e,"aead")?r(`,aead=${e.aead}`):r(`,aead=${e.alterId===0}`),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function _se(e){if(e.encryption&&e.encryption!=="none")throw new Error("VLESS encryption is not supported");let t=new Je(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`vless=${e.server}:${e.port}`),r(",method=none"),r(`,password=${e.uuid}`),Bs(e)&&(e.tls=!0),fe(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(`,obfs=${OC(e)}`);else if(["tcp"].includes(e.network))e.tls&&r(",obfs=over-tls");else if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`);let o=e[`${e.network}-opts`]?.path,i=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(o)?o[0]:o}`,`${e.network}-opts.path`),n(`,obfs-host=${Array.isArray(i)?i[0]:i}`,`${e.network}-opts.headers.Host`)}else e.tls&&r(",obfs=over-tls");return Bs(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(t,e),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(t,e),n(`,tls-host=${e.sni}`,"sni")),n(`,vless-flow=${e.flow}`,"flow"),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function Cse(e){let t=e.network?.trim().toLowerCase();if(t&&t!=="tcp")throw new Error(`Platform ${Pw} does not support AnyTLS with transport ${e.network}`);let r=new Je(e),n=r.append.bind(r),s=r.appendIfPresent.bind(r);return n(`anytls=${e.server}:${e.port}`),n(`,password=${e.password}`),e.tls=!0,n(",over-tls=true"),s(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(r,e),s(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),s(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),s(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(r,e),s(`,tls-host=${e.sni}`,"sni"),s(`,fast-open=${e.tfo}`,"tfo"),s(`,udp-relay=${e.udp}`,"udp"),r.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),r.toString()}function Dse(e){let t=e.obfs||"salamander";if(!["salamander","gecko"].includes(t))throw new Error("QX Hysteria 2 only supports Salamander and Gecko obfuscation");let r=new Je(e);r.append(`hysteria2=${e.server}:${e.port}`),r.appendIfPresent(`,password=${e.password}`,"password");let n=String(e.ports||"").trim();n&&r.append(`,port-hopping=${n.replace(/;/g,",")}`);let s=Number(e["hop-interval"]);if(Number.isInteger(s)&&s>=5&&s<=3600&&r.append(`,port-hopping-interval=${s}`),fe(e,"obfs-password")){let i=String(e["obfs-password"]);if(PC.Buffer.byteLength(i,"utf8")<4)throw new Error(`QX Hysteria 2 ${t}-password must be at least 4 bytes`);r.append(`,${t}-password=${i}`)}else if(t==="gecko")throw new Error("QX Hysteria 2 Gecko obfuscation requires gecko-password");r.appendIfPresent(`,tls-host=${e.sni}`,"sni"),r.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(r,e),r.appendIfPresent(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),r.appendIfPresent(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),r.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(r,e);let o=String(e.down).match(/^\s*(\d+)/)?.[1];return o&&r.append(`,download-bandwidth=${o}`),r.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),r.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r.append(`,tag=${e.name}`),r.toString()}function Fse(e){let t=new Je(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`http=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),Bs(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Bs(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(t,e),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(t,e),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function Bse(e){let t=new Je(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`socks5=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),Bs(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Bs(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(t,e),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(t,e),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function Ise(e){let t=new Je(e);return t.append(`mieru=${e.server}:${e.port}`),t.appendIfPresent(`,username=${e.username}`,"username"),t.appendIfPresent(`,password=${e.password}`,"password"),Bs(e)&&(e.tls=!0),t.appendIfPresent(`,over-tls=${e.tls}`,"tls"),Bs(e)&&(t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),qu(t,e),t.appendIfPresent(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),t.appendIfPresent(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),t.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ju(t,e),t.appendIfPresent(`,tls-host=${e.sni}`,"sni")),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),e.udp===!0&&t.append(",udp-over-tcp=true"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),t.append(`,tag=${e.name}`),t.toString()}function Bs(e){return e.tls}var UCe,PC,Pw,yk=re(()=>{UCe=F(I()),PC=F(iu());ei();Si();Pw="QX"});function R1(){return{type:"ALL",produce:(r,n,s={})=>{let o=r.filter(i=>{if(s["include-unsupported-proxy"])return!0;if(Dh(i,["websocket","quic","http2","mkcp","grpc"])){if(i.type==="snell"&&![1,2,3,4,5,6].includes(i.version))return!1;if($se(i))return R.error(`Platform Shadowrocket does not support Snell shadow-tls with obfs for proxy ${i.name}. Proxy has been filtered.`),!1;if(["tailscale","sudoku","naive","openvpn","gost-relay","shadowquic","zerotier","masque-surge","easytier"].includes(i.type))return!1;if(["xhttp"].includes(i.network))return R.warn("VLESS XHTTP \u7ED3\u6784\u590D\u6742, Shadowrocket \u53EF\u80FD\u65E0\u6CD5\u5B8C\u5168\u517C\u5BB9"),!0}else return!1;return!0}).map(i=>{if(Ew(i),i.type==="vmess"?(fe(i,"aead")&&(i.aead&&(i.alterId=0),delete i.aead),fe(i,"sni")&&(i.servername=i.sni,delete i.sni),i.cipher=cn(i.cipher)):i.type==="tuic"?(fe(i,"alpn")&&(i.alpn=Array.isArray(i.alpn)?i.alpn:[i.alpn]),fe(i,"tfo")&&!fe(i,"fast-open")&&(i["fast-open"]=i.tfo),(!i.token||i.token.length===0)&&!fe(i,"version")&&(i.version=5)):i.type==="hysteria"?(fe(i,"auth_str")&&!fe(i,"auth-str")&&(i["auth-str"]=i.auth_str),fe(i,"alpn")&&(i.alpn=Array.isArray(i.alpn)?i.alpn:[i.alpn]),fe(i,"tfo")&&!fe(i,"fast-open")&&(i["fast-open"]=i.tfo)):i.type==="hysteria2"?(fe(i,"alpn")&&(i.alpn=Array.isArray(i.alpn)?i.alpn:[i.alpn]),fe(i,"tfo")&&!fe(i,"fast-open")&&(i["fast-open"]=i.tfo)):i.type==="wireguard"?(i.keepalive=i.keepalive??i["persistent-keepalive"],i["persistent-keepalive"]=i.keepalive,i["preshared-key"]=i["preshared-key"]??i["pre-shared-key"],i["pre-shared-key"]=i["preshared-key"],i.ip=Qs(i,"ipv4"),i.ipv6=Qs(i,"ipv6")):i.type==="snell"?(i.version<3&&delete i.udp,i.plugin==="shadow-tls"&&i["plugin-opts"]&&(i["obfs-opts"]={mode:"shadow-tls",host:i["plugin-opts"].host,password:i["plugin-opts"].password,version:i["plugin-opts"].version},i["plugin-opts"].alpn&&(i["obfs-opts"].alpn=i["plugin-opts"].alpn),delete i.plugin,delete i["plugin-opts"])):i.type==="vless"?fe(i,"sni")&&(i.servername=i.sni,delete i.sni):i.type==="ss"?Ch(i)&&fe(i,"sni")&&(i.servername=i.sni):["anytls"].includes(i.type)&&i.reuse!=null&&!i.reuse&&(i["disable-reuse"]=!0,delete i.reuse),["vmess","vless"].includes(i.type)&&i.network==="http"){let a=i["http-opts"]?.path;fe(i,"http-opts.path")&&!Array.isArray(a)&&(i["http-opts"].path=[a]);let u=i["http-opts"]?.headers?.Host;fe(i,"http-opts.headers.Host")&&!Array.isArray(u)&&(i["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(i.type)&&i.network==="h2"){let a=i["h2-opts"]?.path;fe(i,"h2-opts.path")&&Array.isArray(a)&&(i["h2-opts"].path=a[0]);let u=i["h2-opts"]?.host??i["h2-opts"]?.headers?.host??i["h2-opts"]?.headers?.Host;(fe(i,"h2-opts.host")||fe(i,"h2-opts.headers.host")||fe(i,"h2-opts.headers.Host"))&&(i["h2-opts"].host=Array.isArray(u)?u:[u]),i["h2-opts"]?.headers&&(delete i["h2-opts"].headers.host,delete i["h2-opts"].headers.Host,Object.keys(i["h2-opts"].headers).length===0&&delete i["h2-opts"].headers)}if(["ws"].includes(i.network)){let a=`${i.network}-opts`;i[a]=i[a]||{},i[a].path||(i[a].path="/"),rl(i[a])}if(i["plugin-opts"]?.tls&&fe(i,"skip-cert-verify")&&(i["plugin-opts"]["skip-cert-verify"]=i["plugin-opts"]["skip-cert-verify"]||i["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].includes(i.type)&&delete i.tls,i["tls-fingerprint"]&&(i.fingerprint=i["tls-fingerprint"]),delete i["tls-fingerprint"],i["underlying-proxy"]&&(i["dialer-proxy"]=i["underlying-proxy"]),delete i["underlying-proxy"],fe(i,"tls")&&typeof i.tls!="boolean"&&delete i.tls,delete i.subName,delete i.collectionName,delete i.id,delete i.resolved,delete i["no-resolve"],delete i["ip-cidr"],delete i["ipv6-cidr"],n!=="internal"){for(let a in i)(i[a]==null||/^_/i.test(a))&&delete i[a];nl(i[`${i.network}-opts`])}return["grpc"].includes(i.network)&&i[`${i.network}-opts`]&&(delete i[`${i.network}-opts`]["_grpc-type"],delete i[`${i.network}-opts`]["_grpc-authority"]),i});return Ra(o,n,s)}}}function $se(e){return e?.type==="snell"&&e?.plugin==="shadow-tls"&&(fe(e,"obfs-opts.mode")||fe(e,"obfs-opts.host")||fe(e,"obfs-opts.path"))}var VCe,Ek=re(()=>{VCe=F(I());ei();Hu();gt();Si()});function If(e){return e!=null&&`${e}`.trim().length>0}function ol(e,t,r=!0){if(!r)return;let n=String(t["tls-fingerprint"]);e.appendIfPresent(`,server-cert-fingerprint-sha256=${n.includes(",")?To(n):n}`,"tls-fingerprint"),e.appendIfPresent(`,sni=${To(t.sni)}`,"sni"),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify")}function Ow(){return{produce:t=>{if(t.type!=="vless"&&t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${T1} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return Pse(t);case"trojan":return Ose(t);case"vmess":return Nse(t);case"vless":return Lse(t);case"http":return Use(t);case"h2-connect":return Hse(t);case"snell":return kse(t);case"tuic":return xse(t);case"socks5":return Mse(t);case"hysteria2":return Rse(t);case"wireguard-surge":return qse(t)}if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw new Error(`Platform ${T1} does not support proxy type ${t.type} with network or REALITY`);return Tse(t)}throw new Error(`Platform ${T1} does not support proxy type: ${t.type}`)}}}function xse(e){if(e.token?.length)throw new Error(`Platform ${T1} does not support proxy type ${e.type} v4`);let t=new Je(e);return t.append(`${e.name}=tuic-v5,${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),If(e.alpn)&&t.append(`,alpn="${Array.isArray(e.alpn)?e.alpn.join(","):e.alpn}"`),If(e.ports)&&t.append(`,port-hopping="${String(e.ports).replace(/,/g,";")}"`),If(e["hop-interval"])&&t.append(`,port-hopping-interval=${e["hop-interval"]}`),ol(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function Rse(e){if((e.obfs||e["obfs-password"])&&!["salamander","gecko"].includes(e.obfs))throw new Error("Surfboard Hysteria2 supports Salamander and Gecko obfs");let t=new Je(e);return t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),If(e.ports)&&t.append(`,port-hopping="${String(e.ports).replace(/,/g,";")}"`),If(e["hop-interval"])&&t.append(`,port-hopping-interval=${e["hop-interval"]}`),e["obfs-password"]&&t.append(`,${e.obfs}-password=${To(e["obfs-password"])}`),ol(t,e),t.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function Tse(e){let t=new Je(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),ol(t,e),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function kse(e){if(fe(e,"version")&&![1,2,3,4,5].includes(Number(e.version)))throw new Error(`Platform ${T1} does not support snell version ${e.version}`);let t=new Je(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk="${e.psk}"`,"psk"),t.appendIfPresent(`,obfs=${e["obfs-opts"]?.mode}`,"obfs-opts.mode"),t.appendIfPresent(`,obfs-host=${e["obfs-opts"]?.host}`,"obfs-opts.host"),t.appendIfPresent(`,obfs-uri=${e["obfs-opts"]?.path}`,"obfs-opts.path"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e.version>=3&&t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function Pse(e){let t=new Je(e);if(t.append(`${e.name}=${e.type},${e.server},${e.port}`),!["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","salsa20","chacha20","chacha20-ietf","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password"),fe(e,"plugin"))if(e.plugin==="obfs")t.append(`,obfs=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else throw new Error(`plugin ${e.plugin} is not supported`);return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function Ose(e){let t=new Je(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),Sk(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),ol(t,e),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function Nse(e){let t=String(e.cipher??"").trim().toLowerCase(),r=Cw(t);if(t&&t!==xh&&!r)throw new Error(`Surfboard does not support VMess cipher ${t}`);let n=new Je(e);return n.append(`${e.name}=${e.type},${e.server},${e.port}`),n.appendIfPresent(`,username=${e.uuid}`,"uuid"),r&&n.append(`,encrypt-method=${r}`),Sk(n,e),fe(e,"aead")?n.append(`,vmess-aead=${e.aead}`):n.append(`,vmess-aead=${e.alterId===0}`),n.appendIfPresent(`,tls=${e.tls}`,"tls"),ol(n,e,!!e.tls),n.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),n.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),n.toString()}function Lse(e){if(!If(e.uuid))throw new Error("VLESS username is missing");if(e.flow&&!["xtls-rprx-vision","xtls-rprx-vision-udp443"].includes(e.flow))throw new Error("Unsupported VLESS flow");if(!ww(e))throw new Error("Unsupported VLESS transport, TLS or flow combination");let t=new Je(e);t.append(`${e.name}=vless,${e.server},${e.port}`);let r=(i,a)=>{if(a==null)return;let u=String(a),l=!u||/[,;"'\s\\]/.test(u)?To(u):u;t.append(`,${i}=${l}`)};r("username",e.uuid);let n=e.network??"tcp";if(n==="ws"){let i=e["ws-opts"];r("ws",!0),i?.["v2ray-http-upgrade"]&&r("ws-http-upgrade",!0),r("ws-path",i?.path),r("ws-headers",bk(Object.entries(i?.headers??{})))}else if(n==="grpc"){let i=e["grpc-opts"];r("grpc",!0),r("grpc-service-name",i?.["grpc-service-name"]),r("grpc-mode",i?.["_grpc-type"]),r("grpc-authority",i?.["_grpc-authority"])}else if(n==="xhttp"){let i=e["xhttp-opts"];if(i?.["download-settings"])throw new Error("VLESS XHTTP download-settings are unsupported");r("xhttp",!0);let a=Object.entries(i?.headers??{}),u=i?.host??a.find(([l])=>/^host$/i.test(l))?.[1];for(let[l,f]of Object.entries($h))r(`xhttp-${l}`,l==="host"?u:Ak.default.get(i,f));r("xhttp-headers",bk(a.filter(([l])=>!/^host$/i.test(l))))}else if(!["tcp","raw","none"].includes(n))throw new Error(`VLESS network ${n} is unsupported`);e.flow&&r("flow",e.flow),e.encryption&&r("encryption",e.encryption);let s=e["reality-opts"];s?(r("reality-public-key",s["public-key"]),r("reality-short-id",s["short-id"])):(r("tls",e.tls),e.tls&&(r("server-cert-fingerprint-sha256",e["tls-fingerprint"]),r("server-cert-verify-name",e["name-cert-verify"]),r("skip-cert-verify",e["skip-cert-verify"]))),(e.tls||s)&&(r("sni",e.sni),If(e.alpn)&&r("alpn",e.alpn)),r("udp-relay",e.udp),r("block-quic",e["block-quic"]),r("underlying-proxy",e["underlying-proxy"]);let o=t.toString();if(/[\r\n]/.test(o))throw new Error("VLESS proxy contains a line break");return o}function bk(e){let t=[];for(let[r,n]of e){if(n==null)continue;let s=String(n);if(r.includes("|")||s.includes("|"))throw new Error('VLESS header names and values cannot contain "|"');t.push(`${r}:${s}`)}return t.join("|")||void 0}function Use(e){let t=new Je(e),r=e.tls?"https":"http";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),ol(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function Hse(e){if(e.plugin)throw new Error("Surfboard HTTP/2 CONNECT does not support plugins");if(e.username==null!=(e.password==null))throw new Error("HTTP/2 CONNECT authentication requires both username and password");let t=new Je(e);t.append(`${e.name}=h2-connect,${e.server},${e.port}`),t.appendIfPresent(`,username=${To(e.username)}`,"username"),t.appendIfPresent(`,password=${To(e.password)}`,"password");let r=Object.entries(e.headers??{}).filter(([,s])=>s!=null).map(([s,o])=>{if(!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(s)||/[;\x00-\x08\x0a-\x1f\x7f]/.test(String(o)))throw new Error("Invalid HTTP/2 CONNECT header name or value");return`${s}:${o}`});if(r.length&&t.append(`,headers=${To(r.join(";"))}`),fe(e,"max-streams")){let s=Number(String(e["max-streams"]));if(!Number.isSafeInteger(s)||s<1)throw new Error("HTTP/2 CONNECT max-streams must be a positive integer");t.append(`,max-streams=${s}`)}ol(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),["auto","on","off"].includes(e["block-quic"])&&t.append(`,block-quic=${e["block-quic"]}`),t.appendIfPresent(`,underlying-proxy=${To(e["underlying-proxy"])}`,"underlying-proxy");let n=t.toString();if(/[\r\n]/.test(n))throw new Error("HTTP/2 CONNECT proxy contains a line break");return n}function Mse(e){let t=new Je(e),r=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),ol(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function qse(e){let t=new Je(e);return t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function Sk(e,t){if(fe(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),fe(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),fe(t,"ws-opts.headers"))){let r=t["ws-opts"].headers,n=Object.keys(r).map(s=>{let o=r[s];return["Host"].includes(s)&&(o=`"${o}"`),`${s}:${o}`}).join("|");Ge(n)&&e.append(`,ws-headers=${n}`)}}else{if(["tcp"].includes(t.network)&&t["reality-opts"])throw new Error("reality is unsupported");if(!["tcp"].includes(t.network))throw new Error(`network ${t.network} is unsupported`)}}var JCe,Ak,T1,_k=re(()=>{JCe=F(I()),Ak=F(ho());ei();Ir();_w();Si();T1="Surfboard"});function Uw(){return{type:"ALL",produce:(r,n,s={})=>{let o=[],i=new Map(r.filter(u=>u?.plugin==="shadow-tls"&&u?.["plugin-opts"]).map(u=>[u,{plugin:u.plugin,"plugin-opts":u["plugin-opts"]?JSON.parse(JSON.stringify(u["plugin-opts"])):void 0,"obfs-opts":u["obfs-opts"]?JSON.parse(JSON.stringify(u["obfs-opts"])):void 0}]));if(_i().produce(r,"internal",{"include-unsupported-proxy":!0}).map(u=>{let l=o.length;try{let f=i.get(u);f&&(u.plugin=f.plugin,u["plugin-opts"]=f["plugin-opts"],f["obfs-opts"]?u["obfs-opts"]=f["obfs-opts"]:delete u["obfs-opts"]);let m=Nw(u),p=!!(m&&(m.password||m.version!=null&&Number(m.version)!==0)),d;if(p&&["vmess","vless","trojan"].includes(u.type)){if(u["reality-opts"])throw new Error(`Platform sing-box cannot chain ShadowTLS with Reality for proxy ${u.name}`);if(["vmess","vless"].includes(u.type)&&u.network==="h2")throw new Error(`Platform sing-box cannot chain ShadowTLS with network h2 for proxy ${u.name}`);if(u.type==="vless"&&u.flow==="xtls-rprx-vision")throw new Error(`Platform sing-box cannot chain ShadowTLS with flow xtls-rprx-vision for proxy ${u.name}`);let v=m.version,g=typeof v=="string"&&v.trim()===""?NaN:Number(v??0),y=g===0?2:g;if(!Number.isInteger(y)||![1,2,3].includes(y))throw new Error(`Platform sing-box does not support shadow-tls version ${v} for proxy ${u.name}`);d=NC(u,{...m,version:y})}if(u.type==="anytls"&&p)throw new Error("Platform sing-box cannot replace AnyTLS TLS with ShadowTLS");if(["xhttp"].includes(u.network))throw new Error(`Platform sing-box does not support network: ${u.network}`);switch(u.type){case"ssh":o.push(zse(u));break;case"http":o.push(Yse(u));break;case"socks5":if(u.tls)throw new Error(`Platform sing-box does not support proxy type: ${u.type} with tls`);o.push(Wse(u));break;case"ss":if(u.plugin==="shadow-tls"){let{ssPart:v,stPart:g}=Xse(u);o.push(v),o.push(g)}else o.push(Jse(u));break;case"ssr":if(s["include-unsupported-proxy"])o.push(Zse(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type}`);break;case"snell":{o.push(eie(u,s["include-unsupported-proxy"]));let v=Nw(u);v&&o.push(NC(u,v));break}case"vmess":if(!u.network||["tcp","ws","grpc","h2","http"].includes(u.network))o.push(sie(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with network ${u.network}`);break;case"vless":if(u.encryption&&u.encryption!=="none")throw new Error("VLESS encryption is not supported");if(!u.flow||["xtls-rprx-vision"].includes(u.flow))o.push(iie(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with flow ${u.flow}`);break;case"trojan":if(!u.flow)o.push(oie(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with flow ${u.flow}`);break;case"naive":o.push(aie(u));break;case"hysteria":o.push(uie(u));break;case"hysteria2":o.push(cie(u,s["include-unsupported-proxy"]));break;case"tuic":if(!u.token||u.token.length===0)o.push(lie(u));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":o.push(hie(u));break;case"anytls":o.push(fie(u,s["include-unsupported-proxy"]));break;case"tailscale":o.push(die(u));break;default:throw new Error(`Platform sing-box does not support proxy type: ${u.type}`)}if(d){let v=o[l];v.detour=Lw(u),delete v.tls,o.push(d)}if(s["include-unsupported-proxy"]&&u["name-cert-verify"])for(let v=l;v<o.length;v++){let g=o[v];g.tls&&(g.tls.certificate_server_name=u["name-cert-verify"])}}catch(f){o.length=l,R.error(f.message??f)}}),n==="internal")return o;let a=o.reduce((u,l)=>(["wireguard","tailscale"].includes(l.type)?u.endpoints.push(l):u.outbounds.push(l),u),{outbounds:[],endpoints:[]});return JSON.stringify(a,null,2)}}}var i4e,Dk,jse,Nn,Ln,Kse,Un,Oo,Is,No,LC,Fk,Bk,UC,Vse,Gse,Ik,$k,Ku,zse,Yse,Wse,Xse,Lw,Nw,Ck,NC,Jse,Zse,Qse,eie,tie,rie,xk,nie,sie,iie,oie,aie,uie,cie,lie,fie,die,hie,Rk=re(()=>{i4e=F(I()),Dk=F(iu());Bw();gt();Ir();ei();Hu();Si();jse={ipv4:"ipv4_only",ipv6:"ipv6_only","v4-only":"ipv4_only","v6-only":"ipv6_only","ipv4-prefer":"prefer_ipv4","ipv6-prefer":"prefer_ipv6","prefer-v4":"prefer_ipv4","prefer-v6":"prefer_ipv6"},Nn=(e,t)=>{let r=jse[e["ip-version"]];e._dns_server&&r&&(t.domain_resolver={server:e._dns_server,strategy:r})},Ln=(e,t)=>{e._domain_resolver&&(typeof e._domain_resolver=="string"?t.domain_resolver={...t.domain_resolver??{},server:e._domain_resolver}:t.domain_resolver={...t.domain_resolver??{},...e._domain_resolver})},Kse=e=>{let t=e["control-http-client"];return t==null?!1:typeof t=="string"?t.trim()!=="":Ze(t)?Object.values(t).some(r=>r!=null&&r!==""):!0},Un=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},Oo=(e,t)=>{if(["tcp","udp"].includes(e._network)){t.network=e._network;return}e.udp===!1&&(t.network="tcp")},Is=(e,t)=>{t.tcp_fast_open=!1,e.tfo&&(t.tcp_fast_open=!0),e.tcp_fast_open&&(t.tcp_fast_open=!0),e["tcp-fast-open"]&&(t.tcp_fast_open=!0),t.tcp_fast_open||delete t.tcp_fast_open},No=(e,t)=>{!e||!e.enabled||(t.multiplex={enabled:!0},t.multiplex.protocol=e.protocol,e["max-connections"]&&(t.multiplex.max_connections=parseInt(`${e["max-connections"]}`,10)),e["max-streams"]&&(t.multiplex.max_streams=parseInt(`${e["max-streams"]}`,10)),e["min-streams"]&&(t.multiplex.min_streams=parseInt(`${e["min-streams"]}`,10)),e.padding&&(t.multiplex.padding=!0),(e["brutal-opts"]?.up||e["brutal-opts"]?.down)&&(t.multiplex.brutal={enabled:!0},e["brutal-opts"]?.up&&(t.multiplex.brutal.up_mbps=parseInt(`${e["brutal-opts"]?.up}`,10)),e["brutal-opts"]?.down&&(t.multiplex.brutal.down_mbps=parseInt(`${e["brutal-opts"]?.down}`,10))))},LC=(e,t)=>{let r={type:"ws",headers:{}};if(e["ws-opts"]){let{path:n="",headers:s={},"max-early-data":o,"early-data-header-name":i}=e["ws-opts"];if(r.early_data_header_name=i,r.max_early_data=o?parseInt(o,10):void 0,n!==""&&(r.path=`${n}`),Object.keys(s).length>0){let a={};for(let l of Object.keys(s)){let f=s[l];f!==""&&(Array.isArray(f)||(f=[`${f}`]),f.length>0&&(a[l]=f))}let{Host:u}=a;if(u.length===1)for(let l of`Host:${u[0]}`.split(`
|
||
`)){let[f,m]=l.split(":");m.trim()!==""&&(a[f.trim()]=m.trim().split(","))}r.headers=a}}if(e["ws-headers"]){let n={};for(let o of Object.keys(e["ws-headers"])){let i=e["ws-headers"][o];i!==""&&(Array.isArray(i)||(i=[`${i}`]),i.length>0&&(n[o]=i))}let{Host:s}=n;if(s.length===1)for(let o of`Host:${s[0]}`.split(`
|
||
`)){let[i,a]=o.split(":");a.trim()!==""&&(n[i.trim()]=a.trim().split(","))}for(let o of Object.keys(n))r.headers[o]=n[o]}if(e["ws-path"]&&e["ws-path"]!==""&&(r.path=`${e["ws-path"]}`),r.path){let{value:n,parsed:s}=AC(r.path,"ed");n!==""&&(r.path=ti(r.path,"ed").path,r.early_data_header_name="Sec-WebSocket-Protocol",r.max_early_data=s)}t.tls.insecure&&(t.tls.server_name=r.headers.Host[0]),e["ws-opts"]&&e["ws-opts"]["v2ray-http-upgrade"]&&(r.type="httpupgrade",r.headers.Host&&(r.host=r.headers.Host[0],delete r.headers.Host),r.max_early_data&&delete r.max_early_data,r.early_data_header_name&&delete r.early_data_header_name);for(let n of Object.keys(r.headers)){let s=r.headers[n];s.length===1&&(r.headers[n]=s[0])}t.transport=r},Fk=(e,t)=>{let r={type:"http",headers:{}};if(e["http-opts"]){let{method:n="",path:s="",headers:o={}}=e["http-opts"];n!==""&&(r.method=n),Array.isArray(s)?r.path=`${s[0]}`:s!==""&&(r.path=`${s}`);for(let i of Object.keys(o)){let a=o[i];if(a!==""){if(i.toLowerCase()==="host"){let u=a;Array.isArray(u)||(u=`${u}`.split(",").map(l=>l.trim())),u.length>0&&(r.host=u);continue}Array.isArray(a)||(a=`${a}`.split(",").map(u=>u.trim())),a.length>0&&(r.headers[i]=a)}}}if(e["http-host"]&&e["http-host"]!==""){let n=e["http-host"];Array.isArray(n)||(n=`${n}`.split(",").map(s=>s.trim())),n.length>0&&(r.host=n)}if(e["http-path"]&&e["http-path"]!==""){let n=e["http-path"];Array.isArray(n)?r.path=`${n[0]}`:n!==""&&(r.path=`${n}`)}t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host?.length===1&&(r.host=r.host[0]);for(let n of Object.keys(r.headers)){let s=r.headers[n];s.length===1&&(r.headers[n]=s[0])}t.transport=r},Bk=(e,t)=>{let r={type:"http"};if(e["h2-opts"]){let{host:n="",path:s=""}=e["h2-opts"];s!==""&&(r.path=`${s}`),n!==""&&(Array.isArray(n)||(n=`${n}`.split(",").map(o=>o.trim())),n.length>0&&(r.host=n))}if(e["h2-host"]&&e["h2-host"]!==""){let n=e["h2-host"];Array.isArray(n)||(n=`${n}`.split(",").map(s=>s.trim())),n.length>0&&(r.host=n)}e["h2-path"]&&e["h2-path"]!==""&&(r.path=`${e["h2-path"]}`),t.tls.enabled=!0,t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host.length===1&&(r.host=r.host[0]),t.transport=r},UC=(e,t)=>{let r={type:"grpc"};if(e["grpc-opts"]){let n=e["grpc-opts"]["grpc-service-name"];n!=null&&n!==""&&(r.service_name=`${n}`)}t.transport=r},Vse=(e,t)=>{let r=Array.isArray(e)?e:[e],n=[];for(let s of r){let o=`${s}`.trim().replace(/\\r\\n/g,`
|
||
`).replace(/\\n/g,`
|
||
`);if(o!=="")for(let i of o.split(/\r?\n/)){let a=i.trim();a!==""&&n.push(a)}}if(n.length!==0)return n.some(s=>/^-----BEGIN [A-Za-z0-9 -]+-----$/.test(s))?n:[`-----BEGIN ${t}-----`,...n,`-----END ${t}-----`]},Gse=["chrome","firefox","edge","safari","360","qq","ios","android","random","randomized"],Ik=e=>{let t=`${e||""}`.trim().toLowerCase();if(Gse.includes(t))return t},$k=(e,t)=>{let r=t.tls;if(e.ca&&(r.certificate_path=`${e.ca}`),e.ca_str&&(r.certificate=[e.ca_str]),e["ca-str"]&&(r.certificate=[e["ca-str"]]),e._certificate&&(r.certificate=e._certificate),e._certificate_path&&(r.certificate_path=e._certificate_path),r.reality?.enabled){(e._certificate_sha256?.length||e._certificate_public_key_sha256?.length)&&R.warn(`Platform sing-box: certificate_sha256 and certificate_public_key_sha256 are ignored by Reality for proxy ${e.name}`);return}e._certificate_public_key_sha256&&(r.certificate_public_key_sha256=e._certificate_public_key_sha256);let n=r.certificate?.length||r.certificate_path;if(e._certificate_sha256!=null)r.certificate_sha256=e._certificate_sha256;else if((e.fingerprint||e["tls-fingerprint"])&&!n&&!r.certificate_public_key_sha256?.length){let s=`${e.fingerprint||e["tls-fingerprint"]}`.trim().replace(/:/g,"");if(!/^[0-9a-f]{64}$/i.test(s))throw new Error(`Platform sing-box: invalid SHA-256 certificate fingerprint for proxy ${e.name}`);r.certificate_sha256=[Dk.Buffer.from(s,"hex").toString("base64")]}if(n&&(r.certificate_sha256?.length||r.certificate_public_key_sha256?.length))throw new Error(`Platform sing-box: certificate_sha256 or certificate_public_key_sha256 conflicts with certificate or certificate_path for proxy ${e.name}`)},Ku=(e,t)=>{if(e.tls&&(t.tls.enabled=!0),e.servername&&e.servername!==""&&(t.tls.server_name=e.servername),e.peer&&e.peer!==""&&(t.tls.server_name=e.peer),e.sni&&e.sni!==""&&(t.tls.server_name=e.sni),e["skip-cert-verify"]&&(t.tls.insecure=!0),e.insecure&&(t.tls.insecure=!0),e["disable-sni"]&&(t.tls.disable_sni=!0),typeof e.alpn=="string"?t.tls.alpn=[e.alpn]:Array.isArray(e.alpn)&&(t.tls.alpn=e.alpn),e["reality-opts"]&&(t.tls.reality={enabled:!0},e["reality-opts"]["public-key"]&&(t.tls.reality.public_key=e["reality-opts"]["public-key"]),e["reality-opts"]["short-id"]&&(t.tls.reality.short_id=e["reality-opts"]["short-id"]),t.tls.utls={enabled:!0}),!["hysteria","hysteria2","tuic"].includes(e.type)&&e["client-fingerprint"]&&e["client-fingerprint"]!==""){let r=Ik(e["client-fingerprint"]);r&&(t.tls.utls={...t.tls.utls,enabled:!0,fingerprint:r})}if(e._ech&&Ze(e._ech))t.tls.ech=e._ech;else if(e["ech-opts"]&&Ze(e["ech-opts"])){t.tls.ech=t.tls.ech||{},t.tls.ech.enabled=e["ech-opts"].enable;let r=e["ech-opts"].config;if(Array.isArray(r)||typeof r=="string"){let n=Vse(r,"ECH CONFIGS");n&&(t.tls.ech.config=n)}t.tls.ech.query_server_name=e["ech-opts"]["query-server-name"],t.tls.ech.config_path=e["ech-opts"]["config-path"],t.tls.ech.fragment=e["ech-opts"].fragment,t.tls.ech.fragment_fallback_delay=e["ech-opts"]["fragment-fallback-delay"],t.tls.ech.record_fragment=e["ech-opts"]["record-fragment"]}e._curve_preferences&&Array.isArray(e._curve_preferences)&&(t.tls.curve_preferences=e._curve_preferences),e._fragment&&(t.tls.fragment=!!e._fragment),e._fragment_fallback_delay&&(t.tls.fragment_fallback_delay=e._fragment_fallback_delay),e._record_fragment&&(t.tls.record_fragment=!!e._record_fragment),e._client_certificate&&(t.tls.client_certificate=e._client_certificate),e._client_certificate_path&&(t.tls.client_certificate_path=e._client_certificate_path),e._client_key&&(t.tls.client_key=e._client_key),e._client_key_path&&(t.tls.client_key_path=e._client_key_path),t.tls.enabled?$k(e,t):delete t.tls},zse=(e={})=>{let t={tag:e.name,type:"ssh",server:e.server,server_port:parseInt(`${e.port}`,10)};if(t.server_port<0||t.server_port>65535)throw"invalid port";e.username&&(t.user=e.username),e.password&&(t.password=e.password);let r=e["private-key"]||e.privateKey;return r&&(t[r.includes("PRIVATE KEY")?"private_key":"private_key_path"]=r),e["private-key-passphrase"]&&(t.private_key_passphrase=e["private-key-passphrase"]),e["server-fingerprint"]&&(t.host_key=[e["server-fingerprint"]],t.host_key_algorithms=[e["server-fingerprint"].split(" ")[0]]),e["host-key"]&&(t.host_key=e["host-key"]),e["host-key-algorithms"]&&(t.host_key_algorithms=e["host-key-algorithms"]),e["fast-open"]&&(t.udp_fragment=!0),Is(e,t),Un(e,t),Nn(e,t),Ln(e,t),t},Yse=(e={})=>{let t={tag:e.name,type:"http",server:e.server,server_port:parseInt(`${e.port}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";if(e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.headers){t.headers={};for(let r of Object.keys(e.headers))t.headers[r]=`${e.headers[r]}`;Object.keys(t.headers).length===0&&delete t.headers}return e["fast-open"]&&(t.udp_fragment=!0),Is(e,t),Un(e,t),Ku(e,t),Nn(e,t),Ln(e,t),t},Wse=(e={})=>{let t={tag:e.name,type:"socks",server:e.server,server_port:parseInt(`${e.port}`,10),version:"5"};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),e["fast-open"]&&(t.udp_fragment=!0),Oo(e,t),Is(e,t),Un(e,t),Nn(e,t),Ln(e,t),t},Xse=(e={})=>{let t=Nw(e),r={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:Lw(e)};return e.uot&&(r.udp_over_tcp=!0),e["udp-over-tcp"]&&(r.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),Oo(e,r),No(e.smux,r),{type:"ss-with-st",ssPart:r,stPart:NC(e,t)}},Lw=(e={})=>`${e.name}_shadowtls`,Nw=(e={})=>{if(e.plugin==="shadow-tls"&&e["plugin-opts"])return e["plugin-opts"];if(e.type==="snell"&&e["obfs-opts"]?.mode==="shadow-tls")return{host:e["obfs-opts"].host,password:e["obfs-opts"].password,version:e["obfs-opts"].version,alpn:e["obfs-opts"].alpn}},Ck=e=>{if(typeof e=="string")return e.split(",").map(t=>t.trim()).filter(t=>t!=="");if(Array.isArray(e))return e},NC=(e={},t)=>{if(!t)throw new Error("shadow-tls plugin options are missing");let r=Ik(e["client-fingerprint"]),n={tag:Lw(e),type:"shadowtls",server:e.server,server_port:parseInt(`${e.port}`,10),version:t.version,password:t.password,tls:{enabled:!0,server_name:t.host}};if(e["skip-cert-verify"]&&(n.tls.insecure=!0),r&&(n.tls.utls={enabled:!0,fingerprint:r}),n.server_port<0||n.server_port>65535)throw"\u7AEF\u53E3\u503C\u975E\u6CD5";let s=Ck(t.alpn)??Ck(e.alpn);return s&&(n.tls.alpn=s),$k(e,n),e["fast-open"]===!0&&(n.udp_fragment=!0),Is(e,n),Un(e,n),Nn(e,n),Ln(e,n),n},Jse=(e={})=>{let t={tag:e.name,type:"shadowsocks",server:e.server,server_port:parseInt(`${e.port}`,10),method:e.cipher,password:e.password};if(t.server_port<0||t.server_port>65535)throw"invalid port";if(e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),e["fast-open"]&&(t.udp_fragment=!0),Oo(e,t),Is(e,t),Un(e,t),No(e.smux,t),Nn(e,t),Ln(e,t),e.plugin){let r=[];e.plugin==="obfs"&&(t.plugin="obfs-local",t.plugin_opts="",e["obfs-host"]&&(e["plugin-opts"].host=e["obfs-host"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"mode":r.push(`obfs=${e["plugin-opts"].mode}`);break;case"host":r.push(`obfs-host=${e["plugin-opts"].host}`);break;default:r.push(`${n}=${e["plugin-opts"][n]}`);break}})),e.plugin==="v2ray-plugin"&&(t.plugin="v2ray-plugin",e["ws-host"]&&(e["plugin-opts"].host=e["ws-host"]),e["ws-path"]&&(e["plugin-opts"].path=e["ws-path"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"tls":e["plugin-opts"].tls&&r.push("tls");break;case"host":r.push(`host=${e["plugin-opts"].host}`);break;case"path":r.push(`path=${e["plugin-opts"].path}`);break;case"headers":r.push(`headers=${JSON.stringify(e["plugin-opts"].headers)}`);break;case"mux":{let s=_1(e["plugin-opts"].mux);s&&(t.multiplex={enabled:!0}),r.push(`mux=${s}`);break}default:r.push(`${n}=${e["plugin-opts"][n]}`)}})),t.plugin_opts=r.join(";")}return t},Zse=(e={})=>{let t={tag:e.name,type:"shadowsocksr",server:e.server,server_port:parseInt(`${e.port}`,10),method:e.cipher,password:e.password,obfs:e.obfs,protocol:e.protocol};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["obfs-param"]&&(t.obfs_param=e["obfs-param"]),e["protocol-param"]&&e["protocol-param"]!==""&&(t.protocol_param=e["protocol-param"]),e["fast-open"]&&(t.udp_fragment=!0),Oo(e,t),Is(e,t),Un(e,t),No(e.smux,t),Nn(e,t),Ln(e,t),t},Qse=e=>{if(e==null)return;let t=`${e}`.trim();return/^\d+$/.test(t)?parseInt(t,10):NaN},eie=(e={},t=!1)=>{let r=Qse(e.version),n=Nw(e),s=t?[1,2,3,4,5,6]:[4,5,6];if(r!=null&&(!s.includes(r)||Number.isNaN(r)))throw new Error(`Platform sing-box does not support snell version ${e.version}`);let o=!t&&r===5?4:r,i={tag:e.name,type:"snell",server:e.server,server_port:parseInt(`${e.port}`,10),psk:e.psk};if(i.server_port<0||i.server_port>65535)throw"invalid port";return o!=null&&(i.version=o),(e.userkey||e._userkey)&&(i.userkey=e.userkey||e._userkey),o===6?(e.mode&&(i.mode=e.mode),t&&e["quic-proxy-mode"]&&(i.quic_proxy_mode=!!e["quic-proxy-mode"])):(e["obfs-opts"]?.mode&&e["obfs-opts"].mode!=="shadow-tls"&&(i.obfs_mode=e["obfs-opts"].mode),e["obfs-opts"]?.host&&e["obfs-opts"]?.mode!=="shadow-tls"&&(i.obfs_host=e["obfs-opts"].host)),e.reuse&&(r==null||r>=4)&&(i.reuse=!0),Oo(e,i),n?(i.detour=Lw(e),delete i.server,delete i.server_port):(e["fast-open"]&&(i.udp_fragment=!0),Is(e,i),Un(e,i),Nn(e,i),Ln(e,i)),i},tie=["","packetaddr","xudp"],rie=e=>{let t=`${e}`.trim().toLowerCase();if(tie.includes(t))return t},xk=(e,t)=>{if(e["packet-encoding"]!=null){let r=rie(e["packet-encoding"]);r!=null&&(t.packet_encoding=r)}else e.xudp?t.packet_encoding="xudp":e["packet-addr"]&&(t.packet_encoding="packetaddr")},nie=(e,t)=>{xk(e,t),e["global-padding"]!=null&&(t.global_padding=!!e["global-padding"]),e["authenticated-length"]!=null&&(t.authenticated_length=!!e["authenticated-length"])},sie=(e={})=>{let t={tag:e.name,type:"vmess",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,security:cn(e.cipher),alter_id:parseInt(`${e.alterId}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return nie(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.network==="ws"&&LC(e,t),e.network==="h2"&&Bk(e,t),e.network==="http"&&Fk(e,t),e.network==="grpc"&&UC(e,t),Oo(e,t),Is(e,t),Un(e,t),Ku(e,t),No(e.smux,t),Nn(e,t),Ln(e,t),t},iie=(e={})=>{let t={tag:e.name,type:"vless",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return xk(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.flow!=null&&(t.flow=e.flow),e.network==="ws"&&LC(e,t),e.network==="h2"&&Bk(e,t),e.network==="http"&&Fk(e,t),e.network==="grpc"&&UC(e,t),Oo(e,t),Is(e,t),Un(e,t),No(e.smux,t),Ku(e,t),Nn(e,t),Ln(e,t),t},oie=(e={})=>{let t={tag:e.name,type:"trojan",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["fast-open"]&&(t.udp_fragment=!0),e.network==="grpc"&&UC(e,t),e.network==="ws"&&LC(e,t),Oo(e,t),Is(e,t),Un(e,t),Ku(e,t),No(e.smux,t),Nn(e,t),Ln(e,t),t},aie=(e={})=>{let t={tag:e.name,type:"naive",server:e.server,server_port:parseInt(`${e.port}`,10),tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2});let r=parseInt(`${e["insecure-concurrency"]}`,10);return Number.isInteger(r)&&r>=0&&(t.insecure_concurrency=r),e["extra-headers"]&&(t.extra_headers=e["extra-headers"]),e.quic&&(t.quic=!!e.quic),e["quic-congestion-control"]&&(t.quic_congestion_control=e["quic-congestion-control"]),e["fast-open"]&&(t.udp_fragment=!0),Is(e,t),Un(e,t),Ku(e,t),No(e.smux,t),Nn(e,t),Ln(e,t),t.tls?.insecure&&(R.info("Platform sing-box: insecure is not supported on naive outbound"),delete t.tls.insecure),t},uie=(e={})=>{let t={tag:e.name,type:"hysteria",server:e.server,server_port:parseInt(`${e.port}`,10),disable_mtu_discovery:!1,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(n=>{let s=n.replace(/\s*-\s*/g,":");return s.includes(":")?s:`${s}:${s}`})),e.auth_str&&(t.auth_str=`${e.auth_str}`),e["auth-str"]&&(t.auth_str=`${e["auth-str"]}`),e["fast-open"]&&(t.udp_fragment=!0);let r=new RegExp("^[0-9]+[ ]*[KMGT]*[Bb]ps$");return r.test(`${e.up}`)&&!`${e.up}`.endsWith("Mbps")?t.up=`${e.up}`:t.up_mbps=parseInt(`${e.up}`,10),r.test(`${e.down}`)&&!`${e.down}`.endsWith("Mbps")?t.down=`${e.down}`:t.down_mbps=parseInt(`${e.down}`,10),e.obfs&&(t.obfs=e.obfs),e.recv_window_conn&&(t.recv_window_conn=e.recv_window_conn),e["recv-window-conn"]&&(t.recv_window_conn=e["recv-window-conn"]),e.recv_window&&(t.recv_window=e.recv_window),e["recv-window"]&&(t.recv_window=e["recv-window"]),e.disable_mtu_discovery&&(typeof e.disable_mtu_discovery=="boolean"?t.disable_mtu_discovery=e.disable_mtu_discovery:e.disable_mtu_discovery===1&&(t.disable_mtu_discovery=!0)),Oo(e,t),Ku(e,t),Un(e,t),Is(e,t),No(e.smux,t),Nn(e,t),Ln(e,t),t},cie=(e={})=>{let t={tag:e.name,type:"hysteria2",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,obfs:{},tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";if(e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(r=>{let n=r.replace(/\s*-\s*/g,":");return n.includes(":")?n:`${n}:${n}`})),e.up&&(t.up_mbps=parseInt(`${e.up}`,10)),e.down&&(t.down_mbps=parseInt(`${e.down}`,10)),["salamander","gecko"].includes(e.obfs)&&(t.obfs.type=e.obfs),e.obfs==="gecko"){let r=e["obfs-min-packet-size"],n=e["obfs-max-packet-size"],s=r!=null&&`${r}`!="",o=n!=null&&`${n}`!="";if(s||o){let i=s?Yi(`${r}`.trim()):void 0,a=o?Yi(`${n}`.trim()):void 0,u=a!=null?Math.min(a,2048):a,l=i??512,f=u??1200;o&&a!=null&&a>2048&&R.warn(`Gecko obfs max packet size for proxy ${e.name} exceeds 2048, clamped to 2048: ${n}`),s&&(i==null||i<=0)||o&&(a==null||a<=0)||f<l?R.error(`Invalid obfs packet size for proxy ${e.name}: min=${r} max=${n}`):(s&&(t.obfs.min_packet_size=i),o&&(t.obfs.max_packet_size=u))}}return e["obfs-password"]&&(t.obfs.password=e["obfs-password"]),t.obfs.type||delete t.obfs,e["bbr-profile"]&&(t.bbr_profile=e["bbr-profile"]),e["disable-chrome-parrot"]&&(t.disable_chrome_parrot=!!e["disable-chrome-parrot"]),Oo(e,t),Ku(e,t),Is(e,t),Un(e,t),No(e.smux,t),Nn(e,t),Ln(e,t),t},lie=(e={})=>{let t={tag:e.name,type:"tuic",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["fast-open"]&&(t.udp_fragment=!0),e["congestion-controller"]&&e["congestion-controller"]!=="cubic"&&(t.congestion_control=e["congestion-controller"]),e["udp-relay-mode"]&&e["udp-relay-mode"]!=="native"&&(t.udp_relay_mode=e["udp-relay-mode"]),e["reduce-rtt"]&&(t.zero_rtt_handshake=!0),e["udp-over-stream"]&&(t.udp_over_stream=!0),e["heartbeat-interval"]&&(t.heartbeat=`${e["heartbeat-interval"]}ms`),Oo(e,t),Is(e,t),Un(e,t),Ku(e,t),No(e.smux,t),Nn(e,t),Ln(e,t),t},fie=(e={},t=!1)=>{let r={tag:e.name,type:"anytls",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};return e["client-metadata"]&&(r.client_metadata=`${e["client-metadata"]}`),/^\d+$/.test(e["idle-session-check-interval"])&&(r.idle_session_check_interval=`${e["idle-session-check-interval"]}s`),/^\d+$/.test(e["idle-session-timeout"])&&(r.idle_session_timeout=`${e["idle-session-timeout"]}s`),/^\d+$/.test(e["min-idle-session"])&&(r.min_idle_session=parseInt(`${e["min-idle-session"]}`,10)),e["disable-reuse"]!=null&&(r.disable_reuse=!!e["disable-reuse"]),Un(e,r),Ku(e,r),Nn(e,r),Ln(e,r),r},die=(e={})=>{let t=Kse(e),r=Yi(e._listen_port),n={tag:e.name,type:"tailscale",listen_port:r!=null&&r<=65535?r:void 0,taildrop_directory:typeof e._taildrop_directory=="string"?e._taildrop_directory:void 0,on_demand:typeof e._on_demand=="boolean"?e._on_demand:void 0,control_http_client:e["control-http-client"],udp_timeout:e["udp-timeout"],state_directory:e["state-dir"]||e["state-directory"],auth_key:e["auth-key"],control_url:e["control-url"],ephemeral:e.ephemeral,hostname:e.hostname,accept_routes:e["accept-routes"],exit_node:e["exit-node"],exit_node_allow_lan_access:e["exit-node-allow-lan-access"],advertise_routes:Array.isArray(e["advertise-routes"])?e["advertise-routes"]:void 0,advertise_exit_node:e["advertise-exit-node"],advertise_tags:Array.isArray(e["advertise-tags"])?e["advertise-tags"]:void 0,relay_server_static_endpoints:Array.isArray(e["relay-server-static-endpoints"])?e["relay-server-static-endpoints"]:void 0,system_interface:e["system-interface"],system_interface_name:e["system-interface-name"]};return/^\d+$/.test(e["system-interface-mtu"])&&(n.system_interface_mtu=parseInt(`${e["system-interface-mtu"]}`,10)),/^\d+$/.test(e["relay-server-port"])&&(n.relay_server_port=parseInt(`${e["relay-server-port"]}`,10)),t||(Un(e,n),Nn(e,n),Ln(e,n)),Ze(e["ssh-server"])?n.ssh_server={enabled:e["ssh-server"].enabled!==!1,disable_pty:e["ssh-server"]["disable-pty"],disable_sftp:e["ssh-server"]["disable-sftp"],disable_forwarding:e["ssh-server"]["disable-forwarding"]}:e["ssh-server"]&&(n.ssh_server=!!e["ssh-server"]),n},hie=(e={})=>{let t=["ipv4","ipv6"].map(o=>Qs(e,o)).filter(o=>o),r=Yi(e._listen_port),n=Yi(e._udp_nat_max),s={system:!!e.system,name:typeof e._name=="string"?e._name:void 0,listen_port:r!=null&&r<=65535?r:void 0,on_demand:typeof e._on_demand=="boolean"?e._on_demand:void 0,mtu:e.mtu?parseInt(`${e.mtu}`,10):void 0,udp_timeout:e["udp-timeout"],udp_nat_max:n!=null&&n<=4294967295?n:void 0,workers:e.workers?parseInt(`${e.workers}`,10):void 0,tag:e.name,type:"wireguard",server:e.server,server_port:parseInt(`${e.port}`,10),address:t,private_key:e["private-key"],peer_public_key:e["public-key"],pre_shared_key:e["pre-shared-key"],reserved:[]};for(let o of["udp_mapping","udp_filtering"])["endpoint_independent","address_dependent","address_and_port_dependent"].includes(e[`_${o}`])&&(s[o]=e[`_${o}`]);if(s.server_port<0||s.server_port>65535)throw"invalid port";if(e["fast-open"]&&(s.udp_fragment=!0),typeof e.reserved=="string")s.reserved=e.reserved;else if(Array.isArray(e.reserved))for(let o of e.reserved)s.reserved.push(o);else delete s.reserved;if((!Array.isArray(e.peers)||e.peers.length===0)&&(e.peers=[{}]),e.peers&&e.peers.length>0){s.peers=[];for(let o of e.peers){let i,a;o.server&&o.port?(i=o.server,a=parseInt(`${o.port}`,10)):(i=s.server,a=parseInt(`${s.server_port}`,10));let u=o["allowed-ips"]||o.allowed_ips||e["allowed-ips"]||e.allowed_ips;typeof u=="string"&&(u=u.split(",").map(f=>f.trim()).filter(Boolean)),(!Array.isArray(u)||u.length===0)&&(u=["0.0.0.0/0",...e.ipv6?["::/0"]:[]]);let l={address:i,port:a,persistent_keepalive_interval:o["persistent-keepalive-interval"]?parseInt(`${o["persistent-keepalive-interval"]}`,10):void 0,public_key:o["public-key"]||o.public_key||s.peer_public_key,pre_shared_key:o["pre-shared-key"]||o.pre_shared_key||s.pre_shared_key,allowed_ips:u,reserved:[]};if(typeof o.reserved=="string")l.reserved.push(o.reserved);else if(Array.isArray(o.reserved))for(let f of o.reserved)l.reserved.push(f);else delete l.reserved;(!Array.isArray(l.reserved)||l.reserved.length===0)&&(l.reserved=s.reserved),s.peers.push(l)}}return Is(e,s),Un(e,s),No(e.smux,s),Nn(e,s),Ln(e,s),delete s.server,delete s.server_port,delete s.pre_shared_key,delete s.peer_public_key,delete s.reserved,s}});function Hw(){return{type:"ALL",produce:(r,n,s={})=>{let o=r.filter(i=>!["http","https","socks5","ss","ssr","trojan","hysteria2","vless","vmess","tuic","wireguard","anytls","ssh","snell"].includes(i.type)||i.type==="ss"&&(i.plugin==="obfs"&&!["http","tls"].includes(i["plugin-opts"]?.mode)||!["chacha20-ietf-poly1305","chacha20-poly1305","aes-256-gcm","aes-128-gcm","none","tbale","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(i.cipher))||i.type==="vmess"&&(!["h2","http","ws","tcp","grpc"].includes(i.network)&&i.network||!Ok(i))||i.type==="trojan"&&!["http","ws","tcp"].includes(i.network)&&i.network||i.type==="vless"&&(!["h2","http","ws","tcp","grpc"].includes(i.network)&&i.network||!Ok(i)||typeof i.flow<"u"&&!["xtls-rprx-vision",""].includes(i.flow))||i.type==="tuic"&&i.token&&i.token.length!==0||i.type==="snell"&&Nk(i.version)===null||i.type==="ssr"&&!wie(i)||["anytls"].includes(i.type)&&i.network&&!["tcp"].includes(i.network)?!1:!(["ws"].includes(i.network)&&i["ws-opts"]?.["v2ray-http-upgrade"])).map(i=>{let a=i;try{let u={...i},l;i.tls&&!i.sni&&(i.sni=i.server);let f=i.prev_hop||i["underlying-proxy"]||i["dialer-proxy"]||i.detour;if(i.type==="http")i={type:i.tls?"https":"http",name:i.name,server:i.server,port:i.port,username:i.username,password:i.password,...Tk(i)?{headers:i.headers}:{},tfo:Wi(i),...i.tls?{sni:i.sni,skip_tls_verify:i["skip-cert-verify"],reality:$f(i)}:{}};else if(i.type==="https")i={type:"https",name:i.name,server:i.server,port:i.port,username:i.username,password:i.password,...Tk(i)?{headers:i.headers}:{},tfo:Wi(i),sni:i.sni,skip_tls_verify:i["skip-cert-verify"],reality:$f(i)};else if(i.type==="socks5")i={type:i.tls?"socks5_tls":"socks5",name:i.name,server:i.server,port:i.port,username:i.username,password:i.password,tfo:Wi(i),udp_relay:Vu(i),...i.tls?{sni:i.sni,skip_tls_verify:i["skip-cert-verify"],reality:$f(i)}:{}};else if(i.type==="ss"){if(i={type:"shadowsocks",name:i.name,method:i.cipher==="chacha20-ietf-poly1305"?"chacha20-poly1305":i.cipher,server:i.server,port:i.port,password:i.password,tfo:Wi(i),udp_relay:Vu(i)},fe(u,"plugin")){if(u.plugin==="obfs")i.obfs=u["plugin-opts"].mode,i.obfs_host=u["plugin-opts"].host,i.obfs_uri=u["plugin-opts"].path;else if(!["shadow-tls"].includes(u.plugin))throw new Error(`plugin ${u.plugin} is not supported`)}}else if(i.type==="ssr")i={type:"shadowsocksr",name:i.name,method:Uk(i.cipher),server:i.server,port:i.port,password:i.password,protocol:k1(i.protocol),protocol_param:i["protocol-param"],obfs:k1(i.obfs),obfs_param:i["obfs-param"],tfo:Wi(i),udp_relay:Vu(i)};else if(i.type==="hysteria2")i={type:"hysteria2",name:i.name,server:i.server,port:i.port,auth:i.password,...fe(i,"up")?{bandwidth:parseInt(`${i.up}`.match(/\d+/)?.[0]||0,10)}:{},tfo:Wi(i),udp_relay:Vu(i),sni:i.sni,skip_tls_verify:i["skip-cert-verify"],port_hopping:i.ports,port_hopping_interval:i["hop-interval"]},u["obfs-password"]&&u.obfs=="salamander"&&(i.obfs="salamander",i.obfs_password=u["obfs-password"]);else if(i.type==="tuic")i={type:"tuic",name:i.name,server:i.server,port:i.port,uuid:i.uuid,password:i.password,sni:i.sni,alpn:Array.isArray(i.alpn)?i.alpn:[i.alpn||"h3"],skip_tls_verify:i["skip-cert-verify"],port_hopping:i.ports,port_hopping_interval:i["hop-interval"]};else if(i.type==="trojan")i.network==="ws"&&(i.websocket={path:i["ws-opts"]?.path,host:i["ws-opts"]?.headers?.Host}),i={type:"trojan",name:i.name,server:i.server,port:i.port,password:i.password,tfo:Wi(i),udp_relay:Vu(i),sni:i.sni,skip_tls_verify:i["skip-cert-verify"],reality:$f(i),websocket:i.websocket};else if(i.type==="anytls")i={type:"anytls",name:i.name,server:i.server,port:i.port,password:i.password,tfo:Wi(i),udp_relay:Vu(i),sni:i.sni,skip_tls_verify:i["skip-cert-verify"],reality:$f(i)};else if(i.type==="vmess"){let p=cn(i.cipher);i.network==="ws"?i.transport={[i.tls?"wss":"ws"]:{path:i["ws-opts"]?.path,headers:{Host:i["ws-opts"]?.headers?.Host},sni:i.tls?i.sni:void 0,skip_tls_verify:i.tls?i["skip-cert-verify"]:void 0}}:i.network==="http"?i.transport={http1:{method:i["http-opts"]?.method,path:Array.isArray(i["http-opts"]?.path)?i["http-opts"]?.path[0]:i["http-opts"]?.path,headers:{Host:Array.isArray(i["http-opts"]?.headers?.Host)?i["http-opts"]?.headers?.Host[0]:i["http-opts"]?.headers?.Host},skip_tls_verify:i["skip-cert-verify"]}}:i.network==="h2"?i.transport={http2:{method:i["h2-opts"]?.method,path:Array.isArray(i["h2-opts"]?.path)?i["h2-opts"]?.path[0]:i["h2-opts"]?.path,headers:Lk(i["h2-opts"]),sni:i.sni,skip_tls_verify:i["skip-cert-verify"]}}:i.network==="grpc"?i.transport=Pk(i):(i.network==="tcp"||!i.network)&&i.tls&&(i.transport={tls:{sni:i.tls?i.sni:void 0,skip_tls_verify:i.tls?i["skip-cert-verify"]:void 0}});let d=!1;(fe(i,"aead")&&!i.aead||fe(i,"alterId")&&i.alterId!==0)&&(d=!0),i={type:"vmess",name:i.name,server:i.server,port:i.port,user_id:i.uuid,security:p,tfo:Wi(i),legacy:d,udp_relay:Vu(i),transport:i.transport}}else if(i.type==="vless"){if(i.encryption&&i.encryption!=="none")throw new Error("VLESS encryption is not supported");i.network==="ws"?i.transport={[i.tls?"wss":"ws"]:{path:i["ws-opts"]?.path,headers:{Host:i["ws-opts"]?.headers?.Host},sni:i.tls?i.sni:void 0,skip_tls_verify:i.tls?i["skip-cert-verify"]:void 0}}:i.network==="http"?i.transport={http1:{method:i["http-opts"]?.method,path:Array.isArray(i["http-opts"]?.path)?i["http-opts"]?.path[0]:i["http-opts"]?.path,headers:{Host:Array.isArray(i["http-opts"]?.headers?.Host)?i["http-opts"]?.headers?.Host[0]:i["http-opts"]?.headers?.Host},skip_tls_verify:i["skip-cert-verify"]}}:i.network==="h2"?i.transport={http2:{method:i["h2-opts"]?.method,path:Array.isArray(i["h2-opts"]?.path)?i["h2-opts"]?.path[0]:i["h2-opts"]?.path,headers:Lk(i["h2-opts"]),sni:i.sni,skip_tls_verify:i["skip-cert-verify"]}}:i.network==="grpc"?i.transport=Pk(i):(i.network==="tcp"||!i.network)&&(i.transport={[i.tls?"tls":"tcp"]:{sni:i.tls?i.sni:void 0,skip_tls_verify:i.tls?i["skip-cert-verify"]:void 0,reality:$f(i)}},l=i.flow,l===""&&(l=void 0)),i={type:"vless",name:i.name,server:i.server,port:i.port,user_id:i.uuid,security:i.cipher,tfo:Wi(i),udp_relay:Vu(i),transport:i.transport,flow:l}}else if(i.type==="wireguard")Array.isArray(i.peers)&&i.peers.length>0&&(i.server=i.peers[0].server,i.port=i.peers[0].port,i.ip=i.peers[0].ip,i.ipv6=i.peers[0].ipv6,i["public-key"]=i.peers[0]["public-key"],i["preshared-key"]=i.peers[0]["pre-shared-key"],i["allowed-ips"]=i.peers[0]["allowed-ips"],i.reserved=i.peers[0].reserved),i={type:"wireguard",name:i.name,local_ipv4:Qs(i,"ipv4"),local_ipv6:Qs(i,"ipv6"),server:i.server,port:i.port,private_key:i["private-key"],peer_public_key:i["public-key"],preshared_key:i["preshared-key"]??i["pre-shared-key"],reserved:i.reserved?Array.isArray(i.reserved)?i.reserved:i.reserved.split(/\s*\/\s*/).map(p=>p.trim()).filter(p=>p.length>0):void 0,dns_servers:i.dns?Array.isArray(i.dns)?i.dns:i.dns.split(/\s*,\s*/).map(p=>p.trim()).filter(p=>p.length>0):void 0,mtu:i.mtu,keepalive:i.keepalive};else if(i.type==="ssh")i={type:"ssh",name:i.name,server:i.server,port:i.port,username:i.username,password:i.password,private_key:i["private-key"],host_keys:i["host-key"],tfo:Wi(i)};else if(i.type==="snell"){let p=Nk(i.version);i={type:"snell",name:i.name,server:i.server,port:i.port,psk:i.psk,version:p,...p==null||p>=3?{udp_relay:Vu(i)}:{},reuse:i.reuse,obfs:i["obfs-opts"]?.mode||i.obfs,obfs_host:i["obfs-opts"]?.host||i["obfs-host"]||i.obfs_host,tfo:Wi(i)}}if(["http","https","socks5","ss","ssr","trojan","vless","vmess","anytls","ssh","snell"].includes(u.type)&&["shadow-tls"].includes(u.plugin)&&u["plugin-opts"]){if(u["plugin-opts"].version!=3)throw new Error(`shadow-tls version ${u["plugin-opts"].version} is not supported`);i.shadow_tls={password:u["plugin-opts"].password,sni:u["plugin-opts"].host}}let m=bie(u);if(m&&(Aie(u,i)&&(i.fingerprint_sha256=m),Sie(i.transport,m)),["socks5","ss","ssr","trojan","vless","vmess","wireguard","tuic","hysteria2","anytls","ssh","snell"].includes(u.type)&&(["on","true",!0,"1",1].includes(u["block-quic"])?i.block_quic=!0:["off","false",!1,"0",0].includes(u["block-quic"])&&(i.block_quic=!1)),["ss","ssr"].includes(u.type)&&i.shadow_tls&&u["udp-port"]>0&&u["udp-port"]<=65535&&(i.udp_port=u["udp-port"]),u["ip-version"]&&(i.ip_version=pie[u["ip-version"]]||u["ip-version"]),delete i.subName,delete i.collectionName,delete i.id,delete i.resolved,delete i["no-resolve"],i.transport){for(let p in i.transport)p!=="grpc"&&(Object.keys(i.transport[p]).length===0||Object.values(i.transport[p]).every(d=>d==null))&&delete i.transport[p];Object.keys(i.transport).length===0&&delete i.transport}if(n!=="internal")for(let p in i)(i[p]==null||/^_/i.test(p))&&delete i[p];return{[i.type]:{...i,type:void 0,prev_hop:f}}}catch(u){return R.error(`Cannot produce proxy: ${i.name}
|
||
Reason: ${u}`),null}}).filter(Boolean);return Ra(o,n,s)}}}function Tk(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function Wi(e){return!!(e.tfo??e["fast-open"])}function Vu(e){return e.udp??e.udp_relay}function kk(e){if(e!=null&&!(typeof e=="string"&&e.length===0))return e}function $f(e){let t=e?.["reality-opts"];if(!t)return;let r={},n=kk(t["public-key"]),s=kk(t["short-id"]);return n!=null&&(r.public_key=n),s!=null&&(r.short_id=s),Object.keys(r).length>0?r:void 0}function Pk(e){return{grpc:{service_name:e["grpc-opts"]?.["grpc-service-name"],sni:e.sni,reality:$f(e),skip_tls_verify:e["skip-cert-verify"]}}}function Ok(e){if(e.network!=="grpc")return!0;let t=e["grpc-opts"]?.["_grpc-type"];return t==null?!0:`${t}`.trim().toLowerCase()==="gun"}function Nk(e){if(e==null)return;let t=`${e}`.trim();return/^[1-5]$/.test(t)?parseInt(t,10):null}function k1(e){if(e==null)return;let t=`${e}`.trim().toLowerCase();return t.length>0?t:void 0}function Uk(e){let t=k1(e);return t==="plain"?"none":t}function wie(e){if(!mie.includes(Uk(e.cipher)))return!1;let t=k1(e.protocol);if(t!=null&&!gie.includes(t))return!1;let r=k1(e.obfs);return r==null||vie.includes(r)}function yie(e,...t){for(let r of t){let n=HC(e?.[r]);if(n)return n}}function Eie(e){return HC(e?.host)||yie(e?.headers,"host","Host")}function Lk(e){let t={};if(e?.headers&&typeof e.headers=="object"&&!Array.isArray(e.headers))for(let[n,s]of Object.entries(e.headers)){if(/^host$/i.test(n))continue;let o=HC(s);o!=null&&(t[n]=o)}let r=Eie(e);return r&&(t.Host=r),Object.keys(t).length>0?t:void 0}function HC(e){if(Array.isArray(e))return e[0];if(e!=null)return e}function bie(e){let t=e?.["tls-fingerprint"];if(typeof t!="string")return;let r=t.trim();return r.length>0?r:void 0}function Aie(e,t){return["anytls","https","hysteria2","trojan","tuic"].includes(e.type)||e.type==="socks5"&&t.type==="socks5_tls"||e.type==="http"&&t.type==="https"}function Sie(e,t){if(e)for(let r of["grpc","http2","tls","wss"])e[r]&&(e[r].fingerprint_sha256=t)}var l4e,pie,mie,gie,vie,Hk=re(()=>{l4e=F(I());gt();ei();Si();pie={dual:"dual_stack",ipv4:"v4_only",ipv6:"v6_only","v4-only":"v4_only","v6-only":"v6_only","ipv4-prefer":"v4_prefer","ipv6-prefer":"v6_prefer","prefer-v4":"v4_prefer","prefer-v6":"v6_prefer"};mie=["none","dummy","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","chacha20","chacha20-ietf","xchacha20"],gie=["origin","auth_sha1_v4","auth_aes128_md5","auth_aes128_sha1","auth_chain_a","auth_chain_b"],vie=["plain","http_simple","http_post","random_head","tls1.2_ticket_auth","tls1.2_ticket_fastauth"]});function Mk(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var C4e,Mw,MC=re(()=>{C4e=F(I());EC();DC();ek();Bw();tk();hk();kC();wk();yk();Ek();_k();Rk();Hk();Mw={qx:x1(),QX:x1(),QuantumultX:x1(),surge:Th(),Surge:Th(),SurgeMac:F1(),Loon:$C(),Clash:Iw(),clash:Iw(),meta:_i(),clashmeta:_i(),"clash.meta":_i(),"Clash.Meta":_i(),ClashMeta:_i(),mihomo:_i(),Mihomo:_i(),uri:kh(),URI:kh(),v2:$1(),v2ray:$1(),V2Ray:$1(),json:Mk(),JSON:Mk(),stash:$w(),Stash:$w(),shadowrocket:R1(),Shadowrocket:R1(),ShadowRocket:R1(),surfboard:Ow(),Surfboard:Ow(),singbox:Uw(),"sing-box":Uw(),egern:Hw(),Egern:Hw()}});var qw=be((D4e,qk)=>{"use strict";var F4e=F(I()),_ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},qC=class e extends Error{constructor(t,r,n){super(t),_ie(this,e.prototype),this.name="GrammarError",this.location=r,n===void 0&&(n=[]),this.diagnostics=n,this.stage=null,this.problems=[["error",t,r,n]]}toString(){let t=super.toString();this.location&&(t+=`
|
||
at `,this.location.source!==void 0&&this.location.source!==null&&(t+=`${this.location.source}:`),t+=`${this.location.start.line}:${this.location.start.column}`);for(let r of this.diagnostics)t+=`
|
||
from `,r.location.source!==void 0&&r.location.source!==null&&(t+=`${r.location.source}:`),t+=`${r.location.start.line}:${r.location.start.column}: ${r.message}`;return t}format(t){let r=t.map(({source:o,text:i})=>({source:o,text:i.split(/\r\n|\n|\r/g)}));function n(o,i,a=""){let u="",l=r.find(({source:m})=>m===o.source),f=o.start;if(l){let m=o.end,p=l.text[f.line-1],v=(f.line===m.line?m.column:p.length+1)-f.column||1;a&&(u+=`
|
||
note: ${a}`),u+=`
|
||
--> ${o.source}:${f.line}:${f.column}
|
||
${"".padEnd(i)} |
|
||
${f.line.toString().padStart(i)} | ${p}
|
||
${"".padEnd(i)} | ${"".padEnd(f.column-1)}${"".padEnd(v,"^")}`}else u+=`
|
||
at ${o.source}:${f.line}:${f.column}`,a&&(u+=`: ${a}`);return u}function s(o,i,a,u=[]){let l;a?l=u.reduce((m,{location:p})=>Math.max(m,p.start.line),a.start.line):l=Math.max.apply(null,u.map(m=>m.location.start.line)),l=l.toString().length;let f=`${o}: ${i}`;a&&(f+=n(a,l));for(let m of u)f+=n(m.location,l,m.message);return f}return this.problems.filter(o=>o[0]!=="info").map(o=>s(...o)).join(`
|
||
|
||
`)}};qk.exports=qC});var Xi=be((B4e,jk)=>{"use strict";var I4e=F(I()),Cie={build(e){function t(i,...a){return e[i.type](i,...a)}function r(){}function n(i,...a){return t(i.expression,...a)}function s(i){return function(a,...u){a[i].forEach(l=>t(l,...u))}}let o={grammar(i,...a){i.topLevelInitializer&&t(i.topLevelInitializer,...a),i.initializer&&t(i.initializer,...a),i.rules.forEach(u=>t(u,...a))},top_level_initializer:r,initializer:r,rule:n,named:n,choice:s("alternatives"),action:n,sequence:s("elements"),labeled:n,text:n,simple_and:n,simple_not:n,optional:n,zero_or_more:n,one_or_more:n,group:n,semantic_and:r,semantic_not:r,rule_ref:r,literal:r,class:r,any:r};return Object.keys(o).forEach(i=>{Object.prototype.hasOwnProperty.call(e,i)||(e[i]=o[i])}),t}};jk.exports=Cie});var al=be(($4e,Vk)=>{"use strict";var x4e=F(I()),Die=Xi(),Kk={findRule(e,t){for(let r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return e.rules[r]},indexOfRule(e,t){for(let r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return r;return-1},alwaysConsumesOnSuccess(e,t){function r(){return!0}function n(){return!1}let s=Die.build({choice(o){return o.alternatives.every(s)},sequence(o){return o.elements.some(s)},simple_and:n,simple_not:n,optional:n,zero_or_more:n,semantic_and:n,semantic_not:n,rule_ref(o){let i=Kk.findRule(e,o.name);return i?s(i):void 0},literal(o){return o.value!==""},class:r,any:r});return s(t)}};Vk.exports=Kk});var jC=be((R4e,Gk)=>{"use strict";var T4e=F(I()),Fie={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29};Gk.exports=Fie});var KC=be((k4e,zk)=>{"use strict";var P4e=F(I()),Bie=Xi(),Iie=al(),$ie=qw(),P1=1,xf=0,O1=-1;function jw(e){function t(i){return i.match=xf}function r(i){return o(i.expression),i.match=P1}function n(i){return i.match=o(i.expression)}function s(i,a){let u=i.length,l=0,f=0;for(let m=0;m<u;++m){let p=o(i[m]);p===P1&&++l,p===O1&&++f}return l===u?P1:a?f===u?O1:xf:f>0?O1:xf}let o=Bie.build({rule(i){let a,u=0;if(typeof i.match>"u"){i.match=xf;do if(a=i.match,i.match=o(i.expression),++u>6)throw new $ie("Infinity cycle detected when trying to evaluate node match result",i.location);while(a!==i.match)}return i.match},named:n,choice(i){return i.match=s(i.alternatives,!0)},action:n,sequence(i){return i.match=s(i.elements,!1)},labeled:n,text:n,simple_and:n,simple_not(i){return i.match=-o(i.expression)},optional:r,zero_or_more:r,one_or_more:n,group:n,semantic_and:t,semantic_not:t,rule_ref(i){let a=Iie.findRule(e,i.name);return i.match=o(a)},literal(i){let a=i.value.length===0?P1:xf;return i.match=a},class(i){let a=i.parts.length===0?O1:xf;return i.match=a},any:t});o(e)}jw.ALWAYS_MATCH=P1;jw.SOMETIMES_MATCH=xf;jw.NEVER_MATCH=O1;zk.exports=jw});var Wk=be((O4e,Yk)=>{"use strict";var N4e=F(I()),xie=al(),je=jC(),Rie=Xi(),{ALWAYS_MATCH:Ph,SOMETIMES_MATCH:VC,NEVER_MATCH:GC}=KC();function Tie(e){let t=[],r=[],n=[],s=[];function o(E){let S=t.indexOf(E);return S===-1?t.push(E)-1:S}function i(E){let S={value:E.parts,inverted:E.inverted,ignoreCase:E.ignoreCase},C=JSON.stringify(S),D=r.findIndex(H=>JSON.stringify(H)===C);return D===-1?r.push(S)-1:D}function a(E){let S=JSON.stringify(E),C=n.findIndex(D=>JSON.stringify(D)===S);return C===-1?n.push(E)-1:C}function u(E,S,C){let D={predicate:E,params:S,body:C.code,location:C.codeLocation},H=JSON.stringify(D),K=s.findIndex(_=>JSON.stringify(_)===H);return K===-1?s.push(D)-1:K}function l(E){let S={};return Object.keys(E).forEach(C=>{S[C]=E[C]}),S}function f(E,...S){return E.concat(...S)}function m(E,S,C,D){return E===Ph?C:E===GC?D:S.concat([C.length,D.length],C,D)}function p(E,S){return E.concat([S.length],S)}function d(E,S,C,D){let H=Object.keys(C).map(K=>D-C[K]);return[je.CALL,E,S,H.length].concat(H)}function v(E,S,C){let D=E.match|0;return f([je.PUSH_CURR_POS],[je.SILENT_FAILS_ON],w(E,{sp:C.sp+1,env:l(C.env),action:null}),[je.SILENT_FAILS_OFF],m(S?-D:D,[S?je.IF_ERROR:je.IF_NOT_ERROR],f([je.POP],[S?je.POP:je.POP_CURR_POS],[je.PUSH_UNDEFINED]),f([je.POP],[S?je.POP_CURR_POS:je.POP],[je.PUSH_FAILED])))}function g(E,S,C){let D=u(!0,Object.keys(C.env),E);return f([je.UPDATE_SAVED_POS],d(D,0,C.env,C.sp),m(E.match|0,[je.IF],f([je.POP],S?[je.PUSH_FAILED]:[je.PUSH_UNDEFINED]),f([je.POP],S?[je.PUSH_UNDEFINED]:[je.PUSH_FAILED])))}function y(E){return p([je.WHILE_NOT_ERROR],f([je.APPEND],E))}let w=Rie.build({grammar(E){E.rules.forEach(w),E.literals=t,E.classes=r,E.expectations=n,E.functions=s},rule(E){E.bytecode=w(E.expression,{sp:-1,env:{},pluck:[],action:null})},named(E,S){let C=E.match|0,D=C===GC?null:a({type:"rule",value:E.name});return f([je.SILENT_FAILS_ON],w(E.expression,S),[je.SILENT_FAILS_OFF],m(C,[je.IF_ERROR],[je.FAIL,D],[]))},choice(E,S){function C(D,H){let K=D[0].match|0,_=w(D[0],{sp:H.sp,env:l(H.env),action:null});return K===Ph?_:f(_,D.length>1?m(VC,[je.IF_ERROR],f([je.POP],C(D.slice(1),H)),[]):[])}return C(E.alternatives,S)},action(E,S){let C=l(S.env),D=E.expression.type!=="sequence"||E.expression.elements.length===0,H=w(E.expression,{sp:S.sp+(D?1:0),env:C,action:E}),K=E.expression.match|0,_=D&&K!==GC?u(!1,Object.keys(C),E):null;return D?f([je.PUSH_CURR_POS],H,m(K,[je.IF_NOT_ERROR],f([je.LOAD_SAVED_POS,1],d(_,1,C,S.sp+2)),[]),[je.NIP]):H},sequence(E,S){function C(D,H){if(D.length>0){let K=E.elements.length-D.length+1;return f(w(D[0],{sp:H.sp,env:H.env,pluck:H.pluck,action:null}),m(D[0].match|0,[je.IF_NOT_ERROR],C(D.slice(1),{sp:H.sp+1,env:H.env,pluck:H.pluck,action:H.action}),f(K>1?[je.POP_N,K]:[je.POP],[je.POP_CURR_POS],[je.PUSH_FAILED])))}else{if(H.pluck.length>0)return f([je.PLUCK,E.elements.length+1,H.pluck.length],H.pluck.map(K=>H.sp-K));if(H.action){let K=u(!1,Object.keys(H.env),H.action);return f([je.LOAD_SAVED_POS,E.elements.length],d(K,E.elements.length+1,H.env,H.sp))}else return f([je.WRAP,E.elements.length],[je.NIP])}}return f([je.PUSH_CURR_POS],C(E.elements,{sp:S.sp+1,env:S.env,pluck:[],action:S.action}))},labeled(E,S){let C=S.env,D=E.label,H=S.sp+1;return D&&(C=l(S.env),S.env[E.label]=H),E.pick&&S.pluck.push(H),w(E.expression,{sp:S.sp,env:C,action:null})},text(E,S){return f([je.PUSH_CURR_POS],w(E.expression,{sp:S.sp+1,env:l(S.env),action:null}),m(E.match|0,[je.IF_NOT_ERROR],f([je.POP],[je.TEXT]),[je.NIP]))},simple_and(E,S){return v(E.expression,!1,S)},simple_not(E,S){return v(E.expression,!0,S)},optional(E,S){return f(w(E.expression,{sp:S.sp,env:l(S.env),action:null}),m(-(E.expression.match|0),[je.IF_ERROR],f([je.POP],[je.PUSH_NULL]),[]))},zero_or_more(E,S){let C=w(E.expression,{sp:S.sp+1,env:l(S.env),action:null});return f([je.PUSH_EMPTY_ARRAY],C,y(C),[je.POP])},one_or_more(E,S){let C=w(E.expression,{sp:S.sp+1,env:l(S.env),action:null});return f([je.PUSH_EMPTY_ARRAY],C,m(E.expression.match|0,[je.IF_NOT_ERROR],f(y(C),[je.POP]),f([je.POP],[je.POP],[je.PUSH_FAILED])))},group(E,S){return w(E.expression,{sp:S.sp,env:l(S.env),action:null})},semantic_and(E,S){return g(E,!1,S)},semantic_not(E,S){return g(E,!0,S)},rule_ref(E){return[je.RULE,xie.indexOfRule(e,E.name)]},literal(E){if(E.value.length>0){let S=E.match|0,D=S===VC||S===Ph&&!E.ignoreCase?o(E.ignoreCase?E.value.toLowerCase():E.value):null,H=S!==Ph?a({type:"literal",value:E.value,ignoreCase:E.ignoreCase}):null;return m(S,E.ignoreCase?[je.MATCH_STRING_IC,D]:[je.MATCH_STRING,D],E.ignoreCase?[je.ACCEPT_N,E.value.length]:[je.ACCEPT_STRING,D],[je.FAIL,H])}return[je.PUSH_EMPTY_STRING]},class(E){let S=E.match|0,C=S===VC?i(E):null,D=S!==Ph?a({type:"class",value:E.parts,inverted:E.inverted,ignoreCase:E.ignoreCase}):null;return m(S,[je.MATCH_CHAR_CLASS,C],[je.ACCEPT_N,1],[je.FAIL,D])},any(E){let S=E.match|0,C=S!==Ph?a({type:"any"}):null;return m(S,[je.MATCH_ANY],[je.ACCEPT_N,1],[je.FAIL,C])}});w(e)}Yk.exports=Tie});var Jk=be((L4e,Xk)=>{"use strict";var U4e=F(I()),zC=class{constructor(t,r,n){this.sp=-1,this.maxSp=-1,this.varName=r,this.ruleName=t,this.type=n}name(t){if(t<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack underflow: attempt to use a variable '${this.varName}<x>' at an index ${t}`);return this.varName+t}push(t){let r=this.name(++this.sp)+" = "+t+";";return this.sp>this.maxSp&&(this.maxSp=this.sp),r}pop(t){return t!==void 0?(this.sp-=t,Array.from({length:t},(r,n)=>this.name(this.sp+1+n))):this.name(this.sp--)}top(){return this.name(this.sp)}index(t){if(t<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack overflow: attempt to get a variable at a negative index ${t}`);return this.name(this.sp-t)}result(){if(this.maxSp<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack is empty, can't get the result'`);return this.name(0)}defines(){return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(t,r)=>this.name(r)).join(", ")+";"}checkedIf(t,r,n){let s=this.sp;if(r(),n){let o=this.sp;if(this.sp=s,n(),o!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Branches of a condition can't move the stack pointer differently (before: "+s+", after then: "+o+", after else: "+this.sp+").")}}checkedLoop(t,r){let n=this.sp;if(r(),n!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Body of a loop can't move the stack pointer (before: "+n+", after: "+this.sp+").")}};Xk.exports=zC});var YC=be((H4e,Zk)=>{"use strict";var M4e=F(I());Zk.exports="2.0.1"});var Qk=be(Kw=>{"use strict";var j4e=F(I());function Gu(e){return e.charCodeAt(0).toString(16).toUpperCase()}Kw.hex=Gu;function kie(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+Gu(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Gu(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Gu(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Gu(t))}Kw.stringEscape=kie;function Pie(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+Gu(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Gu(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Gu(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Gu(t))}Kw.regexpClassEscape=Pie});var rP=be(tP=>{var V4e=F(I()),eP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");tP.encode=function(e){if(0<=e&&e<eP.length)return eP[e];throw new TypeError("Must be between 0 and 63: "+e)}});var oP=be(iP=>{var z4e=F(I()),Oie=rP(),nP=5,sP=1<<nP,Nie=sP-1,Lie=sP;function Uie(e){return e<0?(-e<<1)+1:(e<<1)+0}iP.encode=function(t){let r="",n,s=Uie(t);do n=s&Nie,s>>>=nP,s>0&&(n|=Lie),r+=Oie.encode(n);while(s>0);return r}});var Gw=be(cl=>{var W4e=F(I());function Hie(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}cl.getArg=Hie;var uP=(function(){return!("__proto__"in Object.create(null))})();function cP(e){return e}function Mie(e){return lP(e)?"$"+e:e}cl.toSetString=uP?cP:Mie;function qie(e){return lP(e)?e.slice(1):e}cl.fromSetString=uP?cP:qie;function lP(e){if(!e)return!1;let t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(let r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function aP(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function jie(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=aP(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:aP(e.name,t.name)}cl.compareByGeneratedPositionsInflated=jie;var WC="http:",N1=`${WC}//host`;function fP(e){return t=>{let r=L1(t),n=XC(t),s=new URL(t,n);e(s);let o=s.toString();return r==="absolute"?o:r==="scheme-relative"?o.slice(WC.length):r==="path-absolute"?o.slice(N1.length):JC(n,o)}}function ul(e,t){return new URL(e,t).toString()}function Kie(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function XC(e){let t=e.split("..").length-1,r=Kie("p",e),n=`${N1}/`;for(let s=0;s<t;s++)n+=`${r}/`;return n}var Vie=/^[A-Za-z0-9\+\-\.]+:/;function L1(e){return e[0]==="/"?e[1]==="/"?"scheme-relative":"path-absolute":Vie.test(e)?"absolute":"path-relative"}function JC(e,t){typeof e=="string"&&(e=new URL(e)),typeof t=="string"&&(t=new URL(t));let r=t.pathname.split("/"),n=e.pathname.split("/");for(n.length>0&&!n[n.length-1]&&n.pop();r.length>0&&n.length>0&&r[0]===n[0];)r.shift(),n.shift();return n.map(()=>"..").concat(r).join("/")+t.search+t.hash}var Gie=fP(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),Vw=fP(e=>{});cl.normalize=Vw;function zie(e,t){let r=L1(t),n=L1(e);if(e=Gie(e),r==="absolute")return ul(t,void 0);if(n==="absolute")return ul(t,e);if(r==="scheme-relative")return Vw(t);if(n==="scheme-relative")return ul(t,ul(e,N1)).slice(WC.length);if(r==="path-absolute")return Vw(t);if(n==="path-absolute")return ul(t,ul(e,N1)).slice(N1.length);let s=XC(t+e),o=ul(t,ul(e,s));return JC(s,o)}cl.join=zie;function Yie(e,t){let r=Wie(e,t);return typeof r=="string"?r:Vw(t)}cl.relative=Yie;function Wie(e,t){if(L1(e)!==L1(t))return null;let n=XC(e+t),s=new URL(e,n),o=new URL(t,n);try{new URL("",o.toString())}catch{return null}return o.protocol!==s.protocol||o.user!==s.user||o.password!==s.password||o.hostname!==s.hostname||o.port!==s.port?null:JC(s,o)}});var hP=be(dP=>{var J4e=F(I()),ZC=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){let n=new e;for(let s=0,o=t.length;s<o;s++)n.add(t[s],r);return n}size(){return this._set.size}add(t,r){let n=this.has(t),s=this._array.length;(!n||r)&&this._array.push(t),n||this._set.set(t,s)}has(t){return this._set.has(t)}indexOf(t){let r=this._set.get(t);if(r>=0)return r;throw new Error('"'+t+'" is not in the set.')}at(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)}toArray(){return this._array.slice()}};dP.ArraySet=ZC});var gP=be(mP=>{var Q4e=F(I()),pP=Gw();function Xie(e,t){let r=e.generatedLine,n=t.generatedLine,s=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=s||pP.compareByGeneratedPositionsInflated(e,t)<=0}var QC=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){Xie(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(pP.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mP.MappingList=QC});var e4=be(vP=>{var t5e=F(I()),U1=oP(),Jr=Gw(),zw=hP().ArraySet,Jie=gP().MappingList,Yw=class e{constructor(t){t||(t={}),this._file=Jr.getArg(t,"file",null),this._sourceRoot=Jr.getArg(t,"sourceRoot",null),this._skipValidation=Jr.getArg(t,"skipValidation",!1),this._sources=new zw,this._names=new zw,this._mappings=new Jie,this._sourcesContents=null}static fromSourceMap(t){let r=t.sourceRoot,n=new e({file:t.file,sourceRoot:r});return t.eachMapping(function(s){let o={generated:{line:s.generatedLine,column:s.generatedColumn}};s.source!=null&&(o.source=s.source,r!=null&&(o.source=Jr.relative(r,o.source)),o.original={line:s.originalLine,column:s.originalColumn},s.name!=null&&(o.name=s.name)),n.addMapping(o)}),t.sources.forEach(function(s){let o=s;r!=null&&(o=Jr.relative(r,s)),n._sources.has(o)||n._sources.add(o);let i=t.sourceContentFor(s);i!=null&&n.setSourceContent(s,i)}),n}addMapping(t){let r=Jr.getArg(t,"generated"),n=Jr.getArg(t,"original",null),s=Jr.getArg(t,"source",null),o=Jr.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,s,o),s!=null&&(s=String(s),this._sources.has(s)||this._sources.add(s)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:s,name:o})}setSourceContent(t,r){let n=t;this._sourceRoot!=null&&(n=Jr.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[Jr.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[Jr.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(t,r,n){let s=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);s=t.file}let o=this._sourceRoot;o!=null&&(s=Jr.relative(o,s));let i=this._mappings.toArray().length>0?new zw:this._sources,a=new zw;this._mappings.unsortedForEach(function(u){if(u.source===s&&u.originalLine!=null){let m=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});m.source!=null&&(u.source=m.source,n!=null&&(u.source=Jr.join(n,u.source)),o!=null&&(u.source=Jr.relative(o,u.source)),u.originalLine=m.line,u.originalColumn=m.column,m.name!=null&&(u.name=m.name))}let l=u.source;l!=null&&!i.has(l)&&i.add(l);let f=u.name;f!=null&&!a.has(f)&&a.add(f)},this),this._sources=i,this._names=a,t.sources.forEach(function(u){let l=t.sourceContentFor(u);l!=null&&(n!=null&&(u=Jr.join(n,u)),o!=null&&(u=Jr.relative(o,u)),this.setSourceContent(u,l))},this)}_validateMapping(t,r,n,s){if(r&&typeof r.line!="number"&&typeof r.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!s)){if(!(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:s}))}}_serializeMappings(){let t=0,r=1,n=0,s=0,o=0,i=0,a="",u,l,f,m,p=this._mappings.toArray();for(let d=0,v=p.length;d<v;d++){if(l=p[d],u="",l.generatedLine!==r)for(t=0;l.generatedLine!==r;)u+=";",r++;else if(d>0){if(!Jr.compareByGeneratedPositionsInflated(l,p[d-1]))continue;u+=","}u+=U1.encode(l.generatedColumn-t),t=l.generatedColumn,l.source!=null&&(m=this._sources.indexOf(l.source),u+=U1.encode(m-i),i=m,u+=U1.encode(l.originalLine-1-s),s=l.originalLine-1,u+=U1.encode(l.originalColumn-n),n=l.originalColumn,l.name!=null&&(f=this._names.indexOf(l.name),u+=U1.encode(f-o),o=f)),a+=u}return a}_generateSourcesContent(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=Jr.relative(r,n));let s=Jr.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null},this)}toJSON(){let t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t}toString(){return JSON.stringify(this.toJSON())}};Yw.prototype._version=3;vP.SourceMapGenerator=Yw});var yP=be(wP=>{var n5e=F(I()),Zie=e4().SourceMapGenerator,Ww=Gw(),Qie=/(\r?\n)/,eoe=10,Oh="$$$isSourceNode$$$",t4=class e{constructor(t,r,n,s,o){this.children=[],this.sourceContents={},this.line=t??null,this.column=r??null,this.source=n??null,this.name=o??null,this[Oh]=!0,s!=null&&this.add(s)}static fromStringWithSourceMap(t,r,n){let s=new e,o=t.split(Qie),i=0,a=function(){let d=g(),v=g()||"";return d+v;function g(){return i<o.length?o[i++]:void 0}},u=1,l=0,f=null,m;return r.eachMapping(function(d){if(f!==null)if(u<d.generatedLine)p(f,a()),u++,l=0;else{m=o[i]||"";let v=m.substr(0,d.generatedColumn-l);o[i]=m.substr(d.generatedColumn-l),l=d.generatedColumn,p(f,v),f=d;return}for(;u<d.generatedLine;)s.add(a()),u++;l<d.generatedColumn&&(m=o[i]||"",s.add(m.substr(0,d.generatedColumn)),o[i]=m.substr(d.generatedColumn),l=d.generatedColumn),f=d},this),i<o.length&&(f&&p(f,a()),s.add(o.splice(i).join(""))),r.sources.forEach(function(d){let v=r.sourceContentFor(d);v!=null&&(n!=null&&(d=Ww.join(n,d)),s.setSourceContent(d,v))}),s;function p(d,v){if(d===null||d.source===void 0)s.add(v);else{let g=n?Ww.join(n,d.source):d.source;s.add(new e(d.originalLine,d.originalColumn,g,v,d.name))}}}add(t){if(Array.isArray(t))t.forEach(function(r){this.add(r)},this);else if(t[Oh]||typeof t=="string")t&&this.children.push(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this}prepend(t){if(Array.isArray(t))for(let r=t.length-1;r>=0;r--)this.prepend(t[r]);else if(t[Oh]||typeof t=="string")this.children.unshift(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this}walk(t){let r;for(let n=0,s=this.children.length;n<s;n++)r=this.children[n],r[Oh]?r.walk(t):r!==""&&t(r,{source:this.source,line:this.line,column:this.column,name:this.name})}join(t){let r,n,s=this.children.length;if(s>0){for(r=[],n=0;n<s-1;n++)r.push(this.children[n]),r.push(t);r.push(this.children[n]),this.children=r}return this}replaceRight(t,r){let n=this.children[this.children.length-1];return n[Oh]?n.replaceRight(t,r):typeof n=="string"?this.children[this.children.length-1]=n.replace(t,r):this.children.push("".replace(t,r)),this}setSourceContent(t,r){this.sourceContents[Ww.toSetString(t)]=r}walkSourceContents(t){for(let n=0,s=this.children.length;n<s;n++)this.children[n][Oh]&&this.children[n].walkSourceContents(t);let r=Object.keys(this.sourceContents);for(let n=0,s=r.length;n<s;n++)t(Ww.fromSetString(r[n]),this.sourceContents[r[n]])}toString(){let t="";return this.walk(function(r){t+=r}),t}toStringWithSourceMap(t){let r={code:"",line:1,column:0},n=new Zie(t),s=!1,o=null,i=null,a=null,u=null;return this.walk(function(l,f){r.code+=l,f.source!==null&&f.line!==null&&f.column!==null?((o!==f.source||i!==f.line||a!==f.column||u!==f.name)&&n.addMapping({source:f.source,original:{line:f.line,column:f.column},generated:{line:r.line,column:r.column},name:f.name}),o=f.source,i=f.line,a=f.column,u=f.name,s=!0):s&&(n.addMapping({generated:{line:r.line,column:r.column}}),o=null,s=!1);for(let m=0,p=l.length;m<p;m++)l.charCodeAt(m)===eoe?(r.line++,r.column=0,m+1===p?(o=null,s=!1):s&&n.addMapping({source:f.source,original:{line:f.line,column:f.column},generated:{line:r.line,column:r.column},name:f.name})):r.column++}),this.walkSourceContents(function(l,f){n.setSourceContent(l,f)}),{code:r.code,map:n}}};wP.SourceNode=t4});var EP=be(r4=>{var i5e=F(I());r4.SourceMapGenerator=e4().SourceMapGenerator;r4.SourceNode=yP().SourceNode});var _P=be((o5e,SP)=>{"use strict";var a5e=F(I()),toe=al(),nr=jC(),roe=Jk(),noe=YC(),{stringEscape:Di,regexpClassEscape:n4}=Qk(),{SourceNode:Ji}=EP();function AP(e,t,r){let n=t.start.line,s=t.start.column-1,o=e.split(`
|
||
`);return o.length===1?new Ji(n,s,t.source,e,r):new Ji(null,null,t.source,o.map((i,a)=>new Ji(n+a,a===0?s:0,t.source,a===o.length-1?i:[i,`
|
||
`],r)))}function bP(e,t,r,n,s){return r?new Ji(null,null,r.source,[e,AP(t,r,s),new Ji(r.end.line,r.end.column-1,r.source,n)]):new Ji(null,null,null,[e,t,n])}function soe(e,t){function r(g){return g instanceof Ji?g:g.replace(/^(.+)$/gm," $1")}function n(g){return"peg$c"+g}function s(g){return"peg$r"+g}function o(g){return"peg$e"+g}function i(g){return"peg$f"+g}function a(g){return"peg$parse"+g}function u(){function g(S){return'"'+Di(S)+'"'}function y(S){return"/^["+(S.inverted?"^":"")+S.value.map(C=>Array.isArray(C)?n4(C[0])+"-"+n4(C[1]):n4(C)).join("")+"]/"+(S.ignoreCase?"i":"")}function w(S){switch(S.type){case"rule":return'peg$otherExpectation("'+Di(S.value)+'")';case"literal":return'peg$literalExpectation("'+Di(S.value)+'", '+S.ignoreCase+")";case"class":return"peg$classExpectation(["+S.value.map(D=>Array.isArray(D)?'["'+Di(D[0])+'", "'+Di(D[1])+'"]':'"'+Di(D)+'"').join(", ")+"], "+S.inverted+", "+S.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(S)+")")}}function E(S,C){return bP(`
|
||
var ${i(C)} = function(${S.params.join(", ")}) {`,S.body,S.location,"};")}return new Ji(null,null,t.grammarSource,[e.literals.map((S,C)=>" var "+n(C)+" = "+g(S)+";").concat("",e.classes.map((S,C)=>" var "+s(C)+" = "+y(S)+";")).concat("",e.expectations.map((S,C)=>" var "+o(C)+" = "+w(S)+";")).concat("").join(`
|
||
`),e.functions.map(E)])}function l(g,y){let w=[];return w.push(""),t.trace&&w.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+g+","," location: peg$computeLocation(startPos, startPos)","});",""),t.cache&&(w.push("var key = peg$currPos * "+e.rules.length+" + "+y+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&w.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+g+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+g+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),w.push(" return cached.result;","}","")),w}function f(g,y){let w=[];return t.cache&&w.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+y+" };"),t.trace&&w.push("","if ("+y+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+g+","," result: "+y+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+g+","," location: peg$computeLocation(startPos, startPos)"," });","}"),w.push("","return "+y+";"),w}function m(g){let y=[],w=new roe(g.name,"s","var");function E(C){let D=0,H=C.length,K=[],_;function x(k,N){let O=N+3,L=C[D+O-2],T=C[D+O-1],M,W;w.checkedIf(D,()=>{D+=O,M=E(C.slice(D,D+L)),D+=L},T>0?()=>{W=E(C.slice(D,D+T)),D+=T}:null),K.push("if ("+k+") {"),K.push(...M.map(r)),T>0&&(K.push("} else {"),K.push(...W.map(r))),K.push("}")}function j(k){let O=C[D+2-1],L;w.checkedLoop(D,()=>{D+=2,L=E(C.slice(D,D+O)),D+=O}),K.push("while ("+k+") {"),K.push(...L.map(r)),K.push("}")}function U(){let N=C[D+4-1],O=i(C[D+1])+"("+C.slice(D+4,D+4+N).map(L=>w.index(L)).join(", ")+")";w.pop(C[D+2]),K.push(w.push(O)),D+=4+N}for(;D<H;)switch(C[D]){case nr.PUSH_EMPTY_STRING:K.push(w.push("''")),D++;break;case nr.PUSH_CURR_POS:K.push(w.push("peg$currPos")),D++;break;case nr.PUSH_UNDEFINED:K.push(w.push("undefined")),D++;break;case nr.PUSH_NULL:K.push(w.push("null")),D++;break;case nr.PUSH_FAILED:K.push(w.push("peg$FAILED")),D++;break;case nr.PUSH_EMPTY_ARRAY:K.push(w.push("[]")),D++;break;case nr.POP:w.pop(),D++;break;case nr.POP_CURR_POS:K.push("peg$currPos = "+w.pop()+";"),D++;break;case nr.POP_N:w.pop(C[D+1]),D+=2;break;case nr.NIP:_=w.pop(),w.pop(),K.push(w.push(_)),D++;break;case nr.APPEND:_=w.pop(),K.push(w.top()+".push("+_+");"),D++;break;case nr.WRAP:K.push(w.push("["+w.pop(C[D+1]).join(", ")+"]")),D+=2;break;case nr.TEXT:K.push(w.push("input.substring("+w.pop()+", peg$currPos)")),D++;break;case nr.PLUCK:{let N=C[D+3-1],O=3+N;_=C.slice(D+3,D+O),_=N===1?w.index(_[0]):`[ ${_.map(L=>w.index(L)).join(", ")} ]`,w.pop(C[D+1]),K.push(w.push(_)),D+=O;break}case nr.IF:x(w.top(),0);break;case nr.IF_ERROR:x(w.top()+" === peg$FAILED",0);break;case nr.IF_NOT_ERROR:x(w.top()+" !== peg$FAILED",0);break;case nr.WHILE_NOT_ERROR:j(w.top()+" !== peg$FAILED");break;case nr.MATCH_ANY:x("input.length > peg$currPos",0);break;case nr.MATCH_STRING:x(e.literals[C[D+1]].length>1?"input.substr(peg$currPos, "+e.literals[C[D+1]].length+") === "+n(C[D+1]):"input.charCodeAt(peg$currPos) === "+e.literals[C[D+1]].charCodeAt(0),1);break;case nr.MATCH_STRING_IC:x("input.substr(peg$currPos, "+e.literals[C[D+1]].length+").toLowerCase() === "+n(C[D+1]),1);break;case nr.MATCH_CHAR_CLASS:x(s(C[D+1])+".test(input.charAt(peg$currPos))",1);break;case nr.ACCEPT_N:K.push(w.push(C[D+1]>1?"input.substr(peg$currPos, "+C[D+1]+")":"input.charAt(peg$currPos)")),K.push(C[D+1]>1?"peg$currPos += "+C[D+1]+";":"peg$currPos++;"),D+=2;break;case nr.ACCEPT_STRING:K.push(w.push(n(C[D+1]))),K.push(e.literals[C[D+1]].length>1?"peg$currPos += "+e.literals[C[D+1]].length+";":"peg$currPos++;"),D+=2;break;case nr.FAIL:K.push(w.push("peg$FAILED")),K.push("if (peg$silentFails === 0) { peg$fail("+o(C[D+1])+"); }"),D+=2;break;case nr.LOAD_SAVED_POS:K.push("peg$savedPos = "+w.index(C[D+1])+";"),D+=2;break;case nr.UPDATE_SAVED_POS:K.push("peg$savedPos = peg$currPos;"),D++;break;case nr.CALL:U();break;case nr.RULE:K.push(w.push(a(e.rules[C[D+1]].name)+"()")),D+=2;break;case nr.SILENT_FAILS_ON:K.push("peg$silentFails++;"),D++;break;case nr.SILENT_FAILS_OFF:K.push("peg$silentFails--;"),D++;break;default:throw new Error("Invalid opcode: "+C[D]+".")}return K}let S=E(g.bytecode);return y.push(bP(" function ",a(g.name),g.nameLocation,`() {
|
||
`,g.name)),t.trace&&y.push(" var startPos = peg$currPos;"),y.push(r(w.defines())),y.push(...l('"'+Di(g.name)+'"',toe.indexOfRule(e,g.name)).map(r)),y.push(...S.map(r)),y.push(...f('"'+Di(g.name)+'"',w.result()).map(r)),y.push("}"),y}function p(g){return g.codeLocation?AP(g.code,g.codeLocation,"$"+g.type):g.code}function d(){let g=[];e.topLevelInitializer&&(g.push(p(e.topLevelInitializer)),g.push("")),g.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var loc = this.location.source + ":" + s.line + ":" + s.column;'," if (src) {"," var e = this.location.end;",` var filler = peg$padEnd("", s.line.toString().length, ' ');`," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --> " + loc + "\\n"',' + filler + " |\\n"',' + s.line + " | " + line + "\\n"',` + filler + " | " + peg$padEnd("", s.column - 1, ' ')`,' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&g.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");let y="{ "+t.allowedStartRules.map(E=>E+": "+a(E)).join(", ")+" }",w=a(t.allowedStartRules[0]);return g.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+y+";"," var peg$startRuleFunction = "+w+";","",u(),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&g.push(" var peg$resultsCache = {};",""),t.trace&&g.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),g.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",` throw new Error("Can't start parsing from rule \\"" + options.startRule + "\\".");`," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," p = pos - 1;"," while (!peg$posDetailsCache[p]) {"," p--;"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," return {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach(E=>{g.push(...m(E).map(r)),g.push("")}),e.initializer&&(g.push(p(e.initializer)),g.push("")),g.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new Ji(null,null,t.grammarSource,g.map(E=>E instanceof Ji?E:E+`
|
||
`))}function v(g){function y(){return[`// Generated by Peggy ${noe}.`,"//","// https://peggyjs.org/"]}function w(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(`
|
||
`):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(`
|
||
`)}let S={bare(){return[...y(),"(function() {",' "use strict";',"",g,"",r("return "+w()+";"),"})()"]},commonjs(){let C=Object.keys(t.dependencies),D=y();return D.push("",'"use strict";',""),C.length>0&&(C.forEach(H=>{D.push("var "+H+' = require("'+Di(t.dependencies[H])+'");')}),D.push("")),D.push(g,"","module.exports = "+w()+";"),D},es(){let C=Object.keys(t.dependencies),D=y();return D.push(""),C.length>0&&(C.forEach(H=>{D.push("import "+H+' from "'+Di(t.dependencies[H])+'";')}),D.push("")),D.push(g,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),D},amd(){let C=Object.keys(t.dependencies),H="["+C.map(_=>t.dependencies[_]).map(_=>'"'+Di(_)+'"').join(", ")+"]",K=C.join(", ");return[...y(),"define("+H+", function("+K+") {",' "use strict";',"",g,"",r("return "+w()+";"),"});"]},globals(){return[...y(),"(function(root) {",' "use strict";',"",g,"",r("root."+t.exportVar+" = "+w()+";"),"})(this);"]},umd(){let C=Object.keys(t.dependencies),D=C.map(j=>t.dependencies[j]),H="["+D.map(j=>'"'+Di(j)+'"').join(", ")+"]",K=D.map(j=>'require("'+Di(j)+'")').join(", "),_=C.join(", "),x=y();return x.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+H+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+K+");"),t.exportVar!==null&&x.push(" } else {"," root."+t.exportVar+" = factory();"),x.push(" }","})(this, function("+_+") {",' "use strict";',"",g,"",r("return "+w()+";"),"});"),x}}[t.format]();return new Ji(null,null,t.grammarSource,S.map(C=>C instanceof Ji?C:C+`
|
||
`))}e.code=v(d())}SP.exports=soe});var DP=be((u5e,CP)=>{"use strict";var c5e=F(I()),ioe=al(),ooe=Xi();function aoe(e,t,r){function n(i){return i.type==="rule"&&i.expression.type==="rule_ref"}function s(i,a,u){ooe.build({rule_ref(f){f.name===a&&(f.name=u,r.info(`Proxy rule "${a}" replaced by the rule "${u}"`,f.location,[{message:"This rule will be used",location:ioe.findRule(i,u).nameLocation}]))}})(i)}let o=[];e.rules.forEach((i,a)=>{n(i)&&(s(e,i.name,i.expression.name),t.allowedStartRules.indexOf(i.name)===-1&&o.push(a))}),o.reverse(),o.forEach(i=>{e.rules.splice(i,1)})}CP.exports=aoe});var BP=be((l5e,FP)=>{"use strict";var f5e=F(I()),uoe=Xi();function coe(e,t,r){function n(i){let a={};return Object.keys(i).forEach(u=>{a[u]=i[u]}),a}function s(i,a){o(i.expression,n(a))}let o=uoe.build({rule(i){o(i.expression,{})},choice(i,a){i.alternatives.forEach(u=>{o(u,n(a))})},action:s,labeled(i,a){let u=i.label;u&&Object.prototype.hasOwnProperty.call(a,u)&&r.error(`Label "${i.label}" is already defined`,i.labelLocation,[{message:"Original label location",location:a[u]}]),o(i.expression,a),a[i.label]=i.labelLocation},text:s,simple_and:s,simple_not:s,optional:s,zero_or_more:s,one_or_more:s,group:s});o(e)}FP.exports=coe});var $P=be((d5e,IP)=>{"use strict";var h5e=F(I()),loe=Xi();function foe(e,t,r){let n={};loe.build({rule(o){if(Object.prototype.hasOwnProperty.call(n,o.name)){r.error(`Rule "${o.name}" is already defined`,o.nameLocation,[{message:"Original rule location",location:n[o.name]}]);return}n[o.name]=o.nameLocation}})(e)}IP.exports=foe});var TP=be((p5e,RP)=>{"use strict";var m5e=F(I()),xP=al(),doe=Xi();function hoe(e,t,r){let n=[],s=[],o=doe.build({rule(i){n.push(i.name),o(i.expression),n.pop()},sequence(i){i.elements.every(a=>(o(a),!xP.alwaysConsumesOnSuccess(e,a)))},rule_ref(i){s.push(i);let a=xP.findRule(e,i.name);if(n.indexOf(i.name)!==-1){n.push(i.name),r.error("Possible infinite loop when parsing (left recursion: "+n.join(" -> ")+")",a.nameLocation,s.map((u,l,f)=>({message:l+1!==f.length?`Step ${l+1}: call of the rule "${u.name}" without input consumption`:`Step ${l+1}: call itself without input consumption - left recursion`,location:u.location})));return}a&&o(a),s.pop()}});o(e)}RP.exports=hoe});var OP=be((g5e,PP)=>{"use strict";var v5e=F(I()),kP=al(),poe=Xi();function moe(e,t,r){poe.build({zero_or_more(s){kP.alwaysConsumesOnSuccess(e,s.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",s.location)},one_or_more(s){kP.alwaysConsumesOnSuccess(e,s.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",s.location)}})(e)}PP.exports=moe});var LP=be((w5e,NP)=>{"use strict";var y5e=F(I()),goe=al(),voe=Xi();function woe(e,t,r){voe.build({rule_ref(s){goe.findRule(e,s.name)||r.error(`Rule "${s.name}" is not defined`,s.location)}})(e)}NP.exports=woe});var HP=be((E5e,UP)=>{"use strict";var b5e=F(I()),yoe=Xi();function Eoe(e,t,r){let n=yoe.build({action(s){n(s.expression,s)},labeled(s,o){s.pick&&o&&r.error('"@" cannot be used with an action block',s.labelLocation,[{message:"Action block location",location:o.codeLocation}]),n(s.expression)}});n(e)}UP.exports=Eoe});var qP=be((A5e,MP)=>{"use strict";var S5e=F(I()),boe=qw(),s4=class{constructor(t){t=typeof t<"u"?t:{},typeof t.error=="function"&&(this.error=t.error),typeof t.warning=="function"&&(this.warning=t.warning),typeof t.info=="function"&&(this.info=t.info)}error(){}warning(){}info(){}},i4=class{constructor(t){this._callbacks=new s4(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new boe(...t),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(["error",...t]),this._callbacks.error(this.stage,...t)}warning(...t){this.problems.push(["warning",...t]),this._callbacks.warning(this.stage,...t)}info(...t){this.problems.push(["info",...t]),this._callbacks.info(this.stage,...t)}checkErrors(){if(this.errors!==0)throw this._firstError}};MP.exports=i4});var jP=be((exports,module)=>{"use strict";var _5e=F(I()),generateBytecode=Wk(),generateJS=_P(),inferenceMatchResult=KC(),removeProxyRules=DP(),reportDuplicateLabels=BP(),reportDuplicateRules=$P(),reportInfiniteRecursion=TP(),reportInfiniteRepetition=OP(),reportUndefinedRules=LP(),reportIncorrectPlucking=HP(),Session=qP(),visitor=Xi();function processOptions(e,t){let r={};return Object.keys(e).forEach(n=>{r[n]=e[n]}),Object.keys(t).forEach(n=>{Object.prototype.hasOwnProperty.call(r,n)||(r[n]=t[n])}),r}var compiler={visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile(ast,passes,options){if(options=options!==void 0?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(options.allowedStartRules.length===0)throw new Error("Must have at least one start rule");let allRules=ast.rules.map(e=>e.name);for(let e of options.allowedStartRules)if(allRules.indexOf(e)===-1)throw new Error(`Unknown start rule "${e}"`);let session=new Session(options);switch(Object.keys(passes).forEach(e=>{session.stage=e,session.info(`Process stage ${e}`),passes[e].forEach(t=>{session.info(`Process pass ${e}.${t.name}`),t(ast,options,session)}),session.checkErrors()}),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;default:throw new Error("Invalid output format: "+options.output+".")}}};module.exports=compiler});var VP=be((C5e,KP)=>{"use strict";var D5e=F(I()),Aoe={$:"text","&":"simple_and","!":"simple_not"},Soe={"?":"optional","*":"zero_or_more","+":"one_or_more"},_oe={"&":"semantic_and","!":"semantic_not"};function Coe(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function ll(e,t,r,n){var s=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(s,ll.prototype),s.expected=t,s.found=r,s.location=n,s.name="SyntaxError",s}Coe(ll,Error);function o4(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,r+=r.repeat(t),e+r.slice(0,t))}ll.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n<e.length;n++)if(e[n].source===this.location.source){r=e[n].text.split(/\r\n|\n|\r/g);break}var s=this.location.start,o=this.location.source+":"+s.line+":"+s.column;if(r){var i=this.location.end,a=o4("",s.line.toString().length," "),u=r[s.line-1],l=s.line===i.line?i.column:u.length+1,f=l-s.column||1;t+=`
|
||
--> `+o+`
|
||
`+a+` |
|
||
`+s.line+" | "+u+`
|
||
`+a+" | "+o4("",s.column-1," ")+o4("",f,"^")}else t+=`
|
||
at `+o}return t};ll.buildMessage=function(e,t){var r={literal:function(l){return'"'+s(l.text)+'"'},class:function(l){var f=l.parts.map(function(m){return Array.isArray(m)?o(m[0])+"-"+o(m[1]):o(m)});return"["+(l.inverted?"^":"")+f.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(l){return l.description}};function n(l){return l.charCodeAt(0).toString(16).toUpperCase()}function s(l){return l.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(f){return"\\x0"+n(f)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(f){return"\\x"+n(f)})}function o(l){return l.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(f){return"\\x0"+n(f)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(f){return"\\x"+n(f)})}function i(l){return r[l.type](l)}function a(l){var f=l.map(i),m,p;if(f.sort(),f.length>0){for(m=1,p=1;m<f.length;m++)f[m-1]!==f[m]&&(f[p]=f[m],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}function u(l){return l?'"'+s(l)+'"':"end of input"}return"Expected "+a(e)+" but "+u(t)+" found."};function Doe(e,t){t=t!==void 0?t:{};var r={},n=t.grammarSource,s={Grammar:wm},o=wm,i="{",a="}",u="=",l="/",f="@",m=":",p="$",d="&",v="!",g="?",y="*",w="+",E="(",S=")",C=" ",D="\v",H="\f",K=" ",_="\xA0",x="\uFEFF",j=`
|
||
`,U=`\r
|
||
`,k="\r",N="\u2028",O="\u2029",L="/*",T="*/",M="//",W="_",G="\\",J="\u200C",te="\u200D",ie="i",ge='"',he="'",Fe="[",ke="^",$e="]",oe="-",me="0",Be="b",Ue="f",We="n",He="r",St="t",st="v",wt="x",Mn="u",Rr=".",Tr=";",yt=/^[\n\r\u2028\u2029]/,Zr=/^[0-9]/,$s=/^[0-9a-f]/i,to=/^[{}]/,Ot=/^[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137-\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148-\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C-\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA-\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9-\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC-\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF-\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F-\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0-\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB-\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE-\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6-\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FC7\u1FD0-\u1FD3\u1FD6-\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6-\u1FF7\u210A\u210E-\u210F\u2113\u212F\u2134\u2139\u213C-\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65-\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73-\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3-\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]/,rt=/^[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5-\u06E6\u07F4-\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C-\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D-\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C-\uA69D\uA717-\uA71F\uA770\uA788\uA7F8-\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3-\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E-\uFF9F]/,Ne=/^[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A-\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,Ar=/^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/,ls=/^[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178-\u0179\u017B\u017D\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018B\u018E-\u0191\u0193-\u0194\u0196-\u0198\u019C-\u019D\u019F-\u01A0\u01A2\u01A4\u01A6-\u01A7\u01A9\u01AC\u01AE-\u01AF\u01B1-\u01B3\u01B5\u01B7-\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A-\u023B\u023D-\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E-\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9-\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0-\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E-\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D-\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A]/,_t=/^[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E-\u094F\u0982-\u0983\u09BE-\u09C0\u09C7-\u09C8\u09CB-\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB-\u0ACC\u0B02-\u0B03\u0B3E\u0B40\u0B47-\u0B48\u0B4B-\u0B4C\u0B57\u0BBE-\u0BBF\u0BC1-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82-\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7-\u0CC8\u0CCA-\u0CCB\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82-\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2-\u0DF3\u0F3E-\u0F3F\u0F7F\u102B-\u102C\u1031\u1038\u103B-\u103C\u1056-\u1057\u1062-\u1064\u1067-\u106D\u1083-\u1084\u1087-\u108C\u108F\u109A-\u109C\u17B6\u17BE-\u17C5\u17C7-\u17C8\u1923-\u1926\u1929-\u192B\u1930-\u1931\u1933-\u1938\u1A19-\u1A1A\u1A55\u1A57\u1A61\u1A63-\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B44\u1B82\u1BA1\u1BA6-\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2-\u1BF3\u1C24-\u1C2B\u1C34-\u1C35\u1CE1\u1CF2-\u1CF3\u302E-\u302F\uA823-\uA824\uA827\uA880-\uA881\uA8B4-\uA8C3\uA952-\uA953\uA983\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BD-\uA9C0\uAA2F-\uAA30\uAA33-\uAA34\uAA4D\uAA7B\uAA7D\uAAEB\uAAEE-\uAAEF\uAAF5\uABE3-\uABE4\uABE6-\uABE7\uABE9-\uABEA\uABEC]/,pl=/^[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962-\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2-\u09E3\u0A01-\u0A02\u0A3C\u0A41-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A70-\u0A71\u0A75\u0A81-\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7-\u0AC8\u0ACD\u0AE2-\u0AE3\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62-\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC-\u0CCD\u0CE2-\u0CE3\u0D01\u0D41-\u0D44\u0D4D\u0D62-\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039-\u103A\u103D-\u103E\u1058-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193B\u1A17-\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80-\u1B81\u1BA2-\u1BA5\u1BA8-\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8-\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099-\u309A\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA825-\uA826\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9E5\uAA29-\uAA2E\uAA31-\uAA32\uAA35-\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEC-\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/,ds=/^[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]/,_e=/^[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/,Wu=/^[_\u203F-\u2040\u2054\uFE33-\uFE34\uFE4D-\uFE4F\uFF3F]/,Qt=/^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,qn=at("{",!1),Uo=at("}",!1),Of=at("=",!1),Xu=at("/",!1),Gh=at("@",!1),Ju=at(":",!1),Ho=at("$",!1),sr=at("&",!1),Fi=at("!",!1),Nf=at("?",!1),zh=at("*",!1),ml=at("+",!1),Zu=at("(",!1),Yh=at(")",!1),Lf=Mf(),gl=no("whitespace"),Wh=at(" ",!1),ae=at("\v",!1),ye=at("\f",!1),ze=at(" ",!1),Ve=at("\xA0",!1),it=at("\uFEFF",!1),Ct=dn([`
|
||
`,"\r","\u2028","\u2029"],!1,!1),Bt=no("end of line"),Qr=at(`
|
||
`,!1),Sr=at(`\r
|
||
`,!1),Bi=at("\r",!1),Mo=at("\u2028",!1),hs=at("\u2029",!1),xs=no("comment"),Vr=at("/*",!1),ps=at("*/",!1),Qu=at("//",!1),ec=no("identifier"),Xh=at("_",!1),jn=at("\\",!1),er=at("\u200C",!1),Gr=at("\u200D",!1),ht=no("literal"),_r=at("i",!1),Kn=no("string"),yr=at('"',!1),Rs=at("'",!1),ni=no("character class"),Ii=at("[",!1),ro=at("^",!1),qo=at("]",!1),Uf=at("-",!1),Z1=at("0",!1),Jh=at("b",!1),my=at("f",!1),Q1=at("n",!1),Hf=at("r",!1),em=at("t",!1),gy=at("v",!1),Zh=at("x",!1),Qh=at("u",!1),ep=dn([["0","9"]],!1,!1),vy=dn([["0","9"],["a","f"]],!1,!0),tm=at(".",!1),tp=no("code block"),tc=dn(["{","}"],!1,!1),rc=dn([["a","z"],"\xB5",["\xDF","\xF6"],["\xF8","\xFF"],"\u0101","\u0103","\u0105","\u0107","\u0109","\u010B","\u010D","\u010F","\u0111","\u0113","\u0115","\u0117","\u0119","\u011B","\u011D","\u011F","\u0121","\u0123","\u0125","\u0127","\u0129","\u012B","\u012D","\u012F","\u0131","\u0133","\u0135",["\u0137","\u0138"],"\u013A","\u013C","\u013E","\u0140","\u0142","\u0144","\u0146",["\u0148","\u0149"],"\u014B","\u014D","\u014F","\u0151","\u0153","\u0155","\u0157","\u0159","\u015B","\u015D","\u015F","\u0161","\u0163","\u0165","\u0167","\u0169","\u016B","\u016D","\u016F","\u0171","\u0173","\u0175","\u0177","\u017A","\u017C",["\u017E","\u0180"],"\u0183","\u0185","\u0188",["\u018C","\u018D"],"\u0192","\u0195",["\u0199","\u019B"],"\u019E","\u01A1","\u01A3","\u01A5","\u01A8",["\u01AA","\u01AB"],"\u01AD","\u01B0","\u01B4","\u01B6",["\u01B9","\u01BA"],["\u01BD","\u01BF"],"\u01C6","\u01C9","\u01CC","\u01CE","\u01D0","\u01D2","\u01D4","\u01D6","\u01D8","\u01DA",["\u01DC","\u01DD"],"\u01DF","\u01E1","\u01E3","\u01E5","\u01E7","\u01E9","\u01EB","\u01ED",["\u01EF","\u01F0"],"\u01F3","\u01F5","\u01F9","\u01FB","\u01FD","\u01FF","\u0201","\u0203","\u0205","\u0207","\u0209","\u020B","\u020D","\u020F","\u0211","\u0213","\u0215","\u0217","\u0219","\u021B","\u021D","\u021F","\u0221","\u0223","\u0225","\u0227","\u0229","\u022B","\u022D","\u022F","\u0231",["\u0233","\u0239"],"\u023C",["\u023F","\u0240"],"\u0242","\u0247","\u0249","\u024B","\u024D",["\u024F","\u0293"],["\u0295","\u02AF"],"\u0371","\u0373","\u0377",["\u037B","\u037D"],"\u0390",["\u03AC","\u03CE"],["\u03D0","\u03D1"],["\u03D5","\u03D7"],"\u03D9","\u03DB","\u03DD","\u03DF","\u03E1","\u03E3","\u03E5","\u03E7","\u03E9","\u03EB","\u03ED",["\u03EF","\u03F3"],"\u03F5","\u03F8",["\u03FB","\u03FC"],["\u0430","\u045F"],"\u0461","\u0463","\u0465","\u0467","\u0469","\u046B","\u046D","\u046F","\u0471","\u0473","\u0475","\u0477","\u0479","\u047B","\u047D","\u047F","\u0481","\u048B","\u048D","\u048F","\u0491","\u0493","\u0495","\u0497","\u0499","\u049B","\u049D","\u049F","\u04A1","\u04A3","\u04A5","\u04A7","\u04A9","\u04AB","\u04AD","\u04AF","\u04B1","\u04B3","\u04B5","\u04B7","\u04B9","\u04BB","\u04BD","\u04BF","\u04C2","\u04C4","\u04C6","\u04C8","\u04CA","\u04CC",["\u04CE","\u04CF"],"\u04D1","\u04D3","\u04D5","\u04D7","\u04D9","\u04DB","\u04DD","\u04DF","\u04E1","\u04E3","\u04E5","\u04E7","\u04E9","\u04EB","\u04ED","\u04EF","\u04F1","\u04F3","\u04F5","\u04F7","\u04F9","\u04FB","\u04FD","\u04FF","\u0501","\u0503","\u0505","\u0507","\u0509","\u050B","\u050D","\u050F","\u0511","\u0513","\u0515","\u0517","\u0519","\u051B","\u051D","\u051F","\u0521","\u0523","\u0525","\u0527","\u0529","\u052B","\u052D","\u052F",["\u0561","\u0587"],["\u13F8","\u13FD"],["\u1D00","\u1D2B"],["\u1D6B","\u1D77"],["\u1D79","\u1D9A"],"\u1E01","\u1E03","\u1E05","\u1E07","\u1E09","\u1E0B","\u1E0D","\u1E0F","\u1E11","\u1E13","\u1E15","\u1E17","\u1E19","\u1E1B","\u1E1D","\u1E1F","\u1E21","\u1E23","\u1E25","\u1E27","\u1E29","\u1E2B","\u1E2D","\u1E2F","\u1E31","\u1E33","\u1E35","\u1E37","\u1E39","\u1E3B","\u1E3D","\u1E3F","\u1E41","\u1E43","\u1E45","\u1E47","\u1E49","\u1E4B","\u1E4D","\u1E4F","\u1E51","\u1E53","\u1E55","\u1E57","\u1E59","\u1E5B","\u1E5D","\u1E5F","\u1E61","\u1E63","\u1E65","\u1E67","\u1E69","\u1E6B","\u1E6D","\u1E6F","\u1E71","\u1E73","\u1E75","\u1E77","\u1E79","\u1E7B","\u1E7D","\u1E7F","\u1E81","\u1E83","\u1E85","\u1E87","\u1E89","\u1E8B","\u1E8D","\u1E8F","\u1E91","\u1E93",["\u1E95","\u1E9D"],"\u1E9F","\u1EA1","\u1EA3","\u1EA5","\u1EA7","\u1EA9","\u1EAB","\u1EAD","\u1EAF","\u1EB1","\u1EB3","\u1EB5","\u1EB7","\u1EB9","\u1EBB","\u1EBD","\u1EBF","\u1EC1","\u1EC3","\u1EC5","\u1EC7","\u1EC9","\u1ECB","\u1ECD","\u1ECF","\u1ED1","\u1ED3","\u1ED5","\u1ED7","\u1ED9","\u1EDB","\u1EDD","\u1EDF","\u1EE1","\u1EE3","\u1EE5","\u1EE7","\u1EE9","\u1EEB","\u1EED","\u1EEF","\u1EF1","\u1EF3","\u1EF5","\u1EF7","\u1EF9","\u1EFB","\u1EFD",["\u1EFF","\u1F07"],["\u1F10","\u1F15"],["\u1F20","\u1F27"],["\u1F30","\u1F37"],["\u1F40","\u1F45"],["\u1F50","\u1F57"],["\u1F60","\u1F67"],["\u1F70","\u1F7D"],["\u1F80","\u1F87"],["\u1F90","\u1F97"],["\u1FA0","\u1FA7"],["\u1FB0","\u1FB4"],["\u1FB6","\u1FB7"],"\u1FBE",["\u1FC2","\u1FC4"],["\u1FC6","\u1FC7"],["\u1FD0","\u1FD3"],["\u1FD6","\u1FD7"],["\u1FE0","\u1FE7"],["\u1FF2","\u1FF4"],["\u1FF6","\u1FF7"],"\u210A",["\u210E","\u210F"],"\u2113","\u212F","\u2134","\u2139",["\u213C","\u213D"],["\u2146","\u2149"],"\u214E","\u2184",["\u2C30","\u2C5E"],"\u2C61",["\u2C65","\u2C66"],"\u2C68","\u2C6A","\u2C6C","\u2C71",["\u2C73","\u2C74"],["\u2C76","\u2C7B"],"\u2C81","\u2C83","\u2C85","\u2C87","\u2C89","\u2C8B","\u2C8D","\u2C8F","\u2C91","\u2C93","\u2C95","\u2C97","\u2C99","\u2C9B","\u2C9D","\u2C9F","\u2CA1","\u2CA3","\u2CA5","\u2CA7","\u2CA9","\u2CAB","\u2CAD","\u2CAF","\u2CB1","\u2CB3","\u2CB5","\u2CB7","\u2CB9","\u2CBB","\u2CBD","\u2CBF","\u2CC1","\u2CC3","\u2CC5","\u2CC7","\u2CC9","\u2CCB","\u2CCD","\u2CCF","\u2CD1","\u2CD3","\u2CD5","\u2CD7","\u2CD9","\u2CDB","\u2CDD","\u2CDF","\u2CE1",["\u2CE3","\u2CE4"],"\u2CEC","\u2CEE","\u2CF3",["\u2D00","\u2D25"],"\u2D27","\u2D2D","\uA641","\uA643","\uA645","\uA647","\uA649","\uA64B","\uA64D","\uA64F","\uA651","\uA653","\uA655","\uA657","\uA659","\uA65B","\uA65D","\uA65F","\uA661","\uA663","\uA665","\uA667","\uA669","\uA66B","\uA66D","\uA681","\uA683","\uA685","\uA687","\uA689","\uA68B","\uA68D","\uA68F","\uA691","\uA693","\uA695","\uA697","\uA699","\uA69B","\uA723","\uA725","\uA727","\uA729","\uA72B","\uA72D",["\uA72F","\uA731"],"\uA733","\uA735","\uA737","\uA739","\uA73B","\uA73D","\uA73F","\uA741","\uA743","\uA745","\uA747","\uA749","\uA74B","\uA74D","\uA74F","\uA751","\uA753","\uA755","\uA757","\uA759","\uA75B","\uA75D","\uA75F","\uA761","\uA763","\uA765","\uA767","\uA769","\uA76B","\uA76D","\uA76F",["\uA771","\uA778"],"\uA77A","\uA77C","\uA77F","\uA781","\uA783","\uA785","\uA787","\uA78C","\uA78E","\uA791",["\uA793","\uA795"],"\uA797","\uA799","\uA79B","\uA79D","\uA79F","\uA7A1","\uA7A3","\uA7A5","\uA7A7","\uA7A9","\uA7B5","\uA7B7","\uA7FA",["\uAB30","\uAB5A"],["\uAB60","\uAB65"],["\uAB70","\uABBF"],["\uFB00","\uFB06"],["\uFB13","\uFB17"],["\uFF41","\uFF5A"]],!1,!1),rm=dn([["\u02B0","\u02C1"],["\u02C6","\u02D1"],["\u02E0","\u02E4"],"\u02EC","\u02EE","\u0374","\u037A","\u0559","\u0640",["\u06E5","\u06E6"],["\u07F4","\u07F5"],"\u07FA","\u081A","\u0824","\u0828","\u0971","\u0E46","\u0EC6","\u10FC","\u17D7","\u1843","\u1AA7",["\u1C78","\u1C7D"],["\u1D2C","\u1D6A"],"\u1D78",["\u1D9B","\u1DBF"],"\u2071","\u207F",["\u2090","\u209C"],["\u2C7C","\u2C7D"],"\u2D6F","\u2E2F","\u3005",["\u3031","\u3035"],"\u303B",["\u309D","\u309E"],["\u30FC","\u30FE"],"\uA015",["\uA4F8","\uA4FD"],"\uA60C","\uA67F",["\uA69C","\uA69D"],["\uA717","\uA71F"],"\uA770","\uA788",["\uA7F8","\uA7F9"],"\uA9CF","\uA9E6","\uAA70","\uAADD",["\uAAF3","\uAAF4"],["\uAB5C","\uAB5F"],"\uFF70",["\uFF9E","\uFF9F"]],!1,!1),nm=dn(["\xAA","\xBA","\u01BB",["\u01C0","\u01C3"],"\u0294",["\u05D0","\u05EA"],["\u05F0","\u05F2"],["\u0620","\u063F"],["\u0641","\u064A"],["\u066E","\u066F"],["\u0671","\u06D3"],"\u06D5",["\u06EE","\u06EF"],["\u06FA","\u06FC"],"\u06FF","\u0710",["\u0712","\u072F"],["\u074D","\u07A5"],"\u07B1",["\u07CA","\u07EA"],["\u0800","\u0815"],["\u0840","\u0858"],["\u08A0","\u08B4"],["\u0904","\u0939"],"\u093D","\u0950",["\u0958","\u0961"],["\u0972","\u0980"],["\u0985","\u098C"],["\u098F","\u0990"],["\u0993","\u09A8"],["\u09AA","\u09B0"],"\u09B2",["\u09B6","\u09B9"],"\u09BD","\u09CE",["\u09DC","\u09DD"],["\u09DF","\u09E1"],["\u09F0","\u09F1"],["\u0A05","\u0A0A"],["\u0A0F","\u0A10"],["\u0A13","\u0A28"],["\u0A2A","\u0A30"],["\u0A32","\u0A33"],["\u0A35","\u0A36"],["\u0A38","\u0A39"],["\u0A59","\u0A5C"],"\u0A5E",["\u0A72","\u0A74"],["\u0A85","\u0A8D"],["\u0A8F","\u0A91"],["\u0A93","\u0AA8"],["\u0AAA","\u0AB0"],["\u0AB2","\u0AB3"],["\u0AB5","\u0AB9"],"\u0ABD","\u0AD0",["\u0AE0","\u0AE1"],"\u0AF9",["\u0B05","\u0B0C"],["\u0B0F","\u0B10"],["\u0B13","\u0B28"],["\u0B2A","\u0B30"],["\u0B32","\u0B33"],["\u0B35","\u0B39"],"\u0B3D",["\u0B5C","\u0B5D"],["\u0B5F","\u0B61"],"\u0B71","\u0B83",["\u0B85","\u0B8A"],["\u0B8E","\u0B90"],["\u0B92","\u0B95"],["\u0B99","\u0B9A"],"\u0B9C",["\u0B9E","\u0B9F"],["\u0BA3","\u0BA4"],["\u0BA8","\u0BAA"],["\u0BAE","\u0BB9"],"\u0BD0",["\u0C05","\u0C0C"],["\u0C0E","\u0C10"],["\u0C12","\u0C28"],["\u0C2A","\u0C39"],"\u0C3D",["\u0C58","\u0C5A"],["\u0C60","\u0C61"],["\u0C85","\u0C8C"],["\u0C8E","\u0C90"],["\u0C92","\u0CA8"],["\u0CAA","\u0CB3"],["\u0CB5","\u0CB9"],"\u0CBD","\u0CDE",["\u0CE0","\u0CE1"],["\u0CF1","\u0CF2"],["\u0D05","\u0D0C"],["\u0D0E","\u0D10"],["\u0D12","\u0D3A"],"\u0D3D","\u0D4E",["\u0D5F","\u0D61"],["\u0D7A","\u0D7F"],["\u0D85","\u0D96"],["\u0D9A","\u0DB1"],["\u0DB3","\u0DBB"],"\u0DBD",["\u0DC0","\u0DC6"],["\u0E01","\u0E30"],["\u0E32","\u0E33"],["\u0E40","\u0E45"],["\u0E81","\u0E82"],"\u0E84",["\u0E87","\u0E88"],"\u0E8A","\u0E8D",["\u0E94","\u0E97"],["\u0E99","\u0E9F"],["\u0EA1","\u0EA3"],"\u0EA5","\u0EA7",["\u0EAA","\u0EAB"],["\u0EAD","\u0EB0"],["\u0EB2","\u0EB3"],"\u0EBD",["\u0EC0","\u0EC4"],["\u0EDC","\u0EDF"],"\u0F00",["\u0F40","\u0F47"],["\u0F49","\u0F6C"],["\u0F88","\u0F8C"],["\u1000","\u102A"],"\u103F",["\u1050","\u1055"],["\u105A","\u105D"],"\u1061",["\u1065","\u1066"],["\u106E","\u1070"],["\u1075","\u1081"],"\u108E",["\u10D0","\u10FA"],["\u10FD","\u1248"],["\u124A","\u124D"],["\u1250","\u1256"],"\u1258",["\u125A","\u125D"],["\u1260","\u1288"],["\u128A","\u128D"],["\u1290","\u12B0"],["\u12B2","\u12B5"],["\u12B8","\u12BE"],"\u12C0",["\u12C2","\u12C5"],["\u12C8","\u12D6"],["\u12D8","\u1310"],["\u1312","\u1315"],["\u1318","\u135A"],["\u1380","\u138F"],["\u1401","\u166C"],["\u166F","\u167F"],["\u1681","\u169A"],["\u16A0","\u16EA"],["\u16F1","\u16F8"],["\u1700","\u170C"],["\u170E","\u1711"],["\u1720","\u1731"],["\u1740","\u1751"],["\u1760","\u176C"],["\u176E","\u1770"],["\u1780","\u17B3"],"\u17DC",["\u1820","\u1842"],["\u1844","\u1877"],["\u1880","\u18A8"],"\u18AA",["\u18B0","\u18F5"],["\u1900","\u191E"],["\u1950","\u196D"],["\u1970","\u1974"],["\u1980","\u19AB"],["\u19B0","\u19C9"],["\u1A00","\u1A16"],["\u1A20","\u1A54"],["\u1B05","\u1B33"],["\u1B45","\u1B4B"],["\u1B83","\u1BA0"],["\u1BAE","\u1BAF"],["\u1BBA","\u1BE5"],["\u1C00","\u1C23"],["\u1C4D","\u1C4F"],["\u1C5A","\u1C77"],["\u1CE9","\u1CEC"],["\u1CEE","\u1CF1"],["\u1CF5","\u1CF6"],["\u2135","\u2138"],["\u2D30","\u2D67"],["\u2D80","\u2D96"],["\u2DA0","\u2DA6"],["\u2DA8","\u2DAE"],["\u2DB0","\u2DB6"],["\u2DB8","\u2DBE"],["\u2DC0","\u2DC6"],["\u2DC8","\u2DCE"],["\u2DD0","\u2DD6"],["\u2DD8","\u2DDE"],"\u3006","\u303C",["\u3041","\u3096"],"\u309F",["\u30A1","\u30FA"],"\u30FF",["\u3105","\u312D"],["\u3131","\u318E"],["\u31A0","\u31BA"],["\u31F0","\u31FF"],["\u3400","\u4DB5"],["\u4E00","\u9FD5"],["\uA000","\uA014"],["\uA016","\uA48C"],["\uA4D0","\uA4F7"],["\uA500","\uA60B"],["\uA610","\uA61F"],["\uA62A","\uA62B"],"\uA66E",["\uA6A0","\uA6E5"],"\uA78F","\uA7F7",["\uA7FB","\uA801"],["\uA803","\uA805"],["\uA807","\uA80A"],["\uA80C","\uA822"],["\uA840","\uA873"],["\uA882","\uA8B3"],["\uA8F2","\uA8F7"],"\uA8FB","\uA8FD",["\uA90A","\uA925"],["\uA930","\uA946"],["\uA960","\uA97C"],["\uA984","\uA9B2"],["\uA9E0","\uA9E4"],["\uA9E7","\uA9EF"],["\uA9FA","\uA9FE"],["\uAA00","\uAA28"],["\uAA40","\uAA42"],["\uAA44","\uAA4B"],["\uAA60","\uAA6F"],["\uAA71","\uAA76"],"\uAA7A",["\uAA7E","\uAAAF"],"\uAAB1",["\uAAB5","\uAAB6"],["\uAAB9","\uAABD"],"\uAAC0","\uAAC2",["\uAADB","\uAADC"],["\uAAE0","\uAAEA"],"\uAAF2",["\uAB01","\uAB06"],["\uAB09","\uAB0E"],["\uAB11","\uAB16"],["\uAB20","\uAB26"],["\uAB28","\uAB2E"],["\uABC0","\uABE2"],["\uAC00","\uD7A3"],["\uD7B0","\uD7C6"],["\uD7CB","\uD7FB"],["\uF900","\uFA6D"],["\uFA70","\uFAD9"],"\uFB1D",["\uFB1F","\uFB28"],["\uFB2A","\uFB36"],["\uFB38","\uFB3C"],"\uFB3E",["\uFB40","\uFB41"],["\uFB43","\uFB44"],["\uFB46","\uFBB1"],["\uFBD3","\uFD3D"],["\uFD50","\uFD8F"],["\uFD92","\uFDC7"],["\uFDF0","\uFDFB"],["\uFE70","\uFE74"],["\uFE76","\uFEFC"],["\uFF66","\uFF6F"],["\uFF71","\uFF9D"],["\uFFA0","\uFFBE"],["\uFFC2","\uFFC7"],["\uFFCA","\uFFCF"],["\uFFD2","\uFFD7"],["\uFFDA","\uFFDC"]],!1,!1),wy=dn(["\u01C5","\u01C8","\u01CB","\u01F2",["\u1F88","\u1F8F"],["\u1F98","\u1F9F"],["\u1FA8","\u1FAF"],"\u1FBC","\u1FCC","\u1FFC"],!1,!1),sm=dn([["A","Z"],["\xC0","\xD6"],["\xD8","\xDE"],"\u0100","\u0102","\u0104","\u0106","\u0108","\u010A","\u010C","\u010E","\u0110","\u0112","\u0114","\u0116","\u0118","\u011A","\u011C","\u011E","\u0120","\u0122","\u0124","\u0126","\u0128","\u012A","\u012C","\u012E","\u0130","\u0132","\u0134","\u0136","\u0139","\u013B","\u013D","\u013F","\u0141","\u0143","\u0145","\u0147","\u014A","\u014C","\u014E","\u0150","\u0152","\u0154","\u0156","\u0158","\u015A","\u015C","\u015E","\u0160","\u0162","\u0164","\u0166","\u0168","\u016A","\u016C","\u016E","\u0170","\u0172","\u0174","\u0176",["\u0178","\u0179"],"\u017B","\u017D",["\u0181","\u0182"],"\u0184",["\u0186","\u0187"],["\u0189","\u018B"],["\u018E","\u0191"],["\u0193","\u0194"],["\u0196","\u0198"],["\u019C","\u019D"],["\u019F","\u01A0"],"\u01A2","\u01A4",["\u01A6","\u01A7"],"\u01A9","\u01AC",["\u01AE","\u01AF"],["\u01B1","\u01B3"],"\u01B5",["\u01B7","\u01B8"],"\u01BC","\u01C4","\u01C7","\u01CA","\u01CD","\u01CF","\u01D1","\u01D3","\u01D5","\u01D7","\u01D9","\u01DB","\u01DE","\u01E0","\u01E2","\u01E4","\u01E6","\u01E8","\u01EA","\u01EC","\u01EE","\u01F1","\u01F4",["\u01F6","\u01F8"],"\u01FA","\u01FC","\u01FE","\u0200","\u0202","\u0204","\u0206","\u0208","\u020A","\u020C","\u020E","\u0210","\u0212","\u0214","\u0216","\u0218","\u021A","\u021C","\u021E","\u0220","\u0222","\u0224","\u0226","\u0228","\u022A","\u022C","\u022E","\u0230","\u0232",["\u023A","\u023B"],["\u023D","\u023E"],"\u0241",["\u0243","\u0246"],"\u0248","\u024A","\u024C","\u024E","\u0370","\u0372","\u0376","\u037F","\u0386",["\u0388","\u038A"],"\u038C",["\u038E","\u038F"],["\u0391","\u03A1"],["\u03A3","\u03AB"],"\u03CF",["\u03D2","\u03D4"],"\u03D8","\u03DA","\u03DC","\u03DE","\u03E0","\u03E2","\u03E4","\u03E6","\u03E8","\u03EA","\u03EC","\u03EE","\u03F4","\u03F7",["\u03F9","\u03FA"],["\u03FD","\u042F"],"\u0460","\u0462","\u0464","\u0466","\u0468","\u046A","\u046C","\u046E","\u0470","\u0472","\u0474","\u0476","\u0478","\u047A","\u047C","\u047E","\u0480","\u048A","\u048C","\u048E","\u0490","\u0492","\u0494","\u0496","\u0498","\u049A","\u049C","\u049E","\u04A0","\u04A2","\u04A4","\u04A6","\u04A8","\u04AA","\u04AC","\u04AE","\u04B0","\u04B2","\u04B4","\u04B6","\u04B8","\u04BA","\u04BC","\u04BE",["\u04C0","\u04C1"],"\u04C3","\u04C5","\u04C7","\u04C9","\u04CB","\u04CD","\u04D0","\u04D2","\u04D4","\u04D6","\u04D8","\u04DA","\u04DC","\u04DE","\u04E0","\u04E2","\u04E4","\u04E6","\u04E8","\u04EA","\u04EC","\u04EE","\u04F0","\u04F2","\u04F4","\u04F6","\u04F8","\u04FA","\u04FC","\u04FE","\u0500","\u0502","\u0504","\u0506","\u0508","\u050A","\u050C","\u050E","\u0510","\u0512","\u0514","\u0516","\u0518","\u051A","\u051C","\u051E","\u0520","\u0522","\u0524","\u0526","\u0528","\u052A","\u052C","\u052E",["\u0531","\u0556"],["\u10A0","\u10C5"],"\u10C7","\u10CD",["\u13A0","\u13F5"],"\u1E00","\u1E02","\u1E04","\u1E06","\u1E08","\u1E0A","\u1E0C","\u1E0E","\u1E10","\u1E12","\u1E14","\u1E16","\u1E18","\u1E1A","\u1E1C","\u1E1E","\u1E20","\u1E22","\u1E24","\u1E26","\u1E28","\u1E2A","\u1E2C","\u1E2E","\u1E30","\u1E32","\u1E34","\u1E36","\u1E38","\u1E3A","\u1E3C","\u1E3E","\u1E40","\u1E42","\u1E44","\u1E46","\u1E48","\u1E4A","\u1E4C","\u1E4E","\u1E50","\u1E52","\u1E54","\u1E56","\u1E58","\u1E5A","\u1E5C","\u1E5E","\u1E60","\u1E62","\u1E64","\u1E66","\u1E68","\u1E6A","\u1E6C","\u1E6E","\u1E70","\u1E72","\u1E74","\u1E76","\u1E78","\u1E7A","\u1E7C","\u1E7E","\u1E80","\u1E82","\u1E84","\u1E86","\u1E88","\u1E8A","\u1E8C","\u1E8E","\u1E90","\u1E92","\u1E94","\u1E9E","\u1EA0","\u1EA2","\u1EA4","\u1EA6","\u1EA8","\u1EAA","\u1EAC","\u1EAE","\u1EB0","\u1EB2","\u1EB4","\u1EB6","\u1EB8","\u1EBA","\u1EBC","\u1EBE","\u1EC0","\u1EC2","\u1EC4","\u1EC6","\u1EC8","\u1ECA","\u1ECC","\u1ECE","\u1ED0","\u1ED2","\u1ED4","\u1ED6","\u1ED8","\u1EDA","\u1EDC","\u1EDE","\u1EE0","\u1EE2","\u1EE4","\u1EE6","\u1EE8","\u1EEA","\u1EEC","\u1EEE","\u1EF0","\u1EF2","\u1EF4","\u1EF6","\u1EF8","\u1EFA","\u1EFC","\u1EFE",["\u1F08","\u1F0F"],["\u1F18","\u1F1D"],["\u1F28","\u1F2F"],["\u1F38","\u1F3F"],["\u1F48","\u1F4D"],"\u1F59","\u1F5B","\u1F5D","\u1F5F",["\u1F68","\u1F6F"],["\u1FB8","\u1FBB"],["\u1FC8","\u1FCB"],["\u1FD8","\u1FDB"],["\u1FE8","\u1FEC"],["\u1FF8","\u1FFB"],"\u2102","\u2107",["\u210B","\u210D"],["\u2110","\u2112"],"\u2115",["\u2119","\u211D"],"\u2124","\u2126","\u2128",["\u212A","\u212D"],["\u2130","\u2133"],["\u213E","\u213F"],"\u2145","\u2183",["\u2C00","\u2C2E"],"\u2C60",["\u2C62","\u2C64"],"\u2C67","\u2C69","\u2C6B",["\u2C6D","\u2C70"],"\u2C72","\u2C75",["\u2C7E","\u2C80"],"\u2C82","\u2C84","\u2C86","\u2C88","\u2C8A","\u2C8C","\u2C8E","\u2C90","\u2C92","\u2C94","\u2C96","\u2C98","\u2C9A","\u2C9C","\u2C9E","\u2CA0","\u2CA2","\u2CA4","\u2CA6","\u2CA8","\u2CAA","\u2CAC","\u2CAE","\u2CB0","\u2CB2","\u2CB4","\u2CB6","\u2CB8","\u2CBA","\u2CBC","\u2CBE","\u2CC0","\u2CC2","\u2CC4","\u2CC6","\u2CC8","\u2CCA","\u2CCC","\u2CCE","\u2CD0","\u2CD2","\u2CD4","\u2CD6","\u2CD8","\u2CDA","\u2CDC","\u2CDE","\u2CE0","\u2CE2","\u2CEB","\u2CED","\u2CF2","\uA640","\uA642","\uA644","\uA646","\uA648","\uA64A","\uA64C","\uA64E","\uA650","\uA652","\uA654","\uA656","\uA658","\uA65A","\uA65C","\uA65E","\uA660","\uA662","\uA664","\uA666","\uA668","\uA66A","\uA66C","\uA680","\uA682","\uA684","\uA686","\uA688","\uA68A","\uA68C","\uA68E","\uA690","\uA692","\uA694","\uA696","\uA698","\uA69A","\uA722","\uA724","\uA726","\uA728","\uA72A","\uA72C","\uA72E","\uA732","\uA734","\uA736","\uA738","\uA73A","\uA73C","\uA73E","\uA740","\uA742","\uA744","\uA746","\uA748","\uA74A","\uA74C","\uA74E","\uA750","\uA752","\uA754","\uA756","\uA758","\uA75A","\uA75C","\uA75E","\uA760","\uA762","\uA764","\uA766","\uA768","\uA76A","\uA76C","\uA76E","\uA779","\uA77B",["\uA77D","\uA77E"],"\uA780","\uA782","\uA784","\uA786","\uA78B","\uA78D","\uA790","\uA792","\uA796","\uA798","\uA79A","\uA79C","\uA79E","\uA7A0","\uA7A2","\uA7A4","\uA7A6","\uA7A8",["\uA7AA","\uA7AD"],["\uA7B0","\uA7B4"],"\uA7B6",["\uFF21","\uFF3A"]],!1,!1),im=dn(["\u0903","\u093B",["\u093E","\u0940"],["\u0949","\u094C"],["\u094E","\u094F"],["\u0982","\u0983"],["\u09BE","\u09C0"],["\u09C7","\u09C8"],["\u09CB","\u09CC"],"\u09D7","\u0A03",["\u0A3E","\u0A40"],"\u0A83",["\u0ABE","\u0AC0"],"\u0AC9",["\u0ACB","\u0ACC"],["\u0B02","\u0B03"],"\u0B3E","\u0B40",["\u0B47","\u0B48"],["\u0B4B","\u0B4C"],"\u0B57",["\u0BBE","\u0BBF"],["\u0BC1","\u0BC2"],["\u0BC6","\u0BC8"],["\u0BCA","\u0BCC"],"\u0BD7",["\u0C01","\u0C03"],["\u0C41","\u0C44"],["\u0C82","\u0C83"],"\u0CBE",["\u0CC0","\u0CC4"],["\u0CC7","\u0CC8"],["\u0CCA","\u0CCB"],["\u0CD5","\u0CD6"],["\u0D02","\u0D03"],["\u0D3E","\u0D40"],["\u0D46","\u0D48"],["\u0D4A","\u0D4C"],"\u0D57",["\u0D82","\u0D83"],["\u0DCF","\u0DD1"],["\u0DD8","\u0DDF"],["\u0DF2","\u0DF3"],["\u0F3E","\u0F3F"],"\u0F7F",["\u102B","\u102C"],"\u1031","\u1038",["\u103B","\u103C"],["\u1056","\u1057"],["\u1062","\u1064"],["\u1067","\u106D"],["\u1083","\u1084"],["\u1087","\u108C"],"\u108F",["\u109A","\u109C"],"\u17B6",["\u17BE","\u17C5"],["\u17C7","\u17C8"],["\u1923","\u1926"],["\u1929","\u192B"],["\u1930","\u1931"],["\u1933","\u1938"],["\u1A19","\u1A1A"],"\u1A55","\u1A57","\u1A61",["\u1A63","\u1A64"],["\u1A6D","\u1A72"],"\u1B04","\u1B35","\u1B3B",["\u1B3D","\u1B41"],["\u1B43","\u1B44"],"\u1B82","\u1BA1",["\u1BA6","\u1BA7"],"\u1BAA","\u1BE7",["\u1BEA","\u1BEC"],"\u1BEE",["\u1BF2","\u1BF3"],["\u1C24","\u1C2B"],["\u1C34","\u1C35"],"\u1CE1",["\u1CF2","\u1CF3"],["\u302E","\u302F"],["\uA823","\uA824"],"\uA827",["\uA880","\uA881"],["\uA8B4","\uA8C3"],["\uA952","\uA953"],"\uA983",["\uA9B4","\uA9B5"],["\uA9BA","\uA9BB"],["\uA9BD","\uA9C0"],["\uAA2F","\uAA30"],["\uAA33","\uAA34"],"\uAA4D","\uAA7B","\uAA7D","\uAAEB",["\uAAEE","\uAAEF"],"\uAAF5",["\uABE3","\uABE4"],["\uABE6","\uABE7"],["\uABE9","\uABEA"],"\uABEC"],!1,!1),om=dn([["\u0300","\u036F"],["\u0483","\u0487"],["\u0591","\u05BD"],"\u05BF",["\u05C1","\u05C2"],["\u05C4","\u05C5"],"\u05C7",["\u0610","\u061A"],["\u064B","\u065F"],"\u0670",["\u06D6","\u06DC"],["\u06DF","\u06E4"],["\u06E7","\u06E8"],["\u06EA","\u06ED"],"\u0711",["\u0730","\u074A"],["\u07A6","\u07B0"],["\u07EB","\u07F3"],["\u0816","\u0819"],["\u081B","\u0823"],["\u0825","\u0827"],["\u0829","\u082D"],["\u0859","\u085B"],["\u08E3","\u0902"],"\u093A","\u093C",["\u0941","\u0948"],"\u094D",["\u0951","\u0957"],["\u0962","\u0963"],"\u0981","\u09BC",["\u09C1","\u09C4"],"\u09CD",["\u09E2","\u09E3"],["\u0A01","\u0A02"],"\u0A3C",["\u0A41","\u0A42"],["\u0A47","\u0A48"],["\u0A4B","\u0A4D"],"\u0A51",["\u0A70","\u0A71"],"\u0A75",["\u0A81","\u0A82"],"\u0ABC",["\u0AC1","\u0AC5"],["\u0AC7","\u0AC8"],"\u0ACD",["\u0AE2","\u0AE3"],"\u0B01","\u0B3C","\u0B3F",["\u0B41","\u0B44"],"\u0B4D","\u0B56",["\u0B62","\u0B63"],"\u0B82","\u0BC0","\u0BCD","\u0C00",["\u0C3E","\u0C40"],["\u0C46","\u0C48"],["\u0C4A","\u0C4D"],["\u0C55","\u0C56"],["\u0C62","\u0C63"],"\u0C81","\u0CBC","\u0CBF","\u0CC6",["\u0CCC","\u0CCD"],["\u0CE2","\u0CE3"],"\u0D01",["\u0D41","\u0D44"],"\u0D4D",["\u0D62","\u0D63"],"\u0DCA",["\u0DD2","\u0DD4"],"\u0DD6","\u0E31",["\u0E34","\u0E3A"],["\u0E47","\u0E4E"],"\u0EB1",["\u0EB4","\u0EB9"],["\u0EBB","\u0EBC"],["\u0EC8","\u0ECD"],["\u0F18","\u0F19"],"\u0F35","\u0F37","\u0F39",["\u0F71","\u0F7E"],["\u0F80","\u0F84"],["\u0F86","\u0F87"],["\u0F8D","\u0F97"],["\u0F99","\u0FBC"],"\u0FC6",["\u102D","\u1030"],["\u1032","\u1037"],["\u1039","\u103A"],["\u103D","\u103E"],["\u1058","\u1059"],["\u105E","\u1060"],["\u1071","\u1074"],"\u1082",["\u1085","\u1086"],"\u108D","\u109D",["\u135D","\u135F"],["\u1712","\u1714"],["\u1732","\u1734"],["\u1752","\u1753"],["\u1772","\u1773"],["\u17B4","\u17B5"],["\u17B7","\u17BD"],"\u17C6",["\u17C9","\u17D3"],"\u17DD",["\u180B","\u180D"],"\u18A9",["\u1920","\u1922"],["\u1927","\u1928"],"\u1932",["\u1939","\u193B"],["\u1A17","\u1A18"],"\u1A1B","\u1A56",["\u1A58","\u1A5E"],"\u1A60","\u1A62",["\u1A65","\u1A6C"],["\u1A73","\u1A7C"],"\u1A7F",["\u1AB0","\u1ABD"],["\u1B00","\u1B03"],"\u1B34",["\u1B36","\u1B3A"],"\u1B3C","\u1B42",["\u1B6B","\u1B73"],["\u1B80","\u1B81"],["\u1BA2","\u1BA5"],["\u1BA8","\u1BA9"],["\u1BAB","\u1BAD"],"\u1BE6",["\u1BE8","\u1BE9"],"\u1BED",["\u1BEF","\u1BF1"],["\u1C2C","\u1C33"],["\u1C36","\u1C37"],["\u1CD0","\u1CD2"],["\u1CD4","\u1CE0"],["\u1CE2","\u1CE8"],"\u1CED","\u1CF4",["\u1CF8","\u1CF9"],["\u1DC0","\u1DF5"],["\u1DFC","\u1DFF"],["\u20D0","\u20DC"],"\u20E1",["\u20E5","\u20F0"],["\u2CEF","\u2CF1"],"\u2D7F",["\u2DE0","\u2DFF"],["\u302A","\u302D"],["\u3099","\u309A"],"\uA66F",["\uA674","\uA67D"],["\uA69E","\uA69F"],["\uA6F0","\uA6F1"],"\uA802","\uA806","\uA80B",["\uA825","\uA826"],"\uA8C4",["\uA8E0","\uA8F1"],["\uA926","\uA92D"],["\uA947","\uA951"],["\uA980","\uA982"],"\uA9B3",["\uA9B6","\uA9B9"],"\uA9BC","\uA9E5",["\uAA29","\uAA2E"],["\uAA31","\uAA32"],["\uAA35","\uAA36"],"\uAA43","\uAA4C","\uAA7C","\uAAB0",["\uAAB2","\uAAB4"],["\uAAB7","\uAAB8"],["\uAABE","\uAABF"],"\uAAC1",["\uAAEC","\uAAED"],"\uAAF6","\uABE5","\uABE8","\uABED","\uFB1E",["\uFE00","\uFE0F"],["\uFE20","\uFE2F"]],!1,!1),am=dn([["0","9"],["\u0660","\u0669"],["\u06F0","\u06F9"],["\u07C0","\u07C9"],["\u0966","\u096F"],["\u09E6","\u09EF"],["\u0A66","\u0A6F"],["\u0AE6","\u0AEF"],["\u0B66","\u0B6F"],["\u0BE6","\u0BEF"],["\u0C66","\u0C6F"],["\u0CE6","\u0CEF"],["\u0D66","\u0D6F"],["\u0DE6","\u0DEF"],["\u0E50","\u0E59"],["\u0ED0","\u0ED9"],["\u0F20","\u0F29"],["\u1040","\u1049"],["\u1090","\u1099"],["\u17E0","\u17E9"],["\u1810","\u1819"],["\u1946","\u194F"],["\u19D0","\u19D9"],["\u1A80","\u1A89"],["\u1A90","\u1A99"],["\u1B50","\u1B59"],["\u1BB0","\u1BB9"],["\u1C40","\u1C49"],["\u1C50","\u1C59"],["\uA620","\uA629"],["\uA8D0","\uA8D9"],["\uA900","\uA909"],["\uA9D0","\uA9D9"],["\uA9F0","\uA9F9"],["\uAA50","\uAA59"],["\uABF0","\uABF9"],["\uFF10","\uFF19"]],!1,!1),yy=dn([["\u16EE","\u16F0"],["\u2160","\u2182"],["\u2185","\u2188"],"\u3007",["\u3021","\u3029"],["\u3038","\u303A"],["\uA6E6","\uA6EF"]],!1,!1),Ey=dn(["_",["\u203F","\u2040"],"\u2054",["\uFE33","\uFE34"],["\uFE4D","\uFE4F"],"\uFF3F"],!1,!1),by=dn([" ","\xA0","\u1680",["\u2000","\u200A"],"\u202F","\u205F","\u3000"],!1,!1),um=at(";",!1),Ay=function(B,z,ee){return{type:"grammar",topLevelInitializer:B,initializer:z,rules:ee,location:vr()}},Sy=function(B){return{type:"top_level_initializer",code:B[0],codeLocation:B[1],location:vr()}},_y=function(B){return{type:"initializer",code:B[0],codeLocation:B[1],location:vr()}},Cy=function(B,z,ee){return{type:"rule",name:B[0],nameLocation:B[1],expression:z!==null?{type:"named",name:z,expression:ee,location:vr()}:ee,location:vr()}},rp=function(B,z){return z.length>0?{type:"choice",alternatives:[B].concat(z),location:vr()}:B},Dy=function(B,z){return z!==null?{type:"action",expression:B,code:z[0],codeLocation:z[1],location:vr()}:B},Fy=function(B,z){return z.length>0||B.type==="labeled"&&B.pick?{type:"sequence",elements:[B].concat(z),location:vr()}:B},By=function(B,z,ee){return ee.type.startsWith("semantic_")&&ip('"@" cannot be used on a semantic predicate',B),{type:"labeled",label:z!==null?z[0]:null,labelLocation:z!==null?z[1]:B,pick:!0,expression:ee,location:vr()}},Iy=function(B,z){return{type:"labeled",label:B[0],labelLocation:B[1],expression:z,location:vr()}},$y=function(){return vr()},gr=function(B){return qa.indexOf(B[0])>=0&&ip(`Label can't be a reserved word "${B[0]}"`,B[1]),B},fr=function(B,z){return{type:Aoe[B],expression:z,location:vr()}},xy=function(B,z){return{type:Soe[z],expression:B,location:vr()}},Ry=function(B){return B.type==="labeled"||B.type==="sequence"?{type:"group",expression:B,location:vr()}:B},Ty=function(B){return{type:"rule_ref",name:B[0],location:vr()}},ky=function(B,z){return{type:_oe[B],code:z[0],codeLocation:z[1],location:vr()}},Py=function(B,z){return[B+z.join(""),vr()]},Oy=function(B,z){return{type:"literal",value:B,ignoreCase:z!==null,location:vr()}},cm=function(B){return B.join("")},Ny=function(B){return B.join("")},zr=function(B,z,ee){return{type:"class",parts:z.filter(Z=>Z!==""),inverted:B!==null,ignoreCase:ee!==null,location:vr()}},np=function(B,z){return B.charCodeAt(0)>z.charCodeAt(0)&&ip("Invalid character range: "+jo()+"."),[B,z]},Na=function(){return""},lm=function(){return"\0"},sp=function(){return"\b"},Ts=function(){return"\f"},fm=function(){return`
|
||
`},dm=function(){return"\r"},hm=function(){return" "},pm=function(){return"\v"},mm=function(B){return String.fromCharCode(parseInt(B,16))},gm=function(B){return String.fromCharCode(parseInt(B,16))},ms=function(){return{type:"any",location:vr()}},Ly=function(B){return[B,vr()]},q=0,Et=0,vl=[{line:1,column:1}],en=0,nc=[],le=0,ur;if("startRule"in t){if(!(t.startRule in s))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');o=s[t.startRule]}function jo(){return e.substring(Et,q)}function vm(){return Et}function S5(){return{source:n,start:Et,end:q}}function vr(){return ic(Et,q)}function _5(B,z){throw z=z!==void 0?z:ic(Et,q),up([no(B)],e.substring(Et,q),z)}function ip(B,z){throw z=z!==void 0?z:ic(Et,q),ap(B,z)}function at(B,z){return{type:"literal",text:B,ignoreCase:z}}function dn(B,z,ee){return{type:"class",parts:B,inverted:z,ignoreCase:ee}}function Mf(){return{type:"any"}}function sc(){return{type:"end"}}function no(B){return{type:"other",description:B}}function op(B){var z=vl[B],ee;if(z)return z;for(ee=B-1;!vl[ee];)ee--;for(z=vl[ee],z={line:z.line,column:z.column};ee<B;)e.charCodeAt(ee)===10?(z.line++,z.column=1):z.column++,ee++;return vl[B]=z,z}function ic(B,z){var ee=op(B),Z=op(z);return{source:n,start:{offset:B,line:ee.line,column:ee.column},end:{offset:z,line:Z.line,column:Z.column}}}function Se(B){q<en||(q>en&&(en=q,nc=[]),nc.push(B))}function ap(B,z){return new ll(B,null,null,z)}function up(B,z,ee){return new ll(ll.buildMessage(B,z),B,z,ee)}function wm(){var B,z,ee,Z,de,ve,tr,Pr;if(B=q,z=cr(),ee=q,Z=cp(),Z!==r?(de=cr(),ee=Z):(q=ee,ee=r),ee===r&&(ee=null),Z=q,de=lp(),de!==r?(ve=cr(),Z=de):(q=Z,Z=r),Z===r&&(Z=null),de=[],ve=q,tr=ym(),tr!==r?(Pr=cr(),ve=tr):(q=ve,ve=r),ve!==r)for(;ve!==r;)de.push(ve),ve=q,tr=ym(),tr!==r?(Pr=cr(),ve=tr):(q=ve,ve=r);else de=r;return de!==r?(Et=B,B=Ay(ee,Z,de)):(q=B,B=r),B}function cp(){var B,z,ee,Z,de;return B=q,e.charCodeAt(q)===123?(z=i,q++):(z=r,le===0&&Se(qn)),z!==r?(ee=Ma(),ee!==r?(e.charCodeAt(q)===125?(Z=a,q++):(Z=r,le===0&&Se(Uo)),Z!==r?(de=Yf(),de!==r?(Et=B,B=Sy(ee)):(q=B,B=r)):(q=B,B=r)):(q=B,B=r)):(q=B,B=r),B}function lp(){var B,z,ee;return B=q,z=Ma(),z!==r?(ee=Yf(),ee!==r?(Et=B,B=_y(z)):(q=B,B=r)):(q=B,B=r),B}function ym(){var B,z,ee,Z,de,ve,tr,Pr;return B=q,z=gs(),z!==r?(ee=cr(),Z=q,de=gp(),de!==r?(ve=cr(),Z=de):(q=Z,Z=r),Z===r&&(Z=null),e.charCodeAt(q)===61?(de=u,q++):(de=r,le===0&&Se(Of)),de!==r?(ve=cr(),tr=fp(),tr!==r?(Pr=Yf(),Pr!==r?(Et=B,B=Cy(z,Z,tr)):(q=B,B=r)):(q=B,B=r)):(q=B,B=r)):(q=B,B=r),B}function fp(){var B,z,ee,Z,de,ve,tr,Pr;if(B=q,z=Cn(),z!==r){for(ee=[],Z=q,de=cr(),e.charCodeAt(q)===47?(ve=l,q++):(ve=r,le===0&&Se(Xu)),ve!==r?(tr=cr(),Pr=Cn(),Pr!==r?Z=Pr:(q=Z,Z=r)):(q=Z,Z=r);Z!==r;)ee.push(Z),Z=q,de=cr(),e.charCodeAt(q)===47?(ve=l,q++):(ve=r,le===0&&Se(Xu)),ve!==r?(tr=cr(),Pr=Cn(),Pr!==r?Z=Pr:(q=Z,Z=r)):(q=Z,Z=r);Et=B,B=rp(z,ee)}else q=B,B=r;return B}function Cn(){var B,z,ee,Z,de;return B=q,z=dp(),z!==r?(ee=q,Z=cr(),de=Ma(),de!==r?ee=de:(q=ee,ee=r),ee===r&&(ee=null),Et=B,B=Dy(z,ee)):(q=B,B=r),B}function dp(){var B,z,ee,Z,de,ve;if(B=q,z=La(),z!==r){for(ee=[],Z=q,de=cr(),ve=La(),ve!==r?Z=ve:(q=Z,Z=r);Z!==r;)ee.push(Z),Z=q,de=cr(),ve=La(),ve!==r?Z=ve:(q=Z,Z=r);Et=B,B=Fy(z,ee)}else q=B,B=r;return B}function La(){var B,z,ee,Z;return B=q,z=Em(),z!==r?(ee=hp(),ee===r&&(ee=null),Z=pp(),Z!==r?(Et=B,B=By(z,ee,Z)):(q=B,B=r)):(q=B,B=r),B===r&&(B=q,z=hp(),z!==r?(ee=cr(),Z=pp(),Z!==r?(Et=B,B=Iy(z,Z)):(q=B,B=r)):(q=B,B=r),B===r&&(B=pp())),B}function Em(){var B,z;return B=q,e.charCodeAt(q)===64?(z=f,q++):(z=r,le===0&&Se(Gh)),z!==r&&(Et=B,z=$y()),B=z,B}function hp(){var B,z,ee,Z;return B=q,z=gs(),z!==r?(ee=cr(),e.charCodeAt(q)===58?(Z=m,q++):(Z=r,le===0&&Se(Ju)),Z!==r?(Et=B,B=gr(z)):(q=B,B=r)):(q=B,B=r),B}function pp(){var B,z,ee,Z;return B=q,z=Uy(),z!==r?(ee=cr(),Z=bm(),Z!==r?(Et=B,B=fr(z,Z)):(q=B,B=r)):(q=B,B=r),B===r&&(B=bm()),B}function Uy(){var B;return e.charCodeAt(q)===36?(B=p,q++):(B=r,le===0&&Se(Ho)),B===r&&(e.charCodeAt(q)===38?(B=d,q++):(B=r,le===0&&Se(sr)),B===r&&(e.charCodeAt(q)===33?(B=v,q++):(B=r,le===0&&Se(Fi)))),B}function bm(){var B,z,ee,Z;return B=q,z=Am(),z!==r?(ee=cr(),Z=Hy(),Z!==r?(Et=B,B=xy(z,Z)):(q=B,B=r)):(q=B,B=r),B===r&&(B=Am()),B}function Hy(){var B;return e.charCodeAt(q)===63?(B=g,q++):(B=r,le===0&&Se(Nf)),B===r&&(e.charCodeAt(q)===42?(B=y,q++):(B=r,le===0&&Se(zh)),B===r&&(e.charCodeAt(q)===43?(B=w,q++):(B=r,le===0&&Se(ml)))),B}function Am(){var B,z,ee,Z,de,ve;return B=Gy(),B===r&&(B=Ee(),B===r&&(B=qf(),B===r&&(B=oc(),B===r&&(B=My(),B===r&&(B=q,e.charCodeAt(q)===40?(z=E,q++):(z=r,le===0&&Se(Zu)),z!==r?(ee=cr(),Z=fp(),Z!==r?(de=cr(),e.charCodeAt(q)===41?(ve=S,q++):(ve=r,le===0&&Se(Yh)),ve!==r?(Et=B,B=Ry(Z)):(q=B,B=r)):(q=B,B=r)):(q=B,B=r)))))),B}function oc(){var B,z,ee,Z,de,ve,tr,Pr;return B=q,z=gs(),z!==r?(ee=q,le++,Z=q,de=cr(),ve=q,tr=gp(),tr!==r?(Pr=cr(),tr=[tr,Pr],ve=tr):(q=ve,ve=r),ve===r&&(ve=null),e.charCodeAt(q)===61?(tr=u,q++):(tr=r,le===0&&Se(Of)),tr!==r?(de=[de,ve,tr],Z=de):(q=Z,Z=r),le--,Z===r?ee=void 0:(q=ee,ee=r),ee!==r?(Et=B,B=Ty(z)):(q=B,B=r)):(q=B,B=r),B}function My(){var B,z,ee,Z;return B=q,z=qy(),z!==r?(ee=cr(),Z=Ma(),Z!==r?(Et=B,B=ky(z,Z)):(q=B,B=r)):(q=B,B=r),B}function qy(){var B;return e.charCodeAt(q)===38?(B=d,q++):(B=r,le===0&&Se(sr)),B===r&&(e.charCodeAt(q)===33?(B=v,q++):(B=r,le===0&&Se(Fi))),B}function hn(){var B;return e.length>q?(B=e.charAt(q),q++):(B=r,le===0&&Se(Lf)),B}function wl(){var B,z;return le++,e.charCodeAt(q)===9?(B=C,q++):(B=r,le===0&&Se(Wh)),B===r&&(e.charCodeAt(q)===11?(B=D,q++):(B=r,le===0&&Se(ae)),B===r&&(e.charCodeAt(q)===12?(B=H,q++):(B=r,le===0&&Se(ye)),B===r&&(e.charCodeAt(q)===32?(B=K,q++):(B=r,le===0&&Se(ze)),B===r&&(e.charCodeAt(q)===160?(B=_,q++):(B=r,le===0&&Se(Ve)),B===r&&(e.charCodeAt(q)===65279?(B=x,q++):(B=r,le===0&&Se(it)),B===r&&(B=Im())))))),le--,B===r&&(z=r,le===0&&Se(gl)),B}function Dn(){var B;return yt.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(Ct)),B}function Ua(){var B,z;return le++,e.charCodeAt(q)===10?(B=j,q++):(B=r,le===0&&Se(Qr)),B===r&&(e.substr(q,2)===U?(B=U,q+=2):(B=r,le===0&&Se(Sr)),B===r&&(e.charCodeAt(q)===13?(B=k,q++):(B=r,le===0&&Se(Bi)),B===r&&(e.charCodeAt(q)===8232?(B=N,q++):(B=r,le===0&&Se(Mo)),B===r&&(e.charCodeAt(q)===8233?(B=O,q++):(B=r,le===0&&Se(hs)))))),le--,B===r&&(z=r,le===0&&Se(Bt)),B}function Sm(){var B,z;return le++,B=jy(),B===r&&(B=Ha()),le--,B===r&&(z=r,le===0&&Se(xs)),B}function jy(){var B,z,ee,Z,de,ve;if(B=q,e.substr(q,2)===L?(z=L,q+=2):(z=r,le===0&&Se(Vr)),z!==r){for(ee=[],Z=q,de=q,le++,e.substr(q,2)===T?(ve=T,q+=2):(ve=r,le===0&&Se(ps)),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r);Z!==r;)ee.push(Z),Z=q,de=q,le++,e.substr(q,2)===T?(ve=T,q+=2):(ve=r,le===0&&Se(ps)),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r);e.substr(q,2)===T?(Z=T,q+=2):(Z=r,le===0&&Se(ps)),Z!==r?(z=[z,ee,Z],B=z):(q=B,B=r)}else q=B,B=r;return B}function _m(){var B,z,ee,Z,de,ve;if(B=q,e.substr(q,2)===L?(z=L,q+=2):(z=r,le===0&&Se(Vr)),z!==r){for(ee=[],Z=q,de=q,le++,e.substr(q,2)===T?(ve=T,q+=2):(ve=r,le===0&&Se(ps)),ve===r&&(ve=Dn()),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r);Z!==r;)ee.push(Z),Z=q,de=q,le++,e.substr(q,2)===T?(ve=T,q+=2):(ve=r,le===0&&Se(ps)),ve===r&&(ve=Dn()),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r);e.substr(q,2)===T?(Z=T,q+=2):(Z=r,le===0&&Se(ps)),Z!==r?(z=[z,ee,Z],B=z):(q=B,B=r)}else q=B,B=r;return B}function Ha(){var B,z,ee,Z,de,ve;if(B=q,e.substr(q,2)===M?(z=M,q+=2):(z=r,le===0&&Se(Qu)),z!==r){for(ee=[],Z=q,de=q,le++,ve=Dn(),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r);Z!==r;)ee.push(Z),Z=q,de=q,le++,ve=Dn(),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r);z=[z,ee],B=z}else q=B,B=r;return B}function gs(){var B,z,ee,Z;if(le++,B=q,z=mp(),z!==r){for(ee=[],Z=Cm();Z!==r;)ee.push(Z),Z=Cm();Et=B,B=Py(z,ee)}else q=B,B=r;return le--,B===r&&(z=r,le===0&&Se(ec)),B}function mp(){var B,z,ee;return B=Ky(),B===r&&(e.charCodeAt(q)===36?(B=p,q++):(B=r,le===0&&Se(Ho)),B===r&&(e.charCodeAt(q)===95?(B=W,q++):(B=r,le===0&&Se(Xh)),B===r&&(B=q,e.charCodeAt(q)===92?(z=G,q++):(z=r,le===0&&Se(jn)),z!==r?(ee=yl(),ee!==r?B=ee:(q=B,B=r)):(q=B,B=r)))),B}function Cm(){var B;return B=mp(),B===r&&(B=Vy(),B===r&&(B=Vf(),B===r&&(B=Gf(),B===r&&(e.charCodeAt(q)===8204?(B=J,q++):(B=r,le===0&&Se(er)),B===r&&(e.charCodeAt(q)===8205?(B=te,q++):(B=r,le===0&&Se(Gr))))))),B}function Ky(){var B;return B=Xy(),B===r&&(B=Fm(),B===r&&(B=Wy(),B===r&&(B=jf(),B===r&&(B=Yy(),B===r&&(B=Bm()))))),B}function Vy(){var B;return B=Ko(),B===r&&(B=Kf()),B}function Gy(){var B,z,ee;return le++,B=q,z=gp(),z!==r?(e.charCodeAt(q)===105?(ee=ie,q++):(ee=r,le===0&&Se(_r)),ee===r&&(ee=null),Et=B,B=Oy(z,ee)):(q=B,B=r),le--,B===r&&(z=r,le===0&&Se(ht)),B}function gp(){var B,z,ee,Z;if(le++,B=q,e.charCodeAt(q)===34?(z=ge,q++):(z=r,le===0&&Se(yr)),z!==r){for(ee=[],Z=so();Z!==r;)ee.push(Z),Z=so();e.charCodeAt(q)===34?(Z=ge,q++):(Z=r,le===0&&Se(yr)),Z!==r?(Et=B,B=cm(ee)):(q=B,B=r)}else q=B,B=r;if(B===r)if(B=q,e.charCodeAt(q)===39?(z=he,q++):(z=r,le===0&&Se(Rs)),z!==r){for(ee=[],Z=ue();Z!==r;)ee.push(Z),Z=ue();e.charCodeAt(q)===39?(Z=he,q++):(Z=r,le===0&&Se(Rs)),Z!==r?(Et=B,B=Ny(ee)):(q=B,B=r)}else q=B,B=r;return le--,B===r&&(z=r,le===0&&Se(Kn)),B}function so(){var B,z,ee,Z;return B=q,z=q,ee=q,le++,e.charCodeAt(q)===34?(Z=ge,q++):(Z=r,le===0&&Se(yr)),Z===r&&(e.charCodeAt(q)===92?(Z=G,q++):(Z=r,le===0&&Se(jn)),Z===r&&(Z=Dn())),le--,Z===r?ee=void 0:(q=ee,ee=r),ee!==r?(Z=hn(),Z!==r?(ee=[ee,Z],z=ee):(q=z,z=r)):(q=z,z=r),z!==r?B=e.substring(B,q):B=z,B===r&&(B=q,e.charCodeAt(q)===92?(z=G,q++):(z=r,le===0&&Se(jn)),z!==r?(ee=Mt(),ee!==r?B=ee:(q=B,B=r)):(q=B,B=r),B===r&&(B=ft())),B}function ue(){var B,z,ee,Z;return B=q,z=q,ee=q,le++,e.charCodeAt(q)===39?(Z=he,q++):(Z=r,le===0&&Se(Rs)),Z===r&&(e.charCodeAt(q)===92?(Z=G,q++):(Z=r,le===0&&Se(jn)),Z===r&&(Z=Dn())),le--,Z===r?ee=void 0:(q=ee,ee=r),ee!==r?(Z=hn(),Z!==r?(ee=[ee,Z],z=ee):(q=z,z=r)):(q=z,z=r),z!==r?B=e.substring(B,q):B=z,B===r&&(B=q,e.charCodeAt(q)===92?(z=G,q++):(z=r,le===0&&Se(jn)),z!==r?(ee=Mt(),ee!==r?B=ee:(q=B,B=r)):(q=B,B=r),B===r&&(B=ft())),B}function Ee(){var B,z,ee,Z,de,ve;if(le++,B=q,e.charCodeAt(q)===91?(z=Fe,q++):(z=r,le===0&&Se(Ii)),z!==r){for(e.charCodeAt(q)===94?(ee=ke,q++):(ee=r,le===0&&Se(ro)),ee===r&&(ee=null),Z=[],de=pe(),de===r&&(de=Ke());de!==r;)Z.push(de),de=pe(),de===r&&(de=Ke());e.charCodeAt(q)===93?(de=$e,q++):(de=r,le===0&&Se(qo)),de!==r?(e.charCodeAt(q)===105?(ve=ie,q++):(ve=r,le===0&&Se(_r)),ve===r&&(ve=null),Et=B,B=zr(ee,Z,ve)):(q=B,B=r)}else q=B,B=r;return le--,B===r&&(z=r,le===0&&Se(ni)),B}function pe(){var B,z,ee,Z;return B=q,z=Ke(),z!==r?(e.charCodeAt(q)===45?(ee=oe,q++):(ee=r,le===0&&Se(Uf)),ee!==r?(Z=Ke(),Z!==r?(Et=B,B=np(z,Z)):(q=B,B=r)):(q=B,B=r)):(q=B,B=r),B}function Ke(){var B,z,ee,Z;return B=q,z=q,ee=q,le++,e.charCodeAt(q)===93?(Z=$e,q++):(Z=r,le===0&&Se(qo)),Z===r&&(e.charCodeAt(q)===92?(Z=G,q++):(Z=r,le===0&&Se(jn)),Z===r&&(Z=Dn())),le--,Z===r?ee=void 0:(q=ee,ee=r),ee!==r?(Z=hn(),Z!==r?(ee=[ee,Z],z=ee):(q=z,z=r)):(q=z,z=r),z!==r?B=e.substring(B,q):B=z,B===r&&(B=q,e.charCodeAt(q)===92?(z=G,q++):(z=r,le===0&&Se(jn)),z!==r?(ee=Mt(),ee!==r?B=ee:(q=B,B=r)):(q=B,B=r),B===r&&(B=ft())),B}function ft(){var B,z,ee;return B=q,e.charCodeAt(q)===92?(z=G,q++):(z=r,le===0&&Se(jn)),z!==r?(ee=Ua(),ee!==r?(Et=B,B=Na()):(q=B,B=r)):(q=B,B=r),B}function Mt(){var B,z,ee,Z;return B=kr(),B===r&&(B=q,e.charCodeAt(q)===48?(z=me,q++):(z=r,le===0&&Se(Z1)),z!==r?(ee=q,le++,Z=Dm(),le--,Z===r?ee=void 0:(q=ee,ee=r),ee!==r?(Et=B,B=lm()):(q=B,B=r)):(q=B,B=r),B===r&&(B=ks(),B===r&&(B=yl()))),B}function kr(){var B;return B=ir(),B===r&&(B=vp()),B}function ir(){var B,z;return e.charCodeAt(q)===39?(B=he,q++):(B=r,le===0&&Se(Rs)),B===r&&(e.charCodeAt(q)===34?(B=ge,q++):(B=r,le===0&&Se(yr)),B===r&&(e.charCodeAt(q)===92?(B=G,q++):(B=r,le===0&&Se(jn)),B===r&&(B=q,e.charCodeAt(q)===98?(z=Be,q++):(z=r,le===0&&Se(Jh)),z!==r&&(Et=B,z=sp()),B=z,B===r&&(B=q,e.charCodeAt(q)===102?(z=Ue,q++):(z=r,le===0&&Se(my)),z!==r&&(Et=B,z=Ts()),B=z,B===r&&(B=q,e.charCodeAt(q)===110?(z=We,q++):(z=r,le===0&&Se(Q1)),z!==r&&(Et=B,z=fm()),B=z,B===r&&(B=q,e.charCodeAt(q)===114?(z=He,q++):(z=r,le===0&&Se(Hf)),z!==r&&(Et=B,z=dm()),B=z,B===r&&(B=q,e.charCodeAt(q)===116?(z=St,q++):(z=r,le===0&&Se(em)),z!==r&&(Et=B,z=hm()),B=z,B===r&&(B=q,e.charCodeAt(q)===118?(z=st,q++):(z=r,le===0&&Se(gy)),z!==r&&(Et=B,z=pm()),B=z)))))))),B}function vp(){var B,z,ee,Z;return B=q,z=q,ee=q,le++,Z=zy(),Z===r&&(Z=Dn()),le--,Z===r?ee=void 0:(q=ee,ee=r),ee!==r?(Z=hn(),Z!==r?(ee=[ee,Z],z=ee):(q=z,z=r)):(q=z,z=r),z!==r?B=e.substring(B,q):B=z,B}function zy(){var B;return B=ir(),B===r&&(B=Dm(),B===r&&(e.charCodeAt(q)===120?(B=wt,q++):(B=r,le===0&&Se(Zh)),B===r&&(e.charCodeAt(q)===117?(B=Mn,q++):(B=r,le===0&&Se(Qh))))),B}function ks(){var B,z,ee,Z,de,ve;return B=q,e.charCodeAt(q)===120?(z=wt,q++):(z=r,le===0&&Se(Zh)),z!==r?(ee=q,Z=q,de=si(),de!==r?(ve=si(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r),Z!==r?ee=e.substring(ee,q):ee=Z,ee!==r?(Et=B,B=mm(ee)):(q=B,B=r)):(q=B,B=r),B}function yl(){var B,z,ee,Z,de,ve,tr,Pr;return B=q,e.charCodeAt(q)===117?(z=Mn,q++):(z=r,le===0&&Se(Qh)),z!==r?(ee=q,Z=q,de=si(),de!==r?(ve=si(),ve!==r?(tr=si(),tr!==r?(Pr=si(),Pr!==r?(de=[de,ve,tr,Pr],Z=de):(q=Z,Z=r)):(q=Z,Z=r)):(q=Z,Z=r)):(q=Z,Z=r),Z!==r?ee=e.substring(ee,q):ee=Z,ee!==r?(Et=B,B=gm(ee)):(q=B,B=r)):(q=B,B=r),B}function Dm(){var B;return Zr.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(ep)),B}function si(){var B;return $s.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(vy)),B}function qf(){var B,z;return B=q,e.charCodeAt(q)===46?(z=Rr,q++):(z=r,le===0&&Se(tm)),z!==r&&(Et=B,z=ms()),B=z,B}function Ma(){var B,z,ee,Z;return le++,B=q,e.charCodeAt(q)===123?(z=i,q++):(z=r,le===0&&Se(qn)),z!==r?(ee=Xt(),e.charCodeAt(q)===125?(Z=a,q++):(Z=r,le===0&&Se(Uo)),Z!==r?B=ee:(q=B,B=r)):(q=B,B=r),le--,B===r&&(z=r,le===0&&Se(tp)),B}function Xt(){var B,z;return B=q,z=wp(),Et=B,z=Ly(z),B=z,B}function wp(){var B,z,ee,Z,de,ve;if(B=q,z=[],ee=[],Z=q,de=q,le++,to.test(e.charAt(q))?(ve=e.charAt(q),q++):(ve=r,le===0&&Se(tc)),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r),Z!==r)for(;Z!==r;)ee.push(Z),Z=q,de=q,le++,to.test(e.charAt(q))?(ve=e.charAt(q),q++):(ve=r,le===0&&Se(tc)),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r);else ee=r;for(ee===r&&(ee=q,e.charCodeAt(q)===123?(Z=i,q++):(Z=r,le===0&&Se(qn)),Z!==r?(de=wp(),e.charCodeAt(q)===125?(ve=a,q++):(ve=r,le===0&&Se(Uo)),ve!==r?(Z=[Z,de,ve],ee=Z):(q=ee,ee=r)):(q=ee,ee=r));ee!==r;){if(z.push(ee),ee=[],Z=q,de=q,le++,to.test(e.charAt(q))?(ve=e.charAt(q),q++):(ve=r,le===0&&Se(tc)),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r),Z!==r)for(;Z!==r;)ee.push(Z),Z=q,de=q,le++,to.test(e.charAt(q))?(ve=e.charAt(q),q++):(ve=r,le===0&&Se(tc)),le--,ve===r?de=void 0:(q=de,de=r),de!==r?(ve=hn(),ve!==r?(de=[de,ve],Z=de):(q=Z,Z=r)):(q=Z,Z=r);else ee=r;ee===r&&(ee=q,e.charCodeAt(q)===123?(Z=i,q++):(Z=r,le===0&&Se(qn)),Z!==r?(de=wp(),e.charCodeAt(q)===125?(ve=a,q++):(ve=r,le===0&&Se(Uo)),ve!==r?(Z=[Z,de,ve],ee=Z):(q=ee,ee=r)):(q=ee,ee=r))}return B=e.substring(B,q),B}function Fm(){var B;return Ot.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(rc)),B}function jf(){var B;return rt.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(rm)),B}function Yy(){var B;return Ne.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(nm)),B}function Wy(){var B;return Ar.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(wy)),B}function Xy(){var B;return ls.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(sm)),B}function Kf(){var B;return _t.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(im)),B}function Ko(){var B;return pl.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(om)),B}function Vf(){var B;return ds.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(am)),B}function Bm(){var B;return _e.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(yy)),B}function Gf(){var B;return Wu.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(Ey)),B}function Im(){var B;return Qt.test(e.charAt(q))?(B=e.charAt(q),q++):(B=r,le===0&&Se(by)),B}function cr(){var B,z;for(B=[],z=wl(),z===r&&(z=Ua(),z===r&&(z=Sm()));z!==r;)B.push(z),z=wl(),z===r&&(z=Ua(),z===r&&(z=Sm()));return B}function zf(){var B,z;for(B=[],z=wl(),z===r&&(z=_m());z!==r;)B.push(z),z=wl(),z===r&&(z=_m());return B}function Yf(){var B,z,ee,Z;return B=q,z=cr(),e.charCodeAt(q)===59?(ee=Tr,q++):(ee=r,le===0&&Se(um)),ee!==r?(z=[z,ee],B=z):(q=B,B=r),B===r&&(B=q,z=zf(),ee=Ha(),ee===r&&(ee=null),Z=Ua(),Z!==r?(z=[z,ee,Z],B=z):(q=B,B=r),B===r&&(B=q,z=cr(),ee=El(),ee!==r?(z=[z,ee],B=z):(q=B,B=r))),B}function El(){var B,z;return B=q,le++,e.length>q?(z=e.charAt(q),q++):(z=r,le===0&&Se(Lf)),le--,z===r?B=void 0:(q=B,B=r),B}let qa=t.reservedWords||[];if(ur=o(),ur!==r&&q===e.length)return ur;throw ur!==r&&q<e.length&&Se(sc()),up(nc,en<e.length?e.charAt(en):null,en<e.length?ic(en,en+1):ic(en,en))}KP.exports={SyntaxError:ll,parse:Doe}});var Xw=be((F5e,GP)=>{"use strict";var B5e=F(I()),Foe=qw(),Boe=jP(),Ioe=VP(),$oe=YC(),xoe=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await"],H1={VERSION:$oe,RESERVED_WORDS:xoe,GrammarError:Foe,parser:Ioe,compiler:Boe,generate(e,t){t=t!==void 0?t:{};function r(o){let i={};return Object.keys(o).forEach(a=>{i[a]=o[a].slice()}),i}let n="plugins"in t?t.plugins:[],s={parser:H1.parser,passes:r(H1.compiler.passes),reservedWords:H1.RESERVED_WORDS.slice()};return n.forEach(o=>{o.use(s,t)}),H1.compiler.compile(s.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:s.reservedWords}),s.passes,t)}};GP.exports=H1});function ln(){if(!a4){let e=zP.default.generate(Roe);a4={parse:t=>e.parse(t,{normalizeInlineEchConfigList:bw,setSurgeXhttpOption:O7})}}return a4}var R5e,zP,Roe,a4,YP=re(()=>{R5e=F(I()),zP=F(Xw());Fh();_w();Roe=String.raw`
|
||
// global initializer
|
||
{{
|
||
function $set(obj, path, value) {
|
||
if (Object(obj) !== obj) return obj;
|
||
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [];
|
||
path
|
||
.slice(0, -1)
|
||
.reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
|
||
path[path.length - 1]
|
||
] = value;
|
||
return obj;
|
||
}
|
||
}}
|
||
|
||
// per-parser initializer
|
||
{
|
||
const proxy = {};
|
||
const obfs = {};
|
||
const shadowTLS = {};
|
||
const xhttpOpts = { mode: "auto" };
|
||
let xhttpEnabled = false;
|
||
let clientFingerprint;
|
||
let echConfig;
|
||
const $ = {};
|
||
|
||
function handleWebsocket() {
|
||
if (obfs.type === "ws") {
|
||
proxy.network = "ws";
|
||
$set(proxy, "ws-opts.path", obfs.path);
|
||
$set(proxy, "ws-opts.headers", obfs['ws-headers']);
|
||
if (obfs.httpUpgrade) $set(proxy, "ws-opts.v2ray-http-upgrade", true);
|
||
if (proxy['ws-opts'] && proxy['ws-opts']['headers'] && proxy['ws-opts']['headers'].Host) {
|
||
proxy['ws-opts']['headers'].Host = proxy['ws-opts']['headers'].Host.replace(/^"(.*)"$/, '$1')
|
||
}
|
||
}
|
||
}
|
||
function handleShadowTLS() {
|
||
if (shadowTLS.password && !shadowTLS.version) {
|
||
shadowTLS.version = 2;
|
||
}
|
||
if (shadowTLS.password) {
|
||
if (shadowTLS.version < 2) {
|
||
throw new Error("shadow-tls version " + shadowTLS.version + " is not supported");
|
||
}
|
||
proxy.plugin = "shadow-tls";
|
||
proxy["plugin-opts"] = {
|
||
host: shadowTLS.host,
|
||
password: shadowTLS.password,
|
||
version: shadowTLS.version,
|
||
};
|
||
if (proxy.alpn) {
|
||
$set(proxy, "plugin-opts.alpn", proxy.alpn);
|
||
delete proxy.alpn;
|
||
}
|
||
}
|
||
}
|
||
function stripQuotes(value) {
|
||
const trimmed = value.trim();
|
||
const quote = trimmed[0];
|
||
if (
|
||
(quote === '"' || quote === "'") &&
|
||
trimmed[trimmed.length - 1] === quote
|
||
) {
|
||
return trimmed.slice(1, -1);
|
||
}
|
||
|
||
return trimmed;
|
||
}
|
||
function isQuotedEscape(text, index) {
|
||
return text[index] === "\\" &&
|
||
(text[index + 1] === '"' || text[index + 1] === "\\");
|
||
}
|
||
function unescapeQuotedValue(value) {
|
||
return value.replace(/\\(["\\])/g, "$1");
|
||
}
|
||
function supportsQuotedEscapes() {
|
||
return proxy.type === "vless" || proxy.type === "h2-connect";
|
||
}
|
||
function readQuotedHeaderKey(text, start) {
|
||
const quote = text[start];
|
||
const withEscapes = proxy.type === "vless" && quote === '"';
|
||
let index = start + 1;
|
||
let hasKey = false;
|
||
|
||
while (index < text.length) {
|
||
const char = text[index];
|
||
if (withEscapes && isQuotedEscape(text, index)) {
|
||
hasKey = true;
|
||
index += 2;
|
||
continue;
|
||
}
|
||
if (char === quote) {
|
||
return hasKey ? index + 1 : -1;
|
||
}
|
||
|
||
hasKey = true;
|
||
index++;
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
function startsWithQuotedHeaderKey(text) {
|
||
const trimmed = text.trim();
|
||
if (trimmed[0] !== '"' && trimmed[0] !== "'") return false;
|
||
|
||
const index = readQuotedHeaderKey(trimmed, 0);
|
||
if (index === -1) return false;
|
||
|
||
let cursor = index;
|
||
while (cursor < trimmed.length && /\s/.test(trimmed[cursor])) cursor++;
|
||
return trimmed[cursor] === ":";
|
||
}
|
||
function stripOuterHeadersQuotes(headers) {
|
||
const trimmed = headers.trim();
|
||
const quote = trimmed[0];
|
||
|
||
if (
|
||
(quote === '"' || quote === "'") &&
|
||
trimmed[trimmed.length - 1] === quote &&
|
||
!startsWithQuotedHeaderKey(trimmed)
|
||
) {
|
||
return trimmed.slice(1, -1);
|
||
}
|
||
|
||
return trimmed;
|
||
}
|
||
function isHeaderKeyStart(text, start) {
|
||
let index = start;
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
|
||
if (text[index] === '"' || text[index] === "'") {
|
||
index = readQuotedHeaderKey(text, index);
|
||
if (index === -1) return false;
|
||
} else {
|
||
const keyStart = index;
|
||
while (
|
||
index < text.length &&
|
||
/[!#$%&'*+\-.^_|~0-9A-Za-z]/.test(text[index])
|
||
)
|
||
index++;
|
||
if (index === keyStart) return false;
|
||
}
|
||
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
return text[index] === ":";
|
||
}
|
||
function isOptionStart(text, start) {
|
||
let index = start;
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
|
||
const keyStart = index;
|
||
while (index < text.length && /[0-9A-Za-z-]/.test(text[index])) index++;
|
||
if (index === keyStart) return false;
|
||
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
return text[index] === "=";
|
||
}
|
||
function isHeaderValueQuoteEnd(text, index, pairSeparator, allowCommaEnd, containerQuote) {
|
||
let cursor = index + 1;
|
||
while (cursor < text.length && /\s/.test(text[cursor])) cursor++;
|
||
|
||
if (cursor >= text.length) return true;
|
||
if (allowCommaEnd && text[cursor] === "," && isOptionStart(text, cursor + 1)) {
|
||
return true;
|
||
}
|
||
if (text[cursor] === pairSeparator && isHeaderKeyStart(text, cursor + 1)) {
|
||
return true;
|
||
}
|
||
if (containerQuote && text[cursor] === containerQuote) {
|
||
let next = cursor + 1;
|
||
while (next < text.length && /\s/.test(text[next])) next++;
|
||
return next >= text.length || text[next] === ",";
|
||
}
|
||
|
||
return false;
|
||
}
|
||
function findHeaderSeparator(pair) {
|
||
let quote = "";
|
||
|
||
for (let index = 0; index < pair.length; index++) {
|
||
const char = pair[index];
|
||
|
||
if (quote) {
|
||
if (char === quote) {
|
||
quote = "";
|
||
}
|
||
continue;
|
||
}
|
||
|
||
if (char === '"' || char === "'") {
|
||
quote = char;
|
||
continue;
|
||
}
|
||
|
||
if (char === ":") {
|
||
return index;
|
||
}
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
function readUnquotedHeadersEnd(text, start, pairSeparator) {
|
||
let index = start;
|
||
let quote = "";
|
||
let quoteRole = "";
|
||
let seenSeparator = false;
|
||
|
||
while (index < text.length) {
|
||
const char = text[index];
|
||
|
||
if (quote) {
|
||
if (char === quote) {
|
||
if (
|
||
quoteRole === "key" ||
|
||
isHeaderValueQuoteEnd(text, index, pairSeparator, true)
|
||
) {
|
||
quote = "";
|
||
quoteRole = "";
|
||
}
|
||
}
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === '"' || char === "'") {
|
||
quote = char;
|
||
quoteRole = seenSeparator ? "value" : "key";
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === ":" && !seenSeparator) {
|
||
seenSeparator = true;
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === pairSeparator && isHeaderKeyStart(text, index + 1)) {
|
||
seenSeparator = false;
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === ",") break;
|
||
index++;
|
||
}
|
||
|
||
return index;
|
||
}
|
||
function readQuotedHeadersEnd(text, start, pairSeparator) {
|
||
const quote = text[start];
|
||
const withEscapes = proxy.type === "vless";
|
||
let index = start + 1;
|
||
let innerQuote = "";
|
||
let quoteRole = "";
|
||
let seenSeparator = false;
|
||
|
||
while (index < text.length) {
|
||
const char = text[index];
|
||
if (withEscapes && isQuotedEscape(text, index)) {
|
||
index += 2;
|
||
continue;
|
||
}
|
||
|
||
if (innerQuote) {
|
||
if (char === innerQuote) {
|
||
if (
|
||
quoteRole === "key" ||
|
||
isHeaderValueQuoteEnd(text, index, pairSeparator, false, quote)
|
||
) {
|
||
innerQuote = "";
|
||
quoteRole = "";
|
||
}
|
||
}
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === quote) {
|
||
let cursor = index + 1;
|
||
while (cursor < text.length && /\s/.test(text[cursor])) cursor++;
|
||
if (cursor >= text.length || text[cursor] === ",") {
|
||
return index + 1;
|
||
}
|
||
}
|
||
|
||
if (char === '"' || char === "'") {
|
||
innerQuote = char;
|
||
quoteRole = seenSeparator ? "value" : "key";
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === ":" && !seenSeparator) {
|
||
seenSeparator = true;
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === pairSeparator && isHeaderKeyStart(text, index + 1)) {
|
||
seenSeparator = false;
|
||
index++;
|
||
continue;
|
||
}
|
||
index++;
|
||
}
|
||
|
||
return text.length;
|
||
}
|
||
function readHeadersEnd(text, start, pairSeparator) {
|
||
let index = start;
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
|
||
if (
|
||
(text[index] === '"' || text[index] === "'") &&
|
||
!startsWithQuotedHeaderKey(text.slice(index))
|
||
) {
|
||
return readQuotedHeadersEnd(text, index, pairSeparator);
|
||
}
|
||
|
||
return readUnquotedHeadersEnd(text, start, pairSeparator);
|
||
}
|
||
function splitHeaders(headers, pairSeparator, withEscapes) {
|
||
const result = [];
|
||
let start = 0;
|
||
let quote = "";
|
||
let quoteRole = "";
|
||
let seenSeparator = false;
|
||
|
||
for (let index = 0; index < headers.length; index++) {
|
||
const char = headers[index];
|
||
if (withEscapes && isQuotedEscape(headers, index)) {
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (quote) {
|
||
if (char === quote) {
|
||
if (
|
||
quoteRole === "key" ||
|
||
isHeaderValueQuoteEnd(headers, index, pairSeparator, false)
|
||
) {
|
||
quote = "";
|
||
quoteRole = "";
|
||
}
|
||
}
|
||
continue;
|
||
}
|
||
|
||
if (char === '"' || char === "'") {
|
||
quote = char;
|
||
quoteRole = seenSeparator ? "value" : "key";
|
||
continue;
|
||
}
|
||
|
||
if (char === ":" && !seenSeparator) {
|
||
seenSeparator = true;
|
||
continue;
|
||
}
|
||
|
||
if (char === pairSeparator && isHeaderKeyStart(headers, index + 1)) {
|
||
result.push(headers.slice(start, index));
|
||
start = index + 1;
|
||
seenSeparator = false;
|
||
}
|
||
}
|
||
|
||
result.push(headers.slice(start));
|
||
return result;
|
||
}
|
||
function parseHeaders(headers, pairSeparator) {
|
||
const result = {};
|
||
const trimmed = headers.trim();
|
||
const content = stripOuterHeadersQuotes(trimmed);
|
||
const withEscapes = proxy.type === "vless" && content !== trimmed;
|
||
splitHeaders(content, pairSeparator, withEscapes).forEach((pair) => {
|
||
const index = findHeaderSeparator(pair);
|
||
if (index === -1) return;
|
||
|
||
const key = stripQuotes(pair.slice(0, index));
|
||
const value = stripQuotes(pair.slice(index + 1));
|
||
|
||
if (key) {
|
||
result[key] = withEscapes ? unescapeQuotedValue(value) : value;
|
||
}
|
||
});
|
||
return result;
|
||
}
|
||
function normalizeVmessSecurity(security) {
|
||
const normalized = String(security || "").trim().toLowerCase();
|
||
const supported = ["aes-128-gcm", "chacha20-ietf-poly1305"];
|
||
if (!supported.includes(normalized)) return "auto";
|
||
return normalized === "chacha20-ietf-poly1305" ? "chacha20-poly1305" : normalized;
|
||
}
|
||
function parseAlpn(value) {
|
||
return stripQuotes(value)
|
||
.split(",")
|
||
.map((item) => item.trim())
|
||
.filter((item) => item !== "");
|
||
}
|
||
}
|
||
|
||
start = (masque/anytls/shadowsocks/vmess/vless/trojan/h2_connect/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/trust_tunnel/direct/external) {
|
||
if (
|
||
["auto", "none", "apple-26", "chromium-155"].includes(clientFingerprint) &&
|
||
proxy.network !== "h3" &&
|
||
(proxy.tls || proxy.type === "trojan")
|
||
) {
|
||
proxy._surge_client_fingerprint = clientFingerprint;
|
||
if (clientFingerprint === "apple-26") proxy["client-fingerprint"] = "ios";
|
||
if (clientFingerprint === "chromium-155") proxy["client-fingerprint"] = "chrome";
|
||
}
|
||
if (
|
||
echConfig !== undefined &&
|
||
(proxy.tls || ["trojan", "tuic", "hysteria2"].includes(proxy.type))
|
||
) {
|
||
if (proxy["reality-opts"]) error("ECH cannot be combined with REALITY");
|
||
// Preserve malformed ECH for export validation so another parser cannot discard it.
|
||
const config = options.normalizeInlineEchConfigList(echConfig) ?? echConfig;
|
||
proxy["ech-opts"] = { enable: true, config };
|
||
}
|
||
return proxy;
|
||
}
|
||
|
||
shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/udp_relay/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/udp_port/proxy_policy_parameter/others)* {
|
||
proxy.type = "ss";
|
||
// handle obfs
|
||
if (obfs.type == "http" || obfs.type === "tls") {
|
||
proxy.plugin = "obfs";
|
||
$set(proxy, "plugin-opts.mode", obfs.type);
|
||
$set(proxy, "plugin-opts.host", obfs.host);
|
||
$set(proxy, "plugin-opts.path", obfs.path);
|
||
}
|
||
handleShadowTLS();
|
||
}
|
||
vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_http_upgrade/ws_path/ws_headers/vmess_method/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "vmess";
|
||
proxy.cipher = proxy.cipher || "auto";
|
||
// Surfboard 与 Surge 默认不一致, 不管 Surfboard https://getsurfboard.com/docs/profile-format/proxy/external-proxy/vmess
|
||
if (proxy.aead) {
|
||
proxy.alterId = 0;
|
||
} else {
|
||
proxy.alterId = 1;
|
||
}
|
||
handleWebsocket();
|
||
handleShadowTLS();
|
||
}
|
||
vless = tag equals vless_address (vless_username/vless_option/reality_option/ws/ws_http_upgrade/ws_path/ws_headers/grpc/grpc_service_name/grpc_mode/grpc_authority/xhttp/xhttp_headers/xhttp_option/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy["packet-encoding"] = "xudp";
|
||
if (proxy["reality-opts"] && proxy["reality-opts"]["public-key"]) proxy.tls = true;
|
||
if (xhttpEnabled) {
|
||
proxy.network = "xhttp";
|
||
proxy["xhttp-opts"] = xhttpOpts;
|
||
} else {
|
||
handleWebsocket();
|
||
}
|
||
handleShadowTLS();
|
||
}
|
||
vless_address = "vless" address { proxy.type = "vless"; }
|
||
trojan = tag equals "trojan" address (passwordk/ws/ws_http_upgrade/ws_path/ws_headers/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "trojan";
|
||
handleWebsocket();
|
||
handleShadowTLS();
|
||
}
|
||
https = tag equals "https" address (username password)? (usernamek passwordk)? (headers/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "http";
|
||
proxy.tls = true;
|
||
handleShadowTLS();
|
||
}
|
||
h2_connect = tag equals h2_connect_address h2_credentials? (h2_credential/h2_headers/headers/max_streams/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.tls = true;
|
||
handleShadowTLS();
|
||
}
|
||
h2_connect_address = "h2-connect" address { proxy.type = "h2-connect"; }
|
||
h2_credentials = comma !([a-zA-Z0-9-]+ equals) user:quoted_value comma pass:quoted_value {
|
||
proxy.username = user;
|
||
proxy.password = pass;
|
||
}
|
||
h2_credential = comma key:("username"/"password") equals value:quoted_value { proxy[key] = value; }
|
||
// Keep nested single-quoted Surge header values in the shared header parser.
|
||
h2_headers = comma "headers" equals value:double_quoted_value &{
|
||
return !/(?:^|;)\s*[^:;]+:\s*'.*?'\s*(?:;|$)/.test(value);
|
||
} {
|
||
const entries = [];
|
||
for (const pair of value.split(";")) {
|
||
const separator = pair.indexOf(":");
|
||
if (separator <= 0) continue;
|
||
const key = pair.slice(0, separator).trim();
|
||
if (key) entries.push([key, unescapeQuotedValue(pair.slice(separator + 1).trim())]);
|
||
}
|
||
proxy.headers = Object.fromEntries(entries);
|
||
}
|
||
http = tag equals "http" address (username password)? (usernamek passwordk)? (headers/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "http";
|
||
handleShadowTLS();
|
||
}
|
||
ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (server_fingerprint/idle_timeout/private_key/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "ssh";
|
||
handleShadowTLS();
|
||
}
|
||
snell = tag equals ("snell"i/"opensnell"i) address (snell_version/snell_mode/snell_psk/obfs/obfs_host/obfs_uri/udp_relay/reuse/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "snell";
|
||
// handle obfs
|
||
if (obfs.type == "http" || obfs.type === "tls") {
|
||
$set(proxy, "obfs-opts.mode", obfs.type);
|
||
$set(proxy, "obfs-opts.host", obfs.host);
|
||
$set(proxy, "obfs-opts.path", obfs.path);
|
||
}
|
||
handleShadowTLS();
|
||
}
|
||
tuic = tag equals "tuic" address (alpn/token/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/proxy_policy_parameter/others)* {
|
||
proxy.type = "tuic";
|
||
handleShadowTLS();
|
||
}
|
||
tuic_v5 = tag equals "tuic-v5" address (alpn/passwordk/uuidk/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/proxy_policy_parameter/others)* {
|
||
proxy.type = "tuic";
|
||
proxy.version = 5;
|
||
handleShadowTLS();
|
||
}
|
||
wireguard = tag equals "wireguard" (section_name/common_policy_parameter/proxy_only_parameter/ignored_policy_parameter)* {
|
||
if (!proxy["section-name"]) error("WireGuard requires section-name");
|
||
proxy.type = "wireguard-surge";
|
||
}
|
||
hysteria2 = tag equals "hysteria2" address (sni/cert_verify_name/alpn/tls_verification/client_cert/ech_config/passwordk/tls_fingerprint/download_bandwidth/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/hysteria2_obfs_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "hysteria2";
|
||
handleShadowTLS();
|
||
}
|
||
socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "socks5";
|
||
handleShadowTLS();
|
||
}
|
||
socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek passwordk)? (udp_relay/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "socks5";
|
||
proxy.tls = true;
|
||
handleShadowTLS();
|
||
}
|
||
anytls = tag equals "anytls" address (passwordk/reuse/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/proxy_policy_parameter/others)* {
|
||
proxy.type = "anytls";
|
||
proxy.tls = true;
|
||
}
|
||
trust_tunnel = tag equals "trust-tunnel" address (usernamek/passwordk/client_random_auth_key/headers/max_streams/reuse/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/h3/proxy_policy_parameter/others)* {
|
||
proxy.type = "trusttunnel";
|
||
proxy.tls = true;
|
||
}
|
||
masque = tag equals "masque" address (usernamek/passwordk/port_hopping/port_hopping_interval/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/udp_relay/proxy_policy_parameter/others)* {
|
||
proxy.type = "masque-surge";
|
||
proxy.tls = true;
|
||
}
|
||
|
||
direct = tag equals "direct"i (common_policy_parameter/interface_parameter/udp_relay/ignored_policy_parameter)* {
|
||
proxy.type = "direct";
|
||
}
|
||
|
||
external = tag equals "external" (external_exec/external_local_port/external_arg/external_address/udp_relay/proxy_policy_parameter/ignored_policy_parameter)* {
|
||
proxy.type = "external";
|
||
proxy.args = proxy.args || [];
|
||
proxy.addresses = proxy.addresses || [];
|
||
}
|
||
external_exec = comma "exec" equals value:quoted_value { if (proxy.exec === undefined) proxy.exec = value; }
|
||
external_local_port = comma "local-port" equals value:quoted_value { if (proxy["local-port"] === undefined) proxy["local-port"] = value; }
|
||
external_arg = comma "args" equals value:quoted_value {
|
||
proxy.args = proxy.args || [];
|
||
proxy.args.push(value);
|
||
}
|
||
external_address = comma "addresses" equals value:quoted_value {
|
||
proxy.addresses = proxy.addresses || [];
|
||
proxy.addresses.push(value);
|
||
}
|
||
|
||
proxy_policy_parameter = common_policy_parameter / interface_parameter / proxy_only_parameter
|
||
common_policy_parameter = ip_version / hybrid / tfo / fast_open / tos / block_quic / test_url / test_timeout / test_udp
|
||
interface_parameter = interface / allow_other_interface / dns_follow_interface
|
||
proxy_only_parameter = no_error_alert / ecn / underlying_proxy
|
||
ignored_policy_parameter = comma [^=,]+ equals quoted_value
|
||
|
||
address = comma server:server comma port:port {
|
||
proxy.server = server;
|
||
proxy.port = port;
|
||
}
|
||
|
||
server = ip/domain
|
||
|
||
ip = & {
|
||
const start = peg$currPos;
|
||
let j = start;
|
||
while (j < input.length) {
|
||
if (input[j] === ",") break;
|
||
j++;
|
||
}
|
||
peg$currPos = j;
|
||
$.ip = input.substring(start, j).trim();
|
||
return true;
|
||
} { return $.ip; }
|
||
|
||
domain = match:[0-9a-zA-z-_.]+ {
|
||
const domain = match.join("");
|
||
if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) {
|
||
return domain;
|
||
}
|
||
}
|
||
|
||
port = digits:[0-9]+ {
|
||
const port = parseInt(digits.join(""), 10);
|
||
if (port >= 0 && port <= 65535) {
|
||
return port;
|
||
}
|
||
}
|
||
|
||
port_hopping = comma "port-hopping" equals value:(
|
||
'"' _ list:port_hopping_list _ '"' { return list; }
|
||
/ "'" _ list:port_hopping_list _ "'" { return list; }
|
||
/ port_hopping_list
|
||
) &(_ ("," / !.)) { proxy.ports = value.replace(/\s+/g, "").replace(/;/g, ","); }
|
||
port_hopping_list = $(port_hopping_range (_ [,;] _ port_hopping_range)*)
|
||
port_hopping_range = [0-9]+ ("-" [0-9]+)?
|
||
port_hopping_interval = comma "port-hopping-interval" equals match:$[0-9]+ { proxy["hop-interval"] = parseInt(match.trim()); }
|
||
|
||
username = & {
|
||
let j = peg$currPos;
|
||
let start, end;
|
||
let first = true;
|
||
while (j < input.length) {
|
||
if (input[j] === ',') {
|
||
if (first) {
|
||
start = j + 1;
|
||
first = false;
|
||
} else {
|
||
end = j;
|
||
break;
|
||
}
|
||
}
|
||
j++;
|
||
}
|
||
const match = input.substring(start, end);
|
||
if (match.indexOf("=") === -1) {
|
||
$.username = match;
|
||
peg$currPos = end;
|
||
return true;
|
||
}
|
||
} { proxy.username = $.username.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
password = comma match:[^,]+ { proxy.password = match.join("").replace(/^"(.*)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
|
||
tls = comma "tls" equals flag:bool { proxy.tls = flag; }
|
||
sni = comma "sni" equals match:[^,]+ {
|
||
const sni = match.join("").replace(/^"(.*)"$/, '$1');
|
||
if (sni === "off") {
|
||
proxy["disable-sni"] = true;
|
||
} else {
|
||
proxy.sni = sni;
|
||
}
|
||
}
|
||
cert_verify_name = comma "server-cert-verify-name" equals match:[^,]+ { proxy["name-cert-verify"] = stripQuotes(match.join("")); }
|
||
tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; }
|
||
tls_fingerprint = comma "server-cert-fingerprint-sha256" equals value:quoted_value { proxy["tls-fingerprint"] = value.trim(); }
|
||
client_fingerprint = comma "client-fingerprint" equals value:quoted_value { clientFingerprint = value.trim().toLowerCase(); }
|
||
client_cert = comma "client-cert" equals match:[^,]+ { proxy["keystore-client-cert"] = stripQuotes(match.join("")); }
|
||
ech_config = comma "ech-config" equals value:quoted_value { echConfig = value; }
|
||
|
||
snell_psk = comma "psk" equals value:quoted_value { proxy.psk = value; }
|
||
snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); }
|
||
snell_mode = comma "mode" equals match:[^,]+ {
|
||
const mode = stripQuotes(match.join("")).trim();
|
||
if (["default", "unshaped", "unsafe-raw"].includes(mode)) {
|
||
proxy.mode = mode;
|
||
}
|
||
}
|
||
|
||
usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
vmess_uuid = comma "username" equals match:[^,]+ { proxy.uuid = match.join(""); }
|
||
vmess_aead = comma "vmess-aead" equals flag:bool { proxy.aead = flag; }
|
||
// shortcut: keep text IDs as given, convert them to UUIDv5 when a target requires it.
|
||
vless_username = comma "username" equals value:quoted_value { proxy.uuid = value.trim(); }
|
||
vless_option = comma key:("flow"/"encryption") equals value:quoted_value { proxy[key] = value.trim(); }
|
||
reality_option = comma "reality-" key:("public-key"/"short-id") equals value:quoted_value { $set(proxy, "reality-opts." + key, value.trim()); }
|
||
client_random_auth_key = comma "client-random-auth-key" equals value:$[^,]* { proxy["client-random-auth-key"] = stripQuotes(value); }
|
||
|
||
method = comma "encrypt-method" equals cipher:cipher {
|
||
proxy.cipher = cipher;
|
||
}
|
||
vmess_method = comma "encrypt-method" equals cipher:$[^,]+ {
|
||
proxy.cipher = normalizeVmessSecurity(cipher);
|
||
}
|
||
cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"idea-cfb"/"none"/"rc2-cfb"/"rc4-md5"/"rc4"/"salsa20"/"seed-cfb"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm");
|
||
|
||
ws = comma "ws" equals flag:bool { if (flag) obfs.type = "ws"; }
|
||
ws_http_upgrade = comma "ws-http-upgrade" equals flag:bool { obfs.httpUpgrade = flag; }
|
||
ws_headers = comma "ws-headers" equals value:pipe_headers { obfs["ws-headers"] = value; }
|
||
pipe_headers = & {
|
||
const start = peg$currPos;
|
||
const index = readHeadersEnd(input, start, "|");
|
||
|
||
$.headers = input.substring(start, index);
|
||
peg$currPos = index;
|
||
return $.headers.trim().length > 0;
|
||
} { return parseHeaders($.headers, "|"); }
|
||
ws_path = comma "ws-path" equals path:(vless_quoted_value / value:uri { return stripQuotes(value); }) { obfs.path = path; }
|
||
grpc = comma "grpc" equals flag:bool { if (flag) proxy.network = "grpc"; }
|
||
grpc_service_name = comma "grpc-service-name" equals value:quoted_value { $set(proxy, "grpc-opts.grpc-service-name", value.trim()); }
|
||
grpc_mode = comma "grpc-mode" equals value:quoted_value { $set(proxy, "grpc-opts._grpc-type", value.trim()); }
|
||
grpc_authority = comma "grpc-authority" equals value:quoted_value { $set(proxy, "grpc-opts._grpc-authority", value.trim()); }
|
||
xhttp = comma "xhttp" equals flag:bool { xhttpEnabled = flag; }
|
||
xhttp_headers = comma "xhttp-headers" equals value:pipe_headers {
|
||
for (const key of Object.keys(value)) {
|
||
if (/^host$/i.test(key)) delete value[key];
|
||
}
|
||
xhttpOpts.headers = value;
|
||
}
|
||
xhttp_option = comma "xhttp-" key:$[a-z0-9-]+ equals value:quoted_value {
|
||
options.setSurgeXhttpOption(xhttpOpts, key, value.trim());
|
||
}
|
||
headers = comma "headers" equals & {
|
||
const start = peg$currPos;
|
||
const index = readHeadersEnd(input, start, ";");
|
||
|
||
$.headers = input.substring(start, index);
|
||
peg$currPos = index;
|
||
return $.headers.trim().length > 0;
|
||
} { proxy.headers = parseHeaders($.headers, ";"); }
|
||
|
||
obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; }
|
||
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); };
|
||
obfs_uri = comma "obfs-uri" equals path:uri { obfs.path = path }
|
||
uri = $[^,]+
|
||
|
||
udp_relay = comma "udp-relay" equals flag:policy_bool { proxy.udp = flag; }
|
||
fast_open = comma "fast-open" equals flag:policy_bool { proxy.tfo = flag; }
|
||
reuse = comma "reuse" equals flag:bool { proxy.reuse = flag; }
|
||
ecn = comma "ecn" equals mode:policy_toggle { if (mode !== undefined) proxy.ecn = mode; }
|
||
tfo = comma "tfo" equals flag:policy_bool { proxy.tfo = flag; }
|
||
ip_version = comma "ip-version" equals value:quoted_value { proxy["ip-version"] = value.trim(); }
|
||
section_name = comma "section-name" equals value:quoted_value { proxy["section-name"] = value.trim(); }
|
||
no_error_alert = comma "no-error-alert" equals value:quoted_value { proxy["no-error-alert"] = value.trim(); }
|
||
underlying_proxy = comma "underlying-proxy" equals value:quoted_value { proxy["underlying-proxy"] = value.trim(); }
|
||
download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); }
|
||
test_url = comma "test-url" equals value:quoted_value { proxy["test-url"] = value.trim(); }
|
||
test_udp = comma "test-udp" equals value:quoted_value { proxy["test-udp"] = value.trim(); }
|
||
test_timeout = comma "test-timeout" equals value:quoted_value {
|
||
const seconds = value.trim();
|
||
if (/^(?:\d+(?:\.\d*)?|\.\d+)$/.test(seconds)) proxy["test-timeout"] = Number(seconds);
|
||
}
|
||
max_streams = comma "max-streams" equals match:quoted_integer { proxy["max-streams"] = match; }
|
||
quoted_integer = '"' match:$[0-9]+ '"' { return parseInt(match.trim()); } / "'" match:$[0-9]+ "'" { return parseInt(match.trim()); } / match:$[0-9]+ { return parseInt(match.trim()); }
|
||
tos = comma "tos" equals value:quoted_value {
|
||
const text = value.trim();
|
||
proxy.tos = /^(?:\d+|0x[\da-f]+)$/i.test(text) ? Number(text) : text;
|
||
}
|
||
interface = comma "interface" equals value:quoted_value { proxy.interface = value.trim(); }
|
||
allow_other_interface = comma "allow-other-interface" equals flag:policy_bool { proxy["allow-other-interface"] = flag; }
|
||
dns_follow_interface = comma "dns-follow-interface" equals flag:policy_bool { proxy["dns-follow-interface"] = flag; }
|
||
hybrid = comma "hybrid" equals mode:policy_toggle { if (mode !== undefined) proxy.hybrid = mode; }
|
||
policy_bool = value:quoted_value &{ return /^(?:true|false)$/.test(value.trim()); } { return value.trim() === "true"; }
|
||
policy_toggle = value:quoted_value {
|
||
const mode = value.trim();
|
||
if (mode === "true" || mode === "false") return mode === "true";
|
||
if (["auto", "on", "off"].includes(mode)) return mode;
|
||
}
|
||
idle_timeout = comma "idle-timeout" equals match:$[0-9]+ { proxy["idle-timeout"] = parseInt(match.trim()); }
|
||
private_key = comma "private-key" equals match:[^,]+ { proxy["keystore-private-key"] = stripQuotes(match.join("")); }
|
||
server_fingerprint = comma "server-fingerprint" equals match:[^,]+ { proxy["server-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
block_quic = comma "block-quic" equals value:quoted_value { proxy["block-quic"] = value.trim(); }
|
||
udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); }
|
||
shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { shadowTLS.version = parseInt(match.trim()); }
|
||
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { shadowTLS.host = match.join(""); }
|
||
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { shadowTLS.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
token = comma "token" equals match:[^,]+ { proxy.token = match.join(""); }
|
||
alpn = comma "alpn" equals match:quoted_value {
|
||
const values = parseAlpn(match);
|
||
if (values.length > 0) proxy.alpn = values;
|
||
}
|
||
h3 = comma "h3" equals flag:bool { if (flag) proxy.network = "h3"; }
|
||
quoted_value
|
||
= value:double_quoted_value { return supportsQuotedEscapes() ? unescapeQuotedValue(value) : value; }
|
||
/ '"' match:$[^"]* '"' { return match; }
|
||
/ "'" match:$[^']* "'" { return supportsQuotedEscapes() ? unescapeQuotedValue(match) : match; }
|
||
/ value:uri { return value.trim(); }
|
||
double_quoted_value = '"' value:$(("\\" ('"' / "\\") / [^"])*) '"' &(_ ("," / !.)) { return value; }
|
||
vless_quoted_value = &{ return proxy.type === "vless"; } value:quoted_value { return value.trim(); }
|
||
uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); }
|
||
hysteria2_obfs_password = comma mode:("salamander"/"gecko") "-password" equals value:(
|
||
text:double_quoted_value { return unescapeQuotedValue(text); }
|
||
/ quoted_value
|
||
) {
|
||
if (proxy.obfs === "gecko" && mode === "salamander") return;
|
||
proxy.obfs = mode;
|
||
proxy["obfs-password"] = value;
|
||
}
|
||
|
||
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
|
||
comma = _ "," _
|
||
equals = _ "=" _
|
||
_ = [ \r\t]*
|
||
bool = b:("true"/"false") { return b === "true" }
|
||
others = comma [^=,]+ equals [^=,]+
|
||
`});function ri(){if(!u4){let e=WP.default.generate(Toe);u4={parse:t=>e.parse(t,{setLoonXhttpOption:ik})}}return u4}var P5e,WP,Toe,u4,XP=re(()=>{P5e=F(I()),WP=F(Xw());IC();Toe=String.raw`
|
||
// global initializer
|
||
{{
|
||
function $set(obj, path, value) {
|
||
if (Object(obj) !== obj) return obj;
|
||
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [];
|
||
path
|
||
.slice(0, -1)
|
||
.reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
|
||
path[path.length - 1]
|
||
] = value;
|
||
return obj;
|
||
}
|
||
}}
|
||
|
||
// per-parser initializer
|
||
{
|
||
const proxy = {};
|
||
const obfs = {};
|
||
const transport = {};
|
||
const xhttpOpts = {};
|
||
const vlessEncryption = {};
|
||
const shadowTLS = {};
|
||
const $ = {};
|
||
|
||
function handleTransport() {
|
||
if (transport.type === "tcp") { /* do nothing */ }
|
||
else if (transport.type === "ws") {
|
||
proxy.network = "ws";
|
||
$set(proxy, "ws-opts.path", transport.path);
|
||
$set(proxy, "ws-opts.headers.Host", transport.host);
|
||
} else if (transport.type === "http") {
|
||
proxy.network = "http";
|
||
$set(proxy, "http-opts.path", transport.path);
|
||
$set(proxy, "http-opts.headers.Host", transport.host);
|
||
} else if (transport.type === "xhttp") {
|
||
if (proxy.type === "vmess" && proxy.alterId !== 0) {
|
||
throw new Error("VMess XHTTP requires AEAD");
|
||
}
|
||
proxy.network = "xhttp";
|
||
proxy.udp ??= false;
|
||
if (transport.path != null) xhttpOpts.path = transport.path;
|
||
if (transport.host != null) xhttpOpts.host = transport.host;
|
||
const download = xhttpOpts["download-settings"];
|
||
if (download) {
|
||
download.tls ??= Boolean(download["reality-opts"]?.["public-key"]);
|
||
const fingerprint = loonClientFingerprint(download._loon_tls_profile);
|
||
if (fingerprint) download["client-fingerprint"] = fingerprint;
|
||
}
|
||
proxy["xhttp-opts"] = xhttpOpts;
|
||
}
|
||
}
|
||
|
||
function handleShadowTLS() {
|
||
if (shadowTLS.password) {
|
||
if (shadowTLS.version < 2) {
|
||
throw new Error("shadow-tls version " + shadowTLS.version + " is not supported");
|
||
}
|
||
proxy.plugin = "shadow-tls";
|
||
proxy["plugin-opts"] = {
|
||
host: shadowTLS.host,
|
||
password: shadowTLS.password,
|
||
version: shadowTLS.version,
|
||
};
|
||
if (proxy.alpn) {
|
||
$set(proxy, "plugin-opts.alpn", proxy.alpn);
|
||
delete proxy.alpn;
|
||
}
|
||
}
|
||
}
|
||
|
||
function normalizeVmessSecurity(security) {
|
||
const normalized = String(security || "").trim().toLowerCase();
|
||
const supported = ["none", "auto", "aes-128-gcm", "chacha20-ietf-poly1305"];
|
||
if (!supported.includes(normalized)) return "auto";
|
||
return normalized === "chacha20-ietf-poly1305" ? "chacha20-poly1305" : normalized;
|
||
}
|
||
|
||
function loonClientFingerprint(tlsProfile) {
|
||
switch (String(tlsProfile || "").trim()) {
|
||
case "chrome":
|
||
case "chrome147":
|
||
return "chrome";
|
||
case "safari-ios18":
|
||
case "safari-ios-26":
|
||
return "ios";
|
||
}
|
||
}
|
||
}
|
||
|
||
start = (shadowsocksr/shadowsocks/vmess/vless/trojan/https/http/socks5/hysteria2/anytls/tailscale/snell/mieru) {
|
||
return proxy;
|
||
}
|
||
|
||
shadowsocksr = tag equals "shadowsocksr"i address method password (ssr_protocol/ssr_protocol_param/obfs_ssr/obfs_ssr_param/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/tls_profile/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)*{
|
||
proxy.type = "ssr";
|
||
// handle ssr obfs
|
||
proxy.obfs = obfs.type;
|
||
handleShadowTLS();
|
||
}
|
||
shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs_hostv)? (obfs_ss/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/tls_profile/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/udp_over_tcp/others)* {
|
||
proxy.type = "ss";
|
||
// handle ss obfs
|
||
if (obfs.type == "http" || obfs.type === "tls") {
|
||
proxy.plugin = "obfs";
|
||
$set(proxy, "plugin-opts.mode", obfs.type);
|
||
$set(proxy, "plugin-opts.host", obfs.host);
|
||
$set(proxy, "plugin-opts.path", obfs.path);
|
||
}
|
||
handleShadowTLS();
|
||
}
|
||
vmess = tag equals "vmess"i address vmess_method uuid (xhttp_transport/transport/transport_host/transport_path/xhttp_option/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/vmess_alterId/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* {
|
||
proxy.type = "vmess";
|
||
proxy.cipher = proxy.cipher || "auto";
|
||
proxy.alterId = proxy.alterId || 0;
|
||
handleTransport();
|
||
}
|
||
vless = tag equals "vless"i address uuid (xhttp_transport/transport/transport_host/transport_path/xhttp_option/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/flow/vless_encryption/public_key/short_id/block_quic/others)* {
|
||
proxy.type = "vless";
|
||
const { mode, rtt, padding, "public-keys": publicKeys } = vlessEncryption;
|
||
if (mode && mode !== "none") {
|
||
if (!publicKeys) throw new Error("VLESS encryption requires public keys");
|
||
proxy.encryption = ["mlkem768x25519plus", mode, rtt || "0rtt", padding, publicKeys].filter(Boolean).join(".");
|
||
}
|
||
handleTransport();
|
||
}
|
||
trojan = tag equals "trojan"i address password (xhttp_transport/transport/transport_host/transport_path/xhttp_option/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* {
|
||
proxy.type = "trojan";
|
||
handleTransport();
|
||
}
|
||
anytls = tag equals "anytls"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/idle_session_check_interval/idle_session_timeout/min_idle_session/max_stream_count/others)* {
|
||
proxy.type = "anytls";
|
||
handleTransport();
|
||
}
|
||
hysteria2 = tag equals "hysteria2"i address password (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/udp_relay/fast_open/download_bandwidth/server_ports/hop_interval/salamander_password/ecn/ip_mode/block_quic/others)* {
|
||
proxy.type = "hysteria2";
|
||
}
|
||
https = tag equals "https"i address (username password)? (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/block_quic/others)* {
|
||
proxy.type = "http";
|
||
proxy.tls = true;
|
||
}
|
||
http = tag equals "http"i address (username password)? (fast_open/udp_relay/ip_mode/block_quic/others)* {
|
||
proxy.type = "http";
|
||
}
|
||
socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/block_quic/others)* {
|
||
proxy.type = "socks5";
|
||
}
|
||
tailscale = tag equals "tailscale"i (tailscale_string/tailscale_bool/tailscale_mtu/idle_session_timeout/udp_relay/block_quic/others)* {
|
||
proxy.type = "tailscale";
|
||
if (proxy["exit-node"] === "auto") proxy["exit-node"] = "auto:any";
|
||
if (proxy["exit-node"] === "none") proxy["exit-node"] = "";
|
||
}
|
||
snell = tag equals ("snell"i/"opensnell"i) address snell_positional_psk? (snell_psk/snell_version/snell_obfs/obfs_host/obfs_uri/udp_relay/ip_mode/block_quic/others)* {
|
||
if (!proxy.psk) throw new Error("Missing Snell PSK");
|
||
proxy.type = "snell";
|
||
proxy.version ??= 4;
|
||
proxy.udp ??= false;
|
||
if (obfs.type === "http") {
|
||
proxy["obfs-opts"] = { mode: obfs.type, host: obfs.host, path: obfs.path };
|
||
}
|
||
}
|
||
mieru = tag equals "mieru"i address comma user:option_value comma pass:option_value (udp_relay/ip_mode/block_quic/others)* {
|
||
proxy.type = "mieru";
|
||
proxy.transport = "TCP";
|
||
proxy.username = user;
|
||
proxy.password = pass;
|
||
proxy.udp ??= false;
|
||
}
|
||
|
||
tailscale_string = comma key:("auth-key"/"control-url"/"hostname"/"exit-node"/"path-mode"/"ip-mode") equals value:(
|
||
'"' match:$[^"]* '"' { return match; }
|
||
/ match:$[^,"]* { return match.trim(); }
|
||
) {
|
||
if (value !== "" || key === "exit-node") {
|
||
proxy[key === "ip-mode" ? "ip-version" : key] = value;
|
||
}
|
||
}
|
||
tailscale_bool = comma key:("accept-routes"/"accept-dns"/"magic-dns") equals flag:bool { proxy[key] = flag; }
|
||
tailscale_mtu = comma "mtu" equals match:$[0-9]+ { proxy.mtu = Number(match); }
|
||
|
||
address = comma server:server comma port:port {
|
||
proxy.server = server;
|
||
proxy.port = port;
|
||
}
|
||
|
||
server = ip/domain
|
||
|
||
ip = & {
|
||
const start = peg$currPos;
|
||
let j = start;
|
||
while (j < input.length) {
|
||
if (input[j] === ",") break;
|
||
j++;
|
||
}
|
||
peg$currPos = j;
|
||
$.ip = input.substring(start, j).trim();
|
||
return true;
|
||
} { return $.ip; }
|
||
|
||
domain = match:[0-9a-zA-z-_.]+ {
|
||
const domain = match.join("");
|
||
if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) {
|
||
return domain;
|
||
}
|
||
throw new Error("Invalid domain: " + domain);
|
||
}
|
||
|
||
port = digits:[0-9]+ {
|
||
const port = parseInt(digits.join(""), 10);
|
||
if (port >= 0 && port <= 65535) {
|
||
return port;
|
||
}
|
||
throw new Error("Invalid port number: " + port);
|
||
}
|
||
|
||
method = comma cipher:cipher {
|
||
proxy.cipher = cipher;
|
||
}
|
||
vmess_method = comma cipher:$[^,]+ {
|
||
proxy.cipher = normalizeVmessSecurity(cipher);
|
||
}
|
||
cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"auto"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none"/"rc4-md5"/"rc4"/"salsa20"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm");
|
||
|
||
username = & {
|
||
let j = peg$currPos;
|
||
let start, end;
|
||
let first = true;
|
||
while (j < input.length) {
|
||
if (input[j] === ',') {
|
||
if (first) {
|
||
start = j + 1;
|
||
first = false;
|
||
} else {
|
||
end = j;
|
||
break;
|
||
}
|
||
}
|
||
j++;
|
||
}
|
||
const match = input.substring(start, end);
|
||
if (match.indexOf("=") === -1) {
|
||
$.username = match;
|
||
peg$currPos = end;
|
||
return true;
|
||
}
|
||
} { proxy.username = $.username; }
|
||
password = comma '"' match:[^"]* '"' { proxy.password = match.join(""); }
|
||
uuid = comma '"' match:[^"]+ '"' { proxy.uuid = match.join(""); }
|
||
|
||
obfs_typev = comma type:("http"/"tls") { obfs.type = type; }
|
||
obfs_hostv = comma match:[^,]+ { obfs.host = match.join(""); }
|
||
|
||
obfs_ss = comma "obfs-name" equals type:("http"/"tls") { obfs.type = type; }
|
||
|
||
obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { obfs.type = type; }
|
||
obfs_ssr_param = comma "obfs-param" equals match:$[^,]+ { proxy["obfs-param"] = match; }
|
||
|
||
obfs_host = comma "obfs-host" equals value:option_value { obfs.host = value; }
|
||
obfs_uri = comma "obfs-uri" equals value:option_value { obfs.path = value; }
|
||
|
||
snell_positional_psk = comma psk:quoted_value { proxy.psk = psk; }
|
||
snell_psk = comma "psk" equals psk:option_value { proxy.psk = psk; }
|
||
snell_version = comma "version" equals version:$[0-9]+ { proxy.version = Number(version); }
|
||
snell_obfs = comma ("obfs-name"/"obfs") equals type:("none"/"http") { obfs.type = type; }
|
||
|
||
transport = comma "transport" equals type:("tcp"/"ws"/"http") { transport.type = type; }
|
||
transport_host = comma "host" equals value:option_value { transport.host = value; }
|
||
transport_path = comma "path" equals value:option_value { transport.path = value; }
|
||
|
||
xhttp_transport = comma "transport" equals "xhttp" { transport.type = "xhttp"; }
|
||
xhttp_option = comma "xhttp-" key:$[a-z0-9-]+ equals value:option_value {
|
||
options.setLoonXhttpOption(xhttpOpts, key, value);
|
||
}
|
||
|
||
ssr_protocol = comma "protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; }
|
||
ssr_protocol_param = comma "protocol-param" equals param:$[^=,]+ { proxy["protocol-param"] = param; }
|
||
|
||
vmess_alterId = comma "alterId" equals alterId:$[0-9]+ { proxy.alterId = parseInt(alterId); }
|
||
|
||
udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); }
|
||
shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { shadowTLS.version = parseInt(match.trim()); }
|
||
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { shadowTLS.host = match.join(""); }
|
||
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { shadowTLS.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
|
||
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
|
||
tls_name = comma sni:("tls-name") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
sni = comma "sni" equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; }
|
||
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
tls_profile = comma "tls-profile" equals match:[^,]+ {
|
||
const tlsProfile = match.join("").replace(/^"(.*)"$/, '$1').trim();
|
||
proxy["_loon_tls_profile"] = tlsProfile;
|
||
const clientFingerprint = loonClientFingerprint(tlsProfile);
|
||
if (clientFingerprint) proxy["client-fingerprint"] = clientFingerprint;
|
||
}
|
||
alpn = comma "alpn" equals match:option_value {
|
||
const values = match
|
||
.split(",")
|
||
.map((item) => item.trim())
|
||
.filter((item) => item !== "");
|
||
if (values.length > 0) proxy.alpn = values;
|
||
}
|
||
|
||
flow = comma "flow" equals match:[^,]+ { proxy["flow"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
vless_encryption = comma "encryption-" key:("mode"/"rtt"/"public-keys"/"padding") equals value:option_value {
|
||
vlessEncryption[key] = value;
|
||
}
|
||
public_key = comma "public-key" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["public-key"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
short_id = comma "short-id" equals value:option_value { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["short-id"] = value; }
|
||
|
||
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
||
udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; }
|
||
ip_mode = comma "ip-mode" equals match:[^,]+ { proxy["ip-version"] = match.join(""); }
|
||
|
||
ecn = comma "ecn" equals flag:bool { proxy.ecn = flag; }
|
||
download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); }
|
||
server_ports = comma "server-ports" equals '"' match:$[^"]+ '"' { proxy.ports = match.trim().replace(/\s*-\s*/g, "-").replace(/\s*,\s*/g, ","); }
|
||
hop_interval = comma "hop-interval" equals match:$[0-9]+ { proxy["hop-interval"] = parseInt(match, 10); }
|
||
salamander_password = comma "salamander-password" equals match:[^,]+ { proxy['obfs-password'] = match.join(""); proxy.obfs = 'salamander'; }
|
||
|
||
block_quic = comma "block-quic" equals flag:bool { if(flag) proxy["block-quic"] = "on"; else proxy["block-quic"] = "off"; }
|
||
|
||
idle_session_check_interval = comma "idle-session-check-interval" equals match:$[0-9]+ { proxy["idle-session-check-interval"] = parseInt(match.trim()); }
|
||
idle_session_timeout = comma "idle-session-timeout" equals match:$[0-9]+ { proxy["idle-session-timeout"] = parseInt(match.trim()); }
|
||
min_idle_session = comma "min-idle-session" equals match:$[0-9]+ { proxy["min-idle-session"] = parseInt(match.trim()); }
|
||
max_stream_count = comma "max-stream-count" equals match:$[0-9]+ { proxy["max-stream-count"] = parseInt(match.trim()); }
|
||
|
||
udp_over_tcp = comma "udp-over-tcp" equals flag:bool { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 2; }
|
||
|
||
server_dns = comma "server-dns" equals value:(
|
||
'"' match:$[^"]* '"' { return match; }
|
||
/ $(!(comma [a-zA-Z0-9_-]+ equals) [^"])*
|
||
) {
|
||
proxy["server-dns"] = value.split(",").map((item) => item.trim()).filter(Boolean);
|
||
}
|
||
|
||
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
|
||
quoted_value = '"' match:$[^"]* '"' { return match; }
|
||
option_value = quoted_value / match:$[^,"]* { return match.trim(); }
|
||
comma = _ "," _
|
||
equals = _ "=" _
|
||
_ = [ \r\t]*
|
||
bool = b:("true"/"false") { return b === "true" }
|
||
others = server_dns / (comma [^=,]+ equals [^=,]+)
|
||
`});function koe(e){if(typeof e!="string")return;let t=e.trim().replace(/:/g,"");if(!t||t.length%2||/[^0-9a-f]/i.test(t))return;let r=l4.Buffer.from(t,"hex"),n=[];for(let s=0;s<r.length;){let o=r[s++];if(!o||s+o>r.length)return;n.push(r.subarray(s,s+o).toString("utf8")),s+=o}return n}function Zi(){if(!c4){let e=JP.default.generate(Poe);c4={parse(t,r){let n=e.parse(t,{...r,byteLength:l4.Buffer.byteLength}),s=koe(n["tls-alpn"]);return s&&(n.alpn=s),n}}}return c4}var N5e,l4,JP,Poe,c4,ZP=re(()=>{N5e=F(I()),l4=F(iu()),JP=F(Xw());Poe=String.raw`
|
||
// global initializer
|
||
{{
|
||
function $set(obj, path, value) {
|
||
if (Object(obj) !== obj) return obj;
|
||
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [];
|
||
path
|
||
.slice(0, -1)
|
||
.reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
|
||
path[path.length - 1]
|
||
] = value;
|
||
return obj;
|
||
}
|
||
}}
|
||
|
||
// per-parse initializer
|
||
{
|
||
const proxy = {};
|
||
const obfs = {};
|
||
const $ = {};
|
||
let mieruUdpOverTcp = false;
|
||
|
||
function setQxHttpObfs(type) {
|
||
// Preserve the original QX http-obfs token for round-trip output,
|
||
// including the upstream "vemss-http" typo that appears in QX
|
||
// examples.
|
||
proxy._qx_obfs_http = type;
|
||
obfs.type = "http";
|
||
return type;
|
||
}
|
||
|
||
function handleObfs() {
|
||
if (obfs.type === "ws" || obfs.type === "wss") {
|
||
proxy.network = "ws";
|
||
if (obfs.type === 'wss') {
|
||
proxy.tls = true;
|
||
}
|
||
$set(proxy, "ws-opts.path", obfs.path);
|
||
$set(proxy, "ws-opts.headers.Host", obfs.host);
|
||
} else if (obfs.type === "over-tls") {
|
||
proxy.tls = true;
|
||
// Some QX share links use obfs-host as the TLS server name for
|
||
// plain over-tls TCP nodes instead of the explicit tls-host field.
|
||
// Accept it as a compatibility alias, but do not override tls-host.
|
||
if (obfs.host && !proxy.sni) {
|
||
proxy.sni = obfs.host;
|
||
}
|
||
} else if (obfs.type === "http") {
|
||
proxy.network = "http";
|
||
$set(proxy, "http-opts.path", obfs.path);
|
||
$set(proxy, "http-opts.headers.Host", obfs.host);
|
||
}
|
||
}
|
||
}
|
||
|
||
start = (trojan/shadowsocks/vmess/vless/anytls/mieru/hysteria2/http/socks5) {
|
||
return proxy
|
||
}
|
||
|
||
trojan = "trojan" equals address
|
||
(password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/obfs/obfs_host/obfs_uri/tag/udp_relay/udp_over_tcp/fast_open/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* {
|
||
proxy.type = "trojan";
|
||
handleObfs();
|
||
}
|
||
|
||
shadowsocks = "shadowsocks" equals address
|
||
(password/method/obfs_ssr/obfs_ss/obfs_host/obfs_uri/ssr_protocol/ssr_protocol_param/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/udp_relay/udp_over_tcp_new/fast_open/tag/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* {
|
||
if (proxy.protocol || proxy.type === "ssr") {
|
||
proxy.type = "ssr";
|
||
if (!proxy.protocol) {
|
||
proxy.protocol = "origin";
|
||
}
|
||
// handle ssr obfs
|
||
if (obfs.host) proxy["obfs-param"] = obfs.host;
|
||
if (obfs.type) proxy.obfs = obfs.type;
|
||
} else {
|
||
proxy.type = "ss";
|
||
// handle ss obfs
|
||
if (obfs.type == "http" || obfs.type === "tls") {
|
||
proxy.plugin = "obfs";
|
||
$set(proxy, "plugin-opts", {
|
||
mode: obfs.type
|
||
});
|
||
} else if (obfs.type === "ws" || obfs.type === "wss") {
|
||
proxy.plugin = "v2ray-plugin";
|
||
$set(proxy, "plugin-opts.mode", "websocket");
|
||
if (obfs.type === "wss") {
|
||
$set(proxy, "plugin-opts.tls", true);
|
||
}
|
||
} else if (obfs.type === 'over-tls') {
|
||
proxy.tls = true;
|
||
if (obfs.host) {
|
||
proxy.sni = obfs.host;
|
||
}
|
||
}
|
||
if (obfs.type && obfs.type !== 'over-tls') {
|
||
$set(proxy, "plugin-opts.host", obfs.host);
|
||
$set(proxy, "plugin-opts.path", obfs.path);
|
||
}
|
||
}
|
||
}
|
||
|
||
vmess = "vmess" equals address
|
||
(uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs_vmess/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* {
|
||
proxy.type = "vmess";
|
||
proxy.cipher = proxy.cipher || "none";
|
||
if (proxy.aead === false) {
|
||
proxy.alterId = 1;
|
||
} else {
|
||
proxy.alterId = 0;
|
||
}
|
||
handleObfs();
|
||
}
|
||
|
||
vless = "vless" equals address
|
||
(uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs_vless/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/reality_base64_pubkey/reality_hex_shortid/vless_flow/others)* {
|
||
proxy.type = "vless";
|
||
proxy.cipher = proxy.cipher || "none";
|
||
handleObfs();
|
||
}
|
||
|
||
anytls = "anytls" equals address
|
||
(password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/udp_relay/fast_open/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* {
|
||
proxy.type = "anytls";
|
||
proxy.tls = true;
|
||
}
|
||
|
||
mieru = "mieru" equals address
|
||
(username/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/udp_relay/mieru_udp_over_tcp/fast_open/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* {
|
||
proxy.type = "mieru";
|
||
proxy.udp = proxy.udp === true && mieruUdpOverTcp;
|
||
}
|
||
|
||
hysteria2 = "hysteria2" equals address
|
||
(password/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/udp_relay/download_bandwidth/hysteria2_obfs_password/port_hopping/port_hopping_interval/server_check_url/tag/others)* {
|
||
proxy.type = "hysteria2";
|
||
proxy.tls = true;
|
||
}
|
||
|
||
http = "http" equals address
|
||
(username/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/fast_open/udp_relay/udp_over_tcp/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)*{
|
||
proxy.type = "http";
|
||
}
|
||
|
||
socks5 = "socks5" equals address
|
||
(username/password/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/fast_open/udp_relay/udp_over_tcp/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* {
|
||
proxy.type = "socks5";
|
||
}
|
||
|
||
address = server:server ":" port:port {
|
||
proxy.server = server;
|
||
proxy.port = port;
|
||
}
|
||
server = ip/domain
|
||
|
||
domain = match:[0-9a-zA-z-_.]+ {
|
||
const domain = match.join("");
|
||
if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) {
|
||
return domain;
|
||
}
|
||
}
|
||
|
||
ip = & {
|
||
const start = peg$currPos;
|
||
let end;
|
||
let j = start;
|
||
while (j < input.length) {
|
||
if (input[j] === ",") break;
|
||
if (input[j] === ":") end = j;
|
||
j++;
|
||
}
|
||
peg$currPos = end || j;
|
||
$.ip = input.substring(start, end).trim();
|
||
return true;
|
||
} { return $.ip; }
|
||
|
||
port = digits:[0-9]+ {
|
||
const port = parseInt(digits.join(""), 10);
|
||
if (port >= 0 && port <= 65535) {
|
||
return port;
|
||
}
|
||
}
|
||
|
||
username = comma "username" equals username:[^,]+ { proxy.username = username.join("").trim(); }
|
||
password = comma "password" equals password:$((!next_parameter .)+) { proxy.password = password.trim(); }
|
||
next_parameter = "," _ [^=,]+ equals
|
||
uuid = comma "password" equals uuid:[^,]+ { proxy.uuid = uuid.join("").trim(); }
|
||
|
||
method = comma "method" equals cipher:cipher {
|
||
proxy.cipher = cipher;
|
||
};
|
||
cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"none"/"rc2-cfb"/"rc4-md5-6"/"rc4-md5"/"salsa20"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm");
|
||
aead = comma "aead" equals flag:bool { proxy.aead = flag; }
|
||
|
||
udp_relay = comma "udp-relay" equals flag:bool { proxy.udp = flag; }
|
||
udp_over_tcp = comma "udp-over-tcp" equals flag:bool { throw new Error("UDP over TCP is not supported"); }
|
||
udp_over_tcp_new = comma "udp-over-tcp" equals param:$[^=,]+ { if (param === "sp.v1") { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 1; } else if (param === "sp.v2") { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 2; } else if (param === "true") { proxy["_ssr_python_uot"] = true; } else { throw new Error("Invalid value for udp-over-tcp"); } }
|
||
mieru_udp_over_tcp = comma "udp-over-tcp" equals raw:$[^,]* {
|
||
const value = raw.trim();
|
||
if (value !== "true" && value !== "false") {
|
||
throw new Error("mieru udp-over-tcp must be true or false");
|
||
}
|
||
mieruUdpOverTcp = value === "true";
|
||
}
|
||
|
||
download_bandwidth = comma "download-bandwidth" equals value:$[^,]+ { proxy.down = value.trim(); }
|
||
hysteria2_obfs_password = comma type:("salamander"/"gecko") "-password" equals value:$((!next_parameter .)*) {
|
||
if (proxy.obfs && proxy.obfs !== type) {
|
||
throw new Error("QX Hysteria 2 cannot combine salamander-password and gecko-password");
|
||
}
|
||
const password = value.trim();
|
||
if (options.byteLength(password, "utf8") < 4) {
|
||
throw new Error("QX Hysteria 2 " + type + "-password must be at least 4 bytes");
|
||
}
|
||
proxy.obfs = type;
|
||
proxy["obfs-password"] = password;
|
||
}
|
||
port_hopping = comma "port-hopping" equals ports:$(hopping_port (comma hopping_port)*) {
|
||
proxy.ports = ports.replace(/\s/g, "");
|
||
}
|
||
hopping_port = [0-9]+ (_ "-" _ [0-9]+)?
|
||
port_hopping_interval = comma "port-hopping-interval" equals interval:$[0-9]+ {
|
||
const seconds = Number(interval);
|
||
if (seconds >= 5 && seconds <= 3600) {
|
||
proxy["hop-interval"] = seconds;
|
||
}
|
||
}
|
||
|
||
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
||
|
||
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
|
||
tls_host = comma sni:("tls-host") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
tls_verification = comma "tls-verification" equals raw:$[^,]+ {
|
||
const value = raw.trim();
|
||
if (value === "true" || value === "false") {
|
||
proxy["skip-cert-verify"] = value !== "true";
|
||
} else {
|
||
proxy["name-cert-verify"] = value;
|
||
}
|
||
}
|
||
tls_fingerprint = comma "tls-cert-sha256" equals tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.trim(); }
|
||
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals param:$[^=,]+ { proxy["tls-pubkey-sha256"] = param; }
|
||
tls_alpn = comma "tls-alpn" equals param:$[^=,]+ { proxy["tls-alpn"] = param; }
|
||
tls_no_session_ticket = comma "tls-no-session-ticket" equals flag:bool {
|
||
proxy["tls-no-session-ticket"] = flag;
|
||
}
|
||
tls_no_session_reuse = comma "tls-no-session-reuse" equals flag:bool {
|
||
proxy["tls-no-session-reuse"] = flag;
|
||
}
|
||
|
||
obfs_ss = comma "obfs" equals (
|
||
type:("tls"/"wss"/"ws"/"over-tls") { obfs.type = type; return type; }
|
||
/ type:("http"/"vmess-http"/"vemss-http"/"shadowsocks-http") {
|
||
// QX accepts multiple http-obfs spellings for ss/vmess/vless; keep
|
||
// the original token so QX output can round-trip it unchanged.
|
||
return setQxHttpObfs(type);
|
||
}
|
||
)
|
||
obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { proxy.type = "ssr"; obfs.type = type; return type; }
|
||
obfs = comma "obfs" equals type:("wss"/"ws"/"over-tls"/"http") { obfs.type = type; return type; };
|
||
obfs_vmess = comma "obfs" equals (
|
||
type:("wss"/"ws"/"over-tls") { obfs.type = type; return type; }
|
||
/ type:("http"/"vmess-http"/"vemss-http"/"shadowsocks-http") {
|
||
// QX accepts multiple http-obfs spellings for ss/vmess/vless; keep
|
||
// the original token so QX output can round-trip it unchanged.
|
||
return setQxHttpObfs(type);
|
||
}
|
||
);
|
||
obfs_vless = comma "obfs" equals (
|
||
type:("wss"/"ws"/"over-tls") { obfs.type = type; return type; }
|
||
/ type:("http"/"vmess-http"/"vemss-http"/"shadowsocks-http") {
|
||
// QX accepts multiple http-obfs spellings for ss/vmess/vless; keep
|
||
// the original token so QX output can round-trip it unchanged.
|
||
return setQxHttpObfs(type);
|
||
}
|
||
);
|
||
|
||
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; }
|
||
|
||
ssr_protocol = comma "ssr-protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; return protocol; }
|
||
ssr_protocol_param = comma "ssr-protocol-param" equals param:$[^=,]+ { proxy["protocol-param"] = param; }
|
||
|
||
reality_base64_pubkey = comma "reality-base64-pubkey" equals param:$[^=,]+ {
|
||
$set(proxy, "reality-opts.public-key", param);
|
||
}
|
||
reality_hex_shortid = comma "reality-hex-shortid" equals param:$[^=,]+ {
|
||
$set(proxy, "reality-opts.short-id", param);
|
||
}
|
||
|
||
vless_flow = comma "vless-flow" equals param:$[^=,]+ { proxy["flow"] = param; }
|
||
server_check_url = comma "server_check_url" equals param:$[^,]+ { proxy["test-url"] = param.trim(); }
|
||
|
||
uri = $[^,]+
|
||
|
||
tag = comma "tag" equals tag:[^=,]+ { proxy.name = tag.join(""); }
|
||
others = comma [^=,]+ equals [^=,]+
|
||
comma = _ "," _
|
||
equals = _ "=" _
|
||
_ = [ \r\t]*
|
||
bool = b:("true"/"false") { return b === "true" }
|
||
`});function zu(e,t,r){if(Object(e)!==e)return e;if(Array.isArray(t)||(t=t.toString().match(/[^.[\]]+/g)||[]),t.some(n=>Ooe.has(n)))throw new Error("Unsafe property path");return t.slice(0,-1).reduce((n,s,o)=>Object.prototype.hasOwnProperty.call(n,s)&&Object(n[s])===n[s]?n[s]:n[s]=Math.abs(t[o+1])>>0===+t[o+1]?[]:{},e)[t[t.length-1]]=r,e}function Jw(e){if(e!=null)return/(TRUE)|1/i.test(e)}function QP(e){return Yi(e)!=null}function d4(e){try{return decodeURIComponent(e)}catch{return e}}function Noe(e){let t={},r=e.match(/^trojan:\/\/([^@]+)@(\[[^\]]+\]|[^/?#]+):(\d+)(?:\/)?(?:\?([^#]*))?(?:#(.*))?$/);if(!r)throw new Error("Invalid trojan url");let[,n,s,o,i,a]=r,u=s.replace(/^\[|\]$/g,"");if((s.startsWith("[")||s.includes(":"))&&!lr(u))throw new Error(`Invalid server: ${s}`);if(t.type="trojan",t.password=d4(n),t.server=s,t.port=Number(o),!Number.isSafeInteger(t.port)||t.port<1||t.port>65535)throw new Error(`Invalid port: ${o}`);t.name=a?d4(a):`${s}:${o}`;let l={};if(i)for(let f of i.split("&")){let m=f.indexOf("="),p=m===-1?f:f.slice(0,m);l[p]=m===-1?!0:d4(f.slice(m+1))}if(t["skip-cert-verify"]=Jw(l.allowInsecure),t.sni=l.sni||l.peer,t["client-fingerprint"]=l.fp??l["client-fingerprint"],t["tls-fingerprint"]=l.pcs,t._vcn=l.vcn?.split(",").map(f=>f.trim()).filter(Boolean),t["name-cert-verify"]=t._vcn?.[0],l.alpn&&(t.alpn=l.alpn.split(",")),Jw(l.ws)&&(t.network="ws",zu(t,"ws-opts.path",l.wspath)),l.type){let f=!1,m="",p="";if(t.network=l.type,t.network==="httpupgrade"&&(t.network="ws",f=!0),t.network==="grpc")t["grpc-opts"]={"grpc-service-name":l.serviceName,"_grpc-type":l.mode,"_grpc-authority":l.authority};else{if(l.path){let d=l.path;if(t.network==="ws"){let v=Ff(d,"ed");QP(v)&&(d=ti(d,"ed").path,f?m=v:p=v)}zu(t,`${t.network}-opts.path`,d)}l.host&&zu(t,`${t.network}-opts.headers.Host`,l.host),f?(m=m||(QP(l.ed)?String(l.ed):""),zu(t,"ws-opts.v2ray-http-upgrade",!0),m&&(zu(t,"ws-opts.v2ray-http-upgrade-fast-open",!0),zu(t,"ws-opts._v2ray-http-upgrade-ed",m))):t.network==="ws"&&p&&(zu(t,"ws-opts.max-early-data",Yi(p)),zu(t,"ws-opts.early-data-header-name","Sec-WebSocket-Protocol"))}if(l.security==="reality"){let d={};l.pbk&&(d["public-key"]=l.pbk),l.sid&&(d["short-id"]=l.sid),l.spx&&(d["_spider-x"]=l.spx),l.mode&&(t._mode=l.mode),l.extra&&(t._extra=l.extra),Object.keys(d).length&&zu(t,"reality-opts",d)}}return t.udp=Jw(l.udp),t.tfo=Jw(l.tfo),t}function h4(){return f4||(f4={parse:Noe}),f4}var M5e,Ooe,f4,eO=re(()=>{M5e=F(I());Hu();Ir();Ooe=new Set(["__proto__","constructor","prototype"])});var g4=be((p4,m4)=>{var q5e=F(I());(function(e,t){typeof p4=="object"&&typeof m4<"u"?m4.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(p4,(function(){"use strict";function e(ae,ye){return ye={exports:{}},ae(ye,ye.exports),ye.exports}var t=e(function(ae){var ye=ae.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=ye)}),r=e(function(ae){var ye=ae.exports={version:"2.6.5"};typeof __e=="number"&&(__e=ye)}),n=r.version,s=function(ae){return typeof ae=="object"?ae!==null:typeof ae=="function"},o=function(ae){if(!s(ae))throw TypeError(ae+" is not an object!");return ae},i=function(ae){try{return!!ae()}catch{return!0}},a=!i(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),u=t.document,l=s(u)&&s(u.createElement),f=function(ae){return l?u.createElement(ae):{}},m=!a&&!i(function(){return Object.defineProperty(f("div"),"a",{get:function(){return 7}}).a!=7}),p=function(ae,ye){if(!s(ae))return ae;var ze,Ve;if(ye&&typeof(ze=ae.toString)=="function"&&!s(Ve=ze.call(ae))||typeof(ze=ae.valueOf)=="function"&&!s(Ve=ze.call(ae))||!ye&&typeof(ze=ae.toString)=="function"&&!s(Ve=ze.call(ae)))return Ve;throw TypeError("Can't convert object to primitive value")},d=Object.defineProperty,v=a?Object.defineProperty:function(ye,ze,Ve){if(o(ye),ze=p(ze,!0),o(Ve),m)try{return d(ye,ze,Ve)}catch{}if("get"in Ve||"set"in Ve)throw TypeError("Accessors not supported!");return"value"in Ve&&(ye[ze]=Ve.value),ye},g={f:v},y=function(ae,ye){return{enumerable:!(ae&1),configurable:!(ae&2),writable:!(ae&4),value:ye}},w=a?function(ae,ye,ze){return g.f(ae,ye,y(1,ze))}:function(ae,ye,ze){return ae[ye]=ze,ae},E={}.hasOwnProperty,S=function(ae,ye){return E.call(ae,ye)},C=0,D=Math.random(),H=function(ae){return"Symbol(".concat(ae===void 0?"":ae,")_",(++C+D).toString(36))},K=!1,_=e(function(ae){var ye="__core-js_shared__",ze=t[ye]||(t[ye]={});(ae.exports=function(Ve,it){return ze[Ve]||(ze[Ve]=it!==void 0?it:{})})("versions",[]).push({version:r.version,mode:K?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),x=_("native-function-to-string",Function.toString),j=e(function(ae){var ye=H("src"),ze="toString",Ve=(""+x).split(ze);r.inspectSource=function(it){return x.call(it)},(ae.exports=function(it,Ct,Bt,Qr){var Sr=typeof Bt=="function";Sr&&(S(Bt,"name")||w(Bt,"name",Ct)),it[Ct]!==Bt&&(Sr&&(S(Bt,ye)||w(Bt,ye,it[Ct]?""+it[Ct]:Ve.join(String(Ct)))),it===t?it[Ct]=Bt:Qr?it[Ct]?it[Ct]=Bt:w(it,Ct,Bt):(delete it[Ct],w(it,Ct,Bt)))})(Function.prototype,ze,function(){return typeof this=="function"&&this[ye]||x.call(this)})}),U=function(ae){if(typeof ae!="function")throw TypeError(ae+" is not a function!");return ae},k=function(ae,ye,ze){if(U(ae),ye===void 0)return ae;switch(ze){case 1:return function(Ve){return ae.call(ye,Ve)};case 2:return function(Ve,it){return ae.call(ye,Ve,it)};case 3:return function(Ve,it,Ct){return ae.call(ye,Ve,it,Ct)}}return function(){return ae.apply(ye,arguments)}},N="prototype",O=function(ae,ye,ze){var Ve=ae&O.F,it=ae&O.G,Ct=ae&O.S,Bt=ae&O.P,Qr=ae&O.B,Sr=it?t:Ct?t[ye]||(t[ye]={}):(t[ye]||{})[N],Bi=it?r:r[ye]||(r[ye]={}),Mo=Bi[N]||(Bi[N]={}),hs,xs,Vr,ps;it&&(ze=ye);for(hs in ze)xs=!Ve&&Sr&&Sr[hs]!==void 0,Vr=(xs?Sr:ze)[hs],ps=Qr&&xs?k(Vr,t):Bt&&typeof Vr=="function"?k(Function.call,Vr):Vr,Sr&&j(Sr,hs,Vr,ae&O.U),Bi[hs]!=Vr&&w(Bi,hs,ps),Bt&&Mo[hs]!=Vr&&(Mo[hs]=Vr)};t.core=r,O.F=1,O.G=2,O.S=4,O.P=8,O.B=16,O.W=32,O.U=64,O.R=128;var L=O,T=Math.ceil,M=Math.floor,W=function(ae){return isNaN(ae=+ae)?0:(ae>0?M:T)(ae)},G=function(ae){if(ae==null)throw TypeError("Can't call method on "+ae);return ae},J=function(ae){return function(ye,ze){var Ve=String(G(ye)),it=W(ze),Ct=Ve.length,Bt,Qr;return it<0||it>=Ct?ae?"":void 0:(Bt=Ve.charCodeAt(it),Bt<55296||Bt>56319||it+1===Ct||(Qr=Ve.charCodeAt(it+1))<56320||Qr>57343?ae?Ve.charAt(it):Bt:ae?Ve.slice(it,it+2):(Bt-55296<<10)+(Qr-56320)+65536)}},te=J(!1);L(L.P,"String",{codePointAt:function(ye){return te(this,ye)}});var ie=r.String.codePointAt,ge=Math.max,he=Math.min,Fe=function(ae,ye){return ae=W(ae),ae<0?ge(ae+ye,0):he(ae,ye)},ke=String.fromCharCode,$e=String.fromCodePoint;L(L.S+L.F*(!!$e&&$e.length!=1),"String",{fromCodePoint:function(ye){for(var ze=arguments,Ve=[],it=arguments.length,Ct=0,Bt;it>Ct;){if(Bt=+ze[Ct++],Fe(Bt,1114111)!==Bt)throw RangeError(Bt+" is not a valid code point");Ve.push(Bt<65536?ke(Bt):ke(((Bt-=65536)>>10)+55296,Bt%1024+56320))}return Ve.join("")}});var oe=r.String.fromCodePoint,me=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Be=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Ue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,We={Space_Separator:me,ID_Start:Be,ID_Continue:Ue},He={isSpaceSeparator:function(ye){return typeof ye=="string"&&We.Space_Separator.test(ye)},isIdStartChar:function(ye){return typeof ye=="string"&&(ye>="a"&&ye<="z"||ye>="A"&&ye<="Z"||ye==="$"||ye==="_"||We.ID_Start.test(ye))},isIdContinueChar:function(ye){return typeof ye=="string"&&(ye>="a"&&ye<="z"||ye>="A"&&ye<="Z"||ye>="0"&&ye<="9"||ye==="$"||ye==="_"||ye==="\u200C"||ye==="\u200D"||We.ID_Continue.test(ye))},isDigit:function(ye){return typeof ye=="string"&&/[0-9]/.test(ye)},isHexDigit:function(ye){return typeof ye=="string"&&/[0-9A-Fa-f]/.test(ye)}},St,st,wt,Mn,Rr,Tr,yt,Zr,$s,to=function(ye,ze){St=String(ye),st="start",wt=[],Mn=0,Rr=1,Tr=0,yt=void 0,Zr=void 0,$s=void 0;do yt=pl(),Gh[st]();while(yt.type!=="eof");return typeof ze=="function"?Ot({"":$s},"",ze):$s};function Ot(ae,ye,ze){var Ve=ae[ye];if(Ve!=null&&typeof Ve=="object")if(Array.isArray(Ve))for(var it=0;it<Ve.length;it++){var Ct=String(it),Bt=Ot(Ve,Ct,ze);Bt===void 0?delete Ve[Ct]:Object.defineProperty(Ve,Ct,{value:Bt,writable:!0,enumerable:!0,configurable:!0})}else for(var Qr in Ve){var Sr=Ot(Ve,Qr,ze);Sr===void 0?delete Ve[Qr]:Object.defineProperty(Ve,Qr,{value:Sr,writable:!0,enumerable:!0,configurable:!0})}return ze.call(ae,ye,Ve)}var rt,Ne,Ar,ls,_t;function pl(){for(rt="default",Ne="",Ar=!1,ls=1;;){_t=ds();var ae=Wu[rt]();if(ae)return ae}}function ds(){if(St[Mn])return String.fromCodePoint(St.codePointAt(Mn))}function _e(){var ae=ds();return ae===`
|
||
`?(Rr++,Tr=0):ae?Tr+=ae.length:Tr++,ae&&(Mn+=ae.length),ae}var Wu={default:function(){switch(_t){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
|
||
`:case"\r":case"\u2028":case"\u2029":_e();return;case"/":_e(),rt="comment";return;case void 0:return _e(),Qt("eof")}if(He.isSpaceSeparator(_t)){_e();return}return Wu[st]()},comment:function(){switch(_t){case"*":_e(),rt="multiLineComment";return;case"/":_e(),rt="singleLineComment";return}throw sr(_e())},multiLineComment:function(){switch(_t){case"*":_e(),rt="multiLineCommentAsterisk";return;case void 0:throw sr(_e())}_e()},multiLineCommentAsterisk:function(){switch(_t){case"*":_e();return;case"/":_e(),rt="default";return;case void 0:throw sr(_e())}_e(),rt="multiLineComment"},singleLineComment:function(){switch(_t){case`
|
||
`:case"\r":case"\u2028":case"\u2029":_e(),rt="default";return;case void 0:return _e(),Qt("eof")}_e()},value:function(){switch(_t){case"{":case"[":return Qt("punctuator",_e());case"n":return _e(),qn("ull"),Qt("null",null);case"t":return _e(),qn("rue"),Qt("boolean",!0);case"f":return _e(),qn("alse"),Qt("boolean",!1);case"-":case"+":_e()==="-"&&(ls=-1),rt="sign";return;case".":Ne=_e(),rt="decimalPointLeading";return;case"0":Ne=_e(),rt="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Ne=_e(),rt="decimalInteger";return;case"I":return _e(),qn("nfinity"),Qt("numeric",1/0);case"N":return _e(),qn("aN"),Qt("numeric",NaN);case'"':case"'":Ar=_e()==='"',Ne="",rt="string";return}throw sr(_e())},identifierNameStartEscape:function(){if(_t!=="u")throw sr(_e());_e();var ye=Xu();switch(ye){case"$":case"_":break;default:if(!He.isIdStartChar(ye))throw Nf();break}Ne+=ye,rt="identifierName"},identifierName:function(){switch(_t){case"$":case"_":case"\u200C":case"\u200D":Ne+=_e();return;case"\\":_e(),rt="identifierNameEscape";return}if(He.isIdContinueChar(_t)){Ne+=_e();return}return Qt("identifier",Ne)},identifierNameEscape:function(){if(_t!=="u")throw sr(_e());_e();var ye=Xu();switch(ye){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!He.isIdContinueChar(ye))throw Nf();break}Ne+=ye,rt="identifierName"},sign:function(){switch(_t){case".":Ne=_e(),rt="decimalPointLeading";return;case"0":Ne=_e(),rt="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Ne=_e(),rt="decimalInteger";return;case"I":return _e(),qn("nfinity"),Qt("numeric",ls*(1/0));case"N":return _e(),qn("aN"),Qt("numeric",NaN)}throw sr(_e())},zero:function(){switch(_t){case".":Ne+=_e(),rt="decimalPoint";return;case"e":case"E":Ne+=_e(),rt="decimalExponent";return;case"x":case"X":Ne+=_e(),rt="hexadecimal";return}return Qt("numeric",ls*0)},decimalInteger:function(){switch(_t){case".":Ne+=_e(),rt="decimalPoint";return;case"e":case"E":Ne+=_e(),rt="decimalExponent";return}if(He.isDigit(_t)){Ne+=_e();return}return Qt("numeric",ls*Number(Ne))},decimalPointLeading:function(){if(He.isDigit(_t)){Ne+=_e(),rt="decimalFraction";return}throw sr(_e())},decimalPoint:function(){switch(_t){case"e":case"E":Ne+=_e(),rt="decimalExponent";return}if(He.isDigit(_t)){Ne+=_e(),rt="decimalFraction";return}return Qt("numeric",ls*Number(Ne))},decimalFraction:function(){switch(_t){case"e":case"E":Ne+=_e(),rt="decimalExponent";return}if(He.isDigit(_t)){Ne+=_e();return}return Qt("numeric",ls*Number(Ne))},decimalExponent:function(){switch(_t){case"+":case"-":Ne+=_e(),rt="decimalExponentSign";return}if(He.isDigit(_t)){Ne+=_e(),rt="decimalExponentInteger";return}throw sr(_e())},decimalExponentSign:function(){if(He.isDigit(_t)){Ne+=_e(),rt="decimalExponentInteger";return}throw sr(_e())},decimalExponentInteger:function(){if(He.isDigit(_t)){Ne+=_e();return}return Qt("numeric",ls*Number(Ne))},hexadecimal:function(){if(He.isHexDigit(_t)){Ne+=_e(),rt="hexadecimalInteger";return}throw sr(_e())},hexadecimalInteger:function(){if(He.isHexDigit(_t)){Ne+=_e();return}return Qt("numeric",ls*Number(Ne))},string:function(){switch(_t){case"\\":_e(),Ne+=Uo();return;case'"':if(Ar)return _e(),Qt("string",Ne);Ne+=_e();return;case"'":if(!Ar)return _e(),Qt("string",Ne);Ne+=_e();return;case`
|
||
`:case"\r":throw sr(_e());case"\u2028":case"\u2029":zh(_t);break;case void 0:throw sr(_e())}Ne+=_e()},start:function(){switch(_t){case"{":case"[":return Qt("punctuator",_e())}rt="value"},beforePropertyName:function(){switch(_t){case"$":case"_":Ne=_e(),rt="identifierName";return;case"\\":_e(),rt="identifierNameStartEscape";return;case"}":return Qt("punctuator",_e());case'"':case"'":Ar=_e()==='"',rt="string";return}if(He.isIdStartChar(_t)){Ne+=_e(),rt="identifierName";return}throw sr(_e())},afterPropertyName:function(){if(_t===":")return Qt("punctuator",_e());throw sr(_e())},beforePropertyValue:function(){rt="value"},afterPropertyValue:function(){switch(_t){case",":case"}":return Qt("punctuator",_e())}throw sr(_e())},beforeArrayValue:function(){if(_t==="]")return Qt("punctuator",_e());rt="value"},afterArrayValue:function(){switch(_t){case",":case"]":return Qt("punctuator",_e())}throw sr(_e())},end:function(){throw sr(_e())}};function Qt(ae,ye){return{type:ae,value:ye,line:Rr,column:Tr}}function qn(ae){for(var ye=0,ze=ae;ye<ze.length;ye+=1){var Ve=ze[ye],it=ds();if(it!==Ve)throw sr(_e());_e()}}function Uo(){var ae=ds();switch(ae){case"b":return _e(),"\b";case"f":return _e(),"\f";case"n":return _e(),`
|
||
`;case"r":return _e(),"\r";case"t":return _e()," ";case"v":return _e(),"\v";case"0":if(_e(),He.isDigit(ds()))throw sr(_e());return"\0";case"x":return _e(),Of();case"u":return _e(),Xu();case`
|
||
`:case"\u2028":case"\u2029":return _e(),"";case"\r":return _e(),ds()===`
|
||
`&&_e(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw sr(_e());case void 0:throw sr(_e())}return _e()}function Of(){var ae="",ye=ds();if(!He.isHexDigit(ye)||(ae+=_e(),ye=ds(),!He.isHexDigit(ye)))throw sr(_e());return ae+=_e(),String.fromCodePoint(parseInt(ae,16))}function Xu(){for(var ae="",ye=4;ye-- >0;){var ze=ds();if(!He.isHexDigit(ze))throw sr(_e());ae+=_e()}return String.fromCodePoint(parseInt(ae,16))}var Gh={start:function(){if(yt.type==="eof")throw Fi();Ju()},beforePropertyName:function(){switch(yt.type){case"identifier":case"string":Zr=yt.value,st="afterPropertyName";return;case"punctuator":Ho();return;case"eof":throw Fi()}},afterPropertyName:function(){if(yt.type==="eof")throw Fi();st="beforePropertyValue"},beforePropertyValue:function(){if(yt.type==="eof")throw Fi();Ju()},beforeArrayValue:function(){if(yt.type==="eof")throw Fi();if(yt.type==="punctuator"&&yt.value==="]"){Ho();return}Ju()},afterPropertyValue:function(){if(yt.type==="eof")throw Fi();switch(yt.value){case",":st="beforePropertyName";return;case"}":Ho()}},afterArrayValue:function(){if(yt.type==="eof")throw Fi();switch(yt.value){case",":st="beforeArrayValue";return;case"]":Ho()}},end:function(){}};function Ju(){var ae;switch(yt.type){case"punctuator":switch(yt.value){case"{":ae={};break;case"[":ae=[];break}break;case"null":case"boolean":case"numeric":case"string":ae=yt.value;break}if($s===void 0)$s=ae;else{var ye=wt[wt.length-1];Array.isArray(ye)?ye.push(ae):Object.defineProperty(ye,Zr,{value:ae,writable:!0,enumerable:!0,configurable:!0})}if(ae!==null&&typeof ae=="object")wt.push(ae),Array.isArray(ae)?st="beforeArrayValue":st="beforePropertyName";else{var ze=wt[wt.length-1];ze==null?st="end":Array.isArray(ze)?st="afterArrayValue":st="afterPropertyValue"}}function Ho(){wt.pop();var ae=wt[wt.length-1];ae==null?st="end":Array.isArray(ae)?st="afterArrayValue":st="afterPropertyValue"}function sr(ae){return Zu(ae===void 0?"JSON5: invalid end of input at "+Rr+":"+Tr:"JSON5: invalid character '"+ml(ae)+"' at "+Rr+":"+Tr)}function Fi(){return Zu("JSON5: invalid end of input at "+Rr+":"+Tr)}function Nf(){return Tr-=5,Zu("JSON5: invalid identifier character at "+Rr+":"+Tr)}function zh(ae){console.warn("JSON5: '"+ml(ae)+"' in strings is not valid ECMAScript; consider escaping")}function ml(ae){var ye={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(ye[ae])return ye[ae];if(ae<" "){var ze=ae.charCodeAt(0).toString(16);return"\\x"+("00"+ze).substring(ze.length)}return ae}function Zu(ae){var ye=new SyntaxError(ae);return ye.lineNumber=Rr,ye.columnNumber=Tr,ye}var Yh=function(ye,ze,Ve){var it=[],Ct="",Bt,Qr,Sr="",Bi;if(ze!=null&&typeof ze=="object"&&!Array.isArray(ze)&&(Ve=ze.space,Bi=ze.quote,ze=ze.replacer),typeof ze=="function")Qr=ze;else if(Array.isArray(ze)){Bt=[];for(var Mo=0,hs=ze;Mo<hs.length;Mo+=1){var xs=hs[Mo],Vr=void 0;typeof xs=="string"?Vr=xs:(typeof xs=="number"||xs instanceof String||xs instanceof Number)&&(Vr=String(xs)),Vr!==void 0&&Bt.indexOf(Vr)<0&&Bt.push(Vr)}}return Ve instanceof Number?Ve=Number(Ve):Ve instanceof String&&(Ve=String(Ve)),typeof Ve=="number"?Ve>0&&(Ve=Math.min(10,Math.floor(Ve)),Sr=" ".substr(0,Ve)):typeof Ve=="string"&&(Sr=Ve.substr(0,10)),ps("",{"":ye});function ps(er,Gr){var ht=Gr[er];switch(ht!=null&&(typeof ht.toJSON5=="function"?ht=ht.toJSON5(er):typeof ht.toJSON=="function"&&(ht=ht.toJSON(er))),Qr&&(ht=Qr.call(Gr,er,ht)),ht instanceof Number?ht=Number(ht):ht instanceof String?ht=String(ht):ht instanceof Boolean&&(ht=ht.valueOf()),ht){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof ht=="string")return Qu(ht,!1);if(typeof ht=="number")return String(ht);if(typeof ht=="object")return Array.isArray(ht)?jn(ht):ec(ht)}function Qu(er){for(var Gr={"'":.1,'"':.2},ht={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},_r="",Kn=0;Kn<er.length;Kn++){var yr=er[Kn];switch(yr){case"'":case'"':Gr[yr]++,_r+=yr;continue;case"\0":if(He.isDigit(er[Kn+1])){_r+="\\x00";continue}}if(ht[yr]){_r+=ht[yr];continue}if(yr<" "){var Rs=yr.charCodeAt(0).toString(16);_r+="\\x"+("00"+Rs).substring(Rs.length);continue}_r+=yr}var ni=Bi||Object.keys(Gr).reduce(function(Ii,ro){return Gr[Ii]<Gr[ro]?Ii:ro});return _r=_r.replace(new RegExp(ni,"g"),ht[ni]),ni+_r+ni}function ec(er){if(it.indexOf(er)>=0)throw TypeError("Converting circular structure to JSON5");it.push(er);var Gr=Ct;Ct=Ct+Sr;for(var ht=Bt||Object.keys(er),_r=[],Kn=0,yr=ht;Kn<yr.length;Kn+=1){var Rs=yr[Kn],ni=ps(Rs,er);if(ni!==void 0){var Ii=Xh(Rs)+":";Sr!==""&&(Ii+=" "),Ii+=ni,_r.push(Ii)}}var ro;if(_r.length===0)ro="{}";else{var qo;if(Sr==="")qo=_r.join(","),ro="{"+qo+"}";else{var Uf=`,
|
||
`+Ct;qo=_r.join(Uf),ro=`{
|
||
`+Ct+qo+`,
|
||
`+Gr+"}"}}return it.pop(),Ct=Gr,ro}function Xh(er){if(er.length===0)return Qu(er,!0);var Gr=String.fromCodePoint(er.codePointAt(0));if(!He.isIdStartChar(Gr))return Qu(er,!0);for(var ht=Gr.length;ht<er.length;ht++)if(!He.isIdContinueChar(String.fromCodePoint(er.codePointAt(ht))))return Qu(er,!0);return er}function jn(er){if(it.indexOf(er)>=0)throw TypeError("Converting circular structure to JSON5");it.push(er);var Gr=Ct;Ct=Ct+Sr;for(var ht=[],_r=0;_r<er.length;_r++){var Kn=ps(String(_r),er);ht.push(Kn!==void 0?Kn:"null")}var yr;if(ht.length===0)yr="[]";else if(Sr===""){var Rs=ht.join(",");yr="["+Rs+"]"}else{var ni=`,
|
||
`+Ct,Ii=ht.join(ni);yr=`[
|
||
`+Ct+Ii+`,
|
||
`+Gr+"]"}return it.pop(),Ct=Gr,yr}},Lf={parse:to,stringify:Yh},gl=Lf,Wh=gl;return Wh}))});function w4(e){let[t,r,n]=/^(.*?)(?:#(.*?))?$/.exec(e);return{content:r,fragment:n!=null?decodeURIComponent(n):void 0}}function Loe(e){let t=e.indexOf(":");if(t!==-1)return[decodeURIComponent(e.slice(0,t)),decodeURIComponent(e.slice(t+1))].join(":");let r=decodeURIComponent(e);return r.includes(":")?r:mt.decode(r)}function y4(e){return e==null||!/^\d+$/.test(`${e}`)?!1:Number.isSafeInteger(parseInt(`${e}`,10))}function E4(e){let t=Ff(e,"ed");return y4(t)?{path:ti(e,"ed").path,ed:t}:{path:e,ed:""}}function b4(e){let t=`${e}`;if(!/^\d+$/.test(t))throw new Error(`bad WebSocket max early data size: ${e}`);let r=parseInt(t,10);if(!Number.isSafeInteger(r))throw new Error(`bad WebSocket max early data size: ${e}`);return r}function A4(e){if(Array.isArray(e))return e.flatMap(r=>A4(r)||[]);if(typeof e!="string")return e==null?void 0:[e];let t=e.split(",").map(r=>r.trim()).filter(Boolean);return t.length>0?t:void 0}function Uoe(e){if(e==null)return null;let t=`${e}`.trim();if(!t)return null;let[,r=t,n]=/^(.*?)(?:\/(\d+))?$/.exec(t)||[],s=`${r}`.trim().replace(/^\[/,"").replace(/\]$/,""),o=(i,a)=>{if(i==null||!/^\d+$/.test(i))return;let u=parseInt(i,10);if(!(u<0||u>a))return u};return Ur(s)?{family:"ipv4",address:s,cidr:o(n,32)}:lr(s)?{family:"ipv6",address:s,cidr:o(n,128)}:null}function Hoe(){return{name:"URI PROXY Parser",test:n=>/^(socks5\+tls|socks5|http|https):\/\//.test(n),parse:n=>{let[s,o,i,a,u,l,f,m,p]=n.match(/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?\/?(\?.*?)?(?:#(.*?))?$/);if(f)f=parseInt(f,10);else{if(i)f=443;else if(o==="http")f=80;else throw R.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);R.info(`port is not present in line: ${n}, set to ${f}`)}let d={name:p!=null?decodeURIComponent(p):`${o} ${l}:${f}`,type:o,tls:!!i,server:l,port:f,username:a!=null?decodeURIComponent(a):void 0,password:u!=null?decodeURIComponent(u):void 0};if(i&&m){let v=Ff(m,"fp")||Ff(m,"client-fingerprint");v&&(d["client-fingerprint"]=v)}return d}}}function Moe(){return{name:"URI SOCKS Parser",test:n=>/^socks:\/\//.test(n),parse:n=>{let[s,o,i,a,u,l,f]=n.match(/^(socks)?:\/\/(?:(.*)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(u)u=parseInt(u,10);else throw R.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);let m,p;if(i){let v=mt.decode(decodeURIComponent(i)).split(":");m=v[0],p=v[1]}return{name:f!=null?decodeURIComponent(f):`${o} ${a}:${u}`,type:"socks5",server:a,port:u,username:m,password:p}}}}function qoe(){return{name:"URI SS Parser",test:n=>/^ss:\/\//.test(n),parse:n=>{let{content:s,fragment:o}=w4(n.split("ss://")[1]),i={type:"ss"},a=s.match(/@([^/?]*)(\/|\?|$)/),u=Loe(s.split("@")[0]),l="";if(a)s.includes("?")&&(l=s.match(/(\?.*)$/)[1]);else{if(s.includes("?")){let w=s.match(/^(.*)(\?.*)$/);s=w[1],l=w[2]}if(s=mt.decode(s),l){if(/(&|\?)v2ray-plugin=/.test(l)){let E=l.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];E&&(i.plugin="v2ray-plugin",i["plugin-opts"]=JSON.parse(mt.decode(E)))}s=`${s}${l}`}u=s.match(/(^.*)@/)?.[1],a=s.match(/@([^/@]*)(\/|$)/)}let f={};for(let w of l.replace(/^\?/,"").split("&"))if(w){let[E,S]=w.split("="),C=S;C=decodeURIComponent(S),f[E]=C}if(i.tls=f.security&&f.security!=="none",i["skip-cert-verify"]=!!f.allowInsecure,i.sni=f.sni||f.peer,i["client-fingerprint"]=f.fp,i.alpn=f.alpn?decodeURIComponent(f.alpn).split(","):void 0,f.ws&&(i.network="ws",Pa.default.set(i,"ws-opts.path",f.wspath)),f.type){let w,E="",S="";if(i.network=f.type,i.network==="httpupgrade"&&(i.network="ws",w=!0),["grpc"].includes(i.network))i[i.network+"-opts"]={"grpc-service-name":f.serviceName,"_grpc-type":f.mode,"_grpc-authority":f.authority};else{if(f.path){let C=f.path;if(i.network==="ws"){let D=E4(C);C=D.path,w?E=D.ed:S=D.ed}Pa.default.set(i,i.network+"-opts.path",C)}f.host&&Pa.default.set(i,i.network+"-opts.headers.Host",decodeURIComponent(f.host)),w?(E=E||(y4(f.ed)?`${f.ed}`:""),Pa.default.set(i,i.network+"-opts.v2ray-http-upgrade",!0),E!==""&&(Pa.default.set(i,i.network+"-opts.v2ray-http-upgrade-fast-open",!0),Pa.default.set(i,i.network+"-opts._v2ray-http-upgrade-ed",E))):i.network==="ws"&&S!==""&&(Pa.default.set(i,i.network+"-opts.max-early-data",b4(S)),Pa.default.set(i,i.network+"-opts.early-data-header-name","Sec-WebSocket-Protocol"))}if(["reality"].includes(f.security)){let C={};f.pbk&&(C["public-key"]=f.pbk),f.sid&&(C["short-id"]=f.sid),f.spx&&(C["_spider-x"]=f.spx),f.mode&&(i._mode=f.mode),Object.keys(C).length>0&&Pa.default.set(i,f.security+"-opts",C)}f.extra&&(i.network==="xhttp"||f.security==="reality")&&(i._extra=f.extra)}i.udp=![!1,0,"0","false","off"].includes(typeof f.udp=="string"?f.udp.toLowerCase():f.udp);let m=a[1],p=m.lastIndexOf(":");i.server=m.substring(0,p),i.port=`${m.substring(p+1)}`.match(/\d+/)?.[0];let d=u.match(/(^.*?):(.*$)/);i.cipher=d?.[1],i.password=d?.[2];let v=s.match(/[?&]plugin=([^&]+)/),g=s.match(/[?&]shadow-tls=([^&]+)/),y=s.match(/[?&]gost=([^&]+)/);if(v){let w=("plugin="+decodeURIComponent(v[1])).split(";"),E={};for(let S of w){let C=S.indexOf("=");if(C===-1){S&&(E[S]=!0);continue}let D=S.slice(0,C),H=S.slice(C+1).replace(/\\=/g,"=");D&&(E[D]=H||!0)}switch(E.plugin){case"obfs-local":case"simple-obfs":i.plugin="obfs",i["plugin-opts"]={mode:E.obfs,host:Dt(E["obfs-host"])};break;case"v2ray-plugin":i.plugin="v2ray-plugin",i["plugin-opts"]={mode:Dt(E.obfs)||Dt(E.mode)||"websocket",host:Dt(E["obfs-host"])||Dt(E.host),path:Dt(E.path),tls:eu(E.tls),sni:eu(E.sni),"skip-cert-verify":["1","true",1,!0].includes(E["skip-cert-verify"]),mux:/^\d+$/.test(E.mux)?parseInt(E.mux,10):void 0};break;case"shadow-tls":{i.plugin="shadow-tls";let S=Dt(E.version);i["plugin-opts"]={host:Dt(E.host),password:Dt(E.password),version:S?parseInt(S,10):void 0};break}default:throw new Error(`Unsupported plugin option: ${E.plugin}`)}}if(g){let w=JSON.parse(mt.decode(g[1])),E=Dt(w.version),S=Dt(w.address),C=Dt(w.port);i.plugin="shadow-tls",i["plugin-opts"]={host:Dt(w.host),password:Dt(w.password),version:E?parseInt(E,10):void 0},S&&(i.server=S),C&&(i.port=parseInt(C,10))}if(y){let w=JSON.parse(mt.decode(decodeURIComponent(y[1]))),E=Dt(w.address),S=Dt(w.port),C=Dt(w.route),D=C?.trim().toLowerCase(),H=["ws","wss","websocket"].includes(D);i.plugin="gost-plugin",i["plugin-opts"]={mode:H?"websocket":C,host:Dt(w.host),path:Dt(w.path)},D==="wss"&&(i["plugin-opts"].tls=!0),E&&(i.server=E),S&&(i.port=parseInt(S,10))}return/(&|\?)uot=(1|true)/i.test(l)&&(i["udp-over-tcp"]=!0),/(&|\?)tfo=(1|true)/i.test(l)&&(i.tfo=!0),i.name=o??`SS ${i.server}:${i.port}`,i}}}function joe(){return{name:"URI SSR Parser",test:n=>/^ssr:\/\//.test(n),parse:n=>{n=mt.decode(n.split("ssr://")[1]);let s=n.indexOf(":origin");s===-1&&(s=n.indexOf(":auth_"));let o=n.substring(0,s),i=o.substring(0,o.lastIndexOf(":")),a=o.substring(o.lastIndexOf(":")+1),u=n.substring(s+1).split("/?")[0].split(":"),l={type:"ssr",server:i,port:a,protocol:u[0],cipher:u[1],obfs:u[2],password:mt.decode(u[3])},f={};if(n=n.split("/?")[1].split("&"),n.length>1)for(let m of n){let[p,d]=m.split("=");d=d.trim(),d.length>0&&d!=="(null)"&&(f[p]=d)}return l={...l,name:f.remarks?mt.decode(f.remarks):l.server,"protocol-param":Dt(mt.decode(f.protoparam||f.protocolparam||"").replace(/\s/g,"")),"obfs-param":Dt(mt.decode(f.obfsparam||"").replace(/\s/g,""))},l}}}function Koe(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{if(/^vmess:\/\/[^/?#]+@/.test(n))return S4().parse(n,"vmess");let{content:s,fragment:o}=w4(n.split("vmess://")[1]),i=mt.decode(s.replace(/\?.*?$/,""));if(/=\s*vmess/.test(i)){let a=i.split(",").map(f=>f.trim()),u={};for(let f of a)if(f.indexOf("=")!==-1){let[m,p]=f.split("=");u[m.trim()]=p.trim()}let l={name:a[0].split("=")[0].trim(),type:"vmess",server:a[1],port:a[2],cipher:cn(Dt(a[3],"auto")),uuid:a[4].match(/^"(.*)"$/)[1],tls:u.obfs==="wss",udp:eu(u["udp-relay"]),tfo:eu(u["fast-open"]),"skip-cert-verify":dd(u["tls-verification"])?!u["tls-verification"]:void 0};if(dd(u.obfs))if(u.obfs==="ws"||u.obfs==="wss"){l.network="ws",l["ws-opts"].path=(Dt(u["obfs-path"])||'"/"').match(/^"(.*)"$/)[1];let f=u["obfs-header"];f&&f.indexOf("Host")!==-1&&(f=f.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),Ge(f)&&(l["ws-opts"].headers={Host:f})}else throw new Error(`Unsupported obfs: ${u.obfs}`);return Ge(o)&&(l.name=o),l}else{let a={};try{a=JSON.parse(i)}catch{let[d,v,g]=/(^[^?]+?)\/?\?(.*)$/.exec(s);i=mt.decode(v);for(let D of g.split("&")){let[H,K]=D.split("="),_=K;_=decodeURIComponent(K),_.indexOf(",")===-1?a[H]=_:a[H]=_.split(",")}let[y,w,E,S,C]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(i);a.scy=w,a.id=E,a.port=C,a.add=S}let u=a.add,l=parseInt(eu(a.port),10),f={name:a.ps??a.remarks??a.remark??`VMess ${u}:${l}`,type:"vmess",server:u,port:l,cipher:cn(a.scy),uuid:a.id,alterId:parseInt(eu(a.aid??a.alterId,0),10),tls:["tls",!0,1,"1"].includes(a.tls),"skip-cert-verify":dd(a.verify_cert)?!a.verify_cert:void 0};!f["skip-cert-verify"]&&dd(a.allowInsecure)&&(f["skip-cert-verify"]=/(TRUE)|1/i.test(a.allowInsecure)),f.tls&&(a.sni&&a.sni!==""?f.sni=a.sni:a.peer&&a.peer!==""&&(f.sni=a.peer));let m=!1;if(a.net==="ws"||a.obfs==="websocket"?f.network="ws":["http"].includes(a.obfs)||["http"].includes(a.type)?f.network="http":a.net==="http"?f.network="h2":["grpc","kcp","quic"].includes(a.net)?f.network=a.net:a.net==="httpupgrade"||f.network==="httpupgrade"?(f.network="ws",m=!0):(a.net==="h2"||f.network==="h2")&&(f.network="h2"),f.network){let p=a.host??a.obfsParam;try{let w=JSON.parse(p)?.Host;w&&(p=w)}catch{}let d=a.path,v="",g="";if(f.network==="ws"&&d){let y=E4(d);d=y.path,m?v=y.ed:g=y.ed}if(["ws"].includes(f.network)&&(d=d||"/"),f.network==="http"?(p&&(p=p.split(",").map(y=>y.trim()),p=Array.isArray(p)?p[0]:p),d?d=Array.isArray(d)?d[0]:d:d="/"):f.network==="h2"&&(d||(d="/")),d||p||["kcp","quic"].includes(f.network))if(["grpc"].includes(f.network))f[`${f.network}-opts`]={"grpc-service-name":Dt(d),"_grpc-type":Dt(a.type),"_grpc-authority":Dt(a.authority)};else if(["kcp","quic"].includes(f.network))f[`${f.network}-opts`]={[`_${f.network}-type`]:Dt(a.type),[`_${f.network}-host`]:Dt(Dt(p)),[`_${f.network}-path`]:Dt(d)};else{let y={path:Dt(d)},w=Dt(p);if(f.network==="h2"){let E=A4(w);E&&(y.host=E)}else y.headers={Host:w};m?(y["v2ray-http-upgrade"]=!0,v=v||(y4(a.ed)?`${a.ed}`:""),v!==""&&(y["v2ray-http-upgrade-fast-open"]=!0,y["_v2ray-http-upgrade-ed"]=v)):f.network==="ws"&&g!==""&&(y["max-early-data"]=b4(g),y["early-data-header-name"]="Sec-WebSocket-Protocol"),f[`${f.network}-opts`]=y}else delete f.network}return f["client-fingerprint"]=a.fp??a["client-fingerprint"],f.alpn=a.alpn?a.alpn.split(","):void 0,Ge(o)&&(f.name=o),f}}}}function S4(){return{name:"URI VLESS Parser",test:n=>/^vless:\/\//.test(n),parse:(n,s="vless")=>{let o=T=>{if(!Ze(T))return;let M={},W={maxConnections:"max-connections",maxConcurrency:"max-concurrency",cMaxReuseTimes:"c-max-reuse-times",hMaxRequestTimes:"h-max-request-times",hMaxReusableSecs:"h-max-reusable-secs"};for(let[J,te]of Object.entries(W)){let ie=Ai(T[J]);ie!=null&&(M[te]=typeof ie=="number"?`${ie}`:ie)}let G=Fs(T.hKeepAlivePeriod);return G!=null&&(M["h-keep-alive-period"]=G),Object.keys(M).length>0?M:void 0},i=T=>{if(!Ze(T))return;let M={};for(let[W,G]of Object.entries(T))typeof G=="string"&&(M[W]=G);return Object.keys(M).length>0?M:void 0},a=T=>{if(Array.isArray(T))return T.map(a);if(Ze(T)){let M={};for(let[W,G]of Object.entries(T))M[W]=a(G);return M}return T},u=T=>{if(Array.isArray(T))return T.map(u).filter(W=>W!==void 0);if(!Ze(T))return T;let M={};for(let[W,G]of Object.entries(T)){let J=u(G);J!==void 0&&(M[W]=J)}return Object.keys(M).length>0?M:void 0},l=(T,M,W)=>{let G=u(a(W));G!==void 0&&(T[M]=G)},f=T=>{if(T==null)return;if(!Ze(T))return a(T);let M={};for(let[W,G]of Object.entries(T))typeof G!="string"&&l(M,W,G);return u(M)},m=(T,M)=>["maxConnections","maxConcurrency","cMaxReuseTimes","hMaxRequestTimes","hMaxReusableSecs"].includes(T)?Ai(M)!=null:T==="hKeepAlivePeriod"?Fs(M)!=null:!1,p=T=>{if(T==null)return;if(!Ze(T))return a(T);let M={};for(let[W,G]of Object.entries(T))m(W,G)||l(M,W,G);return u(M)},d=T=>{if(T==null)return;if(!Ze(T))return a(T);let M={};for(let[W,G]of Object.entries(T))switch(W){case"headers":{let J=f(G);J!==void 0&&(M.headers=J);break}case"noGRPCHeader":case"xPaddingObfsMode":G!==!0&&l(M,W,G);break;case"xPaddingBytes":Bh(G)==null&&l(M,W,G);break;case"xPaddingKey":case"xPaddingHeader":case"xPaddingPlacement":case"xPaddingMethod":case"uplinkHTTPMethod":case"sessionIDPlacement":case"sessionPlacement":case"sessionIDKey":case"sessionKey":case"seqPlacement":case"seqKey":case"uplinkDataPlacement":case"uplinkDataKey":typeof G!="string"&&l(M,W,G);break;case"sessionIDTable":typeof G!="string"&&l(M,W,G);break;case"uplinkChunkSize":Ai(G)==null&&l(M,W,G);break;case"scMaxEachPostBytes":Bh(G)==null&&l(M,W,G);break;case"scMinPostsIntervalMs":Ta(G)==null&&l(M,W,G);break;case"sessionIDLength":Bh(G)==null&&l(M,W,G);break;case"xmux":{let J=p(G);J!==void 0&&(M.xmux=J);break}default:l(M,W,G);break}return u(M)},v=T=>{if(T==null)return;if(!Ze(T))return a(T);let M={};Object.prototype.hasOwnProperty.call(T,"path")&&!Ge(T.path)&&l(M,"path",T.path),Object.prototype.hasOwnProperty.call(T,"host")&&!Ge(T.host)&&l(M,"host",T.host),Object.prototype.hasOwnProperty.call(T,"mode")&&!Ge(T.mode)&&l(M,"mode",T.mode);let W={};for(let[J,te]of Object.entries(T))["path","host","mode","extra"].includes(J)||(W[J]=te);let G=d(W);if(Ze(G)&&Object.assign(M,G),Object.prototype.hasOwnProperty.call(T,"extra")){let J=d(T.extra);J!==void 0&&(M.extra=J)}return u(M)},g=T=>{if(T==null)return;if(!Ze(T))return a(T);let M={};for(let[W,G]of Object.entries(T))switch(W){case"address":Ge(G)||l(M,W,G);break;case"port":Fs(G,{allowNegative:!1})==null&&l(M,W,G);break;case"security":{let J=typeof G=="string"?G.toLowerCase():"";["tls","reality"].includes(J)||l(M,W,G);break}case"tlsSettings":{if(!Ze(G)){l(M,W,G);break}let J={},te=lC(G.echConfigList);for(let[ge,he]of Object.entries(G))switch(ge){case"serverName":case"fingerprint":Ge(he)||l(J,ge,he);break;case"echConfigList":lC(he)||l(J,ge,he);break;case"echForceQuery":(!te||!Aw(he))&&l(J,ge,he);break;case"echSockopt":(!te||!Ze(he))&&l(J,ge,he);break;case"alpn":Array.isArray(he)&&he.length>0&&he.every(Fe=>typeof Fe=="string"&&Fe!=="")||l(J,ge,he);break;case"allowInsecure":he!==!0&&l(J,ge,he);break;default:l(J,ge,he);break}let ie=u(J);ie!==void 0&&(M.tlsSettings=ie);break}case"realitySettings":{if(!Ze(G)){l(M,W,G);break}let J={};for(let[ie,ge]of Object.entries(G))switch(ie){case"publicKey":case"shortId":case"serverName":case"fingerprint":Ge(ge)||l(J,ie,ge);break;default:l(J,ie,ge);break}let te=u(J);te!==void 0&&(M.realitySettings=te);break}case"xhttpSettings":{let J=v(G);J!==void 0&&(M.xhttpSettings=J);break}case"network":{let J=typeof G=="string"?G.toLowerCase():"";J!=="xhttp"&&J!=="splithttp"&&l(M,W,G);break}default:l(M,W,G);break}return u(M)},y=(T,{parsedDownloadSettings:M}={})=>{if(!Ze(T))return;let{downloadSettings:W,...G}=T,J=d(G)||{};if(Object.prototype.hasOwnProperty.call(T,"downloadSettings")){let te=g(W);te!==void 0&&(J.downloadSettings=te)}return u(J)},w=(T,M)=>{if(!Ze(T)||!Ze(M))return;let W=i(M.headers);if(W){let Fe={...T.headers||{}};for(let[ke,$e]of Object.entries(W)){if(/^host$/i.test(ke)){!Object.prototype.hasOwnProperty.call(Fe,"Host")&&!Object.prototype.hasOwnProperty.call(Fe,"host")&&(Fe.Host=$e);continue}Fe[ke]=$e}Object.keys(Fe).length>0&&(T.headers=Fe)}M.noGRPCHeader===!0&&(T["no-grpc-header"]=!0);let G=Bh(M.xPaddingBytes);G!=null&&(T["x-padding-bytes"]=G),M.xPaddingObfsMode===!0&&(T["x-padding-obfs-mode"]=!0),Ge(M.xPaddingKey)&&(T["x-padding-key"]=M.xPaddingKey),Ge(M.xPaddingHeader)&&(T["x-padding-header"]=M.xPaddingHeader),Ge(M.xPaddingPlacement)&&(T["x-padding-placement"]=M.xPaddingPlacement),Ge(M.xPaddingMethod)&&(T["x-padding-method"]=M.xPaddingMethod),Ge(M.uplinkHTTPMethod)&&(T["uplink-http-method"]=M.uplinkHTTPMethod),Ge(M.sessionIDPlacement)?T["session-placement"]=M.sessionIDPlacement:Ge(M.sessionPlacement)&&(T["session-placement"]=M.sessionPlacement),Ge(M.sessionIDKey)?T["session-key"]=M.sessionIDKey:Ge(M.sessionKey)&&(T["session-key"]=M.sessionKey),typeof M.sessionIDTable=="string"&&(T["session-table"]=M.sessionIDTable);let J=Bh(M.sessionIDLength);J!=null&&(T["session-length"]=J),Ge(M.seqPlacement)&&(T["seq-placement"]=M.seqPlacement),Ge(M.seqKey)&&(T["seq-key"]=M.seqKey),Ge(M.uplinkDataPlacement)&&(T["uplink-data-placement"]=M.uplinkDataPlacement),Ge(M.uplinkDataKey)&&(T["uplink-data-key"]=M.uplinkDataKey);let te=Ai(M.uplinkChunkSize);te!=null&&(T["uplink-chunk-size"]=te);let ie=Cf(M.scMaxEachPostBytes);ie!=null&&(T["sc-max-each-post-bytes"]=ie);let ge=Ta(M.scMinPostsIntervalMs);ge!=null&&(T["sc-min-posts-interval-ms"]=ge);let he=o(M.xmux);he&&(T["reuse-settings"]=he)},E=T=>{if(!Ze(T))return;let M={},W=typeof T.network=="string"?T.network.toLowerCase():"";(W==="xhttp"||W==="splithttp")&&(M.network="xhttp"),Ge(T.address)&&(M.server=T.address);let G=Fs(T.port,{allowNegative:!1});G!=null&&(M.port=G);let J=typeof T.security=="string"?T.security.toLowerCase():"";if((J==="tls"||J==="reality")&&(M.tls=!0),Ze(T.tlsSettings)){Ge(T.tlsSettings.serverName)&&(M.servername=T.tlsSettings.serverName),Ge(T.tlsSettings.fingerprint)&&(M["client-fingerprint"]=T.tlsSettings.fingerprint),Array.isArray(T.tlsSettings.alpn)&&T.tlsSettings.alpn.length>0&&T.tlsSettings.alpn.every(ge=>typeof ge=="string"&&ge!=="")&&(M.alpn=T.tlsSettings.alpn),T.tlsSettings.allowInsecure===!0&&(M["skip-cert-verify"]=!0);let ie=Sw({echConfigList:T.tlsSettings.echConfigList,echForceQuery:T.tlsSettings.echForceQuery,echSockopt:T.tlsSettings.echSockopt});ie&&(M["ech-opts"]=ie)}let te;return Ze(T.realitySettings)&&(te={},Ge(T.realitySettings.publicKey)&&(te["public-key"]=T.realitySettings.publicKey),Ge(T.realitySettings.shortId)&&(te["short-id"]=T.realitySettings.shortId),Ge(T.realitySettings.serverName)&&(M.servername=T.realitySettings.serverName),Ge(T.realitySettings.fingerprint)&&(M["client-fingerprint"]=T.realitySettings.fingerprint)),J==="reality"?M["reality-opts"]=te||{}:te&&Object.keys(te).length>0&&(M["reality-opts"]=te),Ze(T.xhttpSettings)&&(Ge(T.xhttpSettings.path)&&(M.path=T.xhttpSettings.path),Ge(T.xhttpSettings.host)&&(M.host=T.xhttpSettings.host),Ge(T.xhttpSettings.mode)&&(M.mode=T.xhttpSettings.mode),w(M,T.xhttpSettings),Ze(T.xhttpSettings.extra)&&w(M,T.xhttpSettings.extra)),Object.keys(M).length>0?M:void 0};n=n.split(`${s}://`)[1];let S,C=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);if(!C){let[T,M,W]=/^(.*?)(\?.*?$)/.exec(n);n=`${mt.decode(M)}${W}`,C=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),S=!0}let[D,H,K,_,x,j="",U]=C;S&&(H=H.replace(/^.*?:/g,"")),_=parseInt(`${_}`,10),H=decodeURIComponent(H),U!=null&&(U=decodeURIComponent(U));let k={type:s,name:U,server:K,port:_,uuid:H,udp:!0},N={};for(let T of j.split("&"))if(T){let[M,...W]=T.split("=");N[M]=decodeURIComponent(W.join("="))}if(k.name=U??N.remarks??N.remark??`${s==="vmess"?"VMess":"VLESS"} ${K}:${_}`,k.tls=N.security&&N.security!=="none",N.pbk&&(N.security="reality"),S&&/TRUE|1/i.test(N.tls)&&(k.tls=!0,N.security=N.security??"reality"),k.sni=N.sni||N.peer,k.flow=N.flow,!k.flow&&S&&N.xtls){let T=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][N.xtls];T&&(k.flow=T)}k["client-fingerprint"]=N.fp??N["client-fingerprint"],k.alpn=N.alpn?N.alpn.split(","):void 0,k["skip-cert-verify"]=/(TRUE)|1/i.test(N.allowInsecure)||s==="vless"&&N.allowInsecure==null&&N.insecure==="1",k._echConfigList=eu(N.ech);let O=Sw({echConfigList:N.ech});switch(O&&(k["ech-opts"]=O),k["tls-fingerprint"]=eu(N.pcs),k._vcn=N.vcn?.split(",").map(T=>T.trim()).filter(Boolean),k["name-cert-verify"]=k._vcn?.[0],k._h2=/(TRUE)|1/i.test(N.h2),`${N.packetEncoding||""}`.trim().toLowerCase()){case"none":k["packet-encoding"]="";break;case"packet":k["packet-encoding"]="packetaddr";break;default:k["packet-encoding"]="xudp";break}if(["reality"].includes(N.security)){let T={};if(N.pbk){T["public-key"]=N.pbk;let M=N["support-x25519mlkem768"];["1","t","T","true","TRUE","True"].includes(M)&&(T["support-x25519mlkem768"]=!0)}N.sid&&(T["short-id"]=N.sid),N.spx&&(T["_spider-x"]=N.spx),Object.keys(T).length>0&&(k[`${N.security}-opts`]=T)}let L=!1;if(k.network=N.type||"tcp",k.network==="tcp"&&N.headerType==="http"?k.network="http":k.network==="http"?k.network="h2":k.network==="httpupgrade"&&(k.network="ws",L=!0),!N.type&&S&&N.obfs&&(k.network=N.obfs,["none"].includes(k.network)&&(k.network="tcp")),["websocket"].includes(k.network)?k.network="ws":s==="vless"&&k.network==="splithttp"&&(k.network="xhttp"),k.network&&!["tcp","none"].includes(k.network)){let T={},M="",W=N.host??N.obfsParam;if(W){if(N.obfsParam)try{let te=JSON.parse(W);T.headers=te}catch{T.headers={Host:W}}else T.headers={Host:W};["xhttp"].includes(k.network)&&T.headers?.Host&&(T.host=T.headers.Host,delete T.headers.Host,Object.keys(T.headers).length===0&&delete T.headers);let J=T.headers?.Host??T.headers?.host;["h2"].includes(k.network)&&J&&(T.host=A4(J),delete T.headers.Host,delete T.headers.host,Object.keys(T.headers).length===0&&delete T.headers)}if(N.serviceName?T[`${k.network}-service-name`]=N.serviceName:S&&N.path&&(["ws","http","h2","xhttp"].includes(k.network)||(T[`${k.network}-service-name`]=N.path,delete N.path)),N.path){let J=N.path;if(k.network==="ws"){let te=E4(J);J=te.path,M=te.ed}T.path=J}else k.network==="h2"&&(T.path="/");k.network==="http"&&N.method&&(T.method=N.method),["grpc"].includes(k.network)&&(T["_grpc-type"]=N.mode||"gun",N.authority&&(T["_grpc-authority"]=N.authority)),L&&(T["v2ray-http-upgrade"]=!0);let G=M||N.ed;if(G){let J=b4(G);L?(T["v2ray-http-upgrade-fast-open"]=!0,T["_v2ray-http-upgrade-ed"]=`${G}`):k.network==="ws"&&(T["max-early-data"]=J,T["early-data-header-name"]=N.eh||"Sec-WebSocket-Protocol")}if(N.eh&&(k.network==="ws"||L)&&(T["early-data-header-name"]=N.eh),Object.keys(T).length>0&&(k[`${k.network}-opts`]=T),k.network==="kcp"&&(N.seed&&(k.seed=N.seed),k.headerType=N.headerType||"none"),N.extra&&!["xhttp"].includes(k.network)&&(k._extra=N.extra),["xhttp"].includes(k.network)){let J={},te;try{J=N.extra?JSON.parse(N.extra):{}}catch{R.error(`Failed to parse extra field as JSON: ${N.extra}`),te=N.extra}let ie={...k[`${k.network}-opts`]||{}};N.mode&&(ie.mode=N.mode),w(ie,J);let ge=E(J?.downloadSettings);ge&&(ie["download-settings"]=ge),Object.keys(ie).length>0&&(k[`${k.network}-opts`]=ie),te!=null&&(k._extra=te);let he=y(J,{parsedDownloadSettings:ge});he&&(k._extra_unsupported=he)}else N.mode&&(k._mode=N.mode)}if(s==="vmess"?(k.cipher=cn(N.encryption),k.alterId=0,delete k.flow):N.encryption&&(k.encryption=N.encryption),N.pqv&&(k._pqv=N.pqv),N.fm)try{let T=JSON.parse(N.fm);k._finalmask=Ze(T)?T:N.fm}catch{k._finalmask=N.fm}return k}}}function Voe(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{let s=S4().parse(n.replace("anytls","vless"));n=n.split(/anytls:\/\//)[1];let[o,i,a,u,l="",f]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);u=parseInt(`${u}`,10),isNaN(u)&&(u=443),i=decodeURIComponent(i),f!=null&&(f=decodeURIComponent(f)),f=f??`AnyTLS ${a}:${u}`;let m={...s,uuid:void 0,type:"anytls",name:f,server:a,port:u,password:i};for(let p of l.split("&"))if(p){let[d,v]=p.split("=");d=d.replace(/_/g,"-"),v=decodeURIComponent(v),["alpn"].includes(d)?m[d]=v?v.split(","):void 0:["insecure"].includes(d)?m["skip-cert-verify"]=/(TRUE)|1/i.test(v):["udp"].includes(d)?m[d]=/(TRUE)|1/i.test(v):Object.keys(m).includes(d)||(m[d]=v)}return["tcp"].includes(m.network)&&!m["reality-opts"]&&(delete m.network,delete m.security),m}}}function Goe(){return{name:"URI Mieru Parser",test:n=>/^mierus:\/\//i.test(n),parse:n=>{let{content:s,fragment:o}=w4(n),i=/^mierus:\/\/([^:@/?]+):([^@/?]+)@(\[[^\]]+\]|[^:/?@\s]+)\/?\?(.+)$/i.exec(s);if(!i)throw new Error("Invalid Mieru URI");let[,a,u,l,f]=i,m=new Map;for(let y of f.split("&")){let{key:w,value:E}=Fw(y);m.has(w)||m.set(w,[]),m.get(w).push(E)}let p=m.get("port")||[],d=m.get("protocol")??m.get("transport")??[];if(p.length===0||p.length!==d.length)throw new Error("Mieru URI requires matching ports and protocols");let v=o||m.get("profile")?.[0]||l,g={type:"mieru",server:l,username:decodeURIComponent(a),password:decodeURIComponent(u)};for(let y of["multiplexing","handshake-mode","traffic-pattern"]){let w=m.get(y)?.[0];w&&(g[y]=w)}return p.map((y,w)=>{let E=d[w].toUpperCase(),[,S,C=S]=/^(\d+)(?:-(\d+))?$/.exec(y)||[],D=Number(S),H=Number(C);if(!(1<=D&&D<=H&&H<=65535)||E!=="TCP"&&E!=="UDP")throw new Error("Invalid Mieru port binding");let K={...g,name:p.length===1?v:`${v}:${y}/${E}`,transport:E};return y.includes("-")?K["port-range"]=y:K.port=D,K})}}}function zoe(){return{name:"URI Hysteria2 Parser",test:n=>/^(hysteria2|hy2):\/\//.test(n),parse:n=>{n=n.split(/(hysteria2|hy2):\/\//)[2];let s,[o,i,a,u,l,f,m,p,d,v,g="",y]=/^(.*?)@(.*?)(:((\d+(-\d+)?)([,;]\d+(-\d+)?)*))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);/^\d+$/.test(l)?(l=parseInt(`${l}`,10),isNaN(l)&&(l=443)):l?(s=l,l=Mp(s)):l=443,i=decodeURIComponent(i),y!=null&&(y=decodeURIComponent(y)),y=y??`Hysteria2 ${a}:${l}`;let w={type:"hysteria2",name:y,server:a,port:l,ports:s,password:i},E={};for(let H of g.split("&"))if(H){let[K,_]=H.split("="),x=_;x=decodeURIComponent(_),E[K]=x}w.sni=E.sni,!w.sni&&E.peer&&(w.sni=E.peer),E.obfs&&E.obfs!=="none"&&(w.obfs=E.obfs),E.mport&&(w.ports=E.mport),w["obfs-password"]=E["obfs-password"],w["skip-cert-verify"]=/(TRUE)|1/i.test(E.insecure),w.tfo=/(TRUE)|1/i.test(E.fastopen),w["tls-fingerprint"]=E.pinSHA256;let S=E["hop-interval"]||E.hop_interval;S!=null&&(w["hop-interval"]=S);let C=E.keepalive;/^\d+$/.test(C)&&(w.keepalive=parseInt(`${C}`,10)),E.upmbps&&(w.up=E.upmbps),E.downmbps&&(w.down=E.downmbps);let D=Sw({echConfigList:E.ech});return D&&(w["ech-opts"]=D),w}}}function Yoe(){return{name:"URI Hysteria Parser",test:n=>/^(hysteria|hy):\/\//.test(n),parse:n=>{n=n.split(/(hysteria|hy):\/\//)[2];let[s,o,i,a,u,l="",f]=/^(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);a=parseInt(`${a}`,10),isNaN(a)&&(a=443),f!=null&&(f=decodeURIComponent(f)),f=f??`Hysteria ${o}:${a}`;let m={type:"hysteria",name:f,server:o,port:a},p={};for(let d of l.split("&"))if(d){let[v,g]=d.split("=");v=v.replace(/_/,"-"),g=decodeURIComponent(g),["alpn"].includes(v)?m[v]=g?g.split(","):void 0:["insecure"].includes(v)?m["skip-cert-verify"]=/(TRUE)|1/i.test(g):["auth"].includes(v)?m["auth-str"]=g:["mport"].includes(v)?m.ports=g:["obfsParam"].includes(v)?m.obfs=g:["upmbps"].includes(v)?m.up=g:["downmbps"].includes(v)?m.down=g:["obfs"].includes(v)?m._obfs=g||"":["fast-open","peer"].includes(v)?p[v]=g:Object.keys(m).includes(v)||(m[v]=g)}return!m.sni&&p.peer&&(m.sni=p.peer),!m["fast-open"]&&p.fastopen&&(m["fast-open"]=!0),m.protocol||(m.protocol="udp"),m}}}function Woe(){return{name:"URI TUIC Parser",test:n=>/^tuic:\/\//.test(n),parse:n=>{n=n.split(/tuic:\/\//)[1];let[s,o,i,a,u="",l]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);o=decodeURIComponent(o);let[f,...m]=o.split(":"),p=m.join(":");a=parseInt(`${a}`,10),isNaN(a)&&(a=443),p=decodeURIComponent(p),l!=null&&(l=decodeURIComponent(l)),l=l??`TUIC ${i}:${a}`;let d={type:"tuic",name:l,server:i,port:a,password:p,uuid:f};for(let v of u.split("&"))if(v){let[g,y]=v.split("=");g=g.replace(/_/g,"-"),y=decodeURIComponent(y),["alpn"].includes(g)?d[g]=y?y.split(","):void 0:["allow-insecure","insecure"].includes(g)?d["skip-cert-verify"]=/(TRUE)|1/i.test(y):["fast-open"].includes(g)?d.tfo=!0:["disable-sni","reduce-rtt"].includes(g)?d[g]=/(TRUE)|1/i.test(y):g==="congestion-control"?(d["congestion-controller"]=y,delete d[g]):Object.keys(d).includes(g)||(d[g]=y)}return d}}}function Xoe(){return{name:"URI WireGuard Parser",test:n=>/^(wireguard|wg):\/\//.test(n),parse:n=>{n=n.split(/(wireguard|wg):\/\//)[2];let[s,o,i,a,u,l,f,m="",p]=/^((.*?)@)?(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);l=parseInt(`${l}`,10),isNaN(l)&&(l=51820),i=decodeURIComponent(i),p!=null&&(p=decodeURIComponent(p)),p=p??`WireGuard ${a}:${l}`;let d={type:"wireguard",name:p,server:a,port:l,"private-key":i,udp:!0};for(let v of m.split("&"))if(v){let g=v.indexOf("="),y,w;if(g===-1?(y=v,w=""):(y=v.slice(0,g),w=v.slice(g+1)),y=y.replace(/_/,"-"),w=decodeURIComponent(w),["reserved"].includes(y)){let E=w.split(",").map(S=>parseInt(S.trim(),10)).filter(S=>Number.isInteger(S));E.length===3&&(d[y]=E)}else if(["address","ip"].includes(y))w.split(",").map(E=>{let S=Uoe(E);S&&(S.family==="ipv4"?(d.ip=S.address,typeof S.cidr<"u"&&(d["ip-cidr"]=S.cidr)):S.family==="ipv6"&&(d.ipv6=S.address,typeof S.cidr<"u"&&(d["ipv6-cidr"]=S.cidr)))});else if(["mtu"].includes(y)){let E=parseInt(w.trim(),10);Number.isInteger(E)&&(d[y]=E)}else/publickey/i.test(y)?d["public-key"]=w:/privatekey/i.test(y)?d["private-key"]=w:/^presharedkey$/i.test(y)?d["preshared-key"]=w:["udp"].includes(y)?d[y]=/(TRUE)|1/i.test(w):[...Object.keys(d),"flag"].includes(y)||(d[y]=w)}return d}}}function Joe(){return{name:"URI Trojan Parser",test:n=>/^trojan:\/\//.test(n),parse:n=>{let[s,o]=n.split(/#(.+)/,2),i=/^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(s);i?.[2]||(s=s.replace(i[1],`${i[1]}:443`));let l=h4().parse(s);if(Ge(o))try{l.name=decodeURIComponent(o)}catch(f){console.log(f)}return l}}}function Zoe(){return{name:"Clash Parser",test:n=>{let s;try{s=v4.default.parse(n)}catch{s=gi.parse(n)}return!!s?.type},parse:n=>{let s;try{s=v4.default.parse(n)}catch{s=gi.parse(n)}if(!["zerotier","shadowquic","gost-relay","openvpn","tailscale","easytier","trusttunnel","h2-connect","naive","anytls","mieru","masque","masque-surge","sudoku","juicity","ss","ssr","vmess","socks5","http","snell","trojan","tuic","vless","hysteria","hysteria2","wireguard","ssh","direct"].includes(s.type))throw new Error(`Clash does not support proxy with type: ${s.type}`);return["vmess","vless"].includes(s.type)&&s.servername&&(s.sni=s.servername,delete s.servername),s["server-cert-fingerprint"]&&(s["tls-fingerprint"]=s["server-cert-fingerprint"]),s.fingerprint&&(s["tls-fingerprint"]=s.fingerprint),s["dialer-proxy"]&&(s["underlying-proxy"]=s["dialer-proxy"]),s["benchmark-url"]&&(s["test-url"]=s["benchmark-url"]),s["benchmark-timeout"]&&(s["test-timeout"]=s["benchmark-timeout"]),s.type==="vmess"&&(s.cipher=cn(s.cipher)),s}}}function Qoe(){return{name:"QX SS Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")===-1,parse:n=>Zi().parse(n)}}function eae(){return{name:"QX SSR Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")!==-1,parse:n=>Zi().parse(n)}}function tae(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>Zi().parse(n)}}function rae(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>Zi().parse(n)}}function nae(){return{name:"QX AnyTLS Parser",test:n=>/^anytls\s*=/.test(n.split(",")[0].trim()),parse:n=>Zi().parse(n)}}function sae(){return{name:"QX Mieru Parser",test:n=>/^mieru\s*=/.test(n),parse:n=>Zi().parse(n)}}function iae(){return{name:"QX Hysteria2 Parser",test:n=>/^hysteria2\s*=/.test(n),parse:n=>Zi().parse(n)}}function oae(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>Zi().parse(n)}}function aae(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>Zi().parse(n)}}function uae(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>Zi().parse(n)}}function cae(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>ri().parse(n)}}function lae(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>ri().parse(n)}}function fae(){return{name:"Loon VMess Parser",test:n=>tO.test(n),parse:n=>ri().parse(n)}}function dae(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>ri().parse(n)}}function hae(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>ri().parse(n)}}function pae(){return{name:"Loon AnyTLS Parser",test:n=>/^.*=\s*anytls/i.test(n.split(",")[0]),parse:n=>ri().parse(n)}}function mae(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>ri().parse(n)}}function gae(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>ri().parse(n)}}function vae(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>ri().parse(n)}}function wae(){return{name:"Loon Tailscale Parser",test:n=>/^[^=,]*=\s*tailscale\s*(?:,|$)/i.test(n),parse:n=>ri().parse(n)}}function yae(){return{name:"Loon Mieru Parser",test:n=>/^[^=,]*=\s*mieru\s*,/i.test(n),parse:n=>ri().parse(n)}}function Eae(){return{name:"Loon WireGuard Parser",test:n=>/^.*=\s*wireguard/i.test(n.split(",")[0]),parse:n=>{let s=n.match(/(^.*?)\s*?=\s*?wireguard\s*?,.+?\s*?=\s*?.+?/i)?.[1];n=n.replace(s,"").replace(/^\s*?=\s*?wireguard\s*/i,"");let o=n.match(/,\s*?peers\s*?=\s*?\[\s*?\{\s*?(.+?)\s*?\}\s*?\]/i)?.[1],i=o.match(/(,|^)\s*?endpoint\s*?=\s*?"?(.+?):(\d+)"?\s*?(,|$)/i),a=i?.[2],u=parseInt(i?.[3],10),l=n.match(/(,|^)\s*?mtu\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];l&&(l=parseInt(l,10));let f=n.match(/(,|^)\s*?keepalive\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];f&&(f=parseInt(f,10));let m=o.match(/(,|^)\s*?reserved\s*?=\s*?"?(\[\s*?.+?\s*?\])"?\s*?(,|$)/i)?.[2];m&&(m=JSON.parse(m));let p,d=n.match(/(?:^|,)\s*server-dns\s*=\s*(?:"([^"]*)"|([^"]*?))(?=\s*(?:,\s*[\w-]+\s*=|$))/i),v=n.match(/(,|^)\s*?dns\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],g=n.match(/(,|^)\s*?dnsv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2];(v||g)&&(p=[],v&&p.push(v),g&&p.push(g));let y=o.match(/(,|^)\s*?allowed-ips\s*?=\s*?"(.+?)"\s*?(,|$)/i)?.[2]?.split(",").map(H=>H.trim()),w=o.match(/(,|^)\s*?preshared-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],E=n.match(/(,|^)\s*?interface-ip\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],S=n.match(/(,|^)\s*?interface-ipv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],C=o.match(/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],D={type:"wireguard",name:s,server:a,port:u,ip:E,ipv6:S,"private-key":n.match(/(,|^)\s*?private-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],"public-key":C,mtu:l,keepalive:f,reserved:m,"allowed-ips":y,"preshared-key":w,dns:p,"server-dns":(d?.[1]??d?.[2])?.split(",").map(H=>H.trim()).filter(Boolean),udp:!0,peers:[{server:a,port:u,ip:E,ipv6:S,"public-key":C,"pre-shared-key":w,"allowed-ips":y,reserved:m}]};return Array.isArray(D.dns)&&D.dns.length>0&&(D["remote-dns-resolve"]=!0),D}}}function bae(){return{name:"Surge Direct Parser",test:n=>/^[^=,]*=\s*direct\s*$/i.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Aae(){return{name:"Surge AnyTLS Parser",test:n=>/^.*=\s*anytls/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Sae(){return{name:"Surge TrustTunnel Parser",test:n=>/^.*=\s*trust-tunnel/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function _ae(){return{name:"Surge MASQUE Parser",test:n=>/^.*=\s*masque/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Cae(){return{name:"Surge HTTP/2 CONNECT Parser",test:n=>/^.*=\s*h2-connect/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Dae(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Fae(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Bae(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1&&!tO.test(n),parse:n=>ln().parse(n)}}function Iae(){return{name:"Surge VLESS Parser",test:n=>/^.*=\s*vless\s*$/.test(n.split(",")[0])&&/,\s*username\s*=/.test(n),parse:n=>ln().parse(n)}}function $ae(){return{name:"Surge Trojan Parser",test:n=>/^.*=\s*trojan/.test(n.split(",")[0])&&!/^[^=,]*=\s*trojan\s*,[^,]*,[^,]*,\s*"/.test(n),parse:n=>ln().parse(n)}}function xae(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0])&&!rO.test(n),parse:n=>ln().parse(n)}}function Rae(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0])&&!rO.test(n),parse:n=>ln().parse(n)}}function Tae(){return{name:"Surge External Parser",test:n=>/^.*=\s*external/.test(n.split(",")[0]),parse:n=>{let s=ln().parse(n);return s.addresses=s.addresses.map(o=>o.trim().replace(/^\[/,"").replace(/\]$/,"")).filter(Lae),s}}}function kae(){return{name:"Snell Parser",test:n=>/^[^=,]*=\s*(?:snell|opensnell)\s*,/i.test(n),parse:n=>{let s=n.match(/(?:[^",]+|"[^"]*")+/g).slice(3),o=/^(?:(?:udp|obfs-name|ip-mode|server-dns)\s*=|block-quic\s*=\s*(?:true|false)$)/;return(s[0]?.trim().startsWith('"')||s.some(a=>o.test(a.trim()))?ri():ln()).parse(n)}}}function Pae(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Oae(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Nae(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>ln().parse(n)}}function Lae(e){return Ur(e)||lr(e)}var r3e,v4,Pa,tO,rO,nO,sO=re(()=>{r3e=F(I());Ir();YP();XP();ZP();eO();gt();v4=F(g4());zl();Pa=F(ho());Xo();Ih();Hu();Fh();Si();tO=/^[^=,]*=\s*vmess\s*,[^,]*,[^,]*,[^,]*,\s*"/i;rO=/(^|,)\s*(fast-open|over-tls|tls-name|ip-mode|tls-cert-sha256|tls-pubkey-sha256|server-dns)\s*=/i;nO=[Hoe(),Moe(),qoe(),joe(),Koe(),S4(),Woe(),Xoe(),Yoe(),zoe(),Joe(),Voe(),Goe(),Zoe(),bae(),Aae(),Sae(),_ae(),Cae(),Dae(),Fae(),Bae(),Iae(),$ae(),xae(),kae(),Pae(),Oae(),Nae(),Rae(),Tae(),cae(),lae(),fae(),dae(),mae(),hae(),pae(),gae(),vae(),Eae(),wae(),yae(),Qoe(),eae(),tae(),rae(),nae(),sae(),iae(),oae(),aae(),uae()]});function iO(e){let t;try{t=JSON.parse(e.body)}catch{}let r=t?.message?.error??t?.error??t?.message??e.body??"Unknown error";return`ERROR: HTTP ${e.statusCode}: ${r}`}function Uae(e,t=_4){return(String(e??"").trim()||t).replace(/\/+$/,"")}function oO({githubApiUrl:e,githubProxy:t}={}){let r=Uae(e),n=r!==_4,s=String(t||"").trim().replace(/\/+$/,"");return n?r:`${s?`${s}/`:""}${_4}`}function a3e(e={}){return!!e?.gistToken}var c3e,_4,Qi,M1=re(()=>{c3e=F(I());li();Ir();gt();dr();_4="https://api.github.com";Qi=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=hr(),{defaultProxy,githubApiTimeout,githubProxy,githubApiUrl}=R.read(pt)||{},githubApiRequestTimeout=githubApiTimeout||1e4,githubGistBaseURL=oO({githubApiUrl,githubProxy}),proxy=defaultProxy;R.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY")),syncPlatform==="gitlab"?(this.headers={"PRIVATE-TOKEN":`${token}`,"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"},this.http=Oi({baseURL:"https://gitlab.com/api/v4",headers:{...this.headers,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?tu(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(iO(e)):e}})):(this.headers={Authorization:`token ${token}`,"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"},this.http=Oi({baseURL:githubGistBaseURL,headers:{...this.headers,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?tu(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(iO(e)):e}})),this.key=key,this.syncPlatform=syncPlatform,this._requestQueue=Promise.resolve();let queuedMethods=["get","post","put","patch","delete"];for(let e of queuedMethods){let t=this.http[e];typeof t=="function"&&(this.http[e]=(...r)=>new Promise((n,s)=>{this._requestQueue=this._requestQueue.then(()=>t.apply(this.http,r).then(n,s))}))}}async locate(){return this.syncPlatform==="gitlab"?this.http.get("/snippets").then(e=>{let t=JSON.parse(e.body);for(let r of t)if(r.title===this.key)return r}):this.http.get("/gists?per_page=100&page=1").then(e=>{let t=JSON.parse(e.body);R.info(`\u83B7\u53D6\u5230\u5F53\u524D GitHub \u7528\u6237\u7684 gist: ${t.length} \u4E2A`);for(let r of t)if(r.description===this.key)return r})}async upload(e,t={}){if(Object.keys(e).length===0)return Promise.reject("\u672A\u63D0\u4F9B\u9700\u4E0A\u4F20\u7684\u6587\u4EF6");let r=await this.locate(),n=e,s=t.emptyFileFallback,o=!!s?.filename,i={},a=async l=>{let f=await l;return Object.keys(i).length>0&&(f.subStoreUploadMeta=i),f},u=({actions:l,existingFiles:f,result:m})=>{if(!o)return;let p=s.filename,d=s.content??"",v=Object.keys(m).filter(g=>g!==p);Object.keys(m).length===0?(m[p]={content:d},i.emptyFileFallback={status:"created",filename:p},this.syncPlatform==="gitlab"?l.push({action:f[p]?"update":"create",file_path:p,content:d}):n[p]={content:d}):m[p]&&v.length>0?(delete m[p],i.emptyFileFallback={status:"removed",filename:p},this.syncPlatform==="gitlab"?l.push({action:"delete",file_path:p}):n[p]=null):m[p]&&v.length===0&&(i.emptyFileFallback={status:"retained",filename:p})};if(r?.id){this.syncPlatform==="gitlab"&&(r.files=r.files.reduce((m,p)=>(m[p.path]=p,m),{}));let l=[],f={...r.files};return Object.keys(n).map(m=>{f[m]?n[m].content==null||n[m].content===""?(delete f[m],n[m]=null,l.push({action:"delete",file_path:m})):(f[m]=n[m],l.push({action:"update",file_path:m,content:n[m].content})):n[m].content==null||n[m].content===""?(delete f[m],delete n[m]):(f[m]=n[m],l.push({action:"create",file_path:m,content:n[m].content}))}),u({actions:l,existingFiles:r.files,result:f}),this.syncPlatform==="gitlab"?Object.keys(f).length===0?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u66F4\u65B0 snippet"):Object.keys(f).length>10?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4 snippet \u7684\u6587\u4EF6\u6570\u8D85\u8FC7 10, \u65E0\u6CD5\u66F4\u65B0 snippet"):(n=l,a(this.http.put({headers:{...this.headers,"Content-Type":"application/json"},url:`/snippets/${r.id}`,body:JSON.stringify({files:n})}))):Object.keys(f).length===0?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u66F4\u65B0 gist"):a(this.http.patch({url:`/gists/${r.id}`,headers:{...this.headers,"Accept-Encoding":"gzip, deflate, br"},body:JSON.stringify({files:n})}))}else return n=Object.entries(n).reduce((l,[f,m])=>(m.content!==null&&m.content!==""&&(l[f]=m),l),{}),this.syncPlatform==="gitlab"?Object.keys(n).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA snippet"):(n=Object.keys(n).map(l=>({file_path:l,content:n[l].content})),a(this.http.post({headers:{...this.headers,"Content-Type":"application/json"},url:"/snippets",body:JSON.stringify({title:this.key,visibility:"private",files:n})}))):Object.keys(n).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA gist"):a(this.http.post({url:"/gists",body:JSON.stringify({description:this.key,public:!1,files:n})}))}async download(e){let t=await this.locate();if(t?.id)try{let{files:r}=await this.http.get(`/gists/${t.id}`).then(s=>JSON.parse(s.body)),n=r[e].raw_url;return await this.http.get(n).then(s=>s.body)}catch(r){return Promise.reject(r)}else return Promise.reject(`\u627E\u4E0D\u5230 Sub-Store Gist (${this.key})`)}}});function Mae(e){for(let t of vw)try{let r=t.test(e);if(r)return R.info(`Pre-processor [${t.name}] activated`),t.parse(e,!1,r)}catch(r){R.error(`Parser [${t.name}] failed
|
||
Reason: ${r}`)}return e}function qae(e){e=Mae(e);let t=e.split(`
|
||
`),r=[],n=o=>{for(let i of Array.isArray(o)?o:[o])r.push(Jae(i))},s;for(let o of t){if(o=o.trim(),o.length===0)continue;let i=!1;if(s){let[a,u]=cO(s,o);u||(n(a),i=!0)}if(!i)for(let a of nO){let[u,l]=cO(a,o);if(!l){n(u),s=a,i=!0,R.info(`${a.name} is activated`);break}}i||R.error(`Failed to parse line: ${o}`)}return r.filter(o=>{if(["vless","vmess"].includes(o.type))Pg(o.uuid)||R.warn(`UUID may be invalid: ${o.name} ${o.uuid}`);else if(["hysteria2"].includes(o.type)&&o.obfs&&!o["obfs-password"])return R.error(`Proxy ${o.name} has obfs ${o.obfs} but missing obfs-password`),!1;return!0})}function dO(e,t){let r=t.process;if(!r||typeof r!="object")return!1;let{type:n,customNames:s}=r;if(!Array.isArray(s))return!1;let o=e.customName!=null&&s.includes(e.customName);return n==="disable"?o:n==="enable"?!o:!1}async function jae(e,t=[],r,n,s,o,i={}){let a={};o!==void 0&&(a.raw=Array.isArray(o)||o!==null&&typeof o=="object"?o:[o]);for(let u of t){if(sC(u.type)){R.log(`Skipping response transformer during proxy/file processing: "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}if(dO(u,a)){R.info(`Skipping context-controlled operator: "${u.type}" with customName "${u.customName||""}"`);continue}if(u.disabled){R.log(`Skipping disabled operator: "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}let l,f={};if(u.type.indexOf("Script")!==-1&&({script:l,$arguments:f}=await hO(u,i)),!S1[u.type]){R.error(`Unknown operator: "${u.type}"`);continue}R.log(`Applying "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);let m;u.type.indexOf("Script")!==-1?m=S1[u.type](l,r,f,n,s,a):m=S1[u.type](u.args||{},i),e=await A7(m,e)}return e}async function Kae(e,t=[],r,n,s,o={}){let i={},a=aO(e);for(let u of t){if(!sC(u.type))continue;if(dO(u,i)){R.info(`Skipping context-controlled response transformer: "${u.type}" with customName "${u.customName||""}"`);continue}if(u.disabled){R.log(`Skipping disabled response transformer: "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}let{script:l,$arguments:f}=await hO(u,o);R.log(`Applying "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);let m=S1[u.type](l,r,f,n,s,i);a=aO(await b7(m,a))}return a}async function hO(item,executionContext={}){if(R.env.isNode&&!eval("process.env.SUB_STORE_FRONTEND_BACKEND_PATH")?.startsWith("/")&&!eval("process.env.SUB_STORE_BACKEND_CUSTOM_NAME")){let e="Node.js \u73AF\u5883\u4E0B\uFF0C\u811A\u672C\u64CD\u4F5C\u3001\u811A\u672C\u8FC7\u6EE4\u548C\u4FEE\u6539\u54CD\u5E94\u5FC5\u987B\u8BBE\u7F6E SUB_STORE_FRONTEND_BACKEND_PATH \u624D\u80FD\u751F\u6548\uFF1B\u82E5\u4E0D\u60F3\u6539\u53D8\u5F53\u524D path\uFF0C\u53EF\u8BBE\u7F6E SUB_STORE_FRONTEND_BACKEND_PATH=/";throw R.error(e),new Error(e)}let script,$arguments={},{mode,content}=item.args||{};if(mode==="link"){let e=content||"",t=e.split("#");if(t.length>1)try{$arguments=JSON.parse(decodeURIComponent(t[1]))}catch{for(let s of t[1].split("&")){let o=s.split("=")[0],i=s.split("=")[1];$arguments[o]=i==null||i===""?!0:decodeURIComponent(i)}}e=`${e.split("#")[0]}${t[2]?`#${t[2]}`:$arguments?.noCache!=null||$arguments?.insecure!=null?`#${t[1]}`:""}`;let r=e.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(r){let n="";try{n=r?.[1];let s=r?.[2];if(s==null)throw new Error(`\u672C\u5730 ${n} URL \u65E0\u6548: ${e}`);s=decodeURIComponent(s);let o=n==="module"?zn:Lt,i=Qe(R.read(o),s);if(!i)throw new Error(`\u627E\u4E0D\u5230 ${n}: ${s}`);n==="module"?script=i.content:script=await _n({type:"file",name:s,noFlow:executionContext.noFlow})}catch(s){throw R.error(`Error when loading ${n}: ${item.args.content}.
|
||
Reason: ${s}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${n}: ${e}`)}}else if(e?.startsWith("/"))try{script=Pi().readFileSync(e.split("#")[0],"utf8")}catch(n){throw R.error(`Error when reading local script: ${item.args.content}.
|
||
Reason: ${n}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u811A\u672C\u6587\u4EF6: ${e}`)}else try{script=await fn(e,void 0,void 0,void 0,void 0,void 0,void 0,void 0,{noFlow:executionContext.noFlow})}catch(n){throw R.error(`Error when downloading remote script: ${item.args.content}.
|
||
Reason: ${n}`),new Error(`\u65E0\u6CD5\u4E0B\u8F7D\u811A\u672C: ${e}`)}}else script=content,$arguments=item.args?.arguments||{};return{script,$arguments}}function aO(e={}){let t=e.header||e.headers||{};(!t||typeof t!="object")&&(t={});let r={status:e.status||e.statusCode||200,body:Object.prototype.hasOwnProperty.call(e,"body")?e.body:""};return Object.defineProperty(r,"headers",{enumerable:!0,get(){return t},set(n){t=n&&typeof n=="object"?n:{}}}),Object.defineProperty(r,"header",{enumerable:!0,get(){return t},set(n){t=n&&typeof n=="object"?n:{}}}),r}function uO(e){return e.replace(/[=,]/g,"").replace(/(^|\s)(?:[#;]|\/\/)+/g,"$1").trim()}function Vae(e,t,r,n={}){let s=Mw[t];if(!s)throw new Error(`Target platform: ${t} is not supported!`);let o=String(t).toLowerCase(),i=["surge","surgemac","surfboard"].includes(o);if(e=e.filter(a=>{if(!yw(a,t))return!1;let u=n["include-unsupported-proxy"];if(!u&&a.supported&&a.supported[t]===!1)return!1;if(!u&&Gae(a)&&zae(a)&&!Yae(a,t))return R.error(`Target platform ${t} does not support headers for ${Wae(a)} proxy ${a.name||`${a.server}:${a.port}`}. Proxy has been filtered.`),!1;if(!u&&Ch(a)&&!["qx","quantumultx","shadowrocket"].includes(o))return!1;if(["vless","vmess"].includes(a.type)){Pg(a.uuid)||R.warn(`UUID may be invalid: ${a.name} ${a.uuid}`);let f=a.type==="vless",m=f?[["reality-opts",a["reality-opts"]],["xhttp download-settings reality-opts",a["xhttp-opts"]?.["download-settings"]?.["reality-opts"]]]:[];for(let[d,v]of m)if(v&&!Ge(v["public-key"])){if(d==="xhttp download-settings reality-opts"&&Ge(a["reality-opts"]?.["public-key"])&&v["public-key"]==="")continue;return R.error(`Skipping VLESS Reality proxy ${a.name}: empty ${d}.public-key`),!1}let p=a["xhttp-opts"];if(f&&a.network==="xhttp"&&p?.mode==="stream-one"&&p["download-settings"])return R.error(`Skipping VLESS xhttp proxy ${a.name}: mode "stream-one" cannot be used with download-settings`),!1}return!0}),e=e.map(a=>(a._resolved=a.resolved,i&&typeof a.name=="string"&&(a.name=uO(a.name)),Ge(a.name)||(a.name=`${a.type} ${a.server}:${a.port}`),a["disable-sni"]&&(["surge","surgemac","shadowrocket"].includes(o)||o==="surfboard"&&["h2-connect","vless"].includes(a.type)?a.sni="off":!["tuic"].includes(a.type)&&!["sing-box","singbox"].includes(o)&&(R.error(`Target platform ${t} does not support sni off. As a workaround for mihomo, proxy ${a.name} sni will be set to IP instead`),a.sni=Qw(a.server)?a.server:"127.0.0.1")),a.ports&&(a.ports=String(a.ports),["meta","clashmeta","clash.meta","mihomo"].includes(o)||(a.ports=a.ports.replace(/\//g,",")),a.port||(a.port=Mp(a.ports))),a.type==="wireguard"&&C1(a),a)),R.log(`Producing proxies for target: ${t}`),typeof s.type>"u"||s.type==="SINGLE"){let a=e.map(u=>{try{return s.produce(u,r,n)}catch(l){return R.error(`Cannot produce proxy: ${u.name}
|
||
Reason: ${l}`),""}}).filter(u=>u.length>0);return n._merged&&n.localPort>=1&&a.push(F1().produce({name:uO(String(n._merged.name??""))||"mihomo merged",type:"external",udp:!0,exec:n._merged.exec,"local-port":n.localPort,args:["-config",mt.encode(JSON.stringify({...n._merged.config,...n._merged.configOverride||{},"mixed-port":n.localPort}))],addresses:[]},r,n)),a=r==="internal"?a:a.join(`
|
||
`),t.startsWith("Surge")&&e.length>0&&e.every(u=>u.type==="wireguard")&&(a=`#!name=${e[0]?._subName}
|
||
#!desc=${e[0]?._desc??""}
|
||
#!category=${e[0]?._category??""}
|
||
${a}`),a}else if(s.type==="ALL")return s.produce(e,r,n)}function Gae(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function zae(e){return["http","h2-connect","trusttunnel"].includes(e?.type)}function Yae(e,t){let r=`${t}`.toLowerCase();return r.startsWith("surge")?["http","h2-connect","trusttunnel"].includes(e.type):r==="surfboard"?e.type==="h2-connect":r==="egern"||["clashmeta","clash.meta","meta","mihomo"].includes(r)||["singbox","sing-box"].includes(r)?e.type==="http":r==="json"?["http","h2-connect","trusttunnel"].includes(e.type):!1}function Wae(e){return e.type==="http"?e.tls?"HTTPS":"HTTP":e.type==="h2-connect"?"HTTP/2 CONNECT":e.type==="trusttunnel"?"TrustTunnel":e.type}function cO(e,t){if(!Xae(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function Xae(e,t){try{return e.test(t)}catch{return!1}}function lO(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function Jae(e){let t=(a,u)=>Object.prototype.hasOwnProperty.call(a,u),r=a=>{if(!(!a||typeof a!="object"||Array.isArray(a)))for(let u of Object.keys(a)){let l=u.toLowerCase();u!==l&&(t(a,l)||(a[l]=a[u]),delete a[u])}};for(let a of Object.keys(e)){let u=a.toLowerCase();u.endsWith("-opts")&&(a!==u&&(t(e,u)||(e[u]=e[a]),delete e[a]),r(e[u]))}let n=a=>{let u=a?.["reality-opts"];Ge(u?.["public-key"])&&!t(u,"support-x25519mlkem768")&&["safari-ios-26","chrome147"].includes(`${a._loon_tls_profile||""}`.trim())&&(u["support-x25519mlkem768"]=!0)};if(n(e),e.network==="xhttp"&&n(e["xhttp-opts"]?.["download-settings"]),(e.type!=="h2-connect"||e.udp!=null)&&(e.udp=![!1,0,"0","false","off"].includes(typeof e.udp=="string"?e.udp.toLowerCase():e.udp)),typeof e.cipher=="string"&&(e.cipher=e.cipher.toLowerCase()),typeof e.password=="number"&&(e.password=iI(e.password)),e["hop-interval"]!=null){let a=`${e["hop-interval"]}`.trim(),u=a.match(/^(\d+)\s*-\s*(\d+)$/);if(u){let l=parseInt(u[1],10),f=parseInt(u[2],10);l>0&&l<=f?(e["hop-interval"]=l,e["hop-interval-max"]=f):(delete e["hop-interval"],delete e["hop-interval-max"])}else if(/^\d+$/.test(a)){let l=parseInt(a,10);l>0?(e["hop-interval"]=l,delete e["hop-interval-max"]):(delete e["hop-interval"],delete e["hop-interval-max"])}else delete e["hop-interval"],delete e["hop-interval-max"]}["ss"].includes(e.type)&&e.cipher==="none"&&!e.password&&(e.password=""),e.interface&&(e["interface-name"]=e.interface,delete e.interface),sI(e.port)&&(e.port=parseInt(e.port,10)),e.server&&(e.server=`${e.server}`.trim().replace(/^\[/,"").replace(/\]$/,"")),["vmess","vless","trojan","anytls"].includes(e.type)&&e["shadow-tls-opts"]&&(e.plugin="shadow-tls",e["plugin-opts"]={host:e.sni,password:e["shadow-tls-opts"].password,version:e["shadow-tls-opts"].version},delete e["shadow-tls-opts"]),e.type==="snell"&&e["obfs-opts"]?.mode==="shadow-tls"&&!e.plugin&&(e.plugin="shadow-tls",e["plugin-opts"]={...e["obfs-opts"]},delete e["plugin-opts"].mode,delete e["obfs-opts"]),e.plugin==="shadow-tls"&&e["plugin-opts"]&&(e.alpn&&!e["plugin-opts"].alpn&&(e["plugin-opts"].alpn=e.alpn),delete e.alpn);let s=e.type==="vless"&&e.network==="xhttp"?e["xhttp-opts"]?.["download-settings"]:void 0;s?.["shadow-tls-opts"]&&(s.plugin="shadow-tls",s["plugin-opts"]={host:s.servername,password:s["shadow-tls-opts"].password,version:s["shadow-tls-opts"].version},delete s["shadow-tls-opts"]),s?.plugin==="shadow-tls"&&s["plugin-opts"]&&(s.alpn&&!s["plugin-opts"].alpn&&(s["plugin-opts"].alpn=s.alpn),delete s.alpn),e.network==="ws"&&(!e["ws-opts"]&&(e["ws-path"]||e["ws-headers"])&&(e["ws-opts"]={},e["ws-path"]&&(e["ws-opts"].path=e["ws-path"]),e["ws-headers"]&&(e["ws-opts"].headers=e["ws-headers"])),delete e["ws-path"],delete e["ws-headers"]);let o=e[`${e.network}-opts`]?.path;if(Array.isArray(o)?e[`${e.network}-opts`].path=o.map(a=>lO(a)):o!=null&&(e[`${e.network}-opts`].path=lO(o)),e.type==="trojan"&&(e.network=e.network||"tcp"),["vmess"].includes(e.type)&&(e.network=e.network||"tcp",e.cipher=e.cipher||"none",e.alterId=e.alterId||0),["vless"].includes(e.type)&&(e.network=e.network||"tcp"),["vmess","vless"].includes(e.type)&&e["packet-encoding"]==null&&(e.xudp?e["packet-encoding"]="xudp":e["packet-addr"]&&(e["packet-encoding"]="packetaddr")),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","h2-connect","naive","masque","shadowquic"].includes(e.type)&&(e.tls=!0),e.network){let a=e[`${e.network}-opts`]?.headers?.Host,u=e[`${e.network}-opts`]?.headers?.host;e.network!=="h2"&&u&&!a&&(e[`${e.network}-opts`].headers.Host=u,delete e[`${e.network}-opts`].headers.host)}if(e.network==="h2"){let a=e["h2-opts"],u=a?.host??a?.headers?.host??a?.headers?.Host,l=a?.path;u&&(a.host=Array.isArray(u)?u:[u]),a?.headers&&(delete a.headers.host,delete a.headers.Host,Object.keys(a.headers).length===0&&delete a.headers),Array.isArray(l)&&(a.path=l[0])}if(!e.tls&&["ws","http"].includes(e.network)&&!e[`${e.network}-opts`]?.headers?.Host&&!Qw(e.server)&&(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].headers=e[`${e.network}-opts`].headers||{},e[`${e.network}-opts`].headers.Host=["vmess","vless"].includes(e.type)&&e.network==="http"?[e.server]:e.server),["vmess","vless"].includes(e.type)&&e.network==="http"){let a=e[`${e.network}-opts`]?.path,u=e[`${e.network}-opts`]?.headers?.Host;u&&!Array.isArray(u)&&(e[`${e.network}-opts`].headers.Host=[u]),a&&!Array.isArray(a)&&(e[`${e.network}-opts`].path=[a])}if(e.tls&&!e.sni&&e.sni!==""){if(e.network){let a=e.network==="h2"?e["h2-opts"]?.host:e[`${e.network}-opts`]?.headers?.Host;a=Array.isArray(a)?a[0]:a,a&&(e.sni=a)}!e.sni&&!Qw(e.server)&&(e.sni=e.server)}if(e.ports?e.ports=String(e.ports).replace(/\//g,","):delete e.ports,["hysteria2"].includes(e.type)&&e.obfs&&!["salamander","gecko"].includes(e.obfs)&&!e["obfs-password"]&&(e["obfs-password"]=e.obfs,e.obfs="salamander"),["hysteria2"].includes(e.type)&&!e["obfs-password"]&&e.obfs_password&&(e["obfs-password"]=e.obfs_password,delete e.obfs_password),["vless"].includes(e.type)&&(e["reality-opts"]&&Object.keys(e["reality-opts"]).length===0&&delete e["reality-opts"],e["grpc-opts"]&&Object.keys(e["grpc-opts"]).length===0&&delete e["grpc-opts"],(!e["reality-opts"]&&!e.flow||["null",null].includes(e.flow))&&delete e.flow,["http"].includes(e.network)&&(e[`${e.network}-opts`]?.path||(e[`${e.network}-opts`]||(e[`${e.network}-opts`]={}),e[`${e.network}-opts`].path=["/"]))),typeof e.name!="string")if(/^\d+$/.test(e.name))e.name=`${e.name}`;else try{e.name?.data?e.name=Zw.Buffer.from(e.name.data).toString("utf8"):e.name=Zw.Buffer.from(e.name).toString("utf8")}catch(a){R.error(`proxy.name decode failed
|
||
Reason: ${a}`),e.name=`${e.type} ${e.server}:${e.port}`}["ws","http","h2"].includes(e.network)&&!["masque"].includes(e.type)&&(["ws","h2"].includes(e.network)&&!e[`${e.network}-opts`]?.path?(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].path="/"):e.network==="http"&&(!Array.isArray(e[`${e.network}-opts`]?.path)||e[`${e.network}-opts`]?.path.every(a=>!a))&&(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].path=["/"])),["anytls"].includes(e.type)&&e["disable-reuse"]&&(e.reuse=!1),["","off"].includes(e.sni)&&(e["disable-sni"]=!0);let i=e.ca_str;e["ca-str"]?i=e["ca-str"]:i&&(delete e.ca_str,e["ca-str"]=i);try{R.env.isNode&&!i&&e._ca&&(i=R.node.fs.readFileSync(e._ca,{encoding:"utf8"}))}catch(a){R.error(`Read ca file failed
|
||
Reason: ${a}`)}return!e["tls-fingerprint"]&&i&&(e["tls-fingerprint"]=s$.generateFingerprint(i)),["tuic"].includes(e.type)&&(e.alpn=Array.isArray(e.alpn)?e.alpn:[e.alpn||"h3"],e["congestion-controller"]=e["congestion-controller"]||"cubic",e["udp-relay-mode"]=e["udp-relay-mode"]||"native"),["wireguard"].includes(e.type)&&(Array.isArray(e.peers)&&e.peers.length>0&&(e.peers.find(u=>u.ip&&u.ipv6)||e.peers.find(u=>u.ip||u.ipv6))&&(e.ip||(e.ip=e.peers[0]?.ip),e.ipv6||(e.ipv6=e.peers[0]?.ipv6)),C1(e)),e}function Qw(e){return Ur(e)||lr(e)}var R3e,Zw,fO,Hae,Ft,tl=re(()=>{R3e=F(I());Xo();Zw=F(iu());i$();zl();Nh();us();Ir();S7();_h();MC();sO();gt();dr();hi();Lu();O6();od();M1();ei();Z6();fO=F(g4());fd();DC();Hae={encrypt:gh,decrypt:vh,derivePublicKey:yf};Ft={parse:qae,process:jae,processResponse:Kae,produce:Vae,age:Hae,ipAddress:kg,getRandomPort:Mp,isIPv4:Ur,isIPv6:lr,isIP:Qw,yaml:gi,getFlag:wh,removeFlag:w1,getISO:GT,MMDB:lw,Gist:Qi,download:fn,downloadFile:q1,isValidUUID:Pg,doh:J6,Buffer:Zw.Buffer,Base64:mt,JSON5:fO.default,hex_md5:Lr}});function Zae(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function Qae(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var k3e,pO,mO=re(()=>{k3e=F(I());pO=[Zae(),Qae()]});function eue(){return{type:"SINGLE",func:r=>["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL","GEOSITE","GEOIP"].indexOf(r.type)!==-1?null:`${{"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[r.type]||r.type},${r.content},SUB-STORE`}}function gO(){return{type:"SINGLE",func:r=>{if(["GEOSITE","GEOIP"].indexOf(r.type)!==-1)return null;let s=`${r.type},${r.content}`;return["IP-CIDR","IP-CIDR6"].includes(r.type)&&(s+=r.options?.length>0?`,${r.options.join(",")}`:""),s}}}function tue(){return{type:"SINGLE",func:r=>["SRC-IP","GEOSITE","GEOIP"].indexOf(r.type)!==-1?null:(["IP-CIDR","IP-CIDR6"].includes(r.type)&&r.options&&(r.options=r.options.filter(s=>["no-resolve"].includes(s))),gO().func(r))}}function rue(){return{type:"ALL",func:r=>{let n={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},s={payload:r.map(o=>{let i=`${n[o.type]||o.type},${o.content}`;return["IP-CIDR","IP-CIDR6","GEOIP"].includes(o.type)&&(o.options&&(o.options=o.options.filter(a=>["no-resolve"].includes(a))),i+=o.options?.length>0?`,${o.options.join(",")}`:""),i})};return gi.dump(s)}}}var N3e,vO,wO=re(()=>{N3e=F(I());zl();vO={QX:eue(),Surge:gO(),Loon:tue(),Clash:rue()}});function sue(){return{name:"Universal Rule Parser",test:()=>!0,parse:n=>{let s=n.split(`
|
||
`),o=[];for(let i of s)if(i=i.trim(),i.length!==0&&!/\s*#/.test(i))try{let a=i.split(",").map(f=>f.trim()),u=a[0],l=!1;for(let f of nue)if(f[0].test(u)){l=!0;let p={type:f[1],content:a[1]};["IP-CIDR","IP-CIDR6","GEOIP"].includes(p.type)&&(p.options=a.slice(2)),o.push(p)}if(!l)throw new Error("Invalid rule type: "+u)}catch(a){console.log(`Failed to parse line: ${i}
|
||
Reason: ${a}`)}return o}}}var U3e,nue,yO,EO=re(()=>{U3e=F(I()),nue=[[/^(DOMAIN|host|HOST)$/,"DOMAIN"],[/^(DOMAIN-KEYWORD|host-keyword|HOST-KEYWORD)$/,"DOMAIN-KEYWORD"],[/^(DOMAIN-SUFFIX|host-suffix|HOST-SUFFIX)$/,"DOMAIN-SUFFIX"],[/^USER-AGENT$/i,"USER-AGENT"],[/^PROCESS-NAME$/,"PROCESS-NAME"],[/^(DEST-PORT|DST-PORT)$/,"DST-PORT"],[/^SRC-IP(-CIDR)?$/,"SRC-IP"],[/^(IN|SRC)-PORT$/,"IN-PORT"],[/^PROTOCOL$/,"PROTOCOL"],[/^IP-CIDR$/i,"IP-CIDR"],[/^(IP-CIDR6|ip6-cidr|IP6-CIDR)$/,"IP-CIDR6"],[/^GEOIP$/i,"GEOIP"],[/^GEOSITE$/i,"GEOSITE"]];yO=[sue()]});var V3e,Rf,C4=re(()=>{V3e=F(I());mO();wO();EO();gt();Rf=(function(){function e(n){for(let s of pO)try{if(s.test(n))return R.info(`Pre-processor [${s.name}] activated`),s.parse(n)}catch(o){R.error(`Parser [${s.name}] failed
|
||
Reason: ${o}`)}return n}function t(n){n=e(n);for(let s of yO){let o;try{o=s.test(n)}catch{o=!1}if(o)return R.info(`Rule parser [${s.name}] is activated!`),s.parse(n)}}function r(n,s){let o=vO[s];if(!o)throw new Error(`Target platform: ${s} is not supported!`);if(typeof o.type>"u"||o.type==="SINGLE")return n.map(i=>{try{return o.func(i)}catch(a){return console.log(`ERROR: cannot produce rule: ${JSON.stringify(i)}
|
||
Reason: ${a}`),""}}).filter(i=>i.length>0).join(`
|
||
`);if(o.type==="ALL")return o.func(n)}return{parse:t,produce:r}})()});function Oa(){return(R.read(pt)||{}).appearanceSetting?.createItemPosition==="top"?"top":"bottom"}var W3e,Lh=re(()=>{W3e=F(I());dr();gt()});function bO(e){if(e!==void 0)return JSON.parse(JSON.stringify(e))}function Tf(){let e=R.read(pg);if(Array.isArray(e))return e;let t=[];return R.write(t,pg),t}function AO(){return Tf()}function D4(e){R.write(e,pg)}function iue(){return`${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function oue(e){let t=Tf(),r={id:iue(),archivedAt:Date.now(),...e};return t.unshift(r),D4(t),r}function aue(e){return Tf().find(t=>t.id===e)}function F4(e){let t=aue(e);if(!t)throw new vt("ARCHIVE_ENTRY_NOT_FOUND",`Archive entry ${e} does not exist`);return t}function B4(e){let t=Tf(),r=t.findIndex(s=>s.id===e);if(r===-1)throw new vt("ARCHIVE_ENTRY_NOT_FOUND",`Archive entry ${e} does not exist`);let[n]=t.splice(r,1);return D4(t),n}function SO(e){if(!Array.isArray(e))throw new Pe("INVALID_SORT_PAYLOAD","Archive sort payload must be an array of ids");let t=Tf(),r=new Map(e.map((n,s)=>[n,s]));return t.sort((n,s)=>{let o=r.has(n.id)?r.get(n.id):Number.MAX_SAFE_INTEGER,i=r.has(s.id)?r.get(s.id):Number.MAX_SAFE_INTEGER;return o-i}),D4(t),t}function j1(e,t,r={}){return oue({itemType:e,name:t.name,displayName:t.displayName,remark:t.remark,tag:bO(t.tag),snapshot:bO(t),...r})}function _O(e){let t=R.read(Gt)||[],r=Qe(t,e);if(!r)throw new vt("RESOURCE_NOT_FOUND",`Subscription ${e} does not exist!`);return j1("sub",r)}function CO(e){let t=R.read(zt)||[],r=Qe(t,e);if(!r)throw new vt("RESOURCE_NOT_FOUND",`Collection ${e} does not exist!`);return j1("col",r)}function DO(e){let t=R.read(Lt)||[],r=Qe(t,e);if(!r)throw new vt("RESOURCE_NOT_FOUND",`File ${e} does not exist!`);return j1("file",r)}function FO(e){let t=R.read($t)||[],r=Qe(t,e);if(!r)throw new vt("RESOURCE_NOT_FOUND",`Artifact ${e} does not exist!`);return j1("artifact",r)}function BO(e,t,r){let s=(R.read(Yr)||[]).find(o=>o.token===e&&o.type===t&&o.name===r);if(!s)throw new vt("RESOURCE_NOT_FOUND",`Share ${t}/${r}/${e} does not exist!`);return j1("share",s,{shareType:s.type})}var t8e,fl=re(()=>{t8e=F(I());gt();dr();hi();wn()});function $O(e){let t=Math.floor(Number(e));return!isFinite(t)||t<=0?cue:t}function I4(e){R.read($t)||R.write({},$t),e.get("/api/artifacts/restore",lue),e.route("/api/artifacts").get(fue).post(pue).put(due),e.route("/api/artifact/:name").get(hue).patch(mue).delete(gue)}async function lue(e,t){R.info("\u5F00\u59CB\u6062\u590D\u8FDC\u7A0B\u914D\u7F6E...");try{let{gistToken:r,syncPlatform:n}=R.read(pt)||{};if(!r)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let s=new Qi({token:r,key:Il,syncPlatform:n});try{let o=await s.locate();if(!o?.files)throw new Error("\u627E\u4E0D\u5230 Sub-Store Gist \u6587\u4EF6\u5217\u8868");let i=R.read($t),a=[];Object.keys(o.files).map(u=>{let l=o.files[u]?.filename;if(l){if(RO(l)){R.info(`\u5FFD\u7565 Gist \u5360\u4F4D\u6587\u4EF6: ${l}`);return}if(encodeURIComponent(l)!==l)R.error(`\u6587\u4EF6\u540D ${l} \u672A\u7F16\u7801 \u4E0D\u4FDD\u5B58`),a.push(l);else{let f=Qe(i,l);f?di(i,l,{...f,url:o.files[u]?.raw_url.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1")}):i.push({name:`${l}`,url:o.files[u]?.raw_url.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1")})}}}),R.write(i,$t),Ul()}catch(o){throw R.error(`\u67E5\u627E Sub-Store Gist \u65F6\u53D1\u751F\u9519\u8BEF: ${o.message??o}`),o}Le(t)}catch(r){R.error(`\u6062\u590D\u8FDC\u7A0B\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),Re(t,new Jt("FAILED_TO_RESTORE_ARTIFACTS","Failed to restore artifacts",`Reason: ${r.message??r}`))}}function fue(e,t){let r=R.read($t);Le(t,r)}function due(e,t){try{let r=e.body;r.forEach(bn),r.forEach(qg),R.write(r,$t),Ul(),Le(t)}catch(r){Re(t,r)}}async function hue(e,t){let{name:r}=e.params,n=R.read($t),s=Qe(n,r);s?Le(t,s):Re(t,new vt("RESOURCE_NOT_FOUND",`Artifact ${r} does not exist!`),404)}function pue(e,t){try{let r=$4(e.body);Le(t,r,201)}catch(r){Re(t,r)}}function mue(e,t){let r=e.body,n=R.read($t),s=e.params.name,o=Qe(n,s);if(o){r.name||(r.name=o.name),R.info(`\u6B63\u5728\u66F4\u65B0\u8FDC\u7A0B\u914D\u7F6E\uFF1A${o.name}`);let i={...o,...r};if(bn(i),!xO(i.name)){Re(t,new Pe("INVALID_ARTIFACT_NAME",`Artifact name ${i.name} is invalid.`));return}try{qg(i)}catch(a){Re(t,a);return}di(n,s,i),R.write(n,$t),Ul(),Le(t,i)}else Re(t,new Pe("DUPLICATE_KEY",`Artifact ${s} already exists.`))}async function gue(e,t){try{let{name:r}=e.params;R.info(`\u6B63\u5728\u5220\u9664\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r}`),wue(e.query.mode)&&FO(r);let n=await vue(r);Le(t,n)}catch(r){R.error(`\u65E0\u6CD5\u5220\u9664\u8FDC\u7A0B\u914D\u7F6E\uFF1A${e.params.name}\uFF0C\u539F\u56E0\uFF1A${r}`),Re(t,r instanceof Jt||r instanceof Pe||r instanceof vt?r:new Jt("FAILED_TO_DELETE_ARTIFACT",`Failed to delete artifact ${e.params.name}`,`Reason: ${r}`))}}function xO(e){return/^[a-zA-Z0-9._-]*$/.test(e)&&!RO(e)}function $4(e){if(bn(e),!xO(e.name))throw new Pe("INVALID_ARTIFACT_NAME",`Artifact name ${e.name} is invalid.`);R.info(`\u6B63\u5728\u521B\u5EFA\u8FDC\u7A0B\u914D\u7F6E\uFF1A${e.name}`),qg(e);let t=R.read($t);if(Qe(t,e.name))throw new Pe("DUPLICATE_KEY",`Artifact ${e.name} already exists.`);return sa(t,e,Oa()),R.write(t,$t),Ul(),e}async function vue(e){let t=R.read($t),r=Qe(t,e);if(!r)throw new vt("RESOURCE_NOT_FOUND",`Artifact ${e} does not exist!`);let n={attempted:!1,status:"not_attempted"};if(r.url||r.updated&&r.upload!==!1){let s={};s[encodeURIComponent(r.name)]={content:""},encodeURIComponent(r.name)!==r.name&&(s[r.name]={content:""}),n.attempted=!0;try{let i=(await ty(s)).subStoreUploadMeta?.emptyFileFallback;n.status=i?.status==="created"||i?.status==="retained"?"placeholder_retained":"deleted",i?.filename&&(n.placeholderFilename=i.filename)}catch(o){n.status="failed",n.message=`${o.message??o}`,R.error(`Function syncToGist: ${e} : ${o}`)}}return na(t,e),R.write(t,$t),Ul(),{artifact:r,remote:n}}function wue(e){if(e==null||e===""||e==="permanent")return!1;if(e==="archive")return!0;throw new Pe("INVALID_DELETE_MODE",`Unsupported delete mode: ${e}`)}function RO(e){return e===IO}function yue(){return{filename:IO,content:uue}}async function ty(e,t={}){let{gistToken:r,syncPlatform:n}=R.read(pt)||{};if(!r)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let s=Eue(e);R.info(`\u51C6\u5907\u540C\u6B65 Gist: \u6587\u4EF6\u6570 ${s.count}, \u603B\u5927\u5C0F ${ey(s.totalBytes)}, \u6700\u5927\u6587\u4EF6 ${s.largestFilename||"-"} (${ey(s.largestBytes)})`);let o=new Qi({token:r,key:Il,syncPlatform:n}),i;try{i=await o.upload(e,{...t,emptyFileFallback:t.emptyFileFallback??yue()})}catch(f){throw R.error(`\u540C\u6B65 Gist \u8BF7\u6C42\u5931\u8D25: \u6587\u4EF6\u6570 ${s.count}, \u603B\u5927\u5C0F ${ey(s.totalBytes)}, \u6700\u5927\u6587\u4EF6 ${s.largestFilename||"-"} (${ey(s.largestBytes)}), \u539F\u56E0: ${f.message??f}`),f}let a={};try{a=JSON.parse(i.body)}catch{}let u=a?.html_url??a?.web_url,l=R.read(pt)||{};return u?(R.log(`\u540C\u6B65 Gist \u540E, \u627E\u5230 Sub-Store Gist: ${u}`),l.artifactStore=u,l.artifactStoreStatus="VALID"):(R.error("\u540C\u6B65 Gist \u540E, \u627E\u4E0D\u5230 Sub-Store Gist"),l.artifactStoreStatus="NOT FOUND"),R.write(l,pt),i}function Eue(e){return Object.entries(e||{}).reduce((t,[r,n])=>{let s=n?.content;if(typeof s!="string")return t;let o=bue(s);return t.count++,t.totalBytes+=o,o>t.largestBytes&&(t.largestBytes=o,t.largestFilename=r),t},{count:0,totalBytes:0,largestBytes:0,largestFilename:""})}function bue(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e).length:unescape(encodeURIComponent(e)).length}function ey(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var h8e,IO,uue,cue,ry=re(()=>{h8e=F(I());gt();dr();hi();Lh();vn();wn();M1();fl();jg();us();IO=".sub-store-placeholder",uue=["Sub-Store placeholder","This file keeps the Gist alive when all sync configuration files are deleted."].join(`
|
||
`),cue=10});function ny(e){return e===!0?"quiet":e===!1||e==null||e===""?"disabled":e}function dl(...e){for(let t of e)if(t!=null&&t!=="")return ny(t);return"disabled"}function Uh(e){return Aue.has(ny(e))}function Lo(e){return Sue.has(ny(e))}function Yu({mode:e,message:t,notify:r}){let n=ny(e);if(n==="disabled"||Lo(n))throw new Error(t);Uh(n)&&r?.(t)}function hl({mode:e,notify:t,error:r}){Uh(e)&&t?.(r)}function x4({platform:e="JSON",produceType:t,produceOpts:r={}}){return t==="raw"?JSON.stringify([]):Ft.produce([],e,t,r)}var g8e,Aue,Sue,R4=re(()=>{g8e=F(I());tl();Aue=new Set(["enabled","fallbackNotify"]),Sue=new Set(["fallbackNotify","fallbackQuiet"])});function TO(e){return String(e??"").trim()}function Cue(e){let t=TO(e);return t?{[Cs]:t}:void 0}function Due(...e){for(let t of e){let r=TO(t?.[Cs]);if(r)return r}return""}function K1({req:e,type:t,name:r,findShareToken:n}){if(!e?.path?.startsWith("/share/"))return;let o=e.subStoreShareToken||(e.query?.token&&typeof n=="function"?n({token:e.query.token,type:t,name:r,pathname:e.path}):null),i=e.headers?.[_ue];return Cue(o?.[Cs]||i)}async function kf({body:e,res:t,configs:r=[]}){let n=Due(...r);if(!n)return e;let s=await gh(e??"",n);return t?.set&&t.set("Content-Type","text/plain; charset=utf-8"),s}var y8e,_ue,sy=re(()=>{y8e=F(I());us();_ue="x-sub-store-share-age-public-key"});function T4(e){R.read($t)||R.write({},$t),e.get("/api/sync/artifacts",Nue),e.get("/api/sync/artifact/:name",Lue)}function V1(e){return Object.keys(e).map(An).join(", ")}function kO(e){return Fue.includes(e)}function $ue(e){return bi(e)?LO(e):e?.source}function LO(e){return Iue.includes(e?.sourceType)?e.sourceType:"collection"}function iy(e){return(Array.isArray(e)?e:[e]).flat()}function UO(e){return iy(e).filter(t=>t!=null&&t!=="").join(`
|
||
`)}function xue(e,t){return t!=null&&t!==""?t:e.ignoreFailedRemoteFile}async function PO({file:e,sourceUrl:t,ua:r,proxy:n,noCache:s,noFlow:o,ignoreFailedRemoteFile:i,notifyTitle:a="\u{1F30D} Sub-Store \u5904\u7406\u6587\u4EF6\u5931\u8D25"}){let u={},l=`${t||""}`.split(/[\r\n]+/).map(p=>p.trim()).filter(p=>p.length);if(l.length===0)throw new Error(`\u6587\u4EF6 ${e.name} \u672A\u914D\u7F6E\u8FDC\u7A0B\u6587\u4EF6 URL`);let f=await Promise.all(l.map(async p=>{try{return await fn(p,r||e.ua,void 0,e.proxy||n,void 0,void 0,s||e.noCache,void 0,{noFlow:o})}catch(d){return u[p]=d,R.error(`\u6587\u4EF6 ${e.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${An(p)} \u53D1\u751F\u9519\u8BEF: ${d}`),""}})),m=xue(e,i);if(Object.keys(u).length>0)if(m)m==="enabled"&&R.notify(a,`\u274C ${e.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${V1(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${e.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${V1(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);return f}async function oy(e,{url:t,ua:r,content:n,mergeSources:s,ignoreFailedRemoteFile:o,proxy:i,noCache:a,noFlow:u,notifyTitle:l}={}){if(n&&!kO(s))return n;if(t){let m=await PO({file:e,sourceUrl:t,ua:r,proxy:i,noCache:a,noFlow:u,ignoreFailedRemoteFile:o,notifyTitle:l});return s==="localFirst"?m.unshift(n):s==="remoteFirst"&&m.push(n),m}if($ue(e)==="local"&&!kO(e.mergeSources))return e.content;let f=await PO({file:e,sourceUrl:e.url,ua:r,proxy:i,noCache:a,noFlow:u,ignoreFailedRemoteFile:o,notifyTitle:l});return e.mergeSources==="localFirst"?f.unshift(e.content):e.mergeSources==="remoteFirst"&&f.push(e.content),f}async function k4(e,t={}){let r={},n=LO(e);if(n==="none")return Ft.yaml.safeDump(r);if(Bue.includes(n)){let s=await oy(e,t);if(e?.mode!=="proxy")return UO(s);let o=iy(s).map(i=>Ft.parse(i)).flat();if(o.length===0)throw new Error(`\u6587\u4EF6 ${e.name} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);r.proxies=Ft.produce(o,"mihomo","internal",{"delete-underscore-fields":!0,"include-unsupported-proxy":e?.includeUnsupportedProxy})}else r.proxies=await _n({type:n,name:e?.sourceName,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0,"include-unsupported-proxy":e?.includeUnsupportedProxy},noFlow:t.noFlow});return Ft.yaml.safeDump(r)}async function _n({type:e,name:t,platform:r,url:n,ua:s,content:o,mergeSources:i,ignoreFailedRemoteSub:a,ignoreFailedRemoteFile:u,produceType:l,produceOpts:f={},subscription:m,file:p,awaitCustomCache:d,$options:v,proxy:g,noCache:y,noFlow:w,all:E,includeRaw:S}){if(r=r||"JSON",["subscription","sub"].includes(e)){let C;if(t){let _=R.read(Gt);if(C=Qe(_,t),!C)throw new Error(`\u627E\u4E0D\u5230\u8BA2\u9605 ${t}`)}else if(m)C=m;else throw new Error("\u672A\u63D0\u4F9B\u8BA2\u9605\u540D\u79F0\u6216\u8BA2\u9605\u6570\u636E");let D=dl(a,C.ignoreFailedRemoteSub),H=w||C.noFlow,K=[];try{let _;if(o&&!["localFirst","remoteFirst"].includes(i))_=o,K=o;else if(n){let k={},N=await Promise.all(n.split(/[\r\n]+/).map(O=>O.trim()).filter(O=>O.length).map(async O=>{try{return await fn(O,s||C.ua,void 0,g||C.proxy,void 0,d,y||C.noCache,!0,{returnRaw:!0,noFlow:H})}catch(L){return k[O]=L,R.error(`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${An(O)} \u53D1\u751F\u9519\u8BEF: ${L}`),""}}));if(_=N.map(O=>O.result??O),K=N.map(O=>O.raw??O),Object.keys(k).length>0){let O=`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${V1(k)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;Yu({mode:D,message:O,notify:()=>{R.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,O)}})}i==="localFirst"?(_.unshift(o),K.unshift(o)):i==="remoteFirst"&&(_.push(o),K.push(o))}else if(C.source==="local"&&!["localFirst","remoteFirst"].includes(C.mergeSources))_=C.content,K=C.content;else{let k={},N=await Promise.all(C.url.split(/[\r\n]+/).map(O=>O.trim()).filter(O=>O.length).map(async O=>{try{return await fn(O,s||C.ua,void 0,g||C.proxy,void 0,d,y||C.noCache,!0,{returnRaw:!0,noFlow:H})}catch(L){return k[O]=L,R.error(`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${An(O)} \u53D1\u751F\u9519\u8BEF: ${L}`),""}}));if(_=N.map(O=>O.result??O),K=N.map(O=>O.raw??O),Object.keys(k).length>0){let O=`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${V1(k)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;Yu({mode:D,message:O,notify:()=>{R.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,O)}})}C.mergeSources==="localFirst"?(_.unshift(C.content),K.unshift(C.content)):C.mergeSources==="remoteFirst"&&(_.push(C.content),K.push(C.content))}if(l==="raw"){let k=JSON.stringify((Array.isArray(_)?_:[_]).flat());return S?{result:k,raw:Array.isArray(K)?K:[K]}:k}let x=(Array.isArray(_)?_:[_]).map(k=>Ft.parse(k)).flat();if(x.forEach(k=>{k._subName=C.name,k._subDisplayName=C.displayName}),x=await Ft.process(x,C.process||[],r,{[C.name]:C},v,K,{noFlow:H}),x.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let j={};for(let k of x){if(j[k.name]){R.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${k.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}j[k.name]=!0}let U=Ft.produce(x,r,l,f);return S?{result:U,raw:Array.isArray(K)?K:[K]}:U}catch(_){if(!Lo(D))throw _;hl({mode:D,error:_,notify:j=>{R.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,`\u{1F914} \u539F\u56E0\uFF1A${j.message??j}`)}}),R.error(`\u8BA2\u9605 ${C.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${_.message??_}`);let x=x4({platform:r,produceType:l,produceOpts:f});return S?{result:x,raw:Array.isArray(K)?K:[K]}:x}}else if(["collection","col"].includes(e)){let C=R.read(Gt),D=R.read(zt),H=Qe(D,t);if(!H)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let K=[...H.subscriptions],_=H.subscriptionTags;Array.isArray(_)&&_.length>0&&C.forEach(k=>{Array.isArray(k.tag)&&k.tag.length>0&&!K.includes(k.name)&&k.tag.some(N=>_.includes(N))&&K.push(k.name)});let x=dl(a,H.ignoreFailedRemoteSub),j=w||H.noFlow,U={};try{let k={},N={},O=0;if(await Promise.all(K.map(async W=>{let G=Qe(C,W),J=dl(G.ignoreFailedRemoteSub),te=G.passThroughUA,ie=G.ua;te&&(R.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${s}`),ie=s);try{R.info(`\u6B63\u5728\u5904\u7406\u5B50\u8BA2\u9605\uFF1A${G.name}...`);let ge,he;if(G.source==="local"&&!["localFirst","remoteFirst"].includes(G.mergeSources))ge=G.content,he=G.content;else{let $e={},oe=await Promise.all(G.url.split(/[\r\n]+/).map(me=>me.trim()).filter(me=>me.length).map(async me=>{try{return await fn(me,ie,void 0,g||G.proxy||H.proxy,void 0,void 0,y||G.noCache,!0,{returnRaw:!0,noFlow:j||G.noFlow})}catch(Be){return $e[me]=Be,R.error(`\u8BA2\u9605 ${G.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${An(me)} \u53D1\u751F\u9519\u8BEF: ${Be}`),""}}));if(ge=oe.map(me=>me.result??me),he=oe.map(me=>me.raw??me),Object.keys($e).length>0){let me=`\u8BA2\u9605 ${G.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${V1($e)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;Yu({mode:J,message:me,notify:()=>{R.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${G.name}`,me)}})}G.mergeSources==="localFirst"?(ge.unshift(G.content),he.unshift(G.content)):G.mergeSources==="remoteFirst"&&(ge.push(G.content),he.push(G.content))}let Fe=(Array.isArray(ge)?ge:[ge]).map($e=>Ft.parse($e)).flat();Fe.forEach($e=>{$e._subName=G.name,$e._subDisplayName=G.displayName,$e._collectionName=H.name,$e._collectionDisplayName=H.displayName});let ke=Array.isArray(he)?he:[he];Fe=await Ft.process(Fe,G.process||[],r,{[G.name]:G,_collection:H,$options:v},void 0,ke,{noFlow:j||G.noFlow}),k[W]=Fe,U[W]=ke,O++,R.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${G.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(O/K.length).toFixed(1)}% `)}catch(ge){if(O++,Lo(J)){hl({mode:J,error:ge,notify:he=>{R.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${G.name}`,`\u{1F914} \u539F\u56E0\uFF1A${he.message??he}`)}}),R.error(`\u8BA2\u9605 ${G.name} \u5728\u7EC4\u5408\u8BA2\u9605\u5904\u7406\u4E2D\u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${ge.message??ge}`),k[W]=[],U[W]=[];return}N[W]=ge,U[W]=void 0,R.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${G.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${ge}\uFF01\u8FDB\u5EA6--${100*(O/K.length).toFixed(1)}%`)}})),Object.keys(N).length>0){let W=`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`,G=()=>{R.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,W)};Object.keys(k).length>0&&Lo(x)?(Object.keys(N).forEach(te=>{U[te]=[]}),Uh(x)&&G()):Yu({mode:x,message:W,notify:G})}let L=Array.prototype.concat.apply([],K.map(W=>k[W]||[]));if(L.forEach(W=>{W._collectionName=H.name,W._collectionDisplayName=H.displayName}),L=await Ft.process(L,H.process||[],r,{_collection:H},v,U,{noFlow:j}),L.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let T={};for(let W of L){if(T[W.name]){R.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${W.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}T[W.name]=!0}let M=Ft.produce(L,r,l,f);return S?{result:M,raw:U}:M}catch(k){if(!Lo(x))throw k;hl({mode:x,error:k,notify:O=>{R.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,`\u{1F914} \u539F\u56E0\uFF1A${O.message??O}`)}}),R.error(`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${k.message??k}`);let N=x4({platform:r,produceType:l,produceOpts:f});return S?{result:N,raw:U}:N}}else if(e==="rule"){let C=R.read(Pp),D=Qe(C,t);if(!D)throw new Error(`\u627E\u4E0D\u5230\u89C4\u5219 ${t}`);let H=[];for(let K=0;K<D.urls.length;K++){let _=D.urls[K];R.info(`\u6B63\u5728\u5904\u7406URL\uFF1A${_}\uFF0C\u8FDB\u5EA6--${100*((K+1)/D.urls.length).toFixed(1)}% `);try{let{body:x}=await fn(_),j=Rf.parse(x);H=H.concat(j)}catch(x){R.error(`\u5904\u7406\u5206\u6D41\u8BA2\u9605\u4E2D\u7684URL: ${_}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${x}! \u8BE5\u8BA2\u9605\u5DF2\u88AB\u8DF3\u8FC7\u3002`)}}return H=await Rf.process(H,[{type:"Remove Duplicate Filter"}]),Rf.produce(H,r)}else if(e==="file"){let C=R.read(Lt),D=el(p||Qe(C,t));if(!D)throw new Error(`\u627E\u4E0D\u5230\u6587\u4EF6 ${t}`);let H="";if(bi(D)?H=await k4(D,{url:n,ua:s,content:o,mergeSources:i,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}):H=await oy(D,{url:n,ua:s,content:o,mergeSources:i,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}),l==="raw")return JSON.stringify(iy(H));let K=iy(H),_=UO(K),x=Array.isArray(D.process)&&D.process.length>0?await Ft.process({$files:K,$content:_,$options:v,$file:D},D.process,void 0,void 0,void 0,void 0,{noFlow:w}):{$content:_,$files:K,$options:v};return x.$content=Sh(x?.$content??""),(E?x:x?.$content)??""}}function Rue(e,t){let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Tue(e){return Array.isArray(e)?{isGitLab:!0,files:Object.fromEntries(e.map(t=>[t.path,t]))}:{isGitLab:!1,files:e||{}}}function HO(e){delete e.history,delete e.forks,delete e.owner,e.files&&Object.values(e.files).forEach(t=>{delete t.content}),R.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),R.info(JSON.stringify(e,null,2))}function MO(e,t){let{files:r,isGitLab:n}=Tue(e.files),s=encodeURIComponent(t),o=r[s]?.raw_url,i=n?o:o?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");return R.info(`\u4E0A\u4F20\u914D\u7F6E\u5B8C\u6210
|
||
\u6587\u4EF6\u5217\u8868: ${Object.keys(r).join(", ")}
|
||
\u5F53\u524D\u6587\u4EF6: ${s}
|
||
\u54CD\u5E94\u8FD4\u56DE\u7684\u539F\u59CB\u94FE\u63A5: ${o}
|
||
\u5904\u7406\u5B8C\u7684\u65B0\u94FE\u63A5: ${i}`),i}function P4(e){return e?.upload!==!1}function kue(e){return e?.source?["subscription","sub"].includes(e.type)?Qe(R.read(Gt),e.source):["collection","col"].includes(e.type)?Qe(R.read(zt),e.source):e.type==="file"?Qe(R.read(Lt),e.source):null:null}async function qO(e){let t=e.platform==="SurgeMac",r=await _n({type:e.type,name:e.source,platform:e.platform,produceOpts:{"include-unsupported-proxy":e.includeUnsupportedProxy,useMihomoExternal:t,prettyYaml:e.prettyYaml}});return kf({body:r,configs:[e,kue(e)]})}function Pue(e){e.updated=new Date().getTime(),delete e.url}function OO(e,t){let r=R.read($t),n=Qe(r,e);if(!n)return R.info(`\u8FDC\u7A0B\u914D\u7F6E ${e} \u5DF2\u4E0D\u5B58\u5728, \u8DF3\u8FC7\u540C\u6B65\u7ED3\u679C\u5199\u5165`),null;let s=t({...n});return di(r,e,s),R.write(r,$t),s}async function Oue({allArtifacts:e,files:t,valid:r,invalid:n}){let s=R.read(pt)||{},o=$O(s.artifactSyncBatchSize),i=r.filter(l=>{let f=Qe(e,l);return f&&P4(f)}),a=Rue(i,o),u=[];if(i.length===0)return R.info("\u6CA1\u6709\u9700\u8981\u4E0A\u4F20\u7684\u540C\u6B65\u914D\u7F6E"),u;R.info(`\u51C6\u5907\u5206\u6279\u4E0A\u4F20\u540C\u6B65\u914D\u7F6E: \u5171 ${i.length} \u4E2A, \u6BCF\u6279 ${o} \u4E2A, \u6279\u6B21\u6570 ${a.length}`);for(let l=0;l<a.length;l++){let f=a[l],m=Object.fromEntries(f.map(p=>[encodeURIComponent(p),t[encodeURIComponent(p)]]));try{R.info(`\u6B63\u5728\u4E0A\u4F20\u7B2C ${l+1}/${a.length} \u6279\u540C\u6B65\u914D\u7F6E: ${f.join(", ")}`);let p=await ty(m),d=JSON.parse(p.body);HO(d);for(let v of e)if(v.sync&&v.source&&f.includes(v.name)){let g=MO(d,v.name);g?(v.updated=new Date().getTime(),v.url=g,u.push(v.name)):(R.error(`\u540C\u6B65\u914D\u7F6E ${v.name} \u4E0A\u4F20\u6210\u529F\u4F46\u54CD\u5E94\u4E2D\u672A\u627E\u5230\u6587\u4EF6\u94FE\u63A5`),n.push(v.name))}}catch(p){R.error(`\u7B2C ${l+1}/${a.length} \u6279\u540C\u6B65\u914D\u7F6E\u4E0A\u4F20\u5931\u8D25: ${f.join(", ")}, \u539F\u56E0: ${p.message??p}`),n.push(...f)}}return u}function NO(e,{skipCronArtifacts:t=!1}={}){return e.sync&&e.source&&(!t||lI(e))}async function O4(e={}){R.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");let t=R.read($t),r={};try{let n=[],s=[],o=[],i=R.read(Gt),a=R.read(zt),u=[],l=0;if(t.map(p=>{if(NO(p,e)){if(l++,p.type==="subscription"){let d=p.source,v=Qe(i,d);v&&v.url&&!u.includes(d)&&u.push(d)}else if(p.type==="collection"){let d=Qe(a,p.source);d&&Array.isArray(d.subscriptions)&&d.subscriptions.map(v=>{let g=Qe(i,v);g&&g.url&&!u.includes(v)&&u.push(v)})}}}),l===0){R.info(`\u9700\u540C\u6B65\u7684\u914D\u7F6E: ${l}, \u603B\u6570: ${t.length}`);return}u.length>0&&await Promise.all(u.map(async p=>{try{await _n({type:"subscription",name:p,awaitCustomCache:!0})}catch{}})),await Promise.all(t.map(async p=>{try{if(NO(p,e)){R.info(`\u6B63\u5728\u540C\u6B65\u4E91\u914D\u7F6E\uFF1A${nu(p)}...`),p.platform==="SurgeMac"&&R.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 mihomo External");let v=await qO(p);P4(p)?(r[encodeURIComponent(p.name)]={content:v},n.push(p.name)):(Pue(p),o.push(p.name))}}catch(d){R.error(`\u751F\u6210\u540C\u6B65\u914D\u7F6E ${nu(p)} \u53D1\u751F\u9519\u8BEF: ${d.message??d}`),s.push(p.name)}}));let f=n.length+o.length;if(R.info(`${f} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u6210\u529F: ${n.concat(o).join(", ")}`),R.info(`${s.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u5931\u8D25: ${s.join(", ")}`),o.length>0&&R.info(`${o.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u4EC5\u751F\u6210\u672A\u4E0A\u4F20: ${o.join(", ")}`),f===0)throw new Error(`\u540C\u6B65\u914D\u7F6E ${s.join(", ")} \u751F\u6210\u5931\u8D25 \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`);let m=await Oue({allArtifacts:t,files:r,valid:n,invalid:s});if(R.write(t,$t),R.info("\u540C\u6B65\u914D\u7F6E\u6267\u884C\u5B8C\u6210"),s.length>0)throw new Error(`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${m.length+o.length} \u4E2A, \u5931\u8D25 ${s.length} \u4E2A, \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`);R.info(`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${m.length+o.length} \u4E2A`)}catch(n){throw R.error(`\u540C\u6B65\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${n.message??n}`),n}}async function Nue(e,t){R.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");try{await O4(),Le(t)}catch(r){R.error(`\u540C\u6B65\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),Re(t,new Jt("FAILED_TO_SYNC_ARTIFACTS","Failed to sync all artifacts",`Reason: ${r.message??r}`))}}async function N4(e){let t=R.read($t),r=Qe(t,e);if(!r)throw R.error(`\u627E\u4E0D\u5230\u8FDC\u7A0B\u914D\u7F6E ${e}`),new vt("RESOURCE_NOT_FOUND",`\u627E\u4E0D\u5230\u8FDC\u7A0B\u914D\u7F6E ${e}`);if(!r.source)throw R.error(`\u8FDC\u7A0B\u914D\u7F6E ${nu(r)} \u672A\u8BBE\u7F6E\u6765\u6E90`),new vt("RESOURCE_HAS_NO_SOURCE",`\u8FDC\u7A0B\u914D\u7F6E ${nu(r)} \u672A\u8BBE\u7F6E\u6765\u6E90`);R.info(`\u5F00\u59CB\u540C\u6B65\u8FDC\u7A0B\u914D\u7F6E ${nu(r)}...`),r.platform==="SurgeMac"&&R.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 mihomo External");let s=await qO(r);if(!P4(r)){R.info(`\u914D\u7F6E ${nu(r)} \u5DF2\u5173\u95ED\u4E0A\u4F20, \u4EC5\u66F4\u65B0\u6267\u884C\u65F6\u95F4`);let f=new Date().getTime(),m=OO(e,d=>(d.updated=f,delete d.url,d));if(m)return m;let p={...r,updated:f};return delete p.url,p}R.info(`\u6B63\u5728\u4E0A\u4F20\u914D\u7F6E\uFF1A${nu(r)}
|
||
>>>${JSON.stringify(r,null,2)}`);let o=await ty({[encodeURIComponent(r.name)]:{content:s}}),i=new Date().getTime(),a=JSON.parse(o.body);HO(a);let u=MO(a,r.name);return OO(e,f=>({...f,updated:i,url:u}))||{...r,updated:i,url:u}}async function Lue(e,t){let{name:r}=e.params;try{let n=await N4(r);Le(t,n)}catch(n){R.error(`\u8FDC\u7A0B\u914D\u7F6E ${r} \u53D1\u751F\u9519\u8BEF: ${n.message??n}`),Re(t,n instanceof vt?n:new Jt("FAILED_TO_SYNC_ARTIFACT",`Failed to sync artifact ${r}`,`Reason: ${n}`),n instanceof vt?404:void 0)}}var O8e,Fue,Bue,Iue,Lu=re(()=>{O8e=F(I());gt();dr();vn();wn();jg();hi();Nh();tl();C4();ry();R4();_h();sy();us();b1();Fue=["localFirst","remoteFirst"],Bue=["local","remote"],Iue=["collection","local","none","remote","subscription"]});function L4(){return Us(()=>Yo("stream/promises"))}var U8e,jO=re(()=>{U8e=F(I());hc()});function Uue(e=""){let t=`${e}`.trim();return t?new RegExp(t,"i"):null}function Hue(e,t,r){if(!t||!r||typeof e!="string"||!/^https?:\/\//i.test(e))return e;let n=`${t}/`;if(e.startsWith(n))return e;let s;try{s=Uue(r)}catch(o){return R.error(`GitHub \u52A0\u901F\u4EE3\u7406\u5339\u914D\u6B63\u5219\u65E0\u6548: ${o.message??o}`),e}return s?.test(e)?(R.info(`GitHub \u52A0\u901F\u4EE3\u7406\u547D\u4E2D\u4E0B\u8F7D\u94FE\u63A5: ${e}`),`${t}/${e}`):e}function Mue(e){return An(e)}async function Hh(e,{ageSecretKey:t,preprocess:r,url:n}){let s=t?await vh(e,t):e,o=s;if(r)try{let i=KO.test(s);i&&(s=KO.parse(s,!0,i))}catch(i){R.error(`Clash Pre-processor error: ${i}`)}if(r)try{let i=Ft.parse(s);if(!Array.isArray(i)||i.length===0)return{result:s,raw:o,shouldCache:!1,cacheReason:`URL ${n} \u4E0D\u5305\u542B\u6709\u6548\u8282\u70B9, \u4E0D\u7F13\u5B58`}}catch(i){return{result:s,raw:o,shouldCache:!1,cacheReason:`URL ${n} \u5C1D\u8BD5\u89E3\u6790\u8282\u70B9\u5931\u8D25 ${i.message??i}, \u4E0D\u7F13\u5B58`}}return{result:s,raw:o,shouldCache:!0}}function G1(e,t){return t?{result:e.result,raw:e.raw}:e.result}function H4(e,t){return t?{result:e,raw:e}:e}async function fn(rawUrl="",ua,timeout,customProxy,skipCustomCache,awaitCustomCache,noCache,preprocess,options={}){let $arguments={},url=rawUrl.replace(/#noFlow$/,""),rawArgs=url.split("#");if(url=url.split("#")[0],rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}let explicitAgeSecretKey=options&&typeof options=="object"?options?.[un]||options?.ageSecretKey:void 0,returnRaw=options&&typeof options=="object"&&options.returnRaw,ageSecretKey=explicitAgeSecretKey||$arguments?.[un],{isNode,isStash,isLoon,isShadowRocket,isQX}=hr(),{githubProxy,githubProxyRegex,defaultProxy,defaultUserAgent,defaultTimeout,cacheThreshold:defaultCacheThreshold}=R.read(pt)||{},cacheThreshold=defaultCacheThreshold||1024,proxy=customProxy||defaultProxy;R.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultUserAgent||"clash.meta/v1.19.34",customHeaders;if($arguments?.headers)try{let e=JSON.parse($arguments?.headers);if(e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0){let t={"user-agent":userAgent};for(let r in e)t[r.toLowerCase()]=e[r];customHeaders=t}}catch(e){R.error(`\u89E3\u6790\u81EA\u5B9A\u4E49 headers \u5931\u8D25: ${e}`)}let requestTimeout=timeout||defaultTimeout||8e3;url=Hue(url,githubProxy,githubProxyRegex);let safeUrl=Mue(url),id=Lr(`${customHeaders?JSON.stringify(customHeaders):userAgent}${url}`);$arguments?.cacheKey===!0&&(R.error("\u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58\u65F6 cacheKey \u7684\u503C\u4E0D\u80FD\u4E3A\u7A7A"),$arguments.cacheKey=void 0);let customCacheKey=$arguments?.cacheKey?`#sub-store-cached-custom-${$arguments?.cacheKey}`:void 0;if(customCacheKey&&!skipCustomCache){let e=R.read(customCacheKey),t=Hr.get(id);if(!noCache&&!$arguments?.noCache&&t)return R.info(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl}
|
||
\u5B58\u5728\u6709\u6548\u7684\u5E38\u89C4\u7F13\u5B58
|
||
\u4F7F\u7528\u5E38\u89C4\u7F13\u5B58\u4EE5\u907F\u514D\u91CD\u590D\u8BF7\u6C42`),G1(await Hh(t,{ageSecretKey,preprocess,url:safeUrl}),returnRaw);if(e){if(awaitCustomCache){R.info(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl}
|
||
\u672C\u6B21\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u66F4\u65B0\u7F13\u5B58`);try{await fn(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess,options)}catch(r){R.error(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl} \u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`),R.info("\u4F7F\u7528\u4E50\u89C2\u7F13\u5B58\u7684\u6570\u636E\u5237\u65B0\u7F13\u5B58, \u9632\u6B62\u540E\u7EED\u8BF7\u6C42"),Hr.set(id,e)}}else R.info(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl}
|
||
\u672C\u6B21\u8FD4\u56DE\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}
|
||
\u5E76\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u5F02\u6B65\u66F4\u65B0\u7F13\u5B58`),fn(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess,options).catch(r=>{R.error(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl} \u5F02\u6B65\u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`)});return G1(await Hh(e,{ageSecretKey,preprocess,url:safeUrl}),returnRaw)}}let downloadUrlMatch=url.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(downloadUrlMatch){let e="";try{e=downloadUrlMatch?.[1];let t=downloadUrlMatch?.[2];if(t==null)throw new Error(`\u672C\u5730 ${e} URL \u65E0\u6548: ${url}`);t=decodeURIComponent(t);let r=e==="module"?zn:Lt,n=Qe(R.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return H4(e==="module"?n.content:await _n({type:"file",name:t,noFlow:options?.noFlow}),returnRaw)}catch(t){throw R.error(`Error when loading ${e}: ${url.split("#")[0]}.
|
||
Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let e=Pi();return H4(e.readFileSync(url.split("#")[0],"utf8"),returnRaw)}catch(e){throw R.error(`Error when reading local file: ${url.split("#")[0]}.
|
||
Reason: ${e}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u6587\u672C\u5185\u5BB9: ${url}`)}if(!isNode&&U4.has(id))return G1(await Hh(await U4.get(id),{ageSecretKey,preprocess,url:safeUrl}),returnRaw);let http=Oi({headers:{...customHeaders||{"User-Agent":userAgent},...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,rawResult,cached=Hr.get(id);if(!noCache&&!$arguments?.noCache&&cached)R.info(`\u4F7F\u7528\u7F13\u5B58: ${safeUrl}, ${customHeaders?JSON.stringify(customHeaders):userAgent}`),rawResult=cached,result=await Hh(cached,{ageSecretKey,preprocess,url:safeUrl}),customCacheKey&&(R.info(`URL ${safeUrl}
|
||
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),R.write(cached,customCacheKey));else{let e=$arguments?.insecure?isNode?{strictSSL:!1}:{insecure:!0}:void 0;R.info(`Downloading...
|
||
${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent}`}
|
||
Timeout: ${requestTimeout}
|
||
Proxy: ${proxy}
|
||
Insecure: ${!!e}
|
||
Preprocess: ${preprocess}
|
||
URL: ${safeUrl}`);try{let{body:t,headers:r,statusCode:n}=await hd(()=>http.get({url,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?tu(proxy):{},...e||{}}),"download");if(R.info(`statusCode: ${n}`),n<200||n>=400)throw new Error(`statusCode: ${n}`);if(r){let o=Ll(r);o&&Nl.set(id,o,$arguments?.headersCacheTtl?$arguments?.headersCacheTtl*1e3:void 0)}if(t.replace(/\s/g,"").length===0)throw new Error(new Error("\u8FDC\u7A0B\u8D44\u6E90\u5185\u5BB9\u4E3A\u7A7A"));result=await Hh(t,{ageSecretKey,preprocess,url:safeUrl});let s=!0;if(cacheThreshold){let o=t.length/1024;o>cacheThreshold&&(R.info(`\u8D44\u6E90\u5927\u5C0F ${o.toFixed(2)} KB \u8D85\u8FC7\u4E86 ${cacheThreshold} KB, \u4E0D\u7F13\u5B58`),s=!1)}result.shouldCache||(R.error(result.cacheReason),s=!1),s&&(Hr.set(id,t,$arguments?.cacheTtl?$arguments?.cacheTtl*1e3:void 0),customCacheKey&&(R.info(`URL ${safeUrl}
|
||
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),R.write(t,customCacheKey))),rawResult=t}catch(t){if(customCacheKey){let n=R.read(customCacheKey);if(n)return R.info(`\u65E0\u6CD5\u4E0B\u8F7D URL ${safeUrl}: ${t.message??t}
|
||
\u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),G1(await Hh(n,{ageSecretKey,preprocess,url:safeUrl}),returnRaw)}let r=`\u65E0\u6CD5\u4E0B\u8F7D URL ${safeUrl}: ${t.message??t}`;throw R.error(r),new Error(r)}}return $arguments?.validCheck&&!$arguments?.noFlow&&!options?.noFlow&&await Hg(ru(await es(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl,$arguments.flowHeaders))),isNode||U4.set(id,rawResult),G1(result,returnRaw)}async function q1(url,file){let undici=require('undici'),fs=Pi(),{pipeline}=L4(),{Agent,interceptors,request}=undici;R.info(`Downloading file...
|
||
URL: ${url}
|
||
File: ${file}`);let{body,statusCode}=await request(url,{dispatcher:new Agent().compose(interceptors.redirect({maxRedirections:3,throwOnMaxRedirect:!0}))});if(statusCode!==200)throw new Error(`Failed to download file from ${url}`);let fileStream=fs.createWriteStream(file);return await pipeline(body,fileStream),R.info(`File downloaded from ${url} to ${file}`),file}var nDe,KO,U4,Nh=re(()=>{nDe=F(I());dr();li();fd();Ir();Og();Ng();pd();gt();hi();Lu();_h();tl();Ug();od();jO();us();KO=vw.find(e=>e.name==="Clash Pre-processor"),U4=new Map});function VO(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function GO(e,t){return Object.prototype.hasOwnProperty.call(e||{},t)}function jue(e,t={}){return t.gistUpload==="age"||e?.gistUpload==="age"&&GO(t,un)}async function Kue(e){if(await jT(e),!e[un])throw new Pe("INVALID_GIST_AGE_KEYS","age \u52A0\u5BC6\u6A21\u5F0F\u9700\u8981\u914D\u7F6E age-secret-key")}function Vue(e={}){return que.some(t=>Object.prototype.hasOwnProperty.call(e,t))}function M4(e){R.read(pt)||R.write({},pt),e.route("/api/settings").get(Gue).patch(zue)}async function Gue(e,t){try{let r=R.read(pt);r||(r={},R.write(r,pt)),r.artifactStore||await ay(),Le(t,r)}catch(r){R.error(`Failed to get settings: ${r.message??r}`),Re(t,new Jt("FAILED_TO_GET_SETTINGS","Failed to get settings",`Reason: ${r.message??r}`))}}async function zue(e,t){try{let r=R.read(pt)||{},n={...r,...e.body};for(let s of["githubUser","gistToken"])typeof n[s]=="string"&&(n[s]=n[s].trim());if(VO(e.body?.appearanceSetting)&&(n.appearanceSetting={...VO(r?.appearanceSetting)?r.appearanceSetting:{},...e.body.appearanceSetting}),["defaultTimeout","githubApiTimeout","artifactSyncBatchSize","cacheThreshold","resourceCacheTtl","headersCacheTtl","scriptCacheTtl"].map(s=>{let o=Number(n[s]);(!isFinite(o)||o<=0)&&delete n[s]}),"logsMaxCount"in n){let s=n.logsMaxCount,o=Number(s);(s==null||s===""||!isFinite(o)||o<0)&&delete n.logsMaxCount}if(jp in n){let s=n[jp],o=Number(s);(s==null||s===""||!Number.isInteger(o)||o<1)&&delete n[jp]}if(Kp in n){let s=n[Kp],o=Number(s);(s==null||s===""||!Number.isInteger(o)||o<0)&&delete n[Kp]}if(jue(n,e.body)&&await Kue(n),GO(e.body,"gistDownloadTokenStrategy")&&!zF.includes(e.body.gistDownloadTokenStrategy))throw new Pe("INVALID_GIST_DOWNLOAD_TOKEN_STRATEGY","Token \u5904\u7406\u65B9\u5F0F\u4EC5\u652F\u6301 ask\u3001overwrite \u6216 keep");R.write(n,pt),uB(),Vue(e.body)&&await ay(),Le(t,n)}catch(r){R.error(`Failed to update settings: ${r.message??r}`),Re(t,r instanceof Pe?r:new Jt("FAILED_TO_UPDATE_SETTINGS","Failed to update settings",`Reason: ${r.message??r}`))}}async function ay(){R.log("Updating artifact store");let e=R.read(pt)||{},{gistToken:t,syncPlatform:r}=e;if(t){let n=new Qi({token:t,key:Il,syncPlatform:r});try{let s=await n.locate(),o=s?.html_url??s?.web_url;o?(R.log(`\u627E\u5230 Sub-Store Gist: ${o}`),e.artifactStore=o,e.artifactStoreStatus="VALID"):(R.error(`\u627E\u4E0D\u5230 Sub-Store Gist (${Il})`),e.artifactStoreStatus="NOT FOUND")}catch(s){R.error(`\u67E5\u627E Sub-Store Gist (${Il}) \u65F6\u53D1\u751F\u9519\u8BEF: ${s.message??s}`),e.artifactStoreStatus="ERROR"}R.write(e,pt)}}var hDe,que,q4=re(()=>{hDe=F(I());dr();vn();wn();gt();M1();vg();Ug();us();que=["gistToken","githubProxy","githubApiUrl","defaultProxy"]});function z4(e){e.get("/api/utils/env",YO),e.get("/api/utils/backup",Zue),e.get("/api/utils/refresh",Yue),e.route("/api/storage").get((t,r)=>{r.set("content-type","application/json").set("access-control-expose-headers","content-disposition").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_data_${yc(new Date)}.json`)}"`).send(R.env.isNode?JSON.stringify(R.cache):R.read("#sub-store"))}).post((t,r)=>{try{let{content:n}=t.body;try{if(n=JSON.parse(mt.decode(n)),!(Object.keys(n.settings).length>=0))throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch{try{if(n=JSON.parse(n),!(Object.keys(n.settings).length>=0))throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(o){throw R.error(`\u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F
|
||
Reason: ${o.message??o}`),new Error("\u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F")}}R.write(JSON.stringify(n,null," "),"#sub-store"),R.env.isNode&&(R.cache=n,R.persistCache()),vc(),Le(r)}catch(n){R.error(`Failed to restore backup data.
|
||
Reason: ${n.message??n}`),Re(r,new Pe("INVALID_BACKUP_DATA","Invalid backup data, failed to restore!",`Reason: ${n.message??n}`))}}),hr().isNode?e.get("/",YO):e.get("/",async(t,r)=>{r.set("location",`${G4}/`).status(302).end()}),hr().isQX&&e.options("/",async(t,r)=>{r.status(200).end()}),e.all("/",(t,r)=>{r.send("Hello from sub-store, made with \u2764\uFE0F by Peng-YM")})}function YO(e,t){xa.feature=xa.feature||{},xa.feature.archive=!0,(hr().isSubsCheckPro||e.query.share)&&(xa.feature.share=!0),t.set("Content-Type","application/json;charset=UTF-8").send(JSON.stringify({status:"success",data:{guide:`\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F \u60A8\u5F53\u524D\u770B\u5230\u7684\u662F\u540E\u7AEF\u7684\u54CD\u5E94. \u82E5\u60F3\u914D\u5408\u524D\u7AEF\u4F7F\u7528, \u53EF\u8BBF\u95EE\u5B98\u65B9\u524D\u7AEF ${G4} \u540E\u81EA\u884C\u914D\u7F6E\u540E\u7AEF\u5730\u5740, \u6216\u4E00\u952E\u914D\u7F6E\u540E\u7AEF ${G4}?api=https://a.com/xxx (\u5047\u8BBE https://a.com \u662F\u4F60\u540E\u7AEF\u7684\u57DF\u540D, /xxx \u662F\u81EA\u5B9A\u4E49\u8DEF\u5F84). \u9700\u6CE8\u610F HTTPS \u524D\u7AEF\u65E0\u6CD5\u8BF7\u6C42\u975E\u672C\u5730\u7684 HTTP \u540E\u7AEF(\u90E8\u5206\u6D4F\u89C8\u5668\u4E0A\u4E5F\u65E0\u6CD5\u8BBF\u95EE\u672C\u5730 HTTP \u540E\u7AEF). \u8BF7\u914D\u7F6E\u53CD\u4EE3\u6216\u5728\u5C40\u57DF\u7F51\u81EA\u5EFA HTTP \u524D\u7AEF. \u5982\u679C\u8FD8\u6709\u95EE\u9898, \u53EF\u67E5\u770B\u6B64\u6392\u67E5\u8BF4\u660E: https://telegram.me/zhetengsha/1068`,...xa}},null,2))}async function Yue(e,t){await ay(),Hr.revokeAll(),v1.revokeAll(),Nl.revokeAll(),Le(t)}function j4(){let e=R.read("#sub-store");return e=e?JSON.parse(e):{},R.env.isNode&&(e=JSON.parse(JSON.stringify(R.cache))),e}function WO(e,t,r={}){let n=JSON.parse(JSON.stringify(e||{}));return!r.keepAgeSecretKey&&n.settings?.[un]&&delete n.settings[un],t==="plaintext"?(n.settings=n.settings||{},n.settings.gistToken="\u6062\u590D\u540E\u8BF7\u91CD\u65B0\u8BBE\u7F6E GitHub Token",JSON.stringify(n,null," ")):mt.encode(JSON.stringify(n,null," "))}function Wue(e){return["base64","plaintext","age"].includes(e)?e:"base64"}function XO(e){return e==="plaintext"?"plaintext":"base64"}function Mh(e){return e==="age"}async function Xue(e,t,r){if(!Mh(r))return e;let n=t?.[un];if(!n)throw new Error("age \u52A0\u5BC6\u6A21\u5F0F\u9700\u8981\u914D\u7F6E age \u89E3\u5BC6\u79C1\u94A5");return R.info("\u4F7F\u7528 age \u52A0\u5BC6 Gist \u5907\u4EFD\u5185\u5BB9"),gh(e,await yf(n))}async function K4(e,t,r){if(!Mh(r))return e;let n=t?.[un];if(!n)throw new Error("age \u52A0\u5BC6\u6A21\u5F0F\u9700\u8981\u914D\u7F6E age \u89E3\u5BC6\u79C1\u94A5");return R.info("\u5C1D\u8BD5\u4F7F\u7528 age \u89E3\u5BC6 Gist \u5907\u4EFD\u5185\u5BB9"),vh(e,n)}function Jue(e,t,r){if(t!==void 0){if(t!=="overwrite"&&t!=="keep")throw new Pe("INVALID_GIST_DOWNLOAD_TOKEN_STRATEGY","Token \u5904\u7406\u65B9\u5F0F\u4EC5\u652F\u6301 overwrite \u6216 keep");return t}return r!==void 0?String(r).split(",").includes(V4)?"keep":"overwrite":e==="keep"?"keep":"overwrite"}async function uy(e,{keep:t,encode:r,tokenStrategy:n}={}){let s=R.read(pt)||{},{gistToken:o,syncPlatform:i}=s;if(!o)throw new Error("GitHub Token is required for backup!");let a=new Qi({token:o,key:GF,syncPlatform:i}),u=j4(),l,f=s.syncTime,m=Wue(r||s.gistUpload||"base64"),p=e==="download"?Jue(s.gistDownloadTokenStrategy,n,t):void 0;switch(R.info(`Gist backup action: ${e}, keep: ${t}, token strategy: ${n}, settings token strategy: ${s.gistDownloadTokenStrategy}, final token strategy: ${p}, encode: ${r}, settings encode: ${s.gistUpload}, final encoding: ${m}`),e){case"upload":{let d;try{let g=Mh(m);d=WO(j4(),XO(m),{keepAgeSecretKey:g}),R.info("\u4E0B\u8F7D\u5907\u4EFD, \u4E0E\u672C\u5730\u5185\u5BB9\u5BF9\u6BD4...");let y=await a.download(Op),w=await K4(y,s,m);if((!Mh(m)||uw(y))&&w===d){R.info("\u5185\u5BB9\u4E00\u81F4, \u65E0\u9700\u4E0A\u4F20\u5907\u4EFD");return}}catch(g){R.error(`${g.message??g}`)}s.syncTime=new Date().getTime(),R.write(s,pt),d=WO(j4(),XO(m),{keepAgeSecretKey:Mh(m)});let v=await Xue(d,s,m);R.info("\u4E0A\u4F20\u5907\u4EFD\u4E2D..."),await R.wait(100);try{await a.upload({[Op]:{content:v}}),R.info("\u4E0A\u4F20\u5907\u4EFD\u5B8C\u6210")}catch(g){R.error(`\u4E0A\u4F20\u8BF7\u6C42\u5F02\u5E38: ${g?.message??g}`);try{R.info("\u91CD\u65B0\u83B7\u53D6\u5907\u4EFD, \u786E\u8BA4\u4E0A\u4F20\u7ED3\u679C..."),await R.wait(500);let y=await a.download(Op),w=await K4(y,s,m);if((!Mh(m)||uw(y))&&w===d){R.info("\u7EBF\u4E0A\u5185\u5BB9\u4E0E\u672C\u6B21\u4E0A\u4F20\u5185\u5BB9\u4E00\u81F4, \u4E0A\u4F20\u5B9E\u9645\u5DF2\u6210\u529F");break}R.error("\u7EBF\u4E0A\u5185\u5BB9\u4E0E\u672C\u6B21\u4E0A\u4F20\u5185\u5BB9\u4E0D\u4E00\u81F4, \u4E0A\u4F20\u786E\u8BA4\u5931\u8D25")}catch(y){R.error(`\u4E0A\u4F20\u7ED3\u679C\u786E\u8BA4\u5931\u8D25: ${y?.message??y}`)}throw s.syncTime=f,R.write(s,pt),g}break}case"download":{R.info("\u8FD8\u539F\u5907\u4EFD\u4E2D..."),l=await a.download(Op),l=await K4(l,s,m);try{if(l=JSON.parse(mt.decode(l)),!(Object.keys(l.settings).length>=0))throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch{try{if(l=JSON.parse(l),!(Object.keys(l.settings).length>=0))throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(y){throw R.error(`Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F
|
||
Reason: ${y.message??y}`),new Error("Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F")}}let d=t?String(t).split(",").map(g=>g.trim()).filter(Boolean):[],v=d.indexOf(V4);p==="keep"&&v===-1?d.push(V4):p==="overwrite"&&v!==-1&&d.splice(v,1),d.includes(zO)||d.push(zO),R.info(`\u4FDD\u7559\u539F\u6709\u8BBE\u7F6E ${d}`),d.forEach(g=>{z1.default.has(u,g)?z1.default.set(l,g,z1.default.get(u,g)):z1.default.unset(l,g)}),R.write(JSON.stringify(l,null," "),"#sub-store"),R.env.isNode&&(R.cache=l,R.persistCache()),R.info("perform migration after restoring from gist..."),vc(),R.info("migration completed"),R.info("\u8FD8\u539F\u5907\u4EFD\u5B8C\u6210");break}}}async function Zue(e,t){let{action:r,keep:n,encode:s,tokenStrategy:o}=e.query,{gistToken:i}=R.read(pt)||{};if(!i)Re(t,new Pe("GIST_TOKEN_NOT_FOUND","GitHub Token is required for backup!"));else try{await uy(r,{keep:n,encode:s,tokenStrategy:o}),Le(t)}catch(a){R.error(`Failed to ${r} gist data.
|
||
Reason: ${a.message??a}`),Re(t,a instanceof Pe?a:new Jt("BACKUP_FAILED",`Failed to ${r} gist data!`,`Reason: ${a.message??a}`))}}var $De,z1,V4,zO,G4,Y4=re(()=>{$De=F(I());Xo();z1=F(ho());gt();li();vn();q4();Og();k6();Ng();dr();wn();M1();Ag();Q6();Ir();us();V4="settings.gistToken",zO="settings.gistDownloadTokenStrategy",G4="https://sub.xream.eu.org"});function ece(e){return Que.test(e)}function W4(root,fallbackPath){let express=require("express"),mime=require("mime-types"),staticFiles=express.static(root,{setHeaders(e,t){let r=t.endsWith(".gz"),n=r?t.slice(0,-3):t,s=mime.contentType(mime.lookup(n));s&&e.setHeader("Content-Type",s),r&&e.setHeader("Content-Encoding","gzip"),e.vary("Accept-Encoding"),e.setHeader("Cache-Control",ece(n)?"public, max-age=31536000, immutable":"public, max-age=0")}});function serveFile(e,t,r){if(e.acceptsEncodings(["gzip","identity"])!=="gzip"){staticFiles(e,t,r);return}let n=e.url;e.url=tce(n),staticFiles(e,t,s=>{e.url=n,s?r(s):staticFiles(e,t,r)}),e.url=n}return fallbackPath?(e,t,r)=>{let n=e.url;serveFile(e,t,s=>{if(s){r(s);return}e.url=fallbackPath,serveFile(e,t,o=>{e.url=n,r(o)}),e.url=n})}:serveFile}function tce(e){let t=e.indexOf("?");return t===-1?`${e}.gz`:`${e.slice(0,t)}.gz${e.slice(t)}`}var TDe,xDe,Que,JO=re(()=>{TDe=F(I()),xDe=".gz",Que=/-[0-9a-f]{8}\.[^/\\]+$/i});function ZO(e){if(!(!e||typeof e!="object"))for(let t of nce)rce.has(e[t])||delete e[t]}function eo(e){ZO(e),Array.isArray(e?.process)&&e.process.forEach(t=>{ZO(t?.args)})}var PDe,rce,nce,cy=re(()=>{PDe=F(I()),rce=new Set(["javascript","json","json5","yaml","ini","plaintext"]),nce=["editorLanguage","previewLanguage"]});function X4(e){e.get("/api/sub/flow/:name",sce),e.route("/api/sub/:name").get(oce).patch(ace).delete(uce),e.route("/api/subs").get(cce).post(ice).put(lce)}async function sce(e,t){let{name:r}=e.params,{url:n}=e.query;n&&R.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 URL: ${An(n)}`);let s=R.read(Gt),o=Qe(s,r);if(!o){Re(t,new vt("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404);return}if(e.query.noFlow||o.noFlow){Re(t,new Pe("NO_FLOW_INFO","N/A",`Subscription ${r}: noFlow`),400);return}if(o.source==="local"&&!["localFirst","remoteFirst"].includes(o.mergeSources)){if(o.subUserinfo){let i;if(/^https?:\/\//.test(o.subUserinfo))try{i=await es(void 0,void 0,void 0,o.proxy,o.subUserinfo)}catch(a){R.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${o.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(a)}`)}else i=o.subUserinfo;try{Le(t,{...ru(i)})}catch(a){R.error(`Failed to parse flow info for local subscription ${r}: ${a.message??a}`),Re(t,new Pe("NO_FLOW_INFO","N/A","Failed to parse flow info"))}}else Re(t,new Pe("NO_FLOW_INFO","N/A",`Local subscription ${r} has no flow information!`));return}try{n=`${n||o.url}`.split(/[\r\n]+/).map(l=>l.trim()).filter(l=>l.length)?.[0]||"";let i={},a=n.split("#");if(n=n.split("#")[0],a.length>1)try{i=JSON.parse(decodeURIComponent(a[1]))}catch{for(let f of a[1].split("&")){let m=f.split("=")[0],p=f.split("=")[1];i[m]=p==null||p===""?!0:decodeURIComponent(p)}}if(i.noFlow||!/^https?/.test(n)){Re(t,new Pe("NO_FLOW_INFO","N/A",`Subscription ${r}: noFlow`));return}let u=await es(i?.insecure?`${n}#insecure`:n,i.flowUserAgent,void 0,o.proxy,i.flowUrl,i.flowHeaders);if(!u&&!o.subUserinfo){Re(t,new Jt("NO_FLOW_INFO","No flow info","Failed to fetch flow headers"));return}try{let l=Mg({resetDay:i.resetDay,startDate:i.startDate,cycleDays:i.cycleDays}),f;if(/^https?:\/\//.test(o.subUserinfo))try{f=await es(void 0,void 0,void 0,o.proxy,o.subUserinfo)}catch(p){R.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${o.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(p)}`)}else f=o.subUserinfo;let m={...ru([f,u].filter(p=>p).join("; "))};l!=null&&(m.remainingDays=l),Le(t,m)}catch(l){R.error(`Failed to parse flow info for local subscription ${r}: ${l.message??l}`),Re(t,new Pe("NO_FLOW_INFO","N/A","Failed to parse flow info"))}}catch{Re(t,new gd("URL_NOT_ACCESSIBLE",`The URL for subscription ${r} is inaccessible.`))}}function ice(e,t){try{let r=J4(e.body);Le(t,r,201)}catch(r){Re(t,r)}}function oce(e,t){let{name:r}=e.params,{raw:n}=e.query,s=R.read(Gt),o=Qe(s,r);delete o.subscriptions,o?n?t.set("content-type","application/json").set("access-control-expose-headers","content-disposition").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_subscription_${r}_${yc(new Date)}.json`)}"`).send(JSON.stringify(o)):Le(t,o):Re(t,new vt("SUBSCRIPTION_NOT_FOUND",`Subscription ${r} does not exist`,404))}function ace(e,t){let{name:r}=e.params,n=e.body;delete n.subscriptions;let s=R.read(Gt),o=Qe(s,r);if(o){n.name||(n.name=o.name);let i={...o,...n};if(bn(i),eo(i),R.info(`\u6B63\u5728\u66F4\u65B0\u8BA2\u9605\uFF1A ${r}`),r!==n.name){let a=R.read(zt)||[];for(let f of a){let m=f.subscriptions.indexOf(r);m!==-1&&(f.subscriptions[m]=n.name)}let u=R.read($t)||[];for(let f of u)f.type==="subscription"&&f.source==r&&(f.source=n.name);let l=R.read(Lt)||[];for(let f of l)f.sourceType==="subscription"&&f.sourceName==r&&(f.sourceName=n.name);R.write(a,zt),R.write(u,$t),R.write(l,Lt)}di(s,r,i),R.write(s,Gt),Le(t,i)}else Re(t,new vt("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404)}function uce(e,t){try{let{name:r}=e.params;R.info(`\u5220\u9664\u8BA2\u9605\uFF1A${r}...`),dce(e.query.mode)&&_O(r),fce(r),Le(t)}catch(r){Re(t,r)}}function cce(e,t){let r=R.read(Gt);Le(t,r)}function lce(e,t){try{let r=e.body;r.forEach(n=>{bn(n),eo(n)}),R.write(r,Gt),Le(t)}catch(r){Re(t,r)}}function J4(e){let t={...e};if(bn(t),eo(t),delete t.subscriptions,R.info(`\u6B63\u5728\u521B\u5EFA\u8BA2\u9605\uFF1A ${t.name}`),/\//.test(t.name))throw new Pe("INVALID_NAME",`Subscription ${t.name} is invalid`);let r=R.read(Gt);if(Qe(r,t.name))throw new Pe("DUPLICATE_KEY",`Subscription ${t.name} already exists.`);return sa(r,t,Oa()),R.write(r,Gt),t}function fce(e){let t=R.read(Gt),r=Qe(t,e);if(!r)throw new vt("RESOURCE_NOT_FOUND",`Subscription ${e} does not exist!`);na(t,e),R.write(t,Gt);let n=R.read(zt)||[];for(let s of n)s.subscriptions=s.subscriptions.filter(o=>o!==e);return R.write(n,zt),r}function dce(e){if(e==null||e===""||e==="permanent")return!1;if(e==="archive")return!0;throw new Pe("INVALID_DELETE_MODE",`Unsupported delete mode: ${e}`)}var YDe,Z4=re(()=>{YDe=F(I());wn();hi();Lh();dr();pd();fl();vn();gt();Ir();us();cy();R.read(Gt)||R.write({},Gt)});function Q4(e){R.read(zt)||R.write({},zt),e.route("/api/collection/:name").get(pce).patch(mce).delete(gce),e.route("/api/collections").get(vce).post(hce).put(wce)}function hce(e,t){try{let r=e5(e.body);Le(t,r,201)}catch(r){Re(t,r)}}function pce(e,t){let{name:r}=e.params,{raw:n}=e.query,s=R.read(zt),o=Qe(s,r);o?n?t.set("content-type","application/json").set("access-control-expose-headers","content-disposition").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_collection_${r}_${yc(new Date)}.json`)}"`).send(JSON.stringify(o)):Le(t,o):Re(t,new vt("SUBSCRIPTION_NOT_FOUND",`Collection ${r} does not exist`,404))}function mce(e,t){let{name:r}=e.params,n=e.body,s=R.read(zt),o=Qe(s,r);if(o){n.name||(n.name=o.name);let i={...o,...n};if(bn(i),eo(i),R.info(`\u6B63\u5728\u66F4\u65B0\u7EC4\u5408\u8BA2\u9605\uFF1A${r}...`),r!==i.name){let a=R.read($t)||[];for(let l of a)l.type==="collection"&&l.source===o.name&&(l.source=i.name);let u=R.read(Lt)||[];for(let l of u)l.sourceType==="collection"&&l.sourceName===o.name&&(l.sourceName=i.name);R.write(a,$t),R.write(u,Lt)}di(s,r,i),R.write(s,zt),Le(t,i)}else Re(t,new vt("RESOURCE_NOT_FOUND",`Collection ${r} does not exist!`),404)}function gce(e,t){try{let{name:r}=e.params;R.info(`\u6B63\u5728\u5220\u9664\u7EC4\u5408\u8BA2\u9605\uFF1A${r}`),Ece(e.query.mode)&&CO(r),yce(r),Le(t)}catch(r){Re(t,r)}}function vce(e,t){let r=R.read(zt);Le(t,r)}function wce(e,t){try{let r=e.body;r.forEach(n=>{bn(n),eo(n)}),R.write(r,zt),Le(t)}catch(r){Re(t,r)}}function e5(e){if(bn(e),eo(e),R.info(`\u6B63\u5728\u521B\u5EFA\u7EC4\u5408\u8BA2\u9605\uFF1A${e.name}`),/\//.test(e.name))throw new Pe("INVALID_NAME",`Collection ${e.name} is invalid`);let t=R.read(zt);if(Qe(t,e.name))throw new Pe("DUPLICATE_KEY",`Collection ${e.name} already exists.`);return sa(t,e,Oa()),R.write(t,zt),e}function yce(e){let t=R.read(zt),r=Qe(t,e);if(!r)throw new vt("RESOURCE_NOT_FOUND",`Collection ${e} does not exist!`);return na(t,e),R.write(t,zt),r}function Ece(e){if(e==null||e===""||e==="permanent")return!1;if(e==="archive")return!0;throw new Pe("INVALID_DELETE_MODE",`Unsupported delete mode: ${e}`)}var oFe,t5=re(()=>{oFe=F(I());hi();Lh();dr();fl();vn();gt();wn();Ir();us();cy()});function bce(e){return typeof e.getHeaders=="function"?{...e.getHeaders()}:{}}function Ace(e,t,r={}){for(let n of Object.keys(t))Object.prototype.hasOwnProperty.call(r,n)||e.removeHeader(n);for(let[n,s]of Object.entries(r))s==null?e.removeHeader(n):e.set(n,s)}function Sce(e,t){let r=Number(t);Number.isInteger(r)&&r>=100&&r<=599&&e.status(r)}async function Y1({res:e,body:t,process:r,targetPlatform:n,source:s,$options:o,executionContext:i}){let a=bce(e),u=await Ft.processResponse({status:e.statusCode||200,headers:a,body:t},r||[],n,s,o,i);return Ace(e,a,u.header||u.headers),Sce(e,u.status||u.statusCode),u.body}var cFe,r5=re(()=>{cFe=F(I());tl()});var eN=be((lFe,QO)=>{var fFe=F(I()),qh=1e3,jh=qh*60,Kh=jh*60,Pf=Kh*24,_ce=Pf*7,Cce=Pf*365.25;QO.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Dce(e);if(r==="number"&&isFinite(e))return t.long?Bce(e):Fce(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Dce(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Cce;case"weeks":case"week":case"w":return r*_ce;case"days":case"day":case"d":return r*Pf;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Kh;case"minutes":case"minute":case"mins":case"min":case"m":return r*jh;case"seconds":case"second":case"secs":case"sec":case"s":return r*qh;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Fce(e){var t=Math.abs(e);return t>=Pf?Math.round(e/Pf)+"d":t>=Kh?Math.round(e/Kh)+"h":t>=jh?Math.round(e/jh)+"m":t>=qh?Math.round(e/qh)+"s":e+"ms"}function Bce(e){var t=Math.abs(e);return t>=Pf?ly(e,t,Pf,"day"):t>=Kh?ly(e,t,Kh,"hour"):t>=jh?ly(e,t,jh,"minute"):t>=qh?ly(e,t,qh,"second"):e+" ms"}function ly(e,t,r,n){var s=t>=r*1.5;return Math.round(e/r)+" "+n+(s?"s":"")}});var hFe,n5,tN=re(()=>{hFe=F(I(),1),n5="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"});var gFe,Ice,$ce,rN,nN=re(()=>{gFe=F(I(),1);tN();Ice=e=>crypto.getRandomValues(new Uint8Array(e)),$ce=(e,t,r)=>{let n=(2<<Math.log(e.length-1)/Math.LN2)-1,s=-~(1.6*n*t/e.length);return(o=t)=>{if(o<=0)return"";let i="";for(;;){let a=r(s),u=s|0;for(;u--;)if(i+=e[a[u]&n]||"",i.length===o)return i}}},rN=(e,t=21)=>$ce(e,t,Ice)});var wFe,xce,sN,iN=re(()=>{wFe=F(I(),1),xce="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",sN=(e=21)=>{let t="",r=e|0;for(;r-- >0;)t+=xce[Math.random()*64|0];return t}});function s5(e){R.read(Yr)||R.write([],Yr),e.post("/api/token",Pce),e.route("/api/token/:token").delete(Tce),e.route("/api/tokens").get(kce)}function Rce(){if(hr().isNode){let nanoid=require("nanoid");return nanoid.customAlphabet(nanoid.urlAlphabet)()}try{return rN(n5)()}catch{return sN()}}function Tce(e,t){try{let{token:r}=e.params,{type:n,name:s}=e.query;if(!n||!s)throw new Pe("INVALID_PAYLOAD","Payload type and name are required. Please update your front-end(version >= 2.15.76)");R.info(`\u6B63\u5728\u5220\u9664...
|
||
token: ${r}, \u7C7B\u578B\uFF1A${n}, \u540D\u79F0\uFF1A${s}`),Gce(e.query.mode)&&BO(r,n,s),Vce(r,n,s),Le(t)}catch(r){Re(t,r)}}function kce(e,t){let{type:r,name:n}=e.query,s=R.read(Yr)||[];Le(t,r||n?s.filter(o=>(r?o.type===r:!0)&&(n?o.name===n:!0)):s)}async function Pce(e,t){if(!hr().isNode&&!hr().isSubsCheckPro)return Re(t,new Pe("INVALID_ENV","This endpoint is only available in Node.js environment"));try{let r=i5(e.body.payload,e.body.options);return Le(t,{token:r.token})}catch(r){return Re(t,r instanceof Pe?r:new Jt("TOKEN_SIGN_FAILED","Failed to sign token",`Reason: ${r.message??r}`))}}function Oce(e){if(!(e==null||e==="")){if(e==="duration"||e==="datetime"||e==="count")return e;throw new Pe("INVALID_EXPIRATION_MODE",`Unsupported expiration mode: ${e}`)}}function Nce(e={}){if(e?.expiresIn!=null&&e.expiresIn!=="")return"duration";if(e?.exp!=null&&e.exp!=="")return"datetime"}function Lce(e={}){let t=e?.exp;if(typeof t!="number"&&typeof t!="string")throw new Pe("INVALID_EXPIRATION_DATETIME",`Invalid exp option: ${t}`);let r=typeof t=="string"?t.trim():t;if(r==="")throw new Pe("INVALID_EXPIRATION_DATETIME",`Invalid exp option: ${t}`);let n=Number(r);if(!Number.isSafeInteger(n)||n<=0||n<1e12)throw new Pe("INVALID_EXPIRATION_DATETIME",`Invalid exp option: ${t}`);return n}function Uce(e={},{required:t=!1}={}){let r=e?.expiresIn;if(r==null||r===""){if(t)throw new Pe("INVALID_EXPIRES_IN",`Invalid expiresIn option: ${r}`);return null}let n=(0,oN.default)(r);if(n==null||isNaN(n)||n<=0)throw new Pe("INVALID_EXPIRES_IN",`Invalid expiresIn option: ${r}`);return{rawExpiresIn:r,expiresIn:n,exp:Date.now()+n}}function Mce(e={}){let t=e?.expiresUnit;return typeof t=="string"&&t.trim()===aN}function qce(e={}){let t=e?.expiresIn;if(t!=null&&t!=="")throw new Pe("INVALID_DURATION_INPUT",`expiresIn option is not allowed for lifetime duration: ${t}`);return{expiresUnit:aN}}function jce(e={},t){let r=e?.expiresValue,n=e?.expiresUnit,s=r!=null&&r!=="",o=n!=null&&n!=="";if(!s&&!o)return null;let i=Number(r);if(!Number.isFinite(i)||i<=0)throw new Pe("INVALID_EXPIRES_VALUE",`Invalid expiresValue option: ${r}`);let a=typeof n=="string"?n.trim():"";if(!["day","month","season","year"].includes(a))throw new Pe("INVALID_EXPIRES_UNIT",`Invalid expiresUnit option: ${n}`);let u=Number(i.toFixed(2)),l=u*Hce[a];if(t&&Math.abs(t.expiresIn-l)>1)throw new Pe("INVALID_DURATION_INPUT",`expiresValue/expiresUnit do not match expiresIn option: ${r}${a} != ${e?.expiresIn}`);return{expiresValue:String(u),expiresUnit:a}}function Kce(e={}){let t=e?.count;if(t==null||t==="")throw new Pe("INVALID_SHARE_COUNT",`Invalid count option: ${t}`);let r=Number(t);if(!Number.isSafeInteger(r)||r<=0)throw new Pe("INVALID_SHARE_COUNT",`Invalid count option: ${t}`);let n=e?.usedCount??0,s=Number(n);if(!Number.isSafeInteger(s)||s<0||s>r)throw new Pe("INVALID_SHARE_USED_COUNT",`Invalid usedCount option: ${n}`);return{count:r,usedCount:s}}function i5(e,t={}){let r=e?.type,n=e?.name;if(!r||!n)throw new Pe("INVALID_PAYLOAD","payload type and name are required");let s=e?.token;if(s!=null){if(typeof s!="string"||s.length<1)throw new Pe("INVALID_CUSTOM_TOKEN",`Invalid custom token: ${s}`);if((R.read(Yr)||[]).find(y=>y.token===s&&y.type===r&&y.name===n))throw new Pe("DUPLICATE_TOKEN",`Token ${s} already exists`)}if(r==="col"){if(!(R.read(zt)||[]).find(w=>w.name===n))throw new Pe("INVALID_COLLECTION",`collection ${n} not found`)}else if(r==="file"){if(!(R.read(Lt)||[]).find(w=>w.name===n))throw new Pe("INVALID_FILE",`file ${n} not found`)}else if(r==="sub"){if(!(R.read(Gt)||[]).find(w=>w.name===n))throw new Pe("INVALID_SUB",`sub ${n} not found`)}else throw new Pe("INVALID_TYPE",`type ${n} not supported`);let o=Oce(t?.mode)??Nce(t),i=null,a=null,u=null,l,f=null;o==="datetime"?l=Lce(t):o==="count"?f=Kce(t):o==="duration"&&Mce(t)?u=qce(t):(i=Uce(t,{required:o==="duration"}),i&&(a=jce(t,i)),l=i?.exp);let m=R.read(Yr)||[];if(!s)do s=Rce();while(m.find(g=>g.token===s&&g.type===r&&g.name===n));let p=o==="datetime"?"datetime":o==="count"?"count":i||u?"duration":void 0,d={...e};delete d.mode,delete d.exp,delete d.expiresIn,delete d.expiresValue,delete d.expiresUnit,delete d.count,delete d.usedCount,bn(d);let v={...d,token:s,createdAt:Date.now(),...p?{mode:p}:{},...p==="datetime"?{exp:l}:p==="count"?{count:f.count,usedCount:f.usedCount}:u?{...u}:i?{expiresIn:i.rawExpiresIn,...a||{},exp:l}:{}};return sa(m,v,Oa()),R.write(m,Yr),v}function Vce(e,t,r){let n=R.read(Yr)||[],s=n.find(i=>i.token===e&&i.type===t&&i.name===r);if(!s)throw new vt("RESOURCE_NOT_FOUND",`Share ${t}/${r}/${e} does not exist!`);let o=n.filter(i=>!(i.token===e&&i.type===t&&i.name===r));return R.write(o,Yr),s}function uN(e,{token:t,type:r,name:n,pathname:s}){return e.token===t&&(r?e.type===r:!0)&&(n?e.name===n:!0)&&(s?`/share/${e.type}/${e.name}`===s||s.startsWith(`/share/${e.type}/${e.name}/`):!0)}function cN(e){if(e.exp!=null&&e.exp<=Date.now())return!1;if(e.mode==="count"){let t=Number(e.count),r=e.usedCount==null?0:Number(e.usedCount);return Number.isSafeInteger(t)&&t>0&&Number.isSafeInteger(r)&&r>=0&&r<t}return!0}function fy(e){let t=R.read(Yr)||[],r=t.findIndex(o=>uN(o,e)&&cN(o));if(r<0)return null;let n=t[r];if(n.mode!=="count")return n;let s={...n,usedCount:Number(n.usedCount??0)+1};return t[r]=s,R.write(t,Yr),s}function W1(e,t){let r={token:e.query?.token,type:t,name:e.params?.name};if(e.subStoreShareToken&&e.subStoreShareToken.token===r.token&&e.subStoreShareToken.type===t&&e.subStoreShareToken.name===r.name)return e.subStoreShareToken;let n=fy(r);return n&&(e.subStoreShareToken=n),n}function X1(e){return(R.read(Yr)||[]).find(r=>uN(r,e)&&cN(r))||null}function Gce(e){if(e==null||e===""||e==="permanent")return!1;if(e==="archive")return!0;throw new Pe("INVALID_DELETE_MODE",`Unsupported delete mode: ${e}`)}var xFe,oN,Hce,aN,Vh=re(()=>{xFe=F(I());li();dr();vn();gt();wn();hi();Lh();fl();us();oN=F(eN());nN();iN();Hce={day:1440*60*1e3,month:720*60*60*1e3,season:2160*60*60*1e3,year:365*24*60*60*1e3},aN="lifetime"});function o5(e){R.read(Lt)||R.write([],Lt),e.get("/share/file/:name",lN),e.route("/api/file/:name").get(lN).patch(Wce).delete(Xce),e.route("/api/wholeFile/:name").get(Yce),e.route("/api/files").get(Jce).post(zce).put(Qce),e.route("/api/wholeFiles").get(Zce)}function zce(e,t){try{let r=a5(e.body);Le(t,r,201)}catch(r){Re(t,r)}}async function lN(e,t,r){let{name:n}=e.params,s=e.headers["user-agent"]||e.headers["User-Agent"],o=e.path?.startsWith("/share/");if(hr().isSubsCheckPro&&o&&!W1(e,"file")){Re(t,new Pe("INVALID_SHARE_TOKEN","\u5206\u4EAB\u4EE4\u724C\u9519\u8BEF\u3001\u5DF2\u8FC7\u671F\u6216\u5DF2\u7528\u5C3D"),404);return}R.info(`\u6B63\u5728\u4E0B\u8F7D\u6587\u4EF6\uFF1A${n}
|
||
\u8BF7\u6C42 User-Agent: ${s}`);let{url:i,subInfoUrl:a,subInfoUserAgent:u,ua:l,content:f,mergeSources:m,ignoreFailedRemoteFile:p,includeUnsupportedProxy:d,type:v,source:g,sourceType:y,sourceName:w,mode:E,proxy:S,noCache:C,produceType:D,download:H,fakeFile:K}=e.query,_={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body,socket:{remoteAddress:e.socket?.remoteAddress}}};if(e.query.$options){let k={};try{k=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let O of e.query.$options.split("&")){let L=O.split("=")[0],T=O.split("=")[1];k[L]=T==null||T===""?!0:decodeURIComponent(T)}}R.info(`\u4F20\u5165 $options: ${JSON.stringify(k)}`),Object.assign(_,k)}if(o&&K){R.warn(`\u5206\u4EAB\u94FE\u63A5\u7981\u6B62\u4F7F\u7528 fakeFile: ${n}`),Re(t,new Pe("UNSUPPORTED_SHARE_FAKE_FILE","share/file \u4E0D\u652F\u6301 fakeFile \u53C2\u6570"),400);return}if(K&&!nle({content:f,fileType:v,sourceName:w,sourceType:y,url:i})){R.warn(`fakeFile \u7F3A\u5C11\u53EF\u7528\u6765\u6E90: ${n}`),Re(t,new Pe("INVALID_FAKE_FILE_SOURCE","fakeFile \u9700\u8981\u63D0\u4F9B content/url \u6216 mihomo \u914D\u7F6E\u6765\u6E90\u53C2\u6570"),400);return}if(o&&(i!=null&&i!==""||f!=null&&f!=="")){R.warn(`\u5206\u4EAB\u94FE\u63A5\u7981\u6B62\u4F7F\u7528 url/content: ${n}`),Re(t,new Pe("UNSUPPORTED_SHARE_FILE_SOURCE_OVERRIDE","share/file \u4E0D\u652F\u6301 url \u6216 content \u53C2\u6570"),400);return}if(o&&fN([v,g,y,w,E])){R.warn(`\u5206\u4EAB\u94FE\u63A5\u7981\u6B62\u4F7F\u7528\u6587\u4EF6\u6765\u6E90\u914D\u7F6E\u8986\u76D6: ${n}`),Re(t,new Pe("UNSUPPORTED_SHARE_FILE_RUNTIME_OVERRIDE","share/file \u4E0D\u652F\u6301\u6587\u4EF6\u6765\u6E90\u914D\u7F6E\u8986\u76D6\u53C2\u6570"),400);return}if(o&&a!=null&&a!==""){R.warn(`\u5206\u4EAB\u94FE\u63A5\u7981\u6B62\u4F7F\u7528 subInfoUrl: ${n}`),Re(t,new Pe("UNSUPPORTED_SHARE_FILE_SUB_INFO_URL","share/file \u4E0D\u652F\u6301 subInfoUrl \u53C2\u6570"),400);return}if(o&&m){R.warn(`\u5206\u4EAB\u94FE\u63A5\u7981\u6B62\u4F7F\u7528 mergeSources: ${n}`),Re(t,new Pe("UNSUPPORTED_SHARE_FILE_MERGE_SOURCES","share/file \u4E0D\u652F\u6301 mergeSources \u53C2\u6570"),400);return}i&&R.info(`\u6307\u5B9A\u8FDC\u7A0B\u6587\u4EF6 URL: ${An(i)}`),K&&R.info(`\u4F7F\u7528\u5047\u6587\u4EF6, \u4E0D\u518D\u901A\u8FC7\u5355\u4E2A\u6587\u4EF6\u540D\u79F0 ${n} \u67E5\u8BE2`),S&&R.info(`\u6307\u5B9A\u8FDC\u7A0B\u6587\u4EF6\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${S}`),l&&R.info(`\u6307\u5B9A\u8FDC\u7A0B\u6587\u4EF6 User-Agent: ${l}`),a&&R.info(`\u6307\u5B9A\u83B7\u53D6\u6D41\u91CF\u7684 subInfoUrl: ${a}`),u&&R.info(`\u6307\u5B9A\u83B7\u53D6\u6D41\u91CF\u7684 subInfoUserAgent: ${u}`),f&&R.info(`\u6307\u5B9A\u672C\u5730\u6587\u4EF6: ${f}`),m&&R.info(`\u6307\u5B9A\u5408\u5E76\u6765\u6E90: ${m}`),p!=null&&p!==""&&R.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u6587\u4EF6: ${p}`),C&&R.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${C}`),D&&R.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${D}`),v&&R.info(`\u6307\u5B9A\u6587\u4EF6\u7C7B\u578B: ${v}`),g&&R.info(`\u6307\u5B9A\u6587\u4EF6\u6765\u6E90: ${g}`),y&&R.info(`\u6307\u5B9A mihomo \u914D\u7F6E\u6765\u6E90: ${y}`),w&&R.info(`\u6307\u5B9A mihomo \u914D\u7F6E\u6765\u6E90\u540D\u79F0: ${w}`),E&&R.info(`\u6307\u5B9A mihomo \u914D\u7F6E\u5904\u7406\u65B9\u5F0F: ${E}`),H&&R.info("\u542F\u7528\u4E0B\u8F7D(\u6587\u4EF6\u540D\u4E3A\u663E\u793A\u540D\u79F0)"),d!=null&&d!==""&&R.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${d}`);let x=R.read(Lt)||[],U=K?{name:"fakeFile",source:"remote",url:""}:Qe(x,n);if(U)try{let k=rle(U,{content:f,download:H,fileSource:g,fileType:v,ignoreFailedRemoteFile:p,includeUnsupportedProxy:d,mergeSources:m,mode:E,noCache:C,sourceName:w,sourceType:y,produceType:D,proxy:S,subInfoUrl:a,subInfoUserAgent:u,ua:l,url:i}),N=await _n({type:"file",name:n,url:i,ua:l,content:f,mergeSources:m,ignoreFailedRemoteFile:p,$options:_,proxy:S,noCache:C,produceType:D,all:!0,file:k});try{let L=k.subInfoUrl;if(L){let T=await es(L,k.subInfoUserAgent,void 0,k.proxy);if(T){let M=Ec(T,!0);M?.["subscription-userinfo"]&&t.set("subscription-userinfo",M["subscription-userinfo"]),M?.["profile-web-page-url"]&&t.set("profile-web-page-url",M["profile-web-page-url"]),M?.["plan-name"]&&t.set("plan-name",M["plan-name"])}}}catch(L){R.error(`\u6587\u4EF6 ${n} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(L)}`)}k.download&&t.set("Content-Disposition",`attachment; filename*=UTF-8''${encodeURIComponent(k.displayName||k.name)}`),t.set("Content-Type","text/plain; charset=utf-8"),N?.$options?._res?.headers&&Object.entries(N.$options._res.headers).forEach(([L,T])=>{T==null?t.removeHeader(L):t.set(L,T)}),N?.$options?._res?.status&&t.status(N.$options._res.status);let O=await Y1({res:t,body:N?.$content??"",process:k.process,source:{$file:k},$options:N?.$options??_});t.send(await kf({res:t,body:O,configs:[K1({req:e,type:"file",name:n,findShareToken:X1}),k]}))}catch(k){R.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25",`\u274C \u65E0\u6CD5\u4E0B\u8F7D\u6587\u4EF6\uFF1A${n}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${k.message??k}`),R.error(k.message??k),Re(t,new Jt("INTERNAL_SERVER_ERROR",`Failed to download file: ${n}`,`Reason: ${k.message??k}`))}else R.error(`\u{1F30D} Sub-Store \u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25
|
||
\u274C \u672A\u627E\u5230\u6587\u4EF6\uFF1A${n}\uFF01`),Re(t,new vt("RESOURCE_NOT_FOUND",`File ${n} does not exist!`),404)}function Yce(e,t){let{name:r}=e.params,{raw:n}=e.query,s=R.read(Lt),o=Qe(s,r);o?n?t.set("content-type","application/json").set("access-control-expose-headers","content-disposition").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_file_${r}_${yc(new Date)}.json`)}"`).send(JSON.stringify(o)):Le(t,o):Re(t,new vt("FILE_NOT_FOUND",`File ${r} does not exist`,404))}function Wce(e,t){let{name:r}=e.params,n=e.body,s=R.read(Lt)||[],o=Qe(s,r);if(o){n.name||(n.name=o.name);let i=el({...o,...n});if(bn(i),eo(i),R.info(`\u6B63\u5728\u66F4\u65B0\u6587\u4EF6\uFF1A${r}...`),r!==i.name){let a=R.read($t)||[];for(let u of a)u.type==="file"&&u.source===o.name&&(u.source=i.name);R.write(a,$t)}di(s,r,i),R.write(s,Lt),Le(t,i)}else Re(t,new vt("RESOURCE_NOT_FOUND",`File ${r} does not exist!`),404)}function Xce(e,t){try{let{name:r}=e.params;R.info(`\u6B63\u5728\u5220\u9664\u6587\u4EF6\uFF1A${r}`),tle(e.query.mode)&&DO(r),ele(r),Le(t)}catch(r){Re(t,r)}}function Jce(e,t){let r=R.read(Lt)||[];Le(t,r.map(({content:n,...s})=>s))}function Zce(e,t){let r=R.read(Lt)||[];Le(t,r)}function Qce(e,t){try{let r=e.body.map(el);r.forEach(n=>{bn(n),eo(n)}),R.write(r,Lt),Le(t)}catch(r){Re(t,r)}}function a5(e){let t=el({...e});bn(t),eo(t),t.name=`${t.name??Date.now()}`,R.info(`\u6B63\u5728\u521B\u5EFA\u6587\u4EF6\uFF1A${t.name}`);let r=R.read(Lt);if(Qe(r,t.name))throw new Pe("DUPLICATE_KEY",e.name?`\u5DF2\u5B58\u5728 name \u4E3A ${t.name} \u7684\u6587\u4EF6`:"\u65E0\u6CD5\u540C\u65F6\u521B\u5EFA\u76F8\u540C\u7684\u6587\u4EF6 \u53EF\u7A0D\u540E\u91CD\u8BD5");return sa(r,t,Oa()),R.write(r,Lt),t}function ele(e){let t=R.read(Lt)||[],r=Qe(t,e);if(!r)throw new vt("RESOURCE_NOT_FOUND",`File ${e} does not exist!`);return na(t,e),R.write(t,Lt),r}function tle(e){if(e==null||e===""||e==="permanent")return!1;if(e==="archive")return!0;throw new Pe("INVALID_DELETE_MODE",`Unsupported delete mode: ${e}`)}function rle(e,{content:t,download:r,fileSource:n,fileType:s,ignoreFailedRemoteFile:o,includeUnsupportedProxy:i,mergeSources:a,mode:u,noCache:l,produceType:f,proxy:m,sourceName:p,sourceType:d,subInfoUrl:v,subInfoUserAgent:g,ua:y,url:w}={}){let E={...e};return Hn(E,"content",t),Hn(E,"download",r),Hn(E,"ignoreFailedRemoteFile",o),Hn(E,"mergeSources",a),Hn(E,"noCache",l),Hn(E,"produceType",f),Hn(E,"proxy",m),Hn(E,"subInfoUrl",v),Hn(E,"subInfoUserAgent",g),Hn(E,"type",s),E.type=u7(E.type),Hn(E,"ua",y),Hn(E,"url",w),Hn(E,"source",n),bi(E)&&(Hn(E,"sourceType",d),Hn(E,"sourceName",p),Hn(E,"mode",u),E.sourceType||(J1(w)?E.sourceType="remote":J1(t)&&(E.sourceType="local"))),Hn(E,"includeUnsupportedProxy",i),E}function nle({content:e,fileType:t,sourceName:r,sourceType:n,url:s}){if(fN([e,s]))return!0;if(!bi(dy(t)))return!1;let o=dy(n);return o==="none"?!0:["subscription","collection"].includes(o)&&J1(r)}function Hn(e,t,r){J1(r)&&(e[t]=dy(r))}function dy(e){return Array.isArray(e)?e[e.length-1]:e}function J1(e){let t=dy(e);return t!=null&&t!==""}function fN(e){return e.some(J1)}var XFe,u5=re(()=>{XFe=F(I());hi();Lh();pd();dr();vn();gt();wn();Lu();fl();Ir();r5();sy();Vh();us();cy();li();b1()});function c5(e){Tf(),e.route("/api/archives").get(sle),e.route("/api/archives/:id").get(ile).delete(ole),e.post("/api/archives/:id/restore",ale)}function sle(e,t){Le(t,AO())}function ile(e,t){try{Le(t,F4(e.params.id))}catch(r){Re(t,r,r instanceof vt?404:500)}}function ole(e,t){try{let r=B4(e.params.id);Le(t,r)}catch(r){Re(t,r,r instanceof vt?404:500)}}function ale(e,t){try{let r=F4(e.params.id),n=ule(r);B4(e.params.id),Le(t,n)}catch(r){let n=r instanceof Pe||r instanceof vt?r:new Jt("ARCHIVE_RESTORE_FAILED","Failed to restore archive entry",`Reason: ${r.message??r}`),s=n instanceof vt?404:n instanceof Pe?400:500;Re(t,n,s)}}function ule(e){let t=JSON.parse(JSON.stringify(e.snapshot));switch(e.itemType){case"sub":return J4(t);case"col":return e5(t);case"file":return a5(t);case"artifact":return $4(cle(t));case"share":return i5(t,{mode:t.mode,expiresIn:t.expiresIn,expiresValue:t.expiresValue,expiresUnit:t.expiresUnit,exp:t.exp,count:t.count,usedCount:t.usedCount});default:throw new Pe("INVALID_ARCHIVE_TYPE",`Unsupported archive item type: ${e.itemType}`)}}function cle(e){let t={...e};return delete t.updated,delete t.url,t}var oBe,dN=re(()=>{oBe=F(I());vn();wn();fl();Z4();t5();u5();ry();Vh()});function l5(e){R.read(zn)||R.write([],zn),e.route("/api/module/:name").get(fle).patch(dle).delete(hle),e.route("/api/modules").get(ple).post(lle).put(mle)}function lle(e,t){let r=e.body;r.name=`${r.name??Lr(JSON.stringify(r))}`,R.info(`\u6B63\u5728\u521B\u5EFA\u6A21\u5757\uFF1A${r.name}`);let n=R.read(zn);if(Qe(n,r.name))return Re(t,new Pe("DUPLICATE_KEY",e.body.name?`\u5DF2\u5B58\u5728 name \u4E3A ${r.name} \u7684\u6A21\u5757`:"\u5DF2\u5B58\u5728\u76F8\u540C\u7684\u6A21\u5757 \u8BF7\u52FF\u91CD\u590D\u6DFB\u52A0"));n.push(r),R.write(n,zn),Le(t,r,201)}function fle(e,t){let{name:r}=e.params,n=R.read(zn),s=Qe(n,r);s?t.set("Content-Type","text/plain; charset=utf-8").send(s.content):Re(t,new vt("MODULE_NOT_FOUND",`Module ${r} does not exist`,404))}function dle(e,t){let{name:r}=e.params,n=e.body,s=R.read(zn),o=Qe(s,r);if(o){let i={...o,...n};R.info(`\u6B63\u5728\u66F4\u65B0\u6A21\u5757\uFF1A${r}...`),di(s,r,i),R.write(s,zn),Le(t,i)}else Re(t,new vt("RESOURCE_NOT_FOUND",`Module ${r} does not exist!`),404)}function hle(e,t){let{name:r}=e.params;R.info(`\u6B63\u5728\u5220\u9664\u6A21\u5757\uFF1A${r}`);let n=R.read(zn);na(n,r),R.write(n,zn),Le(t)}function ple(e,t){let r=R.read(zn);Le(t,r.map(({content:n,...s})=>s))}function mle(e,t){let r=e.body;R.write(r,zn),Le(t)}var pBe,hN=re(()=>{pBe=F(I());hi();dr();vn();gt();wn();fd()});function gle(e){let t=Object.keys(e),r="",n="",s="";for(let o of t){let i=o.toLowerCase();i==="user-agent"?(r=e[o],n=r.toLowerCase()):i==="accept"&&(s=e[o])}return{UA:r,ua:n,accept:s}}function vle({ua:e,UA:t,accept:r}){return t.indexOf("Quantumult%20X")!==-1?"QX":e.indexOf("egern")!==-1?"Egern":t.indexOf("Surfboard")!==-1?"Surfboard":t.indexOf("Surge Mac")!==-1?"SurgeMac":t.indexOf("Surge")!==-1?"Surge":t.indexOf("Decar")!==-1||t.indexOf("Loon")!==-1?"Loon":t.indexOf("Shadowrocket")!==-1?"Shadowrocket":t.indexOf("Stash")!==-1?"Stash":e==="meta"||e.indexOf("clash")!==-1&&e.indexOf("meta")!==-1||e.indexOf("clash-verge")!==-1||e.indexOf("flclash")!==-1?"ClashMeta":e.indexOf("clash")!==-1?"Clash":e.indexOf("v2ray")!==-1?"V2Ray":e.indexOf("sing-box")!==-1||e.indexOf("singbox")!==-1?"sing-box":r.indexOf("application/json")===0?"JSON":"V2Ray"}function f5(e){let{UA:t,ua:r,accept:n}=gle(e);return vle({ua:r,UA:t,accept:n})}var gBe,pN=re(()=>{gBe=F(I())});function mN(e){let t=e.target==="SurgeMac",r=t?e.mihomoExternal:void 0,n=t?e.mihomoMerge:void 0,s=t?e.mihomoMergeName:void 0,o;if(t&&e.mihomoLocalPort!=null){let i=parseInt(e.mihomoLocalPort,10);Number.isInteger(i)&&i>=1&&i<=65535&&(o=i)}return{useMihomoExternal:t,mihomoExternal:r,mihomoMerge:n,mihomoMergeName:s,mihomoLocalPort:o}}function d5(e){e.get("/share/col/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,R.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await py(t,r)}),e.get("/share/col/:name",py),e.get("/share/sub/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,R.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await hy(t,r)}),e.get("/share/sub/:name",hy),e.get("/download/collection/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,R.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await py(t,r)}),e.get("/download/collection/:name",py),e.get("/download/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,R.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await hy(t,r)}),e.get("/download/:name",hy)}async function hy(e,t){let{name:r}=e.params,n=e.path?.startsWith("/share/");if(hr().isSubsCheckPro&&n&&!W1(e,"sub")){Re(t,new Pe("INVALID_SHARE_TOKEN","\u5206\u4EAB\u4EE4\u724C\u9519\u8BEF\u3001\u5DF2\u8FC7\u671F\u6216\u5DF2\u7528\u5C3D"),404);return}let{useMihomoExternal:s,mihomoMerge:o,mihomoMergeName:i,mihomoExternal:a,mihomoLocalPort:u}=mN(e.query),l=e.query.platform||e.query.target||f5(e.headers)||"JSON",f=e.headers["user-agent"]||e.headers["User-Agent"];R.info(`\u6B63\u5728\u4E0B\u8F7D\u8BA2\u9605\uFF1A${r}
|
||
\u8BF7\u6C42 User-Agent: ${f}
|
||
\u8BF7\u6C42 target: ${e.query.target}
|
||
\u5B9E\u9645\u8F93\u51FA: ${l}`);let{url:m,ua:p,content:d,mergeSources:v,ignoreFailedRemoteSub:g,produceType:y,includeUnsupportedProxy:w,proxy:E,noCache:S,_fakeNode:C,fakeSub:D}=e.query,H=e.query.prettyYaml??e.query["pretty-yaml"],K={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body,socket:{remoteAddress:e.socket?.remoteAddress}}};if(e.query.$options){let U={};try{U=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let N of e.query.$options.split("&")){let O=N.split("=")[0],L=N.split("=")[1];U[O]=L==null||L===""?!0:decodeURIComponent(L)}}R.info(`\u4F20\u5165 $options: ${JSON.stringify(U)}`),Object.assign(K,U)}if(n&&D){R.warn(`\u5206\u4EAB\u94FE\u63A5\u7981\u6B62\u4F7F\u7528 fakeSub: ${r}`),Re(t,new Pe("UNSUPPORTED_SHARE_FAKE_SUB","share/sub \u4E0D\u652F\u6301 fakeSub \u53C2\u6570"),400);return}if(n&&(m!=null&&m!==""||d!=null&&d!=="")){R.warn(`\u5206\u4EAB\u94FE\u63A5\u7981\u6B62\u4F7F\u7528 url/content: ${r}`),Re(t,new Pe("UNSUPPORTED_SHARE_SUB_SOURCE_OVERRIDE","share/sub \u4E0D\u652F\u6301 url \u6216 content \u53C2\u6570"),400);return}if(n&&v){R.warn(`\u5206\u4EAB\u94FE\u63A5\u7981\u6B62\u4F7F\u7528 mergeSources: ${r}`),Re(t,new Pe("UNSUPPORTED_SHARE_SUB_MERGE_SOURCES","share/sub \u4E0D\u652F\u6301 mergeSources \u53C2\u6570"),400);return}m&&(R.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 URL: ${An(m)}`),/^https?:\/\//.test(m)||(d=m,R.info("URL \u4E0D\u662F\u94FE\u63A5\uFF0C\u89C6\u4E3A\u672C\u5730\u8BA2\u9605"))),D&&R.info(`\u4F7F\u7528\u5047\u8BA2\u9605, \u4E0D\u518D\u901A\u8FC7\u5355\u6761\u8BA2\u9605\u540D\u79F0 ${r} \u67E5\u8BE2`),d&&R.info(`\u6307\u5B9A\u672C\u5730\u8BA2\u9605: ${d}`),E&&R.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${E}`),p&&R.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 User-Agent: ${p}`),v&&R.info(`\u6307\u5B9A\u5408\u5E76\u6765\u6E90: ${v}`),g!=null&&g!==""&&R.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u8BA2\u9605: ${g}`),y&&R.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${y}`),w&&R.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${w}`),H&&R.info(`\u6307\u5B9A\u8F93\u51FA\u6613\u8BFB YAML: ${H}`),o&&R.info(`\u6307\u5B9A\u5408\u5E76 mihomo External: ${o}`),i&&R.info(`\u6307\u5B9A\u5408\u5E76 mihomo External \u540D\u79F0: ${i}`),s&&R.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 mihomo External"),a&&R.info(`\u624B\u52A8\u6307\u5B9A\u4E86 mihomo External \u94FE\u63A5\u53C2\u6570: ${a}`),S&&R.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${S}`),e.query.noFlow&&R.info(`\u6307\u5B9A\u4E0D\u67E5\u8BE2\u8BA2\u9605\u6D41\u91CF\u4FE1\u606F: ${e.query.noFlow}`);let _=R.read(Gt),x=C?{name:"fakeNodeInfo",source:"local",content:"invalid share = ss, 1.0.0.1, 80, encrypt-method=aes-128-gcm, password=password"}:{name:"fakeSub",source:"remote",url:""},j=C||D?x:Qe(_,r);if(j)try{let U=e.query.noFlow||j.noFlow;j.passThroughUA&&(R.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${f}`),p=f);let N={type:"subscription",name:r,platform:l,url:m,ua:p,content:d,mergeSources:v,ignoreFailedRemoteSub:g,produceType:y,produceOpts:{"include-unsupported-proxy":w,useMihomoExternal:s,merge:o,mergeName:i,mihomoExternal:a,localPort:u,prettyYaml:H},$options:K,proxy:E,noCache:S,noFlow:U};(C||D)&&(C&&R.info("\u8FD4\u56DE\u5047\u8282\u70B9\u4FE1\u606F"),delete N.name,N.subscription=x);let O=await _n(N),L;if(j.source!=="local"||["localFirst","remoteFirst"].includes(j.mergeSources))try{m=`${m||j.url}`.split(/[\r\n]+/).map(G=>G.trim()).filter(G=>G.length)?.[0]||"";let M={},W=m.split("#");if(m=m.split("#")[0],W.length>1)try{M=JSON.parse(decodeURIComponent(W[1]))}catch{for(let J of W[1].split("&")){let te=J.split("=")[0],ie=J.split("=")[1];M[te]=ie==null||ie===""?!0:decodeURIComponent(ie)}}if(!U&&!M.noFlow&&/^https?/.test(m)&&(L=await es(M?.insecure?`${m}#insecure`:m,M.flowUserAgent,void 0,E||j.proxy,M.flowUrl,M.flowHeaders),L)){let G=Ec(L,!0);G?.["subscription-userinfo"]&&t.set("subscription-userinfo",G["subscription-userinfo"]),G?.["profile-web-page-url"]&&t.set("profile-web-page-url",G["profile-web-page-url"]),G?.["plan-name"]&&t.set("plan-name",G["plan-name"])}}catch(M){R.error(`\u8BA2\u9605 ${r} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(M)}`)}if(!U&&j.subUserinfo){let M;if(/^https?:\/\//.test(j.subUserinfo))try{M=await es(void 0,void 0,void 0,E||j.proxy,j.subUserinfo)}catch(G){R.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${j.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(G)}`)}else M=j.subUserinfo;let W=Ec([M,L].filter(G=>G).join(";"),!0);W?.["subscription-userinfo"]&&t.set("subscription-userinfo",W["subscription-userinfo"]),W?.["profile-web-page-url"]&&t.set("profile-web-page-url",W["profile-web-page-url"]),W?.["plan-name"]&&t.set("plan-name",W["plan-name"])}l==="JSON"?t.set("Content-Type","application/json;charset=utf-8"):t.set("Content-Type","text/plain; charset=utf-8"),K?._res?.headers&&Object.entries(K._res.headers).forEach(([M,W])=>{W==null?t.removeHeader(M):t.set(M,W)}),K?._res?.status&&t.status(K._res.status);let T=await Y1({res:t,body:O,process:j.process,targetPlatform:l,source:{[j.name]:j},$options:K,executionContext:{noFlow:U}});t.send(await kf({res:t,body:T,configs:[K1({req:e,type:"sub",name:r,findShareToken:X1}),j]}))}catch(U){R.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u8BA2\u9605\u5931\u8D25",`\u274C \u65E0\u6CD5\u4E0B\u8F7D\u8BA2\u9605\uFF1A${r}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${U.message??U}`),R.error(U.message??U),Re(t,new Jt("INTERNAL_SERVER_ERROR",`Failed to download subscription: ${r}`,`Reason: ${U.message??U}`))}else R.error(`\u{1F30D} Sub-Store \u4E0B\u8F7D\u8BA2\u9605\u5931\u8D25
|
||
\u274C \u672A\u627E\u5230\u8BA2\u9605\uFF1A${r}\uFF01`),Re(t,new vt("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404)}async function py(e,t){let{name:r}=e.params;if(hr().isSubsCheckPro&&e.path?.startsWith("/share/")&&!W1(e,"col")){Re(t,new Pe("INVALID_SHARE_TOKEN","\u5206\u4EAB\u4EE4\u724C\u9519\u8BEF\u3001\u5DF2\u8FC7\u671F\u6216\u5DF2\u7528\u5C3D"),404);return}let{useMihomoExternal:n,mihomoMerge:s,mihomoMergeName:o,mihomoExternal:i,mihomoLocalPort:a}=mN(e.query),u=e.query.platform||e.query.target||f5(e.headers)||"JSON",l=R.read(zt),f=Qe(l,r),m=e.headers["user-agent"]||e.headers["User-Agent"];R.info(`\u6B63\u5728\u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\uFF1A${r}
|
||
\u8BF7\u6C42 User-Agent: ${m}
|
||
\u8BF7\u6C42 target: ${e.query.target}
|
||
\u5B9E\u9645\u8F93\u51FA: ${u}`);let{ignoreFailedRemoteSub:p,produceType:d,includeUnsupportedProxy:v,proxy:g,noCache:y}=e.query,w=e.query.prettyYaml??e.query["pretty-yaml"],E={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body,socket:{remoteAddress:e.socket?.remoteAddress}}};if(e.query.$options){let S={};try{S=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let D of e.query.$options.split("&")){let H=D.split("=")[0],K=D.split("=")[1];S[H]=K==null||K===""?!0:decodeURIComponent(K)}}R.info(`\u4F20\u5165 $options: ${JSON.stringify(S)}`),Object.assign(E,S)}if(g&&R.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${g}`),p!=null&&p!==""&&R.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u8BA2\u9605: ${p}`),d&&R.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${d}`),v&&R.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${v}`),w&&R.info(`\u6307\u5B9A\u8F93\u51FA\u6613\u8BFB YAML: ${w}`),s&&R.info(`\u6307\u5B9A\u5408\u5E76 mihomo External: ${s}`),o&&R.info(`\u6307\u5B9A\u5408\u5E76 mihomo External \u540D\u79F0: ${o}`),n&&R.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 mihomo External"),i&&R.info(`\u624B\u52A8\u6307\u5B9A\u4E86 mihomo External \u94FE\u63A5\u53C2\u6570: ${i}`),y&&R.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${y}`),e.query.noFlow&&R.info(`\u6307\u5B9A\u4E0D\u67E5\u8BE2\u8BA2\u9605\u6D41\u91CF\u4FE1\u606F: ${e.query.noFlow}`),f)try{let S=e.query.noFlow||f.noFlow,C=await _n({type:"collection",name:r,platform:u,ignoreFailedRemoteSub:p,produceType:d,produceOpts:{"include-unsupported-proxy":v,useMihomoExternal:n,merge:s,mergeName:o,mihomoExternal:i,localPort:a,prettyYaml:w},$options:E,proxy:g,noCache:y,noFlow:S,ua:m}),D;if(!S&&f.firstSubFlow!==!1){let x=R.read(Gt),j=f.subscriptions;if(j.length>0){let U=Qe(x,j[0]);if(U.source!=="local"||["localFirst","remoteFirst"].includes(U.mergeSources))try{let k=`${U.url}`.split(/[\r\n]+/).map(L=>L.trim()).filter(L=>L.length)?.[0]||"",N={},O=k.split("#");if(k=k.split("#")[0],O.length>1)try{N=JSON.parse(decodeURIComponent(O[1]))}catch{for(let T of O[1].split("&")){let M=T.split("=")[0],W=T.split("=")[1];N[M]=W==null||W===""?!0:decodeURIComponent(W)}}!U.noFlow&&!N.noFlow&&/^https?:/.test(k)&&(D=await es(N?.insecure?`${k}#insecure`:k,N.flowUserAgent,void 0,g||U.proxy||f.proxy,N.flowUrl,N.flowHeaders))}catch(k){R.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4E2D\u7684\u5B50\u8BA2\u9605 ${U.name} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${k.message??k}`)}if(!U.noFlow&&U.subUserinfo){let k;if(/^https?:\/\//.test(U.subUserinfo))try{k=await es(void 0,void 0,void 0,g||U.proxy,U.subUserinfo)}catch(N){R.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${U.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(N)}`)}else k=U.subUserinfo;D=[k,D].filter(N=>N).join("; ")}}R.info(`\u7EC4\u5408\u8BA2\u9605 ${r} \u900F\u4F20\u7684\u7684\u6D41\u91CF\u4FE1\u606F: ${D}`)}let H;if(!S)if(/^https?:\/\//.test(f.subUserinfo))try{H=await es(void 0,void 0,void 0,g||f.proxy,f.subUserinfo)}catch(x){R.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${f.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(x)}`)}else H=f.subUserinfo;let K=[H,D].filter(x=>x).join("; ");if(K){let x=Ec(K,!0);x?.["subscription-userinfo"]&&t.set("subscription-userinfo",x["subscription-userinfo"]),x?.["profile-web-page-url"]&&t.set("profile-web-page-url",x["profile-web-page-url"]),x?.["plan-name"]&&t.set("plan-name",x["plan-name"])}u==="JSON"?t.set("Content-Type","application/json;charset=utf-8"):t.set("Content-Type","text/plain; charset=utf-8"),E?._res?.headers&&Object.entries(E._res.headers).forEach(([x,j])=>{j==null?t.removeHeader(x):t.set(x,j)}),E?._res?.status&&t.status(E._res.status);let _=await Y1({res:t,body:C,process:f.process,targetPlatform:u,source:{_collection:f},$options:E,executionContext:{noFlow:S}});t.send(await kf({res:t,body:_,configs:[K1({req:e,type:"col",name:r,findShareToken:X1}),f]}))}catch(S){R.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u9519\u8BEF\uFF1A${r}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${S}`),Re(t,new Jt("INTERNAL_SERVER_ERROR",`Failed to download collection: ${r}`,`Reason: ${S.message??S}`))}else R.error("\u{1F30D} Sub-Store \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C \u672A\u627E\u5230\u7EC4\u5408\u8BA2\u9605\uFF1A${r}\uFF01`),Re(t,new vt("RESOURCE_NOT_FOUND",`Collection ${r} does not exist!`),404)}var xBe,gN=re(()=>{xBe=F(I());pN();dr();hi();pd();gt();vn();wn();Lu();r5();sy();Vh();us();li()});function vN(e){return Object.keys(e).map(An).join(", ")}function h5(e){e.post("/api/preview/sub",yle),e.post("/api/preview/collection",Ele),e.post("/api/preview/file",wle)}async function wle(e,t){try{let r=el(e.body),n="";bi(r)?n=await k4(r,{notifyTitle:"\u{1F30D} Sub-Store \u9884\u89C8\u6587\u4EF6\u5931\u8D25"}):n=await oy(r,{notifyTitle:"\u{1F30D} Sub-Store \u9884\u89C8\u6587\u4EF6\u5931\u8D25"});let s=(Array.isArray(n)?n:[n]).flat(),o=s.filter(a=>a!=null&&a!=="").join(`
|
||
`),i=Array.isArray(r.process)&&r.process.length>0?await Ft.process({$files:s,$content:o,$file:r},r.process):{$content:o,$files:s};Le(t,{original:o,processed:Sh(i?.$content??"")})}catch(r){R.error(r.message??r),Re(t,new Jt("INTERNAL_SERVER_ERROR","Failed to preview file",`Reason: ${r.message??r}`))}}async function yle(e,t){let r=e.body,n=dl(r.ignoreFailedRemoteSub);try{let s=e.query.target||"JSON",o,i;if(r.source==="local"&&!["localFirst","remoteFirst"].includes(r.mergeSources))o=r.content,i=r.content;else{let l={},f=await Promise.all(r.url.split(/[\r\n]+/).map(m=>m.trim()).filter(m=>m.length).map(async m=>{try{return await fn(m,r.ua,void 0,r.proxy,void 0,void 0,r.noCache,!0,{returnRaw:!0})}catch(p){return l[m]=p,R.error(`\u8BA2\u9605 ${r.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${An(m)} \u53D1\u751F\u9519\u8BEF: ${p}`),""}}));if(o=f.map(m=>m.result??m),i=f.map(m=>m.raw??m),Object.keys(l).length>0){let m=`\u8BA2\u9605 ${r.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${vN(l)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;Yu({mode:n,message:m,notify:()=>{R.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${r.name}`,m)}})}r.mergeSources==="localFirst"?(o.unshift(r.content),i.unshift(r.content)):r.mergeSources==="remoteFirst"&&(o.push(r.content),i.push(r.content))}let a=(Array.isArray(o)?o:[o]).map(l=>Ft.parse(l)).flat();a.forEach((l,f)=>{l.id=f,l._subName=r.name,l._subDisplayName=r.displayName});let u=await Ft.process(a,r.process||[],s,{[r.name]:r},void 0,i);Le(t,{original:a,processed:u})}catch(s){if(Lo(n)){hl({mode:n,error:s,notify:o=>{R.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${r.name}`,`\u{1F914} \u539F\u56E0\uFF1A${o.message??o}`)}}),R.error(`\u8BA2\u9605 ${r.name} \u9884\u89C8\u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${s.message??s}`),Le(t,{original:[],processed:[]});return}R.error(s.message??s),Re(t,new Jt("INTERNAL_SERVER_ERROR","Failed to preview subscription",`Reason: ${s.message??s}`))}}async function Ele(e,t){let r=e.body,n=dl(r.ignoreFailedRemoteSub);try{let s=R.read(Gt),o=[...r.subscriptions],i=r.subscriptionTags;Array.isArray(i)&&i.length>0&&s.forEach(p=>{Array.isArray(p.tag)&&p.tag.length>0&&!o.includes(p.name)&&p.tag.some(d=>i.includes(d))&&o.push(p.name)});let a={},u={},l={};if(await Promise.all(o.map(async p=>{let d=Qe(s,p),v=dl(d.ignoreFailedRemoteSub);try{let g,y;if(d.source==="local"&&!["localFirst","remoteFirst"].includes(d.mergeSources))g=d.content,y=d.content;else{let S={},C=await Promise.all(d.url.split(/[\r\n]+/).map(D=>D.trim()).filter(D=>D.length).map(async D=>{try{return await fn(D,d.ua,void 0,d.proxy,void 0,void 0,d.noCache,!0,{returnRaw:!0})}catch(H){return S[D]=H,R.error(`\u8BA2\u9605 ${d.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${An(D)} \u53D1\u751F\u9519\u8BEF: ${H}`),""}}));if(g=C.map(D=>D.result??D),y=C.map(D=>D.raw??D),Object.keys(S).length>0){let D=`\u8BA2\u9605 ${d.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${vN(S)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;Yu({mode:v,message:D,notify:()=>{R.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${d.name}`,D)}})}d.mergeSources==="localFirst"?(g.unshift(d.content),y.unshift(d.content)):d.mergeSources==="remoteFirst"&&(g.push(d.content),y.push(d.content))}let w=(Array.isArray(g)?g:[g]).map(S=>Ft.parse(S)).flat();w.forEach(S=>{S._subName=d.name,S._subDisplayName=d.displayName,S._collectionName=r.name,S._collectionDisplayName=r.displayName});let E=Array.isArray(y)?y:[y];w=await Ft.process(w,d.process||[],"JSON",{[d.name]:d,_collection:r},void 0,E),a[p]=w,l[p]=E}catch(g){if(Lo(v)){hl({mode:v,error:g,notify:y=>{R.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${d.name}`,`\u{1F914} \u539F\u56E0\uFF1A${y.message??y}`)}}),R.error(`\u8BA2\u9605 ${d.name} \u5728\u7EC4\u5408\u8BA2\u9605\u9884\u89C8\u4E2D\u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${g.message??g}`),a[p]=[],l[p]=[];return}u[p]=g,l[p]=void 0,R.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605 ${r.name} \u4E2D\u7684\u5B50\u8BA2\u9605: ${d.name} \u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${g}\uFF01`)}})),Object.keys(u).length>0){let p=`\u7EC4\u5408\u8BA2\u9605 ${r.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(u).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`,d=()=>{R.notify("\u{1F30D} Sub-Store \u9884\u89C8\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${r.name}`,p)};Object.keys(a).length>0&&Lo(n)?(Object.keys(u).forEach(g=>{l[g]=[]}),Uh(n)&&d()):Yu({mode:n,message:p,notify:d})}let f=Array.prototype.concat.apply([],o.map(p=>a[p]||[]));f.forEach((p,d)=>{p.id=d,p._collectionName=r.name,p._collectionDisplayName=r.displayName});let m=await Ft.process(f,r.process||[],"JSON",{_collection:r},void 0,l);Le(t,{original:f,processed:m})}catch(s){if(Lo(n)){hl({mode:n,error:s,notify:o=>{R.notify("\u{1F30D} Sub-Store \u9884\u89C8\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${r.name}`,`\u{1F914} \u539F\u56E0\uFF1A${o.message??o}`)}}),R.error(`\u7EC4\u5408\u8BA2\u9605 ${r.name} \u9884\u89C8\u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${s.message??s}`),Le(t,{original:[],processed:[]});return}R.error(s.message??s),Re(t,new Jt("INTERNAL_SERVER_ERROR","Failed to preview collection",`Reason: ${s.message??s}`))}}var VBe,wN=re(()=>{VBe=F(I());wn();tl();hi();vn();Nh();dr();gt();R4();Lu();_h();us();b1()});function p5(e){e.post("/api/sort/subs",ble),e.post("/api/sort/collections",Ale),e.post("/api/sort/artifacts",Sle),e.post("/api/sort/files",_le),e.post("/api/sort/tokens",Cle),e.post("/api/sort/archives",Dle)}function ble(e,t){let r=e.body,n=R.read(Gt);n.sort((s,o)=>r.indexOf(s.name)-r.indexOf(o.name)),R.write(n,Gt),Le(t,n)}function Ale(e,t){let r=e.body,n=R.read(zt);n.sort((s,o)=>r.indexOf(s.name)-r.indexOf(o.name)),R.write(n,zt),Le(t,n)}function Sle(e,t){let r=e.body,n=R.read($t);n.sort((s,o)=>r.indexOf(s.name)-r.indexOf(o.name)),R.write(n,$t),Le(t,n)}function _le(e,t){let r=e.body,n=R.read(Lt);n.sort((s,o)=>r.indexOf(s.name)-r.indexOf(o.name)),R.write(n,Lt),Le(t,n)}function Cle(e,t){let r=e.body,n=R.read(Yr);n.sort((s,o)=>r.indexOf(`${s.type}-${s.name}-${s.token}`)-r.indexOf(`${o.type}-${o.name}-${o.token}`)),R.write(n,Yr),Le(t,n)}function Dle(e,t){let r=SO(e.body);Le(t,r)}var JBe,yN=re(()=>{JBe=F(I());dr();gt();vn();fl()});function m5(e){e.post("/api/utils/node-info",Fle)}async function Fle(e,t){let r=e.body,n=e.query.lang||"zh-CN",s;try{s=Mw.URI.produce(r)}catch{}try{let i=await Oi().get({url:`http://ip-api.com/json/${encodeURIComponent(`${r.server}`.trim().replace(/^\[/,"").replace(/\]$/,""))}?lang=${n}`,headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15"}}).then(a=>{let u=JSON.parse(a.body);if(u.status!=="success")throw new Error(u.message);return delete u.status,u});Le(t,{shareUrl:s,info:i})}catch(o){Re(t,new gd("FAILED_TO_GET_NODE_INFO","Failed to get node info",`Reason: ${o}`))}}var nIe,EN=re(()=>{nIe=F(I());MC();li();vn();wn()});function g5(e){e.route("/api/proxy/parse").post(Ble),e.route("/api/rule/parse").post(Ile)}async function Ble(e,t){var r={};try{let{data:o,client:i,content:a,platform:u,download:l,type:f,produce:m}=e.body,p;l?p=await fn(...l):p=o??a;var n=Ft.parse(p),s=Ft.produce(n,i??u,f,m);r.par_res=s}catch(o){Re(t,o);return}Le(t,r)}function Ile(e,t){var r={};try{let{data:s,client:o,content:i,platform:a}=e.body,u=Rf.parse(s??i);var n=Rf.produce(u,o??a);r.par_res=n}catch(s){Re(t,s);return}Le(t,r)}var cIe,bN=re(()=>{cIe=F(I());vn();tl();C4();Nh()});function v5(e){e.route("/api/logs").get($le).delete(xle)}function $le(e,t){try{Le(t,cB(R,e.query||{}))}catch(r){if(r instanceof SyntaxError){Re(t,new Pe("INVALID_LOG_KEYWORD_REGEX","Invalid log keyword regular expression",`Reason: ${r.message??r}`),400);return}Re(t,new Jt("FAILED_TO_GET_LOGS","Failed to get logs",`Reason: ${r.message??r}`))}}function xle(e,t){try{lB(R),Le(t)}catch(r){Re(t,new Jt("FAILED_TO_CLEAR_LOGS","Failed to clear logs",`Reason: ${r.message??r}`))}}var mIe,AN=re(()=>{mIe=F(I());gt();wn();vn();vg()});function w5(e){e.post("/api/utils/age/key-pair",Rle),e.post("/api/utils/age/public-key",Tle)}async function Rle(e,t){try{let r=await KT(e.body?.type||mh.X25519);Le(t,{type:r.type,[un]:r[un],[Cs]:r[Cs]})}catch(r){Re(t,r)}}async function Tle(e,t){try{let r=await yf(e.body?.[un]);Le(t,{[Cs]:r})}catch(r){Re(t,r)}}var yIe,SN=re(()=>{yIe=F(I());vn();us()});function y5(){return Us(()=>Yo("path"))}var AIe,_N=re(()=>{AIe=F(I());hc()});function Ple(e,t){return(t==="/"?e:e.replace(t,""))||"/"}function CN(e,t,r){return t!=="/"?e.startsWith(t):/^\/(api|download|share)(\/|$)/.test(e)&&(!r||!e.startsWith("/share/"))}function E5(){let port,host;R.env.isNode&&(port=eval("process.env.SUB_STORE_BACKEND_API_PORT")||3e3,host=eval("process.env.SUB_STORE_BACKEND_API_HOST")||"::");let $app=Kb({substore:R,port,host});if(R.env.isNode){let be_merge=eval("process.env.SUB_STORE_BACKEND_MERGE"),be_prefix=eval("process.env.SUB_STORE_BACKEND_PREFIX"),fe_be_path=eval("process.env.SUB_STORE_FRONTEND_BACKEND_PATH"),fe_path=eval("process.env.SUB_STORE_FRONTEND_PATH"),mergedFrontend=be_merge&&fe_path?W4(fe_path,"/index.html"):null;if(be_prefix||be_merge){if(!fe_be_path?.startsWith("/"))throw new Error('SUB_STORE_FRONTEND_BACKEND_PATH must be set and start with "/" when SUB_STORE_BACKEND_PREFIX or SUB_STORE_BACKEND_MERGE is enabled');be_merge&&(R.info("[BACKEND] MERGE mode is [ON]."),R.info(`[BACKEND && FRONTEND] ${host}:${port}`)),R.info(`[BACKEND PREFIX] ${host}:${port}${fe_be_path==="/"?"":fe_be_path}`),$app.use((e,t,r)=>{if(CN(e.path,fe_be_path,be_merge)){e.url=Ple(e.url,fe_be_path),be_merge&&e.url.startsWith("/api/")&&(e.query.share="true"),r();return}let n=decodeURIComponent(e._parsedUrl.pathname)||"/";if(be_merge&&e.path.startsWith("/share/")&&e.query.token){if(e.method.toLowerCase()!=="get"){t.status(405).send("Method not allowed");return}let o=fy({token:e.query.token,pathname:n});if(o){e.subStoreShareToken=o,r();return}else if((R.read(pt)||{})?.appearanceSetting?.invalidShareFakeNode){e.query._fakeNode=!0,e.url=e.url.replace(/\/share\/.*?\//,"/share/sub/"),r();return}}let s=CN(e.path,"/",!1);if(mergedFrontend&&!s){mergedFrontend(e,t,r);return}t.status(404).end()})}}if(Q4($app),X4($app),d5($app),h5($app),p5($app),M4($app),I4($app),o5($app),s5($app),c5($app),l5($app),T4($app),m5($app),z4($app),g5($app),v5($app),w5($app),$app.start(),R.env.isNode){fI(N4);let backend_sync_cron=eval("process.env.SUB_STORE_BACKEND_SYNC_CRON");if(backend_sync_cron){R.info(`[SYNC CRON] ${backend_sync_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_sync_cron,async function(){try{R.info(`[SYNC CRON] ${backend_sync_cron} started`),await O4({skipCronArtifacts:!0}),R.info(`[SYNC CRON] ${backend_sync_cron} finished`)}catch(e){R.error(`[SYNC CRON] ${backend_sync_cron} error: ${e.message??e}`)}},null,!0)}else eval("process.env.SUB_STORE_BACKEND_CRON")&&R.error("[SYNC CRON] SUB_STORE_BACKEND_CRON \u5DF2\u5F03\u7528, \u8BF7\u4F7F\u7528 SUB_STORE_BACKEND_SYNC_CRON"),eval("process.env.SUB_STORE_CRON")&&R.error("[SYNC CRON] SUB_STORE_CRON \u5DF2\u5F03\u7528, \u8BF7\u4F7F\u7528 SUB_STORE_BACKEND_SYNC_CRON");let produce_cron=eval("process.env.SUB_STORE_PRODUCE_CRON");if(produce_cron){R.info(`[PRODUCE CRON] ${produce_cron} enabled`);let{CronJob}=require("cron");produce_cron.split(/\s*;\s*/).map(e=>e.trim()).filter(e=>e.length>0).forEach(e=>{let[t,r,n]=e.split(/\s*,\s*/);R.info(`[PRODUCE CRON] ${r} ${n} ${t} scheduled`),new CronJob(t.trim(),async function(){try{R.info(`[PRODUCE CRON] ${r} ${n} ${t} started`),await _n({type:r,name:n}),R.info(`[PRODUCE CRON] ${r} ${n} ${t} finished`)}catch(s){R.error(`[PRODUCE CRON] ${r} ${n} ${t} error: ${s.message??s}`)}},null,!0)})}let backend_download_cron=eval("process.env.SUB_STORE_BACKEND_DOWNLOAD_CRON");if(backend_download_cron){R.info(`[DOWNLOAD CRON] ${backend_download_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_download_cron,async function(){try{R.info(`[DOWNLOAD CRON] ${backend_download_cron} started`),await uy("download"),R.info(`[DOWNLOAD CRON] ${backend_download_cron} finished`)}catch(e){R.error(`[DOWNLOAD CRON] ${backend_download_cron} error: ${e.message??e}`)}},null,!0)}let backend_upload_cron=eval("process.env.SUB_STORE_BACKEND_UPLOAD_CRON");if(backend_upload_cron){R.info(`[UPLOAD CRON] ${backend_upload_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_upload_cron,async function(){try{R.info(`[UPLOAD CRON] ${backend_upload_cron} started`),await uy("upload"),R.info(`[UPLOAD CRON] ${backend_upload_cron} finished`)}catch(e){R.error(`[UPLOAD CRON] ${backend_upload_cron} error: ${e.message??e}`)}},null,!0)}let mmdb_cron=eval("process.env.SUB_STORE_MMDB_CRON"),countryFile=eval("process.env.SUB_STORE_MMDB_COUNTRY_PATH"),countryUrl=eval("process.env.SUB_STORE_MMDB_COUNTRY_URL"),asnFile=eval("process.env.SUB_STORE_MMDB_ASN_PATH"),asnUrl=eval("process.env.SUB_STORE_MMDB_ASN_URL");if(mmdb_cron&&(countryFile&&countryUrl||asnFile&&asnUrl)){R.info(`[MMDB CRON] ${mmdb_cron} enabled`);let{CronJob}=require("cron");new CronJob(mmdb_cron,async function(){try{if(R.info(`[MMDB CRON] ${mmdb_cron} started`),countryFile&&countryUrl)try{R.info(`[MMDB CRON] downloading ${countryUrl} to ${countryFile}`),await q1(countryUrl,countryFile)}catch(e){R.error(`[MMDB CRON] ${countryUrl} download failed: ${e.message??e}`)}if(asnFile&&asnUrl)try{R.info(`[MMDB CRON] downloading ${asnUrl} to ${asnFile}`),await q1(asnUrl,asnFile)}catch(e){R.error(`[MMDB CRON] ${asnUrl} download failed: ${e.message??e}`)}R.info(`[MMDB CRON] ${mmdb_cron} finished`)}catch(e){R.error(`[MMDB CRON] ${mmdb_cron} error: ${e.message??e}`)}},null,!0)}let path=y5(),fs=Pi(),data_url=eval("process.env.SUB_STORE_DATA_URL"),data_url_post=eval("process.env.SUB_STORE_DATA_URL_POST"),fe_be_path=eval("process.env.SUB_STORE_FRONTEND_BACKEND_PATH"),fe_port=eval("process.env.SUB_STORE_FRONTEND_PORT")||3001,fe_host=eval("process.env.SUB_STORE_FRONTEND_HOST")||host||"::",fe_path=eval("process.env.SUB_STORE_FRONTEND_PATH"),fe_abs_path=path.resolve(fe_path||path.join(__dirname,"frontend")),be_merge=eval("process.env.SUB_STORE_BACKEND_MERGE");if(fe_path&&!be_merge){try{fs.accessSync(path.join(fe_abs_path,"index.html"))}catch(e){R.error(`[FRONTEND] index.html file not found in ${fe_abs_path}`)}let express_=require("express"),history=require("connect-history-api-fallback"),{createProxyMiddleware}=require("http-proxy-middleware"),app=express_(),staticFileMiddleware=W4(fe_path),be_api="/api/",be_download="/download/",be_share="/share/",be_download_rewrite="",be_api_rewrite="",be_share_rewrite=`${be_share}:type/:name`,prefix=eval("process.env.SUB_STORE_BACKEND_PREFIX")?fe_be_path:"";if(fe_be_path){if(!fe_be_path.startsWith("/"))throw new Error('SUB_STORE_FRONTEND_BACKEND_PATH must start with "/"');be_api_rewrite=`${fe_be_path==="/"?"":fe_be_path}${be_api}`,be_download_rewrite=`${fe_be_path==="/"?"":fe_be_path}${be_download}`,app.use(be_share_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}`,changeOrigin:!0,pathRewrite:async(e,t)=>{if(t.method.toLowerCase()!=="get")throw new Error("Method not allowed");let r=fy({token:t.query.token,type:t.params.type,name:t.params.name});return r?(r?.[Cs]&&(t.headers["x-sub-store-share-age-public-key"]=r[Cs]),t.originalUrl):(R.read(pt)||{})?.appearanceSetting?.invalidShareFakeNode?t.originalUrl.replace(/\/share\/.*?\//,"/share/sub/").replace("?","?_fakeNode=true&"):"/404"}})),app.use(be_api_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}${be_api}`,pathRewrite:async e=>e.includes("?")?`${e}&share=true`:`${e}?share=true`})),app.use(be_download_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}${be_download}`,changeOrigin:!0}))}app.use(staticFileMiddleware),app.use(history({disableDotRule:!0,verbose:!1})),app.use(staticFileMiddleware);let listener=app.listen(fe_port,fe_host,()=>{let{address:e,port:t}=listener.address();R.info(`[FRONTEND] ${e}:${t}`),fe_be_path&&(R.info(`[FRONTEND -> BACKEND] ${e}:${t}${be_api_rewrite} -> ${host}:${port}${prefix}${be_api}`),R.info(`[FRONTEND -> BACKEND] ${e}:${t}${be_download_rewrite} -> ${host}:${port}${prefix}${be_download}`),R.info(`[SHARE BACKEND] ${e}:${t}${be_share_rewrite}`))})}data_url&&(R.info(`[BACKEND] downloading data from ${data_url}`),fn(data_url).then(async content=>{try{if(content=JSON.parse(mt.decode(content)),!(Object.keys(content.settings).length>=0))throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(e){try{if(content=JSON.parse(content),!(Object.keys(content.settings).length>=0))throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(t){throw R.error(`Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F
|
||
Reason: ${t.message??t}`),new Error("Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F")}}data_url_post&&(R.info("[BACKEND] executing post-processing script"),eval(data_url_post)),R.write(JSON.stringify(content,null," "),"#sub-store"),R.cache=content,R.persistCache(),vc(),R.info(`[BACKEND] restored data from ${data_url}`)}).catch(e=>{throw R.error("[BACKEND] restore data failed"),console.error(e),e}))}}var t$e,kle,DN=re(()=>{t$e=F(I());Xo();kle=F(ho());GB();gt();Ag();Nh();Lu();Y4();dr();jg();JO();Z4();t5();ry();u5();Vh();dN();hN();Lu();gN();q4();wN();yN();Y4();EN();bN();AN();SN();Vh();us();od();_N()});var Ole=be((b5,A5)=>{var a$e=F(I());Rb();gt();kB();Ag();DN();console.log(`
|
||
\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505
|
||
Sub-Store -- v${hg}
|
||
\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505
|
||
`);if(R.env.isNode){typeof Promise.withResolvers!="function"&&require('core-js/actual/promise/with-resolvers');let workerThreads=Mb();typeof workerThreads.markAsUncloneable!="function"&&(workerThreads.markAsUncloneable=()=>{}),eval("process").on("uncaughtExceptionMonitor",(e,t)=>{console.error(`[FATAL] ${t}: ${e?.stack??e}`)})}vc();E5()});Ole();})();
|
||
/*! Bundled license information:
|
||
|
||
lodash/lodash.js:
|
||
(**
|
||
* @license
|
||
* Lodash <https://lodash.com/>
|
||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||
* Released under MIT license <https://lodash.com/license>
|
||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
*)
|
||
|
||
ieee754/index.js:
|
||
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
||
|
||
buffer/index.js:
|
||
(*!
|
||
* The buffer module from node.js, for the browser.
|
||
*
|
||
* @author Feross Aboukhadijeh <https://feross.org>
|
||
* @license MIT
|
||
*)
|
||
|
||
jsrsasign/lib/jsrsasign.js:
|
||
(*! CryptoJS v3.1.2 core-fix.js
|
||
* code.google.com/p/crypto-js
|
||
* (c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
* code.google.com/p/crypto-js/wiki/License
|
||
* THIS IS FIX of 'core.js' to fix Hmac issue.
|
||
* https://code.google.com/p/crypto-js/issues/detail?id=84
|
||
* https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js
|
||
*)
|
||
(*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*)
|
||
(*! (c) Tom Wu, Kenji Urushima | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*)
|
||
(*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
|
||
*)
|
||
(*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
|
||
*)
|
||
|
||
@scure/base/index.js:
|
||
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||
|
||
@noble/ciphers/utils.js:
|
||
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
|
||
|
||
@noble/hashes/utils.js:
|
||
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||
|
||
@noble/curves/utils.js:
|
||
@noble/curves/abstract/modular.js:
|
||
@noble/curves/abstract/curve.js:
|
||
@noble/curves/abstract/montgomery.js:
|
||
@noble/curves/abstract/weierstrass.js:
|
||
@noble/curves/ed25519.js:
|
||
@noble/curves/nist.js:
|
||
@noble/curves/utils.js:
|
||
@noble/curves/abstract/modular.js:
|
||
@noble/curves/abstract/curve.js:
|
||
@noble/curves/abstract/weierstrass.js:
|
||
@noble/curves/nist.js:
|
||
@noble/curves/abstract/edwards.js:
|
||
@noble/curves/abstract/montgomery.js:
|
||
@noble/curves/ed25519.js:
|
||
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||
|
||
@noble/post-quantum/utils.js:
|
||
@noble/post-quantum/_crystals.js:
|
||
@noble/post-quantum/ml-kem.js:
|
||
@noble/post-quantum/hybrid.js:
|
||
(*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) *)
|
||
*/
|