Files
Sub-Store/cron-sync-artifacts.min.js
T
2026-11-26 15:50:27 +00:00

1910 lines
1.2 MiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(()=>{var BO=Object.create;var Qv=Object.defineProperty;var IO=Object.getOwnPropertyDescriptor;var $O=Object.getOwnPropertyNames;var xO=Object.getPrototypeOf,PO=Object.prototype.hasOwnProperty;var wu=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kO=(e,t)=>{for(var n in t)Qv(e,n,{get:t[n],enumerable:!0})},TO=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $O(t))!PO.call(e,i)&&i!==n&&Qv(e,i,{get:()=>t[i],enumerable:!(r=IO(t,i))||r.enumerable});return e};var B=(e,t,n)=>(n=e!=null?BO(xO(e)):{},TO(t||!e||!e.__esModule?Qv(n,"default",{value:e,enumerable:!0}):n,e));var xs=be((ew,L5)=>{"use strict";var Ute=B(x()),Wh=function(e){return e&&e.Math===Math&&e};L5.exports=Wh(typeof globalThis=="object"&&globalThis)||Wh(typeof window=="object"&&window)||Wh(typeof self=="object"&&self)||Wh(typeof global=="object"&&global)||Wh(typeof ew=="object"&&ew)||(function(){return this})()||Function("return this")()});var sa=be((Hte,U5)=>{"use strict";var Mte=B(x());U5.exports=function(e){try{return!!e()}catch{return!0}}});var yu=be((qte,H5)=>{"use strict";var jte=B(x()),RO=sa();H5.exports=!RO(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var tw=be((Kte,M5)=>{"use strict";var Vte=B(x()),OO=sa();M5.exports=!OO(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")})});var j0=be((Gte,q5)=>{"use strict";var zte=B(x()),NO=tw(),q0=Function.prototype.call;q5.exports=NO?q0.bind(q0):function(){return q0.apply(q0,arguments)}});var G5=be(V5=>{"use strict";var Yte=B(x()),j5={}.propertyIsEnumerable,K5=Object.getOwnPropertyDescriptor,LO=K5&&!j5.call({1:2},1);V5.f=LO?function(t){var n=K5(this,t);return!!n&&n.enumerable}:j5});var nw=be((Xte,z5)=>{"use strict";var Zte=B(x());z5.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}});var io=be((Jte,X5)=>{"use strict";var Qte=B(x()),W5=tw(),Y5=Function.prototype,rw=Y5.call,UO=W5&&Y5.bind.bind(rw,rw);X5.exports=W5?UO:function(e){return function(){return rw.apply(e,arguments)}}});var Q5=be((ene,J5)=>{"use strict";var tne=B(x()),Z5=io(),HO=Z5({}.toString),MO=Z5("".slice);J5.exports=function(e){return MO(HO(e),8,-1)}});var t4=be((nne,e4)=>{"use strict";var rne=B(x()),qO=io(),jO=sa(),KO=Q5(),sw=Object,VO=qO("".split);e4.exports=jO(function(){return!sw("z").propertyIsEnumerable(0)})?function(e){return KO(e)==="String"?VO(e,""):sw(e)}:sw});var iw=be((sne,n4)=>{"use strict";var ine=B(x());n4.exports=function(e){return e==null}});var ow=be((one,r4)=>{"use strict";var ane=B(x()),GO=iw(),zO=TypeError;r4.exports=function(e){if(GO(e))throw new zO("Can't call method on "+e);return e}});var K0=be((une,s4)=>{"use strict";var cne=B(x()),WO=t4(),YO=ow();s4.exports=function(e){return WO(YO(e))}});var Ci=be((lne,i4)=>{"use strict";var fne=B(x()),aw=typeof document=="object"&&document.all;i4.exports=typeof aw>"u"&&aw!==void 0?function(e){return typeof e=="function"||e===aw}:function(e){return typeof e=="function"}});var Vl=be((hne,o4)=>{"use strict";var dne=B(x()),XO=Ci();o4.exports=function(e){return typeof e=="object"?e!==null:XO(e)}});var cw=be((pne,a4)=>{"use strict";var mne=B(x()),uw=xs(),ZO=Ci(),JO=function(e){return ZO(e)?e:void 0};a4.exports=function(e,t){return arguments.length<2?JO(uw[e]):uw[e]&&uw[e][t]}});var c4=be((gne,u4)=>{"use strict";var vne=B(x()),QO=io();u4.exports=QO({}.isPrototypeOf)});var d4=be((wne,h4)=>{"use strict";var yne=B(x()),eN=xs(),l4=eN.navigator,f4=l4&&l4.userAgent;h4.exports=f4?String(f4):""});var E4=be((Ene,y4)=>{"use strict";var bne=B(x()),w4=xs(),lw=d4(),p4=w4.process,m4=w4.Deno,g4=p4&&p4.versions||m4&&m4.version,v4=g4&&g4.v8,_i,V0;v4&&(_i=v4.split("."),V0=_i[0]>0&&_i[0]<4?1:+(_i[0]+_i[1]));!V0&&lw&&(_i=lw.match(/Edge\/(\d+)/),(!_i||_i[1]>=74)&&(_i=lw.match(/Chrome\/(\d+)/),_i&&(V0=+_i[1])));y4.exports=V0});var fw=be((Ane,A4)=>{"use strict";var Sne=B(x()),b4=E4(),tN=sa(),nN=xs(),rN=nN.String;A4.exports=!!Object.getOwnPropertySymbols&&!tN(function(){var e=Symbol("symbol detection");return!rN(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&b4&&b4<41})});var hw=be((Cne,S4)=>{"use strict";var _ne=B(x()),sN=fw();S4.exports=sN&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var dw=be((Dne,C4)=>{"use strict";var Fne=B(x()),iN=cw(),oN=Ci(),aN=c4(),uN=hw(),cN=Object;C4.exports=uN?function(e){return typeof e=="symbol"}:function(e){var t=iN("Symbol");return oN(t)&&aN(t.prototype,cN(e))}});var D4=be((Bne,_4)=>{"use strict";var Ine=B(x()),lN=String;_4.exports=function(e){try{return lN(e)}catch{return"Object"}}});var B4=be(($ne,F4)=>{"use strict";var xne=B(x()),fN=Ci(),hN=D4(),dN=TypeError;F4.exports=function(e){if(fN(e))return e;throw new dN(hN(e)+" is not a function")}});var $4=be((Pne,I4)=>{"use strict";var kne=B(x()),pN=B4(),mN=iw();I4.exports=function(e,t){var n=e[t];return mN(n)?void 0:pN(n)}});var P4=be((Tne,x4)=>{"use strict";var Rne=B(x()),pw=j0(),mw=Ci(),gw=Vl(),gN=TypeError;x4.exports=function(e,t){var n,r;if(t==="string"&&mw(n=e.toString)&&!gw(r=pw(n,e))||mw(n=e.valueOf)&&!gw(r=pw(n,e))||t!=="string"&&mw(n=e.toString)&&!gw(r=pw(n,e)))return r;throw new gN("Can't convert object to primitive value")}});var T4=be((One,k4)=>{"use strict";var Nne=B(x());k4.exports=!1});var G0=be((Lne,O4)=>{"use strict";var Une=B(x()),R4=xs(),vN=Object.defineProperty;O4.exports=function(e,t){try{vN(R4,e,{value:t,configurable:!0,writable:!0})}catch{R4[e]=t}return t}});var z0=be((Hne,U4)=>{"use strict";var Mne=B(x()),wN=T4(),yN=xs(),EN=G0(),N4="__core-js_shared__",L4=U4.exports=yN[N4]||EN(N4,{});(L4.versions||(L4.versions=[])).push({version:"3.49.0",mode:wN?"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 vw=be((qne,M4)=>{"use strict";var jne=B(x()),H4=z0();M4.exports=function(e,t){return H4[e]||(H4[e]=t||{})}});var j4=be((Kne,q4)=>{"use strict";var Vne=B(x()),bN=ow(),AN=Object;q4.exports=function(e){return AN(bN(e))}});var ia=be((Gne,K4)=>{"use strict";var zne=B(x()),SN=io(),CN=j4(),_N=SN({}.hasOwnProperty);K4.exports=Object.hasOwn||function(t,n){return _N(CN(t),n)}});var ww=be((Wne,V4)=>{"use strict";var Yne=B(x()),DN=io(),FN=0,BN=Math.random(),IN=DN(1.1.toString);V4.exports=function(e){return"Symbol("+(e===void 0?"":e)+")_"+IN(++FN+BN,36)}});var W4=be((Xne,z4)=>{"use strict";var Zne=B(x()),$N=xs(),xN=vw(),G4=ia(),PN=ww(),kN=fw(),TN=hw(),Gl=$N.Symbol,yw=xN("wks"),RN=TN?Gl.for||Gl:Gl&&Gl.withoutSetter||PN;z4.exports=function(e){return G4(yw,e)||(yw[e]=kN&&G4(Gl,e)?Gl[e]:RN("Symbol."+e)),yw[e]}});var J4=be((Jne,Z4)=>{"use strict";var Qne=B(x()),ON=j0(),Y4=Vl(),X4=dw(),NN=$4(),LN=P4(),UN=W4(),HN=TypeError,MN=UN("toPrimitive");Z4.exports=function(e,t){if(!Y4(e)||X4(e))return e;var n=NN(e,MN),r;if(n){if(t===void 0&&(t="default"),r=ON(n,e,t),!Y4(r)||X4(r))return r;throw new HN("Can't convert object to primitive value")}return t===void 0&&(t="number"),LN(e,t)}});var Ew=be((ere,Q4)=>{"use strict";var tre=B(x()),qN=J4(),jN=dw();Q4.exports=function(e){var t=qN(e,"string");return jN(t)?t:t+""}});var n3=be((nre,t3)=>{"use strict";var rre=B(x()),KN=xs(),e3=Vl(),bw=KN.document,VN=e3(bw)&&e3(bw.createElement);t3.exports=function(e){return VN?bw.createElement(e):{}}});var Aw=be((sre,r3)=>{"use strict";var ire=B(x()),GN=yu(),zN=sa(),WN=n3();r3.exports=!GN&&!zN(function(){return Object.defineProperty(WN("div"),"a",{get:function(){return 7}}).a!==7})});var Sw=be(i3=>{"use strict";var are=B(x()),YN=yu(),XN=j0(),ZN=G5(),JN=nw(),QN=K0(),eL=Ew(),tL=ia(),nL=Aw(),s3=Object.getOwnPropertyDescriptor;i3.f=YN?s3:function(t,n){if(t=QN(t),n=eL(n),nL)try{return s3(t,n)}catch{}if(tL(t,n))return JN(!XN(ZN.f,t,n),t[n])}});var a3=be((ure,o3)=>{"use strict";var cre=B(x()),rL=yu(),sL=sa();o3.exports=rL&&sL(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Cw=be((lre,u3)=>{"use strict";var fre=B(x()),iL=Vl(),oL=String,aL=TypeError;u3.exports=function(e){if(iL(e))return e;throw new aL(oL(e)+" is not an object")}});var Y0=be(l3=>{"use strict";var dre=B(x()),uL=yu(),cL=Aw(),lL=a3(),W0=Cw(),c3=Ew(),fL=TypeError,_w=Object.defineProperty,hL=Object.getOwnPropertyDescriptor,Dw="enumerable",Fw="configurable",Bw="writable";l3.f=uL?lL?function(t,n,r){if(W0(t),n=c3(n),W0(r),typeof t=="function"&&n==="prototype"&&"value"in r&&Bw in r&&!r[Bw]){var i=hL(t,n);i&&i[Bw]&&(t[n]=r.value,r={configurable:Fw in r?r[Fw]:i[Fw],enumerable:Dw in r?r[Dw]:i[Dw],writable:!1})}return _w(t,n,r)}:_w:function(t,n,r){if(W0(t),n=c3(n),W0(r),cL)try{return _w(t,n,r)}catch{}if("get"in r||"set"in r)throw new fL("Accessors not supported");return"value"in r&&(t[n]=r.value),t}});var Iw=be((pre,f3)=>{"use strict";var mre=B(x()),dL=yu(),pL=Y0(),mL=nw();f3.exports=dL?function(e,t,n){return pL.f(e,t,mL(1,n))}:function(e,t,n){return e[t]=n,e}});var p3=be((gre,d3)=>{"use strict";var vre=B(x()),$w=yu(),gL=ia(),h3=Function.prototype,vL=$w&&Object.getOwnPropertyDescriptor,xw=gL(h3,"name"),wL=xw&&function(){}.name==="something",yL=xw&&(!$w||$w&&vL(h3,"name").configurable);d3.exports={EXISTS:xw,PROPER:wL,CONFIGURABLE:yL}});var g3=be((wre,m3)=>{"use strict";var yre=B(x()),EL=io(),bL=Ci(),Pw=z0(),AL=EL(Function.toString);bL(Pw.inspectSource)||(Pw.inspectSource=function(e){return AL(e)});m3.exports=Pw.inspectSource});var y3=be((Ere,w3)=>{"use strict";var bre=B(x()),SL=xs(),CL=Ci(),v3=SL.WeakMap;w3.exports=CL(v3)&&/native code/.test(String(v3))});var A3=be((Are,b3)=>{"use strict";var Sre=B(x()),_L=vw(),DL=ww(),E3=_L("keys");b3.exports=function(e){return E3[e]||(E3[e]=DL(e))}});var kw=be((Cre,S3)=>{"use strict";var _re=B(x());S3.exports={}});var F3=be((Dre,D3)=>{"use strict";var Fre=B(x()),FL=y3(),_3=xs(),BL=Vl(),IL=Iw(),Tw=ia(),Rw=z0(),$L=A3(),xL=kw(),C3="Object already initialized",Ow=_3.TypeError,PL=_3.WeakMap,X0,Yh,Z0,kL=function(e){return Z0(e)?Yh(e):X0(e,{})},TL=function(e){return function(t){var n;if(!BL(t)||(n=Yh(t)).type!==e)throw new Ow("Incompatible receiver, "+e+" required");return n}};FL||Rw.state?(Di=Rw.state||(Rw.state=new PL),Di.get=Di.get,Di.has=Di.has,Di.set=Di.set,X0=function(e,t){if(Di.has(e))throw new Ow(C3);return t.facade=e,Di.set(e,t),t},Yh=function(e){return Di.get(e)||{}},Z0=function(e){return Di.has(e)}):(Sc=$L("state"),xL[Sc]=!0,X0=function(e,t){if(Tw(e,Sc))throw new Ow(C3);return t.facade=e,IL(e,Sc,t),t},Yh=function(e){return Tw(e,Sc)?e[Sc]:{}},Z0=function(e){return Tw(e,Sc)});var Di,Sc;D3.exports={set:X0,get:Yh,has:Z0,enforce:kL,getterFor:TL}});var x3=be((Bre,$3)=>{"use strict";var Ire=B(x()),Lw=io(),RL=sa(),OL=Ci(),J0=ia(),Nw=yu(),NL=p3().CONFIGURABLE,LL=g3(),I3=F3(),UL=I3.enforce,HL=I3.get,B3=String,Q0=Object.defineProperty,ML=Lw("".slice),qL=Lw("".replace),jL=Lw([].join),KL=Nw&&!RL(function(){return Q0(function(){},"length",{value:8}).length!==8}),VL=String(String).split("String"),GL=$3.exports=function(e,t,n){ML(B3(t),0,7)==="Symbol("&&(t="["+qL(B3(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!J0(e,"name")||NL&&e.name!==t)&&(Nw?Q0(e,"name",{value:t,configurable:!0}):e.name=t),KL&&n&&J0(n,"arity")&&e.length!==n.arity&&Q0(e,"length",{value:n.arity});try{n&&J0(n,"constructor")&&n.constructor?Nw&&Q0(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var r=UL(e);return J0(r,"source")||(r.source=jL(VL,typeof t=="string"?t:"")),e};Function.prototype.toString=GL(function(){return OL(this)&&HL(this).source||LL(this)},"toString")});var k3=be(($re,P3)=>{"use strict";var xre=B(x()),zL=Ci(),WL=Y0(),YL=x3(),XL=G0();P3.exports=function(e,t,n,r){r||(r={});var i=r.enumerable,o=r.name!==void 0?r.name:t;if(zL(n)&&YL(n,o,r),r.global)i?e[t]=n:XL(t,n);else{try{r.unsafe?e[t]&&(i=!0):delete e[t]}catch{}i?e[t]=n:WL.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e}});var R3=be((Pre,T3)=>{"use strict";var kre=B(x()),ZL=Math.ceil,JL=Math.floor;T3.exports=Math.trunc||function(t){var n=+t;return(n>0?JL:ZL)(n)}});var Uw=be((Tre,O3)=>{"use strict";var Rre=B(x()),QL=R3();O3.exports=function(e){var t=+e;return t!==t||t===0?0:QL(t)}});var L3=be((Ore,N3)=>{"use strict";var Nre=B(x()),eU=Uw(),tU=Math.max,nU=Math.min;N3.exports=function(e,t){var n=eU(e);return n<0?tU(n+t,0):nU(n,t)}});var H3=be((Lre,U3)=>{"use strict";var Ure=B(x()),rU=Uw(),sU=Math.min;U3.exports=function(e){var t=rU(e);return t>0?sU(t,9007199254740991):0}});var q3=be((Hre,M3)=>{"use strict";var Mre=B(x()),iU=H3();M3.exports=function(e){return iU(e.length)}});var V3=be((qre,K3)=>{"use strict";var jre=B(x()),oU=K0(),aU=L3(),uU=q3(),j3=function(e){return function(t,n,r){var i=oU(t),o=uU(i);if(o===0)return!e&&-1;var s=aU(r,o),a;if(e&&n!==n){for(;o>s;)if(a=i[s++],a!==a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return!e&&-1}};K3.exports={includes:j3(!0),indexOf:j3(!1)}});var W3=be((Kre,z3)=>{"use strict";var Vre=B(x()),cU=io(),Hw=ia(),lU=K0(),fU=V3().indexOf,hU=kw(),G3=cU([].push);z3.exports=function(e,t){var n=lU(e),r=0,i=[],o;for(o in n)!Hw(hU,o)&&Hw(n,o)&&G3(i,o);for(;t.length>r;)Hw(n,o=t[r++])&&(~fU(i,o)||G3(i,o));return i}});var X3=be((Gre,Y3)=>{"use strict";var zre=B(x());Y3.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var J3=be(Z3=>{"use strict";var Yre=B(x()),dU=W3(),pU=X3(),mU=pU.concat("length","prototype");Z3.f=Object.getOwnPropertyNames||function(t){return dU(t,mU)}});var eC=be(Q3=>{"use strict";var Zre=B(x());Q3.f=Object.getOwnPropertySymbols});var nC=be((Jre,tC)=>{"use strict";var Qre=B(x()),gU=cw(),vU=io(),wU=J3(),yU=eC(),EU=Cw(),bU=vU([].concat);tC.exports=gU("Reflect","ownKeys")||function(t){var n=wU.f(EU(t)),r=yU.f;return r?bU(n,r(t)):n}});var iC=be((ese,sC)=>{"use strict";var tse=B(x()),rC=ia(),AU=nC(),SU=Sw(),CU=Y0();sC.exports=function(e,t,n){for(var r=AU(t),i=CU.f,o=SU.f,s=0;s<r.length;s++){var a=r[s];!rC(e,a)&&!(n&&rC(n,a))&&i(e,a,o(t,a))}}});var aC=be((nse,oC)=>{"use strict";var rse=B(x()),_U=sa(),DU=Ci(),FU=/#|\.prototype\./,Xh=function(e,t){var n=IU[BU(e)];return n===xU?!0:n===$U?!1:DU(t)?_U(t):!!t},BU=Xh.normalize=function(e){return String(e).replace(FU,".").toLowerCase()},IU=Xh.data={},$U=Xh.NATIVE="N",xU=Xh.POLYFILL="P";oC.exports=Xh});var cC=be((sse,uC)=>{"use strict";var ise=B(x()),e1=xs(),PU=Sw().f,kU=Iw(),TU=k3(),RU=G0(),OU=iC(),NU=aC();uC.exports=function(e,t){var n=e.target,r=e.global,i=e.stat,o,s,a,u,l,h;if(r?s=e1:i?s=e1[n]||RU(n,{}):s=e1[n]&&e1[n].prototype,s)for(a in t){if(l=t[a],e.dontCallGetSet?(h=PU(s,a),u=h&&h.value):u=s[a],o=NU(r?a:n+(i?".":"#")+a,e.forced),!o&&u!==void 0){if(typeof l==typeof u)continue;OU(l,u)}(e.sham||u&&u.sham)&&kU(l,"sham",!0),TU(s,a,l,e)}}});var lC=be(()=>{"use strict";var use=B(x()),LU=cC(),UU=ia();LU({target:"Object",stat:!0},{hasOwn:UU})});var hC=be((cse,fC)=>{"use strict";var lse=B(x()),HU=xs();fC.exports=HU});var pC=be((fse,dC)=>{"use strict";var hse=B(x());lC();var MU=hC();dC.exports=MU.Object.hasOwn});var gC=be((dse,mC)=>{"use strict";var pse=B(x()),qU=pC();mC.exports=qU});var x=be((mse,vC)=>{"use strict";var jU=gC();vC.exports=jU});var bC=be(EC=>{"use strict";var Ese=B(x());(function(e){function t(){}function n(){}var r=String.fromCharCode,i={}.toString,o=i.call(e.SharedArrayBuffer),s=i(),a=e.Uint8Array,u=a||Array,l=a?ArrayBuffer:u,h=l.isView||function(v){return v&&"length"in v},m=i.call(l.prototype);l=n.prototype;var p=e.TextEncoder,d=new(a?Uint16Array:u)(32);t.prototype.decode=function(v){if(!h(v)){var g=i.call(v);if(g!==m&&g!==o&&g!==s)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,C=E-32|0,_,F,H=0,K=0,S,I=0,q=-1;w<E;){for(_=w<=C?32:E-w|0;I<_;w=w+1|0,I=I+1|0){switch(F=v[w]&255,F>>4){case 15:if(S=v[w=w+1|0]&255,S>>6!==2||247<F){w=w-1|0;break}H=(F&7)<<6|S&63,K=5,F=256;case 14:S=v[w=w+1|0]&255,H<<=6,H|=(F&15)<<6|S&63,K=S>>6===2?K+4|0:24,F=F+256&768;case 13:case 12:S=v[w=w+1|0]&255,H<<=6,H|=(F&31)<<6|S&63,K=K+7|0,w<E&&S>>6===2&&H>>K&&1114112>H?(F=H,H=H-65536|0,0<=H&&(q=(H>>10)+55296|0,F=(H&1023)+56320|0,31>I?(d[I]=q,I=I+1|0,q=-1):(S=q,q=F,F=S))):(F>>=8,w=w-F-1|0,F=65533),H=K=0,_=w<=C?32:E-w|0;default:d[I]=F;continue;case 11:case 10:case 9:case 8:}d[I]=65533}if(y+=r(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>I&&(y=y.slice(0,I-32|0)),w<E){if(d[0]=q,I=~q>>>31,q=-1,y.length<g.length)continue}else q!==-1&&(y+=r(q));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,C=!a;for(w=0;w<g;w=w+1|0,E=E+1|0){var _=v.charCodeAt(w)|0;if(127>=_)y[E]=_;else{if(2047>=_)y[E]=192|_>>6;else{e:{if(55296<=_)if(56319>=_){var F=v.charCodeAt(w=w+1|0)|0;if(56320<=F&&57343>=F){if(_=(_<<10)+F-56613888|0,65535<_){y[E]=240|_>>18,y[E=E+1|0]=128|_>>12&63,y[E=E+1|0]=128|_>>6&63,y[E=E+1|0]=128|_&63;continue}break e}_=65533}else 57343>=_&&(_=65533);!C&&w<<1<E&&w<<1<(E-7|0)&&(C=!0,F=new u(3*g),F.set(y),y=F)}y[E]=224|_>>12,y[E=E+1|0]=128|_>>6&63}y[E=E+1|0]=128|_&63}}return a?y.subarray(0,E):y.slice(0,E)},p||(e.TextDecoder=t,e.TextEncoder=n)})(typeof global>"u"?typeof self>"u"?EC:self:global)});var Jh=be(c1=>{"use strict";var nie=B(x());Object.defineProperty(c1,"__esModule",{value:!0});c1.AddressError=void 0;var Jw=class extends Error{constructor(t,n){super(t),this.name="AddressError",this.parseMessage=n}};c1.AddressError=Jw});var l1=be(Qs=>{"use strict";var sie=B(x());Object.defineProperty(Qs,"__esModule",{value:!0});Qs.isInSubnet=HH;Qs.isHostInSubnet=Qw;Qs.isGloballyReachable=MH;Qs.offsetBigInt=qH;Qs.isCorrect=jH;Qs.prefixLengthFromMask=KH;Qs.assertByteArray=VH;Qs.numberToPaddedHex=i_;Qs.stringToPaddedHex=GH;Qs.testBit=zH;var Bc=Jh();function HH(e){return this.subnetMask<e.subnetMask?!1:Qw.call(this,e)}function Qw(e){return this.binaryZeroPad().length!==e.binaryZeroPad().length?!1:this.mask(e.subnetMask)===e.mask()}function MH(e){let t=null;for(let n=0;n<e.length;n++){let r=e[n];r.reachable!==null&&Qw.call(this,r.subnet)&&(t===null||r.subnet.subnetMask>t.subnet.subnetMask)&&(t=r)}return t===null?!0:t.reachable}function qH(e,t,n,r){if(typeof t=="number"&&!Number.isSafeInteger(t))throw new Bc.AddressError(`${r} offset must be an integer`);if(typeof t!="number"&&typeof t!="bigint")throw new Bc.AddressError(`${r} offset must be an integer`);let i=e+BigInt(t);if(i<BigInt(0)||i>(BigInt(1)<<BigInt(n))-BigInt(1))throw new Bc.AddressError(`${r} offset leaves the address space`);return i}function jH(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}function KH(e,t){let n=e.toString(2).padStart(t,"0");if(n.length>t)throw new Bc.AddressError("Invalid subnet mask.");let r=n.indexOf("0");if(r===-1)return t;if(n.slice(r).includes("1"))throw new Bc.AddressError("Invalid subnet mask.");return r}function VH(e,t,n,r){if(e.length!==t)throw new Bc.AddressError(`${n} addresses require exactly ${t} bytes`);for(let i=0;i<e.length;i++)if(!Number.isInteger(e[i])||e[i]<r||e[i]>255)throw new Bc.AddressError(`All bytes must be integers between ${r} and 255`)}function i_(e){return e.toString(16).padStart(2,"0")}function GH(e){return i_(parseInt(e,10))}function zH(e,t){let{length:n}=e;if(t>=n)return!1;let r=n-t-1;return e.substring(r,r+1)==="1"}});var ey=be(ei=>{"use strict";var oie=B(x());Object.defineProperty(ei,"__esModule",{value:!0});ei.SPECIAL_PURPOSE=ei.RE_SUBNET_STRING=ei.RE_ADDRESS=ei.GROUPS=ei.BITS=void 0;ei.BITS=32;ei.GROUPS=4;ei.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;ei.RE_SUBNET_STRING=/\/\d{1,2}$/;ei.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 ty=be(fo=>{"use strict";var uie=B(x()),WH=fo&&fo.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),YH=fo&&fo.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),o_=fo&&fo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&WH(t,e,n);return YH(t,e),t};Object.defineProperty(fo,"__esModule",{value:!0});fo.Address4=void 0;var Ps=o_(l1()),hn=o_(ey()),Fi=Jh(),XH=Ps.isCorrect(hn.BITS),Xn=class e{constructor(t){this.addressMinusSuffix="",this.groups=hn.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=XH,this.isInSubnet=Ps.isInSubnet,this.isHostInSubnet=Ps.isHostInSubnet,this.address=t;let n=hn.RE_SUBNET_STRING.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>hn.BITS)throw new Fi.AddressError("Invalid subnet mask.");t=t.replace(hn.RE_SUBNET_STRING,"")}let r=hn.GROUPS*4-1;if(t.length>r)throw new Fi.AddressError(`IPv4 addresses are at most ${r} characters.`);this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let n=t.split(".");if(n.some(r=>/^0\d/.test(r)))throw new Fi.AddressError("IPv4 addresses can't have leading zeroes.");if(!t.match(hn.RE_ADDRESS))throw new Fi.AddressError("Invalid IPv4 address.");return n}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromAddressAndMask(t,n){let r=Ps.prefixLengthFromMask(new e(n).bigInt(),hn.BITS);return new e(`${t}/${r}`)}static fromAddressAndWildcardMask(t,n){let r=new e(n).bigInt(),i=(BigInt(1)<<BigInt(hn.BITS))-BigInt(1),o=r^i,s=Ps.prefixLengthFromMask(o,hn.BITS);return new e(`${t}/${s}`)}static fromWildcard(t){let n=t.split(".");if(n.length!==hn.GROUPS)throw new Fi.AddressError("Wildcard pattern must have 4 octets");let r=-1;for(let a=0;a<n.length;a++)if(n[a]==="*")r===-1&&(r=a);else if(r!==-1)throw new Fi.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)");let i=r===-1?0:n.length-r,o=n.map(a=>a==="*"?"0":a),s=hn.BITS-i*8;return new e(`${o.join(".")}/${s}`)}static fromHex(t){let n=t.replace(/:/g,"");if(!/^[0-9a-fA-F]{8}$/.test(n))throw new Fi.AddressError("IPv4 hex must be exactly 8 hex digits");let r=[];for(let i=0;i<8;i+=2)r.push(parseInt(n.slice(i,i+2),16));return new e(r.join("."))}static fromInteger(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new Fi.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 n=hn.GROUPS*4-1+3+14;if(t.length>n)throw new Fi.AddressError(`in-addr.arpa names are at most ${n} characters.`);let i=t.replace(/(\.in-addr\.arpa)?\.?$/i,"").split(".").reverse().join(".");return new e(i)}toHex(){return this.parsedAddress.map(t=>Ps.stringToPaddedHex(t)).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],n;for(n=0;n<hn.GROUPS;n+=2)t.push(`${Ps.stringToPaddedHex(this.parsedAddress[n])}${Ps.stringToPaddedHex(this.parsedAddress[n+1])}`);return t.join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(t=>Ps.stringToPaddedHex(t)).join("")}`)}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(hn.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(Ps.offsetBigInt(this.bigInt(),t,hn.BITS,"IPv4")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(Ps.offsetBigInt(this._endAddress(),1,hn.BITS,"IPv4")).withSubnetMask(this.subnetMask)}withSubnetMask(t){return new e(`${this.correctForm()}/${t}`)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(hn.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(hn.BITS-this.subnetMask)}`))}wildcardMask(){return e.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(hn.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}static fromBigInt(t){if(t<BigInt(0)||t>BigInt(4294967295))throw new Fi.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 Ps.assertByteArray(t,4,"IPv4",0),this.fromUnsignedByteArray(t)}static fromUnsignedByteArray(t){if(t.length!==4)throw new Fi.AddressError("IPv4 addresses require exactly 4 bytes");let n=t.join(".");return new e(n)}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,n){return this.binaryZeroPad().slice(t,n)}reverseForm(t){t||(t={});let n=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?n:`${n}.in-addr.arpa.`}isMulticast(){return this.isHostInSubnet(ZH)}isPrivate(){return JH.some(t=>this.isHostInSubnet(t))}isLoopback(){return this.isHostInSubnet(QH)}isLinkLocal(){return this.isHostInSubnet(eM)}isUnspecified(){return this.isHostInSubnet(tM)}isBroadcast(){return this.isHostInSubnet(nM)}isCGNAT(){return this.isHostInSubnet(rM)}isDocumentation(){return sM.some(t=>this.isHostInSubnet(t))}isBenchmarking(){return this.isHostInSubnet(iM)}isReserved(){return this.isHostInSubnet(oM)}isGlobal(){return!this.isMulticast()&&Ps.isGloballyReachable.call(this,aM)}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(hn.BITS,"0")),this._binaryZeroPad}groupForV6(){let t=this.parsedAddress;return this.correctForm().replace(hn.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>`)}};fo.Address4=Xn;var ZH=new Xn("224.0.0.0/4"),JH=[new Xn("10.0.0.0/8"),new Xn("172.16.0.0/12"),new Xn("192.168.0.0/16")],QH=new Xn("127.0.0.0/8"),eM=new Xn("169.254.0.0/16"),tM=new Xn("0.0.0.0/32"),nM=new Xn("255.255.255.255/32"),rM=new Xn("100.64.0.0/10"),sM=[new Xn("192.0.2.0/24"),new Xn("198.51.100.0/24"),new Xn("203.0.113.0/24")],iM=new Xn("198.18.0.0/15"),oM=new Xn("240.0.0.0/4"),aM=hn.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new Xn(e),reachable:t}))});var ny=be(on=>{"use strict";var lie=B(x());Object.defineProperty(on,"__esModule",{value:!0});on.SPECIAL_PURPOSE=on.RE_URL_WITH_PORT=on.RE_URL=on.RE_ZONE_STRING=on.RE_SUBNET_STRING=on.RE_BAD_ADDRESS=on.RE_BAD_CHARACTERS=on.TYPES=on.SCOPES=on.GROUPS=on.BITS=void 0;on.BITS=128;on.GROUPS=8;on.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};on.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)"};on.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;on.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;on.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;on.RE_ZONE_STRING=/%.*$/;on.RE_URL=/^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;on.RE_URL_WITH_PORT=/^\[([0-9a-f:.]+)\]:([0-9]{1,5})(?:[/?#].*)?$/i;on.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 ry=be(Ic=>{"use strict";var hie=B(x());Object.defineProperty(Ic,"__esModule",{value:!0});Ic.escapeHtml=f1;Ic.spanAllZeroes=a_;Ic.spanAll=uM;Ic.spanLeadingZeroes=cM;Ic.simpleGroup=lM;function f1(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function a_(e){return f1(e).replace(/(0+)/g,'<span class="zero">$1</span>')}function uM(e,t=0){return e.split("").map((r,i)=>`<span class="digit value-${f1(r)} position-${i+t}">${a_(r)}</span>`).join("")}function u_(e){return f1(e).replace(/^(0+)/,'<span class="zero">$1</span>')}function cM(e){return e.split(":").map(n=>u_(n)).join(":")}function lM(e,t=0){return e.split(":").map((r,i)=>/group-v4/.test(r)?r:`<span class="hover-group group-${i+t}">${u_(r)}</span>`)}});var c_=be(cs=>{"use strict";var pie=B(x()),fM=cs&&cs.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),hM=cs&&cs.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),dM=cs&&cs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&fM(t,e,n);return hM(t,e),t};Object.defineProperty(cs,"__esModule",{value:!0});cs.ADDRESS_BOUNDARY=void 0;cs.groupPossibilities=d1;cs.padGroup=h1;cs.simpleRegularExpression=mM;cs.possibleElisions=gM;var pM=dM(ny());function d1(e){return`(${e.join("|")})`}function h1(e){return e.length<4?`0{0,${4-e.length}}${e}`:e}cs.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function mM(e){let t=[];e.forEach((r,i)=>{parseInt(r,16)===0&&t.push(i)});let n=t.map(r=>e.map((i,o)=>{if(o===r){let s=o===0||o===pM.GROUPS-1?":":"";return d1([h1(i),s])}return h1(i)}).join(":"));return n.push(e.map(h1).join(":")),d1(n)}function gM(e,t,n){let r=t?"":":",i=n?"":":",o=[];!t&&!n&&o.push("::"),t&&n&&o.push(""),(n&&!t||!n&&t)&&o.push(":"),o.push(`${r}(:0{1,4}){1,${e-1}}`),o.push(`(0{1,4}:){1,${e-1}}${i}`),o.push(`(0{1,4}:){${e-1}}0{1,4}`);for(let s=1;s<e-1;s++)for(let a=1;a<e-s;a++)o.push(`(0{1,4}:){${a}}:(0{1,4}:){${e-a-s-1}}0{1,4}`);return d1(o)}});var d_=be(mo=>{"use strict";var gie=B(x()),vM=mo&&mo.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),wM=mo&&mo.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),g1=mo&&mo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&vM(t,e,n);return wM(t,e),t};Object.defineProperty(mo,"__esModule",{value:!0});mo.Address6=void 0;var po=g1(l1()),sy=g1(ey()),Ct=g1(ny()),$c=g1(ry()),ho=ty(),xc=c_(),Zn=Jh(),p1=l1(),yM=po.isCorrect(Ct.BITS);function m1(e){if(!e)throw new Error("Assertion failed.")}function EM(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function bM(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 AM(e,t){let n=[],r=[],i;for(i=0;i<e.length;i++)i<t[0]?n.push(e[i]):i>t[1]&&r.push(e[i]);return n.concat(["compact"]).concat(r)}function l_(e){return parseInt(e,16).toString(16).padStart(4,"0")}function f_(e){return e&255}var Dr=class e{constructor(t,n){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=po.isInSubnet,this.isHostInSubnet=po.isHostInSubnet,this.isCorrect=yM,n===void 0?this.groups=Ct.GROUPS:this.groups=n,this.address=t;let r=Ct.RE_SUBNET_STRING.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>Ct.BITS)throw new Zn.AddressError("Invalid subnet mask.");t=t.replace(Ct.RE_SUBNET_STRING,"")}if(/\//.test(t))throw new Zn.AddressError("Invalid subnet mask.");let i=t.indexOf("%");i!==-1&&/^.*$/.test(t.slice(i))&&(this.zone=t.slice(i),t=t.slice(0,i));let o=this.groups*5+5;if(t.length>o)throw new Zn.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(Ct.BITS))-BigInt(1))throw new Zn.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");let n=t.toString(16).padStart(32,"0"),r=[];for(let i=0;i<Ct.GROUPS;i++)r.push(n.slice(i*4,(i+1)*4));return new e(r.join(":"))}static fromURL(t){var n;let r,i=null,o,s,a=t.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"");if(a.indexOf("[")!==-1&&a.indexOf("]:")!==-1){if(s="failed to parse address with port",o=Ct.RE_URL_WITH_PORT.exec(a),o===null)return{error:s,address:null,port:null};r=o[1],i=o[2]}else{if(s="failed to parse address from URL",o=Ct.RE_URL.exec(a),o===null)return{error:s,address:null,port:null};r=(n=o[1])!==null&&n!==void 0?n:o[2]}i?(i=parseInt(i,10),(i<0||i>65535)&&(i=null)):i=null;let u;try{u=new e(r)}catch{return{error:s,address:null,port:null}}return{address:u,port:i}}static fromAddressAndMask(t,n){let r=po.prefixLengthFromMask(new e(n).bigInt(),Ct.BITS);return new e(`${t}/${r}`)}static fromAddressAndWildcardMask(t,n){let r=new e(n).bigInt(),i=(BigInt(1)<<BigInt(Ct.BITS))-BigInt(1),o=r^i,s=po.prefixLengthFromMask(o,Ct.BITS);return new e(`${t}/${s}`)}static fromWildcard(t){if(t.includes("%")||t.includes("/"))throw new Zn.AddressError("Wildcard pattern must not include a zone or CIDR suffix");let n=t.split("::");if(n.length>2)throw new Zn.AddressError("Wildcard pattern cannot contain more than one '::'");let r;if(n.length===2){let u=n[0]===""?[]:n[0].split(":"),l=n[1]===""?[]:n[1].split(":"),h=Ct.GROUPS-u.length-l.length;if(h<1)throw new Zn.AddressError("Wildcard pattern with '::' has too many groups");r=[...u,...new Array(h).fill("0"),...l]}else r=t.split(":");if(r.length!==Ct.GROUPS)throw new Zn.AddressError("Wildcard pattern must have 8 groups");let i=-1;for(let u=0;u<r.length;u++)if(r[u]==="*")i===-1&&(i=u);else if(i!==-1)throw new Zn.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)");let o=i===-1?0:r.length-i,s=r.map(u=>u==="*"?"0":u),a=Ct.BITS-o*16;return new e(`${s.join(":")}/${a}`)}static fromAddress4(t){let n=new ho.Address4(t),r=Ct.BITS-(sy.BITS-n.subnetMask);return new e(`::ffff:${n.correctForm()}/${r}`)}static fromArpa(t){let n=t.replace(/(\.ip6\.arpa)?\.?$/i,"");if(!/^[0-9a-f](\.[0-9a-f]){0,31}$/i.test(n))throw new Zn.AddressError("Invalid 'ip6.arpa' form.");let r=n.split(".").reverse(),i=r.length*4,o=r.join("").padEnd(32,"0"),s=[];for(let a=0;a<Ct.GROUPS;a++)s.push(o.slice(a*4,(a+1)*4));return new e(`${s.join(":")}/${i}`)}microsoftTranscription(){return`${this.correctForm().replace(/:/g,"-")}.ipv6-literal.net`}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let n=Ct.BITS-this.subnetMask,r=Math.abs(t-Ct.BITS),i=n-r;return i<0?"0":EM((BigInt("2")**BigInt(i)).toString(10))}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(Ct.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(Ct.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(po.offsetBigInt(this.bigInt(),t,Ct.BITS,"IPv6")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(po.offsetBigInt(this._endAddress(),1,Ct.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(Ct.BITS-this.subnetMask)}`))}wildcardMask(){return e.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(Ct.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}getScope(){let t=this.getType();return t==="Multicast"||t.startsWith("Multicast ")?Ct.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<h_.length;t++){let n=h_[t];if(this.isHostInSubnet(n[0]))return n[1]}return"Global unicast"}getBits(t,n){return BigInt(`0b${this.getBitsBase2(t,n)}`)}getBitsBase2(t,n){return this.binaryZeroPad().slice(t,n)}getBitsBase16(t,n){let r=n-t;if(r%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,n).toString(16).padStart(r/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,Ct.BITS)}reverseForm(t){t||(t={});let n=Math.floor(this.subnetMask/4),r=this.canonicalForm().replace(/:/g,"").split("").slice(0,n).reverse().join(".");return n>0?t.omitSuffix?r:`${r}.ip6.arpa.`:t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,n=[],r=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let a=parseInt(this.parsedAddress[t],16);a===0&&r++,a!==0&&r>0&&(r>1&&i.push([t-r,t-1]),r=0)}r>1&&i.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);let o=i.map(a=>a[1]-a[0]+1);if(i.length>0){let a=o.indexOf(Math.max(...o));n=AM(this.parsedAddress,i[a])}else n=this.parsedAddress;for(t=0;t<n.length;t++)n[t]!=="compact"&&(n[t]=parseInt(n[t],16).toString(16));let s=n.join(":");return s=s.replace(/^compact$/,"::"),s=s.replace(/(^compact)|(compact$)/,":"),s=s.replace(/compact/,""),s}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(Ct.BITS,"0")),this._binaryZeroPad}parse4in6(t){if(t.indexOf(".")===-1)return t;let n=t.split(":"),r=n.slice(-1)[0],i=r.split(".");if(i.length===sy.GROUPS&&i.every(s=>/^\d{1,3}$/.test(s))&&i.some(s=>/^0\d/.test(s))){let s=i.map(bM).join("."),a=n.slice(0,-1).map($c.escapeHtml).join(":"),u=n.length>1?":":"";throw new Zn.AddressError("IPv4 addresses can't have leading zeroes.",`${a}${u}${s}`)}let o=r.match(sy.RE_ADDRESS);if(o){this.parsedAddress4=o[0];let s=this.subnetMask>=96?`/${this.subnetMask-96}`:"";this.address4=new ho.Address4(`${this.parsedAddress4}${s}`),this.v4=!0,n[n.length-1]=this.address4.toGroup6(),t=n.join(":")}return t}parse(t){t=this.parse4in6(t);let n=t.match(Ct.RE_BAD_CHARACTERS);if(n)throw new Zn.AddressError(`Bad character${n.length>1?"s":""} detected in address: ${n.join("")}`,t.replace(Ct.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));let r=t.match(Ct.RE_BAD_ADDRESS);if(r)throw new Zn.AddressError(`Address failed regex: ${r.join("")}`,t.replace(Ct.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let i=[],o=t.split("::");if(o.length===2){let s=o[0].split(":"),a=o[1].split(":");s.length===1&&s[0]===""&&(s=[]),a.length===1&&a[0]===""&&(a=[]);let u=this.groups-(s.length+a.length);if(!u)throw new Zn.AddressError("Error parsing groups");this.elidedGroups=u,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,i=i.concat(s);for(let l=0;l<u;l++)i.push("0");i=i.concat(a)}else if(o.length===1)i=t.split(":"),this.elidedGroups=0;else throw new Zn.AddressError("Too many :: groups found");if(i=i.map(s=>parseInt(s,16).toString(16)),i.length!==this.groups)throw new Zn.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(l_).join(":")}decimal(){return this.parsedAddress.map(t=>parseInt(t,16).toString(10).padStart(5,"0")).join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(l_).join("")}`)}to4(){let t=this.binaryZeroPad().split(""),n=BigInt(`0b${t.slice(96,128).join("")}`).toString(16).padStart(8,"0");if(this.subnetMask>=96){let r=this.subnetMask-96,i=[];for(let o=0;o<8;o+=2)i.push(parseInt(n.slice(o,o+2),16));return new ho.Address4(`${i.join(".")}/${r}`)}return ho.Address4.fromHex(n)}to4in6(){let t=this.to4(),r=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(r)||(i=":"),r+i+t.correctForm()}inspectTeredo(){let t=this.getBitsBase16(0,32),r=(this.getBits(80,96)^BigInt("0xffff")).toString(),i=ho.Address4.fromHex(this.getBitsBase16(32,64)),o=this.getBits(96,128),s=ho.Address4.fromHex((o^BigInt("0xffffffff")).toString(16).padStart(8,"0")),a=this.getBitsBase2(64,80),u=(0,p1.testBit)(a,15),l=(0,p1.testBit)(a,14),h=(0,p1.testBit)(a,8),m=(0,p1.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:i.address,client4:s.address,flags:a,coneNat:u,microsoft:{reserved:l,universalLocal:m,groupIndividual:h,nonce:p},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),n=ho.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:t.slice(0,4),gateway:n.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,n="64:ff9b::/96"){let r=new ho.Address4(t),i=new e(n),o=i.subnetMask;if(o!==32&&o!==40&&o!==48&&o!==56&&o!==64&&o!==96)throw new Zn.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");let s=i.binaryZeroPad(),a=r.binaryZeroPad(),u;if(o===96)u=s.slice(0,96)+a;else{let m=64-o;u=[s.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"),h=[];for(let m=0;m<8;m++)h.push(l.slice(m*4,(m+1)*4));return new e(h.join(":"))}toAddress4Nat64(t="64:ff9b::/96"){let n=new e(t),r=n.subnetMask;if(r!==32&&r!==40&&r!==48&&r!==56&&r!==64&&r!==96)throw new Zn.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");if(!this.isHostInSubnet(n))return null;let i=this.binaryZeroPad(),o;if(r===96)o=i.slice(96,128);else{let a=64-r;o=i.slice(r,r+a)+i.slice(72,72+(32-a))}let s=[];for(let a=0;a<4;a++)s.push(parseInt(o.slice(a*8,(a+1)*8),2).toString());return new ho.Address4(s.join("."))}toByteArray(){let t=this.bigInt().toString(16).padStart(Ct.BITS/4,"0"),n=[];for(let r=0,i=t.length;r<i;r+=2)n.push(parseInt(t.substring(r,r+2),16));return n}toUnsignedByteArray(){return this.toByteArray().map(f_)}static fromByteArray(t){return po.assertByteArray(t,16,"IPv6",-128),this.fromUnsignedByteArray(t.map(f_))}static fromUnsignedByteArray(t){po.assertByteArray(t,16,"IPv6",0);let n=BigInt("256"),r=BigInt("0"),i=BigInt("1");for(let o=t.length-1;o>=0;o--)r+=i*BigInt(t[o].toString(10)),i*=n;return e.fromBigInt(r)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){let t=this.embeddedIPv4();return t?t.isLinkLocal():this.isHostInSubnet(DM)}isMulticast(){let t=this.embeddedIPv4();if(t)return t.isMulticast();let n=this.getType();return n==="Multicast"||n.startsWith("Multicast ")}is4(){return this.v4}isMapped4(){return this.isHostInSubnet(xM)}embeddedIPv4(){return this.isMapped4()||this.isHostInSubnet(PM)?this.to4():null}isTeredo(){return this.isHostInSubnet(SM)}is6to4(){return this.isHostInSubnet(CM)}isLoopback(){let t=this.embeddedIPv4();return t?t.isLoopback():this.getType()==="Loopback"}isULA(){return this.isHostInSubnet(_M)}isPrivate(){let t=this.embeddedIPv4();return t?t.isPrivate():this.isULA()||this.isHostInSubnet(kM)}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 FM.some(t=>this.isHostInSubnet(t))}isBenchmarking(){let t=this.embeddedIPv4();return t?t.isBenchmarking():this.isHostInSubnet(BM)}isGlobal(){let t=this.embeddedIPv4();return t?t.isGlobal():this.isHostInSubnet(IM)&&po.isGloballyReachable.call(this,$M)}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 n=this.correctForm;t.v4&&(n=this.to4in6);let r=n.call(this),i=$c.escapeHtml(`${t.prefix}${r}`),o=$c.escapeHtml(r);if(t.className){let s=$c.escapeHtml(t.className);return`<a href="${i}" class="${s}">${o}</a>`}return`<a href="${i}">${o}</a>`}group(){if(this.elidedGroups===0)return $c.simpleGroup(this.addressMinusSuffix).join(":");m1(typeof this.elidedGroups=="number"),m1(typeof this.elisionBegin=="number");let t=[],[n,r]=this.addressMinusSuffix.split("::");n.length?t.push(...$c.simpleGroup(n)):t.push("");let i=["hover-group"];for(let o=this.elisionBegin;o<this.elisionBegin+this.elidedGroups;o++)i.push(`group-${o}`);return t.push(`<span class="${i.join(" ")}"></span>`),r.length?t.push(...$c.simpleGroup(r,this.elisionEnd)):t.push(""),this.is4()&&(m1(this.address4 instanceof ho.Address4),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let n=[],r=new e(this.correctForm());if(r.elidedGroups===0)n.push((0,xc.simpleRegularExpression)(r.parsedAddress));else if(r.elidedGroups===Ct.GROUPS)n.push((0,xc.possibleElisions)(Ct.GROUPS));else{let i=r.address.split("::");i[0].length&&n.push((0,xc.simpleRegularExpression)(i[0].split(":"))),m1(typeof r.elidedGroups=="number"),n.push((0,xc.possibleElisions)(r.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&n.push((0,xc.simpleRegularExpression)(i[1].split(":"))),n=[n.join(":")]}return t||(n=["(?=^|",xc.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...n,")(?=[^\\w\\:]|",xc.ADDRESS_BOUNDARY,"|$)"]),n.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};mo.Address6=Dr;var h_=Object.keys(Ct.TYPES).map(e=>[new Dr(e),Ct.TYPES[e]]),SM=new Dr("2001::/32"),CM=new Dr("2002::/16"),_M=new Dr("fc00::/7"),DM=new Dr("fe80::/10"),FM=[new Dr("2001:db8::/32"),new Dr("3fff::/20")],BM=new Dr("2001:2::/48"),IM=new Dr("2000::/3"),$M=Ct.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new Dr(e),reachable:t})),xM=new Dr("::ffff:0:0/96"),PM=new Dr("64:ff9b::/96"),kM=new Dr("64:ff9b:1::/48")});var p_=be(Fr=>{"use strict";var wie=B(x()),TM=Fr&&Fr.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),RM=Fr&&Fr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),OM=Fr&&Fr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&TM(t,e,n);return RM(t,e),t};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.v6=Fr.AddressError=Fr.Address6=Fr.Address4=void 0;var NM=ty();Object.defineProperty(Fr,"Address4",{enumerable:!0,get:function(){return NM.Address4}});var LM=d_();Object.defineProperty(Fr,"Address6",{enumerable:!0,get:function(){return LM.Address6}});var UM=Jh();Object.defineProperty(Fr,"AddressError",{enumerable:!0,get:function(){return UM.AddressError}});var HM=OM(ry());Fr.v6={helpers:HM}});var E8=be(am=>{"use strict";var Zhe=B(x());am.byteLength=Gq;am.toByteArray=Wq;am.fromByteArray=Zq;var bo=[],ni=[],Vq=typeof Uint8Array<"u"?Uint8Array:Array,jy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Oc=0,w8=jy.length;Oc<w8;++Oc)bo[Oc]=jy[Oc],ni[jy.charCodeAt(Oc)]=Oc;var Oc,w8;ni[45]=62;ni[95]=63;function y8(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function Gq(e){var t=y8(e),n=t[0],r=t[1];return(n+r)*3/4-r}function zq(e,t,n){return(t+n)*3/4-n}function Wq(e){var t,n=y8(e),r=n[0],i=n[1],o=new Vq(zq(e,r,i)),s=0,a=i>0?r-4:r,u;for(u=0;u<a;u+=4)t=ni[e.charCodeAt(u)]<<18|ni[e.charCodeAt(u+1)]<<12|ni[e.charCodeAt(u+2)]<<6|ni[e.charCodeAt(u+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=ni[e.charCodeAt(u)]<<2|ni[e.charCodeAt(u+1)]>>4,o[s++]=t&255),i===1&&(t=ni[e.charCodeAt(u)]<<10|ni[e.charCodeAt(u+1)]<<4|ni[e.charCodeAt(u+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function Yq(e){return bo[e>>18&63]+bo[e>>12&63]+bo[e>>6&63]+bo[e&63]}function Xq(e,t,n){for(var r,i=[],o=t;o<n;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(Yq(r));return i.join("")}function Zq(e){for(var t,n=e.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push(Xq(e,s,s+o>a?a:s+o));return r===1?(t=e[n-1],i.push(bo[t>>2]+bo[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(bo[t>>10]+bo[t>>4&63]+bo[t<<2&63]+"=")),i.join("")}});var b8=be(Ky=>{var Qhe=B(x());Ky.read=function(e,t,n,r,i){var o,s,a=i*8-r-1,u=(1<<a)-1,l=u>>1,h=-7,m=n?i-1:0,p=n?-1:1,d=e[t+m];for(m+=p,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=o*256+e[t+m],m+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=s*256+e[t+m],m+=p,h-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-l}return(d?-1:1)*s*Math.pow(2,o-r)};Ky.write=function(e,t,n,r,i,o){var s,a,u,l=o*8-i-1,h=(1<<l)-1,m=h>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,v=r?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,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+m>=1?t+=p/u:t+=p*Math.pow(2,1-m),t*u>=2&&(s++,u/=2),s+m>=h?(a=0,s=h):s+m>=1?(a=(t*u-1)*Math.pow(2,i),s=s+m):(a=t*Math.pow(2,m-1)*Math.pow(2,i),s=0));i>=8;e[n+d]=a&255,d+=v,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;e[n+d]=s&255,d+=v,s/=256,l-=8);e[n+d-v]|=g*128}});var wa=be(mf=>{"use strict";var nde=B(x());var Vy=E8(),df=b8(),A8=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;mf.Buffer=ve;mf.SlowBuffer=rj;mf.INSPECT_MAX_BYTES=50;var um=2147483647;mf.kMaxLength=um;ve.TYPED_ARRAY_SUPPORT=Jq();!ve.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 Jq(){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(ve.prototype,"parent",{enumerable:!0,get:function(){if(ve.isBuffer(this))return this.buffer}});Object.defineProperty(ve.prototype,"offset",{enumerable:!0,get:function(){if(ve.isBuffer(this))return this.byteOffset}});function va(e){if(e>um)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,ve.prototype),t}function ve(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Yy(e)}return D8(e,t,n)}ve.poolSize=8192;function D8(e,t,n){if(typeof e=="string")return ej(e,t);if(ArrayBuffer.isView(e))return tj(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(Ao(e,ArrayBuffer)||e&&Ao(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ao(e,SharedArrayBuffer)||e&&Ao(e.buffer,SharedArrayBuffer)))return zy(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return ve.from(r,t,n);let i=nj(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return ve.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}ve.from=function(e,t,n){return D8(e,t,n)};Object.setPrototypeOf(ve.prototype,Uint8Array.prototype);Object.setPrototypeOf(ve,Uint8Array);function F8(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 Qq(e,t,n){return F8(e),e<=0?va(e):t!==void 0?typeof n=="string"?va(e).fill(t,n):va(e).fill(t):va(e)}ve.alloc=function(e,t,n){return Qq(e,t,n)};function Yy(e){return F8(e),va(e<0?0:Xy(e)|0)}ve.allocUnsafe=function(e){return Yy(e)};ve.allocUnsafeSlow=function(e){return Yy(e)};function ej(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!ve.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=B8(e,t)|0,r=va(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function Gy(e){let t=e.length<0?0:Xy(e.length)|0,n=va(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function tj(e){if(Ao(e,Uint8Array)){let t=new Uint8Array(e);return zy(t.buffer,t.byteOffset,t.byteLength)}return Gy(e)}function zy(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return t===void 0&&n===void 0?r=new Uint8Array(e):n===void 0?r=new Uint8Array(e,t):r=new Uint8Array(e,t,n),Object.setPrototypeOf(r,ve.prototype),r}function nj(e){if(ve.isBuffer(e)){let t=Xy(e.length)|0,n=va(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||Jy(e.length)?va(0):Gy(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Gy(e.data)}function Xy(e){if(e>=um)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+um.toString(16)+" bytes");return e|0}function rj(e){return+e!=e&&(e=0),ve.alloc(+e)}ve.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==ve.prototype};ve.compare=function(t,n){if(Ao(t,Uint8Array)&&(t=ve.from(t,t.offset,t.byteLength)),Ao(n,Uint8Array)&&(n=ve.from(n,n.offset,n.byteLength)),!ve.isBuffer(t)||!ve.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===n)return 0;let r=t.length,i=n.length;for(let o=0,s=Math.min(r,i);o<s;++o)if(t[o]!==n[o]){r=t[o],i=n[o];break}return r<i?-1:i<r?1:0};ve.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}};ve.concat=function(t,n){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return ve.alloc(0);let r;if(n===void 0)for(n=0,r=0;r<t.length;++r)n+=t[r].length;let i=ve.allocUnsafe(n),o=0;for(r=0;r<t.length;++r){let s=t[r];if(Ao(s,Uint8Array))o+s.length>i.length?(ve.isBuffer(s)||(s=ve.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(ve.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function B8(e,t){if(ve.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Ao(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 n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Wy(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return N8(e).length;default:if(i)return r?-1:Wy(e).length;t=(""+t).toLowerCase(),i=!0}}ve.byteLength=B8;function sj(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return pj(this,t,n);case"utf8":case"utf-8":return $8(this,t,n);case"ascii":return hj(this,t,n);case"latin1":case"binary":return dj(this,t,n);case"base64":return lj(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mj(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}ve.prototype._isBuffer=!0;function Nc(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}ve.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 n=0;n<t;n+=2)Nc(this,n,n+1);return this};ve.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 n=0;n<t;n+=4)Nc(this,n,n+3),Nc(this,n+1,n+2);return this};ve.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 n=0;n<t;n+=8)Nc(this,n,n+7),Nc(this,n+1,n+6),Nc(this,n+2,n+5),Nc(this,n+3,n+4);return this};ve.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?$8(this,0,t):sj.apply(this,arguments)};ve.prototype.toLocaleString=ve.prototype.toString;ve.prototype.equals=function(t){if(!ve.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:ve.compare(this,t)===0};ve.prototype.inspect=function(){let t="",n=mf.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"};A8&&(ve.prototype[A8]=ve.prototype.inspect);ve.prototype.compare=function(t,n,r,i,o){if(Ao(t,Uint8Array)&&(t=ve.from(t,t.offset,t.byteLength)),!ve.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(n===void 0&&(n=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),n<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;let s=o-i,a=r-n,u=Math.min(s,a),l=this.slice(i,o),h=t.slice(n,r);for(let m=0;m<u;++m)if(l[m]!==h[m]){s=l[m],a=h[m];break}return s<a?-1:a<s?1:0};function I8(e,t,n,r,i){if(e.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Jy(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t=="string"&&(t=ve.from(t,r)),ve.isBuffer(t))return t.length===0?-1:S8(e,t,n,r,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):S8(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function S8(e,t,n,r,i){let o=1,s=e.length,a=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,s/=2,a/=2,n/=2}function u(h,m){return o===1?h[m]:h.readUInt16BE(m*o)}let l;if(i){let h=-1;for(l=n;l<s;l++)if(u(e,l)===u(t,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===a)return h*o}else h!==-1&&(l-=l-h),h=-1}else for(n+a>s&&(n=s-a),l=n;l>=0;l--){let h=!0;for(let m=0;m<a;m++)if(u(e,l+m)!==u(t,m)){h=!1;break}if(h)return l}return-1}ve.prototype.includes=function(t,n,r){return this.indexOf(t,n,r)!==-1};ve.prototype.indexOf=function(t,n,r){return I8(this,t,n,r,!0)};ve.prototype.lastIndexOf=function(t,n,r){return I8(this,t,n,r,!1)};function ij(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let o=t.length;r>o/2&&(r=o/2);let s;for(s=0;s<r;++s){let a=parseInt(t.substr(s*2,2),16);if(Jy(a))return s;e[n+s]=a}return s}function oj(e,t,n,r){return cm(Wy(t,e.length-n),e,n,r)}function aj(e,t,n,r){return cm(yj(t),e,n,r)}function uj(e,t,n,r){return cm(N8(t),e,n,r)}function cj(e,t,n,r){return cm(Ej(t,e.length-n),e,n,r)}ve.prototype.write=function(t,n,r,i){if(n===void 0)i="utf8",r=this.length,n=0;else if(r===void 0&&typeof n=="string")i=n,r=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-n;if((r===void 0||r>o)&&(r=o),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return ij(this,t,n,r);case"utf8":case"utf-8":return oj(this,t,n,r);case"ascii":case"latin1":case"binary":return aj(this,t,n,r);case"base64":return uj(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cj(this,t,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};ve.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function lj(e,t,n){return t===0&&n===e.length?Vy.fromByteArray(e):Vy.fromByteArray(e.slice(t,n))}function $8(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=n){let u,l,h,m;switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],(u&192)===128&&(m=(o&31)<<6|u&63,m>127&&(s=m));break;case 3:u=e[i+1],l=e[i+2],(u&192)===128&&(l&192)===128&&(m=(o&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(s=m));break;case 4:u=e[i+1],l=e[i+2],h=e[i+3],(u&192)===128&&(l&192)===128&&(h&192)===128&&(m=(o&15)<<18|(u&63)<<12|(l&63)<<6|h&63,m>65535&&m<1114112&&(s=m))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=a}return fj(r)}var C8=4096;function fj(e){let t=e.length;if(t<=C8)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=C8));return n}function hj(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function dj(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function pj(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let o=t;o<n;++o)i+=bj[e[o]];return i}function mj(e,t,n){let r=e.slice(t,n),i="";for(let o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}ve.prototype.slice=function(t,n){let r=this.length;t=~~t,n=n===void 0?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n<t&&(n=t);let i=this.subarray(t,n);return Object.setPrototypeOf(i,ve.prototype),i};function Jn(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}ve.prototype.readUintLE=ve.prototype.readUIntLE=function(t,n,r){t=t>>>0,n=n>>>0,r||Jn(t,n,this.length);let i=this[t],o=1,s=0;for(;++s<n&&(o*=256);)i+=this[t+s]*o;return i};ve.prototype.readUintBE=ve.prototype.readUIntBE=function(t,n,r){t=t>>>0,n=n>>>0,r||Jn(t,n,this.length);let i=this[t+--n],o=1;for(;n>0&&(o*=256);)i+=this[t+--n]*o;return i};ve.prototype.readUint8=ve.prototype.readUInt8=function(t,n){return t=t>>>0,n||Jn(t,1,this.length),this[t]};ve.prototype.readUint16LE=ve.prototype.readUInt16LE=function(t,n){return t=t>>>0,n||Jn(t,2,this.length),this[t]|this[t+1]<<8};ve.prototype.readUint16BE=ve.prototype.readUInt16BE=function(t,n){return t=t>>>0,n||Jn(t,2,this.length),this[t]<<8|this[t+1]};ve.prototype.readUint32LE=ve.prototype.readUInt32LE=function(t,n){return t=t>>>0,n||Jn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};ve.prototype.readUint32BE=ve.prototype.readUInt32BE=function(t,n){return t=t>>>0,n||Jn(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};ve.prototype.readBigUInt64LE=xu(function(t){t=t>>>0,pf(t,"offset");let n=this[t],r=this[t+7];(n===void 0||r===void 0)&&Cd(t,this.length-8);let i=n+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+r*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});ve.prototype.readBigUInt64BE=xu(function(t){t=t>>>0,pf(t,"offset");let n=this[t],r=this[t+7];(n===void 0||r===void 0)&&Cd(t,this.length-8);let i=n*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+r;return(BigInt(i)<<BigInt(32))+BigInt(o)});ve.prototype.readIntLE=function(t,n,r){t=t>>>0,n=n>>>0,r||Jn(t,n,this.length);let i=this[t],o=1,s=0;for(;++s<n&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*n)),i};ve.prototype.readIntBE=function(t,n,r){t=t>>>0,n=n>>>0,r||Jn(t,n,this.length);let i=n,o=1,s=this[t+--i];for(;i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*n)),s};ve.prototype.readInt8=function(t,n){return t=t>>>0,n||Jn(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};ve.prototype.readInt16LE=function(t,n){t=t>>>0,n||Jn(t,2,this.length);let r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};ve.prototype.readInt16BE=function(t,n){t=t>>>0,n||Jn(t,2,this.length);let r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};ve.prototype.readInt32LE=function(t,n){return t=t>>>0,n||Jn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};ve.prototype.readInt32BE=function(t,n){return t=t>>>0,n||Jn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};ve.prototype.readBigInt64LE=xu(function(t){t=t>>>0,pf(t,"offset");let n=this[t],r=this[t+7];(n===void 0||r===void 0)&&Cd(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(n+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});ve.prototype.readBigInt64BE=xu(function(t){t=t>>>0,pf(t,"offset");let n=this[t],r=this[t+7];(n===void 0||r===void 0)&&Cd(t,this.length-8);let i=(n<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+r)});ve.prototype.readFloatLE=function(t,n){return t=t>>>0,n||Jn(t,4,this.length),df.read(this,t,!0,23,4)};ve.prototype.readFloatBE=function(t,n){return t=t>>>0,n||Jn(t,4,this.length),df.read(this,t,!1,23,4)};ve.prototype.readDoubleLE=function(t,n){return t=t>>>0,n||Jn(t,8,this.length),df.read(this,t,!0,52,8)};ve.prototype.readDoubleBE=function(t,n){return t=t>>>0,n||Jn(t,8,this.length),df.read(this,t,!1,52,8)};function ps(e,t,n,r,i,o){if(!ve.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}ve.prototype.writeUintLE=ve.prototype.writeUIntLE=function(t,n,r,i){if(t=+t,n=n>>>0,r=r>>>0,!i){let a=Math.pow(2,8*r)-1;ps(this,t,n,r,a,0)}let o=1,s=0;for(this[n]=t&255;++s<r&&(o*=256);)this[n+s]=t/o&255;return n+r};ve.prototype.writeUintBE=ve.prototype.writeUIntBE=function(t,n,r,i){if(t=+t,n=n>>>0,r=r>>>0,!i){let a=Math.pow(2,8*r)-1;ps(this,t,n,r,a,0)}let o=r-1,s=1;for(this[n+o]=t&255;--o>=0&&(s*=256);)this[n+o]=t/s&255;return n+r};ve.prototype.writeUint8=ve.prototype.writeUInt8=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,1,255,0),this[n]=t&255,n+1};ve.prototype.writeUint16LE=ve.prototype.writeUInt16LE=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,2,65535,0),this[n]=t&255,this[n+1]=t>>>8,n+2};ve.prototype.writeUint16BE=ve.prototype.writeUInt16BE=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,2,65535,0),this[n]=t>>>8,this[n+1]=t&255,n+2};ve.prototype.writeUint32LE=ve.prototype.writeUInt32LE=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,4,4294967295,0),this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=t&255,n+4};ve.prototype.writeUint32BE=ve.prototype.writeUInt32BE=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,4,4294967295,0),this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255,n+4};function x8(e,t,n,r,i){O8(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o=o>>8,e[n++]=o,o=o>>8,e[n++]=o,o=o>>8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s=s>>8,e[n++]=s,s=s>>8,e[n++]=s,s=s>>8,e[n++]=s,n}function P8(e,t,n,r,i){O8(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o=o>>8,e[n+6]=o,o=o>>8,e[n+5]=o,o=o>>8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s=s>>8,e[n+2]=s,s=s>>8,e[n+1]=s,s=s>>8,e[n]=s,n+8}ve.prototype.writeBigUInt64LE=xu(function(t,n=0){return x8(this,t,n,BigInt(0),BigInt("0xffffffffffffffff"))});ve.prototype.writeBigUInt64BE=xu(function(t,n=0){return P8(this,t,n,BigInt(0),BigInt("0xffffffffffffffff"))});ve.prototype.writeIntLE=function(t,n,r,i){if(t=+t,n=n>>>0,!i){let u=Math.pow(2,8*r-1);ps(this,t,n,r,u-1,-u)}let o=0,s=1,a=0;for(this[n]=t&255;++o<r&&(s*=256);)t<0&&a===0&&this[n+o-1]!==0&&(a=1),this[n+o]=(t/s>>0)-a&255;return n+r};ve.prototype.writeIntBE=function(t,n,r,i){if(t=+t,n=n>>>0,!i){let u=Math.pow(2,8*r-1);ps(this,t,n,r,u-1,-u)}let o=r-1,s=1,a=0;for(this[n+o]=t&255;--o>=0&&(s*=256);)t<0&&a===0&&this[n+o+1]!==0&&(a=1),this[n+o]=(t/s>>0)-a&255;return n+r};ve.prototype.writeInt8=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,1,127,-128),t<0&&(t=255+t+1),this[n]=t&255,n+1};ve.prototype.writeInt16LE=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,2,32767,-32768),this[n]=t&255,this[n+1]=t>>>8,n+2};ve.prototype.writeInt16BE=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,2,32767,-32768),this[n]=t>>>8,this[n+1]=t&255,n+2};ve.prototype.writeInt32LE=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,4,2147483647,-2147483648),this[n]=t&255,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24,n+4};ve.prototype.writeInt32BE=function(t,n,r){return t=+t,n=n>>>0,r||ps(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255,n+4};ve.prototype.writeBigInt64LE=xu(function(t,n=0){return x8(this,t,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ve.prototype.writeBigInt64BE=xu(function(t,n=0){return P8(this,t,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function k8(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function T8(e,t,n,r,i){return t=+t,n=n>>>0,i||k8(e,t,n,4,34028234663852886e22,-34028234663852886e22),df.write(e,t,n,r,23,4),n+4}ve.prototype.writeFloatLE=function(t,n,r){return T8(this,t,n,!0,r)};ve.prototype.writeFloatBE=function(t,n,r){return T8(this,t,n,!1,r)};function R8(e,t,n,r,i){return t=+t,n=n>>>0,i||k8(e,t,n,8,17976931348623157e292,-17976931348623157e292),df.write(e,t,n,r,52,8),n+8}ve.prototype.writeDoubleLE=function(t,n,r){return R8(this,t,n,!0,r)};ve.prototype.writeDoubleBE=function(t,n,r){return R8(this,t,n,!1,r)};ve.prototype.copy=function(t,n,r,i){if(!ve.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n<i-r&&(i=t.length-n+r);let o=i-r;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),n),o};ve.prototype.fill=function(t,n,r,i){if(typeof t=="string"){if(typeof n=="string"?(i=n,n=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!ve.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let s=t.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(n<0||this.length<n||this.length<r)throw new RangeError("Out of range index");if(r<=n)return this;n=n>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);let o;if(typeof t=="number")for(o=n;o<r;++o)this[o]=t;else{let s=ve.isBuffer(t)?t:ve.from(t,i),a=s.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-n;++o)this[o+n]=s[o%a]}return this};var hf={};function Zy(e,t,n){hf[e]=class extends n{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(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}Zy("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Zy("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);Zy("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=_8(String(n)):typeof n=="bigint"&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=_8(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r},RangeError);function _8(e){let t="",n=e.length,r=e[0]==="-"?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function gj(e,t,n){pf(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&Cd(t,e.length-(n+1))}function O8(e,t,n,r,i,o){if(e>n||e<t){let s=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${t}${s} and <= ${n}${s}`,new hf.ERR_OUT_OF_RANGE("value",a,e)}gj(r,i,o)}function pf(e,t){if(typeof e!="number")throw new hf.ERR_INVALID_ARG_TYPE(t,"number",e)}function Cd(e,t,n){throw Math.floor(e)!==e?(pf(e,n),new hf.ERR_OUT_OF_RANGE(n||"offset","an integer",e)):t<0?new hf.ERR_BUFFER_OUT_OF_BOUNDS:new hf.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}var vj=/[^+/0-9A-Za-z-_]/g;function wj(e){if(e=e.split("=")[0],e=e.trim().replace(vj,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Wy(e,t){t=t||1/0;let n,r=e.length,i=null,o=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return o}function yj(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Ej(e,t){let n,r,i,o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}function N8(e){return Vy.toByteArray(wj(e))}function cm(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Ao(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Jy(e){return e!==e}var bj=(function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function xu(e){return typeof BigInt>"u"?Aj:e}function Aj(){throw new Error("BigInt not supported")}});var cD=be(xe=>{var ide=B(x()),Dd={};Dd.userAgent=!1;var gf={},Sj="11.1.3",Cj="jsrsasign(all) 11.1.3 (2026-04-18) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var ke=ke||(function(e,t){var n={},r=n.lib={},i=r.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=r.WordArray=i.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 C=g[E>>>2]>>>24-E%4*8&255;v[y+E>>>2]|=C<<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=i.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)}}),s=n.enc={},a=s.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=s.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=s.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)))}},h=r.BufferedBlockAlgorithm=i.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,C=y/E;d?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var _=C*w,F=e.min(_*4,y);if(_){for(var H=0;H<_;H+=w)this._doProcessBlock(g,H);var K=g.splice(0,_);v.sigBytes-=F}return new o.init(K,F)},clone:function(){var d=i.clone.call(this);return d._data=this._data.clone(),d},_minBufferSize:0}),m=r.Hasher=h.extend({cfg:i.extend(),init:function(d){this.cfg=this.cfg.extend(d),this.reset()},reset:function(){h.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=n.algo={};return n})(Math);(function(e){var i=ke,t=i.lib,n=t.Base,r=t.WordArray,i=i.x64={};i.Word=n.extend({init:function(o,s){this.high=o,this.low=s}}),i.WordArray=n.extend({init:function(o,s){o=this.words=o||[],this.sigBytes=s!=e?s:8*o.length},toX32:function(){for(var o=this.words,s=o.length,a=[],u=0;u<s;u++){var l=o[u];a.push(l.high),a.push(l.low)}return r.create(a,this.sigBytes)},clone:function(){for(var o=n.clone.call(this),s=o.words=this.words.slice(0),a=s.length,u=0;u<a;u++)s[u]=s[u].clone();return o}})})();ke.lib.Cipher||(function(e){var d=ke,t=d.lib,n=t.Base,r=t.WordArray,i=t.BufferedBlockAlgorithm,o=d.enc.Base64,s=d.algo.EvpKDF,a=t.Cipher=i.extend({cfg:n.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(){i.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 C=0;C<w;C++)g[y+C]^=E[C]},l=(t.BlockCipherMode=n.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,C=g.slice(y,y+E);w.decryptBlock(g,y),u.call(this,g,y,E),this._prevBlock=C}}),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,C=[],_=0;_<w;_+=4)C.push(E);w=r.create(C,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 h=t.CipherParams=n.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?r.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=r.create(y.slice(2,4));y.splice(0,4),g.sigBytes-=16}return h.create({ciphertext:g,salt:w})}},p=t.SerializableCipher=n.extend({cfg:n.extend({format:m}),encrypt:function(g,y,w,E){E=this.cfg.extend(E);var C=g.createEncryptor(w,E);return y=C.finalize(y),C=C.cfg,h.create({ciphertext:y,key:w,iv:C.iv,algorithm:g,mode:C.mode,padding:C.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=r.random(8)),g=s.create({keySize:y+w}).compute(g,E),w=r.create(g.words.slice(y),4*w),g.sigBytes=4*y,h.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=ke,t=e.lib.BlockCipher,H=e.algo,n=[],r=[],i=[],o=[],s=[],a=[],u=[],l=[],h=[],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;n[v]=y,r[y]=v;var w=p[v],E=p[w],C=p[E],_=257*p[y]^16843008*y;i[v]=_<<24|_>>>8,o[v]=_<<16|_>>>16,s[v]=_<<8|_>>>24,a[v]=_,_=16843009*C^65537*E^257*w^16843008*v,u[y]=_<<24|_>>>8,l[y]=_<<16|_>>>16,h[y]=_<<8|_>>>24,m[y]=_,v?(v=w^p[p[p[C^w]]],g^=p[p[g]]):v=g=1}var F=[0,1,2,4,8,16,32,64,128,27,54],H=H.AES=t.extend({_doReset:function(){for(var I=this._key,K=I.words,S=I.sigBytes/4,I=4*((this._nRounds=S+6)+1),q=this._keySchedule=[],L=0;L<I;L++)if(L<S)q[L]=K[L];else{var T=q[L-1];L%S?6<S&&L%S==4&&(T=n[T>>>24]<<24|n[T>>>16&255]<<16|n[T>>>8&255]<<8|n[T&255]):(T=T<<8|T>>>24,T=n[T>>>24]<<24|n[T>>>16&255]<<16|n[T>>>8&255]<<8|n[T&255],T^=F[L/S|0]<<24),q[L]=q[L-S]^T}for(K=this._invKeySchedule=[],S=0;S<I;S++)L=I-S,T=S%4?q[L]:q[L-4],K[S]=4>S||4>=L?T:u[n[T>>>24]]^l[n[T>>>16&255]]^h[n[T>>>8&255]]^m[n[T&255]]},encryptBlock:function(K,S){this._doCryptBlock(K,S,this._keySchedule,i,o,s,a,n)},decryptBlock:function(K,S){var I=K[S+1];K[S+1]=K[S+3],K[S+3]=I,this._doCryptBlock(K,S,this._invKeySchedule,u,l,h,m,r),I=K[S+1],K[S+1]=K[S+3],K[S+3]=I},_doCryptBlock:function(K,S,I,q,L,T,O,R){for(var N=this._nRounds,ae=K[S]^I[0],me=K[S+1]^I[1],he=K[S+2]^I[2],te=K[S+3]^I[3],P=4,M=1;M<N;M++)var Y=q[ae>>>24]^L[me>>>16&255]^T[he>>>8&255]^O[te&255]^I[P++],V=q[me>>>24]^L[he>>>16&255]^T[te>>>8&255]^O[ae&255]^I[P++],X=q[he>>>24]^L[te>>>16&255]^T[ae>>>8&255]^O[me&255]^I[P++],te=q[te>>>24]^L[ae>>>16&255]^T[me>>>8&255]^O[he&255]^I[P++],ae=Y,me=V,he=X;Y=(R[ae>>>24]<<24|R[me>>>16&255]<<16|R[he>>>8&255]<<8|R[te&255])^I[P++],V=(R[me>>>24]<<24|R[he>>>16&255]<<16|R[te>>>8&255]<<8|R[ae&255])^I[P++],X=(R[he>>>24]<<24|R[te>>>16&255]<<16|R[ae>>>8&255]<<8|R[me&255])^I[P++],te=(R[te>>>24]<<24|R[ae>>>16&255]<<16|R[me>>>8&255]<<8|R[he&255])^I[P++],K[S]=Y,K[S+1]=V,K[S+2]=X,K[S+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 n=ke,i=n.lib,r=i.WordArray,i=i.BlockCipher,o=n.algo,s=[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}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],m=o.DES=i.extend({_doReset:function(){for(var p=this._key.words,d=[],v=0;56>v;v++){var g=s[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,C=0,_=0;8>_;_++)C|=l[_][((E^y[_])&h[_])>>>0];this._lBlock=E,this._rBlock=w^C}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});n.DES=i._createHelper(m),o=o.TripleDES=i.extend({_doReset:function(){var p=this._key.words;this._des1=m.createEncryptor(r.create(p.slice(0,2))),this._des2=m.createEncryptor(r.create(p.slice(2,4))),this._des3=m.createEncryptor(r.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}),n.TripleDES=i._createHelper(o)})();(function(){var e=ke,t=e.lib.WordArray;e.enc.Base64={stringify:function(n){var r=n.words,i=n.sigBytes,o=this._map;n.clamp(),n=[];for(var s=0;s<i;s+=3)for(var a=(r[s>>>2]>>>24-8*(s%4)&255)<<16|(r[s+1>>>2]>>>24-8*((s+1)%4)&255)<<8|r[s+2>>>2]>>>24-8*((s+2)%4)&255,u=0;4>u&&s+.75*u<i;u++)n.push(o.charAt(a>>>6*(3-u)&63));if(r=o.charAt(64))for(;n.length%4;)n.push(r);return n.join("")},parse:function(n){var r=n.length,i=this._map,o=i.charAt(64);o&&(o=n.indexOf(o),o!=-1&&(r=o));for(var o=[],s=0,a=0;a<r;a++)if(a%4){var u=i.indexOf(n.charAt(a-1))<<2*(a%4),l=i.indexOf(n.charAt(a))>>>6-2*(a%4);o[s>>>2]|=(u|l)<<24-8*(s%4),s++}return t.create(o,s)},_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 n(m,p,d,v,g,y,w){return m=m+(p&v|d&~v)+g+w,(m<<y|m>>>32-y)+p}function r(m,p,d,v,g,y,w){return m=m+(p^d^v)+g+w,(m<<y|m>>>32-y)+p}function i(m,p,d,v,g,y,w){return m=m+(d^(p|~v))+g+w,(m<<y|m>>>32-y)+p}for(var o=ke,u=o.lib,s=u.WordArray,a=u.Hasher,u=o.algo,l=[],h=0;64>h;h++)l[h]=4294967296*e.abs(e.sin(h+1))|0;u=u.MD5=a.extend({_doReset:function(){this._hash=new s.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],C=m[p+5],_=m[p+6],F=m[p+7],H=m[p+8],K=m[p+9],S=m[p+10],I=m[p+11],q=m[p+12],L=m[p+13],T=m[p+14],O=m[p+15],R=d[0],M=d[1],P=d[2],N=d[3],R=t(R,M,P,N,v,7,l[0]),N=t(N,R,M,P,g,12,l[1]),P=t(P,N,R,M,y,17,l[2]),M=t(M,P,N,R,w,22,l[3]),R=t(R,M,P,N,E,7,l[4]),N=t(N,R,M,P,C,12,l[5]),P=t(P,N,R,M,_,17,l[6]),M=t(M,P,N,R,F,22,l[7]),R=t(R,M,P,N,H,7,l[8]),N=t(N,R,M,P,K,12,l[9]),P=t(P,N,R,M,S,17,l[10]),M=t(M,P,N,R,I,22,l[11]),R=t(R,M,P,N,q,7,l[12]),N=t(N,R,M,P,L,12,l[13]),P=t(P,N,R,M,T,17,l[14]),M=t(M,P,N,R,O,22,l[15]),R=n(R,M,P,N,g,5,l[16]),N=n(N,R,M,P,_,9,l[17]),P=n(P,N,R,M,I,14,l[18]),M=n(M,P,N,R,v,20,l[19]),R=n(R,M,P,N,C,5,l[20]),N=n(N,R,M,P,S,9,l[21]),P=n(P,N,R,M,O,14,l[22]),M=n(M,P,N,R,E,20,l[23]),R=n(R,M,P,N,K,5,l[24]),N=n(N,R,M,P,T,9,l[25]),P=n(P,N,R,M,w,14,l[26]),M=n(M,P,N,R,H,20,l[27]),R=n(R,M,P,N,L,5,l[28]),N=n(N,R,M,P,y,9,l[29]),P=n(P,N,R,M,F,14,l[30]),M=n(M,P,N,R,q,20,l[31]),R=r(R,M,P,N,C,4,l[32]),N=r(N,R,M,P,H,11,l[33]),P=r(P,N,R,M,I,16,l[34]),M=r(M,P,N,R,T,23,l[35]),R=r(R,M,P,N,g,4,l[36]),N=r(N,R,M,P,E,11,l[37]),P=r(P,N,R,M,F,16,l[38]),M=r(M,P,N,R,S,23,l[39]),R=r(R,M,P,N,L,4,l[40]),N=r(N,R,M,P,v,11,l[41]),P=r(P,N,R,M,w,16,l[42]),M=r(M,P,N,R,_,23,l[43]),R=r(R,M,P,N,K,4,l[44]),N=r(N,R,M,P,q,11,l[45]),P=r(P,N,R,M,O,16,l[46]),M=r(M,P,N,R,y,23,l[47]),R=i(R,M,P,N,v,6,l[48]),N=i(N,R,M,P,F,10,l[49]),P=i(P,N,R,M,T,15,l[50]),M=i(M,P,N,R,C,21,l[51]),R=i(R,M,P,N,q,6,l[52]),N=i(N,R,M,P,w,10,l[53]),P=i(P,N,R,M,S,15,l[54]),M=i(M,P,N,R,g,21,l[55]),R=i(R,M,P,N,H,6,l[56]),N=i(N,R,M,P,O,10,l[57]),P=i(P,N,R,M,_,15,l[58]),M=i(M,P,N,R,L,21,l[59]),R=i(R,M,P,N,E,6,l[60]),N=i(N,R,M,P,I,10,l[61]),P=i(P,N,R,M,y,15,l[62]),M=i(M,P,N,R,K,21,l[63]);d[0]=d[0]+R|0,d[1]=d[1]+M|0,d[2]=d[2]+P|0,d[3]=d[3]+N|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=ke,i=e.lib,t=i.WordArray,n=i.Hasher,r=[],i=e.algo.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(o,s){for(var a=this._hash.words,u=a[0],l=a[1],h=a[2],m=a[3],p=a[4],d=0;80>d;d++){if(16>d)r[d]=o[s+d]|0;else{var v=r[d-3]^r[d-8]^r[d-14]^r[d-16];r[d]=v<<1|v>>>31}v=(u<<5|u>>>27)+p+r[d],v=20>d?v+((l&h|~l&m)+1518500249):40>d?v+((l^h^m)+1859775393):60>d?v+((l&h|l&m|h&m)-1894007588):v+((l^h^m)-899497514),p=m,m=h,h=l<<30|l>>>2,l=u,u=v}a[0]=a[0]+u|0,a[1]=a[1]+l|0,a[2]=a[2]+h|0,a[3]=a[3]+m|0,a[4]=a[4]+p|0},_doFinalize:function(){var o=this._data,s=o.words,a=8*this._nDataBytes,u=8*o.sigBytes;return s[u>>>5]|=128<<24-u%32,s[(u+64>>>9<<4)+14]=Math.floor(a/4294967296),s[(u+64>>>9<<4)+15]=a,o.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var o=n.clone.call(this);return o._hash=this._hash.clone(),o}});e.SHA1=n._createHelper(i),e.HmacSHA1=n._createHmacHelper(i)})();(function(e){for(var t=ke,d=t.lib,n=d.WordArray,r=d.Hasher,d=t.algo,i=[],o=[],s=function(g){return 4294967296*(g-(g|0))|0},a=2,u=0;64>u;){var l;e:{l=a;for(var h=e.sqrt(l),m=2;m<=h;m++)if(!(l%m)){l=!1;break e}l=!0}l&&(8>u&&(i[u]=s(e.pow(a,.5))),o[u]=s(e.pow(a,1/3)),u++),a++}var p=[],d=d.SHA256=r.extend({_doReset:function(){this._hash=new n.init(i.slice(0))},_doProcessBlock:function(v,g){for(var y=this._hash.words,w=y[0],E=y[1],C=y[2],_=y[3],F=y[4],H=y[5],K=y[6],S=y[7],I=0;64>I;I++){if(16>I)p[I]=v[g+I]|0;else{var q=p[I-15],L=p[I-2];p[I]=((q<<25|q>>>7)^(q<<14|q>>>18)^q>>>3)+p[I-7]+((L<<15|L>>>17)^(L<<13|L>>>19)^L>>>10)+p[I-16]}q=S+((F<<26|F>>>6)^(F<<21|F>>>11)^(F<<7|F>>>25))+(F&H^~F&K)+o[I]+p[I],L=((w<<30|w>>>2)^(w<<19|w>>>13)^(w<<10|w>>>22))+(w&E^w&C^E&C),S=K,K=H,H=F,F=_+q|0,_=C,C=E,E=w,w=q+L|0}y[0]=y[0]+w|0,y[1]=y[1]+E|0,y[2]=y[2]+C|0,y[3]=y[3]+_|0,y[4]=y[4]+F|0,y[5]=y[5]+H|0,y[6]=y[6]+K|0,y[7]=y[7]+S|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=r.clone.call(this);return v._hash=this._hash.clone(),v}});t.SHA256=r._createHelper(d),t.HmacSHA256=r._createHmacHelper(d)})(Math);(function(){var e=ke,t=e.lib.WordArray,r=e.algo,n=r.SHA256,r=r.SHA224=n.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var i=n._doFinalize.call(this);return i.sigBytes-=4,i}});e.SHA224=n._createHelper(r),e.HmacSHA224=n._createHmacHelper(r)})();(function(){function e(){return r.create.apply(r,arguments)}for(var t=ke,n=t.lib.Hasher,o=t.x64,r=o.Word,i=o.WordArray,o=t.algo,s=[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=n.extend({_doReset:function(){this._hash=new i.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(l,h){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],C=m.high,_=m.low,F=p.high,H=p.low,K=d.high,S=d.low,I=v.high,q=v.low,L=g.high,T=g.low,O=y.high,R=y.low,N=w.high,P=w.low,M=E.high,Y=E.low,V=C,X=_,te=F,ae=H,me=K,he=S,De=I,Pe=q,Ie=L,se=T,pe=O,Fe=R,Re=N,Ve=P,Oe=M,pt=Y,Qe=0;80>Qe;Qe++){var un=a[Qe];if(16>Qe)var ct=un.high=l[h+2*Qe]|0,Te=un.low=l[h+2*Qe+1]|0;else{var ct=a[Qe-15],Te=ct.high,lt=ct.low,ct=(Te>>>1|lt<<31)^(Te>>>8|lt<<24)^Te>>>7,lt=(lt>>>1|Te<<31)^(lt>>>8|Te<<24)^(lt>>>7|Te<<25),Tn=a[Qe-2],Te=Tn.high,Dt=Tn.low,Tn=(Te>>>19|Dt<<13)^(Te<<3|Dt>>>29)^Te>>>6,Dt=(Dt>>>19|Te<<13)^(Dt<<3|Te>>>29)^(Dt>>>6|Te<<26),Te=a[Qe-7],gr=Te.high,vn=a[Qe-16],Ze=vn.high,vn=vn.low,Te=lt+Te.low,ct=ct+gr+(Te>>>0<lt>>>0?1:0),Te=Te+Dt,ct=ct+Tn+(Te>>>0<Dt>>>0?1:0),Te=Te+vn,ct=ct+Ze+(Te>>>0<vn>>>0?1:0);un.high=ct,un.low=Te}var gr=Ie&pe^~Ie&Re,vn=se&Fe^~se&Ve,un=V&te^V&me^te&me,wn=X&ae^X&he^ae&he,lt=(V>>>28|X<<4)^(V<<30|X>>>2)^(V<<25|X>>>7),Tn=(X>>>28|V<<4)^(X<<30|V>>>2)^(X<<25|V>>>7),Dt=s[Qe],es=Dt.high,gi=Dt.low,Dt=pt+((se>>>14|Ie<<18)^(se>>>18|Ie<<14)^(se<<23|Ie>>>9)),Ze=Oe+((Ie>>>14|se<<18)^(Ie>>>18|se<<14)^(Ie<<23|se>>>9))+(Dt>>>0<pt>>>0?1:0),Dt=Dt+vn,Ze=Ze+gr+(Dt>>>0<vn>>>0?1:0),Dt=Dt+gi,Ze=Ze+es+(Dt>>>0<gi>>>0?1:0),Dt=Dt+Te,Ze=Ze+ct+(Dt>>>0<Te>>>0?1:0),Te=Tn+wn,un=lt+un+(Te>>>0<Tn>>>0?1:0),Oe=Re,pt=Ve,Re=pe,Ve=Fe,pe=Ie,Fe=se,se=Pe+Dt|0,Ie=De+Ze+(se>>>0<Pe>>>0?1:0)|0,De=me,Pe=he,me=te,he=ae,te=V,ae=X,X=Dt+Te|0,V=Ze+un+(X>>>0<Dt>>>0?1:0)|0}_=m.low=_+X,m.high=C+V+(_>>>0<X>>>0?1:0),H=p.low=H+ae,p.high=F+te+(H>>>0<ae>>>0?1:0),S=d.low=S+he,d.high=K+me+(S>>>0<he>>>0?1:0),q=v.low=q+Pe,v.high=I+De+(q>>>0<Pe>>>0?1:0),T=g.low=T+se,g.high=L+Ie+(T>>>0<se>>>0?1:0),R=y.low=R+Fe,y.high=O+pe+(R>>>0<Fe>>>0?1:0),P=w.low=P+Ve,w.high=N+Re+(P>>>0<Ve>>>0?1:0),Y=E.low=Y+pt,E.high=M+Oe+(Y>>>0<pt>>>0?1:0)},_doFinalize:function(){var l=this._data,h=l.words,m=8*this._nDataBytes,p=8*l.sigBytes;return h[p>>>5]|=128<<24-p%32,h[(p+128>>>10<<5)+30]=Math.floor(m/4294967296),h[(p+128>>>10<<5)+31]=m,l.sigBytes=4*h.length,this._process(),this._hash.toX32()},clone:function(){var l=n.clone.call(this);return l._hash=this._hash.clone(),l},blockSize:32}),t.SHA512=n._createHelper(o),t.HmacSHA512=n._createHmacHelper(o)})();(function(){var e=ke,i=e.x64,t=i.Word,n=i.WordArray,i=e.algo,r=i.SHA512,i=i.SHA384=r.extend({_doReset:function(){this._hash=new n.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=r._doFinalize.call(this);return o.sigBytes-=16,o}});e.SHA384=r._createHelper(i),e.HmacSHA384=r._createHmacHelper(i)})();(function(){var e=ke,l=e.lib,t=l.WordArray,n=l.Hasher,l=e.algo,r=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]),i=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]),s=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=n.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,m){for(var p=0;16>p;p++){var d=m+p,v=h[d];h[d]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var d=this._hash.words,v=a.words,g=u.words,y=r.words,w=i.words,E=o.words,C=s.words,_,F,H,K,S,I,q,L,T,O;I=_=d[0],q=F=d[1],L=H=d[2],T=K=d[3],O=S=d[4];for(var R,p=0;80>p;p+=1)R=_+h[m+y[p]]|0,R=16>p?R+((F^H^K)+v[0]):32>p?R+((F&H|~F&K)+v[1]):48>p?R+(((F|~H)^K)+v[2]):64>p?R+((F&K|H&~K)+v[3]):R+((F^(H|~K))+v[4]),R|=0,R=R<<E[p]|R>>>32-E[p],R=R+S|0,_=S,S=K,K=H<<10|H>>>22,H=F,F=R,R=I+h[m+w[p]]|0,R=16>p?R+((q^(L|~T))+g[0]):32>p?R+((q&T|L&~T)+g[1]):48>p?R+(((q|~L)^T)+g[2]):64>p?R+((q&L|~q&T)+g[3]):R+((q^L^T)+g[4]),R|=0,R=R<<C[p]|R>>>32-C[p],R=R+O|0,I=O,O=T,T=L<<10|L>>>22,L=q,q=R;R=d[1]+H+T|0,d[1]=d[2]+K+O|0,d[2]=d[3]+S+I|0,d[3]=d[4]+_+q|0,d[4]=d[0]+F+L|0,d[0]=R},_doFinalize:function(){var h=this._data,m=h.words,p=8*this._nDataBytes,d=8*h.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,h.sigBytes=4*(m.length+1),this._process(),h=this._hash,m=h.words,p=0;5>p;p++)d=m[p],m[p]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;return h},clone:function(){var h=n.clone.call(this);return h._hash=this._hash.clone(),h}});e.RIPEMD160=n._createHelper(l),e.HmacRIPEMD160=n._createHmacHelper(l)})(Math);(function(){var e=ke,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(n,r){n=this._hasher=new n.init,typeof r=="string"&&(r=t.parse(r));var i=n.blockSize,o=4*i;r.sigBytes>o&&(r=n.finalize(r)),r.clamp();for(var s=this._oKey=r.clone(),a=this._iKey=r.clone(),u=s.words,l=a.words,h=0;h<i;h++)u[h]^=1549556828,l[h]^=909522486;s.sigBytes=a.sigBytes=o,this.reset()},reset:function(){var n=this._hasher;n.reset(),n.update(this._iKey)},update:function(n){return this._hasher.update(n),this},finalize:function(n){var r=this._hasher;return n=r.finalize(n),r.reset(),r.finalize(this._oKey.clone().concat(n))}})})();(function(){var e=ke,r=e.lib,t=r.Base,n=r.WordArray,r=e.algo,i=r.HMAC,o=r.PBKDF2=t.extend({cfg:t.extend({keySize:4,hasher:r.SHA1,iterations:1}),init:function(s){this.cfg=this.cfg.extend(s)},compute:function(s,a){for(var v=this.cfg,u=i.create(v.hasher,s),l=n.create(),h=n.create([1]),m=l.words,p=h.words,d=v.keySize,v=v.iterations;m.length<d;){var g=u.update(a).finalize(h);u.reset();for(var y=g.words,w=y.length,E=g,C=1;C<v;C++){E=u.finalize(E),u.reset();for(var _=E.words,F=0;F<w;F++)y[F]^=_[F]}l.concat(g),p[0]++}return l.sigBytes=4*d,l}});e.PBKDF2=function(s,a,u){return o.create(u).compute(s,a)}})();var vf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tE="=";function ba(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=vf.charAt(n>>6)+vf.charAt(n&63);if(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=vf.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=vf.charAt(n>>2)+vf.charAt((n&3)<<4)),tE)for(;(r.length&3)>0;)r+=tE;return r}function yf(e){var t="",n,r=0,i,o;for(n=0;n<e.length&&e.charAt(n)!=tE;++n)o=vf.indexOf(e.charAt(n)),!(o<0)&&(r==0?(t+=ya(o>>2),i=o&3,r=1):r==1?(t+=ya(i<<2|o>>4),i=o&15,r=2):r==2?(t+=ya(i),t+=ya(o>>2),i=o&3,r=3):(t+=ya(i<<2|o>>4),t+=ya(o&15),r=0));return r==1&&(t+=ya(i<<2)),t}function M8(e){var t=yf(e),n,r=new Array;for(n=0;2*n<t.length;++n)r[n]=parseInt(t.substring(2*n,2*n+2),16);return r}var ku,_j=0xdeadbeefcafe,L8=(_j&16777215)==15715070;function re(e,t,n){e!=null&&(typeof e=="number"?this.fromNumber(e,t,n):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function kt(){return new re(null)}function Dj(e,t,n,r,i,o){for(;--o>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=s&67108863}return i}function Fj(e,t,n,r,i,o){for(var s=t&32767,a=t>>15;--o>=0;){var u=this[e]&32767,l=this[e++]>>15,h=a*u+l*s;u=s*u+((h&32767)<<15)+n[r]+(i&1073741823),i=(u>>>30)+(h>>>15)+a*l+(i>>>30),n[r++]=u&1073741823}return i}function Bj(e,t,n,r,i,o){for(var s=t&16383,a=t>>14;--o>=0;){var u=this[e]&16383,l=this[e++]>>14,h=a*u+l*s;u=s*u+((h&16383)<<14)+n[r]+i,i=(u>>28)+(h>>14)+a*l,n[r++]=u&268435455}return i}L8&&Dd.appName=="Microsoft Internet Explorer"?(re.prototype.am=Fj,ku=30):L8&&Dd.appName!="Netscape"?(re.prototype.am=Dj,ku=26):(re.prototype.am=Bj,ku=28);re.prototype.DB=ku;re.prototype.DM=(1<<ku)-1;re.prototype.DV=1<<ku;var iE=52;re.prototype.FV=Math.pow(2,iE);re.prototype.F1=iE-ku;re.prototype.F2=2*ku-iE;var Ij="0123456789abcdefghijklmnopqrstuvwxyz",mm=new Array,Ef,ri;Ef=48;for(ri=0;ri<=9;++ri)mm[Ef++]=ri;Ef=97;for(ri=10;ri<36;++ri)mm[Ef++]=ri;Ef=65;for(ri=10;ri<36;++ri)mm[Ef++]=ri;function ya(e){return Ij.charAt(e)}function q8(e,t){var n=mm[e.charCodeAt(t)];return n??-1}function $j(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function xj(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 Pu(e){var t=kt();return t.fromInt(e),t}function Pj(e,t){var n;if(t==16)n=4;else if(t==8)n=3;else if(t==256)n=8;else if(t==2)n=1;else if(t==32)n=5;else if(t==4)n=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,i=!1,o=0;--r>=0;){var s=n==8?e[r]&255:q8(e,r);if(s<0){e.charAt(r)=="-"&&(i=!0);continue}i=!1,o==0?this[this.t++]=s:o+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=n,o>=this.DB&&(o-=this.DB)}n==8&&(e[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&re.ZERO.subTo(this,this)}function kj(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function Tj(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 n=(1<<t)-1,r,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=ya(r));s>=0;)a<t?(r=(this[s]&(1<<a)-1)<<t-a,r|=this[--s]>>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=ya(r));return i?o:"0"}function Rj(){var e=kt();return re.ZERO.subTo(this,e),e}function Oj(){return this.s<0?this.negate():this}function Nj(e){var t=this.s-e.s;if(t!=0)return t;var n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0}function gm(e){var t=1,n;return(n=e>>>16)!=0&&(e=n,t+=16),(n=e>>8)!=0&&(e=n,t+=8),(n=e>>4)!=0&&(e=n,t+=4),(n=e>>2)!=0&&(e=n,t+=2),(n=e>>1)!=0&&(e=n,t+=1),t}function Lj(){return this.t<=0?0:this.DB*(this.t-1)+gm(this[this.t-1]^this.s&this.DM)}function Uj(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function Hj(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function Mj(e,t){var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,o=Math.floor(e/this.DB),s=this.s<<n&this.DM,a;for(a=this.t-1;a>=0;--a)t[a+o+1]=this[a]>>r|s,s=(this[a]&i)<<n;for(a=o-1;a>=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function qj(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)t[s-n-1]|=(this[s]&o)<<i,t[s-n]=this[s]>>r;r>0&&(t[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}function jj(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function Kj(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&re.ZERO.subTo(t,t)}function Vj(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function Gj(e,t,n){var r=e.abs();if(r.t<=0)throw"BigInteger divide by zero";var i=this.abs();if(i.t<r.t){t?.fromInt(0),n!=null&&this.copyTo(n);return}n==null&&(n=kt());var o=kt(),s=this.s,a=e.s,u=this.DB-gm(r[r.t-1]);u>0?(r.lShiftTo(u,o),i.lShiftTo(u,n)):(r.copyTo(o),i.copyTo(n));var l=o.t,h=o[l-1];if(h!=0){var m=h*(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=n.t,y=g-l,w=t??kt();for(o.dlShiftTo(y,w),n.compareTo(w)>=0&&(n[n.t++]=1,n.subTo(w,n)),re.ONE.dlShiftTo(l,w),w.subTo(o,o);o.t<l;)o[o.t++]=0;for(;--y>=0;){var E=n[--g]==h?this.DM:Math.floor(n[g]*p+(n[g-1]+v)*d);if((n[g]+=o.am(0,E,n,y,0,l))<E)for(o.dlShiftTo(y,w),n.subTo(w,n);n[g]<--E;)n.subTo(w,n)}t!=null&&(n.drShiftTo(l,t),s!=a&&re.ZERO.subTo(t,t)),n.t=l,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&re.ZERO.subTo(n,n)}}function zj(e){var t=kt();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(re.ZERO)>0&&e.subTo(t,t),t}function Lc(e){this.m=e}function Wj(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function Yj(e){return e}function Xj(e){e.divRemTo(this.m,null,e)}function Zj(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function Jj(e,t){e.squareTo(t),this.reduce(t)}Lc.prototype.convert=Wj;Lc.prototype.revert=Yj;Lc.prototype.reduce=Xj;Lc.prototype.mulTo=Zj;Lc.prototype.sqrTo=Jj;function Qj(){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 Uc(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 eK(e){var t=kt();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(re.ZERO)>0&&this.m.subTo(t,t),t}function tK(e){var t=kt();return e.copyTo(t),this.reduce(t),t}function nK(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=e[t]&32767,r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function rK(e,t){e.squareTo(t),this.reduce(t)}function sK(e,t,n){e.multiplyTo(t,n),this.reduce(n)}Uc.prototype.convert=eK;Uc.prototype.revert=tK;Uc.prototype.reduce=nK;Uc.prototype.mulTo=sK;Uc.prototype.sqrTo=rK;function iK(){return(this.t>0?this[0]&1:this.s)==0}function oK(e,t){if(e>4294967295||e<1)return re.ONE;var n=kt(),r=kt(),i=t.convert(this),o=gm(e)-1;for(i.copyTo(n);--o>=0;)if(t.sqrTo(n,r),(e&1<<o)>0)t.mulTo(r,i,n);else{var s=n;n=r,r=s}return t.revert(n)}function aK(e,t){var n;return e<256||t.isEven()?n=new Lc(t):n=new Uc(t),this.exp(e,n)}re.prototype.copyTo=$j;re.prototype.fromInt=xj;re.prototype.fromString=Pj;re.prototype.clamp=kj;re.prototype.dlShiftTo=Uj;re.prototype.drShiftTo=Hj;re.prototype.lShiftTo=Mj;re.prototype.rShiftTo=qj;re.prototype.subTo=jj;re.prototype.multiplyTo=Kj;re.prototype.squareTo=Vj;re.prototype.divRemTo=Gj;re.prototype.invDigit=Qj;re.prototype.isEven=iK;re.prototype.exp=oK;re.prototype.toString=Tj;re.prototype.negate=Rj;re.prototype.abs=Oj;re.prototype.compareTo=Nj;re.prototype.bitLength=Lj;re.prototype.mod=zj;re.prototype.modPowInt=aK;re.ZERO=Pu(0);re.ONE=Pu(1);function uK(){var e=kt();return this.copyTo(e),e}function cK(){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 lK(){return this.t==0?this.s:this[0]<<24>>24}function fK(){return this.t==0?this.s:this[0]<<16>>16}function hK(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function dK(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function pK(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=Pu(n),i=kt(),o=kt(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(e).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(e)+s}function mK(e,t){this.fromInt(0),t==null&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,o=0,s=0,a=0;a<e.length;++a){var u=q8(e,a);if(u<0){e.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}s=t*s+u,++o>=n&&(this.dMultiply(r),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&re.ZERO.subTo(this,this)}function gK(e,t,n){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(re.ONE.shiftLeft(e-1),oE,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(re.ONE.shiftLeft(e-1),this);else{var r=new Array,i=e&7;r.length=(e>>3)+1,t.nextBytes(r),i>0?r[0]&=(1<<i)-1:r[0]=0,this.fromString(r,256)}}function vK(){var e=this.t,t=new Array;t[0]=this.s;var n=this.DB-e*this.DB%8,r,i=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),(r&128)!=0&&(r|=-256),i==0&&(this.s&128)!=(r&128)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t}function wK(e){return this.compareTo(e)==0}function yK(e){return this.compareTo(e)<0?this:e}function EK(e){return this.compareTo(e)>0?this:e}function bK(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r<o;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=o;r<this.t;++r)n[r]=t(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<e.t;++r)n[r]=t(i,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()}function AK(e,t){return e&t}function SK(e){var t=kt();return this.bitwiseTo(e,AK,t),t}function oE(e,t){return e|t}function CK(e){var t=kt();return this.bitwiseTo(e,oE,t),t}function j8(e,t){return e^t}function _K(e){var t=kt();return this.bitwiseTo(e,j8,t),t}function K8(e,t){return e&~t}function DK(e){var t=kt();return this.bitwiseTo(e,K8,t),t}function FK(){for(var e=kt(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function BK(e){var t=kt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function IK(e){var t=kt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function $K(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 xK(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+$K(this[e]);return this.s<0?this.t*this.DB:-1}function PK(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function kK(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=PK(this[n]^t);return e}function TK(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function RK(e,t){var n=re.ONE.shiftLeft(e);return this.bitwiseTo(n,t,n),n}function OK(e){return this.changeBit(e,oE)}function NK(e){return this.changeBit(e,K8)}function LK(e){return this.changeBit(e,j8)}function UK(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()}function HK(e){var t=kt();return this.addTo(e,t),t}function MK(e){var t=kt();return this.subTo(e,t),t}function qK(e){var t=kt();return this.multiplyTo(e,t),t}function jK(){var e=kt();return this.squareTo(e),e}function KK(e){var t=kt();return this.divRemTo(e,t,null),t}function VK(e){var t=kt();return this.divRemTo(e,null,t),t}function GK(e){var t=kt(),n=kt();return this.divRemTo(e,t,n),new Array(t,n)}function zK(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function WK(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 Bd(){}function V8(e){return e}function YK(e,t,n){e.multiplyTo(t,n)}function XK(e,t){e.squareTo(t)}Bd.prototype.convert=V8;Bd.prototype.revert=V8;Bd.prototype.mulTo=YK;Bd.prototype.sqrTo=XK;function ZK(e){return this.exp(e,new Bd)}function JK(e,t,n){var r=Math.min(this.t+e.t,t);for(n.s=0,n.t=r;r>0;)n[--r]=0;var i;for(i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(i=Math.min(e.t,t);r<i;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()}function QK(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)}function bf(e){this.r2=kt(),this.q3=kt(),re.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function eV(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=kt();return e.copyTo(t),this.reduce(t),t}function tV(e){return e}function nV(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 rV(e,t){e.squareTo(t),this.reduce(t)}function sV(e,t,n){e.multiplyTo(t,n),this.reduce(n)}bf.prototype.convert=eV;bf.prototype.revert=tV;bf.prototype.reduce=nV;bf.prototype.mulTo=sV;bf.prototype.sqrTo=rV;function iV(e,t){if(e.signum()<0)return this.modInverse(t).modPow(e.negate(),t);var n=e.bitLength(),r,i=Pu(1),o;if(n<=0)return i;n<18?r=1:n<48?r=3:n<144?r=4:n<768?r=5:r=6,n<8?o=new Lc(t):t.isEven()?o=new bf(t):o=new Uc(t);var s=new Array,a=3,u=r-1,l=(1<<r)-1;if(s[1]=o.convert(this),r>1){var h=kt();for(o.sqrTo(s[1],h);a<=l;)s[a]=kt(),o.mulTo(h,s[a-2],s[a]),a+=2}var m=e.t-1,p,d=!0,v=kt(),g;for(n=gm(e[m])-1;m>=0;){for(n>=u?p=e[m]>>n-u&l:(p=(e[m]&(1<<n+1)-1)<<u-n,m>0&&(p|=e[m-1]>>this.DB+n-u)),a=r;(p&1)==0;)p>>=1,--a;if((n-=a)<0&&(n+=this.DB,--m),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,v),o.sqrTo(v,i),a-=2;a>0?o.sqrTo(i,v):(g=i,i=v,v=g),o.mulTo(v,s[p],i)}for(;m>=0&&(e[m]&1<<n)==0;)o.sqrTo(i,v),g=i,i=v,v=g,--n<0&&(n=this.DB-1,--m)}return o.revert(i)}function oV(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n}function aV(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(t==0)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n}function uV(e){if(e.signum()==0)return re.ZERO;var t=this.mod(e),n=e.isEven();if(t.isEven()&&n||t.signum()==0)return re.ZERO;for(var r=e.clone(),i=t.clone(),o=Pu(1),s=Pu(0),a=Pu(0),u=Pu(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),n?((!o.isEven()||!s.isEven())&&(o.addTo(t,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),n?((!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);r.compareTo(i)>=0?(r.subTo(i,r),n&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(r,i),n&&a.subTo(o,a),u.subTo(s,u))}if(i.compareTo(re.ONE)!=0)return re.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 Gr=[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],cV=(1<<26)/Gr[Gr.length-1];function lV(e){if(this.signum()<=0)return!1;var t,n=this.abs();if(n.t==1&&n[0]<=Gr[Gr.length-1]){for(t=0;t<Gr.length;++t)if(n[0]==Gr[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<Gr.length;){for(var r=Gr[t],i=t+1;i<Gr.length&&r<cV;)r*=Gr[i++];for(r=n.modInt(r);t<i;)if(r%Gr[t++]==0)return!1}return n.millerRabin(e)}function fV(e){if(this.signum()<=0)return!1;var t=this.subtract(re.ONE),n=t.getLowestSetBit();if(n<=0)return!1;var r=t.shiftRight(n);e=e+1>>1,e>Gr.length&&(e=Gr.length);for(var i=kt(),o=0;o<e;++o){i.fromInt(Gr[Math.floor(Math.random()*Gr.length)]);var s=i.modPow(r,this);if(s.compareTo(re.ONE)!=0&&s.compareTo(t)!=0){for(var a=1;a++<n&&s.compareTo(t)!=0;)if(s=s.modPowInt(2,this),s.compareTo(re.ONE)==0)return!1;if(s.compareTo(t)!=0)return!1}}return!0}re.prototype.chunkSize=hK;re.prototype.toRadix=pK;re.prototype.fromRadix=mK;re.prototype.fromNumber=gK;re.prototype.bitwiseTo=bK;re.prototype.changeBit=RK;re.prototype.addTo=UK;re.prototype.dMultiply=zK;re.prototype.dAddOffset=WK;re.prototype.multiplyLowerTo=JK;re.prototype.multiplyUpperTo=QK;re.prototype.modInt=aV;re.prototype.millerRabin=fV;re.prototype.clone=uK;re.prototype.intValue=cK;re.prototype.byteValue=lK;re.prototype.shortValue=fK;re.prototype.signum=dK;re.prototype.toByteArray=vK;re.prototype.equals=wK;re.prototype.min=yK;re.prototype.max=EK;re.prototype.and=SK;re.prototype.or=CK;re.prototype.xor=_K;re.prototype.andNot=DK;re.prototype.not=FK;re.prototype.shiftLeft=BK;re.prototype.shiftRight=IK;re.prototype.getLowestSetBit=xK;re.prototype.bitCount=kK;re.prototype.testBit=TK;re.prototype.setBit=OK;re.prototype.clearBit=NK;re.prototype.flipBit=LK;re.prototype.add=HK;re.prototype.subtract=MK;re.prototype.multiply=qK;re.prototype.divide=KK;re.prototype.remainder=VK;re.prototype.divideAndRemainder=GK;re.prototype.modPow=iV;re.prototype.modInverse=uV;re.prototype.pow=ZK;re.prototype.gcd=oV;re.prototype.isProbablePrime=lV;re.prototype.square=jK;re.prototype.sqrt=function(){for(var e=re.ZERO.setBit(this.bitLength()/2),t=e;;){var n=e.add(this.divide(e)).shiftRight(1);if(n.equals(e)||n.equals(t))return n;t=e,e=n}};function aE(){this.i=0,this.j=0,this.S=new Array}function hV(e){var t,n,r;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0}function dV(){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]}aE.prototype.init=hV;aE.prototype.next=dV;function pV(){return new aE}var _d=256;var lm,ms,_n;function mV(e){ms[_n++]^=e&255,ms[_n++]^=e>>8&255,ms[_n++]^=e>>16&255,ms[_n++]^=e>>24&255,_n>=_d&&(_n-=_d)}function uE(){mV(new Date().getTime())}if(ms==null){if(ms=new Array,_n=0,typeof gf<"u"&&(gf.crypto!==void 0||gf.msCrypto!==void 0)){if(Ea=gf.crypto||gf.msCrypto,Ea.getRandomValues)for(Qy=new Uint8Array(32),Ea.getRandomValues(Qy),$r=0;$r<32;++$r)ms[_n++]=Qy[$r];else if(Dd.appName=="Netscape"&&Dd.appVersion<"5")for(eE=gf.crypto.random(32),$r=0;$r<eE.length;++$r)ms[_n++]=eE.charCodeAt($r)&255}if(_n<_d&&typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues)for(fm=new Uint8Array(_d-_n),globalThis.crypto.getRandomValues(fm),$r=0;$r<fm.length;++$r)ms[_n++]=fm[$r];for(;_n<_d;)$r=Math.floor(65536*Math.random()),ms[_n++]=$r>>>8,ms[_n++]=$r&255;_n=0,uE()}var $r,Ea,Qy,eE,fm;function gV(){if(lm==null){for(uE(),lm=pV(),lm.init(ms),_n=0;_n<ms.length;++_n)ms[_n]=0;_n=0}return lm.next()}function vV(e){var t;for(t=0;t<e.length;++t)e[t]=gV()}function Af(){}Af.prototype.nextBytes=vV;function gs(e,t){return new re(e,t)}function at(){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 wV(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=gs(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(re.ONE)<=0||this.e==null||isNaN(this.e)||this.e<=0)throw"Invalid RSA public key"}function yV(e){return e.modPowInt(this.e,this.n)}at.prototype.doPublic=yV;at.prototype.setPublic=wV;at.prototype.type="RSA";function EV(e,t,n){if(this.isPrivate=!0,typeof e!="string")this.n=e,this.e=t,this.d=n;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=gs(e,16),this.e=parseInt(t,16),this.d=gs(n,16);else throw"Invalid RSA private key"}function bV(e,t,n,r,i,o,s,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=gs(e,16),this.e=parseInt(t,16),this.d=gs(n,16),this.p=gs(r,16),this.q=gs(i,16),this.dmp1=gs(o,16),this.dmq1=gs(s,16),this.coeff=gs(a,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function AV(e,t){var n=new Af,r=e>>1;this.e=parseInt(t,16);for(var i=new re(t,16),o=e/2-100,s=re.ONE.shiftLeft(o);;){for(;this.p=new re(e-r,1,n),!(this.p.subtract(re.ONE).gcd(i).compareTo(re.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new re(r,1,n),!(this.q.subtract(re.ONE).gcd(i).compareTo(re.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(s)<=0)){var l=this.p.subtract(re.ONE),h=this.q.subtract(re.ONE),m=l.multiply(h);if(m.gcd(i).compareTo(re.ONE)==0&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=i.modInverse(m),this.dmp1=this.d.mod(l),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0}function SV(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),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)}at.prototype.doPrivate=SV;at.prototype.setPrivate=EV;at.prototype.setPrivateEx=bV;at.prototype.generate=AV;function qn(e,t){this.x=t,this.q=e}function CV(e){return e==this?!0:this.q.equals(e.q)&&this.x.equals(e.x)}function _V(){return this.x}function DV(){return new qn(this.q,this.x.negate().mod(this.q))}function FV(e){return new qn(this.q,this.x.add(e.toBigInteger()).mod(this.q))}function BV(e){return new qn(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}function IV(e){return new qn(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}function $V(){return new qn(this.q,this.x.square().mod(this.q))}function xV(e){return new qn(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}qn.prototype.equals=CV;qn.prototype.toBigInteger=_V;qn.prototype.negate=DV;qn.prototype.add=FV;qn.prototype.subtract=BV;qn.prototype.multiply=IV;qn.prototype.square=$V;qn.prototype.divide=xV;qn.prototype.sqrt=function(){return new qn(this.q,this.x.sqrt().mod(this.q))};function Nt(e,t,n,r){this.curve=e,this.x=t,this.y=n,r==null?this.z=re.ONE:this.z=r,this.zinv=null}function PV(){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 kV(){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 TV(e){if(e==this)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return this.isInfinity();var t,n;return t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),t.equals(re.ZERO)?(n=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q),n.equals(re.ZERO)):!1}function RV(){return this.x==null&&this.y==null?!0:this.z.equals(re.ZERO)&&!this.y.toBigInteger().equals(re.ZERO)}function OV(){return new Nt(this.curve,this.x,this.y.negate(),this.z)}function NV(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),n=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(re.ZERO.equals(n))return re.ZERO.equals(t)?this.twice():this.curve.getInfinity();var r=new re("3"),i=this.x.toBigInteger(),o=this.y.toBigInteger(),s=e.x.toBigInteger(),a=e.y.toBigInteger(),u=n.square(),l=u.multiply(n),h=i.multiply(u),m=t.square().multiply(this.z),p=m.subtract(h.shiftLeft(1)).multiply(e.z).subtract(l).multiply(n).mod(this.curve.q),d=h.multiply(r).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 Nt(this.curve,this.curve.fromBigInteger(p),this.curve.fromBigInteger(d),v)}function LV(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=new re("3"),t=this.x.toBigInteger(),n=this.y.toBigInteger(),r=n.multiply(this.z),i=r.multiply(n).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=t.square().multiply(e);re.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o))),s=s.mod(this.curve.q);var a=s.square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(r).mod(this.curve.q),u=s.multiply(e).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),l=r.square().multiply(r).shiftLeft(3).mod(this.curve.q);return new Nt(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),l)}function UV(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,n=t.multiply(new re("3")),r=this.negate(),i=this,o=this.curve.q.subtract(e),s=o.multiply(new re("3")),a=new Nt(this.curve,this.x,this.y),u=a.negate(),l;for(l=n.bitLength()-2;l>0;--l){i=i.twice();var h=n.testBit(l),m=t.testBit(l);h!=m&&(i=i.add(h?this:r))}for(l=s.bitLength()-2;l>0;--l){a=a.twice();var p=s.testBit(l),d=o.testBit(l);p!=d&&(a=a.add(p?a:u))}return i}function HV(e,t,n){var r;e.bitLength()>n.bitLength()?r=e.bitLength()-1:r=n.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);r>=0;)i=i.twice(),e.testBit(r)?n.testBit(r)?i=i.add(o):i=i.add(this):n.testBit(r)&&(i=i.add(t)),--r;return i}Nt.prototype.getX=PV;Nt.prototype.getY=kV;Nt.prototype.equals=TV;Nt.prototype.isInfinity=RV;Nt.prototype.negate=OV;Nt.prototype.add=NV;Nt.prototype.twice=LV;Nt.prototype.multiply=UV;Nt.prototype.multiplyTwo=HV;function Aa(e,t,n){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(n),this.infinity=new Nt(this,null,null)}function MV(){return this.q}function qV(){return this.a}function jV(){return this.b}function KV(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function VV(){return this.infinity}function GV(e){return new qn(this.q,e)}function zV(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=e.substr(0,2),n=e.substr(2),r=this.fromBigInteger(new re(l,16)),i=this.getA(),o=this.getB(),s=r.square().add(i).multiply(r).add(o),a=s.sqrt();return t=="03"&&(a=a.negate()),new Nt(this,r,a);case 4:case 6:case 7:var u=(e.length-2)/2,l=e.substr(2,u),h=e.substr(u+2,u);return new Nt(this,this.fromBigInteger(new re(l,16)),this.fromBigInteger(new re(h,16)));default:return null}}Aa.prototype.getQ=MV;Aa.prototype.getA=qV;Aa.prototype.getB=jV;Aa.prototype.equals=KV;Aa.prototype.getInfinity=VV;Aa.prototype.fromBigInteger=GV;Aa.prototype.decodePointHex=zV;qn.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};Nt.prototype.getEncoded=function(e){var t=function(o,s){var a=o.toByteArrayUnsigned();if(s<a.length)a=a.slice(a.length-s);else for(;s>a.length;)a.unshift(0);return a},n=this.getX().toBigInteger(),r=this.getY().toBigInteger(),i=t(n,32);return e?r.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(r,32))),i};Nt.decodeFrom=function(e,t){var n=t[0],r=t.length-1,i=t.slice(1,1+r/2),o=t.slice(1+r/2,1+r);i.unshift(0),o.unshift(0);var s=new re(i),a=new re(o);return new Nt(e,e.fromBigInteger(s),e.fromBigInteger(a))};Nt.decodeFromHex=function(e,t){var n=t.substr(0,2),r=t.length-2,i=t.substr(2,r/2),o=t.substr(2+r/2,r/2),s=new re(i,16),a=new re(o,16);return new Nt(e,e.fromBigInteger(s),e.fromBigInteger(a))};Nt.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),n=e.y.subtract(this.y),r=n.divide(t),i=r.square().subtract(this.x).subtract(e.x),o=r.multiply(this.x.subtract(i)).subtract(this.y);return new Nt(this.curve,i,o)};Nt.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=this.curve.fromBigInteger(re.valueOf(2)),t=this.curve.fromBigInteger(re.valueOf(3)),n=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),r=n.square().subtract(this.x.multiply(e)),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new Nt(this.curve,r,i)};Nt.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,n=t.multiply(new re("3")),r=this.negate(),i=this,o;for(o=n.bitLength()-2;o>0;--o){i=i.twice();var s=n.testBit(o),a=t.testBit(o);s!=a&&(i=i.add2D(s?this:r))}return i};Nt.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),n=this.curve.getA().toBigInteger(),r=this.curve.getB().toBigInteger(),i=this.curve.getQ(),o=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(n.multiply(e)).add(r).mod(i);return o.equals(s)};Nt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};Nt.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),n=this.getY().toBigInteger();if(t.compareTo(re.ONE)<0||t.compareTo(e.subtract(re.ONE))>0)throw new Error("x coordinate out of bounds");if(n.compareTo(re.ONE)<0||n.compareTo(e.subtract(re.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 G8=(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}))',n='(?:"'+t+'*")',r=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+n+")","g"),i=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),o={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
`,r:"\r",t:" "};function s(m,p,d){return p?o[p]:String.fromCharCode(parseInt(d,16))}var a=new String(""),u="\\",l={"{":Object,"[":Array},h=Object.hasOwnProperty;return function(m,p){var d=m.match(r),v,g=d[0],y=!1;g==="{"?v={}:g==="["?v=[]:(v=[],y=!0);for(var w,E=[v],C=1-y,_=d.length;C<_;++C){g=d[C];var F;switch(g.charCodeAt(0)){default:F=E[0],F[w||F.length]=+g,w=void 0;break;case 34:if(g=g.substring(1,g.length-1),g.indexOf(u)!==-1&&(g=g.replace(i,s)),F=E[0],!w)if(F instanceof Array)w=F.length;else{w=g||a;break}F[w]=g,w=void 0;break;case 91:F=E[0],E.unshift(F[w||F.length]=[]),w=void 0;break;case 93:E.shift();break;case 102:F=E[0],F[w||F.length]=!1,w=void 0;break;case 110:F=E[0],F[w||F.length]=null,w=void 0;break;case 116:F=E[0],F[w||F.length]=!0,w=void 0;break;case 123:F=E[0],E.unshift(F[w||F.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,S){var I=K[S];if(I&&typeof I=="object"){var q=null;for(var L in I)if(h.call(I,L)&&I!==K){var T=H(I,L);T!==void 0?I[L]=T:(q||(q=[]),q.push(L))}if(q)for(var O=q.length;--O>=0;)delete I[q[O]]}return p.call(K,S,I)};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 $d(e)},this.getPEMStringFromHex=function(e,t){return xr(e,t)},this.newObject=function(e){var t=A,n=t.asn1,r=n.ASN1Object,i=n.DERBoolean,o=n.DERInteger,s=n.DERBitString,a=n.DEROctetString,u=n.DERNull,l=n.DERObjectIdentifier,h=n.DEREnumerated,m=n.DERUTF8String,p=n.DERNumericString,d=n.DERPrintableString,v=n.DERTeletexString,g=n.DERIA5String,y=n.DERUTCTime,w=n.DERGeneralizedTime,E=n.DERVisibleString,C=n.DERBMPString,_=n.DERSequence,F=n.DERSet,H=n.DERTaggedObject,K=n.ASN1Util.newObject;if(e instanceof n.ASN1Object)return e;var S=Object.keys(e);if(S.length!=1)throw new Error("key of param shall be only one.");var I=S[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+I+":")==-1)throw new Error("undefined key: "+I);if(I=="bool")return new i(e[I]);if(I=="int")return new o(e[I]);if(I=="bitstr")return new s(e[I]);if(I=="octstr")return new a(e[I]);if(I=="null")return new u(e[I]);if(I=="oid")return new l(e[I]);if(I=="enum")return new h(e[I]);if(I=="utf8str")return new m(e[I]);if(I=="numstr")return new p(e[I]);if(I=="prnstr")return new d(e[I]);if(I=="telstr")return new v(e[I]);if(I=="ia5str")return new g(e[I]);if(I=="utctime")return new y(e[I]);if(I=="gentime")return new w(e[I]);if(I=="visstr")return new E(e[I]);if(I=="bmpstr")return new C(e[I]);if(I=="asn1")return new r(e[I]);if(I=="seq"){for(var q=e[I],L=[],T=0;T<q.length;T++){var O=K(q[T]);L.push(O)}return new _({array:L})}if(I=="set"){for(var q=e[I],L=[],T=0;T<q.length;T++){var O=K(q[T]);L.push(O)}return new F({array:L})}if(I=="tag"){var R=e[I];if(Object.prototype.toString.call(R)==="[object Array]"&&R.length==3){var N=K(R[2]);return new H({tag:R[0],explicit:R[1],obj:N})}else return new H(R)}},this.jsonToASN1HEX=function(e){var t=this.newObject(e);return t.tohex()}};A.asn1.ASN1Util.oidHexToInt=function(e){for(var i="",t=parseInt(e.substr(0,2),16),n=Math.floor(t/40),r=t%40,i=n+"."+r,o="",s=2;s<e.length;s+=2){var a=parseInt(e.substr(s,2),16),u=("00000000"+a.toString(2)).slice(-8);if(o=o+u.substr(1,7),u.substr(0,1)=="0"){var l=new re(o,2);i=i+"."+l.toString(10),o=""}}return i};A.asn1.ASN1Util.oidIntToHex=function(e){var t=function(a){var u=a.toString(16);return u.length==1&&(u="0"+u),u},n=function(a){var u="",l=new re(a,10),h=l.toString(2),m=7-h.length%7;m==7&&(m=0);for(var p="",d=0;d<m;d++)p+="0";h=p+h;for(var d=0;d<h.length-1;d+=7){var v=h.substr(d,7);d!=h.length-7&&(v="1"+v),u+=t(parseInt(v,2))}return u};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",i=e.split("."),o=parseInt(i[0])*40+parseInt(i[1]);r+=t(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r};A.asn1.ASN1Object=function(e){var t=!0,n=null,r="00",i="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 s=this.hV.length/2,a=s.toString(16);if(a.length%2==1&&(a="0"+a),s<128)return a;var u=a.length/2;if(u>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+s.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(s){this.params=s},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,n=null;this.getString=function(){return this.s},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.s=r,this.hV=wm(this.s).toLowerCase()},this.setStringHex=function(r){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},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))};Ee(A.asn1.DERAbstractString,A.asn1.ASN1Object);A.asn1.DERAbstractTime=function(e){A.asn1.DERAbstractTime.superclass.constructor.call(this);var t=null,n=null;this.localDateToUTC=function(r){var i=r.getTime()+r.getTimezoneOffset()*6e4,o=new Date(i);return o},this.formatDate=function(r,i,o){var s=this.zeroPadding,a=this.localDateToUTC(r),u=String(a.getFullYear());i=="utc"&&(u=u.substr(2,2));var l=s(String(a.getMonth()+1),2),h=s(String(a.getDate()),2),m=s(String(a.getHours()),2),p=s(String(a.getMinutes()),2),d=s(String(a.getSeconds()),2),v=u+l+h+m+p+d;if(o===!0){var g=a.getMilliseconds();if(g!=0){var y=s(String(g),3);y=y.replace(/[0]+$/,""),v=v+"."+y}}return v+"Z"},this.zeroPadding=function(r,i){return r.length>=i?r:new Array(i-r.length+1).join("0")+r},this.setByParam=function(r){this.hV=null,this.hTLV=null,this.params=r},this.getString=function(){},this.setString=function(r){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.str=r},this.setByDate=function(r){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.date=r},this.setByDateValue=function(r,i,o,s,a,u){var l=new Date(Date.UTC(r,i-1,o,s,a,u,0));this.setByDate(l)},this.getFreshValueHex=function(){return this.hV}};Ee(A.asn1.DERAbstractTime,A.asn1.ASN1Object);A.asn1.DERAbstractStructured=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null;this.setByASN1ObjectArray=function(n){this.hTLV=null,this.isModified=!0,this.asn1Array=n},this.appendASN1Object=function(n){this.hTLV=null,this.isModified=!0,this.asn1Array.push(n)},this.asn1Array=new Array,typeof e<"u"&&typeof e.array<"u"&&(this.asn1Array=e.array)};Ee(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"};Ee(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=$d;this.setByBigInteger=function(n){this.isModified=!0,this.params={bigint:n}},this.setByInteger=function(n){this.isModified=!0,this.params=n},this.setValueHex=function(n){this.isModified=!0,this.params={hex:n}},this.getFreshValueHex=function(){var n=this.params,r=null;if(n==null)throw new Error("value not set");if(typeof n=="object"&&n.hex!=null)return this.hV=n.hex,this.hV;if(typeof n=="number")r=new re(String(n),10);else if(n.int!=null)r=new re(String(n.int),10);else if(n.bigint!=null)r=n.bigint;else throw new Error("wrong parameter");return this.hV=t(r),this.hV},e!=null&&(this.params=e)};Ee(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(n){this.hTLV=null,this.isModified=!0,this.hV=n},this.setUnusedBitsAndHexValue=function(n,r){if(n<0||7<n)throw"unused bits shall be from 0 to 7: u = "+n;var i="0"+n;this.hTLV=null,this.isModified=!0,this.hV=i+r},this.setByBinaryString=function(n){n=n.replace(/0+$/,"");var r=8-n.length%8;r==8&&(r=0),n+="0000000".substr(0,r);for(var i="",o=0;o<n.length-1;o+=8){var s=n.substr(o,8),a=parseInt(s,2).toString(16);a.length==1&&(a="0"+a),i+=a}this.hTLV=null,this.isModified=!0,this.hV="0"+r+i},this.setByBooleanArray=function(n){for(var r="",i=0;i<n.length;i++)n[i]==!0?r+="1":r+="0";this.setByBinaryString(r)},this.newFalseArray=function(n){for(var r=new Array(n),i=0;i<n;i++)r[i]=!1;return r},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))};Ee(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"};Ee(A.asn1.DEROctetString,A.asn1.DERAbstractString);A.asn1.DERNull=function(){A.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};Ee(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 n=tD(t);if(n==null)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(t){var n=A.asn1.x509.OID.name2oid(t);if(n!=="")this.setValueOidString(n);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)};Ee(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=$d(t)},this.setByInteger=function(t){var n=new re(String(t),10);this.setByBigInteger(n)},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))};Ee(A.asn1.DEREnumerated,A.asn1.ASN1Object);A.asn1.DERUTF8String=function(e){A.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"};Ee(A.asn1.DERUTF8String,A.asn1.DERAbstractString);A.asn1.DERNumericString=function(e){A.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"};Ee(A.asn1.DERNumericString,A.asn1.DERAbstractString);A.asn1.DERPrintableString=function(e){A.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"};Ee(A.asn1.DERPrintableString,A.asn1.DERAbstractString);A.asn1.DERTeletexString=function(e){A.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"};Ee(A.asn1.DERTeletexString,A.asn1.DERAbstractString);A.asn1.DERIA5String=function(e){A.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"};Ee(A.asn1.DERIA5String,A.asn1.DERAbstractString);A.asn1.DERVisibleString=function(e){A.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"};Ee(A.asn1.DERVisibleString,A.asn1.DERAbstractString);A.asn1.DERBMPString=function(e){A.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"};Ee(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=vs(t);else throw new Error("malformed string for UTCTime: "+t);else if(t.str!=null)this.hV=vs(t.str);else if(t.date==null&&t.millis==!0){var n=new Date;this.hV=vs(this.formatDate(n,"utc",!0))}else if(t.date!=null&&t.date instanceof Date){var r=t.millis===!0;this.hV=vs(this.formatDate(t.date,"utc",r))}else t instanceof Date&&(this.hV=vs(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)};Ee(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=vs(t);else throw new Error("malformed string for GeneralizedTime: "+t);else if(t.str!=null)this.hV=vs(t.str);else if(t.date==null&&t.millis==!0){var n=new Date;this.hV=vs(this.formatDate(n,"gen",!0))}else if(t.date!=null&&t.date instanceof Date){var r=t.millis===!0;this.hV=vs(this.formatDate(t.date,"gen",r))}else t instanceof Date&&(this.hV=vs(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)};Ee(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="",n=0;n<this.asn1Array.length;n++){var r=this.asn1Array[n];t+=r.tohex()}return this.hV=t,this.hV}};Ee(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,n=0;n<this.asn1Array.length;n++){var r=this.asn1Array[n];t.push(r.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)};Ee(A.asn1.DERSet,A.asn1.DERAbstractStructured);A.asn1.DERTaggedObject=function(e){A.asn1.DERTaggedObject.superclass.constructor.call(this);var t=A.asn1,n=$e,r=n.getV,i=n.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(s,a,u){this.params={tag:a,explicit:s,obj:u}},this.getFreshValueHex=function(){var s=this.params;if(s.explicit==null&&(s.explicit=!0),s.tage!=null&&(s.tag=s.tage,s.explicit=!0),s.tagi!=null&&(s.tag=s.tagi,s.explicit=!1),s.str!=null)this.hV=wm(s.str);else if(s.hex!=null)this.hV=s.hex;else if(s.obj!=null){var a;s.obj instanceof t.ASN1Object?a=s.obj.tohex():typeof s.obj=="object"&&(a=o(s.obj).tohex()),s.explicit?this.hV=a:this.hV=r(a,0)}else throw new Error("str, hex nor obj not specified");return s.tag==null&&(s.tag="a0"),this.hT=s.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(s){this.params=s},e!==void 0&&this.setByParam(e)};Ee(A.asn1.DERTaggedObject,A.asn1.ASN1Object);var $e=new function(){};$e.getLblen=function(e,t){if(e.substr(t+2,1)!="8")return 1;var n=parseInt(e.substr(t+3,1));return n==0?-1:0<n&&n<10?n+1:-2};$e.getL=function(e,t){var n=$e.getLblen(e,t);return n<1?"":e.substr(t+2,n*2)};$e.getVblen=function(e,t){var n,r;return n=$e.getL(e,t),n==""?-1:(n.substr(0,1)==="8"?r=new re(n.substr(2),16):r=new re(n,16),r.intValue())};$e.getVidx=function(e,t){var n=$e.getLblen(e,t);return n<0?n:t+(n+1)*2};$e.getV=function(e,t){var n=$e.getVidx(e,t),r=$e.getVblen(e,t);return e.substr(n,r*2)};$e.getTLV=function(e,t){return e.substr(t,2)+$e.getL(e,t)+$e.getV(e,t)};$e.getTLVblen=function(e,t){return 2+$e.getLblen(e,t)*2+$e.getVblen(e,t)*2};$e.getNextSiblingIdx=function(e,t){var n=$e.getVidx(e,t),r=$e.getVblen(e,t);return n+r*2};$e.getChildIdx=function(e,t){var n=$e,r=[],i,o,s;if(i=n.getVidx(e,t),o=n.getVblen(e,t)*2,i+o>e.length)throw new Error("too short ASN.1 value");e.substr(t,2)=="03"&&(i+=2,o-=2),s=0;for(var a=i;s<=o;){var u=n.getTLVblen(e,a);if(u<=0)throw new Error("malformed ASN.1: invalid TLV length");if(s+=u,s<=o&&r.push(a),a+=u,s>=o)break}return r};$e.getNthChildIdx=function(e,t,n){var r=$e.getChildIdx(e,t);return r[n]};$e.getIdxbyList=function(e,t,n,r){var i=$e,o,s;return n.length==0?r!==void 0&&e.substr(t,2)!==r?-1:t:(o=n.shift(),s=i.getChildIdx(e,t),o>=s.length?-1:i.getIdxbyList(e,s[o],n,r))};$e.getIdxbyListEx=function(e,t,n,r){var i=$e,o,s;if(n.length==0)return r!==void 0&&e.substr(t,2)!==r?-1:t;o=n.shift(),s=i.getChildIdx(e,t);for(var a=0,u=0;u<s.length;u++){var l=e.substr(s[u],2);if(typeof o=="number"&&!i.isContextTag(l)&&a==o||typeof o=="string"&&i.isContextTag(l,o))return i.getIdxbyListEx(e,s[u],n,r);i.isContextTag(l)||a++}return-1};$e.getTLVbyList=function(e,t,n,r){var i=$e,o=i.getIdxbyList(e,t,n,r);return o==-1||o>=e.length?null:i.getTLV(e,o)};$e.getTLVbyListEx=function(e,t,n,r){var i=$e,o=i.getIdxbyListEx(e,t,n,r);return o==-1?null:i.getTLV(e,o)};$e.getVbyList=function(e,t,n,r,i){var o=$e,s,a;return s=o.getIdxbyList(e,t,n,r),s==-1||s>=e.length?null:(a=o.getV(e,s),i===!0&&(a=a.substr(2)),a)};$e.getVbyListEx=function(e,t,n,r,i){var o=$e,s,a,u;return s=o.getIdxbyListEx(e,t,n,r),s==-1?null:(u=o.getV(e,s),e.substr(s,2)=="03"&&i!==!1&&(u=u.substr(2)),u)};$e.getInt=function(e,t,n){n==null&&(n=-1);try{var r=e.substr(t,2);if(r!="02"&&r!="03")return n;var i=$e.getV(e,t);return r=="02"?parseInt(i,16):rD(i)}catch{return n}};$e.getOID=function(e,t,n){n==null&&(n=null);try{if(e.substr(t,2)!="06")return n;var r=$e.getV(e,t);return Sm(r)}catch{return n}};$e.getOIDName=function(e,t,n){n==null&&(n=null);try{var r=$e.getOID(e,t,n);if(r==n)return n;var i=A.asn1.x509.OID.oid2name(r);return i==""?r:i}catch{return n}};$e.getString=function(e,t,n){n==null&&(n=null);try{var r=$e.getV(e,t);return ws(r)}catch{return n}};$e.hextooidstr=function(e){var t=function(m,p){return m.length>=p?m:new Array(p-m.length+1).join("0")+m},n=[],r=e.substr(0,2),i=parseInt(r,16);n[0]=new String(Math.floor(i/40)),n[1]=new String(i%40);for(var o=e.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(a*2,2),16));for(var u=[],l="",a=0;a<s.length;a++)s[a]&128?l=l+t((s[a]&127).toString(2),7):(l=l+t((s[a]&127).toString(2),7),u.push(new String(parseInt(l,2))),l="");var h=n.join(".");return u.length>0&&(h=h+"."+u.join(".")),h};$e.dump=function(e,t,n,r){var i=$e,o=i.getV,s=i.dump,a=i.getChildIdx,u=e;e instanceof A.asn1.ASN1Object&&(u=e.tohex());var l=function(K,S){if(K.length<=S*2)return K;var I=K.substr(0,S)+"..(total "+K.length/2+"bytes).."+K.substr(K.length-S,S);return I};t===void 0&&(t={ommit_long_octet:32}),n===void 0&&(n=0),r===void 0&&(r="");var h=t.ommit_long_octet,F=u.substr(n,2);if(F=="01"){var m=o(u,n);return m=="00"?r+`BOOLEAN FALSE
`:r+`BOOLEAN TRUE
`}if(F=="02"){var m=o(u,n);return r+"INTEGER "+l(m,h)+`
`}if(F=="03"){var m=o(u,n);if(i.isASN1HEX(m.substr(2))){var p=r+`BITSTRING, encapsulates
`;return p=p+s(m.substr(2),t,0,r+" "),p}else return r+"BITSTRING "+l(m,h)+`
`}if(F=="04"){var m=o(u,n);if(i.isASN1HEX(m)){var p=r+`OCTETSTRING, encapsulates
`;return p=p+s(m,t,0,r+" "),p}else return r+"OCTETSTRING "+l(m,h)+`
`}if(F=="05")return r+`NULL
`;if(F=="06"){var d=o(u,n),v=A.asn1.ASN1Util.oidHexToInt(d),g=A.asn1.x509.OID.oid2name(v),y=v.replace(/\./g," ");return g!=""?r+"ObjectIdentifier "+g+" ("+y+`)
`:r+"ObjectIdentifier ("+y+`)
`}if(F=="0a")return r+"ENUMERATED "+parseInt(o(u,n))+`
`;if(F=="0c")return r+"UTF8String '"+Gt(o(u,n))+`'
`;if(F=="13")return r+"PrintableString '"+Gt(o(u,n))+`'
`;if(F=="14")return r+"TeletexString '"+Gt(o(u,n))+`'
`;if(F=="16")return r+"IA5String '"+Gt(o(u,n))+`'
`;if(F=="17")return r+"UTCTime "+Gt(o(u,n))+`
`;if(F=="18")return r+"GeneralizedTime "+Gt(o(u,n))+`
`;if(F=="1a")return r+"VisualString '"+Gt(o(u,n))+`'
`;if(F=="1e")return r+"BMPString '"+hE(o(u,n))+`'
`;if(F=="30"){if(u.substr(n,4)=="3000")return r+`SEQUENCE {}
`;var p=r+`SEQUENCE
`,w=a(u,n),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=i.oidname(o(u,w[0])),C=JSON.parse(JSON.stringify(t));C.x509ExtName=g,E=C}for(var _=0;_<w.length;_++)p=p+s(u,E,w[_],r+" ");return p}if(F=="31"){for(var p=r+`SET
`,w=a(u,n),_=0;_<w.length;_++)p=p+s(u,t,w[_],r+" ");return p}var F=parseInt(F,16);if((F&128)!=0){var H=F&31;if((F&32)!=0){for(var p=r+"["+H+`]
`,w=a(u,n),_=0;_<w.length;_++)p=p+s(u,t,w[_],r+" ");return p}else{var m=o(u,n);if($e.isASN1HEX(m)){var p=r+"["+H+`]
`;return p=p+s(m,t,0,r+" "),p}else(m.substr(0,8)=="68747470"||t.x509ExtName==="subjectAltName"&&H==2)&&(m=Gt(m));var p=r+"["+H+"] "+m+`
`;return p}}return r+"UNKNOWN("+F+") "+o(u,n)+`
`};$e.parse=function(e){var t=$e,n=t.parse,r=t.isASN1HEX,i=t.getV,o=t.getTLV,s=t.getChildIdx,a=A.asn1,u=a.ASN1Util.oidHexToInt,l=a.x509.OID.oid2name,h=Gt,m=hE,p=QV,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(I){for(var q=[],L=s(I,0),T=0;T<L.length;T++){var O=L[T],R=o(I,O),N=n(R);q.push(N)}return q},g=e.substr(0,2),y={},w=i(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(!r(E))throw"not encap";return{bitstr:{obj:n(E)}}}catch{var C=null;return w.length<=10&&(C=iD(w)),C==null?{bitstr:{hex:w}}:{bitstr:{bin:C}}}else if(g=="04")try{if(!r(w))throw"not encap";return{octstr:{obj:n(w)}}}catch{return{octstr:{hex:w}}}else{if(g=="05")return{null:""};if(g=="06"){var _=u(w),F=l(_);return F==""?{oid:_}:{oid:F}}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=h(w);return y[d[g]]={str:H},y}else if(g.match(/^8[0-9]$/)){var H=h(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(!r(w))throw new Error("not encap");return{tag:{tag:g,explicit:!0,obj:n(w)}}}catch{return{tag:{tag:g,explicit:!0,hex:w}}}else{var K=new A.asn1.ASN1Object;K.hV=w;var S=K.getLengthHexFromValue();return{asn1:{tlv:g+S+w}}}}}};$e.isContextTag=function(e,t){e=e.toLowerCase();var n,r;try{n=parseInt(e,16)}catch{return-1}if(t===void 0)return(n&192)==128;try{var i=t.match(/^\[[0-9]+\]$/);return i==null||(r=parseInt(t.substr(1,t.length-1),10),r>31)?!1:(n&192)==128&&(n&31)==r}catch{return!1}};$e.isASN1HEX=function(e){var t=$e;if(e.length%2==1)return!1;var n=t.getVblen(e,0),r=e.substr(0,2),i=t.getL(e,0),o=e.length-r.length-i.length;return o==n*2};$e.checkStrictDER=function(e,t,n,r,i){var o=$e;if(n===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");n=e.length,r=e.length/2,r<128?i=1:i=Math.ceil(r.toString(16))+1}var s=o.getL(e,t);if(s.length>i*2)throw new Error("L of TLV too long: idx="+t);var a=o.getVblen(e,t);if(a>r)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 h=e.substr(t,2);if(h==="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(h,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],n,r,i)}if(p*2!=d)throw new Error("sum of children's TLV length and L unmatch: "+p*2+"!="+d)}};$e.oidname=function(e){var t=A.asn1;A.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var n=t.x509.OID.oid2name(e);return n===""&&(n=e),n};(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,n=t.asn1,r=n.DERBitString,i=n.DERSequence,o=n.x509,s=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 h=u.tbsobj.tohex(),m=new A.crypto.Signature({alg:l});m.init(u.cakey),m.updateHex(h),u.sighex=m.sign()},this.getPEM=function(){return xr(this.tohex(),"CERTIFICATE")},this.tohex=function(){var u=this.params;if((u.tbsobj==null||u.tbsobj==null)&&(u.tbsobj=new s(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 r({hex:"00"+u.sighex}));var h=new i({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};Ee(A.asn1.x509.Certificate,A.asn1.ASN1Object);A.asn1.x509.TBSCertificate=function(e){A.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=A,n=t.asn1,r=n.x509,i=n.DERTaggedObject,o=n.DERInteger,s=n.DERSequence,a=r.AlgorithmIdentifier,u=r.Time,l=r.X500Name,h=r.Extensions,m=r.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 i({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 s({array:[new u(d.notbefore),new u(d.notafter)]})),p.push(new l(d.subject)),p.push(new m(_t.getKey(d.sbjpubkey))),d.ext!==void 0&&d.ext.length>0&&p.push(new i({tag:"a3",obj:new h(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)};Ee(A.asn1.x509.TBSCertificate,A.asn1.ASN1Object);A.asn1.x509.Extensions=function(e){A.asn1.x509.Extensions.superclass.constructor.call(this);var t=A,n=t.asn1,r=n.DERSequence,i=n.x509;this.aParam=[],this.setByParam=function(o){this.aParam=o},this.tohex=function(){for(var o=[],s=0;s<this.aParam.length;s++){var a=this.aParam[s],u=a.extname,l=null;if(a.extn!=null)l=new i.PrivateExtension(a);else if(u=="subjectKeyIdentifier")l=new i.SubjectKeyIdentifier(a);else if(u=="keyUsage")l=new i.KeyUsage(a);else if(u=="subjectAltName")l=new i.SubjectAltName(a);else if(u=="issuerAltName")l=new i.IssuerAltName(a);else if(u=="basicConstraints")l=new i.BasicConstraints(a);else if(u=="nameConstraints")l=new i.NameConstraints(a);else if(u=="cRLDistributionPoints")l=new i.CRLDistributionPoints(a);else if(u=="certificatePolicies")l=new i.CertificatePolicies(a);else if(u=="policyMappings")l=new i.PolicyMappings(a);else if(u=="policyConstraints")l=new i.PolicyConstraints(a);else if(u=="inhibitAnyPolicy")l=new i.InhibitAnyPolicy(a);else if(u=="authorityKeyIdentifier")l=new i.AuthorityKeyIdentifier(a);else if(u=="extKeyUsage")l=new i.ExtKeyUsage(a);else if(u=="authorityInfoAccess")l=new i.AuthorityInfoAccess(a);else if(u=="cRLNumber")l=new i.CRLNumber(a);else if(u=="cRLReason")l=new i.CRLReason(a);else if(u=="ocspNonce")l=new i.OCSPNonce(a);else if(u=="ocspNoCheck")l=new i.OCSPNoCheck(a);else if(u=="adobeTimeStamp")l=new i.AdobeTimeStamp(a);else if(u=="subjectDirectoryAttributes")l=new i.SubjectDirectoryAttributes(a);else throw new Error("extension not supported:"+JSON.stringify(a));l!=null&&o.push(l)}var h=new r({array:o});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.x509.Extensions,A.asn1.ASN1Object);A.asn1.x509.Extension=function(e){A.asn1.x509.Extension.superclass.constructor.call(this);var t=null,n=A,r=n.asn1,i=r.DERObjectIdentifier,o=r.DEROctetString,s=r.DERBitString,a=r.DERBoolean,u=r.DERSequence;this.tohex=function(){var l=new i({oid:this.oid}),h=new o({hex:this.getExtnValueHex()}),m=new Array;m.push(l),this.critical&&m.push(new a),m.push(h);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)};Ee(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,n={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var r=this.getBinValue();return this.asn1ExtnValue=new A.asn1.DERBitString({bin:r}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var r=this.params;if(typeof r!="object"||typeof r.names!="object"&&typeof r.bin!="string")throw new t("parameter not yet set");if(r.names!=null)return pm(r.names,n);if(r.bin!=null)return r.bin;throw new t("parameter not set properly")},this.oid="2.5.29.15",e!==void 0&&(this.params=e)};Ee(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,n=t.DERBoolean,r=t.DERInteger,i=t.DERSequence,o=!1,s=-1;this.getExtnValueHex=function(){var a=new Array;this.cA&&a.push(new n),this.pathLen>-1&&a.push(new r({int:this.pathLen}));var u=new i({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))};Ee(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,n=t.asn1,r=n.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var o=[],s=0;s<i.length;s++)if(i[s]instanceof A.asn1.ASN1Object)o.push(i[s]);else{var a=new r.DistributionPoint(i[s]);o.push(a)}this.asn1ExtnValue=new n.DERSequence({array:o})},this.setByOneURI=function(i){var o=new r.DistributionPoint({fulluri:i});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))};Ee(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,n=A,r=n.asn1,i=r.x509.DistributionPointName;this.tohex=function(){var o=new r.DERSequence;if(this.asn1DP!=null){var s=new r.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});o.appendASN1Object(s)}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 i(e.dpname):e.fulluri!==void 0&&(this.asn1DP=new i({full:[{uri:e.fulluri}]})))};Ee(A.asn1.x509.DistributionPoint,A.asn1.ASN1Object);A.asn1.x509.DistributionPointName=function(e){A.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=null,n=null,r=null,i=null,o=A,s=o.asn1,a=s.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(s.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 s.x509.GeneralNames(e.full);else throw new Error("This class supports GeneralNames only as argument")};Ee(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,n=t.asn1,r=n.x509,i=n.DERSequence,o=r.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var s=[],a=0;a<this.params.array.length;a++)s.push(new o(this.params.array[a]));var u=new i({array:s});return this.asn1ExtnValue=u,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",e!==void 0&&(this.params=e)};Ee(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,n=t.DERSequence,r=t.DERObjectIdentifier,i=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 r(this.params.policyoid)];if(this.params.array!==void 0){for(var s=[],a=0;a<this.params.array.length;a++)s.push(new i(this.params.array[a]));s.length>0&&o.push(new n({array:s}))}var u=new n({array:o});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ee(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,n=t.DERSequence,r=t.DERIA5String,i=t.DERObjectIdentifier,o=t.x509.UserNotice;this.params=null,this.tohex=function(){if(this.params.cps!==void 0){var s=new n({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]});return s.tohex()}if(this.params.unotice!=null){var s=new n({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new o(this.params.unotice)]});return s.tohex()}},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ee(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,n=A.asn1.DERInteger,r=A.asn1.x509.DisplayText,i=A.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var o=[];this.params.noticeref!==void 0&&o.push(new i(this.params.noticeref)),this.params.exptext!==void 0&&o.push(new r(this.params.exptext));var s=new t({array:o});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ee(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,n=A.asn1.DERInteger,r=A.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var i=[];if(this.params.org!==void 0&&i.push(new r(this.params.org)),this.params.noticenum!==void 0){for(var o=[],s=this.params.noticenum,a=0;a<s.length;a++)o.push(new n(s[a]));i.push(new t({array:o}))}if(i.length==0)throw new Error("parameter is empty");var u=new t({array:i});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ee(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"))};Ee(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,n=t.asn1,r=n.x509,i=n.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){for(var o=this.params,s=[],a=0;a<o.array.length;a++){var u=o.array[a];s.push({seq:[{oid:u[0]},{oid:u[1]}]})}return this.asn1ExtnValue=i({seq:s}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",e!==void 0&&(this.params=e)};Ee(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,n=t.asn1,r=n.x509,i=n.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){var o=this.params,s=[];return o.reqexp!=null&&s.push({tag:{tagi:"80",obj:{int:o.reqexp}}}),o.inhibit!=null&&s.push({tag:{tagi:"81",obj:{int:o.inhibit}}}),this.asn1ExtnValue=i({seq:s}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",e!==void 0&&(this.params=e)};Ee(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,n=t.asn1,r=n.x509,i=n.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=i({int:this.params.skip}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.54",e!==void 0&&(this.params=e)};Ee(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,n=t.asn1,r=n.x509,i=n.ASN1Util.newObject,o=r.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var s=this.params,a=[];if(s.permit!=null&&s.permit.length!=null){for(var u=[],l=0;l<s.permit.length;l++)u.push(new o(s.permit[l]));a.push({tag:{tagi:"a0",obj:{seq:u}}})}if(s.exclude!=null&&s.exclude.length!=null){for(var h=[],l=0;l<s.exclude.length;l++)h.push(new o(s.exclude[l]));a.push({tag:{tagi:"a1",obj:{seq:h}}})}return this.asn1ExtnValue=i({seq:a}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",e!==void 0&&(this.params=e)};Ee(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,n=t.x509,r=n.GeneralName,i=t.ASN1Util.newObject;this.params=null,this.setByParam=function(o){this.params=o},this.tohex=function(){var o=this.params,s=[new r(o)];o.min!=null&&s.push({tag:{tagi:"80",obj:{int:o.min}}}),o.max!=null&&s.push({tag:{tagi:"81",obj:{int:o.max}}});var a=i({seq:s});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(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,n=t.asn1;this.setPurposeArray=function(r){this.asn1ExtnValue=new n.DERSequence;for(var i=0;i<r.length;i++){var o=new n.DERObjectIdentifier(r[i]);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)};Ee(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,n=t.asn1,r=n.DERTaggedObject,i=n.x509.GeneralNames,o=t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var s=new Array;this.asn1KID&&s.push(new r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&s.push(new r({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&s.push(new r({explicit:!1,tag:"82",obj:this.asn1CertSN}));var a=new n.DERSequence({array:s});return this.asn1ExtnValue=a,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(s){if(s.str!==void 0||s.hex!==void 0)this.asn1KID=new A.asn1.DEROctetString(s);else if(typeof s=="object"&&A.crypto.Util.isKey(s)||typeof s=="string"&&s.indexOf("BEGIN ")!=-1){var a=s;typeof s=="string"&&(a=_t.getKey(s));var u=_t.getKeyID(a);this.asn1KID=new A.asn1.DEROctetString({hex:u})}},this.setCertIssuerByParam=function(s){s.str!==void 0||s.ldapstr!==void 0||s.hex!==void 0||s.certsubject!==void 0||s.certissuer!==void 0?this.asn1CertIssuer=new A.asn1.x509.X500Name(s):typeof s=="string"&&s.indexOf("BEGIN ")!=-1&&s.indexOf("CERTIFICATE")!=-1&&(this.asn1CertIssuer=new A.asn1.x509.X500Name({certissuer:s}))},this.setCertSNByParam=function(s){if(s.str!==void 0||s.bigint!==void 0||s.hex!==void 0)this.asn1CertSN=new A.asn1.DERInteger(s);else if(typeof s=="string"&&s.indexOf("BEGIN ")!=-1&&s.indexOf("CERTIFICATE")){var a=new tt;a.readCertPEM(s);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)))};Ee(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,n=t.asn1,r=n.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(i){if(i.str!==void 0||i.hex!==void 0)this.asn1KID=new r(i);else if(typeof i=="object"&&A.crypto.Util.isKey(i)||typeof i=="string"&&i.indexOf("BEGIN")!=-1){var o=i;typeof i=="string"&&(o=_t.getKey(i));var s=_t.getKeyID(o);this.asn1KID=new A.asn1.DEROctetString({hex:s})}},this.oid="2.5.29.14",e!==void 0&&e.kid!==void 0&&this.setKIDByParam(e.kid)};Ee(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 n=new Array,r=A,i=r.asn1,o=i.DERSequence,s=i.DERObjectIdentifier,a=i.x509.GeneralName,u=0;u<t.length;u++){var l,h=t[u];if(h.ocsp!==void 0)l=new o({array:[new s({oid:"1.3.6.1.5.5.7.48.1"}),new a({uri:h.ocsp})]});else if(h.caissuer!==void 0)l=new o({array:[new s({oid:"1.3.6.1.5.5.7.48.2"}),new a({uri:h.caissuer})]});else throw new Error("unknown AccessMethod parameter: "+JSON.stringify(h));n.push(l)}this.asn1ExtnValue=new o({array:n})},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)};Ee(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)};Ee(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)};Ee(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,n=t.DERSequence,r=t.ASN1Util.newObject,i=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var o=[],s=0;s<this.params.array.length;s++){var a=this.params.array[s];if(a.attr!=null&&a.array!=null){var u={seq:[{oid:a.attr},{set:a.array}]};o.push(r(u));continue}var l={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if(a.attr=="dateOfBirth")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={gentime:a.str};else if(a.attr=="placeOfBirth")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={utf8str:a.str};else if(a.attr=="gender")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={prnstr:a.str};else if(a.attr=="countryOfCitizenship")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={prnstr:a.str};else if(a.attr=="countryOfResidence")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={prnstr:a.str};else throw new Error("unsupported attribute: "+a.attr);o.push(new r(l))}var h=new n({array:o});return this.asn1ExtnValue=h,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",e!==void 0&&(this.params=e)};Ee(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,n=t.lang.String.isHex,r=t.asn1,i=r.x509.OID.name2oid,o=r.ASN1Util.newObject;this.params=null,this.setByParam=function(s){this.oid=i(s.extname),this.params=s},this.getExtnValueHex=function(){if(this.params.extname==null||this.params.extn==null)throw new Error("extname or extnhex not specified");var s=this.params.extn;if(typeof s=="string"&&n(s))return s;if(typeof s=="object")try{return o(s).tohex()}catch{}throw new Error("unsupported extn value")},e!=null&&this.setByParam(e)};Ee(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,n=t.asn1,r=n.DERSequence,i=n.DERBitString,o=n.x509,s=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 h=l.sign();this.params.sighex=h},this.getPEM=function(){return xr(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 s({name:u.sigalg})),l.push(new i({hex:"00"+u.sighex}));var h=new r({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};Ee(A.asn1.x509.CRL,A.asn1.ASN1Object);A.asn1.x509.TBSCertList=function(e){A.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=A,n=t.asn1,r=n.DERInteger,i=n.DERSequence,o=n.DERTaggedObject,s=n.DERObjectIdentifier,a=n.x509,u=a.AlgorithmIdentifier,l=a.Time,h=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 r(d[v].sn),new l(d[v].date)];d[v].ext!=null&&g.push(new h(d[v].ext)),p.push(new i({array:g}))}return new i({array:p})},this.tohex=function(){var p=[],d=this.params;if(d.version!=null){var v=d.version-1,g=new r({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 h(d.ext);p.push(new o({tag:"a0",explicit:!0,obj:y}))}var w=new i({array:p});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.TBSCertList,A.asn1.ASN1Object);A.asn1.x509.CRLEntry=function(e){A.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=null,n=null,r=A,i=r.asn1;this.setCertSerial=function(o){this.sn=new i.DERInteger(o)},this.setRevocationDate=function(o){this.time=new i.x509.Time(o)},this.tohex=function(){var o=new i.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))};Ee(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)};Ee(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)};Ee(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)};Ee(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)};Ee(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,n=t.asn1,r=n.DERInteger,i=n.DERBoolean,o=n.DERSequence,s=n.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var a=this.params,u=[new r(1)];return u.push(new s({uri:a.uri})),a.reqauth!=null&&u.push(new i(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)};Ee(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,n=t.asn1,r=n.x509,i=r.RDN,o=dn;this.setByString=function(s,a){a!==void 0&&(this.sRule=a);var u=s.split("/");u.shift();for(var l=[],h=0;h<u.length;h++)if(u[h].match(/^[^=]+=.+$/))l.push(u[h]);else{var m=l.length-1;l[m]=l[m]+"/"+u[h]}for(var h=0;h<l.length;h++)this.asn1Array.push(new i({str:l[h],rule:this.sRule}))},this.setByLdapString=function(s,a){a!==void 0&&(this.sRule=a);var u=r.X500Name.ldapToCompat(s);this.setByString(u,a)},this.setByObject=function(s,a){a!==void 0&&(this.sRule=a);for(var u in s)if(s.hasOwnProperty(u)){var l=new i({str:u+"="+s[u],rule:this.sRule});this.asn1Array?this.asn1Array.push(l):this.asn1Array=[l]}},this.setByParam=function(s){if(s.rule!==void 0&&(this.sRule=s.rule),s.array!==void 0)this.paramArray=s.array;else if(s.str!==void 0)this.setByString(s.str);else if(s.ldapstr!==void 0)this.setByLdapString(s.ldapstr);else if(s.hex!==void 0)this.hTLV=s.hex;else if(s.certissuer!==void 0){var a=new tt;a.readCertPEM(s.certissuer),this.hTLV=a.getIssuerHex()}else if(s.certsubject!==void 0){var a=new tt;a.readCertPEM(s.certsubject),this.hTLV=a.getSubjectHex()}else typeof s=="object"&&s.certsubject===void 0&&s.certissuer===void 0&&this.setByObject(s)},this.tohex=function(){if(typeof this.hTLV=="string")return this.hTLV;if(this.asn1Array.length==0&&this.paramArray.length>0)for(var s=0;s<this.paramArray.length;s++){var a={array:this.paramArray[s]};this.sRule!="utf8"&&(a.rule=this.sRule);var u=new i(a);this.asn1Array.push(u)}var l=new n.DERSequence({array:this.asn1Array});return this.hTLV=l.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(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 n=e.split("/");return n.reverse(),n=n.map(function(r){return r.replace(/,/,"\\,")}),n.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(","),n=!1,r=[],i=0;t.length>0;i++){var o=t.shift();if(n===!0){var s=r.pop(),a=(s+","+o).replace(/\\,/g,",");r.push(a),n=!1}else r.push(o);o.substr(-1,1)==="\\"&&(n=!0)}return r=r.map(function(u){return u.replace("/","\\/")}),r.reverse(),"/"+r.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(n){n.rule!==void 0&&(this.sRule=n.rule),n.str!==void 0&&this.addByMultiValuedString(n.str),n.array!==void 0&&(this.paramArray=n.array)},this.addByString=function(n){this.asn1Array.push(new A.asn1.x509.AttributeTypeAndValue({str:n,rule:this.sRule}))},this.addByMultiValuedString=function(n){for(var r=A.asn1.x509.RDN.parseString(n),i=0;i<r.length;i++)this.addByString(r[i])},this.tohex=function(){if(this.asn1Array.length==0&&this.paramArray.length>0)for(var n=0;n<this.paramArray.length;n++){var r=this.paramArray[n];r.rule!==void 0&&this.sRule!="utf8"&&(r.rule=this.sRule);var i=new t(r);this.asn1Array.push(i)}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)};Ee(A.asn1.x509.RDN,A.asn1.ASN1Object);A.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),n=!1,r=[],i=0;t.length>0;i++){var o=t.shift();if(n===!0){var s=r.pop(),a=(s+"+"+o).replace(/\\\+/g,"+");r.push(a),n=!1}else r.push(o);o.substr(-1,1)==="\\"&&(n=!0)}for(var u=!1,l=[],i=0;r.length>0;i++){var o=r.shift();if(u===!0){var h=l.pop();if(o.match(/"$/)){var a=(h+"+"+o).replace(/^([^=]+)="(.*)"$/,"$1=$2");l.push(a),u=!1}else l.push(h+"+"+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,n=t.asn1,r=n.DERSequence,i=n.DERUTF8String,o=n.DERPrintableString,s=n.DERTeletexString,a=n.DERIA5String,u=n.DERVisibleString,l=n.DERBMPString,h=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"&&h(d)?"ia5":m(d)?"prn":"utf8":v==="utf8"?p=="CN"&&h(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 i({str:d});if(p=="prn")return new o({str:d});if(p=="tel")return new s({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 r({array:[p,d]});return this.TLV=v.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.AttributeTypeAndValue,A.asn1.ASN1Object);A.asn1.x509.SubjectPublicKeyInfo=function(e){A.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=null,n=null,r=A,i=r.asn1,o=i.DERInteger,s=i.DERBitString,a=i.DERObjectIdentifier,u=i.DERSequence,l=i.ASN1Util.newObject,h=i.x509,m=h.AlgorithmIdentifier,p=r.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 at){var y=l({seq:[{int:{bigint:g.n}},{int:{int:g.e}}]}),w=y.tohex();this.asn1AlgId=new m({name:"rsaEncryption"}),this.asn1SubjPKey=new s({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 s({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 C=new o({bigint:g.y});this.asn1SubjPKey=new s({hex:"00"+C.tohex()})}}catch{}},e!==void 0&&this.setPubKey(e)};Ee(A.asn1.x509.SubjectPublicKeyInfo,A.asn1.ASN1Object);A.asn1.x509.Time=function(e){A.asn1.x509.Time.superclass.constructor.call(this);var t=null,n=null,r=A,i=r.asn1,o=i.DERUTCTime,s=i.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 s(a.str))):this.type=="gen"?u=new s: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,n=null,r=A,i=r.asn1,o=i.DERUTCTime,s=i.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 s(this.timeParams):this.type=="utc"?a=new o:a=new s,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)};Ee(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,n=t.asn1,r=n.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 s in r)s===this.nameAlg&&(o=r[s]);if(o!==null)return this.hTLV=o,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=n.x509.OID.name2obj(this.nameAlg));var a=[this.asn1Alg];this.asn1Params!==null&&a.push(this.asn1Params);var u=new n.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 i=this.nameAlg.toLowerCase();i.substr(-7,7)!=="withdsa"&&i.substr(-9,9)!=="withecdsa"&&(this.asn1Params=new n.DERNull)}};Ee(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"},n=A,r=n.asn1,i=r.x509,o=i.X500Name,s=i.OtherName,a=r.DERIA5String,u=r.DERPrintableString,l=r.DEROctetString,h=r.DERTaggedObject,m=r.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 s(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,C=null;if(d.certsubj!==void 0?(w=!1,E=d.certsubj):(w=!0,E=d.certissuer),E.match(/^[0-9A-Fa-f]+$/)&&C==E,E.indexOf("-----BEGIN ")!=-1&&(C=dn(E)),C==null)throw new Error("certsubj/certissuer not cert");var _=new tt;_.hex=C;var F;w?F=_.getIssuerHex():F=_.getSubjectHex(),g=new m,g.hTLV=F}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 S=K.length;if(S==8||S==16||S==32||S==64)H=K;else throw"err"}else H=fE(K)}catch(q){throw new p("malformed IP address: "+d.ip+":"+q.message)}g=new l({hex:H})}else throw new p("improper params");var I=new h({tag:v,explicit:y,obj:g});return I.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.GeneralName,A.asn1.ASN1Object);A.asn1.x509.GeneralNames=function(e){A.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,n=A,r=n.asn1;this.setByParamArray=function(i){for(var o=0;o<i.length;o++){var s=new r.x509.GeneralName(i[o]);this.asn1Array.push(s)}},this.tohex=function(){var i=new r.DERSequence({array:this.asn1Array});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,typeof e<"u"&&this.setByParamArray(e)};Ee(A.asn1.x509.GeneralNames,A.asn1.ASN1Object);A.asn1.x509.OtherName=function(e){A.asn1.x509.OtherName.superclass.constructor.call(this);var t=null,n=null,r=A,i=r.asn1,o=i.DERObjectIdentifier,s=i.DERSequence,a=i.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}),h=a({tag:{tag:"a0",explicit:!0,obj:u.value}}),m=new s({array:[l,h]});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(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 n=this.name2oidList[t],r=new e({oid:n});return this.objCache[t]=r,r},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var n;if(t.match(/^\d+\.\d+\.[0-9.]+$/))n=t;else if(this.atype2oidList[t]!==void 0)n=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)n=this.name2oidList[t];else throw new Error("AttributeType name undefined: "+t);var r=new e({oid:n});return this.objCache[t]=r,r},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var n in t)this.name2oidList[n]=t[n]},this.checkOIDs=function(t){try{var n=Object.keys(t);return n.length==0?!1:(n.map(function(r,i,o){var s=this[r];if(!s.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 n in t)if(t[n]==e)return n;return""};A.asn1.x509.OID.oid2atype=function(e){var t=A.asn1.x509.OID.atype2oidList;for(var n in t)if(t[n]==e)return n;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,n=t.TBSCertificate,r=t.Certificate,i=new r(e);return i.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,n=A,r=n.asn1,i=r.DERSequence,o=r.DERSet,s=r.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 s({oid:this.typeOid}),u=new o({array:this.getValueArray()}),l=new i({array:[a,u]});return l.tohex()},this.getEncodedHex=function(){return this.tohex()}};Ee(A.asn1.cms.Attribute,A.asn1.ASN1Object);A.asn1.cms.ContentType=function(e){var t=A,n=t.asn1;n.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var r=new n.DERObjectIdentifier(this.params.type);return[r]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ContentType,A.asn1.cms.Attribute);A.asn1.cms.MessageDigest=function(e){var t=A,n=t.asn1,r=n.DEROctetString,i=n.cms;i.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var o=new r(this.params);return[o]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.MessageDigest,A.asn1.cms.Attribute);A.asn1.cms.SigningTime=function(e){var t=A,n=t.asn1;n.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var r=new n.x509.Time(this.params);return[r]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SigningTime,A.asn1.cms.Attribute);A.asn1.cms.SigningCertificate=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSequence,o=r.cms,s=o.ESSCertID,a=n.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=[],h=0;h<u.length;h++){var m=u[h];e.hasis==!1&&typeof m=="string"&&(m.indexOf("-----BEGIN")!=-1||$e.isASN1HEX(m))&&(m={cert:m}),m.hasis!=!1&&e.hasis==!1&&(m.hasis=!1),l.push(new s(m))}var p=new i({array:l}),d=new i({array:[p]});return[d]},e!=null&&this.setByParam(e)};Ee(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,n=A,r=n.asn1,i=r.DEROctetString,o=r.DERSequence,s=r.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&&!$e.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 h;l.indexOf("-----BEGIN")!=-1?h=dn(l):h=l,typeof a=="string"&&(a.indexOf("-----BEGIN")!=-1?h=dn(a):$e.isASN1HEX(a)&&(h=a));var m;if(a.alg!=null)m=a.alg;else if(u!=null)m=u;else throw new t("hash alg unspecified");return n.crypto.Util.hashHex(h,m)},this.tohex=function(){var a=this.params,u=this.getCertHash(a,"sha1"),l=[];l.push(new i({hex:u})),(typeof a=="string"&&a.indexOf("-----BEGIN")!=-1||a.cert!=null&&a.hasis!=!1||a.issuer!=null&&a.serial!=null)&&l.push(new s(a));var h=new o({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ESSCertID,A.asn1.ASN1Object);A.asn1.cms.SigningCertificateV2=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSequence,o=r.x509,s=r.cms,a=s.ESSCertIDv2,u=n.crypto;s.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,h=[],m=0;m<l.length;m++){var p=l[m];(e.alg!=null||e.hasis==!1)&&typeof p=="string"&&(p.indexOf("-----BEGIN")!=-1||$e.isASN1HEX(p))&&(p={cert:p}),p.alg==null&&e.alg!=null&&(p.alg=e.alg),p.hasis!=!1&&e.hasis==!1&&(p.hasis=!1),h.push(new a(p))}var d=new i({array:h}),v=new i({array:[d]});return[v]},e!=null&&this.setByParam(e)};Ee(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,n=A,r=n.asn1,i=r.DEROctetString,o=r.DERSequence,s=r.cms.IssuerSerial,a=r.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var u=this.params,l=this.getCertHash(u,"sha256"),h=[];u.alg!=null&&u.alg!="sha256"&&h.push(new a({name:u.alg})),h.push(new i({hex:l})),(typeof u=="string"&&u.indexOf("-----BEGIN")!=-1||u.cert!=null&&u.hasis!=!1||u.issuer!=null&&u.serial!=null)&&h.push(new s(u));var m=new o({array:h});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ESSCertIDv2,A.asn1.cms.ESSCertID);A.asn1.cms.IssuerSerial=function(e){var t=Error,n=A,r=n.asn1,i=r.DERInteger,o=r.DERSequence,s=r.cms,a=r.x509,u=a.GeneralNames,l=tt;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,m,p;if(typeof h=="string"&&h.indexOf("-----BEGIN")!=-1||h.cert!=null){var d;h.cert!=null?d=h.cert:d=h;var v=new l;v.readCertPEM(d),m=v.getIssuer(),p={hex:v.getSerialNumberHex()}}else if(h.issuer!=null&&h.serial)m=h.issuer,p=h.serial;else throw new t("cert or issuer and serial parameter not specified");var g=new u([{dn:m}]),y=new i(p),w=new o({array:[g,y]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.IssuerSerial,A.asn1.ASN1Object);A.asn1.cms.SignerIdentifier=function(e){var t=A,n=t.asn1,r=n.DERInteger,i=n.DERSequence,o=n.cms,s=o.IssuerAndSerialNumber,a=o.SubjectKeyIdentifier,u=n.x509,l=u.X500Name,h=tt,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 s(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)};Ee(A.asn1.cms.SignerIdentifier,A.asn1.ASN1Object);A.asn1.cms.IssuerAndSerialNumber=function(e){var t=A,n=t.asn1,r=n.DERInteger,i=n.DERSequence,o=n.cms,s=n.x509,a=s.X500Name,u=tt,l=Error;o.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params,m,p;if(typeof h=="string"&&h.indexOf("-----BEGIN")!=-1||h.cert!=null){var d;h.cert!=null?d=h.cert:d=h;var v=new u;v.readCertPEM(d),m=v.getIssuer(),p={hex:v.getSerialNumberHex()}}else if(h.issuer!=null&&h.serial)m=h.issuer,p=h.serial;else throw new l("cert or issuer and serial parameter not specified");var g=new a(m),y=new r(p),w=new i({array:[g,y]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(h){this.params=h},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.IssuerAndSerialNumber,A.asn1.ASN1Object);A.asn1.cms.SubjectKeyIdentifier=function(e){var t=A,n=t.asn1,r=n.DERInteger,i=n.DERSequence,o=n.ASN1Util.newObject,s=n.cms,a=s.IssuerAndSerialName,u=s.SubjectKeyIdentifier,l=n.x509,h=l.X500Name,m=tt,p=Error;s.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)};Ee(A.asn1.cms.SubjectKeyIdentifier,A.asn1.ASN1Object);A.asn1.cms.AttributeList=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSet,o=r.cms;o.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(s){this.params=s},this.tohex=function(){var s=this.params;if(this.hTLV!=null)return this.hTLV;var a=!0;s.sortflag!=null&&(a=s.sortflag);for(var u=s.array,l=[],h=0;h<u.length;h++){var m=u[h],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 i({array:l,sortflag:a});return this.hTLV=d.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.AttributeList,A.asn1.ASN1Object);A.asn1.cms.SignerInfo=function(e){var t=Error,n=A,r=n.asn1,i=r.DERInteger,o=r.DEROctetString,s=r.DERSequence,a=r.DERTaggedObject,u=r.cms,l=u.SignerIdentifier,h=u.AttributeList,m=u.ContentType,p=u.EncapsulatedContentInfo,d=u.MessageDigest,v=u.SignedData,g=r.x509,y=g.AlgorithmIdentifier,w=n.crypto,E=_t;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var C=this.params,_=C.sigalg,F=new h(C.sattrs).tohex(),H=E.getKey(C.signkey),K=new w.Signature({alg:_});K.init(H),K.updateHex(F);var S=K.sign();C.sighex=S},this.tohex=function(){var C=this.params,_=[];if(_.push(new i({int:C.version})),_.push(new l(C.id)),_.push(new y({name:C.hashalg})),C.sattrs!=null){var F=new h(C.sattrs);try{_.push(new a({tag:"a0",explicit:!1,obj:F}))}catch(K){throw new t("si sattr error: "+K)}}if(C.sigalgfield!=null?_.push(new y({name:C.sigalgfield})):_.push(new y({name:C.sigalg})),C.sighex==null&&C.signkey!=null&&this.sign(),_.push(new o({hex:C.sighex})),C.uattrs!=null){var F=new h(C.uattrs);try{_.push(new a({tag:"a1",explicit:!1,obj:F}))}catch(S){throw new t("si uattr error: "+S)}}var H=new s({array:_});return H.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SignerInfo,A.asn1.ASN1Object);A.asn1.cms.EncapsulatedContentInfo=function(e){var t=A,n=t.asn1,r=n.DERTaggedObject,i=n.DERSequence,o=n.DERObjectIdentifier,s=n.DEROctetString,a=n.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 h=new s(u.content),m=new r({tag:"a0",explicit:!0,obj:h});l.push(m)}var p=new i({array:l});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.EncapsulatedContentInfo,A.asn1.ASN1Object);A.asn1.cms.ContentInfo=function(e){var t=A,n=t.asn1,r=n.DERTaggedObject,i=n.DERSequence,o=n.DERObjectIdentifier,s=n.x509,a=s.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 h=new r({tag:"a0",explicit:!0,obj:u.obj});l.push(h);var m=new i({array:l});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ContentInfo,A.asn1.ASN1Object);A.asn1.cms.SignedData=function(e){var t=Error,n=A,r=n.asn1,i=r.ASN1Object,o=r.DERInteger,s=r.DERSet,a=r.DERSequence,u=r.DERTaggedObject,l=r.cms,h=l.EncapsulatedContentInfo,m=l.SignerInfo,p=l.ContentInfo,d=l.CertificateSet,v=l.RevocationInfoChoices,g=r.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={},C=w.sinfos,_=0;_<C.length;_++){var F=C[_];E[F.hashalg]=1}w.hashalgs=Object.keys(E).sort()},this._setContentTypeByEContent=function(w){for(var E=w.econtent.type,C=w.sinfos,_=0;_<C.length;_++){var F=C[_],H=this._getAttrParamByName(F,"contentType");H.type=E}},this._setMessageDigestByEContent=function(w){var E=w.econtent,C=w.econtent.type,_=E.content.hex;_==null&&E.type=="data"&&E.content.str!=null&&(_=So(E.content.str));for(var F=w.sinfos,H=0;H<F.length;H++){var K=F[H],S=K.hashalg,I=this._getAttrParamByName(K,"messageDigest"),q=A.crypto.Util.hashHex(_,S);I.hex=q}},this._getAttrParamByName=function(w,E){for(var C=w.sattrs.array,_=0;_<C.length;_++)if(C[_].attr==E)return C[_]},this._setSignerInfoVersion=function(w){for(var E=w.sinfos,C=0;C<E.length;C++){var _=E[C],F=1;_.id.type=="skid"&&(F=3),_.version=F}},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,C=0;C<E.length;C++){var _=E[C];if(_.ocsp!=null)return 5}for(var F=w.sinfos,C=0;C<F.length;C++){var H=w.sinfos[C];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 C=[],_=0;_<w.hashalgs.length;_++){var F=w.hashalgs[_];C.push(new y({name:F}))}E.push(new s({array:C})),E.push(new h(w.econtent)),w.certs!=null&&E.push(new d(w.certs)),w.revinfos!=null&&E.push(new v(w.revinfos));for(var H=[],_=0;_<w.sinfos.length;_++){var K=w.sinfos[_];H.push(new m(K))}E.push(new s({array:H}));var S=new a({array:E});return S.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)};Ee(A.asn1.cms.SignedData,A.asn1.ASN1Object);A.asn1.cms.CertificateSet=function(e){A.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,n=A.asn1,r=n.DERTaggedObject,i=n.DERSet,o=n.ASN1Object;this.params=null,this.tohex=function(){var s=this.params,a=[],u;if(s instanceof Array)u=s;else if(s.array!=null)u=s.array;else throw new t("cert array not specified");for(var l=0;l<u.length;l++){var h=u[l],m=dn(h),p=new o;p.hTLV=m,a.push(p)}var d={array:a};s.sortflag==!1&&(d.sortflag=!1);var v=new i(d),g=new r({tag:"a0",explicit:!1,obj:v});return g.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(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 n=[],r=0;r<t.length;r++)n.push(new A.asn1.cms.RevocationInfoChoice(t[r]));var i=A.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:n}}});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(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 n=t.crl;return t.crl.indexOf("-----BEGIN")!=-1&&(n=dn(t.crl)),n}else if(t.ocsp!=null){var r=A.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new A.asn1.cms.OtherRevocationFormat(t)}});return r.tohex()}else throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.RevocationInfoChoice,A.asn1.ASN1Object);A.asn1.cms.OtherRevocationFormat=function(e){A.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,n=A,r=n.asn1,i=r.ASN1Util.newObject,o=n.lang.String.isHex;this.params=null,this.tohex=function(){var s=this.params;if(s.ocsp==null)throw new t("property ocsp not specified");if(!o(s.ocsp)||!$e.isASN1HEX(s.ocsp))throw new t("ocsp value not ASN.1 hex string");var a=i({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:s.ocsp}}]});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(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,n=t.asn1,r=n.cms,i=r.SignerInfo,o=r.SignedData,s=r.SigningTime,a=r.SigningCertificate,u=r.SigningCertificateV2,l=n.cades,h=l.SignaturePolicyIdentifier,m=t.lang.String.isHex,p=$e,d=p.getVbyList,v=p.getTLVbyList,g=p.getIdxbyList,y=p.getChildIdx,w=p.getTLV,E=p.oidname,C=t.crypto.Util.hashHex;e.cms===void 0&&m(e.cms);var _=e.cms,F=function(N,P){for(var M,Y=3;Y<6;Y++)if(M=g(N,0,[1,0,Y]),M!==void 0){var V=N.substr(M,2);V==="a0"&&(P.certsIdx=M),V==="a1"&&(P.revinfosIdx=M),V==="31"&&(P.signerinfosIdx=M)}},H=function(N,P){var M=P.signerinfosIdx;if(M!==void 0){var Y=y(N,M);P.signerInfoIdxList=Y;for(var V=0;V<Y.length;V++){var X=Y[V],te={idx:X};K(N,te),P.signerInfos.push(te)}}},K=function(N,P){var M=P.idx;P.signerid_issuer1=v(N,M,[1,0],"30"),P.signerid_serial1=d(N,M,[1,1],"02"),P.hashalg=E(d(N,M,[2,0],"06"));var Y=g(N,M,[3],"a0");P.idxSignedAttrs=Y,S(N,P,Y);var V=y(N,M),X=V.length;if(X<6)throw"malformed SignerInfo";P.sigalg=E(d(N,M,[X-2,0],"06")),P.sigval=d(N,M,[X-1],"04")},S=function(N,P,M){var Y=y(N,M);P.signedAttrIdxList=Y;for(var V=0;V<Y.length;V++){var X=Y[V],te=d(N,X,[0],"06"),ae;te==="2a864886f70d010905"?(ae=Gt(d(N,X,[1,0])),P.saSigningTime=ae):te==="2a864886f70d010904"&&(ae=d(N,X,[1,0],"04"),P.saMessageDigest=ae)}},I=function(N,P){if(d(N,0,[0],"06")!=="2a864886f70d010702")return P;P.cmsType="signedData",P.econtent=d(N,0,[1,0,2,1,0]),F(N,P),P.signerInfos=[],H(N,P)},q=function(N,P){for(var M=P.parse.signerInfos,Y=M.length,V=!0,X=0;X<Y;X++){var te=M[X];T(N,P,te,X),te.isValid||(V=!1)}P.isValid=V},L=function(N,P,M,Y){var V=P.parse.certsIdx,X;if(P.certs===void 0){X=[],P.certkeys=[];for(var te=y(N,V),ae=0;ae<te.length;ae++){var me=w(N,te[ae]),he=new tt;he.readCertHex(me),X[ae]=he,P.certkeys[ae]=he.getPublicKey()}P.certs=X}else X=P.certs;P.cccc=X.length,P.cccci=te.length;for(var ae=0;ae<X.length;ae++){var De=he.getIssuerHex(),Pe=he.getSerialNumberHex();M.signerid_issuer1===De&&M.signerid_serial1===Pe&&(M.certkey_idx=ae)}},T=function(N,P,M,Y){M.verifyDetail={};var V=M.verifyDetail,X=P.parse.econtent,te=M.hashalg,ae=M.saMessageDigest;V.validMessageDigest=!1,C(X,te)===ae&&(V.validMessageDigest=!0),L(N,P,M,Y),V.validSignatureValue=!1;var me=M.sigalg,he="31"+w(N,M.idxSignedAttrs).substr(2);M.signedattrshex=he;var De=P.certs[M.certkey_idx].getPublicKey(),Pe=new A.crypto.Signature({alg:me});Pe.init(De),Pe.updateHex(he);var Ie=Pe.verify(M.sigval);V.validSignatureValue_isValid=Ie,Ie===!0&&(V.validSignatureValue=!0),M.isValid=!1,V.validMessageDigest&&V.validSignatureValue&&(M.isValid=!0)},O=function(){},R={isValid:!1,parse:{}};return I(_,R.parse),q(_,R),R};A.asn1.cms.CMSParser=function(){var e=Error,t=tt,n=new t,r=$e,i=r.getV,o=r.getTLV,s=r.getIdxbyList,a=r.getTLVbyList,u=r.getTLVbyListEx,l=r.getVbyList,h=r.getVbyListEx,m=r.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=i(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 C=u(p,0,["[0]"]);C!=null&&(v.certs=this.getCertificateSet(C));var _=u(p,0,["[1]"]);_!=null;var F=u(p,0,[3]);return v.sinfos=this.getSignerInfos(F),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($e.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=r.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]),C=n.getAlgorithmIdentifierName(E);d.hashalg=C;var _=u(p,0,["[0]"]);if(_!=null){var F=this.getAttributeList(_);d.sattrs=F}var H=u(p,0,[3]),K=n.getAlgorithmIdentifierName(H);d.sigalg=K;var S=h(p,0,[4]);d.sighex=S;var I=u(p,0,["[1]"]);if(I!=null){var q=this.getAttributeList(I);d.uattrs=q}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=n.getX500Name(g);var y=i(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=r.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 C=[],_=0;_<E.length;_++)C.push(o(w,E[_]));d.valhex=C}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=r.getOIDName(p.valhex,0,null);d!=null&&(p.type=d,delete p.valhex)},this.setSigningTime=function(p){var d=i(p.valhex,0),v=Gt(d);p.str=v,delete p.valhex},this.setMessageDigest=function(p){var d=i(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]),C=this.getESSCertID(E);y.push(C)}p.array=y}if(d.length>1){var _=o(p.valhex,d[1]);p.polhex=_}delete p.valhex},this.setSignaturePolicyIdentifier=function(p){var d=m(p.valhex,0);if(d.length>0){var v=r.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 C=i(p.valhex,y[1]);p.hash=C}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]),C=this.getESSCertIDv2(E);y.push(C)}p.array=y}if(d.length>1){var _=o(p.valhex,d[1]);p.polhex=_}delete p.valhex},this.getESSCertID=function(p){var d={},v=m(p,0);if(v.length>0){var g=i(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=n.getAlgorithmIdentifierName(y),g++}else d.alg="sha256";var w=i(p,v[g]);if(d.hash=w,v.length>g+1){var E=o(p,v[g+1]),C=this.getIssuerSerial(E);d.issuer=C.issuer,d.serial=C.serial}return d},this.getIssuerSerial=function(p){var d={},v=m(p,0),g=o(p,v[0]),y=n.getGeneralNames(g),w=y[0].dn;d.issuer=w;var E=i(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=xr(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,n=t.asn1,r=n.tsp;r.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var i=new r.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=i.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.TimeStampToken,A.asn1.cms.SignedData);A.asn1.tsp.TSTInfo=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSequence,o=r.DERInteger,s=r.DERBoolean,a=r.DERGeneralizedTime,u=r.DERObjectIdentifier,l=r.DERTaggedObject,h=r.tsp,m=h.MessageImprint,p=h.Accuracy,d=r.x509.X500Name,v=r.x509.GeneralName;if(h.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 i({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 s),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})}))}};Ee(A.asn1.tsp.TSTInfo,A.asn1.ASN1Object);A.asn1.tsp.Accuracy=function(e){var t=A,n=t.asn1,r=n.ASN1Util.newObject;n.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var i=this.params,o=[];return i.seconds!=null&&typeof i.seconds=="number"&&o.push({int:i.seconds}),i.millis!=null&&typeof i.millis=="number"&&o.push({tag:{tagi:"80",obj:{int:i.millis}}}),i.micros!=null&&typeof i.micros=="number"&&o.push({tag:{tagi:"81",obj:{int:i.micros}}}),r({seq:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.Accuracy,A.asn1.ASN1Object);A.asn1.tsp.MessageImprint=function(e){var t=A,n=t.asn1,r=n.DERSequence,i=n.DEROctetString,o=n.x509,s=o.AlgorithmIdentifier;n.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params,u=new s({name:a.alg}),l=new i({hex:a.hash}),h=new r({array:[u,l]});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.tsp.MessageImprint,A.asn1.ASN1Object);A.asn1.tsp.TimeStampReq=function(e){var t=A,n=t.asn1,r=n.DERSequence,i=n.DERInteger,o=n.DERBoolean,s=n.ASN1Object,a=n.DERObjectIdentifier,u=n.tsp,l=u.MessageImprint;u.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params,m=[];m.push(new i({int:1})),h.messageImprint instanceof A.asn1.ASN1Object?m.push(h.messageImprint):m.push(new l(h.messageImprint)),h.policy!=null&&m.push(new a(h.policy)),h.nonce!=null&&m.push(new i(h.nonce)),h.certreq==!0&&m.push(new o);var p=new r({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.TimeStampReq,A.asn1.ASN1Object);A.asn1.tsp.TimeStampResp=function(e){var t=A,n=t.asn1,r=n.DERSequence,i=n.ASN1Object,o=n.tsp,s=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 s(a.statusinfo)):u.push(new s("granted")),a.econtent!=null)u.push(new o.TimeStampToken(a).getContentInfo());else if(a.tst instanceof n.ASN1Object)u.push(a.tst);else throw new Error("improper member tst value");else if(a.statusinfo!=null)u.push(new s(a.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var l=new r({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.TimeStampResp,A.asn1.ASN1Object);A.asn1.tsp.PKIStatusInfo=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSequence,o=r.tsp,s=o.PKIStatus,a=o.PKIFreeText,u=o.PKIFailureInfo;o.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params,h=[];if(typeof l=="string")h.push(new s(l));else{if(l.status==null)throw new t("property 'status' unspecified");h.push(new s(l.status)),l.statusstr!=null&&h.push(new a(l.statusstr)),l.failinfo!=null&&h.push(new u(l.failinfo))}var m=new i({array:h});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.PKIStatusInfo,A.asn1.ASN1Object);A.asn1.tsp.PKIStatus=function(e){var t=Error,n=A,r=n.asn1,i=r.DERInteger,o=r.tsp;o.PKIStatus.superclass.constructor.call(this);var s={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=s[a]}catch{throw new t("undefined name: "+a)}else if(typeof a=="number")l=a;else throw new t("unsupported params");return new i({int:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.PKIStatus,A.asn1.ASN1Object);A.asn1.tsp.PKIFreeText=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSequence,o=r.DERUTF8String,s=r.tsp;s.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 h=new i({array:u});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.PKIFreeText,A.asn1.ASN1Object);A.asn1.tsp.PKIFailureInfo=function(e){var t=Error,n=A,r=n.asn1,i=r.DERBitString,o=r.tsp,s=o.PKIFailureInfo,a={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};s.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 h=l.toString(2),m="",p=h.length-1;p>=0;p--)m+=h[p];return m}else{if(typeof u=="string"&&a[u]!=null)return pm([u],a);if(typeof u=="object"&&u.length!=null)return pm(u,a);throw new t("wrong params")}},this.tohex=function(){var u=this.params,l=this.getBinValue();return new i({bin:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.PKIFailureInfo,A.asn1.ASN1Object);A.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(t,n){throw"not implemented yet"}};A.asn1.tsp.SimpleTSAAdapter=function(e){var t=A,n=t.asn1,r=n.tsp,i=t.crypto.Util.hashHex;r.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(o,s){var a=i(o,s);this.params.econtent.content.messageImprint={alg:s,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 r.TimeStampToken(this.params);return l.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};Ee(A.asn1.tsp.SimpleTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.FixedTSAAdapter=function(e){var t=A,n=t.asn1,r=n.tsp,i=t.crypto.Util.hashHex;r.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(o,s){var a=i(o,s);this.params.econtent.content.messageImprint={alg:s,hash:a};var u=new r.TimeStampToken(this.params);return u.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};Ee(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=tt,n=new t,r=$e,i=r.getV,o=r.getTLV,s=r.getIdxbyList,a=r.getTLVbyListEx,u=r.getChildIdx,l=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],h={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=i(m,d[1]);p.policy=Sm(v);var g=o(m,d[2]);p.messageImprint=this.getMessageImprint(g);var y=i(m,d[3]);p.serial={hex:y};var w=i(m,d[4]);p.genTime={str:Gt(w)};var E=0;if(d.length>5&&m.substr(d[5],2)=="30"){var C=o(m,d[5]);p.accuracy=this.getAccuracy(C),E++}if(d.length>5+E&&m.substr(d[5+E],2)=="01"){var _=i(m,d[5+E]);_=="ff"&&(p.ordering=!0),E++}if(d.length>5+E&&m.substr(d[5+E],2)=="02"){var F=i(m,d[5+E]);p.nonce={hex:F},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=n.getGeneralNames(H);var K=pGeneralNames[0].dn;p.tsa=K,E++}if(d.length>5+E&&m.substr(d[5+E],2)=="a1"){var S=o(m,d[5+E]);S="30"+S.substr(2);var I=n.getExtParamArray(S);p.ext=I,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=i(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=s(m,0,[0,0]),g=i(m,v),y=r.hextooidstr(g),w=A.asn1.x509.OID.oid2name(y);if(w=="")throw new Error("hashAlg name undefined: "+y);var E=w,C=s(m,0,[1]);return p.alg=E,p.hash=i(m,C),p},this.getPKIStatusInfo=function(m){var p={},d=u(m,0),v=0;try{var g=i(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(r.getString(m,d[v]));return p},this.getPKIFailureInfo=function(m){var p=r.getInt(m,0);return h[p]!=null?h[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=i(m,y);p.policy=r.hextooidstr(E)}w=="02"&&(p.nonce=i(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,n=t.asn1,r=n.cades,i=r.SignaturePolicyId;r.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(o){this.params=o},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.SignaturePolicyIdentifier,A.asn1.cms.Attribute);A.asn1.cades.SignaturePolicyId=function(e){var t=A,n=t.asn1,r=n.DERSequence,i=n.DERObjectIdentifier,o=n.x509,s=o.AlgorithmIdentifier,a=n.cades,u=a.SignaturePolicyId,l=a.OtherHashAlgAndValue;u.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params,m=[];m.push(new i(h.oid)),m.push(new l(h));var p=new r({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(h){this.params=h},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.SignaturePolicyId,A.asn1.ASN1Object);A.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSequence,o=r.DEROctetString,s=r.x509,a=s.AlgorithmIdentifier,u=r.cades,l=u.OtherHashAlgAndValue;l.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params;if(h.alg==null)throw new t("property 'alg' not specified");if(h.hash==null&&h.cert==null)throw new t("property 'hash' nor 'cert' not specified");var m=null;if(h.hash!=null)m=h.hash;else if(h.cert!=null){if(typeof h.cert!="string")throw new t("cert not string");var p=h.cert;h.cert.indexOf("-----BEGIN")!=-1&&(p=dn(h.cert)),m=A.crypto.Util.hashHex(p,h.alg)}var d=[];d.push(new a({name:h.alg})),d.push(new o({hex:m}));var v=new i({array:d});return v.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.OtherHashAlgAndValue,A.asn1.ASN1Object);A.asn1.cades.OtherHashValue=function(e){A.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,n=A,r=n.lang.String.isHex,i=n.asn1,o=i.DEROctetString,s=n.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=dn(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)};Ee(A.asn1.cades.OtherHashValue,A.asn1.ASN1Object);A.asn1.cades.SignatureTimeStamp=function(e){var t=Error,n=A,r=n.lang.String.isHex,i=n.asn1,o=i.ASN1Object,s=i.x509,a=i.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(r(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 h=u.res;if(h instanceof o&&(h=h.tohex()),typeof h!="string"||!r(h))throw new t("params.res has wrong value");var m=$e.getTLVbyList(h,0,[1]),l=new o;return l.hTLV=u.tst,[l]}},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.SignatureTimeStamp,A.asn1.cms.Attribute);A.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSequence,o=r.cades,s=o.OtherCertID,a=n.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=[],h=0;h<u.array.length;h++){var m=u.array[h];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 s(m);l.push(p)}var d=new i({array:l});return[d]},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.CompleteCertificateRefs,A.asn1.cms.Attribute);A.asn1.cades.OtherCertID=function(e){var t=A,n=t.asn1,r=n.DERSequence,i=n.cms,o=i.IssuerSerial,s=n.cades,a=s.OtherHashValue,u=s.OtherHashAlgAndValue;s.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 h=[],m=null;if(l.alg!=null?m=new u(l):m=new a(l),h.push(m),l.cert!=null&&l.hasis==!0||l.issuer!=null&&l.serial!=null){var p=new o(l);h.push(p)}var d=new r({array:h});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.OtherCertID,A.asn1.ASN1Object);A.asn1.cades.OtherHash=function(e){var t=Error,n=A,r=n.asn1,i=r.cms,o=r.cades,s=o.OtherHashAlgAndValue,a=o.OtherHashValue,u=n.crypto.Util.hashHex,l=n.lang.String.isHex;o.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params;typeof h=="string"&&(h.indexOf("-----BEGIN")!=-1?h={cert:h}:l(h)&&(h={hash:h}));var m=null;return h.alg!=null?m=new s(h):m=new a(h),m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(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,n=t.getCMSSignedData(e);return n};A.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,n){var r=$e,i=r.getChildIdx,o=r.getTLV,s=r.getV,a=A,u=a.asn1,l=u.ASN1Object,h=u.cms,m=h.AttributeList,p=h.SignerInfo,d={},v=i(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 C=v.shift();d.sigalg=o(e,C);var _=v.shift();d.sig=o(e,_),d.sigval=s(e,_);var F=null;return d.obj=new p,F=new l,F.hTLV=d.version,d.obj.dCMSVersion=F,F=new l,F.hTLV=d.si,d.obj.dSignerIdentifier=F,F=new l,F.hTLV=d.digalg,d.obj.dDigestAlgorithm=F,F=new l,F.hTLV=d.sattrs,d.obj.dSignedAttrs=F,F=new l,F.hTLV=d.sigalg,d.obj.dSigAlg=F,F=new l,F.hTLV=d.sig,d.obj.dSig=F,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,n=t.asn1,r=n.DERBitString,i=n.DERSequence,o=n.csr,s=n.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 h=l.sign();this.params.sighex=h},this.getPEM=function(){return xr(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var u=this.params,l=new A.asn1.csr.CertificationRequestInfo(this.params),h=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 r({hex:"00"+u.sighex}),p=new i({array:[l,h,m]});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.csr.CertificationRequest,A.asn1.ASN1Object);A.asn1.csr.CertificationRequestInfo=function(e){var t=A,n=t.asn1,r=n.DERBitString,i=n.DERSequence,o=n.DERInteger,s=n.DERUTF8String,a=n.DERTaggedObject,u=n.ASN1Util.newObject,l=n.csr,h=n.x509,m=h.X500Name,p=h.Extensions,d=h.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(_t.getKey(y.sbjpubkey))),y.attrs!=null){var E=g(y.attrs),C=u({tag:{tage:"a0",obj:E}});w.push(C)}else if(y.extreq!=null){var _=new p(y.extreq),C=u({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[_]}]}}});w.push(C)}else w.push(new a({tag:"a0",explicit:!1,obj:new s({str:""})}));var F=new i({array:w});return F.tohex()},this.getEncodedHex=function(){return this.tohex()};function g(y){for(var w=Error,E=A.asn1.x509.Extensions,C=[],_=0;_<y.length;_++){var F=y[_],H=F.attr;if(H=="extensionRequest"){var K=new E(F.ext),S={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[K]}]};C.push(S)}else if(H=="unstructuredName"){var S={seq:[{oid:"1.2.840.113549.1.9.2"},{set:F.names}]};C.push(S)}else if(H=="challengePassword"){var S={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:F.password}]}]};C.push(S)}else throw new w("unknown CSR attribute")}return{set:C}}e!=null&&this.setByParam(e)};Ee(A.asn1.csr.CertificationRequestInfo,A.asn1.ASN1Object);A.asn1.csr.AttributeList=function(e){function t(n){}};Ee(A.asn1.csr.AttributeList,A.asn1.ASN1Object);A.asn1.csr.CSRUtil=new function(){};A.asn1.csr.CSRUtil.newCSRPEM=function(e){var t=_t,n=A.asn1.csr,r=new n.CertificationRequest(e),i=r.getPEM();return i};A.asn1.csr.CSRUtil.getParam=function(e,t){var n=$e,r=n.getV,i=n.getIdxbyList,o=n.getTLVbyList,s=n.getTLVbyListEx,a=n.getVbyListEx,u=function(E){var C=i(E,0,[0,3,0,0],"06");return r(E,C)!="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 h=dn(e,"CERTIFICATE REQUEST");t&&(l.tbs=o(h,0,[0]));try{var m=s(h,0,[0,1]);if(m=="3000")l.subject={};else{var g=new tt;l.subject=g.getX500Name(m)}}catch{}var p=s(h,0,[0,2]),d=_t.getKey(p,null,"pkcs8pub");l.sbjpubkey=_t.getPEM(d,"PKCS8PUB");var v=u(h),g=new tt;v!=null&&(l.extreq=g.getExtParamArray(v));try{var y=s(h,0,[1],"30"),g=new tt;l.sigalg=g.getAlgorithmIdentifierName(y)}catch{}try{var w=a(h,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 n=new A.crypto.Signature({alg:t.sigalg});return n.init(t.sbjpubkey),n.updateHex(t.tbs),n.verify(t.sighex)}catch(r){return alert(r),!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,n=A.asn1.ASN1Util.newObject,r=A.asn1.ocsp.ResponseBytes,i=["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:i.indexOf(o)},this.setByParam=function(o){this.params=o},this.tohex=function(){var o=this.params,s=this._getStatusCode();if(s==-1)throw new Error("responseStatus not supported: "+o.resstatus);if(s!=0)return n({seq:[{enum:{int:s}}]}).tohex();var a=new r(o);return n({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:a}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(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,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.DEROctetString,o=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(s){this.params=s},this.tohex=function(){var s=this.params;if(s.restype!="ocspBasic")throw new Error("not supported responseType: "+s.restype);var a=new o(s),u=[];u.push(new r({name:"ocspBasic"})),u.push(new i({hex:a.tohex()}));var l=new n({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.ResponseBytes,A.asn1.ASN1Object);A.asn1.ocsp.BasicOCSPResponse=function(e){A.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,n=A.asn1,r=n.ASN1Object,i=n.DERSequence,o=n.DERGeneralizedTime,s=n.DERTaggedObject,a=n.DERBitString,u=n.x509.Extensions,l=n.x509.AlgorithmIdentifier,h=n.ocsp,m=h.ResponderID;_SingleResponseList=h.SingleResponseList,_ResponseData=h.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($e.isASN1HEX(y))w=y;else if(y.match(/-----BEGIN/))w=dn(y);else throw new t("certs["+g+"] not hex or PEM");v.push(new r({tlv:w}))}var E=new i({array:v});d.push(new s({tag:"a0",explicit:!0,obj:E}))}var C=new i({array:d});return C.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.BasicOCSPResponse,A.asn1.ASN1Object);A.asn1.ocsp.ResponseData=function(e){A.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,n=A.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,o=n.DERTaggedObject,s=n.x509.Extensions,a=n.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 h=[];if(h.push(new u(l.respid)),h.push(new i(l.prodat)),h.push(new _SingleResponseList(l.array)),l.ext!=null){var m=new s(l.ext);h.push(new o({tag:"a1",explicit:!0,obj:m}))}var p=new r({array:h});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(l){this.params=l},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.ResponseData,A.asn1.ASN1Object);A.asn1.ocsp.ResponderID=function(e){A.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=A,n=t.asn1,r=n.ASN1Util.newObject,i=n.x509.X500Name,o=t.lang.String.isHex,s=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 tt(a.key),h=l.getExtSubjectKeyIdentifier();h!=null&&(u=h.kid.hex)}}else if(a.key instanceof tt){var h=a.key.getExtSubjectKeyIdentifier();h!=null&&(u=h.kid.hex)}if(u==null)throw new s("wrong key member value");var m=r({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 tt(a.name);p=l.getSubject()}else a.name instanceof tt?p=a.name.getSubject():typeof a.name=="object"&&(a.name.array!=null||a.name.str!=null)&&(p=a.name);if(p==null)throw new s("wrong name member value");var m=r({tag:{tag:"a1",explicit:!0,obj:new i(p)}});return m.tohex()}throw new s("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(a){this.params=a},e!==void 0&&this.setByParam(e)};Ee(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,n=t.DERSequence,r=t.ocsp.SingleResponse;this.params=null,this.tohex=function(){var i=this.params;if(typeof i!="object"||i.length==null)throw new Error("params not specified properly");for(var o=[],s=0;s<i.length;s++)o.push(new r(i[s]));var a=new n({array:o});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(i){this.params=i},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.SingleResponseList,A.asn1.ASN1Object);A.asn1.ocsp.SingleResponse=function(e){var t=Error,n=A,r=n.asn1,i=r.DERSequence,o=r.DERGeneralizedTime,s=r.DERTaggedObject,a=r.ocsp,u=a.CertID,l=a.CertStatus,h=r.x509,m=h.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 s({tag:"a0",explicit:!0,obj:v}))}if(p.ext!=null){var g=new m(p.ext);d.push(new s({tag:"a1",explicit:!0,obj:g}))}var y=new i({array:d});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(p){this.params=p},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.SingleResponse,A.asn1.ASN1Object);A.asn1.ocsp.CertID=function(e){var t=A,n=t.asn1,r=n.DEROctetString,i=n.DERInteger,o=n.DERSequence,s=n.x509,a=s.AlgorithmIdentifier,u=n.ocsp,l=u.DEFAULT_HASH,h=t.crypto,m=h.Util.hashHex,p=tt,d=$e,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),C=new p(y),_=m(E.getSubjectHex(),w),F=E.getPublicKeyHex(),H=m(v(F,0,[1],"03",!0),w),K=C.getSerialNumberHex(),S={alg:w,issname:_,isskey:H,sbjsn:K};return S},this.tohex=function(){if(typeof this.params!="object")throw new Error("params not set");var g=this.params,y,w,E,C;if(g.alg==null?C=this.DEFAULT_HASH:C=g.alg,g.issuerCert!=null&&g.subjectCert!=null){var _=this.getParamByCerts(g.issuerCert,g.subjectCert,C);y=_.issname,w=_.isskey,E=_.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 F=new a({name:C}),H=new r({hex:y}),K=new r({hex:w}),S=new i({hex:E}),I=new o({array:[F,H,K,S]});return this.hTLV=I.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(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 n=[{gentime:{str:t.time}}];t.reason!=null&&n.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:t.reason}}}});var r={tag:"a1",explicit:!1,obj:{seq:n}};return A.asn1.ASN1Util.newObject({tag:r}).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)};Ee(A.asn1.ocsp.CertStatus,A.asn1.ASN1Object);A.asn1.ocsp.Request=function(e){var t=A,n=t.asn1,r=n.DERSequence,i=n.ocsp;if(i.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var s=[];if(this.dReqCert===null)throw"reqCert not set";s.push(this.dReqCert);var a=new r({array:s});return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},typeof e<"u"){var o=new i.CertID(e);this.dReqCert=o}};Ee(A.asn1.ocsp.Request,A.asn1.ASN1Object);A.asn1.ocsp.TBSRequest=function(e){var t=A,n=t.asn1,r=n.DERSequence,i=n.ocsp;i.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(o){for(var s=[],a=0;a<o.length;a++){var u=new i.Request(o[0]);s.push(u)}this.dRequestList=s},this.tohex=function(){var o=[];if(this.version!==0)throw"not supported version: "+this.version;if(this.dRequestorName!==null)throw"requestorName not supported";var s=new r({array:this.dRequestList});if(o.push(s),this.dRequestExt!==null)throw"requestExtensions not supported";var a=new r({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)};Ee(A.asn1.ocsp.TBSRequest,A.asn1.ASN1Object);A.asn1.ocsp.OCSPRequest=function(e){var t=A,n=t.asn1,r=n.DERSequence,i=n.ocsp;if(i.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var s=[];if(this.dTbsRequest!==null)s.push(this.dTbsRequest);else throw"tbsRequest not set";if(this.dOptionalSignature!==null)throw"optionalSignature not supported";var a=new r({array:s});return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0){var o=new i.TBSRequest(e);this.dTbsRequest=o}};Ee(A.asn1.ocsp.OCSPRequest,A.asn1.ASN1Object);A.asn1.ocsp.OCSPUtil={};A.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,n){var r=A,i=r.asn1,o=i.ocsp;n===void 0&&(n=o.DEFAULT_HASH);var s={alg:n,issuerCert:e,subjectCert:t},a=new o.OCSPRequest({reqList:[s]});return a.tohex()};A.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=$e,n=t.getVbyList,r=t.getVbyListEx,i=t.getIdxbyList,o=t.getIdxbyListEx,s=t.getV,a={};try{var u=r(e,0,[0],"0a");a.responseStatus=parseInt(u,16)}catch{}if(a.responseStatus!==0)return a;try{var l=i(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=Gt(n(e,l,[0]))):e.substr(l,2)==="82"&&(a.certStatus="unknown")}catch{}try{var h=i(e,0,[1,0,1,0,0,2,0,2]);a.thisUpdate=Gt(s(e,h))}catch{}try{var m=i(e,0,[1,0,1,0,0,2,0,3]);e.substr(m,2)==="a0"&&(a.nextUpdate=Gt(n(e,m,[0])))}catch{}return a};A.asn1.ocsp.OCSPParser=function(){var e=Error,t=tt,n=new t,r=$e,i=r.getV,o=r.getTLV,s=r.getIdxbyList,a=r.getVbyList,u=r.getTLVbyList,l=r.getVbyListEx,h=r.getTLVbyListEx,m=r.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=h(p,0,[0],"30");d.array=this.getRequestList(v);var g=h(p,0,["[2]",0],"30");return g!=null&&(d.ext=n.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=s(p,0,[1,0]);v.ext=n.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=i(p,d[1]),g.isskey=i(p,d[2]),g.sbjsn=i(p,d[3]),g},this.getOCSPResponse=function(p){var d=m(p,0),v,g=i(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=i(p,d[0]);return v.restype=A.asn1.x509.OID.oid2name(Sm(y)),v},this.getBasicOCSPResponse=function(p){var d=m(p,0),v;v=this.getResponseData(o(p,d[0]));var g=new tt;v.alg=g.getAlgorithmIdentifierName(o(p,d[1]));var y=i(p,d[2]);v.sighex=y.substr(2);var w=l(p,0,["[0]"]);if(w!=null){for(var E=m(w,0),C=[],_=0;_<E.length;_++){var F=o(w,E[_]);C.push(F)}v.certs=C}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=i(p,d[y++]);if(g.prodat=Gt(w),g.array=this.getSingleResponseList(o(p,d[y++])),p.substr(d[v-1],2)=="a1"){var E=u(p,d[v-1],[0]),C=new tt;g.ext=C.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 tt;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=i(p,d[2]);v.thisupdate=Gt(w)}for(var E=3;E<d.length;E++){if(p.substr(d[E],2)=="a0"){var C=a(p,d[E],[0],"18");v.nextupdate=Gt(C)}if(p.substr(d[E],2)=="a1"){var _=new tt,F=u(p,0,[E,0]);v.ext=_.getExtParamArray(F)}}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=Gt(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 z8(e){for(var t=new Array,n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function W8(e){for(var t="",n=0;n<e.length;n++)t=t+String.fromCharCode(e[n]);return t}function vm(e){for(var t="",n=0;n<e.length;n++){var r=e[n].toString(16);r.length==1&&(r="0"+r),t=t+r}return t}function vs(e){return vm(z8(e))}function WV(e){return ba(vs(e))}function YV(e){return wf(ba(vs(e)))}function XV(e){return W8(M8(Id(e)))}function wf(e){return e=e.replace(/\=/g,""),e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e}function Id(e){return e.length%4==2?e=e+"==":e.length%4==3&&(e=e+"="),e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/"),e}function Mn(e){return e.length%2==1&&(e="0"+e),wf(ba(e))}function rn(e){return yf(Id(e))}var Fd,Oi;typeof Buffer=="function"?(Fd=function(e){return wf(Buffer.from(e,"utf8").toString("base64"))},Oi=function(e){return Buffer.from(Id(e),"base64").toString("utf8")}):(Fd=function(e){return Mn(Em(Am(e)))},Oi=function(e){return decodeURIComponent(bm(rn(e)))});function ZV(e){return ba(Em(Am(e)))}function JV(e){return decodeURIComponent(bm(yf(e)))}function wm(e){return Em(Am(e)).toLowerCase()}function Gt(e){try{return decodeURIComponent(bm(e))}catch{return null}}function QV(e){return Gt(eG(e))}function eG(e){for(var t=e.match(/.{1,2}/g),n=[],r=0;r<t.length;r++){var i=parseInt(t[r],16);161<=i&&i<=191?(n.push("c2"),n.push(t[r])):192<=i&&i<=255?(n.push("c3"),n.push((i-64).toString(16))):n.push(t[r])}return n.join("")}function ws(e){for(var t="",n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function So(e){for(var t="",n=0;n<e.length;n++)t+=("0"+e.charCodeAt(n).toString(16)).slice(-2);return t}function cE(e){return ba(e)}function tG(e){return ym(cE(e),64)}function ym(e,t){return e=e.replace(new RegExp("(.{"+t+"})","g"),`$1\r
`),e=e.replace(/\s+$/,""),e}function Y8(e){var t=e.replace(/[^0-9A-Za-z\/+=]*/g,""),n=yf(t);return n}function nG(e,t){return"-----BEGIN "+t+`-----\r
`+ym(e,64)+`\r
-----END `+t+`-----\r
`}function xr(e,t){return"-----BEGIN "+t+`-----\r
`+ym(cE(e),64)+`\r
-----END `+t+`-----\r
`}function dn(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 [^-]+-----[^]*$/,"")),Y8(e)}function rG(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 sG(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),n=new DataView(t),r=0;r<e.length/2;r++)n.setUint8(r,parseInt(e.substr(r*2,2),16));return t}function iG(e){for(var t="",n=new DataView(e),r=0;r<e.byteLength;r++)t+=("00"+n.getUint8(r).toString(16)).slice(-2);return t}function lE(e){var t,n,r,i,o,s,a,u,l,h,m,p;if(e=Z8(e),p=e.match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/),p)return t=parseInt(p[1]),n=parseInt(p[2])-1,r=parseInt(p[3]),i=parseInt(p[4]),o=parseInt(p[5]),s=parseInt(p[6]),a=0,h=p[7],h!==""&&(m=(h.substr(1)+"00").substr(0,3),a=parseInt(m)),Date.UTC(t,n,r,i,o,s,a);throw new Error("unsupported zulu format: "+e)}function oG(e){var t=new Date(e),n=("0000"+t.getUTCFullYear()).slice(-4),r=("00"+(t.getUTCMonth()+1)).slice(-2),i=("00"+t.getUTCDate()).slice(-2),o=("00"+t.getUTCHours()).slice(-2),s=("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,n+r+i+o+s+a+u+"Z"}function X8(e){return Math.round(lE(e)/1e3)}function aG(e){return new Date(lE(e))}function uG(e,t,n){var r,i=e.getUTCFullYear();if(t){if(i<1950||2049<i)throw"not proper year for UTCTime: "+i;r=(""+i).slice(-2)}else r=("000"+i).slice(-4);if(r+=("0"+(e.getUTCMonth()+1)).slice(-2),r+=("0"+e.getUTCDate()).slice(-2),r+=("0"+e.getUTCHours()).slice(-2),r+=("0"+e.getUTCMinutes()).slice(-2),r+=("0"+e.getUTCSeconds()).slice(-2),n){var o=e.getUTCMilliseconds();o!==0&&(o=("00"+o).slice(-3),o=o.replace(/0+$/g,""),r+="."+o)}return r+="Z",r}function Z8(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 Em(e){return e.replace(/%/g,"")}function bm(e){return e.replace(/(..)/g,"%$1")}function nE(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;e=e.toLowerCase();var n=e.split(":").length-1;if(n<2)throw t;var r=":".repeat(7-n+2);e=e.replace("::",r);var i=e.split(":");if(i.length!=8)throw t;for(var o=0;o<8;o++)i[o]=("0000"+i[o]).slice(-4);return i.join("")}function rE(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(i){return i.replace(/^0+/,"")}),t=t.map(function(i){return i==""?"0":i}),e=":"+t.join(":")+":";var n=e.match(/:(0:){2,}/g);if(n==null)return e.slice(1,-1);var r=n.sort().slice(-1)[0];return e=e.replace(r.substr(0,r.length-1),":"),e.substr(0,2)!="::"&&(e=e.substr(1)),e.substr(-2,2)!="::"&&(e=e.substr(0,e.length-1)),e}function hm(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 n;try{return n=parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16),n}catch{throw t}}else if(e.length==16)try{return hm(e.substr(0,8))+"/"+U8(e.substr(8))}catch{throw t}else{if(e.length==32)return rE(e);if(e.length==64){try{return rE(e.substr(0,32))+"/"+U8(e.substr(32))}catch{throw t}return}else return e}}function U8(e){var t=new Error("malformed mask"),n;try{n=new re(e,16).toString(2)}catch{throw t}if(!n.match(/^1*0*$/))throw t;return n.replace(/0+$/,"").length}function fE(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 n=e.split(".");if(n.length!==4)throw t;var r="";try{for(var i=0;i<4;i++){var o=parseInt(n[i]);r+=("0"+o.toString(16)).slice(-2)}return r}catch{throw t}}else if(e.match(/^[0-9.]+\/[0-9]+$/)){var s=e.split("/");return fE(s[0])+H8(parseInt(s[1]),32)}else{if(e.match(/^[0-9a-f:]+$/)&&e.indexOf(":")!==-1)return nE(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&e.indexOf(":")!==-1){var s=e.split("/");return nE(s[0])+H8(parseInt(s[1]),128)}else throw t}}function H8(e,t){if(t==32&&e==0)return"00000000";if(t==128&&e==0)return"00000000000000000000000000000000";var n=Array(e+1).join("1")+Array(t-e+1).join("0");return new re(n,2).toString(16)}function hE(e){function t(i){var o=parseInt(i.substr(0,2),16),s=parseInt(i.substr(2),16);if(o==0&s<128)return String.fromCharCode(s);if(o<8){var a=192|(o&7)<<3|(s&192)>>6,u=128|s&63;return Gt(a.toString(16)+u.toString(16))}var a=224|(o&240)>>4,u=128|(o&15)<<2|(s&192)>>6,l=128|s&63;return Gt(a.toString(16)+u.toString(16)+l.toString(16))}var n=e.match(/.{4}/g),r=n.map(t);return r.join("")}function Am(e){for(var t=encodeURIComponent(e),n="",r=0;r<t.length;r++)t[r]=="%"?(n=n+t.substr(r,3),r=r+2):n=n+"%"+vs(t[r]);return n}function cG(e){return e=e.replace(/\r\n/mg,`
`),e}function lG(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 J8(e)};function J8(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=Id(e),A.lang.String.isBase64(e))};function dE(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 sE(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function fG(e){e=e.replace(/^\s*\[\s*/,""),e=e.replace(/\s*\]\s*$/,""),e=e.replace(/\s*/g,"");try{var t=e.split(/,/).map(function(n,r,i){var o=parseInt(n);if(o<0||255<o)throw"integer not in range 0-255";var s=("00"+o.toString(16)).slice(-2);return s}).join("");return t}catch(n){throw"malformed integer array string: "+n}}var hG=function(e,t){var n=e.length;e.length>t.length&&(n=t.length);for(var r=0;r<n;r++)if(e.charCodeAt(r)!=t.charCodeAt(r))return r;return e.length!=t.length?n:-1};function Q8(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 Ea<"u"){if(Ea.timingSafeEqual!==void 0)return Ea.timingSafeEqual(Buffer.from(e),Buffer.from(t));if(Ea.subtle!==void 0&&Ea.subtle.timingSafeEqual)return Ea.subtle.timingSafeEqual(Buffer.from(e),Buffer.from(t))}return eD(e,t)}function eD(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 n=t.slice();for(var r=0,i=0;i<e.length;i++)r|=e.charCodeAt(i)^n.charCodeAt(i);return r===0}function tD(e){var t=function(a){var u=a.toString(16);return u.length==1&&(u="0"+u),u},n=function(a){var u="",l=parseInt(a,10),h=l.toString(2),m=7-h.length%7;m==7&&(m=0);for(var p="",d=0;d<m;d++)p+="0";h=p+h;for(var d=0;d<h.length-1;d+=7){var v=h.substr(d,7);d!=h.length-7&&(v="1"+v),u+=t(parseInt(v,2))}return u};try{if(!e.match(/^[0-9.]+$/))return null;var r="",i=e.split("."),o=parseInt(i[0],10)*40+parseInt(i[1],10);r+=t(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r}catch{return null}}function Sm(e){if(!J8(e))return null;try{var t=[],n=e.substr(0,2),r=parseInt(n,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var i=e.substr(2),o=[],s=0;s<i.length/2;s++)o.push(parseInt(i.substr(s*2,2),16));for(var a=[],u="",s=0;s<o.length;s++)o[s]&128?u=u+dm((o[s]&127).toString(2),7):(u=u+dm((o[s]&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 nD(e){var t=new re(String(e),10);return $d(t)}function $d(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 n=t.substr(1),r=n.length;r%2==1?r+=1:t.match(/^[0-7]/)||(r+=2);for(var i="",o=0;o<r;o++)i+="f";var s=new re(i,16),a=s.xor(e).add(re.ONE);return t=a.toString(16).replace(/^-/,""),t}var dm=function(e,t,n){return n==null&&(n="0"),e.length>=t?e:new Array(t-e.length+1).join(n)+e};function rD(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 n=parseInt(t,16);if(n>7)return-1;var r=e.substr(2),i=parseInt(r,16).toString(2);i=="0"&&(i="00000000"),i=i.slice(0,0-n);var o=parseInt(i,2);return o==NaN?-1:o}catch{return-1}}function sD(e){if(typeof e!="number"||e<0)return null;var t=Number(e).toString(2),n=8-t.length%8;n==8&&(n=0),t=t+dm("",n,"0");var r=parseInt(t,2).toString(16);r.length%2==1&&(r="0"+r);var i="0"+n;return i+r}function iD(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 n=e.substr(2),r="",i=0;i<n.length;i+=2){var o=n.substr(i,2),s=parseInt(o,16).toString(2);s=("0000000"+s).slice(-8),r+=s}return r.substr(0,r.length-t)}catch{return null}}function dG(e){if(typeof e!="string"||e.match(/^[01]+$/)==null)return null;try{var t=parseInt(e,2);return sD(t)}catch{return null}}function pm(e,t){for(var n=0,r=0;r<e.length;r++)n|=1<<t[e[r]];for(var i=n.toString(2),o="",r=i.length-1;r>=0;r--)o+=i[r];return o}function Qt(e,r,n){if(typeof e=="object"){for(var r=String(r).split("."),i=0;i<r.length&&e;i++){var o=r[i];o.match(/^[0-9]+$/)&&(o=parseInt(o)),e=e[o]}return e||e===!1?e:n}}function Ee(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,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:ke.algo.MD5,sha1:ke.algo.SHA1,sha224:ke.algo.SHA224,sha256:ke.algo.SHA256,sha384:ke.algo.SHA384,sha512:ke.algo.SHA512,ripemd160:ke.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,n){var r=this.getDigestInfoHex(e,t),i=n/4;if(r.length+22>i)throw"key is too short for SigAlg: keylen="+n+","+t;for(var o="0001",s="00"+r,a="",u=i-o.length-s.length,l=0;l<u;l+=2)a+="ff";var h=o+a+s;return h},this.hashString=function(e,t){var n=new A.crypto.MessageDigest({alg:t});return n.digestString(e)},this.hashHex=function(e,t){var n=new A.crypto.MessageDigest({alg:t});return n.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 at||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 Af;A.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return A.crypto.Util.SECURERANDOMGEN.nextBytes(t),vm(t)};A.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new re(A.crypto.Util.getRandomHexOfNbytes(e),16)};A.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,n=(e-t)/8,r=new Array(n+1);return A.crypto.Util.SECURERANDOMGEN.nextBytes(r),r[0]=(255<<t&255^255)&r[0],vm(r)};A.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new re(A.crypto.Util.getRandomHexOfNbits(e),16)};A.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var n=A.crypto.Util.getRandomBigIntegerOfNbits(t);if(e.compareTo(n)>=0)return n}};A.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var n=e.compareTo(t);if(n>0)throw"biMin is greater than biMax";if(n==0)return e;var r=t.subtract(e),i=A.crypto.Util.getRandomBigIntegerZeroToMax(r);return i.add(e)};A.crypto.MessageDigest=function(e){var t=null,n=null,r=null;this.setAlgAndProvider=function(i,o){if(i=A.crypto.MessageDigest.getCanonicalAlgName(i),i!==null&&o===void 0&&(o=A.crypto.Util.DEFAULTPROVIDER[i]),":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)!=-1&&o=="cryptojs"){try{this.md=A.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i].create()}catch(s){throw"setAlgAndProvider hash alg set fail alg="+i+"/"+s}this.updateString=function(s){this.md.update(s)},this.updateHex=function(s){var a=ke.enc.Hex.parse(s);this.md.update(a)},this.digest=function(){var s=this.md.finalize();return s.toString(ke.enc.Hex)},this.digestString=function(s){return this.updateString(s),this.digest()},this.digestHex=function(s){return this.updateHex(s),this.digest()}}if(":sha256:".indexOf(i)!=-1&&o=="sjcl"){try{this.md=new sjcl.hash.sha256}catch(s){throw"setAlgAndProvider hash alg set fail alg="+i+"/"+s}this.updateString=function(s){this.md.update(s)},this.updateHex=function(s){var a=sjcl.codec.hex.toBits(s);this.md.update(a)},this.digest=function(){var s=this.md.finalize();return sjcl.codec.hex.fromBits(s)},this.digestString=function(s){return this.updateString(s),this.digest()},this.digestHex=function(s){return this.updateHex(s),this.digest()}}},this.updateString=function(i){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(i){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(i){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(i){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,n=t.getCanonicalAlgName(e);if(t.HASHLENGTH[n]===void 0)throw"not supported algorithm: "+e;return t.HASHLENGTH[n]};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,n=null,r=null,i=null,o=null;this.setAlgAndProvider=function(s,a){if(s=s.toLowerCase(),s==null&&(s="hmacsha1"),s=s.toLowerCase(),s.substr(0,4)!="hmac")throw"setAlgAndProvider unsupported HMAC alg: "+s;a===void 0&&(a=A.crypto.Util.DEFAULTPROVIDER[s]),this.algProv=s+"/"+a;var u=s.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=ke.algo.HMAC.create(l,this.pass)}catch(h){throw"setAlgAndProvider hash alg set fail hashAlg="+u+"/"+h}this.updateString=function(h){this.mac.update(h)},this.updateHex=function(h){var m=ke.enc.Hex.parse(h);this.mac.update(m)},this.doFinal=function(){var h=this.mac.finalize();return h.toString(ke.enc.Hex)},this.doFinalString=function(h){return this.updateString(h),this.doFinal()},this.doFinalHex=function(h){return this.updateHex(h),this.doFinal()}}},this.updateString=function(s){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(s){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(s){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(s){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(s){if(typeof s=="string"){var a=s;(s.length%2==1||!s.match(/^[0-9A-Fa-f]+$/))&&(a=So(s)),this.pass=ke.enc.Hex.parse(a);return}if(typeof s!="object")throw"KJUR.crypto.Mac unsupported password type: "+s;var a=null;if(s.hex!==void 0){if(s.hex.length%2!=0||!s.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+s.hex;a=s.hex}if(s.utf8!==void 0&&(a=wm(s.utf8)),s.rstr!==void 0&&(a=So(s.rstr)),s.b64!==void 0&&(a=yf(s.b64)),s.b64u!==void 0&&(a=rn(s.b64u)),a==null)throw"KJUR.crypto.Mac unsupported password type: "+s;this.pass=ke.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,n=null,r=null,i=null,o=null,s=null,a=null,u=null,l=null,h=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 C="",_=E/4-w.length,F=0;F<_;F++)C=C+"0";return C+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(C){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+C)}this.init=function(C,_){var F=null;try{_===void 0?F=_t.getKey(C):F=_t.getKey(C,_)}catch(H){throw"init failed:"+H}if(F.isPrivate===!0)this.prvKey=F,this.state="SIGN";else if(F.isPublic===!0)this.pubKey=F,this.state="VERIFY";else throw"init failed.:"+F},this.updateString=function(C){this.md.updateString(C)},this.updateHex=function(C){this.md.updateHex(C)},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 at&&this.pubkeyAlgName==="rsaandmgf1")this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof at&&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(C){return this.updateString(C),this.sign()},this.signHex=function(C){return this.updateHex(C),this.sign()},this.verify=function(C){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 at&&this.pubkeyAlgName==="rsaandmgf1")return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,C,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof at&&this.pubkeyAlgName==="rsa")return this.pubKey.verifyWithMessageHash(this.sHashHex,C);if(A.crypto.ECDSA!==void 0&&this.pubKey instanceof A.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,C);if(A.crypto.DSA!==void 0&&this.pubKey instanceof A.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,C);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=_t.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,n,r){if(Qt(r,"enclag")!=null&&(n=r.encalg),typeof n=="string"&&n.substr(-4)=="-CBC"){var i=t,o=e;Qt(r,"key")!=null&&(i=r.key),Qt(r,"enc")!=null&&(hEnc=r.enc);var s=ke.enc.Hex.parse(i),a=ke.enc.Hex.parse(o),u=ke.enc.Hex.parse(r.iv),l;if(n=="des-EDE3-CBC")l=ke.TripleDES.encrypt(a,s,{iv:u});else if(n=="aes128-CBC"||n=="aes256-CBC")l=ke.AES.encrypt(a,s,{iv:u});else throw new Error("unsupported algorithm: "+n);return l+""}else throw new Error("Cipher.encrypt: unsupported key or algorithm")};A.crypto.Cipher.decrypt=function(e,t,n,r){if(Qt(r,"enclag")!=null&&(n=r.encalg),typeof n=="string"&&n.substr(-4)=="-CBC"){var i=t,o=e;Qt(r,"key")!=null&&(i=r.key),Qt(r,"enc")!=null&&(o=r.enc);var s=ke.enc.Hex.parse(i),a=ke.enc.Hex.parse(o),u=ke.enc.Hex.parse(r.iv),l;if(n=="des-EDE3-CBC")l=ke.TripleDES.decrypt({ciphertext:a},s,{iv:u});else if(n=="aes128-CBC"||n=="aes256-CBC")l=ke.AES.decrypt({ciphertext:a},s,{iv:u});else throw new Error("unsupported algorithm: "+n);return ke.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",n=null,r=null,i=null,o=Error,s=re,a=Nt,u=A.crypto.ECDSA,l=A.crypto.ECParameterDB,h=u.getName,m=$e,p=m.getVbyListEx,d=m.isASN1HEX,v=new Af,g=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function y(w,E,C,_){for(var F=Math.max(E.bitLength(),_.bitLength()),H=w.add2D(C),K=w.curve.getInfinity(),S=F-1;S>=0;--S)K=K.twice2D(),K.z=s.ONE,E.testBit(S)?_.testBit(S)?K=K.add2D(H):K=K.add2D(w):_.testBit(S)&&(K=K.add2D(C));return K}this.getBigRandom=function(w){return new s(w.bitLength(),v).mod(w.subtract(s.ONE)).add(s.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 C={};return C.x=w.substr(2,E),C.y=w.substr(2+E),C},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),C=this.ecparams.keycharlen,_=("0000000000"+E.toString(16)).slice(-C);this.setPrivateKeyHex(_);var F=this.generatePublicKeyHex();return{ecprvhex:_,ecpubhex:F}},this.generatePublicKeyHex=function(){var w=new s(this.prvKeyHex,16),E=this.ecparams.G.multiply(w),C=E.getX().toBigInteger(),_=E.getY().toBigInteger(),F=this.ecparams.keycharlen,H=("0000000000"+C.toString(16)).slice(-F),K=("0000000000"+_.toString(16)).slice(-F),S="04"+H+K;return this.setPublicKeyHex(S),S},this.signWithMessageHash=function(w){return this.signHex(w,this.prvKeyHex)},this.signHex=function(w,E){var C=new s(E,16),_=this.ecparams.n,F=new s(w.substring(0,this.ecparams.keycharlen),16);do var H=this.getBigRandom(_),K=this.ecparams.G,S=K.multiply(H),I=S.getX().toBigInteger().mod(_);while(I.compareTo(s.ZERO)<=0);var q=H.modInverse(_).multiply(F.add(C.multiply(I))).mod(_);return u.biRSSigToASN1Sig(I,q)},this.sign=function(w,E){var C=E,_=this.ecparams.n,F=s.fromByteArrayUnsigned(w);do var H=this.getBigRandom(_),K=this.ecparams.G,S=K.multiply(H),I=S.getX().toBigInteger().mod(_);while(I.compareTo(re.ZERO)<=0);var q=H.modInverse(_).multiply(F.add(C.multiply(I))).mod(_);return this.serializeSig(I,q)},this.verifyWithMessageHash=function(w,E){return this.verifyHex(w,E,this.pubKeyHex)},this.verifyHex=function(w,E,C){try{var _,F,H=u.parseSigHex(E);_=H.r,F=H.s;var K=a.decodeFromHex(this.ecparams.curve,C),S=new s(w.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(S,_,F,K)}catch{return!1}},this.verify=function(w,E,C){var _,F;if(Bitcoin.Util.isArray(E)){var H=this.parseSig(E);_=H.r,F=H.s}else if(typeof E=="object"&&E.r&&E.s)_=E.r,F=E.s;else throw"Invalid value for signature";var K;if(C instanceof Nt)K=C;else if(Bitcoin.Util.isArray(C))K=a.decodeFrom(this.ecparams.curve,C);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var S=s.fromByteArrayUnsigned(w);return this.verifyRaw(S,_,F,K)},this.verifyRaw=function(w,E,C,_){var F=this.ecparams.n,H=this.ecparams.G;if(E.compareTo(s.ONE)<0||E.compareTo(F)>=0||C.compareTo(s.ONE)<0||C.compareTo(F)>=0)return!1;var K=C.modInverse(F),S=w.multiply(K).mod(F),I=E.multiply(K).mod(F),q=H.multiply(S).add(_.multiply(I)),L=q.getX().toBigInteger().mod(F);return L.equals(E)},this.serializeSig=function(w,E){var C=w.toByteArraySigned(),_=E.toByteArraySigned(),F=[];return F.push(2),F.push(C.length),F=F.concat(C),F.push(2),F.push(_.length),F=F.concat(_),F.unshift(F.length),F.unshift(48),F},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 C=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 _=w.slice(E+2,E+2+w[E+1]);E+=2+w[E+1];var F=s.fromByteArrayUnsigned(C),H=s.fromByteArrayUnsigned(_);return{r:F,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 C=this.ecparams.n,_=s.fromByteArrayUnsigned(w.slice(1,33)).mod(C),F=s.fromByteArrayUnsigned(w.slice(33,65)).mod(C);return{r:_,s:F,i:E}},this.readPKCS5PrvKeyHex=function(w){if(d(w)===!1)throw new Error("not ASN.1 hex string");var E,C,_;try{E=p(w,0,["[0]",0],"06"),C=p(w,0,[1],"04");try{_=p(w,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=h(E),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(_),this.setPrivateKeyHex(C),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(w){if(d(w)===!1)throw new o("not ASN.1 hex string");var E,C,_,F;try{E=p(w,0,[1,0],"06"),C=p(w,0,[1,1],"06"),_=p(w,0,[2,0,1],"04");try{F=p(w,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new o("malformed PKCS#8 plain ECC private key")}if(this.curveName=h(C),this.curveName===void 0)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(F),this.setPrivateKeyHex(_),this.isPublic=!1},this.readPKCS8PubKeyHex=function(w){if(d(w)===!1)throw new o("not ASN.1 hex string");var E,C,_;try{E=p(w,0,[0,0],"06"),C=p(w,0,[0,1],"06"),_=p(w,0,[1],"03")}catch{throw new o("malformed PKCS#8 ECC public key")}if(this.curveName=h(C),this.curveName===null)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(_)},this.readCertPubKeyHex=function(w,E){if(d(w)===!1)throw new o("not ASN.1 hex string");var C,_;try{C=p(w,0,[0,5,0,1],"06"),_=p(w,0,[0,5,1],"03")}catch{throw new o("malformed X.509 certificate ECC public key")}if(this.curveName=h(C),this.curveName===null)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(_)},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),n=new re(t.r,16),r=new re(t.s,16);return{r:n,s:r}};A.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=$e,n=t.getChildIdx,r=t.getV;if(t.checkStrictDER(e,0),e.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var i=n(e,0);if(i.length!=2)throw new Error("signature shall have two elements");var o=i[0],s=i[1];if(e.substr(o,2)!="02")throw new Error("1st item not ASN.1 integer");if(e.substr(s,2)!="02")throw new Error("2nd item not ASN.1 integer");var a=r(e,o),u=r(e,s);return{r:a,s:u}};A.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),n=t.r,r=t.s;if(n.length>=130&&n.length<=134){if(n.length%2!=0)throw Error("unknown ECDSA sig r length error");if(r.length%2!=0)throw Error("unknown ECDSA sig s length error");n.substr(0,2)=="00"&&(n=n.substr(2)),r.substr(0,2)=="00"&&(r=r.substr(2));var i=Math.max(n.length,r.length);return n=("000000"+n).slice(-i),r=("000000"+r).slice(-i),n+r}if(n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.length%32==30&&(n="00"+n),r.length%32==30&&(r="00"+r),n.length%32!=0)throw Error("unknown ECDSA sig r length error");if(r.length%32!=0)throw Error("unknown ECDSA sig s length error");return n+r};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),n=e.substr(e.length/2);return A.crypto.ECDSA.hexRSSigToASN1Sig(t,n)};A.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var n=new re(e,16),r=new re(t,16);return A.crypto.ECDSA.biRSSigToASN1Sig(n,r)};A.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var n=A.asn1,r=new n.DERInteger({bigint:e}),i=new n.DERInteger({bigint:t}),o=new n.DERSequence({array:[r,i]});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 n(r){return new re(r,16)}this.getByName=function(r){var i=r;if(typeof t[i]<"u"&&(i=t[r]),typeof e[i]<"u")return e[i];throw"unregistered EC curve name: "+i},this.regist=function(r,i,o,s,a,u,l,h,m,p,d,v){e[r]={};var g=n(o),y=n(s),w=n(a),E=n(u),C=n(l),_=new Aa(g,y,w),F=_.decodePointHex("04"+h+m);e[r].name=r,e[r].keylen=i,e[r].keycharlen=Math.ceil(i/8)*2,e[r].curve=_,e[r].G=F,e[r].n=E,e[r].h=C,e[r].oid=d,e[r].info=v;for(var H=0;H<p.length;H++)t[p[H]]=r}};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=$e,t=e.getVbyList,n=e.getVbyListEx,r=e.isASN1HEX,i=re,o=re.ONE,s=function(a,u,l,h){if(a==null||u==null||l==null||h==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(h)>=0||h.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,h,m){this.isPrivate=!0,this.p=a,this.q=u,this.g=l,this.y=h,this.x=m},this.setPrivateHex=function(a,u,l,h,m){var p,d,v,g,y;p=new re(a,16),d=new re(u,16),v=new re(l,16),typeof h=="string"&&h.length>1?g=new re(h,16):g=null,y=new re(m,16),this.setPrivate(p,d,v,g,y)},this.setPublic=function(a,u,l,h){s(a,u,l,h),this.isPublic=!0,this.p=a,this.q=u,this.g=l,this.y=h,this.x=null},this.setPublicHex=function(a,u,l,h){var m,p,d,v;m=new re(a,16),p=new re(u,16),d=new re(l,16),v=new re(h,16),this.setPublic(m,p,d,v)},this.signWithMessageHash=function(a){var u=this.p,l=this.q,h=this.g,m=this.y,p=this.x,d=a.substr(0,l.bitLength()/4),v=new re(d,16),g,y,w;do g=A.crypto.Util.getRandomBigIntegerMinToMax(re.ONE.add(re.ONE),l.subtract(re.ONE)),y=h.modPow(g,u).mod(l),w=g.modInverse(l).multiply(v.add(p.multiply(y))).mod(l);while(y.compareTo(re.ZERO)==0||w.compareTo(re.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,h=this.q,m=this.g,p=this.y,d=this.parseASN1Signature(u),v=d[0],g=d[1],y=a.substr(0,h.bitLength()/4),w=new re(y,16);if(re.ZERO.compareTo(v)>=0||v.compareTo(h)>=0||re.ZERO.compareTo(g)>=0||g.compareTo(h)>=0)throw"invalid DSA signature";var E=g.modInverse(h),C=w.multiply(E).mod(h),_=v.multiply(E).mod(h),F=m.modPow(C,l).multiply(p.modPow(_,l)).mod(l).mod(h);return F.compareTo(v)==0},this.parseASN1Signature=function(a){try{var u=new i(n(a,0,[0],"02"),16),l=new i(n(a,0,[1],"02"),16);return[u,l]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(a){var u,l,h,m,p;if(r(a)===!1)throw new Error("not ASN.1 hex string");try{u=n(a,0,[1],"02"),l=n(a,0,[2],"02"),h=n(a,0,[3],"02"),m=n(a,0,[4],"02"),p=n(a,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(u,l,h,m,p)},this.readPKCS8PrvKeyHex=function(a){var u,l,h,m;if(r(a)===!1)throw new Error("not ASN.1 hex string");try{u=n(a,0,[1,1,0],"02"),l=n(a,0,[1,1,1],"02"),h=n(a,0,[1,1,2],"02"),m=n(a,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(u,l,h,null,m)},this.readPKCS8PubKeyHex=function(a){var u,l,h,m;if(r(a)===!1)throw new Error("not ASN.1 hex string");try{u=n(a,0,[0,1,0],"02"),l=n(a,0,[0,1,1],"02"),h=n(a,0,[0,1,2],"02"),m=n(a,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(u,l,h,m)},this.readCertPubKeyHex=function(a,u){var l,h,m,p;if(r(a)===!1)throw new Error("not ASN.1 hex string");try{l=n(a,0,[0,5,0,1,0],"02"),h=n(a,0,[0,5,0,1,1],"02"),m=n(a,0,[0,5,0,1,2],"02"),p=n(a,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(l,h,m,p)}};var _t=(function(){var e=function(g,y,w){return r(ke.AES,g,y,w)},t=function(g,y,w){return r(ke.TripleDES,g,y,w)},n=function(g,y,w){return r(ke.DES,g,y,w)},r=function(g,y,w,E){var C=ke.enc.Hex.parse(y),_=ke.enc.Hex.parse(w),F=ke.enc.Hex.parse(E),H={};H.key=_,H.iv=F,H.ciphertext=C;var K=g.decrypt(H,_,{iv:F});return ke.enc.Hex.stringify(K)},i=function(g,y,w){return a(ke.AES,g,y,w)},o=function(g,y,w){return a(ke.TripleDES,g,y,w)},s=function(g,y,w){return a(ke.DES,g,y,w)},a=function(g,y,w,E){var C=ke.enc.Hex.parse(y),_=ke.enc.Hex.parse(w),F=ke.enc.Hex.parse(E),H=g.encrypt(C,_,{iv:F}),K=ke.enc.Hex.parse(H.toString()),S=ke.enc.Base64.stringify(K);return S},u={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:t,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:n,eproc:s,keylen:8,ivlen:8}},l=function(g){return u[g].proc},h=function(g){var y=ke.lib.WordArray.random(g),w=ke.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 C=-1,_=0;g.indexOf(`\r
\r
`)!=-1&&(C=g.indexOf(`\r
\r
`),_=2),g.indexOf(`
`)!=-1&&(C=g.indexOf(`
`),_=1);var F=g.indexOf("-----END");if(C!=-1&&F!=-1){var H=g.substring(C+_*2,F-_);H=H.replace(/\s+/g,""),y.data=H}return y},p=function(g,y,w){for(var E=w.substring(0,16),C=ke.enc.Hex.parse(E),_=ke.enc.Utf8.parse(y),F=u[g].keylen+u[g].ivlen,H="",K=null;;){var S=ke.algo.MD5.create();if(K!=null&&S.update(K),S.update(_),S.update(C),K=S.finalize(),H=H+ke.enc.Hex.stringify(K),H.length>=F*2)break}var I={};return I.keyhex=H.substr(0,u[g].keylen*2),I.ivhex=H.substr(u[g].keylen*2,u[g].ivlen*2),I},d=function(g,y,w,E){var C=ke.enc.Base64.parse(g),_=ke.enc.Hex.stringify(C),F=u[y].proc,H=F(_,w,E);return H},v=function(g,y,w,E){var C=u[y].eproc,_=C(g,w,E);return _};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,C=w.cipher,_=w.ivsalt,F=w.data,H=p(C,y,_),K=H.keyhex,S=d(F,C,K,_);return S},getEncryptedPKCS5PEMFromPrvKeyHex:function(g,y,w,E,C){var q="";if((typeof E>"u"||E==null)&&(E="AES-256-CBC"),typeof u[E]>"u")throw new Error("KEYUTIL unsupported algorithm: "+E);if(typeof C>"u"||C==null){var _=u[E].ivlen,F=h(_);C=F.toUpperCase()}var H=p(E,w,C),K=H.keyhex,S=v(y,E,K,C),I=S.replace(/(.{64})/g,`$1\r
`),q="-----BEGIN "+g+` PRIVATE KEY-----\r
`;return q+=`Proc-Type: 4,ENCRYPTED\r
`,q+="DEK-Info: "+E+","+C+`\r
`,q+=`\r
`,q+=I,q+=`\r
-----END `+g+` PRIVATE KEY-----\r
`,q},getEncryptedPKCS8PEM:function(g,y,w){var E=this.getEncryptedPKCS8Hex(g,y,w);return xr(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 C=this.generatePBES2ASN1Param(E);return A.asn1.ASN1Util.newObject(C).tohex()},initPBES2Param:function(g){if(Qt(g,"encalg")==null&&(g.encalg="aes256-CBC"),Qt(g,"iter")==null&&(g.iter=2048),Qt(g,"prf")==null&&(g.prf="hmacWithSHA256"),Qt(g,"salt")==null&&(g.salt=ke.enc.Hex.stringify(ke.lib.WordArray.random(8))),Qt(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=ke.enc.Hex.stringify(ke.lib.WordArray.random(y))}},encryptPBES2Param:function(g,y){var w=_t.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:nD(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=$e,w=y.getChildIdx,E=y.getV,C={},_=w(g,0);if(_.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+_.length);C.ciphertext=E(g,_[1]);var F=w(g,_[0]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+F.length);if(E(g,F[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var H=w(g,F[1]);if(F.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";C.encryptionSchemeAlg="TripleDES",C.encryptionSchemeIV=E(g,K[1]);var S=w(g,H[0]);if(S.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+S.length);if(E(g,S[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var I=w(g,S[1]);if(I.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+I.length);C.pbkdf2Salt=E(g,I[0]);var q=E(g,I[1]);try{C.pbkdf2Iter=parseInt(q,16)}catch{throw new Error("malformed format pbkdf2Iter: "+q)}return C},getPBKDF2KeyHexFromParam:function(g,y){var w=ke.enc.Hex.parse(g.pbkdf2Salt),E=g.pbkdf2Iter,C=ke.PBKDF2(y,w,{keySize:192/32,iterations:E}),_=ke.enc.Hex.stringify(C);return _},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(g,y){var w=dn(g,"ENCRYPTED PRIVATE KEY"),E=this.parseHexOfEncryptedPKCS8(w),C=_t.getPBKDF2KeyHexFromParam(E,y),_={};_.ciphertext=ke.enc.Hex.parse(E.ciphertext);var F=ke.enc.Hex.parse(C),H=ke.enc.Hex.parse(E.encryptionSchemeIV),K=ke.TripleDES.decrypt(_,F,{iv:H}),S=ke.enc.Hex.stringify(K);return S},parsePBES2:function(g){var y=$e.parse(g);if(Qt(y,"seq.0.seq.0.oid")!="pkcs5PBES2"||Qt(y,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var w=Qt(y,"seq.0.seq.1.seq.0.seq.1.seq");if(w==null)throw new Error("PBKDF2 parameter not found");var E=Qt(w,"0.octstr.hex"),C=Qt(w,"1.int.hex"),_=Qt(w,"2.seq.0.oid","hmacWithSHA1"),F=-1;try{F=parseInt(C,16)}catch{throw new Error("iter not proper value")}var H=Qt(y,"seq.0.seq.1.seq.1.seq.0.oid"),K=Qt(y,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),S=Qt(y,"seq.1.octstr.hex");if(H==null||K==null||S==null)throw new Error("encalg, enciv or enc is undefined");var I={salt:E,iter:F,prf:_,encalg:H,enciv:K,enc:S};return I},getDKFromPBES2Param:function(g,y){var w={hmacWithSHA1:ke.algo.SHA1,hmacWithSHA224:ke.algo.SHA224,hmacWithSHA256:ke.algo.SHA256,hmacWithSHA384:ke.algo.SHA384,hmacWithSHA512:ke.algo.SHA512},E={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},C=w[g.prf];if(C==null)throw new Error("unsupported prf");var _=E[g.encalg];if(_==null)throw new Error("unsupported encalg");var F=ke.enc.Hex.parse(g.salt),H=g.iter;try{var K=ke.PBKDF2(y,F,{keySize:_,iterations:H,hasher:C});return ke.enc.Hex.stringify(K)}catch(S){throw new Error("PBKDF2 error: "+S+" "+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=dn(g),E;try{E=_t.parsePBES2(w)}catch(_){throw new Error("malformed PBES2 format: "+_.message)}var C=_t.getDKFromPBES2Param(E,y);return A.crypto.Cipher.decrypt(E.enc,C,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=$e,w=y.getChildIdx,E=y.getV,C={};if(C.algparam=null,g.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var _=w(g,0);if(_.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(g.substr(_[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var F=w(g,_[1]);if(F.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(g.substr(F[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(C.algoid=E(g,F[0]),g.substr(F[1],2)=="06"&&(C.algparam=E(g,F[1])),g.substr(_[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return C.keyidx=y.getVidx(g,_[2]),C},getKeyFromPlainPrivatePKCS8PEM:function(g){var y=dn(g,"PRIVATE KEY"),w=this.getKeyFromPlainPrivatePKCS8Hex(y);return w},getKeyFromPlainPrivatePKCS8Hex:function(g){var y=this.parsePlainPrivatePKCS8Hex(g),w;if(y.algoid=="2a864886f70d010101")w=new at;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=$e.getVbyList(g,0,[0,0],"06");if(w==="2a864886f70d010101")y=new at;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=$e,w=y.getChildIdx,E=y.getV,C={};if(g.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var _=w(g,0);if(_.length!=2)throw new Error("malformed RSA key(code:002)");if(g.substr(_[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(C.n=E(g,_[0]),g.substr(_[1],2)!="02")throw new Error("malformed RSA key(code:004)");return C.e=E(g,_[1]),C},parsePublicPKCS8Hex:function(g){var y=$e,w=y.getChildIdx,E=y.getV,C={};C.algparam=null;var _=w(g,0);if(_.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+_.length);var F=_[0];if(g.substr(F,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var H=w(g,F);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(C.algoid=E(g,H[0]),g.substr(H[1],2)=="06"?C.algparam=E(g,H[1]):g.substr(H[1],2)=="30"&&(C.algparam={},C.algparam.p=y.getVbyList(g,H[1],[0],"02"),C.algparam.q=y.getVbyList(g,H[1],[1],"02"),C.algparam.g=y.getVbyList(g,H[1],[2],"02")),g.substr(_[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return C.key=E(g,_[1]).substr(2),C}}})();_t.getKey=function(e,t,n){var r=$e,i=r.getChildIdx,o=r.getV,s=r.getVbyList,a=A.crypto,u=a.ECDSA,l=a.DSA,h=at,m=dn,p=_t;if(typeof h<"u"&&e instanceof h||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 h;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 h;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 h;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 h;return d.setPublic(rn(e.n),rn(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 h;return d.setPrivateEx(rn(e.n),rn(e.e),rn(e.d),rn(e.p),rn(e.q),rn(e.dp),rn(e.dq),rn(e.qi)),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var d=new h;return d.setPrivate(rn(e.n),rn(e.e),rn(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"+rn(e.x)).slice(-g),w=("0000000000"+rn(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"+rn(e.x)).slice(-g),w=("0000000000"+rn(e.y)).slice(-g),E="04"+y+w,C=("0000000000"+rn(e.d)).slice(-g);return v.setPublicKeyHex(E),v.setPrivateKeyHex(C),v}if(n==="pkcs5prv"){var _=e,r=$e,F,d;if(F=i(_,0),F.length===9)d=new h,d.readPKCS5PrvKeyHex(_);else if(F.length===6)d=new l,d.readPKCS5PrvKeyHex(_);else if(F.length>2&&_.substr(F[1],2)==="04")d=new u,d.readPKCS5PrvKeyHex(_);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return d}if(n==="pkcs8prv"){var d=p.getKeyFromPlainPrivatePKCS8Hex(e);return d}if(n==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(e);if(n==="x509pub")return tt.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return tt.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var H=dn(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 S=m(e,"DSA PRIVATE KEY"),I=s(S,0,[1],"02"),q=s(S,0,[2],"02"),L=s(S,0,[3],"02"),T=s(S,0,[4],"02"),O=s(S,0,[5],"02"),d=new l;return d.setPrivate(new re(I,16),new re(q,16),new re(L,16),new re(T,16),new re(O,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 R=p.getDecryptedKeyHex(e,t),N=new at;return N.readPKCS5PrvKeyHex(R),N}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),d=s(S,0,[1],"04"),P=s(S,0,[2,0],"06"),M=s(S,0,[3,0],"03").substr(2),Y="";if(A.crypto.OID.oidhex2name[P]!==void 0)Y=A.crypto.OID.oidhex2name[P];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+P);var v=new u({curve:Y});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 S=p.getDecryptedKeyHex(e,t),I=s(S,0,[1],"02"),q=s(S,0,[2],"02"),L=s(S,0,[3],"02"),T=s(S,0,[4],"02"),O=s(S,0,[5],"02"),d=new l;return d.setPrivate(new re(I,16),new re(q,16),new re(L,16),new re(T,16),new re(O,16)),d}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};_t.generateKeypair=function(e,t){if(e=="RSA"){var n=t,r=new at;r.generate(n,"10001"),r.isPrivate=!0,r.isPublic=!0;var i=new at,o=r.n.toString(16),s=r.e.toString(16);i.setPublic(o,s),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=r,a.pubKeyObj=i,a}else if(e=="EC"){var u=t,l=new A.crypto.ECDSA({curve:u}),h=l.generateKeyPairHex(),r=new A.crypto.ECDSA({curve:u});r.setPublicKeyHex(h.ecpubhex),r.setPrivateKeyHex(h.ecprvhex),r.isPrivate=!0,r.isPublic=!1;var i=new A.crypto.ECDSA({curve:u});i.setPublicKeyHex(h.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=r,a.pubKeyObj=i,a}else throw new Error("unknown algorithm: "+e)};_t.getPEM=function(e,t,n,r,i,o){var s=A,a=s.asn1,u=a.DERObjectIdentifier,l=a.DERInteger,h=a.ASN1Util.newObject,m=a.x509,p=m.SubjectPublicKeyInfo,d=s.crypto,v=d.DSA,g=d.ECDSA,y=at;function w(N){var P=h({seq:[{int:0},{int:{bigint:N.n}},{int:N.e},{int:{bigint:N.d}},{int:{bigint:N.p}},{int:{bigint:N.q}},{int:{bigint:N.dmp1}},{int:{bigint:N.dmq1}},{int:{bigint:N.coeff}}]});return P}function E(N){var P=h({seq:[{int:1},{octstr:{hex:N.prvKeyHex}},{tag:["a0",!0,{oid:{name:N.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+N.pubKeyHex}}]}]});return P}function C(N){var P=h({seq:[{int:0},{int:{bigint:N.p}},{int:{bigint:N.q}},{int:{bigint:N.g}},{int:{bigint:N.y}},{int:{bigint:N.x}}]});return P}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 _=new p(e),F=_.tohex();return xr(F,"PUBLIC KEY")}if(t=="PKCS1PRV"&&y!==void 0&&e instanceof y&&(n===void 0||n==null)&&e.isPrivate==!0){var _=w(e),F=_.tohex();return xr(F,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&g!==void 0&&e instanceof g&&(n===void 0||n==null)&&e.isPrivate==!0){var H=new u({name:e.curveName}),K=H.tohex(),S=E(e),I=S.tohex(),q="";return q+=xr(K,"EC PARAMETERS"),q+=xr(I,"EC PRIVATE KEY"),q}if(t=="PKCS1PRV"&&v!==void 0&&e instanceof v&&(n===void 0||n==null)&&e.isPrivate==!0){var _=C(e),F=_.tohex();return xr(F,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&y!==void 0&&e instanceof y&&n!==void 0&&n!=null&&e.isPrivate==!0){var _=w(e),F=_.tohex();return r===void 0&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",F,n,r,o)}if(t=="PKCS5PRV"&&g!==void 0&&e instanceof g&&n!==void 0&&n!=null&&e.isPrivate==!0){var _=E(e),F=_.tohex();return r===void 0&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",F,n,r,o)}if(t=="PKCS5PRV"&&v!==void 0&&e instanceof v&&n!==void 0&&n!=null&&e.isPrivate==!0){var _=C(e),F=_.tohex();return r===void 0&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",F,n,r,o)}var L=function(N,P){if(typeof P=="string")return _t.getEncryptedPKCS8PEM(N,P);if(typeof P=="object"&&Qt(P,"passcode")!=null){var M=JSON.parse(JSON.stringify(P)),Y=M.passcode;return delete M.passcode,_t.getEncryptedPKCS8PEM(N,Y,M)}};if(t=="PKCS8PRV"&&y!=null&&e instanceof y&&e.isPrivate==!0){var T=w(e),O=T.tohex(),_=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:O}}]}),F=_.tohex();return n===void 0||n==null?xr(F,"PRIVATE KEY"):L(F,n)}if(t=="PKCS8PRV"&&g!==void 0&&e instanceof g&&e.isPrivate==!0){var R={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&R.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var T=new h(R),O=T.tohex(),_=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:O}}]}),F=_.tohex();return n===void 0||n==null?xr(F,"PRIVATE KEY"):L(F,n)}if(t=="PKCS8PRV"&&v!==void 0&&e instanceof v&&e.isPrivate==!0){var T=new l({bigint:e.x}),O=T.tohex(),_=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:O}}]}),F=_.tohex();return n===void 0||n==null?xr(F,"PRIVATE KEY"):L(F,n)}throw new Error("unsupported object nor format")};_t.getKeyFromCSRPEM=function(e){var t=dn(e,"CERTIFICATE REQUEST"),n=_t.getKeyFromCSRHex(t);return n};_t.getKeyFromCSRHex=function(e){var t=_t.parseCSRHex(e),n=_t.getKey(t.p8pubkeyhex,null,"pkcs8pub");return n};_t.parseCSRHex=function(e){var t=$e,n=t.getChildIdx,r=t.getTLV,i={},o=e;if(o.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var s=n(o,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if(o.substr(s[0],2)!="30")throw new Error("malformed CSR(code:003)");var a=n(o,s[0]);if(a.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=r(o,a[2]),i};_t.getKeyID=function(e){var t=_t,n=$e;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var r=dn(t.getPEM(e)),i=n.getIdxbyList(r,0,[1]),o=n.getV(r,i).substring(2);return A.crypto.Util.hashHex(o,"sha1")};_t.getJWK=function(e,t,n,r,i){var o,s={},a,u=A.crypto.Util.hashHex;if(typeof e=="string")o=_t.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(a=dn(e));else if(typeof e=="object")e instanceof tt?(o=e.getPublicKey(),a=e.hex):o=e;else throw new Error("unsupported keyinfo type");if(o instanceof at&&o.isPrivate)s.kty="RSA",s.n=Mn(o.n.toString(16)),s.e=Mn(o.e.toString(16)),s.d=Mn(o.d.toString(16)),s.p=Mn(o.p.toString(16)),s.q=Mn(o.q.toString(16)),s.dp=Mn(o.dmp1.toString(16)),s.dq=Mn(o.dmq1.toString(16)),s.qi=Mn(o.coeff.toString(16));else if(o instanceof at&&o.isPublic)s.kty="RSA",s.n=Mn(o.n.toString(16)),s.e=Mn(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 h=o.getPublicKeyXYHex();s.kty="EC",s.crv=l,s.x=Mn(h.x),s.y=Mn(h.y),s.d=Mn(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 h=o.getPublicKeyXYHex();s.kty="EC",s.crv=l,s.x=Mn(h.x),s.y=Mn(h.y)}if(s.kty==null)throw new Error("unsupported keyinfo");return!o.isPrivate&&t!=!0&&(s.kid=A.jws.JWS.getJWKthumbprint(s)),a!=null&&n!=!0&&(s.x5c=[ba(a)]),a!=null&&r!=!0&&(s.x5t=wf(ba(u(a,"sha1")))),a!=null&&i!=!0&&(s["x5t#S256"]=wf(ba(u(a,"sha256")))),s};_t.getJWKFromKey=function(e){return _t.getJWK(e,!0,!0,!0,!0)};at.getPosArrayOfChildrenFromHex=function(e){return $e.getChildIdx(e,0)};at.getHexValueArrayOfChildrenFromHex=function(e){var t=$e,n=t.getV,p=at.getPosArrayOfChildrenFromHex(e),r=n(e,p[0]),i=n(e,p[1]),o=n(e,p[2]),s=n(e,p[3]),a=n(e,p[4]),u=n(e,p[5]),l=n(e,p[6]),h=n(e,p[7]),m=n(e,p[8]),p=new Array;return p.push(r,i,o,s,a,u,l,h,m),p};at.prototype.readPrivateKeyFromPEMString=function(e){var t=dn(e),n=at.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])};at.prototype.readPKCS5PrvKeyHex=function(e){var t=at.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])};at.prototype.readPKCS8PrvKeyHex=function(e){var t,n,r,i,o,s,a,u,l=$e,h=l.getVbyListEx;if(l.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");try{t=h(e,0,[2,0,1],"02"),n=h(e,0,[2,0,2],"02"),r=h(e,0,[2,0,3],"02"),i=h(e,0,[2,0,4],"02"),o=h(e,0,[2,0,5],"02"),s=h(e,0,[2,0,6],"02"),a=h(e,0,[2,0,7],"02"),u=h(e,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,n,r,i,o,s,a,u)};at.prototype.readPKCS5PubKeyHex=function(e){var t=$e,n=t.getV;if(t.isASN1HEX(e)===!1)throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(e,0);if(r.length!==2||e.substr(r[0],2)!=="02"||e.substr(r[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var i=n(e,r[0]),o=n(e,r[1]);this.setPublic(i,o)};at.prototype.readPKCS8PubKeyHex=function(e){var t=$e;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 n=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(n)};at.prototype.readCertPubKeyHex=function(e,t){var n,r;n=new tt,n.readCertHex(e),r=n.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};var rde=new RegExp("[^0-9a-f]","gi");function oD(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n=n+"0";return n+e}at.prototype.sign=function(e,t){var n=function(i){return A.crypto.Util.hashString(i,t)},r=n(e);return this.signWithMessageHash(r,t)};at.prototype.signWithMessageHash=function(e,t){var n=A.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),r=gs(n,16),i=this.doPrivate(r),o=i.toString(16);return oD(o,this.n.bitLength())};function aD(e,t,n){for(var r="",i=0;r.length<t;)r+=ws(n(So(e+String.fromCharCode.apply(String,[(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return r}at.prototype.signPSS=function(e,t,n){var r=function(o){return A.crypto.Util.hashHex(o,t)},i=r(So(e));return n===void 0&&(n=-1),this.signWithMessageHashPSS(i,t,n)};at.prototype.signWithMessageHashPSS=function(e,t,n){var r=ws(e),i=r.length,o=this.n.bitLength()-1,s=Math.ceil(o/8),a,u=function(y){return A.crypto.Util.hashHex(y,t)};if(n===-1||n===void 0)n=i;else if(n===-2)n=s-i-2;else if(n<-2)throw new Error("invalid salt length");if(s<i+n+2)throw new Error("data too long");var l="";n>0&&(l=new Array(n),new Af().nextBytes(l),l=String.fromCharCode.apply(String,l));var h=ws(u(So("\0\0\0\0\0\0\0\0"+r+l))),m=[];for(a=0;a<s-n-i-2;a+=1)m[a]=0;var p=String.fromCharCode.apply(String,m)+""+l,d=aD(h,p.length,u),v=[];for(a=0;a<p.length;a+=1)v[a]=p.charCodeAt(a)^d.charCodeAt(a);var g=65280>>8*s-o&255;for(v[0]&=~g,a=0;a<i;a++)v.push(h.charCodeAt(a));return v.push(188),oD(this.doPrivate(new re(v)).toString(16),this.n.bitLength())};function uD(e){for(var t in A.crypto.Util.DIGESTINFOHEAD){var n=A.crypto.Util.DIGESTINFOHEAD[t],r=n.length;if(e.substring(0,r)==n){var i=[t,e.substring(r)];return i}}return[]}at.prototype.verify=function(e,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var n=gs(t,16),r=this.n.bitLength();if(n.bitLength()>r)return!1;var i=this.doPublic(n),o=i.toString(16);if(o.length+3!=r/4)return!1;var s=o.replace(/^1f+00/,""),a=uD(s);if(a.length==0)return!1;var u=a[0],l=a[1],h=function(p){return A.crypto.Util.hashString(p,u)},m=h(e);return l==m};at.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=gs(t,16);if(n.bitLength()>this.n.bitLength())return 0;var r=this.doPublic(n),i=r.toString(16).replace(/^1f+00/,""),o=uD(i);if(o.length==0)return!1;var s=o[0],a=o[1];return a==e};at.prototype.verifyPSS=function(e,t,n,r){var i=function(s){return A.crypto.Util.hashHex(s,n)},o=i(So(e));return r===void 0&&(r=-1),this.verifyWithMessageHashPSS(o,t,n,r)};at.prototype.verifyWithMessageHashPSS=function(e,t,n,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new re(t,16),o=function(E){return A.crypto.Util.hashHex(E,n)},s=ws(e),a=s.length,u=this.n.bitLength()-1,l=Math.ceil(u/8),h;if(r===-1||r===void 0)r=a;else if(r===-2)r=l-a-2;else if(r<-2)throw new Error("invalid salt length");if(l<a+r+2)throw new Error("data too long");var m=this.doPublic(i).toByteArray();for(h=0;h<m.length;h+=1)m[h]&=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=aD(d,p.length,o),y=[];for(h=0;h<p.length;h+=1)y[h]=p.charCodeAt(h)^g.charCodeAt(h);y[0]&=~v;var w=l-a-r-2;for(h=0;h<w;h+=1)if(y[h]!==0)throw new Error("leftmost octets not zero");if(y[w]!==1)throw new Error("0x01 marker not found");return d===ws(o(So("\0\0\0\0\0\0\0\0"+s+String.fromCharCode.apply(String,y.slice(-r)))))};at.SALT_LEN_HLEN=-1;at.SALT_LEN_MAX=-2;at.SALT_LEN_RECOVER=-2;function tt(e){var t=$e,n=t.getChildIdx,r=t.getV,i=t.dump,o=t.parse,s=t.getTLV,a=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,h=t.getTLVbyListEx,m=t.getIdxbyList,p=t.getIdxbyListEx,d=t.getVidx,v=t.getInt,g=t.oidname,y=t.hextooidstr,w=tt,E=dn,C,_=Error;try{C=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 S=l(this.hex,0,[0,0]);if(S.substr(0,2)=="a0"){var I=l(S,0,[0]),q=v(I,0);if(q<0||2<q)throw new Error("malformed version field");return this.version=q+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 S=h(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(S)},this.getAlgorithmIdentifierName=function(S){for(var I in C)if(S===C[I])return I;return g(u(S,0,[0],"06"))},this.getIssuer=function(S,I){return this.getX500Name(this.getIssuerHex(),S,I)},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var S=this.getIssuer();return S.str},this.getSubject=function(S,I){return this.getX500Name(this.getSubjectHex(),S,I)},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var S=this.getSubject();return S.str},this.getNotBefore=function(){var S=a(this.hex,0,[0,4+this.foffset,0]);return S=S.replace(/(..)/g,"%$1"),S=decodeURIComponent(S),S},this.getNotAfter=function(){var S=a(this.hex,0,[0,4+this.foffset,1]);return S=S.replace(/(..)/g,"%$1"),S=decodeURIComponent(S),S},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var S=this.getSPKI();return S==null?null:a(S,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return m(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var S=this.getPublicKeyIdx();return m(this.hex,S,[1,0],"30")},this.getPublicKey=function(){return _t.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var S=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(S)},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(S){var I=this.getSignatureAlgorithmField(),q=this.getSignatureValueHex(),L=l(this.hex,0,[0],"30"),T=new A.crypto.Signature({alg:I});return T.init(S),T.updateHex(L),T.verify(q)},this.parseExt=function(S){var I,q,L;if(S===void 0){if(L=this.hex,this.version!==3)return-1;I=m(L,0,[0,7,0],"30"),q=n(L,I)}else{L=dn(S);var T=m(L,0,[0,3,0,0],"06");if(r(L,T)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}I=m(L,0,[0,3,0,1,0],"30"),q=n(L,I),this.hex=L}this.aExtInfo=new Array;for(var O=0;O<q.length;O++){var R={};R.critical=!1;var N=n(L,q[O]),P=0;N.length===3&&(R.critical=!0,P=1),R.oid=t.hextooidstr(a(L,q[O],[0],"06"));var M=m(L,q[O],[1+P]);R.vidx=d(L,M),this.aExtInfo.push(R)}},this.getExtInfo=function(S){var I=this.aExtInfo,q=S;if(S.match(/^[0-9.]+$/)||(q=A.asn1.x509.OID.name2oid(S)),q!==""){for(var L=0;L<I.length;L++)if(I[L].oid===q)return I[L]}},this.getCriticalExtV=function(S,I,q){if(I!=null)return[I,q];var L=this.getExtInfo(S);return L==null?[null,null]:[s(this.hex,L.vidx),L.critical]},this.getExtBasicConstraints=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("basicConstraints");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"basicConstraints"};if(I&&(L.critical=!0),S==="3000")return L;if(S==="30030101ff")return L.cA=!0,L;if(S.substr(0,12)==="30060101ff02"){var T=r(S,10),O=parseInt(T,16);return L.cA=!0,L.pathLen=O,L}throw new Error("hExtV parse error: "+S)},this.getExtNameConstraints=function(S,I){var q=this.getCriticalExtV("nameConstraints",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"nameConstraints"};I&&(L.critical=!0);for(var T=n(S,0),O=0;O<T.length;O++){for(var R=[],N=n(S,T[O]),P=0;P<N.length;P++){var M=s(S,N[P]),Y=this.getGeneralSubtree(M);R.push(Y)}var V=S.substr(T[O],2);V=="a0"?L.permit=R:V=="a1"&&(L.exclude=R)}return L}},this.getGeneralSubtree=function(S){var I=n(S,0),q=I.length;if(q<1||2<q)throw new Error("wrong num elements");for(var L=this.getGeneralName(s(S,I[0])),T=1;T<q;T++){var O=S.substr(I[T],2),R=r(S,I[T]),N=parseInt(R,16);O=="80"&&(L.min=N),O=="81"&&(L.max=N)}return L},this.getExtKeyUsage=function(S,I){var q=this.getCriticalExtV("keyUsage",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"keyUsage"};return I&&(L.critical=!0),L.names=this.getExtKeyUsageString(S).split(","),L}},this.getExtKeyUsageBin=function(S){if(S===void 0){var I=this.getExtInfo("keyUsage");if(I===void 0)return"";S=s(this.hex,I.vidx)}if(S.length!=8&&S.length!=10)throw new Error("malformed key usage value: "+S);var q="000000000000000"+parseInt(S.substr(6),16).toString(2);return S.length==8&&(q=q.slice(-8)),S.length==10&&(q=q.slice(-16)),q=q.replace(/0+$/,""),q==""&&(q="0"),q},this.getExtKeyUsageString=function(S){for(var I=this.getExtKeyUsageBin(S),q=new Array,L=0;L<I.length;L++)I.substr(L,1)=="1"&&q.push(tt.KEYUSAGE_NAME[L]);return q.join(",")},this.getExtSubjectKeyIdentifier=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectKeyIdentifier");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectKeyIdentifier"};I&&(L.critical=!0);var T=r(S,0);return L.kid={hex:T},L},this.getExtAuthorityKeyIdentifier=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("authorityKeyIdentifier");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"authorityKeyIdentifier"};I&&(L.critical=!0);for(var T=n(S,0),O=0;O<T.length;O++){var R=S.substr(T[O],2);if(R==="80"&&(L.kid={hex:r(S,T[O])}),R==="a1"){var N=s(S,T[O]),P=this.getGeneralNames(N);L.issuer=P[0].dn}R==="82"&&(L.sn={hex:r(S,T[O])})}return L},this.getExtExtKeyUsage=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("extKeyUsage");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"extKeyUsage",array:[]};I&&(L.critical=!0);for(var T=n(S,0),O=0;O<T.length;O++)L.array.push(g(r(S,T[O])));return L},this.getExtExtKeyUsageName=function(){var S=this.getExtInfo("extKeyUsage");if(S===void 0)return S;var I=new Array,q=s(this.hex,S.vidx);if(q==="")return I;for(var L=n(q,0),T=0;T<L.length;T++)I.push(g(r(q,L[T])));return I},this.getExtSubjectAltName=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectAltName");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectAltName",array:[]};return I&&(L.critical=!0),L.array=this.getGeneralNames(S),L},this.getExtIssuerAltName=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("issuerAltName");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"issuerAltName",array:[]};return I&&(L.critical=!0),L.array=this.getGeneralNames(S),L},this.getGeneralNames=function(S){for(var I=n(S,0),q=[],L=0;L<I.length;L++){var T=this.getGeneralName(s(S,I[L]));T!==void 0&&q.push(T)}return q},this.getGeneralName=function(S){var I=S.substr(0,2),q=r(S,0),L=ws(q);if(I=="81")return{rfc822:L};if(I=="82")return{dns:L};if(I=="86")return{uri:L};if(I=="87")return{ip:hm(q)};if(I=="a4")return{dn:this.getX500Name(q)};if(I=="a0")return{other:this.getOtherName(S)}},this.getExtSubjectAltName2=function(){var S,I,q,L=this.getExtInfo("subjectAltName");if(L===void 0)return L;for(var T=new Array,O=s(this.hex,L.vidx),R=n(O,0),N=0;N<R.length;N++)q=O.substr(R[N],2),S=r(O,R[N]),q==="81"&&(I=Gt(S),T.push(["MAIL",I])),q==="82"&&(I=Gt(S),T.push(["DNS",I])),q==="84"&&(I=tt.hex2dn(S,0),T.push(["DN",I])),q==="86"&&(I=Gt(S),T.push(["URI",I])),q==="87"&&(I=hm(S),T.push(["IP",I]));return T},this.getExtCRLDistributionPoints=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("cRLDistributionPoints");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"cRLDistributionPoints",array:[]};I&&(L.critical=!0);for(var T=n(S,0),O=0;O<T.length;O++){var R=s(S,T[O]);L.array.push(this.getDistributionPoint(R))}return L},this.getDistributionPoint=function(S){for(var I={},q=n(S,0),L=0;L<q.length;L++){var T=S.substr(q[L],2),O=s(S,q[L]);T=="a0"&&(I.dpname=this.getDistributionPointName(O))}return I},this.getDistributionPointName=function(S){for(var I={},q=n(S,0),L=0;L<q.length;L++){var T=S.substr(q[L],2),O=s(S,q[L]);T=="a0"&&(I.full=this.getGeneralNames(O))}return I},this.getExtCRLDistributionPointsURI=function(){var S=this.getExtCRLDistributionPoints();if(S==null)return S;for(var I=S.array,q=[],L=0;L<I.length;L++)try{I[L].dpname.full[0].uri!=null&&q.push(I[L].dpname.full[0].uri)}catch{}return q},this.getExtAIAInfo=function(){var S=this.getExtInfo("authorityInfoAccess");if(S===void 0)return S;for(var I={ocsp:[],caissuer:[]},q=n(this.hex,S.vidx),L=0;L<q.length;L++){var T=a(this.hex,q[L],[0],"06"),O=a(this.hex,q[L],[1],"86");T==="2b06010505073001"&&I.ocsp.push(Gt(O)),T==="2b06010505073002"&&I.caissuer.push(Gt(O))}return I},this.getExtAuthorityInfoAccess=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("authorityInfoAccess");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"authorityInfoAccess",array:[]};I&&(L.critical=!0);for(var T=n(S,0),O=0;O<T.length;O++){var R=u(S,T[O],[0],"06"),N=a(S,T[O],[1],"86"),P=Gt(N);if(R=="2b06010505073001")L.array.push({ocsp:P});else if(R=="2b06010505073002")L.array.push({caissuer:P});else throw new Error("unknown method: "+R)}return L},this.getExtCertificatePolicies=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("certificatePolicies");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"certificatePolicies",array:[]};I&&(L.critical=!0);for(var T=n(S,0),O=0;O<T.length;O++){var R=s(S,T[O]),N=this.getPolicyInformation(R);L.array.push(N)}return L},this.getPolicyInformation=function(S){var I={},q=a(S,0,[0],"06");I.policyoid=g(q);var L=p(S,0,[1],"30");if(L!=-1){I.array=[];for(var T=n(S,L),O=0;O<T.length;O++){var R=s(S,T[O]),N=this.getPolicyQualifierInfo(R);I.array.push(N)}}return I},this.getOtherName=function(S){var I={},q=n(S,0),L=a(S,q[0],[],"06"),T=a(S,q[1],[]);return I.oid=g(L),I.value=o(T),I},this.getPolicyQualifierInfo=function(S){var I={},q=a(S,0,[0],"06");if(q==="2b06010505070201"){var L=u(S,0,[1],"16");I.cps=ws(L)}else if(q==="2b06010505070202"){var T=l(S,0,[1],"30");I.unotice=this.getUserNotice(T)}return I},this.getUserNotice=function(S){var I=null,q={};try{I=t.parse(S);var L=this._asn1ToUnotice(I);return L}catch{return}},this._asn1ToUnotice=function(S){try{for(var I={},q=Qt(S,"seq"),L=0;L<q.length;L++){var T=this._asn1ToNoticeRef(q[L]);T!=null&&(I.noticeref=T);var O=this.asn1ToDisplayText(q[L]);O!=null&&(I.exptext=O)}return Object.keys(I).length>0?I:void 0}catch{return}},this._asn1ToNoticeRef=function(S){try{for(var I={},q=Qt(S,"seq"),L=0;L<q.length;L++){var T=this._asn1ToNoticeNum(q[L]);T!=null&&(I.noticenum=T);var O=this.asn1ToDisplayText(q[L]);O!=null&&(I.org=O)}return Object.keys(I).length>0?I:void 0}catch{return}},this._asn1ToNoticeNum=function(S){try{for(var I=Qt(S,"seq"),q=[],L=0;L<I.length;L++){var T=I[L];q.push(parseInt(Qt(T,"int.hex"),16))}return q}catch{return}},this.getDisplayText=function(S){var I={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},q={};return q.type=I[S.substr(0,2)],q.str=ws(r(S,0)),q},this.asn1ToDisplayText=function(S){if(S.utf8str!=null)return{type:"utf8",str:S.utf8str.str};if(S.ia5str!=null)return{type:"ia5",str:S.ia5str.str};if(S.visstr!=null)return{type:"vis",str:S.visstr.str};if(S.bmpstr!=null)return{type:"bmp",str:S.bmpstr.str};if(S.prnstr!=null)return{type:"prn",str:S.prnstr.str}},this.getExtPolicyMappings=function(S,I){var q=this.getCriticalExtV("policyMappings",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"policyMappings"};I&&(L.critical=!0);try{for(var T=o(S),O=T.seq,R=[],N=0;N<O.length;N++){var P=O[N].seq;R.push([P[0].oid,P[1].oid])}L.array=R}catch{throw new _("malformed policyMappings")}return L}},this.getExtPolicyConstraints=function(S,I){var q=this.getCriticalExtV("policyConstraints",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"policyConstraints"};I&&(L.critical=!0);var T=o(S);try{for(var O=T.seq,R=0;R<O.length;R++){var N=O[R].tag;N.explicit==!1&&(N.tag=="80"&&(L.reqexp=parseInt(N.hex,16)),N.tag=="81"&&(L.inhibit=parseInt(N.hex,16)))}}catch{return new _("malformed policyConstraints value")}return L}},this.getExtInhibitAnyPolicy=function(S,I){var q=this.getCriticalExtV("inhibitAnyPolicy",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"inhibitAnyPolicy"};I&&(L.critical=!0);var T=v(S,0);return T==-1?new _("wrong value"):(L.skip=T,L)}},this.getExtCRLNumber=function(S,I){var q={extname:"cRLNumber"};if(I&&(q.critical=!0),S.substr(0,2)=="02")return q.num={hex:r(S,0)},q;throw new _("hExtV parse error: "+S)},this.getExtCRLReason=function(S,I){var q={extname:"cRLReason"};if(I&&(q.critical=!0),S.substr(0,2)=="0a")return q.code=parseInt(r(S,0),16),q;throw new Error("hExtV parse error: "+S)},this.getExtOcspNonce=function(S,I){var q={extname:"ocspNonce"};I&&(q.critical=!0);var L=r(S,0);return q.hex=L,q},this.getExtOcspNoCheck=function(S,I){var q={extname:"ocspNoCheck"};return I&&(q.critical=!0),q},this.getExtAdobeTimeStamp=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("adobeTimeStamp");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"adobeTimeStamp"};I&&(L.critical=!0);var T=n(S,0);if(T.length>1){var O=s(S,T[1]),R=this.getGeneralName(O);R.uri!=null&&(L.uri=R.uri)}if(T.length>2){var N=s(S,T[2]);N=="0101ff"&&(L.reqauth=!0),N=="010100"&&(L.reqauth=!1)}return L},this.getExtSubjectDirectoryAttributes=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectDirectoryAttributes");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectDirectoryAttributes"};I&&(L.critical=!0);try{for(var T=o(S),O=[],R=0;R<T.seq.length;R++){var N=T.seq[R],P=Qt(N,"seq.0.oid"),M=Qt(N,"seq.1.set");if(P==null||M==null)throw"error";O.push({attr:P,array:M})}return L.array=O,L}catch{throw new Error("malformed subjectDirectoryAttributes extension value")}};var F=function(S){var I={};try{var q=S.seq[0].oid,L=A.asn1.x509.OID.name2oid(q);I.type=A.asn1.x509.OID.oid2atype(L);var T=S.seq[1];if(T.utf8str!=null)I.ds="utf8",I.value=T.utf8str.str;else if(T.numstr!=null)I.ds="num",I.value=T.numstr.str;else if(T.telstr!=null)I.ds="tel",I.value=T.telstr.str;else if(T.prnstr!=null)I.ds="prn",I.value=T.prnstr.str;else if(T.ia5str!=null)I.ds="ia5",I.value=T.ia5str.str;else if(T.visstr!=null)I.ds="vis",I.value=T.visstr.str;else if(T.bmpstr!=null)I.ds="bmp",I.value=T.bmpstr.str;else throw"error";return I}catch{throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},H=function(S){try{return S.set.map(function(I){return F(I)})}catch(I){throw new Error("improper ASN.1 parsed RDN: "+I)}},K=function(S){try{return S.seq.map(function(I){return H(I)})}catch(I){throw new Error("improper ASN.1 parsed X500Name: "+I)}};this.getX500NameRule=function(S){for(var I=!0,q=!0,L=!1,T="",O="",R=null,N=[],P=0;P<S.length;P++)for(var M=S[P],Y=0;Y<M.length;Y++)N.push(M[Y]);for(var P=0;P<N.length;P++){var V=N[P],X=V.ds,te=V.value,ae=V.type;if(T+=":"+X,X!="prn"&&X!="utf8"&&X!="ia5")return"mixed";if(X=="ia5"){if(ae!="CN")return"mixed";if(A.lang.String.isMail(te))continue;return"mixed"}if(ae=="C"){if(X=="prn")continue;return"mixed"}if(O+=":"+X,R==null)R=X;else if(R!==X)return"mixed"}return R??"prn"},this.getAttrTypeAndValue=function(S){var I=o(S);return F(I)},this.getRDN=function(S){var I=o(S);return H(I)},this.getX500NameArray=function(S){var I=o(S);return K(I)},this.getX500Name=function(S,I,q){var L=this.getX500NameArray(S),T=this.dnarraytostr(L),O={str:T};return O.array=L,q==!0&&(O.hex=S),I==!0&&(O.canon=this.c14nRDNArray(L)),O},this.readCertPEM=function(S){this.readCertHex(E(S))},this.readCertHex=function(S){this.hex=S,this.getVersion();try{m(this.hex,0,[0,7],"a3"),this.parseExt()}catch{}},this.getParam=function(S){var I={};return S==null&&(S={}),I.version=this.getVersion(),I.serial={hex:this.getSerialNumberHex()},I.sigalg=this.getSignatureAlgorithmField(),I.issuer=this.getIssuer(S.dncanon,S.dnhex),I.notbefore=this.getNotBefore(),I.notafter=this.getNotAfter(),I.subject=this.getSubject(S.dncanon,S.dnhex),I.sbjpubkey=xr(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo!=null&&this.aExtInfo.length>0&&(I.ext=this.getExtParamArray()),I.sighex=this.getSignatureValueHex(),S.tbshex==!0&&(I.tbshex=l(this.hex,0,[0])),S.nodnarray==!0&&(delete I.issuer.array,delete I.subject.array),I},this.getExtParamArray=function(S){if(S==null){var I=p(this.hex,0,[0,"[3]"]);I!=-1&&(S=h(this.hex,0,[0,"[3]",0],"30"))}for(var q=[],L=n(S,0),T=0;T<L.length;T++){var O=s(S,L[T]),R=this.getExtParam(O);R!=null&&q.push(R)}return q},this.getExtParam=function(S){var I={},q=n(S,0),L=q.length;if(L!=2&&L!=3)throw new Error("wrong number elements in Extension: "+L+" "+S);var T=y(a(S,0,[0],"06")),O=!1;L==3&&l(S,0,[1])=="0101ff"&&(O=!0);var R=l(S,0,[L-1,0]),N=void 0;if(T=="2.5.29.14"?N=this.getExtSubjectKeyIdentifier(R,O):T=="2.5.29.15"?N=this.getExtKeyUsage(R,O):T=="2.5.29.17"?N=this.getExtSubjectAltName(R,O):T=="2.5.29.18"?N=this.getExtIssuerAltName(R,O):T=="2.5.29.19"?N=this.getExtBasicConstraints(R,O):T=="2.5.29.30"?N=this.getExtNameConstraints(R,O):T=="2.5.29.31"?N=this.getExtCRLDistributionPoints(R,O):T=="2.5.29.32"?N=this.getExtCertificatePolicies(R,O):T=="2.5.29.33"?N=this.getExtPolicyMappings(R,O):T=="2.5.29.35"?N=this.getExtAuthorityKeyIdentifier(R,O):T=="2.5.29.36"?N=this.getExtPolicyConstraints(R,O):T=="2.5.29.37"?N=this.getExtExtKeyUsage(R,O):T=="2.5.29.54"?N=this.getExtInhibitAnyPolicy(R,O):T=="1.3.6.1.5.5.7.1.1"?N=this.getExtAuthorityInfoAccess(R,O):T=="2.5.29.20"?N=this.getExtCRLNumber(R,O):T=="2.5.29.21"?N=this.getExtCRLReason(R,O):T=="2.5.29.9"?N=this.getExtSubjectDirectoryAttributes(R,O):T=="1.3.6.1.5.5.7.48.1.2"?N=this.getExtOcspNonce(R,O):T=="1.3.6.1.5.5.7.48.1.5"?N=this.getExtOcspNoCheck(R,O):T=="1.2.840.113583.1.1.9.1"?N=this.getExtAdobeTimeStamp(R,O):tt.EXT_PARSER[T]!=null&&(N=tt.EXT_PARSER[T](T,O,R)),N!=null)return N;var P={extname:T,extn:R};try{P.extn=o(R)}catch{}return O&&(P.critical=!0),P},this.findExt=function(S,I){for(var q=0;q<S.length;q++)if(S[q].extname==I)return S[q];return null},this.updateExtCDPFullURI=function(S,I){var q=this.findExt(S,"cRLDistributionPoints");if(q!=null&&q.array!=null){for(var L=q.array,T=0;T<L.length;T++)if(L[T].dpname!=null&&L[T].dpname.full!=null)for(var O=L[T].dpname.full,R=0;R<O.length;R++){var N=O[T];N.uri!=null&&(N.uri=I)}}},this.updateExtAIAOCSP=function(S,I){var q=this.findExt(S,"authorityInfoAccess");if(q!=null&&q.array!=null)for(var L=q.array,T=0;T<L.length;T++)L[T].ocsp!=null&&(L[T].ocsp=I)},this.updateExtAIACAIssuer=function(S,I){var q=this.findExt(S,"authorityInfoAccess");if(q!=null&&q.array!=null)for(var L=q.array,T=0;T<L.length;T++)L[T].caissuer!=null&&(L[T].caissuer=I)},this.dnarraytostr=function(S){function I(L){return L.map(function(T){return q(T).replace(/\+/,"\\+")}).join("+")}function q(L){return L.type+"="+L.value}return"/"+S.map(function(L){return I(L).replace(/\//,"\\/")}).join("/")},this.setCanonicalizedDN=function(S){var I;if(S.str!=null&&S.array==null){var q=new A.asn1.x509.X500Name({str:S.str}),L=q.tohex();I=this.getX500NameArray(L)}else I=S.array;S.canon==null&&(S.canon=this.c14nRDNArray(I))},this.c14nRDNArray=function(S){for(var I=[],q=0;q<S.length;q++){for(var L=S[q],T=[],O=0;O<L.length;O++){var R=L[O],N=R.value;N=N.replace(/^\s*/,""),N=N.replace(/\s*$/,""),N=N.replace(/\s+/g," "),N=N.toLowerCase(),T.push(R.type.toLowerCase()+"="+N)}I.push(T.join("+"))}return"/"+I.join("/")},this.getInfo=function(){var S=function(pe){for(var Fe="",Re=" ",Ve=`
`,Oe=pe.array,pt=0;pt<Oe.length;pt++){var Qe=Oe[pt];if(Qe.dn!=null&&(Fe+=Re+"dn: "+Qe.dn.str+Ve),Qe.ip!=null&&(Fe+=Re+"ip: "+Qe.ip+Ve),Qe.rfc822!=null&&(Fe+=Re+"rfc822: "+Qe.rfc822+Ve),Qe.dns!=null&&(Fe+=Re+"dns: "+Qe.dns+Ve),Qe.uri!=null&&(Fe+=Re+"uri: "+Qe.uri+Ve),Qe.other!=null){var ct=Qe.other.oid,gr=JSON.stringify(Qe.other.value).replace(/\"/g,"");Fe+=Re+"other: "+ct+"="+gr+Ve}}return Fe=Fe.replace(/\n$/,""),Fe},I=function(pe){for(var Fe="",Re=pe.array,Ve=0;Ve<Re.length;Ve++){var Oe=Re[Ve];if(Fe+=" policy oid: "+Oe.policyoid+`
`,Oe.array!==void 0)for(var pt=0;pt<Oe.array.length;pt++){var Qe=Oe.array[pt];Qe.cps!==void 0&&(Fe+=" cps: "+Qe.cps+`
`)}}return Fe},q=function(pe){for(var Fe="",Re=pe.array,Ve=0;Ve<Re.length;Ve++){var Oe=Re[Ve];try{Oe.dpname.full[0].uri!==void 0&&(Fe+=" "+Oe.dpname.full[0].uri+`
`)}catch{}try{Oe.dname.full[0].dn.hex!==void 0&&(Fe+=" "+tt.hex2dn(Oe.dpname.full[0].dn.hex)+`
`)}catch{}}return Fe},L=function(pe){for(var Fe="",Re=pe.array,Ve=0;Ve<Re.length;Ve++){var Oe=Re[Ve];Oe.caissuer!==void 0&&(Fe+=" caissuer: "+Oe.caissuer+`
`),Oe.ocsp!==void 0&&(Fe+=" ocsp: "+Oe.ocsp+`
`)}return Fe},T=tt,O,R,N;if(O=`Basic Fields
`,O+=" serial number: "+this.getSerialNumberHex()+`
`,O+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
`,O+=" issuer: "+this.getIssuerString()+`
`,O+=" notBefore: "+this.getNotBefore()+`
`,O+=" notAfter: "+this.getNotAfter()+`
`,O+=" subject: "+this.getSubjectString()+`
`,O+=` subject public key info:
`,R=this.getPublicKey(),O+=" key algorithm: "+R.type+`
`,R.type==="RSA"&&(O+=" n="+sE(R.n.toString(16)).substr(0,16)+`...
`,O+=" e="+sE(R.e.toString(16))+`
`),N=this.aExtInfo,N!=null){O+=`X509v3 Extensions:
`;for(var P=0;P<N.length;P++){var M=N[P],Y=A.asn1.x509.OID.oid2name(M.oid);Y===""&&(Y=M.oid);var V="";if(M.critical===!0&&(V="CRITICAL"),O+=" "+Y+" "+V+`:
`,Y==="basicConstraints"){var X=this.getExtBasicConstraints();X.cA===void 0?O+=` {}
`:(O+=" cA=true",X.pathLen!==void 0&&(O+=", pathLen="+X.pathLen),O+=`
`)}else if(Y=="policyMappings"){var te=this.getExtPolicyMappings().array,ae=te.map(function(pe){var Fe=pe;return Fe[0]+":"+Fe[1]}).join(", ");O+=" "+ae+`
`}else if(Y=="policyConstraints"){var me=this.getExtPolicyConstraints();O+=" ",me.reqexp!=null&&(O+=" reqexp="+me.reqexp),me.inhibit!=null&&(O+=" inhibit="+me.inhibit),O+=`
`}else if(Y=="inhibitAnyPolicy"){var me=this.getExtInhibitAnyPolicy();O+=" skip="+me.skip+`
`}else if(Y=="keyUsage")O+=" "+this.getExtKeyUsageString()+`
`;else if(Y=="subjectKeyIdentifier")O+=" "+this.getExtSubjectKeyIdentifier().kid.hex+`
`;else if(Y=="authorityKeyIdentifier"){var he=this.getExtAuthorityKeyIdentifier();he.kid!==void 0&&(O+=" kid="+he.kid.hex+`
`)}else if(Y=="extKeyUsage"){var De=this.getExtExtKeyUsage().array;O+=" "+De.join(", ")+`
`}else if(Y=="subjectAltName"){var Pe=S(this.getExtSubjectAltName());O+=Pe+`
`}else if(Y=="cRLDistributionPoints"){var Ie=this.getExtCRLDistributionPoints();O+=q(Ie)}else if(Y=="authorityInfoAccess"){var se=this.getExtAuthorityInfoAccess();O+=L(se)}else Y=="certificatePolicies"&&(O+=I(this.getExtCertificatePolicies()))}}return O+="signature algorithm: "+this.getSignatureAlgorithmName()+`
`,O+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
`,O},typeof e=="string"&&(e.indexOf("-----BEGIN")!=-1?this.readCertPEM(e):A.lang.String.isHex(e)&&this.readCertHex(e))}tt.EXT_PARSER={};tt.registExtParser=function(e,t){tt.EXT_PARSER[e]=t};tt.hex2dn=function(e,t){t===void 0&&(t=0);var n=new tt,r=$e.getTLV(e,t),i=n.getX500Name(e);return i.str};tt.hex2rdn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="31")throw new Error("malformed RDN");for(var n=new Array,r=$e.getChildIdx(e,t),i=0;i<r.length;i++)n.push(tt.hex2attrTypeValue(e,r[i]));return n=n.map(function(o){return o.replace("+","\\+")}),n.join("+")};tt.hex2attrTypeValue=function(e,t){var n=$e,r=n.getV;if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var i=n.getChildIdx(e,t);i.length!==2||e.substr(i[0],2);var o=r(e,i[0]),s=A.asn1.ASN1Util.oidHexToInt(o),a=A.asn1.x509.OID.oid2atype(s),u=r(e,i[1]),l=ws(u);return a+"="+l};tt.getPublicKeyFromCertHex=function(e){var t=new tt;return t.readCertHex(e),t.getPublicKey()};tt.getPublicKeyFromCertPEM=function(e){var t=new tt;return t.readCertPEM(e),t.getPublicKey()};tt.getPublicKeyInfoPropOfCertPEM=function(e){var t=$e,n=t.getVbyList,r={},i,o,s;return r.algparam=null,i=new tt,i.readCertPEM(e),o=i.getPublicKeyHex(),r.keyhex=n(o,0,[1],"03").substr(2),r.algoid=n(o,0,[0,0],"06"),r.algoid==="2a8648ce3d0201"&&(r.algparam=n(o,0,[0,1],"06")),r};tt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var pG=function(e){var t=A,n=t.lang.String.isHex,r=$e,i=r.getV,o=r.getTLV,s=r.getVbyList,a=r.getTLVbyList,u=r.getTLVbyListEx,l=r.getIdxbyList,h=r.getIdxbyListEx,m=r.getChildIdx,p=new tt;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(s(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=s(this.hex,0,[0,this.posSigAlg+2]);return result=ws(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:ws(i(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:s(d,0,[0],"02")},v.date=ws(s(d,0,[1])),g.length==3&&(v.ext=p.getExtParamArray(a(d,0,[2]))),v},this.findRevCert=function(d){var v=new tt(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 s(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=h(this.hex,0,[0,"[0]"]);if(E!=-1){var C=u(this.hex,0,[0,"[0]",0]);v.ext=p.getExtParamArray(C)}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"&&(n(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=dn(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,n=t.isSafeJSONString;this.parseJWS=function(r,i){if(!(this.parsedJWS!==void 0&&(i||this.parsedJWS.sigvalH!==void 0))){var o=r.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(o==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var s=o[1],a=o[2],u=o[3],l=s+"."+a;if(this.parsedJWS={},this.parsedJWS.headB64U=s,this.parsedJWS.payloadB64U=a,this.parsedJWS.sigvalB64U=u,this.parsedJWS.si=l,!i){var h=rn(u),m=gs(h,16);this.parsedJWS.sigvalH=h,this.parsedJWS.sigvalBI=m}var p=Oi(s),d=Oi(a);if(this.parsedJWS.headS=p,this.parsedJWS.payloadS=d,!n(p,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+p}}};A.jws.JWS.sign=function(e,t,n,r,i){var o=A,s=o.jws,a=s.JWS,u=a.readSafeJSONString,l=a.isSafeJSONString,h=o.crypto,m=h.ECDSA,p=h.Mac,d=h.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=n,typeof n=="object"&&(w=v.stringify(n)),(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 C=Fd(g),_=Fd(w),F=C+"."+_,H="";if(E.substr(0,4)=="Hmac"){if(r===void 0)throw"mac key shall be specified for HS* alg";var K=new p({alg:E,prov:"cryptojs",pass:r});K.updateString(F),H=K.doFinal()}else if(E.indexOf("withECDSA")!=-1){var S=new d({alg:E});S.init(r,i),S.updateString(F);var I=S.sign();H=A.crypto.ECDSA.asn1SigToConcatSig(I)}else if(E!="none"){var S=new d({alg:E});S.init(r,i),S.updateString(F),H=S.sign()}var q=Mn(H);return F+"."+q};A.jws.JWS.verify=function(e,t,n){var r=A,i=r.jws,o=i.JWS,s=o.readSafeJSONString,a=r.crypto,u=a.ECDSA,l=a.Mac,h=a.Signature,m;if(typeof at!==void 0&&(m=at),!dE(e))return!1;var p=e.split(".");if(p.length!==3)return!1;var d=p[0],v=p[1],g=d+"."+v,y=rn(p[2]),w=s(Oi(p[0])),E=null,C=null;if(w.alg===void 0)throw"algorithm not specified in header";if(E=w.alg,C=E.substr(0,2),n!=null&&Object.prototype.toString.call(n)==="[object Array]"&&n.length>0){var _=":"+n.join(":")+":";if(_.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=_t.getKey(t)),(C=="RS"||C=="PS")&&!(t instanceof m))throw"key shall be a RSAKey obj for RS* and PS* algs";if(C=="ES"&&!(t instanceof u))throw"key shall be a ECDSA obj for ES* algs";E=="none";var F=null;if(o.jwsalg2sigalg[w.alg]===void 0)throw new Error("unsupported alg name: "+E);if(F=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(F=="none")throw new Error("not supported");if(F.substr(0,4)=="Hmac"){var S=null;if(t===void 0)throw new Error("hexadecimal key shall be specified for HMAC");var I=new l({alg:F,pass:t});return I.updateString(g),S=I.doFinal(),Q8(y,S)}else if(F.indexOf("withECDSA")!=-1){var q=null;try{q=u.concatSigToASN1Sig(y)}catch{return!1}var L=new h({alg:F});return L.init(t),L.updateString(g),L.verify(q)}else{var L=new h({alg:F});return L.init(t),L.updateString(g),L.verify(y)}};A.jws.JWS.parse=function(e){var t=e.split("."),n={},r,i,o;if(t.length!=2&&t.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return r=t[0],i=t[1],t.length==3&&(o=t[2]),n.headerObj=A.jws.JWS.readSafeJSONString(Oi(r)),n.payloadObj=A.jws.JWS.readSafeJSONString(Oi(i)),n.headerPP=JSON.stringify(n.headerObj,null," "),n.payloadObj==null?n.payloadPP=Oi(i):n.payloadPP=JSON.stringify(n.payloadObj,null," "),o!==void 0&&(n.sigHex=rn(o)),n};A.jws.JWS.verifyJWT=function(e,t,n){var r=A,i=r.jws,o=i.JWS,s=o.readSafeJSONString,a=o.inArray,u=o.includedArray;if(!dE(e))return!1;var l=e.split(".");if(l.length!=3)return!1;var h=l[0],m=l[1],p=h+"."+m,d=rn(l[2]),v=s(Oi(h)),g=s(Oi(m));if(v.alg===void 0)return!1;if(n.alg===void 0)throw"acceptField.alg shall be specified";if(!a(v.alg,n.alg)||g.iss!==void 0&&typeof n.iss=="object"&&!a(g.iss,n.iss)||g.sub!==void 0&&typeof n.sub=="object"&&!a(g.sub,n.sub))return!1;if(g.aud!==void 0&&typeof n.aud=="object"){if(typeof g.aud=="string"){if(!a(g.aud,n.aud))return!1}else if(typeof g.aud=="object"&&!u(g.aud,n.aud))return!1}var y=i.IntDate.getNow();return n.verifyAt!==void 0&&typeof n.verifyAt=="number"&&(y=n.verifyAt),(n.gracePeriod===void 0||typeof n.gracePeriod!="number")&&(n.gracePeriod=0),!(g.exp!==void 0&&typeof g.exp=="number"&&g.exp+n.gracePeriod<y||g.nbf!==void 0&&typeof g.nbf=="number"&&y<g.nbf-n.gracePeriod||g.iat!==void 0&&typeof g.iat=="number"&&y<g.iat-n.gracePeriod||g.jti!==void 0&&n.jti!==void 0&&g.jti!==n.jti||!o.verify(e,t,n.alg))};A.jws.JWS.includedArray=function(e,t){var n=A.jws.JWS.inArray;if(e===null||typeof e!="object"||typeof e.length!="number")return!1;for(var r=0;r<e.length;r++)if(!n(e[r],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 n=0;n<t.length;n++)if(t[n]==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,n){var r=null;try{return r=G8(e),typeof r!="object"||r.constructor===Array?0:(t&&(t[n]=r),1)}catch{return 0}};A.jws.JWS.readSafeJSONString=function(e){var t=null;try{return t=G8(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 n=So(t),r=A.crypto.Util.hashHex(n,"sha256"),i=Mn(r);return i};A.jws.IntDate={};A.jws.IntDate.get=function(e){var t=A.jws.IntDate,n=t.getNow,r=t.getZulu;if(e=="now")return n();if(e=="now + 1hour")return n()+3600;if(e=="now + 1day")return n()+3600*24;if(e=="now + 1month")return n()+3600*24*30;if(e=="now + 1year")return n()+3600*24*365;if(e.match(/Z$/))return r(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e};A.jws.IntDate.getZulu=function(e){return X8(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),n=("0000"+t.getUTCFullYear()).slice(-4),r=("00"+(t.getUTCMonth()+1)).slice(-2),i=("00"+t.getUTCDate()).slice(-2),o=("00"+t.getUTCHours()).slice(-2),s=("00"+t.getUTCMinutes()).slice(-2),a=("00"+t.getUTCSeconds()).slice(-2);return n+r+i+o+s+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,n=t.JWS,r=n.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(i){this.init();var o=i.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(i,o,s,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(i,o,this.sPayload,s,a),h=l.split("."),m=h[0],p=h[2];this.aHeader.push(h[0]),this.aSignature.push(h[2])}catch(d){throw this.aHeader.length>u&&this.aHeader.pop(),this.aSignature.length>u&&this.aSignature.pop(),"addSignature failed: "+d}},this.verifyAll=function(i){if(this.aHeader.length!==i.length||this.aSignature.length!==i.length)return!1;for(var o=0;o<i.length;o++){var s=i[o];if(s.length!==2)return!1;var a=this.verifyNth(o,s[0],s[1]);if(a===!1)return!1}return!0},this.verifyNth=function(i,o,s){if(this.aHeader.length<=i||this.aSignature.length<=i)return!1;var a=this.aHeader[i],u=this.aSignature[i],l=a+"."+this.sPayload+"."+u,h=!1;try{h=n.verify(l,o,s)}catch{return!1}return h},this.readJWSJS=function(i){if(typeof i=="string"){var o=r(i);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(i.headers.length>0)this.aHeader=i.headers;else throw"malformed header";if(typeof i.payload=="string")this.sPayload=i.payload;else throw"malformed signatures";if(i.signatures.length>0)this.aSignature=i.signatures;else throw"malformed signatures"}catch(s){throw"malformed JWS-JS JSON object: "+s}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return this.aHeader.length==0?1:0}};xe.SecureRandom=Af;xe.rng_seed_time=uE;xe.BigInteger=re;xe.RSAKey=at;xe.ECDSA=A.crypto.ECDSA;xe.DSA=A.crypto.DSA;xe.Signature=A.crypto.Signature;xe.MessageDigest=A.crypto.MessageDigest;xe.Mac=A.crypto.Mac;xe.KEYUTIL=_t;xe.ASN1HEX=$e;xe.X509=tt;xe.X509CRL=pG;xe.CryptoJS=ke;xe.b64tohex=yf;xe.b64toBA=M8;xe.ECFieldElementFp=qn;xe.ECPointFp=Nt;xe.ECCurveFp=Aa;xe.stoBA=z8;xe.BAtos=W8;xe.BAtohex=vm;xe.stohex=vs;xe.stob64=WV;xe.stob64u=YV;xe.b64utos=XV;xe.b64tob64u=wf;xe.b64utob64=Id;xe.hex2b64=ba;xe.hextob64u=Mn;xe.b64utohex=rn;xe.utf8tob64u=Fd;xe.b64utoutf8=Oi;xe.utf8tob64=ZV;xe.b64toutf8=JV;xe.utf8tohex=wm;xe.hextoutf8=Gt;xe.hextorstr=ws;xe.rstrtohex=So;xe.hextob64=cE;xe.hextob64nl=tG;xe.b64nltohex=Y8;xe.hextopem=xr;xe.pemtohex=dn;xe.hextoArrayBuffer=sG;xe.ArrayBuffertohex=iG;xe.zulutomsec=lE;xe.msectozulu=oG;xe.zulutosec=X8;xe.zulutodate=aG;xe.datetozulu=uG;xe.uricmptohex=Em;xe.hextouricmp=bm;xe.ipv6tohex=nE;xe.hextoipv6=rE;xe.hextoip=hm;xe.iptohex=fE;xe.ucs2hextoutf8=hE;xe.encodeURIComponentAll=Am;xe.newline_toUnix=cG;xe.newline_toDos=lG;xe.hextoposhex=sE;xe.intarystrtohex=fG;xe.strdiffidx=hG;xe.oidtohex=tD;xe.hextooid=Sm;xe.strpad=dm;xe.bitstrtoint=rD;xe.inttobitstr=sD;xe.bitstrtobinstr=iD;xe.binstrtobitstr=dG;xe.isBase64URLDot=dE;xe.namearraytobinstr=pm;xe.extendClass=Ee;xe.foldnl=ym;xe.b64topem=nG;xe.pemtob64=rG;xe.timeogen=Z8;xe.aryval=Qt;xe.inttohex=nD;xe.twoscompl=$d;xe.timingSafeEqual=Q8;xe.timingSafeEqualImpl=eD;xe.KJUR=A;xe.crypto=A.crypto;xe.asn1=A.asn1;xe.jws=A.jws;xe.lang=A.lang;xe.VERSION=Sj;xe.VERSION_FULL=Cj});var lI=be(uA=>{"use strict";var Jme=B(x());uA.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};uA.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 fI=be(cA=>{"use strict";var ege=B(x());cA.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};cA.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 hI=be(lA=>{"use strict";var nge=B(x());lA.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};lA.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 dI=be(fA=>{"use strict";var sge=B(x());fA.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};fA.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 pI=be(hA=>{"use strict";var oge=B(x());hA.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}`};hA.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 vI=be((gI,dA)=>{var age=B(x()),mI=(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=m,e.encode=h,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}$/,n=4,r=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,o={name:"v4",size:n,isFormat:p=>t.test(p),encode(p,d,v){v=~~v,d=d||new Uint8Array(v+n);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 s={name:"v6",size:i,isFormat:p=>p.length>0&&r.test(p),encode(p,d,v){v=~~v;let g=v+i,y=-1,w=0,E=0,C=!0,_=!1;d=d||new Uint8Array(v+i);for(let F=0;F<p.length;F++){let H=p.charCodeAt(F);H===58?(C?y!==-1?(v<g&&(d[v]=0),v<g-1&&(d[v+1]=0),v+=2):v<g&&(y=v):(_===!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),C=!0,_=!1):H===46?(v<g&&(d[v]=E),v++,E=0,w=0,C=!1,_=!0):(C=!1,H>=97?H-=87:H>=65?H-=55:(H-=48,E=E*10+H),w=(w<<4)+H)}if(C===!1)_===!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 F=Math.min(v-1,g-1);F>=y+2;F--)d[F]=d[F-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<i;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=s;let a="ip";e.name=a;function u(p){if(o.isFormat(p))return o.size;if(s.isFormat(p))return s.size;throw Error(`Invalid ip address: ${p}`)}function l(p){return u(p)===o.size?1:2}function h(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):s.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===s.size)return s.decode(p,d,v);throw Error(`Invalid buffer size needs to be ${o.size} for v4 or ${s.size} for v6.`)}return"default"in e?e.default:e})({});typeof define=="function"&&define.amd?define([],function(){return mI}):typeof dA=="object"&&typeof gI=="object"&&(dA.exports=mI)});var EI=be(Ye=>{"use strict";var cge=B(x()),Xe=wa().Buffer,Va=lI(),cY=fI(),lY=hI(),kg=dI(),pA=pI(),cl=vI(),fY=0,wI=32768,mA=32768,hY=~mA,yI=32768,dY=~yI,Le=Ye.name={};Le.encode=function(e,t,n,{mail:r=!1}={}){t||(t=Xe.alloc(Le.encodingLength(e))),n||(n=0);let i=n,o=e.replace(/^\.|\.$/gm,"");if(o.length){let s=[];if(r){let a="";o.split(".").forEach(u=>{u.endsWith("\\")?a+=(a.length?".":"")+u.slice(0,-1):s.length===0&&a.length?s.push(a+"."+u):s.push(u)})}else s=o.split(".");for(let a=0;a<s.length;a++){let u=t.write(s[a],n+1);t[n]=u,n+=u+1}}return t[n++]=0,Le.encode.bytes=n-i,t};Le.encode.bytes=0;Le.decode=function(e,t,{mail:n=!1}={}){t||(t=0);let r=[],i=t,o=0,s=0,a=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");let u=e[t++];if(s+=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);n&&(l=l.replace(/\./g,"\\.")),r.push(l),t+=u,s+=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>=i)throw new Error("Cannot decode name (bad pointer)");t=l,i=l,s+=a?0:1,a=!0}else throw new Error("Cannot decode name (bad label)")}return Le.decode.bytes=s,r.length===0?".":r.join(".")};Le.decode.bytes=0;Le.encodingLength=function(e){return e==="."||e===".."?1:Xe.byteLength(e.replace(/^\.|\.$/gm,""))+2};var St={};St.encode=function(e,t,n){t||(t=Xe.alloc(St.encodingLength(e))),n||(n=0);let r=t.write(e,n+1);return t[n]=r,St.encode.bytes=r+1,t};St.encode.bytes=0;St.decode=function(e,t){t||(t=0);let n=e[t],r=e.toString("utf-8",t+1,t+1+n);return St.decode.bytes=n+1,r};St.decode.bytes=0;St.encodingLength=function(e){return Xe.byteLength(e)+1};var Vi={};Vi.encode=function(e,t,n){t||(t=Vi.encodingLength(e)),n||(n=0);let r=(e.flags||0)&32767,i=e.type==="response"?wI:fY;return t.writeUInt16BE(e.id||0,n),t.writeUInt16BE(r|i,n+2),t.writeUInt16BE(e.questions.length,n+4),t.writeUInt16BE(e.answers.length,n+6),t.writeUInt16BE(e.authorities.length,n+8),t.writeUInt16BE(e.additionals.length,n+10),t};Vi.encode.bytes=12;Vi.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");let n=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:n&wI?"response":"query",flags:n&32767,flag_qr:(n>>15&1)===1,opcode:lY.toString(n>>11&15),flag_aa:(n>>10&1)===1,flag_tc:(n>>9&1)===1,flag_rd:(n>>8&1)===1,flag_ra:(n>>7&1)===1,flag_z:(n>>6&1)===1,flag_ad:(n>>5&1)===1,flag_cd:(n>>4&1)===1,rcode:cY.toString(n&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))}};Vi.decode.bytes=12;Vi.encodingLength=function(){return 12};var Oa=Ye.unknown={};Oa.encode=function(e,t,n){return t||(t=Xe.alloc(Oa.encodingLength(e))),n||(n=0),t.writeUInt16BE(e.length,n),e.copy(t,n+2),Oa.encode.bytes=e.length+2,t};Oa.encode.bytes=0;Oa.decode=function(e,t){t||(t=0);let n=e.readUInt16BE(t),r=e.slice(t+2,t+2+n);return Oa.decode.bytes=n+2,r};Oa.decode.bytes=0;Oa.encodingLength=function(e){return e.length+2};var Na=Ye.ns={};Na.encode=function(e,t,n){return t||(t=Xe.alloc(Na.encodingLength(e))),n||(n=0),Le.encode(e,t,n+2),t.writeUInt16BE(Le.encode.bytes,n),Na.encode.bytes=Le.encode.bytes+2,t};Na.encode.bytes=0;Na.decode=function(e,t){t||(t=0);let n=e.readUInt16BE(t),r=Le.decode(e,t+2);return Na.decode.bytes=n+2,r};Na.decode.bytes=0;Na.encodingLength=function(e){return Le.encodingLength(e)+2};var La=Ye.soa={};La.encode=function(e,t,n){t||(t=Xe.alloc(La.encodingLength(e))),n||(n=0);let r=n;return n+=2,Le.encode(e.mname,t,n),n+=Le.encode.bytes,Le.encode(e.rname,t,n,{mail:!0}),n+=Le.encode.bytes,t.writeUInt32BE(e.serial||0,n),n+=4,t.writeUInt32BE(e.refresh||0,n),n+=4,t.writeUInt32BE(e.retry||0,n),n+=4,t.writeUInt32BE(e.expire||0,n),n+=4,t.writeUInt32BE(e.minimum||0,n),n+=4,t.writeUInt16BE(n-r-2,r),La.encode.bytes=n-r,t};La.encode.bytes=0;La.decode=function(e,t){t||(t=0);let n=t,r={};return t+=2,r.mname=Le.decode(e,t),t+=Le.decode.bytes,r.rname=Le.decode(e,t,{mail:!0}),t+=Le.decode.bytes,r.serial=e.readUInt32BE(t),t+=4,r.refresh=e.readUInt32BE(t),t+=4,r.retry=e.readUInt32BE(t),t+=4,r.expire=e.readUInt32BE(t),t+=4,r.minimum=e.readUInt32BE(t),t+=4,La.decode.bytes=t-n,r};La.decode.bytes=0;La.encodingLength=function(e){return 22+Le.encodingLength(e.mname)+Le.encodingLength(e.rname)};var Ua=Ye.txt={};Ua.encode=function(e,t,n){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)if(typeof e[i]=="string"&&(e[i]=Xe.from(e[i])),!Xe.isBuffer(e[i]))throw new Error("Must be a Buffer");t||(t=Xe.alloc(Ua.encodingLength(e))),n||(n=0);let r=n;return n+=2,e.forEach(function(i){t[n++]=i.length,i.copy(t,n,0,i.length),n+=i.length}),t.writeUInt16BE(n-r-2,r),Ua.encode.bytes=n-r,t};Ua.encode.bytes=0;Ua.decode=function(e,t){t||(t=0);let n=t,r=e.readUInt16BE(t);t+=2;let i=[];for(;r>0;){let o=e[t++];if(--r,r<o)throw new Error("Buffer overflow");i.push(e.slice(t,t+o)),t+=o,r-=o}return Ua.decode.bytes=t-n,i};Ua.decode.bytes=0;Ua.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(n){typeof n=="string"?t+=Xe.byteLength(n)+1:t+=n.length+1}),t};var Ha=Ye.null={};Ha.encode=function(e,t,n){t||(t=Xe.alloc(Ha.encodingLength(e))),n||(n=0),typeof e=="string"&&(e=Xe.from(e)),e||(e=Xe.alloc(0));let r=n;n+=2;let i=e.length;return e.copy(t,n,0,i),n+=i,t.writeUInt16BE(n-r-2,r),Ha.encode.bytes=n-r,t};Ha.encode.bytes=0;Ha.decode=function(e,t){t||(t=0);let n=t,r=e.readUInt16BE(t);t+=2;let i=e.slice(t,t+r);return t+=r,Ha.decode.bytes=t-n,i};Ha.decode.bytes=0;Ha.encodingLength=function(e){return e?(Xe.isBuffer(e)?e.length:Xe.byteLength(e))+2:2};var Ma=Ye.hinfo={};Ma.encode=function(e,t,n){t||(t=Xe.alloc(Ma.encodingLength(e))),n||(n=0);let r=n;return n+=2,St.encode(e.cpu,t,n),n+=St.encode.bytes,St.encode(e.os,t,n),n+=St.encode.bytes,t.writeUInt16BE(n-r-2,r),Ma.encode.bytes=n-r,t};Ma.encode.bytes=0;Ma.decode=function(e,t){t||(t=0);let n=t,r={};return t+=2,r.cpu=St.decode(e,t),t+=St.decode.bytes,r.os=St.decode(e,t),t+=St.decode.bytes,Ma.decode.bytes=t-n,r};Ma.decode.bytes=0;Ma.encodingLength=function(e){return St.encodingLength(e.cpu)+St.encodingLength(e.os)+2};var ji=Ye.ptr={},pY=Ye.cname=ji,mY=Ye.dname=ji;ji.encode=function(e,t,n){return t||(t=Xe.alloc(ji.encodingLength(e))),n||(n=0),Le.encode(e,t,n+2),t.writeUInt16BE(Le.encode.bytes,n),ji.encode.bytes=Le.encode.bytes+2,t};ji.encode.bytes=0;ji.decode=function(e,t){t||(t=0);let n=Le.decode(e,t+2);return ji.decode.bytes=Le.decode.bytes+2,n};ji.decode.bytes=0;ji.encodingLength=function(e){return Le.encodingLength(e)+2};var qa=Ye.srv={};qa.encode=function(e,t,n){t||(t=Xe.alloc(qa.encodingLength(e))),n||(n=0),t.writeUInt16BE(e.priority||0,n+2),t.writeUInt16BE(e.weight||0,n+4),t.writeUInt16BE(e.port||0,n+6),Le.encode(e.target,t,n+8);let r=Le.encode.bytes+6;return t.writeUInt16BE(r,n),qa.encode.bytes=r+2,t};qa.encode.bytes=0;qa.decode=function(e,t){t||(t=0);let n=e.readUInt16BE(t),r={};return r.priority=e.readUInt16BE(t+2),r.weight=e.readUInt16BE(t+4),r.port=e.readUInt16BE(t+6),r.target=Le.decode(e,t+8),qa.decode.bytes=n+2,r};qa.decode.bytes=0;qa.encodingLength=function(e){return 8+Le.encodingLength(e.target)};var Os=Ye.caa={};Os.ISSUER_CRITICAL=128;Os.encode=function(e,t,n){let r=Os.encodingLength(e);return t||(t=Xe.alloc(Os.encodingLength(e))),n||(n=0),e.issuerCritical&&(e.flags=Os.ISSUER_CRITICAL),t.writeUInt16BE(r-2,n),n+=2,t.writeUInt8(e.flags||0,n),n+=1,St.encode(e.tag,t,n),n+=St.encode.bytes,t.write(e.value,n),n+=Xe.byteLength(e.value),Os.encode.bytes=r,t};Os.encode.bytes=0;Os.decode=function(e,t){t||(t=0);let n=e.readUInt16BE(t);t+=2;let r=t,i={};return i.flags=e.readUInt8(t),t+=1,i.tag=St.decode(e,t),t+=St.decode.bytes,i.value=e.toString("utf-8",t,r+n),i.issuerCritical=!!(i.flags&Os.ISSUER_CRITICAL),Os.decode.bytes=n+2,i};Os.decode.bytes=0;Os.encodingLength=function(e){return St.encodingLength(e.tag)+St.encodingLength(e.value)+2};var ec=Ye.mx={};ec.encode=function(e,t,n){t||(t=Xe.alloc(ec.encodingLength(e))),n||(n=0);let r=n;return n+=2,t.writeUInt16BE(e.preference||0,n),n+=2,Le.encode(e.exchange,t,n),n+=Le.encode.bytes,t.writeUInt16BE(n-r-2,r),ec.encode.bytes=n-r,t};ec.encode.bytes=0;ec.decode=function(e,t){t||(t=0);let n=t,r={};return t+=2,r.preference=e.readUInt16BE(t),t+=2,r.exchange=Le.decode(e,t),t+=Le.decode.bytes,ec.decode.bytes=t-n,r};ec.encodingLength=function(e){return 4+Le.encodingLength(e.exchange)};var ja=Ye.a={};ja.encode=function(e,t,n){return t||(t=Xe.alloc(ja.encodingLength(e))),n||(n=0),t.writeUInt16BE(4,n),n+=2,cl.v4.encode(e,t,n),ja.encode.bytes=6,t};ja.encode.bytes=0;ja.decode=function(e,t){t||(t=0),t+=2;let n=cl.v4.decode(e,t);return ja.decode.bytes=6,n};ja.decode.bytes=0;ja.encodingLength=function(){return 6};var Ka=Ye.aaaa={};Ka.encode=function(e,t,n){return t||(t=Xe.alloc(Ka.encodingLength(e))),n||(n=0),t.writeUInt16BE(16,n),n+=2,cl.v6.encode(e,t,n),Ka.encode.bytes=18,t};Ka.encode.bytes=0;Ka.decode=function(e,t){t||(t=0),t+=2;let n=cl.v6.decode(e,t);return Ka.decode.bytes=18,n};Ka.decode.bytes=0;Ka.encodingLength=function(){return 18};var bs=Ye.option={};bs.encode=function(e,t,n){t||(t=Xe.alloc(bs.encodingLength(e))),n||(n=0);let r=n,i=pA.toCode(e.code);if(t.writeUInt16BE(i,n),n+=2,e.data)t.writeUInt16BE(e.data.length,n),n+=2,e.data.copy(t,n),n+=e.data.length;else switch(i){case 8:let o=e.sourcePrefixLength||0,s=e.family||cl.familyOf(e.ip),a=cl.encode(e.ip,Xe.alloc),u=Math.ceil(o/8);t.writeUInt16BE(u+4,n),n+=2,t.writeUInt16BE(s,n),n+=2,t.writeUInt8(o,n++),t.writeUInt8(e.scopePrefixLength||0,n++),a.copy(t,n,0,u),n+=u;break;case 11:e.timeout?(t.writeUInt16BE(2,n),n+=2,t.writeUInt16BE(e.timeout,n),n+=2):(t.writeUInt16BE(0,n),n+=2);break;case 12:let l=e.length||0;t.writeUInt16BE(l,n),n+=2,t.fill(0,n,n+l),n+=l;break;case 14:let h=e.tags.length*2;t.writeUInt16BE(h,n),n+=2;for(let m of e.tags)t.writeUInt16BE(m,n),n+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return bs.encode.bytes=n-r,t};bs.encode.bytes=0;bs.decode=function(e,t){t||(t=0);let n={};n.code=e.readUInt16BE(t),n.type=pA.toString(n.code),t+=2;let r=e.readUInt16BE(t);switch(t+=2,n.data=e.slice(t,t+r),n.code){case 8:n.family=e.readUInt16BE(t),t+=2,n.sourcePrefixLength=e.readUInt8(t++),n.scopePrefixLength=e.readUInt8(t++);let i=Xe.alloc(n.family===1?4:16);e.copy(i,0,t,t+r-4),n.ip=cl.decode(i);break;case 11:r>0&&(n.timeout=e.readUInt16BE(t),t+=2);break;case 14:n.tags=[];for(let o=0;o<r;o+=2)n.tags.push(e.readUInt16BE(t)),t+=2}return bs.decode.bytes=r+4,n};bs.decode.bytes=0;bs.encodingLength=function(e){if(e.data)return e.data.length+4;switch(pA.toCode(e.code)){case 8:let n=e.sourcePrefixLength||0;return Math.ceil(n/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 Ls=Ye.opt={};Ls.encode=function(e,t,n){t||(t=Xe.alloc(Ls.encodingLength(e))),n||(n=0);let r=n,i=Gf(e,bs);return t.writeUInt16BE(i,n),n=mp(e,bs,t,n+2),Ls.encode.bytes=n-r,t};Ls.encode.bytes=0;Ls.decode=function(e,t){t||(t=0);let n=t,r=[],i=e.readUInt16BE(t);t+=2;let o=0;for(;i>0;)r[o++]=bs.decode(e,t),t+=bs.decode.bytes,i-=bs.decode.bytes;return Ls.decode.bytes=t-n,r};Ls.decode.bytes=0;Ls.encodingLength=function(e){return 2+Gf(e||[],bs)};var Xr=Ye.dnskey={};Xr.PROTOCOL_DNSSEC=3;Xr.ZONE_KEY=128;Xr.SECURE_ENTRYPOINT=32768;Xr.encode=function(e,t,n){t||(t=Xe.alloc(Xr.encodingLength(e))),n||(n=0);let r=n,i=e.key;if(!Xe.isBuffer(i))throw new Error("Key must be a Buffer");return n+=2,t.writeUInt16BE(e.flags,n),n+=2,t.writeUInt8(Xr.PROTOCOL_DNSSEC,n),n+=1,t.writeUInt8(e.algorithm,n),n+=1,i.copy(t,n,0,i.length),n+=i.length,Xr.encode.bytes=n-r,t.writeUInt16BE(Xr.encode.bytes-2,r),t};Xr.encode.bytes=0;Xr.decode=function(e,t){t||(t=0);let n=t;var r={},i=e.readUInt16BE(t);if(t+=2,r.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==Xr.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,r.algorithm=e.readUInt8(t),t+=1,r.key=e.slice(t,n+i+2),t+=r.key.length,Xr.decode.bytes=t-n,r};Xr.decode.bytes=0;Xr.encodingLength=function(e){return 6+Xe.byteLength(e.key)};var Po=Ye.rrsig={};Po.encode=function(e,t,n){t||(t=Xe.alloc(Po.encodingLength(e))),n||(n=0);let r=n,i=e.signature;if(!Xe.isBuffer(i))throw new Error("Signature must be a Buffer");return n+=2,t.writeUInt16BE(Va.toType(e.typeCovered),n),n+=2,t.writeUInt8(e.algorithm,n),n+=1,t.writeUInt8(e.labels,n),n+=1,t.writeUInt32BE(e.originalTTL,n),n+=4,t.writeUInt32BE(e.expiration,n),n+=4,t.writeUInt32BE(e.inception,n),n+=4,t.writeUInt16BE(e.keyTag,n),n+=2,Le.encode(e.signersName,t,n),n+=Le.encode.bytes,i.copy(t,n,0,i.length),n+=i.length,Po.encode.bytes=n-r,t.writeUInt16BE(Po.encode.bytes-2,r),t};Po.encode.bytes=0;Po.decode=function(e,t){t||(t=0);let n=t;var r={},i=e.readUInt16BE(t);return t+=2,r.typeCovered=Va.toString(e.readUInt16BE(t)),t+=2,r.algorithm=e.readUInt8(t),t+=1,r.labels=e.readUInt8(t),t+=1,r.originalTTL=e.readUInt32BE(t),t+=4,r.expiration=e.readUInt32BE(t),t+=4,r.inception=e.readUInt32BE(t),t+=4,r.keyTag=e.readUInt16BE(t),t+=2,r.signersName=Le.decode(e,t),t+=Le.decode.bytes,r.signature=e.slice(t,n+i+2),t+=r.signature.length,Po.decode.bytes=t-n,r};Po.decode.bytes=0;Po.encodingLength=function(e){return 20+Le.encodingLength(e.signersName)+Xe.byteLength(e.signature)};var ko=Ye.rp={};ko.encode=function(e,t,n){t||(t=Xe.alloc(ko.encodingLength(e))),n||(n=0);let r=n;return n+=2,Le.encode(e.mbox||".",t,n,{mail:!0}),n+=Le.encode.bytes,Le.encode(e.txt||".",t,n),n+=Le.encode.bytes,ko.encode.bytes=n-r,t.writeUInt16BE(ko.encode.bytes-2,r),t};ko.encode.bytes=0;ko.decode=function(e,t){t||(t=0);let n=t,r={};return t+=2,r.mbox=Le.decode(e,t,{mail:!0})||".",t+=Le.decode.bytes,r.txt=Le.decode(e,t)||".",t+=Le.decode.bytes,ko.decode.bytes=t-n,r};ko.decode.bytes=0;ko.encodingLength=function(e){return 2+Le.encodingLength(e.mbox||".")+Le.encodingLength(e.txt||".")};var er={};er.encode=function(e,t,n){t||(t=Xe.alloc(er.encodingLength(e))),n||(n=0);let r=n;for(var i=[],o=0;o<e.length;o++){var s=Va.toType(e[o]);i[s>>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(o=0;o<i.length;o++)if(i[o]!==void 0){var a=Xe.from(i[o]);t.writeUInt8(o,n),n+=1,t.writeUInt8(a.length,n),n+=1,a.copy(t,n),n+=a.length}return er.encode.bytes=n-r,t};er.encode.bytes=0;er.decode=function(e,t,n){t||(t=0);let r=t;for(var i=[];t-r<n;){var o=e.readUInt8(t);t+=1;var s=e.readUInt8(t);t+=1;for(var a=0;a<s;a++)for(var u=e.readUInt8(t+a),l=0;l<8;l++)if(u&1<<7-l){var h=Va.toString(o<<8|a<<3|l);i.push(h)}t+=s}return er.decode.bytes=t-r,i};er.decode.bytes=0;er.encodingLength=function(e){for(var t=[],n=0;n<e.length;n++){var r=Va.toType(e[n]);t[r>>8]=Math.max(t[r>>8]||0,r&255)}var i=0;for(n=0;n<t.length;n++)t[n]!==void 0&&(i+=2+Math.ceil((t[n]+1)/8));return i};var To=Ye.nsec={};To.encode=function(e,t,n){t||(t=Xe.alloc(To.encodingLength(e))),n||(n=0);let r=n;return n+=2,Le.encode(e.nextDomain,t,n),n+=Le.encode.bytes,er.encode(e.rrtypes,t,n),n+=er.encode.bytes,To.encode.bytes=n-r,t.writeUInt16BE(To.encode.bytes-2,r),t};To.encode.bytes=0;To.decode=function(e,t){t||(t=0);let n=t;var r={},i=e.readUInt16BE(t);return t+=2,r.nextDomain=Le.decode(e,t),t+=Le.decode.bytes,r.rrtypes=er.decode(e,t,i-(t-n)),t+=er.decode.bytes,To.decode.bytes=t-n,r};To.decode.bytes=0;To.encodingLength=function(e){return 2+Le.encodingLength(e.nextDomain)+er.encodingLength(e.rrtypes)};var Ro=Ye.nsec3={};Ro.encode=function(e,t,n){t||(t=Xe.alloc(Ro.encodingLength(e))),n||(n=0);let r=n,i=e.salt;if(!Xe.isBuffer(i))throw new Error("salt must be a Buffer");let o=e.nextDomain;if(!Xe.isBuffer(o))throw new Error("nextDomain must be a Buffer");return n+=2,t.writeUInt8(e.algorithm,n),n+=1,t.writeUInt8(e.flags,n),n+=1,t.writeUInt16BE(e.iterations,n),n+=2,t.writeUInt8(i.length,n),n+=1,i.copy(t,n,0,i.length),n+=i.length,t.writeUInt8(o.length,n),n+=1,o.copy(t,n,0,o.length),n+=o.length,er.encode(e.rrtypes,t,n),n+=er.encode.bytes,Ro.encode.bytes=n-r,t.writeUInt16BE(Ro.encode.bytes-2,r),t};Ro.encode.bytes=0;Ro.decode=function(e,t){t||(t=0);let n=t;var r={},i=e.readUInt16BE(t);t+=2,r.algorithm=e.readUInt8(t),t+=1,r.flags=e.readUInt8(t),t+=1,r.iterations=e.readUInt16BE(t),t+=2;let o=e.readUInt8(t);t+=1,r.salt=e.slice(t,t+o),t+=o;let s=e.readUInt8(t);return t+=1,r.nextDomain=e.slice(t,t+s),t+=s,r.rrtypes=er.decode(e,t,i-(t-n)),t+=er.decode.bytes,Ro.decode.bytes=t-n,r};Ro.decode.bytes=0;Ro.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+er.encodingLength(e.rrtypes)};var Oo=Ye.ds={};Oo.encode=function(e,t,n){t||(t=Xe.alloc(Oo.encodingLength(e))),n||(n=0);let r=n,i=e.digest;if(!Xe.isBuffer(i))throw new Error("Digest must be a Buffer");return n+=2,t.writeUInt16BE(e.keyTag,n),n+=2,t.writeUInt8(e.algorithm,n),n+=1,t.writeUInt8(e.digestType,n),n+=1,i.copy(t,n,0,i.length),n+=i.length,Oo.encode.bytes=n-r,t.writeUInt16BE(Oo.encode.bytes-2,r),t};Oo.encode.bytes=0;Oo.decode=function(e,t){t||(t=0);let n=t;var r={},i=e.readUInt16BE(t);return t+=2,r.keyTag=e.readUInt16BE(t),t+=2,r.algorithm=e.readUInt8(t),t+=1,r.digestType=e.readUInt8(t),t+=1,r.digest=e.slice(t,n+i+2),t+=r.digest.length,Oo.decode.bytes=t-n,r};Oo.decode.bytes=0;Oo.encodingLength=function(e){return 6+Xe.byteLength(e.digest)};var Ns=Ye.sshfp={};Ns.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};Ns.encode=function(t,n,r){n||(n=Xe.alloc(Ns.encodingLength(t))),r||(r=0);let i=r;r+=2,n[r]=t.algorithm,r+=1,n[r]=t.hash,r+=1;let o=Xe.from(t.fingerprint.toUpperCase(),"hex");if(o.length!==Ns.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return o.copy(n,r),r+=o.byteLength,Ns.encode.bytes=r-i,n.writeUInt16BE(Ns.encode.bytes-2,i),n};Ns.encode.bytes=0;Ns.decode=function(t,n){n||(n=0);let r=n,i={};n+=2,i.algorithm=t[n],n+=1,i.hash=t[n],n+=1;let o=Ns.getFingerprintLengthForHashType(i.hash);return i.fingerprint=t.slice(n,n+o).toString("hex").toUpperCase(),n+=o,Ns.decode.bytes=n-r,i};Ns.decode.bytes=0;Ns.encodingLength=function(e){return 4+Xe.from(e.fingerprint,"hex").byteLength};var No=Ye.naptr={};No.encode=function(e,t,n){t||(t=Xe.alloc(No.encodingLength(e))),n||(n=0);let r=n;return n+=2,t.writeUInt16BE(e.order||0,n),n+=2,t.writeUInt16BE(e.preference||0,n),n+=2,St.encode(e.flags,t,n),n+=St.encode.bytes,St.encode(e.services,t,n),n+=St.encode.bytes,St.encode(e.regexp,t,n),n+=St.encode.bytes,Le.encode(e.replacement,t,n),n+=Le.encode.bytes,No.encode.bytes=n-r,t.writeUInt16BE(No.encode.bytes-2,r),t};No.encode.bytes=0;No.decode=function(e,t){t||(t=0);let n=t,r={};return t+=2,r.order=e.readUInt16BE(t),t+=2,r.preference=e.readUInt16BE(t),t+=2,r.flags=St.decode(e,t),t+=St.decode.bytes,r.services=St.decode(e,t),t+=St.decode.bytes,r.regexp=St.decode(e,t),t+=St.decode.bytes,r.replacement=Le.decode(e,t),t+=Le.decode.bytes,No.decode.bytes=t-n,r};No.decode.bytes=0;No.encodingLength=function(e){return St.encodingLength(e.flags)+St.encodingLength(e.services)+St.encodingLength(e.regexp)+Le.encodingLength(e.replacement)+6};var Lo=Ye.tlsa={};Lo.encode=function(e,t,n){t||(t=Xe.alloc(Lo.encodingLength(e))),n||(n=0);let r=n,i=e.certificate;if(!Xe.isBuffer(i))throw new Error("Certificate must be a Buffer");return n+=2,t.writeUInt8(e.usage,n),n+=1,t.writeUInt8(e.selector,n),n+=1,t.writeUInt8(e.matchingType,n),n+=1,i.copy(t,n,0,i.length),n+=i.length,Lo.encode.bytes=n-r,t.writeUInt16BE(Lo.encode.bytes-2,r),t};Lo.encode.bytes=0;Lo.decode=function(e,t){t||(t=0);let n=t,r={},i=e.readUInt16BE(t);return t+=2,r.usage=e.readUInt8(t),t+=1,r.selector=e.readUInt8(t),t+=1,r.matchingType=e.readUInt8(t),t+=1,r.certificate=e.slice(t,n+i+2),t+=r.certificate.length,Lo.decode.bytes=t-n,r};Lo.decode.bytes=0;Lo.encodingLength=function(e){return 5+Xe.byteLength(e.certificate)};var gA=Ye.record=function(e){switch(e.toUpperCase()){case"A":return ja;case"PTR":return ji;case"CNAME":return pY;case"DNAME":return mY;case"TXT":return Ua;case"NULL":return Ha;case"AAAA":return Ka;case"SRV":return qa;case"HINFO":return Ma;case"CAA":return Os;case"NS":return Na;case"SOA":return La;case"MX":return ec;case"OPT":return Ls;case"DNSKEY":return Xr;case"RRSIG":return Po;case"RP":return ko;case"NSEC":return To;case"NSEC3":return Ro;case"SSHFP":return Ns;case"DS":return Oo;case"NAPTR":return No;case"TLSA":return Lo}return Oa},fr=Ye.answer={};fr.encode=function(e,t,n){t||(t=Xe.alloc(fr.encodingLength(e))),n||(n=0);let r=n;if(Le.encode(e.name,t,n),n+=Le.encode.bytes,t.writeUInt16BE(Va.toType(e.type),n),e.type.toUpperCase()==="OPT"){if(e.name!==".")throw new Error("OPT name must be root.");t.writeUInt16BE(e.udpPayloadSize||4096,n+2),t.writeUInt8(e.extendedRcode||0,n+4),t.writeUInt8(e.ednsVersion||0,n+5),t.writeUInt16BE(e.flags||0,n+6),n+=8,Ls.encode(e.options||[],t,n),n+=Ls.encode.bytes}else{let i=kg.toClass(e.class===void 0?"IN":e.class);e.flush&&(i|=mA),t.writeUInt16BE(i,n+2),t.writeUInt32BE(e.ttl||0,n+4),n+=8;let o=gA(e.type);o.encode(e.data,t,n),n+=o.encode.bytes}return fr.encode.bytes=n-r,t};fr.encode.bytes=0;fr.decode=function(e,t){t||(t=0);let n={},r=t;if(n.name=Le.decode(e,t),t+=Le.decode.bytes,n.type=Va.toString(e.readUInt16BE(t)),n.type==="OPT")n.udpPayloadSize=e.readUInt16BE(t+2),n.extendedRcode=e.readUInt8(t+4),n.ednsVersion=e.readUInt8(t+5),n.flags=e.readUInt16BE(t+6),n.flag_do=(n.flags>>15&1)===1,n.options=Ls.decode(e,t+8),t+=8+Ls.decode.bytes;else{let i=e.readUInt16BE(t+2);n.ttl=e.readUInt32BE(t+4),n.class=kg.toString(i&hY),n.flush=!!(i&mA);let o=gA(n.type);n.data=o.decode(e,t+8),t+=8+o.decode.bytes}return fr.decode.bytes=t-r,n};fr.decode.bytes=0;fr.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return Le.encodingLength(e.name)+8+gA(e.type).encodingLength(t)};var Ki=Ye.question={};Ki.encode=function(e,t,n){t||(t=Xe.alloc(Ki.encodingLength(e))),n||(n=0);let r=n;return Le.encode(e.name,t,n),n+=Le.encode.bytes,t.writeUInt16BE(Va.toType(e.type),n),n+=2,t.writeUInt16BE(kg.toClass(e.class===void 0?"IN":e.class),n),n+=2,Ki.encode.bytes=n-r,e};Ki.encode.bytes=0;Ki.decode=function(e,t){t||(t=0);let n=t,r={};return r.name=Le.decode(e,t),t+=Le.decode.bytes,r.type=Va.toString(e.readUInt16BE(t)),t+=2,r.class=kg.toString(e.readUInt16BE(t)),t+=2,!!(r.class&yI)&&(r.class&=dY),Ki.decode.bytes=t-n,r};Ki.decode.bytes=0;Ki.encodingLength=function(e){return Le.encodingLength(e.name)+4};Ye.AUTHORITATIVE_ANSWER=1024;Ye.TRUNCATED_RESPONSE=512;Ye.RECURSION_DESIRED=256;Ye.RECURSION_AVAILABLE=128;Ye.AUTHENTIC_DATA=32;Ye.CHECKING_DISABLED=16;Ye.DNSSEC_OK=32768;Ye.encode=function(e,t,n){let r=!t;r&&(t=Xe.alloc(Ye.encodingLength(e))),n||(n=0);let i=n;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),Vi.encode(e,t,n),n+=Vi.encode.bytes,n=mp(e.questions,Ki,t,n),n=mp(e.answers,fr,t,n),n=mp(e.authorities,fr,t,n),n=mp(e.additionals,fr,t,n),Ye.encode.bytes=n-i,r&&Ye.encode.bytes!==t.length?t.slice(0,Ye.encode.bytes):t};Ye.encode.bytes=0;Ye.decode=function(e,t){t||(t=0);let n=t,r=Vi.decode(e,t);return t+=Vi.decode.bytes,t=Pg(r.questions,Ki,e,t),t=Pg(r.answers,fr,e,t),t=Pg(r.authorities,fr,e,t),t=Pg(r.additionals,fr,e,t),Ye.decode.bytes=t-n,r};Ye.decode.bytes=0;Ye.encodingLength=function(e){return Vi.encodingLength(e)+Gf(e.questions||[],Ki)+Gf(e.answers||[],fr)+Gf(e.authorities||[],fr)+Gf(e.additionals||[],fr)};Ye.streamEncode=function(e){let t=Ye.encode(e),n=Xe.alloc(2);n.writeUInt16BE(t.byteLength);let r=Xe.concat([n,t]);return Ye.streamEncode.bytes=r.byteLength,r};Ye.streamEncode.bytes=0;Ye.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;let n=Ye.decode(e.slice(2));return Ye.streamDecode.bytes=Ye.decode.bytes,n};Ye.streamDecode.bytes=0;function Gf(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t.encodingLength(e[r]);return n}function mp(e,t,n,r){for(let i=0;i<e.length;i++)t.encode(e[i],n,r),r+=t.encode.bytes;return r}function Pg(e,t,n,r){for(let i=0;i<e.length;i++)e[i]=t.decode(n,r),r+=t.decode.bytes;return r}});var Ga=be((Wf,vp)=>{var Dge=B(x());(function(){var e,t="4.18.1",n=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",o="Invalid `variable` option passed into `_.template`",s="Invalid `imports` option passed into `_.template`",a="__lodash_hash_undefined__",u=500,l="__lodash_placeholder__",h=1,m=2,p=4,d=1,v=2,g=1,y=2,w=4,E=8,C=16,_=32,F=64,H=128,K=256,S=512,I=30,q="...",L=800,T=16,O=1,R=2,N=3,P=1/0,M=9007199254740991,Y=17976931348623157e292,V=NaN,X=4294967295,te=X-1,ae=X>>>1,me=[["ary",H],["bind",g],["bindKey",y],["curry",E],["curryRight",C],["flip",S],["partial",_],["partialRight",F],["rearg",K]],he="[object Arguments]",De="[object Array]",Pe="[object AsyncFunction]",Ie="[object Boolean]",se="[object Date]",pe="[object DOMException]",Fe="[object Error]",Re="[object Function]",Ve="[object GeneratorFunction]",Oe="[object Map]",pt="[object Number]",Qe="[object Null]",ct="[object Object]",gr="[object Promise]",vn="[object Proxy]",wn="[object RegExp]",lt="[object Set]",Tn="[object String]",es="[object Symbol]",gi="[object Undefined]",Dt="[object WeakMap]",Ze="[object WeakSet]",Te="[object ArrayBuffer]",un="[object DataView]",Or="[object Float32Array]",mt="[object Float64Array]",cc="[object Int8Array]",Nr="[object Int16Array]",Se="[object Int32Array]",tu="[object Uint8Array]",Lt="[object Uint8ClampedArray]",vr="[object Uint16Array]",Xi="[object Uint32Array]",Cl=/\b__p \+= '';/g,nu=/\b(__p \+=) '' \+/g,uh=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ru=/&(?:amp|lt|gt|quot|#39);/g,Zi=/[&<>"']/g,jt=RegExp(ru.source),Ks=RegExp(Zi.source),_l=/<%-([\s\S]+?)%>/g,ch=/<%([\s\S]+?)%>/g,lc=/<%=([\s\S]+?)%>/g,su=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lh=/^\w*$/,Dl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fc=/[\\^$.*+?()[\]{}|]/g,fh=RegExp(fc.source),ie=/^\s+/,we=/\s/,je=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Me=/\{\n\/\* \[wrapped with (.+)\] \*/,et=/,? & /,gt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,wt=/[()=,{}\[\]\/\s]/,Rn=/\\(\\)?/g,cn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Vs=/\w*$/,Ji=/^[-+]0x[0-9a-f]+$/i,Lr=/^0b[01]+$/i,ts=/^\[object .+?Constructor\]$/,Bn=/^0o[0-7]+$/i,Ur=/^(?:0|[1-9]\d*)$/,iu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ou=/($^)/,hh=/['\n\r\u2028\u2029\\]/g,wr="\\ud800-\\udfff",Ut="\\u0300-\\u036f",In="\\ufe20-\\ufe2f",ut="\\u20d0-\\u20ff",ln=Ut+In+ut,yr="\\u2700-\\u27bf",sn="a-z\\xdf-\\xf6\\xf8-\\xff",ns="\\xac\\xb1\\xd7\\xf7",_s="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Gs="\\u2000-\\u206f",vi=" \\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",Qi="A-Z\\xc0-\\xd6\\xd8-\\xde",Fl="\\ufe0e\\ufe0f",Hp=ns+_s+Gs+vi,dh="['\u2019]",C2="["+wr+"]",Mp="["+Hp+"]",Bl="["+ln+"]",qp="\\d+",_2="["+yr+"]",ph="["+sn+"]",mh="[^"+wr+Hp+qp+yr+sn+Qi+"]",gh="\\ud83c[\\udffb-\\udfff]",D2="(?:"+Bl+"|"+gh+")",jp="[^"+wr+"]",vh="(?:\\ud83c[\\udde6-\\uddff]){2}",au="[\\ud800-\\udbff][\\udc00-\\udfff]",uu="["+Qi+"]",Kp="\\u200d",Vp="(?:"+ph+"|"+mh+")",F2="(?:"+uu+"|"+mh+")",Gp="(?:"+dh+"(?:d|ll|m|re|s|t|ve))?",zp="(?:"+dh+"(?:D|LL|M|RE|S|T|VE))?",Wp=D2+"?",Yp="["+Fl+"]?",B2="(?:"+Kp+"(?:"+[jp,vh,au].join("|")+")"+Yp+Wp+")*",I2="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",$2="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Xp=Yp+Wp+B2,x2="(?:"+[_2,vh,au].join("|")+")"+Xp,P2="(?:"+[jp+Bl+"?",Bl,vh,au,C2].join("|")+")",k2=RegExp(dh,"g"),T2=RegExp(Bl,"g"),wh=RegExp(gh+"(?="+gh+")|"+P2+Xp,"g"),R2=RegExp([uu+"?"+ph+"+"+Gp+"(?="+[Mp,uu,"$"].join("|")+")",F2+"+"+zp+"(?="+[Mp,uu+Vp,"$"].join("|")+")",uu+"?"+Vp+"+"+Gp,uu+"+"+zp,$2,I2,qp,x2].join("|"),"g"),O2=RegExp("["+Kp+wr+ln+Fl+"]"),N2=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,L2=["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"],U2=-1,tn={};tn[Or]=tn[mt]=tn[cc]=tn[Nr]=tn[Se]=tn[tu]=tn[Lt]=tn[vr]=tn[Xi]=!0,tn[he]=tn[De]=tn[Te]=tn[Ie]=tn[un]=tn[se]=tn[Fe]=tn[Re]=tn[Oe]=tn[pt]=tn[ct]=tn[wn]=tn[lt]=tn[Tn]=tn[Dt]=!1;var Zt={};Zt[he]=Zt[De]=Zt[Te]=Zt[un]=Zt[Ie]=Zt[se]=Zt[Or]=Zt[mt]=Zt[cc]=Zt[Nr]=Zt[Se]=Zt[Oe]=Zt[pt]=Zt[ct]=Zt[wn]=Zt[lt]=Zt[Tn]=Zt[es]=Zt[tu]=Zt[Lt]=Zt[vr]=Zt[Xi]=!0,Zt[Fe]=Zt[Re]=Zt[Dt]=!1;var H2={\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"},M2={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},q2={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},j2={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},K2=parseFloat,V2=parseInt,Zp=typeof global=="object"&&global&&global.Object===Object&&global,G2=typeof self=="object"&&self&&self.Object===Object&&self,$n=Zp||G2||Function("return this")(),yh=typeof Wf=="object"&&Wf&&!Wf.nodeType&&Wf,Ko=yh&&typeof vp=="object"&&vp&&!vp.nodeType&&vp,Jp=Ko&&Ko.exports===yh,Eh=Jp&&Zp.process,rs=(function(){try{var oe=Ko&&Ko.require&&Ko.require("util").types;return oe||Eh&&Eh.binding&&Eh.binding("util")}catch{}})(),Qp=rs&&rs.isArrayBuffer,e0=rs&&rs.isDate,t0=rs&&rs.isMap,n0=rs&&rs.isRegExp,r0=rs&&rs.isSet,s0=rs&&rs.isTypedArray;function Hr(oe,ye,de){switch(de.length){case 0:return oe.call(ye);case 1:return oe.call(ye,de[0]);case 2:return oe.call(ye,de[0],de[1]);case 3:return oe.call(ye,de[0],de[1],de[2])}return oe.apply(ye,de)}function z2(oe,ye,de,He){for(var ot=-1,$t=oe==null?0:oe.length;++ot<$t;){var yn=oe[ot];ye(He,yn,de(yn),oe)}return He}function U(oe,ye){for(var de=-1,He=oe==null?0:oe.length;++de<He&&ye(oe[de],de,oe)!==!1;);return oe}function ft(oe,ye){for(var de=oe==null?0:oe.length;de--&&ye(oe[de],de,oe)!==!1;);return oe}function hc(oe,ye){for(var de=-1,He=oe==null?0:oe.length;++de<He;)if(!ye(oe[de],de,oe))return!1;return!0}function On(oe,ye){for(var de=-1,He=oe==null?0:oe.length,ot=0,$t=[];++de<He;){var yn=oe[de];ye(yn,de,oe)&&($t[ot++]=yn)}return $t}function cu(oe,ye){var de=oe==null?0:oe.length;return!!de&&lu(oe,ye,0)>-1}function ce(oe,ye,de){for(var He=-1,ot=oe==null?0:oe.length;++He<ot;)if(de(ye,oe[He]))return!0;return!1}function Wt(oe,ye){for(var de=-1,He=oe==null?0:oe.length,ot=Array(He);++de<He;)ot[de]=ye(oe[de],de,oe);return ot}function eo(oe,ye){for(var de=-1,He=ye.length,ot=oe.length;++de<He;)oe[ot+de]=ye[de];return oe}function i0(oe,ye,de,He){var ot=-1,$t=oe==null?0:oe.length;for(He&&$t&&(de=oe[++ot]);++ot<$t;)de=ye(de,oe[ot],ot,oe);return de}function ZS(oe,ye,de,He){var ot=oe==null?0:oe.length;for(He&&ot&&(de=oe[--ot]);ot--;)de=ye(de,oe[ot],ot,oe);return de}function nn(oe,ye){for(var de=-1,He=oe==null?0:oe.length;++de<He;)if(ye(oe[de],de,oe))return!0;return!1}var JS=Ae("length");function bh(oe){return oe.split("")}function nt(oe){return oe.match(gt)||[]}function zn(oe,ye,de){var He;return de(oe,function(ot,$t,yn){if(ye(ot,$t,yn))return He=$t,!1}),He}function Il(oe,ye,de,He){for(var ot=oe.length,$t=de+(He?1:-1);He?$t--:++$t<ot;)if(ye(oe[$t],$t,oe))return $t;return-1}function lu(oe,ye,de){return ye===ye?J2(oe,ye,de):Il(oe,Ah,de)}function wi(oe,ye,de,He){for(var ot=de-1,$t=oe.length;++ot<$t;)if(He(oe[ot],ye))return ot;return-1}function Ah(oe){return oe!==oe}function fu(oe,ye){var de=oe==null?0:oe.length;return de?_h(oe,ye)/de:V}function Ae(oe){return function(ye){return ye==null?e:ye[oe]}}function Sh(oe){return function(ye){return oe==null?e:oe[ye]}}function Ch(oe,ye,de,He,ot){return ot(oe,function($t,yn,Kt){de=He?(He=!1,$t):ye(de,$t,yn,Kt)}),de}function o0(oe,ye){var de=oe.length;for(oe.sort(ye);de--;)oe[de]=oe[de].value;return oe}function _h(oe,ye){for(var de,He=-1,ot=oe.length;++He<ot;){var $t=ye(oe[He]);$t!==e&&(de=de===e?$t:de+$t)}return de}function Dh(oe,ye){for(var de=-1,He=Array(oe);++de<oe;)He[de]=ye(de);return He}function a0(oe,ye){return Wt(ye,function(de){return[de,oe[de]]})}function Fh(oe){return oe&&oe.slice(0,xh(oe)+1).replace(ie,"")}function tr(oe){return function(ye){return oe(ye)}}function Bh(oe,ye){return Wt(ye,function(de){return oe[de]})}function Vo(oe,ye){return oe.has(ye)}function u0(oe,ye){for(var de=-1,He=oe.length;++de<He&&lu(ye,oe[de],0)>-1;);return de}function Ih(oe,ye){for(var de=oe.length;de--&&lu(ye,oe[de],0)>-1;);return de}function $h(oe,ye){for(var de=oe.length,He=0;de--;)oe[de]===ye&&++He;return He}var W2=Sh(H2),c0=Sh(M2);function Y2(oe){return"\\"+j2[oe]}function l0(oe,ye){return oe==null?e:oe[ye]}function hu(oe){return O2.test(oe)}function X2(oe){return N2.test(oe)}function Z2(oe){for(var ye,de=[];!(ye=oe.next()).done;)de.push(ye.value);return de}function Wn(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He,ot){de[++ye]=[ot,He]}),de}function dc(oe,ye){return function(de){return oe(ye(de))}}function nr(oe,ye){for(var de=-1,He=oe.length,ot=0,$t=[];++de<He;){var yn=oe[de];(yn===ye||yn===l)&&(oe[de]=l,$t[ot++]=de)}return $t}function Go(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He){de[++ye]=He}),de}function f0(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He){de[++ye]=[He,He]}),de}function J2(oe,ye,de){for(var He=de-1,ot=oe.length;++He<ot;)if(oe[He]===ye)return He;return-1}function h0(oe,ye,de){for(var He=de+1;He--;)if(oe[He]===ye)return He;return He}function zo(oe){return hu(oe)?Q2(oe):JS(oe)}function Mr(oe){return hu(oe)?ev(oe):bh(oe)}function xh(oe){for(var ye=oe.length;ye--&&we.test(oe.charAt(ye)););return ye}var d0=Sh(q2);function Q2(oe){for(var ye=wh.lastIndex=0;wh.test(oe);)++ye;return ye}function ev(oe){return oe.match(wh)||[]}function tv(oe){return oe.match(R2)||[]}var Ph=(function oe(ye){ye=ye==null?$n:yi.defaults($n.Object(),ye,yi.pick($n,L2));var de=ye.Array,He=ye.Date,ot=ye.Error,$t=ye.Function,yn=ye.Math,Kt=ye.Object,kh=ye.RegExp,nv=ye.String,ss=ye.TypeError,pc=de.prototype,p0=$t.prototype,Ds=Kt.prototype,$l=ye["__core-js_shared__"],Wo=p0.toString,Ot=Ds.hasOwnProperty,Th=0,m0=(function(){var c=/[^.]+$/.exec($l&&$l.keys&&$l.keys.IE_PROTO||"");return c?"Symbol(src)_1."+c:""})(),xl=Ds.toString,rv=Wo.call(Kt),sv=$n._,iv=kh("^"+Wo.call(Ot).replace(fc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pl=Jp?ye.Buffer:e,to=ye.Symbol,kl=ye.Uint8Array,g0=Pl?Pl.allocUnsafe:e,Tl=dc(Kt.getPrototypeOf,Kt),v0=Kt.create,Yt=Ds.propertyIsEnumerable,Rl=pc.splice,Ol=to?to.isConcatSpreadable:e,mc=to?to.iterator:e,Yo=to?to.toStringTag:e,D=(function(){try{var c=Ec(Kt,"defineProperty");return c({},"",{}),c}catch{}})(),G=ye.clearTimeout!==$n.clearTimeout&&ye.clearTimeout,ee=He&&He.now!==$n.Date.now&&He.now,Z=ye.setTimeout!==$n.setTimeout&&ye.setTimeout,fe=yn.ceil,ge=yn.floor,Ht=Kt.getOwnPropertySymbols,En=Pl?Pl.isBuffer:e,QS=ye.isFinite,P$=pc.join,k$=dc(Kt.keys,Kt),Nn=yn.max,Er=yn.min,T$=He.now,R$=ye.parseInt,e6=yn.random,O$=pc.reverse,ov=Ec(ye,"DataView"),Rh=Ec(ye,"Map"),av=Ec(ye,"Promise"),Nl=Ec(ye,"Set"),Oh=Ec(ye,"WeakMap"),Nh=Ec(Kt,"create"),w0=Oh&&new Oh,Ll={},N$=bc(ov),L$=bc(Rh),U$=bc(av),H$=bc(Nl),M$=bc(Oh),y0=to?to.prototype:e,Lh=y0?y0.valueOf:e,t6=y0?y0.toString:e;function z(c){if(pn(c)&&!ht(c)&&!(c instanceof Bt)){if(c instanceof zs)return c;if(Ot.call(c,"__wrapped__"))return n5(c)}return new zs(c)}var Ul=(function(){function c(){}return function(f){if(!fn(f))return{};if(v0)return v0(f);c.prototype=f;var b=new c;return c.prototype=e,b}})();function E0(){}function zs(c,f){this.__wrapped__=c,this.__actions__=[],this.__chain__=!!f,this.__index__=0,this.__values__=e}z.templateSettings={escape:_l,evaluate:ch,interpolate:lc,variable:"",imports:{_:z}},z.prototype=E0.prototype,z.prototype.constructor=z,zs.prototype=Ul(E0.prototype),zs.prototype.constructor=zs;function Bt(c){this.__wrapped__=c,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=X,this.__views__=[]}function q$(){var c=new Bt(this.__wrapped__);return c.__actions__=is(this.__actions__),c.__dir__=this.__dir__,c.__filtered__=this.__filtered__,c.__iteratees__=is(this.__iteratees__),c.__takeCount__=this.__takeCount__,c.__views__=is(this.__views__),c}function j$(){if(this.__filtered__){var c=new Bt(this);c.__dir__=-1,c.__filtered__=!0}else c=this.clone(),c.__dir__*=-1;return c}function K$(){var c=this.__wrapped__.value(),f=this.__dir__,b=ht(c),k=f<0,j=b?c.length:0,W=nP(0,j,this.__views__),Q=W.start,ne=W.end,ue=ne-Q,Ce=k?ne:Q-1,_e=this.__iteratees__,Be=_e.length,Ne=0,Ge=Er(ue,this.__takeCount__);if(!b||!k&&j==ue&&Ge==ue)return _6(c,this.__actions__);var it=[];e:for(;ue--&&Ne<Ge;){Ce+=f;for(var Et=-1,rt=c[Ce];++Et<Be;){var Ft=_e[Et],xt=Ft.iteratee,Is=Ft.type,Kr=xt(rt);if(Is==R)rt=Kr;else if(!Kr){if(Is==O)continue e;break e}}it[Ne++]=rt}return it}Bt.prototype=Ul(E0.prototype),Bt.prototype.constructor=Bt;function gc(c){var f=-1,b=c==null?0:c.length;for(this.clear();++f<b;){var k=c[f];this.set(k[0],k[1])}}function V$(){this.__data__=Nh?Nh(null):{},this.size=0}function G$(c){var f=this.has(c)&&delete this.__data__[c];return this.size-=f?1:0,f}function z$(c){var f=this.__data__;if(Nh){var b=f[c];return b===a?e:b}return Ot.call(f,c)?f[c]:e}function W$(c){var f=this.__data__;return Nh?f[c]!==e:Ot.call(f,c)}function Y$(c,f){var b=this.__data__;return this.size+=this.has(c)?0:1,b[c]=Nh&&f===e?a:f,this}gc.prototype.clear=V$,gc.prototype.delete=G$,gc.prototype.get=z$,gc.prototype.has=W$,gc.prototype.set=Y$;function Xo(c){var f=-1,b=c==null?0:c.length;for(this.clear();++f<b;){var k=c[f];this.set(k[0],k[1])}}function X$(){this.__data__=[],this.size=0}function Z$(c){var f=this.__data__,b=b0(f,c);if(b<0)return!1;var k=f.length-1;return b==k?f.pop():Rl.call(f,b,1),--this.size,!0}function J$(c){var f=this.__data__,b=b0(f,c);return b<0?e:f[b][1]}function Q$(c){return b0(this.__data__,c)>-1}function ex(c,f){var b=this.__data__,k=b0(b,c);return k<0?(++this.size,b.push([c,f])):b[k][1]=f,this}Xo.prototype.clear=X$,Xo.prototype.delete=Z$,Xo.prototype.get=J$,Xo.prototype.has=Q$,Xo.prototype.set=ex;function Zo(c){var f=-1,b=c==null?0:c.length;for(this.clear();++f<b;){var k=c[f];this.set(k[0],k[1])}}function tx(){this.size=0,this.__data__={hash:new gc,map:new(Rh||Xo),string:new gc}}function nx(c){var f=k0(this,c).delete(c);return this.size-=f?1:0,f}function rx(c){return k0(this,c).get(c)}function sx(c){return k0(this,c).has(c)}function ix(c,f){var b=k0(this,c),k=b.size;return b.set(c,f),this.size+=b.size==k?0:1,this}Zo.prototype.clear=tx,Zo.prototype.delete=nx,Zo.prototype.get=rx,Zo.prototype.has=sx,Zo.prototype.set=ix;function vc(c){var f=-1,b=c==null?0:c.length;for(this.__data__=new Zo;++f<b;)this.add(c[f])}function ox(c){return this.__data__.set(c,a),this}function ax(c){return this.__data__.has(c)}vc.prototype.add=vc.prototype.push=ox,vc.prototype.has=ax;function Ei(c){var f=this.__data__=new Xo(c);this.size=f.size}function ux(){this.__data__=new Xo,this.size=0}function cx(c){var f=this.__data__,b=f.delete(c);return this.size=f.size,b}function lx(c){return this.__data__.get(c)}function fx(c){return this.__data__.has(c)}function hx(c,f){var b=this.__data__;if(b instanceof Xo){var k=b.__data__;if(!Rh||k.length<n-1)return k.push([c,f]),this.size=++b.size,this;b=this.__data__=new Zo(k)}return b.set(c,f),this.size=b.size,this}Ei.prototype.clear=ux,Ei.prototype.delete=cx,Ei.prototype.get=lx,Ei.prototype.has=fx,Ei.prototype.set=hx;function n6(c,f){var b=ht(c),k=!b&&Ac(c),j=!b&&!k&&vu(c),W=!b&&!k&&!j&&jl(c),Q=b||k||j||W,ne=Q?Dh(c.length,nv):[],ue=ne.length;for(var Ce in c)(f||Ot.call(c,Ce))&&!(Q&&(Ce=="length"||j&&(Ce=="offset"||Ce=="parent")||W&&(Ce=="buffer"||Ce=="byteLength"||Ce=="byteOffset")||ea(Ce,ue)))&&ne.push(Ce);return ne}function r6(c){var f=c.length;return f?c[wv(0,f-1)]:e}function dx(c,f){return T0(is(c),wc(f,0,c.length))}function px(c){return T0(is(c))}function uv(c,f,b){(b!==e&&!Ai(c[f],b)||b===e&&!(f in c))&&no(c,f,b)}function Uh(c,f,b){var k=c[f];(!(Ot.call(c,f)&&Ai(k,b))||b===e&&!(f in c))&&no(c,f,b)}function b0(c,f){for(var b=c.length;b--;)if(Ai(c[b][0],f))return b;return-1}function mx(c,f,b,k){return du(c,function(j,W,Q){f(k,j,b(j),Q)}),k}function s6(c,f){return c&&so(f,Yn(f),c)}function gx(c,f){return c&&so(f,as(f),c)}function no(c,f,b){f=="__proto__"&&D?D(c,f,{configurable:!0,enumerable:!0,value:b,writable:!0}):c[f]=b}function cv(c,f){for(var b=-1,k=f.length,j=de(k),W=c==null;++b<k;)j[b]=W?e:Kv(c,f[b]);return j}function wc(c,f,b){return c===c&&(b!==e&&(c=c<=b?c:b),f!==e&&(c=c>=f?c:f)),c}function Ws(c,f,b,k,j,W){var Q,ne=f&h,ue=f&m,Ce=f&p;if(b&&(Q=j?b(c,k,j,W):b(c)),Q!==e)return Q;if(!fn(c))return c;var _e=ht(c);if(_e){if(Q=sP(c),!ne)return is(c,Q)}else{var Be=br(c),Ne=Be==Re||Be==Ve;if(vu(c))return B6(c,ne);if(Be==ct||Be==he||Ne&&!j){if(Q=ue||Ne?{}:z6(c),!ne)return ue?zx(c,gx(Q,c)):Gx(c,s6(Q,c))}else{if(!Zt[Be])return j?c:{};Q=iP(c,Be,ne)}}W||(W=new Ei);var Ge=W.get(c);if(Ge)return Ge;W.set(c,Q),A5(c)?c.forEach(function(rt){Q.add(Ws(rt,f,b,rt,c,W))}):E5(c)&&c.forEach(function(rt,Ft){Q.set(Ft,Ws(rt,f,b,Ft,c,W))});var it=Ce?ue?Iv:Bv:ue?as:Yn,Et=_e?e:it(c);return U(Et||c,function(rt,Ft){Et&&(Ft=rt,rt=c[Ft]),Uh(Q,Ft,Ws(rt,f,b,Ft,c,W))}),Q}function vx(c){var f=Yn(c);return function(b){return i6(b,c,f)}}function i6(c,f,b){var k=b.length;if(c==null)return!k;for(c=Kt(c);k--;){var j=b[k],W=f[j],Q=c[j];if(Q===e&&!(j in c)||!W(Q))return!1}return!0}function o6(c,f,b){if(typeof c!="function")throw new ss(i);return Gh(function(){c.apply(e,b)},f)}function Hh(c,f,b,k){var j=-1,W=cu,Q=!0,ne=c.length,ue=[],Ce=f.length;if(!ne)return ue;b&&(f=Wt(f,tr(b))),k?(W=ce,Q=!1):f.length>=n&&(W=Vo,Q=!1,f=new vc(f));e:for(;++j<ne;){var _e=c[j],Be=b==null?_e:b(_e);if(_e=k||_e!==0?_e:0,Q&&Be===Be){for(var Ne=Ce;Ne--;)if(f[Ne]===Be)continue e;ue.push(_e)}else W(f,Be,k)||ue.push(_e)}return ue}var du=k6(ro),a6=k6(fv,!0);function wx(c,f){var b=!0;return du(c,function(k,j,W){return b=!!f(k,j,W),b}),b}function A0(c,f,b){for(var k=-1,j=c.length;++k<j;){var W=c[k],Q=f(W);if(Q!=null&&(ne===e?Q===Q&&!Bs(Q):b(Q,ne)))var ne=Q,ue=W}return ue}function yx(c,f,b,k){var j=c.length;for(b=yt(b),b<0&&(b=-b>j?0:j+b),k=k===e||k>j?j:yt(k),k<0&&(k+=j),k=b>k?0:C5(k);b<k;)c[b++]=f;return c}function u6(c,f){var b=[];return du(c,function(k,j,W){f(k,j,W)&&b.push(k)}),b}function rr(c,f,b,k,j){var W=-1,Q=c.length;for(b||(b=aP),j||(j=[]);++W<Q;){var ne=c[W];f>0&&b(ne)?f>1?rr(ne,f-1,b,k,j):eo(j,ne):k||(j[j.length]=ne)}return j}var lv=T6(),c6=T6(!0);function ro(c,f){return c&&lv(c,f,Yn)}function fv(c,f){return c&&c6(c,f,Yn)}function S0(c,f){return On(f,function(b){return ta(c[b])})}function yc(c,f){f=mu(f,c);for(var b=0,k=f.length;c!=null&&b<k;)c=c[bi(f[b++])];return b&&b==k?c:e}function l6(c,f,b){var k=f(c);return ht(c)?k:eo(k,b(c))}function qr(c){return c==null?c===e?gi:Qe:Yo&&Yo in Kt(c)?tP(c):pP(c)}function hv(c,f){return c>f}function Ex(c,f){return c!=null&&Ot.call(c,f)}function bx(c,f){return c!=null&&f in Kt(c)}function Ax(c,f,b){return c>=Er(f,b)&&c<Nn(f,b)}function dv(c,f,b){for(var k=b?ce:cu,j=c[0].length,W=c.length,Q=W,ne=de(W),ue=1/0,Ce=[];Q--;){var _e=c[Q];Q&&f&&(_e=Wt(_e,tr(f))),ue=Er(_e.length,ue),ne[Q]=!b&&(f||j>=120&&_e.length>=120)?new vc(Q&&_e):e}_e=c[0];var Be=-1,Ne=ne[0];e:for(;++Be<j&&Ce.length<ue;){var Ge=_e[Be],it=f?f(Ge):Ge;if(Ge=b||Ge!==0?Ge:0,!(Ne?Vo(Ne,it):k(Ce,it,b))){for(Q=W;--Q;){var Et=ne[Q];if(!(Et?Vo(Et,it):k(c[Q],it,b)))continue e}Ne&&Ne.push(it),Ce.push(Ge)}}return Ce}function Sx(c,f,b,k){return ro(c,function(j,W,Q){f(k,b(j),W,Q)}),k}function Mh(c,f,b){f=mu(f,c),c=Z6(c,f);var k=c==null?c:c[bi(Xs(f))];return k==null?e:Hr(k,c,b)}function f6(c){return pn(c)&&qr(c)==he}function Cx(c){return pn(c)&&qr(c)==Te}function _x(c){return pn(c)&&qr(c)==se}function qh(c,f,b,k,j){return c===f?!0:c==null||f==null||!pn(c)&&!pn(f)?c!==c&&f!==f:Dx(c,f,b,k,qh,j)}function Dx(c,f,b,k,j,W){var Q=ht(c),ne=ht(f),ue=Q?De:br(c),Ce=ne?De:br(f);ue=ue==he?ct:ue,Ce=Ce==he?ct:Ce;var _e=ue==ct,Be=Ce==ct,Ne=ue==Ce;if(Ne&&vu(c)){if(!vu(f))return!1;Q=!0,_e=!1}if(Ne&&!_e)return W||(W=new Ei),Q||jl(c)?K6(c,f,b,k,j,W):Qx(c,f,ue,b,k,j,W);if(!(b&d)){var Ge=_e&&Ot.call(c,"__wrapped__"),it=Be&&Ot.call(f,"__wrapped__");if(Ge||it){var Et=Ge?c.value():c,rt=it?f.value():f;return W||(W=new Ei),j(Et,rt,b,k,W)}}return Ne?(W||(W=new Ei),eP(c,f,b,k,j,W)):!1}function Fx(c){return pn(c)&&br(c)==Oe}function pv(c,f,b,k){var j=b.length,W=j,Q=!k;if(c==null)return!W;for(c=Kt(c);j--;){var ne=b[j];if(Q&&ne[2]?ne[1]!==c[ne[0]]:!(ne[0]in c))return!1}for(;++j<W;){ne=b[j];var ue=ne[0],Ce=c[ue],_e=ne[1];if(Q&&ne[2]){if(Ce===e&&!(ue in c))return!1}else{var Be=new Ei;if(k)var Ne=k(Ce,_e,ue,c,f,Be);if(!(Ne===e?qh(_e,Ce,d|v,k,Be):Ne))return!1}}return!0}function h6(c){if(!fn(c)||cP(c))return!1;var f=ta(c)?iv:ts;return f.test(bc(c))}function Bx(c){return pn(c)&&qr(c)==wn}function Ix(c){return pn(c)&&br(c)==lt}function $x(c){return pn(c)&&H0(c.length)&&!!tn[qr(c)]}function d6(c){return typeof c=="function"?c:c==null?us:typeof c=="object"?ht(c)?g6(c[0],c[1]):m6(c):O5(c)}function mv(c){if(!Vh(c))return k$(c);var f=[];for(var b in Kt(c))Ot.call(c,b)&&b!="constructor"&&f.push(b);return f}function xx(c){if(!fn(c))return dP(c);var f=Vh(c),b=[];for(var k in c)k=="constructor"&&(f||!Ot.call(c,k))||b.push(k);return b}function gv(c,f){return c<f}function p6(c,f){var b=-1,k=os(c)?de(c.length):[];return du(c,function(j,W,Q){k[++b]=f(j,W,Q)}),k}function m6(c){var f=xv(c);return f.length==1&&f[0][2]?Y6(f[0][0],f[0][1]):function(b){return b===c||pv(b,c,f)}}function g6(c,f){return kv(c)&&W6(f)?Y6(bi(c),f):function(b){var k=Kv(b,c);return k===e&&k===f?Vv(b,c):qh(f,k,d|v)}}function C0(c,f,b,k,j){c!==f&&lv(f,function(W,Q){if(j||(j=new Ei),fn(W))Px(c,f,Q,b,C0,k,j);else{var ne=k?k(Rv(c,Q),W,Q+"",c,f,j):e;ne===e&&(ne=W),uv(c,Q,ne)}},as)}function Px(c,f,b,k,j,W,Q){var ne=Rv(c,b),ue=Rv(f,b),Ce=Q.get(ue);if(Ce){uv(c,b,Ce);return}var _e=W?W(ne,ue,b+"",c,f,Q):e,Be=_e===e;if(Be){var Ne=ht(ue),Ge=!Ne&&vu(ue),it=!Ne&&!Ge&&jl(ue);_e=ue,Ne||Ge||it?ht(ne)?_e=ne:bn(ne)?_e=is(ne):Ge?(Be=!1,_e=B6(ue,!0)):it?(Be=!1,_e=I6(ue,!0)):_e=[]:zh(ue)||Ac(ue)?(_e=ne,Ac(ne)?_e=_5(ne):(!fn(ne)||ta(ne))&&(_e=z6(ue))):Be=!1}Be&&(Q.set(ue,_e),j(_e,ue,k,W,Q),Q.delete(ue)),uv(c,b,_e)}function v6(c,f){var b=c.length;if(b)return f+=f<0?b:0,ea(f,b)?c[f]:e}function w6(c,f,b){f.length?f=Wt(f,function(W){return ht(W)?function(Q){return yc(Q,W.length===1?W[0]:W)}:W}):f=[us];var k=-1;f=Wt(f,tr(st()));var j=p6(c,function(W,Q,ne){var ue=Wt(f,function(Ce){return Ce(W)});return{criteria:ue,index:++k,value:W}});return o0(j,function(W,Q){return Vx(W,Q,b)})}function kx(c,f){return y6(c,f,function(b,k){return Vv(c,k)})}function y6(c,f,b){for(var k=-1,j=f.length,W={};++k<j;){var Q=f[k],ne=yc(c,Q);b(ne,Q)&&jh(W,mu(Q,c),ne)}return W}function Tx(c){return function(f){return yc(f,c)}}function vv(c,f,b,k){var j=k?wi:lu,W=-1,Q=f.length,ne=c;for(c===f&&(f=is(f)),b&&(ne=Wt(c,tr(b)));++W<Q;)for(var ue=0,Ce=f[W],_e=b?b(Ce):Ce;(ue=j(ne,_e,ue,k))>-1;)ne!==c&&Rl.call(ne,ue,1),Rl.call(c,ue,1);return c}function E6(c,f){for(var b=c?f.length:0,k=b-1;b--;){var j=f[b];if(b==k||j!==W){var W=j;ea(j)?Rl.call(c,j,1):bv(c,j)}}return c}function wv(c,f){return c+ge(e6()*(f-c+1))}function Rx(c,f,b,k){for(var j=-1,W=Nn(fe((f-c)/(b||1)),0),Q=de(W);W--;)Q[k?W:++j]=c,c+=b;return Q}function yv(c,f){var b="";if(!c||f<1||f>M)return b;do f%2&&(b+=c),f=ge(f/2),f&&(c+=c);while(f);return b}function At(c,f){return Ov(X6(c,f,us),c+"")}function Ox(c){return r6(Kl(c))}function Nx(c,f){var b=Kl(c);return T0(b,wc(f,0,b.length))}function jh(c,f,b,k){if(!fn(c))return c;f=mu(f,c);for(var j=-1,W=f.length,Q=W-1,ne=c;ne!=null&&++j<W;){var ue=bi(f[j]),Ce=b;if(ue==="__proto__"||ue==="constructor"||ue==="prototype")return c;if(j!=Q){var _e=ne[ue];Ce=k?k(_e,ue,ne):e,Ce===e&&(Ce=fn(_e)?_e:ea(f[j+1])?[]:{})}Uh(ne,ue,Ce),ne=ne[ue]}return c}var b6=w0?function(c,f){return w0.set(c,f),c}:us,Lx=D?function(c,f){return D(c,"toString",{configurable:!0,enumerable:!1,value:zv(f),writable:!0})}:us;function Ux(c){return T0(Kl(c))}function Ys(c,f,b){var k=-1,j=c.length;f<0&&(f=-f>j?0:j+f),b=b>j?j:b,b<0&&(b+=j),j=f>b?0:b-f>>>0,f>>>=0;for(var W=de(j);++k<j;)W[k]=c[k+f];return W}function Hx(c,f){var b;return du(c,function(k,j,W){return b=f(k,j,W),!b}),!!b}function _0(c,f,b){var k=0,j=c==null?k:c.length;if(typeof f=="number"&&f===f&&j<=ae){for(;k<j;){var W=k+j>>>1,Q=c[W];Q!==null&&!Bs(Q)&&(b?Q<=f:Q<f)?k=W+1:j=W}return j}return Ev(c,f,us,b)}function Ev(c,f,b,k){var j=0,W=c==null?0:c.length;if(W===0)return 0;f=b(f);for(var Q=f!==f,ne=f===null,ue=Bs(f),Ce=f===e;j<W;){var _e=ge((j+W)/2),Be=b(c[_e]),Ne=Be!==e,Ge=Be===null,it=Be===Be,Et=Bs(Be);if(Q)var rt=k||it;else Ce?rt=it&&(k||Ne):ne?rt=it&&Ne&&(k||!Ge):ue?rt=it&&Ne&&!Ge&&(k||!Et):Ge||Et?rt=!1:rt=k?Be<=f:Be<f;rt?j=_e+1:W=_e}return Er(W,te)}function A6(c,f){for(var b=-1,k=c.length,j=0,W=[];++b<k;){var Q=c[b],ne=f?f(Q):Q;if(!b||!Ai(ne,ue)){var ue=ne;W[j++]=Q===0?0:Q}}return W}function S6(c){return typeof c=="number"?c:Bs(c)?V:+c}function Fs(c){if(typeof c=="string")return c;if(ht(c))return Wt(c,Fs)+"";if(Bs(c))return t6?t6.call(c):"";var f=c+"";return f=="0"&&1/c==-P?"-0":f}function pu(c,f,b){var k=-1,j=cu,W=c.length,Q=!0,ne=[],ue=ne;if(b)Q=!1,j=ce;else if(W>=n){var Ce=f?null:Zx(c);if(Ce)return Go(Ce);Q=!1,j=Vo,ue=new vc}else ue=f?[]:ne;e:for(;++k<W;){var _e=c[k],Be=f?f(_e):_e;if(_e=b||_e!==0?_e:0,Q&&Be===Be){for(var Ne=ue.length;Ne--;)if(ue[Ne]===Be)continue e;f&&ue.push(Be),ne.push(_e)}else j(ue,Be,b)||(ue!==ne&&ue.push(Be),ne.push(_e))}return ne}function bv(c,f){f=mu(f,c);var b=-1,k=f.length;if(!k)return!0;for(;++b<k;){var j=bi(f[b]);if(j==="__proto__"&&!Ot.call(c,"__proto__")||(j==="constructor"||j==="prototype")&&b<k-1)return!1}var W=Z6(c,f);return W==null||delete W[bi(Xs(f))]}function C6(c,f,b,k){return jh(c,f,b(yc(c,f)),k)}function D0(c,f,b,k){for(var j=c.length,W=k?j:-1;(k?W--:++W<j)&&f(c[W],W,c););return b?Ys(c,k?0:W,k?W+1:j):Ys(c,k?W+1:0,k?j:W)}function _6(c,f){var b=c;return b instanceof Bt&&(b=b.value()),i0(f,function(k,j){return j.func.apply(j.thisArg,eo([k],j.args))},b)}function Av(c,f,b){var k=c.length;if(k<2)return k?pu(c[0]):[];for(var j=-1,W=de(k);++j<k;)for(var Q=c[j],ne=-1;++ne<k;)ne!=j&&(W[j]=Hh(W[j]||Q,c[ne],f,b));return pu(rr(W,1),f,b)}function D6(c,f,b){for(var k=-1,j=c.length,W=f.length,Q={};++k<j;){var ne=k<W?f[k]:e;b(Q,c[k],ne)}return Q}function Sv(c){return bn(c)?c:[]}function Cv(c){return typeof c=="function"?c:us}function mu(c,f){return ht(c)?c:kv(c,f)?[c]:t5(Vt(c))}var Mx=At;function gu(c,f,b){var k=c.length;return b=b===e?k:b,!f&&b>=k?c:Ys(c,f,b)}var F6=G||function(c){return $n.clearTimeout(c)};function B6(c,f){if(f)return c.slice();var b=c.length,k=g0?g0(b):new c.constructor(b);return c.copy(k),k}function _v(c){var f=new c.constructor(c.byteLength);return new kl(f).set(new kl(c)),f}function qx(c,f){var b=f?_v(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.byteLength)}function jx(c){var f=new c.constructor(c.source,Vs.exec(c));return f.lastIndex=c.lastIndex,f}function Kx(c){return Lh?Kt(Lh.call(c)):{}}function I6(c,f){var b=f?_v(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.length)}function $6(c,f){if(c!==f){var b=c!==e,k=c===null,j=c===c,W=Bs(c),Q=f!==e,ne=f===null,ue=f===f,Ce=Bs(f);if(!ne&&!Ce&&!W&&c>f||W&&Q&&ue&&!ne&&!Ce||k&&Q&&ue||!b&&ue||!j)return 1;if(!k&&!W&&!Ce&&c<f||Ce&&b&&j&&!k&&!W||ne&&b&&j||!Q&&j||!ue)return-1}return 0}function Vx(c,f,b){for(var k=-1,j=c.criteria,W=f.criteria,Q=j.length,ne=b.length;++k<Q;){var ue=$6(j[k],W[k]);if(ue){if(k>=ne)return ue;var Ce=b[k];return ue*(Ce=="desc"?-1:1)}}return c.index-f.index}function x6(c,f,b,k){for(var j=-1,W=c.length,Q=b.length,ne=-1,ue=f.length,Ce=Nn(W-Q,0),_e=de(ue+Ce),Be=!k;++ne<ue;)_e[ne]=f[ne];for(;++j<Q;)(Be||j<W)&&(_e[b[j]]=c[j]);for(;Ce--;)_e[ne++]=c[j++];return _e}function P6(c,f,b,k){for(var j=-1,W=c.length,Q=-1,ne=b.length,ue=-1,Ce=f.length,_e=Nn(W-ne,0),Be=de(_e+Ce),Ne=!k;++j<_e;)Be[j]=c[j];for(var Ge=j;++ue<Ce;)Be[Ge+ue]=f[ue];for(;++Q<ne;)(Ne||j<W)&&(Be[Ge+b[Q]]=c[j++]);return Be}function is(c,f){var b=-1,k=c.length;for(f||(f=de(k));++b<k;)f[b]=c[b];return f}function so(c,f,b,k){var j=!b;b||(b={});for(var W=-1,Q=f.length;++W<Q;){var ne=f[W],ue=k?k(b[ne],c[ne],ne,b,c):e;ue===e&&(ue=c[ne]),j?no(b,ne,ue):Uh(b,ne,ue)}return b}function Gx(c,f){return so(c,Pv(c),f)}function zx(c,f){return so(c,V6(c),f)}function F0(c,f){return function(b,k){var j=ht(b)?z2:mx,W=f?f():{};return j(b,c,st(k,2),W)}}function Hl(c){return At(function(f,b){var k=-1,j=b.length,W=j>1?b[j-1]:e,Q=j>2?b[2]:e;for(W=c.length>3&&typeof W=="function"?(j--,W):e,Q&&jr(b[0],b[1],Q)&&(W=j<3?e:W,j=1),f=Kt(f);++k<j;){var ne=b[k];ne&&c(f,ne,k,W)}return f})}function k6(c,f){return function(b,k){if(b==null)return b;if(!os(b))return c(b,k);for(var j=b.length,W=f?j:-1,Q=Kt(b);(f?W--:++W<j)&&k(Q[W],W,Q)!==!1;);return b}}function T6(c){return function(f,b,k){for(var j=-1,W=Kt(f),Q=k(f),ne=Q.length;ne--;){var ue=Q[c?ne:++j];if(b(W[ue],ue,W)===!1)break}return f}}function Wx(c,f,b){var k=f&g,j=Kh(c);function W(){var Q=this&&this!==$n&&this instanceof W?j:c;return Q.apply(k?b:this,arguments)}return W}function R6(c){return function(f){f=Vt(f);var b=hu(f)?Mr(f):e,k=b?b[0]:f.charAt(0),j=b?gu(b,1).join(""):f.slice(1);return k[c]()+j}}function Ml(c){return function(f){return i0(T5(k5(f).replace(k2,"")),c,"")}}function Kh(c){return function(){var f=arguments;switch(f.length){case 0:return new c;case 1:return new c(f[0]);case 2:return new c(f[0],f[1]);case 3:return new c(f[0],f[1],f[2]);case 4:return new c(f[0],f[1],f[2],f[3]);case 5:return new c(f[0],f[1],f[2],f[3],f[4]);case 6:return new c(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return new c(f[0],f[1],f[2],f[3],f[4],f[5],f[6])}var b=Ul(c.prototype),k=c.apply(b,f);return fn(k)?k:b}}function Yx(c,f,b){var k=Kh(c);function j(){for(var W=arguments.length,Q=de(W),ne=W,ue=ql(j);ne--;)Q[ne]=arguments[ne];var Ce=W<3&&Q[0]!==ue&&Q[W-1]!==ue?[]:nr(Q,ue);if(W-=Ce.length,W<b)return H6(c,f,B0,j.placeholder,e,Q,Ce,e,e,b-W);var _e=this&&this!==$n&&this instanceof j?k:c;return Hr(_e,this,Q)}return j}function O6(c){return function(f,b,k){var j=Kt(f);if(!os(f)){var W=st(b,3);f=Yn(f),b=function(ne){return W(j[ne],ne,j)}}var Q=c(f,b,k);return Q>-1?j[W?f[Q]:Q]:e}}function N6(c){return Qo(function(f){var b=f.length,k=b,j=zs.prototype.thru;for(c&&f.reverse();k--;){var W=f[k];if(typeof W!="function")throw new ss(i);if(j&&!Q&&P0(W)=="wrapper")var Q=new zs([],!0)}for(k=Q?k:b;++k<b;){W=f[k];var ne=P0(W),ue=ne=="wrapper"?$v(W):e;ue&&Tv(ue[0])&&ue[1]==(H|E|_|K)&&!ue[4].length&&ue[9]==1?Q=Q[P0(ue[0])].apply(Q,ue[3]):Q=W.length==1&&Tv(W)?Q[ne]():Q.thru(W)}return function(){var Ce=arguments,_e=Ce[0];if(Q&&Ce.length==1&&ht(_e))return Q.plant(_e).value();for(var Be=0,Ne=b?f[Be].apply(this,Ce):_e;++Be<b;)Ne=f[Be].call(this,Ne);return Ne}})}function B0(c,f,b,k,j,W,Q,ne,ue,Ce){var _e=f&H,Be=f&g,Ne=f&y,Ge=f&(E|C),it=f&S,Et=Ne?e:Kh(c);function rt(){for(var Ft=arguments.length,xt=de(Ft),Is=Ft;Is--;)xt[Is]=arguments[Is];if(Ge)var Kr=ql(rt),$s=$h(xt,Kr);if(k&&(xt=x6(xt,k,j,Ge)),W&&(xt=P6(xt,W,Q,Ge)),Ft-=$s,Ge&&Ft<Ce){var An=nr(xt,Kr);return H6(c,f,B0,rt.placeholder,b,xt,An,ne,ue,Ce-Ft)}var Si=Be?b:this,ra=Ne?Si[c]:c;return Ft=xt.length,ne?xt=mP(xt,ne):it&&Ft>1&&xt.reverse(),_e&&ue<Ft&&(xt.length=ue),this&&this!==$n&&this instanceof rt&&(ra=Et||Kh(ra)),ra.apply(Si,xt)}return rt}function L6(c,f){return function(b,k){return Sx(b,c,f(k),{})}}function I0(c,f){return function(b,k){var j;if(b===e&&k===e)return f;if(b!==e&&(j=b),k!==e){if(j===e)return k;typeof b=="string"||typeof k=="string"?(b=Fs(b),k=Fs(k)):(b=S6(b),k=S6(k)),j=c(b,k)}return j}}function Dv(c){return Qo(function(f){return f=Wt(f,tr(st())),At(function(b){var k=this;return c(f,function(j){return Hr(j,k,b)})})})}function $0(c,f){f=f===e?" ":Fs(f);var b=f.length;if(b<2)return b?yv(f,c):f;var k=yv(f,fe(c/zo(f)));return hu(f)?gu(Mr(k),0,c).join(""):k.slice(0,c)}function Xx(c,f,b,k){var j=f&g,W=Kh(c);function Q(){for(var ne=-1,ue=arguments.length,Ce=-1,_e=k.length,Be=de(_e+ue),Ne=this&&this!==$n&&this instanceof Q?W:c;++Ce<_e;)Be[Ce]=k[Ce];for(;ue--;)Be[Ce++]=arguments[++ne];return Hr(Ne,j?b:this,Be)}return Q}function U6(c){return function(f,b,k){return k&&typeof k!="number"&&jr(f,b,k)&&(b=k=e),f=na(f),b===e?(b=f,f=0):b=na(b),k=k===e?f<b?1:-1:na(k),Rx(f,b,k,c)}}function x0(c){return function(f,b){return typeof f=="string"&&typeof b=="string"||(f=Zs(f),b=Zs(b)),c(f,b)}}function H6(c,f,b,k,j,W,Q,ne,ue,Ce){var _e=f&E,Be=_e?Q:e,Ne=_e?e:Q,Ge=_e?W:e,it=_e?e:W;f|=_e?_:F,f&=~(_e?F:_),f&w||(f&=~(g|y));var Et=[c,f,j,Ge,Be,it,Ne,ne,ue,Ce],rt=b.apply(e,Et);return Tv(c)&&J6(rt,Et),rt.placeholder=k,Q6(rt,c,f)}function Fv(c){var f=yn[c];return function(b,k){if(b=Zs(b),k=k==null?0:Er(yt(k),292),k&&QS(b)){var j=(Vt(b)+"e").split("e"),W=f(j[0]+"e"+(+j[1]+k));return j=(Vt(W)+"e").split("e"),+(j[0]+"e"+(+j[1]-k))}return f(b)}}var Zx=Nl&&1/Go(new Nl([,-0]))[1]==P?function(c){return new Nl(c)}:Xv;function M6(c){return function(f){var b=br(f);return b==Oe?Wn(f):b==lt?f0(f):a0(f,c(f))}}function Jo(c,f,b,k,j,W,Q,ne){var ue=f&y;if(!ue&&typeof c!="function")throw new ss(i);var Ce=k?k.length:0;if(Ce||(f&=~(_|F),k=j=e),Q=Q===e?Q:Nn(yt(Q),0),ne=ne===e?ne:yt(ne),Ce-=j?j.length:0,f&F){var _e=k,Be=j;k=j=e}var Ne=ue?e:$v(c),Ge=[c,f,b,k,j,_e,Be,W,Q,ne];if(Ne&&hP(Ge,Ne),c=Ge[0],f=Ge[1],b=Ge[2],k=Ge[3],j=Ge[4],ne=Ge[9]=Ge[9]===e?ue?0:c.length:Nn(Ge[9]-Ce,0),!ne&&f&(E|C)&&(f&=~(E|C)),!f||f==g)var it=Wx(c,f,b);else f==E||f==C?it=Yx(c,f,ne):(f==_||f==(g|_))&&!j.length?it=Xx(c,f,b,k):it=B0.apply(e,Ge);var Et=Ne?b6:J6;return Q6(Et(it,Ge),c,f)}function q6(c,f,b,k){return c===e||Ai(c,Ds[b])&&!Ot.call(k,b)?f:c}function j6(c,f,b,k,j,W){return fn(c)&&fn(f)&&(W.set(f,c),C0(c,f,e,j6,W),W.delete(f)),c}function Jx(c){return zh(c)?e:c}function K6(c,f,b,k,j,W){var Q=b&d,ne=c.length,ue=f.length;if(ne!=ue&&!(Q&&ue>ne))return!1;var Ce=W.get(c),_e=W.get(f);if(Ce&&_e)return Ce==f&&_e==c;var Be=-1,Ne=!0,Ge=b&v?new vc:e;for(W.set(c,f),W.set(f,c);++Be<ne;){var it=c[Be],Et=f[Be];if(k)var rt=Q?k(Et,it,Be,f,c,W):k(it,Et,Be,c,f,W);if(rt!==e){if(rt)continue;Ne=!1;break}if(Ge){if(!nn(f,function(Ft,xt){if(!Vo(Ge,xt)&&(it===Ft||j(it,Ft,b,k,W)))return Ge.push(xt)})){Ne=!1;break}}else if(!(it===Et||j(it,Et,b,k,W))){Ne=!1;break}}return W.delete(c),W.delete(f),Ne}function Qx(c,f,b,k,j,W,Q){switch(b){case un:if(c.byteLength!=f.byteLength||c.byteOffset!=f.byteOffset)return!1;c=c.buffer,f=f.buffer;case Te:return!(c.byteLength!=f.byteLength||!W(new kl(c),new kl(f)));case Ie:case se:case pt:return Ai(+c,+f);case Fe:return c.name==f.name&&c.message==f.message;case wn:case Tn:return c==f+"";case Oe:var ne=Wn;case lt:var ue=k&d;if(ne||(ne=Go),c.size!=f.size&&!ue)return!1;var Ce=Q.get(c);if(Ce)return Ce==f;k|=v,Q.set(c,f);var _e=K6(ne(c),ne(f),k,j,W,Q);return Q.delete(c),_e;case es:if(Lh)return Lh.call(c)==Lh.call(f)}return!1}function eP(c,f,b,k,j,W){var Q=b&d,ne=Bv(c),ue=ne.length,Ce=Bv(f),_e=Ce.length;if(ue!=_e&&!Q)return!1;for(var Be=ue;Be--;){var Ne=ne[Be];if(!(Q?Ne in f:Ot.call(f,Ne)))return!1}var Ge=W.get(c),it=W.get(f);if(Ge&&it)return Ge==f&&it==c;var Et=!0;W.set(c,f),W.set(f,c);for(var rt=Q;++Be<ue;){Ne=ne[Be];var Ft=c[Ne],xt=f[Ne];if(k)var Is=Q?k(xt,Ft,Ne,f,c,W):k(Ft,xt,Ne,c,f,W);if(!(Is===e?Ft===xt||j(Ft,xt,b,k,W):Is)){Et=!1;break}rt||(rt=Ne=="constructor")}if(Et&&!rt){var Kr=c.constructor,$s=f.constructor;Kr!=$s&&"constructor"in c&&"constructor"in f&&!(typeof Kr=="function"&&Kr instanceof Kr&&typeof $s=="function"&&$s instanceof $s)&&(Et=!1)}return W.delete(c),W.delete(f),Et}function Qo(c){return Ov(X6(c,e,i5),c+"")}function Bv(c){return l6(c,Yn,Pv)}function Iv(c){return l6(c,as,V6)}var $v=w0?function(c){return w0.get(c)}:Xv;function P0(c){for(var f=c.name+"",b=Ll[f],k=Ot.call(Ll,f)?b.length:0;k--;){var j=b[k],W=j.func;if(W==null||W==c)return j.name}return f}function ql(c){var f=Ot.call(z,"placeholder")?z:c;return f.placeholder}function st(){var c=z.iteratee||Wv;return c=c===Wv?d6:c,arguments.length?c(arguments[0],arguments[1]):c}function k0(c,f){var b=c.__data__;return uP(f)?b[typeof f=="string"?"string":"hash"]:b.map}function xv(c){for(var f=Yn(c),b=f.length;b--;){var k=f[b],j=c[k];f[b]=[k,j,W6(j)]}return f}function Ec(c,f){var b=l0(c,f);return h6(b)?b:e}function tP(c){var f=Ot.call(c,Yo),b=c[Yo];try{c[Yo]=e;var k=!0}catch{}var j=xl.call(c);return k&&(f?c[Yo]=b:delete c[Yo]),j}var Pv=Ht?function(c){return c==null?[]:(c=Kt(c),On(Ht(c),function(f){return Yt.call(c,f)}))}:Zv,V6=Ht?function(c){for(var f=[];c;)eo(f,Pv(c)),c=Tl(c);return f}:Zv,br=qr;(ov&&br(new ov(new ArrayBuffer(1)))!=un||Rh&&br(new Rh)!=Oe||av&&br(av.resolve())!=gr||Nl&&br(new Nl)!=lt||Oh&&br(new Oh)!=Dt)&&(br=function(c){var f=qr(c),b=f==ct?c.constructor:e,k=b?bc(b):"";if(k)switch(k){case N$:return un;case L$:return Oe;case U$:return gr;case H$:return lt;case M$:return Dt}return f});function nP(c,f,b){for(var k=-1,j=b.length;++k<j;){var W=b[k],Q=W.size;switch(W.type){case"drop":c+=Q;break;case"dropRight":f-=Q;break;case"take":f=Er(f,c+Q);break;case"takeRight":c=Nn(c,f-Q);break}}return{start:c,end:f}}function rP(c){var f=c.match(Me);return f?f[1].split(et):[]}function G6(c,f,b){f=mu(f,c);for(var k=-1,j=f.length,W=!1;++k<j;){var Q=bi(f[k]);if(!(W=c!=null&&b(c,Q)))break;c=c[Q]}return W||++k!=j?W:(j=c==null?0:c.length,!!j&&H0(j)&&ea(Q,j)&&(ht(c)||Ac(c)))}function sP(c){var f=c.length,b=new c.constructor(f);return f&&typeof c[0]=="string"&&Ot.call(c,"index")&&(b.index=c.index,b.input=c.input),b}function z6(c){return typeof c.constructor=="function"&&!Vh(c)?Ul(Tl(c)):{}}function iP(c,f,b){var k=c.constructor;switch(f){case Te:return _v(c);case Ie:case se:return new k(+c);case un:return qx(c,b);case Or:case mt:case cc:case Nr:case Se:case tu:case Lt:case vr:case Xi:return I6(c,b);case Oe:return new k;case pt:case Tn:return new k(c);case wn:return jx(c);case lt:return new k;case es:return Kx(c)}}function oP(c,f){var b=f.length;if(!b)return c;var k=b-1;return f[k]=(b>1?"& ":"")+f[k],f=f.join(b>2?", ":" "),c.replace(je,`{
/* [wrapped with `+f+`] */
`)}function aP(c){return ht(c)||Ac(c)||!!(Ol&&c&&c[Ol])}function ea(c,f){var b=typeof c;return f=f??M,!!f&&(b=="number"||b!="symbol"&&Ur.test(c))&&c>-1&&c%1==0&&c<f}function jr(c,f,b){if(!fn(b))return!1;var k=typeof f;return(k=="number"?os(b)&&ea(f,b.length):k=="string"&&f in b)?Ai(b[f],c):!1}function kv(c,f){if(ht(c))return!1;var b=typeof c;return b=="number"||b=="symbol"||b=="boolean"||c==null||Bs(c)?!0:lh.test(c)||!su.test(c)||f!=null&&c in Kt(f)}function uP(c){var f=typeof c;return f=="string"||f=="number"||f=="symbol"||f=="boolean"?c!=="__proto__":c===null}function Tv(c){var f=P0(c),b=z[f];if(typeof b!="function"||!(f in Bt.prototype))return!1;if(c===b)return!0;var k=$v(b);return!!k&&c===k[0]}function cP(c){return!!m0&&m0 in c}var lP=$l?ta:Jv;function Vh(c){var f=c&&c.constructor,b=typeof f=="function"&&f.prototype||Ds;return c===b}function W6(c){return c===c&&!fn(c)}function Y6(c,f){return function(b){return b==null?!1:b[c]===f&&(f!==e||c in Kt(b))}}function fP(c){var f=L0(c,function(k){return b.size===u&&b.clear(),k}),b=f.cache;return f}function hP(c,f){var b=c[1],k=f[1],j=b|k,W=j<(g|y|H),Q=k==H&&b==E||k==H&&b==K&&c[7].length<=f[8]||k==(H|K)&&f[7].length<=f[8]&&b==E;if(!(W||Q))return c;k&g&&(c[2]=f[2],j|=b&g?0:w);var ne=f[3];if(ne){var ue=c[3];c[3]=ue?x6(ue,ne,f[4]):ne,c[4]=ue?nr(c[3],l):f[4]}return ne=f[5],ne&&(ue=c[5],c[5]=ue?P6(ue,ne,f[6]):ne,c[6]=ue?nr(c[5],l):f[6]),ne=f[7],ne&&(c[7]=ne),k&H&&(c[8]=c[8]==null?f[8]:Er(c[8],f[8])),c[9]==null&&(c[9]=f[9]),c[0]=f[0],c[1]=j,c}function dP(c){var f=[];if(c!=null)for(var b in Kt(c))f.push(b);return f}function pP(c){return xl.call(c)}function X6(c,f,b){return f=Nn(f===e?c.length-1:f,0),function(){for(var k=arguments,j=-1,W=Nn(k.length-f,0),Q=de(W);++j<W;)Q[j]=k[f+j];j=-1;for(var ne=de(f+1);++j<f;)ne[j]=k[j];return ne[f]=b(Q),Hr(c,this,ne)}}function Z6(c,f){return f.length<2?c:yc(c,Ys(f,0,-1))}function mP(c,f){for(var b=c.length,k=Er(f.length,b),j=is(c);k--;){var W=f[k];c[k]=ea(W,b)?j[W]:e}return c}function Rv(c,f){if(!(f==="constructor"&&typeof c[f]=="function")&&f!="__proto__")return c[f]}var J6=e5(b6),Gh=Z||function(c,f){return $n.setTimeout(c,f)},Ov=e5(Lx);function Q6(c,f,b){var k=f+"";return Ov(c,oP(k,gP(rP(k),b)))}function e5(c){var f=0,b=0;return function(){var k=T$(),j=T-(k-b);if(b=k,j>0){if(++f>=L)return arguments[0]}else f=0;return c.apply(e,arguments)}}function T0(c,f){var b=-1,k=c.length,j=k-1;for(f=f===e?k:f;++b<f;){var W=wv(b,j),Q=c[W];c[W]=c[b],c[b]=Q}return c.length=f,c}var t5=fP(function(c){var f=[];return c.charCodeAt(0)===46&&f.push(""),c.replace(Dl,function(b,k,j,W){f.push(j?W.replace(Rn,"$1"):k||b)}),f});function bi(c){if(typeof c=="string"||Bs(c))return c;var f=c+"";return f=="0"&&1/c==-P?"-0":f}function bc(c){if(c!=null){try{return Wo.call(c)}catch{}try{return c+""}catch{}}return""}function gP(c,f){return U(me,function(b){var k="_."+b[0];f&b[1]&&!cu(c,k)&&c.push(k)}),c.sort()}function n5(c){if(c instanceof Bt)return c.clone();var f=new zs(c.__wrapped__,c.__chain__);return f.__actions__=is(c.__actions__),f.__index__=c.__index__,f.__values__=c.__values__,f}function vP(c,f,b){(b?jr(c,f,b):f===e)?f=1:f=Nn(yt(f),0);var k=c==null?0:c.length;if(!k||f<1)return[];for(var j=0,W=0,Q=de(fe(k/f));j<k;)Q[W++]=Ys(c,j,j+=f);return Q}function wP(c){for(var f=-1,b=c==null?0:c.length,k=0,j=[];++f<b;){var W=c[f];W&&(j[k++]=W)}return j}function yP(){var c=arguments.length;if(!c)return[];for(var f=de(c-1),b=arguments[0],k=c;k--;)f[k-1]=arguments[k];return eo(ht(b)?is(b):[b],rr(f,1))}var EP=At(function(c,f){return bn(c)?Hh(c,rr(f,1,bn,!0)):[]}),bP=At(function(c,f){var b=Xs(f);return bn(b)&&(b=e),bn(c)?Hh(c,rr(f,1,bn,!0),st(b,2)):[]}),AP=At(function(c,f){var b=Xs(f);return bn(b)&&(b=e),bn(c)?Hh(c,rr(f,1,bn,!0),e,b):[]});function SP(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),Ys(c,f<0?0:f,k)):[]}function CP(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),f=k-f,Ys(c,0,f<0?0:f)):[]}function _P(c,f){return c&&c.length?D0(c,st(f,3),!0,!0):[]}function DP(c,f){return c&&c.length?D0(c,st(f,3),!0):[]}function FP(c,f,b,k){var j=c==null?0:c.length;return j?(b&&typeof b!="number"&&jr(c,f,b)&&(b=0,k=j),yx(c,f,b,k)):[]}function r5(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=b==null?0:yt(b);return j<0&&(j=Nn(k+j,0)),Il(c,st(f,3),j)}function s5(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=k-1;return b!==e&&(j=yt(b),j=b<0?Nn(k+j,0):Er(j,k-1)),Il(c,st(f,3),j,!0)}function i5(c){var f=c==null?0:c.length;return f?rr(c,1):[]}function BP(c){var f=c==null?0:c.length;return f?rr(c,P):[]}function IP(c,f){var b=c==null?0:c.length;return b?(f=f===e?1:yt(f),rr(c,f)):[]}function $P(c){for(var f=-1,b=c==null?0:c.length,k={};++f<b;){var j=c[f];no(k,j[0],j[1])}return k}function o5(c){return c&&c.length?c[0]:e}function xP(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=b==null?0:yt(b);return j<0&&(j=Nn(k+j,0)),lu(c,f,j)}function PP(c){var f=c==null?0:c.length;return f?Ys(c,0,-1):[]}var kP=At(function(c){var f=Wt(c,Sv);return f.length&&f[0]===c[0]?dv(f):[]}),TP=At(function(c){var f=Xs(c),b=Wt(c,Sv);return f===Xs(b)?f=e:b.pop(),b.length&&b[0]===c[0]?dv(b,st(f,2)):[]}),RP=At(function(c){var f=Xs(c),b=Wt(c,Sv);return f=typeof f=="function"?f:e,f&&b.pop(),b.length&&b[0]===c[0]?dv(b,e,f):[]});function OP(c,f){return c==null?"":P$.call(c,f)}function Xs(c){var f=c==null?0:c.length;return f?c[f-1]:e}function NP(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=k;return b!==e&&(j=yt(b),j=j<0?Nn(k+j,0):Er(j,k-1)),f===f?h0(c,f,j):Il(c,Ah,j,!0)}function LP(c,f){return c&&c.length?v6(c,yt(f)):e}var UP=At(a5);function a5(c,f){return c&&c.length&&f&&f.length?vv(c,f):c}function HP(c,f,b){return c&&c.length&&f&&f.length?vv(c,f,st(b,2)):c}function MP(c,f,b){return c&&c.length&&f&&f.length?vv(c,f,e,b):c}var qP=Qo(function(c,f){var b=c==null?0:c.length,k=cv(c,f);return E6(c,Wt(f,function(j){return ea(j,b)?+j:j}).sort($6)),k});function jP(c,f){var b=[];if(!(c&&c.length))return b;var k=-1,j=[],W=c.length;for(f=st(f,3);++k<W;){var Q=c[k];f(Q,k,c)&&(b.push(Q),j.push(k))}return E6(c,j),b}function Nv(c){return c==null?c:O$.call(c)}function KP(c,f,b){var k=c==null?0:c.length;return k?(b&&typeof b!="number"&&jr(c,f,b)?(f=0,b=k):(f=f==null?0:yt(f),b=b===e?k:yt(b)),Ys(c,f,b)):[]}function VP(c,f){return _0(c,f)}function GP(c,f,b){return Ev(c,f,st(b,2))}function zP(c,f){var b=c==null?0:c.length;if(b){var k=_0(c,f);if(k<b&&Ai(c[k],f))return k}return-1}function WP(c,f){return _0(c,f,!0)}function YP(c,f,b){return Ev(c,f,st(b,2),!0)}function XP(c,f){var b=c==null?0:c.length;if(b){var k=_0(c,f,!0)-1;if(Ai(c[k],f))return k}return-1}function ZP(c){return c&&c.length?A6(c):[]}function JP(c,f){return c&&c.length?A6(c,st(f,2)):[]}function QP(c){var f=c==null?0:c.length;return f?Ys(c,1,f):[]}function ek(c,f,b){return c&&c.length?(f=b||f===e?1:yt(f),Ys(c,0,f<0?0:f)):[]}function tk(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),f=k-f,Ys(c,f<0?0:f,k)):[]}function nk(c,f){return c&&c.length?D0(c,st(f,3),!1,!0):[]}function rk(c,f){return c&&c.length?D0(c,st(f,3)):[]}var sk=At(function(c){return pu(rr(c,1,bn,!0))}),ik=At(function(c){var f=Xs(c);return bn(f)&&(f=e),pu(rr(c,1,bn,!0),st(f,2))}),ok=At(function(c){var f=Xs(c);return f=typeof f=="function"?f:e,pu(rr(c,1,bn,!0),e,f)});function ak(c){return c&&c.length?pu(c):[]}function uk(c,f){return c&&c.length?pu(c,st(f,2)):[]}function ck(c,f){return f=typeof f=="function"?f:e,c&&c.length?pu(c,e,f):[]}function Lv(c){if(!(c&&c.length))return[];var f=0;return c=On(c,function(b){if(bn(b))return f=Nn(b.length,f),!0}),Dh(f,function(b){return Wt(c,Ae(b))})}function u5(c,f){if(!(c&&c.length))return[];var b=Lv(c);return f==null?b:Wt(b,function(k){return Hr(f,e,k)})}var lk=At(function(c,f){return bn(c)?Hh(c,f):[]}),fk=At(function(c){return Av(On(c,bn))}),hk=At(function(c){var f=Xs(c);return bn(f)&&(f=e),Av(On(c,bn),st(f,2))}),dk=At(function(c){var f=Xs(c);return f=typeof f=="function"?f:e,Av(On(c,bn),e,f)}),pk=At(Lv);function mk(c,f){return D6(c||[],f||[],Uh)}function gk(c,f){return D6(c||[],f||[],jh)}var vk=At(function(c){var f=c.length,b=f>1?c[f-1]:e;return b=typeof b=="function"?(c.pop(),b):e,u5(c,b)});function c5(c){var f=z(c);return f.__chain__=!0,f}function wk(c,f){return f(c),c}function R0(c,f){return f(c)}var yk=Qo(function(c){var f=c.length,b=f?c[0]:0,k=this.__wrapped__,j=function(W){return cv(W,c)};return f>1||this.__actions__.length||!(k instanceof Bt)||!ea(b)?this.thru(j):(k=k.slice(b,+b+(f?1:0)),k.__actions__.push({func:R0,args:[j],thisArg:e}),new zs(k,this.__chain__).thru(function(W){return f&&!W.length&&W.push(e),W}))});function Ek(){return c5(this)}function bk(){return new zs(this.value(),this.__chain__)}function Ak(){this.__values__===e&&(this.__values__=S5(this.value()));var c=this.__index__>=this.__values__.length,f=c?e:this.__values__[this.__index__++];return{done:c,value:f}}function Sk(){return this}function Ck(c){for(var f,b=this;b instanceof E0;){var k=n5(b);k.__index__=0,k.__values__=e,f?j.__wrapped__=k:f=k;var j=k;b=b.__wrapped__}return j.__wrapped__=c,f}function _k(){var c=this.__wrapped__;if(c instanceof Bt){var f=c;return this.__actions__.length&&(f=new Bt(this)),f=f.reverse(),f.__actions__.push({func:R0,args:[Nv],thisArg:e}),new zs(f,this.__chain__)}return this.thru(Nv)}function Dk(){return _6(this.__wrapped__,this.__actions__)}var Fk=F0(function(c,f,b){Ot.call(c,b)?++c[b]:no(c,b,1)});function Bk(c,f,b){var k=ht(c)?hc:wx;return b&&jr(c,f,b)&&(f=e),k(c,st(f,3))}function Ik(c,f){var b=ht(c)?On:u6;return b(c,st(f,3))}var $k=O6(r5),xk=O6(s5);function Pk(c,f){return rr(O0(c,f),1)}function kk(c,f){return rr(O0(c,f),P)}function Tk(c,f,b){return b=b===e?1:yt(b),rr(O0(c,f),b)}function l5(c,f){var b=ht(c)?U:du;return b(c,st(f,3))}function f5(c,f){var b=ht(c)?ft:a6;return b(c,st(f,3))}var Rk=F0(function(c,f,b){Ot.call(c,b)?c[b].push(f):no(c,b,[f])});function Ok(c,f,b,k){c=os(c)?c:Kl(c),b=b&&!k?yt(b):0;var j=c.length;return b<0&&(b=Nn(j+b,0)),M0(c)?b<=j&&c.indexOf(f,b)>-1:!!j&&lu(c,f,b)>-1}var Nk=At(function(c,f,b){var k=-1,j=typeof f=="function",W=os(c)?de(c.length):[];return du(c,function(Q){W[++k]=j?Hr(f,Q,b):Mh(Q,f,b)}),W}),Lk=F0(function(c,f,b){no(c,b,f)});function O0(c,f){var b=ht(c)?Wt:p6;return b(c,st(f,3))}function Uk(c,f,b,k){return c==null?[]:(ht(f)||(f=f==null?[]:[f]),b=k?e:b,ht(b)||(b=b==null?[]:[b]),w6(c,f,b))}var Hk=F0(function(c,f,b){c[b?0:1].push(f)},function(){return[[],[]]});function Mk(c,f,b){var k=ht(c)?i0:Ch,j=arguments.length<3;return k(c,st(f,4),b,j,du)}function qk(c,f,b){var k=ht(c)?ZS:Ch,j=arguments.length<3;return k(c,st(f,4),b,j,a6)}function jk(c,f){var b=ht(c)?On:u6;return b(c,U0(st(f,3)))}function Kk(c){var f=ht(c)?r6:Ox;return f(c)}function Vk(c,f,b){(b?jr(c,f,b):f===e)?f=1:f=yt(f);var k=ht(c)?dx:Nx;return k(c,f)}function Gk(c){var f=ht(c)?px:Ux;return f(c)}function zk(c){if(c==null)return 0;if(os(c))return M0(c)?zo(c):c.length;var f=br(c);return f==Oe||f==lt?c.size:mv(c).length}function Wk(c,f,b){var k=ht(c)?nn:Hx;return b&&jr(c,f,b)&&(f=e),k(c,st(f,3))}var Yk=At(function(c,f){if(c==null)return[];var b=f.length;return b>1&&jr(c,f[0],f[1])?f=[]:b>2&&jr(f[0],f[1],f[2])&&(f=[f[0]]),w6(c,rr(f,1),[])}),N0=ee||function(){return $n.Date.now()};function Xk(c,f){if(typeof f!="function")throw new ss(i);return c=yt(c),function(){if(--c<1)return f.apply(this,arguments)}}function h5(c,f,b){return f=b?e:f,f=c&&f==null?c.length:f,Jo(c,H,e,e,e,e,f)}function d5(c,f){var b;if(typeof f!="function")throw new ss(i);return c=yt(c),function(){return--c>0&&(b=f.apply(this,arguments)),c<=1&&(f=e),b}}var Uv=At(function(c,f,b){var k=g;if(b.length){var j=nr(b,ql(Uv));k|=_}return Jo(c,k,f,b,j)}),p5=At(function(c,f,b){var k=g|y;if(b.length){var j=nr(b,ql(p5));k|=_}return Jo(f,k,c,b,j)});function m5(c,f,b){f=b?e:f;var k=Jo(c,E,e,e,e,e,e,f);return k.placeholder=m5.placeholder,k}function g5(c,f,b){f=b?e:f;var k=Jo(c,C,e,e,e,e,e,f);return k.placeholder=g5.placeholder,k}function v5(c,f,b){var k,j,W,Q,ne,ue,Ce=0,_e=!1,Be=!1,Ne=!0;if(typeof c!="function")throw new ss(i);f=Zs(f)||0,fn(b)&&(_e=!!b.leading,Be="maxWait"in b,W=Be?Nn(Zs(b.maxWait)||0,f):W,Ne="trailing"in b?!!b.trailing:Ne);function Ge(An){var Si=k,ra=j;return k=j=e,Ce=An,Q=c.apply(ra,Si),Q}function it(An){return Ce=An,ne=Gh(Ft,f),_e?Ge(An):Q}function Et(An){var Si=An-ue,ra=An-Ce,N5=f-Si;return Be?Er(N5,W-ra):N5}function rt(An){var Si=An-ue,ra=An-Ce;return ue===e||Si>=f||Si<0||Be&&ra>=W}function Ft(){var An=N0();if(rt(An))return xt(An);ne=Gh(Ft,Et(An))}function xt(An){return ne=e,Ne&&k?Ge(An):(k=j=e,Q)}function Is(){ne!==e&&F6(ne),Ce=0,k=ue=j=ne=e}function Kr(){return ne===e?Q:xt(N0())}function $s(){var An=N0(),Si=rt(An);if(k=arguments,j=this,ue=An,Si){if(ne===e)return it(ue);if(Be)return F6(ne),ne=Gh(Ft,f),Ge(ue)}return ne===e&&(ne=Gh(Ft,f)),Q}return $s.cancel=Is,$s.flush=Kr,$s}var Zk=At(function(c,f){return o6(c,1,f)}),Jk=At(function(c,f,b){return o6(c,Zs(f)||0,b)});function Qk(c){return Jo(c,S)}function L0(c,f){if(typeof c!="function"||f!=null&&typeof f!="function")throw new ss(i);var b=function(){var k=arguments,j=f?f.apply(this,k):k[0],W=b.cache;if(W.has(j))return W.get(j);var Q=c.apply(this,k);return b.cache=W.set(j,Q)||W,Q};return b.cache=new(L0.Cache||Zo),b}L0.Cache=Zo;function U0(c){if(typeof c!="function")throw new ss(i);return function(){var f=arguments;switch(f.length){case 0:return!c.call(this);case 1:return!c.call(this,f[0]);case 2:return!c.call(this,f[0],f[1]);case 3:return!c.call(this,f[0],f[1],f[2])}return!c.apply(this,f)}}function eT(c){return d5(2,c)}var tT=Mx(function(c,f){f=f.length==1&&ht(f[0])?Wt(f[0],tr(st())):Wt(rr(f,1),tr(st()));var b=f.length;return At(function(k){for(var j=-1,W=Er(k.length,b);++j<W;)k[j]=f[j].call(this,k[j]);return Hr(c,this,k)})}),Hv=At(function(c,f){var b=nr(f,ql(Hv));return Jo(c,_,e,f,b)}),w5=At(function(c,f){var b=nr(f,ql(w5));return Jo(c,F,e,f,b)}),nT=Qo(function(c,f){return Jo(c,K,e,e,e,f)});function rT(c,f){if(typeof c!="function")throw new ss(i);return f=f===e?f:yt(f),At(c,f)}function sT(c,f){if(typeof c!="function")throw new ss(i);return f=f==null?0:Nn(yt(f),0),At(function(b){var k=b[f],j=gu(b,0,f);return k&&eo(j,k),Hr(c,this,j)})}function iT(c,f,b){var k=!0,j=!0;if(typeof c!="function")throw new ss(i);return fn(b)&&(k="leading"in b?!!b.leading:k,j="trailing"in b?!!b.trailing:j),v5(c,f,{leading:k,maxWait:f,trailing:j})}function oT(c){return h5(c,1)}function aT(c,f){return Hv(Cv(f),c)}function uT(){if(!arguments.length)return[];var c=arguments[0];return ht(c)?c:[c]}function cT(c){return Ws(c,p)}function lT(c,f){return f=typeof f=="function"?f:e,Ws(c,p,f)}function fT(c){return Ws(c,h|p)}function hT(c,f){return f=typeof f=="function"?f:e,Ws(c,h|p,f)}function dT(c,f){return f==null||i6(c,f,Yn(f))}function Ai(c,f){return c===f||c!==c&&f!==f}var pT=x0(hv),mT=x0(function(c,f){return c>=f}),Ac=f6((function(){return arguments})())?f6:function(c){return pn(c)&&Ot.call(c,"callee")&&!Yt.call(c,"callee")},ht=de.isArray,gT=Qp?tr(Qp):Cx;function os(c){return c!=null&&H0(c.length)&&!ta(c)}function bn(c){return pn(c)&&os(c)}function vT(c){return c===!0||c===!1||pn(c)&&qr(c)==Ie}var vu=En||Jv,wT=e0?tr(e0):_x;function yT(c){return pn(c)&&c.nodeType===1&&!zh(c)}function ET(c){if(c==null)return!0;if(os(c)&&(ht(c)||typeof c=="string"||typeof c.splice=="function"||vu(c)||jl(c)||Ac(c)))return!c.length;var f=br(c);if(f==Oe||f==lt)return!c.size;if(Vh(c))return!mv(c).length;for(var b in c)if(Ot.call(c,b))return!1;return!0}function bT(c,f){return qh(c,f)}function AT(c,f,b){b=typeof b=="function"?b:e;var k=b?b(c,f):e;return k===e?qh(c,f,e,b):!!k}function Mv(c){if(!pn(c))return!1;var f=qr(c);return f==Fe||f==pe||typeof c.message=="string"&&typeof c.name=="string"&&!zh(c)}function ST(c){return typeof c=="number"&&QS(c)}function ta(c){if(!fn(c))return!1;var f=qr(c);return f==Re||f==Ve||f==Pe||f==vn}function y5(c){return typeof c=="number"&&c==yt(c)}function H0(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=M}function fn(c){var f=typeof c;return c!=null&&(f=="object"||f=="function")}function pn(c){return c!=null&&typeof c=="object"}var E5=t0?tr(t0):Fx;function CT(c,f){return c===f||pv(c,f,xv(f))}function _T(c,f,b){return b=typeof b=="function"?b:e,pv(c,f,xv(f),b)}function DT(c){return b5(c)&&c!=+c}function FT(c){if(lP(c))throw new ot(r);return h6(c)}function BT(c){return c===null}function IT(c){return c==null}function b5(c){return typeof c=="number"||pn(c)&&qr(c)==pt}function zh(c){if(!pn(c)||qr(c)!=ct)return!1;var f=Tl(c);if(f===null)return!0;var b=Ot.call(f,"constructor")&&f.constructor;return typeof b=="function"&&b instanceof b&&Wo.call(b)==rv}var qv=n0?tr(n0):Bx;function $T(c){return y5(c)&&c>=-M&&c<=M}var A5=r0?tr(r0):Ix;function M0(c){return typeof c=="string"||!ht(c)&&pn(c)&&qr(c)==Tn}function Bs(c){return typeof c=="symbol"||pn(c)&&qr(c)==es}var jl=s0?tr(s0):$x;function xT(c){return c===e}function PT(c){return pn(c)&&br(c)==Dt}function kT(c){return pn(c)&&qr(c)==Ze}var TT=x0(gv),RT=x0(function(c,f){return c<=f});function S5(c){if(!c)return[];if(os(c))return M0(c)?Mr(c):is(c);if(mc&&c[mc])return Z2(c[mc]());var f=br(c),b=f==Oe?Wn:f==lt?Go:Kl;return b(c)}function na(c){if(!c)return c===0?c:0;if(c=Zs(c),c===P||c===-P){var f=c<0?-1:1;return f*Y}return c===c?c:0}function yt(c){var f=na(c),b=f%1;return f===f?b?f-b:f:0}function C5(c){return c?wc(yt(c),0,X):0}function Zs(c){if(typeof c=="number")return c;if(Bs(c))return V;if(fn(c)){var f=typeof c.valueOf=="function"?c.valueOf():c;c=fn(f)?f+"":f}if(typeof c!="string")return c===0?c:+c;c=Fh(c);var b=Lr.test(c);return b||Bn.test(c)?V2(c.slice(2),b?2:8):Ji.test(c)?V:+c}function _5(c){return so(c,as(c))}function OT(c){return c?wc(yt(c),-M,M):c===0?c:0}function Vt(c){return c==null?"":Fs(c)}var NT=Hl(function(c,f){if(Vh(f)||os(f)){so(f,Yn(f),c);return}for(var b in f)Ot.call(f,b)&&Uh(c,b,f[b])}),D5=Hl(function(c,f){so(f,as(f),c)}),F5=Hl(function(c,f,b,k){so(f,as(f),c,k)}),jv=Hl(function(c,f,b,k){so(f,Yn(f),c,k)}),LT=Qo(cv);function UT(c,f){var b=Ul(c);return f==null?b:s6(b,f)}var HT=At(function(c,f){c=Kt(c);var b=-1,k=f.length,j=k>2?f[2]:e;for(j&&jr(f[0],f[1],j)&&(k=1);++b<k;)for(var W=f[b],Q=as(W),ne=-1,ue=Q.length;++ne<ue;){var Ce=Q[ne],_e=c[Ce];(_e===e||Ai(_e,Ds[Ce])&&!Ot.call(c,Ce))&&(c[Ce]=W[Ce])}return c}),MT=At(function(c){return c.push(e,j6),Hr(B5,e,c)});function qT(c,f){return zn(c,st(f,3),ro)}function jT(c,f){return zn(c,st(f,3),fv)}function KT(c,f){return c==null?c:lv(c,st(f,3),as)}function VT(c,f){return c==null?c:c6(c,st(f,3),as)}function GT(c,f){return c&&ro(c,st(f,3))}function zT(c,f){return c&&fv(c,st(f,3))}function WT(c){return c==null?[]:S0(c,Yn(c))}function YT(c){return c==null?[]:S0(c,as(c))}function Kv(c,f,b){var k=c==null?e:yc(c,f);return k===e?b:k}function XT(c,f){return c!=null&&G6(c,f,Ex)}function Vv(c,f){return c!=null&&G6(c,f,bx)}var ZT=L6(function(c,f,b){f!=null&&typeof f.toString!="function"&&(f=xl.call(f)),c[f]=b},zv(us)),JT=L6(function(c,f,b){f!=null&&typeof f.toString!="function"&&(f=xl.call(f)),Ot.call(c,f)?c[f].push(b):c[f]=[b]},st),QT=At(Mh);function Yn(c){return os(c)?n6(c):mv(c)}function as(c){return os(c)?n6(c,!0):xx(c)}function eR(c,f){var b={};return f=st(f,3),ro(c,function(k,j,W){no(b,f(k,j,W),k)}),b}function tR(c,f){var b={};return f=st(f,3),ro(c,function(k,j,W){no(b,j,f(k,j,W))}),b}var nR=Hl(function(c,f,b){C0(c,f,b)}),B5=Hl(function(c,f,b,k){C0(c,f,b,k)}),rR=Qo(function(c,f){var b={};if(c==null)return b;var k=!1;f=Wt(f,function(W){return W=mu(W,c),k||(k=W.length>1),W}),so(c,Iv(c),b),k&&(b=Ws(b,h|m|p,Jx));for(var j=f.length;j--;)bv(b,f[j]);return b});function sR(c,f){return I5(c,U0(st(f)))}var iR=Qo(function(c,f){return c==null?{}:kx(c,f)});function I5(c,f){if(c==null)return{};var b=Wt(Iv(c),function(k){return[k]});return f=st(f),y6(c,b,function(k,j){return f(k,j[0])})}function oR(c,f,b){f=mu(f,c);var k=-1,j=f.length;for(j||(j=1,c=e);++k<j;){var W=c==null?e:c[bi(f[k])];W===e&&(k=j,W=b),c=ta(W)?W.call(c):W}return c}function aR(c,f,b){return c==null?c:jh(c,f,b)}function uR(c,f,b,k){return k=typeof k=="function"?k:e,c==null?c:jh(c,f,b,k)}var $5=M6(Yn),x5=M6(as);function cR(c,f,b){var k=ht(c),j=k||vu(c)||jl(c);if(f=st(f,4),b==null){var W=c&&c.constructor;j?b=k?new W:[]:fn(c)?b=ta(W)?Ul(Tl(c)):{}:b={}}return(j?U:ro)(c,function(Q,ne,ue){return f(b,Q,ne,ue)}),b}function lR(c,f){return c==null?!0:bv(c,f)}function fR(c,f,b){return c==null?c:C6(c,f,Cv(b))}function hR(c,f,b,k){return k=typeof k=="function"?k:e,c==null?c:C6(c,f,Cv(b),k)}function Kl(c){return c==null?[]:Bh(c,Yn(c))}function dR(c){return c==null?[]:Bh(c,as(c))}function pR(c,f,b){return b===e&&(b=f,f=e),b!==e&&(b=Zs(b),b=b===b?b:0),f!==e&&(f=Zs(f),f=f===f?f:0),wc(Zs(c),f,b)}function mR(c,f,b){return f=na(f),b===e?(b=f,f=0):b=na(b),c=Zs(c),Ax(c,f,b)}function gR(c,f,b){if(b&&typeof b!="boolean"&&jr(c,f,b)&&(f=b=e),b===e&&(typeof f=="boolean"?(b=f,f=e):typeof c=="boolean"&&(b=c,c=e)),c===e&&f===e?(c=0,f=1):(c=na(c),f===e?(f=c,c=0):f=na(f)),c>f){var k=c;c=f,f=k}if(b||c%1||f%1){var j=e6();return Er(c+j*(f-c+K2("1e-"+((j+"").length-1))),f)}return wv(c,f)}var vR=Ml(function(c,f,b){return f=f.toLowerCase(),c+(b?P5(f):f)});function P5(c){return Gv(Vt(c).toLowerCase())}function k5(c){return c=Vt(c),c&&c.replace(iu,W2).replace(T2,"")}function wR(c,f,b){c=Vt(c),f=Fs(f);var k=c.length;b=b===e?k:wc(yt(b),0,k);var j=b;return b-=f.length,b>=0&&c.slice(b,j)==f}function yR(c){return c=Vt(c),c&&Ks.test(c)?c.replace(Zi,c0):c}function ER(c){return c=Vt(c),c&&fh.test(c)?c.replace(fc,"\\$&"):c}var bR=Ml(function(c,f,b){return c+(b?"-":"")+f.toLowerCase()}),AR=Ml(function(c,f,b){return c+(b?" ":"")+f.toLowerCase()}),SR=R6("toLowerCase");function CR(c,f,b){c=Vt(c),f=yt(f);var k=f?zo(c):0;if(!f||k>=f)return c;var j=(f-k)/2;return $0(ge(j),b)+c+$0(fe(j),b)}function _R(c,f,b){c=Vt(c),f=yt(f);var k=f?zo(c):0;return f&&k<f?c+$0(f-k,b):c}function DR(c,f,b){c=Vt(c),f=yt(f);var k=f?zo(c):0;return f&&k<f?$0(f-k,b)+c:c}function FR(c,f,b){return b||f==null?f=0:f&&(f=+f),R$(Vt(c).replace(ie,""),f||0)}function BR(c,f,b){return(b?jr(c,f,b):f===e)?f=1:f=yt(f),yv(Vt(c),f)}function IR(){var c=arguments,f=Vt(c[0]);return c.length<3?f:f.replace(c[1],c[2])}var $R=Ml(function(c,f,b){return c+(b?"_":"")+f.toLowerCase()});function xR(c,f,b){return b&&typeof b!="number"&&jr(c,f,b)&&(f=b=e),b=b===e?X:b>>>0,b?(c=Vt(c),c&&(typeof f=="string"||f!=null&&!qv(f))&&(f=Fs(f),!f&&hu(c))?gu(Mr(c),0,b):c.split(f,b)):[]}var PR=Ml(function(c,f,b){return c+(b?" ":"")+Gv(f)});function kR(c,f,b){return c=Vt(c),b=b==null?0:wc(yt(b),0,c.length),f=Fs(f),c.slice(b,b+f.length)==f}function TR(c,f,b){var k=z.templateSettings;b&&jr(c,f,b)&&(f=e),c=Vt(c),f=jv({},f,k,q6);var j=jv({},f.imports,k.imports,q6),W=Yn(j),Q=Bh(j,W);U(W,function(rt){if(wt.test(rt))throw new ot(s)});var ne,ue,Ce=0,_e=f.interpolate||ou,Be="__p += '",Ne=kh((f.escape||ou).source+"|"+_e.source+"|"+(_e===lc?cn:ou).source+"|"+(f.evaluate||ou).source+"|$","g"),Ge="//# sourceURL="+(Ot.call(f,"sourceURL")?(f.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++U2+"]")+`
`;c.replace(Ne,function(rt,Ft,xt,Is,Kr,$s){return xt||(xt=Is),Be+=c.slice(Ce,$s).replace(hh,Y2),Ft&&(ne=!0,Be+=`' +
__e(`+Ft+`) +
'`),Kr&&(ue=!0,Be+=`';
`+Kr+`;
__p += '`),xt&&(Be+=`' +
((__t = (`+xt+`)) == null ? '' : __t) +
'`),Ce=$s+rt.length,rt}),Be+=`';
`;var it=Ot.call(f,"variable")&&f.variable;if(!it)Be=`with (obj) {
`+Be+`
}
`;else if(wt.test(it))throw new ot(o);Be=(ue?Be.replace(Cl,""):Be).replace(nu,"$1").replace(uh,"$1;"),Be="function("+(it||"obj")+`) {
`+(it?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(ne?", __e = _.escape":"")+(ue?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+Be+`return __p
}`;var Et=R5(function(){return $t(W,Ge+"return "+Be).apply(e,Q)});if(Et.source=Be,Mv(Et))throw Et;return Et}function RR(c){return Vt(c).toLowerCase()}function OR(c){return Vt(c).toUpperCase()}function NR(c,f,b){if(c=Vt(c),c&&(b||f===e))return Fh(c);if(!c||!(f=Fs(f)))return c;var k=Mr(c),j=Mr(f),W=u0(k,j),Q=Ih(k,j)+1;return gu(k,W,Q).join("")}function LR(c,f,b){if(c=Vt(c),c&&(b||f===e))return c.slice(0,xh(c)+1);if(!c||!(f=Fs(f)))return c;var k=Mr(c),j=Ih(k,Mr(f))+1;return gu(k,0,j).join("")}function UR(c,f,b){if(c=Vt(c),c&&(b||f===e))return c.replace(ie,"");if(!c||!(f=Fs(f)))return c;var k=Mr(c),j=u0(k,Mr(f));return gu(k,j).join("")}function HR(c,f){var b=I,k=q;if(fn(f)){var j="separator"in f?f.separator:j;b="length"in f?yt(f.length):b,k="omission"in f?Fs(f.omission):k}c=Vt(c);var W=c.length;if(hu(c)){var Q=Mr(c);W=Q.length}if(b>=W)return c;var ne=b-zo(k);if(ne<1)return k;var ue=Q?gu(Q,0,ne).join(""):c.slice(0,ne);if(j===e)return ue+k;if(Q&&(ne+=ue.length-ne),qv(j)){if(c.slice(ne).search(j)){var Ce,_e=ue;for(j.global||(j=kh(j.source,Vt(Vs.exec(j))+"g")),j.lastIndex=0;Ce=j.exec(_e);)var Be=Ce.index;ue=ue.slice(0,Be===e?ne:Be)}}else if(c.indexOf(Fs(j),ne)!=ne){var Ne=ue.lastIndexOf(j);Ne>-1&&(ue=ue.slice(0,Ne))}return ue+k}function MR(c){return c=Vt(c),c&&jt.test(c)?c.replace(ru,d0):c}var qR=Ml(function(c,f,b){return c+(b?" ":"")+f.toUpperCase()}),Gv=R6("toUpperCase");function T5(c,f,b){return c=Vt(c),f=b?e:f,f===e?X2(c)?tv(c):nt(c):c.match(f)||[]}var R5=At(function(c,f){try{return Hr(c,e,f)}catch(b){return Mv(b)?b:new ot(b)}}),jR=Qo(function(c,f){return U(f,function(b){b=bi(b),no(c,b,Uv(c[b],c))}),c});function KR(c){var f=c==null?0:c.length,b=st();return c=f?Wt(c,function(k){if(typeof k[1]!="function")throw new ss(i);return[b(k[0]),k[1]]}):[],At(function(k){for(var j=-1;++j<f;){var W=c[j];if(Hr(W[0],this,k))return Hr(W[1],this,k)}})}function VR(c){return vx(Ws(c,h))}function zv(c){return function(){return c}}function GR(c,f){return c==null||c!==c?f:c}var zR=N6(),WR=N6(!0);function us(c){return c}function Wv(c){return d6(typeof c=="function"?c:Ws(c,h))}function YR(c){return m6(Ws(c,h))}function XR(c,f){return g6(c,Ws(f,h))}var ZR=At(function(c,f){return function(b){return Mh(b,c,f)}}),JR=At(function(c,f){return function(b){return Mh(c,b,f)}});function Yv(c,f,b){var k=Yn(f),j=S0(f,k);b==null&&!(fn(f)&&(j.length||!k.length))&&(b=f,f=c,c=this,j=S0(f,Yn(f)));var W=!(fn(b)&&"chain"in b)||!!b.chain,Q=ta(c);return U(j,function(ne){var ue=f[ne];c[ne]=ue,Q&&(c.prototype[ne]=function(){var Ce=this.__chain__;if(W||Ce){var _e=c(this.__wrapped__),Be=_e.__actions__=is(this.__actions__);return Be.push({func:ue,args:arguments,thisArg:c}),_e.__chain__=Ce,_e}return ue.apply(c,eo([this.value()],arguments))})}),c}function QR(){return $n._===this&&($n._=sv),this}function Xv(){}function eO(c){return c=yt(c),At(function(f){return v6(f,c)})}var tO=Dv(Wt),nO=Dv(hc),rO=Dv(nn);function O5(c){return kv(c)?Ae(bi(c)):Tx(c)}function sO(c){return function(f){return c==null?e:yc(c,f)}}var iO=U6(),oO=U6(!0);function Zv(){return[]}function Jv(){return!1}function aO(){return{}}function uO(){return""}function cO(){return!0}function lO(c,f){if(c=yt(c),c<1||c>M)return[];var b=X,k=Er(c,X);f=st(f),c-=X;for(var j=Dh(k,f);++b<c;)f(b);return j}function fO(c){return ht(c)?Wt(c,bi):Bs(c)?[c]:is(t5(Vt(c)))}function hO(c){var f=++Th;return Vt(c)+f}var dO=I0(function(c,f){return c+f},0),pO=Fv("ceil"),mO=I0(function(c,f){return c/f},1),gO=Fv("floor");function vO(c){return c&&c.length?A0(c,us,hv):e}function wO(c,f){return c&&c.length?A0(c,st(f,2),hv):e}function yO(c){return fu(c,us)}function EO(c,f){return fu(c,st(f,2))}function bO(c){return c&&c.length?A0(c,us,gv):e}function AO(c,f){return c&&c.length?A0(c,st(f,2),gv):e}var SO=I0(function(c,f){return c*f},1),CO=Fv("round"),_O=I0(function(c,f){return c-f},0);function DO(c){return c&&c.length?_h(c,us):0}function FO(c,f){return c&&c.length?_h(c,st(f,2)):0}return z.after=Xk,z.ary=h5,z.assign=NT,z.assignIn=D5,z.assignInWith=F5,z.assignWith=jv,z.at=LT,z.before=d5,z.bind=Uv,z.bindAll=jR,z.bindKey=p5,z.castArray=uT,z.chain=c5,z.chunk=vP,z.compact=wP,z.concat=yP,z.cond=KR,z.conforms=VR,z.constant=zv,z.countBy=Fk,z.create=UT,z.curry=m5,z.curryRight=g5,z.debounce=v5,z.defaults=HT,z.defaultsDeep=MT,z.defer=Zk,z.delay=Jk,z.difference=EP,z.differenceBy=bP,z.differenceWith=AP,z.drop=SP,z.dropRight=CP,z.dropRightWhile=_P,z.dropWhile=DP,z.fill=FP,z.filter=Ik,z.flatMap=Pk,z.flatMapDeep=kk,z.flatMapDepth=Tk,z.flatten=i5,z.flattenDeep=BP,z.flattenDepth=IP,z.flip=Qk,z.flow=zR,z.flowRight=WR,z.fromPairs=$P,z.functions=WT,z.functionsIn=YT,z.groupBy=Rk,z.initial=PP,z.intersection=kP,z.intersectionBy=TP,z.intersectionWith=RP,z.invert=ZT,z.invertBy=JT,z.invokeMap=Nk,z.iteratee=Wv,z.keyBy=Lk,z.keys=Yn,z.keysIn=as,z.map=O0,z.mapKeys=eR,z.mapValues=tR,z.matches=YR,z.matchesProperty=XR,z.memoize=L0,z.merge=nR,z.mergeWith=B5,z.method=ZR,z.methodOf=JR,z.mixin=Yv,z.negate=U0,z.nthArg=eO,z.omit=rR,z.omitBy=sR,z.once=eT,z.orderBy=Uk,z.over=tO,z.overArgs=tT,z.overEvery=nO,z.overSome=rO,z.partial=Hv,z.partialRight=w5,z.partition=Hk,z.pick=iR,z.pickBy=I5,z.property=O5,z.propertyOf=sO,z.pull=UP,z.pullAll=a5,z.pullAllBy=HP,z.pullAllWith=MP,z.pullAt=qP,z.range=iO,z.rangeRight=oO,z.rearg=nT,z.reject=jk,z.remove=jP,z.rest=rT,z.reverse=Nv,z.sampleSize=Vk,z.set=aR,z.setWith=uR,z.shuffle=Gk,z.slice=KP,z.sortBy=Yk,z.sortedUniq=ZP,z.sortedUniqBy=JP,z.split=xR,z.spread=sT,z.tail=QP,z.take=ek,z.takeRight=tk,z.takeRightWhile=nk,z.takeWhile=rk,z.tap=wk,z.throttle=iT,z.thru=R0,z.toArray=S5,z.toPairs=$5,z.toPairsIn=x5,z.toPath=fO,z.toPlainObject=_5,z.transform=cR,z.unary=oT,z.union=sk,z.unionBy=ik,z.unionWith=ok,z.uniq=ak,z.uniqBy=uk,z.uniqWith=ck,z.unset=lR,z.unzip=Lv,z.unzipWith=u5,z.update=fR,z.updateWith=hR,z.values=Kl,z.valuesIn=dR,z.without=lk,z.words=T5,z.wrap=aT,z.xor=fk,z.xorBy=hk,z.xorWith=dk,z.zip=pk,z.zipObject=mk,z.zipObjectDeep=gk,z.zipWith=vk,z.entries=$5,z.entriesIn=x5,z.extend=D5,z.extendWith=F5,Yv(z,z),z.add=dO,z.attempt=R5,z.camelCase=vR,z.capitalize=P5,z.ceil=pO,z.clamp=pR,z.clone=cT,z.cloneDeep=fT,z.cloneDeepWith=hT,z.cloneWith=lT,z.conformsTo=dT,z.deburr=k5,z.defaultTo=GR,z.divide=mO,z.endsWith=wR,z.eq=Ai,z.escape=yR,z.escapeRegExp=ER,z.every=Bk,z.find=$k,z.findIndex=r5,z.findKey=qT,z.findLast=xk,z.findLastIndex=s5,z.findLastKey=jT,z.floor=gO,z.forEach=l5,z.forEachRight=f5,z.forIn=KT,z.forInRight=VT,z.forOwn=GT,z.forOwnRight=zT,z.get=Kv,z.gt=pT,z.gte=mT,z.has=XT,z.hasIn=Vv,z.head=o5,z.identity=us,z.includes=Ok,z.indexOf=xP,z.inRange=mR,z.invoke=QT,z.isArguments=Ac,z.isArray=ht,z.isArrayBuffer=gT,z.isArrayLike=os,z.isArrayLikeObject=bn,z.isBoolean=vT,z.isBuffer=vu,z.isDate=wT,z.isElement=yT,z.isEmpty=ET,z.isEqual=bT,z.isEqualWith=AT,z.isError=Mv,z.isFinite=ST,z.isFunction=ta,z.isInteger=y5,z.isLength=H0,z.isMap=E5,z.isMatch=CT,z.isMatchWith=_T,z.isNaN=DT,z.isNative=FT,z.isNil=IT,z.isNull=BT,z.isNumber=b5,z.isObject=fn,z.isObjectLike=pn,z.isPlainObject=zh,z.isRegExp=qv,z.isSafeInteger=$T,z.isSet=A5,z.isString=M0,z.isSymbol=Bs,z.isTypedArray=jl,z.isUndefined=xT,z.isWeakMap=PT,z.isWeakSet=kT,z.join=OP,z.kebabCase=bR,z.last=Xs,z.lastIndexOf=NP,z.lowerCase=AR,z.lowerFirst=SR,z.lt=TT,z.lte=RT,z.max=vO,z.maxBy=wO,z.mean=yO,z.meanBy=EO,z.min=bO,z.minBy=AO,z.stubArray=Zv,z.stubFalse=Jv,z.stubObject=aO,z.stubString=uO,z.stubTrue=cO,z.multiply=SO,z.nth=LP,z.noConflict=QR,z.noop=Xv,z.now=N0,z.pad=CR,z.padEnd=_R,z.padStart=DR,z.parseInt=FR,z.random=gR,z.reduce=Mk,z.reduceRight=qk,z.repeat=BR,z.replace=IR,z.result=oR,z.round=CO,z.runInContext=oe,z.sample=Kk,z.size=zk,z.snakeCase=$R,z.some=Wk,z.sortedIndex=VP,z.sortedIndexBy=GP,z.sortedIndexOf=zP,z.sortedLastIndex=WP,z.sortedLastIndexBy=YP,z.sortedLastIndexOf=XP,z.startCase=PR,z.startsWith=kR,z.subtract=_O,z.sum=DO,z.sumBy=FO,z.template=TR,z.times=lO,z.toFinite=na,z.toInteger=yt,z.toLength=C5,z.toLower=RR,z.toNumber=Zs,z.toSafeInteger=OT,z.toString=Vt,z.toUpper=OR,z.trim=NR,z.trimEnd=LR,z.trimStart=UR,z.truncate=HR,z.unescape=MR,z.uniqueId=hO,z.upperCase=qR,z.upperFirst=Gv,z.each=l5,z.eachRight=f5,z.first=o5,Yv(z,(function(){var c={};return ro(z,function(f,b){Ot.call(z.prototype,b)||(c[b]=f)}),c})(),{chain:!1}),z.VERSION=t,U(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){z[c].placeholder=z}),U(["drop","take"],function(c,f){Bt.prototype[c]=function(b){b=b===e?1:Nn(yt(b),0);var k=this.__filtered__&&!f?new Bt(this):this.clone();return k.__filtered__?k.__takeCount__=Er(b,k.__takeCount__):k.__views__.push({size:Er(b,X),type:c+(k.__dir__<0?"Right":"")}),k},Bt.prototype[c+"Right"]=function(b){return this.reverse()[c](b).reverse()}}),U(["filter","map","takeWhile"],function(c,f){var b=f+1,k=b==O||b==N;Bt.prototype[c]=function(j){var W=this.clone();return W.__iteratees__.push({iteratee:st(j,3),type:b}),W.__filtered__=W.__filtered__||k,W}}),U(["head","last"],function(c,f){var b="take"+(f?"Right":"");Bt.prototype[c]=function(){return this[b](1).value()[0]}}),U(["initial","tail"],function(c,f){var b="drop"+(f?"":"Right");Bt.prototype[c]=function(){return this.__filtered__?new Bt(this):this[b](1)}}),Bt.prototype.compact=function(){return this.filter(us)},Bt.prototype.find=function(c){return this.filter(c).head()},Bt.prototype.findLast=function(c){return this.reverse().find(c)},Bt.prototype.invokeMap=At(function(c,f){return typeof c=="function"?new Bt(this):this.map(function(b){return Mh(b,c,f)})}),Bt.prototype.reject=function(c){return this.filter(U0(st(c)))},Bt.prototype.slice=function(c,f){c=yt(c);var b=this;return b.__filtered__&&(c>0||f<0)?new Bt(b):(c<0?b=b.takeRight(-c):c&&(b=b.drop(c)),f!==e&&(f=yt(f),b=f<0?b.dropRight(-f):b.take(f-c)),b)},Bt.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},Bt.prototype.toArray=function(){return this.take(X)},ro(Bt.prototype,function(c,f){var b=/^(?:filter|find|map|reject)|While$/.test(f),k=/^(?:head|last)$/.test(f),j=z[k?"take"+(f=="last"?"Right":""):f],W=k||/^find/.test(f);j&&(z.prototype[f]=function(){var Q=this.__wrapped__,ne=k?[1]:arguments,ue=Q instanceof Bt,Ce=ne[0],_e=ue||ht(Q),Be=function(Ft){var xt=j.apply(z,eo([Ft],ne));return k&&Ne?xt[0]:xt};_e&&b&&typeof Ce=="function"&&Ce.length!=1&&(ue=_e=!1);var Ne=this.__chain__,Ge=!!this.__actions__.length,it=W&&!Ne,Et=ue&&!Ge;if(!W&&_e){Q=Et?Q:new Bt(this);var rt=c.apply(Q,ne);return rt.__actions__.push({func:R0,args:[Be],thisArg:e}),new zs(rt,Ne)}return it&&Et?c.apply(this,ne):(rt=this.thru(Be),it?k?rt.value()[0]:rt.value():rt)})}),U(["pop","push","shift","sort","splice","unshift"],function(c){var f=pc[c],b=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",k=/^(?:pop|shift)$/.test(c);z.prototype[c]=function(){var j=arguments;if(k&&!this.__chain__){var W=this.value();return f.apply(ht(W)?W:[],j)}return this[b](function(Q){return f.apply(ht(Q)?Q:[],j)})}}),ro(Bt.prototype,function(c,f){var b=z[f];if(b){var k=b.name+"";Ot.call(Ll,k)||(Ll[k]=[]),Ll[k].push({name:f,func:b})}}),Ll[B0(e,y).name]=[{name:"wrapper",func:e}],Bt.prototype.clone=q$,Bt.prototype.reverse=j$,Bt.prototype.value=K$,z.prototype.at=yk,z.prototype.chain=Ek,z.prototype.commit=bk,z.prototype.next=Ak,z.prototype.plant=Ck,z.prototype.reverse=_k,z.prototype.toJSON=z.prototype.valueOf=z.prototype.value=Dk,z.prototype.first=z.prototype.head,mc&&(z.prototype[mc]=Sk),z}),yi=Ph();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=yi,define(function(){return yi})):Ko?((Ko.exports=yi)._=yi,yh._=yi):$n._=yi}).call(Wf)});var i2=be((dwe,V9)=>{"use strict";var pwe=B(x()),_J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},aS=class e extends Error{constructor(t,n,r){super(t),_J(this,e.prototype),this.name="GrammarError",this.location=n,r===void 0&&(r=[]),this.diagnostics=r,this.stage=null,this.problems=[["error",t,n,r]]}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 n of this.diagnostics)t+=`
from `,n.location.source!==void 0&&n.location.source!==null&&(t+=`${n.location.source}:`),t+=`${n.location.start.line}:${n.location.start.column}: ${n.message}`;return t}format(t){let n=t.map(({source:o,text:s})=>({source:o,text:s.split(/\r\n|\n|\r/g)}));function r(o,s,a=""){let u="",l=n.find(({source:m})=>m===o.source),h=o.start;if(l){let m=o.end,p=l.text[h.line-1],v=(h.line===m.line?m.column:p.length+1)-h.column||1;a&&(u+=`
note: ${a}`),u+=`
--> ${o.source}:${h.line}:${h.column}
${"".padEnd(s)} |
${h.line.toString().padStart(s)} | ${p}
${"".padEnd(s)} | ${"".padEnd(h.column-1)}${"".padEnd(v,"^")}`}else u+=`
at ${o.source}:${h.line}:${h.column}`,a&&(u+=`: ${a}`);return u}function i(o,s,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 h=`${o}: ${s}`;a&&(h+=r(a,l));for(let m of u)h+=r(m.location,l,m.message);return h}return this.problems.filter(o=>o[0]!=="info").map(o=>i(...o)).join(`
`)}};V9.exports=aS});var hi=be((mwe,G9)=>{"use strict";var gwe=B(x()),DJ={build(e){function t(s,...a){return e[s.type](s,...a)}function n(){}function r(s,...a){return t(s.expression,...a)}function i(s){return function(a,...u){a[s].forEach(l=>t(l,...u))}}let o={grammar(s,...a){s.topLevelInitializer&&t(s.topLevelInitializer,...a),s.initializer&&t(s.initializer,...a),s.rules.forEach(u=>t(u,...a))},top_level_initializer:n,initializer:n,rule:r,named:r,choice:i("alternatives"),action:r,sequence:i("elements"),labeled:r,text:r,simple_and:r,simple_not:r,optional:r,zero_or_more:r,one_or_more:r,group:r,semantic_and:n,semantic_not:n,rule_ref:n,literal:n,class:n,any:n};return Object.keys(o).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||(e[s]=o[s])}),t}};G9.exports=DJ});var ic=be((vwe,W9)=>{"use strict";var wwe=B(x()),FJ=hi(),z9={findRule(e,t){for(let n=0;n<e.rules.length;n++)if(e.rules[n].name===t)return e.rules[n]},indexOfRule(e,t){for(let n=0;n<e.rules.length;n++)if(e.rules[n].name===t)return n;return-1},alwaysConsumesOnSuccess(e,t){function n(){return!0}function r(){return!1}let i=FJ.build({choice(o){return o.alternatives.every(i)},sequence(o){return o.elements.some(i)},simple_and:r,simple_not:r,optional:r,zero_or_more:r,semantic_and:r,semantic_not:r,rule_ref(o){let s=z9.findRule(e,o.name);return s?i(s):void 0},literal(o){return o.value!==""},class:n,any:n});return i(t)}};W9.exports=z9});var uS=be((ywe,Y9)=>{"use strict";var Ewe=B(x()),BJ={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};Y9.exports=BJ});var cS=be((bwe,X9)=>{"use strict";var Awe=B(x()),IJ=hi(),$J=ic(),xJ=i2(),xp=1,Al=0,Pp=-1;function o2(e){function t(s){return s.match=Al}function n(s){return o(s.expression),s.match=xp}function r(s){return s.match=o(s.expression)}function i(s,a){let u=s.length,l=0,h=0;for(let m=0;m<u;++m){let p=o(s[m]);p===xp&&++l,p===Pp&&++h}return l===u?xp:a?h===u?Pp:Al:h>0?Pp:Al}let o=IJ.build({rule(s){let a,u=0;if(typeof s.match>"u"){s.match=Al;do if(a=s.match,s.match=o(s.expression),++u>6)throw new xJ("Infinity cycle detected when trying to evaluate node match result",s.location);while(a!==s.match)}return s.match},named:r,choice(s){return s.match=i(s.alternatives,!0)},action:r,sequence(s){return s.match=i(s.elements,!1)},labeled:r,text:r,simple_and:r,simple_not(s){return s.match=-o(s.expression)},optional:n,zero_or_more:n,one_or_more:r,group:r,semantic_and:t,semantic_not:t,rule_ref(s){let a=$J.findRule(e,s.name);return s.match=o(a)},literal(s){let a=s.value.length===0?xp:Al;return s.match=a},class(s){let a=s.parts.length===0?Pp:Al;return s.match=a},any:t});o(e)}o2.ALWAYS_MATCH=xp;o2.SOMETIMES_MATCH=Al;o2.NEVER_MATCH=Pp;X9.exports=o2});var J9=be((Swe,Z9)=>{"use strict";var Cwe=B(x()),PJ=ic(),Ue=uS(),kJ=hi(),{ALWAYS_MATCH:sh,SOMETIMES_MATCH:lS,NEVER_MATCH:fS}=cS();function TJ(e){let t=[],n=[],r=[],i=[];function o(E){let C=t.indexOf(E);return C===-1?t.push(E)-1:C}function s(E){let C={value:E.parts,inverted:E.inverted,ignoreCase:E.ignoreCase},_=JSON.stringify(C),F=n.findIndex(H=>JSON.stringify(H)===_);return F===-1?n.push(C)-1:F}function a(E){let C=JSON.stringify(E),_=r.findIndex(F=>JSON.stringify(F)===C);return _===-1?r.push(E)-1:_}function u(E,C,_){let F={predicate:E,params:C,body:_.code,location:_.codeLocation},H=JSON.stringify(F),K=i.findIndex(S=>JSON.stringify(S)===H);return K===-1?i.push(F)-1:K}function l(E){let C={};return Object.keys(E).forEach(_=>{C[_]=E[_]}),C}function h(E,...C){return E.concat(...C)}function m(E,C,_,F){return E===sh?_:E===fS?F:C.concat([_.length,F.length],_,F)}function p(E,C){return E.concat([C.length],C)}function d(E,C,_,F){let H=Object.keys(_).map(K=>F-_[K]);return[Ue.CALL,E,C,H.length].concat(H)}function v(E,C,_){let F=E.match|0;return h([Ue.PUSH_CURR_POS],[Ue.SILENT_FAILS_ON],w(E,{sp:_.sp+1,env:l(_.env),action:null}),[Ue.SILENT_FAILS_OFF],m(C?-F:F,[C?Ue.IF_ERROR:Ue.IF_NOT_ERROR],h([Ue.POP],[C?Ue.POP:Ue.POP_CURR_POS],[Ue.PUSH_UNDEFINED]),h([Ue.POP],[C?Ue.POP_CURR_POS:Ue.POP],[Ue.PUSH_FAILED])))}function g(E,C,_){let F=u(!0,Object.keys(_.env),E);return h([Ue.UPDATE_SAVED_POS],d(F,0,_.env,_.sp),m(E.match|0,[Ue.IF],h([Ue.POP],C?[Ue.PUSH_FAILED]:[Ue.PUSH_UNDEFINED]),h([Ue.POP],C?[Ue.PUSH_UNDEFINED]:[Ue.PUSH_FAILED])))}function y(E){return p([Ue.WHILE_NOT_ERROR],h([Ue.APPEND],E))}let w=kJ.build({grammar(E){E.rules.forEach(w),E.literals=t,E.classes=n,E.expectations=r,E.functions=i},rule(E){E.bytecode=w(E.expression,{sp:-1,env:{},pluck:[],action:null})},named(E,C){let _=E.match|0,F=_===fS?null:a({type:"rule",value:E.name});return h([Ue.SILENT_FAILS_ON],w(E.expression,C),[Ue.SILENT_FAILS_OFF],m(_,[Ue.IF_ERROR],[Ue.FAIL,F],[]))},choice(E,C){function _(F,H){let K=F[0].match|0,S=w(F[0],{sp:H.sp,env:l(H.env),action:null});return K===sh?S:h(S,F.length>1?m(lS,[Ue.IF_ERROR],h([Ue.POP],_(F.slice(1),H)),[]):[])}return _(E.alternatives,C)},action(E,C){let _=l(C.env),F=E.expression.type!=="sequence"||E.expression.elements.length===0,H=w(E.expression,{sp:C.sp+(F?1:0),env:_,action:E}),K=E.expression.match|0,S=F&&K!==fS?u(!1,Object.keys(_),E):null;return F?h([Ue.PUSH_CURR_POS],H,m(K,[Ue.IF_NOT_ERROR],h([Ue.LOAD_SAVED_POS,1],d(S,1,_,C.sp+2)),[]),[Ue.NIP]):H},sequence(E,C){function _(F,H){if(F.length>0){let K=E.elements.length-F.length+1;return h(w(F[0],{sp:H.sp,env:H.env,pluck:H.pluck,action:null}),m(F[0].match|0,[Ue.IF_NOT_ERROR],_(F.slice(1),{sp:H.sp+1,env:H.env,pluck:H.pluck,action:H.action}),h(K>1?[Ue.POP_N,K]:[Ue.POP],[Ue.POP_CURR_POS],[Ue.PUSH_FAILED])))}else{if(H.pluck.length>0)return h([Ue.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 h([Ue.LOAD_SAVED_POS,E.elements.length],d(K,E.elements.length+1,H.env,H.sp))}else return h([Ue.WRAP,E.elements.length],[Ue.NIP])}}return h([Ue.PUSH_CURR_POS],_(E.elements,{sp:C.sp+1,env:C.env,pluck:[],action:C.action}))},labeled(E,C){let _=C.env,F=E.label,H=C.sp+1;return F&&(_=l(C.env),C.env[E.label]=H),E.pick&&C.pluck.push(H),w(E.expression,{sp:C.sp,env:_,action:null})},text(E,C){return h([Ue.PUSH_CURR_POS],w(E.expression,{sp:C.sp+1,env:l(C.env),action:null}),m(E.match|0,[Ue.IF_NOT_ERROR],h([Ue.POP],[Ue.TEXT]),[Ue.NIP]))},simple_and(E,C){return v(E.expression,!1,C)},simple_not(E,C){return v(E.expression,!0,C)},optional(E,C){return h(w(E.expression,{sp:C.sp,env:l(C.env),action:null}),m(-(E.expression.match|0),[Ue.IF_ERROR],h([Ue.POP],[Ue.PUSH_NULL]),[]))},zero_or_more(E,C){let _=w(E.expression,{sp:C.sp+1,env:l(C.env),action:null});return h([Ue.PUSH_EMPTY_ARRAY],_,y(_),[Ue.POP])},one_or_more(E,C){let _=w(E.expression,{sp:C.sp+1,env:l(C.env),action:null});return h([Ue.PUSH_EMPTY_ARRAY],_,m(E.expression.match|0,[Ue.IF_NOT_ERROR],h(y(_),[Ue.POP]),h([Ue.POP],[Ue.POP],[Ue.PUSH_FAILED])))},group(E,C){return w(E.expression,{sp:C.sp,env:l(C.env),action:null})},semantic_and(E,C){return g(E,!1,C)},semantic_not(E,C){return g(E,!0,C)},rule_ref(E){return[Ue.RULE,PJ.indexOfRule(e,E.name)]},literal(E){if(E.value.length>0){let C=E.match|0,F=C===lS||C===sh&&!E.ignoreCase?o(E.ignoreCase?E.value.toLowerCase():E.value):null,H=C!==sh?a({type:"literal",value:E.value,ignoreCase:E.ignoreCase}):null;return m(C,E.ignoreCase?[Ue.MATCH_STRING_IC,F]:[Ue.MATCH_STRING,F],E.ignoreCase?[Ue.ACCEPT_N,E.value.length]:[Ue.ACCEPT_STRING,F],[Ue.FAIL,H])}return[Ue.PUSH_EMPTY_STRING]},class(E){let C=E.match|0,_=C===lS?s(E):null,F=C!==sh?a({type:"class",value:E.parts,inverted:E.inverted,ignoreCase:E.ignoreCase}):null;return m(C,[Ue.MATCH_CHAR_CLASS,_],[Ue.ACCEPT_N,1],[Ue.FAIL,F])},any(E){let C=E.match|0,_=C!==sh?a({type:"any"}):null;return m(C,[Ue.MATCH_ANY],[Ue.ACCEPT_N,1],[Ue.FAIL,_])}});w(e)}Z9.exports=TJ});var e7=be((_we,Q9)=>{"use strict";var Dwe=B(x()),hS=class{constructor(t,n,r){this.sp=-1,this.maxSp=-1,this.varName=n,this.ruleName=t,this.type=r}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 n=this.name(++this.sp)+" = "+t+";";return this.sp>this.maxSp&&(this.maxSp=this.sp),n}pop(t){return t!==void 0?(this.sp-=t,Array.from({length:t},(n,r)=>this.name(this.sp+1+r))):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,n)=>this.name(n)).join(", ")+";"}checkedIf(t,n,r){let i=this.sp;if(n(),r){let o=this.sp;if(this.sp=i,r(),o!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Branches of a condition can't move the stack pointer differently (before: "+i+", after then: "+o+", after else: "+this.sp+").")}}checkedLoop(t,n){let r=this.sp;if(n(),r!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Body of a loop can't move the stack pointer (before: "+r+", after: "+this.sp+").")}};Q9.exports=hS});var dS=be((Fwe,t7)=>{"use strict";var Bwe=B(x());t7.exports="2.0.1"});var n7=be(a2=>{"use strict";var $we=B(x());function Qa(e){return e.charCodeAt(0).toString(16).toUpperCase()}a2.hex=Qa;function RJ(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"+Qa(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Qa(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Qa(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Qa(t))}a2.stringEscape=RJ;function OJ(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"+Qa(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Qa(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Qa(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Qa(t))}a2.regexpClassEscape=OJ});var i7=be(s7=>{var Pwe=B(x()),r7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");s7.encode=function(e){if(0<=e&&e<r7.length)return r7[e];throw new TypeError("Must be between 0 and 63: "+e)}});var c7=be(u7=>{var Twe=B(x()),NJ=i7(),o7=5,a7=1<<o7,LJ=a7-1,UJ=a7;function HJ(e){return e<0?(-e<<1)+1:(e<<1)+0}u7.encode=function(t){let n="",r,i=HJ(t);do r=i&LJ,i>>>=o7,i>0&&(r|=UJ),n+=NJ.encode(r);while(i>0);return n}});var c2=be(ac=>{var Owe=B(x());function MJ(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw new Error('"'+t+'" is a required argument.')}ac.getArg=MJ;var f7=(function(){return!("__proto__"in Object.create(null))})();function h7(e){return e}function qJ(e){return d7(e)?"$"+e:e}ac.toSetString=f7?h7:qJ;function jJ(e){return d7(e)?e.slice(1):e}ac.fromSetString=f7?h7:jJ;function d7(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 n=t-10;n>=0;n--)if(e.charCodeAt(n)!==36)return!1;return!0}function l7(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function KJ(e,t){let n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=l7(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:l7(e.name,t.name)}ac.compareByGeneratedPositionsInflated=KJ;var pS="http:",kp=`${pS}//host`;function p7(e){return t=>{let n=Tp(t),r=mS(t),i=new URL(t,r);e(i);let o=i.toString();return n==="absolute"?o:n==="scheme-relative"?o.slice(pS.length):n==="path-absolute"?o.slice(kp.length):gS(r,o)}}function oc(e,t){return new URL(e,t).toString()}function VJ(e,t){let n=0;do{let r=e+n++;if(t.indexOf(r)===-1)return r}while(!0)}function mS(e){let t=e.split("..").length-1,n=VJ("p",e),r=`${kp}/`;for(let i=0;i<t;i++)r+=`${n}/`;return r}var GJ=/^[A-Za-z0-9\+\-\.]+:/;function Tp(e){return e[0]==="/"?e[1]==="/"?"scheme-relative":"path-absolute":GJ.test(e)?"absolute":"path-relative"}function gS(e,t){typeof e=="string"&&(e=new URL(e)),typeof t=="string"&&(t=new URL(t));let n=t.pathname.split("/"),r=e.pathname.split("/");for(r.length>0&&!r[r.length-1]&&r.pop();n.length>0&&r.length>0&&n[0]===r[0];)n.shift(),r.shift();return r.map(()=>"..").concat(n).join("/")+t.search+t.hash}var zJ=p7(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),u2=p7(e=>{});ac.normalize=u2;function WJ(e,t){let n=Tp(t),r=Tp(e);if(e=zJ(e),n==="absolute")return oc(t,void 0);if(r==="absolute")return oc(t,e);if(n==="scheme-relative")return u2(t);if(r==="scheme-relative")return oc(t,oc(e,kp)).slice(pS.length);if(n==="path-absolute")return u2(t);if(r==="path-absolute")return oc(t,oc(e,kp)).slice(kp.length);let i=mS(t+e),o=oc(t,oc(e,i));return gS(i,o)}ac.join=WJ;function YJ(e,t){let n=XJ(e,t);return typeof n=="string"?n:u2(t)}ac.relative=YJ;function XJ(e,t){if(Tp(e)!==Tp(t))return null;let r=mS(e+t),i=new URL(e,r),o=new URL(t,r);try{new URL("",o.toString())}catch{return null}return o.protocol!==i.protocol||o.user!==i.user||o.password!==i.password||o.hostname!==i.hostname||o.port!==i.port?null:gS(i,o)}});var g7=be(m7=>{var Lwe=B(x()),vS=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,n){let r=new e;for(let i=0,o=t.length;i<o;i++)r.add(t[i],n);return r}size(){return this._set.size}add(t,n){let r=this.has(t),i=this._array.length;(!r||n)&&this._array.push(t),r||this._set.set(t,i)}has(t){return this._set.has(t)}indexOf(t){let n=this._set.get(t);if(n>=0)return n;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()}};m7.ArraySet=vS});var y7=be(w7=>{var Hwe=B(x()),v7=c2();function ZJ(e,t){let n=e.generatedLine,r=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return r>n||r==n&&o>=i||v7.compareByGeneratedPositionsInflated(e,t)<=0}var wS=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,n){this._array.forEach(t,n)}add(t){ZJ(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(v7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};w7.MappingList=wS});var yS=be(E7=>{var qwe=B(x()),Rp=c7(),kn=c2(),l2=g7().ArraySet,JJ=y7().MappingList,f2=class e{constructor(t){t||(t={}),this._file=kn.getArg(t,"file",null),this._sourceRoot=kn.getArg(t,"sourceRoot",null),this._skipValidation=kn.getArg(t,"skipValidation",!1),this._sources=new l2,this._names=new l2,this._mappings=new JJ,this._sourcesContents=null}static fromSourceMap(t){let n=t.sourceRoot,r=new e({file:t.file,sourceRoot:n});return t.eachMapping(function(i){let o={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(o.source=i.source,n!=null&&(o.source=kn.relative(n,o.source)),o.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(o.name=i.name)),r.addMapping(o)}),t.sources.forEach(function(i){let o=i;n!=null&&(o=kn.relative(n,i)),r._sources.has(o)||r._sources.add(o);let s=t.sourceContentFor(i);s!=null&&r.setSourceContent(i,s)}),r}addMapping(t){let n=kn.getArg(t,"generated"),r=kn.getArg(t,"original",null),i=kn.getArg(t,"source",null),o=kn.getArg(t,"name",null);this._skipValidation||this._validateMapping(n,r,i,o),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:r&&r.line,originalColumn:r&&r.column,source:i,name:o})}setSourceContent(t,n){let r=t;this._sourceRoot!=null&&(r=kn.relative(this._sourceRoot,r)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[kn.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[kn.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(t,n,r){let i=n;if(n==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.`);i=t.file}let o=this._sourceRoot;o!=null&&(i=kn.relative(o,i));let s=this._mappings.toArray().length>0?new l2:this._sources,a=new l2;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){let m=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});m.source!=null&&(u.source=m.source,r!=null&&(u.source=kn.join(r,u.source)),o!=null&&(u.source=kn.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&&!s.has(l)&&s.add(l);let h=u.name;h!=null&&!a.has(h)&&a.add(h)},this),this._sources=s,this._names=a,t.sources.forEach(function(u){let l=t.sourceContentFor(u);l!=null&&(r!=null&&(u=kn.join(r,u)),o!=null&&(u=kn.relative(o,u)),this.setSourceContent(u,l))},this)}_validateMapping(t,n,r,i){if(n&&typeof n.line!="number"&&typeof n.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&&!n&&!r&&!i)){if(!(t&&"line"in t&&"column"in t&&n&&"line"in n&&"column"in n&&t.line>0&&t.column>=0&&n.line>0&&n.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:r,original:n,name:i}))}}_serializeMappings(){let t=0,n=1,r=0,i=0,o=0,s=0,a="",u,l,h,m,p=this._mappings.toArray();for(let d=0,v=p.length;d<v;d++){if(l=p[d],u="",l.generatedLine!==n)for(t=0;l.generatedLine!==n;)u+=";",n++;else if(d>0){if(!kn.compareByGeneratedPositionsInflated(l,p[d-1]))continue;u+=","}u+=Rp.encode(l.generatedColumn-t),t=l.generatedColumn,l.source!=null&&(m=this._sources.indexOf(l.source),u+=Rp.encode(m-s),s=m,u+=Rp.encode(l.originalLine-1-i),i=l.originalLine-1,u+=Rp.encode(l.originalColumn-r),r=l.originalColumn,l.name!=null&&(h=this._names.indexOf(l.name),u+=Rp.encode(h-o),o=h)),a+=u}return a}_generateSourcesContent(t,n){return t.map(function(r){if(!this._sourcesContents)return null;n!=null&&(r=kn.relative(n,r));let i=kn.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]: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())}};f2.prototype._version=3;E7.SourceMapGenerator=f2});var A7=be(b7=>{var Kwe=B(x()),QJ=yS().SourceMapGenerator,h2=c2(),eQ=/(\r?\n)/,tQ=10,ih="$$$isSourceNode$$$",ES=class e{constructor(t,n,r,i,o){this.children=[],this.sourceContents={},this.line=t??null,this.column=n??null,this.source=r??null,this.name=o??null,this[ih]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,n,r){let i=new e,o=t.split(eQ),s=0,a=function(){let d=g(),v=g()||"";return d+v;function g(){return s<o.length?o[s++]:void 0}},u=1,l=0,h=null,m;return n.eachMapping(function(d){if(h!==null)if(u<d.generatedLine)p(h,a()),u++,l=0;else{m=o[s]||"";let v=m.substr(0,d.generatedColumn-l);o[s]=m.substr(d.generatedColumn-l),l=d.generatedColumn,p(h,v),h=d;return}for(;u<d.generatedLine;)i.add(a()),u++;l<d.generatedColumn&&(m=o[s]||"",i.add(m.substr(0,d.generatedColumn)),o[s]=m.substr(d.generatedColumn),l=d.generatedColumn),h=d},this),s<o.length&&(h&&p(h,a()),i.add(o.splice(s).join(""))),n.sources.forEach(function(d){let v=n.sourceContentFor(d);v!=null&&(r!=null&&(d=h2.join(r,d)),i.setSourceContent(d,v))}),i;function p(d,v){if(d===null||d.source===void 0)i.add(v);else{let g=r?h2.join(r,d.source):d.source;i.add(new e(d.originalLine,d.originalColumn,g,v,d.name))}}}add(t){if(Array.isArray(t))t.forEach(function(n){this.add(n)},this);else if(t[ih]||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 n=t.length-1;n>=0;n--)this.prepend(t[n]);else if(t[ih]||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 n;for(let r=0,i=this.children.length;r<i;r++)n=this.children[r],n[ih]?n.walk(t):n!==""&&t(n,{source:this.source,line:this.line,column:this.column,name:this.name})}join(t){let n,r,i=this.children.length;if(i>0){for(n=[],r=0;r<i-1;r++)n.push(this.children[r]),n.push(t);n.push(this.children[r]),this.children=n}return this}replaceRight(t,n){let r=this.children[this.children.length-1];return r[ih]?r.replaceRight(t,n):typeof r=="string"?this.children[this.children.length-1]=r.replace(t,n):this.children.push("".replace(t,n)),this}setSourceContent(t,n){this.sourceContents[h2.toSetString(t)]=n}walkSourceContents(t){for(let r=0,i=this.children.length;r<i;r++)this.children[r][ih]&&this.children[r].walkSourceContents(t);let n=Object.keys(this.sourceContents);for(let r=0,i=n.length;r<i;r++)t(h2.fromSetString(n[r]),this.sourceContents[n[r]])}toString(){let t="";return this.walk(function(n){t+=n}),t}toStringWithSourceMap(t){let n={code:"",line:1,column:0},r=new QJ(t),i=!1,o=null,s=null,a=null,u=null;return this.walk(function(l,h){n.code+=l,h.source!==null&&h.line!==null&&h.column!==null?((o!==h.source||s!==h.line||a!==h.column||u!==h.name)&&r.addMapping({source:h.source,original:{line:h.line,column:h.column},generated:{line:n.line,column:n.column},name:h.name}),o=h.source,s=h.line,a=h.column,u=h.name,i=!0):i&&(r.addMapping({generated:{line:n.line,column:n.column}}),o=null,i=!1);for(let m=0,p=l.length;m<p;m++)l.charCodeAt(m)===tQ?(n.line++,n.column=0,m+1===p?(o=null,i=!1):i&&r.addMapping({source:h.source,original:{line:h.line,column:h.column},generated:{line:n.line,column:n.column},name:h.name})):n.column++}),this.walkSourceContents(function(l,h){r.setSourceContent(l,h)}),{code:n.code,map:r}}};b7.SourceNode=ES});var S7=be(bS=>{var Gwe=B(x());bS.SourceMapGenerator=yS().SourceMapGenerator;bS.SourceNode=A7().SourceNode});var F7=be((zwe,D7)=>{"use strict";var Wwe=B(x()),nQ=ic(),qt=uS(),rQ=e7(),sQ=dS(),{stringEscape:js,regexpClassEscape:AS}=n7(),{SourceNode:di}=S7();function _7(e,t,n){let r=t.start.line,i=t.start.column-1,o=e.split(`
`);return o.length===1?new di(r,i,t.source,e,n):new di(null,null,t.source,o.map((s,a)=>new di(r+a,a===0?i:0,t.source,a===o.length-1?s:[s,`
`],n)))}function C7(e,t,n,r,i){return n?new di(null,null,n.source,[e,_7(t,n,i),new di(n.end.line,n.end.column-1,n.source,r)]):new di(null,null,null,[e,t,r])}function iQ(e,t){function n(g){return g instanceof di?g:g.replace(/^(.+)$/gm," $1")}function r(g){return"peg$c"+g}function i(g){return"peg$r"+g}function o(g){return"peg$e"+g}function s(g){return"peg$f"+g}function a(g){return"peg$parse"+g}function u(){function g(C){return'"'+js(C)+'"'}function y(C){return"/^["+(C.inverted?"^":"")+C.value.map(_=>Array.isArray(_)?AS(_[0])+"-"+AS(_[1]):AS(_)).join("")+"]/"+(C.ignoreCase?"i":"")}function w(C){switch(C.type){case"rule":return'peg$otherExpectation("'+js(C.value)+'")';case"literal":return'peg$literalExpectation("'+js(C.value)+'", '+C.ignoreCase+")";case"class":return"peg$classExpectation(["+C.value.map(F=>Array.isArray(F)?'["'+js(F[0])+'", "'+js(F[1])+'"]':'"'+js(F)+'"').join(", ")+"], "+C.inverted+", "+C.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(C)+")")}}function E(C,_){return C7(`
var ${s(_)} = function(${C.params.join(", ")}) {`,C.body,C.location,"};")}return new di(null,null,t.grammarSource,[e.literals.map((C,_)=>" var "+r(_)+" = "+g(C)+";").concat("",e.classes.map((C,_)=>" var "+i(_)+" = "+y(C)+";")).concat("",e.expectations.map((C,_)=>" var "+o(_)+" = "+w(C)+";")).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 h(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 rQ(g.name,"s","var");function E(_){let F=0,H=_.length,K=[],S;function I(T,O){let R=O+3,N=_[F+R-2],P=_[F+R-1],M,Y;w.checkedIf(F,()=>{F+=R,M=E(_.slice(F,F+N)),F+=N},P>0?()=>{Y=E(_.slice(F,F+P)),F+=P}:null),K.push("if ("+T+") {"),K.push(...M.map(n)),P>0&&(K.push("} else {"),K.push(...Y.map(n))),K.push("}")}function q(T){let R=_[F+2-1],N;w.checkedLoop(F,()=>{F+=2,N=E(_.slice(F,F+R)),F+=R}),K.push("while ("+T+") {"),K.push(...N.map(n)),K.push("}")}function L(){let O=_[F+4-1],R=s(_[F+1])+"("+_.slice(F+4,F+4+O).map(N=>w.index(N)).join(", ")+")";w.pop(_[F+2]),K.push(w.push(R)),F+=4+O}for(;F<H;)switch(_[F]){case qt.PUSH_EMPTY_STRING:K.push(w.push("''")),F++;break;case qt.PUSH_CURR_POS:K.push(w.push("peg$currPos")),F++;break;case qt.PUSH_UNDEFINED:K.push(w.push("undefined")),F++;break;case qt.PUSH_NULL:K.push(w.push("null")),F++;break;case qt.PUSH_FAILED:K.push(w.push("peg$FAILED")),F++;break;case qt.PUSH_EMPTY_ARRAY:K.push(w.push("[]")),F++;break;case qt.POP:w.pop(),F++;break;case qt.POP_CURR_POS:K.push("peg$currPos = "+w.pop()+";"),F++;break;case qt.POP_N:w.pop(_[F+1]),F+=2;break;case qt.NIP:S=w.pop(),w.pop(),K.push(w.push(S)),F++;break;case qt.APPEND:S=w.pop(),K.push(w.top()+".push("+S+");"),F++;break;case qt.WRAP:K.push(w.push("["+w.pop(_[F+1]).join(", ")+"]")),F+=2;break;case qt.TEXT:K.push(w.push("input.substring("+w.pop()+", peg$currPos)")),F++;break;case qt.PLUCK:{let O=_[F+3-1],R=3+O;S=_.slice(F+3,F+R),S=O===1?w.index(S[0]):`[ ${S.map(N=>w.index(N)).join(", ")} ]`,w.pop(_[F+1]),K.push(w.push(S)),F+=R;break}case qt.IF:I(w.top(),0);break;case qt.IF_ERROR:I(w.top()+" === peg$FAILED",0);break;case qt.IF_NOT_ERROR:I(w.top()+" !== peg$FAILED",0);break;case qt.WHILE_NOT_ERROR:q(w.top()+" !== peg$FAILED");break;case qt.MATCH_ANY:I("input.length > peg$currPos",0);break;case qt.MATCH_STRING:I(e.literals[_[F+1]].length>1?"input.substr(peg$currPos, "+e.literals[_[F+1]].length+") === "+r(_[F+1]):"input.charCodeAt(peg$currPos) === "+e.literals[_[F+1]].charCodeAt(0),1);break;case qt.MATCH_STRING_IC:I("input.substr(peg$currPos, "+e.literals[_[F+1]].length+").toLowerCase() === "+r(_[F+1]),1);break;case qt.MATCH_CHAR_CLASS:I(i(_[F+1])+".test(input.charAt(peg$currPos))",1);break;case qt.ACCEPT_N:K.push(w.push(_[F+1]>1?"input.substr(peg$currPos, "+_[F+1]+")":"input.charAt(peg$currPos)")),K.push(_[F+1]>1?"peg$currPos += "+_[F+1]+";":"peg$currPos++;"),F+=2;break;case qt.ACCEPT_STRING:K.push(w.push(r(_[F+1]))),K.push(e.literals[_[F+1]].length>1?"peg$currPos += "+e.literals[_[F+1]].length+";":"peg$currPos++;"),F+=2;break;case qt.FAIL:K.push(w.push("peg$FAILED")),K.push("if (peg$silentFails === 0) { peg$fail("+o(_[F+1])+"); }"),F+=2;break;case qt.LOAD_SAVED_POS:K.push("peg$savedPos = "+w.index(_[F+1])+";"),F+=2;break;case qt.UPDATE_SAVED_POS:K.push("peg$savedPos = peg$currPos;"),F++;break;case qt.CALL:L();break;case qt.RULE:K.push(w.push(a(e.rules[_[F+1]].name)+"()")),F+=2;break;case qt.SILENT_FAILS_ON:K.push("peg$silentFails++;"),F++;break;case qt.SILENT_FAILS_OFF:K.push("peg$silentFails--;"),F++;break;default:throw new Error("Invalid opcode: "+_[F]+".")}return K}let C=E(g.bytecode);return y.push(C7(" function ",a(g.name),g.nameLocation,`() {
`,g.name)),t.trace&&y.push(" var startPos = peg$currPos;"),y.push(n(w.defines())),y.push(...l('"'+js(g.name)+'"',nQ.indexOfRule(e,g.name)).map(n)),y.push(...C.map(n)),y.push(...h('"'+js(g.name)+'"',w.result()).map(n)),y.push("}"),y}function p(g){return g.codeLocation?_7(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(n)),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 di(null,null,t.grammarSource,g.map(E=>E instanceof di?E:E+`
`))}function v(g){function y(){return[`// Generated by Peggy ${sQ}.`,"//","// 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 C={bare(){return[...y(),"(function() {",' "use strict";',"",g,"",n("return "+w()+";"),"})()"]},commonjs(){let _=Object.keys(t.dependencies),F=y();return F.push("",'"use strict";',""),_.length>0&&(_.forEach(H=>{F.push("var "+H+' = require("'+js(t.dependencies[H])+'");')}),F.push("")),F.push(g,"","module.exports = "+w()+";"),F},es(){let _=Object.keys(t.dependencies),F=y();return F.push(""),_.length>0&&(_.forEach(H=>{F.push("import "+H+' from "'+js(t.dependencies[H])+'";')}),F.push("")),F.push(g,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),F},amd(){let _=Object.keys(t.dependencies),H="["+_.map(S=>t.dependencies[S]).map(S=>'"'+js(S)+'"').join(", ")+"]",K=_.join(", ");return[...y(),"define("+H+", function("+K+") {",' "use strict";',"",g,"",n("return "+w()+";"),"});"]},globals(){return[...y(),"(function(root) {",' "use strict";',"",g,"",n("root."+t.exportVar+" = "+w()+";"),"})(this);"]},umd(){let _=Object.keys(t.dependencies),F=_.map(q=>t.dependencies[q]),H="["+F.map(q=>'"'+js(q)+'"').join(", ")+"]",K=F.map(q=>'require("'+js(q)+'")').join(", "),S=_.join(", "),I=y();return I.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&&I.push(" } else {"," root."+t.exportVar+" = factory();"),I.push(" }","})(this, function("+S+") {",' "use strict";',"",g,"",n("return "+w()+";"),"});"),I}}[t.format]();return new di(null,null,t.grammarSource,C.map(_=>_ instanceof di?_:_+`
`))}e.code=v(d())}D7.exports=iQ});var I7=be((Ywe,B7)=>{"use strict";var Xwe=B(x()),oQ=ic(),aQ=hi();function uQ(e,t,n){function r(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,a,u){aQ.build({rule_ref(h){h.name===a&&(h.name=u,n.info(`Proxy rule "${a}" replaced by the rule "${u}"`,h.location,[{message:"This rule will be used",location:oQ.findRule(s,u).nameLocation}]))}})(s)}let o=[];e.rules.forEach((s,a)=>{r(s)&&(i(e,s.name,s.expression.name),t.allowedStartRules.indexOf(s.name)===-1&&o.push(a))}),o.reverse(),o.forEach(s=>{e.rules.splice(s,1)})}B7.exports=uQ});var x7=be((Zwe,$7)=>{"use strict";var Jwe=B(x()),cQ=hi();function lQ(e,t,n){function r(s){let a={};return Object.keys(s).forEach(u=>{a[u]=s[u]}),a}function i(s,a){o(s.expression,r(a))}let o=cQ.build({rule(s){o(s.expression,{})},choice(s,a){s.alternatives.forEach(u=>{o(u,r(a))})},action:i,labeled(s,a){let u=s.label;u&&Object.prototype.hasOwnProperty.call(a,u)&&n.error(`Label "${s.label}" is already defined`,s.labelLocation,[{message:"Original label location",location:a[u]}]),o(s.expression,a),a[s.label]=s.labelLocation},text:i,simple_and:i,simple_not:i,optional:i,zero_or_more:i,one_or_more:i,group:i});o(e)}$7.exports=lQ});var k7=be((Qwe,P7)=>{"use strict";var eye=B(x()),fQ=hi();function hQ(e,t,n){let r={};fQ.build({rule(o){if(Object.prototype.hasOwnProperty.call(r,o.name)){n.error(`Rule "${o.name}" is already defined`,o.nameLocation,[{message:"Original rule location",location:r[o.name]}]);return}r[o.name]=o.nameLocation}})(e)}P7.exports=hQ});var O7=be((tye,R7)=>{"use strict";var nye=B(x()),T7=ic(),dQ=hi();function pQ(e,t,n){let r=[],i=[],o=dQ.build({rule(s){r.push(s.name),o(s.expression),r.pop()},sequence(s){s.elements.every(a=>(o(a),!T7.alwaysConsumesOnSuccess(e,a)))},rule_ref(s){i.push(s);let a=T7.findRule(e,s.name);if(r.indexOf(s.name)!==-1){r.push(s.name),n.error("Possible infinite loop when parsing (left recursion: "+r.join(" -> ")+")",a.nameLocation,i.map((u,l,h)=>({message:l+1!==h.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),i.pop()}});o(e)}R7.exports=pQ});var U7=be((rye,L7)=>{"use strict";var sye=B(x()),N7=ic(),mQ=hi();function gQ(e,t,n){mQ.build({zero_or_more(i){N7.alwaysConsumesOnSuccess(e,i.expression)||n.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",i.location)},one_or_more(i){N7.alwaysConsumesOnSuccess(e,i.expression)||n.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",i.location)}})(e)}L7.exports=gQ});var M7=be((iye,H7)=>{"use strict";var oye=B(x()),vQ=ic(),wQ=hi();function yQ(e,t,n){wQ.build({rule_ref(i){vQ.findRule(e,i.name)||n.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}H7.exports=yQ});var j7=be((aye,q7)=>{"use strict";var uye=B(x()),EQ=hi();function bQ(e,t,n){let r=EQ.build({action(i){r(i.expression,i)},labeled(i,o){i.pick&&o&&n.error('"@" cannot be used with an action block',i.labelLocation,[{message:"Action block location",location:o.codeLocation}]),r(i.expression)}});r(e)}q7.exports=bQ});var V7=be((cye,K7)=>{"use strict";var lye=B(x()),AQ=i2(),SS=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(){}},CS=class{constructor(t){this._callbacks=new SS(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new AQ(...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}};K7.exports=CS});var G7=be((exports,module)=>{"use strict";var fye=B(x()),generateBytecode=J9(),generateJS=F7(),inferenceMatchResult=cS(),removeProxyRules=I7(),reportDuplicateLabels=x7(),reportDuplicateRules=k7(),reportInfiniteRecursion=O7(),reportInfiniteRepetition=U7(),reportUndefinedRules=M7(),reportIncorrectPlucking=j7(),Session=V7(),visitor=hi();function processOptions(e,t){let n={};return Object.keys(e).forEach(r=>{n[r]=e[r]}),Object.keys(t).forEach(r=>{Object.prototype.hasOwnProperty.call(n,r)||(n[r]=t[r])}),n}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 W7=be((hye,z7)=>{"use strict";var dye=B(x()),SQ={$:"text","&":"simple_and","!":"simple_not"},CQ={"?":"optional","*":"zero_or_more","+":"one_or_more"},_Q={"&":"semantic_and","!":"semantic_not"};function DQ(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}function uc(e,t,n,r){var i=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(i,uc.prototype),i.expected=t,i.found=n,i.location=r,i.name="SyntaxError",i}DQ(uc,Error);function _S(e,t,n){return n=n||" ",e.length>t?e:(t-=e.length,n+=n.repeat(t),e+n.slice(0,t))}uc.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var n=null,r;for(r=0;r<e.length;r++)if(e[r].source===this.location.source){n=e[r].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,o=this.location.source+":"+i.line+":"+i.column;if(n){var s=this.location.end,a=_S("",i.line.toString().length," "),u=n[i.line-1],l=i.line===s.line?s.column:u.length+1,h=l-i.column||1;t+=`
--> `+o+`
`+a+` |
`+i.line+" | "+u+`
`+a+" | "+_S("",i.column-1," ")+_S("",h,"^")}else t+=`
at `+o}return t};uc.buildMessage=function(e,t){var n={literal:function(l){return'"'+i(l.text)+'"'},class:function(l){var h=l.parts.map(function(m){return Array.isArray(m)?o(m[0])+"-"+o(m[1]):o(m)});return"["+(l.inverted?"^":"")+h.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(l){return l.description}};function r(l){return l.charCodeAt(0).toString(16).toUpperCase()}function i(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(h){return"\\x0"+r(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+r(h)})}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(h){return"\\x0"+r(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+r(h)})}function s(l){return n[l.type](l)}function a(l){var h=l.map(s),m,p;if(h.sort(),h.length>0){for(m=1,p=1;m<h.length;m++)h[m-1]!==h[m]&&(h[p]=h[m],p++);h.length=p}switch(h.length){case 1:return h[0];case 2:return h[0]+" or "+h[1];default:return h.slice(0,-1).join(", ")+", or "+h[h.length-1]}}function u(l){return l?'"'+i(l)+'"':"end of input"}return"Expected "+a(e)+" but "+u(t)+" found."};function FQ(e,t){t=t!==void 0?t:{};var n={},r=t.grammarSource,i={Grammar:o0},o=o0,s="{",a="}",u="=",l="/",h="@",m=":",p="$",d="&",v="!",g="?",y="*",w="+",E="(",C=")",_=" ",F="\v",H="\f",K=" ",S="\xA0",I="\uFEFF",q=`
`,L=`\r
`,T="\r",O="\u2028",R="\u2029",N="/*",P="*/",M="//",Y="_",V="\\",X="\u200C",te="\u200D",ae="i",me='"',he="'",De="[",Pe="^",Ie="]",se="-",pe="0",Fe="b",Re="f",Ve="n",Oe="r",pt="t",Qe="v",ct="x",gr="u",vn=".",wn=";",lt=/^[\n\r\u2028\u2029]/,Tn=/^[0-9]/,es=/^[0-9a-f]/i,gi=/^[{}]/,Dt=/^[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]/,Ze=/^[\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]/,Te=/^[\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]/,un=/^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/,Or=/^[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]/,mt=/^[\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]/,cc=/^[\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]/,Nr=/^[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]/,Se=/^[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/,tu=/^[_\u203F-\u2040\u2054\uFE33-\uFE34\uFE4D-\uFE4F\uFF3F]/,Lt=/^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,vr=nt("{",!1),Xi=nt("}",!1),Cl=nt("=",!1),nu=nt("/",!1),uh=nt("@",!1),ru=nt(":",!1),Zi=nt("$",!1),jt=nt("&",!1),Ks=nt("!",!1),_l=nt("?",!1),ch=nt("*",!1),lc=nt("+",!1),su=nt("(",!1),lh=nt(")",!1),Dl=Il(),fc=wi("whitespace"),fh=nt(" ",!1),ie=nt("\v",!1),we=nt("\f",!1),je=nt(" ",!1),Me=nt("\xA0",!1),et=nt("\uFEFF",!1),gt=zn([`
`,"\r","\u2028","\u2029"],!1,!1),wt=wi("end of line"),Rn=nt(`
`,!1),cn=nt(`\r
`,!1),Vs=nt("\r",!1),Ji=nt("\u2028",!1),Lr=nt("\u2029",!1),ts=wi("comment"),Bn=nt("/*",!1),Ur=nt("*/",!1),iu=nt("//",!1),ou=wi("identifier"),hh=nt("_",!1),wr=nt("\\",!1),Ut=nt("\u200C",!1),In=nt("\u200D",!1),ut=wi("literal"),ln=nt("i",!1),yr=wi("string"),sn=nt('"',!1),ns=nt("'",!1),_s=wi("character class"),Gs=nt("[",!1),vi=nt("^",!1),Qi=nt("]",!1),Fl=nt("-",!1),Hp=nt("0",!1),dh=nt("b",!1),C2=nt("f",!1),Mp=nt("n",!1),Bl=nt("r",!1),qp=nt("t",!1),_2=nt("v",!1),ph=nt("x",!1),mh=nt("u",!1),gh=zn([["0","9"]],!1,!1),D2=zn([["0","9"],["a","f"]],!1,!0),jp=nt(".",!1),vh=wi("code block"),au=zn(["{","}"],!1,!1),uu=zn([["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),Kp=zn([["\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),Vp=zn(["\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),F2=zn(["\u01C5","\u01C8","\u01CB","\u01F2",["\u1F88","\u1F8F"],["\u1F98","\u1F9F"],["\u1FA8","\u1FAF"],"\u1FBC","\u1FCC","\u1FFC"],!1,!1),Gp=zn([["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),zp=zn(["\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),Wp=zn([["\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),Yp=zn([["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),B2=zn([["\u16EE","\u16F0"],["\u2160","\u2182"],["\u2185","\u2188"],"\u3007",["\u3021","\u3029"],["\u3038","\u303A"],["\uA6E6","\uA6EF"]],!1,!1),I2=zn(["_",["\u203F","\u2040"],"\u2054",["\uFE33","\uFE34"],["\uFE4D","\uFE4F"],"\uFF3F"],!1,!1),$2=zn([" ","\xA0","\u1680",["\u2000","\u200A"],"\u202F","\u205F","\u3000"],!1,!1),Xp=nt(";",!1),x2=function(D,G,ee){return{type:"grammar",topLevelInitializer:D,initializer:G,rules:ee,location:nn()}},P2=function(D){return{type:"top_level_initializer",code:D[0],codeLocation:D[1],location:nn()}},k2=function(D){return{type:"initializer",code:D[0],codeLocation:D[1],location:nn()}},T2=function(D,G,ee){return{type:"rule",name:D[0],nameLocation:D[1],expression:G!==null?{type:"named",name:G,expression:ee,location:nn()}:ee,location:nn()}},wh=function(D,G){return G.length>0?{type:"choice",alternatives:[D].concat(G),location:nn()}:D},R2=function(D,G){return G!==null?{type:"action",expression:D,code:G[0],codeLocation:G[1],location:nn()}:D},O2=function(D,G){return G.length>0||D.type==="labeled"&&D.pick?{type:"sequence",elements:[D].concat(G),location:nn()}:D},N2=function(D,G,ee){return ee.type.startsWith("semantic_")&&bh('"@" cannot be used on a semantic predicate',D),{type:"labeled",label:G!==null?G[0]:null,labelLocation:G!==null?G[1]:D,pick:!0,expression:ee,location:nn()}},L2=function(D,G){return{type:"labeled",label:D[0],labelLocation:D[1],expression:G,location:nn()}},U2=function(){return nn()},tn=function(D){return Yo.indexOf(D[0])>=0&&bh(`Label can't be a reserved word "${D[0]}"`,D[1]),D},Zt=function(D,G){return{type:SQ[D],expression:G,location:nn()}},H2=function(D,G){return{type:CQ[G],expression:D,location:nn()}},M2=function(D){return D.type==="labeled"||D.type==="sequence"?{type:"group",expression:D,location:nn()}:D},q2=function(D){return{type:"rule_ref",name:D[0],location:nn()}},j2=function(D,G){return{type:_Q[D],code:G[0],codeLocation:G[1],location:nn()}},K2=function(D,G){return[D+G.join(""),nn()]},V2=function(D,G){return{type:"literal",value:D,ignoreCase:G!==null,location:nn()}},Zp=function(D){return D.join("")},G2=function(D){return D.join("")},$n=function(D,G,ee){return{type:"class",parts:G.filter(Z=>Z!==""),inverted:D!==null,ignoreCase:ee!==null,location:nn()}},yh=function(D,G){return D.charCodeAt(0)>G.charCodeAt(0)&&bh("Invalid character range: "+eo()+"."),[D,G]},Ko=function(){return""},Jp=function(){return"\0"},Eh=function(){return"\b"},rs=function(){return"\f"},Qp=function(){return`
`},e0=function(){return"\r"},t0=function(){return" "},n0=function(){return"\v"},r0=function(D){return String.fromCharCode(parseInt(D,16))},s0=function(D){return String.fromCharCode(parseInt(D,16))},Hr=function(){return{type:"any",location:nn()}},z2=function(D){return[D,nn()]},U=0,ft=0,hc=[{line:1,column:1}],On=0,cu=[],ce=0,Wt;if("startRule"in t){if(!(t.startRule in i))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');o=i[t.startRule]}function eo(){return e.substring(ft,U)}function i0(){return ft}function ZS(){return{source:r,start:ft,end:U}}function nn(){return fu(ft,U)}function JS(D,G){throw G=G!==void 0?G:fu(ft,U),Ch([wi(D)],e.substring(ft,U),G)}function bh(D,G){throw G=G!==void 0?G:fu(ft,U),Sh(D,G)}function nt(D,G){return{type:"literal",text:D,ignoreCase:G}}function zn(D,G,ee){return{type:"class",parts:D,inverted:G,ignoreCase:ee}}function Il(){return{type:"any"}}function lu(){return{type:"end"}}function wi(D){return{type:"other",description:D}}function Ah(D){var G=hc[D],ee;if(G)return G;for(ee=D-1;!hc[ee];)ee--;for(G=hc[ee],G={line:G.line,column:G.column};ee<D;)e.charCodeAt(ee)===10?(G.line++,G.column=1):G.column++,ee++;return hc[D]=G,G}function fu(D,G){var ee=Ah(D),Z=Ah(G);return{source:r,start:{offset:D,line:ee.line,column:ee.column},end:{offset:G,line:Z.line,column:Z.column}}}function Ae(D){U<On||(U>On&&(On=U,cu=[]),cu.push(D))}function Sh(D,G){return new uc(D,null,null,G)}function Ch(D,G,ee){return new uc(uc.buildMessage(D,G),D,G,ee)}function o0(){var D,G,ee,Z,fe,ge,Ht,En;if(D=U,G=Yt(),ee=U,Z=_h(),Z!==n?(fe=Yt(),ee=Z):(U=ee,ee=n),ee===n&&(ee=null),Z=U,fe=Dh(),fe!==n?(ge=Yt(),Z=fe):(U=Z,Z=n),Z===n&&(Z=null),fe=[],ge=U,Ht=a0(),Ht!==n?(En=Yt(),ge=Ht):(U=ge,ge=n),ge!==n)for(;ge!==n;)fe.push(ge),ge=U,Ht=a0(),Ht!==n?(En=Yt(),ge=Ht):(U=ge,ge=n);else fe=n;return fe!==n?(ft=D,D=x2(ee,Z,fe)):(U=D,D=n),D}function _h(){var D,G,ee,Z,fe;return D=U,e.charCodeAt(U)===123?(G=s,U++):(G=n,ce===0&&Ae(vr)),G!==n?(ee=Wo(),ee!==n?(e.charCodeAt(U)===125?(Z=a,U++):(Z=n,ce===0&&Ae(Xi)),Z!==n?(fe=Ol(),fe!==n?(ft=D,D=P2(ee)):(U=D,D=n)):(U=D,D=n)):(U=D,D=n)):(U=D,D=n),D}function Dh(){var D,G,ee;return D=U,G=Wo(),G!==n?(ee=Ol(),ee!==n?(ft=D,D=k2(G)):(U=D,D=n)):(U=D,D=n),D}function a0(){var D,G,ee,Z,fe,ge,Ht,En;return D=U,G=Mr(),G!==n?(ee=Yt(),Z=U,fe=Ph(),fe!==n?(ge=Yt(),Z=fe):(U=Z,Z=n),Z===n&&(Z=null),e.charCodeAt(U)===61?(fe=u,U++):(fe=n,ce===0&&Ae(Cl)),fe!==n?(ge=Yt(),Ht=Fh(),Ht!==n?(En=Ol(),En!==n?(ft=D,D=T2(G,Z,Ht)):(U=D,D=n)):(U=D,D=n)):(U=D,D=n)):(U=D,D=n),D}function Fh(){var D,G,ee,Z,fe,ge,Ht,En;if(D=U,G=tr(),G!==n){for(ee=[],Z=U,fe=Yt(),e.charCodeAt(U)===47?(ge=l,U++):(ge=n,ce===0&&Ae(nu)),ge!==n?(Ht=Yt(),En=tr(),En!==n?Z=En:(U=Z,Z=n)):(U=Z,Z=n);Z!==n;)ee.push(Z),Z=U,fe=Yt(),e.charCodeAt(U)===47?(ge=l,U++):(ge=n,ce===0&&Ae(nu)),ge!==n?(Ht=Yt(),En=tr(),En!==n?Z=En:(U=Z,Z=n)):(U=Z,Z=n);ft=D,D=wh(G,ee)}else U=D,D=n;return D}function tr(){var D,G,ee,Z,fe;return D=U,G=Bh(),G!==n?(ee=U,Z=Yt(),fe=Wo(),fe!==n?ee=fe:(U=ee,ee=n),ee===n&&(ee=null),ft=D,D=R2(G,ee)):(U=D,D=n),D}function Bh(){var D,G,ee,Z,fe,ge;if(D=U,G=Vo(),G!==n){for(ee=[],Z=U,fe=Yt(),ge=Vo(),ge!==n?Z=ge:(U=Z,Z=n);Z!==n;)ee.push(Z),Z=U,fe=Yt(),ge=Vo(),ge!==n?Z=ge:(U=Z,Z=n);ft=D,D=O2(G,ee)}else U=D,D=n;return D}function Vo(){var D,G,ee,Z;return D=U,G=u0(),G!==n?(ee=Ih(),ee===n&&(ee=null),Z=$h(),Z!==n?(ft=D,D=N2(G,ee,Z)):(U=D,D=n)):(U=D,D=n),D===n&&(D=U,G=Ih(),G!==n?(ee=Yt(),Z=$h(),Z!==n?(ft=D,D=L2(G,Z)):(U=D,D=n)):(U=D,D=n),D===n&&(D=$h())),D}function u0(){var D,G;return D=U,e.charCodeAt(U)===64?(G=h,U++):(G=n,ce===0&&Ae(uh)),G!==n&&(ft=D,G=U2()),D=G,D}function Ih(){var D,G,ee,Z;return D=U,G=Mr(),G!==n?(ee=Yt(),e.charCodeAt(U)===58?(Z=m,U++):(Z=n,ce===0&&Ae(ru)),Z!==n?(ft=D,D=tn(G)):(U=D,D=n)):(U=D,D=n),D}function $h(){var D,G,ee,Z;return D=U,G=W2(),G!==n?(ee=Yt(),Z=c0(),Z!==n?(ft=D,D=Zt(G,Z)):(U=D,D=n)):(U=D,D=n),D===n&&(D=c0()),D}function W2(){var D;return e.charCodeAt(U)===36?(D=p,U++):(D=n,ce===0&&Ae(Zi)),D===n&&(e.charCodeAt(U)===38?(D=d,U++):(D=n,ce===0&&Ae(jt)),D===n&&(e.charCodeAt(U)===33?(D=v,U++):(D=n,ce===0&&Ae(Ks)))),D}function c0(){var D,G,ee,Z;return D=U,G=l0(),G!==n?(ee=Yt(),Z=Y2(),Z!==n?(ft=D,D=H2(G,Z)):(U=D,D=n)):(U=D,D=n),D===n&&(D=l0()),D}function Y2(){var D;return e.charCodeAt(U)===63?(D=g,U++):(D=n,ce===0&&Ae(_l)),D===n&&(e.charCodeAt(U)===42?(D=y,U++):(D=n,ce===0&&Ae(ch)),D===n&&(e.charCodeAt(U)===43?(D=w,U++):(D=n,ce===0&&Ae(lc)))),D}function l0(){var D,G,ee,Z,fe,ge;return D=tv(),D===n&&(D=ye(),D===n&&(D=$l(),D===n&&(D=hu(),D===n&&(D=X2(),D===n&&(D=U,e.charCodeAt(U)===40?(G=E,U++):(G=n,ce===0&&Ae(su)),G!==n?(ee=Yt(),Z=Fh(),Z!==n?(fe=Yt(),e.charCodeAt(U)===41?(ge=C,U++):(ge=n,ce===0&&Ae(lh)),ge!==n?(ft=D,D=M2(Z)):(U=D,D=n)):(U=D,D=n)):(U=D,D=n)))))),D}function hu(){var D,G,ee,Z,fe,ge,Ht,En;return D=U,G=Mr(),G!==n?(ee=U,ce++,Z=U,fe=Yt(),ge=U,Ht=Ph(),Ht!==n?(En=Yt(),Ht=[Ht,En],ge=Ht):(U=ge,ge=n),ge===n&&(ge=null),e.charCodeAt(U)===61?(Ht=u,U++):(Ht=n,ce===0&&Ae(Cl)),Ht!==n?(fe=[fe,ge,Ht],Z=fe):(U=Z,Z=n),ce--,Z===n?ee=void 0:(U=ee,ee=n),ee!==n?(ft=D,D=q2(G)):(U=D,D=n)):(U=D,D=n),D}function X2(){var D,G,ee,Z;return D=U,G=Z2(),G!==n?(ee=Yt(),Z=Wo(),Z!==n?(ft=D,D=j2(G,Z)):(U=D,D=n)):(U=D,D=n),D}function Z2(){var D;return e.charCodeAt(U)===38?(D=d,U++):(D=n,ce===0&&Ae(jt)),D===n&&(e.charCodeAt(U)===33?(D=v,U++):(D=n,ce===0&&Ae(Ks))),D}function Wn(){var D;return e.length>U?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(Dl)),D}function dc(){var D,G;return ce++,e.charCodeAt(U)===9?(D=_,U++):(D=n,ce===0&&Ae(fh)),D===n&&(e.charCodeAt(U)===11?(D=F,U++):(D=n,ce===0&&Ae(ie)),D===n&&(e.charCodeAt(U)===12?(D=H,U++):(D=n,ce===0&&Ae(we)),D===n&&(e.charCodeAt(U)===32?(D=K,U++):(D=n,ce===0&&Ae(je)),D===n&&(e.charCodeAt(U)===160?(D=S,U++):(D=n,ce===0&&Ae(Me)),D===n&&(e.charCodeAt(U)===65279?(D=I,U++):(D=n,ce===0&&Ae(et)),D===n&&(D=v0())))))),ce--,D===n&&(G=n,ce===0&&Ae(fc)),D}function nr(){var D;return lt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(gt)),D}function Go(){var D,G;return ce++,e.charCodeAt(U)===10?(D=q,U++):(D=n,ce===0&&Ae(Rn)),D===n&&(e.substr(U,2)===L?(D=L,U+=2):(D=n,ce===0&&Ae(cn)),D===n&&(e.charCodeAt(U)===13?(D=T,U++):(D=n,ce===0&&Ae(Vs)),D===n&&(e.charCodeAt(U)===8232?(D=O,U++):(D=n,ce===0&&Ae(Ji)),D===n&&(e.charCodeAt(U)===8233?(D=R,U++):(D=n,ce===0&&Ae(Lr)))))),ce--,D===n&&(G=n,ce===0&&Ae(wt)),D}function f0(){var D,G;return ce++,D=J2(),D===n&&(D=zo()),ce--,D===n&&(G=n,ce===0&&Ae(ts)),D}function J2(){var D,G,ee,Z,fe,ge;if(D=U,e.substr(U,2)===N?(G=N,U+=2):(G=n,ce===0&&Ae(Bn)),G!==n){for(ee=[],Z=U,fe=U,ce++,e.substr(U,2)===P?(ge=P,U+=2):(ge=n,ce===0&&Ae(Ur)),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n);Z!==n;)ee.push(Z),Z=U,fe=U,ce++,e.substr(U,2)===P?(ge=P,U+=2):(ge=n,ce===0&&Ae(Ur)),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n);e.substr(U,2)===P?(Z=P,U+=2):(Z=n,ce===0&&Ae(Ur)),Z!==n?(G=[G,ee,Z],D=G):(U=D,D=n)}else U=D,D=n;return D}function h0(){var D,G,ee,Z,fe,ge;if(D=U,e.substr(U,2)===N?(G=N,U+=2):(G=n,ce===0&&Ae(Bn)),G!==n){for(ee=[],Z=U,fe=U,ce++,e.substr(U,2)===P?(ge=P,U+=2):(ge=n,ce===0&&Ae(Ur)),ge===n&&(ge=nr()),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n);Z!==n;)ee.push(Z),Z=U,fe=U,ce++,e.substr(U,2)===P?(ge=P,U+=2):(ge=n,ce===0&&Ae(Ur)),ge===n&&(ge=nr()),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n);e.substr(U,2)===P?(Z=P,U+=2):(Z=n,ce===0&&Ae(Ur)),Z!==n?(G=[G,ee,Z],D=G):(U=D,D=n)}else U=D,D=n;return D}function zo(){var D,G,ee,Z,fe,ge;if(D=U,e.substr(U,2)===M?(G=M,U+=2):(G=n,ce===0&&Ae(iu)),G!==n){for(ee=[],Z=U,fe=U,ce++,ge=nr(),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n);Z!==n;)ee.push(Z),Z=U,fe=U,ce++,ge=nr(),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n);G=[G,ee],D=G}else U=D,D=n;return D}function Mr(){var D,G,ee,Z;if(ce++,D=U,G=xh(),G!==n){for(ee=[],Z=d0();Z!==n;)ee.push(Z),Z=d0();ft=D,D=K2(G,ee)}else U=D,D=n;return ce--,D===n&&(G=n,ce===0&&Ae(ou)),D}function xh(){var D,G,ee;return D=Q2(),D===n&&(e.charCodeAt(U)===36?(D=p,U++):(D=n,ce===0&&Ae(Zi)),D===n&&(e.charCodeAt(U)===95?(D=Y,U++):(D=n,ce===0&&Ae(hh)),D===n&&(D=U,e.charCodeAt(U)===92?(G=V,U++):(G=n,ce===0&&Ae(wr)),G!==n?(ee=pc(),ee!==n?D=ee:(U=D,D=n)):(U=D,D=n)))),D}function d0(){var D;return D=xh(),D===n&&(D=ev(),D===n&&(D=kl(),D===n&&(D=Tl(),D===n&&(e.charCodeAt(U)===8204?(D=X,U++):(D=n,ce===0&&Ae(Ut)),D===n&&(e.charCodeAt(U)===8205?(D=te,U++):(D=n,ce===0&&Ae(In))))))),D}function Q2(){var D;return D=iv(),D===n&&(D=m0(),D===n&&(D=sv(),D===n&&(D=xl(),D===n&&(D=rv(),D===n&&(D=g0()))))),D}function ev(){var D;return D=to(),D===n&&(D=Pl()),D}function tv(){var D,G,ee;return ce++,D=U,G=Ph(),G!==n?(e.charCodeAt(U)===105?(ee=ae,U++):(ee=n,ce===0&&Ae(ln)),ee===n&&(ee=null),ft=D,D=V2(G,ee)):(U=D,D=n),ce--,D===n&&(G=n,ce===0&&Ae(ut)),D}function Ph(){var D,G,ee,Z;if(ce++,D=U,e.charCodeAt(U)===34?(G=me,U++):(G=n,ce===0&&Ae(sn)),G!==n){for(ee=[],Z=yi();Z!==n;)ee.push(Z),Z=yi();e.charCodeAt(U)===34?(Z=me,U++):(Z=n,ce===0&&Ae(sn)),Z!==n?(ft=D,D=Zp(ee)):(U=D,D=n)}else U=D,D=n;if(D===n)if(D=U,e.charCodeAt(U)===39?(G=he,U++):(G=n,ce===0&&Ae(ns)),G!==n){for(ee=[],Z=oe();Z!==n;)ee.push(Z),Z=oe();e.charCodeAt(U)===39?(Z=he,U++):(Z=n,ce===0&&Ae(ns)),Z!==n?(ft=D,D=G2(ee)):(U=D,D=n)}else U=D,D=n;return ce--,D===n&&(G=n,ce===0&&Ae(yr)),D}function yi(){var D,G,ee,Z;return D=U,G=U,ee=U,ce++,e.charCodeAt(U)===34?(Z=me,U++):(Z=n,ce===0&&Ae(sn)),Z===n&&(e.charCodeAt(U)===92?(Z=V,U++):(Z=n,ce===0&&Ae(wr)),Z===n&&(Z=nr())),ce--,Z===n?ee=void 0:(U=ee,ee=n),ee!==n?(Z=Wn(),Z!==n?(ee=[ee,Z],G=ee):(U=G,G=n)):(U=G,G=n),G!==n?D=e.substring(D,U):D=G,D===n&&(D=U,e.charCodeAt(U)===92?(G=V,U++):(G=n,ce===0&&Ae(wr)),G!==n?(ee=$t(),ee!==n?D=ee:(U=D,D=n)):(U=D,D=n),D===n&&(D=ot())),D}function oe(){var D,G,ee,Z;return D=U,G=U,ee=U,ce++,e.charCodeAt(U)===39?(Z=he,U++):(Z=n,ce===0&&Ae(ns)),Z===n&&(e.charCodeAt(U)===92?(Z=V,U++):(Z=n,ce===0&&Ae(wr)),Z===n&&(Z=nr())),ce--,Z===n?ee=void 0:(U=ee,ee=n),ee!==n?(Z=Wn(),Z!==n?(ee=[ee,Z],G=ee):(U=G,G=n)):(U=G,G=n),G!==n?D=e.substring(D,U):D=G,D===n&&(D=U,e.charCodeAt(U)===92?(G=V,U++):(G=n,ce===0&&Ae(wr)),G!==n?(ee=$t(),ee!==n?D=ee:(U=D,D=n)):(U=D,D=n),D===n&&(D=ot())),D}function ye(){var D,G,ee,Z,fe,ge;if(ce++,D=U,e.charCodeAt(U)===91?(G=De,U++):(G=n,ce===0&&Ae(Gs)),G!==n){for(e.charCodeAt(U)===94?(ee=Pe,U++):(ee=n,ce===0&&Ae(vi)),ee===n&&(ee=null),Z=[],fe=de(),fe===n&&(fe=He());fe!==n;)Z.push(fe),fe=de(),fe===n&&(fe=He());e.charCodeAt(U)===93?(fe=Ie,U++):(fe=n,ce===0&&Ae(Qi)),fe!==n?(e.charCodeAt(U)===105?(ge=ae,U++):(ge=n,ce===0&&Ae(ln)),ge===n&&(ge=null),ft=D,D=$n(ee,Z,ge)):(U=D,D=n)}else U=D,D=n;return ce--,D===n&&(G=n,ce===0&&Ae(_s)),D}function de(){var D,G,ee,Z;return D=U,G=He(),G!==n?(e.charCodeAt(U)===45?(ee=se,U++):(ee=n,ce===0&&Ae(Fl)),ee!==n?(Z=He(),Z!==n?(ft=D,D=yh(G,Z)):(U=D,D=n)):(U=D,D=n)):(U=D,D=n),D}function He(){var D,G,ee,Z;return D=U,G=U,ee=U,ce++,e.charCodeAt(U)===93?(Z=Ie,U++):(Z=n,ce===0&&Ae(Qi)),Z===n&&(e.charCodeAt(U)===92?(Z=V,U++):(Z=n,ce===0&&Ae(wr)),Z===n&&(Z=nr())),ce--,Z===n?ee=void 0:(U=ee,ee=n),ee!==n?(Z=Wn(),Z!==n?(ee=[ee,Z],G=ee):(U=G,G=n)):(U=G,G=n),G!==n?D=e.substring(D,U):D=G,D===n&&(D=U,e.charCodeAt(U)===92?(G=V,U++):(G=n,ce===0&&Ae(wr)),G!==n?(ee=$t(),ee!==n?D=ee:(U=D,D=n)):(U=D,D=n),D===n&&(D=ot())),D}function ot(){var D,G,ee;return D=U,e.charCodeAt(U)===92?(G=V,U++):(G=n,ce===0&&Ae(wr)),G!==n?(ee=Go(),ee!==n?(ft=D,D=Ko()):(U=D,D=n)):(U=D,D=n),D}function $t(){var D,G,ee,Z;return D=yn(),D===n&&(D=U,e.charCodeAt(U)===48?(G=pe,U++):(G=n,ce===0&&Ae(Hp)),G!==n?(ee=U,ce++,Z=p0(),ce--,Z===n?ee=void 0:(U=ee,ee=n),ee!==n?(ft=D,D=Jp()):(U=D,D=n)):(U=D,D=n),D===n&&(D=ss(),D===n&&(D=pc()))),D}function yn(){var D;return D=Kt(),D===n&&(D=kh()),D}function Kt(){var D,G;return e.charCodeAt(U)===39?(D=he,U++):(D=n,ce===0&&Ae(ns)),D===n&&(e.charCodeAt(U)===34?(D=me,U++):(D=n,ce===0&&Ae(sn)),D===n&&(e.charCodeAt(U)===92?(D=V,U++):(D=n,ce===0&&Ae(wr)),D===n&&(D=U,e.charCodeAt(U)===98?(G=Fe,U++):(G=n,ce===0&&Ae(dh)),G!==n&&(ft=D,G=Eh()),D=G,D===n&&(D=U,e.charCodeAt(U)===102?(G=Re,U++):(G=n,ce===0&&Ae(C2)),G!==n&&(ft=D,G=rs()),D=G,D===n&&(D=U,e.charCodeAt(U)===110?(G=Ve,U++):(G=n,ce===0&&Ae(Mp)),G!==n&&(ft=D,G=Qp()),D=G,D===n&&(D=U,e.charCodeAt(U)===114?(G=Oe,U++):(G=n,ce===0&&Ae(Bl)),G!==n&&(ft=D,G=e0()),D=G,D===n&&(D=U,e.charCodeAt(U)===116?(G=pt,U++):(G=n,ce===0&&Ae(qp)),G!==n&&(ft=D,G=t0()),D=G,D===n&&(D=U,e.charCodeAt(U)===118?(G=Qe,U++):(G=n,ce===0&&Ae(_2)),G!==n&&(ft=D,G=n0()),D=G)))))))),D}function kh(){var D,G,ee,Z;return D=U,G=U,ee=U,ce++,Z=nv(),Z===n&&(Z=nr()),ce--,Z===n?ee=void 0:(U=ee,ee=n),ee!==n?(Z=Wn(),Z!==n?(ee=[ee,Z],G=ee):(U=G,G=n)):(U=G,G=n),G!==n?D=e.substring(D,U):D=G,D}function nv(){var D;return D=Kt(),D===n&&(D=p0(),D===n&&(e.charCodeAt(U)===120?(D=ct,U++):(D=n,ce===0&&Ae(ph)),D===n&&(e.charCodeAt(U)===117?(D=gr,U++):(D=n,ce===0&&Ae(mh))))),D}function ss(){var D,G,ee,Z,fe,ge;return D=U,e.charCodeAt(U)===120?(G=ct,U++):(G=n,ce===0&&Ae(ph)),G!==n?(ee=U,Z=U,fe=Ds(),fe!==n?(ge=Ds(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n),Z!==n?ee=e.substring(ee,U):ee=Z,ee!==n?(ft=D,D=r0(ee)):(U=D,D=n)):(U=D,D=n),D}function pc(){var D,G,ee,Z,fe,ge,Ht,En;return D=U,e.charCodeAt(U)===117?(G=gr,U++):(G=n,ce===0&&Ae(mh)),G!==n?(ee=U,Z=U,fe=Ds(),fe!==n?(ge=Ds(),ge!==n?(Ht=Ds(),Ht!==n?(En=Ds(),En!==n?(fe=[fe,ge,Ht,En],Z=fe):(U=Z,Z=n)):(U=Z,Z=n)):(U=Z,Z=n)):(U=Z,Z=n),Z!==n?ee=e.substring(ee,U):ee=Z,ee!==n?(ft=D,D=s0(ee)):(U=D,D=n)):(U=D,D=n),D}function p0(){var D;return Tn.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(gh)),D}function Ds(){var D;return es.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(D2)),D}function $l(){var D,G;return D=U,e.charCodeAt(U)===46?(G=vn,U++):(G=n,ce===0&&Ae(jp)),G!==n&&(ft=D,G=Hr()),D=G,D}function Wo(){var D,G,ee,Z;return ce++,D=U,e.charCodeAt(U)===123?(G=s,U++):(G=n,ce===0&&Ae(vr)),G!==n?(ee=Ot(),e.charCodeAt(U)===125?(Z=a,U++):(Z=n,ce===0&&Ae(Xi)),Z!==n?D=ee:(U=D,D=n)):(U=D,D=n),ce--,D===n&&(G=n,ce===0&&Ae(vh)),D}function Ot(){var D,G;return D=U,G=Th(),ft=D,G=z2(G),D=G,D}function Th(){var D,G,ee,Z,fe,ge;if(D=U,G=[],ee=[],Z=U,fe=U,ce++,gi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=n,ce===0&&Ae(au)),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n),Z!==n)for(;Z!==n;)ee.push(Z),Z=U,fe=U,ce++,gi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=n,ce===0&&Ae(au)),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n);else ee=n;for(ee===n&&(ee=U,e.charCodeAt(U)===123?(Z=s,U++):(Z=n,ce===0&&Ae(vr)),Z!==n?(fe=Th(),e.charCodeAt(U)===125?(ge=a,U++):(ge=n,ce===0&&Ae(Xi)),ge!==n?(Z=[Z,fe,ge],ee=Z):(U=ee,ee=n)):(U=ee,ee=n));ee!==n;){if(G.push(ee),ee=[],Z=U,fe=U,ce++,gi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=n,ce===0&&Ae(au)),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n),Z!==n)for(;Z!==n;)ee.push(Z),Z=U,fe=U,ce++,gi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=n,ce===0&&Ae(au)),ce--,ge===n?fe=void 0:(U=fe,fe=n),fe!==n?(ge=Wn(),ge!==n?(fe=[fe,ge],Z=fe):(U=Z,Z=n)):(U=Z,Z=n);else ee=n;ee===n&&(ee=U,e.charCodeAt(U)===123?(Z=s,U++):(Z=n,ce===0&&Ae(vr)),Z!==n?(fe=Th(),e.charCodeAt(U)===125?(ge=a,U++):(ge=n,ce===0&&Ae(Xi)),ge!==n?(Z=[Z,fe,ge],ee=Z):(U=ee,ee=n)):(U=ee,ee=n))}return D=e.substring(D,U),D}function m0(){var D;return Dt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(uu)),D}function xl(){var D;return Ze.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(Kp)),D}function rv(){var D;return Te.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(Vp)),D}function sv(){var D;return un.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(F2)),D}function iv(){var D;return Or.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(Gp)),D}function Pl(){var D;return mt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(zp)),D}function to(){var D;return cc.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(Wp)),D}function kl(){var D;return Nr.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(Yp)),D}function g0(){var D;return Se.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(B2)),D}function Tl(){var D;return tu.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae(I2)),D}function v0(){var D;return Lt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=n,ce===0&&Ae($2)),D}function Yt(){var D,G;for(D=[],G=dc(),G===n&&(G=Go(),G===n&&(G=f0()));G!==n;)D.push(G),G=dc(),G===n&&(G=Go(),G===n&&(G=f0()));return D}function Rl(){var D,G;for(D=[],G=dc(),G===n&&(G=h0());G!==n;)D.push(G),G=dc(),G===n&&(G=h0());return D}function Ol(){var D,G,ee,Z;return D=U,G=Yt(),e.charCodeAt(U)===59?(ee=wn,U++):(ee=n,ce===0&&Ae(Xp)),ee!==n?(G=[G,ee],D=G):(U=D,D=n),D===n&&(D=U,G=Rl(),ee=zo(),ee===n&&(ee=null),Z=Go(),Z!==n?(G=[G,ee,Z],D=G):(U=D,D=n),D===n&&(D=U,G=Yt(),ee=mc(),ee!==n?(G=[G,ee],D=G):(U=D,D=n))),D}function mc(){var D,G;return D=U,ce++,e.length>U?(G=e.charAt(U),U++):(G=n,ce===0&&Ae(Dl)),ce--,G===n?D=void 0:(U=D,D=n),D}let Yo=t.reservedWords||[];if(Wt=o(),Wt!==n&&U===e.length)return Wt;throw Wt!==n&&U<e.length&&Ae(lu()),Ch(cu,On<e.length?e.charAt(On):null,On<e.length?fu(On,On+1):fu(On,On))}z7.exports={SyntaxError:uc,parse:FQ}});var d2=be((pye,Y7)=>{"use strict";var mye=B(x()),BQ=i2(),IQ=G7(),$Q=W7(),xQ=dS(),PQ=["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"],Op={VERSION:xQ,RESERVED_WORDS:PQ,GrammarError:BQ,parser:$Q,compiler:IQ,generate(e,t){t=t!==void 0?t:{};function n(o){let s={};return Object.keys(o).forEach(a=>{s[a]=o[a].slice()}),s}let r="plugins"in t?t.plugins:[],i={parser:Op.parser,passes:n(Op.compiler.passes),reservedWords:Op.RESERVED_WORDS.slice()};return r.forEach(o=>{o.use(i,t)}),Op.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};Y7.exports=Op});var RS=be((kS,TS)=>{var Iye=B(x());(function(e,t){typeof kS=="object"&&typeof TS<"u"?TS.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(kS,(function(){"use strict";function e(ie,we){return we={exports:{}},ie(we,we.exports),we.exports}var t=e(function(ie){var we=ie.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=we)}),n=e(function(ie){var we=ie.exports={version:"2.6.5"};typeof __e=="number"&&(__e=we)}),r=n.version,i=function(ie){return typeof ie=="object"?ie!==null:typeof ie=="function"},o=function(ie){if(!i(ie))throw TypeError(ie+" is not an object!");return ie},s=function(ie){try{return!!ie()}catch{return!0}},a=!s(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),u=t.document,l=i(u)&&i(u.createElement),h=function(ie){return l?u.createElement(ie):{}},m=!a&&!s(function(){return Object.defineProperty(h("div"),"a",{get:function(){return 7}}).a!=7}),p=function(ie,we){if(!i(ie))return ie;var je,Me;if(we&&typeof(je=ie.toString)=="function"&&!i(Me=je.call(ie))||typeof(je=ie.valueOf)=="function"&&!i(Me=je.call(ie))||!we&&typeof(je=ie.toString)=="function"&&!i(Me=je.call(ie)))return Me;throw TypeError("Can't convert object to primitive value")},d=Object.defineProperty,v=a?Object.defineProperty:function(we,je,Me){if(o(we),je=p(je,!0),o(Me),m)try{return d(we,je,Me)}catch{}if("get"in Me||"set"in Me)throw TypeError("Accessors not supported!");return"value"in Me&&(we[je]=Me.value),we},g={f:v},y=function(ie,we){return{enumerable:!(ie&1),configurable:!(ie&2),writable:!(ie&4),value:we}},w=a?function(ie,we,je){return g.f(ie,we,y(1,je))}:function(ie,we,je){return ie[we]=je,ie},E={}.hasOwnProperty,C=function(ie,we){return E.call(ie,we)},_=0,F=Math.random(),H=function(ie){return"Symbol(".concat(ie===void 0?"":ie,")_",(++_+F).toString(36))},K=!1,S=e(function(ie){var we="__core-js_shared__",je=t[we]||(t[we]={});(ie.exports=function(Me,et){return je[Me]||(je[Me]=et!==void 0?et:{})})("versions",[]).push({version:n.version,mode:K?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),I=S("native-function-to-string",Function.toString),q=e(function(ie){var we=H("src"),je="toString",Me=(""+I).split(je);n.inspectSource=function(et){return I.call(et)},(ie.exports=function(et,gt,wt,Rn){var cn=typeof wt=="function";cn&&(C(wt,"name")||w(wt,"name",gt)),et[gt]!==wt&&(cn&&(C(wt,we)||w(wt,we,et[gt]?""+et[gt]:Me.join(String(gt)))),et===t?et[gt]=wt:Rn?et[gt]?et[gt]=wt:w(et,gt,wt):(delete et[gt],w(et,gt,wt)))})(Function.prototype,je,function(){return typeof this=="function"&&this[we]||I.call(this)})}),L=function(ie){if(typeof ie!="function")throw TypeError(ie+" is not a function!");return ie},T=function(ie,we,je){if(L(ie),we===void 0)return ie;switch(je){case 1:return function(Me){return ie.call(we,Me)};case 2:return function(Me,et){return ie.call(we,Me,et)};case 3:return function(Me,et,gt){return ie.call(we,Me,et,gt)}}return function(){return ie.apply(we,arguments)}},O="prototype",R=function(ie,we,je){var Me=ie&R.F,et=ie&R.G,gt=ie&R.S,wt=ie&R.P,Rn=ie&R.B,cn=et?t:gt?t[we]||(t[we]={}):(t[we]||{})[O],Vs=et?n:n[we]||(n[we]={}),Ji=Vs[O]||(Vs[O]={}),Lr,ts,Bn,Ur;et&&(je=we);for(Lr in je)ts=!Me&&cn&&cn[Lr]!==void 0,Bn=(ts?cn:je)[Lr],Ur=Rn&&ts?T(Bn,t):wt&&typeof Bn=="function"?T(Function.call,Bn):Bn,cn&&q(cn,Lr,Bn,ie&R.U),Vs[Lr]!=Bn&&w(Vs,Lr,Ur),wt&&Ji[Lr]!=Bn&&(Ji[Lr]=Bn)};t.core=n,R.F=1,R.G=2,R.S=4,R.P=8,R.B=16,R.W=32,R.U=64,R.R=128;var N=R,P=Math.ceil,M=Math.floor,Y=function(ie){return isNaN(ie=+ie)?0:(ie>0?M:P)(ie)},V=function(ie){if(ie==null)throw TypeError("Can't call method on "+ie);return ie},X=function(ie){return function(we,je){var Me=String(V(we)),et=Y(je),gt=Me.length,wt,Rn;return et<0||et>=gt?ie?"":void 0:(wt=Me.charCodeAt(et),wt<55296||wt>56319||et+1===gt||(Rn=Me.charCodeAt(et+1))<56320||Rn>57343?ie?Me.charAt(et):wt:ie?Me.slice(et,et+2):(wt-55296<<10)+(Rn-56320)+65536)}},te=X(!1);N(N.P,"String",{codePointAt:function(we){return te(this,we)}});var ae=n.String.codePointAt,me=Math.max,he=Math.min,De=function(ie,we){return ie=Y(ie),ie<0?me(ie+we,0):he(ie,we)},Pe=String.fromCharCode,Ie=String.fromCodePoint;N(N.S+N.F*(!!Ie&&Ie.length!=1),"String",{fromCodePoint:function(we){for(var je=arguments,Me=[],et=arguments.length,gt=0,wt;et>gt;){if(wt=+je[gt++],De(wt,1114111)!==wt)throw RangeError(wt+" is not a valid code point");Me.push(wt<65536?Pe(wt):Pe(((wt-=65536)>>10)+55296,wt%1024+56320))}return Me.join("")}});var se=n.String.fromCodePoint,pe=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Fe=/[\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]/,Re=/[\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]/,Ve={Space_Separator:pe,ID_Start:Fe,ID_Continue:Re},Oe={isSpaceSeparator:function(we){return typeof we=="string"&&Ve.Space_Separator.test(we)},isIdStartChar:function(we){return typeof we=="string"&&(we>="a"&&we<="z"||we>="A"&&we<="Z"||we==="$"||we==="_"||Ve.ID_Start.test(we))},isIdContinueChar:function(we){return typeof we=="string"&&(we>="a"&&we<="z"||we>="A"&&we<="Z"||we>="0"&&we<="9"||we==="$"||we==="_"||we==="\u200C"||we==="\u200D"||Ve.ID_Continue.test(we))},isDigit:function(we){return typeof we=="string"&&/[0-9]/.test(we)},isHexDigit:function(we){return typeof we=="string"&&/[0-9A-Fa-f]/.test(we)}},pt,Qe,ct,gr,vn,wn,lt,Tn,es,gi=function(we,je){pt=String(we),Qe="start",ct=[],gr=0,vn=1,wn=0,lt=void 0,Tn=void 0,es=void 0;do lt=cc(),uh[Qe]();while(lt.type!=="eof");return typeof je=="function"?Dt({"":es},"",je):es};function Dt(ie,we,je){var Me=ie[we];if(Me!=null&&typeof Me=="object")if(Array.isArray(Me))for(var et=0;et<Me.length;et++){var gt=String(et),wt=Dt(Me,gt,je);wt===void 0?delete Me[gt]:Object.defineProperty(Me,gt,{value:wt,writable:!0,enumerable:!0,configurable:!0})}else for(var Rn in Me){var cn=Dt(Me,Rn,je);cn===void 0?delete Me[Rn]:Object.defineProperty(Me,Rn,{value:cn,writable:!0,enumerable:!0,configurable:!0})}return je.call(ie,we,Me)}var Ze,Te,un,Or,mt;function cc(){for(Ze="default",Te="",un=!1,Or=1;;){mt=Nr();var ie=tu[Ze]();if(ie)return ie}}function Nr(){if(pt[gr])return String.fromCodePoint(pt.codePointAt(gr))}function Se(){var ie=Nr();return ie===`
`?(vn++,wn=0):ie?wn+=ie.length:wn++,ie&&(gr+=ie.length),ie}var tu={default:function(){switch(mt){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
`:case"\r":case"\u2028":case"\u2029":Se();return;case"/":Se(),Ze="comment";return;case void 0:return Se(),Lt("eof")}if(Oe.isSpaceSeparator(mt)){Se();return}return tu[Qe]()},comment:function(){switch(mt){case"*":Se(),Ze="multiLineComment";return;case"/":Se(),Ze="singleLineComment";return}throw jt(Se())},multiLineComment:function(){switch(mt){case"*":Se(),Ze="multiLineCommentAsterisk";return;case void 0:throw jt(Se())}Se()},multiLineCommentAsterisk:function(){switch(mt){case"*":Se();return;case"/":Se(),Ze="default";return;case void 0:throw jt(Se())}Se(),Ze="multiLineComment"},singleLineComment:function(){switch(mt){case`
`:case"\r":case"\u2028":case"\u2029":Se(),Ze="default";return;case void 0:return Se(),Lt("eof")}Se()},value:function(){switch(mt){case"{":case"[":return Lt("punctuator",Se());case"n":return Se(),vr("ull"),Lt("null",null);case"t":return Se(),vr("rue"),Lt("boolean",!0);case"f":return Se(),vr("alse"),Lt("boolean",!1);case"-":case"+":Se()==="-"&&(Or=-1),Ze="sign";return;case".":Te=Se(),Ze="decimalPointLeading";return;case"0":Te=Se(),Ze="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Te=Se(),Ze="decimalInteger";return;case"I":return Se(),vr("nfinity"),Lt("numeric",1/0);case"N":return Se(),vr("aN"),Lt("numeric",NaN);case'"':case"'":un=Se()==='"',Te="",Ze="string";return}throw jt(Se())},identifierNameStartEscape:function(){if(mt!=="u")throw jt(Se());Se();var we=nu();switch(we){case"$":case"_":break;default:if(!Oe.isIdStartChar(we))throw _l();break}Te+=we,Ze="identifierName"},identifierName:function(){switch(mt){case"$":case"_":case"\u200C":case"\u200D":Te+=Se();return;case"\\":Se(),Ze="identifierNameEscape";return}if(Oe.isIdContinueChar(mt)){Te+=Se();return}return Lt("identifier",Te)},identifierNameEscape:function(){if(mt!=="u")throw jt(Se());Se();var we=nu();switch(we){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Oe.isIdContinueChar(we))throw _l();break}Te+=we,Ze="identifierName"},sign:function(){switch(mt){case".":Te=Se(),Ze="decimalPointLeading";return;case"0":Te=Se(),Ze="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Te=Se(),Ze="decimalInteger";return;case"I":return Se(),vr("nfinity"),Lt("numeric",Or*(1/0));case"N":return Se(),vr("aN"),Lt("numeric",NaN)}throw jt(Se())},zero:function(){switch(mt){case".":Te+=Se(),Ze="decimalPoint";return;case"e":case"E":Te+=Se(),Ze="decimalExponent";return;case"x":case"X":Te+=Se(),Ze="hexadecimal";return}return Lt("numeric",Or*0)},decimalInteger:function(){switch(mt){case".":Te+=Se(),Ze="decimalPoint";return;case"e":case"E":Te+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Te+=Se();return}return Lt("numeric",Or*Number(Te))},decimalPointLeading:function(){if(Oe.isDigit(mt)){Te+=Se(),Ze="decimalFraction";return}throw jt(Se())},decimalPoint:function(){switch(mt){case"e":case"E":Te+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Te+=Se(),Ze="decimalFraction";return}return Lt("numeric",Or*Number(Te))},decimalFraction:function(){switch(mt){case"e":case"E":Te+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Te+=Se();return}return Lt("numeric",Or*Number(Te))},decimalExponent:function(){switch(mt){case"+":case"-":Te+=Se(),Ze="decimalExponentSign";return}if(Oe.isDigit(mt)){Te+=Se(),Ze="decimalExponentInteger";return}throw jt(Se())},decimalExponentSign:function(){if(Oe.isDigit(mt)){Te+=Se(),Ze="decimalExponentInteger";return}throw jt(Se())},decimalExponentInteger:function(){if(Oe.isDigit(mt)){Te+=Se();return}return Lt("numeric",Or*Number(Te))},hexadecimal:function(){if(Oe.isHexDigit(mt)){Te+=Se(),Ze="hexadecimalInteger";return}throw jt(Se())},hexadecimalInteger:function(){if(Oe.isHexDigit(mt)){Te+=Se();return}return Lt("numeric",Or*Number(Te))},string:function(){switch(mt){case"\\":Se(),Te+=Xi();return;case'"':if(un)return Se(),Lt("string",Te);Te+=Se();return;case"'":if(!un)return Se(),Lt("string",Te);Te+=Se();return;case`
`:case"\r":throw jt(Se());case"\u2028":case"\u2029":ch(mt);break;case void 0:throw jt(Se())}Te+=Se()},start:function(){switch(mt){case"{":case"[":return Lt("punctuator",Se())}Ze="value"},beforePropertyName:function(){switch(mt){case"$":case"_":Te=Se(),Ze="identifierName";return;case"\\":Se(),Ze="identifierNameStartEscape";return;case"}":return Lt("punctuator",Se());case'"':case"'":un=Se()==='"',Ze="string";return}if(Oe.isIdStartChar(mt)){Te+=Se(),Ze="identifierName";return}throw jt(Se())},afterPropertyName:function(){if(mt===":")return Lt("punctuator",Se());throw jt(Se())},beforePropertyValue:function(){Ze="value"},afterPropertyValue:function(){switch(mt){case",":case"}":return Lt("punctuator",Se())}throw jt(Se())},beforeArrayValue:function(){if(mt==="]")return Lt("punctuator",Se());Ze="value"},afterArrayValue:function(){switch(mt){case",":case"]":return Lt("punctuator",Se())}throw jt(Se())},end:function(){throw jt(Se())}};function Lt(ie,we){return{type:ie,value:we,line:vn,column:wn}}function vr(ie){for(var we=0,je=ie;we<je.length;we+=1){var Me=je[we],et=Nr();if(et!==Me)throw jt(Se());Se()}}function Xi(){var ie=Nr();switch(ie){case"b":return Se(),"\b";case"f":return Se(),"\f";case"n":return Se(),`
`;case"r":return Se(),"\r";case"t":return Se()," ";case"v":return Se(),"\v";case"0":if(Se(),Oe.isDigit(Nr()))throw jt(Se());return"\0";case"x":return Se(),Cl();case"u":return Se(),nu();case`
`:case"\u2028":case"\u2029":return Se(),"";case"\r":return Se(),Nr()===`
`&&Se(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw jt(Se());case void 0:throw jt(Se())}return Se()}function Cl(){var ie="",we=Nr();if(!Oe.isHexDigit(we)||(ie+=Se(),we=Nr(),!Oe.isHexDigit(we)))throw jt(Se());return ie+=Se(),String.fromCodePoint(parseInt(ie,16))}function nu(){for(var ie="",we=4;we-- >0;){var je=Nr();if(!Oe.isHexDigit(je))throw jt(Se());ie+=Se()}return String.fromCodePoint(parseInt(ie,16))}var uh={start:function(){if(lt.type==="eof")throw Ks();ru()},beforePropertyName:function(){switch(lt.type){case"identifier":case"string":Tn=lt.value,Qe="afterPropertyName";return;case"punctuator":Zi();return;case"eof":throw Ks()}},afterPropertyName:function(){if(lt.type==="eof")throw Ks();Qe="beforePropertyValue"},beforePropertyValue:function(){if(lt.type==="eof")throw Ks();ru()},beforeArrayValue:function(){if(lt.type==="eof")throw Ks();if(lt.type==="punctuator"&&lt.value==="]"){Zi();return}ru()},afterPropertyValue:function(){if(lt.type==="eof")throw Ks();switch(lt.value){case",":Qe="beforePropertyName";return;case"}":Zi()}},afterArrayValue:function(){if(lt.type==="eof")throw Ks();switch(lt.value){case",":Qe="beforeArrayValue";return;case"]":Zi()}},end:function(){}};function ru(){var ie;switch(lt.type){case"punctuator":switch(lt.value){case"{":ie={};break;case"[":ie=[];break}break;case"null":case"boolean":case"numeric":case"string":ie=lt.value;break}if(es===void 0)es=ie;else{var we=ct[ct.length-1];Array.isArray(we)?we.push(ie):Object.defineProperty(we,Tn,{value:ie,writable:!0,enumerable:!0,configurable:!0})}if(ie!==null&&typeof ie=="object")ct.push(ie),Array.isArray(ie)?Qe="beforeArrayValue":Qe="beforePropertyName";else{var je=ct[ct.length-1];je==null?Qe="end":Array.isArray(je)?Qe="afterArrayValue":Qe="afterPropertyValue"}}function Zi(){ct.pop();var ie=ct[ct.length-1];ie==null?Qe="end":Array.isArray(ie)?Qe="afterArrayValue":Qe="afterPropertyValue"}function jt(ie){return su(ie===void 0?"JSON5: invalid end of input at "+vn+":"+wn:"JSON5: invalid character '"+lc(ie)+"' at "+vn+":"+wn)}function Ks(){return su("JSON5: invalid end of input at "+vn+":"+wn)}function _l(){return wn-=5,su("JSON5: invalid identifier character at "+vn+":"+wn)}function ch(ie){console.warn("JSON5: '"+lc(ie)+"' in strings is not valid ECMAScript; consider escaping")}function lc(ie){var we={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(we[ie])return we[ie];if(ie<" "){var je=ie.charCodeAt(0).toString(16);return"\\x"+("00"+je).substring(je.length)}return ie}function su(ie){var we=new SyntaxError(ie);return we.lineNumber=vn,we.columnNumber=wn,we}var lh=function(we,je,Me){var et=[],gt="",wt,Rn,cn="",Vs;if(je!=null&&typeof je=="object"&&!Array.isArray(je)&&(Me=je.space,Vs=je.quote,je=je.replacer),typeof je=="function")Rn=je;else if(Array.isArray(je)){wt=[];for(var Ji=0,Lr=je;Ji<Lr.length;Ji+=1){var ts=Lr[Ji],Bn=void 0;typeof ts=="string"?Bn=ts:(typeof ts=="number"||ts instanceof String||ts instanceof Number)&&(Bn=String(ts)),Bn!==void 0&&wt.indexOf(Bn)<0&&wt.push(Bn)}}return Me instanceof Number?Me=Number(Me):Me instanceof String&&(Me=String(Me)),typeof Me=="number"?Me>0&&(Me=Math.min(10,Math.floor(Me)),cn=" ".substr(0,Me)):typeof Me=="string"&&(cn=Me.substr(0,10)),Ur("",{"":we});function Ur(Ut,In){var ut=In[Ut];switch(ut!=null&&(typeof ut.toJSON5=="function"?ut=ut.toJSON5(Ut):typeof ut.toJSON=="function"&&(ut=ut.toJSON(Ut))),Rn&&(ut=Rn.call(In,Ut,ut)),ut instanceof Number?ut=Number(ut):ut instanceof String?ut=String(ut):ut instanceof Boolean&&(ut=ut.valueOf()),ut){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof ut=="string")return iu(ut,!1);if(typeof ut=="number")return String(ut);if(typeof ut=="object")return Array.isArray(ut)?wr(ut):ou(ut)}function iu(Ut){for(var In={"'":.1,'"':.2},ut={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},ln="",yr=0;yr<Ut.length;yr++){var sn=Ut[yr];switch(sn){case"'":case'"':In[sn]++,ln+=sn;continue;case"\0":if(Oe.isDigit(Ut[yr+1])){ln+="\\x00";continue}}if(ut[sn]){ln+=ut[sn];continue}if(sn<" "){var ns=sn.charCodeAt(0).toString(16);ln+="\\x"+("00"+ns).substring(ns.length);continue}ln+=sn}var _s=Vs||Object.keys(In).reduce(function(Gs,vi){return In[Gs]<In[vi]?Gs:vi});return ln=ln.replace(new RegExp(_s,"g"),ut[_s]),_s+ln+_s}function ou(Ut){if(et.indexOf(Ut)>=0)throw TypeError("Converting circular structure to JSON5");et.push(Ut);var In=gt;gt=gt+cn;for(var ut=wt||Object.keys(Ut),ln=[],yr=0,sn=ut;yr<sn.length;yr+=1){var ns=sn[yr],_s=Ur(ns,Ut);if(_s!==void 0){var Gs=hh(ns)+":";cn!==""&&(Gs+=" "),Gs+=_s,ln.push(Gs)}}var vi;if(ln.length===0)vi="{}";else{var Qi;if(cn==="")Qi=ln.join(","),vi="{"+Qi+"}";else{var Fl=`,
`+gt;Qi=ln.join(Fl),vi=`{
`+gt+Qi+`,
`+In+"}"}}return et.pop(),gt=In,vi}function hh(Ut){if(Ut.length===0)return iu(Ut,!0);var In=String.fromCodePoint(Ut.codePointAt(0));if(!Oe.isIdStartChar(In))return iu(Ut,!0);for(var ut=In.length;ut<Ut.length;ut++)if(!Oe.isIdContinueChar(String.fromCodePoint(Ut.codePointAt(ut))))return iu(Ut,!0);return Ut}function wr(Ut){if(et.indexOf(Ut)>=0)throw TypeError("Converting circular structure to JSON5");et.push(Ut);var In=gt;gt=gt+cn;for(var ut=[],ln=0;ln<Ut.length;ln++){var yr=Ur(String(ln),Ut);ut.push(yr!==void 0?yr:"null")}var sn;if(ut.length===0)sn="[]";else if(cn===""){var ns=ut.join(",");sn="["+ns+"]"}else{var _s=`,
`+gt,Gs=ut.join(_s);sn=`[
`+gt+Gs+`,
`+In+"]"}return et.pop(),gt=In,sn}},Dl={parse:gi,stringify:lh},fc=Dl,fh=fc;return fh}))});var oAe=B(x());var t1="2.44.31";var wse=B(x());var Jt="settings",Cc="subs",zl="collections",Eu="files",n1="modules",oa="artifacts",wC="rules";var yC="Sub-Store Artifacts Repository",_c="#sub-store-cached-resource",Dc="#sub-store-cached-headers-resource",Fc="#sub-store-cached-script-resource",Mw="#sub-store-logs";var Hse=B(x()),Nse=B(bC());var Ose=B(x());var Sse=B(x());var SC=1e4,VU=1e3,$C=["log","info","warn","error","debug"],CC="unknown",xC=/^Sub-Store\s+--\s+v\d+(?:\.\d+){0,3}$/,_C=/^\u2505{8,}$/,GU=/^\[sub-store\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/,PC=/^\[[^\]\r\n]+\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/i,zU=/^\[([^\]\r\n]+)\]\s*/,WU=[/^(?:.+\sParser|Rule parser \[.+\]) is activated!?$/,/^Pre-processor \[.+\] activated!?$/,/^Fallback Base64 Pre-processor error: decoded line does not start with protocol$/,/^\[CORS\] allowed origins: .+$/],DC=!1,qw=!1,r1=null,FC=0;function YU(e,{isNode:t}={}){let n=Array.from(e||[]);if(!t)return n;let r=new Date().toLocaleString();if(typeof n[0]=="string"){let[o,...s]=n;return[`${s.length?BC(r):r} ${o}`,...s]}return[n.length?BC(r):r,...n]}function BC(e){return`${e}`.replace(/%/g,"%%")}function XU(e,t=0){let n=IC(t,0,SC);return IC(e,n,SC)}function ZU(e){return Array.from(e||[]).map(aH).join(" ")}function JU(e){try{let t=e.read(Mw);if(!t)return[];let n=typeof t=="string"?JSON.parse(t):t;return Array.isArray(n)?n.filter(uH):[]}catch{return[]}}function QU(e,t){e.write(JSON.stringify(Array.isArray(t)?t:[]),Mw)}function eH(e,t,n){try{let r=tH(e);if(r===0)return;let i=ZU(n);if(rH(i))return;let o=JU(e),s=TC(t);o.push({id:cH(),time:Date.now(),level:s,message:nH(i,s)}),QU(e,o.slice(-r))}catch{}}function kC(e){DC||typeof console>"u"||(DC=!0,$C.forEach(t=>{let n=console[t];typeof n=="function"&&(console[t]=function(...r){if(n.apply(console,YU(r,{isNode:e.env.isNode})),!qw)try{qw=!0,eH(e,t,r)}finally{qw=!1}})}))}function tH(e){let t=Date.now();if(r1!==null&&t<FC)return r1;let n=e.read(Jt)||{};return r1=XU(n.logsMaxCount),FC=t+VU,r1}function IC(e,t,n){if(e==null||e==="")return t;let r=Number(e);return!isFinite(r)||r<0?t:Math.min(Math.floor(r),n)}function TC(e){return $C.includes(e)?e:"log"}function nH(e,t){let n=`${e||""}`;if(PC.test(n))return n;let r=TC(t).toUpperCase(),i=n.match(zU);if(i){let o=i[1].trim()||CC,s=n.slice(i[0].length).trimStart();return`[${o}] ${r}: ${s}`}return`[${CC}] ${r}: ${n}`}function rH(e){let t=sH(e);return t.length===1?xC.test(t[0])||oH(t[0]):iH(t)}function sH(e){let t=`${e||""}`.split(/\r?\n/).map(r=>r.trim()).filter(Boolean);if(t.length===0)return t;let n=t[0].replace(PC,"").trim();return n!==t[0]&&(n?t[0]=n:t.shift()),t}function iH(e){return e.length<3||!_C.test(e[0])||!_C.test(e[e.length-1])?!1:e.slice(1,-1).some(t=>xC.test(t))}function oH(e){let t=e.replace(GU,"");return WU.some(n=>n.test(t))}function aH(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 uH(e){return e&&typeof e=="object"&&typeof e.id=="string"&&typeof e.time=="number"&&typeof e.level=="string"&&typeof e.message=="string"}function cH(){return`${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var Ise=B(x());var Dse=B(x());function oo(e){if(Js().isNode)try{return e()}catch{return}}function ao(){return oo(()=>wu("fs"))}var xse=B(x(),1),HC="3.7.8",lH=HC,Yl=typeof Buffer=="function",RC=typeof TextDecoder=="function"?new TextDecoder:void 0,OC=typeof TextEncoder=="function"?new TextEncoder:void 0,fH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Zh=Array.prototype.slice.call(fH),s1=(e=>{let t={};return e.forEach((n,r)=>t[n]=r),t})(Zh),hH=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,sr=String.fromCharCode.bind(String),NC=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),MC=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),qC=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),jC=e=>{let t,n,r,i,o="",s=e.length%3;for(let a=0;a<e.length;){if((n=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255||(i=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|i,o+=Zh[t>>18&63]+Zh[t>>12&63]+Zh[t>>6&63]+Zh[t&63]}return s?o.slice(0,s-3)+"===".substring(s):o},Vw=typeof btoa=="function"?e=>btoa(e):Yl?e=>Buffer.from(e,"binary").toString("base64"):jC,jw=Yl?e=>Buffer.from(e).toString("base64"):e=>{let n=[];for(let r=0,i=e.length;r<i;r+=4096)n.push(sr.apply(null,e.subarray(r,r+4096)));return Vw(n.join(""))},i1=(e,t=!1)=>t?MC(jw(e)):jw(e),dH=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?sr(192|t>>>6)+sr(128|t&63):sr(224|t>>>12&15)+sr(128|t>>>6&63)+sr(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return sr(240|t>>>18&7)+sr(128|t>>>12&63)+sr(128|t>>>6&63)+sr(128|t&63)}},pH=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,KC=e=>e.replace(pH,dH),LC=Yl?e=>Buffer.from(e,"utf8").toString("base64"):OC?e=>jw(OC.encode(e)):e=>Vw(KC(e)),Wl=(e,t=!1)=>t?MC(LC(e)):LC(e),UC=e=>Wl(e,!0),mH=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,gH=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),n=t-65536;return sr((n>>>10)+55296)+sr((n&1023)+56320);case 3:return sr((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return sr((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},VC=e=>e.replace(mH,gH),GC=e=>{if(e=e.replace(/\s+/g,""),!hH.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,n,r,i=[];for(let o=0;o<e.length;)t=s1[e.charAt(o++)]<<18|s1[e.charAt(o++)]<<12|(n=s1[e.charAt(o++)])<<6|(r=s1[e.charAt(o++)]),n===64?i.push(sr(t>>16&255)):r===64?i.push(sr(t>>16&255,t>>8&255)):i.push(sr(t>>16&255,t>>8&255,t&255));return i.join("")},Gw=typeof atob=="function"?e=>atob(qC(e)):Yl?e=>Buffer.from(e,"base64").toString("binary"):GC,zC=Yl?e=>NC(Buffer.from(e,"base64")):e=>NC(Gw(e).split("").map(t=>t.charCodeAt(0))),WC=e=>zC(YC(e)),vH=Yl?e=>Buffer.from(e,"base64").toString("utf8"):RC?e=>RC.decode(zC(e)):e=>VC(Gw(e)),YC=e=>qC(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Kw=e=>vH(YC(e)),wH=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)},XC=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),ZC=function(){let e=(t,n)=>Object.defineProperty(String.prototype,t,XC(n));e("fromBase64",function(){return Kw(this)}),e("toBase64",function(t){return Wl(this,t)}),e("toBase64URI",function(){return Wl(this,!0)}),e("toBase64URL",function(){return Wl(this,!0)}),e("toUint8Array",function(){return WC(this)})},JC=function(){let e=(t,n)=>Object.defineProperty(Uint8Array.prototype,t,XC(n));e("toBase64",function(t){return i1(this,t)}),e("toBase64URI",function(){return i1(this,!0)}),e("toBase64URL",function(){return i1(this,!0)})},yH=()=>{ZC(),JC()},bt={version:HC,VERSION:lH,atob:Gw,atobPolyfill:GC,btoa:Vw,btoaPolyfill:jC,fromBase64:Kw,toBase64:Wl,encode:Wl,encodeURI:UC,encodeURL:UC,utob:KC,btou:VC,decode:Kw,isValid:wH,fromUint8Array:i1,toUint8Array:WC,extendString:ZC,extendUint8Array:JC,extendBuiltins:yH};var bu=typeof $task<"u",co=typeof $loon<"u",aa=typeof Egern<"u",Au=typeof $httpClient<"u"&&!co&&!aa,uo=eval('typeof process !== "undefined"'),QC=typeof $environment<"u"&&$environment["stash-version"],e_=typeof $rocket<"u",EH=typeof $native<"u",Su=typeof $Plugins<"u",bH=co&&typeof $loon=="object"&&$loon!==null&&$loon.isSubsCheckPro===!0;function o1(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function AH(e){let[t,n,r,i,o,s,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:i,port:o,userId:n!=null?decodeURIComponent(n):void 0,password:r!=null?decodeURIComponent(r):void 0}}function SH(e){let t=[],n=!1;for(let[r,i]of Object.entries(e||{})){let o=r.toLowerCase();o==="accept"&&(n=!0,i==null)||t.push([o,i])}return n||t.push(["accept","*/*"]),Object.fromEntries(t)}var a1=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=lo(),this.env=Js(),uo){let dotenv=eval('require("dotenv")');dotenv.config()}this.node=uo?{fs:ao()}:null,this.initCache(),kC(this);let delay=(e,t)=>new Promise(function(n){setTimeout(n.bind(null,t),e)});Promise.prototype.delay=async function(e){let t=await this;return await delay(e,t)}}initCache(){if(bu&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(co||Au||aa)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),Su&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),uo){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}`)}o1(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")),!o1(this.cache))throw new Error("Invalid Data")}catch{try{let t=bt.decode(this.node.fs.readFileSync(`${fpath}`,"utf-8"));if(this.cache=JSON.parse(t),this.node.fs.writeFileSync(fpath,t,{flag:"w"}),!o1(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}`)}}o1(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(bu&&$prefs.setValueForKey(data,this.name),(co||Au||aa)&&$persistentStore.write(data,this.name),Su&&$Plugins.SubStoreCache.set(this.name,data),uo){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),Au||co||aa)return $persistentStore.write(e,t);if(bu)return $prefs.setValueForKey(e,t);if(uo&&(this.root[t]=e),Su)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),Au||co||aa)return $persistentStore.read(e);if(bu)return $prefs.valueForKey(e);if(uo)return this.root[e];if(Su)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),Au||co||aa)return $persistentStore.write(null,e);if(bu)return $prefs.removeValueForKey(e);if(uo&&delete this.root[e],Su)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(bu&&$notify(title,subtitle,content,options),(Au||aa)&&$notification.post(title,subtitle,content+`${mediaURL?`
\u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),co){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(uo){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(n=>n).join(`
`)));lo().get({url:e}).then(n=>{console.log(`[Push Service] URL: ${e}
RES: ${n.statusCode} ${n.body}`)}).catch(n=>{console.log(`[Push Service] URL: ${e}
ERROR: ${n}`)})}else eval('import("shoutrrr-ts")').then(({send:e})=>e(push,`${title}
${subtitle}
${content_}`,{transport:CH(lo())}).then(()=>console.log("[Push Service] RES: sent"),t=>console.log(`[Push Service] ERROR: ${t.message}`))).catch(()=>console.log("[Push Service] ERROR: notification delivery failed"))}Su&&$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={}){bu||co||Au||Su||aa?$done(e):uo&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function Js(){return{isQX:bu,isLoon:co,isSurge:Au,isNode:uo,isStash:QC,isShadowRocket:e_,isEgern:aa,isLanceX:EH,isGUIforCores:Su,isSubsCheckPro:bH}}function CH(e){return async(t,n={})=>{let r=n.body;if(r!=null&&typeof r!="string"&&!(r instanceof Uint8Array)&&!(r instanceof ArrayBuffer))throw new Error("unsupported notification request body");let i=Object.fromEntries(new Headers(n.headers).entries()),o=await e.request({url:t,method:n.method||"GET",headers:i,body:r instanceof ArrayBuffer?new Uint8Array(r):r,encoding:null,timeout:8e3});return new Response([204,205,304].includes(o.statusCode)?null:o.body,{status:o.statusCode})}}function lo(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores,isEgern}=Js(),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=eval("require('undici')"),{socksDispatcher}=eval("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=SH(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(AH(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||QC||e_)&&(opts.timeout=Math.ceil(opts.timeout/1e3));try{$httpClient[method.toLowerCase()](opts,(e,t,n)=>{if(e){reject(e);return}resolve({statusCode:t?.status||t?.statusCode,headers:t?.headers||{},body:n,requestId})})}catch(e){reject(e)}}}):isGUIforCores&&(worker=new Promise(async(e,t)=>{try{let n=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:n.status,headers:n.headers,body:n.body,requestId})}catch(n){t(n)}})),new Promise((e,t)=>{let n=!1,r=!1,i=null,o=()=>{i!==null&&(clearTimeout(i),i=null)},s=async u=>{if(!(n||r)){r=!0;try{if(await Promise.resolve(events.onResponse(u)),n)return;n=!0,o(),e({...u,requestId})}catch(l){if(n)return;n=!0,o(),t(l)}}},a=u=>{n||(n=!0,o(),t(u))};worker.then(async u=>{await s(u)},u=>{a(u)}),timeout&&(i=setTimeout(()=>{if(!n){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 _H=new a1("sub-store"),J=_H;var Xbe=B(x());var qse=B(x());var Kse=B(x()),zw=class{constructor(t,n,r){this.code=t,this.message=n,this.details=r}};var ca=class extends zw{constructor(t,n,r){super(t,n,r),this.type="RequestInvalidError"}};var Xse=B(x());var Yw=new Map,Ww=new Set,Xw;function Zw(e){return e?.cron==null?"":`${e.cron}`.trim()}function t_(e){return Zw(e).length>0}function DH(e){let t=e?.displayName??e?.["display-name"];return t==null?"":`${t}`.trim()}function n_(e){if(!e||typeof e!="object")return`${e}`;let t=e.name==null?"":`${e.name}`,n=DH(e);return!n||n===t?t:`${t} (${n})`}function FH(e){return!t_(e)}function BH(cron){if(!(!cron||!J.env.isNode))try{let{CronTime}=eval('require("cron")');new CronTime(cron)}catch(e){throw new ca("INVALID_ARTIFACT_CRON",`Artifact cron ${cron} is invalid.`,`Reason: ${e.message??e}`)}}function IH(e){if(!e||typeof e!="object")return e;let t=Zw(e);return t?(BH(t),e.cron=t,e):(delete e.cron,e)}function $H(){Yw.forEach(e=>e.stop()),Yw.clear()}async function xH(e,t,n){if(Ww.has(e)){J.info(`[ARTIFACT CRON] ${t} ${n} skipped: previous run is still running`);return}Ww.add(e);try{J.info(`[ARTIFACT CRON] ${t} ${n} started`),await Xw(e),J.info(`[ARTIFACT CRON] ${t} ${n} finished`)}catch(r){J.error(`[ARTIFACT CRON] ${t} ${n} error: ${r.message??r}`)}finally{Ww.delete(e)}}function PH(artifact){let cron=Zw(artifact),name=artifact.name,logName=n_(artifact),{CronJob}=eval('require("cron")');try{let e=new CronJob(cron,async function(){await xH(name,logName,cron)},null,!0);Yw.set(name,e),J.info(`[ARTIFACT CRON] ${logName} ${cron} scheduled`)}catch(e){J.error(`[ARTIFACT CRON] ${logName} ${cron} schedule error: ${e.message??e}`)}}function r_(){if(!J.env.isNode||!Xw)return;$H();let e=J.read(oa);(Array.isArray(e)?e:[]).filter(n=>n.sync&&n.source).filter(t_).forEach(PH)}function Wse(e){J.env.isNode&&(Xw=e,r_())}var Jse=B(x());function xn(e,t,n="name"){return e.find(r=>r[n]===t)}var UEe=B(x());var eie=B(x()),s_=0;function Ln(e){return TH(kH(RH(e)))}function kH(e){return NH(LH(OH(e),e.length*8))}function TH(e){for(var t=s_?"0123456789ABCDEF":"0123456789abcdef",n="",r,i=0;i<e.length;i++)r=e.charCodeAt(i),n+=t.charAt(r>>>4&15)+t.charAt(r&15);return n}function RH(e){for(var t="",n=-1,r,i;++n<e.length;)r=e.charCodeAt(n),i=n+1<e.length?e.charCodeAt(n+1):0,55296<=r&&r<=56319&&56320<=i&&i<=57343&&(r=65536+((r&1023)<<10)+(i&1023),n++),r<=127?t+=String.fromCharCode(r):r<=2047?t+=String.fromCharCode(192|r>>>6&31,128|r&63):r<=65535?t+=String.fromCharCode(224|r>>>12&15,128|r>>>6&63,128|r&63):r<=2097151&&(t+=String.fromCharCode(240|r>>>18&7,128|r>>>12&63,128|r>>>6&63,128|r&63));return t}function OH(e){for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(var n=0;n<e.length*8;n+=8)t[n>>5]|=(e.charCodeAt(n/8)&255)<<n%32;return t}function NH(e){for(var t="",n=0;n<e.length*32;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}function LH(e,t){e[t>>5]|=128<<t%32,e[(t+64>>>9<<4)+14]=t;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,s=0;s<e.length;s+=16){var a=n,u=r,l=i,h=o;n=Ar(n,r,i,o,e[s+0],7,-680876936),o=Ar(o,n,r,i,e[s+1],12,-389564586),i=Ar(i,o,n,r,e[s+2],17,606105819),r=Ar(r,i,o,n,e[s+3],22,-1044525330),n=Ar(n,r,i,o,e[s+4],7,-176418897),o=Ar(o,n,r,i,e[s+5],12,1200080426),i=Ar(i,o,n,r,e[s+6],17,-1473231341),r=Ar(r,i,o,n,e[s+7],22,-45705983),n=Ar(n,r,i,o,e[s+8],7,1770035416),o=Ar(o,n,r,i,e[s+9],12,-1958414417),i=Ar(i,o,n,r,e[s+10],17,-42063),r=Ar(r,i,o,n,e[s+11],22,-1990404162),n=Ar(n,r,i,o,e[s+12],7,1804603682),o=Ar(o,n,r,i,e[s+13],12,-40341101),i=Ar(i,o,n,r,e[s+14],17,-1502002290),r=Ar(r,i,o,n,e[s+15],22,1236535329),n=Sr(n,r,i,o,e[s+1],5,-165796510),o=Sr(o,n,r,i,e[s+6],9,-1069501632),i=Sr(i,o,n,r,e[s+11],14,643717713),r=Sr(r,i,o,n,e[s+0],20,-373897302),n=Sr(n,r,i,o,e[s+5],5,-701558691),o=Sr(o,n,r,i,e[s+10],9,38016083),i=Sr(i,o,n,r,e[s+15],14,-660478335),r=Sr(r,i,o,n,e[s+4],20,-405537848),n=Sr(n,r,i,o,e[s+9],5,568446438),o=Sr(o,n,r,i,e[s+14],9,-1019803690),i=Sr(i,o,n,r,e[s+3],14,-187363961),r=Sr(r,i,o,n,e[s+8],20,1163531501),n=Sr(n,r,i,o,e[s+13],5,-1444681467),o=Sr(o,n,r,i,e[s+2],9,-51403784),i=Sr(i,o,n,r,e[s+7],14,1735328473),r=Sr(r,i,o,n,e[s+12],20,-1926607734),n=Cr(n,r,i,o,e[s+5],4,-378558),o=Cr(o,n,r,i,e[s+8],11,-2022574463),i=Cr(i,o,n,r,e[s+11],16,1839030562),r=Cr(r,i,o,n,e[s+14],23,-35309556),n=Cr(n,r,i,o,e[s+1],4,-1530992060),o=Cr(o,n,r,i,e[s+4],11,1272893353),i=Cr(i,o,n,r,e[s+7],16,-155497632),r=Cr(r,i,o,n,e[s+10],23,-1094730640),n=Cr(n,r,i,o,e[s+13],4,681279174),o=Cr(o,n,r,i,e[s+0],11,-358537222),i=Cr(i,o,n,r,e[s+3],16,-722521979),r=Cr(r,i,o,n,e[s+6],23,76029189),n=Cr(n,r,i,o,e[s+9],4,-640364487),o=Cr(o,n,r,i,e[s+12],11,-421815835),i=Cr(i,o,n,r,e[s+15],16,530742520),r=Cr(r,i,o,n,e[s+2],23,-995338651),n=_r(n,r,i,o,e[s+0],6,-198630844),o=_r(o,n,r,i,e[s+7],10,1126891415),i=_r(i,o,n,r,e[s+14],15,-1416354905),r=_r(r,i,o,n,e[s+5],21,-57434055),n=_r(n,r,i,o,e[s+12],6,1700485571),o=_r(o,n,r,i,e[s+3],10,-1894986606),i=_r(i,o,n,r,e[s+10],15,-1051523),r=_r(r,i,o,n,e[s+1],21,-2054922799),n=_r(n,r,i,o,e[s+8],6,1873313359),o=_r(o,n,r,i,e[s+15],10,-30611744),i=_r(i,o,n,r,e[s+6],15,-1560198380),r=_r(r,i,o,n,e[s+13],21,1309151649),n=_r(n,r,i,o,e[s+4],6,-145523070),o=_r(o,n,r,i,e[s+11],10,-1120210379),i=_r(i,o,n,r,e[s+2],15,718787259),r=_r(r,i,o,n,e[s+9],21,-343485551),n=Cu(n,a),r=Cu(r,u),i=Cu(i,l),o=Cu(o,h)}return Array(n,r,i,o)}function u1(e,t,n,r,i,o){return Cu(UH(Cu(Cu(t,e),Cu(r,o)),i),n)}function Ar(e,t,n,r,i,o,s){return u1(t&n|~t&r,e,t,i,o,s)}function Sr(e,t,n,r,i,o,s){return u1(t&r|n&~r,e,t,i,o,s)}function Cr(e,t,n,r,i,o,s){return u1(t^n^r,e,t,i,o,s)}function _r(e,t,n,r,i,o,s){return u1(n^(t|~r),e,t,i,o,s)}function Cu(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}function UH(e,t){return e<<t|e>>>32-t}var Eie=B(x()),v1=B(p_()),MM=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,qM=/^(([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 Sn(e){return MM.test(e)}function Xt(e){return qM.test(e)}function m_(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 qe(e){return typeof e=="string"&&e.trim().length>0}function vt(e,t){return qe(e)?e:t}function Xl(e){return typeof e<"u"&&e!==null}function la(e,t){return Xl(e)?e:t}function fa(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function jM(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function Qh(e){let t=e.split(/,|\//),n=t[Math.floor(Math.random()*t.length)];if(n.includes("-")){let[r,i]=n.split("-").map(Number);return jM(r,i)}else return Number(n)}function g_(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function w1(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 ze(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}var Cie=B(x());var oy=class{constructor(){J.read(_c)||J.write("{}",_c);try{this.resourceCache=JSON.parse(J.read(_c))}catch(t){J.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${_c} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},J.write("{}",_c)}this._cleanup()}_cleanup(t,n){let r=iy(n)??0,i=!1,o=Date.now();Object.entries(this.resourceCache).forEach(s=>{let[a,u]=s;(!u.time||u.time<o+r)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],i=!0)}),i&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){J.write(JSON.stringify(this.resourceCache),_c)}gettime(t){let n=this.resourceCache[t]&&this.resourceCache[t].time;return n&&new Date().getTime()<=n?this.resourceCache[t].time:null}get(t,n,r){let i=iy(n)??0,o=this.resourceCache[t],s=o&&o.time;if(s){if(Date.now()+i<=s)return o.data;r&&(delete this.resourceCache[t],this._persist())}return null}set(t,n,r){let i=iy(r)??VM();this.resourceCache[t]={time:Date.now()+i,data:n},this._persist()}};function iy(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function VM(){let t=(J.read(Jt)||{})?.resourceCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:36e5}var Un=new oy;var Bie=B(x());var uy=class{constructor(){J.read(Dc)||J.write("{}",Dc);try{this.resourceCache=JSON.parse(J.read(Dc))}catch(t){J.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Dc} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},J.write("{}",Dc)}this._cleanup()}_cleanup(t,n){let r=ay(n)??0,i=!1,o=Date.now();Object.entries(this.resourceCache).forEach(s=>{let[a,u]=s;(!u.time||u.time<o+r)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],i=!0)}),i&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){J.write(JSON.stringify(this.resourceCache),Dc)}gettime(t){let n=this.resourceCache[t]&&this.resourceCache[t].time;return n&&new Date().getTime()<=n?this.resourceCache[t].time:null}get(t,n,r){let i=ay(n)??0,o=this.resourceCache[t],s=o&&o.time;if(s){if(Date.now()+i<=s)return o.data;r&&(delete this.resourceCache[t],this._persist())}return null}set(t,n,r){let i=ay(r)??zM();this.resourceCache[t]={time:Date.now()+i,data:n},this._persist()}};function ay(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function zM(){let t=(J.read(Jt)||{})?.headersCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:6e4}var ed=new uy;var Mie=B(x());var Pie=B(x());var v_=10,WM="backendRequestConcurrency",w_=0,YM="backendRequestConcurrencyWaitTime",td=0,fy=[];function XM(e){return new Promise(t=>setTimeout(t,e))}function ZM(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return v_;let t=Number(e);return!Number.isInteger(t)||t<1?v_:t}function JM(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return w_;let t=Number(e);return!Number.isInteger(t)||t<0?w_:t}function cy(){let e=J.read(Jt)||{};return ZM(e[WM])}function ly(){let e=J.read(Jt)||{};return JM(e[YM])}function QM(e,t){return`active=${td}, pending=${fy.length}, limit=${e}, waitTime=${t}ms`}function y1(e,t,n,r){J.log(`[Backend Request Concurrency] ${e}: ${t} (${QM(n,r)})`)}function eq(){let e=fy.shift();e&&e()}async function tq(e){let t=cy(),n=ly();for(;td>=t;)y1("queued",e,t,n),await new Promise(r=>{fy.push(r)}),t=cy(),n=ly();td+=1,y1("acquired",e,t,n),n>0&&(y1("waiting before request",e,t,n),await XM(n))}function nq(e){td=Math.max(0,td-1),y1("released",e,cy(),ly()),eq()}async function Zl(e,t="request"){await tq(t);try{return await e()}finally{nq(t)}}function Pc(e){let t=Object.keys(e),n="",r="",i="";for(let o of t){let s=o.toLowerCase();s==="subscription-userinfo"?n=e[o]:s==="profile-web-page-url"?r=e[o]:s==="plan-name"&&(i=e[o])}return`${n||""}${r?`; app_url=${encodeURIComponent(r)}`:""}${i?`; plan_name=${encodeURIComponent(i)}`:""}`}async function E1(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 n=t.split("=")[0],r=t.split("=")[1];$arguments[n]=r==null||r===""?!0:decodeURIComponent(r)}}if($arguments?.noFlow||!/^https?/.test(url))return;let{isStash,isLoon,isShadowRocket,isQX}=Js(),insecure=$arguments?.insecure?J.env.isNode?{strictSSL:!1}:{insecure:!0}:void 0,{defaultProxy,defaultFlowUserAgent,defaultTimeout}=J.read(Jt)||{},proxy=customProxy||defaultProxy;J.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 n in e)t[n.toLowerCase()]=e[n];customHeaders=t}}catch(e){J.error(`\u89E3\u6790\u81EA\u5B9A\u4E49 ${flowHeaders||$arguments?.flowHeaders?"flowHeaders":"headers"} \u5931\u8D25: ${e}`)}let id=Ln(`${customHeaders?JSON.stringify(customHeaders):userAgent}${url}`),cached=ed.get(id),flowInfo;if(!$arguments?.noCache&&cached)J.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${customHeaders?JSON.stringify(customHeaders):userAgent}`),flowInfo=cached;else{let e=lo();if(flowUrl){let t;try{J.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:n,body:r,statusCode:i}=await Zl(()=>e.get({url,headers:customHeaders||{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?fa(proxy):{},...insecure||{}}),"flow body GET");if(i<200||i>=400)throw new Error(`statusCode: ${i}`);t=n;let o=Jl(r);if(Number.isFinite(o?.total)&&Number.isFinite(o?.usage?.download)&&Number.isFinite(o?.usage?.upload))flowInfo=r;else throw new Error("\u54CD\u5E94\u4F53\u4E2D\u672A\u5305\u542B\u5408\u6CD5\u7684\u6D41\u91CF\u4FE1\u606F")}catch(n){if(J.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}: ${n.message??n}`),t)try{let r=Pc(t),i=Jl(r);if(Number.isFinite(i?.total)&&Number.isFinite(i?.usage?.download)&&Number.isFinite(i?.usage?.upload))J.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=r;else throw new Error("\u54CD\u5E94\u4F53\u4E2D\u672A\u5305\u542B\u5408\u6CD5\u7684\u6D41\u91CF\u4FE1\u606F")}catch(r){J.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}: ${r.message??r}`)}}}else{try{J.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 Zl(()=>e.head({url:url.split(/[\r\n]+/).map(n=>n.trim()).filter(n=>n.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?fa(proxy):{},...insecure||{}}),"flow headers HEAD");flowInfo=Pc(t)}catch(t){J.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){J.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 Zl(()=>e.get({url:url.split(/[\r\n]+/).map(n=>n.trim()).filter(n=>n.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?fa(proxy):{},...insecure||{}}),"flow headers GET");flowInfo=Pc(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&ed.set(id,flowInfo,$arguments?.headersCacheTtl?$arguments?.headersCacheTtl*1e3:void 0)}return flowInfo}function Jl(e){if(!e)return;let t=e.match(/upload=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),n=t==null?0:Number(t[1]+t[2]),r=e.match(/download=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),i=Number(r[1]+r[2]),o=e.match(/total=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),s=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]+)/),h=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:s,usage:{upload:n,download:i},remainingDays:h,appUrl:p,planName:v}}function nd(e,t="B"){let n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=n.indexOf(t);return e<1024||r===n.length-1?{value:(Math.round(e*100)/100).toString(),unit:t}:nd(e/1024,n[++r])}function b1(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,n=e.usage?.download||0;if(e.total-t-n<=0){let r=t+n,i=nd(Math.abs(r));i.value=r<0?"-"+i.value:i.value;let o=nd(e.total);throw new Error(`\u6D41\u91CF\u5DF2\u7528\u5B8C: ${i.value} ${i.unit} / ${o.value} ${o.unit}`)}}}function y_(e={}){try{let{resetDay:t,startDate:n,cycleDays:r}=e;if(["string","number"].includes(typeof e)&&(t=e),n&&r){if(r=parseInt(r),isNaN(r)||r<=0)throw new Error("\u91CD\u7F6E\u5468\u671F\u5E94\u4E3A\u6B63\u6574\u6570");if(!n||!Date.parse(n))throw new Error("\u5F00\u59CB\u65E5\u671F\u4E0D\u5408\u6CD5");let i=new Date(n),o=new Date;if(i.setHours(0,0,0,0),o.setHours(0,0,0,0),i.getTime()>o.getTime())throw new Error("\u5F00\u59CB\u65E5\u671F\u5E94\u65E9\u4E8E\u73B0\u5728");let s=new Date(n);for(s.setDate(s.getDate()+r);s<o;)s.setDate(s.getDate()+r);s.setHours(0,0,0,0);let a=s.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 i=new Date,o=i.getDate(),s=i.getMonth(),a=i.getFullYear(),u;return t>o?u=0:u=new Date(a,s+1,0).getDate(),u-o+t}}catch(t){J.error(`getRmainingDays failed: ${t.message??t}`)}}function E_(e,t){try{let n=new Map;e.split(";").map(o=>o.trim()).filter(Boolean).forEach(o=>{let s=o.indexOf("=");if(s===-1)return;let a=o.slice(0,s).trim(),u=o.slice(s+1).trim();if(!n.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(h){J.error(`Failed to convert value for key "${a}=${u}": ${h.message??h}`)}n.set(a,l)}catch{n.set(a,u)}});let r={},i={"subscription-userinfo":"","profile-web-page-url":"","plan-name":""};return n.forEach((o,s)=>{t&&s==="app_url"?i["profile-web-page-url"]=o:t&&s==="plan_name"?i["plan-name"]=o:r[s]=o}),Object.keys(r).length>0&&(i["subscription-userinfo"]=Object.entries(r).map(([o,s])=>`${o}=${encodeURIComponent(s)}`).join("; ")),t?i:i["subscription-userinfo"]}catch(n){return J.error(`normalizeFlowHeader failed: ${n.message??n}`),t?{"subscription-userinfo":e}:e}}var Yhe=B(x());var jhe=B(x());var Uhe=B(x(),1);var Ahe=B(x(),1);var Lfe=B(x(),1);var Xie=B(x(),1);var jie=B(x(),1),A1=Symbol.for("yaml.alias"),S1=Symbol.for("yaml.document"),Bi=Symbol.for("yaml.map"),hy=Symbol.for("yaml.pair"),ks=Symbol.for("yaml.scalar"),ha=Symbol.for("yaml.seq"),Vr=Symbol.for("yaml.node.type"),ls=e=>!!e&&typeof e=="object"&&e[Vr]===A1,Ii=e=>!!e&&typeof e=="object"&&e[Vr]===S1,$i=e=>!!e&&typeof e=="object"&&e[Vr]===Bi,It=e=>!!e&&typeof e=="object"&&e[Vr]===hy,dt=e=>!!e&&typeof e=="object"&&e[Vr]===ks,Ts=e=>!!e&&typeof e=="object"&&e[Vr]===ha;function Mt(e){if(e&&typeof e=="object")switch(e[Vr]){case Bi:case ha:return!0}return!1}function Pt(e){if(e&&typeof e=="object")switch(e[Vr]){case A1:case Bi:case ks:case ha:return!0}return!1}var C1=e=>(dt(e)||Mt(e))&&!!e.anchor;var Gie=B(x(),1);var hs=Symbol("break visit"),b_=Symbol("skip children"),go=Symbol("remove node");function ds(e,t){let n=A_(t);Ii(e)?Ql(null,e.contents,n,Object.freeze([e]))===go&&(e.contents=null):Ql(null,e,n,Object.freeze([]))}ds.BREAK=hs;ds.SKIP=b_;ds.REMOVE=go;function Ql(e,t,n,r){let i=S_(e,t,n,r);if(Pt(i)||It(i))return C_(e,r,i),Ql(e,i,n,r);if(typeof i!="symbol"){if(Mt(t)){r=Object.freeze(r.concat(t));for(let o=0;o<t.items.length;++o){let s=Ql(o,t.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===hs)return hs;s===go&&(t.items.splice(o,1),o-=1)}}}else if(It(t)){r=Object.freeze(r.concat(t));let o=Ql("key",t.key,n,r);if(o===hs)return hs;o===go&&(t.key=null);let s=Ql("value",t.value,n,r);if(s===hs)return hs;s===go&&(t.value=null)}}return i}async function _1(e,t){let n=A_(t);Ii(e)?await ef(null,e.contents,n,Object.freeze([e]))===go&&(e.contents=null):await ef(null,e,n,Object.freeze([]))}_1.BREAK=hs;_1.SKIP=b_;_1.REMOVE=go;async function ef(e,t,n,r){let i=await S_(e,t,n,r);if(Pt(i)||It(i))return C_(e,r,i),ef(e,i,n,r);if(typeof i!="symbol"){if(Mt(t)){r=Object.freeze(r.concat(t));for(let o=0;o<t.items.length;++o){let s=await ef(o,t.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===hs)return hs;s===go&&(t.items.splice(o,1),o-=1)}}}else if(It(t)){r=Object.freeze(r.concat(t));let o=await ef("key",t.key,n,r);if(o===hs)return hs;o===go&&(t.key=null);let s=await ef("value",t.value,n,r);if(s===hs)return hs;s===go&&(t.value=null)}}return i}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 S_(e,t,n,r){if(typeof n=="function")return n(e,t,r);if($i(t))return n.Map?.(e,t,r);if(Ts(t))return n.Seq?.(e,t,r);if(It(t))return n.Pair?.(e,t,r);if(dt(t))return n.Scalar?.(e,t,r);if(ls(t))return n.Alias?.(e,t,r)}function C_(e,t,n){let r=t[t.length-1];if(Mt(r))r.items[e]=n;else if(It(r))e==="key"?r.key=n:r.value=n;else if(Ii(r))r.contents=n;else{let i=ls(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var rq={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sq=e=>e.replace(/[!,[\]{}]/g,t=>rq[t]),vo=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}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,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,r,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+sq(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(t&&r.length>0&&Pt(t.contents)){let o={};ds(t.contents,(s,a)=>{Pt(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
`)}};vo.defaultYaml={explicit:!1,version:"1.2"};vo.defaultTags={"!!":"tag:yaml.org,2002:"};var cle=B(x(),1);var voe=B(x(),1);var eoe=B(x(),1);function D1(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function dy(e){let t=new Set;return ds(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function py(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function __(e,t){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=dy(e));let s=py(t,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(dt(s.node)||Mt(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}var loe=B(x(),1);var noe=B(x(),1);function _u(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=_u(e,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=_u(e,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=_u(e,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=_u(e,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return e.call(t,n,r)}var ioe=B(x(),1);function Hn(e,t,n){if(Array.isArray(e))return e.map((r,i)=>Hn(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!C1(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!n?.keep?Number(e):e}var Du=class{constructor(t){Object.defineProperty(this,Vr,{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:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!Ii(t))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Hn(this,"",s);if(typeof i=="function")for(let{count:u,res:l}of s.anchors.values())i(l,u);return typeof o=="function"?_u(o,{"":a},"",a):a}};var da=class extends Du{constructor(t){super(A1),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],ds(t,{Node:(o,s)=>{(ls(s)||C1(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(t,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=n,s=this.resolve(i,n);if(!s){let u=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(u)}let a=r.get(s);if(a||(Hn(s,null,n),a=r.get(s)),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=F1(i,s,r)),a.count*a.aliasCount>o)){let u="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(u)}return a.res}toString(t,n,r){let i=`*${this.source}`;if(t){if(D1(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`${i} `}return i}};function F1(e,t,n){if(ls(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Mt(t)){let r=0;for(let i of t.items){let o=F1(e,i,n);o>r&&(r=o)}return r}else if(It(t)){let r=F1(e,t.key,n),i=F1(e,t.value,n);return Math.max(r,i)}return 1}var Poe=B(x(),1);var Foe=B(x(),1);var Aoe=B(x(),1);var B1=e=>!e||typeof e!="function"&&typeof e!="object",Ke=class extends Du{constructor(t){super(ks),this.value=t}toJSON(t,n){return n?.keep?this.value:Hn(this.value,t,n)}toString(){return String(this.value)}};Ke.BLOCK_FOLDED="BLOCK_FOLDED";Ke.BLOCK_LITERAL="BLOCK_LITERAL";Ke.PLAIN="PLAIN";Ke.QUOTE_DOUBLE="QUOTE_DOUBLE";Ke.QUOTE_SINGLE="QUOTE_SINGLE";var iq="tag:yaml.org,2002:";function oq(e,t,n){if(t){let r=n.filter(o=>o.tag===t),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>r.identify?.(e)&&!r.format)}function pa(e,t,n){if(Ii(e)&&(e=e.contents),Pt(e))return e;if(It(e)){let m=n.schema[Bi].createNode?.(n.schema,null,n);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:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,u;if(r&&e&&typeof e=="object"){if(u=a.get(e),u)return u.anchor??(u.anchor=i(e)),new da(u.anchor);u={anchor:null,node:null},a.set(e,u)}t?.startsWith("!!")&&(t=iq+t.slice(2));let l=oq(e,t,s.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let m=new Ke(e);return u&&(u.node=m),m}l=e instanceof Map?s[Bi]:Symbol.iterator in Object(e)?s[ha]:s[Bi]}o&&(o(l),delete n.onTagObj);let h=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,e,n):new Ke(e);return t?h.tag=t:l.default||(h.tag=l.tag),u&&(u.node=h),h}function rd(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){let o=t[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return pa(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var nf=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,tf=class extends Du{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>Pt(r)||It(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(nf(t))this.add(n);else{let[r,...i]=t,o=this.get(r,!0);if(Mt(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,rd(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){let[n,...r]=t;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(Mt(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){let[r,...i]=t,o=this.get(r,!0);return i.length===0?!n&&dt(o)?o.value:o:Mt(o)?o.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!It(n))return!1;let r=n.value;return r==null||t&&dt(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[n,...r]=t;if(r.length===0)return this.has(n);let i=this.get(n,!0);return Mt(i)?i.hasIn(r):!1}setIn(t,n){let[r,...i]=t;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(Mt(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,rd(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};var vae=B(x(),1);var Joe=B(x(),1);var Goe=B(x(),1);var Toe=B(x(),1),D_=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function ti(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var wo=(e,t,n)=>e.endsWith(`
`)?ti(n,t):n.includes(`
`)?`
`+ti(n,t):(e.endsWith(" ")?"":" ")+n;var Hoe=B(x(),1);var Ooe=B(x(),1),my="flow",I1="block",sd="quoted";function od(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return e;i<o&&(o=0);let u=Math.max(1+o,1+i-t.length);if(e.length<=u)return e;let l=[],h={},m=i-t.length;typeof r=="number"&&(r>i-Math.max(2,o)?l.push(0):m=i-r);let p,d,v=!1,g=-1,y=-1,w=-1;n===I1&&(g=F_(e,g,t.length),g!==-1&&(m=g+u));for(let C;C=e[g+=1];){if(n===sd&&C==="\\"){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(C===`
`)n===I1&&(g=F_(e,g,t.length)),m=g+t.length+u,p=void 0;else{if(C===" "&&d&&d!==" "&&d!==`
`&&d!==" "){let _=e[g+1];_&&_!==" "&&_!==`
`&&_!==" "&&(p=g)}if(g>=m)if(p)l.push(p),m=p+u,p=void 0;else if(n===sd){for(;d===" "||d===" ";)d=C,C=e[g+=1],v=!0;let _=g>w+1?g-2:y-1;if(h[_])return e;l.push(_),h[_]=!0,m=_+u,p=void 0}else v=!0}d=C}if(v&&a&&a(),l.length===0)return e;s&&s();let E=e.slice(0,l[0]);for(let C=0;C<l.length;++C){let _=l[C],F=l[C+1]||e.length;_===0?E=`
${t}${e.slice(0,F)}`:(n===sd&&h[_]&&(E+=`${e[_]}\\`),E+=`
${t}${e.slice(_+1,F)}`)}return E}function F_(e,t,n){let r=t,i=t+1,o=e[i];for(;o===" "||o===" ";)if(t<i+n)o=e[++t];else{do o=e[++t];while(o&&o!==`
`);r=t,i=t+1,o=e[i]}return r}var x1=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),P1=e=>/^(%|---|\.\.\.)/m.test(e);function aq(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(e[o]===`
`){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function ad(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(P1(e)?" ":""),s="",a=0;for(let u=0,l=n[u];l;l=n[++u])if(l===" "&&n[u+1]==="\\"&&n[u+2]==="n"&&(s+=n.slice(a,u)+"\\ ",u+=1,a=u,l="\\"),l==="\\")switch(n[u+1]){case"u":{s+=n.slice(a,u);let h=n.substr(u+2,4);switch(h){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:h.substr(0,2)==="00"?s+="\\x"+h.substr(2):s+=n.substr(u,6)}u+=5,a=u+1}break;case"n":if(r||n[u+2]==='"'||n.length<i)u+=1;else{for(s+=n.slice(a,u)+`
`;n[u+2]==="\\"&&n[u+3]==="n"&&n[u+4]!=='"';)s+=`
`,u+=2;s+=o,n[u+2]===" "&&(s+="\\"),u+=1,a=u+1}break;default:u+=1}return s=a?s+n.slice(a):n,r?s:od(s,o,sd,x1(t,!1))}function gy(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return ad(e,t);let n=t.indent||(P1(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
${n}`)+"'";return t.implicitKey?r:od(r,n,my,x1(t,!1))}function rf(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=ad;else{let i=e.includes('"'),o=e.includes("'");i&&!o?r=gy:o&&!i?r=ad:r=n?gy:ad}return r(e,t)}var vy;try{vy=new RegExp(`(^|(?<!
))
+(?!
|$)`,"g")}catch{vy=/\n+(?!\n|$)/g}function $1({comment:e,type:t,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:u}=r.options;if(!s||/\n[\t ]+$/.test(n))return rf(n,r);let l=r.indent||(r.forceBlockIndent||P1(n)?" ":""),h=s==="literal"?!0:s==="folded"||t===Ke.BLOCK_FOLDED?!1:t===Ke.BLOCK_LITERAL?!0:!aq(n,u,l.length);if(!n)return h?`|
`:`>
`;let m,p;for(p=n.length;p>0;--p){let F=n[p-1];if(F!==`
`&&F!==" "&&F!==" ")break}let d=n.substring(p),v=d.indexOf(`
`);v===-1?m="-":n===d||v!==d.length-1?(m="+",o&&o()):m="",d&&(n=n.slice(0,-d.length),d[d.length-1]===`
`&&(d=d.slice(0,-1)),d=d.replace(vy,`$&${l}`));let g=!1,y,w=-1;for(y=0;y<n.length;++y){let F=n[y];if(F===" ")g=!0;else if(F===`
`)w=y;else break}let E=n.substring(0,w<y?w+1:y);E&&(n=n.substring(E.length),E=E.replace(/\n+/g,`$&${l}`));let _=(g?l?"2":"1":"")+m;if(e&&(_+=" "+a(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!h){let F=n.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),H=!1,K=x1(r,!0);s!=="folded"&&t!==Ke.BLOCK_FOLDED&&(K.onOverflow=()=>{H=!0});let S=od(`${E}${F}${d}`,l,I1,K);if(!H)return`>${_}
${l}${S}`}return n=n.replace(/\n+/g,`$&${l}`),`|${_}
${l}${E}${n}${d}`}function uq(e,t,n,r){let{type:i,value:o}=e,{actualString:s,implicitKey:a,indent:u,indentStep:l,inFlow:h}=t;if(a&&o.includes(`
`)||h&&/[[\]{},]/.test(o))return rf(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||h||!o.includes(`
`)?rf(o,t):$1(e,t,n,r);if(!a&&!h&&i!==Ke.PLAIN&&o.includes(`
`))return $1(e,t,n,r);if(P1(o)){if(u==="")return t.forceBlockIndent=!0,$1(e,t,n,r);if(a&&u===l)return rf(o,t)}let m=o.replace(/\n+/g,`$&
${u}`);if(s){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 rf(o,t)}return a?m:od(m,u,my,x1(t,!1))}function kc(e,t,n,r){let{implicitKey:i,inFlow:o}=t,s=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==Ke.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Ke.QUOTE_DOUBLE);let u=h=>{switch(h){case Ke.BLOCK_FOLDED:case Ke.BLOCK_LITERAL:return i||o?rf(s.value,t):$1(s,t,n,r);case Ke.QUOTE_DOUBLE:return ad(s.value,t);case Ke.QUOTE_SINGLE:return gy(s.value,t);case Ke.PLAIN:return uq(s,t,n,r);default:return null}},l=u(a);if(l===null){let{defaultKeyType:h,defaultStringType:m}=t.options,p=i&&h||m;if(l=u(p),l===null)throw new Error(`Unsupported default string type ${p}`)}return l}function k1(e,t){let n=Object.assign({blockQuote:!0,commentString:D_,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),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function cq(e,t){if(t.tag){let i=e.filter(o=>o.tag===t.tag);if(i.length>0)return i.find(o=>o.format===t.format)??i[0]}let n,r;if(dt(t)){r=t.value;let i=e.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===t.format)??i.find(o=>!o.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function lq(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(dt(e)||Mt(e))&&e.anchor;o&&D1(o)&&(n.add(o),i.push(`&${o}`));let s=e.tag??(t.default?null:t.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function ma(e,t,n,r){if(It(e))return e.toString(t,n,r);if(ls(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 i,o=Pt(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=cq(t.doc.schema.tags,o));let s=lq(o,i,t);s.length>0&&(t.indentAtStart=(t.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,t,n,r):dt(o)?kc(o,t,n,r):o.toString(t,n,r);return s?dt(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
${t.indent}${a}`:a}function B_({key:e,value:t},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:u,options:{commentString:l,indentSeq:h,simpleKeys:m}}=n,p=Pt(e)&&e.comment||null;if(m){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(Mt(e)||!Pt(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&&!n.inFlow||Mt(e)||(dt(e)?e.type===Ke.BLOCK_FOLDED||e.type===Ke.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!d&&(m||!o),indent:a+u});let v=!1,g=!1,y=ma(e,n,()=>v=!0,()=>g=!0);if(!d&&!n.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(n.inFlow){if(o||t==null)return v&&r&&r(),y===""?"?":d?`? ${y}`:y}else if(o&&!m||t==null&&d)return y=`? ${y}`,p&&!v?y+=wo(y,n.indent,l(p)):g&&i&&i(),y;v&&(p=null),d?(p&&(y+=wo(y,n.indent,l(p))),y=`? ${y}
${a}:`):(y=`${y}:`,p&&(y+=wo(y,n.indent,l(p))));let w,E,C;Pt(t)?(w=!!t.spaceBefore,E=t.commentBefore,C=t.comment):(w=!1,E=null,C=null,t&&typeof t=="object"&&(t=s.createNode(t))),n.implicitKey=!1,!d&&!p&&dt(t)&&(n.indentAtStart=y.length+1),g=!1,!h&&u.length>=2&&!n.inFlow&&!d&&Ts(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1,F=ma(t,n,()=>_=!0,()=>g=!0),H=" ";if(p||w||E){if(H=w?`
`:"",E){let K=l(E);H+=`
${ti(K,n.indent)}`}F===""&&!n.inFlow?H===`
`&&C&&(H=`
`):H+=`
${n.indent}`}else if(!d&&Mt(t)){let K=F[0],S=F.indexOf(`
`),I=S!==-1,q=n.inFlow??t.flow??t.items.length===0;if(I||!q){let L=!1;if(I&&(K==="&"||K==="!")){let T=F.indexOf(" ");K==="&"&&T!==-1&&T<S&&F[T+1]==="!"&&(T=F.indexOf(" ",T+1)),(T===-1||S<T)&&(L=!0)}L||(H=`
${n.indent}`)}}else(F===""||F[0]===`
`)&&(H="");return y+=H+F,n.inFlow?_&&r&&r():C&&!_?y+=wo(y,n.indent,l(C)):g&&i&&i(),y}var fae=B(x(),1);var eae=B(x(),1);function T1(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var sae=B(x(),1);var R1="<<",xi={identify:e=>e===R1||typeof e=="symbol"&&e.description===R1,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ke(Symbol(R1)),{addToJSMap:yy}),stringify:()=>R1},I_=(e,t)=>(xi.identify(t)||dt(t)&&(!t.type||t.type===Ke.PLAIN)&&xi.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===xi.tag&&n.default);function yy(e,t,n){let r=$_(e,n);if(Ts(r))for(let i of r.items)wy(e,t,i);else if(Array.isArray(r))for(let i of r)wy(e,t,i);else wy(e,t,r)}function wy(e,t,n){let r=$_(e,n);if(!$i(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,e,Map);for(let[o,s]of i)t instanceof Map?t.has(o)||t.set(o,s):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function $_(e,t){return e&&ls(t)?t.resolve(e.doc,e):t}function O1(e,t,{key:n,value:r}){if(Pt(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(I_(e,n))yy(e,t,r);else{let i=Hn(n,"",e);if(t instanceof Map)t.set(i,Hn(r,i,e));else if(t instanceof Set)t.add(i);else{let o=fq(n,i,e),s=Hn(r,o,e);o in t?Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[o]=s}}return t}function fq(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Pt(e)&&n?.doc){let r=k1(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=e.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),T1(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function sf(e,t,n){let r=pa(e,void 0,n),i=pa(t,void 0,n);return new mn(r,i)}var mn=class e{constructor(t,n=null){Object.defineProperty(this,Vr,{value:hy}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return Pt(n)&&(n=n.clone(t)),Pt(r)&&(r=r.clone(t)),new e(n,r)}toJSON(t,n){let r=n?.mapAsMap?new Map:{};return O1(n,r,this)}toString(t,n,r){return t?.doc?B_(this,t,n,r):JSON.stringify(this)}};var Vce=B(x(),1);var Tae=B(x(),1);var $ae=B(x(),1);var Aae=B(x(),1);function L1(e,t,n){return(t.inFlow??e.flow?dq:hq)(e,t,n)}function hq({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:u,options:{commentString:l}}=n,h=Object.assign({},n,{indent:o,type:null}),m=!1,p=[];for(let v=0;v<t.length;++v){let g=t[v],y=null;if(Pt(g))!m&&g.spaceBefore&&p.push(""),N1(n,p,g.commentBefore,m),g.comment&&(y=g.comment);else if(It(g)){let E=Pt(g.key)?g.key:null;E&&(!m&&E.spaceBefore&&p.push(""),N1(n,p,E.commentBefore,m))}m=!1;let w=ma(g,h,()=>y=null,()=>m=!0);y&&(w+=wo(w,o,l(y))),m&&y&&(m=!1),p.push(r+w)}let d;if(p.length===0)d=i.start+i.end;else{d=p[0];for(let v=1;v<p.length;++v){let g=p[v];d+=g?`
${u}${g}`:`
`}}return e?(d+=`
`+ti(l(e),u),a&&a()):m&&s&&s(),d}function dq({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=t;r+=o;let u=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,h=0,m=[];for(let v=0;v<e.length;++v){let g=e[v],y=null;if(Pt(g))g.spaceBefore&&m.push(""),N1(t,m,g.commentBefore,!1),g.comment&&(y=g.comment);else if(It(g)){let E=Pt(g.key)?g.key:null;E&&(E.spaceBefore&&m.push(""),N1(t,m,E.commentBefore,!1),E.comment&&(l=!0));let C=Pt(g.value)?g.value:null;C?(C.comment&&(y=C.comment),C.commentBefore&&(l=!0)):g.value==null&&E?.comment&&(y=E.comment)}y&&(l=!0);let w=ma(g,u,()=>y=null);l||(l=m.length>h||w.includes(`
`)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=m.reduce((E,C)=>E+C.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),y&&(w+=wo(w,r,a(y))),m.push(w),h=m.length}let{start:p,end:d}=n;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}${i}${g}`:`
`;return`${v}
${i}${d}`}else return`${p}${s}${m.join(" ")}${s}${d}`}function N1({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=ti(t(r),e);n.push(o.trimStart())}}function Fu(e,t){let n=dt(t)?t.value:t;for(let r of e)if(It(r)&&(r.key===t||r.key===n||dt(r.key)&&r.key.value===n))return r}var Cn=class extends tf{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Bi,t),this.items=[]}static from(t,n,r){let{keepUndefined:i,replacer:o}=r,s=new this(t),a=(u,l)=>{if(typeof o=="function")l=o.call(n,u,l);else if(Array.isArray(o)&&!o.includes(u))return;(l!==void 0||i)&&s.items.push(sf(u,l,r))};if(n instanceof Map)for(let[u,l]of n)a(u,l);else if(n&&typeof n=="object")for(let u of Object.keys(n))a(u,n[u]);return typeof t.sortMapEntries=="function"&&s.items.sort(t.sortMapEntries),s}add(t,n){let r;It(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new mn(t,t?.value):r=new mn(t.key,t.value);let i=Fu(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);dt(i.value)&&B1(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(t){let n=Fu(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let i=Fu(this.items,t)?.value;return(!n&&dt(i)?i.value:i)??void 0}has(t){return!!Fu(this.items,t)}set(t,n){this.add(new mn(t,n),!0)}toJSON(t,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)O1(n,i,o);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(let i of this.items)if(!It(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),L1(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}};var Pi={collection:"map",default:!0,nodeClass:Cn,tag:"tag:yaml.org,2002:map",resolve(e,t){return $i(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Cn.from(e,t,n)};var Gae=B(x(),1);var qae=B(x(),1);var Br=class extends tf{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(ha,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=U1(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let r=U1(t);if(typeof r!="number")return;let i=this.items[r];return!n&&dt(i)?i.value:i}has(t){let n=U1(t);return typeof n=="number"&&n<this.items.length}set(t,n){let r=U1(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let i=this.items[r];dt(i)&&B1(n)?i.value=n:this.items[r]=n}toJSON(t,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(Hn(o,String(i++),n));return r}toString(t,n,r){return t?L1(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(t,n,r){let{replacer:i}=r,o=new this(t);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let u=n instanceof Set?a:String(s++);a=i.call(n,u,a)}o.items.push(pa(a,void 0,r))}}return o}};function U1(e){let t=dt(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var ki={collection:"seq",default:!0,nodeClass:Br,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Ts(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Br.from(e,t,n)};var Yae=B(x(),1);var Bu={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),kc(e,t,n,r)}};var Lce=B(x(),1);var Jae=B(x(),1);var Tc={identify:e=>e==null,createNode:()=>new Ke(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ke(null),stringify:({source:e},t)=>typeof e=="string"&&Tc.test.test(e)?e:t.options.nullStr};var tue=B(x(),1);var ud={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Ke(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&ud.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};var aue=B(x(),1);var rue=B(x(),1);function Ir({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=t-(o.length-s-1);for(;a-- >0;)o+="0"}return o}var H1={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:Ir},M1={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():Ir(e)}},q1={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 Ke(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Ir};var lue=B(x(),1);var j1=e=>typeof e=="bigint"||Number.isInteger(e),Ey=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function x_(e,t,n){let{value:r}=e;return j1(r)&&r>=0?n+r.toString(t):Ir(e)}var K1={identify:e=>j1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Ey(e,2,8,n),stringify:e=>x_(e,8,"0o")},V1={identify:j1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Ey(e,0,10,n),stringify:Ir},G1={identify:e=>j1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Ey(e,2,16,n),stringify:e=>x_(e,16,"0x")};var yue=B(x(),1);var P_=[Pi,ki,Bu,Tc,ud,K1,V1,G1,H1,M1,q1];var Cue=B(x(),1);function k_(e){return typeof e=="bigint"||Number.isInteger(e)}var z1=({value:e})=>JSON.stringify(e),pq=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:z1},{identify:e=>e==null,createNode:()=>new Ke(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:z1},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:z1},{identify:k_,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>k_(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:z1}],mq={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},T_=[Pi,ki].concat(pq,mq);var Bue=B(x(),1);var cd={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,i,o){if(!n)return"";let s=n,a;if(typeof btoa=="function"){let u="";for(let l=0;l<s.length;++l)u+=String.fromCharCode(s[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=Ke.BLOCK_LITERAL),t!==Ke.QUOTE_DOUBLE){let u=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(a.length/u),h=new Array(l);for(let m=0,p=0;m<l;++m,p+=u)h[m]=a.substr(p,u);a=h.join(t===Ke.BLOCK_LITERAL?`
`:" ")}return kc({comment:e,type:t,value:a},r,i,o)}};var Mue=B(x(),1);var Tue=B(x(),1);function by(e,t){if(Ts(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!It(r)){if($i(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let i=r.items[0]||new mn(new Ke(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
${o.comment}`:r.comment}r=i}e.items[n]=It(r)?r:new mn(r)}}else t("Expected a sequence for this tag");return e}function Ay(e,t,n){let{replacer:r}=n,i=new Br(e);i.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){typeof r=="function"&&(s=r.call(t,String(o++),s));let a,u;if(Array.isArray(s))if(s.length===2)a=s[0],u=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],u=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(sf(a,u,n))}return i}var ld={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:by,createNode:Ay};var of=class e extends Br{constructor(){super(),this.add=Cn.prototype.add.bind(this),this.delete=Cn.prototype.delete.bind(this),this.get=Cn.prototype.get.bind(this),this.has=Cn.prototype.has.bind(this),this.set=Cn.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(It(i)?(o=Hn(i.key,"",n),s=Hn(i.value,o,n)):o=Hn(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(t,n,r){let i=Ay(t,n,r),o=new this;return o.items=i.items,o}};of.tag="tag:yaml.org,2002:omap";var fd={collection:"seq",identify:e=>e instanceof Map,nodeClass:of,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=by(e,t),r=[];for(let{key:i}of n.items)dt(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new of,n)},createNode:(e,t,n)=>of.from(e,t,n)};var Ece=B(x(),1);var Kue=B(x(),1);function R_({value:e,source:t},n){return t&&(e?Sy:Cy).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Sy={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 Ke(!0),stringify:R_},Cy={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 Ke(!1),stringify:R_};var Wue=B(x(),1);var O_={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:Ir},N_={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():Ir(e)}},L_={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 Ke(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Ir};var Zue=B(x(),1);var hd=e=>typeof e=="bigint"||Number.isInteger(e);function W1(e,t,n,{intAsBigInt:r}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return i==="-"?BigInt(-1)*s:s}let o=parseInt(e,n);return i==="-"?-1*o:o}function _y(e,t,n){let{value:r}=e;if(hd(r)){let i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return Ir(e)}var U_={identify:hd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>W1(e,2,2,n),stringify:e=>_y(e,2,"0b")},H_={identify:hd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>W1(e,1,8,n),stringify:e=>_y(e,8,"0")},M_={identify:hd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>W1(e,0,10,n),stringify:Ir},q_={identify:hd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>W1(e,2,16,n),stringify:e=>_y(e,16,"0x")};var nce=B(x(),1);var af=class e extends Cn{constructor(t){super(t),this.tag=e.tag}add(t){let n;It(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new mn(t.key,null):n=new mn(t,null),Fu(this.items,n.key)||this.items.push(n)}get(t,n){let r=Fu(this.items,t);return!n&&It(r)?dt(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Fu(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new mn(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){let{replacer:i}=r,o=new this(t);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(sf(s,null,r));return o}};af.tag="tag:yaml.org,2002:set";var dd={collection:"map",identify:e=>e instanceof Set,nodeClass:af,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>af.from(e,t,n),resolve(e,t){if($i(e)){if(e.hasAllNullValues(!0))return Object.assign(new af,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};var ice=B(x(),1);function Dy(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=s=>t?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function j_(e){let{value:t}=e,n=s=>s;if(typeof t=="bigint")n=s=>BigInt(s);else if(isNaN(t)||!isFinite(t))return Ir(e);let r="";t<0&&(r="-",t*=n(-1));let i=n(60),o=[t%i];return t<60?o.unshift(0):(t=(t-o[0])/i,o.unshift(t%i),t>=60&&(t=(t-o[0])/i,o.unshift(t))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Y1={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:n})=>Dy(e,n),stringify:j_},X1={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=>Dy(e,!1),stringify:j_},uf={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(uf.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=t.map(Number),u=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,o||0,s||0,a||0,u),h=t[8];if(h&&h!=="Z"){let m=Dy(h,!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 Fy=[Pi,ki,Bu,Tc,Sy,Cy,U_,H_,M_,q_,O_,N_,L_,cd,xi,fd,ld,dd,Y1,X1,uf];var K_=new Map([["core",P_],["failsafe",[Pi,ki,Bu]],["json",T_],["yaml11",Fy],["yaml-1.1",Fy]]),V_={binary:cd,bool:ud,float:q1,floatExp:M1,floatNaN:H1,floatTime:X1,int:V1,intHex:G1,intOct:K1,intTime:Y1,map:Pi,merge:xi,null:Tc,omap:fd,pairs:ld,seq:ki,set:dd,timestamp:uf},G_={"tag:yaml.org,2002:binary":cd,"tag:yaml.org,2002:merge":xi,"tag:yaml.org,2002:omap":fd,"tag:yaml.org,2002:pairs":ld,"tag:yaml.org,2002:set":dd,"tag:yaml.org,2002:timestamp":uf};function Z1(e,t,n){let r=K_.get(t);if(r&&!e)return n&&!r.includes(xi)?r.concat(xi):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let o=Array.from(K_.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)i=i.concat(o);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(xi)),i.reduce((o,s)=>{let a=typeof s=="string"?V_[s]:s;if(!a){let u=JSON.stringify(s),l=Object.keys(V_).map(h=>JSON.stringify(h)).join(", ");throw new Error(`Unknown custom tag ${u}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}var gq=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,pd=class e{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?Z1(t,"compat"):t?Z1(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?G_:{},this.tags=Z1(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Bi,{value:Pi}),Object.defineProperty(this,ks,{value:Bu}),Object.defineProperty(this,ha,{value:ki}),this.sortMapEntries=typeof s=="function"?s:s===!0?gq:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};var Xce=B(x(),1);function z_(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let u=e.directives.toString(e);u?(n.push(u),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let i=k1(e,t),{commentString:o}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let u=o(e.commentBefore);n.unshift(ti(u,""))}let s=!1,a=null;if(e.contents){if(Pt(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let h=o(e.contents.commentBefore);n.push(ti(h,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}let u=a?void 0:()=>s=!0,l=ma(e.contents,i,()=>a=null,u);a&&(l+=wo(l,"",o(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(ma(e.contents,i));if(e.directives?.docEnd)if(e.comment){let u=o(e.comment);u.includes(`
`)?(n.push("..."),n.push(ti(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&s&&(u=u.replace(/^\n+/,"")),u&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(ti(o(u),"")))}return n.join(`
`)+`
`}var ga=class e{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Vr,{value:S1});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new vo({version:s}),this.setSchema(s,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){let t=Object.create(e.prototype,{[Vr]:{value:S1}});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=Pt(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){cf(this.contents)&&this.contents.add(t)}addIn(t,n){cf(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let r=dy(this);t.anchor=!n||r.has(n)?py(n||"a",r):n}return new da(t.anchor)}createNode(t,n,r){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){let y=E=>typeof E=="number"||E instanceof String||E instanceof Number,w=n.filter(y).map(String);w.length>0&&(n=n.concat(w)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:u,onTagObj:l,tag:h}=r??{},{onAnchor:m,setAnchors:p,sourceObjects:d}=__(this,s||"a"),v={aliasDuplicateObjects:o??!0,keepUndefined:u??!1,onAnchor:m,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:d},g=pa(t,h,v);return a&&Mt(g)&&(g.flow=!0),p(),g}createPair(t,n,r={}){let i=this.createNode(t,null,r),o=this.createNode(n,null,r);return new mn(i,o)}delete(t){return cf(this.contents)?this.contents.delete(t):!1}deleteIn(t){return nf(t)?this.contents==null?!1:(this.contents=null,!0):cf(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Mt(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return nf(t)?!n&&dt(this.contents)?this.contents.value:this.contents:Mt(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Mt(this.contents)?this.contents.has(t):!1}hasIn(t){return nf(t)?this.contents!==void 0:Mt(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=rd(this.schema,[t],n):cf(this.contents)&&this.contents.set(t,n)}setIn(t,n){nf(t)?this.contents=n:this.contents==null?this.contents=rd(this.schema,Array.from(t),n):cf(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new vo({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new vo({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new pd(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},u=Hn(this.contents,n??"",a);if(typeof o=="function")for(let{count:l,res:h}of a.anchors.values())o(h,l);return typeof s=="function"?_u(s,{"":u},"",u):u}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return z_(this,t)}};function cf(e){if(Mt(e))return!0;throw new Error("Expected a YAML collection as document contents")}var fle=B(x(),1),md=class extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}},Ti=class extends md{constructor(t,n,r){super("YAMLParseError",t,n,r)}},gd=class extends md{constructor(t,n,r){super("YAMLWarning",t,n,r)}},By=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>t.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(s.substring(0,o))){let a=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
`),s=a+s}if(/[^ ]/.test(s)){let a=1,u=n.linePos[1];u?.line===r&&u.col>i&&(a=Math.max(1,Math.min(u.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);n.message+=`:
${s}
${l}
`}};var $fe=B(x(),1);var Cfe=B(x(),1);var tfe=B(x(),1);var Ile=B(x(),1);var dle=B(x(),1);function yo(e,{flow:t,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let u=!1,l=a,h=a,m="",p="",d=!1,v=!1,g=null,y=null,w=null,E=null,C=null,_=null,F=null;for(let S of e)switch(v&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&o(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),g&&(l&&S.type!=="comment"&&S.type!=="newline"&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),S.type){case"space":!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&S.source.includes(" ")&&(g=S),h=!0;break;case"comment":{h||o(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let I=S.source.substring(1)||" ";m?m+=p+I:m=I,p="",l=!1;break}case"newline":l?m?m+=S.source:(!_||n!=="seq-item-ind")&&(u=!0):p+=S.source,l=!0,d=!0,(y||w)&&(E=S),h=!0;break;case"anchor":y&&o(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&o(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=S,F??(F=S.offset),l=!1,h=!1,v=!0;break;case"tag":{w&&o(S,"MULTIPLE_TAGS","A node can have at most one tag"),w=S,F??(F=S.offset),l=!1,h=!1,v=!0;break}case n:(y||w)&&o(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),_&&o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${t??"collection"}`),_=S,l=n==="seq-item-ind"||n==="explicit-key-ind",h=!1;break;case"comma":if(t){C&&o(S,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),C=S,l=!1,h=!1;break}default:o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),l=!1,h=!1}let H=e[e.length-1],K=H?H.offset+H.source.length:i;return v&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(l&&g.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:C,found:_,spaceBefore:u,comment:m,hasNewline:d,anchor:y,tag:w,newlineAfterProp:E,end:K,start:F??K}}var mle=B(x(),1);function Iu(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 n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(Iu(t.key)||Iu(t.value))return!0}return!1;default:return!0}}var wle=B(x(),1);function vd(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Iu(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}var ble=B(x(),1);function J1(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||dt(o)&&dt(s)&&o.value===s.value;return t.some(o=>i(o.key,n))}var W_="All mapping items must start at the same column";function Y_({composeNode:e,composeEmptyNode:t},n,r,i,o){let s=o?.nodeClass??Cn,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let u=r.offset,l=null;for(let h of r.items){let{start:m,key:p,sep:d,value:v}=h,g=yo(m,{indicator:"explicit-key-ind",next:p??d?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!0}),y=!g.found;if(y){if(p&&(p.type==="block-seq"?i(u,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&i(u,"BAD_INDENT",W_)),!g.anchor&&!g.tag&&!d){l=g.end,g.comment&&(a.comment?a.comment+=`
`+g.comment:a.comment=g.comment);continue}(g.newlineAfterProp||Iu(p))&&i(p??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else g.found?.indent!==r.indent&&i(u,"BAD_INDENT",W_);n.atKey=!0;let w=g.end,E=p?e(n,p,g,i):t(n,w,m,null,g,i);n.schema.compat&&vd(r.indent,p,i),n.atKey=!1,J1(n,a.items,E)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let C=yo(d??[],{indicator:"map-value-ind",next:v,offset:E.range[2],onError:i,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(u=C.end,C.found){y&&(v?.type==="block-map"&&!C.hasNewline&&i(u,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&g.start<C.found.offset-1024&&i(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=v?e(n,v,C,i):t(n,u,d,null,C,i);n.schema.compat&&vd(r.indent,v,i),u=_.range[2];let F=new mn(E,_);n.options.keepSourceTokens&&(F.srcToken=h),a.items.push(F)}else{y&&i(E.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),C.comment&&(E.comment?E.comment+=`
`+C.comment:E.comment=C.comment);let _=new mn(E);n.options.keepSourceTokens&&(_.srcToken=h),a.items.push(_)}}return l&&l<u&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,u,l??u],a}var Tle=B(x(),1);function X_({composeNode:e,composeEmptyNode:t},n,r,i,o){let s=o?.nodeClass??Br,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=r.offset,l=null;for(let{start:h,value:m}of r.items){let p=yo(h,{indicator:"seq-item-ind",next:m,offset:u,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||m)m?.type==="block-seq"?i(p.end,"BAD_INDENT","All sequence items must start at the same column"):i(u,"MISSING_CHAR","Sequence item without - indicator");else{l=p.end,p.comment&&(a.comment=p.comment);continue}let d=m?e(n,m,p,i):t(n,p.end,h,null,p,i);n.schema.compat&&vd(r.indent,m,i),u=d.range[2],a.items.push(d)}return a.range=[r.offset,u,l??u],a}var Gle=B(x(),1);var Ole=B(x(),1);function Eo(e,t,n,r){let i="";if(e){let o=!1,s="";for(let a of e){let{source:u,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let h=u.substring(1)||" ";i?i+=s+h:i=h,s="";break}case"newline":i&&(s+=u),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=u.length}}return{comment:i,offset:t}}var Iy="Block collections are not allowed within flow collections",$y=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Z_({composeNode:e,composeEmptyNode:t},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",u=o?.nodeClass??(s?Cn:Br),l=new u(n.schema);l.flow=!0;let h=n.atRoot;h&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let m=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let w=r.items[y],{start:E,key:C,sep:_,value:F}=w,H=yo(E,{flow:a,indicator:"explicit-key-ind",next:C??_?.[0],offset:m,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!H.found){if(!H.anchor&&!H.tag&&!_&&!F){y===0&&H.comma?i(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<r.items.length-1&&i(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}!s&&n.options.strict&&Iu(C)&&i(C,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)H.comma&&i(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(H.comma||i(H.start,"MISSING_CHAR",`Missing , between ${a} items`),H.comment){let K="";e:for(let S of E)switch(S.type){case"comma":case"space":break;case"comment":K=S.source.substring(1);break e;default:break e}if(K){let S=l.items[l.items.length-1];It(S)&&(S=S.value??S.key),S.comment?S.comment+=`
`+K:S.comment=K,H.comment=H.comment.substring(K.length+1)}}if(!s&&!_&&!H.found){let K=F?e(n,F,H,i):t(n,H.end,_,null,H,i);l.items.push(K),m=K.range[2],$y(F)&&i(K.range,"BLOCK_IN_FLOW",Iy)}else{n.atKey=!0;let K=H.end,S=C?e(n,C,H,i):t(n,K,E,null,H,i);$y(C)&&i(S.range,"BLOCK_IN_FLOW",Iy),n.atKey=!1;let I=yo(_??[],{flow:a,indicator:"map-value-ind",next:F,offset:S.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(I.found){if(!s&&!H.found&&n.options.strict){if(_)for(let T of _){if(T===I.found)break;if(T.type==="newline"){i(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}H.start<I.found.offset-1024&&i(I.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else F&&("source"in F&&F.source?.[0]===":"?i(F,"MISSING_CHAR",`Missing space after : in ${a}`):i(I.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let q=F?e(n,F,I,i):I.found?t(n,I.end,_,null,I,i):null;q?$y(F)&&i(q.range,"BLOCK_IN_FLOW",Iy):I.comment&&(S.comment?S.comment+=`
`+I.comment:S.comment=I.comment);let L=new mn(S,q);if(n.options.keepSourceTokens&&(L.srcToken=w),s){let T=l;J1(n,T.items,S)&&i(K,"DUPLICATE_KEY","Map keys must be unique"),T.items.push(L)}else{let T=new Cn(n.schema);T.flow=!0,T.items.push(L);let O=(q??S).range;T.range=[S.range[0],O[1],O[2]],l.items.push(T)}m=q?q.range[2]:I.end}}let p=s?"}":"]",[d,...v]=r.end,g=m;if(d?.source===p)g=d.offset+d.source.length;else{let y=a[0].toUpperCase()+a.substring(1),w=h?`${y} must end with a ${p}`:`${y} in block collection must be sufficiently indented and end with a ${p}`;i(m,h?"MISSING_CHAR":"BAD_INDENT",w),d&&d.source.length!==1&&v.unshift(d)}if(v.length>0){let y=Eo(v,g,n.options.strict,i);y.comment&&(l.comment?l.comment+=`
`+y.comment:l.comment=y.comment),l.range=[r.offset,g,y.offset]}else l.range=[r.offset,g,g];return l}function xy(e,t,n,r,i,o){let s=n.type==="block-map"?Y_(e,t,n,r,o):n.type==="block-seq"?X_(e,t,n,r,o):Z_(e,t,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function J_(e,t,n,r,i){let o=r.tag,s=o?t.directives.tagName(o.source,p=>i(o,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){let{anchor:p,newlineAfterProp:d}=r,v=p&&o?p.offset>o.offset?p:o:p??o;v&&(!d||d.offset<v.offset)&&i(v,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===Cn.tagName&&a==="map"||s===Br.tagName&&a==="seq")return xy(e,t,n,i,s);let u=t.schema.tags.find(p=>p.tag===s&&p.collection===a);if(!u){let p=t.schema.knownTags[s];if(p?.collection===a)t.schema.tags.push(Object.assign({},p,{default:!1})),u=p;else return p?i(o,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),xy(e,t,n,i,s)}let l=xy(e,t,n,i,s,u),h=u.resolve?.(l,p=>i(o,"TAG_RESOLVE_FAILED",p),t.options)??l,m=Pt(h)?h:new Ke(h);return m.range=l.range,m.tag=s,u?.format&&(m.format=u.format),m}var pfe=B(x(),1);var sfe=B(x(),1);function Py(e,t,n){let r=t.offset,i=vq(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?Ke.BLOCK_FOLDED:Ke.BLOCK_LITERAL,s=t.source?wq(t.source):[],a=s.length;for(let g=s.length-1;g>=0;--g){let y=s[g][1];if(y===""||y==="\r")a=g;else break}if(a===0){let g=i.chomp==="+"&&s.length>0?`
`.repeat(Math.max(1,s.length-1)):"",y=r+i.length;return t.source&&(y+=t.source.length),{value:g,type:o,comment:i.comment,range:[r,y,y]}}let u=t.indent+i.indent,l=t.offset+i.length,h=0;for(let g=0;g<a;++g){let[y,w]=s[g];if(w===""||w==="\r")i.indent===0&&y.length>u&&(u=y.length);else{y.length<u&&n(l+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(u=y.length),h=g,u===0&&!e.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=y.length+w.length+1}for(let g=s.length-1;g>=a;--g)s[g][0].length>u&&(a=g+1);let m="",p="",d=!1;for(let g=0;g<h;++g)m+=s[g][0].slice(u)+`
`;for(let g=h;g<a;++g){let[y,w]=s[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 _=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-w.length-(E?2:1),"BAD_INDENT",_),y=""}o===Ke.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(i.chomp){case"-":break;case"+":for(let g=a;g<s.length;++g)m+=`
`+s[g][0].slice(u);m[m.length-1]!==`
`&&(m+=`
`);break;default:m+=`
`}let v=r+i.length+t.source.length;return{value:m,type:o,comment:i.comment,range:[r,v,v]}}function vq({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],o=i[0],s=0,a="",u=-1;for(let p=1;p<i.length;++p){let d=i[p];if(!a&&(d==="-"||d==="+"))a=d;else{let v=Number(d);!s&&v?s=v:u===-1&&(u=e+p)}}u!==-1&&r(u,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,h="",m=i.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":n&&!l&&r(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=d.source.length,h=d.source.substring(1);break;case"error":r(d,"UNEXPECTED_TOKEN",d.message),m+=d.source.length;break;default:{let v=`Unexpected token in block scalar header: ${d.type}`;r(d,"UNEXPECTED_TOKEN",v);let g=d.source;g&&typeof g=="string"&&(m+=g.length)}}}return{mode:o,indent:s,chomp:a,comment:h,length:m}}function wq(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<t.length;s+=2)o.push([t[s],t[s+1]]);return o}var ufe=B(x(),1);function ky(e,t,n){let{offset:r,type:i,source:o,end:s}=e,a,u,l=(p,d,v)=>n(r+p,d,v);switch(i){case"scalar":a=Ke.PLAIN,u=yq(o,l);break;case"single-quoted-scalar":a=Ke.QUOTE_SINGLE,u=Eq(o,l);break;case"double-quoted-scalar":a=Ke.QUOTE_DOUBLE,u=bq(o,l);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let h=r+o.length,m=Eo(s,h,t,n);return{value:u,type:a,comment:m.comment,range:[r,h,m.offset]}}function yq(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Q_(e)}function Eq(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Q_(e.slice(1,-1)).replace(/''/g,"'")}function Q_(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],o=" ",s=t.lastIndex;for(n.lastIndex=s;r=n.exec(e);)r[1]===""?o===`
`?i+=o:o=`
`:(i+=o+r[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,r=a.exec(e),i+o+(r?.[1]??"")}function bq(e,t){let n="";for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i==="\r"&&e[r+1]===`
`))if(i===`
`){let{fold:o,offset:s}=Aq(e,r);n+=o,r=s}else if(i==="\\"){let o=e[++r],s=Sq[o];if(s)n+=s;else if(o===`
`)for(o=e[r+1];o===" "||o===" ";)o=e[++r+1];else if(o==="\r"&&e[r+1]===`
`)for(o=e[++r+1];o===" "||o===" ";)o=e[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=Cq(e,r+1,a,t),r+=a}else{let a=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let o=r,s=e[r+1];for(;s===" "||s===" ";)s=e[++r+1];s!==`
`&&!(s==="\r"&&e[r+2]===`
`)&&(n+=r>o?e.slice(o,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function Aq(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===`
`||r==="\r")&&!(r==="\r"&&e[t+2]!==`
`);)r===`
`&&(n+=`
`),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}var Sq={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Cq(e,t,n,r){let i=e.substr(t,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Ty(e,t,n,r){let{value:i,type:o,comment:s,range:a}=t.type==="block-scalar"?Py(e,t,r):ky(t,e.options.strict,r),u=n?e.directives.tagName(n.source,m=>r(n,"TAG_RESOLVE_FAILED",m)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[ks]:u?l=_q(e.schema,i,u,n,r):t.type==="scalar"?l=Dq(e,i,t,r):l=e.schema[ks];let h;try{let m=l.resolve(i,p=>r(n??t,"TAG_RESOLVE_FAILED",p),e.options);h=dt(m)?m:new Ke(m)}catch(m){let p=m instanceof Error?m.message:String(m);r(n??t,"TAG_RESOLVE_FAILED",p),h=new Ke(i)}return h.range=a,h.source=i,o&&(h.type=o),u&&(h.tag=u),l.format&&(h.format=l.format),s&&(h.comment=s),h}function _q(e,t,n,r,i){if(n==="!")return e[ks];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let s=e.knownTags[n];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[ks])}function Dq({atKey:e,directives:t,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(r))||n[ks];if(n.compat){let a=n.compat.find(u=>u.default&&u.test?.test(r))??n[ks];if(s.tag!==a.tag){let u=t.tagString(s.tag),l=t.tagString(a.tag),h=`Value may be parsed as either ${u} or ${l}`;o(i,"TAG_RESOLVE_FAILED",h,!0)}}return s}var gfe=B(x(),1);function e8(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++r];i?.type==="space";)e+=i.source.length,i=t[++r];break}}return e}var Fq={composeNode:Ry,composeEmptyNode:Q1};function Ry(e,t,n,r){let i=e.atKey,{spaceBefore:o,comment:s,anchor:a,tag:u}=n,l,h=!0;switch(t.type){case"alias":l=Bq(e,t,r),(a||u)&&r(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=Ty(e,t,u,r),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=J_(Fq,e,t,n,r),a&&(l.anchor=a.source.substring(1))}catch(m){let p=m instanceof Error?m.message:String(m);r(t,"RESOURCE_EXHAUSTION",p)}break;default:{let m=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",m),h=!1}}return l??(l=Q1(e,t.offset,void 0,null,n,r)),a&&l.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!dt(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(u??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(t.type==="scalar"&&t.source===""?l.comment=s:l.commentBefore=s),e.options.keepSourceTokens&&h&&(l.srcToken=t),l}function Q1(e,t,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:u},l){let h={type:"scalar",offset:e8(t,n,r),indent:-1,source:""},m=Ty(e,h,a,l);return s&&(m.anchor=s.source.substring(1),m.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(m.spaceBefore=!0),o&&(m.comment=o,m.range[2]=u),m}function Bq({options:e},{offset:t,source:n,end:r},i){let o=new da(n.substring(1));o.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=t+n.length,a=Eo(r,s,e.strict,i);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}function t8(e,t,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:t},e),u=new ga(void 0,a),l={atKey:!1,atRoot:!0,directives:u.directives,options:u.options,schema:u.schema},h=yo(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});h.found&&(u.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!h.hasNewline&&s(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),u.contents=i?Ry(l,i,h,s):Q1(l,h.end,r,null,h,s);let m=u.contents.range[2],p=Eo(o,m,!1,s);return p.comment&&(u.comment=p.comment),u.range=[n,m,p.offset],u}function wd(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:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function n8(e){let t="",n=!1,r=!1;for(let i=0;i<e.length;++i){let o=e[i];switch(o[0]){case"#":t+=(t===""?"":r?`
`:`
`)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var yd=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=wd(n);o?this.warnings.push(new gd(s,r,i)):this.errors.push(new Ti(s,r,i))},this.directives=new vo({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:r,afterEmptyLine:i}=n8(this.prelude);if(r){let o=t.contents;if(n)t.comment=t.comment?`${t.comment}
${r}`:r;else if(i||t.directives.docStart||!o)t.commentBefore=r;else if(Mt(o)&&!o.flow&&o.items.length>0){let s=o.items[0];It(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
${a}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
${s}`:r}}if(n){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:n8(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,r=-1){for(let i of t)yield*this.next(i);yield*this.end(n,r)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(n,r,i)=>{let o=wd(t);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=t8(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Ti(wd(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Ti(wd(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=Eo(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Ti(wd(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),i=new ga(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};var Qfe=B(x(),1);var Kfe=B(x(),1);var Gfe=B(x(),1);var Wfe=B(x(),1),Oy=Symbol("break visit"),Iq=Symbol("skip children"),r8=Symbol("remove item");function Rc(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),s8(Object.freeze([]),e,t)}Rc.BREAK=Oy;Rc.SKIP=Iq;Rc.REMOVE=r8;Rc.itemAtPath=(e,t)=>{let n=e;for(let[r,i]of t){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};Rc.parentCollection=(e,t)=>{let n=Rc.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function s8(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=t[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=s8(Object.freeze(e.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Oy)return Oy;a===r8&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}var Ny="\uFEFF",Ly="",Uy="",em="";function i8(e){switch(e){case Ny:return"byte-order-mark";case Ly:return"doc-mode";case Uy:return"flow-error-end";case em: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 ihe=B(x(),1);function Ri(e){switch(e){case void 0:case" ":case`
`:case"\r":case" ":return!0;default:return!1}}var o8=new Set("0123456789ABCDEFabcdef"),xq=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),tm=new Set(",[]{}"),Pq=new Set(` ,[]{}
\r `),Hy=e=>!e||Pq.has(e),Ed=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,n=!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=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
`?!0:n==="\r"?this.buffer[t+1]===`
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){let i=this.buffer[r+t+1];if(i===`
`||!i&&!this.atEnd)return t+r+1}return n===`
`||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&Ri(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]===Ny&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,r=t.indexOf("#");for(;r!==-1;){let o=t[r-1];if(o===" "||o===" "){n=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let o=t[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield Ly,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 n=this.peek(3);if((n==="---"||n==="...")&&Ri(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ri(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Ri(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);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(Hy),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&Ri(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Uy,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.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(Hy),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||Ri(s)||s===",")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),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
`,o)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Ri(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":n+=1;break;case`
`:t=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n: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 i=t+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
`;)r=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let o=t-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
`&&o>=this.pos&&o+1+n>a)t=o;else break}while(!0);return yield em,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(Ri(o)||t&&tm.has(o))break;n=r}else if(Ri(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
`?(r+=1,i=`
`,o=this.buffer[r+1]):n=r),o==="#"||t&&tm.has(o))break;if(i===`
`){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(t&&tm.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield em,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(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(Hy),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Ri(r)||n&&tm.has(r)){n?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,n=this.buffer[t];for(;!Ri(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(xq.has(n))n=this.buffer[++t];else if(n==="%"&&o8.has(this.buffer[t+1])&&o8.has(this.buffer[t+2]))n=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 n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};var ahe=B(x(),1),bd=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<t?n=o+1:r=o}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let i=this.lineStarts[n-1];return{line:n,col:t-i+1}}}};var fhe=B(x(),1);function $u(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function a8(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 c8(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 nm(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 lf(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 rm(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function u8(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!$u(t.start,"explicit-key-ind")&&!$u(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,c8(t.value)?t.value.end?rm(t.value.end,t.sep):t.value.end=t.sep:rm(t.start,t.sep),delete t.sep)}var Ad=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 Ed,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,n))yield*this.next(r);n||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=i8(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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 r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,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 n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&u8(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&a8(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.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":{a8(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 n=this.startBlockValue(t);n?this.stack.push(n):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 n=nm(this.peek(2)),r=lf(n),i;t.end?(i=t.end,i.push(this.sourceToken),delete t.end):i=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:i}]};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 n=this.source.indexOf(`
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){rm(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let u=n.sep[a];switch(u.type){case"newline":s.push(a);break;case"space":break;case"comment":u.indent>t.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.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(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if($u(n.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(c8(n.key)&&!$u(n.sep,"newline")){let s=lf(n.start),a=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:u}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if($u(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=lf(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:o,key:null,sep:[this.sourceToken]}):$u(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||n.value?(t.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(t);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!$u(n.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 r&&t.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){rm(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||$u(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=nm(r),o=lf(i);u8(t);let s=t.end.splice(1,t.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
`,n)+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 n=nm(t),r=lf(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=nm(t),r=lf(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.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())}}};var Ehe=B(x(),1);function kq(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new bd||null,prettyErrors:t}}function Sd(e,t={}){let{lineCounter:n,prettyErrors:r}=kq(t),i=new Ad(n?.addNewLine),o=new yd(t),s=null;for(let a of o.compose(i.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Ti(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(By(e,n)),s.warnings.forEach(By(e,n))),s}function My(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let i=Sd(e,n);if(!i)return null;if(i.warnings.forEach(o=>T1(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function qy(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}return Ii(e)&&!r?e.toString(n):new ga(e,r,n).toString(n)}var Rq={logLevel:"error",merge:!0};function f8(e,t,...n){try{return e(t,...n)}catch{return e(p8(e(t.replace(/!<str>\s*/g,"__SubStoreJSYAMLString__"),...n)).replace(/__SubStoreJSYAMLString__/g,""),...n)}}function sm(e){return JSON.parse(JSON.stringify(e))}function Oq(e){return{...Rq,...e||{}}}function Nq(e={}){let{forceQuotes:t,lineWidth:n,noArrayIndent:r,noRefs:i,quotingType:o,sortKeys:s,...a}=e||{},u={...a};return typeof n=="number"&&(u.lineWidth=n<=0?0:n),typeof r=="boolean"&&(u.indentSeq=!r),typeof i=="boolean"&&(u.aliasDuplicateObjects=!i),typeof s<"u"&&(u.sortMapEntries=s),o==="'"?u.singleQuote=!0:o==='"'&&(u.singleQuote=!1),t&&(u.defaultStringType=o==="'"?"QUOTE_SINGLE":"QUOTE_DOUBLE"),u}function h8(e,t){return My(e,Oq(t))}function d8(e,t){return qy(e,Nq(t))}function ff(e,...t){return f8(h8,sm(e),...t)}function Lq(e,...t){return f8(h8,sm(e),...t)}function l8(e,...t){return d8(sm(e),...t)}function p8(e,...t){return d8(sm(e),...t)}var Rs={safeLoad:ff,load:Lq,safeDump:l8,dump:p8,parse:ff,stringify:l8};var m8={merge:!0,logLevel:"error"};function g8(e){return typeof e=="string"&&e.includes("short-id")}function im(e){if(!g8(e))return e;try{let t=Sd(e,m8);return v8(e,t)}catch{return e}}function v8(e,t,n){let r=new Map,i=new Map;ds(t,{Node(p,d){ls(d)?i.set(d.range[0],r.get(d.source)):d.anchor&&r.set(d.anchor,d)}});let o=p=>ls(p)?i.get(p.range[0]):p,s=p=>dt(p)&&typeof p.value!="string"&&p.value!==null&&!p.tag&&p.source,a=new Set;ds(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)ds(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(Ts(d))for(let v of d.items)u.add(v);else s(d)&&l.set(d,JSON.stringify(d.source))}if(l.size===0||(n===void 0&&(n=t.errors.length>0?ff(e):t.toJS()),![n?.proxies,n?.listeners].some(p=>Array.isArray(p)&&p.length>0)))return e;let h=[],m=0;for(let[p,d]of[...l].sort(([v],[g])=>v.range[0]-g.range[0]))h.push(e.slice(m,p.range[0]),d),m=p.range[1];return h.join("")+e.slice(m)}function Uq(){return{name:"HTML",test:r=>/^<!DOCTYPE html>/.test(r),parse:()=>""}}function Hq(){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(i){return bt.isValid(i)&&!/^\w+:\/\/\w+/im.test(i)&&t.some(o=>i.indexOf(o)!==-1)},parse:function(i){let o=bt.decode(i);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(o)?o:(J.error("Base64 Pre-processor error: decoded line does not start with protocol"),i)}}}function Mq(){return{name:"Fallback Base64 Pre-processor",test:function(r){return bt.isValid(r)},parse:function(r){let i=bt.decode(r);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(i)?i:(J.error("Fallback Base64 Pre-processor error: decoded line does not start with protocol"),r)}}}function qq(){let e="Clash Pre-processor",t=function(i,o){if(o&&!/proxies/.test(i))return!1;let s,a;if(g8(i))try{s=Sd(i,m8),s.errors.length===0&&(a=s.toJS())}catch{s=void 0}if(a===void 0&&(a=ff(i)),o&&!Array.isArray(a.proxies)&&!Array.isArray(a["proxy-groups"]))return!1;if(s){let u=v8(i,s,a);if(u!==i)return{normalized:u}}return{content:a}};return{name:e,test:i=>t(i,!0),parse:function(i,o,s=t(i)){let{proxies:a}=s.normalized===void 0?s.content:ff(s.normalized);return(o?`proxies:
`:"")+(Array.isArray(a)?a:[]).map(u=>`${o?" - ":""}${JSON.stringify(u)}
`).join("")}}}function jq(){return{name:"SSD Pre-processor",test:function(r){return r.indexOf("ssd://")===0},parse:function(r){let i=[],o=JSON.parse(bt.decode(r.split("ssd://")[1])),s=o.port,a=o.encryption,u=o.password,l=o.servers;for(let h=0;h<l.length;h++){let m=l[h];a=m.encryption?m.encryption:a,u=m.password?m.password:u;let p=bt.encode(a+":"+u),d=m.server;s=m.port?m.port:s;let v=m.remarks?m.remarks:h,g=m.plugin_options?"/?plugin="+encodeURIComponent(m.plugin+";"+m.plugin_options):"";i[h]="ss://"+p+"@"+d+":"+s+g+"#"+v}return i.join(`
`)}}}function Kq(){return{name:"Full Config Preprocessor",test:function(r){return/^(\[server_local\]|\[Proxy\])/gm.test(r)},parse:function(r){return r.match(/^\[server_local|Proxy\]([\s\S]+?)^\[.+?\](\r?\n|$)/im)?.[1]||r}}}var om=[Uq(),qq(),Hq(),jq(),Kq(),Mq()];var wEe=B(x());var m2=B(wa());var ade=B(x()),pE=B(cD());function mG(e){let t=pE.default.pemtohex(e);return pE.default.KJUR.crypto.Util.hashHex(t,"sha256").match(/.{2}/g).join(":").toUpperCase()}var lD={generateFingerprint:mG};var Hme=B(x());var Rme=B(x(),1);var hde=B(x(),1);var cde=B(x(),1);function mE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Dn(e,t=""){if(typeof e!="number"){let n=t&&`"${t}" `;throw new TypeError(`${n}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw new RangeError(`${n}expected integer >= 0, got ${e}`)}}function ir(e,t,n=""){let r=mE(e),i=e?.length,o=t!==void 0;if(!r||o&&i!==t){let s=n&&`"${n}" `,a=o?` of length ${t}`:"",u=r?`length=${i}`:`type=${typeof e}`,l=s+"expected Uint8Array"+a+", got "+u;throw r?new RangeError(l):new TypeError(l)}return e}function Ca(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Dn(e.outputLen),Dn(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Sf(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 Cm(e,t){ir(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new RangeError('"digestInto() output" expected to be of length >='+n)}function _m(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function zr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Cf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ni(e,t){return e<<32-t|e>>>t}function Tt(e,t){return e<<t|e>>>32-t>>>0}var gG=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function vG(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function wG(e){for(let t=0;t<e.length;t++)e[t]=vG(e[t]);return e}var gE=gG?e=>e:wG,hD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",yG=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Dm(e){if(ir(e),hD)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=yG[e[n]];return t}var Sa={_0:48,_9:57,A:65,F:70,a:97,f:102};function fD(e){if(e>=Sa._0&&e<=Sa._9)return e-Sa._0;if(e>=Sa.A&&e<=Sa.F)return e-(Sa.A-10);if(e>=Sa.a&&e<=Sa.f)return e-(Sa.a-10)}function xd(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(hD)try{return Uint8Array.fromHex(e)}catch(i){throw i instanceof SyntaxError?new RangeError(i.message):i}let t=e.length,n=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){let s=fD(e.charCodeAt(o)),a=fD(e.charCodeAt(o+1));if(s===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)}r[i]=s*16+a}return r}function EG(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function vE(e,t=""){return typeof e=="string"?EG(e):ir(e,void 0,t)}function wE(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];ir(i),t+=i.length}let n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){let o=e[r];n.set(o,i),i+=o.length}return n}function Fm(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 yE(e,t={}){let n=(i,o)=>e(o).update(i).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=i=>e(i),Object.assign(n,t),Object.freeze(n)}function Tu(e=32){Dn(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 EE=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Bm=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,n){if(Ca(t),ir(n,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 r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),zr(i)}update(t){return Sf(this),this.iHash.update(t),this}digestInto(t){Sf(this),Cm(t,this),this.finished=!0;let n=t.subarray(0,this.outputLen);this.iHash.digestInto(n),this.oHash.update(n),this.oHash.digestInto(n),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:n,iHash:r,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=s,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Co=(()=>{let e=((t,n,r)=>new Bm(t,n).update(r).digest());return e.create=(t,n)=>new Bm(t,n),e})();var gde=B(x(),1);function Pd(e,t,n){return Ca(e),n===void 0&&(n=new Uint8Array(e.outputLen)),Co(e,n,t)}var bE=Uint8Array.of(0),dD=Uint8Array.of();function AE(e,t,n,r=32){Ca(e),Dn(r,"length"),ir(t,void 0,"prk");let i=e.outputLen;if(t.length<i)throw new Error('"prk" must be at least HashLen octets');if(r>255*i)throw new Error("Length must be <= 255*HashLen");let o=Math.ceil(r/i);n===void 0?n=dD:ir(n,void 0,"info");let s=new Uint8Array(o*i),a=Co.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let h=0;h<o;h++)bE[0]=h+1,u.update(h===0?dD:l).update(n).update(bE).digestInto(l),s.set(l,i*h),a._cloneInto(u);return a.destroy(),u.destroy(),zr(l,bE),s.slice(0,r)}var Ru=(e,t,n,r,i)=>AE(e,Pd(e,t,n),r,i);var Dde=B(x(),1);var yde=B(x(),1);function pD(e,t,n){return e&t^~e&n}function mD(e,t,n){return e&t^e&n^t&n}var kd=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,r,i){this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Cf(this.buffer)}update(t){Sf(this),ir(t);let{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let u=Cf(t);for(;i<=o-s;s+=i)this.process(u,s);continue}r.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Sf(this),Cm(t,this),this.finished=!0;let{buffer:n,view:r,blockLen:i,isLE:o}=this,{pos:s}=this;n[s++]=128,zr(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(r,0),s=0);for(let m=s;m<i;m++)n[m]=0;r.setBigUint64(i-8,BigInt(this.length*8),o),this.process(r,0);let a=Cf(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=u/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)a.setUint32(4*m,h[m],o)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:n,buffer:r,length:i,finished:o,destroyed:s,pos:a}=this;return t.destroyed=s,t.finished=o,t.length=i,t.pos=a,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}},_a=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var or=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var Ede=B(x(),1),Im=BigInt(4294967295),gD=BigInt(32);function bG(e,t=!1){return t?{h:Number(e&Im),l:Number(e>>gD&Im)}:{h:Number(e>>gD&Im)|0,l:Number(e&Im)|0}}function vD(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){let{h:s,l:a}=bG(e[o],t);[r[o],i[o]]=[s,a]}return[r,i]}var SE=(e,t,n)=>e>>>n,CE=(e,t,n)=>e<<32-n|t>>>n,Hc=(e,t,n)=>e>>>n|t<<32-n,Mc=(e,t,n)=>e<<32-n|t>>>n,Td=(e,t,n)=>e<<64-n|t>>>n-32,Rd=(e,t,n)=>e>>>n-32|t<<64-n;function _o(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var wD=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),yD=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,ED=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),bD=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,AD=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),SD=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0;var SG=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]),Ou=new Uint32Array(64),_E=class extends kd{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:n,C:r,D:i,E:o,F:s,G:a,H:u}=this;return[t,n,r,i,o,s,a,u]}set(t,n,r,i,o,s,a,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=u|0}process(t,n){for(let m=0;m<16;m++,n+=4)Ou[m]=t.getUint32(n,!1);for(let m=16;m<64;m++){let p=Ou[m-15],d=Ou[m-2],v=Ni(p,7)^Ni(p,18)^p>>>3,g=Ni(d,17)^Ni(d,19)^d>>>10;Ou[m]=g+Ou[m-7]+v+Ou[m-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:u,G:l,H:h}=this;for(let m=0;m<64;m++){let p=Ni(a,6)^Ni(a,11)^Ni(a,25),d=h+p+pD(a,u,l)+SG[m]+Ou[m]|0,g=(Ni(r,2)^Ni(r,13)^Ni(r,22))+mD(r,i,o)|0;h=l,l=u,u=a,a=s+d|0,s=o,o=i,i=r,r=d+g|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(r,i,o,s,a,u,l,h)}roundClean(){zr(Ou)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),zr(this.buffer)}},DE=class extends _E{A=_a[0]|0;B=_a[1]|0;C=_a[2]|0;D=_a[3]|0;E=_a[4]|0;F=_a[5]|0;G=_a[6]|0;H=_a[7]|0;constructor(){super(32)}};var CD=vD(["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))),CG=CD[0],_G=CD[1],Nu=new Uint32Array(80),Lu=new Uint32Array(80),FE=class extends kd{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:n,Bh:r,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:l,El:h,Fh:m,Fl:p,Gh:d,Gl:v,Hh:g,Hl:y}=this;return[t,n,r,i,o,s,a,u,l,h,m,p,d,v,g,y]}set(t,n,r,i,o,s,a,u,l,h,m,p,d,v,g,y){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=u|0,this.Eh=l|0,this.El=h|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,n){for(let C=0;C<16;C++,n+=4)Nu[C]=t.getUint32(n),Lu[C]=t.getUint32(n+=4);for(let C=16;C<80;C++){let _=Nu[C-15]|0,F=Lu[C-15]|0,H=Hc(_,F,1)^Hc(_,F,8)^SE(_,F,7),K=Mc(_,F,1)^Mc(_,F,8)^CE(_,F,7),S=Nu[C-2]|0,I=Lu[C-2]|0,q=Hc(S,I,19)^Td(S,I,61)^SE(S,I,6),L=Mc(S,I,19)^Rd(S,I,61)^CE(S,I,6),T=ED(K,L,Lu[C-7],Lu[C-16]),O=bD(T,H,q,Nu[C-7],Nu[C-16]);Nu[C]=O|0,Lu[C]=T|0}let{Ah:r,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:h,Eh:m,El:p,Fh:d,Fl:v,Gh:g,Gl:y,Hh:w,Hl:E}=this;for(let C=0;C<80;C++){let _=Hc(m,p,14)^Hc(m,p,18)^Td(m,p,41),F=Mc(m,p,14)^Mc(m,p,18)^Rd(m,p,41),H=m&d^~m&g,K=p&v^~p&y,S=AD(E,F,K,_G[C],Lu[C]),I=SD(S,w,_,H,CG[C],Nu[C]),q=S|0,L=Hc(r,i,28)^Td(r,i,34)^Td(r,i,39),T=Mc(r,i,28)^Rd(r,i,34)^Rd(r,i,39),O=r&o^r&a^o&a,R=i&s^i&u^s&u;w=g|0,E=y|0,g=d|0,y=v|0,d=m|0,v=p|0,{h:m,l:p}=_o(l|0,h|0,I|0,q|0),l=a|0,h=u|0,a=o|0,u=s|0,o=r|0,s=i|0;let N=wD(q,T,R);r=yD(N,I,L,O),i=N|0}({h:r,l:i}=_o(this.Ah|0,this.Al|0,r|0,i|0)),{h:o,l:s}=_o(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=_o(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:h}=_o(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:p}=_o(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=_o(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=_o(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=_o(this.Hh|0,this.Hl|0,w|0,E|0),this.set(r,i,o,s,a,u,l,h,m,p,d,v,g,y,w,E)}roundClean(){zr(Nu,Lu)}destroy(){this.destroyed=!0,zr(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},BE=class extends FE{Ah=or[0]|0;Al=or[1]|0;Bh=or[2]|0;Bl=or[3]|0;Ch=or[4]|0;Cl=or[5]|0;Dh=or[6]|0;Dl=or[7]|0;Eh=or[8]|0;El=or[9]|0;Fh=or[10]|0;Fl=or[11]|0;Gh=or[12]|0;Gl=or[13]|0;Hh=or[14]|0;Hl=or[15]|0;constructor(){super(64)}};var Fn=yE(()=>new DE,EE(1));var $m=yE(()=>new BE,EE(3));var nme=B(x(),1);var Bde=B(x(),1);function PE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function DG(e){if(!PE(e))throw new TypeError("Uint8Array expected")}function BD(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function FG(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function qc(e,t){if(typeof t!="string")throw new TypeError(`${e}: string expected`);return!0}function kE(e){if(typeof e!="number")throw new TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function IE(e){if(!Array.isArray(e))throw new TypeError("array expected")}function Pm(e,t){if(!BD(!0,t))throw new TypeError(`${e}: array of strings expected`)}function ID(e,t){if(!BD(!1,t))throw new TypeError(`${e}: array of numbers expected`)}function TE(...e){let t=o=>o,n=(o,s)=>a=>o(s(a)),r=e.map(o=>o.encode).reduceRight(n,t),i=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:i}}function RE(e){let t=typeof e=="string"?e.split(""):e,n=t.length;Pm("alphabet",t);let r=new Map(t.map((i,o)=>[i,o]));return{encode:i=>(IE(i),i.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:i=>(IE(i),i.map(o=>{qc("alphabet.decode",o);let s=r.get(o);if(s===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return s}))}}function OE(e=""){return qc("join",e),{encode:t=>(Pm("join.decode",t),t.join(e)),decode:t=>(qc("join.decode",t),t.split(e))}}function BG(e,t="="){return kE(e),qc("padding",t),{encode(n){for(Pm("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){Pm("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if((r-1)*e%8===0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,r)}}}var $D=(e,t)=>t===0?e:$D(t,e%t),km=(e,t)=>e+(t-$D(e,t)),xm=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function $E(e,t,n,r){if(IE(e),t<=0||t>32)throw new RangeError(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new RangeError(`convertRadix2: wrong to=${n}`);if(km(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${km(t,n)}`);let i=0,o=0,s=xm[t],a=xm[n]-1,u=[];for(let l of e){if(kE(l),l>=s)throw new Error(`convertRadix2: invalid data word=${l} from=${t}`);if(i=i<<t|l,o+t>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=n;o-=n)u.push((i>>o-n&a)>>>0);let h=xm[o];if(h===void 0)throw new Error("invalid carry");i&=h-1}if(i=i<<n-o&a,!r&&o>=t)throw new Error("Excess padding");if(!r&&i>0)throw new Error(`Non-zero padding: ${i}`);return r&&o>0&&u.push(i>>>0),u}function NE(e,t=!1){if(kE(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(km(8,e)>32||km(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:n=>{if(!PE(n))throw new TypeError("radix2.encode input should be Uint8Array");return $E(Array.from(n),8,e,!t)},decode:n=>(ID("radix2.decode",n),Uint8Array.from($E(n,e,8,t)))}}function _D(e){return FG(e),function(...t){try{return e.apply(null,t)}catch{}}}var IG=typeof Uint8Array.from([]).toBase64=="function"&&typeof Uint8Array.fromBase64=="function",$G=/[\t\n\f\r ]/,xG=(e,t)=>{qc("base64",e);let n=t?"base64url":"base64";if(e.length>0&&$G.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:n,lastChunkHandling:"strict"})},LE=Object.freeze(IG?{encode(e){return DG(e),e.toBase64()},decode(e){return xG(e,!1)}}:TE(NE(6),RE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),BG(6),OE(""))),Pr=Object.freeze(TE(NE(6),RE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),OE("")));var xE=TE(RE("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),OE("")),DD=[996825010,642813549,513874426,1027748829,705979059];function Od(e){let t=e>>25,n=(e&33554431)<<5;for(let r=0;r<DD.length;r++)(t>>r&1)===1&&(n^=DD[r]);return n}function FD(e,t,n=1){let r=e.length,i=1;for(let o=0;o<r;o++){let s=e.charCodeAt(o);if(s<33||s>126)throw new Error(`Invalid prefix (${e})`);i=Od(i)^s>>5}i=Od(i);for(let o=0;o<r;o++)i=Od(i)^e.charCodeAt(o)&31;for(let o of t)i=Od(i)^o;for(let o=0;o<6;o++)i=Od(i);return i^=n,xE.encode($E([i%xm[30]],30,5,!1))}function PG(e){let t=e==="bech32"?1:734539939,n=NE(5),r=n.decode,i=n.encode,o=_D(r);function s(m,p,d=90){qc("bech32.encode prefix",m),PE(p)&&(p=Array.from(p)),ID("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=FD(y,p,t);return`${y}1${xE.encode(p)}${w}`}function a(m,p=90){qc("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=xE.decode(w).slice(0,-6),C=FD(y,E,t);if(!w.endsWith(C))throw new Error(`Invalid checksum in ${m}: expected "${C}"`);return{prefix:y,words:E}}let u=_D(a);function l(m){let{prefix:p,words:d}=a(m,!1);return{prefix:p,words:d,bytes:r(d)}}function h(m,p){return s(m,i(p))}return{encode:s,decode:a,encodeFromBytes:h,decodeToBytes:l,decodeUnsafe:u,fromWords:r,fromWordsUnsafe:o,toWords:i}}var si=Object.freeze(PG("bech32"));var Nde=B(x(),1);var Pde=B(x(),1);function TG(e,t,n,r){Ca(e);let i=Fm({dkLen:32,asyncTick:10},r),{c:o,dkLen:s,asyncTick:a}=i;if(Dn(o,"c"),Dn(s,"dkLen"),Dn(a,"asyncTick"),o<1)throw new Error("iterations (c) must be >= 1");if(s<1)throw new Error('"dkLen" must be >= 1');if(s>(2**32-1)*e.outputLen)throw new Error("derived key too long");let u=vE(t,"password"),l=vE(n,"salt"),h=new Uint8Array(s),m=Co.create(e,u),p=m._cloneInto().update(l);return{c:o,dkLen:s,asyncTick:a,DK:h,PRF:m,PRFSalt:p}}function RG(e,t,n,r,i){return e.destroy(),t.destroy(),r&&r.destroy(),zr(i),n}function UE(e,t,n,r){let{c:i,dkLen:o,DK:s,PRF:a,PRFSalt:u}=TG(e,t,n,r),l,h=new Uint8Array(4),m=Cf(h),p=new Uint8Array(a.outputLen);for(let d=1,v=0;v<o;d++,v+=a.outputLen){let g=s.subarray(v,v+a.outputLen);m.setInt32(0,d,!1),(l=u._cloneInto(l)).update(h).digestInto(p),g.set(p.subarray(0,g.length));for(let y=1;y<i;y++){a._cloneInto(l).update(p).digestInto(p);for(let w=0;w<g.length;w++)g[w]^=p[w]}}return RG(a,u,s,l,p)}function xD(e,t,n,r,i,o){let s=e[t++]^n[r++],a=e[t++]^n[r++],u=e[t++]^n[r++],l=e[t++]^n[r++],h=e[t++]^n[r++],m=e[t++]^n[r++],p=e[t++]^n[r++],d=e[t++]^n[r++],v=e[t++]^n[r++],g=e[t++]^n[r++],y=e[t++]^n[r++],w=e[t++]^n[r++],E=e[t++]^n[r++],C=e[t++]^n[r++],_=e[t++]^n[r++],F=e[t++]^n[r++],H=s,K=a,S=u,I=l,q=h,L=m,T=p,O=d,R=v,N=g,P=y,M=w,Y=E,V=C,X=_,te=F;for(let ae=0;ae<8;ae+=2)q^=Tt(H+Y|0,7),R^=Tt(q+H|0,9),Y^=Tt(R+q|0,13),H^=Tt(Y+R|0,18),N^=Tt(L+K|0,7),V^=Tt(N+L|0,9),K^=Tt(V+N|0,13),L^=Tt(K+V|0,18),X^=Tt(P+T|0,7),S^=Tt(X+P|0,9),T^=Tt(S+X|0,13),P^=Tt(T+S|0,18),I^=Tt(te+M|0,7),O^=Tt(I+te|0,9),M^=Tt(O+I|0,13),te^=Tt(M+O|0,18),K^=Tt(H+I|0,7),S^=Tt(K+H|0,9),I^=Tt(S+K|0,13),H^=Tt(I+S|0,18),T^=Tt(L+q|0,7),O^=Tt(T+L|0,9),q^=Tt(O+T|0,13),L^=Tt(q+O|0,18),M^=Tt(P+N|0,7),R^=Tt(M+P|0,9),N^=Tt(R+M|0,13),P^=Tt(N+R|0,18),Y^=Tt(te+X|0,7),V^=Tt(Y+te|0,9),X^=Tt(V+Y|0,13),te^=Tt(X+V|0,18);i[o++]=s+H|0,i[o++]=a+K|0,i[o++]=u+S|0,i[o++]=l+I|0,i[o++]=h+q|0,i[o++]=m+L|0,i[o++]=p+T|0,i[o++]=d+O|0,i[o++]=v+R|0,i[o++]=g+N|0,i[o++]=y+P|0,i[o++]=w+M|0,i[o++]=E+Y|0,i[o++]=C+V|0,i[o++]=_+X|0,i[o++]=F+te|0}function HE(e,t,n,r,i){let o=r+0,s=r+16*i;for(let a=0;a<16;a++)n[s+a]=e[t+(2*i-1)*16+a];for(let a=0;a<i;a++,o+=16,t+=16)xD(n,s,e,t,n,o),a>0&&(s+=16),xD(n,o,e,t+=16,n,s)}function OG(e,t,n){let r=Fm({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:i,r:o,p:s,dkLen:a,asyncTick:u,maxmem:l,onProgress:h}=r;if(Dn(i,"N"),Dn(o,"r"),Dn(s,"p"),Dn(a,"dkLen"),Dn(u,"asyncTick"),Dn(l,"maxmem"),h!==void 0&&typeof h!="function")throw new Error("progressCb must be a function");let m=128*o,p=m/4,d=Math.pow(2,32);if(i<=1||(i&i-1)!==0||i>d)throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');if(s<1||s>(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*(i+s+1);if(v>l)throw new Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))='+v+", maxmem="+l);let g=UE(Fn,e,t,{c:1,dkLen:m*s}),y=_m(g),w=_m(new Uint8Array(m*i)),E=_m(new Uint8Array(m)),C=()=>{};if(h){let _=2*i*s,F=Math.max(Math.floor(_/1e4),1),H=0;C=()=>{H++,h&&(!(H%F)||H===_)&&h(H/_)}}return{N:i,r:o,p:s,dkLen:a,blockSize32:p,V:w,B32:y,B:g,tmp:E,blockMixCb:C,asyncTick:u}}function NG(e,t,n,r,i){let o=UE(Fn,e,n,{c:1,dkLen:t});return zr(n,r,i),o}function ME(e,t,n){let{N:r,r:i,p:o,dkLen:s,blockSize32:a,V:u,B32:l,B:h,tmp:m,blockMixCb:p}=OG(e,t,n);gE(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<r-1;g++)HE(u,y,u,y+=a,i),p();HE(u,(r-1)*a,l,v,i),p();for(let g=0;g<r;g++){let y=(l[v+a-16]&r-1)>>>0;for(let w=0;w<a;w++)m[w]=l[v+w]^u[y*a+w];HE(m,0,l,v,i),p()}}return gE(l),NG(e,s,h,u,m)}var rpe=B(x(),1);var jde=B(x(),1);var Ude=B(x(),1);function LG(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Tm(e){if(typeof e!="boolean")throw new TypeError(`boolean expected, not ${e}`)}function _f(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 jn(e,t,n=""){let r=LG(e),i=e?.length,o=t!==void 0;if(!r||o&&i!==t){let s=n&&`"${n}" `,a=o?` of length ${t}`:"",u=r?`length=${i}`:`type=${typeof e}`,l=s+"expected Uint8Array"+a+", got "+u;throw r?new RangeError(l):new TypeError(l)}return e}function qE(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 PD(e,t,n=!1){jn(e,void 0,"output");let r=t.outputLen;if(e.length<r)throw new RangeError("digestInto() expects output buffer of length at least "+r);if(n&&!Df(e))throw new Error("invalid output, must be aligned")}function Do(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Li(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function UG(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var jc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,HG=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;var MG=e=>{for(let t=0;t<e.length;t++)e[t]=HG(e[t]);return e},Da=jc?e=>e:MG;function kD(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function TD(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function RD(e,t,n){let r=t,i=n||(()=>[]),o=(a,u)=>r(u,...i(a)).update(a).digest(),s=r(new Uint8Array(e),...i(new Uint8Array(0)));return o.outputLen=s.outputLen,o.blockLen=s.blockLen,o.create=(a,...u)=>r(a,...u),o}var OD=(e,t)=>{function n(r,...i){if(jn(r,void 0,"key"),e.nonceLength!==void 0){let h=i[0];jn(h,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let o=e.tagLength;o&&i[1]!==void 0&&jn(i[1],void 0,"AAD");let s=t(r,...i),a=(h,m)=>{if(m!==void 0){if(h!==2)throw new Error("cipher output not supported");jn(m,void 0,"output")}},u=!1;return{encrypt(h,m){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,jn(h),a(s.encrypt.length,m),s.encrypt(h,m)},decrypt(h,m){if(jn(h),o&&h.length<o)throw new Error('"ciphertext" expected length bigger than tagLength='+o);return a(s.decrypt.length,m),s.decrypt(h,m)}}}return Object.assign(n,e),n};function Nd(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(jn(t,void 0,"output"),t.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(n&&!Df(t))throw new Error("invalid output, must be aligned");return t}function ND(e,t,n){_f(e),_f(t),Tm(n);let r=new Uint8Array(16),i=UG(r);return i.setBigUint64(0,BigInt(t),n),i.setBigUint64(8,BigInt(e),n),r}function Df(e){return e.byteOffset%4===0}function Ff(e){return Uint8Array.from(jn(e))}var UD=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),qG=Da(Do(UD("expand 16-byte k"))),jG=Da(Do(UD("expand 32-byte k")));function Rt(e,t){return e<<t|e>>>32-t}var Ld=64,KG=16,jE=2**32-1,LD=Uint32Array.of();function VG(e,t,n,r,i,o,s,a){let u=i.length,l=new Uint8Array(Ld),h=Do(l),m=jc&&Df(i)&&Df(o),p=m?Do(i):LD,d=m?Do(o):LD;if(!jc){for(let v=0;v<u;s++){if(e(t,n,r,h,s,a),Da(h),s>=jE)throw new Error("arx: counter overflow");let g=Math.min(Ld,u-v);for(let y=0,w;y<g;y++)w=v+y,o[w]=i[w]^l[y];v+=g}return}for(let v=0;v<u;s++){if(e(t,n,r,h,s,a),s>=jE)throw new Error("arx: counter overflow");let g=Math.min(Ld,u-v);if(m&&g===Ld){let y=v/4;if(v%4!==0)throw new Error("arx: invalid block position");for(let w=0,E;w<KG;w++)E=y+w,d[E]=p[E]^h[w];v+=Ld;continue}for(let y=0,w;y<g;y++)w=v+y,o[w]=i[w]^l[y];v+=g}}function HD(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:s}=kD({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return _f(i),_f(s),Tm(o),Tm(n),(a,u,l,h,m=0)=>{jn(a,void 0,"key"),jn(u,void 0,"nonce"),jn(l,void 0,"data");let p=l.length;if(h=Nd(p,h,!1),_f(m),m<0||m>=jE)throw new Error("arx: counter overflow");let d=[],v=a.length,g,y;if(v===32)d.push(g=Ff(a)),y=jG;else if(v===16&&n)g=new Uint8Array(32),g.set(a),g.set(a,16),y=qG,d.push(g);else throw jn(a,32,"arx key"),new Error("invalid key size");(!jc||!Df(u))&&d.push(u=Ff(u));let w=Do(g);if(r){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let _=u.subarray(0,16);if(jc)r(y,w,Do(_),w);else{let F=Da(Uint32Array.from(y));r(F,w,Do(_),w),Li(F),Da(w)}u=u.subarray(16)}else jc||Da(w);let E=16-i;if(E!==u.length)throw new Error(`arx: nonce must be ${E} or 16 bytes`);if(E!==12){let _=new Uint8Array(12);_.set(u,o?0:12-u.length),u=_,d.push(u)}let C=Da(Do(u));try{return VG(e,y,w,C,l,h,m,s),h}finally{Li(...d)}}}var Xde=B(x(),1);function ar(e,t){return e[t++]&255|(e[t++]&255)<<8}var KE=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=Ff(jn(t,32,"key"));let n=ar(t,0),r=ar(t,2),i=ar(t,4),o=ar(t,6),s=ar(t,8),a=ar(t,10),u=ar(t,12),l=ar(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>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 h=0;h<8;h++)this.pad[h]=ar(t,16+2*h)}process(t,n,r=!1){let i=r?0:2048,{h:o,r:s}=this,a=s[0],u=s[1],l=s[2],h=s[3],m=s[4],p=s[5],d=s[6],v=s[7],g=s[8],y=s[9],w=ar(t,n+0),E=ar(t,n+2),C=ar(t,n+4),_=ar(t,n+6),F=ar(t,n+8),H=ar(t,n+10),K=ar(t,n+12),S=ar(t,n+14),I=o[0]+(w&8191),q=o[1]+((w>>>13|E<<3)&8191),L=o[2]+((E>>>10|C<<6)&8191),T=o[3]+((C>>>7|_<<9)&8191),O=o[4]+((_>>>4|F<<12)&8191),R=o[5]+(F>>>1&8191),N=o[6]+((F>>>14|H<<2)&8191),P=o[7]+((H>>>11|K<<5)&8191),M=o[8]+((K>>>8|S<<8)&8191),Y=o[9]+(S>>>5|i),V=0,X=V+I*a+q*(5*y)+L*(5*g)+T*(5*v)+O*(5*d);V=X>>>13,X&=8191,X+=R*(5*p)+N*(5*m)+P*(5*h)+M*(5*l)+Y*(5*u),V+=X>>>13,X&=8191;let te=V+I*u+q*a+L*(5*y)+T*(5*g)+O*(5*v);V=te>>>13,te&=8191,te+=R*(5*d)+N*(5*p)+P*(5*m)+M*(5*h)+Y*(5*l),V+=te>>>13,te&=8191;let ae=V+I*l+q*u+L*a+T*(5*y)+O*(5*g);V=ae>>>13,ae&=8191,ae+=R*(5*v)+N*(5*d)+P*(5*p)+M*(5*m)+Y*(5*h),V+=ae>>>13,ae&=8191;let me=V+I*h+q*l+L*u+T*a+O*(5*y);V=me>>>13,me&=8191,me+=R*(5*g)+N*(5*v)+P*(5*d)+M*(5*p)+Y*(5*m),V+=me>>>13,me&=8191;let he=V+I*m+q*h+L*l+T*u+O*a;V=he>>>13,he&=8191,he+=R*(5*y)+N*(5*g)+P*(5*v)+M*(5*d)+Y*(5*p),V+=he>>>13,he&=8191;let De=V+I*p+q*m+L*h+T*l+O*u;V=De>>>13,De&=8191,De+=R*a+N*(5*y)+P*(5*g)+M*(5*v)+Y*(5*d),V+=De>>>13,De&=8191;let Pe=V+I*d+q*p+L*m+T*h+O*l;V=Pe>>>13,Pe&=8191,Pe+=R*u+N*a+P*(5*y)+M*(5*g)+Y*(5*v),V+=Pe>>>13,Pe&=8191;let Ie=V+I*v+q*d+L*p+T*m+O*h;V=Ie>>>13,Ie&=8191,Ie+=R*l+N*u+P*a+M*(5*y)+Y*(5*g),V+=Ie>>>13,Ie&=8191;let se=V+I*g+q*v+L*d+T*p+O*m;V=se>>>13,se&=8191,se+=R*h+N*l+P*u+M*a+Y*(5*y),V+=se>>>13,se&=8191;let pe=V+I*y+q*g+L*v+T*d+O*p;V=pe>>>13,pe&=8191,pe+=R*m+N*h+P*l+M*u+Y*a,V+=pe>>>13,pe&=8191,V=(V<<2)+V|0,V=V+X|0,X=V&8191,V=V>>>13,te+=V,o[0]=X,o[1]=te,o[2]=ae,o[3]=me,o[4]=he,o[5]=De,o[6]=Pe,o[7]=Ie,o[8]=se,o[9]=pe}finalize(){let{h:t,pad:n}=this,r=new Uint16Array(10),i=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=i,i=t[a]>>>13,t[a]&=8191;t[0]+=i*5,i=t[0]>>>13,t[0]&=8191,t[1]+=i,i=t[1]>>>13,t[1]&=8191,t[2]+=i,r[0]=t[0]+5,i=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+i,i=r[a]>>>13,r[a]&=8191;r[9]-=8192;let o=(i^1)-1;for(let a=0;a<10;a++)r[a]&=o;o=~o;for(let a=0;a<10;a++)t[a]=t[a]&o|r[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 s=t[0]+n[0];t[0]=s&65535;for(let a=1;a<8;a++)s=(t[a]+n[a]|0)+(s>>>16)|0,t[a]=s&65535;Li(r)}update(t){qE(this),jn(t),t=Ff(t);let{buffer:n,blockLen:r}=this,i=t.length;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){for(;r<=i-o;o+=r)this.process(t,o);continue}n.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,Li(this.h,this.r,this.buffer,this.pad)}digestInto(t){qE(this),PD(t,this),this.finished=!0;let{buffer:n,h:r}=this,{pos:i}=this;if(i){for(n[i++]=1;i<16;i++)n[i]=0;this.process(n,0,!0)}this.finalize();let o=0;for(let s=0;s<8;s++)t[o++]=r[s]>>>0,t[o++]=r[s]>>>8}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}},MD=RD(32,e=>new KE(e));function GG(e,t,n,r,i,o=20){let s=e[0],a=e[1],u=e[2],l=e[3],h=t[0],m=t[1],p=t[2],d=t[3],v=t[4],g=t[5],y=t[6],w=t[7],E=i,C=n[0],_=n[1],F=n[2],H=s,K=a,S=u,I=l,q=h,L=m,T=p,O=d,R=v,N=g,P=y,M=w,Y=E,V=C,X=_,te=F;for(let me=0;me<o;me+=2)H=H+q|0,Y=Rt(Y^H,16),R=R+Y|0,q=Rt(q^R,12),H=H+q|0,Y=Rt(Y^H,8),R=R+Y|0,q=Rt(q^R,7),K=K+L|0,V=Rt(V^K,16),N=N+V|0,L=Rt(L^N,12),K=K+L|0,V=Rt(V^K,8),N=N+V|0,L=Rt(L^N,7),S=S+T|0,X=Rt(X^S,16),P=P+X|0,T=Rt(T^P,12),S=S+T|0,X=Rt(X^S,8),P=P+X|0,T=Rt(T^P,7),I=I+O|0,te=Rt(te^I,16),M=M+te|0,O=Rt(O^M,12),I=I+O|0,te=Rt(te^I,8),M=M+te|0,O=Rt(O^M,7),H=H+L|0,te=Rt(te^H,16),P=P+te|0,L=Rt(L^P,12),H=H+L|0,te=Rt(te^H,8),P=P+te|0,L=Rt(L^P,7),K=K+T|0,Y=Rt(Y^K,16),M=M+Y|0,T=Rt(T^M,12),K=K+T|0,Y=Rt(Y^K,8),M=M+Y|0,T=Rt(T^M,7),S=S+O|0,V=Rt(V^S,16),R=R+V|0,O=Rt(O^R,12),S=S+O|0,V=Rt(V^S,8),R=R+V|0,O=Rt(O^R,7),I=I+q|0,X=Rt(X^I,16),N=N+X|0,q=Rt(q^N,12),I=I+q|0,X=Rt(X^I,8),N=N+X|0,q=Rt(q^N,7);let ae=0;r[ae++]=s+H|0,r[ae++]=a+K|0,r[ae++]=u+S|0,r[ae++]=l+I|0,r[ae++]=h+q|0,r[ae++]=m+L|0,r[ae++]=p+T|0,r[ae++]=d+O|0,r[ae++]=v+R|0,r[ae++]=g+N|0,r[ae++]=y+P|0,r[ae++]=w+M|0,r[ae++]=E+Y|0,r[ae++]=C+V|0,r[ae++]=_+X|0,r[ae++]=F+te|0}var zG=HD(GG,{counterRight:!1,counterLength:4,allowShortKeys:!1});var WG=new Uint8Array(16),qD=(e,t)=>{e.update(t);let n=t.length%16;n&&e.update(WG.subarray(n))},YG=new Uint8Array(32);function jD(e,t,n,r,i){i!==void 0&&jn(i,void 0,"AAD");let o=e(t,n,YG),s=ND(r.length,i?i.length:0,!0),a=MD.create(o);i&&qD(a,i),qD(a,r),a.update(s);let u=a.digest();return Li(o,s),u}var XG=e=>(t,n,r)=>({encrypt(o,s){let a=o.length;s=Nd(a+16,s,!1),s.set(o);let u=s.subarray(0,-16);e(t,n,u,u,1);let l=jD(e,t,n,u,r);return s.set(l,a),Li(l),s},decrypt(o,s){s=Nd(o.length-16,s,!1);let a=o.subarray(0,-16),u=o.subarray(-16),l=jD(e,t,n,a,r);if(!TD(u,l))throw Li(l),new Error("invalid tag");return s.set(o.subarray(0,-16)),e(t,n,s,s,1),Li(l),s}}),ii=OD({blockSize:64,nonceLength:12,tagLength:16},XG(zG));var M0e=B(x(),1);var upe=B(x(),1);var ipe=B(x(),1);function Bf(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Qn(e,t=""){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw new Error(`${n}expected integer >0, got ${e}`)}}function Je(e,t,n=""){let r=Bf(e),i=e?.length,o=t!==void 0;if(!r||o&&i!==t){let s=n&&`"${n}" `,a=o?` of length ${t}`:"",u=r?`length=${i}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+u)}return e}function oi(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash must wrapped by utils.createHasher");Qn(e.outputLen),Qn(e.blockLen)}function Ba(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 Rm(e,t){Je(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function Om(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ys(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Nm(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ui(e,t){return e<<32-t|e>>>t}var ZG=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function JG(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function QG(e){for(let t=0;t<e.length;t++)e[t]=JG(e[t]);return e}var VE=ZG?e=>e:QG,VD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ez=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kc(e){if(Je(e),VD)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=ez[e[n]];return t}var Fa={_0:48,_9:57,A:65,F:70,a:97,f:102};function KD(e){if(e>=Fa._0&&e<=Fa._9)return e-Fa._0;if(e>=Fa.A&&e<=Fa.F)return e-(Fa.A-10);if(e>=Fa.a&&e<=Fa.f)return e-(Fa.a-10)}function Vc(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(VD)return Uint8Array.fromHex(e);let t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){let s=KD(e.charCodeAt(o)),a=KD(e.charCodeAt(o+1));if(s===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)}r[i]=s*16+a}return r}function Pn(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];Je(i),t+=i.length}let n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){let o=e[r];n.set(o,i),i+=o.length}return n}function If(e,t={}){let n=(i,o)=>e(o).update(i).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=i=>e(i),Object.assign(n,t),Object.freeze(n)}function Uu(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 Hu=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var zE=BigInt(0),GE=BigInt(1);function Ud(e,t=""){if(typeof e!="boolean"){let n=t&&`"${t}" `;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function GD(e){if(typeof e=="bigint"){if(!Lm(e))throw new Error("positive bigint expected, got "+e)}else Qn(e);return e}function Hd(e){let t=GD(e).toString(16);return t.length&1?"0"+t:t}function zD(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?zE:BigInt("0x"+e)}function Mu(e){return zD(Kc(e))}function qu(e){return zD(Kc(Um(Je(e)).reverse()))}function $f(e,t){Qn(t),e=GD(e);let n=Vc(e.toString(16).padStart(t*2,"0"));if(n.length!==t)throw new Error("number too large");return n}function Md(e,t){return $f(e,t).reverse()}function Um(e){return Uint8Array.from(e)}function ju(e){return Uint8Array.from(e,(t,n)=>{let r=t.charCodeAt(0);if(t.length!==1||r>127)throw new Error(`string contains non-ASCII character "${e[n]}" with code ${r} at position ${n}`);return r})}var Lm=e=>typeof e=="bigint"&&zE<=e;function tz(e,t,n){return Lm(e)&&Lm(t)&&Lm(n)&&t<=e&&e<n}function qd(e,t,n,r){if(!tz(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function WE(e){let t;for(t=0;e>zE;e>>=GE,t+=1);return t}var jd=e=>(GE<<BigInt(e))-GE;function WD(e,t,n){if(Qn(e,"hashLen"),Qn(t,"qByteLen"),typeof n!="function")throw new Error("hmacFn must be a function");let r=y=>new Uint8Array(y),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1),a=1e3,u=r(e),l=r(e),h=0,m=()=>{u.fill(1),l.fill(0),h=0},p=(...y)=>n(l,Pn(u,...y)),d=(y=i)=>{l=p(o,y),u=p(),y.length!==0&&(l=p(s,y),u=p())},v=()=>{if(h++>=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 Pn(...w)};return(y,w)=>{m(),d(y);let E;for(;!(E=w(v()));)d();return m(),E}}function Gc(e,t={},n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,a){let u=e[o];if(a&&u===void 0)return;let l=typeof u;if(l!==s||u===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${l}`)}let i=(o,s)=>Object.entries(o).forEach(([a,u])=>r(a,u,s));i(t,!1),i(n,!0)}function YE(e){let t=new WeakMap;return(n,...r)=>{let i=t.get(n);if(i!==void 0)return i;let o=e(n,...r);return t.set(n,o),o}}var gpe=B(x(),1);var hpe=B(x(),1);var Yr=BigInt(0),kr=BigInt(1),zc=BigInt(2),ZD=BigInt(3),JD=BigInt(4),QD=BigInt(5),nz=BigInt(7),eF=BigInt(8),rz=BigInt(9),tF=BigInt(16);function Wr(e,t){let n=e%t;return n>=Yr?n:t+n}function ai(e,t,n){let r=e;for(;t-- >Yr;)r*=r,r%=n;return r}function YD(e,t){if(e===Yr)throw new Error("invert: expected non-zero number");if(t<=Yr)throw new Error("invert: expected positive modulus, got "+t);let n=Wr(e,t),r=t,i=Yr,o=kr,s=kr,a=Yr;for(;n!==Yr;){let l=r/n,h=r%n,m=i-s*l,p=o-a*l;r=n,n=h,i=s,o=a,s=m,a=p}if(r!==kr)throw new Error("invert: does not exist");return Wr(i,t)}function ZE(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function nF(e,t){let n=(e.ORDER+kr)/JD,r=e.pow(t,n);return ZE(e,r,t),r}function sz(e,t){let n=(e.ORDER-QD)/eF,r=e.mul(t,zc),i=e.pow(r,n),o=e.mul(t,i),s=e.mul(e.mul(o,zc),i),a=e.mul(o,e.sub(s,e.ONE));return ZE(e,a,t),a}function iz(e){let t=Hm(e),n=rF(e),r=n(t,t.neg(t.ONE)),i=n(t,r),o=n(t,t.neg(r)),s=(e+nz)/tF;return(a,u)=>{let l=a.pow(u,s),h=a.mul(l,r),m=a.mul(l,i),p=a.mul(l,o),d=a.eql(a.sqr(h),u),v=a.eql(a.sqr(m),u);l=a.cmov(l,h,d),h=a.cmov(p,m,v);let g=a.eql(a.sqr(h),u),y=a.cmov(l,h,g);return ZE(a,y,u),y}}function rF(e){if(e<ZD)throw new Error("sqrt is not defined for small field");let t=e-kr,n=0;for(;t%zc===Yr;)t/=zc,n++;let r=zc,i=Hm(e);for(;XD(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return nF;let o=i.pow(r,t),s=(t+kr)/zc;return function(u,l){if(u.is0(l))return l;if(XD(u,l)!==1)throw new Error("Cannot find square root");let h=n,m=u.mul(u.ONE,o),p=u.pow(l,t),d=u.pow(l,s);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===h)throw new Error("Cannot find square root");let y=kr<<BigInt(h-v-1),w=u.pow(m,y);h=v,m=u.sqr(w),p=u.mul(p,m),d=u.mul(d,w)}return d}}function oz(e){return e%JD===ZD?nF:e%eF===QD?sz:e%tF===rz?iz(e):rF(e)}var az=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function JE(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},n=az.reduce((r,i)=>(r[i]="function",r),t);return Gc(e,n),e}function uz(e,t,n){if(n<Yr)throw new Error("invalid exponent, negatives unsupported");if(n===Yr)return e.ONE;if(n===kr)return t;let r=e.ONE,i=t;for(;n>Yr;)n&kr&&(r=e.mul(r,i)),i=e.sqr(i),n>>=kr;return r}function Kd(e,t,n=!1){let r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((s,a,u)=>e.is0(a)?s:(r[u]=s,e.mul(s,a)),e.ONE),o=e.inv(i);return t.reduceRight((s,a,u)=>e.is0(a)?s:(r[u]=e.mul(s,r[u]),e.mul(s,a)),o),r}function XD(e,t){let n=(e.ORDER-kr)/zc,r=e.pow(t,n),i=e.eql(r,e.ONE),o=e.eql(r,e.ZERO),s=e.eql(r,e.neg(e.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function cz(e,t){t!==void 0&&Qn(t);let n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}var XE=class{ORDER;BITS;BYTES;isLE;ZERO=Yr;ONE=kr;_lengths;_sqrt;_mod;constructor(t,n={}){if(t<=Yr)throw new Error("invalid field: expected ORDER > 0, got "+t);let r;this.isLE=!1,n!=null&&typeof n=="object"&&(typeof n.BITS=="number"&&(r=n.BITS),typeof n.sqrt=="function"&&(this.sqrt=n.sqrt),typeof n.isLE=="boolean"&&(this.isLE=n.isLE),n.allowedLengths&&(this._lengths=n.allowedLengths?.slice()),typeof n.modFromBytes=="boolean"&&(this._mod=n.modFromBytes));let{nBitLength:i,nByteLength:o}=cz(t,r);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=o,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return Wr(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return Yr<=t&&t<this.ORDER}is0(t){return t===Yr}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&kr)===kr}neg(t){return Wr(-t,this.ORDER)}eql(t,n){return t===n}sqr(t){return Wr(t*t,this.ORDER)}add(t,n){return Wr(t+n,this.ORDER)}sub(t,n){return Wr(t-n,this.ORDER)}mul(t,n){return Wr(t*n,this.ORDER)}pow(t,n){return uz(this,t,n)}div(t,n){return Wr(t*YD(n,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,n){return t+n}subN(t,n){return t-n}mulN(t,n){return t*n}inv(t){return YD(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=oz(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Md(t,this.BYTES):$f(t,this.BYTES)}fromBytes(t,n=!1){Je(t);let{_lengths:r,BYTES:i,isLE:o,ORDER:s,_mod:a}=this;if(r){if(!r.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let l=new Uint8Array(i);l.set(t,o?0:l.length-t.length),t=l}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let u=o?qu(t):Mu(t);if(a&&(u=Wr(u,s)),!n&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(t){return Kd(this,t)}cmov(t,n,r){return r?n:t}};function Hm(e,t={}){return new XE(e,t)}function sF(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 QE(e){let t=sF(e);return t+Math.ceil(t/2)}function iF(e,t,n=!1){Je(e);let r=e.length,i=sF(t),o=QE(t);if(r<16||r<o||r>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);let s=n?qu(e):Mu(e),a=Wr(s,t-kr)+kr;return n?Md(a,i):$f(a,i)}var xf=BigInt(0),Wc=BigInt(1);function Vd(e,t){let n=t.negate();return e?n:t}function rb(e,t){let n=Kd(e.Fp,t.map(r=>r.Z));return t.map((r,i)=>e.fromAffine(r.toAffine(n[i])))}function cF(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function eb(e,t){cF(e,t);let n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,o=jd(e),s=BigInt(e);return{windows:n,windowSize:r,mask:o,maxNumber:i,shiftBy:s}}function oF(e,t,n){let{windowSize:r,mask:i,maxNumber:o,shiftBy:s}=n,a=Number(e&i),u=e>>s;a>r&&(a-=o,u+=Wc);let l=t*r,h=l+Math.abs(a)-1,m=a===0,p=a<0,d=t%2!==0;return{nextN:u,offset:h,isZero:m,isNeg:p,isNegF:d,offsetF:l}}var tb=new WeakMap,lF=new WeakMap;function nb(e){return lF.get(e)||1}function aF(e){if(e!==xf)throw new Error("invalid wNAF")}var Mm=class{BASE;ZERO;Fn;bits;constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let i=t;for(;n>xf;)n&Wc&&(r=r.add(i)),i=i.double(),n>>=Wc;return r}precomputeWindow(t,n){let{windows:r,windowSize:i}=eb(n,this.bits),o=[],s=t,a=s;for(let u=0;u<r;u++){a=s,o.push(a);for(let l=1;l<i;l++)a=a.add(s),o.push(a);s=a.double()}return o}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,o=this.BASE,s=eb(t,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:l,isZero:h,isNeg:m,isNegF:p,offsetF:d}=oF(r,a,s);r=u,h?o=o.add(Vd(p,n[d])):i=i.add(Vd(m,n[l]))}return aF(r),{p:i,f:o}}wNAFUnsafe(t,n,r,i=this.ZERO){let o=eb(t,this.bits);for(let s=0;s<o.windows&&r!==xf;s++){let{nextN:a,offset:u,isZero:l,isNeg:h}=oF(r,s,o);if(r=a,!l){let m=n[u];i=i.add(h?m.negate():m)}}return aF(r),i}getPrecomputes(t,n,r){let i=tb.get(n);return i||(i=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(i=r(i)),tb.set(n,i))),i}cached(t,n,r){let i=nb(t);return this.wNAF(i,this.getPrecomputes(i,t,r),n)}unsafe(t,n,r,i){let o=nb(t);return o===1?this._unsafeLadder(t,n,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),n,i)}createCache(t,n){cF(n,this.bits),lF.set(t,n),tb.delete(t)}hasCache(t){return nb(t)!==1}};function fF(e,t,n,r){let i=t,o=e.ZERO,s=e.ZERO;for(;n>xf||r>xf;)n&Wc&&(o=o.add(i)),r&Wc&&(s=s.add(i)),i=i.double(),n>>=Wc,r>>=Wc;return{p1:o,p2:s}}function uF(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return JE(t),t}else return Hm(e,{isLE:n})}function hF(e,t,n={},r){if(r===void 0&&(r=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>xf))throw new Error(`CURVE.${u} must be positive bigint`)}let i=uF(t.p,n.Fp,r),o=uF(t.n,n.Fn,r),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let u of a)if(!i.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:i,Fn:o}}function qm(e,t){return function(r){let i=e(r);return{secretKey:i,publicKey:t(i)}}}var bpe=B(x(),1);var Gd=BigInt(0),Pf=BigInt(1),jm=BigInt(2);function lz(e){return Gc(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function dF(e){let t=lz(e),{P:n,type:r,adjustScalarBytes:i,powPminus2:o,randomBytes:s}=t,a=r==="x25519";if(!a&&r!=="x448")throw new Error("invalid type");let u=s||Uu,l=a?255:448,h=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?jm**BigInt(254):jm**BigInt(447),v=a?BigInt(8)*jm**BigInt(251)-Pf:BigInt(4)*jm**BigInt(445)-Pf,g=d+v+Pf,y=R=>Wr(R,n),w=E(m);function E(R){return Md(y(R),h)}function C(R){let N=Um(Je(R,h,"uCoordinate"));return a&&(N[31]&=127),y(qu(N))}function _(R){return qu(i(Um(Je(R,h,"scalar"))))}function F(R,N){let P=q(C(N),_(R));if(P===Gd)throw new Error("invalid private or public key received");return E(P)}function H(R){return F(R,w)}let K=H,S=F;function I(R,N,P){let M=y(R*(N-P));return N=y(N-M),P=y(P+M),{x_2:N,x_3:P}}function q(R,N){qd("u",R,Gd,n),qd("scalar",N,d,g);let P=N,M=R,Y=Pf,V=Gd,X=R,te=Pf,ae=Gd;for(let he=BigInt(l-1);he>=Gd;he--){let De=P>>he&Pf;ae^=De,{x_2:Y,x_3:X}=I(ae,Y,X),{x_2:V,x_3:te}=I(ae,V,te),ae=De;let Pe=Y+V,Ie=y(Pe*Pe),se=Y-V,pe=y(se*se),Fe=Ie-pe,Re=X+te,Ve=X-te,Oe=y(Ve*Pe),pt=y(Re*se),Qe=Oe+pt,ct=Oe-pt;X=y(Qe*Qe),te=y(M*y(ct*ct)),Y=y(Ie*pe),V=y(Fe*(Ie+y(p*Fe)))}({x_2:Y,x_3:X}=I(ae,Y,X)),{x_2:V,x_3:te}=I(ae,V,te);let me=o(V);return y(Y*me)}let L={secretKey:h,publicKey:h,seed:h},T=(R=u(h))=>(Je(R,L.seed,"seed"),R),O={randomSecretKey:T};return Object.freeze({keygen:qm(T,K),getSharedSecret:S,getPublicKey:K,scalarMult:F,scalarMultBase:H,utils:O,GuBytes:w.slice(),lengths:L})}var xpe=B(x(),1);var Cpe=B(x(),1);var Km=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,n){if(oi(t),Je(n,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 r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?t.create().update(n).digest():n);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),ys(i)}update(t){return Ba(this),this.iHash.update(t),this}digestInto(t){Ba(this),Je(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:n,iHash:r,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=s,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},kf=(e,t,n)=>new Km(e,t).update(n).digest();kf.create=(e,t)=>new Km(e,t);var pF=(e,t)=>(e+(e>=0?t:-t)/mF)/t;function fz(e,t,n){let[[r,i],[o,s]]=t,a=pF(s*e,n),u=pF(-i*e,n),l=e-a*r-u*o,h=-a*i-u*s,m=l<Ia,p=h<Ia;m&&(l=-l),p&&(h=-h);let d=jd(Math.ceil(WE(n)/2))+Tf;if(l<Ia||l>=d||h<Ia||h>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:m,k1:l,k2neg:p,k2:h}}function ib(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function sb(e,t){let n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Ud(n.lowS,"lowS"),Ud(n.prehash,"prehash"),n.format!==void 0&&ib(n.format),n}var ob=class extends Error{constructor(t=""){super(t)}},Ku={Err:ob,_tlv:{encode:(e,t)=>{let{Err:n}=Ku;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");let r=t.length/2,i=Hd(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");let o=r>127?Hd(i.length/2|128):"";return Hd(e)+o+i+t},decode(e,t){let{Err:n}=Ku,r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");let i=t[r++],o=!!(i&128),s=0;if(!o)s=i;else{let u=i&127;if(!u)throw new n("tlv.decode(long): indefinite length not supported");if(u>4)throw new n("tlv.decode(long): byte length is too big");let l=t.subarray(r,r+u);if(l.length!==u)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(let h of l)s=s<<8|h;if(r+=u,s<128)throw new n("tlv.decode(long): not minimal encoding")}let a=t.subarray(r,r+s);if(a.length!==s)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+s)}}},_int:{encode(e){let{Err:t}=Ku;if(e<Ia)throw new t("integer: negative integers are not allowed");let n=Hd(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){let{Err:t}=Ku;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 Mu(e)}},toSig(e){let{Err:t,_int:n,_tlv:r}=Ku,i=Je(e,void 0,"signature"),{v:o,l:s}=r.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:u}=r.decode(2,o),{v:l,l:h}=r.decode(2,u);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){let{_tlv:t,_int:n}=Ku,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),o=r+i;return t.encode(48,o)}},Ia=BigInt(0),Tf=BigInt(1),mF=BigInt(2),Vm=BigInt(3),hz=BigInt(4);function ab(e,t={}){let n=hF("weierstrass",e,t),{Fp:r,Fn:i}=n,o=n.CURVE,{h:s,n:a}=o;Gc(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:u}=t;if(u&&(!r.is0(o.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let l=vF(r,i);function h(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function m(T,O,R){let{x:N,y:P}=O.toAffine(),M=r.toBytes(N);if(Ud(R,"isCompressed"),R){h();let Y=!r.isOdd(P);return Pn(gF(Y),M)}else return Pn(Uint8Array.of(4),M,r.toBytes(P))}function p(T){Je(T,void 0,"Point");let{publicKey:O,publicKeyUncompressed:R}=l,N=T.length,P=T[0],M=T.subarray(1);if(N===O&&(P===2||P===3)){let Y=r.fromBytes(M);if(!r.isValid(Y))throw new Error("bad point: is not on curve, wrong x");let V=g(Y),X;try{X=r.sqrt(V)}catch(me){let he=me instanceof Error?": "+me.message:"";throw new Error("bad point: is not on curve, sqrt error"+he)}h();let te=r.isOdd(X);return(P&1)===1!==te&&(X=r.neg(X)),{x:Y,y:X}}else if(N===R&&P===4){let Y=r.BYTES,V=r.fromBytes(M.subarray(0,Y)),X=r.fromBytes(M.subarray(Y,Y*2));if(!y(V,X))throw new Error("bad point: is not on curve");return{x:V,y:X}}else throw new Error(`bad point: got length ${N}, expected compressed=${O} or uncompressed=${R}`)}let d=t.toBytes||m,v=t.fromBytes||p;function g(T){let O=r.sqr(T),R=r.mul(O,T);return r.add(r.add(R,r.mul(T,o.a)),o.b)}function y(T,O){let R=r.sqr(O),N=g(T);return r.eql(R,N)}if(!y(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let w=r.mul(r.pow(o.a,Vm),hz),E=r.mul(r.sqr(o.b),BigInt(27));if(r.is0(r.add(w,E)))throw new Error("bad curve params: a or b");function C(T,O,R=!1){if(!r.isValid(O)||R&&r.is0(O))throw new Error(`bad point coordinate ${T}`);return O}function _(T){if(!(T instanceof I))throw new Error("Weierstrass Point expected")}function F(T){if(!u||!u.basises)throw new Error("no endo");return fz(T,u.basises,i.ORDER)}let H=YE((T,O)=>{let{X:R,Y:N,Z:P}=T;if(r.eql(P,r.ONE))return{x:R,y:N};let M=T.is0();O==null&&(O=M?r.ONE:r.inv(P));let Y=r.mul(R,O),V=r.mul(N,O),X=r.mul(P,O);if(M)return{x:r.ZERO,y:r.ZERO};if(!r.eql(X,r.ONE))throw new Error("invZ was invalid");return{x:Y,y:V}}),K=YE(T=>{if(T.is0()){if(t.allowInfinityPoint&&!r.is0(T.Y))return;throw new Error("bad point: ZERO")}let{x:O,y:R}=T.toAffine();if(!r.isValid(O)||!r.isValid(R))throw new Error("bad point: x or y not field elements");if(!y(O,R))throw new Error("bad point: equation left != right");if(!T.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function S(T,O,R,N,P){return R=new I(r.mul(R.X,T),R.Y,R.Z),O=Vd(N,O),R=Vd(P,R),O.add(R)}class I{static BASE=new I(o.Gx,o.Gy,r.ONE);static ZERO=new I(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(O,R,N){this.X=C("x",O),this.Y=C("y",R,!0),this.Z=C("z",N),Object.freeze(this)}static CURVE(){return o}static fromAffine(O){let{x:R,y:N}=O||{};if(!O||!r.isValid(R)||!r.isValid(N))throw new Error("invalid affine point");if(O instanceof I)throw new Error("projective point not allowed");return r.is0(R)&&r.is0(N)?I.ZERO:new I(R,N,r.ONE)}static fromBytes(O){let R=I.fromAffine(v(Je(O,void 0,"point")));return R.assertValidity(),R}static fromHex(O){return I.fromBytes(Vc(O))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(O=8,R=!0){return L.createCache(this,O),R||this.multiply(Vm),this}assertValidity(){K(this)}hasEvenY(){let{y:O}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(O)}equals(O){_(O);let{X:R,Y:N,Z:P}=this,{X:M,Y,Z:V}=O,X=r.eql(r.mul(R,V),r.mul(M,P)),te=r.eql(r.mul(N,V),r.mul(Y,P));return X&&te}negate(){return new I(this.X,r.neg(this.Y),this.Z)}double(){let{a:O,b:R}=o,N=r.mul(R,Vm),{X:P,Y:M,Z:Y}=this,V=r.ZERO,X=r.ZERO,te=r.ZERO,ae=r.mul(P,P),me=r.mul(M,M),he=r.mul(Y,Y),De=r.mul(P,M);return De=r.add(De,De),te=r.mul(P,Y),te=r.add(te,te),V=r.mul(O,te),X=r.mul(N,he),X=r.add(V,X),V=r.sub(me,X),X=r.add(me,X),X=r.mul(V,X),V=r.mul(De,V),te=r.mul(N,te),he=r.mul(O,he),De=r.sub(ae,he),De=r.mul(O,De),De=r.add(De,te),te=r.add(ae,ae),ae=r.add(te,ae),ae=r.add(ae,he),ae=r.mul(ae,De),X=r.add(X,ae),he=r.mul(M,Y),he=r.add(he,he),ae=r.mul(he,De),V=r.sub(V,ae),te=r.mul(he,me),te=r.add(te,te),te=r.add(te,te),new I(V,X,te)}add(O){_(O);let{X:R,Y:N,Z:P}=this,{X:M,Y,Z:V}=O,X=r.ZERO,te=r.ZERO,ae=r.ZERO,me=o.a,he=r.mul(o.b,Vm),De=r.mul(R,M),Pe=r.mul(N,Y),Ie=r.mul(P,V),se=r.add(R,N),pe=r.add(M,Y);se=r.mul(se,pe),pe=r.add(De,Pe),se=r.sub(se,pe),pe=r.add(R,P);let Fe=r.add(M,V);return pe=r.mul(pe,Fe),Fe=r.add(De,Ie),pe=r.sub(pe,Fe),Fe=r.add(N,P),X=r.add(Y,V),Fe=r.mul(Fe,X),X=r.add(Pe,Ie),Fe=r.sub(Fe,X),ae=r.mul(me,pe),X=r.mul(he,Ie),ae=r.add(X,ae),X=r.sub(Pe,ae),ae=r.add(Pe,ae),te=r.mul(X,ae),Pe=r.add(De,De),Pe=r.add(Pe,De),Ie=r.mul(me,Ie),pe=r.mul(he,pe),Pe=r.add(Pe,Ie),Ie=r.sub(De,Ie),Ie=r.mul(me,Ie),pe=r.add(pe,Ie),De=r.mul(Pe,pe),te=r.add(te,De),De=r.mul(Fe,pe),X=r.mul(se,X),X=r.sub(X,De),De=r.mul(se,Pe),ae=r.mul(Fe,ae),ae=r.add(ae,De),new I(X,te,ae)}subtract(O){return this.add(O.negate())}is0(){return this.equals(I.ZERO)}multiply(O){let{endo:R}=t;if(!i.isValidNot0(O))throw new Error("invalid scalar: out of range");let N,P,M=Y=>L.cached(this,Y,V=>rb(I,V));if(R){let{k1neg:Y,k1:V,k2neg:X,k2:te}=F(O),{p:ae,f:me}=M(V),{p:he,f:De}=M(te);P=me.add(De),N=S(R.beta,ae,he,Y,X)}else{let{p:Y,f:V}=M(O);N=Y,P=V}return rb(I,[N,P])[0]}multiplyUnsafe(O){let{endo:R}=t,N=this;if(!i.isValid(O))throw new Error("invalid scalar: out of range");if(O===Ia||N.is0())return I.ZERO;if(O===Tf)return N;if(L.hasCache(this))return this.multiply(O);if(R){let{k1neg:P,k1:M,k2neg:Y,k2:V}=F(O),{p1:X,p2:te}=fF(I,N,M,V);return S(R.beta,X,te,P,Y)}else return L.unsafe(N,O)}toAffine(O){return H(this,O)}isTorsionFree(){let{isTorsionFree:O}=t;return s===Tf?!0:O?O(I,this):L.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:O}=t;return s===Tf?this:O?O(I,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(O=!0){return Ud(O,"isCompressed"),this.assertValidity(),d(I,this,O)}toHex(O=!0){return Kc(this.toBytes(O))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let q=i.BITS,L=new Mm(I,t.endo?Math.ceil(q/2):q);return I.BASE.precompute(8),I}function gF(e){return Uint8Array.of(e?2:3)}function vF(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function dz(e,t={}){let{Fn:n}=e,r=t.randomBytes||Uu,i=Object.assign(vF(e.Fp,n),{seed:QE(n.ORDER)});function o(d){try{let v=n.fromBytes(d);return n.isValidNot0(v)}catch{return!1}}function s(d,v){let{publicKey:g,publicKeyUncompressed:y}=i;try{let w=d.length;return v===!0&&w!==g||v===!1&&w!==y?!1:!!e.fromBytes(d)}catch{return!1}}function a(d=r(i.seed)){return iF(Je(d,i.seed,"seed"),n.ORDER)}function u(d,v=!0){return e.BASE.multiply(n.fromBytes(d)).toBytes(v)}function l(d){let{secretKey:v,publicKey:g,publicKeyUncompressed:y}=i;if(!Bf(d)||"_lengths"in n&&n._lengths||v===g)return;let w=Je(d,void 0,"key").length;return w===g||w===y}function h(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=n.fromBytes(d);return e.fromBytes(v).multiply(y).toBytes(g)}let m={isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:a},p=qm(a,u);return Object.freeze({getPublicKey:u,getSharedSecret:h,keygen:p,Point:e,utils:m,lengths:i})}function ub(e,t,n={}){oi(t),Gc(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),n=Object.assign({},n);let r=n.randomBytes||Uu,i=n.hmac||((R,N)=>kf(t,R,N)),{Fp:o,Fn:s}=e,{ORDER:a,BITS:u}=s,{keygen:l,getPublicKey:h,getSharedSecret:m,utils:p,lengths:d}=dz(e,n),v={prehash:!0,lowS:typeof n.lowS=="boolean"?n.lowS:!0,format:"compact",extraEntropy:!1},g=a*mF<o.ORDER;function y(R){let N=a>>Tf;return R>N}function w(R,N){if(!s.isValidNot0(N))throw new Error(`invalid signature ${R}: out of range 1..Point.Fn.ORDER`);return N}function E(){if(g)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function C(R,N){ib(N);let P=d.signature,M=N==="compact"?P:N==="recovered"?P+1:void 0;return Je(R,M)}class _{r;s;recovery;constructor(N,P,M){if(this.r=w("r",N),this.s=w("s",P),M!=null){if(E(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(N,P=v.format){C(N,P);let M;if(P==="der"){let{r:te,s:ae}=Ku.toSig(Je(N));return new _(te,ae)}P==="recovered"&&(M=N[0],P="compact",N=N.subarray(1));let Y=d.signature/2,V=N.subarray(0,Y),X=N.subarray(Y,Y*2);return new _(s.fromBytes(V),s.fromBytes(X),M)}static fromHex(N,P){return this.fromBytes(Vc(N),P)}assertRecovery(){let{recovery:N}=this;if(N==null)throw new Error("invalid recovery id: must be present");return N}addRecoveryBit(N){return new _(this.r,this.s,N)}recoverPublicKey(N){let{r:P,s:M}=this,Y=this.assertRecovery(),V=Y===2||Y===3?P+a:P;if(!o.isValid(V))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let X=o.toBytes(V),te=e.fromBytes(Pn(gF((Y&1)===0),X)),ae=s.inv(V),me=H(Je(N,void 0,"msgHash")),he=s.create(-me*ae),De=s.create(M*ae),Pe=e.BASE.multiplyUnsafe(he).add(te.multiplyUnsafe(De));if(Pe.is0())throw new Error("invalid recovery: point at infinify");return Pe.assertValidity(),Pe}hasHighS(){return y(this.s)}toBytes(N=v.format){if(ib(N),N==="der")return Vc(Ku.hexFromSig(this));let{r:P,s:M}=this,Y=s.toBytes(P),V=s.toBytes(M);return N==="recovered"?(E(),Pn(Uint8Array.of(this.assertRecovery()),Y,V)):Pn(Y,V)}toHex(N){return Kc(this.toBytes(N))}}let F=n.bits2int||function(N){if(N.length>8192)throw new Error("input is too large");let P=Mu(N),M=N.length*8-u;return M>0?P>>BigInt(M):P},H=n.bits2int_modN||function(N){return s.create(F(N))},K=jd(u);function S(R){return qd("num < 2^"+u,R,Ia,K),s.toBytes(R)}function I(R,N){return Je(R,void 0,"message"),N?Je(t(R),void 0,"prehashed message"):R}function q(R,N,P){let{lowS:M,prehash:Y,extraEntropy:V}=sb(P,v);R=I(R,Y);let X=H(R),te=s.fromBytes(N);if(!s.isValidNot0(te))throw new Error("invalid private key");let ae=[S(te),S(X)];if(V!=null&&V!==!1){let Pe=V===!0?r(d.secretKey):V;ae.push(Je(Pe,void 0,"extraEntropy"))}let me=Pn(...ae),he=X;function De(Pe){let Ie=F(Pe);if(!s.isValidNot0(Ie))return;let se=s.inv(Ie),pe=e.BASE.multiply(Ie).toAffine(),Fe=s.create(pe.x);if(Fe===Ia)return;let Re=s.create(se*s.create(he+Fe*te));if(Re===Ia)return;let Ve=(pe.x===Fe?0:2)|Number(pe.y&Tf),Oe=Re;return M&&y(Re)&&(Oe=s.neg(Re),Ve^=1),new _(Fe,Oe,g?void 0:Ve)}return{seed:me,k2sig:De}}function L(R,N,P={}){let{seed:M,k2sig:Y}=q(R,N,P);return WD(t.outputLen,s.BYTES,i)(M,Y).toBytes(P.format)}function T(R,N,P,M={}){let{lowS:Y,prehash:V,format:X}=sb(M,v);if(P=Je(P,void 0,"publicKey"),N=I(N,V),!Bf(R)){let te=R instanceof _?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}C(R,X);try{let te=_.fromBytes(R,X),ae=e.fromBytes(P);if(Y&&te.hasHighS())return!1;let{r:me,s:he}=te,De=H(N),Pe=s.inv(he),Ie=s.create(De*Pe),se=s.create(me*Pe),pe=e.BASE.multiplyUnsafe(Ie).add(ae.multiplyUnsafe(se));return pe.is0()?!1:s.create(pe.x)===me}catch{return!1}}function O(R,N,P={}){let{prehash:M}=sb(P,v);return N=I(N,M),_.fromBytes(R,"recovered").recoverPublicKey(N).toBytes()}return Object.freeze({keygen:l,getPublicKey:h,getSharedSecret:m,utils:p,lengths:d,Point:e,sign:L,verify:T,recoverPublicKey:O,Signature:_,hash:t})}var Wpe=B(x(),1);var Mpe=B(x(),1);var Tpe=B(x(),1);function wF(e,t,n){return e&t^~e&n}function yF(e,t,n){return e&t^e&n^t&n}var zd=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,n,r,i){this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Nm(this.buffer)}update(t){Ba(this),Je(t);let{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let u=Nm(t);for(;i<=o-s;s+=i)this.process(u,s);continue}r.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ba(this),Rm(t,this),this.finished=!0;let{buffer:n,view:r,blockLen:i,isLE:o}=this,{pos:s}=this;n[s++]=128,ys(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(r,0),s=0);for(let m=s;m<i;m++)n[m]=0;r.setBigUint64(i-8,BigInt(this.length*8),o),this.process(r,0);let a=Nm(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=u/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)a.setUint32(4*m,h[m],o)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:n,buffer:r,length:i,finished:o,destroyed:s,pos:a}=this;return t.destroyed=s,t.finished=o,t.length=i,t.pos=a,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}},$a=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var ur=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]);var Rpe=B(x(),1),Gm=BigInt(4294967295),EF=BigInt(32);function pz(e,t=!1){return t?{h:Number(e&Gm),l:Number(e>>EF&Gm)}:{h:Number(e>>EF&Gm)|0,l:Number(e&Gm)|0}}function zm(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){let{h:s,l:a}=pz(e[o],t);[r[o],i[o]]=[s,a]}return[r,i]}var cb=(e,t,n)=>e>>>n,lb=(e,t,n)=>e<<32-n|t>>>n,Yc=(e,t,n)=>e>>>n|t<<32-n,Xc=(e,t,n)=>e<<32-n|t>>>n,Wd=(e,t,n)=>e<<64-n|t>>>n-32,Yd=(e,t,n)=>e>>>n-32|t<<64-n;var bF=(e,t,n)=>e<<n|t>>>32-n,AF=(e,t,n)=>t<<n|e>>>32-n,SF=(e,t,n)=>t<<n-32|e>>>64-n,CF=(e,t,n)=>e<<n-32|t>>>64-n;function Fo(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var _F=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),DF=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,FF=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),BF=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,IF=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),$F=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0;var gz=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]),Vu=new Uint32Array(64),fb=class extends zd{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:n,C:r,D:i,E:o,F:s,G:a,H:u}=this;return[t,n,r,i,o,s,a,u]}set(t,n,r,i,o,s,a,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=u|0}process(t,n){for(let m=0;m<16;m++,n+=4)Vu[m]=t.getUint32(n,!1);for(let m=16;m<64;m++){let p=Vu[m-15],d=Vu[m-2],v=Ui(p,7)^Ui(p,18)^p>>>3,g=Ui(d,17)^Ui(d,19)^d>>>10;Vu[m]=g+Vu[m-7]+v+Vu[m-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:u,G:l,H:h}=this;for(let m=0;m<64;m++){let p=Ui(a,6)^Ui(a,11)^Ui(a,25),d=h+p+wF(a,u,l)+gz[m]+Vu[m]|0,g=(Ui(r,2)^Ui(r,13)^Ui(r,22))+yF(r,i,o)|0;h=l,l=u,u=a,a=s+d|0,s=o,o=i,i=r,r=d+g|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(r,i,o,s,a,u,l,h)}roundClean(){ys(Vu)}destroy(){this.set(0,0,0,0,0,0,0,0),ys(this.buffer)}},hb=class extends fb{A=$a[0]|0;B=$a[1]|0;C=$a[2]|0;D=$a[3]|0;E=$a[4]|0;F=$a[5]|0;G=$a[6]|0;H=$a[7]|0;constructor(){super(32)}};var xF=zm(["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))),vz=xF[0],wz=xF[1],Gu=new Uint32Array(80),zu=new Uint32Array(80),db=class extends zd{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:n,Bh:r,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:l,El:h,Fh:m,Fl:p,Gh:d,Gl:v,Hh:g,Hl:y}=this;return[t,n,r,i,o,s,a,u,l,h,m,p,d,v,g,y]}set(t,n,r,i,o,s,a,u,l,h,m,p,d,v,g,y){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=u|0,this.Eh=l|0,this.El=h|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,n){for(let C=0;C<16;C++,n+=4)Gu[C]=t.getUint32(n),zu[C]=t.getUint32(n+=4);for(let C=16;C<80;C++){let _=Gu[C-15]|0,F=zu[C-15]|0,H=Yc(_,F,1)^Yc(_,F,8)^cb(_,F,7),K=Xc(_,F,1)^Xc(_,F,8)^lb(_,F,7),S=Gu[C-2]|0,I=zu[C-2]|0,q=Yc(S,I,19)^Wd(S,I,61)^cb(S,I,6),L=Xc(S,I,19)^Yd(S,I,61)^lb(S,I,6),T=FF(K,L,zu[C-7],zu[C-16]),O=BF(T,H,q,Gu[C-7],Gu[C-16]);Gu[C]=O|0,zu[C]=T|0}let{Ah:r,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:h,Eh:m,El:p,Fh:d,Fl:v,Gh:g,Gl:y,Hh:w,Hl:E}=this;for(let C=0;C<80;C++){let _=Yc(m,p,14)^Yc(m,p,18)^Wd(m,p,41),F=Xc(m,p,14)^Xc(m,p,18)^Yd(m,p,41),H=m&d^~m&g,K=p&v^~p&y,S=IF(E,F,K,wz[C],zu[C]),I=$F(S,w,_,H,vz[C],Gu[C]),q=S|0,L=Yc(r,i,28)^Wd(r,i,34)^Wd(r,i,39),T=Xc(r,i,28)^Yd(r,i,34)^Yd(r,i,39),O=r&o^r&a^o&a,R=i&s^i&u^s&u;w=g|0,E=y|0,g=d|0,y=v|0,d=m|0,v=p|0,{h:m,l:p}=Fo(l|0,h|0,I|0,q|0),l=a|0,h=u|0,a=o|0,u=s|0,o=r|0,s=i|0;let N=_F(q,T,R);r=DF(N,I,L,O),i=N|0}({h:r,l:i}=Fo(this.Ah|0,this.Al|0,r|0,i|0)),{h:o,l:s}=Fo(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=Fo(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:h}=Fo(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:p}=Fo(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=Fo(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=Fo(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=Fo(this.Hh|0,this.Hl|0,w|0,E|0),this.set(r,i,o,s,a,u,l,h,m,p,d,v,g,y,w,E)}roundClean(){ys(Gu,zu)}destroy(){ys(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var pb=class extends db{Ah=ur[0]|0;Al=ur[1]|0;Bh=ur[2]|0;Bl=ur[3]|0;Ch=ur[4]|0;Cl=ur[5]|0;Dh=ur[6]|0;Dl=ur[7]|0;Eh=ur[8]|0;El=ur[9]|0;Fh=ur[10]|0;Fl=ur[11]|0;Gh=ur[12]|0;Gl=ur[13]|0;Hh=ur[14]|0;Hl=ur[15]|0;constructor(){super(48)}};var Wm=If(()=>new hb,Hu(1));var PF=If(()=>new pb,Hu(2));var yz=BigInt(1),kF=BigInt(2),Ez=BigInt(3),bz=BigInt(5),Gpe=BigInt(8),TF=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");function Az(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),o=TF,a=e*e%o*e%o,u=ai(a,kF,o)*a%o,l=ai(u,yz,o)*e%o,h=ai(l,bz,o)*l%o,m=ai(h,t,o)*h%o,p=ai(m,n,o)*m%o,d=ai(p,r,o)*p%o,v=ai(d,i,o)*d%o,g=ai(v,i,o)*d%o,y=ai(g,t,o)*h%o;return{pow_p_5_8:ai(y,kF,o)*e%o,b2:a}}function Sz(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var RF=(()=>{let e=TF;return dF({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:n,b2:r}=Az(t);return Wr(ai(n,Ez,e)*r,e)},adjustScalarBytes:Sz})})();var e0e=B(x(),1);var Cz={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},_z={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")};var Dz=ab(Cz),mb=ub(Dz,Wm);var Fz=ab(_z),OF=ub(Fz,PF);var s0e=B(x(),1);function LF(e,t,n){return oi(e),n===void 0&&(n=new Uint8Array(e.outputLen)),kf(e,n,t)}var gb=Uint8Array.of(0),NF=Uint8Array.of();function UF(e,t,n,r=32){oi(e),Qn(r,"length");let i=e.outputLen;if(r>255*i)throw new Error("Length must be <= 255*HashLen");let o=Math.ceil(r/i);n===void 0?n=NF:Je(n,void 0,"info");let s=new Uint8Array(o*i),a=kf.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let h=0;h<o;h++)gb[0]=h+1,u.update(h===0?NF:l).update(n).update(gb).digestInto(l),s.set(l,i*h),a._cloneInto(u);return a.destroy(),u.destroy(),ys(l,gb),s.slice(0,r)}var u0e=B(x(),1);var Bz=BigInt(0),Xd=BigInt(1),Iz=BigInt(2),$z=BigInt(7),xz=BigInt(256),Pz=BigInt(113),qF=[],jF=[],KF=[];for(let e=0,t=Xd,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],qF.push(2*(5*r+n)),jF.push((e+1)*(e+2)/2%64);let i=Bz;for(let o=0;o<7;o++)t=(t<<Xd^(t>>$z)*Pz)%xz,t&Iz&&(i^=Xd<<(Xd<<BigInt(o))-Xd);KF.push(i)}var VF=zm(KF,!0),kz=VF[0],Tz=VF[1],HF=(e,t,n)=>n>32?SF(e,t,n):bF(e,t,n),MF=(e,t,n)=>n>32?CF(e,t,n):AF(e,t,n);function Rz(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,l=n[u],h=n[u+1],m=HF(l,h,1)^n[a],p=MF(l,h,1)^n[a+1];for(let d=0;d<50;d+=10)e[s+d]^=m,e[s+d+1]^=p}let i=e[2],o=e[3];for(let s=0;s<24;s++){let a=jF[s],u=HF(i,o,a),l=MF(i,o,a),h=qF[s];i=e[h],o=e[h+1],e[h]=u,e[h+1]=l}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=kz[r],e[1]^=Tz[r]}ys(n)}var Ym=class e{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(t,n,r,i=!1,o=24){if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=o,Qn(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Om(this.state)}clone(){return this._cloneInto()}keccak(){VE(this.state32),Rz(this.state32,this.rounds),VE(this.state32),this.posOut=0,this.pos=0}update(t){Ba(this),Je(t);let{blockLen:n,state:r}=this,i=t.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);for(let a=0;a<s;a++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,(n&128)!==0&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Ba(this,!1),Je(t),this.finish();let n=this.state,{blockLen:r}=this;for(let i=0,o=t.length;i<o;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,o-i);t.set(n.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Qn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Rm(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,ys(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:o,enableXOF:s}=this;return t||=new e(n,r,i,s,o),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}},GF=(e,t,n,r={})=>If(()=>new Ym(t,e,n),r);var Zc=GF(6,136,32,Hu(8));var zF=GF(6,72,64,Hu(10));var WF=(e,t,n,r={})=>If((i={})=>new Ym(t,e,i.dkLen===void 0?n:i.dkLen,!0),r),YF=WF(31,168,16,Hu(11)),Bo=WF(31,136,32,Hu(12));var F0e=B(x(),1);var E0e=B(x(),1);var l0e=B(x(),1);function vb(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error("wrong u32 integer:"+e);return e}function ZF(e){return vb(e),(e&e-1)===0&&e!==0}function wb(e,t){vb(e);let n=0;for(let r=0;r<t;r++,e>>>=1)n=n<<1|e&1;return n}function JF(e){return vb(e),31-Math.clz32(e)}function XF(e){let t=e.length;if(t<2||!ZF(t))throw new Error("n must be a power of 2 and greater than 1. Got "+t);let n=JF(t);for(let r=0;r<t;r++){let i=wb(r,n);if(r<i){let o=e[r];e[r]=e[i],e[i]=o}}return e}var yb=(e,t)=>{let{N:n,roots:r,dit:i,invertButterflies:o=!1,skipStages:s=0,brp:a=!0}=t,u=JF(n);if(!ZF(n))throw new Error("FFT: Polynomial size should be power of two");let l=i!==o;return h=>{if(h.length!==n)throw new Error("FFT: wrong Polynomial length");i&&a&&XF(h);for(let m=0,p=1;m<u-s;m++){let d=i?m+1+s:u-m,v=1<<d,g=v>>1,y=n>>d;for(let w=0;w<n;w+=v)for(let E=0,C=p++;E<g;E++){let _=o?i?n-C:C:E*y,F=w+E,H=w+E+g,K=r[_],S=h[H],I=h[F];if(l){let q=e.mul(S,K);h[F]=e.add(I,q),h[H]=e.sub(I,q)}else o?(h[F]=e.add(S,I),h[H]=e.mul(e.sub(S,I),K)):(h[F]=e.add(I,S),h[H]=e.mul(e.sub(I,S),K))}}return!i&&a&&XF(h),h}};var p0e=B(x(),1);var Io=Uu;function Xm(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function QF(e){return Uint8Array.from(e)}function Jc(e,...t){let n=i=>typeof i=="number"?i:i.bytesLen,r=t.reduce((i,o)=>i+n(o),0);return{bytesLen:r,encode:i=>{let o=new Uint8Array(r);for(let s=0,a=0;s<t.length;s++){let u=t[s],l=n(u),h=typeof u=="number"?i[s]:u.encode(i[s]);Je(h,l,e),o.set(h,a),typeof u!="number"&&h.fill(0),a+=l}return o},decode:i=>{Je(i,r,e);let o=[];for(let s of t){let a=n(s),u=i.subarray(0,a);o.push(typeof s=="number"?u:s.decode(u)),i=i.subarray(a)}return o}}}function Zm(e,t){let n=t*e.bytesLen;return{bytesLen:n,encode:r=>{if(r.length!==t)throw new Error(`vecCoder.encode: wrong length=${r.length}. Expected: ${t}`);let i=new Uint8Array(n);for(let o=0,s=0;o<r.length;o++){let a=e.encode(r[o]);i.set(a,s),a.fill(0),s+=a.length}return i},decode:r=>{Je(r,n);let i=[];for(let o=0;o<r.length;o+=e.bytesLen)i.push(e.decode(r.subarray(o,o+e.bytesLen)));return i}}}function Kn(...e){for(let t of e)if(Array.isArray(t))for(let n of t)n.fill(0);else t.fill(0)}function Eb(e){return(1<<e)-1}var h0e=Uint8Array.of();var eB=e=>{let{newPoly:t,N:n,Q:r,F:i,ROOT_OF_UNITY:o,brvBits:s,isKyber:a}=e,u=(E,C=r)=>{let _=E%C|0;return(_>=0?_|0:C+_|0)|0},l=(E,C=r)=>{let _=u(E,C)|0;return(_>C>>1?_-C|0:_)|0};function h(){let E=t(n);for(let C=0;C<n;C++){let _=wb(C,s),F=BigInt(o)**BigInt(_)%BigInt(r);E[C]=Number(F)|0}return E}let m=h(),p={add:(E,C)=>u((E|0)+(C|0))|0,sub:(E,C)=>u((E|0)-(C|0))|0,mul:(E,C)=>u((E|0)*(C|0))|0,inv:E=>{throw new Error("not implemented")}},d={N:n,roots:m,invertButterflies:!0,skipStages:a?1:0,brp:!1},v=yb(p,{dit:!1,...d}),g=yb(p,{dit:!0,...d});return{mod:u,smod:l,nttZetas:m,NTT:{encode:E=>v(E),decode:E=>{g(E);for(let C=0;C<E.length;C++)E[C]=u(i*E[C]);return E}},bitsCoder:(E,C)=>{let _=Eb(E),F=E*(n/8);return{bytesLen:F,encode:H=>{let K=new Uint8Array(F);for(let S=0,I=0,q=0,L=0;S<H.length;S++)for(I|=(C.encode(H[S])&_)<<q,q+=E;q>=8;q-=8,I>>=8)K[L++]=I&Eb(q);return K},decode:H=>{let K=t(n);for(let S=0,I=0,q=0,L=0;S<H.length;S++)for(I|=H[S]<<q,q+=8;q>=E;q-=E,I>>=E)K[L++]=C.decode(I&_);return K}}}}},Oz=e=>(t,n)=>{n||(n=e.blockLen);let r=new Uint8Array(t.length+2);r.set(t);let i=t.length,o=new Uint8Array(n),s=e.create({}),a=0,u=0;return{stats:()=>({calls:a,xofs:u}),get:(l,h)=>(r[i+0]=l,r[i+1]=h,s.destroy(),s=e.create({}).update(r),a++,()=>(u++,s.xofInto(o))),clean:()=>{s.destroy(),Kn(o,r)}}},tB=Oz(YF);var Tr=256,xa=3329,Nz=3303,Lz=17,{mod:Qd,nttZetas:Uz,NTT:Qc,bitsCoder:Hz}=eB({N:Tr,Q:xa,F:Nz,ROOT_OF_UNITY:Lz,newPoly:e=>new Uint16Array(e),brvBits:7,isKyber:!0}),bb={512:{N:Tr,Q:xa,K:2,ETA1:3,ETA2:2,du:10,dv:4,RBGstrength:128},768:{N:Tr,Q:xa,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192},1024:{N:Tr,Q:xa,K:4,ETA1:2,ETA2:2,du:11,dv:5,RBGstrength:256}},Mz=e=>{if(e>=12)return{encode:n=>n,decode:n=>n};let t=2**(e-1);return{encode:n=>((n<<e)+xa/2)/xa,decode:n=>n*xa+t>>>e}},Zd=e=>Hz(e,Mz(e));function el(e,t){for(let n=0;n<Tr;n++)e[n]=Qd(e[n]+t[n])}function qz(e,t){for(let n=0;n<Tr;n++)e[n]=Qd(e[n]-t[n])}function jz(e,t,n,r,i){let o=Qd(t*r*i+e*n),s=Qd(e*r+t*n);return{c0:o,c1:s}}function Jm(e,t){for(let n=0;n<Tr/2;n++){let r=Uz[64+(n>>1)];n&1&&(r=-r);let{c0:i,c1:o}=jz(e[2*n+0],e[2*n+1],t[2*n+0],t[2*n+1],r);e[2*n+0]=i,e[2*n+1]=o}return e}function nB(e){let t=new Uint16Array(Tr);for(let n=0;n<Tr;){let r=e();if(r.length%3)throw new Error("SampleNTT: unaligned block");for(let i=0;n<Tr&&i+3<=r.length;i+=3){let o=(r[i+0]>>0|r[i+1]<<8)&4095,s=(r[i+1]>>4|r[i+2]<<4)&4095;o<xa&&(t[n++]=o),n<Tr&&s<xa&&(t[n++]=s)}}return t}function Jd(e,t,n,r){let i=e(r*Tr/4,t,n),o=new Uint16Array(Tr),s=Om(i),a=0;for(let u=0,l=0,h=0,m=0;u<s.length;u++){let p=s[u];for(let d=0;d<32;d++)h+=p&1,p>>=1,a+=1,a===r?(m=h,h=0):a===2*r&&(o[l++]=Qd(m-h),h=0,a=0)}if(a)throw new Error(`sampleCBD: leftover bits: ${a}`);return o}var Kz=e=>{let{K:t,PRF:n,XOF:r,HASH512:i,ETA1:o,ETA2:s,du:a,dv:u}=e,l=Zd(1),h=Zd(u),m=Zd(a),p=Jc("publicKey",Zm(Zd(12),t),32),d=Zm(Zd(12),t),v=Jc("ciphertext",Zm(m,t),h),g=Jc("seed",32,32);return{secretCoder:d,lengths:{secretKey:d.bytesLen,publicKey:p.bytesLen,cipherText:v.bytesLen},keygen:y=>{Je(y,32,"seed");let w=new Uint8Array(33);w.set(y),w[32]=t;let E=i(w),[C,_]=g.decode(E),F=[],H=[];for(let I=0;I<t;I++)F.push(Qc.encode(Jd(n,_,I,o)));let K=r(C);for(let I=0;I<t;I++){let q=Qc.encode(Jd(n,_,t+I,o));for(let L=0;L<t;L++){let T=nB(K.get(L,I));el(q,Jm(T,F[L]))}H.push(q)}K.clean();let S={publicKey:p.encode([H,C]),secretKey:d.encode(F)};return Kn(C,_,F,H,w,E),S},encrypt:(y,w,E)=>{let[C,_]=p.decode(y),F=[];for(let L=0;L<t;L++)F.push(Qc.encode(Jd(n,E,L,o)));let H=r(_),K=new Uint16Array(Tr),S=[];for(let L=0;L<t;L++){let T=Jd(n,E,t+L,s),O=new Uint16Array(Tr);for(let R=0;R<t;R++){let N=nB(H.get(L,R));el(O,Jm(N,F[R]))}el(T,Qc.decode(O)),S.push(T),el(K,Jm(C[L],F[L])),Kn(O)}H.clean();let I=Jd(n,E,2*t,s);el(I,Qc.decode(K));let q=l.decode(w);return el(q,I),Kn(C,F,K,I),v.encode([S,q])},decrypt:(y,w)=>{let[E,C]=v.decode(y),_=d.decode(w),F=new Uint16Array(Tr);for(let H=0;H<t;H++)el(F,Jm(_[H],Qc.encode(E[H])));return qz(C,Qc.decode(F)),Kn(F,_,E),l.encode(C)}}};function Ab(e){let t=Kz(e),{HASH256:n,HASH512:r,KDF:i}=e,{secretCoder:o,lengths:s}=t,a=Jc("secretKey",s.secretKey,s.publicKey,32,32),u=32,l=64;return{info:{type:"ml-kem"},lengths:{...s,seed:64,msg:u,msgRand:u,secretKey:a.bytesLen},keygen:(h=Io(l))=>{Je(h,l,"seed");let{publicKey:m,secretKey:p}=t.keygen(h.subarray(0,32)),d=n(m),v=a.encode([p,m,d,h.subarray(32)]);return Kn(p,d),{publicKey:m,secretKey:v}},getPublicKey:h=>{let[m,p,d,v]=a.decode(h);return Uint8Array.from(p)},encapsulate:(h,m=Io(u))=>{Je(h,s.publicKey,"publicKey"),Je(m,u,"message");let p=h.subarray(0,384*e.K),d=o.encode(o.decode(QF(p)));if(!Xm(d,p))throw Kn(d),new Error("ML-KEM.encapsulate: wrong publicKey modulus");Kn(d);let v=r.create().update(m).update(n(h)).digest(),g=t.encrypt(h,m,v.subarray(32,64));return Kn(v.subarray(32)),{cipherText:g,sharedSecret:v.subarray(0,32)}},decapsulate:(h,m)=>{Je(m,a.bytesLen,"secretKey"),Je(h,s.cipherText,"cipherText");let p=a.bytesLen-96,d=p+32,v=n(m.subarray(p/2,d));if(!Xm(v,m.subarray(d,d+32)))throw new Error("invalid secretKey: hash check failed");let[g,y,w,E]=a.decode(m),C=t.decrypt(h,g),_=r.create().update(C).update(w).digest(),F=_.subarray(0,32),H=t.encrypt(y,C,_.subarray(32,64)),K=Xm(h,H),S=i.create({dkLen:32}).update(E).update(h).digest();return Kn(C,H,K?S:F),K?F:S}}}function Vz(e,t,n){return Bo.create({dkLen:e}).update(t).update(new Uint8Array([n])).digest()}var Sb={HASH256:Zc,HASH512:zF,KDF:Bo,XOF:tB,PRF:Vz},_0e=Ab({...Sb,...bb[512]}),ep=Ab({...Sb,...bb[768]}),rB=Ab({...Sb,...bb[1024]});function Gz(e,t=!1){let n=e.lengths,r=e.keygen;if(t){let o=e.Point.Fn;if(!o)throw new Error("No Point.Fn");r=(s=Io(n.seed))=>{Je(s,n.seed,"seed");let a=o.isLE?qu(s):Mu(s),u=o.toBytes(o.create(a));return{secretKey:u,publicKey:e.getPublicKey(u)}}}return{lengths:{secretKey:n.secretKey,publicKey:n.publicKey,seed:n.seed},keygen:r,getPublicKey:i=>e.getPublicKey(i)}}function Cb(e,t=!1){let n=Gz(e,t);if(!e.getSharedSecret)throw new Error("wrong curve");return{lengths:{...n.lengths,msg:n.lengths.seed,cipherText:n.lengths.publicKey},keygen:n.keygen,getPublicKey:n.getPublicKey,encapsulate(r,i=Io(e.lengths.seed)){let o=this.keygen(i).secretKey,s=this.decapsulate(r,o),a=e.getPublicKey(o);return Kn(o),{sharedSecret:s,cipherText:a}},decapsulate(r,i){let o=e.getSharedSecret(i,r);return e.lengths.publicKeyHasPrefix?o.subarray(1):o}}}function tp(e,t){return Jc(t,...e.map(n=>{if(typeof n.lengths[t]!="number")throw new Error("wrong length: "+t);return n.lengths[t]}))}function _b(e){return(t,n)=>e(t,{dkLen:n})}function zz(e,t,...n){let r=tp(n,"seed"),i=tp(n,"publicKey");e===void 0&&(e=r.bytesLen),Qn(e);function o(s){Je(s,e);let a=r.decode(t(s,r.bytesLen)),u=n.map((m,p)=>m.keygen(a[p])),l=u.map(m=>m.secretKey),h=u.map(m=>m.publicKey);return{secretKey:l,publicKey:h}}return{info:{lengths:{seed:e,publicKey:i.bytesLen,secretKey:e}},getPublicKey(s){return this.keygen(s).publicKey},keygen(s=Io(e)){let{publicKey:a,secretKey:u}=o(s),l=i.encode(a);return Kn(a),Kn(u),{secretKey:s,publicKey:l}},expandDecapsulationKey:o,realSeedLen:e}}function Qm(e,t,n,r,...i){let o=zz(e,n,...i),s=tp(i,"cipherText"),a=tp(i,"publicKey"),u=tp(i,"msg");return t===void 0&&(t=u.bytesLen),Qn(t),{lengths:{...o.info.lengths,msg:t,msgRand:u.bytesLen,cipherText:s.bytesLen},getPublicKey:o.getPublicKey,keygen:o.keygen,encapsulate(l,h=Io(u.bytesLen)){let m=a.decode(l),p=u.decode(h),d=i.map((w,E)=>w.encapsulate(m[E],p[E])),v=d.map(w=>w.sharedSecret),g=d.map(w=>w.cipherText),y={sharedSecret:r(m,g,v),cipherText:s.encode(g)};return Kn(v,g),y},decapsulate(l,h){let m=s.decode(l),{publicKey:p,secretKey:d}=o.expandDecapsulationKey(h),v=i.map((g,y)=>g.decapsulate(m[y],d[y]));return r(p,m,v)}}}function sB(e,t,n,r,i){return oi(r),oi(i),Qm(32,32,_b(r),(o,s,a)=>i(Pn(a[0],a[1],s[1],o[1],ju(e))),t,n)}var N0e=sB("QSF-KEM(ML-KEM-768,P-256)-XOF(SHAKE256)-KDF(SHA3-256)",ep,Cb(mb,!0),Bo,Zc),L0e=sB("QSF-KEM(ML-KEM-1024,P-384)-XOF(SHAKE256)-KDF(SHA3-256)",rB,Cb(OF,!0),Bo,Zc);function Wz(e,t,n,r,i){return oi(r),oi(i),Qm(32,32,_b(r),(o,s,a)=>{let u=Pn(a[0],a[1],s[0],o[0],s[1],o[1],ju(e)),l=32,h=Pn(ju("hybrid_prk"),u),m=LF(i,h),p=Pn($f(l,2),ju("shared_secret"),ju("")),d=UF(i,m,p,l);return Kn(m,p,h,u),d},t,n)}var iB=Cb(RF),U0e=Wz("KitchenSink-KEM(ML-KEM-768,X25519)-XOF(SHAKE256)-KDF(HKDF-SHA-256)",ep,iB,Bo,Wm),Yz=Qm(32,32,_b(Bo),(e,t,n)=>Zc(Pn(n[0],n[1],t[1],e[1],ju("\\.//^\\"))),ep,iB);function Xz(e,t,n,r){let i=e.Point.Fn;if(!i)throw new Error("no Point.Fn");function o(s){let a;for(let h=0,m=t;;h=m,m+=t){if(m>s.length)throw new Error("rejection sampling failed");if(a=i.fromBytes(s.subarray(h,m),!0),i.isValidNot0(a))break}let u=i.toBytes(i.create(a)),l=e.getPublicKey(u,!1);return{secretKey:u,publicKey:l}}return{lengths:{secretKey:t,publicKey:n,seed:r,msg:r,cipherText:n},keygen(s=Io(r)){return Je(s,r,"seed"),o(s)},getPublicKey(s){return e.getPublicKey(s,!1)},encapsulate(s,a=Io(r)){Je(a,r,"rand");let{secretKey:u}=o(a),l=this.decapsulate(s,u),h=e.getPublicKey(u,!1);return Kn(u),{sharedSecret:l,cipherText:h}},decapsulate(s,a){return e.getSharedSecret(a,s).subarray(1)}}}function Zz(e,t,n,r){let{secretKey:i,publicKeyUncompressed:o}=n.lengths;if(!i||!o)throw new Error("wrong curve");let s=Xz(n,i,o,r),a=64,u=a+r;return Qm(32,32,l=>{Je(l,32);let h=Bo(l,{dkLen:u}),m=h.subarray(0,a),p=h.subarray(a,u);return Pn(m,p)},(l,h,m)=>Zc(Pn(m[0],m[1],h[1],l[1],ju(e))),t,s)}var Jz=Zz("MLKEM768-P256",ep,mb,128);var eg=Yz,oB=Jz;var p1e=B(x(),1);var K0e=B(x(),1);var en=(e,t,n)=>ir(e,t,n),Fb=Dn,Rf=Dm,cr=(...e)=>wE(...e),Of=e=>xd(e),Nf=mE,Lf=e=>Tu(e),ng=BigInt(0),Db=BigInt(1);function Pa(e,t=""){if(typeof e!="boolean"){let n=t&&`"${t}" `;throw new TypeError(n+"expected boolean, got type="+typeof e)}return e}function rg(e){if(typeof e=="bigint"){if(!tg(e))throw new RangeError("positive bigint expected, got "+e)}else Fb(e);return e}function $o(e,t=""){if(typeof e!="number"){let n=t&&`"${t}" `;throw new TypeError(n+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let n=t&&`"${t}" `;throw new RangeError(n+"expected safe integer, got "+e)}}function np(e){let t=rg(e).toString(16);return t.length&1?"0"+t:t}function aB(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?ng:BigInt("0x"+e)}function tl(e){return aB(Dm(e))}function Hi(e){return aB(Dm(Wu(ir(e)).reverse()))}function sg(e,t){if(Dn(t),t===0)throw new RangeError("zero length");e=rg(e);let n=e.toString(16);if(n.length>t*2)throw new RangeError("number too large");return xd(n.padStart(t*2,"0"))}function rp(e,t){return sg(e,t).reverse()}function uB(e,t){if(e=en(e),t=en(t),e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function Wu(e){return Uint8Array.from(en(e))}function ig(e){if(typeof e!="string")throw new TypeError("ascii string expected, got "+typeof e);return Uint8Array.from(e,(t,n)=>{let r=t.charCodeAt(0);if(t.length!==1||r>127)throw new RangeError(`string contains non-ASCII character "${e[n]}" with code ${r} at position ${n}`);return r})}var tg=e=>typeof e=="bigint"&&ng<=e;function Qz(e,t,n){return tg(e)&&tg(t)&&tg(n)&&t<=e&&e<n}function ka(e,t,n,r){if(!Qz(t,n,r))throw new RangeError("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Uf(e){if(e<ng)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>ng;e>>=Db,t+=1);return t}var sp=e=>(Db<<BigInt(e))-Db;function cB(e,t,n){if(Dn(e,"hashLen"),Dn(t,"qByteLen"),typeof n!="function")throw new TypeError("hmacFn must be a function");let r=y=>new Uint8Array(y),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1),a=1e3,u=r(e),l=r(e),h=0,m=()=>{u.fill(1),l.fill(0),h=0},p=(...y)=>n(l,cr(u,...y)),d=(y=i)=>{l=p(o,y),u=p(),y.length!==0&&(l=p(s,y),u=p())},v=()=>{if(h++>=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 cr(...w)};return(y,w)=>{m(),d(y);let E;for(;(E=w(v()))===void 0;)d();return m(),E}}function ui(e,t={},n={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function r(o,s,a){if(!a&&s!=="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!==s||u===null)throw new TypeError(`param "${o}" is invalid: expected ${s}, got ${l}`)}let i=(o,s)=>Object.entries(o).forEach(([a,u])=>r(a,u,s));i(t,!1),i(n,!0)}var Bb=()=>{throw new Error("not implemented")};var Z0e=B(x(),1);var z0e=B(x(),1);var lr=BigInt(0),gn=BigInt(1),nl=BigInt(2),dB=BigInt(3),pB=BigInt(4),mB=BigInt(5),eW=BigInt(7),gB=BigInt(8),tW=BigInt(9),vB=BigInt(16);function an(e,t){if(t<=lr)throw new Error("mod: expected positive modulus, got "+t);let n=e%t;return n>=lr?n:t+n}function ci(e,t,n){if(t<lr)throw new Error("pow2: expected non-negative exponent, got "+t);let r=e;for(;t-- >lr;)r*=r,r%=n;return r}function lB(e,t){if(e===lr)throw new Error("invert: expected non-zero number");if(t<=lr)throw new Error("invert: expected positive modulus, got "+t);let n=an(e,t),r=t,i=lr,o=gn,s=gn,a=lr;for(;n!==lr;){let l=r/n,h=r-n*l,m=i-s*l,p=o-a*l;r=n,n=h,i=s,o=a,s=m,a=p}if(r!==gn)throw new Error("invert: does not exist");return an(i,t)}function Ib(e,t,n){let r=e;if(!r.eql(r.sqr(t),n))throw new Error("Cannot find square root")}function wB(e,t){let n=e,r=(n.ORDER+gn)/pB,i=n.pow(t,r);return Ib(n,i,t),i}function nW(e,t){let n=e,r=(n.ORDER-mB)/gB,i=n.mul(t,nl),o=n.pow(i,r),s=n.mul(t,o),a=n.mul(n.mul(s,nl),o),u=n.mul(s,n.sub(a,n.ONE));return Ib(n,u,t),u}function rW(e){let t=ag(e),n=yB(e),r=n(t,t.neg(t.ONE)),i=n(t,r),o=n(t,t.neg(r)),s=(e+eW)/vB;return((a,u)=>{let l=a,h=l.pow(u,s),m=l.mul(h,r),p=l.mul(h,i),d=l.mul(h,o),v=l.eql(l.sqr(m),u),g=l.eql(l.sqr(p),u);h=l.cmov(h,m,v),m=l.cmov(d,p,g);let y=l.eql(l.sqr(m),u),w=l.cmov(h,m,y);return Ib(l,w,u),w})}function yB(e){if(e<dB)throw new Error("sqrt is not defined for small field");let t=e-gn,n=0;for(;t%nl===lr;)t/=nl,n++;let r=nl,i=ag(e);for(;fB(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return wB;let o=i.pow(r,t),s=(t+gn)/nl;return function(u,l){let h=u;if(h.is0(l))return l;if(fB(h,l)!==1)throw new Error("Cannot find square root");let m=n,p=h.mul(h.ONE,o),d=h.pow(l,t),v=h.pow(l,s);for(;!h.eql(d,h.ONE);){if(h.is0(d))return h.ZERO;let g=1,y=h.sqr(d);for(;!h.eql(y,h.ONE);)if(g++,y=h.sqr(y),g===m)throw new Error("Cannot find square root");let w=gn<<BigInt(m-g-1),E=h.pow(p,w);m=g,p=h.sqr(E),d=h.mul(d,p),v=h.mul(v,E)}return v}}function sW(e){return e%pB===dB?wB:e%gB===mB?nW:e%vB===tW?rW(e):yB(e)}var Ta=(e,t)=>(an(e,t)&gn)===gn,iW=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function $b(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},n=iW.reduce((r,i)=>(r[i]="function",r),t);if(ui(e,n),$o(e.BYTES,"BYTES"),$o(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=gn)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function oW(e,t,n){let r=e;if(n<lr)throw new Error("invalid exponent, negatives unsupported");if(n===lr)return r.ONE;if(n===gn)return t;let i=r.ONE,o=t;for(;n>lr;)n&gn&&(i=r.mul(i,o)),o=r.sqr(o),n>>=gn;return i}function ip(e,t,n=!1){let r=e,i=new Array(t.length).fill(n?r.ZERO:void 0),o=t.reduce((a,u,l)=>r.is0(u)?a:(i[l]=a,r.mul(a,u)),r.ONE),s=r.inv(o);return t.reduceRight((a,u,l)=>r.is0(u)?a:(i[l]=r.mul(a,i[l]),r.mul(a,u)),s),i}function fB(e,t){let n=e,r=(n.ORDER-gn)/nl,i=n.pow(t,r),o=n.eql(i,n.ONE),s=n.eql(i,n.ZERO),a=n.eql(i,n.neg(n.ONE));if(!o&&!s&&!a)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function aW(e,t){if(t!==void 0&&Fb(t),e<=lr)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 n=Uf(e);if(t!==void 0&&t<n)throw new Error(`invalid n length: expected bit length (${n}) >= n.length (${t})`);let r=t!==void 0?t:n,i=Math.ceil(r/8);return{nBitLength:r,nByteLength:i}}var hB=new WeakMap,og=class{ORDER;BITS;BYTES;isLE;ZERO=lr;ONE=gn;_lengths;_mod;constructor(t,n={}){if(t<=gn)throw new Error("invalid field: expected ORDER > 1, got "+t);let r;this.isLE=!1,n!=null&&typeof n=="object"&&(typeof n.BITS=="number"&&(r=n.BITS),typeof n.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:n.sqrt,enumerable:!0}),typeof n.isLE=="boolean"&&(this.isLE=n.isLE),n.allowedLengths&&(this._lengths=Object.freeze(n.allowedLengths.slice())),typeof n.modFromBytes=="boolean"&&(this._mod=n.modFromBytes));let{nBitLength:i,nByteLength:o}=aW(t,r);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=o,Object.freeze(this)}create(t){return an(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return lr<=t&&t<this.ORDER}is0(t){return t===lr}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&gn)===gn}neg(t){return an(-t,this.ORDER)}eql(t,n){return t===n}sqr(t){return an(t*t,this.ORDER)}add(t,n){return an(t+n,this.ORDER)}sub(t,n){return an(t-n,this.ORDER)}mul(t,n){return an(t*n,this.ORDER)}pow(t,n){return oW(this,t,n)}div(t,n){return an(t*lB(n,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,n){return t+n}subN(t,n){return t-n}mulN(t,n){return t*n}inv(t){return lB(t,this.ORDER)}sqrt(t){let n=hB.get(this);return n||hB.set(this,n=sW(this.ORDER)),n(this,t)}toBytes(t){return this.isLE?rp(t,this.BYTES):sg(t,this.BYTES)}fromBytes(t,n=!1){en(t);let{_lengths:r,BYTES:i,isLE:o,ORDER:s,_mod:a}=this;if(r){if(t.length<1||!r.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let l=new Uint8Array(i);l.set(t,o?0:l.length-t.length),t=l}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let u=o?Hi(t):tl(t);if(a&&(u=an(u,s)),!n&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(t){return ip(this,t)}cmov(t,n,r){return Pa(r,"condition"),r?n:t}};Object.freeze(og.prototype);function ag(e,t={}){return new og(e,t)}function EB(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=gn)throw new Error("field order must be greater than 1");let t=Uf(e-gn);return Math.ceil(t/8)}function xb(e){let t=EB(e);return t+Math.ceil(t/2)}function bB(e,t,n=!1){en(e);let r=e.length,i=EB(t),o=Math.max(xb(t),16);if(r<o||r>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);let s=n?Hi(e):tl(e),a=an(s,t-gn)+gn;return n?rp(a,i):sg(a,i)}var Hf=BigInt(0),rl=BigInt(1);function op(e,t){let n=t.negate();return e?n:t}function sl(e,t){let n=ip(e.Fp,t.map(r=>r.Z));return t.map((r,i)=>e.fromAffine(r.toAffine(n[i])))}function _B(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Pb(e,t){_B(e,t);let n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,o=sp(e),s=BigInt(e);return{windows:n,windowSize:r,mask:o,maxNumber:i,shiftBy:s}}function AB(e,t,n){let{windowSize:r,mask:i,maxNumber:o,shiftBy:s}=n,a=Number(e&i),u=e>>s;a>r&&(a-=o,u+=rl);let l=t*r,h=l+Math.abs(a)-1,m=a===0,p=a<0,d=t%2!==0;return{nextN:u,offset:h,isZero:m,isNeg:p,isNegF:d,offsetF:l}}var kb=new WeakMap,DB=new WeakMap;function Tb(e){return DB.get(e)||1}function SB(e){if(e!==Hf)throw new Error("invalid wNAF")}var Mf=class{BASE;ZERO;Fn;bits;constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let i=t;for(;n>Hf;)n&rl&&(r=r.add(i)),i=i.double(),n>>=rl;return r}precomputeWindow(t,n){let{windows:r,windowSize:i}=Pb(n,this.bits),o=[],s=t,a=s;for(let u=0;u<r;u++){a=s,o.push(a);for(let l=1;l<i;l++)a=a.add(s),o.push(a);s=a.double()}return o}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,o=this.BASE,s=Pb(t,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:l,isZero:h,isNeg:m,isNegF:p,offsetF:d}=AB(r,a,s);r=u,h?o=o.add(op(p,n[d])):i=i.add(op(m,n[l]))}return SB(r),{p:i,f:o}}wNAFUnsafe(t,n,r,i=this.ZERO){let o=Pb(t,this.bits);for(let s=0;s<o.windows&&r!==Hf;s++){let{nextN:a,offset:u,isZero:l,isNeg:h}=AB(r,s,o);if(r=a,!l){let m=n[u];i=i.add(h?m.negate():m)}}return SB(r),i}getPrecomputes(t,n,r){let i=kb.get(n);return i||(i=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(i=r(i)),kb.set(n,i))),i}cached(t,n,r){let i=Tb(t);return this.wNAF(i,this.getPrecomputes(i,t,r),n)}unsafe(t,n,r,i){let o=Tb(t);return o===1?this._unsafeLadder(t,n,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),n,i)}createCache(t,n){_B(n,this.bits),DB.set(t,n),kb.delete(t)}hasCache(t){return Tb(t)!==1}};function FB(e,t,n,r){let i=t,o=e.ZERO,s=e.ZERO;for(;n>Hf||r>Hf;)n&rl&&(o=o.add(i)),r&rl&&(s=s.add(i)),i=i.double(),n>>=rl,r>>=rl;return{p1:o,p2:s}}function CB(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return $b(t),t}else return ag(e,{isLE:n})}function ug(e,t,n={},r){if(r===void 0&&(r=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>Hf))throw new Error(`CURVE.${u} must be positive bigint`)}let i=CB(t.p,n.Fp,r),o=CB(t.n,n.Fn,r),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let u of a)if(!i.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:i,Fn:o}}function ap(e,t){return function(r){let i=e(r);return{secretKey:i,publicKey:t(i)}}}var e1e=B(x(),1);function up(e,t){if($o(e),$o(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 n=Array.from({length:t}).fill(0);for(let r=t-1;r>=0;r--)n[r]=e&255,e>>>=8;return new Uint8Array(n)}function uW(e,t){let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r];return n}function cW(e){if(!Nf(e)&&typeof e!="string")throw new Error("DST must be Uint8Array or ascii string");let t=typeof e=="string"?ig(e):e;if(t.length===0)throw new Error("DST must be non-empty");return t}function Rb(e,t,n,r){en(e),$o(n),t=cW(t),t.length>255&&(t=r(cr(ig("H2C-OVERSIZE-DST-"),t)));let{outputLen:i,blockLen:o}=r,s=Math.ceil(n/i);if(n>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");let a=cr(t,up(t.length,1)),u=new Uint8Array(o),l=up(n,2),h=new Array(s),m=r(cr(u,e,l,up(0,1),a));h[0]=r(cr(m,up(1,1),a));for(let d=1;d<s;d++){let v=[uW(m,h[d-1]),up(d+1,1),a];h[d]=r(cr(...v))}return cr(...h).slice(0,n)}var BB="HashToScalar-";var u1e=B(x(),1);var IB=(e,t)=>(e+(e>=0?t:-t)/$B)/t;function lW(e,t,n){ka("scalar",e,xo,n);let[[r,i],[o,s]]=t,a=IB(s*e,n),u=IB(-i*e,n),l=e-a*r-u*o,h=-a*i-u*s,m=l<xo,p=h<xo;m&&(l=-l),p&&(h=-h);let d=sp(Math.ceil(Uf(n)/2))+Yu;if(l<xo||l>=d||h<xo||h>=d)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:l,k2neg:p,k2:h}}function Nb(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Ob(e,t){ui(e);let n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Pa(n.lowS,"lowS"),Pa(n.prehash,"prehash"),n.format!==void 0&&Nb(n.format),n}var Lb=class extends Error{constructor(t=""){super(t)}},Mi={Err:Lb,_tlv:{encode:(e,t)=>{let{Err:n}=Mi;if($o(e,"tag"),e<0||e>255)throw new n("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new n("tlv.encode: unpadded data");let r=t.length/2,i=np(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");let o=r>127?np(i.length/2|128):"";return np(e)+o+i+t},decode(e,t){let{Err:n}=Mi;t=en(t,void 0,"DER data");let r=0;if(e<0||e>255)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");let i=t[r++],o=!!(i&128),s=0;if(!o)s=i;else{let u=i&127;if(!u)throw new n("tlv.decode(long): indefinite length not supported");if(u>4)throw new n("tlv.decode(long): byte length is too big");let l=t.subarray(r,r+u);if(l.length!==u)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(let h of l)s=s<<8|h;if(r+=u,s<128)throw new n("tlv.decode(long): not minimal encoding")}let a=t.subarray(r,r+s);if(a.length!==s)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+s)}}},_int:{encode(e){let{Err:t}=Mi;if(rg(e),e<xo)throw new t("integer: negative integers are not allowed");let n=np(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){let{Err:t}=Mi;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 tl(e)}},toSig(e){let{Err:t,_int:n,_tlv:r}=Mi,i=en(e,void 0,"signature"),{v:o,l:s}=r.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:u}=r.decode(2,o),{v:l,l:h}=r.decode(2,u);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){let{_tlv:t,_int:n}=Mi,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),o=r+i;return t.encode(48,o)}};Object.freeze(Mi._tlv);Object.freeze(Mi._int);Object.freeze(Mi);var xo=BigInt(0),Yu=BigInt(1),$B=BigInt(2),cg=BigInt(3),fW=BigInt(4);function xB(e,t={}){let n=ug("weierstrass",e,t),r=n.Fp,i=n.Fn,o=n.CURVE,{h:s,n:a}=o;ui(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:u,allowInfinityPoint:l}=t;if(u&&(!r.is0(o.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let h=kB(r,i);function m(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function p(L,T,O){if(l&&T.is0())return Uint8Array.of(0);let{x:R,y:N}=T.toAffine(),P=r.toBytes(R);if(Pa(O,"isCompressed"),O){m();let M=!r.isOdd(N);return cr(PB(M),P)}else return cr(Uint8Array.of(4),P,r.toBytes(N))}function d(L){en(L,void 0,"Point");let{publicKey:T,publicKeyUncompressed:O}=h,R=L.length,N=L[0],P=L.subarray(1);if(l&&R===1&&N===0)return{x:r.ZERO,y:r.ZERO};if(R===T&&(N===2||N===3)){let M=r.fromBytes(P);if(!r.isValid(M))throw new Error("bad point: is not on curve, wrong x");let Y=y(M),V;try{V=r.sqrt(Y)}catch(ae){let me=ae instanceof Error?": "+ae.message:"";throw new Error("bad point: is not on curve, sqrt error"+me)}m();let X=r.isOdd(V);return(N&1)===1!==X&&(V=r.neg(V)),{x:M,y:V}}else if(R===O&&N===4){let M=r.BYTES,Y=r.fromBytes(P.subarray(0,M)),V=r.fromBytes(P.subarray(M,M*2));if(!w(Y,V))throw new Error("bad point: is not on curve");return{x:Y,y:V}}else throw new Error(`bad point: got length ${R}, expected compressed=${T} or uncompressed=${O}`)}let v=t.toBytes===void 0?p:t.toBytes,g=t.fromBytes===void 0?d:t.fromBytes;function y(L){let T=r.sqr(L),O=r.mul(T,L);return r.add(r.add(O,r.mul(L,o.a)),o.b)}function w(L,T){let O=r.sqr(T),R=y(L);return r.eql(O,R)}if(!w(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let E=r.mul(r.pow(o.a,cg),fW),C=r.mul(r.sqr(o.b),BigInt(27));if(r.is0(r.add(E,C)))throw new Error("bad curve params: a or b");function _(L,T,O=!1){if(!r.isValid(T)||O&&r.is0(T))throw new Error(`bad point coordinate ${L}`);return T}function F(L){if(!(L instanceof S))throw new Error("Weierstrass Point expected")}function H(L){if(!u||!u.basises)throw new Error("no endo");return lW(L,u.basises,i.ORDER)}function K(L,T,O,R,N){return O=new S(r.mul(O.X,L),O.Y,O.Z),T=op(R,T),O=op(N,O),T.add(O)}class S{static BASE=new S(o.Gx,o.Gy,r.ONE);static ZERO=new S(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(T,O,R){this.X=_("x",T),this.Y=_("y",O,!0),this.Z=_("z",R),Object.freeze(this)}static CURVE(){return o}static fromAffine(T){let{x:O,y:R}=T||{};if(!T||!r.isValid(O)||!r.isValid(R))throw new Error("invalid affine point");if(T instanceof S)throw new Error("projective point not allowed");return r.is0(O)&&r.is0(R)?S.ZERO:new S(O,R,r.ONE)}static fromBytes(T){let O=S.fromAffine(g(en(T,void 0,"point")));return O.assertValidity(),O}static fromHex(T){return S.fromBytes(Of(T))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(T=8,O=!0){return q.createCache(this,T),O||this.multiply(cg),this}assertValidity(){let T=this;if(T.is0()){if(t.allowInfinityPoint&&r.is0(T.X)&&r.eql(T.Y,r.ONE)&&r.is0(T.Z))return;throw new Error("bad point: ZERO")}let{x:O,y:R}=T.toAffine();if(!r.isValid(O)||!r.isValid(R))throw new Error("bad point: x or y not field elements");if(!w(O,R))throw new Error("bad point: equation left != right");if(!T.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:T}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(T)}equals(T){F(T);let{X:O,Y:R,Z:N}=this,{X:P,Y:M,Z:Y}=T,V=r.eql(r.mul(O,Y),r.mul(P,N)),X=r.eql(r.mul(R,Y),r.mul(M,N));return V&&X}negate(){return new S(this.X,r.neg(this.Y),this.Z)}double(){let{a:T,b:O}=o,R=r.mul(O,cg),{X:N,Y:P,Z:M}=this,Y=r.ZERO,V=r.ZERO,X=r.ZERO,te=r.mul(N,N),ae=r.mul(P,P),me=r.mul(M,M),he=r.mul(N,P);return he=r.add(he,he),X=r.mul(N,M),X=r.add(X,X),Y=r.mul(T,X),V=r.mul(R,me),V=r.add(Y,V),Y=r.sub(ae,V),V=r.add(ae,V),V=r.mul(Y,V),Y=r.mul(he,Y),X=r.mul(R,X),me=r.mul(T,me),he=r.sub(te,me),he=r.mul(T,he),he=r.add(he,X),X=r.add(te,te),te=r.add(X,te),te=r.add(te,me),te=r.mul(te,he),V=r.add(V,te),me=r.mul(P,M),me=r.add(me,me),te=r.mul(me,he),Y=r.sub(Y,te),X=r.mul(me,ae),X=r.add(X,X),X=r.add(X,X),new S(Y,V,X)}add(T){F(T);let{X:O,Y:R,Z:N}=this,{X:P,Y:M,Z:Y}=T,V=r.ZERO,X=r.ZERO,te=r.ZERO,ae=o.a,me=r.mul(o.b,cg),he=r.mul(O,P),De=r.mul(R,M),Pe=r.mul(N,Y),Ie=r.add(O,R),se=r.add(P,M);Ie=r.mul(Ie,se),se=r.add(he,De),Ie=r.sub(Ie,se),se=r.add(O,N);let pe=r.add(P,Y);return se=r.mul(se,pe),pe=r.add(he,Pe),se=r.sub(se,pe),pe=r.add(R,N),V=r.add(M,Y),pe=r.mul(pe,V),V=r.add(De,Pe),pe=r.sub(pe,V),te=r.mul(ae,se),V=r.mul(me,Pe),te=r.add(V,te),V=r.sub(De,te),te=r.add(De,te),X=r.mul(V,te),De=r.add(he,he),De=r.add(De,he),Pe=r.mul(ae,Pe),se=r.mul(me,se),De=r.add(De,Pe),Pe=r.sub(he,Pe),Pe=r.mul(ae,Pe),se=r.add(se,Pe),he=r.mul(De,se),X=r.add(X,he),he=r.mul(pe,se),V=r.mul(Ie,V),V=r.sub(V,he),he=r.mul(Ie,De),te=r.mul(pe,te),te=r.add(te,he),new S(V,X,te)}subtract(T){return F(T),this.add(T.negate())}is0(){return this.equals(S.ZERO)}multiply(T){let{endo:O}=t;if(!i.isValidNot0(T))throw new RangeError("invalid scalar: out of range");let R,N,P=M=>q.cached(this,M,Y=>sl(S,Y));if(O){let{k1neg:M,k1:Y,k2neg:V,k2:X}=H(T),{p:te,f:ae}=P(Y),{p:me,f:he}=P(X);N=ae.add(he),R=K(O.beta,te,me,M,V)}else{let{p:M,f:Y}=P(T);R=M,N=Y}return sl(S,[R,N])[0]}multiplyUnsafe(T){let{endo:O}=t,R=this,N=T;if(!i.isValid(N))throw new RangeError("invalid scalar: out of range");if(N===xo||R.is0())return S.ZERO;if(N===Yu)return R;if(q.hasCache(this))return this.multiply(N);if(O){let{k1neg:P,k1:M,k2neg:Y,k2:V}=H(N),{p1:X,p2:te}=FB(S,R,M,V);return K(O.beta,X,te,P,Y)}else return q.unsafe(R,N)}toAffine(T){let O=this,R=T,{X:N,Y:P,Z:M}=O;if(r.eql(M,r.ONE))return{x:N,y:P};let Y=O.is0();R==null&&(R=Y?r.ONE:r.inv(M));let V=r.mul(N,R),X=r.mul(P,R),te=r.mul(M,R);if(Y)return{x:r.ZERO,y:r.ZERO};if(!r.eql(te,r.ONE))throw new Error("invZ was invalid");return{x:V,y:X}}isTorsionFree(){let{isTorsionFree:T}=t;return s===Yu?!0:T?T(S,this):q.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:T}=t;return s===Yu?this:T?T(S,this):this.multiplyUnsafe(s)}isSmallOrder(){return s===Yu?this.is0():this.clearCofactor().is0()}toBytes(T=!0){return Pa(T,"isCompressed"),this.assertValidity(),v(S,this,T)}toHex(T=!0){return Rf(this.toBytes(T))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let I=i.BITS,q=new Mf(S,t.endo?Math.ceil(I/2):I);return I>=8&&S.BASE.precompute(8),Object.freeze(S.prototype),Object.freeze(S),S}function PB(e){return Uint8Array.of(e?2:3)}function kB(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function hW(e,t={}){let{Fn:n}=e,r=t.randomBytes===void 0?Lf:t.randomBytes,i=Object.assign(kB(e.Fp,n),{seed:Math.max(xb(n.ORDER),16)});function o(d){try{let v=n.fromBytes(d);return n.isValidNot0(v)}catch{return!1}}function s(d,v){let{publicKey:g,publicKeyUncompressed:y}=i;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?r(i.seed):d,bB(en(d,i.seed,"seed"),n.ORDER)}function u(d,v=!0){return e.BASE.multiply(n.fromBytes(d)).toBytes(v)}function l(d){let{secretKey:v,publicKey:g,publicKeyUncompressed:y}=i,w=n._lengths;if(!Nf(d))return;let E=en(d,void 0,"key").length,C=E===g||E===y,_=E===v||!!w?.includes(E);if(!(C&&_))return C}function h(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=n.fromBytes(d);return e.fromBytes(v).multiply(y).toBytes(g)}let m={isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:a},p=ap(a,u);return Object.freeze(m),Object.freeze(i),Object.freeze({getPublicKey:u,getSharedSecret:h,keygen:p,Point:e,utils:m,lengths:i})}function TB(e,t,n={}){let r=t;Ca(r),ui(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),n=Object.assign({},n);let i=n.randomBytes===void 0?Lf:n.randomBytes,o=n.hmac===void 0?(N,P)=>Co(r,N,P):n.hmac,{Fp:s,Fn:a}=e,{ORDER:u,BITS:l}=a,{keygen:h,getPublicKey:m,getSharedSecret:p,utils:d,lengths:v}=hW(e,n),g={prehash:!0,lowS:typeof n.lowS=="boolean"?n.lowS:!0,format:"compact",extraEntropy:!1},y=u*$B+Yu<s.ORDER;function w(N){let P=u>>Yu;return N>P}function E(N,P){if(!a.isValidNot0(P))throw new Error(`invalid signature ${N}: out of range 1..Point.Fn.ORDER`);return P}function C(){if(y)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function _(N,P){Nb(P);let M=v.signature,Y=P==="compact"?M:P==="recovered"?M+1:void 0;return en(N,Y)}class F{r;s;recovery;constructor(P,M,Y){if(this.r=E("r",P),this.s=E("s",M),Y!=null){if(C(),![0,1,2,3].includes(Y))throw new Error("invalid recovery id");this.recovery=Y}Object.freeze(this)}static fromBytes(P,M=g.format){_(P,M);let Y;if(M==="der"){let{r:ae,s:me}=Mi.toSig(en(P));return new F(ae,me)}M==="recovered"&&(Y=P[0],M="compact",P=P.subarray(1));let V=v.signature/2,X=P.subarray(0,V),te=P.subarray(V,V*2);return new F(a.fromBytes(X),a.fromBytes(te),Y)}static fromHex(P,M){return this.fromBytes(Of(P),M)}assertRecovery(){let{recovery:P}=this;if(P==null)throw new Error("invalid recovery id: must be present");return P}addRecoveryBit(P){return new F(this.r,this.s,P)}recoverPublicKey(P){let{r:M,s:Y}=this,V=this.assertRecovery(),X=V===2||V===3?M+u:M;if(!s.isValid(X))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let te=s.toBytes(X),ae=e.fromBytes(cr(PB((V&1)===0),te)),me=a.inv(X),he=K(en(P,void 0,"msgHash")),De=a.create(-he*me),Pe=a.create(Y*me),Ie=e.BASE.multiplyUnsafe(De).add(ae.multiplyUnsafe(Pe));if(Ie.is0())throw new Error("invalid recovery: point at infinify");return Ie.assertValidity(),Ie}hasHighS(){return w(this.s)}toBytes(P=g.format){if(Nb(P),P==="der")return Of(Mi.hexFromSig(this));let{r:M,s:Y}=this,V=a.toBytes(M),X=a.toBytes(Y);return P==="recovered"?(C(),cr(Uint8Array.of(this.assertRecovery()),V,X)):cr(V,X)}toHex(P){return Rf(this.toBytes(P))}}Object.freeze(F.prototype),Object.freeze(F);let H=n.bits2int===void 0?function(P){if(P.length>8192)throw new Error("input is too large");let M=tl(P),Y=P.length*8-l;return Y>0?M>>BigInt(Y):M}:n.bits2int,K=n.bits2int_modN===void 0?function(P){return a.create(H(P))}:n.bits2int_modN,S=sp(l);function I(N){return ka("num < 2^"+l,N,xo,S),a.toBytes(N)}function q(N,P){return en(N,void 0,"message"),P?en(r(N),void 0,"prehashed message"):N}function L(N,P,M){let{lowS:Y,prehash:V,extraEntropy:X}=Ob(M,g);N=q(N,V);let te=K(N),ae=a.fromBytes(P);if(!a.isValidNot0(ae))throw new Error("invalid private key");let me=[I(ae),I(te)];if(X!=null&&X!==!1){let Ie=X===!0?i(v.secretKey):X;me.push(en(Ie,void 0,"extraEntropy"))}let he=cr(...me),De=te;function Pe(Ie){let se=H(Ie);if(!a.isValidNot0(se))return;let pe=a.inv(se),Fe=e.BASE.multiply(se).toAffine(),Re=a.create(Fe.x);if(Re===xo)return;let Ve=a.create(pe*a.create(De+Re*ae));if(Ve===xo)return;let Oe=(Fe.x===Re?0:2)|Number(Fe.y&Yu),pt=Ve;return Y&&w(Ve)&&(pt=a.neg(Ve),Oe^=1),new F(Re,pt,y?void 0:Oe)}return{seed:he,k2sig:Pe}}function T(N,P,M={}){let{seed:Y,k2sig:V}=L(N,P,M);return cB(r.outputLen,a.BYTES,o)(Y,V).toBytes(M.format)}function O(N,P,M,Y={}){let{lowS:V,prehash:X,format:te}=Ob(Y,g);if(M=en(M,void 0,"publicKey"),P=q(P,X),!Nf(N)){let ae=N instanceof F?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+ae)}_(N,te);try{let ae=F.fromBytes(N,te),me=e.fromBytes(M);if(V&&ae.hasHighS())return!1;let{r:he,s:De}=ae,Pe=K(P),Ie=a.inv(De),se=a.create(Pe*Ie),pe=a.create(he*Ie),Fe=e.BASE.multiplyUnsafe(se).add(me.multiplyUnsafe(pe));return Fe.is0()?!1:a.create(Fe.x)===he}catch{return!1}}function R(N,P,M={}){let{prehash:Y}=Ob(M,g);return P=q(P,Y),F.fromBytes(N,"recovered").recoverPublicKey(P).toBytes()}return Object.freeze({keygen:h,getPublicKey:m,getSharedSecret:p,utils:d,lengths:v,Point:e,sign:T,verify:O,recoverPublicKey:R,Signature:F,hash:r})}var dW={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")};var pW=xB(dW),qf=TB(pW,Fn);var N1e=B(x(),1);var R1e=B(x(),1);var w1e=B(x(),1);var Xu=BigInt(0),Es=BigInt(1),Ub=BigInt(2),mW=BigInt(8);function gW(e,t,n,r){let i=e.sqr(n),o=e.sqr(r),s=e.add(e.mul(t.a,i),o),a=e.add(e.ONE,e.mul(t.d,e.mul(i,o)));return e.eql(s,a)}function RB(e,t={}){let n=t,r=ug("edwards",e,n,n.FpFnLE),{Fp:i,Fn:o}=r,s=r.CURVE,{h:a}=s;ui(n,{},{uvRatio:"function"});let u=Ub<<BigInt(o.BYTES*8)-Es,l=g=>i.create(g),h=n.uvRatio===void 0?(g,y)=>{try{return{isValid:!0,value:i.sqrt(i.div(g,y))}}catch{return{isValid:!1,value:Xu}}}:n.uvRatio;if(!gW(i,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function m(g,y,w=!1){let E=w?Es:Xu;return ka("coordinate "+g,y,E,u),y}function p(g){if(!(g instanceof d))throw new Error("EdwardsPoint expected")}class d{static BASE=new d(s.Gx,s.Gy,Es,l(s.Gx*s.Gy));static ZERO=new d(Xu,Es,Es,Xu);static Fp=i;static Fn=o;X;Y;Z;T;constructor(y,w,E,C){this.X=m("x",y),this.Y=m("y",w),this.Z=m("z",E,!0),this.T=m("t",C),Object.freeze(this)}static CURVE(){return s}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,Es,l(w*E))}static fromBytes(y,w=!1){let E=i.BYTES,{a:C,d:_}=s;y=Wu(en(y,E,"point")),Pa(w,"zip215");let F=Wu(y),H=y[E-1];F[E-1]=H&-129;let K=Hi(F),S=w?u:i.ORDER;ka("point.y",K,Xu,S);let I=l(K*K),q=l(I-Es),L=l(_*I-C),{isValid:T,value:O}=h(q,L);if(!T)throw new Error("bad point: invalid y coordinate");let R=(O&Es)===Es,N=(H&128)!==0;if(!w&&O===Xu&&N)throw new Error("bad point: x=0 and x_0=1");return N!==R&&(O=l(-O)),d.fromAffine({x:O,y:K})}static fromHex(y,w=!1){return d.fromBytes(Of(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(Ub),this}assertValidity(){let y=this,{a:w,d:E}=s;if(y.is0())throw new Error("bad point: ZERO");let{X:C,Y:_,Z:F,T:H}=y,K=l(C*C),S=l(_*_),I=l(F*F),q=l(I*I),L=l(K*w),T=l(I*l(L+S)),O=l(q+l(E*l(K*S)));if(T!==O)throw new Error("bad point: equation left != right (1)");let R=l(C*_),N=l(F*H);if(R!==N)throw new Error("bad point: equation left != right (2)")}equals(y){p(y);let{X:w,Y:E,Z:C}=this,{X:_,Y:F,Z:H}=y,K=l(w*H),S=l(_*C),I=l(E*H),q=l(F*C);return K===S&&I===q}is0(){return this.equals(d.ZERO)}negate(){return new d(l(-this.X),this.Y,this.Z,l(-this.T))}double(){let{a:y}=s,{X:w,Y:E,Z:C}=this,_=l(w*w),F=l(E*E),H=l(Ub*l(C*C)),K=l(y*_),S=w+E,I=l(l(S*S)-_-F),q=K+F,L=q-H,T=K-F,O=l(I*L),R=l(q*T),N=l(I*T),P=l(L*q);return new d(O,R,P,N)}add(y){p(y);let{a:w,d:E}=s,{X:C,Y:_,Z:F,T:H}=this,{X:K,Y:S,Z:I,T:q}=y,L=l(C*K),T=l(_*S),O=l(H*E*q),R=l(F*I),N=l((C+_)*(K+S)-L-T),P=R-O,M=R+O,Y=l(T-w*L),V=l(N*P),X=l(M*Y),te=l(N*Y),ae=l(P*M);return new d(V,X,ae,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,C=>sl(d,C));return sl(d,[w,E])[0]}multiplyUnsafe(y){if(!o.isValid(y))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return y===Xu?d.ZERO:this.is0()||y===Es?this:v.unsafe(this,y,w=>sl(d,w))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return v.unsafe(this,s.n).is0()}toAffine(y){let w=this,E=y,{X:C,Y:_,Z:F}=w,H=w.is0();E==null&&(E=H?mW:i.inv(F));let K=l(C*E),S=l(_*E),I=i.mul(F,E);if(H)return{x:Xu,y:Es};if(I!==Es)throw new Error("invZ was invalid");return{x:K,y:S}}clearCofactor(){return a===Es?this:this.multiplyUnsafe(a)}toBytes(){let{x:y,y:w}=this.toAffine(),E=i.toBytes(w);return E[E.length-1]|=y&Es?128:0,E}toHex(){return Rf(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let v=new Mf(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}var lg=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(t){this.ep=t}static fromBytes(t){Bb()}static fromHex(t){Bb()}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 Rf(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,n){return this.ep.precompute(t,n),this}};var S1e=B(x(),1);var cp=BigInt(0),jf=BigInt(1),fg=BigInt(2);function vW(e){return ui(e,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...e})}function OB(e){let t=vW(e),{P:n,type:r,adjustScalarBytes:i,powPminus2:o,randomBytes:s}=t,a=r==="x25519";if(!a&&r!=="x448")throw new Error("invalid type");let u=s===void 0?Lf:s,l=a?255:448,h=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?fg**BigInt(254):fg**BigInt(447),v=a?BigInt(8)*fg**BigInt(251)-jf:BigInt(4)*fg**BigInt(445)-jf,g=d+v+jf,y=R=>an(R,n),w=E(m);function E(R){return rp(y(R),h)}function C(R){let N=Wu(en(R,h,"uCoordinate"));return a&&(N[31]&=127),y(Hi(N))}function _(R){return Hi(i(Wu(en(R,h,"scalar"))))}function F(R,N){let P=q(C(N),_(R));if(P===cp)throw new Error("invalid private or public key received");return E(P)}function H(R){return F(R,w)}let K=H,S=F;function I(R,N,P){let M=y(R*(N-P));return N=y(N-M),P=y(P+M),{x_2:N,x_3:P}}function q(R,N){ka("u",R,cp,n),ka("scalar",N,d,g);let P=N,M=R,Y=jf,V=cp,X=R,te=jf,ae=cp;for(let he=BigInt(l-1);he>=cp;he--){let De=P>>he&jf;ae^=De,{x_2:Y,x_3:X}=I(ae,Y,X),{x_2:V,x_3:te}=I(ae,V,te),ae=De;let Pe=Y+V,Ie=y(Pe*Pe),se=Y-V,pe=y(se*se),Fe=Ie-pe,Re=X+te,Ve=X-te,Oe=y(Ve*Pe),pt=y(Re*se),Qe=Oe+pt,ct=Oe-pt;X=y(Qe*Qe),te=y(M*y(ct*ct)),Y=y(Ie*pe),V=y(Fe*(Ie+y(p*Fe)))}({x_2:Y,x_3:X}=I(ae,Y,X)),{x_2:V,x_3:te}=I(ae,V,te);let me=o(V);return y(Y*me)}let L={secretKey:h,publicKey:h,seed:h},T=R=>(R=R===void 0?u(h):R,en(R,L.seed,"seed"),R),O={randomSecretKey:T};return Object.freeze(L),Object.freeze(O),Object.freeze({keygen:ap(T,K),getSharedSecret:S,getPublicKey:K,scalarMult:F,scalarMultBase:H,utils:O,GuBytes:w.slice(),lengths:L})}var wW=BigInt(0),Ra=BigInt(1),NB=BigInt(2),yW=BigInt(3),EW=BigInt(5),bW=BigInt(8),ol=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),jb={p:ol,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:bW,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function HB(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),o=ol,a=e*e%o*e%o,u=ci(a,NB,o)*a%o,l=ci(u,Ra,o)*e%o,h=ci(l,EW,o)*l%o,m=ci(h,t,o)*h%o,p=ci(m,n,o)*m%o,d=ci(p,r,o)*p%o,v=ci(d,i,o)*d%o,g=ci(v,i,o)*d%o,y=ci(g,t,o)*h%o;return{pow_p_5_8:ci(y,NB,o)*e%o,b2:a}}function AW(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var Hb=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Kb(e,t){let n=ol,r=an(t*t*t,n),i=an(r*r*t,n),o=HB(e*i).pow_p_5_8,s=an(e*r*o,n),a=an(t*s*s,n),u=s,l=an(s*Hb,n),h=a===e,m=a===an(-e,n),p=a===an(-e*Hb,n);return h&&(s=u),(m||p)&&(s=l),Ta(s,n)&&(s=an(-s,n)),{isValid:h||m,value:s}}var il=RB(jb,{uvRatio:Kb}),Zu=il.Fp,MB=il.Fn;var hg=(()=>{let e=ol;return OB({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:n,b2:r}=HB(t);return an(ci(n,yW,e)*r,e)},adjustScalarBytes:AW})})();var Mb=Hb,SW=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),CW=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),_W=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),DW=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),LB=e=>Kb(Ra,e),FW=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),qb=e=>Zu.create(Hi(e)&FW);function UB(e){let{d:t}=jb,n=ol,r=w=>Zu.create(w),i=r(Mb*e*e),o=r((i+Ra)*_W),s=BigInt(-1),a=r((s-t*i)*r(i+t)),{isValid:u,value:l}=Kb(o,a),h=r(l*e);Ta(h,n)||(h=r(-h)),u||(l=h),u||(s=i);let m=r(s*(i-Ra)*DW-a),p=l*l,d=r((l+l)*a),v=r(m*SW),g=r(Ra-p),y=r(Ra+p);return new il(r(d*y),r(g*v),r(v*y),r(d*g))}var Ju=class e extends lg{static BASE=new e(il.BASE);static ZERO=new e(il.ZERO);static Fp=Zu;static Fn=MB;constructor(t){super(t)}static fromAffine(t){return new e(il.fromAffine(t))}assertSame(t){if(!(t instanceof e))throw new Error("RistrettoPoint expected")}init(t){return new e(t)}static fromBytes(t){ir(t,32);let{a:n,d:r}=jb,i=ol,o=_=>Zu.create(_),s=qb(t);if(!uB(Zu.toBytes(s),t)||Ta(s,i))throw new Error("invalid ristretto255 encoding 1");let a=o(s*s),u=o(Ra+n*a),l=o(Ra-n*a),h=o(u*u),m=o(l*l),p=o(n*r*h-m),{isValid:d,value:v}=LB(o(p*m)),g=o(v*l),y=o(v*g*p),w=o((s+s)*g);Ta(w,i)&&(w=o(-w));let E=o(u*y),C=o(w*E);if(!d||Ta(C,i)||E===wW)throw new Error("invalid ristretto255 encoding 2");return new e(new il(w,E,Ra,C))}static fromHex(t){return e.fromBytes(xd(t))}toBytes(){let{X:t,Y:n,Z:r,T:i}=this.ep,o=ol,s=y=>Zu.create(y),a=s(s(r+n)*s(r-n)),u=s(t*n),l=s(u*u),{value:h}=LB(s(a*l)),m=s(h*a),p=s(h*u),d=s(m*p*i),v;if(Ta(i*d,o)){let y=s(n*Mb),w=s(t*Mb);t=y,n=w,v=s(m*CW)}else v=p;Ta(t*d,o)&&(n=s(-n));let g=s((r-n)*v);return Ta(g,o)&&(g=s(-g)),Zu.toBytes(g)}equals(t){this.assertSame(t);let{X:n,Y:r}=this.ep,{X:i,Y:o}=t.ep,s=l=>Zu.create(l),a=s(n*o)===s(r*i),u=s(r*o)===s(n*i);return a||u}is0(){return this.equals(e.ZERO)}};Object.freeze(Ju.BASE);Object.freeze(Ju.ZERO);Object.freeze(Ju.prototype);Object.freeze(Ju);var BW=Object.freeze({Point:Ju,hashToCurve(e,t){let n=t?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":t.DST,r=Rb(e,n,64,$m);return BW.deriveToCurve(r)},hashToScalar(e,t={DST:BB}){let n=Rb(e,t.DST,64,$m);return MB.create(Hi(n))},deriveToCurve(e){ir(e,64);let t=qb(e.subarray(0,32)),n=UB(t),r=qb(e.subarray(32,64)),i=UB(r);return new Ju(n.add(i))}});var qB=!1,IW=!1;async function jB(e,t){if(IW)return await t();try{return await e()}catch(n){if(n instanceof ReferenceError||n instanceof DOMException&&n.name==="NotSupportedError")return await t();throw n}}async function dg(e,t){return await jB(async()=>{let n=Vb(e)?e:await xW(e),r=await crypto.subtle.importKey("raw",t,{name:"X25519"},qB,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:r},n,256))},()=>{if(Vb(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return hg.scalarMult(e,t)})}async function lp(e){return await jB(async()=>dg(e,hg.GuBytes),()=>{if(Vb(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return hg.scalarMultBase(e)})}var $W=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]);async function xW(e){if(e.length!==32)throw new Error("X25519 private key must be 32 bytes");let t=new Uint8Array([...$W,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},qB,["deriveBits"])}function Vb(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var j1e=B(x(),1);var U1e=B(x(),1);var pg=class{s;transcript=[];buf=new Uint8Array(0);constructor(t){this.s=t.getReader()}async readLine(){let t=[];for(;;){let n=this.buf.indexOf(10);if(n>=0)return t.push(this.buf.subarray(0,n)),this.transcript.push(this.buf.subarray(0,n+1)),this.buf=this.buf.subarray(n+1),kW(al(t));this.buf.length>0&&(t.push(this.buf),this.transcript.push(this.buf));let r=await this.s.read();if(r.done)return this.buf=al(t),null;this.buf=r.value}}close(){return this.s.releaseLock(),{rest:this.buf,transcript:al(this.transcript)}}};function kW(e){return e.forEach(t=>{if(t<32||t>126)throw Error("invalid non-ASCII byte in header")}),new TextDecoder().decode(e)}function al(e){let t=e.reduce(((i,o)=>i+o.length),0),n=new Uint8Array(t),r=0;for(let i of e)n.set(i,r),r+=i.length;return n}function Kf(e,...t){return e.pipeThrough(new TransformStream({start(n){for(let r of t)n.enqueue(r)}}))}function mg(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function Gb(e){if(!(e instanceof ReadableStream))throw new Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function KB(e){if(!(e instanceof ReadableStream))throw new Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function VB(e,t){let n=e.getReader(),r=[],i=0;for(;i<t;){let{done:u,value:l}=await n.read();if(u)throw Error("stream ended before reading "+t.toString()+" bytes");r.push(l),i+=l.length}n.releaseLock();let o=al(r),s=o.subarray(0,t),a=Kf(e,o.subarray(t));return{data:s,rest:a}}var qi=class{args;body;constructor(t,n){this.args=t,this.body=n}};async function TW(e){let t=await e.readLine();if(t===null)throw Error("invalid stanza");let n=t.split(" ");if(n.length<2||n.shift()!=="->")return{next:t};for(let o of n)if(o.length===0)throw Error("invalid stanza");let r=[];for(;;){let o=await e.readLine();if(o===null)throw Error("invalid stanza");let s=Pr.decode(o);if(s.length>48)throw Error("invalid stanza");if(r.push(s),s.length<48)break}let i=al(r);return{s:new qi(n,i)}}async function GB(e){let t=new pg(e),n=await t.readLine();if(n!=="age-encryption.org/v1")throw Error("invalid version "+(n??"line"));let r=[];for(;;){let{s:i,next:o}=await TW(t);if(i!==void 0){r.push(i);continue}if(!o.startsWith("--- "))throw Error("invalid header");let s=Pr.decode(o.slice(4)),{rest:a,transcript:u}=t.close(),l=u.slice(0,u.length-1-o.length+3);return{stanzas:r,headerNoMAC:l,MAC:s,headerSize:u.length,rest:Kf(e,a)}}}function zb(e){let t=[];t.push(`age-encryption.org/v1
`);for(let n of e){t.push("-> "+n.args.join(" ")+`
`);for(let r=0;r<n.body.length;r+=48){let i=r+48;i>n.body.length&&(i=n.body.length),t.push(Pr.encode(n.body.subarray(r,i))+`
`)}n.body.length%48===0&&t.push(`
`)}return t.push("---"),new TextEncoder().encode(t.join(""))}function zB(e,t){return al([zb(e),new TextEncoder().encode(" "+Pr.encode(t)+`
`)])}async function Cg(e){let t;if(YB(e))t=e;else if(e.startsWith("AGE-SECRET-KEY-PQ-1")){let r=si.decodeToBytes(e);if(r.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||r.bytes.length!==32)throw Error("invalid identity");let i=eg.getPublicKey(r.bytes);return si.encode("age1pq",si.toWords(i),!1)}else{let r=si.decodeToBytes(e);if(!e.startsWith("AGE-SECRET-KEY-1")||r.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||r.bytes.length!==32)throw Error("invalid identity");t=r.bytes}let n=await lp(t);return si.encodeFromBytes("age",n)}var vg=class{recipient;constructor(t){let n=si.decodeToBytes(t);if(!t.startsWith("age1pq1")||n.prefix.toLowerCase()!=="age1pq"||n.bytes.length!==1216)throw Error("invalid recipient");this.recipient=n.bytes}wrapFileKey(t){let{cipherText:n,sharedSecret:r}=eg.encapsulate(this.recipient),i=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:o,nonce:s}=_g(WB,r,i),a=ii(o,s).encrypt(t);return[new qi(["mlkem768x25519",Pr.encode(n)],a)]}},wg=class{identity;constructor(t){let n=si.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-PQ-1")||n.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||n.bytes.length!==32)throw Error("invalid identity");this.identity=n.bytes}unwrapFileKey(t){for(let n of t){if(n.args.length<1||n.args[0]!=="mlkem768x25519")continue;if(n.args.length!==2)throw Error("invalid mlkem768x25519 stanza");let r=Pr.decode(n.args[1]);if(r.length!==1120||n.body.length!==32)throw Error("invalid mlkem768x25519 stanza");let i=eg.decapsulate(r,this.identity),o=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:s,nonce:a}=_g(WB,i,o);try{return ii(s,a).decrypt(n.body)}catch{continue}}return null}},WB=25722,RW=80,Wb=16;function _g(e,t,n){let r=OW(e),i=gg(r,void 0,"psk_id_hash",new Uint8Array(0)),o=gg(r,void 0,"info_hash",n),s=new Uint8Array(1+i.length+o.length);s[0]=0,s.set(i,1),s.set(o,1+i.length);let a=gg(r,t,"secret",new Uint8Array(0)),u=Yb(r,a,"key",s,32),l=Yb(r,a,"base_nonce",s,12);return{key:u,nonce:l}}function OW(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 gg(e,t,n,r){let i=new Uint8Array(7+e.length+n.length+r.length),o=0;return i.set(new TextEncoder().encode("HPKE-v1"),o),o+=7,i.set(e,o),o+=e.length,i.set(new TextEncoder().encode(n),o),o+=n.length,i.set(r,o),Pd(Fn,i,t)}function Yb(e,t,n,r,i){let o=new Uint8Array(9+e.length+n.length+r.length),s=0;return o[s]=i>>8&255,o[s+1]=i&255,s+=2,o.set(new TextEncoder().encode("HPKE-v1"),s),s+=7,o.set(e,s),s+=e.length,o.set(new TextEncoder().encode(n),s),s+=n.length,o.set(r,s),AE(Fn,t,o,i)}function NW(e){e.length!==qf.lengths.publicKeyUncompressed&&(e=qf.Point.fromBytes(e).toBytes(!1));let t=qf.utils.randomSecretKey(),n=qf.getPublicKey(t,!1),r=qf.getSharedSecret(t,e,!0).subarray(1),i=new Uint8Array(n.length+e.length);i.set(n,0),i.set(e,n.length);let o=new Uint8Array(5);o.set(new TextEncoder().encode("KEM"),0),o[3]=Wb>>8,o[4]=Wb&255;let s=gg(o,void 0,"eae_prk",r),a=Yb(o,s,"shared_secret",i,32);return{encapsulatedKey:n,sharedSecret:a}}var yg=class{recipient;constructor(t){let n=si.decodeToBytes(t);if(!t.startsWith("age1tag1")||n.prefix.toLowerCase()!=="age1tag"||n.bytes.length!==33)throw Error("invalid recipient");this.recipient=n.bytes}wrapFileKey(t){let{encapsulatedKey:n,sharedSecret:r}=NW(this.recipient),i=new TextEncoder().encode("age-encryption.org/p256tag"),o=(()=>{let l=Fn(this.recipient).subarray(0,4),h=new Uint8Array(n.length+l.length);return h.set(n,0),h.set(l,n.length),Pd(Fn,h,i).subarray(0,4)})(),{key:s,nonce:a}=_g(Wb,r,i),u=ii(s,a).encrypt(t);return[new qi(["p256tag",Pr.encode(o),Pr.encode(n)],u)]}},Eg=class{recipient;constructor(t){let n=si.decodeToBytes(t);if(!t.startsWith("age1tagpq1")||n.prefix.toLowerCase()!=="age1tagpq"||n.bytes.length!==1249)throw Error("invalid recipient");this.recipient=n.bytes}wrapFileKey(t){let{cipherText:n,sharedSecret:r}=oB.encapsulate(this.recipient),i=new TextEncoder().encode("age-encryption.org/mlkem768p256tag"),o=(()=>{let l=Fn(this.recipient.subarray(1184)).subarray(0,4),h=new Uint8Array(n.length+l.length);return h.set(n,0),h.set(l,n.length),Pd(Fn,h,i).subarray(0,4)})(),{key:s,nonce:a}=_g(RW,r,i),u=ii(s,a).encrypt(t);return[new qi(["mlkem768p256tag",Pr.encode(o),Pr.encode(n)],u)]}},bg=class{recipient;constructor(t){let n=si.decodeToBytes(t);if(!t.startsWith("age1")||n.prefix.toLowerCase()!=="age"||n.bytes.length!==32)throw Error("invalid recipient");this.recipient=n.bytes}async wrapFileKey(t){let n=Tu(32),r=await lp(n),i=await dg(n,this.recipient),o=new Uint8Array(r.length+this.recipient.length);o.set(r),o.set(this.recipient,r.length);let s=new TextEncoder().encode("age-encryption.org/v1/X25519"),a=Ru(Fn,i,o,s,32);return[new qi(["X25519",Pr.encode(r)],Xb(t,a))]}},fp=class{identity;recipient;constructor(t){if(YB(t)){this.identity=t,this.recipient=lp(t);return}let n=si.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-1")||n.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||n.bytes.length!==32)throw Error("invalid identity");this.identity=n.bytes,this.recipient=lp(n.bytes)}async unwrapFileKey(t){for(let n of t){if(n.args.length<1||n.args[0]!=="X25519")continue;if(n.args.length!==2)throw Error("invalid X25519 stanza");let r=Pr.decode(n.args[1]);if(r.length!==32)throw Error("invalid X25519 stanza");let i=await dg(this.identity,r),o=await this.recipient,s=new Uint8Array(r.length+o.length);s.set(r),s.set(o,r.length);let a=new TextEncoder().encode("age-encryption.org/v1/X25519"),u=Ru(Fn,i,s,a,32),l=Zb(n.body,u);if(l!==null)return l}return null}},Ag=class{passphrase;logN;constructor(t,n){this.passphrase=t,this.logN=n}wrapFileKey(t){let n=Tu(16),r="age-encryption.org/v1/scrypt",i=new Uint8Array(r.length+16);i.set(new TextEncoder().encode(r)),i.set(n,r.length);let o=ME(this.passphrase,i,{N:2**this.logN,r:8,p:1,dkLen:32});return[new qi(["scrypt",Pr.encode(n),this.logN.toString()],Xb(t,o))]}},Sg=class{passphrase;constructor(t){this.passphrase=t}unwrapFileKey(t){for(let n of t){if(n.args.length<1||n.args[0]!=="scrypt")continue;if(t.length!==1)throw Error("scrypt recipient is not the only one in the header");if(n.args.length!==3||!/^[1-9][0-9]*$/.test(n.args[2]))throw Error("invalid scrypt stanza");let r=Pr.decode(n.args[1]);if(r.length!==16)throw Error("invalid scrypt stanza");let i=Number(n.args[2]);if(i>20)throw Error("scrypt work factor is too high");let o="age-encryption.org/v1/scrypt",s=new Uint8Array(o.length+16);s.set(new TextEncoder().encode(o)),s.set(r,o.length);let a=ME(this.passphrase,s,{N:2**i,r:8,p:1,dkLen:32}),u=Zb(n.body,a);if(u!==null)return u}return null}};function Xb(e,t){let n=new Uint8Array(12);return ii(t,n).encrypt(e)}function Zb(e,t){if(e.length!==32)throw Error("invalid stanza");let n=new Uint8Array(12);try{return ii(t,n).decrypt(e)}catch{return null}}function YB(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var ime=B(x(),1);var ul=16,Qb=64*1024,Jb=Qb+ul;function XB(e){let t=new Uint8Array(12),n=()=>{for(let s=t.length-2;s>=0&&(t[s]++,t[s]===0);s--);},r=!0,i=new Uint8Array(Jb),o=0;return new TransformStream({transform(s,a){for(;s.length>0;){if(o===i.length){let l=ii(e,t).decrypt(i);a.enqueue(l),n(),o=0,r=!1}let u=Math.min(i.length-o,s.length);i.set(s.subarray(0,u),o),o+=u,s=s.subarray(u)}},flush(s){t[11]=1;let a=ii(e,t).decrypt(i.subarray(0,o));if(!r&&a.length===0)throw new Error("final chunk is empty");s.enqueue(a)}})}function ZB(e){if(e<ul)throw Error("ciphertext is too small");if(e===ul)return 0;let t=Math.floor(e/Jb),n=e%Jb;if(0<n&&n<=ul)throw Error("ciphertext size is invalid");let r=e;return r-=t*ul,r-=n>0?ul:0,r}function JB(e){let t=new Uint8Array(12),n=()=>{for(let o=t.length-2;o>=0&&(t[o]++,t[o]===0);o--);},r=new Uint8Array(Qb),i=0;return new TransformStream({transform(o,s){for(;o.length>0;){if(i===r.length){let u=ii(e,t).encrypt(r);s.enqueue(u),n(),i=0}let a=Math.min(r.length-i,o.length);r.set(o.subarray(0,a),i),i+=a,o=o.subarray(a)}},flush(o){t[11]=1;let s=ii(e,t).encrypt(r.subarray(0,i));o.enqueue(s)}})}function QB(e){let t=Math.max(1,Math.ceil(e/Qb));return e+ul*t}var hp={};kO(hp,{decode:()=>UW,encode:()=>LW});var ume=B(x(),1);function LW(e){let t=[];t.push(`-----BEGIN AGE ENCRYPTED FILE-----
`);for(let n=0;n<e.length;n+=48){let r=n+48;r>e.length&&(r=e.length),t.push(LE.encode(e.subarray(n,r))+`
`)}return t.push(`-----END AGE ENCRYPTED FILE-----
`),t.join("")}function UW(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 n(r,i){return r===t.length-1?i.length>0&&i.length<=64&&i.length%4===0:i.length===64}if(!t.every((r,i)=>n(i,r)))throw Error("invalid line length");if(!t.every(r=>/^[A-Za-z0-9+/=]+$/.test(r)))throw Error("invalid base64");return LE.decode(t.join(""))}var Ame=B(x(),1);var cme=B(x(),1);var dp=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 vg(t));else if(t.startsWith("age1tag1"))this.recipients.push(new yg(t));else if(t.startsWith("age1tagpq1"))this.recipients.push(new Eg(t));else if(t.startsWith("age1"))this.recipients.push(new bg(t));else throw new Error("unrecognized recipient type");else this.recipients.push(t)}async encrypt(t){let n=Tu(16),r=[],i=this.recipients;this.passphrase!==null&&(i=[new Ag(this.passphrase,this.scryptWorkFactor)]);for(let d of i)r.push(...await d.wrapFileKey(n));let o=new TextEncoder().encode("header"),s=Ru(Fn,n,void 0,o,32),a=Co(Fn,s,zb(r)),u=zB(r,a),l=Tu(16),h=new TextEncoder().encode("payload"),m=Ru(Fn,n,l,h,32),p=JB(m);return t instanceof ReadableStream?Object.assign(Kf(t.pipeThrough(p),u,l),{size:d=>QB(d)+u.length+l.length}):(typeof t=="string"&&(t=new TextEncoder().encode(t)),await Gb(Kf(mg(t).pipeThrough(p),u,l)))}},Dg=class{identities=[];addPassphrase(t){this.identities.push(new Sg(t))}addIdentity(t){if(VW(t))this.identities.push(new fp(t));else if(typeof t=="string")if(t.startsWith("AGE-SECRET-KEY-1"))this.identities.push(new fp(t));else if(t.startsWith("AGE-SECRET-KEY-PQ-1"))this.identities.push(new wg(t));else throw new Error("unrecognized identity type");else this.identities.push(t)}async decrypt(t,n){let r=t instanceof ReadableStream?t:mg(t),{fileKey:i,headerSize:o,rest:s}=await this.decryptHeaderInternal(r),{data:a,rest:u}=await VB(s,16),l=new TextEncoder().encode("payload"),h=Ru(Fn,i,a,l,32),m=XB(h),p=u.pipeThrough(m),d=Object.assign(p,{size:v=>ZB(v-o-a.length)});return t instanceof ReadableStream?d:n==="text"?await KB(p):await Gb(p)}async decryptHeader(t){return(await this.decryptHeaderInternal(mg(t))).fileKey}async decryptHeaderInternal(t){let n=await GB(t),r=await this.unwrapFileKey(n.stanzas);if(r===null)throw Error("no identity matched any of the file's recipients");let i=new TextEncoder().encode("header"),o=Ru(Fn,r,void 0,i,32),s=Co(Fn,o,n.headerNoMAC);if(!KW(n.MAC,s))throw Error("invalid header HMAC");return{fileKey:r,headerSize:n.headerSize,rest:n.rest}}async unwrapFileKey(t){for(let n of this.identities){let r=await n.unwrapFileKey(t);if(r!==null)return r}return null}};function KW(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function VW(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var zW="-----BEGIN AGE ENCRYPTED FILE-----",iI="age-public-key",eA="age-secret-key",Lme=Object.freeze({X25519:"x25519",HYBRID:"mlkem768-x25519"}),WW=["TextEncoder","TextDecoder","ReadableStream","TransformStream","Response","Uint8Array"],YW=/\bAGE-SECRET-KEY(?:-PQ)?-1[023456789ACDEFGHJKLMNPQRSTUVWXYZ]+\b/g,tA="__subStoreAgeX25519Fallback";function nA(e){return String(e??"").trim()}function XW(e){return e.startsWith("age1")&&!e.startsWith("age1pq1")&&!e.startsWith("age1tag1")&&!e.startsWith("age1tagpq1")}function ZW(e){return e.startsWith("age1pq1")}function JW(e){return e.startsWith("AGE-SECRET-KEY-1")}function QW(e){return e.startsWith("AGE-SECRET-KEY-PQ-1")}function eI(){return new ca("INVALID_AGE_PUBLIC_KEY","age-public-key \u4EC5\u652F\u6301 X25519(age1...) \u6216 MLKEM768-X25519(age1pq1...) \u516C\u94A5")}function tI(){return new ca("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 rA(e=globalThis){let t=WW.filter(i=>typeof e?.[i]>"u"),n=e?.crypto;if(n&&typeof n.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(", ")}`);sY(e)}function Fg(){return typeof DOMException<"u"?new DOMException("X25519 WebCrypto is not available","NotSupportedError"):new ReferenceError("X25519 WebCrypto is not available")}function eY(){let e={importKey(){throw Fg()},deriveBits(){throw Fg()}};return e[tA]=!0,e}function tY(e){return typeof e=="string"?e:e?.name}function nI(e){return String(tY(e)||"").toUpperCase()==="X25519"}function nY(e){let t=String(e?.message||e||"");return/x25519|algorithm|not\s+supported|unsupported|unrecognized|unknown/i.test(t)}function rI(e){return e instanceof TypeError||e instanceof ReferenceError||e?.name==="TypeError"||e?.name==="ReferenceError"||e?.name==="NotSupportedError"||e?.name==="Error"&&nY(e)||typeof DOMException<"u"&&e instanceof DOMException&&e.name==="NotSupportedError"}function rY(e){let t=Object.create(e);return Object.defineProperty(t,tA,{configurable:!0,value:!0}),Object.defineProperty(t,"importKey",{configurable:!0,value:async(...n)=>{try{return await e.importKey.apply(e,n)}catch(r){throw nI(n[2])&&rI(r)?Fg():r}}}),Object.defineProperty(t,"deriveBits",{configurable:!0,value:async(...n)=>{try{return await e.deriveBits.apply(e,n)}catch(r){throw nI(n[0])&&rI(r)?Fg():r}}}),t}function sI(e,t,n){try{if(t.subtle=n,t.subtle===n)return!0}catch{}try{if(Object.defineProperty(t,"subtle",{configurable:!0,value:n}),t.subtle===n)return!0}catch{}try{let r=Object.create(t);return Object.defineProperty(r,"subtle",{configurable:!0,value:n}),typeof t.getRandomValues=="function"&&Object.defineProperty(r,"getRandomValues",{configurable:!0,value:t.getRandomValues.bind(t)}),e.crypto=r,e.crypto?.subtle===n}catch{return!1}}function sY(e=globalThis){let t=e?.crypto,n=t?.subtle;if(!(!t||n?.[tA])){if(!n||typeof n.importKey!="function"||typeof n.deriveBits!="function"){sI(e,t,eY());return}typeof process>"u"&&sI(e,t,rY(n))}}function oI(e){let t=nA(e);if(!t||!XW(t)&&!ZW(t))throw eI();try{new dp().addRecipient(t)}catch{throw eI()}return t}async function aI(e){let t=nA(e);if(!t||!JW(t)&&!QW(t))throw tI();try{await Cg(t)}catch{throw tI()}return t}async function uI(e){rA();let t=await aI(e),n=await Cg(t);return oI(n)}async function Bg(e,t){rA();let n=oI(t),r=new dp;r.addRecipient(n);let i=await r.encrypt(e??"");return hp.encode(i)}function iY(e){return nA(e).startsWith(zW)}async function Ig(e,t){let n=e??"",r=typeof n=="string"?n:new TextDecoder().decode(n);if(!iY(r))return n;rA();let i=await aI(t),o=new Dg;o.addIdentity(i);try{let s=hp.decode(r);return await o.decrypt(s,"text")}catch(s){throw new Error(`age \u89E3\u5BC6\u5931\u8D25: ${s?.message??s}`)}}function oY(e){return String(e??"").replace(YW,t=>`${t.startsWith("AGE-SECRET-KEY-PQ-1")?"AGE-SECRET-KEY-PQ-1":"AGE-SECRET-KEY-1"}...${t.slice(-6)}`)}function Qu(e){return oY(String(e??"").replace(/([?#&]age-secret-key=)[^&#\s]+/gi,"$1***"))}var Yge=B(x());var Kme=B(x());var iA=class{constructor(){J.read(Fc)||J.write("{}",Fc);try{this.resourceCache=JSON.parse(J.read(Fc))}catch(t){J.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Fc} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},J.write("{}",Fc)}this._cleanup()}_cleanup(t,n){let r=sA(n)??0,i=!1,o=Date.now();Object.entries(this.resourceCache).forEach(s=>{let[a,u]=s;(!u.time||u.time<o+r)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],i=!0)}),i&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){J.write(JSON.stringify(this.resourceCache),Fc)}gettime(t){let n=this.resourceCache[t]&&this.resourceCache[t].time;return n&&new Date().getTime()<=n?this.resourceCache[t].time:null}get(t,n,r){let i=sA(n)??0,o=this.resourceCache[t],s=o&&o.time;if(s){if(Date.now()+i<=s)return o.data;r&&(delete this.resourceCache[t],this._persist())}return null}set(t,n,r){let i=sA(r)??uY();this.resourceCache[t]={time:Date.now()+i,data:n},this._persist()}};function sA(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function uY(){let t=(J.read(Jt)||{})?.scriptCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:1728e5}var oA=new iA;var Gme=B(x());function $g(e,t){return[...Array(e).keys()].map(()=>t)}var Xme=B(x());var aA={"\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"]};function Vf(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"]},n=e.match(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/)?.[0]||"\u{1F3F4}\u200D\u2620\uFE0F";for(let r of Object.keys(t))if(t[r].some(o=>RegExp(`${o}`,"i").test(e)))return/内蒙古/.test(e)&&["\u{1F1F2}\u{1F1F3}"].includes(r)?n="\u{1F1E8}\u{1F1F3}":n=r;for(let r of Object.keys(aA))if(aA[r].some(o=>RegExp(`(^|[^a-zA-Z])${o}([^a-zA-Z]|$)`).test(e))&&!(r=="\u{1F1E8}\u{1F1F3}"&&RegExp("(^|[^a-zA-Z])CN2([^a-zA-Z]|$)").test(e)))return n=r;return n}function cI(e){return aA[Vf(e)]?.[0]}function pp(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴‍☠️|🏳️‍🌈/g,"").trim()}var xg=class{constructor({country,asn}={}){if(J.env.isNode){let Reader=eval('require("@maxmind/geoip2-node")').Reader,fs=ao(),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 _ge=B(x());var zf=B(EI());var hge=B(x());function vA(){return oo(()=>wu("dgram"))}var mge=B(x());function wA(){return oo(()=>wu("net"))}var wge=B(x());function yA(){return oo(()=>wu("tls"))}var ll=B(wa());var bI=53,gY=853,gp=2;function EA({domain:e,type:t="A",edns:n}){let r=[];return n&&r.push({type:"OPT",name:".",udpPayloadSize:4096,flags:0,options:[{code:"CLIENT_SUBNET",ip:n,sourcePrefixLength:Sn(n)?24:56,scopePrefixLength:0}]}),zf.default.encode({type:"query",id:0,flags:zf.default.RECURSION_DESIRED,questions:[{type:t,name:e}],additionals:r})}function bA(e){return e||8e3}function vY(e){return e?.replace(/^\[(.*)\]$/,"$1")}function wY(e){return Sn(e)||Xt(e)}function yY(e,t=bI){if(!e)return t;let n=Number(e);if(!Number.isInteger(n)||n<1||n>65535)throw new Error("\u81EA\u5B9A\u4E49 DNS \u7AEF\u53E3\u53F7\u5E94\u4E3A 1-65535 \u7684\u6574\u6570");return n}function EY(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 bY(e,t){try{let n=t?e:`udp://${Xt(e)?`[${e}]`:e}`,r=new URL(n);EY(r,e);let i=vY(r.hostname);if(!i)throw new Error(`\u81EA\u5B9A\u4E49 DNS \u5730\u5740\u683C\u5F0F\u65E0\u6548: ${e}`);return{protocol:t||"udp",host:i,port:yY(r.port,t==="tls"?gY:bI)}}catch(n){throw n?.message?.includes("\u81EA\u5B9A\u4E49 DNS")?n:new Error(`\u81EA\u5B9A\u4E49 DNS \u5730\u5740\u683C\u5F0F\u65E0\u6548: ${e}`)}}function AY(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 n=t.match(/^([a-z][a-z\d+.-]*):\/\//i)?.[1],r=n?.toLowerCase();if(r&&!["udp","tcp","tls"].includes(r))throw new Error(`\u81EA\u5B9A\u4E49 DNS \u4E0D\u652F\u6301 ${n} \u534F\u8BAE`);return bY(t,r)}async function AA({url:e,domain:t,type:n="A",timeout:r,edns:i,skipCertVerify:o}){let s=EA({domain:t,type:n,edns:i}),u=ll.Buffer.from(s).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),l=await J.http.get({url:`${e}?dns=${encodeURIComponent(u)}`,headers:{Accept:"application/dns-message"},"binary-mode":!0,encoding:null,timeout:r,insecure:o===!0});return zf.default.decode(ll.Buffer.from(J.env.isQX?l.bodyBytes:l.body))}async function SY({server:e,domain:t,type:n="A",timeout:r,edns:i}){let o=vA(),s=EA({domain:t,type:n,edns:i});return new Promise((a,u)=>{let l=!1,h=o.createSocket(Xt(e.host)?"udp6":"udp4"),m=setTimeout(()=>{d(new Error("DNS UDP query timeout"))},bA(r));function p(){clearTimeout(m),h.removeAllListeners();try{h.close()}catch{}}function d(v,g){l||(l=!0,p(),v?u(v):a(g))}h.on("error",v=>d(v)),h.on("message",v=>{try{d(null,zf.default.decode(v))}catch(g){d(g)}}),h.send(s,e.port,e.host,v=>{v&&d(v)})})}async function CY({server:e,domain:t,type:n="A",timeout:r,edns:i,skipCertVerify:o}){let s=e.protocol==="tls"?yA():wA(),a=e.protocol==="tls"?"TLS":"TCP",u=EA({domain:t,type:n,edns:i}),l=ll.Buffer.alloc(gp);l.writeUInt16BE(u.length,0);let h=ll.Buffer.concat([l,u]);return new Promise((m,p)=>{let d=!1,v=ll.Buffer.alloc(0),g,y=e.protocol==="tls"?s.connect({host:e.host,port:e.port,servername:wY(e.host)?void 0:e.host,rejectUnauthorized:o===!0?!1:void 0}):s.createConnection({host:e.host,port:e.port});function w(){y.removeAllListeners(),y.destroy()}function E(C,_){d||(d=!0,w(),C?p(C):m(_))}y.setTimeout(bA(r),()=>{E(new Error(`DNS ${a} query timeout`))}),y.on(e.protocol==="tls"?"secureConnect":"connect",()=>{y.write(h)}),y.on("error",C=>E(C)),y.on("end",()=>{E(new Error(`DNS ${a} connection ended before response`))}),y.on("data",C=>{try{if(v=ll.Buffer.concat([v,C]),g==null&&v.length>=gp&&(g=v.readUInt16BE(0)),g!=null&&v.length>=g+gp){let _=v.slice(gp,g+gp);E(null,zf.default.decode(_))}}catch(_){E(_)}})})}async function Tg({url:e,domain:t,type:n="A",timeout:r,edns:i,skipCertVerify:o}){let s=`${e||""}`.trim(),a=s.match(/^([a-z][a-z\d+.-]*):\/\//i)?.[1].toLowerCase(),u=["http","https"].includes(a);if(!J.env.isLoon&&(["auto","system"].includes(s.toLowerCase())||["h3","quic"].includes(a)))throw new Error("auto/system \u548C DoH3/DoQ \u4EC5\u652F\u6301 Loon Build \u2265 988");if(J.env.isLoon&&s&&(!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 h=s.replace(/^udp:\/\//i,""),m=await new Promise((p,d)=>{$dns.query({domain:t,...s.toLowerCase()==="auto"?{}:{server:h},timeout:bA(r)},(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(s&&!J.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=AY(e);if(l.protocol==="doh")return AA({url:l.url,domain:t,type:n,timeout:r,edns:i,skipCertVerify:o});if(!J.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)?CY({server:l,domain:t,type:n,timeout:r,edns:i,skipCertVerify:o}):SY({server:l,domain:t,type:n,timeout:r,edns:i})}var Yf=B(Ga());var Bge=B(x()),SA="mihomoConfig",_Y="mihomoProfile",DY=[SA,_Y];function fl(e){let t=typeof e=="string"?e:e?.type;return DY.includes(t)}function AI(e){return!e||!fl(e)||e.type===SA?e:{...e,type:SA}}var Pge=B(x());var{isNode:SI,isQX:FY,isLoon:BY,isSurge:IY,isStash:$Y,isShadowRocket:xY,isLanceX:PY,isEgern:kY,isGUIforCores:TY}=Js(),Uo="Node";SI?Uo="Node":FY?Uo="QX":BY?Uo="Loon":$Y?Uo="Stash":xY?Uo="Shadowrocket":kY?Uo="Egern":IY?Uo="Surge":PY?Uo="LanceX":TY&&(Uo="GUI.for.Cores");var hl={},RY={};try{if(typeof $environment<"u"&&(hl.env=$environment),typeof $loon<"u"&&(hl.loon=$loon),typeof $script<"u"&&(hl.script=$script),typeof $Plugin<"u"&&(hl.plugin=$Plugin),SI){hl.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)&&(hl.node.env[e]=env[e])}}catch(e){}var Rg={backend:Uo,version:t1,feature:RY,meta:hl};var FA="Response Transformer";function BA(e){return e===FA}function wp(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function FI(e,t){let n=typeof t=="string"?JSON.parse(t):t;for(let r in n)if(ze(n[r]))if(r.endsWith("!")){let i=wp(r.slice(0,-1));e[i]=n[r]}else{let i=wp(r);e[i]||Object.assign(e,{[i]:{}}),FI(e[i],n[i])}else if(Array.isArray(n[r]))if(r.startsWith("+")){let i=wp(r.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...n[r],...e[i]]}else if(r.endsWith("+")){let i=wp(r.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...n[r]]}else{let i=wp(r);Object.assign(e,{[i]:n[r]})}else Object.assign(e,{[r]:n[r]});return e}function OY({rule:e}){return{name:"Conditional Filter",func:t=>t.map(n=>Og(e,n))}}function Og(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(n=>Og(n,t));case"OR":return e.child.some(n=>Og(n,t));case"NOT":return!Og(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function NY(e){return{name:"Quick Setting Operator",func:i=>{if(t(e.useless)){let a=TI().func(i);i=i.filter((u,l)=>a[l]&&u.port>0&&u.port<=65535)}let o=n(e.ecn,t(e.ecn));return i.map(s=>(s.udp=t(e.udp,s.udp),s.tfo=t(e.tfo,s.tfo),s["fast-open"]=t(e.tfo,s["fast-open"]),s["skip-cert-verify"]=t(e.scert,s["skip-cert-verify"]),s.type==="vmess"&&(s.aead=t(e["vmess aead"],s.aead)),["snell","anytls","trusttunnel"].includes(s.type)&&(s.reuse=t(e.reuse,s.reuse)),o!==void 0&&s.type!=="direct"&&s.type!=="external"&&(s.ecn=o),s["block-quic"]=n(e["block-quic"],s["block-quic"]),s["ip-version"]=r(e["ip-version"],s["ip-version"]),s))}};function t(i,o){switch(i){case"ENABLED":return!0;case"DISABLED":return!1;default:return o}}function n(i,o){switch(i){case"auto":case"on":case"off":return i;default:return o}}function r(i,o){switch(i){case void 0:case null:case"":case"DEFAULT":return o;default:return i}}}function LY({mode:e,tw:t}){return{name:"Flag Operator",func:n=>n.map(r=>{if(e==="remove")r.name=pp(r.name);else{let i=Vf(r.name);r.name=pp(r.name),r.name=i+" "+r.name,t=="ws"?r.name=r.name.replace(/🇹🇼/g,"\u{1F1FC}\u{1F1F8}"):t=="tw"||(r.name=r.name.replace(/🇹🇼/g,"\u{1F1E8}\u{1F1F3}"))}return r})}}function UY(e){let{action:t,template:n,link:r,position:i,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:s=>{if(t==="delete"){let a={};return s.filter(u=>{let l=o.map(h=>Yf.default.get(u,h,"-")).join("_");return a[l]?!1:(a[l]=!0,!0)})}else if(t==="rename"){let a=n.split(" "),u={},l=0;s.forEach(m=>{let p=o.map(d=>Yf.default.get(m,d,"-")).join("_");typeof u[p]>"u"?u[p]=1:u[p]++,l=Math.max(u[p].toString().length,l)});let h={};return s.map(m=>{let p=o.map(d=>Yf.default.get(m,d,"-")).join("_");if(u[p]>1){typeof h[p]>"u"&&(h[p]=1);let d="",v=h[p]++,g=0;for(;v>0;)d=a[v%10]+d,v=parseInt(v/10),g++;for(;g++<l;)d=a[0]+d;i==="front"?m.name=d+r+m.name:i==="back"&&(m.name=m.name+r+d)}return m})}}}}function HY(e="asc"){return{name:"Sort Operator",func:t=>{switch(e){case"asc":case"desc":return t.sort((n,r)=>{let i=n.name>r.name?1:-1;return i*=e==="desc"?-1:1,i});case"random":return hX(t);default:throw new Error("Unknown sort option: "+e)}}}}function MY(e){let t=e.order||"asc",n=e.expressions;return Array.isArray(e)&&(n=e),Array.isArray(n)||(n=[]),{name:"Regex Sort Operator",func:r=>{let i=n.map(s=>$A(s)),o=new Map;return r.sort((s,a)=>{let u=CI(i,s.name,o),l=CI(i,a.name,o);return u&&!l?-1:l&&!u?1:u&&l?u<l?-1:1:t==="original"?0:t==="desc"?s.name<a.name?1:-1:s.name<a.name?-1:1})}}}function CI(e,t,n){if(e.length===0)return null;let r=n.get(t);if(r!==void 0)return r;let i=null;for(let o=0;o<e.length;o++)if(e[o].test(t)){i=o+1;break}return typeof t=="string"&&n.set(t,i),i}function BI(e){return{name:"Regex Rename Operator",func:t=>t.map(n=>{for(let{expr:r,now:i}of e)n.name=n.name.replace($A(r,"g"),i).trim();return n})}}function qY(e){let t=e.map(n=>({expr:n,now:""}));return{name:"Regex Delete Operator",func:BI(t).func}}function jY(e,t,n,r,i,o){return o.source=r,o.env=Rg,{name:"Script Operator",func:async s=>{let a=s;if(fl(a?.$file))try{let u=Rs.safeLoad(e),l;if(a?.$content)try{l=Rs.safeLoad(a?.$content)}catch(h){J.error(h.message??h)}if(typeof u!="object")throw new Error("patch is not an object");return a.$content=zt.yaml.safeDump(FI(l||{},u)),a}catch{}return await(async function(){a=Xf("operator",e,n,i)(s,t,o)})(),a},nodeFunc:async s=>{let a=s;return await(async function(){a=Xf("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
}
}`,n,i)(s,t,o)})(),a}}}var II="Add Proxies From Subscription Operator";function KY(e){if(!e)return{};let t=Rs.safeLoad(e);return ze(t)?t:{}}function VY(e){return Array.isArray(e?.proxies)?e.proxies:[]}function GY({sourceType:e="subscription",sourceName:t,includeUnsupportedProxy:n,position:r="replace"}={},i={}){let o=async s=>{if(!fl(s?.$file))return s;let a=KY(s.$content),u=VY(a),l=await Us({type:e,name:t,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0,"include-unsupported-proxy":n},noFlow:i.noFlow});switch(r){case"front":a.proxies=[...l,...u];break;case"back":a.proxies=[...u,...l];break;case"replace":default:a.proxies=l;break}return s.$content=zt.yaml.safeDump(a),s};return{name:II,func:o,nodeFunc:o}}function zY(e){let t,n;try{let r=e.split(":");n=parseInt(r[2],16);let i=parseInt(r[3],16),o=parseInt(r[4],16),s=i>>8,a=i&255,u=o>>8,l=o&255;if(t=`${s}.${a}.${u}.${l}`,n<=0||n>65535)throw new Error(`Invalid port number: ${n}`);if(!Sn(t))throw new Error(`Invalid IP address: ${t}`)}catch(r){J.error(`IP4P \u89E3\u6790\u5931\u8D25: ${r}`)}return{server:t,port:n}}var WY=10,YY=2,_I=20;function XY(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return WY;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 $I(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return YY;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 ZY(e,t){if(!(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")){let i=Number(e);if(!Number.isInteger(i)||i<1)throw new Error("DNS \u8D85\u65F6\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return i}if(typeof t>"u"||t===null||typeof t=="string"&&t.trim()==="")return 8e3;let r=Number(t);return!isFinite(r)||r<=0?8e3:r}function JY(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 IA(e){let t=`${e||""}`.split(/\r?\n/).map(n=>n.trim()).filter(n=>n);if(t.length===0)throw new Error("\u81EA\u5B9A\u4E49 DNS \u4E0D\u80FD\u4E3A\u7A7A");return t}function QY(e){return IA(e).join(`
`)}async function eX(e,t,n){let r=0,i=Math.min(t,e.length),o=Array.from({length:i},async()=>{for(;r<e.length;){let s=e[r];r+=1,await n(s)}});await Promise.all(o)}async function tX(e,t,n){return new Promise((r,i)=>{let o=0,s=0,a=0,u=!1,l=[],h=Math.min(t,e.length);function m(){!u&&a===e.length&&i(new Error(l.length>0?l.join("; "):"No answers"))}function p(){if(!u){for(;s<h&&o<e.length;){let d=e[o];o+=1,s+=1,Promise.resolve().then(()=>n(d)).then(v=>{s-=1,a+=1,!u&&(u=!0,r({result:v,resolverUrl:d}))}).catch(v=>{s-=1,a+=1,l.push(`${d}: ${v}`),p(),m()})}m()}}p()})}function DA(e,t,n,r,i){switch(e){case"Custom":return Ln(`CUSTOM:${i?"INSECURE:":""}${r}:${t}:${n}`);case"Google":return Ln(`GOOGLE:${t}:${n}`);case"IP-API":return Ln(`IP-API:${t}`);case"Cloudflare":return Ln(`CLOUDFLARE:${t}:${n}`);case"Ali":return Ln(`ALI:${t}:${n}`);case"Tencent":return Ln(`TENCENT:${t}:${n}`)}}function nX(e,t,n,r,i,o){if(r==="disabled")return null;let s=DA(e,t,n,i,o),a=s?Un.get(s):null;return e==="Custom"?PI(a):a}function CA(e,t){if(e!=="Custom"||!t)return"";let n=`${t}`.split(/\r?\n/).map(r=>r.trim()).filter(r=>r);return n.length<=1?` via ${t}`:` via ${n.length} custom DNS`}function rX(e,t){if(e!=="Custom"||!t)return t||"";let n=`${t}`.split(/\r?\n/).map(r=>r.trim()).filter(r=>r);return n.length<=1?t:`${n.length} custom DNS`}function xI(e,t){return e&&typeof e=="object"&&Object.defineProperty(e,"_resolverUrl",{value:t,enumerable:!1,configurable:!0}),e}function sX(e,t){return{result:e,resolverUrl:t}}function PI(e){return e&&typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.result)?xI(e.result,e.resolverUrl):e}function DI(e){return e&&typeof e=="object"?e._resolverUrl:null}var Ng={Custom:async function(e,t,n,r,i,o,s,a,u){let l=IA(o),h=l.join(`
`),m=$I(a),p=Ln(`CUSTOM:${s?"INSECURE:":""}${h}:${e}:${t}`),d=PI(Un.get(p));if(!n&&d)return d;let v=t==="IPv6"?"AAAA":"A",g=async E=>{let C=await Tg({url:E,domain:e,type:v,timeout:r,edns:i,skipCertVerify:s}),{answers:_}=C;if(!Array.isArray(_)||_.length===0)throw new Error("No answers");let F=_.filter(H=>H?.type===v).map(H=>H?.data).filter(H=>H);if(F.length===0)throw new Error("No answers");return F},{result:y,resolverUrl:w}=l.length===1?{result:await g(l[0]),resolverUrl:l[0]}:await tX(l,m,g);return Un.set(p,sX(y,w),u),xI(y,w)},Google:async function(e,t,n,r,i,o,s,a,u){let l=Ln(`GOOGLE:${e}:${t}`),h=Un.get(l);if(!n&&h)return h;let m=t==="IPv6"?"AAAA":"A",p=await Tg({url:"https://8.8.4.4/dns-query",domain:e,type:m,timeout:r,edns:i}),{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 Un.set(l,v,u),v},"IP-API":async function(e,t,n,r,i,o,s,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=Ln(`IP-API:${e}`),h=Un.get(l);if(!n&&h)return h;let m=await J.http.get({url:`http://ip-api.com/json/${encodeURIComponent(e)}?lang=zh-CN`,timeout:r}),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 Un.set(l,d,u),d},Cloudflare:async function(e,t,n,r,i,o,s,a,u){let l=Ln(`CLOUDFLARE:${e}:${t}`),h=Un.get(l);if(!n&&h)return h;let m=t==="IPv6"?"AAAA":"A",p=await Tg({url:"https://1.0.0.1/dns-query",domain:e,type:m,timeout:r,edns:i}),{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 Un.set(l,v,u),v},Ali:async function(e,t,n,r,i,o,s,a,u){let l=Ln(`ALI:${e}:${t}`),h=Un.get(l);if(!n&&h)return h;let m=await J.http.get({url:`http://223.6.6.6/resolve?edns_client_subnet=${i}/${Sn(i)?24:56}&name=${encodeURIComponent(e)}&type=${t==="IPv6"?"AAAA":"A"}&short=1`,headers:{accept:"application/dns-json"},timeout:r}),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 Un.set(l,d,u),d},Tencent:async function(e,t,n,r,i,o,s,a,u){let l=Ln(`TENCENT:${e}:${t}`),h=Un.get(l);if(!n&&h)return h;let p=(await J.http.get({url:`http://119.28.28.28/d?ip=${i}&type=${t==="IPv6"?"AAAA":"A"}&dn=${encodeURIComponent(e)}`,headers:{accept:"application/dns-json"},timeout:r})).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 Un.set(l,d,u),d}};function kI({provider:e,type:t,filter:n,cache:r,url:i,tlsSkipCertVerify:o,timeout:s,cacheTtl:a,edns:u,concurrency:l,dnsConcurrency:h}){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}=J.read(Jt)||{},p=ZY(s,m),d=JY(a),v=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",g=Ng[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(!dl(y))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");let w=XY(l),E=e==="Custom"?QY(i):i,C=e==="Custom"?IA(E).length:1,_=e==="Custom"?$I(h):1,F=w*Math.min(_,C),H=e==="Custom"&&(o===!0||o==="enabled");return F>_I&&J.warn(`\u57DF\u540D\u89E3\u6790\u603B\u5E76\u53D1\u6570\u4E0A\u9650 ${F} \u8D85\u8FC7\u5EFA\u8BAE\u503C ${_I}, \u53EF\u80FD\u5BFC\u81F4\u4EE3\u7406 App TCP \u8FDE\u63A5\u6570\u6FC0\u589E`),J.info(`Domain Resolver: [${t}] ${e} ${y||""} ${rX(e,E)}${H?" tlsSkipCertVerify=enabled":""} concurrency=${w}${e==="Custom"?` dnsConcurrency=${_}`:""}`),{name:"Resolve Domain Operator",func:async K=>{K.forEach((L,T)=>{!L["_no-resolve"]&&L["no-resolve"]&&(K[T]["_no-resolve"]=L["no-resolve"])});let S={},I=[...new Map(K.filter(L=>!dl(L.server)&&!L["_no-resolve"]).map(L=>{let T=DA(e,L.server,v,E,H);return[T,{id:T,domain:L.server}]})).values()],q=[];return I.forEach(({id:L,domain:T})=>{let O=nX(e,T,v,r,E,H);if(O){S[L]=O;let R=e==="Custom"&&DI(O)||E;J.info(`Using cached resolved domain: ${T}${CA(e,R)} \u279F ${O}`)}else q.push({id:L,domain:T})}),await eX(q,w,async({id:L,domain:T})=>{try{let O=await g(T,v,r==="disabled",p,y,E,H,_,d);S[L]=O;let R=e==="Custom"&&DI(O)||E;J.info(`Successfully resolved domain: ${T}${CA(e,R)} \u279F ${O}`)}catch(O){J.error(`Failed to resolve domain: ${T}${CA(e,E)} with resolver [${e}]: ${O}`)}}),K.forEach(L=>{if(!L["_no-resolve"]){let T=DA(e,L.server,v,E,H);if(T&&S[T]){L._resolved_ips=S[T];let O=Array.isArray(S[T])?S[T][Math.floor(Math.random()*S[T].length)]:S[T];if(v==="IPv6"&&Xt(O)){try{O=new v1.Address6(O).correctForm()}catch(R){J.error(`Failed to parse IPv6 address: ${O}: ${R}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(O)){L._IP4P=O;let{server:R,port:N}=zY(O);R&&N?(L._domain=L.server,L.server=R,L.port=N,L.resolved=!0,L._IPv4=L.server,dl(L._IP)||(L._IP=L.server)):L.resolved||(L.resolved=!1)}else L._domain=L.server,L.server=O,L.resolved=!0,L[`_${v}`]=L.server,dl(L._IP)||(L._IP=L.server)}else L._domain=L.server,L.server=O,L.resolved=!0,L[`_${v}`]=L.server,dl(L._IP)||(L._IP=L.server)}else L.resolved||(L.resolved=!1)}}),K.filter(L=>n==="removeFailed"?dl(L.server)||L["_no-resolve"]||L.resolved:n==="IPOnly"?dl(L.server):n==="IPv4Only"?Sn(L.server):n==="IPv6Only"?Xt(L.server):!0)}}}function dl(e){return Sn(e)||Xt(e)}kI.resolver=Ng;function _A(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function TI(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!_A(t.cipher))return!1;if(t.password&&!_A(t.password))return!1;if(t.network){let n=t[`${t.network}-opts`]?.headers?.Host||t[`${t.network}-opts`]?.headers?.host;if(n=Array.isArray(n)?n:[n],n.some(r=>r&&!_A(r)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function iX(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let n=e?.keep??!0,r={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:i=>i.map(o=>{let s=Vf(o.name),a=t.some(u=>r[u]===s);return n?a:!a})}}function oX({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:n=>n.map(r=>{let i=e.some(o=>$A(o).test(r.name));return t?i:!i})}}function $A(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function aX(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let n=e?.keep??!0;return{name:"Type Filter",func:r=>r.map(i=>{let o=t.some(s=>i.type===s);return n?o:!o})}}function uX(e,t,n,r,i,o){return o.source=r,o.env=Rg,{name:"Script Filter",func:async s=>{let a=$g(s.length,!0);return await(async function(){a=Xf("filter",e,n,i)(s,t,o)})(),a},nodeFunc:async s=>{let a=$g(s.length,!0);return await(async function(){a=Xf("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
}`,n,i)(s,t,o)})(),a}}}function cX(e,t,n,r,i,o){return o.source=r,o.env=Rg,{name:FA,func:async s=>{let a=s;return await(async function(){a=Xf("transformFunction",e,n,i)(s,o)})(),a},shortcutFunc:async s=>{let a=s;return await(async function(){a=Xf("transformFunction",`async function transformFunction(res = {}, context) {
let $res = res
${e}
return $res
}`,n,i)(s,o)})(),a}}}var yp={"Useless Filter":TI,"Region Filter":iX,"Regex Filter":oX,"Type Filter":aX,"Script Filter":uX,"Conditional Filter":OY,"Quick Setting Operator":NY,"Flag Operator":LY,"Sort Operator":HY,"Regex Sort Operator":MY,"Regex Rename Operator":BI,"Regex Delete Operator":qY,"Script Operator":jY,[II]:GY,[FA]:cX,"Handle Duplicate Operator":UY,"Resolve Domain Operator":kI};async function RI(e,t){let n=t;try{let r=await e.func(n);r&&(n=r)}catch(r){let i="",o=`${r.message??r}`;o.includes("$res is not defined")||(J.error(`Cannot apply ${e.name}(function transformFunction)! Reason: ${r}`),i=`\u6267\u884C function transformFunction \u5931\u8D25 ${o}; `);try{let s=await e.shortcutFunc(n);s&&(n=s)}catch(s){J.error(`Cannot apply ${e.name}(shortcut script)! Reason: ${s}`);let a="",u=`${s.message??s}`;throw i&&u===o?(a="",i=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u811A\u672C\u5931\u8D25 ${u}`,new Error(`\u54CD\u5E94\u4FEE\u6539 ${i}${a}`)}}return n}async function lX(e,t){let n=$g(t.length,!0);try{n=await e.func(t)}catch(r){let i="",o=`${r.message??r}`;o.includes("$server is not defined")?i="":(J.error(`Cannot apply filter ${e.name}(function filter)! Reason: ${r}`),i=`\u6267\u884C function filter \u5931\u8D25 ${o}; `);try{n=await e.nodeFunc(t)}catch(s){J.error(`Cannot apply filter ${e.name}(shortcut script)! Reason: ${s}`);let a="",u=`${s.message??s}`;throw i&&u===o?(a="",i=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u8FC7\u6EE4\u811A\u672C \u5931\u8D25 ${u}`,new Error(`\u811A\u672C\u8FC7\u6EE4 ${i}${a}`)}}return t.filter((r,i)=>n[i])}async function fX(e,t){let n=dX(t);try{let r=await e.func(n);r&&(n=r)}catch(r){let i="",o=`${r.message??r}`;o.includes("$server is not defined")||o.includes("$content is not defined")||o.includes("$files is not defined")||n?.$files||n?.$content?i="":(J.error(`Cannot apply operator ${e.name}(function operator)! Reason: ${r}`),i=`\u6267\u884C function operator \u5931\u8D25 ${o}; `);try{let s=await e.nodeFunc(n);s&&(n=s)}catch(s){J.error(`Cannot apply operator ${e.name}(shortcut script)! Reason: ${s}`);let a="",u=`${s.message??s}`;throw i&&u===o?(a="",i=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u811A\u672C \u5931\u8D25 ${u}`,new Error(`\u811A\u672C\u64CD\u4F5C ${i}${a}`)}}return n}async function OI(e,t){if(e.name.indexOf("Filter")!==-1)return lX(e,t);if(e.name.indexOf("Operator")!==-1)return fX(e,t)}function hX(e){let t=e.length,n,r;for(;t!==0;)r=Math.floor(Math.random()*t),t-=1,n=e[t],e[t]=e[r],e[r]=n;return e}function dX(e){return JSON.parse(JSON.stringify(e))}function Xf(name,script,$arguments,$options){let flowUtils={getFlowField:Pc,getFlowHeaders:E1,parseFlowHeaders:Jl,flowTransfer:nd,validCheck:b1,getRmainingDays:y_,normalizeFlowHeader:E_};return J.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,J,Yf.default,$persistentStore,$httpClient,$notification,zt,zt.yaml,zt.Buffer,zt.Base64.decode,zt.Base64.encode,Ng,oA,flowUtils,Us,eval('typeof require !== "undefined"')?wu:void 0):new Function("$arguments","$options","$substore","lodash","ProxyUtils","yaml","Buffer","b64d","b64e","DOMAIN_RESOLVERS","scriptResourceCache","flowUtils","produceArtifact","require",`${script}
return ${name}`)($arguments,$options,J,Yf.default,zt,zt.yaml,zt.Buffer,zt.Base64.decode,zt.Base64.encode,Ng,oA,flowUtils,Us,eval('typeof require !== "undefined"')?wu:void 0)}var hwe=B(x());var E2e=B(x()),ZI=B(Ga());var n2e=B(x()),UI=B(Ga());var We=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,n){le(this.proxy,n)&&this.append(t)}toString(){return this.output.join("")}};function le(e,t){let n=UI.default.get(e,t);return typeof n<"u"&&n!==null}function Lg(e){let{network:t,flow:n,encryption:r}=e,i=e["reality-opts"],o=!!(e.tls||i);return t==="ws"&&i?!1:t==="grpc"?o&&!n:n?qe(r)&&r.trim()!=="none"||o&&!["ws","xhttp"].includes(t):!0}function Ug(e,t){return e.type!=="trusttunnel"||!le(e,"client-random-auth-key")||["surge","surgemac","json"].includes(t.toLowerCase())?!0:(J.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 Zf(e){let t=typeof e?.network=="string"?e.network.trim().toLowerCase():e?.network;return e?.type==="ss"&&e?.tls===!0&&!le(e,"plugin")&&(!le(e,"network")||t==="tcp")}function Ep(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 HI(e){return!!Ep(e)}function Jf(e,t){if(e?.type!=="ss"||e?.plugin!=="v2ray-plugin")return!0;let n=typeof e?.["plugin-opts"]?.mode=="string"?e["plugin-opts"].mode.trim().toLowerCase():e?.["plugin-opts"]?.mode;return t.includes(n)}function NI(e,t){if(e?.plugin!=="shadow-tls"||!e["plugin-opts"])return;let n=e["plugin-opts"],r=!!n.password||n.version!=null&&Number(n.version)!==0;return e["shadow-tls-opts"]={password:n.password,version:n.version},n.host!=null&&(e[t]=n.host),n.alpn!=null&&(e.alpn=n.alpn),delete e.plugin,delete e["plugin-opts"],r}function Hg(e){if(["vmess","vless","trojan","anytls"].includes(e.type)&&NI(e,"sni")&&["vmess","vless"].includes(e.type)&&(e.tls=!0),e.type==="vless"&&e.network==="xhttp"){let t=e["xhttp-opts"]?.["download-settings"];NI(t,"servername")&&(t.tls=!0)}}function xA(e,t){if(e==null)return;let n=`${e}`.trim();if(!/^\d+$/.test(n))return;let r=parseInt(n,10);if(!(r<0||r>t))return r}function MI(e,t){if(e==null)return null;let n=`${e}`.trim();if(!n)return null;let[,r=n,i]=/^(.*?)(?:\/(\d+))?$/.exec(n)||[],o=`${r}`.trim().replace(/^\[/,"").replace(/\]$/,""),s=t==="ipv4";return(s?Sn(o):Xt(o))?{address:o,cidr:xA(i,s?32:128)}:null}function LI(e,t){let{addressKey:n,cidrKey:r,family:i,defaultCIDR:o}=t,s=MI(e[n],i);if(!s){(e[n]==null||`${e[n]}`.trim().length===0)&&delete e[r];return}e[n]=s.address;let a=xA(e[r],o);e[r]=a??s.cidr??o}function bp(e={}){return LI(e,{addressKey:"ip",cidrKey:"ip-cidr",family:"ipv4",defaultCIDR:32}),LI(e,{addressKey:"ipv6",cidrKey:"ipv6-cidr",family:"ipv6",defaultCIDR:128}),e}function As(e={},t="ipv4"){let n=t==="ipv6"?{addressKey:"ipv6",cidrKey:"ipv6-cidr",defaultCIDR:128}:{addressKey:"ip",cidrKey:"ip-cidr",defaultCIDR:32},r=MI(e[n.addressKey],t);if(!r)return;let i=xA(e[n.cidrKey],n.defaultCIDR);return`${r.address}/${i??r.cidr??n.defaultCIDR}`}function Ho(e,t,n={}){return e=e.map(r=>{if(!Object.hasOwn(r,"ecn"))return r;let i={...r};return delete i.ecn,i}),t==="internal"?e:n.prettyYaml||n["pretty-yaml"]?im(Rs.safeDump({proxies:e},{lineWidth:-1})):`proxies:
`+e.map(r=>" - "+JSON.stringify(r)+`
`).join("")}var i2e=B(x());var pl="_dns",PA="_force-query",kA="_sockopt",qI="https://dns.alidns.com/dns-query";function Mg(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[,n,r]=t,i=(4-n.length%4)%4;if(!(i===3||r&&r.length!==i))return n.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat(i)}function jI(e){if(!qe(e))return;if(!e.includes("://"))return{type:"config",config:e};let t=e.split("+");if(t.length===1&&qe(t[0]))return{type:"dns",dns:t[0]};if(t.length===2&&qe(t[0])&&qe(t[1]))return{type:"dns",queryServerName:t[0],dns:t[1]}}function TA(e){return jI(e)!=null}function qg(e){return["none","half","full"].includes(e)}function RA(e){return typeof e=="boolean"?e:typeof e=="number"&&Number.isInteger(e)&&e!==0}function jg({echConfigList:e,echForceQuery:t,echSockopt:n}={}){let r=jI(e);if(!r)return;let i={enable:!0};return r.type==="config"?i.config=r.config:(i[pl]=r.dns,r.queryServerName&&(i["query-server-name"]=r.queryServerName)),qg(t)&&(i[PA]=t),ze(n)&&(i[kA]=n),i}function OA(e,t,{dnsFieldPath:n="ech-opts._dns",warnDefaultDns:r}={}){let i={};if(ze(e)){if(!RA(e.enable))return i;let o=e["query-server-name"];return qe(e.config)?i.echConfigList=e.config:qe(e[pl])?i.echConfigList=qe(o)?`${o}+${e[pl]}`:e[pl]:qe(o)&&(i.echConfigList=`${o}+${qI}`,r?.({defaultDns:qI,dnsFieldPath:n,queryServerName:o})),i.echConfigList&&qg(e[PA])&&(i.echForceQuery=e[PA]),i.echConfigList&&ze(e[kA])&&(i.echSockopt=e[kA]),i}return qe(t)&&(i.echConfigList=t),i}function NA(e,t,n){return OA(e,t,n).echConfigList}var l2e=B(x()),VI=B(Ga());var a2e=B(x());function LA(e,{allowZeroLowerBound:t=!0,allowZeroUpperBound:n=!0}={}){if(typeof e!="string"&&typeof e!="number")return;let r=h=>{let m=h.trim();if(!/^\+?\d+$/.test(m))return;let p=parseInt(m,10);return Number.isSafeInteger(p)?p:void 0},o=`${e}`.trim().split("-"),s=t?0:1,a=n?0:1;if(o.length===1){let h=r(o[0]),m=Math.max(s,a);return h>=m?{lowerBound:h,upperBound:h}:void 0}if(o.length!==2)return;let u=r(o[0]),l=r(o[1]);if(!(u==null||l==null))return u>=s&&l>=a&&l>=u?{lowerBound:u,upperBound:l}:void 0}function pX(e){return LA(e,{allowZeroUpperBound:!1})}function KI(e){return LA(e,{allowZeroLowerBound:!1,allowZeroUpperBound:!1})}function Mo(e){let t=pX(e);if(!t)return;let{lowerBound:n,upperBound:r}=t;return n===r?r:`${n}-${r}`}function Qf(e){let t=KI(e);if(!t)return;let{lowerBound:n,upperBound:r}=t;return n===r?`${r}`:`${n}-${r}`}function ml(e){let t=KI(e);if(!t)return;let{lowerBound:n,upperBound:r}=t;return n===r?r:`${n}-${r}`}function Hs(e){let t=LA(e);if(!t)return;let{lowerBound:n,upperBound:r}=t;return n===r?r:`${n}-${r}`}function Zr(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 n=e.trim();if(!(t?/^[+-]?\d+$/:/^\+?\d+$/).test(n))return;let i=parseInt(n,10);if(Number.isSafeInteger(i)&&!(!t&&i<0))return i}var eh={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 GI(e,t,n){if(!Object.prototype.hasOwnProperty.call(eh,t))return;let r=eh[t],i=n;switch(t){case"padding-obfs":case"no-grpc-header":if(n!=="true"&&n!=="false")return;i=n==="true";break;case"uplink-chunk-size":i=Hs(n)??n;break;case"max-each-post-bytes":i=ml(n)??n;break;case"min-posts-interval":i=Mo(n)??n;break;case"xmux-keep-alive":i=Zr(n)??n;break}VI.default.set(e,r,i)}var h2e=B(x()),Kg="auto",mX=[Kg,"none","zero","aes-128-gcm","chacha20-poly1305"],gX=[Kg,"aes-128-gcm","chacha20-poly1305","none"],vX=["none","chacha20-poly1305"],wX={"chacha20-ietf-poly1305":"chacha20-poly1305"};function zI(e){return e==null?"":`${e}`.trim().toLowerCase()}function UA(e){return wX[e]||e}function Vn(e,t=mX,{acceptAliases:n=!0,fallback:r=Kg}={}){let i=zI(e);if(!i)return r;let o=t.map(zI);if(o.includes(i))return UA(i);let s=UA(i),a=o.map(UA);return n&&a.includes(s)?s:r}function Ap(e){return Vn(e,gX)}function WI(e){return Vn(e,vX,{fallback:"chacha20-poly1305"})}function YI(e){let t=Ap(e);return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}function XI(e){let t=Vn(e,["aes-128-gcm","chacha20-poly1305"]);if(t!==Kg)return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}var Vg="Surge",th=class extends Error{constructor(t){super(t),this.name="SurgeUnsupportedProxyError"}};function Rr(e){return new th(e)}var yX={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function qo(e){if(typeof e!="string")return e;let t=e.trim(),n=t[0];return(n==='"'||n==="'")&&t[t.length-1]===n?t.slice(1,-1):t}function Gi(e){return`"${String(qo(e))}"`}function gl(e){return e!=null&&`${e}`.trim().length>0}function hr(e,t){let n=t.type==="direct",r=!["wireguard","wireguard-surge"].includes(t.type),i=t["ip-version"],o=qo(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 s={"ip-version":yX[i]??i,"no-error-alert":n?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":r?t["allow-other-interface"]:void 0,interface:r?t.interface??t["interface-name"]:void 0,"dns-follow-interface":r?t["dns-follow-interface"]:void 0,"block-quic":t["block-quic"],ecn:n?void 0:t.ecn,"underlying-proxy":n?void 0:t["underlying-proxy"]};for(let[a,u]of Object.entries(s)){if(u==null)continue;let l=typeof u=="string"&&u.includes(",")?Gi(u):u;e.append(`,${a}=${l}`)}}function HA(e,t){if(gl(t.ports)){if(gl(qo(t["underlying-proxy"])))throw new Error("Surge port-hopping cannot be combined with underlying-proxy");e.append(`,port-hopping="${String(t.ports).replace(/,/g,";")}"`)}gl(t["hop-interval"])&&e.append(`,port-hopping-interval=${t["hop-interval"]}`)}function JI(e){return(Array.isArray(e)?e:qo(`${e||""}`).split(",")).filter(n=>n!=null).map(n=>String(qo(n)).trim()).filter(n=>n!=="").join(",")}function QI(e,t){let n=JI(t.alpn);n&&e.append(`,alpn="${n}"`)}function e9(e,t){if(t.network==="h3"||["tuic","hysteria2","masque-surge"].includes(t.type))return;let n=t._surge_client_fingerprint??t["client-fingerprint"];if(typeof n!="string")return;let r=n.trim().toLowerCase();if(!["auto","none","apple-26","chromium-155"].includes(r)){let i=r.replace(/^hello/,"").split(/[-_]/,1)[0].replace(/([a-z])\d+$/,"$1");if(["chrome","edge","android","360","qq"].includes(i))r="chromium-155";else if(["safari","ios"].includes(i))r="apple-26";else if(["firefox","golang","random","randomized","randomizedalpn","randomizednoalpn"].includes(i))r="auto";else return}e.append(`,client-fingerprint=${r}`)}function EX(e){return JI(e?.["plugin-opts"]?.alpn??e?.alpn)}function za(e,t,n=!1){if(t.plugin!=="shadow-tls"||!t["plugin-opts"])return;let r=t["plugin-opts"].password,i=t["plugin-opts"].host,o=t["plugin-opts"].version;if(!r)return;if(e.append(`,shadow-tls-password="${r}"`),i&&e.append(`,shadow-tls-sni=${i}`),o){if(o<2)throw Rr(`shadow-tls version ${o} is not supported`);e.append(`,shadow-tls-version=${o}`)}let s=EX(t);s&&e.append(`,alpn="${s}"`),n&&e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function zi(e,t,n=!0){if(!n)return;e.appendIfPresent(`,server-cert-fingerprint-sha256=${t["tls-fingerprint"]}`,"tls-fingerprint"),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),e.appendIfPresent(`,server-cert-verify-name=${Gi(t["name-cert-verify"])}`,"name-cert-verify"),t.plugin!=="shadow-tls"&&QI(e,t),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify");let r=le(t,"keystore-client-cert")?t["keystore-client-cert"]:t["client-cert"];(le(t,"keystore-client-cert")||le(t,"client-cert"))&&e.append(`,client-cert=${Gi(r)}`),e9(e,t);let i=ze(t["ech-opts"])?t["ech-opts"]:void 0;if((i?RA(i.enable):qe(t._echConfigList))&&!t["reality-opts"]){let s=Mg(i?i.config:t._echConfigList);if(!s)throw Rr("Surge ECH requires an inline ECHConfigList in base64 or base64url");e.append(`,ech-config=${s}`)}}function bX(e,t){let n=le(t,"keystore-private-key")?t["keystore-private-key"]:t["private-key"];(le(t,"keystore-private-key")||le(t,"private-key"))&&e.append(`,private-key=${Gi(n)}`)}function t9(e){if(!le(e,"max-streams"))return;let t=Number(qo(e["max-streams"]));!Number.isInteger(t)||t<=3||J.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 AX(e){return le(e,"obfs-opts.mode")||le(e,"obfs-opts.host")||le(e,"obfs-opts.path")}function SX(e){return Number(e.version)===6&&AX(e)}function nh(){return{produce:(t,n,r={})=>{if(t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"]&&!["vmess","trojan","vless"].includes(t.type))throw Rr(`Platform ${Vg} does not support network ${t.network} with http upgrade`);switch(t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return CX(t);case"trojan":return _X(t);case"vmess":case"vless":return $X(t,r["include-unsupported-proxy"]);case"http":return TX(t);case"h2-connect":return IX(t);case"direct":return RX(t);case"socks5":return OX(t);case"snell":return LX(t);case"tuic":return UX(t);case"wireguard-surge":return n9(t);case"hysteria2":return MX(t);case"ssh":return kX(t);case"trusttunnel":return FX(t);case"masque-surge":return BX(t)}if(r["include-unsupported-proxy"]&&t.type==="wireguard")return HX(t);if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw Rr(`Platform ${Vg} does not support proxy type ${t.type} with network or REALITY`);return DX(t)}throw Rr(`Platform ${Vg} does not support proxy type: ${t.type}`)}}}function CX(e){let t=new We(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 Rr(`cipher ${e.cipher} is not supported`);if(t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password"),le(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 Rr(`plugin ${e.plugin} is not supported`)}return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),za(t,e,!0),hr(t,e),t.toString()}function _X(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),jA(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),zi(t,e),za(t,e),hr(t,e),t.toString()}function DX(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),zi(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),hr(t,e),t.toString()}function FX(e){let t=new We(e);if(t.append(`${e.name}=trust-tunnel,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),le(e,"client-random-auth-key")){let n=qo(e["client-random-auth-key"]);if(typeof n!="string"||!/^[0-9a-f]+$/i.test(n))throw new Error("TrustTunnel client-random-auth-key must be a hex string");t.append(`,client-random-auth-key=${n}`)}return MA(t,e),t9(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),e.network==="h3"&&t.append(",h3=true"),zi(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),hr(t,e),t.toString()}function BX(e){let t=new We(e);return t.append(`${e.name}=masque,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),HA(t,e),zi(t,e),hr(t,e),t.toString()}function IX(e){let t=new We(e);return t.append(`${e.name}=h2-connect,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),MA(t,e),t9(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),zi(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),za(t,e),hr(t,e),t.toString()}function $X(e,t){let n=e.type==="vless",r=new We(e);if(r.append(`${e.name}=${e.type},${e.server},${e.port}`),r.appendIfPresent(`,username=${e.uuid}`,"uuid"),!n){let i=XI(e.cipher);i&&r.append(`,encrypt-method=${i}`)}if(n)xX(r,e);else{jA(r,e,t);let i=le(e,"aead")?e.aead:e.alterId===0;r.append(`,vmess-aead=${i}`),r.appendIfPresent(`,tls=${e.tls}`,"tls"),zi(r,e,!!e.tls)}return za(r,e),hr(r,e),r.toString()}function xX(e,t){let n=t.network??"tcp",r=t["reality-opts"],i=t.tls||r;if(!["tcp","raw","none","ws","grpc","xhttp"].includes(n))throw Rr(`VLESS network ${n} is unsupported`);if(t.encryption&&/[,\r\n"']/.test(t.encryption))throw Rr("VLESS encryption contains unsupported characters");if(!Lg(t))throw Rr("Unsupported VLESS transport, TLS or flow combination");if(n==="ws")jA(e,t);else if(n==="grpc"){e.append(",grpc=true");let o=t["grpc-opts"];for(let[s,a]of[["grpc-service-name",o?.["grpc-service-name"]],["grpc-mode",o?.["_grpc-type"]],["grpc-authority",o?.["_grpc-authority"]]])a&&e.append(`,${s}=${a}`)}else n==="xhttp"&&PX(e,t);t.flow&&e.append(`,flow=${t.flow}`),t.encryption&&e.append(`,encryption=${t.encryption}`),r?(e.append(`,reality-public-key=${r["public-key"]}`),r["short-id"]&&e.append(`,reality-short-id=${r["short-id"]}`),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),QI(e,t),e9(e,t)):(e.appendIfPresent(`,tls=${t.tls}`,"tls"),zi(e,t,!!i))}function PX(e,t){let n=t["xhttp-opts"];if(n?.["download-settings"])throw Rr("VLESS XHTTP download-settings are unsupported");e.append(",xhttp=true");let r=ze(n?.headers)?Object.entries(n.headers):[],i=n?.host??r.find(([a])=>/^host$/i.test(a))?.[1];for(let[a,u]of Object.entries(eh)){let l=a==="host"?i:ZI.default.get(n,u);if(l==null)continue;let h=String(l),m=qo(h);if(!m&&a!=="session-table")continue;if(/[\r\n]/.test(h)||m.includes('"'))throw Rr(`VLESS xhttp-${a} contains unsupported characters`);let p=!m||/[,'\s]/.test(m)?Gi(m):m;e.append(`,xhttp-${a}=${p}`)}let o=r.filter(([a])=>!/^host$/i.test(a));if(o.some(([a,u])=>/[,="':|\r\n]/.test(a)||/[\r\n]/.test(String(u))))throw Rr("VLESS xhttp-headers contain unsupported characters");let s=qA(Object.fromEntries(o),"|");s&&e.append(`,xhttp-headers=${Gi(s)}`)}function kX(e){let t=new We(e);return t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),bX(t,e),t.appendIfPresent(`,idle-timeout=${e["idle-timeout"]}`,"idle-timeout"),t.appendIfPresent(`,server-fingerprint="${e["server-fingerprint"]}"`,"server-fingerprint"),hr(t,e),t.toString()}function TX(e){let t=new We(e),n=e.tls?"https":"http";return t.append(`${e.name}=${n},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),MA(t,e),zi(t,e,!!e.tls),za(t,e),hr(t,e),t.toString()}function RX(e){let t=new We(e);return t.append(`${e.name}=direct`),hr(t,e),t.toString()}function OX(e){let t=new We(e),n=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${n},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),zi(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),za(t,e),hr(t,e),t.toString()}function MA(e,t){let n=NX(t.headers);qe(n)&&e.append(`,headers=${Gi(n)}`)}function NX(e){return qA(e,";")}function qA(e,t){return!e||typeof e!="object"?"":Object.entries(e).filter(([n,r])=>qe(n)&&r!=null).map(([n,r])=>`${n}:${Gi(r)}`).join(t)}function LX(e){if(SX(e))return J.error(`Platform ${Vg} does not support Snell version ${e.version} with obfs`),"";let t=new We(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"),za(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),hr(t,e),t.toString()}function UX(e){let t=new We(e),n=e.type;return(!e.token||e.token.length===0)&&(n="tuic-v5"),t.append(`${e.name}=${n},${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,token=${e.token}`,"token"),HA(t,e),zi(t,e),za(t,e),hr(t,e),t.toString()}function HX(e){let t=Array.isArray(e.peers)&&e.peers.length>0?e.peers:[e],{ip:n,ipv6:r}=bp({ip:e["self-ip"]??e.ip??t[0].ip,ipv6:e["self-ip-v6"]??e.ipv6??t[0].ipv6}),i=qe(e["private-key-keystore-name"])?"private-key-keystore-name":"private-key",o=e[i];if(!gl(o)||!n&&!r)throw new Error("Surge WireGuard requires a local address and either private-key or private-key-keystore-name");let s=e["listen-port"];if(s!=null&&(!/^\d+$/.test(`${s}`.trim())||s<1||s>65535))throw new Error("Surge WireGuard listen-port must be between 1 and 65535");let a=vt(e["section-name"],e.name).trim(),u=n9({...e,"section-name":a,"underlying-proxy":s==null?e["underlying-proxy"]:void 0}),l=new We(e);l.append(`# > WireGuard Proxy ${e.name}
# ${u}
# > WireGuard Section ${e.name}
[WireGuard ${a}]
${i} = ${o}`),n&&l.append(`
self-ip = ${n}`),r&&l.append(`
self-ip-v6 = ${r}`);let h=e["dns-server"]??e.dns,m=Array.isArray(h)?h.join(", "):h;qe(m)&&l.append(`
dns-server = ${m}`),l.appendIfPresent(`
mtu = ${e.mtu}`,"mtu"),le(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"];s==null&&p!=null&&l.append(`
allow-peer-access = ${p}`),l.appendIfPresent(`
listen-port = ${s}`,"listen-port");let d=t.length===1?e:{},v=t.length===1&&s==null&&(p==null||/^false$/i.test(`${p}`.trim()))?[n&&"0.0.0.0/0",r&&"::/0"].filter(Boolean).join(","):void 0;for(let g of t){let y=g["allowed-ips"]??d["allowed-ips"],w=qo(Array.isArray(y)?y.join(","):y)||v;if(!gl(g["public-key"])||!w)throw new Error("Surge WireGuard peers require public-key and allowed-ips");let E=g.endpoint;if(!qe(E)&&qe(g.server)&&gl(g.port)){let H=g.server.trim();E=`${Xt(H)?`[${H}]`:H}:${g.port}`}if(!qe(E)&&s==null)throw new Error("Surge WireGuard peers require endpoint without listen-port");let C=qo(g["client-id"]??g.reserved);Array.isArray(C)?C=C.join("/"):/^[\da-f]{6}$/i.test(C)&&(C=`0x${C}`);let _={"public-key":g["public-key"],"allowed-ips":Gi(w),endpoint:E,keepalive:g["persistent-keepalive"]??g.keepalive??g["persistent-keepalive-interval"]??e["persistent-keepalive"]??e.keepalive,"client-id":C,"preshared-key":g["preshared-key"]??g["pre-shared-key"]??d["preshared-key"]??d["pre-shared-key"]},F=Object.entries(_).filter(([,H])=>gl(H)).map(([H,K])=>`${H} = ${K}`).join(", ");l.append(`
peer = (${F})`)}return l.toString()}function n9(e){let t=vt(e["section-name"])?.trim();if(!t)throw new Error("Surge WireGuard requires section-name");let n=t.includes(",")?Gi(t):t,r=new We(e);return r.append(`${e.name}=wireguard,section-name=${n}`),hr(r,e),r.toString()}function MX(e){let t={salamander:"salamander-password",gecko:"gecko-password"}[e.obfs];if(e["obfs-password"]&&!t)throw Rr("only salamander and gecko obfs are supported");let n=new We(e);return n.append(`${e.name}=hysteria2,${e.server},${e.port}`),n.appendIfPresent(`,password="${e.password}"`,"password"),HA(n,e),e["obfs-password"]&&t&&n.append(`,${t}="${e["obfs-password"]}"`),zi(n,e),za(n,e),n.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),hr(n,e),n.toString()}function jA(e,t,n){if(le(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),le(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"),le(t,"ws-opts.headers"))){let r=t["ws-opts"].headers,i=qA(r,"|");qe(i)&&e.append(`,ws-headers=${Gi(i)}`)}}else if(n&&["http"].includes(t.network))J.info(`Include Unsupported Proxy: network ${t.network} -> tcp`);else{if(["tcp"].includes(t.network)&&t["reality-opts"])throw Rr("reality is unsupported");if(!["tcp"].includes(t.network))throw Rr(`network ${t.network} is unsupported`)}}var L2e=B(x());var $2e=B(x()),o9=B(wa());var A2e=B(x());function KA(e){try{return decodeURIComponent(`${e}`.replace(/\+/g,"%20"))}catch{return e}}function Gg(e){let t=e.indexOf("=");return t===-1?{key:KA(e),value:""}:{key:KA(e.slice(0,t)),value:KA(e.slice(t+1))}}function li(e){if(!/^\d+$/.test(`${e}`))return null;let t=parseInt(`${e}`,10);return Number.isSafeInteger(t)?t:null}function Ss(e,t){let n=e==null?"":`${e}`,r=n.indexOf("?");if(r===-1)return{path:n,value:""};let i=n.slice(0,r),o=n.slice(r+1),s=[],a="";for(let u of o.split("&")){if(u==="")continue;let l=Gg(u);if(l.key===t){a===""&&l.value!==""&&(a=l.value);continue}s.push(u)}return{path:s.length>0?`${i}?${s.join("&")}`:i,value:a}}function vl(e,t){let n=e==null?"":`${e}`,r=n.indexOf("?");if(r===-1)return"";let i=n.slice(r+1);for(let o of i.split("&")){if(o==="")continue;let s=Gg(o);if(s.key===t&&s.value!=="")return s.value}return""}function VA(e,t){let n=vl(e,t),r=li(n);return r==null?{value:"",parsed:null}:{value:n,parsed:r}}function qX(e,t,n){let r=e.includes("?")?e.endsWith("?")||e.endsWith("&")?"":"&":"?";return`${e}${r}${encodeURIComponent(t)}=${encodeURIComponent(`${n}`)}`}function GA(e,t,n){let r=e==null||e===""?"/":`${e}`,{path:i}=Ss(r,t);return qX(i,t,n)}function tc(e){let t=e?.path;if(!e)return;let{value:n,parsed:r}=VA(t,"ed");if(e["v2ray-http-upgrade"]){n!==""&&(e.path=Ss(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"]=n)),delete e["early-data-header-name"],delete e["max-early-data"];return}n!==""&&(e.path=Ss(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"]=r))}function nc(e){e&&delete e["_v2ray-http-upgrade-ed"]}var jX={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"};function r9(e,t,n){if(!ze(t)||!qe(t[pl]))return;let r=qe(t["query-server-name"])?t["query-server-name"]:"\u8FD9\u91CC\u662F query-server-name";J.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"]["${r}"] = ["${t[pl]}"].`)}function KX(e,t){t!=="internal"&&(r9(e,e["ech-opts"],"ech-opts"),r9(e,e["xhttp-opts"]?.["download-settings"]?.["ech-opts"],"xhttp-opts.download-settings.ech-opts"))}function Ms(){return{type:"ALL",produce:(n,r,i={})=>{let o=n.filter(s=>{if(!Ug(s,"Mihomo"))return!1;if(i["include-unsupported-proxy"])return!0;if(s.type==="h2-connect")return J.error(`mihomo does not support HTTP/2 CONNECT proxy type. Proxy ${s.name} has been filtered.`),!1;if(s.type==="masque-surge")return J.error(`mihomo does not support Surge MASQUE proxy type. Proxy ${s.name} has been filtered.`),!1;if(VX(s)&&s.type==="trusttunnel")return J.error(`mihomo does not support headers for TrustTunnel proxy ${s.name}. Proxy has been filtered.`),!1;if(Jf(s,["websocket"])){if(s.type==="snell"&&!GX(s))return!1;if(s9(s)&&(!["ss","snell","vmess","vless","trojan","anytls"].includes(s.type)||!zA(i9(s),["ss","snell"].includes(s.type)?[1,2,3]:[0,1,2,3])))return!1;if(s.type==="vless"&&s.network==="xhttp"&&s9(s["xhttp-opts"]?.["download-settings"])&&!zA(i9(s["xhttp-opts"]["download-settings"]),[0,1,2,3]))return!1;if(zX(s))return J.error(`Platform Mihomo does not support Snell shadow-tls with obfs for proxy ${s.name}. Proxy has been filtered.`),!1;if(["juicity","naive"].includes(s.type))return!1;if(["ss"].includes(s.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(s.cipher))return!1;if(["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"]))return!1;if(!["vless"].includes(s.type)&&["xhttp"].includes(s.network))return!1}else return!1;return!0}).map(s=>{if(KX(s,r),Hg(s),s["reality-opts"]&&!s["client-fingerprint"]&&(s["client-fingerprint"]="chrome"),s.type==="vmess")le(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.cipher=Vn(s.cipher);else if(s.type==="tuic")le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!le(s,"version")&&(s.version=5);else if(s.type==="hysteria")le(s,"auth_str")&&!le(s,"auth-str")&&(s["auth-str"]=s.auth_str),le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo);else if(s.type==="wireguard")s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"],s.ip=As(s,"ipv4"),s.ipv6=As(s,"ipv6");else if(s.type==="vless"){if(le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.network==="xhttp"&&s["xhttp-opts"]?.["download-settings"]){let a=s["xhttp-opts"]["download-settings"];s.tls&&a.tls&&s["reality-opts"]&&!a["reality-opts"]&&(a["reality-opts"]={"public-key":""})}}else["anytls"].includes(s.type)&&s.reuse!=null&&!s.reuse&&(s["disable-reuse"]=!0,delete s.reuse);if(le(s,"plugin-opts.mux")&&(s["plugin-opts"].mux=HI(s["plugin-opts"].mux)),s.type==="snell"){let a=Number(s.version??1);s.version!=null&&Number.isInteger(a)&&(s.version=a),a<3&&delete s.udp,a<6&&delete s.mode;let u=WA(s);u&&(s["obfs-opts"]={...u,mode:"shadow-tls"},delete s.plugin,delete s["plugin-opts"])}if(["vmess","vless"].includes(s.type)&&s.network==="http"){let a=s["http-opts"]?.path;le(s,"http-opts.path")&&!Array.isArray(a)&&(s["http-opts"].path=[a]);let u=s["http-opts"]?.headers?.Host;le(s,"http-opts.headers.Host")&&!Array.isArray(u)&&(s["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let a=s["h2-opts"]?.path;le(s,"h2-opts.path")&&Array.isArray(a)&&(s["h2-opts"].path=a[0]);let u=s["h2-opts"]?.host??s["h2-opts"]?.headers?.host??s["h2-opts"]?.headers?.Host;(le(s,"h2-opts.host")||le(s,"h2-opts.headers.host")||le(s,"h2-opts.headers.Host"))&&(s["h2-opts"].host=Array.isArray(u)?u:[u]),s["h2-opts"]?.headers&&(delete s["h2-opts"].headers.host,delete s["h2-opts"].headers.Host,Object.keys(s["h2-opts"].headers).length===0&&delete s["h2-opts"].headers)}if(["ws"].includes(s.network)){let a=`${s.network}-opts`;s[a]=s[a]||{},s[a].path||(s[a].path="/"),tc(s[a])}if(s["plugin-opts"]?.tls&&le(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["plugin-opts"]["skip-cert-verify"]||s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive","masque","shadowquic"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],s["underlying-proxy"]&&(s["dialer-proxy"]=s["underlying-proxy"]),delete s["underlying-proxy"],le(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],delete s["ip-cidr"],delete s["ipv6-cidr"],r!=="internal"||i["delete-underscore-fields"]){for(let a in s)(s[a]==null||/^_/i.test(a))&&delete s[a];nc(s[`${s.network}-opts`])}return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s["ip-version"]&&(s["ip-version"]=jX[s["ip-version"]]||s["ip-version"]),s});return Ho(o,r,i)}}}function VX(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function zA(e,t){if(e==null)return!0;let n=typeof e=="string"?e.trim():`${e}`;if(!n)return!1;let r=Number(n);return Number.isInteger(r)&&t.includes(r)}function GX(e){if(!zA(e.version,[0,1,2,3,4,5,6]))return!1;let t=Number(e.version)===6,{psk:n,mode:r,"obfs-opts":i}=e,o=["","shadow-tls","restls","jls"];t||o.push("http","tls");let s;if(typeof n!="string"&&!Number.isFinite(n))s="missing or invalid PSK";else if(i!=null&&!ze(i))s="obfs-opts must be a mapping";else if(!o.includes(i?.mode??""))s="unsupported obfs-opts.mode";else if(t){let a=o9.Buffer.byteLength(String(n),"utf8");a<12||a>255?s="PSK must be 12 to 255 UTF-8 bytes":["","default","unshaped","unsafe-raw"].includes(r??"")||(s="unsupported mode")}return s?(J.error(`Mihomo Snell proxy ${e.name} has been filtered. ${s}.`),!1):!0}function s9(e){return!!WA(e)}function zX(e){return e?.type==="snell"&&e?.plugin==="shadow-tls"&&(le(e,"obfs-opts.mode")||le(e,"obfs-opts.host")||le(e,"obfs-opts.path"))}function i9(e){return WA(e)?.version}function WA(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 u9="SurgeMac",c9=nh();function Sp(){return{produce:(t,n,r={})=>{switch(t.type){case"external":return l9(t);default:{if(r.mihomoExternal||t._mihomoExternal)return a9(t,n,r)||"";try{return c9.produce(t,n,r)}catch(i){if(r.useMihomoExternal&&i instanceof th){let o=a9(t,n,r)||"";if(!o)throw i;return J.log(`${t.name} is not supported on ${u9}, try to use mihomo(SurgeMac - External Proxy Program) instead`),o}throw i instanceof th?new Error(`${i.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`):i}}}}}}function l9(e){let t=new We(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(n=>{t.append(`,args="${n}"`)}),Array.isArray(e.addresses)&&e.addresses.map(n=>{t.append(`,addresses=${n}`)}),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),hr(t,e),t.toString()}function a9(e,t,n){let r=Ms().produce([e],"internal")?.[0];if(r){let i=n?.localPort||e._localPort||65535,o=!["ipv4","v4-only"].includes(e["ip-version"]),s={enable:!0,ipv6:o,"default-nameserver":n?.defaultNameserver||e._defaultNameserver||["180.76.76.76","52.80.52.52","119.28.28.28","223.6.6.6"],nameserver:n?.nameserver||e._nameserver||["https://doh.pub/dns-query","https://dns.alidns.com/dns-query","https://doh-pure.onedns.net/dns-query"]},a=n?.merge||e._merge,u;if(a){let l={name:e.name,type:"socks5",server:"127.0.0.1",port:i,udp:!0};u=c9.produce(l,"socks5",n),n._merged=n._merged||{name:n?.mergeName||e._mergeName||"mihomo merged",exec:n?.exec||e._exec||"/usr/local/bin/mihomo",config:{ipv6:o,mode:"global",dns:s,proxies:[],"proxy-groups":[{name:"GLOBAL",type:"fallback",proxies:[]}],listeners:[]}};let h=`${i}`;n._merged.config.listeners.push({name:`socks5-${i}`,type:"socks",port:i,listen:"127.0.0.1",udp:!0,proxy:h}),n._merged.config["proxy-groups"][0].proxies.push(h),n._merged.config.proxies.push({...r,name:h});let m=n?.config||e._config;m&&(n._merged.configOverride={...n._merged.configOverride||{},...m})}else{let l={name:e.name,type:"external",udp:!0,exec:n?.exec||e._exec||"/usr/local/bin/mihomo","local-port":i,args:["-config",bt.encode(JSON.stringify({"mixed-port":i,ipv6:o,mode:"global",dns:s,proxies:[{...r,name:"proxy"}],"proxy-groups":[{name:"GLOBAL",type:"select",proxies:["proxy"]}],...n?.config||e._config||{}}))],addresses:[]};WX(e.server)?l.addresses.push(e.server):J.warn(`Platform ${u9}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),u=l9(l)}return n.localPort=i-1,u}}function WX(e){return Sn(e)||Xt(e)}var K2e=B(x());function zg(){return{type:"ALL",produce:(n,r,i={})=>{let o=n.filter(s=>i["include-unsupported-proxy"]?!0:!["ss","ssr","vmess","vless","socks5","http","snell","trojan","wireguard"].includes(s.type)||s.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(s.cipher)||s.type==="snell"&&s.version>=4||s.type==="vless"&&(typeof s.flow<"u"||s["reality-opts"])||["ws"].includes(s.network)&&s["ws-opts"]?.["v2ray-http-upgrade"]?!1:s["underlying-proxy"]||s["dialer-proxy"]?(J.error(`Clash \u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${s.name}`),!1):!0).map(s=>{if(s.type==="vmess"?(le(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.cipher=Ap(s.cipher)):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"]):s.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"&&le(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let a=s["http-opts"]?.path;le(s,"http-opts.path")&&!Array.isArray(a)&&(s["http-opts"].path=[a]);let u=s["http-opts"]?.headers?.Host;le(s,"http-opts.headers.Host")&&!Array.isArray(u)&&(s["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let a=s["h2-opts"]?.path;le(s,"h2-opts.path")&&Array.isArray(a)&&(s["h2-opts"].path=a[0]);let u=s["h2-opts"]?.host??s["h2-opts"]?.headers?.host??s["h2-opts"]?.headers?.Host;(le(s,"h2-opts.host")||le(s,"h2-opts.headers.host")||le(s,"h2-opts.headers.Host"))&&(s["h2-opts"].host=Array.isArray(u)?u:[u]),s["h2-opts"]?.headers&&(delete s["h2-opts"].headers.host,delete s["h2-opts"].headers.Host,Object.keys(s["h2-opts"].headers).length===0&&delete s["h2-opts"].headers)}if(["ws"].includes(s.network)){let a=`${s.network}-opts`;s[a]=s[a]||{},s[a].path||(s[a].path="/"),tc(s[a])}if(s["plugin-opts"]?.tls&&le(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["plugin-opts"]["skip-cert-verify"]||s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],le(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],delete s["ip-cidr"],delete s["ipv6-cidr"],r!=="internal"){for(let a in s)(s[a]==null||/^_/i.test(a))&&delete s[a];nc(s[`${s.network}-opts`])}return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return Ho(o,r,i)}}}var Z2e=B(x());function Wg(){return{type:"ALL",produce:(n,r,i={})=>{let o=n.filter(s=>{if(i["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(s.type)||s.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(s.cipher)||s.type==="snell"&&s.version>6)return!1;if(Jf(s,["websocket"])){if(["vless"].includes(s.type)&&s["reality-opts"]&&s.network&&!["tcp"].includes(s.network))return!1;if(["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"]))return!1;if(!["vless"].includes(s.type)&&["xhttp"].includes(s.network))return!1;if(["ws"].includes(s.network)&&s["ws-opts"]?.["v2ray-http-upgrade"])return!1}else return!1;return!0}).map(s=>{if(s.type==="vmess"?(le(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.cipher=Ap(s.cipher)):s.type==="tuic"?(le(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),(!s.token||s.token.length===0)&&!le(s,"version")&&(s.version=5)):s.type==="hysteria"?(le(s,"auth_str")&&!le(s,"auth-str")&&(s["auth-str"]=s.auth_str),le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),le(s,"down")&&!le(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),le(s,"up")&&!le(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),le(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),le(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="hysteria2"?(le(s,"password")&&!le(s,"auth")&&(s.auth=s.password,delete s.password),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),le(s,"down")&&!le(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),le(s,"up")&&!le(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),le(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),le(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"]):s.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"&&le(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let a=s["http-opts"]?.path;le(s,"http-opts.path")&&!Array.isArray(a)&&(s["http-opts"].path=[a]);let u=s["http-opts"]?.headers?.Host;le(s,"http-opts.headers.Host")&&!Array.isArray(u)&&(s["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let a=s["h2-opts"]?.path;le(s,"h2-opts.path")&&Array.isArray(a)&&(s["h2-opts"].path=a[0]);let u=s["h2-opts"]?.host??s["h2-opts"]?.headers?.host??s["h2-opts"]?.headers?.Host;(le(s,"h2-opts.host")||le(s,"h2-opts.headers.host")||le(s,"h2-opts.headers.Host"))&&(s["h2-opts"].host=Array.isArray(u)?u:[u]),s["h2-opts"]?.headers&&(delete s["h2-opts"].headers.host,delete s["h2-opts"].headers.Host,Object.keys(s["h2-opts"].headers).length===0&&delete s["h2-opts"].headers)}if(["ws"].includes(s.network)){let a=`${s.network}-opts`;s[a]=s[a]||{},s[a].path||(s[a].path="/"),tc(s[a])}if(s["plugin-opts"]?.tls&&le(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["plugin-opts"]["skip-cert-verify"]||s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s["server-cert-fingerprint"]=s["tls-fingerprint"]),delete s["tls-fingerprint"],s["underlying-proxy"]&&(s["dialer-proxy"]=s["underlying-proxy"]),delete s["underlying-proxy"],le(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,s["test-url"]&&(s["benchmark-url"]=s["test-url"],delete s["test-url"]),s["test-timeout"]&&(s["benchmark-timeout"]=s["test-timeout"],delete s["test-timeout"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],delete s["ip-cidr"],delete s["ipv6-cidr"],r!=="internal"){for(let a in s)(s[a]==null||/^_/i.test(a))&&delete s[a];nc(s[`${s.network}-opts`])}return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return Ho(o,r,i)}}}var uve=B(x()),g9=B(wa()),v9=B(Ga());var eve=B(x()),YA=B(Ga());var f9={"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"},h9={"session-id-placement":"session-placement","session-id-key":"session-key"},XA={"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"},YX={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",...XA,...f9,...h9},Cp={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",...f9,"no-grpc-header":"no-grpc-header",...h9,"session-id-table":"session-table","session-id-length":"session-length","seq-placement":"seq-placement","seq-key":"seq-key",...XA,...Object.fromEntries(Object.entries(YX).map(([e,t])=>[`download-${e}`,`download-settings.${t}`]))};function d9(e){if(e)for(let t of["","download-"]){let n=o=>YA.default.get(e,Cp[`${t}${o}`]);for(let o of Object.keys(XA)){let s=n(o);if(s==null)continue;let a=o==="xmux-http-keepalive-secs",u=a?Zr(s):Hs(s);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 r=n("xmux-max-concurrency"),i=n("xmux-max-connections");if(Mo(r)!=null&&Mo(i)!=null){let o=`xhttp-${t}xmux`;throw new Error(`Loon ${o}-max-concurrency and ${o}-max-connections cannot both be positive`)}}}function p9(e,t,n){if(t==="header"||t==="download-header"){let r=n.indexOf(":");if(r<=0)return;let i=n.slice(0,r).trim();if(!i||/^host$/i.test(i))return;let o=t==="header"?e:e["download-settings"]??={};o.headers={...o.headers,[i]:n.slice(r+1).trim()};return}if(Object.prototype.hasOwnProperty.call(Cp,t)){switch(t.replace(/^download-/,"")){case"padding-obfs-mode":case"no-grpc-header":case"over-tls":case"skip-cert-verify":if(n!=="true"&&n!=="false")return;n=n==="true";break;case"min-post-interval-ms":case"max-post-bytes":case"uplink-chunk-size":n=Hs(n)??n;break;case"port":case"xmux-http-keepalive-secs":n=Zr(n)??n;break;case"alpn":n=[n];break}YA.default.set(e,Cp[t],n)}}var _p="Loon",qs={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function ZA(){let e=(t,n,r={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${_p} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return ZX(t);case"ssr":return JX(t);case"snell":return QX(t);case"trojan":return eZ(t);case"vmess":return nZ(t,r["include-unsupported-proxy"]);case"vless":return sZ(t,r["include-unsupported-proxy"]);case"http":return iZ(t);case"socks5":return oZ(t);case"wireguard":return uZ(t);case"tailscale":return aZ(t);case"hysteria2":return lZ(t);case"mieru":return cZ(t)}if(t.type==="anytls"){if(t.network&&!["tcp"].includes(t.network))throw new Error(`Platform ${_p} does not support proxy type ${t.type} with network ${t.network}`);return tZ(t)}throw new Error(`Platform ${_p} does not support proxy type: ${t.type}`)};return{produce:(t,n,r={})=>{let i=e(t,n,r),o=t["server-dns"];return Array.isArray(o)&&o.length>0?`${i},server-dns="${o.join(",")}"`:i}}}function rc(e,t){let n=b9(t);n&&e.append(`,tls-profile=${n}`)}function wl(e,t,n=!1){let r=n?E9(t):y9(t);r&&e.append(`,alpn="${r}"`)}function Wa(e,t=!1){let n=String(e);if(/["\r\n]/.test(n))throw new Error("Unsupported characters in Loon option");return t||!n||/[,\s]/.test(n)?`"${n}"`:n}function JA(e,t){let n=t["xhttp-opts"],r=n?.["download-settings"];if(r?.plugin||r?.["shadow-tls-opts"])throw new Error("Loon XHTTP download-settings do not support plugins");d9(n);let i=n;if(r){let o=vt(r.server)??vt(t.server);if(o==null)throw new Error("Loon xhttp-download-server requires a server address");let s=Zr(r.port??t.port);if(s==null||s<1||s>65535)throw new Error("Loon xhttp-download-port must be an integer from 1 to 65535");let a=r["reality-opts"],u=!!vt(a?.["public-key"]);if(a&&!u)throw new Error("Loon XHTTP download REALITY requires a non-blank public-key");if(u&&[!1,"false"].includes(r.tls))throw new Error("Loon XHTTP download REALITY conflicts with xhttp-download-over-tls=false");let l=E9(r,!0),h=r.fingerprint??r["tls-fingerprint"],m=r["tls-pubkey-sha256"],p=r["skip-cert-verify"];if(u&&(h||m||[!0,"true"].includes(p)))throw new Error("Loon XHTTP download REALITY conflicts with skip-cert-verify=true or TLS certificate fingerprints");i={...n,"download-settings":{...r,server:o.trim(),port:s,host:m9(r),alpn:l||void 0,servername:r.servername??r.sni,fingerprint:u?void 0:h,"tls-pubkey-sha256":u?void 0:m,"skip-cert-verify":u?void 0:p,_loon_tls_profile:b9(r)}}}e.append(",transport=xhttp");for(let[o,s]of[["path",n?.path],["host",m9(n)]])s!=null&&e.append(`,${o}=${Wa(s)}`);for(let[o,s]of Object.entries(Cp)){let a=v9.default.get(i,s);a!=null&&e.append(`,xhttp-${o}=${Wa(a)}`)}for(let[o,s]of[["xhttp-header",n?.headers],["xhttp-download-header",r?.headers]])if(ze(s))for(let[a,u]of Object.entries(s))/^host$/i.test(a)||u==null||e.append(`,${o}=${Wa(`${a}: ${u}`,!0)}`)}function m9(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 XX(e){let t=e?.["plugin-opts"]?.alpn??e?.alpn;return(Array.isArray(t)?t:`${t||""}`.split(",")).map(r=>`${r}`.trim()).filter(r=>r!=="").join(",")}function w9(e,t){if(t.plugin!=="shadow-tls"||!t["plugin-opts"])return;let n=t["plugin-opts"].password,r=t["plugin-opts"].host,i=t["plugin-opts"].version;if(!n)return;if(e.append(`,shadow-tls-password=${n}`),r&&e.append(`,shadow-tls-sni=${r}`),i){if(i<2)throw new Error(`shadow-tls version ${i} is not supported`);e.append(`,shadow-tls-version=${i}`)}rc(e,t);let o=XX(t);o&&e.append(`,alpn="${o}"`),e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function Yg(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 y9(e){return(Array.isArray(e.alpn)?e.alpn:`${e.alpn||""}`.split(",")).map(n=>`${n}`.trim()).filter(n=>n!=="").join(",")}function E9(e,t=!1){let n=y9(e);if(!n)return n;if(n.includes(",")){let s=t?" download":"";throw new Error(`Loon XHTTP${s} supports only a single ALPN`)}let r=!!e["reality-opts"]?.["public-key"],i=!t&&e.type==="trojan"||[!0,"true"].includes(e.tls),o=r?["h2"]:i?["http/1.1","h2","h3"]:["http/1.1"];if(!o.includes(n)){let s=t?"xhttp-download-alpn":"XHTTP alpn";throw new Error(`Loon ${s} must be ${o.join(" or ")} for the configured security`)}return n}function b9(e){let t=`${e._loon_tls_profile||""}`.trim();if(["global","default","safari-ios18","safari-ios-26","chrome","chrome147"].includes(t))return t;let n=`${e["client-fingerprint"]||""}`.trim();if(e["reality-opts"]?.["support-x25519mlkem768"])return["safari","ios"].includes(n)?"safari-ios-26":"chrome147";switch(n){case"chrome":return"chrome";case"safari":case"ios":return"safari-ios18"}}function ZX(e){let t=new We(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}"`),le(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`)}w9(t,e),e["udp-over-tcp"]&&(e["udp-over-tcp-version"]===2?e.plugin==="obfs"?J.error(`Platform ${_p} shadowsocks udp-over-tcp does not support obfs`):t.append(",udp-over-tcp=true"):J.error(`Platform ${_p} 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 n=qs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function JX(e){let t=new We(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"),w9(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 n=qs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function QX(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 n=e["obfs-opts"];if(e.plugin||n?.mode&&!["none","http"].includes(n.mode))throw new Error("Loon Snell only supports HTTP obfs");let r=new We(e);r.append(`${e.name}=snell,${e.server},${e.port},${Wa(e.psk,!0)},version=${t}`),n?.mode==="http"&&(r.append(",obfs=http"),n.host!=null&&r.append(`,obfs-host=${Wa(n.host)}`),n.path!=null&&r.append(`,obfs-uri=${Wa(n.path)}`)),r.appendIfPresent(`,udp=${e.udp}`,"udp");let i=e["block-quic"];(i==="on"||i==="off")&&r.append(`,block-quic=${i==="on"}`);let o=qs[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${o}`,"ip-version"),r.toString()}function eZ(e){let t=!!e["reality-opts"],n=e.network==="xhttp",r=new We(e);if(r.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,le(e,"network"))if(e.network==="ws")r.append(",transport=ws"),r.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),r.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(n)JA(r,e);else throw new Error(`network ${e.network} is unsupported`);r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),rc(r,e),wl(r,e,n),t?Yg(r,e):(r.appendIfPresent(`,${n?"sni":"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 i=qs[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${i}`,"ip-version"),r.toString()}function tZ(e){let t=!!e["reality-opts"],n=new We(e);n.append(`${e.name}=anytls,${e.server},${e.port},"${e.password}"`);for(let i of["idle-session-timeout","max-stream-count"])le(e,i)&&Number.isInteger(e[i])&&n.append(`,${i}=${e[i]}`);n.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),rc(n,e),wl(n,e),t?Yg(n,e):(n.appendIfPresent(`,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 r=qs[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${r}`,"ip-version"),n.toString()}function nZ(e){let t=!!e["reality-opts"],n=e.network==="xhttp",r=YI(e.cipher),i=new We(e);if(i.append(`${e.name}=vmess,${e.server},${e.port},${r},"${e.uuid}"`),e.network==="tcp"&&delete e.network,le(e,"network"))if(e.network==="ws")i.append(",transport=ws"),i.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),i.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){i.append(",transport=http");let a=e["http-opts"]?.path,u=e["http-opts"]?.headers?.Host;i.appendIfPresent(`,path=${Array.isArray(a)?a[0]:a}`,"http-opts.path"),i.appendIfPresent(`,host=${Array.isArray(u)?u[0]:u}`,"http-opts.headers.Host")}else if(n)JA(i,e);else throw new Error(`network ${e.network} is unsupported`);else i.append(",transport=tcp");i.appendIfPresent(`,over-tls=${e.tls}`,"tls"),i.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),(e.tls||t)&&rc(i,e),(e.tls||t||n)&&wl(i,e,n),t?Yg(i,e):(i.appendIfPresent(`,${n?"sni":"tls-name"}=${e.sni}`,"sni"),i.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),i.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"));let o=e.alterId;if(le(e,"aead")&&(o=e.aead?0:1),n&&(o??=0,Number(o)!==0))throw new Error("VMess XHTTP requires AEAD");i.append(`,alterId=${o}`),i.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?i.append(",block-quic=true"):e["block-quic"]==="off"&&i.append(",block-quic=false"),e.udp&&i.append(",udp=true");let s=qs[e["ip-version"]]||e["ip-version"];return i.appendIfPresent(`,ip-mode=${s}`,"ip-version"),i.toString()}function rZ(e,t){if(!t||t==="none")return;let[n,r,i,...o]=t.split("."),s=/^(-?\d+)-(-?\d+)-(-?\d+)$/,a=o.findIndex(h=>!s.test(h));if(n!=="mlkem768x25519plus"||!["native","xorpub","random"].includes(r)||!["0rtt","1rtt"].includes(i)||!o[a])throw new Error("Unsupported VLESS encryption format");let u=o.slice(0,a);for(let[h,m]of u.entries()){let[,p,d,v]=s.exec(m).map(Number);if(h===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=${r},encryption-rtt=${i}`),e.append(`,encryption-public-keys=${Wa(l)}`),u.length&&e.append(`,encryption-padding=${Wa(u.join("."))}`)}function sZ(e){let t=!!e.flow,n=e["reality-opts"],r=!!vt(n?.["public-key"]),i=e.network==="xhttp",o=(e.network??"tcp")==="tcp",s=r||[!0,"true"].includes(e.tls),a=e.encryption&&e.encryption!=="none";if(n&&!r)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||!s))throw new Error("Loon VLESS Vision without encryption requires TCP with TLS or REALITY");let u=new We(e);if(u.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,le(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 h=e["http-opts"]?.path,m=e["http-opts"]?.headers?.Host;u.appendIfPresent(`,path=${Array.isArray(h)?h[0]:h}`,"http-opts.path"),u.appendIfPresent(`,host=${Array.isArray(m)?m[0]:m}`,"http-opts.headers.Host")}else if(i)JA(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||r||t)&&rc(u,e),(e.tls||r||t||i)&&wl(u,e,i),rZ(u,e.encryption),t&&u.append(`,flow=${e.flow}`),r?Yg(u,e):(u.appendIfPresent(`,${i?"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=qs[e["ip-version"]]||e["ip-version"];return u.appendIfPresent(`,ip-mode=${l}`,"ip-version"),u.toString()}function iZ(e){let t=new We(e),n=e.tls?"https":"http";t.append(`${e.name}=${n},${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&&(rc(t,e),wl(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 r=qs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function oZ(e){let t=new We(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&&(rc(t,e),wl(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 n=qs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function aZ(e){let t=new We(e);t.append(`${e.name}=tailscale`);let n=e["exit-node"];n==="auto:any"&&(n="auto"),n===""&&(n="none");let r={"control-url":e["control-url"],"auth-key":e["auth-key"],hostname:e.hostname,"exit-node":n};for(let[s,a]of Object.entries(r)){if(!a)continue;let u=s==="control-url"||s==="auth-key"||/[,\s]/.test(a);t.append(`,${s}=${u?`"${a}"`:a}`)}for(let s of["accept-routes","accept-dns","magic-dns","path-mode","mtu","idle-session-timeout","udp"])t.appendIfPresent(`,${s}=${e[s]}`,s);let i=qs[e["ip-version"]]||e["ip-version"];t.appendIfPresent(`,ip-mode=${i}`,"ip-version");let o=e["block-quic"];return(o==="on"||o==="off")&&t.append(`,block-quic=${o==="on"}`),t.toString()}function uZ(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 We(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=>Xt(a));let s=e.dns.find(a=>Sn(a));s||(s=e.dns.find(a=>!Sn(a)&&!Xt(a))),e.dns=s}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 n=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],r=Array.isArray(e.reserved)?e.reserved.join(","):e.reserved;r&&(r=`,reserved=[${r}]`);let i=e["preshared-key"]??e["pre-shared-key"];i&&(i=`,preshared-key="${i}"`),t.append(`,peers=[{public-key="${e["public-key"]}",allowed-ips="${n??"0.0.0.0/0,::/0"}",endpoint=${e.server}:${e.port}${r??""}${i??""}}]`);let o=qs[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 cZ(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=vt(e.server)?.trim();if(!t)throw new Error("Loon Mieru requires a server");let n=String(e.port??"").trim(),r=Number(n);if(!/^\d+$/.test(n)||r<1||r>65535)throw new Error("Loon Mieru port must be an integer from 1 to 65535");let i=[e.username,e.password].map(m=>String(m??""));if(i.some(m=>!m||g9.Buffer.byteLength(m,"utf8")>64))throw new Error("Loon Mieru username and password must each be 1-64 UTF-8 bytes");let o=new We(e),s=Xt(t)?`[${t}]`:t,[a,u]=i.map(m=>Wa(m,!0));o.append(`${e.name}=mieru,${s},${r},${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 h=qs[e["ip-version"]]||e["ip-version"];return o.appendIfPresent(`,ip-mode=${h}`,"ip-version"),o.toString()}function lZ(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new We(e);t.append(`${e.name}=Hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,"${e.password}"`,"password"),le(e,"ports")&&`${e.ports}`.trim().length>0&&t.append(`,server-ports="${e.ports}"`),le(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"),rc(t,e),wl(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 n=qs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}var wve=B(x());function fZ(e,{excludeHost:t=!1}={}){if(!ze(e))return;let n={};for(let[r,i]of Object.entries(e))typeof i=="string"&&(t&&/^host$/i.test(r)||(n[r]=i));return Object.keys(n).length>0?n:void 0}function hZ(e,t){let n=Zg(e?.["_v2ray-http-upgrade-ed"]);if(n!=="")return n;let r=Zg(Ss(t||"/","ed").value);return r!==""?r:2560}function Xg(e,t){return t?.["v2ray-http-upgrade-fast-open"]?GA(e||"/","ed",hZ(t,e)):e}function QA(e,t){let n=t?.["max-early-data"],r=Zg(n);if(r==="")return n!=null&&`${n}`!=""?e==null?e:Ss(e,"ed").path:e;let i=t?.["early-data-header-name"];return i&&i!=="Sec-WebSocket-Protocol"?e==null?e:Ss(e,"ed").path:GA(e||"/","ed",r)}function Zg(e){return e==null||`${e}`==""||li(e)==null?"":`${e}`}function dZ(e){return Zr(e)}function pZ(e){return Hs(e)}function A9({defaultDns:e,dnsFieldPath:t,echOptsPath:n,proxyName:r,queryServerName:i}){let o=r||"\u672A\u547D\u540D\u8282\u70B9";J.warn(`URI ECH: \u8282\u70B9 "${o}" \u7684 ${n} \u5DF2\u5F00\u542F\u4E14\u8BBE\u7F6E query-server-name="${i}", \u4F46\u672A\u8BBE\u7F6E ${t}; \u5DF2\u4F7F\u7528\u9ED8\u8BA4 DNS ${e}. \u5982\u9700\u81EA\u5B9A\u4E49, \u8BF7\u8BBE\u7F6E ${t}.`)}function Jg(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 mZ(e){if(!ze(e))return;let t={},n={"max-connections":"maxConnections","max-concurrency":"maxConcurrency","c-max-reuse-times":"cMaxReuseTimes","h-max-request-times":"hMaxRequestTimes","h-max-reusable-secs":"hMaxReusableSecs"};for(let[i,o]of Object.entries(n)){let s=Hs(e[i]);s!=null&&(t[o]=typeof s=="number"?`${s}`:s)}let r=dZ(e["h-keep-alive-period"]);return r!=null&&(t.hKeepAlivePeriod=r),Object.keys(t).length>0?t:void 0}function S9(e,t,{excludeHostHeader:n=!0,xmuxTarget:r="root"}={}){if(!ze(e)||!ze(t))return;let i=fZ(t.headers,{excludeHost:n});if(i&&(e.headers=i),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=ml(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=pZ(t["uplink-chunk-size"]);if(o!=null&&(e.uplinkChunkSize=o),t["sc-max-each-post-bytes"]!=null){let a=ml(t["sc-max-each-post-bytes"]);a!=null&&(e.scMaxEachPostBytes=a)}if(t["sc-min-posts-interval-ms"]!=null){let a=Mo(t["sc-min-posts-interval-ms"]);a!=null&&(e.scMinPostsIntervalMs=a)}let s=mZ(t["reuse-settings"]);s&&(r==="extra"?e.extra={...ze(e.extra)?e.extra:{},xmux:s}:e.xmux=s)}function gZ(e,t={},n={}){if(!ze(e))return;let r=typeof e.network=="string"?e.network.toLowerCase():"",i=r==="xhttp"||r==="splithttp"?"xhttp":void 0,o={};e.server&&(o.address=e.server);let s=Zr(e.port,{allowNegative:!1});s!=null&&(o.port=s);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=OA(e["ech-opts"],void 0,{dnsFieldPath:"xhttp-opts.download-settings.ech-opts._dns",warnDefaultDns:v=>A9({...v,echOptsPath:"xhttp-opts.download-settings.ech-opts",proxyName:n.name})});if(l.echConfigList&&(u.echConfigList=l.echConfigList),l.echForceQuery&&(u.echForceQuery=l.echForceQuery),l.echSockopt&&(u.echSockopt=sc(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 h={},m=e.path??t.path;m&&(h.path=m);let p=Jg("xhttp",e)??Jg("xhttp",t);p&&(h.host=p);let d=e.mode??t.mode;if(d&&(h.mode=d),S9(h,e,{excludeHostHeader:!0,xmuxTarget:"extra"}),Object.keys(h).length>0&&(o.xhttpSettings=h),!(Object.keys(o).length===0&&i==null))return{...o.address!=null?{address:o.address}:{},network:i||"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 vZ(e){let t=e["xhttp-opts"]||{},n={};S9(n,t,{excludeHostHeader:!0,xmuxTarget:"root"});let r=gZ(t["download-settings"],t,e);return r&&(n.downloadSettings=r),Object.keys(n).length>0?n:void 0}function sc(e){if(Array.isArray(e))return e.map(sc);if(ze(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=sc(r);return t}return e}function wZ(e,t){return e==null?sc(t):Array.isArray(e)||Array.isArray(t)?sc(e):ze(e)&&ze(t)?C9(e,t):sc(e)}function C9(e,t){let n=ze(e)?sc(e):{};if(!ze(t))return n;for(let[r,i]of Object.entries(t)){if(!Object.prototype.hasOwnProperty.call(n,r)){n[r]=sc(i);continue}n[r]=wZ(n[r],i)}return n}function _9(e){if(typeof e=="string")return e;if(ze(e))return JSON.stringify(e)}function yZ(e){let t=_9(e._extra);if(t!=null)return t;if(e.network!=="xhttp")return e._extra||"";let n=vZ(e),r=C9(n,e._extra_unsupported);return Object.keys(r).length>0?JSON.stringify(r):""}function eS(e){let t="none",n=e["reality-opts"],r="",i="",o="";if(n){t="reality";let V=e["reality-opts"]?.["public-key"];if(V){i=`&pbk=${encodeURIComponent(V)}`;let ae=e["reality-opts"]["support-x25519mlkem768"];ae&&(i+=`&support-x25519mlkem768=${encodeURIComponent(ae)}`)}let X=e["reality-opts"]?.["short-id"];X&&(r=`&sid=${encodeURIComponent(X)}`);let te=e["reality-opts"]?.["_spider-x"];te&&(o=`&spx=${encodeURIComponent(te)}`)}else e.tls&&(t="tls");let s="";e.alpn&&(s=`&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 h="",m=Array.isArray(e._vcn)?e._vcn.join(","):e["name-cert-verify"];(Array.isArray(e._vcn)||m)&&(h=`&vcn=${encodeURIComponent(m)}`);let p="",d=NA(e["ech-opts"],e._echConfigList,{dnsFieldPath:"ech-opts._dns",warnDefaultDns:V=>A9({...V,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=yZ(e);E&&(w=`&extra=${encodeURIComponent(E)}`);let C="",_=_9(e._finalmask);_&&(C=`&fm=${encodeURIComponent(_)}`);let F="";["xhttp"].includes(e.network)&&e[`${e.network}-opts`]?.mode?F=`&mode=${encodeURIComponent(e[`${e.network}-opts`].mode)}`:e._mode&&(F=`&mode=${encodeURIComponent(e._mode)}`);let H="";e._pqv&&(H=`&pqv=${encodeURIComponent(e._pqv)}`);let K="";e.encryption&&(K=`&encryption=${encodeURIComponent(e.encryption)}`);let S=e.network;e.network==="ws"&&e["ws-opts"]?.["v2ray-http-upgrade"]?S="httpupgrade":e.network==="http"?S="tcp":e.network==="h2"&&(S="http");let I=`&type=${encodeURIComponent(S)}`;if(e.network==="http"&&(I+="&headerType=http"),["grpc"].includes(e.network)){I+=`&mode=${encodeURIComponent(e[`${e.network}-opts`]?.["_grpc-type"]||"gun")}`;let V=e[`${e.network}-opts`]?.["_grpc-authority"];V&&(I+=`&authority=${encodeURIComponent(V)}`)}let q=e[`${e.network}-opts`]||{},L=e.network==="ws"&&q?.["v2ray-http-upgrade"],T=q?.[`${e.network}-service-name`],O=q?.path,R=Jg(e.network,q),N=Zg(e["ws-opts"]?.["max-early-data"]);Array.isArray(O)&&(O=O[0]),L&&q?.["v2ray-http-upgrade-fast-open"]?O=Xg(O,q):e.network==="ws"&&e["ws-opts"]?.["max-early-data"]!=null&&O&&(O=Ss(O,"ed").path),O&&(I+=`&path=${encodeURIComponent(O)}`),R&&(I+=`&host=${encodeURIComponent(Array.isArray(R)?R[0]:R)}`),T&&(I+=`&serviceName=${encodeURIComponent(T)}`),e.network==="http"&&e["http-opts"]?.method&&(I+=`&method=${encodeURIComponent(e["http-opts"].method)}`),e.network==="kcp"&&(e.seed&&(I+=`&seed=${encodeURIComponent(e.seed)}`),e.headerType&&(I+=`&headerType=${encodeURIComponent(e.headerType)}`)),e.network==="ws"&&!L&&N!==""&&(I+=`&ed=${encodeURIComponent(N)}`);let P=e["ws-opts"]?.["early-data-header-name"];P&&(L||e["ws-opts"]?.["max-early-data"]==null||P!=="Sec-WebSocket-Protocol")&&(I+=`&eh=${encodeURIComponent(P)}`);let M="",Y;switch(e["packet-encoding"]!=null?Y=`${e["packet-encoding"]}`.trim().toLowerCase():e.xudp?Y="xudp":e["packet-addr"]?Y="packetaddr":e.udp===!0&&(Y=""),Y){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)}${I}${M}${s}${a}${l}${h}${p}${u}${v}${g}${y}${r}${o}${i}${F}${w}${C}${H}${K}#${encodeURIComponent(e.name)}`}function rh(){return{type:"SINGLE",produce:n=>{let r="";delete n.subName,delete n.collectionName,delete n.id,delete n.resolved,delete n["no-resolve"];for(let i in n)n[i]==null&&delete n[i];switch(["tuic","hysteria","hysteria2","juicity","trusttunnel"].includes(n.type)&&delete n.tls,!["vmess"].includes(n.type)&&n.server&&Xt(n.server)&&(n.server=`[${n.server}]`),n.type){case"socks5":r=`socks://${encodeURIComponent(bt.encode(`${n.username??""}:${n.password??""}`))}@${n.server}:${n.port}#${n.name}`;break;case"ss":let i=`${n.cipher}:${n.password}`;r=`ss://${n.cipher?.startsWith("2022-blake3-")?`${encodeURIComponent(n.cipher)}:${encodeURIComponent(n.password)}`:bt.encode(i)}@${n.server}:${n.port}${n.plugin?"/":""}`;let o="";if(n.plugin){o+="&plugin=";let se=n["plugin-opts"];switch(n.plugin){case"obfs":o+=encodeURIComponent(`simple-obfs;obfs=${se.mode}${se.host?";obfs-host="+se.host:""}`);break;case"v2ray-plugin":let pe=Ep(se.mux);o+=encodeURIComponent(`v2ray-plugin;obfs=${se.mode};mode=${se.mode}${se.host?";obfs-host="+se.host:""}${se.host?";host="+se.host:""}${se.path?";path="+se.path:""}${se.tls?";tls":""}${se.sni?";sni="+se.sni:""}${se["skip-cert-verify"]?";skip-cert-verify="+se["skip-cert-verify"]:""}${pe!=null?";mux="+pe:""}`);break;case"shadow-tls":o+=encodeURIComponent(`shadow-tls;host=${se.host};password=${se.password};version=${se.version}`);break;default:throw new Error(`Unsupported plugin option: ${n.plugin}`)}}n["udp-over-tcp"]&&(o+="&uot=1"),n.tfo&&(o+="&tfo=1"),o+=`&udp=${n.udp?1:0}`;let s="";if(n.network){let se=n.network;if(n.network==="ws"&&n["ws-opts"]?.["v2ray-http-upgrade"]&&(se="httpupgrade"),s=`&type=${encodeURIComponent(se)}`,["grpc"].includes(n.network)){let Oe=n[`${n.network}-opts`]?.[`${n.network}-service-name`],pt=n[`${n.network}-opts`]?.["_grpc-authority"];Oe&&(s+=`&serviceName=${encodeURIComponent(Oe)}`),pt&&(s+=`&authority=${encodeURIComponent(pt)}`),s+=`&mode=${encodeURIComponent(n[`${n.network}-opts`]?.["_grpc-type"]||"gun")}`}let pe=n[`${n.network}-opts`]||{},Fe=n.network==="ws"&&pe?.["v2ray-http-upgrade"],Re=pe?.path,Ve=pe?.headers?.Host;Array.isArray(Re)&&(Re=Re[0]),Fe?Re=Xg(Re,pe):n.network==="ws"&&(Re=QA(Re,pe)),Re&&(s+=`&path=${encodeURIComponent(Re)}`),Ve&&(s+=`&host=${encodeURIComponent(Array.isArray(Ve)?Ve[0]:Ve)}`)}let a="";n["client-fingerprint"]&&(a=`&fp=${encodeURIComponent(n["client-fingerprint"])}`);let u="";n.alpn&&(u=`&alpn=${encodeURIComponent(Array.isArray(n.alpn)?n.alpn:n.alpn.join(","))}`);let l=n["reality-opts"],h="",m="",p="",d=n.tls?"&security=tls":"",v="",g=n._extra&&(l||n.network==="xhttp")?`&extra=${encodeURIComponent(n._extra)}`:"";if(l){d="&security=reality";let se=n["reality-opts"]?.["public-key"];se&&(m=`&pbk=${encodeURIComponent(se)}`);let pe=n["reality-opts"]?.["short-id"];pe&&(h=`&sid=${encodeURIComponent(pe)}`);let Fe=n["reality-opts"]?.["_spider-x"];Fe&&(p=`&spx=${encodeURIComponent(Fe)}`),n._mode&&(v=`&mode=${encodeURIComponent(n._mode)}`)}n.tls&&(o+=`&sni=${encodeURIComponent(n.sni||n.server)}${n["skip-cert-verify"]?"&allowInsecure=1":""}`),o+=`${s}${u}${a}${d}${h}${m}${p}${v}${g}#${encodeURIComponent(n.name)}`,r+=o.replace(/^&/,"?");break;case"ssr":r=`${n.server}:${n.port}:${n.protocol}:${n.cipher}:${n.obfs}:${bt.encode(n.password)}/`,r+=`?remarks=${bt.encode(n.name)}${n["obfs-param"]?"&obfsparam="+bt.encode(n["obfs-param"]):""}${n["protocol-param"]?"&protoparam="+bt.encode(n["protocol-param"]):""}`,r="ssr://"+bt.encode(r);break;case"vmess":if(n["reality-opts"]||n._finalmask){if(n.aead===!1||n.aead!==!0&&Number(n.alterId||0)!==0)throw new Error("VMess query URI format cannot represent non-AEAD authentication (alterId must be 0)");r=eS({...n,server:Xt(n.server)?`[${n.server}]`:n.server,network:n.network||"tcp",encryption:Vn(n.cipher),flow:void 0}).replace(/^vless:\/\//,"vmess://");break}let y="",w=n.network||"tcp";if(n.network==="http"?(w="tcp",y="http"):n.network==="ws"&&n["ws-opts"]?.["v2ray-http-upgrade"]&&(w="httpupgrade"),r={v:"2",ps:n.name,add:n.server,port:`${n.port}`,id:n.uuid,aid:`${n.alterId||0}`,scy:Vn(n.cipher),net:w,type:y,tls:n.tls?"tls":"",alpn:Array.isArray(n.alpn)?n.alpn.join(","):n.alpn,fp:n["client-fingerprint"]},n.tls&&n.sni&&(r.sni=n.sni),n.network){let se=n[`${n.network}-opts`]||{},pe=n.network==="ws"&&se?.["v2ray-http-upgrade"],Fe=se?.path,Re=Jg(n.network,se);["grpc"].includes(n.network)?(r.path=n[`${n.network}-opts`]?.["grpc-service-name"],r.type=n[`${n.network}-opts`]?.["_grpc-type"]||"gun",r.host=n[`${n.network}-opts`]?.["_grpc-authority"]):["kcp","quic"].includes(n.network)?(r.type=n[`${n.network}-opts`]?.[`_${n.network}-type`]||"none",r.host=n[`${n.network}-opts`]?.[`_${n.network}-host`],r.path=n[`${n.network}-opts`]?.[`_${n.network}-path`]):(Array.isArray(Fe)&&(Fe=Fe[0]),pe?Fe=Xg(Fe,se):n.network==="ws"&&(Fe=QA(Fe,se)),Fe&&(r.path=Fe),Re&&(r.host=Array.isArray(Re)?n.network==="h2"?Re.join(","):Re[0]:Re))}r="vmess://"+bt.encode(JSON.stringify(r));break;case"vless":r=eS(n);break;case"trojan":let E="";if(n.network){let se=n.network;if(n.network==="ws"&&n["ws-opts"]?.["v2ray-http-upgrade"]&&(se="httpupgrade"),E=`&type=${encodeURIComponent(se)}`,["grpc"].includes(n.network)){let Oe=n[`${n.network}-opts`]?.[`${n.network}-service-name`],pt=n[`${n.network}-opts`]?.["_grpc-authority"];Oe&&(E+=`&serviceName=${encodeURIComponent(Oe)}`),pt&&(E+=`&authority=${encodeURIComponent(pt)}`),E+=`&mode=${encodeURIComponent(n[`${n.network}-opts`]?.["_grpc-type"]||"gun")}`}let pe=n[`${n.network}-opts`]||{},Fe=n.network==="ws"&&pe?.["v2ray-http-upgrade"],Re=pe?.path,Ve=pe?.headers?.Host;Array.isArray(Re)&&(Re=Re[0]),Fe?Re=Xg(Re,pe):n.network==="ws"&&(Re=QA(Re,pe)),Re&&(E+=`&path=${encodeURIComponent(Re)}`),Ve&&(E+=`&host=${encodeURIComponent(Array.isArray(Ve)?Ve[0]:Ve)}`)}let C="";n["client-fingerprint"]&&(C=`&fp=${encodeURIComponent(n["client-fingerprint"])}`);let _="";n["tls-fingerprint"]&&(_=`&pcs=${encodeURIComponent(n["tls-fingerprint"])}`);let F="",H=Array.isArray(n._vcn)?n._vcn.join(","):n["name-cert-verify"];(Array.isArray(n._vcn)||H)&&(F=`&vcn=${encodeURIComponent(H)}`);let K="";n.alpn&&(K=`&alpn=${encodeURIComponent(Array.isArray(n.alpn)?n.alpn:n.alpn.join(","))}`);let S=n["reality-opts"],I="",q="",L="",T="",O="",R="";if(S){T="&security=reality";let se=n["reality-opts"]?.["public-key"];se&&(q=`&pbk=${encodeURIComponent(se)}`);let pe=n["reality-opts"]?.["short-id"];pe&&(I=`&sid=${encodeURIComponent(pe)}`);let Fe=n["reality-opts"]?.["_spider-x"];Fe&&(L=`&spx=${encodeURIComponent(Fe)}`),n._extra&&(R=`&extra=${encodeURIComponent(n._extra)}`),n._mode&&(O=`&mode=${encodeURIComponent(n._mode)}`)}r=`trojan://${encodeURIComponent(n.password)}@${n.server}:${n.port}?sni=${encodeURIComponent(n.sni||n.server)}${n["skip-cert-verify"]?"&allowInsecure=1":""}${E}${K}${C}${_}${F}${T}${I}${q}${L}${O}${R}#${encodeURIComponent(n.name)}`;break;case"hysteria2":let N=[];n["hop-interval"]&&N.push(`hop-interval=${n["hop-interval"]}`),n.keepalive&&N.push(`keepalive=${n.keepalive}`),n["skip-cert-verify"]&&N.push("insecure=1"),n.obfs&&(N.push(`obfs=${encodeURIComponent(n.obfs)}`),n["obfs-password"]&&N.push(`obfs-password=${encodeURIComponent(n["obfs-password"])}`)),n.sni&&N.push(`sni=${encodeURIComponent(n.sni)}`),n.ports&&N.push(`mport=${n.ports}`),n["tls-fingerprint"]&&N.push(`pinSHA256=${encodeURIComponent(n["tls-fingerprint"])}`),n.tfo&&N.push("fastopen=1");let P=NA(n["ech-opts"]);P&&N.push(`ech=${encodeURIComponent(P)}`),r=`hysteria2://${encodeURIComponent(n.password)}@${n.server}:${n.port}?${N.join("&")}#${encodeURIComponent(n.name)}`;break;case"hysteria":let M=[];Object.keys(n).forEach(se=>{if(!["name","type","server","port"].includes(se)){let pe=se.replace(/-/,"_");["alpn"].includes(se)?n[se]&&M.push(`${pe}=${encodeURIComponent(Array.isArray(n[se])?n[se][0]:n[se])}`):["skip-cert-verify"].includes(se)?n[se]&&M.push("insecure=1"):["tfo","fast-open"].includes(se)?n[se]&&!M.includes("fastopen=1")&&M.push("fastopen=1"):["ports"].includes(se)?M.push(`mport=${n[se]}`):["auth-str"].includes(se)?M.push(`auth=${n[se]}`):["up"].includes(se)?M.push(`upmbps=${n[se]}`):["down"].includes(se)?M.push(`downmbps=${n[se]}`):["_obfs"].includes(se)?M.push(`obfs=${n[se]}`):["obfs"].includes(se)?M.push(`obfsParam=${n[se]}`):["sni"].includes(se)?M.push(`peer=${n[se]}`):n[se]&&!/^_/i.test(se)&&M.push(`${pe}=${encodeURIComponent(n[se])}`)}}),r=`hysteria://${n.server}:${n.port}?${M.join("&")}#${encodeURIComponent(n.name)}`;break;case"tuic":if(!n.token||n.token.length===0){let se=[];Object.keys(n).forEach(pe=>{if(!["name","type","uuid","password","server","port","tls"].includes(pe)){let Fe=pe.replace(/-/,"_");["alpn"].includes(pe)?n[pe]&&se.push(`${Fe}=${encodeURIComponent(Array.isArray(n[pe])?n[pe][0]:n[pe])}`):["skip-cert-verify"].includes(pe)?n[pe]&&se.push("allow_insecure=1"):["tfo","fast-open"].includes(pe)?n[pe]&&!se.includes("fast_open=1")&&se.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(pe)&&n[pe]?se.push(`${Fe.replace(/-/g,"_")}=1`):["congestion-controller"].includes(pe)?se.push(`congestion_control=${n[pe]}`):n[pe]&&!/^_/i.test(pe)&&se.push(`${Fe.replace(/-/g,"_")}=${encodeURIComponent(n[pe])}`)}}),r=`tuic://${encodeURIComponent(n.uuid)}:${encodeURIComponent(n.password)}@${n.server}:${n.port}?${se.join("&")}#${encodeURIComponent(n.name)}`}break;case"anytls":r=eS({...n,uuid:encodeURIComponent(n.password),network:n.network||"tcp"}).replace("vless","anytls");let Y=[];Object.keys(n).forEach(se=>{if(!["name","type","password","server","port","tls"].includes(se)){let pe=se.replace(/-/,"_");["alpn"].includes(se)?n[se]&&Y.push(`${pe}=${encodeURIComponent(Array.isArray(n[se])?n[se][0]:n[se])}`):["skip-cert-verify"].includes(se)?n[se]&&Y.push("insecure=1"):["udp"].includes(se)?n[se]&&Y.push("udp=1"):n[se]&&!/^_|client-fingerprint/i.test(se)&&["number","string","boolean"].includes(typeof n[se])&&Y.push(`${pe.replace(/-/g,"_")}=${encodeURIComponent(n[se])}`)}});let V=r.split("?"),X=V[0],te={};V.length>1&&V[1].split("#")[0].split("&").forEach(Fe=>{let[Re,Ve]=Fe.split("=");Re&&(te[Re]=Ve)}),Y.forEach(se=>{let[pe,Fe]=se.split("=");pe&&(te[pe]=Fe)});let ae=Object.keys(te).map(se=>`${se}=${te[se]}`).join("&"),me=r.match(/#(.*)$/),he=me?`#${me[1]}`:"";r=`${X}?${ae}${he}`;break;case"mieru":{let se=n["port-range"]||n.port,pe=encodeURIComponent(n.username??""),Fe=encodeURIComponent(n.password??"");if(!n.server||!se||!pe||!Fe)throw new Error("Mieru URI requires a server, port and credentials");let Re=[`port=${encodeURIComponent(se)}`,`protocol=${encodeURIComponent(n.transport||"TCP")}`,`profile=${encodeURIComponent(n.name||n.server)}`];for(let Ve of["multiplexing","handshake-mode","traffic-pattern"])n[Ve]&&Re.push(`${Ve}=${encodeURIComponent(n[Ve])}`);r=`mierus://${pe}:${Fe}@${n.server}?${Re.join("&")}`;break}case"wireguard":let De=[];Object.keys(n).forEach(se=>{["name","type","server","port","ip","ipv6","ip-cidr","ipv6-cidr","private-key"].includes(se)||(["public-key"].includes(se)?De.push(`publickey=${encodeURIComponent(n[se])}`):["udp"].includes(se)?n[se]&&De.push(`${se}=1`):n[se]&&!/^_/i.test(se)&&De.push(`${se}=${encodeURIComponent(n[se])}`))});let Pe=As(n,"ipv4"),Ie=As(n,"ipv6");Pe&&Ie?De.push(`address=${encodeURIComponent(`${Pe},${Ie}`)}`):Pe?De.push(`address=${encodeURIComponent(Pe)}`):Ie&&De.push(`address=${encodeURIComponent(Ie)}`),r=`wireguard://${encodeURIComponent(n["private-key"])}@${n.server}:${n.port}/?${De.join("&")}#${encodeURIComponent(n.name)}`;break}return r}}}var Sve=B(x());var EZ=rh();function Dp(){return{type:"ALL",produce:n=>{let r=[];return n.map(i=>{try{r.push(EZ.produce(i))}catch(o){J.error(`Cannot produce proxy: ${i.name}
Reason: ${o}`)}}),bt.encode(r.join(`
`))}}}var Fve=B(x()),tS=B(wa());var Qg="QX";function bZ(e){return(Array.isArray(e)?e:`${e}`.split(",")).map(n=>`${n}`.trim()).filter(Boolean).map(n=>{let r=tS.Buffer.from(n,"utf8");if(r.length>255)throw new Error("QX ALPN protocol exceeds 255 bytes");return`${r.length.toString(16).padStart(2,"0")}${r.toString("hex")}`}).join("")||void 0}function Ya(e,t){if(le(t,"tls-alpn")){e.append(`,tls-alpn=${t["tls-alpn"]}`);return}let n=le(t,"alpn")&&bZ(t.alpn);n&&e.append(`,tls-alpn=${n}`)}function Fp(){let e=(t,n,r={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${Qg} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return AZ(t);case"ssr":return SZ(t);case"trojan":return CZ(t);case"vmess":return _Z(t);case"http":return IZ(t);case"socks5":return $Z(t);case"vless":return DZ(t);case"anytls":return FZ(t);case"hysteria2":return BZ(t);case"mieru":return xZ(t)}throw new Error(`Platform ${Qg} does not support proxy type: ${t.type}`)};return{produce:(t,n,r={})=>{let i=e(t,n,r);if(t.flow&&t.flow!=="xtls-rprx-vision")throw new Error(`Platform ${Qg} does not support flow ${t.flow}`);return t["reality-opts"]&&(t["reality-opts"]["public-key"]&&(i=`${i},reality-base64-pubkey=${t["reality-opts"]["public-key"]}`),t["reality-opts"]["short-id"]&&(i=`${i},reality-hex-shortid=${t["reality-opts"]["short-id"]}`)),i}}}function nS(e){return["http","vmess-http","vemss-http","shadowsocks-http"].includes(e._qx_obfs_http)?e._qx_obfs_http:"http"}function Xa(e,t){let n=le(t,"name-cert-verify")?"name-cert-verify":"skip-cert-verify";e.appendIfPresent(`,tls-verification=${t["name-cert-verify"]??!t["skip-cert-verify"]}`,n)}function AZ(e){let t=new We(e),n=t.append.bind(t),r=t.appendIfPresent.bind(t),i=Zf(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(n(`shadowsocks=${e.server}:${e.port}`),n(`,method=${e.cipher}`),n(`,password=${e.password}`),Jr(e)&&(e.tls=!0),i)n(",obfs=over-tls"),le(e,"sni")?n(`,obfs-host=${e.sni}`):r(`,obfs-host=${e.servername}`,"servername");else if(le(e,"plugin")){if(e.plugin==="obfs"){let o=e["plugin-opts"];o.mode==="http"?n(`,obfs=${nS(e)}`):n(`,obfs=${o.mode}`)}else if(e.plugin==="v2ray-plugin"&&e["plugin-opts"].mode==="websocket")e["plugin-opts"].tls?n(",obfs=wss"):n(",obfs=ws");else throw new Error("plugin is not supported");r(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),r(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path")}return(Jr(e)||e.plugin==="v2ray-plugin"&&e["plugin-opts"]?.tls)&&(r(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(t,e),r(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),r(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),r(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Xa(t,e),i||r(`,tls-host=${e.sni}`,"sni")),r(`,fast-open=${e.tfo}`,"tfo"),r(`,udp-relay=${e.udp}`,"udp"),e._ssr_python_uot?n(",udp-over-tcp=true"):e["udp-over-tcp"]&&(!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?n(",udp-over-tcp=sp.v1"):e["udp-over-tcp-version"]===2&&n(",udp-over-tcp=sp.v2")),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),t.toString()}function SZ(e){let t=new We(e),n=t.append.bind(t),r=t.appendIfPresent.bind(t);return n(`shadowsocks=${e.server}:${e.port}`),n(`,method=${e.cipher}`),n(`,password=${e.password}`),n(`,ssr-protocol=${e.protocol}`),r(`,ssr-protocol-param=${e["protocol-param"]}`,"protocol-param"),r(`,obfs=${e.obfs}`,"obfs"),r(`,obfs-host=${e["obfs-param"]}`,"obfs-param"),r(`,fast-open=${e.tfo}`,"tfo"),r(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),t.toString()}function CZ(e){let t=new We(e),n=t.append.bind(t),r=t.appendIfPresent.bind(t);if(n(`trojan=${e.server}:${e.port}`),n(`,password=${e.password}`),le(e,"network")){if(e.network==="ws")Jr(e)?n(",obfs=wss"):n(",obfs=ws"),r(`,obfs-uri=${e["ws-opts"]?.path}`,"ws-opts.path"),r(`,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"&&Jr(e)&&n(",over-tls=true"),Jr(e)&&(r(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(t,e),r(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),r(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),r(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Xa(t,e),r(`,tls-host=${e.sni}`,"sni")),r(`,fast-open=${e.tfo}`,"tfo"),r(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),t.toString()}function _Z(e){let t=new We(e),n=t.append.bind(t),r=t.appendIfPresent.bind(t);n(`vmess=${e.server}:${e.port}`);let i=WI(e.cipher);if(n(`,method=${i}`),n(`,password=${e.uuid}`),Jr(e)&&(e.tls=!0),le(e,"network")){if(e.network==="ws")e.tls?n(",obfs=wss"):n(",obfs=ws");else if(e.network==="http")n(`,obfs=${nS(e)}`);else if(["tcp"].includes(e.network))e.tls&&n(",obfs=over-tls");else if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`);let o=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;r(`,obfs-uri=${Array.isArray(o)?o[0]:o}`,`${e.network}-opts.path`),r(`,obfs-host=${Array.isArray(s)?s[0]:s}`,`${e.network}-opts.headers.Host`)}else e.tls&&n(",obfs=over-tls");return Jr(e)&&(r(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(t,e),r(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),r(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),r(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Xa(t,e),r(`,tls-host=${e.sni}`,"sni")),le(e,"aead")?n(`,aead=${e.aead}`):n(`,aead=${e.alterId===0}`),r(`,fast-open=${e.tfo}`,"tfo"),r(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),t.toString()}function DZ(e){if(e.encryption&&e.encryption!=="none")throw new Error("VLESS encryption is not supported");let t=new We(e),n=t.append.bind(t),r=t.appendIfPresent.bind(t);if(n(`vless=${e.server}:${e.port}`),n(",method=none"),n(`,password=${e.uuid}`),Jr(e)&&(e.tls=!0),le(e,"network")){if(e.network==="ws")e.tls?n(",obfs=wss"):n(",obfs=ws");else if(e.network==="http")n(`,obfs=${nS(e)}`);else if(["tcp"].includes(e.network))e.tls&&n(",obfs=over-tls");else if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`);let o=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;r(`,obfs-uri=${Array.isArray(o)?o[0]:o}`,`${e.network}-opts.path`),r(`,obfs-host=${Array.isArray(s)?s[0]:s}`,`${e.network}-opts.headers.Host`)}else e.tls&&n(",obfs=over-tls");return Jr(e)&&(r(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(t,e),r(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),r(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),r(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Xa(t,e),r(`,tls-host=${e.sni}`,"sni")),r(`,vless-flow=${e.flow}`,"flow"),r(`,fast-open=${e.tfo}`,"tfo"),r(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),t.toString()}function FZ(e){let t=e.network?.trim().toLowerCase();if(t&&t!=="tcp")throw new Error(`Platform ${Qg} does not support AnyTLS with transport ${e.network}`);let n=new We(e),r=n.append.bind(n),i=n.appendIfPresent.bind(n);return r(`anytls=${e.server}:${e.port}`),r(`,password=${e.password}`),e.tls=!0,r(",over-tls=true"),i(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(n,e),i(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),i(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),i(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Xa(n,e),i(`,tls-host=${e.sni}`,"sni"),i(`,fast-open=${e.tfo}`,"tfo"),i(`,udp-relay=${e.udp}`,"udp"),n.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),n.toString()}function BZ(e){let t=e.obfs||"salamander";if(!["salamander","gecko"].includes(t))throw new Error("QX Hysteria 2 only supports Salamander and Gecko obfuscation");let n=new We(e);n.append(`hysteria2=${e.server}:${e.port}`),n.appendIfPresent(`,password=${e.password}`,"password");let r=String(e.ports||"").trim();r&&n.append(`,port-hopping=${r.replace(/;/g,",")}`);let i=Number(e["hop-interval"]);if(Number.isInteger(i)&&i>=5&&i<=3600&&n.append(`,port-hopping-interval=${i}`),le(e,"obfs-password")){let s=String(e["obfs-password"]);if(tS.Buffer.byteLength(s,"utf8")<4)throw new Error(`QX Hysteria 2 ${t}-password must be at least 4 bytes`);n.append(`,${t}-password=${s}`)}else if(t==="gecko")throw new Error("QX Hysteria 2 Gecko obfuscation requires gecko-password");n.appendIfPresent(`,tls-host=${e.sni}`,"sni"),n.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(n,e),n.appendIfPresent(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n.appendIfPresent(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Xa(n,e);let o=String(e.down).match(/^\s*(\d+)/)?.[1];return o&&n.append(`,download-bandwidth=${o}`),n.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),n.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n.append(`,tag=${e.name}`),n.toString()}function IZ(e){let t=new We(e),n=t.append.bind(t),r=t.appendIfPresent.bind(t);return n(`http=${e.server}:${e.port}`),r(`,username=${e.username}`,"username"),r(`,password=${e.password}`,"password"),Jr(e)&&(e.tls=!0),r(`,over-tls=${e.tls}`,"tls"),Jr(e)&&(r(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(t,e),r(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),r(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),r(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Xa(t,e),r(`,tls-host=${e.sni}`,"sni")),r(`,fast-open=${e.tfo}`,"tfo"),r(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),t.toString()}function $Z(e){let t=new We(e),n=t.append.bind(t),r=t.appendIfPresent.bind(t);return n(`socks5=${e.server}:${e.port}`),r(`,username=${e.username}`,"username"),r(`,password=${e.password}`,"password"),Jr(e)&&(e.tls=!0),r(`,over-tls=${e.tls}`,"tls"),Jr(e)&&(r(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(t,e),r(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),r(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),r(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Xa(t,e),r(`,tls-host=${e.sni}`,"sni")),r(`,fast-open=${e.tfo}`,"tfo"),r(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),t.toString()}function xZ(e){let t=new We(e);return t.append(`mieru=${e.server}:${e.port}`),t.appendIfPresent(`,username=${e.username}`,"username"),t.appendIfPresent(`,password=${e.password}`,"password"),Jr(e)&&(e.tls=!0),t.appendIfPresent(`,over-tls=${e.tls}`,"tls"),Jr(e)&&(t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Ya(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"),Xa(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 Jr(e){return e.tls}var kve=B(x());function Bp(){return{type:"ALL",produce:(n,r,i={})=>{let o=n.filter(s=>{if(i["include-unsupported-proxy"])return!0;if(Jf(s,["websocket","quic","http2","mkcp","grpc"])){if(s.type==="snell"&&![1,2,3,4,5,6].includes(s.version))return!1;if(PZ(s))return J.error(`Platform Shadowrocket does not support Snell shadow-tls with obfs for proxy ${s.name}. Proxy has been filtered.`),!1;if(["tailscale","sudoku","naive","openvpn","gost-relay","shadowquic","zerotier","masque-surge","easytier"].includes(s.type))return!1;if(["xhttp"].includes(s.network))return J.warn("VLESS XHTTP \u7ED3\u6784\u590D\u6742, Shadowrocket \u53EF\u80FD\u65E0\u6CD5\u5B8C\u5168\u517C\u5BB9"),!0}else return!1;return!0}).map(s=>{if(Hg(s),s.type==="vmess"?(le(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.cipher=Vn(s.cipher)):s.type==="tuic"?(le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!le(s,"version")&&(s.version=5)):s.type==="hysteria"?(le(s,"auth_str")&&!le(s,"auth-str")&&(s["auth-str"]=s.auth_str),le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo)):s.type==="hysteria2"?(le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo)):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"],s.ip=As(s,"ipv4"),s.ipv6=As(s,"ipv6")):s.type==="snell"?(s.version<3&&delete s.udp,s.plugin==="shadow-tls"&&s["plugin-opts"]&&(s["obfs-opts"]={mode:"shadow-tls",host:s["plugin-opts"].host,password:s["plugin-opts"].password,version:s["plugin-opts"].version},s["plugin-opts"].alpn&&(s["obfs-opts"].alpn=s["plugin-opts"].alpn),delete s.plugin,delete s["plugin-opts"])):s.type==="vless"?le(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"?Zf(s)&&le(s,"sni")&&(s.servername=s.sni):["anytls"].includes(s.type)&&s.reuse!=null&&!s.reuse&&(s["disable-reuse"]=!0,delete s.reuse),["vmess","vless"].includes(s.type)&&s.network==="http"){let a=s["http-opts"]?.path;le(s,"http-opts.path")&&!Array.isArray(a)&&(s["http-opts"].path=[a]);let u=s["http-opts"]?.headers?.Host;le(s,"http-opts.headers.Host")&&!Array.isArray(u)&&(s["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let a=s["h2-opts"]?.path;le(s,"h2-opts.path")&&Array.isArray(a)&&(s["h2-opts"].path=a[0]);let u=s["h2-opts"]?.host??s["h2-opts"]?.headers?.host??s["h2-opts"]?.headers?.Host;(le(s,"h2-opts.host")||le(s,"h2-opts.headers.host")||le(s,"h2-opts.headers.Host"))&&(s["h2-opts"].host=Array.isArray(u)?u:[u]),s["h2-opts"]?.headers&&(delete s["h2-opts"].headers.host,delete s["h2-opts"].headers.Host,Object.keys(s["h2-opts"].headers).length===0&&delete s["h2-opts"].headers)}if(["ws"].includes(s.network)){let a=`${s.network}-opts`;s[a]=s[a]||{},s[a].path||(s[a].path="/"),tc(s[a])}if(s["plugin-opts"]?.tls&&le(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["plugin-opts"]["skip-cert-verify"]||s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],s["underlying-proxy"]&&(s["dialer-proxy"]=s["underlying-proxy"]),delete s["underlying-proxy"],le(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],delete s["ip-cidr"],delete s["ipv6-cidr"],r!=="internal"){for(let a in s)(s[a]==null||/^_/i.test(a))&&delete s[a];nc(s[`${s.network}-opts`])}return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return Ho(o,r,i)}}}function PZ(e){return e?.type==="snell"&&e?.plugin==="shadow-tls"&&(le(e,"obfs-opts.mode")||le(e,"obfs-opts.host")||le(e,"obfs-opts.path"))}var Lve=B(x()),F9=B(Ga());var Ip="Surfboard";function yl(e){return e!=null&&`${e}`.trim().length>0}function El(e,t,n=!0){n&&(e.appendIfPresent(`,server-cert-fingerprint-sha256=${t["tls-fingerprint"]}`,"tls-fingerprint"),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify"))}function e2(){return{produce:t=>{if(t.type!=="vless"&&t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${Ip} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return NZ(t);case"trojan":return LZ(t);case"vmess":return UZ(t);case"vless":return HZ(t);case"http":return MZ(t);case"snell":return OZ(t);case"tuic":return kZ(t);case"socks5":return qZ(t);case"hysteria2":return TZ(t);case"wireguard-surge":return jZ(t)}if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw new Error(`Platform ${Ip} does not support proxy type ${t.type} with network or REALITY`);return RZ(t)}throw new Error(`Platform ${Ip} does not support proxy type: ${t.type}`)}}}function kZ(e){if(e.token?.length)throw new Error(`Platform ${Ip} does not support proxy type ${e.type} v4`);let t=new We(e);return t.append(`${e.name}=tuic-v5,${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),yl(e.alpn)&&t.append(`,alpn="${Array.isArray(e.alpn)?e.alpn.join(","):e.alpn}"`),yl(e.ports)&&t.append(`,port-hopping="${String(e.ports).replace(/,/g,";")}"`),yl(e["hop-interval"])&&t.append(`,port-hopping-interval=${e["hop-interval"]}`),El(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function TZ(e){if(e.obfs&&e.obfs!=="salamander"||e["obfs-password"]&&e.obfs!=="salamander")throw new Error("Surfboard Hysteria2 only supports salamander obfs");let t=new We(e);return t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),yl(e.ports)&&t.append(`,port-hopping="${String(e.ports).replace(/,/g,";")}"`),yl(e["hop-interval"])&&t.append(`,port-hopping-interval=${e["hop-interval"]}`),e["obfs-password"]&&t.append(`,salamander-password="${e["obfs-password"]}"`),El(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 RZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),El(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 OZ(e){if(le(e,"version")&&![1,2,3,4,5].includes(Number(e.version)))throw new Error(`Platform ${Ip} does not support snell version ${e.version}`);let t=new We(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 NZ(e){let t=new We(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"),le(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 LZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),B9(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),El(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 UZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,username=${e.uuid}`,"uuid"),B9(t,e),le(e,"aead")?t.append(`,vmess-aead=${e.aead}`):t.append(`,vmess-aead=${e.alterId===0}`),t.appendIfPresent(`,tls=${e.tls}`,"tls"),El(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function HZ(e){if(!yl(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(!Lg(e))throw new Error("Unsupported VLESS transport, TLS or flow combination");let t=new We(e);t.append(`${e.name}=vless,${e.server},${e.port}`);let n=(s,a)=>{if(a==null)return;let u=String(a),l=!u||/[,;"'\s\\]/.test(u)?`"${u.replace(/["\\]/g,"\\$&")}"`:u;t.append(`,${s}=${l}`)};n("username",e.uuid);let r=e.network??"tcp";if(r==="ws"){let s=e["ws-opts"];n("ws",!0),s?.["v2ray-http-upgrade"]&&n("ws-http-upgrade",!0),n("ws-path",s?.path),n("ws-headers",D9(Object.entries(s?.headers??{})))}else if(r==="grpc"){let s=e["grpc-opts"];n("grpc",!0),n("grpc-service-name",s?.["grpc-service-name"]),n("grpc-mode",s?.["_grpc-type"]),n("grpc-authority",s?.["_grpc-authority"])}else if(r==="xhttp"){let s=e["xhttp-opts"];if(s?.["download-settings"])throw new Error("VLESS XHTTP download-settings are unsupported");n("xhttp",!0);let a=Object.entries(s?.headers??{}),u=s?.host??a.find(([l])=>/^host$/i.test(l))?.[1];for(let[l,h]of Object.entries(eh))n(`xhttp-${l}`,l==="host"?u:F9.default.get(s,h));n("xhttp-headers",D9(a.filter(([l])=>!/^host$/i.test(l))))}else if(!["tcp","raw","none"].includes(r))throw new Error(`VLESS network ${r} is unsupported`);e.flow&&n("flow",e.flow),e.encryption&&n("encryption",e.encryption);let i=e["reality-opts"];i?(n("reality-public-key",i["public-key"]),n("reality-short-id",i["short-id"])):(n("tls",e.tls),e.tls&&(n("server-cert-fingerprint-sha256",e["tls-fingerprint"]),n("server-cert-verify-name",e["name-cert-verify"]),n("skip-cert-verify",e["skip-cert-verify"]))),(e.tls||i)&&(n("sni",e.sni),yl(e.alpn)&&n("alpn",e.alpn)),n("udp-relay",e.udp),n("block-quic",e["block-quic"]),n("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 D9(e){let t=[];for(let[n,r]of e){if(r==null)continue;let i=String(r);if(n.includes("|")||i.includes("|"))throw new Error('VLESS header names and values cannot contain "|"');t.push(`${n}:${i}`)}return t.join("|")||void 0}function MZ(e){let t=new We(e),n=e.tls?"https":"http";return t.append(`${e.name}=${n},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),El(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function qZ(e){let t=new We(e),n=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${n},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),El(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function jZ(e){let t=new We(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 B9(e,t){if(le(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),le(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),le(t,"ws-opts.headers"))){let n=t["ws-opts"].headers,r=Object.keys(n).map(i=>{let o=n[i];return["Host"].includes(i)&&(o=`"${o}"`),`${i}:${o}`}).join("|");qe(r)&&e.append(`,ws-headers=${r}`)}}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 Gve=B(x()),$9=B(wa());var KZ={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"},dr=(e,t)=>{let n=KZ[e["ip-version"]];e._dns_server&&n&&(t.domain_resolver={server:e._dns_server,strategy:n})},pr=(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})},VZ=e=>{let t=e["control-http-client"];return t==null?!1:typeof t=="string"?t.trim()!=="":ze(t)?Object.values(t).some(n=>n!=null&&n!==""):!0},mr=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},Wi=(e,t)=>{if(["tcp","udp"].includes(e._network)){t.network=e._network;return}e.udp===!1&&(t.network="tcp")},Qr=(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},Yi=(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))))},sS=(e,t)=>{let n={type:"ws",headers:{}};if(e["ws-opts"]){let{path:r="",headers:i={},"max-early-data":o,"early-data-header-name":s}=e["ws-opts"];if(n.early_data_header_name=s,n.max_early_data=o?parseInt(o,10):void 0,r!==""&&(n.path=`${r}`),Object.keys(i).length>0){let a={};for(let l of Object.keys(i)){let h=i[l];h!==""&&(Array.isArray(h)||(h=[`${h}`]),h.length>0&&(a[l]=h))}let{Host:u}=a;if(u.length===1)for(let l of`Host:${u[0]}`.split(`
`)){let[h,m]=l.split(":");m.trim()!==""&&(a[h.trim()]=m.trim().split(","))}n.headers=a}}if(e["ws-headers"]){let r={};for(let o of Object.keys(e["ws-headers"])){let s=e["ws-headers"][o];s!==""&&(Array.isArray(s)||(s=[`${s}`]),s.length>0&&(r[o]=s))}let{Host:i}=r;if(i.length===1)for(let o of`Host:${i[0]}`.split(`
`)){let[s,a]=o.split(":");a.trim()!==""&&(r[s.trim()]=a.trim().split(","))}for(let o of Object.keys(r))n.headers[o]=r[o]}if(e["ws-path"]&&e["ws-path"]!==""&&(n.path=`${e["ws-path"]}`),n.path){let{value:r,parsed:i}=VA(n.path,"ed");r!==""&&(n.path=Ss(n.path,"ed").path,n.early_data_header_name="Sec-WebSocket-Protocol",n.max_early_data=i)}t.tls.insecure&&(t.tls.server_name=n.headers.Host[0]),e["ws-opts"]&&e["ws-opts"]["v2ray-http-upgrade"]&&(n.type="httpupgrade",n.headers.Host&&(n.host=n.headers.Host[0],delete n.headers.Host),n.max_early_data&&delete n.max_early_data,n.early_data_header_name&&delete n.early_data_header_name);for(let r of Object.keys(n.headers)){let i=n.headers[r];i.length===1&&(n.headers[r]=i[0])}t.transport=n},x9=(e,t)=>{let n={type:"http",headers:{}};if(e["http-opts"]){let{method:r="",path:i="",headers:o={}}=e["http-opts"];r!==""&&(n.method=r),Array.isArray(i)?n.path=`${i[0]}`:i!==""&&(n.path=`${i}`);for(let s of Object.keys(o)){let a=o[s];if(a!==""){if(s.toLowerCase()==="host"){let u=a;Array.isArray(u)||(u=`${u}`.split(",").map(l=>l.trim())),u.length>0&&(n.host=u);continue}Array.isArray(a)||(a=`${a}`.split(",").map(u=>u.trim())),a.length>0&&(n.headers[s]=a)}}}if(e["http-host"]&&e["http-host"]!==""){let r=e["http-host"];Array.isArray(r)||(r=`${r}`.split(",").map(i=>i.trim())),r.length>0&&(n.host=r)}if(e["http-path"]&&e["http-path"]!==""){let r=e["http-path"];Array.isArray(r)?n.path=`${r[0]}`:r!==""&&(n.path=`${r}`)}t.tls.insecure&&(t.tls.server_name=n.host[0]),n.host?.length===1&&(n.host=n.host[0]);for(let r of Object.keys(n.headers)){let i=n.headers[r];i.length===1&&(n.headers[r]=i[0])}t.transport=n},P9=(e,t)=>{let n={type:"http"};if(e["h2-opts"]){let{host:r="",path:i=""}=e["h2-opts"];i!==""&&(n.path=`${i}`),r!==""&&(Array.isArray(r)||(r=`${r}`.split(",").map(o=>o.trim())),r.length>0&&(n.host=r))}if(e["h2-host"]&&e["h2-host"]!==""){let r=e["h2-host"];Array.isArray(r)||(r=`${r}`.split(",").map(i=>i.trim())),r.length>0&&(n.host=r)}e["h2-path"]&&e["h2-path"]!==""&&(n.path=`${e["h2-path"]}`),t.tls.enabled=!0,t.tls.insecure&&(t.tls.server_name=n.host[0]),n.host.length===1&&(n.host=n.host[0]),t.transport=n},iS=(e,t)=>{let n={type:"grpc"};if(e["grpc-opts"]){let r=e["grpc-opts"]["grpc-service-name"];r!=null&&r!==""&&(n.service_name=`${r}`)}t.transport=n},GZ=(e,t)=>{let n=Array.isArray(e)?e:[e],r=[];for(let i of n){let o=`${i}`.trim().replace(/\\r\\n/g,`
`).replace(/\\n/g,`
`);if(o!=="")for(let s of o.split(/\r?\n/)){let a=s.trim();a!==""&&r.push(a)}}if(r.length!==0)return r.some(i=>/^-----BEGIN [A-Za-z0-9 -]+-----$/.test(i))?r:[`-----BEGIN ${t}-----`,...r,`-----END ${t}-----`]},zZ=["chrome","firefox","edge","safari","360","qq","ios","android","random","randomized"],k9=e=>{let t=`${e||""}`.trim().toLowerCase();if(zZ.includes(t))return t},T9=(e,t)=>{let n=t.tls;if(e.ca&&(n.certificate_path=`${e.ca}`),e.ca_str&&(n.certificate=[e.ca_str]),e["ca-str"]&&(n.certificate=[e["ca-str"]]),e._certificate&&(n.certificate=e._certificate),e._certificate_path&&(n.certificate_path=e._certificate_path),n.reality?.enabled){(e._certificate_sha256?.length||e._certificate_public_key_sha256?.length)&&J.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&&(n.certificate_public_key_sha256=e._certificate_public_key_sha256);let r=n.certificate?.length||n.certificate_path;if(e._certificate_sha256!=null)n.certificate_sha256=e._certificate_sha256;else if((e.fingerprint||e["tls-fingerprint"])&&!r&&!n.certificate_public_key_sha256?.length){let i=`${e.fingerprint||e["tls-fingerprint"]}`.trim().replace(/:/g,"");if(!/^[0-9a-f]{64}$/i.test(i))throw new Error(`Platform sing-box: invalid SHA-256 certificate fingerprint for proxy ${e.name}`);n.certificate_sha256=[$9.Buffer.from(i,"hex").toString("base64")]}if(r&&(n.certificate_sha256?.length||n.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}`)},Za=(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 n=k9(e["client-fingerprint"]);n&&(t.tls.utls={...t.tls.utls,enabled:!0,fingerprint:n})}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 n=e["ech-opts"].config;if(Array.isArray(n)||typeof n=="string"){let r=GZ(n,"ECH CONFIGS");r&&(t.tls.ech.config=r)}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?T9(e,t):delete t.tls},WZ=(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 n=e["private-key"]||e.privateKey;return n&&(t[n.includes("PRIVATE KEY")?"private_key":"private_key_path"]=n),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),Qr(e,t),mr(e,t),dr(e,t),pr(e,t),t},YZ=(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 n of Object.keys(e.headers))t.headers[n]=`${e.headers[n]}`;Object.keys(t.headers).length===0&&delete t.headers}return e["fast-open"]&&(t.udp_fragment=!0),Qr(e,t),mr(e,t),Za(e,t),dr(e,t),pr(e,t),t},XZ=(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),Wi(e,t),Qr(e,t),mr(e,t),dr(e,t),pr(e,t),t},ZZ=(e={})=>{let t=t2(e),n={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:n2(e)};return e.uot&&(n.udp_over_tcp=!0),e["udp-over-tcp"]&&(n.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),Wi(e,n),Yi(e.smux,n),{type:"ss-with-st",ssPart:n,stPart:rS(e,t)}},n2=(e={})=>`${e.name}_shadowtls`,t2=(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}},I9=e=>{if(typeof e=="string")return e.split(",").map(t=>t.trim()).filter(t=>t!=="");if(Array.isArray(e))return e},rS=(e={},t)=>{if(!t)throw new Error("shadow-tls plugin options are missing");let n=k9(e["client-fingerprint"]),r={tag:n2(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"]&&(r.tls.insecure=!0),n&&(r.tls.utls={enabled:!0,fingerprint:n}),r.server_port<0||r.server_port>65535)throw"\u7AEF\u53E3\u503C\u975E\u6CD5";let i=I9(t.alpn)??I9(e.alpn);return i&&(r.tls.alpn=i),T9(e,r),e["fast-open"]===!0&&(r.udp_fragment=!0),Qr(e,r),mr(e,r),dr(e,r),pr(e,r),r},JZ=(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),Wi(e,t),Qr(e,t),mr(e,t),Yi(e.smux,t),dr(e,t),pr(e,t),e.plugin){let n=[];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(r=>{switch(r){case"mode":n.push(`obfs=${e["plugin-opts"].mode}`);break;case"host":n.push(`obfs-host=${e["plugin-opts"].host}`);break;default:n.push(`${r}=${e["plugin-opts"][r]}`);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(r=>{switch(r){case"tls":e["plugin-opts"].tls&&n.push("tls");break;case"host":n.push(`host=${e["plugin-opts"].host}`);break;case"path":n.push(`path=${e["plugin-opts"].path}`);break;case"headers":n.push(`headers=${JSON.stringify(e["plugin-opts"].headers)}`);break;case"mux":{let i=Ep(e["plugin-opts"].mux);i&&(t.multiplex={enabled:!0}),n.push(`mux=${i}`);break}default:n.push(`${r}=${e["plugin-opts"][r]}`)}})),t.plugin_opts=n.join(";")}return t},QZ=(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),Wi(e,t),Qr(e,t),mr(e,t),Yi(e.smux,t),dr(e,t),pr(e,t),t},eJ=e=>{if(e==null)return;let t=`${e}`.trim();return/^\d+$/.test(t)?parseInt(t,10):NaN},tJ=(e={},t=!1)=>{let n=eJ(e.version),r=t2(e),i=t?[1,2,3,4,5,6]:[4,5,6];if(n!=null&&(!i.includes(n)||Number.isNaN(n)))throw new Error(`Platform sing-box does not support snell version ${e.version}`);let o=!t&&n===5?4:n,s={tag:e.name,type:"snell",server:e.server,server_port:parseInt(`${e.port}`,10),psk:e.psk};if(s.server_port<0||s.server_port>65535)throw"invalid port";return o!=null&&(s.version=o),(e.userkey||e._userkey)&&(s.userkey=e.userkey||e._userkey),o===6?(e.mode&&(s.mode=e.mode),t&&e["quic-proxy-mode"]&&(s.quic_proxy_mode=!!e["quic-proxy-mode"])):(e["obfs-opts"]?.mode&&e["obfs-opts"].mode!=="shadow-tls"&&(s.obfs_mode=e["obfs-opts"].mode),e["obfs-opts"]?.host&&e["obfs-opts"]?.mode!=="shadow-tls"&&(s.obfs_host=e["obfs-opts"].host)),e.reuse&&(n==null||n>=4)&&(s.reuse=!0),Wi(e,s),r?(s.detour=n2(e),delete s.server,delete s.server_port):(e["fast-open"]&&(s.udp_fragment=!0),Qr(e,s),mr(e,s),dr(e,s),pr(e,s)),s},nJ=["","packetaddr","xudp"],rJ=e=>{let t=`${e}`.trim().toLowerCase();if(nJ.includes(t))return t},R9=(e,t)=>{if(e["packet-encoding"]!=null){let n=rJ(e["packet-encoding"]);n!=null&&(t.packet_encoding=n)}else e.xudp?t.packet_encoding="xudp":e["packet-addr"]&&(t.packet_encoding="packetaddr")},sJ=(e,t)=>{R9(e,t),e["global-padding"]!=null&&(t.global_padding=!!e["global-padding"]),e["authenticated-length"]!=null&&(t.authenticated_length=!!e["authenticated-length"])},iJ=(e={})=>{let t={tag:e.name,type:"vmess",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,security:Vn(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 sJ(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.network==="ws"&&sS(e,t),e.network==="h2"&&P9(e,t),e.network==="http"&&x9(e,t),e.network==="grpc"&&iS(e,t),Wi(e,t),Qr(e,t),mr(e,t),Za(e,t),Yi(e.smux,t),dr(e,t),pr(e,t),t},oJ=(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 R9(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.flow!=null&&(t.flow=e.flow),e.network==="ws"&&sS(e,t),e.network==="h2"&&P9(e,t),e.network==="http"&&x9(e,t),e.network==="grpc"&&iS(e,t),Wi(e,t),Qr(e,t),mr(e,t),Yi(e.smux,t),Za(e,t),dr(e,t),pr(e,t),t},aJ=(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"&&iS(e,t),e.network==="ws"&&sS(e,t),Wi(e,t),Qr(e,t),mr(e,t),Za(e,t),Yi(e.smux,t),dr(e,t),pr(e,t),t},uJ=(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 n=parseInt(`${e["insecure-concurrency"]}`,10);return Number.isInteger(n)&&n>=0&&(t.insecure_concurrency=n),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),Qr(e,t),mr(e,t),Za(e,t),Yi(e.smux,t),dr(e,t),pr(e,t),t.tls?.insecure&&(J.info("Platform sing-box: insecure is not supported on naive outbound"),delete t.tls.insecure),t},cJ=(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(r=>{let i=r.replace(/\s*-\s*/g,":");return i.includes(":")?i:`${i}:${i}`})),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 n=new RegExp("^[0-9]+[ ]*[KMGT]*[Bb]ps$");return n.test(`${e.up}`)&&!`${e.up}`.endsWith("Mbps")?t.up=`${e.up}`:t.up_mbps=parseInt(`${e.up}`,10),n.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)),Wi(e,t),Za(e,t),mr(e,t),Qr(e,t),Yi(e.smux,t),dr(e,t),pr(e,t),t},lJ=(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(n=>{let r=n.replace(/\s*-\s*/g,":");return r.includes(":")?r:`${r}:${r}`})),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 n=e["obfs-min-packet-size"],r=e["obfs-max-packet-size"],i=n!=null&&`${n}`!="",o=r!=null&&`${r}`!="";if(i||o){let s=i?li(`${n}`.trim()):void 0,a=o?li(`${r}`.trim()):void 0,u=a!=null?Math.min(a,2048):a,l=s??512,h=u??1200;o&&a!=null&&a>2048&&J.warn(`Gecko obfs max packet size for proxy ${e.name} exceeds 2048, clamped to 2048: ${r}`),i&&(s==null||s<=0)||o&&(a==null||a<=0)||h<l?J.error(`Invalid obfs packet size for proxy ${e.name}: min=${n} max=${r}`):(i&&(t.obfs.min_packet_size=s),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"]),Wi(e,t),Za(e,t),Qr(e,t),mr(e,t),Yi(e.smux,t),dr(e,t),pr(e,t),t},fJ=(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`),Wi(e,t),Qr(e,t),mr(e,t),Za(e,t),Yi(e.smux,t),dr(e,t),pr(e,t),t},hJ=(e={},t=!1)=>{let n={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"]&&(n.client_metadata=`${e["client-metadata"]}`),/^\d+$/.test(e["idle-session-check-interval"])&&(n.idle_session_check_interval=`${e["idle-session-check-interval"]}s`),/^\d+$/.test(e["idle-session-timeout"])&&(n.idle_session_timeout=`${e["idle-session-timeout"]}s`),/^\d+$/.test(e["min-idle-session"])&&(n.min_idle_session=parseInt(`${e["min-idle-session"]}`,10)),e["disable-reuse"]!=null&&(n.disable_reuse=!!e["disable-reuse"]),mr(e,n),Za(e,n),dr(e,n),pr(e,n),n},dJ=(e={})=>{let t=VZ(e),n=li(e._listen_port),r={tag:e.name,type:"tailscale",listen_port:n!=null&&n<=65535?n: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"])&&(r.system_interface_mtu=parseInt(`${e["system-interface-mtu"]}`,10)),/^\d+$/.test(e["relay-server-port"])&&(r.relay_server_port=parseInt(`${e["relay-server-port"]}`,10)),t||(mr(e,r),dr(e,r),pr(e,r)),ze(e["ssh-server"])?r.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"]&&(r.ssh_server=!!e["ssh-server"]),r},pJ=(e={})=>{let t=["ipv4","ipv6"].map(o=>As(e,o)).filter(o=>o),n=li(e._listen_port),r=li(e._udp_nat_max),i={system:!!e.system,name:typeof e._name=="string"?e._name:void 0,listen_port:n!=null&&n<=65535?n: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:r!=null&&r<=4294967295?r: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}`])&&(i[o]=e[`_${o}`]);if(i.server_port<0||i.server_port>65535)throw"invalid port";if(e["fast-open"]&&(i.udp_fragment=!0),typeof e.reserved=="string")i.reserved=e.reserved;else if(Array.isArray(e.reserved))for(let o of e.reserved)i.reserved.push(o);else delete i.reserved;if((!Array.isArray(e.peers)||e.peers.length===0)&&(e.peers=[{}]),e.peers&&e.peers.length>0){i.peers=[];for(let o of e.peers){let s,a;o.server&&o.port?(s=o.server,a=parseInt(`${o.port}`,10)):(s=i.server,a=parseInt(`${i.server_port}`,10));let u=o["allowed-ips"]||o.allowed_ips||e["allowed-ips"]||e.allowed_ips;typeof u=="string"&&(u=u.split(",").map(h=>h.trim()).filter(Boolean)),(!Array.isArray(u)||u.length===0)&&(u=["0.0.0.0/0",...e.ipv6?["::/0"]:[]]);let l={address:s,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||i.peer_public_key,pre_shared_key:o["pre-shared-key"]||o.pre_shared_key||i.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 h of o.reserved)l.reserved.push(h);else delete l.reserved;(!Array.isArray(l.reserved)||l.reserved.length===0)&&(l.reserved=i.reserved),i.peers.push(l)}}return Qr(e,i),mr(e,i),Yi(e.smux,i),dr(e,i),pr(e,i),delete i.server,delete i.server_port,delete i.pre_shared_key,delete i.peer_public_key,delete i.reserved,i};function r2(){return{type:"ALL",produce:(n,r,i={})=>{let o=[],s=new Map(n.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(Ms().produce(n,"internal",{"include-unsupported-proxy":!0}).map(u=>{let l=o.length;try{let h=s.get(u);h&&(u.plugin=h.plugin,u["plugin-opts"]=h["plugin-opts"],h["obfs-opts"]?u["obfs-opts"]=h["obfs-opts"]:delete u["obfs-opts"]);let m=t2(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=rS(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(WZ(u));break;case"http":o.push(YZ(u));break;case"socks5":if(u.tls)throw new Error(`Platform sing-box does not support proxy type: ${u.type} with tls`);o.push(XZ(u));break;case"ss":if(u.plugin==="shadow-tls"){let{ssPart:v,stPart:g}=ZZ(u);o.push(v),o.push(g)}else o.push(JZ(u));break;case"ssr":if(i["include-unsupported-proxy"])o.push(QZ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type}`);break;case"snell":{o.push(tJ(u,i["include-unsupported-proxy"]));let v=t2(u);v&&o.push(rS(u,v));break}case"vmess":if(!u.network||["tcp","ws","grpc","h2","http"].includes(u.network))o.push(iJ(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(oJ(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(aJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with flow ${u.flow}`);break;case"naive":o.push(uJ(u));break;case"hysteria":o.push(cJ(u));break;case"hysteria2":o.push(lJ(u,i["include-unsupported-proxy"]));break;case"tuic":if(!u.token||u.token.length===0)o.push(fJ(u));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":o.push(pJ(u));break;case"anytls":o.push(hJ(u,i["include-unsupported-proxy"]));break;case"tailscale":o.push(dJ(u));break;default:throw new Error(`Platform sing-box does not support proxy type: ${u.type}`)}if(d){let v=o[l];v.detour=n2(u),delete v.tls,o.push(d)}if(i["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(h){o.length=l,J.error(h.message??h)}}),r==="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 Zve=B(x());var mJ={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"};function s2(){return{type:"ALL",produce:(n,r,i={})=>{let o=n.filter(s=>!["http","https","socks5","ss","ssr","trojan","hysteria2","vless","vmess","tuic","wireguard","anytls","ssh","snell"].includes(s.type)||s.type==="ss"&&(s.plugin==="obfs"&&!["http","tls"].includes(s["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(s.cipher))||s.type==="vmess"&&(!["h2","http","ws","tcp","grpc"].includes(s.network)&&s.network||!U9(s))||s.type==="trojan"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="vless"&&(!["h2","http","ws","tcp","grpc"].includes(s.network)&&s.network||!U9(s)||typeof s.flow<"u"&&!["xtls-rprx-vision",""].includes(s.flow))||s.type==="tuic"&&s.token&&s.token.length!==0||s.type==="snell"&&H9(s.version)===null||s.type==="ssr"&&!yJ(s)||["anytls"].includes(s.type)&&s.network&&!["tcp"].includes(s.network)?!1:!(["ws"].includes(s.network)&&s["ws-opts"]?.["v2ray-http-upgrade"])).map(s=>{let a=s;try{let u={...s},l;s.tls&&!s.sni&&(s.sni=s.server);let h=s.prev_hop||s["underlying-proxy"]||s["dialer-proxy"]||s.detour;if(s.type==="http")s={type:s.tls?"https":"http",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,...O9(s)?{headers:s.headers}:{},tfo:fi(s),...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(s)}:{}};else if(s.type==="https")s={type:"https",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,...O9(s)?{headers:s.headers}:{},tfo:fi(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(s)};else if(s.type==="socks5")s={type:s.tls?"socks5_tls":"socks5",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,tfo:fi(s),udp_relay:Ja(s),...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(s)}:{}};else if(s.type==="ss"){if(s={type:"shadowsocks",name:s.name,method:s.cipher==="chacha20-ietf-poly1305"?"chacha20-poly1305":s.cipher,server:s.server,port:s.port,password:s.password,tfo:fi(s),udp_relay:Ja(s)},le(u,"plugin")){if(u.plugin==="obfs")s.obfs=u["plugin-opts"].mode,s.obfs_host=u["plugin-opts"].host,s.obfs_uri=u["plugin-opts"].path;else if(!["shadow-tls"].includes(u.plugin))throw new Error(`plugin ${u.plugin} is not supported`)}}else if(s.type==="ssr")s={type:"shadowsocksr",name:s.name,method:q9(s.cipher),server:s.server,port:s.port,password:s.password,protocol:$p(s.protocol),protocol_param:s["protocol-param"],obfs:$p(s.obfs),obfs_param:s["obfs-param"],tfo:fi(s),udp_relay:Ja(s)};else if(s.type==="hysteria2")s={type:"hysteria2",name:s.name,server:s.server,port:s.port,auth:s.password,...le(s,"up")?{bandwidth:parseInt(`${s.up}`.match(/\d+/)?.[0]||0,10)}:{},tfo:fi(s),udp_relay:Ja(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]},u["obfs-password"]&&u.obfs=="salamander"&&(s.obfs="salamander",s.obfs_password=u["obfs-password"]);else if(s.type==="tuic")s={type:"tuic",name:s.name,server:s.server,port:s.port,uuid:s.uuid,password:s.password,sni:s.sni,alpn:Array.isArray(s.alpn)?s.alpn:[s.alpn||"h3"],skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]};else if(s.type==="trojan")s.network==="ws"&&(s.websocket={path:s["ws-opts"]?.path,host:s["ws-opts"]?.headers?.Host}),s={type:"trojan",name:s.name,server:s.server,port:s.port,password:s.password,tfo:fi(s),udp_relay:Ja(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(s),websocket:s.websocket};else if(s.type==="anytls")s={type:"anytls",name:s.name,server:s.server,port:s.port,password:s.password,tfo:fi(s),udp_relay:Ja(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(s)};else if(s.type==="vmess"){let p=Vn(s.cipher);s.network==="ws"?s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}}:s.network==="http"?s.transport={http1:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:s.network==="h2"?s.transport={http2:{method:s["h2-opts"]?.method,path:Array.isArray(s["h2-opts"]?.path)?s["h2-opts"]?.path[0]:s["h2-opts"]?.path,headers:M9(s["h2-opts"]),sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}}:s.network==="grpc"?s.transport=L9(s):(s.network==="tcp"||!s.network)&&s.tls&&(s.transport={tls:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}});let d=!1;(le(s,"aead")&&!s.aead||le(s,"alterId")&&s.alterId!==0)&&(d=!0),s={type:"vmess",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:p,tfo:fi(s),legacy:d,udp_relay:Ja(s),transport:s.transport}}else if(s.type==="vless"){if(s.encryption&&s.encryption!=="none")throw new Error("VLESS encryption is not supported");s.network==="ws"?s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}}:s.network==="http"?s.transport={http1:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:s.network==="h2"?s.transport={http2:{method:s["h2-opts"]?.method,path:Array.isArray(s["h2-opts"]?.path)?s["h2-opts"]?.path[0]:s["h2-opts"]?.path,headers:M9(s["h2-opts"]),sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}}:s.network==="grpc"?s.transport=L9(s):(s.network==="tcp"||!s.network)&&(s.transport={[s.tls?"tls":"tcp"]:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0,reality:bl(s)}},l=s.flow,l===""&&(l=void 0)),s={type:"vless",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:s.cipher,tfo:fi(s),udp_relay:Ja(s),transport:s.transport,flow:l}}else if(s.type==="wireguard")Array.isArray(s.peers)&&s.peers.length>0&&(s.server=s.peers[0].server,s.port=s.peers[0].port,s.ip=s.peers[0].ip,s.ipv6=s.peers[0].ipv6,s["public-key"]=s.peers[0]["public-key"],s["preshared-key"]=s.peers[0]["pre-shared-key"],s["allowed-ips"]=s.peers[0]["allowed-ips"],s.reserved=s.peers[0].reserved),s={type:"wireguard",name:s.name,local_ipv4:As(s,"ipv4"),local_ipv6:As(s,"ipv6"),server:s.server,port:s.port,private_key:s["private-key"],peer_public_key:s["public-key"],preshared_key:s["preshared-key"]??s["pre-shared-key"],reserved:s.reserved?Array.isArray(s.reserved)?s.reserved:s.reserved.split(/\s*\/\s*/).map(p=>p.trim()).filter(p=>p.length>0):void 0,dns_servers:s.dns?Array.isArray(s.dns)?s.dns:s.dns.split(/\s*,\s*/).map(p=>p.trim()).filter(p=>p.length>0):void 0,mtu:s.mtu,keepalive:s.keepalive};else if(s.type==="ssh")s={type:"ssh",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,private_key:s["private-key"],host_keys:s["host-key"],tfo:fi(s)};else if(s.type==="snell"){let p=H9(s.version);s={type:"snell",name:s.name,server:s.server,port:s.port,psk:s.psk,version:p,...p==null||p>=3?{udp_relay:Ja(s)}:{},reuse:s.reuse,obfs:s["obfs-opts"]?.mode||s.obfs,obfs_host:s["obfs-opts"]?.host||s["obfs-host"]||s.obfs_host,tfo:fi(s)}}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`);s.shadow_tls={password:u["plugin-opts"].password,sni:u["plugin-opts"].host}}let m=AJ(u);if(m&&(SJ(u,s)&&(s.fingerprint_sha256=m),CJ(s.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"])?s.block_quic=!0:["off","false",!1,"0",0].includes(u["block-quic"])&&(s.block_quic=!1)),["ss","ssr"].includes(u.type)&&s.shadow_tls&&u["udp-port"]>0&&u["udp-port"]<=65535&&(s.udp_port=u["udp-port"]),u["ip-version"]&&(s.ip_version=mJ[u["ip-version"]]||u["ip-version"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],s.transport){for(let p in s.transport)p!=="grpc"&&(Object.keys(s.transport[p]).length===0||Object.values(s.transport[p]).every(d=>d==null))&&delete s.transport[p];Object.keys(s.transport).length===0&&delete s.transport}if(r!=="internal")for(let p in s)(s[p]==null||/^_/i.test(p))&&delete s[p];return{[s.type]:{...s,type:void 0,prev_hop:h}}}catch(u){return J.error(`Cannot produce proxy: ${s.name}
Reason: ${u}`),null}}).filter(Boolean);return Ho(o,r,i)}}}function O9(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function fi(e){return!!(e.tfo??e["fast-open"])}function Ja(e){return e.udp??e.udp_relay}function N9(e){if(e!=null&&!(typeof e=="string"&&e.length===0))return e}function bl(e){let t=e?.["reality-opts"];if(!t)return;let n={},r=N9(t["public-key"]),i=N9(t["short-id"]);return r!=null&&(n.public_key=r),i!=null&&(n.short_id=i),Object.keys(n).length>0?n:void 0}function L9(e){return{grpc:{service_name:e["grpc-opts"]?.["grpc-service-name"],sni:e.sni,reality:bl(e),skip_tls_verify:e["skip-cert-verify"]}}}function U9(e){if(e.network!=="grpc")return!0;let t=e["grpc-opts"]?.["_grpc-type"];return t==null?!0:`${t}`.trim().toLowerCase()==="gun"}function H9(e){if(e==null)return;let t=`${e}`.trim();return/^[1-5]$/.test(t)?parseInt(t,10):null}var gJ=["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"],vJ=["origin","auth_sha1_v4","auth_aes128_md5","auth_aes128_sha1","auth_chain_a","auth_chain_b"],wJ=["plain","http_simple","http_post","random_head","tls1.2_ticket_auth","tls1.2_ticket_fastauth"];function $p(e){if(e==null)return;let t=`${e}`.trim().toLowerCase();return t.length>0?t:void 0}function q9(e){let t=$p(e);return t==="plain"?"none":t}function yJ(e){if(!gJ.includes(q9(e.cipher)))return!1;let t=$p(e.protocol);if(t!=null&&!vJ.includes(t))return!1;let n=$p(e.obfs);return n==null||wJ.includes(n)}function EJ(e,...t){for(let n of t){let r=oS(e?.[n]);if(r)return r}}function bJ(e){return oS(e?.host)||EJ(e?.headers,"host","Host")}function M9(e){let t={};if(e?.headers&&typeof e.headers=="object"&&!Array.isArray(e.headers))for(let[r,i]of Object.entries(e.headers)){if(/^host$/i.test(r))continue;let o=oS(i);o!=null&&(t[r]=o)}let n=bJ(e);return n&&(t.Host=n),Object.keys(t).length>0?t:void 0}function oS(e){if(Array.isArray(e))return e[0];if(e!=null)return e}function AJ(e){let t=e?.["tls-fingerprint"];if(typeof t!="string")return;let n=t.trim();return n.length>0?n:void 0}function SJ(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 CJ(e,t){if(e)for(let n of["grpc","http2","tls","wss"])e[n]&&(e[n].fingerprint_sha256=t)}function j9(){return{type:"ALL",produce:(n,r)=>r==="internal"?n:JSON.stringify(n,null,2)}}var K9={qx:Fp(),QX:Fp(),QuantumultX:Fp(),surge:nh(),Surge:nh(),SurgeMac:Sp(),Loon:ZA(),Clash:zg(),clash:zg(),meta:Ms(),clashmeta:Ms(),"clash.meta":Ms(),"Clash.Meta":Ms(),ClashMeta:Ms(),mihomo:Ms(),Mihomo:Ms(),uri:rh(),URI:rh(),v2:Dp(),v2ray:Dp(),V2Ray:Dp(),json:j9(),JSON:j9(),stash:Wg(),Stash:Wg(),shadowrocket:Bp(),Shadowrocket:Bp(),ShadowRocket:Bp(),surfboard:e2(),Surfboard:e2(),singbox:r2(),"sing-box":r2(),egern:s2(),Egern:s2()};var jye=B(x());var yye=B(x()),X7=B(d2());var kQ=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 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 (username password)? (usernamek passwordk)? (headers/max_streams/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 = "h2-connect";
proxy.tls = true;
handleShadowTLS();
}
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/salamander_password/gecko_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 tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.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: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:$(("\\" ('"' / "\\") / [^"])*) '"' &(_ ("," / !.)) { return proxy.type === "vless" ? unescapeQuotedValue(value) : value; }
/ '"' match:$[^"]* '"' { return match; }
/ "'" match:$[^']* "'" { return proxy.type === "vless" ? unescapeQuotedValue(match) : match; }
/ value:uri { return value.trim(); }
vless_quoted_value = &{ return proxy.type === "vless"; } value:quoted_value { return value.trim(); }
uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); }
salamander_password = comma "salamander-password" equals match:[^,]+ { proxy['obfs-password'] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); proxy.obfs = 'salamander'; }
gecko_password = comma "gecko-password" equals match:[^,]+ { proxy['obfs-password'] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); proxy.obfs = 'gecko'; }
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
comma = _ "," _
equals = _ "=" _
_ = [ \r\t]*
bool = b:("true"/"false") { return b === "true" }
others = comma [^=,]+ equals [^=,]+
`,DS;function Gn(){if(!DS){let e=X7.default.generate(kQ);DS={parse:t=>e.parse(t,{normalizeInlineEchConfigList:Mg,setSurgeXhttpOption:GI})}}return DS}var Aye=B(x()),Z7=B(d2());var TQ=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 [^=,]+)
`,FS;function Cs(){if(!FS){let e=Z7.default.generate(TQ);FS={parse:t=>e.parse(t,{setLoonXhttpOption:p9})}}return FS}var Cye=B(x()),IS=B(wa()),J7=B(d2());function RQ(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 n=IS.Buffer.from(t,"hex"),r=[];for(let i=0;i<n.length;){let o=n[i++];if(!o||i+o>n.length)return;r.push(n.subarray(i,i+o).toString("utf8")),i+=o}return r}var OQ=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" }
`,BS;function pi(){if(!BS){let e=J7.default.generate(OQ);BS={parse(t,n){let r=e.parse(t,{...n,byteLength:IS.Buffer.byteLength}),i=RQ(r["tls-alpn"]);return i&&(r.alpn=i),r}}}return BS}var Bye=B(x());var NQ=new Set(["__proto__","constructor","prototype"]),$S;function eu(e,t,n){if(Object(e)!==e)return e;if(Array.isArray(t)||(t=t.toString().match(/[^.[\]]+/g)||[]),t.some(r=>NQ.has(r)))throw new Error("Unsafe property path");return t.slice(0,-1).reduce((r,i,o)=>Object.prototype.hasOwnProperty.call(r,i)&&Object(r[i])===r[i]?r[i]:r[i]=Math.abs(t[o+1])>>0===+t[o+1]?[]:{},e)[t[t.length-1]]=n,e}function p2(e){if(e!=null)return/(TRUE)|1/i.test(e)}function Q7(e){return li(e)!=null}function xS(e){try{return decodeURIComponent(e)}catch{return e}}function LQ(e){let t={},n=e.match(/^trojan:\/\/([^@]+)@(\[[^\]]+\]|[^/?#]+):(\d+)(?:\/)?(?:\?([^#]*))?(?:#(.*))?$/);if(!n)throw new Error("Invalid trojan url");let[,r,i,o,s,a]=n,u=i.replace(/^\[|\]$/g,"");if((i.startsWith("[")||i.includes(":"))&&!Xt(u))throw new Error(`Invalid server: ${i}`);if(t.type="trojan",t.password=xS(r),t.server=i,t.port=Number(o),!Number.isSafeInteger(t.port)||t.port<1||t.port>65535)throw new Error(`Invalid port: ${o}`);t.name=a?xS(a):`${i}:${o}`;let l={};if(s)for(let h of s.split("&")){let m=h.indexOf("="),p=m===-1?h:h.slice(0,m);l[p]=m===-1?!0:xS(h.slice(m+1))}if(t["skip-cert-verify"]=p2(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(h=>h.trim()).filter(Boolean),t["name-cert-verify"]=t._vcn?.[0],l.alpn&&(t.alpn=l.alpn.split(",")),p2(l.ws)&&(t.network="ws",eu(t,"ws-opts.path",l.wspath)),l.type){let h=!1,m="",p="";if(t.network=l.type,t.network==="httpupgrade"&&(t.network="ws",h=!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=vl(d,"ed");Q7(v)&&(d=Ss(d,"ed").path,h?m=v:p=v)}eu(t,`${t.network}-opts.path`,d)}l.host&&eu(t,`${t.network}-opts.headers.Host`,l.host),h?(m=m||(Q7(l.ed)?String(l.ed):""),eu(t,"ws-opts.v2ray-http-upgrade",!0),m&&(eu(t,"ws-opts.v2ray-http-upgrade-fast-open",!0),eu(t,"ws-opts._v2ray-http-upgrade-ed",m))):t.network==="ws"&&p&&(eu(t,"ws-opts.max-early-data",li(p)),eu(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&&eu(t,"reality-opts",d)}}return t.udp=p2(l.udp),t.tfo=p2(l.tfo),t}function PS(){return $S||($S={parse:LQ}),$S}var OS=B(RS());var jo=B(Ga());function NS(e){let[t,n,r]=/^(.*?)(?:#(.*?))?$/.exec(e);return{content:n,fragment:r!=null?decodeURIComponent(r):void 0}}function UQ(e){let t=e.indexOf(":");if(t!==-1)return[decodeURIComponent(e.slice(0,t)),decodeURIComponent(e.slice(t+1))].join(":");let n=decodeURIComponent(e);return n.includes(":")?n:bt.decode(n)}function LS(e){return e==null||!/^\d+$/.test(`${e}`)?!1:Number.isSafeInteger(parseInt(`${e}`,10))}function US(e){let t=vl(e,"ed");return LS(t)?{path:Ss(e,"ed").path,ed:t}:{path:e,ed:""}}function HS(e){let t=`${e}`;if(!/^\d+$/.test(t))throw new Error(`bad WebSocket max early data size: ${e}`);let n=parseInt(t,10);if(!Number.isSafeInteger(n))throw new Error(`bad WebSocket max early data size: ${e}`);return n}function MS(e){if(Array.isArray(e))return e.flatMap(n=>MS(n)||[]);if(typeof e!="string")return e==null?void 0:[e];let t=e.split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t:void 0}function HQ(e){if(e==null)return null;let t=`${e}`.trim();if(!t)return null;let[,n=t,r]=/^(.*?)(?:\/(\d+))?$/.exec(t)||[],i=`${n}`.trim().replace(/^\[/,"").replace(/\]$/,""),o=(s,a)=>{if(s==null||!/^\d+$/.test(s))return;let u=parseInt(s,10);if(!(u<0||u>a))return u};return Sn(i)?{family:"ipv4",address:i,cidr:o(r,32)}:Xt(i)?{family:"ipv6",address:i,cidr:o(r,128)}:null}function MQ(){return{name:"URI PROXY Parser",test:r=>/^(socks5\+tls|socks5|http|https):\/\//.test(r),parse:r=>{let[i,o,s,a,u,l,h,m,p]=r.match(/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?\/?(\?.*?)?(?:#(.*?))?$/);if(h)h=parseInt(h,10);else{if(s)h=443;else if(o==="http")h=80;else throw J.error(`port is not present in line: ${r}`),new Error(`port is not present in line: ${r}`);J.info(`port is not present in line: ${r}, set to ${h}`)}let d={name:p!=null?decodeURIComponent(p):`${o} ${l}:${h}`,type:o,tls:!!s,server:l,port:h,username:a!=null?decodeURIComponent(a):void 0,password:u!=null?decodeURIComponent(u):void 0};if(s&&m){let v=vl(m,"fp")||vl(m,"client-fingerprint");v&&(d["client-fingerprint"]=v)}return d}}}function qQ(){return{name:"URI SOCKS Parser",test:r=>/^socks:\/\//.test(r),parse:r=>{let[i,o,s,a,u,l,h]=r.match(/^(socks)?:\/\/(?:(.*)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(u)u=parseInt(u,10);else throw J.error(`port is not present in line: ${r}`),new Error(`port is not present in line: ${r}`);let m,p;if(s){let v=bt.decode(decodeURIComponent(s)).split(":");m=v[0],p=v[1]}return{name:h!=null?decodeURIComponent(h):`${o} ${a}:${u}`,type:"socks5",server:a,port:u,username:m,password:p}}}}function jQ(){return{name:"URI SS Parser",test:r=>/^ss:\/\//.test(r),parse:r=>{let{content:i,fragment:o}=NS(r.split("ss://")[1]),s={type:"ss"},a=i.match(/@([^/?]*)(\/|\?|$)/),u=UQ(i.split("@")[0]),l="";if(a)i.includes("?")&&(l=i.match(/(\?.*)$/)[1]);else{if(i.includes("?")){let w=i.match(/^(.*)(\?.*)$/);i=w[1],l=w[2]}if(i=bt.decode(i),l){if(/(&|\?)v2ray-plugin=/.test(l)){let E=l.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];E&&(s.plugin="v2ray-plugin",s["plugin-opts"]=JSON.parse(bt.decode(E)))}i=`${i}${l}`}u=i.match(/(^.*)@/)?.[1],a=i.match(/@([^/@]*)(\/|$)/)}let h={};for(let w of l.replace(/^\?/,"").split("&"))if(w){let[E,C]=w.split("="),_=C;_=decodeURIComponent(C),h[E]=_}if(s.tls=h.security&&h.security!=="none",s["skip-cert-verify"]=!!h.allowInsecure,s.sni=h.sni||h.peer,s["client-fingerprint"]=h.fp,s.alpn=h.alpn?decodeURIComponent(h.alpn).split(","):void 0,h.ws&&(s.network="ws",jo.default.set(s,"ws-opts.path",h.wspath)),h.type){let w,E="",C="";if(s.network=h.type,s.network==="httpupgrade"&&(s.network="ws",w=!0),["grpc"].includes(s.network))s[s.network+"-opts"]={"grpc-service-name":h.serviceName,"_grpc-type":h.mode,"_grpc-authority":h.authority};else{if(h.path){let _=h.path;if(s.network==="ws"){let F=US(_);_=F.path,w?E=F.ed:C=F.ed}jo.default.set(s,s.network+"-opts.path",_)}h.host&&jo.default.set(s,s.network+"-opts.headers.Host",decodeURIComponent(h.host)),w?(E=E||(LS(h.ed)?`${h.ed}`:""),jo.default.set(s,s.network+"-opts.v2ray-http-upgrade",!0),E!==""&&(jo.default.set(s,s.network+"-opts.v2ray-http-upgrade-fast-open",!0),jo.default.set(s,s.network+"-opts._v2ray-http-upgrade-ed",E))):s.network==="ws"&&C!==""&&(jo.default.set(s,s.network+"-opts.max-early-data",HS(C)),jo.default.set(s,s.network+"-opts.early-data-header-name","Sec-WebSocket-Protocol"))}if(["reality"].includes(h.security)){let _={};h.pbk&&(_["public-key"]=h.pbk),h.sid&&(_["short-id"]=h.sid),h.spx&&(_["_spider-x"]=h.spx),h.mode&&(s._mode=h.mode),Object.keys(_).length>0&&jo.default.set(s,h.security+"-opts",_)}h.extra&&(s.network==="xhttp"||h.security==="reality")&&(s._extra=h.extra)}s.udp=![!1,0,"0","false","off"].includes(typeof h.udp=="string"?h.udp.toLowerCase():h.udp);let m=a[1],p=m.lastIndexOf(":");s.server=m.substring(0,p),s.port=`${m.substring(p+1)}`.match(/\d+/)?.[0];let d=u.match(/(^.*?):(.*$)/);s.cipher=d?.[1],s.password=d?.[2];let v=i.match(/[?&]plugin=([^&]+)/),g=i.match(/[?&]shadow-tls=([^&]+)/),y=i.match(/[?&]gost=([^&]+)/);if(v){let w=("plugin="+decodeURIComponent(v[1])).split(";"),E={};for(let C of w){let _=C.indexOf("=");if(_===-1){C&&(E[C]=!0);continue}let F=C.slice(0,_),H=C.slice(_+1).replace(/\\=/g,"=");F&&(E[F]=H||!0)}switch(E.plugin){case"obfs-local":case"simple-obfs":s.plugin="obfs",s["plugin-opts"]={mode:E.obfs,host:vt(E["obfs-host"])};break;case"v2ray-plugin":s.plugin="v2ray-plugin",s["plugin-opts"]={mode:vt(E.obfs)||vt(E.mode)||"websocket",host:vt(E["obfs-host"])||vt(E.host),path:vt(E.path),tls:la(E.tls),sni:la(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":{s.plugin="shadow-tls";let C=vt(E.version);s["plugin-opts"]={host:vt(E.host),password:vt(E.password),version:C?parseInt(C,10):void 0};break}default:throw new Error(`Unsupported plugin option: ${E.plugin}`)}}if(g){let w=JSON.parse(bt.decode(g[1])),E=vt(w.version),C=vt(w.address),_=vt(w.port);s.plugin="shadow-tls",s["plugin-opts"]={host:vt(w.host),password:vt(w.password),version:E?parseInt(E,10):void 0},C&&(s.server=C),_&&(s.port=parseInt(_,10))}if(y){let w=JSON.parse(bt.decode(decodeURIComponent(y[1]))),E=vt(w.address),C=vt(w.port),_=vt(w.route),F=_?.trim().toLowerCase(),H=["ws","wss","websocket"].includes(F);s.plugin="gost-plugin",s["plugin-opts"]={mode:H?"websocket":_,host:vt(w.host),path:vt(w.path)},F==="wss"&&(s["plugin-opts"].tls=!0),E&&(s.server=E),C&&(s.port=parseInt(C,10))}return/(&|\?)uot=(1|true)/i.test(l)&&(s["udp-over-tcp"]=!0),/(&|\?)tfo=(1|true)/i.test(l)&&(s.tfo=!0),s.name=o??`SS ${s.server}:${s.port}`,s}}}function KQ(){return{name:"URI SSR Parser",test:r=>/^ssr:\/\//.test(r),parse:r=>{r=bt.decode(r.split("ssr://")[1]);let i=r.indexOf(":origin");i===-1&&(i=r.indexOf(":auth_"));let o=r.substring(0,i),s=o.substring(0,o.lastIndexOf(":")),a=o.substring(o.lastIndexOf(":")+1),u=r.substring(i+1).split("/?")[0].split(":"),l={type:"ssr",server:s,port:a,protocol:u[0],cipher:u[1],obfs:u[2],password:bt.decode(u[3])},h={};if(r=r.split("/?")[1].split("&"),r.length>1)for(let m of r){let[p,d]=m.split("=");d=d.trim(),d.length>0&&d!=="(null)"&&(h[p]=d)}return l={...l,name:h.remarks?bt.decode(h.remarks):l.server,"protocol-param":vt(bt.decode(h.protoparam||h.protocolparam||"").replace(/\s/g,"")),"obfs-param":vt(bt.decode(h.obfsparam||"").replace(/\s/g,""))},l}}}function VQ(){return{name:"URI VMess Parser",test:r=>/^vmess:\/\//.test(r),parse:r=>{if(/^vmess:\/\/[^/?#]+@/.test(r))return qS().parse(r,"vmess");let{content:i,fragment:o}=NS(r.split("vmess://")[1]),s=bt.decode(i.replace(/\?.*?$/,""));if(/=\s*vmess/.test(s)){let a=s.split(",").map(h=>h.trim()),u={};for(let h of a)if(h.indexOf("=")!==-1){let[m,p]=h.split("=");u[m.trim()]=p.trim()}let l={name:a[0].split("=")[0].trim(),type:"vmess",server:a[1],port:a[2],cipher:Vn(vt(a[3],"auto")),uuid:a[4].match(/^"(.*)"$/)[1],tls:u.obfs==="wss",udp:la(u["udp-relay"]),tfo:la(u["fast-open"]),"skip-cert-verify":Xl(u["tls-verification"])?!u["tls-verification"]:void 0};if(Xl(u.obfs))if(u.obfs==="ws"||u.obfs==="wss"){l.network="ws",l["ws-opts"].path=(vt(u["obfs-path"])||'"/"').match(/^"(.*)"$/)[1];let h=u["obfs-header"];h&&h.indexOf("Host")!==-1&&(h=h.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),qe(h)&&(l["ws-opts"].headers={Host:h})}else throw new Error(`Unsupported obfs: ${u.obfs}`);return qe(o)&&(l.name=o),l}else{let a={};try{a=JSON.parse(s)}catch{let[d,v,g]=/(^[^?]+?)\/?\?(.*)$/.exec(i);s=bt.decode(v);for(let F of g.split("&")){let[H,K]=F.split("="),S=K;S=decodeURIComponent(K),S.indexOf(",")===-1?a[H]=S:a[H]=S.split(",")}let[y,w,E,C,_]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(s);a.scy=w,a.id=E,a.port=_,a.add=C}let u=a.add,l=parseInt(la(a.port),10),h={name:a.ps??a.remarks??a.remark??`VMess ${u}:${l}`,type:"vmess",server:u,port:l,cipher:Vn(a.scy),uuid:a.id,alterId:parseInt(la(a.aid??a.alterId,0),10),tls:["tls",!0,1,"1"].includes(a.tls),"skip-cert-verify":Xl(a.verify_cert)?!a.verify_cert:void 0};!h["skip-cert-verify"]&&Xl(a.allowInsecure)&&(h["skip-cert-verify"]=/(TRUE)|1/i.test(a.allowInsecure)),h.tls&&(a.sni&&a.sni!==""?h.sni=a.sni:a.peer&&a.peer!==""&&(h.sni=a.peer));let m=!1;if(a.net==="ws"||a.obfs==="websocket"?h.network="ws":["http"].includes(a.obfs)||["http"].includes(a.type)?h.network="http":a.net==="http"?h.network="h2":["grpc","kcp","quic"].includes(a.net)?h.network=a.net:a.net==="httpupgrade"||h.network==="httpupgrade"?(h.network="ws",m=!0):(a.net==="h2"||h.network==="h2")&&(h.network="h2"),h.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(h.network==="ws"&&d){let y=US(d);d=y.path,m?v=y.ed:g=y.ed}if(["ws"].includes(h.network)&&(d=d||"/"),h.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="/"):h.network==="h2"&&(d||(d="/")),d||p||["kcp","quic"].includes(h.network))if(["grpc"].includes(h.network))h[`${h.network}-opts`]={"grpc-service-name":vt(d),"_grpc-type":vt(a.type),"_grpc-authority":vt(a.authority)};else if(["kcp","quic"].includes(h.network))h[`${h.network}-opts`]={[`_${h.network}-type`]:vt(a.type),[`_${h.network}-host`]:vt(vt(p)),[`_${h.network}-path`]:vt(d)};else{let y={path:vt(d)},w=vt(p);if(h.network==="h2"){let E=MS(w);E&&(y.host=E)}else y.headers={Host:w};m?(y["v2ray-http-upgrade"]=!0,v=v||(LS(a.ed)?`${a.ed}`:""),v!==""&&(y["v2ray-http-upgrade-fast-open"]=!0,y["_v2ray-http-upgrade-ed"]=v)):h.network==="ws"&&g!==""&&(y["max-early-data"]=HS(g),y["early-data-header-name"]="Sec-WebSocket-Protocol"),h[`${h.network}-opts`]=y}else delete h.network}return h["client-fingerprint"]=a.fp??a["client-fingerprint"],h.alpn=a.alpn?a.alpn.split(","):void 0,qe(o)&&(h.name=o),h}}}}function qS(){return{name:"URI VLESS Parser",test:r=>/^vless:\/\//.test(r),parse:(r,i="vless")=>{let o=P=>{if(!ze(P))return;let M={},Y={maxConnections:"max-connections",maxConcurrency:"max-concurrency",cMaxReuseTimes:"c-max-reuse-times",hMaxRequestTimes:"h-max-request-times",hMaxReusableSecs:"h-max-reusable-secs"};for(let[X,te]of Object.entries(Y)){let ae=Hs(P[X]);ae!=null&&(M[te]=typeof ae=="number"?`${ae}`:ae)}let V=Zr(P.hKeepAlivePeriod);return V!=null&&(M["h-keep-alive-period"]=V),Object.keys(M).length>0?M:void 0},s=P=>{if(!ze(P))return;let M={};for(let[Y,V]of Object.entries(P))typeof V=="string"&&(M[Y]=V);return Object.keys(M).length>0?M:void 0},a=P=>{if(Array.isArray(P))return P.map(a);if(ze(P)){let M={};for(let[Y,V]of Object.entries(P))M[Y]=a(V);return M}return P},u=P=>{if(Array.isArray(P))return P.map(u).filter(Y=>Y!==void 0);if(!ze(P))return P;let M={};for(let[Y,V]of Object.entries(P)){let X=u(V);X!==void 0&&(M[Y]=X)}return Object.keys(M).length>0?M:void 0},l=(P,M,Y)=>{let V=u(a(Y));V!==void 0&&(P[M]=V)},h=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))typeof V!="string"&&l(M,Y,V);return u(M)},m=(P,M)=>["maxConnections","maxConcurrency","cMaxReuseTimes","hMaxRequestTimes","hMaxReusableSecs"].includes(P)?Hs(M)!=null:P==="hKeepAlivePeriod"?Zr(M)!=null:!1,p=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))m(Y,V)||l(M,Y,V);return u(M)},d=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))switch(Y){case"headers":{let X=h(V);X!==void 0&&(M.headers=X);break}case"noGRPCHeader":case"xPaddingObfsMode":V!==!0&&l(M,Y,V);break;case"xPaddingBytes":Qf(V)==null&&l(M,Y,V);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 V!="string"&&l(M,Y,V);break;case"sessionIDTable":typeof V!="string"&&l(M,Y,V);break;case"uplinkChunkSize":Hs(V)==null&&l(M,Y,V);break;case"scMaxEachPostBytes":Qf(V)==null&&l(M,Y,V);break;case"scMinPostsIntervalMs":Mo(V)==null&&l(M,Y,V);break;case"sessionIDLength":Qf(V)==null&&l(M,Y,V);break;case"xmux":{let X=p(V);X!==void 0&&(M.xmux=X);break}default:l(M,Y,V);break}return u(M)},v=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};Object.prototype.hasOwnProperty.call(P,"path")&&!qe(P.path)&&l(M,"path",P.path),Object.prototype.hasOwnProperty.call(P,"host")&&!qe(P.host)&&l(M,"host",P.host),Object.prototype.hasOwnProperty.call(P,"mode")&&!qe(P.mode)&&l(M,"mode",P.mode);let Y={};for(let[X,te]of Object.entries(P))["path","host","mode","extra"].includes(X)||(Y[X]=te);let V=d(Y);if(ze(V)&&Object.assign(M,V),Object.prototype.hasOwnProperty.call(P,"extra")){let X=d(P.extra);X!==void 0&&(M.extra=X)}return u(M)},g=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))switch(Y){case"address":qe(V)||l(M,Y,V);break;case"port":Zr(V,{allowNegative:!1})==null&&l(M,Y,V);break;case"security":{let X=typeof V=="string"?V.toLowerCase():"";["tls","reality"].includes(X)||l(M,Y,V);break}case"tlsSettings":{if(!ze(V)){l(M,Y,V);break}let X={},te=TA(V.echConfigList);for(let[me,he]of Object.entries(V))switch(me){case"serverName":case"fingerprint":qe(he)||l(X,me,he);break;case"echConfigList":TA(he)||l(X,me,he);break;case"echForceQuery":(!te||!qg(he))&&l(X,me,he);break;case"echSockopt":(!te||!ze(he))&&l(X,me,he);break;case"alpn":Array.isArray(he)&&he.length>0&&he.every(De=>typeof De=="string"&&De!=="")||l(X,me,he);break;case"allowInsecure":he!==!0&&l(X,me,he);break;default:l(X,me,he);break}let ae=u(X);ae!==void 0&&(M.tlsSettings=ae);break}case"realitySettings":{if(!ze(V)){l(M,Y,V);break}let X={};for(let[ae,me]of Object.entries(V))switch(ae){case"publicKey":case"shortId":case"serverName":case"fingerprint":qe(me)||l(X,ae,me);break;default:l(X,ae,me);break}let te=u(X);te!==void 0&&(M.realitySettings=te);break}case"xhttpSettings":{let X=v(V);X!==void 0&&(M.xhttpSettings=X);break}case"network":{let X=typeof V=="string"?V.toLowerCase():"";X!=="xhttp"&&X!=="splithttp"&&l(M,Y,V);break}default:l(M,Y,V);break}return u(M)},y=(P,{parsedDownloadSettings:M}={})=>{if(!ze(P))return;let{downloadSettings:Y,...V}=P,X=d(V)||{};if(Object.prototype.hasOwnProperty.call(P,"downloadSettings")){let te=g(Y);te!==void 0&&(X.downloadSettings=te)}return u(X)},w=(P,M)=>{if(!ze(P)||!ze(M))return;let Y=s(M.headers);if(Y){let De={...P.headers||{}};for(let[Pe,Ie]of Object.entries(Y)){if(/^host$/i.test(Pe)){!Object.prototype.hasOwnProperty.call(De,"Host")&&!Object.prototype.hasOwnProperty.call(De,"host")&&(De.Host=Ie);continue}De[Pe]=Ie}Object.keys(De).length>0&&(P.headers=De)}M.noGRPCHeader===!0&&(P["no-grpc-header"]=!0);let V=Qf(M.xPaddingBytes);V!=null&&(P["x-padding-bytes"]=V),M.xPaddingObfsMode===!0&&(P["x-padding-obfs-mode"]=!0),qe(M.xPaddingKey)&&(P["x-padding-key"]=M.xPaddingKey),qe(M.xPaddingHeader)&&(P["x-padding-header"]=M.xPaddingHeader),qe(M.xPaddingPlacement)&&(P["x-padding-placement"]=M.xPaddingPlacement),qe(M.xPaddingMethod)&&(P["x-padding-method"]=M.xPaddingMethod),qe(M.uplinkHTTPMethod)&&(P["uplink-http-method"]=M.uplinkHTTPMethod),qe(M.sessionIDPlacement)?P["session-placement"]=M.sessionIDPlacement:qe(M.sessionPlacement)&&(P["session-placement"]=M.sessionPlacement),qe(M.sessionIDKey)?P["session-key"]=M.sessionIDKey:qe(M.sessionKey)&&(P["session-key"]=M.sessionKey),typeof M.sessionIDTable=="string"&&(P["session-table"]=M.sessionIDTable);let X=Qf(M.sessionIDLength);X!=null&&(P["session-length"]=X),qe(M.seqPlacement)&&(P["seq-placement"]=M.seqPlacement),qe(M.seqKey)&&(P["seq-key"]=M.seqKey),qe(M.uplinkDataPlacement)&&(P["uplink-data-placement"]=M.uplinkDataPlacement),qe(M.uplinkDataKey)&&(P["uplink-data-key"]=M.uplinkDataKey);let te=Hs(M.uplinkChunkSize);te!=null&&(P["uplink-chunk-size"]=te);let ae=ml(M.scMaxEachPostBytes);ae!=null&&(P["sc-max-each-post-bytes"]=ae);let me=Mo(M.scMinPostsIntervalMs);me!=null&&(P["sc-min-posts-interval-ms"]=me);let he=o(M.xmux);he&&(P["reuse-settings"]=he)},E=P=>{if(!ze(P))return;let M={},Y=typeof P.network=="string"?P.network.toLowerCase():"";(Y==="xhttp"||Y==="splithttp")&&(M.network="xhttp"),qe(P.address)&&(M.server=P.address);let V=Zr(P.port,{allowNegative:!1});V!=null&&(M.port=V);let X=typeof P.security=="string"?P.security.toLowerCase():"";if((X==="tls"||X==="reality")&&(M.tls=!0),ze(P.tlsSettings)){qe(P.tlsSettings.serverName)&&(M.servername=P.tlsSettings.serverName),qe(P.tlsSettings.fingerprint)&&(M["client-fingerprint"]=P.tlsSettings.fingerprint),Array.isArray(P.tlsSettings.alpn)&&P.tlsSettings.alpn.length>0&&P.tlsSettings.alpn.every(me=>typeof me=="string"&&me!=="")&&(M.alpn=P.tlsSettings.alpn),P.tlsSettings.allowInsecure===!0&&(M["skip-cert-verify"]=!0);let ae=jg({echConfigList:P.tlsSettings.echConfigList,echForceQuery:P.tlsSettings.echForceQuery,echSockopt:P.tlsSettings.echSockopt});ae&&(M["ech-opts"]=ae)}let te;return ze(P.realitySettings)&&(te={},qe(P.realitySettings.publicKey)&&(te["public-key"]=P.realitySettings.publicKey),qe(P.realitySettings.shortId)&&(te["short-id"]=P.realitySettings.shortId),qe(P.realitySettings.serverName)&&(M.servername=P.realitySettings.serverName),qe(P.realitySettings.fingerprint)&&(M["client-fingerprint"]=P.realitySettings.fingerprint)),X==="reality"?M["reality-opts"]=te||{}:te&&Object.keys(te).length>0&&(M["reality-opts"]=te),ze(P.xhttpSettings)&&(qe(P.xhttpSettings.path)&&(M.path=P.xhttpSettings.path),qe(P.xhttpSettings.host)&&(M.host=P.xhttpSettings.host),qe(P.xhttpSettings.mode)&&(M.mode=P.xhttpSettings.mode),w(M,P.xhttpSettings),ze(P.xhttpSettings.extra)&&w(M,P.xhttpSettings.extra)),Object.keys(M).length>0?M:void 0};r=r.split(`${i}://`)[1];let C,_=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(r);if(!_){let[P,M,Y]=/^(.*?)(\?.*?$)/.exec(r);r=`${bt.decode(M)}${Y}`,_=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(r),C=!0}let[F,H,K,S,I,q="",L]=_;C&&(H=H.replace(/^.*?:/g,"")),S=parseInt(`${S}`,10),H=decodeURIComponent(H),L!=null&&(L=decodeURIComponent(L));let T={type:i,name:L,server:K,port:S,uuid:H,udp:!0},O={};for(let P of q.split("&"))if(P){let[M,...Y]=P.split("=");O[M]=decodeURIComponent(Y.join("="))}if(T.name=L??O.remarks??O.remark??`${i==="vmess"?"VMess":"VLESS"} ${K}:${S}`,T.tls=O.security&&O.security!=="none",O.pbk&&(O.security="reality"),C&&/TRUE|1/i.test(O.tls)&&(T.tls=!0,O.security=O.security??"reality"),T.sni=O.sni||O.peer,T.flow=O.flow,!T.flow&&C&&O.xtls){let P=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][O.xtls];P&&(T.flow=P)}T["client-fingerprint"]=O.fp??O["client-fingerprint"],T.alpn=O.alpn?O.alpn.split(","):void 0,T["skip-cert-verify"]=/(TRUE)|1/i.test(O.allowInsecure)||i==="vless"&&O.allowInsecure==null&&O.insecure==="1",T._echConfigList=la(O.ech);let R=jg({echConfigList:O.ech});switch(R&&(T["ech-opts"]=R),T["tls-fingerprint"]=la(O.pcs),T._vcn=O.vcn?.split(",").map(P=>P.trim()).filter(Boolean),T["name-cert-verify"]=T._vcn?.[0],T._h2=/(TRUE)|1/i.test(O.h2),`${O.packetEncoding||""}`.trim().toLowerCase()){case"none":T["packet-encoding"]="";break;case"packet":T["packet-encoding"]="packetaddr";break;default:T["packet-encoding"]="xudp";break}if(["reality"].includes(O.security)){let P={};if(O.pbk){P["public-key"]=O.pbk;let M=O["support-x25519mlkem768"];["1","t","T","true","TRUE","True"].includes(M)&&(P["support-x25519mlkem768"]=!0)}O.sid&&(P["short-id"]=O.sid),O.spx&&(P["_spider-x"]=O.spx),Object.keys(P).length>0&&(T[`${O.security}-opts`]=P)}let N=!1;if(T.network=O.type||"tcp",T.network==="tcp"&&O.headerType==="http"?T.network="http":T.network==="http"?T.network="h2":T.network==="httpupgrade"&&(T.network="ws",N=!0),!O.type&&C&&O.obfs&&(T.network=O.obfs,["none"].includes(T.network)&&(T.network="tcp")),["websocket"].includes(T.network)?T.network="ws":i==="vless"&&T.network==="splithttp"&&(T.network="xhttp"),T.network&&!["tcp","none"].includes(T.network)){let P={},M="",Y=O.host??O.obfsParam;if(Y){if(O.obfsParam)try{let te=JSON.parse(Y);P.headers=te}catch{P.headers={Host:Y}}else P.headers={Host:Y};["xhttp"].includes(T.network)&&P.headers?.Host&&(P.host=P.headers.Host,delete P.headers.Host,Object.keys(P.headers).length===0&&delete P.headers);let X=P.headers?.Host??P.headers?.host;["h2"].includes(T.network)&&X&&(P.host=MS(X),delete P.headers.Host,delete P.headers.host,Object.keys(P.headers).length===0&&delete P.headers)}if(O.serviceName?P[`${T.network}-service-name`]=O.serviceName:C&&O.path&&(["ws","http","h2","xhttp"].includes(T.network)||(P[`${T.network}-service-name`]=O.path,delete O.path)),O.path){let X=O.path;if(T.network==="ws"){let te=US(X);X=te.path,M=te.ed}P.path=X}else T.network==="h2"&&(P.path="/");T.network==="http"&&O.method&&(P.method=O.method),["grpc"].includes(T.network)&&(P["_grpc-type"]=O.mode||"gun",O.authority&&(P["_grpc-authority"]=O.authority)),N&&(P["v2ray-http-upgrade"]=!0);let V=M||O.ed;if(V){let X=HS(V);N?(P["v2ray-http-upgrade-fast-open"]=!0,P["_v2ray-http-upgrade-ed"]=`${V}`):T.network==="ws"&&(P["max-early-data"]=X,P["early-data-header-name"]=O.eh||"Sec-WebSocket-Protocol")}if(O.eh&&(T.network==="ws"||N)&&(P["early-data-header-name"]=O.eh),Object.keys(P).length>0&&(T[`${T.network}-opts`]=P),T.network==="kcp"&&(O.seed&&(T.seed=O.seed),T.headerType=O.headerType||"none"),O.extra&&!["xhttp"].includes(T.network)&&(T._extra=O.extra),["xhttp"].includes(T.network)){let X={},te;try{X=O.extra?JSON.parse(O.extra):{}}catch{J.error(`Failed to parse extra field as JSON: ${O.extra}`),te=O.extra}let ae={...T[`${T.network}-opts`]||{}};O.mode&&(ae.mode=O.mode),w(ae,X);let me=E(X?.downloadSettings);me&&(ae["download-settings"]=me),Object.keys(ae).length>0&&(T[`${T.network}-opts`]=ae),te!=null&&(T._extra=te);let he=y(X,{parsedDownloadSettings:me});he&&(T._extra_unsupported=he)}else O.mode&&(T._mode=O.mode)}if(i==="vmess"?(T.cipher=Vn(O.encryption),T.alterId=0,delete T.flow):O.encryption&&(T.encryption=O.encryption),O.pqv&&(T._pqv=O.pqv),O.fm)try{let P=JSON.parse(O.fm);T._finalmask=ze(P)?P:O.fm}catch{T._finalmask=O.fm}return T}}}function GQ(){return{name:"URI AnyTLS Parser",test:r=>/^anytls:\/\//.test(r),parse:r=>{let i=qS().parse(r.replace("anytls","vless"));r=r.split(/anytls:\/\//)[1];let[o,s,a,u,l="",h]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(r);u=parseInt(`${u}`,10),isNaN(u)&&(u=443),s=decodeURIComponent(s),h!=null&&(h=decodeURIComponent(h)),h=h??`AnyTLS ${a}:${u}`;let m={...i,uuid:void 0,type:"anytls",name:h,server:a,port:u,password:s};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 zQ(){return{name:"URI Mieru Parser",test:r=>/^mierus:\/\//i.test(r),parse:r=>{let{content:i,fragment:o}=NS(r),s=/^mierus:\/\/([^:@/?]+):([^@/?]+)@(\[[^\]]+\]|[^:/?@\s]+)\/?\?(.+)$/i.exec(i);if(!s)throw new Error("Invalid Mieru URI");let[,a,u,l,h]=s,m=new Map;for(let y of h.split("&")){let{key:w,value:E}=Gg(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(),[,C,_=C]=/^(\d+)(?:-(\d+))?$/.exec(y)||[],F=Number(C),H=Number(_);if(!(1<=F&&F<=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=F,K})}}}function WQ(){return{name:"URI Hysteria2 Parser",test:r=>/^(hysteria2|hy2):\/\//.test(r),parse:r=>{r=r.split(/(hysteria2|hy2):\/\//)[2];let i,[o,s,a,u,l,h,m,p,d,v,g="",y]=/^(.*?)@(.*?)(:((\d+(-\d+)?)([,;]\d+(-\d+)?)*))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(r);/^\d+$/.test(l)?(l=parseInt(`${l}`,10),isNaN(l)&&(l=443)):l?(i=l,l=Qh(i)):l=443,s=decodeURIComponent(s),y!=null&&(y=decodeURIComponent(y)),y=y??`Hysteria2 ${a}:${l}`;let w={type:"hysteria2",name:y,server:a,port:l,ports:i,password:s},E={};for(let H of g.split("&"))if(H){let[K,S]=H.split("="),I=S;I=decodeURIComponent(S),E[K]=I}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 C=E["hop-interval"]||E.hop_interval;C!=null&&(w["hop-interval"]=C);let _=E.keepalive;/^\d+$/.test(_)&&(w.keepalive=parseInt(`${_}`,10)),E.upmbps&&(w.up=E.upmbps),E.downmbps&&(w.down=E.downmbps);let F=jg({echConfigList:E.ech});return F&&(w["ech-opts"]=F),w}}}function YQ(){return{name:"URI Hysteria Parser",test:r=>/^(hysteria|hy):\/\//.test(r),parse:r=>{r=r.split(/(hysteria|hy):\/\//)[2];let[i,o,s,a,u,l="",h]=/^(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(r);a=parseInt(`${a}`,10),isNaN(a)&&(a=443),h!=null&&(h=decodeURIComponent(h)),h=h??`Hysteria ${o}:${a}`;let m={type:"hysteria",name:h,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 XQ(){return{name:"URI TUIC Parser",test:r=>/^tuic:\/\//.test(r),parse:r=>{r=r.split(/tuic:\/\//)[1];let[i,o,s,a,u="",l]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(r);o=decodeURIComponent(o);let[h,...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 ${s}:${a}`;let d={type:"tuic",name:l,server:s,port:a,password:p,uuid:h};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 ZQ(){return{name:"URI WireGuard Parser",test:r=>/^(wireguard|wg):\/\//.test(r),parse:r=>{r=r.split(/(wireguard|wg):\/\//)[2];let[i,o,s,a,u,l,h,m="",p]=/^((.*?)@)?(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(r);l=parseInt(`${l}`,10),isNaN(l)&&(l=51820),s=decodeURIComponent(s),p!=null&&(p=decodeURIComponent(p)),p=p??`WireGuard ${a}:${l}`;let d={type:"wireguard",name:p,server:a,port:l,"private-key":s,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(C=>parseInt(C.trim(),10)).filter(C=>Number.isInteger(C));E.length===3&&(d[y]=E)}else if(["address","ip"].includes(y))w.split(",").map(E=>{let C=HQ(E);C&&(C.family==="ipv4"?(d.ip=C.address,typeof C.cidr<"u"&&(d["ip-cidr"]=C.cidr)):C.family==="ipv6"&&(d.ipv6=C.address,typeof C.cidr<"u"&&(d["ipv6-cidr"]=C.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 JQ(){return{name:"URI Trojan Parser",test:r=>/^trojan:\/\//.test(r),parse:r=>{let[i,o]=r.split(/#(.+)/,2),s=/^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(i);s?.[2]||(i=i.replace(s[1],`${s[1]}:443`));let l=PS().parse(i);if(qe(o))try{l.name=decodeURIComponent(o)}catch(h){console.log(h)}return l}}}function QQ(){return{name:"Clash Parser",test:r=>{let i;try{i=OS.default.parse(r)}catch{i=Rs.parse(r)}return!!i?.type},parse:r=>{let i;try{i=OS.default.parse(r)}catch{i=Rs.parse(r)}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(i.type))throw new Error(`Clash does not support proxy with type: ${i.type}`);return["vmess","vless"].includes(i.type)&&i.servername&&(i.sni=i.servername,delete i.servername),i["server-cert-fingerprint"]&&(i["tls-fingerprint"]=i["server-cert-fingerprint"]),i.fingerprint&&(i["tls-fingerprint"]=i.fingerprint),i["dialer-proxy"]&&(i["underlying-proxy"]=i["dialer-proxy"]),i["benchmark-url"]&&(i["test-url"]=i["benchmark-url"]),i["benchmark-timeout"]&&(i["test-timeout"]=i["benchmark-timeout"]),i.type==="vmess"&&(i.cipher=Vn(i.cipher)),i}}}function eee(){return{name:"QX SS Parser",test:r=>/^shadowsocks\s*=/.test(r.split(",")[0].trim())&&r.indexOf("ssr-protocol")===-1,parse:r=>pi().parse(r)}}function tee(){return{name:"QX SSR Parser",test:r=>/^shadowsocks\s*=/.test(r.split(",")[0].trim())&&r.indexOf("ssr-protocol")!==-1,parse:r=>pi().parse(r)}}function nee(){return{name:"QX VMess Parser",test:r=>/^vmess\s*=/.test(r.split(",")[0].trim()),parse:r=>pi().parse(r)}}function ree(){return{name:"QX VLESS Parser",test:r=>/^vless\s*=/.test(r.split(",")[0].trim()),parse:r=>pi().parse(r)}}function see(){return{name:"QX AnyTLS Parser",test:r=>/^anytls\s*=/.test(r.split(",")[0].trim()),parse:r=>pi().parse(r)}}function iee(){return{name:"QX Mieru Parser",test:r=>/^mieru\s*=/.test(r),parse:r=>pi().parse(r)}}function oee(){return{name:"QX Hysteria2 Parser",test:r=>/^hysteria2\s*=/.test(r),parse:r=>pi().parse(r)}}function aee(){return{name:"QX Trojan Parser",test:r=>/^trojan\s*=/.test(r.split(",")[0].trim()),parse:r=>pi().parse(r)}}function uee(){return{name:"QX HTTP Parser",test:r=>/^http\s*=/.test(r.split(",")[0].trim()),parse:r=>pi().parse(r)}}function cee(){return{name:"QX Socks5 Parser",test:r=>/^socks5\s*=/.test(r.split(",")[0].trim()),parse:r=>pi().parse(r)}}function lee(){return{name:"Loon SS Parser",test:r=>r.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:r=>Cs().parse(r)}}function fee(){return{name:"Loon SSR Parser",test:r=>r.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:r=>Cs().parse(r)}}var e$=/^[^=,]*=\s*vmess\s*,[^,]*,[^,]*,[^,]*,\s*"/i;function hee(){return{name:"Loon VMess Parser",test:r=>e$.test(r),parse:r=>Cs().parse(r)}}function dee(){return{name:"Loon Vless Parser",test:r=>/^.*=\s*vless/i.test(r.split(",")[0]),parse:r=>Cs().parse(r)}}function pee(){return{name:"Loon Trojan Parser",test:r=>/^.*=\s*trojan/i.test(r.split(",")[0]),parse:r=>Cs().parse(r)}}function mee(){return{name:"Loon AnyTLS Parser",test:r=>/^.*=\s*anytls/i.test(r.split(",")[0]),parse:r=>Cs().parse(r)}}function gee(){return{name:"Loon Hysteria2 Parser",test:r=>/^.*=\s*Hysteria2/i.test(r.split(",")[0]),parse:r=>Cs().parse(r)}}function vee(){return{name:"Loon HTTP Parser",test:r=>/^.*=\s*http/i.test(r.split(",")[0]),parse:r=>Cs().parse(r)}}function wee(){return{name:"Loon SOCKS5 Parser",test:r=>/^.*=\s*socks5/i.test(r.split(",")[0]),parse:r=>Cs().parse(r)}}function yee(){return{name:"Loon Tailscale Parser",test:r=>/^[^=,]*=\s*tailscale\s*(?:,|$)/i.test(r),parse:r=>Cs().parse(r)}}function Eee(){return{name:"Loon Mieru Parser",test:r=>/^[^=,]*=\s*mieru\s*,/i.test(r),parse:r=>Cs().parse(r)}}function bee(){return{name:"Loon WireGuard Parser",test:r=>/^.*=\s*wireguard/i.test(r.split(",")[0]),parse:r=>{let i=r.match(/(^.*?)\s*?=\s*?wireguard\s*?,.+?\s*?=\s*?.+?/i)?.[1];r=r.replace(i,"").replace(/^\s*?=\s*?wireguard\s*/i,"");let o=r.match(/,\s*?peers\s*?=\s*?\[\s*?\{\s*?(.+?)\s*?\}\s*?\]/i)?.[1],s=o.match(/(,|^)\s*?endpoint\s*?=\s*?"?(.+?):(\d+)"?\s*?(,|$)/i),a=s?.[2],u=parseInt(s?.[3],10),l=r.match(/(,|^)\s*?mtu\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];l&&(l=parseInt(l,10));let h=r.match(/(,|^)\s*?keepalive\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];h&&(h=parseInt(h,10));let m=o.match(/(,|^)\s*?reserved\s*?=\s*?"?(\[\s*?.+?\s*?\])"?\s*?(,|$)/i)?.[2];m&&(m=JSON.parse(m));let p,d=r.match(/(?:^|,)\s*server-dns\s*=\s*(?:"([^"]*)"|([^"]*?))(?=\s*(?:,\s*[\w-]+\s*=|$))/i),v=r.match(/(,|^)\s*?dns\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],g=r.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=r.match(/(,|^)\s*?interface-ip\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],C=r.match(/(,|^)\s*?interface-ipv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],_=o.match(/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],F={type:"wireguard",name:i,server:a,port:u,ip:E,ipv6:C,"private-key":r.match(/(,|^)\s*?private-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],"public-key":_,mtu:l,keepalive:h,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:C,"public-key":_,"pre-shared-key":w,"allowed-ips":y,reserved:m}]};return Array.isArray(F.dns)&&F.dns.length>0&&(F["remote-dns-resolve"]=!0),F}}}function Aee(){return{name:"Surge Direct Parser",test:r=>/^[^=,]*=\s*direct\s*$/i.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function See(){return{name:"Surge AnyTLS Parser",test:r=>/^.*=\s*anytls/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function Cee(){return{name:"Surge TrustTunnel Parser",test:r=>/^.*=\s*trust-tunnel/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function _ee(){return{name:"Surge MASQUE Parser",test:r=>/^.*=\s*masque/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function Dee(){return{name:"Surge HTTP/2 CONNECT Parser",test:r=>/^.*=\s*h2-connect/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function Fee(){return{name:"Surge SSH Parser",test:r=>/^.*=\s*ssh/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function Bee(){return{name:"Surge SS Parser",test:r=>/^.*=\s*ss/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function Iee(){return{name:"Surge VMess Parser",test:r=>/^.*=\s*vmess/.test(r.split(",")[0])&&r.indexOf("username")!==-1&&!e$.test(r),parse:r=>Gn().parse(r)}}function $ee(){return{name:"Surge VLESS Parser",test:r=>/^.*=\s*vless\s*$/.test(r.split(",")[0])&&/,\s*username\s*=/.test(r),parse:r=>Gn().parse(r)}}function xee(){return{name:"Surge Trojan Parser",test:r=>/^.*=\s*trojan/.test(r.split(",")[0])&&!/^[^=,]*=\s*trojan\s*,[^,]*,[^,]*,\s*"/.test(r),parse:r=>Gn().parse(r)}}var t$=/(^|,)\s*(fast-open|over-tls|tls-name|ip-mode|tls-cert-sha256|tls-pubkey-sha256|server-dns)\s*=/i;function Pee(){return{name:"Surge HTTP Parser",test:r=>/^.*=\s*https?/.test(r.split(",")[0])&&!t$.test(r),parse:r=>Gn().parse(r)}}function kee(){return{name:"Surge Socks5 Parser",test:r=>/^.*=\s*socks5(-tls)?/.test(r.split(",")[0])&&!t$.test(r),parse:r=>Gn().parse(r)}}function Tee(){return{name:"Surge External Parser",test:r=>/^.*=\s*external/.test(r.split(",")[0]),parse:r=>{let i=Gn().parse(r);return i.addresses=i.addresses.map(o=>o.trim().replace(/^\[/,"").replace(/\]$/,"")).filter(Uee),i}}}function Ree(){return{name:"Snell Parser",test:r=>/^[^=,]*=\s*(?:snell|opensnell)\s*,/i.test(r),parse:r=>{let i=r.match(/(?:[^",]+|"[^"]*")+/g).slice(3),o=/^(?:(?:udp|obfs-name|ip-mode|server-dns)\s*=|block-quic\s*=\s*(?:true|false)$)/;return(i[0]?.trim().startsWith('"')||i.some(a=>o.test(a.trim()))?Cs():Gn()).parse(r)}}}function Oee(){return{name:"Surge Tuic Parser",test:r=>/^.*=\s*tuic(-v5)?/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function Nee(){return{name:"Surge WireGuard Parser",test:r=>/^.*=\s*wireguard/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function Lee(){return{name:"Surge Hysteria2 Parser",test:r=>/^.*=\s*hysteria2/.test(r.split(",")[0]),parse:r=>Gn().parse(r)}}function Uee(e){return Sn(e)||Xt(e)}var n$=[MQ(),qQ(),jQ(),KQ(),VQ(),qS(),XQ(),ZQ(),YQ(),WQ(),JQ(),GQ(),zQ(),QQ(),Aee(),See(),Cee(),_ee(),Dee(),Fee(),Bee(),Iee(),$ee(),xee(),Pee(),Ree(),Oee(),Nee(),Lee(),kee(),Tee(),lee(),fee(),hee(),dee(),gee(),pee(),mee(),vee(),wee(),bee(),yee(),Eee(),eee(),tee(),nee(),ree(),see(),iee(),oee(),aee(),uee(),cee()];var Yye=B(x());var jS="https://api.github.com";function r$(e){let t;try{t=JSON.parse(e.body)}catch{}let n=t?.message?.error??t?.error??t?.message??e.body??"Unknown error";return`ERROR: HTTP ${e.statusCode}: ${n}`}function Hee(e,t=jS){return(String(e??"").trim()||t).replace(/\/+$/,"")}function Mee({githubApiUrl:e,githubProxy:t}={}){let n=Hee(e),r=n!==jS,i=String(t||"").trim().replace(/\/+$/,"");return r?n:`${i?`${i}/`:""}${jS}`}function s$(e={}){return!!e?.gistToken}var Sl=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=Js(),{defaultProxy,githubApiTimeout,githubProxy,githubApiUrl}=J.read(Jt)||{},githubApiRequestTimeout=githubApiTimeout||1e4,githubGistBaseURL=Mee({githubApiUrl,githubProxy}),proxy=defaultProxy;J.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=lo({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?fa(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(r$(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=lo({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?fa(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(r$(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]=(...n)=>new Promise((r,i)=>{this._requestQueue=this._requestQueue.then(()=>t.apply(this.http,n).then(r,i))}))}}async locate(){return this.syncPlatform==="gitlab"?this.http.get("/snippets").then(e=>{let t=JSON.parse(e.body);for(let n of t)if(n.title===this.key)return n}):this.http.get("/gists?per_page=100&page=1").then(e=>{let t=JSON.parse(e.body);J.info(`\u83B7\u53D6\u5230\u5F53\u524D GitHub \u7528\u6237\u7684 gist: ${t.length} \u4E2A`);for(let n of t)if(n.description===this.key)return n})}async upload(e,t={}){if(Object.keys(e).length===0)return Promise.reject("\u672A\u63D0\u4F9B\u9700\u4E0A\u4F20\u7684\u6587\u4EF6");let n=await this.locate(),r=e,i=t.emptyFileFallback,o=!!i?.filename,s={},a=async l=>{let h=await l;return Object.keys(s).length>0&&(h.subStoreUploadMeta=s),h},u=({actions:l,existingFiles:h,result:m})=>{if(!o)return;let p=i.filename,d=i.content??"",v=Object.keys(m).filter(g=>g!==p);Object.keys(m).length===0?(m[p]={content:d},s.emptyFileFallback={status:"created",filename:p},this.syncPlatform==="gitlab"?l.push({action:h[p]?"update":"create",file_path:p,content:d}):r[p]={content:d}):m[p]&&v.length>0?(delete m[p],s.emptyFileFallback={status:"removed",filename:p},this.syncPlatform==="gitlab"?l.push({action:"delete",file_path:p}):r[p]=null):m[p]&&v.length===0&&(s.emptyFileFallback={status:"retained",filename:p})};if(n?.id){this.syncPlatform==="gitlab"&&(n.files=n.files.reduce((m,p)=>(m[p.path]=p,m),{}));let l=[],h={...n.files};return Object.keys(r).map(m=>{h[m]?r[m].content==null||r[m].content===""?(delete h[m],r[m]=null,l.push({action:"delete",file_path:m})):(h[m]=r[m],l.push({action:"update",file_path:m,content:r[m].content})):r[m].content==null||r[m].content===""?(delete h[m],delete r[m]):(h[m]=r[m],l.push({action:"create",file_path:m,content:r[m].content}))}),u({actions:l,existingFiles:n.files,result:h}),this.syncPlatform==="gitlab"?Object.keys(h).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(h).length>10?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4 snippet \u7684\u6587\u4EF6\u6570\u8D85\u8FC7 10, \u65E0\u6CD5\u66F4\u65B0 snippet"):(r=l,a(this.http.put({headers:{...this.headers,"Content-Type":"application/json"},url:`/snippets/${n.id}`,body:JSON.stringify({files:r})}))):Object.keys(h).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/${n.id}`,headers:{...this.headers,"Accept-Encoding":"gzip, deflate, br"},body:JSON.stringify({files:r})}))}else return r=Object.entries(r).reduce((l,[h,m])=>(m.content!==null&&m.content!==""&&(l[h]=m),l),{}),this.syncPlatform==="gitlab"?Object.keys(r).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA snippet"):(r=Object.keys(r).map(l=>({file_path:l,content:r[l].content})),a(this.http.post({headers:{...this.headers,"Content-Type":"application/json"},url:"/snippets",body:JSON.stringify({title:this.key,visibility:"private",files:r})}))):Object.keys(r).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:r})}))}async download(e){let t=await this.locate();if(t?.id)try{let{files:n}=await this.http.get(`/gists/${t.id}`).then(i=>JSON.parse(i.body)),r=n[e].raw_url;return await this.http.get(r).then(i=>i.body)}catch(n){return Promise.reject(n)}else return Promise.reject(`\u627E\u4E0D\u5230 Sub-Store Gist (${this.key})`)}};var c$=B(RS());var qee={encrypt:Bg,decrypt:Ig,derivePublicKey:uI};function jee(e){for(let t of om)try{let n=t.test(e);if(n)return J.info(`Pre-processor [${t.name}] activated`),t.parse(e,!1,n)}catch(n){J.error(`Parser [${t.name}] failed
Reason: ${n}`)}return e}function Kee(e){e=jee(e);let t=e.split(`
`),n=[],r=o=>{for(let s of Array.isArray(o)?o:[o])n.push(Qee(s))},i;for(let o of t){if(o=o.trim(),o.length===0)continue;let s=!1;if(i){let[a,u]=a$(i,o);u||(r(a),s=!0)}if(!s)for(let a of n$){let[u,l]=a$(a,o);if(!l){r(u),i=a,s=!0,J.info(`${a.name} is activated`);break}}s||J.error(`Failed to parse line: ${o}`)}return n.filter(o=>{if(["vless","vmess"].includes(o.type))w1(o.uuid)||J.warn(`UUID may be invalid: ${o.name} ${o.uuid}`);else if(["hysteria2"].includes(o.type)&&o.obfs&&!o["obfs-password"])return J.error(`Proxy ${o.name} has obfs ${o.obfs} but missing obfs-password`),!1;return!0})}function l$(e,t){let n=t.process;if(!n||typeof n!="object")return!1;let{type:r,customNames:i}=n;if(!Array.isArray(i))return!1;let o=e.customName!=null&&i.includes(e.customName);return r==="disable"?o:r==="enable"?!o:!1}async function Vee(e,t=[],n,r,i,o,s={}){let a={};o!==void 0&&(a.raw=Array.isArray(o)||o!==null&&typeof o=="object"?o:[o]);for(let u of t){if(BA(u.type)){J.log(`Skipping response transformer during proxy/file processing: "${u.type}" with arguments:
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}if(l$(u,a)){J.info(`Skipping context-controlled operator: "${u.type}" with customName "${u.customName||""}"`);continue}if(u.disabled){J.log(`Skipping disabled operator: "${u.type}" with arguments:
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}let l,h={};if(u.type.indexOf("Script")!==-1&&({script:l,$arguments:h}=await f$(u,s)),!yp[u.type]){J.error(`Unknown operator: "${u.type}"`);continue}J.log(`Applying "${u.type}" with arguments:
>>> ${JSON.stringify(u.args,null,2)||"None"}`);let m;u.type.indexOf("Script")!==-1?m=yp[u.type](l,n,h,r,i,a):m=yp[u.type](u.args||{},s),e=await OI(m,e)}return e}async function Gee(e,t=[],n,r,i,o={}){let s={},a=i$(e);for(let u of t){if(!BA(u.type))continue;if(l$(u,s)){J.info(`Skipping context-controlled response transformer: "${u.type}" with customName "${u.customName||""}"`);continue}if(u.disabled){J.log(`Skipping disabled response transformer: "${u.type}" with arguments:
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}let{script:l,$arguments:h}=await f$(u,o);J.log(`Applying "${u.type}" with arguments:
>>> ${JSON.stringify(u.args,null,2)||"None"}`);let m=yp[u.type](l,n,h,r,i,s);a=i$(await RI(m,a))}return a}async function f$(item,executionContext={}){if(J.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 J.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 i of t[1].split("&")){let o=i.split("=")[0],s=i.split("=")[1];$arguments[o]=s==null||s===""?!0:decodeURIComponent(s)}}e=`${e.split("#")[0]}${t[2]?`#${t[2]}`:$arguments?.noCache!=null||$arguments?.insecure!=null?`#${t[1]}`:""}`;let n=e.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(n){let r="";try{r=n?.[1];let i=n?.[2];if(i==null)throw new Error(`\u672C\u5730 ${r} URL \u65E0\u6548: ${e}`);i=decodeURIComponent(i);let o=r==="module"?n1:Eu,s=xn(J.read(o),i);if(!s)throw new Error(`\u627E\u4E0D\u5230 ${r}: ${i}`);r==="module"?script=s.content:script=await Us({type:"file",name:i,noFlow:executionContext.noFlow})}catch(i){throw J.error(`Error when loading ${r}: ${item.args.content}.
Reason: ${i}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${r}: ${e}`)}}else if(e?.startsWith("/"))try{script=ao().readFileSync(e.split("#")[0],"utf8")}catch(r){throw J.error(`Error when reading local script: ${item.args.content}.
Reason: ${r}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u811A\u672C\u6587\u4EF6: ${e}`)}else try{script=await mi(e,void 0,void 0,void 0,void 0,void 0,void 0,void 0,{noFlow:executionContext.noFlow})}catch(r){throw J.error(`Error when downloading remote script: ${item.args.content}.
Reason: ${r}`),new Error(`\u65E0\u6CD5\u4E0B\u8F7D\u811A\u672C: ${e}`)}}else script=content,$arguments=item.args?.arguments||{};return{script,$arguments}}function i$(e={}){let t=e.header||e.headers||{};(!t||typeof t!="object")&&(t={});let n={status:e.status||e.statusCode||200,body:Object.prototype.hasOwnProperty.call(e,"body")?e.body:""};return Object.defineProperty(n,"headers",{enumerable:!0,get(){return t},set(r){t=r&&typeof r=="object"?r:{}}}),Object.defineProperty(n,"header",{enumerable:!0,get(){return t},set(r){t=r&&typeof r=="object"?r:{}}}),n}function o$(e){return e.replace(/[=,]/g,"").replace(/(^|\s)(?:[#;]|\/\/)+/g,"$1").trim()}function zee(e,t,n,r={}){let i=K9[t];if(!i)throw new Error(`Target platform: ${t} is not supported!`);let o=String(t).toLowerCase(),s=["surge","surgemac","surfboard"].includes(o);if(e=e.filter(a=>{if(!Ug(a,t))return!1;let u=r["include-unsupported-proxy"];if(!u&&a.supported&&a.supported[t]===!1)return!1;if(!u&&Wee(a)&&Yee(a)&&!Xee(a,t))return J.error(`Target platform ${t} does not support headers for ${Zee(a)} proxy ${a.name||`${a.server}:${a.port}`}. Proxy has been filtered.`),!1;if(!u&&Zf(a)&&!["qx","quantumultx","shadowrocket"].includes(o))return!1;if(["vless","vmess"].includes(a.type)){w1(a.uuid)||J.warn(`UUID may be invalid: ${a.name} ${a.uuid}`);let h=a.type==="vless",m=h?[["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&&!qe(v["public-key"])){if(d==="xhttp download-settings reality-opts"&&qe(a["reality-opts"]?.["public-key"])&&v["public-key"]==="")continue;return J.error(`Skipping VLESS Reality proxy ${a.name}: empty ${d}.public-key`),!1}let p=a["xhttp-opts"];if(h&&a.network==="xhttp"&&p?.mode==="stream-one"&&p["download-settings"])return J.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,s&&typeof a.name=="string"&&(a.name=o$(a.name)),qe(a.name)||(a.name=`${a.type} ${a.server}:${a.port}`),a["disable-sni"]&&(["surge","surgemac","shadowrocket"].includes(o)||o==="surfboard"&&a.type==="vless"?a.sni="off":!["tuic"].includes(a.type)&&!["sing-box","singbox"].includes(o)&&(J.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=g2(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=Qh(a.ports))),a.type==="wireguard"&&bp(a),a)),J.log(`Producing proxies for target: ${t}`),typeof i.type>"u"||i.type==="SINGLE"){let a=e.map(u=>{try{return i.produce(u,n,r)}catch(l){return J.error(`Cannot produce proxy: ${u.name}
Reason: ${l}`),""}}).filter(u=>u.length>0);return r._merged&&r.localPort>=1&&a.push(Sp().produce({name:o$(String(r._merged.name??""))||"mihomo merged",type:"external",udp:!0,exec:r._merged.exec,"local-port":r.localPort,args:["-config",bt.encode(JSON.stringify({...r._merged.config,...r._merged.configOverride||{},"mixed-port":r.localPort}))],addresses:[]},n,r)),a=n==="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(i.type==="ALL")return i.produce(e,n,r)}function Wee(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function Yee(e){return["http","h2-connect","trusttunnel"].includes(e?.type)}function Xee(e,t){let n=`${t}`.toLowerCase();return n.startsWith("surge")?["http","h2-connect","trusttunnel"].includes(e.type):n==="egern"||["clashmeta","clash.meta","meta","mihomo"].includes(n)||["singbox","sing-box"].includes(n)?e.type==="http":n==="json"?["http","h2-connect","trusttunnel"].includes(e.type):!1}function Zee(e){return e.type==="http"?e.tls?"HTTPS":"HTTP":e.type==="h2-connect"?"HTTP/2 CONNECT":e.type==="trusttunnel"?"TrustTunnel":e.type}var zt={parse:Kee,process:Vee,processResponse:Gee,produce:zee,age:qee,ipAddress:v1,getRandomPort:Qh,isIPv4:Sn,isIPv6:Xt,isIP:g2,yaml:Rs,getFlag:Vf,removeFlag:pp,getISO:cI,MMDB:xg,Gist:Sl,download:mi,downloadFile:h$,isValidUUID:w1,doh:AA,Buffer:m2.Buffer,Base64:bt,JSON5:c$.default,hex_md5:Ln};function a$(e,t){if(!Jee(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(n){return[null,n]}}function Jee(e,t){try{return e.test(t)}catch{return!1}}function u$(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function Qee(e){let t=(a,u)=>Object.prototype.hasOwnProperty.call(a,u),n=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]),n(e[u]))}let r=a=>{let u=a?.["reality-opts"];qe(u?.["public-key"])&&!t(u,"support-x25519mlkem768")&&["safari-ios-26","chrome147"].includes(`${a._loon_tls_profile||""}`.trim())&&(u["support-x25519mlkem768"]=!0)};if(r(e),e.network==="xhttp"&&r(e["xhttp-opts"]?.["download-settings"]),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=g_(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),h=parseInt(u[2],10);l>0&&l<=h?(e["hop-interval"]=l,e["hop-interval-max"]=h):(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),m_(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 i=e.type==="vless"&&e.network==="xhttp"?e["xhttp-opts"]?.["download-settings"]:void 0;i?.["shadow-tls-opts"]&&(i.plugin="shadow-tls",i["plugin-opts"]={host:i.servername,password:i["shadow-tls-opts"].password,version:i["shadow-tls-opts"].version},delete i["shadow-tls-opts"]),i?.plugin==="shadow-tls"&&i["plugin-opts"]&&(i.alpn&&!i["plugin-opts"].alpn&&(i["plugin-opts"].alpn=i.alpn),delete i.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=>u$(a)):o!=null&&(e[`${e.network}-opts`].path=u$(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&&!g2(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&&!g2(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=m2.Buffer.from(e.name.data).toString("utf8"):e.name=m2.Buffer.from(e.name).toString("utf8")}catch(a){J.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 s=e.ca_str;e["ca-str"]?s=e["ca-str"]:s&&(delete e.ca_str,e["ca-str"]=s);try{J.env.isNode&&!s&&e._ca&&(s=J.node.fs.readFileSync(e._ca,{encoding:"utf8"}))}catch(a){J.error(`Read ca file failed
Reason: ${a}`)}return!e["tls-fingerprint"]&&s&&(e["tls-fingerprint"]=lD.generateFingerprint(s)),["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)),bp(e)),e}function g2(e){return Sn(e)||Xt(e)}var bEe=B(x());function KS(){return oo(()=>wu("stream/promises"))}var d$=om.find(e=>e.name==="Clash Pre-processor"),VS=new Map;function ete(e=""){let t=`${e}`.trim();return t?new RegExp(t,"i"):null}function tte(e,t,n){if(!t||!n||typeof e!="string"||!/^https?:\/\//i.test(e))return e;let r=`${t}/`;if(e.startsWith(r))return e;let i;try{i=ete(n)}catch(o){return J.error(`GitHub \u52A0\u901F\u4EE3\u7406\u5339\u914D\u6B63\u5219\u65E0\u6548: ${o.message??o}`),e}return i?.test(e)?(J.info(`GitHub \u52A0\u901F\u4EE3\u7406\u547D\u4E2D\u4E0B\u8F7D\u94FE\u63A5: ${e}`),`${t}/${e}`):e}function nte(e){return Qu(e)}async function oh(e,{ageSecretKey:t,preprocess:n,url:r}){let i=t?await Ig(e,t):e,o=i;if(n)try{let s=d$.test(i);s&&(i=d$.parse(i,!0,s))}catch(s){J.error(`Clash Pre-processor error: ${s}`)}if(n)try{let s=zt.parse(i);if(!Array.isArray(s)||s.length===0)return{result:i,raw:o,shouldCache:!1,cacheReason:`URL ${r} \u4E0D\u5305\u542B\u6709\u6548\u8282\u70B9, \u4E0D\u7F13\u5B58`}}catch(s){return{result:i,raw:o,shouldCache:!1,cacheReason:`URL ${r} \u5C1D\u8BD5\u89E3\u6790\u8282\u70B9\u5931\u8D25 ${s.message??s}, \u4E0D\u7F13\u5B58`}}return{result:i,raw:o,shouldCache:!0}}function Np(e,t){return t?{result:e.result,raw:e.raw}:e.result}function GS(e,t){return t?{result:e,raw:e}:e}async function mi(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 n=t.split("=")[0],r=t.split("=")[1];$arguments[n]=r==null||r===""?!0:decodeURIComponent(r)}}let explicitAgeSecretKey=options&&typeof options=="object"?options?.[eA]||options?.ageSecretKey:void 0,returnRaw=options&&typeof options=="object"&&options.returnRaw,ageSecretKey=explicitAgeSecretKey||$arguments?.[eA],{isNode,isStash,isLoon,isShadowRocket,isQX}=Js(),{githubProxy,githubProxyRegex,defaultProxy,defaultUserAgent,defaultTimeout,cacheThreshold:defaultCacheThreshold}=J.read(Jt)||{},cacheThreshold=defaultCacheThreshold||1024,proxy=customProxy||defaultProxy;J.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 n in e)t[n.toLowerCase()]=e[n];customHeaders=t}}catch(e){J.error(`\u89E3\u6790\u81EA\u5B9A\u4E49 headers \u5931\u8D25: ${e}`)}let requestTimeout=timeout||defaultTimeout||8e3;url=tte(url,githubProxy,githubProxyRegex);let safeUrl=nte(url),id=Ln(`${customHeaders?JSON.stringify(customHeaders):userAgent}${url}`);$arguments?.cacheKey===!0&&(J.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=J.read(customCacheKey),t=Un.get(id);if(!noCache&&!$arguments?.noCache&&t)return J.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`),Np(await oh(t,{ageSecretKey,preprocess,url:safeUrl}),returnRaw);if(e){if(awaitCustomCache){J.info(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl}
\u672C\u6B21\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u66F4\u65B0\u7F13\u5B58`);try{await mi(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess,options)}catch(n){J.error(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl} \u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${n.message??n}`),J.info("\u4F7F\u7528\u4E50\u89C2\u7F13\u5B58\u7684\u6570\u636E\u5237\u65B0\u7F13\u5B58, \u9632\u6B62\u540E\u7EED\u8BF7\u6C42"),Un.set(id,e)}}else J.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`),mi(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess,options).catch(n=>{J.error(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl} \u5F02\u6B65\u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${n.message??n}`)});return Np(await oh(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 n=e==="module"?n1:Eu,r=xn(J.read(n),t);if(!r)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return GS(e==="module"?r.content:await Us({type:"file",name:t,noFlow:options?.noFlow}),returnRaw)}catch(t){throw J.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=ao();return GS(e.readFileSync(url.split("#")[0],"utf8"),returnRaw)}catch(e){throw J.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&&VS.has(id))return Np(await oh(await VS.get(id),{ageSecretKey,preprocess,url:safeUrl}),returnRaw);let http=lo({headers:{...customHeaders||{"User-Agent":userAgent},...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,rawResult,cached=Un.get(id);if(!noCache&&!$arguments?.noCache&&cached)J.info(`\u4F7F\u7528\u7F13\u5B58: ${safeUrl}, ${customHeaders?JSON.stringify(customHeaders):userAgent}`),rawResult=cached,result=await oh(cached,{ageSecretKey,preprocess,url:safeUrl}),customCacheKey&&(J.info(`URL ${safeUrl}
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),J.write(cached,customCacheKey));else{let e=$arguments?.insecure?isNode?{strictSSL:!1}:{insecure:!0}:void 0;J.info(`Downloading...
${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent}`}
Timeout: ${requestTimeout}
Proxy: ${proxy}
Insecure: ${!!e}
Preprocess: ${preprocess}
URL: ${safeUrl}`);try{let{body:t,headers:n,statusCode:r}=await Zl(()=>http.get({url,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?fa(proxy):{},...e||{}}),"download");if(J.info(`statusCode: ${r}`),r<200||r>=400)throw new Error(`statusCode: ${r}`);if(n){let o=Pc(n);o&&ed.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 oh(t,{ageSecretKey,preprocess,url:safeUrl});let i=!0;if(cacheThreshold){let o=t.length/1024;o>cacheThreshold&&(J.info(`\u8D44\u6E90\u5927\u5C0F ${o.toFixed(2)} KB \u8D85\u8FC7\u4E86 ${cacheThreshold} KB, \u4E0D\u7F13\u5B58`),i=!1)}result.shouldCache||(J.error(result.cacheReason),i=!1),i&&(Un.set(id,t,$arguments?.cacheTtl?$arguments?.cacheTtl*1e3:void 0),customCacheKey&&(J.info(`URL ${safeUrl}
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),J.write(t,customCacheKey))),rawResult=t}catch(t){if(customCacheKey){let r=J.read(customCacheKey);if(r)return J.info(`\u65E0\u6CD5\u4E0B\u8F7D URL ${safeUrl}: ${t.message??t}
\u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),Np(await oh(r,{ageSecretKey,preprocess,url:safeUrl}),returnRaw)}let n=`\u65E0\u6CD5\u4E0B\u8F7D URL ${safeUrl}: ${t.message??t}`;throw J.error(n),new Error(n)}}return $arguments?.validCheck&&!$arguments?.noFlow&&!options?.noFlow&&await b1(Jl(await E1(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl,$arguments.flowHeaders))),isNode||VS.set(id,rawResult),Np(result,returnRaw)}async function h$(url,file){let undici=eval("require('undici')"),fs=ao(),{pipeline}=KS(),{Agent,interceptors,request}=undici;J.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),J.info(`File downloaded from ${url} to ${file}`),file}var JEe=B(x());var MEe=B(x());function rte(){return{name:"HTML",test:r=>/^<!DOCTYPE html>/.test(r),parse:()=>""}}function ste(){return{name:"Clash Provider",test:r=>/^payload:/gm.exec(r).index>=0,parse:r=>r.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var p$=[rte(),ste()];var KEe=B(x());function ite(){return{type:"SINGLE",func:n=>["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL","GEOSITE","GEOIP"].indexOf(n.type)!==-1?null:`${{"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[n.type]||n.type},${n.content},SUB-STORE`}}function m$(){return{type:"SINGLE",func:n=>{if(["GEOSITE","GEOIP"].indexOf(n.type)!==-1)return null;let i=`${n.type},${n.content}`;return["IP-CIDR","IP-CIDR6"].includes(n.type)&&(i+=n.options?.length>0?`,${n.options.join(",")}`:""),i}}}function ote(){return{type:"SINGLE",func:n=>["SRC-IP","GEOSITE","GEOIP"].indexOf(n.type)!==-1?null:(["IP-CIDR","IP-CIDR6"].includes(n.type)&&n.options&&(n.options=n.options.filter(i=>["no-resolve"].includes(i))),m$().func(n))}}function ate(){return{type:"ALL",func:n=>{let r={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},i={payload:n.map(o=>{let s=`${r[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))),s+=o.options?.length>0?`,${o.options.join(",")}`:""),s})};return Rs.dump(i)}}}var g$={QX:ite(),Surge:m$(),Loon:ote(),Clash:ate()};var GEe=B(x()),ute=[[/^(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"]];function cte(){return{name:"Universal Rule Parser",test:()=>!0,parse:r=>{let i=r.split(`
`),o=[];for(let s of i)if(s=s.trim(),s.length!==0&&!/\s*#/.test(s))try{let a=s.split(",").map(h=>h.trim()),u=a[0],l=!1;for(let h of ute)if(h[0].test(u)){l=!0;let p={type:h[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: ${s}
Reason: ${a}`)}return o}}}var v$=[cte()];var v2=(function(){function e(r){for(let i of p$)try{if(i.test(r))return J.info(`Pre-processor [${i.name}] activated`),i.parse(r)}catch(o){J.error(`Parser [${i.name}] failed
Reason: ${o}`)}return r}function t(r){r=e(r);for(let i of v$){let o;try{o=i.test(r)}catch{o=!1}if(o)return J.info(`Rule parser [${i.name}] is activated!`),i.parse(r)}}function n(r,i){let o=g$[i];if(!o)throw new Error(`Target platform: ${i} is not supported!`);if(typeof o.type>"u"||o.type==="SINGLE")return r.map(s=>{try{return o.func(s)}catch(a){return console.log(`ERROR: cannot produce rule: ${JSON.stringify(s)}
Reason: ${a}`),""}}).filter(s=>s.length>0).join(`
`);if(o.type==="ALL")return o.func(r)}return{parse:t,produce:n}})();var Fbe=B(x());var nbe=B(x());var lbe=B(x());var pte=".sub-store-placeholder",mte=["Sub-Store placeholder","This file keeps the Gist alive when all sync configuration files are deleted."].join(`
`),gte=10;function y$(e){let t=Math.floor(Number(e));return!isFinite(t)||t<=0?gte:t}function vte(){return{filename:pte,content:mte}}async function E$(e,t={}){let{gistToken:n,syncPlatform:r}=J.read(Jt)||{};if(!n)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let i=wte(e);J.info(`\u51C6\u5907\u540C\u6B65 Gist: \u6587\u4EF6\u6570 ${i.count}, \u603B\u5927\u5C0F ${w2(i.totalBytes)}, \u6700\u5927\u6587\u4EF6 ${i.largestFilename||"-"} (${w2(i.largestBytes)})`);let o=new Sl({token:n,key:yC,syncPlatform:r}),s;try{s=await o.upload(e,{...t,emptyFileFallback:t.emptyFileFallback??vte()})}catch(h){throw J.error(`\u540C\u6B65 Gist \u8BF7\u6C42\u5931\u8D25: \u6587\u4EF6\u6570 ${i.count}, \u603B\u5927\u5C0F ${w2(i.totalBytes)}, \u6700\u5927\u6587\u4EF6 ${i.largestFilename||"-"} (${w2(i.largestBytes)}), \u539F\u56E0: ${h.message??h}`),h}let a={};try{a=JSON.parse(s.body)}catch{}let u=a?.html_url??a?.web_url,l=J.read(Jt)||{};return u?(J.log(`\u540C\u6B65 Gist \u540E, \u627E\u5230 Sub-Store Gist: ${u}`),l.artifactStore=u,l.artifactStoreStatus="VALID"):(J.error("\u540C\u6B65 Gist \u540E, \u627E\u4E0D\u5230 Sub-Store Gist"),l.artifactStoreStatus="NOT FOUND"),J.write(l,Jt),s}function wte(e){return Object.entries(e||{}).reduce((t,[n,r])=>{let i=r?.content;if(typeof i!="string")return t;let o=yte(i);return t.count++,t.totalBytes+=o,o>t.largestBytes&&(t.largestBytes=o,t.largestFilename=n),t},{count:0,totalBytes:0,largestBytes:0,largestFilename:""})}function yte(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e).length:unescape(encodeURIComponent(e)).length}function w2(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var $be=B(x());var Ete=new Set(["enabled","fallbackNotify"]),bte=new Set(["fallbackNotify","fallbackQuiet"]);function y2(e){return e===!0?"quiet":e===!1||e==null||e===""?"disabled":e}function E2(...e){for(let t of e)if(t!=null&&t!=="")return y2(t);return"disabled"}function b2(e){return Ete.has(y2(e))}function ah(e){return bte.has(y2(e))}function Lp({mode:e,message:t,notify:n}){let r=y2(e);if(r==="disabled"||ah(r))throw new Error(t);b2(r)&&n?.(t)}function A2({mode:e,notify:t,error:n}){b2(e)&&t?.(n)}function zS({platform:e="JSON",produceType:t,produceOpts:n={}}){return t==="raw"?JSON.stringify([]):zt.produce([],e,t,n)}var kbe=B(x());function Ate(e){return String(e??"").trim()}function Ste(...e){for(let t of e){let n=Ate(t?.[iI]);if(n)return n}return""}async function b$({body:e,res:t,configs:n=[]}){let r=Ste(...n);if(!r)return e;let i=await Bg(e??"",r);return t?.set&&t.set("Content-Type","text/plain; charset=utf-8"),i}var Cte=["localFirst","remoteFirst"],_te=["local","remote"],Dte=["collection","local","none","remote","subscription"];function Up(e){return Object.keys(e).map(Qu).join(", ")}function A$(e){return Cte.includes(e)}function Fte(e){return fl(e)?C$(e):e?.source}function C$(e){return Dte.includes(e?.sourceType)?e.sourceType:"collection"}function S2(e){return(Array.isArray(e)?e:[e]).flat()}function _$(e){return S2(e).filter(t=>t!=null&&t!=="").join(`
`)}function Bte(e,t){return t!=null&&t!==""?t:e.ignoreFailedRemoteFile}async function S$({file:e,sourceUrl:t,ua:n,proxy:r,noCache:i,noFlow:o,ignoreFailedRemoteFile:s,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 h=await Promise.all(l.map(async p=>{try{return await mi(p,n||e.ua,void 0,e.proxy||r,void 0,void 0,i||e.noCache,void 0,{noFlow:o})}catch(d){return u[p]=d,J.error(`\u6587\u4EF6 ${e.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Qu(p)} \u53D1\u751F\u9519\u8BEF: ${d}`),""}})),m=Bte(e,s);if(Object.keys(u).length>0)if(m)m==="enabled"&&J.notify(a,`\u274C ${e.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Up(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${e.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Up(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);return h}async function D$(e,{url:t,ua:n,content:r,mergeSources:i,ignoreFailedRemoteFile:o,proxy:s,noCache:a,noFlow:u,notifyTitle:l}={}){if(r&&!A$(i))return r;if(t){let m=await S$({file:e,sourceUrl:t,ua:n,proxy:s,noCache:a,noFlow:u,ignoreFailedRemoteFile:o,notifyTitle:l});return i==="localFirst"?m.unshift(r):i==="remoteFirst"&&m.push(r),m}if(Fte(e)==="local"&&!A$(e.mergeSources))return e.content;let h=await S$({file:e,sourceUrl:e.url,ua:n,proxy:s,noCache:a,noFlow:u,ignoreFailedRemoteFile:o,notifyTitle:l});return e.mergeSources==="localFirst"?h.unshift(e.content):e.mergeSources==="remoteFirst"&&h.push(e.content),h}async function Ite(e,t={}){let n={},r=C$(e);if(r==="none")return zt.yaml.safeDump(n);if(_te.includes(r)){let i=await D$(e,t);if(e?.mode!=="proxy")return _$(i);let o=S2(i).map(s=>zt.parse(s)).flat();if(o.length===0)throw new Error(`\u6587\u4EF6 ${e.name} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);n.proxies=zt.produce(o,"mihomo","internal",{"delete-underscore-fields":!0,"include-unsupported-proxy":e?.includeUnsupportedProxy})}else n.proxies=await Us({type:r,name:e?.sourceName,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0,"include-unsupported-proxy":e?.includeUnsupportedProxy},noFlow:t.noFlow});return zt.yaml.safeDump(n)}async function Us({type:e,name:t,platform:n,url:r,ua:i,content:o,mergeSources:s,ignoreFailedRemoteSub:a,ignoreFailedRemoteFile:u,produceType:l,produceOpts:h={},subscription:m,file:p,awaitCustomCache:d,$options:v,proxy:g,noCache:y,noFlow:w,all:E,includeRaw:C}){if(n=n||"JSON",["subscription","sub"].includes(e)){let _;if(t){let S=J.read(Cc);if(_=xn(S,t),!_)throw new Error(`\u627E\u4E0D\u5230\u8BA2\u9605 ${t}`)}else if(m)_=m;else throw new Error("\u672A\u63D0\u4F9B\u8BA2\u9605\u540D\u79F0\u6216\u8BA2\u9605\u6570\u636E");let F=E2(a,_.ignoreFailedRemoteSub),H=w||_.noFlow,K=[];try{let S;if(o&&!["localFirst","remoteFirst"].includes(s))S=o,K=o;else if(r){let T={},O=await Promise.all(r.split(/[\r\n]+/).map(R=>R.trim()).filter(R=>R.length).map(async R=>{try{return await mi(R,i||_.ua,void 0,g||_.proxy,void 0,d,y||_.noCache,!0,{returnRaw:!0,noFlow:H})}catch(N){return T[R]=N,J.error(`\u8BA2\u9605 ${_.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Qu(R)} \u53D1\u751F\u9519\u8BEF: ${N}`),""}}));if(S=O.map(R=>R.result??R),K=O.map(R=>R.raw??R),Object.keys(T).length>0){let R=`\u8BA2\u9605 ${_.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Up(T)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;Lp({mode:F,message:R,notify:()=>{J.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${_.name}`,R)}})}s==="localFirst"?(S.unshift(o),K.unshift(o)):s==="remoteFirst"&&(S.push(o),K.push(o))}else if(_.source==="local"&&!["localFirst","remoteFirst"].includes(_.mergeSources))S=_.content,K=_.content;else{let T={},O=await Promise.all(_.url.split(/[\r\n]+/).map(R=>R.trim()).filter(R=>R.length).map(async R=>{try{return await mi(R,i||_.ua,void 0,g||_.proxy,void 0,d,y||_.noCache,!0,{returnRaw:!0,noFlow:H})}catch(N){return T[R]=N,J.error(`\u8BA2\u9605 ${_.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Qu(R)} \u53D1\u751F\u9519\u8BEF: ${N}`),""}}));if(S=O.map(R=>R.result??R),K=O.map(R=>R.raw??R),Object.keys(T).length>0){let R=`\u8BA2\u9605 ${_.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Up(T)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;Lp({mode:F,message:R,notify:()=>{J.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${_.name}`,R)}})}_.mergeSources==="localFirst"?(S.unshift(_.content),K.unshift(_.content)):_.mergeSources==="remoteFirst"&&(S.push(_.content),K.push(_.content))}if(l==="raw"){let T=JSON.stringify((Array.isArray(S)?S:[S]).flat());return C?{result:T,raw:Array.isArray(K)?K:[K]}:T}let I=(Array.isArray(S)?S:[S]).map(T=>zt.parse(T)).flat();if(I.forEach(T=>{T._subName=_.name,T._subDisplayName=_.displayName}),I=await zt.process(I,_.process||[],n,{[_.name]:_},v,K,{noFlow:H}),I.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let q={};for(let T of I){if(q[T.name]){J.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${T.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}q[T.name]=!0}let L=zt.produce(I,n,l,h);return C?{result:L,raw:Array.isArray(K)?K:[K]}:L}catch(S){if(!ah(F))throw S;A2({mode:F,error:S,notify:q=>{J.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${_.name}`,`\u{1F914} \u539F\u56E0\uFF1A${q.message??q}`)}}),J.error(`\u8BA2\u9605 ${_.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${S.message??S}`);let I=zS({platform:n,produceType:l,produceOpts:h});return C?{result:I,raw:Array.isArray(K)?K:[K]}:I}}else if(["collection","col"].includes(e)){let _=J.read(Cc),F=J.read(zl),H=xn(F,t);if(!H)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let K=[...H.subscriptions],S=H.subscriptionTags;Array.isArray(S)&&S.length>0&&_.forEach(T=>{Array.isArray(T.tag)&&T.tag.length>0&&!K.includes(T.name)&&T.tag.some(O=>S.includes(O))&&K.push(T.name)});let I=E2(a,H.ignoreFailedRemoteSub),q=w||H.noFlow,L={};try{let T={},O={},R=0;if(await Promise.all(K.map(async Y=>{let V=xn(_,Y),X=E2(V.ignoreFailedRemoteSub),te=V.passThroughUA,ae=V.ua;te&&(J.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${i}`),ae=i);try{J.info(`\u6B63\u5728\u5904\u7406\u5B50\u8BA2\u9605\uFF1A${V.name}...`);let me,he;if(V.source==="local"&&!["localFirst","remoteFirst"].includes(V.mergeSources))me=V.content,he=V.content;else{let Ie={},se=await Promise.all(V.url.split(/[\r\n]+/).map(pe=>pe.trim()).filter(pe=>pe.length).map(async pe=>{try{return await mi(pe,ae,void 0,g||V.proxy||H.proxy,void 0,void 0,y||V.noCache,!0,{returnRaw:!0,noFlow:q||V.noFlow})}catch(Fe){return Ie[pe]=Fe,J.error(`\u8BA2\u9605 ${V.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Qu(pe)} \u53D1\u751F\u9519\u8BEF: ${Fe}`),""}}));if(me=se.map(pe=>pe.result??pe),he=se.map(pe=>pe.raw??pe),Object.keys(Ie).length>0){let pe=`\u8BA2\u9605 ${V.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Up(Ie)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;Lp({mode:X,message:pe,notify:()=>{J.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${V.name}`,pe)}})}V.mergeSources==="localFirst"?(me.unshift(V.content),he.unshift(V.content)):V.mergeSources==="remoteFirst"&&(me.push(V.content),he.push(V.content))}let De=(Array.isArray(me)?me:[me]).map(Ie=>zt.parse(Ie)).flat();De.forEach(Ie=>{Ie._subName=V.name,Ie._subDisplayName=V.displayName,Ie._collectionName=H.name,Ie._collectionDisplayName=H.displayName});let Pe=Array.isArray(he)?he:[he];De=await zt.process(De,V.process||[],n,{[V.name]:V,_collection:H,$options:v},void 0,Pe,{noFlow:q||V.noFlow}),T[Y]=De,L[Y]=Pe,R++,J.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${V.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(R/K.length).toFixed(1)}% `)}catch(me){if(R++,ah(X)){A2({mode:X,error:me,notify:he=>{J.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${V.name}`,`\u{1F914} \u539F\u56E0\uFF1A${he.message??he}`)}}),J.error(`\u8BA2\u9605 ${V.name} \u5728\u7EC4\u5408\u8BA2\u9605\u5904\u7406\u4E2D\u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${me.message??me}`),T[Y]=[],L[Y]=[];return}O[Y]=me,L[Y]=void 0,J.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${V.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${me}\uFF01\u8FDB\u5EA6--${100*(R/K.length).toFixed(1)}%`)}})),Object.keys(O).length>0){let Y=`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(O).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`,V=()=>{J.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,Y)};Object.keys(T).length>0&&ah(I)?(Object.keys(O).forEach(te=>{L[te]=[]}),b2(I)&&V()):Lp({mode:I,message:Y,notify:V})}let N=Array.prototype.concat.apply([],K.map(Y=>T[Y]||[]));if(N.forEach(Y=>{Y._collectionName=H.name,Y._collectionDisplayName=H.displayName}),N=await zt.process(N,H.process||[],n,{_collection:H},v,L,{noFlow:q}),N.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let P={};for(let Y of N){if(P[Y.name]){J.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${Y.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}P[Y.name]=!0}let M=zt.produce(N,n,l,h);return C?{result:M,raw:L}:M}catch(T){if(!ah(I))throw T;A2({mode:I,error:T,notify:R=>{J.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,`\u{1F914} \u539F\u56E0\uFF1A${R.message??R}`)}}),J.error(`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${T.message??T}`);let O=zS({platform:n,produceType:l,produceOpts:h});return C?{result:O,raw:L}:O}}else if(e==="rule"){let _=J.read(wC),F=xn(_,t);if(!F)throw new Error(`\u627E\u4E0D\u5230\u89C4\u5219 ${t}`);let H=[];for(let K=0;K<F.urls.length;K++){let S=F.urls[K];J.info(`\u6B63\u5728\u5904\u7406URL\uFF1A${S}\uFF0C\u8FDB\u5EA6--${100*((K+1)/F.urls.length).toFixed(1)}% `);try{let{body:I}=await mi(S),q=v2.parse(I);H=H.concat(q)}catch(I){J.error(`\u5904\u7406\u5206\u6D41\u8BA2\u9605\u4E2D\u7684URL: ${S}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${I}! \u8BE5\u8BA2\u9605\u5DF2\u88AB\u8DF3\u8FC7\u3002`)}}return H=await v2.process(H,[{type:"Remove Duplicate Filter"}]),v2.produce(H,n)}else if(e==="file"){let _=J.read(Eu),F=AI(p||xn(_,t));if(!F)throw new Error(`\u627E\u4E0D\u5230\u6587\u4EF6 ${t}`);let H="";if(fl(F)?H=await Ite(F,{url:r,ua:i,content:o,mergeSources:s,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}):H=await D$(F,{url:r,ua:i,content:o,mergeSources:s,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}),l==="raw")return JSON.stringify(S2(H));let K=S2(H),S=_$(K),I=Array.isArray(F.process)&&F.process.length>0?await zt.process({$files:K,$content:S,$options:v,$file:F},F.process,void 0,void 0,void 0,void 0,{noFlow:w}):{$content:S,$files:K,$options:v};return I.$content=im(I?.$content??""),(E?I:I?.$content)??""}}function $te(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function xte(e){return Array.isArray(e)?{isGitLab:!0,files:Object.fromEntries(e.map(t=>[t.path,t]))}:{isGitLab:!1,files:e||{}}}function Pte(e){delete e.history,delete e.forks,delete e.owner,e.files&&Object.values(e.files).forEach(t=>{delete t.content}),J.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),J.info(JSON.stringify(e,null,2))}function kte(e,t){let{files:n,isGitLab:r}=xte(e.files),i=encodeURIComponent(t),o=n[i]?.raw_url,s=r?o:o?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");return J.info(`\u4E0A\u4F20\u914D\u7F6E\u5B8C\u6210
\u6587\u4EF6\u5217\u8868: ${Object.keys(n).join(", ")}
\u5F53\u524D\u6587\u4EF6: ${i}
\u54CD\u5E94\u8FD4\u56DE\u7684\u539F\u59CB\u94FE\u63A5: ${o}
\u5904\u7406\u5B8C\u7684\u65B0\u94FE\u63A5: ${s}`),s}function WS(e){return e?.upload!==!1}function Tte(e){return e?.source?["subscription","sub"].includes(e.type)?xn(J.read(Cc),e.source):["collection","col"].includes(e.type)?xn(J.read(zl),e.source):e.type==="file"?xn(J.read(Eu),e.source):null:null}async function F$(e){let t=e.platform==="SurgeMac",n=await Us({type:e.type,name:e.source,platform:e.platform,produceOpts:{"include-unsupported-proxy":e.includeUnsupportedProxy,useMihomoExternal:t,prettyYaml:e.prettyYaml}});return b$({body:n,configs:[e,Tte(e)]})}function B$(e){e.updated=new Date().getTime(),delete e.url}async function I$({allArtifacts:e,files:t,valid:n,invalid:r}){let i=J.read(Jt)||{},o=y$(i.artifactSyncBatchSize),s=n.filter(l=>{let h=xn(e,l);return h&&WS(h)}),a=$te(s,o),u=[];if(s.length===0)return J.info("\u6CA1\u6709\u9700\u8981\u4E0A\u4F20\u7684\u540C\u6B65\u914D\u7F6E"),u;J.info(`\u51C6\u5907\u5206\u6279\u4E0A\u4F20\u540C\u6B65\u914D\u7F6E: \u5171 ${s.length} \u4E2A, \u6BCF\u6279 ${o} \u4E2A, \u6279\u6B21\u6570 ${a.length}`);for(let l=0;l<a.length;l++){let h=a[l],m=Object.fromEntries(h.map(p=>[encodeURIComponent(p),t[encodeURIComponent(p)]]));try{J.info(`\u6B63\u5728\u4E0A\u4F20\u7B2C ${l+1}/${a.length} \u6279\u540C\u6B65\u914D\u7F6E: ${h.join(", ")}`);let p=await E$(m),d=JSON.parse(p.body);Pte(d);for(let v of e)if(v.sync&&v.source&&h.includes(v.name)){let g=kte(d,v.name);g?(v.updated=new Date().getTime(),v.url=g,u.push(v.name)):(J.error(`\u540C\u6B65\u914D\u7F6E ${v.name} \u4E0A\u4F20\u6210\u529F\u4F46\u54CD\u5E94\u4E2D\u672A\u627E\u5230\u6587\u4EF6\u94FE\u63A5`),r.push(v.name))}}catch(p){J.error(`\u7B2C ${l+1}/${a.length} \u6279\u540C\u6B65\u914D\u7F6E\u4E0A\u4F20\u5931\u8D25: ${h.join(", ")}, \u539F\u56E0: ${p.message??p}`),r.push(...h)}}return u}var Qbe=B(x());function YS(e){return e?.upload!==!1}function $$({artifacts:e=[],settings:t={}}={}){let n=s$(t),r=e.some(s=>s.sync),i=e.some(s=>s.sync&&YS(s)),o=e.some(s=>s.sync&&!YS(s));return{canUpload:n||!i,shouldRun:r&&(n||o)}}function XS(e,{canUpload:t}){return!t&&YS(e)}(async function(){let e;typeof $argument<"u"?e=Rte($argument):e={};let t=(e?.subscription??e?.sub??"").split(/,|,/g).map(r=>r.trim()).filter(r=>r.length>0).map(r=>decodeURIComponent(r)),n=(e?.collection??e?.col??"").split(/,|,/g).map(r=>r.trim()).filter(r=>r.length>0).map(r=>decodeURIComponent(r));if(t.length>0||n.length>0)t.length>0&&await x$(t,"subscription"),n.length>0&&await x$(n,"collection");else{let r=J.read(Jt)||{},i=J.read(oa);if(!i||i.length===0)return;let o=$$({artifacts:i,settings:r});o.shouldRun&&await Nte(e,o)}})().finally(()=>J.done());function Rte(e){return e==null?{}:typeof e=="object"?e:Object.fromEntries(`${e}`.split("&").filter(Boolean).map(t=>{let[n,...r]=t.split("=");return[n,r.join("=")]}))}function Ote(e,t=!0){if(e==null||e==="")return t;let n=`${e}`.trim().replace(/^["']|["']$/g,"").toLowerCase();return!["false","0","no","off"].includes(n)}async function x$(e,t){try{e.length>0&&(J.info(`produceArtifacts ${t} \u5F00\u59CB: ${e.join(", ")}`),await Promise.all(e.map(async n=>{try{await Us({type:t,name:n})}catch(r){J.error(`${t} ${n} error: ${r.message??r}`)}})),J.info(`produceArtifacts ${t} \u5B8C\u6210: ${e.join(", ")}`))}catch(n){J.error(`produceArtifacts error: ${n.message??n}`)}}async function Nte(e={},{canUpload:t=!0}={}){let n=Ote(e.sync_success_notify);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 Sync -- v${t1}
\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
`),J.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");let r=J.read(oa),i={};try{let o=[],s=[],a=[],u=[],l=J.read(Cc),h=J.read(zl),m=[],p=0;if(r.map(g=>{if(g.sync&&g.source){if(p++,XS(g,{canUpload:t}))return;if(g.type==="subscription"){let y=g.source,w=xn(l,y);w&&w.url&&!m.includes(y)&&m.push(y)}else if(g.type==="collection"){let y=xn(h,g.source);y&&Array.isArray(y.subscriptions)&&y.subscriptions.map(w=>{let E=xn(l,w);E&&E.url&&!m.includes(w)&&m.push(w)})}}}),p===0){J.info(`\u9700\u540C\u6B65\u7684\u914D\u7F6E: ${p}, \u603B\u6570: ${r.length}`);return}m.length>0&&await Promise.all(m.map(async g=>{try{await Us({type:"subscription",name:g,awaitCustomCache:!0})}catch{}})),await Promise.all(r.map(async g=>{try{if(g.sync&&g.source){if(XS(g,{canUpload:t})){u.push(g.name);return}J.info(`\u6B63\u5728\u540C\u6B65\u4E91\u914D\u7F6E\uFF1A${g.name}...`),g.platform==="SurgeMac"&&J.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 mihomo External");let w=await F$(g);WS(g)?(i[encodeURIComponent(g.name)]={content:w},o.push(g.name)):(B$(g),a.push(g.name))}}catch(y){J.error(`\u751F\u6210\u540C\u6B65\u914D\u7F6E ${g.name} \u53D1\u751F\u9519\u8BEF: ${y.message??y}`),s.push(g.name)}}));let d=o.length+a.length;if(J.info(`${d} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u6210\u529F: ${o.concat(a).join(", ")}`),J.info(`${s.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u5931\u8D25: ${s.join(", ")}`),a.length>0&&J.info(`${a.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u4EC5\u751F\u6210\u672A\u4E0A\u4F20: ${a.join(", ")}`),u.length>0&&J.info(`${u.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u56E0\u672A\u8BBE\u7F6E GitHub Token \u5DF2\u8DF3\u8FC7\u4E0A\u4F20: ${u.join(", ")}`),d===0)throw new Error(`\u540C\u6B65\u914D\u7F6E ${s.join(", ")} \u751F\u6210\u5931\u8D25 \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`);let v=await I$({allArtifacts:r,files:i,valid:o,invalid:s});J.write(r,oa),J.info("\u540C\u6B65\u914D\u7F6E\u6267\u884C\u5B8C\u6210"),s.length>0?J.notify("\u{1F30D} Sub-Store",`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${v.length+a.length} \u4E2A, \u5931\u8D25 ${s.length} \u4E2A${u.length?`, \u8DF3\u8FC7 ${u.length} \u4E2A\u9700\u4E0A\u4F20\u914D\u7F6E`:""}, \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`):n&&J.notify("\u{1F30D} Sub-Store","\u540C\u6B65\u914D\u7F6E\u5B8C\u6210",u.length?`\u5DF2\u8DF3\u8FC7 ${u.length} \u4E2A\u9700\u4E0A\u4F20\u914D\u7F6E\uFF08\u672A\u8BBE\u7F6E GitHub Token\uFF09`:void 0)}catch(o){J.notify("\u{1F30D} Sub-Store","\u540C\u6B65\u914D\u7F6E\u5931\u8D25",`\u539F\u56E0\uFF1A${o.message??o}`),J.error(`\u65E0\u6CD5\u540C\u6B65\u914D\u7F6E\u5230 Gist\uFF0C\u539F\u56E0\uFF1A${o.stack??o.message??o}`)}}})();
/*! Bundled license information:
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
*)
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
*)
@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) *)
*/