(()=>{var D9=Object.create;var Gw=Object.defineProperty;var F9=Object.getOwnPropertyDescriptor;var S9=Object.getOwnPropertyNames;var I9=Object.getPrototypeOf,B9=Object.prototype.hasOwnProperty;var Fo=(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 ce=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $9=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of S9(t))!B9.call(e,i)&&i!==r&&Gw(e,i,{get:()=>t[i],enumerable:!(n=F9(t,i))||n.enumerable});return e};var Zr=(e,t,r)=>(r=e!=null?D9(I9(e)):{},$9(t||!e||!e.__esModule?Gw(r,"default",{value:e,enumerable:!0}):r,e));var Xw=ce(Ww=>{"use strict";(function(e){function t(){}function r(){}var n=String.fromCharCode,i={}.toString,a=i.call(e.SharedArrayBuffer),s=i(),u=e.Uint8Array,c=u||Array,f=u?ArrayBuffer:c,d=f.isView||function(E){return E&&"length"in E},g=i.call(f.prototype);f=r.prototype;var p=e.TextEncoder,h=new(u?Uint16Array:c)(32);t.prototype.decode=function(E){if(!d(E)){var v=i.call(E);if(v!==g&&v!==a&&v!==s)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");E=u?new c(E):E||[]}for(var b=v="",m=0,y=E.length|0,D=y-32|0,_,F,L=0,k=0,S,B=0,O=-1;m>4){case 15:if(S=E[m=m+1|0]&255,S>>6!==2||247>6===2?k+4|0:24,F=F+256&768;case 13:case 12:S=E[m=m+1|0]&255,L<<=6,L|=(F&31)<<6|S&63,k=k+7|0,m>6===2&&L>>k&&1114112>L?(F=L,L=L-65536|0,0<=L&&(O=(L>>10)+55296|0,F=(L&1023)+56320|0,31>B?(h[B]=O,B=B+1|0,O=-1):(S=O,O=F,F=S))):(F>>=8,m=m-F-1|0,F=65533),L=k=0,_=m<=D?32:y-m|0;default:h[B]=F;continue;case 11:case 10:case 9:case 8:}h[B]=65533}if(b+=n(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15],h[16],h[17],h[18],h[19],h[20],h[21],h[22],h[23],h[24],h[25],h[26],h[27],h[28],h[29],h[30],h[31]),32>B&&(b=b.slice(0,B-32|0)),m>>31,O=-1,b.length=_)b[y]=_;else{if(2047>=_)b[y]=192|_>>6;else{e:{if(55296<=_)if(56319>=_){var F=E.charCodeAt(m=m+1|0)|0;if(56320<=F&&57343>=F){if(_=(_<<10)+F-56613888|0,65535<_){b[y]=240|_>>18,b[y=y+1|0]=128|_>>12&63,b[y=y+1|0]=128|_>>6&63,b[y=y+1|0]=128|_&63;continue}break e}_=65533}else 57343>=_&&(_=65533);!D&&m<<1>12,b[y=y+1|0]=128|_>>6&63}b[y=y+1|0]=128|_&63}}return u?b.subarray(0,y):b.slice(0,y)},p||(e.TextDecoder=t,e.TextEncoder=r)})(typeof global>"u"?typeof self>"u"?Ww:self:global)});var ag=ce((ZK,EA)=>{var J9=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};EA.exports=J9});var ug=ce((QK,wA)=>{var Z9="2.0.0",Q9=Number.MAX_SAFE_INTEGER||9007199254740991,e7=16,t7=250,r7=["major","premajor","minor","preminor","patch","prepatch","prerelease"];wA.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:e7,MAX_SAFE_BUILD_LENGTH:t7,MAX_SAFE_INTEGER:Q9,RELEASE_TYPES:r7,SEMVER_SPEC_VERSION:Z9,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var lg=ce((Ka,AA)=>{var{MAX_SAFE_COMPONENT_LENGTH:og,MAX_SAFE_BUILD_LENGTH:n7,MAX_LENGTH:i7}=ug(),s7=ag();Ka=AA.exports={};var a7=Ka.re=[],u7=Ka.safeRe=[],ke=Ka.src=[],Ne=Ka.t={},o7=0,cg="[a-zA-Z0-9-]",c7=[["\\s",1],["\\d",i7],[cg,n7]],l7=e=>{for(let[t,r]of c7)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},ot=(e,t,r)=>{let n=l7(t),i=o7++;s7(e,i,t),Ne[e]=i,ke[i]=t,a7[i]=new RegExp(t,r?"g":void 0),u7[i]=new RegExp(n,r?"g":void 0)};ot("NUMERICIDENTIFIER","0|[1-9]\\d*");ot("NUMERICIDENTIFIERLOOSE","\\d+");ot("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${cg}*`);ot("MAINVERSION",`(${ke[Ne.NUMERICIDENTIFIER]})\\.(${ke[Ne.NUMERICIDENTIFIER]})\\.(${ke[Ne.NUMERICIDENTIFIER]})`);ot("MAINVERSIONLOOSE",`(${ke[Ne.NUMERICIDENTIFIERLOOSE]})\\.(${ke[Ne.NUMERICIDENTIFIERLOOSE]})\\.(${ke[Ne.NUMERICIDENTIFIERLOOSE]})`);ot("PRERELEASEIDENTIFIER",`(?:${ke[Ne.NUMERICIDENTIFIER]}|${ke[Ne.NONNUMERICIDENTIFIER]})`);ot("PRERELEASEIDENTIFIERLOOSE",`(?:${ke[Ne.NUMERICIDENTIFIERLOOSE]}|${ke[Ne.NONNUMERICIDENTIFIER]})`);ot("PRERELEASE",`(?:-(${ke[Ne.PRERELEASEIDENTIFIER]}(?:\\.${ke[Ne.PRERELEASEIDENTIFIER]})*))`);ot("PRERELEASELOOSE",`(?:-?(${ke[Ne.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${ke[Ne.PRERELEASEIDENTIFIERLOOSE]})*))`);ot("BUILDIDENTIFIER",`${cg}+`);ot("BUILD",`(?:\\+(${ke[Ne.BUILDIDENTIFIER]}(?:\\.${ke[Ne.BUILDIDENTIFIER]})*))`);ot("FULLPLAIN",`v?${ke[Ne.MAINVERSION]}${ke[Ne.PRERELEASE]}?${ke[Ne.BUILD]}?`);ot("FULL",`^${ke[Ne.FULLPLAIN]}$`);ot("LOOSEPLAIN",`[v=\\s]*${ke[Ne.MAINVERSIONLOOSE]}${ke[Ne.PRERELEASELOOSE]}?${ke[Ne.BUILD]}?`);ot("LOOSE",`^${ke[Ne.LOOSEPLAIN]}$`);ot("GTLT","((?:<|>)?=?)");ot("XRANGEIDENTIFIERLOOSE",`${ke[Ne.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ot("XRANGEIDENTIFIER",`${ke[Ne.NUMERICIDENTIFIER]}|x|X|\\*`);ot("XRANGEPLAIN",`[v=\\s]*(${ke[Ne.XRANGEIDENTIFIER]})(?:\\.(${ke[Ne.XRANGEIDENTIFIER]})(?:\\.(${ke[Ne.XRANGEIDENTIFIER]})(?:${ke[Ne.PRERELEASE]})?${ke[Ne.BUILD]}?)?)?`);ot("XRANGEPLAINLOOSE",`[v=\\s]*(${ke[Ne.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ke[Ne.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ke[Ne.XRANGEIDENTIFIERLOOSE]})(?:${ke[Ne.PRERELEASELOOSE]})?${ke[Ne.BUILD]}?)?)?`);ot("XRANGE",`^${ke[Ne.GTLT]}\\s*${ke[Ne.XRANGEPLAIN]}$`);ot("XRANGELOOSE",`^${ke[Ne.GTLT]}\\s*${ke[Ne.XRANGEPLAINLOOSE]}$`);ot("COERCEPLAIN",`(^|[^\\d])(\\d{1,${og}})(?:\\.(\\d{1,${og}}))?(?:\\.(\\d{1,${og}}))?`);ot("COERCE",`${ke[Ne.COERCEPLAIN]}(?:$|[^\\d])`);ot("COERCEFULL",ke[Ne.COERCEPLAIN]+`(?:${ke[Ne.PRERELEASE]})?(?:${ke[Ne.BUILD]})?(?:$|[^\\d])`);ot("COERCERTL",ke[Ne.COERCE],!0);ot("COERCERTLFULL",ke[Ne.COERCEFULL],!0);ot("LONETILDE","(?:~>?)");ot("TILDETRIM",`(\\s*)${ke[Ne.LONETILDE]}\\s+`,!0);Ka.tildeTrimReplace="$1~";ot("TILDE",`^${ke[Ne.LONETILDE]}${ke[Ne.XRANGEPLAIN]}$`);ot("TILDELOOSE",`^${ke[Ne.LONETILDE]}${ke[Ne.XRANGEPLAINLOOSE]}$`);ot("LONECARET","(?:\\^)");ot("CARETTRIM",`(\\s*)${ke[Ne.LONECARET]}\\s+`,!0);Ka.caretTrimReplace="$1^";ot("CARET",`^${ke[Ne.LONECARET]}${ke[Ne.XRANGEPLAIN]}$`);ot("CARETLOOSE",`^${ke[Ne.LONECARET]}${ke[Ne.XRANGEPLAINLOOSE]}$`);ot("COMPARATORLOOSE",`^${ke[Ne.GTLT]}\\s*(${ke[Ne.LOOSEPLAIN]})$|^$`);ot("COMPARATOR",`^${ke[Ne.GTLT]}\\s*(${ke[Ne.FULLPLAIN]})$|^$`);ot("COMPARATORTRIM",`(\\s*)${ke[Ne.GTLT]}\\s*(${ke[Ne.LOOSEPLAIN]}|${ke[Ne.XRANGEPLAIN]})`,!0);Ka.comparatorTrimReplace="$1$2$3";ot("HYPHENRANGE",`^\\s*(${ke[Ne.XRANGEPLAIN]})\\s+-\\s+(${ke[Ne.XRANGEPLAIN]})\\s*$`);ot("HYPHENRANGELOOSE",`^\\s*(${ke[Ne.XRANGEPLAINLOOSE]})\\s+-\\s+(${ke[Ne.XRANGEPLAINLOOSE]})\\s*$`);ot("STAR","(<|>)?=?\\s*\\*");ot("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ot("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var bA=ce((ez,yA)=>{var f7=Object.freeze({loose:!0}),h7=Object.freeze({}),d7=e=>e?typeof e!="object"?f7:e:h7;yA.exports=d7});var FA=ce((tz,DA)=>{var CA=/^[0-9]+$/,_A=(e,t)=>{let r=CA.test(e),n=CA.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e_A(t,e);DA.exports={compareIdentifiers:_A,rcompareIdentifiers:p7}});var O0=ce((rz,$A)=>{var x0=ag(),{MAX_LENGTH:SA,MAX_SAFE_INTEGER:P0}=ug(),{safeRe:IA,t:BA}=lg(),g7=bA(),{compareIdentifiers:Pc}=FA(),fg=class e{constructor(t,r){if(r=g7(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>SA)throw new TypeError(`version is longer than ${SA} characters`);x0("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?IA[BA.LOOSE]:IA[BA.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>P0||this.major<0)throw new TypeError("Invalid major version");if(this.minor>P0||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>P0||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let a=+i;if(a>=0&&a=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);if(a===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let a=[r,i];n===!1&&(a=[r]),Pc(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};$A.exports=fg});var PA=ce((nz,xA)=>{var RA=O0(),m7=(e,t,r)=>new RA(e,r).compare(new RA(t,r));xA.exports=m7});var TA=ce((iz,OA)=>{var v7=PA(),E7=(e,t,r)=>v7(e,t,r)>=0;OA.exports=E7});var LA=ce((sz,NA)=>{var kA=O0(),w7=(e,t,r=!1)=>{if(e instanceof kA)return e;try{return new kA(e,t)}catch(n){if(!r)return null;throw n}};NA.exports=w7});var jA=ce((az,UA)=>{var A7=O0(),y7=LA(),{safeRe:T0,t:k0}=lg(),b7=(e,t)=>{if(e instanceof A7)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?T0[k0.COERCEFULL]:T0[k0.COERCE]);else{let c=t.includePrerelease?T0[k0.COERCERTLFULL]:T0[k0.COERCERTL],f;for(;(f=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",a=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",u=t.includePrerelease&&r[6]?`+${r[6]}`:"";return y7(`${n}.${i}.${a}${s}${u}`,t)};UA.exports=b7});var qA=ce(N0=>{"use strict";N0.byteLength=F7;N0.toByteArray=I7;N0.fromByteArray=R7;var Ks=[],is=[],D7=typeof Uint8Array<"u"?Uint8Array:Array,pg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($o=0,HA=pg.length;$o0)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 F7(e){var t=MA(e),r=t[0],n=t[1];return(r+n)*3/4-n}function S7(e,t,r){return(t+r)*3/4-r}function I7(e){var t,r=MA(e),n=r[0],i=r[1],a=new D7(S7(e,n,i)),s=0,u=i>0?n-4:n,c;for(c=0;c>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=is[e.charCodeAt(c)]<<2|is[e.charCodeAt(c+1)]>>4,a[s++]=t&255),i===1&&(t=is[e.charCodeAt(c)]<<10|is[e.charCodeAt(c+1)]<<4|is[e.charCodeAt(c+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function B7(e){return Ks[e>>18&63]+Ks[e>>12&63]+Ks[e>>6&63]+Ks[e&63]}function $7(e,t,r){for(var n,i=[],a=t;au?u:s+a));return n===1?(t=e[r-1],i.push(Ks[t>>2]+Ks[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Ks[t>>10]+Ks[t>>4&63]+Ks[t<<2&63]+"=")),i.join("")}});var VA=ce(gg=>{gg.read=function(e,t,r,n,i){var a,s,u=i*8-n-1,c=(1<>1,d=-7,g=r?i-1:0,p=r?-1:1,h=e[t+g];for(g+=p,a=h&(1<<-d)-1,h>>=-d,d+=u;d>0;a=a*256+e[t+g],g+=p,d-=8);for(s=a&(1<<-d)-1,a>>=-d,d+=n;d>0;s=s*256+e[t+g],g+=p,d-=8);if(a===0)a=1-f;else{if(a===c)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-f}return(h?-1:1)*s*Math.pow(2,a-n)};gg.write=function(e,t,r,n,i,a){var s,u,c,f=a*8-i-1,d=(1<>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,E=n?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+g>=1?t+=p/c:t+=p*Math.pow(2,1-g),t*c>=2&&(s++,c/=2),s+g>=d?(u=0,s=d):s+g>=1?(u=(t*c-1)*Math.pow(2,i),s=s+g):(u=t*Math.pow(2,g-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=u&255,h+=E,u/=256,i-=8);for(s=s<0;e[r+h]=s&255,h+=E,s/=256,f-=8);e[r+h-E]|=v*128}});var j0=ce(Nc=>{"use strict";var mg=qA(),Tc=VA(),KA=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Nc.Buffer=de;Nc.SlowBuffer=N7;Nc.INSPECT_MAX_BYTES=50;var L0=2147483647;Nc.kMaxLength=L0;de.TYPED_ARRAY_SUPPORT=x7();!de.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 x7(){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(de.prototype,"parent",{enumerable:!0,get:function(){if(de.isBuffer(this))return this.buffer}});Object.defineProperty(de.prototype,"offset",{enumerable:!0,get:function(){if(de.isBuffer(this))return this.byteOffset}});function za(e){if(e>L0)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,de.prototype),t}function de(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 Ag(e)}return WA(e,t,r)}de.poolSize=8192;function WA(e,t,r){if(typeof e=="string")return O7(e,t);if(ArrayBuffer.isView(e))return T7(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(zs(e,ArrayBuffer)||e&&zs(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(zs(e,SharedArrayBuffer)||e&&zs(e.buffer,SharedArrayBuffer)))return Eg(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 de.from(n,t,r);let i=k7(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return de.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)}de.from=function(e,t,r){return WA(e,t,r)};Object.setPrototypeOf(de.prototype,Uint8Array.prototype);Object.setPrototypeOf(de,Uint8Array);function XA(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 P7(e,t,r){return XA(e),e<=0?za(e):t!==void 0?typeof r=="string"?za(e).fill(t,r):za(e).fill(t):za(e)}de.alloc=function(e,t,r){return P7(e,t,r)};function Ag(e){return XA(e),za(e<0?0:yg(e)|0)}de.allocUnsafe=function(e){return Ag(e)};de.allocUnsafeSlow=function(e){return Ag(e)};function O7(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!de.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=JA(e,t)|0,n=za(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function vg(e){let t=e.length<0?0:yg(e.length)|0,r=za(t);for(let n=0;n=L0)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+L0.toString(16)+" bytes");return e|0}function N7(e){return+e!=e&&(e=0),de.alloc(+e)}de.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==de.prototype};de.compare=function(t,r){if(zs(t,Uint8Array)&&(t=de.from(t,t.offset,t.byteLength)),zs(r,Uint8Array)&&(r=de.from(r,r.offset,r.byteLength)),!de.isBuffer(t)||!de.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 a=0,s=Math.min(n,i);ai.length?(de.isBuffer(s)||(s=de.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(de.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function JA(e,t){if(de.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||zs(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 wg(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ay(e).length;default:if(i)return n?-1:wg(e).length;t=(""+t).toLowerCase(),i=!0}}de.byteLength=JA;function L7(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 Y7(this,t,r);case"utf8":case"utf-8":return QA(this,t,r);case"ascii":return z7(this,t,r);case"latin1":case"binary":return G7(this,t,r);case"base64":return V7(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W7(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}de.prototype._isBuffer=!0;function Ro(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}de.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;rr&&(t+=" ... "),""};KA&&(de.prototype[KA]=de.prototype.inspect);de.prototype.compare=function(t,r,n,i,a){if(zs(t,Uint8Array)&&(t=de.from(t,t.offset,t.byteLength)),!de.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),a===void 0&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===t)return 0;let s=a-i,u=n-r,c=Math.min(s,u),f=this.slice(i,a),d=t.slice(r,n);for(let g=0;g2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Cg(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=de.from(t,n)),de.isBuffer(t))return t.length===0?-1:zA(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):zA(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function zA(e,t,r,n,i){let a=1,s=e.length,u=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;a=2,s/=2,u/=2,r/=2}function c(d,g){return a===1?d[g]:d.readUInt16BE(g*a)}let f;if(i){let d=-1;for(f=r;fs&&(r=s-u),f=r;f>=0;f--){let d=!0;for(let g=0;gi&&(n=i)):n=i;let a=t.length;n>a/2&&(n=a/2);let s;for(s=0;s>>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 a=this.length-r;if((n===void 0||n>a)&&(n=a),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 U7(this,t,r,n);case"utf8":case"utf-8":return j7(this,t,r,n);case"ascii":case"latin1":case"binary":return H7(this,t,r,n);case"base64":return M7(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q7(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};de.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function V7(e,t,r){return t===0&&r===e.length?mg.fromByteArray(e):mg.fromByteArray(e.slice(t,r))}function QA(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i239?4:a>223?3:a>191?2:1;if(i+u<=r){let c,f,d,g;switch(u){case 1:a<128&&(s=a);break;case 2:c=e[i+1],(c&192)===128&&(g=(a&31)<<6|c&63,g>127&&(s=g));break;case 3:c=e[i+1],f=e[i+2],(c&192)===128&&(f&192)===128&&(g=(a&15)<<12|(c&63)<<6|f&63,g>2047&&(g<55296||g>57343)&&(s=g));break;case 4:c=e[i+1],f=e[i+2],d=e[i+3],(c&192)===128&&(f&192)===128&&(d&192)===128&&(g=(a&15)<<18|(c&63)<<12|(f&63)<<6|d&63,g>65535&&g<1114112&&(s=g))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=u}return K7(n)}var GA=4096;function K7(e){let t=e.length;if(t<=GA)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn)&&(r=n);let i="";for(let a=t;an&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}de.prototype.readUintLE=de.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Qr(t,r,this.length);let i=this[t],a=1,s=0;for(;++s>>0,r=r>>>0,n||Qr(t,r,this.length);let i=this[t+--r],a=1;for(;r>0&&(a*=256);)i+=this[t+--r]*a;return i};de.prototype.readUint8=de.prototype.readUInt8=function(t,r){return t=t>>>0,r||Qr(t,1,this.length),this[t]};de.prototype.readUint16LE=de.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||Qr(t,2,this.length),this[t]|this[t+1]<<8};de.prototype.readUint16BE=de.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||Qr(t,2,this.length),this[t]<<8|this[t+1]};de.prototype.readUint32LE=de.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||Qr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};de.prototype.readUint32BE=de.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||Qr(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};de.prototype.readBigUInt64LE=Nu(function(t){t=t>>>0,kc(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&hf(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,a=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<>>0,kc(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&hf(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],a=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Qr(t,r,this.length);let i=this[t],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*r)),i};de.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Qr(t,r,this.length);let i=r,a=1,s=this[t+--i];for(;i>0&&(a*=256);)s+=this[t+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*r)),s};de.prototype.readInt8=function(t,r){return t=t>>>0,r||Qr(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};de.prototype.readInt16LE=function(t,r){t=t>>>0,r||Qr(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};de.prototype.readInt16BE=function(t,r){t=t>>>0,r||Qr(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};de.prototype.readInt32LE=function(t,r){return t=t>>>0,r||Qr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};de.prototype.readInt32BE=function(t,r){return t=t>>>0,r||Qr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};de.prototype.readBigInt64LE=Nu(function(t){t=t>>>0,kc(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&hf(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<>>0,kc(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&hf(t,this.length-8);let i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<>>0,r||Qr(t,4,this.length),Tc.read(this,t,!0,23,4)};de.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Qr(t,4,this.length),Tc.read(this,t,!1,23,4)};de.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Qr(t,8,this.length),Tc.read(this,t,!0,52,8)};de.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Qr(t,8,this.length),Tc.read(this,t,!1,52,8)};function hi(e,t,r,n,i,a){if(!de.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}de.prototype.writeUintLE=de.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;hi(this,t,r,n,u,0)}let a=1,s=0;for(this[r]=t&255;++s>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;hi(this,t,r,n,u,0)}let a=n-1,s=1;for(this[r+a]=t&255;--a>=0&&(s*=256);)this[r+a]=t/s&255;return r+n};de.prototype.writeUint8=de.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||hi(this,t,r,1,255,0),this[r]=t&255,r+1};de.prototype.writeUint16LE=de.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||hi(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};de.prototype.writeUint16BE=de.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||hi(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};de.prototype.writeUint32LE=de.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||hi(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};de.prototype.writeUint32BE=de.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||hi(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 ey(e,t,r,n,i){sy(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a;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 ty(e,t,r,n,i){sy(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a=a>>8,e[r+6]=a,a=a>>8,e[r+5]=a,a=a>>8,e[r+4]=a;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}de.prototype.writeBigUInt64LE=Nu(function(t,r=0){return ey(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});de.prototype.writeBigUInt64BE=Nu(function(t,r=0){return ty(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});de.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let c=Math.pow(2,8*n-1);hi(this,t,r,n,c-1,-c)}let a=0,s=1,u=0;for(this[r]=t&255;++a>0)-u&255;return r+n};de.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let c=Math.pow(2,8*n-1);hi(this,t,r,n,c-1,-c)}let a=n-1,s=1,u=0;for(this[r+a]=t&255;--a>=0&&(s*=256);)t<0&&u===0&&this[r+a+1]!==0&&(u=1),this[r+a]=(t/s>>0)-u&255;return r+n};de.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||hi(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};de.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||hi(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};de.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||hi(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};de.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||hi(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};de.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||hi(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};de.prototype.writeBigInt64LE=Nu(function(t,r=0){return ey(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});de.prototype.writeBigInt64BE=Nu(function(t,r=0){return ty(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ry(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ny(e,t,r,n,i){return t=+t,r=r>>>0,i||ry(e,t,r,4,34028234663852886e22,-34028234663852886e22),Tc.write(e,t,r,n,23,4),r+4}de.prototype.writeFloatLE=function(t,r,n){return ny(this,t,r,!0,n)};de.prototype.writeFloatBE=function(t,r,n){return ny(this,t,r,!1,n)};function iy(e,t,r,n,i){return t=+t,r=r>>>0,i||ry(e,t,r,8,17976931348623157e292,-17976931348623157e292),Tc.write(e,t,r,n,52,8),r+8}de.prototype.writeDoubleLE=function(t,r,n){return iy(this,t,r,!0,n)};de.prototype.writeDoubleBE=function(t,r,n){return iy(this,t,r,!1,n)};de.prototype.copy=function(t,r,n,i){if(!de.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=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>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let a;if(typeof t=="number")for(a=r;a2**32?i=YA(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=YA(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function YA(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 X7(e,t,r){kc(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&hf(t,e.length-(r+1))}function sy(e,t,r,n,i,a){if(e>r||e3?t===0||t===BigInt(0)?u=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:u=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:u=`>= ${t}${s} and <= ${r}${s}`,new Oc.ERR_OUT_OF_RANGE("value",u,e)}X7(n,i,a)}function kc(e,t){if(typeof e!="number")throw new Oc.ERR_INVALID_ARG_TYPE(t,"number",e)}function hf(e,t,r){throw Math.floor(e)!==e?(kc(e,r),new Oc.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new Oc.ERR_BUFFER_OUT_OF_BOUNDS:new Oc.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var J7=/[^+/0-9A-Za-z-_]/g;function Z7(e){if(e=e.split("=")[0],e=e.trim().replace(J7,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function wg(e,t){t=t||1/0;let r,n=e.length,i=null,a=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function Q7(e){let t=[];for(let r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function ay(e){return mg.toByteArray(Z7(e))}function U0(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function zs(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Cg(e){return e!==e}var t$=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 Nu(e){return typeof BigInt>"u"?r$:e}function r$(){throw new Error("BigInt not supported")}});var $y=ce(Ce=>{var df={};df.userAgent=!1;var Lc={},n$="11.1.0",i$="jsrsasign(all) 11.1.0 (2024-02-01) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var Se=Se||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function h(){}return{extend:function(E){h.prototype=this;var v=new h;return E&&v.mixIn(E),v.hasOwnProperty("init")||(v.init=function(){v.$super.init.apply(this,arguments)}),v.init.prototype=v,v.$super=this,v},create:function(){var E=this.extend();return E.init.apply(E,arguments),E},init:function(){},mixIn:function(E){for(var v in E)E.hasOwnProperty(v)&&(this[v]=E[v]);E.hasOwnProperty("toString")&&(this.toString=E.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),a=n.WordArray=i.extend({init:function(h,E){h=this.words=h||[],E!=t?this.sigBytes=E:this.sigBytes=h.length*4},toString:function(h){return(h||u).stringify(this)},concat:function(h){var E=this.words,v=h.words,b=this.sigBytes,m=h.sigBytes;if(this.clamp(),b%4)for(var y=0;y>>2]>>>24-y%4*8&255;E[b+y>>>2]|=D<<24-(b+y)%4*8}else for(var y=0;y>>2]=v[y>>>2];return this.sigBytes+=m,this},clamp:function(){var h=this.words,E=this.sigBytes;h[E>>>2]&=4294967295<<32-E%4*8,h.length=e.ceil(E/4)},clone:function(){var h=i.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var E=[],v=0;v>>2]>>>24-m%4*8&255;b.push((y>>>4).toString(16)),b.push((y&15).toString(16))}return b.join("")},parse:function(h){for(var E=h.length,v=[],b=0;b>>3]|=parseInt(h.substr(b,2),16)<<24-b%8*4;return new a.init(v,E/2)}},c=s.Latin1={stringify:function(h){for(var E=h.words,v=h.sigBytes,b=[],m=0;m>>2]>>>24-m%4*8&255;b.push(String.fromCharCode(y))}return b.join("")},parse:function(h){for(var E=h.length,v=[],b=0;b>>2]|=(h.charCodeAt(b)&255)<<24-b%4*8;return new a.init(v,E)}},f=s.Utf8={stringify:function(h){try{return decodeURIComponent(escape(c.stringify(h)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(h){return c.parse(unescape(encodeURIComponent(h)))}},d=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.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 E=this._data,v=E.words,b=E.sigBytes,m=this.blockSize,y=m*4,D=b/y;h?D=e.ceil(D):D=e.max((D|0)-this._minBufferSize,0);var _=D*m,F=e.min(_*4,b);if(_){for(var L=0;L<_;L+=m)this._doProcessBlock(v,L);var k=v.splice(0,_);E.sigBytes-=F}return new a.init(k,F)},clone:function(){var h=i.clone.call(this);return h._data=this._data.clone(),h},_minBufferSize:0}),g=n.Hasher=d.extend({cfg:i.extend(),init:function(h){this.cfg=this.cfg.extend(h),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(h){return this._append(h),this._process(),this},finalize:function(h){h&&this._append(h);var E=this._doFinalize();return E},blockSize:512/32,_createHelper:function(h){return function(E,v){return new h.init(v).finalize(E)}},_createHmacHelper:function(h){return function(E,v){return new p.HMAC.init(h,v).finalize(E)}}}),p=r.algo={};return r}(Math);(function(e){var i=Se,t=i.lib,r=t.Base,n=t.WordArray,i=i.x64={};i.Word=r.extend({init:function(a,s){this.high=a,this.low=s}}),i.WordArray=r.extend({init:function(a,s){a=this.words=a||[],this.sigBytes=s!=e?s:8*a.length},toX32:function(){for(var a=this.words,s=a.length,u=[],c=0;c>>2]&255}},t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:g,padding:f}),reset:function(){u.reset.call(this);var b=this.cfg,v=b.iv,b=b.mode;if(this._xformMode==this._ENC_XFORM_MODE)var m=b.createEncryptor;else m=b.createDecryptor,this._minBufferSize=1;this._mode=m.call(b,this,v&&v.words)},_doProcessBlock:function(v,b){this._mode.processBlock(v,b)},_doFinalize:function(){var v=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){v.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),v.unpad(b);return b},blockSize:4});var d=t.CipherParams=r.extend({init:function(v){this.mixIn(v)},toString:function(v){return(v||this.formatter).stringify(this)}}),g=(h.format={}).OpenSSL={stringify:function(v){var b=v.ciphertext;return v=v.salt,(v?n.create([1398893684,1701076831]).concat(v).concat(b):b).toString(a)},parse:function(v){v=a.parse(v);var b=v.words;if(b[0]==1398893684&&b[1]==1701076831){var m=n.create(b.slice(2,4));b.splice(0,4),v.sigBytes-=16}return d.create({ciphertext:v,salt:m})}},p=t.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(v,b,m,y){y=this.cfg.extend(y);var D=v.createEncryptor(m,y);return b=D.finalize(b),D=D.cfg,d.create({ciphertext:b,key:m,iv:D.iv,algorithm:v,mode:D.mode,padding:D.padding,blockSize:v.blockSize,formatter:y.format})},decrypt:function(v,b,m,y){return y=this.cfg.extend(y),b=this._parse(b,y.format),v.createDecryptor(m,y).finalize(b.ciphertext)},_parse:function(v,b){return typeof v=="string"?b.parse(v,this):v}}),h=(h.kdf={}).OpenSSL={execute:function(v,b,m,y){return y||(y=n.random(8)),v=s.create({keySize:b+m}).compute(v,y),m=n.create(v.words.slice(b),4*m),v.sigBytes=4*b,d.create({key:v,iv:m,salt:y})}},E=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:h}),encrypt:function(v,b,m,y){return y=this.cfg.extend(y),m=y.kdf.execute(m,v.keySize,v.ivSize),y.iv=m.iv,v=p.encrypt.call(this,v,b,m.key,y),v.mixIn(m),v},decrypt:function(v,b,m,y){return y=this.cfg.extend(y),b=this._parse(b,y.format),m=y.kdf.execute(m,v.keySize,v.ivSize,b.salt),y.iv=m.iv,p.decrypt.call(this,v,b,m.key,y)}})}();(function(){for(var e=Se,t=e.lib.BlockCipher,L=e.algo,r=[],n=[],i=[],a=[],s=[],u=[],c=[],f=[],d=[],g=[],p=[],h=0;256>h;h++)p[h]=128>h?h<<1:h<<1^283;for(var E=0,v=0,h=0;256>h;h++){var b=v^v<<1^v<<2^v<<3^v<<4,b=b>>>8^b&255^99;r[E]=b,n[b]=E;var m=p[E],y=p[m],D=p[y],_=257*p[b]^16843008*b;i[E]=_<<24|_>>>8,a[E]=_<<16|_>>>16,s[E]=_<<8|_>>>24,u[E]=_,_=16843009*D^65537*y^257*m^16843008*E,c[b]=_<<24|_>>>8,f[b]=_<<16|_>>>16,d[b]=_<<8|_>>>24,g[b]=_,E?(E=m^p[p[p[D^m]]],v^=p[p[v]]):E=v=1}var F=[0,1,2,4,8,16,32,64,128,27,54],L=L.AES=t.extend({_doReset:function(){for(var B=this._key,k=B.words,S=B.sigBytes/4,B=4*((this._nRounds=S+6)+1),O=this._keySchedule=[],x=0;x>>24]<<24|r[U>>>16&255]<<16|r[U>>>8&255]<<8|r[U&255]):(U=U<<8|U>>>24,U=r[U>>>24]<<24|r[U>>>16&255]<<16|r[U>>>8&255]<<8|r[U&255],U^=F[x/S|0]<<24),O[x]=O[x-S]^U}for(k=this._invKeySchedule=[],S=0;SS||4>=x?U:c[r[U>>>24]]^f[r[U>>>16&255]]^d[r[U>>>8&255]]^g[r[U&255]]},encryptBlock:function(k,S){this._doCryptBlock(k,S,this._keySchedule,i,a,s,u,r)},decryptBlock:function(k,S){var B=k[S+1];k[S+1]=k[S+3],k[S+3]=B,this._doCryptBlock(k,S,this._invKeySchedule,c,f,d,g,n),B=k[S+1],k[S+1]=k[S+3],k[S+3]=B},_doCryptBlock:function(k,S,B,O,x,U,Y,H){for(var K=this._nRounds,tt=k[S]^B[0],ct=k[S+1]^B[1],lt=k[S+2]^B[2],rt=k[S+3]^B[3],W=4,ie=1;ie>>24]^x[ct>>>16&255]^U[lt>>>8&255]^Y[rt&255]^B[W++],Fe=O[ct>>>24]^x[lt>>>16&255]^U[rt>>>8&255]^Y[tt&255]^B[W++],xe=O[lt>>>24]^x[rt>>>16&255]^U[tt>>>8&255]^Y[ct&255]^B[W++],rt=O[rt>>>24]^x[tt>>>16&255]^U[ct>>>8&255]^Y[lt&255]^B[W++],tt=_e,ct=Fe,lt=xe;_e=(H[tt>>>24]<<24|H[ct>>>16&255]<<16|H[lt>>>8&255]<<8|H[rt&255])^B[W++],Fe=(H[ct>>>24]<<24|H[lt>>>16&255]<<16|H[rt>>>8&255]<<8|H[tt&255])^B[W++],xe=(H[lt>>>24]<<24|H[rt>>>16&255]<<16|H[tt>>>8&255]<<8|H[ct&255])^B[W++],rt=(H[rt>>>24]<<24|H[tt>>>16&255]<<16|H[ct>>>8&255]<<8|H[lt&255])^B[W++],k[S]=_e,k[S+1]=Fe,k[S+2]=xe,k[S+3]=rt},keySize:8});e.AES=t._createHelper(L)})();(function(){function e(p,h){var E=(this._lBlock>>>p^this._rBlock)&h;this._rBlock^=E,this._lBlock^=E<>>p^this._lBlock)&h;this._lBlock^=E,this._rBlock^=E<E;E++){var v=s[E]-1;h[E]=p[v>>>5]>>>31-v%32&1}for(p=this._subKeys=[],v=0;16>v;v++){for(var b=p[v]=[],m=c[v],E=0;24>E;E++)b[E/6|0]|=h[(u[E]-1+m)%28]<<31-E%6,b[4+(E/6|0)]|=h[28+(u[E+24]-1+m)%28]<<31-E%6;for(b[0]=b[0]<<1|b[0]>>>31,E=1;7>E;E++)b[E]>>>=4*(E-1)+3;b[7]=b[7]<<5|b[7]>>>27}for(h=this._invSubKeys=[],E=0;16>E;E++)h[E]=p[15-E]},encryptBlock:function(p,h){this._doCryptBlock(p,h,this._subKeys)},decryptBlock:function(p,h){this._doCryptBlock(p,h,this._invSubKeys)},_doCryptBlock:function(p,h,E){this._lBlock=p[h],this._rBlock=p[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 v=0;16>v;v++){for(var b=E[v],m=this._lBlock,y=this._rBlock,D=0,_=0;8>_;_++)D|=f[_][((y^b[_])&d[_])>>>0];this._lBlock=y,this._rBlock=m^D}E=this._lBlock,this._lBlock=this._rBlock,this._rBlock=E,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),p[h]=this._lBlock,p[h+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(g),a=a.TripleDES=i.extend({_doReset:function(){var p=this._key.words;this._des1=g.createEncryptor(n.create(p.slice(0,2))),this._des2=g.createEncryptor(n.create(p.slice(2,4))),this._des3=g.createEncryptor(n.create(p.slice(4,6)))},encryptBlock:function(p,h){this._des1.encryptBlock(p,h),this._des2.decryptBlock(p,h),this._des3.encryptBlock(p,h)},decryptBlock:function(p,h){this._des3.decryptBlock(p,h),this._des2.encryptBlock(p,h),this._des1.decryptBlock(p,h)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(a)})();(function(){var e=Se,t=e.lib.WordArray;e.enc.Base64={stringify:function(r){var n=r.words,i=r.sigBytes,a=this._map;r.clamp(),r=[];for(var s=0;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,c=0;4>c&&s+.75*c>>6*(3-c)&63));if(n=a.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,i=this._map,a=i.charAt(64);a&&(a=r.indexOf(a),a!=-1&&(n=a));for(var a=[],s=0,u=0;u>>6-2*(u%4);a[s>>>2]|=(c|f)<<24-8*(s%4),s++}return t.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(e){function t(g,p,h,E,v,b,m){return g=g+(p&h|~p&E)+v+m,(g<>>32-b)+p}function r(g,p,h,E,v,b,m){return g=g+(p&E|h&~E)+v+m,(g<>>32-b)+p}function n(g,p,h,E,v,b,m){return g=g+(p^h^E)+v+m,(g<>>32-b)+p}function i(g,p,h,E,v,b,m){return g=g+(h^(p|~E))+v+m,(g<>>32-b)+p}for(var a=Se,c=a.lib,s=c.WordArray,u=c.Hasher,c=a.algo,f=[],d=0;64>d;d++)f[d]=4294967296*e.abs(e.sin(d+1))|0;c=c.MD5=u.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(g,p){for(var h=0;16>h;h++){var E=p+h,v=g[E];g[E]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var h=this._hash.words,E=g[p+0],v=g[p+1],b=g[p+2],m=g[p+3],y=g[p+4],D=g[p+5],_=g[p+6],F=g[p+7],L=g[p+8],k=g[p+9],S=g[p+10],B=g[p+11],O=g[p+12],x=g[p+13],U=g[p+14],Y=g[p+15],H=h[0],ie=h[1],W=h[2],K=h[3],H=t(H,ie,W,K,E,7,f[0]),K=t(K,H,ie,W,v,12,f[1]),W=t(W,K,H,ie,b,17,f[2]),ie=t(ie,W,K,H,m,22,f[3]),H=t(H,ie,W,K,y,7,f[4]),K=t(K,H,ie,W,D,12,f[5]),W=t(W,K,H,ie,_,17,f[6]),ie=t(ie,W,K,H,F,22,f[7]),H=t(H,ie,W,K,L,7,f[8]),K=t(K,H,ie,W,k,12,f[9]),W=t(W,K,H,ie,S,17,f[10]),ie=t(ie,W,K,H,B,22,f[11]),H=t(H,ie,W,K,O,7,f[12]),K=t(K,H,ie,W,x,12,f[13]),W=t(W,K,H,ie,U,17,f[14]),ie=t(ie,W,K,H,Y,22,f[15]),H=r(H,ie,W,K,v,5,f[16]),K=r(K,H,ie,W,_,9,f[17]),W=r(W,K,H,ie,B,14,f[18]),ie=r(ie,W,K,H,E,20,f[19]),H=r(H,ie,W,K,D,5,f[20]),K=r(K,H,ie,W,S,9,f[21]),W=r(W,K,H,ie,Y,14,f[22]),ie=r(ie,W,K,H,y,20,f[23]),H=r(H,ie,W,K,k,5,f[24]),K=r(K,H,ie,W,U,9,f[25]),W=r(W,K,H,ie,m,14,f[26]),ie=r(ie,W,K,H,L,20,f[27]),H=r(H,ie,W,K,x,5,f[28]),K=r(K,H,ie,W,b,9,f[29]),W=r(W,K,H,ie,F,14,f[30]),ie=r(ie,W,K,H,O,20,f[31]),H=n(H,ie,W,K,D,4,f[32]),K=n(K,H,ie,W,L,11,f[33]),W=n(W,K,H,ie,B,16,f[34]),ie=n(ie,W,K,H,U,23,f[35]),H=n(H,ie,W,K,v,4,f[36]),K=n(K,H,ie,W,y,11,f[37]),W=n(W,K,H,ie,F,16,f[38]),ie=n(ie,W,K,H,S,23,f[39]),H=n(H,ie,W,K,x,4,f[40]),K=n(K,H,ie,W,E,11,f[41]),W=n(W,K,H,ie,m,16,f[42]),ie=n(ie,W,K,H,_,23,f[43]),H=n(H,ie,W,K,k,4,f[44]),K=n(K,H,ie,W,O,11,f[45]),W=n(W,K,H,ie,Y,16,f[46]),ie=n(ie,W,K,H,b,23,f[47]),H=i(H,ie,W,K,E,6,f[48]),K=i(K,H,ie,W,F,10,f[49]),W=i(W,K,H,ie,U,15,f[50]),ie=i(ie,W,K,H,D,21,f[51]),H=i(H,ie,W,K,O,6,f[52]),K=i(K,H,ie,W,m,10,f[53]),W=i(W,K,H,ie,S,15,f[54]),ie=i(ie,W,K,H,v,21,f[55]),H=i(H,ie,W,K,L,6,f[56]),K=i(K,H,ie,W,Y,10,f[57]),W=i(W,K,H,ie,_,15,f[58]),ie=i(ie,W,K,H,x,21,f[59]),H=i(H,ie,W,K,y,6,f[60]),K=i(K,H,ie,W,B,10,f[61]),W=i(W,K,H,ie,b,15,f[62]),ie=i(ie,W,K,H,k,21,f[63]);h[0]=h[0]+H|0,h[1]=h[1]+ie|0,h[2]=h[2]+W|0,h[3]=h[3]+K|0},_doFinalize:function(){var g=this._data,p=g.words,h=8*this._nDataBytes,E=8*g.sigBytes;p[E>>>5]|=128<<24-E%32;var v=e.floor(h/4294967296);for(p[(E+64>>>9<<4)+15]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,p[(E+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,g.sigBytes=4*(p.length+1),this._process(),g=this._hash,p=g.words,h=0;4>h;h++)E=p[h],p[h]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360;return g},clone:function(){var g=u.clone.call(this);return g._hash=this._hash.clone(),g}}),a.MD5=u._createHelper(c),a.HmacMD5=u._createHmacHelper(c)})(Math);(function(){var e=Se,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(a,s){for(var u=this._hash.words,c=u[0],f=u[1],d=u[2],g=u[3],p=u[4],h=0;80>h;h++){if(16>h)n[h]=a[s+h]|0;else{var E=n[h-3]^n[h-8]^n[h-14]^n[h-16];n[h]=E<<1|E>>>31}E=(c<<5|c>>>27)+p+n[h],E=20>h?E+((f&d|~f&g)+1518500249):40>h?E+((f^d^g)+1859775393):60>h?E+((f&d|f&g|d&g)-1894007588):E+((f^d^g)-899497514),p=g,g=d,d=f<<30|f>>>2,f=c,c=E}u[0]=u[0]+c|0,u[1]=u[1]+f|0,u[2]=u[2]+d|0,u[3]=u[3]+g|0,u[4]=u[4]+p|0},_doFinalize:function(){var a=this._data,s=a.words,u=8*this._nDataBytes,c=8*a.sigBytes;return s[c>>>5]|=128<<24-c%32,s[(c+64>>>9<<4)+14]=Math.floor(u/4294967296),s[(c+64>>>9<<4)+15]=u,a.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var a=r.clone.call(this);return a._hash=this._hash.clone(),a}});e.SHA1=r._createHelper(i),e.HmacSHA1=r._createHmacHelper(i)})();(function(e){for(var t=Se,h=t.lib,r=h.WordArray,n=h.Hasher,h=t.algo,i=[],a=[],s=function(v){return 4294967296*(v-(v|0))|0},u=2,c=0;64>c;){var f;e:{f=u;for(var d=e.sqrt(f),g=2;g<=d;g++)if(!(f%g)){f=!1;break e}f=!0}f&&(8>c&&(i[c]=s(e.pow(u,.5))),a[c]=s(e.pow(u,1/3)),c++),u++}var p=[],h=h.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(E,v){for(var b=this._hash.words,m=b[0],y=b[1],D=b[2],_=b[3],F=b[4],L=b[5],k=b[6],S=b[7],B=0;64>B;B++){if(16>B)p[B]=E[v+B]|0;else{var O=p[B-15],x=p[B-2];p[B]=((O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3)+p[B-7]+((x<<15|x>>>17)^(x<<13|x>>>19)^x>>>10)+p[B-16]}O=S+((F<<26|F>>>6)^(F<<21|F>>>11)^(F<<7|F>>>25))+(F&L^~F&k)+a[B]+p[B],x=((m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22))+(m&y^m&D^y&D),S=k,k=L,L=F,F=_+O|0,_=D,D=y,y=m,m=O+x|0}b[0]=b[0]+m|0,b[1]=b[1]+y|0,b[2]=b[2]+D|0,b[3]=b[3]+_|0,b[4]=b[4]+F|0,b[5]=b[5]+L|0,b[6]=b[6]+k|0,b[7]=b[7]+S|0},_doFinalize:function(){var E=this._data,v=E.words,b=8*this._nDataBytes,m=8*E.sigBytes;return v[m>>>5]|=128<<24-m%32,v[(m+64>>>9<<4)+14]=e.floor(b/4294967296),v[(m+64>>>9<<4)+15]=b,E.sigBytes=4*v.length,this._process(),this._hash},clone:function(){var E=n.clone.call(this);return E._hash=this._hash.clone(),E}});t.SHA256=n._createHelper(h),t.HmacSHA256=n._createHmacHelper(h)})(Math);(function(){var e=Se,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=Se,r=t.lib.Hasher,a=t.x64,n=a.Word,i=a.WordArray,a=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)],u=[],c=0;80>c;c++)u[c]=e();a=a.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,d){for(var y=this._hash.words,g=y[0],p=y[1],h=y[2],E=y[3],v=y[4],b=y[5],m=y[6],y=y[7],D=g.high,_=g.low,F=p.high,L=p.low,k=h.high,S=h.low,B=E.high,O=E.low,x=v.high,U=v.low,Y=b.high,H=b.low,K=m.high,W=m.low,ie=y.high,_e=y.low,Fe=D,xe=_,rt=F,tt=L,ct=k,lt=S,sn=B,nr=O,Ct=x,Er=U,sr=Y,dt=H,zt=K,nt=W,Ke=ie,ar=_e,He=0;80>He;He++){var wr=u[He];if(16>He)var Ot=wr.high=f[d+2*He]|0,De=wr.low=f[d+2*He+1]|0;else{var Ot=u[He-15],De=Ot.high,vt=Ot.low,Ot=(De>>>1|vt<<31)^(De>>>8|vt<<24)^De>>>7,vt=(vt>>>1|De<<31)^(vt>>>8|De<<24)^(vt>>>7|De<<25),Or=u[He-2],De=Or.high,Ft=Or.low,Or=(De>>>19|Ft<<13)^(De<<3|Ft>>>29)^De>>>6,Ft=(Ft>>>19|De<<13)^(Ft<<3|De>>>29)^(Ft>>>6|De<<26),De=u[He-7],an=De.high,er=u[He-16],Ue=er.high,er=er.low,De=vt+De.low,Ot=Ot+an+(De>>>0>>0?1:0),De=De+Ft,Ot=Ot+Or+(De>>>0>>0?1:0),De=De+er,Ot=Ot+Ue+(De>>>0>>0?1:0);wr.high=Ot,wr.low=De}var an=Ct&sr^~Ct&zt,er=Er&dt^~Er&nt,wr=Fe&rt^Fe&ct^rt&ct,Gt=xe&tt^xe<^tt<,vt=(Fe>>>28|xe<<4)^(Fe<<30|xe>>>2)^(Fe<<25|xe>>>7),Or=(xe>>>28|Fe<<4)^(xe<<30|Fe>>>2)^(xe<<25|Fe>>>7),Ft=s[He],_i=Ft.high,un=Ft.low,Ft=ar+((Er>>>14|Ct<<18)^(Er>>>18|Ct<<14)^(Er<<23|Ct>>>9)),Ue=Ke+((Ct>>>14|Er<<18)^(Ct>>>18|Er<<14)^(Ct<<23|Er>>>9))+(Ft>>>0>>0?1:0),Ft=Ft+er,Ue=Ue+an+(Ft>>>0>>0?1:0),Ft=Ft+un,Ue=Ue+_i+(Ft>>>0>>0?1:0),Ft=Ft+De,Ue=Ue+Ot+(Ft>>>0>>0?1:0),De=Or+Gt,wr=vt+wr+(De>>>0>>0?1:0),Ke=zt,ar=nt,zt=sr,nt=dt,sr=Ct,dt=Er,Er=nr+Ft|0,Ct=sn+Ue+(Er>>>0>>0?1:0)|0,sn=ct,nr=lt,ct=rt,lt=tt,rt=Fe,tt=xe,xe=Ft+De|0,Fe=Ue+wr+(xe>>>0>>0?1:0)|0}_=g.low=_+xe,g.high=D+Fe+(_>>>0>>0?1:0),L=p.low=L+tt,p.high=F+rt+(L>>>0>>0?1:0),S=h.low=S+lt,h.high=k+ct+(S>>>0>>0?1:0),O=E.low=O+nr,E.high=B+sn+(O>>>0>>0?1:0),U=v.low=U+Er,v.high=x+Ct+(U>>>0>>0?1:0),H=b.low=H+dt,b.high=Y+sr+(H>>>0
>>0?1:0),W=m.low=W+nt,m.high=K+zt+(W>>>0>>0?1:0),_e=y.low=_e+ar,y.high=ie+Ke+(_e>>>0>>0?1:0)},_doFinalize:function(){var f=this._data,d=f.words,g=8*this._nDataBytes,p=8*f.sigBytes;return d[p>>>5]|=128<<24-p%32,d[(p+128>>>10<<5)+30]=Math.floor(g/4294967296),d[(p+128>>>10<<5)+31]=g,f.sigBytes=4*d.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(a),t.HmacSHA512=r._createHmacHelper(a)})();(function(){var e=Se,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 a=n._doFinalize.call(this);return a.sigBytes-=16,a}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)})();(function(){var e=Se,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]),a=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]),u=t.create([0,1518500249,1859775393,2400959708,2840853838]),c=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(d,g){for(var p=0;16>p;p++){var h=g+p,E=d[h];d[h]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}var h=this._hash.words,E=u.words,v=c.words,b=n.words,m=i.words,y=a.words,D=s.words,_,F,L,k,S,B,O,x,U,Y;B=_=h[0],O=F=h[1],x=L=h[2],U=k=h[3],Y=S=h[4];for(var H,p=0;80>p;p+=1)H=_+d[g+b[p]]|0,H=16>p?H+((F^L^k)+E[0]):32>p?H+((F&L|~F&k)+E[1]):48>p?H+(((F|~L)^k)+E[2]):64>p?H+((F&k|L&~k)+E[3]):H+((F^(L|~k))+E[4]),H|=0,H=H<>>32-y[p],H=H+S|0,_=S,S=k,k=L<<10|L>>>22,L=F,F=H,H=B+d[g+m[p]]|0,H=16>p?H+((O^(x|~U))+v[0]):32>p?H+((O&U|x&~U)+v[1]):48>p?H+(((O|~x)^U)+v[2]):64>p?H+((O&x|~O&U)+v[3]):H+((O^x^U)+v[4]),H|=0,H=H<>>32-D[p],H=H+Y|0,B=Y,Y=U,U=x<<10|x>>>22,x=O,O=H;H=h[1]+L+U|0,h[1]=h[2]+k+Y|0,h[2]=h[3]+S+B|0,h[3]=h[4]+_+O|0,h[4]=h[0]+F+x|0,h[0]=H},_doFinalize:function(){var d=this._data,g=d.words,p=8*this._nDataBytes,h=8*d.sigBytes;for(g[h>>>5]|=128<<24-h%32,g[(h+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,d.sigBytes=4*(g.length+1),this._process(),d=this._hash,g=d.words,p=0;5>p;p++)h=g[p],g[p]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return d},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});e.RIPEMD160=r._createHelper(f),e.HmacRIPEMD160=r._createHmacHelper(f)})(Math);(function(){var e=Se,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,a=4*i;n.sigBytes>a&&(n=r.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),u=this._iKey=n.clone(),c=s.words,f=u.words,d=0;d>6)+Uc.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=Uc.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=Uc.charAt(r>>2)+Uc.charAt((r&3)<<4)),Sg)for(;(n.length&3)>0;)n+=Sg;return n}function Hc(e){var t="",r,n=0,i,a;for(r=0;r>2),i=a&3,n=1):n==1?(t+=Ga(i<<2|a>>4),i=a&15,n=2):n==2?(t+=Ga(i),t+=Ga(a>>2),i=a&3,n=3):(t+=Ga(i<<2|a>>4),t+=Ga(a&15),n=0));return n==1&&(t+=Ga(i<<2)),t}function ly(e){var t=Hc(e),r,n=new Array;for(r=0;2*r=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=s&67108863}return i}function u$(e,t,r,n,i,a){for(var s=t&32767,u=t>>15;--a>=0;){var c=this[e]&32767,f=this[e++]>>15,d=u*c+f*s;c=s*c+((d&32767)<<15)+r[n]+(i&1073741823),i=(c>>>30)+(d>>>15)+u*f+(i>>>30),r[n++]=c&1073741823}return i}function o$(e,t,r,n,i,a){for(var s=t&16383,u=t>>14;--a>=0;){var c=this[e]&16383,f=this[e++]>>14,d=u*c+f*s;c=s*c+((d&16383)<<14)+r[n]+i,i=(c>>28)+(d>>14)+u*f,r[n++]=c&268435455}return i}uy&&df.appName=="Microsoft Internet Explorer"?(ee.prototype.am=u$,Uu=30):uy&&df.appName!="Netscape"?(ee.prototype.am=a$,Uu=26):(ee.prototype.am=o$,Uu=28);ee.prototype.DB=Uu;ee.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function f$(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 Lu(e){var t=Bt();return t.fromInt(e),t}function h$(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,a=0;--n>=0;){var s=r==8?e[n]&255:fy(e,n);if(s<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,a==0?this[this.t++]=s:a+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-a):this[this.t-1]|=s<=this.DB&&(a-=this.DB)}r==8&&e[0]&128&&(this.s=-1,a>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function p$(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<0)for(u>u)>0&&(i=!0,a=Ga(n));s>=0;)u>(u+=this.DB-t)):(n=this[s]>>(u-=t)&r,u<=0&&(u+=this.DB,--s)),n>0&&(i=!0),i&&(a+=Ga(n));return i?a:"0"}function g$(){var e=Bt();return ee.ZERO.subTo(this,e),e}function m$(){return this.s<0?this.negate():this}function v$(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 z0(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 E$(){return this.t<=0?0:this.DB*(this.t-1)+z0(this[this.t-1]^this.s&this.DM)}function w$(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 A$(e,t){for(var r=e;r=0;--u)t[u+a+1]=this[u]>>n|s,s=(this[u]&i)<=0;--u)t[u]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function b$(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,a=(1<>n;for(var s=r+1;s>n;n>0&&(t[this.t-r-1]|=(this.s&a)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=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 _$(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=0;)e[r]=0;for(r=0;r=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 F$(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(c,a),i.lShiftTo(c,r)):(n.copyTo(a),i.copyTo(r));var f=a.t,d=a[f-1];if(d!=0){var g=d*(1<1?a[f-2]>>this.F2:0),p=this.FV/g,h=(1<=0&&(r[r.t++]=1,r.subTo(m,r)),ee.ONE.dlShiftTo(f,m),m.subTo(a,a);a.t=0;){var y=r[--v]==d?this.DM:Math.floor(r[v]*p+(r[v-1]+E)*h);if((r[v]+=a.am(0,y,r,b,0,f))0&&r.rShiftTo(c,r),s<0&&ee.ZERO.subTo(r,r)}}}function S$(e){var t=Bt();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(ee.ZERO)>0&&e.subTo(t,t),t}function xo(e){this.m=e}function I$(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function B$(e){return e}function $$(e){e.divRemTo(this.m,null,e)}function R$(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function x$(e,t){e.squareTo(t),this.reduce(t)}xo.prototype.convert=I$;xo.prototype.revert=B$;xo.prototype.reduce=$$;xo.prototype.mulTo=R$;xo.prototype.sqrTo=x$;function P$(){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 Po(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function T$(e){var t=Bt();return e.copyTo(t),this.reduce(t),t}function k$(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;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 N$(e,t){e.squareTo(t),this.reduce(t)}function L$(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Po.prototype.convert=O$;Po.prototype.revert=T$;Po.prototype.reduce=k$;Po.prototype.mulTo=L$;Po.prototype.sqrTo=N$;function U$(){return(this.t>0?this[0]&1:this.s)==0}function j$(e,t){if(e>4294967295||e<1)return ee.ONE;var r=Bt(),n=Bt(),i=t.convert(this),a=z0(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function H$(e,t){var r;return e<256||t.isEven()?r=new xo(t):r=new Po(t),this.exp(e,r)}ee.prototype.copyTo=l$;ee.prototype.fromInt=f$;ee.prototype.fromString=h$;ee.prototype.clamp=d$;ee.prototype.dlShiftTo=w$;ee.prototype.drShiftTo=A$;ee.prototype.lShiftTo=y$;ee.prototype.rShiftTo=b$;ee.prototype.subTo=C$;ee.prototype.multiplyTo=_$;ee.prototype.squareTo=D$;ee.prototype.divRemTo=F$;ee.prototype.invDigit=P$;ee.prototype.isEven=U$;ee.prototype.exp=j$;ee.prototype.toString=p$;ee.prototype.negate=g$;ee.prototype.abs=m$;ee.prototype.compareTo=v$;ee.prototype.bitLength=E$;ee.prototype.mod=S$;ee.prototype.modPowInt=H$;ee.ZERO=Lu(0);ee.ONE=Lu(1);function M$(){var e=Bt();return this.copyTo(e),e}function q$(){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)<>24}function K$(){return this.t==0?this.s:this[0]<<16>>16}function z$(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function G$(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Y$(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=Lu(r),i=Bt(),a=Bt(),s="";for(this.divRemTo(n,i,a);i.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,a);return a.intValue().toString(e)+s}function W$(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,a=0,s=0,u=0;u=r&&(this.dMultiply(n),this.dAddOffset(s,0),a=0,s=0)}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),i&&ee.ZERO.subTo(this,this)}function X$(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),Pg,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<0)for(r>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<=0;)r<8?(n=(this[e]&(1<>(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 Z$(e){return this.compareTo(e)==0}function Q$(e){return this.compareTo(e)<0?this:e}function eR(e){return this.compareTo(e)>0?this:e}function tR(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n>=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 fR(){for(var e=0;e=this.t?this.s!=0:(this[t]&1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=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 AR(e){var t=Bt();return this.addTo(e,t),t}function yR(e){var t=Bt();return this.subTo(e,t),t}function bR(e){var t=Bt();return this.multiplyTo(e,t),t}function CR(){var e=Bt();return this.squareTo(e),e}function _R(e){var t=Bt();return this.divRemTo(e,t,null),t}function DR(e){var t=Bt();return this.divRemTo(e,null,t),t}function FR(e){var t=Bt(),r=Bt();return this.divRemTo(e,t,r),new Array(t,r)}function SR(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function IR(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 gf(){}function py(e){return e}function BR(e,t,r){e.multiplyTo(t,r)}function $R(e,t){e.squareTo(t)}gf.prototype.convert=py;gf.prototype.revert=py;gf.prototype.mulTo=BR;gf.prototype.sqrTo=$R;function RR(e){return this.exp(e,new gf)}function xR(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=0;)r[n]=0;for(n=Math.max(t-this.t,0);n2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Bt();return e.copyTo(t),this.reduce(t),t}function TR(e){return e}function kR(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 NR(e,t){e.squareTo(t),this.reduce(t)}function LR(e,t,r){e.multiplyTo(t,r),this.reduce(r)}qc.prototype.convert=OR;qc.prototype.revert=TR;qc.prototype.reduce=kR;qc.prototype.mulTo=LR;qc.prototype.sqrTo=NR;function UR(e,t){var r=e.bitLength(),n,i=Lu(1),a;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?a=new xo(t):t.isEven()?a=new qc(t):a=new Po(t);var s=new Array,u=3,c=n-1,f=(1<1){var d=Bt();for(a.sqrTo(s[1],d);u<=f;)s[u]=Bt(),a.mulTo(d,s[u-2],s[u]),u+=2}var g=e.t-1,p,h=!0,E=Bt(),v;for(r=z0(e[g])-1;g>=0;){for(r>=c?p=e[g]>>r-c&f:(p=(e[g]&(1<0&&(p|=e[g-1]>>this.DB+r-c)),u=n;!(p&1);)p>>=1,--u;if((r-=u)<0&&(r+=this.DB,--g),h)s[p].copyTo(i),h=!1;else{for(;u>1;)a.sqrTo(i,E),a.sqrTo(E,i),u-=2;u>0?a.sqrTo(i,E):(v=i,i=E,E=v),a.mulTo(E,s[p],i)}for(;g>=0&&!(e[g]&1<0&&(t.rShiftTo(a,t),r.rShiftTo(a,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 a>0&&r.lShiftTo(a,r),r}function HR(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 MR(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return ee.ZERO;for(var r=e.clone(),n=this.clone(),i=Lu(1),a=Lu(0),s=Lu(0),u=Lu(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!a.isEven())&&(i.addTo(this,i),a.subTo(e,a)),i.rShiftTo(1,i)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;n.isEven();)n.rShiftTo(1,n),t?((!s.isEven()||!u.isEven())&&(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(s,i),a.subTo(u,a)):(n.subTo(r,n),t&&s.subTo(i,s),u.subTo(a,u))}if(n.compareTo(ee.ONE)!=0)return ee.ZERO;if(u.compareTo(e)>=0)return u.subtract(e);if(u.signum()<0)u.addTo(e,u);else return u;return u.signum()<0?u.add(e):u}var Yn=[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],qR=(1<<26)/Yn[Yn.length-1];function VR(e){var t,r=this.abs();if(r.t==1&&r[0]<=Yn[Yn.length-1]){for(t=0;t>1,e>Yn.length&&(e=Yn.length);for(var i=Bt(),a=0;a>8&255,Ti[en++]^=e>>16&255,Ti[en++]^=e>>24&255,en>=Ig&&(en-=Ig)}function Tg(){WR(new Date().getTime())}if(Ti==null){if(Ti=new Array,en=0,Lc!==void 0&&(Lc.crypto!==void 0||Lc.msCrypto!==void 0)){if(_g=Lc.crypto||Lc.msCrypto,_g.getRandomValues)for(Dg=new Uint8Array(32),_g.getRandomValues(Dg),ss=0;ss<32;++ss)Ti[en++]=Dg[ss];else if(df.appName=="Netscape"&&df.appVersion<"5")for(Fg=Lc.crypto.random(32),ss=0;ss>>8,Ti[en++]=ss&255;en=0,Tg()}var ss,_g,Dg,Fg;function XR(){if(H0==null){for(Tg(),H0=YR(),H0.init(Ti),en=0;en0&&t.length>0)this.n=di(e,16),this.e=parseInt(t,16);else throw"Invalid RSA public key"}function QR(e){return e.modPowInt(this.e,this.n)}et.prototype.doPublic=QR;et.prototype.setPublic=ZR;et.prototype.type="RSA";function ex(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=di(e,16),this.e=parseInt(t,16),this.d=di(r,16);else throw"Invalid RSA private key"}function tx(e,t,r,n,i,a,s,u){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=di(e,16),this.e=parseInt(t,16),this.d=di(r,16),this.p=di(n,16),this.q=di(i,16),this.dmp1=di(a,16),this.dmq1=di(s,16),this.coeff=di(u,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function rx(e,t){var r=new Vc,n=e>>1;this.e=parseInt(t,16);for(var i=new ee(t,16),a=e/2-100,s=ee.ONE.shiftLeft(a);;){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 u=this.p;this.p=this.q,this.q=u}var c=this.q.subtract(this.p).abs();if(!(c.bitLength()0;--f){i=i.twice();var d=r.testBit(f),g=t.testBit(f);d!=g&&(i=i.add(d?this:n))}for(f=s.bitLength()-2;f>0;--f){u=u.twice();var p=s.testBit(f),h=a.testBit(f);p!=h&&(u=u.add(p?u:c))}return i}function Ax(e,t,r){var n;e.bitLength()>r.bitLength()?n=e.bitLength()-1:n=r.bitLength()-1;for(var i=this.curve.getInfinity(),a=this.add(t);n>=0;)i=i.twice(),e.testBit(n)?r.testBit(n)?i=i.add(a):i=i.add(this):r.testBit(n)&&(i=i.add(t)),--n;return i}kt.prototype.getX=hx;kt.prototype.getY=dx;kt.prototype.equals=px;kt.prototype.isInfinity=gx;kt.prototype.negate=mx;kt.prototype.add=vx;kt.prototype.twice=Ex;kt.prototype.multiply=wx;kt.prototype.multiplyTwo=Ax;function Wa(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new kt(this,null,null)}function yx(){return this.q}function bx(){return this.a}function Cx(){return this.b}function _x(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function Dx(){return this.infinity}function Fx(e){return new Kr(this.q,e)}function Sx(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(),a=this.getB(),s=n.square().add(i).multiply(n).add(a),u=s.sqrt();return t=="03"&&(u=u.negate()),new kt(this,n,u);case 4:case 6:case 7:var c=(e.length-2)/2,f=e.substr(2,c),d=e.substr(c+2,c);return new kt(this,this.fromBigInteger(new ee(f,16)),this.fromBigInteger(new ee(d,16)));default:return null}}Wa.prototype.getQ=yx;Wa.prototype.getA=bx;Wa.prototype.getB=Cx;Wa.prototype.equals=_x;Wa.prototype.getInfinity=Dx;Wa.prototype.fromBigInteger=Fx;Wa.prototype.decodePointHex=Sx;Kr.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};kt.prototype.getEncoded=function(e){var t=function(a,s){var u=a.toByteArrayUnsigned();if(su.length;)u.unshift(0);return u},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};kt.decodeFrom=function(e,t){var r=t[0],n=t.length-1,i=t.slice(1,1+n/2),a=t.slice(1+n/2,1+n);i.unshift(0),a.unshift(0);var s=new ee(i),u=new ee(a);return new kt(e,e.fromBigInteger(s),e.fromBigInteger(u))};kt.decodeFromHex=function(e,t){var r=t.substr(0,2),n=t.length-2,i=t.substr(2,n/2),a=t.substr(2+n/2,n/2),s=new ee(i,16),u=new ee(a,16);return new kt(e,e.fromBigInteger(s),e.fromBigInteger(u))};kt.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),a=n.multiply(this.x.subtract(i)).subtract(this.y);return new kt(this.curve,i,a)};kt.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 kt(this.curve,n,i)};kt.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,a;for(a=r.bitLength()-2;a>0;--a){i=i.twice();var s=r.testBit(a),u=t.testBit(a);s!=u&&(i=i.add2D(s?this:n))}return i};kt.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(),a=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(i);return a.equals(s)};kt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};kt.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 gy=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"),a={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:` `,r:"\r",t:" "};function s(g,p,h){return p?a[p]:String.fromCharCode(parseInt(h,16))}var u=new String(""),c="\\",f={"{":Object,"[":Array},d=Object.hasOwnProperty;return function(g,p){var h=g.match(n),E,v=h[0],b=!1;v==="{"?E={}:v==="["?E=[]:(E=[],b=!0);for(var m,y=[E],D=1-b,_=h.length;D<_;++D){v=h[D];var F;switch(v.charCodeAt(0)){default:F=y[0],F[m||F.length]=+v,m=void 0;break;case 34:if(v=v.substring(1,v.length-1),v.indexOf(c)!==-1&&(v=v.replace(i,s)),F=y[0],!m)if(F instanceof Array)m=F.length;else{m=v||u;break}F[m]=v,m=void 0;break;case 91:F=y[0],y.unshift(F[m||F.length]=[]),m=void 0;break;case 93:y.shift();break;case 102:F=y[0],F[m||F.length]=!1,m=void 0;break;case 110:F=y[0],F[m||F.length]=null,m=void 0;break;case 116:F=y[0],F[m||F.length]=!0,m=void 0;break;case 123:F=y[0],y.unshift(F[m||F.length]={}),m=void 0;break;case 125:y.shift();break}}if(b){if(y.length!==1)throw new Error;E=E[0]}else if(y.length)throw new Error;if(p){var L=function(k,S){var B=k[S];if(B&&typeof B=="object"){var O=null;for(var x in B)if(d.call(B,x)&&B!==k){var U=L(B,x);U!==void 0?B[x]=U:(O||(O=[]),O.push(x))}if(O)for(var Y=O.length;--Y>=0;)delete B[O[Y]]}return p.call(k,S,B)};E=L({"":E},"")}return E}}();(typeof w>"u"||!w)&&(w={});(typeof w.asn1>"u"||!w.asn1)&&(w.asn1={});w.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 vf(e)},this.getPEMStringFromHex=function(e,t){return Bn(e,t)},this.newObject=function(e){var t=w,r=t.asn1,n=r.ASN1Object,i=r.DERBoolean,a=r.DERInteger,s=r.DERBitString,u=r.DEROctetString,c=r.DERNull,f=r.DERObjectIdentifier,d=r.DEREnumerated,g=r.DERUTF8String,p=r.DERNumericString,h=r.DERPrintableString,E=r.DERTeletexString,v=r.DERIA5String,b=r.DERUTCTime,m=r.DERGeneralizedTime,y=r.DERVisibleString,D=r.DERBMPString,_=r.DERSequence,F=r.DERSet,L=r.DERTaggedObject,k=r.ASN1Util.newObject;if(e instanceof r.ASN1Object)return e;var S=Object.keys(e);if(S.length!=1)throw new Error("key of param shall be only one.");var B=S[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+B+":")==-1)throw new Error("undefined key: "+B);if(B=="bool")return new i(e[B]);if(B=="int")return new a(e[B]);if(B=="bitstr")return new s(e[B]);if(B=="octstr")return new u(e[B]);if(B=="null")return new c(e[B]);if(B=="oid")return new f(e[B]);if(B=="enum")return new d(e[B]);if(B=="utf8str")return new g(e[B]);if(B=="numstr")return new p(e[B]);if(B=="prnstr")return new h(e[B]);if(B=="telstr")return new E(e[B]);if(B=="ia5str")return new v(e[B]);if(B=="utctime")return new b(e[B]);if(B=="gentime")return new m(e[B]);if(B=="visstr")return new y(e[B]);if(B=="bmpstr")return new D(e[B]);if(B=="asn1")return new n(e[B]);if(B=="seq"){for(var O=e[B],x=[],U=0;U"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="+a.length+",v="+this.hV);var s=this.hV.length/2,u=s.toString(16);if(u.length%2==1&&(u="0"+u),s<128)return u;var c=u.length/2;if(c>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+s.toString(16));var f=128+c;return f.toString(16)+u},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)};w.asn1.DERAbstractString=function(e){w.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=Y0(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))};pe(w.asn1.DERAbstractString,w.asn1.ASN1Object);w.asn1.DERAbstractTime=function(e){w.asn1.DERAbstractTime.superclass.constructor.call(this);var t=null,r=null;this.localDateToUTC=function(n){var i=n.getTime()+n.getTimezoneOffset()*6e4,a=new Date(i);return a},this.formatDate=function(n,i,a){var s=this.zeroPadding,u=this.localDateToUTC(n),c=String(u.getFullYear());i=="utc"&&(c=c.substr(2,2));var f=s(String(u.getMonth()+1),2),d=s(String(u.getDate()),2),g=s(String(u.getHours()),2),p=s(String(u.getMinutes()),2),h=s(String(u.getSeconds()),2),E=c+f+d+g+p+h;if(a===!0){var v=u.getMilliseconds();if(v!=0){var b=s(String(v),3);b=b.replace(/[0]+$/,""),E=E+"."+b}}return E+"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,a,s,u,c){var f=new Date(Date.UTC(n,i-1,a,s,u,c,0));this.setByDate(f)},this.getFreshValueHex=function(){return this.hV}};pe(w.asn1.DERAbstractTime,w.asn1.ASN1Object);w.asn1.DERAbstractStructured=function(e){w.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)};pe(w.asn1.DERAbstractStructured,w.asn1.ASN1Object);w.asn1.DERBoolean=function(e){w.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",e==!1?this.hTLV="010100":this.hTLV="0101ff"};pe(w.asn1.DERBoolean,w.asn1.ASN1Object);w.asn1.DERInteger=function(e){w.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=vf;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)};pe(w.asn1.DERInteger,w.asn1.ASN1Object);w.asn1.DERBitString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=w.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}w.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=a)break}return n};be.getNthChildIdx=function(e,t,r){var n=be.getChildIdx(e,t);return n[r]};be.getIdxbyList=function(e,t,r,n){var i=be,a,s;return r.length==0?n!==void 0&&e.substr(t,2)!==n?-1:t:(a=r.shift(),s=i.getChildIdx(e,t),a>=s.length?-1:i.getIdxbyList(e,s[a],r,n))};be.getIdxbyListEx=function(e,t,r,n){var i=be,a,s;if(r.length==0)return n!==void 0&&e.substr(t,2)!==n?-1:t;a=r.shift(),s=i.getChildIdx(e,t);for(var u=0,c=0;c=e.length?null:i.getTLV(e,a)};be.getTLVbyListEx=function(e,t,r,n){var i=be,a=i.getIdxbyListEx(e,t,r,n);return a==-1?null:i.getTLV(e,a)};be.getVbyList=function(e,t,r,n,i){var a=be,s,u;return s=a.getIdxbyList(e,t,r,n),s==-1||s>=e.length?null:(u=a.getV(e,s),i===!0&&(u=u.substr(2)),u)};be.getVbyListEx=function(e,t,r,n,i){var a=be,s,u,c;return s=a.getIdxbyListEx(e,t,r,n),s==-1?null:(c=a.getV(e,s),e.substr(s,2)=="03"&&i!==!1&&(c=c.substr(2)),c)};be.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=be.getV(e,t);return n=="02"?parseInt(i,16):_y(i)}catch{return r}};be.getOID=function(e,t,r){r==null&&(r=null);try{if(e.substr(t,2)!="06")return r;var n=be.getV(e,t);return Q0(n)}catch{return r}};be.getOIDName=function(e,t,r){r==null&&(r=null);try{var n=be.getOID(e,t,r);if(n==r)return r;var i=w.asn1.x509.OID.oid2name(n);return i==""?n:i}catch{return r}};be.getString=function(e,t,r){r==null&&(r=null);try{var n=be.getV(e,t);return gi(n)}catch{return r}};be.hextooidstr=function(e){var t=function(g,p){return g.length>=p?g:new Array(p-g.length+1).join("0")+g},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 a=e.substr(2),s=[],u=0;u0&&(d=d+"."+c.join(".")),d};be.dump=function(e,t,r,n){var i=be,a=i.getV,s=i.dump,u=i.getChildIdx,c=e;e instanceof w.asn1.ASN1Object&&(c=e.tohex());var f=function(k,S){if(k.length<=S*2)return k;var B=k.substr(0,S)+"..(total "+k.length/2+"bytes).."+k.substr(k.length-S,S);return B};t===void 0&&(t={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var d=t.ommit_long_octet,F=c.substr(r,2);if(F=="01"){var g=a(c,r);return g=="00"?n+`BOOLEAN FALSE `:n+`BOOLEAN TRUE `}if(F=="02"){var g=a(c,r);return n+"INTEGER "+f(g,d)+` `}if(F=="03"){var g=a(c,r);if(i.isASN1HEX(g.substr(2))){var p=n+`BITSTRING, encapsulates `;return p=p+s(g.substr(2),t,0,n+" "),p}else return n+"BITSTRING "+f(g,d)+` `}if(F=="04"){var g=a(c,r);if(i.isASN1HEX(g)){var p=n+`OCTETSTRING, encapsulates `;return p=p+s(g,t,0,n+" "),p}else return n+"OCTETSTRING "+f(g,d)+` `}if(F=="05")return n+`NULL `;if(F=="06"){var h=a(c,r),E=w.asn1.ASN1Util.oidHexToInt(h),v=w.asn1.x509.OID.oid2name(E),b=E.replace(/\./g," ");return v!=""?n+"ObjectIdentifier "+v+" ("+b+`) `:n+"ObjectIdentifier ("+b+`) `}if(F=="0a")return n+"ENUMERATED "+parseInt(a(c,r))+` `;if(F=="0c")return n+"UTF8String '"+Vt(a(c,r))+`' `;if(F=="13")return n+"PrintableString '"+Vt(a(c,r))+`' `;if(F=="14")return n+"TeletexString '"+Vt(a(c,r))+`' `;if(F=="16")return n+"IA5String '"+Vt(a(c,r))+`' `;if(F=="17")return n+"UTCTime "+Vt(a(c,r))+` `;if(F=="18")return n+"GeneralizedTime "+Vt(a(c,r))+` `;if(F=="1a")return n+"VisualString '"+Vt(a(c,r))+`' `;if(F=="1e")return n+"BMPString '"+Ug(a(c,r))+`' `;if(F=="30"){if(c.substr(r,4)=="3000")return n+`SEQUENCE {} `;var p=n+`SEQUENCE `,m=u(c,r),y=t;if((m.length==2||m.length==3)&&c.substr(m[0],2)=="06"&&c.substr(m[m.length-1],2)=="04"){var v=i.oidname(a(c,m[0])),D=JSON.parse(JSON.stringify(t));D.x509ExtName=v,y=D}for(var _=0;_4?{enum:{hex:m}}:{enum:parseInt(m,16)};if(v=="30"||v=="31")return b[h[v]]=E(e),b;if(v=="14"){var L=p(m);return b[h[v]]={str:L},b}else if(v=="1e"){var L=g(m);return b[h[v]]={str:L},b}else if(":0c:12:13:16:17:18:1a:".indexOf(v)!=-1){var L=d(m);return b[h[v]]={str:L},b}else if(v.match(/^8[0-9]$/)){var L=d(m);return L==null|L==""?{tag:{tag:v,explicit:!1,hex:m}}:L.match(/[\x00-\x1F\x7F-\x9F]/)!=null||L.match(/[\u0000-\u001F\u0080–\u009F]/)!=null?{tag:{tag:v,explicit:!1,hex:m}}:{tag:{tag:v,explicit:!1,str:L}}}else if(v.match(/^a[0-9]$/))try{if(!n(m))throw new Error("not encap");return{tag:{tag:v,explicit:!0,obj:r(m)}}}catch{return{tag:{tag:v,explicit:!0,hex:m}}}else{var k=new w.asn1.ASN1Object;k.hV=m;var S=k.getLengthHexFromValue();return{asn1:{tlv:v+S+m}}}}}};be.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}};be.isASN1HEX=function(e){var t=be;if(e.length%2==1)return!1;var r=t.getVblen(e,0),n=e.substr(0,2),i=t.getL(e,0),a=e.length-n.length-i.length;return a==r*2};be.checkStrictDER=function(e,t,r,n,i){var a=be;if(r===void 0){if(typeof e!="string")throw new Error("not hex string");if(e=e.toLowerCase(),!w.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=a.getL(e,t);if(s.length>i*2)throw new Error("L of TLV too long: idx="+t);var u=a.getVblen(e,t);if(u>n)throw new Error("value of L too long than hex: idx="+t);var c=a.getTLV(e,t),f=c.length-2-a.getL(e,t).length;if(f!==u*2)throw new Error("V string length and L's value not the same:"+f+"/"+u*2);if(t===0&&e.length!=c.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+c.length);var d=e.substr(t,2);if(d==="02"){var g=a.getVidx(e,t);if(e.substr(g,2)=="00"&&e.charCodeAt(g+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(d,16)&32){for(var p=a.getVblen(e,t),h=0,E=a.getChildIdx(e,t),v=0;v"u"||!w)&&(w={});(typeof w.asn1>"u"||!w.asn1)&&(w.asn1={});(typeof w.asn1.x509>"u"||!w.asn1.x509)&&(w.asn1.x509={});w.asn1.x509.Certificate=function(e){w.asn1.x509.Certificate.superclass.constructor.call(this);var t=w,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.x509,s=a.TBSCertificate,u=a.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(c){this.params=c},this.sign=function(){var c=this.params,f=c.sigalg;c.sigalg.name!=null&&(f=c.sigalg.name);var d=c.tbsobj.tohex(),g=new w.crypto.Signature({alg:f});g.init(c.cakey),g.updateHex(d),c.sighex=g.sign()},this.getPEM=function(){return Bn(this.tohex(),"CERTIFICATE")},this.tohex=function(){var c=this.params;if((c.tbsobj==null||c.tbsobj==null)&&(c.tbsobj=new s(c)),c.sighex==null&&c.cakey!=null&&this.sign(),c.sighex==null)throw new Error("sighex or cakey parameter not defined");var f=[];f.push(c.tbsobj),f.push(new u({name:c.sigalg})),f.push(new n({hex:"00"+c.sighex}));var d=new i({array:f});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};pe(w.asn1.x509.Certificate,w.asn1.ASN1Object);w.asn1.x509.TBSCertificate=function(e){w.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=w,r=t.asn1,n=r.x509,i=r.DERTaggedObject,a=r.DERInteger,s=r.DERSequence,u=n.AlgorithmIdentifier,c=n.Time,f=n.X500Name,d=n.Extensions,g=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(p){this.params=p},this.tohex=function(){var p=[],h=this.params;if(h.version!=null||h.version!=1){var E=2;h.version!=null&&(E=h.version-1);var v=new i({obj:new a({int:E})});p.push(v)}p.push(new a(h.serial)),p.push(new u({name:h.sigalg})),p.push(new f(h.issuer)),p.push(new s({array:[new c(h.notbefore),new c(h.notafter)]})),p.push(new f(h.subject)),p.push(new g(At.getKey(h.sbjpubkey))),h.ext!==void 0&&h.ext.length>0&&p.push(new i({tag:"a3",obj:new d(h.ext)}));var b=new w.asn1.DERSequence({array:p});return b.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(w.asn1.x509.TBSCertificate,w.asn1.ASN1Object);w.asn1.x509.Extensions=function(e){w.asn1.x509.Extensions.superclass.constructor.call(this);var t=w,r=t.asn1,n=r.DERSequence,i=r.x509;this.aParam=[],this.setByParam=function(a){this.aParam=a},this.tohex=function(){for(var a=[],s=0;s-1&&u.push(new n({int:this.pathLen}));var c=new i({array:u});return this.asn1ExtnValue=c,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))};pe(w.asn1.x509.BasicConstraints,w.asn1.x509.Extension);w.asn1.x509.CRLDistributionPoints=function(e){w.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=w,r=t.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var a=[],s=0;s0&&a.push(new r({array:s}))}var c=new r({array:a});return c.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(w.asn1.x509.PolicyInformation,w.asn1.ASN1Object);w.asn1.x509.PolicyQualifierInfo=function(e){w.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=w.asn1,r=t.DERSequence,n=t.DERIA5String,i=t.DERObjectIdentifier,a=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 a(this.params.unotice)]});return s.tohex()}},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(w.asn1.x509.PolicyQualifierInfo,w.asn1.ASN1Object);w.asn1.x509.UserNotice=function(e){w.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=w.asn1.DERSequence,r=w.asn1.DERInteger,n=w.asn1.x509.DisplayText,i=w.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var a=[];this.params.noticeref!==void 0&&a.push(new i(this.params.noticeref)),this.params.exptext!==void 0&&a.push(new n(this.params.exptext));var s=new t({array:a});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(w.asn1.x509.UserNotice,w.asn1.ASN1Object);w.asn1.x509.NoticeReference=function(e){w.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=w.asn1.DERSequence,r=w.asn1.DERInteger,n=w.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 a=[],s=this.params.noticenum,u=0;u0)for(var s=0;s0;i++){var a=t.shift();if(r===!0){var s=n.pop(),u=(s+","+a).replace(/\\,/g,",");n.push(u),r=!1}else n.push(a);a.substr(-1,1)==="\\"&&(r=!0)}return n=n.map(function(c){return c.replace("/","\\/")}),n.reverse(),"/"+n.join("/")};w.asn1.x509.X500Name.ldapToOneline=function(e){return w.asn1.x509.X500Name.ldapToCompat(e)};w.asn1.x509.RDN=function(e){w.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=w.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 w.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=w.asn1.x509.RDN.parseString(r),i=0;i0)for(var r=0;r0;i++){var a=t.shift();if(r===!0){var s=n.pop(),u=(s+"+"+a).replace(/\\\+/g,"+");n.push(u),r=!1}else n.push(a);a.substr(-1,1)==="\\"&&(r=!0)}for(var c=!1,f=[],i=0;n.length>0;i++){var a=n.shift();if(c===!0){var d=f.pop();if(a.match(/"$/)){var u=(d+"+"+a).replace(/^([^=]+)="(.*)"$/,"$1=$2");f.push(u),c=!1}else f.push(d+"+"+a)}else f.push(a);a.match(/^[^=]+="/)&&(c=!0)}return f};w.asn1.x509.AttributeTypeAndValue=function(e){w.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=w,r=t.asn1,n=r.DERSequence,i=r.DERUTF8String,a=r.DERPrintableString,s=r.DERTeletexString,u=r.DERIA5String,c=r.DERVisibleString,f=r.DERBMPString,d=t.lang.String.isMail,g=t.lang.String.isPrintable;this.setByParam=function(p){if(p.rule!==void 0&&(this.sRule=p.rule),p.ds!==void 0&&(this.dsType=p.ds),p.value===void 0&&p.str!==void 0){var h=p.str,E=h.match(/^([^=]+)=(.+)$/);if(E)this.sType=E[1],this.sValue=E[2];else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)}else this.sType=p.type,this.sValue=p.value},this.setByString=function(p,h){h!==void 0&&(this.sRule=h);var E=p.match(/^([^=]+)=(.+)$/);if(E)this.setByAttrTypeAndValueStr(E[1],E[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var p=this.sType,h=this.sValue,E=this.sRule;return E==="prn"?p=="CN"&&d(h)?"ia5":g(h)?"prn":"utf8":E==="utf8"?p=="CN"&&d(h)?"ia5":p=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(p,h,E){E!==void 0&&(this.sRule=E),this.sType=p,this.sValue=h},this.getValueObj=function(p,h){if(p=="utf8")return new i({str:h});if(p=="prn")return new a({str:h});if(p=="tel")return new s({str:h});if(p=="ia5")return new u({str:h});if(p=="vis")return new c({str:h});if(p=="bmp")return new f({str:h});throw new Error("unsupported directory string type: type="+p+" value="+h)},this.tohex=function(){this.dsType==null&&(this.dsType=this._getDsType());var p=w.asn1.x509.OID.atype2obj(this.sType),h=this.getValueObj(this.dsType,this.sValue),E=new n({array:[p,h]});return this.TLV=E.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(w.asn1.x509.AttributeTypeAndValue,w.asn1.ASN1Object);w.asn1.x509.SubjectPublicKeyInfo=function(e){w.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=null,r=null,n=w,i=n.asn1,a=i.DERInteger,s=i.DERBitString,u=i.DERObjectIdentifier,c=i.DERSequence,f=i.ASN1Util.newObject,d=i.x509,g=d.AlgorithmIdentifier,p=n.crypto,h=p.ECDSA,E=p.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var v=new c({array:[this.asn1AlgId,this.asn1SubjPKey]});return v},this.tohex=function(){var v=this.getASN1Object();return this.hTLV=v.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(v){try{if(v instanceof et){var b=f({seq:[{int:{bigint:v.n}},{int:{int:v.e}}]}),m=b.tohex();this.asn1AlgId=new g({name:"rsaEncryption"}),this.asn1SubjPKey=new s({hex:"00"+m})}}catch{}try{if(v instanceof w.crypto.ECDSA){var y=new u({name:v.curveName});this.asn1AlgId=new g({name:"ecPublicKey",asn1params:y}),this.asn1SubjPKey=new s({hex:"00"+v.pubKeyHex})}}catch{}try{if(v instanceof w.crypto.DSA){var y=new f({seq:[{int:{bigint:v.p}},{int:{bigint:v.q}},{int:{bigint:v.g}}]});this.asn1AlgId=new g({name:"dsa",asn1params:y});var D=new a({bigint:v.y});this.asn1SubjPKey=new s({hex:"00"+D.tohex()})}}catch{}},e!==void 0&&this.setPubKey(e)};pe(w.asn1.x509.SubjectPublicKeyInfo,w.asn1.ASN1Object);w.asn1.x509.Time=function(e){w.asn1.x509.Time.superclass.constructor.call(this);var t=null,r=null,n=w,i=n.asn1,a=i.DERUTCTime,s=i.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(u){this.timeParams=u},this.setByParam=function(u){this.params=u},this.getType=function(u){return u.match(/^[0-9]{12}Z$/)?"utc":u.match(/^[0-9]{14}Z$/)?"gen":u.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":u.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var u=this.params,c=null;if(typeof u=="string"&&(u={str:u}),u!=null&&u.str&&(u.type==null||u.type==null)&&(u.type=this.getType(u.str)),u!=null&&u.str?(u.type=="utc"&&(c=new a(u.str)),u.type=="gen"&&(c=new s(u.str))):this.type=="gen"?c=new s:c=new a,c==null)throw new Error("wrong setting for Time");return this.TLV=c.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};w.asn1.x509.Time_bak=function(e){w.asn1.x509.Time_bak.superclass.constructor.call(this);var t=null,r=null,n=w,i=n.asn1,a=i.DERUTCTime,s=i.DERGeneralizedTime;this.setTimeParams=function(u){this.timeParams=u},this.tohex=function(){var u=null;return this.timeParams!=null?this.type=="utc"?u=new a(this.timeParams):u=new s(this.timeParams):this.type=="utc"?u=new a:u=new s,this.TLV=u.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)};pe(w.asn1.x509.Time,w.asn1.ASN1Object);w.asn1.x509.AlgorithmIdentifier=function(e){w.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=w,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 a=null;for(var s in n)s===this.nameAlg&&(a=n[s]);if(a!==null)return this.hTLV=a,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=r.x509.OID.name2obj(this.nameAlg));var u=[this.asn1Alg];this.asn1Params!==null&&u.push(this.asn1Params);var c=new r.DERSequence({array:u});return this.hTLV=c.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)}};pe(w.asn1.x509.AlgorithmIdentifier,w.asn1.ASN1Object);w.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};w.asn1.x509.GeneralName=function(e){w.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87",otherName:"a0"},r=w,n=r.asn1,i=n.x509,a=i.X500Name,s=i.OtherName,u=n.DERIA5String,c=n.DERPrintableString,f=n.DEROctetString,d=n.DERTaggedObject,g=n.ASN1Object,p=Error;this.params=null,this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,E,b,v,b=!1;if(h.other!==void 0)E="a0",v=new s(h.other);else if(h.rfc822!==void 0)E="81",v=new u({str:h.rfc822});else if(h.dns!==void 0)E="82",v=new u({str:h.dns});else if(h.dn!==void 0)E="a4",b=!0,typeof h.dn=="string"?v=new a({str:h.dn}):h.dn instanceof w.asn1.x509.X500Name?v=h.dn:v=new a(h.dn);else if(h.ldapdn!==void 0)E="a4",b=!0,v=new a({ldapstr:h.ldapdn});else if(h.certissuer!==void 0||h.certsubj!==void 0){E="a4",b=!0;var m,y,D=null;if(h.certsubj!==void 0?(m=!1,y=h.certsubj):(m=!0,y=h.certissuer),y.match(/^[0-9A-Fa-f]+$/)&&D==y,y.indexOf("-----BEGIN ")!=-1&&(D=mr(y)),D==null)throw new Error("certsubj/certissuer not cert");var _=new Ge;_.hex=D;var F;m?F=_.getIssuerHex():F=_.getSubjectHex(),v=new g,v.hTLV=F}else if(h.uri!==void 0)E="86",v=new u({str:h.uri});else if(h.ip!==void 0){E="87";var L,k=h.ip;try{if(k.match(/^[0-9a-f]+$/)){var S=k.length;if(S==8||S==16||S==32||S==64)L=k;else throw"err"}else L=Lg(k)}catch(O){throw new p("malformed IP address: "+h.ip+":"+O.message)}v=new f({hex:L})}else throw new p("improper params");var B=new d({tag:E,explicit:b,obj:v});return B.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(w.asn1.x509.GeneralName,w.asn1.ASN1Object);w.asn1.x509.GeneralNames=function(e){w.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,r=w,n=r.asn1;this.setByParamArray=function(i){for(var a=0;a"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,a){var s=this[n];if(!s.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch{return!1}}};w.asn1.x509.OID.oid2name=function(e){var t=w.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""};w.asn1.x509.OID.oid2atype=function(e){var t=w.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e};w.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=w.asn1.x509.OID.name2oidList;return t[e]===void 0?"":t[e]};w.asn1.x509.X509Util={};w.asn1.x509.X509Util.newCertPEM=function(e){var t=w.asn1.x509,r=t.TBSCertificate,n=t.Certificate,i=new n(e);return i.getPEM()};(typeof w>"u"||!w)&&(w={});(typeof w.asn1>"u"||!w.asn1)&&(w.asn1={});(typeof w.asn1.cms>"u"||!w.asn1.cms)&&(w.asn1.cms={});w.asn1.cms.Attribute=function(e){var t=Error,r=w,n=r.asn1,i=n.DERSequence,a=n.DERSet,s=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(u){this.params=u},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var u=new s({oid:this.typeOid}),c=new a({array:this.getValueArray()}),f=new i({array:[u,c]});return f.tohex()},this.getEncodedHex=function(){return this.tohex()}};pe(w.asn1.cms.Attribute,w.asn1.ASN1Object);w.asn1.cms.ContentType=function(e){var t=w,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)};pe(w.asn1.cms.ContentType,w.asn1.cms.Attribute);w.asn1.cms.MessageDigest=function(e){var t=w,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 a=new n(this.params);return[a]},e!=null&&this.setByParam(e)};pe(w.asn1.cms.MessageDigest,w.asn1.cms.Attribute);w.asn1.cms.SigningTime=function(e){var t=w,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)};pe(w.asn1.cms.SigningTime,w.asn1.cms.Attribute);w.asn1.cms.SigningCertificate=function(e){var t=Error,r=w,n=r.asn1,i=n.DERSequence,a=n.cms,s=a.ESSCertID,u=r.crypto;a.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 c=this.params.array,f=[],d=0;d0){for(var E=a(p.valhex,h[0]),v=g(E,0),b=[],m=0;m1){var _=a(p.valhex,h[1]);p.polhex=_}delete p.valhex},this.setSignaturePolicyIdentifier=function(p){var h=g(p.valhex,0);if(h.length>0){var E=n.getOID(p.valhex,h[0]);p.oid=E}if(h.length>1){var v=new t,b=g(p.valhex,h[1]),m=a(p.valhex,b[0]),y=v.getAlgorithmIdentifierName(m);p.alg=y;var D=i(p.valhex,b[1]);p.hash=D}delete p.valhex},this.setSigningCertificateV2=function(p){var h=g(p.valhex,0);if(h.length>0){for(var E=a(p.valhex,h[0]),v=g(E,0),b=[],m=0;m1){var _=a(p.valhex,h[1]);p.polhex=_}delete p.valhex},this.getESSCertID=function(p){var h={},E=g(p,0);if(E.length>0){var v=i(p,E[0]);h.hash=v}if(E.length>1){var b=a(p,E[1]),m=this.getIssuerSerial(b);m.serial!=null&&(h.serial=m.serial),m.issuer!=null&&(h.issuer=m.issuer)}return h},this.getESSCertIDv2=function(p){var h={},E=g(p,0);if(E.length<1||3v+1){var y=a(p,E[v+1]),D=this.getIssuerSerial(y);h.issuer=D.issuer,h.serial=D.serial}return h},this.getIssuerSerial=function(p){var h={},E=g(p,0),v=a(p,E[0]),b=r.getGeneralNames(v),m=b[0].dn;h.issuer=m;var y=i(p,E[1]);return h.serial={hex:y},h},this.getCertificateSet=function(p){for(var h=g(p,0),E=[],v=0;v"u"||!w)&&(w={});(typeof w.asn1>"u"||!w.asn1)&&(w.asn1={});(typeof w.asn1.tsp>"u"||!w.asn1.tsp)&&(w.asn1.tsp={});w.asn1.tsp.TimeStampToken=function(e){var t=w,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)};pe(w.asn1.tsp.TimeStampToken,w.asn1.cms.SignedData);w.asn1.tsp.TSTInfo=function(e){var t=Error,r=w,n=r.asn1,i=n.DERSequence,a=n.DERInteger,s=n.DERBoolean,u=n.DERGeneralizedTime,c=n.DERObjectIdentifier,f=n.DERTaggedObject,d=n.tsp,g=d.MessageImprint,p=d.Accuracy,h=n.x509.X500Name,E=n.x509.GeneralName;if(d.TSTInfo.superclass.constructor.call(this),this.dVersion=new a({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 v=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(v.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(v.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(v.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");v.push(this.dGenTime),this.dAccuracy!=null&&v.push(this.dAccuracy),this.dOrdering!=null&&v.push(this.dOrdering),this.dNonce!=null&&v.push(this.dNonce),this.dTsa!=null&&v.push(this.dTsa);var b=new i({array:v});return this.hTLV=b.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 c({oid:e.policy})}e.messageImprint!==void 0&&(this.dMessageImprint=new g(e.messageImprint)),e.serial!==void 0&&(this.dSerial=new a(e.serial)),e.genTime!==void 0&&(this.dGenTime=new u(e.genTime)),e.accuracy!==void 0&&(this.dAccuracy=new p(e.accuracy)),e.ordering!==void 0&&e.ordering==!0&&(this.dOrdering=new s),e.nonce!==void 0&&(this.dNonce=new a(e.nonce)),e.tsa!==void 0&&(this.dTsa=new f({tag:"a0",explicit:!0,obj:new E({dn:e.tsa})}))}};pe(w.asn1.tsp.TSTInfo,w.asn1.ASN1Object);w.asn1.tsp.Accuracy=function(e){var t=w,r=t.asn1,n=r.ASN1Util.newObject;r.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var i=this.params,a=[];return i.seconds!=null&&typeof i.seconds=="number"&&a.push({int:i.seconds}),i.millis!=null&&typeof i.millis=="number"&&a.push({tag:{tagi:"80",obj:{int:i.millis}}}),i.micros!=null&&typeof i.micros=="number"&&a.push({tag:{tagi:"81",obj:{int:i.micros}}}),n({seq:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(w.asn1.tsp.Accuracy,w.asn1.ASN1Object);w.asn1.tsp.MessageImprint=function(e){var t=w,r=t.asn1,n=r.DERSequence,i=r.DEROctetString,a=r.x509,s=a.AlgorithmIdentifier;r.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,c=new s({name:u.alg}),f=new i({hex:u.hash}),d=new n({array:[c,f]});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(w.asn1.tsp.MessageImprint,w.asn1.ASN1Object);w.asn1.tsp.TimeStampReq=function(e){var t=w,r=t.asn1,n=r.DERSequence,i=r.DERInteger,a=r.DERBoolean,s=r.ASN1Object,u=r.DERObjectIdentifier,c=r.tsp,f=c.MessageImprint;c.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params,g=[];g.push(new i({int:1})),d.messageImprint instanceof w.asn1.ASN1Object?g.push(d.messageImprint):g.push(new f(d.messageImprint)),d.policy!=null&&g.push(new u(d.policy)),d.nonce!=null&&g.push(new i(d.nonce)),d.certreq==!0&&g.push(new a);var p=new n({array:g});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(w.asn1.tsp.TimeStampReq,w.asn1.ASN1Object);w.asn1.tsp.TimeStampResp=function(e){var t=w,r=t.asn1,n=r.DERSequence,i=r.ASN1Object,a=r.tsp,s=a.PKIStatusInfo;a.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,c=[];if(u.econtent!=null||u.tst!=null)if(u.statusinfo!=null?c.push(new s(u.statusinfo)):c.push(new s("granted")),u.econtent!=null)c.push(new a.TimeStampToken(u).getContentInfo());else if(u.tst instanceof r.ASN1Object)c.push(u.tst);else throw new Error("improper member tst value");else if(u.statusinfo!=null)c.push(new s(u.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var f=new n({array:c});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(w.asn1.tsp.TimeStampResp,w.asn1.ASN1Object);w.asn1.tsp.PKIStatusInfo=function(e){var t=Error,r=w,n=r.asn1,i=n.DERSequence,a=n.tsp,s=a.PKIStatus,u=a.PKIFreeText,c=a.PKIFailureInfo;a.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params,d=[];if(typeof f=="string")d.push(new s(f));else{if(f.status==null)throw new t("property 'status' unspecified");d.push(new s(f.status)),f.statusstr!=null&&d.push(new u(f.statusstr)),f.failinfo!=null&&d.push(new c(f.failinfo))}var g=new i({array:d});return g.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(w.asn1.tsp.PKIStatusInfo,w.asn1.ASN1Object);w.asn1.tsp.PKIStatus=function(e){var t=Error,r=w,n=r.asn1,i=n.DERInteger,a=n.tsp;a.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 u=this.params,c,f;if(typeof u=="string")try{f=s[u]}catch{throw new t("undefined name: "+u)}else if(typeof u=="number")f=u;else throw new t("unsupported params");return new i({int:f}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(w.asn1.tsp.PKIStatus,w.asn1.ASN1Object);w.asn1.tsp.PKIFreeText=function(e){var t=Error,r=w,n=r.asn1,i=n.DERSequence,a=n.DERUTF8String,s=n.tsp;s.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params;if(!u instanceof Array)throw new t("wrong params: not array");for(var c=[],f=0;f=0;p--)g+=d[p];return g}else{if(typeof c=="string"&&u[c]!=null)return V0([c],u);if(typeof c=="object"&&c.length!=null)return V0(c,u);throw new t("wrong params")}},this.tohex=function(){var c=this.params,f=this.getBinValue();return new i({bin:f}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(w.asn1.tsp.PKIFailureInfo,w.asn1.ASN1Object);w.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(t,r){throw"not implemented yet"}};w.asn1.tsp.SimpleTSAAdapter=function(e){var t=w,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(a,s){var u=i(a,s);this.params.econtent.content.messageImprint={alg:s,hash:u},this.params.econtent.content.serial={int:this.serial++};var c=Math.floor(Math.random()*1e9);this.params.econtent.content.nonce={int:c};var f=new n.TimeStampToken(this.params);return f.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};pe(w.asn1.tsp.SimpleTSAAdapter,w.asn1.tsp.AbstractTSAAdapter);w.asn1.tsp.FixedTSAAdapter=function(e){var t=w,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(a,s){var u=i(a,s);this.params.econtent.content.messageImprint={alg:s,hash:u};var c=new n.TimeStampToken(this.params);return c.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};pe(w.asn1.tsp.FixedTSAAdapter,w.asn1.tsp.AbstractTSAAdapter);w.asn1.tsp.TSPUtil=new function(){};w.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new w.asn1.tsp.TimeStampToken(e)};w.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=new w.asn1.tsp.TSPParser;return t.getTimeStampReq(e)};w.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=new w.asn1.tsp.TSPParser;return t.getMessageImprint(e)};w.asn1.tsp.TSPParser=function(){var e=Error,t=Ge,r=new t,n=be,i=n.getV,a=n.getTLV,s=n.getIdxbyList,u=n.getTLVbyListEx,c=n.getChildIdx,f=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],d={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(g){var p=c(g,0);if(p.length==1)return this.getPKIStatusInfo(a(g,p[0]));if(p.length>1){var h=this.getPKIStatusInfo(a(g,p[0])),E=a(g,p[1]),v=this.getToken(E);return v.statusinfo=h,v}},this.getToken=function(g){var p=new w.asn1.cms.CMSParser,h=p.getCMSSignedData(g);return this.setTSTInfo(h),h},this.setTSTInfo=function(g){var p=g.econtent;if(p.type=="tstinfo"){var h=p.content.hex,E=this.getTSTInfo(h);p.content=E}},this.getTSTInfo=function(g){var p={},h=c(g,0),E=i(g,h[1]);p.policy=Q0(E);var v=a(g,h[2]);p.messageImprint=this.getMessageImprint(v);var b=i(g,h[3]);p.serial={hex:b};var m=i(g,h[4]);p.genTime={str:Vt(m)};var y=0;if(h.length>5&&g.substr(h[5],2)=="30"){var D=a(g,h[5]);p.accuracy=this.getAccuracy(D),y++}if(h.length>5+y&&g.substr(h[5+y],2)=="01"){var _=i(g,h[5+y]);_=="ff"&&(p.ordering=!0),y++}if(h.length>5+y&&g.substr(h[5+y],2)=="02"){var F=i(g,h[5+y]);p.nonce={hex:F},y++}if(h.length>5+y&&g.substr(h[5+y],2)=="a0"){var L=a(g,h[5+y]);L="30"+L.substr(2),pGeneralNames=r.getGeneralNames(L);var k=pGeneralNames[0].dn;p.tsa=k,y++}if(h.length>5+y&&g.substr(h[5+y],2)=="a1"){var S=a(g,h[5+y]);S="30"+S.substr(2);var B=r.getExtParamArray(S);p.ext=B,y++}return p},this.getAccuracy=function(g){for(var p={},h=c(g,0),E=0;E1&&g.substr(h[1],2)=="30"){var m=a(g,h[1]);p.statusstr=this.getPKIFreeText(m),E++}if(h.length>E&&g.substr(h[1+E],2)=="03"){var y=a(g,h[1+E]);p.failinfo=this.getPKIFailureInfo(y)}return p},this.getPKIFreeText=function(g){for(var p=[],h=c(g,0),E=0;E"u"||!w)&&(w={});(typeof w.asn1>"u"||!w.asn1)&&(w.asn1={});(typeof w.asn1.cades>"u"||!w.asn1.cades)&&(w.asn1.cades={});w.asn1.cades.SignaturePolicyIdentifier=function(e){var t=w,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(a){this.params=a},e!=null&&this.setByParam(e)};pe(w.asn1.cades.SignaturePolicyIdentifier,w.asn1.cms.Attribute);w.asn1.cades.SignaturePolicyId=function(e){var t=w,r=t.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,a=r.x509,s=a.AlgorithmIdentifier,u=r.cades,c=u.SignaturePolicyId,f=u.OtherHashAlgAndValue;c.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params,g=[];g.push(new i(d.oid)),g.push(new f(d));var p=new n({array:g});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(d){this.params=d},e!=null&&this.setByParam(e)};pe(w.asn1.cades.SignaturePolicyId,w.asn1.ASN1Object);w.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,r=w,n=r.asn1,i=n.DERSequence,a=n.DEROctetString,s=n.x509,u=s.AlgorithmIdentifier,c=n.cades,f=c.OtherHashAlgAndValue;f.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params;if(d.alg==null)throw new t("property 'alg' not specified");if(d.hash==null&&d.cert==null)throw new t("property 'hash' nor 'cert' not specified");var g=null;if(d.hash!=null)g=d.hash;else if(d.cert!=null){if(typeof d.cert!="string")throw new t("cert not string");var p=d.cert;d.cert.indexOf("-----BEGIN")!=-1&&(p=mr(d.cert)),g=w.crypto.Util.hashHex(p,d.alg)}var h=[];h.push(new u({name:d.alg})),h.push(new a({hex:g}));var E=new i({array:h});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(w.asn1.cades.OtherHashAlgAndValue,w.asn1.ASN1Object);w.asn1.cades.OtherHashValue=function(e){w.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,r=w,n=r.lang.String.isHex,i=r.asn1,a=i.DEROctetString,s=r.crypto.Util.hashHex;this.params=null,this.tohex=function(){var u=this.params;if(u.hash==null&&u.cert==null)throw new t("hash or cert not specified");var c=null;if(u.hash!=null)c=u.hash;else if(u.cert!=null){if(typeof u.cert!="string")throw new t("cert not string");var f=u.cert;u.cert.indexOf("-----BEGIN")!=-1&&(f=mr(u.cert)),c=w.crypto.Util.hashHex(f,"sha1")}return new a({hex:c}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(w.asn1.cades.OtherHashValue,w.asn1.ASN1Object);w.asn1.cades.SignatureTimeStamp=function(e){var t=Error,r=w,n=r.lang.String.isHex,i=r.asn1,a=i.ASN1Object,s=i.x509,u=i.cades;u.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var c=this.params;if(c.tst!=null)if(n(c.tst)){var f=new a;return f.hTLV=c.tst,[f]}else{if(c.tst instanceof a)return[c.tst];throw new t("params.tst has wrong value")}else if(c.res!=null){var d=c.res;if(d instanceof a&&(d=d.tohex()),typeof d!="string"||!n(d))throw new t("params.res has wrong value");var g=be.getTLVbyList(d,0,[1]),f=new a;return f.hTLV=c.tst,[f]}},e!=null&&this.setByParam(e)};pe(w.asn1.cades.SignatureTimeStamp,w.asn1.cms.Attribute);w.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,r=w,n=r.asn1,i=n.DERSequence,a=n.cades,s=a.OtherCertID,u=r.lang.String.isHex;a.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var c=this.params,f=[],d=0;d"u"||!w.asn1.csr)&&(w.asn1.csr={});w.asn1.csr.CertificationRequest=function(e){var t=w,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.csr,s=r.x509,u=a.CertificationRequestInfo;a.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(c){this.params=c},this.sign=function(){var c=new u(this.params).tohex(),f=new w.crypto.Signature({alg:this.params.sigalg});f.init(this.params.sbjprvkey),f.updateHex(c);var d=f.sign();this.params.sighex=d},this.getPEM=function(){return Bn(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var c=this.params,f=new w.asn1.csr.CertificationRequestInfo(this.params),d=new w.asn1.x509.AlgorithmIdentifier({name:c.sigalg});if(c.sighex==null&&c.sbjprvkey!=null&&this.sign(),c.sighex==null)throw new Error("sighex or sbjprvkey parameter not defined");var g=new n({hex:"00"+c.sighex}),p=new i({array:[f,d,g]});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(w.asn1.csr.CertificationRequest,w.asn1.ASN1Object);w.asn1.csr.CertificationRequestInfo=function(e){var t=w,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.DERInteger,s=r.DERUTF8String,u=r.DERTaggedObject,c=r.ASN1Util.newObject,f=r.csr,d=r.x509,g=d.X500Name,p=d.Extensions,h=d.SubjectPublicKeyInfo,E=f.AttributeList;f.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(b){b!=null&&(this.params=b)},this.tohex=function(){var b=this.params,m=[];if(m.push(new a({int:0})),m.push(new g(b.subject)),m.push(new h(At.getKey(b.sbjpubkey))),b.attrs!=null){var y=v(b.attrs),D=c({tag:{tage:"a0",obj:y}});m.push(D)}else if(b.extreq!=null){var _=new p(b.extreq),D=c({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[_]}]}}});m.push(D)}else m.push(new u({tag:"a0",explicit:!1,obj:new s({str:""})}));var F=new i({array:m});return F.tohex()},this.getEncodedHex=function(){return this.tohex()};function v(b){for(var m=Error,y=w.asn1.x509.Extensions,D=[],_=0;_"u"||!w)&&(w={});(typeof w.asn1>"u"||!w.asn1)&&(w.asn1={});(typeof w.asn1.ocsp>"u"||!w.asn1.ocsp)&&(w.asn1.ocsp={});w.asn1.ocsp.DEFAULT_HASH="sha1";w.asn1.ocsp.OCSPResponse=function(e){w.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);var t=w.asn1.DEREnumerated,r=w.asn1.ASN1Util.newObject,n=w.asn1.ocsp.ResponseBytes,i=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var a=this.params.resstatus;return typeof a=="number"?a:typeof a!="string"?-1:i.indexOf(a)},this.setByParam=function(a){this.params=a},this.tohex=function(){var a=this.params,s=this._getStatusCode();if(s==-1)throw new Error("responseStatus not supported: "+a.resstatus);if(s!=0)return r({seq:[{enum:{int:s}}]}).tohex();var u=new n(a);return r({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:u}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(w.asn1.ocsp.OCSPResponse,w.asn1.ASN1Object);w.asn1.ocsp.ResponseBytes=function(e){w.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=w.asn1,r=t.DERSequence,n=t.DERObjectIdentifier,i=t.DEROctetString,a=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 u=new a(s),c=[];c.push(new n({name:"ocspBasic"})),c.push(new i({hex:u.tohex()}));var f=new r({array:c});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(w.asn1.ocsp.ResponseBytes,w.asn1.ASN1Object);w.asn1.ocsp.BasicOCSPResponse=function(e){w.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,r=w.asn1,n=r.ASN1Object,i=r.DERSequence,a=r.DERGeneralizedTime,s=r.DERTaggedObject,u=r.DERBitString,c=r.x509.Extensions,f=r.x509.AlgorithmIdentifier,d=r.ocsp,g=d.ResponderID;_SingleResponseList=d.SingleResponseList,_ResponseData=d.ResponseData,this.params=null,this.setByParam=function(p){this.params=p},this.sign=function(){var p=this.params,h=p.tbsresp.tohex(),E=new w.crypto.Signature({alg:p.sigalg});E.init(p.reskey),E.updateHex(h),p.sighex=E.sign()},this.tohex=function(){var p=this.params;p.tbsresp==null&&(p.tbsresp=new _ResponseData(p)),p.sighex==null&&p.reskey!=null&&this.sign();var h=[];if(h.push(p.tbsresp),h.push(new f({name:p.sigalg})),h.push(new u({hex:"00"+p.sighex})),p.certs!=null&&p.certs.length!=null){for(var E=[],v=0;v"u"||!w)&&(w={});(typeof w.lang>"u"||!w.lang)&&(w.lang={});w.lang.String=function(){};function my(e){for(var t=new Array,r=0;r>6,c=128|s&63;return Vt(u.toString(16)+c.toString(16))}var u=224|(a&240)>>4,c=128|(a&15)<<2|(s&192)>>6,f=128|s&63;return Vt(u.toString(16)+c.toString(16)+f.toString(16))}var r=e.match(/.{4}/g),n=r.map(t);return n.join("")}function Z0(e){for(var t=encodeURIComponent(e),r="",n=0;n"7"?"00"+e:e}function Kx(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 a=parseInt(r);if(a<0||255t.length&&(r=t.length);for(var n=0;n0&&(f=f+"."+u.join(".")),f}catch{return null}}function Cy(e){var t=new ee(String(e),10);return vf(t)}function vf(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="",a=0;a=t?e:new Array(t-e.length+1).join(r)+e};function _y(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 a=parseInt(i,2);return a==NaN?-1:a}catch{return-1}}function Dy(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+q0("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var i="0"+r;return i+n}function Fy(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=0;n--)a+=i[n];return a}function Zt(e,n,r){if(typeof e=="object"){for(var n=String(n).split("."),i=0;i"u"||!w)&&(w={});(typeof w.crypto>"u"||!w.crypto)&&(w.crypto={});w.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:Se.algo.MD5,sha1:Se.algo.SHA1,sha224:Se.algo.SHA224,sha256:Se.algo.SHA256,sha384:Se.algo.SHA384,sha512:Se.algo.SHA512,ripemd160:Se.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 a="0001",s="00"+n,u="",c=i-a.length-s.length,f=0;f"u"||!w)&&(w={});(typeof w.crypto>"u"||!w.crypto)&&(w.crypto={});w.crypto.ECDSA=function(e){var t="secp256r1",r=null,n=null,i=null,a=Error,s=ee,u=kt,c=w.crypto.ECDSA,f=w.crypto.ECParameterDB,d=c.getName,g=be,p=g.getVbyListEx,h=g.isASN1HEX,E=new Vc,v=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function b(m,y,D,_){for(var F=Math.max(y.bitLength(),_.bitLength()),L=m.add2D(D),k=m.curve.getInfinity(),S=F-1;S>=0;--S)k=k.twice2D(),k.z=s.ONE,y.testBit(S)?_.testBit(S)?k=k.add2D(L):k=k.add2D(m):_.testBit(S)&&(k=k.add2D(D));return k}this.getBigRandom=function(m){return new s(m.bitLength(),E).mod(m.subtract(s.ONE)).add(s.ONE)},this.setNamedCurve=function(m){this.ecparams=f.getByName(m),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=m},this.setPrivateKeyHex=function(m){this.isPrivate=!0,this.prvKeyHex=m},this.setPublicKeyHex=function(m){this.isPublic=!0,this.pubKeyHex=m},this.getPublicKeyXYHex=function(){var m=this.pubKeyHex;if(m.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var y=this.ecparams.keycharlen;if(m.length!==2+y*2)throw"malformed public key hex length";var D={};return D.x=m.substr(2,y),D.y=m.substr(2+y),D},this.getShortNISTPCurveName=function(){var m=this.curveName;return m==="secp256r1"||m==="NIST P-256"||m==="P-256"||m==="prime256v1"?"P-256":m==="secp384r1"||m==="NIST P-384"||m==="P-384"?"P-384":m==="secp521r1"||m==="NIST P-521"||m==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var m=this.ecparams.n,y=this.getBigRandom(m),D=this.ecparams.keycharlen,_=("0000000000"+y.toString(16)).slice(-D);this.setPrivateKeyHex(_);var F=this.generatePublicKeyHex();return{ecprvhex:_,ecpubhex:F}},this.generatePublicKeyHex=function(){var m=new s(this.prvKeyHex,16),y=this.ecparams.G.multiply(m),D=y.getX().toBigInteger(),_=y.getY().toBigInteger(),F=this.ecparams.keycharlen,L=("0000000000"+D.toString(16)).slice(-F),k=("0000000000"+_.toString(16)).slice(-F),S="04"+L+k;return this.setPublicKeyHex(S),S},this.signWithMessageHash=function(m){return this.signHex(m,this.prvKeyHex)},this.signHex=function(m,y){var D=new s(y,16),_=this.ecparams.n,F=new s(m.substring(0,this.ecparams.keycharlen),16);do var L=this.getBigRandom(_),k=this.ecparams.G,S=k.multiply(L),B=S.getX().toBigInteger().mod(_);while(B.compareTo(s.ZERO)<=0);var O=L.modInverse(_).multiply(F.add(D.multiply(B))).mod(_);return c.biRSSigToASN1Sig(B,O)},this.sign=function(m,y){var D=y,_=this.ecparams.n,F=s.fromByteArrayUnsigned(m);do var L=this.getBigRandom(_),k=this.ecparams.G,S=k.multiply(L),B=S.getX().toBigInteger().mod(_);while(B.compareTo(ee.ZERO)<=0);var O=L.modInverse(_).multiply(F.add(D.multiply(B))).mod(_);return this.serializeSig(B,O)},this.verifyWithMessageHash=function(m,y){return this.verifyHex(m,y,this.pubKeyHex)},this.verifyHex=function(m,y,D){try{var _,F,L=c.parseSigHex(y);_=L.r,F=L.s;var k=u.decodeFromHex(this.ecparams.curve,D),S=new s(m.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(S,_,F,k)}catch{return!1}},this.verify=function(m,y,D){var _,F;if(Bitcoin.Util.isArray(y)){var L=this.parseSig(y);_=L.r,F=L.s}else if(typeof y=="object"&&y.r&&y.s)_=y.r,F=y.s;else throw"Invalid value for signature";var k;if(D instanceof kt)k=D;else if(Bitcoin.Util.isArray(D))k=u.decodeFrom(this.ecparams.curve,D);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var S=s.fromByteArrayUnsigned(m);return this.verifyRaw(S,_,F,k)},this.verifyRaw=function(m,y,D,_){var F=this.ecparams.n,L=this.ecparams.G;if(y.compareTo(s.ONE)<0||y.compareTo(F)>=0||D.compareTo(s.ONE)<0||D.compareTo(F)>=0)return!1;var k=D.modInverse(F),S=m.multiply(k).mod(F),B=y.multiply(k).mod(F),O=L.multiply(S).add(_.multiply(B)),x=O.getX().toBigInteger().mod(F);return x.equals(y)},this.serializeSig=function(m,y){var D=m.toByteArraySigned(),_=y.toByteArraySigned(),F=[];return F.push(2),F.push(D.length),F=F.concat(D),F.push(2),F.push(_.length),F=F.concat(_),F.unshift(F.length),F.unshift(48),F},this.parseSig=function(m){var y;if(m[0]!=48)throw new Error("Signature not a valid DERSequence");if(y=2,m[y]!=2)throw new Error("First element in signature must be a DERInteger");var D=m.slice(y+2,y+2+m[y+1]);if(y+=2+m[y+1],m[y]!=2)throw new Error("Second element in signature must be a DERInteger");var _=m.slice(y+2,y+2+m[y+1]);y+=2+m[y+1];var F=s.fromByteArrayUnsigned(D),L=s.fromByteArrayUnsigned(_);return{r:F,s:L}},this.parseSigCompact=function(m){if(m.length!==65)throw"Signature has the wrong length";var y=m[0]-27;if(y<0||y>7)throw"Invalid signature type";var D=this.ecparams.n,_=s.fromByteArrayUnsigned(m.slice(1,33)).mod(D),F=s.fromByteArrayUnsigned(m.slice(33,65)).mod(D);return{r:_,s:F,i:y}},this.readPKCS5PrvKeyHex=function(m){if(h(m)===!1)throw new Error("not ASN.1 hex string");var y,D,_;try{y=p(m,0,["[0]",0],"06"),D=p(m,0,[1],"04");try{_=p(m,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=d(y),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(_),this.setPrivateKeyHex(D),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(m){if(h(m)===!1)throw new a("not ASN.1 hex string");var y,D,_,F;try{y=p(m,0,[1,0],"06"),D=p(m,0,[1,1],"06"),_=p(m,0,[2,0,1],"04");try{F=p(m,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new a("malformed PKCS#8 plain ECC private key")}if(this.curveName=d(D),this.curveName===void 0)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(F),this.setPrivateKeyHex(_),this.isPublic=!1},this.readPKCS8PubKeyHex=function(m){if(h(m)===!1)throw new a("not ASN.1 hex string");var y,D,_;try{y=p(m,0,[0,0],"06"),D=p(m,0,[0,1],"06"),_=p(m,0,[1],"03")}catch{throw new a("malformed PKCS#8 ECC public key")}if(this.curveName=d(D),this.curveName===null)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(_)},this.readCertPubKeyHex=function(m,y){if(h(m)===!1)throw new a("not ASN.1 hex string");var D,_;try{D=p(m,0,[0,5,0,1],"06"),_=p(m,0,[0,5,1],"03")}catch{throw new a("malformed X.509 certificate ECC public key")}if(this.curveName=d(D),this.curveName===null)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(_)},e!==void 0&&e.curve!==void 0&&(this.curveName=e.curve),this.curveName===void 0&&(this.curveName=t),this.setNamedCurve(this.curveName),e!==void 0&&(e.prv!==void 0&&this.setPrivateKeyHex(e.prv),e.pub!==void 0&&this.setPublicKeyHex(e.pub))};w.crypto.ECDSA.parseSigHex=function(e){var t=w.crypto.ECDSA.parseSigHexInHexRS(e),r=new ee(t.r,16),n=new ee(t.s,16);return{r,s:n}};w.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=be,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 a=i[0],s=i[1];if(e.substr(a,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 u=n(e,a),c=n(e,s);return{r:u,s:c}};w.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=w.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};w.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 w.crypto.ECDSA.hexRSSigToASN1Sig(t,r)};w.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new ee(e,16),n=new ee(t,16);return w.crypto.ECDSA.biRSSigToASN1Sig(r,n)};w.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=w.asn1,n=new r.DERInteger({bigint:e}),i=new r.DERInteger({bigint:t}),a=new r.DERSequence({array:[n,i]});return a.tohex()};w.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 w>"u"||!w)&&(w={});(typeof w.crypto>"u"||!w.crypto)&&(w.crypto={});w.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,a,s,u,c,f,d,g,p,h,E){e[n]={};var v=r(a),b=r(s),m=r(u),y=r(c),D=r(f),_=new Wa(v,b,m),F=_.decodePointHex("04"+d+g);e[n].name=n,e[n].keylen=i,e[n].keycharlen=Math.ceil(i/8)*2,e[n].curve=_,e[n].G=F,e[n].n=y,e[n].h=D,e[n].oid=h,e[n].info=E;for(var L=0;L"u"||!w)&&(w={});(typeof w.crypto>"u"||!w.crypto)&&(w.crypto={});w.crypto.DSA=function(){var e=be,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(a,s,u,c,f){this.isPrivate=!0,this.p=a,this.q=s,this.g=u,this.y=c,this.x=f},this.setPrivateHex=function(a,s,u,c,f){var d,g,p,h,E;d=new ee(a,16),g=new ee(s,16),p=new ee(u,16),typeof c=="string"&&c.length>1?h=new ee(c,16):h=null,E=new ee(f,16),this.setPrivate(d,g,p,h,E)},this.setPublic=function(a,s,u,c){this.isPublic=!0,this.p=a,this.q=s,this.g=u,this.y=c,this.x=null},this.setPublicHex=function(a,s,u,c){var f,d,g,p;f=new ee(a,16),d=new ee(s,16),g=new ee(u,16),p=new ee(c,16),this.setPublic(f,d,g,p)},this.signWithMessageHash=function(a){var s=this.p,u=this.q,c=this.g,f=this.y,d=this.x,g=w.crypto.Util.getRandomBigIntegerMinToMax(ee.ONE.add(ee.ONE),u.subtract(ee.ONE)),p=a.substr(0,u.bitLength()/4),h=new ee(p,16),E=c.modPow(g,s).mod(u),v=g.modInverse(u).multiply(h.add(d.multiply(E))).mod(u),b=w.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:E}},{int:{bigint:v}}]});return b},this.verifyWithMessageHash=function(a,s){var u=this.p,c=this.q,f=this.g,d=this.y,g=this.parseASN1Signature(s),p=g[0],h=g[1],E=a.substr(0,c.bitLength()/4),v=new ee(E,16);if(ee.ZERO.compareTo(p)>0||p.compareTo(c)>0||ee.ZERO.compareTo(h)>=0||h.compareTo(c)>0)throw"invalid DSA signature";var b=h.modInverse(c),m=v.multiply(b).mod(c),y=p.multiply(b).mod(c),D=f.modPow(m,u).multiply(d.modPow(y,u)).mod(u).mod(c);return D.compareTo(p)==0},this.parseASN1Signature=function(a){try{var s=new i(r(a,0,[0],"02"),16),u=new i(r(a,0,[1],"02"),16);return[s,u]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(a){var s,u,c,f,d;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[1],"02"),u=r(a,0,[2],"02"),c=r(a,0,[3],"02"),f=r(a,0,[4],"02"),d=r(a,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(s,u,c,f,d)},this.readPKCS8PrvKeyHex=function(a){var s,u,c,f;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[1,1,0],"02"),u=r(a,0,[1,1,1],"02"),c=r(a,0,[1,1,2],"02"),f=r(a,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(s,u,c,null,f)},this.readPKCS8PubKeyHex=function(a){var s,u,c,f;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[0,1,0],"02"),u=r(a,0,[0,1,1],"02"),c=r(a,0,[0,1,2],"02"),f=r(a,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(s,u,c,f)},this.readCertPubKeyHex=function(a,s){var u,c,f,d;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[0,5,0,1,0],"02"),c=r(a,0,[0,5,0,1,1],"02"),f=r(a,0,[0,5,0,1,2],"02"),d=r(a,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(u,c,f,d)}};var At=function(){var e=function(v,b,m){return n(Se.AES,v,b,m)},t=function(v,b,m){return n(Se.TripleDES,v,b,m)},r=function(v,b,m){return n(Se.DES,v,b,m)},n=function(v,b,m,y){var D=Se.enc.Hex.parse(b),_=Se.enc.Hex.parse(m),F=Se.enc.Hex.parse(y),L={};L.key=_,L.iv=F,L.ciphertext=D;var k=v.decrypt(L,_,{iv:F});return Se.enc.Hex.stringify(k)},i=function(v,b,m){return u(Se.AES,v,b,m)},a=function(v,b,m){return u(Se.TripleDES,v,b,m)},s=function(v,b,m){return u(Se.DES,v,b,m)},u=function(v,b,m,y){var D=Se.enc.Hex.parse(b),_=Se.enc.Hex.parse(m),F=Se.enc.Hex.parse(y),L=v.encrypt(D,_,{iv:F}),k=Se.enc.Hex.parse(L.toString()),S=Se.enc.Base64.stringify(k);return S},c={"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:a,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:s,keylen:8,ivlen:8}},f=function(v){return c[v].proc},d=function(v){var b=Se.lib.WordArray.random(v),m=Se.enc.Hex.stringify(b);return m},g=function(v){var b={},m=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));m&&(b.cipher=m[1],b.ivsalt=m[2]);var y=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));y&&(b.type=y[1]);var D=-1,_=0;v.indexOf(`\r \r `)!=-1&&(D=v.indexOf(`\r \r `),_=2),v.indexOf(` `)!=-1&&(D=v.indexOf(` `),_=1);var F=v.indexOf("-----END");if(D!=-1&&F!=-1){var L=v.substring(D+_*2,F-_);L=L.replace(/\s+/g,""),b.data=L}return b},p=function(v,b,m){for(var y=m.substring(0,16),D=Se.enc.Hex.parse(y),_=Se.enc.Utf8.parse(b),F=c[v].keylen+c[v].ivlen,L="",k=null;;){var S=Se.algo.MD5.create();if(k!=null&&S.update(k),S.update(_),S.update(D),k=S.finalize(),L=L+Se.enc.Hex.stringify(k),L.length>=F*2)break}var B={};return B.keyhex=L.substr(0,c[v].keylen*2),B.ivhex=L.substr(c[v].keylen*2,c[v].ivlen*2),B},h=function(v,b,m,y){var D=Se.enc.Base64.parse(v),_=Se.enc.Hex.stringify(D),F=c[b].proc,L=F(_,m,y);return L},E=function(v,b,m,y){var D=c[b].eproc,_=D(v,m,y);return _};return{version:"1.0.0",parsePKCS5PEM:function(v){return g(v)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(v,b,m){return p(v,b,m)},decryptKeyB64:function(v,b,m,y){return h(v,b,m,y)},getDecryptedKeyHex:function(v,b){var m=g(v),y=m.type,D=m.cipher,_=m.ivsalt,F=m.data,L=p(D,b,_),k=L.keyhex,S=h(F,D,k,_);return S},getEncryptedPKCS5PEMFromPrvKeyHex:function(v,b,m,y,D){var O="";if((typeof y>"u"||y==null)&&(y="AES-256-CBC"),typeof c[y]>"u")throw new Error("KEYUTIL unsupported algorithm: "+y);if(typeof D>"u"||D==null){var _=c[y].ivlen,F=d(_);D=F.toUpperCase()}var L=p(y,m,D),k=L.keyhex,S=E(b,y,k,D),B=S.replace(/(.{64})/g,`$1\r `),O="-----BEGIN "+v+` PRIVATE KEY-----\r `;return O+=`Proc-Type: 4,ENCRYPTED\r `,O+="DEK-Info: "+y+","+D+`\r `,O+=`\r `,O+=B,O+=`\r -----END `+v+` PRIVATE KEY-----\r `,O},getEncryptedPKCS8PEM:function(v,b,m){var y=this.getEncryptedPKCS8Hex(v,b,m);return Bn(y,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(v,b,m){var y;m==null||m==null?y={}:y=JSON.parse(JSON.stringify(m)),y.plain=v,this.initPBES2Param(y),this.encryptPBES2Param(y,b);var D=this.generatePBES2ASN1Param(y);return w.asn1.ASN1Util.newObject(D).tohex()},initPBES2Param:function(v){if(Zt(v,"encalg")==null&&(v.encalg="aes256-CBC"),Zt(v,"iter")==null&&(v.iter=2048),Zt(v,"prf")==null&&(v.prf="hmacWithSHA256"),Zt(v,"salt")==null&&(v.salt=Se.enc.Hex.stringify(Se.lib.WordArray.random(8))),Zt(v,"enciv")==null){var b;v.encalg=="des-EDE3-CBC"&&(b=8),v.encalg=="aes128-CBC"&&(b=16),v.encalg=="aes256-CBC"&&(b=16),v.enciv=Se.enc.Hex.stringify(Se.lib.WordArray.random(b))}},encryptPBES2Param:function(v,b){var m=At.getDKFromPBES2Param(v,b);try{var y=w.crypto.Cipher.encrypt(v.plain,m,v.encalg,{iv:v.enciv})}catch{throw new Error("encrypt error: "+v.plain+" "+m+" "+v.encalg+" "+v.enciv)}v.enc=y},generatePBES2ASN1Param:function(v){var b={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:v.salt}},{int:{hex:Cy(v.iter)}}]}]},{seq:[{oid:v.encalg},{octstr:{hex:v.enciv}}]}]}]},{octstr:{hex:v.enc}}]};return v.prf!="hmacWithSHA1"&&b.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:v.prf},{null:""}]}),b},parseHexOfEncryptedPKCS8:function(v){var b=be,m=b.getChildIdx,y=b.getV,D={},_=m(v,0);if(_.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+_.length);D.ciphertext=y(v,_[1]);var F=m(v,_[0]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+F.length);if(y(v,F[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var L=m(v,F[1]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+L.length);var k=m(v,L[1]);if(k.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+k.length);if(y(v,k[0])!="2a864886f70d0307")throw"this only supports TripleDES";D.encryptionSchemeAlg="TripleDES",D.encryptionSchemeIV=y(v,k[1]);var S=m(v,L[0]);if(S.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+S.length);if(y(v,S[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var B=m(v,S[1]);if(B.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+B.length);D.pbkdf2Salt=y(v,B[0]);var O=y(v,B[1]);try{D.pbkdf2Iter=parseInt(O,16)}catch{throw new Error("malformed format pbkdf2Iter: "+O)}return D},getPBKDF2KeyHexFromParam:function(v,b){var m=Se.enc.Hex.parse(v.pbkdf2Salt),y=v.pbkdf2Iter,D=Se.PBKDF2(b,m,{keySize:192/32,iterations:y}),_=Se.enc.Hex.stringify(D);return _},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,b){var m=mr(v,"ENCRYPTED PRIVATE KEY"),y=this.parseHexOfEncryptedPKCS8(m),D=At.getPBKDF2KeyHexFromParam(y,b),_={};_.ciphertext=Se.enc.Hex.parse(y.ciphertext);var F=Se.enc.Hex.parse(D),L=Se.enc.Hex.parse(y.encryptionSchemeIV),k=Se.TripleDES.decrypt(_,F,{iv:L}),S=Se.enc.Hex.stringify(k);return S},parsePBES2:function(v){var b=be.parse(v);if(Zt(b,"seq.0.seq.0.oid")!="pkcs5PBES2"||Zt(b,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var m=Zt(b,"seq.0.seq.1.seq.0.seq.1.seq");if(m==null)throw new Error("PBKDF2 parameter not found");var y=Zt(m,"0.octstr.hex"),D=Zt(m,"1.int.hex"),_=Zt(m,"2.seq.0.oid","hmacWithSHA1"),F=-1;try{F=parseInt(D,16)}catch{throw new Error("iter not proper value")}var L=Zt(b,"seq.0.seq.1.seq.1.seq.0.oid"),k=Zt(b,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),S=Zt(b,"seq.1.octstr.hex");if(L==null||k==null||S==null)throw new Error("encalg, enciv or enc is undefined");var B={salt:y,iter:F,prf:_,encalg:L,enciv:k,enc:S};return B},getDKFromPBES2Param:function(v,b){var m={hmacWithSHA1:Se.algo.SHA1,hmacWithSHA224:Se.algo.SHA224,hmacWithSHA256:Se.algo.SHA256,hmacWithSHA384:Se.algo.SHA384,hmacWithSHA512:Se.algo.SHA512},y={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},D=m[v.prf];if(D==null)throw new Error("unsupported prf");var _=y[v.encalg];if(_==null)throw new Error("unsupported encalg");var F=Se.enc.Hex.parse(v.salt),L=v.iter;try{var k=Se.PBKDF2(b,F,{keySize:_,iterations:L,hasher:D});return Se.enc.Hex.stringify(k)}catch(S){throw new Error("PBKDF2 error: "+S+" "+JSON.stringify(v)+" "+b)}},getPlainHexFromEncryptedPKCS8PEM:function(v,b){if(v.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var m=mr(v),y;try{y=At.parsePBES2(m)}catch(_){throw new Error("malformed PBES2 format: "+_.message)}var D=At.getDKFromPBES2Param(y,b);return w.crypto.Cipher.decrypt(y.enc,D,y.encalg,{iv:y.enciv})},getKeyFromEncryptedPKCS8PEM:function(v,b){var m=this.getPlainHexFromEncryptedPKCS8PEM(v,b),y=this.getKeyFromPlainPrivatePKCS8Hex(m);return y},parsePlainPrivatePKCS8Hex:function(v){var b=be,m=b.getChildIdx,y=b.getV,D={};if(D.algparam=null,v.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var _=m(v,0);if(_.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(v.substr(_[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var F=m(v,_[1]);if(F.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(v.substr(F[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(D.algoid=y(v,F[0]),v.substr(F[1],2)=="06"&&(D.algparam=y(v,F[1])),v.substr(_[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return D.keyidx=b.getVidx(v,_[2]),D},getKeyFromPlainPrivatePKCS8PEM:function(v){var b=mr(v,"PRIVATE KEY"),m=this.getKeyFromPlainPrivatePKCS8Hex(b);return m},getKeyFromPlainPrivatePKCS8Hex:function(v){var b=this.parsePlainPrivatePKCS8Hex(v),m;if(b.algoid=="2a864886f70d010101")m=new et;else if(b.algoid=="2a8648ce380401")m=new w.crypto.DSA;else if(b.algoid=="2a8648ce3d0201")m=new w.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return m.readPKCS8PrvKeyHex(v),m},_getKeyFromPublicPKCS8Hex:function(v){var b,m=be.getVbyList(v,0,[0,0],"06");if(m==="2a864886f70d010101")b=new et;else if(m==="2a8648ce380401")b=new w.crypto.DSA;else if(m==="2a8648ce3d0201")b=new w.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return b.readPKCS8PubKeyHex(v),b},parsePublicRawRSAKeyHex:function(v){var b=be,m=b.getChildIdx,y=b.getV,D={};if(v.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var _=m(v,0);if(_.length!=2)throw new Error("malformed RSA key(code:002)");if(v.substr(_[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(D.n=y(v,_[0]),v.substr(_[1],2)!="02")throw new Error("malformed RSA key(code:004)");return D.e=y(v,_[1]),D},parsePublicPKCS8Hex:function(v){var b=be,m=b.getChildIdx,y=b.getV,D={};D.algparam=null;var _=m(v,0);if(_.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+_.length);var F=_[0];if(v.substr(F,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var L=m(v,F);if(L.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(v.substr(L[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(D.algoid=y(v,L[0]),v.substr(L[1],2)=="06"?D.algparam=y(v,L[1]):v.substr(L[1],2)=="30"&&(D.algparam={},D.algparam.p=b.getVbyList(v,L[1],[0],"02"),D.algparam.q=b.getVbyList(v,L[1],[1],"02"),D.algparam.g=b.getVbyList(v,L[1],[2],"02")),v.substr(_[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return D.key=y(v,_[1]).substr(2),D}}}();At.getKey=function(e,t,r){var n=be,i=n.getChildIdx,a=n.getV,s=n.getVbyList,u=w.crypto,c=u.ECDSA,f=u.DSA,d=et,g=mr,p=At;if(typeof d<"u"&&e instanceof d||typeof c<"u"&&e instanceof c||typeof f<"u"&&e instanceof f)return e;if(e.curve!==void 0&&e.xy!==void 0&&e.d===void 0)return new c({pub:e.xy,curve:e.curve});if(e.curve!==void 0&&e.d!==void 0)return new c({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 d;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 d;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 d;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 d;return h.setPublic(cr(e.n),cr(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 d;return h.setPrivateEx(cr(e.n),cr(e.e),cr(e.d),cr(e.p),cr(e.q),cr(e.dp),cr(e.dq),cr(e.qi)),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var h=new d;return h.setPrivate(cr(e.n),cr(e.e),cr(e.d)),h}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var E=new c({curve:e.crv}),v=E.ecparams.keycharlen,b=("0000000000"+cr(e.x)).slice(-v),m=("0000000000"+cr(e.y)).slice(-v),y="04"+b+m;return E.setPublicKeyHex(y),E}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var E=new c({curve:e.crv}),v=E.ecparams.keycharlen,b=("0000000000"+cr(e.x)).slice(-v),m=("0000000000"+cr(e.y)).slice(-v),y="04"+b+m,D=("0000000000"+cr(e.d)).slice(-v);return E.setPublicKeyHex(y),E.setPrivateKeyHex(D),E}if(r==="pkcs5prv"){var _=e,n=be,F,h;if(F=i(_,0),F.length===9)h=new d,h.readPKCS5PrvKeyHex(_);else if(F.length===6)h=new f,h.readPKCS5PrvKeyHex(_);else if(F.length>2&&_.substr(F[1],2)==="04")h=new c,h.readPKCS5PrvKeyHex(_);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return h}if(r==="pkcs8prv"){var h=p.getKeyFromPlainPrivatePKCS8Hex(e);return h}if(r==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(e);if(r==="x509pub")return Ge.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return Ge.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var L=mr(e,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(L)}if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var k=g(e,"RSA PRIVATE KEY");return p.getKey(k,null,"pkcs5prv")}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var S=g(e,"DSA PRIVATE KEY"),B=s(S,0,[1],"02"),O=s(S,0,[2],"02"),x=s(S,0,[3],"02"),U=s(S,0,[4],"02"),Y=s(S,0,[5],"02"),h=new f;return h.setPrivate(new ee(B,16),new ee(O,16),new ee(x,16),new ee(U,16),new ee(Y,16)),h}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var k=g(e,"EC PRIVATE KEY");return p.getKey(k,null,"pkcs5prv")}if(e.indexOf("-END PRIVATE KEY-")!=-1)return p.getKeyFromPlainPrivatePKCS8PEM(e);if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var H=p.getDecryptedKeyHex(e,t),K=new et;return K.readPKCS5PrvKeyHex(H),K}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),h=s(S,0,[1],"04"),W=s(S,0,[2,0],"06"),ie=s(S,0,[3,0],"03").substr(2),_e="";if(w.crypto.OID.oidhex2name[W]!==void 0)_e=w.crypto.OID.oidhex2name[W];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+W);var E=new c({curve:_e});return E.setPublicKeyHex(ie),E.setPrivateKeyHex(h),E.isPublic=!1,E}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),B=s(S,0,[1],"02"),O=s(S,0,[2],"02"),x=s(S,0,[3],"02"),U=s(S,0,[4],"02"),Y=s(S,0,[5],"02"),h=new f;return h.setPrivate(new ee(B,16),new ee(O,16),new ee(x,16),new ee(U,16),new ee(Y,16)),h}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};At.generateKeypair=function(e,t){if(e=="RSA"){var r=t,n=new et;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new et,a=n.n.toString(16),s=n.e.toString(16);i.setPublic(a,s),i.isPrivate=!1,i.isPublic=!0;var u={};return u.prvKeyObj=n,u.pubKeyObj=i,u}else if(e=="EC"){var c=t,f=new w.crypto.ECDSA({curve:c}),d=f.generateKeyPairHex(),n=new w.crypto.ECDSA({curve:c});n.setPublicKeyHex(d.ecpubhex),n.setPrivateKeyHex(d.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new w.crypto.ECDSA({curve:c});i.setPublicKeyHex(d.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var u={};return u.prvKeyObj=n,u.pubKeyObj=i,u}else throw new Error("unknown algorithm: "+e)};At.getPEM=function(e,t,r,n,i,a){var s=w,u=s.asn1,c=u.DERObjectIdentifier,f=u.DERInteger,d=u.ASN1Util.newObject,g=u.x509,p=g.SubjectPublicKeyInfo,h=s.crypto,E=h.DSA,v=h.ECDSA,b=et;function m(K){var W=d({seq:[{int:0},{int:{bigint:K.n}},{int:K.e},{int:{bigint:K.d}},{int:{bigint:K.p}},{int:{bigint:K.q}},{int:{bigint:K.dmp1}},{int:{bigint:K.dmq1}},{int:{bigint:K.coeff}}]});return W}function y(K){var W=d({seq:[{int:1},{octstr:{hex:K.prvKeyHex}},{tag:["a0",!0,{oid:{name:K.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+K.pubKeyHex}}]}]});return W}function D(K){var W=d({seq:[{int:0},{int:{bigint:K.p}},{int:{bigint:K.q}},{int:{bigint:K.g}},{int:{bigint:K.y}},{int:{bigint:K.x}}]});return W}if((b!==void 0&&e instanceof b||E!==void 0&&e instanceof E||v!==void 0&&e instanceof v)&&e.isPublic==!0&&(t===void 0||t=="PKCS8PUB")){var _=new p(e),F=_.tohex();return Bn(F,"PUBLIC KEY")}if(t=="PKCS1PRV"&&b!==void 0&&e instanceof b&&(r===void 0||r==null)&&e.isPrivate==!0){var _=m(e),F=_.tohex();return Bn(F,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&v!==void 0&&e instanceof v&&(r===void 0||r==null)&&e.isPrivate==!0){var L=new c({name:e.curveName}),k=L.tohex(),S=y(e),B=S.tohex(),O="";return O+=Bn(k,"EC PARAMETERS"),O+=Bn(B,"EC PRIVATE KEY"),O}if(t=="PKCS1PRV"&&E!==void 0&&e instanceof E&&(r===void 0||r==null)&&e.isPrivate==!0){var _=D(e),F=_.tohex();return Bn(F,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&b!==void 0&&e instanceof b&&r!==void 0&&r!=null&&e.isPrivate==!0){var _=m(e),F=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",F,r,n,a)}if(t=="PKCS5PRV"&&v!==void 0&&e instanceof v&&r!==void 0&&r!=null&&e.isPrivate==!0){var _=y(e),F=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",F,r,n,a)}if(t=="PKCS5PRV"&&E!==void 0&&e instanceof E&&r!==void 0&&r!=null&&e.isPrivate==!0){var _=D(e),F=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",F,r,n,a)}var x=function(K,W){if(typeof W=="string")return At.getEncryptedPKCS8PEM(K,W);if(typeof W=="object"&&Zt(W,"passcode")!=null){var ie=JSON.parse(JSON.stringify(W)),_e=ie.passcode;return delete ie.passcode,At.getEncryptedPKCS8PEM(K,_e,ie)}};if(t=="PKCS8PRV"&&b!=null&&e instanceof b&&e.isPrivate==!0){var U=m(e),Y=U.tohex(),_=d({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:Y}}]}),F=_.tohex();return r===void 0||r==null?Bn(F,"PRIVATE KEY"):x(F,r)}if(t=="PKCS8PRV"&&v!==void 0&&e instanceof v&&e.isPrivate==!0){var H={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&H.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var U=new d(H),Y=U.tohex(),_=d({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:Y}}]}),F=_.tohex();return r===void 0||r==null?Bn(F,"PRIVATE KEY"):x(F,r)}if(t=="PKCS8PRV"&&E!==void 0&&e instanceof E&&e.isPrivate==!0){var U=new f({bigint:e.x}),Y=U.tohex(),_=d({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:Y}}]}),F=_.tohex();return r===void 0||r==null?Bn(F,"PRIVATE KEY"):x(F,r)}throw new Error("unsupported object nor format")};At.getKeyFromCSRPEM=function(e){var t=mr(e,"CERTIFICATE REQUEST"),r=At.getKeyFromCSRHex(t);return r};At.getKeyFromCSRHex=function(e){var t=At.parseCSRHex(e),r=At.getKey(t.p8pubkeyhex,null,"pkcs8pub");return r};At.parseCSRHex=function(e){var t=be,r=t.getChildIdx,n=t.getTLV,i={},a=e;if(a.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var s=r(a,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if(a.substr(s[0],2)!="30")throw new Error("malformed CSR(code:003)");var u=r(a,s[0]);if(u.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(a,u[2]),i};At.getKeyID=function(e){var t=At,r=be;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var n=mr(t.getPEM(e)),i=r.getIdxbyList(n,0,[1]),a=r.getV(n,i).substring(2);return w.crypto.Util.hashHex(a,"sha1")};At.getJWK=function(e,t,r,n,i){var a,s={},u,c=w.crypto.Util.hashHex;if(typeof e=="string")a=At.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(u=mr(e));else if(typeof e=="object")e instanceof Ge?(a=e.getPublicKey(),u=e.hex):a=e;else throw new Error("unsupported keyinfo type");if(a instanceof et&&a.isPrivate)s.kty="RSA",s.n=Vr(a.n.toString(16)),s.e=Vr(a.e.toString(16)),s.d=Vr(a.d.toString(16)),s.p=Vr(a.p.toString(16)),s.q=Vr(a.q.toString(16)),s.dp=Vr(a.dmp1.toString(16)),s.dq=Vr(a.dmq1.toString(16)),s.qi=Vr(a.coeff.toString(16));else if(a instanceof et&&a.isPublic)s.kty="RSA",s.n=Vr(a.n.toString(16)),s.e=Vr(a.e.toString(16));else if(a instanceof w.crypto.ECDSA&&a.isPrivate){var f=a.getShortNISTPCurveName();if(f!=="P-256"&&f!=="P-384"&&f!=="P-521")throw new Error("unsupported curve name for JWT: "+f);var d=a.getPublicKeyXYHex();s.kty="EC",s.crv=f,s.x=Vr(d.x),s.y=Vr(d.y),s.d=Vr(a.prvKeyHex)}else if(a instanceof w.crypto.ECDSA&&a.isPublic){var f=a.getShortNISTPCurveName();if(f!=="P-256"&&f!=="P-384"&&f!=="P-521")throw new Error("unsupported curve name for JWT: "+f);var d=a.getPublicKeyXYHex();s.kty="EC",s.crv=f,s.x=Vr(d.x),s.y=Vr(d.y)}if(s.kty==null)throw new Error("unsupported keyinfo");return!a.isPrivate&&t!=!0&&(s.kid=w.jws.JWS.getJWKthumbprint(s)),u!=null&&r!=!0&&(s.x5c=[Ya(u)]),u!=null&&n!=!0&&(s.x5t=jc(Ya(c(u,"sha1")))),u!=null&&i!=!0&&(s["x5t#S256"]=jc(Ya(c(u,"sha256")))),s};At.getJWKFromKey=function(e){return At.getJWK(e,!0,!0,!0,!0)};et.getPosArrayOfChildrenFromHex=function(e){return be.getChildIdx(e,0)};et.getHexValueArrayOfChildrenFromHex=function(e){var t=be,r=t.getV,p=et.getPosArrayOfChildrenFromHex(e),n=r(e,p[0]),i=r(e,p[1]),a=r(e,p[2]),s=r(e,p[3]),u=r(e,p[4]),c=r(e,p[5]),f=r(e,p[6]),d=r(e,p[7]),g=r(e,p[8]),p=new Array;return p.push(n,i,a,s,u,c,f,d,g),p};et.prototype.readPrivateKeyFromPEMString=function(e){var t=mr(e),r=et.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};et.prototype.readPKCS5PrvKeyHex=function(e){var t=et.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])};et.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,i,a,s,u,c,f=be,d=f.getVbyListEx;if(f.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");try{t=d(e,0,[2,0,1],"02"),r=d(e,0,[2,0,2],"02"),n=d(e,0,[2,0,3],"02"),i=d(e,0,[2,0,4],"02"),a=d(e,0,[2,0,5],"02"),s=d(e,0,[2,0,6],"02"),u=d(e,0,[2,0,7],"02"),c=d(e,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,r,n,i,a,s,u,c)};et.prototype.readPKCS5PubKeyHex=function(e){var t=be,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]),a=r(e,n[1]);this.setPublic(i,a)};et.prototype.readPKCS8PubKeyHex=function(e){var t=be;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)};et.prototype.readCertPubKeyHex=function(e,t){var r,n;r=new Ge,r.readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};var Ez=new RegExp("[^0-9a-f]","gi");function Sy(e,t){for(var r="",n=t/4-e.length,i=0;i>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}et.prototype.signPSS=function(e,t,r){var n=function(a){return w.crypto.Util.hashHex(a,t)},i=n(Gs(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,t,r)};et.prototype.signWithMessageHashPSS=function(e,t,r){var n=gi(e),i=n.length,a=this.n.bitLength()-1,s=Math.ceil(a/8),u,c=function(b){return w.crypto.Util.hashHex(b,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(s0&&(f=new Array(r),new Vc().nextBytes(f),f=String.fromCharCode.apply(String,f));var d=gi(c(Gs("\0\0\0\0\0\0\0\0"+n+f))),g=[];for(u=0;u>8*s-a&255;for(E[0]&=~v,u=0;un)return!1;var i=this.doPublic(r),a=i.toString(16);if(a.length+3!=n/4)return!1;var s=a.replace(/^1f+00/,""),u=By(s);if(u.length==0)return!1;var c=u[0],f=u[1],d=function(p){return w.crypto.Util.hashString(p,c)},g=d(e);return f==g};et.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=di(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),a=By(i);if(a.length==0)return!1;var s=a[0],u=a[1];return u==e};et.prototype.verifyPSS=function(e,t,r,n){var i=function(s){return w.crypto.Util.hashHex(s,r)},a=i(Gs(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(a,t,r,n)};et.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new ee(t,16),a=function(y){return w.crypto.Util.hashHex(y,r)},s=gi(e),u=s.length,c=this.n.bitLength()-1,f=Math.ceil(c/8),d;if(n===-1||n===void 0)n=u;else if(n===-2)n=f-u-2;else if(n<-2)throw new Error("invalid salt length");if(f>8*f-c&255;if(p.charCodeAt(0)&E)throw new Error("bits beyond keysize not zero");var v=Iy(h,p.length,a),b=[];for(d=0;d0?B:void 0}catch{return}},this._asn1ToNoticeRef=function(S){try{for(var B={},O=Zt(S,"seq"),x=0;x0?B:void 0}catch{return}},this._asn1ToNoticeNum=function(S){try{for(var B=Zt(S,"seq"),O=[],x=0;x1){var Y=s(S,U[1]),H=this.getGeneralName(Y);H.uri!=null&&(x.uri=H.uri)}if(U.length>2){var K=s(S,U[2]);K=="0101ff"&&(x.reqauth=!0),K=="010100"&&(x.reqauth=!1)}return x},this.getExtSubjectDirectoryAttributes=function(S,B){if(S===void 0&&B===void 0){var O=this.getExtInfo("subjectDirectoryAttributes");if(O===void 0)return;S=s(this.hex,O.vidx),B=O.critical}var x={extname:"subjectDirectoryAttributes"};B&&(x.critical=!0);try{for(var U=a(S),Y=[],H=0;H0&&(B.ext=this.getExtParamArray()),B.sighex=this.getSignatureValueHex(),S.tbshex==!0&&(B.tbshex=f(this.hex,0,[0])),S.nodnarray==!0&&(delete B.issuer.array,delete B.subject.array),B},this.getExtParamArray=function(S){if(S==null){var B=p(this.hex,0,[0,"[3]"]);B!=-1&&(S=d(this.hex,0,[0,"[3]",0],"30"))}for(var O=[],x=r(S,0),U=0;U"u"||!w)&&(w={});(typeof w.jws>"u"||!w.jws)&&(w.jws={});w.jws.JWS=function(){var e=w,t=e.jws.JWS,r=t.isSafeJSONString;this.parseJWS=function(n,i){if(!(this.parsedJWS!==void 0&&(i||this.parsedJWS.sigvalH!==void 0))){var a=n.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(a==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var s=a[1],u=a[2],c=a[3],f=s+"."+u;if(this.parsedJWS={},this.parsedJWS.headB64U=s,this.parsedJWS.payloadB64U=u,this.parsedJWS.sigvalB64U=c,this.parsedJWS.si=f,!i){var d=cr(c),g=di(d,16);this.parsedJWS.sigvalH=d,this.parsedJWS.sigvalBI=g}var p=ys(s),h=ys(u);if(this.parsedJWS.headS=p,this.parsedJWS.payloadS=h,!r(p,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+p}}};w.jws.JWS.sign=function(e,t,r,n,i){var a=w,s=a.jws,u=s.JWS,c=u.readSafeJSONString,f=u.isSafeJSONString,d=a.crypto,g=d.ECDSA,p=d.Mac,h=d.Signature,E=JSON,v,b,m;if(typeof t!="string"&&typeof t!="object")throw"spHeader must be JSON string or object: "+t;if(typeof t=="object"&&(b=t,v=E.stringify(b)),typeof t=="string"){if(v=t,!f(v))throw"JWS Head is not safe JSON string: "+v;b=c(v)}if(m=r,typeof r=="object"&&(m=E.stringify(r)),(e==""||e==null)&&b.alg!==void 0&&(e=b.alg),e!=""&&e!=null&&b.alg===void 0&&(b.alg=e,v=E.stringify(b)),e!==b.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+b.alg;var y=null;if(u.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;y=u.jwsalg2sigalg[e];var D=pf(v),_=pf(m),F=D+"."+_,L="";if(y.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var k=new p({alg:y,prov:"cryptojs",pass:n});k.updateString(F),L=k.doFinal()}else if(y.indexOf("withECDSA")!=-1){var S=new h({alg:y});S.init(n,i),S.updateString(F);var B=S.sign();L=w.crypto.ECDSA.asn1SigToConcatSig(B)}else if(y!="none"){var S=new h({alg:y});S.init(n,i),S.updateString(F),L=S.sign()}var O=Vr(L);return F+"."+O};w.jws.JWS.verify=function(e,t,r){var n=w,i=n.jws,a=i.JWS,s=a.readSafeJSONString,u=n.crypto,c=u.ECDSA,f=u.Mac,d=u.Signature,g;if(typeof et!==void 0&&(g=et),!jg(e))return!1;var p=e.split(".");if(p.length!==3)return!1;var h=p[0],E=p[1],v=h+"."+E,b=cr(p[2]),m=s(ys(p[0])),y=null,D=null;if(m.alg===void 0)throw"algorithm not specified in header";if(y=m.alg,D=y.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var _=":"+r.join(":")+":";if(_.indexOf(":"+y+":")==-1)throw"algorithm '"+y+"' not accepted in the list"}if(y!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=At.getKey(t)),(D=="RS"||D=="PS")&&!(t instanceof g))throw"key shall be a RSAKey obj for RS* and PS* algs";if(D=="ES"&&!(t instanceof c))throw"key shall be a ECDSA obj for ES* algs";y=="none";var F=null;if(a.jwsalg2sigalg[m.alg]===void 0)throw"unsupported alg name: "+y;if(F=a.jwsalg2sigalg[y],F=="none")throw"not supported";if(F.substr(0,4)=="Hmac"){var L=null;if(t===void 0)throw"hexadecimal key shall be specified for HMAC";var k=new f({alg:F,pass:t});return k.updateString(v),L=k.doFinal(),b==L}else if(F.indexOf("withECDSA")!=-1){var S=null;try{S=c.concatSigToASN1Sig(b)}catch{return!1}var B=new d({alg:F});return B.init(t),B.updateString(v),B.verify(S)}else{var B=new d({alg:F});return B.init(t),B.updateString(v),B.verify(b)}};w.jws.JWS.parse=function(e){var t=e.split("."),r={},n,i,a;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&&(a=t[2]),r.headerObj=w.jws.JWS.readSafeJSONString(ys(n)),r.payloadObj=w.jws.JWS.readSafeJSONString(ys(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=ys(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),a!==void 0&&(r.sigHex=cr(a)),r};w.jws.JWS.verifyJWT=function(e,t,r){var n=w,i=n.jws,a=i.JWS,s=a.readSafeJSONString,u=a.inArray,c=a.includedArray;if(!jg(e))return!1;var f=e.split(".");if(f.length!=3)return!1;var d=f[0],g=f[1],p=d+"."+g,h=cr(f[2]),E=s(ys(d)),v=s(ys(g));if(E.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!u(E.alg,r.alg)||v.iss!==void 0&&typeof r.iss=="object"&&!u(v.iss,r.iss)||v.sub!==void 0&&typeof r.sub=="object"&&!u(v.sub,r.sub))return!1;if(v.aud!==void 0&&typeof r.aud=="object"){if(typeof v.aud=="string"){if(!u(v.aud,r.aud))return!1}else if(typeof v.aud=="object"&&!c(v.aud,r.aud))return!1}var b=i.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(b=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(v.exp!==void 0&&typeof v.exp=="number"&&v.exp+r.gracePeriod"u"||!w)&&(w={});(typeof w.jws>"u"||!w.jws)&&(w.jws={});w.jws.JWSJS=function(){var e=w,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 a=i.split(".");if(a.length!=3)throw"malformed input JWS";this.aHeader.push(a[0]),this.sPayload=a[1],this.aSignature.push(a[2])},this.addSignature=function(i,a,s,u){if(this.sPayload===void 0||this.sPayload===null)throw"there's no JSON-JS signature to add.";var c=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var f=w.jws.JWS.sign(i,a,this.sPayload,s,u),d=f.split("."),g=d[0],p=d[2];this.aHeader.push(d[0]),this.aSignature.push(d[2])}catch(h){throw this.aHeader.length>c&&this.aHeader.pop(),this.aSignature.length>c&&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 a=0;a0)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}};Ce.SecureRandom=Vc;Ce.rng_seed_time=Tg;Ce.BigInteger=ee;Ce.RSAKey=et;Ce.ECDSA=w.crypto.ECDSA;Ce.DSA=w.crypto.DSA;Ce.Signature=w.crypto.Signature;Ce.MessageDigest=w.crypto.MessageDigest;Ce.Mac=w.crypto.Mac;Ce.KEYUTIL=At;Ce.ASN1HEX=be;Ce.X509=Ge;Ce.X509CRL=Yx;Ce.CryptoJS=Se;Ce.b64tohex=Hc;Ce.b64toBA=ly;Ce.ECFieldElementFp=Kr;Ce.ECPointFp=kt;Ce.ECCurveFp=Wa;Ce.stoBA=my;Ce.BAtos=vy;Ce.BAtohex=G0;Ce.stohex=pi;Ce.stob64=Ix;Ce.stob64u=Bx;Ce.b64utos=$x;Ce.b64tob64u=jc;Ce.b64utob64=mf;Ce.hex2b64=Ya;Ce.hextob64u=Vr;Ce.b64utohex=cr;Ce.utf8tob64u=pf;Ce.b64utoutf8=ys;Ce.utf8tob64=Rx;Ce.b64toutf8=xx;Ce.utf8tohex=Y0;Ce.hextoutf8=Vt;Ce.hextorstr=gi;Ce.rstrtohex=Gs;Ce.hextob64=kg;Ce.hextob64nl=Tx;Ce.b64nltohex=Ey;Ce.hextopem=Bn;Ce.pemtohex=mr;Ce.hextoArrayBuffer=Lx;Ce.ArrayBuffertohex=Ux;Ce.zulutomsec=Ng;Ce.msectozulu=jx;Ce.zulutosec=wy;Ce.zulutodate=Hx;Ce.datetozulu=Mx;Ce.uricmptohex=X0;Ce.hextouricmp=J0;Ce.ipv6tohex=Bg;Ce.hextoipv6=$g;Ce.hextoip=M0;Ce.iptohex=Lg;Ce.ucs2hextoutf8=Ug;Ce.encodeURIComponentAll=Z0;Ce.newline_toUnix=qx;Ce.newline_toDos=Vx;Ce.hextoposhex=Rg;Ce.intarystrtohex=Kx;Ce.strdiffidx=zx;Ce.oidtohex=by;Ce.hextooid=Q0;Ce.strpad=q0;Ce.bitstrtoint=_y;Ce.inttobitstr=Dy;Ce.bitstrtobinstr=Fy;Ce.binstrtobitstr=Gx;Ce.isBase64URLDot=jg;Ce.namearraytobinstr=V0;Ce.extendClass=pe;Ce.foldnl=W0;Ce.b64topem=kx;Ce.pemtob64=Nx;Ce.timeogen=Ay;Ce.aryval=Zt;Ce.inttohex=Cy;Ce.twoscompl=vf;Ce.KJUR=w;Ce.crypto=w.crypto;Ce.asn1=w.asn1;Ce.jws=w.jws;Ce.lang=w.lang;Ce.VERSION=n$;Ce.VERSION_FULL=i$});var To=ce((yz,Oo)=>{"use strict";function xy(e){return typeof e>"u"||e===null}function Xx(e){return typeof e=="object"&&e!==null}function Jx(e){return Array.isArray(e)?e:xy(e)?[]:[e]}function Zx(e,t){var r,n,i,a;if(t)for(a=Object.keys(t),r=0,n=a.length;r{"use strict";function Ef(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||""}Ef.prototype=Object.create(Error.prototype);Ef.prototype.constructor=Ef;Ef.prototype.toString=function(t){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!t&&this.mark&&(r+=" "+this.mark.toString()),r};Py.exports=Ef});var ky=ce((Cz,Ty)=>{"use strict";var Oy=To();function Mg(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}Mg.prototype.getSnippet=function(t,r){var n,i,a,s,u;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(a="",s=this.position;sr/2-1){a=" ... ",s-=5;break}return u=this.buffer.slice(i,s),Oy.repeat(" ",t)+n+u+a+` `+Oy.repeat(" ",t+this.position-i+n.length)+"^"};Mg.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};Ty.exports=Mg});var zr=ce((_z,Ly)=>{"use strict";var Ny=Kc(),tP=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],rP=["scalar","sequence","mapping"];function nP(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function iP(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(tP.indexOf(r)===-1)throw new Ny('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=nP(t.styleAliases||null),rP.indexOf(this.kind)===-1)throw new Ny('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}Ly.exports=iP});var ko=ce((Dz,jy)=>{"use strict";var Uy=To(),ed=Kc(),sP=zr();function qg(e,t,r){var n=[];return e.include.forEach(function(i){r=qg(i,t,r)}),e[t].forEach(function(i){r.forEach(function(a,s){a.tag===i.tag&&a.kind===i.kind&&n.push(s)}),r.push(i)}),r.filter(function(i,a){return n.indexOf(a)===-1})}function aP(){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{"use strict";var uP=zr();Hy.exports=new uP("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}})});var Vy=ce((Sz,qy)=>{"use strict";var oP=zr();qy.exports=new oP("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}})});var zy=ce((Iz,Ky)=>{"use strict";var cP=zr();Ky.exports=new cP("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}})});var td=ce((Bz,Gy)=>{"use strict";var lP=ko();Gy.exports=new lP({explicit:[My(),Vy(),zy()]})});var Wy=ce(($z,Yy)=>{"use strict";var fP=zr();function hP(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function dP(){return null}function pP(e){return e===null}Yy.exports=new fP("tag:yaml.org,2002:null",{kind:"scalar",resolve:hP,construct:dP,predicate:pP,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var Jy=ce((Rz,Xy)=>{"use strict";var gP=zr();function mP(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 vP(e){return e==="true"||e==="True"||e==="TRUE"}function EP(e){return Object.prototype.toString.call(e)==="[object Boolean]"}Xy.exports=new gP("tag:yaml.org,2002:bool",{kind:"scalar",resolve:mP,construct:vP,predicate:EP,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 Qy=ce((xz,Zy)=>{"use strict";var wP=To(),AP=zr();function yP(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function bP(e){return 48<=e&&e<=55}function CP(e){return 48<=e&&e<=57}function _P(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=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 rb=ce((Pz,tb)=>{"use strict";var eb=To(),SP=zr(),IP=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 BP(e){return!(e===null||!IP.test(e)||e[e.length-1]==="_")}function $P(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(a){i.unshift(parseFloat(a,10))}),t=0,n=1,i.forEach(function(a){t+=a*n,n*=60}),r*t):r*parseFloat(t,10)}var RP=/^[-+]?[0-9]+e/;function xP(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(eb.isNegativeZero(e))return"-0.0";return r=e.toString(10),RP.test(r)?r.replace("e",".e"):r}function PP(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||eb.isNegativeZero(e))}tb.exports=new SP("tag:yaml.org,2002:float",{kind:"scalar",resolve:BP,construct:$P,predicate:PP,represent:xP,defaultStyle:"lowercase"})});var Vg=ce((Oz,nb)=>{"use strict";var OP=ko();nb.exports=new OP({include:[td()],implicit:[Wy(),Jy(),Qy(),rb()]})});var Kg=ce((Tz,ib)=>{"use strict";var TP=ko();ib.exports=new TP({include:[Vg()]})});var ob=ce((kz,ub)=>{"use strict";var kP=zr(),sb=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ab=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 NP(e){return e===null?!1:sb.exec(e)!==null||ab.exec(e)!==null}function LP(e){var t,r,n,i,a,s,u,c=0,f=null,d,g,p;if(t=sb.exec(e),t===null&&(t=ab.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(a=+t[4],s=+t[5],u=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(d=+t[10],g=+(t[11]||0),f=(d*60+g)*6e4,t[9]==="-"&&(f=-f)),p=new Date(Date.UTC(r,n,i,a,s,u,c)),f&&p.setTime(p.getTime()-f),p}function UP(e){return e.toISOString()}ub.exports=new kP("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:NP,construct:LP,instanceOf:Date,represent:UP})});var lb=ce((Nz,cb)=>{"use strict";var jP=zr();function HP(e){return e==="<<"||e===null}cb.exports=new jP("tag:yaml.org,2002:merge",{kind:"scalar",resolve:HP})});var db=ce((Lz,hb)=>{"use strict";var No;try{fb=Fo,No=fb("buffer").Buffer}catch{}var fb,MP=zr(),zg=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= \r`;function qP(e){if(e===null)return!1;var t,r,n=0,i=e.length,a=zg;for(r=0;r64)){if(t<0)return!1;n+=6}return n%8===0}function VP(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,a=zg,s=0,u=[];for(t=0;t>16&255),u.push(s>>8&255),u.push(s&255)),s=s<<6|a.indexOf(n.charAt(t));return r=i%4*6,r===0?(u.push(s>>16&255),u.push(s>>8&255),u.push(s&255)):r===18?(u.push(s>>10&255),u.push(s>>2&255)):r===12&&u.push(s>>4&255),No?No.from?No.from(u):new No(u):u}function KP(e){var t="",r=0,n,i,a=e.length,s=zg;for(n=0;n>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[n];return i=a%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 zP(e){return No&&No.isBuffer(e)}hb.exports=new MP("tag:yaml.org,2002:binary",{kind:"scalar",resolve:qP,construct:VP,predicate:zP,represent:KP})});var gb=ce((jz,pb)=>{"use strict";var GP=zr(),YP=Object.prototype.hasOwnProperty,WP=Object.prototype.toString;function XP(e){if(e===null)return!0;var t=[],r,n,i,a,s,u=e;for(r=0,n=u.length;r{"use strict";var ZP=zr(),QP=Object.prototype.toString;function eO(e){if(e===null)return!0;var t,r,n,i,a,s=e;for(a=new Array(s.length),t=0,r=s.length;t{"use strict";var rO=zr(),nO=Object.prototype.hasOwnProperty;function iO(e){if(e===null)return!0;var t,r=e;for(t in r)if(nO.call(r,t)&&r[t]!==null)return!1;return!0}function sO(e){return e!==null?e:{}}Eb.exports=new rO("tag:yaml.org,2002:set",{kind:"mapping",resolve:iO,construct:sO})});var Gc=ce((qz,Ab)=>{"use strict";var aO=ko();Ab.exports=new aO({include:[Kg()],implicit:[ob(),lb()],explicit:[db(),gb(),vb(),wb()]})});var bb=ce((Vz,yb)=>{"use strict";var uO=zr();function oO(){return!0}function cO(){}function lO(){return""}function fO(e){return typeof e>"u"}yb.exports=new uO("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:oO,construct:cO,predicate:fO,represent:lO})});var _b=ce((Kz,Cb)=>{"use strict";var hO=zr();function dO(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 pO(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 gO(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}function mO(e){return Object.prototype.toString.call(e)==="[object RegExp]"}Cb.exports=new hO("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:dO,construct:pO,predicate:mO,represent:gO})});var Sb=ce((zz,Fb)=>{"use strict";var rd;try{Db=Fo,rd=Db("esprima")}catch{typeof window<"u"&&(rd=window.esprima)}var Db,vO=zr();function EO(e){if(e===null)return!1;try{var t="("+e+")",r=rd.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 wO(e){var t="("+e+")",r=rd.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(a){n.push(a.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 AO(e){return e.toString()}function yO(e){return Object.prototype.toString.call(e)==="[object Function]"}Fb.exports=new vO("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:EO,construct:wO,predicate:yO,represent:AO})});var wf=ce((Yz,Bb)=>{"use strict";var Ib=ko();Bb.exports=Ib.DEFAULT=new Ib({include:[Gc()],explicit:[bb(),_b(),Sb()]})});var Yb=ce((Wz,Af)=>{"use strict";var Xa=To(),kb=Kc(),bO=ky(),Nb=Gc(),CO=wf(),Hu=Object.prototype.hasOwnProperty,nd=1,Lb=2,Ub=3,sd=4,Gg=1,_O=2,$b=3,DO=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,FO=/[\x85\u2028\u2029]/,SO=/[,\[\]\{\}]/,jb=/^(?:!|!!|![a-z\-]+!)$/i,Hb=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Rb(e){return Object.prototype.toString.call(e)}function Ys(e){return e===10||e===13}function Uo(e){return e===9||e===32}function mi(e){return e===9||e===32||e===10||e===13}function Yc(e){return e===44||e===91||e===93||e===123||e===125}function IO(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function BO(e){return e===120?2:e===117?4:e===85?8:0}function $O(e){return 48<=e&&e<=57?e-48:-1}function xb(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 RO(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var Mb=new Array(256),qb=new Array(256);for(Lo=0;Lo<256;Lo++)Mb[Lo]=xb(Lo)?1:0,qb[Lo]=xb(Lo);var Lo;function xO(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||CO,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 Vb(e,t){return new kb(t,new bO(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function We(e,t){throw Vb(e,t)}function ad(e,t){e.onWarning&&e.onWarning.call(null,Vb(e,t))}var Pb={YAML:function(t,r,n){var i,a,s;t.version!==null&&We(t,"duplication of %YAML directive"),n.length!==1&&We(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&We(t,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),s=parseInt(i[2],10),a!==1&&We(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&ad(t,"unsupported YAML version of the document")},TAG:function(t,r,n){var i,a;n.length!==2&&We(t,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],jb.test(i)||We(t,"ill-formed tag handle (first argument) of the TAG directive"),Hu.call(t.tagMap,i)&&We(t,'there is a previously declared suffix for "'+i+'" tag handle'),Hb.test(a)||We(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[i]=a}};function ju(e,t,r,n){var i,a,s,u;if(t1&&(e.result+=Xa.repeat(` `,t-1))}function PO(e,t,r){var n,i,a,s,u,c,f,d,g=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),mi(h)||Yc(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),mi(i)||r&&Yc(i)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,u=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),mi(i)||r&&Yc(i))break}else if(h===35){if(n=e.input.charCodeAt(e.position-1),mi(n))break}else{if(e.position===e.lineStart&&ud(e)||r&&Yc(h))break;if(Ys(h))if(c=e.line,f=e.lineStart,d=e.lineIndent,Lr(e,!1,-1),e.lineIndent>=t){u=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=c,e.lineStart=f,e.lineIndent=d;break}}u&&(ju(e,a,s,!1),Wg(e,e.line-c),a=s=e.position,u=!1),Uo(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position)}return ju(e,a,s,!1),e.result?!0:(e.kind=g,e.result=p,!1)}function OO(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(ju(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 Ys(r)?(ju(e,n,i,!0),Wg(e,Lr(e,!1,t)),n=i=e.position):e.position===e.lineStart&&ud(e)?We(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);We(e,"unexpected end of the stream within a single quoted scalar")}function TO(e,t){var r,n,i,a,s,u;if(u=e.input.charCodeAt(e.position),u!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(u=e.input.charCodeAt(e.position))!==0;){if(u===34)return ju(e,r,e.position,!0),e.position++,!0;if(u===92){if(ju(e,r,e.position,!0),u=e.input.charCodeAt(++e.position),Ys(u))Lr(e,!1,t);else if(u<256&&Mb[u])e.result+=qb[u],e.position++;else if((s=BO(u))>0){for(i=s,a=0;i>0;i--)u=e.input.charCodeAt(++e.position),(s=IO(u))>=0?a=(a<<4)+s:We(e,"expected hexadecimal character");e.result+=RO(a),e.position++}else We(e,"unknown escape sequence");r=n=e.position}else Ys(u)?(ju(e,r,n,!0),Wg(e,Lr(e,!1,t)),r=n=e.position):e.position===e.lineStart&&ud(e)?We(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}We(e,"unexpected end of the stream within a double quoted scalar")}function kO(e,t){var r=!0,n,i=e.tag,a,s=e.anchor,u,c,f,d,g,p={},h,E,v,b;if(b=e.input.charCodeAt(e.position),b===91)c=93,g=!1,a=[];else if(b===123)c=125,g=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),b=e.input.charCodeAt(++e.position);b!==0;){if(Lr(e,!0,t),b=e.input.charCodeAt(e.position),b===c)return e.position++,e.tag=i,e.anchor=s,e.kind=g?"mapping":"sequence",e.result=a,!0;r||We(e,"missed comma between flow collection entries"),E=h=v=null,f=d=!1,b===63&&(u=e.input.charCodeAt(e.position+1),mi(u)&&(f=d=!0,e.position++,Lr(e,!0,t))),n=e.line,Xc(e,t,nd,!1,!0),E=e.tag,h=e.result,Lr(e,!0,t),b=e.input.charCodeAt(e.position),(d||e.line===n)&&b===58&&(f=!0,b=e.input.charCodeAt(++e.position),Lr(e,!0,t),Xc(e,t,nd,!1,!0),v=e.result),g?Wc(e,a,p,E,h,v):f?a.push(Wc(e,null,p,E,h,v)):a.push(h),Lr(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(r=!0,b=e.input.charCodeAt(++e.position)):r=!1}We(e,"unexpected end of the stream within a flow collection")}function NO(e,t){var r,n,i=Gg,a=!1,s=!1,u=t,c=0,f=!1,d,g;if(g=e.input.charCodeAt(e.position),g===124)n=!1;else if(g===62)n=!0;else return!1;for(e.kind="scalar",e.result="";g!==0;)if(g=e.input.charCodeAt(++e.position),g===43||g===45)Gg===i?i=g===43?$b:_O:We(e,"repeat of a chomping mode identifier");else if((d=$O(g))>=0)d===0?We(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?We(e,"repeat of an indentation width identifier"):(u=t+d-1,s=!0);else break;if(Uo(g)){do g=e.input.charCodeAt(++e.position);while(Uo(g));if(g===35)do g=e.input.charCodeAt(++e.position);while(!Ys(g)&&g!==0)}for(;g!==0;){for(Yg(e),e.lineIndent=0,g=e.input.charCodeAt(e.position);(!s||e.lineIndentu&&(u=e.lineIndent),Ys(g)){c++;continue}if(e.lineIndentt)&&c!==0)We(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(Xc(e,t,sd,!0,i)&&(E?p=e.result:h=e.result),E||(Wc(e,f,d,g,p,h,a,s),g=p=h=null),Lr(e,!0,-1),b=e.input.charCodeAt(e.position)),e.lineIndent>t&&b!==0)We(e,"bad indentation of a mapping entry");else if(e.lineIndentt?c=1:e.lineIndent===t?c=0:e.lineIndentt?c=1:e.lineIndent===t?c=0:e.lineIndent tag; it should be "scalar", not "'+e.kind+'"'),g=0,p=e.implicitTypes.length;g 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)):We(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):We(e,"unknown tag !<"+e.tag+">");return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function MO(e){var t=e.position,r,n,i,a=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};(s=e.input.charCodeAt(e.position))!==0&&(Lr(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(a=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!mi(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),i=[],n.length<1&&We(e,"directive name must not be less than one character in length");s!==0;){for(;Uo(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Ys(s));break}if(Ys(s))break;for(r=e.position;s!==0&&!mi(s);)s=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}s!==0&&Yg(e),Hu.call(Pb,n)?Pb[n](e,n,i):ad(e,'unknown document directive "'+n+'"')}if(Lr(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,Lr(e,!0,-1)):a&&We(e,"directives end mark is expected"),Xc(e,e.lineIndent-1,sd,!1,!0),Lr(e,!0,-1),e.checkLineBreaks&&FO.test(e.input.slice(t,e.position))&&ad(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&ud(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Lr(e,!0,-1));return}if(e.position"u"&&(r=t,t=null);var n=Kb(e,r);if(typeof t!="function")return n;for(var i=0,a=n.length;i"u"&&(r=t,t=null),zb(e,t,Xa.extend({schema:Nb},r))}function VO(e,t){return Gb(e,Xa.extend({schema:Nb},t))}Af.exports.loadAll=zb;Af.exports.load=Gb;Af.exports.safeLoadAll=qO;Af.exports.safeLoad=VO});var vC=ce((Xz,Qg)=>{"use strict";var bf=To(),Cf=Kc(),KO=wf(),zO=Gc(),rC=Object.prototype.toString,nC=Object.prototype.hasOwnProperty,GO=9,yf=10,YO=13,WO=32,XO=33,JO=34,iC=35,ZO=37,QO=38,eT=39,tT=42,sC=44,rT=45,aC=58,nT=61,iT=62,sT=63,aT=64,uC=91,oC=93,uT=96,cC=123,oT=124,lC=125,$n={};$n[0]="\\0";$n[7]="\\a";$n[8]="\\b";$n[9]="\\t";$n[10]="\\n";$n[11]="\\v";$n[12]="\\f";$n[13]="\\r";$n[27]="\\e";$n[34]='\\"';$n[92]="\\\\";$n[133]="\\N";$n[160]="\\_";$n[8232]="\\L";$n[8233]="\\P";var cT=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function lT(e,t){var r,n,i,a,s,u,c;if(t===null)return{};for(r={},n=Object.keys(t),i=0,a=n.length;i0?e.charCodeAt(a-1):null,p=p&&Jb(s,u)}else{for(a=0;an&&e[g+1]!==" ",g=a);else if(!Jc(s))return od;u=a>0?e.charCodeAt(a-1):null,p=p&&Jb(s,u)}f=f||d&&a-g-1>n&&e[g+1]!==" "}return!c&&!f?p&&!i(e)?hC:dC:r>9&&fC(e)?od:f?gC:pC}function mT(e,t,r,n){e.dump=function(){if(t.length===0)return"''";if(!e.noCompatMode&&cT.indexOf(t)!==-1)return"'"+t+"'";var i=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),s=n||e.flowLevel>-1&&r>=e.flowLevel;function u(c){return hT(e,c)}switch(gT(t,s,e.indent,a,u)){case hC:return t;case dC:return"'"+t.replace(/'/g,"''")+"'";case pC:return"|"+Zb(t,e.indent)+Qb(Xb(t,i));case gC:return">"+Zb(t,e.indent)+Qb(Xb(vT(t,a),i));case od:return'"'+ET(t,a)+'"';default:throw new Cf("impossible error: invalid scalar style")}}()}function Zb(e,t){var r=fC(e)?String(t):"",n=e[e.length-1]===` `,i=n&&(e[e.length-2]===` `||e===` `),a=i?"+":n?"":"-";return r+a+` `}function Qb(e){return e[e.length-1]===` `?e.slice(0,-1):e}function vT(e,t){for(var r=/(\n+)([^\n]*)/g,n=function(){var f=e.indexOf(` `);return f=f!==-1?f:e.length,r.lastIndex=f,eC(e.slice(0,f),t)}(),i=e[0]===` `||e[0]===" ",a,s;s=r.exec(e);){var u=s[1],c=s[2];a=c[0]===" ",n+=u+(!i&&!a&&c!==""?` `:"")+eC(c,t),i=a}return n}function eC(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,i=0,a,s=0,u=0,c="";n=r.exec(e);)u=n.index,u-i>t&&(a=s>i?s:u,c+=` `+e.slice(i,a),i=a+1),s=u;return c+=` `,e.length-i>t&&s>i?c+=e.slice(i,s)+` `+e.slice(s+1):c+=e.slice(i),c.slice(1)}function ET(e){for(var t="",r,n,i,a=0;a=55296&&r<=56319&&(n=e.charCodeAt(a+1),n>=56320&&n<=57343)){t+=Wb((r-55296)*1024+n-56320+65536),a++;continue}i=$n[r],t+=!i&&Jc(r)?e[a]:i||Wb(r)}return t}function wT(e,t,r){var n="",i=e.tag,a,s;for(a=0,s=r.length;a1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),jo(e,t,f,!1,!1)&&(d+=e.dump,n+=d));e.tag=i,e.dump="{"+n+"}"}function bT(e,t,r,n){var i="",a=e.tag,s=Object.keys(r),u,c,f,d,g,p;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Cf("sortKeys must be a boolean or a function");for(u=0,c=s.length;u1024,g&&(e.dump&&yf===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,g&&(p+=Xg(e,t)),jo(e,t+1,d,!0,g)&&(e.dump&&yf===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=a,e.dump=i||"{}"}function tC(e,t,r){var n,i,a,s,u,c;for(i=r?e.explicitTypes:e.implicitTypes,a=0,s=i.length;a tag resolver accepts not "'+c+'" style');e.dump=n}return!0}return!1}function jo(e,t,r,n,i,a){e.tag=null,e.dump=r,tC(e,r,!1)||tC(e,r,!0);var s=rC.call(e.dump);n&&(n=e.flowLevel<0||e.flowLevel>t);var u=s==="[object Object]"||s==="[object Array]",c,f;if(u&&(c=e.duplicates.indexOf(r),f=c!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[c])e.dump="*ref_"+c;else{if(u&&f&&!e.usedDuplicates[c]&&(e.usedDuplicates[c]=!0),s==="[object Object]")n&&Object.keys(e.dump).length!==0?(bT(e,t,e.dump,i),f&&(e.dump="&ref_"+c+e.dump)):(yT(e,t,e.dump),f&&(e.dump="&ref_"+c+" "+e.dump));else if(s==="[object Array]"){var d=e.noArrayIndent&&t>0?t-1:t;n&&e.dump.length!==0?(AT(e,d,e.dump,i),f&&(e.dump="&ref_"+c+e.dump)):(wT(e,d,e.dump),f&&(e.dump="&ref_"+c+" "+e.dump))}else if(s==="[object String]")e.tag!=="?"&&mT(e,e.dump,t,a);else{if(e.skipInvalid)return!1;throw new Cf("unacceptable kind of an object to dump "+s)}e.tag!==null&&e.tag!=="?"&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function CT(e,t){var r=[],n=[],i,a;for(Jg(e,r,n),i=0,a=n.length;i{"use strict";var cd=Yb(),EC=vC();function ld(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}Dr.exports.Type=zr();Dr.exports.Schema=ko();Dr.exports.FAILSAFE_SCHEMA=td();Dr.exports.JSON_SCHEMA=Vg();Dr.exports.CORE_SCHEMA=Kg();Dr.exports.DEFAULT_SAFE_SCHEMA=Gc();Dr.exports.DEFAULT_FULL_SCHEMA=wf();Dr.exports.load=cd.load;Dr.exports.loadAll=cd.loadAll;Dr.exports.safeLoad=cd.safeLoad;Dr.exports.safeLoadAll=cd.safeLoadAll;Dr.exports.dump=EC.dump;Dr.exports.safeDump=EC.safeDump;Dr.exports.YAMLException=Kc();Dr.exports.MINIMAL_SCHEMA=td();Dr.exports.SAFE_SCHEMA=Gc();Dr.exports.DEFAULT_SCHEMA=wf();Dr.exports.scan=ld("scan");Dr.exports.parse=ld("parse");Dr.exports.compose=ld("compose");Dr.exports.addConstructor=ld("addConstructor")});var yC=ce((Zz,AC)=>{"use strict";var DT=wC();AC.exports=DT});var CC=ce((Qz,bC)=>{"use strict";var fd=yC();bC.exports={safeLoad:fd.safeLoad,load:fd.load,safeDump:fd.safeDump,dump:fd.dump}});var tm=ce(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});Zc.isCorrect=Zc.isInSubnet=void 0;function OT(e){return this.subnetMask{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.RE_SUBNET_STRING=Xs.RE_ADDRESS=Xs.GROUPS=Xs.BITS=void 0;Xs.BITS=32;Xs.GROUPS=4;Xs.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;Xs.RE_SUBNET_STRING=/\/\d{1,2}$/});var pd=ce(dd=>{"use strict";Object.defineProperty(dd,"__esModule",{value:!0});dd.AddressError=void 0;var nm=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};dd.AddressError=nm});var im=ce((gd,SC)=>{(function(){var e,t=0xdeadbeefcafe,r=(t&16777215)==15715070;function n(P,N,V){P!=null&&(typeof P=="number"?this.fromNumber(P,N,V):N==null&&typeof P!="string"?this.fromString(P,256):this.fromString(P,N))}function i(){return new n(null)}function a(P,N,V,Q,ve,Ae){for(;--Ae>=0;){var Ie=N*this[P++]+V[Q]+ve;ve=Math.floor(Ie/67108864),V[Q++]=Ie&67108863}return ve}function s(P,N,V,Q,ve,Ae){for(var Ie=N&32767,Pe=N>>15;--Ae>=0;){var Yt=this[P]&32767,br=this[P++]>>15,hn=Pe*Yt+br*Ie;Yt=Ie*Yt+((hn&32767)<<15)+V[Q]+(ve&1073741823),ve=(Yt>>>30)+(hn>>>15)+Pe*br+(ve>>>30),V[Q++]=Yt&1073741823}return ve}function u(P,N,V,Q,ve,Ae){for(var Ie=N&16383,Pe=N>>14;--Ae>=0;){var Yt=this[P]&16383,br=this[P++]>>14,hn=Pe*Yt+br*Ie;Yt=Ie*Yt+((hn&16383)<<14)+V[Q]+ve,ve=(Yt>>28)+(hn>>14)+Pe*br,V[Q++]=Yt&268435455}return ve}var c=typeof navigator<"u";c&&r&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=s,e=30):c&&r&&navigator.appName!="Netscape"?(n.prototype.am=a,e=26):(n.prototype.am=u,e=28),n.prototype.DB=e,n.prototype.DM=(1<=0;--N)P[N]=this[N];P.t=this.t,P.s=this.s}function m(P){this.t=1,this.s=P<0?-1:0,P>0?this[0]=P:P<-1?this[0]=P+this.DV:this.t=0}function y(P){var N=i();return N.fromInt(P),N}function D(P,N){var V;if(N==16)V=4;else if(N==8)V=3;else if(N==256)V=8;else if(N==2)V=1;else if(N==32)V=5;else if(N==4)V=2;else{this.fromRadix(P,N);return}this.t=0,this.s=0;for(var Q=P.length,ve=!1,Ae=0;--Q>=0;){var Ie=V==8?P[Q]&255:v(P,Q);if(Ie<0){P.charAt(Q)=="-"&&(ve=!0);continue}ve=!1,Ae==0?this[this.t++]=Ie:Ae+V>this.DB?(this[this.t-1]|=(Ie&(1<>this.DB-Ae):this[this.t-1]|=Ie<=this.DB&&(Ae-=this.DB)}V==8&&P[0]&128&&(this.s=-1,Ae>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==P;)--this.t}function F(P){if(this.s<0)return"-"+this.negate().toString(P);var N;if(P==16)N=4;else if(P==8)N=3;else if(P==2)N=1;else if(P==32)N=5;else if(P==4)N=2;else return this.toRadix(P);var V=(1<0)for(Pe>Pe)>0&&(ve=!0,Ae=E(Q));Ie>=0;)Pe>(Pe+=this.DB-N)):(Q=this[Ie]>>(Pe-=N)&V,Pe<=0&&(Pe+=this.DB,--Ie)),Q>0&&(ve=!0),ve&&(Ae+=E(Q));return ve?Ae:"0"}function L(){var P=i();return n.ZERO.subTo(this,P),P}function k(){return this.s<0?this.negate():this}function S(P){var N=this.s-P.s;if(N!=0)return N;var V=this.t;if(N=V-P.t,N!=0)return this.s<0?-N:N;for(;--V>=0;)if((N=this[V]-P[V])!=0)return N;return 0}function B(P){var N=1,V;return(V=P>>>16)!=0&&(P=V,N+=16),(V=P>>8)!=0&&(P=V,N+=8),(V=P>>4)!=0&&(P=V,N+=4),(V=P>>2)!=0&&(P=V,N+=2),(V=P>>1)!=0&&(P=V,N+=1),N}function O(){return this.t<=0?0:this.DB*(this.t-1)+B(this[this.t-1]^this.s&this.DM)}function x(P,N){var V;for(V=this.t-1;V>=0;--V)N[V+P]=this[V];for(V=P-1;V>=0;--V)N[V]=0;N.t=this.t+P,N.s=this.s}function U(P,N){for(var V=P;V=0;--Pe)N[Pe+Ae+1]=this[Pe]>>Q|Ie,Ie=(this[Pe]&ve)<=0;--Pe)N[Pe]=0;N[Ae]=Ie,N.t=this.t+Ae+1,N.s=this.s,N.clamp()}function H(P,N){N.s=this.s;var V=Math.floor(P/this.DB);if(V>=this.t){N.t=0;return}var Q=P%this.DB,ve=this.DB-Q,Ae=(1<>Q;for(var Ie=V+1;Ie>Q;Q>0&&(N[this.t-V-1]|=(this.s&Ae)<>=this.DB;if(P.t>=this.DB;Q+=this.s}else{for(Q+=this.s;V>=this.DB;Q-=P.s}N.s=Q<0?-1:0,Q<-1?N[V++]=this.DV+Q:Q>0&&(N[V++]=Q),N.t=V,N.clamp()}function W(P,N){var V=this.abs(),Q=P.abs(),ve=V.t;for(N.t=ve+Q.t;--ve>=0;)N[ve]=0;for(ve=0;ve=0;)P[V]=0;for(V=0;V=N.DV&&(P[V+N.t]-=N.DV,P[V+N.t+1]=1)}P.t>0&&(P[P.t-1]+=N.am(V,N[V],P,2*V,0,1)),P.s=0,P.clamp()}function _e(P,N,V){var Q=P.abs();if(!(Q.t<=0)){var ve=this.abs();if(ve.t0?(Q.lShiftTo(Yt,Ae),ve.lShiftTo(Yt,V)):(Q.copyTo(Ae),ve.copyTo(V));var br=Ae.t,hn=Ae[br-1];if(hn!=0){var dn=hn*(1<1?Ae[br-2]>>this.F2:0),Di=this.FV/dn,Du=(1<=0&&(V[V.t++]=1,V.subTo(Yi,V)),n.ONE.dlShiftTo(br,Yi),Yi.subTo(Ae,Ae);Ae.t=0;){var go=V[--pn]==hn?this.DM:Math.floor(V[pn]*Di+(V[pn-1]+Mn)*Du);if((V[pn]+=Ae.am(0,go,V,Fu,0,br))0&&V.rShiftTo(Yt,V),Ie<0&&n.ZERO.subTo(V,V)}}}function Fe(P){var N=i();return this.abs().divRemTo(P,null,N),this.s<0&&N.compareTo(n.ZERO)>0&&P.subTo(N,N),N}function xe(P){this.m=P}function rt(P){return P.s<0||P.compareTo(this.m)>=0?P.mod(this.m):P}function tt(P){return P}function ct(P){P.divRemTo(this.m,null,P)}function lt(P,N,V){P.multiplyTo(N,V),this.reduce(V)}function sn(P,N){P.squareTo(N),this.reduce(N)}xe.prototype.convert=rt,xe.prototype.revert=tt,xe.prototype.reduce=ct,xe.prototype.mulTo=lt,xe.prototype.sqrTo=sn;function nr(){if(this.t<1)return 0;var P=this[0];if(!(P&1))return 0;var N=P&3;return N=N*(2-(P&15)*N)&15,N=N*(2-(P&255)*N)&255,N=N*(2-((P&65535)*N&65535))&65535,N=N*(2-P*N%this.DV)%this.DV,N>0?this.DV-N:-N}function Ct(P){this.m=P,this.mp=P.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(N,N),N}function sr(P){var N=i();return P.copyTo(N),this.reduce(N),N}function dt(P){for(;P.t<=this.mt2;)P[P.t++]=0;for(var N=0;N>15)*this.mpl&this.um)<<15)&P.DM;for(V=N+this.m.t,P[V]+=this.m.am(0,Q,P,N,0,this.m.t);P[V]>=P.DV;)P[V]-=P.DV,P[++V]++}P.clamp(),P.drShiftTo(this.m.t,P),P.compareTo(this.m)>=0&&P.subTo(this.m,P)}function zt(P,N){P.squareTo(N),this.reduce(N)}function nt(P,N,V){P.multiplyTo(N,V),this.reduce(V)}Ct.prototype.convert=Er,Ct.prototype.revert=sr,Ct.prototype.reduce=dt,Ct.prototype.mulTo=nt,Ct.prototype.sqrTo=zt;function Ke(){return(this.t>0?this[0]&1:this.s)==0}function ar(P,N){if(P>4294967295||P<1)return n.ONE;var V=i(),Q=i(),ve=N.convert(this),Ae=B(P)-1;for(ve.copyTo(V);--Ae>=0;)if(N.sqrTo(V,Q),(P&1<0)N.mulTo(Q,ve,V);else{var Ie=V;V=Q,Q=Ie}return N.revert(V)}function He(P,N){var V;return P<256||N.isEven()?V=new xe(N):V=new Ct(N),this.exp(P,V)}n.prototype.copyTo=b,n.prototype.fromInt=m,n.prototype.fromString=D,n.prototype.clamp=_,n.prototype.dlShiftTo=x,n.prototype.drShiftTo=U,n.prototype.lShiftTo=Y,n.prototype.rShiftTo=H,n.prototype.subTo=K,n.prototype.multiplyTo=W,n.prototype.squareTo=ie,n.prototype.divRemTo=_e,n.prototype.invDigit=nr,n.prototype.isEven=Ke,n.prototype.exp=ar,n.prototype.toString=F,n.prototype.negate=L,n.prototype.abs=k,n.prototype.compareTo=S,n.prototype.bitLength=O,n.prototype.mod=Fe,n.prototype.modPowInt=He,n.ZERO=y(0),n.ONE=y(1);function Ot(){var P=i();return this.copyTo(P),P}function an(){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)<>24}function Gt(){return this.t==0?this.s:this[0]<<16>>16}function vt(P){return Math.floor(Math.LN2*this.DB/Math.log(P))}function Or(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function _i(P){if(P==null&&(P=10),this.signum()==0||P<2||P>36)return"0";var N=this.chunkSize(P),V=Math.pow(P,N),Q=y(V),ve=i(),Ae=i(),Ie="";for(this.divRemTo(Q,ve,Ae);ve.signum()>0;)Ie=(V+Ae.intValue()).toString(P).substr(1)+Ie,ve.divRemTo(Q,ve,Ae);return Ae.intValue().toString(P)+Ie}function un(P,N){this.fromInt(0),N==null&&(N=10);for(var V=this.chunkSize(N),Q=Math.pow(N,V),ve=!1,Ae=0,Ie=0,Pe=0;Pe=V&&(this.dMultiply(Q),this.dAddOffset(Ie,0),Ae=0,Ie=0)}Ae>0&&(this.dMultiply(Math.pow(N,Ae)),this.dAddOffset(Ie,0)),ve&&n.ZERO.subTo(this,this)}function Ft(P,N,V){if(typeof N=="number")if(P<2)this.fromInt(1);else for(this.fromNumber(P,V),this.testBit(P-1)||this.bitwiseTo(n.ONE.shiftLeft(P-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(N);)this.dAddOffset(2,0),this.bitLength()>P&&this.subTo(n.ONE.shiftLeft(P-1),this);else{var Q=new Array,ve=P&7;Q.length=(P>>3)+1,N.nextBytes(Q),ve>0?Q[0]&=(1<0)for(V>V)!=(this.s&this.DM)>>V&&(N[ve++]=Q|this.s<=0;)V<8?(Q=(this[P]&(1<>(V+=this.DB-8)):(Q=this[P]>>(V-=8)&255,V<=0&&(V+=this.DB,--P)),Q&128&&(Q|=-256),ve==0&&(this.s&128)!=(Q&128)&&++ve,(ve>0||Q!=this.s)&&(N[ve++]=Q);return N}function De(P){return this.compareTo(P)==0}function wr(P){return this.compareTo(P)<0?this:P}function on(P){return this.compareTo(P)>0?this:P}function it(P,N,V){var Q,ve,Ae=Math.min(P.t,this.t);for(Q=0;Q>=16,N+=16),P&255||(P>>=8,N+=8),P&15||(P>>=4,N+=4),P&3||(P>>=2,N+=2),P&1||++N,N}function Tt(){for(var P=0;P=this.t?this.s!=0:(this[N]&1<>=this.DB;if(P.t>=this.DB;Q+=this.s}else{for(Q+=this.s;V>=this.DB;Q+=P.s}N.s=Q<0?-1:0,Q>0?N[V++]=Q:Q<-1&&(N[V++]=this.DV+Q),N.t=V,N.clamp()}function Fa(P){var N=i();return this.addTo(P,N),N}function re(P){var N=i();return this.subTo(P,N),N}function fe(P){var N=i();return this.multiplyTo(P,N),N}function Le(){var P=i();return this.squareTo(P),P}function Oe(P){var N=i();return this.divRemTo(P,N,null),N}function Ve(P){var N=i();return this.divRemTo(P,null,N),N}function st(P){var N=i(),V=i();return this.divRemTo(P,N,V),new Array(N,V)}function ft(P){this[this.t]=this.am(0,P-1,this,0,0,this.t),++this.t,this.clamp()}function Ir(P,N){if(P!=0){for(;this.t<=N;)this[this.t++]=0;for(this[N]+=P;this[N]>=this.DV;)this[N]-=this.DV,++N>=this.t&&(this[this.t++]=0),++this[N]}}function Ht(){}function ti(P){return P}function Gi(P,N,V){P.multiplyTo(N,V)}function ln(P,N){P.squareTo(N)}Ht.prototype.convert=ti,Ht.prototype.revert=ti,Ht.prototype.mulTo=Gi,Ht.prototype.sqrTo=ln;function Dn(P){return this.exp(P,new Ht)}function Ar(P,N,V){var Q=Math.min(this.t+P.t,N);for(V.s=0,V.t=Q;Q>0;)V[--Q]=0;var ve;for(ve=V.t-this.t;Q=0;)V[Q]=0;for(Q=Math.max(N-this.t,0);Q2*this.m.t)return P.mod(this.m);if(P.compareTo(this.m)<0)return P;var N=i();return P.copyTo(N),this.reduce(N),N}function Ls(P){return P}function Ln(P){for(P.drShiftTo(this.m.t-1,this.r2),P.t>this.m.t+1&&(P.t=this.m.t+1,P.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);P.compareTo(this.r2)<0;)P.dAddOffset(1,this.m.t+1);for(P.subTo(this.r2,P);P.compareTo(this.m)>=0;)P.subTo(this.m,P)}function Pt(P,N){P.squareTo(N),this.reduce(N)}function yr(P,N,V){P.multiplyTo(N,V),this.reduce(V)}Mr.prototype.convert=uo,Mr.prototype.revert=Ls,Mr.prototype.reduce=Ln,Mr.prototype.mulTo=yr,Mr.prototype.sqrTo=Pt;function Ze(P,N){var V=P.bitLength(),Q,ve=y(1),Ae;if(V<=0)return ve;V<18?Q=1:V<48?Q=3:V<144?Q=4:V<768?Q=5:Q=6,V<8?Ae=new xe(N):N.isEven()?Ae=new Mr(N):Ae=new Ct(N);var Ie=new Array,Pe=3,Yt=Q-1,br=(1<1){var hn=i();for(Ae.sqrTo(Ie[1],hn);Pe<=br;)Ie[Pe]=i(),Ae.mulTo(hn,Ie[Pe-2],Ie[Pe]),Pe+=2}var dn=P.t-1,Di,Du=!0,Mn=i(),pn;for(V=B(P[dn])-1;dn>=0;){for(V>=Yt?Di=P[dn]>>V-Yt&br:(Di=(P[dn]&(1<0&&(Di|=P[dn-1]>>this.DB+V-Yt)),Pe=Q;!(Di&1);)Di>>=1,--Pe;if((V-=Pe)<0&&(V+=this.DB,--dn),Du)Ie[Di].copyTo(ve),Du=!1;else{for(;Pe>1;)Ae.sqrTo(ve,Mn),Ae.sqrTo(Mn,ve),Pe-=2;Pe>0?Ae.sqrTo(ve,Mn):(pn=ve,ve=Mn,Mn=pn),Ae.mulTo(Mn,Ie[Di],ve)}for(;dn>=0&&!(P[dn]&1<0&&(N.rShiftTo(Ae,N),V.rShiftTo(Ae,V));N.signum()>0;)(ve=N.getLowestSetBit())>0&&N.rShiftTo(ve,N),(ve=V.getLowestSetBit())>0&&V.rShiftTo(ve,V),N.compareTo(V)>=0?(N.subTo(V,N),N.rShiftTo(1,N)):(V.subTo(N,V),V.rShiftTo(1,V));return Ae>0&&V.lShiftTo(Ae,V),V}function Wr(P){if(P<=0)return 0;var N=this.DV%P,V=this.s<0?P-1:0;if(this.t>0)if(N==0)V=this[0]%P;else for(var Q=this.t-1;Q>=0;--Q)V=(N*V+this[Q])%P;return V}function or(P){var N=P.isEven();if(this.isEven()&&N||P.signum()==0)return n.ZERO;for(var V=P.clone(),Q=this.clone(),ve=y(1),Ae=y(0),Ie=y(0),Pe=y(1);V.signum()!=0;){for(;V.isEven();)V.rShiftTo(1,V),N?((!ve.isEven()||!Ae.isEven())&&(ve.addTo(this,ve),Ae.subTo(P,Ae)),ve.rShiftTo(1,ve)):Ae.isEven()||Ae.subTo(P,Ae),Ae.rShiftTo(1,Ae);for(;Q.isEven();)Q.rShiftTo(1,Q),N?((!Ie.isEven()||!Pe.isEven())&&(Ie.addTo(this,Ie),Pe.subTo(P,Pe)),Ie.rShiftTo(1,Ie)):Pe.isEven()||Pe.subTo(P,Pe),Pe.rShiftTo(1,Pe);V.compareTo(Q)>=0?(V.subTo(Q,V),N&&ve.subTo(Ie,ve),Ae.subTo(Pe,Ae)):(Q.subTo(V,Q),N&&Ie.subTo(ve,Ie),Pe.subTo(Ae,Pe))}if(Q.compareTo(n.ONE)!=0)return n.ZERO;if(Pe.compareTo(P)>=0)return Pe.subtract(P);if(Pe.signum()<0)Pe.addTo(P,Pe);else return Pe;return Pe.signum()<0?Pe.add(P):Pe}var Mt=[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],Un=(1<<26)/Mt[Mt.length-1];function ri(P){var N,V=this.abs();if(V.t==1&&V[0]<=Mt[Mt.length-1]){for(N=0;N>1,P>Mt.length&&(P=Mt.length);for(var ve=i(),Ae=0;Ae>8&255,Tr[fr++]^=P>>16&255,Tr[fr++]^=P>>24&255,fr>=Hn&&(fr-=Hn)}function oo(){jl(new Date().getTime())}if(Tr==null){Tr=new Array,fr=0;var Xr;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var co=new Uint8Array(32);for(window.crypto.getRandomValues(co),Xr=0;Xr<32;++Xr)Tr[fr++]=co[Xr]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var uc=window.crypto.random(32);for(Xr=0;Xr>>8,Tr[fr++]=Xr&255;fr=0,oo()}function oc(){if(jn==null){for(oo(),jn=po(),jn.init(Tr),fr=0;fr{(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(a(s),arguments)}function r(s,u){return t.apply(null,[s].concat(u||[]))}function n(s,u){var c=1,f=s.length,d,g="",p,h,E,v,b,m,y,D;for(p=0;p=0),E.type){case"b":d=parseInt(d,10).toString(2);break;case"c":d=String.fromCharCode(parseInt(d,10));break;case"d":case"i":d=parseInt(d,10);break;case"j":d=JSON.stringify(d,null,E.width?parseInt(E.width):0);break;case"e":d=E.precision?parseFloat(d).toExponential(E.precision):parseFloat(d).toExponential();break;case"f":d=E.precision?parseFloat(d).toFixed(E.precision):parseFloat(d);break;case"g":d=E.precision?String(Number(d.toPrecision(E.precision))):parseFloat(d);break;case"o":d=(parseInt(d,10)>>>0).toString(8);break;case"s":d=String(d),d=E.precision?d.substring(0,E.precision):d;break;case"t":d=String(!!d),d=E.precision?d.substring(0,E.precision):d;break;case"T":d=Object.prototype.toString.call(d).slice(8,-1).toLowerCase(),d=E.precision?d.substring(0,E.precision):d;break;case"u":d=parseInt(d,10)>>>0;break;case"v":d=d.valueOf(),d=E.precision?d.substring(0,E.precision):d;break;case"x":d=(parseInt(d,10)>>>0).toString(16);break;case"X":d=(parseInt(d,10)>>>0).toString(16).toUpperCase();break}e.json.test(E.type)?g+=d:(e.number.test(E.type)&&(!y||E.sign)?(D=y?"+":"-",d=d.toString().replace(e.sign,"")):D="",b=E.pad_char?E.pad_char==="0"?"0":E.pad_char.charAt(1):" ",m=E.width-(D+d).length,v=E.width&&m>0?b.repeat(m):"",g+=E.align?D+d+v:b==="0"?D+v+d:v+D+d)}return g}var i=Object.create(null);function a(s){if(i[s])return i[s];for(var u=s,c,f=[],d=0;u;){if((c=e.text.exec(u))!==null)f.push(c[0]);else if((c=e.modulo.exec(u))!==null)f.push("%");else if((c=e.placeholder.exec(u))!==null){if(c[2]){d|=1;var g=[],p=c[2],h=[];if((h=e.key.exec(p))!==null)for(g.push(h[1]);(p=p.substring(h[0].length))!=="";)if((h=e.key_access.exec(p))!==null)g.push(h[1]);else if((h=e.index_access.exec(p))!==null)g.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");c[2]=g}else d|=2;if(d===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");f.push({placeholder:c[0],param_no:c[1],keys:c[2],sign:c[3],pad_char:c[4],align:c[5],width:c[6],precision:c[7],type:c[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");u=u.substring(c[0].length)}return i[s]=f}typeof md<"u"&&(md.sprintf=t,md.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var am=ce(Js=>{"use strict";var kT=Js&&Js.__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]}),NT=Js&&Js.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),$C=Js&&Js.__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)&&kT(t,e,r);return NT(t,e),t};Object.defineProperty(Js,"__esModule",{value:!0});Js.Address4=void 0;var IC=$C(tm()),Cs=$C(rm()),BC=pd(),Sf=im(),Qc=Ff(),sm=class e{constructor(t){this.groups=Cs.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=IC.isCorrect(Cs.BITS),this.isInSubnet=IC.isInSubnet,this.address=t;let r=Cs.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>Cs.BITS)throw new BC.AddressError("Invalid subnet mask.");t=t.replace(Cs.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(Cs.RE_ADDRESS))throw new BC.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 a=r.slice(i,i+2);n.push(parseInt(a,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,Qc.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r(0,Qc.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new Sf.BigInteger(this.mask()+"0".repeat(Cs.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new Sf.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new Sf.BigInteger(this.mask()+"1".repeat(Cs.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new Sf.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,Qc.sprintf)("%s.in-addr.arpa.",r)}isMulticast(){return this.isInSubnet(new e("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(Cs.BITS,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(Cs.RE_ADDRESS,(0,Qc.sprintf)('%s.%s',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};Js.Address4=sm});var um=ce(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.RE_URL_WITH_PORT=Fr.RE_URL=Fr.RE_ZONE_STRING=Fr.RE_SUBNET_STRING=Fr.RE_BAD_ADDRESS=Fr.RE_BAD_CHARACTERS=Fr.TYPES=Fr.SCOPES=Fr.GROUPS=Fr.BITS=void 0;Fr.BITS=128;Fr.GROUPS=8;Fr.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};Fr.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"};Fr.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;Fr.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;Fr.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;Fr.RE_ZONE_STRING=/%.*$/;Fr.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);Fr.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)});var om=ce(Zs=>{"use strict";Object.defineProperty(Zs,"__esModule",{value:!0});Zs.simpleGroup=Zs.spanLeadingZeroes=Zs.spanAll=Zs.spanAllZeroes=void 0;var RC=Ff();function xC(e){return e.replace(/(0+)/g,'$1')}Zs.spanAllZeroes=xC;function LT(e,t=0){return e.split("").map((n,i)=>(0,RC.sprintf)('%s',n,i+t,xC(n))).join("")}Zs.spanAll=LT;function PC(e){return e.replace(/^(0+)/,'$1')}function UT(e){return e.split(":").map(r=>PC(r)).join(":")}Zs.spanLeadingZeroes=UT;function jT(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,RC.sprintf)('%s',i+t,PC(n)))}Zs.simpleGroup=jT});var OC=ce(tn=>{"use strict";var HT=tn&&tn.__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]}),MT=tn&&tn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),qT=tn&&tn.__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)&&HT(t,e,r);return MT(t,e),t};Object.defineProperty(tn,"__esModule",{value:!0});tn.possibleElisions=tn.simpleRegularExpression=tn.ADDRESS_BOUNDARY=tn.padGroup=tn.groupPossibilities=void 0;var VT=qT(um()),el=Ff();function Ed(e){return(0,el.sprintf)("(%s)",e.join("|"))}tn.groupPossibilities=Ed;function vd(e){return e.length<4?(0,el.sprintf)("0{0,%d}%s",4-e.length,e):e}tn.padGroup=vd;tn.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function KT(e){let t=[];e.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let r=t.map(n=>e.map((i,a)=>{if(a===n){let s=a===0||a===VT.GROUPS-1?":":"";return Ed([vd(i),s])}return vd(i)}).join(":"));return r.push(e.map(vd).join(":")),Ed(r)}tn.simpleRegularExpression=KT;function zT(e,t,r){let n=t?"":":",i=r?"":":",a=[];!t&&!r&&a.push("::"),t&&r&&a.push(""),(r&&!t||!r&&t)&&a.push(":"),a.push((0,el.sprintf)("%s(:0{1,4}){1,%d}",n,e-1)),a.push((0,el.sprintf)("(0{1,4}:){1,%d}%s",e-1,i)),a.push((0,el.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let s=1;s{"use strict";var GT=Qs&&Qs.__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]}),YT=Qs&&Qs.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ad=Qs&&Qs.__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)&>(t,e,r);return YT(t,e),t};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.Address6=void 0;var TC=Ad(tm()),cm=Ad(rm()),ir=Ad(um()),lm=Ad(om()),Ho=am(),Mo=OC(),Ja=pd(),Wn=im(),Xn=Ff();function wd(e){if(!e)throw new Error("Assertion failed.")}function WT(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function XT(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'$1$2'),e=e.replace(/^(0{1,})(0)$/,'$1$2'),e}function JT(e,t){let r=[],n=[],i;for(i=0;it[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function kC(e){return(0,Xn.sprintf)("%04x",parseInt(e,16))}function NC(e){return e&255}var fm=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=TC.isInSubnet,this.isCorrect=TC.isCorrect(ir.BITS),r===void 0?this.groups=ir.GROUPS:this.groups=r,this.address=t;let n=ir.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>ir.BITS)throw new Ja.AddressError("Invalid subnet mask.");t=t.replace(ir.RE_SUBNET_STRING,"")}else if(/\//.test(t))throw new Ja.AddressError("Invalid subnet mask.");let i=ir.RE_ZONE_STRING.exec(t);i&&(this.zone=i[0],t=t.replace(ir.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;i65536)&&(n=null)):n=null,{address:new e(r),port:n}}static fromAddress4(t){let r=new Ho.Address4(t),n=ir.BITS-(cm.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 Ja.AddressError("Invalid 'ip6.arpa' form.");let i=r.split(".").reverse();for(let a=n;a>0;a--){let s=a*4;i.splice(s,0,":")}return r=i.join(""),new e(r)}microsoftTranscription(){return(0,Xn.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=ir.BITS-this.subnetMask,n=Math.abs(t-ir.BITS),i=r-n;return i<0?"0":WT(new Wn.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new Wn.BigInteger(this.mask()+"0".repeat(ir.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new Wn.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new Wn.BigInteger(this.mask()+"1".repeat(ir.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new Wn.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=ir.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(ir.TYPES))if(this.isInSubnet(new e(t)))return ir.TYPES[t];return"Global unicast"}getBits(t,r){return new Wn.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,ir.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,Xn.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t0&&(n>1&&i.push([t-n,t-1]),n=0)}n>1&&i.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let a=i.map(u=>u[1]-u[0]+1);if(i.length>0){let u=a.indexOf(Math.max(...a));r=JT(this.parsedAddress,i[u])}else r=this.parsedAddress;for(t=0;t1?"s":"",r.join("")),t.replace(ir.RE_BAD_CHARACTERS,'$1'));let n=t.match(ir.RE_BAD_ADDRESS);if(n)throw new Ja.AddressError((0,Xn.sprintf)("Address failed regex: %s",n.join("")),t.replace(ir.RE_BAD_ADDRESS,'$1'));let i=[],a=t.split("::");if(a.length===2){let s=a[0].split(":"),u=a[1].split(":");s.length===1&&s[0]===""&&(s=[]),u.length===1&&u[0]===""&&(u=[]);let c=this.groups-(s.length+u.length);if(!c)throw new Ja.AddressError("Error parsing groups");this.elidedGroups=c,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,i=i.concat(s);for(let f=0;f(0,Xn.sprintf)("%x",parseInt(s,16))),i.length!==this.groups)throw new Ja.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(kC).join(":")}decimal(){return this.parsedAddress.map(t=>(0,Xn.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new Wn.BigInteger(this.parsedAddress.map(kC).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return Ho.Address4.fromHex(new Wn.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 Wn.BigInteger("ffff",16)).toString(),n=Ho.Address4.fromHex(this.getBitsBase16(32,64)),i=Ho.Address4.fromHex(this.getBits(96,128).xor(new Wn.BigInteger("ffffffff",16)).toString(16)),a=this.getBits(64,80),s=this.getBitsBase2(64,80),u=a.testBit(15),c=a.testBit(14),f=a.testBit(8),d=a.testBit(9),g=new Wn.BigInteger(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:(0,Xn.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:s,coneNat:u,microsoft:{reserved:c,universalLocal:d,groupIndividual:f,nonce:g},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),r=Ho.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:(0,Xn.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(NC)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(NC))}static fromUnsignedByteArray(t){let r=new Wn.BigInteger("256",10),n=new Wn.BigInteger("0",10),i=new Wn.BigInteger("1",10);for(let a=t.length-1;a>=0;a--)n=n.add(i.multiply(new Wn.BigInteger(t[a].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,Xn.sprintf)(":%s",t),(0,Xn.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,Xn.sprintf)('%2$s',t.prefix,r.call(this),t.className):(0,Xn.sprintf)('%2$s',t.prefix,r.call(this))}group(){if(this.elidedGroups===0)return lm.simpleGroup(this.address).join(":");wd(typeof this.elidedGroups=="number"),wd(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...lm.simpleGroup(r)):t.push("");let i=["hover-group"];for(let a=this.elisionBegin;a',i.join(" "))),n.length?t.push(...lm.simpleGroup(n,this.elisionEnd)):t.push(""),this.is4()&&(wd(this.address4 instanceof Ho.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,Mo.simpleRegularExpression)(n.parsedAddress));else if(n.elidedGroups===ir.GROUPS)r.push((0,Mo.possibleElisions)(ir.GROUPS));else{let i=n.address.split("::");i[0].length&&r.push((0,Mo.simpleRegularExpression)(i[0].split(":"))),wd(typeof n.elidedGroups=="number"),r.push((0,Mo.possibleElisions)(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push((0,Mo.simpleRegularExpression)(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Mo.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Mo.ADDRESS_BOUNDARY,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};Qs.Address6=fm});var UC=ce(Tn=>{"use strict";var ZT=Tn&&Tn.__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]}),QT=Tn&&Tn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ek=Tn&&Tn.__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)&&ZT(t,e,r);return QT(t,e),t};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.v6=Tn.AddressError=Tn.Address6=Tn.Address4=void 0;var tk=am();Object.defineProperty(Tn,"Address4",{enumerable:!0,get:function(){return tk.Address4}});var rk=LC();Object.defineProperty(Tn,"Address6",{enumerable:!0,get:function(){return rk.Address6}});var nk=pd();Object.defineProperty(Tn,"AddressError",{enumerable:!0,get:function(){return nk.AddressError}});var ik=ek(om());Tn.v6={helpers:ik}});var WC=ce(Am=>{"use strict";Am.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};Am.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 XC=ce(ym=>{"use strict";ym.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};ym.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 JC=ce(bm=>{"use strict";bm.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};bm.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 ZC=ce(Cm=>{"use strict";Cm.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};Cm.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 QC=ce(_m=>{"use strict";_m.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}`};_m.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 r_=ce((t_,Dm)=>{var e_=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=g,e.encode=d,e.familyOf=f,e.name=void 0,e.sizeOf=c,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,a={name:"v4",size:r,isFormat:p=>t.test(p),encode(p,h,E){E=~~E,h=h||new Uint8Array(E+r);let v=p.length,b=0;for(let m=0;mp.length>0&&n.test(p),encode(p,h,E){E=~~E;let v=E+i,b=-1,m=0,y=0,D=!0,_=!1;h=h||new Uint8Array(E+i);for(let F=0;F>8),E=97?L-=87:L>=65?L-=55:(L-=48,y=y*10+L),m=(m<<4)+L)}if(D===!1)_===!0?(E>8),E=b+2;F--)h[F]=h[F-2];h[b]=0,h[b+1]=0,b=E}if(b!==E&&b!==-1)for(E>v-2&&(E=v-2);v>b;)h[--v]=Eb?h[--E]:0;else for(;E{"use strict";var qe=j0().Buffer,cu=WC(),Sk=XC(),Ik=JC(),xd=ZC(),Fm=QC(),Vo=r_(),Bk=0,n_=32768,Sm=32768,$k=~Sm,i_=32768,Rk=~i_,$e=Me.name={};$e.encode=function(e,t,r,{mail:n=!1}={}){t||(t=qe.alloc($e.encodingLength(e))),r||(r=0);let i=r,a=e.replace(/^\.|\.$/gm,"");if(a.length){let s=[];if(n){let u="";a.split(".").forEach(c=>{c.endsWith("\\")?u+=(u.length?".":"")+c.slice(0,-1):s.length===0&&u.length?s.push(u+"."+c):s.push(c)})}else s=a.split(".");for(let u=0;u=e.length)throw new Error("Cannot decode name (buffer overflow)");let c=e[t++];if(s+=u?0:1,c===0)break;if(c&192)if((c&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+=u?0:1,u=!0}else throw new Error("Cannot decode name (bad label)");else{if(t+c>e.length)throw new Error("Cannot decode name (buffer overflow)");if(a+=c+1,a>254)throw new Error("Cannot decode name (name too long)");let f=e.toString("utf-8",t,t+c);r&&(f=f.replace(/\./g,"\\.")),n.push(f),t+=c,s+=u?0:c}}return $e.decode.bytes=s,n.length===0?".":n.join(".")};$e.decode.bytes=0;$e.encodingLength=function(e){return e==="."||e===".."?1:qe.byteLength(e.replace(/^\.|\.$/gm,""))+2};var wt={};wt.encode=function(e,t,r){t||(t=qe.alloc(wt.encodingLength(e))),r||(r=0);let n=t.write(e,r+1);return t[r]=n,wt.encode.bytes=n+1,t};wt.encode.bytes=0;wt.decode=function(e,t){t||(t=0);let r=e[t],n=e.toString("utf-8",t+1,t+1+r);return wt.decode.bytes=r+1,n};wt.decode.bytes=0;wt.encodingLength=function(e){return qe.byteLength(e)+1};var Fs={};Fs.encode=function(e,t,r){t||(t=Fs.encodingLength(e)),r||(r=0);let n=(e.flags||0)&32767,i=e.type==="response"?n_:Bk;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};Fs.encode.bytes=12;Fs.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&n_?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:Ik.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:Sk.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))}};Fs.decode.bytes=12;Fs.encodingLength=function(){return 12};var eu=Me.unknown={};eu.encode=function(e,t,r){return t||(t=qe.alloc(eu.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),eu.encode.bytes=e.length+2,t};eu.encode.bytes=0;eu.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return eu.decode.bytes=r+2,n};eu.decode.bytes=0;eu.encodingLength=function(e){return e.length+2};var tu=Me.ns={};tu.encode=function(e,t,r){return t||(t=qe.alloc(tu.encodingLength(e))),r||(r=0),$e.encode(e,t,r+2),t.writeUInt16BE($e.encode.bytes,r),tu.encode.bytes=$e.encode.bytes+2,t};tu.encode.bytes=0;tu.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=$e.decode(e,t+2);return tu.decode.bytes=r+2,n};tu.decode.bytes=0;tu.encodingLength=function(e){return $e.encodingLength(e)+2};var ru=Me.soa={};ru.encode=function(e,t,r){t||(t=qe.alloc(ru.encodingLength(e))),r||(r=0);let n=r;return r+=2,$e.encode(e.mname,t,r),r+=$e.encode.bytes,$e.encode(e.rname,t,r,{mail:!0}),r+=$e.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),ru.encode.bytes=r-n,t};ru.encode.bytes=0;ru.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mname=$e.decode(e,t),t+=$e.decode.bytes,n.rname=$e.decode(e,t,{mail:!0}),t+=$e.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,ru.decode.bytes=t-r,n};ru.decode.bytes=0;ru.encodingLength=function(e){return 22+$e.encodingLength(e.mname)+$e.encodingLength(e.rname)};var nu=Me.txt={};nu.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let i=0;i0;){let a=e[t++];if(--n,n0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let a=0;a0;)n[a++]=Ei.decode(e,t),t+=Ei.decode.bytes,i-=Ei.decode.bytes;return Ui.decode.bytes=t-r,n};Ui.decode.bytes=0;Ui.encodingLength=function(e){return 2+al(e||[],Ei)};var Jn=Me.dnskey={};Jn.PROTOCOL_DNSSEC=3;Jn.ZONE_KEY=128;Jn.SECURE_ENTRYPOINT=32768;Jn.encode=function(e,t,r){t||(t=qe.alloc(Jn.encodingLength(e))),r||(r=0);let n=r,i=e.key;if(!qe.isBuffer(i))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(Jn.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,Jn.encode.bytes=r-n,t.writeUInt16BE(Jn.encode.bytes-2,n),t};Jn.encode.bytes=0;Jn.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)!==Jn.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,Jn.decode.bytes=t-r,n};Jn.decode.bytes=0;Jn.encodingLength=function(e){return 6+qe.byteLength(e.key)};var na=Me.rrsig={};na.encode=function(e,t,r){t||(t=qe.alloc(na.encodingLength(e))),r||(r=0);let n=r,i=e.signature;if(!qe.isBuffer(i))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(cu.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,$e.encode(e.signersName,t,r),r+=$e.encode.bytes,i.copy(t,r,0,i.length),r+=i.length,na.encode.bytes=r-n,t.writeUInt16BE(na.encode.bytes-2,n),t};na.encode.bytes=0;na.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.typeCovered=cu.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=$e.decode(e,t),t+=$e.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,na.decode.bytes=t-r,n};na.decode.bytes=0;na.encodingLength=function(e){return 20+$e.encodingLength(e.signersName)+qe.byteLength(e.signature)};var ia=Me.rp={};ia.encode=function(e,t,r){t||(t=qe.alloc(ia.encodingLength(e))),r||(r=0);let n=r;return r+=2,$e.encode(e.mbox||".",t,r,{mail:!0}),r+=$e.encode.bytes,$e.encode(e.txt||".",t,r),r+=$e.encode.bytes,ia.encode.bytes=r-n,t.writeUInt16BE(ia.encode.bytes-2,n),t};ia.encode.bytes=0;ia.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=$e.decode(e,t,{mail:!0})||".",t+=$e.decode.bytes,n.txt=$e.decode(e,t)||".",t+=$e.decode.bytes,ia.decode.bytes=t-r,n};ia.decode.bytes=0;ia.encodingLength=function(e){return 2+$e.encodingLength(e.mbox||".")+$e.encodingLength(e.txt||".")};var nn={};nn.encode=function(e,t,r){t||(t=qe.alloc(nn.encodingLength(e))),r||(r=0);let n=r;for(var i=[],a=0;a>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(a=0;a>8]=Math.max(t[n>>8]||0,n&255)}var i=0;for(r=0;r>15&1)===1,r.options=Ui.decode(e,t+8),t+=8+Ui.decode.bytes;else{let i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=xd.toString(i&$k),r.flush=!!(i&Sm);let a=Im(r.type);r.data=a.decode(e,t+8),t+=8+a.decode.bytes}return An.decode.bytes=t-n,r};An.decode.bytes=0;An.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return $e.encodingLength(e.name)+8+Im(e.type).encodingLength(t)};var Ds=Me.question={};Ds.encode=function(e,t,r){t||(t=qe.alloc(Ds.encodingLength(e))),r||(r=0);let n=r;return $e.encode(e.name,t,r),r+=$e.encode.bytes,t.writeUInt16BE(cu.toType(e.type),r),r+=2,t.writeUInt16BE(xd.toClass(e.class===void 0?"IN":e.class),r),r+=2,Ds.encode.bytes=r-n,e};Ds.encode.bytes=0;Ds.decode=function(e,t){t||(t=0);let r=t,n={};return n.name=$e.decode(e,t),t+=$e.decode.bytes,n.type=cu.toString(e.readUInt16BE(t)),t+=2,n.class=xd.toString(e.readUInt16BE(t)),t+=2,!!(n.class&i_)&&(n.class&=Rk),Ds.decode.bytes=t-r,n};Ds.decode.bytes=0;Ds.encodingLength=function(e){return $e.encodingLength(e.name)+4};Me.AUTHORITATIVE_ANSWER=1024;Me.TRUNCATED_RESPONSE=512;Me.RECURSION_DESIRED=256;Me.RECURSION_AVAILABLE=128;Me.AUTHENTIC_DATA=32;Me.CHECKING_DISABLED=16;Me.DNSSEC_OK=32768;Me.encode=function(e,t,r){let n=!t;n&&(t=qe.alloc(Me.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=[]),Fs.encode(e,t,r),r+=Fs.encode.bytes,r=Pf(e.questions,Ds,t,r),r=Pf(e.answers,An,t,r),r=Pf(e.authorities,An,t,r),r=Pf(e.additionals,An,t,r),Me.encode.bytes=r-i,n&&Me.encode.bytes!==t.length?t.slice(0,Me.encode.bytes):t};Me.encode.bytes=0;Me.decode=function(e,t){t||(t=0);let r=t,n=Fs.decode(e,t);return t+=Fs.decode.bytes,t=Rd(n.questions,Ds,e,t),t=Rd(n.answers,An,e,t),t=Rd(n.authorities,An,e,t),t=Rd(n.additionals,An,e,t),Me.decode.bytes=t-r,n};Me.decode.bytes=0;Me.encodingLength=function(e){return Fs.encodingLength(e)+al(e.questions||[],Ds)+al(e.answers||[],An)+al(e.authorities||[],An)+al(e.additionals||[],An)};Me.streamEncode=function(e){let t=Me.encode(e),r=qe.alloc(2);r.writeUInt16BE(t.byteLength);let n=qe.concat([r,t]);return Me.streamEncode.bytes=n.byteLength,n};Me.streamEncode.bytes=0;Me.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength{(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",a="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",u=500,c="__lodash_placeholder__",f=1,d=2,g=4,p=1,h=2,E=1,v=2,b=4,m=8,y=16,D=32,_=64,F=128,L=256,k=512,S=30,B="...",O=800,x=16,U=1,Y=2,H=3,K=1/0,W=9007199254740991,ie=17976931348623157e292,_e=NaN,Fe=4294967295,xe=Fe-1,rt=Fe>>>1,tt=[["ary",F],["bind",E],["bindKey",v],["curry",m],["curryRight",y],["flip",k],["partial",D],["partialRight",_],["rearg",L]],ct="[object Arguments]",lt="[object Array]",sn="[object AsyncFunction]",nr="[object Boolean]",Ct="[object Date]",Er="[object DOMException]",sr="[object Error]",dt="[object Function]",zt="[object GeneratorFunction]",nt="[object Map]",Ke="[object Number]",ar="[object Null]",He="[object Object]",Ot="[object Promise]",an="[object Proxy]",er="[object RegExp]",Gt="[object Set]",vt="[object String]",Or="[object Symbol]",_i="[object Undefined]",un="[object WeakMap]",Ft="[object WeakSet]",Ue="[object ArrayBuffer]",De="[object DataView]",wr="[object Float32Array]",on="[object Float64Array]",it="[object Int8Array]",Da="[object Int16Array]",cn="[object Int32Array]",ge="[object Uint8Array]",Ps="[object Uint8ClampedArray]",Rt="[object Uint16Array]",Yr="[object Uint32Array]",ds=/\b__p \+= '';/g,Au=/\b(__p \+=) '' \+/g,Os=/(__e\(.*?\)|\b__t\)) \+\n'';/g,yu=/&(?:amp|lt|gt|quot|#39);/g,Ts=/[&<>"']/g,ps=RegExp(yu.source),Tt=RegExp(Ts.source),ei=/<%-([\s\S]+?)%>/g,bu=/<%([\s\S]+?)%>/g,Cu=/<%=([\s\S]+?)%>/g,_u=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ks=/^\w*$/,so=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ns=/[\\^$.*+?()[\]{}|]/g,ao=RegExp(Ns.source),Fa=/^\s+/,re=/\s/,fe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Le=/\{\n\/\* \[wrapped with (.+)\] \*/,Oe=/,? & /,Ve=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,st=/[()=,{}\[\]\/\s]/,ft=/\\(\\)?/g,Ir=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ht=/\w*$/,ti=/^[-+]0x[0-9a-f]+$/i,Gi=/^0b[01]+$/i,ln=/^\[object .+?Constructor\]$/,Dn=/^0o[0-7]+$/i,Ar=/^(?:0|[1-9]\d*)$/,fn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Mr=/($^)/,uo=/['\n\r\u2028\u2029\\]/g,Ls="\\ud800-\\udfff",Ln="\\u0300-\\u036f",Pt="\\ufe20-\\ufe2f",yr="\\u20d0-\\u20ff",Ze=Ln+Pt+yr,ur="\\u2700-\\u27bf",Wr="a-z\\xdf-\\xf6\\xf8-\\xff",or="\\xac\\xb1\\xd7\\xf7",Mt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Un="\\u2000-\\u206f",ri=" \\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",ni="A-Z\\xc0-\\xd6\\xd8-\\xde",jn="\\ufe0e\\ufe0f",Tr=or+Mt+Un+ri,fr="['\u2019]",jl="["+Ls+"]",oo="["+Tr+"]",Xr="["+Ze+"]",co="\\d+",uc="["+ur+"]",oc="["+Wr+"]",lo="[^"+Ls+Tr+co+ur+Wr+ni+"]",Us="\\ud83c[\\udffb-\\udfff]",fo="(?:"+Xr+"|"+Us+")",cc="[^"+Ls+"]",ho="(?:\\ud83c[\\udde6-\\uddff]){2}",po="[\\ud800-\\udbff][\\udc00-\\udfff]",Hn="["+ni+"]",P="\\u200d",N="(?:"+oc+"|"+lo+")",V="(?:"+Hn+"|"+lo+")",Q="(?:"+fr+"(?:d|ll|m|re|s|t|ve))?",ve="(?:"+fr+"(?:D|LL|M|RE|S|T|VE))?",Ae=fo+"?",Ie="["+jn+"]?",Pe="(?:"+P+"(?:"+[cc,ho,po].join("|")+")"+Ie+Ae+")*",Yt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",br="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",hn=Ie+Ae+Pe,dn="(?:"+[uc,ho,po].join("|")+")"+hn,Di="(?:"+[cc+Xr+"?",Xr,ho,po,jl].join("|")+")",Du=RegExp(fr,"g"),Mn=RegExp(Xr,"g"),pn=RegExp(Us+"(?="+Us+")|"+Di+hn,"g"),Fu=RegExp([Hn+"?"+oc+"+"+Q+"(?="+[oo,Hn,"$"].join("|")+")",V+"+"+ve+"(?="+[oo,Hn+N,"$"].join("|")+")",Hn+"?"+N+"+"+Q,Hn+"+"+ve,br,Yt,co,dn].join("|"),"g"),Yi=RegExp("["+P+Ls+Ze+jn+"]"),go=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Tp=["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"],kp=-1,tr={};tr[wr]=tr[on]=tr[it]=tr[Da]=tr[cn]=tr[ge]=tr[Ps]=tr[Rt]=tr[Yr]=!0,tr[ct]=tr[lt]=tr[Ue]=tr[nr]=tr[De]=tr[Ct]=tr[sr]=tr[dt]=tr[nt]=tr[Ke]=tr[He]=tr[er]=tr[Gt]=tr[vt]=tr[un]=!1;var Jt={};Jt[ct]=Jt[lt]=Jt[Ue]=Jt[De]=Jt[nr]=Jt[Ct]=Jt[wr]=Jt[on]=Jt[it]=Jt[Da]=Jt[cn]=Jt[nt]=Jt[Ke]=Jt[He]=Jt[er]=Jt[Gt]=Jt[vt]=Jt[Or]=Jt[ge]=Jt[Ps]=Jt[Rt]=Jt[Yr]=!0,Jt[sr]=Jt[dt]=Jt[un]=!1;var Np={\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"},Lp={"&":"&","<":"<",">":">",'"':""","'":"'"},Up={"&":"&","<":"<",">":">",""":'"',"'":"'"},jp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Hp=parseFloat,Mp=parseInt,Rh=typeof global=="object"&&global&&global.Object===Object&&global,qp=typeof self=="object"&&self&&self.Object===Object&&self,kr=Rh||qp||Function("return this")(),Hl=typeof ol=="object"&&ol&&!ol.nodeType&&ol,Sa=Hl&&typeof Of=="object"&&Of&&!Of.nodeType&&Of,xh=Sa&&Sa.exports===Hl,Ml=xh&&Rh.process,ii=function(){try{var ne=Sa&&Sa.require&&Sa.require("util").types;return ne||Ml&&Ml.binding&&Ml.binding("util")}catch{}}(),Ph=ii&&ii.isArrayBuffer,Oh=ii&&ii.isDate,Th=ii&&ii.isMap,kh=ii&&ii.isRegExp,Nh=ii&&ii.isSet,Lh=ii&&ii.isTypedArray;function qn(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 Vp(ne,he,oe,Te){for(var Qe=-1,St=ne==null?0:ne.length;++Qe-1}function mo(ne,he,oe){for(var Te=-1,Qe=ne==null?0:ne.length;++Te-1;);return oe}function Mh(ne,he){for(var oe=ne.length;oe--&&Su(he,ne[oe],0)>-1;);return oe}function qh(ne,he){for(var oe=ne.length,Te=0;oe--;)ne[oe]===he&&++Te;return Te}var Yl=me(Np),Gp=me(Lp);function Vh(ne){return"\\"+jp[ne]}function Yp(ne,he){return ne==null?e:ne[he]}function Ba(ne){return Yi.test(ne)}function Wp(ne){return go.test(ne)}function Xp(ne){for(var he,oe=[];!(he=ne.next()).done;)oe.push(he.value);return oe}function Wl(ne){var he=-1,oe=Array(ne.size);return ne.forEach(function(Te,Qe){oe[++he]=[Qe,Te]}),oe}function gn(ne,he){return function(oe){return ne(he(oe))}}function Ii(ne,he){for(var oe=-1,Te=ne.length,Qe=0,St=[];++oe-1}function X5(o,l){var A=this.__data__,I=r0(A,o);return I<0?(++this.size,A.push([o,l])):A[I][1]=l,this}Oa.prototype.clear=z5,Oa.prototype.delete=G5,Oa.prototype.get=Y5,Oa.prototype.has=W5,Oa.prototype.set=X5;function Ta(o){var l=-1,A=o==null?0:o.length;for(this.clear();++l=l?o:l)),o}function Zi(o,l,A,I,T,q){var X,Z=l&f,se=l&d,Ee=l&g;if(A&&(X=T?A(o,I,T,q):A(o)),X!==e)return X;if(!gr(o))return o;var we=ut(o);if(we){if(X=eS(o),!Z)return oi(o,X)}else{var ye=In(o),Be=ye==dt||ye==zt;if(xu(o))return LE(o,Z);if(ye==He||ye==ct||Be&&!T){if(X=se||Be?{}:nw(o),!Z)return se?qF(o,hF(X,o)):MF(o,pE(X,o))}else{if(!Jt[ye])return T?o:{};X=tS(o,ye,Z)}}q||(q=new ms);var je=q.get(o);if(je)return je;q.set(o,X),xw(o)?o.forEach(function(Je){X.add(Zi(Je,l,A,Je,o,q))}):$w(o)&&o.forEach(function(Je,yt){X.set(yt,Zi(Je,l,A,yt,o,q))});var Xe=Ee?se?B1:I1:se?li:Jr,gt=we?e:Xe(o);return si(gt||o,function(Je,yt){gt&&(yt=Je,Je=o[yt]),ef(X,yt,Zi(Je,l,A,yt,o,q))}),X}function dF(o){var l=Jr(o);return function(A){return gE(A,o,l)}}function gE(o,l,A){var I=A.length;if(o==null)return!I;for(o=Wt(o);I--;){var T=A[I],q=l[T],X=o[T];if(X===e&&!(T in o)||!q(X))return!1}return!0}function mE(o,l,A){if(typeof o!="function")throw new ui(i);return of(function(){o.apply(e,A)},l)}function tf(o,l,A,I){var T=-1,q=Vn,X=!0,Z=o.length,se=[],Ee=l.length;if(!Z)return se;A&&(l=te(l,Fn(A))),I?(q=mo,X=!1):l.length>=r&&(q=Eo,X=!1,l=new Ao(l));e:for(;++TT?0:T+A),I=I===e||I>T?T:pt(I),I<0&&(I+=T),I=A>I?0:Ow(I);A0&&A(Z)?l>1?mn(Z,l-1,A,I,T):Si(T,Z):I||(T[T.length]=Z)}return T}var l1=VE(),wE=VE(!0);function Hs(o,l){return o&&l1(o,l,Jr)}function f1(o,l){return o&&wE(o,l,Jr)}function i0(o,l){return Fi(l,function(A){return ja(o[A])})}function bo(o,l){l=$u(l,o);for(var A=0,I=l.length;o!=null&&Al}function mF(o,l){return o!=null&&xt.call(o,l)}function vF(o,l){return o!=null&&l in Wt(o)}function EF(o,l,A){return o>=Sn(l,A)&&o=120&&we.length>=120)?new Ao(X&&we):e}we=o[0];var ye=-1,Be=Z[0];e:for(;++ye-1;)Z!==o&&Lt.call(Z,se,1),Lt.call(o,se,1);return o}function $E(o,l){for(var A=o?l.length:0,I=A-1;A--;){var T=l[A];if(A==I||T!==q){var q=T;Ua(T)?Lt.call(o,T,1):y1(o,T)}}return o}function E1(o,l){return o+ae(lE()*(l-o+1))}function RF(o,l,A,I){for(var T=-1,q=qr(z((l-o)/(A||1)),0),X=oe(q);q--;)X[I?q:++T]=o,o+=A;return X}function w1(o,l){var A="";if(!o||l<1||l>W)return A;do l%2&&(A+=o),l=ae(l/2),l&&(o+=o);while(l);return A}function Et(o,l){return k1(aw(o,l,fi),o+"")}function xF(o){return dE($c(o))}function PF(o,l){var A=$c(o);return g0(A,yo(l,0,A.length))}function sf(o,l,A,I){if(!gr(o))return o;l=$u(l,o);for(var T=-1,q=l.length,X=q-1,Z=o;Z!=null&&++TT?0:T+l),A=A>T?T:A,A<0&&(A+=T),T=l>A?0:A-l>>>0,l>>>=0;for(var q=oe(T);++I>>1,X=o[q];X!==null&&!Ri(X)&&(A?X<=l:X=r){var Ee=l?null:GF(o);if(Ee)return Bi(Ee);X=!1,T=Eo,se=new Ao}else se=l?[]:Z;e:for(;++I=I?o:Qi(o,l,A)}var NE=C||function(o){return kr.clearTimeout(o)};function LE(o,l){if(l)return o.slice();var A=o.length,I=Wh?Wh(A):new o.constructor(A);return o.copy(I),I}function D1(o){var l=new o.constructor(o.byteLength);return new Ac(l).set(new Ac(o)),l}function LF(o,l){var A=l?D1(o.buffer):o.buffer;return new o.constructor(A,o.byteOffset,o.byteLength)}function UF(o){var l=new o.constructor(o.source,Ht.exec(o));return l.lastIndex=o.lastIndex,l}function jF(o){return Ql?Wt(Ql.call(o)):{}}function UE(o,l){var A=l?D1(o.buffer):o.buffer;return new o.constructor(A,o.byteOffset,o.length)}function jE(o,l){if(o!==l){var A=o!==e,I=o===null,T=o===o,q=Ri(o),X=l!==e,Z=l===null,se=l===l,Ee=Ri(l);if(!Z&&!Ee&&!q&&o>l||q&&X&&se&&!Z&&!Ee||I&&X&&se||!A&&se||!T)return 1;if(!I&&!q&&!Ee&&o=Z)return se;var Ee=A[I];return se*(Ee=="desc"?-1:1)}}return o.index-l.index}function HE(o,l,A,I){for(var T=-1,q=o.length,X=A.length,Z=-1,se=l.length,Ee=qr(q-X,0),we=oe(se+Ee),ye=!I;++Z1?A[T-1]:e,X=T>2?A[2]:e;for(q=o.length>3&&typeof q=="function"?(T--,q):e,X&&zn(A[0],A[1],X)&&(q=T<3?e:q,T=1),l=Wt(l);++I-1?T[q?l[X]:X]:e}}function GE(o){return La(function(l){var A=l.length,I=A,T=Ji.prototype.thru;for(o&&l.reverse();I--;){var q=l[I];if(typeof q!="function")throw new ui(i);if(T&&!X&&d0(q)=="wrapper")var X=new Ji([],!0)}for(I=X?I:A;++I1&&It.reverse(),we&&seZ))return!1;var Ee=q.get(o),we=q.get(l);if(Ee&&we)return Ee==l&&we==o;var ye=-1,Be=!0,je=A&h?new Ao:e;for(q.set(o,l),q.set(l,o);++ye1?"& ":"")+l[I],l=l.join(A>2?", ":" "),o.replace(fe,`{ /* [wrapped with `+l+`] */ `)}function nS(o){return ut(o)||Do(o)||!!(Zh&&o&&o[Zh])}function Ua(o,l){var A=typeof o;return l=l??W,!!l&&(A=="number"||A!="symbol"&&Ar.test(o))&&o>-1&&o%1==0&&o0){if(++l>=O)return arguments[0]}else l=0;return o.apply(e,arguments)}}function g0(o,l){var A=-1,I=o.length,T=I-1;for(l=l===e?I:l;++A1?o[l-1]:e;return A=typeof A=="function"?(o.pop(),A):e,Ew(o,A)});function ww(o){var l=M(o);return l.__chain__=!0,l}function p8(o,l){return l(o),o}function m0(o,l){return l(o)}var g8=La(function(o){var l=o.length,A=l?o[0]:0,I=this.__wrapped__,T=function(q){return c1(q,o)};return l>1||this.__actions__.length||!(I instanceof _t)||!Ua(A)?this.thru(T):(I=I.slice(A,+A+(l?1:0)),I.__actions__.push({func:m0,args:[T],thisArg:e}),new Ji(I,this.__chain__).thru(function(q){return l&&!q.length&&q.push(e),q}))});function m8(){return ww(this)}function v8(){return new Ji(this.value(),this.__chain__)}function E8(){this.__values__===e&&(this.__values__=Pw(this.value()));var o=this.__index__>=this.__values__.length,l=o?e:this.__values__[this.__index__++];return{done:o,value:l}}function w8(){return this}function A8(o){for(var l,A=this;A instanceof t0;){var I=hw(A);I.__index__=0,I.__values__=e,l?T.__wrapped__=I:l=I;var T=I;A=A.__wrapped__}return T.__wrapped__=o,l}function y8(){var o=this.__wrapped__;if(o instanceof _t){var l=o;return this.__actions__.length&&(l=new _t(this)),l=l.reverse(),l.__actions__.push({func:m0,args:[N1],thisArg:e}),new Ji(l,this.__chain__)}return this.thru(N1)}function b8(){return TE(this.__wrapped__,this.__actions__)}var C8=o0(function(o,l,A){xt.call(o,A)?++o[A]:ka(o,A,1)});function _8(o,l,A){var I=ut(o)?at:pF;return A&&zn(o,l,A)&&(l=e),I(o,Ye(l,3))}function D8(o,l){var A=ut(o)?Fi:EE;return A(o,Ye(l,3))}var F8=zE(dw),S8=zE(pw);function I8(o,l){return mn(v0(o,l),1)}function B8(o,l){return mn(v0(o,l),K)}function $8(o,l,A){return A=A===e?1:pt(A),mn(v0(o,l),A)}function Aw(o,l){var A=ut(o)?si:Iu;return A(o,Ye(l,3))}function yw(o,l){var A=ut(o)?R:vE;return A(o,Ye(l,3))}var R8=o0(function(o,l,A){xt.call(o,A)?o[A].push(l):ka(o,A,[l])});function x8(o,l,A,I){o=ci(o)?o:$c(o),A=A&&!I?pt(A):0;var T=o.length;return A<0&&(A=qr(T+A,0)),b0(o)?A<=T&&o.indexOf(l,A)>-1:!!T&&Su(o,l,A)>-1}var P8=Et(function(o,l,A){var I=-1,T=typeof l=="function",q=ci(o)?oe(o.length):[];return Iu(o,function(X){q[++I]=T?qn(l,X,A):rf(X,l,A)}),q}),O8=o0(function(o,l,A){ka(o,A,l)});function v0(o,l){var A=ut(o)?te:_E;return A(o,Ye(l,3))}function T8(o,l,A,I){return o==null?[]:(ut(l)||(l=l==null?[]:[l]),A=I?e:A,ut(A)||(A=A==null?[]:[A]),IE(o,l,A))}var k8=o0(function(o,l,A){o[A?0:1].push(l)},function(){return[[],[]]});function N8(o,l,A){var I=ut(o)?ql:jh,T=arguments.length<3;return I(o,Ye(l,4),A,T,Iu)}function L8(o,l,A){var I=ut(o)?oE:jh,T=arguments.length<3;return I(o,Ye(l,4),A,T,vE)}function U8(o,l){var A=ut(o)?Fi:EE;return A(o,A0(Ye(l,3)))}function j8(o){var l=ut(o)?dE:xF;return l(o)}function H8(o,l,A){(A?zn(o,l,A):l===e)?l=1:l=pt(l);var I=ut(o)?cF:PF;return I(o,l)}function M8(o){var l=ut(o)?lF:TF;return l(o)}function q8(o){if(o==null)return 0;if(ci(o))return b0(o)?$a(o):o.length;var l=In(o);return l==nt||l==Gt?o.size:g1(o).length}function V8(o,l,A){var I=ut(o)?Uh:kF;return A&&zn(o,l,A)&&(l=e),I(o,Ye(l,3))}var K8=Et(function(o,l){if(o==null)return[];var A=l.length;return A>1&&zn(o,l[0],l[1])?l=[]:A>2&&zn(l[0],l[1],l[2])&&(l=[l[0]]),IE(o,mn(l,1),[])}),E0=j||function(){return kr.Date.now()};function z8(o,l){if(typeof l!="function")throw new ui(i);return o=pt(o),function(){if(--o<1)return l.apply(this,arguments)}}function bw(o,l,A){return l=A?e:l,l=o&&l==null?o.length:l,Na(o,F,e,e,e,e,l)}function Cw(o,l){var A;if(typeof l!="function")throw new ui(i);return o=pt(o),function(){return--o>0&&(A=l.apply(this,arguments)),o<=1&&(l=e),A}}var U1=Et(function(o,l,A){var I=E;if(A.length){var T=Ii(A,Ic(U1));I|=D}return Na(o,I,l,A,T)}),_w=Et(function(o,l,A){var I=E|v;if(A.length){var T=Ii(A,Ic(_w));I|=D}return Na(l,I,o,A,T)});function Dw(o,l,A){l=A?e:l;var I=Na(o,m,e,e,e,e,e,l);return I.placeholder=Dw.placeholder,I}function Fw(o,l,A){l=A?e:l;var I=Na(o,y,e,e,e,e,e,l);return I.placeholder=Fw.placeholder,I}function Sw(o,l,A){var I,T,q,X,Z,se,Ee=0,we=!1,ye=!1,Be=!0;if(typeof o!="function")throw new ui(i);l=ts(l)||0,gr(A)&&(we=!!A.leading,ye="maxWait"in A,q=ye?qr(ts(A.maxWait)||0,l):q,Be="trailing"in A?!!A.trailing:Be);function je($r){var Es=I,Ma=T;return I=T=e,Ee=$r,X=o.apply(Ma,Es),X}function Xe($r){return Ee=$r,Z=of(yt,l),we?je($r):X}function gt($r){var Es=$r-se,Ma=$r-Ee,zw=l-Es;return ye?Sn(zw,q-Ma):zw}function Je($r){var Es=$r-se,Ma=$r-Ee;return se===e||Es>=l||Es<0||ye&&Ma>=q}function yt(){var $r=E0();if(Je($r))return It($r);Z=of(yt,gt($r))}function It($r){return Z=e,Be&&I?je($r):(I=T=e,X)}function xi(){Z!==e&&NE(Z),Ee=0,I=se=T=Z=e}function Gn(){return Z===e?X:It(E0())}function Pi(){var $r=E0(),Es=Je($r);if(I=arguments,T=this,se=$r,Es){if(Z===e)return Xe(se);if(ye)return NE(Z),Z=of(yt,l),je(se)}return Z===e&&(Z=of(yt,l)),X}return Pi.cancel=xi,Pi.flush=Gn,Pi}var G8=Et(function(o,l){return mE(o,1,l)}),Y8=Et(function(o,l,A){return mE(o,ts(l)||0,A)});function W8(o){return Na(o,k)}function w0(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new ui(i);var A=function(){var I=arguments,T=l?l.apply(this,I):I[0],q=A.cache;if(q.has(T))return q.get(T);var X=o.apply(this,I);return A.cache=q.set(T,X)||q,X};return A.cache=new(w0.Cache||Ta),A}w0.Cache=Ta;function A0(o){if(typeof o!="function")throw new ui(i);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function X8(o){return Cw(2,o)}var J8=NF(function(o,l){l=l.length==1&&ut(l[0])?te(l[0],Fn(Ye())):te(mn(l,1),Fn(Ye()));var A=l.length;return Et(function(I){for(var T=-1,q=Sn(I.length,A);++T=l}),Do=yE(function(){return arguments}())?yE:function(o){return _r(o)&&xt.call(o,"callee")&&!Jh.call(o,"callee")},ut=oe.isArray,hI=Ph?Fn(Ph):AF;function ci(o){return o!=null&&y0(o.length)&&!ja(o)}function Br(o){return _r(o)&&ci(o)}function dI(o){return o===!0||o===!1||_r(o)&&Kn(o)==nr}var xu=Xt||J1,pI=Oh?Fn(Oh):yF;function gI(o){return _r(o)&&o.nodeType===1&&!cf(o)}function mI(o){if(o==null)return!0;if(ci(o)&&(ut(o)||typeof o=="string"||typeof o.splice=="function"||xu(o)||Bc(o)||Do(o)))return!o.length;var l=In(o);if(l==nt||l==Gt)return!o.size;if(uf(o))return!g1(o).length;for(var A in o)if(xt.call(o,A))return!1;return!0}function vI(o,l){return nf(o,l)}function EI(o,l,A){A=typeof A=="function"?A:e;var I=A?A(o,l):e;return I===e?nf(o,l,e,A):!!I}function H1(o){if(!_r(o))return!1;var l=Kn(o);return l==sr||l==Er||typeof o.message=="string"&&typeof o.name=="string"&&!cf(o)}function wI(o){return typeof o=="number"&&Cr(o)}function ja(o){if(!gr(o))return!1;var l=Kn(o);return l==dt||l==zt||l==sn||l==an}function Bw(o){return typeof o=="number"&&o==pt(o)}function y0(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=W}function gr(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function _r(o){return o!=null&&typeof o=="object"}var $w=Th?Fn(Th):CF;function AI(o,l){return o===l||p1(o,l,R1(l))}function yI(o,l,A){return A=typeof A=="function"?A:e,p1(o,l,R1(l),A)}function bI(o){return Rw(o)&&o!=+o}function CI(o){if(aS(o))throw new Qe(n);return bE(o)}function _I(o){return o===null}function DI(o){return o==null}function Rw(o){return typeof o=="number"||_r(o)&&Kn(o)==Ke}function cf(o){if(!_r(o)||Kn(o)!=He)return!1;var l=yc(o);if(l===null)return!0;var A=xt.call(l,"constructor")&&l.constructor;return typeof A=="function"&&A instanceof A&&mc.call(A)==n1}var M1=kh?Fn(kh):_F;function FI(o){return Bw(o)&&o>=-W&&o<=W}var xw=Nh?Fn(Nh):DF;function b0(o){return typeof o=="string"||!ut(o)&&_r(o)&&Kn(o)==vt}function Ri(o){return typeof o=="symbol"||_r(o)&&Kn(o)==Or}var Bc=Lh?Fn(Lh):FF;function SI(o){return o===e}function II(o){return _r(o)&&In(o)==un}function BI(o){return _r(o)&&Kn(o)==Ft}var $I=h0(m1),RI=h0(function(o,l){return o<=l});function Pw(o){if(!o)return[];if(ci(o))return b0(o)?ai(o):oi(o);if(xa&&o[xa])return Xp(o[xa]());var l=In(o),A=l==nt?Wl:l==Gt?Bi:$c;return A(o)}function Ha(o){if(!o)return o===0?o:0;if(o=ts(o),o===K||o===-K){var l=o<0?-1:1;return l*ie}return o===o?o:0}function pt(o){var l=Ha(o),A=l%1;return l===l?A?l-A:l:0}function Ow(o){return o?yo(pt(o),0,Fe):0}function ts(o){if(typeof o=="number")return o;if(Ri(o))return _e;if(gr(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=gr(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=Gl(o);var A=Gi.test(o);return A||Dn.test(o)?Mp(o.slice(2),A?2:8):ti.test(o)?_e:+o}function Tw(o){return Ms(o,li(o))}function xI(o){return o?yo(pt(o),-W,W):o===0?o:0}function qt(o){return o==null?"":$i(o)}var PI=Fc(function(o,l){if(uf(l)||ci(l)){Ms(l,Jr(l),o);return}for(var A in l)xt.call(l,A)&&ef(o,A,l[A])}),kw=Fc(function(o,l){Ms(l,li(l),o)}),C0=Fc(function(o,l,A,I){Ms(l,li(l),o,I)}),OI=Fc(function(o,l,A,I){Ms(l,Jr(l),o,I)}),TI=La(c1);function kI(o,l){var A=Dc(o);return l==null?A:pE(A,l)}var NI=Et(function(o,l){o=Wt(o);var A=-1,I=l.length,T=I>2?l[2]:e;for(T&&zn(l[0],l[1],T)&&(I=1);++A1),q}),Ms(o,B1(o),A),I&&(A=Zi(A,f|d|g,YF));for(var T=l.length;T--;)y1(A,l[T]);return A});function tB(o,l){return Lw(o,A0(Ye(l)))}var rB=La(function(o,l){return o==null?{}:BF(o,l)});function Lw(o,l){if(o==null)return{};var A=te(B1(o),function(I){return[I]});return l=Ye(l),BE(o,A,function(I,T){return l(I,T[0])})}function nB(o,l,A){l=$u(l,o);var I=-1,T=l.length;for(T||(T=1,o=e);++Il){var I=o;o=l,l=I}if(A||o%1||l%1){var T=lE();return Sn(o+T*(l-o+Hp("1e-"+((T+"").length-1))),l)}return E1(o,l)}var pB=Sc(function(o,l,A){return l=l.toLowerCase(),o+(A?Hw(l):l)});function Hw(o){return K1(qt(o).toLowerCase())}function Mw(o){return o=qt(o),o&&o.replace(fn,Yl).replace(Mn,"")}function gB(o,l,A){o=qt(o),l=$i(l);var I=o.length;A=A===e?I:yo(pt(A),0,I);var T=A;return A-=l.length,A>=0&&o.slice(A,T)==l}function mB(o){return o=qt(o),o&&Tt.test(o)?o.replace(Ts,Gp):o}function vB(o){return o=qt(o),o&&ao.test(o)?o.replace(Ns,"\\$&"):o}var EB=Sc(function(o,l,A){return o+(A?"-":"")+l.toLowerCase()}),wB=Sc(function(o,l,A){return o+(A?" ":"")+l.toLowerCase()}),AB=KE("toLowerCase");function yB(o,l,A){o=qt(o),l=pt(l);var I=l?$a(o):0;if(!l||I>=l)return o;var T=(l-I)/2;return f0(ae(T),A)+o+f0(z(T),A)}function bB(o,l,A){o=qt(o),l=pt(l);var I=l?$a(o):0;return l&&I>>0,A?(o=qt(o),o&&(typeof l=="string"||l!=null&&!M1(l))&&(l=$i(l),!l&&Ba(o))?Ru(ai(o),0,A):o.split(l,A)):[]}var BB=Sc(function(o,l,A){return o+(A?" ":"")+K1(l)});function $B(o,l,A){return o=qt(o),A=A==null?0:yo(pt(A),0,o.length),l=$i(l),o.slice(A,A+l.length)==l}function RB(o,l,A){var I=M.templateSettings;A&&zn(o,l,A)&&(l=e),o=qt(o),l=C0({},l,I,ZE);var T=C0({},l.imports,I.imports,ZE),q=Jr(T),X=vo(T,q),Z,se,Ee=0,we=l.interpolate||Mr,ye="__p += '",Be=pc((l.escape||Mr).source+"|"+we.source+"|"+(we===Cu?Ir:Mr).source+"|"+(l.evaluate||Mr).source+"|$","g"),je="//# sourceURL="+(xt.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++kp+"]")+` `;o.replace(Be,function(Je,yt,It,xi,Gn,Pi){return It||(It=xi),ye+=o.slice(Ee,Pi).replace(uo,Vh),yt&&(Z=!0,ye+=`' + __e(`+yt+`) + '`),Gn&&(se=!0,ye+=`'; `+Gn+`; __p += '`),It&&(ye+=`' + ((__t = (`+It+`)) == null ? '' : __t) + '`),Ee=Pi+Je.length,Je}),ye+=`'; `;var Xe=xt.call(l,"variable")&&l.variable;if(!Xe)ye=`with (obj) { `+ye+` } `;else if(st.test(Xe))throw new Qe(a);ye=(se?ye.replace(ds,""):ye).replace(Au,"$1").replace(Os,"$1;"),ye="function("+(Xe||"obj")+`) { `+(Xe?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(se?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+ye+`return __p }`;var gt=Vw(function(){return St(q,je+"return "+ye).apply(e,X)});if(gt.source=ye,H1(gt))throw gt;return gt}function xB(o){return qt(o).toLowerCase()}function PB(o){return qt(o).toUpperCase()}function OB(o,l,A){if(o=qt(o),o&&(A||l===e))return Gl(o);if(!o||!(l=$i(l)))return o;var I=ai(o),T=ai(l),q=fc(I,T),X=Mh(I,T)+1;return Ru(I,q,X).join("")}function TB(o,l,A){if(o=qt(o),o&&(A||l===e))return o.slice(0,dc(o)+1);if(!o||!(l=$i(l)))return o;var I=ai(o),T=Mh(I,ai(l))+1;return Ru(I,0,T).join("")}function kB(o,l,A){if(o=qt(o),o&&(A||l===e))return o.replace(Fa,"");if(!o||!(l=$i(l)))return o;var I=ai(o),T=fc(I,ai(l));return Ru(I,T).join("")}function NB(o,l){var A=S,I=B;if(gr(l)){var T="separator"in l?l.separator:T;A="length"in l?pt(l.length):A,I="omission"in l?$i(l.omission):I}o=qt(o);var q=o.length;if(Ba(o)){var X=ai(o);q=X.length}if(A>=q)return o;var Z=A-$a(I);if(Z<1)return I;var se=X?Ru(X,0,Z).join(""):o.slice(0,Z);if(T===e)return se+I;if(X&&(Z+=se.length-Z),M1(T)){if(o.slice(Z).search(T)){var Ee,we=se;for(T.global||(T=pc(T.source,qt(Ht.exec(T))+"g")),T.lastIndex=0;Ee=T.exec(we);)var ye=Ee.index;se=se.slice(0,ye===e?Z:ye)}}else if(o.indexOf($i(T),Z)!=Z){var Be=se.lastIndexOf(T);Be>-1&&(se=se.slice(0,Be))}return se+I}function LB(o){return o=qt(o),o&&ps.test(o)?o.replace(yu,zh):o}var UB=Sc(function(o,l,A){return o+(A?" ":"")+l.toUpperCase()}),K1=KE("toUpperCase");function qw(o,l,A){return o=qt(o),l=A?e:l,l===e?Wp(o)?Qp(o):Vl(o):o.match(l)||[]}var Vw=Et(function(o,l){try{return qn(o,e,l)}catch(A){return H1(A)?A:new Qe(A)}}),jB=La(function(o,l){return si(l,function(A){A=qs(A),ka(o,A,U1(o[A],o))}),o});function HB(o){var l=o==null?0:o.length,A=Ye();return o=l?te(o,function(I){if(typeof I[1]!="function")throw new ui(i);return[A(I[0]),I[1]]}):[],Et(function(I){for(var T=-1;++TW)return[];var A=Fe,I=Sn(o,Fe);l=Ye(l),o-=Fe;for(var T=zl(I,l);++A0||l<0)?new _t(A):(o<0?A=A.takeRight(-o):o&&(A=A.drop(o)),l!==e&&(l=pt(l),A=l<0?A.dropRight(-l):A.take(l-o)),A)},_t.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},_t.prototype.toArray=function(){return this.take(Fe)},Hs(_t.prototype,function(o,l){var A=/^(?:filter|find|map|reject)|While$/.test(l),I=/^(?:head|last)$/.test(l),T=M[I?"take"+(l=="last"?"Right":""):l],q=I||/^find/.test(l);T&&(M.prototype[l]=function(){var X=this.__wrapped__,Z=I?[1]:arguments,se=X instanceof _t,Ee=Z[0],we=se||ut(X),ye=function(yt){var It=T.apply(M,Si([yt],Z));return I&&Be?It[0]:It};we&&A&&typeof Ee=="function"&&Ee.length!=1&&(se=we=!1);var Be=this.__chain__,je=!!this.__actions__.length,Xe=q&&!Be,gt=se&&!je;if(!q&&we){X=gt?X:new _t(this);var Je=o.apply(X,Z);return Je.__actions__.push({func:m0,args:[ye],thisArg:e}),new Ji(Je,Be)}return Xe&>?o.apply(this,Z):(Je=this.thru(ye),Xe?I?Je.value()[0]:Je.value():Je)})}),si(["pop","push","shift","sort","splice","unshift"],function(o){var l=gc[o],A=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",I=/^(?:pop|shift)$/.test(o);M.prototype[o]=function(){var T=arguments;if(I&&!this.__chain__){var q=this.value();return l.apply(ut(q)?q:[],T)}return this[A](function(X){return l.apply(ut(X)?X:[],T)})}}),Hs(_t.prototype,function(o,l){var A=M[l];if(A){var I=A.name+"";xt.call(_c,I)||(_c[I]=[]),_c[I].push({name:l,func:A})}}),_c[c0(e,v).name]=[{name:"wrapper",func:e}],_t.prototype.clone=L5,_t.prototype.reverse=U5,_t.prototype.value=j5,M.prototype.at=g8,M.prototype.chain=m8,M.prototype.commit=v8,M.prototype.next=E8,M.prototype.plant=A8,M.prototype.reverse=y8,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=b8,M.prototype.first=M.prototype.head,xa&&(M.prototype[xa]=w8),M},Xi=e1();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(kr._=Xi,define(function(){return Xi})):Sa?((Sa.exports=Xi)._=Xi,Hl._=Xi):kr._=Xi}).call(ol)});var jm=ce((BW,Um)=>{var E_=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);E_?(Nm=new Uint8Array(16),Um.exports=function(){return E_(Nm),Nm}):(Lm=new Array(16),Um.exports=function(){for(var t=0,r;t<16;t++)t&3||(r=Math.random()*4294967296),Lm[t]=r>>>((t&3)<<3)&255;return Lm});var Nm,Lm});var Hm=ce(($W,A_)=>{var w_=[];for(kf=0;kf<256;++kf)w_[kf]=(kf+256).toString(16).substr(1);var kf;function ON(e,t){var r=t||0,n=w_;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}A_.exports=ON});var C_=ce((RW,b_)=>{var TN=jm(),kN=Hm(),y_,Mm,qm=0,Vm=0;function NN(e,t,r){var n=t&&r||0,i=t||[];e=e||{};var a=e.node||y_,s=e.clockseq!==void 0?e.clockseq:Mm;if(a==null||s==null){var u=TN();a==null&&(a=y_=[u[0]|1,u[1],u[2],u[3],u[4],u[5]]),s==null&&(s=Mm=(u[6]<<8|u[7])&16383)}var c=e.msecs!==void 0?e.msecs:new Date().getTime(),f=e.nsecs!==void 0?e.nsecs:Vm+1,d=c-qm+(f-Vm)/1e4;if(d<0&&e.clockseq===void 0&&(s=s+1&16383),(d<0||c>qm)&&e.nsecs===void 0&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");qm=c,Vm=f,Mm=s,c+=122192928e5;var g=((c&268435455)*1e4+f)%4294967296;i[n++]=g>>>24&255,i[n++]=g>>>16&255,i[n++]=g>>>8&255,i[n++]=g&255;var p=c/4294967296*1e4&268435455;i[n++]=p>>>8&255,i[n++]=p&255,i[n++]=p>>>24&15|16,i[n++]=p>>>16&255,i[n++]=s>>>8|128,i[n++]=s&255;for(var h=0;h<6;++h)i[n+h]=a[h];return t||kN(i)}b_.exports=NN});var D_=ce((xW,__)=>{var LN=jm(),UN=Hm();function jN(e,t,r){var n=t&&r||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||LN)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var a=0;a<16;++a)t[n+a]=i[a];return t||UN(i)}__.exports=jN});var I_=ce((PW,S_)=>{var HN=C_(),F_=D_(),Km=F_;Km.v1=HN;Km.v4=F_;S_.exports=Km});var Ld=ce((OW,$_)=>{var{v4:MN}=I_();function B_(){return MN().replace(/-/g,"")}var zm=B_;function Gm(){return zm()}Gm.setFactory=e=>{zm=e};Gm.reset=()=>{zm=B_};$_.exports=Gm});var fu=ce((TW,R_)=>{var qN=Symbol("_options"),VN=Symbol("_cache"),KN=Symbol("_state"),zN=Symbol("_objectId"),GN=Symbol("_conflicts"),YN=Symbol("_change"),WN=Symbol("_elemIds");R_.exports={OPTIONS:qN,CACHE:VN,STATE:KN,OBJECT_ID:zN,CONFLICTS:GN,CHANGE:YN,ELEM_IDS:WN}});var Ss=ce((kW,P_)=>{function x_(e){return typeof e=="object"&&e!==null}function XN(e){if(!x_(e))return{};let t={};for(let r of Object.keys(e))t[r]=e[r];return t}function JN(e){let t=/^(\d+)@(.*)$/.exec(e||"");if(!t)throw new RangeError(`Not a valid opId: ${e}`);return{counter:parseInt(t[1],10),actorId:t[2]}}function ZN(e,t){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array))throw new TypeError("equalBytes can only compare Uint8Arrays");if(e.byteLength!==t.byteLength)return!1;for(let r=0;r{var{OBJECT_ID:Yo}=fu(),{isObject:eL}=Ss(),Lf=class{constructor(t){if(typeof t=="string"){let r=[...t].map(n=>({value:n}));return Nf(void 0,r)}else if(Array.isArray(t)){let r=t.map(n=>({value:n}));return Nf(void 0,r)}else{if(t===void 0)return Nf(void 0,[]);throw new TypeError(`Unsupported initial value for Text: ${t}`)}}get length(){return this.elems.length}get(t){let r=this.elems[t].value;if(this.context&&eL(r)){let n=r[Yo],i=this.path.concat([{key:t,objectId:n}]);return this.context.instantiateObject(i,n)}else return r}getElemId(t){return this.elems[t].elemId}[Symbol.iterator](){let t=this.elems,r=-1;return{next(){return r+=1,r0&&(t.push(r),r=""),t.push(n.value));return r.length>0&&t.push(r),t}toJSON(){return this.toString()}getWriteable(t,r){if(!this[Yo])throw new RangeError("getWriteable() requires the objectId to be set");let n=Nf(this[Yo],this.elems);return n.context=t,n.path=r,n}set(t,r){if(this.context)this.context.setListIndex(this.path,t,r);else if(!this[Yo])this.elems[t].value=r;else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}insertAt(t,...r){if(this.context)this.context.splice(this.path,t,0,r);else if(!this[Yo])this.elems.splice(t,0,...r.map(n=>({value:n})));else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}deleteAt(t,r=1){if(this.context)this.context.splice(this.path,t,r,[]);else if(!this[Yo])this.elems.splice(t,r);else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}};for(let e of["concat","every","filter","find","findIndex","forEach","includes","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toLocaleString"])Lf.prototype[e]=function(...t){return[...this][e](...t)};function Nf(e,t){let r=Object.create(Lf.prototype);return r[Yo]=e,r.elems=t,r}O_.exports={Text:Lf,instantiateText:Nf}});var Hf=ce((LW,N_)=>{var{OBJECT_ID:Wo,CONFLICTS:tL}=fu(),{isObject:Ud,copyObject:T_}=Ss();function Ym(e,t,r){for(let n of e)if(t[n]!==r[n]){if(typeof t[n]=="number"&&typeof r[n]=="number")return t[n]-r[n];{let i=""+t[n],a=""+r[n];if(i===a)continue;return i{let r=this.entries[t];return Ud(r)&&r.id===t})}get count(){return this.ids.length}get rows(){return this.ids.map(t=>this.byId(t))}filter(t,r){return this.rows.filter(t,r)}find(t,r){return this.rows.find(t,r)}map(t,r){return this.rows.map(t,r)}sort(t){if(typeof t=="function")return this.rows.sort(t);if(typeof t=="string")return this.rows.sort((r,n)=>Ym([t],r,n));if(Array.isArray(t))return this.rows.sort((r,n)=>Ym(t,r,n));if(t===void 0)return this.rows.sort((r,n)=>Ym(["id"],r,n));throw new TypeError(`Unsupported sorting argument: ${t}`)}[Symbol.iterator](){let t=this.rows,r=-1;return{next(){return r+=1,r{var jd=class{constructor(t){this.value=t||0,Object.freeze(this)}valueOf(){return this.value}toString(){return this.valueOf().toString()}toJSON(){return this.value}},Xm=class extends jd{increment(t){return t=typeof t=="number"?t:1,this.context.increment(this.path,this.key,t),this.value+=t,this.value}decrement(t){return this.increment(typeof t=="number"?-t:-1)}};function rL(e,t,r,n,i){let a=Object.create(Xm.prototype);return a.value=e,a.context=t,a.path=r,a.objectId=n,a.key=i,a}L_.exports={Counter:jd,getWriteableCounter:rL}});var Jm=ce((jW,M_)=>{var{isObject:nL,copyObject:U_,parseOpId:qd}=Ss(),{OBJECT_ID:Mf,CONFLICTS:Xo,ELEM_IDS:Md}=fu(),{instantiateText:iL}=Uf(),{instantiateTable:sL}=Hf(),{Counter:aL}=Hd();function hu(e,t,r){return e.objectId?(t&&t[Mf]!==e.objectId&&(t=void 0),H_(e,t,r)):e.datatype==="timestamp"?new Date(e.value):e.datatype==="counter"?new aL(e.value):e.value}function uL(e,t){let r=/^(\d+)@(.*)$/,n=r.test(e)?qd(e):{counter:0,actorId:e},i=r.test(t)?qd(t):{counter:0,actorId:t};return n.counteri.counter?1:n.actorIdi.actorId?1:0}function oL(e,t,r,n){if(e)for(let i of Object.keys(e)){let a={},s=Object.keys(e[i]).sort(uL).reverse();for(let u of s){let c=e[i][u];r[i]&&r[i][u]?a[u]=hu(c,r[i][u],n):a[u]=hu(c,void 0,n)}s.length===0?(delete t[i],delete r[i]):(t[i]=a[s[0]],r[i]=a)}}function j_(e,t){let r=U_(e),n=U_(e?e[Xo]:void 0);return Object.defineProperty(r,Mf,{value:t}),Object.defineProperty(r,Xo,{value:n}),r}function cL(e,t,r){let n=e.objectId;r[n]||(r[n]=j_(t,n));let i=r[n];return oL(e.props,i,i[Xo],r),i}function lL(e,t,r){let n=e.objectId;r[n]||(r[n]=t?t._clone():sL(n));let i=r[n];for(let a of Object.keys(e.props||{})){let s=Object.keys(e.props[a]);if(s.length===0)i.remove(a);else if(s.length===1){let u=e.props[a][s[0]];i._set(a,hu(u,i.byId(a),r),s[0])}else throw new RangeError("Conflicts are not supported on properties of a table")}return i}function fL(e,t){let r=e?e.slice():[],n=e&&e[Xo]?e[Xo].slice():[],i=e&&e[Md]?e[Md].slice():[];return Object.defineProperty(r,Mf,{value:t}),Object.defineProperty(r,Xo,{value:n}),Object.defineProperty(r,Md,{value:i}),r}function hL(e,t,r){let n=e.objectId;r[n]||(r[n]=fL(t,n));let i=r[n],a=i[Xo],s=i[Md];for(let u=0;u{let b=`${f.counter+v}@${f.actorId}`;E=hu({value:E,datatype:h},void 0,r),g.push(E),p.push({[b]:{value:E,datatype:h,type:"value"}}),d.push(b)}),i.splice(c.index,0,...g),a.splice(c.index,0,...p),s.splice(c.index,0,...d)}else c.action==="remove"&&(i.splice(c.index,c.count),a.splice(c.index,c.count),s.splice(c.index,c.count))}return i}function dL(e,t,r){let n=e.objectId,i;r[n]?i=r[n].elems:t?i=t.elems.slice():i=[];for(let a of e.edits)if(a.action==="insert"){let s=hu(a.value,void 0,r),u={elemId:a.elemId,pred:[a.opId],value:s};i.splice(a.index,0,u)}else if(a.action==="multi-insert"){let s=qd(a.elemId),u=a.datatype,c=a.values.map((f,d)=>{f=hu({datatype:u,value:f},void 0,r);let g=`${s.counter+d}@${s.actorId}`;return{elemId:g,pred:[g],value:f}});i.splice(a.index,0,...c)}else if(a.action==="update"){let s=i[a.index].elemId,u=hu(a.value,i[a.index].value,r);i[a.index]={elemId:s,pred:[a.opId],value:u}}else a.action==="remove"&&i.splice(a.index,a.count);return r[n]=iL(n,i),r[n]}function H_(e,t,r){if(nL(t)&&(!e.props||Object.keys(e.props).length===0)&&(!e.edits||e.edits.length===0)&&!r[e.objectId])return t;if(e.type==="map")return cL(e,t,r);if(e.type==="table")return lL(e,t,r);if(e.type==="list")return hL(e,t,r);if(e.type==="text")return dL(e,t,r);throw new TypeError(`Unknown object type: ${e.type}`)}function pL(e){if(e[Mf]!=="_root")throw new RangeError(`Not the root object: ${e[Mf]}`);return j_(e,"_root")}M_.exports={interpretPatch:H_,cloneRootObject:pL}});var K_=ce((HW,V_)=>{var{OBJECT_ID:Jo,CHANGE:Vd,STATE:gL}=fu(),{createArrayOfNulls:mL}=Ss(),{Text:vL}=Uf(),{Table:EL}=Hf();function ha(e){if(typeof e=="string"&&/^[0-9]+$/.test(e)&&(e=parseInt(e,10)),typeof e!="number")throw new TypeError("A list index must be a number, but you passed "+JSON.stringify(e));if(e<0||isNaN(e)||e===1/0||e===-1/0)throw new RangeError("A list index must be positive, but you passed "+e);return e}function wL(e,t,r){let n={deleteAt(i,a){return e.splice(r,ha(i),a||1,[]),this},fill(i,a,s){let u=e.getObject(t);for(let c=ha(a||0);cu.length-i)&&(a=u.length-i);let c=[];for(let f=0;fa[i]()}for(let i of["concat","every","filter","find","findIndex","forEach","includes","join","lastIndexOf","map","reduce","reduceRight","slice","some","toLocaleString","toString"])n[i]=(...a)=>e.getObject(t).map((u,c)=>e.getObjectField(r,t,c))[i](...a);return n}var AL={get(e,t){let{context:r,objectId:n,path:i}=e;return t===Jo?n:t===Vd?r:t===gL?{actorId:r.actorId}:r.getObjectField(i,n,t)},set(e,t,r){let{context:n,path:i,readonly:a}=e;if(Array.isArray(a)&&a.indexOf(t)>=0)throw new RangeError(`Object property "${t}" cannot be modified`);return n.setMapKey(i,t,r),!0},deleteProperty(e,t){let{context:r,path:n,readonly:i}=e;if(Array.isArray(i)&&i.indexOf(t)>=0)throw new RangeError(`Object property "${t}" cannot be modified`);return r.deleteMapKey(n,t),!0},has(e,t){let{context:r,objectId:n}=e;return[Jo,Vd].includes(t)||t in r.getObject(n)},getOwnPropertyDescriptor(e,t){let{context:r,objectId:n}=e,i=r.getObject(n);if(t in i)return{configurable:!0,enumerable:!0,value:r.getObjectField(n,t)}},ownKeys(e){let{context:t,objectId:r}=e;return Object.keys(t.getObject(r))}},yL={get(e,t){let[r,n,i]=e;return t===Symbol.iterator?r.getObject(n)[Symbol.iterator]:t===Jo?n:t===Vd?r:t==="length"?r.getObject(n).length:typeof t=="string"&&/^[0-9]+$/.test(t)?r.getObjectField(i,n,ha(t)):wL(r,n,i)[t]},set(e,t,r){let[n,i,a]=e;if(t==="length"){if(typeof r!="number")throw new RangeError("Invalid array length");let s=n.getObject(i).length;s>r?n.splice(a,r,s-r,[]):n.splice(a,s,0,mL(r-s))}else n.setListIndex(a,ha(t),r);return!0},deleteProperty(e,t){let[r,,n]=e;return r.splice(n,ha(t),1,[]),!0},has(e,t){let[r,n]=e;return typeof t=="string"&&/^[0-9]+$/.test(t)?ha(t){var Zm=class{constructor(t){if(!(Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER))throw new RangeError(`Value ${t} cannot be a uint`);this.value=t,Object.freeze(this)}},Qm=class{constructor(t){if(!(Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=0))throw new RangeError(`Value ${t} cannot be a uint`);this.value=t,Object.freeze(this)}},ev=class{constructor(t){if(typeof t!="number")throw new RangeError(`Value ${t} cannot be a float64`);this.value=t||0,Object.freeze(this)}};z_.exports={Int:Zm,Uint:Qm,Float64:ev}});var X_=ce((qW,W_)=>{var{CACHE:DL,OBJECT_ID:Kd,CONFLICTS:Zo,ELEM_IDS:G_,STATE:FL}=fu(),{interpretPatch:SL}=Jm(),{Text:Kf}=Uf(),{Table:zf}=Hf(),{Counter:Vu,getWriteableCounter:IL}=Hd(),{Int:rv,Uint:nv,Float64:iv}=tv(),{isObject:qf,parseOpId:Y_,createArrayOfNulls:BL}=Ss(),$L=Ld(),sv=class{constructor(t,r,n){this.actorId=r,this.nextOpNum=t[FL].maxOp+1,this.cache=t[DL],this.updated={},this.ops=[],this.applyPatch=n||SL}addOp(t){this.ops.push(t),t.action==="set"&&t.values?this.nextOpNum+=t.values.length:t.action==="del"&&t.multiOp?this.nextOpNum+=t.multiOp:this.nextOpNum+=1}nextOpId(){return`${this.nextOpNum}@${this.actorId}`}getValueDescription(t){if(!["object","boolean","number","string"].includes(typeof t))throw new TypeError(`Unsupported type of value: ${typeof t}`);if(qf(t)){if(t instanceof Date)return{type:"value",value:t.getTime(),datatype:"timestamp"};if(t instanceof rv)return{type:"value",value:t.value,datatype:"int"};if(t instanceof nv)return{type:"value",value:t.value,datatype:"uint"};if(t instanceof iv)return{type:"value",value:t.value,datatype:"float64"};if(t instanceof Vu)return{type:"value",value:t.value,datatype:"counter"};{let r=t[Kd],n=this.getObjectType(r);if(!r)throw new RangeError(`Object ${JSON.stringify(t)} has no objectId`);return n==="list"||n==="text"?{objectId:r,type:n,edits:[]}:{objectId:r,type:n,props:{}}}}else return typeof t=="number"?Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER?{type:"value",value:t,datatype:"int"}:{type:"value",value:t,datatype:"float64"}:{type:"value",value:t}}getValuesDescriptions(t,r,n){if(r instanceof zf){let i=r.byId(n),a=r.opIds[n];return i?{[a]:this.getValueDescription(i)}:{}}else if(r instanceof Kf){let i=r.get(n),a=r.getElemId(n);return i?{[a]:this.getValueDescription(i)}:{}}else{let i=r[Zo][n],a={};if(!i)throw new RangeError(`No children at key ${n} of path ${JSON.stringify(t)}`);for(let s of Object.keys(i))a[s]=this.getValueDescription(i[s]);return a}}getPropertyValue(t,r,n){return t instanceof zf?t.byId(r):t instanceof Kf?t.get(r):t[Zo][r][n]}getSubpatch(t,r){if(r.length==0)return t;let n=t,i=this.getObject("_root");for(let a of r){let s=this.getValuesDescriptions(r,i,a.key);if(n.props)n.props[a.key]||(n.props[a.key]=s);else if(n.edits)for(let c of Object.keys(s))n.edits.push({action:"update",index:a.key,opId:c,value:s[c]});let u=null;for(let c of Object.keys(s))s[c].objectId===a.objectId&&(u=c);if(!u)throw new RangeError(`Cannot find path object with objectId ${a.objectId}`);n=s[u],i=this.getPropertyValue(i,a.key,u)}return n}getObject(t){let r=this.updated[t]||this.cache[t];if(!r)throw new RangeError(`Target object does not exist: ${t}`);return r}getObjectType(t){if(t==="_root")return"map";let r=this.getObject(t);return r instanceof Kf?"text":r instanceof zf?"table":Array.isArray(r)?"list":"map"}getObjectField(t,r,n){if(!["string","number"].includes(typeof n))return;let i=this.getObject(r);if(i[n]instanceof Vu)return IL(i[n].value,this,t,r,n);if(qf(i[n])){let a=i[n][Kd],s=t.concat([{key:n,objectId:a}]);return this.instantiateObject(s,a)}else return i[n]}createNestedObjects(t,r,n,i,a,s){if(n[Kd])throw new RangeError("Cannot create a reference to an existing document object");let u=this.nextOpId();if(n instanceof Kf){this.addOp(s?{action:"makeText",obj:t,elemId:s,insert:i,pred:a}:{action:"makeText",obj:t,key:r,insert:i,pred:a});let c={objectId:u,type:"text",edits:[]};return this.insertListItems(c,0,[...n],!0),c}else if(n instanceof zf){if(n.count>0)throw new RangeError("Assigning a non-empty Table object is not supported");return this.addOp(s?{action:"makeTable",obj:t,elemId:s,insert:i,pred:a}:{action:"makeTable",obj:t,key:r,insert:i,pred:a}),{objectId:u,type:"table",props:{}}}else if(Array.isArray(n)){this.addOp(s?{action:"makeList",obj:t,elemId:s,insert:i,pred:a}:{action:"makeList",obj:t,key:r,insert:i,pred:a});let c={objectId:u,type:"list",edits:[]};return this.insertListItems(c,0,n,!0),c}else{this.addOp(s?{action:"makeMap",obj:t,elemId:s,insert:i,pred:a}:{action:"makeMap",obj:t,key:r,insert:i,pred:a});let c={};for(let f of Object.keys(n).sort()){let d=this.nextOpId(),g=this.setValue(u,f,n[f],!1,[]);c[f]={[d]:g}}return{objectId:u,type:"map",props:c}}}setValue(t,r,n,i,a,s){if(!t)throw new RangeError("setValue needs an objectId");if(r==="")throw new RangeError("The key of a map entry must not be an empty string");if(qf(n)&&!(n instanceof Date)&&!(n instanceof Vu)&&!(n instanceof rv)&&!(n instanceof nv)&&!(n instanceof iv))return this.createNestedObjects(t,r,n,i,a,s);{let u=this.getValueDescription(n),c={action:"set",obj:t,insert:i,value:u.value,pred:a};return s?c.elemId=s:c.key=r,u.datatype&&(c.datatype=u.datatype),this.addOp(c),u}}applyAtPath(t,r){let n={objectId:"_root",type:"map",props:{}};r(this.getSubpatch(n,t)),this.applyPatch(n,this.cache._root,this.updated)}setMapKey(t,r,n){if(typeof r!="string")throw new RangeError(`The key of a map entry must be a string, not ${typeof r}`);let i=t.length===0?"_root":t[t.length-1].objectId,a=this.getObject(i);if(a[r]instanceof Vu)throw new RangeError("Cannot overwrite a Counter object; use .increment() or .decrement() to change its value.");(a[r]!==n||Object.keys(a[Zo][r]||{}).length>1||n===void 0)&&this.applyAtPath(t,s=>{let u=Vf(a,r),c=this.nextOpId(),f=this.setValue(i,r,n,!1,u);s.props[r]={[c]:f}})}deleteMapKey(t,r){let n=t.length===0?"_root":t[t.length-1].objectId,i=this.getObject(n);if(i[r]!==void 0){let a=Vf(i,r);this.addOp({action:"del",obj:n,key:r,insert:!1,pred:a}),this.applyAtPath(t,s=>{s.props[r]={}})}}insertListItems(t,r,n,i){let a=i?[]:this.getObject(t.objectId);if(r<0||r>a.length)throw new RangeError(`List index ${r} is out of bounds for list of length ${a.length}`);if(n.length===0)return;let s=zd(a,r,!0),u=n.every(d=>typeof d=="string"||typeof d=="number"||typeof d=="boolean"||d===null||qf(d)&&(d instanceof Date||d instanceof Vu||d instanceof rv||d instanceof nv||d instanceof iv)),c=u?n.map(d=>this.getValueDescription(d)):[],f=c.every(d=>d.datatype===c[0].datatype);if(u&&f&&n.length>1){let d=this.nextOpId(),g=c[0].datatype,p=c.map(v=>v.value),h={action:"set",obj:t.objectId,elemId:s,insert:!0,values:p,pred:[]},E={action:"multi-insert",elemId:d,index:r,values:p};g&&(h.datatype=g,E.datatype=g),this.addOp(h),t.edits.push(E)}else for(let d=0;d=a.length){let s=BL(r-a.length);return s.push(n),this.splice(t,a.length,0,s)}if(a[r]instanceof Vu)throw new RangeError("Cannot overwrite a Counter object; use .increment() or .decrement() to change its value.");(a[r]!==n||Object.keys(a[Zo][r]||{}).length>1||n===void 0)&&this.applyAtPath(t,s=>{let u=Vf(a,r),c=this.nextOpId(),f=this.setValue(i,r,n,!1,u,zd(a,r));s.edits.push({action:"update",index:r,opId:c,value:f})})}splice(t,r,n,i){let a=t.length===0?"_root":t[t.length-1].objectId,s=this.getObject(a);if(r<0||n<0||r>s.length-n)throw new RangeError(`${n} deletions starting at index ${r} are out of bounds for list of length ${s.length}`);if(n===0&&i.length===0)return;let u={diffs:{objectId:"_root",type:"map",props:{}}},c=this.getSubpatch(u.diffs,t);if(n>0){let f,d,g;for(let p=0;p0&&this.insertListItems(c,r,i,!1),this.applyPatch(u.diffs,this.cache._root,this.updated)}addTableRow(t,r){if(!qf(r)||Array.isArray(r))throw new TypeError("A table row must be an object");if(r[Kd])throw new TypeError("Cannot reuse an existing object as table row");if(r.id)throw new TypeError('A table row must not have an "id" property; it is generated automatically');let n=$L(),i=this.setValue(t[t.length-1].objectId,n,r,!1,[]);return this.applyAtPath(t,a=>{a.props[n]={[i.objectId]:i}}),n}deleteTableRow(t,r,n){let i=t[t.length-1].objectId;this.getObject(i).byId(r)&&(this.addOp({action:"del",obj:i,key:r,insert:!1,pred:[n]}),this.applyAtPath(t,s=>{s.props[r]={}}))}increment(t,r,n){let i=t.length===0?"_root":t[t.length-1].objectId,a=this.getObject(i);if(!(a[r]instanceof Vu))throw new TypeError("Only counter values can be incremented");let s=this.getObjectType(i),u=a[r].value+n,c=this.nextOpId(),f=Vf(a,r);if(s==="list"||s==="text"){let d=zd(a,r,!1);this.addOp({action:"inc",obj:i,elemId:d,value:n,insert:!1,pred:f})}else this.addOp({action:"inc",obj:i,key:r,value:n,insert:!1,pred:f});this.applyAtPath(t,d=>{s==="list"||s==="text"?d.edits.push({action:"update",index:r,opId:c,value:{value:u,datatype:"counter"}}):d.props[r]={[c]:{value:u,datatype:"counter"}}})}};function Vf(e,t){return e instanceof zf?[e.opIds[t]]:e instanceof Kf?e.elems[t].pred:e[Zo]?e[Zo][t]?Object.keys(e[Zo][t]):[]:[]}function zd(e,t,r=!1){if(r){if(t===0)return"_head";t-=1}if(e[G_])return e[G_][t];if(e.getElemId)return e.getElemId(t);throw new RangeError(`Cannot find elemId at list index ${t}`)}W_.exports={Context:sv}});var Z_=ce((VW,J_)=>{var{OBJECT_ID:RL,CONFLICTS:Zn}=fu(),av=class{constructor(){this.observers={}}patchCallback(t,r,n,i,a){this._objectUpdate(t.diffs,r,n,i,a)}_objectUpdate(t,r,n,i,a){if(t.objectId){if(this.observers[t.objectId])for(let s of this.observers[t.objectId])s(t,r,n,i,a);if(t.type==="map"&&t.props)for(let s of Object.keys(t.props))for(let u of Object.keys(t.props[s]))this._objectUpdate(t.props[s][u],r&&r[Zn]&&r[Zn][s]&&r[Zn][s][u],n&&n[Zn]&&n[Zn][s]&&n[Zn][s][u],i,a);else if(t.type==="table"&&t.props)for(let s of Object.keys(t.props))for(let u of Object.keys(t.props[s]))this._objectUpdate(t.props[s][u],r&&r.byId(s),n&&n.byId(s),i,a);else if(t.type==="list"&&t.edits){let s=0;for(let u of t.edits)u.action==="insert"?(s-=1,this._objectUpdate(u.value,void 0,n&&n[Zn]&&n[Zn][u.index]&&n[Zn][u.index][u.elemId],i,a)):u.action==="multi-insert"?s-=u.values.length:u.action==="update"?this._objectUpdate(u.value,r&&r[Zn]&&r[Zn][u.index+s]&&r[Zn][u.index+s][u.opId],n&&n[Zn]&&n[Zn][u.index]&&n[Zn][u.index][u.opId],i,a):u.action==="remove"&&(s+=u.count)}else if(t.type==="text"&&t.edits){let s=0;for(let u of t.edits)u.action==="insert"?(s-=1,this._objectUpdate(u.value,void 0,n&&n.get(u.index),i,a)):u.action==="multi-insert"?s-=u.values.length:u.action==="update"?this._objectUpdate(u.value,r&&r.get(u.index+s),n&&n.get(u.index),i,a):u.action==="remove"&&(s+=u.count)}}}observe(t,r){let n=t[RL];if(!n)throw new TypeError("The observed object must be part of an Automerge document");this.observers[n]||(this.observers[n]=[]),this.observers[n].push(r)}};J_.exports={Observable:av}});var u6=ce((KW,a6)=>{var{OPTIONS:da,CACHE:ll,STATE:pa,OBJECT_ID:hl,CONFLICTS:fl,CHANGE:Q_,ELEM_IDS:xL}=fu(),{isObject:cv,copyObject:uv}=Ss(),PL=Ld(),{interpretPatch:OL,cloneRootObject:TL}=Jm(),{rootObjectProxy:kL}=K_(),{Context:e6}=X_(),{Text:lv}=Uf(),{Table:t6}=Hf(),{Counter:NL}=Hd(),{Float64:LL,Int:UL,Uint:jL}=tv(),{Observable:HL}=Z_();function r6(e){if(typeof e!="string")throw new TypeError(`Unsupported type of actorId: ${typeof e}`);if(!/^[0-9a-f]+$/.test(e))throw new RangeError("actorId must consist only of lowercase hex digits");if(e.length%2!==0)throw new RangeError("actorId must consist of an even number of digits")}function Gd(e,t,r){let n=t._root;if(n||(n=TL(e[ll]._root),t._root=n),Object.defineProperty(n,da,{value:e[da]}),Object.defineProperty(n,ll,{value:t}),Object.defineProperty(n,pa,{value:r}),e[da].freeze)for(let i of Object.keys(t))t[i]instanceof t6?t[i]._freeze():t[i]instanceof lv?(Object.freeze(t[i].elems),Object.freeze(t[i])):(Object.freeze(t[i]),Object.freeze(t[i][fl]));for(let i of Object.keys(e[ll]))t[i]||(t[i]=e[ll][i]);return e[da].freeze&&Object.freeze(t),n}function n6(e,t,r){let n=dl(e);if(!n)throw new Error("Actor ID must be initialized with setActorId() before making a change");let i=uv(e[pa]);i.seq+=1;let a={actor:n,seq:i.seq,startOp:i.maxOp+1,deps:i.deps,time:r&&typeof r.time=="number"?r.time:Math.round(new Date().getTime()/1e3),message:r&&typeof r.message=="string"?r.message:"",ops:t.ops};if(e[da].backend){let[s,u,c]=e[da].backend.applyLocalChange(i.backendState,a);i.backendState=s,i.lastLocalChange=c;let f=ov(e,u,i,!0),d=r&&r.patchCallback||e[da].patchCallback;return d&&d(u,e,f,!0,[c]),[f,a]}else{let s={actor:n,seq:a.seq,before:e};return i.requests=i.requests.concat([s]),i.maxOp=i.maxOp+ML(a.ops),i.deps=[],[Gd(e,t?t.updated:{},i),a]}}function ML(e){let t=0;for(let r of e)r.action==="set"&&r.values?t+=r.values.length:t+=1;return t}function qL(e){return e[pa]&&e[pa].lastLocalChange?e[pa].lastLocalChange:null}function ov(e,t,r,n){let i=dl(e),a={};if(OL(t.diffs,e,a),n){if(!t.clock)throw new RangeError("patch is missing clock field");t.clock[i]&&t.clock[i]>r.seq&&(r.seq=t.clock[i]),r.clock=t.clock,r.deps=t.deps,r.maxOp=Math.max(r.maxOp,t.maxOp)}return Gd(e,a,r)}function i6(e){if(typeof e=="string")e={actorId:e};else if(typeof e>"u")e={};else if(!cv(e))throw new TypeError(`Unsupported value for init() options: ${e}`);if(e.deferActorId||(e.actorId===void 0&&(e.actorId=PL()),r6(e.actorId)),e.observable){let i=e.patchCallback,a=e.observable;e.patchCallback=(s,u,c,f,d)=>{i&&i(s,u,c,f,d),a.patchCallback(s,u,c,f,d)}}let t={},r={_root:t},n={seq:0,maxOp:0,requests:[],clock:{},deps:[]};return e.backend&&(n.backendState=e.backend.init(),n.lastLocalChange=null),Object.defineProperty(t,hl,{value:"_root"}),Object.defineProperty(t,da,{value:Object.freeze(e)}),Object.defineProperty(t,fl,{value:Object.freeze({})}),Object.defineProperty(t,ll,{value:Object.freeze(r)}),Object.defineProperty(t,pa,{value:Object.freeze(n)}),Object.freeze(t)}function VL(e,t){return s6(i6(t),"Initialization",r=>Object.assign(r,e))}function s6(e,t,r){if(e[hl]!=="_root")throw new TypeError("The first argument to Automerge.change must be the document root");if(e[Q_])throw new TypeError("Calls to Automerge.change cannot be nested");if(typeof t=="function"&&r===void 0&&([t,r]=[r,t]),typeof t=="string"&&(t={message:t}),t!==void 0&&!cv(t))throw new TypeError("Unsupported type of options");let n=dl(e);if(!n)throw new Error("Actor ID must be initialized with setActorId() before making a change");let i=new e6(e,n);return r(kL(i)),Object.keys(i.updated).length===0?[e,null]:n6(e,i,t)}function KL(e,t){if(e[hl]!=="_root")throw new TypeError("The first argument to Automerge.emptyChange must be the document root");if(typeof t=="string"&&(t={message:t}),t!==void 0&&!cv(t))throw new TypeError("Unsupported type of options");let r=dl(e);if(!r)throw new Error("Actor ID must be initialized with setActorId() before making a change");return n6(e,new e6(e,r),t)}function zL(e,t,r=void 0){if(e[hl]!=="_root")throw new TypeError("The first argument to Frontend.applyPatch must be the document root");let n=uv(e[pa]);if(e[da].backend){if(!r)throw new RangeError("applyPatch must be called with the updated backend state");return n.backendState=r,ov(e,t,n,!0)}let i;if(n.requests.length>0)if(i=n.requests[0].before,t.actor===dl(e)){if(n.requests[0].seq!==t.seq)throw new RangeError(`Mismatched sequence number: patch ${t.seq} does not match next request ${n.requests[0].seq}`);n.requests=n.requests.slice(1)}else n.requests=n.requests.slice();else i=e,n.requests=[];let a=ov(i,t,n,!0);return n.requests.length===0?a:(n.requests[0]=uv(n.requests[0]),n.requests[0].before=a,Gd(e,{},n))}function GL(e){return e[hl]}function YL(e,t){if(e[Q_])throw new TypeError("Cannot use getObjectById in a change callback");return e[ll][t]}function dl(e){return e[pa].actorId||e[da].actorId}function WL(e,t){r6(t);let r=Object.assign({},e[pa],{actorId:t});return Gd(e,{},r)}function XL(e,t){if(e[fl]&&e[fl][t]&&Object.keys(e[fl][t]).length>1)return e[fl][t]}function JL(e,t=null,r="first"){if(e[hl]!=="_root"){let n=Array.isArray(e)?". Note: Automerge.applyChanges now returns an array.":"";throw t?new TypeError(`The ${r} argument to Automerge.${t} must be the document root${n}`):new TypeError(`Argument is not an Automerge document root${n}`)}return e[pa].backendState}function ZL(e){return e instanceof lv?e.elems.map(t=>t.elemId):e[xL]}a6.exports={init:i6,from:VL,change:s6,emptyChange:KL,applyPatch:zL,getObjectId:GL,getObjectById:YL,getActorId:dl,setActorId:WL,getConflicts:XL,getLastLocalChange:qL,getBackendState:JL,getElementIds:ZL,Text:lv,Table:t6,Counter:NL,Observable:HL,Float64:LL,Int:UL,Uint:jL}});var I6=ce((zW,ml)=>{"use strict";function gl(e){let t=e.length;for(;--t>=0;)e[t]=0}var QL=0,d6=1,eU=2,tU=3,rU=258,vv=29,Zf=256,Yf=Zf+1+vv,pl=30,Ev=19,p6=2*Yf+1,Qo=15,fv=16,nU=7,wv=256,g6=16,m6=17,v6=18,gv=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Yd=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),iU=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),E6=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sU=512,du=new Array((Yf+2)*2);gl(du);var Gf=new Array(pl*2);gl(Gf);var Wf=new Array(sU);gl(Wf);var Xf=new Array(rU-tU+1);gl(Xf);var Av=new Array(vv);gl(Av);var Wd=new Array(pl);gl(Wd);function hv(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var w6,A6,y6;function dv(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var b6=e=>e<256?Wf[e]:Wf[256+(e>>>7)],Jf=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},wi=(e,t,r)=>{e.bi_valid>fv-r?(e.bi_buf|=t<>fv-e.bi_valid,e.bi_valid+=r-fv):(e.bi_buf|=t<{wi(e,r[t*2],r[t*2+1])},C6=(e,t)=>{let r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1},aU=e=>{e.bi_valid===16?(Jf(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},uU=(e,t)=>{let r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,u=t.stat_desc.extra_base,c=t.stat_desc.max_length,f,d,g,p,h,E,v=0;for(p=0;p<=Qo;p++)e.bl_count[p]=0;for(r[e.heap[e.heap_max]*2+1]=0,f=e.heap_max+1;fc&&(p=c,v++),r[d*2+1]=p,!(d>n)&&(e.bl_count[p]++,h=0,d>=u&&(h=s[d-u]),E=r[d*2],e.opt_len+=E*(p+h),a&&(e.static_len+=E*(i[d*2+1]+h)));if(v!==0){do{for(p=c-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[c]--,v-=2}while(v>0);for(p=c;p!==0;p--)for(d=e.bl_count[p];d!==0;)g=e.heap[--f],!(g>n)&&(r[g*2+1]!==p&&(e.opt_len+=(p-r[g*2+1])*r[g*2],r[g*2+1]=p),d--)}},_6=(e,t,r)=>{let n=new Array(Qo+1),i=0,a,s;for(a=1;a<=Qo;a++)i=i+r[a-1]<<1,n[a]=i;for(s=0;s<=t;s++){let u=e[s*2+1];u!==0&&(e[s*2]=C6(n[u]++,u))}},oU=()=>{let e,t,r,n,i,a=new Array(Qo+1);for(r=0,n=0;n>=7;n{let t;for(t=0;t{e.bi_valid>8?Jf(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},o6=(e,t,r,n)=>{let i=t*2,a=r*2;return e[i]{let n=e.heap[r],i=r<<1;for(;i<=e.heap_len&&(i{let n,i,a=0,s,u;if(e.sym_next!==0)do n=e.pending_buf[e.sym_buf+a++]&255,n+=(e.pending_buf[e.sym_buf+a++]&255)<<8,i=e.pending_buf[e.sym_buf+a++],n===0?ga(e,i,t):(s=Xf[i],ga(e,s+Zf+1,t),u=gv[s],u!==0&&(i-=Av[s],wi(e,i,u)),n--,s=b6(n),ga(e,s,r),u=Yd[s],u!==0&&(n-=Wd[s],wi(e,n,u)));while(a{let r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,s,u,c=-1,f;for(e.heap_len=0,e.heap_max=p6,s=0;s>1;s>=1;s--)pv(e,r,s);f=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],pv(e,r,1),u=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=u,r[f*2]=r[s*2]+r[u*2],e.depth[f]=(e.depth[s]>=e.depth[u]?e.depth[s]:e.depth[u])+1,r[s*2+1]=r[u*2+1]=f,e.heap[1]=f++,pv(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],uU(e,t),_6(r,c,e.bl_count)},l6=(e,t,r)=>{let n,i=-1,a,s=t[0*2+1],u=0,c=7,f=4;for(s===0&&(c=138,f=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)a=s,s=t[(n+1)*2+1],!(++u{let n,i=-1,a,s=t[0*2+1],u=0,c=7,f=4;for(s===0&&(c=138,f=3),n=0;n<=r;n++)if(a=s,s=t[(n+1)*2+1],!(++u{let t;for(l6(e,e.dyn_ltree,e.l_desc.max_code),l6(e,e.dyn_dtree,e.d_desc.max_code),mv(e,e.bl_desc),t=Ev-1;t>=3&&e.bl_tree[E6[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},lU=(e,t,r,n)=>{let i;for(wi(e,t-257,5),wi(e,r-1,5),wi(e,n-4,4),i=0;i{let t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return 0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return 1;for(r=32;r{h6||(oU(),h6=!0),e.l_desc=new dv(e.dyn_ltree,w6),e.d_desc=new dv(e.dyn_dtree,A6),e.bl_desc=new dv(e.bl_tree,y6),e.bi_buf=0,e.bi_valid=0,D6(e)},S6=(e,t,r,n)=>{wi(e,(QL<<1)+(n?1:0),3),F6(e),Jf(e,r),Jf(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r},dU=e=>{wi(e,d6<<1,3),ga(e,wv,du),aU(e)},pU=(e,t,r,n)=>{let i,a,s=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=fU(e)),mv(e,e.l_desc),mv(e,e.d_desc),s=cU(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&t!==-1?S6(e,t,r,n):e.strategy===4||a===i?(wi(e,(d6<<1)+(n?1:0),3),c6(e,du,Gf)):(wi(e,(eU<<1)+(n?1:0),3),lU(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),c6(e,e.dyn_ltree,e.dyn_dtree)),D6(e),n&&F6(e)},gU=(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(Xf[r]+Zf+1)*2]++,e.dyn_dtree[b6(t)*2]++),e.sym_next===e.sym_end);ml.exports._tr_init=hU;ml.exports._tr_stored_block=S6;ml.exports._tr_flush_block=pU;ml.exports._tr_tally=gU;ml.exports._tr_align=dU});var yv=ce((GW,B6)=>{"use strict";var mU=(e,t,r,n)=>{let i=e&65535|0,a=e>>>16&65535|0,s=0;for(;r!==0;){s=r>2e3?2e3:r,r-=s;do i=i+t[n++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0};B6.exports=mU});var bv=ce((YW,$6)=>{"use strict";var vU=()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t},EU=new Uint32Array(vU()),wU=(e,t,r,n)=>{let i=EU,a=n+r;e^=-1;for(let s=n;s>>8^i[(e^t[s])&255];return e^-1};$6.exports=wU});var Xd=ce((WW,R6)=>{"use strict";R6.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Ku=ce((XW,x6)=>{"use strict";x6.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var M6=ce((JW,wa)=>{"use strict";var{_tr_init:AU,_tr_stored_block:Dv,_tr_flush_block:yU,_tr_tally:Wu,_tr_align:bU}=I6(),k6=yv(),zu=bv(),CU=Xd(),{Z_NO_FLUSH:Xu,Z_PARTIAL_FLUSH:_U,Z_FULL_FLUSH:DU,Z_FINISH:os,Z_BLOCK:P6,Z_OK:yn,Z_STREAM_END:O6,Z_STREAM_ERROR:va,Z_DATA_ERROR:FU,Z_BUF_ERROR:Cv,Z_DEFAULT_COMPRESSION:SU,Z_FILTERED:IU,Z_HUFFMAN_ONLY:Jd,Z_RLE:BU,Z_FIXED:$U,Z_DEFAULT_STRATEGY:RU,Z_UNKNOWN:xU,Z_DEFLATED:Zd}=Ku(),PU=9,OU=15,TU=8,kU=29,NU=256,Fv=NU+1+kU,LU=30,UU=19,jU=2*Fv+1,HU=15,$t=3,Yu=258,Ea=Yu+$t+1,MU=32,El=42,xv=57,Sv=69,Iv=73,Bv=91,$v=103,ec=113,eh=666,Qn=1,Al=2,rc=3,yl=4,qU=3,tc=(e,t)=>(e.msg=CU[t],t),T6=e=>e*2-(e>4?9:0),Gu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},VU=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do r=e.head[--n],e.head[n]=r>=i?r-i:0;while(--t);t=i,n=t;do r=e.prev[--n],e.prev[n]=r>=i?r-i:0;while(--t)},KU=(e,t,r)=>(t<{let t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))},Mi=(e,t)=>{yU(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Hi(e.strm)},Ut=(e,t)=>{e.pending_buf[e.pending++]=t},Qf=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Rv=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),e.state.wrap===1?e.adler=k6(e.adler,t,i,r):e.state.wrap===2&&(e.adler=zu(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},N6=(e,t)=>{let r=e.max_chain_length,n=e.strstart,i,a,s=e.prev_length,u=e.nice_match,c=e.strstart>e.w_size-Ea?e.strstart-(e.w_size-Ea):0,f=e.window,d=e.w_mask,g=e.prev,p=e.strstart+Yu,h=f[n+s-1],E=f[n+s];e.prev_length>=e.good_match&&(r>>=2),u>e.lookahead&&(u=e.lookahead);do if(i=t,!(f[i+s]!==E||f[i+s-1]!==h||f[i]!==f[n]||f[++i]!==f[n+1])){n+=2,i++;do;while(f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&ns){if(e.match_start=t,s=a,a>=u)break;h=f[n+s-1],E=f[n+s]}}while((t=g[t&d])>c&&--r!==0);return s<=e.lookahead?s:e.lookahead},wl=e=>{let t=e.w_size,r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ea)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),VU(e),n+=t),e.strm.avail_in===0)break;if(r=Rv(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=$t)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Ju(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Ju(e,e.ins_h,e.window[i+$t-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<$t)););}while(e.lookahead{let r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n,i,a,s=0,u=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(n=i+e.strm.avail_in),n>a&&(n=a),n>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Hi(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(Rv(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(s===0);return u-=e.strm.avail_in,u&&(u>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=u&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-u,e.strm.next_in),e.strstart),e.strstart+=u,e.insert+=u>e.w_size-e.insert?e.w_size-e.insert:u),e.block_start=e.strstart),e.high_watera&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Rv(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,r=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=r||(i||t===os)&&t!==Xu&&e.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,s=t===os&&e.strm.avail_in===0&&n===i?1:0,Dv(e,e.block_start,n,s),e.block_start+=n,Hi(e.strm)),s?rc:Qn)},_v=(e,t)=>{let r,n;for(;;){if(e.lookahead=$t&&(e.ins_h=Ju(e,e.ins_h,e.window[e.strstart+$t-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-Ea&&(e.match_length=N6(e,r)),e.match_length>=$t)if(n=Wu(e,e.strstart-e.match_start,e.match_length-$t),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=$t){e.match_length--;do e.strstart++,e.ins_h=Ju(e,e.ins_h,e.window[e.strstart+$t-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ju(e,e.ins_h,e.window[e.strstart+1]);else n=Wu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Mi(e,!1),e.strm.avail_out===0))return Qn}return e.insert=e.strstart<$t-1?e.strstart:$t-1,t===os?(Mi(e,!0),e.strm.avail_out===0?rc:yl):e.sym_next&&(Mi(e,!1),e.strm.avail_out===0)?Qn:Al},vl=(e,t)=>{let r,n,i;for(;;){if(e.lookahead=$t&&(e.ins_h=Ju(e,e.ins_h,e.window[e.strstart+$t-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=$t-1,r!==0&&e.prev_length4096)&&(e.match_length=$t-1)),e.prev_length>=$t&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-$t,n=Wu(e,e.strstart-1-e.prev_match,e.prev_length-$t),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Ju(e,e.ins_h,e.window[e.strstart+$t-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=$t-1,e.strstart++,n&&(Mi(e,!1),e.strm.avail_out===0))return Qn}else if(e.match_available){if(n=Wu(e,0,e.window[e.strstart-1]),n&&Mi(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Qn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Wu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<$t-1?e.strstart:$t-1,t===os?(Mi(e,!0),e.strm.avail_out===0?rc:yl):e.sym_next&&(Mi(e,!1),e.strm.avail_out===0)?Qn:Al},zU=(e,t)=>{let r,n,i,a,s=e.window;for(;;){if(e.lookahead<=Yu){if(wl(e),e.lookahead<=Yu&&t===Xu)return Qn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=$t&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){a=e.strstart+Yu;do;while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=$t?(r=Wu(e,1,e.match_length-$t),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Wu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Mi(e,!1),e.strm.avail_out===0))return Qn}return e.insert=0,t===os?(Mi(e,!0),e.strm.avail_out===0?rc:yl):e.sym_next&&(Mi(e,!1),e.strm.avail_out===0)?Qn:Al},GU=(e,t)=>{let r;for(;;){if(e.lookahead===0&&(wl(e),e.lookahead===0)){if(t===Xu)return Qn;break}if(e.match_length=0,r=Wu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Mi(e,!1),e.strm.avail_out===0))return Qn}return e.insert=0,t===os?(Mi(e,!0),e.strm.avail_out===0?rc:yl):e.sym_next&&(Mi(e,!1),e.strm.avail_out===0)?Qn:Al};function ma(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var th=[new ma(0,0,0,0,L6),new ma(4,4,8,4,_v),new ma(4,5,16,8,_v),new ma(4,6,32,32,_v),new ma(4,4,16,16,vl),new ma(8,16,32,32,vl),new ma(8,16,128,128,vl),new ma(8,32,128,256,vl),new ma(32,128,258,1024,vl),new ma(32,258,258,4096,vl)],YU=e=>{e.window_size=2*e.w_size,Gu(e.head),e.max_lazy_match=th[e.level].max_lazy,e.good_match=th[e.level].good_length,e.nice_match=th[e.level].nice_length,e.max_chain_length=th[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=$t-1,e.match_available=0,e.ins_h=0};function WU(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Zd,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(jU*2),this.dyn_dtree=new Uint16Array((2*LU+1)*2),this.bl_tree=new Uint16Array((2*UU+1)*2),Gu(this.dyn_ltree),Gu(this.dyn_dtree),Gu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(HU+1),this.heap=new Uint16Array(2*Fv+1),Gu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Fv+1),Gu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var rh=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==El&&t.status!==xv&&t.status!==Sv&&t.status!==Iv&&t.status!==Bv&&t.status!==$v&&t.status!==ec&&t.status!==eh?1:0},U6=e=>{if(rh(e))return tc(e,va);e.total_in=e.total_out=0,e.data_type=xU;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?xv:t.wrap?El:ec,e.adler=t.wrap===2?0:1,t.last_flush=-2,AU(t),yn},j6=e=>{let t=U6(e);return t===yn&&YU(e.state),t},XU=(e,t)=>rh(e)||e.state.wrap!==2?va:(e.state.gzhead=t,yn),H6=(e,t,r,n,i,a)=>{if(!e)return va;let s=1;if(t===SU&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>PU||r!==Zd||n<8||n>15||t<0||t>9||a<0||a>$U||n===8&&s!==1)return tc(e,va);n===8&&(n=9);let u=new WU;return e.state=u,u.strm=e,u.status=El,u.wrap=s,u.gzhead=null,u.w_bits=n,u.w_size=1<H6(e,t,Zd,OU,TU,RU),ZU=(e,t)=>{if(rh(e)||t>P6||t<0)return e?tc(e,va):va;let r=e.state;if(!e.output||e.avail_in!==0&&!e.input||r.status===eh&&t!==os)return tc(e,e.avail_out===0?Cv:va);let n=r.last_flush;if(r.last_flush=t,r.pending!==0){if(Hi(e),e.avail_out===0)return r.last_flush=-1,yn}else if(e.avail_in===0&&T6(t)<=T6(n)&&t!==os)return tc(e,Cv);if(r.status===eh&&e.avail_in!==0)return tc(e,Cv);if(r.status===El&&r.wrap===0&&(r.status=ec),r.status===El){let i=Zd+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Jd||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=MU),i+=31-i%31,Qf(r,i),r.strstart!==0&&(Qf(r,e.adler>>>16),Qf(r,e.adler&65535)),e.adler=1,r.status=ec,Hi(e),r.pending!==0)return r.last_flush=-1,yn}if(r.status===xv){if(e.adler=0,Ut(r,31),Ut(r,139),Ut(r,8),r.gzhead)Ut(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Ut(r,r.gzhead.time&255),Ut(r,r.gzhead.time>>8&255),Ut(r,r.gzhead.time>>16&255),Ut(r,r.gzhead.time>>24&255),Ut(r,r.level===9?2:r.strategy>=Jd||r.level<2?4:0),Ut(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(Ut(r,r.gzhead.extra.length&255),Ut(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=zu(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Sv;else if(Ut(r,0),Ut(r,0),Ut(r,0),Ut(r,0),Ut(r,0),Ut(r,r.level===9?2:r.strategy>=Jd||r.level<2?4:0),Ut(r,qU),r.status=ec,Hi(e),r.pending!==0)return r.last_flush=-1,yn}if(r.status===Sv){if(r.gzhead.extra){let i=r.pending,a=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let u=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+u),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>i&&(e.adler=zu(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=u,Hi(e),r.pending!==0)return r.last_flush=-1,yn;i=0,a-=u}let s=new Uint8Array(r.gzhead.extra);r.pending_buf.set(s.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>i&&(e.adler=zu(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Iv}if(r.status===Iv){if(r.gzhead.name){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=zu(e.adler,r.pending_buf,r.pending-i,i)),Hi(e),r.pending!==0)return r.last_flush=-1,yn;i=0}r.gzindexi&&(e.adler=zu(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Bv}if(r.status===Bv){if(r.gzhead.comment){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=zu(e.adler,r.pending_buf,r.pending-i,i)),Hi(e),r.pending!==0)return r.last_flush=-1,yn;i=0}r.gzindexi&&(e.adler=zu(e.adler,r.pending_buf,r.pending-i,i))}r.status=$v}if(r.status===$v){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Hi(e),r.pending!==0))return r.last_flush=-1,yn;Ut(r,e.adler&255),Ut(r,e.adler>>8&255),e.adler=0}if(r.status=ec,Hi(e),r.pending!==0)return r.last_flush=-1,yn}if(e.avail_in!==0||r.lookahead!==0||t!==Xu&&r.status!==eh){let i=r.level===0?L6(r,t):r.strategy===Jd?GU(r,t):r.strategy===BU?zU(r,t):th[r.level].func(r,t);if((i===rc||i===yl)&&(r.status=eh),i===Qn||i===rc)return e.avail_out===0&&(r.last_flush=-1),yn;if(i===Al&&(t===_U?bU(r):t!==P6&&(Dv(r,0,0,!1),t===DU&&(Gu(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Hi(e),e.avail_out===0))return r.last_flush=-1,yn}return t!==os?yn:r.wrap<=0?O6:(r.wrap===2?(Ut(r,e.adler&255),Ut(r,e.adler>>8&255),Ut(r,e.adler>>16&255),Ut(r,e.adler>>24&255),Ut(r,e.total_in&255),Ut(r,e.total_in>>8&255),Ut(r,e.total_in>>16&255),Ut(r,e.total_in>>24&255)):(Qf(r,e.adler>>>16),Qf(r,e.adler&65535)),Hi(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?yn:O6)},QU=e=>{if(rh(e))return va;let t=e.state.status;return e.state=null,t===ec?tc(e,FU):yn},ej=(e,t)=>{let r=t.length;if(rh(e))return va;let n=e.state,i=n.wrap;if(i===2||i===1&&n.status!==El||n.lookahead)return va;if(i===1&&(e.adler=k6(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Gu(n.head),n.strstart=0,n.block_start=0,n.insert=0);let c=new Uint8Array(n.w_size);c.set(t.subarray(r-n.w_size,r),0),t=c,r=n.w_size}let a=e.avail_in,s=e.next_in,u=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,wl(n);n.lookahead>=$t;){let c=n.strstart,f=n.lookahead-($t-1);do n.ins_h=Ju(n,n.ins_h,n.window[c+$t-1]),n.prev[c&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=c,c++;while(--f);n.strstart=c,n.lookahead=$t-1,wl(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=$t-1,n.match_available=0,e.next_in=s,e.input=u,e.avail_in=a,n.wrap=i,yn};wa.exports.deflateInit=JU;wa.exports.deflateInit2=H6;wa.exports.deflateReset=j6;wa.exports.deflateResetKeep=U6;wa.exports.deflateSetHeader=XU;wa.exports.deflate=ZU;wa.exports.deflateEnd=QU;wa.exports.deflateSetDictionary=ej;wa.exports.deflateInfo="pako deflate (from Nodeca project)"});var Ov=ce((ZW,Pv)=>{"use strict";var tj=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);Pv.exports.assign=function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let n in r)tj(r,n)&&(e[n]=r[n])}}return e};Pv.exports.flattenChunks=e=>{let t=0;for(let n=0,i=e.length;n{"use strict";var q6=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{q6=!1}var nh=new Uint8Array(256);for(let e=0;e<256;e++)nh[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;nh[254]=nh[254]=1;Qd.exports.string2buf=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,r,n,i,a,s=e.length,u=0;for(i=0;i>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};var rj=(e,t)=>{if(t<65534&&e.subarray&&q6)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n{let r=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let n,i,a=new Array(r*2);for(i=0,n=0;n4){a[i++]=65533,n+=u-1;continue}for(s&=u===2?31:u===3?15:7;u>1&&n1){a[i++]=65533;continue}s<65536?a[i++]=s:(s-=65536,a[i++]=55296|s>>10&1023,a[i++]=56320|s&1023)}return rj(a,i)};Qd.exports.utf8border=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let r=t-1;for(;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+nh[e[r]]>t?r:t}});var kv=ce((eX,V6)=>{"use strict";function nj(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}V6.exports=nj});var Y6=ce((tX,bl)=>{"use strict";var ih=M6(),K6=Ov(),z6=Tv(),Nv=Xd(),ij=kv(),G6=Object.prototype.toString,{Z_NO_FLUSH:sj,Z_SYNC_FLUSH:aj,Z_FULL_FLUSH:uj,Z_FINISH:oj,Z_OK:ep,Z_STREAM_END:cj,Z_DEFAULT_COMPRESSION:lj,Z_DEFAULT_STRATEGY:fj,Z_DEFLATED:hj}=Ku();function sh(e){this.options=K6.assign({level:lj,method:hj,chunkSize:16384,windowBits:15,memLevel:8,strategy:fj},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ij,this.strm.avail_out=0;let r=ih.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==ep)throw new Error(Nv[r]);if(t.header&&ih.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=z6.string2buf(t.dictionary):G6.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=ih.deflateSetDictionary(this.strm,n),r!==ep)throw new Error(Nv[r]);this._dict_set=!0}}sh.prototype.push=function(e,t){let r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?oj:sj,typeof e=="string"?r.input=z6.string2buf(e):G6.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(a===aj||a===uj)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=ih.deflate(r,a),i===cj)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=ih.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ep;if(r.avail_out===0){this.onData(r.output);continue}if(a>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};sh.prototype.onData=function(e){this.chunks.push(e)};sh.prototype.onEnd=function(e){e===ep&&(this.result=K6.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Lv(e,t){let r=new sh(t);if(r.push(e,!0),r.err)throw r.msg||Nv[r.err];return r.result}function dj(e,t){return t=t||{},t.raw=!0,Lv(e,t)}function pj(e,t){return t=t||{},t.gzip=!0,Lv(e,t)}bl.exports.Deflate=sh;bl.exports.deflate=Lv;bl.exports.deflateRaw=dj;bl.exports.gzip=pj;bl.exports.constants=Ku()});var X6=ce((rX,W6)=>{"use strict";W6.exports=function(t,r){let n,i,a,s,u,c,f,d,g,p,h,E,v,b,m,y,D,_,F,L,k,S,B,O,x=t.state;n=t.next_in,B=t.input,i=n+(t.avail_in-5),a=t.next_out,O=t.output,s=a-(r-t.avail_out),u=a+(t.avail_out-257),c=x.dmax,f=x.wsize,d=x.whave,g=x.wnext,p=x.window,h=x.hold,E=x.bits,v=x.lencode,b=x.distcode,m=(1<>>24,h>>>=_,E-=_,_=D>>>16&255,_===0)O[a++]=D&65535;else if(_&16){F=D&65535,_&=15,_&&(E<_&&(h+=B[n++]<>>=_,E-=_),E<15&&(h+=B[n++]<>>24,h>>>=_,E-=_,_=D>>>16&255,_&16){if(L=D&65535,_&=15,E<_&&(h+=B[n++]<c){t.msg="invalid distance too far back",x.mode=16209;break e}if(h>>>=_,E-=_,_=a-s,L>_){if(_=L-_,_>d&&x.sane){t.msg="invalid distance too far back",x.mode=16209;break e}if(k=0,S=p,g===0){if(k+=f-_,_2;)O[a++]=S[k++],O[a++]=S[k++],O[a++]=S[k++],F-=3;F&&(O[a++]=S[k++],F>1&&(O[a++]=S[k++]))}else{k=a-L;do O[a++]=O[k++],O[a++]=O[k++],O[a++]=O[k++],F-=3;while(F>2);F&&(O[a++]=O[k++],F>1&&(O[a++]=O[k++]))}}else if(_&64){t.msg="invalid distance code",x.mode=16209;break e}else{D=b[(D&65535)+(h&(1<<_)-1)];continue r}break}}else if(_&64)if(_&32){x.mode=16191;break e}else{t.msg="invalid literal/length code",x.mode=16209;break e}else{D=v[(D&65535)+(h&(1<<_)-1)];continue t}break}}while(n>3,n-=F,E-=F<<3,h&=(1<{"use strict";var gj=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),mj=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),vj=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ej=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),wj=(e,t,r,n,i,a,s,u)=>{let c=u.bits,f=0,d=0,g=0,p=0,h=0,E=0,v=0,b=0,m=0,y=0,D,_,F,L,k,S=null,B,O=new Uint16Array(16),x=new Uint16Array(16),U=null,Y,H,K;for(f=0;f<=15;f++)O[f]=0;for(d=0;d=1&&O[p]===0;p--);if(h>p&&(h=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,u.bits=1,0;for(g=1;g0&&(e===0||p!==1))return-1;for(x[1]=0,f=1;f<15;f++)x[f+1]=x[f]+O[f];for(d=0;d852||e===2&&m>592)return 1;for(;;){Y=f-v,s[d]+1=B?(H=U[s[d]-B],K=S[s[d]-B]):(H=96,K=0),D=1<>v)+_]=Y<<24|H<<16|K|0;while(_!==0);for(D=1<>=1;if(D!==0?(y&=D-1,y+=D):y=0,d++,--O[f]===0){if(f===p)break;f=t[r+s[d]]}if(f>h&&(y&L)!==F){for(v===0&&(v=h),k+=g,E=f-v,b=1<852||e===2&&m>592)return 1;F=y&L,i[F]=h<<24|E<<16|k-a|0}}return y!==0&&(i[k+y]=f-v<<24|64<<16|0),u.bits=h,0};J6.exports=wj});var P4=ce((iX,Is)=>{"use strict";var Vv=yv(),Aa=bv(),Aj=X6(),ah=Z6(),yj=0,_4=1,D4=2,{Z_FINISH:Q6,Z_BLOCK:bj,Z_TREES:tp,Z_OK:nc,Z_STREAM_END:Cj,Z_NEED_DICT:_j,Z_STREAM_ERROR:cs,Z_DATA_ERROR:F4,Z_MEM_ERROR:Kv,Z_BUF_ERROR:Dj,Z_DEFLATED:e4}=Ku(),sp=16180,t4=16181,r4=16182,n4=16183,i4=16184,s4=16185,a4=16186,u4=16187,o4=16188,c4=16189,ip=16190,pu=16191,Uv=16192,l4=16193,jv=16194,f4=16195,h4=16196,d4=16197,p4=16198,rp=16199,np=16200,g4=16201,m4=16202,v4=16203,E4=16204,w4=16205,Hv=16206,A4=16207,y4=16208,hr=16209,zv=16210,S4=16211,Fj=852,Sj=592,Ij=15,Bj=Ij,b4=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function $j(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var ic=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modeS4?1:0},I4=e=>{if(ic(e))return cs;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=sp,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Fj),t.distcode=t.distdyn=new Int32Array(Sj),t.sane=1,t.back=-1,nc},B4=e=>{if(ic(e))return cs;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,I4(e)},$4=(e,t)=>{let r;if(ic(e))return cs;let n=e.state;return t<0?(r=0,t=-t):(r=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?cs:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,B4(e))},R4=(e,t)=>{if(!e)return cs;let r=new $j;e.state=r,r.strm=e,r.window=null,r.mode=sp;let n=$4(e,t);return n!==nc&&(e.state=null),n},Rj=e=>R4(e,Bj),C4=!0,Mv,qv,xj=e=>{if(C4){Mv=new Int32Array(512),qv=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ah(_4,e.lens,0,288,Mv,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ah(D4,e.lens,0,32,qv,0,e.work,{bits:5}),C4=!1}e.lencode=Mv,e.lenbits=9,e.distcode=qv,e.distbits=5},x4=(e,t,r,n)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(t.subarray(r-n,r-n+i),a.wnext),n-=i,n?(a.window.set(t.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave{let r,n,i,a,s,u,c,f,d,g,p,h,E,v,b=0,m,y,D,_,F,L,k,S,B=new Uint8Array(4),O,x,U=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ic(e)||!e.output||!e.input&&e.avail_in!==0)return cs;r=e.state,r.mode===pu&&(r.mode=Uv),s=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,u=e.avail_in,f=r.hold,d=r.bits,g=u,p=c,S=nc;e:for(;;)switch(r.mode){case sp:if(r.wrap===0){r.mode=Uv;break}for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>>8&255,r.check=Aa(r.check,B,2,0),f=0,d=0,r.mode=t4;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((f&255)<<8)+(f>>8))%31){e.msg="incorrect header check",r.mode=hr;break}if((f&15)!==e4){e.msg="unknown compression method",r.mode=hr;break}if(f>>>=4,d-=4,k=(f&15)+8,r.wbits===0&&(r.wbits=k),k>15||k>r.wbits){e.msg="invalid window size",r.mode=hr;break}r.dmax=1<>8&1),r.flags&512&&r.wrap&4&&(B[0]=f&255,B[1]=f>>>8&255,r.check=Aa(r.check,B,2,0)),f=0,d=0,r.mode=r4;case r4:for(;d<32;){if(u===0)break e;u--,f+=n[a++]<>>8&255,B[2]=f>>>16&255,B[3]=f>>>24&255,r.check=Aa(r.check,B,4,0)),f=0,d=0,r.mode=n4;case n4:for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>8),r.flags&512&&r.wrap&4&&(B[0]=f&255,B[1]=f>>>8&255,r.check=Aa(r.check,B,2,0)),f=0,d=0,r.mode=i4;case i4:if(r.flags&1024){for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>>8&255,r.check=Aa(r.check,B,2,0)),f=0,d=0}else r.head&&(r.head.extra=null);r.mode=s4;case s4:if(r.flags&1024&&(h=r.length,h>u&&(h=u),h&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+h),k)),r.flags&512&&r.wrap&4&&(r.check=Aa(r.check,n,h,a)),u-=h,a+=h,r.length-=h),r.length))break e;r.length=0,r.mode=a4;case a4:if(r.flags&2048){if(u===0)break e;h=0;do k=n[a+h++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k));while(k&&h>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=pu;break;case c4:for(;d<32;){if(u===0)break e;u--,f+=n[a++]<>>=d&7,d-=d&7,r.mode=Hv;break}for(;d<3;){if(u===0)break e;u--,f+=n[a++]<>>=1,d-=1,f&3){case 0:r.mode=l4;break;case 1:if(xj(r),r.mode=rp,t===tp){f>>>=2,d-=2;break e}break;case 2:r.mode=h4;break;case 3:e.msg="invalid block type",r.mode=hr}f>>>=2,d-=2;break;case l4:for(f>>>=d&7,d-=d&7;d<32;){if(u===0)break e;u--,f+=n[a++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=hr;break}if(r.length=f&65535,f=0,d=0,r.mode=jv,t===tp)break e;case jv:r.mode=f4;case f4:if(h=r.length,h){if(h>u&&(h=u),h>c&&(h=c),h===0)break e;i.set(n.subarray(a,a+h),s),u-=h,a+=h,c-=h,s+=h,r.length-=h;break}r.mode=pu;break;case h4:for(;d<14;){if(u===0)break e;u--,f+=n[a++]<>>=5,d-=5,r.ndist=(f&31)+1,f>>>=5,d-=5,r.ncode=(f&15)+4,f>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=hr;break}r.have=0,r.mode=d4;case d4:for(;r.have>>=3,d-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,O={bits:r.lenbits},S=ah(yj,r.lens,0,19,r.lencode,0,r.work,O),r.lenbits=O.bits,S){e.msg="invalid code lengths set",r.mode=hr;break}r.have=0,r.mode=p4;case p4:for(;r.have>>24,y=b>>>16&255,D=b&65535,!(m<=d);){if(u===0)break e;u--,f+=n[a++]<>>=m,d-=m,r.lens[r.have++]=D;else{if(D===16){for(x=m+2;d>>=m,d-=m,r.have===0){e.msg="invalid bit length repeat",r.mode=hr;break}k=r.lens[r.have-1],h=3+(f&3),f>>>=2,d-=2}else if(D===17){for(x=m+3;d>>=m,d-=m,k=0,h=3+(f&7),f>>>=3,d-=3}else{for(x=m+7;d>>=m,d-=m,k=0,h=11+(f&127),f>>>=7,d-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=hr;break}for(;h--;)r.lens[r.have++]=k}}if(r.mode===hr)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=hr;break}if(r.lenbits=9,O={bits:r.lenbits},S=ah(_4,r.lens,0,r.nlen,r.lencode,0,r.work,O),r.lenbits=O.bits,S){e.msg="invalid literal/lengths set",r.mode=hr;break}if(r.distbits=6,r.distcode=r.distdyn,O={bits:r.distbits},S=ah(D4,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,O),r.distbits=O.bits,S){e.msg="invalid distances set",r.mode=hr;break}if(r.mode=rp,t===tp)break e;case rp:r.mode=np;case np:if(u>=6&&c>=258){e.next_out=s,e.avail_out=c,e.next_in=a,e.avail_in=u,r.hold=f,r.bits=d,Aj(e,p),s=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,u=e.avail_in,f=r.hold,d=r.bits,r.mode===pu&&(r.back=-1);break}for(r.back=0;b=r.lencode[f&(1<>>24,y=b>>>16&255,D=b&65535,!(m<=d);){if(u===0)break e;u--,f+=n[a++]<>_)],m=b>>>24,y=b>>>16&255,D=b&65535,!(_+m<=d);){if(u===0)break e;u--,f+=n[a++]<>>=_,d-=_,r.back+=_}if(f>>>=m,d-=m,r.back+=m,r.length=D,y===0){r.mode=w4;break}if(y&32){r.back=-1,r.mode=pu;break}if(y&64){e.msg="invalid literal/length code",r.mode=hr;break}r.extra=y&15,r.mode=g4;case g4:if(r.extra){for(x=r.extra;d>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=m4;case m4:for(;b=r.distcode[f&(1<>>24,y=b>>>16&255,D=b&65535,!(m<=d);){if(u===0)break e;u--,f+=n[a++]<>_)],m=b>>>24,y=b>>>16&255,D=b&65535,!(_+m<=d);){if(u===0)break e;u--,f+=n[a++]<>>=_,d-=_,r.back+=_}if(f>>>=m,d-=m,r.back+=m,y&64){e.msg="invalid distance code",r.mode=hr;break}r.offset=D,r.extra=y&15,r.mode=v4;case v4:if(r.extra){for(x=r.extra;d>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=hr;break}r.mode=E4;case E4:if(c===0)break e;if(h=p-c,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=hr;break}h>r.wnext?(h-=r.wnext,E=r.wsize-h):E=r.wnext-h,h>r.length&&(h=r.length),v=r.window}else v=i,E=s-r.offset,h=r.length;h>c&&(h=c),c-=h,r.length-=h;do i[s++]=v[E++];while(--h);r.length===0&&(r.mode=np);break;case w4:if(c===0)break e;i[s++]=r.length,c--,r.mode=np;break;case Hv:if(r.wrap){for(;d<32;){if(u===0)break e;u--,f|=n[a++]<{if(ic(e))return cs;let t=e.state;return t.window&&(t.window=null),e.state=null,nc},Tj=(e,t)=>{if(ic(e))return cs;let r=e.state;return r.wrap&2?(r.head=t,t.done=!1,nc):cs},kj=(e,t)=>{let r=t.length,n,i,a;return ic(e)||(n=e.state,n.wrap!==0&&n.mode!==ip)?cs:n.mode===ip&&(i=1,i=Vv(i,t,r,0),i!==n.check)?F4:(a=x4(e,t,r,r),a?(n.mode=zv,Kv):(n.havedict=1,nc))};Is.exports.inflateReset=B4;Is.exports.inflateReset2=$4;Is.exports.inflateResetKeep=I4;Is.exports.inflateInit=Rj;Is.exports.inflateInit2=R4;Is.exports.inflate=Pj;Is.exports.inflateEnd=Oj;Is.exports.inflateGetHeader=Tj;Is.exports.inflateSetDictionary=kj;Is.exports.inflateInfo="pako inflate (from Nodeca project)"});var T4=ce((sX,O4)=>{"use strict";function Nj(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}O4.exports=Nj});var U4=ce((aX,Cl)=>{"use strict";var gu=P4(),N4=Ov(),Wv=Tv(),Xv=Xd(),Lj=kv(),Uj=T4(),L4=Object.prototype.toString,{Z_NO_FLUSH:jj,Z_FINISH:Hj,Z_OK:uh,Z_STREAM_END:Gv,Z_NEED_DICT:Yv,Z_STREAM_ERROR:Mj,Z_DATA_ERROR:k4,Z_MEM_ERROR:qj}=Ku();function oh(e){this.options=N4.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Lj,this.strm.avail_out=0;let r=gu.inflateInit2(this.strm,t.windowBits);if(r!==uh)throw new Error(Xv[r]);if(this.header=new Uj,gu.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Wv.string2buf(t.dictionary):L4.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=gu.inflateSetDictionary(this.strm,t.dictionary),r!==uh)))throw new Error(Xv[r])}oh.prototype.push=function(e,t){let r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,s,u;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?Hj:jj,L4.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),a=gu.inflate(r,s),a===Yv&&i&&(a=gu.inflateSetDictionary(r,i),a===uh?a=gu.inflate(r,s):a===k4&&(a=Yv));r.avail_in>0&&a===Gv&&r.state.wrap>0&&e[r.next_in]!==0;)gu.inflateReset(r),a=gu.inflate(r,s);switch(a){case Mj:case k4:case Yv:case qj:return this.onEnd(a),this.ended=!0,!1}if(u=r.avail_out,r.next_out&&(r.avail_out===0||a===Gv))if(this.options.to==="string"){let c=Wv.utf8border(r.output,r.next_out),f=r.next_out-c,d=Wv.buf2string(r.output,c);r.next_out=f,r.avail_out=n-f,f&&r.output.set(r.output.subarray(c,c+f),0),this.onData(d)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===uh&&u===0)){if(a===Gv)return a=gu.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};oh.prototype.onData=function(e){this.chunks.push(e)};oh.prototype.onEnd=function(e){e===uh&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=N4.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Jv(e,t){let r=new oh(t);if(r.push(e),r.err)throw r.msg||Xv[r.err];return r.result}function Vj(e,t){return t=t||{},t.raw=!0,Jv(e,t)}Cl.exports.Inflate=oh;Cl.exports.inflate=Jv;Cl.exports.inflateRaw=Vj;Cl.exports.ungzip=Jv;Cl.exports.constants=Ku()});var j4=ce((uX,ya)=>{"use strict";var{Deflate:Kj,deflate:zj,deflateRaw:Gj,gzip:Yj}=Y6(),{Inflate:Wj,inflate:Xj,inflateRaw:Jj,ungzip:Zj}=U4(),Qj=Ku();ya.exports.Deflate=Kj;ya.exports.deflate=zj;ya.exports.deflateRaw=Gj;ya.exports.gzip=Yj;ya.exports.Inflate=Wj;ya.exports.inflate=Xj;ya.exports.inflateRaw=Jj;ya.exports.ungzip=Zj;ya.exports.constants=Qj});var r2=ce((oX,K4)=>{var eH=new TextEncoder,tH=new TextDecoder("utf-8");function Zv(e){return eH.encode(e)}function Qv(e){return tH.decode(e)}function M4(e){if(typeof e!="string")throw new TypeError("value is not a string");if(!/^([0-9a-f][0-9a-f])*$/.test(e))throw new RangeError("value is not hexadecimal");return e===""?new Uint8Array(0):new Uint8Array(e.match(/../g).map(t=>parseInt(t,16)))}var H4=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],q4=new Array(256);for(let e=0;e<256;e++)q4[e]=`${H4[e>>>4&15]}${H4[e&15]}`;function V4(e){let t="",r=e.byteLength;for(let n=0;n=this.buf.byteLength&&this.grow(),this.buf[this.offset]=t,this.offset+=1}appendUint32(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<0||t>4294967295)throw new RangeError("number out of range");let r=Math.max(1,Math.ceil((32-Math.clz32(t))/7));this.offset+r>this.buf.byteLength&&this.grow();for(let n=0;n>>=7;return this.offset+=r,r}appendInt32(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<-2147483648||t>2147483647)throw new RangeError("number out of range");let r=Math.ceil((33-Math.clz32(t>=0?t:-t-1))/7);this.offset+r>this.buf.byteLength&&this.grow();for(let n=0;n>=7;return this.offset+=r,r}appendUint53(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<0||t>Number.MAX_SAFE_INTEGER)throw new RangeError("number out of range");let r=Math.floor(t/4294967296),n=(t&4294967295)>>>0;return this.appendUint64(r,n)}appendInt53(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(tNumber.MAX_SAFE_INTEGER)throw new RangeError("number out of range");let r=Math.floor(t/4294967296),n=(t&4294967295)>>>0;return this.appendInt64(r,n)}appendUint64(t,r){if(!Number.isInteger(t)||!Number.isInteger(r))throw new RangeError("value is not an integer");if(t<0||t>4294967295||r<0||r>4294967295)throw new RangeError("number out of range");if(t===0)return this.appendUint32(r);let n=Math.ceil((64-Math.clz32(t))/7);this.offset+n>this.buf.byteLength&&this.grow();for(let i=0;i<4;i++)this.buf[this.offset+i]=r&127|128,r>>>=7;this.buf[this.offset+4]=r&15|(t&7)<<4|(n===5?0:128),t>>>=3;for(let i=5;i>>=7;return this.offset+=n,n}appendInt64(t,r){if(!Number.isInteger(t)||!Number.isInteger(r))throw new RangeError("value is not an integer");if(t<-2147483648||t>2147483647||r<-2147483648||r>4294967295)throw new RangeError("number out of range");if(r>>>=0,t===0&&r<=2147483647)return this.appendInt32(r);if(t===-1&&r>=2147483648)return this.appendInt32(r-4294967296);let n=Math.ceil((65-Math.clz32(t>=0?t:-t-1))/7);this.offset+n>this.buf.byteLength&&this.grow();for(let i=0;i<4;i++)this.buf[this.offset+i]=r&127|128,r>>>=7;this.buf[this.offset+4]=r&15|(t&7)<<4|(n===5?0:128),t>>=3;for(let i=5;i>=7;return this.offset+=n,n}appendRawBytes(t){return this.offset+t.byteLength>this.buf.byteLength&&this.grow(this.offset+t.byteLength),this.buf.set(t,this.offset),this.offset+=t.byteLength,t.byteLength}appendRawString(t){if(typeof t!="string")throw new TypeError("value is not a string");return this.appendRawBytes(Zv(t))}appendPrefixedBytes(t){return this.appendUint53(t.byteLength),this.appendRawBytes(t),this}appendPrefixedString(t){if(typeof t!="string")throw new TypeError("value is not a string");return this.appendPrefixedBytes(Zv(t)),this}appendHexString(t){return this.appendPrefixedBytes(M4(t)),this}finish(){}},lh=class{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError(`Not a byte array: ${t}`);this.buf=t,this.offset=0}get done(){return this.offset===this.buf.byteLength}reset(){this.offset=0}skip(t){if(this.offset+t>this.buf.byteLength)throw new RangeError("cannot skip beyond end of buffer");this.offset+=t}readByte(){return this.offset+=1,this.buf[this.offset-1]}readUint32(){let t=0,r=0;for(;this.offset>>0,r+=7,this.offset++,!(n&128))return t}throw new RangeError("buffer ended with incomplete number")}readInt32(){let t=0,r=0;for(;this.offset28?t:t|-1<2097151)throw new RangeError("number out of range");return r*4294967296+t}readInt53(){let{low32:t,high32:r}=this.readInt64();if(r<-2097152||r===-2097152&&t===0||r>2097151)throw new RangeError("number out of range");return r*4294967296+t}readUint64(){let t=0,r=0,n=0;for(;this.offset>>0,n===28&&(r=(i&112)>>>4),n+=7,this.offset++,!(i&128))return{high32:r,low32:t}}for(n=3;this.offset>>0,n+=7,this.offset++,!(i&128))return{high32:r,low32:t}}throw new RangeError("buffer ended with incomplete number")}readInt64(){let t=0,r=0,n=0;for(;this.offset>>0,n===28&&(r=(i&112)>>>4),n+=7,this.offset++,!(i&128))return i&64&&(n<32&&(t=(t|-1<>>0),r|=-1<this.buf.byteLength)throw new RangeError("subarray exceeds buffer size");return this.offset+=t,this.buf.subarray(r,this.offset)}readRawString(t){return Qv(this.readRawBytes(t))}readPrefixedBytes(){return this.readRawBytes(this.readUint53())}readPrefixedString(){return Qv(this.readPrefixedBytes())}readHexString(){return V4(this.readPrefixedBytes())}},ap=class extends ch{constructor(t){super(),this.type=t,this.state="empty",this.lastValue=void 0,this.count=0,this.literal=[]}appendValue(t,r=1){this._appendValue(t,r)}_appendValue(t,r=1){r<=0||(this.state==="empty"?(this.state=t===null?"nulls":r===1?"loneValue":"repetition",this.lastValue=t,this.count=r):this.state==="loneValue"?t===null?(this.flush(),this.state="nulls",this.count=r):t===this.lastValue?(this.state="repetition",this.count=1+r):r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.state="literal",this.literal=[this.lastValue],this.lastValue=t):this.state==="repetition"?t===null?(this.flush(),this.state="nulls",this.count=r):t===this.lastValue?this.count+=r:r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.flush(),this.state="loneValue",this.lastValue=t):this.state==="literal"?t===null?(this.literal.push(this.lastValue),this.flush(),this.state="nulls",this.count=r):t===this.lastValue?(this.flush(),this.state="repetition",this.count=1+r):r>1?(this.literal.push(this.lastValue),this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.literal.push(this.lastValue),this.lastValue=t):this.state==="nulls"&&(t===null?this.count+=r:r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.flush(),this.state="loneValue",this.lastValue=t)))}copyFrom(t,r={}){let{count:n,sumValues:i,sumShift:a}=r;if(!(t instanceof fh)||t.type!==this.type)throw new TypeError("incompatible type of decoder");let s=typeof n=="number"?n:Number.MAX_SAFE_INTEGER,u=0,c=0;if(n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:c}:{nonNullValues:u};let f=t.readValue();if(f===null){let g=Math.min(t.count+1,s);if(s-=g,t.count-=g-1,this.appendValue(null,g),n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:c}:{nonNullValues:u};if(f=t.readValue(),f===null)throw new RangeError("null run must be followed by non-null value")}if(this.appendValue(f),s--,u++,i&&(c+=a?f>>>a:f),n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:c}:{nonNullValues:u};let d=t.count>0;for(;s>0&&!t.done;){d||t.readRecord();let g=Math.min(t.count,s);if(t.count-=g,t.state==="literal"){u+=g;for(let p=0;p>>a:h)}}else if(t.state==="repetition"){u+=g,i&&(c+=g*(a?t.lastValue>>>a:t.lastValue));let p=t.lastValue;if(this._appendValue(p),g>1){if(this._appendValue(p),this.state!=="repetition")throw new RangeError(`Unexpected state ${this.state}`);this.count+=g-2}}else if(t.state==="nulls"){if(this._appendValue(null),this.state!=="nulls")throw new RangeError(`Unexpected state ${this.state}`);this.count+=g-1}d=!1,s-=g}if(n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);return i?{nonNullValues:u,sum:c}:{nonNullValues:u}}flush(){if(this.state==="loneValue")this.appendInt32(-1),this.appendRawValue(this.lastValue);else if(this.state==="repetition")this.appendInt53(this.count),this.appendRawValue(this.lastValue);else if(this.state==="literal"){this.appendInt53(-this.literal.length);for(let t of this.literal)this.appendRawValue(t)}else this.state==="nulls"&&(this.appendInt32(0),this.appendUint53(this.count));this.state="empty"}appendRawValue(t){if(this.type==="int")this.appendInt53(t);else if(this.type==="uint")this.appendUint53(t);else if(this.type==="utf8")this.appendPrefixedString(t);else throw new RangeError(`Unknown RLEEncoder datatype: ${this.type}`)}finish(){this.state==="literal"&&this.literal.push(this.lastValue),(this.state!=="nulls"||this.offset>0)&&this.flush()}},fh=class extends lh{constructor(t,r){super(r),this.type=t,this.lastValue=void 0,this.count=0,this.state=void 0}get done(){return this.count===0&&this.offset===this.buf.byteLength}reset(){this.offset=0,this.lastValue=void 0,this.count=0,this.state=void 0}readValue(){if(this.done)return null;if(this.count===0&&this.readRecord(),this.count-=1,this.state==="literal"){let t=this.readRawValue();if(t===this.lastValue)throw new RangeError("Repetition of values is not allowed in literal");return this.lastValue=t,t}else return this.lastValue}skipValues(t){for(;t>0&&!this.done;){this.count===0&&(this.count=this.readInt53(),this.count>0?(this.lastValue=this.count<=t?this.skipRawValues(1):this.readRawValue(),this.state="repetition"):this.count<0?(this.count=-this.count,this.state="literal"):(this.count=this.readUint53(),this.lastValue=null,this.state="nulls"));let r=Math.min(t,this.count);this.state==="literal"&&this.skipRawValues(r),t-=r,this.count-=r}}readRecord(){if(this.count=this.readInt53(),this.count>1){let t=this.readRawValue();if((this.state==="repetition"||this.state==="literal")&&this.lastValue===t)throw new RangeError("Successive repetitions with the same value are not allowed");this.state="repetition",this.lastValue=t}else{if(this.count===1)throw new RangeError("Repetition count of 1 is not allowed, use a literal instead");if(this.count<0){if(this.count=-this.count,this.state==="literal")throw new RangeError("Successive literals are not allowed");this.state="literal"}else{if(this.state==="nulls")throw new RangeError("Successive null runs are not allowed");if(this.count=this.readUint53(),this.count===0)throw new RangeError("Zero-length null runs are not allowed");this.lastValue=null,this.state="nulls"}}}readRawValue(){if(this.type==="int")return this.readInt53();if(this.type==="uint")return this.readUint53();if(this.type==="utf8")return this.readPrefixedString();throw new RangeError(`Unknown RLEDecoder datatype: ${this.type}`)}skipRawValues(t){if(this.type==="utf8")for(let r=0;r0&&this.offset0)throw new RangeError("cannot skip beyond end of buffer")}}},e2=class extends ap{constructor(){super("int"),this.absoluteValue=0}appendValue(t,r=1){r<=0||(typeof t=="number"?(super.appendValue(t-this.absoluteValue,1),this.absoluteValue=t,r>1&&super.appendValue(0,r-1)):super.appendValue(t,r))}copyFrom(t,r={}){if(r.sumValues)throw new RangeError("unsupported options for DeltaEncoder.copyFrom()");if(!(t instanceof up))throw new TypeError("incompatible type of decoder");let n=r.count;if(n>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(n===0||t.done)return;let i=t.readValue(),a=0;if(this.appendValue(i),i===null){if(a=t.count+1,n!==void 0&&na&&t.done)throw new RangeError(`cannot copy ${n} values`);if(n===a||t.done)return;t.count===0&&this.appendValue(t.readValue())}n!==void 0&&(n-=a+1);let{nonNullValues:s,sum:u}=super.copyFrom(t,{count:n,sumValues:!0});s>0&&(this.absoluteValue=u,t.absoluteValue=u)}},up=class extends fh{constructor(t){super("int",t),this.absoluteValue=0}reset(){this.offset=0,this.lastValue=void 0,this.count=0,this.state=void 0,this.absoluteValue=0}readValue(){let t=super.readValue();return t===null?null:(this.absoluteValue+=t,this.absoluteValue)}skipValues(t){for(;t>0&&!this.done;){this.count===0&&this.readRecord();let r=Math.min(t,this.count);if(this.state==="literal")for(let n=0;n0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(i===0||t.done)return;this.appendValue(t.readValue()),i--;let a=Math.min(t.count,i);for(this.count+=a,t.count-=a,i-=a;i>0&&!t.done;){if(t.count=t.readUint53(),t.count===0)throw new RangeError("Zero-length runs are not allowed");t.lastValue=!t.lastValue,this.appendUint53(this.count);let s=Math.min(t.count,i);this.count=s,this.lastValue=t.lastValue,t.count-=s,i-=s}if(n&&i>0&&t.done)throw new RangeError(`cannot copy ${n} values`)}finish(){this.count>0&&(this.appendUint53(this.count),this.count=0)}},op=class extends lh{constructor(t){super(t),this.lastValue=!0,this.firstRun=!0,this.count=0}get done(){return this.count===0&&this.offset===this.buf.byteLength}reset(){this.offset=0,this.lastValue=!0,this.firstRun=!0,this.count=0}readValue(){if(this.done)return!1;for(;this.count===0;){if(this.count=this.readUint53(),this.lastValue=!this.lastValue,this.count===0&&!this.firstRun)throw new RangeError("Zero-length runs are not allowed");this.firstRun=!1}return this.count-=1,this.lastValue}skipValues(t){for(;t>0&&!this.done;){if(this.count===0){if(this.count=this.readUint53(),this.lastValue=!this.lastValue,this.count===0&&!this.firstRun)throw new RangeError("Zero-length runs are not allowed");this.firstRun=!1}this.count{(function(e,t){var r={};t(r);var n=r.default;for(var i in r)n[i]=r[i];typeof cp=="object"&&typeof cp.exports=="object"?cp.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):e.sha256=n})(z4,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(g,p,h,E,v){for(var b,m,y,D,_,F,L,k,S,B,O,x,U;v>=64;){for(b=p[0],m=p[1],y=p[2],D=p[3],_=p[4],F=p[5],L=p[6],k=p[7],B=0;B<16;B++)O=E+B*4,g[B]=(h[O]&255)<<24|(h[O+1]&255)<<16|(h[O+2]&255)<<8|h[O+3]&255;for(B=16;B<64;B++)S=g[B-2],x=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,S=g[B-15],U=(S>>>7|S<<25)^(S>>>18|S<<14)^S>>>3,g[B]=(x+g[B-7]|0)+(U+g[B-16]|0);for(B=0;B<64;B++)x=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&F^~_&L)|0)+(k+(t[B]+g[B]|0)|0)|0,U=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&m^b&y^m&y)|0,k=L,L=F,F=_,_=D+x|0,D=y,y=m,m=b,b=x+U|0;p[0]+=b,p[1]+=m,p[2]+=y,p[3]+=D,p[4]+=_,p[5]+=F,p[6]+=L,p[7]+=k,E+=64,v-=64}return E}var n=function(){function g(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return g.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},g.prototype.clean=function(){for(var p=0;p0){for(;this.bufferLength<64&&h>0;)this.buffer[this.bufferLength++]=p[E++],h--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(h>=64&&(E=r(this.temp,this.state,p,E,h),h%=64);h>0;)this.buffer[this.bufferLength++]=p[E++],h--;return this},g.prototype.finish=function(p){if(!this.finished){var h=this.bytesHashed,E=this.bufferLength,v=h/536870912|0,b=h<<3,m=h%64<56?64:128;this.buffer[E]=128;for(var y=E+1;y>>24&255,this.buffer[m-7]=v>>>16&255,this.buffer[m-6]=v>>>8&255,this.buffer[m-5]=v>>>0&255,this.buffer[m-4]=b>>>24&255,this.buffer[m-3]=b>>>16&255,this.buffer[m-2]=b>>>8&255,this.buffer[m-1]=b>>>0&255,r(this.temp,this.state,this.buffer,0,m),this.finished=!0}for(var y=0;y<8;y++)p[y*4+0]=this.state[y]>>>24&255,p[y*4+1]=this.state[y]>>>16&255,p[y*4+2]=this.state[y]>>>8&255,p[y*4+3]=this.state[y]>>>0&255;return this},g.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},g.prototype._saveState=function(p){for(var h=0;hthis.blockSize)new n().update(p).finish(h).clean();else for(var E=0;E1&&p.update(g),h&&p.update(h),p.update(E),p.finish(g),E[0]++}var c=new Uint8Array(e.digestLength);function f(g,p,h,E){p===void 0&&(p=c),E===void 0&&(E=32);for(var v=new Uint8Array([1]),b=s(p,g),m=new i(b),y=new Uint8Array(m.digestLength),D=y.length,_=new Uint8Array(E),F=0;F>>24&255,m[1]=L>>>16&255,m[2]=L>>>8&255,m[3]=L>>>0&255,v.reset(),v.update(p),v.update(m),v.finish(D);for(var k=0;k{var hp=j4(),{copyObject:Y4,parseOpId:mu,equalBytes:W4}=Ss(),{utf8ToString:rH,hexStringToBytes:tD,bytesToHexString:dp,Encoder:Fl,Decoder:yi,RLEEncoder:Ai,RLEDecoder:X4,DeltaEncoder:_l,DeltaDecoder:nH,BooleanEncoder:rD,BooleanDecoder:iH}=r2(),{Hash:nD}=G4(),Dl=new Uint8Array([133,111,74,131]),u2=0,Sl=1,ph=2,iD=256,mt={GROUP_CARD:0,ACTOR_ID:1,INT_RLE:2,INT_DELTA:3,BOOLEAN:4,STRING_RLE:5,VALUE_LEN:6,VALUE_RAW:7},dh=8,Qt={NULL:0,FALSE:1,TRUE:2,LEB128_UINT:3,LEB128_INT:4,IEEE754:5,UTF8:6,BYTES:7,COUNTER:8,TIMESTAMP:9,MIN_UNKNOWN:10,MAX_UNKNOWN:15},hh=["makeMap","set","makeList","del","makeText","inc","makeTable","link"],sH={makeMap:"map",makeList:"list",makeText:"text",makeTable:"table"},sD=[{columnName:"objActor",columnId:0|mt.ACTOR_ID},{columnName:"objCtr",columnId:0|mt.INT_RLE},{columnName:"keyActor",columnId:16|mt.ACTOR_ID},{columnName:"keyCtr",columnId:16|mt.INT_DELTA},{columnName:"keyStr",columnId:16|mt.STRING_RLE},{columnName:"idActor",columnId:32|mt.ACTOR_ID},{columnName:"idCtr",columnId:32|mt.INT_DELTA},{columnName:"insert",columnId:48|mt.BOOLEAN},{columnName:"action",columnId:64|mt.INT_RLE},{columnName:"valLen",columnId:80|mt.VALUE_LEN},{columnName:"valRaw",columnId:80|mt.VALUE_RAW},{columnName:"chldActor",columnId:96|mt.ACTOR_ID},{columnName:"chldCtr",columnId:96|mt.INT_DELTA}],o2=sD.concat([{columnName:"predNum",columnId:112|mt.GROUP_CARD},{columnName:"predActor",columnId:112|mt.ACTOR_ID},{columnName:"predCtr",columnId:112|mt.INT_DELTA}]),c2=sD.concat([{columnName:"succNum",columnId:128|mt.GROUP_CARD},{columnName:"succActor",columnId:128|mt.ACTOR_ID},{columnName:"succCtr",columnId:128|mt.INT_DELTA}]),aD=[{columnName:"actor",columnId:0|mt.ACTOR_ID},{columnName:"seq",columnId:0|mt.INT_DELTA},{columnName:"maxOp",columnId:16|mt.INT_DELTA},{columnName:"time",columnId:32|mt.INT_DELTA},{columnName:"message",columnId:48|mt.STRING_RLE},{columnName:"depsNum",columnId:64|mt.GROUP_CARD},{columnName:"depsIndex",columnId:64|mt.INT_DELTA},{columnName:"extraLen",columnId:80|mt.VALUE_LEN},{columnName:"extraRaw",columnId:80|mt.VALUE_RAW}];function lp(e,t){if(!e||!e.actorId)return e;let r=e.counter,n=t.indexOf(e.actorId);if(n<0)throw new RangeError("missing actorId");return{counter:r,actorNum:n,actorId:e.actorId}}function n2(e,t){return e.countert.counter?1:e.actorIdt.actorId?1:0}function aH(e,t){let r={},n=[];for(let a of e)a=Y4(a),r[a.actor]=!0,a.ops=pH(a.ops,a.startOp,a.actor),a.ops=a.ops.map(s=>{s=Y4(s),s.obj!=="_root"&&(s.obj=mu(s.obj)),s.elemId&&s.elemId!=="_head"&&(s.elemId=mu(s.elemId)),s.child&&(s.child=mu(s.child)),s.pred&&(s.pred=s.pred.map(mu)),s.obj.actorId&&(r[s.obj.actorId]=!0),s.elemId&&s.elemId.actorId&&(r[s.elemId.actorId]=!0),s.child&&s.child.actorId&&(r[s.child.actorId]=!0);for(let u of s.pred)r[u.actorId]=!0;return s}),n.push(a);let i=Object.keys(r).sort();t&&(i=[e[0].actor].concat(i.filter(a=>a!==e[0].actor)));for(let a of n){a.actorNum=i.indexOf(a.actor);for(let s=0;slp(c,i))}}return{changes:n,actorIds:i}}function uH(e,t){if(e.obj==="_root")t.objActor.appendValue(null),t.objCtr.appendValue(null);else if(e.obj.actorNum>=0&&e.obj.counter>0)t.objActor.appendValue(e.obj.actorNum),t.objCtr.appendValue(e.obj.counter);else throw new RangeError(`Unexpected objectId reference: ${JSON.stringify(e.obj)}`)}function oH(e,t){if(e.key)t.keyActor.appendValue(null),t.keyCtr.appendValue(null),t.keyStr.appendValue(e.key);else if(e.elemId==="_head"&&e.insert)t.keyActor.appendValue(null),t.keyCtr.appendValue(0),t.keyStr.appendValue(null);else if(e.elemId&&e.elemId.actorNum>=0&&e.elemId.counter>0)t.keyActor.appendValue(e.elemId.actorNum),t.keyCtr.appendValue(e.elemId.counter),t.keyStr.appendValue(null);else throw new RangeError(`Unexpected operation key: ${JSON.stringify(e)}`)}function cH(e,t){let r=hh.indexOf(e.action);if(r>=0)t.action.appendValue(r);else if(typeof e.action=="number")t.action.appendValue(e.action);else throw new RangeError(`Unexpected operation action: ${e.action}`)}function lH(e){switch(e.datatype){case"counter":return[Qt.COUNTER,e.value];case"timestamp":return[Qt.TIMESTAMP,e.value];case"uint":return[Qt.LEB128_UINT,e.value];case"int":return[Qt.LEB128_INT,e.value];case"float64":{let t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e.value,!0),[Qt.IEEE754,new Uint8Array(t)]}default:if(Number.isInteger(e.value)&&e.value<=Number.MAX_SAFE_INTEGER&&e.value>=Number.MIN_SAFE_INTEGER)return[Qt.LEB128_INT,e.value];{let t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e.value,!0),[Qt.IEEE754,new Uint8Array(t)]}}}function fH(e,t){if(e.action!=="set"&&e.action!=="inc"||e.value===null)t.valLen.appendValue(Qt.NULL);else if(e.value===!1)t.valLen.appendValue(Qt.FALSE);else if(e.value===!0)t.valLen.appendValue(Qt.TRUE);else if(typeof e.value=="string"){let r=t.valRaw.appendRawString(e.value);t.valLen.appendValue(r<<4|Qt.UTF8)}else if(ArrayBuffer.isView(e.value)){let r=t.valRaw.appendRawBytes(new Uint8Array(e.value.buffer));t.valLen.appendValue(r<<4|Qt.BYTES)}else if(typeof e.value=="number"){let[r,n]=lH(e),i;r===Qt.LEB128_UINT?i=t.valRaw.appendUint53(n):r===Qt.IEEE754?i=t.valRaw.appendRawBytes(n):i=t.valRaw.appendInt53(n),t.valLen.appendValue(i<<4|r)}else if(typeof e.datatype=="number"&&e.datatype>=Qt.MIN_UNKNOWN&&e.datatype<=Qt.MAX_UNKNOWN&&e.value instanceof Uint8Array){let r=t.valRaw.appendRawBytes(e.value);t.valLen.appendValue(r<<4|e.datatype)}else throw e.datatype?new RangeError(`Unknown datatype ${e.datatype} for value ${e.value}`):new RangeError(`Unsupported value in operation: ${e.value}`)}function uD(e,t){if(e===Qt.NULL)return{value:null};if(e===Qt.FALSE)return{value:!1};if(e===Qt.TRUE)return{value:!0};if(e%16===Qt.UTF8)return{value:rH(t)};if(e%16===Qt.LEB128_UINT)return{value:new yi(t).readUint53(),datatype:"uint"};if(e%16===Qt.LEB128_INT)return{value:new yi(t).readInt53(),datatype:"int"};if(e%16===Qt.IEEE754){let r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.byteLength===8)return{value:r.getFloat64(0,!0),datatype:"float64"};throw new RangeError(`Invalid length for floating point number: ${t.byteLength}`)}else return e%16===Qt.COUNTER?{value:new yi(t).readInt53(),datatype:"counter"}:e%16===Qt.TIMESTAMP?{value:new yi(t).readInt53(),datatype:"timestamp"}:{value:t,datatype:e%16}}function J4(e,t,r,n){let{columnId:i,columnName:a,decoder:s}=e[t];if(i%8===mt.VALUE_LEN&&t+1>4),{value:f,datatype:d}=uD(u,c);return n[a]=f,d&&(n[a+"_datatype"]=d),2}else if(i%8===mt.ACTOR_ID){let u=s.readValue();if(u===null)n[a]=null;else{if(!r[u])throw new RangeError(`No actor index ${u}`);n[a]=r[u]}}else n[a]=s.readValue();return 1}function hH(e,t){let r={objActor:new Ai("uint"),objCtr:new Ai("uint"),keyActor:new Ai("uint"),keyCtr:new _l,keyStr:new Ai("utf8"),insert:new rD,action:new Ai("uint"),valLen:new Ai("uint"),valRaw:new Fl,chldActor:new Ai("uint"),chldCtr:new _l};t?(r.idActor=new Ai("uint"),r.idCtr=new _l,r.succNum=new Ai("uint"),r.succActor=new Ai("uint"),r.succCtr=new _l):(r.predNum=new Ai("uint"),r.predCtr=new _l,r.predActor=new Ai("uint"));for(let i of e)if(uH(i,r),oH(i,r),r.insert.appendValue(!!i.insert),cH(i,r),fH(i,r),i.child&&i.child.counter?(r.chldActor.appendValue(i.child.actorNum),r.chldCtr.appendValue(i.child.counter)):(r.chldActor.appendValue(null),r.chldCtr.appendValue(null)),t){r.idActor.appendValue(i.id.actorNum),r.idCtr.appendValue(i.id.counter),r.succNum.appendValue(i.succ.length),i.succ.sort(n2);for(let a=0;ai.columnId-a.columnId)}function dH(e,t){return t===void 0?typeof e=="string"||typeof e=="boolean"||e===null:typeof e=="number"}function pH(e,t,r){let n=t,i=[];for(let a of e)if(a.action==="set"&&a.values&&a.insert){if(a.pred.length!==0)throw new RangeError("multi-insert pred must be empty");let s=a.elemId,u=a.datatype;for(let c of a.values){if(!dH(c,u))throw new RangeError(`Decode failed: bad value/datatype association (${c},${u})`);i.push({action:"set",obj:a.obj,elemId:s,datatype:u,value:c,pred:[],insert:!0}),s=`${n}@${r}`,n+=1}}else if(a.action==="del"&&a.multiOp>1){if(a.pred.length!==1)throw new RangeError("multiOp deletion must have exactly one pred");let s=mu(a.elemId),u=mu(a.pred[0]);for(let c=0;c`${c.succCtr}@${c.succActor}`),Z4(n.succNum.map(c=>({counter:c.succCtr,actorId:c.succActor})))):(u.pred=n.predNum.map(c=>`${c.predCtr}@${c.predActor}`),Z4(n.predNum.map(c=>({counter:c.predCtr,actorId:c.predActor})))),r.push(u)}return r}function Z4(e){let t=null;for(let r of e){if(t&&n2(t,r)!==-1)throw new RangeError("operation IDs are not in ascending order");t=r}}function gH(e){return(e&7)===mt.INT_DELTA?new _l:(e&7)===mt.BOOLEAN?new rD:(e&7)===mt.STRING_RLE?new Ai("utf8"):(e&7)===mt.VALUE_RAW?new Fl:new Ai("uint")}function fp(e,t){return(e&7)===mt.INT_DELTA?new nH(t):(e&7)===mt.BOOLEAN?new iH(t):(e&7)===mt.STRING_RLE?new X4("utf8",t):(e&7)===mt.VALUE_RAW?new yi(t):new X4("uint",t)}function cD(e,t){let r=new Uint8Array(0),n=[],i=0,a=0;for(;i!i.decoder.done);){let i={},a=0;for(;a>4,c=1;for(;a+c>4===u;)c++;if(s%8===mt.GROUP_CARD){let f=[],d=e[a].decoder.readValue();for(let g=0;g>>0,r=-1,n=[],i=e.readUint53();for(let a=0;an.encoder.buffer.byteLength>0);e.appendUint53(r.length);for(let n of r)e.appendUint53(n.columnId),e.appendUint53(n.encoder.buffer.byteLength)}function lD(e){let t=e.readUint53(),r=[];for(let s=0;s{if(!Array.isArray(n.deps))throw new TypeError("deps is not an array");u.appendUint53(n.deps.length);for(let f of n.deps.slice().sort())u.appendRawBytes(tD(f));u.appendHexString(n.actor),u.appendUint53(n.seq),u.appendUint53(n.startOp),u.appendInt53(n.time),u.appendPrefixedString(n.message||""),u.appendUint53(r.length-1);for(let f of r.slice(1))u.appendHexString(f);let c=hH(n.ops,!1);a2(u,c);for(let f of c)u.appendRawBytes(f.encoder.buffer);n.extraBytes&&u.appendRawBytes(n.extraBytes)}),s=dp(i);if(e.hash&&e.hash!==s)throw new RangeError(`Change hash does not match encoding: ${e.hash} != ${s}`);return a.byteLength>=iD?vH(a):a}function dD(e){e[8]===ph&&(e=pD(e));let t=new yi(e),r=Il(t,!0),n=new yi(r.chunkData);if(!t.done)throw new RangeError("Encoded change has trailing data");if(r.chunkType!==Sl)throw new RangeError(`Unexpected chunk type: ${r.chunkType}`);let i=lD(n),a=s2(n);for(let s=0;sn.counter?1:r.actorIdn.actorId?1:0}function AH(e,t){let r={};for(let i of e){if(i.ops=[],r[i.actor]||(r[i.actor]=[]),i.seq!==r[i.actor].length+1)throw new RangeError(`Expected seq = ${r[i.actor].length+1}, got ${i.seq}`);if(i.seq>1&&r[i.actor][i.seq-2].maxOp>i.maxOp)throw new RangeError("maxOp must increase monotonically per actor");r[i.actor].push(i)}let n={};for(let i of t){if(i.action==="del")throw new RangeError("document should not contain del operations");i.pred=n[i.id]?n[i.id].pred:[],n[i.id]=i;for(let a of i.succ){if(!n[a])if(i.elemId){let s=i.insert?i.id:i.elemId;n[a]={id:a,action:"del",obj:i.obj,elemId:s,pred:[]}}else n[a]={id:a,action:"del",obj:i.obj,key:i.key,pred:[]};n[a].pred.push(i.id)}delete i.succ}for(let i of Object.values(n))i.action==="del"&&t.push(i);for(let i of t){let{counter:a,actorId:s}=mu(i.id),u=r[s],c=0,f=u.length;for(;c=u.length)throw new RangeError(`Operation ID ${i.id} outside of allowed range`);u[c].ops.push(i)}for(let i of e){i.ops.sort((a,s)=>wH(a.id,s.id)),i.startOp=i.maxOp-i.ops.length+1,delete i.maxOp;for(let a=0;af.depsIndex)){if(!e[c]||!e[c].hash)throw new RangeError(`No hash for index ${c} while processing index ${s}`);let f=e[c].hash;u.deps.push(f),r[f]&&delete r[f]}if(u.deps.sort(),delete u.depsNum,u.extraLen_datatype!==Qt.BYTES)throw new RangeError(`Bad datatype for extra bytes: ${Qt.BYTES}`);u.extraBytes=u.extraLen,delete u.extraLen_datatype,e[s]=l2(hD(u)),r[e[s].hash]=!0}let n=Object.keys(r).sort(),i=n.length===t.length,a=0;for(;i&&a{u.appendUint53(n.length);for(let c of n)u.appendHexString(c);u.appendUint53(i.length);for(let c of i.sort())u.appendRawBytes(tD(c));a2(u,t),a2(u,r);for(let c of t)u.appendRawBytes(c.encoder.buffer);for(let c of r)u.appendRawBytes(c.encoder.buffer);for(let c of a)u.appendUint53(c);s&&u.appendRawBytes(s)}).bytes}function mD(e){let t=new yi(e),r=Il(t,!0),n=new yi(r.chunkData);if(!t.done)throw new RangeError("Encoded document has trailing data");if(r.chunkType!==u2)throw new RangeError(`Unexpected chunk type: ${r.chunkType}`);let i=[],a=n.readUint53();for(let p=0;p=iD&&(e.encoder={buffer:hp.deflateRaw(e.encoder.buffer)},e.columnId|=dh)}function eD(e){e.columnId&dh&&(e.buffer=hp.inflateRaw(e.buffer),e.columnId^=dh)}ED.exports={COLUMN_TYPE:mt,VALUE_TYPE:Qt,ACTIONS:hh,OBJECT_TYPE:sH,DOC_OPS_COLUMNS:c2,CHANGE_COLUMNS:o2,DOCUMENT_COLUMNS:aD,encoderByColumnId:gH,decoderByColumnId:fp,makeDecoders:cD,decodeValue:uD,splitContainers:gD,encodeChange:hD,decodeChangeColumns:dD,decodeChange:l2,decodeChangeMeta:mH,decodeChanges:EH,encodeDocumentHeader:bH,decodeDocumentHeader:mD,decodeDocument:vD}});var TD=ce((lX,OD)=>{var{parseOpId:mp,copyObject:vp}=Ss(),{COLUMN_TYPE:_n,VALUE_TYPE:h2,ACTIONS:vu,OBJECT_TYPE:wD,DOC_OPS_COLUMNS:AD,CHANGE_COLUMNS:Kt,DOCUMENT_COLUMNS:Bs,encoderByColumnId:Pl,decoderByColumnId:A2,makeDecoders:mh,decodeValue:pp,encodeChange:CH,decodeChangeColumns:_H,decodeChangeMeta:DH,decodeChanges:FH,decodeDocumentHeader:SH,encodeDocumentHeader:IH}=gh(),Eh=600,BH=10,FD=7,SD=Math.floor(BH*Eh/8),Sr=0,vr=1,bn=2,Cn=3,bt=4,kn=5,lr=6,Nn=7,jr=8,Zu=9,sc=10,Qu=13,Bl=14,$l=15,$s=13,d2=14,Rl=15,yD=Kt.filter(e=>["predNum","predActor","predCtr"].includes(e.columnName)).map(e=>e.columnId);function p2(e,t,r){if(t.length===1)e[t[0]]=r;else{let n=Object.assign({},e[t[0]]);p2(n,t.slice(1),r),e[t[0]]=n}}function bD(e,t,r,n){for(let H of t)H.decoder.reset();let{objActor:i,objCtr:a,keyActor:s,keyCtr:u,keyStr:c,idActor:f,idCtr:d,insert:g}=e,[p,h,,,E,v,b,m,y,,,,,D]=t.map(H=>H.decoder),_=0,F=0,L=!1,k=null,S=null,B=null,O=null,x=null,U=null,Y=0;if(a!==null&&!n)for(;(!h.done||!p.done||!y.done)&&(S=h.readValue(),k=r[p.readValue()],y.skipValues(1),S===null||!k||S0&&s!==null){for(_+=1;!b.done&&!v.done&&(O!==u||B!==s)&&(U&&(L=!1),Y===0&&!L&&(F+=1,L=!0),O=b.readValue(),B=r[v.readValue()],S=h.readValue(),k=r[p.readValue()],U=m.readValue(),Y=D.readValue(),S===a&&k===i);)_+=1;if(S!==a||k!==i||O!==u||B!==s||!U)return{found:!1,skipCount:_,visibleCount:F};if(U&&(L=!1),Y===0&&!L&&(F+=1,L=!0),b.done||v.done)return{found:!0,skipCount:_,visibleCount:F};O=b.readValue(),B=r[v.readValue()],S=h.readValue(),k=r[p.readValue()],U=m.readValue(),Y=D.readValue()}for(;(!U||O>d||O===d&&B>f)&&S===a&&k===i&&(_+=1,U&&(L=!1),Y===0&&!L&&(F+=1,L=!0),!b.done&&!v.done);)O=b.readValue(),B=r[v.readValue()],S=h.readValue(),k=r[p.readValue()],U=m.readValue(),Y=D.readValue()}else if(u!==null&&u>0&&s!==null){for(;(!U||O!==u||B!==s)&&S===a&&k===i&&(_+=1,U&&(L=!1),Y===0&&!L&&(F+=1,L=!0),!b.done&&!v.done);)O=b.readValue(),B=r[v.readValue()],S=h.readValue(),k=r[p.readValue()],U=m.readValue(),Y=D.readValue();if(S!==a||k!==i||O!==u||B!==s||!U)return{found:!1,skipCount:_,visibleCount:F}}return{found:!0,skipCount:_,visibleCount:F}}function CD(e,t,r,n){let i=e.blocks[t],a=e.blocks[t+1];return i.lastObjectActor!==r||i.lastObjectCtr!==n||i.numVisible===void 0?0:i.lastVisibleActor===a.firstVisibleActor&&i.lastVisibleActor!==void 0&&i.lastVisibleCtr===a.firstVisibleCtr&&i.lastVisibleCtr!==void 0?i.numVisible-1:i.numVisible}function ID(e,t){let{objActor:r,objActorNum:n,objCtr:i,keyActor:a,keyCtr:s,keyStr:u}=t,c=0,f=0;if(i!==null)for(;ci)throw new RangeError(`Reference element not found: ${s}@${a}`);f+=CD(e,c,n,i),c++}let{found:h,skipCount:E,visibleCount:v}=bD(t,e.blocks[c].columns,e.actorIds,p);if(c===e.blocks.length-1||e.blocks[c].lastObjectActor!==n||e.blocks[c].lastObjectCtr!==i){if(h)return{blockIndex:c,skipCount:E,visibleCount:f+v};throw new RangeError(`Reference element not found: ${s}@${a}`)}else if(h&&E>>0)%n;for(let u=0;u>>3]|=1<<(i&7),i=(i+a)%n,a=(a+s)%n}function $D(e,t,r){let n=8*e.byteLength,i=r%n,a=t%n,s=((r^t)*16777619>>>0)%n;for(let u=0;u>>3]&1<<(i&7)))return!1;i=(i+a)%n,a=(a+s)%n}return!0}function RD(e){e.bloom=new Uint8Array(SD),e.numOps=0,e.lastKey=void 0,e.numVisible=void 0,e.lastObjectActor=void 0,e.lastObjectCtr=void 0,e.firstVisibleActor=void 0,e.firstVisibleCtr=void 0,e.lastVisibleActor=void 0,e.lastVisibleCtr=void 0;for(let d of e.columns)d.decoder.reset();let[t,r,n,i,a,s,u,c,,,,,,f]=e.columns.map(d=>d.decoder);for(;!u.done;){e.numOps+=1;let d=t.readValue(),g=r.readValue(),p=n.readValue(),h=i.readValue(),E=a.readValue(),v=s.readValue(),b=u.readValue(),m=c.readValue(),y=f.readValue();if((e.lastObjectActor!==d||e.lastObjectCtr!==g)&&(e.numVisible=0,e.lastObjectActor=d,e.lastObjectCtr=g),E!==null)e.lastKey=E;else if(m||h!==null){e.lastKey=void 0;let D=m?v:p,_=m?b:h;BD(e.bloom,D,_),y===0&&(e.firstVisibleActor===void 0&&(e.firstVisibleActor=D),e.firstVisibleCtr===void 0&&(e.firstVisibleCtr=_),(e.lastVisibleActor!==D||e.lastVisibleCtr!==_)&&(e.numVisible+=1,e.lastVisibleActor=D,e.lastVisibleCtr=_))}}}function f2(e,t,r,n){if(t[bt]!==null)e.lastObjectCtr===t[vr]&&e.lastObjectActor===t[Sr]&&(e.lastKey===void 0||e.lastKey({columnId:f.columnId,encoder:Pl(f.columnId)}));Ol(s,e.columns,a);let c={columns:s.map(f=>{let d=A2(f.columnId,f.encoder.buffer);return{columnId:f.columnId,decoder:d}})};RD(c),r.push(c),n+=a}return r}function $H(e){let t=e[0].columns.map(r=>({columnId:r.columnId,encoder:Pl(r.columnId)}));for(let r of e){for(let n of r.columns)n.decoder.reset();Ol(t,r.columns,r.numOps)}return t}function Ol(e,t,r){if(r===0)return;let n=0,i=-1,a=0,s=-1,u=0;for(let c of e){for(;n0&&(f=t[n].decoder);let d=c.columnId>>4===i?a:r;if(c.columnId%8===_n.GROUP_CARD)i=c.columnId>>4,f?a=c.encoder.copyFrom(f,{count:r,sumValues:!0}).sum:(c.encoder.appendValue(0,r),a=0);else if(c.columnId%8===_n.VALUE_LEN)if(f){if(n+1===t.length||t[n+1].columnId!==c.columnId+1)throw new RangeError("VALUE_LEN column without accompanying VALUE_RAW column");s=c.columnId+1,u=c.encoder.copyFrom(f,{count:d,sumValues:!0,sumShift:4}).sum}else c.encoder.appendValue(null,d),s=c.columnId+1,u=0;else if(c.columnId%8===_n.VALUE_RAW){if(c.columnId!==s)throw new RangeError("VALUE_RAW column without accompanying VALUE_LEN column");u>0&&c.encoder.appendRawBytes(f.readRawBytes(u))}else if(f)c.encoder.copyFrom(f,{count:d});else{let g=c.columnId%8===_n.BOOLEAN?!1:null;c.encoder.appendValue(g,d)}}}function g2(e,t){let r=[],n,i=-1,a=0,s=-1,u=0;for(let c of e){if(c.columnId%8===_n.VALUE_RAW){if(c.columnId!==s)throw new RangeError("unexpected VALUE_RAW column");n=c.decoder.readRawBytes(u)}else if(c.columnId%8===_n.GROUP_CARD)i=c.columnId>>4,a=c.decoder.readValue()||0,n=a;else if(c.columnId>>4===i){n=[],c.columnId%8===_n.VALUE_LEN&&(s=c.columnId+1,u=0);for(let f=0;f>>4),n.push(d)}}else n=c.decoder.readValue(),c.columnId%8===_n.ACTOR_ID&&t&&typeof n=="number"&&(n=t[n]),c.columnId%8===_n.VALUE_LEN&&(s=c.columnId+1,u=n>>>4);r.push(n)}return r}function gp(e,t,r){let n=0,i=-1,a=0;for(let s of e){for(;n>4,a=u,s.encoder.appendValue(u);else if(s.columnId>>4===i){if(!Array.isArray(u)||u.length!==a)throw new RangeError("bad group value");for(let c of u)s.encoder.appendValue(c)}else s.columnId%8===_n.VALUE_RAW?u&&s.encoder.appendRawBytes(u):s.encoder.appendValue(u)}else if(s.columnId%8===_n.GROUP_CARD)i=s.columnId>>4,a=0,s.encoder.appendValue(0);else if(s.columnId%8!==_n.VALUE_RAW){let u=s.columnId>>4===i?a:1,c=null;s.columnId%8===_n.BOOLEAN&&(c=!1),s.columnId%8===_n.VALUE_LEN&&(c=0),s.encoder.appendValue(c,u)}}}function m2(e,t){let r=e.blocks[t];if(r.columns[jr].decoder.done){if(t===e.blocks.length-1)return{docOp:null,blockIndex:t};t+=1,r=e.blocks[t];for(let n of r.columns)n.decoder.reset();return{docOp:g2(r.columns),blockIndex:t}}else return{docOp:g2(r.columns),blockIndex:t}}function PD(e,t){for(;t.changeIndexe.maxOp&&(e.maxOp=t.opCtr),t.opCtr+=1;let r=t.nextOp;if(r[vr]===null&&r[Sr]!==null||r[vr]!==null&&r[Sr]===null)throw new RangeError(`Mismatched object reference: (${r[vr]}, ${r[Sr]})`);if(r[Cn]===null&&r[bn]!==null||r[Cn]===0&&r[bn]!==null||r[Cn]>0&&r[bn]===null)throw new RangeError(`Mismatched operation key: (${r[Cn]}, ${r[bn]})`)}function xl(e,t){return t==="list"||t==="text"?{objectId:e,type:t,edits:[]}:{objectId:e,type:t,props:{}}}function _D(e,t,r=1){let n=mp(e),i=mp(t);return n.actorId===i.actorId&&n.counter+r===i.counter}function vh(e,t){if(e.length===0){e.push(t);return}let r=e[e.length-1];r.action==="insert"&&t.action==="insert"&&r.index===t.index-1&&r.value.type==="value"&&t.value.type==="value"&&r.elemId===r.opId&&t.elemId===t.opId&&_D(r.elemId,t.elemId,1)&&r.value.datatype===t.value.datatype&&typeof r.value.value==typeof t.value.value?(r.action="multi-insert",t.value.datatype&&(r.datatype=t.value.datatype),r.values=[r.value.value,t.value.value],delete r.value,delete r.opId):r.action==="multi-insert"&&t.action==="insert"&&r.index+r.values.length===t.index&&t.value.type==="value"&&t.elemId===t.opId&&_D(r.elemId,t.elemId,r.values.length)&&r.datatype===t.value.datatype&&typeof r.values[0]==typeof t.value.value?r.values.push(t.value.value):r.action==="remove"&&t.action==="remove"&&r.index===t.index?r.count+=t.count:e.push(t)}function v2(e,t,r,n,i,a){let s=!1;if(a)for(;!s&&e.length>0;){let u=e[e.length-1];if((u.action==="insert"||u.action==="update")&&u.index===t)e.pop(),s=u.action==="insert";else if(u.action==="multi-insert"&&u.index+u.values.length-1===t)u.values.pop(),s=!0;else break}s?vh(e,{action:"insert",index:t,elemId:r,opId:n,value:i}):vh(e,{action:"update",index:t,opId:n,value:i})}function RH(e,t,r){let n=[];for(;e.length>0;){let a=e[e.length-1];if(a.action==="insert"){if(a.index!==t)throw new RangeError("last edit has unexpected index");n.unshift(e.pop());break}else if(a.action==="update"){if(a.index!==t)throw new RangeError("last edit has unexpected index");n.unshift(e.pop())}else throw new RangeError("last edit has unexpected action")}let i=!0;for(let a of n)v2(e,t,r,a.opId,a.value,i),i=!1}function E2(e,t,r,n,i,a,s,u){let c=!t,f=n[jr]0;v||(a[h].visibleOps.push(n),a[h].hasChild=a[h].hasChild||n[jr]%2===0);let b=i.objectMeta[r].children[h];if(a[h].hasChild||b&&Object.keys(b).length>0){let _={};for(let F of a[h].visibleOps){let L=`${F[lr]}@${i.actorIds[F[kn]]}`;if(vu[F[jr]]==="set")_[L]=Object.assign({type:"value"},pp(F[Zu],F[sc]));else if(F[jr]%2===0){let k=F[jr]1?_.count-=1:D.edits.pop(),a[h].action="update",v2(D.edits,s,h,m,y,!0),t&&t.lastObjectActor===n[Sr]&&t.lastObjectCtr===n[vr]&&(t.numVisible+=1)}else v2(D.edits,s,h,m,y,!a[h].action),a[h].action||(a[h].action="update");else u===0&&!a[h].action&&(a[h].action="remove",vh(D.edits,{action:"remove",index:s,count:1}),t&&t.lastObjectActor===n[Sr]&&t.lastObjectCtr===n[vr]&&(t.numVisible-=1));else(y||!c)&&((E||!D.props[n[bt]])&&(D.props[n[bt]]={}),y&&(D.props[n[bt]][m]=y))}function xH(e,t,r,n,i,a,s){let u=n.nextOp,c=u[Nn],f=u[Sr],d=u[vr],g=f===null?"_root":`${d}@${i.actorIds[f]}`,p=n.actorIndex,h=i.actorIds[p],E=!1,v=!1,b={},m;({docOp:m,blockIndex:s}=m2(i,s));let y=m===null?0:1,D=m===null?0:m[$s],_=null,F=[],L=[],k=[],S=null;for(n.objectIds.add(g);;){if(F.length===0){E=!1;let H=n.nextOp;for(;!n.done&&H[kn]===p&&H[Nn]===c&&H[Sr]===u[Sr]&&H[vr]===u[vr];){let K=F.length>0?F[F.length-1]:null,W=!1;for(let ie=0;ie0&&(_=F[0]);let B=m&&m[Sr]===_[Sr]&&m[vr]===_[vr],O=m&&m[bt]!==null&&m[bt]===_[bt],x=m&&m[bt]===null&&_[bt]===null&&(!m[Nn]&&m[bn]===_[bn]&&m[Cn]===_[Cn]||m[Nn]&&m[kn]===_[bn]&&m[lr]===_[Cn]);if(F.length===0&&!(B&&(O||x)))break;let U=!1,Y=0;if(c||!B||m[bt]===null&&_[bt]!==null||m[bt]!==null&&_[bt]!==null&&_[bt]=0;H--){let K=!0;for(let W=0;W0){for(let H=0;H({columnId:B.columnId,encoder:Pl(B.columnId)}));Ol(_,m.columns,v);let{blockIndex:F,docOpsConsumed:L}=xH(e,D,_,t,r,b,E),k=r.blocks[F],S=-v-L;for(let B=E;B<=F;B++)S+=r.blocks[B].numOps;Ol(_,k.columns,S),D.numOps+=S;for(let B of k.columns)if(!B.decoder.done)throw new RangeError(`excess ops in column ${B.columnId}`);if(D.columns=_.map(B=>{let O=A2(B.columnId,B.encoder.buffer);return{columnId:B.columnId,decoder:O}}),E===F&&D.numOps<=Eh)S>0&&m.lastVisibleActor!==void 0&&m.lastVisibleCtr!==void 0&&(D.lastVisibleActor=m.lastVisibleActor,D.lastVisibleCtr=m.lastVisibleCtr),r.blocks[E]=D;else{let B=xD(D);r.blocks.splice(E,F-E+1,...B)}}function OH(e,t){if(t[Sr].columnId!==Kt[Sr].columnId||Kt[Sr].columnName!=="objActor"||t[vr].columnId!==Kt[vr].columnId||Kt[vr].columnName!=="objCtr"||t[bn].columnId!==Kt[bn].columnId||Kt[bn].columnName!=="keyActor"||t[Cn].columnId!==Kt[Cn].columnId||Kt[Cn].columnName!=="keyCtr"||t[bt].columnId!==Kt[bt].columnId||Kt[bt].columnName!=="keyStr"||t[kn].columnId!==Kt[kn].columnId||Kt[kn].columnName!=="idActor"||t[lr].columnId!==Kt[lr].columnId||Kt[lr].columnName!=="idCtr"||t[Nn].columnId!==Kt[Nn].columnId||Kt[Nn].columnName!=="insert"||t[jr].columnId!==Kt[jr].columnId||Kt[jr].columnName!=="action"||t[Zu].columnId!==Kt[Zu].columnId||Kt[Zu].columnName!=="valLen"||t[sc].columnId!==Kt[sc].columnId||Kt[sc].columnName!=="valRaw"||t[Qu].columnId!==Kt[Qu].columnId||Kt[Qu].columnName!=="predNum"||t[Bl].columnId!==Kt[Bl].columnId||Kt[Bl].columnName!=="predActor"||t[$l].columnId!==Kt[$l].columnId||Kt[$l].columnName!=="predCtr")throw new RangeError("unexpected columnId");let r=e.blocks[0].columns;if(!t.every(n=>yD.includes(n.columnId)||r.find(i=>i.columnId===n.columnId))){let n=r.map(i=>({columnId:i.columnId}));for(let i of t){let{columnId:a}=i;!yD.includes(a)&&!r.find(s=>s.columnId===a)&&n.push({columnId:a})}n.sort((i,a)=>i.columnId-a.columnId);for(let i=0;i({columnId:s.columnId,buffer:s.decoder.buf})),n),e.blocks[i]=a}}}function TH(e,t){if(e.indexOf(t.actorIds[0])<0){if(t.seq!==1)throw new RangeError(`Seq ${t.seq} is the first change for actor ${t.actorIds[0]}`);e=e.concat([t.actorIds[0]])}let r=[];for(let n of t.actorIds){let i=e.indexOf(n);if(i<0)throw new RangeError(`actorId ${n} is not known to document`);r.push(i)}return{actorIds:e,actorTable:r}}function kH(e,t,r){for(let n of t){let i=r.objectMeta[n],a=null,s=!1;for(;;){let u=a&&Object.keys(i.children[a.parentKey]).length>0;if(e[n]||(e[n]=xl(n,i.type)),a&&u)if(i.type==="list"||i.type==="text"){for(let c of e[n].edits)c.opId&&i.children[a.parentKey][c.opId]&&(s=!0);if(!s){let c=mp(n),f=mp(a.parentKey),d={objActor:c.actorId,objCtr:c.counter,keyActor:f.actorId,keyCtr:f.counter,objActorNum:r.actorIds.indexOf(c.actorId),keyActorNum:r.actorIds.indexOf(f.actorId),keyStr:null,insert:!1,objId:n},{visibleCount:g}=ID(r,d);for(let[p,h]of Object.entries(i.children[a.parentKey])){let E=h;h.objectId&&(e[h.objectId]||(e[h.objectId]=xl(h.objectId,h.type)),E=e[h.objectId]);let v={action:"update",index:g,opId:p,value:E};vh(e[n].edits,v)}}}else{e[n].props[a.parentKey]||(e[n].props[a.parentKey]={});let c=e[n].props[a.parentKey];for(let[f,d]of Object.entries(i.children[a.parentKey]))c[f]?s=!0:d.objectId?(e[d.objectId]||(e[d.objectId]=xl(d.objectId,d.type)),c[f]=e[d.objectId]):c[f]=d}if(s||!i.parentObj||a&&!u)break;a=i,n=i.parentObj,i=r.objectMeta[n]}}return e}function NH(e,t,r,n,i){let a=new Set(r.heads),s=new Set,u=vp(r.clock),c=[],f=[];for(let d of t){if(r.changeIndexByHash[d.hash]!==void 0||s.has(d.hash))continue;let g=(u[d.actor]||0)+1,p=!0;for(let h of d.deps){let E=r.changeIndexByHash[h];(E===void 0||E===-1)&&!s.has(h)&&(p=!1)}if(!p)f.push(d);else if(d.seqg)throw new RangeError(`Skipped sequence number ${g} for actor ${d.actor}`);u[d.actor]=d.seq,s.add(d.hash);for(let h of d.deps)a.delete(h);a.add(d.hash),c.push(d)}}if(c.length>0){let d={changes:c,changeIndex:-1,objectIds:n};for(PD(r,d);!d.done;)PH(e,d,r);r.heads=[...a].sort(),r.clock=u}return[c,f]}function DD(e){for(let d of e.blocks[0].columns)d.decoder.reset();let t={},r=null,n=0,i={_root:{objectId:"_root",type:"map",props:{}}},a=null,s=null,u="_root",c=!1,f=0;for(;{docOp:r,blockIndex:n}=m2(e,n),r!==null;){(r[Sr]!==a||r[vr]!==s)&&(u=`${r[vr]}@${e.actorIds[r[Sr]]}`,a=r[Sr],s=r[vr],t={},f=0,c=!1),r[Nn]&&c&&(c=!1,f++),r[$s]===0&&(c=!0),r[lr]>e.maxOp&&(e.maxOp=r[lr]);for(let d=0;de.maxOp&&(e.maxOp=r[Rl][d]);E2(i,null,u,r,e,t,f,r[$s])}return i._root}function LH(e){let t=mh(e.changesColumns,Bs),r=t[0].decoder,n=t[1].decoder,i=t[5].decoder,a=t[6].decoder;if(t[0].columnId!==Bs[0].columnId||Bs[0].columnName!=="actor"||t[1].columnId!==Bs[1].columnId||Bs[1].columnName!=="seq"||t[5].columnId!==Bs[5].columnId||Bs[5].columnName!=="depsNum"||t[6].columnId!==Bs[6].columnId||Bs[6].columnName!=="depsIndex")throw new RangeError("unexpected columnId");let s=0,u={},c=[],f=new Set;for(;!r.done;){let p=r.readValue(),h=n.readValue(),E=i.readValue(),v=e.actorIds[p];if(h!==1&&h!==u[v]+1)throw new RangeError(`Expected seq ${u[v]+1}, got ${h} for actor ${v}`);c.push(p),u[v]=h,f.add(s);for(let b=0;be.actorIds[c[p]]).sort();for(let p of t)p.decoder.reset();let g=t.map(p=>({columnId:p.columnId,encoder:Pl(p.columnId)}));return Ol(g,t,s),{clock:u,headActors:d,encoders:g,numChanges:s}}function UH(e,t,r,n){gp(e,Bs,[r.indexOf(t.actor),t.seq,t.maxOp,t.time,t.message,t.deps.length,t.deps.map(i=>n[i]),t.extraBytes?t.extraBytes.byteLength<<4|h2.BYTES:h2.BYTES,t.extraBytes])}var w2=class e{constructor(t){if(this.maxOp=0,this.haveHashGraph=!1,this.changes=[],this.changeIndexByHash={},this.dependenciesByHash={},this.dependentsByHash={},this.hashesByActor={},this.actorIds=[],this.heads=[],this.clock={},this.queue=[],this.objectMeta={_root:{parentObj:null,parentKey:null,opId:null,type:"map",children:{}}},t){let r=SH(t),{clock:n,headActors:i,encoders:a,numChanges:s}=LH(r);if(this.binaryDoc=t,this.changes=new Array(s),this.actorIds=r.actorIds,this.heads=r.heads,this.clock=n,this.changesEncoders=a,this.extraBytes=r.extraBytes,r.heads.length===1&&i.length===1&&(this.hashesByActor[i[0]]=[],this.hashesByActor[i[0]][n[i[0]]-1]=r.heads[0]),r.heads.length===r.headsIndexes.length)for(let c=0;cEh&&(this.blocks=xD(this.blocks[0]));let u={blocks:this.blocks,actorIds:this.actorIds,objectMeta:this.objectMeta,maxOp:0};this.initPatch=DD(u),this.maxOp=u.maxOp}else this.haveHashGraph=!0,this.changesEncoders=Bs.map(r=>({columnId:r.columnId,encoder:Pl(r.columnId)})),this.blocks=[{columns:mh([],AD),bloom:new Uint8Array(SD),numOps:0,lastKey:void 0,numVisible:void 0,lastObjectActor:void 0,lastObjectCtr:void 0,firstVisibleActor:void 0,firstVisibleCtr:void 0,lastVisibleActor:void 0,lastVisibleCtr:void 0}]}clone(){let t=new e;return t.maxOp=this.maxOp,t.haveHashGraph=this.haveHashGraph,t.changes=this.changes.slice(),t.changeIndexByHash=vp(this.changeIndexByHash),t.dependenciesByHash=vp(this.dependenciesByHash),t.dependentsByHash=Object.entries(this.dependentsByHash).reduce((r,[n,i])=>(r[n]=i.slice(),r),{}),t.hashesByActor=Object.entries(this.hashesByActor).reduce((r,[n,i])=>(r[n]=i.slice(),r),{}),t.actorIds=this.actorIds,t.heads=this.heads,t.clock=this.clock,t.blocks=this.blocks,t.objectMeta=this.objectMeta,t.queue=this.queue,t}applyChanges(t,r=!1){let n=t.map(d=>{let g=_H(d);return g.buffer=d,g}),i={_root:{objectId:"_root",type:"map",props:{}}},a={maxOp:this.maxOp,changeIndexByHash:this.changeIndexByHash,actorIds:this.actorIds,heads:this.heads,clock:this.clock,blocks:this.blocks.slice(),objectMeta:Object.assign({},this.objectMeta)},s=this.queue.length===0?n:n.concat(this.queue),u=[],c=new Set;for(;;){let[d,g]=NH(i,s,a,c,this.haveHashGraph);s=g;for(let p=0;p0&&(u=u.concat(d)),s.length===0)break;if(d.length===0){if(this.haveHashGraph)break;this.computeHashGraph(),a.changeIndexByHash=this.changeIndexByHash}}kH(i,c,a);for(let d of u){this.changes.push(d.buffer),this.hashesByActor[d.actor]||(this.hashesByActor[d.actor]=[]),this.hashesByActor[d.actor][d.seq-1]=d.hash,this.changeIndexByHash[d.hash]=this.changes.length-1,this.dependenciesByHash[d.hash]=d.deps,this.dependentsByHash[d.hash]=[];for(let g of d.deps)this.dependentsByHash[g]||(this.dependentsByHash[g]=[]),this.dependentsByHash[g].push(d.hash);UH(this.changesEncoders,d,a.actorIds,this.changeIndexByHash)}this.maxOp=a.maxOp,this.actorIds=a.actorIds,this.heads=a.heads,this.clock=a.clock,this.blocks=a.blocks,this.objectMeta=a.objectMeta,this.queue=s,this.binaryDoc=null,this.initPatch=null;let f={maxOp:this.maxOp,clock:this.clock,deps:this.heads,pendingChanges:this.queue.length,diffs:i._root};return r&&n.length===1&&(f.actor=n[0].actor,f.seq=n[0].seq),f}computeHashGraph(){let t=this.save();this.haveHashGraph=!0,this.changes=[],this.changeIndexByHash={},this.dependenciesByHash={},this.dependentsByHash={},this.hashesByActor={},this.clock={};for(let r of FH([t])){let n=CH(r);this.changes.push(n),this.changeIndexByHash[r.hash]=this.changes.length-1,this.dependenciesByHash[r.hash]=r.deps,this.dependentsByHash[r.hash]=[];for(let a of r.deps)this.dependentsByHash[a].push(r.hash);r.seq===1&&(this.hashesByActor[r.actor]=[]),this.hashesByActor[r.actor].push(r.hash);let i=(this.clock[r.actor]||0)+1;if(r.seq!==i)throw new RangeError(`Expected seq ${i}, got seq ${r.seq} from actor ${r.actor}`);this.clock[r.actor]=r.seq}}getChanges(t){if(this.haveHashGraph||this.computeHashGraph(),t.length===0)return this.changes.slice();let r=[],n={},i=[];for(let a of t){n[a]=!0;let s=this.dependentsByHash[a];if(!s)throw new RangeError(`hash not found: ${a}`);r.push(...s)}for(;r.length>0;){let a=r.pop();if(n[a]=!0,i.push(a),!this.dependenciesByHash[a].every(s=>n[s]))break;r.push(...this.dependentsByHash[a])}if(r.length===0&&this.heads.every(a=>n[a]))return i.map(a=>this.changes[this.changeIndexByHash[a]]);for(r=t.slice(),n={};r.length>0;){let a=r.pop();if(!n[a]){let s=this.dependenciesByHash[a];if(!s)throw new RangeError(`hash not found: ${a}`);r.push(...s),n[a]=!0}}return this.changes.filter(a=>!n[DH(a,!0).hash])}getChangesAdded(t){this.haveHashGraph||this.computeHashGraph();let r=this.heads.slice(),n={},i=[];for(;r.length>0;){let a=r.pop();!n[a]&&t.changeIndexByHash[a]===void 0&&(n[a]=!0,i.push(a),r.push(...this.dependenciesByHash[a]))}return i.reverse().map(a=>this.changes[this.changeIndexByHash[a]])}getChangeByHash(t){return this.haveHashGraph||this.computeHashGraph(),this.changes[this.changeIndexByHash[t]]}getMissingDeps(t=[]){this.haveHashGraph||this.computeHashGraph();let r=new Set(t),n=new Set;for(let a of this.queue){n.add(a.hash);for(let s of a.deps)r.add(s)}let i=[];for(let a of r)this.changeIndexByHash[a]===void 0&&!n.has(a)&&i.push(a);return i.sort()}save(){if(this.binaryDoc)return this.binaryDoc;let t=this.changesEncoders.map(n=>({columnId:n.columnId,encoder:Pl(n.columnId)})),r=this.changesEncoders.map(n=>{let i=A2(n.columnId,n.encoder.buffer);return{columnId:n.columnId,decoder:i}});return Ol(t,r,this.changes.length),this.binaryDoc=IH({changesColumns:this.changesEncoders,opsColumns:$H(this.blocks),actorIds:this.actorIds,heads:this.heads,headsIndexes:this.heads.map(n=>this.changeIndexByHash[n]),extraBytes:this.extraBytes}),this.changesEncoders=t,this.binaryDoc}getPatch(){let t={_root:{parentObj:null,parentKey:null,opId:null,type:"map",children:{}}},r={blocks:this.blocks,actorIds:this.actorIds,objectMeta:t,maxOp:0},n=this.initPatch?this.initPatch:DD(r);return{maxOp:this.maxOp,clock:this.clock,deps:this.heads,pendingChanges:this.queue.length,diffs:n}}};OD.exports={MAX_BLOCK_SIZE:Eh,BackendDoc:w2,bloomFilterContains:$D}});var ND=ce((fX,kD)=>{function jH(e){if(e.frozen)throw new Error("Attempting to use an outdated Automerge document that has already been updated. Please use the latest document state, or call Automerge.clone() if you really need to use this old document state.");return e.state}kD.exports={backendState:jH}});var y2=ce((hX,HD)=>{var{encodeChange:HH}=gh(),{BackendDoc:UD}=TD(),{backendState:Rs}=ND();function MH(){return{state:new UD,heads:[]}}function qH(e){return{state:Rs(e).clone(),heads:e.heads}}function VH(e){e.state=null,e.frozen=!0}function KH(e,t){let r=Rs(e),n=r.applyChanges(t);return e.frozen=!0,[{state:r,heads:r.heads},n]}function LD(e,t,r){if(e.hashesByActor[t]&&e.hashesByActor[t][r]||!e.haveHashGraph&&(e.computeHashGraph(),e.hashesByActor[t]&&e.hashesByActor[t][r]))return e.hashesByActor[t][r];throw new RangeError(`Unknown change: actorId = ${t}, seq = ${r+1}`)}function zH(e,t){let r=Rs(e);if(t.seq<=r.clock[t.actor])throw new RangeError("Change request has already been applied");if(t.seq>1){let s=LD(r,t.actor,t.seq-2);if(!s)throw new RangeError(`Cannot find hash of localChange before seq=${t.seq}`);let u={[s]:!0};for(let c of t.deps)u[c]=!0;t.deps=Object.keys(u).sort()}let n=HH(t),i=r.applyChanges([n],!0);e.frozen=!0;let a=LD(r,t.actor,t.seq-1);return i.deps=i.deps.filter(s=>s!==a),[{state:r,heads:r.heads},i,n]}function GH(e){return Rs(e).save()}function YH(e){let t=new UD(e);return{state:t,heads:t.heads}}function WH(e,t){let r=Rs(e);return r.applyChanges(t),e.frozen=!0,{state:r,heads:r.heads}}function XH(e){return Rs(e).getPatch()}function JH(e){return e.heads}function ZH(e){return jD(e,[])}function jD(e,t){if(!Array.isArray(t))throw new TypeError("Pass an array of hashes to Backend.getChanges()");return Rs(e).getChanges(t)}function QH(e,t){return Rs(t).getChangesAdded(Rs(e))}function eM(e,t){return Rs(e).getChangeByHash(t)}function tM(e,t=[]){return Rs(e).getMissingDeps(t)}HD.exports={init:MH,clone:qH,free:VH,applyChanges:KH,applyLocalChange:zH,save:GH,load:YH,loadChanges:WH,getPatch:XH,getHeads:JH,getAllChanges:ZH,getChanges:jD,getChangesAdded:QH,getChangeByHash:eM,getMissingDeps:tM}});var WD=ce((dX,YD)=>{var xs=y2(),{hexStringToBytes:MD,bytesToHexString:rM,Encoder:_2,Decoder:D2}=r2(),{decodeChangeMeta:Ap}=gh(),{copyObject:nM}=Ss(),qD=32,VD=66,KD=67,iM=10,sM=7,wh=class{constructor(t){if(Array.isArray(t)){this.numEntries=t.length,this.numBitsPerEntry=iM,this.numProbes=sM,this.bits=new Uint8Array(Math.ceil(this.numEntries*this.numBitsPerEntry/8));for(let r of t)this.addHash(r)}else if(t instanceof Uint8Array)if(t.byteLength===0)this.numEntries=0,this.numBitsPerEntry=0,this.numProbes=0,this.bits=t;else{let r=new D2(t);this.numEntries=r.readUint32(),this.numBitsPerEntry=r.readUint32(),this.numProbes=r.readUint32(),this.bits=r.readRawBytes(Math.ceil(this.numEntries*this.numBitsPerEntry/8))}else throw new TypeError("invalid argument")}get bytes(){if(this.numEntries===0)return new Uint8Array(0);let t=new _2;return t.appendUint32(this.numEntries),t.appendUint32(this.numBitsPerEntry),t.appendUint32(this.numProbes),t.appendRawBytes(this.bits),t.buffer}getProbes(t){let r=MD(t),n=8*this.bits.byteLength;if(r.byteLength!==32)throw new RangeError(`Not a 256-bit hash: ${t}`);let i=((r[0]|r[1]<<8|r[2]<<16|r[3]<<24)>>>0)%n,a=((r[4]|r[5]<<8|r[6]<<16|r[7]<<24)>>>0)%n,s=((r[8]|r[9]<<8|r[10]<<16|r[11]<<24)>>>0)%n,u=[i];for(let c=1;c>>3]|=1<<(r&7)}containsHash(t){if(this.numEntries===0)return!1;for(let r of this.getProbes(t))if(!(this.bits[r>>>3]&1<<(r&7)))return!1;return!0}};function Ep(e,t){if(!Array.isArray(t))throw new TypeError("hashes must be an array");e.appendUint32(t.length);for(let r=0;r0&&t[r-1]>=t[r])throw new RangeError("hashes must be sorted");let n=MD(t[r]);if(n.byteLength!==qD)throw new TypeError("heads hashes must be 256 bits");e.appendRawBytes(n)}}function wp(e){let t=e.readUint32(),r=[];for(let n=0;nAp(i,!0).hash);return{lastSync:t,bloom:new wh(n).bytes}}function cM(e,t,r){if(t.length===0)return r.map(g=>xs.getChangeByHash(e,g)).filter(g=>g!==void 0);let n={},i=[];for(let g of t){for(let p of g.lastSync)n[p]=!0;i.push(new wh(g.bloom))}let a=xs.getChanges(e,Object.keys(n)).map(g=>Ap(g,!0)),s={},u={},c={};for(let g of a){s[g.hash]=!0;for(let p of g.deps)u[p]||(u[p]=[]),u[p].push(g.hash);i.every(p=>!p.containsHash(g.hash))&&(c[g.hash]=!0)}let f=Object.keys(c);for(;f.length>0;){let g=f.pop();if(u[g])for(let p of u[g])c[p]||(c[p]=!0,f.push(p))}let d=[];for(let g of r)if(c[g]=!0,!s[g]){let p=xs.getChangeByHash(e,g);p&&d.push(p)}for(let g of a)c[g.hash]&&d.push(g.change);return d}function GD(){return{sharedHeads:[],lastSentHeads:[],theirHeads:null,theirNeed:null,theirHave:null,sentHashes:{}}}function C2(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function lM(e,t){if(!e)throw new Error("generateSyncMessage called with no Automerge document");if(!t)throw new Error("generateSyncMessage requires a syncState, which can be created with initSyncState()");let{sharedHeads:r,lastSentHeads:n,theirHeads:i,theirNeed:a,theirHave:s,sentHashes:u}=t,c=xs.getHeads(e),f=xs.getMissingDeps(e,i||[]),d=[];if((!i||f.every(v=>i.includes(v)))&&(d=[oM(e,r)]),s&&s.length>0&&!s[0].lastSync.every(b=>xs.getChangeByHash(e,b))){let b={heads:c,need:[],have:[{lastSync:[],bloom:new Uint8Array(0)}],changes:[]};return[t,b2(b)]}let g=Array.isArray(s)&&Array.isArray(a)?cM(e,s,a):[],p=Array.isArray(n)&&C2(c,n),h=Array.isArray(i)&&C2(c,i);if(p&&h&&g.length===0)return[t,null];g=g.filter(v=>!u[Ap(v,!0).hash]);let E={heads:c,have:d,need:f,changes:g};if(g.length>0){u=nM(u);for(let v of g)u[Ap(v,!0).hash]=!0}return t=Object.assign({},t,{lastSentHeads:c,sentHashes:u}),[t,b2(E)]}function fM(e,t,r){let n=t.filter(s=>!e.includes(s)),i=r.filter(s=>t.includes(s));return[...new Set([...n,...i])].sort()}function hM(e,t,r){if(!e)throw new Error("generateSyncMessage called with no Automerge document");if(!t)throw new Error("generateSyncMessage requires a syncState, which can be created with initSyncState()");let{sharedHeads:n,lastSentHeads:i,sentHashes:a}=t,s=null,u=zD(r),c=xs.getHeads(e);u.changes.length>0&&([e,s]=xs.applyChanges(e,u.changes),n=fM(c,xs.getHeads(e),n)),u.changes.length===0&&C2(u.heads,c)&&(i=u.heads);let f=u.heads.filter(g=>xs.getChangeByHash(e,g));f.length===u.heads.length?(n=u.heads,u.heads.length===0&&(i=[],a=[])):n=[...new Set(f.concat(n))].sort();let d={sharedHeads:n,lastSentHeads:i,theirHave:u.have,theirHeads:u.heads,theirNeed:u.need,sentHashes:a};return[e,d,s]}YD.exports={receiveSyncMessage:hM,generateSyncMessage:lM,encodeSyncMessage:b2,decodeSyncMessage:zD,initSyncState:GD,encodeSyncState:aM,decodeSyncState:uM,BloomFilter:wh}});var JD=ce((pX,XD)=>{var{init:dM,clone:pM,free:gM,applyChanges:mM,applyLocalChange:vM,save:EM,load:wM,loadChanges:AM,getPatch:yM,getHeads:bM,getAllChanges:CM,getChanges:_M,getChangesAdded:DM,getChangeByHash:FM,getMissingDeps:SM}=y2(),{receiveSyncMessage:IM,generateSyncMessage:BM,encodeSyncMessage:$M,decodeSyncMessage:RM,encodeSyncState:xM,decodeSyncState:PM,initSyncState:OM}=WD();XD.exports={init:dM,clone:pM,free:gM,applyChanges:mM,applyLocalChange:vM,save:EM,load:wM,loadChanges:AM,getPatch:yM,getHeads:bM,getAllChanges:CM,getChanges:_M,getChangesAdded:DM,getChangeByHash:FM,getMissingDeps:SM,receiveSyncMessage:IM,generateSyncMessage:BM,encodeSyncMessage:$M,decodeSyncMessage:RM,encodeSyncState:xM,decodeSyncState:PM,initSyncState:OM}});var i3=ce((gX,S2)=>{var TM=Ld(),Gr=u6(),{OPTIONS:ZD}=fu(),{encodeChange:kM,decodeChange:QD}=gh(),{isObject:F2}=Ss(),Pr=JD();function Ah(e){if(typeof e=="string")e={actorId:e};else if(typeof e>"u")e={};else if(!F2(e))throw new TypeError(`Unsupported options for init(): ${e}`);return Gr.init(Object.assign({backend:Pr},e))}function NM(e,t){let r={message:"Initialization"};return e3(Ah(t),r,n=>Object.assign(n,e))}function e3(e,t,r){let[n]=Gr.change(e,t,r);return n}function LM(e,t){let[r]=Gr.emptyChange(e,t);return r}function UM(e,t={}){let r=Pr.clone(Gr.getBackendState(e,"clone"));return yp(Ah(t),Pr.getPatch(r),r,[],t)}function jM(e){Pr.free(Gr.getBackendState(e,"free"))}function HM(e,t={}){let r=Pr.load(e);return yp(Ah(t),Pr.getPatch(r),r,[e],t)}function MM(e){return Pr.save(Gr.getBackendState(e,"save"))}function qM(e,t){let r=Gr.getBackendState(e,"merge"),n=Gr.getBackendState(t,"merge","second"),i=Pr.getChangesAdded(r,n),[a]=r3(e,i);return a}function VM(e,t){let r=Gr.getBackendState(e,"getChanges"),n=Gr.getBackendState(t,"getChanges","second");return Pr.getChanges(n,Pr.getHeads(r))}function t3(e){return Pr.getAllChanges(Gr.getBackendState(e,"getAllChanges"))}function yp(e,t,r,n,i){let a=Gr.applyPatch(e,t,r),s=i.patchCallback||e[ZD].patchCallback;return s&&s(t,e,a,!1,n),a}function r3(e,t,r={}){let n=Gr.getBackendState(e,"applyChanges"),[i,a]=Pr.applyChanges(n,t);return[yp(e,a,i,t,r),a]}function n3(e,t){if(!F2(e)||!F2(t))return e===t;let r=Object.keys(e).sort(),n=Object.keys(t).sort();if(r.length!==n.length)return!1;for(let i=0;i({get change(){return QD(n)},get snapshot(){let a=Pr.loadChanges(Pr.init(),r.slice(0,i+1));return Gr.applyPatch(Ah(t),Pr.getPatch(a),a)}}))}function zM(e,t){let r=Gr.getBackendState(e,"generateSyncMessage");return Pr.generateSyncMessage(r,t)}function GM(e,t,r){let n=Gr.getBackendState(e,"receiveSyncMessage"),[i,a,s]=Pr.receiveSyncMessage(n,t,r);if(!s)return[e,a,s];let u=null;return e[ZD].patchCallback&&(u=Pr.decodeSyncMessage(r).changes),[yp(e,s,i,u,{}),a,s]}function YM(){return Pr.initSyncState()}function WM(e){Pr=e}S2.exports={init:Ah,from:NM,change:e3,emptyChange:LM,clone:UM,free:jM,load:HM,save:MM,merge:qM,getChanges:VM,getAllChanges:t3,applyChanges:r3,encodeChange:kM,decodeChange:QD,equals:n3,getHistory:KM,uuid:TM,Frontend:Gr,setDefaultBackend:WM,generateSyncMessage:zM,receiveSyncMessage:GM,initSyncState:YM,get Backend(){return Pr}};for(let e of["getObjectId","getObjectById","getActorId","setActorId","getConflicts","getLastLocalChange","Text","Table","Counter","Observable","Int","Uint","Float64"])S2.exports[e]=Gr[e]});var Fp=ce((eJ,l3)=>{"use strict";var Sq=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])},$2=class e extends Error{constructor(t,r,n){super(t),Sq(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:a,text:s})=>({source:a,text:s.split(/\r\n|\n|\r/g)}));function n(a,s,u=""){let c="",f=r.find(({source:g})=>g===a.source),d=a.start;if(f){let g=a.end,p=f.text[d.line-1],E=(d.line===g.line?g.column:p.length+1)-d.column||1;u&&(c+=` note: ${u}`),c+=` --> ${a.source}:${d.line}:${d.column} ${"".padEnd(s)} | ${d.line.toString().padStart(s)} | ${p} ${"".padEnd(s)} | ${"".padEnd(d.column-1)}${"".padEnd(E,"^")}`}else c+=` at ${a.source}:${d.line}:${d.column}`,u&&(c+=`: ${u}`);return c}function i(a,s,u,c=[]){let f;u?f=c.reduce((g,{location:p})=>Math.max(g,p.start.line),u.start.line):f=Math.max.apply(null,c.map(g=>g.location.start.line)),f=f.toString().length;let d=`${a}: ${s}`;u&&(d+=n(u,f));for(let g of c)d+=n(g.location,f,g.message);return d}return this.problems.filter(a=>a[0]!=="info").map(a=>i(...a)).join(` `)}};l3.exports=$2});var ls=ce((tJ,f3)=>{"use strict";var Iq={build(e){function t(s,...u){return e[s.type](s,...u)}function r(){}function n(s,...u){return t(s.expression,...u)}function i(s){return function(u,...c){u[s].forEach(f=>t(f,...c))}}let a={grammar(s,...u){s.topLevelInitializer&&t(s.topLevelInitializer,...u),s.initializer&&t(s.initializer,...u),s.rules.forEach(c=>t(c,...u))},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(a).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||(e[s]=a[s])}),t}};f3.exports=Iq});var to=ce((rJ,d3)=>{"use strict";var Bq=ls(),h3={findRule(e,t){for(let r=0;r{"use strict";var $q={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};p3.exports=$q});var x2=ce((iJ,g3)=>{"use strict";var Rq=ls(),xq=to(),Pq=Fp(),_h=1,ac=0,Dh=-1;function Sp(e){function t(s){return s.match=ac}function r(s){return a(s.expression),s.match=_h}function n(s){return s.match=a(s.expression)}function i(s,u){let c=s.length,f=0,d=0;for(let g=0;g0?Dh:ac}let a=Rq.build({rule(s){let u,c=0;if(typeof s.match>"u"){s.match=ac;do if(u=s.match,s.match=a(s.expression),++c>6)throw new Pq("Infinity cycle detected when trying to evaluate node match result",s.location);while(u!==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=-a(s.expression)},optional:r,zero_or_more:r,one_or_more:n,group:n,semantic_and:t,semantic_not:t,rule_ref(s){let u=xq.findRule(e,s.name);return s.match=a(u)},literal(s){let u=s.value.length===0?_h:ac;return s.match=u},class(s){let u=s.parts.length===0?Dh:ac;return s.match=u},any:t});a(e)}Sp.ALWAYS_MATCH=_h;Sp.SOMETIMES_MATCH=ac;Sp.NEVER_MATCH=Dh;g3.exports=Sp});var v3=ce((sJ,m3)=>{"use strict";var Oq=to(),Re=R2(),Tq=ls(),{ALWAYS_MATCH:kl,SOMETIMES_MATCH:P2,NEVER_MATCH:O2}=x2();function kq(e){let t=[],r=[],n=[],i=[];function a(y){let D=t.indexOf(y);return D===-1?t.push(y)-1:D}function s(y){let D={value:y.parts,inverted:y.inverted,ignoreCase:y.ignoreCase},_=JSON.stringify(D),F=r.findIndex(L=>JSON.stringify(L)===_);return F===-1?r.push(D)-1:F}function u(y){let D=JSON.stringify(y),_=n.findIndex(F=>JSON.stringify(F)===D);return _===-1?n.push(y)-1:_}function c(y,D,_){let F={predicate:y,params:D,body:_.code,location:_.codeLocation},L=JSON.stringify(F),k=i.findIndex(S=>JSON.stringify(S)===L);return k===-1?i.push(F)-1:k}function f(y){let D={};return Object.keys(y).forEach(_=>{D[_]=y[_]}),D}function d(y,...D){return y.concat(...D)}function g(y,D,_,F){return y===kl?_:y===O2?F:D.concat([_.length,F.length],_,F)}function p(y,D){return y.concat([D.length],D)}function h(y,D,_,F){let L=Object.keys(_).map(k=>F-_[k]);return[Re.CALL,y,D,L.length].concat(L)}function E(y,D,_){let F=y.match|0;return d([Re.PUSH_CURR_POS],[Re.SILENT_FAILS_ON],m(y,{sp:_.sp+1,env:f(_.env),action:null}),[Re.SILENT_FAILS_OFF],g(D?-F:F,[D?Re.IF_ERROR:Re.IF_NOT_ERROR],d([Re.POP],[D?Re.POP:Re.POP_CURR_POS],[Re.PUSH_UNDEFINED]),d([Re.POP],[D?Re.POP_CURR_POS:Re.POP],[Re.PUSH_FAILED])))}function v(y,D,_){let F=c(!0,Object.keys(_.env),y);return d([Re.UPDATE_SAVED_POS],h(F,0,_.env,_.sp),g(y.match|0,[Re.IF],d([Re.POP],D?[Re.PUSH_FAILED]:[Re.PUSH_UNDEFINED]),d([Re.POP],D?[Re.PUSH_UNDEFINED]:[Re.PUSH_FAILED])))}function b(y){return p([Re.WHILE_NOT_ERROR],d([Re.APPEND],y))}let m=Tq.build({grammar(y){y.rules.forEach(m),y.literals=t,y.classes=r,y.expectations=n,y.functions=i},rule(y){y.bytecode=m(y.expression,{sp:-1,env:{},pluck:[],action:null})},named(y,D){let _=y.match|0,F=_===O2?null:u({type:"rule",value:y.name});return d([Re.SILENT_FAILS_ON],m(y.expression,D),[Re.SILENT_FAILS_OFF],g(_,[Re.IF_ERROR],[Re.FAIL,F],[]))},choice(y,D){function _(F,L){let k=F[0].match|0,S=m(F[0],{sp:L.sp,env:f(L.env),action:null});return k===kl?S:d(S,F.length>1?g(P2,[Re.IF_ERROR],d([Re.POP],_(F.slice(1),L)),[]):[])}return _(y.alternatives,D)},action(y,D){let _=f(D.env),F=y.expression.type!=="sequence"||y.expression.elements.length===0,L=m(y.expression,{sp:D.sp+(F?1:0),env:_,action:y}),k=y.expression.match|0,S=F&&k!==O2?c(!1,Object.keys(_),y):null;return F?d([Re.PUSH_CURR_POS],L,g(k,[Re.IF_NOT_ERROR],d([Re.LOAD_SAVED_POS,1],h(S,1,_,D.sp+2)),[]),[Re.NIP]):L},sequence(y,D){function _(F,L){if(F.length>0){let k=y.elements.length-F.length+1;return d(m(F[0],{sp:L.sp,env:L.env,pluck:L.pluck,action:null}),g(F[0].match|0,[Re.IF_NOT_ERROR],_(F.slice(1),{sp:L.sp+1,env:L.env,pluck:L.pluck,action:L.action}),d(k>1?[Re.POP_N,k]:[Re.POP],[Re.POP_CURR_POS],[Re.PUSH_FAILED])))}else{if(L.pluck.length>0)return d([Re.PLUCK,y.elements.length+1,L.pluck.length],L.pluck.map(k=>L.sp-k));if(L.action){let k=c(!1,Object.keys(L.env),L.action);return d([Re.LOAD_SAVED_POS,y.elements.length],h(k,y.elements.length+1,L.env,L.sp))}else return d([Re.WRAP,y.elements.length],[Re.NIP])}}return d([Re.PUSH_CURR_POS],_(y.elements,{sp:D.sp+1,env:D.env,pluck:[],action:D.action}))},labeled(y,D){let _=D.env,F=y.label,L=D.sp+1;return F&&(_=f(D.env),D.env[y.label]=L),y.pick&&D.pluck.push(L),m(y.expression,{sp:D.sp,env:_,action:null})},text(y,D){return d([Re.PUSH_CURR_POS],m(y.expression,{sp:D.sp+1,env:f(D.env),action:null}),g(y.match|0,[Re.IF_NOT_ERROR],d([Re.POP],[Re.TEXT]),[Re.NIP]))},simple_and(y,D){return E(y.expression,!1,D)},simple_not(y,D){return E(y.expression,!0,D)},optional(y,D){return d(m(y.expression,{sp:D.sp,env:f(D.env),action:null}),g(-(y.expression.match|0),[Re.IF_ERROR],d([Re.POP],[Re.PUSH_NULL]),[]))},zero_or_more(y,D){let _=m(y.expression,{sp:D.sp+1,env:f(D.env),action:null});return d([Re.PUSH_EMPTY_ARRAY],_,b(_),[Re.POP])},one_or_more(y,D){let _=m(y.expression,{sp:D.sp+1,env:f(D.env),action:null});return d([Re.PUSH_EMPTY_ARRAY],_,g(y.expression.match|0,[Re.IF_NOT_ERROR],d(b(_),[Re.POP]),d([Re.POP],[Re.POP],[Re.PUSH_FAILED])))},group(y,D){return m(y.expression,{sp:D.sp,env:f(D.env),action:null})},semantic_and(y,D){return v(y,!1,D)},semantic_not(y,D){return v(y,!0,D)},rule_ref(y){return[Re.RULE,Oq.indexOfRule(e,y.name)]},literal(y){if(y.value.length>0){let D=y.match|0,F=D===P2||D===kl&&!y.ignoreCase?a(y.ignoreCase?y.value.toLowerCase():y.value):null,L=D!==kl?u({type:"literal",value:y.value,ignoreCase:y.ignoreCase}):null;return g(D,y.ignoreCase?[Re.MATCH_STRING_IC,F]:[Re.MATCH_STRING,F],y.ignoreCase?[Re.ACCEPT_N,y.value.length]:[Re.ACCEPT_STRING,F],[Re.FAIL,L])}return[Re.PUSH_EMPTY_STRING]},class(y){let D=y.match|0,_=D===P2?s(y):null,F=D!==kl?u({type:"class",value:y.parts,inverted:y.inverted,ignoreCase:y.ignoreCase}):null;return g(D,[Re.MATCH_CHAR_CLASS,_],[Re.ACCEPT_N,1],[Re.FAIL,F])},any(y){let D=y.match|0,_=D!==kl?u({type:"any"}):null;return g(D,[Re.MATCH_ANY],[Re.ACCEPT_N,1],[Re.FAIL,_])}});m(e)}m3.exports=kq});var w3=ce((aJ,E3)=>{"use strict";var T2=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}' 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 a=this.sp;if(this.sp=i,n(),a!==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: "+a+", 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+").")}};E3.exports=T2});var k2=ce((uJ,A3)=>{"use strict";A3.exports="2.0.1"});var y3=ce(Ip=>{"use strict";function Eu(e){return e.charCodeAt(0).toString(16).toUpperCase()}Ip.hex=Eu;function Nq(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"+Eu(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Eu(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Eu(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Eu(t))}Ip.stringEscape=Nq;function Lq(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"+Eu(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Eu(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Eu(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Eu(t))}Ip.regexpClassEscape=Lq});var _3=ce(C3=>{var b3="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");C3.encode=function(e){if(0<=e&&e{var Uq=_3(),D3=5,F3=1<>>=D3,i>0&&(n|=Hq),r+=Uq.encode(n);while(i>0);return r}});var $p=ce(no=>{function qq(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}no.getArg=qq;var $3=function(){return!("__proto__"in Object.create(null))}();function R3(e){return e}function Vq(e){return x3(e)?"$"+e:e}no.toSetString=$3?R3:Vq;function Kq(e){return x3(e)?e.slice(1):e}no.fromSetString=$3?R3:Kq;function x3(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 B3(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function zq(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=B3(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:B3(e.name,t.name)}no.compareByGeneratedPositionsInflated=zq;var N2="http:",Fh=`${N2}//host`;function P3(e){return t=>{let r=Sh(t),n=L2(t),i=new URL(t,n);e(i);let a=i.toString();return r==="absolute"?a:r==="scheme-relative"?a.slice(N2.length):r==="path-absolute"?a.slice(Fh.length):U2(n,a)}}function ro(e,t){return new URL(e,t).toString()}function Gq(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function L2(e){let t=e.split("..").length-1,r=Gq("p",e),n=`${Fh}/`;for(let i=0;i0&&!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 Wq=P3(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),Bp=P3(e=>{});no.normalize=Bp;function Xq(e,t){let r=Sh(t),n=Sh(e);if(e=Wq(e),r==="absolute")return ro(t,void 0);if(n==="absolute")return ro(t,e);if(r==="scheme-relative")return Bp(t);if(n==="scheme-relative")return ro(t,ro(e,Fh)).slice(N2.length);if(r==="path-absolute")return Bp(t);if(n==="path-absolute")return ro(t,ro(e,Fh)).slice(Fh.length);let i=L2(t+e),a=ro(t,ro(e,i));return U2(i,a)}no.join=Xq;function Jq(e,t){let r=Zq(e,t);return typeof r=="string"?r:Bp(t)}no.relative=Jq;function Zq(e,t){if(Sh(e)!==Sh(t))return null;let n=L2(e+t),i=new URL(e,n),a=new URL(t,n);try{new URL("",a.toString())}catch{return null}return a.protocol!==i.protocol||a.user!==i.user||a.password!==i.password||a.hostname!==i.hostname||a.port!==i.port?null:U2(i,a)}});var T3=ce(O3=>{var j2=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){let n=new e;for(let i=0,a=t.length;i=0)return r;throw new Error('"'+t+'" is not in the set.')}at(t){if(t>=0&&t{var k3=$p();function Qq(e,t){let r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=i||k3.compareByGeneratedPositionsInflated(e,t)<=0}var H2=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){Qq(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(k3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};N3.MappingList=H2});var M2=ce(U3=>{var Ih=I3(),Hr=$p(),Rp=T3().ArraySet,eV=L3().MappingList,xp=class e{constructor(t){t||(t={}),this._file=Hr.getArg(t,"file",null),this._sourceRoot=Hr.getArg(t,"sourceRoot",null),this._skipValidation=Hr.getArg(t,"skipValidation",!1),this._sources=new Rp,this._names=new Rp,this._mappings=new eV,this._sourcesContents=null}static fromSourceMap(t){let r=t.sourceRoot,n=new e({file:t.file,sourceRoot:r});return t.eachMapping(function(i){let a={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(a.source=i.source,r!=null&&(a.source=Hr.relative(r,a.source)),a.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(a.name=i.name)),n.addMapping(a)}),t.sources.forEach(function(i){let a=i;r!=null&&(a=Hr.relative(r,i)),n._sources.has(a)||n._sources.add(a);let s=t.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n}addMapping(t){let r=Hr.getArg(t,"generated"),n=Hr.getArg(t,"original",null),i=Hr.getArg(t,"source",null),a=Hr.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,i,a),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:i,name:a})}setSourceContent(t,r){let n=t;this._sourceRoot!=null&&(n=Hr.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[Hr.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[Hr.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 a=this._sourceRoot;a!=null&&(i=Hr.relative(a,i));let s=this._mappings.toArray().length>0?new Rp:this._sources,u=new Rp;this._mappings.unsortedForEach(function(c){if(c.source===i&&c.originalLine!=null){let g=t.originalPositionFor({line:c.originalLine,column:c.originalColumn});g.source!=null&&(c.source=g.source,n!=null&&(c.source=Hr.join(n,c.source)),a!=null&&(c.source=Hr.relative(a,c.source)),c.originalLine=g.line,c.originalColumn=g.column,g.name!=null&&(c.name=g.name))}let f=c.source;f!=null&&!s.has(f)&&s.add(f);let d=c.name;d!=null&&!u.has(d)&&u.add(d)},this),this._sources=s,this._names=u,t.sources.forEach(function(c){let f=t.sourceContentFor(c);f!=null&&(n!=null&&(c=Hr.join(n,c)),a!=null&&(c=Hr.relative(a,c)),this.setSourceContent(c,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,a=0,s=0,u="",c,f,d,g,p=this._mappings.toArray();for(let h=0,E=p.length;h0){if(!Hr.compareByGeneratedPositionsInflated(f,p[h-1]))continue;c+=","}c+=Ih.encode(f.generatedColumn-t),t=f.generatedColumn,f.source!=null&&(g=this._sources.indexOf(f.source),c+=Ih.encode(g-s),s=g,c+=Ih.encode(f.originalLine-1-i),i=f.originalLine-1,c+=Ih.encode(f.originalColumn-n),n=f.originalColumn,f.name!=null&&(d=this._names.indexOf(f.name),c+=Ih.encode(d-a),a=d)),u+=c}return u}_generateSourcesContent(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=Hr.relative(r,n));let i=Hr.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())}};xp.prototype._version=3;U3.SourceMapGenerator=xp});var H3=ce(j3=>{var tV=M2().SourceMapGenerator,Pp=$p(),rV=/(\r?\n)/,nV=10,Nl="$$$isSourceNode$$$",q2=class e{constructor(t,r,n,i,a){this.children=[],this.sourceContents={},this.line=t??null,this.column=r??null,this.source=n??null,this.name=a??null,this[Nl]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,r,n){let i=new e,a=t.split(rV),s=0,u=function(){let h=v(),E=v()||"";return h+E;function v(){return s=0;r--)this.prepend(t[r]);else if(t[Nl]||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;n0){for(r=[],n=0;n{V2.SourceMapGenerator=M2().SourceMapGenerator;V2.SourceNode=H3().SourceNode});var z3=ce((vJ,K3)=>{"use strict";var iV=to(),jt=R2(),sV=w3(),aV=k2(),{stringEscape:Ki,regexpClassEscape:K2}=y3(),{SourceNode:hs}=M3();function V3(e,t,r){let n=t.start.line,i=t.start.column-1,a=e.split(` `);return a.length===1?new hs(n,i,t.source,e,r):new hs(null,null,t.source,a.map((s,u)=>new hs(n+u,u===0?i:0,t.source,u===a.length-1?s:[s,` `],r)))}function q3(e,t,r,n,i){return r?new hs(null,null,r.source,[e,V3(t,r,i),new hs(r.end.line,r.end.column-1,r.source,n)]):new hs(null,null,null,[e,t,n])}function uV(e,t){function r(v){return v instanceof hs?v:v.replace(/^(.+)$/gm," $1")}function n(v){return"peg$c"+v}function i(v){return"peg$r"+v}function a(v){return"peg$e"+v}function s(v){return"peg$f"+v}function u(v){return"peg$parse"+v}function c(){function v(D){return'"'+Ki(D)+'"'}function b(D){return"/^["+(D.inverted?"^":"")+D.value.map(_=>Array.isArray(_)?K2(_[0])+"-"+K2(_[1]):K2(_)).join("")+"]/"+(D.ignoreCase?"i":"")}function m(D){switch(D.type){case"rule":return'peg$otherExpectation("'+Ki(D.value)+'")';case"literal":return'peg$literalExpectation("'+Ki(D.value)+'", '+D.ignoreCase+")";case"class":return"peg$classExpectation(["+D.value.map(F=>Array.isArray(F)?'["'+Ki(F[0])+'", "'+Ki(F[1])+'"]':'"'+Ki(F)+'"').join(", ")+"], "+D.inverted+", "+D.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(D)+")")}}function y(D,_){return q3(` var ${s(_)} = function(${D.params.join(", ")}) {`,D.body,D.location,"};")}return new hs(null,null,t.grammarSource,[e.literals.map((D,_)=>" var "+n(_)+" = "+v(D)+";").concat("",e.classes.map((D,_)=>" var "+i(_)+" = "+b(D)+";")).concat("",e.expectations.map((D,_)=>" var "+a(_)+" = "+m(D)+";")).concat("").join(` `),e.functions.map(y)])}function f(v,b){let m=[];return m.push(""),t.trace&&m.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+v+","," location: peg$computeLocation(startPos, startPos)","});",""),t.cache&&(m.push("var key = peg$currPos * "+e.rules.length+" + "+b+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&m.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+v+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+v+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),m.push(" return cached.result;","}","")),m}function d(v,b){let m=[];return t.cache&&m.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+b+" };"),t.trace&&m.push("","if ("+b+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+v+","," result: "+b+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+v+","," location: peg$computeLocation(startPos, startPos)"," });","}"),m.push("","return "+b+";"),m}function g(v){let b=[],m=new sV(v.name,"s","var");function y(_){let F=0,L=_.length,k=[],S;function B(U,Y){let H=Y+3,K=_[F+H-2],W=_[F+H-1],ie,_e;m.checkedIf(F,()=>{F+=H,ie=y(_.slice(F,F+K)),F+=K},W>0?()=>{_e=y(_.slice(F,F+W)),F+=W}:null),k.push("if ("+U+") {"),k.push(...ie.map(r)),W>0&&(k.push("} else {"),k.push(..._e.map(r))),k.push("}")}function O(U){let H=_[F+2-1],K;m.checkedLoop(F,()=>{F+=2,K=y(_.slice(F,F+H)),F+=H}),k.push("while ("+U+") {"),k.push(...K.map(r)),k.push("}")}function x(){let Y=_[F+4-1],H=s(_[F+1])+"("+_.slice(F+4,F+4+Y).map(K=>m.index(K)).join(", ")+")";m.pop(_[F+2]),k.push(m.push(H)),F+=4+Y}for(;Fm.index(K)).join(", ")} ]`,m.pop(_[F+1]),k.push(m.push(S)),F+=H;break}case jt.IF:B(m.top(),0);break;case jt.IF_ERROR:B(m.top()+" === peg$FAILED",0);break;case jt.IF_NOT_ERROR:B(m.top()+" !== peg$FAILED",0);break;case jt.WHILE_NOT_ERROR:O(m.top()+" !== peg$FAILED");break;case jt.MATCH_ANY:B("input.length > peg$currPos",0);break;case jt.MATCH_STRING:B(e.literals[_[F+1]].length>1?"input.substr(peg$currPos, "+e.literals[_[F+1]].length+") === "+n(_[F+1]):"input.charCodeAt(peg$currPos) === "+e.literals[_[F+1]].charCodeAt(0),1);break;case jt.MATCH_STRING_IC:B("input.substr(peg$currPos, "+e.literals[_[F+1]].length+").toLowerCase() === "+n(_[F+1]),1);break;case jt.MATCH_CHAR_CLASS:B(i(_[F+1])+".test(input.charAt(peg$currPos))",1);break;case jt.ACCEPT_N:k.push(m.push(_[F+1]>1?"input.substr(peg$currPos, "+_[F+1]+")":"input.charAt(peg$currPos)")),k.push(_[F+1]>1?"peg$currPos += "+_[F+1]+";":"peg$currPos++;"),F+=2;break;case jt.ACCEPT_STRING:k.push(m.push(n(_[F+1]))),k.push(e.literals[_[F+1]].length>1?"peg$currPos += "+e.literals[_[F+1]].length+";":"peg$currPos++;"),F+=2;break;case jt.FAIL:k.push(m.push("peg$FAILED")),k.push("if (peg$silentFails === 0) { peg$fail("+a(_[F+1])+"); }"),F+=2;break;case jt.LOAD_SAVED_POS:k.push("peg$savedPos = "+m.index(_[F+1])+";"),F+=2;break;case jt.UPDATE_SAVED_POS:k.push("peg$savedPos = peg$currPos;"),F++;break;case jt.CALL:x();break;case jt.RULE:k.push(m.push(u(e.rules[_[F+1]].name)+"()")),F+=2;break;case jt.SILENT_FAILS_ON:k.push("peg$silentFails++;"),F++;break;case jt.SILENT_FAILS_OFF:k.push("peg$silentFails--;"),F++;break;default:throw new Error("Invalid opcode: "+_[F]+".")}return k}let D=y(v.bytecode);return b.push(q3(" function ",u(v.name),v.nameLocation,`() { `,v.name)),t.trace&&b.push(" var startPos = peg$currPos;"),b.push(r(m.defines())),b.push(...f('"'+Ki(v.name)+'"',iV.indexOfRule(e,v.name)).map(r)),b.push(...D.map(r)),b.push(...d('"'+Ki(v.name)+'"',m.result()).map(r)),b.push("}"),b}function p(v){return v.codeLocation?V3(v.code,v.codeLocation,"$"+v.type):v.code}function h(){let v=[];e.topLevelInitializer&&(v.push(p(e.topLevelInitializer)),v.push("")),v.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&&v.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 b="{ "+t.allowedStartRules.map(y=>y+": "+u(y)).join(", ")+" }",m=u(t.allowedStartRules[0]);return v.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+b+";"," var peg$startRuleFunction = "+m+";","",c(),""," 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&&v.push(" var peg$resultsCache = {};",""),t.trace&&v.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),v.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(y=>{v.push(...g(y).map(r)),v.push("")}),e.initializer&&(v.push(p(e.initializer)),v.push("")),v.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 hs(null,null,t.grammarSource,v.map(y=>y instanceof hs?y:y+` `))}function E(v){function b(){return[`// Generated by Peggy ${aV}.`,"//","// https://peggyjs.org/"]}function m(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(` `):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(` `)}let D={bare(){return[...b(),"(function() {",' "use strict";',"",v,"",r("return "+m()+";"),"})()"]},commonjs(){let _=Object.keys(t.dependencies),F=b();return F.push("",'"use strict";',""),_.length>0&&(_.forEach(L=>{F.push("var "+L+' = require("'+Ki(t.dependencies[L])+'");')}),F.push("")),F.push(v,"","module.exports = "+m()+";"),F},es(){let _=Object.keys(t.dependencies),F=b();return F.push(""),_.length>0&&(_.forEach(L=>{F.push("import "+L+' from "'+Ki(t.dependencies[L])+'";')}),F.push("")),F.push(v,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),F},amd(){let _=Object.keys(t.dependencies),L="["+_.map(S=>t.dependencies[S]).map(S=>'"'+Ki(S)+'"').join(", ")+"]",k=_.join(", ");return[...b(),"define("+L+", function("+k+") {",' "use strict";',"",v,"",r("return "+m()+";"),"});"]},globals(){return[...b(),"(function(root) {",' "use strict";',"",v,"",r("root."+t.exportVar+" = "+m()+";"),"})(this);"]},umd(){let _=Object.keys(t.dependencies),F=_.map(O=>t.dependencies[O]),L="["+F.map(O=>'"'+Ki(O)+'"').join(", ")+"]",k=F.map(O=>'require("'+Ki(O)+'")').join(", "),S=_.join(", "),B=b();return B.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+L+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+k+");"),t.exportVar!==null&&B.push(" } else {"," root."+t.exportVar+" = factory();"),B.push(" }","})(this, function("+S+") {",' "use strict";',"",v,"",r("return "+m()+";"),"});"),B}}[t.format]();return new hs(null,null,t.grammarSource,D.map(_=>_ instanceof hs?_:_+` `))}e.code=E(h())}K3.exports=uV});var Y3=ce((EJ,G3)=>{"use strict";var oV=to(),cV=ls();function lV(e,t,r){function n(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,u,c){cV.build({rule_ref(d){d.name===u&&(d.name=c,r.info(`Proxy rule "${u}" replaced by the rule "${c}"`,d.location,[{message:"This rule will be used",location:oV.findRule(s,c).nameLocation}]))}})(s)}let a=[];e.rules.forEach((s,u)=>{n(s)&&(i(e,s.name,s.expression.name),t.allowedStartRules.indexOf(s.name)===-1&&a.push(u))}),a.reverse(),a.forEach(s=>{e.rules.splice(s,1)})}G3.exports=lV});var X3=ce((wJ,W3)=>{"use strict";var fV=ls();function hV(e,t,r){function n(s){let u={};return Object.keys(s).forEach(c=>{u[c]=s[c]}),u}function i(s,u){a(s.expression,n(u))}let a=fV.build({rule(s){a(s.expression,{})},choice(s,u){s.alternatives.forEach(c=>{a(c,n(u))})},action:i,labeled(s,u){let c=s.label;c&&Object.prototype.hasOwnProperty.call(u,c)&&r.error(`Label "${s.label}" is already defined`,s.labelLocation,[{message:"Original label location",location:u[c]}]),a(s.expression,u),u[s.label]=s.labelLocation},text:i,simple_and:i,simple_not:i,optional:i,zero_or_more:i,one_or_more:i,group:i});a(e)}W3.exports=hV});var Z3=ce((AJ,J3)=>{"use strict";var dV=ls();function pV(e,t,r){let n={};dV.build({rule(a){if(Object.prototype.hasOwnProperty.call(n,a.name)){r.error(`Rule "${a.name}" is already defined`,a.nameLocation,[{message:"Original rule location",location:n[a.name]}]);return}n[a.name]=a.nameLocation}})(e)}J3.exports=pV});var t5=ce((yJ,e5)=>{"use strict";var Q3=to(),gV=ls();function mV(e,t,r){let n=[],i=[],a=gV.build({rule(s){n.push(s.name),a(s.expression),n.pop()},sequence(s){s.elements.every(u=>(a(u),!Q3.alwaysConsumesOnSuccess(e,u)))},rule_ref(s){i.push(s);let u=Q3.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(" -> ")+")",u.nameLocation,i.map((c,f,d)=>({message:f+1!==d.length?`Step ${f+1}: call of the rule "${c.name}" without input consumption`:`Step ${f+1}: call itself without input consumption - left recursion`,location:c.location})));return}u&&a(u),i.pop()}});a(e)}e5.exports=mV});var i5=ce((bJ,n5)=>{"use strict";var r5=to(),vV=ls();function EV(e,t,r){vV.build({zero_or_more(i){r5.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){r5.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)}n5.exports=EV});var a5=ce((CJ,s5)=>{"use strict";var wV=to(),AV=ls();function yV(e,t,r){AV.build({rule_ref(i){wV.findRule(e,i.name)||r.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}s5.exports=yV});var o5=ce((_J,u5)=>{"use strict";var bV=ls();function CV(e,t,r){let n=bV.build({action(i){n(i.expression,i)},labeled(i,a){i.pick&&a&&r.error('"@" cannot be used with an action block',i.labelLocation,[{message:"Action block location",location:a.codeLocation}]),n(i.expression)}});n(e)}u5.exports=CV});var l5=ce((DJ,c5)=>{"use strict";var _V=Fp(),z2=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(){}},G2=class{constructor(t){this._callbacks=new z2(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new _V(...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}};c5.exports=G2});var f5=ce((exports,module)=>{"use strict";var generateBytecode=v3(),generateJS=z3(),inferenceMatchResult=x2(),removeProxyRules=Y3(),reportDuplicateLabels=X3(),reportDuplicateRules=Z3(),reportInfiniteRecursion=t5(),reportInfiniteRepetition=i5(),reportUndefinedRules=a5(),reportIncorrectPlucking=o5(),Session=l5(),visitor=ls();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 d5=ce((FJ,h5)=>{"use strict";var DV={$:"text","&":"simple_and","!":"simple_not"},FV={"?":"optional","*":"zero_or_more","+":"one_or_more"},SV={"&":"semantic_and","!":"semantic_not"};function IV(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function io(e,t,r,n){var i=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(i,io.prototype),i.expected=t,i.found=r,i.location=n,i.name="SyntaxError",i}IV(io,Error);function Y2(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,r+=r.repeat(t),e+r.slice(0,t))}io.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n `+a+` `+u+` | `+i.line+" | "+c+` `+u+" | "+Y2("",i.column-1," ")+Y2("",d,"^")}else t+=` at `+a}return t};io.buildMessage=function(e,t){var r={literal:function(f){return'"'+i(f.text)+'"'},class:function(f){var d=f.parts.map(function(g){return Array.isArray(g)?a(g[0])+"-"+a(g[1]):a(g)});return"["+(f.inverted?"^":"")+d.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(d){return"\\x0"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function a(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(d){return"\\x0"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function s(f){return r[f.type](f)}function u(f){var d=f.map(s),g,p;if(d.sort(),d.length>0){for(g=1,p=1;g0?{type:"choice",alternatives:[C].concat(j),location:dr()}:C},Yi=function(C,j){return j!==null?{type:"action",expression:C,code:j[0],codeLocation:j[1],location:dr()}:C},go=function(C,j){return j.length>0||C.type==="labeled"&&C.pick?{type:"sequence",elements:[C].concat(j),location:dr()}:C},Tp=function(C,j,J){return J.type.startsWith("semantic_")&&Vl('"@" cannot be used on a semantic predicate',C),{type:"labeled",label:j!==null?j[0]:null,labelLocation:j!==null?j[1]:C,pick:!0,expression:J,location:dr()}},kp=function(C,j){return{type:"labeled",label:C[0],labelLocation:C[1],expression:j,location:dr()}},tr=function(){return dr()},Jt=function(C){return bc.indexOf(C[0])>=0&&Vl(`Label can't be a reserved word "${C[0]}"`,C[1]),C},Np=function(C,j){return{type:DV[C],expression:j,location:dr()}},Lp=function(C,j){return{type:FV[j],expression:C,location:dr()}},Up=function(C){return C.type==="labeled"||C.type==="sequence"?{type:"group",expression:C,location:dr()}:C},jp=function(C){return{type:"rule_ref",name:C[0],location:dr()}},Hp=function(C,j){return{type:SV[C],code:j[0],codeLocation:j[1],location:dr()}},Mp=function(C,j){return[C+j.join(""),dr()]},Rh=function(C,j){return{type:"literal",value:C,ignoreCase:j!==null,location:dr()}},qp=function(C){return C.join("")},kr=function(C){return C.join("")},Hl=function(C,j,J){return{type:"class",parts:j.filter(z=>z!==""),inverted:C!==null,ignoreCase:J!==null,location:dr()}},Sa=function(C,j){return C.charCodeAt(0)>j.charCodeAt(0)&&Vl("Invalid character range: "+ql()+"."),[C,j]},xh=function(){return""},Ml=function(){return"\0"},ii=function(){return"\b"},Ph=function(){return"\f"},Oh=function(){return` `},Th=function(){return"\r"},kh=function(){return" "},Nh=function(){return"\v"},Lh=function(C){return String.fromCharCode(parseInt(C,16))},qn=function(C){return String.fromCharCode(parseInt(C,16))},Vp=function(){return{type:"any",location:dr()}},si=function(C){return[C,dr()]},R=0,at=0,Fi=[{line:1,column:1}],Vn=0,mo=[],te=0,Si;if("startRule"in t){if(!(t.startRule in i))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');a=i[t.startRule]}function ql(){return e.substring(at,R)}function oE(){return at}function Uh(){return{source:n,start:at,end:R}}function dr(){return Ia(at,R)}function cE(C,j){throw j=j!==void 0?j:Ia(at,R),Hh([Wi(C)],e.substring(at,R),j)}function Vl(C,j){throw j=j!==void 0?j:Ia(at,R),jh(C,j)}function ze(C,j){return{type:"literal",text:C,ignoreCase:j}}function Nr(C,j,J){return{type:"class",parts:C,inverted:j,ignoreCase:J}}function Su(){return{type:"any"}}function Kp(){return{type:"end"}}function Wi(C){return{type:"other",description:C}}function Kl(C){var j=Fi[C],J;if(j)return j;for(J=C-1;!Fi[J];)J--;for(j=Fi[J],j={line:j.line,column:j.column};JVn&&(Vn=R,mo=[]),mo.push(C))}function jh(C,j){return new io(C,null,null,j)}function Hh(C,j,J){return new io(io.buildMessage(C,j),C,j,J)}function lc(){var C,j,J,z,ae,le,Xt,Cr;if(C=R,j=Lt(),J=R,z=zl(),z!==r?(ae=Lt(),J=z):(R=J,J=r),J===r&&(J=null),z=R,ae=zp(),ae!==r?(le=Lt(),z=ae):(R=z,z=r),z===r&&(z=null),ae=[],le=R,Xt=Gl(),Xt!==r?(Cr=Lt(),le=Xt):(R=le,le=r),le!==r)for(;le!==r;)ae.push(le),le=R,Xt=Gl(),Xt!==r?(Cr=Lt(),le=Xt):(R=le,le=r);else ae=r;return ae!==r?(at=C,C=Di(J,z,ae)):(R=C,C=r),C}function zl(){var C,j,J,z,ae;return C=R,e.charCodeAt(R)===123?(j=s,R++):(j=r,te===0&&me(Yr)),j!==r?(J=xt(),J!==r?(e.charCodeAt(R)===125?(z=u,R++):(z=r,te===0&&me(ds)),z!==r?(ae=xa(),ae!==r?(at=C,C=Du(J)):(R=C,C=r)):(R=C,C=r)):(R=C,C=r)):(R=C,C=r),C}function zp(){var C,j,J;return C=R,j=xt(),j!==r?(J=xa(),J!==r?(at=C,C=Mn(j)):(R=C,C=r)):(R=C,C=r),C}function Gl(){var C,j,J,z,ae,le,Xt,Cr;return C=R,j=dc(),j!==r?(J=Lt(),z=R,ae=Xi(),ae!==r?(le=Lt(),z=ae):(R=z,z=r),z===r&&(z=null),e.charCodeAt(R)===61?(ae=c,R++):(ae=r,te===0&&me(Au)),ae!==r?(le=Lt(),Xt=Fn(),Xt!==r?(Cr=xa(),Cr!==r?(at=C,C=pn(j,z,Xt)):(R=C,C=r)):(R=C,C=r)):(R=C,C=r)):(R=C,C=r),C}function Fn(){var C,j,J,z,ae,le,Xt,Cr;if(C=R,j=vo(),j!==r){for(J=[],z=R,ae=Lt(),e.charCodeAt(R)===47?(le=f,R++):(le=r,te===0&&me(Os)),le!==r?(Xt=Lt(),Cr=vo(),Cr!==r?z=Cr:(R=z,z=r)):(R=z,z=r);z!==r;)J.push(z),z=R,ae=Lt(),e.charCodeAt(R)===47?(le=f,R++):(le=r,te===0&&me(Os)),le!==r?(Xt=Lt(),Cr=vo(),Cr!==r?z=Cr:(R=z,z=r)):(R=z,z=r);at=C,C=Fu(j,J)}else R=C,C=r;return C}function vo(){var C,j,J,z,ae;return C=R,j=Eo(),j!==r?(J=R,z=Lt(),ae=xt(),ae!==r?J=ae:(R=J,J=r),J===r&&(J=null),at=C,C=Yi(j,J)):(R=C,C=r),C}function Eo(){var C,j,J,z,ae,le;if(C=R,j=fc(),j!==r){for(J=[],z=R,ae=Lt(),le=fc(),le!==r?z=le:(R=z,z=r);z!==r;)J.push(z),z=R,ae=Lt(),le=fc(),le!==r?z=le:(R=z,z=r);at=C,C=go(j,J)}else R=C,C=r;return C}function fc(){var C,j,J,z;return C=R,j=Mh(),j!==r?(J=qh(),J===r&&(J=null),z=Yl(),z!==r?(at=C,C=Tp(j,J,z)):(R=C,C=r)):(R=C,C=r),C===r&&(C=R,j=qh(),j!==r?(J=Lt(),z=Yl(),z!==r?(at=C,C=kp(j,z)):(R=C,C=r)):(R=C,C=r),C===r&&(C=Yl())),C}function Mh(){var C,j;return C=R,e.charCodeAt(R)===64?(j=d,R++):(j=r,te===0&&me(yu)),j!==r&&(at=C,j=tr()),C=j,C}function qh(){var C,j,J,z;return C=R,j=dc(),j!==r?(J=Lt(),e.charCodeAt(R)===58?(z=g,R++):(z=r,te===0&&me(Ts)),z!==r?(at=C,C=Jt(j)):(R=C,C=r)):(R=C,C=r),C}function Yl(){var C,j,J,z;return C=R,j=Gp(),j!==r?(J=Lt(),z=Vh(),z!==r?(at=C,C=Np(j,z)):(R=C,C=r)):(R=C,C=r),C===r&&(C=Vh()),C}function Gp(){var C;return e.charCodeAt(R)===36?(C=p,R++):(C=r,te===0&&me(ps)),C===r&&(e.charCodeAt(R)===38?(C=h,R++):(C=r,te===0&&me(Tt)),C===r&&(e.charCodeAt(R)===33?(C=E,R++):(C=r,te===0&&me(ei)))),C}function Vh(){var C,j,J,z;return C=R,j=Ba(),j!==r?(J=Lt(),z=Yp(),z!==r?(at=C,C=Lp(j,z)):(R=C,C=r)):(R=C,C=r),C===r&&(C=Ba()),C}function Yp(){var C;return e.charCodeAt(R)===63?(C=v,R++):(C=r,te===0&&me(bu)),C===r&&(e.charCodeAt(R)===42?(C=b,R++):(C=r,te===0&&me(Cu)),C===r&&(e.charCodeAt(R)===43?(C=m,R++):(C=r,te===0&&me(_u)))),C}function Ba(){var C,j,J,z,ae,le;return C=e1(),C===r&&(C=oe(),C===r&&(C=mc(),C===r&&(C=Wp(),C===r&&(C=Xp(),C===r&&(C=R,e.charCodeAt(R)===40?(j=y,R++):(j=r,te===0&&me(ks)),j!==r?(J=Lt(),z=Fn(),z!==r?(ae=Lt(),e.charCodeAt(R)===41?(le=D,R++):(le=r,te===0&&me(so)),le!==r?(at=C,C=Up(z)):(R=C,C=r)):(R=C,C=r)):(R=C,C=r)))))),C}function Wp(){var C,j,J,z,ae,le,Xt,Cr;return C=R,j=dc(),j!==r?(J=R,te++,z=R,ae=Lt(),le=R,Xt=Xi(),Xt!==r?(Cr=Lt(),Xt=[Xt,Cr],le=Xt):(R=le,le=r),le===r&&(le=null),e.charCodeAt(R)===61?(Xt=c,R++):(Xt=r,te===0&&me(Au)),Xt!==r?(ae=[ae,le,Xt],z=ae):(R=z,z=r),te--,z===r?J=void 0:(R=J,J=r),J!==r?(at=C,C=jp(j)):(R=C,C=r)):(R=C,C=r),C}function Xp(){var C,j,J,z;return C=R,j=Wl(),j!==r?(J=Lt(),z=xt(),z!==r?(at=C,C=Hp(j,z)):(R=C,C=r)):(R=C,C=r),C}function Wl(){var C;return e.charCodeAt(R)===38?(C=h,R++):(C=r,te===0&&me(Tt)),C===r&&(e.charCodeAt(R)===33?(C=E,R++):(C=r,te===0&&me(ei))),C}function gn(){var C;return e.length>R?(C=e.charAt(R),R++):(C=r,te===0&&me(Ns)),C}function Ii(){var C,j;return te++,e.charCodeAt(R)===9?(C=_,R++):(C=r,te===0&&me(Fa)),C===r&&(e.charCodeAt(R)===11?(C=F,R++):(C=r,te===0&&me(re)),C===r&&(e.charCodeAt(R)===12?(C=L,R++):(C=r,te===0&&me(fe)),C===r&&(e.charCodeAt(R)===32?(C=k,R++):(C=r,te===0&&me(Le)),C===r&&(e.charCodeAt(R)===160?(C=S,R++):(C=r,te===0&&me(Oe)),C===r&&(e.charCodeAt(R)===65279?(C=B,R++):(C=r,te===0&&me(Ve)),C===r&&(C=Jh())))))),te--,C===r&&(j=r,te===0&&me(ao)),C}function Bi(){var C;return vt.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(st)),C}function hc(){var C,j;return te++,e.charCodeAt(R)===10?(C=O,R++):(C=r,te===0&&me(Ir)),C===r&&(e.substr(R,2)===x?(C=x,R+=2):(C=r,te===0&&me(Ht)),C===r&&(e.charCodeAt(R)===13?(C=U,R++):(C=r,te===0&&me(ti)),C===r&&(e.charCodeAt(R)===8232?(C=Y,R++):(C=r,te===0&&me(Gi)),C===r&&(e.charCodeAt(R)===8233?(C=H,R++):(C=r,te===0&&me(ln)))))),te--,C===r&&(j=r,te===0&&me(ft)),C}function Kh(){var C,j;return te++,C=Jp(),C===r&&(C=ai()),te--,C===r&&(j=r,te===0&&me(Dn)),C}function Jp(){var C,j,J,z,ae,le;if(C=R,e.substr(R,2)===K?(j=K,R+=2):(j=r,te===0&&me(Ar)),j!==r){for(J=[],z=R,ae=R,te++,e.substr(R,2)===W?(le=W,R+=2):(le=r,te===0&&me(fn)),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r);z!==r;)J.push(z),z=R,ae=R,te++,e.substr(R,2)===W?(le=W,R+=2):(le=r,te===0&&me(fn)),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r);e.substr(R,2)===W?(z=W,R+=2):(z=r,te===0&&me(fn)),z!==r?(j=[j,J,z],C=j):(R=C,C=r)}else R=C,C=r;return C}function $a(){var C,j,J,z,ae,le;if(C=R,e.substr(R,2)===K?(j=K,R+=2):(j=r,te===0&&me(Ar)),j!==r){for(J=[],z=R,ae=R,te++,e.substr(R,2)===W?(le=W,R+=2):(le=r,te===0&&me(fn)),le===r&&(le=Bi()),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r);z!==r;)J.push(z),z=R,ae=R,te++,e.substr(R,2)===W?(le=W,R+=2):(le=r,te===0&&me(fn)),le===r&&(le=Bi()),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r);e.substr(R,2)===W?(z=W,R+=2):(z=r,te===0&&me(fn)),z!==r?(j=[j,J,z],C=j):(R=C,C=r)}else R=C,C=r;return C}function ai(){var C,j,J,z,ae,le;if(C=R,e.substr(R,2)===ie?(j=ie,R+=2):(j=r,te===0&&me(Mr)),j!==r){for(J=[],z=R,ae=R,te++,le=Bi(),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r);z!==r;)J.push(z),z=R,ae=R,te++,le=Bi(),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r);j=[j,J],C=j}else R=C,C=r;return C}function dc(){var C,j,J,z;if(te++,C=R,j=zh(),j!==r){for(J=[],z=Gh();z!==r;)J.push(z),z=Gh();at=C,C=Mp(j,J)}else R=C,C=r;return te--,C===r&&(j=r,te===0&&me(uo)),C}function zh(){var C,j,J;return C=Zp(),C===r&&(e.charCodeAt(R)===36?(C=p,R++):(C=r,te===0&&me(ps)),C===r&&(e.charCodeAt(R)===95?(C=_e,R++):(C=r,te===0&&me(Ls)),C===r&&(C=R,e.charCodeAt(R)===92?(j=Fe,R++):(j=r,te===0&&me(Ln)),j!==r?(J=Yh(),J!==r?C=J:(R=C,C=r)):(R=C,C=r)))),C}function Gh(){var C;return C=zh(),C===r&&(C=Qp(),C===r&&(C=Wh(),C===r&&(C=Xh(),C===r&&(e.charCodeAt(R)===8204?(C=xe,R++):(C=r,te===0&&me(Pt)),C===r&&(e.charCodeAt(R)===8205?(C=rt,R++):(C=r,te===0&&me(yr))))))),C}function Zp(){var C;return C=wc(),C===r&&(C=Ec(),C===r&&(C=s1(),C===r&&(C=n1(),C===r&&(C=i1(),C===r&&(C=yc()))))),C}function Qp(){var C;return C=Ac(),C===r&&(C=js()),C}function e1(){var C,j,J;return te++,C=R,j=Xi(),j!==r?(e.charCodeAt(R)===105?(J=tt,R++):(J=r,te===0&&me(ur)),J===r&&(J=null),at=C,C=Rh(j,J)):(R=C,C=r),te--,C===r&&(j=r,te===0&&me(Ze)),C}function Xi(){var C,j,J,z;if(te++,C=R,e.charCodeAt(R)===34?(j=ct,R++):(j=r,te===0&&me(or)),j!==r){for(J=[],z=ne();z!==r;)J.push(z),z=ne();e.charCodeAt(R)===34?(z=ct,R++):(z=r,te===0&&me(or)),z!==r?(at=C,C=qp(J)):(R=C,C=r)}else R=C,C=r;if(C===r)if(C=R,e.charCodeAt(R)===39?(j=lt,R++):(j=r,te===0&&me(Mt)),j!==r){for(J=[],z=he();z!==r;)J.push(z),z=he();e.charCodeAt(R)===39?(z=lt,R++):(z=r,te===0&&me(Mt)),z!==r?(at=C,C=kr(J)):(R=C,C=r)}else R=C,C=r;return te--,C===r&&(j=r,te===0&&me(Wr)),C}function ne(){var C,j,J,z;return C=R,j=R,J=R,te++,e.charCodeAt(R)===34?(z=ct,R++):(z=r,te===0&&me(or)),z===r&&(e.charCodeAt(R)===92?(z=Fe,R++):(z=r,te===0&&me(Ln)),z===r&&(z=Bi())),te--,z===r?J=void 0:(R=J,J=r),J!==r?(z=gn(),z!==r?(J=[J,z],j=J):(R=j,j=r)):(R=j,j=r),j!==r?C=e.substring(C,R):C=j,C===r&&(C=R,e.charCodeAt(R)===92?(j=Fe,R++):(j=r,te===0&&me(Ln)),j!==r?(J=pr(),J!==r?C=J:(R=C,C=r)):(R=C,C=r),C===r&&(C=St())),C}function he(){var C,j,J,z;return C=R,j=R,J=R,te++,e.charCodeAt(R)===39?(z=lt,R++):(z=r,te===0&&me(Mt)),z===r&&(e.charCodeAt(R)===92?(z=Fe,R++):(z=r,te===0&&me(Ln)),z===r&&(z=Bi())),te--,z===r?J=void 0:(R=J,J=r),J!==r?(z=gn(),z!==r?(J=[J,z],j=J):(R=j,j=r)):(R=j,j=r),j!==r?C=e.substring(C,R):C=j,C===r&&(C=R,e.charCodeAt(R)===92?(j=Fe,R++):(j=r,te===0&&me(Ln)),j!==r?(J=pr(),J!==r?C=J:(R=C,C=r)):(R=C,C=r),C===r&&(C=St())),C}function oe(){var C,j,J,z,ae,le;if(te++,C=R,e.charCodeAt(R)===91?(j=sn,R++):(j=r,te===0&&me(ri)),j!==r){for(e.charCodeAt(R)===94?(J=nr,R++):(J=r,te===0&&me(ni)),J===r&&(J=null),z=[],ae=Te(),ae===r&&(ae=Qe());ae!==r;)z.push(ae),ae=Te(),ae===r&&(ae=Qe());e.charCodeAt(R)===93?(ae=Ct,R++):(ae=r,te===0&&me(jn)),ae!==r?(e.charCodeAt(R)===105?(le=tt,R++):(le=r,te===0&&me(ur)),le===r&&(le=null),at=C,C=Hl(J,z,le)):(R=C,C=r)}else R=C,C=r;return te--,C===r&&(j=r,te===0&&me(Un)),C}function Te(){var C,j,J,z;return C=R,j=Qe(),j!==r?(e.charCodeAt(R)===45?(J=Er,R++):(J=r,te===0&&me(Tr)),J!==r?(z=Qe(),z!==r?(at=C,C=Sa(j,z)):(R=C,C=r)):(R=C,C=r)):(R=C,C=r),C}function Qe(){var C,j,J,z;return C=R,j=R,J=R,te++,e.charCodeAt(R)===93?(z=Ct,R++):(z=r,te===0&&me(jn)),z===r&&(e.charCodeAt(R)===92?(z=Fe,R++):(z=r,te===0&&me(Ln)),z===r&&(z=Bi())),te--,z===r?J=void 0:(R=J,J=r),J!==r?(z=gn(),z!==r?(J=[J,z],j=J):(R=j,j=r)):(R=j,j=r),j!==r?C=e.substring(C,R):C=j,C===r&&(C=R,e.charCodeAt(R)===92?(j=Fe,R++):(j=r,te===0&&me(Ln)),j!==r?(J=pr(),J!==r?C=J:(R=C,C=r)):(R=C,C=r),C===r&&(C=St())),C}function St(){var C,j,J;return C=R,e.charCodeAt(R)===92?(j=Fe,R++):(j=r,te===0&&me(Ln)),j!==r?(J=hc(),J!==r?(at=C,C=xh()):(R=C,C=r)):(R=C,C=r),C}function pr(){var C,j,J,z;return C=Wt(),C===r&&(C=R,e.charCodeAt(R)===48?(j=sr,R++):(j=r,te===0&&me(fr)),j!==r?(J=R,te++,z=Ra(),te--,z===r?J=void 0:(R=J,J=r),J!==r?(at=C,C=Ml()):(R=C,C=r)):(R=C,C=r),C===r&&(C=gc(),C===r&&(C=Yh()))),C}function Wt(){var C;return C=pc(),C===r&&(C=t1()),C}function pc(){var C,j;return e.charCodeAt(R)===39?(C=lt,R++):(C=r,te===0&&me(Mt)),C===r&&(e.charCodeAt(R)===34?(C=ct,R++):(C=r,te===0&&me(or)),C===r&&(e.charCodeAt(R)===92?(C=Fe,R++):(C=r,te===0&&me(Ln)),C===r&&(C=R,e.charCodeAt(R)===98?(j=dt,R++):(j=r,te===0&&me(jl)),j!==r&&(at=C,j=ii()),C=j,C===r&&(C=R,e.charCodeAt(R)===102?(j=zt,R++):(j=r,te===0&&me(oo)),j!==r&&(at=C,j=Ph()),C=j,C===r&&(C=R,e.charCodeAt(R)===110?(j=nt,R++):(j=r,te===0&&me(Xr)),j!==r&&(at=C,j=Oh()),C=j,C===r&&(C=R,e.charCodeAt(R)===114?(j=Ke,R++):(j=r,te===0&&me(co)),j!==r&&(at=C,j=Th()),C=j,C===r&&(C=R,e.charCodeAt(R)===116?(j=ar,R++):(j=r,te===0&&me(uc)),j!==r&&(at=C,j=kh()),C=j,C===r&&(C=R,e.charCodeAt(R)===118?(j=He,R++):(j=r,te===0&&me(oc)),j!==r&&(at=C,j=Nh()),C=j)))))))),C}function t1(){var C,j,J,z;return C=R,j=R,J=R,te++,z=ui(),z===r&&(z=Bi()),te--,z===r?J=void 0:(R=J,J=r),J!==r?(z=gn(),z!==r?(J=[J,z],j=J):(R=j,j=r)):(R=j,j=r),j!==r?C=e.substring(C,R):C=j,C}function ui(){var C;return C=pc(),C===r&&(C=Ra(),C===r&&(e.charCodeAt(R)===120?(C=Ot,R++):(C=r,te===0&&me(lo)),C===r&&(e.charCodeAt(R)===117?(C=an,R++):(C=r,te===0&&me(Us))))),C}function gc(){var C,j,J,z,ae,le;return C=R,e.charCodeAt(R)===120?(j=Ot,R++):(j=r,te===0&&me(lo)),j!==r?(J=R,z=R,ae=gs(),ae!==r?(le=gs(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r),z!==r?J=e.substring(J,R):J=z,J!==r?(at=C,C=Lh(J)):(R=C,C=r)):(R=C,C=r),C}function Yh(){var C,j,J,z,ae,le,Xt,Cr;return C=R,e.charCodeAt(R)===117?(j=an,R++):(j=r,te===0&&me(Us)),j!==r?(J=R,z=R,ae=gs(),ae!==r?(le=gs(),le!==r?(Xt=gs(),Xt!==r?(Cr=gs(),Cr!==r?(ae=[ae,le,Xt,Cr],z=ae):(R=z,z=r)):(R=z,z=r)):(R=z,z=r)):(R=z,z=r),z!==r?J=e.substring(J,R):J=z,J!==r?(at=C,C=qn(J)):(R=C,C=r)):(R=C,C=r),C}function Ra(){var C;return Or.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(fo)),C}function gs(){var C;return _i.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(cc)),C}function mc(){var C,j;return C=R,e.charCodeAt(R)===46?(j=er,R++):(j=r,te===0&&me(ho)),j!==r&&(at=C,j=Vp()),C=j,C}function xt(){var C,j,J,z;return te++,C=R,e.charCodeAt(R)===123?(j=s,R++):(j=r,te===0&&me(Yr)),j!==r?(J=r1(),e.charCodeAt(R)===125?(z=u,R++):(z=r,te===0&&me(ds)),z!==r?C=J:(R=C,C=r)):(R=C,C=r),te--,C===r&&(j=r,te===0&&me(po)),C}function r1(){var C,j;return C=R,j=vc(),at=C,j=si(j),C=j,C}function vc(){var C,j,J,z,ae,le;if(C=R,j=[],J=[],z=R,ae=R,te++,un.test(e.charAt(R))?(le=e.charAt(R),R++):(le=r,te===0&&me(Hn)),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r),z!==r)for(;z!==r;)J.push(z),z=R,ae=R,te++,un.test(e.charAt(R))?(le=e.charAt(R),R++):(le=r,te===0&&me(Hn)),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r);else J=r;for(J===r&&(J=R,e.charCodeAt(R)===123?(z=s,R++):(z=r,te===0&&me(Yr)),z!==r?(ae=vc(),e.charCodeAt(R)===125?(le=u,R++):(le=r,te===0&&me(ds)),le!==r?(z=[z,ae,le],J=z):(R=J,J=r)):(R=J,J=r));J!==r;){if(j.push(J),J=[],z=R,ae=R,te++,un.test(e.charAt(R))?(le=e.charAt(R),R++):(le=r,te===0&&me(Hn)),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r),z!==r)for(;z!==r;)J.push(z),z=R,ae=R,te++,un.test(e.charAt(R))?(le=e.charAt(R),R++):(le=r,te===0&&me(Hn)),te--,le===r?ae=void 0:(R=ae,ae=r),ae!==r?(le=gn(),le!==r?(ae=[ae,le],z=ae):(R=z,z=r)):(R=z,z=r);else J=r;J===r&&(J=R,e.charCodeAt(R)===123?(z=s,R++):(z=r,te===0&&me(Yr)),z!==r?(ae=vc(),e.charCodeAt(R)===125?(le=u,R++):(le=r,te===0&&me(ds)),le!==r?(z=[z,ae,le],J=z):(R=J,J=r)):(R=J,J=r))}return C=e.substring(C,R),C}function Ec(){var C;return Ft.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(P)),C}function n1(){var C;return Ue.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(N)),C}function i1(){var C;return De.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(V)),C}function s1(){var C;return wr.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(Q)),C}function wc(){var C;return on.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(ve)),C}function js(){var C;return it.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(Ae)),C}function Ac(){var C;return Da.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(Ie)),C}function Wh(){var C;return cn.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(Pe)),C}function yc(){var C;return ge.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(Yt)),C}function Xh(){var C;return Ps.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(br)),C}function Jh(){var C;return Rt.test(e.charAt(R))?(C=e.charAt(R),R++):(C=r,te===0&&me(hn)),C}function Lt(){var C,j;for(C=[],j=Ii(),j===r&&(j=hc(),j===r&&(j=Kh()));j!==r;)C.push(j),j=Ii(),j===r&&(j=hc(),j===r&&(j=Kh()));return C}function Zh(){var C,j;for(C=[],j=Ii(),j===r&&(j=$a());j!==r;)C.push(j),j=Ii(),j===r&&(j=$a());return C}function xa(){var C,j,J,z;return C=R,j=Lt(),e.charCodeAt(R)===59?(J=Gt,R++):(J=r,te===0&&me(dn)),J!==r?(j=[j,J],C=j):(R=C,C=r),C===r&&(C=R,j=Zh(),J=ai(),J===r&&(J=null),z=hc(),z!==r?(j=[j,J,z],C=j):(R=C,C=r),C===r&&(C=R,j=Lt(),J=Pa(),J!==r?(j=[j,J],C=j):(R=C,C=r))),C}function Pa(){var C,j;return C=R,te++,e.length>R?(j=e.charAt(R),R++):(j=r,te===0&&me(Ns)),te--,j===r?C=void 0:(R=C,C=r),C}let bc=t.reservedWords||[];if(Si=a(),Si!==r&&R===e.length)return Si;throw Si!==r&&R{"use strict";var $V=Fp(),RV=f5(),xV=d5(),PV=k2(),OV=["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"],Bh={VERSION:PV,RESERVED_WORDS:OV,GrammarError:$V,parser:xV,compiler:RV,generate(e,t){t=t!==void 0?t:{};function r(a){let s={};return Object.keys(a).forEach(u=>{s[u]=a[u].slice()}),s}let n="plugins"in t?t.plugins:[],i={parser:Bh.parser,passes:r(Bh.compiler.passes),reservedWords:Bh.RESERVED_WORDS.slice()};return n.forEach(a=>{a.use(i,t)}),Bh.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};p5.exports=Bh});var rE=ce((eE,tE)=>{(function(e,t){typeof eE=="object"&&typeof tE<"u"?tE.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(eE,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"},a=function(re){if(!i(re))throw TypeError(re+" is not an object!");return re},s=function(re){try{return!!re()}catch{return!0}},u=!s(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),c=t.document,f=i(c)&&i(c.createElement),d=function(re){return f?c.createElement(re):{}},g=!u&&!s(function(){return Object.defineProperty(d("div"),"a",{get:function(){return 7}}).a!=7}),p=function(re,fe){if(!i(re))return re;var Le,Oe;if(fe&&typeof(Le=re.toString)=="function"&&!i(Oe=Le.call(re))||typeof(Le=re.valueOf)=="function"&&!i(Oe=Le.call(re))||!fe&&typeof(Le=re.toString)=="function"&&!i(Oe=Le.call(re)))return Oe;throw TypeError("Can't convert object to primitive value")},h=Object.defineProperty,E=u?Object.defineProperty:function(fe,Le,Oe){if(a(fe),Le=p(Le,!0),a(Oe),g)try{return h(fe,Le,Oe)}catch{}if("get"in Oe||"set"in Oe)throw TypeError("Accessors not supported!");return"value"in Oe&&(fe[Le]=Oe.value),fe},v={f:E},b=function(re,fe){return{enumerable:!(re&1),configurable:!(re&2),writable:!(re&4),value:fe}},m=u?function(re,fe,Le){return v.f(re,fe,b(1,Le))}:function(re,fe,Le){return re[fe]=Le,re},y={}.hasOwnProperty,D=function(re,fe){return y.call(re,fe)},_=0,F=Math.random(),L=function(re){return"Symbol(".concat(re===void 0?"":re,")_",(++_+F).toString(36))},k=!1,S=e(function(re){var fe="__core-js_shared__",Le=t[fe]||(t[fe]={});(re.exports=function(Oe,Ve){return Le[Oe]||(Le[Oe]=Ve!==void 0?Ve:{})})("versions",[]).push({version:r.version,mode:k?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),B=S("native-function-to-string",Function.toString),O=e(function(re){var fe=L("src"),Le="toString",Oe=(""+B).split(Le);r.inspectSource=function(Ve){return B.call(Ve)},(re.exports=function(Ve,st,ft,Ir){var Ht=typeof ft=="function";Ht&&(D(ft,"name")||m(ft,"name",st)),Ve[st]!==ft&&(Ht&&(D(ft,fe)||m(ft,fe,Ve[st]?""+Ve[st]:Oe.join(String(st)))),Ve===t?Ve[st]=ft:Ir?Ve[st]?Ve[st]=ft:m(Ve,st,ft):(delete Ve[st],m(Ve,st,ft)))})(Function.prototype,Le,function(){return typeof this=="function"&&this[fe]||B.call(this)})}),x=function(re){if(typeof re!="function")throw TypeError(re+" is not a function!");return re},U=function(re,fe,Le){if(x(re),fe===void 0)return re;switch(Le){case 1:return function(Oe){return re.call(fe,Oe)};case 2:return function(Oe,Ve){return re.call(fe,Oe,Ve)};case 3:return function(Oe,Ve,st){return re.call(fe,Oe,Ve,st)}}return function(){return re.apply(fe,arguments)}},Y="prototype",H=function(re,fe,Le){var Oe=re&H.F,Ve=re&H.G,st=re&H.S,ft=re&H.P,Ir=re&H.B,Ht=Ve?t:st?t[fe]||(t[fe]={}):(t[fe]||{})[Y],ti=Ve?r:r[fe]||(r[fe]={}),Gi=ti[Y]||(ti[Y]={}),ln,Dn,Ar,fn;Ve&&(Le=fe);for(ln in Le)Dn=!Oe&&Ht&&Ht[ln]!==void 0,Ar=(Dn?Ht:Le)[ln],fn=Ir&&Dn?U(Ar,t):ft&&typeof Ar=="function"?U(Function.call,Ar):Ar,Ht&&O(Ht,ln,Ar,re&H.U),ti[ln]!=Ar&&m(ti,ln,fn),ft&&Gi[ln]!=Ar&&(Gi[ln]=Ar)};t.core=r,H.F=1,H.G=2,H.S=4,H.P=8,H.B=16,H.W=32,H.U=64,H.R=128;var K=H,W=Math.ceil,ie=Math.floor,_e=function(re){return isNaN(re=+re)?0:(re>0?ie:W)(re)},Fe=function(re){if(re==null)throw TypeError("Can't call method on "+re);return re},xe=function(re){return function(fe,Le){var Oe=String(Fe(fe)),Ve=_e(Le),st=Oe.length,ft,Ir;return Ve<0||Ve>=st?re?"":void 0:(ft=Oe.charCodeAt(Ve),ft<55296||ft>56319||Ve+1===st||(Ir=Oe.charCodeAt(Ve+1))<56320||Ir>57343?re?Oe.charAt(Ve):ft:re?Oe.slice(Ve,Ve+2):(ft-55296<<10)+(Ir-56320)+65536)}},rt=xe(!1);K(K.P,"String",{codePointAt:function(fe){return rt(this,fe)}});var tt=r.String.codePointAt,ct=Math.max,lt=Math.min,sn=function(re,fe){return re=_e(re),re<0?ct(re+fe,0):lt(re,fe)},nr=String.fromCharCode,Ct=String.fromCodePoint;K(K.S+K.F*(!!Ct&&Ct.length!=1),"String",{fromCodePoint:function(fe){for(var Le=arguments,Oe=[],Ve=arguments.length,st=0,ft;Ve>st;){if(ft=+Le[st++],sn(ft,1114111)!==ft)throw RangeError(ft+" is not a valid code point");Oe.push(ft<65536?nr(ft):nr(((ft-=65536)>>10)+55296,ft%1024+56320))}return Oe.join("")}});var Er=r.String.fromCodePoint,sr=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,dt=/[\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]/,zt=/[\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]/,nt={Space_Separator:sr,ID_Start:dt,ID_Continue:zt},Ke={isSpaceSeparator:function(fe){return typeof fe=="string"&&nt.Space_Separator.test(fe)},isIdStartChar:function(fe){return typeof fe=="string"&&(fe>="a"&&fe<="z"||fe>="A"&&fe<="Z"||fe==="$"||fe==="_"||nt.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"||nt.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)}},ar,He,Ot,an,er,Gt,vt,Or,_i,un=function(fe,Le){ar=String(fe),He="start",Ot=[],an=0,er=1,Gt=0,vt=void 0,Or=void 0,_i=void 0;do vt=Da(),yu[He]();while(vt.type!=="eof");return typeof Le=="function"?Ft({"":_i},"",Le):_i};function Ft(re,fe,Le){var Oe=re[fe];if(Oe!=null&&typeof Oe=="object")if(Array.isArray(Oe))for(var Ve=0;Ve0;){var Le=cn();if(!Ke.isHexDigit(Le))throw Tt(ge());re+=ge()}return String.fromCodePoint(parseInt(re,16))}var yu={start:function(){if(vt.type==="eof")throw ei();Ts()},beforePropertyName:function(){switch(vt.type){case"identifier":case"string":Or=vt.value,He="afterPropertyName";return;case"punctuator":ps();return;case"eof":throw ei()}},afterPropertyName:function(){if(vt.type==="eof")throw ei();He="beforePropertyValue"},beforePropertyValue:function(){if(vt.type==="eof")throw ei();Ts()},beforeArrayValue:function(){if(vt.type==="eof")throw ei();if(vt.type==="punctuator"&&vt.value==="]"){ps();return}Ts()},afterPropertyValue:function(){if(vt.type==="eof")throw ei();switch(vt.value){case",":He="beforePropertyName";return;case"}":ps()}},afterArrayValue:function(){if(vt.type==="eof")throw ei();switch(vt.value){case",":He="beforeArrayValue";return;case"]":ps()}},end:function(){}};function Ts(){var re;switch(vt.type){case"punctuator":switch(vt.value){case"{":re={};break;case"[":re=[];break}break;case"null":case"boolean":case"numeric":case"string":re=vt.value;break}if(_i===void 0)_i=re;else{var fe=Ot[Ot.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")Ot.push(re),Array.isArray(re)?He="beforeArrayValue":He="beforePropertyName";else{var Le=Ot[Ot.length-1];Le==null?He="end":Array.isArray(Le)?He="afterArrayValue":He="afterPropertyValue"}}function ps(){Ot.pop();var re=Ot[Ot.length-1];re==null?He="end":Array.isArray(re)?He="afterArrayValue":He="afterPropertyValue"}function Tt(re){return ks(re===void 0?"JSON5: invalid end of input at "+er+":"+Gt:"JSON5: invalid character '"+_u(re)+"' at "+er+":"+Gt)}function ei(){return ks("JSON5: invalid end of input at "+er+":"+Gt)}function bu(){return Gt-=5,ks("JSON5: invalid identifier character at "+er+":"+Gt)}function Cu(re){console.warn("JSON5: '"+_u(re)+"' in strings is not valid ECMAScript; consider escaping")}function _u(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 Le=re.charCodeAt(0).toString(16);return"\\x"+("00"+Le).substring(Le.length)}return re}function ks(re){var fe=new SyntaxError(re);return fe.lineNumber=er,fe.columnNumber=Gt,fe}var so=function(fe,Le,Oe){var Ve=[],st="",ft,Ir,Ht="",ti;if(Le!=null&&typeof Le=="object"&&!Array.isArray(Le)&&(Oe=Le.space,ti=Le.quote,Le=Le.replacer),typeof Le=="function")Ir=Le;else if(Array.isArray(Le)){ft=[];for(var Gi=0,ln=Le;Gi0&&(Oe=Math.min(10,Math.floor(Oe)),Ht=" ".substr(0,Oe)):typeof Oe=="string"&&(Ht=Oe.substr(0,10)),fn("",{"":fe});function fn(Pt,yr){var Ze=yr[Pt];switch(Ze!=null&&(typeof Ze.toJSON5=="function"?Ze=Ze.toJSON5(Pt):typeof Ze.toJSON=="function"&&(Ze=Ze.toJSON(Pt))),Ir&&(Ze=Ir.call(yr,Pt,Ze)),Ze instanceof Number?Ze=Number(Ze):Ze instanceof String?Ze=String(Ze):Ze instanceof Boolean&&(Ze=Ze.valueOf()),Ze){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof Ze=="string")return Mr(Ze,!1);if(typeof Ze=="number")return String(Ze);if(typeof Ze=="object")return Array.isArray(Ze)?Ln(Ze):uo(Ze)}function Mr(Pt){for(var yr={"'":.1,'"':.2},Ze={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},ur="",Wr=0;Wr=0)throw TypeError("Converting circular structure to JSON5");Ve.push(Pt);var yr=st;st=st+Ht;for(var Ze=ft||Object.keys(Pt),ur=[],Wr=0,or=Ze;Wr=0)throw TypeError("Converting circular structure to JSON5");Ve.push(Pt);var yr=st;st=st+Ht;for(var Ze=[],ur=0;ur{let t={};return e.forEach((r,n)=>t[r]=n),t})(ff),O9=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,vn=String.fromCharCode.bind(String),Qw=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),nA=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),iA=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),sA=e=>{let t,r,n,i,a="",s=e.length%3;for(let u=0;u255||(n=e.charCodeAt(u++))>255||(i=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,a+=ff[t>>18&63]+ff[t>>12&63]+ff[t>>6&63]+ff[t&63]}return s?a.slice(0,s-3)+"===".substring(s):a},rg=typeof btoa=="function"?e=>btoa(e):xc?e=>Buffer.from(e,"binary").toString("base64"):sA,eg=xc?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,i=e.length;nt?nA(eg(e)):eg(e),T9=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)}},k9=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,aA=e=>e.replace(k9,T9),eA=xc?e=>Buffer.from(e,"utf8").toString("base64"):Zw?e=>eg(Zw.encode(e)):e=>rg(aA(e)),Rc=(e,t=!1)=>t?nA(eA(e)):eA(e),tA=e=>Rc(e,!0),N9=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,L9=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))}},uA=e=>e.replace(N9,L9),oA=e=>{if(e=e.replace(/\s+/g,""),!O9.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,i;for(let a=0;a>16&255):i===64?vn(t>>16&255,t>>8&255):vn(t>>16&255,t>>8&255,t&255);return r},ng=typeof atob=="function"?e=>atob(iA(e)):xc?e=>Buffer.from(e,"base64").toString("binary"):oA,cA=xc?e=>Qw(Buffer.from(e,"base64")):e=>Qw(ng(e).split("").map(t=>t.charCodeAt(0))),lA=e=>cA(fA(e)),U9=xc?e=>Buffer.from(e,"base64").toString("utf8"):Jw?e=>Jw.decode(cA(e)):e=>uA(ng(e)),fA=e=>iA(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),tg=e=>U9(fA(e)),j9=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)},hA=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),dA=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,hA(r));e("fromBase64",function(){return tg(this)}),e("toBase64",function(t){return Rc(this,t)}),e("toBase64URI",function(){return Rc(this,!0)}),e("toBase64URL",function(){return Rc(this,!0)}),e("toUint8Array",function(){return lA(this)})},pA=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,hA(r));e("toBase64",function(t){return B0(this,t)}),e("toBase64URI",function(){return B0(this,!0)}),e("toBase64URL",function(){return B0(this,!0)})},H9=()=>{dA(),pA()},Dt={version:rA,VERSION:x9,atob:ng,atobPolyfill:oA,btoa:rg,btoaPolyfill:sA,fromBase64:tg,toBase64:Rc,encode:Rc,encodeURI:tA,encodeURL:tA,utob:aA,btou:uA,decode:tg,isValid:j9,fromUint8Array:B0,toUint8Array:lA,extendString:dA,extendUint8Array:pA,extendBuiltins:H9};var Ou=typeof $task<"u",Va=typeof $loon<"u",Tu=typeof $httpClient<"u"&&!Va,Vs=eval('typeof process !== "undefined"'),gA=typeof $environment<"u"&&$environment["stash-version"],mA=typeof $rocket<"u",M9=typeof egern=="object",q9=typeof $native<"u",ku=typeof $Plugins<"u";function $0(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function V9(e){let[t,r,n,i,a,s,u]=e.match(/^socks5:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(a)a=parseInt(a,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:a,userId:r!=null?decodeURIComponent(r):void 0,password:n!=null?decodeURIComponent(n):void 0}}var R0=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=As(),this.env=Oi(),Vs){let dotenv=eval('require("dotenv")');dotenv.config()}this.node=(()=>{if(Vs){let fs=eval("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(Ou&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(Va||Tu)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),ku&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),Vs){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}`)}$0(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")),!$0(this.cache))throw new Error("Invalid Data")}catch{try{let t=Dt.decode(this.node.fs.readFileSync(`${fpath}`,"utf-8"));if(this.cache=JSON.parse(t),this.node.fs.writeFileSync(fpath,t,{flag:"w"}),!$0(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}`)}}$0(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(Ou&&$prefs.setValueForKey(data,this.name),(Va||Tu)&&$persistentStore.write(data,this.name),ku&&$Plugins.SubStoreCache.set(this.name,data),Vs){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),Tu||Va)return $persistentStore.write(e,t);if(Ou)return $prefs.setValueForKey(e,t);if(Vs&&(this.root[t]=e),ku)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),Tu||Va)return $persistentStore.read(e);if(Ou)return $prefs.valueForKey(e);if(Vs)return this.root[e];if(ku)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),Tu||Va)return $persistentStore.write(null,e);if(Ou)return $prefs.removeValueForKey(e);if(Vs&&delete this.root[e],ku)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(Ou&&$notify(title,subtitle,content,options),Tu&&$notification.post(title,subtitle,content+`${mediaURL?` \u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),Va){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(Vs){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)if(/^https?:\/\//.test(push)){let e=push.replace("[\u63A8\u9001\u6807\u9898]",encodeURIComponent(title||"Sub-Store")).replace("[\u63A8\u9001\u5185\u5BB9]",encodeURIComponent([subtitle,content_].map(r=>r).join(` `)));As().get({url:e}).then(r=>{console.log(`[Push Service] URL: ${e} RES: ${r.statusCode} ${r.body}`)}).catch(r=>{console.log(`[Push Service] URL: ${e} ERROR: ${r}`)})}else{let{execFile}=eval('require("child_process")');execFile("shoutrrr",["send","--url",push,"--message",`${title} ${subtitle} ${content_}`],(e,t,r)=>{if(e){console.log(`[Push Service] URL: ${push} ERROR: ${e}`);return}r&&console.log(`[Push Service] URL: ${push} stderr: ${r}`),console.log(`[Push Service] URL: ${push} stdout: ${t}`)})}}ku&&$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={}){Ou||Va||Tu||ku?$done(e):Vs&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function Oi(){return{isQX:Ou,isLoon:Va,isSurge:Tu,isNode:Vs,isStash:gA,isShadowRocket:mA,isEgern:M9,isLanceX:q9,isGUIforCores:ku}}function As(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores}=Oi(),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||gA||mA)&&(opts.timeout=Math.ceil(opts.timeout/1e3),e="s")}if(isNode){let undici=eval("require('undici')"),{socksDispatcher}=eval("require('fetch-socks')"),{ProxyAgent,EnvHttpProxyAgent,request,interceptors}=undici,agentOpts={connect:{rejectUnauthorized:!(opts.strictSSL===!1||opts.insecure===!0||opts.rejectUnauthorized===!1)},bodyTimeout:opts.timeout,headersTimeout:opts.timeout},tlsOptions={rejectUnauthorized:agentOpts.connect.rejectUnauthorized};opts.tls={...opts.tls||{},...tlsOptions};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(V9(opts.proxy),{...agentOpts,requestTls:tlsOptions}):dispatcher=new ProxyAgent({...agentOpts,uri:opts.proxy,requestTls:tlsOptions}):dispatcher=new EnvHttpProxyAgent({...agentOpts,requestTls:tlsOptions});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 K9=new R0("sub-store"),G=K9;function ig(){z9()}function z9(){let e=G.read(Z1);e||G9(),e!=="2.0"&&G.write("2.0",Z1)}function G9(){G.info("Start migrating...");let e=G.read(ns)||{},t=Object.values(e).map(E=>(E.source=E.source||"remote",p(E),h(E),E));G.write(t,ns);let r=G.read(Pu)||{},n=Object.values(r).map(E=>(delete E.ua,p(E),h(E),E));G.write(n,Pu);let i=G.read(ws)||{},a=Object.values(i);G.write(a,ws);let s=G.read(lf)||{},u=Object.values(s);G.write(u,lf);let c=G.read(qa)||{},f=Object.values(c);G.write(f,qa);let d=G.read(Q1)||{},g=Object.values(d);G.write(g,Q1),delete G.cache.builtin,G.info("Migration complete!");function p(E){let v=E["display-name"];v&&(E.displayName=v,delete E["display-name"])}function h(E){let v=E.process;if(!v||v.length===0)return;let b=[],m={type:"Quick Setting Operator",args:{udp:"DEFAULT",tfo:"DEFAULT",scert:"DEFAULT","vmess aead":"DEFAULT",useless:"DEFAULT"}};for(let y of v)if(y.type){if(y.type==="Useless Filter")m.args.useless="ENABLED";else if(y.type==="Set Property Operator"){let{key:D,value:_}=y.args;switch(D){case"udp":m.args.udp=_?"ENABLED":"DISABLED";break;case"tfo":m.args.tfo=_?"ENABLED":"DISABLED";break;case"skip-cert-verify":m.args.scert=_?"ENABLED":"DISABLED";break;case"aead":m.args["vmess aead"]=_?"ENABLED":"DISABLED";break}}else if(y.type.indexOf("Keyword")===-1)if(y.type==="Flag Operator"){let D=typeof y.args>"u"?!0:y.args;y.args={mode:D?"add":"remove"},b.push(y)}else b.push(y)}b.unshift(m),E.process=b}}function sg({substore:$,port,host}){let{isNode}=Oi(),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_=eval('require("express")'),bodyParser=eval('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:a}=e;i=Y9(i),/json/i.test(i["content-type"])&&(a=JSON.parse(a)),r=r.toUpperCase();let{path:s,query:u}=X9(n),c=null,f,d=0;for(f=t;fd&&(c=handlers[f],d=g.split("/").length)}if(c){let g=()=>{dispatch(r,n,f)},p={method:r,url:n,path:s,query:u,params:vA(c.pattern,s),headers:i,body:a},h=Response(),E=c.callback,v=b=>{h.status(500).json({status:"failed",message:`Internal Server Error: ${b}`})};if(E.constructor.name==="AsyncFunction")E(p,h,g).catch(v);else try{E(p,h,g)}catch(b){v(b)}}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}=Oi(),a=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(u){return e=u,this}send(u=""){let c={status:t?s[e]:e,body:u,headers:a};t||i?$done(c):(r||n)&&$done({response:c})}end(){this.send()}html(u){this.set("Content-Type","text/html;charset=UTF-8"),this.send(u)}json(u){this.set("Content-Type","application/json;charset=UTF-8"),this.send(JSON.stringify(u))}set(u,c){return a[u]=c,this}}}}function Y9(e){let t={};for(let r of Object.keys(e))t[r.toLowerCase()]=e[r];return t}function W9(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\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function _f(e,...t){return DC(Df.default.safeLoad,JSON.parse(JSON.stringify(e)),...t)}function FT(e,...t){return DC(Df.default.load,JSON.parse(JSON.stringify(e)),...t)}function _C(e,...t){return Df.default.safeDump(JSON.parse(JSON.stringify(e)),...t)}function FC(e,...t){return Df.default.dump(JSON.parse(JSON.stringify(e)),...t)}var Ws={safeLoad:_f,load:FT,safeDump:_C,dump:FC,parse:_f,stringify:_C};var em=0;function bs(e){return IT(ST(BT(e)))}function ST(e){return RT(xT($T(e),e.length*8))}function IT(e){try{}catch{em=0}for(var t=em?"0123456789ABCDEF":"0123456789abcdef",r="",n,i=0;i>>4&15)+t.charAt(n&15);return r}function BT(e){for(var t="",r=-1,n,i;++r>>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 $T(e){for(var t=Array(e.length>>2),r=0;r>5]|=(e.charCodeAt(r/8)&255)<>5]>>>r%32&255);return t}function xT(e,t){e[t>>5]|=128<>>9<<4)+14]=t;for(var r=1732584193,n=-271733879,i=-1732584194,a=271733878,s=0;s>16)+(t>>16)+(r>>16);return n<<16|r&65535}function PT(e,t){return e<>>32-t}var yd=Zr(UC()),sk=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,ak=/^(([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 Ur(e){return sk.test(e)}function Rr(e){return ak.test(e)}function jC(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 ea(e){return typeof e=="string"&&e.trim().length>0}function rr(e,t){return ea(e)?e:t}function tl(e){return typeof e<"u"&&e!==null}function rl(e,t){return tl(e)?e:t}function Za(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function uk(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function If(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,i]=r.split("-").map(Number);return uk(n,i)}else return Number(r)}function HC(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function bd(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)}var hm=class{constructor(t){this.expires=t,G.read(So)||G.write("{}",So);try{this.resourceCache=JSON.parse(G.read(So))}catch(r){G.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${So} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${r?.message??r}`),this.resourceCache={},G.write("{}",So)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],G.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(){G.write(JSON.stringify(this.resourceCache),So)}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()}},rn=new hm(36e5);var dm=class{constructor(){this.expires=ck(),G.read(Io)||G.write("{}",Io);try{this.resourceCache=JSON.parse(G.read(Io))}catch(t){G.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Io} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},G.write("{}",Io)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],G.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(){G.write(JSON.stringify(this.resourceCache),Io)}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 ck(){G.read(F0)||G.write("6e4",F0);let e=6e4;if(G.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=G.read("#\u54CD\u5E94\u5934\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=G.read(F0),e}var Bf=new dm;function nl(e){let t=Object.keys(e),r="",n="";for(let i of t){let a=i.toLowerCase();a==="subscription-userinfo"?r=e[i]:a==="profile-web-page-url"&&(n=e[i])}return`${r||""}${n?`; app_url=${encodeURIComponent(n)}`:""}`}async function ta(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}=Oi(),insecure=$arguments?.insecure?G.env.isNode?{strictSSL:!1}:{insecure:!0}:void 0,{defaultProxy,defaultFlowUserAgent,defaultTimeout}=G.read(rs),proxy=customProxy||defaultProxy;G.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultFlowUserAgent||"clash",requestTimeout=timeout||defaultTimeout||8e3,id=bs(userAgent+url),cached=Bf.get(id),flowInfo;if(!$arguments?.noCache&&cached)G.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${userAgent}`),flowInfo=cached;else{let e=As();if(flowUrl){G.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,statusCode:r}=await e.get({url:flowUrl,headers:{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Za(proxy):{},...insecure||{}});if(r<200||r>=400)throw new Error(`statusCode: ${r}`);flowInfo=t}else{try{G.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?Za(proxy):{},...insecure||{}});flowInfo=nl(t)}catch(t){G.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){G.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?Za(proxy):{},...insecure||{}});flowInfo=nl(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&Bf.set(id,flowInfo)}return flowInfo}function Cd(e){if(!e)return;let t=e.match(/upload=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),r=t==null?0:Number(t[1]+t[2]),n=e.match(/download=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),i=Number(n[1]+n[2]),a=e.match(/total=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),s=Number(a[1]+a[2]),u=e.match(/expire=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),c=u?Number(u[1]+u[2]):void 0,f=e.match(/reset_day=([0-9]+)/),d=f?Number(f[1]):void 0,g=e.match(/app_url=(.*?)\s*?(;|$)/),p=g?decodeURIComponent(g[1]):void 0,h=e.match(/plan_name=(.*?)\s*?(;|$)/),E=h?decodeURIComponent(h[1]):void 0;return{expires:c,total:s,usage:{upload:r,download:i},remainingDays:d,appUrl:p,planName:E}}function $f(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}:$f(e/1024,r[++n])}function _d(e){if(!e)throw new Error("\u6CA1\u6709\u6D41\u91CF\u4FE1\u606F");if(e?.expires&&e.expires*1e3a.getTime())throw new Error("\u5F00\u59CB\u65E5\u671F\u5E94\u65E9\u4E8E\u73B0\u5728");let s=new Date(r);for(s.setDate(s.getDate()+n);s31)throw new Error("\u6708\u91CD\u7F6E\u65E5\u5E94\u4E3A 1-31 \u4E4B\u95F4\u7684\u6574\u6570");let i=new Date,a=i.getDate(),s=i.getMonth(),u=i.getFullYear(),c;return t>a?c=0:c=new Date(u,s+1,0).getDate(),c-a+t}}catch(t){G.error(`getRmainingDays failed: ${t.message??t}`)}}function il(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(),a=r.slice(n+1).trim();if(!t.has(i))try{let s=decodeURIComponent(a);if(["upload","download","total","expire"].includes(i))try{s=Number(s).toFixed(0),["expire"].includes(i)&&s<=0&&(s="")}catch(u){G.error(`Failed to convert value for key "${i}=${a}": ${u.message??u}`)}t.set(i,s)}catch{t.set(i,a)}}),Array.from(t.entries()).map(([r,n])=>`${r}=${encodeURIComponent(n)}`).join("; ")}catch(t){return G.error(`normalizeFlowHeader failed: ${t.message??t}`),e}}function xr(e,t,r="name"){return e.find(n=>n[r]===t)}function ra(e,t,r){e.status(r||200).json({status:"success",data:t})}function En(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 Rf=class{constructor(t,r,n){this.code=t,this.message=r,this.details=n}},ki=class extends Rf{constructor(t,r,n){super(t,r,n),this.type="InternalServerError"}};var Qa=class extends Rf{constructor(t,r,n){super(t,r,n),this.type="ResourceNotFoundError"}},Dd=class extends Rf{constructor(t,r,n){super(t,r,n),this.type="NetworkError"}};function lk(){return{name:"HTML",test:n=>/^/.test(n),parse:()=>""}}function fk(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var qC=[lk(),fk()];function hk(){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 VC(){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 dk(){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))),VC().func(r))}}function pk(){return{type:"ALL",func:r=>{let n={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},i={payload:r.map(a=>{let s=`${n[a.type]||a.type},${a.content}`;return["IP-CIDR","IP-CIDR6","GEOIP"].includes(a.type)&&(a.options&&(a.options=a.options.filter(u=>["no-resolve"].includes(u))),s+=a.options?.length>0?`,${a.options.join(",")}`:""),s})};return Ws.dump(i)}}}var KC={QX:hk(),Surge:VC(),Loon:dk(),Clash:pk()};var gk=[[/^(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 mk(){return{name:"Universal Rule Parser",test:()=>!0,parse:n=>{let i=n.split(` `),a=[];for(let s of i)if(s=s.trim(),s.length!==0&&!/\s*#/.test(s))try{let u=s.split(",").map(d=>d.trim()),c=u[0],f=!1;for(let d of gk)if(d[0].test(c)){f=!0;let p={type:d[1],content:u[1]};["IP-CIDR","IP-CIDR6","GEOIP"].includes(p.type)&&(p.options=u.slice(2)),a.push(p)}if(!f)throw new Error("Invalid rule type: "+c)}catch(u){console.log(`Failed to parse line: ${s} Reason: ${u}`)}return a}}}var zC=[mk()];var Fd=function(){function e(n){for(let i of qC)try{if(i.test(n))return G.info(`Pre-processor [${i.name}] activated`),i.parse(n)}catch(a){G.error(`Parser [${i.name}] failed Reason: ${a}`)}return n}function t(n){n=e(n);for(let i of zC){let a;try{a=i.test(n)}catch{a=!1}if(a)return G.info(`Rule parser [${i.name}] is activated!`),i.parse(n)}}function r(n,i){let a=KC[i];if(!a)throw new Error(`Target platform: ${i} is not supported!`);if(typeof a.type>"u"||a.type==="SINGLE")return n.map(s=>{try{return a.func(s)}catch(u){return console.log(`ERROR: cannot produce rule: ${JSON.stringify(s)} Reason: ${u}`),""}}).filter(s=>s.length>0).join(` `);if(a.type==="ALL")return a.func(n)}return{parse:t,produce:r}}();var qo=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=Oi(),{defaultProxy,defaultTimeout:timeout,githubProxy}=G.read(rs),proxy=defaultProxy;G.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=As({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?Za(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=As({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?Za(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);G.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((a,s)=>(a[s.path]=s,a),{}));let n=[],i={...t.files};return Object.keys(r).map(a=>{i[a]?r[a].content==null||r[a].content===""?(delete i[a],n.push({action:"delete",file_path:a})):(i[a]=r[a],n.push({action:"update",file_path:a,content:r[a].content})):r[a].content==null||r[a].content===""?(delete i[a],delete r[a]):(i[a]=r[a],n.push({action:"create",file_path:a,content:r[a].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,a])=>(a.content!==null&&a.content!==""&&(n[i]=a),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})`)}};async function pm(e){let{gistToken:t,syncPlatform:r}=G.read(rs);if(!t)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let i=await new qo({token:t,key:Yw,syncPlatform:r}).upload(e),a={};try{a=JSON.parse(i.body)}catch{}let s=a?.html_url??a?.web_url,u=G.read(rs);return s?(G.log(`\u540C\u6B65 Gist \u540E, \u627E\u5230 Sub-Store Gist: ${s}`),u.artifactStore=s,u.artifactStoreStatus="VALID"):(G.error("\u540C\u6B65 Gist \u540E, \u627E\u4E0D\u5230 Sub-Store Gist"),u.artifactStoreStatus="NOT FOUND"),G.write(u,rs),i}function gm(e){G.read(ws)||G.write({},ws),e.get("/api/sync/artifacts",Ek),e.get("/api/sync/artifact/:name",wk)}async function vi({type:e,name:t,platform:r,url:n,ua:i,content:a,mergeSources:s,ignoreFailedRemoteSub:u,ignoreFailedRemoteFile:c,produceType:f,produceOpts:d={},subscription:g,awaitCustomCache:p,$options:h,proxy:E,noCache:v,all:b}){if(r=r||"JSON",["subscription","sub"].includes(e)){let m;if(t){let F=G.read(ns);if(m=xr(F,t),!m)throw new Error(`\u627E\u4E0D\u5230\u8BA2\u9605 ${t}`)}else if(g)m=g;else throw new Error("\u672A\u63D0\u4F9B\u8BA2\u9605\u540D\u79F0\u6216\u8BA2\u9605\u6570\u636E");let y;if(a&&!["localFirst","remoteFirst"].includes(s))y=a;else if(n){let F={};y=await Promise.all(n.split(/[\r\n]+/).map(k=>k.trim()).filter(k=>k.length).map(async k=>{try{return await wn(k,i||m.ua,void 0,E||m.proxy,void 0,p,v||m.noCache,!0)}catch(S){return F[k]=S,G.error(`\u8BA2\u9605 ${m.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${k} \u53D1\u751F\u9519\u8BEF: ${S}`),""}}));let L=m.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(L=u),Object.keys(F).length>0)if(L)L==="enabled"&&G.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${m.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${m.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?y.unshift(a):s==="remoteFirst"&&y.push(a)}else if(m.source==="local"&&!["localFirst","remoteFirst"].includes(m.mergeSources))y=m.content;else{let F={};y=await Promise.all(m.url.split(/[\r\n]+/).map(k=>k.trim()).filter(k=>k.length).map(async k=>{try{return await wn(k,i||m.ua,void 0,E||m.proxy,void 0,p,v||m.noCache,!0)}catch(S){return F[k]=S,G.error(`\u8BA2\u9605 ${m.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${k} \u53D1\u751F\u9519\u8BEF: ${S}`),""}}));let L=m.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(L=u),Object.keys(F).length>0)if(L)L==="enabled"&&G.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${m.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${m.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);m.mergeSources==="localFirst"?y.unshift(m.content):m.mergeSources==="remoteFirst"&&y.push(m.content)}if(f==="raw")return JSON.stringify((Array.isArray(y)?y:[y]).flat());let D=(Array.isArray(y)?y:[y]).map(F=>Nt.parse(F)).flat();if(D.forEach(F=>{F._subName=m.name,F._subDisplayName=m.displayName}),D=await Nt.process(D,m.process||[],r,{[m.name]:m},h),D.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let _={};for(let F of D){if(_[F.name]){G.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${F.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}_[F.name]=!0}return Nt.produce(D,r,f,d)}else if(["collection","col"].includes(e)){let m=G.read(ns),y=G.read(Pu),D=xr(y,t);if(!D)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let _=[...D.subscriptions],F=D.subscriptionTags;Array.isArray(F)&&F.length>0&&m.forEach(U=>{Array.isArray(U.tag)&&U.tag.length>0&&!_.includes(U.name)&&U.tag.some(Y=>F.includes(Y))&&_.push(U.name)});let L={},k={},S=0;await Promise.all(_.map(async U=>{let Y=xr(m,U),H=Y.passThroughUA,K=Y.ua;H&&(G.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${i}`),K=i);try{G.info(`\u6B63\u5728\u5904\u7406\u5B50\u8BA2\u9605\uFF1A${Y.name}...`);let W;if(Y.source==="local"&&!["localFirst","remoteFirst"].includes(Y.mergeSources))W=Y.content;else{let _e={};if(W=await await Promise.all(Y.url.split(/[\r\n]+/).map(Fe=>Fe.trim()).filter(Fe=>Fe.length).map(async Fe=>{try{return await wn(Fe,K,void 0,E||Y.proxy||D.proxy,void 0,void 0,v||Y.noCache,!0)}catch(xe){return _e[Fe]=xe,G.error(`\u8BA2\u9605 ${Y.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Fe} \u53D1\u751F\u9519\u8BEF: ${xe}`),""}})),Object.keys(_e).length>0)if(Y.ignoreFailedRemoteSub)Y.ignoreFailedRemoteSub==="enabled"&&G.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${Y.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(_e).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(_e).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);Y.mergeSources==="localFirst"?W.unshift(Y.content):Y.mergeSources==="remoteFirst"&&W.push(Y.content)}let ie=(Array.isArray(W)?W:[W]).map(_e=>Nt.parse(_e)).flat();ie.forEach(_e=>{_e._subName=Y.name,_e._subDisplayName=Y.displayName,_e._collectionName=D.name,_e._collectionDisplayName=D.displayName}),ie=await Nt.process(ie,Y.process||[],r,{[Y.name]:Y,_collection:D,$options:h}),L[U]=ie,S++,G.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${Y.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(S/_.length).toFixed(1)}% `)}catch(W){S++,k[U]=W,G.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${Y.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${W}\uFF01\u8FDB\u5EA6--${100*(S/_.length).toFixed(1)}%`)}}));let B=D.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(B=u),Object.keys(k).length>0)if(B)B==="enabled"&&G.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${D.name}`,`\u5B50\u8BA2\u9605 ${Object.keys(k).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${D.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(k).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);let O=Array.prototype.concat.apply([],_.map(U=>L[U]||[]));if(O.forEach(U=>{U._collectionName=D.name,U._collectionDisplayName=D.displayName}),O=await Nt.process(O,D.process||[],r,{_collection:D},h),O.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let x={};for(let U of O){if(x[U.name]){G.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${U.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}x[U.name]=!0}return Nt.produce(O,r,f,d)}else if(e==="rule"){let m=G.read(lf),y=xr(m,t);if(!y)throw new Error(`\u627E\u4E0D\u5230\u89C4\u5219 ${t}`);let D=[];for(let _=0;_B.trim()).filter(B=>B.length).map(async B=>{try{return await wn(B,i||y.ua,void 0,y.proxy||E,void 0,void 0,v)}catch(O){return k[B]=O,G.error(`\u6587\u4EF6 ${y.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${B} \u53D1\u751F\u9519\u8BEF: ${O}`),""}}));let S=y.ignoreFailedRemoteFile;if(c!=null&&c!==""&&(S=c),!S&&Object.keys(k).length>0)throw new Error(`\u6587\u4EF6 ${y.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(k).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?D.unshift(a):s==="remoteFirst"&&D.push(a)}else if(y.source==="local"&&!["localFirst","remoteFirst"].includes(y.mergeSources))D=y.content;else{let k={};D=await Promise.all(y.url.split(/[\r\n]+/).map(B=>B.trim()).filter(B=>B.length).map(async B=>{try{return await wn(B,i||y.ua,void 0,y.proxy||E,void 0,void 0,v)}catch(O){return k[B]=O,G.error(`\u6587\u4EF6 ${y.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${B} \u53D1\u751F\u9519\u8BEF: ${O}`),""}}));let S=y.ignoreFailedRemoteFile;if(c!=null&&c!==""&&(S=c),Object.keys(k).length>0)if(S)S==="enabled"&&G.notify("\u{1F30D} Sub-Store \u5904\u7406\u6587\u4EF6\u5931\u8D25",`\u274C ${y.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(k).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${y.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(k).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);y.mergeSources==="localFirst"?D.unshift(y.content):y.mergeSources==="remoteFirst"&&D.push(y.content)}if(f==="raw")return JSON.stringify((Array.isArray(D)?D:[D]).flat());let _=(Array.isArray(D)?D:[D]).flat(),F=_.filter(k=>k!=null&&k!=="").join(` `),L=Array.isArray(y.process)&&y.process.length>0?await Nt.process({$files:_,$content:F,$options:h,$file:y},y.process):{$content:F,$files:_,$options:h};return(b?L:L?.$content)??""}}async function vk(){G.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");let e=G.read(ws),t={};try{let r=[],n=[],i=G.read(ns),a=G.read(Pu),s=[],u=0;if(e.map(d=>{if(d.sync&&d.source){if(u++,d.type==="subscription"){let g=d.source,p=xr(i,g);p&&p.url&&!s.includes(g)&&s.push(g)}else if(d.type==="collection"){let g=xr(a,d.source);g&&Array.isArray(g.subscriptions)&&g.subscriptions.map(p=>{let h=xr(i,p);h&&h.url&&!s.includes(p)&&s.push(p)})}}}),u===0){G.info(`\u9700\u540C\u6B65\u7684\u914D\u7F6E: ${u}, \u603B\u6570: ${e.length}`);return}if(s.length>0&&await Promise.all(s.map(async d=>{try{await vi({type:"subscription",name:d,awaitCustomCache:!0})}catch{}})),await Promise.all(e.map(async d=>{try{if(d.sync&&d.source){G.info(`\u6B63\u5728\u540C\u6B65\u4E91\u914D\u7F6E\uFF1A${d.name}...`);let g=d.platform==="SurgeMac";g&&G.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External");let p=await vi({type:d.type,name:d.source,platform:d.platform,produceOpts:{"include-unsupported-proxy":d.includeUnsupportedProxy,useMihomoExternal:g}});t[encodeURIComponent(d.name)]={content:p},r.push(d.name)}}catch(g){G.error(`\u751F\u6210\u540C\u6B65\u914D\u7F6E ${d.name} \u53D1\u751F\u9519\u8BEF: ${g.message??g}`),n.push(d.name)}})),G.info(`${r.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u6210\u529F: ${r.join(", ")}`),G.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 c=await pm(t),f=JSON.parse(c.body);delete f.history,delete f.forks,delete f.owner,Object.values(f.files).forEach(d=>{delete d.content}),G.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),G.info(JSON.stringify(f,null,2));for(let d of e)if(d.sync&&d.source&&r.includes(d.name)){d.updated=new Date().getTime();let g=f.files,p;Array.isArray(g)&&(p=!0,g=Object.fromEntries(g.map(v=>[v.path,v])));let h=g[encodeURIComponent(d.name)]?.raw_url,E=p?h:h?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");G.info(`\u4E0A\u4F20\u914D\u7F6E\u5B8C\u6210 \u6587\u4EF6\u5217\u8868: ${Object.keys(g).join(", ")} \u5F53\u524D\u6587\u4EF6: ${encodeURIComponent(d.name)} \u54CD\u5E94\u8FD4\u56DE\u7684\u539F\u59CB\u94FE\u63A5: ${h} \u5904\u7406\u5B8C\u7684\u65B0\u94FE\u63A5: ${E}`),d.url=E}if(G.write(e,ws),G.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`);G.info(`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${r.length} \u4E2A`)}catch(r){throw G.error(`\u540C\u6B65\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),r}}async function Ek(e,t){G.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");try{await vk(),ra(t)}catch(r){G.error(`\u540C\u6B65\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),En(t,new ki("FAILED_TO_SYNC_ARTIFACTS","Failed to sync all artifacts",`Reason: ${r.message??r}`))}}async function wk(e,t){let{name:r}=e.params;G.info(`\u5F00\u59CB\u540C\u6B65\u8FDC\u7A0B\u914D\u7F6E ${r}...`);let n=G.read(ws),i=xr(n,r);if(!i){G.error(`\u627E\u4E0D\u5230\u8FDC\u7A0B\u914D\u7F6E ${r}`),En(t,new Qa("RESOURCE_NOT_FOUND",`\u627E\u4E0D\u5230\u8FDC\u7A0B\u914D\u7F6E ${r}`),404);return}if(!i.source){G.error(`\u8FDC\u7A0B\u914D\u7F6E ${r} \u672A\u8BBE\u7F6E\u6765\u6E90`),En(t,new Qa("RESOURCE_HAS_NO_SOURCE",`\u8FDC\u7A0B\u914D\u7F6E ${r} \u672A\u8BBE\u7F6E\u6765\u6E90`),404);return}try{let a=i.platform==="SurgeMac";a&&G.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External");let s=await vi({type:i.type,name:i.source,platform:i.platform,produceOpts:{"include-unsupported-proxy":i.includeUnsupportedProxy,useMihomoExternal:a}});G.info(`\u6B63\u5728\u4E0A\u4F20\u914D\u7F6E\uFF1A${i.name} >>>${JSON.stringify(i,null,2)}`);let u=await pm({[encodeURIComponent(i.name)]:{content:s}});i.updated=new Date().getTime();let c=JSON.parse(u.body);delete c.history,delete c.forks,delete c.owner,Object.values(c.files).forEach(h=>{delete h.content}),G.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),G.info(JSON.stringify(c,null,2));let f=c.files,d;Array.isArray(f)&&(d=!0,f=Object.fromEntries(f.map(h=>[h.path,h])));let g=f[encodeURIComponent(i.name)]?.raw_url,p=d?g:g?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");G.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: ${g} \u5904\u7406\u5B8C\u7684\u65B0\u94FE\u63A5: ${p}`),i.url=p,G.write(n,ws),ra(t,i)}catch(a){G.error(`\u8FDC\u7A0B\u914D\u7F6E ${i.name} \u53D1\u751F\u9519\u8BEF: ${a.message??a}`),En(t,new ki("FAILED_TO_SYNC_ARTIFACT",`Failed to sync artifact ${r}`,`Reason: ${a}`))}}function Ak(){return{name:"HTML",test:n=>/^/.test(n),parse:()=>""}}function yk(){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(a=>i.indexOf(a)!==-1)},parse:function(i){let a=Dt.decode(i);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(a)?a:(G.error("Base64 Pre-processor error: decoded line does not start with protocol"),i)}}}function bk(){return{name:"Fallback Base64 Pre-processor",test:function(n){return!0},parse:function(n){let i=Dt.decode(n);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(i)?i:(G.error("Fallback Base64 Pre-processor error: decoded line does not start with protocol"),n)}}}function Ck(){return{name:"Clash Pre-processor",test:function(n){if(!/proxies/.test(n))return!1;let i=_f(n);return i.proxies&&Array.isArray(i.proxies)},parse:function(n,i){let a=n.replace(/short-id:([ \t]*[^#\n,}]*)/g,(c,f)=>{let d=f.trim();return!d||d===""?'short-id: ""':/^(['"]).*\1$/.test(d)?`short-id: ${d}`:["null"].includes(d)?`short-id: ${d}`:`short-id: "${d}"`}),{proxies:s,"global-client-fingerprint":u}=_f(a);return(i?`proxies: `:"")+s.map(c=>(u&&!c["client-fingerprint"]&&(c["client-fingerprint"]=u),`${i?" - ":""}${JSON.stringify(c)} `)).join("")}}}function _k(){return{name:"SSD Pre-processor",test:function(n){return n.indexOf("ssd://")===0},parse:function(n){let i=[],a=JSON.parse(Dt.decode(n.split("ssd://")[1])),s=a.port,u=a.encryption,c=a.password,f=a.servers;for(let d=0;de.name==="Clash Pre-processor"),mm=new Map;async function wn(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}=Oi(),{defaultProxy,defaultUserAgent,defaultTimeout,cacheThreshold:defaultCacheThreshold}=G.read(rs),cacheThreshold=defaultCacheThreshold||1024,proxy=customProxy||defaultProxy;G.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultUserAgent||"clash.meta",requestTimeout=timeout||defaultTimeout||8e3,id=bs(userAgent+url);$arguments?.cacheKey===!0&&(G.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=G.read(customCacheKey),t=rn.get(id);if(!noCache&&!$arguments?.noCache&&t)return G.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){G.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u672C\u6B21\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u66F4\u65B0\u7F13\u5B58`);try{await wn(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess)}catch(r){G.error(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`),G.info("\u4F7F\u7528\u4E50\u89C2\u7F13\u5B58\u7684\u6570\u636E\u5237\u65B0\u7F13\u5B58, \u9632\u6B62\u540E\u7EED\u8BF7\u6C42"),rn.set(id,e)}}else G.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`),wn(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess).catch(r=>{G.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"?D0:qa,n=xr(G.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return e==="module"?n.content:await vi({type:"file",name:t})}catch(t){throw G.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=eval('require("fs")');return fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw G.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&&mm.has(id))return mm.get(id);let http=As({headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,cached=rn.get(id);if(!noCache&&!$arguments?.noCache&&cached)G.info(`\u4F7F\u7528\u7F13\u5B58: ${url}, ${userAgent}`),result=cached,customCacheKey&&(G.info(`URL ${url} \u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),G.write(cached,customCacheKey));else{let e=$arguments?.insecure?isNode?{strictSSL:!1}:{insecure:!0}:void 0;G.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?Za(proxy):{},...e||{}});if(G.info(`statusCode: ${n}`),n<200||n>=400)throw new Error(`statusCode: ${n}`);if(r){let a=nl(r);a&&Bf.set(id,a)}if(t.replace(/\s/g,"").length===0)throw new Error(new Error("\u8FDC\u7A0B\u8D44\u6E90\u5185\u5BB9\u4E3A\u7A7A"));if(preprocess)try{GC.test(t)&&(t=GC.parse(t,!0))}catch(a){G.error(`Clash Pre-processor error: ${a}`)}let i=!0;if(cacheThreshold){let a=t.length/1024;a>cacheThreshold&&(G.info(`\u8D44\u6E90\u5927\u5C0F ${a.toFixed(2)} KB \u8D85\u8FC7\u4E86 ${cacheThreshold} KB, \u4E0D\u7F13\u5B58`),i=!1)}if(preprocess)try{let a=Nt.parse(t);(!Array.isArray(a)||a.length===0)&&(G.error(`URL ${url} \u4E0D\u5305\u542B\u6709\u6548\u8282\u70B9, \u4E0D\u7F13\u5B58`),i=!1)}catch(a){G.error(`URL ${url} \u5C1D\u8BD5\u89E3\u6790\u8282\u70B9\u5931\u8D25 ${a.message??a}, \u4E0D\u7F13\u5B58`),i=!1}i&&(rn.set(id,t),customCacheKey&&(G.info(`URL ${url} \u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),G.write(t,customCacheKey))),result=t}catch(t){if(customCacheKey){let r=G.read(customCacheKey);if(r)return G.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 _d(Cd(await ta(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl))),isNode||mm.set(id,result),result}async function YC(url,file){let undici=eval("require('undici')"),fs=eval("require('fs')"),{pipeline}=eval("require('stream/promises')"),{Agent,interceptors,request}=undici;G.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),G.info(`File downloaded from ${url} to ${file}`),file}var vm=class{constructor(){this.expires=Fk(),G.read(Bo)||G.write("{}",Bo);try{this.resourceCache=JSON.parse(G.read(Bo))}catch(t){G.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Bo} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},G.write("{}",Bo)}this._cleanup()}_cleanup(t,r){let n=!1;Object.entries(this.resourceCache).forEach(i=>{let[a,s]=i;s.time||(delete this.resourceCache[a],G.delete(`#${a}`),n=!0),(new Date().getTime()-s.time>(r??this.expires)||t&&a.startsWith(t))&&(delete this.resourceCache[a],n=!0)}),n&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){G.write(JSON.stringify(this.resourceCache),Bo)}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 Fk(){G.read(S0)||G.write("1728e5",S0);let e=1728e5;if(G.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=G.read("#\u8282\u70B9\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=G.read(S0),e}var Em=new vm;function Id(e,t){return[...Array(e).keys()].map(()=>t)}var wm={"\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{1F1E9}\u{1F1FF}":["DZ","DZA"],"\u{1F1EA}\u{1F1E8}":["EC","ECU"],"\u{1F1EA}\u{1F1EA}":["EE","EST"],"\u{1F1EA}\u{1F1EC}":["EG","EGY"],"\u{1F1EA}\u{1F1F8}":["ES","ESP"],"\u{1F1EA}\u{1F1FA}":["EU"],"\u{1F1EB}\u{1F1EE}":["FI","FIN"],"\u{1F1EB}\u{1F1F7}":["FR","FRA"],"\u{1F1EC}\u{1F1E7}":["GB","GBR","UK"],"\u{1F1EC}\u{1F1EA}":["GE","GEO"],"\u{1F1EC}\u{1F1F7}":["GR","GRC"],"\u{1F1EC}\u{1F1F9}":["GT","GTM"],"\u{1F1EC}\u{1F1FA}":["GU","GUM"],"\u{1F1ED}\u{1F1F0}":["HK","HKG","HKT","HKBN","HGC","WTT","CMI"],"\u{1F1ED}\u{1F1F7}":["HR","HRV"],"\u{1F1ED}\u{1F1FA}":["HU","HUN"],"\u{1F1EE}\u{1F1F6}":["IQ","IRQ"],"\u{1F1EF}\u{1F1F4}":["JO","JOR"],"\u{1F1EF}\u{1F1F5}":["JP","JPN","TYO"],"\u{1F1F0}\u{1F1EA}":["KE","KEN"],"\u{1F1F0}\u{1F1EC}":["KG","KGZ"],"\u{1F1F0}\u{1F1ED}":["KH","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{1F1E6}":["VA","VAT"],"\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 sl(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","Dubai"],"\u{1F1E6}\u{1F1EB}":["Afghanistan","\u963F\u5BCC\u6C57"],"\u{1F1E6}\u{1F1F1}":["Albania","\u963F\u5C14\u5DF4\u5C3C\u4E9A","\u963F\u723E\u5DF4\u5C3C\u4E9E"],"\u{1F1E6}\u{1F1F2}":["Armenia","\u4E9A\u7F8E\u5C3C\u4E9A"],"\u{1F1E6}\u{1F1F7}":["Argentina","\u963F\u6839\u5EF7"],"\u{1F1E6}\u{1F1F9}":["Austria","\u5965\u5730\u5229","\u5967\u5730\u5229","\u7EF4\u4E5F\u7EB3"],"\u{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","Czech","Czech Republic"],"\u{1F1E9}\u{1F1EA}":["German","\u5FB7\u56FD","\u5FB7\u570B","\u4EAC\u5FB7","\u6EEC\u5FB7","\u5EE3\u5FB7","\u6CAA\u5FB7","\u5E7F\u5FB7","\u6CD5\u5170\u514B\u798F","Frankfurt","\u5FB7\u610F\u5FD7"],"\u{1F1E9}\u{1F1F0}":["Denmark","\u4E39\u9EA6","\u4E39\u9EA5"],"\u{1F1E9}\u{1F1FF}":["Algeria","\u963F\u5C14\u53CA\u5229\u4E9A","\u963F\u723E\u53CA\u5229\u4E9E"],"\u{1F1EA}\u{1F1E8}":["Ecuador","\u5384\u74DC\u591A\u5C14"],"\u{1F1EA}\u{1F1EA}":["Estonia","\u7231\u6C99\u5C3C\u4E9A"],"\u{1F1EA}\u{1F1EC}":["Egypt","\u57C3\u53CA"],"\u{1F1EA}\u{1F1F8}":["Spain","\u897F\u73ED\u7259"],"\u{1F1EA}\u{1F1FA}":["European Union","\u6B27\u76DF","\u6B27\u7F57\u5DF4"],"\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{1F1E6}":["Vatican","Vatican City","Holy See","\u68B5\u8482\u5188","\u68B5\u8482\u5CA1"],"\u{1F1FB}\u{1F1EA}":["Venezuela","\u59D4\u5185\u745E\u62C9"],"\u{1F1FB}\u{1F1F3}":["Vietnam","\u8D8A\u5357","\u80E1\u5FD7\u660E"],"\u{1F1FF}\u{1F1E6}":["South Africa","\u5357\u975E"],"\u{1F1E8}\u{1F1F3}":["China","\u4E2D\u56FD","\u4E2D\u570B","\u56DE\u56FD","\u56DE\u570B","\u56FD\u5185","\u570B\u5167","\u534E\u4E1C","\u534E\u897F","\u534E\u5357","\u534E\u5317","\u534E\u4E2D","\u6C5F\u82CF","\u5317\u4EAC","\u4E0A\u6D77","\u5E7F\u5DDE","\u6DF1\u5733","\u676D\u5DDE","\u5F90\u5DDE","\u9752\u5C9B","\u5B81\u6CE2","\u9547\u6C5F"]},r=e.match(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/)?.[0]||"\u{1F3F4}\u200D\u2620\uFE0F";for(let n of Object.keys(t))if(t[n].some(a=>RegExp(`${a}`,"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(wm))if(wm[n].some(a=>RegExp(`(^|[^a-zA-Z])${a}([^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 $d(e){return wm[sl(e)]?.[0]}function xf(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴‍☠️|🏳️‍🌈/g,"").trim()}var Bd=class{constructor({country,asn}={}){if(G.env.isNode){let Reader=eval('require("@maxmind/geoip2-node")').Reader,fs=eval("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 Pd=Zr(s_()),Bm=Zr(j0());async function ul({url:e,domain:t,type:r="A",timeout:n,edns:i}){let a=Pd.default.encode({type:"query",id:0,flags:Pd.default.RECURSION_DESIRED,questions:[{type:r,name:t}],additionals:[{type:"OPT",name:".",udpPayloadSize:4096,flags:0,options:[{code:"CLIENT_SUBNET",ip:i,sourcePrefixLength:Ur(i)?24:56,scopePrefixLength:0}]}]}),u=Bm.Buffer.from(a).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),c=await G.http.get({url:`${e}?dns=${encodeURIComponent(u)}`,headers:{Accept:"application/dns-message"},"binary-mode":!0,encoding:null,timeout:n});return Pd.default.decode(Bm.Buffer.from(G.env.isQX?c.bodyBytes:c.body))}var xm=Zr($m());var{isNode:a_,isQX:Ok,isLoon:Tk,isSurge:kk,isStash:Nk,isShadowRocket:Lk,isLanceX:Uk,isEgern:jk,isGUIforCores:Hk}=Oi(),fa="Node";a_&&(fa="Node");Ok&&(fa="QX");Tk&&(fa="Loon");kk&&(fa="Surge");Nk&&(fa="Stash");Lk&&(fa="ShadowRocket");jk&&(fa="Egern");Uk&&(fa="LanceX");Hk&&(fa="GUI.for.Cores");var Ko={},Mk={};try{if(typeof $environment<"u"&&(Ko.env=$environment),typeof $loon<"u"&&(Ko.loon=$loon),typeof $script<"u"&&(Ko.script=$script),typeof $Plugin<"u"&&(Ko.plugin=$Plugin),a_){Ko.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)&&(Ko.node.env[e]=env[e])}}catch(e){}var zo={backend:fa,version:_0,feature:Mk,meta:Ko};function qk(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Tf(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function o_(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(qk(r[n]))if(n.endsWith("!")){let i=Tf(n.slice(0,-1));e[i]=r[n]}else{let i=Tf(n);e[i]||Object.assign(e,{[i]:{}}),o_(e[i],r[i])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let i=Tf(n.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...r[n],...e[i]]}else if(n.endsWith("+")){let i=Tf(n.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...r[n]]}else{let i=Tf(n);Object.assign(e,{[i]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function Vk({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>Od(e,r))}}function Od(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=>Od(r,t));case"OR":return e.child.some(r=>Od(r,t));case"NOT":return!Od(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function Kk(e){return{name:"Quick Setting Operator",func:r=>{if(t(e.useless)){let i=h_().func(r);r=r.filter((a,s)=>i[s]&&a.port>0&&a.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 zk({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=xf(n.name);else{let i=sl(n.name);n.name=xf(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 Gk(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:a=>{if(t==="delete"){let s={};return a.filter(u=>s[u.name]?!1:(s[u.name]=!0,!0))}else if(t==="rename"){let s=r.split(" "),u={},c=0;a.forEach(d=>{typeof u[d.name]>"u"?u[d.name]=1:u[d.name]++,c=Math.max(u[d.name].toString().length,c)});let f={};return a.map(d=>{if(u[d.name]>1){typeof f[d.name]>"u"&&(f[d.name]=1);let g="",p=f[d.name]++,h=0;for(;p>0;)g=s[p%10]+g,p=parseInt(p/10),h++;for(;h++{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 sN(t);default:throw new Error("Unknown sort option: "+e)}}}}function Wk(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=>Pm(i)),n.sort((i,a)=>{let s=u_(r,i.name),u=u_(r,a.name);return s&&!u?-1:u&&!s?1:s&&u?st.map(r=>{for(let{expr:n,now:i}of e)r.name=r.name.replace(Pm(n,"g"),i).trim();return r})}}function Xk(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:c_(t).func}}function Jk(e,t,r,n,i){return{name:"Script Operator",func:async a=>{let s=a;if(s?.$file?.type==="mihomoProfile")try{let u=Ws.safeLoad(e),c;if(s?.$content)try{c=Ws.safeLoad(s?.$content)}catch(f){G.error(f.message??f)}if(typeof u!="object")throw new Error("patch is not an object");return s.$content=Nt.yaml.safeDump(o_(c||(s?.$file?.sourceType==="none"?{}:{proxies:await vi({type:s?.$file?.sourceType||"collection",name:s?.$file?.sourceName,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0}})}),u)),s}catch{}return await async function(){s=Td("operator",e,r,i)(a,t,{source:n,...zo})}(),s},nodeFunc:async a=>{let s=a;return await async function(){s=Td("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)(a,t,{source:n,...zo})}(),s}}}function Zk(e){let t,r;try{let n=e.split(":");r=parseInt(n[2],16);let i=parseInt(n[3],16),a=parseInt(n[4],16),s=i>>8,u=i&255,c=a>>8,f=a&255;if(t=`${s}.${u}.${c}.${f}`,r<=0||r>65535)throw new Error(`Invalid port number: ${r}`);if(!Ur(t))throw new Error(`Invalid IP address: ${t}`)}catch(n){G.error(`IP4P \u89E3\u6790\u5931\u8D25: ${n}`)}return{server:t,port:r}}var l_={Custom:async function(e,t,r,n,i,a){let s=bs(`CUSTOM:${a}:${e}:${t}`),u=rn.get(s);if(!r&&u)return u;let c=t==="IPv6"?"AAAA":"A",f=await ul({url:a,domain:e,type:c,timeout:n,edns:i}),{answers:d}=f;if(!Array.isArray(d)||d.length===0)throw new Error("No answers");let g=d.filter(p=>p?.type===c).map(p=>p?.data).filter(p=>p);if(g.length===0)throw new Error("No answers");return rn.set(s,g),g},Google:async function(e,t,r,n,i){let a=bs(`GOOGLE:${e}:${t}`),s=rn.get(a);if(!r&&s)return s;let u=t==="IPv6"?"AAAA":"A",c=await ul({url:"https://8.8.4.4/dns-query",domain:e,type:u,timeout:n,edns:i}),{answers:f}=c;if(!Array.isArray(f)||f.length===0)throw new Error("No answers");let d=f.filter(g=>g?.type===u).map(g=>g?.data).filter(g=>g);if(d.length===0)throw new Error("No answers");return rn.set(a,d),d},"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=bs(`IP-API:${e}`),a=rn.get(i);if(!r&&a)return a;let s=await G.http.get({url:`http://ip-api.com/json/${encodeURIComponent(e)}?lang=zh-CN`,timeout:n}),u=JSON.parse(s.body);if(u.status!=="success")throw new Error(`Status is ${u.status}`);if(!u.query||u.query===0)throw new Error("No answers");let c=[u.query];if(c.length===0)throw new Error("No answers");return rn.set(i,c),c},Cloudflare:async function(e,t,r,n,i){let a=bs(`CLOUDFLARE:${e}:${t}`),s=rn.get(a);if(!r&&s)return s;let u=t==="IPv6"?"AAAA":"A",c=await ul({url:"https://1.0.0.1/dns-query",domain:e,type:u,timeout:n,edns:i}),{answers:f}=c;if(!Array.isArray(f)||f.length===0)throw new Error("No answers");let d=f.filter(g=>g?.type===u).map(g=>g?.data).filter(g=>g);if(d.length===0)throw new Error("No answers");return rn.set(a,d),d},Ali:async function(e,t,r,n,i){let a=bs(`ALI:${e}:${t}`),s=rn.get(a);if(!r&&s)return s;let u=await G.http.get({url:`http://223.6.6.6/resolve?edns_client_subnet=${i}/${Ur(i)?24:56}&name=${encodeURIComponent(e)}&type=${t==="IPv6"?"AAAA":"A"}&short=1`,headers:{accept:"application/dns-json"},timeout:n}),c=JSON.parse(u.body);if(!Array.isArray(c)||c.length===0)throw new Error("No answers");let f=c;if(f.length===0)throw new Error("No answers");return rn.set(a,f),f},Tencent:async function(e,t,r,n,i){let a=bs(`TENCENT:${e}:${t}`),s=rn.get(a);if(!r&&s)return s;let c=(await G.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(d=>d.split(",")[0]);if(c.length===0||String(c)==="0")throw new Error("No answers");let f=c;if(f.length===0)throw new Error("No answers");return rn.set(a,f),f}};function f_({provider:e,type:t,filter:r,cache:n,url:i,timeout:a,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:u}=G.read(rs),c=a||u||8e3,f=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",d=l_[e];if(!d)throw new Error(`\u627E\u4E0D\u5230\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9: ${e}`);let g=s||"223.6.6.6";if(!Go(g))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");return G.info(`Domain Resolver: [${t}] ${e} ${g||""} ${i||""}`),{name:"Resolve Domain Operator",func:async p=>{p.forEach((m,y)=>{!m["_no-resolve"]&&m["no-resolve"]&&(p[y]["_no-resolve"]=m["no-resolve"])});let h={},E=15,v=[...new Set(p.filter(m=>!Go(m.server)&&!m["_no-resolve"]).map(m=>m.server))],b=Math.ceil(v.length/E);for(let m=0;m{h[D]=_,G.info(`Successfully resolved domain: ${D} \u279F ${_}`)}).catch(_=>{G.error(`Failed to resolve domain: ${D} with resolver [${e}]: ${_}`)}));await Promise.all(y)}return p.forEach(m=>{if(!m["_no-resolve"])if(h[m.server]){m._resolved_ips=h[m.server];let y=Array.isArray(h[m.server])?h[m.server][Math.floor(Math.random()*h[m.server].length)]:h[m.server];if(f==="IPv6"&&Rr(y)){try{y=new yd.Address6(y).correctForm()}catch(D){G.error(`Failed to parse IPv6 address: ${y}: ${D}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(y)){m._IP4P=y;let{server:D,port:_}=Zk(y);D&&_?(m._domain=m.server,m.server=D,m.port=_,m.resolved=!0,m._IPv4=m.server,Go(m._IP)||(m._IP=m.server)):m.resolved||(m.resolved=!1)}else m._domain=m.server,m.server=y,m.resolved=!0,m[`_${f}`]=m.server,Go(m._IP)||(m._IP=m.server)}else m._domain=m.server,m.server=y,m.resolved=!0,m[`_${f}`]=m.server,Go(m._IP)||(m._IP=m.server)}else m.resolved||(m.resolved=!1)}),p.filter(m=>r==="removeFailed"?Go(m.server)||m["_no-resolve"]||m.resolved:r==="IPOnly"?Go(m.server):r==="IPv4Only"?Ur(m.server):r==="IPv6Only"?Rr(m.server):!0)}}}function Go(e){return Ur(e)||Rr(e)}f_.resolver=l_;function Rm(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function h_(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!Rm(t.cipher))return!1;if(t.password&&!Rm(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&&!Rm(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function Qk(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(a=>{let s=sl(a.name),u=t.some(c=>n[c]===s);return r?u:!u})}}function eN({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let i=e.some(a=>Pm(a).test(n.name));return t?i:!i})}}function Pm(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function tN(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 a=t.some(s=>i.type===s);return r?a:!a})}}function rN(e,t,r,n,i){return{name:"Script Filter",func:async a=>{let s=Id(a.length,!0);return await async function(){s=Td("filter",e,r,i)(a,t,{source:n,...zo})}(),s},nodeFunc:async a=>{let s=Id(a.length,!0);return await async function(){s=Td("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)(a,t,{source:n,...zo})}(),s}}}var kd={"Useless Filter":h_,"Region Filter":Qk,"Regex Filter":eN,"Type Filter":tN,"Script Filter":rN,"Conditional Filter":Vk,"Quick Setting Operator":Kk,"Flag Operator":zk,"Sort Operator":Yk,"Regex Sort Operator":Wk,"Regex Rename Operator":c_,"Regex Delete Operator":Xk,"Script Operator":Jk,"Handle Duplicate Operator":Gk,"Resolve Domain Operator":f_};async function nN(e,t){let r=Id(t.length,!0);try{r=await e.func(t)}catch(n){let i="",a=`${n.message??n}`;a.includes("$server is not defined")?i="":(G.error(`Cannot apply filter ${e.name}(function filter)! Reason: ${n}`),i=`\u6267\u884C function filter \u5931\u8D25 ${a}; `);try{r=await e.nodeFunc(t)}catch(s){G.error(`Cannot apply filter ${e.name}(shortcut script)! Reason: ${s}`);let u="",c=`${s.message??s}`;throw i&&c===a?(u="",i=`\u6267\u884C\u5931\u8D25 ${a}`):u=`\u6267\u884C\u5FEB\u6377\u8FC7\u6EE4\u811A\u672C \u5931\u8D25 ${c}`,new Error(`\u811A\u672C\u8FC7\u6EE4 ${i}${u}`)}}return t.filter((n,i)=>r[i])}async function iN(e,t){let r=aN(t);try{let n=await e.func(r);n&&(r=n)}catch(n){let i="",a=`${n.message??n}`;a.includes("$server is not defined")||a.includes("$content is not defined")||a.includes("$files is not defined")||r?.$files||r?.$content?i="":(G.error(`Cannot apply operator ${e.name}(function operator)! Reason: ${n}`),i=`\u6267\u884C function operator \u5931\u8D25 ${a}; `);try{let s=await e.nodeFunc(r);s&&(r=s)}catch(s){G.error(`Cannot apply operator ${e.name}(shortcut script)! Reason: ${s}`);let u="",c=`${s.message??s}`;throw i&&c===a?(u="",i=`\u6267\u884C\u5931\u8D25 ${a}`):u=`\u6267\u884C\u5FEB\u6377\u811A\u672C \u5931\u8D25 ${c}`,new Error(`\u811A\u672C\u64CD\u4F5C ${i}${u}`)}}return r}async function d_(e,t){if(e.name.indexOf("Filter")!==-1)return nN(e,t);if(e.name.indexOf("Operator")!==-1)return iN(e,t)}function sN(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 aN(e){return JSON.parse(JSON.stringify(e))}function Td(name,script,$arguments,$options){let flowUtils={getFlowField:nl,getFlowHeaders:ta,parseFlowHeaders:Cd,flowTransfer:$f,validCheck:_d,getRmainingDays:MC,normalizeFlowHeader:il};return G.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,G,xm.default,$persistentStore,$httpClient,$notification,Nt,Nt.yaml,Nt.Buffer,Nt.Base64.decode,Nt.Base64.encode,Em,flowUtils,vi,eval('typeof require !== "undefined"')?Fo:void 0):new Function("$arguments","$options","$substore","lodash","ProxyUtils","yaml","Buffer","b64d","b64e","scriptResourceCache","flowUtils","produceArtifact","require",`${script} return ${name}`)($arguments,$options,G,xm.default,Nt,Nt.yaml,Nt.Buffer,Nt.Base64.decode,Nt.Base64.encode,Em,flowUtils,vi,eval('typeof require !== "undefined"')?Fo:void 0)}var p_=Zr($m()),ht=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){ue(this.proxy,r)&&this.append(t)}toString(){return this.output.join("")}};function ue(e,t){let r=p_.default.get(e,t);return typeof r<"u"&&r!==null}var uN="Surge",us={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function cl(){return{produce:(t,r,n={})=>{switch(t.name=t.name.replace(/=|,/g,""),t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return oN(t,n["include-unsupported-proxy"]);case"trojan":return cN(t);case"vmess":return lN(t,n["include-unsupported-proxy"]);case"http":return hN(t);case"direct":return dN(t);case"socks5":return pN(t);case"snell":return gN(t);case"tuic":return mN(t);case"wireguard-surge":return EN(t);case"hysteria2":return wN(t);case"ssh":return fN(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return vN(t);throw new Error(`Platform ${uN} does not support proxy type: ${t.type}`)}}}function oN(e){let t=new ht(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=us[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"),ue(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"),ue(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,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}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 cN(e){let t=new ht(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=us[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"),g_(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"),ue(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 lN(e,t){let r=new ht(e);r.append(`${e.name}=${e.type},${e.server},${e.port}`),r.appendIfPresent(`,username=${e.uuid}`,"uuid");let n=us[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"),g_(r,e,t),ue(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"),ue(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 fN(e){let t=new ht(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=us[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 hN(e){if(e.headers&&Object.keys(e.headers).length>0)throw new Error("headers is unsupported");let t=new ht(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=us[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"),ue(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 dN(e){let t=new ht(e);t.append(`${e.name}=direct`);let n=us[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 pN(e){let t=new ht(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=us[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&&G.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"),ue(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 gN(e){let t=new ht(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=us[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"),ue(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 mN(e){let t=new ht(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"),ue(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let n=us[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"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(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"),ue(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 vN(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 ht(e);t.append(`# > WireGuard Proxy ${e.name} # ${e.name}=wireguard`),e["section-name"]=rr(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=us[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"),ue(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,a=e["preshared-key"]??e["pre-shared-key"],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":a};return t.append(` peer = (${Object.keys(s).filter(u=>s[u]!=null).map(u=>`${u} = ${s[u]}`).join(", ")})`),t.toString()}function EN(e){let t=new ht(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=us[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"),ue(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 wN(e){if(e.obfs||e["obfs-password"])throw new Error("obfs is unsupported");let t=new ht(e);t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),ue(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let r=us[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"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(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"),ue(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 g_(e,t,r){if(ue(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ue(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ue(t,"ws-opts.headers"))){let n=t["ws-opts"].headers,i=Object.keys(n).map(a=>{let s=n[a];return s=`"${s}"`,`${a}:${s}`}).join("|");ea(i)&&e.append(`,ws-headers=${i}`)}}else if(r&&["http"].includes(t.network))G.info(`Include Unsupported Proxy: nework ${t.network} -> tcp`);else throw new Error(`network ${t.network} is unsupported`)}var AN={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"};function ji(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&s.version>=4||["juicity"].includes(s.type)||["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)||["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"])?!1:!["xhttp"].includes(s.network)).map(s=>{if(s.type==="vmess"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5)):s.type==="hysteria"?(ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(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"?ue(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"&&ue(s,"shadow-tls-password")&&!ue(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 u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let c=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(c)&&(s["http-opts"].headers.Host=[c])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let c=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(c)&&(s["h2-opts"].headers.host=[c])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let c=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",g=""]=c.exec(u);s[`${s.network}-opts`].path=d,g!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(g,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(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"],ue(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 u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];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"]=AN[s["ip-version"]]||s["ip-version"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var m_="SurgeMac",yN=cl();function Om(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return v_(t);default:try{return yN.produce(t,r,n)}catch{if(n.useMihomoExternal)return G.log(`${t.name} is not supported on ${m_}, try to use Mihomo(SurgeMac - External Proxy Program) instead`),bN(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 v_(e){let t=new ht(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"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(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 bN(e,t,r){let n=ji().produce([e],"internal")?.[0];if(n){let i=r?.localPort||e._localPort||65535,a=!["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",Dt.encode(JSON.stringify({"mixed-port":i,ipv6:a,mode:"global",dns:{enable:!0,ipv6:a,"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 CN(e.server)?s.addresses.push(e.server):G.log(`Platform ${m_}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),r.localPort=i-1,v_(s)}}function CN(e){return Ur(e)||Rr(e)}function Tm(){return{type:"ALL",produce:(r,n,i={})=>{let a=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"]?(G.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"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(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"&&ue(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let c=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(c)&&(s["http-opts"].headers.Host=[c])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let c=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(c)&&(s["h2-opts"].headers.host=[c])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let c=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",g=""]=c.exec(u);s[`${s.network}-opts`].path=d,g!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(g,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(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"],ue(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 u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];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"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}function Nd(){return{type:"ALL",produce:(r,n,i={})=>{let a=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"]?(G.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"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","aes-128-gcm","chacha20-poly1305","none"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ue(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5)):s.type==="hysteria"?(ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ue(s,"down")&&!ue(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ue(s,"up")&&!ue(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ue(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ue(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="hysteria2"?(ue(s,"password")&&!ue(s,"auth")&&(s.auth=s.password,delete s.password),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ue(s,"down")&&!ue(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ue(s,"up")&&!ue(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ue(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ue(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"&&ue(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let c=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(c)&&(s["http-opts"].headers.Host=[c])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let c=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(c)&&(s["h2-opts"].headers.host=[c])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let c=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",g=""]=c.exec(u);s[`${s.network}-opts`].path=d,g!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(g,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(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"],ue(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 u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];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"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var _N="Loon",lu={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function km(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return DN(t);case"ssr":return FN(t);case"trojan":return SN(t);case"vmess":return IN(t,n["include-unsupported-proxy"]);case"vless":return BN(t,n["include-unsupported-proxy"]);case"http":return $N(t);case"socks5":return RN(t);case"wireguard":return xN(t);case"hysteria2":return PN(t)}throw new Error(`Platform ${_N} does not support proxy type: ${t.type}`)}}}function DN(e){let t=new ht(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}"`),ue(e,"plugin")){if(e.plugin==="obfs"){if(e["plugin-opts"]?.mode&&e.cipher.startsWith("2022-"))throw new Error(`${e.cipher} ${e.plugin} is not supported`);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(ue(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,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}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=lu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function FN(e){let t=new ht(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"),ue(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,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}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=lu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function SN(e){let t=new ht(e);if(t.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,ue(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=lu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function IN(e){let t=!!e["reality-opts"],r=new ht(e);if(r.append(`${e.name}=vmess,${e.server},${e.port},${e.cipher},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ue(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,a=e["http-opts"]?.headers?.Host;r.appendIfPresent(`,path=${Array.isArray(i)?i[0]:i}`,"http-opts.path"),r.appendIfPresent(`,host=${Array.isArray(a)?a[0]:a}`,"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")),ue(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=lu[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${n}`,"ip-version"),r.toString()}function BN(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 ht(e);if(n.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ue(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 a=e["http-opts"]?.path,s=e["http-opts"]?.headers?.Host;n.appendIfPresent(`,path=${Array.isArray(a)?a[0]:a}`,"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=lu[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${i}`,"ip-version"),n.toString()}function $N(e){let t=new ht(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=lu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function RN(e){let t=new ht(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=lu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function xN(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 ht(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(u=>Rr(u));let s=e.dns.find(u=>Ur(u));s||(s=e.dns.find(u=>!Ur(u)&&!Rr(u))),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 a=lu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${a}`,"ip-version"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),t.toString()}function PN(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new ht(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=lu[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}var EX=Zr(i3());function s3(e){let t="none",r=e["reality-opts"],n="",i="",a="";if(r){t="reality";let _=e["reality-opts"]?.["public-key"];_&&(i=`&pbk=${encodeURIComponent(_)}`);let F=e["reality-opts"]?.["short-id"];F&&(n=`&sid=${encodeURIComponent(F)}`);let L=e["reality-opts"]?.["_spider-x"];L&&(a=`&spx=${encodeURIComponent(L)}`)}else e.tls&&(t="tls");let s="";e.alpn&&(s=`&alpn=${encodeURIComponent(Array.isArray(e.alpn)?e.alpn:e.alpn.join(","))}`);let u="";e["skip-cert-verify"]&&(u="&allowInsecure=1");let c="";e.sni&&(c=`&sni=${encodeURIComponent(e.sni)}`);let f="";e["client-fingerprint"]&&(f=`&fp=${encodeURIComponent(e["client-fingerprint"])}`);let d="";e.flow&&(d=`&flow=${encodeURIComponent(e.flow)}`);let g="";e._extra&&(g=`&extra=${encodeURIComponent(e._extra)}`);let p="";e._mode&&(p=`&mode=${encodeURIComponent(e._mode)}`);let h="";e._pqv&&(h=`&pqv=${encodeURIComponent(e._pqv)}`);let E="";e.encryption&&(E=`&encryption=${encodeURIComponent(e.encryption)}`);let v=e.network;e.network==="ws"&&e["ws-opts"]?.["v2ray-http-upgrade"]&&(v="httpupgrade");let b=`&type=${encodeURIComponent(v)}`;if(["grpc"].includes(e.network)){b+=`&mode=${encodeURIComponent(e[`${e.network}-opts`]?.["_grpc-type"]||"gun")}`;let _=e[`${e.network}-opts`]?.["_grpc-authority"];_&&(b+=`&authority=${encodeURIComponent(_)}`)}let m=e[`${e.network}-opts`]?.[`${e.network}-service-name`],y=e[`${e.network}-opts`]?.path,D=e[`${e.network}-opts`]?.headers?.Host;return y&&(b+=`&path=${encodeURIComponent(Array.isArray(y)?y[0]:y)}`),D&&(b+=`&host=${encodeURIComponent(Array.isArray(D)?D[0]:D)}`),m&&(b+=`&serviceName=${encodeURIComponent(m)}`),e.network==="kcp"&&(e.seed&&(b+=`&seed=${encodeURIComponent(e.seed)}`),e.headerType&&(b+=`&headerType=${encodeURIComponent(e.headerType)}`)),`vless://${e.uuid}@${e.server}:${e.port}?security=${encodeURIComponent(t)}${b}${s}${u}${c}${f}${d}${n}${a}${i}${p}${g}${h}${E}#${encodeURIComponent(e.name)}`}function Tl(){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(Dt.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)}`:Dt.encode(i)}@${r.server}:${r.port}${r.plugin?"/":""}`,r.plugin){n+="?plugin=";let x=r["plugin-opts"];switch(r.plugin){case"obfs":n+=encodeURIComponent(`simple-obfs;obfs=${x.mode}${x.host?";obfs-host="+x.host:""}`);break;case"v2ray-plugin":n+=encodeURIComponent(`v2ray-plugin;obfs=${x.mode}${x.host?";obfs-host"+x.host:""}${x.tls?";tls":""}`);break;case"shadow-tls":n+=encodeURIComponent(`shadow-tls;host=${x.host};password=${x.password};version=${x.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}:${Dt.encode(r.password)}/`,n+=`?remarks=${Dt.encode(r.name)}${r["obfs-param"]?"&obfsparam="+Dt.encode(r["obfs-param"]):""}${r["protocol-param"]?"&protocolparam="+Dt.encode(r["protocol-param"]):""}`,n="ssr://"+Dt.encode(n);break;case"vmess":let a="",s=r.network||"tcp";if(r.network==="http"?(s="tcp",a="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:a,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 x=r[`${r.network}-opts`]?.path,U=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`]):(x&&(n.path=Array.isArray(x)?x[0]:x),U&&(n.host=Array.isArray(U)?U[0]:U))}n="vmess://"+Dt.encode(JSON.stringify(n));break;case"vless":n=s3(r);break;case"trojan":let u="";if(r.network){let x=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(x="httpupgrade"),u=`&type=${encodeURIComponent(x)}`,["grpc"].includes(r.network)){let H=r[`${r.network}-opts`]?.[`${r.network}-service-name`],K=r[`${r.network}-opts`]?.["_grpc-authority"];H&&(u+=`&serviceName=${encodeURIComponent(H)}`),K&&(u+=`&authority=${encodeURIComponent(K)}`),u+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let U=r[`${r.network}-opts`]?.path,Y=r[`${r.network}-opts`]?.headers?.Host;U&&(u+=`&path=${encodeURIComponent(Array.isArray(U)?U[0]:U)}`),Y&&(u+=`&host=${encodeURIComponent(Array.isArray(Y)?Y[0]:Y)}`)}let c="";r["client-fingerprint"]&&(c=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let f="";r.alpn&&(f=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let d=r["reality-opts"],g="",p="",h="",E="",v="",b="";if(d){E="&security=reality";let x=r["reality-opts"]?.["public-key"];x&&(p=`&pbk=${encodeURIComponent(x)}`);let U=r["reality-opts"]?.["short-id"];U&&(g=`&sid=${encodeURIComponent(U)}`);let Y=r["reality-opts"]?.["_spider-x"];Y&&(h=`&spx=${encodeURIComponent(Y)}`),r._extra&&(b=`&extra=${encodeURIComponent(r._extra)}`),r._mode&&(v=`&mode=${encodeURIComponent(r._mode)}`)}n=`trojan://${r.password}@${r.server}:${r.port}?sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}${u}${f}${c}${E}${g}${p}${h}${v}${b}#${encodeURIComponent(r.name)}`;break;case"hysteria2":let m=[];r["hop-interval"]&&m.push(`hop-interval=${r["hop-interval"]}`),r.keepalive&&m.push(`keepalive=${r.keepalive}`),r["skip-cert-verify"]&&m.push("insecure=1"),r.obfs&&(m.push(`obfs=${encodeURIComponent(r.obfs)}`),r["obfs-password"]&&m.push(`obfs-password=${encodeURIComponent(r["obfs-password"])}`)),r.sni&&m.push(`sni=${encodeURIComponent(r.sni)}`),r.ports&&m.push(`mport=${r.ports}`),r["tls-fingerprint"]&&m.push(`pinSHA256=${encodeURIComponent(r["tls-fingerprint"])}`),r.tfo&&m.push("fastopen=1"),n=`hysteria2://${encodeURIComponent(r.password)}@${r.server}:${r.port}?${m.join("&")}#${encodeURIComponent(r.name)}`;break;case"hysteria":let y=[];Object.keys(r).forEach(x=>{if(!["name","type","server","port"].includes(x)){let U=x.replace(/-/,"_");["alpn"].includes(x)?r[x]&&y.push(`${U}=${encodeURIComponent(Array.isArray(r[x])?r[x][0]:r[x])}`):["skip-cert-verify"].includes(x)?r[x]&&y.push("insecure=1"):["tfo","fast-open"].includes(x)?r[x]&&!y.includes("fastopen=1")&&y.push("fastopen=1"):["ports"].includes(x)?y.push(`mport=${r[x]}`):["auth-str"].includes(x)?y.push(`auth=${r[x]}`):["up"].includes(x)?y.push(`upmbps=${r[x]}`):["down"].includes(x)?y.push(`downmbps=${r[x]}`):["_obfs"].includes(x)?y.push(`obfs=${r[x]}`):["obfs"].includes(x)?y.push(`obfsParam=${r[x]}`):["sni"].includes(x)?y.push(`peer=${r[x]}`):r[x]&&!/^_/i.test(x)&&y.push(`${U}=${encodeURIComponent(r[x])}`)}}),n=`hysteria://${r.server}:${r.port}?${y.join("&")}#${encodeURIComponent(r.name)}`;break;case"tuic":if(!r.token||r.token.length===0){let x=[];Object.keys(r).forEach(U=>{if(!["name","type","uuid","password","server","port","tls"].includes(U)){let Y=U.replace(/-/,"_");["alpn"].includes(U)?r[U]&&x.push(`${Y}=${encodeURIComponent(Array.isArray(r[U])?r[U][0]:r[U])}`):["skip-cert-verify"].includes(U)?r[U]&&x.push("allow_insecure=1"):["tfo","fast-open"].includes(U)?r[U]&&!x.includes("fast_open=1")&&x.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(U)&&r[U]?x.push(`${Y.replace(/-/g,"_")}=1`):["congestion-controller"].includes(U)?x.push(`congestion_control=${r[U]}`):r[U]&&!/^_/i.test(U)&&x.push(`${Y.replace(/-/g,"_")}=${encodeURIComponent(r[U])}`)}}),n=`tuic://${encodeURIComponent(r.uuid)}:${encodeURIComponent(r.password)}@${r.server}:${r.port}?${x.join("&")}#${encodeURIComponent(r.name)}`}break;case"anytls":n=s3({...r,uuid:r.password,network:r.network||"tcp"}).replace("vless","anytls");let D=[];Object.keys(r).forEach(x=>{if(!["name","type","password","server","port","tls"].includes(x)){let U=x.replace(/-/,"_");["alpn"].includes(x)?r[x]&&D.push(`${U}=${encodeURIComponent(Array.isArray(r[x])?r[x][0]:r[x])}`):["skip-cert-verify"].includes(x)?r[x]&&D.push("insecure=1"):["udp"].includes(x)?r[x]&&D.push("udp=1"):r[x]&&!/^_|client-fingerprint/i.test(x)&&["number","string","boolean"].includes(typeof r[x])&&D.push(`${U.replace(/-/g,"_")}=${encodeURIComponent(r[x])}`)}});let _=n.split("?"),F=_[0],L={};_.length>1&&_[1].split("#")[0].split("&").forEach(Y=>{let[H,K]=Y.split("=");H&&(L[H]=K)}),D.forEach(x=>{let[U,Y]=x.split("=");U&&(L[U]=Y)});let k=Object.keys(L).map(x=>`${x}=${L[x]}`).join("&"),S=n.match(/#(.*)$/),B=S?`#${S[1]}`:"";n=`${F}?${k}${B}`;break;case"wireguard":let O=[];Object.keys(r).forEach(x=>{["name","type","server","port","ip","ipv6","private-key"].includes(x)||(["public-key"].includes(x)?O.push(`publickey=${r[x]}`):["udp"].includes(x)?r[x]&&O.push(`${x}=1`):r[x]&&!/^_/i.test(x)&&O.push(`${x}=${encodeURIComponent(r[x])}`))}),r.ip&&r.ipv6?O.push(`address=${r.ip}/32,${r.ipv6}/128`):r.ip?O.push(`address=${r.ip}/32`):r.ipv6&&O.push(`address=${r.ipv6}/128`),n=`wireguard://${encodeURIComponent(r["private-key"])}@${r.server}:${r.port}/?${O.join("&")}#${encodeURIComponent(r.name)}`;break}return n}}}var XM=Tl();function yh(){return{type:"ALL",produce:r=>{let n=[];return r.map(i=>{try{n.push(XM.produce(i))}catch(a){G.error(`Cannot produce proxy: ${JSON.stringify(i,null,2)} Reason: ${a}`)}}),Dt.encode(n.join(` `))}}}var JM="QX";function bh(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return ZM(t);case"ssr":return QM(t);case"trojan":return eq(t);case"vmess":return tq(t);case"http":return nq(t);case"socks5":return iq(t);case"vless":return rq(t)}throw new Error(`Platform ${JM} does not support proxy type: ${t.type}`)}}}function ZM(e){let t=new ht(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}`),qi(e)&&(e.tls=!0),ue(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 qi(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 QM(e){let t=new ht(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 eq(e){let t=new ht(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`trojan=${e.server}:${e.port}`),r(`,password=${e.password}`),ue(e,"network"))if(e.network==="ws")qi(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"&&qi(e)&&r(",over-tls=true"),qi(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 tq(e){let t=new ht(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}`),qi(e)&&(e.tls=!0),ue(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 a=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(a)?a[0]:a}`,`${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 qi(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")),ue(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 rq(e){if(typeof e.flow<"u"||e["reality-opts"])throw new Error("VLESS XTLS/REALITY is not supported");let t=new ht(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}`),qi(e)&&(e.tls=!0),ue(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 a=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(a)?a[0]:a}`,`${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 qi(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 nq(e){let t=new ht(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"),qi(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),qi(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 iq(e){let t=new ht(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"),qi(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),qi(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 qi(e){return e.tls}function Ch(){return{type:"ALL",produce:(r,n,i={})=>{let a=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")ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto");else if(s.type==="tuic")ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5);else if(s.type==="hysteria")ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo);else if(s.type==="hysteria2")ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo);else if(s.type==="wireguard")s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"];else if(s.type==="snell"&&s.version<3)delete s.udp;else if(s.type==="vless")ue(s,"sni")&&(s.servername=s.sni,delete s.sni);else if(s.type==="ss")ue(s,"shadow-tls-password")&&!ue(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"]);else{if(["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"]))return!1;if(["xhttp"].includes(s.network))return!1}if(["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let c=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(c)&&(s["http-opts"].headers.Host=[c])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let c=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(c)&&(s["h2-opts"].headers.host=[c])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let c=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",g=""]=c.exec(u);s[`${s.network}-opts`].path=d,g!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(g,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(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"],ue(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 u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];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"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var sq="Surfboard";function bp(){return{produce:t=>{switch(t.name=t.name.replace(/=|,/g,""),t.type){case"ss":return aq(t);case"trojan":return uq(t);case"vmess":return oq(t);case"http":return cq(t);case"socks5":return lq(t);case"wireguard-surge":return fq(t)}throw new Error(`Platform ${sq} does not support proxy type: ${t.type}`)}}}function aq(e){let t=new ht(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"),ue(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 uq(e){let t=new ht(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),a3(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 oq(e){let t=new ht(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,username=${e.uuid}`,"uuid"),a3(t,e),ue(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 cq(e){let t=new ht(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 lq(e){let t=new ht(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 fq(e){let t=new ht(e);return t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.toString()}function a3(e,t){if(ue(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ue(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ue(t,"ws-opts.headers"))){let r=t["ws-opts"].headers,n=Object.keys(r).map(i=>{let a=r[i];return["Host"].includes(i)&&(a=`"${a}"`),`${i}:${a}`}).join("|");ea(n)&&e.append(`,ws-headers=${n}`)}}else throw new Error(`network ${t.network} is unsupported`)}var hq={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"},bi=(e,t)=>{let r=hq[e["ip-version"]];e._dns_server&&r&&(t.domain_resolver={server:e._dns_server,strategy:r})},Ci=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},ba=(e,t)=>{["tcp","udp"].includes(e._network)&&(t.network=e._network)},Vi=(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},Ca=(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))))},I2=(e,t)=>{let r={type:"ws",headers:{}};if(e["ws-opts"]){let{path:n="",headers:i={},"max-early-data":a,"early-data-header-name":s}=e["ws-opts"];if(r.early_data_header_name=s,r.max_early_data=a?parseInt(a,10):void 0,n!==""&&(r.path=`${n}`),Object.keys(i).length>0){let u={};for(let f of Object.keys(i)){let d=i[f];d!==""&&(Array.isArray(d)||(d=[`${d}`]),d.length>0&&(u[f]=d))}let{Host:c}=u;if(c.length===1)for(let f of`Host:${c[0]}`.split(` `)){let[d,g]=f.split(":");g.trim()!==""&&(u[d.trim()]=g.trim().split(","))}r.headers=u}}if(e["ws-headers"]){let n={};for(let a of Object.keys(e["ws-headers"])){let s=e["ws-headers"][a];s!==""&&(Array.isArray(s)||(s=[`${s}`]),s.length>0&&(n[a]=s))}let{Host:i}=n;if(i.length===1)for(let a of`Host:${i[0]}`.split(` `)){let[s,u]=a.split(":");u.trim()!==""&&(n[s.trim()]=u.trim().split(","))}for(let a of Object.keys(n))r.headers[a]=n[a]}if(e["ws-path"]&&e["ws-path"]!==""&&(r.path=`${e["ws-path"]}`),r.path){let n=/^(.*?)(?:\?ed=(\d+))?$/,[i,a="",s=""]=n.exec(r.path);r.path=a,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},u3=(e,t)=>{let r={type:"http",headers:{}};if(e["http-opts"]){let{method:n="",path:i="",headers:a={}}=e["http-opts"];n!==""&&(r.method=n),Array.isArray(i)?r.path=`${i[0]}`:i!==""&&(r.path=`${i}`);for(let s of Object.keys(a)){let u=a[s];if(u!==""){if(s.toLowerCase()==="host"){let c=u;Array.isArray(c)||(c=`${c}`.split(",").map(f=>f.trim())),c.length>0&&(r.host=c);continue}Array.isArray(u)||(u=`${u}`.split(",").map(c=>c.trim())),u.length>0&&(r.headers[s]=u)}}}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},o3=(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(a=>a.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},B2=(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},eo=(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"]}),e._fragment&&(t.tls.fragment=!!e._fragment),e._fragment_fallback_delay&&(t.tls.fragment_fallback_delay=e._fragment_fallback_delay),e._record_fragment&&(t.tls.record_fragment=!!e._record_fragment),t.tls.enabled||delete t.tls},dq=(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),Vi(e,t),Ci(e,t),bi(e,t),t},pq=(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),Vi(e,t),Ci(e,t),eo(e,t),bi(e,t),t},gq=(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),ba(e,t),Vi(e,t),Ci(e,t),bi(e,t),t},mq=(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),Vi(e,r),Ci(e,r),Ca(e.smux,t),bi(e,r),{type:"ss-with-st",ssPart:t,stPart:r}},vq=(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),ba(e,t),Vi(e,t),Ci(e,t),Ca(e.smux,t),bi(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},Eq=(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),Vi(e,t),Ci(e,t),Ca(e.smux,t),bi(e,t),t},wq=(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"&&I2(e,t),e.network==="h2"&&o3(e,t),e.network==="http"&&u3(e,t),e.network==="grpc"&&B2(e,t),ba(e,t),Vi(e,t),Ci(e,t),eo(e,t),Ca(e.smux,t),bi(e,t),t},Aq=(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"&&I2(e,t),e.network==="h2"&&o3(e,t),e.network==="http"&&u3(e,t),e.network==="grpc"&&B2(e,t),ba(e,t),Vi(e,t),Ci(e,t),Ca(e.smux,t),eo(e,t),bi(e,t),t},yq=(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"&&B2(e,t),e.network==="ws"&&I2(e,t),ba(e,t),Vi(e,t),Ci(e,t),eo(e,t),Ca(e.smux,t),bi(e,t),t},bq=(e={})=>{let t={tag:e.name,type:"hysteria",server:e.server,server_port:parseInt(`${e.port}`,10),disable_mtu_discovery:!1,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(n=>{let i=n.replace(/\s*-\s*/g,":");return i.includes(":")?i:`${i}:${i}`})),e.auth_str&&(t.auth_str=`${e.auth_str}`),e["auth-str"]&&(t.auth_str=`${e["auth-str"]}`),e["fast-open"]&&(t.udp_fragment=!0);let 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)),ba(e,t),eo(e,t),Ci(e,t),Vi(e,t),Ca(e.smux,t),bi(e,t),t},Cq=(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=>{let n=r.replace(/\s*-\s*/g,":");return n.includes(":")?n:`${n}:${n}`})),e.up&&(t.up_mbps=parseInt(`${e.up}`,10)),e.down&&(t.down_mbps=parseInt(`${e.down}`,10)),e.obfs==="salamander"&&(t.obfs.type="salamander"),e["obfs-password"]&&(t.obfs.password=e["obfs-password"]),t.obfs.type||delete t.obfs,ba(e,t),eo(e,t),Vi(e,t),Ci(e,t),Ca(e.smux,t),bi(e,t),t},_q=(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`),ba(e,t),Vi(e,t),Ci(e,t),eo(e,t),Ca(e.smux,t),bi(e,t),t},Dq=(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)),ba(e,t),Ci(e,t),eo(e,t),bi(e,t),t},Fq=(e={})=>{let t=["ip","ipv6"].map(n=>e[n]).map(n=>{if(Ur(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 a of n.reserved)i.reserved.push(a);else delete i.reserved;n["pre-shared-key"]&&(i.pre_shared_key=n["pre-shared-key"]),r.peers.push(i)}}return ba(e,r),Vi(e,r),Ci(e,r),Ca(e.smux,r),bi(e,r),r};function Cp(){return{type:"ALL",produce:(r,n,i={})=>{let a=[];return ji().produce(r,"internal",{"include-unsupported-proxy":!0}).map(s=>{try{switch(s.type){case"ssh":a.push(dq(s));break;case"http":a.push(pq(s));break;case"socks5":if(s.tls)throw new Error(`Platform sing-box does not support proxy type: ${s.type} with tls`);a.push(gq(s));break;case"ss":if(s.plugin==="shadow-tls"){let{ssPart:u,stPart:c}=mq(s);a.push(u),a.push(c)}else a.push(vq(s));break;case"ssr":if(i["include-unsupported-proxy"])a.push(Eq(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))a.push(wq(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))a.push(Aq(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)a.push(yq(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with flow ${s.flow}`);break;case"hysteria":a.push(bq(s));break;case"hysteria2":a.push(Cq(s,i["include-unsupported-proxy"]));break;case"tuic":if(!s.token||s.token.length===0)a.push(_q(s));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":a.push(Fq(s));break;case"anytls":a.push(Dq(s));break;default:throw new Error(`Platform sing-box does not support proxy type: ${s.type}`)}}catch(u){G.error(u.message??u)}}),n==="internal"?a:JSON.stringify({outbounds:a},null,2)}}}function _p(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>!(!["http","socks5","ss","trojan","hysteria2","vless","vmess","tuic"].includes(s.type)||s.type==="ss"&&(s.plugin==="obfs"&&!["http","tls"].includes(s["plugin-opts"]?.mode)||!["chacha20-ietf-poly1305","chacha20-poly1305","aes-256-gcm","aes-128-gcm","none","tbale","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(s.cipher))||s.type==="vmess"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="trojan"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="vless"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="tuic"&&s.token&&s.token.length!==0)).map(s=>{let u={...s},c;s.tls&&!s.sni&&(s.sni=s.server);let f=s.prev_hop||s["underlying-proxy"]||s["dialer-proxy"]||s.detour;if(s.type==="http")s={type:"http",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,tfo:s.tfo||s["fast-open"],next_hop:s.next_hop};else if(s.type==="socks5")s={type:"socks5",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop};else if(s.type==="ss")s={type:"shadowsocks",name:s.name,method:s.cipher==="chacha20-ietf-poly1305"?"chacha20-poly1305":s.cipher,server:s.server,port:s.port,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop},u.plugin==="obfs"&&(s.obfs=u["plugin-opts"].mode,s.obfs_host=u["plugin-opts"].host,s.obfs_uri=u["plugin-opts"].path);else if(s.type==="hysteria2")s={type:"hysteria2",name:s.name,server:s.server,port:s.port,auth:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,sni:s.sni,skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]},u["obfs-password"]&&u.obfs=="salamander"&&(s.obfs="salamander",s.obfs_password=u["obfs-password"]);else if(s.type==="tuic")s={type:"tuic",name:s.name,server:s.server,port:s.port,uuid:s.uuid,password:s.password,next_hop:s.next_hop,sni:s.sni,alpn:Array.isArray(s.alpn)?s.alpn:[s.alpn||"h3"],skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]};else if(s.type==="trojan")s.network==="ws"&&(s.websocket={path:s["ws-opts"]?.path,host:s["ws-opts"]?.headers?.Host}),s={type:"trojan",name:s.name,server:s.server,port:s.port,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,sni:s.sni,skip_tls_verify:s["skip-cert-verify"],websocket:s.websocket};else if(s.type==="vmess"){let d=s.cipher;d&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(d)&&(d="auto"),s.network==="ws"?s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}}:s.network==="http"?s.transport={http1:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:s.network==="h2"?s.transport={http2:{method:s["h2-opts"]?.method,path:Array.isArray(s["h2-opts"]?.path)?s["h2-opts"]?.path[0]:s["h2-opts"]?.path,headers:{Host:Array.isArray(s["h2-opts"]?.headers?.Host)?s["h2-opts"]?.headers?.Host[0]:s["h2-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:(s.network==="tcp"||!s.network)&&s.tls&&(s.transport={tls:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}});let g;(ue(s,"aead")&&!s.aead||s.alterId!==0)&&(g=!0),s={type:"vmess",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:d,tfo:s.tfo||s["fast-open"],legacy:g,udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,transport:s.transport}}else if(s.type==="vless"){if(s.network==="ws")s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}};else if(s.network==="http")s.transport={http:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}};else if(s.network==="tcp"||!s.network){let d;if((s["reality-opts"]?.["short-id"]||s["reality-opts"]?.["public-key"])&&(d={short_id:s["reality-opts"]["short-id"],public_key:s["reality-opts"]["public-key"]}),s.transport={[s.tls?"tls":"tcp"]:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0,reality:d}},typeof s.flow<"u"&&!["xtls-rprx-vision"].includes(s.flow))throw new Error(`VLESS flow(${s.flow}) is not supported`);c=s.flow}s={type:"vless",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:s.cipher,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,transport:s.transport,flow:c}}if(["http","socks5","ss","trojan","vless","vmess"].includes(u.type)){if(ue(u,"shadow-tls-password")){if(u["shadow-tls-version"]!=3)throw new Error(`shadow-tls version ${u["shadow-tls-version"]} is not supported`);s.shadow_tls={password:u["shadow-tls-password"],sni:u["shadow-tls-sni"]}}else if(["shadow-tls"].includes(u.plugin)&&u["plugin-opts"]){if(u["plugin-opts"].version!=3)throw new Error(`shadow-tls version ${u["plugin-opts"].version} is not supported`);s.shadow_tls={password:u["plugin-opts"].password,sni:u["plugin-opts"].host}}}if(["ss"].includes(u.type)&&s.shadow_tls&&u["udp-port"]>0&&u["udp-port"]<=65535&&(s.udp_port=u["udp-port"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],s.transport){for(let d in s.transport)(Object.keys(s.transport[d]).length===0||Object.values(s.transport[d]).every(g=>g==null))&&delete s.transport[d];Object.keys(s.transport).length===0&&delete s.transport}if(n!=="internal")for(let d in s)(s[d]==null||/^_/i.test(d))&&delete s[d];return{[s.type]:{...s,type:void 0,prev_hop:f}}});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}function c3(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var Dp={qx:bh(),QX:bh(),QuantumultX:bh(),surge:cl(),Surge:cl(),SurgeMac:Om(),Loon:km(),Clash:Tm(),meta:ji(),clashmeta:ji(),"clash.meta":ji(),"Clash.Meta":ji(),ClashMeta:ji(),mihomo:ji(),Mihomo:ji(),uri:Tl(),URI:Tl(),v2:yh(),v2ray:yh(),V2Ray:yh(),json:c3(),JSON:c3(),stash:Nd(),Stash:Nd(),shadowrocket:Ch(),Shadowrocket:Ch(),ShadowRocket:Ch(),surfboard:bp(),Surfboard:bp(),singbox:Cp(),"sing-box":Cp(),egern:_p(),Egern:_p()};var g5=Zr($h()),TV=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 [^=,]+ `,W2;function zi(){return W2||(W2=g5.generate(TV)),W2}var m5=Zr($h()),kV=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 [^=,]+ `,X2;function _a(){return X2||(X2=m5.generate(kV)),X2}var v5=Zr($h()),NV=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" } `,J2;function wu(){return J2||(J2=v5.generate(NV)),J2}var E5=Zr($h()),LV=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); } `,Z2;function Q2(){return Z2||(Z2=E5.generate(LV)),Z2}var nE=Zr(rE());function w5(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 UV(){return{name:"URI PROXY Parser",test:n=>/^(socks5\+tls|socks5|http|https):\/\//.test(n),parse:n=>{let[i,a,s,u,c,f,d,g,p]=n.match(/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?\/?(\?.*?)?(?:#(.*?))?$/);if(d)d=parseInt(d,10);else{if(s)d=443;else if(a==="http")d=80;else throw G.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);G.info(`port is not present in line: ${n}, set to ${d}`)}return{name:p!=null?decodeURIComponent(p):`${a} ${f}:${d}`,type:a,tls:!!s,server:f,port:d,username:u!=null?decodeURIComponent(u):void 0,password:c!=null?decodeURIComponent(c):void 0}}}}function jV(){return{name:"URI SOCKS Parser",test:n=>/^socks:\/\//.test(n),parse:n=>{let[i,a,s,u,c,f,d]=n.match(/^(socks)?:\/\/(?:(.*)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(c)c=parseInt(c,10);else throw G.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);let g,p;if(s){let E=Dt.decode(decodeURIComponent(s)).split(":");g=E[0],p=E[1]}return{name:d!=null?decodeURIComponent(d):`${a} ${u}:${c}`,type:"socks5",server:u,port:c,username:g,password:p}}}}function HV(){return{name:"URI SS Parser",test:n=>/^ss:\/\//.test(n),parse:n=>{let i=n.split("ss://")[1],a=n.split("#")[1],s={type:"ss"};i=i.split("#")[0];let u=i.match(/@([^/?]*)(\/|\?|$)/),c=decodeURIComponent(i.split("@")[0]),f;c?.startsWith("2022-blake3-")?f=c:f=Dt.decode(c);let d="";if(u)i.includes("?")&&(d=i.match(/(\?.*)$/)[1]);else{if(i.includes("?")){let b=i.match(/^(.*)(\?.*)$/);i=b[1],d=b[2]}if(i=Dt.decode(i),d){if(/(&|\?)v2ray-plugin=/.test(d)){let m=d.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];m&&(s.plugin="v2ray-plugin",s["plugin-opts"]=JSON.parse(Dt.decode(m)))}i=`${i}${d}`}f=i.match(/(^.*)@/)?.[1],u=i.match(/@([^/@]*)(\/|$)/)}let g=u[1],p=g.lastIndexOf(":");s.server=g.substring(0,p),s.port=`${g.substring(p+1)}`.match(/\d+/)?.[0];let h=f.match(/(^.*?):(.*$)/);s.cipher=h?.[1],s.password=h?.[2];let E=i.match(/[?&]plugin=([^&]+)/),v=i.match(/[?&]shadow-tls=([^&]+)/);if(E){let b=("plugin="+decodeURIComponent(E[1])).split(";"),m={};for(let y of b){let[D,_]=y.split("=");D&&(m[D]=_||!0)}switch(m.plugin){case"obfs-local":case"simple-obfs":s.plugin="obfs",s["plugin-opts"]={mode:m.obfs,host:rr(m["obfs-host"])};break;case"v2ray-plugin":s.plugin="v2ray-plugin",s["plugin-opts"]={mode:"websocket",host:rr(m["obfs-host"]),path:rr(m.path),tls:rl(m.tls)};break;case"shadow-tls":{s.plugin="shadow-tls";let y=rr(m.version);s["plugin-opts"]={host:rr(m.host),password:rr(m.password),version:y?parseInt(y,10):void 0};break}default:throw new Error(`Unsupported plugin option: ${m.plugin}`)}}if(v){let b=JSON.parse(Dt.decode(v[1])),m=rr(b.version),y=rr(b.address),D=rr(b.port);s.plugin="shadow-tls",s["plugin-opts"]={host:rr(b.host),password:rr(b.password),version:m?parseInt(m,10):void 0},y&&(s.server=y),D&&(s.port=parseInt(D,10))}return/(&|\?)uot=(1|true)/i.test(d)&&(s["udp-over-tcp"]=!0),/(&|\?)tfo=(1|true)/i.test(d)&&(s.tfo=!0),a!=null&&(a=decodeURIComponent(a)),s.name=a??`SS ${s.server}:${s.port}`,s}}}function MV(){return{name:"URI SSR Parser",test:n=>/^ssr:\/\//.test(n),parse:n=>{n=Dt.decode(n.split("ssr://")[1]);let i=n.indexOf(":origin");i===-1&&(i=n.indexOf(":auth_"));let a=n.substring(0,i),s=a.substring(0,a.lastIndexOf(":")),u=a.substring(a.lastIndexOf(":")+1),c=n.substring(i+1).split("/?")[0].split(":"),f={type:"ssr",server:s,port:u,protocol:c[0],cipher:c[1],obfs:c[2],password:Dt.decode(c[3])},d={};if(n=n.split("/?")[1].split("&"),n.length>1)for(let g of n){let[p,h]=g.split("=");h=h.trim(),h.length>0&&h!=="(null)"&&(d[p]=h)}return f={...f,name:d.remarks?Dt.decode(d.remarks):f.server,"protocol-param":rr(Dt.decode(d.protoparam||"").replace(/\s/g,"")),"obfs-param":rr(Dt.decode(d.obfsparam||"").replace(/\s/g,""))},f}}}function qV(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{n=n.split("vmess://")[1];let i=Dt.decode(n.replace(/\?.*?$/,""));if(/=\s*vmess/.test(i)){let a=i.split(",").map(c=>c.trim()),s={};for(let c of a)if(c.indexOf("=")!==-1){let[f,d]=c.split("=");s[f.trim()]=d.trim()}let u={name:a[0].split("=")[0].trim(),type:"vmess",server:a[1],port:a[2],cipher:rr(a[3],"auto"),uuid:a[4].match(/^"(.*)"$/)[1],tls:s.obfs==="wss",udp:rl(s["udp-relay"]),tfo:rl(s["fast-open"]),"skip-cert-verify":tl(s["tls-verification"])?!s["tls-verification"]:void 0};if(tl(s.obfs))if(s.obfs==="ws"||s.obfs==="wss"){u.network="ws",u["ws-opts"].path=(rr(s["obfs-path"])||'"/"').match(/^"(.*)"$/)[1];let c=s["obfs-header"];c&&c.indexOf("Host")!==-1&&(c=c.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),ea(c)&&(u["ws-opts"].headers={Host:c})}else throw new Error(`Unsupported obfs: ${s.obfs}`);return u}else{let a={};try{a=JSON.parse(i)}catch{let[g,p,h]=/(^[^?]+?)\/?\?(.*)$/.exec(n);i=Dt.decode(p);for(let D of h.split("&")){let[_,F]=D.split("="),L=F;L=decodeURIComponent(F),L.indexOf(",")===-1?a[_]=L:a[_]=L.split(",")}let[E,v,b,m,y]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(i);a.scy=v,a.id=b,a.port=y,a.add=m}let s=a.add,u=parseInt(rl(a.port),10),c={name:a.ps??a.remarks??a.remark??`VMess ${s}:${u}`,type:"vmess",server:s,port:u,cipher:["auto","aes-128-gcm","chacha20-poly1305","none"].includes(a.scy)?a.scy:"auto",uuid:a.id,alterId:parseInt(rl(a.aid??a.alterId,0),10),tls:["tls",!0,1,"1"].includes(a.tls),"skip-cert-verify":tl(a.verify_cert)?!a.verify_cert:void 0};!c["skip-cert-verify"]&&tl(a.allowInsecure)&&(c["skip-cert-verify"]=/(TRUE)|1/i.test(a.allowInsecure)),c.tls&&(a.sni&&a.sni!==""?c.sni=a.sni:a.peer&&a.peer!==""&&(c.sni=a.peer));let f=!1;if(a.net==="ws"||a.obfs==="websocket"?c.network="ws":["http"].includes(a.net)||["http"].includes(a.obfs)||["http"].includes(a.type)?c.network="http":["grpc","kcp","quic"].includes(a.net)?c.network=a.net:a.net==="httpupgrade"||c.network==="httpupgrade"?(c.network="ws",f=!0):(a.net==="h2"||c.network==="h2")&&(c.network="h2"),c.network){let d=a.host??a.obfsParam;try{let h=JSON.parse(d)?.Host;h&&(d=h)}catch{}let g=a.path;if(["ws"].includes(c.network)&&(g=g||"/"),c.network==="http"&&(d&&(d=d.split(",").map(p=>p.trim()),d=Array.isArray(d)?d[0]:d),g?g=Array.isArray(g)?g[0]:g:g="/"),g||d||["kcp","quic"].includes(c.network))if(["grpc"].includes(c.network))c[`${c.network}-opts`]={"grpc-service-name":rr(g),"_grpc-type":rr(a.type),"_grpc-authority":rr(a.authority)};else if(["kcp","quic"].includes(c.network))c[`${c.network}-opts`]={[`_${c.network}-type`]:rr(a.type),[`_${c.network}-host`]:rr(rr(d)),[`_${c.network}-path`]:rr(g)};else{let p={path:rr(g),headers:{Host:rr(d)}};f&&(p["v2ray-http-upgrade"]=!0,p["v2ray-http-upgrade-fast-open"]=!0),c[`${c.network}-opts`]=p}else delete c.network}return c["client-fingerprint"]=a.fp,c.alpn=a.alpn?a.alpn.split(","):void 0,c}}}}function A5(){return{name:"URI VLESS Parser",test:n=>/^vless:\/\//.test(n),parse:n=>{n=n.split("vless://")[1];let i,a=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);if(!a){let[b,m,y]=/^(.*?)(\?.*?$)/.exec(n);n=`${Dt.decode(m)}${y}`,a=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),i=!0}let[s,u,c,f,d,g="",p]=a;i&&(u=u.replace(/^.*?:/g,"")),f=parseInt(`${f}`,10),u=decodeURIComponent(u),p!=null&&(p=decodeURIComponent(p));let h={type:"vless",name:p,server:c,port:f,uuid:u},E={};for(let b of g.split("&"))if(b){let[m,y]=b.split("="),D=y;D=decodeURIComponent(y),E[m]=D}if(h.name=p??E.remarks??E.remark??`VLESS ${c}:${f}`,h.tls=E.security&&E.security!=="none",i&&/TRUE|1/i.test(E.tls)&&(h.tls=!0,E.security=E.security??"reality"),h.sni=E.sni||E.peer,h.flow=E.flow,!h.flow&&i&&E.xtls){let b=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][E.xtls];b&&(h.flow=b)}if(h["client-fingerprint"]=E.fp,h.alpn=E.alpn?E.alpn.split(","):void 0,h["skip-cert-verify"]=/(TRUE)|1/i.test(E.allowInsecure),["reality"].includes(E.security)){let b={};E.pbk&&(b["public-key"]=E.pbk),E.sid&&(b["short-id"]=E.sid),E.spx&&(b["_spider-x"]=E.spx),Object.keys(b).length>0&&(h[`${E.security}-opts`]=b)}let v=!1;if(h.network=E.type,h.network==="tcp"&&E.headerType==="http"?h.network="http":h.network==="httpupgrade"&&(h.network="ws",v=!0),!h.network&&i&&E.obfs&&(h.network=E.obfs,["none"].includes(h.network)&&(h.network="tcp")),["websocket"].includes(h.network)&&(h.network="ws"),h.network&&!["tcp","none"].includes(h.network)){let b={},m=E.host??E.obfsParam;if(m)if(E.obfsParam)try{let y=JSON.parse(m);b.headers=y}catch{b.headers={Host:m}}else b.headers={Host:m};E.serviceName?(b[`${h.network}-service-name`]=E.serviceName,["grpc"].includes(h.network)&&E.authority&&(b["_grpc-authority"]=E.authority)):i&&E.path&&(["ws","http","h2"].includes(h.network)||(b[`${h.network}-service-name`]=E.path,delete E.path)),E.path&&(b.path=E.path),["grpc"].includes(h.network)&&(b["_grpc-type"]=E.mode||"gun"),v&&(b["v2ray-http-upgrade"]=!0,b["v2ray-http-upgrade-fast-open"]=!0),Object.keys(b).length>0&&(h[`${h.network}-opts`]=b),h.network==="kcp"&&(E.seed&&(h.seed=E.seed),h.headerType=E.headerType||"none"),E.mode&&(h._mode=E.mode),E.extra&&(h._extra=E.extra)}return E.encryption&&(h.encryption=E.encryption),E.pqv&&(h._pqv=E.pqv),h}}}function VV(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{let i=A5().parse(n.replace("anytls","vless"));n=n.split(/anytls:\/\//)[1];let[a,s,u,c,f="",d]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);s=decodeURIComponent(s),c=parseInt(`${c}`,10),isNaN(c)&&(c=443),s=decodeURIComponent(s),d!=null&&(d=decodeURIComponent(d)),d=d??`AnyTLS ${u}:${c}`;let g={...i,uuid:void 0,type:"anytls",name:d,server:u,port:c,password:s};for(let p of f.split("&"))if(p){let[h,E]=p.split("=");h=h.replace(/_/g,"-"),E=decodeURIComponent(E),["alpn"].includes(h)?g[h]=E?E.split(","):void 0:["insecure"].includes(h)?g["skip-cert-verify"]=/(TRUE)|1/i.test(E):["udp"].includes(h)?g[h]=/(TRUE)|1/i.test(E):Object.keys(g).includes(h)||(g[h]=E)}return["tcp"].includes(g.network)&&!g["reality-opts"]&&(delete g.network,delete g.security),g}}}function KV(){return{name:"URI Hysteria2 Parser",test:n=>/^(hysteria2|hy2):\/\//.test(n),parse:n=>{n=n.split(/(hysteria2|hy2):\/\//)[2];let i,[a,s,u,c,f,d,g,p,h,E,v="",b]=/^(.*?)@(.*?)(:((\d+(-\d+)?)([,;]\d+(-\d+)?)*))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);/^\d+$/.test(f)?(f=parseInt(`${f}`,10),isNaN(f)&&(f=443)):f?(i=f,f=If(i)):f=443,s=decodeURIComponent(s),b!=null&&(b=decodeURIComponent(b)),b=b??`Hysteria2 ${u}:${f}`;let m={type:"hysteria2",name:b,server:u,port:f,ports:i,password:s},y={};for(let F of v.split("&"))if(F){let[L,k]=F.split("="),S=k;S=decodeURIComponent(k),y[L]=S}m.sni=y.sni,!m.sni&&y.peer&&(m.sni=y.peer),y.obfs&&y.obfs!=="none"&&(m.obfs=y.obfs),y.mport&&(m.ports=y.mport),m["obfs-password"]=y["obfs-password"],m["skip-cert-verify"]=/(TRUE)|1/i.test(y.insecure),m.tfo=/(TRUE)|1/i.test(y.fastopen),m["tls-fingerprint"]=y.pinSHA256;let D=y["hop-interval"]||y.hop_interval;/^\d+$/.test(D)&&(m["hop-interval"]=parseInt(`${D}`,10));let _=y.keepalive;return/^\d+$/.test(_)&&(m.keepalive=parseInt(`${_}`,10)),m}}}function zV(){return{name:"URI Hysteria Parser",test:n=>/^(hysteria|hy):\/\//.test(n),parse:n=>{n=n.split(/(hysteria|hy):\/\//)[2];let[i,a,s,u,c,f="",d]=/^(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);u=parseInt(`${u}`,10),isNaN(u)&&(u=443),d!=null&&(d=decodeURIComponent(d)),d=d??`Hysteria ${a}:${u}`;let g={type:"hysteria",name:d,server:a,port:u},p={};for(let h of f.split("&"))if(h){let[E,v]=h.split("=");E=E.replace(/_/,"-"),v=decodeURIComponent(v),["alpn"].includes(E)?g[E]=v?v.split(","):void 0:["insecure"].includes(E)?g["skip-cert-verify"]=/(TRUE)|1/i.test(v):["auth"].includes(E)?g["auth-str"]=v:["mport"].includes(E)?g.ports=v:["obfsParam"].includes(E)?g.obfs=v:["upmbps"].includes(E)?g.up=v:["downmbps"].includes(E)?g.down=v:["obfs"].includes(E)?g._obfs=v||"":["fast-open","peer"].includes(E)?p[E]=v:Object.keys(g).includes(E)||(g[E]=v)}return!g.sni&&p.peer&&(g.sni=p.peer),!g["fast-open"]&&p.fastopen&&(g["fast-open"]=!0),g.protocol||(g.protocol="udp"),g}}}function GV(){return{name:"URI TUIC Parser",test:n=>/^tuic:\/\//.test(n),parse:n=>{n=n.split(/tuic:\/\//)[1];let[i,a,s,u,c="",f]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);a=decodeURIComponent(a);let[d,...g]=a.split(":"),p=g.join(":");u=parseInt(`${u}`,10),isNaN(u)&&(u=443),p=decodeURIComponent(p),f!=null&&(f=decodeURIComponent(f)),f=f??`TUIC ${s}:${u}`;let h={type:"tuic",name:f,server:s,port:u,password:p,uuid:d};for(let E of c.split("&"))if(E){let[v,b]=E.split("=");v=v.replace(/_/g,"-"),b=decodeURIComponent(b),["alpn"].includes(v)?h[v]=b?b.split(","):void 0:["allow-insecure","insecure"].includes(v)?h["skip-cert-verify"]=/(TRUE)|1/i.test(b):["fast-open"].includes(v)?h.tfo=!0:["disable-sni","reduce-rtt"].includes(v)?h[v]=/(TRUE)|1/i.test(b):v==="congestion-control"?(h["congestion-controller"]=b,delete h[v]):Object.keys(h).includes(v)||(h[v]=b)}return h}}}function YV(){return{name:"URI WireGuard Parser",test:n=>/^(wireguard|wg):\/\//.test(n),parse:n=>{n=n.split(/(wireguard|wg):\/\//)[2];let[i,a,s,u,c,f,d,g="",p]=/^((.*?)@)?(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);f=parseInt(`${f}`,10),isNaN(f)&&(f=51820),s=decodeURIComponent(s),p!=null&&(p=decodeURIComponent(p)),p=p??`WireGuard ${u}:${f}`;let h={type:"wireguard",name:p,server:u,port:f,"private-key":s,udp:!0};for(let E of g.split("&"))if(E){let[v,b]=E.split("=");if(v=v.replace(/_/,"-"),b=decodeURIComponent(b),["reserved"].includes(v)){let m=b.split(",").map(y=>parseInt(y.trim(),10)).filter(y=>Number.isInteger(y));m.length===3&&(h[v]=m)}else if(["address","ip"].includes(v))b.split(",").map(m=>{let y=m.trim().replace(/\/\d+$/,"").replace(/^\[/,"").replace(/\]$/,"");Ur(y)?h.ip=y:Rr(y)&&(h.ipv6=y)});else if(["mtu"].includes(v)){let m=parseInt(b.trim(),10);Number.isInteger(m)&&(h[v]=m)}else/publickey/i.test(v)?h["public-key"]=b:/privatekey/i.test(v)?h["private-key"]=b:["udp"].includes(v)?h[v]=/(TRUE)|1/i.test(b):[...Object.keys(h),"flag"].includes(v)||(h[v]=b)}return h}}}function WV(){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,u]=n.split(/#(.+)/,2),f=Q2().parse(s);if(ea(u))try{f.name=decodeURIComponent(u)}catch(d){console.log(d)}return f}}}function XV(){return{name:"Clash Parser",test:n=>{let i;try{i=nE.default.parse(n)}catch{i=Ws.parse(n)}return!!i?.type},parse:n=>{let i;try{i=nE.default.parse(n)}catch{i=Ws.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 JV(){return{name:"QX SS Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")===-1,parse:n=>wu().parse(n)}}function ZV(){return{name:"QX SSR Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")!==-1,parse:n=>wu().parse(n)}}function QV(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>wu().parse(n)}}function eK(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>wu().parse(n)}}function tK(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>wu().parse(n)}}function rK(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>wu().parse(n)}}function nK(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>wu().parse(n)}}function iK(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>_a().parse(n)}}function sK(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>_a().parse(n)}}function aK(){return{name:"Loon VMess Parser",test:n=>/^.*=\s*vmess/i.test(n.split(",")[0])&&n.indexOf("username")===-1,parse:n=>_a().parse(n)}}function uK(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>_a().parse(n)}}function oK(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>_a().parse(n)}}function cK(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>_a().parse(n)}}function lK(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>_a().parse(n)}}function fK(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>_a().parse(n)}}function hK(){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 a=n.match(/,\s*?peers\s*?=\s*?\[\s*?\{\s*?(.+?)\s*?\}\s*?\]/i)?.[1],s=a.match(/(,|^)\s*?endpoint\s*?=\s*?"?(.+?):(\d+)"?\s*?(,|$)/i),u=s?.[2],c=parseInt(s?.[3],10),f=n.match(/(,|^)\s*?mtu\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];f&&(f=parseInt(f,10));let d=n.match(/(,|^)\s*?keepalive\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];d&&(d=parseInt(d,10));let g=a.match(/(,|^)\s*?reserved\s*?=\s*?"?(\[\s*?.+?\s*?\])"?\s*?(,|$)/i)?.[2];g&&(g=JSON.parse(g));let p,h=n.match(/(,|^)\s*?dns\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],E=n.match(/(,|^)\s*?dnsv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2];(h||E)&&(p=[],h&&p.push(h),E&&p.push(E));let v=a.match(/(,|^)\s*?allowed-ips\s*?=\s*?"(.+?)"\s*?(,|$)/i)?.[2]?.split(",").map(F=>F.trim()),b=a.match(/(,|^)\s*?preshared-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],m=n.match(/(,|^)\s*?interface-ip\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],y=n.match(/(,|^)\s*?interface-ipv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],D=a.match(/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],_={type:"wireguard",name:i,server:u,port:c,ip:m,ipv6:y,"private-key":n.match(/(,|^)\s*?private-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],"public-key":D,mtu:f,keepalive:d,reserved:g,"allowed-ips":v,"preshared-key":b,dns:p,udp:!0,peers:[{server:u,port:c,ip:m,ipv6:y,"public-key":D,"pre-shared-key":b,"allowed-ips":v,reserved:g}]};return Array.isArray(_.dns)&&_.dns.length>0&&(_["remote-dns-resolve"]=!0),_}}}function dK(){return{name:"Surge Direct Parser",test:n=>/^.*=\s*direct/.test(n.split(",")[0]),parse:n=>zi().parse(n)}}function pK(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>zi().parse(n)}}function gK(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>zi().parse(n)}}function mK(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1,parse:n=>zi().parse(n)}}function vK(){return{name:"Surge Trojan Parser",test:n=>/^.*=\s*trojan/.test(n.split(",")[0]),parse:n=>zi().parse(n)}}function EK(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0]),parse:n=>zi().parse(n)}}function wK(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0]),parse:n=>zi().parse(n)}}function AK(){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),[a,s,u]=i;n=u;let c=/(,|^)\s*?exec\s*?=\s*"(.*?)"\s*?(,|$)/.exec(n)?.[2];c||(c=/(,|^)\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 d=/(,|^)\s*?args\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,g,p=[];for(;(g=d.exec(n))!==null;)g[3]!=null?p.push(g[3]):g[4]!=null&&p.push(g[4]);let h=/(,|^)\s*?addresses\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,E,v=[];for(;(E=h.exec(n))!==null;){let m;E[3]!=null?m=E[3]:E[4]!=null&&(m=E[4]),m!=null&&(m=`${m}`.trim().replace(/^\[/,"").replace(/\]$/,"")),DK(m)&&v.push(m)}return{type:"external",name:s,exec:c,"local-port":f,args:p,addresses:v}}}}function yK(){return{name:"Surge Snell Parser",test:n=>/^.*=\s*snell/.test(n.split(",")[0]),parse:n=>zi().parse(n)}}function bK(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:a}=w5(n),s=zi().parse(a);return s.ports=i,s}}}function CK(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>zi().parse(n)}}function _K(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:a}=w5(n),s=zi().parse(a);return s.ports=i,s}}}function DK(e){return Ur(e)||Rr(e)}var y5=[UV(),jV(),HV(),MV(),qV(),A5(),GV(),YV(),zV(),KV(),WV(),VV(),XV(),dK(),pK(),gK(),mK(),vK(),EK(),yK(),bK(),CK(),_K(),wK(),AK(),iK(),sK(),aK(),uK(),cK(),oK(),lK(),fK(),hK(),JV(),ZV(),QV(),eK(),tK(),rK(),nK()];var D5=Zr(rE());function FK(e){for(let t of Sd)try{if(t.test(e))return G.info(`Pre-processor [${t.name}] activated`),t.parse(e)}catch(r){G.error(`Parser [${t.name}] failed Reason: ${r}`)}return e}function SK(e){e=FK(e);let t=e.split(` `),r=[],n;for(let i of t){if(i=i.trim(),i.length===0)continue;let a=!1;if(n){let[s,u]=b5(n,i);u||(r.push(_5(s)),a=!0)}if(!a)for(let s of y5){let[u,c]=b5(s,i);if(!c){r.push(_5(u)),n=s,a=!0,G.info(`${s.name} is activated`);break}}a||G.error(`Failed to parse line: ${i}`)}return r.filter(i=>(["vless","vmess"].includes(i.type)&&(bd(i.uuid)||G.error(`UUID may be invalid: ${i.name} ${i.uuid}`)),!0))}async function IK(proxies,operators=[],targetPlatform,source,$options){for(let item of operators){if(item.disabled){G.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"?D0:qa,n=xr(G.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);e==="module"?script=n.content:script=await vi({type:"file",name:t})}catch(t){throw G.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=eval('require("fs")');script=fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw G.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 wn(url)}catch(e){throw G.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(!kd[item.type]){G.error(`Unknown operator: "${item.type}"`);continue}G.log(`Applying "${item.type}" with arguments: >>> ${JSON.stringify(item.args,null,2)||"None"}`);let processor;item.type.indexOf("Script")!==-1?processor=kd[item.type](script,targetPlatform,$arguments,source,$options):processor=kd[item.type](item.args||{}),proxies=await d_(processor,proxies)}return proxies}function BK(e,t,r,n={}){let i=Dp[t];if(!i)throw new Error(`Target platform: ${t} is not supported!`);let a=/Surge|SurgeMac|Shadowrocket/i.test(t);if(e=e.filter(s=>s.supported&&s.supported[t]===!1?!1:(["vless","vmess"].includes(s.type)&&(bd(s.uuid)||G.error(`UUID may be invalid: ${s.name} ${s.uuid}`)),!0)),e=e.map(s=>(s._resolved=s.resolved,ea(s.name)||(s.name=`${s.type} ${s.server}:${s.port}`),s["disable-sni"]&&(a?s.sni="off":["tuic"].includes(s.type)||(G.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=If(s.ports))),s)),G.log(`Producing proxies for target: ${t}`),typeof i.type>"u"||i.type==="SINGLE"){let s=e.map(u=>{try{return i.produce(u,r,n)}catch(c){return G.error(`Cannot produce proxy: ${JSON.stringify(u,null,2)} Reason: ${c}`),""}}).filter(u=>u.length>0);return s=r==="internal"?s:s.join(` `),t.startsWith("Surge")&&e.length>0&&e.every(u=>u.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 Nt={parse:SK,process:IK,produce:BK,ipAddress:yd,getRandomPort:If,isIPv4:Ur,isIPv6:Rr,isIP:iE,yaml:Ws,getFlag:sl,removeFlag:xf,getISO:$d,MMDB:Bd,Gist:qo,download:wn,downloadFile:YC,isValidUUID:bd,doh:ul,Buffer:Op.Buffer,Base64:Dt,JSON5:D5.default};function b5(e,t){if(!$K(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function $K(e,t){try{return e.test(t)}catch{return!1}}function C5(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function _5(e){typeof e.cipher=="string"&&(e.cipher=e.cipher.toLowerCase()),typeof e.password=="number"&&(e.password=HC(e.password)),["ss"].includes(e.type)&&e.cipher==="none"&&!e.password&&(e.password=""),e.interface&&(e["interface-name"]=e.interface,delete e.interface),jC(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=>C5(n)):t!=null&&(e[`${e.network}-opts`].path=C5(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&&!iE(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&&(iE(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=Op.Buffer.from(e.name.data).toString("utf8"):e.name=Op.Buffer.from(e.name).toString("utf8")}catch(n){G.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{G.env.isNode&&!r&&e._ca&&(r=G.node.fs.readFileSync(e._ca,{encoding:"utf8"}))}catch(n){G.error(`Read ca file failed Reason: ${n}`)}return!e["tls-fingerprint"]&&r&&(e["tls-fingerprint"]=Ry.generateFingerprint(r)),["ss"].includes(e.type)&&ue(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 iE(e){return Ur(e)||Rr(e)}function sE(e){e.get("/share/col/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,G.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await Ul(t,r)}),e.get("/share/col/:name",Ul),e.get("/share/sub/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,G.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await Ll(t,r)}),e.get("/share/sub/:name",Ll),e.get("/download/collection/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,G.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await Ul(t,r)}),e.get("/download/collection/:name",Ul),e.get("/download/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,G.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await Ll(t,r)}),e.get("/download/:name",Ll),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 Ul(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 Ll(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 Ul(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 Ll(t,r)})}async function Ll(e,t){let{name:r,nezhaIndex:n}=e.params,i=e.query.target==="SurgeMac",a=e.query.target||hg(e.headers)||"JSON",s=e.headers["user-agent"]||e.headers["User-Agent"];G.info(`\u6B63\u5728\u4E0B\u8F7D\u8BA2\u9605\uFF1A${r} \u8BF7\u6C42 User-Agent: ${s} \u8BF7\u6C42 target: ${e.query.target} \u5B9E\u9645\u8F93\u51FA: ${a}`);let{url:u,ua:c,content:f,mergeSources:d,ignoreFailedRemoteSub:g,produceType:p,includeUnsupportedProxy:h,resultFormat:E,proxy:v,noCache:b}=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 F of e.query.$options.split("&")){let L=F.split("=")[0],k=F.split("=")[1];m[L]=k==null||k===""?!0:decodeURIComponent(k)}}G.info(`\u4F20\u5165 $options: ${JSON.stringify(m)}`)}u&&(G.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 URL: ${u}`),/^https?:\/\//.test(u)||(f=u,G.info("URL \u4E0D\u662F\u94FE\u63A5\uFF0C\u89C6\u4E3A\u672C\u5730\u8BA2\u9605"))),f&&G.info(`\u6307\u5B9A\u672C\u5730\u8BA2\u9605: ${f}`),v&&G.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${v}`),c&&G.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 User-Agent: ${c}`),d&&G.info(`\u6307\u5B9A\u5408\u5E76\u6765\u6E90: ${d}`),g!=null&&g!==""&&G.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u8BA2\u9605: ${g}`),p&&G.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${p}`),h&&G.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${h}`),!h&&dg(a,s)&&(h=!0,G.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&&G.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External"),b&&G.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${b}`);let y=G.read(ns),D=xr(y,r);if(D)try{D.passThroughUA&&(G.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${s}`),c=s);let F=await vi({type:"subscription",name:r,platform:a,url:u,ua:c,content:f,mergeSources:d,ignoreFailedRemoteSub:g,produceType:p,produceOpts:{"include-unsupported-proxy":h,useMihomoExternal:i},$options:m,proxy:v,noCache:b}),L;if(D.source!=="local"||["localFirst","remoteFirst"].includes(D.mergeSources))try{u=`${u||D.url}`.split(/[\r\n]+/).map(B=>B.trim()).filter(B=>B.length)?.[0]||"";let k={},S=u.split("#");if(u=u.split("#")[0],S.length>1)try{k=JSON.parse(decodeURIComponent(S[1]))}catch{for(let O of S[1].split("&")){let x=O.split("=")[0],U=O.split("=")[1];k[x]=U==null||U===""?!0:decodeURIComponent(U)}}!k.noFlow&&/^https?/.test(u)&&(L=await ta(k?.insecure?`${u}#insecure`:u,k.flowUserAgent,void 0,v||D.proxy,k.flowUrl),L&&t.set("subscription-userinfo",il(L)))}catch(k){G.error(`\u8BA2\u9605 ${r} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(k)}`)}if(D.subUserinfo){let k;if(/^https?:\/\//.test(D.subUserinfo))try{k=await ta(void 0,void 0,void 0,v||D.proxy,D.subUserinfo)}catch(S){G.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${D.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(S)}`)}else k=D.subUserinfo;t.set("subscription-userinfo",il([k,L].filter(S=>S).join(";")))}a==="JSON"?(E==="nezha"?F=S5(F):E==="nezha-monitor"&&(n=/^\d+$/.test(n)?parseInt(n,10):F.findIndex(k=>k.name===n),F=await F5(F[n],n,e.query)),t.set("Content-Type","application/json;charset=utf-8").send(F)):t.send(F)}catch(_){G.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${_.message??_}`),G.error(_.message??_),En(t,new ki("INTERNAL_SERVER_ERROR",`Failed to download subscription: ${r}`,`Reason: ${_.message??_}`))}else G.error(`\u{1F30D} Sub-Store \u4E0B\u8F7D\u8BA2\u9605\u5931\u8D25 \u274C \u672A\u627E\u5230\u8BA2\u9605\uFF1A${r}\uFF01`),En(t,new Qa("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404)}async function Ul(e,t){let{name:r,nezhaIndex:n}=e.params,i=e.query.target==="SurgeMac",a=e.query.target||hg(e.headers)||"JSON",s=G.read(Pu),u=xr(s,r),c=e.headers["user-agent"]||e.headers["User-Agent"];G.info(`\u6B63\u5728\u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\uFF1A${r} \u8BF7\u6C42 User-Agent: ${c} \u8BF7\u6C42 target: ${e.query.target} \u5B9E\u9645\u8F93\u51FA: ${a}`);let{ignoreFailedRemoteSub:f,produceType:d,includeUnsupportedProxy:g,resultFormat:p,proxy:h,noCache:E}=e.query,v={_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{v=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let m of e.query.$options.split("&")){let y=m.split("=")[0],D=m.split("=")[1];v[y]=D==null||D===""?!0:decodeURIComponent(D)}}G.info(`\u4F20\u5165 $options: ${JSON.stringify(v)}`)}if(h&&G.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${h}`),f!=null&&f!==""&&G.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u8BA2\u9605: ${f}`),d&&G.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${d}`),g&&G.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${g}`),!g&&dg(a,c)&&(g=!0,G.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: ${g}`)),i&&G.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External"),E&&G.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${E}`),u)try{let b=await vi({type:"collection",name:r,platform:a,ignoreFailedRemoteSub:f,produceType:d,produceOpts:{"include-unsupported-proxy":g,useMihomoExternal:i},$options:v,proxy:h,noCache:E,ua:c}),m,y=G.read(ns),D=u.subscriptions;if(D.length>0){let L=xr(y,D[0]);if(L.source!=="local"||["localFirst","remoteFirst"].includes(L.mergeSources))try{let k=`${L.url}`.split(/[\r\n]+/).map(O=>O.trim()).filter(O=>O.length)?.[0]||"",S={},B=k.split("#");if(k=k.split("#")[0],B.length>1)try{S=JSON.parse(decodeURIComponent(B[1]))}catch{for(let x of B[1].split("&")){let U=x.split("=")[0],Y=x.split("=")[1];S[U]=Y==null||Y===""?!0:decodeURIComponent(Y)}}!S.noFlow&&/^https?:/.test(k)&&(m=await ta(S?.insecure?`${k}#insecure`:k,S.flowUserAgent,void 0,h||L.proxy||u.proxy,S.flowUrl))}catch(k){G.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4E2D\u7684\u5B50\u8BA2\u9605 ${L.name} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${k.message??k}`)}if(L.subUserinfo){let k;if(/^https?:\/\//.test(L.subUserinfo))try{k=await ta(void 0,void 0,void 0,h||L.proxy,L.subUserinfo)}catch(S){G.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${L.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(S)}`)}else k=L.subUserinfo;m=[k,m].filter(S=>S).join("; ")}}G.info(`\u7EC4\u5408\u8BA2\u9605 ${r} \u900F\u4F20\u7684\u7684\u6D41\u91CF\u4FE1\u606F: ${m}`);let _;if(/^https?:\/\//.test(u.subUserinfo))try{_=await ta(void 0,void 0,void 0,h||u.proxy,u.subUserinfo)}catch(L){G.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${u.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(L)}`)}else _=u.subUserinfo;let F=[_,m].filter(L=>L).join("; ");F&&t.set("subscription-userinfo",il(F)),a==="JSON"?(p==="nezha"?b=S5(b):p==="nezha-monitor"&&(n=/^\d+$/.test(n)?parseInt(n,10):b.findIndex(L=>L.name===n),b=await F5(b[n],n,e.query)),t.set("Content-Type","application/json;charset=utf-8").send(b)):t.send(b)}catch(b){G.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${b}`),En(t,new ki("INTERNAL_SERVER_ERROR",`Failed to download collection: ${r}`,`Reason: ${b.message??b}`))}else G.error("\u{1F30D} Sub-Store \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C \u672A\u627E\u5230\u7EC4\u5408\u8BA2\u9605\uFF1A${r}\uFF01`),En(t,new Qa("RESOURCE_NOT_FOUND",`Collection ${r} does not exist!`),404)}async function F5(e,t,r){let n={code:0,message:"success",result:[]};try{let{isLoon:i,isSurge:a}=G.env;if(!i&&!a)throw new Error("\u4EC5\u652F\u6301 Loon \u548C Surge(ability=http-client-policy)");let s=Nt.produce([e],i?"Loon":"Surge");if(!s)throw new Error("\u5F53\u524D\u5BA2\u6237\u7AEF\u4E0D\u517C\u5BB9\u6B64\u8282\u70B9");let u=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}],c=r.number||Math.max(...u.map(f=>f.number))||3;for(let f of u){let g={monitor_id:u.indexOf(f),server_id:t,monitor_name:f.name,server_name:e.name,created_at:[],avg_delay:[]};for(let p=0;p{let i=r._geo?.countryCode||r._geo?.country;if(/^[a-z]{2}$/i.test(i)||(i=$d(r.name)),/^[a-z]{2}$/i.test(i)){let a=Math.round(new Date().getTime()/1e3),s=r._unavailable?0:a,u=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:zo.version,CPU:[],MemTotal:1024,DiskTotal:1024,SwapTotal:1024,Arch:"",Virtualization:"",BootTime:a-u,CountryCode:i,Version:"0.0.1"},status:{CPU:0,MemUsed:0,SwapUsed:0,DiskUsed:0,NetInTransfer:0,NetOutTransfer:0,NetInSpeed:0,NetOutSpeed:0,Uptime:u,Load1:0,Load5:0,Load15:0,TcpConnCount:0,UdpConnCount:0,ProcessCount:0}})}}),JSON.stringify(t,null,2)}function aE(e){e.post("/api/preview/sub",xK),e.post("/api/preview/collection",PK),e.post("/api/preview/file",RK)}async function RK(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 u={};if(n=await Promise.all(r.url.split(/[\r\n]+/).map(c=>c.trim()).filter(c=>c.length).map(async c=>{try{return await wn(c,r.ua,void 0,r.proxy)}catch(f){return u[c]=f,G.error(`\u6587\u4EF6 ${r.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${c} \u53D1\u751F\u9519\u8BEF: ${f}`),""}})),Object.keys(u).length>0)if(r.ignoreFailedRemoteFile)r.ignoreFailedRemoteFile==="enabled"&&G.notify("\u{1F30D} Sub-Store \u9884\u89C8\u6587\u4EF6\u5931\u8D25",`\u274C ${r.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(u).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(u).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(),a=i.filter(u=>u!=null&&u!=="").join(` `),s=Array.isArray(r.process)&&r.process.length>0?await Nt.process({$files:i,$content:a,$file:r},r.process):{$content:a,$files:i};ra(t,{original:a,processed:s?.$content??""})}catch(r){G.error(r.message??r),En(t,new ki("INTERNAL_SERVER_ERROR","Failed to preview file",`Reason: ${r.message??r}`))}}async function xK(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 u={};if(i=await Promise.all(r.url.split(/[\r\n]+/).map(c=>c.trim()).filter(c=>c.length).map(async c=>{try{return await wn(c,r.ua,void 0,r.proxy,void 0,void 0,void 0,!0)}catch(f){return u[c]=f,G.error(`\u8BA2\u9605 ${r.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${c} \u53D1\u751F\u9519\u8BEF: ${f}`),""}})),Object.keys(u).length>0)if(r.ignoreFailedRemoteSub)r.ignoreFailedRemoteSub==="enabled"&&G.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${r.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(u).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(u).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 a=(Array.isArray(i)?i:[i]).map(u=>Nt.parse(u)).flat();a.forEach((u,c)=>{u.id=c,u._subName=r.name,u._subDisplayName=r.displayName});let s=await Nt.process(a,r.process||[],n,{[r.name]:r});ra(t,{original:a,processed:s})}catch(r){G.error(r.message??r),En(t,new ki("INTERNAL_SERVER_ERROR","Failed to preview subscription",`Reason: ${r.message??r}`))}}async function PK(e,t){try{let r=G.read(ns),n=e.body,i=[...n.subscriptions],a=n.subscriptionTags;Array.isArray(a)&&a.length>0&&r.forEach(d=>{Array.isArray(d.tag)&&d.tag.length>0&&!i.includes(d.name)&&d.tag.some(g=>a.includes(g))&&i.push(d.name)});let s={},u={};if(await Promise.all(i.map(async d=>{let g=xr(r,d);try{let p;if(g.source==="local"&&!["localFirst","remoteFirst"].includes(g.mergeSources))p=g.content;else{let E={};if(p=await Promise.all(g.url.split(/[\r\n]+/).map(v=>v.trim()).filter(v=>v.length).map(async v=>{try{return await wn(v,g.ua,void 0,g.proxy,void 0,void 0,void 0,!0)}catch(b){return E[v]=b,G.error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${v} \u53D1\u751F\u9519\u8BEF: ${b}`),""}})),Object.keys(E).length>0)if(g.ignoreFailedRemoteSub)g.ignoreFailedRemoteSub==="enabled"&&G.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${g.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(E).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(E).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);g.mergeSources==="localFirst"?p.unshift(g.content):g.mergeSources==="remoteFirst"&&p.push(g.content)}let h=(Array.isArray(p)?p:[p]).map(E=>Nt.parse(E)).flat();h.forEach(E=>{E._subName=g.name,E._subDisplayName=g.displayName,E._collectionName=n.name,E._collectionDisplayName=n.displayName}),h=await Nt.process(h,g.process||[],"JSON",{[g.name]:g,_collection:n}),s[d]=h}catch(p){u[d]=p,G.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605 ${n.name} \u4E2D\u7684\u5B50\u8BA2\u9605: ${g.name} \u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${p}\uFF01`)}})),Object.keys(u).length>0)if(n.ignoreFailedRemoteSub)n.ignoreFailedRemoteSub==="enabled"&&G.notify("\u{1F30D} Sub-Store \u9884\u89C8\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${n.name}`,`\u5B50\u8BA2\u9605 ${Object.keys(u).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(u).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);let c=Array.prototype.concat.apply([],i.map(d=>s[d]||[]));c.forEach((d,g)=>{d.id=g,d._collectionName=n.name,d._collectionDisplayName=n.displayName});let f=await Nt.process(c,n.process||[],"JSON",{_collection:n});ra(t,{original:c,processed:f})}catch(r){G.error(r.message??r),En(t,new ki("INTERNAL_SERVER_ERROR","Failed to preview collection",`Reason: ${r.message??r}`))}}function uE(e){e.post("/api/utils/node-info",OK)}async function OK(e,t){let r=e.body,n=e.query.lang||"zh-CN",i;try{i=Dp.URI.produce(r)}catch{}try{let s=await As().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(u=>{let c=JSON.parse(u.body);if(c.status!=="success")throw new Error(c.message);return delete c.status,c});ra(t,{shareUrl:i,info:s})}catch(a){En(t,new Dd("FAILED_TO_GET_NODE_INFO","Failed to get node info",`Reason: ${a}`))}}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${_0} \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 `);ig();TK();function TK(){let e=sg({substore:G});sE(e),aE(e),gm(e),uE(e),e.options("/",(t,r)=>{r.status(200).end()}),e.start()}})(); /*! Bundled license information: ieee754/index.js: (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) buffer/index.js: (*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT *) jsrsasign/lib/jsrsasign.js: (*! CryptoJS v3.1.2 core-fix.js * code.google.com/p/crypto-js * (c) 2009-2013 by Jeff Mott. All rights reserved. * code.google.com/p/crypto-js/wiki/License * THIS IS FIX of 'core.js' to fix Hmac issue. * https://code.google.com/p/crypto-js/issues/detail?id=84 * https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js *) (*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ *) (*! (c) Tom Wu, Kenji Urushima | http://www-cs-students.stanford.edu/~tjw/jsbn/ *) (*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib *) (*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval *) lodash/lodash.js: (** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) */