Files
Sub-Store/sub-store.no-bundle.js
github-actions[bot] 0fe9da6e02 release: 2.20.2
2025-08-08 04:46:50 +00:00

1188 lines
972 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 nS=Object.create;var pm=Object.defineProperty;var iS=Object.getOwnPropertyDescriptor;var sS=Object.getOwnPropertyNames;var uS=Object.getPrototypeOf,aS=Object.prototype.hasOwnProperty;var Ba=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var oS=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sS(t))!aS.call(e,i)&&i!==r&&pm(e,i,{get:()=>t[i],enumerable:!(n=iS(t,i))||n.enumerable});return e};var Zr=(e,t,r)=>(r=e!=null?nS(uS(e)):{},oS(t||!e||!e.__esModule?pm(r,"default",{value:e,enumerable:!0}):r,e));var xc=Se((_o,Nc)=>{(function(){var e,t="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",u="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",o=500,l="__lodash_placeholder__",f=1,p=2,E=4,d=1,h=2,w=1,m=2,y=4,A=8,C=16,S=32,B=64,I=128,M=256,q=512,b=30,R="...",L=800,j=16,G=1,Y=2,V=3,z=1/0,J=9007199254740991,se=17976931348623157e292,De=NaN,ye=4294967295,Pe=ye-1,Qe=ye>>>1,ce=[["ary",I],["bind",w],["bindKey",m],["curry",A],["curryRight",C],["flip",q],["partial",S],["partialRight",B],["rearg",M]],Be="[object Arguments]",Ge="[object Array]",Tr="[object AsyncFunction]",Jt="[object Boolean]",St="[object Date]",wr="[object DOMException]",cr="[object Error]",vt="[object Function]",Xt="[object GeneratorFunction]",at="[object Map]",Je="[object Number]",lr="[object Null]",Ve="[object Object]",Lt="[object Promise]",un="[object Proxy]",ir="[object RegExp]",Zt="[object Set]",wt="[object String]",Or="[object Symbol]",pi="[object Undefined]",an="[object WeakMap]",It="[object WeakSet]",qe="[object ArrayBuffer]",_e="[object DataView]",Cr="[object Float32Array]",on="[object Float64Array]",ot="[object Int8Array]",Ks="[object Int16Array]",cn="[object Int32Array]",ge="[object Uint8Array]",cs="[object Uint8ClampedArray]",Tt="[object Uint16Array]",Yr="[object Uint32Array]",Ji=/\b__p \+= '';/g,Pu=/\b(__p \+=) '' \+/g,ls=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ru=/&(?:amp|lt|gt|quot|#39);/g,hs=/[&<>"']/g,Xi=RegExp(Ru.source),Ut=RegExp(hs.source),zn=/<%-([\s\S]+?)%>/g,Tu=/<%([\s\S]+?)%>/g,Ou=/<%=([\s\S]+?)%>/g,Nu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ps=/^\w*$/,ca=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ds=/[\\^$.*+?()[\]{}|]/g,la=RegExp(ds.source),Vs=/^\s+/,re=/\s/,fe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,je=/\{\n\/\* \[wrapped with (.+)\] \*/,xe=/,? & /,We=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/[()=,{}\[\]\/\s]/,gt=/\\(\\)?/g,Br=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Kt=/\w*$/,Yn=/^[-+]0x[0-9a-f]+$/i,Ti=/^0b[01]+$/i,ln=/^\[object .+?Constructor\]$/,An=/^0o[0-7]+$/i,yr=/^(?:0|[1-9]\d*)$/,fn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Mr=/($^)/,fa=/['\n\r\u2028\u2029\\]/g,gs="\\ud800-\\udfff",Rn="\\u0300-\\u036f",xt="\\ufe20-\\ufe2f",Fr="\\u20d0-\\u20ff",it=Rn+xt+Fr,fr="\\u2700-\\u27bf",Wr="a-z\\xdf-\\xf6\\xf8-\\xff",hr="\\xac\\xb1\\xd7\\xf7",Vt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Tn="\\u2000-\\u206f",Wn=" \\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",Jn="A-Z\\xc0-\\xd6\\xd8-\\xde",On="\\ufe0e\\ufe0f",Nr=hr+Vt+Tn+Wn,dr="['\u2019]",lc="["+gs+"]",ha="["+Nr+"]",Jr="["+it+"]",pa="\\d+",eo="["+fr+"]",to="["+Wr+"]",da="[^"+gs+Nr+pa+fr+Wr+Jn+"]",vs="\\ud83c[\\udffb-\\udfff]",ga="(?:"+Jr+"|"+vs+")",ro="[^"+gs+"]",ma="(?:\\ud83c[\\udde6-\\uddff]){2}",va="[\\ud800-\\udbff][\\udc00-\\udfff]",Nn="["+Jn+"]",T="\\u200d",N="(?:"+to+"|"+da+")",H="(?:"+Nn+"|"+da+")",Q="(?:"+dr+"(?:d|ll|m|re|s|t|ve))?",ve="(?:"+dr+"(?:D|LL|M|RE|S|T|VE))?",we=ga+"?",$e="["+On+"]?",Ne="(?:"+T+"(?:"+[ro,ma,va].join("|")+")"+$e+we+")*",Qt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Dr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",hn=$e+we+Ne,pn="(?:"+[eo,ma,va].join("|")+")"+hn,di="(?:"+[ro+Jr+"?",Jr,ma,va,lc].join("|")+")",xu=RegExp(dr,"g"),xn=RegExp(Jr,"g"),dn=RegExp(vs+"(?="+vs+")|"+di+hn,"g"),ku=RegExp([Nn+"?"+to+"+"+Q+"(?="+[ha,Nn,"$"].join("|")+")",H+"+"+ve+"(?="+[ha,Nn+N,"$"].join("|")+")",Nn+"?"+N+"+"+Q,Nn+"+"+ve,Dr,Qt,pa,pn].join("|"),"g"),Oi=RegExp("["+T+gs+it+On+"]"),Ea=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Lh=["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"],Uh=-1,sr={};sr[Cr]=sr[on]=sr[ot]=sr[Ks]=sr[cn]=sr[ge]=sr[cs]=sr[Tt]=sr[Yr]=!0,sr[Be]=sr[Ge]=sr[qe]=sr[Jt]=sr[_e]=sr[St]=sr[cr]=sr[vt]=sr[at]=sr[Je]=sr[Ve]=sr[ir]=sr[Zt]=sr[wt]=sr[an]=!1;var rr={};rr[Be]=rr[Ge]=rr[qe]=rr[_e]=rr[Jt]=rr[St]=rr[Cr]=rr[on]=rr[ot]=rr[Ks]=rr[cn]=rr[at]=rr[Je]=rr[Ve]=rr[ir]=rr[Zt]=rr[wt]=rr[Or]=rr[ge]=rr[cs]=rr[Tt]=rr[Yr]=!0,rr[cr]=rr[vt]=rr[an]=!1;var Hh={\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"},jh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Mh={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},qh={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Kh=parseFloat,Vh=parseInt,ml=typeof global=="object"&&global&&global.Object===Object&&global,Gh=typeof self=="object"&&self&&self.Object===Object&&self,xr=ml||Gh||Function("return this")(),fc=typeof _o=="object"&&_o&&!_o.nodeType&&_o,Gs=fc&&typeof Nc=="object"&&Nc&&!Nc.nodeType&&Nc,vl=Gs&&Gs.exports===fc,hc=vl&&ml.process,Xn=function(){try{var ne=Gs&&Gs.require&&Gs.require("util").types;return ne||hc&&hc.binding&&hc.binding("util")}catch{}}(),El=Xn&&Xn.isArrayBuffer,Al=Xn&&Xn.isDate,wl=Xn&&Xn.isMap,Cl=Xn&&Xn.isRegExp,yl=Xn&&Xn.isSet,Fl=Xn&&Xn.isTypedArray;function kn(ne,he,oe){switch(oe.length){case 0:return ne.call(he);case 1:return ne.call(he,oe[0]);case 2:return ne.call(he,oe[0],oe[1]);case 3:return ne.call(he,oe[0],oe[1],oe[2])}return ne.apply(he,oe)}function zh(ne,he,oe,Le){for(var st=-1,Bt=ne==null?0:ne.length;++st<Bt;){var vr=ne[st];he(Le,vr,oe(vr),ne)}return Le}function Zn(ne,he){for(var oe=-1,Le=ne==null?0:ne.length;++oe<Le&&he(ne[oe],oe,ne)!==!1;);return ne}function P(ne,he){for(var oe=ne==null?0:ne.length;oe--&&he(ne[oe],oe,ne)!==!1;);return ne}function lt(ne,he){for(var oe=-1,Le=ne==null?0:ne.length;++oe<Le;)if(!he(ne[oe],oe,ne))return!1;return!0}function gi(ne,he){for(var oe=-1,Le=ne==null?0:ne.length,st=0,Bt=[];++oe<Le;){var vr=ne[oe];he(vr,oe,ne)&&(Bt[st++]=vr)}return Bt}function Ln(ne,he){var oe=ne==null?0:ne.length;return!!oe&&Lu(ne,he,0)>-1}function Aa(ne,he,oe){for(var Le=-1,st=ne==null?0:ne.length;++Le<st;)if(oe(he,ne[Le]))return!0;return!1}function te(ne,he){for(var oe=-1,Le=ne==null?0:ne.length,st=Array(Le);++oe<Le;)st[oe]=he(ne[oe],oe,ne);return st}function mi(ne,he){for(var oe=-1,Le=he.length,st=ne.length;++oe<Le;)ne[st+oe]=he[oe];return ne}function pc(ne,he,oe,Le){var st=-1,Bt=ne==null?0:ne.length;for(Le&&Bt&&(oe=ne[++st]);++st<Bt;)oe=he(oe,ne[st],st,ne);return oe}function I1(ne,he,oe,Le){var st=ne==null?0:ne.length;for(Le&&st&&(oe=ne[--st]);st--;)oe=he(oe,ne[st],st,ne);return oe}function Dl(ne,he){for(var oe=-1,Le=ne==null?0:ne.length;++oe<Le;)if(he(ne[oe],oe,ne))return!0;return!1}var mr=zs("length");function B1(ne){return ne.split("")}function dc(ne){return ne.match(We)||[]}function Xe(ne,he,oe){var Le;return oe(ne,function(st,Bt,vr){if(he(st,Bt,vr))return Le=Bt,!1}),Le}function kr(ne,he,oe,Le){for(var st=ne.length,Bt=oe+(Le?1:-1);Le?Bt--:++Bt<st;)if(he(ne[Bt],Bt,ne))return Bt;return-1}function Lu(ne,he,oe){return he===he?$l(ne,he,oe):kr(ne,Ni,oe)}function Yh(ne,he,oe,Le){for(var st=oe-1,Bt=ne.length;++st<Bt;)if(Le(ne[st],he))return st;return-1}function Ni(ne){return ne!==ne}function gc(ne,he){var oe=ne==null?0:ne.length;return oe?no(ne,he)/oe:De}function zs(ne){return function(he){return he==null?e:he[ne]}}function me(ne){return function(he){return ne==null?e:ne[he]}}function Sl(ne,he,oe,Le,st){return st(ne,function(Bt,vr,er){oe=Le?(Le=!1,Bt):he(oe,Bt,vr,er)}),oe}function bl(ne,he){var oe=ne.length;for(ne.sort(he);oe--;)ne[oe]=ne[oe].value;return ne}function no(ne,he){for(var oe,Le=-1,st=ne.length;++Le<st;){var Bt=he(ne[Le]);Bt!==e&&(oe=oe===e?Bt:oe+Bt)}return oe}function mc(ne,he){for(var oe=-1,Le=Array(ne);++oe<ne;)Le[oe]=he(oe);return Le}function Wh(ne,he){return te(he,function(oe){return[oe,ne[oe]]})}function vc(ne){return ne&&ne.slice(0,uo(ne)+1).replace(Vs,"")}function wn(ne){return function(he){return ne(he)}}function wa(ne,he){return te(he,function(oe){return ne[oe]})}function Ca(ne,he){return ne.has(he)}function io(ne,he){for(var oe=-1,Le=ne.length;++oe<Le&&Lu(he,ne[oe],0)>-1;);return oe}function _l(ne,he){for(var oe=ne.length;oe--&&Lu(he,ne[oe],0)>-1;);return oe}function Il(ne,he){for(var oe=ne.length,Le=0;oe--;)ne[oe]===he&&++Le;return Le}var Ec=me(Hh),Jh=me(jh);function Bl(ne){return"\\"+qh[ne]}function Xh(ne,he){return ne==null?e:ne[he]}function Ys(ne){return Oi.test(ne)}function Zh(ne){return Ea.test(ne)}function Qh(ne){for(var he,oe=[];!(he=ne.next()).done;)oe.push(he.value);return oe}function Ac(ne){var he=-1,oe=Array(ne.size);return ne.forEach(function(Le,st){oe[++he]=[st,Le]}),oe}function gn(ne,he){return function(oe){return ne(he(oe))}}function vi(ne,he){for(var oe=-1,Le=ne.length,st=0,Bt=[];++oe<Le;){var vr=ne[oe];(vr===he||vr===l)&&(ne[oe]=l,Bt[st++]=oe)}return Bt}function Ei(ne){var he=-1,oe=Array(ne.size);return ne.forEach(function(Le){oe[++he]=Le}),oe}function so(ne){var he=-1,oe=Array(ne.size);return ne.forEach(function(Le){oe[++he]=[Le,Le]}),oe}function $l(ne,he,oe){for(var Le=oe-1,st=ne.length;++Le<st;)if(ne[Le]===he)return Le;return-1}function e0(ne,he,oe){for(var Le=oe+1;Le--;)if(ne[Le]===he)return Le;return Le}function Ws(ne){return Ys(ne)?Rl(ne):mr(ne)}function Qn(ne){return Ys(ne)?t0(ne):B1(ne)}function uo(ne){for(var he=ne.length;he--&&re.test(ne.charAt(he)););return he}var Pl=me(Mh);function Rl(ne){for(var he=dn.lastIndex=0;dn.test(ne);)++he;return he}function t0(ne){return ne.match(dn)||[]}function r0(ne){return ne.match(ku)||[]}var n0=function ne(he){he=he==null?xr:xi.defaults(xr.Object(),he,xi.pick(xr,Lh));var oe=he.Array,Le=he.Date,st=he.Error,Bt=he.Function,vr=he.Math,er=he.Object,ao=he.RegExp,i0=he.String,ei=he.TypeError,oo=oe.prototype,Tl=Bt.prototype,Js=er.prototype,Zi=he["__core-js_shared__"],co=Tl.toString,Ot=Js.hasOwnProperty,s0=0,lo=function(){var a=/[^.]+$/.exec(Zi&&Zi.keys&&Zi.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}(),fo=Js.toString,u0=co.call(er),a0=xr._,o0=ao("^"+co.call(Ot).replace(ds,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ho=vl?he.Buffer:e,Es=he.Symbol,po=he.Uint8Array,Ol=ho?ho.allocUnsafe:e,go=gn(er.getPrototypeOf,er),Nl=er.create,xl=Js.propertyIsEnumerable,jt=oo.splice,kl=Es?Es.isConcatSpreadable:e,Xs=Es?Es.iterator:e,Zs=Es?Es.toStringTag:e,mo=function(){try{var a=ba(er,"defineProperty");return a({},"",{}),a}catch{}}(),F=he.clearTimeout!==xr.clearTimeout&&he.clearTimeout,x=Le&&Le.now!==xr.Date.now&&Le.now,X=he.setTimeout!==xr.setTimeout&&he.setTimeout,K=vr.ceil,ue=vr.floor,le=er.getOwnPropertySymbols,tr=ho?ho.isBuffer:e,Sr=he.isFinite,uC=oo.join,aC=gn(er.keys,er),qr=vr.max,Cn=vr.min,oC=Le.now,cC=he.parseInt,$1=vr.random,lC=oo.reverse,c0=ba(he,"DataView"),wc=ba(he,"Map"),l0=ba(he,"Promise"),vo=ba(he,"Set"),Cc=ba(he,"WeakMap"),yc=ba(er,"create"),Ll=Cc&&new Cc,Eo={},fC=_a(c0),hC=_a(wc),pC=_a(l0),dC=_a(vo),gC=_a(Cc),Ul=Es?Es.prototype:e,Fc=Ul?Ul.valueOf:e,P1=Ul?Ul.toString:e;function k(a){if(br(a)&&!ht(a)&&!(a instanceof bt)){if(a instanceof ki)return a;if(Ot.call(a,"__wrapped__"))return Rg(a)}return new ki(a)}var Ao=function(){function a(){}return function(c){if(!Er(c))return{};if(Nl)return Nl(c);a.prototype=c;var v=new a;return a.prototype=e,v}}();function Hl(){}function ki(a,c){this.__wrapped__=a,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=e}k.templateSettings={escape:zn,evaluate:Tu,interpolate:Ou,variable:"",imports:{_:k}},k.prototype=Hl.prototype,k.prototype.constructor=k,ki.prototype=Ao(Hl.prototype),ki.prototype.constructor=ki;function bt(a){this.__wrapped__=a,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ye,this.__views__=[]}function mC(){var a=new bt(this.__wrapped__);return a.__actions__=ti(this.__actions__),a.__dir__=this.__dir__,a.__filtered__=this.__filtered__,a.__iteratees__=ti(this.__iteratees__),a.__takeCount__=this.__takeCount__,a.__views__=ti(this.__views__),a}function vC(){if(this.__filtered__){var a=new bt(this);a.__dir__=-1,a.__filtered__=!0}else a=this.clone(),a.__dir__*=-1;return a}function EC(){var a=this.__wrapped__.value(),c=this.__dir__,v=ht(a),D=c<0,O=v?a.length:0,U=$y(0,O,this.__views__),W=U.start,Z=U.end,ie=Z-W,Ee=D?Z:W-1,Ae=this.__iteratees__,Ce=Ae.length,Re=0,Ke=Cn(ie,this.__takeCount__);if(!v||!D&&O==ie&&Ke==ie)return tg(a,this.__actions__);var rt=[];e:for(;ie--&&Re<Ke;){Ee+=c;for(var At=-1,nt=a[Ee];++At<Ce;){var Dt=Ae[At],$t=Dt.iteratee,Ci=Dt.type,jn=$t(nt);if(Ci==Y)nt=jn;else if(!jn){if(Ci==G)continue e;break e}}rt[Re++]=nt}return rt}bt.prototype=Ao(Hl.prototype),bt.prototype.constructor=bt;function ya(a){var c=-1,v=a==null?0:a.length;for(this.clear();++c<v;){var D=a[c];this.set(D[0],D[1])}}function AC(){this.__data__=yc?yc(null):{},this.size=0}function wC(a){var c=this.has(a)&&delete this.__data__[a];return this.size-=c?1:0,c}function CC(a){var c=this.__data__;if(yc){var v=c[a];return v===s?e:v}return Ot.call(c,a)?c[a]:e}function yC(a){var c=this.__data__;return yc?c[a]!==e:Ot.call(c,a)}function FC(a,c){var v=this.__data__;return this.size+=this.has(a)?0:1,v[a]=yc&&c===e?s:c,this}ya.prototype.clear=AC,ya.prototype.delete=wC,ya.prototype.get=CC,ya.prototype.has=yC,ya.prototype.set=FC;function Qs(a){var c=-1,v=a==null?0:a.length;for(this.clear();++c<v;){var D=a[c];this.set(D[0],D[1])}}function DC(){this.__data__=[],this.size=0}function SC(a){var c=this.__data__,v=jl(c,a);if(v<0)return!1;var D=c.length-1;return v==D?c.pop():jt.call(c,v,1),--this.size,!0}function bC(a){var c=this.__data__,v=jl(c,a);return v<0?e:c[v][1]}function _C(a){return jl(this.__data__,a)>-1}function IC(a,c){var v=this.__data__,D=jl(v,a);return D<0?(++this.size,v.push([a,c])):v[D][1]=c,this}Qs.prototype.clear=DC,Qs.prototype.delete=SC,Qs.prototype.get=bC,Qs.prototype.has=_C,Qs.prototype.set=IC;function eu(a){var c=-1,v=a==null?0:a.length;for(this.clear();++c<v;){var D=a[c];this.set(D[0],D[1])}}function BC(){this.size=0,this.__data__={hash:new ya,map:new(wc||Qs),string:new ya}}function $C(a){var c=Ql(this,a).delete(a);return this.size-=c?1:0,c}function PC(a){return Ql(this,a).get(a)}function RC(a){return Ql(this,a).has(a)}function TC(a,c){var v=Ql(this,a),D=v.size;return v.set(a,c),this.size+=v.size==D?0:1,this}eu.prototype.clear=BC,eu.prototype.delete=$C,eu.prototype.get=PC,eu.prototype.has=RC,eu.prototype.set=TC;function Fa(a){var c=-1,v=a==null?0:a.length;for(this.__data__=new eu;++c<v;)this.add(a[c])}function OC(a){return this.__data__.set(a,s),this}function NC(a){return this.__data__.has(a)}Fa.prototype.add=Fa.prototype.push=OC,Fa.prototype.has=NC;function Qi(a){var c=this.__data__=new Qs(a);this.size=c.size}function xC(){this.__data__=new Qs,this.size=0}function kC(a){var c=this.__data__,v=c.delete(a);return this.size=c.size,v}function LC(a){return this.__data__.get(a)}function UC(a){return this.__data__.has(a)}function HC(a,c){var v=this.__data__;if(v instanceof Qs){var D=v.__data__;if(!wc||D.length<r-1)return D.push([a,c]),this.size=++v.size,this;v=this.__data__=new eu(D)}return v.set(a,c),this.size=v.size,this}Qi.prototype.clear=xC,Qi.prototype.delete=kC,Qi.prototype.get=LC,Qi.prototype.has=UC,Qi.prototype.set=HC;function R1(a,c){var v=ht(a),D=!v&&Ia(a),O=!v&&!D&&qu(a),U=!v&&!D&&!O&&Fo(a),W=v||D||O||U,Z=W?mc(a.length,i0):[],ie=Z.length;for(var Ee in a)(c||Ot.call(a,Ee))&&!(W&&(Ee=="length"||O&&(Ee=="offset"||Ee=="parent")||U&&(Ee=="buffer"||Ee=="byteLength"||Ee=="byteOffset")||iu(Ee,ie)))&&Z.push(Ee);return Z}function T1(a){var c=a.length;return c?a[C0(0,c-1)]:e}function jC(a,c){return ef(ti(a),Da(c,0,a.length))}function MC(a){return ef(ti(a))}function f0(a,c,v){(v!==e&&!es(a[c],v)||v===e&&!(c in a))&&tu(a,c,v)}function Dc(a,c,v){var D=a[c];(!(Ot.call(a,c)&&es(D,v))||v===e&&!(c in a))&&tu(a,c,v)}function jl(a,c){for(var v=a.length;v--;)if(es(a[v][0],c))return v;return-1}function qC(a,c,v,D){return Uu(a,function(O,U,W){c(D,O,v(O),W)}),D}function O1(a,c){return a&&ws(c,Xr(c),a)}function KC(a,c){return a&&ws(c,ni(c),a)}function tu(a,c,v){c=="__proto__"&&mo?mo(a,c,{configurable:!0,enumerable:!0,value:v,writable:!0}):a[c]=v}function h0(a,c){for(var v=-1,D=c.length,O=oe(D),U=a==null;++v<D;)O[v]=U?e:G0(a,c[v]);return O}function Da(a,c,v){return a===a&&(v!==e&&(a=a<=v?a:v),c!==e&&(a=a>=c?a:c)),a}function Li(a,c,v,D,O,U){var W,Z=c&f,ie=c&p,Ee=c&E;if(v&&(W=O?v(a,D,O,U):v(a)),W!==e)return W;if(!Er(a))return a;var Ae=ht(a);if(Ae){if(W=Ry(a),!Z)return ti(a,W)}else{var Ce=yn(a),Re=Ce==vt||Ce==Xt;if(qu(a))return ig(a,Z);if(Ce==Ve||Ce==Be||Re&&!O){if(W=ie||Re?{}:Fg(a),!Z)return ie?Cy(a,KC(W,a)):wy(a,O1(W,a))}else{if(!rr[Ce])return O?a:{};W=Ty(a,Ce,Z)}}U||(U=new Qi);var Ke=U.get(a);if(Ke)return Ke;U.set(a,W),Zg(a)?a.forEach(function(nt){W.add(Li(nt,c,v,nt,a,U))}):Jg(a)&&a.forEach(function(nt,Dt){W.set(Dt,Li(nt,c,v,Dt,a,U))});var rt=Ee?ie?R0:P0:ie?ni:Xr,At=Ae?e:rt(a);return Zn(At||a,function(nt,Dt){At&&(Dt=nt,nt=a[Dt]),Dc(W,Dt,Li(nt,c,v,Dt,a,U))}),W}function VC(a){var c=Xr(a);return function(v){return N1(v,a,c)}}function N1(a,c,v){var D=v.length;if(a==null)return!D;for(a=er(a);D--;){var O=v[D],U=c[O],W=a[O];if(W===e&&!(O in a)||!U(W))return!1}return!0}function x1(a,c,v){if(typeof a!="function")throw new ei(i);return Pc(function(){a.apply(e,v)},c)}function Sc(a,c,v,D){var O=-1,U=Ln,W=!0,Z=a.length,ie=[],Ee=c.length;if(!Z)return ie;v&&(c=te(c,wn(v))),D?(U=Aa,W=!1):c.length>=r&&(U=Ca,W=!1,c=new Fa(c));e:for(;++O<Z;){var Ae=a[O],Ce=v==null?Ae:v(Ae);if(Ae=D||Ae!==0?Ae:0,W&&Ce===Ce){for(var Re=Ee;Re--;)if(c[Re]===Ce)continue e;ie.push(Ae)}else U(c,Ce,D)||ie.push(Ae)}return ie}var Uu=cg(As),k1=cg(d0,!0);function GC(a,c){var v=!0;return Uu(a,function(D,O,U){return v=!!c(D,O,U),v}),v}function Ml(a,c,v){for(var D=-1,O=a.length;++D<O;){var U=a[D],W=c(U);if(W!=null&&(Z===e?W===W&&!wi(W):v(W,Z)))var Z=W,ie=U}return ie}function zC(a,c,v,D){var O=a.length;for(v=Et(v),v<0&&(v=-v>O?0:O+v),D=D===e||D>O?O:Et(D),D<0&&(D+=O),D=v>D?0:em(D);v<D;)a[v++]=c;return a}function L1(a,c){var v=[];return Uu(a,function(D,O,U){c(D,O,U)&&v.push(D)}),v}function mn(a,c,v,D,O){var U=-1,W=a.length;for(v||(v=Ny),O||(O=[]);++U<W;){var Z=a[U];c>0&&v(Z)?c>1?mn(Z,c-1,v,D,O):mi(O,Z):D||(O[O.length]=Z)}return O}var p0=lg(),U1=lg(!0);function As(a,c){return a&&p0(a,c,Xr)}function d0(a,c){return a&&U1(a,c,Xr)}function ql(a,c){return gi(c,function(v){return su(a[v])})}function Sa(a,c){c=ju(c,a);for(var v=0,D=c.length;a!=null&&v<D;)a=a[Cs(c[v++])];return v&&v==D?a:e}function H1(a,c,v){var D=c(a);return ht(a)?D:mi(D,v(a))}function Un(a){return a==null?a===e?pi:lr:Zs&&Zs in er(a)?By(a):My(a)}function g0(a,c){return a>c}function YC(a,c){return a!=null&&Ot.call(a,c)}function WC(a,c){return a!=null&&c in er(a)}function JC(a,c,v){return a>=Cn(c,v)&&a<qr(c,v)}function m0(a,c,v){for(var D=v?Aa:Ln,O=a[0].length,U=a.length,W=U,Z=oe(U),ie=1/0,Ee=[];W--;){var Ae=a[W];W&&c&&(Ae=te(Ae,wn(c))),ie=Cn(Ae.length,ie),Z[W]=!v&&(c||O>=120&&Ae.length>=120)?new Fa(W&&Ae):e}Ae=a[0];var Ce=-1,Re=Z[0];e:for(;++Ce<O&&Ee.length<ie;){var Ke=Ae[Ce],rt=c?c(Ke):Ke;if(Ke=v||Ke!==0?Ke:0,!(Re?Ca(Re,rt):D(Ee,rt,v))){for(W=U;--W;){var At=Z[W];if(!(At?Ca(At,rt):D(a[W],rt,v)))continue e}Re&&Re.push(rt),Ee.push(Ke)}}return Ee}function XC(a,c,v,D){return As(a,function(O,U,W){c(D,v(O),U,W)}),D}function bc(a,c,v){c=ju(c,a),a=_g(a,c);var D=a==null?a:a[Cs(Hi(c))];return D==null?e:kn(D,a,v)}function j1(a){return br(a)&&Un(a)==Be}function ZC(a){return br(a)&&Un(a)==qe}function QC(a){return br(a)&&Un(a)==St}function _c(a,c,v,D,O){return a===c?!0:a==null||c==null||!br(a)&&!br(c)?a!==a&&c!==c:ey(a,c,v,D,_c,O)}function ey(a,c,v,D,O,U){var W=ht(a),Z=ht(c),ie=W?Ge:yn(a),Ee=Z?Ge:yn(c);ie=ie==Be?Ve:ie,Ee=Ee==Be?Ve:Ee;var Ae=ie==Ve,Ce=Ee==Ve,Re=ie==Ee;if(Re&&qu(a)){if(!qu(c))return!1;W=!0,Ae=!1}if(Re&&!Ae)return U||(U=new Qi),W||Fo(a)?wg(a,c,v,D,O,U):_y(a,c,ie,v,D,O,U);if(!(v&d)){var Ke=Ae&&Ot.call(a,"__wrapped__"),rt=Ce&&Ot.call(c,"__wrapped__");if(Ke||rt){var At=Ke?a.value():a,nt=rt?c.value():c;return U||(U=new Qi),O(At,nt,v,D,U)}}return Re?(U||(U=new Qi),Iy(a,c,v,D,O,U)):!1}function ty(a){return br(a)&&yn(a)==at}function v0(a,c,v,D){var O=v.length,U=O,W=!D;if(a==null)return!U;for(a=er(a);O--;){var Z=v[O];if(W&&Z[2]?Z[1]!==a[Z[0]]:!(Z[0]in a))return!1}for(;++O<U;){Z=v[O];var ie=Z[0],Ee=a[ie],Ae=Z[1];if(W&&Z[2]){if(Ee===e&&!(ie in a))return!1}else{var Ce=new Qi;if(D)var Re=D(Ee,Ae,ie,a,c,Ce);if(!(Re===e?_c(Ae,Ee,d|h,D,Ce):Re))return!1}}return!0}function M1(a){if(!Er(a)||ky(a))return!1;var c=su(a)?o0:ln;return c.test(_a(a))}function ry(a){return br(a)&&Un(a)==ir}function ny(a){return br(a)&&yn(a)==Zt}function iy(a){return br(a)&&af(a.length)&&!!sr[Un(a)]}function q1(a){return typeof a=="function"?a:a==null?ii:typeof a=="object"?ht(a)?G1(a[0],a[1]):V1(a):fm(a)}function E0(a){if(!$c(a))return aC(a);var c=[];for(var v in er(a))Ot.call(a,v)&&v!="constructor"&&c.push(v);return c}function sy(a){if(!Er(a))return jy(a);var c=$c(a),v=[];for(var D in a)D=="constructor"&&(c||!Ot.call(a,D))||v.push(D);return v}function A0(a,c){return a<c}function K1(a,c){var v=-1,D=ri(a)?oe(a.length):[];return Uu(a,function(O,U,W){D[++v]=c(O,U,W)}),D}function V1(a){var c=O0(a);return c.length==1&&c[0][2]?Sg(c[0][0],c[0][1]):function(v){return v===a||v0(v,a,c)}}function G1(a,c){return x0(a)&&Dg(c)?Sg(Cs(a),c):function(v){var D=G0(v,a);return D===e&&D===c?z0(v,a):_c(c,D,d|h)}}function Kl(a,c,v,D,O){a!==c&&p0(c,function(U,W){if(O||(O=new Qi),Er(U))uy(a,c,W,v,Kl,D,O);else{var Z=D?D(L0(a,W),U,W+"",a,c,O):e;Z===e&&(Z=U),f0(a,W,Z)}},ni)}function uy(a,c,v,D,O,U,W){var Z=L0(a,v),ie=L0(c,v),Ee=W.get(ie);if(Ee){f0(a,v,Ee);return}var Ae=U?U(Z,ie,v+"",a,c,W):e,Ce=Ae===e;if(Ce){var Re=ht(ie),Ke=!Re&&qu(ie),rt=!Re&&!Ke&&Fo(ie);Ae=ie,Re||Ke||rt?ht(Z)?Ae=Z:$r(Z)?Ae=ti(Z):Ke?(Ce=!1,Ae=ig(ie,!0)):rt?(Ce=!1,Ae=sg(ie,!0)):Ae=[]:Rc(ie)||Ia(ie)?(Ae=Z,Ia(Z)?Ae=tm(Z):(!Er(Z)||su(Z))&&(Ae=Fg(ie))):Ce=!1}Ce&&(W.set(ie,Ae),O(Ae,ie,D,U,W),W.delete(ie)),f0(a,v,Ae)}function z1(a,c){var v=a.length;if(v)return c+=c<0?v:0,iu(c,v)?a[c]:e}function Y1(a,c,v){c.length?c=te(c,function(U){return ht(U)?function(W){return Sa(W,U.length===1?U[0]:U)}:U}):c=[ii];var D=-1;c=te(c,wn(et()));var O=K1(a,function(U,W,Z){var ie=te(c,function(Ee){return Ee(U)});return{criteria:ie,index:++D,value:U}});return bl(O,function(U,W){return Ay(U,W,v)})}function ay(a,c){return W1(a,c,function(v,D){return z0(a,D)})}function W1(a,c,v){for(var D=-1,O=c.length,U={};++D<O;){var W=c[D],Z=Sa(a,W);v(Z,W)&&Ic(U,ju(W,a),Z)}return U}function oy(a){return function(c){return Sa(c,a)}}function w0(a,c,v,D){var O=D?Yh:Lu,U=-1,W=c.length,Z=a;for(a===c&&(c=ti(c)),v&&(Z=te(a,wn(v)));++U<W;)for(var ie=0,Ee=c[U],Ae=v?v(Ee):Ee;(ie=O(Z,Ae,ie,D))>-1;)Z!==a&&jt.call(Z,ie,1),jt.call(a,ie,1);return a}function J1(a,c){for(var v=a?c.length:0,D=v-1;v--;){var O=c[v];if(v==D||O!==U){var U=O;iu(O)?jt.call(a,O,1):D0(a,O)}}return a}function C0(a,c){return a+ue($1()*(c-a+1))}function cy(a,c,v,D){for(var O=-1,U=qr(K((c-a)/(v||1)),0),W=oe(U);U--;)W[D?U:++O]=a,a+=v;return W}function y0(a,c){var v="";if(!a||c<1||c>J)return v;do c%2&&(v+=a),c=ue(c/2),c&&(a+=a);while(c);return v}function Ct(a,c){return U0(bg(a,c,ii),a+"")}function ly(a){return T1(Do(a))}function fy(a,c){var v=Do(a);return ef(v,Da(c,0,v.length))}function Ic(a,c,v,D){if(!Er(a))return a;c=ju(c,a);for(var O=-1,U=c.length,W=U-1,Z=a;Z!=null&&++O<U;){var ie=Cs(c[O]),Ee=v;if(ie==="__proto__"||ie==="constructor"||ie==="prototype")return a;if(O!=W){var Ae=Z[ie];Ee=D?D(Ae,ie,Z):e,Ee===e&&(Ee=Er(Ae)?Ae:iu(c[O+1])?[]:{})}Dc(Z,ie,Ee),Z=Z[ie]}return a}var X1=Ll?function(a,c){return Ll.set(a,c),a}:ii,hy=mo?function(a,c){return mo(a,"toString",{configurable:!0,enumerable:!1,value:W0(c),writable:!0})}:ii;function py(a){return ef(Do(a))}function Ui(a,c,v){var D=-1,O=a.length;c<0&&(c=-c>O?0:O+c),v=v>O?O:v,v<0&&(v+=O),O=c>v?0:v-c>>>0,c>>>=0;for(var U=oe(O);++D<O;)U[D]=a[D+c];return U}function dy(a,c){var v;return Uu(a,function(D,O,U){return v=c(D,O,U),!v}),!!v}function Vl(a,c,v){var D=0,O=a==null?D:a.length;if(typeof c=="number"&&c===c&&O<=Qe){for(;D<O;){var U=D+O>>>1,W=a[U];W!==null&&!wi(W)&&(v?W<=c:W<c)?D=U+1:O=U}return O}return F0(a,c,ii,v)}function F0(a,c,v,D){var O=0,U=a==null?0:a.length;if(U===0)return 0;c=v(c);for(var W=c!==c,Z=c===null,ie=wi(c),Ee=c===e;O<U;){var Ae=ue((O+U)/2),Ce=v(a[Ae]),Re=Ce!==e,Ke=Ce===null,rt=Ce===Ce,At=wi(Ce);if(W)var nt=D||rt;else Ee?nt=rt&&(D||Re):Z?nt=rt&&Re&&(D||!Ke):ie?nt=rt&&Re&&!Ke&&(D||!At):Ke||At?nt=!1:nt=D?Ce<=c:Ce<c;nt?O=Ae+1:U=Ae}return Cn(U,Pe)}function Z1(a,c){for(var v=-1,D=a.length,O=0,U=[];++v<D;){var W=a[v],Z=c?c(W):W;if(!v||!es(Z,ie)){var ie=Z;U[O++]=W===0?0:W}}return U}function Q1(a){return typeof a=="number"?a:wi(a)?De:+a}function Ai(a){if(typeof a=="string")return a;if(ht(a))return te(a,Ai)+"";if(wi(a))return P1?P1.call(a):"";var c=a+"";return c=="0"&&1/a==-z?"-0":c}function Hu(a,c,v){var D=-1,O=Ln,U=a.length,W=!0,Z=[],ie=Z;if(v)W=!1,O=Aa;else if(U>=r){var Ee=c?null:Sy(a);if(Ee)return Ei(Ee);W=!1,O=Ca,ie=new Fa}else ie=c?[]:Z;e:for(;++D<U;){var Ae=a[D],Ce=c?c(Ae):Ae;if(Ae=v||Ae!==0?Ae:0,W&&Ce===Ce){for(var Re=ie.length;Re--;)if(ie[Re]===Ce)continue e;c&&ie.push(Ce),Z.push(Ae)}else O(ie,Ce,v)||(ie!==Z&&ie.push(Ce),Z.push(Ae))}return Z}function D0(a,c){return c=ju(c,a),a=_g(a,c),a==null||delete a[Cs(Hi(c))]}function eg(a,c,v,D){return Ic(a,c,v(Sa(a,c)),D)}function Gl(a,c,v,D){for(var O=a.length,U=D?O:-1;(D?U--:++U<O)&&c(a[U],U,a););return v?Ui(a,D?0:U,D?U+1:O):Ui(a,D?U+1:0,D?O:U)}function tg(a,c){var v=a;return v instanceof bt&&(v=v.value()),pc(c,function(D,O){return O.func.apply(O.thisArg,mi([D],O.args))},v)}function S0(a,c,v){var D=a.length;if(D<2)return D?Hu(a[0]):[];for(var O=-1,U=oe(D);++O<D;)for(var W=a[O],Z=-1;++Z<D;)Z!=O&&(U[O]=Sc(U[O]||W,a[Z],c,v));return Hu(mn(U,1),c,v)}function rg(a,c,v){for(var D=-1,O=a.length,U=c.length,W={};++D<O;){var Z=D<U?c[D]:e;v(W,a[D],Z)}return W}function b0(a){return $r(a)?a:[]}function _0(a){return typeof a=="function"?a:ii}function ju(a,c){return ht(a)?a:x0(a,c)?[a]:Pg(Gt(a))}var gy=Ct;function Mu(a,c,v){var D=a.length;return v=v===e?D:v,!c&&v>=D?a:Ui(a,c,v)}var ng=F||function(a){return xr.clearTimeout(a)};function ig(a,c){if(c)return a.slice();var v=a.length,D=Ol?Ol(v):new a.constructor(v);return a.copy(D),D}function I0(a){var c=new a.constructor(a.byteLength);return new po(c).set(new po(a)),c}function my(a,c){var v=c?I0(a.buffer):a.buffer;return new a.constructor(v,a.byteOffset,a.byteLength)}function vy(a){var c=new a.constructor(a.source,Kt.exec(a));return c.lastIndex=a.lastIndex,c}function Ey(a){return Fc?er(Fc.call(a)):{}}function sg(a,c){var v=c?I0(a.buffer):a.buffer;return new a.constructor(v,a.byteOffset,a.length)}function ug(a,c){if(a!==c){var v=a!==e,D=a===null,O=a===a,U=wi(a),W=c!==e,Z=c===null,ie=c===c,Ee=wi(c);if(!Z&&!Ee&&!U&&a>c||U&&W&&ie&&!Z&&!Ee||D&&W&&ie||!v&&ie||!O)return 1;if(!D&&!U&&!Ee&&a<c||Ee&&v&&O&&!D&&!U||Z&&v&&O||!W&&O||!ie)return-1}return 0}function Ay(a,c,v){for(var D=-1,O=a.criteria,U=c.criteria,W=O.length,Z=v.length;++D<W;){var ie=ug(O[D],U[D]);if(ie){if(D>=Z)return ie;var Ee=v[D];return ie*(Ee=="desc"?-1:1)}}return a.index-c.index}function ag(a,c,v,D){for(var O=-1,U=a.length,W=v.length,Z=-1,ie=c.length,Ee=qr(U-W,0),Ae=oe(ie+Ee),Ce=!D;++Z<ie;)Ae[Z]=c[Z];for(;++O<W;)(Ce||O<U)&&(Ae[v[O]]=a[O]);for(;Ee--;)Ae[Z++]=a[O++];return Ae}function og(a,c,v,D){for(var O=-1,U=a.length,W=-1,Z=v.length,ie=-1,Ee=c.length,Ae=qr(U-Z,0),Ce=oe(Ae+Ee),Re=!D;++O<Ae;)Ce[O]=a[O];for(var Ke=O;++ie<Ee;)Ce[Ke+ie]=c[ie];for(;++W<Z;)(Re||O<U)&&(Ce[Ke+v[W]]=a[O++]);return Ce}function ti(a,c){var v=-1,D=a.length;for(c||(c=oe(D));++v<D;)c[v]=a[v];return c}function ws(a,c,v,D){var O=!v;v||(v={});for(var U=-1,W=c.length;++U<W;){var Z=c[U],ie=D?D(v[Z],a[Z],Z,v,a):e;ie===e&&(ie=a[Z]),O?tu(v,Z,ie):Dc(v,Z,ie)}return v}function wy(a,c){return ws(a,N0(a),c)}function Cy(a,c){return ws(a,Cg(a),c)}function zl(a,c){return function(v,D){var O=ht(v)?zh:qC,U=c?c():{};return O(v,a,et(D,2),U)}}function wo(a){return Ct(function(c,v){var D=-1,O=v.length,U=O>1?v[O-1]:e,W=O>2?v[2]:e;for(U=a.length>3&&typeof U=="function"?(O--,U):e,W&&Hn(v[0],v[1],W)&&(U=O<3?e:U,O=1),c=er(c);++D<O;){var Z=v[D];Z&&a(c,Z,D,U)}return c})}function cg(a,c){return function(v,D){if(v==null)return v;if(!ri(v))return a(v,D);for(var O=v.length,U=c?O:-1,W=er(v);(c?U--:++U<O)&&D(W[U],U,W)!==!1;);return v}}function lg(a){return function(c,v,D){for(var O=-1,U=er(c),W=D(c),Z=W.length;Z--;){var ie=W[a?Z:++O];if(v(U[ie],ie,U)===!1)break}return c}}function yy(a,c,v){var D=c&w,O=Bc(a);function U(){var W=this&&this!==xr&&this instanceof U?O:a;return W.apply(D?v:this,arguments)}return U}function fg(a){return function(c){c=Gt(c);var v=Ys(c)?Qn(c):e,D=v?v[0]:c.charAt(0),O=v?Mu(v,1).join(""):c.slice(1);return D[a]()+O}}function Co(a){return function(c){return pc(cm(om(c).replace(xu,"")),a,"")}}function Bc(a){return function(){var c=arguments;switch(c.length){case 0:return new a;case 1:return new a(c[0]);case 2:return new a(c[0],c[1]);case 3:return new a(c[0],c[1],c[2]);case 4:return new a(c[0],c[1],c[2],c[3]);case 5:return new a(c[0],c[1],c[2],c[3],c[4]);case 6:return new a(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new a(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var v=Ao(a.prototype),D=a.apply(v,c);return Er(D)?D:v}}function Fy(a,c,v){var D=Bc(a);function O(){for(var U=arguments.length,W=oe(U),Z=U,ie=yo(O);Z--;)W[Z]=arguments[Z];var Ee=U<3&&W[0]!==ie&&W[U-1]!==ie?[]:vi(W,ie);if(U-=Ee.length,U<v)return mg(a,c,Yl,O.placeholder,e,W,Ee,e,e,v-U);var Ae=this&&this!==xr&&this instanceof O?D:a;return kn(Ae,this,W)}return O}function hg(a){return function(c,v,D){var O=er(c);if(!ri(c)){var U=et(v,3);c=Xr(c),v=function(Z){return U(O[Z],Z,O)}}var W=a(c,v,D);return W>-1?O[U?c[W]:W]:e}}function pg(a){return nu(function(c){var v=c.length,D=v,O=ki.prototype.thru;for(a&&c.reverse();D--;){var U=c[D];if(typeof U!="function")throw new ei(i);if(O&&!W&&Zl(U)=="wrapper")var W=new ki([],!0)}for(D=W?D:v;++D<v;){U=c[D];var Z=Zl(U),ie=Z=="wrapper"?T0(U):e;ie&&k0(ie[0])&&ie[1]==(I|A|S|M)&&!ie[4].length&&ie[9]==1?W=W[Zl(ie[0])].apply(W,ie[3]):W=U.length==1&&k0(U)?W[Z]():W.thru(U)}return function(){var Ee=arguments,Ae=Ee[0];if(W&&Ee.length==1&&ht(Ae))return W.plant(Ae).value();for(var Ce=0,Re=v?c[Ce].apply(this,Ee):Ae;++Ce<v;)Re=c[Ce].call(this,Re);return Re}})}function Yl(a,c,v,D,O,U,W,Z,ie,Ee){var Ae=c&I,Ce=c&w,Re=c&m,Ke=c&(A|C),rt=c&q,At=Re?e:Bc(a);function nt(){for(var Dt=arguments.length,$t=oe(Dt),Ci=Dt;Ci--;)$t[Ci]=arguments[Ci];if(Ke)var jn=yo(nt),yi=Il($t,jn);if(D&&($t=ag($t,D,O,Ke)),U&&($t=og($t,U,W,Ke)),Dt-=yi,Ke&&Dt<Ee){var Pr=vi($t,jn);return mg(a,c,Yl,nt.placeholder,v,$t,Pr,Z,ie,Ee-Dt)}var ts=Ce?v:this,au=Re?ts[a]:a;return Dt=$t.length,Z?$t=qy($t,Z):rt&&Dt>1&&$t.reverse(),Ae&&ie<Dt&&($t.length=ie),this&&this!==xr&&this instanceof nt&&(au=At||Bc(au)),au.apply(ts,$t)}return nt}function dg(a,c){return function(v,D){return XC(v,a,c(D),{})}}function Wl(a,c){return function(v,D){var O;if(v===e&&D===e)return c;if(v!==e&&(O=v),D!==e){if(O===e)return D;typeof v=="string"||typeof D=="string"?(v=Ai(v),D=Ai(D)):(v=Q1(v),D=Q1(D)),O=a(v,D)}return O}}function B0(a){return nu(function(c){return c=te(c,wn(et())),Ct(function(v){var D=this;return a(c,function(O){return kn(O,D,v)})})})}function Jl(a,c){c=c===e?" ":Ai(c);var v=c.length;if(v<2)return v?y0(c,a):c;var D=y0(c,K(a/Ws(c)));return Ys(c)?Mu(Qn(D),0,a).join(""):D.slice(0,a)}function Dy(a,c,v,D){var O=c&w,U=Bc(a);function W(){for(var Z=-1,ie=arguments.length,Ee=-1,Ae=D.length,Ce=oe(Ae+ie),Re=this&&this!==xr&&this instanceof W?U:a;++Ee<Ae;)Ce[Ee]=D[Ee];for(;ie--;)Ce[Ee++]=arguments[++Z];return kn(Re,O?v:this,Ce)}return W}function gg(a){return function(c,v,D){return D&&typeof D!="number"&&Hn(c,v,D)&&(v=D=e),c=uu(c),v===e?(v=c,c=0):v=uu(v),D=D===e?c<v?1:-1:uu(D),cy(c,v,D,a)}}function Xl(a){return function(c,v){return typeof c=="string"&&typeof v=="string"||(c=ji(c),v=ji(v)),a(c,v)}}function mg(a,c,v,D,O,U,W,Z,ie,Ee){var Ae=c&A,Ce=Ae?W:e,Re=Ae?e:W,Ke=Ae?U:e,rt=Ae?e:U;c|=Ae?S:B,c&=~(Ae?B:S),c&y||(c&=~(w|m));var At=[a,c,O,Ke,Ce,rt,Re,Z,ie,Ee],nt=v.apply(e,At);return k0(a)&&Ig(nt,At),nt.placeholder=D,Bg(nt,a,c)}function $0(a){var c=vr[a];return function(v,D){if(v=ji(v),D=D==null?0:Cn(Et(D),292),D&&Sr(v)){var O=(Gt(v)+"e").split("e"),U=c(O[0]+"e"+(+O[1]+D));return O=(Gt(U)+"e").split("e"),+(O[0]+"e"+(+O[1]-D))}return c(v)}}var Sy=vo&&1/Ei(new vo([,-0]))[1]==z?function(a){return new vo(a)}:Z0;function vg(a){return function(c){var v=yn(c);return v==at?Ac(c):v==Zt?so(c):Wh(c,a(c))}}function ru(a,c,v,D,O,U,W,Z){var ie=c&m;if(!ie&&typeof a!="function")throw new ei(i);var Ee=D?D.length:0;if(Ee||(c&=~(S|B),D=O=e),W=W===e?W:qr(Et(W),0),Z=Z===e?Z:Et(Z),Ee-=O?O.length:0,c&B){var Ae=D,Ce=O;D=O=e}var Re=ie?e:T0(a),Ke=[a,c,v,D,O,Ae,Ce,U,W,Z];if(Re&&Hy(Ke,Re),a=Ke[0],c=Ke[1],v=Ke[2],D=Ke[3],O=Ke[4],Z=Ke[9]=Ke[9]===e?ie?0:a.length:qr(Ke[9]-Ee,0),!Z&&c&(A|C)&&(c&=~(A|C)),!c||c==w)var rt=yy(a,c,v);else c==A||c==C?rt=Fy(a,c,Z):(c==S||c==(w|S))&&!O.length?rt=Dy(a,c,v,D):rt=Yl.apply(e,Ke);var At=Re?X1:Ig;return Bg(At(rt,Ke),a,c)}function Eg(a,c,v,D){return a===e||es(a,Js[v])&&!Ot.call(D,v)?c:a}function Ag(a,c,v,D,O,U){return Er(a)&&Er(c)&&(U.set(c,a),Kl(a,c,e,Ag,U),U.delete(c)),a}function by(a){return Rc(a)?e:a}function wg(a,c,v,D,O,U){var W=v&d,Z=a.length,ie=c.length;if(Z!=ie&&!(W&&ie>Z))return!1;var Ee=U.get(a),Ae=U.get(c);if(Ee&&Ae)return Ee==c&&Ae==a;var Ce=-1,Re=!0,Ke=v&h?new Fa:e;for(U.set(a,c),U.set(c,a);++Ce<Z;){var rt=a[Ce],At=c[Ce];if(D)var nt=W?D(At,rt,Ce,c,a,U):D(rt,At,Ce,a,c,U);if(nt!==e){if(nt)continue;Re=!1;break}if(Ke){if(!Dl(c,function(Dt,$t){if(!Ca(Ke,$t)&&(rt===Dt||O(rt,Dt,v,D,U)))return Ke.push($t)})){Re=!1;break}}else if(!(rt===At||O(rt,At,v,D,U))){Re=!1;break}}return U.delete(a),U.delete(c),Re}function _y(a,c,v,D,O,U,W){switch(v){case _e:if(a.byteLength!=c.byteLength||a.byteOffset!=c.byteOffset)return!1;a=a.buffer,c=c.buffer;case qe:return!(a.byteLength!=c.byteLength||!U(new po(a),new po(c)));case Jt:case St:case Je:return es(+a,+c);case cr:return a.name==c.name&&a.message==c.message;case ir:case wt:return a==c+"";case at:var Z=Ac;case Zt:var ie=D&d;if(Z||(Z=Ei),a.size!=c.size&&!ie)return!1;var Ee=W.get(a);if(Ee)return Ee==c;D|=h,W.set(a,c);var Ae=wg(Z(a),Z(c),D,O,U,W);return W.delete(a),Ae;case Or:if(Fc)return Fc.call(a)==Fc.call(c)}return!1}function Iy(a,c,v,D,O,U){var W=v&d,Z=P0(a),ie=Z.length,Ee=P0(c),Ae=Ee.length;if(ie!=Ae&&!W)return!1;for(var Ce=ie;Ce--;){var Re=Z[Ce];if(!(W?Re in c:Ot.call(c,Re)))return!1}var Ke=U.get(a),rt=U.get(c);if(Ke&&rt)return Ke==c&&rt==a;var At=!0;U.set(a,c),U.set(c,a);for(var nt=W;++Ce<ie;){Re=Z[Ce];var Dt=a[Re],$t=c[Re];if(D)var Ci=W?D($t,Dt,Re,c,a,U):D(Dt,$t,Re,a,c,U);if(!(Ci===e?Dt===$t||O(Dt,$t,v,D,U):Ci)){At=!1;break}nt||(nt=Re=="constructor")}if(At&&!nt){var jn=a.constructor,yi=c.constructor;jn!=yi&&"constructor"in a&&"constructor"in c&&!(typeof jn=="function"&&jn instanceof jn&&typeof yi=="function"&&yi instanceof yi)&&(At=!1)}return U.delete(a),U.delete(c),At}function nu(a){return U0(bg(a,e,Ng),a+"")}function P0(a){return H1(a,Xr,N0)}function R0(a){return H1(a,ni,Cg)}var T0=Ll?function(a){return Ll.get(a)}:Z0;function Zl(a){for(var c=a.name+"",v=Eo[c],D=Ot.call(Eo,c)?v.length:0;D--;){var O=v[D],U=O.func;if(U==null||U==a)return O.name}return c}function yo(a){var c=Ot.call(k,"placeholder")?k:a;return c.placeholder}function et(){var a=k.iteratee||J0;return a=a===J0?q1:a,arguments.length?a(arguments[0],arguments[1]):a}function Ql(a,c){var v=a.__data__;return xy(c)?v[typeof c=="string"?"string":"hash"]:v.map}function O0(a){for(var c=Xr(a),v=c.length;v--;){var D=c[v],O=a[D];c[v]=[D,O,Dg(O)]}return c}function ba(a,c){var v=Xh(a,c);return M1(v)?v:e}function By(a){var c=Ot.call(a,Zs),v=a[Zs];try{a[Zs]=e;var D=!0}catch{}var O=fo.call(a);return D&&(c?a[Zs]=v:delete a[Zs]),O}var N0=le?function(a){return a==null?[]:(a=er(a),gi(le(a),function(c){return xl.call(a,c)}))}:Q0,Cg=le?function(a){for(var c=[];a;)mi(c,N0(a)),a=go(a);return c}:Q0,yn=Un;(c0&&yn(new c0(new ArrayBuffer(1)))!=_e||wc&&yn(new wc)!=at||l0&&yn(l0.resolve())!=Lt||vo&&yn(new vo)!=Zt||Cc&&yn(new Cc)!=an)&&(yn=function(a){var c=Un(a),v=c==Ve?a.constructor:e,D=v?_a(v):"";if(D)switch(D){case fC:return _e;case hC:return at;case pC:return Lt;case dC:return Zt;case gC:return an}return c});function $y(a,c,v){for(var D=-1,O=v.length;++D<O;){var U=v[D],W=U.size;switch(U.type){case"drop":a+=W;break;case"dropRight":c-=W;break;case"take":c=Cn(c,a+W);break;case"takeRight":a=qr(a,c-W);break}}return{start:a,end:c}}function Py(a){var c=a.match(je);return c?c[1].split(xe):[]}function yg(a,c,v){c=ju(c,a);for(var D=-1,O=c.length,U=!1;++D<O;){var W=Cs(c[D]);if(!(U=a!=null&&v(a,W)))break;a=a[W]}return U||++D!=O?U:(O=a==null?0:a.length,!!O&&af(O)&&iu(W,O)&&(ht(a)||Ia(a)))}function Ry(a){var c=a.length,v=new a.constructor(c);return c&&typeof a[0]=="string"&&Ot.call(a,"index")&&(v.index=a.index,v.input=a.input),v}function Fg(a){return typeof a.constructor=="function"&&!$c(a)?Ao(go(a)):{}}function Ty(a,c,v){var D=a.constructor;switch(c){case qe:return I0(a);case Jt:case St:return new D(+a);case _e:return my(a,v);case Cr:case on:case ot:case Ks:case cn:case ge:case cs:case Tt:case Yr:return sg(a,v);case at:return new D;case Je:case wt:return new D(a);case ir:return vy(a);case Zt:return new D;case Or:return Ey(a)}}function Oy(a,c){var v=c.length;if(!v)return a;var D=v-1;return c[D]=(v>1?"& ":"")+c[D],c=c.join(v>2?", ":" "),a.replace(fe,`{
/* [wrapped with `+c+`] */
`)}function Ny(a){return ht(a)||Ia(a)||!!(kl&&a&&a[kl])}function iu(a,c){var v=typeof a;return c=c??J,!!c&&(v=="number"||v!="symbol"&&yr.test(a))&&a>-1&&a%1==0&&a<c}function Hn(a,c,v){if(!Er(v))return!1;var D=typeof c;return(D=="number"?ri(v)&&iu(c,v.length):D=="string"&&c in v)?es(v[c],a):!1}function x0(a,c){if(ht(a))return!1;var v=typeof a;return v=="number"||v=="symbol"||v=="boolean"||a==null||wi(a)?!0:ps.test(a)||!Nu.test(a)||c!=null&&a in er(c)}function xy(a){var c=typeof a;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?a!=="__proto__":a===null}function k0(a){var c=Zl(a),v=k[c];if(typeof v!="function"||!(c in bt.prototype))return!1;if(a===v)return!0;var D=T0(v);return!!D&&a===D[0]}function ky(a){return!!lo&&lo in a}var Ly=Zi?su:ep;function $c(a){var c=a&&a.constructor,v=typeof c=="function"&&c.prototype||Js;return a===v}function Dg(a){return a===a&&!Er(a)}function Sg(a,c){return function(v){return v==null?!1:v[a]===c&&(c!==e||a in er(v))}}function Uy(a){var c=sf(a,function(D){return v.size===o&&v.clear(),D}),v=c.cache;return c}function Hy(a,c){var v=a[1],D=c[1],O=v|D,U=O<(w|m|I),W=D==I&&v==A||D==I&&v==M&&a[7].length<=c[8]||D==(I|M)&&c[7].length<=c[8]&&v==A;if(!(U||W))return a;D&w&&(a[2]=c[2],O|=v&w?0:y);var Z=c[3];if(Z){var ie=a[3];a[3]=ie?ag(ie,Z,c[4]):Z,a[4]=ie?vi(a[3],l):c[4]}return Z=c[5],Z&&(ie=a[5],a[5]=ie?og(ie,Z,c[6]):Z,a[6]=ie?vi(a[5],l):c[6]),Z=c[7],Z&&(a[7]=Z),D&I&&(a[8]=a[8]==null?c[8]:Cn(a[8],c[8])),a[9]==null&&(a[9]=c[9]),a[0]=c[0],a[1]=O,a}function jy(a){var c=[];if(a!=null)for(var v in er(a))c.push(v);return c}function My(a){return fo.call(a)}function bg(a,c,v){return c=qr(c===e?a.length-1:c,0),function(){for(var D=arguments,O=-1,U=qr(D.length-c,0),W=oe(U);++O<U;)W[O]=D[c+O];O=-1;for(var Z=oe(c+1);++O<c;)Z[O]=D[O];return Z[c]=v(W),kn(a,this,Z)}}function _g(a,c){return c.length<2?a:Sa(a,Ui(c,0,-1))}function qy(a,c){for(var v=a.length,D=Cn(c.length,v),O=ti(a);D--;){var U=c[D];a[D]=iu(U,v)?O[U]:e}return a}function L0(a,c){if(!(c==="constructor"&&typeof a[c]=="function")&&c!="__proto__")return a[c]}var Ig=$g(X1),Pc=X||function(a,c){return xr.setTimeout(a,c)},U0=$g(hy);function Bg(a,c,v){var D=c+"";return U0(a,Oy(D,Ky(Py(D),v)))}function $g(a){var c=0,v=0;return function(){var D=oC(),O=j-(D-v);if(v=D,O>0){if(++c>=L)return arguments[0]}else c=0;return a.apply(e,arguments)}}function ef(a,c){var v=-1,D=a.length,O=D-1;for(c=c===e?D:c;++v<c;){var U=C0(v,O),W=a[U];a[U]=a[v],a[v]=W}return a.length=c,a}var Pg=Uy(function(a){var c=[];return a.charCodeAt(0)===46&&c.push(""),a.replace(ca,function(v,D,O,U){c.push(O?U.replace(gt,"$1"):D||v)}),c});function Cs(a){if(typeof a=="string"||wi(a))return a;var c=a+"";return c=="0"&&1/a==-z?"-0":c}function _a(a){if(a!=null){try{return co.call(a)}catch{}try{return a+""}catch{}}return""}function Ky(a,c){return Zn(ce,function(v){var D="_."+v[0];c&v[1]&&!Ln(a,D)&&a.push(D)}),a.sort()}function Rg(a){if(a instanceof bt)return a.clone();var c=new ki(a.__wrapped__,a.__chain__);return c.__actions__=ti(a.__actions__),c.__index__=a.__index__,c.__values__=a.__values__,c}function Vy(a,c,v){(v?Hn(a,c,v):c===e)?c=1:c=qr(Et(c),0);var D=a==null?0:a.length;if(!D||c<1)return[];for(var O=0,U=0,W=oe(K(D/c));O<D;)W[U++]=Ui(a,O,O+=c);return W}function Gy(a){for(var c=-1,v=a==null?0:a.length,D=0,O=[];++c<v;){var U=a[c];U&&(O[D++]=U)}return O}function zy(){var a=arguments.length;if(!a)return[];for(var c=oe(a-1),v=arguments[0],D=a;D--;)c[D-1]=arguments[D];return mi(ht(v)?ti(v):[v],mn(c,1))}var Yy=Ct(function(a,c){return $r(a)?Sc(a,mn(c,1,$r,!0)):[]}),Wy=Ct(function(a,c){var v=Hi(c);return $r(v)&&(v=e),$r(a)?Sc(a,mn(c,1,$r,!0),et(v,2)):[]}),Jy=Ct(function(a,c){var v=Hi(c);return $r(v)&&(v=e),$r(a)?Sc(a,mn(c,1,$r,!0),e,v):[]});function Xy(a,c,v){var D=a==null?0:a.length;return D?(c=v||c===e?1:Et(c),Ui(a,c<0?0:c,D)):[]}function Zy(a,c,v){var D=a==null?0:a.length;return D?(c=v||c===e?1:Et(c),c=D-c,Ui(a,0,c<0?0:c)):[]}function Qy(a,c){return a&&a.length?Gl(a,et(c,3),!0,!0):[]}function eF(a,c){return a&&a.length?Gl(a,et(c,3),!0):[]}function tF(a,c,v,D){var O=a==null?0:a.length;return O?(v&&typeof v!="number"&&Hn(a,c,v)&&(v=0,D=O),zC(a,c,v,D)):[]}function Tg(a,c,v){var D=a==null?0:a.length;if(!D)return-1;var O=v==null?0:Et(v);return O<0&&(O=qr(D+O,0)),kr(a,et(c,3),O)}function Og(a,c,v){var D=a==null?0:a.length;if(!D)return-1;var O=D-1;return v!==e&&(O=Et(v),O=v<0?qr(D+O,0):Cn(O,D-1)),kr(a,et(c,3),O,!0)}function Ng(a){var c=a==null?0:a.length;return c?mn(a,1):[]}function rF(a){var c=a==null?0:a.length;return c?mn(a,z):[]}function nF(a,c){var v=a==null?0:a.length;return v?(c=c===e?1:Et(c),mn(a,c)):[]}function iF(a){for(var c=-1,v=a==null?0:a.length,D={};++c<v;){var O=a[c];D[O[0]]=O[1]}return D}function xg(a){return a&&a.length?a[0]:e}function sF(a,c,v){var D=a==null?0:a.length;if(!D)return-1;var O=v==null?0:Et(v);return O<0&&(O=qr(D+O,0)),Lu(a,c,O)}function uF(a){var c=a==null?0:a.length;return c?Ui(a,0,-1):[]}var aF=Ct(function(a){var c=te(a,b0);return c.length&&c[0]===a[0]?m0(c):[]}),oF=Ct(function(a){var c=Hi(a),v=te(a,b0);return c===Hi(v)?c=e:v.pop(),v.length&&v[0]===a[0]?m0(v,et(c,2)):[]}),cF=Ct(function(a){var c=Hi(a),v=te(a,b0);return c=typeof c=="function"?c:e,c&&v.pop(),v.length&&v[0]===a[0]?m0(v,e,c):[]});function lF(a,c){return a==null?"":uC.call(a,c)}function Hi(a){var c=a==null?0:a.length;return c?a[c-1]:e}function fF(a,c,v){var D=a==null?0:a.length;if(!D)return-1;var O=D;return v!==e&&(O=Et(v),O=O<0?qr(D+O,0):Cn(O,D-1)),c===c?e0(a,c,O):kr(a,Ni,O,!0)}function hF(a,c){return a&&a.length?z1(a,Et(c)):e}var pF=Ct(kg);function kg(a,c){return a&&a.length&&c&&c.length?w0(a,c):a}function dF(a,c,v){return a&&a.length&&c&&c.length?w0(a,c,et(v,2)):a}function gF(a,c,v){return a&&a.length&&c&&c.length?w0(a,c,e,v):a}var mF=nu(function(a,c){var v=a==null?0:a.length,D=h0(a,c);return J1(a,te(c,function(O){return iu(O,v)?+O:O}).sort(ug)),D});function vF(a,c){var v=[];if(!(a&&a.length))return v;var D=-1,O=[],U=a.length;for(c=et(c,3);++D<U;){var W=a[D];c(W,D,a)&&(v.push(W),O.push(D))}return J1(a,O),v}function H0(a){return a==null?a:lC.call(a)}function EF(a,c,v){var D=a==null?0:a.length;return D?(v&&typeof v!="number"&&Hn(a,c,v)?(c=0,v=D):(c=c==null?0:Et(c),v=v===e?D:Et(v)),Ui(a,c,v)):[]}function AF(a,c){return Vl(a,c)}function wF(a,c,v){return F0(a,c,et(v,2))}function CF(a,c){var v=a==null?0:a.length;if(v){var D=Vl(a,c);if(D<v&&es(a[D],c))return D}return-1}function yF(a,c){return Vl(a,c,!0)}function FF(a,c,v){return F0(a,c,et(v,2),!0)}function DF(a,c){var v=a==null?0:a.length;if(v){var D=Vl(a,c,!0)-1;if(es(a[D],c))return D}return-1}function SF(a){return a&&a.length?Z1(a):[]}function bF(a,c){return a&&a.length?Z1(a,et(c,2)):[]}function _F(a){var c=a==null?0:a.length;return c?Ui(a,1,c):[]}function IF(a,c,v){return a&&a.length?(c=v||c===e?1:Et(c),Ui(a,0,c<0?0:c)):[]}function BF(a,c,v){var D=a==null?0:a.length;return D?(c=v||c===e?1:Et(c),c=D-c,Ui(a,c<0?0:c,D)):[]}function $F(a,c){return a&&a.length?Gl(a,et(c,3),!1,!0):[]}function PF(a,c){return a&&a.length?Gl(a,et(c,3)):[]}var RF=Ct(function(a){return Hu(mn(a,1,$r,!0))}),TF=Ct(function(a){var c=Hi(a);return $r(c)&&(c=e),Hu(mn(a,1,$r,!0),et(c,2))}),OF=Ct(function(a){var c=Hi(a);return c=typeof c=="function"?c:e,Hu(mn(a,1,$r,!0),e,c)});function NF(a){return a&&a.length?Hu(a):[]}function xF(a,c){return a&&a.length?Hu(a,et(c,2)):[]}function kF(a,c){return c=typeof c=="function"?c:e,a&&a.length?Hu(a,e,c):[]}function j0(a){if(!(a&&a.length))return[];var c=0;return a=gi(a,function(v){if($r(v))return c=qr(v.length,c),!0}),mc(c,function(v){return te(a,zs(v))})}function Lg(a,c){if(!(a&&a.length))return[];var v=j0(a);return c==null?v:te(v,function(D){return kn(c,e,D)})}var LF=Ct(function(a,c){return $r(a)?Sc(a,c):[]}),UF=Ct(function(a){return S0(gi(a,$r))}),HF=Ct(function(a){var c=Hi(a);return $r(c)&&(c=e),S0(gi(a,$r),et(c,2))}),jF=Ct(function(a){var c=Hi(a);return c=typeof c=="function"?c:e,S0(gi(a,$r),e,c)}),MF=Ct(j0);function qF(a,c){return rg(a||[],c||[],Dc)}function KF(a,c){return rg(a||[],c||[],Ic)}var VF=Ct(function(a){var c=a.length,v=c>1?a[c-1]:e;return v=typeof v=="function"?(a.pop(),v):e,Lg(a,v)});function Ug(a){var c=k(a);return c.__chain__=!0,c}function GF(a,c){return c(a),a}function tf(a,c){return c(a)}var zF=nu(function(a){var c=a.length,v=c?a[0]:0,D=this.__wrapped__,O=function(U){return h0(U,a)};return c>1||this.__actions__.length||!(D instanceof bt)||!iu(v)?this.thru(O):(D=D.slice(v,+v+(c?1:0)),D.__actions__.push({func:tf,args:[O],thisArg:e}),new ki(D,this.__chain__).thru(function(U){return c&&!U.length&&U.push(e),U}))});function YF(){return Ug(this)}function WF(){return new ki(this.value(),this.__chain__)}function JF(){this.__values__===e&&(this.__values__=Qg(this.value()));var a=this.__index__>=this.__values__.length,c=a?e:this.__values__[this.__index__++];return{done:a,value:c}}function XF(){return this}function ZF(a){for(var c,v=this;v instanceof Hl;){var D=Rg(v);D.__index__=0,D.__values__=e,c?O.__wrapped__=D:c=D;var O=D;v=v.__wrapped__}return O.__wrapped__=a,c}function QF(){var a=this.__wrapped__;if(a instanceof bt){var c=a;return this.__actions__.length&&(c=new bt(this)),c=c.reverse(),c.__actions__.push({func:tf,args:[H0],thisArg:e}),new ki(c,this.__chain__)}return this.thru(H0)}function eD(){return tg(this.__wrapped__,this.__actions__)}var tD=zl(function(a,c,v){Ot.call(a,v)?++a[v]:tu(a,v,1)});function rD(a,c,v){var D=ht(a)?lt:GC;return v&&Hn(a,c,v)&&(c=e),D(a,et(c,3))}function nD(a,c){var v=ht(a)?gi:L1;return v(a,et(c,3))}var iD=hg(Tg),sD=hg(Og);function uD(a,c){return mn(rf(a,c),1)}function aD(a,c){return mn(rf(a,c),z)}function oD(a,c,v){return v=v===e?1:Et(v),mn(rf(a,c),v)}function Hg(a,c){var v=ht(a)?Zn:Uu;return v(a,et(c,3))}function jg(a,c){var v=ht(a)?P:k1;return v(a,et(c,3))}var cD=zl(function(a,c,v){Ot.call(a,v)?a[v].push(c):tu(a,v,[c])});function lD(a,c,v,D){a=ri(a)?a:Do(a),v=v&&!D?Et(v):0;var O=a.length;return v<0&&(v=qr(O+v,0)),of(a)?v<=O&&a.indexOf(c,v)>-1:!!O&&Lu(a,c,v)>-1}var fD=Ct(function(a,c,v){var D=-1,O=typeof c=="function",U=ri(a)?oe(a.length):[];return Uu(a,function(W){U[++D]=O?kn(c,W,v):bc(W,c,v)}),U}),hD=zl(function(a,c,v){tu(a,v,c)});function rf(a,c){var v=ht(a)?te:K1;return v(a,et(c,3))}function pD(a,c,v,D){return a==null?[]:(ht(c)||(c=c==null?[]:[c]),v=D?e:v,ht(v)||(v=v==null?[]:[v]),Y1(a,c,v))}var dD=zl(function(a,c,v){a[v?0:1].push(c)},function(){return[[],[]]});function gD(a,c,v){var D=ht(a)?pc:Sl,O=arguments.length<3;return D(a,et(c,4),v,O,Uu)}function mD(a,c,v){var D=ht(a)?I1:Sl,O=arguments.length<3;return D(a,et(c,4),v,O,k1)}function vD(a,c){var v=ht(a)?gi:L1;return v(a,uf(et(c,3)))}function ED(a){var c=ht(a)?T1:ly;return c(a)}function AD(a,c,v){(v?Hn(a,c,v):c===e)?c=1:c=Et(c);var D=ht(a)?jC:fy;return D(a,c)}function wD(a){var c=ht(a)?MC:py;return c(a)}function CD(a){if(a==null)return 0;if(ri(a))return of(a)?Ws(a):a.length;var c=yn(a);return c==at||c==Zt?a.size:E0(a).length}function yD(a,c,v){var D=ht(a)?Dl:dy;return v&&Hn(a,c,v)&&(c=e),D(a,et(c,3))}var FD=Ct(function(a,c){if(a==null)return[];var v=c.length;return v>1&&Hn(a,c[0],c[1])?c=[]:v>2&&Hn(c[0],c[1],c[2])&&(c=[c[0]]),Y1(a,mn(c,1),[])}),nf=x||function(){return xr.Date.now()};function DD(a,c){if(typeof c!="function")throw new ei(i);return a=Et(a),function(){if(--a<1)return c.apply(this,arguments)}}function Mg(a,c,v){return c=v?e:c,c=a&&c==null?a.length:c,ru(a,I,e,e,e,e,c)}function qg(a,c){var v;if(typeof c!="function")throw new ei(i);return a=Et(a),function(){return--a>0&&(v=c.apply(this,arguments)),a<=1&&(c=e),v}}var M0=Ct(function(a,c,v){var D=w;if(v.length){var O=vi(v,yo(M0));D|=S}return ru(a,D,c,v,O)}),Kg=Ct(function(a,c,v){var D=w|m;if(v.length){var O=vi(v,yo(Kg));D|=S}return ru(c,D,a,v,O)});function Vg(a,c,v){c=v?e:c;var D=ru(a,A,e,e,e,e,e,c);return D.placeholder=Vg.placeholder,D}function Gg(a,c,v){c=v?e:c;var D=ru(a,C,e,e,e,e,e,c);return D.placeholder=Gg.placeholder,D}function zg(a,c,v){var D,O,U,W,Z,ie,Ee=0,Ae=!1,Ce=!1,Re=!0;if(typeof a!="function")throw new ei(i);c=ji(c)||0,Er(v)&&(Ae=!!v.leading,Ce="maxWait"in v,U=Ce?qr(ji(v.maxWait)||0,c):U,Re="trailing"in v?!!v.trailing:Re);function Ke(Pr){var ts=D,au=O;return D=O=e,Ee=Pr,W=a.apply(au,ts),W}function rt(Pr){return Ee=Pr,Z=Pc(Dt,c),Ae?Ke(Pr):W}function At(Pr){var ts=Pr-ie,au=Pr-Ee,hm=c-ts;return Ce?Cn(hm,U-au):hm}function nt(Pr){var ts=Pr-ie,au=Pr-Ee;return ie===e||ts>=c||ts<0||Ce&&au>=U}function Dt(){var Pr=nf();if(nt(Pr))return $t(Pr);Z=Pc(Dt,At(Pr))}function $t(Pr){return Z=e,Re&&D?Ke(Pr):(D=O=e,W)}function Ci(){Z!==e&&ng(Z),Ee=0,D=ie=O=Z=e}function jn(){return Z===e?W:$t(nf())}function yi(){var Pr=nf(),ts=nt(Pr);if(D=arguments,O=this,ie=Pr,ts){if(Z===e)return rt(ie);if(Ce)return ng(Z),Z=Pc(Dt,c),Ke(ie)}return Z===e&&(Z=Pc(Dt,c)),W}return yi.cancel=Ci,yi.flush=jn,yi}var SD=Ct(function(a,c){return x1(a,1,c)}),bD=Ct(function(a,c,v){return x1(a,ji(c)||0,v)});function _D(a){return ru(a,q)}function sf(a,c){if(typeof a!="function"||c!=null&&typeof c!="function")throw new ei(i);var v=function(){var D=arguments,O=c?c.apply(this,D):D[0],U=v.cache;if(U.has(O))return U.get(O);var W=a.apply(this,D);return v.cache=U.set(O,W)||U,W};return v.cache=new(sf.Cache||eu),v}sf.Cache=eu;function uf(a){if(typeof a!="function")throw new ei(i);return function(){var c=arguments;switch(c.length){case 0:return!a.call(this);case 1:return!a.call(this,c[0]);case 2:return!a.call(this,c[0],c[1]);case 3:return!a.call(this,c[0],c[1],c[2])}return!a.apply(this,c)}}function ID(a){return qg(2,a)}var BD=gy(function(a,c){c=c.length==1&&ht(c[0])?te(c[0],wn(et())):te(mn(c,1),wn(et()));var v=c.length;return Ct(function(D){for(var O=-1,U=Cn(D.length,v);++O<U;)D[O]=c[O].call(this,D[O]);return kn(a,this,D)})}),q0=Ct(function(a,c){var v=vi(c,yo(q0));return ru(a,S,e,c,v)}),Yg=Ct(function(a,c){var v=vi(c,yo(Yg));return ru(a,B,e,c,v)}),$D=nu(function(a,c){return ru(a,M,e,e,e,c)});function PD(a,c){if(typeof a!="function")throw new ei(i);return c=c===e?c:Et(c),Ct(a,c)}function RD(a,c){if(typeof a!="function")throw new ei(i);return c=c==null?0:qr(Et(c),0),Ct(function(v){var D=v[c],O=Mu(v,0,c);return D&&mi(O,D),kn(a,this,O)})}function TD(a,c,v){var D=!0,O=!0;if(typeof a!="function")throw new ei(i);return Er(v)&&(D="leading"in v?!!v.leading:D,O="trailing"in v?!!v.trailing:O),zg(a,c,{leading:D,maxWait:c,trailing:O})}function OD(a){return Mg(a,1)}function ND(a,c){return q0(_0(c),a)}function xD(){if(!arguments.length)return[];var a=arguments[0];return ht(a)?a:[a]}function kD(a){return Li(a,E)}function LD(a,c){return c=typeof c=="function"?c:e,Li(a,E,c)}function UD(a){return Li(a,f|E)}function HD(a,c){return c=typeof c=="function"?c:e,Li(a,f|E,c)}function jD(a,c){return c==null||N1(a,c,Xr(c))}function es(a,c){return a===c||a!==a&&c!==c}var MD=Xl(g0),qD=Xl(function(a,c){return a>=c}),Ia=j1(function(){return arguments}())?j1:function(a){return br(a)&&Ot.call(a,"callee")&&!xl.call(a,"callee")},ht=oe.isArray,KD=El?wn(El):ZC;function ri(a){return a!=null&&af(a.length)&&!su(a)}function $r(a){return br(a)&&ri(a)}function VD(a){return a===!0||a===!1||br(a)&&Un(a)==Jt}var qu=tr||ep,GD=Al?wn(Al):QC;function zD(a){return br(a)&&a.nodeType===1&&!Rc(a)}function YD(a){if(a==null)return!0;if(ri(a)&&(ht(a)||typeof a=="string"||typeof a.splice=="function"||qu(a)||Fo(a)||Ia(a)))return!a.length;var c=yn(a);if(c==at||c==Zt)return!a.size;if($c(a))return!E0(a).length;for(var v in a)if(Ot.call(a,v))return!1;return!0}function WD(a,c){return _c(a,c)}function JD(a,c,v){v=typeof v=="function"?v:e;var D=v?v(a,c):e;return D===e?_c(a,c,e,v):!!D}function K0(a){if(!br(a))return!1;var c=Un(a);return c==cr||c==wr||typeof a.message=="string"&&typeof a.name=="string"&&!Rc(a)}function XD(a){return typeof a=="number"&&Sr(a)}function su(a){if(!Er(a))return!1;var c=Un(a);return c==vt||c==Xt||c==Tr||c==un}function Wg(a){return typeof a=="number"&&a==Et(a)}function af(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=J}function Er(a){var c=typeof a;return a!=null&&(c=="object"||c=="function")}function br(a){return a!=null&&typeof a=="object"}var Jg=wl?wn(wl):ty;function ZD(a,c){return a===c||v0(a,c,O0(c))}function QD(a,c,v){return v=typeof v=="function"?v:e,v0(a,c,O0(c),v)}function e4(a){return Xg(a)&&a!=+a}function t4(a){if(Ly(a))throw new st(n);return M1(a)}function r4(a){return a===null}function n4(a){return a==null}function Xg(a){return typeof a=="number"||br(a)&&Un(a)==Je}function Rc(a){if(!br(a)||Un(a)!=Ve)return!1;var c=go(a);if(c===null)return!0;var v=Ot.call(c,"constructor")&&c.constructor;return typeof v=="function"&&v instanceof v&&co.call(v)==u0}var V0=Cl?wn(Cl):ry;function i4(a){return Wg(a)&&a>=-J&&a<=J}var Zg=yl?wn(yl):ny;function of(a){return typeof a=="string"||!ht(a)&&br(a)&&Un(a)==wt}function wi(a){return typeof a=="symbol"||br(a)&&Un(a)==Or}var Fo=Fl?wn(Fl):iy;function s4(a){return a===e}function u4(a){return br(a)&&yn(a)==an}function a4(a){return br(a)&&Un(a)==It}var o4=Xl(A0),c4=Xl(function(a,c){return a<=c});function Qg(a){if(!a)return[];if(ri(a))return of(a)?Qn(a):ti(a);if(Xs&&a[Xs])return Qh(a[Xs]());var c=yn(a),v=c==at?Ac:c==Zt?Ei:Do;return v(a)}function uu(a){if(!a)return a===0?a:0;if(a=ji(a),a===z||a===-z){var c=a<0?-1:1;return c*se}return a===a?a:0}function Et(a){var c=uu(a),v=c%1;return c===c?v?c-v:c:0}function em(a){return a?Da(Et(a),0,ye):0}function ji(a){if(typeof a=="number")return a;if(wi(a))return De;if(Er(a)){var c=typeof a.valueOf=="function"?a.valueOf():a;a=Er(c)?c+"":c}if(typeof a!="string")return a===0?a:+a;a=vc(a);var v=Ti.test(a);return v||An.test(a)?Vh(a.slice(2),v?2:8):Yn.test(a)?De:+a}function tm(a){return ws(a,ni(a))}function l4(a){return a?Da(Et(a),-J,J):a===0?a:0}function Gt(a){return a==null?"":Ai(a)}var f4=wo(function(a,c){if($c(c)||ri(c)){ws(c,Xr(c),a);return}for(var v in c)Ot.call(c,v)&&Dc(a,v,c[v])}),rm=wo(function(a,c){ws(c,ni(c),a)}),cf=wo(function(a,c,v,D){ws(c,ni(c),a,D)}),h4=wo(function(a,c,v,D){ws(c,Xr(c),a,D)}),p4=nu(h0);function d4(a,c){var v=Ao(a);return c==null?v:O1(v,c)}var g4=Ct(function(a,c){a=er(a);var v=-1,D=c.length,O=D>2?c[2]:e;for(O&&Hn(c[0],c[1],O)&&(D=1);++v<D;)for(var U=c[v],W=ni(U),Z=-1,ie=W.length;++Z<ie;){var Ee=W[Z],Ae=a[Ee];(Ae===e||es(Ae,Js[Ee])&&!Ot.call(a,Ee))&&(a[Ee]=U[Ee])}return a}),m4=Ct(function(a){return a.push(e,Ag),kn(nm,e,a)});function v4(a,c){return Xe(a,et(c,3),As)}function E4(a,c){return Xe(a,et(c,3),d0)}function A4(a,c){return a==null?a:p0(a,et(c,3),ni)}function w4(a,c){return a==null?a:U1(a,et(c,3),ni)}function C4(a,c){return a&&As(a,et(c,3))}function y4(a,c){return a&&d0(a,et(c,3))}function F4(a){return a==null?[]:ql(a,Xr(a))}function D4(a){return a==null?[]:ql(a,ni(a))}function G0(a,c,v){var D=a==null?e:Sa(a,c);return D===e?v:D}function S4(a,c){return a!=null&&yg(a,c,YC)}function z0(a,c){return a!=null&&yg(a,c,WC)}var b4=dg(function(a,c,v){c!=null&&typeof c.toString!="function"&&(c=fo.call(c)),a[c]=v},W0(ii)),_4=dg(function(a,c,v){c!=null&&typeof c.toString!="function"&&(c=fo.call(c)),Ot.call(a,c)?a[c].push(v):a[c]=[v]},et),I4=Ct(bc);function Xr(a){return ri(a)?R1(a):E0(a)}function ni(a){return ri(a)?R1(a,!0):sy(a)}function B4(a,c){var v={};return c=et(c,3),As(a,function(D,O,U){tu(v,c(D,O,U),D)}),v}function $4(a,c){var v={};return c=et(c,3),As(a,function(D,O,U){tu(v,O,c(D,O,U))}),v}var P4=wo(function(a,c,v){Kl(a,c,v)}),nm=wo(function(a,c,v,D){Kl(a,c,v,D)}),R4=nu(function(a,c){var v={};if(a==null)return v;var D=!1;c=te(c,function(U){return U=ju(U,a),D||(D=U.length>1),U}),ws(a,R0(a),v),D&&(v=Li(v,f|p|E,by));for(var O=c.length;O--;)D0(v,c[O]);return v});function T4(a,c){return im(a,uf(et(c)))}var O4=nu(function(a,c){return a==null?{}:ay(a,c)});function im(a,c){if(a==null)return{};var v=te(R0(a),function(D){return[D]});return c=et(c),W1(a,v,function(D,O){return c(D,O[0])})}function N4(a,c,v){c=ju(c,a);var D=-1,O=c.length;for(O||(O=1,a=e);++D<O;){var U=a==null?e:a[Cs(c[D])];U===e&&(D=O,U=v),a=su(U)?U.call(a):U}return a}function x4(a,c,v){return a==null?a:Ic(a,c,v)}function k4(a,c,v,D){return D=typeof D=="function"?D:e,a==null?a:Ic(a,c,v,D)}var sm=vg(Xr),um=vg(ni);function L4(a,c,v){var D=ht(a),O=D||qu(a)||Fo(a);if(c=et(c,4),v==null){var U=a&&a.constructor;O?v=D?new U:[]:Er(a)?v=su(U)?Ao(go(a)):{}:v={}}return(O?Zn:As)(a,function(W,Z,ie){return c(v,W,Z,ie)}),v}function U4(a,c){return a==null?!0:D0(a,c)}function H4(a,c,v){return a==null?a:eg(a,c,_0(v))}function j4(a,c,v,D){return D=typeof D=="function"?D:e,a==null?a:eg(a,c,_0(v),D)}function Do(a){return a==null?[]:wa(a,Xr(a))}function M4(a){return a==null?[]:wa(a,ni(a))}function q4(a,c,v){return v===e&&(v=c,c=e),v!==e&&(v=ji(v),v=v===v?v:0),c!==e&&(c=ji(c),c=c===c?c:0),Da(ji(a),c,v)}function K4(a,c,v){return c=uu(c),v===e?(v=c,c=0):v=uu(v),a=ji(a),JC(a,c,v)}function V4(a,c,v){if(v&&typeof v!="boolean"&&Hn(a,c,v)&&(c=v=e),v===e&&(typeof c=="boolean"?(v=c,c=e):typeof a=="boolean"&&(v=a,a=e)),a===e&&c===e?(a=0,c=1):(a=uu(a),c===e?(c=a,a=0):c=uu(c)),a>c){var D=a;a=c,c=D}if(v||a%1||c%1){var O=$1();return Cn(a+O*(c-a+Kh("1e-"+((O+"").length-1))),c)}return C0(a,c)}var G4=Co(function(a,c,v){return c=c.toLowerCase(),a+(v?am(c):c)});function am(a){return Y0(Gt(a).toLowerCase())}function om(a){return a=Gt(a),a&&a.replace(fn,Ec).replace(xn,"")}function z4(a,c,v){a=Gt(a),c=Ai(c);var D=a.length;v=v===e?D:Da(Et(v),0,D);var O=v;return v-=c.length,v>=0&&a.slice(v,O)==c}function Y4(a){return a=Gt(a),a&&Ut.test(a)?a.replace(hs,Jh):a}function W4(a){return a=Gt(a),a&&la.test(a)?a.replace(ds,"\\$&"):a}var J4=Co(function(a,c,v){return a+(v?"-":"")+c.toLowerCase()}),X4=Co(function(a,c,v){return a+(v?" ":"")+c.toLowerCase()}),Z4=fg("toLowerCase");function Q4(a,c,v){a=Gt(a),c=Et(c);var D=c?Ws(a):0;if(!c||D>=c)return a;var O=(c-D)/2;return Jl(ue(O),v)+a+Jl(K(O),v)}function e6(a,c,v){a=Gt(a),c=Et(c);var D=c?Ws(a):0;return c&&D<c?a+Jl(c-D,v):a}function t6(a,c,v){a=Gt(a),c=Et(c);var D=c?Ws(a):0;return c&&D<c?Jl(c-D,v)+a:a}function r6(a,c,v){return v||c==null?c=0:c&&(c=+c),cC(Gt(a).replace(Vs,""),c||0)}function n6(a,c,v){return(v?Hn(a,c,v):c===e)?c=1:c=Et(c),y0(Gt(a),c)}function i6(){var a=arguments,c=Gt(a[0]);return a.length<3?c:c.replace(a[1],a[2])}var s6=Co(function(a,c,v){return a+(v?"_":"")+c.toLowerCase()});function u6(a,c,v){return v&&typeof v!="number"&&Hn(a,c,v)&&(c=v=e),v=v===e?ye:v>>>0,v?(a=Gt(a),a&&(typeof c=="string"||c!=null&&!V0(c))&&(c=Ai(c),!c&&Ys(a))?Mu(Qn(a),0,v):a.split(c,v)):[]}var a6=Co(function(a,c,v){return a+(v?" ":"")+Y0(c)});function o6(a,c,v){return a=Gt(a),v=v==null?0:Da(Et(v),0,a.length),c=Ai(c),a.slice(v,v+c.length)==c}function c6(a,c,v){var D=k.templateSettings;v&&Hn(a,c,v)&&(c=e),a=Gt(a),c=cf({},c,D,Eg);var O=cf({},c.imports,D.imports,Eg),U=Xr(O),W=wa(O,U),Z,ie,Ee=0,Ae=c.interpolate||Mr,Ce="__p += '",Re=ao((c.escape||Mr).source+"|"+Ae.source+"|"+(Ae===Ou?Br:Mr).source+"|"+(c.evaluate||Mr).source+"|$","g"),Ke="//# sourceURL="+(Ot.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Uh+"]")+`
`;a.replace(Re,function(nt,Dt,$t,Ci,jn,yi){return $t||($t=Ci),Ce+=a.slice(Ee,yi).replace(fa,Bl),Dt&&(Z=!0,Ce+=`' +
__e(`+Dt+`) +
'`),jn&&(ie=!0,Ce+=`';
`+jn+`;
__p += '`),$t&&(Ce+=`' +
((__t = (`+$t+`)) == null ? '' : __t) +
'`),Ee=yi+nt.length,nt}),Ce+=`';
`;var rt=Ot.call(c,"variable")&&c.variable;if(!rt)Ce=`with (obj) {
`+Ce+`
}
`;else if(ct.test(rt))throw new st(u);Ce=(ie?Ce.replace(Ji,""):Ce).replace(Pu,"$1").replace(ls,"$1;"),Ce="function("+(rt||"obj")+`) {
`+(rt?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(ie?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+Ce+`return __p
}`;var At=lm(function(){return Bt(U,Ke+"return "+Ce).apply(e,W)});if(At.source=Ce,K0(At))throw At;return At}function l6(a){return Gt(a).toLowerCase()}function f6(a){return Gt(a).toUpperCase()}function h6(a,c,v){if(a=Gt(a),a&&(v||c===e))return vc(a);if(!a||!(c=Ai(c)))return a;var D=Qn(a),O=Qn(c),U=io(D,O),W=_l(D,O)+1;return Mu(D,U,W).join("")}function p6(a,c,v){if(a=Gt(a),a&&(v||c===e))return a.slice(0,uo(a)+1);if(!a||!(c=Ai(c)))return a;var D=Qn(a),O=_l(D,Qn(c))+1;return Mu(D,0,O).join("")}function d6(a,c,v){if(a=Gt(a),a&&(v||c===e))return a.replace(Vs,"");if(!a||!(c=Ai(c)))return a;var D=Qn(a),O=io(D,Qn(c));return Mu(D,O).join("")}function g6(a,c){var v=b,D=R;if(Er(c)){var O="separator"in c?c.separator:O;v="length"in c?Et(c.length):v,D="omission"in c?Ai(c.omission):D}a=Gt(a);var U=a.length;if(Ys(a)){var W=Qn(a);U=W.length}if(v>=U)return a;var Z=v-Ws(D);if(Z<1)return D;var ie=W?Mu(W,0,Z).join(""):a.slice(0,Z);if(O===e)return ie+D;if(W&&(Z+=ie.length-Z),V0(O)){if(a.slice(Z).search(O)){var Ee,Ae=ie;for(O.global||(O=ao(O.source,Gt(Kt.exec(O))+"g")),O.lastIndex=0;Ee=O.exec(Ae);)var Ce=Ee.index;ie=ie.slice(0,Ce===e?Z:Ce)}}else if(a.indexOf(Ai(O),Z)!=Z){var Re=ie.lastIndexOf(O);Re>-1&&(ie=ie.slice(0,Re))}return ie+D}function m6(a){return a=Gt(a),a&&Xi.test(a)?a.replace(Ru,Pl):a}var v6=Co(function(a,c,v){return a+(v?" ":"")+c.toUpperCase()}),Y0=fg("toUpperCase");function cm(a,c,v){return a=Gt(a),c=v?e:c,c===e?Zh(a)?r0(a):dc(a):a.match(c)||[]}var lm=Ct(function(a,c){try{return kn(a,e,c)}catch(v){return K0(v)?v:new st(v)}}),E6=nu(function(a,c){return Zn(c,function(v){v=Cs(v),tu(a,v,M0(a[v],a))}),a});function A6(a){var c=a==null?0:a.length,v=et();return a=c?te(a,function(D){if(typeof D[1]!="function")throw new ei(i);return[v(D[0]),D[1]]}):[],Ct(function(D){for(var O=-1;++O<c;){var U=a[O];if(kn(U[0],this,D))return kn(U[1],this,D)}})}function w6(a){return VC(Li(a,f))}function W0(a){return function(){return a}}function C6(a,c){return a==null||a!==a?c:a}var y6=pg(),F6=pg(!0);function ii(a){return a}function J0(a){return q1(typeof a=="function"?a:Li(a,f))}function D6(a){return V1(Li(a,f))}function S6(a,c){return G1(a,Li(c,f))}var b6=Ct(function(a,c){return function(v){return bc(v,a,c)}}),_6=Ct(function(a,c){return function(v){return bc(a,v,c)}});function X0(a,c,v){var D=Xr(c),O=ql(c,D);v==null&&!(Er(c)&&(O.length||!D.length))&&(v=c,c=a,a=this,O=ql(c,Xr(c)));var U=!(Er(v)&&"chain"in v)||!!v.chain,W=su(a);return Zn(O,function(Z){var ie=c[Z];a[Z]=ie,W&&(a.prototype[Z]=function(){var Ee=this.__chain__;if(U||Ee){var Ae=a(this.__wrapped__),Ce=Ae.__actions__=ti(this.__actions__);return Ce.push({func:ie,args:arguments,thisArg:a}),Ae.__chain__=Ee,Ae}return ie.apply(a,mi([this.value()],arguments))})}),a}function I6(){return xr._===this&&(xr._=a0),this}function Z0(){}function B6(a){return a=Et(a),Ct(function(c){return z1(c,a)})}var $6=B0(te),P6=B0(lt),R6=B0(Dl);function fm(a){return x0(a)?zs(Cs(a)):oy(a)}function T6(a){return function(c){return a==null?e:Sa(a,c)}}var O6=gg(),N6=gg(!0);function Q0(){return[]}function ep(){return!1}function x6(){return{}}function k6(){return""}function L6(){return!0}function U6(a,c){if(a=Et(a),a<1||a>J)return[];var v=ye,D=Cn(a,ye);c=et(c),a-=ye;for(var O=mc(D,c);++v<a;)c(v);return O}function H6(a){return ht(a)?te(a,Cs):wi(a)?[a]:ti(Pg(Gt(a)))}function j6(a){var c=++s0;return Gt(a)+c}var M6=Wl(function(a,c){return a+c},0),q6=$0("ceil"),K6=Wl(function(a,c){return a/c},1),V6=$0("floor");function G6(a){return a&&a.length?Ml(a,ii,g0):e}function z6(a,c){return a&&a.length?Ml(a,et(c,2),g0):e}function Y6(a){return gc(a,ii)}function W6(a,c){return gc(a,et(c,2))}function J6(a){return a&&a.length?Ml(a,ii,A0):e}function X6(a,c){return a&&a.length?Ml(a,et(c,2),A0):e}var Z6=Wl(function(a,c){return a*c},1),Q6=$0("round"),eS=Wl(function(a,c){return a-c},0);function tS(a){return a&&a.length?no(a,ii):0}function rS(a,c){return a&&a.length?no(a,et(c,2)):0}return k.after=DD,k.ary=Mg,k.assign=f4,k.assignIn=rm,k.assignInWith=cf,k.assignWith=h4,k.at=p4,k.before=qg,k.bind=M0,k.bindAll=E6,k.bindKey=Kg,k.castArray=xD,k.chain=Ug,k.chunk=Vy,k.compact=Gy,k.concat=zy,k.cond=A6,k.conforms=w6,k.constant=W0,k.countBy=tD,k.create=d4,k.curry=Vg,k.curryRight=Gg,k.debounce=zg,k.defaults=g4,k.defaultsDeep=m4,k.defer=SD,k.delay=bD,k.difference=Yy,k.differenceBy=Wy,k.differenceWith=Jy,k.drop=Xy,k.dropRight=Zy,k.dropRightWhile=Qy,k.dropWhile=eF,k.fill=tF,k.filter=nD,k.flatMap=uD,k.flatMapDeep=aD,k.flatMapDepth=oD,k.flatten=Ng,k.flattenDeep=rF,k.flattenDepth=nF,k.flip=_D,k.flow=y6,k.flowRight=F6,k.fromPairs=iF,k.functions=F4,k.functionsIn=D4,k.groupBy=cD,k.initial=uF,k.intersection=aF,k.intersectionBy=oF,k.intersectionWith=cF,k.invert=b4,k.invertBy=_4,k.invokeMap=fD,k.iteratee=J0,k.keyBy=hD,k.keys=Xr,k.keysIn=ni,k.map=rf,k.mapKeys=B4,k.mapValues=$4,k.matches=D6,k.matchesProperty=S6,k.memoize=sf,k.merge=P4,k.mergeWith=nm,k.method=b6,k.methodOf=_6,k.mixin=X0,k.negate=uf,k.nthArg=B6,k.omit=R4,k.omitBy=T4,k.once=ID,k.orderBy=pD,k.over=$6,k.overArgs=BD,k.overEvery=P6,k.overSome=R6,k.partial=q0,k.partialRight=Yg,k.partition=dD,k.pick=O4,k.pickBy=im,k.property=fm,k.propertyOf=T6,k.pull=pF,k.pullAll=kg,k.pullAllBy=dF,k.pullAllWith=gF,k.pullAt=mF,k.range=O6,k.rangeRight=N6,k.rearg=$D,k.reject=vD,k.remove=vF,k.rest=PD,k.reverse=H0,k.sampleSize=AD,k.set=x4,k.setWith=k4,k.shuffle=wD,k.slice=EF,k.sortBy=FD,k.sortedUniq=SF,k.sortedUniqBy=bF,k.split=u6,k.spread=RD,k.tail=_F,k.take=IF,k.takeRight=BF,k.takeRightWhile=$F,k.takeWhile=PF,k.tap=GF,k.throttle=TD,k.thru=tf,k.toArray=Qg,k.toPairs=sm,k.toPairsIn=um,k.toPath=H6,k.toPlainObject=tm,k.transform=L4,k.unary=OD,k.union=RF,k.unionBy=TF,k.unionWith=OF,k.uniq=NF,k.uniqBy=xF,k.uniqWith=kF,k.unset=U4,k.unzip=j0,k.unzipWith=Lg,k.update=H4,k.updateWith=j4,k.values=Do,k.valuesIn=M4,k.without=LF,k.words=cm,k.wrap=ND,k.xor=UF,k.xorBy=HF,k.xorWith=jF,k.zip=MF,k.zipObject=qF,k.zipObjectDeep=KF,k.zipWith=VF,k.entries=sm,k.entriesIn=um,k.extend=rm,k.extendWith=cf,X0(k,k),k.add=M6,k.attempt=lm,k.camelCase=G4,k.capitalize=am,k.ceil=q6,k.clamp=q4,k.clone=kD,k.cloneDeep=UD,k.cloneDeepWith=HD,k.cloneWith=LD,k.conformsTo=jD,k.deburr=om,k.defaultTo=C6,k.divide=K6,k.endsWith=z4,k.eq=es,k.escape=Y4,k.escapeRegExp=W4,k.every=rD,k.find=iD,k.findIndex=Tg,k.findKey=v4,k.findLast=sD,k.findLastIndex=Og,k.findLastKey=E4,k.floor=V6,k.forEach=Hg,k.forEachRight=jg,k.forIn=A4,k.forInRight=w4,k.forOwn=C4,k.forOwnRight=y4,k.get=G0,k.gt=MD,k.gte=qD,k.has=S4,k.hasIn=z0,k.head=xg,k.identity=ii,k.includes=lD,k.indexOf=sF,k.inRange=K4,k.invoke=I4,k.isArguments=Ia,k.isArray=ht,k.isArrayBuffer=KD,k.isArrayLike=ri,k.isArrayLikeObject=$r,k.isBoolean=VD,k.isBuffer=qu,k.isDate=GD,k.isElement=zD,k.isEmpty=YD,k.isEqual=WD,k.isEqualWith=JD,k.isError=K0,k.isFinite=XD,k.isFunction=su,k.isInteger=Wg,k.isLength=af,k.isMap=Jg,k.isMatch=ZD,k.isMatchWith=QD,k.isNaN=e4,k.isNative=t4,k.isNil=n4,k.isNull=r4,k.isNumber=Xg,k.isObject=Er,k.isObjectLike=br,k.isPlainObject=Rc,k.isRegExp=V0,k.isSafeInteger=i4,k.isSet=Zg,k.isString=of,k.isSymbol=wi,k.isTypedArray=Fo,k.isUndefined=s4,k.isWeakMap=u4,k.isWeakSet=a4,k.join=lF,k.kebabCase=J4,k.last=Hi,k.lastIndexOf=fF,k.lowerCase=X4,k.lowerFirst=Z4,k.lt=o4,k.lte=c4,k.max=G6,k.maxBy=z6,k.mean=Y6,k.meanBy=W6,k.min=J6,k.minBy=X6,k.stubArray=Q0,k.stubFalse=ep,k.stubObject=x6,k.stubString=k6,k.stubTrue=L6,k.multiply=Z6,k.nth=hF,k.noConflict=I6,k.noop=Z0,k.now=nf,k.pad=Q4,k.padEnd=e6,k.padStart=t6,k.parseInt=r6,k.random=V4,k.reduce=gD,k.reduceRight=mD,k.repeat=n6,k.replace=i6,k.result=N4,k.round=Q6,k.runInContext=ne,k.sample=ED,k.size=CD,k.snakeCase=s6,k.some=yD,k.sortedIndex=AF,k.sortedIndexBy=wF,k.sortedIndexOf=CF,k.sortedLastIndex=yF,k.sortedLastIndexBy=FF,k.sortedLastIndexOf=DF,k.startCase=a6,k.startsWith=o6,k.subtract=eS,k.sum=tS,k.sumBy=rS,k.template=c6,k.times=U6,k.toFinite=uu,k.toInteger=Et,k.toLength=em,k.toLower=l6,k.toNumber=ji,k.toSafeInteger=l4,k.toString=Gt,k.toUpper=f6,k.trim=h6,k.trimEnd=p6,k.trimStart=d6,k.truncate=g6,k.unescape=m6,k.uniqueId=j6,k.upperCase=v6,k.upperFirst=Y0,k.each=Hg,k.eachRight=jg,k.first=xg,X0(k,function(){var a={};return As(k,function(c,v){Ot.call(k.prototype,v)||(a[v]=c)}),a}(),{chain:!1}),k.VERSION=t,Zn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){k[a].placeholder=k}),Zn(["drop","take"],function(a,c){bt.prototype[a]=function(v){v=v===e?1:qr(Et(v),0);var D=this.__filtered__&&!c?new bt(this):this.clone();return D.__filtered__?D.__takeCount__=Cn(v,D.__takeCount__):D.__views__.push({size:Cn(v,ye),type:a+(D.__dir__<0?"Right":"")}),D},bt.prototype[a+"Right"]=function(v){return this.reverse()[a](v).reverse()}}),Zn(["filter","map","takeWhile"],function(a,c){var v=c+1,D=v==G||v==V;bt.prototype[a]=function(O){var U=this.clone();return U.__iteratees__.push({iteratee:et(O,3),type:v}),U.__filtered__=U.__filtered__||D,U}}),Zn(["head","last"],function(a,c){var v="take"+(c?"Right":"");bt.prototype[a]=function(){return this[v](1).value()[0]}}),Zn(["initial","tail"],function(a,c){var v="drop"+(c?"":"Right");bt.prototype[a]=function(){return this.__filtered__?new bt(this):this[v](1)}}),bt.prototype.compact=function(){return this.filter(ii)},bt.prototype.find=function(a){return this.filter(a).head()},bt.prototype.findLast=function(a){return this.reverse().find(a)},bt.prototype.invokeMap=Ct(function(a,c){return typeof a=="function"?new bt(this):this.map(function(v){return bc(v,a,c)})}),bt.prototype.reject=function(a){return this.filter(uf(et(a)))},bt.prototype.slice=function(a,c){a=Et(a);var v=this;return v.__filtered__&&(a>0||c<0)?new bt(v):(a<0?v=v.takeRight(-a):a&&(v=v.drop(a)),c!==e&&(c=Et(c),v=c<0?v.dropRight(-c):v.take(c-a)),v)},bt.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},bt.prototype.toArray=function(){return this.take(ye)},As(bt.prototype,function(a,c){var v=/^(?:filter|find|map|reject)|While$/.test(c),D=/^(?:head|last)$/.test(c),O=k[D?"take"+(c=="last"?"Right":""):c],U=D||/^find/.test(c);O&&(k.prototype[c]=function(){var W=this.__wrapped__,Z=D?[1]:arguments,ie=W instanceof bt,Ee=Z[0],Ae=ie||ht(W),Ce=function(Dt){var $t=O.apply(k,mi([Dt],Z));return D&&Re?$t[0]:$t};Ae&&v&&typeof Ee=="function"&&Ee.length!=1&&(ie=Ae=!1);var Re=this.__chain__,Ke=!!this.__actions__.length,rt=U&&!Re,At=ie&&!Ke;if(!U&&Ae){W=At?W:new bt(this);var nt=a.apply(W,Z);return nt.__actions__.push({func:tf,args:[Ce],thisArg:e}),new ki(nt,Re)}return rt&&At?a.apply(this,Z):(nt=this.thru(Ce),rt?D?nt.value()[0]:nt.value():nt)})}),Zn(["pop","push","shift","sort","splice","unshift"],function(a){var c=oo[a],v=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",D=/^(?:pop|shift)$/.test(a);k.prototype[a]=function(){var O=arguments;if(D&&!this.__chain__){var U=this.value();return c.apply(ht(U)?U:[],O)}return this[v](function(W){return c.apply(ht(W)?W:[],O)})}}),As(bt.prototype,function(a,c){var v=k[c];if(v){var D=v.name+"";Ot.call(Eo,D)||(Eo[D]=[]),Eo[D].push({name:c,func:v})}}),Eo[Yl(e,m).name]=[{name:"wrapper",func:e}],bt.prototype.clone=mC,bt.prototype.reverse=vC,bt.prototype.value=EC,k.prototype.at=zF,k.prototype.chain=YF,k.prototype.commit=WF,k.prototype.next=JF,k.prototype.plant=ZF,k.prototype.reverse=QF,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=eD,k.prototype.first=k.prototype.head,Xs&&(k.prototype[Xs]=XF),k},xi=n0();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(xr._=xi,define(function(){return xi})):Gs?((Gs.exports=xi)._=xi,fc._=xi):xr._=xi}).call(_o)});var op=Se(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.isCorrect=Io.isInSubnet=void 0;function xS(e){return this.subnetMask<e.subnetMask?!1:this.mask(e.subnetMask)===e.mask()}Io.isInSubnet=xS;function kS(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}Io.isCorrect=kS});var cp=Se(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.RE_SUBNET_STRING=Fs.RE_ADDRESS=Fs.GROUPS=Fs.BITS=void 0;Fs.BITS=32;Fs.GROUPS=4;Fs.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;Fs.RE_SUBNET_STRING=/\/\d{1,2}$/});var wf=Se(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});Af.AddressError=void 0;var lp=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};Af.AddressError=lp});var fp=Se((Cf,xm)=>{(function(){var e,t=0xdeadbeefcafe,r=(t&16777215)==15715070;function n(T,N,H){T!=null&&(typeof T=="number"?this.fromNumber(T,N,H):N==null&&typeof T!="string"?this.fromString(T,256):this.fromString(T,N))}function i(){return new n(null)}function u(T,N,H,Q,ve,we){for(;--we>=0;){var $e=N*this[T++]+H[Q]+ve;ve=Math.floor($e/67108864),H[Q++]=$e&67108863}return ve}function s(T,N,H,Q,ve,we){for(var $e=N&32767,Ne=N>>15;--we>=0;){var Qt=this[T]&32767,Dr=this[T++]>>15,hn=Ne*Qt+Dr*$e;Qt=$e*Qt+((hn&32767)<<15)+H[Q]+(ve&1073741823),ve=(Qt>>>30)+(hn>>>15)+Ne*Dr+(ve>>>30),H[Q++]=Qt&1073741823}return ve}function o(T,N,H,Q,ve,we){for(var $e=N&16383,Ne=N>>14;--we>=0;){var Qt=this[T]&16383,Dr=this[T++]>>14,hn=Ne*Qt+Dr*$e;Qt=$e*Qt+((hn&16383)<<14)+H[Q]+ve,ve=(Qt>>28)+(hn>>14)+Ne*Dr,H[Q++]=Qt&268435455}return ve}var l=typeof navigator<"u";l&&r&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=s,e=30):l&&r&&navigator.appName!="Netscape"?(n.prototype.am=u,e=26):(n.prototype.am=o,e=28),n.prototype.DB=e,n.prototype.DM=(1<<e)-1,n.prototype.DV=1<<e;var f=52;n.prototype.FV=Math.pow(2,f),n.prototype.F1=f-e,n.prototype.F2=2*e-f;var p="0123456789abcdefghijklmnopqrstuvwxyz",E=new Array,d,h;for(d=48,h=0;h<=9;++h)E[d++]=h;for(d=97,h=10;h<36;++h)E[d++]=h;for(d=65,h=10;h<36;++h)E[d++]=h;function w(T){return p.charAt(T)}function m(T,N){var H=E[T.charCodeAt(N)];return H??-1}function y(T){for(var N=this.t-1;N>=0;--N)T[N]=this[N];T.t=this.t,T.s=this.s}function A(T){this.t=1,this.s=T<0?-1:0,T>0?this[0]=T:T<-1?this[0]=T+this.DV:this.t=0}function C(T){var N=i();return N.fromInt(T),N}function S(T,N){var H;if(N==16)H=4;else if(N==8)H=3;else if(N==256)H=8;else if(N==2)H=1;else if(N==32)H=5;else if(N==4)H=2;else{this.fromRadix(T,N);return}this.t=0,this.s=0;for(var Q=T.length,ve=!1,we=0;--Q>=0;){var $e=H==8?T[Q]&255:m(T,Q);if($e<0){T.charAt(Q)=="-"&&(ve=!0);continue}ve=!1,we==0?this[this.t++]=$e:we+H>this.DB?(this[this.t-1]|=($e&(1<<this.DB-we)-1)<<we,this[this.t++]=$e>>this.DB-we):this[this.t-1]|=$e<<we,we+=H,we>=this.DB&&(we-=this.DB)}H==8&&T[0]&128&&(this.s=-1,we>0&&(this[this.t-1]|=(1<<this.DB-we)-1<<we)),this.clamp(),ve&&n.ZERO.subTo(this,this)}function B(){for(var T=this.s&this.DM;this.t>0&&this[this.t-1]==T;)--this.t}function I(T){if(this.s<0)return"-"+this.negate().toString(T);var N;if(T==16)N=4;else if(T==8)N=3;else if(T==2)N=1;else if(T==32)N=5;else if(T==4)N=2;else return this.toRadix(T);var H=(1<<N)-1,Q,ve=!1,we="",$e=this.t,Ne=this.DB-$e*this.DB%N;if($e-- >0)for(Ne<this.DB&&(Q=this[$e]>>Ne)>0&&(ve=!0,we=w(Q));$e>=0;)Ne<N?(Q=(this[$e]&(1<<Ne)-1)<<N-Ne,Q|=this[--$e]>>(Ne+=this.DB-N)):(Q=this[$e]>>(Ne-=N)&H,Ne<=0&&(Ne+=this.DB,--$e)),Q>0&&(ve=!0),ve&&(we+=w(Q));return ve?we:"0"}function M(){var T=i();return n.ZERO.subTo(this,T),T}function q(){return this.s<0?this.negate():this}function b(T){var N=this.s-T.s;if(N!=0)return N;var H=this.t;if(N=H-T.t,N!=0)return this.s<0?-N:N;for(;--H>=0;)if((N=this[H]-T[H])!=0)return N;return 0}function R(T){var N=1,H;return(H=T>>>16)!=0&&(T=H,N+=16),(H=T>>8)!=0&&(T=H,N+=8),(H=T>>4)!=0&&(T=H,N+=4),(H=T>>2)!=0&&(T=H,N+=2),(H=T>>1)!=0&&(T=H,N+=1),N}function L(){return this.t<=0?0:this.DB*(this.t-1)+R(this[this.t-1]^this.s&this.DM)}function j(T,N){var H;for(H=this.t-1;H>=0;--H)N[H+T]=this[H];for(H=T-1;H>=0;--H)N[H]=0;N.t=this.t+T,N.s=this.s}function G(T,N){for(var H=T;H<this.t;++H)N[H-T]=this[H];N.t=Math.max(this.t-T,0),N.s=this.s}function Y(T,N){var H=T%this.DB,Q=this.DB-H,ve=(1<<Q)-1,we=Math.floor(T/this.DB),$e=this.s<<H&this.DM,Ne;for(Ne=this.t-1;Ne>=0;--Ne)N[Ne+we+1]=this[Ne]>>Q|$e,$e=(this[Ne]&ve)<<H;for(Ne=we-1;Ne>=0;--Ne)N[Ne]=0;N[we]=$e,N.t=this.t+we+1,N.s=this.s,N.clamp()}function V(T,N){N.s=this.s;var H=Math.floor(T/this.DB);if(H>=this.t){N.t=0;return}var Q=T%this.DB,ve=this.DB-Q,we=(1<<Q)-1;N[0]=this[H]>>Q;for(var $e=H+1;$e<this.t;++$e)N[$e-H-1]|=(this[$e]&we)<<ve,N[$e-H]=this[$e]>>Q;Q>0&&(N[this.t-H-1]|=(this.s&we)<<ve),N.t=this.t-H,N.clamp()}function z(T,N){for(var H=0,Q=0,ve=Math.min(T.t,this.t);H<ve;)Q+=this[H]-T[H],N[H++]=Q&this.DM,Q>>=this.DB;if(T.t<this.t){for(Q-=T.s;H<this.t;)Q+=this[H],N[H++]=Q&this.DM,Q>>=this.DB;Q+=this.s}else{for(Q+=this.s;H<T.t;)Q-=T[H],N[H++]=Q&this.DM,Q>>=this.DB;Q-=T.s}N.s=Q<0?-1:0,Q<-1?N[H++]=this.DV+Q:Q>0&&(N[H++]=Q),N.t=H,N.clamp()}function J(T,N){var H=this.abs(),Q=T.abs(),ve=H.t;for(N.t=ve+Q.t;--ve>=0;)N[ve]=0;for(ve=0;ve<Q.t;++ve)N[ve+H.t]=H.am(0,Q[ve],N,ve,0,H.t);N.s=0,N.clamp(),this.s!=T.s&&n.ZERO.subTo(N,N)}function se(T){for(var N=this.abs(),H=T.t=2*N.t;--H>=0;)T[H]=0;for(H=0;H<N.t-1;++H){var Q=N.am(H,N[H],T,2*H,0,1);(T[H+N.t]+=N.am(H+1,2*N[H],T,2*H+1,Q,N.t-H-1))>=N.DV&&(T[H+N.t]-=N.DV,T[H+N.t+1]=1)}T.t>0&&(T[T.t-1]+=N.am(H,N[H],T,2*H,0,1)),T.s=0,T.clamp()}function De(T,N,H){var Q=T.abs();if(!(Q.t<=0)){var ve=this.abs();if(ve.t<Q.t){N?.fromInt(0),H!=null&&this.copyTo(H);return}H==null&&(H=i());var we=i(),$e=this.s,Ne=T.s,Qt=this.DB-R(Q[Q.t-1]);Qt>0?(Q.lShiftTo(Qt,we),ve.lShiftTo(Qt,H)):(Q.copyTo(we),ve.copyTo(H));var Dr=we.t,hn=we[Dr-1];if(hn!=0){var pn=hn*(1<<this.F1)+(Dr>1?we[Dr-2]>>this.F2:0),di=this.FV/pn,xu=(1<<this.F1)/pn,xn=1<<this.F2,dn=H.t,ku=dn-Dr,Oi=N??i();for(we.dlShiftTo(ku,Oi),H.compareTo(Oi)>=0&&(H[H.t++]=1,H.subTo(Oi,H)),n.ONE.dlShiftTo(Dr,Oi),Oi.subTo(we,we);we.t<Dr;)we[we.t++]=0;for(;--ku>=0;){var Ea=H[--dn]==hn?this.DM:Math.floor(H[dn]*di+(H[dn-1]+xn)*xu);if((H[dn]+=we.am(0,Ea,H,ku,0,Dr))<Ea)for(we.dlShiftTo(ku,Oi),H.subTo(Oi,H);H[dn]<--Ea;)H.subTo(Oi,H)}N!=null&&(H.drShiftTo(Dr,N),$e!=Ne&&n.ZERO.subTo(N,N)),H.t=Dr,H.clamp(),Qt>0&&H.rShiftTo(Qt,H),$e<0&&n.ZERO.subTo(H,H)}}}function ye(T){var N=i();return this.abs().divRemTo(T,null,N),this.s<0&&N.compareTo(n.ZERO)>0&&T.subTo(N,N),N}function Pe(T){this.m=T}function Qe(T){return T.s<0||T.compareTo(this.m)>=0?T.mod(this.m):T}function ce(T){return T}function Be(T){T.divRemTo(this.m,null,T)}function Ge(T,N,H){T.multiplyTo(N,H),this.reduce(H)}function Tr(T,N){T.squareTo(N),this.reduce(N)}Pe.prototype.convert=Qe,Pe.prototype.revert=ce,Pe.prototype.reduce=Be,Pe.prototype.mulTo=Ge,Pe.prototype.sqrTo=Tr;function Jt(){if(this.t<1)return 0;var T=this[0];if(!(T&1))return 0;var N=T&3;return N=N*(2-(T&15)*N)&15,N=N*(2-(T&255)*N)&255,N=N*(2-((T&65535)*N&65535))&65535,N=N*(2-T*N%this.DV)%this.DV,N>0?this.DV-N:-N}function St(T){this.m=T,this.mp=T.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<T.DB-15)-1,this.mt2=2*T.t}function wr(T){var N=i();return T.abs().dlShiftTo(this.m.t,N),N.divRemTo(this.m,null,N),T.s<0&&N.compareTo(n.ZERO)>0&&this.m.subTo(N,N),N}function cr(T){var N=i();return T.copyTo(N),this.reduce(N),N}function vt(T){for(;T.t<=this.mt2;)T[T.t++]=0;for(var N=0;N<this.m.t;++N){var H=T[N]&32767,Q=H*this.mpl+((H*this.mph+(T[N]>>15)*this.mpl&this.um)<<15)&T.DM;for(H=N+this.m.t,T[H]+=this.m.am(0,Q,T,N,0,this.m.t);T[H]>=T.DV;)T[H]-=T.DV,T[++H]++}T.clamp(),T.drShiftTo(this.m.t,T),T.compareTo(this.m)>=0&&T.subTo(this.m,T)}function Xt(T,N){T.squareTo(N),this.reduce(N)}function at(T,N,H){T.multiplyTo(N,H),this.reduce(H)}St.prototype.convert=wr,St.prototype.revert=cr,St.prototype.reduce=vt,St.prototype.mulTo=at,St.prototype.sqrTo=Xt;function Je(){return(this.t>0?this[0]&1:this.s)==0}function lr(T,N){if(T>4294967295||T<1)return n.ONE;var H=i(),Q=i(),ve=N.convert(this),we=R(T)-1;for(ve.copyTo(H);--we>=0;)if(N.sqrTo(H,Q),(T&1<<we)>0)N.mulTo(Q,ve,H);else{var $e=H;H=Q,Q=$e}return N.revert(H)}function Ve(T,N){var H;return T<256||N.isEven()?H=new Pe(N):H=new St(N),this.exp(T,H)}n.prototype.copyTo=y,n.prototype.fromInt=A,n.prototype.fromString=S,n.prototype.clamp=B,n.prototype.dlShiftTo=j,n.prototype.drShiftTo=G,n.prototype.lShiftTo=Y,n.prototype.rShiftTo=V,n.prototype.subTo=z,n.prototype.multiplyTo=J,n.prototype.squareTo=se,n.prototype.divRemTo=De,n.prototype.invDigit=Jt,n.prototype.isEven=Je,n.prototype.exp=lr,n.prototype.toString=I,n.prototype.negate=M,n.prototype.abs=q,n.prototype.compareTo=b,n.prototype.bitLength=L,n.prototype.mod=ye,n.prototype.modPowInt=Ve,n.ZERO=C(0),n.ONE=C(1);function Lt(){var T=i();return this.copyTo(T),T}function un(){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 ir(){return this.t==0?this.s:this[0]<<24>>24}function Zt(){return this.t==0?this.s:this[0]<<16>>16}function wt(T){return Math.floor(Math.LN2*this.DB/Math.log(T))}function Or(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function pi(T){if(T==null&&(T=10),this.signum()==0||T<2||T>36)return"0";var N=this.chunkSize(T),H=Math.pow(T,N),Q=C(H),ve=i(),we=i(),$e="";for(this.divRemTo(Q,ve,we);ve.signum()>0;)$e=(H+we.intValue()).toString(T).substr(1)+$e,ve.divRemTo(Q,ve,we);return we.intValue().toString(T)+$e}function an(T,N){this.fromInt(0),N==null&&(N=10);for(var H=this.chunkSize(N),Q=Math.pow(N,H),ve=!1,we=0,$e=0,Ne=0;Ne<T.length;++Ne){var Qt=m(T,Ne);if(Qt<0){T.charAt(Ne)=="-"&&this.signum()==0&&(ve=!0);continue}$e=N*$e+Qt,++we>=H&&(this.dMultiply(Q),this.dAddOffset($e,0),we=0,$e=0)}we>0&&(this.dMultiply(Math.pow(N,we)),this.dAddOffset($e,0)),ve&&n.ZERO.subTo(this,this)}function It(T,N,H){if(typeof N=="number")if(T<2)this.fromInt(1);else for(this.fromNumber(T,H),this.testBit(T-1)||this.bitwiseTo(n.ONE.shiftLeft(T-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(N);)this.dAddOffset(2,0),this.bitLength()>T&&this.subTo(n.ONE.shiftLeft(T-1),this);else{var Q=new Array,ve=T&7;Q.length=(T>>3)+1,N.nextBytes(Q),ve>0?Q[0]&=(1<<ve)-1:Q[0]=0,this.fromString(Q,256)}}function qe(){var T=this.t,N=new Array;N[0]=this.s;var H=this.DB-T*this.DB%8,Q,ve=0;if(T-- >0)for(H<this.DB&&(Q=this[T]>>H)!=(this.s&this.DM)>>H&&(N[ve++]=Q|this.s<<this.DB-H);T>=0;)H<8?(Q=(this[T]&(1<<H)-1)<<8-H,Q|=this[--T]>>(H+=this.DB-8)):(Q=this[T]>>(H-=8)&255,H<=0&&(H+=this.DB,--T)),Q&128&&(Q|=-256),ve==0&&(this.s&128)!=(Q&128)&&++ve,(ve>0||Q!=this.s)&&(N[ve++]=Q);return N}function _e(T){return this.compareTo(T)==0}function Cr(T){return this.compareTo(T)<0?this:T}function on(T){return this.compareTo(T)>0?this:T}function ot(T,N,H){var Q,ve,we=Math.min(T.t,this.t);for(Q=0;Q<we;++Q)H[Q]=N(this[Q],T[Q]);if(T.t<this.t){for(ve=T.s&this.DM,Q=we;Q<this.t;++Q)H[Q]=N(this[Q],ve);H.t=this.t}else{for(ve=this.s&this.DM,Q=we;Q<T.t;++Q)H[Q]=N(ve,T[Q]);H.t=T.t}H.s=N(this.s,T.s),H.clamp()}function Ks(T,N){return T&N}function cn(T){var N=i();return this.bitwiseTo(T,Ks,N),N}function ge(T,N){return T|N}function cs(T){var N=i();return this.bitwiseTo(T,ge,N),N}function Tt(T,N){return T^N}function Yr(T){var N=i();return this.bitwiseTo(T,Tt,N),N}function Ji(T,N){return T&~N}function Pu(T){var N=i();return this.bitwiseTo(T,Ji,N),N}function ls(){for(var T=i(),N=0;N<this.t;++N)T[N]=this.DM&~this[N];return T.t=this.t,T.s=~this.s,T}function Ru(T){var N=i();return T<0?this.rShiftTo(-T,N):this.lShiftTo(T,N),N}function hs(T){var N=i();return T<0?this.lShiftTo(-T,N):this.rShiftTo(T,N),N}function Xi(T){if(T==0)return-1;var N=0;return T&65535||(T>>=16,N+=16),T&255||(T>>=8,N+=8),T&15||(T>>=4,N+=4),T&3||(T>>=2,N+=2),T&1||++N,N}function Ut(){for(var T=0;T<this.t;++T)if(this[T]!=0)return T*this.DB+Xi(this[T]);return this.s<0?this.t*this.DB:-1}function zn(T){for(var N=0;T!=0;)T&=T-1,++N;return N}function Tu(){for(var T=0,N=this.s&this.DM,H=0;H<this.t;++H)T+=zn(this[H]^N);return T}function Ou(T){var N=Math.floor(T/this.DB);return N>=this.t?this.s!=0:(this[N]&1<<T%this.DB)!=0}function Nu(T,N){var H=n.ONE.shiftLeft(T);return this.bitwiseTo(H,N,H),H}function ps(T){return this.changeBit(T,ge)}function ca(T){return this.changeBit(T,Ji)}function ds(T){return this.changeBit(T,Tt)}function la(T,N){for(var H=0,Q=0,ve=Math.min(T.t,this.t);H<ve;)Q+=this[H]+T[H],N[H++]=Q&this.DM,Q>>=this.DB;if(T.t<this.t){for(Q+=T.s;H<this.t;)Q+=this[H],N[H++]=Q&this.DM,Q>>=this.DB;Q+=this.s}else{for(Q+=this.s;H<T.t;)Q+=T[H],N[H++]=Q&this.DM,Q>>=this.DB;Q+=T.s}N.s=Q<0?-1:0,Q>0?N[H++]=Q:Q<-1&&(N[H++]=this.DV+Q),N.t=H,N.clamp()}function Vs(T){var N=i();return this.addTo(T,N),N}function re(T){var N=i();return this.subTo(T,N),N}function fe(T){var N=i();return this.multiplyTo(T,N),N}function je(){var T=i();return this.squareTo(T),T}function xe(T){var N=i();return this.divRemTo(T,N,null),N}function We(T){var N=i();return this.divRemTo(T,null,N),N}function ct(T){var N=i(),H=i();return this.divRemTo(T,N,H),new Array(N,H)}function gt(T){this[this.t]=this.am(0,T-1,this,0,0,this.t),++this.t,this.clamp()}function Br(T,N){if(T!=0){for(;this.t<=N;)this[this.t++]=0;for(this[N]+=T;this[N]>=this.DV;)this[N]-=this.DV,++N>=this.t&&(this[this.t++]=0),++this[N]}}function Kt(){}function Yn(T){return T}function Ti(T,N,H){T.multiplyTo(N,H)}function ln(T,N){T.squareTo(N)}Kt.prototype.convert=Yn,Kt.prototype.revert=Yn,Kt.prototype.mulTo=Ti,Kt.prototype.sqrTo=ln;function An(T){return this.exp(T,new Kt)}function yr(T,N,H){var Q=Math.min(this.t+T.t,N);for(H.s=0,H.t=Q;Q>0;)H[--Q]=0;var ve;for(ve=H.t-this.t;Q<ve;++Q)H[Q+this.t]=this.am(0,T[Q],H,Q,0,this.t);for(ve=Math.min(T.t,N);Q<ve;++Q)this.am(0,T[Q],H,Q,0,N-Q);H.clamp()}function fn(T,N,H){--N;var Q=H.t=this.t+T.t-N;for(H.s=0;--Q>=0;)H[Q]=0;for(Q=Math.max(N-this.t,0);Q<T.t;++Q)H[this.t+Q-N]=this.am(N-Q,T[Q],H,0,0,this.t+Q-N);H.clamp(),H.drShiftTo(1,H)}function Mr(T){this.r2=i(),this.q3=i(),n.ONE.dlShiftTo(2*T.t,this.r2),this.mu=this.r2.divide(T),this.m=T}function fa(T){if(T.s<0||T.t>2*this.m.t)return T.mod(this.m);if(T.compareTo(this.m)<0)return T;var N=i();return T.copyTo(N),this.reduce(N),N}function gs(T){return T}function Rn(T){for(T.drShiftTo(this.m.t-1,this.r2),T.t>this.m.t+1&&(T.t=this.m.t+1,T.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);T.compareTo(this.r2)<0;)T.dAddOffset(1,this.m.t+1);for(T.subTo(this.r2,T);T.compareTo(this.m)>=0;)T.subTo(this.m,T)}function xt(T,N){T.squareTo(N),this.reduce(N)}function Fr(T,N,H){T.multiplyTo(N,H),this.reduce(H)}Mr.prototype.convert=fa,Mr.prototype.revert=gs,Mr.prototype.reduce=Rn,Mr.prototype.mulTo=Fr,Mr.prototype.sqrTo=xt;function it(T,N){var H=T.bitLength(),Q,ve=C(1),we;if(H<=0)return ve;H<18?Q=1:H<48?Q=3:H<144?Q=4:H<768?Q=5:Q=6,H<8?we=new Pe(N):N.isEven()?we=new Mr(N):we=new St(N);var $e=new Array,Ne=3,Qt=Q-1,Dr=(1<<Q)-1;if($e[1]=we.convert(this),Q>1){var hn=i();for(we.sqrTo($e[1],hn);Ne<=Dr;)$e[Ne]=i(),we.mulTo(hn,$e[Ne-2],$e[Ne]),Ne+=2}var pn=T.t-1,di,xu=!0,xn=i(),dn;for(H=R(T[pn])-1;pn>=0;){for(H>=Qt?di=T[pn]>>H-Qt&Dr:(di=(T[pn]&(1<<H+1)-1)<<Qt-H,pn>0&&(di|=T[pn-1]>>this.DB+H-Qt)),Ne=Q;!(di&1);)di>>=1,--Ne;if((H-=Ne)<0&&(H+=this.DB,--pn),xu)$e[di].copyTo(ve),xu=!1;else{for(;Ne>1;)we.sqrTo(ve,xn),we.sqrTo(xn,ve),Ne-=2;Ne>0?we.sqrTo(ve,xn):(dn=ve,ve=xn,xn=dn),we.mulTo(xn,$e[di],ve)}for(;pn>=0&&!(T[pn]&1<<H);)we.sqrTo(ve,xn),dn=ve,ve=xn,xn=dn,--H<0&&(H=this.DB-1,--pn)}return we.revert(ve)}function fr(T){var N=this.s<0?this.negate():this.clone(),H=T.s<0?T.negate():T.clone();if(N.compareTo(H)<0){var Q=N;N=H,H=Q}var ve=N.getLowestSetBit(),we=H.getLowestSetBit();if(we<0)return N;for(ve<we&&(we=ve),we>0&&(N.rShiftTo(we,N),H.rShiftTo(we,H));N.signum()>0;)(ve=N.getLowestSetBit())>0&&N.rShiftTo(ve,N),(ve=H.getLowestSetBit())>0&&H.rShiftTo(ve,H),N.compareTo(H)>=0?(N.subTo(H,N),N.rShiftTo(1,N)):(H.subTo(N,H),H.rShiftTo(1,H));return we>0&&H.lShiftTo(we,H),H}function Wr(T){if(T<=0)return 0;var N=this.DV%T,H=this.s<0?T-1:0;if(this.t>0)if(N==0)H=this[0]%T;else for(var Q=this.t-1;Q>=0;--Q)H=(N*H+this[Q])%T;return H}function hr(T){var N=T.isEven();if(this.isEven()&&N||T.signum()==0)return n.ZERO;for(var H=T.clone(),Q=this.clone(),ve=C(1),we=C(0),$e=C(0),Ne=C(1);H.signum()!=0;){for(;H.isEven();)H.rShiftTo(1,H),N?((!ve.isEven()||!we.isEven())&&(ve.addTo(this,ve),we.subTo(T,we)),ve.rShiftTo(1,ve)):we.isEven()||we.subTo(T,we),we.rShiftTo(1,we);for(;Q.isEven();)Q.rShiftTo(1,Q),N?((!$e.isEven()||!Ne.isEven())&&($e.addTo(this,$e),Ne.subTo(T,Ne)),$e.rShiftTo(1,$e)):Ne.isEven()||Ne.subTo(T,Ne),Ne.rShiftTo(1,Ne);H.compareTo(Q)>=0?(H.subTo(Q,H),N&&ve.subTo($e,ve),we.subTo(Ne,we)):(Q.subTo(H,Q),N&&$e.subTo(ve,$e),Ne.subTo(we,Ne))}if(Q.compareTo(n.ONE)!=0)return n.ZERO;if(Ne.compareTo(T)>=0)return Ne.subtract(T);if(Ne.signum()<0)Ne.addTo(T,Ne);else return Ne;return Ne.signum()<0?Ne.add(T):Ne}var Vt=[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],Tn=(1<<26)/Vt[Vt.length-1];function Wn(T){var N,H=this.abs();if(H.t==1&&H[0]<=Vt[Vt.length-1]){for(N=0;N<Vt.length;++N)if(H[0]==Vt[N])return!0;return!1}if(H.isEven())return!1;for(N=1;N<Vt.length;){for(var Q=Vt[N],ve=N+1;ve<Vt.length&&Q<Tn;)Q*=Vt[ve++];for(Q=H.modInt(Q);N<ve;)if(Q%Vt[N++]==0)return!1}return H.millerRabin(T)}function Jn(T){var N=this.subtract(n.ONE),H=N.getLowestSetBit();if(H<=0)return!1;var Q=N.shiftRight(H);T=T+1>>1,T>Vt.length&&(T=Vt.length);for(var ve=i(),we=0;we<T;++we){ve.fromInt(Vt[Math.floor(Math.random()*Vt.length)]);var $e=ve.modPow(Q,this);if($e.compareTo(n.ONE)!=0&&$e.compareTo(N)!=0){for(var Ne=1;Ne++<H&&$e.compareTo(N)!=0;)if($e=$e.modPowInt(2,this),$e.compareTo(n.ONE)==0)return!1;if($e.compareTo(N)!=0)return!1}}return!0}n.prototype.chunkSize=wt,n.prototype.toRadix=pi,n.prototype.fromRadix=an,n.prototype.fromNumber=It,n.prototype.bitwiseTo=ot,n.prototype.changeBit=Nu,n.prototype.addTo=la,n.prototype.dMultiply=gt,n.prototype.dAddOffset=Br,n.prototype.multiplyLowerTo=yr,n.prototype.multiplyUpperTo=fn,n.prototype.modInt=Wr,n.prototype.millerRabin=Jn,n.prototype.clone=Lt,n.prototype.intValue=un,n.prototype.byteValue=ir,n.prototype.shortValue=Zt,n.prototype.signum=Or,n.prototype.toByteArray=qe,n.prototype.equals=_e,n.prototype.min=Cr,n.prototype.max=on,n.prototype.and=cn,n.prototype.or=cs,n.prototype.xor=Yr,n.prototype.andNot=Pu,n.prototype.not=ls,n.prototype.shiftLeft=Ru,n.prototype.shiftRight=hs,n.prototype.getLowestSetBit=Ut,n.prototype.bitCount=Tu,n.prototype.testBit=Ou,n.prototype.setBit=ps,n.prototype.clearBit=ca,n.prototype.flipBit=ds,n.prototype.add=Vs,n.prototype.subtract=re,n.prototype.multiply=fe,n.prototype.divide=xe,n.prototype.remainder=We,n.prototype.divideAndRemainder=ct,n.prototype.modPow=it,n.prototype.modInverse=hr,n.prototype.pow=An,n.prototype.gcd=fr,n.prototype.isProbablePrime=Wn,n.prototype.square=je,n.prototype.Barrett=Mr;var On,Nr,dr;function lc(T){Nr[dr++]^=T&255,Nr[dr++]^=T>>8&255,Nr[dr++]^=T>>16&255,Nr[dr++]^=T>>24&255,dr>=Nn&&(dr-=Nn)}function ha(){lc(new Date().getTime())}if(Nr==null){Nr=new Array,dr=0;var Jr;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var pa=new Uint8Array(32);for(window.crypto.getRandomValues(pa),Jr=0;Jr<32;++Jr)Nr[dr++]=pa[Jr]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var eo=window.crypto.random(32);for(Jr=0;Jr<eo.length;++Jr)Nr[dr++]=eo.charCodeAt(Jr)&255}}for(;dr<Nn;)Jr=Math.floor(65536*Math.random()),Nr[dr++]=Jr>>>8,Nr[dr++]=Jr&255;dr=0,ha()}function to(){if(On==null){for(ha(),On=va(),On.init(Nr),dr=0;dr<Nr.length;++dr)Nr[dr]=0;dr=0}return On.next()}function da(T){var N;for(N=0;N<T.length;++N)T[N]=to()}function vs(){}vs.prototype.nextBytes=da;function ga(){this.i=0,this.j=0,this.S=new Array}function ro(T){var N,H,Q;for(N=0;N<256;++N)this.S[N]=N;for(H=0,N=0;N<256;++N)H=H+this.S[N]+T[N%T.length]&255,Q=this.S[N],this.S[N]=this.S[H],this.S[H]=Q;this.i=0,this.j=0}function ma(){var T;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,T=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=T,this.S[T+this.S[this.i]&255]}ga.prototype.init=ro,ga.prototype.next=ma;function va(){return new ga}var Nn=256;typeof Cf<"u"?Cf=xm.exports={default:n,BigInteger:n,SecureRandom:vs}:this.jsbn={BigInteger:n,SecureRandom:vs}}).call(Cf)});var kc=Se(yf=>{(function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(s){return n(u(s),arguments)}function r(s,o){return t.apply(null,[s].concat(o||[]))}function n(s,o){var l=1,f=s.length,p,E="",d,h,w,m,y,A,C,S;for(d=0;d<f;d++)if(typeof s[d]=="string")E+=s[d];else if(typeof s[d]=="object"){if(w=s[d],w.keys)for(p=o[l],h=0;h<w.keys.length;h++){if(p==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',w.keys[h],w.keys[h-1]));p=p[w.keys[h]]}else w.param_no?p=o[w.param_no]:p=o[l++];if(e.not_type.test(w.type)&&e.not_primitive.test(w.type)&&p instanceof Function&&(p=p()),e.numeric_arg.test(w.type)&&typeof p!="number"&&isNaN(p))throw new TypeError(t("[sprintf] expecting number but found %T",p));switch(e.number.test(w.type)&&(C=p>=0),w.type){case"b":p=parseInt(p,10).toString(2);break;case"c":p=String.fromCharCode(parseInt(p,10));break;case"d":case"i":p=parseInt(p,10);break;case"j":p=JSON.stringify(p,null,w.width?parseInt(w.width):0);break;case"e":p=w.precision?parseFloat(p).toExponential(w.precision):parseFloat(p).toExponential();break;case"f":p=w.precision?parseFloat(p).toFixed(w.precision):parseFloat(p);break;case"g":p=w.precision?String(Number(p.toPrecision(w.precision))):parseFloat(p);break;case"o":p=(parseInt(p,10)>>>0).toString(8);break;case"s":p=String(p),p=w.precision?p.substring(0,w.precision):p;break;case"t":p=String(!!p),p=w.precision?p.substring(0,w.precision):p;break;case"T":p=Object.prototype.toString.call(p).slice(8,-1).toLowerCase(),p=w.precision?p.substring(0,w.precision):p;break;case"u":p=parseInt(p,10)>>>0;break;case"v":p=p.valueOf(),p=w.precision?p.substring(0,w.precision):p;break;case"x":p=(parseInt(p,10)>>>0).toString(16);break;case"X":p=(parseInt(p,10)>>>0).toString(16).toUpperCase();break}e.json.test(w.type)?E+=p:(e.number.test(w.type)&&(!C||w.sign)?(S=C?"+":"-",p=p.toString().replace(e.sign,"")):S="",y=w.pad_char?w.pad_char==="0"?"0":w.pad_char.charAt(1):" ",A=w.width-(S+p).length,m=w.width&&A>0?y.repeat(A):"",E+=w.align?S+p+m:y==="0"?S+m+p:m+S+p)}return E}var i=Object.create(null);function u(s){if(i[s])return i[s];for(var o=s,l,f=[],p=0;o;){if((l=e.text.exec(o))!==null)f.push(l[0]);else if((l=e.modulo.exec(o))!==null)f.push("%");else if((l=e.placeholder.exec(o))!==null){if(l[2]){p|=1;var E=[],d=l[2],h=[];if((h=e.key.exec(d))!==null)for(E.push(h[1]);(d=d.substring(h[0].length))!=="";)if((h=e.key_access.exec(d))!==null)E.push(h[1]);else if((h=e.index_access.exec(d))!==null)E.push(h[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");l[2]=E}else p|=2;if(p===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");f.push({placeholder:l[0],param_no:l[1],keys:l[2],sign:l[3],pad_char:l[4],align:l[5],width:l[6],precision:l[7],type:l[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");o=o.substring(l[0].length)}return i[s]=f}typeof yf<"u"&&(yf.sprintf=t,yf.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var pp=Se(Ds=>{"use strict";var LS=Ds&&Ds.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),US=Ds&&Ds.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Um=Ds&&Ds.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&LS(t,e,r);return US(t,e),t};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.Address4=void 0;var km=Um(op()),ns=Um(cp()),Lm=wf(),Lc=fp(),Bo=kc(),hp=class e{constructor(t){this.groups=ns.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=km.isCorrect(ns.BITS),this.isInSubnet=km.isInSubnet,this.address=t;let r=ns.RE_SUBNET_STRING.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>ns.BITS)throw new Lm.AddressError("Invalid subnet mask.");t=t.replace(ns.RE_SUBNET_STRING,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let r=t.split(".");if(!t.match(ns.RE_ADDRESS))throw new Lm.AddressError("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let r=t.replace(/:/g,"").padStart(8,"0"),n=[],i;for(i=0;i<8;i+=2){let u=r.slice(i,i+2);n.push(parseInt(u,16))}return new e(n.join("."))}static fromInteger(t){return e.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new e(n)}toHex(){return this.parsedAddress.map(t=>(0,Bo.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r<ns.GROUPS;r+=2){let n=(0,Bo.sprintf)("%02x%02x",parseInt(this.parsedAddress[r],10),parseInt(this.parsedAddress[r+1],10));t.push((0,Bo.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new Lc.BigInteger(this.parsedAddress.map(t=>(0,Bo.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new Lc.BigInteger(this.mask()+"0".repeat(ns.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new Lc.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new Lc.BigInteger(this.mask()+"1".repeat(ns.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new Lc.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return e.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}reverseForm(t){t||(t={});let r=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?r:(0,Bo.sprintf)("%s.in-addr.arpa.",r)}isMulticast(){return this.isInSubnet(new e("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(ns.BITS,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(ns.RE_ADDRESS,(0,Bo.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};Ds.Address4=hp});var dp=Se(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.RE_URL_WITH_PORT=_r.RE_URL=_r.RE_ZONE_STRING=_r.RE_SUBNET_STRING=_r.RE_BAD_ADDRESS=_r.RE_BAD_CHARACTERS=_r.TYPES=_r.SCOPES=_r.GROUPS=_r.BITS=void 0;_r.BITS=128;_r.GROUPS=8;_r.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};_r.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","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"};_r.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;_r.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;_r.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;_r.RE_ZONE_STRING=/%.*$/;_r.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);_r.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)});var gp=Se(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.simpleGroup=Ss.spanLeadingZeroes=Ss.spanAll=Ss.spanAllZeroes=void 0;var Hm=kc();function jm(e){return e.replace(/(0+)/g,'<span class="zero">$1</span>')}Ss.spanAllZeroes=jm;function HS(e,t=0){return e.split("").map((n,i)=>(0,Hm.sprintf)('<span class="digit value-%s position-%d">%s</span>',n,i+t,jm(n))).join("")}Ss.spanAll=HS;function Mm(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}function jS(e){return e.split(":").map(r=>Mm(r)).join(":")}Ss.spanLeadingZeroes=jS;function MS(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,Hm.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,Mm(n)))}Ss.simpleGroup=MS});var qm=Se(en=>{"use strict";var qS=en&&en.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),KS=en&&en.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),VS=en&&en.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&qS(t,e,r);return KS(t,e),t};Object.defineProperty(en,"__esModule",{value:!0});en.possibleElisions=en.simpleRegularExpression=en.ADDRESS_BOUNDARY=en.padGroup=en.groupPossibilities=void 0;var GS=VS(dp()),$o=kc();function Df(e){return(0,$o.sprintf)("(%s)",e.join("|"))}en.groupPossibilities=Df;function Ff(e){return e.length<4?(0,$o.sprintf)("0{0,%d}%s",4-e.length,e):e}en.padGroup=Ff;en.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function zS(e){let t=[];e.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let r=t.map(n=>e.map((i,u)=>{if(u===n){let s=u===0||u===GS.GROUPS-1?":":"";return Df([Ff(i),s])}return Ff(i)}).join(":"));return r.push(e.map(Ff).join(":")),Df(r)}en.simpleRegularExpression=zS;function YS(e,t,r){let n=t?"":":",i=r?"":":",u=[];!t&&!r&&u.push("::"),t&&r&&u.push(""),(r&&!t||!r&&t)&&u.push(":"),u.push((0,$o.sprintf)("%s(:0{1,4}){1,%d}",n,e-1)),u.push((0,$o.sprintf)("(0{1,4}:){1,%d}%s",e-1,i)),u.push((0,$o.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let s=1;s<e-1;s++)for(let o=1;o<e-s;o++)u.push((0,$o.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",o,e-o-s-1));return Df(u)}en.possibleElisions=YS});var zm=Se(bs=>{"use strict";var WS=bs&&bs.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),JS=bs&&bs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),bf=bs&&bs.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&WS(t,e,r);return JS(t,e),t};Object.defineProperty(bs,"__esModule",{value:!0});bs.Address6=void 0;var Km=bf(op()),mp=bf(cp()),ar=bf(dp()),vp=bf(gp()),Oa=pp(),Na=qm(),cu=wf(),qn=fp(),Kn=kc();function Sf(e){if(!e)throw new Error("Assertion failed.")}function XS(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function ZS(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 QS(e,t){let r=[],n=[],i;for(i=0;i<e.length;i++)i<t[0]?r.push(e[i]):i>t[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function Vm(e){return(0,Kn.sprintf)("%04x",parseInt(e,16))}function Gm(e){return e&255}var Ep=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=Km.isInSubnet,this.isCorrect=Km.isCorrect(ar.BITS),r===void 0?this.groups=ar.GROUPS:this.groups=r,this.address=t;let n=ar.RE_SUBNET_STRING.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>ar.BITS)throw new cu.AddressError("Invalid subnet mask.");t=t.replace(ar.RE_SUBNET_STRING,"")}else if(/\//.test(t))throw new cu.AddressError("Invalid subnet mask.");let i=ar.RE_ZONE_STRING.exec(t);i&&(this.zone=i[0],t=t.replace(ar.RE_ZONE_STRING,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInteger(t){let r=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i<ar.GROUPS;i++)n.push(r.slice(i*4,(i+1)*4));return new e(n.join(":"))}static fromURL(t){let r,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=ar.RE_URL_WITH_PORT.exec(t),i===null)return{error:"failed to parse address with port",address:null,port:null};r=i[1],n=i[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),i=ar.RE_URL.exec(t),i===null)return{error:"failed to parse address from URL",address:null,port:null};r=i[1]}else r=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new e(r),port:n}}static fromAddress4(t){let r=new Oa.Address4(t),n=ar.BITS-(mp.BITS-r.subnetMask);return new e(`::ffff:${r.correctForm()}/${n}`)}static fromArpa(t){let r=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(r.length!==63)throw new cu.AddressError("Invalid 'ip6.arpa' form.");let i=r.split(".").reverse();for(let u=n;u>0;u--){let s=u*4;i.splice(s,0,":")}return r=i.join(""),new e(r)}microsoftTranscription(){return(0,Kn.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=ar.BITS-this.subnetMask,n=Math.abs(t-ar.BITS),i=r-n;return i<0?"0":XS(new qn.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new qn.BigInteger(this.mask()+"0".repeat(ar.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new qn.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new qn.BigInteger(this.mask()+"1".repeat(ar.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new qn.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=ar.SCOPES[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(ar.TYPES))if(this.isInSubnet(new e(t)))return ar.TYPES[t];return"Global unicast"}getBits(t,r){return new qn.BigInteger(this.getBitsBase2(t,r),2)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}getBitsBase16(t,r){let n=r-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,r).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,ar.BITS)}reverseForm(t){t||(t={});let r=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?t.omitSuffix?n:(0,Kn.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let o=parseInt(this.parsedAddress[t],16);o===0&&n++,o!==0&&n>0&&(n>1&&i.push([t-n,t-1]),n=0)}n>1&&i.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let u=i.map(o=>o[1]-o[0]+1);if(i.length>0){let o=u.indexOf(Math.max(...u));r=QS(this.parsedAddress,i[o])}else r=this.parsedAddress;for(t=0;t<r.length;t++)r[t]!=="compact"&&(r[t]=parseInt(r[t],16).toString(16));let s=r.join(":");return s=s.replace(/^compact$/,"::"),s=s.replace(/^compact|compact$/,":"),s=s.replace(/compact/,""),s}binaryZeroPad(){return this.bigInteger().toString(2).padStart(ar.BITS,"0")}parse4in6(t){let r=t.split(":"),i=r.slice(-1)[0].match(mp.RE_ADDRESS);if(i){this.parsedAddress4=i[0],this.address4=new Oa.Address4(this.parsedAddress4);for(let u=0;u<this.address4.groups;u++)if(/^0[0-9]+/.test(this.address4.parsedAddress[u]))throw new cu.AddressError("IPv4 addresses can't have leading zeroes.",t.replace(mp.RE_ADDRESS,this.address4.parsedAddress.map(ZS).join(".")));this.v4=!0,r[r.length-1]=this.address4.toGroup6(),t=r.join(":")}return t}parse(t){t=this.parse4in6(t);let r=t.match(ar.RE_BAD_CHARACTERS);if(r)throw new cu.AddressError((0,Kn.sprintf)("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),t.replace(ar.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));let n=t.match(ar.RE_BAD_ADDRESS);if(n)throw new cu.AddressError((0,Kn.sprintf)("Address failed regex: %s",n.join("")),t.replace(ar.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let i=[],u=t.split("::");if(u.length===2){let s=u[0].split(":"),o=u[1].split(":");s.length===1&&s[0]===""&&(s=[]),o.length===1&&o[0]===""&&(o=[]);let l=this.groups-(s.length+o.length);if(!l)throw new cu.AddressError("Error parsing groups");this.elidedGroups=l,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,i=i.concat(s);for(let f=0;f<l;f++)i.push("0");i=i.concat(o)}else if(u.length===1)i=t.split(":"),this.elidedGroups=0;else throw new cu.AddressError("Too many :: groups found");if(i=i.map(s=>(0,Kn.sprintf)("%x",parseInt(s,16))),i.length!==this.groups)throw new cu.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Vm).join(":")}decimal(){return this.parsedAddress.map(t=>(0,Kn.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new qn.BigInteger(this.parsedAddress.map(Vm).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return Oa.Address4.fromHex(new qn.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new qn.BigInteger("ffff",16)).toString(),n=Oa.Address4.fromHex(this.getBitsBase16(32,64)),i=Oa.Address4.fromHex(this.getBits(96,128).xor(new qn.BigInteger("ffffffff",16)).toString(16)),u=this.getBits(64,80),s=this.getBitsBase2(64,80),o=u.testBit(15),l=u.testBit(14),f=u.testBit(8),p=u.testBit(9),E=new qn.BigInteger(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:(0,Kn.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:s,coneNat:o,microsoft:{reserved:l,universalLocal:p,groupIndividual:f,nonce:E},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),r=Oa.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:(0,Kn.sprintf)("%s",t.slice(0,4)),gateway:r.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new e(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Gm)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Gm))}static fromUnsignedByteArray(t){let r=new qn.BigInteger("256",10),n=new qn.BigInteger("0",10),i=new qn.BigInteger("1",10);for(let u=t.length-1;u>=0;u--)n=n.add(i.multiply(new qn.BigInteger(t[u].toString(10),10))),i=i.multiply(r);return e.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new e("2001::/32"))}is6to4(){return this.isInSubnet(new e("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,Kn.sprintf)(":%s",t),(0,Kn.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let r=this.correctForm;return t.v4&&(r=this.to4in6),t.className?(0,Kn.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,r.call(this),t.className):(0,Kn.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,r.call(this))}group(){if(this.elidedGroups===0)return vp.simpleGroup(this.address).join(":");Sf(typeof this.elidedGroups=="number"),Sf(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...vp.simpleGroup(r)):t.push("");let i=["hover-group"];for(let u=this.elisionBegin;u<this.elisionBegin+this.elidedGroups;u++)i.push((0,Kn.sprintf)("group-%d",u));return t.push((0,Kn.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...vp.simpleGroup(n,this.elisionEnd)):t.push(""),this.is4()&&(Sf(this.address4 instanceof Oa.Address4),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let r=[],n=new e(this.correctForm());if(n.elidedGroups===0)r.push((0,Na.simpleRegularExpression)(n.parsedAddress));else if(n.elidedGroups===ar.GROUPS)r.push((0,Na.possibleElisions)(ar.GROUPS));else{let i=n.address.split("::");i[0].length&&r.push((0,Na.simpleRegularExpression)(i[0].split(":"))),Sf(typeof n.elidedGroups=="number"),r.push((0,Na.possibleElisions)(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push((0,Na.simpleRegularExpression)(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Na.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Na.ADDRESS_BOUNDARY,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};bs.Address6=Ep});var Ym=Se(In=>{"use strict";var e3=In&&In.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),t3=In&&In.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r3=In&&In.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&e3(t,e,r);return t3(t,e),t};Object.defineProperty(In,"__esModule",{value:!0});In.v6=In.AddressError=In.Address6=In.Address4=void 0;var n3=pp();Object.defineProperty(In,"Address4",{enumerable:!0,get:function(){return n3.Address4}});var i3=zm();Object.defineProperty(In,"Address6",{enumerable:!0,get:function(){return i3.Address6}});var s3=wf();Object.defineProperty(In,"AddressError",{enumerable:!0,get:function(){return s3.AddressError}});var u3=r3(gp());In.v6={helpers:u3}});var ev=Se(Pf=>{"use strict";Pf.byteLength=p3;Pf.toByteArray=g3;Pf.fromByteArray=E3;var Is=[],qi=[],h3=typeof Uint8Array<"u"?Uint8Array:Array,Cp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(La=0,Zm=Cp.length;La<Zm;++La)Is[La]=Cp[La],qi[Cp.charCodeAt(La)]=La;var La,Zm;qi[45]=62;qi[95]=63;function Qm(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function p3(e){var t=Qm(e),r=t[0],n=t[1];return(r+n)*3/4-n}function d3(e,t,r){return(t+r)*3/4-r}function g3(e){var t,r=Qm(e),n=r[0],i=r[1],u=new h3(d3(e,n,i)),s=0,o=i>0?n-4:n,l;for(l=0;l<o;l+=4)t=qi[e.charCodeAt(l)]<<18|qi[e.charCodeAt(l+1)]<<12|qi[e.charCodeAt(l+2)]<<6|qi[e.charCodeAt(l+3)],u[s++]=t>>16&255,u[s++]=t>>8&255,u[s++]=t&255;return i===2&&(t=qi[e.charCodeAt(l)]<<2|qi[e.charCodeAt(l+1)]>>4,u[s++]=t&255),i===1&&(t=qi[e.charCodeAt(l)]<<10|qi[e.charCodeAt(l+1)]<<4|qi[e.charCodeAt(l+2)]>>2,u[s++]=t>>8&255,u[s++]=t&255),u}function m3(e){return Is[e>>18&63]+Is[e>>12&63]+Is[e>>6&63]+Is[e&63]}function v3(e,t,r){for(var n,i=[],u=t;u<r;u+=3)n=(e[u]<<16&16711680)+(e[u+1]<<8&65280)+(e[u+2]&255),i.push(m3(n));return i.join("")}function E3(e){for(var t,r=e.length,n=r%3,i=[],u=16383,s=0,o=r-n;s<o;s+=u)i.push(v3(e,s,s+u>o?o:s+u));return n===1?(t=e[r-1],i.push(Is[t>>2]+Is[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Is[t>>10]+Is[t>>4&63]+Is[t<<2&63]+"=")),i.join("")}});var tv=Se(yp=>{yp.read=function(e,t,r,n,i){var u,s,o=i*8-n-1,l=(1<<o)-1,f=l>>1,p=-7,E=r?i-1:0,d=r?-1:1,h=e[t+E];for(E+=d,u=h&(1<<-p)-1,h>>=-p,p+=o;p>0;u=u*256+e[t+E],E+=d,p-=8);for(s=u&(1<<-p)-1,u>>=-p,p+=n;p>0;s=s*256+e[t+E],E+=d,p-=8);if(u===0)u=1-f;else{if(u===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),u=u-f}return(h?-1:1)*s*Math.pow(2,u-n)};yp.write=function(e,t,r,n,i,u){var s,o,l,f=u*8-i-1,p=(1<<f)-1,E=p>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:u-1,w=n?1:-1,m=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=p):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+E>=1?t+=d/l:t+=d*Math.pow(2,1-E),t*l>=2&&(s++,l/=2),s+E>=p?(o=0,s=p):s+E>=1?(o=(t*l-1)*Math.pow(2,i),s=s+E):(o=t*Math.pow(2,E-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=o&255,h+=w,o/=256,i-=8);for(s=s<<i|o,f+=i;f>0;e[r+h]=s&255,h+=w,s/=256,f-=8);e[r+h-w]|=m*128}});var Of=Se(Uo=>{"use strict";var Fp=ev(),ko=tv(),rv=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Uo.Buffer=pe;Uo.SlowBuffer=D3;Uo.INSPECT_MAX_BYTES=50;var Rf=2147483647;Uo.kMaxLength=Rf;pe.TYPED_ARRAY_SUPPORT=A3();!pe.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 A3(){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(pe.prototype,"parent",{enumerable:!0,get:function(){if(pe.isBuffer(this))return this.buffer}});Object.defineProperty(pe.prototype,"offset",{enumerable:!0,get:function(){if(pe.isBuffer(this))return this.byteOffset}});function fu(e){if(e>Rf)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,pe.prototype),t}function pe(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _p(e)}return uv(e,t,r)}pe.poolSize=8192;function uv(e,t,r){if(typeof e=="string")return C3(e,t);if(ArrayBuffer.isView(e))return y3(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(Bs(e,ArrayBuffer)||e&&Bs(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Bs(e,SharedArrayBuffer)||e&&Bs(e.buffer,SharedArrayBuffer)))return Sp(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return pe.from(n,t,r);let i=F3(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return pe.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}pe.from=function(e,t,r){return uv(e,t,r)};Object.setPrototypeOf(pe.prototype,Uint8Array.prototype);Object.setPrototypeOf(pe,Uint8Array);function av(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 w3(e,t,r){return av(e),e<=0?fu(e):t!==void 0?typeof r=="string"?fu(e).fill(t,r):fu(e).fill(t):fu(e)}pe.alloc=function(e,t,r){return w3(e,t,r)};function _p(e){return av(e),fu(e<0?0:Ip(e)|0)}pe.allocUnsafe=function(e){return _p(e)};pe.allocUnsafeSlow=function(e){return _p(e)};function C3(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!pe.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=ov(e,t)|0,n=fu(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function Dp(e){let t=e.length<0?0:Ip(e.length)|0,r=fu(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function y3(e){if(Bs(e,Uint8Array)){let t=new Uint8Array(e);return Sp(t.buffer,t.byteOffset,t.byteLength)}return Dp(e)}function Sp(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,pe.prototype),n}function F3(e){if(pe.isBuffer(e)){let t=Ip(e.length)|0,r=fu(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||$p(e.length)?fu(0):Dp(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Dp(e.data)}function Ip(e){if(e>=Rf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Rf.toString(16)+" bytes");return e|0}function D3(e){return+e!=e&&(e=0),pe.alloc(+e)}pe.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==pe.prototype};pe.compare=function(t,r){if(Bs(t,Uint8Array)&&(t=pe.from(t,t.offset,t.byteLength)),Bs(r,Uint8Array)&&(r=pe.from(r,r.offset,r.byteLength)),!pe.isBuffer(t)||!pe.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let u=0,s=Math.min(n,i);u<s;++u)if(t[u]!==r[u]){n=t[u],i=r[u];break}return n<i?-1:i<n?1:0};pe.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}};pe.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return pe.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let i=pe.allocUnsafe(r),u=0;for(n=0;n<t.length;++n){let s=t[n];if(Bs(s,Uint8Array))u+s.length>i.length?(pe.isBuffer(s)||(s=pe.from(s)),s.copy(i,u)):Uint8Array.prototype.set.call(i,s,u);else if(pe.isBuffer(s))s.copy(i,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=s.length}return i};function ov(e,t){if(pe.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Bs(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return bp(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return vv(e).length;default:if(i)return n?-1:bp(e).length;t=(""+t).toLowerCase(),i=!0}}pe.byteLength=ov;function S3(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return N3(this,t,r);case"utf8":case"utf-8":return lv(this,t,r);case"ascii":return T3(this,t,r);case"latin1":case"binary":return O3(this,t,r);case"base64":return P3(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x3(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}pe.prototype._isBuffer=!0;function Ua(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}pe.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)Ua(this,r,r+1);return this};pe.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)Ua(this,r,r+3),Ua(this,r+1,r+2);return this};pe.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)Ua(this,r,r+7),Ua(this,r+1,r+6),Ua(this,r+2,r+5),Ua(this,r+3,r+4);return this};pe.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?lv(this,0,t):S3.apply(this,arguments)};pe.prototype.toLocaleString=pe.prototype.toString;pe.prototype.equals=function(t){if(!pe.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:pe.compare(this,t)===0};pe.prototype.inspect=function(){let t="",r=Uo.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};rv&&(pe.prototype[rv]=pe.prototype.inspect);pe.prototype.compare=function(t,r,n,i,u){if(Bs(t,Uint8Array)&&(t=pe.from(t,t.offset,t.byteLength)),!pe.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),u===void 0&&(u=this.length),r<0||n>t.length||i<0||u>this.length)throw new RangeError("out of range index");if(i>=u&&r>=n)return 0;if(i>=u)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,u>>>=0,this===t)return 0;let s=u-i,o=n-r,l=Math.min(s,o),f=this.slice(i,u),p=t.slice(r,n);for(let E=0;E<l;++E)if(f[E]!==p[E]){s=f[E],o=p[E];break}return s<o?-1:o<s?1:0};function cv(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,$p(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=pe.from(t,n)),pe.isBuffer(t))return t.length===0?-1:nv(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):nv(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function nv(e,t,r,n,i){let u=1,s=e.length,o=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;u=2,s/=2,o/=2,r/=2}function l(p,E){return u===1?p[E]:p.readUInt16BE(E*u)}let f;if(i){let p=-1;for(f=r;f<s;f++)if(l(e,f)===l(t,p===-1?0:f-p)){if(p===-1&&(p=f),f-p+1===o)return p*u}else p!==-1&&(f-=f-p),p=-1}else for(r+o>s&&(r=s-o),f=r;f>=0;f--){let p=!0;for(let E=0;E<o;E++)if(l(e,f+E)!==l(t,E)){p=!1;break}if(p)return f}return-1}pe.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};pe.prototype.indexOf=function(t,r,n){return cv(this,t,r,n,!0)};pe.prototype.lastIndexOf=function(t,r,n){return cv(this,t,r,n,!1)};function b3(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let u=t.length;n>u/2&&(n=u/2);let s;for(s=0;s<n;++s){let o=parseInt(t.substr(s*2,2),16);if($p(o))return s;e[r+s]=o}return s}function _3(e,t,r,n){return Tf(bp(t,e.length-r),e,r,n)}function I3(e,t,r,n){return Tf(H3(t),e,r,n)}function B3(e,t,r,n){return Tf(vv(t),e,r,n)}function $3(e,t,r,n){return Tf(j3(t,e.length-r),e,r,n)}pe.prototype.write=function(t,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-r;if((n===void 0||n>u)&&(n=u),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return b3(this,t,r,n);case"utf8":case"utf-8":return _3(this,t,r,n);case"ascii":case"latin1":case"binary":return I3(this,t,r,n);case"base64":return B3(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $3(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};pe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P3(e,t,r){return t===0&&r===e.length?Fp.fromByteArray(e):Fp.fromByteArray(e.slice(t,r))}function lv(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let u=e[i],s=null,o=u>239?4:u>223?3:u>191?2:1;if(i+o<=r){let l,f,p,E;switch(o){case 1:u<128&&(s=u);break;case 2:l=e[i+1],(l&192)===128&&(E=(u&31)<<6|l&63,E>127&&(s=E));break;case 3:l=e[i+1],f=e[i+2],(l&192)===128&&(f&192)===128&&(E=(u&15)<<12|(l&63)<<6|f&63,E>2047&&(E<55296||E>57343)&&(s=E));break;case 4:l=e[i+1],f=e[i+2],p=e[i+3],(l&192)===128&&(f&192)===128&&(p&192)===128&&(E=(u&15)<<18|(l&63)<<12|(f&63)<<6|p&63,E>65535&&E<1114112&&(s=E))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=o}return R3(n)}var iv=4096;function R3(e){let t=e.length;if(t<=iv)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=iv));return r}function T3(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]&127);return n}function O3(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function N3(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let u=t;u<r;++u)i+=M3[e[u]];return i}function x3(e,t,r){let n=e.slice(t,r),i="";for(let u=0;u<n.length-1;u+=2)i+=String.fromCharCode(n[u]+n[u+1]*256);return i}pe.prototype.slice=function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let i=this.subarray(t,r);return Object.setPrototypeOf(i,pe.prototype),i};function tn(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}pe.prototype.readUintLE=pe.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||tn(t,r,this.length);let i=this[t],u=1,s=0;for(;++s<r&&(u*=256);)i+=this[t+s]*u;return i};pe.prototype.readUintBE=pe.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||tn(t,r,this.length);let i=this[t+--r],u=1;for(;r>0&&(u*=256);)i+=this[t+--r]*u;return i};pe.prototype.readUint8=pe.prototype.readUInt8=function(t,r){return t=t>>>0,r||tn(t,1,this.length),this[t]};pe.prototype.readUint16LE=pe.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||tn(t,2,this.length),this[t]|this[t+1]<<8};pe.prototype.readUint16BE=pe.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||tn(t,2,this.length),this[t]<<8|this[t+1]};pe.prototype.readUint32LE=pe.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||tn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};pe.prototype.readUint32BE=pe.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||tn(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};pe.prototype.readBigUInt64LE=Xu(function(t){t=t>>>0,Lo(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&jc(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,u=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(u)<<BigInt(32))});pe.prototype.readBigUInt64BE=Xu(function(t){t=t>>>0,Lo(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&jc(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],u=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(u)});pe.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||tn(t,r,this.length);let i=this[t],u=1,s=0;for(;++s<r&&(u*=256);)i+=this[t+s]*u;return u*=128,i>=u&&(i-=Math.pow(2,8*r)),i};pe.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||tn(t,r,this.length);let i=r,u=1,s=this[t+--i];for(;i>0&&(u*=256);)s+=this[t+--i]*u;return u*=128,s>=u&&(s-=Math.pow(2,8*r)),s};pe.prototype.readInt8=function(t,r){return t=t>>>0,r||tn(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};pe.prototype.readInt16LE=function(t,r){t=t>>>0,r||tn(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};pe.prototype.readInt16BE=function(t,r){t=t>>>0,r||tn(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};pe.prototype.readInt32LE=function(t,r){return t=t>>>0,r||tn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};pe.prototype.readInt32BE=function(t,r){return t=t>>>0,r||tn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};pe.prototype.readBigInt64LE=Xu(function(t){t=t>>>0,Lo(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&jc(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});pe.prototype.readBigInt64BE=Xu(function(t){t=t>>>0,Lo(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&jc(t,this.length-8);let i=(r<<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+n)});pe.prototype.readFloatLE=function(t,r){return t=t>>>0,r||tn(t,4,this.length),ko.read(this,t,!0,23,4)};pe.prototype.readFloatBE=function(t,r){return t=t>>>0,r||tn(t,4,this.length),ko.read(this,t,!1,23,4)};pe.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||tn(t,8,this.length),ko.read(this,t,!0,52,8)};pe.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||tn(t,8,this.length),ko.read(this,t,!1,52,8)};function si(e,t,r,n,i,u){if(!pe.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<u)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}pe.prototype.writeUintLE=pe.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;si(this,t,r,n,o,0)}let u=1,s=0;for(this[r]=t&255;++s<n&&(u*=256);)this[r+s]=t/u&255;return r+n};pe.prototype.writeUintBE=pe.prototype.writeUIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;si(this,t,r,n,o,0)}let u=n-1,s=1;for(this[r+u]=t&255;--u>=0&&(s*=256);)this[r+u]=t/s&255;return r+n};pe.prototype.writeUint8=pe.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,1,255,0),this[r]=t&255,r+1};pe.prototype.writeUint16LE=pe.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};pe.prototype.writeUint16BE=pe.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};pe.prototype.writeUint32LE=pe.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};pe.prototype.writeUint32BE=pe.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function fv(e,t,r,n,i){mv(t,n,i,e,r,7);let u=Number(t&BigInt(4294967295));e[r++]=u,u=u>>8,e[r++]=u,u=u>>8,e[r++]=u,u=u>>8,e[r++]=u;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function hv(e,t,r,n,i){mv(t,n,i,e,r,7);let u=Number(t&BigInt(4294967295));e[r+7]=u,u=u>>8,e[r+6]=u,u=u>>8,e[r+5]=u,u=u>>8,e[r+4]=u;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}pe.prototype.writeBigUInt64LE=Xu(function(t,r=0){return fv(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});pe.prototype.writeBigUInt64BE=Xu(function(t,r=0){return hv(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});pe.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let l=Math.pow(2,8*n-1);si(this,t,r,n,l-1,-l)}let u=0,s=1,o=0;for(this[r]=t&255;++u<n&&(s*=256);)t<0&&o===0&&this[r+u-1]!==0&&(o=1),this[r+u]=(t/s>>0)-o&255;return r+n};pe.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let l=Math.pow(2,8*n-1);si(this,t,r,n,l-1,-l)}let u=n-1,s=1,o=0;for(this[r+u]=t&255;--u>=0&&(s*=256);)t<0&&o===0&&this[r+u+1]!==0&&(o=1),this[r+u]=(t/s>>0)-o&255;return r+n};pe.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};pe.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};pe.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};pe.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};pe.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||si(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};pe.prototype.writeBigInt64LE=Xu(function(t,r=0){return fv(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});pe.prototype.writeBigInt64BE=Xu(function(t,r=0){return hv(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function pv(e,t,r,n,i,u){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function dv(e,t,r,n,i){return t=+t,r=r>>>0,i||pv(e,t,r,4,34028234663852886e22,-34028234663852886e22),ko.write(e,t,r,n,23,4),r+4}pe.prototype.writeFloatLE=function(t,r,n){return dv(this,t,r,!0,n)};pe.prototype.writeFloatBE=function(t,r,n){return dv(this,t,r,!1,n)};function gv(e,t,r,n,i){return t=+t,r=r>>>0,i||pv(e,t,r,8,17976931348623157e292,-17976931348623157e292),ko.write(e,t,r,n,52,8),r+8}pe.prototype.writeDoubleLE=function(t,r,n){return gv(this,t,r,!0,n)};pe.prototype.writeDoubleBE=function(t,r,n){return gv(this,t,r,!1,n)};pe.prototype.copy=function(t,r,n,i){if(!pe.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);let u=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),u};pe.prototype.fill=function(t,r,n,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!pe.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(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let u;if(typeof t=="number")for(u=r;u<n;++u)this[u]=t;else{let s=pe.isBuffer(t)?t:pe.from(t,i),o=s.length;if(o===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(u=0;u<n-r;++u)this[u+r]=s[u%o]}return this};var xo={};function Bp(e,t,r){xo[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}Bp("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Bp("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);Bp("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=sv(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=sv(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function sv(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function k3(e,t,r){Lo(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&jc(t,e.length-(r+1))}function mv(e,t,r,n,i,u){if(e>r||e<t){let s=typeof t=="bigint"?"n":"",o;throw u>3?t===0||t===BigInt(0)?o=`>= 0${s} and < 2${s} ** ${(u+1)*8}${s}`:o=`>= -(2${s} ** ${(u+1)*8-1}${s}) and < 2 ** ${(u+1)*8-1}${s}`:o=`>= ${t}${s} and <= ${r}${s}`,new xo.ERR_OUT_OF_RANGE("value",o,e)}k3(n,i,u)}function Lo(e,t){if(typeof e!="number")throw new xo.ERR_INVALID_ARG_TYPE(t,"number",e)}function jc(e,t,r){throw Math.floor(e)!==e?(Lo(e,r),new xo.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new xo.ERR_BUFFER_OUT_OF_BOUNDS:new xo.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var L3=/[^+/0-9A-Za-z-_]/g;function U3(e){if(e=e.split("=")[0],e=e.trim().replace(L3,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function bp(e,t){t=t||1/0;let r,n=e.length,i=null,u=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&u.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&u.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&u.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&u.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;u.push(r)}else if(r<2048){if((t-=2)<0)break;u.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;u.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;u.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return u}function H3(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function j3(e,t){let r,n,i,u=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,u.push(i),u.push(n);return u}function vv(e){return Fp.toByteArray(U3(e))}function Tf(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Bs(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function $p(e){return e!==e}var M3=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Xu(e){return typeof BigInt>"u"?q3:e}function q3(){throw new Error("BigInt not supported")}});var jv=Se(be=>{var Mc={};Mc.userAgent=!1;var Ho={},K3="11.1.0",V3="jsrsasign(all) 11.1.0 (2024-02-01) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var Ie=Ie||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function h(){}return{extend:function(w){h.prototype=this;var m=new h;return w&&m.mixIn(w),m.hasOwnProperty("init")||(m.init=function(){m.$super.init.apply(this,arguments)}),m.init.prototype=m,m.$super=this,m},create:function(){var w=this.extend();return w.init.apply(w,arguments),w},init:function(){},mixIn:function(w){for(var m in w)w.hasOwnProperty(m)&&(this[m]=w[m]);w.hasOwnProperty("toString")&&(this.toString=w.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),u=n.WordArray=i.extend({init:function(h,w){h=this.words=h||[],w!=t?this.sigBytes=w:this.sigBytes=h.length*4},toString:function(h){return(h||o).stringify(this)},concat:function(h){var w=this.words,m=h.words,y=this.sigBytes,A=h.sigBytes;if(this.clamp(),y%4)for(var C=0;C<A;C++){var S=m[C>>>2]>>>24-C%4*8&255;w[y+C>>>2]|=S<<24-(y+C)%4*8}else for(var C=0;C<A;C+=4)w[y+C>>>2]=m[C>>>2];return this.sigBytes+=A,this},clamp:function(){var h=this.words,w=this.sigBytes;h[w>>>2]&=4294967295<<32-w%4*8,h.length=e.ceil(w/4)},clone:function(){var h=i.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var w=[],m=0;m<h;m+=4)w.push(e.random()*4294967296|0);return new u.init(w,h)}}),s=r.enc={},o=s.Hex={stringify:function(h){for(var w=h.words,m=h.sigBytes,y=[],A=0;A<m;A++){var C=w[A>>>2]>>>24-A%4*8&255;y.push((C>>>4).toString(16)),y.push((C&15).toString(16))}return y.join("")},parse:function(h){for(var w=h.length,m=[],y=0;y<w;y+=2)m[y>>>3]|=parseInt(h.substr(y,2),16)<<24-y%8*4;return new u.init(m,w/2)}},l=s.Latin1={stringify:function(h){for(var w=h.words,m=h.sigBytes,y=[],A=0;A<m;A++){var C=w[A>>>2]>>>24-A%4*8&255;y.push(String.fromCharCode(C))}return y.join("")},parse:function(h){for(var w=h.length,m=[],y=0;y<w;y++)m[y>>>2]|=(h.charCodeAt(y)&255)<<24-y%4*8;return new u.init(m,w)}},f=s.Utf8={stringify:function(h){try{return decodeURIComponent(escape(l.stringify(h)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(h){return l.parse(unescape(encodeURIComponent(h)))}},p=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(h){typeof h=="string"&&(h=f.parse(h)),this._data.concat(h),this._nDataBytes+=h.sigBytes},_process:function(h){var w=this._data,m=w.words,y=w.sigBytes,A=this.blockSize,C=A*4,S=y/C;h?S=e.ceil(S):S=e.max((S|0)-this._minBufferSize,0);var B=S*A,I=e.min(B*4,y);if(B){for(var M=0;M<B;M+=A)this._doProcessBlock(m,M);var q=m.splice(0,B);w.sigBytes-=I}return new u.init(q,I)},clone:function(){var h=i.clone.call(this);return h._data=this._data.clone(),h},_minBufferSize:0}),E=n.Hasher=p.extend({cfg:i.extend(),init:function(h){this.cfg=this.cfg.extend(h),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(h){return this._append(h),this._process(),this},finalize:function(h){h&&this._append(h);var w=this._doFinalize();return w},blockSize:512/32,_createHelper:function(h){return function(w,m){return new h.init(m).finalize(w)}},_createHmacHelper:function(h){return function(w,m){return new d.HMAC.init(h,m).finalize(w)}}}),d=r.algo={};return r}(Math);(function(e){var i=Ie,t=i.lib,r=t.Base,n=t.WordArray,i=i.x64={};i.Word=r.extend({init:function(u,s){this.high=u,this.low=s}}),i.WordArray=r.extend({init:function(u,s){u=this.words=u||[],this.sigBytes=s!=e?s:8*u.length},toX32:function(){for(var u=this.words,s=u.length,o=[],l=0;l<s;l++){var f=u[l];o.push(f.high),o.push(f.low)}return n.create(o,this.sigBytes)},clone:function(){for(var u=r.clone.call(this),s=u.words=this.words.slice(0),o=s.length,l=0;l<o;l++)s[l]=s[l].clone();return u}})})();Ie.lib.Cipher||function(e){var h=Ie,t=h.lib,r=t.Base,n=t.WordArray,i=t.BufferedBlockAlgorithm,u=h.enc.Base64,s=h.algo.EvpKDF,o=t.Cipher=i.extend({cfg:r.extend(),createEncryptor:function(m,y){return this.create(this._ENC_XFORM_MODE,m,y)},createDecryptor:function(m,y){return this.create(this._DEC_XFORM_MODE,m,y)},init:function(m,y,A){this.cfg=this.cfg.extend(A),this._xformMode=m,this._key=y,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(m){return this._append(m),this._process()},finalize:function(m){return m&&this._append(m),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(m){return{encrypt:function(y,A,C){return(typeof A=="string"?w:d).encrypt(m,y,A,C)},decrypt:function(y,A,C){return(typeof A=="string"?w:d).decrypt(m,y,A,C)}}}});t.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var E=h.mode={},l=function(m,y,A){var C=this._iv;C?this._iv=e:C=this._prevBlock;for(var S=0;S<A;S++)m[y+S]^=C[S]},f=(t.BlockCipherMode=r.extend({createEncryptor:function(m,y){return this.Encryptor.create(m,y)},createDecryptor:function(m,y){return this.Decryptor.create(m,y)},init:function(m,y){this._cipher=m,this._iv=y}})).extend();f.Encryptor=f.extend({processBlock:function(m,y){var A=this._cipher,C=A.blockSize;l.call(this,m,y,C),A.encryptBlock(m,y),this._prevBlock=m.slice(y,y+C)}}),f.Decryptor=f.extend({processBlock:function(m,y){var A=this._cipher,C=A.blockSize,S=m.slice(y,y+C);A.decryptBlock(m,y),l.call(this,m,y,C),this._prevBlock=S}}),E=E.CBC=f,f=(h.pad={}).Pkcs7={pad:function(m,y){for(var A=4*y,A=A-m.sigBytes%A,C=A<<24|A<<16|A<<8|A,S=[],B=0;B<A;B+=4)S.push(C);A=n.create(S,A),m.concat(A)},unpad:function(m){m.sigBytes-=m.words[m.sigBytes-1>>>2]&255}},t.BlockCipher=o.extend({cfg:o.cfg.extend({mode:E,padding:f}),reset:function(){o.reset.call(this);var y=this.cfg,m=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var A=y.createEncryptor;else A=y.createDecryptor,this._minBufferSize=1;this._mode=A.call(y,this,m&&m.words)},_doProcessBlock:function(m,y){this._mode.processBlock(m,y)},_doFinalize:function(){var m=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){m.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),m.unpad(y);return y},blockSize:4});var p=t.CipherParams=r.extend({init:function(m){this.mixIn(m)},toString:function(m){return(m||this.formatter).stringify(this)}}),E=(h.format={}).OpenSSL={stringify:function(m){var y=m.ciphertext;return m=m.salt,(m?n.create([1398893684,1701076831]).concat(m).concat(y):y).toString(u)},parse:function(m){m=u.parse(m);var y=m.words;if(y[0]==1398893684&&y[1]==1701076831){var A=n.create(y.slice(2,4));y.splice(0,4),m.sigBytes-=16}return p.create({ciphertext:m,salt:A})}},d=t.SerializableCipher=r.extend({cfg:r.extend({format:E}),encrypt:function(m,y,A,C){C=this.cfg.extend(C);var S=m.createEncryptor(A,C);return y=S.finalize(y),S=S.cfg,p.create({ciphertext:y,key:A,iv:S.iv,algorithm:m,mode:S.mode,padding:S.padding,blockSize:m.blockSize,formatter:C.format})},decrypt:function(m,y,A,C){return C=this.cfg.extend(C),y=this._parse(y,C.format),m.createDecryptor(A,C).finalize(y.ciphertext)},_parse:function(m,y){return typeof m=="string"?y.parse(m,this):m}}),h=(h.kdf={}).OpenSSL={execute:function(m,y,A,C){return C||(C=n.random(8)),m=s.create({keySize:y+A}).compute(m,C),A=n.create(m.words.slice(y),4*A),m.sigBytes=4*y,p.create({key:m,iv:A,salt:C})}},w=t.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:h}),encrypt:function(m,y,A,C){return C=this.cfg.extend(C),A=C.kdf.execute(A,m.keySize,m.ivSize),C.iv=A.iv,m=d.encrypt.call(this,m,y,A.key,C),m.mixIn(A),m},decrypt:function(m,y,A,C){return C=this.cfg.extend(C),y=this._parse(y,C.format),A=C.kdf.execute(A,m.keySize,m.ivSize,y.salt),C.iv=A.iv,d.decrypt.call(this,m,y,A.key,C)}})}();(function(){for(var e=Ie,t=e.lib.BlockCipher,M=e.algo,r=[],n=[],i=[],u=[],s=[],o=[],l=[],f=[],p=[],E=[],d=[],h=0;256>h;h++)d[h]=128>h?h<<1:h<<1^283;for(var w=0,m=0,h=0;256>h;h++){var y=m^m<<1^m<<2^m<<3^m<<4,y=y>>>8^y&255^99;r[w]=y,n[y]=w;var A=d[w],C=d[A],S=d[C],B=257*d[y]^16843008*y;i[w]=B<<24|B>>>8,u[w]=B<<16|B>>>16,s[w]=B<<8|B>>>24,o[w]=B,B=16843009*S^65537*C^257*A^16843008*w,l[y]=B<<24|B>>>8,f[y]=B<<16|B>>>16,p[y]=B<<8|B>>>24,E[y]=B,w?(w=A^d[d[d[S^A]]],m^=d[d[m]]):w=m=1}var I=[0,1,2,4,8,16,32,64,128,27,54],M=M.AES=t.extend({_doReset:function(){for(var R=this._key,q=R.words,b=R.sigBytes/4,R=4*((this._nRounds=b+6)+1),L=this._keySchedule=[],j=0;j<R;j++)if(j<b)L[j]=q[j];else{var G=L[j-1];j%b?6<b&&j%b==4&&(G=r[G>>>24]<<24|r[G>>>16&255]<<16|r[G>>>8&255]<<8|r[G&255]):(G=G<<8|G>>>24,G=r[G>>>24]<<24|r[G>>>16&255]<<16|r[G>>>8&255]<<8|r[G&255],G^=I[j/b|0]<<24),L[j]=L[j-b]^G}for(q=this._invKeySchedule=[],b=0;b<R;b++)j=R-b,G=b%4?L[j]:L[j-4],q[b]=4>b||4>=j?G:l[r[G>>>24]]^f[r[G>>>16&255]]^p[r[G>>>8&255]]^E[r[G&255]]},encryptBlock:function(q,b){this._doCryptBlock(q,b,this._keySchedule,i,u,s,o,r)},decryptBlock:function(q,b){var R=q[b+1];q[b+1]=q[b+3],q[b+3]=R,this._doCryptBlock(q,b,this._invKeySchedule,l,f,p,E,n),R=q[b+1],q[b+1]=q[b+3],q[b+3]=R},_doCryptBlock:function(q,b,R,L,j,G,Y,V){for(var z=this._nRounds,ce=q[b]^R[0],Be=q[b+1]^R[1],Ge=q[b+2]^R[2],Qe=q[b+3]^R[3],J=4,se=1;se<z;se++)var De=L[ce>>>24]^j[Be>>>16&255]^G[Ge>>>8&255]^Y[Qe&255]^R[J++],ye=L[Be>>>24]^j[Ge>>>16&255]^G[Qe>>>8&255]^Y[ce&255]^R[J++],Pe=L[Ge>>>24]^j[Qe>>>16&255]^G[ce>>>8&255]^Y[Be&255]^R[J++],Qe=L[Qe>>>24]^j[ce>>>16&255]^G[Be>>>8&255]^Y[Ge&255]^R[J++],ce=De,Be=ye,Ge=Pe;De=(V[ce>>>24]<<24|V[Be>>>16&255]<<16|V[Ge>>>8&255]<<8|V[Qe&255])^R[J++],ye=(V[Be>>>24]<<24|V[Ge>>>16&255]<<16|V[Qe>>>8&255]<<8|V[ce&255])^R[J++],Pe=(V[Ge>>>24]<<24|V[Qe>>>16&255]<<16|V[ce>>>8&255]<<8|V[Be&255])^R[J++],Qe=(V[Qe>>>24]<<24|V[ce>>>16&255]<<16|V[Be>>>8&255]<<8|V[Ge&255])^R[J++],q[b]=De,q[b+1]=ye,q[b+2]=Pe,q[b+3]=Qe},keySize:8});e.AES=t._createHelper(M)})();(function(){function e(d,h){var w=(this._lBlock>>>d^this._rBlock)&h;this._rBlock^=w,this._lBlock^=w<<d}function t(d,h){var w=(this._rBlock>>>d^this._lBlock)&h;this._lBlock^=w,this._rBlock^=w<<d}var r=Ie,i=r.lib,n=i.WordArray,i=i.BlockCipher,u=r.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],o=[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],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],f=[{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}],p=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],E=u.DES=i.extend({_doReset:function(){for(var d=this._key.words,h=[],w=0;56>w;w++){var m=s[w]-1;h[w]=d[m>>>5]>>>31-m%32&1}for(d=this._subKeys=[],m=0;16>m;m++){for(var y=d[m]=[],A=l[m],w=0;24>w;w++)y[w/6|0]|=h[(o[w]-1+A)%28]<<31-w%6,y[4+(w/6|0)]|=h[28+(o[w+24]-1+A)%28]<<31-w%6;for(y[0]=y[0]<<1|y[0]>>>31,w=1;7>w;w++)y[w]>>>=4*(w-1)+3;y[7]=y[7]<<5|y[7]>>>27}for(h=this._invSubKeys=[],w=0;16>w;w++)h[w]=d[15-w]},encryptBlock:function(d,h){this._doCryptBlock(d,h,this._subKeys)},decryptBlock:function(d,h){this._doCryptBlock(d,h,this._invSubKeys)},_doCryptBlock:function(d,h,w){this._lBlock=d[h],this._rBlock=d[h+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 m=0;16>m;m++){for(var y=w[m],A=this._lBlock,C=this._rBlock,S=0,B=0;8>B;B++)S|=f[B][((C^y[B])&p[B])>>>0];this._lBlock=C,this._rBlock=A^S}w=this._lBlock,this._lBlock=this._rBlock,this._rBlock=w,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),d[h]=this._lBlock,d[h+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(E),u=u.TripleDES=i.extend({_doReset:function(){var d=this._key.words;this._des1=E.createEncryptor(n.create(d.slice(0,2))),this._des2=E.createEncryptor(n.create(d.slice(2,4))),this._des3=E.createEncryptor(n.create(d.slice(4,6)))},encryptBlock:function(d,h){this._des1.encryptBlock(d,h),this._des2.decryptBlock(d,h),this._des3.encryptBlock(d,h)},decryptBlock:function(d,h){this._des3.decryptBlock(d,h),this._des2.encryptBlock(d,h),this._des1.decryptBlock(d,h)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(u)})();(function(){var e=Ie,t=e.lib.WordArray;e.enc.Base64={stringify:function(r){var n=r.words,i=r.sigBytes,u=this._map;r.clamp(),r=[];for(var s=0;s<i;s+=3)for(var o=(n[s>>>2]>>>24-8*(s%4)&255)<<16|(n[s+1>>>2]>>>24-8*((s+1)%4)&255)<<8|n[s+2>>>2]>>>24-8*((s+2)%4)&255,l=0;4>l&&s+.75*l<i;l++)r.push(u.charAt(o>>>6*(3-l)&63));if(n=u.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,i=this._map,u=i.charAt(64);u&&(u=r.indexOf(u),u!=-1&&(n=u));for(var u=[],s=0,o=0;o<n;o++)if(o%4){var l=i.indexOf(r.charAt(o-1))<<2*(o%4),f=i.indexOf(r.charAt(o))>>>6-2*(o%4);u[s>>>2]|=(l|f)<<24-8*(s%4),s++}return t.create(u,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(e){function t(E,d,h,w,m,y,A){return E=E+(d&h|~d&w)+m+A,(E<<y|E>>>32-y)+d}function r(E,d,h,w,m,y,A){return E=E+(d&w|h&~w)+m+A,(E<<y|E>>>32-y)+d}function n(E,d,h,w,m,y,A){return E=E+(d^h^w)+m+A,(E<<y|E>>>32-y)+d}function i(E,d,h,w,m,y,A){return E=E+(h^(d|~w))+m+A,(E<<y|E>>>32-y)+d}for(var u=Ie,l=u.lib,s=l.WordArray,o=l.Hasher,l=u.algo,f=[],p=0;64>p;p++)f[p]=4294967296*e.abs(e.sin(p+1))|0;l=l.MD5=o.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(E,d){for(var h=0;16>h;h++){var w=d+h,m=E[w];E[w]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}var h=this._hash.words,w=E[d+0],m=E[d+1],y=E[d+2],A=E[d+3],C=E[d+4],S=E[d+5],B=E[d+6],I=E[d+7],M=E[d+8],q=E[d+9],b=E[d+10],R=E[d+11],L=E[d+12],j=E[d+13],G=E[d+14],Y=E[d+15],V=h[0],se=h[1],J=h[2],z=h[3],V=t(V,se,J,z,w,7,f[0]),z=t(z,V,se,J,m,12,f[1]),J=t(J,z,V,se,y,17,f[2]),se=t(se,J,z,V,A,22,f[3]),V=t(V,se,J,z,C,7,f[4]),z=t(z,V,se,J,S,12,f[5]),J=t(J,z,V,se,B,17,f[6]),se=t(se,J,z,V,I,22,f[7]),V=t(V,se,J,z,M,7,f[8]),z=t(z,V,se,J,q,12,f[9]),J=t(J,z,V,se,b,17,f[10]),se=t(se,J,z,V,R,22,f[11]),V=t(V,se,J,z,L,7,f[12]),z=t(z,V,se,J,j,12,f[13]),J=t(J,z,V,se,G,17,f[14]),se=t(se,J,z,V,Y,22,f[15]),V=r(V,se,J,z,m,5,f[16]),z=r(z,V,se,J,B,9,f[17]),J=r(J,z,V,se,R,14,f[18]),se=r(se,J,z,V,w,20,f[19]),V=r(V,se,J,z,S,5,f[20]),z=r(z,V,se,J,b,9,f[21]),J=r(J,z,V,se,Y,14,f[22]),se=r(se,J,z,V,C,20,f[23]),V=r(V,se,J,z,q,5,f[24]),z=r(z,V,se,J,G,9,f[25]),J=r(J,z,V,se,A,14,f[26]),se=r(se,J,z,V,M,20,f[27]),V=r(V,se,J,z,j,5,f[28]),z=r(z,V,se,J,y,9,f[29]),J=r(J,z,V,se,I,14,f[30]),se=r(se,J,z,V,L,20,f[31]),V=n(V,se,J,z,S,4,f[32]),z=n(z,V,se,J,M,11,f[33]),J=n(J,z,V,se,R,16,f[34]),se=n(se,J,z,V,G,23,f[35]),V=n(V,se,J,z,m,4,f[36]),z=n(z,V,se,J,C,11,f[37]),J=n(J,z,V,se,I,16,f[38]),se=n(se,J,z,V,b,23,f[39]),V=n(V,se,J,z,j,4,f[40]),z=n(z,V,se,J,w,11,f[41]),J=n(J,z,V,se,A,16,f[42]),se=n(se,J,z,V,B,23,f[43]),V=n(V,se,J,z,q,4,f[44]),z=n(z,V,se,J,L,11,f[45]),J=n(J,z,V,se,Y,16,f[46]),se=n(se,J,z,V,y,23,f[47]),V=i(V,se,J,z,w,6,f[48]),z=i(z,V,se,J,I,10,f[49]),J=i(J,z,V,se,G,15,f[50]),se=i(se,J,z,V,S,21,f[51]),V=i(V,se,J,z,L,6,f[52]),z=i(z,V,se,J,A,10,f[53]),J=i(J,z,V,se,b,15,f[54]),se=i(se,J,z,V,m,21,f[55]),V=i(V,se,J,z,M,6,f[56]),z=i(z,V,se,J,Y,10,f[57]),J=i(J,z,V,se,B,15,f[58]),se=i(se,J,z,V,j,21,f[59]),V=i(V,se,J,z,C,6,f[60]),z=i(z,V,se,J,R,10,f[61]),J=i(J,z,V,se,y,15,f[62]),se=i(se,J,z,V,q,21,f[63]);h[0]=h[0]+V|0,h[1]=h[1]+se|0,h[2]=h[2]+J|0,h[3]=h[3]+z|0},_doFinalize:function(){var E=this._data,d=E.words,h=8*this._nDataBytes,w=8*E.sigBytes;d[w>>>5]|=128<<24-w%32;var m=e.floor(h/4294967296);for(d[(w+64>>>9<<4)+15]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360,d[(w+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,E.sigBytes=4*(d.length+1),this._process(),E=this._hash,d=E.words,h=0;4>h;h++)w=d[h],d[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360;return E},clone:function(){var E=o.clone.call(this);return E._hash=this._hash.clone(),E}}),u.MD5=o._createHelper(l),u.HmacMD5=o._createHmacHelper(l)})(Math);(function(){var e=Ie,i=e.lib,t=i.WordArray,r=i.Hasher,n=[],i=e.algo.SHA1=r.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,s){for(var o=this._hash.words,l=o[0],f=o[1],p=o[2],E=o[3],d=o[4],h=0;80>h;h++){if(16>h)n[h]=u[s+h]|0;else{var w=n[h-3]^n[h-8]^n[h-14]^n[h-16];n[h]=w<<1|w>>>31}w=(l<<5|l>>>27)+d+n[h],w=20>h?w+((f&p|~f&E)+1518500249):40>h?w+((f^p^E)+1859775393):60>h?w+((f&p|f&E|p&E)-1894007588):w+((f^p^E)-899497514),d=E,E=p,p=f<<30|f>>>2,f=l,l=w}o[0]=o[0]+l|0,o[1]=o[1]+f|0,o[2]=o[2]+p|0,o[3]=o[3]+E|0,o[4]=o[4]+d|0},_doFinalize:function(){var u=this._data,s=u.words,o=8*this._nDataBytes,l=8*u.sigBytes;return s[l>>>5]|=128<<24-l%32,s[(l+64>>>9<<4)+14]=Math.floor(o/4294967296),s[(l+64>>>9<<4)+15]=o,u.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var u=r.clone.call(this);return u._hash=this._hash.clone(),u}});e.SHA1=r._createHelper(i),e.HmacSHA1=r._createHmacHelper(i)})();(function(e){for(var t=Ie,h=t.lib,r=h.WordArray,n=h.Hasher,h=t.algo,i=[],u=[],s=function(m){return 4294967296*(m-(m|0))|0},o=2,l=0;64>l;){var f;e:{f=o;for(var p=e.sqrt(f),E=2;E<=p;E++)if(!(f%E)){f=!1;break e}f=!0}f&&(8>l&&(i[l]=s(e.pow(o,.5))),u[l]=s(e.pow(o,1/3)),l++),o++}var d=[],h=h.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(w,m){for(var y=this._hash.words,A=y[0],C=y[1],S=y[2],B=y[3],I=y[4],M=y[5],q=y[6],b=y[7],R=0;64>R;R++){if(16>R)d[R]=w[m+R]|0;else{var L=d[R-15],j=d[R-2];d[R]=((L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3)+d[R-7]+((j<<15|j>>>17)^(j<<13|j>>>19)^j>>>10)+d[R-16]}L=b+((I<<26|I>>>6)^(I<<21|I>>>11)^(I<<7|I>>>25))+(I&M^~I&q)+u[R]+d[R],j=((A<<30|A>>>2)^(A<<19|A>>>13)^(A<<10|A>>>22))+(A&C^A&S^C&S),b=q,q=M,M=I,I=B+L|0,B=S,S=C,C=A,A=L+j|0}y[0]=y[0]+A|0,y[1]=y[1]+C|0,y[2]=y[2]+S|0,y[3]=y[3]+B|0,y[4]=y[4]+I|0,y[5]=y[5]+M|0,y[6]=y[6]+q|0,y[7]=y[7]+b|0},_doFinalize:function(){var w=this._data,m=w.words,y=8*this._nDataBytes,A=8*w.sigBytes;return m[A>>>5]|=128<<24-A%32,m[(A+64>>>9<<4)+14]=e.floor(y/4294967296),m[(A+64>>>9<<4)+15]=y,w.sigBytes=4*m.length,this._process(),this._hash},clone:function(){var w=n.clone.call(this);return w._hash=this._hash.clone(),w}});t.SHA256=n._createHelper(h),t.HmacSHA256=n._createHmacHelper(h)})(Math);(function(){var e=Ie,t=e.lib.WordArray,n=e.algo,r=n.SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var i=r._doFinalize.call(this);return i.sigBytes-=4,i}});e.SHA224=r._createHelper(n),e.HmacSHA224=r._createHmacHelper(n)})();(function(){function e(){return n.create.apply(n,arguments)}for(var t=Ie,r=t.lib.Hasher,u=t.x64,n=u.Word,i=u.WordArray,u=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)],o=[],l=0;80>l;l++)o[l]=e();u=u.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var C=this._hash.words,E=C[0],d=C[1],h=C[2],w=C[3],m=C[4],y=C[5],A=C[6],C=C[7],S=E.high,B=E.low,I=d.high,M=d.low,q=h.high,b=h.low,R=w.high,L=w.low,j=m.high,G=m.low,Y=y.high,V=y.low,z=A.high,J=A.low,se=C.high,De=C.low,ye=S,Pe=B,Qe=I,ce=M,Be=q,Ge=b,Tr=R,Jt=L,St=j,wr=G,cr=Y,vt=V,Xt=z,at=J,Je=se,lr=De,Ve=0;80>Ve;Ve++){var Cr=o[Ve];if(16>Ve)var Lt=Cr.high=f[p+2*Ve]|0,_e=Cr.low=f[p+2*Ve+1]|0;else{var Lt=o[Ve-15],_e=Lt.high,wt=Lt.low,Lt=(_e>>>1|wt<<31)^(_e>>>8|wt<<24)^_e>>>7,wt=(wt>>>1|_e<<31)^(wt>>>8|_e<<24)^(wt>>>7|_e<<25),Or=o[Ve-2],_e=Or.high,It=Or.low,Or=(_e>>>19|It<<13)^(_e<<3|It>>>29)^_e>>>6,It=(It>>>19|_e<<13)^(It<<3|_e>>>29)^(It>>>6|_e<<26),_e=o[Ve-7],un=_e.high,ir=o[Ve-16],qe=ir.high,ir=ir.low,_e=wt+_e.low,Lt=Lt+un+(_e>>>0<wt>>>0?1:0),_e=_e+It,Lt=Lt+Or+(_e>>>0<It>>>0?1:0),_e=_e+ir,Lt=Lt+qe+(_e>>>0<ir>>>0?1:0);Cr.high=Lt,Cr.low=_e}var un=St&cr^~St&Xt,ir=wr&vt^~wr&at,Cr=ye&Qe^ye&Be^Qe&Be,Zt=Pe&ce^Pe&Ge^ce&Ge,wt=(ye>>>28|Pe<<4)^(ye<<30|Pe>>>2)^(ye<<25|Pe>>>7),Or=(Pe>>>28|ye<<4)^(Pe<<30|ye>>>2)^(Pe<<25|ye>>>7),It=s[Ve],pi=It.high,an=It.low,It=lr+((wr>>>14|St<<18)^(wr>>>18|St<<14)^(wr<<23|St>>>9)),qe=Je+((St>>>14|wr<<18)^(St>>>18|wr<<14)^(St<<23|wr>>>9))+(It>>>0<lr>>>0?1:0),It=It+ir,qe=qe+un+(It>>>0<ir>>>0?1:0),It=It+an,qe=qe+pi+(It>>>0<an>>>0?1:0),It=It+_e,qe=qe+Lt+(It>>>0<_e>>>0?1:0),_e=Or+Zt,Cr=wt+Cr+(_e>>>0<Or>>>0?1:0),Je=Xt,lr=at,Xt=cr,at=vt,cr=St,vt=wr,wr=Jt+It|0,St=Tr+qe+(wr>>>0<Jt>>>0?1:0)|0,Tr=Be,Jt=Ge,Be=Qe,Ge=ce,Qe=ye,ce=Pe,Pe=It+_e|0,ye=qe+Cr+(Pe>>>0<It>>>0?1:0)|0}B=E.low=B+Pe,E.high=S+ye+(B>>>0<Pe>>>0?1:0),M=d.low=M+ce,d.high=I+Qe+(M>>>0<ce>>>0?1:0),b=h.low=b+Ge,h.high=q+Be+(b>>>0<Ge>>>0?1:0),L=w.low=L+Jt,w.high=R+Tr+(L>>>0<Jt>>>0?1:0),G=m.low=G+wr,m.high=j+St+(G>>>0<wr>>>0?1:0),V=y.low=V+vt,y.high=Y+cr+(V>>>0<vt>>>0?1:0),J=A.low=J+at,A.high=z+Xt+(J>>>0<at>>>0?1:0),De=C.low=De+lr,C.high=se+Je+(De>>>0<lr>>>0?1:0)},_doFinalize:function(){var f=this._data,p=f.words,E=8*this._nDataBytes,d=8*f.sigBytes;return p[d>>>5]|=128<<24-d%32,p[(d+128>>>10<<5)+30]=Math.floor(E/4294967296),p[(d+128>>>10<<5)+31]=E,f.sigBytes=4*p.length,this._process(),this._hash.toX32()},clone:function(){var f=r.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:32}),t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)})();(function(){var e=Ie,i=e.x64,t=i.Word,r=i.WordArray,i=e.algo,n=i.SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var u=n._doFinalize.call(this);return u.sigBytes-=16,u}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)})();(function(){var e=Ie,f=e.lib,t=f.WordArray,r=f.Hasher,f=e.algo,n=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),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]),u=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]),o=t.create([0,1518500249,1859775393,2400959708,2840853838]),l=t.create([1352829926,1548603684,1836072691,2053994217,0]),f=f.RIPEMD160=r.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(p,E){for(var d=0;16>d;d++){var h=E+d,w=p[h];p[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var h=this._hash.words,w=o.words,m=l.words,y=n.words,A=i.words,C=u.words,S=s.words,B,I,M,q,b,R,L,j,G,Y;R=B=h[0],L=I=h[1],j=M=h[2],G=q=h[3],Y=b=h[4];for(var V,d=0;80>d;d+=1)V=B+p[E+y[d]]|0,V=16>d?V+((I^M^q)+w[0]):32>d?V+((I&M|~I&q)+w[1]):48>d?V+(((I|~M)^q)+w[2]):64>d?V+((I&q|M&~q)+w[3]):V+((I^(M|~q))+w[4]),V|=0,V=V<<C[d]|V>>>32-C[d],V=V+b|0,B=b,b=q,q=M<<10|M>>>22,M=I,I=V,V=R+p[E+A[d]]|0,V=16>d?V+((L^(j|~G))+m[0]):32>d?V+((L&G|j&~G)+m[1]):48>d?V+(((L|~j)^G)+m[2]):64>d?V+((L&j|~L&G)+m[3]):V+((L^j^G)+m[4]),V|=0,V=V<<S[d]|V>>>32-S[d],V=V+Y|0,R=Y,Y=G,G=j<<10|j>>>22,j=L,L=V;V=h[1]+M+G|0,h[1]=h[2]+q+Y|0,h[2]=h[3]+b+R|0,h[3]=h[4]+B+L|0,h[4]=h[0]+I+j|0,h[0]=V},_doFinalize:function(){var p=this._data,E=p.words,d=8*this._nDataBytes,h=8*p.sigBytes;for(E[h>>>5]|=128<<24-h%32,E[(h+64>>>9<<4)+14]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360,p.sigBytes=4*(E.length+1),this._process(),p=this._hash,E=p.words,d=0;5>d;d++)h=E[d],E[d]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return p},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p}});e.RIPEMD160=r._createHelper(f),e.HmacRIPEMD160=r._createHmacHelper(f)})(Math);(function(){var e=Ie,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(r,n){r=this._hasher=new r.init,typeof n=="string"&&(n=t.parse(n));var i=r.blockSize,u=4*i;n.sigBytes>u&&(n=r.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),o=this._iKey=n.clone(),l=s.words,f=o.words,p=0;p<i;p++)l[p]^=1549556828,f[p]^=909522486;s.sigBytes=o.sigBytes=u,this.reset()},reset:function(){var r=this._hasher;r.reset(),r.update(this._iKey)},update:function(r){return this._hasher.update(r),this},finalize:function(r){var n=this._hasher;return r=n.finalize(r),n.reset(),n.finalize(this._oKey.clone().concat(r))}})})();(function(){var e=Ie,n=e.lib,t=n.Base,r=n.WordArray,n=e.algo,i=n.HMAC,u=n.PBKDF2=t.extend({cfg:t.extend({keySize:4,hasher:n.SHA1,iterations:1}),init:function(s){this.cfg=this.cfg.extend(s)},compute:function(s,o){for(var w=this.cfg,l=i.create(w.hasher,s),f=r.create(),p=r.create([1]),E=f.words,d=p.words,h=w.keySize,w=w.iterations;E.length<h;){var m=l.update(o).finalize(p);l.reset();for(var y=m.words,A=y.length,C=m,S=1;S<w;S++){C=l.finalize(C),l.reset();for(var B=C.words,I=0;I<A;I++)y[I]^=B[I]}f.concat(m),d[0]++}return f.sigBytes=4*h,f}});e.PBKDF2=function(s,o,l){return u.create(l).compute(s,o)}})();var jo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Op="=";function pu(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=jo.charAt(r>>6)+jo.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=jo.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=jo.charAt(r>>2)+jo.charAt((r&3)<<4)),Op)for(;(n.length&3)>0;)n+=Op;return n}function qo(e){var t="",r,n=0,i,u;for(r=0;r<e.length&&e.charAt(r)!=Op;++r)u=jo.indexOf(e.charAt(r)),!(u<0)&&(n==0?(t+=hu(u>>2),i=u&3,n=1):n==1?(t+=hu(i<<2|u>>4),i=u&15,n=2):n==2?(t+=hu(i),t+=hu(u>>2),i=u&3,n=3):(t+=hu(i<<2|u>>4),t+=hu(u&15),n=0));return n==1&&(t+=hu(i<<2)),t}function Cv(e){var t=qo(e),r,n=new Array;for(r=0;2*r<t.length;++r)n[r]=parseInt(t.substring(2*r,2*r+2),16);return n}var Qu,G3=0xdeadbeefcafe,Ev=(G3&16777215)==15715070;function ee(e,t,r){e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function Pt(){return new ee(null)}function z3(e,t,r,n,i,u){for(;--u>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=s&67108863}return i}function Y3(e,t,r,n,i,u){for(var s=t&32767,o=t>>15;--u>=0;){var l=this[e]&32767,f=this[e++]>>15,p=o*l+f*s;l=s*l+((p&32767)<<15)+r[n]+(i&1073741823),i=(l>>>30)+(p>>>15)+o*f+(i>>>30),r[n++]=l&1073741823}return i}function W3(e,t,r,n,i,u){for(var s=t&16383,o=t>>14;--u>=0;){var l=this[e]&16383,f=this[e++]>>14,p=o*l+f*s;l=s*l+((p&16383)<<14)+r[n]+i,i=(l>>28)+(p>>14)+o*f,r[n++]=l&268435455}return i}Ev&&Mc.appName=="Microsoft Internet Explorer"?(ee.prototype.am=Y3,Qu=30):Ev&&Mc.appName!="Netscape"?(ee.prototype.am=z3,Qu=26):(ee.prototype.am=W3,Qu=28);ee.prototype.DB=Qu;ee.prototype.DM=(1<<Qu)-1;ee.prototype.DV=1<<Qu;var Up=52;ee.prototype.FV=Math.pow(2,Up);ee.prototype.F1=Up-Qu;ee.prototype.F2=2*Qu-Up;var J3="0123456789abcdefghijklmnopqrstuvwxyz",Uf=new Array,Ko,Vi;Ko=48;for(Vi=0;Vi<=9;++Vi)Uf[Ko++]=Vi;Ko=97;for(Vi=10;Vi<36;++Vi)Uf[Ko++]=Vi;Ko=65;for(Vi=10;Vi<36;++Vi)Uf[Ko++]=Vi;function hu(e){return J3.charAt(e)}function yv(e,t){var r=Uf[e.charCodeAt(t)];return r??-1}function X3(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function Z3(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 Zu(e){var t=Pt();return t.fromInt(e),t}function Q3(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,i=!1,u=0;--n>=0;){var s=r==8?e[n]&255:yv(e,n);if(s<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,u==0?this[this.t++]=s:u+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-u)-1)<<u,this[this.t++]=s>>this.DB-u):this[this.t-1]|=s<<u,u+=r,u>=this.DB&&(u-=this.DB)}r==8&&e[0]&128&&(this.s=-1,u>0&&(this[this.t-1]|=(1<<this.DB-u)-1<<u)),this.clamp(),i&&ee.ZERO.subTo(this,this)}function eb(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function tb(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,n,i=!1,u="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(n=this[s]>>o)>0&&(i=!0,u=hu(n));s>=0;)o<t?(n=(this[s]&(1<<o)-1)<<t-o,n|=this[--s]>>(o+=this.DB-t)):(n=this[s]>>(o-=t)&r,o<=0&&(o+=this.DB,--s)),n>0&&(i=!0),i&&(u+=hu(n));return i?u:"0"}function rb(){var e=Pt();return ee.ZERO.subTo(this,e),e}function nb(){return this.s<0?this.negate():this}function ib(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this[r]-e[r])!=0)return t;return 0}function Hf(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function sb(){return this.t<=0?0:this.DB*(this.t-1)+Hf(this[this.t-1]^this.s&this.DM)}function ub(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function ab(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function ob(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,u=Math.floor(e/this.DB),s=this.s<<r&this.DM,o;for(o=this.t-1;o>=0;--o)t[o+u+1]=this[o]>>n|s,s=(this[o]&i)<<r;for(o=u-1;o>=0;--o)t[o]=0;t[u]=s,t.t=this.t+u+1,t.s=this.s,t.clamp()}function cb(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,i=this.DB-n,u=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&u)<<i,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&u)<<i),t.t=this.t-r,t.clamp()}function lb(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function fb(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t[i]=0;for(i=0;i<n.t;++i)t[i+r.t]=r.am(0,n[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&ee.ZERO.subTo(t,t)}function hb(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function pb(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=Pt());var u=Pt(),s=this.s,o=e.s,l=this.DB-Hf(n[n.t-1]);l>0?(n.lShiftTo(l,u),i.lShiftTo(l,r)):(n.copyTo(u),i.copyTo(r));var f=u.t,p=u[f-1];if(p!=0){var E=p*(1<<this.F1)+(f>1?u[f-2]>>this.F2:0),d=this.FV/E,h=(1<<this.F1)/E,w=1<<this.F2,m=r.t,y=m-f,A=t??Pt();for(u.dlShiftTo(y,A),r.compareTo(A)>=0&&(r[r.t++]=1,r.subTo(A,r)),ee.ONE.dlShiftTo(f,A),A.subTo(u,u);u.t<f;)u[u.t++]=0;for(;--y>=0;){var C=r[--m]==p?this.DM:Math.floor(r[m]*d+(r[m-1]+w)*h);if((r[m]+=u.am(0,C,r,y,0,f))<C)for(u.dlShiftTo(y,A),r.subTo(A,r);r[m]<--C;)r.subTo(A,r)}t!=null&&(r.drShiftTo(f,t),s!=o&&ee.ZERO.subTo(t,t)),r.t=f,r.clamp(),l>0&&r.rShiftTo(l,r),s<0&&ee.ZERO.subTo(r,r)}}}function db(e){var t=Pt();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(ee.ZERO)>0&&e.subTo(t,t),t}function Ha(e){this.m=e}function gb(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function mb(e){return e}function vb(e){e.divRemTo(this.m,null,e)}function Eb(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Ab(e,t){e.squareTo(t),this.reduce(t)}Ha.prototype.convert=gb;Ha.prototype.revert=mb;Ha.prototype.reduce=vb;Ha.prototype.mulTo=Eb;Ha.prototype.sqrTo=Ab;function wb(){if(this.t<1)return 0;var e=this[0];if(!(e&1))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 ja(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 Cb(e){var t=Pt();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(ee.ZERO)>0&&this.m.subTo(t,t),t}function yb(e){var t=Pt();return e.copyTo(t),this.reduce(t),t}function Fb(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e[t]&32767,n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Db(e,t){e.squareTo(t),this.reduce(t)}function Sb(e,t,r){e.multiplyTo(t,r),this.reduce(r)}ja.prototype.convert=Cb;ja.prototype.revert=yb;ja.prototype.reduce=Fb;ja.prototype.mulTo=Sb;ja.prototype.sqrTo=Db;function bb(){return(this.t>0?this[0]&1:this.s)==0}function _b(e,t){if(e>4294967295||e<1)return ee.ONE;var r=Pt(),n=Pt(),i=t.convert(this),u=Hf(e)-1;for(i.copyTo(r);--u>=0;)if(t.sqrTo(r,n),(e&1<<u)>0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function Ib(e,t){var r;return e<256||t.isEven()?r=new Ha(t):r=new ja(t),this.exp(e,r)}ee.prototype.copyTo=X3;ee.prototype.fromInt=Z3;ee.prototype.fromString=Q3;ee.prototype.clamp=eb;ee.prototype.dlShiftTo=ub;ee.prototype.drShiftTo=ab;ee.prototype.lShiftTo=ob;ee.prototype.rShiftTo=cb;ee.prototype.subTo=lb;ee.prototype.multiplyTo=fb;ee.prototype.squareTo=hb;ee.prototype.divRemTo=pb;ee.prototype.invDigit=wb;ee.prototype.isEven=bb;ee.prototype.exp=_b;ee.prototype.toString=tb;ee.prototype.negate=rb;ee.prototype.abs=nb;ee.prototype.compareTo=ib;ee.prototype.bitLength=sb;ee.prototype.mod=db;ee.prototype.modPowInt=Ib;ee.ZERO=Zu(0);ee.ONE=Zu(1);function Bb(){var e=Pt();return this.copyTo(e),e}function $b(){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 Pb(){return this.t==0?this.s:this[0]<<24>>24}function Rb(){return this.t==0?this.s:this[0]<<16>>16}function Tb(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Ob(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Nb(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Zu(r),i=Pt(),u=Pt(),s="";for(this.divRemTo(n,i,u);i.signum()>0;)s=(r+u.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,u);return u.intValue().toString(e)+s}function xb(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,u=0,s=0,o=0;o<e.length;++o){var l=yv(e,o);if(l<0){e.charAt(o)=="-"&&this.signum()==0&&(i=!0);continue}s=t*s+l,++u>=r&&(this.dMultiply(n),this.dAddOffset(s,0),u=0,s=0)}u>0&&(this.dMultiply(Math.pow(t,u)),this.dAddOffset(s,0)),i&&ee.ZERO.subTo(this,this)}function kb(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(ee.ONE.shiftLeft(e-1),Hp,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(ee.ONE.shiftLeft(e-1),this);else{var n=new Array,i=e&7;n.length=(e>>3)+1,t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function Lb(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,i=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function Ub(e){return this.compareTo(e)==0}function Hb(e){return this.compareTo(e)<0?this:e}function jb(e){return this.compareTo(e)>0?this:e}function Mb(e,t,r){var n,i,u=Math.min(e.t,this.t);for(n=0;n<u;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=u;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=u;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function qb(e,t){return e&t}function Kb(e){var t=Pt();return this.bitwiseTo(e,qb,t),t}function Hp(e,t){return e|t}function Vb(e){var t=Pt();return this.bitwiseTo(e,Hp,t),t}function Fv(e,t){return e^t}function Gb(e){var t=Pt();return this.bitwiseTo(e,Fv,t),t}function Dv(e,t){return e&~t}function zb(e){var t=Pt();return this.bitwiseTo(e,Dv,t),t}function Yb(){for(var e=Pt(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function Wb(e){var t=Pt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function Jb(e){var t=Pt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function Xb(e){if(e==0)return-1;var t=0;return e&65535||(e>>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}function Zb(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+Xb(this[e]);return this.s<0?this.t*this.DB:-1}function Qb(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function e5(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Qb(this[r]^t);return e}function t5(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function r5(e,t){var r=ee.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function n5(e){return this.changeBit(e,Hp)}function i5(e){return this.changeBit(e,Dv)}function s5(e){return this.changeBit(e,Fv)}function u5(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function a5(e){var t=Pt();return this.addTo(e,t),t}function o5(e){var t=Pt();return this.subTo(e,t),t}function c5(e){var t=Pt();return this.multiplyTo(e,t),t}function l5(){var e=Pt();return this.squareTo(e),e}function f5(e){var t=Pt();return this.divRemTo(e,t,null),t}function h5(e){var t=Pt();return this.divRemTo(e,null,t),t}function p5(e){var t=Pt(),r=Pt();return this.divRemTo(e,t,r),new Array(t,r)}function d5(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function g5(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 Kc(){}function Sv(e){return e}function m5(e,t,r){e.multiplyTo(t,r)}function v5(e,t){e.squareTo(t)}Kc.prototype.convert=Sv;Kc.prototype.revert=Sv;Kc.prototype.mulTo=m5;Kc.prototype.sqrTo=v5;function E5(e){return this.exp(e,new Kc)}function A5(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function w5(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Vo(e){this.r2=Pt(),this.q3=Pt(),ee.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function C5(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=Pt();return e.copyTo(t),this.reduce(t),t}function y5(e){return e}function F5(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 D5(e,t){e.squareTo(t),this.reduce(t)}function S5(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Vo.prototype.convert=C5;Vo.prototype.revert=y5;Vo.prototype.reduce=F5;Vo.prototype.mulTo=S5;Vo.prototype.sqrTo=D5;function b5(e,t){var r=e.bitLength(),n,i=Zu(1),u;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?u=new Ha(t):t.isEven()?u=new Vo(t):u=new ja(t);var s=new Array,o=3,l=n-1,f=(1<<n)-1;if(s[1]=u.convert(this),n>1){var p=Pt();for(u.sqrTo(s[1],p);o<=f;)s[o]=Pt(),u.mulTo(p,s[o-2],s[o]),o+=2}var E=e.t-1,d,h=!0,w=Pt(),m;for(r=Hf(e[E])-1;E>=0;){for(r>=l?d=e[E]>>r-l&f:(d=(e[E]&(1<<r+1)-1)<<l-r,E>0&&(d|=e[E-1]>>this.DB+r-l)),o=n;!(d&1);)d>>=1,--o;if((r-=o)<0&&(r+=this.DB,--E),h)s[d].copyTo(i),h=!1;else{for(;o>1;)u.sqrTo(i,w),u.sqrTo(w,i),o-=2;o>0?u.sqrTo(i,w):(m=i,i=w,w=m),u.mulTo(w,s[d],i)}for(;E>=0&&!(e[E]&1<<r);)u.sqrTo(i,w),m=i,i=w,w=m,--r<0&&(r=this.DB-1,--E)}return u.revert(i)}function _5(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),u=r.getLowestSetBit();if(u<0)return t;for(i<u&&(u=i),u>0&&(t.rShiftTo(u,t),r.rShiftTo(u,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return u>0&&r.lShiftTo(u,r),r}function I5(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function B5(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return ee.ZERO;for(var r=e.clone(),n=this.clone(),i=Zu(1),u=Zu(0),s=Zu(0),o=Zu(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!u.isEven())&&(i.addTo(this,i),u.subTo(e,u)),i.rShiftTo(1,i)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);for(;n.isEven();)n.rShiftTo(1,n),t?((!s.isEven()||!o.isEven())&&(s.addTo(this,s),o.subTo(e,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(s,i),u.subTo(o,u)):(n.subTo(r,n),t&&s.subTo(i,s),o.subTo(u,o))}if(n.compareTo(ee.ONE)!=0)return ee.ZERO;if(o.compareTo(e)>=0)return o.subtract(e);if(o.signum()<0)o.addTo(e,o);else return o;return o.signum()<0?o.add(e):o}var Vn=[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],$5=(1<<26)/Vn[Vn.length-1];function P5(e){var t,r=this.abs();if(r.t==1&&r[0]<=Vn[Vn.length-1]){for(t=0;t<Vn.length;++t)if(r[0]==Vn[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Vn.length;){for(var n=Vn[t],i=t+1;i<Vn.length&&n<$5;)n*=Vn[i++];for(n=r.modInt(n);t<i;)if(n%Vn[t++]==0)return!1}return r.millerRabin(e)}function R5(e){var t=this.subtract(ee.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);e=e+1>>1,e>Vn.length&&(e=Vn.length);for(var i=Pt(),u=0;u<e;++u){i.fromInt(Vn[Math.floor(Math.random()*Vn.length)]);var s=i.modPow(n,this);if(s.compareTo(ee.ONE)!=0&&s.compareTo(t)!=0){for(var o=1;o++<r&&s.compareTo(t)!=0;)if(s=s.modPowInt(2,this),s.compareTo(ee.ONE)==0)return!1;if(s.compareTo(t)!=0)return!1}}return!0}ee.prototype.chunkSize=Tb;ee.prototype.toRadix=Nb;ee.prototype.fromRadix=xb;ee.prototype.fromNumber=kb;ee.prototype.bitwiseTo=Mb;ee.prototype.changeBit=r5;ee.prototype.addTo=u5;ee.prototype.dMultiply=d5;ee.prototype.dAddOffset=g5;ee.prototype.multiplyLowerTo=A5;ee.prototype.multiplyUpperTo=w5;ee.prototype.modInt=I5;ee.prototype.millerRabin=R5;ee.prototype.clone=Bb;ee.prototype.intValue=$b;ee.prototype.byteValue=Pb;ee.prototype.shortValue=Rb;ee.prototype.signum=Ob;ee.prototype.toByteArray=Lb;ee.prototype.equals=Ub;ee.prototype.min=Hb;ee.prototype.max=jb;ee.prototype.and=Kb;ee.prototype.or=Vb;ee.prototype.xor=Gb;ee.prototype.andNot=zb;ee.prototype.not=Yb;ee.prototype.shiftLeft=Wb;ee.prototype.shiftRight=Jb;ee.prototype.getLowestSetBit=Zb;ee.prototype.bitCount=e5;ee.prototype.testBit=t5;ee.prototype.setBit=n5;ee.prototype.clearBit=i5;ee.prototype.flipBit=s5;ee.prototype.add=a5;ee.prototype.subtract=o5;ee.prototype.multiply=c5;ee.prototype.divide=f5;ee.prototype.remainder=h5;ee.prototype.divideAndRemainder=p5;ee.prototype.modPow=b5;ee.prototype.modInverse=B5;ee.prototype.pow=E5;ee.prototype.gcd=_5;ee.prototype.isProbablePrime=P5;ee.prototype.square=l5;function jp(){this.i=0,this.j=0,this.S=new Array}function T5(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}function O5(){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]}jp.prototype.init=T5;jp.prototype.next=O5;function N5(){return new jp}var Np=256;var Nf,Di,rn;function x5(e){Di[rn++]^=e&255,Di[rn++]^=e>>8&255,Di[rn++]^=e>>16&255,Di[rn++]^=e>>24&255,rn>=Np&&(rn-=Np)}function Mp(){x5(new Date().getTime())}if(Di==null){if(Di=new Array,rn=0,Ho!==void 0&&(Ho.crypto!==void 0||Ho.msCrypto!==void 0)){if(Pp=Ho.crypto||Ho.msCrypto,Pp.getRandomValues)for(Rp=new Uint8Array(32),Pp.getRandomValues(Rp),Ki=0;Ki<32;++Ki)Di[rn++]=Rp[Ki];else if(Mc.appName=="Netscape"&&Mc.appVersion<"5")for(Tp=Ho.crypto.random(32),Ki=0;Ki<Tp.length;++Ki)Di[rn++]=Tp.charCodeAt(Ki)&255}for(;rn<Np;)Ki=Math.floor(65536*Math.random()),Di[rn++]=Ki>>>8,Di[rn++]=Ki&255;rn=0,Mp()}var Ki,Pp,Rp,Tp;function k5(){if(Nf==null){for(Mp(),Nf=N5(),Nf.init(Di),rn=0;rn<Di.length;++rn)Di[rn]=0;rn=0}return Nf.next()}function L5(e){var t;for(t=0;t<e.length;++t)e[t]=k5()}function Go(){}Go.prototype.nextBytes=L5;function ui(e,t){return new ee(e,t)}function ut(){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 U5(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=ui(e,16),this.e=parseInt(t,16);else throw"Invalid RSA public key"}function H5(e){return e.modPowInt(this.e,this.n)}ut.prototype.doPublic=H5;ut.prototype.setPublic=U5;ut.prototype.type="RSA";function j5(e,t,r){if(this.isPrivate=!0,typeof e!="string")this.n=e,this.e=t,this.d=r;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=ui(e,16),this.e=parseInt(t,16),this.d=ui(r,16);else throw"Invalid RSA private key"}function M5(e,t,r,n,i,u,s,o){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=ui(e,16),this.e=parseInt(t,16),this.d=ui(r,16),this.p=ui(n,16),this.q=ui(i,16),this.dmp1=ui(u,16),this.dmq1=ui(s,16),this.coeff=ui(o,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function q5(e,t){var r=new Go,n=e>>1;this.e=parseInt(t,16);for(var i=new ee(t,16),u=e/2-100,s=ee.ONE.shiftLeft(u);;){for(;this.p=new ee(e-n,1,r),!(this.p.subtract(ee.ONE).gcd(i).compareTo(ee.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new ee(n,1,r),!(this.q.subtract(ee.ONE).gcd(i).compareTo(ee.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var l=this.q.subtract(this.p).abs();if(!(l.bitLength()<u||l.compareTo(s)<=0)){var f=this.p.subtract(ee.ONE),p=this.q.subtract(ee.ONE),E=f.multiply(p);if(E.gcd(i).compareTo(ee.ONE)==0&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=i.modInverse(E),this.dmp1=this.d.mod(f),this.dmq1=this.d.mod(p),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0}function K5(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}ut.prototype.doPrivate=K5;ut.prototype.setPrivate=j5;ut.prototype.setPrivateEx=M5;ut.prototype.generate=q5;function Vr(e,t){this.x=t,this.q=e}function V5(e){return e==this?!0:this.q.equals(e.q)&&this.x.equals(e.x)}function G5(){return this.x}function z5(){return new Vr(this.q,this.x.negate().mod(this.q))}function Y5(e){return new Vr(this.q,this.x.add(e.toBigInteger()).mod(this.q))}function W5(e){return new Vr(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}function J5(e){return new Vr(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}function X5(){return new Vr(this.q,this.x.square().mod(this.q))}function Z5(e){return new Vr(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}Vr.prototype.equals=V5;Vr.prototype.toBigInteger=G5;Vr.prototype.negate=z5;Vr.prototype.add=Y5;Vr.prototype.subtract=W5;Vr.prototype.multiply=J5;Vr.prototype.square=X5;Vr.prototype.divide=Z5;Vr.prototype.sqrt=function(){return new Vr(this.q,this.x.sqrt().mod(this.q))};function Ht(e,t,r,n){this.curve=e,this.x=t,this.y=r,n==null?this.z=ee.ONE:this.z=n,this.zinv=null}function Q5(){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 e_(){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 t_(e){if(e==this)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return this.isInfinity();var t,r;return t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),t.equals(ee.ZERO)?(r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q),r.equals(ee.ZERO)):!1}function r_(){return this.x==null&&this.y==null?!0:this.z.equals(ee.ZERO)&&!this.y.toBigInteger().equals(ee.ZERO)}function n_(){return new Ht(this.curve,this.x,this.y.negate(),this.z)}function i_(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(ee.ZERO.equals(r))return ee.ZERO.equals(t)?this.twice():this.curve.getInfinity();var n=new ee("3"),i=this.x.toBigInteger(),u=this.y.toBigInteger(),s=e.x.toBigInteger(),o=e.y.toBigInteger(),l=r.square(),f=l.multiply(r),p=i.multiply(l),E=t.square().multiply(this.z),d=E.subtract(p.shiftLeft(1)).multiply(e.z).subtract(f).multiply(r).mod(this.curve.q),h=p.multiply(n).multiply(t).subtract(u.multiply(f)).subtract(E.multiply(t)).multiply(e.z).add(t.multiply(f)).mod(this.curve.q),w=f.multiply(this.z).multiply(e.z).mod(this.curve.q);return new Ht(this.curve,this.curve.fromBigInteger(d),this.curve.fromBigInteger(h),w)}function s_(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=new ee("3"),t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),u=this.curve.a.toBigInteger(),s=t.square().multiply(e);ee.ZERO.equals(u)||(s=s.add(this.z.square().multiply(u))),s=s.mod(this.curve.q);var o=s.square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),l=s.multiply(e).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),f=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new Ht(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(l),f)}function u_(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,r=t.multiply(new ee("3")),n=this.negate(),i=this,u=this.curve.q.subtract(e),s=u.multiply(new ee("3")),o=new Ht(this.curve,this.x,this.y),l=o.negate(),f;for(f=r.bitLength()-2;f>0;--f){i=i.twice();var p=r.testBit(f),E=t.testBit(f);p!=E&&(i=i.add(p?this:n))}for(f=s.bitLength()-2;f>0;--f){o=o.twice();var d=s.testBit(f),h=u.testBit(f);d!=h&&(o=o.add(d?o:l))}return i}function a_(e,t,r){var n;e.bitLength()>r.bitLength()?n=e.bitLength()-1:n=r.bitLength()-1;for(var i=this.curve.getInfinity(),u=this.add(t);n>=0;)i=i.twice(),e.testBit(n)?r.testBit(n)?i=i.add(u):i=i.add(this):r.testBit(n)&&(i=i.add(t)),--n;return i}Ht.prototype.getX=Q5;Ht.prototype.getY=e_;Ht.prototype.equals=t_;Ht.prototype.isInfinity=r_;Ht.prototype.negate=n_;Ht.prototype.add=i_;Ht.prototype.twice=s_;Ht.prototype.multiply=u_;Ht.prototype.multiplyTwo=a_;function du(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new Ht(this,null,null)}function o_(){return this.q}function c_(){return this.a}function l_(){return this.b}function f_(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function h_(){return this.infinity}function p_(e){return new Vr(this.q,e)}function d_(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=e.substr(0,2),r=e.substr(2),n=this.fromBigInteger(new ee(f,16)),i=this.getA(),u=this.getB(),s=n.square().add(i).multiply(n).add(u),o=s.sqrt();return t=="03"&&(o=o.negate()),new Ht(this,n,o);case 4:case 6:case 7:var l=(e.length-2)/2,f=e.substr(2,l),p=e.substr(l+2,l);return new Ht(this,this.fromBigInteger(new ee(f,16)),this.fromBigInteger(new ee(p,16)));default:return null}}du.prototype.getQ=o_;du.prototype.getA=c_;du.prototype.getB=l_;du.prototype.equals=f_;du.prototype.getInfinity=h_;du.prototype.fromBigInteger=p_;du.prototype.decodePointHex=d_;Vr.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};Ht.prototype.getEncoded=function(e){var t=function(u,s){var o=u.toByteArrayUnsigned();if(s<o.length)o=o.slice(o.length-s);else for(;s>o.length;)o.unshift(0);return o},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=t(r,32);return e?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(n,32))),i};Ht.decodeFrom=function(e,t){var r=t[0],n=t.length-1,i=t.slice(1,1+n/2),u=t.slice(1+n/2,1+n);i.unshift(0),u.unshift(0);var s=new ee(i),o=new ee(u);return new Ht(e,e.fromBigInteger(s),e.fromBigInteger(o))};Ht.decodeFromHex=function(e,t){var r=t.substr(0,2),n=t.length-2,i=t.substr(2,n/2),u=t.substr(2+n/2,n/2),s=new ee(i,16),o=new ee(u,16);return new Ht(e,e.fromBigInteger(s),e.fromBigInteger(o))};Ht.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),r=e.y.subtract(this.y),n=r.divide(t),i=n.square().subtract(this.x).subtract(e.x),u=n.multiply(this.x.subtract(i)).subtract(this.y);return new Ht(this.curve,i,u)};Ht.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=this.curve.fromBigInteger(ee.valueOf(2)),t=this.curve.fromBigInteger(ee.valueOf(3)),r=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),n=r.square().subtract(this.x.multiply(e)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Ht(this.curve,n,i)};Ht.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,r=t.multiply(new ee("3")),n=this.negate(),i=this,u;for(u=r.bitLength()-2;u>0;--u){i=i.twice();var s=r.testBit(u),o=t.testBit(u);s!=o&&(i=i.add2D(s?this:n))}return i};Ht.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),u=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(i);return u.equals(s)};Ht.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};Ht.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(t.compareTo(ee.ONE)<0||t.compareTo(e.subtract(ee.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(ee.ONE)<0||r.compareTo(e.subtract(ee.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 bv=function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",t='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',r='(?:"'+t+'*")',n=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+r+")","g"),i=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),u={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
`,r:"\r",t:" "};function s(E,d,h){return d?u[d]:String.fromCharCode(parseInt(h,16))}var o=new String(""),l="\\",f={"{":Object,"[":Array},p=Object.hasOwnProperty;return function(E,d){var h=E.match(n),w,m=h[0],y=!1;m==="{"?w={}:m==="["?w=[]:(w=[],y=!0);for(var A,C=[w],S=1-y,B=h.length;S<B;++S){m=h[S];var I;switch(m.charCodeAt(0)){default:I=C[0],I[A||I.length]=+m,A=void 0;break;case 34:if(m=m.substring(1,m.length-1),m.indexOf(l)!==-1&&(m=m.replace(i,s)),I=C[0],!A)if(I instanceof Array)A=I.length;else{A=m||o;break}I[A]=m,A=void 0;break;case 91:I=C[0],C.unshift(I[A||I.length]=[]),A=void 0;break;case 93:C.shift();break;case 102:I=C[0],I[A||I.length]=!1,A=void 0;break;case 110:I=C[0],I[A||I.length]=null,A=void 0;break;case 116:I=C[0],I[A||I.length]=!0,A=void 0;break;case 123:I=C[0],C.unshift(I[A||I.length]={}),A=void 0;break;case 125:C.shift();break}}if(y){if(C.length!==1)throw new Error;w=w[0]}else if(C.length)throw new Error;if(d){var M=function(q,b){var R=q[b];if(R&&typeof R=="object"){var L=null;for(var j in R)if(p.call(R,j)&&R!==q){var G=M(R,j);G!==void 0?R[j]=G:(L||(L=[]),L.push(j))}if(L)for(var Y=L.length;--Y>=0;)delete R[L[Y]]}return d.call(q,b,R)};w=M({"":w},"")}return w}}();(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});g.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 Gc(e)},this.getPEMStringFromHex=function(e,t){return $n(e,t)},this.newObject=function(e){var t=g,r=t.asn1,n=r.ASN1Object,i=r.DERBoolean,u=r.DERInteger,s=r.DERBitString,o=r.DEROctetString,l=r.DERNull,f=r.DERObjectIdentifier,p=r.DEREnumerated,E=r.DERUTF8String,d=r.DERNumericString,h=r.DERPrintableString,w=r.DERTeletexString,m=r.DERIA5String,y=r.DERUTCTime,A=r.DERGeneralizedTime,C=r.DERVisibleString,S=r.DERBMPString,B=r.DERSequence,I=r.DERSet,M=r.DERTaggedObject,q=r.ASN1Util.newObject;if(e instanceof r.ASN1Object)return e;var b=Object.keys(e);if(b.length!=1)throw new Error("key of param shall be only one.");var R=b[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+R+":")==-1)throw new Error("undefined key: "+R);if(R=="bool")return new i(e[R]);if(R=="int")return new u(e[R]);if(R=="bitstr")return new s(e[R]);if(R=="octstr")return new o(e[R]);if(R=="null")return new l(e[R]);if(R=="oid")return new f(e[R]);if(R=="enum")return new p(e[R]);if(R=="utf8str")return new E(e[R]);if(R=="numstr")return new d(e[R]);if(R=="prnstr")return new h(e[R]);if(R=="telstr")return new w(e[R]);if(R=="ia5str")return new m(e[R]);if(R=="utctime")return new y(e[R]);if(R=="gentime")return new A(e[R]);if(R=="visstr")return new C(e[R]);if(R=="bmpstr")return new S(e[R]);if(R=="asn1")return new n(e[R]);if(R=="seq"){for(var L=e[R],j=[],G=0;G<L.length;G++){var Y=q(L[G]);j.push(Y)}return new B({array:j})}if(R=="set"){for(var L=e[R],j=[],G=0;G<L.length;G++){var Y=q(L[G]);j.push(Y)}return new I({array:j})}if(R=="tag"){var V=e[R];if(Object.prototype.toString.call(V)==="[object Array]"&&V.length==3){var z=q(V[2]);return new M({tag:V[0],explicit:V[1],obj:z})}else return new M(V)}},this.jsonToASN1HEX=function(e){var t=this.newObject(e);return t.tohex()}};g.asn1.ASN1Util.oidHexToInt=function(e){for(var i="",t=parseInt(e.substr(0,2),16),r=Math.floor(t/40),n=t%40,i=r+"."+n,u="",s=2;s<e.length;s+=2){var o=parseInt(e.substr(s,2),16),l=("00000000"+o.toString(2)).slice(-8);if(u=u+l.substr(1,7),l.substr(0,1)=="0"){var f=new ee(u,2);i=i+"."+f.toString(10),u=""}}return i};g.asn1.ASN1Util.oidIntToHex=function(e){var t=function(o){var l=o.toString(16);return l.length==1&&(l="0"+l),l},r=function(o){var l="",f=new ee(o,10),p=f.toString(2),E=7-p.length%7;E==7&&(E=0);for(var d="",h=0;h<E;h++)d+="0";p=d+p;for(var h=0;h<p.length-1;h+=7){var w=p.substr(h,7);h!=p.length-7&&(w="1"+w),l+=t(parseInt(w,2))}return l};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),u=parseInt(i[0])*40+parseInt(i[1]);n+=t(u),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n};g.asn1.ASN1Object=function(e){var t=!0,r=null,n="00",i="00",u="";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="+u.length+",v="+this.hV);var s=this.hV.length/2,o=s.toString(16);if(o.length%2==1&&(o="0"+o),s<128)return o;var l=o.length/2;if(l>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+s.toString(16));var f=128+l;return f.toString(16)+o},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)};g.asn1.DERAbstractString=function(e){g.asn1.DERAbstractString.superclass.constructor.call(this);var t=null,r=null;this.getString=function(){return this.s},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.s=n,this.hV=Mf(this.s).toLowerCase()},this.setStringHex=function(n){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e=="string"?this.setString(e):typeof e.str<"u"?this.setString(e.str):typeof e.hex<"u"&&this.setStringHex(e.hex))};de(g.asn1.DERAbstractString,g.asn1.ASN1Object);g.asn1.DERAbstractTime=function(e){g.asn1.DERAbstractTime.superclass.constructor.call(this);var t=null,r=null;this.localDateToUTC=function(n){var i=n.getTime()+n.getTimezoneOffset()*6e4,u=new Date(i);return u},this.formatDate=function(n,i,u){var s=this.zeroPadding,o=this.localDateToUTC(n),l=String(o.getFullYear());i=="utc"&&(l=l.substr(2,2));var f=s(String(o.getMonth()+1),2),p=s(String(o.getDate()),2),E=s(String(o.getHours()),2),d=s(String(o.getMinutes()),2),h=s(String(o.getSeconds()),2),w=l+f+p+E+d+h;if(u===!0){var m=o.getMilliseconds();if(m!=0){var y=s(String(m),3);y=y.replace(/[0]+$/,""),w=w+"."+y}}return w+"Z"},this.zeroPadding=function(n,i){return n.length>=i?n:new Array(i-n.length+1).join("0")+n},this.setByParam=function(n){this.hV=null,this.hTLV=null,this.params=n},this.getString=function(){},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.str=n},this.setByDate=function(n){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.date=n},this.setByDateValue=function(n,i,u,s,o,l){var f=new Date(Date.UTC(n,i-1,u,s,o,l,0));this.setByDate(f)},this.getFreshValueHex=function(){return this.hV}};de(g.asn1.DERAbstractTime,g.asn1.ASN1Object);g.asn1.DERAbstractStructured=function(e){g.asn1.DERAbstractString.superclass.constructor.call(this);var t=null;this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof e<"u"&&typeof e.array<"u"&&(this.asn1Array=e.array)};de(g.asn1.DERAbstractStructured,g.asn1.ASN1Object);g.asn1.DERBoolean=function(e){g.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",e==!1?this.hTLV="010100":this.hTLV="0101ff"};de(g.asn1.DERBoolean,g.asn1.ASN1Object);g.asn1.DERInteger=function(e){g.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=Gc;this.setByBigInteger=function(r){this.isModified=!0,this.params={bigint:r}},this.setByInteger=function(r){this.isModified=!0,this.params=r},this.setValueHex=function(r){this.isModified=!0,this.params={hex:r}},this.getFreshValueHex=function(){var r=this.params,n=null;if(r==null)throw new Error("value not set");if(typeof r=="object"&&r.hex!=null)return this.hV=r.hex,this.hV;if(typeof r=="number")n=new ee(String(r),10);else if(r.int!=null)n=new ee(String(r.int),10);else if(r.bigint!=null)n=r.bigint;else throw new Error("wrong parameter");return this.hV=t(n),this.hV},e!=null&&(this.params=e)};de(g.asn1.DERInteger,g.asn1.ASN1Object);g.asn1.DERBitString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=g.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}g.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7<r)throw"unused bits shall be from 0 to 7: u = "+r;var i="0"+r;this.hTLV=null,this.isModified=!0,this.hV=i+n},this.setByBinaryString=function(r){r=r.replace(/0+$/,"");var n=8-r.length%8;n==8&&(n=0),r+="0000000".substr(0,n);for(var i="",u=0;u<r.length-1;u+=8){var s=r.substr(u,8),o=parseInt(s,2).toString(16);o.length==1&&(o="0"+o),i+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+n+i},this.setByBooleanArray=function(r){for(var n="",i=0;i<r.length;i++)r[i]==!0?n+="1":n+="0";this.setByBinaryString(n)},this.newFalseArray=function(r){for(var n=new Array(r),i=0;i<r;i++)n[i]=!1;return n},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e=="string"&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):typeof e.hex<"u"?this.setHexValueIncludingUnusedBits(e.hex):typeof e.bin<"u"?this.setByBinaryString(e.bin):typeof e.array<"u"&&this.setByBooleanArray(e.array))};de(g.asn1.DERBitString,g.asn1.ASN1Object);g.asn1.DEROctetString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=g.asn1.ASN1Util.newObject(e.obj);e.hex=t.tohex()}g.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"};de(g.asn1.DEROctetString,g.asn1.DERAbstractString);g.asn1.DERNull=function(){g.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};de(g.asn1.DERNull,g.asn1.ASN1Object);g.asn1.DERObjectIdentifier=function(e){g.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var r=Tv(t);if(r==null)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){var r=g.asn1.x509.OID.name2oid(t);if(r!=="")this.setValueOidString(r);else throw new Error("DERObjectIdentifier oidName undefined: "+t)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){typeof t=="string"?this.setValueNameOrOid(t):t.oid!==void 0?this.setValueNameOrOid(t.oid):t.name!==void 0?this.setValueNameOrOid(t.name):t.hex!==void 0&&this.setValueHex(t.hex)},e!==void 0&&this.setByParam(e)};de(g.asn1.DERObjectIdentifier,g.asn1.ASN1Object);g.asn1.DEREnumerated=function(e){g.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Gc(t)},this.setByInteger=function(t){var r=new ee(String(t),10);this.setByBigInteger(r)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e.int<"u"?this.setByInteger(e.int):typeof e=="number"?this.setByInteger(e):typeof e.hex<"u"&&this.setValueHex(e.hex))};de(g.asn1.DEREnumerated,g.asn1.ASN1Object);g.asn1.DERUTF8String=function(e){g.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"};de(g.asn1.DERUTF8String,g.asn1.DERAbstractString);g.asn1.DERNumericString=function(e){g.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"};de(g.asn1.DERNumericString,g.asn1.DERAbstractString);g.asn1.DERPrintableString=function(e){g.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"};de(g.asn1.DERPrintableString,g.asn1.DERAbstractString);g.asn1.DERTeletexString=function(e){g.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"};de(g.asn1.DERTeletexString,g.asn1.DERAbstractString);g.asn1.DERIA5String=function(e){g.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"};de(g.asn1.DERIA5String,g.asn1.DERAbstractString);g.asn1.DERVisibleString=function(e){g.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"};de(g.asn1.DERVisibleString,g.asn1.DERAbstractString);g.asn1.DERBMPString=function(e){g.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"};de(g.asn1.DERBMPString,g.asn1.DERAbstractString);g.asn1.DERUTCTime=function(e){g.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=ai(t);else throw new Error("malformed string for UTCTime: "+t);else if(t.str!=null)this.hV=ai(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=ai(this.formatDate(r,"utc",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=ai(this.formatDate(t.date,"utc",n))}else t instanceof Date&&(this.hV=ai(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)};de(g.asn1.DERUTCTime,g.asn1.DERAbstractTime);g.asn1.DERGeneralizedTime=function(e){g.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=ai(t);else throw new Error("malformed string for GeneralizedTime: "+t);else if(t.str!=null)this.hV=ai(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=ai(this.formatDate(r,"gen",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=ai(this.formatDate(t.date,"gen",n))}else t instanceof Date&&(this.hV=ai(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)};de(g.asn1.DERGeneralizedTime,g.asn1.DERAbstractTime);g.asn1.DERSequence=function(e){g.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var t="",r=0;r<this.asn1Array.length;r++){var n=this.asn1Array[r];t+=n.tohex()}return this.hV=t,this.hV}};de(g.asn1.DERSequence,g.asn1.DERAbstractStructured);g.asn1.DERSet=function(e){g.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,r=0;r<this.asn1Array.length;r++){var n=this.asn1Array[r];t.push(n.tohex())}return this.sortFlag==!0&&t.sort(),this.hV=t.join(""),this.hV},typeof e<"u"&&typeof e.sortflag<"u"&&e.sortflag==!1&&(this.sortFlag=!1)};de(g.asn1.DERSet,g.asn1.DERAbstractStructured);g.asn1.DERTaggedObject=function(e){g.asn1.DERTaggedObject.superclass.constructor.call(this);var t=g.asn1,r=Fe,n=r.getV,i=r.isASN1HEX,u=t.ASN1Util.newObject;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(s,o,l){this.params={tag:o,explicit:s,obj:l}},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=Mf(s.str);else if(s.hex!=null)this.hV=s.hex;else if(s.obj!=null){var o;s.obj instanceof t.ASN1Object?o=s.obj.tohex():typeof s.obj=="object"&&(o=u(s.obj).tohex()),s.explicit?this.hV=o:this.hV=n(o,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)};de(g.asn1.DERTaggedObject,g.asn1.ASN1Object);var Fe=new function(){};Fe.getLblen=function(e,t){if(e.substr(t+2,1)!="8")return 1;var r=parseInt(e.substr(t+3,1));return r==0?-1:0<r&&r<10?r+1:-2};Fe.getL=function(e,t){var r=Fe.getLblen(e,t);return r<1?"":e.substr(t+2,r*2)};Fe.getVblen=function(e,t){var r,n;return r=Fe.getL(e,t),r==""?-1:(r.substr(0,1)==="8"?n=new ee(r.substr(2),16):n=new ee(r,16),n.intValue())};Fe.getVidx=function(e,t){var r=Fe.getLblen(e,t);return r<0?r:t+(r+1)*2};Fe.getV=function(e,t){var r=Fe.getVidx(e,t),n=Fe.getVblen(e,t);return e.substr(r,n*2)};Fe.getTLV=function(e,t){return e.substr(t,2)+Fe.getL(e,t)+Fe.getV(e,t)};Fe.getTLVblen=function(e,t){return 2+Fe.getLblen(e,t)*2+Fe.getVblen(e,t)*2};Fe.getNextSiblingIdx=function(e,t){var r=Fe.getVidx(e,t),n=Fe.getVblen(e,t);return r+n*2};Fe.getChildIdx=function(e,t){var r=Fe,n=[],i,u,s;i=r.getVidx(e,t),u=r.getVblen(e,t)*2,e.substr(t,2)=="03"&&(i+=2,u-=2),s=0;for(var o=i;s<=u;){var l=r.getTLVblen(e,o);if(s+=l,s<=u&&n.push(o),o+=l,s>=u)break}return n};Fe.getNthChildIdx=function(e,t,r){var n=Fe.getChildIdx(e,t);return n[r]};Fe.getIdxbyList=function(e,t,r,n){var i=Fe,u,s;return r.length==0?n!==void 0&&e.substr(t,2)!==n?-1:t:(u=r.shift(),s=i.getChildIdx(e,t),u>=s.length?-1:i.getIdxbyList(e,s[u],r,n))};Fe.getIdxbyListEx=function(e,t,r,n){var i=Fe,u,s;if(r.length==0)return n!==void 0&&e.substr(t,2)!==n?-1:t;u=r.shift(),s=i.getChildIdx(e,t);for(var o=0,l=0;l<s.length;l++){var f=e.substr(s[l],2);if(typeof u=="number"&&!i.isContextTag(f)&&o==u||typeof u=="string"&&i.isContextTag(f,u))return i.getIdxbyListEx(e,s[l],r,n);i.isContextTag(f)||o++}return-1};Fe.getTLVbyList=function(e,t,r,n){var i=Fe,u=i.getIdxbyList(e,t,r,n);return u==-1||u>=e.length?null:i.getTLV(e,u)};Fe.getTLVbyListEx=function(e,t,r,n){var i=Fe,u=i.getIdxbyListEx(e,t,r,n);return u==-1?null:i.getTLV(e,u)};Fe.getVbyList=function(e,t,r,n,i){var u=Fe,s,o;return s=u.getIdxbyList(e,t,r,n),s==-1||s>=e.length?null:(o=u.getV(e,s),i===!0&&(o=o.substr(2)),o)};Fe.getVbyListEx=function(e,t,r,n,i){var u=Fe,s,o,l;return s=u.getIdxbyListEx(e,t,r,n),s==-1?null:(l=u.getV(e,s),e.substr(s,2)=="03"&&i!==!1&&(l=l.substr(2)),l)};Fe.getInt=function(e,t,r){r==null&&(r=-1);try{var n=e.substr(t,2);if(n!="02"&&n!="03")return r;var i=Fe.getV(e,t);return n=="02"?parseInt(i,16):Nv(i)}catch{return r}};Fe.getOID=function(e,t,r){r==null&&(r=null);try{if(e.substr(t,2)!="06")return r;var n=Fe.getV(e,t);return zf(n)}catch{return r}};Fe.getOIDName=function(e,t,r){r==null&&(r=null);try{var n=Fe.getOID(e,t,r);if(n==r)return r;var i=g.asn1.x509.OID.oid2name(n);return i==""?n:i}catch{return r}};Fe.getString=function(e,t,r){r==null&&(r=null);try{var n=Fe.getV(e,t);return oi(n)}catch{return r}};Fe.hextooidstr=function(e){var t=function(E,d){return E.length>=d?E:new Array(d-E.length+1).join("0")+E},r=[],n=e.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var u=e.substr(2),s=[],o=0;o<u.length/2;o++)s.push(parseInt(u.substr(o*2,2),16));for(var l=[],f="",o=0;o<s.length;o++)s[o]&128?f=f+t((s[o]&127).toString(2),7):(f=f+t((s[o]&127).toString(2),7),l.push(new String(parseInt(f,2))),f="");var p=r.join(".");return l.length>0&&(p=p+"."+l.join(".")),p};Fe.dump=function(e,t,r,n){var i=Fe,u=i.getV,s=i.dump,o=i.getChildIdx,l=e;e instanceof g.asn1.ASN1Object&&(l=e.tohex());var f=function(q,b){if(q.length<=b*2)return q;var R=q.substr(0,b)+"..(total "+q.length/2+"bytes).."+q.substr(q.length-b,b);return R};t===void 0&&(t={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var p=t.ommit_long_octet,I=l.substr(r,2);if(I=="01"){var E=u(l,r);return E=="00"?n+`BOOLEAN FALSE
`:n+`BOOLEAN TRUE
`}if(I=="02"){var E=u(l,r);return n+"INTEGER "+f(E,p)+`
`}if(I=="03"){var E=u(l,r);if(i.isASN1HEX(E.substr(2))){var d=n+`BITSTRING, encapsulates
`;return d=d+s(E.substr(2),t,0,n+" "),d}else return n+"BITSTRING "+f(E,p)+`
`}if(I=="04"){var E=u(l,r);if(i.isASN1HEX(E)){var d=n+`OCTETSTRING, encapsulates
`;return d=d+s(E,t,0,n+" "),d}else return n+"OCTETSTRING "+f(E,p)+`
`}if(I=="05")return n+`NULL
`;if(I=="06"){var h=u(l,r),w=g.asn1.ASN1Util.oidHexToInt(h),m=g.asn1.x509.OID.oid2name(w),y=w.replace(/\./g," ");return m!=""?n+"ObjectIdentifier "+m+" ("+y+`)
`:n+"ObjectIdentifier ("+y+`)
`}if(I=="0a")return n+"ENUMERATED "+parseInt(u(l,r))+`
`;if(I=="0c")return n+"UTF8String '"+Wt(u(l,r))+`'
`;if(I=="13")return n+"PrintableString '"+Wt(u(l,r))+`'
`;if(I=="14")return n+"TeletexString '"+Wt(u(l,r))+`'
`;if(I=="16")return n+"IA5String '"+Wt(u(l,r))+`'
`;if(I=="17")return n+"UTCTime "+Wt(u(l,r))+`
`;if(I=="18")return n+"GeneralizedTime "+Wt(u(l,r))+`
`;if(I=="1a")return n+"VisualString '"+Wt(u(l,r))+`'
`;if(I=="1e")return n+"BMPString '"+Gp(u(l,r))+`'
`;if(I=="30"){if(l.substr(r,4)=="3000")return n+`SEQUENCE {}
`;var d=n+`SEQUENCE
`,A=o(l,r),C=t;if((A.length==2||A.length==3)&&l.substr(A[0],2)=="06"&&l.substr(A[A.length-1],2)=="04"){var m=i.oidname(u(l,A[0])),S=JSON.parse(JSON.stringify(t));S.x509ExtName=m,C=S}for(var B=0;B<A.length;B++)d=d+s(l,C,A[B],n+" ");return d}if(I=="31"){for(var d=n+`SET
`,A=o(l,r),B=0;B<A.length;B++)d=d+s(l,t,A[B],n+" ");return d}var I=parseInt(I,16);if(I&128){var M=I&31;if(I&32){for(var d=n+"["+M+`]
`,A=o(l,r),B=0;B<A.length;B++)d=d+s(l,t,A[B],n+" ");return d}else{var E=u(l,r);if(Fe.isASN1HEX(E)){var d=n+"["+M+`]
`;return d=d+s(E,t,0,n+" "),d}else(E.substr(0,8)=="68747470"||t.x509ExtName==="subjectAltName"&&M==2)&&(E=Wt(E));var d=n+"["+M+"] "+E+`
`;return d}}return n+"UNKNOWN("+I+") "+u(l,r)+`
`};Fe.parse=function(e){var t=Fe,r=t.parse,n=t.isASN1HEX,i=t.getV,u=t.getTLV,s=t.getChildIdx,o=g.asn1,l=o.ASN1Util.oidHexToInt,f=o.x509.OID.oid2name,p=Wt,E=Gp,d=w_,h={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},w=function(R){for(var L=[],j=s(R,0),G=0;G<j.length;G++){var Y=j[G],V=u(R,Y),z=r(V);L.push(z)}return L},m=e.substr(0,2),y={},A=i(e,0);if(m=="01")return e=="0101ff"?{bool:!0}:{bool:!1};if(m=="02")return{int:{hex:A}};if(m=="03")try{if(A.substr(0,2)!="00")throw"not encap";var C=A.substr(2);if(!n(C))throw"not encap";return{bitstr:{obj:r(C)}}}catch{var S=null;return A.length<=10&&(S=kv(A)),S==null?{bitstr:{hex:A}}:{bitstr:{bin:S}}}else if(m=="04")try{if(!n(A))throw"not encap";return{octstr:{obj:r(A)}}}catch{return{octstr:{hex:A}}}else{if(m=="05")return{null:""};if(m=="06"){var B=l(A),I=f(B);return I==""?{oid:B}:{oid:I}}else{if(m=="0a")return A.length>4?{enum:{hex:A}}:{enum:parseInt(A,16)};if(m=="30"||m=="31")return y[h[m]]=w(e),y;if(m=="14"){var M=d(A);return y[h[m]]={str:M},y}else if(m=="1e"){var M=E(A);return y[h[m]]={str:M},y}else if(":0c:12:13:16:17:18:1a:".indexOf(m)!=-1){var M=p(A);return y[h[m]]={str:M},y}else if(m.match(/^8[0-9]$/)){var M=p(A);return M==null|M==""?{tag:{tag:m,explicit:!1,hex:A}}:M.match(/[\x00-\x1F\x7F-\x9F]/)!=null||M.match(/[\u0000-\u001F\u0080\u009F]/)!=null?{tag:{tag:m,explicit:!1,hex:A}}:{tag:{tag:m,explicit:!1,str:M}}}else if(m.match(/^a[0-9]$/))try{if(!n(A))throw new Error("not encap");return{tag:{tag:m,explicit:!0,obj:r(A)}}}catch{return{tag:{tag:m,explicit:!0,hex:A}}}else{var q=new g.asn1.ASN1Object;q.hV=A;var b=q.getLengthHexFromValue();return{asn1:{tlv:m+b+A}}}}}};Fe.isContextTag=function(e,t){e=e.toLowerCase();var r,n;try{r=parseInt(e,16)}catch{return-1}if(t===void 0)return(r&192)==128;try{var i=t.match(/^\[[0-9]+\]$/);return i==null||(n=parseInt(t.substr(1,t.length-1),10),n>31)?!1:(r&192)==128&&(r&31)==n}catch{return!1}};Fe.isASN1HEX=function(e){var t=Fe;if(e.length%2==1)return!1;var r=t.getVblen(e,0),n=e.substr(0,2),i=t.getL(e,0),u=e.length-n.length-i.length;return u==r*2};Fe.checkStrictDER=function(e,t,r,n,i){var u=Fe;if(r===void 0){if(typeof e!="string")throw new Error("not hex string");if(e=e.toLowerCase(),!g.lang.String.isHex(e))throw new Error("not hex string");r=e.length,n=e.length/2,n<128?i=1:i=Math.ceil(n.toString(16))+1}var s=u.getL(e,t);if(s.length>i*2)throw new Error("L of TLV too long: idx="+t);var o=u.getVblen(e,t);if(o>n)throw new Error("value of L too long than hex: idx="+t);var l=u.getTLV(e,t),f=l.length-2-u.getL(e,t).length;if(f!==o*2)throw new Error("V string length and L's value not the same:"+f+"/"+o*2);if(t===0&&e.length!=l.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+l.length);var p=e.substr(t,2);if(p==="02"){var E=u.getVidx(e,t);if(e.substr(E,2)=="00"&&e.charCodeAt(E+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(p,16)&32){for(var d=u.getVblen(e,t),h=0,w=u.getChildIdx(e,t),m=0;m<w.length;m++){var y=u.getTLV(e,w[m]);h+=y.length,u.checkStrictDER(e,w[m],r,n,i)}if(d*2!=h)throw new Error("sum of children's TLV length and L unmatch: "+d*2+"!="+h)}};Fe.oidname=function(e){var t=g.asn1;g.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var r=t.x509.OID.oid2name(e);return r===""&&(r=e),r};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.x509>"u"||!g.asn1.x509)&&(g.asn1.x509={});g.asn1.x509.Certificate=function(e){g.asn1.x509.Certificate.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.DERBitString,i=r.DERSequence,u=r.x509,s=u.TBSCertificate,o=u.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(l){this.params=l},this.sign=function(){var l=this.params,f=l.sigalg;l.sigalg.name!=null&&(f=l.sigalg.name);var p=l.tbsobj.tohex(),E=new g.crypto.Signature({alg:f});E.init(l.cakey),E.updateHex(p),l.sighex=E.sign()},this.getPEM=function(){return $n(this.tohex(),"CERTIFICATE")},this.tohex=function(){var l=this.params;if((l.tbsobj==null||l.tbsobj==null)&&(l.tbsobj=new s(l)),l.sighex==null&&l.cakey!=null&&this.sign(),l.sighex==null)throw new Error("sighex or cakey parameter not defined");var f=[];f.push(l.tbsobj),f.push(new o({name:l.sigalg})),f.push(new n({hex:"00"+l.sighex}));var p=new i({array:f});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};de(g.asn1.x509.Certificate,g.asn1.ASN1Object);g.asn1.x509.TBSCertificate=function(e){g.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.x509,i=r.DERTaggedObject,u=r.DERInteger,s=r.DERSequence,o=n.AlgorithmIdentifier,l=n.Time,f=n.X500Name,p=n.Extensions,E=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(d){this.params=d},this.tohex=function(){var d=[],h=this.params;if(h.version!=null||h.version!=1){var w=2;h.version!=null&&(w=h.version-1);var m=new i({obj:new u({int:w})});d.push(m)}d.push(new u(h.serial)),d.push(new o({name:h.sigalg})),d.push(new f(h.issuer)),d.push(new s({array:[new l(h.notbefore),new l(h.notafter)]})),d.push(new f(h.subject)),d.push(new E(Ft.getKey(h.sbjpubkey))),h.ext!==void 0&&h.ext.length>0&&d.push(new i({tag:"a3",obj:new p(h.ext)}));var y=new g.asn1.DERSequence({array:d});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.x509.TBSCertificate,g.asn1.ASN1Object);g.asn1.x509.Extensions=function(e){g.asn1.x509.Extensions.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.DERSequence,i=r.x509;this.aParam=[],this.setByParam=function(u){this.aParam=u},this.tohex=function(){for(var u=[],s=0;s<this.aParam.length;s++){var o=this.aParam[s],l=o.extname,f=null;if(o.extn!=null)f=new i.PrivateExtension(o);else if(l=="subjectKeyIdentifier")f=new i.SubjectKeyIdentifier(o);else if(l=="keyUsage")f=new i.KeyUsage(o);else if(l=="subjectAltName")f=new i.SubjectAltName(o);else if(l=="issuerAltName")f=new i.IssuerAltName(o);else if(l=="basicConstraints")f=new i.BasicConstraints(o);else if(l=="nameConstraints")f=new i.NameConstraints(o);else if(l=="cRLDistributionPoints")f=new i.CRLDistributionPoints(o);else if(l=="certificatePolicies")f=new i.CertificatePolicies(o);else if(l=="policyMappings")f=new i.PolicyMappings(o);else if(l=="policyConstraints")f=new i.PolicyConstraints(o);else if(l=="inhibitAnyPolicy")f=new i.InhibitAnyPolicy(o);else if(l=="authorityKeyIdentifier")f=new i.AuthorityKeyIdentifier(o);else if(l=="extKeyUsage")f=new i.ExtKeyUsage(o);else if(l=="authorityInfoAccess")f=new i.AuthorityInfoAccess(o);else if(l=="cRLNumber")f=new i.CRLNumber(o);else if(l=="cRLReason")f=new i.CRLReason(o);else if(l=="ocspNonce")f=new i.OCSPNonce(o);else if(l=="ocspNoCheck")f=new i.OCSPNoCheck(o);else if(l=="adobeTimeStamp")f=new i.AdobeTimeStamp(o);else if(l=="subjectDirectoryAttributes")f=new i.SubjectDirectoryAttributes(o);else throw new Error("extension not supported:"+JSON.stringify(o));f!=null&&u.push(f)}var p=new n({array:u});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.x509.Extensions,g.asn1.ASN1Object);g.asn1.x509.Extension=function(e){g.asn1.x509.Extension.superclass.constructor.call(this);var t=null,r=g,n=r.asn1,i=n.DERObjectIdentifier,u=n.DEROctetString,s=n.DERBitString,o=n.DERBoolean,l=n.DERSequence;this.tohex=function(){var f=new i({oid:this.oid}),p=new u({hex:this.getExtnValueHex()}),E=new Array;E.push(f),this.critical&&E.push(new o),E.push(p);var d=new l({array:E});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,e!==void 0&&e.critical!==void 0&&(this.critical=e.critical)};de(g.asn1.x509.Extension,g.asn1.ASN1Object);g.asn1.x509.KeyUsage=function(e){g.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Error,r={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var n=this.getBinValue();return this.asn1ExtnValue=new g.asn1.DERBitString({bin:n}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var n=this.params;if(typeof n!="object"||typeof n.names!="object"&&typeof n.bin!="string")throw new t("parameter not yet set");if(n.names!=null)return Lf(n.names,r);if(n.bin!=null)return n.bin;throw new t("parameter not set properly")},this.oid="2.5.29.15",e!==void 0&&(this.params=e)};de(g.asn1.x509.KeyUsage,g.asn1.x509.Extension);g.asn1.x509.BasicConstraints=function(e){g.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=g.asn1,r=t.DERBoolean,n=t.DERInteger,i=t.DERSequence,u=!1,s=-1;this.getExtnValueHex=function(){var o=new Array;this.cA&&o.push(new r),this.pathLen>-1&&o.push(new n({int:this.pathLen}));var l=new i({array:o});return this.asn1ExtnValue=l,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))};de(g.asn1.x509.BasicConstraints,g.asn1.x509.Extension);g.asn1.x509.CRLDistributionPoints=function(e){g.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var u=[],s=0;s<i.length;s++)if(i[s]instanceof g.asn1.ASN1Object)u.push(i[s]);else{var o=new n.DistributionPoint(i[s]);u.push(o)}this.asn1ExtnValue=new r.DERSequence({array:u})},this.setByOneURI=function(i){var u=new n.DistributionPoint({fulluri:i});this.setByDPArray([u])},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))};de(g.asn1.x509.CRLDistributionPoints,g.asn1.x509.Extension);g.asn1.x509.DistributionPoint=function(e){g.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=null,r=g,n=r.asn1,i=n.x509.DistributionPointName;this.tohex=function(){var u=new n.DERSequence;if(this.asn1DP!=null){var s=new n.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});u.appendASN1Object(s)}return this.hTLV=u.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}]})))};de(g.asn1.x509.DistributionPoint,g.asn1.ASN1Object);g.asn1.x509.DistributionPointName=function(e){g.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=null,r=null,n=null,i=null,u=g,s=u.asn1,o=s.DERTaggedObject;if(this.tohex=function(){if(this.type!="full")throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new o({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")};de(g.asn1.x509.DistributionPointName,g.asn1.ASN1Object);g.asn1.x509.CertificatePolicies=function(e){g.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.DERSequence,u=n.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var s=[],o=0;o<this.params.array.length;o++)s.push(new u(this.params.array[o]));var l=new i({array:s});return this.asn1ExtnValue=l,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",e!==void 0&&(this.params=e)};de(g.asn1.x509.CertificatePolicies,g.asn1.x509.Extension);g.asn1.x509.PolicyInformation=function(e){g.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=g.asn1,r=t.DERSequence,n=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 u=[new n(this.params.policyoid)];if(this.params.array!==void 0){for(var s=[],o=0;o<this.params.array.length;o++)s.push(new i(this.params.array[o]));s.length>0&&u.push(new r({array:s}))}var l=new r({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};de(g.asn1.x509.PolicyInformation,g.asn1.ASN1Object);g.asn1.x509.PolicyQualifierInfo=function(e){g.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=g.asn1,r=t.DERSequence,n=t.DERIA5String,i=t.DERObjectIdentifier,u=t.x509.UserNotice;this.params=null,this.tohex=function(){if(this.params.cps!==void 0){var s=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]});return s.tohex()}if(this.params.unotice!=null){var s=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new u(this.params.unotice)]});return s.tohex()}},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};de(g.asn1.x509.PolicyQualifierInfo,g.asn1.ASN1Object);g.asn1.x509.UserNotice=function(e){g.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=g.asn1.DERSequence,r=g.asn1.DERInteger,n=g.asn1.x509.DisplayText,i=g.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var u=[];this.params.noticeref!==void 0&&u.push(new i(this.params.noticeref)),this.params.exptext!==void 0&&u.push(new n(this.params.exptext));var s=new t({array:u});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};de(g.asn1.x509.UserNotice,g.asn1.ASN1Object);g.asn1.x509.NoticeReference=function(e){g.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=g.asn1.DERSequence,r=g.asn1.DERInteger,n=g.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var i=[];if(this.params.org!==void 0&&i.push(new n(this.params.org)),this.params.noticenum!==void 0){for(var u=[],s=this.params.noticenum,o=0;o<s.length;o++)u.push(new r(s[o]));i.push(new t({array:u}))}if(i.length==0)throw new Error("parameter is empty");var l=new t({array:i});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};de(g.asn1.x509.NoticeReference,g.asn1.ASN1Object);g.asn1.x509.DisplayText=function(e){g.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"))};de(g.asn1.x509.DisplayText,g.asn1.DERAbstractString);g.asn1.x509.PolicyMappings=function(e){g.asn1.x509.PolicyMappings.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){for(var u=this.params,s=[],o=0;o<u.array.length;o++){var l=u.array[o];s.push({seq:[{oid:l[0]},{oid:l[1]}]})}return this.asn1ExtnValue=i({seq:s}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",e!==void 0&&(this.params=e)};de(g.asn1.x509.PolicyMappings,g.asn1.x509.Extension);g.asn1.x509.PolicyConstraints=function(e){g.asn1.x509.PolicyConstraints.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){var u=this.params,s=[];return u.reqexp!=null&&s.push({tag:{tagi:"80",obj:{int:u.reqexp}}}),u.inhibit!=null&&s.push({tag:{tagi:"81",obj:{int:u.inhibit}}}),this.asn1ExtnValue=i({seq:s}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",e!==void 0&&(this.params=e)};de(g.asn1.x509.PolicyConstraints,g.asn1.x509.Extension);g.asn1.x509.InhibitAnyPolicy=function(e){g.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.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)};de(g.asn1.x509.InhibitAnyPolicy,g.asn1.x509.Extension);g.asn1.x509.NameConstraints=function(e){g.asn1.x509.NameConstraints.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject,u=n.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var s=this.params,o=[];if(s.permit!=null&&s.permit.length!=null){for(var l=[],f=0;f<s.permit.length;f++)l.push(new u(s.permit[f]));o.push({tag:{tagi:"a0",obj:{seq:l}}})}if(s.exclude!=null&&s.exclude.length!=null){for(var p=[],f=0;f<s.exclude.length;f++)p.push(new u(s.exclude[f]));o.push({tag:{tagi:"a1",obj:{seq:p}}})}return this.asn1ExtnValue=i({seq:o}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",e!==void 0&&(this.params=e)};de(g.asn1.x509.NameConstraints,g.asn1.x509.Extension);g.asn1.x509.GeneralSubtree=function(e){g.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var t=g.asn1,r=t.x509,n=r.GeneralName,i=t.ASN1Util.newObject;this.params=null,this.setByParam=function(u){this.params=u},this.tohex=function(){var u=this.params,s=[new n(u)];u.min!=null&&s.push({tag:{tagi:"80",obj:{int:u.min}}}),u.max!=null&&s.push({tag:{tagi:"81",obj:{int:u.max}}});var o=i({seq:s});return o.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.x509.GeneralSubtree,g.asn1.ASN1Object);g.asn1.x509.ExtKeyUsage=function(e){g.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=g,r=t.asn1;this.setPurposeArray=function(n){this.asn1ExtnValue=new r.DERSequence;for(var i=0;i<n.length;i++){var u=new r.DERObjectIdentifier(n[i]);this.asn1ExtnValue.appendASN1Object(u)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",e!==void 0&&e.array!==void 0&&this.setPurposeArray(e.array)};de(g.asn1.x509.ExtKeyUsage,g.asn1.x509.Extension);g.asn1.x509.AuthorityKeyIdentifier=function(e){g.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.DERTaggedObject,i=r.x509.GeneralNames,u=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 n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&s.push(new n({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&s.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var o=new r.DERSequence({array:s});return this.asn1ExtnValue=o,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(s){if(s.str!==void 0||s.hex!==void 0)this.asn1KID=new g.asn1.DEROctetString(s);else if(typeof s=="object"&&g.crypto.Util.isKey(s)||typeof s=="string"&&s.indexOf("BEGIN ")!=-1){var o=s;typeof s=="string"&&(o=Ft.getKey(s));var l=Ft.getKeyID(o);this.asn1KID=new g.asn1.DEROctetString({hex:l})}},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 g.asn1.x509.X500Name(s):typeof s=="string"&&s.indexOf("BEGIN ")!=-1&&s.indexOf("CERTIFICATE")!=-1&&(this.asn1CertIssuer=new g.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 g.asn1.DERInteger(s);else if(typeof s=="string"&&s.indexOf("BEGIN ")!=-1&&s.indexOf("CERTIFICATE")){var o=new Ze;o.readCertPEM(s);var l=o.getSerialNumberHex();this.asn1CertSN=new g.asn1.DERInteger({hex:l})}},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)))};de(g.asn1.x509.AuthorityKeyIdentifier,g.asn1.x509.Extension);g.asn1.x509.SubjectKeyIdentifier=function(e){g.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.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 n(i);else if(typeof i=="object"&&g.crypto.Util.isKey(i)||typeof i=="string"&&i.indexOf("BEGIN")!=-1){var u=i;typeof i=="string"&&(u=Ft.getKey(i));var s=Ft.getKeyID(u);this.asn1KID=new g.asn1.DEROctetString({hex:s})}},this.oid="2.5.29.14",e!==void 0&&e.kid!==void 0&&this.setKIDByParam(e.kid)};de(g.asn1.x509.SubjectKeyIdentifier,g.asn1.x509.Extension);g.asn1.x509.AuthorityInfoAccess=function(e){g.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(t){for(var r=new Array,n=g,i=n.asn1,u=i.DERSequence,s=i.DERObjectIdentifier,o=i.x509.GeneralName,l=0;l<t.length;l++){var f,p=t[l];if(p.ocsp!==void 0)f=new u({array:[new s({oid:"1.3.6.1.5.5.7.48.1"}),new o({uri:p.ocsp})]});else if(p.caissuer!==void 0)f=new u({array:[new s({oid:"1.3.6.1.5.5.7.48.2"}),new o({uri:p.caissuer})]});else throw new Error("unknown AccessMethod parameter: "+JSON.stringify(p));r.push(f)}this.asn1ExtnValue=new u({array:r})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",e!==void 0&&e.array!==void 0&&this.setAccessDescriptionArray(e.array)};de(g.asn1.x509.AuthorityInfoAccess,g.asn1.x509.Extension);g.asn1.x509.SubjectAltName=function(e){g.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(t){this.asn1ExtnValue=new g.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)};de(g.asn1.x509.SubjectAltName,g.asn1.x509.Extension);g.asn1.x509.IssuerAltName=function(e){g.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(t){this.asn1ExtnValue=new g.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)};de(g.asn1.x509.IssuerAltName,g.asn1.x509.Extension);g.asn1.x509.SubjectDirectoryAttributes=function(e){g.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=g.asn1,r=t.DERSequence,n=t.ASN1Util.newObject,i=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var u=[],s=0;s<this.params.array.length;s++){var o=this.params.array[s];if(o.attr!=null&&o.array!=null){var l={seq:[{oid:o.attr},{set:o.array}]};u.push(n(l));continue}var f={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if(o.attr=="dateOfBirth")f.seq[0].oid=i(o.attr),f.seq[1].set[0]={gentime:o.str};else if(o.attr=="placeOfBirth")f.seq[0].oid=i(o.attr),f.seq[1].set[0]={utf8str:o.str};else if(o.attr=="gender")f.seq[0].oid=i(o.attr),f.seq[1].set[0]={prnstr:o.str};else if(o.attr=="countryOfCitizenship")f.seq[0].oid=i(o.attr),f.seq[1].set[0]={prnstr:o.str};else if(o.attr=="countryOfResidence")f.seq[0].oid=i(o.attr),f.seq[1].set[0]={prnstr:o.str};else throw new Error("unsupported attribute: "+o.attr);u.push(new n(f))}var p=new r({array:u});return this.asn1ExtnValue=p,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",e!==void 0&&(this.params=e)};de(g.asn1.x509.SubjectDirectoryAttributes,g.asn1.x509.Extension);g.asn1.x509.PrivateExtension=function(e){g.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=g,r=t.lang.String.isHex,n=t.asn1,i=n.x509.OID.name2oid,u=n.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"&&r(s))return s;if(typeof s=="object")try{return u(s).tohex()}catch{}throw new Error("unsupported extn value")},e!=null&&this.setByParam(e)};de(g.asn1.x509.PrivateExtension,g.asn1.x509.Extension);g.asn1.x509.CRL=function(e){g.asn1.x509.CRL.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.DERSequence,i=r.DERBitString,u=r.x509,s=u.AlgorithmIdentifier,o=u.TBSCertList;this.params=void 0,this.setByParam=function(l){this.params=l},this.sign=function(){var l=new o(this.params).tohex(),f=new g.crypto.Signature({alg:this.params.sigalg});f.init(this.params.cakey),f.updateHex(l);var p=f.sign();this.params.sighex=p},this.getPEM=function(){return $n(this.tohex(),"X509 CRL")},this.tohex=function(){var l=this.params;if(l.tbsobj==null&&(l.tbsobj=new o(l)),l.sighex==null&&l.cakey!=null&&this.sign(),l.sighex==null)throw new Error("sighex or cakey parameter not defined");var f=[];f.push(l.tbsobj),f.push(new s({name:l.sigalg})),f.push(new i({hex:"00"+l.sighex}));var p=new n({array:f});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};de(g.asn1.x509.CRL,g.asn1.ASN1Object);g.asn1.x509.TBSCertList=function(e){g.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.DERInteger,i=r.DERSequence,u=r.DERTaggedObject,s=r.DERObjectIdentifier,o=r.x509,l=o.AlgorithmIdentifier,f=o.Time,p=o.Extensions,E=o.X500Name;this.params=null,this.setByParam=function(d){this.params=d},this.getRevCertSequence=function(){for(var d=[],h=this.params.revcert,w=0;w<h.length;w++){var m=[new n(h[w].sn),new f(h[w].date)];h[w].ext!=null&&m.push(new p(h[w].ext)),d.push(new i({array:m}))}return new i({array:d})},this.tohex=function(){var d=[],h=this.params;if(h.version!=null){var w=h.version-1,m=new n({int:w});d.push(m)}if(d.push(new l({name:h.sigalg})),d.push(new E(h.issuer)),d.push(new f(h.thisupdate)),h.nextupdate!=null&&d.push(new f(h.nextupdate)),h.revcert!=null&&d.push(this.getRevCertSequence()),h.ext!=null){var y=new p(h.ext);d.push(new u({tag:"a0",explicit:!0,obj:y}))}var A=new i({array:d});return A.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.x509.TBSCertList,g.asn1.ASN1Object);g.asn1.x509.CRLEntry=function(e){g.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=null,r=null,n=g,i=n.asn1;this.setCertSerial=function(u){this.sn=new i.DERInteger(u)},this.setRevocationDate=function(u){this.time=new i.x509.Time(u)},this.tohex=function(){var u=new i.DERSequence({array:[this.sn,this.time]});return this.TLV=u.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))};de(g.asn1.x509.CRLEntry,g.asn1.ASN1Object);g.asn1.x509.CRLNumber=function(e){g.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new g.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",e!=null&&(this.params=e)};de(g.asn1.x509.CRLNumber,g.asn1.x509.Extension);g.asn1.x509.CRLReason=function(e){g.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new g.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",e!=null&&(this.params=e)};de(g.asn1.x509.CRLReason,g.asn1.x509.Extension);g.asn1.x509.OCSPNonce=function(e){g.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new g.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",e!=null&&(this.params=e)};de(g.asn1.x509.OCSPNonce,g.asn1.x509.Extension);g.asn1.x509.OCSPNoCheck=function(e){g.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new g.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",e!=null&&(this.params=e)};de(g.asn1.x509.OCSPNoCheck,g.asn1.x509.Extension);g.asn1.x509.AdobeTimeStamp=function(e){g.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.DERInteger,i=r.DERBoolean,u=r.DERSequence,s=r.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var o=this.params,l=[new n(1)];return l.push(new s({uri:o.uri})),o.reqauth!=null&&l.push(new i(o.reqauth)),this.asn1ExtnValue=new u({array:l}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",e!==void 0&&this.setByParam(e)};de(g.asn1.x509.AdobeTimeStamp,g.asn1.x509.Extension);g.asn1.x509.X500Name=function(e){g.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=g,r=t.asn1,n=r.x509,i=n.RDN,u=Ar;this.setByString=function(s,o){o!==void 0&&(this.sRule=o);var l=s.split("/");l.shift();for(var f=[],p=0;p<l.length;p++)if(l[p].match(/^[^=]+=.+$/))f.push(l[p]);else{var E=f.length-1;f[E]=f[E]+"/"+l[p]}for(var p=0;p<f.length;p++)this.asn1Array.push(new i({str:f[p],rule:this.sRule}))},this.setByLdapString=function(s,o){o!==void 0&&(this.sRule=o);var l=n.X500Name.ldapToCompat(s);this.setByString(l,o)},this.setByObject=function(s,o){o!==void 0&&(this.sRule=o);for(var l in s)if(s.hasOwnProperty(l)){var f=new i({str:l+"="+s[l],rule:this.sRule});this.asn1Array?this.asn1Array.push(f):this.asn1Array=[f]}},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 o=new Ze;o.readCertPEM(s.certissuer),this.hTLV=o.getIssuerHex()}else if(s.certsubject!==void 0){var o=new Ze;o.readCertPEM(s.certsubject),this.hTLV=o.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 o={array:this.paramArray[s]};this.sRule!="utf8"&&(o.rule=this.sRule);var l=new i(o);this.asn1Array.push(l)}var f=new r.DERSequence({array:this.asn1Array});return this.hTLV=f.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.x509.X500Name,g.asn1.ASN1Object);g.asn1.x509.X500Name.compatToLDAP=function(e){if(e.substr(0,1)!=="/")throw"malformed input";var t="";e=e.substr(1);var r=e.split("/");return r.reverse(),r=r.map(function(n){return n.replace(/,/,"\\,")}),r.join(",")};g.asn1.x509.X500Name.onelineToLDAP=function(e){return g.asn1.x509.X500Name.compatToLDAP(e)};g.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),r=!1,n=[],i=0;t.length>0;i++){var u=t.shift();if(r===!0){var s=n.pop(),o=(s+","+u).replace(/\\,/g,",");n.push(o),r=!1}else n.push(u);u.substr(-1,1)==="\\"&&(r=!0)}return n=n.map(function(l){return l.replace("/","\\/")}),n.reverse(),"/"+n.join("/")};g.asn1.x509.X500Name.ldapToOneline=function(e){return g.asn1.x509.X500Name.ldapToCompat(e)};g.asn1.x509.RDN=function(e){g.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=g.asn1.x509.AttributeTypeAndValue;this.setByParam=function(r){r.rule!==void 0&&(this.sRule=r.rule),r.str!==void 0&&this.addByMultiValuedString(r.str),r.array!==void 0&&(this.paramArray=r.array)},this.addByString=function(r){this.asn1Array.push(new g.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=g.asn1.x509.RDN.parseString(r),i=0;i<n.length;i++)this.addByString(n[i])},this.tohex=function(){if(this.asn1Array.length==0&&this.paramArray.length>0)for(var r=0;r<this.paramArray.length;r++){var n=this.paramArray[r];n.rule!==void 0&&this.sRule!="utf8"&&(n.rule=this.sRule);var i=new t(n);this.asn1Array.push(i)}var u=new g.asn1.DERSet({array:this.asn1Array});return this.TLV=u.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.x509.RDN,g.asn1.ASN1Object);g.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),r=!1,n=[],i=0;t.length>0;i++){var u=t.shift();if(r===!0){var s=n.pop(),o=(s+"+"+u).replace(/\\\+/g,"+");n.push(o),r=!1}else n.push(u);u.substr(-1,1)==="\\"&&(r=!0)}for(var l=!1,f=[],i=0;n.length>0;i++){var u=n.shift();if(l===!0){var p=f.pop();if(u.match(/"$/)){var o=(p+"+"+u).replace(/^([^=]+)="(.*)"$/,"$1=$2");f.push(o),l=!1}else f.push(p+"+"+u)}else f.push(u);u.match(/^[^=]+="/)&&(l=!0)}return f};g.asn1.x509.AttributeTypeAndValue=function(e){g.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=g,r=t.asn1,n=r.DERSequence,i=r.DERUTF8String,u=r.DERPrintableString,s=r.DERTeletexString,o=r.DERIA5String,l=r.DERVisibleString,f=r.DERBMPString,p=t.lang.String.isMail,E=t.lang.String.isPrintable;this.setByParam=function(d){if(d.rule!==void 0&&(this.sRule=d.rule),d.ds!==void 0&&(this.dsType=d.ds),d.value===void 0&&d.str!==void 0){var h=d.str,w=h.match(/^([^=]+)=(.+)$/);if(w)this.sType=w[1],this.sValue=w[2];else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)}else this.sType=d.type,this.sValue=d.value},this.setByString=function(d,h){h!==void 0&&(this.sRule=h);var w=d.match(/^([^=]+)=(.+)$/);if(w)this.setByAttrTypeAndValueStr(w[1],w[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var d=this.sType,h=this.sValue,w=this.sRule;return w==="prn"?d=="CN"&&p(h)?"ia5":E(h)?"prn":"utf8":w==="utf8"?d=="CN"&&p(h)?"ia5":d=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(d,h,w){w!==void 0&&(this.sRule=w),this.sType=d,this.sValue=h},this.getValueObj=function(d,h){if(d=="utf8")return new i({str:h});if(d=="prn")return new u({str:h});if(d=="tel")return new s({str:h});if(d=="ia5")return new o({str:h});if(d=="vis")return new l({str:h});if(d=="bmp")return new f({str:h});throw new Error("unsupported directory string type: type="+d+" value="+h)},this.tohex=function(){this.dsType==null&&(this.dsType=this._getDsType());var d=g.asn1.x509.OID.atype2obj(this.sType),h=this.getValueObj(this.dsType,this.sValue),w=new n({array:[d,h]});return this.TLV=w.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.x509.AttributeTypeAndValue,g.asn1.ASN1Object);g.asn1.x509.SubjectPublicKeyInfo=function(e){g.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=null,r=null,n=g,i=n.asn1,u=i.DERInteger,s=i.DERBitString,o=i.DERObjectIdentifier,l=i.DERSequence,f=i.ASN1Util.newObject,p=i.x509,E=p.AlgorithmIdentifier,d=n.crypto,h=d.ECDSA,w=d.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var m=new l({array:[this.asn1AlgId,this.asn1SubjPKey]});return m},this.tohex=function(){var m=this.getASN1Object();return this.hTLV=m.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(m){try{if(m instanceof ut){var y=f({seq:[{int:{bigint:m.n}},{int:{int:m.e}}]}),A=y.tohex();this.asn1AlgId=new E({name:"rsaEncryption"}),this.asn1SubjPKey=new s({hex:"00"+A})}}catch{}try{if(m instanceof g.crypto.ECDSA){var C=new o({name:m.curveName});this.asn1AlgId=new E({name:"ecPublicKey",asn1params:C}),this.asn1SubjPKey=new s({hex:"00"+m.pubKeyHex})}}catch{}try{if(m instanceof g.crypto.DSA){var C=new f({seq:[{int:{bigint:m.p}},{int:{bigint:m.q}},{int:{bigint:m.g}}]});this.asn1AlgId=new E({name:"dsa",asn1params:C});var S=new u({bigint:m.y});this.asn1SubjPKey=new s({hex:"00"+S.tohex()})}}catch{}},e!==void 0&&this.setPubKey(e)};de(g.asn1.x509.SubjectPublicKeyInfo,g.asn1.ASN1Object);g.asn1.x509.Time=function(e){g.asn1.x509.Time.superclass.constructor.call(this);var t=null,r=null,n=g,i=n.asn1,u=i.DERUTCTime,s=i.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(o){this.timeParams=o},this.setByParam=function(o){this.params=o},this.getType=function(o){return o.match(/^[0-9]{12}Z$/)?"utc":o.match(/^[0-9]{14}Z$/)?"gen":o.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":o.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var o=this.params,l=null;if(typeof o=="string"&&(o={str:o}),o!=null&&o.str&&(o.type==null||o.type==null)&&(o.type=this.getType(o.str)),o!=null&&o.str?(o.type=="utc"&&(l=new u(o.str)),o.type=="gen"&&(l=new s(o.str))):this.type=="gen"?l=new s:l=new u,l==null)throw new Error("wrong setting for Time");return this.TLV=l.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};g.asn1.x509.Time_bak=function(e){g.asn1.x509.Time_bak.superclass.constructor.call(this);var t=null,r=null,n=g,i=n.asn1,u=i.DERUTCTime,s=i.DERGeneralizedTime;this.setTimeParams=function(o){this.timeParams=o},this.tohex=function(){var o=null;return this.timeParams!=null?this.type=="utc"?o=new u(this.timeParams):o=new s(this.timeParams):this.type=="utc"?o=new u:o=new s,this.TLV=o.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)};de(g.asn1.x509.Time,g.asn1.ASN1Object);g.asn1.x509.AlgorithmIdentifier=function(e){g.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=g,r=t.asn1,n=r.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(this.nameAlg===null&&this.asn1Alg===null)throw new Error("algorithm not specified");if(this.nameAlg!==null){var u=null;for(var s in n)s===this.nameAlg&&(u=n[s]);if(u!==null)return this.hTLV=u,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=r.x509.OID.name2obj(this.nameAlg));var o=[this.asn1Alg];this.asn1Params!==null&&o.push(this.asn1Params);var l=new r.DERSequence({array:o});return this.hTLV=l.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 r.DERNull)}};de(g.asn1.x509.AlgorithmIdentifier,g.asn1.ASN1Object);g.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};g.asn1.x509.GeneralName=function(e){g.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87",otherName:"a0"},r=g,n=r.asn1,i=n.x509,u=i.X500Name,s=i.OtherName,o=n.DERIA5String,l=n.DERPrintableString,f=n.DEROctetString,p=n.DERTaggedObject,E=n.ASN1Object,d=Error;this.params=null,this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,w,y,m,y=!1;if(h.other!==void 0)w="a0",m=new s(h.other);else if(h.rfc822!==void 0)w="81",m=new o({str:h.rfc822});else if(h.dns!==void 0)w="82",m=new o({str:h.dns});else if(h.dn!==void 0)w="a4",y=!0,typeof h.dn=="string"?m=new u({str:h.dn}):h.dn instanceof g.asn1.x509.X500Name?m=h.dn:m=new u(h.dn);else if(h.ldapdn!==void 0)w="a4",y=!0,m=new u({ldapstr:h.ldapdn});else if(h.certissuer!==void 0||h.certsubj!==void 0){w="a4",y=!0;var A,C,S=null;if(h.certsubj!==void 0?(A=!1,C=h.certsubj):(A=!0,C=h.certissuer),C.match(/^[0-9A-Fa-f]+$/)&&S==C,C.indexOf("-----BEGIN ")!=-1&&(S=Ar(C)),S==null)throw new Error("certsubj/certissuer not cert");var B=new Ze;B.hex=S;var I;A?I=B.getIssuerHex():I=B.getSubjectHex(),m=new E,m.hTLV=I}else if(h.uri!==void 0)w="86",m=new o({str:h.uri});else if(h.ip!==void 0){w="87";var M,q=h.ip;try{if(q.match(/^[0-9a-f]+$/)){var b=q.length;if(b==8||b==16||b==32||b==64)M=q;else throw"err"}else M=Vp(q)}catch(L){throw new d("malformed IP address: "+h.ip+":"+L.message)}m=new f({hex:M})}else throw new d("improper params");var R=new p({tag:w,explicit:y,obj:m});return R.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.x509.GeneralName,g.asn1.ASN1Object);g.asn1.x509.GeneralNames=function(e){g.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,r=g,n=r.asn1;this.setByParamArray=function(i){for(var u=0;u<i.length;u++){var s=new n.x509.GeneralName(i[u]);this.asn1Array.push(s)}},this.tohex=function(){var i=new n.DERSequence({array:this.asn1Array});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,typeof e<"u"&&this.setByParamArray(e)};de(g.asn1.x509.GeneralNames,g.asn1.ASN1Object);g.asn1.x509.OtherName=function(e){g.asn1.x509.OtherName.superclass.constructor.call(this);var t=null,r=null,n=g,i=n.asn1,u=i.DERObjectIdentifier,s=i.DERSequence,o=i.ASN1Util.newObject;this.params=null,this.setByParam=function(l){this.params=l},this.tohex=function(){var l=this.params;if(l.oid==null||l.value==null)throw new Error("oid or value not specified");var f=new u({oid:l.oid}),p=o({tag:{tag:"a0",explicit:!0,obj:l.value}}),E=new s({array:[f,p]});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.x509.OtherName,g.asn1.ASN1Object);g.asn1.x509.OID=new function(){var e=g.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(t){if(typeof this.objCache[t]<"u")return this.objCache[t];if(typeof this.name2oidList[t]>"u")throw"Name of ObjectIdentifier not defined: "+t;var r=this.name2oidList[t],n=new e({oid:r});return this.objCache[t]=n,n},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var r;if(t.match(/^\d+\.\d+\.[0-9.]+$/))r=t;else if(this.atype2oidList[t]!==void 0)r=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)r=this.name2oidList[t];else throw new Error("AttributeType name undefined: "+t);var n=new e({oid:r});return this.objCache[t]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var r in t)this.name2oidList[r]=t[r]},this.checkOIDs=function(t){try{var r=Object.keys(t);return r.length==0?!1:(r.map(function(n,i,u){var s=this[n];if(!s.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch{return!1}}};g.asn1.x509.OID.oid2name=function(e){var t=g.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""};g.asn1.x509.OID.oid2atype=function(e){var t=g.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e};g.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=g.asn1.x509.OID.name2oidList;return t[e]===void 0?"":t[e]};g.asn1.x509.X509Util={};g.asn1.x509.X509Util.newCertPEM=function(e){var t=g.asn1.x509,r=t.TBSCertificate,n=t.Certificate,i=new n(e);return i.getPEM()};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.cms>"u"||!g.asn1.cms)&&(g.asn1.cms={});g.asn1.cms.Attribute=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.DERSet,s=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(o){this.params=o},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var o=new s({oid:this.typeOid}),l=new u({array:this.getValueArray()}),f=new i({array:[o,l]});return f.tohex()},this.getEncodedHex=function(){return this.tohex()}};de(g.asn1.cms.Attribute,g.asn1.ASN1Object);g.asn1.cms.ContentType=function(e){var t=g,r=t.asn1;r.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var n=new r.DERObjectIdentifier(this.params.type);return[n]},e!=null&&this.setByParam(e)};de(g.asn1.cms.ContentType,g.asn1.cms.Attribute);g.asn1.cms.MessageDigest=function(e){var t=g,r=t.asn1,n=r.DEROctetString,i=r.cms;i.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var u=new n(this.params);return[u]},e!=null&&this.setByParam(e)};de(g.asn1.cms.MessageDigest,g.asn1.cms.Attribute);g.asn1.cms.SigningTime=function(e){var t=g,r=t.asn1;r.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var n=new r.x509.Time(this.params);return[n]},e!=null&&this.setByParam(e)};de(g.asn1.cms.SigningTime,g.asn1.cms.Attribute);g.asn1.cms.SigningCertificate=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.cms,s=u.ESSCertID,o=r.crypto;u.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 l=this.params.array,f=[],p=0;p<l.length;p++){var E=l[p];e.hasis==!1&&typeof E=="string"&&(E.indexOf("-----BEGIN")!=-1||Fe.isASN1HEX(E))&&(E={cert:E}),E.hasis!=!1&&e.hasis==!1&&(E.hasis=!1),f.push(new s(E))}var d=new i({array:f}),h=new i({array:[d]});return[h]},e!=null&&this.setByParam(e)};de(g.asn1.cms.SigningCertificate,g.asn1.cms.Attribute);g.asn1.cms.ESSCertID=function(e){g.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,r=g,n=r.asn1,i=n.DEROctetString,u=n.DERSequence,s=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(o,l){if(o.hash!=null)return o.hash;if(typeof o=="string"&&o.indexOf("-----BEGIN")==-1&&!Fe.isASN1HEX(o))return o;var f;if(typeof o=="string")f=o;else if(o.cert!=null)f=o.cert;else throw new t("hash nor cert unspecified");var p;f.indexOf("-----BEGIN")!=-1?p=Ar(f):p=f,typeof o=="string"&&(o.indexOf("-----BEGIN")!=-1?p=Ar(o):Fe.isASN1HEX(o)&&(p=o));var E;if(o.alg!=null)E=o.alg;else if(l!=null)E=l;else throw new t("hash alg unspecified");return r.crypto.Util.hashHex(p,E)},this.tohex=function(){var o=this.params,l=this.getCertHash(o,"sha1"),f=[];f.push(new i({hex:l})),(typeof o=="string"&&o.indexOf("-----BEGIN")!=-1||o.cert!=null&&o.hasis!=!1||o.issuer!=null&&o.serial!=null)&&f.push(new s(o));var p=new u({array:f});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.ESSCertID,g.asn1.ASN1Object);g.asn1.cms.SigningCertificateV2=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.x509,s=n.cms,o=s.ESSCertIDv2,l=r.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 f=this.params.array,p=[],E=0;E<f.length;E++){var d=f[E];(e.alg!=null||e.hasis==!1)&&typeof d=="string"&&(d.indexOf("-----BEGIN")!=-1||Fe.isASN1HEX(d))&&(d={cert:d}),d.alg==null&&e.alg!=null&&(d.alg=e.alg),d.hasis!=!1&&e.hasis==!1&&(d.hasis=!1),p.push(new o(d))}var h=new i({array:p}),w=new i({array:[h]});return[w]},e!=null&&this.setByParam(e)};de(g.asn1.cms.SigningCertificateV2,g.asn1.cms.Attribute);g.asn1.cms.ESSCertIDv2=function(e){g.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);var t=Error,r=g,n=r.asn1,i=n.DEROctetString,u=n.DERSequence,s=n.cms.IssuerSerial,o=n.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var l=this.params,f=this.getCertHash(l,"sha256"),p=[];l.alg!=null&&l.alg!="sha256"&&p.push(new o({name:l.alg})),p.push(new i({hex:f})),(typeof l=="string"&&l.indexOf("-----BEGIN")!=-1||l.cert!=null&&l.hasis!=!1||l.issuer!=null&&l.serial!=null)&&p.push(new s(l));var E=new u({array:p});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.ESSCertIDv2,g.asn1.cms.ESSCertID);g.asn1.cms.IssuerSerial=function(e){var t=Error,r=g,n=r.asn1,i=n.DERInteger,u=n.DERSequence,s=n.cms,o=n.x509,l=o.GeneralNames,f=Ze;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(p){this.params=p},this.tohex=function(){var p=this.params,E,d;if(typeof p=="string"&&p.indexOf("-----BEGIN")!=-1||p.cert!=null){var h;p.cert!=null?h=p.cert:h=p;var w=new f;w.readCertPEM(h),E=w.getIssuer(),d={hex:w.getSerialNumberHex()}}else if(p.issuer!=null&&p.serial)E=p.issuer,d=p.serial;else throw new t("cert or issuer and serial parameter not specified");var m=new l([{dn:E}]),y=new i(d),A=new u({array:[m,y]});return A.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.IssuerSerial,g.asn1.ASN1Object);g.asn1.cms.SignerIdentifier=function(e){var t=g,r=t.asn1,n=r.DERInteger,i=r.DERSequence,u=r.cms,s=u.IssuerAndSerialNumber,o=u.SubjectKeyIdentifier,l=r.x509,f=l.X500Name,p=Ze,E=Error;u.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params;if(d.type=="isssn"){var h=new s(d);return h.tohex()}else if(d.type=="skid"){var w=new o(d);return w.tohex()}else throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.SignerIdentifier,g.asn1.ASN1Object);g.asn1.cms.IssuerAndSerialNumber=function(e){var t=g,r=t.asn1,n=r.DERInteger,i=r.DERSequence,u=r.cms,s=r.x509,o=s.X500Name,l=Ze,f=Error;u.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params,E,d;if(typeof p=="string"&&p.indexOf("-----BEGIN")!=-1||p.cert!=null){var h;p.cert!=null?h=p.cert:h=p;var w=new l;w.readCertPEM(h),E=w.getIssuer(),d={hex:w.getSerialNumberHex()}}else if(p.issuer!=null&&p.serial)E=p.issuer,d=p.serial;else throw new f("cert or issuer and serial parameter not specified");var m=new o(E),y=new n(d),A=new i({array:[m,y]});return A.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(p){this.params=p},e!=null&&this.setByParam(e)};de(g.asn1.cms.IssuerAndSerialNumber,g.asn1.ASN1Object);g.asn1.cms.SubjectKeyIdentifier=function(e){var t=g,r=t.asn1,n=r.DERInteger,i=r.DERSequence,u=r.ASN1Util.newObject,s=r.cms,o=s.IssuerAndSerialName,l=s.SubjectKeyIdentifier,f=r.x509,p=f.X500Name,E=Ze,d=Error;s.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var h=this.params;if(h.cert==null&&h.skid==null)throw new d("property cert nor skid undefined");var w;if(h.cert!=null){var m=new E(h.cert),y=m.getExtSubjectKeyIdentifier();w=y.kid.hex}else h.skid!=null&&(w=h.skid);var A=u({tag:{tage:"a0",obj:{octstr:{hex:w}}}});return A.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.SubjectKeyIdentifier,g.asn1.ASN1Object);g.asn1.cms.AttributeList=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSet,u=n.cms;u.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 o=!0;s.sortflag!=null&&(o=s.sortflag);for(var l=s.array,f=[],p=0;p<l.length;p++){var E=l[p],d=E.attr;if(d=="contentType")f.push(new u.ContentType(E));else if(d=="messageDigest")f.push(new u.MessageDigest(E));else if(d=="signingTime")f.push(new u.SigningTime(E));else if(d=="signingCertificate")f.push(new u.SigningCertificate(E));else if(d=="signingCertificateV2")f.push(new u.SigningCertificateV2(E));else if(d=="signaturePolicyIdentifier")f.push(new g.asn1.cades.SignaturePolicyIdentifier(E));else if(d=="signatureTimeStamp"||d=="timeStampToken")f.push(new g.asn1.cades.SignatureTimeStamp(E));else throw new t("unknown attr: "+d)}var h=new i({array:f,sortflag:o});return this.hTLV=h.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.AttributeList,g.asn1.ASN1Object);g.asn1.cms.SignerInfo=function(e){var t=Error,r=g,n=r.asn1,i=n.DERInteger,u=n.DEROctetString,s=n.DERSequence,o=n.DERTaggedObject,l=n.cms,f=l.SignerIdentifier,p=l.AttributeList,E=l.ContentType,d=l.EncapsulatedContentInfo,h=l.MessageDigest,w=l.SignedData,m=n.x509,y=m.AlgorithmIdentifier,A=r.crypto,C=Ft;l.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var S=this.params,B=S.sigalg,I=new p(S.sattrs).tohex(),M=C.getKey(S.signkey),q=new A.Signature({alg:B});q.init(M),q.updateHex(I);var b=q.sign();S.sighex=b},this.tohex=function(){var S=this.params,B=[];if(B.push(new i({int:S.version})),B.push(new f(S.id)),B.push(new y({name:S.hashalg})),S.sattrs!=null){var I=new p(S.sattrs);try{B.push(new o({tag:"a0",explicit:!1,obj:I}))}catch(q){throw new t("si sattr error: "+q)}}if(S.sigalgfield!=null?B.push(new y({name:S.sigalgfield})):B.push(new y({name:S.sigalg})),S.sighex==null&&S.signkey!=null&&this.sign(),B.push(new u({hex:S.sighex})),S.uattrs!=null){var I=new p(S.uattrs);try{B.push(new o({tag:"a1",explicit:!1,obj:I}))}catch(b){throw new t("si uattr error: "+b)}}var M=new s({array:B});return M.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.SignerInfo,g.asn1.ASN1Object);g.asn1.cms.EncapsulatedContentInfo=function(e){var t=g,r=t.asn1,n=r.DERTaggedObject,i=r.DERSequence,u=r.DERObjectIdentifier,s=r.DEROctetString,o=r.cms;o.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params,f=[];if(f.push(new u(l.type)),l.content!=null&&(l.content.hex!=null||l.content.str!=null)&&l.isDetached!=!0){var p=new s(l.content),E=new n({tag:"a0",explicit:!0,obj:p});f.push(E)}var d=new i({array:f});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(l){this.params=l},e!=null&&this.setByParam(e)};de(g.asn1.cms.EncapsulatedContentInfo,g.asn1.ASN1Object);g.asn1.cms.ContentInfo=function(e){var t=g,r=t.asn1,n=r.DERTaggedObject,i=r.DERSequence,u=r.DERObjectIdentifier,s=r.x509,o=s.OID.name2obj;g.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params,f=[];f.push(new u(l.type));var p=new n({tag:"a0",explicit:!0,obj:l.obj});f.push(p);var E=new i({array:f});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(l){this.params=l},e!=null&&this.setByParam(e)};de(g.asn1.cms.ContentInfo,g.asn1.ASN1Object);g.asn1.cms.SignedData=function(e){var t=Error,r=g,n=r.asn1,i=n.ASN1Object,u=n.DERInteger,s=n.DERSet,o=n.DERSequence,l=n.DERTaggedObject,f=n.cms,p=f.EncapsulatedContentInfo,E=f.SignerInfo,d=f.ContentInfo,h=f.CertificateSet,w=f.RevocationInfoChoices,m=n.x509,y=m.AlgorithmIdentifier;g.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var A=this.params;this._setDigestAlgs(A),this._setContentTypeByEContent(A),this._setMessageDigestByEContent(A),this._setSignerInfoVersion(A),this._setSignedDataVersion(A)},this._setDigestAlgs=function(A){for(var C={},S=A.sinfos,B=0;B<S.length;B++){var I=S[B];C[I.hashalg]=1}A.hashalgs=Object.keys(C).sort()},this._setContentTypeByEContent=function(A){for(var C=A.econtent.type,S=A.sinfos,B=0;B<S.length;B++){var I=S[B],M=this._getAttrParamByName(I,"contentType");M.type=C}},this._setMessageDigestByEContent=function(A){var C=A.econtent,S=A.econtent.type,B=C.content.hex;B==null&&C.type=="data"&&C.content.str!=null&&(B=$s(C.content.str));for(var I=A.sinfos,M=0;M<I.length;M++){var q=I[M],b=q.hashalg,R=this._getAttrParamByName(q,"messageDigest"),L=g.crypto.Util.hashHex(B,b);R.hex=L}},this._getAttrParamByName=function(A,C){for(var S=A.sattrs.array,B=0;B<S.length;B++)if(S[B].attr==C)return S[B]},this._setSignerInfoVersion=function(A){for(var C=A.sinfos,S=0;S<C.length;S++){var B=C[S],I=1;B.id.type=="skid"&&(I=3),B.version=I}},this._setSignedDataVersion=function(A){var C=this._getSignedDataVersion(A);A.version=C},this._getSignedDataVersion=function(A){if(A.revinfos!=null)for(var C=A.revinfos,S=0;S<C.length;S++){var B=C[S];if(B.ocsp!=null)return 5}for(var I=A.sinfos,S=0;S<I.length;S++){var M=A.sinfos[S];if(M.version==3)return 3}return A.econtent.type!="data"?3:1},this.tohex=function(){var A=this.params;this.getEncodedHexPrepare!=null&&this.getEncodedHexPrepare(),A.fixed!=!0&&this.checkAndFixParam();var C=[];C.push(new u({int:A.version}));for(var S=[],B=0;B<A.hashalgs.length;B++){var I=A.hashalgs[B];S.push(new y({name:I}))}C.push(new s({array:S})),C.push(new p(A.econtent)),A.certs!=null&&C.push(new h(A.certs)),A.revinfos!=null&&C.push(new w(A.revinfos));for(var M=[],B=0;B<A.sinfos.length;B++){var q=A.sinfos[B];M.push(new E(q))}C.push(new s({array:M}));var b=new o({array:C});return b.tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){var A=new d({type:"signed-data",obj:this});return A},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.SignedData,g.asn1.ASN1Object);g.asn1.cms.CertificateSet=function(e){g.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,r=g.asn1,n=r.DERTaggedObject,i=r.DERSet,u=r.ASN1Object;this.params=null,this.tohex=function(){var s=this.params,o=[],l;if(s instanceof Array)l=s;else if(s.array!=null)l=s.array;else throw new t("cert array not specified");for(var f=0;f<l.length;f++){var p=l[f],E=Ar(p),d=new u;d.hTLV=E,o.push(d)}var h={array:o};s.sortflag==!1&&(h.sortflag=!1);var w=new i(h),m=new n({tag:"a0",explicit:!1,obj:w});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.CertificateSet,g.asn1.ASN1Object);g.asn1.cms.RevocationInfoChoices=function(e){g.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new Error("params is not array");for(var r=[],n=0;n<t.length;n++)r.push(new g.asn1.cms.RevocationInfoChoice(t[n]));var i=g.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:r}}});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.RevocationInfoChoices,g.asn1.ASN1Object);g.asn1.cms.RevocationInfoChoice=function(e){g.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(t.crl!=null&&typeof t.crl=="string"){var r=t.crl;return t.crl.indexOf("-----BEGIN")!=-1&&(r=Ar(t.crl)),r}else if(t.ocsp!=null){var n=g.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new g.asn1.cms.OtherRevocationFormat(t)}});return n.tohex()}else throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.RevocationInfoChoice,g.asn1.ASN1Object);g.asn1.cms.OtherRevocationFormat=function(e){g.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,r=g,n=r.asn1,i=n.ASN1Util.newObject,u=r.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(!u(s.ocsp)||!Fe.isASN1HEX(s.ocsp))throw new t("ocsp value not ASN.1 hex string");var o=i({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:s.ocsp}}]});return o.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cms.OtherRevocationFormat,g.asn1.ASN1Object);g.asn1.cms.CMSUtil=new function(){};g.asn1.cms.CMSUtil.newSignedData=function(e){return new g.asn1.cms.SignedData(e)};g.asn1.cms.CMSUtil.verifySignedData=function(e){var t=g,r=t.asn1,n=r.cms,i=n.SignerInfo,u=n.SignedData,s=n.SigningTime,o=n.SigningCertificate,l=n.SigningCertificateV2,f=r.cades,p=f.SignaturePolicyIdentifier,E=t.lang.String.isHex,d=Fe,h=d.getVbyList,w=d.getTLVbyList,m=d.getIdxbyList,y=d.getChildIdx,A=d.getTLV,C=d.oidname,S=t.crypto.Util.hashHex;e.cms===void 0&&E(e.cms);var B=e.cms,I=function(z,J){for(var se,De=3;De<6;De++)if(se=m(z,0,[1,0,De]),se!==void 0){var ye=z.substr(se,2);ye==="a0"&&(J.certsIdx=se),ye==="a1"&&(J.revinfosIdx=se),ye==="31"&&(J.signerinfosIdx=se)}},M=function(z,J){var se=J.signerinfosIdx;if(se!==void 0){var De=y(z,se);J.signerInfoIdxList=De;for(var ye=0;ye<De.length;ye++){var Pe=De[ye],Qe={idx:Pe};q(z,Qe),J.signerInfos.push(Qe)}}},q=function(z,J){var se=J.idx;J.signerid_issuer1=w(z,se,[1,0],"30"),J.signerid_serial1=h(z,se,[1,1],"02"),J.hashalg=C(h(z,se,[2,0],"06"));var De=m(z,se,[3],"a0");J.idxSignedAttrs=De,b(z,J,De);var ye=y(z,se),Pe=ye.length;if(Pe<6)throw"malformed SignerInfo";J.sigalg=C(h(z,se,[Pe-2,0],"06")),J.sigval=h(z,se,[Pe-1],"04")},b=function(z,J,se){var De=y(z,se);J.signedAttrIdxList=De;for(var ye=0;ye<De.length;ye++){var Pe=De[ye],Qe=h(z,Pe,[0],"06"),ce;Qe==="2a864886f70d010905"?(ce=Wt(h(z,Pe,[1,0])),J.saSigningTime=ce):Qe==="2a864886f70d010904"&&(ce=h(z,Pe,[1,0],"04"),J.saMessageDigest=ce)}},R=function(z,J){if(h(z,0,[0],"06")!=="2a864886f70d010702")return J;J.cmsType="signedData",J.econtent=h(z,0,[1,0,2,1,0]),I(z,J),J.signerInfos=[],M(z,J)},L=function(z,J){for(var se=J.parse.signerInfos,De=se.length,ye=!0,Pe=0;Pe<De;Pe++){var Qe=se[Pe];G(z,J,Qe,Pe),Qe.isValid||(ye=!1)}J.isValid=ye},j=function(z,J,se,De){var ye=J.parse.certsIdx,Pe;if(J.certs===void 0){Pe=[],J.certkeys=[];for(var Qe=y(z,ye),ce=0;ce<Qe.length;ce++){var Be=A(z,Qe[ce]),Ge=new Ze;Ge.readCertHex(Be),Pe[ce]=Ge,J.certkeys[ce]=Ge.getPublicKey()}J.certs=Pe}else Pe=J.certs;J.cccc=Pe.length,J.cccci=Qe.length;for(var ce=0;ce<Pe.length;ce++){var Tr=Ge.getIssuerHex(),Jt=Ge.getSerialNumberHex();se.signerid_issuer1===Tr&&se.signerid_serial1===Jt&&(se.certkey_idx=ce)}},G=function(z,J,se,De){se.verifyDetail={};var ye=se.verifyDetail,Pe=J.parse.econtent,Qe=se.hashalg,ce=se.saMessageDigest;ye.validMessageDigest=!1,S(Pe,Qe)===ce&&(ye.validMessageDigest=!0),j(z,J,se,De),ye.validSignatureValue=!1;var Be=se.sigalg,Ge="31"+A(z,se.idxSignedAttrs).substr(2);se.signedattrshex=Ge;var Tr=J.certs[se.certkey_idx].getPublicKey(),Jt=new g.crypto.Signature({alg:Be});Jt.init(Tr),Jt.updateHex(Ge);var St=Jt.verify(se.sigval);ye.validSignatureValue_isValid=St,St===!0&&(ye.validSignatureValue=!0),se.isValid=!1,ye.validMessageDigest&&ye.validSignatureValue&&(se.isValid=!0)},Y=function(){},V={isValid:!1,parse:{}};return R(B,V.parse),L(B,V),V};g.asn1.cms.CMSParser=function(){var e=Error,t=Ze,r=new t,n=Fe,i=n.getV,u=n.getTLV,s=n.getIdxbyList,o=n.getTLVbyList,l=n.getTLVbyListEx,f=n.getVbyList,p=n.getVbyListEx,E=n.getChildIdx;this.getCMSSignedData=function(d){var h=o(d,0,[1,0]),w=this.getSignedData(h);return w},this.getSignedData=function(d){var h=E(d,0),w={},m=i(d,h[0]),y=parseInt(m,16);w.version=y;var A=u(d,h[1]);w.hashalgs=this.getHashAlgArray(A);var C=u(d,h[2]);w.econtent=this.getEContent(C);var S=l(d,0,["[0]"]);S!=null&&(w.certs=this.getCertificateSet(S));var B=l(d,0,["[1]"]);B!=null;var I=l(d,0,[3]);return w.sinfos=this.getSignerInfos(I),w},this.getHashAlgArray=function(d){for(var h=E(d,0),w=new t,m=[],y=0;y<h.length;y++){var A=u(d,h[y]),C=w.getAlgorithmIdentifierName(A);m.push(C)}return m},this.getEContent=function(d){var h={},w=f(d,0,[0]),m=f(d,0,[1,0]);return h.type=g.asn1.x509.OID.oid2name(Fe.hextooidstr(w)),h.content={hex:m},h},this.getSignerInfos=function(d){for(var h=[],w=E(d,0),m=0;m<w.length;m++){var y=u(d,w[m]),A=this.getSignerInfo(y);h.push(A)}return h},this.getSignerInfo=function(d){var h={},w=E(d,0),m=n.getInt(d,w[0],-1);m!=-1&&(h.version=m);var y=u(d,w[1]),A=this.getIssuerAndSerialNumber(y);h.id=A;var C=u(d,w[2]),S=r.getAlgorithmIdentifierName(C);h.hashalg=S;var B=l(d,0,["[0]"]);if(B!=null){var I=this.getAttributeList(B);h.sattrs=I}var M=l(d,0,[3]),q=r.getAlgorithmIdentifierName(M);h.sigalg=q;var b=p(d,0,[4]);h.sighex=b;var R=l(d,0,["[1]"]);if(R!=null){var L=this.getAttributeList(R);h.uattrs=L}return h},this.getSignerIdentifier=function(d){if(d.substr(0,2)=="30")return this.getIssuerAndSerialNumber(d);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(d){var h={type:"isssn"},w=E(d,0),m=u(d,w[0]);h.issuer=r.getX500Name(m);var y=i(d,w[1]);return h.serial={hex:y},h},this.getAttributeList=function(d){for(var h=[],w=E(d,0),m=0;m<w.length;m++){var y=u(d,w[m]),A=this.getAttribute(y);h.push(A)}return{array:h}},this.getAttribute=function(d){var h={},w=E(d,0),m=n.getOID(d,w[0]),y=g.asn1.x509.OID.oid2name(m);h.attr=y;var A=u(d,w[1]),C=E(A,0);if(C.length==1)h.valhex=u(A,C[0]);else{for(var S=[],B=0;B<C.length;B++)S.push(u(A,C[B]));h.valhex=S}return y=="contentType"?this.setContentType(h):y=="messageDigest"?this.setMessageDigest(h):y=="signingTime"?this.setSigningTime(h):y=="signingCertificate"?this.setSigningCertificate(h):y=="signingCertificateV2"?this.setSigningCertificateV2(h):y=="signaturePolicyIdentifier"&&this.setSignaturePolicyIdentifier(h),h},this.setContentType=function(d){var h=n.getOIDName(d.valhex,0,null);h!=null&&(d.type=h,delete d.valhex)},this.setSigningTime=function(d){var h=i(d.valhex,0),w=Wt(h);d.str=w,delete d.valhex},this.setMessageDigest=function(d){var h=i(d.valhex,0);d.hex=h,delete d.valhex},this.setSigningCertificate=function(d){var h=E(d.valhex,0);if(h.length>0){for(var w=u(d.valhex,h[0]),m=E(w,0),y=[],A=0;A<m.length;A++){var C=u(w,m[A]),S=this.getESSCertID(C);y.push(S)}d.array=y}if(h.length>1){var B=u(d.valhex,h[1]);d.polhex=B}delete d.valhex},this.setSignaturePolicyIdentifier=function(d){var h=E(d.valhex,0);if(h.length>0){var w=n.getOID(d.valhex,h[0]);d.oid=w}if(h.length>1){var m=new t,y=E(d.valhex,h[1]),A=u(d.valhex,y[0]),C=m.getAlgorithmIdentifierName(A);d.alg=C;var S=i(d.valhex,y[1]);d.hash=S}delete d.valhex},this.setSigningCertificateV2=function(d){var h=E(d.valhex,0);if(h.length>0){for(var w=u(d.valhex,h[0]),m=E(w,0),y=[],A=0;A<m.length;A++){var C=u(w,m[A]),S=this.getESSCertIDv2(C);y.push(S)}d.array=y}if(h.length>1){var B=u(d.valhex,h[1]);d.polhex=B}delete d.valhex},this.getESSCertID=function(d){var h={},w=E(d,0);if(w.length>0){var m=i(d,w[0]);h.hash=m}if(w.length>1){var y=u(d,w[1]),A=this.getIssuerSerial(y);A.serial!=null&&(h.serial=A.serial),A.issuer!=null&&(h.issuer=A.issuer)}return h},this.getESSCertIDv2=function(d){var h={},w=E(d,0);if(w.length<1||3<w.length)throw new e("wrong number of elements");var m=0;if(d.substr(w[0],2)=="30"){var y=u(d,w[0]);h.alg=r.getAlgorithmIdentifierName(y),m++}else h.alg="sha256";var A=i(d,w[m]);if(h.hash=A,w.length>m+1){var C=u(d,w[m+1]),S=this.getIssuerSerial(C);h.issuer=S.issuer,h.serial=S.serial}return h},this.getIssuerSerial=function(d){var h={},w=E(d,0),m=u(d,w[0]),y=r.getGeneralNames(m),A=y[0].dn;h.issuer=A;var C=i(d,w[1]);return h.serial={hex:C},h},this.getCertificateSet=function(d){for(var h=E(d,0),w=[],m=0;m<h.length;m++){var y=u(d,h[m]);if(y.substr(0,2)=="30"){var A=$n(y,"CERTIFICATE");w.push(A)}}return{array:w,sortflag:!1}}};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.tsp>"u"||!g.asn1.tsp)&&(g.asn1.tsp={});g.asn1.tsp.TimeStampToken=function(e){var t=g,r=t.asn1,n=r.tsp;n.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var i=new n.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=i.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.tsp.TimeStampToken,g.asn1.cms.SignedData);g.asn1.tsp.TSTInfo=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.DERInteger,s=n.DERBoolean,o=n.DERGeneralizedTime,l=n.DERObjectIdentifier,f=n.DERTaggedObject,p=n.tsp,E=p.MessageImprint,d=p.Accuracy,h=n.x509.X500Name,w=n.x509.GeneralName;if(p.TSTInfo.superclass.constructor.call(this),this.dVersion=new u({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 m=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(m.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(m.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(m.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");m.push(this.dGenTime),this.dAccuracy!=null&&m.push(this.dAccuracy),this.dOrdering!=null&&m.push(this.dOrdering),this.dNonce!=null&&m.push(this.dNonce),this.dTsa!=null&&m.push(this.dTsa);var y=new i({array:m});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 l({oid:e.policy})}e.messageImprint!==void 0&&(this.dMessageImprint=new E(e.messageImprint)),e.serial!==void 0&&(this.dSerial=new u(e.serial)),e.genTime!==void 0&&(this.dGenTime=new o(e.genTime)),e.accuracy!==void 0&&(this.dAccuracy=new d(e.accuracy)),e.ordering!==void 0&&e.ordering==!0&&(this.dOrdering=new s),e.nonce!==void 0&&(this.dNonce=new u(e.nonce)),e.tsa!==void 0&&(this.dTsa=new f({tag:"a0",explicit:!0,obj:new w({dn:e.tsa})}))}};de(g.asn1.tsp.TSTInfo,g.asn1.ASN1Object);g.asn1.tsp.Accuracy=function(e){var t=g,r=t.asn1,n=r.ASN1Util.newObject;r.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var i=this.params,u=[];return i.seconds!=null&&typeof i.seconds=="number"&&u.push({int:i.seconds}),i.millis!=null&&typeof i.millis=="number"&&u.push({tag:{tagi:"80",obj:{int:i.millis}}}),i.micros!=null&&typeof i.micros=="number"&&u.push({tag:{tagi:"81",obj:{int:i.micros}}}),n({seq:u}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.tsp.Accuracy,g.asn1.ASN1Object);g.asn1.tsp.MessageImprint=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.DEROctetString,u=r.x509,s=u.AlgorithmIdentifier;r.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var o=this.params,l=new s({name:o.alg}),f=new i({hex:o.hash}),p=new n({array:[l,f]});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.tsp.MessageImprint,g.asn1.ASN1Object);g.asn1.tsp.TimeStampReq=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.DERInteger,u=r.DERBoolean,s=r.ASN1Object,o=r.DERObjectIdentifier,l=r.tsp,f=l.MessageImprint;l.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params,E=[];E.push(new i({int:1})),p.messageImprint instanceof g.asn1.ASN1Object?E.push(p.messageImprint):E.push(new f(p.messageImprint)),p.policy!=null&&E.push(new o(p.policy)),p.nonce!=null&&E.push(new i(p.nonce)),p.certreq==!0&&E.push(new u);var d=new n({array:E});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.tsp.TimeStampReq,g.asn1.ASN1Object);g.asn1.tsp.TimeStampResp=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.ASN1Object,u=r.tsp,s=u.PKIStatusInfo;u.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var o=this.params,l=[];if(o.econtent!=null||o.tst!=null)if(o.statusinfo!=null?l.push(new s(o.statusinfo)):l.push(new s("granted")),o.econtent!=null)l.push(new u.TimeStampToken(o).getContentInfo());else if(o.tst instanceof r.ASN1Object)l.push(o.tst);else throw new Error("improper member tst value");else if(o.statusinfo!=null)l.push(new s(o.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var f=new n({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.tsp.TimeStampResp,g.asn1.ASN1Object);g.asn1.tsp.PKIStatusInfo=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.tsp,s=u.PKIStatus,o=u.PKIFreeText,l=u.PKIFailureInfo;u.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params,p=[];if(typeof f=="string")p.push(new s(f));else{if(f.status==null)throw new t("property 'status' unspecified");p.push(new s(f.status)),f.statusstr!=null&&p.push(new o(f.statusstr)),f.failinfo!=null&&p.push(new l(f.failinfo))}var E=new i({array:p});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.tsp.PKIStatusInfo,g.asn1.ASN1Object);g.asn1.tsp.PKIStatus=function(e){var t=Error,r=g,n=r.asn1,i=n.DERInteger,u=n.tsp;u.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 o=this.params,l,f;if(typeof o=="string")try{f=s[o]}catch{throw new t("undefined name: "+o)}else if(typeof o=="number")f=o;else throw new t("unsupported params");return new i({int:f}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.tsp.PKIStatus,g.asn1.ASN1Object);g.asn1.tsp.PKIFreeText=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.DERUTF8String,s=n.tsp;s.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var o=this.params;if(!o instanceof Array)throw new t("wrong params: not array");for(var l=[],f=0;f<o.length;f++)l.push(new u({str:o[f]}));var p=new i({array:l});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.tsp.PKIFreeText,g.asn1.ASN1Object);g.asn1.tsp.PKIFailureInfo=function(e){var t=Error,r=g,n=r.asn1,i=n.DERBitString,u=n.tsp,s=u.PKIFailureInfo,o={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 l=this.params,f=0;if(typeof l=="number"&&0<=l&&l<=25){f|=1<<l;for(var p=f.toString(2),E="",d=p.length-1;d>=0;d--)E+=p[d];return E}else{if(typeof l=="string"&&o[l]!=null)return Lf([l],o);if(typeof l=="object"&&l.length!=null)return Lf(l,o);throw new t("wrong params")}},this.tohex=function(){var l=this.params,f=this.getBinValue();return new i({bin:f}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.tsp.PKIFailureInfo,g.asn1.ASN1Object);g.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(t,r){throw"not implemented yet"}};g.asn1.tsp.SimpleTSAAdapter=function(e){var t=g,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(u,s){var o=i(u,s);this.params.econtent.content.messageImprint={alg:s,hash:o},this.params.econtent.content.serial={int:this.serial++};var l=Math.floor(Math.random()*1e9);this.params.econtent.content.nonce={int:l};var f=new n.TimeStampToken(this.params);return f.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};de(g.asn1.tsp.SimpleTSAAdapter,g.asn1.tsp.AbstractTSAAdapter);g.asn1.tsp.FixedTSAAdapter=function(e){var t=g,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(u,s){var o=i(u,s);this.params.econtent.content.messageImprint={alg:s,hash:o};var l=new n.TimeStampToken(this.params);return l.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};de(g.asn1.tsp.FixedTSAAdapter,g.asn1.tsp.AbstractTSAAdapter);g.asn1.tsp.TSPUtil=new function(){};g.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new g.asn1.tsp.TimeStampToken(e)};g.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=new g.asn1.tsp.TSPParser;return t.getTimeStampReq(e)};g.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=new g.asn1.tsp.TSPParser;return t.getMessageImprint(e)};g.asn1.tsp.TSPParser=function(){var e=Error,t=Ze,r=new t,n=Fe,i=n.getV,u=n.getTLV,s=n.getIdxbyList,o=n.getTLVbyListEx,l=n.getChildIdx,f=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],p={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(E){var d=l(E,0);if(d.length==1)return this.getPKIStatusInfo(u(E,d[0]));if(d.length>1){var h=this.getPKIStatusInfo(u(E,d[0])),w=u(E,d[1]),m=this.getToken(w);return m.statusinfo=h,m}},this.getToken=function(E){var d=new g.asn1.cms.CMSParser,h=d.getCMSSignedData(E);return this.setTSTInfo(h),h},this.setTSTInfo=function(E){var d=E.econtent;if(d.type=="tstinfo"){var h=d.content.hex,w=this.getTSTInfo(h);d.content=w}},this.getTSTInfo=function(E){var d={},h=l(E,0),w=i(E,h[1]);d.policy=zf(w);var m=u(E,h[2]);d.messageImprint=this.getMessageImprint(m);var y=i(E,h[3]);d.serial={hex:y};var A=i(E,h[4]);d.genTime={str:Wt(A)};var C=0;if(h.length>5&&E.substr(h[5],2)=="30"){var S=u(E,h[5]);d.accuracy=this.getAccuracy(S),C++}if(h.length>5+C&&E.substr(h[5+C],2)=="01"){var B=i(E,h[5+C]);B=="ff"&&(d.ordering=!0),C++}if(h.length>5+C&&E.substr(h[5+C],2)=="02"){var I=i(E,h[5+C]);d.nonce={hex:I},C++}if(h.length>5+C&&E.substr(h[5+C],2)=="a0"){var M=u(E,h[5+C]);M="30"+M.substr(2),pGeneralNames=r.getGeneralNames(M);var q=pGeneralNames[0].dn;d.tsa=q,C++}if(h.length>5+C&&E.substr(h[5+C],2)=="a1"){var b=u(E,h[5+C]);b="30"+b.substr(2);var R=r.getExtParamArray(b);d.ext=R,C++}return d},this.getAccuracy=function(E){for(var d={},h=l(E,0),w=0;w<h.length;w++){var m=E.substr(h[w],2),y=i(E,h[w]),A=parseInt(y,16);m=="02"?d.seconds=A:m=="80"?d.millis=A:m=="81"&&(d.micros=A)}return d},this.getMessageImprint=function(E){if(E.substr(0,2)!="30")throw new Error("head of messageImprint hex shall be x30");var d={},h=l(E,0),w=s(E,0,[0,0]),m=i(E,w),y=n.hextooidstr(m),A=g.asn1.x509.OID.oid2name(y);if(A=="")throw new Error("hashAlg name undefined: "+y);var C=A,S=s(E,0,[1]);return d.alg=C,d.hash=i(E,S),d},this.getPKIStatusInfo=function(E){var d={},h=l(E,0),w=0;try{var m=i(E,h[0]),y=parseInt(m,16);d.status=f[y]}catch{}if(h.length>1&&E.substr(h[1],2)=="30"){var A=u(E,h[1]);d.statusstr=this.getPKIFreeText(A),w++}if(h.length>w&&E.substr(h[1+w],2)=="03"){var C=u(E,h[1+w]);d.failinfo=this.getPKIFailureInfo(C)}return d},this.getPKIFreeText=function(E){for(var d=[],h=l(E,0),w=0;w<h.length;w++)d.push(n.getString(E,h[w]));return d},this.getPKIFailureInfo=function(E){var d=n.getInt(E,0);return p[d]!=null?p[d]:d},this.getTimeStampReq=function(E){var d={};d.certreq=!1;var h=l(E,0);if(h.length<2)throw new Error("TimeStampReq must have at least 2 items");var w=u(E,h[1]);d.messageImprint=g.asn1.tsp.TSPUtil.parseMessageImprint(w);for(var m=2;m<h.length;m++){var y=h[m],A=E.substr(y,2);if(A=="06"){var C=i(E,y);d.policy=n.hextooidstr(C)}A=="02"&&(d.nonce=i(E,y)),A=="01"&&(d.certreq=!0)}return d}};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.cades>"u"||!g.asn1.cades)&&(g.asn1.cades={});g.asn1.cades.SignaturePolicyIdentifier=function(e){var t=g,r=t.asn1,n=r.cades,i=n.SignaturePolicyId;n.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};de(g.asn1.cades.SignaturePolicyIdentifier,g.asn1.cms.Attribute);g.asn1.cades.SignaturePolicyId=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,u=r.x509,s=u.AlgorithmIdentifier,o=r.cades,l=o.SignaturePolicyId,f=o.OtherHashAlgAndValue;l.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params,E=[];E.push(new i(p.oid)),E.push(new f(p));var d=new n({array:E});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(p){this.params=p},e!=null&&this.setByParam(e)};de(g.asn1.cades.SignaturePolicyId,g.asn1.ASN1Object);g.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.DEROctetString,s=n.x509,o=s.AlgorithmIdentifier,l=n.cades,f=l.OtherHashAlgAndValue;f.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params;if(p.alg==null)throw new t("property 'alg' not specified");if(p.hash==null&&p.cert==null)throw new t("property 'hash' nor 'cert' not specified");var E=null;if(p.hash!=null)E=p.hash;else if(p.cert!=null){if(typeof p.cert!="string")throw new t("cert not string");var d=p.cert;p.cert.indexOf("-----BEGIN")!=-1&&(d=Ar(p.cert)),E=g.crypto.Util.hashHex(d,p.alg)}var h=[];h.push(new o({name:p.alg})),h.push(new u({hex:E}));var w=new i({array:h});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cades.OtherHashAlgAndValue,g.asn1.ASN1Object);g.asn1.cades.OtherHashValue=function(e){g.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,r=g,n=r.lang.String.isHex,i=r.asn1,u=i.DEROctetString,s=r.crypto.Util.hashHex;this.params=null,this.tohex=function(){var o=this.params;if(o.hash==null&&o.cert==null)throw new t("hash or cert not specified");var l=null;if(o.hash!=null)l=o.hash;else if(o.cert!=null){if(typeof o.cert!="string")throw new t("cert not string");var f=o.cert;o.cert.indexOf("-----BEGIN")!=-1&&(f=Ar(o.cert)),l=g.crypto.Util.hashHex(f,"sha1")}return new u({hex:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cades.OtherHashValue,g.asn1.ASN1Object);g.asn1.cades.SignatureTimeStamp=function(e){var t=Error,r=g,n=r.lang.String.isHex,i=r.asn1,u=i.ASN1Object,s=i.x509,o=i.cades;o.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var l=this.params;if(l.tst!=null)if(n(l.tst)){var f=new u;return f.hTLV=l.tst,[f]}else{if(l.tst instanceof u)return[l.tst];throw new t("params.tst has wrong value")}else if(l.res!=null){var p=l.res;if(p instanceof u&&(p=p.tohex()),typeof p!="string"||!n(p))throw new t("params.res has wrong value");var E=Fe.getTLVbyList(p,0,[1]),f=new u;return f.hTLV=l.tst,[f]}},e!=null&&this.setByParam(e)};de(g.asn1.cades.SignatureTimeStamp,g.asn1.cms.Attribute);g.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.cades,s=u.OtherCertID,o=r.lang.String.isHex;u.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var l=this.params,f=[],p=0;p<l.array.length;p++){var E=l.array[p];if(typeof E=="string")if(E.indexOf("-----BEGIN")!=-1)E={cert:E};else if(o(E))E={hash:E};else throw new t("unsupported value: "+E);l.alg!=null&&E.alg==null&&(E.alg=l.alg),l.hasis!=null&&E.hasis==null&&(E.hasis=l.hasis);var d=new s(E);f.push(d)}var h=new i({array:f});return[h]},e!=null&&this.setByParam(e)};de(g.asn1.cades.CompleteCertificateRefs,g.asn1.cms.Attribute);g.asn1.cades.OtherCertID=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.cms,u=i.IssuerSerial,s=r.cades,o=s.OtherHashValue,l=s.OtherHashAlgAndValue;s.OtherCertID.superclass.constructor.call(this),this.params=e,this.tohex=function(){var f=this.params;typeof f=="string"&&(f.indexOf("-----BEGIN")!=-1?f={cert:f}:_isHex(f)&&(f={hash:f}));var p=[],E=null;if(f.alg!=null?E=new l(f):E=new o(f),p.push(E),f.cert!=null&&f.hasis==!0||f.issuer!=null&&f.serial!=null){var d=new u(f);p.push(d)}var h=new n({array:p});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cades.OtherCertID,g.asn1.ASN1Object);g.asn1.cades.OtherHash=function(e){var t=Error,r=g,n=r.asn1,i=n.cms,u=n.cades,s=u.OtherHashAlgAndValue,o=u.OtherHashValue,l=r.crypto.Util.hashHex,f=r.lang.String.isHex;u.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params;typeof p=="string"&&(p.indexOf("-----BEGIN")!=-1?p={cert:p}:f(p)&&(p={hash:p}));var E=null;return p.alg!=null?E=new s(p):E=new o(p),E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};de(g.asn1.cades.OtherHash,g.asn1.ASN1Object);g.asn1.cades.CAdESUtil=new function(){};g.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){var t=new g.asn1.cms.CMSParser,r=t.getCMSSignedData(e);return r};g.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,r){var n=Fe,i=n.getChildIdx,u=n.getTLV,s=n.getV,o=g,l=o.asn1,f=l.ASN1Object,p=l.cms,E=p.AttributeList,d=p.SignerInfo,h={},w=i(e,t);if(w.length!=6)throw"not supported items for SignerInfo (!=6)";var m=w.shift();h.version=u(e,m);var y=w.shift();h.si=u(e,y);var A=w.shift();h.digalg=u(e,A);var C=w.shift();h.sattrs=u(e,C);var S=w.shift();h.sigalg=u(e,S);var B=w.shift();h.sig=u(e,B),h.sigval=s(e,B);var I=null;return h.obj=new d,I=new f,I.hTLV=h.version,h.obj.dCMSVersion=I,I=new f,I.hTLV=h.si,h.obj.dSignerIdentifier=I,I=new f,I.hTLV=h.digalg,h.obj.dDigestAlgorithm=I,I=new f,I.hTLV=h.sattrs,h.obj.dSignedAttrs=I,I=new f,I.hTLV=h.sigalg,h.obj.dSigAlg=I,I=new f,I.hTLV=h.sig,h.obj.dSig=I,h.obj.dUnsignedAttrs=new E,h};(typeof g.asn1.csr>"u"||!g.asn1.csr)&&(g.asn1.csr={});g.asn1.csr.CertificationRequest=function(e){var t=g,r=t.asn1,n=r.DERBitString,i=r.DERSequence,u=r.csr,s=r.x509,o=u.CertificationRequestInfo;u.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(l){this.params=l},this.sign=function(){var l=new o(this.params).tohex(),f=new g.crypto.Signature({alg:this.params.sigalg});f.init(this.params.sbjprvkey),f.updateHex(l);var p=f.sign();this.params.sighex=p},this.getPEM=function(){return $n(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var l=this.params,f=new g.asn1.csr.CertificationRequestInfo(this.params),p=new g.asn1.x509.AlgorithmIdentifier({name:l.sigalg});if(l.sighex==null&&l.sbjprvkey!=null&&this.sign(),l.sighex==null)throw new Error("sighex or sbjprvkey parameter not defined");var E=new n({hex:"00"+l.sighex}),d=new i({array:[f,p,E]});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.csr.CertificationRequest,g.asn1.ASN1Object);g.asn1.csr.CertificationRequestInfo=function(e){var t=g,r=t.asn1,n=r.DERBitString,i=r.DERSequence,u=r.DERInteger,s=r.DERUTF8String,o=r.DERTaggedObject,l=r.ASN1Util.newObject,f=r.csr,p=r.x509,E=p.X500Name,d=p.Extensions,h=p.SubjectPublicKeyInfo,w=f.AttributeList;f.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(y){y!=null&&(this.params=y)},this.tohex=function(){var y=this.params,A=[];if(A.push(new u({int:0})),A.push(new E(y.subject)),A.push(new h(Ft.getKey(y.sbjpubkey))),y.attrs!=null){var C=m(y.attrs),S=l({tag:{tage:"a0",obj:C}});A.push(S)}else if(y.extreq!=null){var B=new d(y.extreq),S=l({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[B]}]}}});A.push(S)}else A.push(new o({tag:"a0",explicit:!1,obj:new s({str:""})}));var I=new i({array:A});return I.tohex()},this.getEncodedHex=function(){return this.tohex()};function m(y){for(var A=Error,C=g.asn1.x509.Extensions,S=[],B=0;B<y.length;B++){var I=y[B],M=I.attr;if(M=="extensionRequest"){var q=new C(I.ext),b={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[q]}]};S.push(b)}else if(M=="unstructuredName"){var b={seq:[{oid:"1.2.840.113549.1.9.2"},{set:I.names}]};S.push(b)}else if(M=="challengePassword"){var b={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:I.password}]}]};S.push(b)}else throw new A("unknown CSR attribute")}return{set:S}}e!=null&&this.setByParam(e)};de(g.asn1.csr.CertificationRequestInfo,g.asn1.ASN1Object);g.asn1.csr.AttributeList=function(e){function t(r){}};de(g.asn1.csr.AttributeList,g.asn1.ASN1Object);g.asn1.csr.CSRUtil=new function(){};g.asn1.csr.CSRUtil.newCSRPEM=function(e){var t=Ft,r=g.asn1.csr,n=new r.CertificationRequest(e),i=n.getPEM();return i};g.asn1.csr.CSRUtil.getParam=function(e,t){var r=Fe,n=r.getV,i=r.getIdxbyList,u=r.getTLVbyList,s=r.getTLVbyListEx,o=r.getVbyListEx,l=function(C){var S=i(C,0,[0,3,0,0],"06");return n(C,S)!="2a864886f70d01090e"?null:u(C,0,[0,3,0,1,0],"30")},f={};if(e.indexOf("-----BEGIN CERTIFICATE REQUEST")==-1)throw new Error("argument is not PEM file");var p=Ar(e,"CERTIFICATE REQUEST");t&&(f.tbs=u(p,0,[0]));try{var E=s(p,0,[0,1]);if(E=="3000")f.subject={};else{var m=new Ze;f.subject=m.getX500Name(E)}}catch{}var d=s(p,0,[0,2]),h=Ft.getKey(d,null,"pkcs8pub");f.sbjpubkey=Ft.getPEM(h,"PKCS8PUB");var w=l(p),m=new Ze;w!=null&&(f.extreq=m.getExtParamArray(w));try{var y=s(p,0,[1],"30"),m=new Ze;f.sigalg=m.getAlgorithmIdentifierName(y)}catch{}try{var A=o(p,0,[2]);f.sighex=A}catch{}return f};g.asn1.csr.CSRUtil.verifySignature=function(e){try{var t=null;if(typeof e=="string"&&e.indexOf("-----BEGIN CERTIFICATE REQUEST")!=-1?t=g.asn1.csr.CSRUtil.getParam(e,!0):typeof e=="object"&&e.sbjpubkey!=null&&e.sigalg!=null&&e.sighex!=null&&e.tbs!=null&&(t=e),t==null)return!1;var r=new g.crypto.Signature({alg:t.sigalg});return r.init(t.sbjpubkey),r.updateHex(t.tbs),r.verify(t.sighex)}catch(n){return alert(n),!1}};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.ocsp>"u"||!g.asn1.ocsp)&&(g.asn1.ocsp={});g.asn1.ocsp.DEFAULT_HASH="sha1";g.asn1.ocsp.OCSPResponse=function(e){g.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);var t=g.asn1.DEREnumerated,r=g.asn1.ASN1Util.newObject,n=g.asn1.ocsp.ResponseBytes,i=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var u=this.params.resstatus;return typeof u=="number"?u:typeof u!="string"?-1:i.indexOf(u)},this.setByParam=function(u){this.params=u},this.tohex=function(){var u=this.params,s=this._getStatusCode();if(s==-1)throw new Error("responseStatus not supported: "+u.resstatus);if(s!=0)return r({seq:[{enum:{int:s}}]}).tohex();var o=new n(u);return r({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:o}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.OCSPResponse,g.asn1.ASN1Object);g.asn1.ocsp.ResponseBytes=function(e){g.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=g.asn1,r=t.DERSequence,n=t.DERObjectIdentifier,i=t.DEROctetString,u=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 o=new u(s),l=[];l.push(new n({name:"ocspBasic"})),l.push(new i({hex:o.tohex()}));var f=new r({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.ResponseBytes,g.asn1.ASN1Object);g.asn1.ocsp.BasicOCSPResponse=function(e){g.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,r=g.asn1,n=r.ASN1Object,i=r.DERSequence,u=r.DERGeneralizedTime,s=r.DERTaggedObject,o=r.DERBitString,l=r.x509.Extensions,f=r.x509.AlgorithmIdentifier,p=r.ocsp,E=p.ResponderID;_SingleResponseList=p.SingleResponseList,_ResponseData=p.ResponseData,this.params=null,this.setByParam=function(d){this.params=d},this.sign=function(){var d=this.params,h=d.tbsresp.tohex(),w=new g.crypto.Signature({alg:d.sigalg});w.init(d.reskey),w.updateHex(h),d.sighex=w.sign()},this.tohex=function(){var d=this.params;d.tbsresp==null&&(d.tbsresp=new _ResponseData(d)),d.sighex==null&&d.reskey!=null&&this.sign();var h=[];if(h.push(d.tbsresp),h.push(new f({name:d.sigalg})),h.push(new o({hex:"00"+d.sighex})),d.certs!=null&&d.certs.length!=null){for(var w=[],m=0;m<d.certs.length;m++){var y=d.certs[m],A=null;if(Fe.isASN1HEX(y))A=y;else if(y.match(/-----BEGIN/))A=Ar(y);else throw new t("certs["+m+"] not hex or PEM");w.push(new n({tlv:A}))}var C=new i({array:w});h.push(new s({tag:"a0",explicit:!0,obj:C}))}var S=new i({array:h});return S.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.BasicOCSPResponse,g.asn1.ASN1Object);g.asn1.ocsp.ResponseData=function(e){g.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,r=g.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,u=r.DERTaggedObject,s=r.x509.Extensions,o=r.ocsp,l=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.tohex=function(){var f=this.params;f.respid!=null&&new t("respid not specified"),f.prodat!=null&&new t("prodat not specified"),f.array!=null&&new t("array not specified");var p=[];if(p.push(new l(f.respid)),p.push(new i(f.prodat)),p.push(new _SingleResponseList(f.array)),f.ext!=null){var E=new s(f.ext);p.push(new u({tag:"a1",explicit:!0,obj:E}))}var d=new n({array:p});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(f){this.params=f},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.ResponseData,g.asn1.ASN1Object);g.asn1.ocsp.ResponderID=function(e){g.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.ASN1Util.newObject,i=r.x509.X500Name,u=t.lang.String.isHex,s=Error;this.params=null,this.tohex=function(){var o=this.params;if(o.key!=null){var l=null;if(typeof o.key=="string"){if(u(o.key)&&(l=o.key),o.key.match(/-----BEGIN CERTIFICATE/)){var f=new Ze(o.key),p=f.getExtSubjectKeyIdentifier();p!=null&&(l=p.kid.hex)}}else if(o.key instanceof Ze){var p=o.key.getExtSubjectKeyIdentifier();p!=null&&(l=p.kid.hex)}if(l==null)throw new s("wrong key member value");var E=n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:l}}}});return E.tohex()}else if(o.name!=null){var d=null;if(typeof o.name=="string"&&o.name.match(/-----BEGIN CERTIFICATE/)){var f=new Ze(o.name);d=f.getSubject()}else o.name instanceof Ze?d=o.name.getSubject():typeof o.name=="object"&&(o.name.array!=null||o.name.str!=null)&&(d=o.name);if(d==null)throw new s("wrong name member value");var E=n({tag:{tag:"a1",explicit:!0,obj:new i(d)}});return E.tohex()}throw new s("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(o){this.params=o},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.ResponderID,g.asn1.ASN1Object);g.asn1.ocsp.SingleResponseList=function(e){g.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=g.asn1,r=t.DERSequence,n=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 u=[],s=0;s<i.length;s++)u.push(new n(i[s]));var o=new r({array:u});return o.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(i){this.params=i},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.SingleResponseList,g.asn1.ASN1Object);g.asn1.ocsp.SingleResponse=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,u=n.DERGeneralizedTime,s=n.DERTaggedObject,o=n.ocsp,l=o.CertID,f=o.CertStatus,p=n.x509,E=p.Extensions;o.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params,h=[];if(d.certid==null)throw new t("certid unspecified");if(d.status==null)throw new t("status unspecified");if(d.thisupdate==null)throw new t("thisupdate unspecified");if(h.push(new l(d.certid)),h.push(new f(d.status)),h.push(new u(d.thisupdate)),d.nextupdate!=null){var w=new u(d.nextupdate);h.push(new s({tag:"a0",explicit:!0,obj:w}))}if(d.ext!=null){var m=new E(d.ext);h.push(new s({tag:"a1",explicit:!0,obj:m}))}var y=new i({array:h});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(d){this.params=d},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.SingleResponse,g.asn1.ASN1Object);g.asn1.ocsp.CertID=function(e){var t=g,r=t.asn1,n=r.DEROctetString,i=r.DERInteger,u=r.DERSequence,s=r.x509,o=s.AlgorithmIdentifier,l=r.ocsp,f=l.DEFAULT_HASH,p=t.crypto,E=p.Util.hashHex,d=Ze,h=Fe,w=h.getVbyList;l.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(m,y,A,C){C==null&&(C=this.DEFAULT_HASH),this.params={alg:C,issname:m,isskey:y,sbjsn:A}},this.setByCert=function(m,y,A){A==null&&(A=this.DEFAULT_HASH),this.params={alg:A,issuerCert:m,subjectCert:y}},this.getParamByCerts=function(m,y,A){A==null&&(A=this.DEFAULT_HASH);var C=new d(m),S=new d(y),B=E(C.getSubjectHex(),A),I=C.getPublicKeyHex(),M=E(w(I,0,[1],"03",!0),A),q=S.getSerialNumberHex(),b={alg:A,issname:B,isskey:M,sbjsn:q};return b},this.tohex=function(){if(typeof this.params!="object")throw new Error("params not set");var m=this.params,y,A,C,S;if(m.alg==null?S=this.DEFAULT_HASH:S=m.alg,m.issuerCert!=null&&m.subjectCert!=null){var B=this.getParamByCerts(m.issuerCert,m.subjectCert,S);y=B.issname,A=B.isskey,C=B.sbjsn}else if(m.issname!=null&&m.isskey!=null&&m.sbjsn!=null)y=m.issname,A=m.isskey,C=m.sbjsn;else throw new Error("required param members not defined");var I=new o({name:S}),M=new n({hex:y}),q=new n({hex:A}),b=new i({hex:C}),R=new u({array:[I,M,q,b]});return this.hTLV=R.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.CertID,g.asn1.ASN1Object);g.asn1.ocsp.CertStatus=function(e){g.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(t.status=="good")return"8000";if(t.status=="unknown")return"8200";if(t.status=="revoked"){var r=[{gentime:{str:t.time}}];t.reason!=null&&r.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:t.reason}}}});var n={tag:"a1",explicit:!1,obj:{seq:r}};return g.asn1.ASN1Util.newObject({tag:n}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},e!==void 0&&this.setByParam(e)};de(g.asn1.ocsp.CertStatus,g.asn1.ASN1Object);g.asn1.ocsp.Request=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.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 o=new n({array:s});return this.hTLV=o.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},typeof e<"u"){var u=new i.CertID(e);this.dReqCert=u}};de(g.asn1.ocsp.Request,g.asn1.ASN1Object);g.asn1.ocsp.TBSRequest=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.ocsp;i.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(u){for(var s=[],o=0;o<u.length;o++){var l=new i.Request(u[0]);s.push(l)}this.dRequestList=s},this.tohex=function(){var u=[];if(this.version!==0)throw"not supported version: "+this.version;if(this.dRequestorName!==null)throw"requestorName not supported";var s=new n({array:this.dRequestList});if(u.push(s),this.dRequestExt!==null)throw"requestExtensions not supported";var o=new n({array:u});return this.hTLV=o.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0&&this.setRequestListByParam(e.reqList)};de(g.asn1.ocsp.TBSRequest,g.asn1.ASN1Object);g.asn1.ocsp.OCSPRequest=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.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 o=new n({array:s});return this.hTLV=o.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0){var u=new i.TBSRequest(e);this.dTbsRequest=u}};de(g.asn1.ocsp.OCSPRequest,g.asn1.ASN1Object);g.asn1.ocsp.OCSPUtil={};g.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,r){var n=g,i=n.asn1,u=i.ocsp;r===void 0&&(r=u.DEFAULT_HASH);var s={alg:r,issuerCert:e,subjectCert:t},o=new u.OCSPRequest({reqList:[s]});return o.tohex()};g.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=Fe,r=t.getVbyList,n=t.getVbyListEx,i=t.getIdxbyList,u=t.getIdxbyListEx,s=t.getV,o={};try{var l=n(e,0,[0],"0a");o.responseStatus=parseInt(l,16)}catch{}if(o.responseStatus!==0)return o;try{var f=i(e,0,[1,0,1,0,0,2,0,1]);e.substr(f,2)==="80"?o.certStatus="good":e.substr(f,2)==="a1"?(o.certStatus="revoked",o.revocationTime=Wt(r(e,f,[0]))):e.substr(f,2)==="82"&&(o.certStatus="unknown")}catch{}try{var p=i(e,0,[1,0,1,0,0,2,0,2]);o.thisUpdate=Wt(s(e,p))}catch{}try{var E=i(e,0,[1,0,1,0,0,2,0,3]);e.substr(E,2)==="a0"&&(o.nextUpdate=Wt(r(e,E,[0])))}catch{}return o};g.asn1.ocsp.OCSPParser=function(){var e=Error,t=Ze,r=new t,n=Fe,i=n.getV,u=n.getTLV,s=n.getIdxbyList,o=n.getVbyList,l=n.getTLVbyList,f=n.getVbyListEx,p=n.getTLVbyListEx,E=n.getChildIdx;this.getOCSPRequest=function(d){var h=E(d,0);if(h.length!=1&&h.length!=2)throw new e("wrong number elements: "+h.length);var w=this.getTBSRequest(u(d,h[0]));return w},this.getTBSRequest=function(d){var h={},w=p(d,0,[0],"30");h.array=this.getRequestList(w);var m=p(d,0,["[2]",0],"30");return m!=null&&(h.ext=r.getExtParamArray(m)),h},this.getRequestList=function(d){for(var h=[],w=E(d,0),m=0;m<w.length;m++){var d=u(d,w[m]);h.push(this.getRequest(d))}return h},this.getRequest=function(d){var h=E(d,0);if(h.length!=1&&h.length!=2)throw new e("wrong number elements: "+h.length);var w=this.getCertID(u(d,h[0]));if(h.length==2){var m=s(d,0,[1,0]);w.ext=r.getExtParamArray(u(d,m))}return w},this.getCertID=function(d){var h=E(d,0);if(h.length!=4)throw new e("wrong number elements: "+h.length);var w=new t,m={};return m.alg=w.getAlgorithmIdentifierName(u(d,h[0])),m.issname=i(d,h[1]),m.isskey=i(d,h[2]),m.sbjsn=i(d,h[3]),m},this.getOCSPResponse=function(d){var h=E(d,0),w,m=i(d,h[0]),y=parseInt(m);if(h.length==1)return{resstatus:y};var A=l(d,0,[1,0]);return w=this.getResponseBytes(A),w.resstatus=y,w},this.getResponseBytes=function(d){var h=E(d,0),w,m=l(d,0,[1,0]);w=this.getBasicOCSPResponse(m);var y=i(d,h[0]);return w.restype=g.asn1.x509.OID.oid2name(zf(y)),w},this.getBasicOCSPResponse=function(d){var h=E(d,0),w;w=this.getResponseData(u(d,h[0]));var m=new Ze;w.alg=m.getAlgorithmIdentifierName(u(d,h[1]));var y=i(d,h[2]);w.sighex=y.substr(2);var A=f(d,0,["[0]"]);if(A!=null){for(var C=E(A,0),S=[],B=0;B<C.length;B++){var I=u(A,C[B]);S.push(I)}w.certs=S}return w},this.getResponseData=function(d){var h=E(d,0),w=h.length,m={},y=0;d.substr(h[0],2)=="a0"&&y++,m.respid=this.getResponderID(u(d,h[y++]));var A=i(d,h[y++]);if(m.prodat=Wt(A),m.array=this.getSingleResponseList(u(d,h[y++])),d.substr(h[w-1],2)=="a1"){var C=l(d,h[w-1],[0]),S=new Ze;m.ext=S.getExtParamArray(C)}return m},this.getResponderID=function(d){var h={};if(d.substr(0,2)=="a2"){var w=o(d,0,[0]);h.key=w}if(d.substr(0,2)=="a1"){var m=l(d,0,[0]),y=new Ze;h.name=y.getX500Name(m)}return h},this.getSingleResponseList=function(d){for(var h=E(d,0),w=[],m=0;m<h.length;m++){var y=this.getSingleResponse(u(d,h[m]));w.push(y)}return w},this.getSingleResponse=function(d){var h=E(d,0),w={},m=this.getCertID(u(d,h[0]));w.certid=m;var y=this.getCertStatus(u(d,h[1]));if(w.status=y,d.substr(h[2],2)=="18"){var A=i(d,h[2]);w.thisupdate=Wt(A)}for(var C=3;C<h.length;C++){if(d.substr(h[C],2)=="a0"){var S=o(d,h[C],[0],"18");w.nextupdate=Wt(S)}if(d.substr(h[C],2)=="a1"){var B=new Ze,I=l(d,0,[C,0]);w.ext=B.getExtParamArray(I)}}return w},this.getCertStatus=function(d){var h={};if(d=="8000")return{status:"good"};if(d=="8200")return{status:"unknown"};if(d.substr(0,2)=="a1"){h.status="revoked";var w=o(d,0,[0]),m=Wt(w);h.time=m}return h}};var g;(typeof g>"u"||!g)&&(g={});(typeof g.lang>"u"||!g.lang)&&(g.lang={});g.lang.String=function(){};function _v(e){for(var t=new Array,r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Iv(e){for(var t="",r=0;r<e.length;r++)t=t+String.fromCharCode(e[r]);return t}function jf(e){for(var t="",r=0;r<e.length;r++){var n=e[r].toString(16);n.length==1&&(n="0"+n),t=t+n}return t}function ai(e){return jf(_v(e))}function g_(e){return pu(ai(e))}function m_(e){return Mo(pu(ai(e)))}function v_(e){return Iv(Cv(Vc(e)))}function Mo(e){return e=e.replace(/\=/g,""),e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e}function Vc(e){return e.length%4==2?e=e+"==":e.length%4==3&&(e=e+"="),e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/"),e}function Kr(e){return e.length%2==1&&(e="0"+e),Mo(pu(e))}function pr(e){return qo(Vc(e))}var qc,ss;typeof Buffer=="function"?(qc=function(e){return Mo(Buffer.from(e,"utf8").toString("base64"))},ss=function(e){return Buffer.from(Vc(e),"base64").toString("utf8")}):(qc=function(e){return Kr(Kf(Gf(e)))},ss=function(e){return decodeURIComponent(Vf(pr(e)))});function E_(e){return pu(Kf(Gf(e)))}function A_(e){return decodeURIComponent(Vf(qo(e)))}function Mf(e){return Kf(Gf(e)).toLowerCase()}function Wt(e){try{return decodeURIComponent(Vf(e))}catch{return null}}function w_(e){return Wt(C_(e))}function C_(e){for(var t=e.match(/.{1,2}/g),r=[],n=0;n<t.length;n++){var i=parseInt(t[n],16);161<=i&&i<=191?(r.push("c2"),r.push(t[n])):192<=i&&i<=255?(r.push("c3"),r.push((i-64).toString(16))):r.push(t[n])}return r.join("")}function oi(e){for(var t="",r=0;r<e.length-1;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t}function $s(e){for(var t="",r=0;r<e.length;r++)t+=("0"+e.charCodeAt(r).toString(16)).slice(-2);return t}function qp(e){return pu(e)}function y_(e){return qf(qp(e),64)}function qf(e,t){return e=e.replace(new RegExp("(.{"+t+"})","g"),`$1\r
`),e=e.replace(/\s+$/,""),e}function Bv(e){var t=e.replace(/[^0-9A-Za-z\/+=]*/g,""),r=qo(t);return r}function F_(e,t){return"-----BEGIN "+t+`-----\r
`+qf(e,64)+`\r
-----END `+t+`-----\r
`}function $n(e,t){return"-----BEGIN "+t+`-----\r
`+qf(qp(e),64)+`\r
-----END `+t+`-----\r
`}function Ar(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 [^-]+-----[^]*$/,"")),Bv(e)}function D_(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 S_(e){if(e.length%2!=0)throw"input is not even length";if(e.match(/^[0-9A-Fa-f]+$/)==null)throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),r=new DataView(t),n=0;n<e.length/2;n++)r.setUint8(n,parseInt(e.substr(n*2,2),16));return t}function b_(e){for(var t="",r=new DataView(e),n=0;n<e.byteLength;n++)t+=("00"+r.getUint8(n).toString(16)).slice(-2);return t}function Kp(e){var t,r,n,i,u,s,o,l,f,p,E,d;if(e=Pv(e),d=e.match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/),d)return t=parseInt(d[1]),r=parseInt(d[2])-1,n=parseInt(d[3]),i=parseInt(d[4]),u=parseInt(d[5]),s=parseInt(d[6]),o=0,p=d[7],p!==""&&(E=(p.substr(1)+"00").substr(0,3),o=parseInt(E)),Date.UTC(t,r,n,i,u,s,o);throw new Error("unsupported zulu format: "+e)}function __(e){var t=new Date(e),r=("0000"+t.getUTCFullYear()).slice(-4),n=("00"+(t.getUTCMonth()+1)).slice(-2),i=("00"+t.getUTCDate()).slice(-2),u=("00"+t.getUTCHours()).slice(-2),s=("00"+t.getUTCMinutes()).slice(-2),o=("00"+t.getUTCSeconds()).slice(-2),l=("000"+t.getUTCMilliseconds()).slice(-3);return l=l.replace(/0+$/,""),l=l!=""?"."+l:l,r+n+i+u+s+o+l+"Z"}function $v(e){return Math.round(Kp(e)/1e3)}function I_(e){return new Date(Kp(e))}function B_(e,t,r){var n,i=e.getUTCFullYear();if(t){if(i<1950||2049<i)throw"not proper year for UTCTime: "+i;n=(""+i).slice(-2)}else n=("000"+i).slice(-4);if(n+=("0"+(e.getUTCMonth()+1)).slice(-2),n+=("0"+e.getUTCDate()).slice(-2),n+=("0"+e.getUTCHours()).slice(-2),n+=("0"+e.getUTCMinutes()).slice(-2),n+=("0"+e.getUTCSeconds()).slice(-2),r){var u=e.getUTCMilliseconds();u!==0&&(u=("00"+u).slice(-3),u=u.replace(/0+$/g,""),n+="."+u)}return n+="Z",n}function Pv(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 Kf(e){return e.replace(/%/g,"")}function Vf(e){return e.replace(/(..)/g,"%$1")}function xp(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;e=e.toLowerCase();var r=e.split(":").length-1;if(r<2)throw t;var n=":".repeat(7-r+2);e=e.replace("::",n);var i=e.split(":");if(i.length!=8)throw t;for(var u=0;u<8;u++)i[u]=("0000"+i[u]).slice(-4);return i.join("")}function kp(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 r=e.match(/:(0:){2,}/g);if(r==null)return e.slice(1,-1);var n=r.sort().slice(-1)[0];return e=e.replace(n.substr(0,n.length-1),":"),e.substr(0,2)!="::"&&(e=e.substr(1)),e.substr(-2,2)!="::"&&(e=e.substr(0,e.length-1)),e}function xf(e){var t=new Error("malformed hex value");if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(e.length==8){var r;try{return r=parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16),r}catch{throw t}}else if(e.length==16)try{return xf(e.substr(0,8))+"/"+Av(e.substr(8))}catch{throw t}else{if(e.length==32)return kp(e);if(e.length==64){try{return kp(e.substr(0,32))+"/"+Av(e.substr(32))}catch{throw t}return}else return e}}function Av(e){var t=new Error("malformed mask"),r;try{r=new ee(e,16).toString(2)}catch{throw t}if(!r.match(/^1*0*$/))throw t;return r.replace(/0+$/,"").length}function Vp(e){var t=new Error("malformed IP address");if(e=e.toLowerCase(e),!e.match(/^[0-9a-f.:/]+$/))throw t;if(e.match(/^[0-9.]+$/)){var r=e.split(".");if(r.length!==4)throw t;var n="";try{for(var i=0;i<4;i++){var u=parseInt(r[i]);n+=("0"+u.toString(16)).slice(-2)}return n}catch{throw t}}else if(e.match(/^[0-9.]+\/[0-9]+$/)){var s=e.split("/");return Vp(s[0])+wv(parseInt(s[1]),32)}else{if(e.match(/^[0-9a-f:]+$/)&&e.indexOf(":")!==-1)return xp(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&e.indexOf(":")!==-1){var s=e.split("/");return xp(s[0])+wv(parseInt(s[1]),128)}else throw t}}function wv(e,t){if(t==32&&e==0)return"00000000";if(t==128&&e==0)return"00000000000000000000000000000000";var r=Array(e+1).join("1")+Array(t-e+1).join("0");return new ee(r,2).toString(16)}function Gp(e){function t(i){var u=parseInt(i.substr(0,2),16),s=parseInt(i.substr(2),16);if(u==0&s<128)return String.fromCharCode(s);if(u<8){var o=192|(u&7)<<3|(s&192)>>6,l=128|s&63;return Wt(o.toString(16)+l.toString(16))}var o=224|(u&240)>>4,l=128|(u&15)<<2|(s&192)>>6,f=128|s&63;return Wt(o.toString(16)+l.toString(16)+f.toString(16))}var r=e.match(/.{4}/g),n=r.map(t);return n.join("")}function Gf(e){for(var t=encodeURIComponent(e),r="",n=0;n<t.length;n++)t[n]=="%"?(r=r+t.substr(n,3),n=n+2):r=r+"%"+ai(t[n]);return r}function $_(e){return e=e.replace(/\r\n/mg,`
`),e}function P_(e){return e=e.replace(/\r\n/mg,`
`),e=e.replace(/\n/mg,`\r
`),e}g.lang.String.isInteger=function(e){return e.match(/^[0-9]+$/)?!0:!!e.match(/^-[0-9]+$/)};g.lang.String.isHex=function(e){return Rv(e)};function Rv(e){return!!(e.length%2==0&&(e.match(/^[0-9a-f]+$/)||e.match(/^[0-9A-F]+$/)))}g.lang.String.isBase64=function(e){return e=e.replace(/\s+/g,""),!!(e.match(/^[0-9A-Za-z+\/]+={0,3}$/)&&e.length%4==0)};g.lang.String.isBase64URL=function(e){return e.match(/[+/=]/)?!1:(e=Vc(e),g.lang.String.isBase64(e))};function zp(e){return!!e.match(/^[0-9A-Za-z-_.]+$/)}g.lang.String.isIntegerArray=function(e){return e=e.replace(/\s+/g,""),!!e.match(/^\[[0-9,]+\]$/)};g.lang.String.isPrintable=function(e){return e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)!==null};g.lang.String.isIA5=function(e){return e.match(/^[\x20-\x21\x23-\x7f]*$/)!==null};g.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 Lp(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function R_(e){e=e.replace(/^\s*\[\s*/,""),e=e.replace(/\s*\]\s*$/,""),e=e.replace(/\s*/g,"");try{var t=e.split(/,/).map(function(r,n,i){var u=parseInt(r);if(u<0||255<u)throw"integer not in range 0-255";var s=("00"+u.toString(16)).slice(-2);return s}).join("");return t}catch(r){throw"malformed integer array string: "+r}}var T_=function(e,t){var r=e.length;e.length>t.length&&(r=t.length);for(var n=0;n<r;n++)if(e.charCodeAt(n)!=t.charCodeAt(n))return n;return e.length!=t.length?r:-1};function Tv(e){var t=function(o){var l=o.toString(16);return l.length==1&&(l="0"+l),l},r=function(o){var l="",f=parseInt(o,10),p=f.toString(2),E=7-p.length%7;E==7&&(E=0);for(var d="",h=0;h<E;h++)d+="0";p=d+p;for(var h=0;h<p.length-1;h+=7){var w=p.substr(h,7);h!=p.length-7&&(w="1"+w),l+=t(parseInt(w,2))}return l};try{if(!e.match(/^[0-9.]+$/))return null;var n="",i=e.split("."),u=parseInt(i[0],10)*40+parseInt(i[1],10);n+=t(u),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n}catch{return null}}function zf(e){if(!Rv(e))return null;try{var t=[],r=e.substr(0,2),n=parseInt(r,16);t[0]=new String(Math.floor(n/40)),t[1]=new String(n%40);for(var i=e.substr(2),u=[],s=0;s<i.length/2;s++)u.push(parseInt(i.substr(s*2,2),16));for(var o=[],l="",s=0;s<u.length;s++)u[s]&128?l=l+kf((u[s]&127).toString(2),7):(l=l+kf((u[s]&127).toString(2),7),o.push(new String(parseInt(l,2))),l="");var f=t.join(".");return o.length>0&&(f=f+"."+o.join(".")),f}catch{return null}}function Ov(e){var t=new ee(String(e),10);return Gc(t)}function Gc(e){var t=e.toString(16);if(t.substr(0,1)!="-")return t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t),t;var r=t.substr(1),n=r.length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var i="",u=0;u<n;u++)i+="f";var s=new ee(i,16),o=s.xor(e).add(ee.ONE);return t=o.toString(16).replace(/^-/,""),t}var kf=function(e,t,r){return r==null&&(r="0"),e.length>=t?e:new Array(t-e.length+1).join(r)+e};function Nv(e){if(e.length%2!=0||(e=e.toLowerCase(),e.match(/^[0-9a-f]+$/)==null))return-1;try{var t=e.substr(0,2);if(t=="00")return parseInt(e.substr(2),16);var r=parseInt(t,16);if(r>7)return-1;var n=e.substr(2),i=parseInt(n,16).toString(2);i=="0"&&(i="00000000"),i=i.slice(0,0-r);var u=parseInt(i,2);return u==NaN?-1:u}catch{return-1}}function xv(e){if(typeof e!="number"||e<0)return null;var t=Number(e).toString(2),r=8-t.length%8;r==8&&(r=0),t=t+kf("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var i="0"+r;return i+n}function kv(e){if(typeof e!="string"||e.length%2!=0||!e.match(/^[0-9a-f]+$/))return null;try{var t=parseInt(e.substr(0,2),16);if(t<0||7<t)return null;for(var r=e.substr(2),n="",i=0;i<r.length;i+=2){var u=r.substr(i,2),s=parseInt(u,16).toString(2);s=("0000000"+s).slice(-8),n+=s}return n.substr(0,n.length-t)}catch{return null}}function O_(e){if(typeof e!="string"||e.match(/^[01]+$/)==null)return null;try{var t=parseInt(e,2);return xv(t)}catch{return null}}function Lf(e,t){for(var r=0,n=0;n<e.length;n++)r|=1<<t[e[n]];for(var i=r.toString(2),u="",n=i.length-1;n>=0;n--)u+=i[n];return u}function nr(e,n,r){if(typeof e=="object"){for(var n=String(n).split("."),i=0;i<n.length&&e;i++){var u=n[i];u.match(/^[0-9]+$/)&&(u=parseInt(u)),e=e[u]}return e||e===!1?e:r}}function de(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}(typeof g>"u"||!g)&&(g={});(typeof g.crypto>"u"||!g.crypto)&&(g.crypto={});g.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:Ie.algo.MD5,sha1:Ie.algo.SHA1,sha224:Ie.algo.SHA224,sha256:Ie.algo.SHA256,sha384:Ie.algo.SHA384,sha512:Ie.algo.SHA512,ripemd160:Ie.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(typeof this.DIGESTINFOHEAD[t]>"u")throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,r){var n=this.getDigestInfoHex(e,t),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+t;for(var u="0001",s="00"+n,o="",l=i-u.length-s.length,f=0;f<l;f+=2)o+="ff";var p=u+o+s;return p},this.hashString=function(e,t){var r=new g.crypto.MessageDigest({alg:t});return r.digestString(e)},this.hashHex=function(e,t){var r=new g.crypto.MessageDigest({alg:t});return r.digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof ut||e instanceof g.crypto.DSA||e instanceof g.crypto.ECDSA}};g.crypto.Util.md5=function(e){var t=new g.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return t.digestString(e)};g.crypto.Util.ripemd160=function(e){var t=new g.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return t.digestString(e)};g.crypto.Util.SECURERANDOMGEN=new Go;g.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return g.crypto.Util.SECURERANDOMGEN.nextBytes(t),jf(t)};g.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new ee(g.crypto.Util.getRandomHexOfNbytes(e),16)};g.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,r=(e-t)/8,n=new Array(r+1);return g.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<t&255^255)&n[0],jf(n)};g.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new ee(g.crypto.Util.getRandomHexOfNbits(e),16)};g.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var r=g.crypto.Util.getRandomBigIntegerOfNbits(t);if(e.compareTo(r)!=-1)return r}};g.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var r=e.compareTo(t);if(r==1)throw"biMin is greater than biMax";if(r==0)return e;var n=t.subtract(e),i=g.crypto.Util.getRandomBigIntegerZeroToMax(n);return i.add(e)};g.crypto.MessageDigest=function(e){var t=null,r=null,n=null;this.setAlgAndProvider=function(i,u){if(i=g.crypto.MessageDigest.getCanonicalAlgName(i),i!==null&&u===void 0&&(u=g.crypto.Util.DEFAULTPROVIDER[i]),":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)!=-1&&u=="cryptojs"){try{this.md=g.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 o=Ie.enc.Hex.parse(s);this.md.update(o)},this.digest=function(){var s=this.md.finalize();return s.toString(Ie.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&&u=="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 o=sjcl.codec.hex.toBits(s);this.md.update(o)},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=g.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))};g.crypto.MessageDigest.getCanonicalAlgName=function(e){return typeof e=="string"&&(e=e.toLowerCase(),e=e.replace(/-/,"")),e};g.crypto.MessageDigest.getHashLength=function(e){var t=g.crypto.MessageDigest,r=t.getCanonicalAlgName(e);if(t.HASHLENGTH[r]===void 0)throw"not supported algorithm: "+e;return t.HASHLENGTH[r]};g.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20};g.crypto.Mac=function(e){var t=null,r=null,n=null,i=null,u=null;this.setAlgAndProvider=function(s,o){if(s=s.toLowerCase(),s==null&&(s="hmacsha1"),s=s.toLowerCase(),s.substr(0,4)!="hmac")throw"setAlgAndProvider unsupported HMAC alg: "+s;o===void 0&&(o=g.crypto.Util.DEFAULTPROVIDER[s]),this.algProv=s+"/"+o;var l=s.substr(4);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(l)!=-1&&o=="cryptojs"){try{var f=g.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[l];this.mac=Ie.algo.HMAC.create(f,this.pass)}catch(p){throw"setAlgAndProvider hash alg set fail hashAlg="+l+"/"+p}this.updateString=function(p){this.mac.update(p)},this.updateHex=function(p){var E=Ie.enc.Hex.parse(p);this.mac.update(E)},this.doFinal=function(){var p=this.mac.finalize();return p.toString(Ie.enc.Hex)},this.doFinalString=function(p){return this.updateString(p),this.doFinal()},this.doFinalHex=function(p){return this.updateHex(p),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 o=s;(s.length%2==1||!s.match(/^[0-9A-Fa-f]+$/))&&(o=$s(s)),this.pass=Ie.enc.Hex.parse(o);return}if(typeof s!="object")throw"KJUR.crypto.Mac unsupported password type: "+s;var o=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;o=s.hex}if(s.utf8!==void 0&&(o=Mf(s.utf8)),s.rstr!==void 0&&(o=$s(s.rstr)),s.b64!==void 0&&(o=qo(s.b64)),s.b64u!==void 0&&(o=pr(s.b64u)),o==null)throw"KJUR.crypto.Mac unsupported password type: "+s;this.pass=Ie.enc.Hex.parse(o)},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=g.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))};g.crypto.Signature=function(e){var t=null,r=null,n=null,i=null,u=null,s=null,o=null,l=null,f=null,p=null,E=-1,d=null,h=null,w=null,m=null,y=null;if(this._setAlgNames=function(){var A=this.algName.match(/^(.+)with(.+)$/);A&&(this.mdAlgName=A[1].toLowerCase(),this.pubkeyAlgName=A[2].toLowerCase(),this.pubkeyAlgName=="rsaandmgf1"&&this.mdAlgName=="sha"&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(A,C){for(var S="",B=C/4-A.length,I=0;I<B;I++)S=S+"0";return S+A},this.setAlgAndProvider=function(A,C){if(this._setAlgNames(),C!="cryptojs/jsrsa")throw new Error("provider not supported: "+C);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)!=-1){try{this.md=new g.crypto.MessageDigest({alg:this.mdAlgName})}catch(S){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+S)}this.init=function(S,B){var I=null;try{B===void 0?I=Ft.getKey(S):I=Ft.getKey(S,B)}catch(M){throw"init failed:"+M}if(I.isPrivate===!0)this.prvKey=I,this.state="SIGN";else if(I.isPublic===!0)this.pubKey=I,this.state="VERIFY";else throw"init failed.:"+I},this.updateString=function(S){this.md.updateString(S)},this.updateHex=function(S){this.md.updateHex(S)},this.sign=function(){if(this.sHashHex=this.md.digest(),this.prvKey===void 0&&this.ecprvhex!==void 0&&this.eccurvename!==void 0&&g.crypto.ECDSA!==void 0&&(this.prvKey=new g.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof ut&&this.pubkeyAlgName==="rsaandmgf1")this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ut&&this.pubkeyAlgName==="rsa")this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof g.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else if(this.prvKey instanceof g.crypto.DSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;return this.hSign},this.signString=function(S){return this.updateString(S),this.sign()},this.signHex=function(S){return this.updateHex(S),this.sign()},this.verify=function(S){if(this.sHashHex=this.md.digest(),this.pubKey===void 0&&this.ecpubhex!==void 0&&this.eccurvename!==void 0&&g.crypto.ECDSA!==void 0&&(this.pubKey=new g.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof ut&&this.pubkeyAlgName==="rsaandmgf1")return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,S,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ut&&this.pubkeyAlgName==="rsa")return this.pubKey.verifyWithMessageHash(this.sHashHex,S);if(g.crypto.ECDSA!==void 0&&this.pubKey instanceof g.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,S);if(g.crypto.DSA!==void 0&&this.pubKey instanceof g.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,S);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(A,C){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(A){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(A){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(A){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(A){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(A){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=g.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=Ft.getKey(e.prvkeypem);this.init(t)}catch(A){throw"fatal error to load pem private key: "+A}}};g.crypto.Cipher=function(e){};g.crypto.Cipher.encrypt=function(e,t,r,n){if(nr(n,"enclag")!=null&&(r=n.encalg),typeof r=="string"&&r.substr(-4)=="-CBC"){var i=t,u=e;nr(n,"key")!=null&&(i=n.key),nr(n,"enc")!=null&&(hEnc=n.enc);var s=Ie.enc.Hex.parse(i),o=Ie.enc.Hex.parse(u),l=Ie.enc.Hex.parse(n.iv),f;if(r=="des-EDE3-CBC")f=Ie.TripleDES.encrypt(o,s,{iv:l});else if(r=="aes128-CBC"||r=="aes256-CBC")f=Ie.AES.encrypt(o,s,{iv:l});else throw new Error("unsupported algorithm: "+r);return f+""}else throw new Error("Cipher.encrypt: unsupported key or algorithm")};g.crypto.Cipher.decrypt=function(e,t,r,n){if(nr(n,"enclag")!=null&&(r=n.encalg),typeof r=="string"&&r.substr(-4)=="-CBC"){var i=t,u=e;nr(n,"key")!=null&&(i=n.key),nr(n,"enc")!=null&&(u=n.enc);var s=Ie.enc.Hex.parse(i),o=Ie.enc.Hex.parse(u),l=Ie.enc.Hex.parse(n.iv),f;if(r=="des-EDE3-CBC")f=Ie.TripleDES.decrypt({ciphertext:o},s,{iv:l});else if(r=="aes128-CBC"||r=="aes256-CBC")f=Ie.AES.decrypt({ciphertext:o},s,{iv:l});else throw new Error("unsupported algorithm: "+r);return Ie.enc.Hex.stringify(f)}else throw new Error("Cipher.decrypt: unsupported key or algorithm")};g.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 g>"u"||!g)&&(g={});(typeof g.crypto>"u"||!g.crypto)&&(g.crypto={});g.crypto.ECDSA=function(e){var t="secp256r1",r=null,n=null,i=null,u=Error,s=ee,o=Ht,l=g.crypto.ECDSA,f=g.crypto.ECParameterDB,p=l.getName,E=Fe,d=E.getVbyListEx,h=E.isASN1HEX,w=new Go,m=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function y(A,C,S,B){for(var I=Math.max(C.bitLength(),B.bitLength()),M=A.add2D(S),q=A.curve.getInfinity(),b=I-1;b>=0;--b)q=q.twice2D(),q.z=s.ONE,C.testBit(b)?B.testBit(b)?q=q.add2D(M):q=q.add2D(A):B.testBit(b)&&(q=q.add2D(S));return q}this.getBigRandom=function(A){return new s(A.bitLength(),w).mod(A.subtract(s.ONE)).add(s.ONE)},this.setNamedCurve=function(A){this.ecparams=f.getByName(A),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=A},this.setPrivateKeyHex=function(A){this.isPrivate=!0,this.prvKeyHex=A},this.setPublicKeyHex=function(A){this.isPublic=!0,this.pubKeyHex=A},this.getPublicKeyXYHex=function(){var A=this.pubKeyHex;if(A.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var C=this.ecparams.keycharlen;if(A.length!==2+C*2)throw"malformed public key hex length";var S={};return S.x=A.substr(2,C),S.y=A.substr(2+C),S},this.getShortNISTPCurveName=function(){var A=this.curveName;return A==="secp256r1"||A==="NIST P-256"||A==="P-256"||A==="prime256v1"?"P-256":A==="secp384r1"||A==="NIST P-384"||A==="P-384"?"P-384":A==="secp521r1"||A==="NIST P-521"||A==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var A=this.ecparams.n,C=this.getBigRandom(A),S=this.ecparams.keycharlen,B=("0000000000"+C.toString(16)).slice(-S);this.setPrivateKeyHex(B);var I=this.generatePublicKeyHex();return{ecprvhex:B,ecpubhex:I}},this.generatePublicKeyHex=function(){var A=new s(this.prvKeyHex,16),C=this.ecparams.G.multiply(A),S=C.getX().toBigInteger(),B=C.getY().toBigInteger(),I=this.ecparams.keycharlen,M=("0000000000"+S.toString(16)).slice(-I),q=("0000000000"+B.toString(16)).slice(-I),b="04"+M+q;return this.setPublicKeyHex(b),b},this.signWithMessageHash=function(A){return this.signHex(A,this.prvKeyHex)},this.signHex=function(A,C){var S=new s(C,16),B=this.ecparams.n,I=new s(A.substring(0,this.ecparams.keycharlen),16);do var M=this.getBigRandom(B),q=this.ecparams.G,b=q.multiply(M),R=b.getX().toBigInteger().mod(B);while(R.compareTo(s.ZERO)<=0);var L=M.modInverse(B).multiply(I.add(S.multiply(R))).mod(B);return l.biRSSigToASN1Sig(R,L)},this.sign=function(A,C){var S=C,B=this.ecparams.n,I=s.fromByteArrayUnsigned(A);do var M=this.getBigRandom(B),q=this.ecparams.G,b=q.multiply(M),R=b.getX().toBigInteger().mod(B);while(R.compareTo(ee.ZERO)<=0);var L=M.modInverse(B).multiply(I.add(S.multiply(R))).mod(B);return this.serializeSig(R,L)},this.verifyWithMessageHash=function(A,C){return this.verifyHex(A,C,this.pubKeyHex)},this.verifyHex=function(A,C,S){try{var B,I,M=l.parseSigHex(C);B=M.r,I=M.s;var q=o.decodeFromHex(this.ecparams.curve,S),b=new s(A.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(b,B,I,q)}catch{return!1}},this.verify=function(A,C,S){var B,I;if(Bitcoin.Util.isArray(C)){var M=this.parseSig(C);B=M.r,I=M.s}else if(typeof C=="object"&&C.r&&C.s)B=C.r,I=C.s;else throw"Invalid value for signature";var q;if(S instanceof Ht)q=S;else if(Bitcoin.Util.isArray(S))q=o.decodeFrom(this.ecparams.curve,S);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var b=s.fromByteArrayUnsigned(A);return this.verifyRaw(b,B,I,q)},this.verifyRaw=function(A,C,S,B){var I=this.ecparams.n,M=this.ecparams.G;if(C.compareTo(s.ONE)<0||C.compareTo(I)>=0||S.compareTo(s.ONE)<0||S.compareTo(I)>=0)return!1;var q=S.modInverse(I),b=A.multiply(q).mod(I),R=C.multiply(q).mod(I),L=M.multiply(b).add(B.multiply(R)),j=L.getX().toBigInteger().mod(I);return j.equals(C)},this.serializeSig=function(A,C){var S=A.toByteArraySigned(),B=C.toByteArraySigned(),I=[];return I.push(2),I.push(S.length),I=I.concat(S),I.push(2),I.push(B.length),I=I.concat(B),I.unshift(I.length),I.unshift(48),I},this.parseSig=function(A){var C;if(A[0]!=48)throw new Error("Signature not a valid DERSequence");if(C=2,A[C]!=2)throw new Error("First element in signature must be a DERInteger");var S=A.slice(C+2,C+2+A[C+1]);if(C+=2+A[C+1],A[C]!=2)throw new Error("Second element in signature must be a DERInteger");var B=A.slice(C+2,C+2+A[C+1]);C+=2+A[C+1];var I=s.fromByteArrayUnsigned(S),M=s.fromByteArrayUnsigned(B);return{r:I,s:M}},this.parseSigCompact=function(A){if(A.length!==65)throw"Signature has the wrong length";var C=A[0]-27;if(C<0||C>7)throw"Invalid signature type";var S=this.ecparams.n,B=s.fromByteArrayUnsigned(A.slice(1,33)).mod(S),I=s.fromByteArrayUnsigned(A.slice(33,65)).mod(S);return{r:B,s:I,i:C}},this.readPKCS5PrvKeyHex=function(A){if(h(A)===!1)throw new Error("not ASN.1 hex string");var C,S,B;try{C=d(A,0,["[0]",0],"06"),S=d(A,0,[1],"04");try{B=d(A,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=p(C),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(B),this.setPrivateKeyHex(S),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(A){if(h(A)===!1)throw new u("not ASN.1 hex string");var C,S,B,I;try{C=d(A,0,[1,0],"06"),S=d(A,0,[1,1],"06"),B=d(A,0,[2,0,1],"04");try{I=d(A,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new u("malformed PKCS#8 plain ECC private key")}if(this.curveName=p(S),this.curveName===void 0)throw new u("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(I),this.setPrivateKeyHex(B),this.isPublic=!1},this.readPKCS8PubKeyHex=function(A){if(h(A)===!1)throw new u("not ASN.1 hex string");var C,S,B;try{C=d(A,0,[0,0],"06"),S=d(A,0,[0,1],"06"),B=d(A,0,[1],"03")}catch{throw new u("malformed PKCS#8 ECC public key")}if(this.curveName=p(S),this.curveName===null)throw new u("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(B)},this.readCertPubKeyHex=function(A,C){if(h(A)===!1)throw new u("not ASN.1 hex string");var S,B;try{S=d(A,0,[0,5,0,1],"06"),B=d(A,0,[0,5,1],"03")}catch{throw new u("malformed X.509 certificate ECC public key")}if(this.curveName=p(S),this.curveName===null)throw new u("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(B)},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))};g.crypto.ECDSA.parseSigHex=function(e){var t=g.crypto.ECDSA.parseSigHexInHexRS(e),r=new ee(t.r,16),n=new ee(t.s,16);return{r,s:n}};g.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=Fe,r=t.getChildIdx,n=t.getV;if(t.checkStrictDER(e,0),e.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var i=r(e,0);if(i.length!=2)throw new Error("signature shall have two elements");var u=i[0],s=i[1];if(e.substr(u,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 o=n(e,u),l=n(e,s);return{r:o,s:l}};g.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=g.crypto.ECDSA.parseSigHexInHexRS(e),r=t.r,n=t.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");r.substr(0,2)=="00"&&(r=r.substr(2)),n.substr(0,2)=="00"&&(n=n.substr(2));var i=Math.max(r.length,n.length);return r=("000000"+r).slice(-i),n=("000000"+n).slice(-i),r+n}if(r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n};g.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var t=e.substr(0,e.length/2),r=e.substr(e.length/2);return g.crypto.ECDSA.hexRSSigToASN1Sig(t,r)};g.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new ee(e,16),n=new ee(t,16);return g.crypto.ECDSA.biRSSigToASN1Sig(r,n)};g.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=g.asn1,n=new r.DERInteger({bigint:e}),i=new r.DERInteger({bigint:t}),u=new r.DERSequence({array:[n,i]});return u.tohex()};g.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 g>"u"||!g)&&(g={});(typeof g.crypto>"u"||!g.crypto)&&(g.crypto={});g.crypto.ECParameterDB=new function(){var e={},t={};function r(n){return new ee(n,16)}this.getByName=function(n){var i=n;if(typeof t[i]<"u"&&(i=t[n]),typeof e[i]<"u")return e[i];throw"unregistered EC curve name: "+i},this.regist=function(n,i,u,s,o,l,f,p,E,d,h,w){e[n]={};var m=r(u),y=r(s),A=r(o),C=r(l),S=r(f),B=new du(m,y,A),I=B.decodePointHex("04"+p+E);e[n].name=n,e[n].keylen=i,e[n].keycharlen=Math.ceil(i/8)*2,e[n].curve=B,e[n].G=I,e[n].n=C,e[n].h=S,e[n].oid=h,e[n].info=w;for(var M=0;M<d.length;M++)t[d[M]]=n}};g.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field");g.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field");g.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field");g.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]);g.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]);g.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]);g.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]);g.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]);g.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]);g.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);(typeof g>"u"||!g)&&(g={});(typeof g.crypto>"u"||!g.crypto)&&(g.crypto={});g.crypto.DSA=function(){var e=Fe,t=e.getVbyList,r=e.getVbyListEx,n=e.isASN1HEX,i=ee;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(u,s,o,l,f){this.isPrivate=!0,this.p=u,this.q=s,this.g=o,this.y=l,this.x=f},this.setPrivateHex=function(u,s,o,l,f){var p,E,d,h,w;p=new ee(u,16),E=new ee(s,16),d=new ee(o,16),typeof l=="string"&&l.length>1?h=new ee(l,16):h=null,w=new ee(f,16),this.setPrivate(p,E,d,h,w)},this.setPublic=function(u,s,o,l){this.isPublic=!0,this.p=u,this.q=s,this.g=o,this.y=l,this.x=null},this.setPublicHex=function(u,s,o,l){var f,p,E,d;f=new ee(u,16),p=new ee(s,16),E=new ee(o,16),d=new ee(l,16),this.setPublic(f,p,E,d)},this.signWithMessageHash=function(u){var s=this.p,o=this.q,l=this.g,f=this.y,p=this.x,E=g.crypto.Util.getRandomBigIntegerMinToMax(ee.ONE.add(ee.ONE),o.subtract(ee.ONE)),d=u.substr(0,o.bitLength()/4),h=new ee(d,16),w=l.modPow(E,s).mod(o),m=E.modInverse(o).multiply(h.add(p.multiply(w))).mod(o),y=g.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:w}},{int:{bigint:m}}]});return y},this.verifyWithMessageHash=function(u,s){var o=this.p,l=this.q,f=this.g,p=this.y,E=this.parseASN1Signature(s),d=E[0],h=E[1],w=u.substr(0,l.bitLength()/4),m=new ee(w,16);if(ee.ZERO.compareTo(d)>0||d.compareTo(l)>0||ee.ZERO.compareTo(h)>=0||h.compareTo(l)>0)throw"invalid DSA signature";var y=h.modInverse(l),A=m.multiply(y).mod(l),C=d.multiply(y).mod(l),S=f.modPow(A,o).multiply(p.modPow(C,o)).mod(o).mod(l);return S.compareTo(d)==0},this.parseASN1Signature=function(u){try{var s=new i(r(u,0,[0],"02"),16),o=new i(r(u,0,[1],"02"),16);return[s,o]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(u){var s,o,l,f,p;if(n(u)===!1)throw new Error("not ASN.1 hex string");try{s=r(u,0,[1],"02"),o=r(u,0,[2],"02"),l=r(u,0,[3],"02"),f=r(u,0,[4],"02"),p=r(u,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(s,o,l,f,p)},this.readPKCS8PrvKeyHex=function(u){var s,o,l,f;if(n(u)===!1)throw new Error("not ASN.1 hex string");try{s=r(u,0,[1,1,0],"02"),o=r(u,0,[1,1,1],"02"),l=r(u,0,[1,1,2],"02"),f=r(u,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(s,o,l,null,f)},this.readPKCS8PubKeyHex=function(u){var s,o,l,f;if(n(u)===!1)throw new Error("not ASN.1 hex string");try{s=r(u,0,[0,1,0],"02"),o=r(u,0,[0,1,1],"02"),l=r(u,0,[0,1,2],"02"),f=r(u,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(s,o,l,f)},this.readCertPubKeyHex=function(u,s){var o,l,f,p;if(n(u)===!1)throw new Error("not ASN.1 hex string");try{o=r(u,0,[0,5,0,1,0],"02"),l=r(u,0,[0,5,0,1,1],"02"),f=r(u,0,[0,5,0,1,2],"02"),p=r(u,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(o,l,f,p)}};var Ft=function(){var e=function(m,y,A){return n(Ie.AES,m,y,A)},t=function(m,y,A){return n(Ie.TripleDES,m,y,A)},r=function(m,y,A){return n(Ie.DES,m,y,A)},n=function(m,y,A,C){var S=Ie.enc.Hex.parse(y),B=Ie.enc.Hex.parse(A),I=Ie.enc.Hex.parse(C),M={};M.key=B,M.iv=I,M.ciphertext=S;var q=m.decrypt(M,B,{iv:I});return Ie.enc.Hex.stringify(q)},i=function(m,y,A){return o(Ie.AES,m,y,A)},u=function(m,y,A){return o(Ie.TripleDES,m,y,A)},s=function(m,y,A){return o(Ie.DES,m,y,A)},o=function(m,y,A,C){var S=Ie.enc.Hex.parse(y),B=Ie.enc.Hex.parse(A),I=Ie.enc.Hex.parse(C),M=m.encrypt(S,B,{iv:I}),q=Ie.enc.Hex.parse(M.toString()),b=Ie.enc.Base64.stringify(q);return b},l={"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:u,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:s,keylen:8,ivlen:8}},f=function(m){return l[m].proc},p=function(m){var y=Ie.lib.WordArray.random(m),A=Ie.enc.Hex.stringify(y);return A},E=function(m){var y={},A=m.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));A&&(y.cipher=A[1],y.ivsalt=A[2]);var C=m.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));C&&(y.type=C[1]);var S=-1,B=0;m.indexOf(`\r
\r
`)!=-1&&(S=m.indexOf(`\r
\r
`),B=2),m.indexOf(`
`)!=-1&&(S=m.indexOf(`
`),B=1);var I=m.indexOf("-----END");if(S!=-1&&I!=-1){var M=m.substring(S+B*2,I-B);M=M.replace(/\s+/g,""),y.data=M}return y},d=function(m,y,A){for(var C=A.substring(0,16),S=Ie.enc.Hex.parse(C),B=Ie.enc.Utf8.parse(y),I=l[m].keylen+l[m].ivlen,M="",q=null;;){var b=Ie.algo.MD5.create();if(q!=null&&b.update(q),b.update(B),b.update(S),q=b.finalize(),M=M+Ie.enc.Hex.stringify(q),M.length>=I*2)break}var R={};return R.keyhex=M.substr(0,l[m].keylen*2),R.ivhex=M.substr(l[m].keylen*2,l[m].ivlen*2),R},h=function(m,y,A,C){var S=Ie.enc.Base64.parse(m),B=Ie.enc.Hex.stringify(S),I=l[y].proc,M=I(B,A,C);return M},w=function(m,y,A,C){var S=l[y].eproc,B=S(m,A,C);return B};return{version:"1.0.0",parsePKCS5PEM:function(m){return E(m)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(m,y,A){return d(m,y,A)},decryptKeyB64:function(m,y,A,C){return h(m,y,A,C)},getDecryptedKeyHex:function(m,y){var A=E(m),C=A.type,S=A.cipher,B=A.ivsalt,I=A.data,M=d(S,y,B),q=M.keyhex,b=h(I,S,q,B);return b},getEncryptedPKCS5PEMFromPrvKeyHex:function(m,y,A,C,S){var L="";if((typeof C>"u"||C==null)&&(C="AES-256-CBC"),typeof l[C]>"u")throw new Error("KEYUTIL unsupported algorithm: "+C);if(typeof S>"u"||S==null){var B=l[C].ivlen,I=p(B);S=I.toUpperCase()}var M=d(C,A,S),q=M.keyhex,b=w(y,C,q,S),R=b.replace(/(.{64})/g,`$1\r
`),L="-----BEGIN "+m+` PRIVATE KEY-----\r
`;return L+=`Proc-Type: 4,ENCRYPTED\r
`,L+="DEK-Info: "+C+","+S+`\r
`,L+=`\r
`,L+=R,L+=`\r
-----END `+m+` PRIVATE KEY-----\r
`,L},getEncryptedPKCS8PEM:function(m,y,A){var C=this.getEncryptedPKCS8Hex(m,y,A);return $n(C,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(m,y,A){var C;A==null||A==null?C={}:C=JSON.parse(JSON.stringify(A)),C.plain=m,this.initPBES2Param(C),this.encryptPBES2Param(C,y);var S=this.generatePBES2ASN1Param(C);return g.asn1.ASN1Util.newObject(S).tohex()},initPBES2Param:function(m){if(nr(m,"encalg")==null&&(m.encalg="aes256-CBC"),nr(m,"iter")==null&&(m.iter=2048),nr(m,"prf")==null&&(m.prf="hmacWithSHA256"),nr(m,"salt")==null&&(m.salt=Ie.enc.Hex.stringify(Ie.lib.WordArray.random(8))),nr(m,"enciv")==null){var y;m.encalg=="des-EDE3-CBC"&&(y=8),m.encalg=="aes128-CBC"&&(y=16),m.encalg=="aes256-CBC"&&(y=16),m.enciv=Ie.enc.Hex.stringify(Ie.lib.WordArray.random(y))}},encryptPBES2Param:function(m,y){var A=Ft.getDKFromPBES2Param(m,y);try{var C=g.crypto.Cipher.encrypt(m.plain,A,m.encalg,{iv:m.enciv})}catch{throw new Error("encrypt error: "+m.plain+" "+A+" "+m.encalg+" "+m.enciv)}m.enc=C},generatePBES2ASN1Param:function(m){var y={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:m.salt}},{int:{hex:Ov(m.iter)}}]}]},{seq:[{oid:m.encalg},{octstr:{hex:m.enciv}}]}]}]},{octstr:{hex:m.enc}}]};return m.prf!="hmacWithSHA1"&&y.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:m.prf},{null:""}]}),y},parseHexOfEncryptedPKCS8:function(m){var y=Fe,A=y.getChildIdx,C=y.getV,S={},B=A(m,0);if(B.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+B.length);S.ciphertext=C(m,B[1]);var I=A(m,B[0]);if(I.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+I.length);if(C(m,I[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var M=A(m,I[1]);if(I.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+M.length);var q=A(m,M[1]);if(q.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length);if(C(m,q[0])!="2a864886f70d0307")throw"this only supports TripleDES";S.encryptionSchemeAlg="TripleDES",S.encryptionSchemeIV=C(m,q[1]);var b=A(m,M[0]);if(b.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+b.length);if(C(m,b[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var R=A(m,b[1]);if(R.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+R.length);S.pbkdf2Salt=C(m,R[0]);var L=C(m,R[1]);try{S.pbkdf2Iter=parseInt(L,16)}catch{throw new Error("malformed format pbkdf2Iter: "+L)}return S},getPBKDF2KeyHexFromParam:function(m,y){var A=Ie.enc.Hex.parse(m.pbkdf2Salt),C=m.pbkdf2Iter,S=Ie.PBKDF2(y,A,{keySize:192/32,iterations:C}),B=Ie.enc.Hex.stringify(S);return B},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(m,y){var A=Ar(m,"ENCRYPTED PRIVATE KEY"),C=this.parseHexOfEncryptedPKCS8(A),S=Ft.getPBKDF2KeyHexFromParam(C,y),B={};B.ciphertext=Ie.enc.Hex.parse(C.ciphertext);var I=Ie.enc.Hex.parse(S),M=Ie.enc.Hex.parse(C.encryptionSchemeIV),q=Ie.TripleDES.decrypt(B,I,{iv:M}),b=Ie.enc.Hex.stringify(q);return b},parsePBES2:function(m){var y=Fe.parse(m);if(nr(y,"seq.0.seq.0.oid")!="pkcs5PBES2"||nr(y,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var A=nr(y,"seq.0.seq.1.seq.0.seq.1.seq");if(A==null)throw new Error("PBKDF2 parameter not found");var C=nr(A,"0.octstr.hex"),S=nr(A,"1.int.hex"),B=nr(A,"2.seq.0.oid","hmacWithSHA1"),I=-1;try{I=parseInt(S,16)}catch{throw new Error("iter not proper value")}var M=nr(y,"seq.0.seq.1.seq.1.seq.0.oid"),q=nr(y,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),b=nr(y,"seq.1.octstr.hex");if(M==null||q==null||b==null)throw new Error("encalg, enciv or enc is undefined");var R={salt:C,iter:I,prf:B,encalg:M,enciv:q,enc:b};return R},getDKFromPBES2Param:function(m,y){var A={hmacWithSHA1:Ie.algo.SHA1,hmacWithSHA224:Ie.algo.SHA224,hmacWithSHA256:Ie.algo.SHA256,hmacWithSHA384:Ie.algo.SHA384,hmacWithSHA512:Ie.algo.SHA512},C={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},S=A[m.prf];if(S==null)throw new Error("unsupported prf");var B=C[m.encalg];if(B==null)throw new Error("unsupported encalg");var I=Ie.enc.Hex.parse(m.salt),M=m.iter;try{var q=Ie.PBKDF2(y,I,{keySize:B,iterations:M,hasher:S});return Ie.enc.Hex.stringify(q)}catch(b){throw new Error("PBKDF2 error: "+b+" "+JSON.stringify(m)+" "+y)}},getPlainHexFromEncryptedPKCS8PEM:function(m,y){if(m.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var A=Ar(m),C;try{C=Ft.parsePBES2(A)}catch(B){throw new Error("malformed PBES2 format: "+B.message)}var S=Ft.getDKFromPBES2Param(C,y);return g.crypto.Cipher.decrypt(C.enc,S,C.encalg,{iv:C.enciv})},getKeyFromEncryptedPKCS8PEM:function(m,y){var A=this.getPlainHexFromEncryptedPKCS8PEM(m,y),C=this.getKeyFromPlainPrivatePKCS8Hex(A);return C},parsePlainPrivatePKCS8Hex:function(m){var y=Fe,A=y.getChildIdx,C=y.getV,S={};if(S.algparam=null,m.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var B=A(m,0);if(B.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(m.substr(B[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var I=A(m,B[1]);if(I.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(m.substr(I[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(S.algoid=C(m,I[0]),m.substr(I[1],2)=="06"&&(S.algparam=C(m,I[1])),m.substr(B[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return S.keyidx=y.getVidx(m,B[2]),S},getKeyFromPlainPrivatePKCS8PEM:function(m){var y=Ar(m,"PRIVATE KEY"),A=this.getKeyFromPlainPrivatePKCS8Hex(y);return A},getKeyFromPlainPrivatePKCS8Hex:function(m){var y=this.parsePlainPrivatePKCS8Hex(m),A;if(y.algoid=="2a864886f70d010101")A=new ut;else if(y.algoid=="2a8648ce380401")A=new g.crypto.DSA;else if(y.algoid=="2a8648ce3d0201")A=new g.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return A.readPKCS8PrvKeyHex(m),A},_getKeyFromPublicPKCS8Hex:function(m){var y,A=Fe.getVbyList(m,0,[0,0],"06");if(A==="2a864886f70d010101")y=new ut;else if(A==="2a8648ce380401")y=new g.crypto.DSA;else if(A==="2a8648ce3d0201")y=new g.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return y.readPKCS8PubKeyHex(m),y},parsePublicRawRSAKeyHex:function(m){var y=Fe,A=y.getChildIdx,C=y.getV,S={};if(m.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var B=A(m,0);if(B.length!=2)throw new Error("malformed RSA key(code:002)");if(m.substr(B[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(S.n=C(m,B[0]),m.substr(B[1],2)!="02")throw new Error("malformed RSA key(code:004)");return S.e=C(m,B[1]),S},parsePublicPKCS8Hex:function(m){var y=Fe,A=y.getChildIdx,C=y.getV,S={};S.algparam=null;var B=A(m,0);if(B.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+B.length);var I=B[0];if(m.substr(I,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var M=A(m,I);if(M.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(m.substr(M[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(S.algoid=C(m,M[0]),m.substr(M[1],2)=="06"?S.algparam=C(m,M[1]):m.substr(M[1],2)=="30"&&(S.algparam={},S.algparam.p=y.getVbyList(m,M[1],[0],"02"),S.algparam.q=y.getVbyList(m,M[1],[1],"02"),S.algparam.g=y.getVbyList(m,M[1],[2],"02")),m.substr(B[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return S.key=C(m,B[1]).substr(2),S}}}();Ft.getKey=function(e,t,r){var n=Fe,i=n.getChildIdx,u=n.getV,s=n.getVbyList,o=g.crypto,l=o.ECDSA,f=o.DSA,p=ut,E=Ar,d=Ft;if(typeof p<"u"&&e instanceof p||typeof l<"u"&&e instanceof l||typeof f<"u"&&e instanceof f)return e;if(e.curve!==void 0&&e.xy!==void 0&&e.d===void 0)return new l({pub:e.xy,curve:e.curve});if(e.curve!==void 0&&e.d!==void 0)return new l({prv:e.d,curve:e.curve});if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var h=new p;return h.setPublic(e.n,e.e),h}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 h=new p;return h.setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),h}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p===void 0){var h=new p;return h.setPrivate(e.n,e.e,e.d),h}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x===void 0){var h=new f;return h.setPublic(e.p,e.q,e.g,e.y),h}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x!==void 0){var h=new f;return h.setPrivate(e.p,e.q,e.g,e.y,e.x),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var h=new p;return h.setPublic(pr(e.n),pr(e.e)),h}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 h=new p;return h.setPrivateEx(pr(e.n),pr(e.e),pr(e.d),pr(e.p),pr(e.q),pr(e.dp),pr(e.dq),pr(e.qi)),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var h=new p;return h.setPrivate(pr(e.n),pr(e.e),pr(e.d)),h}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var w=new l({curve:e.crv}),m=w.ecparams.keycharlen,y=("0000000000"+pr(e.x)).slice(-m),A=("0000000000"+pr(e.y)).slice(-m),C="04"+y+A;return w.setPublicKeyHex(C),w}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var w=new l({curve:e.crv}),m=w.ecparams.keycharlen,y=("0000000000"+pr(e.x)).slice(-m),A=("0000000000"+pr(e.y)).slice(-m),C="04"+y+A,S=("0000000000"+pr(e.d)).slice(-m);return w.setPublicKeyHex(C),w.setPrivateKeyHex(S),w}if(r==="pkcs5prv"){var B=e,n=Fe,I,h;if(I=i(B,0),I.length===9)h=new p,h.readPKCS5PrvKeyHex(B);else if(I.length===6)h=new f,h.readPKCS5PrvKeyHex(B);else if(I.length>2&&B.substr(I[1],2)==="04")h=new l,h.readPKCS5PrvKeyHex(B);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return h}if(r==="pkcs8prv"){var h=d.getKeyFromPlainPrivatePKCS8Hex(e);return h}if(r==="pkcs8pub")return d._getKeyFromPublicPKCS8Hex(e);if(r==="x509pub")return Ze.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return Ze.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var M=Ar(e,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(M)}if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var q=E(e,"RSA PRIVATE KEY");return d.getKey(q,null,"pkcs5prv")}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var b=E(e,"DSA PRIVATE KEY"),R=s(b,0,[1],"02"),L=s(b,0,[2],"02"),j=s(b,0,[3],"02"),G=s(b,0,[4],"02"),Y=s(b,0,[5],"02"),h=new f;return h.setPrivate(new ee(R,16),new ee(L,16),new ee(j,16),new ee(G,16),new ee(Y,16)),h}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var q=E(e,"EC PRIVATE KEY");return d.getKey(q,null,"pkcs5prv")}if(e.indexOf("-END PRIVATE KEY-")!=-1)return d.getKeyFromPlainPrivatePKCS8PEM(e);if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var V=d.getDecryptedKeyHex(e,t),z=new ut;return z.readPKCS5PrvKeyHex(V),z}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var b=d.getDecryptedKeyHex(e,t),h=s(b,0,[1],"04"),J=s(b,0,[2,0],"06"),se=s(b,0,[3,0],"03").substr(2),De="";if(g.crypto.OID.oidhex2name[J]!==void 0)De=g.crypto.OID.oidhex2name[J];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+J);var w=new l({curve:De});return w.setPublicKeyHex(se),w.setPrivateKeyHex(h),w.isPublic=!1,w}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var b=d.getDecryptedKeyHex(e,t),R=s(b,0,[1],"02"),L=s(b,0,[2],"02"),j=s(b,0,[3],"02"),G=s(b,0,[4],"02"),Y=s(b,0,[5],"02"),h=new f;return h.setPrivate(new ee(R,16),new ee(L,16),new ee(j,16),new ee(G,16),new ee(Y,16)),h}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return d.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};Ft.generateKeypair=function(e,t){if(e=="RSA"){var r=t,n=new ut;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new ut,u=n.n.toString(16),s=n.e.toString(16);i.setPublic(u,s),i.isPrivate=!1,i.isPublic=!0;var o={};return o.prvKeyObj=n,o.pubKeyObj=i,o}else if(e=="EC"){var l=t,f=new g.crypto.ECDSA({curve:l}),p=f.generateKeyPairHex(),n=new g.crypto.ECDSA({curve:l});n.setPublicKeyHex(p.ecpubhex),n.setPrivateKeyHex(p.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new g.crypto.ECDSA({curve:l});i.setPublicKeyHex(p.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var o={};return o.prvKeyObj=n,o.pubKeyObj=i,o}else throw new Error("unknown algorithm: "+e)};Ft.getPEM=function(e,t,r,n,i,u){var s=g,o=s.asn1,l=o.DERObjectIdentifier,f=o.DERInteger,p=o.ASN1Util.newObject,E=o.x509,d=E.SubjectPublicKeyInfo,h=s.crypto,w=h.DSA,m=h.ECDSA,y=ut;function A(z){var J=p({seq:[{int:0},{int:{bigint:z.n}},{int:z.e},{int:{bigint:z.d}},{int:{bigint:z.p}},{int:{bigint:z.q}},{int:{bigint:z.dmp1}},{int:{bigint:z.dmq1}},{int:{bigint:z.coeff}}]});return J}function C(z){var J=p({seq:[{int:1},{octstr:{hex:z.prvKeyHex}},{tag:["a0",!0,{oid:{name:z.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+z.pubKeyHex}}]}]});return J}function S(z){var J=p({seq:[{int:0},{int:{bigint:z.p}},{int:{bigint:z.q}},{int:{bigint:z.g}},{int:{bigint:z.y}},{int:{bigint:z.x}}]});return J}if((y!==void 0&&e instanceof y||w!==void 0&&e instanceof w||m!==void 0&&e instanceof m)&&e.isPublic==!0&&(t===void 0||t=="PKCS8PUB")){var B=new d(e),I=B.tohex();return $n(I,"PUBLIC KEY")}if(t=="PKCS1PRV"&&y!==void 0&&e instanceof y&&(r===void 0||r==null)&&e.isPrivate==!0){var B=A(e),I=B.tohex();return $n(I,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&m!==void 0&&e instanceof m&&(r===void 0||r==null)&&e.isPrivate==!0){var M=new l({name:e.curveName}),q=M.tohex(),b=C(e),R=b.tohex(),L="";return L+=$n(q,"EC PARAMETERS"),L+=$n(R,"EC PRIVATE KEY"),L}if(t=="PKCS1PRV"&&w!==void 0&&e instanceof w&&(r===void 0||r==null)&&e.isPrivate==!0){var B=S(e),I=B.tohex();return $n(I,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&y!==void 0&&e instanceof y&&r!==void 0&&r!=null&&e.isPrivate==!0){var B=A(e),I=B.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",I,r,n,u)}if(t=="PKCS5PRV"&&m!==void 0&&e instanceof m&&r!==void 0&&r!=null&&e.isPrivate==!0){var B=C(e),I=B.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",I,r,n,u)}if(t=="PKCS5PRV"&&w!==void 0&&e instanceof w&&r!==void 0&&r!=null&&e.isPrivate==!0){var B=S(e),I=B.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",I,r,n,u)}var j=function(z,J){if(typeof J=="string")return Ft.getEncryptedPKCS8PEM(z,J);if(typeof J=="object"&&nr(J,"passcode")!=null){var se=JSON.parse(JSON.stringify(J)),De=se.passcode;return delete se.passcode,Ft.getEncryptedPKCS8PEM(z,De,se)}};if(t=="PKCS8PRV"&&y!=null&&e instanceof y&&e.isPrivate==!0){var G=A(e),Y=G.tohex(),B=p({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:Y}}]}),I=B.tohex();return r===void 0||r==null?$n(I,"PRIVATE KEY"):j(I,r)}if(t=="PKCS8PRV"&&m!==void 0&&e instanceof m&&e.isPrivate==!0){var V={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&V.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var G=new p(V),Y=G.tohex(),B=p({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:Y}}]}),I=B.tohex();return r===void 0||r==null?$n(I,"PRIVATE KEY"):j(I,r)}if(t=="PKCS8PRV"&&w!==void 0&&e instanceof w&&e.isPrivate==!0){var G=new f({bigint:e.x}),Y=G.tohex(),B=p({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:Y}}]}),I=B.tohex();return r===void 0||r==null?$n(I,"PRIVATE KEY"):j(I,r)}throw new Error("unsupported object nor format")};Ft.getKeyFromCSRPEM=function(e){var t=Ar(e,"CERTIFICATE REQUEST"),r=Ft.getKeyFromCSRHex(t);return r};Ft.getKeyFromCSRHex=function(e){var t=Ft.parseCSRHex(e),r=Ft.getKey(t.p8pubkeyhex,null,"pkcs8pub");return r};Ft.parseCSRHex=function(e){var t=Fe,r=t.getChildIdx,n=t.getTLV,i={},u=e;if(u.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var s=r(u,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if(u.substr(s[0],2)!="30")throw new Error("malformed CSR(code:003)");var o=r(u,s[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(u,o[2]),i};Ft.getKeyID=function(e){var t=Ft,r=Fe;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var n=Ar(t.getPEM(e)),i=r.getIdxbyList(n,0,[1]),u=r.getV(n,i).substring(2);return g.crypto.Util.hashHex(u,"sha1")};Ft.getJWK=function(e,t,r,n,i){var u,s={},o,l=g.crypto.Util.hashHex;if(typeof e=="string")u=Ft.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(o=Ar(e));else if(typeof e=="object")e instanceof Ze?(u=e.getPublicKey(),o=e.hex):u=e;else throw new Error("unsupported keyinfo type");if(u instanceof ut&&u.isPrivate)s.kty="RSA",s.n=Kr(u.n.toString(16)),s.e=Kr(u.e.toString(16)),s.d=Kr(u.d.toString(16)),s.p=Kr(u.p.toString(16)),s.q=Kr(u.q.toString(16)),s.dp=Kr(u.dmp1.toString(16)),s.dq=Kr(u.dmq1.toString(16)),s.qi=Kr(u.coeff.toString(16));else if(u instanceof ut&&u.isPublic)s.kty="RSA",s.n=Kr(u.n.toString(16)),s.e=Kr(u.e.toString(16));else if(u instanceof g.crypto.ECDSA&&u.isPrivate){var f=u.getShortNISTPCurveName();if(f!=="P-256"&&f!=="P-384"&&f!=="P-521")throw new Error("unsupported curve name for JWT: "+f);var p=u.getPublicKeyXYHex();s.kty="EC",s.crv=f,s.x=Kr(p.x),s.y=Kr(p.y),s.d=Kr(u.prvKeyHex)}else if(u instanceof g.crypto.ECDSA&&u.isPublic){var f=u.getShortNISTPCurveName();if(f!=="P-256"&&f!=="P-384"&&f!=="P-521")throw new Error("unsupported curve name for JWT: "+f);var p=u.getPublicKeyXYHex();s.kty="EC",s.crv=f,s.x=Kr(p.x),s.y=Kr(p.y)}if(s.kty==null)throw new Error("unsupported keyinfo");return!u.isPrivate&&t!=!0&&(s.kid=g.jws.JWS.getJWKthumbprint(s)),o!=null&&r!=!0&&(s.x5c=[pu(o)]),o!=null&&n!=!0&&(s.x5t=Mo(pu(l(o,"sha1")))),o!=null&&i!=!0&&(s["x5t#S256"]=Mo(pu(l(o,"sha256")))),s};Ft.getJWKFromKey=function(e){return Ft.getJWK(e,!0,!0,!0,!0)};ut.getPosArrayOfChildrenFromHex=function(e){return Fe.getChildIdx(e,0)};ut.getHexValueArrayOfChildrenFromHex=function(e){var t=Fe,r=t.getV,d=ut.getPosArrayOfChildrenFromHex(e),n=r(e,d[0]),i=r(e,d[1]),u=r(e,d[2]),s=r(e,d[3]),o=r(e,d[4]),l=r(e,d[5]),f=r(e,d[6]),p=r(e,d[7]),E=r(e,d[8]),d=new Array;return d.push(n,i,u,s,o,l,f,p,E),d};ut.prototype.readPrivateKeyFromPEMString=function(e){var t=Ar(e),r=ut.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};ut.prototype.readPKCS5PrvKeyHex=function(e){var t=ut.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])};ut.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,i,u,s,o,l,f=Fe,p=f.getVbyListEx;if(f.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");try{t=p(e,0,[2,0,1],"02"),r=p(e,0,[2,0,2],"02"),n=p(e,0,[2,0,3],"02"),i=p(e,0,[2,0,4],"02"),u=p(e,0,[2,0,5],"02"),s=p(e,0,[2,0,6],"02"),o=p(e,0,[2,0,7],"02"),l=p(e,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,r,n,i,u,s,o,l)};ut.prototype.readPKCS5PubKeyHex=function(e){var t=Fe,r=t.getV;if(t.isASN1HEX(e)===!1)throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(n.length!==2||e.substr(n[0],2)!=="02"||e.substr(n[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var i=r(e,n[0]),u=r(e,n[1]);this.setPublic(i,u)};ut.prototype.readPKCS8PubKeyHex=function(e){var t=Fe;if(t.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");if(t.getTLVbyListEx(e,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var r=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(r)};ut.prototype.readCertPubKeyHex=function(e,t){var r,n;r=new Ze,r.readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};var xT=new RegExp("[^0-9a-f]","gi");function Lv(e,t){for(var r="",n=t/4-e.length,i=0;i<n;i++)r=r+"0";return r+e}ut.prototype.sign=function(e,t){var r=function(i){return g.crypto.Util.hashString(i,t)},n=r(e);return this.signWithMessageHash(n,t)};ut.prototype.signWithMessageHash=function(e,t){var r=g.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),n=ui(r,16),i=this.doPrivate(n),u=i.toString(16);return Lv(u,this.n.bitLength())};function Uv(e,t,r){for(var n="",i=0;n.length<t;)n+=oi(r($s(e+String.fromCharCode.apply(String,[(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}ut.prototype.signPSS=function(e,t,r){var n=function(u){return g.crypto.Util.hashHex(u,t)},i=n($s(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,t,r)};ut.prototype.signWithMessageHashPSS=function(e,t,r){var n=oi(e),i=n.length,u=this.n.bitLength()-1,s=Math.ceil(u/8),o,l=function(y){return g.crypto.Util.hashHex(y,t)};if(r===-1||r===void 0)r=i;else if(r===-2)r=s-i-2;else if(r<-2)throw new Error("invalid salt length");if(s<i+r+2)throw new Error("data too long");var f="";r>0&&(f=new Array(r),new Go().nextBytes(f),f=String.fromCharCode.apply(String,f));var p=oi(l($s("\0\0\0\0\0\0\0\0"+n+f))),E=[];for(o=0;o<s-r-i-2;o+=1)E[o]=0;var d=String.fromCharCode.apply(String,E)+""+f,h=Uv(p,d.length,l),w=[];for(o=0;o<d.length;o+=1)w[o]=d.charCodeAt(o)^h.charCodeAt(o);var m=65280>>8*s-u&255;for(w[0]&=~m,o=0;o<i;o++)w.push(p.charCodeAt(o));return w.push(188),Lv(this.doPrivate(new ee(w)).toString(16),this.n.bitLength())};function Hv(e){for(var t in g.crypto.Util.DIGESTINFOHEAD){var r=g.crypto.Util.DIGESTINFOHEAD[t],n=r.length;if(e.substring(0,n)==r){var i=[t,e.substring(n)];return i}}return[]}ut.prototype.verify=function(e,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var r=ui(t,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r),u=i.toString(16);if(u.length+3!=n/4)return!1;var s=u.replace(/^1f+00/,""),o=Hv(s);if(o.length==0)return!1;var l=o[0],f=o[1],p=function(d){return g.crypto.Util.hashString(d,l)},E=p(e);return f==E};ut.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=ui(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),u=Hv(i);if(u.length==0)return!1;var s=u[0],o=u[1];return o==e};ut.prototype.verifyPSS=function(e,t,r,n){var i=function(s){return g.crypto.Util.hashHex(s,r)},u=i($s(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(u,t,r,n)};ut.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new ee(t,16),u=function(C){return g.crypto.Util.hashHex(C,r)},s=oi(e),o=s.length,l=this.n.bitLength()-1,f=Math.ceil(l/8),p;if(n===-1||n===void 0)n=o;else if(n===-2)n=f-o-2;else if(n<-2)throw new Error("invalid salt length");if(f<o+n+2)throw new Error("data too long");var E=this.doPublic(i).toByteArray();for(p=0;p<E.length;p+=1)E[p]&=255;for(;E.length<f;)E.unshift(0);if(E[f-1]!==188)throw new Error("encoded message does not end in 0xbc");E=String.fromCharCode.apply(String,E);var d=E.substr(0,f-o-1),h=E.substr(d.length,o),w=65280>>8*f-l&255;if(d.charCodeAt(0)&w)throw new Error("bits beyond keysize not zero");var m=Uv(h,d.length,u),y=[];for(p=0;p<d.length;p+=1)y[p]=d.charCodeAt(p)^m.charCodeAt(p);y[0]&=~w;var A=f-o-n-2;for(p=0;p<A;p+=1)if(y[p]!==0)throw new Error("leftmost octets not zero");if(y[A]!==1)throw new Error("0x01 marker not found");return h===oi(u($s("\0\0\0\0\0\0\0\0"+s+String.fromCharCode.apply(String,y.slice(-n)))))};ut.SALT_LEN_HLEN=-1;ut.SALT_LEN_MAX=-2;ut.SALT_LEN_RECOVER=-2;function Ze(e){var t=Fe,r=t.getChildIdx,n=t.getV,i=t.dump,u=t.parse,s=t.getTLV,o=t.getVbyList,l=t.getVbyListEx,f=t.getTLVbyList,p=t.getTLVbyListEx,E=t.getIdxbyList,d=t.getIdxbyListEx,h=t.getVidx,w=t.getInt,m=t.oidname,y=t.hextooidstr,A=Ze,C=Ar,S,B=Error;try{S=g.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 b=f(this.hex,0,[0,0]);if(b.substr(0,2)=="a0"){var R=f(b,0,[0]),L=w(R,0);if(L<0||2<L)throw new Error("malformed version field");return this.version=L+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return l(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var b=p(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(b)},this.getAlgorithmIdentifierName=function(b){for(var R in S)if(b===S[R])return R;return m(l(b,0,[0],"06"))},this.getIssuer=function(b,R){return this.getX500Name(this.getIssuerHex(),b,R)},this.getIssuerHex=function(){return f(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var b=this.getIssuer();return b.str},this.getSubject=function(b,R){return this.getX500Name(this.getSubjectHex(),b,R)},this.getSubjectHex=function(){return f(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var b=this.getSubject();return b.str},this.getNotBefore=function(){var b=o(this.hex,0,[0,4+this.foffset,0]);return b=b.replace(/(..)/g,"%$1"),b=decodeURIComponent(b),b},this.getNotAfter=function(){var b=o(this.hex,0,[0,4+this.foffset,1]);return b=b.replace(/(..)/g,"%$1"),b=decodeURIComponent(b),b},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return f(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var b=this.getSPKI();return b==null?null:o(b,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return E(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var b=this.getPublicKeyIdx();return E(this.hex,b,[1,0],"30")},this.getPublicKey=function(){return Ft.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var b=f(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(b)},this.getSignatureValueHex=function(){return o(this.hex,0,[2],"03",!0)},this.verifySignature=function(b){var R=this.getSignatureAlgorithmField(),L=this.getSignatureValueHex(),j=f(this.hex,0,[0],"30"),G=new g.crypto.Signature({alg:R});return G.init(b),G.updateHex(j),G.verify(L)},this.parseExt=function(b){var R,L,j;if(b===void 0){if(j=this.hex,this.version!==3)return-1;R=E(j,0,[0,7,0],"30"),L=r(j,R)}else{j=Ar(b);var G=E(j,0,[0,3,0,0],"06");if(n(j,G)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}R=E(j,0,[0,3,0,1,0],"30"),L=r(j,R),this.hex=j}this.aExtInfo=new Array;for(var Y=0;Y<L.length;Y++){var V={};V.critical=!1;var z=r(j,L[Y]),J=0;z.length===3&&(V.critical=!0,J=1),V.oid=t.hextooidstr(o(j,L[Y],[0],"06"));var se=E(j,L[Y],[1+J]);V.vidx=h(j,se),this.aExtInfo.push(V)}},this.getExtInfo=function(b){var R=this.aExtInfo,L=b;if(b.match(/^[0-9.]+$/)||(L=g.asn1.x509.OID.name2oid(b)),L!==""){for(var j=0;j<R.length;j++)if(R[j].oid===L)return R[j]}},this.getCriticalExtV=function(b,R,L){if(R!=null)return[R,L];var j=this.getExtInfo(b);return j==null?[null,null]:[s(this.hex,j.vidx),j.critical]},this.getExtBasicConstraints=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("basicConstraints");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"basicConstraints"};if(R&&(j.critical=!0),b==="3000")return j;if(b==="30030101ff")return j.cA=!0,j;if(b.substr(0,12)==="30060101ff02"){var G=n(b,10),Y=parseInt(G,16);return j.cA=!0,j.pathLen=Y,j}throw new Error("hExtV parse error: "+b)},this.getExtNameConstraints=function(b,R){var L=this.getCriticalExtV("nameConstraints",b,R);if(b=L[0],R=L[1],b!=null){var j={extname:"nameConstraints"};R&&(j.critical=!0);for(var G=r(b,0),Y=0;Y<G.length;Y++){for(var V=[],z=r(b,G[Y]),J=0;J<z.length;J++){var se=s(b,z[J]),De=this.getGeneralSubtree(se);V.push(De)}var ye=b.substr(G[Y],2);ye=="a0"?j.permit=V:ye=="a1"&&(j.exclude=V)}return j}},this.getGeneralSubtree=function(b){var R=r(b,0),L=R.length;if(L<1||2<L)throw new Error("wrong num elements");for(var j=this.getGeneralName(s(b,R[0])),G=1;G<L;G++){var Y=b.substr(R[G],2),V=n(b,R[G]),z=parseInt(V,16);Y=="80"&&(j.min=z),Y=="81"&&(j.max=z)}return j},this.getExtKeyUsage=function(b,R){var L=this.getCriticalExtV("keyUsage",b,R);if(b=L[0],R=L[1],b!=null){var j={extname:"keyUsage"};return R&&(j.critical=!0),j.names=this.getExtKeyUsageString(b).split(","),j}},this.getExtKeyUsageBin=function(b){if(b===void 0){var R=this.getExtInfo("keyUsage");if(R===void 0)return"";b=s(this.hex,R.vidx)}if(b.length!=8&&b.length!=10)throw new Error("malformed key usage value: "+b);var L="000000000000000"+parseInt(b.substr(6),16).toString(2);return b.length==8&&(L=L.slice(-8)),b.length==10&&(L=L.slice(-16)),L=L.replace(/0+$/,""),L==""&&(L="0"),L},this.getExtKeyUsageString=function(b){for(var R=this.getExtKeyUsageBin(b),L=new Array,j=0;j<R.length;j++)R.substr(j,1)=="1"&&L.push(Ze.KEYUSAGE_NAME[j]);return L.join(",")},this.getExtSubjectKeyIdentifier=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("subjectKeyIdentifier");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"subjectKeyIdentifier"};R&&(j.critical=!0);var G=n(b,0);return j.kid={hex:G},j},this.getExtAuthorityKeyIdentifier=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("authorityKeyIdentifier");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"authorityKeyIdentifier"};R&&(j.critical=!0);for(var G=r(b,0),Y=0;Y<G.length;Y++){var V=b.substr(G[Y],2);if(V==="80"&&(j.kid={hex:n(b,G[Y])}),V==="a1"){var z=s(b,G[Y]),J=this.getGeneralNames(z);j.issuer=J[0].dn}V==="82"&&(j.sn={hex:n(b,G[Y])})}return j},this.getExtExtKeyUsage=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("extKeyUsage");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"extKeyUsage",array:[]};R&&(j.critical=!0);for(var G=r(b,0),Y=0;Y<G.length;Y++)j.array.push(m(n(b,G[Y])));return j},this.getExtExtKeyUsageName=function(){var b=this.getExtInfo("extKeyUsage");if(b===void 0)return b;var R=new Array,L=s(this.hex,b.vidx);if(L==="")return R;for(var j=r(L,0),G=0;G<j.length;G++)R.push(m(n(L,j[G])));return R},this.getExtSubjectAltName=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("subjectAltName");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"subjectAltName",array:[]};return R&&(j.critical=!0),j.array=this.getGeneralNames(b),j},this.getExtIssuerAltName=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("issuerAltName");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"issuerAltName",array:[]};return R&&(j.critical=!0),j.array=this.getGeneralNames(b),j},this.getGeneralNames=function(b){for(var R=r(b,0),L=[],j=0;j<R.length;j++){var G=this.getGeneralName(s(b,R[j]));G!==void 0&&L.push(G)}return L},this.getGeneralName=function(b){var R=b.substr(0,2),L=n(b,0),j=oi(L);if(R=="81")return{rfc822:j};if(R=="82")return{dns:j};if(R=="86")return{uri:j};if(R=="87")return{ip:xf(L)};if(R=="a4")return{dn:this.getX500Name(L)};if(R=="a0")return{other:this.getOtherName(b)}},this.getExtSubjectAltName2=function(){var b,R,L,j=this.getExtInfo("subjectAltName");if(j===void 0)return j;for(var G=new Array,Y=s(this.hex,j.vidx),V=r(Y,0),z=0;z<V.length;z++)L=Y.substr(V[z],2),b=n(Y,V[z]),L==="81"&&(R=Wt(b),G.push(["MAIL",R])),L==="82"&&(R=Wt(b),G.push(["DNS",R])),L==="84"&&(R=Ze.hex2dn(b,0),G.push(["DN",R])),L==="86"&&(R=Wt(b),G.push(["URI",R])),L==="87"&&(R=xf(b),G.push(["IP",R]));return G},this.getExtCRLDistributionPoints=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("cRLDistributionPoints");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"cRLDistributionPoints",array:[]};R&&(j.critical=!0);for(var G=r(b,0),Y=0;Y<G.length;Y++){var V=s(b,G[Y]);j.array.push(this.getDistributionPoint(V))}return j},this.getDistributionPoint=function(b){for(var R={},L=r(b,0),j=0;j<L.length;j++){var G=b.substr(L[j],2),Y=s(b,L[j]);G=="a0"&&(R.dpname=this.getDistributionPointName(Y))}return R},this.getDistributionPointName=function(b){for(var R={},L=r(b,0),j=0;j<L.length;j++){var G=b.substr(L[j],2),Y=s(b,L[j]);G=="a0"&&(R.full=this.getGeneralNames(Y))}return R},this.getExtCRLDistributionPointsURI=function(){var b=this.getExtCRLDistributionPoints();if(b==null)return b;for(var R=b.array,L=[],j=0;j<R.length;j++)try{R[j].dpname.full[0].uri!=null&&L.push(R[j].dpname.full[0].uri)}catch{}return L},this.getExtAIAInfo=function(){var b=this.getExtInfo("authorityInfoAccess");if(b===void 0)return b;for(var R={ocsp:[],caissuer:[]},L=r(this.hex,b.vidx),j=0;j<L.length;j++){var G=o(this.hex,L[j],[0],"06"),Y=o(this.hex,L[j],[1],"86");G==="2b06010505073001"&&R.ocsp.push(Wt(Y)),G==="2b06010505073002"&&R.caissuer.push(Wt(Y))}return R},this.getExtAuthorityInfoAccess=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("authorityInfoAccess");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"authorityInfoAccess",array:[]};R&&(j.critical=!0);for(var G=r(b,0),Y=0;Y<G.length;Y++){var V=l(b,G[Y],[0],"06"),z=o(b,G[Y],[1],"86"),J=Wt(z);if(V=="2b06010505073001")j.array.push({ocsp:J});else if(V=="2b06010505073002")j.array.push({caissuer:J});else throw new Error("unknown method: "+V)}return j},this.getExtCertificatePolicies=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("certificatePolicies");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"certificatePolicies",array:[]};R&&(j.critical=!0);for(var G=r(b,0),Y=0;Y<G.length;Y++){var V=s(b,G[Y]),z=this.getPolicyInformation(V);j.array.push(z)}return j},this.getPolicyInformation=function(b){var R={},L=o(b,0,[0],"06");R.policyoid=m(L);var j=d(b,0,[1],"30");if(j!=-1){R.array=[];for(var G=r(b,j),Y=0;Y<G.length;Y++){var V=s(b,G[Y]),z=this.getPolicyQualifierInfo(V);R.array.push(z)}}return R},this.getOtherName=function(b){var R={},L=r(b,0),j=o(b,L[0],[],"06"),G=o(b,L[1],[]);return R.oid=m(j),R.value=u(G),R},this.getPolicyQualifierInfo=function(b){var R={},L=o(b,0,[0],"06");if(L==="2b06010505070201"){var j=l(b,0,[1],"16");R.cps=oi(j)}else if(L==="2b06010505070202"){var G=f(b,0,[1],"30");R.unotice=this.getUserNotice(G)}return R},this.getUserNotice=function(b){var R=null,L={};try{R=t.parse(b);var j=this._asn1ToUnotice(R);return j}catch{return}},this._asn1ToUnotice=function(b){try{for(var R={},L=nr(b,"seq"),j=0;j<L.length;j++){var G=this._asn1ToNoticeRef(L[j]);G!=null&&(R.noticeref=G);var Y=this.asn1ToDisplayText(L[j]);Y!=null&&(R.exptext=Y)}return Object.keys(R).length>0?R:void 0}catch{return}},this._asn1ToNoticeRef=function(b){try{for(var R={},L=nr(b,"seq"),j=0;j<L.length;j++){var G=this._asn1ToNoticeNum(L[j]);G!=null&&(R.noticenum=G);var Y=this.asn1ToDisplayText(L[j]);Y!=null&&(R.org=Y)}return Object.keys(R).length>0?R:void 0}catch{return}},this._asn1ToNoticeNum=function(b){try{for(var R=nr(b,"seq"),L=[],j=0;j<R.length;j++){var G=R[j];L.push(parseInt(nr(G,"int.hex"),16))}return L}catch{return}},this.getDisplayText=function(b){var R={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},L={};return L.type=R[b.substr(0,2)],L.str=oi(n(b,0)),L},this.asn1ToDisplayText=function(b){if(b.utf8str!=null)return{type:"utf8",str:b.utf8str.str};if(b.ia5str!=null)return{type:"ia5",str:b.ia5str.str};if(b.visstr!=null)return{type:"vis",str:b.visstr.str};if(b.bmpstr!=null)return{type:"bmp",str:b.bmpstr.str};if(b.prnstr!=null)return{type:"prn",str:b.prnstr.str}},this.getExtPolicyMappings=function(b,R){var L=this.getCriticalExtV("policyMappings",b,R);if(b=L[0],R=L[1],b!=null){var j={extname:"policyMappings"};R&&(j.critical=!0);try{for(var G=u(b),Y=G.seq,V=[],z=0;z<Y.length;z++){var J=Y[z].seq;V.push([J[0].oid,J[1].oid])}j.array=V}catch{throw new B("malformed policyMappings")}return j}},this.getExtPolicyConstraints=function(b,R){var L=this.getCriticalExtV("policyConstraints",b,R);if(b=L[0],R=L[1],b!=null){var j={extname:"policyConstraints"};R&&(j.critical=!0);var G=u(b);try{for(var Y=G.seq,V=0;V<Y.length;V++){var z=Y[V].tag;z.explicit==!1&&(z.tag=="80"&&(j.reqexp=parseInt(z.hex,16)),z.tag=="81"&&(j.inhibit=parseInt(z.hex,16)))}}catch{return new B("malformed policyConstraints value")}return j}},this.getExtInhibitAnyPolicy=function(b,R){var L=this.getCriticalExtV("inhibitAnyPolicy",b,R);if(b=L[0],R=L[1],b!=null){var j={extname:"inhibitAnyPolicy"};R&&(j.critical=!0);var G=w(b,0);return G==-1?new B("wrong value"):(j.skip=G,j)}},this.getExtCRLNumber=function(b,R){var L={extname:"cRLNumber"};if(R&&(L.critical=!0),b.substr(0,2)=="02")return L.num={hex:n(b,0)},L;throw new B("hExtV parse error: "+b)},this.getExtCRLReason=function(b,R){var L={extname:"cRLReason"};if(R&&(L.critical=!0),b.substr(0,2)=="0a")return L.code=parseInt(n(b,0),16),L;throw new Error("hExtV parse error: "+b)},this.getExtOcspNonce=function(b,R){var L={extname:"ocspNonce"};R&&(L.critical=!0);var j=n(b,0);return L.hex=j,L},this.getExtOcspNoCheck=function(b,R){var L={extname:"ocspNoCheck"};return R&&(L.critical=!0),L},this.getExtAdobeTimeStamp=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("adobeTimeStamp");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"adobeTimeStamp"};R&&(j.critical=!0);var G=r(b,0);if(G.length>1){var Y=s(b,G[1]),V=this.getGeneralName(Y);V.uri!=null&&(j.uri=V.uri)}if(G.length>2){var z=s(b,G[2]);z=="0101ff"&&(j.reqauth=!0),z=="010100"&&(j.reqauth=!1)}return j},this.getExtSubjectDirectoryAttributes=function(b,R){if(b===void 0&&R===void 0){var L=this.getExtInfo("subjectDirectoryAttributes");if(L===void 0)return;b=s(this.hex,L.vidx),R=L.critical}var j={extname:"subjectDirectoryAttributes"};R&&(j.critical=!0);try{for(var G=u(b),Y=[],V=0;V<G.seq.length;V++){var z=G.seq[V],J=nr(z,"seq.0.oid"),se=nr(z,"seq.1.set");if(J==null||se==null)throw"error";Y.push({attr:J,array:se})}return j.array=Y,j}catch{throw new Error("malformed subjectDirectoryAttributes extension value")}};var I=function(b){var R={};try{var L=b.seq[0].oid,j=g.asn1.x509.OID.name2oid(L);R.type=g.asn1.x509.OID.oid2atype(j);var G=b.seq[1];if(G.utf8str!=null)R.ds="utf8",R.value=G.utf8str.str;else if(G.numstr!=null)R.ds="num",R.value=G.numstr.str;else if(G.telstr!=null)R.ds="tel",R.value=G.telstr.str;else if(G.prnstr!=null)R.ds="prn",R.value=G.prnstr.str;else if(G.ia5str!=null)R.ds="ia5",R.value=G.ia5str.str;else if(G.visstr!=null)R.ds="vis",R.value=G.visstr.str;else if(G.bmpstr!=null)R.ds="bmp",R.value=G.bmpstr.str;else throw"error";return R}catch{throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},M=function(b){try{return b.set.map(function(R){return I(R)})}catch(R){throw new Error("improper ASN.1 parsed RDN: "+R)}},q=function(b){try{return b.seq.map(function(R){return M(R)})}catch(R){throw new Error("improper ASN.1 parsed X500Name: "+R)}};this.getX500NameRule=function(b){for(var R=!0,L=!0,j=!1,G="",Y="",V=null,z=[],J=0;J<b.length;J++)for(var se=b[J],De=0;De<se.length;De++)z.push(se[De]);for(var J=0;J<z.length;J++){var ye=z[J],Pe=ye.ds,Qe=ye.value,ce=ye.type;if(G+=":"+Pe,Pe!="prn"&&Pe!="utf8"&&Pe!="ia5")return"mixed";if(Pe=="ia5"){if(ce!="CN")return"mixed";if(g.lang.String.isMail(Qe))continue;return"mixed"}if(ce=="C"){if(Pe=="prn")continue;return"mixed"}if(Y+=":"+Pe,V==null)V=Pe;else if(V!==Pe)return"mixed"}return V??"prn"},this.getAttrTypeAndValue=function(b){var R=u(b);return I(R)},this.getRDN=function(b){var R=u(b);return M(R)},this.getX500NameArray=function(b){var R=u(b);return q(R)},this.getX500Name=function(b,R,L){var j=this.getX500NameArray(b),G=this.dnarraytostr(j),Y={str:G};return Y.array=j,L==!0&&(Y.hex=b),R==!0&&(Y.canon=this.c14nRDNArray(j)),Y},this.readCertPEM=function(b){this.readCertHex(C(b))},this.readCertHex=function(b){this.hex=b,this.getVersion();try{E(this.hex,0,[0,7],"a3"),this.parseExt()}catch{}},this.getParam=function(b){var R={};return b==null&&(b={}),R.version=this.getVersion(),R.serial={hex:this.getSerialNumberHex()},R.sigalg=this.getSignatureAlgorithmField(),R.issuer=this.getIssuer(b.dncanon,b.dnhex),R.notbefore=this.getNotBefore(),R.notafter=this.getNotAfter(),R.subject=this.getSubject(b.dncanon,b.dnhex),R.sbjpubkey=$n(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo!=null&&this.aExtInfo.length>0&&(R.ext=this.getExtParamArray()),R.sighex=this.getSignatureValueHex(),b.tbshex==!0&&(R.tbshex=f(this.hex,0,[0])),b.nodnarray==!0&&(delete R.issuer.array,delete R.subject.array),R},this.getExtParamArray=function(b){if(b==null){var R=d(this.hex,0,[0,"[3]"]);R!=-1&&(b=p(this.hex,0,[0,"[3]",0],"30"))}for(var L=[],j=r(b,0),G=0;G<j.length;G++){var Y=s(b,j[G]),V=this.getExtParam(Y);V!=null&&L.push(V)}return L},this.getExtParam=function(b){var R={},L=r(b,0),j=L.length;if(j!=2&&j!=3)throw new Error("wrong number elements in Extension: "+j+" "+b);var G=y(o(b,0,[0],"06")),Y=!1;j==3&&f(b,0,[1])=="0101ff"&&(Y=!0);var V=f(b,0,[j-1,0]),z=void 0;if(G=="2.5.29.14"?z=this.getExtSubjectKeyIdentifier(V,Y):G=="2.5.29.15"?z=this.getExtKeyUsage(V,Y):G=="2.5.29.17"?z=this.getExtSubjectAltName(V,Y):G=="2.5.29.18"?z=this.getExtIssuerAltName(V,Y):G=="2.5.29.19"?z=this.getExtBasicConstraints(V,Y):G=="2.5.29.30"?z=this.getExtNameConstraints(V,Y):G=="2.5.29.31"?z=this.getExtCRLDistributionPoints(V,Y):G=="2.5.29.32"?z=this.getExtCertificatePolicies(V,Y):G=="2.5.29.33"?z=this.getExtPolicyMappings(V,Y):G=="2.5.29.35"?z=this.getExtAuthorityKeyIdentifier(V,Y):G=="2.5.29.36"?z=this.getExtPolicyConstraints(V,Y):G=="2.5.29.37"?z=this.getExtExtKeyUsage(V,Y):G=="2.5.29.54"?z=this.getExtInhibitAnyPolicy(V,Y):G=="1.3.6.1.5.5.7.1.1"?z=this.getExtAuthorityInfoAccess(V,Y):G=="2.5.29.20"?z=this.getExtCRLNumber(V,Y):G=="2.5.29.21"?z=this.getExtCRLReason(V,Y):G=="2.5.29.9"?z=this.getExtSubjectDirectoryAttributes(V,Y):G=="1.3.6.1.5.5.7.48.1.2"?z=this.getExtOcspNonce(V,Y):G=="1.3.6.1.5.5.7.48.1.5"?z=this.getExtOcspNoCheck(V,Y):G=="1.2.840.113583.1.1.9.1"?z=this.getExtAdobeTimeStamp(V,Y):Ze.EXT_PARSER[G]!=null&&(z=Ze.EXT_PARSER[G](G,Y,V)),z!=null)return z;var J={extname:G,extn:V};try{J.extn=u(V)}catch{}return Y&&(J.critical=!0),J},this.findExt=function(b,R){for(var L=0;L<b.length;L++)if(b[L].extname==R)return b[L];return null},this.updateExtCDPFullURI=function(b,R){var L=this.findExt(b,"cRLDistributionPoints");if(L!=null&&L.array!=null){for(var j=L.array,G=0;G<j.length;G++)if(j[G].dpname!=null&&j[G].dpname.full!=null)for(var Y=j[G].dpname.full,V=0;V<Y.length;V++){var z=Y[G];z.uri!=null&&(z.uri=R)}}},this.updateExtAIAOCSP=function(b,R){var L=this.findExt(b,"authorityInfoAccess");if(L!=null&&L.array!=null)for(var j=L.array,G=0;G<j.length;G++)j[G].ocsp!=null&&(j[G].ocsp=R)},this.updateExtAIACAIssuer=function(b,R){var L=this.findExt(b,"authorityInfoAccess");if(L!=null&&L.array!=null)for(var j=L.array,G=0;G<j.length;G++)j[G].caissuer!=null&&(j[G].caissuer=R)},this.dnarraytostr=function(b){function R(j){return j.map(function(G){return L(G).replace(/\+/,"\\+")}).join("+")}function L(j){return j.type+"="+j.value}return"/"+b.map(function(j){return R(j).replace(/\//,"\\/")}).join("/")},this.setCanonicalizedDN=function(b){var R;if(b.str!=null&&b.array==null){var L=new g.asn1.x509.X500Name({str:b.str}),j=L.tohex();R=this.getX500NameArray(j)}else R=b.array;b.canon==null&&(b.canon=this.c14nRDNArray(R))},this.c14nRDNArray=function(b){for(var R=[],L=0;L<b.length;L++){for(var j=b[L],G=[],Y=0;Y<j.length;Y++){var V=j[Y],z=V.value;z=z.replace(/^\s*/,""),z=z.replace(/\s*$/,""),z=z.replace(/\s+/g," "),z=z.toLowerCase(),G.push(V.type.toLowerCase()+"="+z)}R.push(G.join("+"))}return"/"+R.join("/")},this.getInfo=function(){var b=function(cr){for(var vt="",Xt=" ",at=`
`,Je=cr.array,lr=0;lr<Je.length;lr++){var Ve=Je[lr];if(Ve.dn!=null&&(vt+=Xt+"dn: "+Ve.dn.str+at),Ve.ip!=null&&(vt+=Xt+"ip: "+Ve.ip+at),Ve.rfc822!=null&&(vt+=Xt+"rfc822: "+Ve.rfc822+at),Ve.dns!=null&&(vt+=Xt+"dns: "+Ve.dns+at),Ve.uri!=null&&(vt+=Xt+"uri: "+Ve.uri+at),Ve.other!=null){var Lt=Ve.other.oid,un=JSON.stringify(Ve.other.value).replace(/\"/g,"");vt+=Xt+"other: "+Lt+"="+un+at}}return vt=vt.replace(/\n$/,""),vt},R=function(cr){for(var vt="",Xt=cr.array,at=0;at<Xt.length;at++){var Je=Xt[at];if(vt+=" policy oid: "+Je.policyoid+`
`,Je.array!==void 0)for(var lr=0;lr<Je.array.length;lr++){var Ve=Je.array[lr];Ve.cps!==void 0&&(vt+=" cps: "+Ve.cps+`
`)}}return vt},L=function(cr){for(var vt="",Xt=cr.array,at=0;at<Xt.length;at++){var Je=Xt[at];try{Je.dpname.full[0].uri!==void 0&&(vt+=" "+Je.dpname.full[0].uri+`
`)}catch{}try{Je.dname.full[0].dn.hex!==void 0&&(vt+=" "+Ze.hex2dn(Je.dpname.full[0].dn.hex)+`
`)}catch{}}return vt},j=function(cr){for(var vt="",Xt=cr.array,at=0;at<Xt.length;at++){var Je=Xt[at];Je.caissuer!==void 0&&(vt+=" caissuer: "+Je.caissuer+`
`),Je.ocsp!==void 0&&(vt+=" ocsp: "+Je.ocsp+`
`)}return vt},G=Ze,Y,V,z;if(Y=`Basic Fields
`,Y+=" serial number: "+this.getSerialNumberHex()+`
`,Y+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
`,Y+=" issuer: "+this.getIssuerString()+`
`,Y+=" notBefore: "+this.getNotBefore()+`
`,Y+=" notAfter: "+this.getNotAfter()+`
`,Y+=" subject: "+this.getSubjectString()+`
`,Y+=` subject public key info:
`,V=this.getPublicKey(),Y+=" key algorithm: "+V.type+`
`,V.type==="RSA"&&(Y+=" n="+Lp(V.n.toString(16)).substr(0,16)+`...
`,Y+=" e="+Lp(V.e.toString(16))+`
`),z=this.aExtInfo,z!=null){Y+=`X509v3 Extensions:
`;for(var J=0;J<z.length;J++){var se=z[J],De=g.asn1.x509.OID.oid2name(se.oid);De===""&&(De=se.oid);var ye="";if(se.critical===!0&&(ye="CRITICAL"),Y+=" "+De+" "+ye+`:
`,De==="basicConstraints"){var Pe=this.getExtBasicConstraints();Pe.cA===void 0?Y+=` {}
`:(Y+=" cA=true",Pe.pathLen!==void 0&&(Y+=", pathLen="+Pe.pathLen),Y+=`
`)}else if(De=="policyMappings"){var Qe=this.getExtPolicyMappings().array,ce=Qe.map(function(cr){var vt=cr;return vt[0]+":"+vt[1]}).join(", ");Y+=" "+ce+`
`}else if(De=="policyConstraints"){var Be=this.getExtPolicyConstraints();Y+=" ",Be.reqexp!=null&&(Y+=" reqexp="+Be.reqexp),Be.inhibit!=null&&(Y+=" inhibit="+Be.inhibit),Y+=`
`}else if(De=="inhibitAnyPolicy"){var Be=this.getExtInhibitAnyPolicy();Y+=" skip="+Be.skip+`
`}else if(De=="keyUsage")Y+=" "+this.getExtKeyUsageString()+`
`;else if(De=="subjectKeyIdentifier")Y+=" "+this.getExtSubjectKeyIdentifier().kid.hex+`
`;else if(De=="authorityKeyIdentifier"){var Ge=this.getExtAuthorityKeyIdentifier();Ge.kid!==void 0&&(Y+=" kid="+Ge.kid.hex+`
`)}else if(De=="extKeyUsage"){var Tr=this.getExtExtKeyUsage().array;Y+=" "+Tr.join(", ")+`
`}else if(De=="subjectAltName"){var Jt=b(this.getExtSubjectAltName());Y+=Jt+`
`}else if(De=="cRLDistributionPoints"){var St=this.getExtCRLDistributionPoints();Y+=L(St)}else if(De=="authorityInfoAccess"){var wr=this.getExtAuthorityInfoAccess();Y+=j(wr)}else De=="certificatePolicies"&&(Y+=R(this.getExtCertificatePolicies()))}}return Y+="signature algorithm: "+this.getSignatureAlgorithmName()+`
`,Y+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
`,Y},typeof e=="string"&&(e.indexOf("-----BEGIN")!=-1?this.readCertPEM(e):g.lang.String.isHex(e)&&this.readCertHex(e))}Ze.EXT_PARSER={};Ze.registExtParser=function(e,t){Ze.EXT_PARSER[e]=t};Ze.hex2dn=function(e,t){t===void 0&&(t=0);var r=new Ze,n=Fe.getTLV(e,t),i=r.getX500Name(e);return i.str};Ze.hex2rdn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="31")throw new Error("malformed RDN");for(var r=new Array,n=Fe.getChildIdx(e,t),i=0;i<n.length;i++)r.push(Ze.hex2attrTypeValue(e,n[i]));return r=r.map(function(u){return u.replace("+","\\+")}),r.join("+")};Ze.hex2attrTypeValue=function(e,t){var r=Fe,n=r.getV;if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var i=r.getChildIdx(e,t);i.length!==2||e.substr(i[0],2);var u=n(e,i[0]),s=g.asn1.ASN1Util.oidHexToInt(u),o=g.asn1.x509.OID.oid2atype(s),l=n(e,i[1]),f=oi(l);return o+"="+f};Ze.getPublicKeyFromCertHex=function(e){var t=new Ze;return t.readCertHex(e),t.getPublicKey()};Ze.getPublicKeyFromCertPEM=function(e){var t=new Ze;return t.readCertPEM(e),t.getPublicKey()};Ze.getPublicKeyInfoPropOfCertPEM=function(e){var t=Fe,r=t.getVbyList,n={},i,u,s;return n.algparam=null,i=new Ze,i.readCertPEM(e),u=i.getPublicKeyHex(),n.keyhex=r(u,0,[1],"03").substr(2),n.algoid=r(u,0,[0,0],"06"),n.algoid==="2a8648ce3d0201"&&(n.algparam=r(u,0,[0,1],"06")),n};Ze.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var N_=function(e){var t=g,r=t.lang.String.isHex,n=Fe,i=n.getV,u=n.getTLV,s=n.getVbyList,o=n.getTLVbyList,l=n.getTLVbyListEx,f=n.getIdxbyList,p=n.getIdxbyListEx,E=n.getChildIdx,d=new Ze;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this.parsed=null,this._setPos=function(){var h=f(this.hex,0,[0,0]),w=this.hex.substr(h,2);if(w=="02")this.posSigAlg=1;else if(w=="30")this.posSigAlg=0;else throw new Error("malformed 1st item of TBSCertList: "+w);var m=f(this.hex,0,[0,this.posSigAlg+3]),y=this.hex.substr(m,2);if(y=="17"||y=="18"){var A,C;A=f(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,A!=-1&&(C=this.hex.substr(A,2),C=="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 h=o(this.hex,0,[0,this.posSigAlg],"30");return d.getAlgorithmIdentifierName(h)},this.getIssuer=function(){return d.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return o(this.hex,0,[0,this.posSigAlg+1],"30")},this.getThisUpdate=function(){var h=s(this.hex,0,[0,this.posSigAlg+2]);return result=oi(h)},this.getNextUpdate=function(){var h=f(this.hex,0,[0,this.posSigAlg+3]),w=this.hex.substr(h,2);return w!="17"&&w!="18"?null:oi(i(this.hex,h))},this.getRevCertArray=function(){if(this.posRevCert==null)return null;for(var h=[],w=f(this.hex,0,[0,this.posRevCert]),m=E(this.hex,w),y=0;y<m.length;y++){var A=u(this.hex,m[y]);h.push(this.getRevCert(A))}return h},this.getRevCert=function(h){var w={},m=E(h,0);return w.sn={hex:s(h,0,[0],"02")},w.date=oi(s(h,0,[1])),m.length==3&&(w.ext=d.getExtParamArray(o(h,0,[2]))),w},this.findRevCert=function(h){var w=new Ze(h),m=w.getSerialNumberHex();return this.findRevCertBySN(m)},this.findRevCertBySN=function(h){if(this.parsed==null&&this.getParam(),this.parsed.revcert==null)return null;for(var w=this.parsed.revcert,m=0;m<w.length;m++)if(h==w[m].sn.hex)return w[m];return null},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(h){var w=this.getSignatureAlgorithmField(),m=this.getSignatureValueHex(),y=o(this.hex,0,[0],"30"),A=new g.crypto.Signature({alg:w});return A.init(h),A.updateHex(y),A.verify(m)},this.getParam=function(h){var w={},m=this.getVersion();m!=null&&(w.version=m),w.sigalg=this.getSignatureAlgorithmField(),w.issuer=this.getIssuer(),w.thisupdate=this.getThisUpdate();var y=this.getNextUpdate();y!=null&&(w.nextupdate=y);var A=this.getRevCertArray();A!=null&&(w.revcert=A);var C=p(this.hex,0,[0,"[0]"]);if(C!=-1){var S=l(this.hex,0,[0,"[0]",0]);w.ext=d.getExtParamArray(S)}return w.sighex=this.getSignatureValueHex(),this.parsed=w,typeof h=="object"&&(h.tbshex==!0&&(w.tbshex=o(this.hex,0,[0])),h.nodnarray==!0&&delete w.issuer.array),w},typeof e=="string"&&(r(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=Ar(e)),this._setPos())};(typeof g>"u"||!g)&&(g={});(typeof g.jws>"u"||!g.jws)&&(g.jws={});g.jws.JWS=function(){var e=g,t=e.jws.JWS,r=t.isSafeJSONString;this.parseJWS=function(n,i){if(!(this.parsedJWS!==void 0&&(i||this.parsedJWS.sigvalH!==void 0))){var u=n.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(u==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var s=u[1],o=u[2],l=u[3],f=s+"."+o;if(this.parsedJWS={},this.parsedJWS.headB64U=s,this.parsedJWS.payloadB64U=o,this.parsedJWS.sigvalB64U=l,this.parsedJWS.si=f,!i){var p=pr(l),E=ui(p,16);this.parsedJWS.sigvalH=p,this.parsedJWS.sigvalBI=E}var d=ss(s),h=ss(o);if(this.parsedJWS.headS=d,this.parsedJWS.payloadS=h,!r(d,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+d}}};g.jws.JWS.sign=function(e,t,r,n,i){var u=g,s=u.jws,o=s.JWS,l=o.readSafeJSONString,f=o.isSafeJSONString,p=u.crypto,E=p.ECDSA,d=p.Mac,h=p.Signature,w=JSON,m,y,A;if(typeof t!="string"&&typeof t!="object")throw"spHeader must be JSON string or object: "+t;if(typeof t=="object"&&(y=t,m=w.stringify(y)),typeof t=="string"){if(m=t,!f(m))throw"JWS Head is not safe JSON string: "+m;y=l(m)}if(A=r,typeof r=="object"&&(A=w.stringify(r)),(e==""||e==null)&&y.alg!==void 0&&(e=y.alg),e!=""&&e!=null&&y.alg===void 0&&(y.alg=e,m=w.stringify(y)),e!==y.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+y.alg;var C=null;if(o.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;C=o.jwsalg2sigalg[e];var S=qc(m),B=qc(A),I=S+"."+B,M="";if(C.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var q=new d({alg:C,prov:"cryptojs",pass:n});q.updateString(I),M=q.doFinal()}else if(C.indexOf("withECDSA")!=-1){var b=new h({alg:C});b.init(n,i),b.updateString(I);var R=b.sign();M=g.crypto.ECDSA.asn1SigToConcatSig(R)}else if(C!="none"){var b=new h({alg:C});b.init(n,i),b.updateString(I),M=b.sign()}var L=Kr(M);return I+"."+L};g.jws.JWS.verify=function(e,t,r){var n=g,i=n.jws,u=i.JWS,s=u.readSafeJSONString,o=n.crypto,l=o.ECDSA,f=o.Mac,p=o.Signature,E;if(typeof ut!==void 0&&(E=ut),!zp(e))return!1;var d=e.split(".");if(d.length!==3)return!1;var h=d[0],w=d[1],m=h+"."+w,y=pr(d[2]),A=s(ss(d[0])),C=null,S=null;if(A.alg===void 0)throw"algorithm not specified in header";if(C=A.alg,S=C.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var B=":"+r.join(":")+":";if(B.indexOf(":"+C+":")==-1)throw"algorithm '"+C+"' not accepted in the list"}if(C!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=Ft.getKey(t)),(S=="RS"||S=="PS")&&!(t instanceof E))throw"key shall be a RSAKey obj for RS* and PS* algs";if(S=="ES"&&!(t instanceof l))throw"key shall be a ECDSA obj for ES* algs";C=="none";var I=null;if(u.jwsalg2sigalg[A.alg]===void 0)throw"unsupported alg name: "+C;if(I=u.jwsalg2sigalg[C],I=="none")throw"not supported";if(I.substr(0,4)=="Hmac"){var M=null;if(t===void 0)throw"hexadecimal key shall be specified for HMAC";var q=new f({alg:I,pass:t});return q.updateString(m),M=q.doFinal(),y==M}else if(I.indexOf("withECDSA")!=-1){var b=null;try{b=l.concatSigToASN1Sig(y)}catch{return!1}var R=new p({alg:I});return R.init(t),R.updateString(m),R.verify(b)}else{var R=new p({alg:I});return R.init(t),R.updateString(m),R.verify(y)}};g.jws.JWS.parse=function(e){var t=e.split("."),r={},n,i,u;if(t.length!=2&&t.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return n=t[0],i=t[1],t.length==3&&(u=t[2]),r.headerObj=g.jws.JWS.readSafeJSONString(ss(n)),r.payloadObj=g.jws.JWS.readSafeJSONString(ss(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=ss(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),u!==void 0&&(r.sigHex=pr(u)),r};g.jws.JWS.verifyJWT=function(e,t,r){var n=g,i=n.jws,u=i.JWS,s=u.readSafeJSONString,o=u.inArray,l=u.includedArray;if(!zp(e))return!1;var f=e.split(".");if(f.length!=3)return!1;var p=f[0],E=f[1],d=p+"."+E,h=pr(f[2]),w=s(ss(p)),m=s(ss(E));if(w.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!o(w.alg,r.alg)||m.iss!==void 0&&typeof r.iss=="object"&&!o(m.iss,r.iss)||m.sub!==void 0&&typeof r.sub=="object"&&!o(m.sub,r.sub))return!1;if(m.aud!==void 0&&typeof r.aud=="object"){if(typeof m.aud=="string"){if(!o(m.aud,r.aud))return!1}else if(typeof m.aud=="object"&&!l(m.aud,r.aud))return!1}var y=i.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(y=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(m.exp!==void 0&&typeof m.exp=="number"&&m.exp+r.gracePeriod<y||m.nbf!==void 0&&typeof m.nbf=="number"&&y<m.nbf-r.gracePeriod||m.iat!==void 0&&typeof m.iat=="number"&&y<m.iat-r.gracePeriod||m.jti!==void 0&&r.jti!==void 0&&m.jti!==r.jti||!u.verify(e,t,r.alg))};g.jws.JWS.includedArray=function(e,t){var r=g.jws.JWS.inArray;if(e===null||typeof e!="object"||typeof e.length!="number")return!1;for(var n=0;n<e.length;n++)if(!r(e[n],t))return!1;return!0};g.jws.JWS.inArray=function(e,t){if(t===null||typeof t!="object"||typeof t.length!="number")return!1;for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1};g.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"};g.jws.JWS.isSafeJSONString=function(e,t,r){var n=null;try{return n=bv(e),typeof n!="object"||n.constructor===Array?0:(t&&(t[r]=n),1)}catch{return 0}};g.jws.JWS.readSafeJSONString=function(e){var t=null;try{return t=bv(e),typeof t!="object"||t.constructor===Array?null:t}catch{return null}};g.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]};g.jws.JWS.getJWKthumbprint=function(e){if(e.kty!=="RSA"&&e.kty!=="EC"&&e.kty!=="oct")throw"unsupported algorithm for JWK Thumprint";var t="{";if(e.kty==="RSA"){if(typeof e.n!="string"||typeof e.e!="string")throw"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"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"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var r=$s(t),n=g.crypto.Util.hashHex(r,"sha256"),i=Kr(n);return i};g.jws.IntDate={};g.jws.IntDate.get=function(e){var t=g.jws.IntDate,r=t.getNow,n=t.getZulu;if(e=="now")return r();if(e=="now + 1hour")return r()+60*60;if(e=="now + 1day")return r()+60*60*24;if(e=="now + 1month")return r()+60*60*24*30;if(e=="now + 1year")return r()+60*60*24*365;if(e.match(/Z$/))return n(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e};g.jws.IntDate.getZulu=function(e){return $v(e)};g.jws.IntDate.getNow=function(){var e=~~(new Date/1e3);return e};g.jws.IntDate.intDate2UTCString=function(e){var t=new Date(e*1e3);return t.toUTCString()};g.jws.IntDate.intDate2Zulu=function(e){var t=new Date(e*1e3),r=("0000"+t.getUTCFullYear()).slice(-4),n=("00"+(t.getUTCMonth()+1)).slice(-2),i=("00"+t.getUTCDate()).slice(-2),u=("00"+t.getUTCHours()).slice(-2),s=("00"+t.getUTCMinutes()).slice(-2),o=("00"+t.getUTCSeconds()).slice(-2);return r+n+i+u+s+o+"Z"};(typeof g>"u"||!g)&&(g={});(typeof g.jws>"u"||!g.jws)&&(g.jws={});g.jws.JWSJS=function(){var e=g,t=e.jws,r=t.JWS,n=r.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(i){this.init();var u=i.split(".");if(u.length!=3)throw"malformed input JWS";this.aHeader.push(u[0]),this.sPayload=u[1],this.aSignature.push(u[2])},this.addSignature=function(i,u,s,o){if(this.sPayload===void 0||this.sPayload===null)throw"there's no JSON-JS signature to add.";var l=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var f=g.jws.JWS.sign(i,u,this.sPayload,s,o),p=f.split("."),E=p[0],d=p[2];this.aHeader.push(p[0]),this.aSignature.push(p[2])}catch(h){throw this.aHeader.length>l&&this.aHeader.pop(),this.aSignature.length>l&&this.aSignature.pop(),"addSignature failed: "+h}},this.verifyAll=function(i){if(this.aHeader.length!==i.length||this.aSignature.length!==i.length)return!1;for(var u=0;u<i.length;u++){var s=i[u];if(s.length!==2)return!1;var o=this.verifyNth(u,s[0],s[1]);if(o===!1)return!1}return!0},this.verifyNth=function(i,u,s){if(this.aHeader.length<=i||this.aSignature.length<=i)return!1;var o=this.aHeader[i],l=this.aSignature[i],f=o+"."+this.sPayload+"."+l,p=!1;try{p=r.verify(f,u,s)}catch{return!1}return p},this.readJWSJS=function(i){if(typeof i=="string"){var u=n(i);if(u==null)throw"argument is not safe JSON object string";this.aHeader=u.headers,this.sPayload=u.payload,this.aSignature=u.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}};be.SecureRandom=Go;be.rng_seed_time=Mp;be.BigInteger=ee;be.RSAKey=ut;be.ECDSA=g.crypto.ECDSA;be.DSA=g.crypto.DSA;be.Signature=g.crypto.Signature;be.MessageDigest=g.crypto.MessageDigest;be.Mac=g.crypto.Mac;be.KEYUTIL=Ft;be.ASN1HEX=Fe;be.X509=Ze;be.X509CRL=N_;be.CryptoJS=Ie;be.b64tohex=qo;be.b64toBA=Cv;be.ECFieldElementFp=Vr;be.ECPointFp=Ht;be.ECCurveFp=du;be.stoBA=_v;be.BAtos=Iv;be.BAtohex=jf;be.stohex=ai;be.stob64=g_;be.stob64u=m_;be.b64utos=v_;be.b64tob64u=Mo;be.b64utob64=Vc;be.hex2b64=pu;be.hextob64u=Kr;be.b64utohex=pr;be.utf8tob64u=qc;be.b64utoutf8=ss;be.utf8tob64=E_;be.b64toutf8=A_;be.utf8tohex=Mf;be.hextoutf8=Wt;be.hextorstr=oi;be.rstrtohex=$s;be.hextob64=qp;be.hextob64nl=y_;be.b64nltohex=Bv;be.hextopem=$n;be.pemtohex=Ar;be.hextoArrayBuffer=S_;be.ArrayBuffertohex=b_;be.zulutomsec=Kp;be.msectozulu=__;be.zulutosec=$v;be.zulutodate=I_;be.datetozulu=B_;be.uricmptohex=Kf;be.hextouricmp=Vf;be.ipv6tohex=xp;be.hextoipv6=kp;be.hextoip=xf;be.iptohex=Vp;be.ucs2hextoutf8=Gp;be.encodeURIComponentAll=Gf;be.newline_toUnix=$_;be.newline_toDos=P_;be.hextoposhex=Lp;be.intarystrtohex=R_;be.strdiffidx=T_;be.oidtohex=Tv;be.hextooid=zf;be.strpad=kf;be.bitstrtoint=Nv;be.inttobitstr=xv;be.bitstrtobinstr=kv;be.binstrtobitstr=O_;be.isBase64URLDot=zp;be.namearraytobinstr=Lf;be.extendClass=de;be.foldnl=qf;be.b64topem=F_;be.pemtob64=D_;be.timeogen=Pv;be.aryval=nr;be.inttohex=Ov;be.twoscompl=Gc;be.KJUR=g;be.crypto=g.crypto;be.asn1=g.asn1;be.jws=g.jws;be.lang=g.lang;be.VERSION=K3;be.VERSION_FULL=V3});var qa=Se((UT,Ma)=>{"use strict";function qv(e){return typeof e>"u"||e===null}function k_(e){return typeof e=="object"&&e!==null}function L_(e){return Array.isArray(e)?e:qv(e)?[]:[e]}function U_(e,t){var r,n,i,u;if(t)for(u=Object.keys(t),r=0,n=u.length;r<n;r+=1)i=u[r],e[i]=t[i];return e}function H_(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function j_(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}Ma.exports.isNothing=qv;Ma.exports.isObject=k_;Ma.exports.toArray=L_;Ma.exports.repeat=H_;Ma.exports.isNegativeZero=j_;Ma.exports.extend=U_});var zo=Se((HT,Kv)=>{"use strict";function zc(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}zc.prototype=Object.create(Error.prototype);zc.prototype.constructor=zc;zc.prototype.toString=function(t){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!t&&this.mark&&(r+=" "+this.mark.toString()),r};Kv.exports=zc});var zv=Se((jT,Gv)=>{"use strict";var Vv=qa();function Wp(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}Wp.prototype.getSnippet=function(t,r){var n,i,u,s,o;if(!this.buffer)return null;for(t=t||4,r=r||75,n="",i=this.position;i>0&&`\0\r
\x85\u2028\u2029`.indexOf(this.buffer.charAt(i-1))===-1;)if(i-=1,this.position-i>r/2-1){n=" ... ",i+=5;break}for(u="",s=this.position;s<this.buffer.length&&`\0\r
\x85\u2028\u2029`.indexOf(this.buffer.charAt(s))===-1;)if(s+=1,s-this.position>r/2-1){u=" ... ",s-=5;break}return o=this.buffer.slice(i,s),Vv.repeat(" ",t)+n+o+u+`
`+Vv.repeat(" ",t+this.position-i+n.length)+"^"};Wp.prototype.toString=function(t){var r,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),t||(r=this.getSnippet(),r&&(n+=`:
`+r)),n};Gv.exports=Wp});var Gr=Se((MT,Wv)=>{"use strict";var Yv=zo(),M_=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],q_=["scalar","sequence","mapping"];function K_(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function V_(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(M_.indexOf(r)===-1)throw new Yv('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=K_(t.styleAliases||null),q_.indexOf(this.kind)===-1)throw new Yv('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}Wv.exports=V_});var Ka=Se((qT,Xv)=>{"use strict";var Jv=qa(),Yf=zo(),G_=Gr();function Jp(e,t,r){var n=[];return e.include.forEach(function(i){r=Jp(i,t,r)}),e[t].forEach(function(i){r.forEach(function(u,s){u.tag===i.tag&&u.kind===i.kind&&n.push(s)}),r.push(i)}),r.filter(function(i,u){return n.indexOf(u)===-1})}function z_(){var e={scalar:{},sequence:{},mapping:{},fallback:{}},t,r;function n(i){e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(n);return e}function Yo(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(t){if(t.loadKind&&t.loadKind!=="scalar")throw new Yf("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=Jp(this,"implicit",[]),this.compiledExplicit=Jp(this,"explicit",[]),this.compiledTypeMap=z_(this.compiledImplicit,this.compiledExplicit)}Yo.DEFAULT=null;Yo.create=function(){var t,r;switch(arguments.length){case 1:t=Yo.DEFAULT,r=arguments[0];break;case 2:t=arguments[0],r=arguments[1];break;default:throw new Yf("Wrong number of arguments for Schema.create function")}if(t=Jv.toArray(t),r=Jv.toArray(r),!t.every(function(n){return n instanceof Yo}))throw new Yf("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!r.every(function(n){return n instanceof G_}))throw new Yf("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new Yo({include:t,explicit:r})};Xv.exports=Yo});var Qv=Se((KT,Zv)=>{"use strict";var Y_=Gr();Zv.exports=new Y_("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}})});var t2=Se((VT,e2)=>{"use strict";var W_=Gr();e2.exports=new W_("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}})});var n2=Se((GT,r2)=>{"use strict";var J_=Gr();r2.exports=new J_("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}})});var Wf=Se((zT,i2)=>{"use strict";var X_=Ka();i2.exports=new X_({explicit:[Qv(),t2(),n2()]})});var u2=Se((YT,s2)=>{"use strict";var Z_=Gr();function Q_(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function e8(){return null}function t8(e){return e===null}s2.exports=new Z_("tag:yaml.org,2002:null",{kind:"scalar",resolve:Q_,construct:e8,predicate:t8,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var o2=Se((WT,a2)=>{"use strict";var r8=Gr();function n8(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function i8(e){return e==="true"||e==="True"||e==="TRUE"}function s8(e){return Object.prototype.toString.call(e)==="[object Boolean]"}a2.exports=new r8("tag:yaml.org,2002:bool",{kind:"scalar",resolve:n8,construct:i8,predicate:s8,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})});var l2=Se((JT,c2)=>{"use strict";var u8=qa(),a8=Gr();function o8(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function c8(e){return 48<=e&&e<=55}function l8(e){return 48<=e&&e<=57}function f8(e){if(e===null)return!1;var t=e.length,r=0,n=!1,i;if(!t)return!1;if(i=e[r],(i==="-"||i==="+")&&(i=e[++r]),i==="0"){if(r+1===t)return!0;if(i=e[++r],i==="b"){for(r++;r<t;r++)if(i=e[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(r++;r<t;r++)if(i=e[r],i!=="_"){if(!o8(e.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}for(;r<t;r++)if(i=e[r],i!=="_"){if(!c8(e.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="_")return!1;for(;r<t;r++)if(i=e[r],i!=="_"){if(i===":")break;if(!l8(e.charCodeAt(r)))return!1;n=!0}return!n||i==="_"?!1:i!==":"?!0:/^(:[0-5]?[0-9])+$/.test(e.slice(r))}function h8(e){var t=e,r=1,n,i,u=[];return t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),n=t[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),t=t.slice(1),n=t[0]),t==="0"?0:n==="0"?t[1]==="b"?r*parseInt(t.slice(2),2):t[1]==="x"?r*parseInt(t,16):r*parseInt(t,8):t.indexOf(":")!==-1?(t.split(":").forEach(function(s){u.unshift(parseInt(s,10))}),t=0,i=1,u.forEach(function(s){t+=s*i,i*=60}),r*t):r*parseInt(t,10)}function p8(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!u8.isNegativeZero(e)}c2.exports=new a8("tag:yaml.org,2002:int",{kind:"scalar",resolve:f8,construct:h8,predicate:p8,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var p2=Se((XT,h2)=>{"use strict";var f2=qa(),d8=Gr(),g8=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function m8(e){return!(e===null||!g8.test(e)||e[e.length-1]==="_")}function v8(e){var t,r,n,i;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(u){i.unshift(parseFloat(u,10))}),t=0,n=1,i.forEach(function(u){t+=u*n,n*=60}),r*t):r*parseFloat(t,10)}var E8=/^[-+]?[0-9]+e/;function A8(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(f2.isNegativeZero(e))return"-0.0";return r=e.toString(10),E8.test(r)?r.replace("e",".e"):r}function w8(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||f2.isNegativeZero(e))}h2.exports=new d8("tag:yaml.org,2002:float",{kind:"scalar",resolve:m8,construct:v8,predicate:w8,represent:A8,defaultStyle:"lowercase"})});var Xp=Se((ZT,d2)=>{"use strict";var C8=Ka();d2.exports=new C8({include:[Wf()],implicit:[u2(),o2(),l2(),p2()]})});var Zp=Se((QT,g2)=>{"use strict";var y8=Ka();g2.exports=new y8({include:[Xp()]})});var A2=Se((eO,E2)=>{"use strict";var F8=Gr(),m2=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),v2=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function D8(e){return e===null?!1:m2.exec(e)!==null||v2.exec(e)!==null}function S8(e){var t,r,n,i,u,s,o,l=0,f=null,p,E,d;if(t=m2.exec(e),t===null&&(t=v2.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(r,n,i));if(u=+t[4],s=+t[5],o=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(p=+t[10],E=+(t[11]||0),f=(p*60+E)*6e4,t[9]==="-"&&(f=-f)),d=new Date(Date.UTC(r,n,i,u,s,o,l)),f&&d.setTime(d.getTime()-f),d}function b8(e){return e.toISOString()}E2.exports=new F8("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:D8,construct:S8,instanceOf:Date,represent:b8})});var C2=Se((tO,w2)=>{"use strict";var _8=Gr();function I8(e){return e==="<<"||e===null}w2.exports=new _8("tag:yaml.org,2002:merge",{kind:"scalar",resolve:I8})});var D2=Se((rO,F2)=>{"use strict";var Va;try{y2=Ba,Va=y2("buffer").Buffer}catch{}var y2,B8=Gr(),Qp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;function $8(e){if(e===null)return!1;var t,r,n=0,i=e.length,u=Qp;for(r=0;r<i;r++)if(t=u.indexOf(e.charAt(r)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}function P8(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,u=Qp,s=0,o=[];for(t=0;t<i;t++)t%4===0&&t&&(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)),s=s<<6|u.indexOf(n.charAt(t));return r=i%4*6,r===0?(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)):r===18?(o.push(s>>10&255),o.push(s>>2&255)):r===12&&o.push(s>>4&255),Va?Va.from?Va.from(o):new Va(o):o}function R8(e){var t="",r=0,n,i,u=e.length,s=Qp;for(n=0;n<u;n++)n%3===0&&n&&(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[n];return i=u%3,i===0?(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]):i===2?(t+=s[r>>10&63],t+=s[r>>4&63],t+=s[r<<2&63],t+=s[64]):i===1&&(t+=s[r>>2&63],t+=s[r<<4&63],t+=s[64],t+=s[64]),t}function T8(e){return Va&&Va.isBuffer(e)}F2.exports=new B8("tag:yaml.org,2002:binary",{kind:"scalar",resolve:$8,construct:P8,predicate:T8,represent:R8})});var b2=Se((iO,S2)=>{"use strict";var O8=Gr(),N8=Object.prototype.hasOwnProperty,x8=Object.prototype.toString;function k8(e){if(e===null)return!0;var t=[],r,n,i,u,s,o=e;for(r=0,n=o.length;r<n;r+=1){if(i=o[r],s=!1,x8.call(i)!=="[object Object]")return!1;for(u in i)if(N8.call(i,u))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(u)===-1)t.push(u);else return!1}return!0}function L8(e){return e!==null?e:[]}S2.exports=new O8("tag:yaml.org,2002:omap",{kind:"sequence",resolve:k8,construct:L8})});var I2=Se((sO,_2)=>{"use strict";var U8=Gr(),H8=Object.prototype.toString;function j8(e){if(e===null)return!0;var t,r,n,i,u,s=e;for(u=new Array(s.length),t=0,r=s.length;t<r;t+=1){if(n=s[t],H8.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;u[t]=[i[0],n[i[0]]]}return!0}function M8(e){if(e===null)return[];var t,r,n,i,u,s=e;for(u=new Array(s.length),t=0,r=s.length;t<r;t+=1)n=s[t],i=Object.keys(n),u[t]=[i[0],n[i[0]]];return u}_2.exports=new U8("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:j8,construct:M8})});var $2=Se((uO,B2)=>{"use strict";var q8=Gr(),K8=Object.prototype.hasOwnProperty;function V8(e){if(e===null)return!0;var t,r=e;for(t in r)if(K8.call(r,t)&&r[t]!==null)return!1;return!0}function G8(e){return e!==null?e:{}}B2.exports=new q8("tag:yaml.org,2002:set",{kind:"mapping",resolve:V8,construct:G8})});var Wo=Se((aO,P2)=>{"use strict";var z8=Ka();P2.exports=new z8({include:[Zp()],implicit:[A2(),C2()],explicit:[D2(),b2(),I2(),$2()]})});var T2=Se((oO,R2)=>{"use strict";var Y8=Gr();function W8(){return!0}function J8(){}function X8(){return""}function Z8(e){return typeof e>"u"}R2.exports=new Y8("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:W8,construct:J8,predicate:Z8,represent:X8})});var N2=Se((cO,O2)=>{"use strict";var Q8=Gr();function eI(e){if(e===null||e.length===0)return!1;var t=e,r=/\/([gim]*)$/.exec(e),n="";return!(t[0]==="/"&&(r&&(n=r[1]),n.length>3||t[t.length-n.length-1]!=="/"))}function tI(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return t[0]==="/"&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)}function rI(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}function nI(e){return Object.prototype.toString.call(e)==="[object RegExp]"}O2.exports=new Q8("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:eI,construct:tI,predicate:nI,represent:rI})});var L2=Se((lO,k2)=>{"use strict";var Jf;try{x2=Ba,Jf=x2("esprima")}catch{typeof window<"u"&&(Jf=window.esprima)}var x2,iI=Gr();function sI(e){if(e===null)return!1;try{var t="("+e+")",r=Jf.parse(t,{range:!0});return!(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function uI(e){var t="("+e+")",r=Jf.parse(t,{range:!0}),n=[],i;if(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(u){n.push(u.name)}),i=r.body[0].expression.body.range,r.body[0].expression.body.type==="BlockStatement"?new Function(n,t.slice(i[0]+1,i[1]-1)):new Function(n,"return "+t.slice(i[0],i[1]))}function aI(e){return e.toString()}function oI(e){return Object.prototype.toString.call(e)==="[object Function]"}k2.exports=new iI("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:sI,construct:uI,predicate:oI,represent:aI})});var Yc=Se((hO,H2)=>{"use strict";var U2=Ka();H2.exports=U2.DEFAULT=new U2({include:[Wo()],explicit:[T2(),N2(),L2()]})});var sE=Se((pO,Wc)=>{"use strict";var gu=qa(),z2=zo(),cI=zv(),Y2=Wo(),lI=Yc(),ta=Object.prototype.hasOwnProperty,Xf=1,W2=2,J2=3,Zf=4,ed=1,fI=2,j2=3,hI=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,pI=/[\x85\u2028\u2029]/,dI=/[,\[\]\{\}]/,X2=/^(?:!|!!|![a-z\-]+!)$/i,Z2=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function M2(e){return Object.prototype.toString.call(e)}function Ps(e){return e===10||e===13}function za(e){return e===9||e===32}function ci(e){return e===9||e===32||e===10||e===13}function Jo(e){return e===44||e===91||e===93||e===123||e===125}function gI(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function mI(e){return e===120?2:e===117?4:e===85?8:0}function vI(e){return 48<=e&&e<=57?e-48:-1}function q2(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function EI(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var Q2=new Array(256),eE=new Array(256);for(Ga=0;Ga<256;Ga++)Q2[Ga]=q2(Ga)?1:0,eE[Ga]=q2(Ga);var Ga;function AI(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||lI,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function tE(e,t){return new z2(t,new cI(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function tt(e,t){throw tE(e,t)}function Qf(e,t){e.onWarning&&e.onWarning.call(null,tE(e,t))}var K2={YAML:function(t,r,n){var i,u,s;t.version!==null&&tt(t,"duplication of %YAML directive"),n.length!==1&&tt(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&tt(t,"ill-formed argument of the YAML directive"),u=parseInt(i[1],10),s=parseInt(i[2],10),u!==1&&tt(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&Qf(t,"unsupported YAML version of the document")},TAG:function(t,r,n){var i,u;n.length!==2&&tt(t,"TAG directive accepts exactly two arguments"),i=n[0],u=n[1],X2.test(i)||tt(t,"ill-formed tag handle (first argument) of the TAG directive"),ta.call(t.tagMap,i)&&tt(t,'there is a previously declared suffix for "'+i+'" tag handle'),Z2.test(u)||tt(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[i]=u}};function ea(e,t,r,n){var i,u,s,o;if(t<r){if(o=e.input.slice(t,r),n)for(i=0,u=o.length;i<u;i+=1)s=o.charCodeAt(i),s===9||32<=s&&s<=1114111||tt(e,"expected valid JSON character");else hI.test(o)&&tt(e,"the stream contains non-printable characters");e.result+=o}}function V2(e,t,r,n){var i,u,s,o;for(gu.isObject(r)||tt(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),s=0,o=i.length;s<o;s+=1)u=i[s],ta.call(t,u)||(t[u]=r[u],n[u]=!0)}function Xo(e,t,r,n,i,u,s,o){var l,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),l=0,f=i.length;l<f;l+=1)Array.isArray(i[l])&&tt(e,"nested arrays are not supported inside keys"),typeof i=="object"&&M2(i[l])==="[object Object]"&&(i[l]="[object Object]");if(typeof i=="object"&&M2(i)==="[object Object]"&&(i="[object Object]"),i=String(i),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(u))for(l=0,f=u.length;l<f;l+=1)V2(e,t,u[l],r);else V2(e,t,u,r);else!e.json&&!ta.call(r,i)&&ta.call(t,i)&&(e.line=s||e.line,e.position=o||e.position,tt(e,"duplicated mapping key")),t[i]=u,delete r[i];return t}function td(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):tt(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function Hr(e,t,r){for(var n=0,i=e.input.charCodeAt(e.position);i!==0;){for(;za(i);)i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(Ps(i))for(td(e),i=e.input.charCodeAt(e.position),n++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return r!==-1&&n!==0&&e.lineIndent<r&&Qf(e,"deficient indentation"),n}function eh(e){var t=e.position,r;return r=e.input.charCodeAt(t),!!((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)&&(t+=3,r=e.input.charCodeAt(t),r===0||ci(r)))}function rd(e,t){t===1?e.result+=" ":t>1&&(e.result+=gu.repeat(`
`,t-1))}function wI(e,t,r){var n,i,u,s,o,l,f,p,E=e.kind,d=e.result,h;if(h=e.input.charCodeAt(e.position),ci(h)||Jo(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),ci(i)||r&&Jo(i)))return!1;for(e.kind="scalar",e.result="",u=s=e.position,o=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),ci(i)||r&&Jo(i))break}else if(h===35){if(n=e.input.charCodeAt(e.position-1),ci(n))break}else{if(e.position===e.lineStart&&eh(e)||r&&Jo(h))break;if(Ps(h))if(l=e.line,f=e.lineStart,p=e.lineIndent,Hr(e,!1,-1),e.lineIndent>=t){o=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=f,e.lineIndent=p;break}}o&&(ea(e,u,s,!1),rd(e,e.line-l),u=s=e.position,o=!1),za(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position)}return ea(e,u,s,!1),e.result?!0:(e.kind=E,e.result=d,!1)}function CI(e,t){var r,n,i;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(ea(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,i=e.position;else return!0;else Ps(r)?(ea(e,n,i,!0),rd(e,Hr(e,!1,t)),n=i=e.position):e.position===e.lineStart&&eh(e)?tt(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);tt(e,"unexpected end of the stream within a single quoted scalar")}function yI(e,t){var r,n,i,u,s,o;if(o=e.input.charCodeAt(e.position),o!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(o=e.input.charCodeAt(e.position))!==0;){if(o===34)return ea(e,r,e.position,!0),e.position++,!0;if(o===92){if(ea(e,r,e.position,!0),o=e.input.charCodeAt(++e.position),Ps(o))Hr(e,!1,t);else if(o<256&&Q2[o])e.result+=eE[o],e.position++;else if((s=mI(o))>0){for(i=s,u=0;i>0;i--)o=e.input.charCodeAt(++e.position),(s=gI(o))>=0?u=(u<<4)+s:tt(e,"expected hexadecimal character");e.result+=EI(u),e.position++}else tt(e,"unknown escape sequence");r=n=e.position}else Ps(o)?(ea(e,r,n,!0),rd(e,Hr(e,!1,t)),r=n=e.position):e.position===e.lineStart&&eh(e)?tt(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}tt(e,"unexpected end of the stream within a double quoted scalar")}function FI(e,t){var r=!0,n,i=e.tag,u,s=e.anchor,o,l,f,p,E,d={},h,w,m,y;if(y=e.input.charCodeAt(e.position),y===91)l=93,E=!1,u=[];else if(y===123)l=125,E=!0,u={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),y=e.input.charCodeAt(++e.position);y!==0;){if(Hr(e,!0,t),y=e.input.charCodeAt(e.position),y===l)return e.position++,e.tag=i,e.anchor=s,e.kind=E?"mapping":"sequence",e.result=u,!0;r||tt(e,"missed comma between flow collection entries"),w=h=m=null,f=p=!1,y===63&&(o=e.input.charCodeAt(e.position+1),ci(o)&&(f=p=!0,e.position++,Hr(e,!0,t))),n=e.line,Zo(e,t,Xf,!1,!0),w=e.tag,h=e.result,Hr(e,!0,t),y=e.input.charCodeAt(e.position),(p||e.line===n)&&y===58&&(f=!0,y=e.input.charCodeAt(++e.position),Hr(e,!0,t),Zo(e,t,Xf,!1,!0),m=e.result),E?Xo(e,u,d,w,h,m):f?u.push(Xo(e,null,d,w,h,m)):u.push(h),Hr(e,!0,t),y=e.input.charCodeAt(e.position),y===44?(r=!0,y=e.input.charCodeAt(++e.position)):r=!1}tt(e,"unexpected end of the stream within a flow collection")}function DI(e,t){var r,n,i=ed,u=!1,s=!1,o=t,l=0,f=!1,p,E;if(E=e.input.charCodeAt(e.position),E===124)n=!1;else if(E===62)n=!0;else return!1;for(e.kind="scalar",e.result="";E!==0;)if(E=e.input.charCodeAt(++e.position),E===43||E===45)ed===i?i=E===43?j2:fI:tt(e,"repeat of a chomping mode identifier");else if((p=vI(E))>=0)p===0?tt(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?tt(e,"repeat of an indentation width identifier"):(o=t+p-1,s=!0);else break;if(za(E)){do E=e.input.charCodeAt(++e.position);while(za(E));if(E===35)do E=e.input.charCodeAt(++e.position);while(!Ps(E)&&E!==0)}for(;E!==0;){for(td(e),e.lineIndent=0,E=e.input.charCodeAt(e.position);(!s||e.lineIndent<o)&&E===32;)e.lineIndent++,E=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>o&&(o=e.lineIndent),Ps(E)){l++;continue}if(e.lineIndent<o){i===j2?e.result+=gu.repeat(`
`,u?1+l:l):i===ed&&u&&(e.result+=`
`);break}for(n?za(E)?(f=!0,e.result+=gu.repeat(`
`,u?1+l:l)):f?(f=!1,e.result+=gu.repeat(`
`,l+1)):l===0?u&&(e.result+=" "):e.result+=gu.repeat(`
`,l):e.result+=gu.repeat(`
`,u?1+l:l),u=!0,s=!0,l=0,r=e.position;!Ps(E)&&E!==0;)E=e.input.charCodeAt(++e.position);ea(e,r,e.position,!1)}return!0}function G2(e,t){var r,n=e.tag,i=e.anchor,u=[],s,o=!1,l;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),l=e.input.charCodeAt(e.position);l!==0&&!(l!==45||(s=e.input.charCodeAt(e.position+1),!ci(s)));){if(o=!0,e.position++,Hr(e,!0,-1)&&e.lineIndent<=t){u.push(null),l=e.input.charCodeAt(e.position);continue}if(r=e.line,Zo(e,t,J2,!1,!0),u.push(e.result),Hr(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&l!==0)tt(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return o?(e.tag=n,e.anchor=i,e.kind="sequence",e.result=u,!0):!1}function SI(e,t,r){var n,i,u,s,o=e.tag,l=e.anchor,f={},p={},E=null,d=null,h=null,w=!1,m=!1,y;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),y=e.input.charCodeAt(e.position);y!==0;){if(n=e.input.charCodeAt(e.position+1),u=e.line,s=e.position,(y===63||y===58)&&ci(n))y===63?(w&&(Xo(e,f,p,E,d,null),E=d=h=null),m=!0,w=!0,i=!0):w?(w=!1,i=!0):tt(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,y=n;else if(Zo(e,r,W2,!1,!0))if(e.line===u){for(y=e.input.charCodeAt(e.position);za(y);)y=e.input.charCodeAt(++e.position);if(y===58)y=e.input.charCodeAt(++e.position),ci(y)||tt(e,"a whitespace character is expected after the key-value separator within a block mapping"),w&&(Xo(e,f,p,E,d,null),E=d=h=null),m=!0,w=!1,i=!1,E=e.tag,d=e.result;else if(m)tt(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=o,e.anchor=l,!0}else if(m)tt(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=o,e.anchor=l,!0;else break;if((e.line===u||e.lineIndent>t)&&(Zo(e,t,Zf,!0,i)&&(w?d=e.result:h=e.result),w||(Xo(e,f,p,E,d,h,u,s),E=d=h=null),Hr(e,!0,-1),y=e.input.charCodeAt(e.position)),e.lineIndent>t&&y!==0)tt(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return w&&Xo(e,f,p,E,d,null),m&&(e.tag=o,e.anchor=l,e.kind="mapping",e.result=f),m}function bI(e){var t,r=!1,n=!1,i,u,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&tt(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(r=!0,s=e.input.charCodeAt(++e.position)):s===33?(n=!0,i="!!",s=e.input.charCodeAt(++e.position)):i="!",t=e.position,r){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(u=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):tt(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!ci(s);)s===33&&(n?tt(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),X2.test(i)||tt(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);u=e.input.slice(t,e.position),dI.test(u)&&tt(e,"tag suffix cannot contain flow indicator characters")}return u&&!Z2.test(u)&&tt(e,"tag name cannot contain such characters: "+u),r?e.tag=u:ta.call(e.tagMap,i)?e.tag=e.tagMap[i]+u:i==="!"?e.tag="!"+u:i==="!!"?e.tag="tag:yaml.org,2002:"+u:tt(e,'undeclared tag handle "'+i+'"'),!0}function _I(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&tt(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!ci(r)&&!Jo(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&tt(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function II(e){var t,r,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!ci(n)&&!Jo(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&tt(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),ta.call(e.anchorMap,r)||tt(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],Hr(e,!0,-1),!0}function Zo(e,t,r,n,i){var u,s,o,l=1,f=!1,p=!1,E,d,h,w,m;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,u=s=o=Zf===r||J2===r,n&&Hr(e,!0,-1)&&(f=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;bI(e)||_I(e);)Hr(e,!0,-1)?(f=!0,o=u,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):o=!1;if(o&&(o=f||i),(l===1||Zf===r)&&(Xf===r||W2===r?w=t:w=t+1,m=e.position-e.lineStart,l===1?o&&(G2(e,m)||SI(e,m,w))||FI(e,w)?p=!0:(s&&DI(e,w)||CI(e,w)||yI(e,w)?p=!0:II(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&tt(e,"alias node should not have any properties")):wI(e,w,Xf===r)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(p=o&&G2(e,m))),e.tag!==null&&e.tag!=="!")if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&tt(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),E=0,d=e.implicitTypes.length;E<d;E+=1)if(h=e.implicitTypes[E],h.resolve(e.result)){e.result=h.construct(e.result),e.tag=h.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else ta.call(e.typeMap[e.kind||"fallback"],e.tag)?(h=e.typeMap[e.kind||"fallback"][e.tag],e.result!==null&&h.kind!==e.kind&&tt(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+h.kind+'", not "'+e.kind+'"'),h.resolve(e.result)?(e.result=h.construct(e.result),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):tt(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):tt(e,"unknown tag !<"+e.tag+">");return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||p}function BI(e){var t=e.position,r,n,i,u=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};(s=e.input.charCodeAt(e.position))!==0&&(Hr(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(u=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!ci(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),i=[],n.length<1&&tt(e,"directive name must not be less than one character in length");s!==0;){for(;za(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Ps(s));break}if(Ps(s))break;for(r=e.position;s!==0&&!ci(s);)s=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}s!==0&&td(e),ta.call(K2,n)?K2[n](e,n,i):Qf(e,'unknown document directive "'+n+'"')}if(Hr(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Hr(e,!0,-1)):u&&tt(e,"directives end mark is expected"),Zo(e,e.lineIndent-1,Zf,!1,!0),Hr(e,!0,-1),e.checkLineBreaks&&pI.test(e.input.slice(t,e.position))&&Qf(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&eh(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Hr(e,!0,-1));return}if(e.position<e.length-1)tt(e,"end of the stream or a document separator is expected");else return}function rE(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new AI(e,t),n=e.indexOf("\0");for(n!==-1&&(r.position=n,tt(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)BI(r);return r.documents}function nE(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var n=rE(e,r);if(typeof t!="function")return n;for(var i=0,u=n.length;i<u;i+=1)t(n[i])}function iE(e,t){var r=rE(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new z2("expected a single document in the stream, but found more")}}function $I(e,t,r){return typeof t=="object"&&t!==null&&typeof r>"u"&&(r=t,t=null),nE(e,t,gu.extend({schema:Y2},r))}function PI(e,t){return iE(e,gu.extend({schema:Y2},t))}Wc.exports.loadAll=nE;Wc.exports.load=iE;Wc.exports.safeLoadAll=$I;Wc.exports.safeLoad=PI});var IE=Se((dO,ad)=>{"use strict";var Xc=qa(),Zc=zo(),RI=Yc(),TI=Wo(),pE=Object.prototype.toString,dE=Object.prototype.hasOwnProperty,OI=9,Jc=10,NI=13,xI=32,kI=33,LI=34,gE=35,UI=37,HI=38,jI=39,MI=42,mE=44,qI=45,vE=58,KI=61,VI=62,GI=63,zI=64,EE=91,AE=93,YI=96,wE=123,WI=124,CE=125,Pn={};Pn[0]="\\0";Pn[7]="\\a";Pn[8]="\\b";Pn[9]="\\t";Pn[10]="\\n";Pn[11]="\\v";Pn[12]="\\f";Pn[13]="\\r";Pn[27]="\\e";Pn[34]='\\"';Pn[92]="\\\\";Pn[133]="\\N";Pn[160]="\\_";Pn[8232]="\\L";Pn[8233]="\\P";var JI=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function XI(e,t){var r,n,i,u,s,o,l;if(t===null)return{};for(r={},n=Object.keys(t),i=0,u=n.length;i<u;i+=1)s=n[i],o=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&dE.call(l.styleAliases,o)&&(o=l.styleAliases[o]),r[s]=o;return r}function uE(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else if(e<=4294967295)r="U",n=8;else throw new Zc("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Xc.repeat("0",n-t.length)+t}function ZI(e){this.schema=e.schema||RI,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Xc.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=XI(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function aE(e,t){for(var r=Xc.repeat(" ",t),n=0,i=-1,u="",s,o=e.length;n<o;)i=e.indexOf(`
`,n),i===-1?(s=e.slice(n),n=o):(s=e.slice(n,i+1),n=i+1),s.length&&s!==`
`&&(u+=r),u+=s;return u}function nd(e,t){return`
`+Xc.repeat(" ",e.indent*t)}function QI(e,t){var r,n,i;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(i=e.implicitTypes[r],i.resolve(t))return!0;return!1}function ud(e){return e===xI||e===OI}function Qo(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==65279||65536<=e&&e<=1114111}function eB(e){return Qo(e)&&!ud(e)&&e!==65279&&e!==NI&&e!==Jc}function oE(e,t){return Qo(e)&&e!==65279&&e!==mE&&e!==EE&&e!==AE&&e!==wE&&e!==CE&&e!==vE&&(e!==gE||t&&eB(t))}function tB(e){return Qo(e)&&e!==65279&&!ud(e)&&e!==qI&&e!==GI&&e!==vE&&e!==mE&&e!==EE&&e!==AE&&e!==wE&&e!==CE&&e!==gE&&e!==HI&&e!==MI&&e!==kI&&e!==WI&&e!==KI&&e!==VI&&e!==jI&&e!==LI&&e!==UI&&e!==zI&&e!==YI}function yE(e){var t=/^\n* /;return t.test(e)}var FE=1,DE=2,SE=3,bE=4,th=5;function rB(e,t,r,n,i){var u,s,o,l=!1,f=!1,p=n!==-1,E=-1,d=tB(e.charCodeAt(0))&&!ud(e.charCodeAt(e.length-1));if(t)for(u=0;u<e.length;u++){if(s=e.charCodeAt(u),!Qo(s))return th;o=u>0?e.charCodeAt(u-1):null,d=d&&oE(s,o)}else{for(u=0;u<e.length;u++){if(s=e.charCodeAt(u),s===Jc)l=!0,p&&(f=f||u-E-1>n&&e[E+1]!==" ",E=u);else if(!Qo(s))return th;o=u>0?e.charCodeAt(u-1):null,d=d&&oE(s,o)}f=f||p&&u-E-1>n&&e[E+1]!==" "}return!l&&!f?d&&!i(e)?FE:DE:r>9&&yE(e)?th:f?bE:SE}function nB(e,t,r,n){e.dump=function(){if(t.length===0)return"''";if(!e.noCompatMode&&JI.indexOf(t)!==-1)return"'"+t+"'";var i=e.indent*Math.max(1,r),u=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),s=n||e.flowLevel>-1&&r>=e.flowLevel;function o(l){return QI(e,l)}switch(rB(t,s,e.indent,u,o)){case FE:return t;case DE:return"'"+t.replace(/'/g,"''")+"'";case SE:return"|"+cE(t,e.indent)+lE(aE(t,i));case bE:return">"+cE(t,e.indent)+lE(aE(iB(t,u),i));case th:return'"'+sB(t,u)+'"';default:throw new Zc("impossible error: invalid scalar style")}}()}function cE(e,t){var r=yE(e)?String(t):"",n=e[e.length-1]===`
`,i=n&&(e[e.length-2]===`
`||e===`
`),u=i?"+":n?"":"-";return r+u+`
`}function lE(e){return e[e.length-1]===`
`?e.slice(0,-1):e}function iB(e,t){for(var r=/(\n+)([^\n]*)/g,n=function(){var f=e.indexOf(`
`);return f=f!==-1?f:e.length,r.lastIndex=f,fE(e.slice(0,f),t)}(),i=e[0]===`
`||e[0]===" ",u,s;s=r.exec(e);){var o=s[1],l=s[2];u=l[0]===" ",n+=o+(!i&&!u&&l!==""?`
`:"")+fE(l,t),i=u}return n}function fE(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,i=0,u,s=0,o=0,l="";n=r.exec(e);)o=n.index,o-i>t&&(u=s>i?s:o,l+=`
`+e.slice(i,u),i=u+1),s=o;return l+=`
`,e.length-i>t&&s>i?l+=e.slice(i,s)+`
`+e.slice(s+1):l+=e.slice(i),l.slice(1)}function sB(e){for(var t="",r,n,i,u=0;u<e.length;u++){if(r=e.charCodeAt(u),r>=55296&&r<=56319&&(n=e.charCodeAt(u+1),n>=56320&&n<=57343)){t+=uE((r-55296)*1024+n-56320+65536),u++;continue}i=Pn[r],t+=!i&&Qo(r)?e[u]:i||uE(r)}return t}function uB(e,t,r){var n="",i=e.tag,u,s;for(u=0,s=r.length;u<s;u+=1)Ya(e,t,r[u],!1,!1)&&(u!==0&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function aB(e,t,r,n){var i="",u=e.tag,s,o;for(s=0,o=r.length;s<o;s+=1)Ya(e,t+1,r[s],!0,!0)&&((!n||s!==0)&&(i+=nd(e,t)),e.dump&&Jc===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=u,e.dump=i||"[]"}function oB(e,t,r){var n="",i=e.tag,u=Object.keys(r),s,o,l,f,p;for(s=0,o=u.length;s<o;s+=1)p="",s!==0&&(p+=", "),e.condenseFlow&&(p+='"'),l=u[s],f=r[l],Ya(e,t,l,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ya(e,t,f,!1,!1)&&(p+=e.dump,n+=p));e.tag=i,e.dump="{"+n+"}"}function cB(e,t,r,n){var i="",u=e.tag,s=Object.keys(r),o,l,f,p,E,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Zc("sortKeys must be a boolean or a function");for(o=0,l=s.length;o<l;o+=1)d="",(!n||o!==0)&&(d+=nd(e,t)),f=s[o],p=r[f],Ya(e,t+1,f,!0,!0,!0)&&(E=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,E&&(e.dump&&Jc===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,E&&(d+=nd(e,t)),Ya(e,t+1,p,!0,E)&&(e.dump&&Jc===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,i+=d));e.tag=u,e.dump=i||"{}"}function hE(e,t,r){var n,i,u,s,o,l;for(i=r?e.explicitTypes:e.implicitTypes,u=0,s=i.length;u<s;u+=1)if(o=i[u],(o.instanceOf||o.predicate)&&(!o.instanceOf||typeof t=="object"&&t instanceof o.instanceOf)&&(!o.predicate||o.predicate(t))){if(e.tag=r?o.tag:"?",o.represent){if(l=e.styleMap[o.tag]||o.defaultStyle,pE.call(o.represent)==="[object Function]")n=o.represent(t,l);else if(dE.call(o.represent,l))n=o.represent[l](t,l);else throw new Zc("!<"+o.tag+'> tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}function Ya(e,t,r,n,i,u){e.tag=null,e.dump=r,hE(e,r,!1)||hE(e,r,!0);var s=pE.call(e.dump);n&&(n=e.flowLevel<0||e.flowLevel>t);var o=s==="[object Object]"||s==="[object Array]",l,f;if(o&&(l=e.duplicates.indexOf(r),f=l!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[l])e.dump="*ref_"+l;else{if(o&&f&&!e.usedDuplicates[l]&&(e.usedDuplicates[l]=!0),s==="[object Object]")n&&Object.keys(e.dump).length!==0?(cB(e,t,e.dump,i),f&&(e.dump="&ref_"+l+e.dump)):(oB(e,t,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump));else if(s==="[object Array]"){var p=e.noArrayIndent&&t>0?t-1:t;n&&e.dump.length!==0?(aB(e,p,e.dump,i),f&&(e.dump="&ref_"+l+e.dump)):(uB(e,p,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump))}else if(s==="[object String]")e.tag!=="?"&&nB(e,e.dump,t,u);else{if(e.skipInvalid)return!1;throw new Zc("unacceptable kind of an object to dump "+s)}e.tag!==null&&e.tag!=="?"&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function lB(e,t){var r=[],n=[],i,u;for(sd(e,r,n),i=0,u=n.length;i<u;i+=1)t.duplicates.push(r[n[i]]);t.usedDuplicates=new Array(u)}function sd(e,t,r){var n,i,u;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(t.push(e),Array.isArray(e))for(i=0,u=e.length;i<u;i+=1)sd(e[i],t,r);else for(n=Object.keys(e),i=0,u=n.length;i<u;i+=1)sd(e[n[i]],t,r)}function _E(e,t){t=t||{};var r=new ZI(t);return r.noRefs||lB(e,r),Ya(r,0,e,!0,!0)?r.dump+`
`:""}function fB(e,t){return _E(e,Xc.extend({schema:TI},t))}ad.exports.dump=_E;ad.exports.safeDump=fB});var $E=Se((gO,Ir)=>{"use strict";var rh=sE(),BE=IE();function nh(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}Ir.exports.Type=Gr();Ir.exports.Schema=Ka();Ir.exports.FAILSAFE_SCHEMA=Wf();Ir.exports.JSON_SCHEMA=Xp();Ir.exports.CORE_SCHEMA=Zp();Ir.exports.DEFAULT_SAFE_SCHEMA=Wo();Ir.exports.DEFAULT_FULL_SCHEMA=Yc();Ir.exports.load=rh.load;Ir.exports.loadAll=rh.loadAll;Ir.exports.safeLoad=rh.safeLoad;Ir.exports.safeLoadAll=rh.safeLoadAll;Ir.exports.dump=BE.dump;Ir.exports.safeDump=BE.safeDump;Ir.exports.YAMLException=zo();Ir.exports.MINIMAL_SCHEMA=Wf();Ir.exports.SAFE_SCHEMA=Wo();Ir.exports.DEFAULT_SCHEMA=Yc();Ir.exports.scan=nh("scan");Ir.exports.parse=nh("parse");Ir.exports.compose=nh("compose");Ir.exports.addConstructor=nh("addConstructor")});var RE=Se((mO,PE)=>{"use strict";var hB=$E();PE.exports=hB});var OE=Se((vO,TE)=>{"use strict";var ih=RE();TE.exports={safeLoad:ih.safeLoad,load:ih.load,safeDump:ih.safeDump,dump:ih.dump}});var LE=Se(ld=>{"use strict";ld.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};ld.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 UE=Se(fd=>{"use strict";fd.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};fd.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 HE=Se(hd=>{"use strict";hd.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};hd.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 jE=Se(pd=>{"use strict";pd.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};pd.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 ME=Se(dd=>{"use strict";dd.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}`};dd.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 VE=Se((KE,gd)=>{var qE=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=E,e.encode=p,e.familyOf=f,e.name=void 0,e.sizeOf=l,e.v6=e.v4=void 0;let t=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,u={name:"v4",size:r,isFormat:d=>t.test(d),encode(d,h,w){w=~~w,h=h||new Uint8Array(w+r);let m=d.length,y=0;for(let A=0;A<m;){let C=d.charCodeAt(A++);C===46?(h[w++]=y,y=0):y=y*10+(C-48)}return h[w]=y,h},decode(d,h){return h=~~h,`${d[h++]}.${d[h++]}.${d[h++]}.${d[h]}`}};e.v4=u;let s={name:"v6",size:i,isFormat:d=>d.length>0&&n.test(d),encode(d,h,w){w=~~w;let m=w+i,y=-1,A=0,C=0,S=!0,B=!1;h=h||new Uint8Array(w+i);for(let I=0;I<d.length;I++){let M=d.charCodeAt(I);M===58?(S?y!==-1?(w<m&&(h[w]=0),w<m-1&&(h[w+1]=0),w+=2):w<m&&(y=w):(B===!0?(w<m&&(h[w]=C),w++):(w<m&&(h[w]=A>>8),w<m-1&&(h[w+1]=A&255),w+=2),A=0,C=0),S=!0,B=!1):M===46?(w<m&&(h[w]=C),w++,C=0,A=0,S=!1,B=!0):(S=!1,M>=97?M-=87:M>=65?M-=55:(M-=48,C=C*10+M),A=(A<<4)+M)}if(S===!1)B===!0?(w<m&&(h[w]=C),w++):(w<m&&(h[w]=A>>8),w<m-1&&(h[w+1]=A&255),w+=2);else if(y===0)w<m&&(h[w]=0),w<m-1&&(h[w+1]=0),w+=2;else if(y!==-1){w+=2;for(let I=Math.min(w-1,m-1);I>=y+2;I--)h[I]=h[I-2];h[y]=0,h[y+1]=0,y=w}if(y!==w&&y!==-1)for(w>m-2&&(w=m-2);m>y;)h[--m]=w<m&&w>y?h[--w]:0;else for(;w<m;)h[w++]=0;return h},decode(d,h){h=~~h;let w="";for(let m=0;m<i;m+=2)m!==0&&(w+=":"),w+=(d[h+m]<<8|d[h+m+1]).toString(16);return w.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};e.v6=s;let o="ip";e.name=o;function l(d){if(u.isFormat(d))return u.size;if(s.isFormat(d))return s.size;throw Error(`Invalid ip address: ${d}`)}function f(d){return l(d)===u.size?1:2}function p(d,h,w){w=~~w;let m=l(d);return typeof h=="function"&&(h=h(w+m)),m===u.size?u.encode(d,h,w):s.encode(d,h,w)}function E(d,h,w){if(h=~~h,w=w||d.length-h,w===u.size)return u.decode(d,h,w);if(w===s.size)return s.decode(d,h,w);throw Error(`Invalid buffer size needs to be ${u.size} for v4 or ${s.size} for v6.`)}return"default"in e?e.default:e}({});typeof define=="function"&&define.amd?define([],function(){return qE}):typeof gd=="object"&&typeof KE=="object"&&(gd.exports=qE)});var YE=Se(ze=>{"use strict";var Ye=Of().Buffer,Su=LE(),gB=UE(),mB=HE(),ch=jE(),md=ME(),Wa=VE(),vB=0,GE=32768,vd=32768,EB=~vd,zE=32768,AB=~zE,Te=ze.name={};Te.encode=function(e,t,r,{mail:n=!1}={}){t||(t=Ye.alloc(Te.encodingLength(e))),r||(r=0);let i=r,u=e.replace(/^\.|\.$/gm,"");if(u.length){let s=[];if(n){let o="";u.split(".").forEach(l=>{l.endsWith("\\")?o+=(o.length?".":"")+l.slice(0,-1):s.length===0&&o.length?s.push(o+"."+l):s.push(l)})}else s=u.split(".");for(let o=0;o<s.length;o++){let l=t.write(s[o],r+1);t[r]=l,r+=l+1}}return t[r++]=0,Te.encode.bytes=r-i,t};Te.encode.bytes=0;Te.decode=function(e,t,{mail:r=!1}={}){t||(t=0);let n=[],i=t,u=0,s=0,o=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");let l=e[t++];if(s+=o?0:1,l===0)break;if(l&192)if((l&192)===192){if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");let f=e.readUInt16BE(t-1)-49152;if(f>=i)throw new Error("Cannot decode name (bad pointer)");t=f,i=f,s+=o?0:1,o=!0}else throw new Error("Cannot decode name (bad label)");else{if(t+l>e.length)throw new Error("Cannot decode name (buffer overflow)");if(u+=l+1,u>254)throw new Error("Cannot decode name (name too long)");let f=e.toString("utf-8",t,t+l);r&&(f=f.replace(/\./g,"\\.")),n.push(f),t+=l,s+=o?0:l}}return Te.decode.bytes=s,n.length===0?".":n.join(".")};Te.decode.bytes=0;Te.encodingLength=function(e){return e==="."||e===".."?1:Ye.byteLength(e.replace(/^\.|\.$/gm,""))+2};var yt={};yt.encode=function(e,t,r){t||(t=Ye.alloc(yt.encodingLength(e))),r||(r=0);let n=t.write(e,r+1);return t[r]=n,yt.encode.bytes=n+1,t};yt.encode.bytes=0;yt.decode=function(e,t){t||(t=0);let r=e[t],n=e.toString("utf-8",t+1,t+1+r);return yt.decode.bytes=r+1,n};yt.decode.bytes=0;yt.encodingLength=function(e){return Ye.byteLength(e)+1};var os={};os.encode=function(e,t,r){t||(t=os.encodingLength(e)),r||(r=0);let n=(e.flags||0)&32767,i=e.type==="response"?GE:vB;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(n|i,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t};os.encode.bytes=12;os.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");let r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:r&GE?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:mB.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:gB.toString(r&15),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}};os.decode.bytes=12;os.encodingLength=function(){return 12};var mu=ze.unknown={};mu.encode=function(e,t,r){return t||(t=Ye.alloc(mu.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),mu.encode.bytes=e.length+2,t};mu.encode.bytes=0;mu.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return mu.decode.bytes=r+2,n};mu.decode.bytes=0;mu.encodingLength=function(e){return e.length+2};var vu=ze.ns={};vu.encode=function(e,t,r){return t||(t=Ye.alloc(vu.encodingLength(e))),r||(r=0),Te.encode(e,t,r+2),t.writeUInt16BE(Te.encode.bytes,r),vu.encode.bytes=Te.encode.bytes+2,t};vu.encode.bytes=0;vu.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=Te.decode(e,t+2);return vu.decode.bytes=r+2,n};vu.decode.bytes=0;vu.encodingLength=function(e){return Te.encodingLength(e)+2};var Eu=ze.soa={};Eu.encode=function(e,t,r){t||(t=Ye.alloc(Eu.encodingLength(e))),r||(r=0);let n=r;return r+=2,Te.encode(e.mname,t,r),r+=Te.encode.bytes,Te.encode(e.rname,t,r,{mail:!0}),r+=Te.encode.bytes,t.writeUInt32BE(e.serial||0,r),r+=4,t.writeUInt32BE(e.refresh||0,r),r+=4,t.writeUInt32BE(e.retry||0,r),r+=4,t.writeUInt32BE(e.expire||0,r),r+=4,t.writeUInt32BE(e.minimum||0,r),r+=4,t.writeUInt16BE(r-n-2,n),Eu.encode.bytes=r-n,t};Eu.encode.bytes=0;Eu.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mname=Te.decode(e,t),t+=Te.decode.bytes,n.rname=Te.decode(e,t,{mail:!0}),t+=Te.decode.bytes,n.serial=e.readUInt32BE(t),t+=4,n.refresh=e.readUInt32BE(t),t+=4,n.retry=e.readUInt32BE(t),t+=4,n.expire=e.readUInt32BE(t),t+=4,n.minimum=e.readUInt32BE(t),t+=4,Eu.decode.bytes=t-r,n};Eu.decode.bytes=0;Eu.encodingLength=function(e){return 22+Te.encodingLength(e.mname)+Te.encodingLength(e.rname)};var Au=ze.txt={};Au.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)if(typeof e[i]=="string"&&(e[i]=Ye.from(e[i])),!Ye.isBuffer(e[i]))throw new Error("Must be a Buffer");t||(t=Ye.alloc(Au.encodingLength(e))),r||(r=0);let n=r;return r+=2,e.forEach(function(i){t[r++]=i.length,i.copy(t,r,0,i.length),r+=i.length}),t.writeUInt16BE(r-n-2,n),Au.encode.bytes=r-n,t};Au.encode.bytes=0;Au.decode=function(e,t){t||(t=0);let r=t,n=e.readUInt16BE(t);t+=2;let i=[];for(;n>0;){let u=e[t++];if(--n,n<u)throw new Error("Buffer overflow");i.push(e.slice(t,t+u)),t+=u,n-=u}return Au.decode.bytes=t-r,i};Au.decode.bytes=0;Au.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(r){typeof r=="string"?t+=Ye.byteLength(r)+1:t+=r.length+1}),t};var wu=ze.null={};wu.encode=function(e,t,r){t||(t=Ye.alloc(wu.encodingLength(e))),r||(r=0),typeof e=="string"&&(e=Ye.from(e)),e||(e=Ye.alloc(0));let n=r;r+=2;let i=e.length;return e.copy(t,r,0,i),r+=i,t.writeUInt16BE(r-n-2,n),wu.encode.bytes=r-n,t};wu.encode.bytes=0;wu.decode=function(e,t){t||(t=0);let r=t,n=e.readUInt16BE(t);t+=2;let i=e.slice(t,t+n);return t+=n,wu.decode.bytes=t-r,i};wu.decode.bytes=0;wu.encodingLength=function(e){return e?(Ye.isBuffer(e)?e.length:Ye.byteLength(e))+2:2};var Cu=ze.hinfo={};Cu.encode=function(e,t,r){t||(t=Ye.alloc(Cu.encodingLength(e))),r||(r=0);let n=r;return r+=2,yt.encode(e.cpu,t,r),r+=yt.encode.bytes,yt.encode(e.os,t,r),r+=yt.encode.bytes,t.writeUInt16BE(r-n-2,n),Cu.encode.bytes=r-n,t};Cu.encode.bytes=0;Cu.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.cpu=yt.decode(e,t),t+=yt.decode.bytes,n.os=yt.decode(e,t),t+=yt.decode.bytes,Cu.decode.bytes=t-r,n};Cu.decode.bytes=0;Cu.encodingLength=function(e){return yt.encodingLength(e.cpu)+yt.encodingLength(e.os)+2};var us=ze.ptr={},wB=ze.cname=us,CB=ze.dname=us;us.encode=function(e,t,r){return t||(t=Ye.alloc(us.encodingLength(e))),r||(r=0),Te.encode(e,t,r+2),t.writeUInt16BE(Te.encode.bytes,r),us.encode.bytes=Te.encode.bytes+2,t};us.encode.bytes=0;us.decode=function(e,t){t||(t=0);let r=Te.decode(e,t+2);return us.decode.bytes=Te.decode.bytes+2,r};us.decode.bytes=0;us.encodingLength=function(e){return Te.encodingLength(e)+2};var yu=ze.srv={};yu.encode=function(e,t,r){t||(t=Ye.alloc(yu.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.priority||0,r+2),t.writeUInt16BE(e.weight||0,r+4),t.writeUInt16BE(e.port||0,r+6),Te.encode(e.target,t,r+8);let n=Te.encode.bytes+6;return t.writeUInt16BE(n,r),yu.encode.bytes=n+2,t};yu.encode.bytes=0;yu.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n={};return n.priority=e.readUInt16BE(t+2),n.weight=e.readUInt16BE(t+4),n.port=e.readUInt16BE(t+6),n.target=Te.decode(e,t+8),yu.decode.bytes=r+2,n};yu.decode.bytes=0;yu.encodingLength=function(e){return 8+Te.encodingLength(e.target)};var Si=ze.caa={};Si.ISSUER_CRITICAL=128;Si.encode=function(e,t,r){let n=Si.encodingLength(e);return t||(t=Ye.alloc(Si.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=Si.ISSUER_CRITICAL),t.writeUInt16BE(n-2,r),r+=2,t.writeUInt8(e.flags||0,r),r+=1,yt.encode(e.tag,t,r),r+=yt.encode.bytes,t.write(e.value,r),r+=Ye.byteLength(e.value),Si.encode.bytes=n,t};Si.encode.bytes=0;Si.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t);t+=2;let n=t,i={};return i.flags=e.readUInt8(t),t+=1,i.tag=yt.decode(e,t),t+=yt.decode.bytes,i.value=e.toString("utf-8",t,n+r),i.issuerCritical=!!(i.flags&Si.ISSUER_CRITICAL),Si.decode.bytes=r+2,i};Si.decode.bytes=0;Si.encodingLength=function(e){return yt.encodingLength(e.tag)+yt.encodingLength(e.value)+2};var ra=ze.mx={};ra.encode=function(e,t,r){t||(t=Ye.alloc(ra.encodingLength(e))),r||(r=0);let n=r;return r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,Te.encode(e.exchange,t,r),r+=Te.encode.bytes,t.writeUInt16BE(r-n-2,n),ra.encode.bytes=r-n,t};ra.encode.bytes=0;ra.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.preference=e.readUInt16BE(t),t+=2,n.exchange=Te.decode(e,t),t+=Te.decode.bytes,ra.decode.bytes=t-r,n};ra.encodingLength=function(e){return 4+Te.encodingLength(e.exchange)};var Fu=ze.a={};Fu.encode=function(e,t,r){return t||(t=Ye.alloc(Fu.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,Wa.v4.encode(e,t,r),Fu.encode.bytes=6,t};Fu.encode.bytes=0;Fu.decode=function(e,t){t||(t=0),t+=2;let r=Wa.v4.decode(e,t);return Fu.decode.bytes=6,r};Fu.decode.bytes=0;Fu.encodingLength=function(){return 6};var Du=ze.aaaa={};Du.encode=function(e,t,r){return t||(t=Ye.alloc(Du.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,Wa.v6.encode(e,t,r),Du.encode.bytes=18,t};Du.encode.bytes=0;Du.decode=function(e,t){t||(t=0),t+=2;let r=Wa.v6.decode(e,t);return Du.decode.bytes=18,r};Du.decode.bytes=0;Du.encodingLength=function(){return 18};var li=ze.option={};li.encode=function(e,t,r){t||(t=Ye.alloc(li.encodingLength(e))),r||(r=0);let n=r,i=md.toCode(e.code);if(t.writeUInt16BE(i,r),r+=2,e.data)t.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(t,r),r+=e.data.length;else switch(i){case 8:let u=e.sourcePrefixLength||0,s=e.family||Wa.familyOf(e.ip),o=Wa.encode(e.ip,Ye.alloc),l=Math.ceil(u/8);t.writeUInt16BE(l+4,r),r+=2,t.writeUInt16BE(s,r),r+=2,t.writeUInt8(u,r++),t.writeUInt8(e.scopePrefixLength||0,r++),o.copy(t,r,0,l),r+=l;break;case 11:e.timeout?(t.writeUInt16BE(2,r),r+=2,t.writeUInt16BE(e.timeout,r),r+=2):(t.writeUInt16BE(0,r),r+=2);break;case 12:let f=e.length||0;t.writeUInt16BE(f,r),r+=2,t.fill(0,r,r+f),r+=f;break;case 14:let p=e.tags.length*2;t.writeUInt16BE(p,r),r+=2;for(let E of e.tags)t.writeUInt16BE(E,r),r+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return li.encode.bytes=r-n,t};li.encode.bytes=0;li.decode=function(e,t){t||(t=0);let r={};r.code=e.readUInt16BE(t),r.type=md.toString(r.code),t+=2;let n=e.readUInt16BE(t);switch(t+=2,r.data=e.slice(t,t+n),r.code){case 8:r.family=e.readUInt16BE(t),t+=2,r.sourcePrefixLength=e.readUInt8(t++),r.scopePrefixLength=e.readUInt8(t++);let i=Ye.alloc(r.family===1?4:16);e.copy(i,0,t,t+n-4),r.ip=Wa.decode(i);break;case 11:n>0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let u=0;u<n;u+=2)r.tags.push(e.readUInt16BE(t)),t+=2}return li.decode.bytes=n+4,r};li.decode.bytes=0;li.encodingLength=function(e){if(e.data)return e.data.length+4;switch(md.toCode(e.code)){case 8:let r=e.sourcePrefixLength||0;return Math.ceil(r/8)+8;case 11:return typeof e.timeout=="number"?6:4;case 12:return e.length+4;case 14:return 4+e.tags.length*2}throw new Error(`Unknown roption code: ${e.code}`)};var _i=ze.opt={};_i.encode=function(e,t,r){t||(t=Ye.alloc(_i.encodingLength(e))),r||(r=0);let n=r,i=tc(e,li);return t.writeUInt16BE(i,r),r=nl(e,li,t,r+2),_i.encode.bytes=r-n,t};_i.encode.bytes=0;_i.decode=function(e,t){t||(t=0);let r=t,n=[],i=e.readUInt16BE(t);t+=2;let u=0;for(;i>0;)n[u++]=li.decode(e,t),t+=li.decode.bytes,i-=li.decode.bytes;return _i.decode.bytes=t-r,n};_i.decode.bytes=0;_i.encodingLength=function(e){return 2+tc(e||[],li)};var Gn=ze.dnskey={};Gn.PROTOCOL_DNSSEC=3;Gn.ZONE_KEY=128;Gn.SECURE_ENTRYPOINT=32768;Gn.encode=function(e,t,r){t||(t=Ye.alloc(Gn.encodingLength(e))),r||(r=0);let n=r,i=e.key;if(!Ye.isBuffer(i))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(Gn.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,Gn.encode.bytes=r-n,t.writeUInt16BE(Gn.encode.bytes-2,n),t};Gn.encode.bytes=0;Gn.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);if(t+=2,n.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==Gn.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,n.algorithm=e.readUInt8(t),t+=1,n.key=e.slice(t,r+i+2),t+=n.key.length,Gn.decode.bytes=t-r,n};Gn.decode.bytes=0;Gn.encodingLength=function(e){return 6+Ye.byteLength(e.key)};var Ts=ze.rrsig={};Ts.encode=function(e,t,r){t||(t=Ye.alloc(Ts.encodingLength(e))),r||(r=0);let n=r,i=e.signature;if(!Ye.isBuffer(i))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(Su.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,Te.encode(e.signersName,t,r),r+=Te.encode.bytes,i.copy(t,r,0,i.length),r+=i.length,Ts.encode.bytes=r-n,t.writeUInt16BE(Ts.encode.bytes-2,n),t};Ts.encode.bytes=0;Ts.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.typeCovered=Su.toString(e.readUInt16BE(t)),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.labels=e.readUInt8(t),t+=1,n.originalTTL=e.readUInt32BE(t),t+=4,n.expiration=e.readUInt32BE(t),t+=4,n.inception=e.readUInt32BE(t),t+=4,n.keyTag=e.readUInt16BE(t),t+=2,n.signersName=Te.decode(e,t),t+=Te.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,Ts.decode.bytes=t-r,n};Ts.decode.bytes=0;Ts.encodingLength=function(e){return 20+Te.encodingLength(e.signersName)+Ye.byteLength(e.signature)};var Os=ze.rp={};Os.encode=function(e,t,r){t||(t=Ye.alloc(Os.encodingLength(e))),r||(r=0);let n=r;return r+=2,Te.encode(e.mbox||".",t,r,{mail:!0}),r+=Te.encode.bytes,Te.encode(e.txt||".",t,r),r+=Te.encode.bytes,Os.encode.bytes=r-n,t.writeUInt16BE(Os.encode.bytes-2,n),t};Os.encode.bytes=0;Os.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=Te.decode(e,t,{mail:!0})||".",t+=Te.decode.bytes,n.txt=Te.decode(e,t)||".",t+=Te.decode.bytes,Os.decode.bytes=t-r,n};Os.decode.bytes=0;Os.encodingLength=function(e){return 2+Te.encodingLength(e.mbox||".")+Te.encodingLength(e.txt||".")};var nn={};nn.encode=function(e,t,r){t||(t=Ye.alloc(nn.encodingLength(e))),r||(r=0);let n=r;for(var i=[],u=0;u<e.length;u++){var s=Su.toType(e[u]);i[s>>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(u=0;u<i.length;u++)if(i[u]!==void 0){var o=Ye.from(i[u]);t.writeUInt8(u,r),r+=1,t.writeUInt8(o.length,r),r+=1,o.copy(t,r),r+=o.length}return nn.encode.bytes=r-n,t};nn.encode.bytes=0;nn.decode=function(e,t,r){t||(t=0);let n=t;for(var i=[];t-n<r;){var u=e.readUInt8(t);t+=1;var s=e.readUInt8(t);t+=1;for(var o=0;o<s;o++)for(var l=e.readUInt8(t+o),f=0;f<8;f++)if(l&1<<7-f){var p=Su.toString(u<<8|o<<3|f);i.push(p)}t+=s}return nn.decode.bytes=t-n,i};nn.decode.bytes=0;nn.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var n=Su.toType(e[r]);t[n>>8]=Math.max(t[n>>8]||0,n&255)}var i=0;for(r=0;r<t.length;r++)t[r]!==void 0&&(i+=2+Math.ceil((t[r]+1)/8));return i};var Ns=ze.nsec={};Ns.encode=function(e,t,r){t||(t=Ye.alloc(Ns.encodingLength(e))),r||(r=0);let n=r;return r+=2,Te.encode(e.nextDomain,t,r),r+=Te.encode.bytes,nn.encode(e.rrtypes,t,r),r+=nn.encode.bytes,Ns.encode.bytes=r-n,t.writeUInt16BE(Ns.encode.bytes-2,n),t};Ns.encode.bytes=0;Ns.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.nextDomain=Te.decode(e,t),t+=Te.decode.bytes,n.rrtypes=nn.decode(e,t,i-(t-r)),t+=nn.decode.bytes,Ns.decode.bytes=t-r,n};Ns.decode.bytes=0;Ns.encodingLength=function(e){return 2+Te.encodingLength(e.nextDomain)+nn.encodingLength(e.rrtypes)};var xs=ze.nsec3={};xs.encode=function(e,t,r){t||(t=Ye.alloc(xs.encodingLength(e))),r||(r=0);let n=r,i=e.salt;if(!Ye.isBuffer(i))throw new Error("salt must be a Buffer");let u=e.nextDomain;if(!Ye.isBuffer(u))throw new Error("nextDomain must be a Buffer");return r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.flags,r),r+=1,t.writeUInt16BE(e.iterations,r),r+=2,t.writeUInt8(i.length,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,t.writeUInt8(u.length,r),r+=1,u.copy(t,r,0,u.length),r+=u.length,nn.encode(e.rrtypes,t,r),r+=nn.encode.bytes,xs.encode.bytes=r-n,t.writeUInt16BE(xs.encode.bytes-2,n),t};xs.encode.bytes=0;xs.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);t+=2,n.algorithm=e.readUInt8(t),t+=1,n.flags=e.readUInt8(t),t+=1,n.iterations=e.readUInt16BE(t),t+=2;let u=e.readUInt8(t);t+=1,n.salt=e.slice(t,t+u),t+=u;let s=e.readUInt8(t);return t+=1,n.nextDomain=e.slice(t,t+s),t+=s,n.rrtypes=nn.decode(e,t,i-(t-r)),t+=nn.decode.bytes,xs.decode.bytes=t-r,n};xs.decode.bytes=0;xs.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+nn.encodingLength(e.rrtypes)};var ks=ze.ds={};ks.encode=function(e,t,r){t||(t=Ye.alloc(ks.encodingLength(e))),r||(r=0);let n=r,i=e.digest;if(!Ye.isBuffer(i))throw new Error("Digest must be a Buffer");return r+=2,t.writeUInt16BE(e.keyTag,r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.digestType,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,ks.encode.bytes=r-n,t.writeUInt16BE(ks.encode.bytes-2,n),t};ks.encode.bytes=0;ks.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.keyTag=e.readUInt16BE(t),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.digestType=e.readUInt8(t),t+=1,n.digest=e.slice(t,r+i+2),t+=n.digest.length,ks.decode.bytes=t-r,n};ks.decode.bytes=0;ks.encodingLength=function(e){return 6+Ye.byteLength(e.digest)};var bi=ze.sshfp={};bi.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};bi.encode=function(t,r,n){r||(r=Ye.alloc(bi.encodingLength(t))),n||(n=0);let i=n;n+=2,r[n]=t.algorithm,n+=1,r[n]=t.hash,n+=1;let u=Ye.from(t.fingerprint.toUpperCase(),"hex");if(u.length!==bi.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return u.copy(r,n),n+=u.byteLength,bi.encode.bytes=n-i,r.writeUInt16BE(bi.encode.bytes-2,i),r};bi.encode.bytes=0;bi.decode=function(t,r){r||(r=0);let n=r,i={};r+=2,i.algorithm=t[r],r+=1,i.hash=t[r],r+=1;let u=bi.getFingerprintLengthForHashType(i.hash);return i.fingerprint=t.slice(r,r+u).toString("hex").toUpperCase(),r+=u,bi.decode.bytes=r-n,i};bi.decode.bytes=0;bi.encodingLength=function(e){return 4+Ye.from(e.fingerprint,"hex").byteLength};var Ls=ze.naptr={};Ls.encode=function(e,t,r){t||(t=Ye.alloc(Ls.encodingLength(e))),r||(r=0);let n=r;return r+=2,t.writeUInt16BE(e.order||0,r),r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,yt.encode(e.flags,t,r),r+=yt.encode.bytes,yt.encode(e.services,t,r),r+=yt.encode.bytes,yt.encode(e.regexp,t,r),r+=yt.encode.bytes,Te.encode(e.replacement,t,r),r+=Te.encode.bytes,Ls.encode.bytes=r-n,t.writeUInt16BE(Ls.encode.bytes-2,n),t};Ls.encode.bytes=0;Ls.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.order=e.readUInt16BE(t),t+=2,n.preference=e.readUInt16BE(t),t+=2,n.flags=yt.decode(e,t),t+=yt.decode.bytes,n.services=yt.decode(e,t),t+=yt.decode.bytes,n.regexp=yt.decode(e,t),t+=yt.decode.bytes,n.replacement=Te.decode(e,t),t+=Te.decode.bytes,Ls.decode.bytes=t-r,n};Ls.decode.bytes=0;Ls.encodingLength=function(e){return yt.encodingLength(e.flags)+yt.encodingLength(e.services)+yt.encodingLength(e.regexp)+Te.encodingLength(e.replacement)+6};var Us=ze.tlsa={};Us.encode=function(e,t,r){t||(t=Ye.alloc(Us.encodingLength(e))),r||(r=0);let n=r,i=e.certificate;if(!Ye.isBuffer(i))throw new Error("Certificate must be a Buffer");return r+=2,t.writeUInt8(e.usage,r),r+=1,t.writeUInt8(e.selector,r),r+=1,t.writeUInt8(e.matchingType,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,Us.encode.bytes=r-n,t.writeUInt16BE(Us.encode.bytes-2,n),t};Us.encode.bytes=0;Us.decode=function(e,t){t||(t=0);let r=t,n={},i=e.readUInt16BE(t);return t+=2,n.usage=e.readUInt8(t),t+=1,n.selector=e.readUInt8(t),t+=1,n.matchingType=e.readUInt8(t),t+=1,n.certificate=e.slice(t,r+i+2),t+=n.certificate.length,Us.decode.bytes=t-r,n};Us.decode.bytes=0;Us.encodingLength=function(e){return 5+Ye.byteLength(e.certificate)};var Ed=ze.record=function(e){switch(e.toUpperCase()){case"A":return Fu;case"PTR":return us;case"CNAME":return wB;case"DNAME":return CB;case"TXT":return Au;case"NULL":return wu;case"AAAA":return Du;case"SRV":return yu;case"HINFO":return Cu;case"CAA":return Si;case"NS":return vu;case"SOA":return Eu;case"MX":return ra;case"OPT":return _i;case"DNSKEY":return Gn;case"RRSIG":return Ts;case"RP":return Os;case"NSEC":return Ns;case"NSEC3":return xs;case"SSHFP":return bi;case"DS":return ks;case"NAPTR":return Ls;case"TLSA":return Us}return mu},En=ze.answer={};En.encode=function(e,t,r){t||(t=Ye.alloc(En.encodingLength(e))),r||(r=0);let n=r;if(Te.encode(e.name,t,r),r+=Te.encode.bytes,t.writeUInt16BE(Su.toType(e.type),r),e.type.toUpperCase()==="OPT"){if(e.name!==".")throw new Error("OPT name must be root.");t.writeUInt16BE(e.udpPayloadSize||4096,r+2),t.writeUInt8(e.extendedRcode||0,r+4),t.writeUInt8(e.ednsVersion||0,r+5),t.writeUInt16BE(e.flags||0,r+6),r+=8,_i.encode(e.options||[],t,r),r+=_i.encode.bytes}else{let i=ch.toClass(e.class===void 0?"IN":e.class);e.flush&&(i|=vd),t.writeUInt16BE(i,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;let u=Ed(e.type);u.encode(e.data,t,r),r+=u.encode.bytes}return En.encode.bytes=r-n,t};En.encode.bytes=0;En.decode=function(e,t){t||(t=0);let r={},n=t;if(r.name=Te.decode(e,t),t+=Te.decode.bytes,r.type=Su.toString(e.readUInt16BE(t)),r.type==="OPT")r.udpPayloadSize=e.readUInt16BE(t+2),r.extendedRcode=e.readUInt8(t+4),r.ednsVersion=e.readUInt8(t+5),r.flags=e.readUInt16BE(t+6),r.flag_do=(r.flags>>15&1)===1,r.options=_i.decode(e,t+8),t+=8+_i.decode.bytes;else{let i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=ch.toString(i&EB),r.flush=!!(i&vd);let u=Ed(r.type);r.data=u.decode(e,t+8),t+=8+u.decode.bytes}return En.decode.bytes=t-n,r};En.decode.bytes=0;En.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return Te.encodingLength(e.name)+8+Ed(e.type).encodingLength(t)};var as=ze.question={};as.encode=function(e,t,r){t||(t=Ye.alloc(as.encodingLength(e))),r||(r=0);let n=r;return Te.encode(e.name,t,r),r+=Te.encode.bytes,t.writeUInt16BE(Su.toType(e.type),r),r+=2,t.writeUInt16BE(ch.toClass(e.class===void 0?"IN":e.class),r),r+=2,as.encode.bytes=r-n,e};as.encode.bytes=0;as.decode=function(e,t){t||(t=0);let r=t,n={};return n.name=Te.decode(e,t),t+=Te.decode.bytes,n.type=Su.toString(e.readUInt16BE(t)),t+=2,n.class=ch.toString(e.readUInt16BE(t)),t+=2,!!(n.class&zE)&&(n.class&=AB),as.decode.bytes=t-r,n};as.decode.bytes=0;as.encodingLength=function(e){return Te.encodingLength(e.name)+4};ze.AUTHORITATIVE_ANSWER=1024;ze.TRUNCATED_RESPONSE=512;ze.RECURSION_DESIRED=256;ze.RECURSION_AVAILABLE=128;ze.AUTHENTIC_DATA=32;ze.CHECKING_DISABLED=16;ze.DNSSEC_OK=32768;ze.encode=function(e,t,r){let n=!t;n&&(t=Ye.alloc(ze.encodingLength(e))),r||(r=0);let i=r;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),os.encode(e,t,r),r+=os.encode.bytes,r=nl(e.questions,as,t,r),r=nl(e.answers,En,t,r),r=nl(e.authorities,En,t,r),r=nl(e.additionals,En,t,r),ze.encode.bytes=r-i,n&&ze.encode.bytes!==t.length?t.slice(0,ze.encode.bytes):t};ze.encode.bytes=0;ze.decode=function(e,t){t||(t=0);let r=t,n=os.decode(e,t);return t+=os.decode.bytes,t=oh(n.questions,as,e,t),t=oh(n.answers,En,e,t),t=oh(n.authorities,En,e,t),t=oh(n.additionals,En,e,t),ze.decode.bytes=t-r,n};ze.decode.bytes=0;ze.encodingLength=function(e){return os.encodingLength(e)+tc(e.questions||[],as)+tc(e.answers||[],En)+tc(e.authorities||[],En)+tc(e.additionals||[],En)};ze.streamEncode=function(e){let t=ze.encode(e),r=Ye.alloc(2);r.writeUInt16BE(t.byteLength);let n=Ye.concat([r,t]);return ze.streamEncode.bytes=n.byteLength,n};ze.streamEncode.bytes=0;ze.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;let r=ze.decode(e.slice(2));return ze.streamDecode.bytes=ze.decode.bytes,r};ze.streamDecode.bytes=0;function tc(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function nl(e,t,r,n){for(let i=0;i<e.length;i++)t.encode(e[i],r,n),n+=t.encode.bytes;return n}function oh(e,t,r,n){for(let i=0;i<e.length;i++)e[i]=t.decode(r,n),n+=t.decode.bytes;return n}});var wh=Se((ox,hA)=>{"use strict";var s$=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},_d=class e extends Error{constructor(t,r,n){super(t),s$(this,e.prototype),this.name="GrammarError",this.location=r,n===void 0&&(n=[]),this.diagnostics=n,this.stage=null,this.problems=[["error",t,r,n]]}toString(){let t=super.toString();this.location&&(t+=`
at `,this.location.source!==void 0&&this.location.source!==null&&(t+=`${this.location.source}:`),t+=`${this.location.start.line}:${this.location.start.column}`);for(let r of this.diagnostics)t+=`
from `,r.location.source!==void 0&&r.location.source!==null&&(t+=`${r.location.source}:`),t+=`${r.location.start.line}:${r.location.start.column}: ${r.message}`;return t}format(t){let r=t.map(({source:u,text:s})=>({source:u,text:s.split(/\r\n|\n|\r/g)}));function n(u,s,o=""){let l="",f=r.find(({source:E})=>E===u.source),p=u.start;if(f){let E=u.end,d=f.text[p.line-1],w=(p.line===E.line?E.column:d.length+1)-p.column||1;o&&(l+=`
note: ${o}`),l+=`
--> ${u.source}:${p.line}:${p.column}
${"".padEnd(s)} |
${p.line.toString().padStart(s)} | ${d}
${"".padEnd(s)} | ${"".padEnd(p.column-1)}${"".padEnd(w,"^")}`}else l+=`
at ${u.source}:${p.line}:${p.column}`,o&&(l+=`: ${o}`);return l}function i(u,s,o,l=[]){let f;o?f=l.reduce((E,{location:d})=>Math.max(E,d.start.line),o.start.line):f=Math.max.apply(null,l.map(E=>E.location.start.line)),f=f.toString().length;let p=`${u}: ${s}`;o&&(p+=n(o,f));for(let E of l)p+=n(E.location,f,E.message);return p}return this.problems.filter(u=>u[0]!=="info").map(u=>i(...u)).join(`
`)}};hA.exports=_d});var zi=Se((cx,pA)=>{"use strict";var u$={build(e){function t(s,...o){return e[s.type](s,...o)}function r(){}function n(s,...o){return t(s.expression,...o)}function i(s){return function(o,...l){o[s].forEach(f=>t(f,...l))}}let u={grammar(s,...o){s.topLevelInitializer&&t(s.topLevelInitializer,...o),s.initializer&&t(s.initializer,...o),s.rules.forEach(l=>t(l,...o))},top_level_initializer:r,initializer:r,rule:n,named:n,choice:i("alternatives"),action:n,sequence:i("elements"),labeled:n,text:n,simple_and:n,simple_not:n,optional:n,zero_or_more:n,one_or_more:n,group:n,semantic_and:r,semantic_not:r,rule_ref:r,literal:r,class:r,any:r};return Object.keys(u).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||(e[s]=u[s])}),t}};pA.exports=u$});var ia=Se((lx,gA)=>{"use strict";var a$=zi(),dA={findRule(e,t){for(let r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return e.rules[r]},indexOfRule(e,t){for(let r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return r;return-1},alwaysConsumesOnSuccess(e,t){function r(){return!0}function n(){return!1}let i=a$.build({choice(u){return u.alternatives.every(i)},sequence(u){return u.elements.some(i)},simple_and:n,simple_not:n,optional:n,zero_or_more:n,semantic_and:n,semantic_not:n,rule_ref(u){let s=dA.findRule(e,u.name);return s?i(s):void 0},literal(u){return u.value!==""},class:r,any:r});return i(t)}};gA.exports=dA});var Id=Se((fx,mA)=>{"use strict";var o$={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};mA.exports=o$});var Bd=Se((hx,vA)=>{"use strict";var c$=zi(),l$=ia(),f$=wh(),ol=1,Za=0,cl=-1;function Ch(e){function t(s){return s.match=Za}function r(s){return u(s.expression),s.match=ol}function n(s){return s.match=u(s.expression)}function i(s,o){let l=s.length,f=0,p=0;for(let E=0;E<l;++E){let d=u(s[E]);d===ol&&++f,d===cl&&++p}return f===l?ol:o?p===l?cl:Za:p>0?cl:Za}let u=c$.build({rule(s){let o,l=0;if(typeof s.match>"u"){s.match=Za;do if(o=s.match,s.match=u(s.expression),++l>6)throw new f$("Infinity cycle detected when trying to evaluate node match result",s.location);while(o!==s.match)}return s.match},named:n,choice(s){return s.match=i(s.alternatives,!0)},action:n,sequence(s){return s.match=i(s.elements,!1)},labeled:n,text:n,simple_and:n,simple_not(s){return s.match=-u(s.expression)},optional:r,zero_or_more:r,one_or_more:n,group:n,semantic_and:t,semantic_not:t,rule_ref(s){let o=l$.findRule(e,s.name);return s.match=u(o)},literal(s){let o=s.value.length===0?ol:Za;return s.match=o},class(s){let o=s.parts.length===0?cl:Za;return s.match=o},any:t});u(e)}Ch.ALWAYS_MATCH=ol;Ch.SOMETIMES_MATCH=Za;Ch.NEVER_MATCH=cl;vA.exports=Ch});var AA=Se((px,EA)=>{"use strict";var h$=ia(),Oe=Id(),p$=zi(),{ALWAYS_MATCH:sc,SOMETIMES_MATCH:$d,NEVER_MATCH:Pd}=Bd();function d$(e){let t=[],r=[],n=[],i=[];function u(C){let S=t.indexOf(C);return S===-1?t.push(C)-1:S}function s(C){let S={value:C.parts,inverted:C.inverted,ignoreCase:C.ignoreCase},B=JSON.stringify(S),I=r.findIndex(M=>JSON.stringify(M)===B);return I===-1?r.push(S)-1:I}function o(C){let S=JSON.stringify(C),B=n.findIndex(I=>JSON.stringify(I)===S);return B===-1?n.push(C)-1:B}function l(C,S,B){let I={predicate:C,params:S,body:B.code,location:B.codeLocation},M=JSON.stringify(I),q=i.findIndex(b=>JSON.stringify(b)===M);return q===-1?i.push(I)-1:q}function f(C){let S={};return Object.keys(C).forEach(B=>{S[B]=C[B]}),S}function p(C,...S){return C.concat(...S)}function E(C,S,B,I){return C===sc?B:C===Pd?I:S.concat([B.length,I.length],B,I)}function d(C,S){return C.concat([S.length],S)}function h(C,S,B,I){let M=Object.keys(B).map(q=>I-B[q]);return[Oe.CALL,C,S,M.length].concat(M)}function w(C,S,B){let I=C.match|0;return p([Oe.PUSH_CURR_POS],[Oe.SILENT_FAILS_ON],A(C,{sp:B.sp+1,env:f(B.env),action:null}),[Oe.SILENT_FAILS_OFF],E(S?-I:I,[S?Oe.IF_ERROR:Oe.IF_NOT_ERROR],p([Oe.POP],[S?Oe.POP:Oe.POP_CURR_POS],[Oe.PUSH_UNDEFINED]),p([Oe.POP],[S?Oe.POP_CURR_POS:Oe.POP],[Oe.PUSH_FAILED])))}function m(C,S,B){let I=l(!0,Object.keys(B.env),C);return p([Oe.UPDATE_SAVED_POS],h(I,0,B.env,B.sp),E(C.match|0,[Oe.IF],p([Oe.POP],S?[Oe.PUSH_FAILED]:[Oe.PUSH_UNDEFINED]),p([Oe.POP],S?[Oe.PUSH_UNDEFINED]:[Oe.PUSH_FAILED])))}function y(C){return d([Oe.WHILE_NOT_ERROR],p([Oe.APPEND],C))}let A=p$.build({grammar(C){C.rules.forEach(A),C.literals=t,C.classes=r,C.expectations=n,C.functions=i},rule(C){C.bytecode=A(C.expression,{sp:-1,env:{},pluck:[],action:null})},named(C,S){let B=C.match|0,I=B===Pd?null:o({type:"rule",value:C.name});return p([Oe.SILENT_FAILS_ON],A(C.expression,S),[Oe.SILENT_FAILS_OFF],E(B,[Oe.IF_ERROR],[Oe.FAIL,I],[]))},choice(C,S){function B(I,M){let q=I[0].match|0,b=A(I[0],{sp:M.sp,env:f(M.env),action:null});return q===sc?b:p(b,I.length>1?E($d,[Oe.IF_ERROR],p([Oe.POP],B(I.slice(1),M)),[]):[])}return B(C.alternatives,S)},action(C,S){let B=f(S.env),I=C.expression.type!=="sequence"||C.expression.elements.length===0,M=A(C.expression,{sp:S.sp+(I?1:0),env:B,action:C}),q=C.expression.match|0,b=I&&q!==Pd?l(!1,Object.keys(B),C):null;return I?p([Oe.PUSH_CURR_POS],M,E(q,[Oe.IF_NOT_ERROR],p([Oe.LOAD_SAVED_POS,1],h(b,1,B,S.sp+2)),[]),[Oe.NIP]):M},sequence(C,S){function B(I,M){if(I.length>0){let q=C.elements.length-I.length+1;return p(A(I[0],{sp:M.sp,env:M.env,pluck:M.pluck,action:null}),E(I[0].match|0,[Oe.IF_NOT_ERROR],B(I.slice(1),{sp:M.sp+1,env:M.env,pluck:M.pluck,action:M.action}),p(q>1?[Oe.POP_N,q]:[Oe.POP],[Oe.POP_CURR_POS],[Oe.PUSH_FAILED])))}else{if(M.pluck.length>0)return p([Oe.PLUCK,C.elements.length+1,M.pluck.length],M.pluck.map(q=>M.sp-q));if(M.action){let q=l(!1,Object.keys(M.env),M.action);return p([Oe.LOAD_SAVED_POS,C.elements.length],h(q,C.elements.length+1,M.env,M.sp))}else return p([Oe.WRAP,C.elements.length],[Oe.NIP])}}return p([Oe.PUSH_CURR_POS],B(C.elements,{sp:S.sp+1,env:S.env,pluck:[],action:S.action}))},labeled(C,S){let B=S.env,I=C.label,M=S.sp+1;return I&&(B=f(S.env),S.env[C.label]=M),C.pick&&S.pluck.push(M),A(C.expression,{sp:S.sp,env:B,action:null})},text(C,S){return p([Oe.PUSH_CURR_POS],A(C.expression,{sp:S.sp+1,env:f(S.env),action:null}),E(C.match|0,[Oe.IF_NOT_ERROR],p([Oe.POP],[Oe.TEXT]),[Oe.NIP]))},simple_and(C,S){return w(C.expression,!1,S)},simple_not(C,S){return w(C.expression,!0,S)},optional(C,S){return p(A(C.expression,{sp:S.sp,env:f(S.env),action:null}),E(-(C.expression.match|0),[Oe.IF_ERROR],p([Oe.POP],[Oe.PUSH_NULL]),[]))},zero_or_more(C,S){let B=A(C.expression,{sp:S.sp+1,env:f(S.env),action:null});return p([Oe.PUSH_EMPTY_ARRAY],B,y(B),[Oe.POP])},one_or_more(C,S){let B=A(C.expression,{sp:S.sp+1,env:f(S.env),action:null});return p([Oe.PUSH_EMPTY_ARRAY],B,E(C.expression.match|0,[Oe.IF_NOT_ERROR],p(y(B),[Oe.POP]),p([Oe.POP],[Oe.POP],[Oe.PUSH_FAILED])))},group(C,S){return A(C.expression,{sp:S.sp,env:f(S.env),action:null})},semantic_and(C,S){return m(C,!1,S)},semantic_not(C,S){return m(C,!0,S)},rule_ref(C){return[Oe.RULE,h$.indexOfRule(e,C.name)]},literal(C){if(C.value.length>0){let S=C.match|0,I=S===$d||S===sc&&!C.ignoreCase?u(C.ignoreCase?C.value.toLowerCase():C.value):null,M=S!==sc?o({type:"literal",value:C.value,ignoreCase:C.ignoreCase}):null;return E(S,C.ignoreCase?[Oe.MATCH_STRING_IC,I]:[Oe.MATCH_STRING,I],C.ignoreCase?[Oe.ACCEPT_N,C.value.length]:[Oe.ACCEPT_STRING,I],[Oe.FAIL,M])}return[Oe.PUSH_EMPTY_STRING]},class(C){let S=C.match|0,B=S===$d?s(C):null,I=S!==sc?o({type:"class",value:C.parts,inverted:C.inverted,ignoreCase:C.ignoreCase}):null;return E(S,[Oe.MATCH_CHAR_CLASS,B],[Oe.ACCEPT_N,1],[Oe.FAIL,I])},any(C){let S=C.match|0,B=S!==sc?o({type:"any"}):null;return E(S,[Oe.MATCH_ANY],[Oe.ACCEPT_N,1],[Oe.FAIL,B])}});A(e)}EA.exports=d$});var CA=Se((dx,wA)=>{"use strict";var Rd=class{constructor(t,r,n){this.sp=-1,this.maxSp=-1,this.varName=r,this.ruleName=t,this.type=n}name(t){if(t<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack underflow: attempt to use a variable '${this.varName}<x>' at an index ${t}`);return this.varName+t}push(t){let r=this.name(++this.sp)+" = "+t+";";return this.sp>this.maxSp&&(this.maxSp=this.sp),r}pop(t){return t!==void 0?(this.sp-=t,Array.from({length:t},(r,n)=>this.name(this.sp+1+n))):this.name(this.sp--)}top(){return this.name(this.sp)}index(t){if(t<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack overflow: attempt to get a variable at a negative index ${t}`);return this.name(this.sp-t)}result(){if(this.maxSp<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack is empty, can't get the result'`);return this.name(0)}defines(){return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(t,r)=>this.name(r)).join(", ")+";"}checkedIf(t,r,n){let i=this.sp;if(r(),n){let u=this.sp;if(this.sp=i,n(),u!==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: "+u+", after else: "+this.sp+").")}}checkedLoop(t,r){let n=this.sp;if(r(),n!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Body of a loop can't move the stack pointer (before: "+n+", after: "+this.sp+").")}};wA.exports=Rd});var Td=Se((gx,yA)=>{"use strict";yA.exports="2.0.1"});var FA=Se(yh=>{"use strict";function Iu(e){return e.charCodeAt(0).toString(16).toUpperCase()}yh.hex=Iu;function g$(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"+Iu(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Iu(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Iu(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Iu(t))}yh.stringEscape=g$;function m$(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"+Iu(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Iu(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Iu(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Iu(t))}yh.regexpClassEscape=m$});var bA=Se(SA=>{var DA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");SA.encode=function(e){if(0<=e&&e<DA.length)return DA[e];throw new TypeError("Must be between 0 and 63: "+e)}});var $A=Se(BA=>{var v$=bA(),_A=5,IA=1<<_A,E$=IA-1,A$=IA;function w$(e){return e<0?(-e<<1)+1:(e<<1)+0}BA.encode=function(t){let r="",n,i=w$(t);do n=i&E$,i>>>=_A,i>0&&(n|=A$),r+=v$.encode(n);while(i>0);return r}});var Dh=Se(aa=>{function C$(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}aa.getArg=C$;var RA=function(){return!("__proto__"in Object.create(null))}();function TA(e){return e}function y$(e){return OA(e)?"$"+e:e}aa.toSetString=RA?TA:y$;function F$(e){return OA(e)?e.slice(1):e}aa.fromSetString=RA?TA:F$;function OA(e){if(!e)return!1;let t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(let r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function PA(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function D$(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=PA(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:PA(e.name,t.name)}aa.compareByGeneratedPositionsInflated=D$;var Od="http:",ll=`${Od}//host`;function NA(e){return t=>{let r=fl(t),n=Nd(t),i=new URL(t,n);e(i);let u=i.toString();return r==="absolute"?u:r==="scheme-relative"?u.slice(Od.length):r==="path-absolute"?u.slice(ll.length):xd(n,u)}}function sa(e,t){return new URL(e,t).toString()}function S$(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function Nd(e){let t=e.split("..").length-1,r=S$("p",e),n=`${ll}/`;for(let i=0;i<t;i++)n+=`${r}/`;return n}var b$=/^[A-Za-z0-9\+\-\.]+:/;function fl(e){return e[0]==="/"?e[1]==="/"?"scheme-relative":"path-absolute":b$.test(e)?"absolute":"path-relative"}function xd(e,t){typeof e=="string"&&(e=new URL(e)),typeof t=="string"&&(t=new URL(t));let r=t.pathname.split("/"),n=e.pathname.split("/");for(n.length>0&&!n[n.length-1]&&n.pop();r.length>0&&n.length>0&&r[0]===n[0];)r.shift(),n.shift();return n.map(()=>"..").concat(r).join("/")+t.search+t.hash}var _$=NA(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),Fh=NA(e=>{});aa.normalize=Fh;function I$(e,t){let r=fl(t),n=fl(e);if(e=_$(e),r==="absolute")return sa(t,void 0);if(n==="absolute")return sa(t,e);if(r==="scheme-relative")return Fh(t);if(n==="scheme-relative")return sa(t,sa(e,ll)).slice(Od.length);if(r==="path-absolute")return Fh(t);if(n==="path-absolute")return sa(t,sa(e,ll)).slice(ll.length);let i=Nd(t+e),u=sa(t,sa(e,i));return xd(i,u)}aa.join=I$;function B$(e,t){let r=$$(e,t);return typeof r=="string"?r:Fh(t)}aa.relative=B$;function $$(e,t){if(fl(e)!==fl(t))return null;let n=Nd(e+t),i=new URL(e,n),u=new URL(t,n);try{new URL("",u.toString())}catch{return null}return u.protocol!==i.protocol||u.user!==i.user||u.password!==i.password||u.hostname!==i.hostname||u.port!==i.port?null:xd(i,u)}});var kA=Se(xA=>{var kd=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){let n=new e;for(let i=0,u=t.length;i<u;i++)n.add(t[i],r);return n}size(){return this._set.size}add(t,r){let n=this.has(t),i=this._array.length;(!n||r)&&this._array.push(t),n||this._set.set(t,i)}has(t){return this._set.has(t)}indexOf(t){let r=this._set.get(t);if(r>=0)return r;throw new Error('"'+t+'" is not in the set.')}at(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)}toArray(){return this._array.slice()}};xA.ArraySet=kd});var HA=Se(UA=>{var LA=Dh();function P$(e,t){let r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,u=t.generatedColumn;return n>r||n==r&&u>=i||LA.compareByGeneratedPositionsInflated(e,t)<=0}var Ld=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){P$(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(LA.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};UA.MappingList=Ld});var Ud=Se(jA=>{var hl=$A(),jr=Dh(),Sh=kA().ArraySet,R$=HA().MappingList,bh=class e{constructor(t){t||(t={}),this._file=jr.getArg(t,"file",null),this._sourceRoot=jr.getArg(t,"sourceRoot",null),this._skipValidation=jr.getArg(t,"skipValidation",!1),this._sources=new Sh,this._names=new Sh,this._mappings=new R$,this._sourcesContents=null}static fromSourceMap(t){let r=t.sourceRoot,n=new e({file:t.file,sourceRoot:r});return t.eachMapping(function(i){let u={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(u.source=i.source,r!=null&&(u.source=jr.relative(r,u.source)),u.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(u.name=i.name)),n.addMapping(u)}),t.sources.forEach(function(i){let u=i;r!=null&&(u=jr.relative(r,i)),n._sources.has(u)||n._sources.add(u);let s=t.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n}addMapping(t){let r=jr.getArg(t,"generated"),n=jr.getArg(t,"original",null),i=jr.getArg(t,"source",null),u=jr.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,i,u),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),u!=null&&(u=String(u),this._names.has(u)||this._names.add(u)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:i,name:u})}setSourceContent(t,r){let n=t;this._sourceRoot!=null&&(n=jr.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[jr.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[jr.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(t,r,n){let i=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=t.file}let u=this._sourceRoot;u!=null&&(i=jr.relative(u,i));let s=this._mappings.toArray().length>0?new Sh:this._sources,o=new Sh;this._mappings.unsortedForEach(function(l){if(l.source===i&&l.originalLine!=null){let E=t.originalPositionFor({line:l.originalLine,column:l.originalColumn});E.source!=null&&(l.source=E.source,n!=null&&(l.source=jr.join(n,l.source)),u!=null&&(l.source=jr.relative(u,l.source)),l.originalLine=E.line,l.originalColumn=E.column,E.name!=null&&(l.name=E.name))}let f=l.source;f!=null&&!s.has(f)&&s.add(f);let p=l.name;p!=null&&!o.has(p)&&o.add(p)},this),this._sources=s,this._names=o,t.sources.forEach(function(l){let f=t.sourceContentFor(l);f!=null&&(n!=null&&(l=jr.join(n,l)),u!=null&&(l=jr.relative(u,l)),this.setSourceContent(l,f))},this)}_validateMapping(t,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!i)){if(!(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i}))}}_serializeMappings(){let t=0,r=1,n=0,i=0,u=0,s=0,o="",l,f,p,E,d=this._mappings.toArray();for(let h=0,w=d.length;h<w;h++){if(f=d[h],l="",f.generatedLine!==r)for(t=0;f.generatedLine!==r;)l+=";",r++;else if(h>0){if(!jr.compareByGeneratedPositionsInflated(f,d[h-1]))continue;l+=","}l+=hl.encode(f.generatedColumn-t),t=f.generatedColumn,f.source!=null&&(E=this._sources.indexOf(f.source),l+=hl.encode(E-s),s=E,l+=hl.encode(f.originalLine-1-i),i=f.originalLine-1,l+=hl.encode(f.originalColumn-n),n=f.originalColumn,f.name!=null&&(p=this._names.indexOf(f.name),l+=hl.encode(p-u),u=p)),o+=l}return o}_generateSourcesContent(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=jr.relative(r,n));let i=jr.toSetString(n);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())}};bh.prototype._version=3;jA.SourceMapGenerator=bh});var qA=Se(MA=>{var T$=Ud().SourceMapGenerator,_h=Dh(),O$=/(\r?\n)/,N$=10,uc="$$$isSourceNode$$$",Hd=class e{constructor(t,r,n,i,u){this.children=[],this.sourceContents={},this.line=t??null,this.column=r??null,this.source=n??null,this.name=u??null,this[uc]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,r,n){let i=new e,u=t.split(O$),s=0,o=function(){let h=m(),w=m()||"";return h+w;function m(){return s<u.length?u[s++]:void 0}},l=1,f=0,p=null,E;return r.eachMapping(function(h){if(p!==null)if(l<h.generatedLine)d(p,o()),l++,f=0;else{E=u[s]||"";let w=E.substr(0,h.generatedColumn-f);u[s]=E.substr(h.generatedColumn-f),f=h.generatedColumn,d(p,w),p=h;return}for(;l<h.generatedLine;)i.add(o()),l++;f<h.generatedColumn&&(E=u[s]||"",i.add(E.substr(0,h.generatedColumn)),u[s]=E.substr(h.generatedColumn),f=h.generatedColumn),p=h},this),s<u.length&&(p&&d(p,o()),i.add(u.splice(s).join(""))),r.sources.forEach(function(h){let w=r.sourceContentFor(h);w!=null&&(n!=null&&(h=_h.join(n,h)),i.setSourceContent(h,w))}),i;function d(h,w){if(h===null||h.source===void 0)i.add(w);else{let m=n?_h.join(n,h.source):h.source;i.add(new e(h.originalLine,h.originalColumn,m,w,h.name))}}}add(t){if(Array.isArray(t))t.forEach(function(r){this.add(r)},this);else if(t[uc]||typeof t=="string")t&&this.children.push(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this}prepend(t){if(Array.isArray(t))for(let r=t.length-1;r>=0;r--)this.prepend(t[r]);else if(t[uc]||typeof t=="string")this.children.unshift(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this}walk(t){let r;for(let n=0,i=this.children.length;n<i;n++)r=this.children[n],r[uc]?r.walk(t):r!==""&&t(r,{source:this.source,line:this.line,column:this.column,name:this.name})}join(t){let r,n,i=this.children.length;if(i>0){for(r=[],n=0;n<i-1;n++)r.push(this.children[n]),r.push(t);r.push(this.children[n]),this.children=r}return this}replaceRight(t,r){let n=this.children[this.children.length-1];return n[uc]?n.replaceRight(t,r):typeof n=="string"?this.children[this.children.length-1]=n.replace(t,r):this.children.push("".replace(t,r)),this}setSourceContent(t,r){this.sourceContents[_h.toSetString(t)]=r}walkSourceContents(t){for(let n=0,i=this.children.length;n<i;n++)this.children[n][uc]&&this.children[n].walkSourceContents(t);let r=Object.keys(this.sourceContents);for(let n=0,i=r.length;n<i;n++)t(_h.fromSetString(r[n]),this.sourceContents[r[n]])}toString(){let t="";return this.walk(function(r){t+=r}),t}toStringWithSourceMap(t){let r={code:"",line:1,column:0},n=new T$(t),i=!1,u=null,s=null,o=null,l=null;return this.walk(function(f,p){r.code+=f,p.source!==null&&p.line!==null&&p.column!==null?((u!==p.source||s!==p.line||o!==p.column||l!==p.name)&&n.addMapping({source:p.source,original:{line:p.line,column:p.column},generated:{line:r.line,column:r.column},name:p.name}),u=p.source,s=p.line,o=p.column,l=p.name,i=!0):i&&(n.addMapping({generated:{line:r.line,column:r.column}}),u=null,i=!1);for(let E=0,d=f.length;E<d;E++)f.charCodeAt(E)===N$?(r.line++,r.column=0,E+1===d?(u=null,i=!1):i&&n.addMapping({source:p.source,original:{line:p.line,column:p.column},generated:{line:r.line,column:r.column},name:p.name})):r.column++}),this.walkSourceContents(function(f,p){n.setSourceContent(f,p)}),{code:r.code,map:n}}};MA.SourceNode=Hd});var KA=Se(jd=>{jd.SourceMapGenerator=Ud().SourceMapGenerator;jd.SourceNode=qA().SourceNode});var YA=Se((Sx,zA)=>{"use strict";var x$=ia(),qt=Id(),k$=CA(),L$=Td(),{stringEscape:Pi,regexpClassEscape:Md}=FA(),{SourceNode:Yi}=KA();function GA(e,t,r){let n=t.start.line,i=t.start.column-1,u=e.split(`
`);return u.length===1?new Yi(n,i,t.source,e,r):new Yi(null,null,t.source,u.map((s,o)=>new Yi(n+o,o===0?i:0,t.source,o===u.length-1?s:[s,`
`],r)))}function VA(e,t,r,n,i){return r?new Yi(null,null,r.source,[e,GA(t,r,i),new Yi(r.end.line,r.end.column-1,r.source,n)]):new Yi(null,null,null,[e,t,n])}function U$(e,t){function r(m){return m instanceof Yi?m:m.replace(/^(.+)$/gm," $1")}function n(m){return"peg$c"+m}function i(m){return"peg$r"+m}function u(m){return"peg$e"+m}function s(m){return"peg$f"+m}function o(m){return"peg$parse"+m}function l(){function m(S){return'"'+Pi(S)+'"'}function y(S){return"/^["+(S.inverted?"^":"")+S.value.map(B=>Array.isArray(B)?Md(B[0])+"-"+Md(B[1]):Md(B)).join("")+"]/"+(S.ignoreCase?"i":"")}function A(S){switch(S.type){case"rule":return'peg$otherExpectation("'+Pi(S.value)+'")';case"literal":return'peg$literalExpectation("'+Pi(S.value)+'", '+S.ignoreCase+")";case"class":return"peg$classExpectation(["+S.value.map(I=>Array.isArray(I)?'["'+Pi(I[0])+'", "'+Pi(I[1])+'"]':'"'+Pi(I)+'"').join(", ")+"], "+S.inverted+", "+S.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(S)+")")}}function C(S,B){return VA(`
var ${s(B)} = function(${S.params.join(", ")}) {`,S.body,S.location,"};")}return new Yi(null,null,t.grammarSource,[e.literals.map((S,B)=>" var "+n(B)+" = "+m(S)+";").concat("",e.classes.map((S,B)=>" var "+i(B)+" = "+y(S)+";")).concat("",e.expectations.map((S,B)=>" var "+u(B)+" = "+A(S)+";")).concat("").join(`
`),e.functions.map(C)])}function f(m,y){let A=[];return A.push(""),t.trace&&A.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)","});",""),t.cache&&(A.push("var key = peg$currPos * "+e.rules.length+" + "+y+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&A.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+m+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),A.push(" return cached.result;","}","")),A}function p(m,y){let A=[];return t.cache&&A.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+y+" };"),t.trace&&A.push("","if ("+y+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+m+","," result: "+y+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)"," });","}"),A.push("","return "+y+";"),A}function E(m){let y=[],A=new k$(m.name,"s","var");function C(B){let I=0,M=B.length,q=[],b;function R(G,Y){let V=Y+3,z=B[I+V-2],J=B[I+V-1],se,De;A.checkedIf(I,()=>{I+=V,se=C(B.slice(I,I+z)),I+=z},J>0?()=>{De=C(B.slice(I,I+J)),I+=J}:null),q.push("if ("+G+") {"),q.push(...se.map(r)),J>0&&(q.push("} else {"),q.push(...De.map(r))),q.push("}")}function L(G){let V=B[I+2-1],z;A.checkedLoop(I,()=>{I+=2,z=C(B.slice(I,I+V)),I+=V}),q.push("while ("+G+") {"),q.push(...z.map(r)),q.push("}")}function j(){let Y=B[I+4-1],V=s(B[I+1])+"("+B.slice(I+4,I+4+Y).map(z=>A.index(z)).join(", ")+")";A.pop(B[I+2]),q.push(A.push(V)),I+=4+Y}for(;I<M;)switch(B[I]){case qt.PUSH_EMPTY_STRING:q.push(A.push("''")),I++;break;case qt.PUSH_CURR_POS:q.push(A.push("peg$currPos")),I++;break;case qt.PUSH_UNDEFINED:q.push(A.push("undefined")),I++;break;case qt.PUSH_NULL:q.push(A.push("null")),I++;break;case qt.PUSH_FAILED:q.push(A.push("peg$FAILED")),I++;break;case qt.PUSH_EMPTY_ARRAY:q.push(A.push("[]")),I++;break;case qt.POP:A.pop(),I++;break;case qt.POP_CURR_POS:q.push("peg$currPos = "+A.pop()+";"),I++;break;case qt.POP_N:A.pop(B[I+1]),I+=2;break;case qt.NIP:b=A.pop(),A.pop(),q.push(A.push(b)),I++;break;case qt.APPEND:b=A.pop(),q.push(A.top()+".push("+b+");"),I++;break;case qt.WRAP:q.push(A.push("["+A.pop(B[I+1]).join(", ")+"]")),I+=2;break;case qt.TEXT:q.push(A.push("input.substring("+A.pop()+", peg$currPos)")),I++;break;case qt.PLUCK:{let Y=B[I+3-1],V=3+Y;b=B.slice(I+3,I+V),b=Y===1?A.index(b[0]):`[ ${b.map(z=>A.index(z)).join(", ")} ]`,A.pop(B[I+1]),q.push(A.push(b)),I+=V;break}case qt.IF:R(A.top(),0);break;case qt.IF_ERROR:R(A.top()+" === peg$FAILED",0);break;case qt.IF_NOT_ERROR:R(A.top()+" !== peg$FAILED",0);break;case qt.WHILE_NOT_ERROR:L(A.top()+" !== peg$FAILED");break;case qt.MATCH_ANY:R("input.length > peg$currPos",0);break;case qt.MATCH_STRING:R(e.literals[B[I+1]].length>1?"input.substr(peg$currPos, "+e.literals[B[I+1]].length+") === "+n(B[I+1]):"input.charCodeAt(peg$currPos) === "+e.literals[B[I+1]].charCodeAt(0),1);break;case qt.MATCH_STRING_IC:R("input.substr(peg$currPos, "+e.literals[B[I+1]].length+").toLowerCase() === "+n(B[I+1]),1);break;case qt.MATCH_CHAR_CLASS:R(i(B[I+1])+".test(input.charAt(peg$currPos))",1);break;case qt.ACCEPT_N:q.push(A.push(B[I+1]>1?"input.substr(peg$currPos, "+B[I+1]+")":"input.charAt(peg$currPos)")),q.push(B[I+1]>1?"peg$currPos += "+B[I+1]+";":"peg$currPos++;"),I+=2;break;case qt.ACCEPT_STRING:q.push(A.push(n(B[I+1]))),q.push(e.literals[B[I+1]].length>1?"peg$currPos += "+e.literals[B[I+1]].length+";":"peg$currPos++;"),I+=2;break;case qt.FAIL:q.push(A.push("peg$FAILED")),q.push("if (peg$silentFails === 0) { peg$fail("+u(B[I+1])+"); }"),I+=2;break;case qt.LOAD_SAVED_POS:q.push("peg$savedPos = "+A.index(B[I+1])+";"),I+=2;break;case qt.UPDATE_SAVED_POS:q.push("peg$savedPos = peg$currPos;"),I++;break;case qt.CALL:j();break;case qt.RULE:q.push(A.push(o(e.rules[B[I+1]].name)+"()")),I+=2;break;case qt.SILENT_FAILS_ON:q.push("peg$silentFails++;"),I++;break;case qt.SILENT_FAILS_OFF:q.push("peg$silentFails--;"),I++;break;default:throw new Error("Invalid opcode: "+B[I]+".")}return q}let S=C(m.bytecode);return y.push(VA(" function ",o(m.name),m.nameLocation,`() {
`,m.name)),t.trace&&y.push(" var startPos = peg$currPos;"),y.push(r(A.defines())),y.push(...f('"'+Pi(m.name)+'"',x$.indexOfRule(e,m.name)).map(r)),y.push(...S.map(r)),y.push(...p('"'+Pi(m.name)+'"',A.result()).map(r)),y.push("}"),y}function d(m){return m.codeLocation?GA(m.code,m.codeLocation,"$"+m.type):m.code}function h(){let m=[];e.topLevelInitializer&&(m.push(d(e.topLevelInitializer)),m.push("")),m.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&&m.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(C=>C+": "+o(C)).join(", ")+" }",A=o(t.allowedStartRules[0]);return m.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 = "+A+";","",l(),""," 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&&m.push(" var peg$resultsCache = {};",""),t.trace&&m.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),m.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(C=>{m.push(...E(C).map(r)),m.push("")}),e.initializer&&(m.push(d(e.initializer)),m.push("")),m.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 Yi(null,null,t.grammarSource,m.map(C=>C instanceof Yi?C:C+`
`))}function w(m){function y(){return[`// Generated by Peggy ${L$}.`,"//","// https://peggyjs.org/"]}function A(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(`
`):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(`
`)}let S={bare(){return[...y(),"(function() {",' "use strict";',"",m,"",r("return "+A()+";"),"})()"]},commonjs(){let B=Object.keys(t.dependencies),I=y();return I.push("",'"use strict";',""),B.length>0&&(B.forEach(M=>{I.push("var "+M+' = require("'+Pi(t.dependencies[M])+'");')}),I.push("")),I.push(m,"","module.exports = "+A()+";"),I},es(){let B=Object.keys(t.dependencies),I=y();return I.push(""),B.length>0&&(B.forEach(M=>{I.push("import "+M+' from "'+Pi(t.dependencies[M])+'";')}),I.push("")),I.push(m,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),I},amd(){let B=Object.keys(t.dependencies),M="["+B.map(b=>t.dependencies[b]).map(b=>'"'+Pi(b)+'"').join(", ")+"]",q=B.join(", ");return[...y(),"define("+M+", function("+q+") {",' "use strict";',"",m,"",r("return "+A()+";"),"});"]},globals(){return[...y(),"(function(root) {",' "use strict";',"",m,"",r("root."+t.exportVar+" = "+A()+";"),"})(this);"]},umd(){let B=Object.keys(t.dependencies),I=B.map(L=>t.dependencies[L]),M="["+I.map(L=>'"'+Pi(L)+'"').join(", ")+"]",q=I.map(L=>'require("'+Pi(L)+'")').join(", "),b=B.join(", "),R=y();return R.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+M+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+q+");"),t.exportVar!==null&&R.push(" } else {"," root."+t.exportVar+" = factory();"),R.push(" }","})(this, function("+b+") {",' "use strict";',"",m,"",r("return "+A()+";"),"});"),R}}[t.format]();return new Yi(null,null,t.grammarSource,S.map(B=>B instanceof Yi?B:B+`
`))}e.code=w(h())}zA.exports=U$});var JA=Se((bx,WA)=>{"use strict";var H$=ia(),j$=zi();function M$(e,t,r){function n(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,o,l){j$.build({rule_ref(p){p.name===o&&(p.name=l,r.info(`Proxy rule "${o}" replaced by the rule "${l}"`,p.location,[{message:"This rule will be used",location:H$.findRule(s,l).nameLocation}]))}})(s)}let u=[];e.rules.forEach((s,o)=>{n(s)&&(i(e,s.name,s.expression.name),t.allowedStartRules.indexOf(s.name)===-1&&u.push(o))}),u.reverse(),u.forEach(s=>{e.rules.splice(s,1)})}WA.exports=M$});var ZA=Se((_x,XA)=>{"use strict";var q$=zi();function K$(e,t,r){function n(s){let o={};return Object.keys(s).forEach(l=>{o[l]=s[l]}),o}function i(s,o){u(s.expression,n(o))}let u=q$.build({rule(s){u(s.expression,{})},choice(s,o){s.alternatives.forEach(l=>{u(l,n(o))})},action:i,labeled(s,o){let l=s.label;l&&Object.prototype.hasOwnProperty.call(o,l)&&r.error(`Label "${s.label}" is already defined`,s.labelLocation,[{message:"Original label location",location:o[l]}]),u(s.expression,o),o[s.label]=s.labelLocation},text:i,simple_and:i,simple_not:i,optional:i,zero_or_more:i,one_or_more:i,group:i});u(e)}XA.exports=K$});var ew=Se((Ix,QA)=>{"use strict";var V$=zi();function G$(e,t,r){let n={};V$.build({rule(u){if(Object.prototype.hasOwnProperty.call(n,u.name)){r.error(`Rule "${u.name}" is already defined`,u.nameLocation,[{message:"Original rule location",location:n[u.name]}]);return}n[u.name]=u.nameLocation}})(e)}QA.exports=G$});var nw=Se((Bx,rw)=>{"use strict";var tw=ia(),z$=zi();function Y$(e,t,r){let n=[],i=[],u=z$.build({rule(s){n.push(s.name),u(s.expression),n.pop()},sequence(s){s.elements.every(o=>(u(o),!tw.alwaysConsumesOnSuccess(e,o)))},rule_ref(s){i.push(s);let o=tw.findRule(e,s.name);if(n.indexOf(s.name)!==-1){n.push(s.name),r.error("Possible infinite loop when parsing (left recursion: "+n.join(" -> ")+")",o.nameLocation,i.map((l,f,p)=>({message:f+1!==p.length?`Step ${f+1}: call of the rule "${l.name}" without input consumption`:`Step ${f+1}: call itself without input consumption - left recursion`,location:l.location})));return}o&&u(o),i.pop()}});u(e)}rw.exports=Y$});var uw=Se(($x,sw)=>{"use strict";var iw=ia(),W$=zi();function J$(e,t,r){W$.build({zero_or_more(i){iw.alwaysConsumesOnSuccess(e,i.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",i.location)},one_or_more(i){iw.alwaysConsumesOnSuccess(e,i.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",i.location)}})(e)}sw.exports=J$});var ow=Se((Px,aw)=>{"use strict";var X$=ia(),Z$=zi();function Q$(e,t,r){Z$.build({rule_ref(i){X$.findRule(e,i.name)||r.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}aw.exports=Q$});var lw=Se((Rx,cw)=>{"use strict";var e7=zi();function t7(e,t,r){let n=e7.build({action(i){n(i.expression,i)},labeled(i,u){i.pick&&u&&r.error('"@" cannot be used with an action block',i.labelLocation,[{message:"Action block location",location:u.codeLocation}]),n(i.expression)}});n(e)}cw.exports=t7});var hw=Se((Tx,fw)=>{"use strict";var r7=wh(),qd=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(){}},Kd=class{constructor(t){this._callbacks=new qd(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new r7(...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}};fw.exports=Kd});var pw=Se((exports,module)=>{"use strict";var generateBytecode=AA(),generateJS=YA(),inferenceMatchResult=Bd(),removeProxyRules=JA(),reportDuplicateLabels=ZA(),reportDuplicateRules=ew(),reportInfiniteRecursion=nw(),reportInfiniteRepetition=uw(),reportUndefinedRules=ow(),reportIncorrectPlucking=lw(),Session=hw(),visitor=zi();function processOptions(e,t){let r={};return Object.keys(e).forEach(n=>{r[n]=e[n]}),Object.keys(t).forEach(n=>{Object.prototype.hasOwnProperty.call(r,n)||(r[n]=t[n])}),r}var compiler={visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile(ast,passes,options){if(options=options!==void 0?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(options.allowedStartRules.length===0)throw new Error("Must have at least one start rule");let allRules=ast.rules.map(e=>e.name);for(let e of options.allowedStartRules)if(allRules.indexOf(e)===-1)throw new Error(`Unknown start rule "${e}"`);let session=new Session(options);switch(Object.keys(passes).forEach(e=>{session.stage=e,session.info(`Process stage ${e}`),passes[e].forEach(t=>{session.info(`Process pass ${e}.${t.name}`),t(ast,options,session)}),session.checkErrors()}),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;default:throw new Error("Invalid output format: "+options.output+".")}}};module.exports=compiler});var gw=Se((Ox,dw)=>{"use strict";var n7={$:"text","&":"simple_and","!":"simple_not"},i7={"?":"optional","*":"zero_or_more","+":"one_or_more"},s7={"&":"semantic_and","!":"semantic_not"};function u7(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function oa(e,t,r,n){var i=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(i,oa.prototype),i.expected=t,i.found=r,i.location=n,i.name="SyntaxError",i}u7(oa,Error);function Vd(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,r+=r.repeat(t),e+r.slice(0,t))}oa.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n<e.length;n++)if(e[n].source===this.location.source){r=e[n].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,u=this.location.source+":"+i.line+":"+i.column;if(r){var s=this.location.end,o=Vd("",i.line.toString().length," "),l=r[i.line-1],f=i.line===s.line?s.column:l.length+1,p=f-i.column||1;t+=`
--> `+u+`
`+o+` |
`+i.line+" | "+l+`
`+o+" | "+Vd("",i.column-1," ")+Vd("",p,"^")}else t+=`
at `+u}return t};oa.buildMessage=function(e,t){var r={literal:function(f){return'"'+i(f.text)+'"'},class:function(f){var p=f.parts.map(function(E){return Array.isArray(E)?u(E[0])+"-"+u(E[1]):u(E)});return"["+(f.inverted?"^":"")+p.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(f){return f.description}};function n(f){return f.charCodeAt(0).toString(16).toUpperCase()}function i(f){return f.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(p){return"\\x0"+n(p)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(p){return"\\x"+n(p)})}function u(f){return f.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(p){return"\\x0"+n(p)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(p){return"\\x"+n(p)})}function s(f){return r[f.type](f)}function o(f){var p=f.map(s),E,d;if(p.sort(),p.length>0){for(E=1,d=1;E<p.length;E++)p[E-1]!==p[E]&&(p[d]=p[E],d++);p.length=d}switch(p.length){case 1:return p[0];case 2:return p[0]+" or "+p[1];default:return p.slice(0,-1).join(", ")+", or "+p[p.length-1]}}function l(f){return f?'"'+i(f)+'"':"end of input"}return"Expected "+o(e)+" but "+l(t)+" found."};function a7(e,t){t=t!==void 0?t:{};var r={},n=t.grammarSource,i={Grammar:no},u=no,s="{",o="}",l="=",f="/",p="@",E=":",d="$",h="&",w="!",m="?",y="*",A="+",C="(",S=")",B=" ",I="\v",M="\f",q=" ",b="\xA0",R="\uFEFF",L=`
`,j=`\r
`,G="\r",Y="\u2028",V="\u2029",z="/*",J="*/",se="//",De="_",ye="\\",Pe="\u200C",Qe="\u200D",ce="i",Be='"',Ge="'",Tr="[",Jt="^",St="]",wr="-",cr="0",vt="b",Xt="f",at="n",Je="r",lr="t",Ve="v",Lt="x",un="u",ir=".",Zt=";",wt=/^[\n\r\u2028\u2029]/,Or=/^[0-9]/,pi=/^[0-9a-f]/i,an=/^[{}]/,It=/^[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]/,qe=/^[\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]/,_e=/^[\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]/,Cr=/^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/,on=/^[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]/,ot=/^[\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]/,Ks=/^[\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]/,cn=/^[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]/,ge=/^[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/,cs=/^[_\u203F-\u2040\u2054\uFE33-\uFE34\uFE4D-\uFE4F\uFF3F]/,Tt=/^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,Yr=Xe("{",!1),Ji=Xe("}",!1),Pu=Xe("=",!1),ls=Xe("/",!1),Ru=Xe("@",!1),hs=Xe(":",!1),Xi=Xe("$",!1),Ut=Xe("&",!1),zn=Xe("!",!1),Tu=Xe("?",!1),Ou=Xe("*",!1),Nu=Xe("+",!1),ps=Xe("(",!1),ca=Xe(")",!1),ds=Lu(),la=Ni("whitespace"),Vs=Xe(" ",!1),re=Xe("\v",!1),fe=Xe("\f",!1),je=Xe(" ",!1),xe=Xe("\xA0",!1),We=Xe("\uFEFF",!1),ct=kr([`
`,"\r","\u2028","\u2029"],!1,!1),gt=Ni("end of line"),Br=Xe(`
`,!1),Kt=Xe(`\r
`,!1),Yn=Xe("\r",!1),Ti=Xe("\u2028",!1),ln=Xe("\u2029",!1),An=Ni("comment"),yr=Xe("/*",!1),fn=Xe("*/",!1),Mr=Xe("//",!1),fa=Ni("identifier"),gs=Xe("_",!1),Rn=Xe("\\",!1),xt=Xe("\u200C",!1),Fr=Xe("\u200D",!1),it=Ni("literal"),fr=Xe("i",!1),Wr=Ni("string"),hr=Xe('"',!1),Vt=Xe("'",!1),Tn=Ni("character class"),Wn=Xe("[",!1),Jn=Xe("^",!1),On=Xe("]",!1),Nr=Xe("-",!1),dr=Xe("0",!1),lc=Xe("b",!1),ha=Xe("f",!1),Jr=Xe("n",!1),pa=Xe("r",!1),eo=Xe("t",!1),to=Xe("v",!1),da=Xe("x",!1),vs=Xe("u",!1),ga=kr([["0","9"]],!1,!1),ro=kr([["0","9"],["a","f"]],!1,!0),ma=Xe(".",!1),va=Ni("code block"),Nn=kr(["{","}"],!1,!1),T=kr([["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),N=kr([["\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),H=kr(["\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),Q=kr(["\u01C5","\u01C8","\u01CB","\u01F2",["\u1F88","\u1F8F"],["\u1F98","\u1F9F"],["\u1FA8","\u1FAF"],"\u1FBC","\u1FCC","\u1FFC"],!1,!1),ve=kr([["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),we=kr(["\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),$e=kr([["\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),Ne=kr([["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),Qt=kr([["\u16EE","\u16F0"],["\u2160","\u2182"],["\u2185","\u2188"],"\u3007",["\u3021","\u3029"],["\u3038","\u303A"],["\uA6E6","\uA6EF"]],!1,!1),Dr=kr(["_",["\u203F","\u2040"],"\u2054",["\uFE33","\uFE34"],["\uFE4D","\uFE4F"],"\uFF3F"],!1,!1),hn=kr([" ","\xA0","\u1680",["\u2000","\u200A"],"\u202F","\u205F","\u3000"],!1,!1),pn=Xe(";",!1),di=function(F,x,X){return{type:"grammar",topLevelInitializer:F,initializer:x,rules:X,location:mr()}},xu=function(F){return{type:"top_level_initializer",code:F[0],codeLocation:F[1],location:mr()}},xn=function(F){return{type:"initializer",code:F[0],codeLocation:F[1],location:mr()}},dn=function(F,x,X){return{type:"rule",name:F[0],nameLocation:F[1],expression:x!==null?{type:"named",name:x,expression:X,location:mr()}:X,location:mr()}},ku=function(F,x){return x.length>0?{type:"choice",alternatives:[F].concat(x),location:mr()}:F},Oi=function(F,x){return x!==null?{type:"action",expression:F,code:x[0],codeLocation:x[1],location:mr()}:F},Ea=function(F,x){return x.length>0||F.type==="labeled"&&F.pick?{type:"sequence",elements:[F].concat(x),location:mr()}:F},Lh=function(F,x,X){return X.type.startsWith("semantic_")&&dc('"@" cannot be used on a semantic predicate',F),{type:"labeled",label:x!==null?x[0]:null,labelLocation:x!==null?x[1]:F,pick:!0,expression:X,location:mr()}},Uh=function(F,x){return{type:"labeled",label:F[0],labelLocation:F[1],expression:x,location:mr()}},sr=function(){return mr()},rr=function(F){return mo.indexOf(F[0])>=0&&dc(`Label can't be a reserved word "${F[0]}"`,F[1]),F},Hh=function(F,x){return{type:n7[F],expression:x,location:mr()}},jh=function(F,x){return{type:i7[x],expression:F,location:mr()}},Mh=function(F){return F.type==="labeled"||F.type==="sequence"?{type:"group",expression:F,location:mr()}:F},qh=function(F){return{type:"rule_ref",name:F[0],location:mr()}},Kh=function(F,x){return{type:s7[F],code:x[0],codeLocation:x[1],location:mr()}},Vh=function(F,x){return[F+x.join(""),mr()]},ml=function(F,x){return{type:"literal",value:F,ignoreCase:x!==null,location:mr()}},Gh=function(F){return F.join("")},xr=function(F){return F.join("")},fc=function(F,x,X){return{type:"class",parts:x.filter(K=>K!==""),inverted:F!==null,ignoreCase:X!==null,location:mr()}},Gs=function(F,x){return F.charCodeAt(0)>x.charCodeAt(0)&&dc("Invalid character range: "+pc()+"."),[F,x]},vl=function(){return""},hc=function(){return"\0"},Xn=function(){return"\b"},El=function(){return"\f"},Al=function(){return`
`},wl=function(){return"\r"},Cl=function(){return" "},yl=function(){return"\v"},Fl=function(F){return String.fromCharCode(parseInt(F,16))},kn=function(F){return String.fromCharCode(parseInt(F,16))},zh=function(){return{type:"any",location:mr()}},Zn=function(F){return[F,mr()]},P=0,lt=0,gi=[{line:1,column:1}],Ln=0,Aa=[],te=0,mi;if("startRule"in t){if(!(t.startRule in i))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');u=i[t.startRule]}function pc(){return e.substring(lt,P)}function I1(){return lt}function Dl(){return{source:n,start:lt,end:P}}function mr(){return zs(lt,P)}function B1(F,x){throw x=x!==void 0?x:zs(lt,P),bl([Ni(F)],e.substring(lt,P),x)}function dc(F,x){throw x=x!==void 0?x:zs(lt,P),Sl(F,x)}function Xe(F,x){return{type:"literal",text:F,ignoreCase:x}}function kr(F,x,X){return{type:"class",parts:F,inverted:x,ignoreCase:X}}function Lu(){return{type:"any"}}function Yh(){return{type:"end"}}function Ni(F){return{type:"other",description:F}}function gc(F){var x=gi[F],X;if(x)return x;for(X=F-1;!gi[X];)X--;for(x=gi[X],x={line:x.line,column:x.column};X<F;)e.charCodeAt(X)===10?(x.line++,x.column=1):x.column++,X++;return gi[F]=x,x}function zs(F,x){var X=gc(F),K=gc(x);return{source:n,start:{offset:F,line:X.line,column:X.column},end:{offset:x,line:K.line,column:K.column}}}function me(F){P<Ln||(P>Ln&&(Ln=P,Aa=[]),Aa.push(F))}function Sl(F,x){return new oa(F,null,null,x)}function bl(F,x,X){return new oa(oa.buildMessage(F,x),F,x,X)}function no(){var F,x,X,K,ue,le,tr,Sr;if(F=P,x=jt(),X=P,K=mc(),K!==r?(ue=jt(),X=K):(P=X,X=r),X===r&&(X=null),K=P,ue=Wh(),ue!==r?(le=jt(),K=ue):(P=K,K=r),K===r&&(K=null),ue=[],le=P,tr=vc(),tr!==r?(Sr=jt(),le=tr):(P=le,le=r),le!==r)for(;le!==r;)ue.push(le),le=P,tr=vc(),tr!==r?(Sr=jt(),le=tr):(P=le,le=r);else ue=r;return ue!==r?(lt=F,F=di(X,K,ue)):(P=F,F=r),F}function mc(){var F,x,X,K,ue;return F=P,e.charCodeAt(P)===123?(x=s,P++):(x=r,te===0&&me(Yr)),x!==r?(X=Ot(),X!==r?(e.charCodeAt(P)===125?(K=o,P++):(K=r,te===0&&me(Ji)),K!==r?(ue=Xs(),ue!==r?(lt=F,F=xu(X)):(P=F,F=r)):(P=F,F=r)):(P=F,F=r)):(P=F,F=r),F}function Wh(){var F,x,X;return F=P,x=Ot(),x!==r?(X=Xs(),X!==r?(lt=F,F=xn(x)):(P=F,F=r)):(P=F,F=r),F}function vc(){var F,x,X,K,ue,le,tr,Sr;return F=P,x=uo(),x!==r?(X=jt(),K=P,ue=xi(),ue!==r?(le=jt(),K=ue):(P=K,K=r),K===r&&(K=null),e.charCodeAt(P)===61?(ue=l,P++):(ue=r,te===0&&me(Pu)),ue!==r?(le=jt(),tr=wn(),tr!==r?(Sr=Xs(),Sr!==r?(lt=F,F=dn(x,K,tr)):(P=F,F=r)):(P=F,F=r)):(P=F,F=r)):(P=F,F=r),F}function wn(){var F,x,X,K,ue,le,tr,Sr;if(F=P,x=wa(),x!==r){for(X=[],K=P,ue=jt(),e.charCodeAt(P)===47?(le=f,P++):(le=r,te===0&&me(ls)),le!==r?(tr=jt(),Sr=wa(),Sr!==r?K=Sr:(P=K,K=r)):(P=K,K=r);K!==r;)X.push(K),K=P,ue=jt(),e.charCodeAt(P)===47?(le=f,P++):(le=r,te===0&&me(ls)),le!==r?(tr=jt(),Sr=wa(),Sr!==r?K=Sr:(P=K,K=r)):(P=K,K=r);lt=F,F=ku(x,X)}else P=F,F=r;return F}function wa(){var F,x,X,K,ue;return F=P,x=Ca(),x!==r?(X=P,K=jt(),ue=Ot(),ue!==r?X=ue:(P=X,X=r),X===r&&(X=null),lt=F,F=Oi(x,X)):(P=F,F=r),F}function Ca(){var F,x,X,K,ue,le;if(F=P,x=io(),x!==r){for(X=[],K=P,ue=jt(),le=io(),le!==r?K=le:(P=K,K=r);K!==r;)X.push(K),K=P,ue=jt(),le=io(),le!==r?K=le:(P=K,K=r);lt=F,F=Ea(x,X)}else P=F,F=r;return F}function io(){var F,x,X,K;return F=P,x=_l(),x!==r?(X=Il(),X===r&&(X=null),K=Ec(),K!==r?(lt=F,F=Lh(x,X,K)):(P=F,F=r)):(P=F,F=r),F===r&&(F=P,x=Il(),x!==r?(X=jt(),K=Ec(),K!==r?(lt=F,F=Uh(x,K)):(P=F,F=r)):(P=F,F=r),F===r&&(F=Ec())),F}function _l(){var F,x;return F=P,e.charCodeAt(P)===64?(x=p,P++):(x=r,te===0&&me(Ru)),x!==r&&(lt=F,x=sr()),F=x,F}function Il(){var F,x,X,K;return F=P,x=uo(),x!==r?(X=jt(),e.charCodeAt(P)===58?(K=E,P++):(K=r,te===0&&me(hs)),K!==r?(lt=F,F=rr(x)):(P=F,F=r)):(P=F,F=r),F}function Ec(){var F,x,X,K;return F=P,x=Jh(),x!==r?(X=jt(),K=Bl(),K!==r?(lt=F,F=Hh(x,K)):(P=F,F=r)):(P=F,F=r),F===r&&(F=Bl()),F}function Jh(){var F;return e.charCodeAt(P)===36?(F=d,P++):(F=r,te===0&&me(Xi)),F===r&&(e.charCodeAt(P)===38?(F=h,P++):(F=r,te===0&&me(Ut)),F===r&&(e.charCodeAt(P)===33?(F=w,P++):(F=r,te===0&&me(zn)))),F}function Bl(){var F,x,X,K;return F=P,x=Ys(),x!==r?(X=jt(),K=Xh(),K!==r?(lt=F,F=jh(x,K)):(P=F,F=r)):(P=F,F=r),F===r&&(F=Ys()),F}function Xh(){var F;return e.charCodeAt(P)===63?(F=m,P++):(F=r,te===0&&me(Tu)),F===r&&(e.charCodeAt(P)===42?(F=y,P++):(F=r,te===0&&me(Ou)),F===r&&(e.charCodeAt(P)===43?(F=A,P++):(F=r,te===0&&me(Nu)))),F}function Ys(){var F,x,X,K,ue,le;return F=n0(),F===r&&(F=oe(),F===r&&(F=co(),F===r&&(F=Zh(),F===r&&(F=Qh(),F===r&&(F=P,e.charCodeAt(P)===40?(x=C,P++):(x=r,te===0&&me(ps)),x!==r?(X=jt(),K=wn(),K!==r?(ue=jt(),e.charCodeAt(P)===41?(le=S,P++):(le=r,te===0&&me(ca)),le!==r?(lt=F,F=Mh(K)):(P=F,F=r)):(P=F,F=r)):(P=F,F=r)))))),F}function Zh(){var F,x,X,K,ue,le,tr,Sr;return F=P,x=uo(),x!==r?(X=P,te++,K=P,ue=jt(),le=P,tr=xi(),tr!==r?(Sr=jt(),tr=[tr,Sr],le=tr):(P=le,le=r),le===r&&(le=null),e.charCodeAt(P)===61?(tr=l,P++):(tr=r,te===0&&me(Pu)),tr!==r?(ue=[ue,le,tr],K=ue):(P=K,K=r),te--,K===r?X=void 0:(P=X,X=r),X!==r?(lt=F,F=qh(x)):(P=F,F=r)):(P=F,F=r),F}function Qh(){var F,x,X,K;return F=P,x=Ac(),x!==r?(X=jt(),K=Ot(),K!==r?(lt=F,F=Kh(x,K)):(P=F,F=r)):(P=F,F=r),F}function Ac(){var F;return e.charCodeAt(P)===38?(F=h,P++):(F=r,te===0&&me(Ut)),F===r&&(e.charCodeAt(P)===33?(F=w,P++):(F=r,te===0&&me(zn))),F}function gn(){var F;return e.length>P?(F=e.charAt(P),P++):(F=r,te===0&&me(ds)),F}function vi(){var F,x;return te++,e.charCodeAt(P)===9?(F=B,P++):(F=r,te===0&&me(Vs)),F===r&&(e.charCodeAt(P)===11?(F=I,P++):(F=r,te===0&&me(re)),F===r&&(e.charCodeAt(P)===12?(F=M,P++):(F=r,te===0&&me(fe)),F===r&&(e.charCodeAt(P)===32?(F=q,P++):(F=r,te===0&&me(je)),F===r&&(e.charCodeAt(P)===160?(F=b,P++):(F=r,te===0&&me(xe)),F===r&&(e.charCodeAt(P)===65279?(F=R,P++):(F=r,te===0&&me(We)),F===r&&(F=xl())))))),te--,F===r&&(x=r,te===0&&me(la)),F}function Ei(){var F;return wt.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(ct)),F}function so(){var F,x;return te++,e.charCodeAt(P)===10?(F=L,P++):(F=r,te===0&&me(Br)),F===r&&(e.substr(P,2)===j?(F=j,P+=2):(F=r,te===0&&me(Kt)),F===r&&(e.charCodeAt(P)===13?(F=G,P++):(F=r,te===0&&me(Yn)),F===r&&(e.charCodeAt(P)===8232?(F=Y,P++):(F=r,te===0&&me(Ti)),F===r&&(e.charCodeAt(P)===8233?(F=V,P++):(F=r,te===0&&me(ln)))))),te--,F===r&&(x=r,te===0&&me(gt)),F}function $l(){var F,x;return te++,F=e0(),F===r&&(F=Qn()),te--,F===r&&(x=r,te===0&&me(An)),F}function e0(){var F,x,X,K,ue,le;if(F=P,e.substr(P,2)===z?(x=z,P+=2):(x=r,te===0&&me(yr)),x!==r){for(X=[],K=P,ue=P,te++,e.substr(P,2)===J?(le=J,P+=2):(le=r,te===0&&me(fn)),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r);K!==r;)X.push(K),K=P,ue=P,te++,e.substr(P,2)===J?(le=J,P+=2):(le=r,te===0&&me(fn)),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r);e.substr(P,2)===J?(K=J,P+=2):(K=r,te===0&&me(fn)),K!==r?(x=[x,X,K],F=x):(P=F,F=r)}else P=F,F=r;return F}function Ws(){var F,x,X,K,ue,le;if(F=P,e.substr(P,2)===z?(x=z,P+=2):(x=r,te===0&&me(yr)),x!==r){for(X=[],K=P,ue=P,te++,e.substr(P,2)===J?(le=J,P+=2):(le=r,te===0&&me(fn)),le===r&&(le=Ei()),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r);K!==r;)X.push(K),K=P,ue=P,te++,e.substr(P,2)===J?(le=J,P+=2):(le=r,te===0&&me(fn)),le===r&&(le=Ei()),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r);e.substr(P,2)===J?(K=J,P+=2):(K=r,te===0&&me(fn)),K!==r?(x=[x,X,K],F=x):(P=F,F=r)}else P=F,F=r;return F}function Qn(){var F,x,X,K,ue,le;if(F=P,e.substr(P,2)===se?(x=se,P+=2):(x=r,te===0&&me(Mr)),x!==r){for(X=[],K=P,ue=P,te++,le=Ei(),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r);K!==r;)X.push(K),K=P,ue=P,te++,le=Ei(),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r);x=[x,X],F=x}else P=F,F=r;return F}function uo(){var F,x,X,K;if(te++,F=P,x=Pl(),x!==r){for(X=[],K=Rl();K!==r;)X.push(K),K=Rl();lt=F,F=Vh(x,X)}else P=F,F=r;return te--,F===r&&(x=r,te===0&&me(fa)),F}function Pl(){var F,x,X;return F=t0(),F===r&&(e.charCodeAt(P)===36?(F=d,P++):(F=r,te===0&&me(Xi)),F===r&&(e.charCodeAt(P)===95?(F=De,P++):(F=r,te===0&&me(gs)),F===r&&(F=P,e.charCodeAt(P)===92?(x=ye,P++):(x=r,te===0&&me(Rn)),x!==r?(X=Tl(),X!==r?F=X:(P=F,F=r)):(P=F,F=r)))),F}function Rl(){var F;return F=Pl(),F===r&&(F=r0(),F===r&&(F=Ol(),F===r&&(F=Nl(),F===r&&(e.charCodeAt(P)===8204?(F=Pe,P++):(F=r,te===0&&me(xt)),F===r&&(e.charCodeAt(P)===8205?(F=Qe,P++):(F=r,te===0&&me(Fr))))))),F}function t0(){var F;return F=ho(),F===r&&(F=fo(),F===r&&(F=o0(),F===r&&(F=u0(),F===r&&(F=a0(),F===r&&(F=go()))))),F}function r0(){var F;return F=po(),F===r&&(F=Es()),F}function n0(){var F,x,X;return te++,F=P,x=xi(),x!==r?(e.charCodeAt(P)===105?(X=ce,P++):(X=r,te===0&&me(fr)),X===r&&(X=null),lt=F,F=ml(x,X)):(P=F,F=r),te--,F===r&&(x=r,te===0&&me(it)),F}function xi(){var F,x,X,K;if(te++,F=P,e.charCodeAt(P)===34?(x=Be,P++):(x=r,te===0&&me(hr)),x!==r){for(X=[],K=ne();K!==r;)X.push(K),K=ne();e.charCodeAt(P)===34?(K=Be,P++):(K=r,te===0&&me(hr)),K!==r?(lt=F,F=Gh(X)):(P=F,F=r)}else P=F,F=r;if(F===r)if(F=P,e.charCodeAt(P)===39?(x=Ge,P++):(x=r,te===0&&me(Vt)),x!==r){for(X=[],K=he();K!==r;)X.push(K),K=he();e.charCodeAt(P)===39?(K=Ge,P++):(K=r,te===0&&me(Vt)),K!==r?(lt=F,F=xr(X)):(P=F,F=r)}else P=F,F=r;return te--,F===r&&(x=r,te===0&&me(Wr)),F}function ne(){var F,x,X,K;return F=P,x=P,X=P,te++,e.charCodeAt(P)===34?(K=Be,P++):(K=r,te===0&&me(hr)),K===r&&(e.charCodeAt(P)===92?(K=ye,P++):(K=r,te===0&&me(Rn)),K===r&&(K=Ei())),te--,K===r?X=void 0:(P=X,X=r),X!==r?(K=gn(),K!==r?(X=[X,K],x=X):(P=x,x=r)):(P=x,x=r),x!==r?F=e.substring(F,P):F=x,F===r&&(F=P,e.charCodeAt(P)===92?(x=ye,P++):(x=r,te===0&&me(Rn)),x!==r?(X=vr(),X!==r?F=X:(P=F,F=r)):(P=F,F=r),F===r&&(F=Bt())),F}function he(){var F,x,X,K;return F=P,x=P,X=P,te++,e.charCodeAt(P)===39?(K=Ge,P++):(K=r,te===0&&me(Vt)),K===r&&(e.charCodeAt(P)===92?(K=ye,P++):(K=r,te===0&&me(Rn)),K===r&&(K=Ei())),te--,K===r?X=void 0:(P=X,X=r),X!==r?(K=gn(),K!==r?(X=[X,K],x=X):(P=x,x=r)):(P=x,x=r),x!==r?F=e.substring(F,P):F=x,F===r&&(F=P,e.charCodeAt(P)===92?(x=ye,P++):(x=r,te===0&&me(Rn)),x!==r?(X=vr(),X!==r?F=X:(P=F,F=r)):(P=F,F=r),F===r&&(F=Bt())),F}function oe(){var F,x,X,K,ue,le;if(te++,F=P,e.charCodeAt(P)===91?(x=Tr,P++):(x=r,te===0&&me(Wn)),x!==r){for(e.charCodeAt(P)===94?(X=Jt,P++):(X=r,te===0&&me(Jn)),X===r&&(X=null),K=[],ue=Le(),ue===r&&(ue=st());ue!==r;)K.push(ue),ue=Le(),ue===r&&(ue=st());e.charCodeAt(P)===93?(ue=St,P++):(ue=r,te===0&&me(On)),ue!==r?(e.charCodeAt(P)===105?(le=ce,P++):(le=r,te===0&&me(fr)),le===r&&(le=null),lt=F,F=fc(X,K,le)):(P=F,F=r)}else P=F,F=r;return te--,F===r&&(x=r,te===0&&me(Tn)),F}function Le(){var F,x,X,K;return F=P,x=st(),x!==r?(e.charCodeAt(P)===45?(X=wr,P++):(X=r,te===0&&me(Nr)),X!==r?(K=st(),K!==r?(lt=F,F=Gs(x,K)):(P=F,F=r)):(P=F,F=r)):(P=F,F=r),F}function st(){var F,x,X,K;return F=P,x=P,X=P,te++,e.charCodeAt(P)===93?(K=St,P++):(K=r,te===0&&me(On)),K===r&&(e.charCodeAt(P)===92?(K=ye,P++):(K=r,te===0&&me(Rn)),K===r&&(K=Ei())),te--,K===r?X=void 0:(P=X,X=r),X!==r?(K=gn(),K!==r?(X=[X,K],x=X):(P=x,x=r)):(P=x,x=r),x!==r?F=e.substring(F,P):F=x,F===r&&(F=P,e.charCodeAt(P)===92?(x=ye,P++):(x=r,te===0&&me(Rn)),x!==r?(X=vr(),X!==r?F=X:(P=F,F=r)):(P=F,F=r),F===r&&(F=Bt())),F}function Bt(){var F,x,X;return F=P,e.charCodeAt(P)===92?(x=ye,P++):(x=r,te===0&&me(Rn)),x!==r?(X=so(),X!==r?(lt=F,F=vl()):(P=F,F=r)):(P=F,F=r),F}function vr(){var F,x,X,K;return F=er(),F===r&&(F=P,e.charCodeAt(P)===48?(x=cr,P++):(x=r,te===0&&me(dr)),x!==r?(X=P,te++,K=Js(),te--,K===r?X=void 0:(P=X,X=r),X!==r?(lt=F,F=hc()):(P=F,F=r)):(P=F,F=r),F===r&&(F=oo(),F===r&&(F=Tl()))),F}function er(){var F;return F=ao(),F===r&&(F=i0()),F}function ao(){var F,x;return e.charCodeAt(P)===39?(F=Ge,P++):(F=r,te===0&&me(Vt)),F===r&&(e.charCodeAt(P)===34?(F=Be,P++):(F=r,te===0&&me(hr)),F===r&&(e.charCodeAt(P)===92?(F=ye,P++):(F=r,te===0&&me(Rn)),F===r&&(F=P,e.charCodeAt(P)===98?(x=vt,P++):(x=r,te===0&&me(lc)),x!==r&&(lt=F,x=Xn()),F=x,F===r&&(F=P,e.charCodeAt(P)===102?(x=Xt,P++):(x=r,te===0&&me(ha)),x!==r&&(lt=F,x=El()),F=x,F===r&&(F=P,e.charCodeAt(P)===110?(x=at,P++):(x=r,te===0&&me(Jr)),x!==r&&(lt=F,x=Al()),F=x,F===r&&(F=P,e.charCodeAt(P)===114?(x=Je,P++):(x=r,te===0&&me(pa)),x!==r&&(lt=F,x=wl()),F=x,F===r&&(F=P,e.charCodeAt(P)===116?(x=lr,P++):(x=r,te===0&&me(eo)),x!==r&&(lt=F,x=Cl()),F=x,F===r&&(F=P,e.charCodeAt(P)===118?(x=Ve,P++):(x=r,te===0&&me(to)),x!==r&&(lt=F,x=yl()),F=x)))))))),F}function i0(){var F,x,X,K;return F=P,x=P,X=P,te++,K=ei(),K===r&&(K=Ei()),te--,K===r?X=void 0:(P=X,X=r),X!==r?(K=gn(),K!==r?(X=[X,K],x=X):(P=x,x=r)):(P=x,x=r),x!==r?F=e.substring(F,P):F=x,F}function ei(){var F;return F=ao(),F===r&&(F=Js(),F===r&&(e.charCodeAt(P)===120?(F=Lt,P++):(F=r,te===0&&me(da)),F===r&&(e.charCodeAt(P)===117?(F=un,P++):(F=r,te===0&&me(vs))))),F}function oo(){var F,x,X,K,ue,le;return F=P,e.charCodeAt(P)===120?(x=Lt,P++):(x=r,te===0&&me(da)),x!==r?(X=P,K=P,ue=Zi(),ue!==r?(le=Zi(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r),K!==r?X=e.substring(X,P):X=K,X!==r?(lt=F,F=Fl(X)):(P=F,F=r)):(P=F,F=r),F}function Tl(){var F,x,X,K,ue,le,tr,Sr;return F=P,e.charCodeAt(P)===117?(x=un,P++):(x=r,te===0&&me(vs)),x!==r?(X=P,K=P,ue=Zi(),ue!==r?(le=Zi(),le!==r?(tr=Zi(),tr!==r?(Sr=Zi(),Sr!==r?(ue=[ue,le,tr,Sr],K=ue):(P=K,K=r)):(P=K,K=r)):(P=K,K=r)):(P=K,K=r),K!==r?X=e.substring(X,P):X=K,X!==r?(lt=F,F=kn(X)):(P=F,F=r)):(P=F,F=r),F}function Js(){var F;return Or.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(ga)),F}function Zi(){var F;return pi.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(ro)),F}function co(){var F,x;return F=P,e.charCodeAt(P)===46?(x=ir,P++):(x=r,te===0&&me(ma)),x!==r&&(lt=F,x=zh()),F=x,F}function Ot(){var F,x,X,K;return te++,F=P,e.charCodeAt(P)===123?(x=s,P++):(x=r,te===0&&me(Yr)),x!==r?(X=s0(),e.charCodeAt(P)===125?(K=o,P++):(K=r,te===0&&me(Ji)),K!==r?F=X:(P=F,F=r)):(P=F,F=r),te--,F===r&&(x=r,te===0&&me(va)),F}function s0(){var F,x;return F=P,x=lo(),lt=F,x=Zn(x),F=x,F}function lo(){var F,x,X,K,ue,le;if(F=P,x=[],X=[],K=P,ue=P,te++,an.test(e.charAt(P))?(le=e.charAt(P),P++):(le=r,te===0&&me(Nn)),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r),K!==r)for(;K!==r;)X.push(K),K=P,ue=P,te++,an.test(e.charAt(P))?(le=e.charAt(P),P++):(le=r,te===0&&me(Nn)),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r);else X=r;for(X===r&&(X=P,e.charCodeAt(P)===123?(K=s,P++):(K=r,te===0&&me(Yr)),K!==r?(ue=lo(),e.charCodeAt(P)===125?(le=o,P++):(le=r,te===0&&me(Ji)),le!==r?(K=[K,ue,le],X=K):(P=X,X=r)):(P=X,X=r));X!==r;){if(x.push(X),X=[],K=P,ue=P,te++,an.test(e.charAt(P))?(le=e.charAt(P),P++):(le=r,te===0&&me(Nn)),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r),K!==r)for(;K!==r;)X.push(K),K=P,ue=P,te++,an.test(e.charAt(P))?(le=e.charAt(P),P++):(le=r,te===0&&me(Nn)),te--,le===r?ue=void 0:(P=ue,ue=r),ue!==r?(le=gn(),le!==r?(ue=[ue,le],K=ue):(P=K,K=r)):(P=K,K=r);else X=r;X===r&&(X=P,e.charCodeAt(P)===123?(K=s,P++):(K=r,te===0&&me(Yr)),K!==r?(ue=lo(),e.charCodeAt(P)===125?(le=o,P++):(le=r,te===0&&me(Ji)),le!==r?(K=[K,ue,le],X=K):(P=X,X=r)):(P=X,X=r))}return F=e.substring(F,P),F}function fo(){var F;return It.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(T)),F}function u0(){var F;return qe.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(N)),F}function a0(){var F;return _e.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(H)),F}function o0(){var F;return Cr.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(Q)),F}function ho(){var F;return on.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(ve)),F}function Es(){var F;return ot.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(we)),F}function po(){var F;return Ks.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me($e)),F}function Ol(){var F;return cn.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(Ne)),F}function go(){var F;return ge.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(Qt)),F}function Nl(){var F;return cs.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(Dr)),F}function xl(){var F;return Tt.test(e.charAt(P))?(F=e.charAt(P),P++):(F=r,te===0&&me(hn)),F}function jt(){var F,x;for(F=[],x=vi(),x===r&&(x=so(),x===r&&(x=$l()));x!==r;)F.push(x),x=vi(),x===r&&(x=so(),x===r&&(x=$l()));return F}function kl(){var F,x;for(F=[],x=vi(),x===r&&(x=Ws());x!==r;)F.push(x),x=vi(),x===r&&(x=Ws());return F}function Xs(){var F,x,X,K;return F=P,x=jt(),e.charCodeAt(P)===59?(X=Zt,P++):(X=r,te===0&&me(pn)),X!==r?(x=[x,X],F=x):(P=F,F=r),F===r&&(F=P,x=kl(),X=Qn(),X===r&&(X=null),K=so(),K!==r?(x=[x,X,K],F=x):(P=F,F=r),F===r&&(F=P,x=jt(),X=Zs(),X!==r?(x=[x,X],F=x):(P=F,F=r))),F}function Zs(){var F,x;return F=P,te++,e.length>P?(x=e.charAt(P),P++):(x=r,te===0&&me(ds)),te--,x===r?F=void 0:(P=F,F=r),F}let mo=t.reservedWords||[];if(mi=u(),mi!==r&&P===e.length)return mi;throw mi!==r&&P<e.length&&me(Yh()),bl(Aa,Ln<e.length?e.charAt(Ln):null,Ln<e.length?zs(Ln,Ln+1):zs(Ln,Ln))}dw.exports={SyntaxError:oa,parse:a7}});var dl=Se((Nx,mw)=>{"use strict";var o7=wh(),c7=pw(),l7=gw(),f7=Td(),h7=["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"],pl={VERSION:f7,RESERVED_WORDS:h7,GrammarError:o7,parser:l7,compiler:c7,generate(e,t){t=t!==void 0?t:{};function r(u){let s={};return Object.keys(u).forEach(o=>{s[o]=u[o].slice()}),s}let n="plugins"in t?t.plugins:[],i={parser:pl.parser,passes:r(pl.compiler.passes),reservedWords:pl.RESERVED_WORDS.slice()};return n.forEach(u=>{u.use(i,t)}),pl.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};mw.exports=pl});var Qd=Se((Xd,Zd)=>{(function(e,t){typeof Xd=="object"&&typeof Zd<"u"?Zd.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(Xd,function(){"use strict";function e(re,fe){return fe={exports:{}},re(fe,fe.exports),fe.exports}var t=e(function(re){var fe=re.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=fe)}),r=e(function(re){var fe=re.exports={version:"2.6.5"};typeof __e=="number"&&(__e=fe)}),n=r.version,i=function(re){return typeof re=="object"?re!==null:typeof re=="function"},u=function(re){if(!i(re))throw TypeError(re+" is not an object!");return re},s=function(re){try{return!!re()}catch{return!0}},o=!s(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),l=t.document,f=i(l)&&i(l.createElement),p=function(re){return f?l.createElement(re):{}},E=!o&&!s(function(){return Object.defineProperty(p("div"),"a",{get:function(){return 7}}).a!=7}),d=function(re,fe){if(!i(re))return re;var je,xe;if(fe&&typeof(je=re.toString)=="function"&&!i(xe=je.call(re))||typeof(je=re.valueOf)=="function"&&!i(xe=je.call(re))||!fe&&typeof(je=re.toString)=="function"&&!i(xe=je.call(re)))return xe;throw TypeError("Can't convert object to primitive value")},h=Object.defineProperty,w=o?Object.defineProperty:function(fe,je,xe){if(u(fe),je=d(je,!0),u(xe),E)try{return h(fe,je,xe)}catch{}if("get"in xe||"set"in xe)throw TypeError("Accessors not supported!");return"value"in xe&&(fe[je]=xe.value),fe},m={f:w},y=function(re,fe){return{enumerable:!(re&1),configurable:!(re&2),writable:!(re&4),value:fe}},A=o?function(re,fe,je){return m.f(re,fe,y(1,je))}:function(re,fe,je){return re[fe]=je,re},C={}.hasOwnProperty,S=function(re,fe){return C.call(re,fe)},B=0,I=Math.random(),M=function(re){return"Symbol(".concat(re===void 0?"":re,")_",(++B+I).toString(36))},q=!1,b=e(function(re){var fe="__core-js_shared__",je=t[fe]||(t[fe]={});(re.exports=function(xe,We){return je[xe]||(je[xe]=We!==void 0?We:{})})("versions",[]).push({version:r.version,mode:q?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),R=b("native-function-to-string",Function.toString),L=e(function(re){var fe=M("src"),je="toString",xe=(""+R).split(je);r.inspectSource=function(We){return R.call(We)},(re.exports=function(We,ct,gt,Br){var Kt=typeof gt=="function";Kt&&(S(gt,"name")||A(gt,"name",ct)),We[ct]!==gt&&(Kt&&(S(gt,fe)||A(gt,fe,We[ct]?""+We[ct]:xe.join(String(ct)))),We===t?We[ct]=gt:Br?We[ct]?We[ct]=gt:A(We,ct,gt):(delete We[ct],A(We,ct,gt)))})(Function.prototype,je,function(){return typeof this=="function"&&this[fe]||R.call(this)})}),j=function(re){if(typeof re!="function")throw TypeError(re+" is not a function!");return re},G=function(re,fe,je){if(j(re),fe===void 0)return re;switch(je){case 1:return function(xe){return re.call(fe,xe)};case 2:return function(xe,We){return re.call(fe,xe,We)};case 3:return function(xe,We,ct){return re.call(fe,xe,We,ct)}}return function(){return re.apply(fe,arguments)}},Y="prototype",V=function(re,fe,je){var xe=re&V.F,We=re&V.G,ct=re&V.S,gt=re&V.P,Br=re&V.B,Kt=We?t:ct?t[fe]||(t[fe]={}):(t[fe]||{})[Y],Yn=We?r:r[fe]||(r[fe]={}),Ti=Yn[Y]||(Yn[Y]={}),ln,An,yr,fn;We&&(je=fe);for(ln in je)An=!xe&&Kt&&Kt[ln]!==void 0,yr=(An?Kt:je)[ln],fn=Br&&An?G(yr,t):gt&&typeof yr=="function"?G(Function.call,yr):yr,Kt&&L(Kt,ln,yr,re&V.U),Yn[ln]!=yr&&A(Yn,ln,fn),gt&&Ti[ln]!=yr&&(Ti[ln]=yr)};t.core=r,V.F=1,V.G=2,V.S=4,V.P=8,V.B=16,V.W=32,V.U=64,V.R=128;var z=V,J=Math.ceil,se=Math.floor,De=function(re){return isNaN(re=+re)?0:(re>0?se:J)(re)},ye=function(re){if(re==null)throw TypeError("Can't call method on "+re);return re},Pe=function(re){return function(fe,je){var xe=String(ye(fe)),We=De(je),ct=xe.length,gt,Br;return We<0||We>=ct?re?"":void 0:(gt=xe.charCodeAt(We),gt<55296||gt>56319||We+1===ct||(Br=xe.charCodeAt(We+1))<56320||Br>57343?re?xe.charAt(We):gt:re?xe.slice(We,We+2):(gt-55296<<10)+(Br-56320)+65536)}},Qe=Pe(!1);z(z.P,"String",{codePointAt:function(fe){return Qe(this,fe)}});var ce=r.String.codePointAt,Be=Math.max,Ge=Math.min,Tr=function(re,fe){return re=De(re),re<0?Be(re+fe,0):Ge(re,fe)},Jt=String.fromCharCode,St=String.fromCodePoint;z(z.S+z.F*(!!St&&St.length!=1),"String",{fromCodePoint:function(fe){for(var je=arguments,xe=[],We=arguments.length,ct=0,gt;We>ct;){if(gt=+je[ct++],Tr(gt,1114111)!==gt)throw RangeError(gt+" is not a valid code point");xe.push(gt<65536?Jt(gt):Jt(((gt-=65536)>>10)+55296,gt%1024+56320))}return xe.join("")}});var wr=r.String.fromCodePoint,cr=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,vt=/[\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]/,Xt=/[\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]/,at={Space_Separator:cr,ID_Start:vt,ID_Continue:Xt},Je={isSpaceSeparator:function(fe){return typeof fe=="string"&&at.Space_Separator.test(fe)},isIdStartChar:function(fe){return typeof fe=="string"&&(fe>="a"&&fe<="z"||fe>="A"&&fe<="Z"||fe==="$"||fe==="_"||at.ID_Start.test(fe))},isIdContinueChar:function(fe){return typeof fe=="string"&&(fe>="a"&&fe<="z"||fe>="A"&&fe<="Z"||fe>="0"&&fe<="9"||fe==="$"||fe==="_"||fe==="\u200C"||fe==="\u200D"||at.ID_Continue.test(fe))},isDigit:function(fe){return typeof fe=="string"&&/[0-9]/.test(fe)},isHexDigit:function(fe){return typeof fe=="string"&&/[0-9A-Fa-f]/.test(fe)}},lr,Ve,Lt,un,ir,Zt,wt,Or,pi,an=function(fe,je){lr=String(fe),Ve="start",Lt=[],un=0,ir=1,Zt=0,wt=void 0,Or=void 0,pi=void 0;do wt=Ks(),Ru[Ve]();while(wt.type!=="eof");return typeof je=="function"?It({"":pi},"",je):pi};function It(re,fe,je){var xe=re[fe];if(xe!=null&&typeof xe=="object")if(Array.isArray(xe))for(var We=0;We<xe.length;We++){var ct=String(We),gt=It(xe,ct,je);gt===void 0?delete xe[ct]:Object.defineProperty(xe,ct,{value:gt,writable:!0,enumerable:!0,configurable:!0})}else for(var Br in xe){var Kt=It(xe,Br,je);Kt===void 0?delete xe[Br]:Object.defineProperty(xe,Br,{value:Kt,writable:!0,enumerable:!0,configurable:!0})}return je.call(re,fe,xe)}var qe,_e,Cr,on,ot;function Ks(){for(qe="default",_e="",Cr=!1,on=1;;){ot=cn();var re=cs[qe]();if(re)return re}}function cn(){if(lr[un])return String.fromCodePoint(lr.codePointAt(un))}function ge(){var re=cn();return re===`
`?(ir++,Zt=0):re?Zt+=re.length:Zt++,re&&(un+=re.length),re}var cs={default:function(){switch(ot){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
`:case"\r":case"\u2028":case"\u2029":ge();return;case"/":ge(),qe="comment";return;case void 0:return ge(),Tt("eof")}if(Je.isSpaceSeparator(ot)){ge();return}return cs[Ve]()},comment:function(){switch(ot){case"*":ge(),qe="multiLineComment";return;case"/":ge(),qe="singleLineComment";return}throw Ut(ge())},multiLineComment:function(){switch(ot){case"*":ge(),qe="multiLineCommentAsterisk";return;case void 0:throw Ut(ge())}ge()},multiLineCommentAsterisk:function(){switch(ot){case"*":ge();return;case"/":ge(),qe="default";return;case void 0:throw Ut(ge())}ge(),qe="multiLineComment"},singleLineComment:function(){switch(ot){case`
`:case"\r":case"\u2028":case"\u2029":ge(),qe="default";return;case void 0:return ge(),Tt("eof")}ge()},value:function(){switch(ot){case"{":case"[":return Tt("punctuator",ge());case"n":return ge(),Yr("ull"),Tt("null",null);case"t":return ge(),Yr("rue"),Tt("boolean",!0);case"f":return ge(),Yr("alse"),Tt("boolean",!1);case"-":case"+":ge()==="-"&&(on=-1),qe="sign";return;case".":_e=ge(),qe="decimalPointLeading";return;case"0":_e=ge(),qe="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":_e=ge(),qe="decimalInteger";return;case"I":return ge(),Yr("nfinity"),Tt("numeric",1/0);case"N":return ge(),Yr("aN"),Tt("numeric",NaN);case'"':case"'":Cr=ge()==='"',_e="",qe="string";return}throw Ut(ge())},identifierNameStartEscape:function(){if(ot!=="u")throw Ut(ge());ge();var fe=ls();switch(fe){case"$":case"_":break;default:if(!Je.isIdStartChar(fe))throw Tu();break}_e+=fe,qe="identifierName"},identifierName:function(){switch(ot){case"$":case"_":case"\u200C":case"\u200D":_e+=ge();return;case"\\":ge(),qe="identifierNameEscape";return}if(Je.isIdContinueChar(ot)){_e+=ge();return}return Tt("identifier",_e)},identifierNameEscape:function(){if(ot!=="u")throw Ut(ge());ge();var fe=ls();switch(fe){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Je.isIdContinueChar(fe))throw Tu();break}_e+=fe,qe="identifierName"},sign:function(){switch(ot){case".":_e=ge(),qe="decimalPointLeading";return;case"0":_e=ge(),qe="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":_e=ge(),qe="decimalInteger";return;case"I":return ge(),Yr("nfinity"),Tt("numeric",on*(1/0));case"N":return ge(),Yr("aN"),Tt("numeric",NaN)}throw Ut(ge())},zero:function(){switch(ot){case".":_e+=ge(),qe="decimalPoint";return;case"e":case"E":_e+=ge(),qe="decimalExponent";return;case"x":case"X":_e+=ge(),qe="hexadecimal";return}return Tt("numeric",on*0)},decimalInteger:function(){switch(ot){case".":_e+=ge(),qe="decimalPoint";return;case"e":case"E":_e+=ge(),qe="decimalExponent";return}if(Je.isDigit(ot)){_e+=ge();return}return Tt("numeric",on*Number(_e))},decimalPointLeading:function(){if(Je.isDigit(ot)){_e+=ge(),qe="decimalFraction";return}throw Ut(ge())},decimalPoint:function(){switch(ot){case"e":case"E":_e+=ge(),qe="decimalExponent";return}if(Je.isDigit(ot)){_e+=ge(),qe="decimalFraction";return}return Tt("numeric",on*Number(_e))},decimalFraction:function(){switch(ot){case"e":case"E":_e+=ge(),qe="decimalExponent";return}if(Je.isDigit(ot)){_e+=ge();return}return Tt("numeric",on*Number(_e))},decimalExponent:function(){switch(ot){case"+":case"-":_e+=ge(),qe="decimalExponentSign";return}if(Je.isDigit(ot)){_e+=ge(),qe="decimalExponentInteger";return}throw Ut(ge())},decimalExponentSign:function(){if(Je.isDigit(ot)){_e+=ge(),qe="decimalExponentInteger";return}throw Ut(ge())},decimalExponentInteger:function(){if(Je.isDigit(ot)){_e+=ge();return}return Tt("numeric",on*Number(_e))},hexadecimal:function(){if(Je.isHexDigit(ot)){_e+=ge(),qe="hexadecimalInteger";return}throw Ut(ge())},hexadecimalInteger:function(){if(Je.isHexDigit(ot)){_e+=ge();return}return Tt("numeric",on*Number(_e))},string:function(){switch(ot){case"\\":ge(),_e+=Ji();return;case'"':if(Cr)return ge(),Tt("string",_e);_e+=ge();return;case"'":if(!Cr)return ge(),Tt("string",_e);_e+=ge();return;case`
`:case"\r":throw Ut(ge());case"\u2028":case"\u2029":Ou(ot);break;case void 0:throw Ut(ge())}_e+=ge()},start:function(){switch(ot){case"{":case"[":return Tt("punctuator",ge())}qe="value"},beforePropertyName:function(){switch(ot){case"$":case"_":_e=ge(),qe="identifierName";return;case"\\":ge(),qe="identifierNameStartEscape";return;case"}":return Tt("punctuator",ge());case'"':case"'":Cr=ge()==='"',qe="string";return}if(Je.isIdStartChar(ot)){_e+=ge(),qe="identifierName";return}throw Ut(ge())},afterPropertyName:function(){if(ot===":")return Tt("punctuator",ge());throw Ut(ge())},beforePropertyValue:function(){qe="value"},afterPropertyValue:function(){switch(ot){case",":case"}":return Tt("punctuator",ge())}throw Ut(ge())},beforeArrayValue:function(){if(ot==="]")return Tt("punctuator",ge());qe="value"},afterArrayValue:function(){switch(ot){case",":case"]":return Tt("punctuator",ge())}throw Ut(ge())},end:function(){throw Ut(ge())}};function Tt(re,fe){return{type:re,value:fe,line:ir,column:Zt}}function Yr(re){for(var fe=0,je=re;fe<je.length;fe+=1){var xe=je[fe],We=cn();if(We!==xe)throw Ut(ge());ge()}}function Ji(){var re=cn();switch(re){case"b":return ge(),"\b";case"f":return ge(),"\f";case"n":return ge(),`
`;case"r":return ge(),"\r";case"t":return ge()," ";case"v":return ge(),"\v";case"0":if(ge(),Je.isDigit(cn()))throw Ut(ge());return"\0";case"x":return ge(),Pu();case"u":return ge(),ls();case`
`:case"\u2028":case"\u2029":return ge(),"";case"\r":return ge(),cn()===`
`&&ge(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Ut(ge());case void 0:throw Ut(ge())}return ge()}function Pu(){var re="",fe=cn();if(!Je.isHexDigit(fe)||(re+=ge(),fe=cn(),!Je.isHexDigit(fe)))throw Ut(ge());return re+=ge(),String.fromCodePoint(parseInt(re,16))}function ls(){for(var re="",fe=4;fe-- >0;){var je=cn();if(!Je.isHexDigit(je))throw Ut(ge());re+=ge()}return String.fromCodePoint(parseInt(re,16))}var Ru={start:function(){if(wt.type==="eof")throw zn();hs()},beforePropertyName:function(){switch(wt.type){case"identifier":case"string":Or=wt.value,Ve="afterPropertyName";return;case"punctuator":Xi();return;case"eof":throw zn()}},afterPropertyName:function(){if(wt.type==="eof")throw zn();Ve="beforePropertyValue"},beforePropertyValue:function(){if(wt.type==="eof")throw zn();hs()},beforeArrayValue:function(){if(wt.type==="eof")throw zn();if(wt.type==="punctuator"&&wt.value==="]"){Xi();return}hs()},afterPropertyValue:function(){if(wt.type==="eof")throw zn();switch(wt.value){case",":Ve="beforePropertyName";return;case"}":Xi()}},afterArrayValue:function(){if(wt.type==="eof")throw zn();switch(wt.value){case",":Ve="beforeArrayValue";return;case"]":Xi()}},end:function(){}};function hs(){var re;switch(wt.type){case"punctuator":switch(wt.value){case"{":re={};break;case"[":re=[];break}break;case"null":case"boolean":case"numeric":case"string":re=wt.value;break}if(pi===void 0)pi=re;else{var fe=Lt[Lt.length-1];Array.isArray(fe)?fe.push(re):Object.defineProperty(fe,Or,{value:re,writable:!0,enumerable:!0,configurable:!0})}if(re!==null&&typeof re=="object")Lt.push(re),Array.isArray(re)?Ve="beforeArrayValue":Ve="beforePropertyName";else{var je=Lt[Lt.length-1];je==null?Ve="end":Array.isArray(je)?Ve="afterArrayValue":Ve="afterPropertyValue"}}function Xi(){Lt.pop();var re=Lt[Lt.length-1];re==null?Ve="end":Array.isArray(re)?Ve="afterArrayValue":Ve="afterPropertyValue"}function Ut(re){return ps(re===void 0?"JSON5: invalid end of input at "+ir+":"+Zt:"JSON5: invalid character '"+Nu(re)+"' at "+ir+":"+Zt)}function zn(){return ps("JSON5: invalid end of input at "+ir+":"+Zt)}function Tu(){return Zt-=5,ps("JSON5: invalid identifier character at "+ir+":"+Zt)}function Ou(re){console.warn("JSON5: '"+Nu(re)+"' in strings is not valid ECMAScript; consider escaping")}function Nu(re){var fe={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(fe[re])return fe[re];if(re<" "){var je=re.charCodeAt(0).toString(16);return"\\x"+("00"+je).substring(je.length)}return re}function ps(re){var fe=new SyntaxError(re);return fe.lineNumber=ir,fe.columnNumber=Zt,fe}var ca=function(fe,je,xe){var We=[],ct="",gt,Br,Kt="",Yn;if(je!=null&&typeof je=="object"&&!Array.isArray(je)&&(xe=je.space,Yn=je.quote,je=je.replacer),typeof je=="function")Br=je;else if(Array.isArray(je)){gt=[];for(var Ti=0,ln=je;Ti<ln.length;Ti+=1){var An=ln[Ti],yr=void 0;typeof An=="string"?yr=An:(typeof An=="number"||An instanceof String||An instanceof Number)&&(yr=String(An)),yr!==void 0&&gt.indexOf(yr)<0&&gt.push(yr)}}return xe instanceof Number?xe=Number(xe):xe instanceof String&&(xe=String(xe)),typeof xe=="number"?xe>0&&(xe=Math.min(10,Math.floor(xe)),Kt=" ".substr(0,xe)):typeof xe=="string"&&(Kt=xe.substr(0,10)),fn("",{"":fe});function fn(xt,Fr){var it=Fr[xt];switch(it!=null&&(typeof it.toJSON5=="function"?it=it.toJSON5(xt):typeof it.toJSON=="function"&&(it=it.toJSON(xt))),Br&&(it=Br.call(Fr,xt,it)),it instanceof Number?it=Number(it):it instanceof String?it=String(it):it instanceof Boolean&&(it=it.valueOf()),it){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof it=="string")return Mr(it,!1);if(typeof it=="number")return String(it);if(typeof it=="object")return Array.isArray(it)?Rn(it):fa(it)}function Mr(xt){for(var Fr={"'":.1,'"':.2},it={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},fr="",Wr=0;Wr<xt.length;Wr++){var hr=xt[Wr];switch(hr){case"'":case'"':Fr[hr]++,fr+=hr;continue;case"\0":if(Je.isDigit(xt[Wr+1])){fr+="\\x00";continue}}if(it[hr]){fr+=it[hr];continue}if(hr<" "){var Vt=hr.charCodeAt(0).toString(16);fr+="\\x"+("00"+Vt).substring(Vt.length);continue}fr+=hr}var Tn=Yn||Object.keys(Fr).reduce(function(Wn,Jn){return Fr[Wn]<Fr[Jn]?Wn:Jn});return fr=fr.replace(new RegExp(Tn,"g"),it[Tn]),Tn+fr+Tn}function fa(xt){if(We.indexOf(xt)>=0)throw TypeError("Converting circular structure to JSON5");We.push(xt);var Fr=ct;ct=ct+Kt;for(var it=gt||Object.keys(xt),fr=[],Wr=0,hr=it;Wr<hr.length;Wr+=1){var Vt=hr[Wr],Tn=fn(Vt,xt);if(Tn!==void 0){var Wn=gs(Vt)+":";Kt!==""&&(Wn+=" "),Wn+=Tn,fr.push(Wn)}}var Jn;if(fr.length===0)Jn="{}";else{var On;if(Kt==="")On=fr.join(","),Jn="{"+On+"}";else{var Nr=`,
`+ct;On=fr.join(Nr),Jn=`{
`+ct+On+`,
`+Fr+"}"}}return We.pop(),ct=Fr,Jn}function gs(xt){if(xt.length===0)return Mr(xt,!0);var Fr=String.fromCodePoint(xt.codePointAt(0));if(!Je.isIdStartChar(Fr))return Mr(xt,!0);for(var it=Fr.length;it<xt.length;it++)if(!Je.isIdContinueChar(String.fromCodePoint(xt.codePointAt(it))))return Mr(xt,!0);return xt}function Rn(xt){if(We.indexOf(xt)>=0)throw TypeError("Converting circular structure to JSON5");We.push(xt);var Fr=ct;ct=ct+Kt;for(var it=[],fr=0;fr<xt.length;fr++){var Wr=fn(String(fr),xt);it.push(Wr!==void 0?Wr:"null")}var hr;if(it.length===0)hr="[]";else if(Kt===""){var Vt=it.join(",");hr="["+Vt+"]"}else{var Tn=`,
`+ct,Wn=it.join(Tn);hr=`[
`+ct+Wn+`,
`+Fr+"]"}return We.pop(),ct=Fr,hr}},ds={parse:an,stringify:ca},la=ds,Vs=la;return Vs})});var d1=Se((oU,Nw)=>{var sR=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Nw.exports=sR});var g1=Se((cU,xw)=>{var uR="2.0.0",aR=Number.MAX_SAFE_INTEGER||9007199254740991,oR=16,cR=250,lR=["major","premajor","minor","preminor","patch","prepatch","prerelease"];xw.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:oR,MAX_SAFE_BUILD_LENGTH:cR,MAX_SAFE_INTEGER:aR,RELEASE_TYPES:lR,SEMVER_SPEC_VERSION:uR,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var E1=Se(($u,kw)=>{var{MAX_SAFE_COMPONENT_LENGTH:m1,MAX_SAFE_BUILD_LENGTH:fR,MAX_LENGTH:hR}=g1(),pR=d1();$u=kw.exports={};var dR=$u.re=[],gR=$u.safeRe=[],Ue=$u.src=[],He=$u.t={},mR=0,v1="[a-zA-Z0-9-]",vR=[["\\s",1],["\\d",hR],[v1,fR]],ER=e=>{for(let[t,r]of vR)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},dt=(e,t,r)=>{let n=ER(t),i=mR++;pR(e,i,t),He[e]=i,Ue[i]=t,dR[i]=new RegExp(t,r?"g":void 0),gR[i]=new RegExp(n,r?"g":void 0)};dt("NUMERICIDENTIFIER","0|[1-9]\\d*");dt("NUMERICIDENTIFIERLOOSE","\\d+");dt("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${v1}*`);dt("MAINVERSION",`(${Ue[He.NUMERICIDENTIFIER]})\\.(${Ue[He.NUMERICIDENTIFIER]})\\.(${Ue[He.NUMERICIDENTIFIER]})`);dt("MAINVERSIONLOOSE",`(${Ue[He.NUMERICIDENTIFIERLOOSE]})\\.(${Ue[He.NUMERICIDENTIFIERLOOSE]})\\.(${Ue[He.NUMERICIDENTIFIERLOOSE]})`);dt("PRERELEASEIDENTIFIER",`(?:${Ue[He.NUMERICIDENTIFIER]}|${Ue[He.NONNUMERICIDENTIFIER]})`);dt("PRERELEASEIDENTIFIERLOOSE",`(?:${Ue[He.NUMERICIDENTIFIERLOOSE]}|${Ue[He.NONNUMERICIDENTIFIER]})`);dt("PRERELEASE",`(?:-(${Ue[He.PRERELEASEIDENTIFIER]}(?:\\.${Ue[He.PRERELEASEIDENTIFIER]})*))`);dt("PRERELEASELOOSE",`(?:-?(${Ue[He.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Ue[He.PRERELEASEIDENTIFIERLOOSE]})*))`);dt("BUILDIDENTIFIER",`${v1}+`);dt("BUILD",`(?:\\+(${Ue[He.BUILDIDENTIFIER]}(?:\\.${Ue[He.BUILDIDENTIFIER]})*))`);dt("FULLPLAIN",`v?${Ue[He.MAINVERSION]}${Ue[He.PRERELEASE]}?${Ue[He.BUILD]}?`);dt("FULL",`^${Ue[He.FULLPLAIN]}$`);dt("LOOSEPLAIN",`[v=\\s]*${Ue[He.MAINVERSIONLOOSE]}${Ue[He.PRERELEASELOOSE]}?${Ue[He.BUILD]}?`);dt("LOOSE",`^${Ue[He.LOOSEPLAIN]}$`);dt("GTLT","((?:<|>)?=?)");dt("XRANGEIDENTIFIERLOOSE",`${Ue[He.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);dt("XRANGEIDENTIFIER",`${Ue[He.NUMERICIDENTIFIER]}|x|X|\\*`);dt("XRANGEPLAIN",`[v=\\s]*(${Ue[He.XRANGEIDENTIFIER]})(?:\\.(${Ue[He.XRANGEIDENTIFIER]})(?:\\.(${Ue[He.XRANGEIDENTIFIER]})(?:${Ue[He.PRERELEASE]})?${Ue[He.BUILD]}?)?)?`);dt("XRANGEPLAINLOOSE",`[v=\\s]*(${Ue[He.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Ue[He.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Ue[He.XRANGEIDENTIFIERLOOSE]})(?:${Ue[He.PRERELEASELOOSE]})?${Ue[He.BUILD]}?)?)?`);dt("XRANGE",`^${Ue[He.GTLT]}\\s*${Ue[He.XRANGEPLAIN]}$`);dt("XRANGELOOSE",`^${Ue[He.GTLT]}\\s*${Ue[He.XRANGEPLAINLOOSE]}$`);dt("COERCEPLAIN",`(^|[^\\d])(\\d{1,${m1}})(?:\\.(\\d{1,${m1}}))?(?:\\.(\\d{1,${m1}}))?`);dt("COERCE",`${Ue[He.COERCEPLAIN]}(?:$|[^\\d])`);dt("COERCEFULL",Ue[He.COERCEPLAIN]+`(?:${Ue[He.PRERELEASE]})?(?:${Ue[He.BUILD]})?(?:$|[^\\d])`);dt("COERCERTL",Ue[He.COERCE],!0);dt("COERCERTLFULL",Ue[He.COERCEFULL],!0);dt("LONETILDE","(?:~>?)");dt("TILDETRIM",`(\\s*)${Ue[He.LONETILDE]}\\s+`,!0);$u.tildeTrimReplace="$1~";dt("TILDE",`^${Ue[He.LONETILDE]}${Ue[He.XRANGEPLAIN]}$`);dt("TILDELOOSE",`^${Ue[He.LONETILDE]}${Ue[He.XRANGEPLAINLOOSE]}$`);dt("LONECARET","(?:\\^)");dt("CARETTRIM",`(\\s*)${Ue[He.LONECARET]}\\s+`,!0);$u.caretTrimReplace="$1^";dt("CARET",`^${Ue[He.LONECARET]}${Ue[He.XRANGEPLAIN]}$`);dt("CARETLOOSE",`^${Ue[He.LONECARET]}${Ue[He.XRANGEPLAINLOOSE]}$`);dt("COMPARATORLOOSE",`^${Ue[He.GTLT]}\\s*(${Ue[He.LOOSEPLAIN]})$|^$`);dt("COMPARATOR",`^${Ue[He.GTLT]}\\s*(${Ue[He.FULLPLAIN]})$|^$`);dt("COMPARATORTRIM",`(\\s*)${Ue[He.GTLT]}\\s*(${Ue[He.LOOSEPLAIN]}|${Ue[He.XRANGEPLAIN]})`,!0);$u.comparatorTrimReplace="$1$2$3";dt("HYPHENRANGE",`^\\s*(${Ue[He.XRANGEPLAIN]})\\s+-\\s+(${Ue[He.XRANGEPLAIN]})\\s*$`);dt("HYPHENRANGELOOSE",`^\\s*(${Ue[He.XRANGEPLAINLOOSE]})\\s+-\\s+(${Ue[He.XRANGEPLAINLOOSE]})\\s*$`);dt("STAR","(<|>)?=?\\s*\\*");dt("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");dt("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Uw=Se((lU,Lw)=>{var AR=Object.freeze({loose:!0}),wR=Object.freeze({}),CR=e=>e?typeof e!="object"?AR:e:wR;Lw.exports=CR});var qw=Se((fU,Mw)=>{var Hw=/^[0-9]+$/,jw=(e,t)=>{let r=Hw.test(e),n=Hw.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},yR=(e,t)=>jw(t,e);Mw.exports={compareIdentifiers:jw,rcompareIdentifiers:yR}});var Nh=Se((hU,zw)=>{var Th=d1(),{MAX_LENGTH:Kw,MAX_SAFE_INTEGER:Oh}=g1(),{safeRe:Vw,t:Gw}=E1(),FR=Uw(),{compareIdentifiers:ac}=qw(),A1=class e{constructor(t,r){if(r=FR(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Kw)throw new TypeError(`version is longer than ${Kw} characters`);Th("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?Vw[Gw.LOOSE]:Vw[Gw.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Oh||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Oh||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Oh||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let u=+i;if(u>=0&&u<Oh)return u}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Th("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),ac(this.major,t.major)||ac(this.minor,t.minor)||ac(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=t.prerelease[r];if(Th("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ac(n,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],i=t.build[r];if(Th("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ac(n,i)}while(++r)}inc(t,r,n){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[i];else{let u=this.prerelease.length;for(;--u>=0;)typeof this.prerelease[u]=="number"&&(this.prerelease[u]++,u=-2);if(u===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let u=[r,i];n===!1&&(u=[r]),ac(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=u):this.prerelease=u}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};zw.exports=A1});var Jw=Se((pU,Ww)=>{var Yw=Nh(),DR=(e,t,r)=>new Yw(e,r).compare(new Yw(t,r));Ww.exports=DR});var Zw=Se((dU,Xw)=>{var SR=Jw(),bR=(e,t,r)=>SR(e,t,r)>=0;Xw.exports=bR});var tC=Se((gU,eC)=>{var Qw=Nh(),_R=(e,t,r=!1)=>{if(e instanceof Qw)return e;try{return new Qw(e,t)}catch(n){if(!r)return null;throw n}};eC.exports=_R});var nC=Se((mU,rC)=>{var IR=Nh(),BR=tC(),{safeRe:xh,t:kh}=E1(),$R=(e,t)=>{if(e instanceof IR)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?xh[kh.COERCEFULL]:xh[kh.COERCE]);else{let l=t.includePrerelease?xh[kh.COERCERTLFULL]:xh[kh.COERCERTL],f;for(;(f=l.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),l.lastIndex=f.index+f[1].length+f[2].length;l.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",u=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",o=t.includePrerelease&&r[6]?`+${r[6]}`:"";return BR(`${n}.${i}.${u}${s}${o}`,t)};rC.exports=$R});var lf="2.20.2";var Am="3.7.7",lS=Am,bo=typeof Buffer=="function",dm=typeof TextDecoder=="function"?new TextDecoder:void 0,gm=typeof TextEncoder=="function"?new TextEncoder:void 0,fS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Tc=Array.prototype.slice.call(fS),ff=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(Tc),hS=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,vn=String.fromCharCode.bind(String),mm=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),wm=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),Cm=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),ym=e=>{let t,r,n,i,u="",s=e.length%3;for(let o=0;o<e.length;){if((r=e.charCodeAt(o++))>255||(n=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,u+=Tc[t>>18&63]+Tc[t>>12&63]+Tc[t>>6&63]+Tc[t&63]}return s?u.slice(0,s-3)+"===".substring(s):u},np=typeof btoa=="function"?e=>btoa(e):bo?e=>Buffer.from(e,"binary").toString("base64"):ym,tp=bo?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,i=e.length;n<i;n+=4096)r.push(vn.apply(null,e.subarray(n,n+4096)));return np(r.join(""))},hf=(e,t=!1)=>t?wm(tp(e)):tp(e),pS=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?vn(192|t>>>6)+vn(128|t&63):vn(224|t>>>12&15)+vn(128|t>>>6&63)+vn(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return vn(240|t>>>18&7)+vn(128|t>>>12&63)+vn(128|t>>>6&63)+vn(128|t&63)}},dS=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Fm=e=>e.replace(dS,pS),vm=bo?e=>Buffer.from(e,"utf8").toString("base64"):gm?e=>tp(gm.encode(e)):e=>np(Fm(e)),So=(e,t=!1)=>t?wm(vm(e)):vm(e),Em=e=>So(e,!0),gS=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,mS=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return vn((r>>>10)+55296)+vn((r&1023)+56320);case 3:return vn((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return vn((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},Dm=e=>e.replace(gS,mS),Sm=e=>{if(e=e.replace(/\s+/g,""),!hS.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,i;for(let u=0;u<e.length;)t=ff[e.charAt(u++)]<<18|ff[e.charAt(u++)]<<12|(n=ff[e.charAt(u++)])<<6|(i=ff[e.charAt(u++)]),r+=n===64?vn(t>>16&255):i===64?vn(t>>16&255,t>>8&255):vn(t>>16&255,t>>8&255,t&255);return r},ip=typeof atob=="function"?e=>atob(Cm(e)):bo?e=>Buffer.from(e,"base64").toString("binary"):Sm,bm=bo?e=>mm(Buffer.from(e,"base64")):e=>mm(ip(e).split("").map(t=>t.charCodeAt(0))),_m=e=>bm(Im(e)),vS=bo?e=>Buffer.from(e,"base64").toString("utf8"):dm?e=>dm.decode(bm(e)):e=>Dm(ip(e)),Im=e=>Cm(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),rp=e=>vS(Im(e)),ES=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)},Bm=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),$m=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,Bm(r));e("fromBase64",function(){return rp(this)}),e("toBase64",function(t){return So(this,t)}),e("toBase64URI",function(){return So(this,!0)}),e("toBase64URL",function(){return So(this,!0)}),e("toUint8Array",function(){return _m(this)})},Pm=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,Bm(r));e("toBase64",function(t){return hf(this,t)}),e("toBase64URI",function(){return hf(this,!0)}),e("toBase64URL",function(){return hf(this,!0)})},AS=()=>{$m(),Pm()},pt={version:Am,VERSION:lS,atob:ip,atobPolyfill:Sm,btoa:np,btoaPolyfill:ym,fromBase64:rp,toBase64:So,encode:So,encodeURI:Em,encodeURL:Em,utob:Fm,btou:Dm,decode:rp,isValid:ES,fromUint8Array:hf,toUint8Array:_m,extendString:$m,extendUint8Array:Pm,extendBuiltins:AS};var Ku=typeof $task<"u",ou=typeof $loon<"u",Vu=typeof $httpClient<"u"&&!ou,ys=eval('typeof process !== "undefined"'),Rm=typeof $environment<"u"&&$environment["stash-version"],Tm=typeof $rocket<"u",wS=typeof egern=="object",CS=typeof $native<"u",Gu=typeof $Plugins<"u";function pf(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function yS(e){let[t,r,n,i,u,s,o]=e.match(/^socks5:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(u)u=parseInt(u,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:u,userId:r!=null?decodeURIComponent(r):void 0,password:n!=null?decodeURIComponent(n):void 0}}var df=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=rs(),this.env=Qr(),ys){let dotenv=require("dotenv");dotenv.config()}this.node=(()=>{if(ys){let fs=require('fs');return{fs}}else return null})(),this.initCache();let delay=(e,t)=>new Promise(function(r){setTimeout(r.bind(null,t),e)});Promise.prototype.delay=async function(e){let t=await this;return await delay(e,t)}}initCache(){if(Ku&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(ou||Vu)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),Gu&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),ys){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}`)}pf(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")),!pf(this.cache))throw new Error("Invalid Data")}catch{try{let t=pt.decode(this.node.fs.readFileSync(`${fpath}`,"utf-8"));if(this.cache=JSON.parse(t),this.node.fs.writeFileSync(fpath,t,{flag:"w"}),!pf(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}`)}}pf(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(Ku&&$prefs.setValueForKey(data,this.name),(ou||Vu)&&$persistentStore.write(data,this.name),Gu&&$Plugins.SubStoreCache.set(this.name,data),ys){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),Vu||ou)return $persistentStore.write(e,t);if(Ku)return $prefs.setValueForKey(e,t);if(ys&&(this.root[t]=e),Gu)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),Vu||ou)return $persistentStore.read(e);if(Ku)return $prefs.valueForKey(e);if(ys)return this.root[e];if(Gu)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),Vu||ou)return $persistentStore.write(null,e);if(Ku)return $prefs.removeValueForKey(e);if(ys&&delete this.root[e],Gu)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(Ku&&$notify(title,subtitle,content,options),Vu&&$notification.post(title,subtitle,content+`${mediaURL?`
\u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),ou){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(ys){let content_=content+(openURL?`
\u70B9\u51FB\u8DF3\u8F6C: ${openURL}`:"")+(mediaURL?`
\u591A\u5A92\u4F53: ${mediaURL}`:"");console.log(`${title}
${subtitle}
${content_}
`);let push=eval("process.env.SUB_STORE_PUSH_SERVICE");if(push){let e=push.replace("[\u63A8\u9001\u6807\u9898]",encodeURIComponent(title||"Sub-Store")).replace("[\u63A8\u9001\u5185\u5BB9]",encodeURIComponent([subtitle,content_].map(r=>r).join(`
`)));rs().get({url:e}).then(r=>{console.log(`[Push Service] URL: ${e}
RES: ${r.statusCode} ${r.body}`)}).catch(r=>{console.log(`[Push Service] URL: ${e}
ERROR: ${r}`)})}}Gu&&$Plugins.Notify(title,subtitle+`
`+content)}log(e){this.debug&&console.log(`[${this.name}] LOG: ${e}`)}info(e){console.log(`[${this.name}] INFO: ${e}`)}error(e){console.log(`[${this.name}] ERROR: ${e}`)}wait(e){return new Promise(t=>setTimeout(t,e))}done(e={}){Ku||ou||Vu||Gu?$done(e):ys&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function Qr(){return{isQX:Ku,isLoon:ou,isSurge:Vu,isNode:ys,isStash:Rm,isShadowRocket:Tm,isEgern:wS,isLanceX:CS,isGUIforCores:Gu}}function rs(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores}=Qr(),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()@:%_+.~#?&//=]*)/;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,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;isQX?worker=$task.fetch({method,url:options.url,headers:options.headers,body:options.body,opts:options.opts}):isLoon||isSurge||isNode?worker=new Promise(async(resolve,reject)=>{let body=options.body,opts=JSON.parse(JSON.stringify(options));if(opts.body=body,opts.timeout=opts.timeout||8e3,opts.timeout&&(opts.timeout++,isNaN(opts.timeout)&&(opts.timeout=8e3),!isNode)){let e="ms";(isSurge||Rm||Tm)&&(opts.timeout=Math.ceil(opts.timeout/1e3),e="s")}if(isNode){let undici=require('undici'),{socksDispatcher}=require('fetch-socks'),{ProxyAgent,EnvHttpProxyAgent,request,interceptors}=undici,agentOpts={connect:{rejectUnauthorized:!(opts.strictSSL===!1||opts.insecure===!0)},bodyTimeout:opts.timeout,headersTimeout:opts.timeout};try{let url=new URL(opts.url);(url.username||url.password)&&(opts.headers={...opts.headers||{},Authorization:`Basic ${Buffer.from(`${url.username||""}:${url.password||""}`).toString("base64")}`});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(yS(opts.proxy),agentOpts):dispatcher=new ProxyAgent({...agentOpts,uri:opts.proxy}):dispatcher=new EnvHttpProxyAgent(agentOpts);let response=await request(opts.url,{...opts,method:method.toUpperCase(),dispatcher:dispatcher.compose(interceptors.redirect({maxRedirections:3,throwOnMaxRedirects:!0}))});resolve({statusCode:response.statusCode,headers:response.headers,body:opts.encoding===null?await response.body.arrayBuffer():await response.body.text()})}catch(e){reject(e)}}else $httpClient[method.toLowerCase()](opts,(e,t,r)=>{e?reject(e):resolve({statusCode:t.status||t.statusCode,headers:t.headers,body:r})})}):isGUIforCores&&(worker=new Promise(async(e,t)=>{try{let r=await $Plugins.Requests({method,url:options.url,headers:options.headers,body:options.body,autoTransformBody:!1,options:{Proxy:options.proxy,Timeout:options.timeout?options.timeout/1e3:15}});e({statusCode:r.status,headers:r.headers,body:r.body})}catch(r){t(r)}}));let timeoutid,timer=timeout?new Promise((e,t)=>{timeoutid=setTimeout(()=>(events.onTimeout(),t(`${method} URL: ${options.url} exceeds the timeout ${timeout} ms`)),timeout)}):null;return(timer?Promise.race([timer,worker]).then(e=>(typeof clearTimeout<"u"&&clearTimeout(timeoutid),e)):worker).then(e=>events.onResponse(e))}let http={};return methods.forEach(e=>http[e.toLowerCase()]=t=>send(e,t)),http}var FS=new df("sub-store"),_=FS;var sp="schemaVersion",Mt="settings",zt="subs",Yt="collections",Nt="files",Fn="modules",_t="artifacts",Oc="rules",Mn="tokens",Om="Auto Generated Sub-Store Backup",gf="Sub-Store",$a="Sub-Store Artifacts Repository",Pa="#sub-store-cached-resource",Ra="#sub-store-cached-headers-resource",mf="#sub-store-chr-expiration-time";var Ta="#sub-store-cached-script-resource",vf="#sub-store-csr-expiration-time";function zu(){DS()}function DS(){let e=_.read(sp);e||SS(),e!=="2.0"&&_.write("2.0",sp)}function SS(){_.info("Start migrating...");let e=_.read(zt)||{},t=Object.values(e).map(w=>(w.source=w.source||"remote",d(w),h(w),w));_.write(t,zt);let r=_.read(Yt)||{},n=Object.values(r).map(w=>(delete w.ua,d(w),h(w),w));_.write(n,Yt);let i=_.read(_t)||{},u=Object.values(i);_.write(u,_t);let s=_.read(Oc)||{},o=Object.values(s);_.write(o,Oc);let l=_.read(Nt)||{},f=Object.values(l);_.write(f,Nt);let p=_.read(Mn)||{},E=Object.values(p);_.write(E,Mn),delete _.cache.builtin,_.info("Migration complete!");function d(w){let m=w["display-name"];m&&(w.displayName=m,delete w["display-name"])}function h(w){let m=w.process;if(!m||m.length===0)return;let y=[],A={type:"Quick Setting Operator",args:{udp:"DEFAULT",tfo:"DEFAULT",scert:"DEFAULT","vmess aead":"DEFAULT",useless:"DEFAULT"}};for(let C of m)if(C.type){if(C.type==="Useless Filter")A.args.useless="ENABLED";else if(C.type==="Set Property Operator"){let{key:S,value:B}=C.args;switch(S){case"udp":A.args.udp=B?"ENABLED":"DISABLED";break;case"tfo":A.args.tfo=B?"ENABLED":"DISABLED";break;case"skip-cert-verify":A.args.scert=B?"ENABLED":"DISABLED";break;case"aead":A.args["vmess aead"]=B?"ENABLED":"DISABLED";break}}else if(C.type.indexOf("Keyword")===-1)if(C.type==="Flag Operator"){let S=typeof C.args>"u"?!0:C.args;C.args={mode:S?"add":"remove"},y.push(C)}else y.push(C)}y.unshift(A),w.process=y}}var qR=Zr(xc());function up({substore:$,port,host}){let{isNode}=Qr(),DEFAULT_HEADERS={"Content-Type":"text/plain;charset=UTF-8","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST,GET,OPTIONS,PATCH,PUT,DELETE","Access-Control-Allow-Headers":"Origin, X-Requested-With, Content-Type, Accept","X-Powered-By":"Sub-Store"};if(isNode){let express_=require("express"),bodyParser=require("body-parser"),app=express_(),limit=eval("process.env.SUB_STORE_BODY_JSON_LIMIT")||"1mb";return $.info(`[BACKEND] body JSON limit: ${limit}`),app.use(bodyParser.json({verify:rawBodySaver,limit})),app.use(bodyParser.urlencoded({verify:rawBodySaver,extended:!0})),app.use(bodyParser.raw({verify:rawBodySaver,type:"*/*"})),app.use((e,t,r)=>{t.set(DEFAULT_HEADERS),r()}),app.start=()=>{app.get("*",function(t,r){r.status(404).end()});let e=app.listen(port,host,()=>{let{address:t,port:r}=e.address();$.info(`[BACKEND] listening on ${t}:${r}`)})},app}let handlers=[],METHODS_NAMES=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD'","ALL"],dispatch=(e,t=0)=>{let{method:r,url:n,headers:i,body:u}=e;i=bS(i),/json/i.test(i["content-type"])&&(u=JSON.parse(u)),r=r.toUpperCase();let{path:s,query:o}=IS(n),l=null,f,p=0;for(f=t;f<handlers.length;f++)if(handlers[f].method==="ALL"||r===handlers[f].method){let{pattern:E}=handlers[f];_S(E,s)&&E.split("/").length>p&&(l=handlers[f],p=E.split("/").length)}if(l){let E=()=>{dispatch(r,n,f)},d={method:r,url:n,path:s,query:o,params:Nm(l.pattern,s),headers:i,body:u},h=Response(),w=l.callback,m=y=>{h.status(500).json({status:"failed",message:`Internal Server Error: ${y}`})};if(w.constructor.name==="AsyncFunction")w(d,h,E).catch(m);else try{w(d,h,E)}catch(y){m(y)}}else Response().status(404).json({status:"failed",message:"ERROR: 404 not found"})},app={};return METHODS_NAMES.forEach(e=>{app[e.toLowerCase()]=(t,r)=>{handlers.push({method:e,pattern:t,callback:r})}}),app.route=e=>{let t={};return METHODS_NAMES.forEach(r=>{t[r.toLowerCase()]=n=>(handlers.push({method:r,pattern:e,callback:n}),t)}),t},app.start=()=>{dispatch($request)},app;function rawBodySaver(e,t,r,n){r&&r.length&&(e.rawBody=r.toString(n||"utf8"))}function Response(){let e=200,{isQX:t,isLoon:r,isSurge:n,isGUIforCores:i}=Qr(),u=DEFAULT_HEADERS,s={200:"HTTP/1.1 200 OK",201:"HTTP/1.1 201 Created",302:"HTTP/1.1 302 Found",307:"HTTP/1.1 307 Temporary Redirect",308:"HTTP/1.1 308 Permanent Redirect",404:"HTTP/1.1 404 Not Found",500:"HTTP/1.1 500 Internal Server Error"};return new class{status(o){return e=o,this}send(o=""){let l={status:t?s[e]:e,body:o,headers:u};t||i?$done(l):(r||n)&&$done({response:l})}end(){this.send()}html(o){this.set("Content-Type","text/html;charset=UTF-8"),this.send(o)}json(o){this.set("Content-Type","application/json;charset=UTF-8"),this.send(JSON.stringify(o))}set(o,l){return u[o]=l,this}}}}function bS(e){let t={};for(let r of Object.keys(e))t[r.toLowerCase()]=e[r];return t}function _S(e,t){if(e instanceof RegExp&&e.test(t))return!0;if(e==="/")return!0;if(e.indexOf(":")===-1){let r=t.split("/"),n=e.split("/");for(let i=0;i<n.length;i++)if(r[i]!==n[i])return!1;return!0}else if(Nm(e,t))return!0;return!1}function IS(e){let r=(e.match(/https?:\/\/[^/]+(\/[^?]*)/)||[])[1]||"/",n=e.indexOf("?"),i={};if(n!==-1){let u=e.slice(e.indexOf("?")+1).split("&");for(let s=0;s<u.length;s++){let o=u[s].split("=");i[o[0]]=decodeURIComponent(o[1])}}return{path:r,query:i}}function Nm(e,t){if(e.indexOf(":")===-1)return null;{let r={};for(let n=0,i=0;n<e.length;n++,i++)if(e[n]===":"){let u=[],s=[];for(;e[++n]!=="/"&&n<e.length;)u.push(e[n]);for(;t[i]!=="/"&&i<t.length;)s.push(t[i++]);r[u.join("")]=decodeURIComponent(s.join(""))}else if(e[n]!==t[i])return null;return r}}var ap=0;function Fi(e){return $S(BS(PS(e)))}function BS(e){return TS(OS(RS(e),e.length*8))}function $S(e){try{}catch{ap=0}for(var t=ap?"0123456789ABCDEF":"0123456789abcdef",r="",n,i=0;i<e.length;i++)n=e.charCodeAt(i),r+=t.charAt(n>>>4&15)+t.charAt(n&15);return r}function PS(e){for(var t="",r=-1,n,i;++r<e.length;)n=e.charCodeAt(r),i=r+1<e.length?e.charCodeAt(r+1):0,55296<=n&&n<=56319&&56320<=i&&i<=57343&&(n=65536+((n&1023)<<10)+(i&1023),r++),n<=127?t+=String.fromCharCode(n):n<=2047?t+=String.fromCharCode(192|n>>>6&31,128|n&63):n<=65535?t+=String.fromCharCode(224|n>>>12&15,128|n>>>6&63,128|n&63):n<=2097151&&(t+=String.fromCharCode(240|n>>>18&7,128|n>>>12&63,128|n>>>6&63,128|n&63));return t}function RS(e){for(var t=Array(e.length>>2),r=0;r<t.length;r++)t[r]=0;for(var r=0;r<e.length*8;r+=8)t[r>>5]|=(e.charCodeAt(r/8)&255)<<r%32;return t}function TS(e){for(var t="",r=0;r<e.length*32;r+=8)t+=String.fromCharCode(e[r>>5]>>>r%32&255);return t}function OS(e,t){e[t>>5]|=128<<t%32,e[(t+64>>>9<<4)+14]=t;for(var r=1732584193,n=-271733879,i=-1732584194,u=271733878,s=0;s<e.length;s+=16){var o=r,l=n,f=i,p=u;r=Dn(r,n,i,u,e[s+0],7,-680876936),u=Dn(u,r,n,i,e[s+1],12,-389564586),i=Dn(i,u,r,n,e[s+2],17,606105819),n=Dn(n,i,u,r,e[s+3],22,-1044525330),r=Dn(r,n,i,u,e[s+4],7,-176418897),u=Dn(u,r,n,i,e[s+5],12,1200080426),i=Dn(i,u,r,n,e[s+6],17,-1473231341),n=Dn(n,i,u,r,e[s+7],22,-45705983),r=Dn(r,n,i,u,e[s+8],7,1770035416),u=Dn(u,r,n,i,e[s+9],12,-1958414417),i=Dn(i,u,r,n,e[s+10],17,-42063),n=Dn(n,i,u,r,e[s+11],22,-1990404162),r=Dn(r,n,i,u,e[s+12],7,1804603682),u=Dn(u,r,n,i,e[s+13],12,-40341101),i=Dn(i,u,r,n,e[s+14],17,-1502002290),n=Dn(n,i,u,r,e[s+15],22,1236535329),r=Sn(r,n,i,u,e[s+1],5,-165796510),u=Sn(u,r,n,i,e[s+6],9,-1069501632),i=Sn(i,u,r,n,e[s+11],14,643717713),n=Sn(n,i,u,r,e[s+0],20,-373897302),r=Sn(r,n,i,u,e[s+5],5,-701558691),u=Sn(u,r,n,i,e[s+10],9,38016083),i=Sn(i,u,r,n,e[s+15],14,-660478335),n=Sn(n,i,u,r,e[s+4],20,-405537848),r=Sn(r,n,i,u,e[s+9],5,568446438),u=Sn(u,r,n,i,e[s+14],9,-1019803690),i=Sn(i,u,r,n,e[s+3],14,-187363961),n=Sn(n,i,u,r,e[s+8],20,1163531501),r=Sn(r,n,i,u,e[s+13],5,-1444681467),u=Sn(u,r,n,i,e[s+2],9,-51403784),i=Sn(i,u,r,n,e[s+7],14,1735328473),n=Sn(n,i,u,r,e[s+12],20,-1926607734),r=bn(r,n,i,u,e[s+5],4,-378558),u=bn(u,r,n,i,e[s+8],11,-2022574463),i=bn(i,u,r,n,e[s+11],16,1839030562),n=bn(n,i,u,r,e[s+14],23,-35309556),r=bn(r,n,i,u,e[s+1],4,-1530992060),u=bn(u,r,n,i,e[s+4],11,1272893353),i=bn(i,u,r,n,e[s+7],16,-155497632),n=bn(n,i,u,r,e[s+10],23,-1094730640),r=bn(r,n,i,u,e[s+13],4,681279174),u=bn(u,r,n,i,e[s+0],11,-358537222),i=bn(i,u,r,n,e[s+3],16,-722521979),n=bn(n,i,u,r,e[s+6],23,76029189),r=bn(r,n,i,u,e[s+9],4,-640364487),u=bn(u,r,n,i,e[s+12],11,-421815835),i=bn(i,u,r,n,e[s+15],16,530742520),n=bn(n,i,u,r,e[s+2],23,-995338651),r=_n(r,n,i,u,e[s+0],6,-198630844),u=_n(u,r,n,i,e[s+7],10,1126891415),i=_n(i,u,r,n,e[s+14],15,-1416354905),n=_n(n,i,u,r,e[s+5],21,-57434055),r=_n(r,n,i,u,e[s+12],6,1700485571),u=_n(u,r,n,i,e[s+3],10,-1894986606),i=_n(i,u,r,n,e[s+10],15,-1051523),n=_n(n,i,u,r,e[s+1],21,-2054922799),r=_n(r,n,i,u,e[s+8],6,1873313359),u=_n(u,r,n,i,e[s+15],10,-30611744),i=_n(i,u,r,n,e[s+6],15,-1560198380),n=_n(n,i,u,r,e[s+13],21,1309151649),r=_n(r,n,i,u,e[s+4],6,-145523070),u=_n(u,r,n,i,e[s+11],10,-1120210379),i=_n(i,u,r,n,e[s+2],15,718787259),n=_n(n,i,u,r,e[s+9],21,-343485551),r=Yu(r,o),n=Yu(n,l),i=Yu(i,f),u=Yu(u,p)}return Array(r,n,i,u)}function Ef(e,t,r,n,i,u){return Yu(NS(Yu(Yu(t,e),Yu(n,u)),i),r)}function Dn(e,t,r,n,i,u,s){return Ef(t&r|~t&n,e,t,i,u,s)}function Sn(e,t,r,n,i,u,s){return Ef(t&n|r&~n,e,t,i,u,s)}function bn(e,t,r,n,i,u,s){return Ef(t^r^n,e,t,i,u,s)}function _n(e,t,r,n,i,u,s){return Ef(r^(t|~n),e,t,i,u,s)}function Yu(e,t){var r=(e&65535)+(t&65535),n=(e>>16)+(t>>16)+(r>>16);return n<<16|r&65535}function NS(e,t){return e<<t|e>>>32-t}var _f=Zr(Ym()),a3=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,o3=/^(([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 Lr(e){return a3.test(e)}function Rr(e){return o3.test(e)}function Wm(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 _s(e){return typeof e=="string"&&e.trim().length>0}function ur(e,t){return _s(e)?e:t}function Po(e){return typeof e<"u"&&e!==null}function Ro(e,t){return Po(e)?e:t}function lu(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function c3(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function Uc(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,i]=r.split("-").map(Number);return c3(n,i)}else return Number(r)}function Jm(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function If(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 Wu(e,t="YYYY-MM-DD_HH-mm-ss"){let r=e instanceof Date?e:new Date(e);if(isNaN(r.getTime()))return"";let n=u=>String(u).padStart(2,"0"),i={YYYY:r.getFullYear(),MM:n(r.getMonth()+1),DD:n(r.getDate()),HH:n(r.getHours()),mm:n(r.getMinutes()),ss:n(r.getSeconds())};return t.replace(/YYYY|MM|DD|HH|mm|ss/g,u=>i[u])}var Ap=class{constructor(t){this.expires=t,_.read(Pa)||_.write("{}",Pa);try{this.resourceCache=JSON.parse(_.read(Pa))}catch(r){_.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Pa} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${r?.message??r}`),this.resourceCache={},_.write("{}",Pa)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],_.delete(`#${n}`),t=!0),new Date().getTime()-i.time>this.expires&&(delete this.resourceCache[n],t=!0)}),t&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){_.write(JSON.stringify(this.resourceCache),Pa)}get(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].data:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}},Ur=new Ap(36e5);var wp=class{constructor(){this.expires=f3(),_.read(Ra)||_.write("{}",Ra);try{this.resourceCache=JSON.parse(_.read(Ra))}catch(t){_.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Ra} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},_.write("{}",Ra)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],_.delete(`#${n}`),t=!0),new Date().getTime()-i.time>this.expires&&(delete this.resourceCache[n],t=!0)}),t&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){_.write(JSON.stringify(this.resourceCache),Ra)}get(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].data:null}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].time:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}};function f3(){_.read(mf)||_.write("6e4",mf);let e=6e4;if(_.env.isLoon){let t={"1\u5206\u949F":6e4,"5\u5206\u949F":3e5,"10\u5206\u949F":6e5,"30\u5206\u949F":18e5,"1\u5C0F\u65F6":36e5,"2\u5C0F\u65F6":72e5,"3\u5C0F\u65F6":108e5,"6\u5C0F\u65F6":216e5,"12\u5C0F\u65F6":432e5,"24\u5C0F\u65F6":864e5,"48\u5C0F\u65F6":1728e5,"72\u5C0F\u65F6":2592e5,\u53C2\u6570\u4F20\u5165:"readcachets"},r=_.read("#\u54CD\u5E94\u5934\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=_.read(mf),e}var xa=new wp;function To(e){let t=Object.keys(e),r="",n="";for(let i of t){let u=i.toLowerCase();u==="subscription-userinfo"?r=e[i]:u==="profile-web-page-url"&&(n=e[i])}return`${r||""}${n?`; app_url=${encodeURIComponent(n)}`:""}`}async function Bn(rawUrl,ua,timeout,customProxy,flowUrl){let url=flowUrl||rawUrl||"",$arguments={},rawArgs=url.split("#");if(url=url.split("#")[0],rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}if($arguments?.noFlow||!/^https?/.test(url))return;let{isStash,isLoon,isShadowRocket,isQX}=Qr(),insecure=$arguments?.insecure?_.env.isNode?{strictSSL:!1}:{insecure:!0}:void 0,{defaultProxy,defaultFlowUserAgent,defaultTimeout}=_.read(Mt),proxy=customProxy||defaultProxy;_.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultFlowUserAgent||"clash",requestTimeout=timeout||defaultTimeout||8e3,id=Fi(userAgent+url),cached=xa.get(id),flowInfo;if(!$arguments?.noCache&&cached)_.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${userAgent}`),flowInfo=cached;else{let e=rs();if(flowUrl){_.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u4F53\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${flowUrl}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{body:t}=await e.get({url:flowUrl,headers:{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?lu(proxy):{},...insecure||{}});flowInfo=t}else{try{_.info(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await e.head({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{"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?lu(proxy):{},...insecure||{}});flowInfo=To(t)}catch(t){_.error(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${t.message??t}`)}if(!flowInfo){_.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await e.get({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{"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?lu(proxy):{},...insecure||{}});flowInfo=To(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&xa.set(id,flowInfo)}return flowInfo}function ka(e){if(!e)return;let t=e.match(/upload=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),r=Number(t[1]+t[2]),n=e.match(/download=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),i=Number(n[1]+n[2]),u=e.match(/total=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),s=Number(u[1]+u[2]),o=e.match(/expire=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),l=o?Number(o[1]+o[2]):void 0,f=e.match(/reset_day=([0-9]+)/),p=f?Number(f[1]):void 0,E=e.match(/app_url=(.*?)\s*?(;|$)/),d=E?decodeURIComponent(E[1]):void 0,h=e.match(/plan_name=(.*?)\s*?(;|$)/),w=h?decodeURIComponent(h[1]):void 0;return{expires:l,total:s,usage:{upload:r,download:i},remainingDays:p,appUrl:d,planName:w}}function Hc(e,t="B"){let r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=r.indexOf(t);return e<1024||n===r.length-1?{value:(Math.round(e*100)/100).toString(),unit:t}:Hc(e/1024,r[++n])}function Bf(e){if(!e)throw new Error("\u6CA1\u6709\u6D41\u91CF\u4FE1\u606F");if(e?.expires&&e.expires*1e3<Date.now()){let t=new Date(e.expires*1e3).toLocaleDateString();throw new Error(`\u8BA2\u9605\u5DF2\u8FC7\u671F: ${t}`)}if(e?.total){let t=e.usage?.upload||0,r=e.usage?.download||0;if(e.total-t-r<0){let n=t+r,i=Hc(Math.abs(n));i.value=n<0?"-"+i.value:i.value;let u=Hc(e.total);throw new Error(`\u6D41\u91CF\u5DF2\u7528\u5B8C: ${i.value} ${i.unit} / ${u.value} ${u.unit}`)}}}function $f(e={}){try{let{resetDay:t,startDate:r,cycleDays:n}=e;if(["string","number"].includes(typeof e)&&(t=e),r&&n){if(n=parseInt(n),isNaN(n)||n<=0)throw new Error("\u91CD\u7F6E\u5468\u671F\u5E94\u4E3A\u6B63\u6574\u6570");if(!r||!Date.parse(r))throw new Error("\u5F00\u59CB\u65E5\u671F\u4E0D\u5408\u6CD5");let i=new Date(r),u=new Date;if(i.setHours(0,0,0,0),u.setHours(0,0,0,0),i.getTime()>u.getTime())throw new Error("\u5F00\u59CB\u65E5\u671F\u5E94\u65E9\u4E8E\u73B0\u5728");let s=new Date(r);for(s.setDate(s.getDate()+n);s<u;)s.setDate(s.getDate()+n);s.setHours(0,0,0,0);let o=s.getTime()-u.getTime();return Math.ceil(o/(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,u=i.getDate(),s=i.getMonth(),o=i.getFullYear(),l;return t>u?l=0:l=new Date(o,s+1,0).getDate(),l-u+t}}catch(t){_.error(`getRmainingDays failed: ${t.message??t}`)}}function Ju(e){try{let t=new Map;return e.split(";").map(r=>r.trim()).filter(Boolean).forEach(r=>{let n=r.indexOf("=");if(n===-1)return;let i=r.slice(0,n).trim(),u=r.slice(n+1).trim();if(!t.has(i))try{let s=decodeURIComponent(u);if(["upload","download","total","expire"].includes(i))try{s=Number(s).toFixed(0),["expire"].includes(i)&&s<=0&&(s="")}catch(o){_.error(`Failed to convert value for key "${i}=${u}": ${o.message??o}`)}t.set(i,s)}catch{t.set(i,u)}}),Array.from(t.entries()).map(([r,n])=>`${r}=${encodeURIComponent(n)}`).join("; ")}catch(t){return _.error(`normalizeFlowHeader failed: ${t.message??t}`),e}}function ft(e,t,r="name"){return e.find(n=>n[r]===t)}function Xm(e,t,r="name"){return e.findIndex(n=>n[r]===t)}function Mi(e,t,r="name"){let n=Xm(e,t,r);e.splice(n,1)}function is(e,t,r,n="name"){let i=Xm(e,t,n);e[i]=r}function Me(e,t,r){e.status(r||200).json({status:"success",data:t})}function ke(e,t,r){e.status(r||500).json({status:"failed",error:{code:t.code,type:t.type,message:t.message,details:e.req?.route?.path?.startsWith("/share/")?"\u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7":t.details}})}var Oo=class{constructor(t,r,n){this.code=t,this.message=r,this.details=n}},or=class extends Oo{constructor(t,r,n){super(t,r,n),this.type="InternalServerError"}},kt=class extends Oo{constructor(t,r,n){super(t,r,n),this.type="RequestInvalidError"}},gr=class extends Oo{constructor(t,r,n){super(t,r,n),this.type="ResourceNotFoundError"}},No=class extends Oo{constructor(t,r,n){super(t,r,n),this.type="NetworkError"}};var Ih=Zr(Of());var Yp=Zr(jv());function x_(e){let t=Yp.default.pemtohex(e);return Yp.default.KJUR.crypto.Util.hashHex(t,"sha256").match(/.{2}/g).join(":").toUpperCase()}var Mv={generateFingerprint:x_};var el=Zr(OE());function xE(e,t,...r){try{return e(t,...r)}catch{return e(kE(e(t.replace(/!<str>\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function Qc(e,...t){return xE(el.default.safeLoad,JSON.parse(JSON.stringify(e)),...t)}function pB(e,...t){return xE(el.default.load,JSON.parse(JSON.stringify(e)),...t)}function NE(e,...t){return el.default.safeDump(JSON.parse(JSON.stringify(e)),...t)}function kE(e,...t){return el.default.dump(JSON.parse(JSON.stringify(e)),...t)}var Rs={safeLoad:Qc,load:pB,safeDump:NE,dump:kE,parse:Qc,stringify:NE};var od=class{constructor(){this.expires=dB(),_.read(Ta)||_.write("{}",Ta);try{this.resourceCache=JSON.parse(_.read(Ta))}catch(t){_.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Ta} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},_.write("{}",Ta)}this._cleanup()}_cleanup(t,r){let n=!1;Object.entries(this.resourceCache).forEach(i=>{let[u,s]=i;s.time||(delete this.resourceCache[u],_.delete(`#${u}`),n=!0),(new Date().getTime()-s.time>(r??this.expires)||t&&u.startsWith(t))&&(delete this.resourceCache[u],n=!0)}),n&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){_.write(JSON.stringify(this.resourceCache),Ta)}get(t,r,n){let i=this.resourceCache[t]&&this.resourceCache[t].time;if(i){if(new Date().getTime()-i<=(r??this.expires))return this.resourceCache[t].data;n&&(delete this.resourceCache[t],this._persist())}return null}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].time:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}};function dB(){_.read(vf)||_.write("1728e5",vf);let e=1728e5;if(_.env.isLoon){let t={"1\u5206\u949F":6e4,"5\u5206\u949F":3e5,"10\u5206\u949F":6e5,"30\u5206\u949F":18e5,"1\u5C0F\u65F6":36e5,"2\u5C0F\u65F6":72e5,"3\u5C0F\u65F6":108e5,"6\u5C0F\u65F6":216e5,"12\u5C0F\u65F6":432e5,"24\u5C0F\u65F6":864e5,"48\u5C0F\u65F6":1728e5,"72\u5C0F\u65F6":2592e5,\u53C2\u6570\u4F20\u5165:"readcachets"},r=_.read("#\u8282\u70B9\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=_.read(vf),e}var tl=new od;function sh(e,t){return[...Array(e).keys()].map(()=>t)}var cd={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["EXP","BAND"],"\u{1F1F8}\u{1F1F1}":["TEST","SOS"],"\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{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{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","KGZ"],"\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{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{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{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{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{1F1EA}":["VE","VEN"],"\u{1F1FB}\u{1F1F3}":["VN","VNM"],"\u{1F1FF}\u{1F1E6}":["ZA","ZAF","JNB"],"\u{1F1E8}\u{1F1F3}":["CN","CHN","BACK"]};function ec(e){let t={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["\u6D41\u91CF","\u65F6\u95F4","\u8FC7\u671F","Bandwidth","Expire"],"\u{1F1F8}\u{1F1F1}":["\u5E94\u6025","\u6D4B\u8BD5\u8282\u70B9"],"\u{1F1E6}\u{1F1E9}":["Andorra","\u5B89\u9053\u5C14"],"\u{1F1E6}\u{1F1EA}":["United Arab Emirates","\u963F\u8054\u914B","\u8FEA\u62DC"],"\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{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{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"],"\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{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"],"\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{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{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{1F1F5}\u{1F1FE}":["Paraguay","\u5DF4\u62C9\u572D"],"\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{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{1F1EA}":["Venezuela","\u59D4\u5185\u745E\u62C9"],"\u{1F1FB}\u{1F1F3}":["Vietnam","\u8D8A\u5357","\u80E1\u5FD7\u660E"],"\u{1F1FF}\u{1F1E6}":["South Africa","\u5357\u975E"],"\u{1F1E8}\u{1F1F3}":["China","\u4E2D\u56FD","\u4E2D\u570B","\u56DE\u56FD","\u56DE\u570B","\u56FD\u5185","\u570B\u5167","\u534E\u4E1C","\u534E\u897F","\u534E\u5357","\u534E\u5317","\u534E\u4E2D","\u6C5F\u82CF","\u5317\u4EAC","\u4E0A\u6D77","\u5E7F\u5DDE","\u6DF1\u5733","\u676D\u5DDE","\u5F90\u5DDE","\u9752\u5C9B","\u5B81\u6CE2","\u9547\u6C5F"]},r=e.match(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/)?.[0]||"\u{1F3F4}\u200D\u2620\uFE0F";for(let n of Object.keys(t))if(t[n].some(u=>RegExp(`${u}`,"i").test(e)))return/内蒙古/.test(e)&&["\u{1F1F2}\u{1F1F3}"].includes(n)?r="\u{1F1E8}\u{1F1F3}":r=n;for(let n of Object.keys(cd))if(cd[n].some(u=>RegExp(`(^|[^a-zA-Z])${u}([^a-zA-Z]|$)`).test(e))&&!(n=="\u{1F1E8}\u{1F1F3}"&&RegExp("(^|[^a-zA-Z])CN2([^a-zA-Z]|$)").test(e)))return r=n;return r}function ah(e){return cd[ec(e)]?.[0]}function rl(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴‍☠️|🏳️‍🌈/g,"").trim()}var uh=class{constructor({country,asn}={}){if(_.env.isNode){let Reader=require("@maxmind/geoip2-node").Reader,fs=require('fs'),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 lh=Zr(YE()),WE=Zr(Of());async function rc({url:e,domain:t,type:r="A",timeout:n,edns:i}){let u=lh.default.encode({type:"query",id:0,flags:lh.default.RECURSION_DESIRED,questions:[{type:r,name:t}],additionals:[{type:"OPT",name:".",udpPayloadSize:4096,flags:0,options:[{code:"CLIENT_SUBNET",ip:i,sourcePrefixLength:Lr(i)?24:56,scopePrefixLength:0}]}]}),s=await _.http.get({url:`${e}?dns=${u.toString("base64").toString("utf-8").replace(/=/g,"")}`,headers:{Accept:"application/dns-message"},"binary-mode":!0,encoding:null,timeout:n});return lh.default.decode(WE.Buffer.from(_.env.isQX?s.bodyBytes:s.body))}var wd=Zr(xc());var{isNode:JE,isQX:yB,isLoon:FB,isSurge:DB,isStash:SB,isShadowRocket:bB,isLanceX:_B,isEgern:IB,isGUIforCores:BB}=Qr(),Hs="Node";JE&&(Hs="Node");yB&&(Hs="QX");FB&&(Hs="Loon");DB&&(Hs="Surge");SB&&(Hs="Stash");bB&&(Hs="ShadowRocket");IB&&(Hs="Egern");_B&&(Hs="LanceX");BB&&(Hs="GUI.for.Cores");var Ja={},$B={};try{if(typeof $environment<"u"&&(Ja.env=$environment),typeof $loon<"u"&&(Ja.loon=$loon),typeof $script<"u"&&(Ja.script=$script),typeof $Plugin<"u"&&(Ja.plugin=$Plugin),JE){Ja.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)&&(Ja.node.env[e]=env[e])}}catch(e){}var js={backend:Hs,version:lf,feature:$B,meta:Ja};function PB(e){return e&&typeof e=="object"&&!Array.isArray(e)}function il(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function ZE(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(PB(r[n]))if(n.endsWith("!")){let i=il(n.slice(0,-1));e[i]=r[n]}else{let i=il(n);e[i]||Object.assign(e,{[i]:{}}),ZE(e[i],r[i])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let i=il(n.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...r[n],...e[i]]}else if(n.endsWith("+")){let i=il(n.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...r[n]]}else{let i=il(n);Object.assign(e,{[i]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function RB({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>fh(e,r))}}function fh(e,t){if(!e.operator)switch(e.proposition){case"IN":return e.value.indexOf(t[e.attr])!==-1;case"CONTAINS":return typeof t[e.attr]!="string"?!1:t[e.attr].indexOf(e.value)!==-1;case"EQUALS":return t[e.attr]===e.value;case"EXISTS":return t[e.attr]!==null||typeof t[e.attr]<"u";default:throw new Error(`Unknown proposition: ${e.proposition}`)}switch(e.operator){case"AND":return e.child.every(r=>fh(r,t));case"OR":return e.child.some(r=>fh(r,t));case"NOT":return!fh(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function TB(e){return{name:"Quick Setting Operator",func:r=>{if(t(e.useless)){let i=rA().func(r);r=r.filter((u,s)=>i[s]&&u.port>0&&u.port<=65535)}return r.map(n=>(n.udp=t(e.udp,n.udp),n.tfo=t(e.tfo,n.tfo),n["fast-open"]=t(e.tfo,n["fast-open"]),n["skip-cert-verify"]=t(e.scert,n["skip-cert-verify"]),n.type==="vmess"&&(n.aead=t(e["vmess aead"],n.aead)),n))}};function t(r,n){switch(r){case"ENABLED":return!0;case"DISABLED":return!1;default:return n}}}function OB({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=rl(n.name);else{let i=ec(n.name);n.name=rl(n.name),n.name=i+" "+n.name,t=="ws"?n.name=n.name.replace(/🇹🇼/g,"\u{1F1FC}\u{1F1F8}"):t=="tw"||(n.name=n.name.replace(/🇹🇼/g,"\u{1F1E8}\u{1F1F3}"))}return n})}}function NB(e){let{action:t,template:r,link:n,position:i}={action:"rename",template:"0 1 2 3 4 5 6 7 8 9",link:"-",position:"back",...e};return{name:"Handle Duplicate Operator",func:u=>{if(t==="delete"){let s={};return u.filter(o=>s[o.name]?!1:(s[o.name]=!0,!0))}else if(t==="rename"){let s=r.split(" "),o={},l=0;u.forEach(p=>{typeof o[p.name]>"u"?o[p.name]=1:o[p.name]++,l=Math.max(o[p.name].toString().length,l)});let f={};return u.map(p=>{if(o[p.name]>1){typeof f[p.name]>"u"&&(f[p.name]=1);let E="",d=f[p.name]++,h=0;for(;d>0;)E=s[d%10]+E,d=parseInt(d/10),h++;for(;h++<l;)E=s[0]+E;i==="front"?p.name=E+n+p.name:i==="back"&&(p.name=p.name+n+E)}return p})}}}}function xB(e="asc"){return{name:"Sort Operator",func:t=>{switch(e){case"asc":case"desc":return t.sort((r,n)=>{let i=r.name>n.name?1:-1;return i*=e==="desc"?-1:1,i});case"random":return zB(t);default:throw new Error("Unknown sort option: "+e)}}}}function kB(e){let t=e.order||"asc",r=e.expressions;return Array.isArray(e)&&(r=e),Array.isArray(r)||(r=[]),{name:"Regex Sort Operator",func:n=>(r=r.map(i=>Cd(i)),n.sort((i,u)=>{let s=XE(r,i.name),o=XE(r,u.name);return s&&!o?-1:o&&!s?1:s&&o?s<o?-1:1:t==="original"?0:t==="desc"?i.name<u.name?1:-1:i.name<u.name?-1:1}))}}function XE(e,t){let r=null;for(let n=0;n<e.length;n++)if(e[n].test(t)){r=n+1;break}return r}function QE(e){return{name:"Regex Rename Operator",func:t=>t.map(r=>{for(let{expr:n,now:i}of e)r.name=r.name.replace(Cd(n,"g"),i).trim();return r})}}function LB(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:QE(t).func}}function UB(e,t,r,n,i){return{name:"Script Operator",func:async u=>{let s=u;if(s?.$file?.type==="mihomoProfile")try{let o=Rs.safeLoad(e),l;if(s?.$content)try{l=Rs.safeLoad(s?.$content)}catch(f){_.error(f.message??f)}if(typeof o!="object")throw new Error("patch is not an object");return s.$content=Rt.yaml.safeDump(ZE(l||(s?.$file?.sourceType==="none"?{}:{proxies:await sn({type:s?.$file?.sourceType||"collection",name:s?.$file?.sourceName,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0}})}),o)),s}catch{}return await async function(){s=hh("operator",e,r,i)(u,t,{source:n,...js})}(),s},nodeFunc:async u=>{let s=u;return await async function(){s=hh("operator",`async function operator(input = []) {
if (input && (input.$files || input.$content)) {
let { $content, $files, $options, $file } = input
if($file.type === 'mihomoProfile') {
${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 || ($file.sourceType === 'none' ? {} : {
proxies: await produceArtifact({
type: $file.sourceType || 'collection',
name: $file.sourceName,
platform: 'mihomo',
produceType: 'internal',
produceOpts: {
'delete-underscore-fields': true
}
}),
})))
}
} else {
${e}
}
return { $content, $files, $options, $file }
} else {
let proxies = input
let list = []
for await (let $server of proxies) {
${e}
list.push($server)
}
return list
}
}`,r,i)(u,t,{source:n,...js})}(),s}}}function HB(e){let t,r;try{let n=e.split(":");r=parseInt(n[2],16);let i=parseInt(n[3],16),u=parseInt(n[4],16),s=i>>8,o=i&255,l=u>>8,f=u&255;if(t=`${s}.${o}.${l}.${f}`,r<=0||r>65535)throw new Error(`Invalid port number: ${r}`);if(!Lr(t))throw new Error(`Invalid IP address: ${t}`)}catch(n){_.error(`IP4P \u89E3\u6790\u5931\u8D25: ${n}`)}return{server:t,port:r}}var eA={Custom:async function(e,t,r,n,i,u){let s=Fi(`CUSTOM:${u}:${e}:${t}`),o=Ur.get(s);if(!r&&o)return o;let l=t==="IPv6"?"AAAA":"A",f=await rc({url:u,domain:e,type:l,timeout:n,edns:i}),{answers:p}=f;if(!Array.isArray(p)||p.length===0)throw new Error("No answers");let E=p.filter(d=>d?.type===l).map(d=>d?.data).filter(d=>d);if(E.length===0)throw new Error("No answers");return Ur.set(s,E),E},Google:async function(e,t,r,n,i){let u=Fi(`GOOGLE:${e}:${t}`),s=Ur.get(u);if(!r&&s)return s;let o=t==="IPv6"?"AAAA":"A",l=await rc({url:"https://8.8.4.4/dns-query",domain:e,type:o,timeout:n,edns:i}),{answers:f}=l;if(!Array.isArray(f)||f.length===0)throw new Error("No answers");let p=f.filter(E=>E?.type===o).map(E=>E?.data).filter(E=>E);if(p.length===0)throw new Error("No answers");return Ur.set(u,p),p},"IP-API":async function(e,t,r,n){if(["IPv6"].includes(t))throw new Error(`\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9 IP-API \u4E0D\u652F\u6301 ${t}`);let i=Fi(`IP-API:${e}`),u=Ur.get(i);if(!r&&u)return u;let s=await _.http.get({url:`http://ip-api.com/json/${encodeURIComponent(e)}?lang=zh-CN`,timeout:n}),o=JSON.parse(s.body);if(o.status!=="success")throw new Error(`Status is ${o.status}`);if(!o.query||o.query===0)throw new Error("No answers");let l=[o.query];if(l.length===0)throw new Error("No answers");return Ur.set(i,l),l},Cloudflare:async function(e,t,r,n,i){let u=Fi(`CLOUDFLARE:${e}:${t}`),s=Ur.get(u);if(!r&&s)return s;let o=t==="IPv6"?"AAAA":"A",l=await rc({url:"https://1.0.0.1/dns-query",domain:e,type:o,timeout:n,edns:i}),{answers:f}=l;if(!Array.isArray(f)||f.length===0)throw new Error("No answers");let p=f.filter(E=>E?.type===o).map(E=>E?.data).filter(E=>E);if(p.length===0)throw new Error("No answers");return Ur.set(u,p),p},Ali:async function(e,t,r,n,i){let u=Fi(`ALI:${e}:${t}`),s=Ur.get(u);if(!r&&s)return s;let o=await _.http.get({url:`http://223.6.6.6/resolve?edns_client_subnet=${i}/${Lr(i)?24:56}&name=${encodeURIComponent(e)}&type=${t==="IPv6"?"AAAA":"A"}&short=1`,headers:{accept:"application/dns-json"},timeout:n}),l=JSON.parse(o.body);if(!Array.isArray(l)||l.length===0)throw new Error("No answers");let f=l;if(f.length===0)throw new Error("No answers");return Ur.set(u,f),f},Tencent:async function(e,t,r,n,i){let u=Fi(`TENCENT:${e}:${t}`),s=Ur.get(u);if(!r&&s)return s;let l=(await _.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:n})).body.split(";").map(p=>p.split(",")[0]);if(l.length===0||String(l)==="0")throw new Error("No answers");let f=l;if(f.length===0)throw new Error("No answers");return Ur.set(u,f),f}};function tA({provider:e,type:t,filter:r,cache:n,url:i,timeout:u,edns:s}){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:o}=_.read(Mt),l=u||o||8e3,f=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",p=eA[e];if(!p)throw new Error(`\u627E\u4E0D\u5230\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9: ${e}`);let E=s||"223.6.6.6";if(!Xa(E))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");return _.info(`Domain Resolver: [${t}] ${e} ${E||""} ${i||""}`),{name:"Resolve Domain Operator",func:async d=>{d.forEach((A,C)=>{!A["_no-resolve"]&&A["no-resolve"]&&(d[C]["_no-resolve"]=A["no-resolve"])});let h={},w=15,m=[...new Set(d.filter(A=>!Xa(A.server)&&!A["_no-resolve"]).map(A=>A.server))],y=Math.ceil(m.length/w);for(let A=0;A<y;A++){let C=[];for(let S of m.splice(0,w))C.push(p(S,f,n==="disabled",l,E,i).then(B=>{h[S]=B,_.info(`Successfully resolved domain: ${S} \u279F ${B}`)}).catch(B=>{_.error(`Failed to resolve domain: ${S} with resolver [${e}]: ${B}`)}));await Promise.all(C)}return d.forEach(A=>{if(!A["_no-resolve"])if(h[A.server]){A._resolved_ips=h[A.server];let C=Array.isArray(h[A.server])?h[A.server][Math.floor(Math.random()*h[A.server].length)]:h[A.server];if(f==="IPv6"&&Rr(C)){try{C=new _f.Address6(C).correctForm()}catch(S){_.error(`Failed to parse IPv6 address: ${C}: ${S}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(C)){A._IP4P=C;let{server:S,port:B}=HB(C);S&&B?(A._domain=A.server,A.server=S,A.port=B,A.resolved=!0,A._IPv4=A.server,Xa(A._IP)||(A._IP=A.server)):A.resolved||(A.resolved=!1)}else A._domain=A.server,A.server=C,A.resolved=!0,A[`_${f}`]=A.server,Xa(A._IP)||(A._IP=A.server)}else A._domain=A.server,A.server=C,A.resolved=!0,A[`_${f}`]=A.server,Xa(A._IP)||(A._IP=A.server)}else A.resolved||(A.resolved=!1)}),d.filter(A=>r==="removeFailed"?Xa(A.server)||A["_no-resolve"]||A.resolved:r==="IPOnly"?Xa(A.server):r==="IPv4Only"?Lr(A.server):r==="IPv6Only"?Rr(A.server):!0)}}}function Xa(e){return Lr(e)||Rr(e)}tA.resolver=eA;function Ad(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function rA(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!Ad(t.cipher))return!1;if(t.password&&!Ad(t.password))return!1;if(t.network){let r=t[`${t.network}-opts`]?.headers?.Host||t[`${t.network}-opts`]?.headers?.host;if(r=Array.isArray(r)?r:[r],r.some(n=>n&&!Ad(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function jB(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let r=e?.keep??!0,n={HK:"\u{1F1ED}\u{1F1F0}",TW:"\u{1F1F9}\u{1F1FC}",US:"\u{1F1FA}\u{1F1F8}",SG:"\u{1F1F8}\u{1F1EC}",JP:"\u{1F1EF}\u{1F1F5}",UK:"\u{1F1EC}\u{1F1E7}",DE:"\u{1F1E9}\u{1F1EA}",KR:"\u{1F1F0}\u{1F1F7}"};return{name:"Region Filter",func:i=>i.map(u=>{let s=ec(u.name),o=t.some(l=>n[l]===s);return r?o:!o})}}function MB({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let i=e.some(u=>Cd(u).test(n.name));return t?i:!i})}}function Cd(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function qB(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let r=e?.keep??!0;return{name:"Type Filter",func:n=>n.map(i=>{let u=t.some(s=>i.type===s);return r?u:!u})}}function KB(e,t,r,n,i){return{name:"Script Filter",func:async u=>{let s=sh(u.length,!0);return await async function(){s=hh("filter",e,r,i)(u,t,{source:n,...js})}(),s},nodeFunc:async u=>{let s=sh(u.length,!0);return await async function(){s=hh("filter",`async function filter(input = []) {
let proxies = input
let list = []
const fn = async ($server) => {
${e}
}
for await (let $server of proxies) {
list.push(await fn($server))
}
return list
}`,r,i)(u,t,{source:n,...js})}(),s}}}var ph={"Useless Filter":rA,"Region Filter":jB,"Regex Filter":MB,"Type Filter":qB,"Script Filter":KB,"Conditional Filter":RB,"Quick Setting Operator":TB,"Flag Operator":OB,"Sort Operator":xB,"Regex Sort Operator":kB,"Regex Rename Operator":QE,"Regex Delete Operator":LB,"Script Operator":UB,"Handle Duplicate Operator":NB,"Resolve Domain Operator":tA};async function VB(e,t){let r=sh(t.length,!0);try{r=await e.func(t)}catch(n){let i="",u=`${n.message??n}`;u.includes("$server is not defined")?i="":(_.error(`Cannot apply filter ${e.name}(function filter)! Reason: ${n}`),i=`\u6267\u884C function filter \u5931\u8D25 ${u}; `);try{r=await e.nodeFunc(t)}catch(s){_.error(`Cannot apply filter ${e.name}(shortcut script)! Reason: ${s}`);let o="",l=`${s.message??s}`;throw i&&l===u?(o="",i=`\u6267\u884C\u5931\u8D25 ${u}`):o=`\u6267\u884C\u5FEB\u6377\u8FC7\u6EE4\u811A\u672C \u5931\u8D25 ${l}`,new Error(`\u811A\u672C\u8FC7\u6EE4 ${i}${o}`)}}return t.filter((n,i)=>r[i])}async function GB(e,t){let r=YB(t);try{let n=await e.func(r);n&&(r=n)}catch(n){let i="",u=`${n.message??n}`;u.includes("$server is not defined")||u.includes("$content is not defined")||u.includes("$files is not defined")||r?.$files||r?.$content?i="":(_.error(`Cannot apply operator ${e.name}(function operator)! Reason: ${n}`),i=`\u6267\u884C function operator \u5931\u8D25 ${u}; `);try{let s=await e.nodeFunc(r);s&&(r=s)}catch(s){_.error(`Cannot apply operator ${e.name}(shortcut script)! Reason: ${s}`);let o="",l=`${s.message??s}`;throw i&&l===u?(o="",i=`\u6267\u884C\u5931\u8D25 ${u}`):o=`\u6267\u884C\u5FEB\u6377\u811A\u672C \u5931\u8D25 ${l}`,new Error(`\u811A\u672C\u64CD\u4F5C ${i}${o}`)}}return r}async function nA(e,t){if(e.name.indexOf("Filter")!==-1)return VB(e,t);if(e.name.indexOf("Operator")!==-1)return GB(e,t)}function zB(e){let t=e.length,r,n;for(;t!==0;)n=Math.floor(Math.random()*t),t-=1,r=e[t],e[t]=e[n],e[n]=r;return e}function YB(e){return JSON.parse(JSON.stringify(e))}function hh(name,script,$arguments,$options){let flowUtils={getFlowField:To,getFlowHeaders:Bn,parseFlowHeaders:ka,flowTransfer:Hc,validCheck:Bf,getRmainingDays:$f,normalizeFlowHeader:Ju};return _.env.isLoon?new Function("$arguments","$options","$substore","lodash","$persistentStore","$httpClient","$notification","ProxyUtils","yaml","Buffer","b64d","b64e","scriptResourceCache","flowUtils","produceArtifact","require",`${script}
return ${name}`)($arguments,$options,_,wd.default,$persistentStore,$httpClient,$notification,Rt,Rt.yaml,Rt.Buffer,Rt.Base64.decode,Rt.Base64.encode,tl,flowUtils,sn,eval('typeof require !== "undefined"')?Ba:void 0):new Function("$arguments","$options","$substore","lodash","ProxyUtils","yaml","Buffer","b64d","b64e","scriptResourceCache","flowUtils","produceArtifact","require",`${script}
return ${name}`)($arguments,$options,_,wd.default,Rt,Rt.yaml,Rt.Buffer,Rt.Base64.decode,Rt.Base64.encode,tl,flowUtils,sn,eval('typeof require !== "undefined"')?Ba:void 0)}function WB(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function JB(){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!/^\w+:\/\/\w+/im.test(i)&&t.some(u=>i.indexOf(u)!==-1)},parse:function(i){let u=pt.decode(i);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(u)?u:(_.error("Base64 Pre-processor error: decoded line does not start with protocol"),i)}}}function XB(){return{name:"Fallback Base64 Pre-processor",test:function(n){return!0},parse:function(n){let i=pt.decode(n);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(i)?i:(_.error("Fallback Base64 Pre-processor error: decoded line does not start with protocol"),n)}}}function ZB(){return{name:"Clash Pre-processor",test:function(n){if(!/proxies/.test(n))return!1;let i=Qc(n);return i.proxies&&Array.isArray(i.proxies)},parse:function(n,i){let u=n.replace(/short-id:([ \t]*[^#\n,}]*)/g,(l,f)=>{let p=f.trim();return!p||p===""?'short-id: ""':/^(['"]).*\1$/.test(p)?`short-id: ${p}`:["null"].includes(p)?`short-id: ${p}`:`short-id: "${p}"`}),{proxies:s,"global-client-fingerprint":o}=Qc(u);return(i?`proxies:
`:"")+s.map(l=>(o&&!l["client-fingerprint"]&&(l["client-fingerprint"]=o),`${i?" - ":""}${JSON.stringify(l)}
`)).join("")}}}function QB(){return{name:"SSD Pre-processor",test:function(n){return n.indexOf("ssd://")===0},parse:function(n){let i=[],u=JSON.parse(pt.decode(n.split("ssd://")[1])),s=u.port,o=u.encryption,l=u.password,f=u.servers;for(let p=0;p<f.length;p++){let E=f[p];o=E.encryption?E.encryption:o,l=E.password?E.password:l;let d=pt.encode(o+":"+l),h=E.server;s=E.port?E.port:s;let w=E.remarks?E.remarks:p,m=E.plugin_options?"/?plugin="+encodeURIComponent(E.plugin+";"+E.plugin_options):"";i[p]="ss://"+d+"@"+h+":"+s+m+"#"+w}return i.join(`
`)}}}function e9(){return{name:"Full Config Preprocessor",test:function(n){return/^(\[server_local\]|\[Proxy\])/gm.test(n)},parse:function(n){return n.match(/^\[server_local|Proxy\]([\s\S]+?)^\[.+?\](\r?\n|$)/im)?.[1]||n}}}var dh=[WB(),ZB(),JB(),QB(),e9(),XB()];var iA=Zr(xc()),mt=class{constructor(t){this.proxy=t,this.output=[]}append(t){if(typeof t>"u")throw new Error("required field is missing");this.output.push(t)}appendIfPresent(t,r){ae(this.proxy,r)&&this.append(t)}toString(){return this.output.join("")}};function ae(e,t){let r=iA.default.get(e,t);return typeof r<"u"&&r!==null}var t9="Surge",Gi={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function nc(){return{produce:(t,r,n={})=>{switch(t.name=t.name.replace(/=|,/g,""),t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return r9(t,n["include-unsupported-proxy"]);case"trojan":return n9(t);case"vmess":return i9(t,n["include-unsupported-proxy"]);case"http":return u9(t);case"direct":return a9(t);case"socks5":return o9(t);case"snell":return c9(t);case"tuic":return l9(t);case"wireguard-surge":return h9(t);case"hysteria2":return p9(t);case"ssh":return s9(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return f9(t);throw new Error(`Platform ${t9} does not support proxy type: ${t.type}`)}}}function r9(e){let t=new mt(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 new Error(`cipher ${e.cipher} is not supported`);t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=Gi[e["ip-version"]]||e["ip-version"];if(t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),ae(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 new Error(`plugin ${e.plugin} is not supported`)}if(t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,u=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),u){if(u<2)throw new Error(`shadow-tls version ${u} is not supported`);t.append(`,shadow-tls-version=${u}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}return t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function n9(e){let t=new mt(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),sA(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function i9(e,t){let r=new mt(e);r.append(`${e.name}=${e.type},${e.server},${e.port}`),r.appendIfPresent(`,username=${e.uuid}`,"uuid");let n=Gi[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-version=${n}`,"ip-version"),r.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),sA(r,e,t),ae(e,"aead")?r.append(`,vmess-aead=${e.aead}`):r.append(`,vmess-aead=${e.alterId===0}`),r.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),r.appendIfPresent(`,tls=${e.tls}`,"tls"),r.appendIfPresent(`,sni=${e.sni}`,"sni"),r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),r.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),r.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),r.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),r.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),r.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),r.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),r.appendIfPresent(`,tos=${e.tos}`,"tos"),r.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),r.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(r.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),r.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),r.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),r.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),r.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),r.toString()}function s9(e){let t=new mt(e);t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,private-key=${e["keystore-private-key"]}`,"keystore-private-key"),t.appendIfPresent(`,idle-timeout=${e["idle-timeout"]}`,"idle-timeout"),t.appendIfPresent(`,server-fingerprint="${e["server-fingerprint"]}"`,"server-fingerprint");let r=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function u9(e){if(e.headers&&Object.keys(e.headers).length>0)throw new Error("headers is unsupported");let t=new mt(e),r=e.tls?"https":"http";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password");let n=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function a9(e){let t=new mt(e);t.append(`${e.name}=direct`);let n=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function o9(e){let t=new mt(e),r=e.tls?"socks5-tls":"socks5";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password");let n=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e.tfo&&_.info("Option tfo is not supported by Surge, thus omitted"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function c9(e){let t=new mt(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk=${e.psk}`,"psk");let r=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),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"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),t.toString()}function l9(e){let t=new mt(e),r=e.type;(!e.token||e.token.length===0)&&(r="tuic-v5"),t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,token=${e.token}`,"token"),t.appendIfPresent(`,alpn=${Array.isArray(e.alpn)?e.alpn[0]:e.alpn}`,"alpn"),ae(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let n=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ae(e,"tfo")?t.append(`,tfo=${e.tfo}`):ae(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn"),t.toString()}function f9(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 mt(e);t.append(`# > WireGuard Proxy ${e.name}
# ${e.name}=wireguard`),e["section-name"]=ur(e["section-name"],e.name),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert");let r=Gi[e["ip-version"]]||e["ip-version"];t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.append(`
# > WireGuard Section ${e.name}
[WireGuard ${e["section-name"]}]
private-key = ${e["private-key"]}`),t.appendIfPresent(`
self-ip = ${e.ip}`,"ip"),t.appendIfPresent(`
self-ip-v6 = ${e.ipv6}`,"ipv6"),e.dns&&(Array.isArray(e.dns)&&(e.dns=e.dns.join(", ")),t.append(`
dns-server = ${e.dns}`)),t.appendIfPresent(`
mtu = ${e.mtu}`,"mtu"),r==="prefer-v6"&&t.append(`
prefer-ipv6 = true`);let n=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],i=Array.isArray(e.reserved)?e.reserved.join("/"):e.reserved,u=e["preshared-key"]??e["pre-shared-key"];u&&(u=`,preshared-key="${u}"`);let s={"public-key":e["public-key"],"allowed-ips":n?`"${n}"`:void 0,endpoint:`${e.server}:${e.port}`,keepalive:e["persistent-keepalive"]||e.keepalive,"client-id":i,"preshared-key":u};return t.append(`
peer = (${Object.keys(s).filter(o=>s[o]!=null).map(o=>`${o} = ${s[o]}`).join(", ")})`),t.toString()}function h9(e){let t=new mt(e);t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert");let r=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function p9(e){if(e.obfs||e["obfs-password"])throw new Error("obfs is unsupported");let t=new mt(e);t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),ae(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let r=Gi[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ae(e,"tfo")?t.append(`,tfo=${e.tfo}`):ae(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ae(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn"),t.toString()}function sA(e,t,r){if(ae(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ae(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ae(t,"ws-opts.headers"))){let n=t["ws-opts"].headers,i=Object.keys(n).map(u=>{let s=n[u];return["Host"].includes(u)&&(s=`"${s}"`),`${u}:${s}`}).join("|");_s(i)&&e.append(`,ws-headers=${i}`)}}else if(r&&["http"].includes(t.network))_.info(`Include Unsupported Proxy: nework ${t.network} -> tcp`);else throw new Error(`network ${t.network} is unsupported`)}var d9={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"};function Ii(){return{type:"ALL",produce:(r,n,i={})=>{let u=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&s.version>=4||["juicity"].includes(s.type)?!1:!(["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))).map(s=>{if(s.type==="vmess"?(ae(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ae(s,"sni")&&(s.servername=s.sni,delete s.sni),ae(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ae(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ae(s,"version")&&(s.version=5)):s.type==="hysteria"?(ae(s,"auth_str")&&!ae(s,"auth-str")&&(s["auth-str"]=s.auth_str),ae(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ae(s,"tfo")&&!ae(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.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"?ae(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"&&ae(s,"shadow-tls-password")&&!ae(s,"plugin")&&(s.plugin="shadow-tls",s["plugin-opts"]={host:s["shadow-tls-sni"],password:s["shadow-tls-password"],version:s["shadow-tls-version"]},delete s["shadow-tls-password"],delete s["shadow-tls-sni"],delete s["shadow-tls-version"]),["vmess","vless"].includes(s.type)&&s.network==="http"){let o=s["http-opts"]?.path;ae(s,"http-opts.path")&&!Array.isArray(o)&&(s["http-opts"].path=[o]);let l=s["http-opts"]?.headers?.Host;ae(s,"http-opts.headers.Host")&&!Array.isArray(l)&&(s["http-opts"].headers.Host=[l])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let o=s["h2-opts"]?.path;ae(s,"h2-opts.path")&&Array.isArray(o)&&(s["h2-opts"].path=o[0]);let l=s["h2-opts"]?.headers?.host;ae(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(s.network==="ws"){let o=s["ws-opts"]?.path,l=/^(.*?)(?:\?ed=(\d+))?$/,[f,p="",E=""]=l.exec(o);s["ws-opts"].path=p,E!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(E,10))}if(s["plugin-opts"]?.tls&&ae(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].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"],ae(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"],n!=="internal"||i["delete-underscore-fields"])for(let o in s)(s[o]==null||/^_/i.test(o))&&delete s[o];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"]=d9[s["ip-version"]]||s["ip-version"]),s});return n==="internal"?u:`proxies:
`+u.map(s=>" - "+JSON.stringify(s)+`
`).join("")}}}var uA="SurgeMac",g9=nc();function yd(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return aA(t);default:try{return g9.produce(t,r,n)}catch{if(n.useMihomoExternal)return _.log(`${t.name} is not supported on ${uA}, try to use Mihomo(SurgeMac - External Proxy Program) instead`),m9(t,r,n);throw new Error("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")}}}}}function aA(e){let t=new mt(e);if(!e.exec||!e["local-port"])throw new Error(`${e.type}: exec and local-port are required`);return t.append(`${e.name}=external,exec="${e.exec}",local-port=${e["local-port"]}`),Array.isArray(e.args)&&e.args.map(r=>{t.append(`,args="${r}"`)}),Array.isArray(e.addresses)&&e.addresses.map(r=>{t.append(`,addresses=${r}`)}),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),ae(e,"tfo")?t.append(`,tfo=${e.tfo}`):ae(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function m9(e,t,r){let n=Ii().produce([e],"internal")?.[0];if(n){let i=r?.localPort||e._localPort||65535,u=!["ipv4","v4-only"].includes(e["ip-version"]),s={name:e.name,type:"external",exec:e._exec||"/usr/local/bin/mihomo","local-port":i,args:["-config",pt.encode(JSON.stringify({"mixed-port":i,ipv6:u,mode:"global",dns:{enable:!0,ipv6:u,"default-nameserver":r?.defaultNameserver||e._defaultNameserver||["180.76.76.76","52.80.52.52","119.28.28.28","223.6.6.6"],nameserver:r?.nameserver||e._nameserver||["https://doh.pub/dns-query","https://dns.alidns.com/dns-query","https://doh-pure.onedns.net/dns-query"]},proxies:[{...n,name:"proxy"}],"proxy-groups":[{name:"GLOBAL",type:"select",proxies:["proxy"]}]}))],addresses:[]};return v9(e.server)?s.addresses.push(e.server):_.log(`Platform ${uA}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),r.localPort=i-1,aA(s)}}function v9(e){return Lr(e)||Rr(e)}function Fd(){return{type:"ALL",produce:(r,n,i={})=>{let u=r.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"])?!1:s["underlying-proxy"]||s["dialer-proxy"]?(_.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"?(ae(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ae(s,"sni")&&(s.servername=s.sni,delete s.sni),ae(s,"cipher")&&!["auto","aes-128-gcm","chacha20-poly1305","none"].includes(s.cipher)&&(s.cipher="auto")):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"&&ae(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let o=s["http-opts"]?.path;ae(s,"http-opts.path")&&!Array.isArray(o)&&(s["http-opts"].path=[o]);let l=s["http-opts"]?.headers?.Host;ae(s,"http-opts.headers.Host")&&!Array.isArray(l)&&(s["http-opts"].headers.Host=[l])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let o=s["h2-opts"]?.path;ae(s,"h2-opts.path")&&Array.isArray(o)&&(s["h2-opts"].path=o[0]);let l=s["h2-opts"]?.headers?.host;ae(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(s.network==="ws"){let o=s["ws-opts"]?.path,l=/^(.*?)(?:\?ed=(\d+))?$/,[f,p="",E=""]=l.exec(o);s["ws-opts"].path=p,E!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(E,10))}if(s["plugin-opts"]?.tls&&ae(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],ae(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"],n!=="internal")for(let o in s)(s[o]==null||/^_/i.test(o))&&delete s[o];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 n==="internal"?u:`proxies:
`+u.map(s=>" - "+JSON.stringify(s)+`
`).join("")}}}function gh(){return{type:"ALL",produce:(r,n,i={})=>{let u=r.filter(s=>!["ss","ssr","vmess","socks5","http","snell","trojan","tuic","vless","wireguard","hysteria","hysteria2","ssh","juicity"].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>=4||s.type==="vless"&&s["reality-opts"]&&!["xtls-rprx-vision"].includes(s.flow)?!1:s["underlying-proxy"]||s["dialer-proxy"]?(_.error(`Stash \u6682\u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${s.name}. \u8BF7\u4F7F\u7528 \u4EE3\u7406\u7684\u8F6C\u53D1\u94FE https://stash.wiki/proxy-protocols/proxy-groups#relay`),!1):!0).map(s=>{if(s.type==="vmess"?(ae(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ae(s,"sni")&&(s.servername=s.sni,delete s.sni),ae(s,"cipher")&&!["auto","aes-128-gcm","chacha20-poly1305","none"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ae(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),(!s.token||s.token.length===0)&&!ae(s,"version")&&(s.version=5)):s.type==="hysteria"?(ae(s,"auth_str")&&!ae(s,"auth-str")&&(s["auth-str"]=s.auth_str),ae(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ae(s,"down")&&!ae(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ae(s,"up")&&!ae(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ae(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ae(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="hysteria2"?(ae(s,"password")&&!ae(s,"auth")&&(s.auth=s.password,delete s.password),ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ae(s,"down")&&!ae(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ae(s,"up")&&!ae(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ae(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ae(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"&&ae(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let o=s["http-opts"]?.path;ae(s,"http-opts.path")&&!Array.isArray(o)&&(s["http-opts"].path=[o]);let l=s["http-opts"]?.headers?.Host;ae(s,"http-opts.headers.Host")&&!Array.isArray(l)&&(s["http-opts"].headers.Host=[l])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let o=s["h2-opts"]?.path;ae(s,"h2-opts.path")&&Array.isArray(o)&&(s["h2-opts"].path=o[0]);let l=s["h2-opts"]?.headers?.host;ae(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(s.network==="ws"){let o=s["ws-opts"]?.path,l=/^(.*?)(?:\?ed=(\d+))?$/,[f,p="",E=""]=l.exec(o);s["ws-opts"].path=p,E!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(E,10))}if(s["plugin-opts"]?.tls&&ae(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s["server-cert-fingerprint"]=s["tls-fingerprint"]),delete s["tls-fingerprint"],ae(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"],n!=="internal")for(let o in s)(s[o]==null||/^_/i.test(o))&&delete s[o];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 n==="internal"?u:`proxies:
`+u.map(s=>" - "+JSON.stringify(s)+`
`).join("")}}}var E9="Loon",bu={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function Dd(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return A9(t);case"ssr":return w9(t);case"trojan":return C9(t);case"vmess":return y9(t,n["include-unsupported-proxy"]);case"vless":return F9(t,n["include-unsupported-proxy"]);case"http":return D9(t);case"socks5":return S9(t);case"wireguard":return b9(t);case"hysteria2":return _9(t)}throw new Error(`Platform ${E9} does not support proxy type: ${t.type}`)}}}function A9(e){let t=new mt(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}"`),ae(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`)}if(ae(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,u=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),u){if(u<2)throw new Error(`shadow-tls version ${u} is not supported`);t.append(`,shadow-tls-version=${u}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=bu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function w9(e){let t=new mt(e);if(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"),ae(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,u=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),u){if(u<2)throw new Error(`shadow-tls version ${u} is not supported`);t.append(`,shadow-tls-version=${u}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=bu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function C9(e){let t=new mt(e);if(t.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,ae(e,"network"))if(e.network==="ws")t.append(",transport=ws"),t.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),t.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else throw new Error(`network ${e.network} is unsupported`);t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),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(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=bu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function y9(e){let t=!!e["reality-opts"],r=new mt(e);if(r.append(`${e.name}=vmess,${e.server},${e.port},${e.cipher},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ae(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(e.network==="http"){r.append(",transport=http");let i=e["http-opts"]?.path,u=e["http-opts"]?.headers?.Host;r.appendIfPresent(`,path=${Array.isArray(i)?i[0]:i}`,"http-opts.path"),r.appendIfPresent(`,host=${Array.isArray(u)?u[0]:u}`,"http-opts.headers.Host")}else throw new Error(`network ${e.network} is unsupported`);else r.append(",transport=tcp");r.appendIfPresent(`,over-tls=${e.tls}`,"tls"),r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t?(r.appendIfPresent(`,sni=${e.sni}`,"sni"),r.appendIfPresent(`,public-key="${e["reality-opts"]["public-key"]}"`,"reality-opts.public-key"),r.appendIfPresent(`,short-id=${e["reality-opts"]["short-id"]}`,"reality-opts.short-id")):(r.appendIfPresent(`,tls-name=${e.sni}`,"sni"),r.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),r.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),ae(e,"aead")?r.append(`,alterId=${e.aead?0:1}`):r.append(`,alterId=${e.alterId}`),r.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?r.append(",block-quic=true"):e["block-quic"]==="off"&&r.append(",block-quic=false"),e.udp&&r.append(",udp=true");let n=bu[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${n}`,"ip-version"),r.toString()}function F9(e){let t=!1,r=!!e["reality-opts"];if(typeof e.flow<"u")if(["xtls-rprx-vision"].includes(e.flow))t=!0;else throw new Error(`VLESS flow(${e.flow}) is not supported`);let n=new mt(e);if(n.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ae(e,"network"))if(e.network==="ws")n.append(",transport=ws"),n.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),n.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){n.append(",transport=http");let u=e["http-opts"]?.path,s=e["http-opts"]?.headers?.Host;n.appendIfPresent(`,path=${Array.isArray(u)?u[0]:u}`,"http-opts.path"),n.appendIfPresent(`,host=${Array.isArray(s)?s[0]:s}`,"http-opts.headers.Host")}else throw new Error(`network ${e.network} is unsupported`);else n.append(",transport=tcp");n.appendIfPresent(`,over-tls=${e.tls}`,"tls"),n.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t&&n.appendIfPresent(`,flow=${e.flow}`,"flow"),r?(n.appendIfPresent(`,sni=${e.sni}`,"sni"),n.appendIfPresent(`,public-key="${e["reality-opts"]["public-key"]}"`,"reality-opts.public-key"),n.appendIfPresent(`,short-id=${e["reality-opts"]["short-id"]}`,"reality-opts.short-id")):(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 i=bu[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${i}`,"ip-version"),n.toString()}function D9(e){let t=new mt(e),r=e.tls?"https":"http";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false");let n=bu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function S9(e){let t=new mt(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"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=bu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function b9(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 mt(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(o=>Rr(o));let s=e.dns.find(o=>Lr(o));s||(s=e.dns.find(o=>!Lr(o)&&!Rr(o))),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 r=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],n=Array.isArray(e.reserved)?e.reserved.join(","):e.reserved;n&&(n=`,reserved=[${n}]`);let i=e["preshared-key"]??e["pre-shared-key"];i&&(i=`,preshared-key="${i}"`),t.append(`,peers=[{public-key="${e["public-key"]}",allowed-ips="${r??"0.0.0.0/0,::/0"}",endpoint=${e.server}:${e.port}${n??""}${i??""}}]`);let u=bu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${u}`,"ip-version"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),t.toString()}function _9(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new mt(e);t.append(`${e.name}=Hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,"${e.password}"`,"password"),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"),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"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn");let r=bu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function ic(){return{type:"SINGLE",produce:r=>{let n="";delete r.subName,delete r.collectionName,delete r.id,delete r.resolved,delete r["no-resolve"];for(let i in r)r[i]==null&&delete r[i];switch(["trojan","tuic","hysteria","hysteria2","juicity"].includes(r.type)&&delete r.tls,!["vmess"].includes(r.type)&&r.server&&Rr(r.server)&&(r.server=`[${r.server}]`),r.type){case"socks5":n=`socks://${encodeURIComponent(pt.encode(`${r.username??""}:${r.password??""}`))}@${r.server}:${r.port}#${r.name}`;break;case"ss":let i=`${r.cipher}:${r.password}`;if(n=`ss://${r.cipher?.startsWith("2022-blake3-")?`${encodeURIComponent(r.cipher)}:${encodeURIComponent(r.password)}`:pt.encode(i)}@${r.server}:${r.port}${r.plugin?"/":""}`,r.plugin){n+="?plugin=";let ce=r["plugin-opts"];switch(r.plugin){case"obfs":n+=encodeURIComponent(`simple-obfs;obfs=${ce.mode}${ce.host?";obfs-host="+ce.host:""}`);break;case"v2ray-plugin":n+=encodeURIComponent(`v2ray-plugin;obfs=${ce.mode}${ce.host?";obfs-host"+ce.host:""}${ce.tls?";tls":""}`);break;case"shadow-tls":n+=encodeURIComponent(`shadow-tls;host=${ce.host};password=${ce.password};version=${ce.version}`);break;default:throw new Error(`Unsupported plugin option: ${r.plugin}`)}}r["udp-over-tcp"]&&(n=`${n}${r.plugin?"&":"?"}uot=1`),r.tfo&&(n=`${n}${r.plugin||r["udp-over-tcp"]?"&":"?"}tfo=1`),n+=`#${encodeURIComponent(r.name)}`;break;case"ssr":n=`${r.server}:${r.port}:${r.protocol}:${r.cipher}:${r.obfs}:${pt.encode(r.password)}/`,n+=`?remarks=${pt.encode(r.name)}${r["obfs-param"]?"&obfsparam="+pt.encode(r["obfs-param"]):""}${r["protocol-param"]?"&protocolparam="+pt.encode(r["protocol-param"]):""}`,n="ssr://"+pt.encode(n);break;case"vmess":let u="",s=r.network||"tcp";if(r.network==="http"?(s="tcp",u="http"):r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(s="httpupgrade"),n={v:"2",ps:r.name,add:r.server,port:`${r.port}`,id:r.uuid,aid:`${r.alterId||0}`,scy:r.cipher,net:s,type:u,tls:r.tls?"tls":"",alpn:Array.isArray(r.alpn)?r.alpn.join(","):r.alpn,fp:r["client-fingerprint"]},r.tls&&r.sni&&(n.sni=r.sni),r.network){let ce=r[`${r.network}-opts`]?.path,Be=r[`${r.network}-opts`]?.headers?.Host;["grpc"].includes(r.network)?(n.path=r[`${r.network}-opts`]?.["grpc-service-name"],n.type=r[`${r.network}-opts`]?.["_grpc-type"]||"gun",n.host=r[`${r.network}-opts`]?.["_grpc-authority"]):["kcp","quic"].includes(r.network)?(n.type=r[`${r.network}-opts`]?.[`_${r.network}-type`]||"none",n.host=r[`${r.network}-opts`]?.[`_${r.network}-host`],n.path=r[`${r.network}-opts`]?.[`_${r.network}-path`]):(ce&&(n.path=Array.isArray(ce)?ce[0]:ce),Be&&(n.host=Array.isArray(Be)?Be[0]:Be))}n="vmess://"+pt.encode(JSON.stringify(n));break;case"vless":let o="none",l=r["reality-opts"],f="",p="",E="";if(l){o="reality";let ce=r["reality-opts"]?.["public-key"];ce&&(p=`&pbk=${encodeURIComponent(ce)}`);let Be=r["reality-opts"]?.["short-id"];Be&&(f=`&sid=${encodeURIComponent(Be)}`);let Ge=r["reality-opts"]?.["_spider-x"];Ge&&(E=`&spx=${encodeURIComponent(Ge)}`)}else r.tls&&(o="tls");let d="";r.alpn&&(d=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let h="";r["skip-cert-verify"]&&(h="&allowInsecure=1");let w="";r.sni&&(w=`&sni=${encodeURIComponent(r.sni)}`);let m="";r["client-fingerprint"]&&(m=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let y="";r.flow&&(y=`&flow=${encodeURIComponent(r.flow)}`);let A="";r._extra&&(A=`&extra=${encodeURIComponent(r._extra)}`);let C="";r._mode&&(C=`&mode=${encodeURIComponent(r._mode)}`);let S=r.network;r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(S="httpupgrade");let B=`&type=${encodeURIComponent(S)}`;if(["grpc"].includes(r.network)){B+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`;let ce=r[`${r.network}-opts`]?.["_grpc-authority"];ce&&(B+=`&authority=${encodeURIComponent(ce)}`)}let I=r[`${r.network}-opts`]?.[`${r.network}-service-name`],M=r[`${r.network}-opts`]?.path,q=r[`${r.network}-opts`]?.headers?.Host;M&&(B+=`&path=${encodeURIComponent(Array.isArray(M)?M[0]:M)}`),q&&(B+=`&host=${encodeURIComponent(Array.isArray(q)?q[0]:q)}`),I&&(B+=`&serviceName=${encodeURIComponent(I)}`),r.network==="kcp"&&(r.seed&&(B+=`&seed=${encodeURIComponent(r.seed)}`),r.headerType&&(B+=`&headerType=${encodeURIComponent(r.headerType)}`)),n=`vless://${r.uuid}@${r.server}:${r.port}?security=${encodeURIComponent(o)}${B}${d}${h}${w}${m}${y}${f}${E}${p}${C}${A}#${encodeURIComponent(r.name)}`;break;case"trojan":let b="";if(r.network){let ce=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(ce="httpupgrade"),b=`&type=${encodeURIComponent(ce)}`,["grpc"].includes(r.network)){let Tr=r[`${r.network}-opts`]?.[`${r.network}-service-name`],Jt=r[`${r.network}-opts`]?.["_grpc-authority"];Tr&&(b+=`&serviceName=${encodeURIComponent(Tr)}`),Jt&&(b+=`&authority=${encodeURIComponent(Jt)}`),b+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let Be=r[`${r.network}-opts`]?.path,Ge=r[`${r.network}-opts`]?.headers?.Host;Be&&(b+=`&path=${encodeURIComponent(Array.isArray(Be)?Be[0]:Be)}`),Ge&&(b+=`&host=${encodeURIComponent(Array.isArray(Ge)?Ge[0]:Ge)}`)}let R="";r["client-fingerprint"]&&(R=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let L="";r.alpn&&(L=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let j=r["reality-opts"],G="",Y="",V="",z="",J="",se="";if(j){z="&security=reality";let ce=r["reality-opts"]?.["public-key"];ce&&(Y=`&pbk=${encodeURIComponent(ce)}`);let Be=r["reality-opts"]?.["short-id"];Be&&(G=`&sid=${encodeURIComponent(Be)}`);let Ge=r["reality-opts"]?.["_spider-x"];Ge&&(V=`&spx=${encodeURIComponent(Ge)}`),r._extra&&(se=`&extra=${encodeURIComponent(r._extra)}`),r._mode&&(J=`&mode=${encodeURIComponent(r._mode)}`)}n=`trojan://${r.password}@${r.server}:${r.port}?sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}${b}${L}${R}${z}${G}${Y}${V}${J}${se}#${encodeURIComponent(r.name)}`;break;case"hysteria2":let De=[];r["hop-interval"]&&De.push(`hop-interval=${r["hop-interval"]}`),r.keepalive&&De.push(`keepalive=${r.keepalive}`),r["skip-cert-verify"]&&De.push("insecure=1"),r.obfs&&(De.push(`obfs=${encodeURIComponent(r.obfs)}`),r["obfs-password"]&&De.push(`obfs-password=${encodeURIComponent(r["obfs-password"])}`)),r.sni&&De.push(`sni=${encodeURIComponent(r.sni)}`),r.ports&&De.push(`mport=${r.ports}`),r["tls-fingerprint"]&&De.push(`pinSHA256=${encodeURIComponent(r["tls-fingerprint"])}`),r.tfo&&De.push("fastopen=1"),n=`hysteria2://${encodeURIComponent(r.password)}@${r.server}:${r.port}?${De.join("&")}#${encodeURIComponent(r.name)}`;break;case"hysteria":let ye=[];Object.keys(r).forEach(ce=>{if(!["name","type","server","port"].includes(ce)){let Be=ce.replace(/-/,"_");["alpn"].includes(ce)?r[ce]&&ye.push(`${Be}=${encodeURIComponent(Array.isArray(r[ce])?r[ce][0]:r[ce])}`):["skip-cert-verify"].includes(ce)?r[ce]&&ye.push("insecure=1"):["tfo","fast-open"].includes(ce)?r[ce]&&!ye.includes("fastopen=1")&&ye.push("fastopen=1"):["ports"].includes(ce)?ye.push(`mport=${r[ce]}`):["auth-str"].includes(ce)?ye.push(`auth=${r[ce]}`):["up"].includes(ce)?ye.push(`upmbps=${r[ce]}`):["down"].includes(ce)?ye.push(`downmbps=${r[ce]}`):["_obfs"].includes(ce)?ye.push(`obfs=${r[ce]}`):["obfs"].includes(ce)?ye.push(`obfsParam=${r[ce]}`):["sni"].includes(ce)?ye.push(`peer=${r[ce]}`):r[ce]&&!/^_/i.test(ce)&&ye.push(`${Be}=${encodeURIComponent(r[ce])}`)}}),n=`hysteria://${r.server}:${r.port}?${ye.join("&")}#${encodeURIComponent(r.name)}`;break;case"tuic":if(!r.token||r.token.length===0){let ce=[];Object.keys(r).forEach(Be=>{if(!["name","type","uuid","password","server","port","tls"].includes(Be)){let Ge=Be.replace(/-/,"_");["alpn"].includes(Be)?r[Be]&&ce.push(`${Ge}=${encodeURIComponent(Array.isArray(r[Be])?r[Be][0]:r[Be])}`):["skip-cert-verify"].includes(Be)?r[Be]&&ce.push("allow_insecure=1"):["tfo","fast-open"].includes(Be)?r[Be]&&!ce.includes("fast_open=1")&&ce.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(Be)&&r[Be]?ce.push(`${Ge.replace(/-/g,"_")}=1`):["congestion-controller"].includes(Be)?ce.push(`congestion_control=${r[Be]}`):r[Be]&&!/^_/i.test(Be)&&ce.push(`${Ge.replace(/-/g,"_")}=${encodeURIComponent(r[Be])}`)}}),n=`tuic://${encodeURIComponent(r.uuid)}:${encodeURIComponent(r.password)}@${r.server}:${r.port}?${ce.join("&")}#${encodeURIComponent(r.name)}`}break;case"anytls":let Pe=[];Object.keys(r).forEach(ce=>{if(!["name","type","password","server","port","tls"].includes(ce)){let Be=ce.replace(/-/,"_");["alpn"].includes(ce)?r[ce]&&Pe.push(`${Be}=${encodeURIComponent(Array.isArray(r[ce])?r[ce][0]:r[ce])}`):["skip-cert-verify"].includes(ce)?r[ce]&&Pe.push("insecure=1"):["udp"].includes(ce)?r[ce]&&Pe.push("udp=1"):r[ce]&&!/^_/i.test(ce)&&Pe.push(`${Be.replace(/-/g,"_")}=${encodeURIComponent(r[ce])}`)}}),n=`anytls://${encodeURIComponent(r.password)}@${r.server}:${r.port}/?${Pe.join("&")}#${encodeURIComponent(r.name)}`;break;case"wireguard":let Qe=[];Object.keys(r).forEach(ce=>{["name","type","server","port","ip","ipv6","private-key"].includes(ce)||(["public-key"].includes(ce)?Qe.push(`publickey=${r[ce]}`):["udp"].includes(ce)?r[ce]&&Qe.push(`${ce}=1`):r[ce]&&!/^_/i.test(ce)&&Qe.push(`${ce}=${encodeURIComponent(r[ce])}`))}),r.ip&&r.ipv6?Qe.push(`address=${r.ip}/32,${r.ipv6}/128`):r.ip?Qe.push(`address=${r.ip}/32`):r.ipv6&&Qe.push(`address=${r.ipv6}/128`),n=`wireguard://${encodeURIComponent(r["private-key"])}@${r.server}:${r.port}/?${Qe.join("&")}#${encodeURIComponent(r.name)}`;break}return n}}}var I9=ic();function sl(){return{type:"ALL",produce:r=>{let n=[];return r.map(i=>{try{n.push(I9.produce(i))}catch(u){_.error(`Cannot produce proxy: ${JSON.stringify(i,null,2)}
Reason: ${u}`)}}),pt.encode(n.join(`
`))}}}var B9="QX";function ul(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return $9(t);case"ssr":return P9(t);case"trojan":return R9(t);case"vmess":return T9(t);case"http":return N9(t);case"socks5":return x9(t);case"vless":return O9(t)}throw new Error(`Platform ${B9} does not support proxy type: ${t.type}`)}}}function $9(e){let t=new mt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(e.cipher||(e.cipher="none"),!["none","rc4-md5","rc4-md5-6","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","cast5-cfb","des-cfb","rc2-cfb","salsa20","chacha20","chacha20-ietf","aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),Bi(e)&&(e.tls=!0),ae(e,"plugin")){if(e.plugin==="obfs"){let i=e["plugin-opts"];r(`,obfs=${i.mode}`)}else if(e.plugin==="v2ray-plugin"&&e["plugin-opts"].mode==="websocket")e["plugin-opts"].tls?r(",obfs=wss"):r(",obfs=ws");else throw new Error("plugin is not supported");n(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),n(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path")}return Bi(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),e._ssr_python_uot?r(",udp-over-tcp=true"):e["udp-over-tcp"]&&(!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?r(",udp-over-tcp=sp.v1"):e["udp-over-tcp-version"]===2&&r(",udp-over-tcp=sp.v2")),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function P9(e){let t=new mt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),r(`,ssr-protocol=${e.protocol}`),n(`,ssr-protocol-param=${e["protocol-param"]}`,"protocol-param"),n(`,obfs=${e.obfs}`,"obfs"),n(`,obfs-host=${e["obfs-param"]}`,"obfs-param"),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function R9(e){let t=new mt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`trojan=${e.server}:${e.port}`),r(`,password=${e.password}`),ae(e,"network"))if(e.network==="ws")Bi(e)?r(",obfs=wss"):r(",obfs=ws"),n(`,obfs-uri=${e["ws-opts"]?.path}`,"ws-opts.path"),n(`,obfs-host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else throw new Error(`network ${e.network} is unsupported`);return e.network!=="ws"&&Bi(e)&&r(",over-tls=true"),Bi(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function T9(e){let t=new mt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);r(`vmess=${e.server}:${e.port}`);let i;if(e.cipher==="auto"?i="chacha20-ietf-poly1305":i=e.cipher,r(`,method=${i}`),r(`,password=${e.uuid}`),Bi(e)&&(e.tls=!0),ae(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(",obfs=http");else throw new Error(`network ${e.network} is unsupported`);let u=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(u)?u[0]:u}`,`${e.network}-opts.path`),n(`,obfs-host=${Array.isArray(s)?s[0]:s}`,`${e.network}-opts.headers.Host`)}else e.tls&&r(",obfs=over-tls");return Bi(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),ae(e,"aead")?r(`,aead=${e.aead}`):r(`,aead=${e.alterId===0}`),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function O9(e){if(typeof e.flow<"u"||e["reality-opts"])throw new Error("VLESS XTLS/REALITY is not supported");let t=new mt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`vless=${e.server}:${e.port}`),r(",method=none"),r(`,password=${e.uuid}`),Bi(e)&&(e.tls=!0),ae(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(",obfs=http");else if(["tcp"].includes(e.network))e.tls&&r(",obfs=over-tls");else if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`);let u=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(u)?u[0]:u}`,`${e.network}-opts.path`),n(`,obfs-host=${Array.isArray(s)?s[0]:s}`,`${e.network}-opts.headers.Host`)}else e.tls&&r(",obfs=over-tls");return Bi(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function N9(e){let t=new mt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`http=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),Bi(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Bi(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function x9(e){let t=new mt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`socks5=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),Bi(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Bi(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function Bi(e){return e.tls}function al(){return{type:"ALL",produce:(r,n,i={})=>{let u=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&s.version>=4?!1:!["mieru"].includes(s.type)).map(s=>{if(s.type==="vmess"?(ae(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ae(s,"sni")&&(s.servername=s.sni,delete s.sni),ae(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ae(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ae(s,"version")&&(s.version=5)):s.type==="hysteria"?(ae(s,"auth_str")&&!ae(s,"auth-str")&&(s["auth-str"]=s.auth_str),ae(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo)):s.type==="hysteria2"?(s["obfs-password"]&&s.obfs=="salamander"&&(s.obfs=s["obfs-password"],delete s["obfs-password"]),ae(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ae(s,"tfo")&&!ae(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.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"?ae(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"&&ae(s,"shadow-tls-password")&&!ae(s,"plugin")&&(s.plugin="shadow-tls",s["plugin-opts"]={host:s["shadow-tls-sni"],password:s["shadow-tls-password"],version:s["shadow-tls-version"]},delete s["shadow-tls-password"],delete s["shadow-tls-sni"],delete s["shadow-tls-version"]),["vmess","vless"].includes(s.type)&&s.network==="http"){let o=s["http-opts"]?.path;ae(s,"http-opts.path")&&!Array.isArray(o)&&(s["http-opts"].path=[o]);let l=s["http-opts"]?.headers?.Host;ae(s,"http-opts.headers.Host")&&!Array.isArray(l)&&(s["http-opts"].headers.Host=[l])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let o=s["h2-opts"]?.path;ae(s,"h2-opts.path")&&Array.isArray(o)&&(s["h2-opts"].path=o[0]);let l=s["h2-opts"]?.headers?.host;ae(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(s.network==="ws"){let o=s["ws-opts"]?.path,l=/^(.*?)(?:\?ed=(\d+))?$/,[f,p="",E=""]=l.exec(o);s["ws-opts"].path=p,E!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(E,10))}if(s["plugin-opts"]?.tls&&ae(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].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"],ae(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"],n!=="internal")for(let o in s)(s[o]==null||/^_/i.test(o))&&delete s[o];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 n==="internal"?u:`proxies:
`+u.map(s=>" - "+JSON.stringify(s)+`
`).join("")}}}var k9="Surfboard";function mh(){return{produce:t=>{switch(t.name=t.name.replace(/=|,/g,""),t.type){case"ss":return L9(t);case"trojan":return U9(t);case"vmess":return H9(t);case"http":return j9(t);case"socks5":return M9(t);case"wireguard-surge":return q9(t)}throw new Error(`Platform ${k9} does not support proxy type: ${t.type}`)}}}function L9(e){let t=new mt(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"].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"),ae(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.toString()}function U9(e){let t=new mt(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),oA(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function H9(e){let t=new mt(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,username=${e.uuid}`,"uuid"),oA(t,e),ae(e,"aead")?t.append(`,vmess-aead=${e.aead}`):t.append(`,vmess-aead=${e.alterId===0}`),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function j9(e){let t=new mt(e),r=e.tls?"https":"http";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function M9(e){let t=new mt(e),r=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function q9(e){let t=new mt(e);return t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.toString()}function oA(e,t){if(ae(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ae(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ae(t,"ws-opts.headers"))){let r=t["ws-opts"].headers,n=Object.keys(r).map(i=>{let u=r[i];return["Host"].includes(i)&&(u=`"${u}"`),`${i}:${u}`}).join("|");_s(n)&&e.append(`,ws-headers=${n}`)}}else throw new Error(`network ${t.network} is unsupported`)}var K9={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"},fi=(e,t)=>{let r=K9[e["ip-version"]];e._dns_server&&r&&(t.domain_resolver={server:e._dns_server,strategy:r})},hi=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},_u=(e,t)=>{["tcp","udp"].includes(e._network)&&(t.network=e._network)},$i=(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},Ms=(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))))},Sd=(e,t)=>{let r={type:"ws",headers:{}};if(e["ws-opts"]){let{path:n="",headers:i={},"max-early-data":u,"early-data-header-name":s}=e["ws-opts"];if(r.early_data_header_name=s,r.max_early_data=parseInt(u,10),n!==""&&(r.path=`${n}`),Object.keys(i).length>0){let o={};for(let f of Object.keys(i)){let p=i[f];p!==""&&(Array.isArray(p)||(p=[`${p}`]),p.length>0&&(o[f]=p))}let{Host:l}=o;if(l.length===1)for(let f of`Host:${l[0]}`.split(`
`)){let[p,E]=f.split(":");E.trim()!==""&&(o[p.trim()]=E.trim().split(","))}r.headers=o}}if(e["ws-headers"]){let n={};for(let u of Object.keys(e["ws-headers"])){let s=e["ws-headers"][u];s!==""&&(Array.isArray(s)||(s=[`${s}`]),s.length>0&&(n[u]=s))}let{Host:i}=n;if(i.length===1)for(let u of`Host:${i[0]}`.split(`
`)){let[s,o]=u.split(":");o.trim()!==""&&(n[s.trim()]=o.trim().split(","))}for(let u of Object.keys(n))r.headers[u]=n[u]}if(e["ws-path"]&&e["ws-path"]!==""&&(r.path=`${e["ws-path"]}`),r.path){let n=/^(.*?)(?:\?ed=(\d+))?$/,[i,u="",s=""]=n.exec(r.path);r.path=u,s!==""&&(r.early_data_header_name="Sec-WebSocket-Protocol",r.max_early_data=parseInt(s,10))}t.tls.insecure&&(t.tls.server_name=r.headers.Host[0]),e["ws-opts"]&&e["ws-opts"]["v2ray-http-upgrade"]&&(r.type="httpupgrade",r.headers.Host&&(r.host=r.headers.Host[0],delete r.headers.Host),r.max_early_data&&delete r.max_early_data,r.early_data_header_name&&delete r.early_data_header_name);for(let n of Object.keys(r.headers)){let i=r.headers[n];i.length===1&&(r.headers[n]=i[0])}t.transport=r},cA=(e,t)=>{let r={type:"http",headers:{}};if(e["http-opts"]){let{method:n="",path:i="",headers:u={}}=e["http-opts"];n!==""&&(r.method=n),Array.isArray(i)?r.path=`${i[0]}`:i!==""&&(r.path=`${i}`);for(let s of Object.keys(u)){let o=u[s];if(o!==""){if(s.toLowerCase()==="host"){let l=o;Array.isArray(l)||(l=`${l}`.split(",").map(f=>f.trim())),l.length>0&&(r.host=l);continue}Array.isArray(o)||(o=`${o}`.split(",").map(l=>l.trim())),o.length>0&&(r.headers[s]=o)}}}if(e["http-host"]&&e["http-host"]!==""){let n=e["http-host"];Array.isArray(n)||(n=`${n}`.split(",").map(i=>i.trim())),n.length>0&&(r.host=n)}if(e["http-path"]&&e["http-path"]!==""){let n=e["http-path"];Array.isArray(n)?r.path=`${n[0]}`:n!==""&&(r.path=`${n}`)}t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host?.length===1&&(r.host=r.host[0]);for(let n of Object.keys(r.headers)){let i=r.headers[n];i.length===1&&(r.headers[n]=i[0])}t.transport=r},lA=(e,t)=>{let r={type:"http"};if(e["h2-opts"]){let{host:n="",path:i=""}=e["h2-opts"];i!==""&&(r.path=`${i}`),n!==""&&(Array.isArray(n)||(n=`${n}`.split(",").map(u=>u.trim())),n.length>0&&(r.host=n))}if(e["h2-host"]&&e["h2-host"]!==""){let n=e["h2-host"];Array.isArray(n)||(n=`${n}`.split(",").map(i=>i.trim())),n.length>0&&(r.host=n)}e["h2-path"]&&e["h2-path"]!==""&&(r.path=`${e["h2-path"]}`),t.tls.enabled=!0,t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host.length===1&&(r.host=r.host[0]),t.transport=r},bd=(e,t)=>{let r={type:"grpc"};if(e["grpc-opts"]){let n=e["grpc-opts"]["grpc-service-name"];n!=null&&n!==""&&(r.service_name=`${n}`)}t.transport=r},na=(e,t)=>{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.ca&&(t.tls.certificate_path=`${e.ca}`),e.ca_str&&(t.tls.certificate=[e.ca_str]),e["ca-str"]&&(t.tls.certificate=[e["ca-str"]]),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"]!==""&&(t.tls.utls={enabled:!0,fingerprint:e["client-fingerprint"]}),t.tls.enabled||delete t.tls},V9=(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";return e.username&&(t.user=e.username),e.password&&(t.password=e.password),e.privateKey&&(t.private_key_path=e.privateKey),e["private-key"]&&(t.private_key_path=e["private-key"]),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),$i(e,t),hi(e,t),fi(e,t),t},G9=(e={})=>{let t={tag:e.name,type:"http",server:e.server,server_port:parseInt(`${e.port}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";if(e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.headers){t.headers={};for(let r of Object.keys(e.headers))t.headers[r]=`${e.headers[r]}`;Object.keys(t.headers).length===0&&delete t.headers}return e["fast-open"]&&(t.udp_fragment=!0),$i(e,t),hi(e,t),na(e,t),fi(e,t),t},z9=(e={})=>{let t={tag:e.name,type:"socks",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,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=!0),e["fast-open"]&&(t.udp_fragment=!0),_u(e,t),$i(e,t),hi(e,t),fi(e,t),t},Y9=(e={})=>{let t={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:`${e.name}_shadowtls`};e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2});let r={tag:`${e.name}_shadowtls`,type:"shadowtls",server:e.server,server_port:parseInt(`${e.port}`,10),version:e["plugin-opts"].version,password:e["plugin-opts"].password,tls:{enabled:!0,server_name:e["plugin-opts"].host,utls:{enabled:!0,fingerprint:e["client-fingerprint"]}}};if(r.server_port<0||r.server_port>65535)throw"\u7AEF\u53E3\u503C\u975E\u6CD5";return e["fast-open"]===!0&&(r.udp_fragment=!0),$i(e,r),hi(e,r),Ms(e.smux,t),fi(e,r),{type:"ss-with-st",ssPart:t,stPart:r}},W9=(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),_u(e,t),$i(e,t),hi(e,t),Ms(e.smux,t),fi(e,t),e.plugin){let r=[];e.plugin==="obfs"&&(t.plugin="obfs-local",t.plugin_opts="",e["obfs-host"]&&(e["plugin-opts"].host=e["obfs-host"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"mode":r.push(`obfs=${e["plugin-opts"].mode}`);break;case"host":r.push(`obfs-host=${e["plugin-opts"].host}`);break;default:r.push(`${n}=${e["plugin-opts"][n]}`);break}})),e.plugin==="v2ray-plugin"&&(t.plugin="v2ray-plugin",e["ws-host"]&&(e["plugin-opts"].host=e["ws-host"]),e["ws-path"]&&(e["plugin-opts"].path=e["ws-path"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"tls":e["plugin-opts"].tls&&r.push("tls");break;case"host":r.push(`host=${e["plugin-opts"].host}`);break;case"path":r.push(`path=${e["plugin-opts"].path}`);break;case"headers":r.push(`headers=${JSON.stringify(e["plugin-opts"].headers)}`);break;case"mux":e["plugin-opts"].mux&&(t.multiplex={enabled:!0});break;default:r.push(`${n}=${e["plugin-opts"][n]}`)}})),t.plugin_opts=r.join(";")}return t},J9=(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),$i(e,t),hi(e,t),Ms(e.smux,t),fi(e,t),t},X9=(e={})=>{let t={tag:e.name,type:"vmess",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,security:e.cipher,alter_id:parseInt(`${e.alterId}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(["auto","none","zero","aes-128-gcm","chacha20-poly1305","aes-128-ctr"].indexOf(t.security)===-1&&(t.security="auto"),t.server_port<0||t.server_port>65535)throw"invalid port";return e.xudp&&(t.packet_encoding="xudp"),e["fast-open"]&&(t.udp_fragment=!0),e.network==="ws"&&Sd(e,t),e.network==="h2"&&lA(e,t),e.network==="http"&&cA(e,t),e.network==="grpc"&&bd(e,t),_u(e,t),$i(e,t),hi(e,t),na(e,t),Ms(e.smux,t),fi(e,t),t},Z9=(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 e.xudp&&(t.packet_encoding="xudp"),e["fast-open"]&&(t.udp_fragment=!0),e.flow!=null&&(t.flow=e.flow),e.network==="ws"&&Sd(e,t),e.network==="h2"&&lA(e,t),e.network==="http"&&cA(e,t),e.network==="grpc"&&bd(e,t),_u(e,t),$i(e,t),hi(e,t),Ms(e.smux,t),na(e,t),fi(e,t),t},Q9=(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"&&bd(e,t),e.network==="ws"&&Sd(e,t),_u(e,t),$i(e,t),hi(e,t),na(e,t),Ms(e.smux,t),fi(e,t),t},e$=(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.auth_str&&(t.auth_str=`${e.auth_str}`),e["auth-str"]&&(t.auth_str=`${e["auth-str"]}`),e["fast-open"]&&(t.udp_fragment=!0);let r=new RegExp("^[0-9]+[ ]*[KMGT]*[Bb]ps$");return r.test(`${e.up}`)&&!`${e.up}`.endsWith("Mbps")?t.up=`${e.up}`:t.up_mbps=parseInt(`${e.up}`,10),r.test(`${e.down}`)&&!`${e.down}`.endsWith("Mbps")?t.down=`${e.down}`:t.down_mbps=parseInt(`${e.down}`,10),e.obfs&&(t.obfs=e.obfs),e.recv_window_conn&&(t.recv_window_conn=e.recv_window_conn),e["recv-window-conn"]&&(t.recv_window_conn=e["recv-window-conn"]),e.recv_window&&(t.recv_window=e.recv_window),e["recv-window"]&&(t.recv_window=e["recv-window"]),e.disable_mtu_discovery&&(typeof e.disable_mtu_discovery=="boolean"?t.disable_mtu_discovery=e.disable_mtu_discovery:e.disable_mtu_discovery===1&&(t.disable_mtu_discovery=!0)),_u(e,t),na(e,t),hi(e,t),$i(e,t),Ms(e.smux,t),fi(e,t),t},t$=(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";return 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=>r.replace(/\s*-\s*/g,":"))),e.up&&(t.up_mbps=parseInt(`${e.up}`,10)),e.down&&(t.down_mbps=parseInt(`${e.down}`,10)),e.obfs==="salamander"&&(t.obfs.type="salamander"),e["obfs-password"]&&(t.obfs.password=e["obfs-password"]),t.obfs.type||delete t.obfs,_u(e,t),na(e,t),$i(e,t),hi(e,t),Ms(e.smux,t),fi(e,t),t},r$=(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`),_u(e,t),$i(e,t),hi(e,t),na(e,t),Ms(e.smux,t),fi(e,t),t},n$=(e={})=>{let t={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/^\d+$/.test(e["idle-session-check-interval"])&&(t.idle_session_check_interval=`${e["idle-session-check-interval"]}s`),/^\d+$/.test(e["idle-session-timeout"])&&(t.idle_session_timeout=`${e["idle-session-timeout"]}s`),/^\d+$/.test(e["min-idle-session"])&&(t.min_idle_session=parseInt(`${e["min-idle-session"]}`,10)),hi(e,t),na(e,t),fi(e,t),t},i$=(e={})=>{let t=["ip","ipv6"].map(n=>e[n]).map(n=>{if(Lr(n))return`${n}/32`;if(Rr(n))return`${n}/128`}).filter(n=>n),r={tag:e.name,type:"wireguard",server:e.server,server_port:parseInt(`${e.port}`,10),local_address:t,private_key:e["private-key"],peer_public_key:e["public-key"],pre_shared_key:e["pre-shared-key"],reserved:[]};if(r.server_port<0||r.server_port>65535)throw"invalid port";if(e["fast-open"]&&(r.udp_fragment=!0),typeof e.reserved=="string")r.reserved=e.reserved;else if(Array.isArray(e.reserved))for(let n of e.reserved)r.reserved.push(n);else delete r.reserved;if(e.peers&&e.peers.length>0){r.peers=[];for(let n of e.peers){let i={server:n.server,server_port:parseInt(`${n.port}`,10),public_key:n["public-key"],allowed_ips:n["allowed-ips"]||n.allowed_ips,reserved:[]};if(typeof n.reserved=="string")i.reserved.push(n.reserved);else if(Array.isArray(n.reserved))for(let u of n.reserved)i.reserved.push(u);else delete i.reserved;n["pre-shared-key"]&&(i.pre_shared_key=n["pre-shared-key"]),r.peers.push(i)}}return _u(e,r),$i(e,r),hi(e,r),Ms(e.smux,r),fi(e,r),r};function vh(){return{type:"ALL",produce:(r,n,i={})=>{let u=[];return Ii().produce(r,"internal",{"include-unsupported-proxy":!0}).map(s=>{try{switch(s.type){case"ssh":u.push(V9(s));break;case"http":u.push(G9(s));break;case"socks5":if(s.tls)throw new Error(`Platform sing-box does not support proxy type: ${s.type} with tls`);u.push(z9(s));break;case"ss":if(s.plugin==="shadow-tls"){let{ssPart:o,stPart:l}=Y9(s);u.push(o),u.push(l)}else u.push(W9(s));break;case"ssr":if(i["include-unsupported-proxy"])u.push(J9(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type}`);break;case"vmess":if(!s.network||["ws","grpc","h2","http"].includes(s.network))u.push(X9(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with network ${s.network}`);break;case"vless":if(!s.flow||["xtls-rprx-vision"].includes(s.flow))u.push(Z9(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with flow ${s.flow}`);break;case"trojan":if(!s.flow)u.push(Q9(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with flow ${s.flow}`);break;case"hysteria":u.push(e$(s));break;case"hysteria2":u.push(t$(s,i["include-unsupported-proxy"]));break;case"tuic":if(!s.token||s.token.length===0)u.push(r$(s));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":u.push(i$(s));break;case"anytls":u.push(n$(s));break;default:throw new Error(`Platform sing-box does not support proxy type: ${s.type}`)}}catch(o){_.error(o.message??o)}}),n==="internal"?u:JSON.stringify({outbounds:u},null,2)}}}function Eh(){return{type:"ALL",produce:(r,n)=>{let i=r.filter(u=>!(!["http","socks5","ss","trojan","hysteria2","vless","vmess","tuic"].includes(u.type)||u.type==="ss"&&(u.plugin==="obfs"&&!["http","tls"].includes(u["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(u.cipher))||u.type==="vmess"&&!["http","ws","tcp"].includes(u.network)&&u.network||u.type==="trojan"&&!["http","ws","tcp"].includes(u.network)&&u.network||u.type==="vless"&&(typeof u.flow<"u"||u["reality-opts"]||!["http","ws","tcp"].includes(u.network)&&u.network)||u.type==="tuic"&&u.token&&u.token.length!==0)).map(u=>{let s={...u};u.tls&&!u.sni&&(u.sni=u.server);let o=u.prev_hop||u["underlying-proxy"]||u["dialer-proxy"]||u.detour;if(u.type==="http")u={type:"http",name:u.name,server:u.server,port:u.port,username:u.username,password:u.password,tfo:u.tfo||u["fast-open"],next_hop:u.next_hop};else if(u.type==="socks5")u={type:"socks5",name:u.name,server:u.server,port:u.port,username:u.username,password:u.password,tfo:u.tfo||u["fast-open"],udp_relay:u.udp||u.udp_relay||u.udp_relay,next_hop:u.next_hop};else if(u.type==="ss")u={type:"shadowsocks",name:u.name,method:u.cipher==="chacha20-ietf-poly1305"?"chacha20-poly1305":u.cipher,server:u.server,port:u.port,password:u.password,tfo:u.tfo||u["fast-open"],udp_relay:u.udp||u.udp_relay||u.udp_relay,next_hop:u.next_hop},s.plugin==="obfs"&&(u.obfs=s["plugin-opts"].mode,u.obfs_host=s["plugin-opts"].host,u.obfs_uri=s["plugin-opts"].path);else if(u.type==="hysteria2")u={type:"hysteria2",name:u.name,server:u.server,port:u.port,auth:u.password,tfo:u.tfo||u["fast-open"],udp_relay:u.udp||u.udp_relay||u.udp_relay,next_hop:u.next_hop,sni:u.sni,skip_tls_verify:u["skip-cert-verify"],port_hopping:u.ports,port_hopping_interval:u["hop-interval"]},s["obfs-password"]&&s.obfs=="salamander"&&(u.obfs="salamander",u.obfs_password=s["obfs-password"]);else if(u.type==="tuic")u={type:"tuic",name:u.name,server:u.server,port:u.port,uuid:u.uuid,password:u.password,next_hop:u.next_hop,sni:u.sni,alpn:Array.isArray(u.alpn)?u.alpn:[u.alpn||"h3"],skip_tls_verify:u["skip-cert-verify"],port_hopping:u.ports,port_hopping_interval:u["hop-interval"]};else if(u.type==="trojan")u.network==="ws"&&(u.websocket={path:u["ws-opts"]?.path,host:u["ws-opts"]?.headers?.Host}),u={type:"trojan",name:u.name,server:u.server,port:u.port,password:u.password,tfo:u.tfo||u["fast-open"],udp_relay:u.udp||u.udp_relay||u.udp_relay,next_hop:u.next_hop,sni:u.sni,skip_tls_verify:u["skip-cert-verify"],websocket:u.websocket};else if(u.type==="vmess"){let l=u.cipher;l&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(l)&&(l="auto"),u.network==="ws"?u.transport={[u.tls?"wss":"ws"]:{path:u["ws-opts"]?.path,headers:{Host:u["ws-opts"]?.headers?.Host},sni:u.tls?u.sni:void 0,skip_tls_verify:u.tls?u["skip-cert-verify"]:void 0}}:u.network==="http"?u.transport={http1:{method:u["http-opts"]?.method,path:Array.isArray(u["http-opts"]?.path)?u["http-opts"]?.path[0]:u["http-opts"]?.path,headers:{Host:Array.isArray(u["http-opts"]?.headers?.Host)?u["http-opts"]?.headers?.Host[0]:u["http-opts"]?.headers?.Host},skip_tls_verify:u["skip-cert-verify"]}}:u.network==="h2"?u.transport={http2:{method:u["h2-opts"]?.method,path:Array.isArray(u["h2-opts"]?.path)?u["h2-opts"]?.path[0]:u["h2-opts"]?.path,headers:{Host:Array.isArray(u["h2-opts"]?.headers?.Host)?u["h2-opts"]?.headers?.Host[0]:u["h2-opts"]?.headers?.Host},skip_tls_verify:u["skip-cert-verify"]}}:(u.network==="tcp"||!u.network)&&u.tls&&(u.transport={tls:{sni:u.tls?u.sni:void 0,skip_tls_verify:u.tls?u["skip-cert-verify"]:void 0}}),u={type:"vmess",name:u.name,server:u.server,port:u.port,user_id:u.uuid,security:l,tfo:u.tfo||u["fast-open"],legacy:u.legacy,udp_relay:u.udp||u.udp_relay||u.udp_relay,next_hop:u.next_hop,transport:u.transport}}else u.type==="vless"&&(u.network==="ws"?u.transport={[u.tls?"wss":"ws"]:{path:u["ws-opts"]?.path,headers:{Host:u["ws-opts"]?.headers?.Host},sni:u.tls?u.sni:void 0,skip_tls_verify:u.tls?u["skip-cert-verify"]:void 0}}:u.network==="http"?u.transport={http:{method:u["http-opts"]?.method,path:Array.isArray(u["http-opts"]?.path)?u["http-opts"]?.path[0]:u["http-opts"]?.path,headers:{Host:Array.isArray(u["http-opts"]?.headers?.Host)?u["http-opts"]?.headers?.Host[0]:u["http-opts"]?.headers?.Host},skip_tls_verify:u["skip-cert-verify"]}}:(u.network==="tcp"||!u.network)&&(u.transport={[u.tls?"tls":"tcp"]:{sni:u.tls?u.sni:void 0,skip_tls_verify:u.tls?u["skip-cert-verify"]:void 0}}),u={type:"vless",name:u.name,server:u.server,port:u.port,user_id:u.uuid,security:u.cipher,tfo:u.tfo||u["fast-open"],legacy:u.legacy,udp_relay:u.udp||u.udp_relay||u.udp_relay,next_hop:u.next_hop,transport:u.transport});if(["http","socks5","ss","trojan","vless","vmess"].includes(s.type)){if(ae(s,"shadow-tls-password")){if(s["shadow-tls-version"]!=3)throw new Error(`shadow-tls version ${s["shadow-tls-version"]} is not supported`);u.shadow_tls={password:s["shadow-tls-password"],sni:s["shadow-tls-sni"]}}else if(["shadow-tls"].includes(s.plugin)&&s["plugin-opts"]){if(s["plugin-opts"].version!=3)throw new Error(`shadow-tls version ${s["plugin-opts"].version} is not supported`);u.shadow_tls={password:s["plugin-opts"].password,sni:s["plugin-opts"].host}}}if(["ss"].includes(s.type)&&u.shadow_tls&&s["udp-port"]>0&&s["udp-port"]<=65535&&(u.udp_port=s["udp-port"]),delete u.subName,delete u.collectionName,delete u.id,delete u.resolved,delete u["no-resolve"],u.transport){for(let l in u.transport)(Object.keys(u.transport[l]).length===0||Object.values(u.transport[l]).every(f=>f==null))&&delete u.transport[l];Object.keys(u.transport).length===0&&delete u.transport}if(n!=="internal")for(let l in u)(u[l]==null||/^_/i.test(l))&&delete u[l];return{[u.type]:{...u,type:void 0,prev_hop:o}}});return n==="internal"?i:`proxies:
`+i.map(u=>" - "+JSON.stringify(u)+`
`).join("")}}}function fA(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var Ah={qx:ul(),QX:ul(),QuantumultX:ul(),surge:nc(),Surge:nc(),SurgeMac:yd(),Loon:Dd(),Clash:Fd(),meta:Ii(),clashmeta:Ii(),"clash.meta":Ii(),"Clash.Meta":Ii(),ClashMeta:Ii(),mihomo:Ii(),Mihomo:Ii(),uri:ic(),URI:ic(),v2:sl(),v2ray:sl(),V2Ray:sl(),json:fA(),JSON:fA(),stash:gh(),Stash:gh(),shadowrocket:al(),Shadowrocket:al(),ShadowRocket:al(),surfboard:mh(),Surfboard:mh(),singbox:vh(),"sing-box":vh(),egern:Eh(),Egern:Eh()};var vw=Zr(dl()),p7=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 $ = {};
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 (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 (proxy['shadow-tls-password'] && !proxy['shadow-tls-version']) {
proxy['shadow-tls-version'] = 2;
}
}
}
start = (shadowsocks/vmess/trojan/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/direct) {
return proxy;
}
shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/udp_port/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_path/ws_headers/method/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls/sni/tls_fingerprint/tls_verification/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "vmess";
proxy.cipher = proxy.cipher || "none";
// 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();
}
trojan = tag equals "trojan" address (passwordk/ws/ws_path/ws_headers/tls/sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "trojan";
handleWebsocket();
handleShadowTLS();
}
https = tag equals "https" address (username password)? (usernamek passwordk)? (sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "http";
proxy.tls = true;
handleShadowTLS();
}
http = tag equals "http" address (username password)? (usernamek passwordk)? (ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "http";
handleShadowTLS();
}
ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (server_fingerprint/idle_timeout/private_key/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "ssh";
handleShadowTLS();
}
snell = tag equals "snell" address (snell_version/snell_psk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/reuse/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/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/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/sni/fast_open/tfo/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* {
proxy.type = "tuic";
handleShadowTLS();
}
tuic_v5 = tag equals "tuic-v5" address (alpn/passwordk/uuidk/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/sni/fast_open/tfo/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* {
proxy.type = "tuic";
proxy.version = 5;
handleShadowTLS();
}
wireguard = tag equals "wireguard" (section_name/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "wireguard-surge";
handleShadowTLS();
}
hysteria2 = tag equals "hysteria2" address (no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_verification/passwordk/tls_fingerprint/download_bandwidth/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* {
proxy.type = "hysteria2";
handleShadowTLS();
}
socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "socks5";
handleShadowTLS();
}
socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_fingerprint/tls_verification/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* {
proxy.type = "socks5";
proxy.tls = true;
handleShadowTLS();
}
direct = tag equals "direct" (udp_relay/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/block_quic/others)* {
proxy.type = "direct";
}
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_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 sni:("off"/domain) {
if (sni === "off") {
proxy["disable-sni"] = true;
} else {
proxy.sni = sni;
}
}
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(); }
snell_psk = comma "psk" equals match:[^,]+ { proxy.psk = match.join(""); }
snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); }
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; }
method = comma "encrypt-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"/"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 { obfs.type = "ws"; }
ws_headers = comma "ws-headers" equals headers:$[^,]+ {
const pairs = headers.split("|");
const result = {};
pairs.forEach(pair => {
const [key, value] = pair.trim().split(":");
result[key.trim()] = value.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1');
})
obfs["ws-headers"] = result;
}
ws_path = comma "ws-path" equals path:uri { obfs.path = path.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; }
obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; };
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:bool { proxy.tfo = flag; }
reuse = comma "reuse" equals flag:bool { proxy.reuse = flag; }
ecn = comma "ecn" equals flag:bool { proxy.ecn = flag; }
tfo = comma "tfo" equals flag:bool { proxy.tfo = flag; }
ip_version = comma "ip-version" equals match:[^,]+ { proxy["ip-version"] = match.join(""); }
section_name = comma "section-name" equals match:[^,]+ { proxy["section-name"] = match.join(""); }
no_error_alert = comma "no-error-alert" equals match:[^,]+ { proxy["no-error-alert"] = match.join(""); }
underlying_proxy = comma "underlying-proxy" equals match:[^,]+ { proxy["underlying-proxy"] = match.join(""); }
download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); }
test_url = comma "test-url" equals match:[^,]+ { proxy["test-url"] = match.join(""); }
test_udp = comma "test-udp" equals match:[^,]+ { proxy["test-udp"] = match.join(""); }
test_timeout = comma "test-timeout" equals match:$[0-9]+ { proxy["test-timeout"] = parseInt(match.trim()); }
tos = comma "tos" equals match:$[0-9]+ { proxy.tos = parseInt(match.trim()); }
interface = comma "interface" equals match:[^,]+ { proxy.interface = match.join(""); }
allow_other_interface = comma "allow-other-interface" equals flag:bool { proxy["allow-other-interface"] = flag; }
hybrid = comma "hybrid" equals flag:bool { proxy.hybrid = flag; }
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"] = match.join("").replace(/^"(.*)"$/, '$1'); }
server_fingerprint = comma "server-fingerprint" equals match:[^,]+ { proxy["server-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
block_quic = comma "block-quic" equals match:[^,]+ { proxy["block-quic"] = match.join(""); }
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]+ { proxy["shadow-tls-version"] = parseInt(match.trim()); }
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-sni"] = match.join(""); }
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
token = comma "token" equals match:[^,]+ { proxy.token = match.join(""); }
alpn = comma "alpn" equals match:[^,]+ { proxy.alpn = match.join(""); }
uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); }
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
comma = _ "," _
equals = _ "=" _
_ = [ \r\t]*
bool = b:("true"/"false") { return b === "true" }
others = comma [^=,]+ equals [^=,]+
`,Gd;function Ri(){return Gd||(Gd=vw.generate(p7)),Gd}var Ew=Zr(dl()),d7=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 $ = {};
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);
}
}
}
start = (shadowsocksr/shadowsocks/vmess/vless/trojan/https/http/socks5/hysteria2) {
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/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)*{
proxy.type = "ssr";
// handle ssr obfs
proxy.obfs = obfs.type;
}
shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs_hostv)? (obfs_ss/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/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);
}
}
vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/vmess_alterId/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* {
proxy.type = "vmess";
proxy.cipher = proxy.cipher || "none";
proxy.alterId = proxy.alterId || 0;
handleTransport();
}
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/flow/public_key/short_id/block_quic/others)* {
proxy.type = "vless";
handleTransport();
}
trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* {
proxy.type = "trojan";
handleTransport();
}
hysteria2 = tag equals "hysteria2"i address password (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/udp_relay/fast_open/download_bandwidth/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/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/fast_open/udp_relay/ip_mode/block_quic/others)* {
proxy.type = "socks5";
}
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;
}
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 host:domain { obfs.host = host; }
obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; }
uri = $[^,]+
transport = comma "transport" equals type:("tcp"/"ws"/"http") { transport.type = type; }
transport_host = comma "host" equals host:domain { transport.host = host; }
transport_path = comma "path" equals path:uri { transport.path = path; }
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]+ { proxy["shadow-tls-version"] = parseInt(match.trim()); }
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-sni"] = match.join(""); }
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join(""); }
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
tls_name = comma sni:("tls-name") equals host:domain { proxy.sni = host; }
sni = comma sni:("sni") equals host:domain { proxy.sni = host; }
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'); }
flow = comma "flow" equals match:[^,]+ { proxy["flow"] = match.join("").replace(/^"(.*)"$/, '$1'); }
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 match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["short-id"] = match.join("").replace(/^"(.*)"$/, '$1'); }
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(""); }
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"; }
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
comma = _ "," _
equals = _ "=" _
_ = [ \r\t]*
bool = b:("true"/"false") { return b === "true" }
others = comma [^=,]+ equals [^=,]+
`,zd;function qs(){return zd||(zd=Ew.generate(d7)),zd}var Aw=Zr(dl()),g7=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 $ = {};
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;
} 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/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/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/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') {
throw new Error('ss over-tls is not supported');
}
if (obfs.type) {
$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/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/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/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/others)* {
proxy.type = "vless";
proxy.cipher = proxy.cipher || "none";
handleObfs();
}
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/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/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:[^,]+ { proxy.password = password.join("").trim(); }
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"); } }
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 "tls-host" equals sni:domain { proxy.sni = sni; }
tls_verification = comma "tls-verification" equals flag:bool {
proxy["skip-cert-verify"] = !flag;
}
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:("http"/"tls"/"wss"/"ws"/"over-tls") { obfs.type = type; return 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_host = comma "obfs-host" equals host:domain { obfs.host = host; }
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; }
server_check_url = comma "server_check_url" equals param:$[^=,]+ { proxy["test-url"] = param; }
uri = $[^,]+
tag = comma "tag" equals tag:[^=,]+ { proxy.name = tag.join(""); }
others = comma [^=,]+ equals [^=,]+
comma = _ "," _
equals = _ "=" _
_ = [ \r\t]*
bool = b:("true"/"false") { return b === "true" }
`,Yd;function Bu(){return Yd||(Yd=Aw.generate(g7)),Yd}var ww=Zr(dl()),m7=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;
}
function toBool(str) {
if (typeof str === 'undefined' || str === null) return undefined;
return /(TRUE)|1/i.test(str);
}
}}
{
const proxy = {};
const obfs = {};
const $ = {};
const params = {};
}
start = (trojan) {
return proxy
}
trojan = "trojan://" password:password "@" server:server ":" port:port "/"? params? name:name?{
proxy.type = "trojan";
proxy.password = password;
proxy.server = server;
proxy.port = port;
proxy.name = name;
// name may be empty
if (!proxy.name) {
proxy.name = server + ":" + port;
}
};
password = match:$[^@]+ {
return decodeURIComponent(match);
};
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;
} else {
throw new Error("Invalid port: " + port);
}
}
params = "?" head:param tail:("&"@param)* {
for (const [key, value] of Object.entries(params)) {
params[key] = decodeURIComponent(value);
}
proxy["skip-cert-verify"] = toBool(params["allowInsecure"]);
proxy.sni = params["sni"] || params["peer"];
proxy['client-fingerprint'] = params.fp;
proxy.alpn = params.alpn ? decodeURIComponent(params.alpn).split(',') : undefined;
if (toBool(params["ws"])) {
proxy.network = "ws";
$set(proxy, "ws-opts.path", params["wspath"]);
}
if (params["type"]) {
let httpupgrade
proxy.network = params["type"]
if(proxy.network === 'httpupgrade') {
proxy.network = 'ws'
httpupgrade = true
}
if (['grpc'].includes(proxy.network)) {
proxy[proxy.network + '-opts'] = {
'grpc-service-name': params["serviceName"],
'_grpc-type': params["mode"],
'_grpc-authority': params["authority"],
};
} else {
if (params["path"]) {
$set(proxy, proxy.network+"-opts.path", decodeURIComponent(params["path"]));
}
if (params["host"]) {
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
}
if (httpupgrade) {
$set(proxy, proxy.network+"-opts.v2ray-http-upgrade", true);
$set(proxy, proxy.network+"-opts.v2ray-http-upgrade-fast-open", true);
}
}
if (['reality'].includes(params.security)) {
const opts = {};
if (params.pbk) {
opts['public-key'] = params.pbk;
}
if (params.sid) {
opts['short-id'] = params.sid;
}
if (params.spx) {
opts['_spider-x'] = params.spx;
}
if (params.mode) {
proxy._mode = params.mode;
}
if (params.extra) {
proxy._extra = params.extra;
}
if (Object.keys(opts).length > 0) {
$set(proxy, params.security+"-opts", opts);
}
}
}
proxy.udp = toBool(params["udp"]);
proxy.tfo = toBool(params["tfo"]);
}
param = kv/single;
kv = key:$[a-z]i+ "=" value:$[^&#]i* {
params[key] = value;
}
single = key:$[a-z]i+ {
params[key] = true;
};
name = "#" + match:$.* {
return decodeURIComponent(match);
}
`,Wd;function Jd(){return Wd||(Wd=ww.generate(m7)),Wd}var e1=Zr(Qd());function Cw(e){let[t,r]=e.match(/,\s*?port-hopping\s*?=\s*?["']?\s*?((\d+(-\d+)?)([,;]\d+(-\d+)?)*)\s*?["']?\s*?/)||[];return{port_hopping:r?r.replace(/;/g,","):void 0,line:t?e.replace(t,""):e}}function v7(){return{name:"URI PROXY Parser",test:n=>/^(socks5\+tls|socks5|http|https):\/\//.test(n),parse:n=>{let[i,u,s,o,l,f,p,E,d]=n.match(/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(p)p=parseInt(p,10);else{if(s)p=443;else if(u==="http")p=80;else throw _.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);_.info(`port is not present in line: ${n}, set to ${p}`)}return{name:d!=null?decodeURIComponent(d):`${u} ${f}:${p}`,type:u,tls:!!s,server:f,port:p,username:o!=null?decodeURIComponent(o):void 0,password:l!=null?decodeURIComponent(l):void 0}}}}function E7(){return{name:"URI SOCKS Parser",test:n=>/^socks:\/\//.test(n),parse:n=>{let[i,u,s,o,l,f,p]=n.match(/^(socks)?:\/\/(?:(.*)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(l)l=parseInt(l,10);else throw _.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);let E,d;if(s){let w=pt.decode(decodeURIComponent(s)).split(":");E=w[0],d=w[1]}return{name:p!=null?decodeURIComponent(p):`${u} ${o}:${l}`,type:"socks5",server:o,port:l,username:E,password:d}}}}function A7(){return{name:"URI SS Parser",test:n=>/^ss:\/\//.test(n),parse:n=>{let i=n.split("ss://")[1],u=n.split("#")[1],s={type:"ss"};i=i.split("#")[0];let o=i.match(/@([^/?]*)(\/|\?|$)/),l=decodeURIComponent(i.split("@")[0]),f;l?.startsWith("2022-blake3-")?f=l:f=pt.decode(l);let p="";if(o)i.includes("?")&&(p=i.match(/(\?.*)$/)[1]);else{if(i.includes("?")){let y=i.match(/^(.*)(\?.*)$/);i=y[1],p=y[2]}if(i=pt.decode(i),p){if(/(&|\?)v2ray-plugin=/.test(p)){let A=p.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];A&&(s.plugin="v2ray-plugin",s["plugin-opts"]=JSON.parse(pt.decode(A)))}i=`${i}${p}`}f=i.match(/(^.*)@/)?.[1],o=i.match(/@([^/@]*)(\/|$)/)}let E=o[1],d=E.lastIndexOf(":");s.server=E.substring(0,d),s.port=`${E.substring(d+1)}`.match(/\d+/)?.[0];let h=f.match(/(^.*?):(.*$)/);s.cipher=h?.[1],s.password=h?.[2];let w=i.match(/[?&]plugin=([^&]+)/),m=i.match(/[?&]shadow-tls=([^&]+)/);if(w){let y=("plugin="+decodeURIComponent(w[1])).split(";"),A={};for(let C of y){let[S,B]=C.split("=");S&&(A[S]=B||!0)}switch(A.plugin){case"obfs-local":case"simple-obfs":s.plugin="obfs",s["plugin-opts"]={mode:A.obfs,host:ur(A["obfs-host"])};break;case"v2ray-plugin":s.plugin="v2ray-plugin",s["plugin-opts"]={mode:"websocket",host:ur(A["obfs-host"]),path:ur(A.path),tls:Ro(A.tls)};break;case"shadow-tls":{s.plugin="shadow-tls";let C=ur(A.version);s["plugin-opts"]={host:ur(A.host),password:ur(A.password),version:C?parseInt(C,10):void 0};break}default:throw new Error(`Unsupported plugin option: ${A.plugin}`)}}if(m){let y=JSON.parse(pt.decode(m[1])),A=ur(y.version),C=ur(y.address),S=ur(y.port);s.plugin="shadow-tls",s["plugin-opts"]={host:ur(y.host),password:ur(y.password),version:A?parseInt(A,10):void 0},C&&(s.server=C),S&&(s.port=parseInt(S,10))}return/(&|\?)uot=(1|true)/i.test(p)&&(s["udp-over-tcp"]=!0),/(&|\?)tfo=(1|true)/i.test(p)&&(s.tfo=!0),u!=null&&(u=decodeURIComponent(u)),s.name=u??`SS ${s.server}:${s.port}`,s}}}function w7(){return{name:"URI SSR Parser",test:n=>/^ssr:\/\//.test(n),parse:n=>{n=pt.decode(n.split("ssr://")[1]);let i=n.indexOf(":origin");i===-1&&(i=n.indexOf(":auth_"));let u=n.substring(0,i),s=u.substring(0,u.lastIndexOf(":")),o=u.substring(u.lastIndexOf(":")+1),l=n.substring(i+1).split("/?")[0].split(":"),f={type:"ssr",server:s,port:o,protocol:l[0],cipher:l[1],obfs:l[2],password:pt.decode(l[3])},p={};if(n=n.split("/?")[1].split("&"),n.length>1)for(let E of n){let[d,h]=E.split("=");h=h.trim(),h.length>0&&h!=="(null)"&&(p[d]=h)}return f={...f,name:p.remarks?pt.decode(p.remarks):f.server,"protocol-param":ur(pt.decode(p.protoparam||"").replace(/\s/g,"")),"obfs-param":ur(pt.decode(p.obfsparam||"").replace(/\s/g,""))},f}}}function C7(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{n=n.split("vmess://")[1];let i=pt.decode(n.replace(/\?.*?$/,""));if(/=\s*vmess/.test(i)){let u=i.split(",").map(l=>l.trim()),s={};for(let l of u)if(l.indexOf("=")!==-1){let[f,p]=l.split("=");s[f.trim()]=p.trim()}let o={name:u[0].split("=")[0].trim(),type:"vmess",server:u[1],port:u[2],cipher:ur(u[3],"auto"),uuid:u[4].match(/^"(.*)"$/)[1],tls:s.obfs==="wss",udp:Ro(s["udp-relay"]),tfo:Ro(s["fast-open"]),"skip-cert-verify":Po(s["tls-verification"])?!s["tls-verification"]:void 0};if(Po(s.obfs))if(s.obfs==="ws"||s.obfs==="wss"){o.network="ws",o["ws-opts"].path=(ur(s["obfs-path"])||'"/"').match(/^"(.*)"$/)[1];let l=s["obfs-header"];l&&l.indexOf("Host")!==-1&&(l=l.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),_s(l)&&(o["ws-opts"].headers={Host:l})}else throw new Error(`Unsupported obfs: ${s.obfs}`);return o}else{let u={};try{u=JSON.parse(i)}catch{let[E,d,h]=/(^[^?]+?)\/?\?(.*)$/.exec(n);i=pt.decode(d);for(let S of h.split("&")){let[B,I]=S.split("="),M=I;M=decodeURIComponent(I),M.indexOf(",")===-1?u[B]=M:u[B]=M.split(",")}let[w,m,y,A,C]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(i);u.scy=m,u.id=y,u.port=C,u.add=A}let s=u.add,o=parseInt(Ro(u.port),10),l={name:u.ps??u.remarks??u.remark??`VMess ${s}:${o}`,type:"vmess",server:s,port:o,cipher:["auto","aes-128-gcm","chacha20-poly1305","none"].includes(u.scy)?u.scy:"auto",uuid:u.id,alterId:parseInt(Ro(u.aid??u.alterId,0),10),tls:["tls",!0,1,"1"].includes(u.tls),"skip-cert-verify":Po(u.verify_cert)?!u.verify_cert:void 0};!l["skip-cert-verify"]&&Po(u.allowInsecure)&&(l["skip-cert-verify"]=/(TRUE)|1/i.test(u.allowInsecure)),l.tls&&(u.sni&&u.sni!==""?l.sni=u.sni:u.peer&&u.peer!==""&&(l.sni=u.peer));let f=!1;if(u.net==="ws"||u.obfs==="websocket"?l.network="ws":["http"].includes(u.net)||["http"].includes(u.obfs)||["http"].includes(u.type)?l.network="http":["grpc","kcp","quic"].includes(u.net)?l.network=u.net:u.net==="httpupgrade"||l.network==="httpupgrade"?(l.network="ws",f=!0):(u.net==="h2"||l.network==="h2")&&(l.network="h2"),l.network){let p=u.host??u.obfsParam;try{let h=JSON.parse(p)?.Host;h&&(p=h)}catch{}let E=u.path;if(["ws"].includes(l.network)&&(E=E||"/"),l.network==="http"&&(p&&(p=p.split(",").map(d=>d.trim()),p=Array.isArray(p)?p[0]:p),E?E=Array.isArray(E)?E[0]:E:E="/"),E||p||["kcp","quic"].includes(l.network))if(["grpc"].includes(l.network))l[`${l.network}-opts`]={"grpc-service-name":ur(E),"_grpc-type":ur(u.type),"_grpc-authority":ur(u.authority)};else if(["kcp","quic"].includes(l.network))l[`${l.network}-opts`]={[`_${l.network}-type`]:ur(u.type),[`_${l.network}-host`]:ur(ur(p)),[`_${l.network}-path`]:ur(E)};else{let d={path:ur(E),headers:{Host:ur(p)}};f&&(d["v2ray-http-upgrade"]=!0,d["v2ray-http-upgrade-fast-open"]=!0),l[`${l.network}-opts`]=d}else delete l.network}return l["client-fingerprint"]=u.fp,l.alpn=u.alpn?u.alpn.split(","):void 0,l}}}}function y7(){return{name:"URI VLESS Parser",test:n=>/^vless:\/\//.test(n),parse:n=>{n=n.split("vless://")[1];let i,u=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);if(!u){let[y,A,C]=/^(.*?)(\?.*?$)/.exec(n);n=`${pt.decode(A)}${C}`,u=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),i=!0}let[s,o,l,f,p,E="",d]=u;i&&(o=o.replace(/^.*?:/g,"")),f=parseInt(`${f}`,10),o=decodeURIComponent(o),d!=null&&(d=decodeURIComponent(d));let h={type:"vless",name:d,server:l,port:f,uuid:o},w={};for(let y of E.split("&")){let[A,C]=y.split("="),S=C;S=decodeURIComponent(C),w[A]=S}if(h.name=d??w.remarks??w.remark??`VLESS ${l}:${f}`,h.tls=w.security&&w.security!=="none",i&&/TRUE|1/i.test(w.tls)&&(h.tls=!0,w.security=w.security??"reality"),h.sni=w.sni||w.peer,h.flow=w.flow,!h.flow&&i&&w.xtls){let y=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][w.xtls];y&&(h.flow=y)}if(h["client-fingerprint"]=w.fp,h.alpn=w.alpn?w.alpn.split(","):void 0,h["skip-cert-verify"]=/(TRUE)|1/i.test(w.allowInsecure),["reality"].includes(w.security)){let y={};w.pbk&&(y["public-key"]=w.pbk),w.sid&&(y["short-id"]=w.sid),w.spx&&(y["_spider-x"]=w.spx),Object.keys(y).length>0&&(h[`${w.security}-opts`]=y)}let m=!1;if(h.network=w.type,h.network==="tcp"&&w.headerType==="http"?h.network="http":h.network==="httpupgrade"&&(h.network="ws",m=!0),!h.network&&i&&w.obfs&&(h.network=w.obfs,["none"].includes(h.network)&&(h.network="tcp")),["websocket"].includes(h.network)&&(h.network="ws"),h.network&&!["tcp","none"].includes(h.network)){let y={},A=w.host??w.obfsParam;if(A)if(w.obfsParam)try{let C=JSON.parse(A);y.headers=C}catch{y.headers={Host:A}}else y.headers={Host:A};w.serviceName?(y[`${h.network}-service-name`]=w.serviceName,["grpc"].includes(h.network)&&w.authority&&(y["_grpc-authority"]=w.authority)):i&&w.path&&(["ws","http","h2"].includes(h.network)||(y[`${h.network}-service-name`]=w.path,delete w.path)),w.path&&(y.path=w.path),["grpc"].includes(h.network)&&(y["_grpc-type"]=w.mode||"gun"),m&&(y["v2ray-http-upgrade"]=!0,y["v2ray-http-upgrade-fast-open"]=!0),Object.keys(y).length>0&&(h[`${h.network}-opts`]=y),h.network==="kcp"&&(w.seed&&(h.seed=w.seed),h.headerType=w.headerType||"none"),w.mode&&(h._mode=w.mode),w.extra&&(h._extra=w.extra)}return h}}}function F7(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{n=n.split(/anytls:\/\//)[1];let[i,u,s,o,l="",f]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);u=decodeURIComponent(u),o=parseInt(`${o}`,10),isNaN(o)&&(o=443),u=decodeURIComponent(u),f!=null&&(f=decodeURIComponent(f)),f=f??`AnyTLS ${s}:${o}`;let p={type:"anytls",name:f,server:s,port:o,password:u};for(let E of l.split("&")){let[d,h]=E.split("=");d=d.replace(/_/g,"-"),h=decodeURIComponent(h),["alpn"].includes(d)?p[d]=h?h.split(","):void 0:["insecure"].includes(d)?p["skip-cert-verify"]=/(TRUE)|1/i.test(h):["udp"].includes(d)?p[d]=/(TRUE)|1/i.test(h):p[d]=h}return p}}}function D7(){return{name:"URI Hysteria2 Parser",test:n=>/^(hysteria2|hy2):\/\//.test(n),parse:n=>{n=n.split(/(hysteria2|hy2):\/\//)[2];let i,[u,s,o,l,f,p,E,d,h,w,m="",y]=/^(.*?)@(.*?)(:((\d+(-\d+)?)([,;]\d+(-\d+)?)*))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);/^\d+$/.test(f)?(f=parseInt(`${f}`,10),isNaN(f)&&(f=443)):f?(i=f,f=Uc(i)):f=443,s=decodeURIComponent(s),y!=null&&(y=decodeURIComponent(y)),y=y??`Hysteria2 ${o}:${f}`;let A={type:"hysteria2",name:y,server:o,port:f,ports:i,password:s},C={};for(let I of m.split("&")){let[M,q]=I.split("="),b=q;b=decodeURIComponent(q),C[M]=b}A.sni=C.sni,!A.sni&&C.peer&&(A.sni=C.peer),C.obfs&&C.obfs!=="none"&&(A.obfs=C.obfs),C.mport&&(A.ports=C.mport),A["obfs-password"]=C["obfs-password"],A["skip-cert-verify"]=/(TRUE)|1/i.test(C.insecure),A.tfo=/(TRUE)|1/i.test(C.fastopen),A["tls-fingerprint"]=C.pinSHA256;let S=C["hop-interval"]||C.hop_interval;/^\d+$/.test(S)&&(A["hop-interval"]=parseInt(`${S}`,10));let B=C.keepalive;return/^\d+$/.test(B)&&(A.keepalive=parseInt(`${B}`,10)),A}}}function S7(){return{name:"URI Hysteria Parser",test:n=>/^(hysteria|hy):\/\//.test(n),parse:n=>{n=n.split(/(hysteria|hy):\/\//)[2];let[i,u,s,o,l,f="",p]=/^(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);o=parseInt(`${o}`,10),isNaN(o)&&(o=443),p!=null&&(p=decodeURIComponent(p)),p=p??`Hysteria ${u}:${o}`;let E={type:"hysteria",name:p,server:u,port:o},d={};for(let h of f.split("&")){let[w,m]=h.split("=");w=w.replace(/_/,"-"),m=decodeURIComponent(m),["alpn"].includes(w)?E[w]=m?m.split(","):void 0:["insecure"].includes(w)?E["skip-cert-verify"]=/(TRUE)|1/i.test(m):["auth"].includes(w)?E["auth-str"]=m:["mport"].includes(w)?E.ports=m:["obfsParam"].includes(w)?E.obfs=m:["upmbps"].includes(w)?E.up=m:["downmbps"].includes(w)?E.down=m:["obfs"].includes(w)?E._obfs=m||"":["fast-open","peer"].includes(w)?d[w]=m:E[w]=m}return!E.sni&&d.peer&&(E.sni=d.peer),!E["fast-open"]&&d.fastopen&&(E["fast-open"]=!0),E.protocol||(E.protocol="udp"),E}}}function b7(){return{name:"URI TUIC Parser",test:n=>/^tuic:\/\//.test(n),parse:n=>{n=n.split(/tuic:\/\//)[1];let[i,u,s,o,l="",f]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);u=decodeURIComponent(u);let[p,...E]=u.split(":"),d=E.join(":");o=parseInt(`${o}`,10),isNaN(o)&&(o=443),d=decodeURIComponent(d),f!=null&&(f=decodeURIComponent(f)),f=f??`TUIC ${s}:${o}`;let h={type:"tuic",name:f,server:s,port:o,password:d,uuid:p};for(let w of l.split("&")){let[m,y]=w.split("=");m=m.replace(/_/g,"-"),y=decodeURIComponent(y),["alpn"].includes(m)?h[m]=y?y.split(","):void 0:["allow-insecure"].includes(m)?h["skip-cert-verify"]=/(TRUE)|1/i.test(y):["fast-open"].includes(m)?h.tfo=!0:["disable-sni","reduce-rtt"].includes(m)?h[m]=/(TRUE)|1/i.test(y):m==="congestion-control"?(h["congestion-controller"]=y,delete h[m]):h[m]=y}return h}}}function _7(){return{name:"URI WireGuard Parser",test:n=>/^(wireguard|wg):\/\//.test(n),parse:n=>{n=n.split(/(wireguard|wg):\/\//)[2];let[i,u,s,o,l,f,p,E="",d]=/^((.*?)@)?(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);f=parseInt(`${f}`,10),isNaN(f)&&(f=51820),s=decodeURIComponent(s),d!=null&&(d=decodeURIComponent(d)),d=d??`WireGuard ${o}:${f}`;let h={type:"wireguard",name:d,server:o,port:f,"private-key":s,udp:!0};for(let w of E.split("&")){let[m,y]=w.split("=");if(m=m.replace(/_/,"-"),y=decodeURIComponent(y),["reserved"].includes(m)){let A=y.split(",").map(C=>parseInt(C.trim(),10)).filter(C=>Number.isInteger(C));A.length===3&&(h[m]=A)}else if(["address","ip"].includes(m))y.split(",").map(A=>{let C=A.trim().replace(/\/\d+$/,"").replace(/^\[/,"").replace(/\]$/,"");Lr(C)?h.ip=C:Rr(C)&&(h.ipv6=C)});else if(["mtu"].includes(m)){let A=parseInt(y.trim(),10);Number.isInteger(A)&&(h[m]=A)}else/publickey/i.test(m)?h["public-key"]=y:/privatekey/i.test(m)?h["private-key"]=y:["udp"].includes(m)?h[m]=/(TRUE)|1/i.test(y):["flag"].includes(m)||(h[m]=y)}return h}}}function I7(){return{name:"URI Trojan Parser",test:n=>/^trojan:\/\//.test(n),parse:n=>{let i=/^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(n);i?.[2]||(n=n.replace(i[1],`${i[1]}:443`));let[s,o]=n.split(/#(.+)/,2),f=Jd().parse(s);if(_s(o))try{f.name=decodeURIComponent(o)}catch(p){console.log(p)}return f}}}function B7(){return{name:"Clash Parser",test:n=>{let i;try{i=e1.default.parse(n)}catch{i=Rs.parse(n)}return!!i?.type},parse:n=>{let i;try{i=e1.default.parse(n)}catch{i=Rs.parse(n)}if(!["anytls","mieru","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.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}}}function $7(){return{name:"QX SS Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")===-1,parse:n=>Bu().parse(n)}}function P7(){return{name:"QX SSR Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")!==-1,parse:n=>Bu().parse(n)}}function R7(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>Bu().parse(n)}}function T7(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>Bu().parse(n)}}function O7(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>Bu().parse(n)}}function N7(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>Bu().parse(n)}}function x7(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>Bu().parse(n)}}function k7(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>qs().parse(n)}}function L7(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>qs().parse(n)}}function U7(){return{name:"Loon VMess Parser",test:n=>/^.*=\s*vmess/i.test(n.split(",")[0])&&n.indexOf("username")===-1,parse:n=>qs().parse(n)}}function H7(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>qs().parse(n)}}function j7(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>qs().parse(n)}}function M7(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>qs().parse(n)}}function q7(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>qs().parse(n)}}function K7(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>qs().parse(n)}}function V7(){return{name:"Loon WireGuard Parser",test:n=>/^.*=\s*wireguard/i.test(n.split(",")[0]),parse:n=>{let i=n.match(/(^.*?)\s*?=\s*?wireguard\s*?,.+?\s*?=\s*?.+?/i)?.[1];n=n.replace(i,"").replace(/^\s*?=\s*?wireguard\s*/i,"");let u=n.match(/,\s*?peers\s*?=\s*?\[\s*?\{\s*?(.+?)\s*?\}\s*?\]/i)?.[1],s=u.match(/(,|^)\s*?endpoint\s*?=\s*?"?(.+?):(\d+)"?\s*?(,|$)/i),o=s?.[2],l=parseInt(s?.[3],10),f=n.match(/(,|^)\s*?mtu\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];f&&(f=parseInt(f,10));let p=n.match(/(,|^)\s*?keepalive\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];p&&(p=parseInt(p,10));let E=u.match(/(,|^)\s*?reserved\s*?=\s*?"?(\[\s*?.+?\s*?\])"?\s*?(,|$)/i)?.[2];E&&(E=JSON.parse(E));let d,h=n.match(/(,|^)\s*?dns\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],w=n.match(/(,|^)\s*?dnsv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2];(h||w)&&(d=[],h&&d.push(h),w&&d.push(w));let m=u.match(/(,|^)\s*?allowed-ips\s*?=\s*?"(.+?)"\s*?(,|$)/i)?.[2]?.split(",").map(I=>I.trim()),y=u.match(/(,|^)\s*?preshared-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],A=n.match(/(,|^)\s*?interface-ip\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],C=n.match(/(,|^)\s*?interface-ipv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],S=u.match(/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],B={type:"wireguard",name:i,server:o,port:l,ip:A,ipv6:C,"private-key":n.match(/(,|^)\s*?private-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],"public-key":S,mtu:f,keepalive:p,reserved:E,"allowed-ips":m,"preshared-key":y,dns:d,udp:!0,peers:[{server:o,port:l,ip:A,ipv6:C,"public-key":S,"pre-shared-key":y,"allowed-ips":m,reserved:E}]};return Array.isArray(B.dns)&&B.dns.length>0&&(B["remote-dns-resolve"]=!0),B}}}function G7(){return{name:"Surge Direct Parser",test:n=>/^.*=\s*direct/.test(n.split(",")[0]),parse:n=>Ri().parse(n)}}function z7(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>Ri().parse(n)}}function Y7(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>Ri().parse(n)}}function W7(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1,parse:n=>Ri().parse(n)}}function J7(){return{name:"Surge Trojan Parser",test:n=>/^.*=\s*trojan/.test(n.split(",")[0]),parse:n=>Ri().parse(n)}}function X7(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0]),parse:n=>Ri().parse(n)}}function Z7(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0]),parse:n=>Ri().parse(n)}}function Q7(){return{name:"Surge External Parser",test:n=>/^.*=\s*external/.test(n.split(",")[0]),parse:n=>{let i=/^\s*(.*?)\s*?=\s*?external\s*?,\s*(.*?)\s*$/.exec(n),[u,s,o]=i;n=o;let l=/(,|^)\s*?exec\s*?=\s*"(.*?)"\s*?(,|$)/.exec(n)?.[2];l||(l=/(,|^)\s*?exec\s*?=\s*(.*?)\s*?(,|$)/.exec(n)?.[2]);let f=/(,|^)\s*?local-port\s*?=\s*"(.*?)"\s*?(,|$)/.exec(n)?.[2];f||(f=/(,|^)\s*?local-port\s*?=\s*(.*?)\s*?(,|$)/.exec(n)?.[2]);let p=/(,|^)\s*?args\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,E,d=[];for(;(E=p.exec(n))!==null;)E[3]!=null?d.push(E[3]):E[4]!=null&&d.push(E[4]);let h=/(,|^)\s*?addresses\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,w,m=[];for(;(w=h.exec(n))!==null;){let A;w[3]!=null?A=w[3]:w[4]!=null&&(A=w[4]),A!=null&&(A=`${A}`.trim().replace(/^\[/,"").replace(/\]$/,"")),iP(A)&&m.push(A)}return{type:"external",name:s,exec:l,"local-port":f,args:d,addresses:m}}}}function eP(){return{name:"Surge Snell Parser",test:n=>/^.*=\s*snell/.test(n.split(",")[0]),parse:n=>Ri().parse(n)}}function tP(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:u}=Cw(n),s=Ri().parse(u);return s.ports=i,s}}}function rP(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>Ri().parse(n)}}function nP(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:u}=Cw(n),s=Ri().parse(u);return s.ports=i,s}}}function iP(e){return Lr(e)||Rr(e)}var yw=[v7(),E7(),A7(),w7(),C7(),y7(),b7(),_7(),S7(),D7(),I7(),F7(),B7(),G7(),z7(),Y7(),W7(),J7(),X7(),eP(),tP(),rP(),nP(),Z7(),Q7(),k7(),L7(),U7(),H7(),M7(),j7(),q7(),K7(),V7(),$7(),P7(),R7(),T7(),O7(),N7(),x7()];var Wi=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=Qr(),{defaultProxy,defaultTimeout:timeout,githubProxy}=_.read(Mt),proxy=defaultProxy;_.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=rs({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?lu(proxy):{},timeout:timeout||8e3,events:{onResponse:e=>{if(/^[45]/.test(String(e.statusCode))){let t=JSON.parse(e.body);return Promise.reject(`ERROR: ${t.message?.error??t.message}`)}else return 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=rs({baseURL:`${githubProxy?`${githubProxy}/`:""}https://api.github.com`,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?lu(proxy):{},timeout:timeout||8e3,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(`ERROR: ${JSON.parse(e.body).message}`):e}})),this.key=key,this.syncPlatform=syncPlatform}async locate(){return this.syncPlatform==="gitlab"?this.http.get("/snippets").then(e=>{let t=JSON.parse(e.body);for(let r of t)if(r.title===this.key)return r}):this.http.get("/gists?per_page=100&page=1").then(e=>{let t=JSON.parse(e.body);_.info(`\u83B7\u53D6\u5230\u5F53\u524D GitHub \u7528\u6237\u7684 gist: ${t.length} \u4E2A`);for(let r of t)if(r.description===this.key)return r})}async upload(e){if(Object.keys(e).length===0)return Promise.reject("\u672A\u63D0\u4F9B\u9700\u4E0A\u4F20\u7684\u6587\u4EF6");let t=await this.locate(),r=e;if(t?.id){this.syncPlatform==="gitlab"&&(t.files=t.files.reduce((u,s)=>(u[s.path]=s,u),{}));let n=[],i={...t.files};return Object.keys(r).map(u=>{i[u]?r[u].content==null||r[u].content===""?(delete i[u],n.push({action:"delete",file_path:u})):(i[u]=r[u],n.push({action:"update",file_path:u,content:r[u].content})):r[u].content==null||r[u].content===""?(delete i[u],delete r[u]):(i[u]=r[u],n.push({action:"create",file_path:u,content:r[u].content}))}),this.syncPlatform==="gitlab"?Object.keys(i).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(i).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=n,this.http.put({headers:{...this.headers,"Content-Type":"application/json"},url:`/snippets/${t.id}`,body:JSON.stringify({files:r})})):Object.keys(i).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"):this.http.patch({url:`/gists/${t.id}`,body:JSON.stringify({files:r})})}else return r=Object.entries(r).reduce((n,[i,u])=>(u.content!==null&&u.content!==""&&(n[i]=u),n),{}),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(n=>({file_path:n,content:r[n].content})),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"):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:r}=await this.http.get(`/gists/${t.id}`).then(i=>JSON.parse(i.body)),n=r[e].raw_url;return await this.http.get(n).then(i=>i.body)}catch(r){return Promise.reject(r)}else return Promise.reject(`\u627E\u4E0D\u5230 Sub-Store Gist (${this.key})`)}};var bw=Zr(Qd());function sP(e){for(let t of dh)try{if(t.test(e))return _.info(`Pre-processor [${t.name}] activated`),t.parse(e)}catch(r){_.error(`Parser [${t.name}] failed
Reason: ${r}`)}return e}function uP(e){e=sP(e);let t=e.split(`
`),r=[],n;for(let i of t){if(i=i.trim(),i.length===0)continue;let u=!1;if(n){let[s,o]=Fw(n,i);o||(r.push(Sw(s)),u=!0)}if(!u)for(let s of yw){let[o,l]=Fw(s,i);if(!l){r.push(Sw(o)),n=s,u=!0,_.info(`${s.name} is activated`);break}}u||_.error(`Failed to parse line: ${i}`)}return r.filter(i=>(["vless","vmess"].includes(i.type)&&(If(i.uuid)||_.error(`UUID may be invalid: ${i.name} ${i.uuid}`)),!0))}async function aP(proxies,operators=[],targetPlatform,source,$options){for(let item of operators){if(item.disabled){_.log(`Skipping disabled operator: "${item.type}" with arguments:
>>> ${JSON.stringify(item.args,null,2)||"None"}`);continue}let script,$arguments={};if(item.type.indexOf("Script")!==-1){let{mode,content}=item.args;if(mode==="link"){let url=content||"",rawArgs=url.split("#");if(rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}url=`${url.split("#")[0]}${rawArgs[2]?`#${rawArgs[2]}`:$arguments?.noCache!=null||$arguments?.insecure!=null?`#${rawArgs[1]}`:""}`;let downloadUrlMatch=url.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(downloadUrlMatch){let e="";try{e=downloadUrlMatch?.[1];let t=downloadUrlMatch?.[2];if(t==null)throw new Error(`\u672C\u5730 ${e} URL \u65E0\u6548: ${url}`);t=decodeURIComponent(t);let r=e==="module"?Fn:Nt,n=ft(_.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);e==="module"?script=n.content:script=await sn({type:"file",name:t})}catch(t){throw _.error(`Error when loading ${e}: ${item.args.content}.
Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let fs=require("fs");script=fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw _.error(`Error when reading local script: ${item.args.content}.
Reason: ${e}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u811A\u672C\u6587\u4EF6: ${url}`)}else try{script=await zr(url)}catch(e){throw _.error(`Error when downloading remote script: ${item.args.content}.
Reason: ${e}`),new Error(`\u65E0\u6CD5\u4E0B\u8F7D\u811A\u672C: ${url}`)}}else script=content,$arguments=item.args.arguments||{}}if(!ph[item.type]){_.error(`Unknown operator: "${item.type}"`);continue}_.log(`Applying "${item.type}" with arguments:
>>> ${JSON.stringify(item.args,null,2)||"None"}`);let processor;item.type.indexOf("Script")!==-1?processor=ph[item.type](script,targetPlatform,$arguments,source,$options):processor=ph[item.type](item.args||{}),proxies=await nA(processor,proxies)}return proxies}function oP(e,t,r,n={}){let i=Ah[t];if(!i)throw new Error(`Target platform: ${t} is not supported!`);let u=/Surge|SurgeMac|Shadowrocket/i.test(t);if(e=e.filter(s=>s.supported&&s.supported[t]===!1?!1:(["vless","vmess"].includes(s.type)&&(If(s.uuid)||_.error(`UUID may be invalid: ${s.name} ${s.uuid}`)),!0)),e=e.map(s=>(s._resolved=s.resolved,_s(s.name)||(s.name=`${s.type} ${s.server}:${s.port}`),s["disable-sni"]&&(u?s.sni="off":["tuic"].includes(s.type)||(_.error(`Target platform ${t} does not support sni off. Proxy's fields (sni, tls-fingerprint and skip-cert-verify) will be modified.`),s.sni="",s["skip-cert-verify"]=!0,delete s["tls-fingerprint"])),s.ports&&(s.ports=String(s.ports),["ClashMeta"].includes(t)||(s.ports=s.ports.replace(/\//g,",")),s.port||(s.port=Uc(s.ports))),s)),_.log(`Producing proxies for target: ${t}`),typeof i.type>"u"||i.type==="SINGLE"){let s=e.map(o=>{try{return i.produce(o,r,n)}catch(l){return _.error(`Cannot produce proxy: ${JSON.stringify(o,null,2)}
Reason: ${l}`),""}}).filter(o=>o.length>0);return s=r==="internal"?s:s.join(`
`),t.startsWith("Surge")&&e.length>0&&e.every(o=>o.type==="wireguard")&&(s=`#!name=${e[0]?._subName}
#!desc=${e[0]?._desc??""}
#!category=${e[0]?._category??""}
${s}`),s}else if(i.type==="ALL")return i.produce(e,r,n)}var Rt={parse:uP,process:aP,produce:oP,ipAddress:_f,getRandomPort:Uc,isIPv4:Lr,isIPv6:Rr,isIP:t1,yaml:Rs,getFlag:ec,removeFlag:rl,getISO:ah,MMDB:uh,Gist:Wi,download:zr,downloadFile:gl,isValidUUID:If,doh:rc,Buffer:Ih.Buffer,Base64:pt,JSON5:bw.default};function Fw(e,t){if(!cP(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function cP(e,t){try{return e.test(t)}catch{return!1}}function Dw(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function Sw(e){typeof e.cipher=="string"&&(e.cipher=e.cipher.toLowerCase()),typeof e.password=="number"&&(e.password=Jm(e.password)),["ss"].includes(e.type)&&e.cipher==="none"&&!e.password&&(e.password=""),e.interface&&(e["interface-name"]=e.interface,delete e.interface),Wm(e.port)&&(e.port=parseInt(e.port,10)),e.server&&(e.server=`${e.server}`.trim().replace(/^\[/,"").replace(/\]$/,"")),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 t=e[`${e.network}-opts`]?.path;if(Array.isArray(t)?e[`${e.network}-opts`].path=t.map(n=>Dw(n)):t!=null&&(e[`${e.network}-opts`].path=Dw(t)),e.type==="trojan"&&e.network==="tcp"&&delete e.network,["vless"].includes(e.type)&&(e.network||(e.network="tcp")),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(e.type)&&(e.tls=!0),e.network){let n=e[`${e.network}-opts`]?.headers?.Host,i=e[`${e.network}-opts`]?.headers?.host;e.network==="h2"?!i&&n&&(e[`${e.network}-opts`].headers.host=n,delete e[`${e.network}-opts`].headers.Host):i&&!n&&(e[`${e.network}-opts`].headers.Host=i,delete e[`${e.network}-opts`].headers.host)}if(e.network==="h2"){let n=e["h2-opts"]?.headers?.host,i=e["h2-opts"]?.path;n&&!Array.isArray(n)&&(e["h2-opts"].headers.host=[n]),Array.isArray(i)&&(e["h2-opts"].path=i[0])}if(!e.tls&&["ws","http"].includes(e.network)&&!e[`${e.network}-opts`]?.headers?.Host&&!t1(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 n=e[`${e.network}-opts`]?.path,i=e[`${e.network}-opts`]?.headers?.Host;i&&!Array.isArray(i)&&(e[`${e.network}-opts`].headers.Host=[i]),n&&!Array.isArray(n)&&(e[`${e.network}-opts`].path=[n])}if(e.tls&&!e.sni&&(t1(e.server)||(e.sni=e.server),!e.sni&&e.network)){let n=e[`${e.network}-opts`]?.headers?.Host;n=Array.isArray(n)?n[0]:n,n&&(e.sni=n)}if(e.ports?e.ports=String(e.ports).replace(/\//g,","):delete e.ports,["hysteria2"].includes(e.type)&&e.obfs&&!["salamander"].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&&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=Ih.Buffer.from(e.name.data).toString("utf8"):e.name=Ih.Buffer.from(e.name).toString("utf8")}catch(n){_.error(`proxy.name decode failed
Reason: ${n}`),e.name=`${e.type} ${e.server}:${e.port}`}["ws","http","h2"].includes(e.network)&&(["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(n=>!n))&&(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].path=["/"])),["","off"].includes(e.sni)&&(e["disable-sni"]=!0);let r=e.ca_str;e["ca-str"]?r=e["ca-str"]:r&&(delete e.ca_str,e["ca-str"]=r);try{_.env.isNode&&!r&&e._ca&&(r=_.node.fs.readFileSync(e._ca,{encoding:"utf8"}))}catch(n){_.error(`Read ca file failed
Reason: ${n}`)}return!e["tls-fingerprint"]&&r&&(e["tls-fingerprint"]=Mv.generateFingerprint(r)),["ss"].includes(e.type)&&ae(e,"shadow-tls-password")&&(e.plugin="shadow-tls",e["plugin-opts"]={host:e["shadow-tls-sni"],password:e["shadow-tls-password"],version:e["shadow-tls-version"]},delete e["shadow-tls-sni"],delete e["shadow-tls-password"],delete e["shadow-tls-version"]),e}function t1(e){return Lr(e)||Rr(e)}function lP(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function fP(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var _w=[lP(),fP()];function hP(){return{type:"SINGLE",func:r=>["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL","GEOSITE","GEOIP"].indexOf(r.type)!==-1?null:`${{"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[r.type]||r.type},${r.content},SUB-STORE`}}function Iw(){return{type:"SINGLE",func:r=>{if(["GEOSITE","GEOIP"].indexOf(r.type)!==-1)return null;let i=`${r.type},${r.content}`;return["IP-CIDR","IP-CIDR6"].includes(r.type)&&(i+=r.options?.length>0?`,${r.options.join(",")}`:""),i}}}function pP(){return{type:"SINGLE",func:r=>["SRC-IP","GEOSITE","GEOIP"].indexOf(r.type)!==-1?null:(["IP-CIDR","IP-CIDR6"].includes(r.type)&&r.options&&(r.options=r.options.filter(i=>["no-resolve"].includes(i))),Iw().func(r))}}function dP(){return{type:"ALL",func:r=>{let n={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},i={payload:r.map(u=>{let s=`${n[u.type]||u.type},${u.content}`;return["IP-CIDR","IP-CIDR6","GEOIP"].includes(u.type)&&(u.options&&(u.options=u.options.filter(o=>["no-resolve"].includes(o))),s+=u.options?.length>0?`,${u.options.join(",")}`:""),s})};return Rs.dump(i)}}}var Bw={QX:hP(),Surge:Iw(),Loon:pP(),Clash:dP()};var gP=[[/^(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 mP(){return{name:"Universal Rule Parser",test:()=>!0,parse:n=>{let i=n.split(`
`),u=[];for(let s of i)if(s=s.trim(),s.length!==0&&!/\s*#/.test(s))try{let o=s.split(",").map(p=>p.trim()),l=o[0],f=!1;for(let p of gP)if(p[0].test(l)){f=!0;let d={type:p[1],content:o[1]};["IP-CIDR","IP-CIDR6","GEOIP"].includes(d.type)&&(d.options=o.slice(2)),u.push(d)}if(!f)throw new Error("Invalid rule type: "+l)}catch(o){console.log(`Failed to parse line: ${s}
Reason: ${o}`)}return u}}}var $w=[mP()];var Qa=function(){function e(n){for(let i of _w)try{if(i.test(n))return _.info(`Pre-processor [${i.name}] activated`),i.parse(n)}catch(u){_.error(`Parser [${i.name}] failed
Reason: ${u}`)}return n}function t(n){n=e(n);for(let i of $w){let u;try{u=i.test(n)}catch{u=!1}if(u)return _.info(`Rule parser [${i.name}] is activated!`),i.parse(n)}}function r(n,i){let u=Bw[i];if(!u)throw new Error(`Target platform: ${i} is not supported!`);if(typeof u.type>"u"||u.type==="SINGLE")return n.map(s=>{try{return u.func(s)}catch(o){return console.log(`ERROR: cannot produce rule: ${JSON.stringify(s)}
Reason: ${o}`),""}}).filter(s=>s.length>0).join(`
`);if(u.type==="ALL")return u.func(n)}return{parse:t,produce:r}}();function r1(e){_.read(_t)||_.write({},_t),e.get("/api/artifacts/restore",vP),e.route("/api/artifacts").get(EP).post(CP).put(AP),e.route("/api/artifact/:name").get(wP).patch(yP).delete(FP)}async function vP(e,t){_.info("\u5F00\u59CB\u6062\u590D\u8FDC\u7A0B\u914D\u7F6E...");try{let{gistToken:r,syncPlatform:n}=_.read(Mt);if(!r)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let i=new Wi({token:r,key:$a,syncPlatform:n});try{let u=await i.locate();if(!u?.files)throw new Error("\u627E\u4E0D\u5230 Sub-Store Gist \u6587\u4EF6\u5217\u8868");let s=_.read(_t),o=[];Object.keys(u.files).map(l=>{let f=u.files[l]?.filename;if(f)if(encodeURIComponent(f)!==f)_.error(`\u6587\u4EF6\u540D ${f} \u672A\u7F16\u7801 \u4E0D\u4FDD\u5B58`),o.push(f);else{let p=ft(s,f);p?is(s,f,{...p,url:u.files[l]?.raw_url.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1")}):s.push({name:`${f}`,url:u.files[l]?.raw_url.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1")})}}),_.write(s,_t)}catch(u){throw _.error(`\u67E5\u627E Sub-Store Gist \u65F6\u53D1\u751F\u9519\u8BEF: ${u.message??u}`),u}Me(t)}catch(r){_.error(`\u6062\u590D\u8FDC\u7A0B\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),ke(t,new or("FAILED_TO_RESTORE_ARTIFACTS","Failed to restore artifacts",`Reason: ${r.message??r}`))}}function EP(e,t){let r=_.read(_t);Me(t,r)}function AP(e,t){let r=e.body;_.write(r,_t),Me(t)}async function wP(e,t){let{name:r}=e.params,n=_.read(_t),i=ft(n,r);i?Me(t,i):ke(t,new gr("RESOURCE_NOT_FOUND",`Artifact ${r} does not exist!`),404)}function CP(e,t){let r=e.body;if(!Pw(r.name)){ke(t,new kt("INVALID_ARTIFACT_NAME",`Artifact name ${r.name} is invalid.`));return}_.info(`\u6B63\u5728\u521B\u5EFA\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r.name}`);let n=_.read(_t);ft(n,r.name)?ke(t,new kt("DUPLICATE_KEY",`Artifact ${r.name} already exists.`)):(n.push(r),_.write(n,_t),Me(t,r,201))}function yP(e,t){let r=_.read(_t),n=e.params.name,i=ft(r,n);if(i){_.info(`\u6B63\u5728\u66F4\u65B0\u8FDC\u7A0B\u914D\u7F6E\uFF1A${i.name}`);let u={...i,...e.body};if(!Pw(u.name)){ke(t,new kt("INVALID_ARTIFACT_NAME",`Artifact name ${u.name} is invalid.`));return}is(r,n,u),_.write(r,_t),Me(t,u)}else ke(t,new kt("DUPLICATE_KEY",`Artifact ${n} already exists.`))}async function FP(e,t){let{name:r}=e.params;_.info(`\u6B63\u5728\u5220\u9664\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r}`);let n=_.read(_t);try{let i=ft(n,r);if(!i)throw new Error(`\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r}\u4E0D\u5B58\u5728\uFF01`);if(i.updated){let u={};u[encodeURIComponent(i.name)]={content:""},encodeURIComponent(i.name)!==i.name&&(u[i.name]={content:""});try{await Bh(u)}catch(s){_.error(`Function syncToGist: ${r} : ${s}`)}}Mi(n,r),_.write(n,_t),Me(t)}catch(i){_.error(`\u65E0\u6CD5\u5220\u9664\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r}\uFF0C\u539F\u56E0\uFF1A${i}`),ke(t,new or("FAILED_TO_DELETE_ARTIFACT",`Failed to delete artifact ${r}`,`Reason: ${i}`))}}function Pw(e){return/^[a-zA-Z0-9._-]*$/.test(e)}async function Bh(e){let{gistToken:t,syncPlatform:r}=_.read(Mt);if(!t)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let i=await new Wi({token:t,key:$a,syncPlatform:r}).upload(e),u={};try{u=JSON.parse(i.body)}catch{}let s=u?.html_url??u?.web_url,o=_.read(Mt);return s?(_.log(`\u540C\u6B65 Gist \u540E, \u627E\u5230 Sub-Store Gist: ${s}`),o.artifactStore=s,o.artifactStoreStatus="VALID"):(_.error("\u540C\u6B65 Gist \u540E, \u627E\u4E0D\u5230 Sub-Store Gist"),o.artifactStoreStatus="NOT FOUND"),_.write(o,Mt),i}function n1(e){_.read(_t)||_.write({},_t),e.get("/api/sync/artifacts",DP),e.get("/api/sync/artifact/:name",SP)}async function sn({type:e,name:t,platform:r,url:n,ua:i,content:u,mergeSources:s,ignoreFailedRemoteSub:o,ignoreFailedRemoteFile:l,produceType:f,produceOpts:p={},subscription:E,awaitCustomCache:d,$options:h,proxy:w,noCache:m,all:y}){if(r=r||"JSON",["subscription","sub"].includes(e)){let A;if(t){let I=_.read(zt);if(A=ft(I,t),!A)throw new Error(`\u627E\u4E0D\u5230\u8BA2\u9605 ${t}`)}else if(E)A=E;else throw new Error("\u672A\u63D0\u4F9B\u8BA2\u9605\u540D\u79F0\u6216\u8BA2\u9605\u6570\u636E");let C;if(u&&!["localFirst","remoteFirst"].includes(s))C=u;else if(n){let I={};C=await Promise.all(n.split(/[\r\n]+/).map(q=>q.trim()).filter(q=>q.length).map(async q=>{try{return await zr(q,i||A.ua,void 0,w||A.proxy,void 0,d,m||A.noCache,!0)}catch(b){return I[q]=b,_.error(`\u8BA2\u9605 ${A.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${q} \u53D1\u751F\u9519\u8BEF: ${b}`),""}}));let M=A.ignoreFailedRemoteSub;if(o!=null&&o!==""&&(M=o),Object.keys(I).length>0)if(M)M==="enabled"&&_.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${A.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(I).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${A.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(I).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?C.unshift(u):s==="remoteFirst"&&C.push(u)}else if(A.source==="local"&&!["localFirst","remoteFirst"].includes(A.mergeSources))C=A.content;else{let I={};C=await Promise.all(A.url.split(/[\r\n]+/).map(q=>q.trim()).filter(q=>q.length).map(async q=>{try{return await zr(q,i||A.ua,void 0,w||A.proxy,void 0,d,m||A.noCache,!0)}catch(b){return I[q]=b,_.error(`\u8BA2\u9605 ${A.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${q} \u53D1\u751F\u9519\u8BEF: ${b}`),""}}));let M=A.ignoreFailedRemoteSub;if(o!=null&&o!==""&&(M=o),Object.keys(I).length>0)if(M)M==="enabled"&&_.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${A.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(I).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${A.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(I).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);A.mergeSources==="localFirst"?C.unshift(A.content):A.mergeSources==="remoteFirst"&&C.push(A.content)}if(f==="raw")return JSON.stringify((Array.isArray(C)?C:[C]).flat());let S=(Array.isArray(C)?C:[C]).map(I=>Rt.parse(I)).flat();if(S.forEach(I=>{I._subName=A.name,I._subDisplayName=A.displayName}),S=await Rt.process(S,A.process||[],r,{[A.name]:A},h),S.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let B={};for(let I of S){if(B[I.name]){_.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${I.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}B[I.name]=!0}return Rt.produce(S,r,f,p)}else if(["collection","col"].includes(e)){let A=_.read(zt),C=_.read(Yt),S=ft(C,t);if(!S)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let B=[...S.subscriptions],I=S.subscriptionTags;Array.isArray(I)&&I.length>0&&A.forEach(G=>{Array.isArray(G.tag)&&G.tag.length>0&&!B.includes(G.name)&&G.tag.some(Y=>I.includes(Y))&&B.push(G.name)});let M={},q={},b=0;await Promise.all(B.map(async G=>{let Y=ft(A,G),V=Y.passThroughUA,z=Y.ua;V&&(_.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${i}`),z=i);try{_.info(`\u6B63\u5728\u5904\u7406\u5B50\u8BA2\u9605\uFF1A${Y.name}...`);let J;if(Y.source==="local"&&!["localFirst","remoteFirst"].includes(Y.mergeSources))J=Y.content;else{let De={};if(J=await await Promise.all(Y.url.split(/[\r\n]+/).map(ye=>ye.trim()).filter(ye=>ye.length).map(async ye=>{try{return await zr(ye,z,void 0,w||Y.proxy||S.proxy,void 0,void 0,m||Y.noCache,!0)}catch(Pe){return De[ye]=Pe,_.error(`\u8BA2\u9605 ${Y.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${ye} \u53D1\u751F\u9519\u8BEF: ${Pe}`),""}})),Object.keys(De).length>0)if(Y.ignoreFailedRemoteSub)Y.ignoreFailedRemoteSub==="enabled"&&_.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${Y.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(De).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${Y.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(De).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);Y.mergeSources==="localFirst"?J.unshift(Y.content):Y.mergeSources==="remoteFirst"&&J.push(Y.content)}let se=(Array.isArray(J)?J:[J]).map(De=>Rt.parse(De)).flat();se.forEach(De=>{De._subName=Y.name,De._subDisplayName=Y.displayName,De._collectionName=S.name,De._collectionDisplayName=S.displayName}),se=await Rt.process(se,Y.process||[],r,{[Y.name]:Y,_collection:S,$options:h}),M[G]=se,b++,_.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${Y.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(b/B.length).toFixed(1)}% `)}catch(J){b++,q[G]=J,_.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${Y.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${J}\uFF01\u8FDB\u5EA6--${100*(b/B.length).toFixed(1)}%`)}}));let R=S.ignoreFailedRemoteSub;if(o!=null&&o!==""&&(R=o),Object.keys(q).length>0)if(R)R==="enabled"&&_.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${S.name}`,`\u5B50\u8BA2\u9605 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${S.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);let L=Array.prototype.concat.apply([],B.map(G=>M[G]||[]));if(L.forEach(G=>{G._collectionName=S.name,G._collectionDisplayName=S.displayName}),L=await Rt.process(L,S.process||[],r,{_collection:S},h),L.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let j={};for(let G of L){if(j[G.name]){_.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${G.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}j[G.name]=!0}return Rt.produce(L,r,f,p)}else if(e==="rule"){let A=_.read(Oc),C=ft(A,t);if(!C)throw new Error(`\u627E\u4E0D\u5230\u89C4\u5219 ${t}`);let S=[];for(let B=0;B<C.urls.length;B++){let I=C.urls[B];_.info(`\u6B63\u5728\u5904\u7406URL\uFF1A${I}\uFF0C\u8FDB\u5EA6--${100*((B+1)/C.urls.length).toFixed(1)}% `);try{let{body:M}=await zr(I),q=Qa.parse(M);S=S.concat(q)}catch(M){_.error(`\u5904\u7406\u5206\u6D41\u8BA2\u9605\u4E2D\u7684URL: ${I}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${M}! \u8BE5\u8BA2\u9605\u5DF2\u88AB\u8DF3\u8FC7\u3002`)}}return S=await Qa.process(S,[{type:"Remove Duplicate Filter"}]),Qa.produce(S,r)}else if(e==="file"){let A=_.read(Nt),C=ft(A,t);if(!C)throw new Error(`\u627E\u4E0D\u5230\u6587\u4EF6 ${t}`);let S="";if(C.type!=="mihomoProfile")if(u&&!["localFirst","remoteFirst"].includes(s))S=u;else if(n){let q={};S=await Promise.all(n.split(/[\r\n]+/).map(R=>R.trim()).filter(R=>R.length).map(async R=>{try{return await zr(R,i||C.ua,void 0,C.proxy||w,void 0,void 0,m)}catch(L){return q[R]=L,_.error(`\u6587\u4EF6 ${C.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${R} \u53D1\u751F\u9519\u8BEF: ${L}`),""}}));let b=C.ignoreFailedRemoteFile;if(l!=null&&l!==""&&(b=l),!b&&Object.keys(q).length>0)throw new Error(`\u6587\u4EF6 ${C.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?S.unshift(u):s==="remoteFirst"&&S.push(u)}else if(C.source==="local"&&!["localFirst","remoteFirst"].includes(C.mergeSources))S=C.content;else{let q={};S=await Promise.all(C.url.split(/[\r\n]+/).map(R=>R.trim()).filter(R=>R.length).map(async R=>{try{return await zr(R,i||C.ua,void 0,C.proxy||w,void 0,void 0,m)}catch(L){return q[R]=L,_.error(`\u6587\u4EF6 ${C.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${R} \u53D1\u751F\u9519\u8BEF: ${L}`),""}}));let b=C.ignoreFailedRemoteFile;if(l!=null&&l!==""&&(b=l),Object.keys(q).length>0)if(b)b==="enabled"&&_.notify("\u{1F30D} Sub-Store \u5904\u7406\u6587\u4EF6\u5931\u8D25",`\u274C ${C.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${C.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);C.mergeSources==="localFirst"?S.unshift(C.content):C.mergeSources==="remoteFirst"&&S.push(C.content)}if(f==="raw")return JSON.stringify((Array.isArray(S)?S:[S]).flat());let B=(Array.isArray(S)?S:[S]).flat(),I=B.filter(q=>q!=null&&q!=="").join(`
`),M=Array.isArray(C.process)&&C.process.length>0?await Rt.process({$files:B,$content:I,$options:h,$file:C},C.process):{$content:I,$files:B,$options:h};return(y?M:M?.$content)??""}}async function i1(){_.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");let e=_.read(_t),t={};try{let r=[],n=[],i=_.read(zt),u=_.read(Yt),s=[],o=0;if(e.map(p=>{if(p.sync&&p.source){if(o++,p.type==="subscription"){let E=p.source,d=ft(i,E);d&&d.url&&!s.includes(E)&&s.push(E)}else if(p.type==="collection"){let E=ft(u,p.source);E&&Array.isArray(E.subscriptions)&&E.subscriptions.map(d=>{let h=ft(i,d);h&&h.url&&!s.includes(d)&&s.push(d)})}}}),o===0){_.info(`\u9700\u540C\u6B65\u7684\u914D\u7F6E: ${o}, \u603B\u6570: ${e.length}`);return}if(s.length>0&&await Promise.all(s.map(async p=>{try{await sn({type:"subscription",name:p,awaitCustomCache:!0})}catch{}})),await Promise.all(e.map(async p=>{try{if(p.sync&&p.source){_.info(`\u6B63\u5728\u540C\u6B65\u4E91\u914D\u7F6E\uFF1A${p.name}...`);let E=p.platform==="SurgeMac";E&&_.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External");let d=await sn({type:p.type,name:p.source,platform:p.platform,produceOpts:{"include-unsupported-proxy":p.includeUnsupportedProxy,useMihomoExternal:E}});t[encodeURIComponent(p.name)]={content:d},r.push(p.name)}}catch(E){_.error(`\u751F\u6210\u540C\u6B65\u914D\u7F6E ${p.name} \u53D1\u751F\u9519\u8BEF: ${E.message??E}`),n.push(p.name)}})),_.info(`${r.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u6210\u529F: ${r.join(", ")}`),_.info(`${n.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u5931\u8D25: ${n.join(", ")}`),r.length===0)throw new Error(`\u540C\u6B65\u914D\u7F6E ${n.join(", ")} \u751F\u6210\u5931\u8D25 \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`);let l=await Bh(t),f=JSON.parse(l.body);delete f.history,delete f.forks,delete f.owner,Object.values(f.files).forEach(p=>{delete p.content}),_.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),_.info(JSON.stringify(f,null,2));for(let p of e)if(p.sync&&p.source&&r.includes(p.name)){p.updated=new Date().getTime();let E=f.files,d;Array.isArray(E)&&(d=!0,E=Object.fromEntries(E.map(m=>[m.path,m])));let h=E[encodeURIComponent(p.name)]?.raw_url,w=d?h:h?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");_.info(`\u4E0A\u4F20\u914D\u7F6E\u5B8C\u6210
\u6587\u4EF6\u5217\u8868: ${Object.keys(E).join(", ")}
\u5F53\u524D\u6587\u4EF6: ${encodeURIComponent(p.name)}
\u54CD\u5E94\u8FD4\u56DE\u7684\u539F\u59CB\u94FE\u63A5: ${h}
\u5904\u7406\u5B8C\u7684\u65B0\u94FE\u63A5: ${w}`),p.url=w}if(_.write(e,_t),_.info("\u4E0A\u4F20\u914D\u7F6E\u6210\u529F"),n.length>0)throw new Error(`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${r.length} \u4E2A, \u5931\u8D25 ${n.length} \u4E2A, \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`);_.info(`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${r.length} \u4E2A`)}catch(r){throw _.error(`\u540C\u6B65\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),r}}async function DP(e,t){_.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");try{await i1(),Me(t)}catch(r){_.error(`\u540C\u6B65\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),ke(t,new or("FAILED_TO_SYNC_ARTIFACTS","Failed to sync all artifacts",`Reason: ${r.message??r}`))}}async function SP(e,t){let{name:r}=e.params;_.info(`\u5F00\u59CB\u540C\u6B65\u8FDC\u7A0B\u914D\u7F6E ${r}...`);let n=_.read(_t),i=ft(n,r);if(!i){_.error(`\u627E\u4E0D\u5230\u8FDC\u7A0B\u914D\u7F6E ${r}`),ke(t,new gr("RESOURCE_NOT_FOUND",`\u627E\u4E0D\u5230\u8FDC\u7A0B\u914D\u7F6E ${r}`),404);return}if(!i.source){_.error(`\u8FDC\u7A0B\u914D\u7F6E ${r} \u672A\u8BBE\u7F6E\u6765\u6E90`),ke(t,new gr("RESOURCE_HAS_NO_SOURCE",`\u8FDC\u7A0B\u914D\u7F6E ${r} \u672A\u8BBE\u7F6E\u6765\u6E90`),404);return}try{let u=i.platform==="SurgeMac";u&&_.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External");let s=await sn({type:i.type,name:i.source,platform:i.platform,produceOpts:{"include-unsupported-proxy":i.includeUnsupportedProxy,useMihomoExternal:u}});_.info(`\u6B63\u5728\u4E0A\u4F20\u914D\u7F6E\uFF1A${i.name}
>>>${JSON.stringify(i,null,2)}`);let o=await Bh({[encodeURIComponent(i.name)]:{content:s}});i.updated=new Date().getTime();let l=JSON.parse(o.body);delete l.history,delete l.forks,delete l.owner,Object.values(l.files).forEach(h=>{delete h.content}),_.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),_.info(JSON.stringify(l,null,2));let f=l.files,p;Array.isArray(f)&&(p=!0,f=Object.fromEntries(f.map(h=>[h.path,h])));let E=f[encodeURIComponent(i.name)]?.raw_url,d=p?E:E?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");_.info(`\u4E0A\u4F20\u914D\u7F6E\u5B8C\u6210
\u6587\u4EF6\u5217\u8868: ${Object.keys(f).join(", ")}
\u5F53\u524D\u6587\u4EF6: ${encodeURIComponent(i.name)}
\u54CD\u5E94\u8FD4\u56DE\u7684\u539F\u59CB\u94FE\u63A5: ${E}
\u5904\u7406\u5B8C\u7684\u65B0\u94FE\u63A5: ${d}`),i.url=d,_.write(n,_t),Me(t,i)}catch(u){_.error(`\u8FDC\u7A0B\u914D\u7F6E ${i.name} \u53D1\u751F\u9519\u8BEF: ${u.message??u}`),ke(t,new or("FAILED_TO_SYNC_ARTIFACT",`Failed to sync artifact ${r}`,`Reason: ${u}`))}}var Rw=dh.find(e=>e.name==="Clash Pre-processor"),s1=new Map;async function zr(rawUrl="",ua,timeout,customProxy,skipCustomCache,awaitCustomCache,noCache,preprocess){let $arguments={},url=rawUrl.replace(/#noFlow$/,""),rawArgs=url.split("#");if(url=url.split("#")[0],rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}let{isNode,isStash,isLoon,isShadowRocket,isQX}=Qr(),{defaultProxy,defaultUserAgent,defaultTimeout,cacheThreshold:defaultCacheThreshold}=_.read(Mt),cacheThreshold=defaultCacheThreshold||1024,proxy=customProxy||defaultProxy;_.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultUserAgent||"clash.meta",requestTimeout=timeout||defaultTimeout||8e3,id=Fi(userAgent+url);$arguments?.cacheKey===!0&&(_.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=_.read(customCacheKey),t=Ur.get(id);if(!noCache&&!$arguments?.noCache&&t)return _.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url}
\u5B58\u5728\u6709\u6548\u7684\u5E38\u89C4\u7F13\u5B58
\u4F7F\u7528\u5E38\u89C4\u7F13\u5B58\u4EE5\u907F\u514D\u91CD\u590D\u8BF7\u6C42`),t;if(e){if(awaitCustomCache){_.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url}
\u672C\u6B21\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u66F4\u65B0\u7F13\u5B58`);try{await zr(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess)}catch(r){_.error(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`),_.info("\u4F7F\u7528\u4E50\u89C2\u7F13\u5B58\u7684\u6570\u636E\u5237\u65B0\u7F13\u5B58, \u9632\u6B62\u540E\u7EED\u8BF7\u6C42"),Ur.set(id,e)}}else _.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url}
\u672C\u6B21\u8FD4\u56DE\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}
\u5E76\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u5F02\u6B65\u66F4\u65B0\u7F13\u5B58`),zr(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess).catch(r=>{_.error(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u5F02\u6B65\u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`)});return e}}let downloadUrlMatch=url.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(downloadUrlMatch){let e="";try{e=downloadUrlMatch?.[1];let t=downloadUrlMatch?.[2];if(t==null)throw new Error(`\u672C\u5730 ${e} URL \u65E0\u6548: ${url}`);t=decodeURIComponent(t);let r=e==="module"?Fn:Nt,n=ft(_.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return e==="module"?n.content:await sn({type:"file",name:t})}catch(t){throw _.error(`Error when loading ${e}: ${url.split("#")[0]}.
Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let fs=require("fs");return fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw _.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&&s1.has(id))return s1.get(id);let http=rs({headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,cached=Ur.get(id);if(!noCache&&!$arguments?.noCache&&cached)_.info(`\u4F7F\u7528\u7F13\u5B58: ${url}, ${userAgent}`),result=cached,customCacheKey&&(_.info(`URL ${url}
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),_.write(cached,customCacheKey));else{let e=$arguments?.insecure?isNode?{strictSSL:!1}:{insecure:!0}:void 0;_.info(`Downloading...
User-Agent: ${userAgent}
Timeout: ${requestTimeout}
Proxy: ${proxy}
Insecure: ${!!e}
Preprocess: ${preprocess}
URL: ${url}`);try{let{body:t,headers:r,statusCode:n}=await http.get({url,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?lu(proxy):{},...e||{}});if(_.info(`statusCode: ${n}`),n<200||n>=400)throw new Error(`statusCode: ${n}`);if(r){let u=To(r);u&&xa.set(id,u)}if(t.replace(/\s/g,"").length===0)throw new Error(new Error("\u8FDC\u7A0B\u8D44\u6E90\u5185\u5BB9\u4E3A\u7A7A"));if(preprocess)try{Rw.test(t)&&(t=Rw.parse(t,!0))}catch(u){_.error(`Clash Pre-processor error: ${u}`)}let i=!0;if(cacheThreshold){let u=t.length/1024;u>cacheThreshold&&(_.info(`\u8D44\u6E90\u5927\u5C0F ${u.toFixed(2)} KB \u8D85\u8FC7\u4E86 ${cacheThreshold} KB, \u4E0D\u7F13\u5B58`),i=!1)}if(preprocess)try{let u=Rt.parse(t);(!Array.isArray(u)||u.length===0)&&(_.error(`URL ${url} \u4E0D\u5305\u542B\u6709\u6548\u8282\u70B9, \u4E0D\u7F13\u5B58`),i=!1)}catch(u){_.error(`URL ${url} \u5C1D\u8BD5\u89E3\u6790\u8282\u70B9\u5931\u8D25 ${u.message??u}, \u4E0D\u7F13\u5B58`),i=!1}i&&(Ur.set(id,t),customCacheKey&&(_.info(`URL ${url}
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),_.write(t,customCacheKey))),result=t}catch(t){if(customCacheKey){let r=_.read(customCacheKey);if(r)return _.info(`\u65E0\u6CD5\u4E0B\u8F7D URL ${url}: ${t.message??t}
\u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),r}throw new Error(`\u65E0\u6CD5\u4E0B\u8F7D URL ${url}: ${t.message??t}`)}}return $arguments?.validCheck&&await Bf(ka(await Bn(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl))),isNode||s1.set(id,result),result}async function gl(url,file){let undici=require('undici'),fs=require('fs'),{pipeline}=require('stream/promises'),{Agent,interceptors,request}=undici;_.info(`Downloading file...
URL: ${url}
File: ${file}`);let{body,statusCode}=await request(url,{dispatcher:new Agent().compose(interceptors.redirect({maxRedirections:3,throwOnRedirect:!0}))});if(statusCode!==200)throw new Error(`Failed to download file from ${url}`);let fileStream=fs.createWriteStream(file);return await pipeline(body,fileStream),_.info(`File downloaded from ${url} to ${file}`),file}var a1=Zr(xc());function u1(e){_.read(Mt)||_.write({},Mt),e.route("/api/settings").get(bP).patch(_P)}async function bP(e,t){try{let r=_.read(Mt);r||(r={},_.write(r,Mt)),r.avatarUrl||await $h(),r.artifactStore||await Ph(),Me(t,r)}catch(r){_.error(`Failed to get settings: ${r.message??r}`),ke(t,new or("FAILED_TO_GET_SETTINGS","Failed to get settings",`Reason: ${r.message??r}`))}}async function _P(e,t){try{let n={..._.read(Mt),...e.body};_.write(n,Mt),await $h(),await Ph(),Me(t,n)}catch(r){_.error(`Failed to update settings: ${r.message??r}`),ke(t,new or("FAILED_TO_UPDATE_SETTINGS","Failed to update settings",`Reason: ${r.message??r}`))}}async function $h(){let e=_.read(Mt),{githubUser:t,syncPlatform:r,githubProxy:n}=e;if(t)if(r==="gitlab")try{let i=await _.http.get({url:`https://gitlab.com/api/v4/users?username=${encodeURIComponent(t)}`,headers:{"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"}}).then(u=>JSON.parse(u.body));e.avatarUrl=i[0].avatar_url.replace(/(\?|&)s=\d+(&|$)/,"$1s=160$2"),_.write(e,Mt)}catch(i){_.error(`Failed to fetch GitLab avatar for User: ${t}. Reason: ${i.message??i}`)}else try{let i=await _.http.get({url:`${n?`${n}/`:""}https://api.github.com/users/${encodeURIComponent(t)}`,headers:{"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"}}).then(u=>JSON.parse(u.body));e.avatarUrl=i.avatar_url,_.write(e,Mt)}catch(i){_.error(`Failed to fetch GitHub avatar for User: ${t}. Reason: ${i.message??i}`)}}async function Ph(){_.log("Updating artifact store");let e=_.read(Mt),{gistToken:t,syncPlatform:r}=e;if(t){let n=new Wi({token:t,key:$a,syncPlatform:r});try{let i=await n.locate(),u=i?.html_url??i?.web_url;u?(_.log(`\u627E\u5230 Sub-Store Gist: ${u}`),e.artifactStore=u,e.artifactStoreStatus="VALID"):(_.error(`\u627E\u4E0D\u5230 Sub-Store Gist (${$a})`),e.artifactStoreStatus="NOT FOUND")}catch(i){_.error(`\u67E5\u627E Sub-Store Gist (${$a}) \u65F6\u53D1\u751F\u9519\u8BEF: ${i.message??i}`),e.artifactStoreStatus="ERROR"}_.write(e,Mt)}}function o1(e){e.get("/api/utils/env",Tw),e.get("/api/utils/backup",BP),e.get("/api/utils/refresh",IP),e.route("/api/storage").get((t,r)=>{r.set("content-type","application/json").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_data_${Wu(new Date)}.json`)}"`).send(_.env.isNode?JSON.stringify(_.cache):_.read("#sub-store"))}).post((t,r)=>{let{content:n}=t.body;try{if(n=JSON.parse(pt.decode(n)),Object.keys(n.settings).length===0)throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch{try{if(n=JSON.parse(n),Object.keys(n.settings).length===0)throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(u){throw _.error(`\u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F
Reason: ${u.message??u}`),new Error("\u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F")}}_.write(JSON.stringify(n,null," "),"#sub-store"),_.env.isNode&&(_.cache=n,_.persistCache()),zu(),Me(r)}),Qr().isNode?e.get("/",Tw):e.get("/",async(t,r)=>{r.set("location","https://sub-store.vercel.app/").status(302).end()}),Qr().isQX&&e.options("/",async(t,r)=>{r.status(200).end()}),e.all("/",(t,r)=>{r.send("Hello from sub-store, made with \u2764\uFE0F by Peng-YM")})}function Tw(e,t){e.query.share&&(js.feature.share=!0),t.set("Content-Type","application/json;charset=UTF-8").send(JSON.stringify({status:"success",data:{guide:"\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F \u60A8\u5F53\u524D\u770B\u5230\u7684\u662F\u540E\u7AEF\u7684\u54CD\u5E94. \u82E5\u60F3\u914D\u5408\u524D\u7AEF\u4F7F\u7528, \u53EF\u8BBF\u95EE\u5B98\u65B9\u524D\u7AEF https://sub-store.vercel.app \u540E\u81EA\u884C\u914D\u7F6E\u540E\u7AEF\u5730\u5740, \u6216\u4E00\u952E\u914D\u7F6E\u540E\u7AEF https://sub-store.vercel.app?api=https://a.com/xxx (\u5047\u8BBE https://a.com \u662F\u4F60\u540E\u7AEF\u7684\u57DF\u540D, /xxx \u662F\u81EA\u5B9A\u4E49\u8DEF\u5F84). \u9700\u6CE8\u610F HTTPS \u524D\u7AEF\u65E0\u6CD5\u8BF7\u6C42\u975E\u672C\u5730\u7684 HTTP \u540E\u7AEF(\u90E8\u5206\u6D4F\u89C8\u5668\u4E0A\u4E5F\u65E0\u6CD5\u8BBF\u95EE\u672C\u5730 HTTP \u540E\u7AEF). \u8BF7\u914D\u7F6E\u53CD\u4EE3\u6216\u5728\u5C40\u57DF\u7F51\u81EA\u5EFA HTTP \u524D\u7AEF. \u5982\u679C\u8FD8\u6709\u95EE\u9898, \u53EF\u67E5\u770B\u6B64\u6392\u67E5\u8BF4\u660E: https://t.me/zhetengsha/1068",...js}},null,2))}async function IP(e,t){await $h(),await Ph(),Ur.revokeAll(),tl.revokeAll(),xa.revokeAll(),Me(t)}async function Rh(e,t,r){let{gistToken:n,syncPlatform:i}=_.read(Mt);if(!n)throw new Error("GitHub Token is required for backup!");let u=new Wi({token:n,key:Om,syncPlatform:i}),s=_.read("#sub-store");s=s?JSON.parse(s):{},_.env.isNode&&(s=JSON.parse(JSON.stringify(_.cache)));let o,l=_.read(Mt),f=l.syncTime;switch(e){case"upload":try{if(o=_.read("#sub-store"),o=o?JSON.parse(o):{},_.env.isNode&&(o=JSON.parse(JSON.stringify(_.cache))),r==="plaintext"?(o.settings.gistToken="\u6062\u590D\u540E\u8BF7\u91CD\u65B0\u8BBE\u7F6E GitHub Token",o=JSON.stringify(o,null," ")):o=pt.encode(JSON.stringify(o,null," ")),_.info("\u4E0B\u8F7D\u5907\u4EFD, \u4E0E\u672C\u5730\u5185\u5BB9\u5BF9\u6BD4..."),await u.download(gf)===o){_.info("\u5185\u5BB9\u4E00\u81F4, \u65E0\u9700\u4E0A\u4F20\u5907\u4EFD");return}}catch(p){_.error(`${p.message??p}`)}l.syncTime=new Date().getTime(),_.write(l,Mt),o=_.read("#sub-store"),o=o?JSON.parse(o):{},_.env.isNode&&(o=JSON.parse(JSON.stringify(_.cache))),r==="plaintext"?(o.settings.gistToken="\u6062\u590D\u540E\u8BF7\u91CD\u65B0\u8BBE\u7F6E GitHub Token",o=JSON.stringify(o,null," ")):o=pt.encode(JSON.stringify(o,null," ")),_.info("\u4E0A\u4F20\u5907\u4EFD\u4E2D...");try{await u.upload({[gf]:{content:o}}),_.info("\u4E0A\u4F20\u5907\u4EFD\u5B8C\u6210")}catch(p){throw l.syncTime=f,_.write(l,Mt),p}break;case"download":_.info("\u8FD8\u539F\u5907\u4EFD\u4E2D..."),o=await u.download(gf);try{if(o=JSON.parse(pt.decode(o)),Object.keys(o.settings).length===0)throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch{try{if(o=JSON.parse(o),Object.keys(o.settings).length===0)throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(E){throw _.error(`Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F
Reason: ${E.message??E}`),new Error("Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F")}}t&&(_.info(`\u4FDD\u7559\u539F\u6709\u8BBE\u7F6E ${t}`),t.split(",").forEach(p=>{a1.default.set(o,p,a1.default.get(s,p))})),_.write(JSON.stringify(o,null," "),"#sub-store"),_.env.isNode&&(_.cache=o,_.persistCache()),_.info("perform migration after restoring from gist..."),zu(),_.info("migration completed"),_.info("\u8FD8\u539F\u5907\u4EFD\u5B8C\u6210");break}}async function BP(e,t){let{action:r,keep:n,encode:i}=e.query,{gistToken:u}=_.read(Mt);if(!u)ke(t,new kt("GIST_TOKEN_NOT_FOUND","GitHub Token is required for backup!"));else try{await Rh(r,n,i),Me(t)}catch(s){_.error(`Failed to ${r} gist data.
Reason: ${s.message??s}`),ke(t,new or("BACKUP_FAILED",`Failed to ${r} gist data!`,`Reason: ${s.message??s}`))}}_.read(zt)||_.write({},zt);function c1(e){e.get("/api/sub/flow/:name",$P),e.route("/api/sub/:name").get(RP).patch(TP).delete(OP),e.route("/api/subs").get(NP).post(PP).put(xP)}async function $P(e,t){let{name:r}=e.params,{url:n}=e.query;n&&_.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 URL: ${n}`);let i=_.read(zt),u=ft(i,r);if(!u){ke(t,new gr("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404);return}if(u.source==="local"&&!["localFirst","remoteFirst"].includes(u.mergeSources)){if(u.subUserinfo){let s;if(/^https?:\/\//.test(u.subUserinfo))try{s=await Bn(void 0,void 0,void 0,u.proxy,u.subUserinfo)}catch(o){_.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${u.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(o)}`)}else s=u.subUserinfo;try{Me(t,{...ka(s)})}catch(o){_.error(`Failed to parse flow info for local subscription ${r}: ${o.message??o}`),ke(t,new kt("NO_FLOW_INFO","N/A","Failed to parse flow info"))}}else ke(t,new kt("NO_FLOW_INFO","N/A",`Local subscription ${r} has no flow information!`));return}try{n=`${n||u.url}`.split(/[\r\n]+/).map(f=>f.trim()).filter(f=>f.length)?.[0]||"";let s={},o=n.split("#");if(n=n.split("#")[0],o.length>1)try{s=JSON.parse(decodeURIComponent(o[1]))}catch{for(let p of o[1].split("&")){let E=p.split("=")[0],d=p.split("=")[1];s[E]=d==null||d===""?!0:decodeURIComponent(d)}}if(s.noFlow||!/^https?/.test(n)){ke(t,new kt("NO_FLOW_INFO","N/A",`Subscription ${r}: noFlow`));return}let l=await Bn(s?.insecure?`${n}#insecure`:n,s.flowUserAgent,void 0,u.proxy,s.flowUrl);if(!l&&!u.subUserinfo){ke(t,new or("NO_FLOW_INFO","No flow info","Failed to fetch flow headers"));return}try{let f=$f({resetDay:s.resetDay,startDate:s.startDate,cycleDays:s.cycleDays}),p;if(/^https?:\/\//.test(u.subUserinfo))try{p=await Bn(void 0,void 0,void 0,u.proxy,u.subUserinfo)}catch(d){_.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${u.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(d)}`)}else p=u.subUserinfo;let E={...ka([p,l].filter(d=>d).join("; "))};f!=null&&(E.remainingDays=f),Me(t,E)}catch(f){_.error(`Failed to parse flow info for local subscription ${r}: ${f.message??f}`),ke(t,new kt("NO_FLOW_INFO","N/A","Failed to parse flow info"))}}catch{ke(t,new No("URL_NOT_ACCESSIBLE",`The URL for subscription ${r} is inaccessible.`))}}function PP(e,t){let r=e.body;if(delete r.subscriptions,_.info(`\u6B63\u5728\u521B\u5EFA\u8BA2\u9605\uFF1A ${r.name}`),/\//.test(r.name)){ke(t,new kt("INVALID_NAME",`Subscription ${r.name} is invalid`));return}let n=_.read(zt);if(ft(n,r.name)){ke(t,new kt("DUPLICATE_KEY",`Subscription ${r.name} already exists.`));return}n.push(r),_.write(n,zt),Me(t,r,201)}function RP(e,t){let{name:r}=e.params,{raw:n}=e.query,i=_.read(zt),u=ft(i,r);delete u.subscriptions,u?n?t.set("content-type","application/json").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_subscription_${r}_${Wu(new Date)}.json`)}"`).send(JSON.stringify(u)):Me(t,u):ke(t,new gr("SUBSCRIPTION_NOT_FOUND",`Subscription ${r} does not exist`,404))}function TP(e,t){let{name:r}=e.params,n=e.body;delete n.subscriptions;let i=_.read(zt),u=ft(i,r);if(u){let s={...u,...n};if(_.info(`\u6B63\u5728\u66F4\u65B0\u8BA2\u9605\uFF1A ${r}`),r!==n.name){let o=_.read(Yt)||[];for(let p of o){let E=p.subscriptions.indexOf(r);E!==-1&&(p.subscriptions[E]=n.name)}let l=_.read(_t)||[];for(let p of l)p.type==="subscription"&&p.source==r&&(p.source=n.name);let f=_.read(Nt)||[];for(let p of f)p.sourceType==="subscription"&&p.sourceName==r&&(p.sourceName=n.name);_.write(o,Yt),_.write(l,_t),_.write(f,Nt)}is(i,r,s),_.write(i,zt),Me(t,s)}else ke(t,new gr("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404)}function OP(e,t){let{name:r}=e.params;_.info(`\u5220\u9664\u8BA2\u9605\uFF1A${r}...`);let n=_.read(zt);Mi(n,r),_.write(n,zt);let i=_.read(Yt);for(let u of i)u.subscriptions=u.subscriptions.filter(s=>s!==r);_.write(i,Yt),Me(t)}function NP(e,t){let r=_.read(zt);Me(t,r)}function xP(e,t){let r=e.body;_.write(r,zt),Me(t)}function l1(e){_.read(Yt)||_.write({},Yt),e.route("/api/collection/:name").get(LP).patch(UP).delete(HP),e.route("/api/collections").get(jP).post(kP).put(MP)}function kP(e,t){let r=e.body;if(_.info(`\u6B63\u5728\u521B\u5EFA\u7EC4\u5408\u8BA2\u9605\uFF1A${r.name}`),/\//.test(r.name)){ke(t,new kt("INVALID_NAME",`Collection ${r.name} is invalid`));return}let n=_.read(Yt);if(ft(n,r.name)){ke(t,new kt("DUPLICATE_KEY",`Collection ${r.name} already exists.`));return}n.push(r),_.write(n,Yt),Me(t,r,201)}function LP(e,t){let{name:r}=e.params,{raw:n}=e.query,i=_.read(Yt),u=ft(i,r);u?n?t.set("content-type","application/json").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_collection_${r}_${Wu(new Date)}.json`)}"`).send(JSON.stringify(u)):Me(t,u):ke(t,new gr("SUBSCRIPTION_NOT_FOUND",`Collection ${r} does not exist`,404))}function UP(e,t){let{name:r}=e.params,n=e.body,i=_.read(Yt),u=ft(i,r);if(u){let s={...u,...n};if(_.info(`\u6B63\u5728\u66F4\u65B0\u7EC4\u5408\u8BA2\u9605\uFF1A${r}...`),r!==s.name){let o=_.read(_t)||[];for(let f of o)f.type==="collection"&&f.source===u.name&&(f.source=s.name);let l=_.read(Nt)||[];for(let f of l)f.sourceType==="collection"&&f.sourceName===u.name&&(f.sourceName=s.name);_.write(o,_t),_.write(l,Nt)}is(i,r,s),_.write(i,Yt),Me(t,s)}else ke(t,new gr("RESOURCE_NOT_FOUND",`Collection ${r} does not exist!`),404)}function HP(e,t){let{name:r}=e.params;_.info(`\u6B63\u5728\u5220\u9664\u7EC4\u5408\u8BA2\u9605\uFF1A${r}`);let n=_.read(Yt);Mi(n,r),_.write(n,Yt),Me(t)}function jP(e,t){let r=_.read(Yt);Me(t,r)}function MP(e,t){let r=e.body;_.write(r,Yt),Me(t)}function f1(e){_.read(Nt)||_.write([],Nt),e.get("/share/file/:name",Ow),e.route("/api/file/:name").get(Ow).patch(VP).delete(GP),e.route("/api/wholeFile/:name").get(KP),e.route("/api/files").get(zP).post(qP).put(WP),e.route("/api/wholeFiles").get(YP)}function qP(e,t){let r=e.body;r.name=`${r.name??Date.now()}`,_.info(`\u6B63\u5728\u521B\u5EFA\u6587\u4EF6\uFF1A${r.name}`);let n=_.read(Nt);if(ft(n,r.name))return ke(t,new kt("DUPLICATE_KEY",e.body.name?`\u5DF2\u5B58\u5728 name \u4E3A ${r.name} \u7684\u6587\u4EF6`:"\u65E0\u6CD5\u540C\u65F6\u521B\u5EFA\u76F8\u540C\u7684\u6587\u4EF6 \u53EF\u7A0D\u540E\u91CD\u8BD5"));n.push(r),_.write(n,Nt),Me(t,r,201)}async function Ow(e,t){let{name:r}=e.params,n=e.headers["user-agent"]||e.headers["User-Agent"];_.info(`\u6B63\u5728\u4E0B\u8F7D\u6587\u4EF6\uFF1A${r}
\u8BF7\u6C42 User-Agent: ${n}`);let{url:i,subInfoUrl:u,subInfoUserAgent:s,ua:o,content:l,mergeSources:f,ignoreFailedRemoteFile:p,proxy:E,noCache:d,produceType:h}=e.query,w={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body}};if(e.query.$options){try{w=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let C of e.query.$options.split("&")){let S=C.split("=")[0],B=C.split("=")[1];w[S]=B==null||B===""?!0:decodeURIComponent(B)}}_.info(`\u4F20\u5165 $options: ${JSON.stringify(w)}`)}i&&_.info(`\u6307\u5B9A\u8FDC\u7A0B\u6587\u4EF6 URL: ${i}`),E&&_.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${E}`),o&&_.info(`\u6307\u5B9A\u8FDC\u7A0B\u6587\u4EF6 User-Agent: ${o}`),u&&_.info(`\u6307\u5B9A\u83B7\u53D6\u6D41\u91CF\u7684 subInfoUrl: ${u}`),s&&_.info(`\u6307\u5B9A\u83B7\u53D6\u6D41\u91CF\u7684 subInfoUserAgent: ${s}`),l&&_.info(`\u6307\u5B9A\u672C\u5730\u6587\u4EF6: ${l}`),f&&_.info(`\u6307\u5B9A\u5408\u5E76\u6765\u6E90: ${f}`),p!=null&&p!==""&&_.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u6587\u4EF6: ${p}`),d&&_.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${d}`),h&&_.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${h}`);let m=_.read(Nt),y=ft(m,r);if(y)try{let A=await sn({type:"file",name:r,url:i,ua:o,content:l,mergeSources:f,ignoreFailedRemoteFile:p,$options:w,proxy:E,noCache:d,produceType:h,all:!0});try{if(u=u||y.subInfoUrl,u){let C=await Bn(u,s||y.subInfoUserAgent,void 0,E||y.proxy);C&&t.set("subscription-userinfo",Ju(C))}}catch(C){_.error(`\u6587\u4EF6 ${r} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(C)}`)}y.download&&t.set("Content-Disposition",`attachment; filename*=UTF-8''${encodeURIComponent(y.displayName||y.name)}`),t.set("Content-Type","text/plain; charset=utf-8"),A?.$options?._res?.headers&&Object.entries(A.$options._res.headers).forEach(([C,S])=>{t.set(C,S)}),t.send(A?.$content??"")}catch(A){_.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25",`\u274C \u65E0\u6CD5\u4E0B\u8F7D\u6587\u4EF6\uFF1A${r}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${A.message??A}`),_.error(A.message??A),ke(t,new or("INTERNAL_SERVER_ERROR",`Failed to download file: ${r}`,`Reason: ${A.message??A}`))}else _.error(`\u{1F30D} Sub-Store \u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25
\u274C \u672A\u627E\u5230\u6587\u4EF6\uFF1A${r}\uFF01`),ke(t,new gr("RESOURCE_NOT_FOUND",`File ${r} does not exist!`),404)}function KP(e,t){let{name:r}=e.params,{raw:n}=e.query,i=_.read(Nt),u=ft(i,r);u?n?t.set("content-type","application/json").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_file_${r}_${Wu(new Date)}.json`)}"`).send(JSON.stringify(u)):Me(t,u):ke(t,new gr("FILE_NOT_FOUND",`File ${r} does not exist`,404))}function VP(e,t){let{name:r}=e.params,n=e.body,i=_.read(Nt),u=ft(i,r);if(u){let s={...u,...n};if(_.info(`\u6B63\u5728\u66F4\u65B0\u6587\u4EF6\uFF1A${r}...`),r!==s.name){let o=_.read(_t)||[];for(let l of o)l.type==="file"&&l.source===u.name&&(l.source=s.name);_.write(o,_t)}is(i,r,s),_.write(i,Nt),Me(t,s)}else ke(t,new gr("RESOURCE_NOT_FOUND",`File ${r} does not exist!`),404)}function GP(e,t){let{name:r}=e.params;_.info(`\u6B63\u5728\u5220\u9664\u6587\u4EF6\uFF1A${r}`);let n=_.read(Nt);Mi(n,r),_.write(n,Nt),Me(t)}function zP(e,t){let r=_.read(Nt);Me(t,r.map(({content:n,...i})=>i))}function YP(e,t){let r=_.read(Nt);Me(t,r)}function WP(e,t){let r=e.body;_.write(r,Nt),Me(t)}function h1(e){_.read(Mn)||_.write([],Mn),e.post("/api/token",ZP),e.route("/api/token/:token").delete(JP),e.route("/api/tokens").get(XP)}function JP(e,t){let{token:r}=e.params;_.info(`\u6B63\u5728\u5220\u9664\uFF1A${r}`);let n=_.read(Mn);Mi(n,r,"token"),_.write(n,Mn),Me(t)}function XP(e,t){let{type:r,name:n}=e.query,i=_.read(Mn)||[];Me(t,r||n?i.filter(u=>(r?u.type===r:!0)&&(n?u.name===n:!0)):i)}async function ZP(req,res){if(!Qr().isNode)return ke(res,new kt("INVALID_ENV","This endpoint is only available in Node.js environment"));try{let{payload,options}=req.body,ms=require("ms"),type=payload?.type,name=payload?.name;if(!type||!name)return ke(res,new kt("INVALID_PAYLOAD","payload type and name are required"));let token=payload?.token;if(token!=null){if(typeof token!="string"||token.length<1)return ke(res,new kt("INVALID_CUSTOM_TOKEN",`Invalid custom token: ${token}`));if((_.read(Mn)||[]).find(t=>t.token===token&&t.type===type&&t.name===name))return ke(res,new kt("DUPLICATE_TOKEN",`Token ${token} already exists`))}if(type==="col"){if(!(_.read(Yt)||[]).find(r=>r.name===name))return ke(res,new kt("INVALID_COLLECTION",`collection ${name} not found`))}else if(type==="file"){if(!(_.read(Nt)||[]).find(r=>r.name===name))return ke(res,new kt("INVALID_FILE",`file ${name} not found`))}else if(type==="sub"){if(!(_.read(zt)||[]).find(r=>r.name===name))return ke(res,new kt("INVALID_SUB",`sub ${name} not found`))}else return ke(res,new kt("INVALID_TYPE",`type ${name} not supported`));let expiresIn=options?.expiresIn;if(options?.expiresIn!=null&&(expiresIn=ms(options.expiresIn),expiresIn==null||isNaN(expiresIn)||expiresIn<=0))return ke(res,new kt("INVALID_EXPIRES_IN",`Invalid expiresIn option: ${options.expiresIn}`));let nanoid=require("nanoid"),tokens=_.read(Mn)||[];if(!token)do token=nanoid.customAlphabet(nanoid.urlAlphabet)();while(tokens.find(e=>e.token===token&&e.type===type&&e.name===name));return tokens.push({...payload,token,createdAt:Date.now(),expiresIn:expiresIn>0?options?.expiresIn:void 0,exp:expiresIn>0?Date.now()+expiresIn:void 0}),_.write(tokens,Mn),Me(res,{token})}catch(e){return ke(res,new or("TOKEN_SIGN_FAILED","Failed to sign token",`Reason: ${e.message??e}`))}}function p1(e){_.read(Fn)||_.write([],Fn),e.route("/api/module/:name").get(eR).patch(tR).delete(rR),e.route("/api/modules").get(nR).post(QP).put(iR)}function QP(e,t){let r=e.body;r.name=`${r.name??Fi(JSON.stringify(r))}`,_.info(`\u6B63\u5728\u521B\u5EFA\u6A21\u5757\uFF1A${r.name}`);let n=_.read(Fn);if(ft(n,r.name))return ke(t,new kt("DUPLICATE_KEY",e.body.name?`\u5DF2\u5B58\u5728 name \u4E3A ${r.name} \u7684\u6A21\u5757`:"\u5DF2\u5B58\u5728\u76F8\u540C\u7684\u6A21\u5757 \u8BF7\u52FF\u91CD\u590D\u6DFB\u52A0"));n.push(r),_.write(n,Fn),Me(t,r,201)}function eR(e,t){let{name:r}=e.params,n=_.read(Fn),i=ft(n,r);i?t.set("Content-Type","text/plain; charset=utf-8").send(i.content):ke(t,new gr("MODULE_NOT_FOUND",`Module ${r} does not exist`,404))}function tR(e,t){let{name:r}=e.params,n=e.body,i=_.read(Fn),u=ft(i,r);if(u){let s={...u,...n};_.info(`\u6B63\u5728\u66F4\u65B0\u6A21\u5757\uFF1A${r}...`),is(i,r,s),_.write(i,Fn),Me(t,s)}else ke(t,new gr("RESOURCE_NOT_FOUND",`Module ${r} does not exist!`),404)}function rR(e,t){let{name:r}=e.params;_.info(`\u6B63\u5728\u5220\u9664\u6A21\u5757\uFF1A${r}`);let n=_.read(Fn);Mi(n,r),_.write(n,Fn),Me(t)}function nR(e,t){let r=_.read(Fn);Me(t,r.map(({content:n,...i})=>i))}function iR(e,t){let r=e.body;_.write(r,Fn),Me(t)}var vU=Zr(Zw()),AU=Zr(nC());function PR(e){let t=Object.keys(e),r="",n="",i="";for(let u of t){let s=u.toLowerCase();s==="user-agent"?(r=e[u],n=r.toLowerCase()):s==="accept"&&(i=e[u])}return{UA:r,ua:n,accept:i}}function RR({ua:e,UA:t,accept:r}){return t.indexOf("Quantumult%20X")!==-1?"QX":e.indexOf("egern")!==-1?"Egern":t.indexOf("Surfboard")!==-1?"Surfboard":t.indexOf("Surge Mac")!==-1?"SurgeMac":t.indexOf("Surge")!==-1?"Surge":t.indexOf("Decar")!==-1||t.indexOf("Loon")!==-1?"Loon":t.indexOf("Shadowrocket")!==-1?"Shadowrocket":t.indexOf("Stash")!==-1?"Stash":e==="meta"||e.indexOf("clash")!==-1&&e.indexOf("meta")!==-1||e.indexOf("clash-verge")!==-1||e.indexOf("flclash")!==-1?"ClashMeta":e.indexOf("clash")!==-1?"Clash":e.indexOf("v2ray")!==-1?"V2Ray":e.indexOf("sing-box")!==-1||e.indexOf("singbox")!==-1?"sing-box":r.indexOf("application/json")===0?"JSON":"V2Ray"}function w1(e){let{UA:t,ua:r,accept:n}=PR(e);return RR({ua:r,UA:t,accept:n})}function C1(e,t){return!1}function y1(e){e.get("/share/col/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,_.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await cc(t,r)}),e.get("/share/col/:name",cc),e.get("/share/sub/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,_.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await oc(t,r)}),e.get("/share/sub/:name",oc),e.get("/download/collection/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,_.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await cc(t,r)}),e.get("/download/collection/:name",cc),e.get("/download/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,_.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await oc(t,r)}),e.get("/download/:name",oc),e.get("/download/collection/:name/api/v1/server/details",async(t,r)=>{t.query.platform="JSON",t.query.produceType="internal",t.query.resultFormat="nezha",await cc(t,r)}),e.get("/download/:name/api/v1/server/details",async(t,r)=>{t.query.platform="JSON",t.query.produceType="internal",t.query.resultFormat="nezha",await oc(t,r)}),e.get("/download/collection/:name/api/v1/monitor/:nezhaIndex",async(t,r)=>{t.query.platform="JSON",t.query.produceType="internal",t.query.resultFormat="nezha-monitor",await cc(t,r)}),e.get("/download/:name/api/v1/monitor/:nezhaIndex",async(t,r)=>{t.query.platform="JSON",t.query.produceType="internal",t.query.resultFormat="nezha-monitor",await oc(t,r)})}async function oc(e,t){let{name:r,nezhaIndex:n}=e.params,i=e.query.target==="SurgeMac",u=e.query.target||w1(e.headers)||"JSON",s=e.headers["user-agent"]||e.headers["User-Agent"];_.info(`\u6B63\u5728\u4E0B\u8F7D\u8BA2\u9605\uFF1A${r}
\u8BF7\u6C42 User-Agent: ${s}
\u8BF7\u6C42 target: ${e.query.target}
\u5B9E\u9645\u8F93\u51FA: ${u}`);let{url:o,ua:l,content:f,mergeSources:p,ignoreFailedRemoteSub:E,produceType:d,includeUnsupportedProxy:h,resultFormat:w,proxy:m,noCache:y}=e.query,A={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body}};if(e.query.$options){try{A=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let I of e.query.$options.split("&")){let M=I.split("=")[0],q=I.split("=")[1];A[M]=q==null||q===""?!0:decodeURIComponent(q)}}_.info(`\u4F20\u5165 $options: ${JSON.stringify(A)}`)}o&&(_.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 URL: ${o}`),/^https?:\/\//.test(o)||(f=o,_.info("URL \u4E0D\u662F\u94FE\u63A5\uFF0C\u89C6\u4E3A\u672C\u5730\u8BA2\u9605"))),f&&_.info(`\u6307\u5B9A\u672C\u5730\u8BA2\u9605: ${f}`),m&&_.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${m}`),l&&_.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 User-Agent: ${l}`),p&&_.info(`\u6307\u5B9A\u5408\u5E76\u6765\u6E90: ${p}`),E!=null&&E!==""&&_.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u8BA2\u9605: ${E}`),d&&_.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${d}`),h&&_.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${h}`),!h&&C1(u,s)&&(h=!0,_.info(`\u5F53\u524D\u5BA2\u6237\u7AEF\u53EF\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${h}`)),i&&_.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External"),y&&_.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${y}`);let C=_.read(zt),S=ft(C,r);if(S)try{S.passThroughUA&&(_.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${s}`),l=s);let I=await sn({type:"subscription",name:r,platform:u,url:o,ua:l,content:f,mergeSources:p,ignoreFailedRemoteSub:E,produceType:d,produceOpts:{"include-unsupported-proxy":h,useMihomoExternal:i},$options:A,proxy:m,noCache:y}),M;if(S.source!=="local"||["localFirst","remoteFirst"].includes(S.mergeSources))try{o=`${o||S.url}`.split(/[\r\n]+/).map(R=>R.trim()).filter(R=>R.length)?.[0]||"";let q={},b=o.split("#");if(o=o.split("#")[0],b.length>1)try{q=JSON.parse(decodeURIComponent(b[1]))}catch{for(let L of b[1].split("&")){let j=L.split("=")[0],G=L.split("=")[1];q[j]=G==null||G===""?!0:decodeURIComponent(G)}}!q.noFlow&&/^https?/.test(o)&&(M=await Bn(q?.insecure?`${o}#insecure`:o,q.flowUserAgent,void 0,m||S.proxy,q.flowUrl),M&&t.set("subscription-userinfo",Ju(M)))}catch(q){_.error(`\u8BA2\u9605 ${r} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(q)}`)}if(S.subUserinfo){let q;if(/^https?:\/\//.test(S.subUserinfo))try{q=await Bn(void 0,void 0,void 0,m||S.proxy,S.subUserinfo)}catch(b){_.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${S.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(b)}`)}else q=S.subUserinfo;t.set("subscription-userinfo",Ju([q,M].filter(b=>b).join(";")))}u==="JSON"?(w==="nezha"?I=sC(I):w==="nezha-monitor"&&(n=/^\d+$/.test(n)?parseInt(n,10):I.findIndex(q=>q.name===n),I=await iC(I[n],n,e.query)),t.set("Content-Type","application/json;charset=utf-8").send(I)):t.send(I)}catch(B){_.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u8BA2\u9605\u5931\u8D25",`\u274C \u65E0\u6CD5\u4E0B\u8F7D\u8BA2\u9605\uFF1A${r}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${B.message??B}`),_.error(B.message??B),ke(t,new or("INTERNAL_SERVER_ERROR",`Failed to download subscription: ${r}`,`Reason: ${B.message??B}`))}else _.error(`\u{1F30D} Sub-Store \u4E0B\u8F7D\u8BA2\u9605\u5931\u8D25
\u274C \u672A\u627E\u5230\u8BA2\u9605\uFF1A${r}\uFF01`),ke(t,new gr("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404)}async function cc(e,t){let{name:r,nezhaIndex:n}=e.params,i=e.query.target==="SurgeMac",u=e.query.target||w1(e.headers)||"JSON",s=_.read(Yt),o=ft(s,r),l=e.headers["user-agent"]||e.headers["User-Agent"];_.info(`\u6B63\u5728\u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\uFF1A${r}
\u8BF7\u6C42 User-Agent: ${l}
\u8BF7\u6C42 target: ${e.query.target}
\u5B9E\u9645\u8F93\u51FA: ${u}`);let{ignoreFailedRemoteSub:f,produceType:p,includeUnsupportedProxy:E,resultFormat:d,proxy:h,noCache:w}=e.query,m={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body}};if(e.query.$options){try{m=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let A of e.query.$options.split("&")){let C=A.split("=")[0],S=A.split("=")[1];m[C]=S==null||S===""?!0:decodeURIComponent(S)}}_.info(`\u4F20\u5165 $options: ${JSON.stringify(m)}`)}if(h&&_.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${h}`),f!=null&&f!==""&&_.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u8BA2\u9605: ${f}`),p&&_.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${p}`),E&&_.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${E}`),!E&&C1(u,l)&&(E=!0,_.info(`\u5F53\u524D\u5BA2\u6237\u7AEF\u53EF\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${E}`)),i&&_.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External"),w&&_.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${w}`),o)try{let y=await sn({type:"collection",name:r,platform:u,ignoreFailedRemoteSub:f,produceType:p,produceOpts:{"include-unsupported-proxy":E,useMihomoExternal:i},$options:m,proxy:h,noCache:w,ua:l}),A,C=_.read(zt),S=o.subscriptions;if(S.length>0){let M=ft(C,S[0]);if(M.source!=="local"||["localFirst","remoteFirst"].includes(M.mergeSources))try{let q=`${M.url}`.split(/[\r\n]+/).map(L=>L.trim()).filter(L=>L.length)?.[0]||"",b={},R=q.split("#");if(q=q.split("#")[0],R.length>1)try{b=JSON.parse(decodeURIComponent(R[1]))}catch{for(let j of R[1].split("&")){let G=j.split("=")[0],Y=j.split("=")[1];b[G]=Y==null||Y===""?!0:decodeURIComponent(Y)}}!b.noFlow&&/^https?:/.test(q)&&(A=await Bn(b?.insecure?`${q}#insecure`:q,b.flowUserAgent,void 0,h||M.proxy||o.proxy,b.flowUrl))}catch(q){_.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4E2D\u7684\u5B50\u8BA2\u9605 ${M.name} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${q.message??q}`)}if(M.subUserinfo){let q;if(/^https?:\/\//.test(M.subUserinfo))try{q=await Bn(void 0,void 0,void 0,h||M.proxy,M.subUserinfo)}catch(b){_.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${M.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(b)}`)}else q=M.subUserinfo;A=[q,A].filter(b=>b).join("; ")}}_.info(`\u7EC4\u5408\u8BA2\u9605 ${r} \u900F\u4F20\u7684\u7684\u6D41\u91CF\u4FE1\u606F: ${A}`);let B;if(/^https?:\/\//.test(o.subUserinfo))try{B=await Bn(void 0,void 0,void 0,h||o.proxy,o.subUserinfo)}catch(M){_.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${o.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(M)}`)}else B=o.subUserinfo;let I=[B,A].filter(M=>M).join("; ");I&&t.set("subscription-userinfo",Ju(I)),u==="JSON"?(d==="nezha"?y=sC(y):d==="nezha-monitor"&&(n=/^\d+$/.test(n)?parseInt(n,10):y.findIndex(M=>M.name===n),y=await iC(y[n],n,e.query)),t.set("Content-Type","application/json;charset=utf-8").send(y)):t.send(y)}catch(y){_.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u9519\u8BEF\uFF1A${r}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${y}`),ke(t,new or("INTERNAL_SERVER_ERROR",`Failed to download collection: ${r}`,`Reason: ${y.message??y}`))}else _.error("\u{1F30D} Sub-Store \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C \u672A\u627E\u5230\u7EC4\u5408\u8BA2\u9605\uFF1A${r}\uFF01`),ke(t,new gr("RESOURCE_NOT_FOUND",`Collection ${r} does not exist!`),404)}async function iC(e,t,r){let n={code:0,message:"success",result:[]};try{let{isLoon:i,isSurge:u}=_.env;if(!i&&!u)throw new Error("\u4EC5\u652F\u6301 Loon \u548C Surge(ability=http-client-policy)");let s=Rt.produce([e],i?"Loon":"Surge");if(!s)throw new Error("\u5F53\u524D\u5BA2\u6237\u7AEF\u4E0D\u517C\u5BB9\u6B64\u8282\u70B9");let o=e._monitors||[{name:"Cloudflare",url:"http://cp.cloudflare.com/generate_204",method:"HEAD",number:3,timeout:2e3},{name:"Google",url:"http://www.google.com/generate_204",method:"HEAD",number:3,timeout:2e3}],l=r.number||Math.max(...o.map(f=>f.number))||3;for(let f of o){let E={monitor_id:o.indexOf(f),server_id:t,monitor_name:f.name,server_name:e.name,created_at:[],avg_delay:[]};for(let d=0;d<l;d++){let h=Date.now();try{await _.http[(f.method||"HEAD").toLowerCase()]({timeout:f.timeout||2e3,url:f.url,"policy-descriptor":s,node:s});let w=Date.now()-h;_.info(`${f.name} latency: ${w}`),E.avg_delay.push(w)}catch(w){_.error(w),E.avg_delay.push(0)}E.created_at.push(Date.now()-6e5*(f.number-d-1))}n.result.push(E)}}catch(i){_.error(i),n.result.push({monitor_id:0,server_id:0,monitor_name:`\u274C ${i.message??i}`,server_name:e.name,created_at:[Date.now()],avg_delay:[0]})}return JSON.stringify(n,null,2)}function sC(e){let t={code:0,message:"success",result:[]};return e.map((r,n)=>{let i=r._geo?.countryCode||r._geo?.country;if(/^[a-z]{2}$/i.test(i)||(i=ah(r.name)),/^[a-z]{2}$/i.test(i)){let u=Math.round(new Date().getTime()/1e3),s=r._unavailable?0:u,o=parseInt(r._uptime||0,10);t.result.push({id:n,name:r.name,tag:`${r._tag??""}`,last_active:s,valid_ip:r._IP||r.server,ipv4:r._IPv4||r.server,ipv6:r._IPv6||(Rr(r.server)?r.server:""),host:{Platform:"Sub-Store",PlatformVersion:js.version,CPU:[],MemTotal:1024,DiskTotal:1024,SwapTotal:1024,Arch:"",Virtualization:"",BootTime:u-o,CountryCode:i,Version:"0.0.1"},status:{CPU:0,MemUsed:0,SwapUsed:0,DiskUsed:0,NetInTransfer:0,NetOutTransfer:0,NetInSpeed:0,NetOutSpeed:0,Uptime:o,Load1:0,Load5:0,Load15:0,TcpConnCount:0,UdpConnCount:0,ProcessCount:0}})}}),JSON.stringify(t,null,2)}function F1(e){e.post("/api/preview/sub",OR),e.post("/api/preview/collection",NR),e.post("/api/preview/file",TR)}async function TR(e,t){try{let r=e.body,n="";if(r.type!=="mihomoProfile")if(r.source==="local"&&!["localFirst","remoteFirst"].includes(r.mergeSources))n=r.content;else{let o={};if(n=await Promise.all(r.url.split(/[\r\n]+/).map(l=>l.trim()).filter(l=>l.length).map(async l=>{try{return await zr(l,r.ua,void 0,r.proxy)}catch(f){return o[l]=f,_.error(`\u6587\u4EF6 ${r.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${l} \u53D1\u751F\u9519\u8BEF: ${f}`),""}})),Object.keys(o).length>0)if(r.ignoreFailedRemoteFile)r.ignoreFailedRemoteFile==="enabled"&&_.notify("\u{1F30D} Sub-Store \u9884\u89C8\u6587\u4EF6\u5931\u8D25",`\u274C ${r.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(o).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${r.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(o).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);r.mergeSources==="localFirst"?n.unshift(r.content):r.mergeSources==="remoteFirst"&&n.push(r.content)}let i=(Array.isArray(n)?n:[n]).flat(),u=i.filter(o=>o!=null&&o!=="").join(`
`),s=Array.isArray(r.process)&&r.process.length>0?await Rt.process({$files:i,$content:u,$file:r},r.process):{$content:u,$files:i};Me(t,{original:u,processed:s?.$content??""})}catch(r){_.error(r.message??r),ke(t,new or("INTERNAL_SERVER_ERROR","Failed to preview file",`Reason: ${r.message??r}`))}}async function OR(e,t){try{let r=e.body,n=e.query.target||"JSON",i;if(r.source==="local"&&!["localFirst","remoteFirst"].includes(r.mergeSources))i=r.content;else{let o={};if(i=await Promise.all(r.url.split(/[\r\n]+/).map(l=>l.trim()).filter(l=>l.length).map(async l=>{try{return await zr(l,r.ua,void 0,r.proxy,void 0,void 0,void 0,!0)}catch(f){return o[l]=f,_.error(`\u8BA2\u9605 ${r.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${l} \u53D1\u751F\u9519\u8BEF: ${f}`),""}})),Object.keys(o).length>0)if(r.ignoreFailedRemoteSub)r.ignoreFailedRemoteSub==="enabled"&&_.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${r.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(o).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${r.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(o).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);r.mergeSources==="localFirst"?i.unshift(r.content):r.mergeSources==="remoteFirst"&&i.push(r.content)}let u=(Array.isArray(i)?i:[i]).map(o=>Rt.parse(o)).flat();u.forEach((o,l)=>{o.id=l,o._subName=r.name,o._subDisplayName=r.displayName});let s=await Rt.process(u,r.process||[],n,{[r.name]:r});Me(t,{original:u,processed:s})}catch(r){_.error(r.message??r),ke(t,new or("INTERNAL_SERVER_ERROR","Failed to preview subscription",`Reason: ${r.message??r}`))}}async function NR(e,t){try{let r=_.read(zt),n=e.body,i=[...n.subscriptions],u=n.subscriptionTags;Array.isArray(u)&&u.length>0&&r.forEach(p=>{Array.isArray(p.tag)&&p.tag.length>0&&!i.includes(p.name)&&p.tag.some(E=>u.includes(E))&&i.push(p.name)});let s={},o={};if(await Promise.all(i.map(async p=>{let E=ft(r,p);try{let d;if(E.source==="local"&&!["localFirst","remoteFirst"].includes(E.mergeSources))d=E.content;else{let w={};if(d=await Promise.all(E.url.split(/[\r\n]+/).map(m=>m.trim()).filter(m=>m.length).map(async m=>{try{return await zr(m,E.ua,void 0,E.proxy,void 0,void 0,void 0,!0)}catch(y){return w[m]=y,_.error(`\u8BA2\u9605 ${E.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${m} \u53D1\u751F\u9519\u8BEF: ${y}`),""}})),Object.keys(w).length>0)if(E.ignoreFailedRemoteSub)E.ignoreFailedRemoteSub==="enabled"&&_.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${E.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(w).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${E.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(w).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);E.mergeSources==="localFirst"?d.unshift(E.content):E.mergeSources==="remoteFirst"&&d.push(E.content)}let h=(Array.isArray(d)?d:[d]).map(w=>Rt.parse(w)).flat();h.forEach(w=>{w._subName=E.name,w._subDisplayName=E.displayName,w._collectionName=n.name,w._collectionDisplayName=n.displayName}),h=await Rt.process(h,E.process||[],"JSON",{[E.name]:E,_collection:n}),s[p]=h}catch(d){o[p]=d,_.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605 ${n.name} \u4E2D\u7684\u5B50\u8BA2\u9605: ${E.name} \u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${d}\uFF01`)}})),Object.keys(o).length>0)if(n.ignoreFailedRemoteSub)n.ignoreFailedRemoteSub==="enabled"&&_.notify("\u{1F30D} Sub-Store \u9884\u89C8\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${n.name}`,`\u5B50\u8BA2\u9605 ${Object.keys(o).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${n.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(o).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);let l=Array.prototype.concat.apply([],i.map(p=>s[p]||[]));l.forEach((p,E)=>{p.id=E,p._collectionName=n.name,p._collectionDisplayName=n.displayName});let f=await Rt.process(l,n.process||[],"JSON",{_collection:n});Me(t,{original:l,processed:f})}catch(r){_.error(r.message??r),ke(t,new or("INTERNAL_SERVER_ERROR","Failed to preview collection",`Reason: ${r.message??r}`))}}function D1(e){e.post("/api/sort/subs",xR),e.post("/api/sort/collections",kR),e.post("/api/sort/artifacts",LR),e.post("/api/sort/files",UR)}function xR(e,t){let r=e.body,n=_.read(zt);n.sort((i,u)=>r.indexOf(i.name)-r.indexOf(u.name)),_.write(n,zt),Me(t,n)}function kR(e,t){let r=e.body,n=_.read(Yt);n.sort((i,u)=>r.indexOf(i.name)-r.indexOf(u.name)),_.write(n,Yt),Me(t,n)}function LR(e,t){let r=e.body,n=_.read(_t);n.sort((i,u)=>r.indexOf(i.name)-r.indexOf(u.name)),_.write(n,_t),Me(t,n)}function UR(e,t){let r=e.body,n=_.read(Nt);n.sort((i,u)=>r.indexOf(i.name)-r.indexOf(u.name)),_.write(n,Nt),Me(t,n)}function S1(e){e.post("/api/utils/node-info",HR)}async function HR(e,t){let r=e.body,n=e.query.lang||"zh-CN",i;try{i=Ah.URI.produce(r)}catch{}try{let s=await rs().get({url:`http://ip-api.com/json/${encodeURIComponent(`${r.server}`.trim().replace(/^\[/,"").replace(/\]$/,""))}?lang=${n}`,headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15"}}).then(o=>{let l=JSON.parse(o.body);if(l.status!=="success")throw new Error(l.message);return delete l.status,l});Me(t,{shareUrl:i,info:s})}catch(u){ke(t,new No("FAILED_TO_GET_NODE_INFO","Failed to get node info",`Reason: ${u}`))}}function b1(e){e.route("/api/proxy/parse").post(jR),e.route("/api/rule/parse").post(MR)}function jR(e,t){let{data:r,client:n,content:i,platform:u}=e.body;var s={};try{var o=Rt.parse(r??i),l=Rt.produce(o,n??u);s.par_res=l}catch(f){ke(t,f);return}Me(t,s)}function MR(e,t){let{data:r,client:n,content:i,platform:u}=e.body;var s={};try{let l=Qa.parse(r??i);var o=Qa.produce(l,n??u);s.par_res=o}catch(l){ke(t,l);return}Me(t,s)}function _1(){let port,host;_.env.isNode&&(port=eval("process.env.SUB_STORE_BACKEND_API_PORT")||3e3,host=eval("process.env.SUB_STORE_BACKEND_API_HOST")||"::");let $app=up({substore:_,port,host});if(_.env.isNode){let be_merge=eval("process.env.SUB_STORE_BACKEND_MERGE"),be_prefix=eval("process.env.SUB_STORE_BACKEND_PREFIX"),fe_be_path=eval("process.env.SUB_STORE_FRONTEND_BACKEND_PATH"),fe_path=eval("process.env.SUB_STORE_FRONTEND_PATH");if(be_prefix||be_merge){if(!fe_be_path.startsWith("/"))throw new Error("SUB_STORE_FRONTEND_BACKEND_PATH should start with /");be_merge&&(_.info("[BACKEND] MERGE mode is [ON]."),_.info(`[BACKEND && FRONTEND] ${host}:${port}`)),_.info(`[BACKEND PREFIX] ${host}:${port}${fe_be_path}`),$app.use((req,res,next)=>{if(req.path.startsWith(fe_be_path)){req.url=req.url.replace(fe_be_path,"")||"/",be_merge&&req.url.startsWith("/api/")&&(req.query.share="true"),next();return}let pathname=decodeURIComponent(req._parsedUrl.pathname)||"/";if(be_merge&&req.path.startsWith("/share/")&&req.query.token){if(req.method.toLowerCase()!=="get"){res.status(405).send("Method not allowed");return}if((_.read(Mn)||[]).find(r=>r.token===req.query.token&&`/share/${r.type}/${r.name}`===pathname&&(r.exp==null||r.exp>Date.now()))){next();return}}if(be_merge&&fe_path&&req.path.indexOf("/",1)==-1){req.path.indexOf(".")==-1&&(req.url="/index.html");let express_=require("express"),mime_=require("mime-types"),path_=require("path"),staticFileMiddleware=express_.static(fe_path,{setHeaders:(e,t)=>{let r=mime_.contentType(path_.extname(t));r&&e.set("Content-Type",r)}});staticFileMiddleware(req,res,next);return}res.status(404).end()})}}if(l1($app),c1($app),y1($app),F1($app),D1($app),u1($app),r1($app),f1($app),h1($app),p1($app),n1($app),S1($app),o1($app),b1($app),$app.start(),_.env.isNode){let backend_sync_cron=eval("process.env.SUB_STORE_BACKEND_SYNC_CRON");if(backend_sync_cron){_.info(`[SYNC CRON] ${backend_sync_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_sync_cron,async function(){try{_.info(`[SYNC CRON] ${backend_sync_cron} started`),await i1(),_.info(`[SYNC CRON] ${backend_sync_cron} finished`)}catch(e){_.error(`[SYNC CRON] ${backend_sync_cron} error: ${e.message??e}`)}},null,!0)}else eval("process.env.SUB_STORE_BACKEND_CRON")&&_.error("[SYNC CRON] SUB_STORE_BACKEND_CRON \u5DF2\u5F03\u7528, \u8BF7\u4F7F\u7528 SUB_STORE_BACKEND_SYNC_CRON"),eval("process.env.SUB_STORE_CRON")&&_.error("[SYNC CRON] SUB_STORE_CRON \u5DF2\u5F03\u7528, \u8BF7\u4F7F\u7528 SUB_STORE_BACKEND_SYNC_CRON");let produce_cron=eval("process.env.SUB_STORE_PRODUCE_CRON");if(produce_cron){_.info(`[PRODUCE CRON] ${produce_cron} enabled`);let{CronJob}=require("cron");produce_cron.split(/\s*;\s*/).map(e=>{let[t,r,n]=e.split(/\s*,\s*/);new CronJob(t.trim(),async function(){try{_.info(`[PRODUCE CRON] ${r} ${n} ${t} started`),await sn({type:r,name:n}),_.info(`[PRODUCE CRON] ${r} ${n} ${t} finished`)}catch(i){_.error(`[PRODUCE CRON] ${r} ${n} ${t} error: ${i.message??i}`)}},null,!0)})}let backend_download_cron=eval("process.env.SUB_STORE_BACKEND_DOWNLOAD_CRON");if(backend_download_cron){_.info(`[DOWNLOAD CRON] ${backend_download_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_download_cron,async function(){try{_.info(`[DOWNLOAD CRON] ${backend_download_cron} started`),await Rh("download"),_.info(`[DOWNLOAD CRON] ${backend_download_cron} finished`)}catch(e){_.error(`[DOWNLOAD CRON] ${backend_download_cron} error: ${e.message??e}`)}},null,!0)}let backend_upload_cron=eval("process.env.SUB_STORE_BACKEND_UPLOAD_CRON");if(backend_upload_cron){_.info(`[UPLOAD CRON] ${backend_upload_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_upload_cron,async function(){try{_.info(`[UPLOAD CRON] ${backend_upload_cron} started`),await Rh("upload"),_.info(`[UPLOAD CRON] ${backend_upload_cron} finished`)}catch(e){_.error(`[UPLOAD CRON] ${backend_upload_cron} error: ${e.message??e}`)}},null,!0)}let mmdb_cron=eval("process.env.SUB_STORE_MMDB_CRON"),countryFile=eval("process.env.SUB_STORE_MMDB_COUNTRY_PATH"),countryUrl=eval("process.env.SUB_STORE_MMDB_COUNTRY_URL"),asnFile=eval("process.env.SUB_STORE_MMDB_ASN_PATH"),asnUrl=eval("process.env.SUB_STORE_MMDB_ASN_URL");if(mmdb_cron&&(countryFile&&countryUrl||asnFile&&asnUrl)){_.info(`[MMDB CRON] ${mmdb_cron} enabled`);let{CronJob}=require("cron");new CronJob(mmdb_cron,async function(){try{if(_.info(`[MMDB CRON] ${mmdb_cron} started`),countryFile&&countryUrl)try{_.info(`[MMDB CRON] downloading ${countryUrl} to ${countryFile}`),await gl(countryUrl,countryFile)}catch(e){_.error(`[MMDB CRON] ${countryUrl} download failed: ${e.message??e}`)}if(asnFile&&asnUrl)try{_.info(`[MMDB CRON] downloading ${asnUrl} to ${asnFile}`),await gl(asnUrl,asnFile)}catch(e){_.error(`[MMDB CRON] ${asnUrl} download failed: ${e.message??e}`)}_.info(`[MMDB CRON] ${mmdb_cron} finished`)}catch(e){_.error(`[MMDB CRON] ${mmdb_cron} error: ${e.message??e}`)}},null,!0)}let path=require("path"),fs=require("fs"),data_url=eval("process.env.SUB_STORE_DATA_URL"),data_url_post=eval("process.env.SUB_STORE_DATA_URL_POST"),fe_be_path=eval("process.env.SUB_STORE_FRONTEND_BACKEND_PATH"),fe_port=eval("process.env.SUB_STORE_FRONTEND_PORT")||3001,fe_host=eval("process.env.SUB_STORE_FRONTEND_HOST")||host||"::",fe_path=eval("process.env.SUB_STORE_FRONTEND_PATH"),fe_abs_path=path.resolve(fe_path||path.join(__dirname,"frontend")),be_merge=eval("process.env.SUB_STORE_BACKEND_MERGE");if(fe_path&&!be_merge){try{fs.accessSync(path.join(fe_abs_path,"index.html"))}catch(e){_.error(`[FRONTEND] index.html file not found in ${fe_abs_path}`)}let express_=require("express"),history=require("connect-history-api-fallback"),{createProxyMiddleware}=require("http-proxy-middleware"),app=express_(),staticFileMiddleware=express_.static(fe_path),be_api="/api/",be_download="/download/",be_share="/share/",be_download_rewrite="",be_api_rewrite="",be_share_rewrite=`${be_share}:type/:name`,prefix=eval("process.env.SUB_STORE_BACKEND_PREFIX")?fe_be_path:"";if(fe_be_path){if(!fe_be_path.startsWith("/"))throw new Error("SUB_STORE_FRONTEND_BACKEND_PATH should start with /");be_api_rewrite=`${fe_be_path==="/"?"":fe_be_path}${be_api}`,be_download_rewrite=`${fe_be_path==="/"?"":fe_be_path}${be_download}`,app.use(be_share_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}`,changeOrigin:!0,pathRewrite:async(e,t)=>{if(t.method.toLowerCase()!=="get")throw new Error("Method not allowed");if(!(_.read(Mn)||[]).find(i=>i.token===t.query.token&&i.type===t.params.type&&i.name===t.params.name&&(i.exp==null||i.exp>Date.now())))throw new Error("Forbbiden");return t.originalUrl}})),app.use(be_api_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}${be_api}`,pathRewrite:async e=>e.includes("?")?`${e}&share=true`:`${e}?share=true`})),app.use(be_download_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}${be_download}`,changeOrigin:!0}))}app.use(staticFileMiddleware),app.use(history({disableDotRule:!0,verbose:!1})),app.use(staticFileMiddleware);let listener=app.listen(fe_port,fe_host,()=>{let{address:e,port:t}=listener.address();_.info(`[FRONTEND] ${e}:${t}`),fe_be_path&&(_.info(`[FRONTEND -> BACKEND] ${e}:${t}${be_api_rewrite} -> ${host}:${port}${prefix}${be_api}`),_.info(`[FRONTEND -> BACKEND] ${e}:${t}${be_download_rewrite} -> ${host}:${port}${prefix}${be_download}`),_.info(`[SHARE BACKEND] ${e}:${t}${be_share_rewrite}`))})}data_url&&(_.info(`[BACKEND] downloading data from ${data_url}`),zr(data_url).then(async content=>{try{if(content=JSON.parse(pt.decode(content)),Object.keys(content.settings).length===0)throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(e){try{if(content=JSON.parse(content),Object.keys(content.settings).length===0)throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(t){throw _.error(`Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F
Reason: ${t.message??t}`),new Error("Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F")}}data_url_post&&(_.info("[BACKEND] executing post-processing script"),eval(data_url_post)),_.write(JSON.stringify(content,null," "),"#sub-store"),_.cache=content,_.persistCache(),zu(),_.info(`[BACKEND] restored data from ${data_url}`)}).catch(e=>{throw _.error("[BACKEND] restore data failed"),console.error(e),e}))}}console.log(`
\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505
Sub-Store -- v${lf}
\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
`);zu();_1();})();
/*! Bundled license information:
lodash/lodash.js:
(**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
jsrsasign/lib/jsrsasign.js:
(*! CryptoJS v3.1.2 core-fix.js
* code.google.com/p/crypto-js
* (c) 2009-2013 by Jeff Mott. All rights reserved.
* code.google.com/p/crypto-js/wiki/License
* THIS IS FIX of 'core.js' to fix Hmac issue.
* https://code.google.com/p/crypto-js/issues/detail?id=84
* https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js
*)
(*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
*)
(*! (c) Tom Wu, Kenji Urushima | http://www-cs-students.stanford.edu/~tjw/jsbn/
*)
(*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
*)
(*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
*)
*/