algolia-uploader 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +30 -27
- package/dist/index.mjs +30 -27
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{defineCommand as Ko,runMain as qo}from"citty";import qe from"fs";import Ie from"path";import Vo from"tty";import kn from"os";import ko from"crypto";import{createRequire as Fo}from"node:module";import Fn from"child_process";import{isEqual as jo}from"es-toolkit";import{algoliasearch as Uo}from"algoliasearch";const Mo="algolia-uploader",Go="0.0.12",Yo="command-line util to upload Algolia source";function $o(e){return qe.readdirSync(e).filter(r=>r.endsWith(".json")).map(r=>{const y=qe.readFileSync(Ie.join(e,r),"utf8");return JSON.parse(y)})}function jn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var y=function i(){var u=!1;try{u=this instanceof i}catch{}return u?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};y.prototype=r.prototype}else y={};return Object.defineProperty(y,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var u=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(y,i,u.get?u:{enumerable:!0,get:function(){return e[i]}})}),y}var Un={};const Mn="1.54.1",Gn="@dotenvx/dotenvx",Yn="a secure dotenv\u2013from the creator of `dotenv`",$n="@motdotla",Zn=["dotenv","env"],Xn="https://github.com/dotenvx/dotenvx",Wn={type:"git",url:"git+https://github.com/dotenvx/dotenvx.git"},zn="BSD-3-Clause",Qn=["src/**/*","CHANGELOG.md"],Jn="src/lib/main.js",er="src/lib/main.d.ts",tr={".":{types:"./src/lib/main.d.ts",require:"./src/lib/main.js",default:"./src/lib/main.js"},"./config":"./src/lib/config.js","./config.js":"./src/lib/config.js","./package.json":"./package.json"},nr={dotenvx:"./src/cli/dotenvx.js"},rr={standard:"standard","standard:fix":"standard --fix",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test-coverage":"tap run --show-full-coverage --timeout=60000",testshell:"bash shellspec",prerelease:"npm test && npm run testshell",release:"standard-version"},sr="https://dotenvx.com",or={commander:"^11.1.0",dotenv:"^17.2.1",eciesjs:"^0.4.10",execa:"^5.1.1",fdir:"^6.2.0",ignore:"^5.3.0","object-treeify":"1.1.33",picomatch:"^4.0.2",which:"^4.0.0"},ir={"@yao-pkg/pkg":"^5.14.2","capture-console":"^1.0.2",esbuild:"^0.25.8",proxyquire:"^2.1.3",sinon:"^14.0.1",standard:"^17.1.0","standard-version":"^9.5.0",tap:"^21.0.1"},cr={access:"public",provenance:!0},Zo={version:Mn,name:Gn,description:Yn,author:$n,keywords:Zn,homepage:Xn,repository:Wn,license:zn,files:Qn,main:Jn,types:er,exports:tr,bin:nr,scripts:rr,funding:sr,dependencies:or,devDependencies:ir,publishConfig:cr},Xo={__proto__:null,author:$n,bin:nr,default:Zo,dependencies:or,description:Yn,devDependencies:ir,exports:tr,files:Qn,funding:sr,homepage:Xn,keywords:Zn,license:zn,main:Jn,name:Gn,publishConfig:cr,repository:Wn,scripts:rr,types:er,version:Mn},Wo=jn(Xo);var ht,ar;function zo(){if(ar)return ht;ar=1;const{name:e,version:r,description:y}=Wo;return ht={name:e,version:r,description:y},ht}var pt,ur;function Qo(){if(ur)return pt;ur=1;const{WriteStream:e}=Vo;return pt={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const i=process.env.TERM;return i&&(i.includes("256color")||i.includes("xterm"))?8:4}}},pt}var yt,lr;function fr(){if(lr)return yt;lr=1;const e=Qo(),r=new Map([["blue",34],["gray",37],["green",32],["olive",33],["orangered",31],["plum",35],["red",31],["electricblue",36],["dodgerblue",36]]),y=new Map([["blue",21],["gray",244],["green",34],["olive",142],["orangered",202],["plum",182],["red",196],["electricblue",45],["dodgerblue",33]]);function i(c){const s=e.getColorDepth();if(!y.has(c))throw new Error(`Invalid color ${c}`);if(s>=8){const d=y.get(c);return b=>`\x1B[38;5;${d}m${b}\x1B[39m`}if(s>=4){const d=r.get(c);return b=>`\x1B[${d}m${b}\x1B[39m`}return d=>d}function u(c){return e.getColorDepth()>=4?`\x1B[1m${c}\x1B[22m`:c}return yt={getColor:i,bold:u},yt}var vt,dr;function hr(){if(dr)return vt;dr=1;const e=zo(),{getColor:r,bold:y}=fr(),i={error:0,warn:1,success:2,successv:2,info:2,help:2,verbose:4,debug:5,silly:6},u=E=>y(r("red")(E)),c=r("orangered"),s=r("green"),d=r("olive"),b=r("dodgerblue"),I=r("plum"),A=r("plum");let D=i.info,w="dotenvx",P=e.version;function _(E,R){const H=S(E,R);console.error(H)}function x(E,R){if(i[E]===void 0)throw new Error(`MISSING_LOG_LEVEL: '${E}'. implement in logger.`);if(i[E]<=D){const H=S(E,R);console.log(H)}}function S(E,R){const H=typeof R=="object"?JSON.stringify(R):R;switch(E.toLowerCase()){case"error":return u(H);case"warn":return c(H);case"success":return s(H);case"successv":return d(`[${w}@${P}] ${H}`);case"info":return H;case"help":return b(H);case"verbose":return I(H);case"debug":return A(H)}}const O={level:"info",error:E=>_("error",E),warn:E=>x("warn",E),success:E=>x("success",E),successv:E=>x("successv",E),info:E=>x("info",E),help:E=>x("help",E),verbose:E=>x("verbose",E),debug:E=>x("debug",E),setLevel:E=>{i[E]!==void 0&&(D=i[E],O.level=E)},setName:E=>{w=E,O.name=E},setVersion:E=>{P=E,O.version=E}};function M(E){const R=E.debug?"debug":E.verbose?"verbose":E.quiet?"error":E.logLevel;R&&(O.setLevel(R),(!E.quiet||E.quiet&&R!=="error")&&O.debug(`Setting log level to ${R}`))}function L(E){const R=E.logName;R&&O.setName(R)}function F(E){const R=E.logVersion;R&&O.setVersion(R)}return vt={logger:O,getColor:r,setLogLevel:M,setLogName:L,setLogVersion:F,levels:i},vt}var gt={},mt={},bt,pr;function ct(){if(pr)return bt;pr=1;const e="\\\\/",r=`[^${e}]`,y="\\.",i="\\+",u="\\?",c="\\/",s="(?=.)",d="[^/]",b=`(?:${c}|$)`,I=`(?:^|${c})`,A=`${y}{1,2}${b}`,D=`(?!${y})`,w=`(?!${I}${A})`,P=`(?!${y}{0,1}${b})`,_=`(?!${A})`,x=`[^.${c}]`,S=`${d}*?`,M={DOT_LITERAL:y,PLUS_LITERAL:i,QMARK_LITERAL:u,SLASH_LITERAL:c,ONE_CHAR:s,QMARK:d,END_ANCHOR:b,DOTS_SLASH:A,NO_DOT:D,NO_DOTS:w,NO_DOT_SLASH:P,NO_DOTS_SLASH:_,QMARK_NO_DOT:x,STAR:S,START_ANCHOR:I,SEP:"/"},L={...M,SLASH_LITERAL:`[${e}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${y}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${y})`,NO_DOTS:`(?!(?:^|[${e}])${y}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${y}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${y}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`,SEP:"\\"},F={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return bt={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:F,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(E){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${E.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(E){return E===!0?L:M}},bt}var yr;function at(){return yr||(yr=1,(function(e){const{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:y,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:u}=ct();e.isObject=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),e.hasRegexChars=c=>i.test(c),e.isRegexChar=c=>c.length===1&&e.hasRegexChars(c),e.escapeRegex=c=>c.replace(u,"\\$1"),e.toPosixSlashes=c=>c.replace(r,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const c=navigator.platform.toLowerCase();return c==="win32"||c==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=c=>c.replace(y,s=>s==="\\"?"":s),e.escapeLast=(c,s,d)=>{const b=c.lastIndexOf(s,d);return b===-1?c:c[b-1]==="\\"?e.escapeLast(c,s,b-1):`${c.slice(0,b)}\\${c.slice(b)}`},e.removePrefix=(c,s={})=>{let d=c;return d.startsWith("./")&&(d=d.slice(2),s.prefix="./"),d},e.wrapOutput=(c,s={},d={})=>{const b=d.contains?"":"^",I=d.contains?"":"$";let A=`${b}(?:${c})${I}`;return s.negated===!0&&(A=`(?:^(?!${A}).*$)`),A},e.basename=(c,{windows:s}={})=>{const d=c.split(s?/[\\/]/:"/"),b=d[d.length-1];return b===""?d[d.length-2]:b}})(mt)),mt}var Et,vr;function Jo(){if(vr)return Et;vr=1;const e=at(),{CHAR_ASTERISK:r,CHAR_AT:y,CHAR_BACKWARD_SLASH:i,CHAR_COMMA:u,CHAR_DOT:c,CHAR_EXCLAMATION_MARK:s,CHAR_FORWARD_SLASH:d,CHAR_LEFT_CURLY_BRACE:b,CHAR_LEFT_PARENTHESES:I,CHAR_LEFT_SQUARE_BRACKET:A,CHAR_PLUS:D,CHAR_QUESTION_MARK:w,CHAR_RIGHT_CURLY_BRACE:P,CHAR_RIGHT_PARENTHESES:_,CHAR_RIGHT_SQUARE_BRACKET:x}=ct(),S=L=>L===d||L===i,O=L=>{L.isPrefix!==!0&&(L.depth=L.isGlobstar?1/0:1)};return Et=(L,F)=>{const E=F||{},R=L.length-1,H=E.parts===!0||E.scanToEnd===!0,k=[],N=[],V=[];let B=L,j=-1,K=0,C=0,a=!1,p=!1,o=!1,n=!1,h=!1,f=!1,t=!1,v=!1,g=!1,l=!1,m=0,Q,$,q={value:"",depth:0,isGlob:!1};const G=()=>j>=R,X=()=>B.charCodeAt(j+1),z=()=>(Q=$,B.charCodeAt(++j));for(;j<R;){$=z();let ce;if($===i){t=q.backslashes=!0,$=z(),$===b&&(f=!0);continue}if(f===!0||$===b){for(m++;G()!==!0&&($=z());){if($===i){t=q.backslashes=!0,z();continue}if($===b){m++;continue}if(f!==!0&&$===c&&($=z())===c){if(a=q.isBrace=!0,o=q.isGlob=!0,l=!0,H===!0)continue;break}if(f!==!0&&$===u){if(a=q.isBrace=!0,o=q.isGlob=!0,l=!0,H===!0)continue;break}if($===P&&(m--,m===0)){f=!1,a=q.isBrace=!0,l=!0;break}}if(H===!0)continue;break}if($===d){if(k.push(j),N.push(q),q={value:"",depth:0,isGlob:!1},l===!0)continue;if(Q===c&&j===K+1){K+=2;continue}C=j+1;continue}if(E.noext!==!0&&($===D||$===y||$===r||$===w||$===s)===!0&&X()===I){if(o=q.isGlob=!0,n=q.isExtglob=!0,l=!0,$===s&&j===K&&(g=!0),H===!0){for(;G()!==!0&&($=z());){if($===i){t=q.backslashes=!0,$=z();continue}if($===_){o=q.isGlob=!0,l=!0;break}}continue}break}if($===r){if(Q===r&&(h=q.isGlobstar=!0),o=q.isGlob=!0,l=!0,H===!0)continue;break}if($===w){if(o=q.isGlob=!0,l=!0,H===!0)continue;break}if($===A){for(;G()!==!0&&(ce=z());){if(ce===i){t=q.backslashes=!0,z();continue}if(ce===x){p=q.isBracket=!0,o=q.isGlob=!0,l=!0;break}}if(H===!0)continue;break}if(E.nonegate!==!0&&$===s&&j===K){v=q.negated=!0,K++;continue}if(E.noparen!==!0&&$===I){if(o=q.isGlob=!0,H===!0){for(;G()!==!0&&($=z());){if($===I){t=q.backslashes=!0,$=z();continue}if($===_){l=!0;break}}continue}break}if(o===!0){if(l=!0,H===!0)continue;break}}E.noext===!0&&(n=!1,o=!1);let ee=B,U="",Z="";K>0&&(U=B.slice(0,K),B=B.slice(K),C-=K),ee&&o===!0&&C>0?(ee=B.slice(0,C),Z=B.slice(C)):o===!0?(ee="",Z=B):ee=B,ee&&ee!==""&&ee!=="/"&&ee!==B&&S(ee.charCodeAt(ee.length-1))&&(ee=ee.slice(0,-1)),E.unescape===!0&&(Z&&(Z=e.removeBackslashes(Z)),ee&&t===!0&&(ee=e.removeBackslashes(ee)));const te={prefix:U,input:L,start:K,base:ee,glob:Z,isBrace:a,isBracket:p,isGlob:o,isExtglob:n,isGlobstar:h,negated:v,negatedExtglob:g};if(E.tokens===!0&&(te.maxDepth=0,S($)||N.push(q),te.tokens=N),E.parts===!0||E.tokens===!0){let ce;for(let le=0;le<k.length;le++){const ne=ce?ce+1:K,de=k[le],W=L.slice(ne,de);E.tokens&&(le===0&&K!==0?(N[le].isPrefix=!0,N[le].value=U):N[le].value=W,O(N[le]),te.maxDepth+=N[le].depth),(le!==0||W!=="")&&V.push(W),ce=de}if(ce&&ce+1<L.length){const le=L.slice(ce+1);V.push(le),E.tokens&&(N[N.length-1].value=le,O(N[N.length-1]),te.maxDepth+=N[N.length-1].depth)}te.slashes=k,te.parts=V}return te},Et}var _t,gr;function ei(){if(gr)return _t;gr=1;const e=ct(),r=at(),{MAX_LENGTH:y,POSIX_REGEX_SOURCE:i,REGEX_NON_SPECIAL_CHARS:u,REGEX_SPECIAL_CHARS_BACKREF:c,REPLACEMENTS:s}=e,d=(A,D)=>{if(typeof D.expandRange=="function")return D.expandRange(...A,D);A.sort();const w=`[${A.join("-")}]`;try{new RegExp(w)}catch{return A.map(_=>r.escapeRegex(_)).join("..")}return w},b=(A,D)=>`Missing ${A}: "${D}" - use "\\\\${D}" to match literal characters`,I=(A,D)=>{if(typeof A!="string")throw new TypeError("Expected a string");A=s[A]||A;const w={...D},P=typeof w.maxLength=="number"?Math.min(y,w.maxLength):y;let _=A.length;if(_>P)throw new SyntaxError(`Input length: ${_}, exceeds maximum allowed length: ${P}`);const x={type:"bos",value:"",output:w.prepend||""},S=[x],O=w.capture?"":"?:",M=e.globChars(w.windows),L=e.extglobChars(M),{DOT_LITERAL:F,PLUS_LITERAL:E,SLASH_LITERAL:R,ONE_CHAR:H,DOTS_SLASH:k,NO_DOT:N,NO_DOT_SLASH:V,NO_DOTS_SLASH:B,QMARK:j,QMARK_NO_DOT:K,STAR:C,START_ANCHOR:a}=M,p=ne=>`(${O}(?:(?!${a}${ne.dot?k:F}).)*?)`,o=w.dot?"":N,n=w.dot?j:K;let h=w.bash===!0?p(w):C;w.capture&&(h=`(${h})`),typeof w.noext=="boolean"&&(w.noextglob=w.noext);const f={input:A,index:-1,start:0,dot:w.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:S};A=r.removePrefix(A,f),_=A.length;const t=[],v=[],g=[];let l=x,m;const Q=()=>f.index===_-1,$=f.peek=(ne=1)=>A[f.index+ne],q=f.advance=()=>A[++f.index]||"",G=()=>A.slice(f.index+1),X=(ne="",de=0)=>{f.consumed+=ne,f.index+=de},z=ne=>{f.output+=ne.output!=null?ne.output:ne.value,X(ne.value)},ee=()=>{let ne=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)q(),f.start++,ne++;return ne%2===0?!1:(f.negated=!0,f.start++,!0)},U=ne=>{f[ne]++,g.push(ne)},Z=ne=>{f[ne]--,g.pop()},te=ne=>{if(l.type==="globstar"){const de=f.braces>0&&(ne.type==="comma"||ne.type==="brace"),W=ne.extglob===!0||t.length&&(ne.type==="pipe"||ne.type==="paren");ne.type!=="slash"&&ne.type!=="paren"&&!de&&!W&&(f.output=f.output.slice(0,-l.output.length),l.type="star",l.value="*",l.output=h,f.output+=l.output)}if(t.length&&ne.type!=="paren"&&(t[t.length-1].inner+=ne.value),(ne.value||ne.output)&&z(ne),l&&l.type==="text"&&ne.type==="text"){l.output=(l.output||l.value)+ne.value,l.value+=ne.value;return}ne.prev=l,S.push(ne),l=ne},ce=(ne,de)=>{const W={...L[de],conditions:1,inner:""};W.prev=l,W.parens=f.parens,W.output=f.output;const pe=(w.capture?"(":"")+W.open;U("parens"),te({type:ne,value:de,output:f.output?"":H}),te({type:"paren",extglob:!0,value:q(),output:pe}),t.push(W)},le=ne=>{let de=ne.close+(w.capture?")":""),W;if(ne.type==="negate"){let pe=h;if(ne.inner&&ne.inner.length>1&&ne.inner.includes("/")&&(pe=p(w)),(pe!==h||Q()||/^\)+$/.test(G()))&&(de=ne.close=`)$))${pe}`),ne.inner.includes("*")&&(W=G())&&/^\.[^\\/.]+$/.test(W)){const me=I(W,{...D,fastpaths:!1}).output;de=ne.close=`)${me})${pe})`}ne.prev.type==="bos"&&(f.negatedExtglob=!0)}te({type:"paren",extglob:!0,value:m,output:de}),Z("parens")};if(w.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(A)){let ne=!1,de=A.replace(c,(W,pe,me,fe,J,se)=>fe==="\\"?(ne=!0,W):fe==="?"?pe?pe+fe+(J?j.repeat(J.length):""):se===0?n+(J?j.repeat(J.length):""):j.repeat(me.length):fe==="."?F.repeat(me.length):fe==="*"?pe?pe+fe+(J?h:""):h:pe?W:`\\${W}`);return ne===!0&&(w.unescape===!0?de=de.replace(/\\/g,""):de=de.replace(/\\+/g,W=>W.length%2===0?"\\\\":W?"\\":"")),de===A&&w.contains===!0?(f.output=A,f):(f.output=r.wrapOutput(de,f,D),f)}for(;!Q();){if(m=q(),m==="\0")continue;if(m==="\\"){const W=$();if(W==="/"&&w.bash!==!0||W==="."||W===";")continue;if(!W){m+="\\",te({type:"text",value:m});continue}const pe=/^\\+/.exec(G());let me=0;if(pe&&pe[0].length>2&&(me=pe[0].length,f.index+=me,me%2!==0&&(m+="\\")),w.unescape===!0?m=q():m+=q(),f.brackets===0){te({type:"text",value:m});continue}}if(f.brackets>0&&(m!=="]"||l.value==="["||l.value==="[^")){if(w.posix!==!1&&m===":"){const W=l.value.slice(1);if(W.includes("[")&&(l.posix=!0,W.includes(":"))){const pe=l.value.lastIndexOf("["),me=l.value.slice(0,pe),fe=l.value.slice(pe+2),J=i[fe];if(J){l.value=me+J,f.backtrack=!0,q(),!x.output&&S.indexOf(l)===1&&(x.output=H);continue}}}(m==="["&&$()!==":"||m==="-"&&$()==="]")&&(m=`\\${m}`),m==="]"&&(l.value==="["||l.value==="[^")&&(m=`\\${m}`),w.posix===!0&&m==="!"&&l.value==="["&&(m="^"),l.value+=m,z({value:m});continue}if(f.quotes===1&&m!=='"'){m=r.escapeRegex(m),l.value+=m,z({value:m});continue}if(m==='"'){f.quotes=f.quotes===1?0:1,w.keepQuotes===!0&&te({type:"text",value:m});continue}if(m==="("){U("parens"),te({type:"paren",value:m});continue}if(m===")"){if(f.parens===0&&w.strictBrackets===!0)throw new SyntaxError(b("opening","("));const W=t[t.length-1];if(W&&f.parens===W.parens+1){le(t.pop());continue}te({type:"paren",value:m,output:f.parens?")":"\\)"}),Z("parens");continue}if(m==="["){if(w.nobracket===!0||!G().includes("]")){if(w.nobracket!==!0&&w.strictBrackets===!0)throw new SyntaxError(b("closing","]"));m=`\\${m}`}else U("brackets");te({type:"bracket",value:m});continue}if(m==="]"){if(w.nobracket===!0||l&&l.type==="bracket"&&l.value.length===1){te({type:"text",value:m,output:`\\${m}`});continue}if(f.brackets===0){if(w.strictBrackets===!0)throw new SyntaxError(b("opening","["));te({type:"text",value:m,output:`\\${m}`});continue}Z("brackets");const W=l.value.slice(1);if(l.posix!==!0&&W[0]==="^"&&!W.includes("/")&&(m=`/${m}`),l.value+=m,z({value:m}),w.literalBrackets===!1||r.hasRegexChars(W))continue;const pe=r.escapeRegex(l.value);if(f.output=f.output.slice(0,-l.value.length),w.literalBrackets===!0){f.output+=pe,l.value=pe;continue}l.value=`(${O}${pe}|${l.value})`,f.output+=l.value;continue}if(m==="{"&&w.nobrace!==!0){U("braces");const W={type:"brace",value:m,output:"(",outputIndex:f.output.length,tokensIndex:f.tokens.length};v.push(W),te(W);continue}if(m==="}"){const W=v[v.length-1];if(w.nobrace===!0||!W){te({type:"text",value:m,output:m});continue}let pe=")";if(W.dots===!0){const me=S.slice(),fe=[];for(let J=me.length-1;J>=0&&(S.pop(),me[J].type!=="brace");J--)me[J].type!=="dots"&&fe.unshift(me[J].value);pe=d(fe,w),f.backtrack=!0}if(W.comma!==!0&&W.dots!==!0){const me=f.output.slice(0,W.outputIndex),fe=f.tokens.slice(W.tokensIndex);W.value=W.output="\\{",m=pe="\\}",f.output=me;for(const J of fe)f.output+=J.output||J.value}te({type:"brace",value:m,output:pe}),Z("braces"),v.pop();continue}if(m==="|"){t.length>0&&t[t.length-1].conditions++,te({type:"text",value:m});continue}if(m===","){let W=m;const pe=v[v.length-1];pe&&g[g.length-1]==="braces"&&(pe.comma=!0,W="|"),te({type:"comma",value:m,output:W});continue}if(m==="/"){if(l.type==="dot"&&f.index===f.start+1){f.start=f.index+1,f.consumed="",f.output="",S.pop(),l=x;continue}te({type:"slash",value:m,output:R});continue}if(m==="."){if(f.braces>0&&l.type==="dot"){l.value==="."&&(l.output=F);const W=v[v.length-1];l.type="dots",l.output+=m,l.value+=m,W.dots=!0;continue}if(f.braces+f.parens===0&&l.type!=="bos"&&l.type!=="slash"){te({type:"text",value:m,output:F});continue}te({type:"dot",value:m,output:F});continue}if(m==="?"){if(!(l&&l.value==="(")&&w.noextglob!==!0&&$()==="("&&$(2)!=="?"){ce("qmark",m);continue}if(l&&l.type==="paren"){const pe=$();let me=m;(l.value==="("&&!/[!=<:]/.test(pe)||pe==="<"&&!/<([!=]|\w+>)/.test(G()))&&(me=`\\${m}`),te({type:"text",value:m,output:me});continue}if(w.dot!==!0&&(l.type==="slash"||l.type==="bos")){te({type:"qmark",value:m,output:K});continue}te({type:"qmark",value:m,output:j});continue}if(m==="!"){if(w.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){ce("negate",m);continue}if(w.nonegate!==!0&&f.index===0){ee();continue}}if(m==="+"){if(w.noextglob!==!0&&$()==="("&&$(2)!=="?"){ce("plus",m);continue}if(l&&l.value==="("||w.regex===!1){te({type:"plus",value:m,output:E});continue}if(l&&(l.type==="bracket"||l.type==="paren"||l.type==="brace")||f.parens>0){te({type:"plus",value:m});continue}te({type:"plus",value:E});continue}if(m==="@"){if(w.noextglob!==!0&&$()==="("&&$(2)!=="?"){te({type:"at",extglob:!0,value:m,output:""});continue}te({type:"text",value:m});continue}if(m!=="*"){(m==="$"||m==="^")&&(m=`\\${m}`);const W=u.exec(G());W&&(m+=W[0],f.index+=W[0].length),te({type:"text",value:m});continue}if(l&&(l.type==="globstar"||l.star===!0)){l.type="star",l.star=!0,l.value+=m,l.output=h,f.backtrack=!0,f.globstar=!0,X(m);continue}let ne=G();if(w.noextglob!==!0&&/^\([^?]/.test(ne)){ce("star",m);continue}if(l.type==="star"){if(w.noglobstar===!0){X(m);continue}const W=l.prev,pe=W.prev,me=W.type==="slash"||W.type==="bos",fe=pe&&(pe.type==="star"||pe.type==="globstar");if(w.bash===!0&&(!me||ne[0]&&ne[0]!=="/")){te({type:"star",value:m,output:""});continue}const J=f.braces>0&&(W.type==="comma"||W.type==="brace"),se=t.length&&(W.type==="pipe"||W.type==="paren");if(!me&&W.type!=="paren"&&!J&&!se){te({type:"star",value:m,output:""});continue}for(;ne.slice(0,3)==="/**";){const re=A[f.index+4];if(re&&re!=="/")break;ne=ne.slice(3),X("/**",3)}if(W.type==="bos"&&Q()){l.type="globstar",l.value+=m,l.output=p(w),f.output=l.output,f.globstar=!0,X(m);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&!fe&&Q()){f.output=f.output.slice(0,-(W.output+l.output).length),W.output=`(?:${W.output}`,l.type="globstar",l.output=p(w)+(w.strictSlashes?")":"|$)"),l.value+=m,f.globstar=!0,f.output+=W.output+l.output,X(m);continue}if(W.type==="slash"&&W.prev.type!=="bos"&&ne[0]==="/"){const re=ne[1]!==void 0?"|$":"";f.output=f.output.slice(0,-(W.output+l.output).length),W.output=`(?:${W.output}`,l.type="globstar",l.output=`${p(w)}${R}|${R}${re})`,l.value+=m,f.output+=W.output+l.output,f.globstar=!0,X(m+q()),te({type:"slash",value:"/",output:""});continue}if(W.type==="bos"&&ne[0]==="/"){l.type="globstar",l.value+=m,l.output=`(?:^|${R}|${p(w)}${R})`,f.output=l.output,f.globstar=!0,X(m+q()),te({type:"slash",value:"/",output:""});continue}f.output=f.output.slice(0,-l.output.length),l.type="globstar",l.output=p(w),l.value+=m,f.output+=l.output,f.globstar=!0,X(m);continue}const de={type:"star",value:m,output:h};if(w.bash===!0){de.output=".*?",(l.type==="bos"||l.type==="slash")&&(de.output=o+de.output),te(de);continue}if(l&&(l.type==="bracket"||l.type==="paren")&&w.regex===!0){de.output=m,te(de);continue}(f.index===f.start||l.type==="slash"||l.type==="dot")&&(l.type==="dot"?(f.output+=V,l.output+=V):w.dot===!0?(f.output+=B,l.output+=B):(f.output+=o,l.output+=o),$()!=="*"&&(f.output+=H,l.output+=H)),te(de)}for(;f.brackets>0;){if(w.strictBrackets===!0)throw new SyntaxError(b("closing","]"));f.output=r.escapeLast(f.output,"["),Z("brackets")}for(;f.parens>0;){if(w.strictBrackets===!0)throw new SyntaxError(b("closing",")"));f.output=r.escapeLast(f.output,"("),Z("parens")}for(;f.braces>0;){if(w.strictBrackets===!0)throw new SyntaxError(b("closing","}"));f.output=r.escapeLast(f.output,"{"),Z("braces")}if(w.strictSlashes!==!0&&(l.type==="star"||l.type==="bracket")&&te({type:"maybe_slash",value:"",output:`${R}?`}),f.backtrack===!0){f.output="";for(const ne of f.tokens)f.output+=ne.output!=null?ne.output:ne.value,ne.suffix&&(f.output+=ne.suffix)}return f};return I.fastpaths=(A,D)=>{const w={...D},P=typeof w.maxLength=="number"?Math.min(y,w.maxLength):y,_=A.length;if(_>P)throw new SyntaxError(`Input length: ${_}, exceeds maximum allowed length: ${P}`);A=s[A]||A;const{DOT_LITERAL:x,SLASH_LITERAL:S,ONE_CHAR:O,DOTS_SLASH:M,NO_DOT:L,NO_DOTS:F,NO_DOTS_SLASH:E,STAR:R,START_ANCHOR:H}=e.globChars(w.windows),k=w.dot?F:L,N=w.dot?E:L,V=w.capture?"":"?:",B={negated:!1,prefix:""};let j=w.bash===!0?".*?":R;w.capture&&(j=`(${j})`);const K=o=>o.noglobstar===!0?j:`(${V}(?:(?!${H}${o.dot?M:x}).)*?)`,C=o=>{switch(o){case"*":return`${k}${O}${j}`;case".*":return`${x}${O}${j}`;case"*.*":return`${k}${j}${x}${O}${j}`;case"*/*":return`${k}${j}${S}${O}${N}${j}`;case"**":return k+K(w);case"**/*":return`(?:${k}${K(w)}${S})?${N}${O}${j}`;case"**/*.*":return`(?:${k}${K(w)}${S})?${N}${j}${x}${O}${j}`;case"**/.*":return`(?:${k}${K(w)}${S})?${x}${O}${j}`;default:{const n=/^(.*?)\.(\w+)$/.exec(o);if(!n)return;const h=C(n[1]);return h?h+x+n[2]:void 0}}},a=r.removePrefix(A,B);let p=C(a);return p&&w.strictSlashes!==!0&&(p+=`${S}?`),p},_t=I,_t}var wt,mr;function ti(){if(mr)return wt;mr=1;const e=Jo(),r=ei(),y=at(),i=ct(),u=s=>s&&typeof s=="object"&&!Array.isArray(s),c=(s,d,b=!1)=>{if(Array.isArray(s)){const S=s.map(M=>c(M,d,b));return M=>{for(const L of S){const F=L(M);if(F)return F}return!1}}const I=u(s)&&s.tokens&&s.input;if(s===""||typeof s!="string"&&!I)throw new TypeError("Expected pattern to be a non-empty string");const A=d||{},D=A.windows,w=I?c.compileRe(s,d):c.makeRe(s,d,!1,!0),P=w.state;delete w.state;let _=()=>!1;if(A.ignore){const S={...d,ignore:null,onMatch:null,onResult:null};_=c(A.ignore,S,b)}const x=(S,O=!1)=>{const{isMatch:M,match:L,output:F}=c.test(S,w,d,{glob:s,posix:D}),E={glob:s,state:P,regex:w,posix:D,input:S,output:F,match:L,isMatch:M};return typeof A.onResult=="function"&&A.onResult(E),M===!1?(E.isMatch=!1,O?E:!1):_(S)?(typeof A.onIgnore=="function"&&A.onIgnore(E),E.isMatch=!1,O?E:!1):(typeof A.onMatch=="function"&&A.onMatch(E),O?E:!0)};return b&&(x.state=P),x};return c.test=(s,d,b,{glob:I,posix:A}={})=>{if(typeof s!="string")throw new TypeError("Expected input to be a string");if(s==="")return{isMatch:!1,output:""};const D=b||{},w=D.format||(A?y.toPosixSlashes:null);let P=s===I,_=P&&w?w(s):s;return P===!1&&(_=w?w(s):s,P=_===I),(P===!1||D.capture===!0)&&(D.matchBase===!0||D.basename===!0?P=c.matchBase(s,d,b,A):P=d.exec(_)),{isMatch:!!P,match:P,output:_}},c.matchBase=(s,d,b)=>(d instanceof RegExp?d:c.makeRe(d,b)).test(y.basename(s)),c.isMatch=(s,d,b)=>c(d,b)(s),c.parse=(s,d)=>Array.isArray(s)?s.map(b=>c.parse(b,d)):r(s,{...d,fastpaths:!1}),c.scan=(s,d)=>e(s,d),c.compileRe=(s,d,b=!1,I=!1)=>{if(b===!0)return s.output;const A=d||{},D=A.contains?"":"^",w=A.contains?"":"$";let P=`${D}(?:${s.output})${w}`;s&&s.negated===!0&&(P=`^(?!${P}).*$`);const _=c.toRegex(P,d);return I===!0&&(_.state=s),_},c.makeRe=(s,d={},b=!1,I=!1)=>{if(!s||typeof s!="string")throw new TypeError("Expected a non-empty string");let A={negated:!1,fastpaths:!0};return d.fastpaths!==!1&&(s[0]==="."||s[0]==="*")&&(A.output=r.fastpaths(s,d)),A.output||(A=r(s,d)),c.compileRe(A,d,b,I)},c.toRegex=(s,d)=>{try{const b=d||{};return new RegExp(s,b.flags||(b.nocase?"i":""))}catch(b){if(d&&d.debug===!0)throw b;return/$^/}},c.constants=i,wt=c,wt}var St,br;function Er(){if(br)return St;br=1;const e=ti(),r=at();function y(i,u,c=!1){return u&&(u.windows===null||u.windows===void 0)&&(u={...u,windows:r.isWindows()}),e(i,u,c)}return Object.assign(y,e),St=y,St}var _r;function ni(){if(_r)return gt;_r=1;var e=Object.create,r=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,u=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,s=(T,Y,oe,ie)=>{if(Y&&typeof Y=="object"||typeof Y=="function")for(var ae=i(Y),be=0,_e=ae.length,we;be<_e;be++)we=ae[be],!c.call(T,we)&&we!==oe&&r(T,we,{get:(Se=>Y[Se]).bind(null,we),enumerable:!(ie=y(Y,we))||ie.enumerable});return T},d=(T,Y,oe)=>(oe=T!=null?e(u(T)):{},s(!T||!T.__esModule?r(oe,"default",{value:T,enumerable:!0}):oe,T));const b=d(Ie),I=d(qe);function A(T){let Y=(0,b.normalize)(T);return Y.length>1&&Y[Y.length-1]===b.sep&&(Y=Y.substring(0,Y.length-1)),Y}const D=/[\\/]/g;function w(T,Y){return T.replace(D,Y)}const P=/^[a-z]:[\\/]$/i;function _(T){return T==="/"||P.test(T)}function x(T,Y){const{resolvePaths:oe,normalizePath:ie,pathSeparator:ae}=Y,be=process.platform==="win32"&&T.includes("/")||T.startsWith(".");if(oe&&(T=(0,b.resolve)(T)),(ie||be)&&(T=A(T)),T===".")return"";const _e=T[T.length-1]!==ae;return w(_e?T+ae:T,ae)}function S(T,Y){return Y+T}function O(T,Y){return function(oe,ie){return ie.startsWith(T)?ie.slice(T.length)+oe:w((0,b.relative)(T,ie),Y.pathSeparator)+Y.pathSeparator+oe}}function M(T){return T}function L(T,Y,oe){return Y+T+oe}function F(T,Y){const{relativePaths:oe,includeBasePath:ie}=Y;return oe&&T?O(T,Y):ie?S:M}function E(T){return function(Y,oe){oe.push(Y.substring(T.length)||".")}}function R(T){return function(Y,oe,ie){const ae=Y.substring(T.length)||".";ie.every(be=>be(ae,!0))&&oe.push(ae)}}const H=(T,Y)=>{Y.push(T||".")},k=(T,Y,oe)=>{const ie=T||".";oe.every(ae=>ae(ie,!0))&&Y.push(ie)},N=()=>{};function V(T,Y){const{includeDirs:oe,filters:ie,relativePaths:ae}=Y;return oe?ae?ie&&ie.length?R(T):E(T):ie&&ie.length?k:H:N}const B=(T,Y,oe,ie)=>{ie.every(ae=>ae(T,!1))&&oe.files++},j=(T,Y,oe,ie)=>{ie.every(ae=>ae(T,!1))&&Y.push(T)},K=(T,Y,oe,ie)=>{oe.files++},C=(T,Y)=>{Y.push(T)},a=()=>{};function p(T){const{excludeFiles:Y,filters:oe,onlyCounts:ie}=T;return Y?a:oe&&oe.length?ie?B:j:ie?K:C}const o=T=>T,n=()=>[""].slice(0,0);function h(T){return T.group?n:o}const f=(T,Y,oe)=>{T.push({directory:Y,files:oe,dir:Y})},t=()=>{};function v(T){return T.group?f:t}const g=function(T,Y,oe){const{queue:ie,fs:ae,options:{suppressErrors:be}}=Y;ie.enqueue(),ae.realpath(T,(_e,we)=>{if(_e)return ie.dequeue(be?null:_e,Y);ae.stat(we,(Se,Be)=>{if(Se)return ie.dequeue(be?null:Se,Y);if(Be.isDirectory()&&Q(T,we,Y))return ie.dequeue(null,Y);oe(Be,we),ie.dequeue(null,Y)})})},l=function(T,Y,oe){const{queue:ie,fs:ae,options:{suppressErrors:be}}=Y;ie.enqueue();try{const _e=ae.realpathSync(T),we=ae.statSync(_e);if(we.isDirectory()&&Q(T,_e,Y))return;oe(we,_e)}catch(_e){if(!be)throw _e}};function m(T,Y){return!T.resolveSymlinks||T.excludeSymlinks?null:Y?l:g}function Q(T,Y,oe){if(oe.options.useRealPaths)return $(Y,oe);let ie=(0,b.dirname)(T),ae=1;for(;ie!==oe.root&&ae<2;){const be=oe.symlinks.get(ie);!!be&&(be===Y||be.startsWith(Y)||Y.startsWith(be))?ae++:ie=(0,b.dirname)(ie)}return oe.symlinks.set(T,Y),ae>1}function $(T,Y){return Y.visited.includes(T+Y.options.pathSeparator)}const q=T=>T.counts,G=T=>T.groups,X=T=>T.paths,z=T=>T.paths.slice(0,T.options.maxFiles),ee=(T,Y,oe)=>(ce(Y,oe,T.counts,T.options.suppressErrors),null),U=(T,Y,oe)=>(ce(Y,oe,T.paths,T.options.suppressErrors),null),Z=(T,Y,oe)=>(ce(Y,oe,T.paths.slice(0,T.options.maxFiles),T.options.suppressErrors),null),te=(T,Y,oe)=>(ce(Y,oe,T.groups,T.options.suppressErrors),null);function ce(T,Y,oe,ie){Y(T&&!ie?T:null,oe)}function le(T,Y){const{onlyCounts:oe,group:ie,maxFiles:ae}=T;return oe?Y?q:ee:ie?Y?G:te:ae?Y?z:Z:Y?X:U}const ne={withFileTypes:!0},de=(T,Y,oe,ie,ae)=>{if(T.queue.enqueue(),ie<0)return T.queue.dequeue(null,T);const{fs:be}=T;T.visited.push(Y),T.counts.directories++,be.readdir(Y||".",ne,(_e,we=[])=>{ae(we,oe,ie),T.queue.dequeue(T.options.suppressErrors?null:_e,T)})},W=(T,Y,oe,ie,ae)=>{const{fs:be}=T;if(ie<0)return;T.visited.push(Y),T.counts.directories++;let _e=[];try{_e=be.readdirSync(Y||".",ne)}catch(we){if(!T.options.suppressErrors)throw we}ae(_e,oe,ie)};function pe(T){return T?W:de}var me=class{count=0;constructor(T){this.onQueueEmpty=T}enqueue(){return this.count++,this.count}dequeue(T,Y){this.onQueueEmpty&&(--this.count<=0||T)&&(this.onQueueEmpty(T,Y),T&&(Y.controller.abort(),this.onQueueEmpty=void 0))}},fe=class{_files=0;_directories=0;set files(T){this._files=T}get files(){return this._files}set directories(T){this._directories=T}get directories(){return this._directories}get dirs(){return this._directories}},J=class{aborted=!1;abort(){this.aborted=!0}},se=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(T,Y,oe){this.isSynchronous=!oe,this.callbackInvoker=le(Y,this.isSynchronous),this.root=x(T,Y),this.state={root:_(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new fe,options:Y,queue:new me((ie,ae)=>this.callbackInvoker(ae,ie,oe)),symlinks:new Map,visited:[""].slice(0,0),controller:new J,fs:Y.fs||I},this.joinPath=F(this.root,Y),this.pushDirectory=V(this.root,Y),this.pushFile=p(Y),this.getArray=h(Y),this.groupFiles=v(Y),this.resolveSymlink=m(Y,this.isSynchronous),this.walkDirectory=pe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(T,Y,oe)=>{const{paths:ie,options:{filters:ae,resolveSymlinks:be,excludeSymlinks:_e,exclude:we,maxFiles:Se,signal:Be,useRealPaths:Ke,pathSeparator:ze},controller:it}=this.state;if(it.aborted||Be&&Be.aborted||Se&&ie.length>Se)return;const ft=this.getArray(this.state.paths);for(let dt=0;dt<T.length;++dt){const He=T[dt];if(He.isFile()||He.isSymbolicLink()&&!be&&!_e){const Ne=this.joinPath(He.name,Y);this.pushFile(Ne,ft,this.state.counts,ae)}else if(He.isDirectory()){let Ne=L(He.name,Y,this.state.options.pathSeparator);if(we&&we(He.name,Ne))continue;this.pushDirectory(Ne,ie,ae),this.walkDirectory(this.state,Ne,Ne,oe-1,this.walk)}else if(this.resolveSymlink&&He.isSymbolicLink()){let Ne=S(He.name,Y);this.resolveSymlink(Ne,this.state,(Ho,Ce)=>{if(Ho.isDirectory()){if(Ce=x(Ce,this.state.options),we&&we(He.name,Ke?Ce:Ne+ze))return;this.walkDirectory(this.state,Ce,Ke?Ce:Ne+ze,oe-1,this.walk)}else{Ce=Ke?Ce:Ne;const Lo=(0,b.basename)(Ce),Do=x((0,b.dirname)(Ce),this.state.options);Ce=this.joinPath(Lo,Do),this.pushFile(Ce,ft,this.state.counts,ae)}})}}this.groupFiles(this.state.groups,Y,ft)}};function re(T,Y){return new Promise((oe,ie)=>{ue(T,Y,(ae,be)=>{if(ae)return ie(ae);oe(be)})})}function ue(T,Y,oe){new se(T,Y,oe).start()}function he(T,Y){return new se(T,Y).start()}var ge=class{constructor(T,Y){this.root=T,this.options=Y}withPromise(){return re(this.root,this.options)}withCallback(T){ue(this.root,this.options,T)}sync(){return he(this.root,this.options)}};let ye=null;try{require.resolve("picomatch"),ye=Er()}catch{}var ve=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:b.sep,filters:[]};globFunction;constructor(T){this.options={...this.options,...T},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(T){return this.options.pathSeparator=T,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(T){return this.options.maxDepth=T,this}withMaxFiles(T){return this.options.maxFiles=T,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:T=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=T,this.withFullPaths()}withAbortSignal(T){return this.options.signal=T,this}normalize(){return this.options.normalizePath=!0,this}filter(T){return this.options.filters.push(T),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(T){return this.options.exclude=T,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(T){return new ge(T||".",this.options)}withGlobFunction(T){return this.globFunction=T,this}crawlWithOptions(T,Y){return this.options={...this.options,...Y},new ge(T||".",this.options)}glob(...T){return this.globFunction?this.globWithOptions(T):this.globWithOptions(T,{dot:!0})}globWithOptions(T,...Y){const oe=this.globFunction||ye;if(!oe)throw new Error("Please specify a glob function to use glob matching.");var ie=this.globCache[T.join("\0")];return ie||(ie=oe(T,...Y),this.globCache[T.join("\0")]=ie),this.options.filters.push(ae=>ie(ae)),this}};return gt.fdir=ve,gt}var At,wr;function ri(){if(wr)return At;wr=1;const{fdir:e}=ni(),r=Ie,y=Er();class i{constructor(c="./",s=[".env*"],d=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=r.resolve(c),this.envFile=s,this.excludeEnvFile=d}run(){return this._filepaths()}_filepaths(){const c=y(this._exclude()),s=y(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((d,b)=>c(b)).filter(d=>s(d)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(c=>`**/${c}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(c=>`**/${c}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}return At=i,At}var xt,Sr;function Ve(){if(Sr)return xt;Sr=1;const e=qe,r="utf8";function y(c,s=null){return s||(s=r),e.readFileSync(c,s)}function i(c,s){return e.writeFileSync(c,s,r)}return xt={chmodSync:e.chmodSync,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:y,writeFileX:i},xt}var Pe={exports:{}};const Ar="dotenv",xr="17.2.3",Br="Loads environment variables from .env file",Rr="lib/main.js",Ir="lib/main.d.ts",Or={".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},Tr={"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},Nr={type:"git",url:"git://github.com/motdotla/dotenv.git"},Cr="https://github.com/motdotla/dotenv#readme",Pr="https://dotenvx.com",Hr=["dotenv","env",".env","environment","variables","config","settings"],Lr="README.md",Dr="BSD-2-Clause",Kr={"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},qr={node:">=12"},Vr={fs:!1},si={name:Ar,version:xr,description:Br,main:Rr,types:Ir,exports:Or,scripts:Tr,repository:Nr,homepage:Cr,funding:Pr,keywords:Hr,readmeFilename:Lr,license:Dr,devDependencies:Kr,engines:qr,browser:Vr},oi={__proto__:null,browser:Vr,default:si,description:Br,devDependencies:Kr,engines:qr,exports:Or,funding:Pr,homepage:Cr,keywords:Hr,license:Dr,main:Rr,name:Ar,readmeFilename:Lr,repository:Nr,scripts:Tr,types:Ir,version:xr},ii=jn(oi);var kr;function ci(){if(kr)return Pe.exports;kr=1;const e=qe,r=Ie,y=kn,i=ko,c=ii.version,s=["\u{1F510} encrypt with Dotenvx: https://dotenvx.com","\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit","\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild","\u{1F4E1} add observability to secrets: https://dotenvx.com/ops","\u{1F465} sync secrets across teammates & machines: https://dotenvx.com/ops","\u{1F5C2}\uFE0F backup and recover secrets: https://dotenvx.com/ops","\u2705 audit secrets and track compliance: https://dotenvx.com/ops","\u{1F504} add secrets lifecycle management: https://dotenvx.com/ops","\u{1F511} add access controls to secrets: https://dotenvx.com/ops","\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`","\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }","\u2699\uFE0F enable debug logging with { debug: true }","\u2699\uFE0F override existing env vars with { override: true }","\u2699\uFE0F suppress all logs with { quiet: true }","\u2699\uFE0F write to custom object with { processEnv: myObject }","\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"];function d(){return s[Math.floor(Math.random()*s.length)]}function b(B){return typeof B=="string"?!["false","0","no","off",""].includes(B.toLowerCase()):!!B}function I(){return process.stdout.isTTY}function A(B){return I()?`\x1B[2m${B}\x1B[0m`:B}const D=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function w(B){const j={};let K=B.toString();K=K.replace(/\r\n?/mg,`
|
|
3
|
-
`);let
|
|
4
|
-
`),p=p.replace(/\\r/g,"\r")),j[a]=p}return j}function P(B){B=B||{};const j=L(B);B.path=j;const K=V.configDotenv(B);if(!K.parsed){const o=new Error(`MISSING_DATA: Cannot parse ${j} for an unknown reason`);throw o.code="MISSING_DATA",o}const C=O(B).split(","),a=C.length;let p;for(let o=0;o<a;o++)try{const n=C[o].trim(),h=M(K,n);p=V.decrypt(h.ciphertext,h.key);break}catch(n){if(o+1>=a)throw n}return V.parse(p)}function _(B){console.error(`[dotenv@${c}][WARN] ${B}`)}function x(B){console.log(`[dotenv@${c}][DEBUG] ${B}`)}function S(B){console.log(`[dotenv@${c}] ${B}`)}function O(B){return B&&B.DOTENV_KEY&&B.DOTENV_KEY.length>0?B.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function M(B,j){let K;try{K=new URL(j)}catch(n){if(n.code==="ERR_INVALID_URL"){const h=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw h.code="INVALID_DOTENV_KEY",h}throw n}const C=K.password;if(!C){const n=new Error("INVALID_DOTENV_KEY: Missing key part");throw n.code="INVALID_DOTENV_KEY",n}const a=K.searchParams.get("environment");if(!a){const n=new Error("INVALID_DOTENV_KEY: Missing environment part");throw n.code="INVALID_DOTENV_KEY",n}const p=`DOTENV_VAULT_${a.toUpperCase()}`,o=B.parsed[p];if(!o){const n=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${p} in your .env.vault file.`);throw n.code="NOT_FOUND_DOTENV_ENVIRONMENT",n}return{ciphertext:o,key:C}}function L(B){let j=null;if(B&&B.path&&B.path.length>0)if(Array.isArray(B.path))for(const K of B.path)e.existsSync(K)&&(j=K.endsWith(".vault")?K:`${K}.vault`);else j=B.path.endsWith(".vault")?B.path:`${B.path}.vault`;else j=r.resolve(process.cwd(),".env.vault");return e.existsSync(j)?j:null}function F(B){return B[0]==="~"?r.join(y.homedir(),B.slice(1)):B}function E(B){const j=b(process.env.DOTENV_CONFIG_DEBUG||B&&B.debug),K=b(process.env.DOTENV_CONFIG_QUIET||B&&B.quiet);(j||!K)&&S("Loading env from encrypted .env.vault");const C=V._parseVault(B);let a=process.env;return B&&B.processEnv!=null&&(a=B.processEnv),V.populate(a,C,B),{parsed:C}}function R(B){const j=r.resolve(process.cwd(),".env");let K="utf8",C=process.env;B&&B.processEnv!=null&&(C=B.processEnv);let a=b(C.DOTENV_CONFIG_DEBUG||B&&B.debug),p=b(C.DOTENV_CONFIG_QUIET||B&&B.quiet);B&&B.encoding?K=B.encoding:a&&x("No encoding is specified. UTF-8 is used by default");let o=[j];if(B&&B.path)if(!Array.isArray(B.path))o=[F(B.path)];else{o=[];for(const t of B.path)o.push(F(t))}let n;const h={};for(const t of o)try{const v=V.parse(e.readFileSync(t,{encoding:K}));V.populate(h,v,B)}catch(v){a&&x(`Failed to load ${t} ${v.message}`),n=v}const f=V.populate(C,h,B);if(a=b(C.DOTENV_CONFIG_DEBUG||a),p=b(C.DOTENV_CONFIG_QUIET||p),a||!p){const t=Object.keys(f).length,v=[];for(const g of o)try{const l=r.relative(process.cwd(),g);v.push(l)}catch(l){a&&x(`Failed to load ${g} ${l.message}`),n=l}S(`injecting env (${t}) from ${v.join(",")} ${A(`-- tip: ${d()}`)}`)}return n?{parsed:h,error:n}:{parsed:h}}function H(B){if(O(B).length===0)return V.configDotenv(B);const j=L(B);return j?V._configVault(B):(_(`You set DOTENV_KEY but you are missing a .env.vault file at ${j}. Did you forget to build it?`),V.configDotenv(B))}function k(B,j){const K=Buffer.from(j.slice(-64),"hex");let C=Buffer.from(B,"base64");const a=C.subarray(0,12),p=C.subarray(-16);C=C.subarray(12,-16);try{const o=i.createDecipheriv("aes-256-gcm",K,a);return o.setAuthTag(p),`${o.update(C)}${o.final()}`}catch(o){const n=o instanceof RangeError,h=o.message==="Invalid key length",f=o.message==="Unsupported state or unable to authenticate data";if(n||h){const t=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw t.code="INVALID_DOTENV_KEY",t}else if(f){const t=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw t.code="DECRYPTION_FAILED",t}else throw o}}function N(B,j,K={}){const C=!!(K&&K.debug),a=!!(K&&K.override),p={};if(typeof j!="object"){const o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(const o of Object.keys(j))Object.prototype.hasOwnProperty.call(B,o)?(a===!0&&(B[o]=j[o],p[o]=j[o]),C&&x(a===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(B[o]=j[o],p[o]=j[o]);return p}const V={configDotenv:R,_configVault:E,_parseVault:P,config:H,decrypt:k,parse:w,populate:N};return Pe.exports.configDotenv=V.configDotenv,Pe.exports._configVault=V._configVault,Pe.exports._parseVault=V._parseVault,Pe.exports.config=V.config,Pe.exports.decrypt=V.decrypt,Pe.exports.parse=V.parse,Pe.exports.populate=V.populate,Pe.exports=V,Pe.exports}var Bt,Fr;function ai(){if(Fr)return Bt;Fr=1;function e(r){let y;try{y=new URL(r)}catch{throw new Error("INVALID_DOTENV_KEY: Incomplete format. It should be a dotenv uri. (dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development)")}const i=y.password;if(!i)throw new Error("INVALID_DOTENV_KEY: Missing key part");return Buffer.from(i.slice(-64),"hex")}return Bt=e,Bt}var Rt,jr;function ui(){if(jr)return Rt;jr=1;const e=ci(),r=ai();function y(i,u){const c=r(u);try{return e.decrypt(i,c)}catch(s){if(s.code==="DECRYPTION_FAILED"){const d=new Error("[DECRYPTION_FAILED] Unable to decrypt .env.vault with DOTENV_KEY.");throw d.code="DECRYPTION_FAILED",d.help="[DECRYPTION_FAILED] Run with debug flag [dotenvx run --debug -- yourcommand] or manually run [echo $DOTENV_KEY] to compare it to the one in .env.keys.",d.debug=`[DECRYPTION_FAILED] DOTENV_KEY is ${u}`,d}if(s.code==="ERR_CRYPTO_INVALID_AUTH_TAG"){const d=new Error("[INVALID_CIPHERTEXT] Unable to decrypt what appears to be invalid ciphertext.");throw d.code="INVALID_CIPHERTEXT",d.help="[INVALID_CIPHERTEXT] Run with debug flag [dotenvx run --debug -- yourcommand] or manually check .env.vault.",d.debug=`[INVALID_CIPHERTEXT] ciphertext is '${i}'`,d}throw s}}return Rt=y,Rt}var It={},Ot={},Ur;function Le(){return Ur||(Ur=1,(function(e){/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=void 0,e.isBytes=r,e.abool=y,e.anumber=i,e.abytes=u,e.ahash=c,e.aexists=s,e.aoutput=d,e.u8=b,e.u32=I,e.clean=A,e.createView=D,e.bytesToHex=_,e.hexToBytes=O,e.hexToNumber=M,e.bytesToNumberBE=L,e.numberToBytesBE=F,e.utf8ToBytes=R,e.bytesToUtf8=H,e.toBytes=k,e.overlapBytes=N,e.complexOverlapBytes=V,e.concatBytes=B,e.checkOpts=j,e.equalBytes=K,e.getOutput=p,e.setBigUint64=o,e.u64Lengths=n,e.isAligned32=h,e.copyBytes=f;function r(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function y(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function i(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function u(t,...v){if(!r(t))throw new Error("Uint8Array expected");if(v.length>0&&!v.includes(t.length))throw new Error("Uint8Array expected of length "+v+", got length="+t.length)}function c(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");i(t.outputLen),i(t.blockLen)}function s(t,v=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(v&&t.finished)throw new Error("Hash#digest() has already been called")}function d(t,v){u(t);const g=v.outputLen;if(t.length<g)throw new Error("digestInto() expects output buffer of length at least "+g)}function b(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function I(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function A(...t){for(let v=0;v<t.length;v++)t[v].fill(0)}function D(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const w=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",P=Array.from({length:256},(t,v)=>v.toString(16).padStart(2,"0"));function _(t){if(u(t),w)return t.toHex();let v="";for(let g=0;g<t.length;g++)v+=P[t[g]];return v}const x={_0:48,_9:57,A:65,F:70,a:97,f:102};function S(t){if(t>=x._0&&t<=x._9)return t-x._0;if(t>=x.A&&t<=x.F)return t-(x.A-10);if(t>=x.a&&t<=x.f)return t-(x.a-10)}function O(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(w)return Uint8Array.fromHex(t);const v=t.length,g=v/2;if(v%2)throw new Error("hex string expected, got unpadded hex of length "+v);const l=new Uint8Array(g);for(let m=0,Q=0;m<g;m++,Q+=2){const $=S(t.charCodeAt(Q)),q=S(t.charCodeAt(Q+1));if($===void 0||q===void 0){const G=t[Q]+t[Q+1];throw new Error('hex string expected, got non-hex character "'+G+'" at index '+Q)}l[m]=$*16+q}return l}function M(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":"0x"+t)}function L(t){return M(_(t))}function F(t,v){return O(t.toString(16).padStart(v*2,"0"))}const E=async()=>{};e.nextTick=E;function R(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function H(t){return new TextDecoder().decode(t)}function k(t){if(typeof t=="string")t=R(t);else if(r(t))t=f(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function N(t,v){return t.buffer===v.buffer&&t.byteOffset<v.byteOffset+v.byteLength&&v.byteOffset<t.byteOffset+t.byteLength}function V(t,v){if(N(t,v)&&t.byteOffset<v.byteOffset)throw new Error("complex overlap of input and output is not supported")}function B(...t){let v=0;for(let l=0;l<t.length;l++){const m=t[l];u(m),v+=m.length}const g=new Uint8Array(v);for(let l=0,m=0;l<t.length;l++){const Q=t[l];g.set(Q,m),m+=Q.length}return g}function j(t,v){if(v==null||typeof v!="object")throw new Error("options must be defined");return Object.assign(t,v)}function K(t,v){if(t.length!==v.length)return!1;let g=0;for(let l=0;l<t.length;l++)g|=t[l]^v[l];return g===0}class C{}e.Hash=C;const a=(t,v)=>{function g(l,...m){if(u(l),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const z=m[0];if(!z)throw new Error("nonce / iv required");t.varSizeNonce?u(z):u(z,t.nonceLength)}const Q=t.tagLength;Q&&m[1]!==void 0&&u(m[1]);const $=v(l,...m),q=(z,ee)=>{if(ee!==void 0){if(z!==2)throw new Error("cipher output not supported");u(ee)}};let G=!1;return{encrypt(z,ee){if(G)throw new Error("cannot encrypt() twice with same key + nonce");return G=!0,u(z),q($.encrypt.length,ee),$.encrypt(z,ee)},decrypt(z,ee){if(u(z),Q&&z.length<Q)throw new Error("invalid ciphertext length: smaller than tagLength="+Q);return q($.decrypt.length,ee),$.decrypt(z,ee)}}}return Object.assign(g,t),g};e.wrapCipher=a;function p(t,v,g=!0){if(v===void 0)return new Uint8Array(t);if(v.length!==t)throw new Error("invalid output length, expected "+t+", got: "+v.length);if(g&&!h(v))throw new Error("invalid output, must be aligned");return v}function o(t,v,g,l){if(typeof t.setBigUint64=="function")return t.setBigUint64(v,g,l);const m=BigInt(32),Q=BigInt(4294967295),$=Number(g>>m&Q),q=Number(g&Q),G=l?4:0,X=l?0:4;t.setUint32(v+G,$,l),t.setUint32(v+X,q,l)}function n(t,v,g){y(g);const l=new Uint8Array(16),m=D(l);return o(m,0,BigInt(v),g),o(m,8,BigInt(t),g),l}function h(t){return t.byteOffset%4===0}function f(t){return Uint8Array.from(t)}})(Ot)),Ot}var Tt={},Re={},Mr;function Nt(){return Mr||(Mr=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.AEAD_TAG_LENGTH=Re.XCHACHA20_NONCE_LENGTH=Re.CURVE25519_PUBLIC_KEY_SIZE=Re.ETH_PUBLIC_KEY_SIZE=Re.UNCOMPRESSED_PUBLIC_KEY_SIZE=Re.COMPRESSED_PUBLIC_KEY_SIZE=Re.SECRET_KEY_LENGTH=void 0,Re.SECRET_KEY_LENGTH=32,Re.COMPRESSED_PUBLIC_KEY_SIZE=33,Re.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,Re.ETH_PUBLIC_KEY_SIZE=64,Re.CURVE25519_PUBLIC_KEY_SIZE=32,Re.XCHACHA20_NONCE_LENGTH=24,Re.AEAD_TAG_LENGTH=16),Re}var Gr;function ut(){return Gr||(Gr=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0;var r=Nt(),y=(function(){function I(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return I})();e.ECIES_CONFIG=new y;var i=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=i;var u=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=u;var c=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=c;var s=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=s;var d=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=d;var b=function(){var I={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?r.COMPRESSED_PUBLIC_KEY_SIZE:r.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:r.CURVE25519_PUBLIC_KEY_SIZE,ed25519:r.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in I)return I[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=b})(Tt)),Tt}var Ct={},Qe={},je={},Pt={},Ht={},Je={},Yr;function li(){return Yr||(Yr=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.crypto=void 0,Je.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),Je}var $r;function Zr(){return $r||($r=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=i,e.getWebcryptoSubtle=u,e.managedNonce=c;const r=li(),y=Le();function i(I=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(I));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(I));throw new Error("crypto.getRandomValues must be defined")}function u(){if(r.crypto&&typeof r.crypto.subtle=="object"&&r.crypto.subtle!=null)return r.crypto.subtle;throw new Error("crypto.subtle must be defined")}function c(I){const{nonceLength:A}=I;return(0,y.anumber)(A),((D,...w)=>({encrypt(P,..._){const x=i(A),S=I(D,x,...w).encrypt(P,..._),O=(0,y.concatBytes)(x,S);return S.fill(0),O},decrypt(P,..._){const x=P.subarray(0,A),S=P.subarray(A);return I(D,x,...w).decrypt(S,..._)}}))}e.utils={async encrypt(I,A,D,w){const P=u(),_=await P.importKey("raw",I,A,!0,["encrypt"]),x=await P.encrypt(D,_,w);return new Uint8Array(x)},async decrypt(I,A,D,w){const P=u(),_=await P.importKey("raw",I,A,!0,["decrypt"]),x=await P.decrypt(D,_,w);return new Uint8Array(x)}};const s={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function d(I,A,D){if(I===s.CBC)return{name:s.CBC,iv:A};if(I===s.CTR)return{name:s.CTR,counter:A,length:64};if(I===s.GCM)return D?{name:s.GCM,iv:A,additionalData:D}:{name:s.GCM,iv:A};throw new Error("unknown aes block mode")}function b(I){return(A,D,w)=>{(0,y.abytes)(A),(0,y.abytes)(D);const P={name:I,length:A.length*8},_=d(I,D,w);let x=!1;return{encrypt(S){if((0,y.abytes)(S),x)throw new Error("Cannot encrypt() twice with same key / nonce");return x=!0,e.utils.encrypt(A,P,_,S)},decrypt(S){return(0,y.abytes)(S),e.utils.decrypt(A,P,_,S)}}}}e.cbc=b(s.CBC),e.ctr=b(s.CTR),e.gcm=b(s.GCM)})(Ht)),Ht}var Lt={},Ae={},Oe={},Dt={},et={},Xr;function fi(){return Xr||(Xr=1,Object.defineProperty(et,"__esModule",{value:!0}),et.crypto=void 0,et.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),et}var Wr;function De(){return Wr||(Wr=1,(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=y,e.anumber=i,e.abytes=u,e.ahash=c,e.aexists=s,e.aoutput=d,e.u8=b,e.u32=I,e.clean=A,e.createView=D,e.rotr=w,e.rotl=P,e.byteSwap=_,e.byteSwap32=x,e.bytesToHex=M,e.hexToBytes=E,e.asyncLoop=H,e.utf8ToBytes=k,e.bytesToUtf8=N,e.toBytes=V,e.kdfInputToBytes=B,e.concatBytes=j,e.checkOpts=K,e.createHasher=a,e.createOptHasher=p,e.createXOFer=o,e.randomBytes=n;const r=fi();function y(h){return h instanceof Uint8Array||ArrayBuffer.isView(h)&&h.constructor.name==="Uint8Array"}function i(h){if(!Number.isSafeInteger(h)||h<0)throw new Error("positive integer expected, got "+h)}function u(h,...f){if(!y(h))throw new Error("Uint8Array expected");if(f.length>0&&!f.includes(h.length))throw new Error("Uint8Array expected of length "+f+", got length="+h.length)}function c(h){if(typeof h!="function"||typeof h.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");i(h.outputLen),i(h.blockLen)}function s(h,f=!0){if(h.destroyed)throw new Error("Hash instance has been destroyed");if(f&&h.finished)throw new Error("Hash#digest() has already been called")}function d(h,f){u(h);const t=f.outputLen;if(h.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function b(h){return new Uint8Array(h.buffer,h.byteOffset,h.byteLength)}function I(h){return new Uint32Array(h.buffer,h.byteOffset,Math.floor(h.byteLength/4))}function A(...h){for(let f=0;f<h.length;f++)h[f].fill(0)}function D(h){return new DataView(h.buffer,h.byteOffset,h.byteLength)}function w(h,f){return h<<32-f|h>>>f}function P(h,f){return h<<f|h>>>32-f>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function _(h){return h<<24&4278190080|h<<8&16711680|h>>>8&65280|h>>>24&255}e.swap8IfBE=e.isLE?h=>h:h=>_(h),e.byteSwapIfBE=e.swap8IfBE;function x(h){for(let f=0;f<h.length;f++)h[f]=_(h[f]);return h}e.swap32IfBE=e.isLE?h=>h:x;const S=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",O=Array.from({length:256},(h,f)=>f.toString(16).padStart(2,"0"));function M(h){if(u(h),S)return h.toHex();let f="";for(let t=0;t<h.length;t++)f+=O[h[t]];return f}const L={_0:48,_9:57,A:65,F:70,a:97,f:102};function F(h){if(h>=L._0&&h<=L._9)return h-L._0;if(h>=L.A&&h<=L.F)return h-(L.A-10);if(h>=L.a&&h<=L.f)return h-(L.a-10)}function E(h){if(typeof h!="string")throw new Error("hex string expected, got "+typeof h);if(S)return Uint8Array.fromHex(h);const f=h.length,t=f/2;if(f%2)throw new Error("hex string expected, got unpadded hex of length "+f);const v=new Uint8Array(t);for(let g=0,l=0;g<t;g++,l+=2){const m=F(h.charCodeAt(l)),Q=F(h.charCodeAt(l+1));if(m===void 0||Q===void 0){const $=h[l]+h[l+1];throw new Error('hex string expected, got non-hex character "'+$+'" at index '+l)}v[g]=m*16+Q}return v}const R=async()=>{};e.nextTick=R;async function H(h,f,t){let v=Date.now();for(let g=0;g<h;g++){t(g);const l=Date.now()-v;l>=0&&l<f||(await(0,e.nextTick)(),v+=l)}}function k(h){if(typeof h!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(h))}function N(h){return new TextDecoder().decode(h)}function V(h){return typeof h=="string"&&(h=k(h)),u(h),h}function B(h){return typeof h=="string"&&(h=k(h)),u(h),h}function j(...h){let f=0;for(let v=0;v<h.length;v++){const g=h[v];u(g),f+=g.length}const t=new Uint8Array(f);for(let v=0,g=0;v<h.length;v++){const l=h[v];t.set(l,g),g+=l.length}return t}function K(h,f){if(f!==void 0&&{}.toString.call(f)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(h,f)}class C{}e.Hash=C;function a(h){const f=v=>h().update(V(v)).digest(),t=h();return f.outputLen=t.outputLen,f.blockLen=t.blockLen,f.create=()=>h(),f}function p(h){const f=(v,g)=>h(g).update(V(v)).digest(),t=h({});return f.outputLen=t.outputLen,f.blockLen=t.blockLen,f.create=v=>h(v),f}function o(h){const f=(v,g)=>h(g).update(V(v)).digest(),t=h({});return f.outputLen=t.outputLen,f.blockLen=t.blockLen,f.create=v=>h(v),f}e.wrapConstructor=a,e.wrapConstructorWithOpts=p,e.wrapXOFConstructorWithOpts=o;function n(h=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(h));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(h));throw new Error("crypto.getRandomValues must be defined")}})(Dt)),Dt}var zr;function di(){if(zr)return Oe;zr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.SHA512_IV=Oe.SHA384_IV=Oe.SHA224_IV=Oe.SHA256_IV=Oe.HashMD=void 0,Oe.setBigUint64=r,Oe.Chi=y,Oe.Maj=i;const e=De();function r(c,s,d,b){if(typeof c.setBigUint64=="function")return c.setBigUint64(s,d,b);const I=BigInt(32),A=BigInt(4294967295),D=Number(d>>I&A),w=Number(d&A),P=b?4:0,_=b?0:4;c.setUint32(s+P,D,b),c.setUint32(s+_,w,b)}function y(c,s,d){return c&s^~c&d}function i(c,s,d){return c&s^c&d^s&d}class u extends e.Hash{constructor(s,d,b,I){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=s,this.outputLen=d,this.padOffset=b,this.isLE=I,this.buffer=new Uint8Array(s),this.view=(0,e.createView)(this.buffer)}update(s){(0,e.aexists)(this),s=(0,e.toBytes)(s),(0,e.abytes)(s);const{view:d,buffer:b,blockLen:I}=this,A=s.length;for(let D=0;D<A;){const w=Math.min(I-this.pos,A-D);if(w===I){const P=(0,e.createView)(s);for(;I<=A-D;D+=I)this.process(P,D);continue}b.set(s.subarray(D,D+w),this.pos),this.pos+=w,D+=w,this.pos===I&&(this.process(d,0),this.pos=0)}return this.length+=s.length,this.roundClean(),this}digestInto(s){(0,e.aexists)(this),(0,e.aoutput)(s,this),this.finished=!0;const{buffer:d,view:b,blockLen:I,isLE:A}=this;let{pos:D}=this;d[D++]=128,(0,e.clean)(this.buffer.subarray(D)),this.padOffset>I-D&&(this.process(b,0),D=0);for(let S=D;S<I;S++)d[S]=0;r(b,I-8,BigInt(this.length*8),A),this.process(b,0);const w=(0,e.createView)(s),P=this.outputLen;if(P%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const _=P/4,x=this.get();if(_>x.length)throw new Error("_sha2: outputLen bigger than state");for(let S=0;S<_;S++)w.setUint32(4*S,x[S],A)}digest(){const{buffer:s,outputLen:d}=this;this.digestInto(s);const b=s.slice(0,d);return this.destroy(),b}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());const{blockLen:d,buffer:b,length:I,finished:A,destroyed:D,pos:w}=this;return s.destroyed=D,s.finished=A,s.length=I,s.pos=w,I%d&&s.buffer.set(b),s}clone(){return this._cloneInto()}}return Oe.HashMD=u,Oe.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oe.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),Oe.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Oe.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Oe}var Ee={},Qr;function hi(){if(Qr)return Ee;Qr=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.toBig=Ee.shrSL=Ee.shrSH=Ee.rotrSL=Ee.rotrSH=Ee.rotrBL=Ee.rotrBH=Ee.rotr32L=Ee.rotr32H=Ee.rotlSL=Ee.rotlSH=Ee.rotlBL=Ee.rotlBH=Ee.add5L=Ee.add5H=Ee.add4L=Ee.add4H=Ee.add3L=Ee.add3H=void 0,Ee.add=O,Ee.fromBig=y,Ee.split=i;const e=BigInt(2**32-1),r=BigInt(32);function y(N,V=!1){return V?{h:Number(N&e),l:Number(N>>r&e)}:{h:Number(N>>r&e)|0,l:Number(N&e)|0}}function i(N,V=!1){const B=N.length;let j=new Uint32Array(B),K=new Uint32Array(B);for(let C=0;C<B;C++){const{h:a,l:p}=y(N[C],V);[j[C],K[C]]=[a,p]}return[j,K]}const u=(N,V)=>BigInt(N>>>0)<<r|BigInt(V>>>0);Ee.toBig=u;const c=(N,V,B)=>N>>>B;Ee.shrSH=c;const s=(N,V,B)=>N<<32-B|V>>>B;Ee.shrSL=s;const d=(N,V,B)=>N>>>B|V<<32-B;Ee.rotrSH=d;const b=(N,V,B)=>N<<32-B|V>>>B;Ee.rotrSL=b;const I=(N,V,B)=>N<<64-B|V>>>B-32;Ee.rotrBH=I;const A=(N,V,B)=>N>>>B-32|V<<64-B;Ee.rotrBL=A;const D=(N,V)=>V;Ee.rotr32H=D;const w=(N,V)=>N;Ee.rotr32L=w;const P=(N,V,B)=>N<<B|V>>>32-B;Ee.rotlSH=P;const _=(N,V,B)=>V<<B|N>>>32-B;Ee.rotlSL=_;const x=(N,V,B)=>V<<B-32|N>>>64-B;Ee.rotlBH=x;const S=(N,V,B)=>N<<B-32|V>>>64-B;Ee.rotlBL=S;function O(N,V,B,j){const K=(V>>>0)+(j>>>0);return{h:N+B+(K/2**32|0)|0,l:K|0}}const M=(N,V,B)=>(N>>>0)+(V>>>0)+(B>>>0);Ee.add3L=M;const L=(N,V,B,j)=>V+B+j+(N/2**32|0)|0;Ee.add3H=L;const F=(N,V,B,j)=>(N>>>0)+(V>>>0)+(B>>>0)+(j>>>0);Ee.add4L=F;const E=(N,V,B,j,K)=>V+B+j+K+(N/2**32|0)|0;Ee.add4H=E;const R=(N,V,B,j,K)=>(N>>>0)+(V>>>0)+(B>>>0)+(j>>>0)+(K>>>0);Ee.add5L=R;const H=(N,V,B,j,K,C)=>V+B+j+K+C+(N/2**32|0)|0;Ee.add5H=H;const k={fromBig:y,split:i,toBig:u,shrSH:c,shrSL:s,rotrSH:d,rotrSL:b,rotrBH:I,rotrBL:A,rotr32H:D,rotr32L:w,rotlSH:P,rotlSL:_,rotlBH:x,rotlBL:S,add:O,add3L:M,add3H:L,add4L:F,add4H:E,add5H:H,add5L:R};return Ee.default=k,Ee}var Jr;function Kt(){if(Jr)return Ae;Jr=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.sha512_224=Ae.sha512_256=Ae.sha384=Ae.sha512=Ae.sha224=Ae.sha256=Ae.SHA512_256=Ae.SHA512_224=Ae.SHA384=Ae.SHA512=Ae.SHA224=Ae.SHA256=void 0;const e=di(),r=hi(),y=De(),i=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),u=new Uint32Array(64);class c extends e.HashMD{constructor(L=32){super(64,L,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:L,B:F,C:E,D:R,E:H,F:k,G:N,H:V}=this;return[L,F,E,R,H,k,N,V]}set(L,F,E,R,H,k,N,V){this.A=L|0,this.B=F|0,this.C=E|0,this.D=R|0,this.E=H|0,this.F=k|0,this.G=N|0,this.H=V|0}process(L,F){for(let K=0;K<16;K++,F+=4)u[K]=L.getUint32(F,!1);for(let K=16;K<64;K++){const C=u[K-15],a=u[K-2],p=(0,y.rotr)(C,7)^(0,y.rotr)(C,18)^C>>>3,o=(0,y.rotr)(a,17)^(0,y.rotr)(a,19)^a>>>10;u[K]=o+u[K-7]+p+u[K-16]|0}let{A:E,B:R,C:H,D:k,E:N,F:V,G:B,H:j}=this;for(let K=0;K<64;K++){const C=(0,y.rotr)(N,6)^(0,y.rotr)(N,11)^(0,y.rotr)(N,25),a=j+C+(0,e.Chi)(N,V,B)+i[K]+u[K]|0,o=((0,y.rotr)(E,2)^(0,y.rotr)(E,13)^(0,y.rotr)(E,22))+(0,e.Maj)(E,R,H)|0;j=B,B=V,V=N,N=k+a|0,k=H,H=R,R=E,E=a+o|0}E=E+this.A|0,R=R+this.B|0,H=H+this.C|0,k=k+this.D|0,N=N+this.E|0,V=V+this.F|0,B=B+this.G|0,j=j+this.H|0,this.set(E,R,H,k,N,V,B,j)}roundClean(){(0,y.clean)(u)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,y.clean)(this.buffer)}}Ae.SHA256=c;class s extends c{constructor(){super(28),this.A=e.SHA224_IV[0]|0,this.B=e.SHA224_IV[1]|0,this.C=e.SHA224_IV[2]|0,this.D=e.SHA224_IV[3]|0,this.E=e.SHA224_IV[4]|0,this.F=e.SHA224_IV[5]|0,this.G=e.SHA224_IV[6]|0,this.H=e.SHA224_IV[7]|0}}Ae.SHA224=s;const d=r.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(M=>BigInt(M))),b=d[0],I=d[1],A=new Uint32Array(80),D=new Uint32Array(80);class w extends e.HashMD{constructor(L=64){super(128,L,16,!1),this.Ah=e.SHA512_IV[0]|0,this.Al=e.SHA512_IV[1]|0,this.Bh=e.SHA512_IV[2]|0,this.Bl=e.SHA512_IV[3]|0,this.Ch=e.SHA512_IV[4]|0,this.Cl=e.SHA512_IV[5]|0,this.Dh=e.SHA512_IV[6]|0,this.Dl=e.SHA512_IV[7]|0,this.Eh=e.SHA512_IV[8]|0,this.El=e.SHA512_IV[9]|0,this.Fh=e.SHA512_IV[10]|0,this.Fl=e.SHA512_IV[11]|0,this.Gh=e.SHA512_IV[12]|0,this.Gl=e.SHA512_IV[13]|0,this.Hh=e.SHA512_IV[14]|0,this.Hl=e.SHA512_IV[15]|0}get(){const{Ah:L,Al:F,Bh:E,Bl:R,Ch:H,Cl:k,Dh:N,Dl:V,Eh:B,El:j,Fh:K,Fl:C,Gh:a,Gl:p,Hh:o,Hl:n}=this;return[L,F,E,R,H,k,N,V,B,j,K,C,a,p,o,n]}set(L,F,E,R,H,k,N,V,B,j,K,C,a,p,o,n){this.Ah=L|0,this.Al=F|0,this.Bh=E|0,this.Bl=R|0,this.Ch=H|0,this.Cl=k|0,this.Dh=N|0,this.Dl=V|0,this.Eh=B|0,this.El=j|0,this.Fh=K|0,this.Fl=C|0,this.Gh=a|0,this.Gl=p|0,this.Hh=o|0,this.Hl=n|0}process(L,F){for(let t=0;t<16;t++,F+=4)A[t]=L.getUint32(F),D[t]=L.getUint32(F+=4);for(let t=16;t<80;t++){const v=A[t-15]|0,g=D[t-15]|0,l=r.rotrSH(v,g,1)^r.rotrSH(v,g,8)^r.shrSH(v,g,7),m=r.rotrSL(v,g,1)^r.rotrSL(v,g,8)^r.shrSL(v,g,7),Q=A[t-2]|0,$=D[t-2]|0,q=r.rotrSH(Q,$,19)^r.rotrBH(Q,$,61)^r.shrSH(Q,$,6),G=r.rotrSL(Q,$,19)^r.rotrBL(Q,$,61)^r.shrSL(Q,$,6),X=r.add4L(m,G,D[t-7],D[t-16]),z=r.add4H(X,l,q,A[t-7],A[t-16]);A[t]=z|0,D[t]=X|0}let{Ah:E,Al:R,Bh:H,Bl:k,Ch:N,Cl:V,Dh:B,Dl:j,Eh:K,El:C,Fh:a,Fl:p,Gh:o,Gl:n,Hh:h,Hl:f}=this;for(let t=0;t<80;t++){const v=r.rotrSH(K,C,14)^r.rotrSH(K,C,18)^r.rotrBH(K,C,41),g=r.rotrSL(K,C,14)^r.rotrSL(K,C,18)^r.rotrBL(K,C,41),l=K&a^~K&o,m=C&p^~C&n,Q=r.add5L(f,g,m,I[t],D[t]),$=r.add5H(Q,h,v,l,b[t],A[t]),q=Q|0,G=r.rotrSH(E,R,28)^r.rotrBH(E,R,34)^r.rotrBH(E,R,39),X=r.rotrSL(E,R,28)^r.rotrBL(E,R,34)^r.rotrBL(E,R,39),z=E&H^E&N^H&N,ee=R&k^R&V^k&V;h=o|0,f=n|0,o=a|0,n=p|0,a=K|0,p=C|0,{h:K,l:C}=r.add(B|0,j|0,$|0,q|0),B=N|0,j=V|0,N=H|0,V=k|0,H=E|0,k=R|0;const U=r.add3L(q,X,ee);E=r.add3H(U,$,G,z),R=U|0}({h:E,l:R}=r.add(this.Ah|0,this.Al|0,E|0,R|0)),{h:H,l:k}=r.add(this.Bh|0,this.Bl|0,H|0,k|0),{h:N,l:V}=r.add(this.Ch|0,this.Cl|0,N|0,V|0),{h:B,l:j}=r.add(this.Dh|0,this.Dl|0,B|0,j|0),{h:K,l:C}=r.add(this.Eh|0,this.El|0,K|0,C|0),{h:a,l:p}=r.add(this.Fh|0,this.Fl|0,a|0,p|0),{h:o,l:n}=r.add(this.Gh|0,this.Gl|0,o|0,n|0),{h,l:f}=r.add(this.Hh|0,this.Hl|0,h|0,f|0),this.set(E,R,H,k,N,V,B,j,K,C,a,p,o,n,h,f)}roundClean(){(0,y.clean)(A,D)}destroy(){(0,y.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}Ae.SHA512=w;class P extends w{constructor(){super(48),this.Ah=e.SHA384_IV[0]|0,this.Al=e.SHA384_IV[1]|0,this.Bh=e.SHA384_IV[2]|0,this.Bl=e.SHA384_IV[3]|0,this.Ch=e.SHA384_IV[4]|0,this.Cl=e.SHA384_IV[5]|0,this.Dh=e.SHA384_IV[6]|0,this.Dl=e.SHA384_IV[7]|0,this.Eh=e.SHA384_IV[8]|0,this.El=e.SHA384_IV[9]|0,this.Fh=e.SHA384_IV[10]|0,this.Fl=e.SHA384_IV[11]|0,this.Gh=e.SHA384_IV[12]|0,this.Gl=e.SHA384_IV[13]|0,this.Hh=e.SHA384_IV[14]|0,this.Hl=e.SHA384_IV[15]|0}}Ae.SHA384=P;const _=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),x=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class S extends w{constructor(){super(28),this.Ah=_[0]|0,this.Al=_[1]|0,this.Bh=_[2]|0,this.Bl=_[3]|0,this.Ch=_[4]|0,this.Cl=_[5]|0,this.Dh=_[6]|0,this.Dl=_[7]|0,this.Eh=_[8]|0,this.El=_[9]|0,this.Fh=_[10]|0,this.Fl=_[11]|0,this.Gh=_[12]|0,this.Gl=_[13]|0,this.Hh=_[14]|0,this.Hl=_[15]|0}}Ae.SHA512_224=S;class O extends w{constructor(){super(32),this.Ah=x[0]|0,this.Al=x[1]|0,this.Bh=x[2]|0,this.Bl=x[3]|0,this.Ch=x[4]|0,this.Cl=x[5]|0,this.Dh=x[6]|0,this.Dl=x[7]|0,this.Eh=x[8]|0,this.El=x[9]|0,this.Fh=x[10]|0,this.Fl=x[11]|0,this.Gh=x[12]|0,this.Gl=x[13]|0,this.Hh=x[14]|0,this.Hl=x[15]|0}}return Ae.SHA512_256=O,Ae.sha256=(0,y.createHasher)(()=>new c),Ae.sha224=(0,y.createHasher)(()=>new s),Ae.sha512=(0,y.createHasher)(()=>new w),Ae.sha384=(0,y.createHasher)(()=>new P),Ae.sha512_256=(0,y.createHasher)(()=>new O),Ae.sha512_224=(0,y.createHasher)(()=>new S),Ae}var Te={},qt={},es;function ke(){return es||(es=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.notImplemented=e.bitMask=e.utf8ToBytes=e.randomBytes=e.isBytes=e.hexToBytes=e.concatBytes=e.bytesToUtf8=e.bytesToHex=e.anumber=e.abytes=void 0,e.abool=c,e._abool2=s,e._abytes2=d,e.numberToHexUnpadded=b,e.hexToNumber=I,e.bytesToNumberBE=A,e.bytesToNumberLE=D,e.numberToBytesBE=w,e.numberToBytesLE=P,e.numberToVarBytesBE=_,e.ensureBytes=x,e.equalBytes=S,e.copyBytes=O,e.asciiToBytes=M,e.inRange=F,e.aInRange=E,e.bitLen=R,e.bitGet=H,e.bitSet=k,e.createHmacDrbg=V,e.validateObject=j,e.isHash=K,e._validateObject=C,e.memoized=p;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=De();var y=De();Object.defineProperty(e,"abytes",{enumerable:!0,get:function(){return y.abytes}}),Object.defineProperty(e,"anumber",{enumerable:!0,get:function(){return y.anumber}}),Object.defineProperty(e,"bytesToHex",{enumerable:!0,get:function(){return y.bytesToHex}}),Object.defineProperty(e,"bytesToUtf8",{enumerable:!0,get:function(){return y.bytesToUtf8}}),Object.defineProperty(e,"concatBytes",{enumerable:!0,get:function(){return y.concatBytes}}),Object.defineProperty(e,"hexToBytes",{enumerable:!0,get:function(){return y.hexToBytes}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return y.isBytes}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return y.randomBytes}}),Object.defineProperty(e,"utf8ToBytes",{enumerable:!0,get:function(){return y.utf8ToBytes}});const i=BigInt(0),u=BigInt(1);function c(o,n){if(typeof n!="boolean")throw new Error(o+" boolean expected, got "+n)}function s(o,n=""){if(typeof o!="boolean"){const h=n&&`"${n}"`;throw new Error(h+"expected boolean, got type="+typeof o)}return o}function d(o,n,h=""){const f=(0,r.isBytes)(o),t=o?.length,v=n!==void 0;if(!f||v&&t!==n){const g=h&&`"${h}" `,l=v?` of length ${n}`:"",m=f?`length=${t}`:`type=${typeof o}`;throw new Error(g+"expected Uint8Array"+l+", got "+m)}return o}function b(o){const n=o.toString(16);return n.length&1?"0"+n:n}function I(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);return o===""?i:BigInt("0x"+o)}function A(o){return I((0,r.bytesToHex)(o))}function D(o){return(0,r.abytes)(o),I((0,r.bytesToHex)(Uint8Array.from(o).reverse()))}function w(o,n){return(0,r.hexToBytes)(o.toString(16).padStart(n*2,"0"))}function P(o,n){return w(o,n).reverse()}function _(o){return(0,r.hexToBytes)(b(o))}function x(o,n,h){let f;if(typeof n=="string")try{f=(0,r.hexToBytes)(n)}catch(v){throw new Error(o+" must be hex string or Uint8Array, cause: "+v)}else if((0,r.isBytes)(n))f=Uint8Array.from(n);else throw new Error(o+" must be hex string or Uint8Array");const t=f.length;if(typeof h=="number"&&t!==h)throw new Error(o+" of length "+h+" expected, got "+t);return f}function S(o,n){if(o.length!==n.length)return!1;let h=0;for(let f=0;f<o.length;f++)h|=o[f]^n[f];return h===0}function O(o){return Uint8Array.from(o)}function M(o){return Uint8Array.from(o,(n,h)=>{const f=n.charCodeAt(0);if(n.length!==1||f>127)throw new Error(`string contains non-ASCII character "${o[h]}" with code ${f} at position ${h}`);return f})}const L=o=>typeof o=="bigint"&&i<=o;function F(o,n,h){return L(o)&&L(n)&&L(h)&&n<=o&&o<h}function E(o,n,h,f){if(!F(n,h,f))throw new Error("expected valid "+o+": "+h+" <= n < "+f+", got "+n)}function R(o){let n;for(n=0;o>i;o>>=u,n+=1);return n}function H(o,n){return o>>BigInt(n)&u}function k(o,n,h){return o|(h?u:i)<<BigInt(n)}const N=o=>(u<<BigInt(o))-u;e.bitMask=N;function V(o,n,h){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof n!="number"||n<2)throw new Error("qByteLen must be a number");if(typeof h!="function")throw new Error("hmacFn must be a function");const f=X=>new Uint8Array(X),t=X=>Uint8Array.of(X);let v=f(o),g=f(o),l=0;const m=()=>{v.fill(1),g.fill(0),l=0},Q=(...X)=>h(g,v,...X),$=(X=f(0))=>{g=Q(t(0),X),v=Q(),X.length!==0&&(g=Q(t(1),X),v=Q())},q=()=>{if(l++>=1e3)throw new Error("drbg: tried 1000 values");let X=0;const z=[];for(;X<n;){v=Q();const ee=v.slice();z.push(ee),X+=v.length}return(0,r.concatBytes)(...z)};return(X,z)=>{m(),$(X);let ee;for(;!(ee=z(q()));)$();return m(),ee}}const B={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||(0,r.isBytes)(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,n)=>n.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function j(o,n,h={}){const f=(t,v,g)=>{const l=B[v];if(typeof l!="function")throw new Error("invalid validator function");const m=o[t];if(!(g&&m===void 0)&&!l(m,o))throw new Error("param "+String(t)+" is invalid. Expected "+v+", got "+m)};for(const[t,v]of Object.entries(n))f(t,v,!1);for(const[t,v]of Object.entries(h))f(t,v,!0);return o}function K(o){return typeof o=="function"&&Number.isSafeInteger(o.outputLen)}function C(o,n,h={}){if(!o||typeof o!="object")throw new Error("expected valid options object");function f(t,v,g){const l=o[t];if(g&&l===void 0)return;const m=typeof l;if(m!==v||l===null)throw new Error(`param "${t}" is invalid: expected ${v}, got ${m}`)}Object.entries(n).forEach(([t,v])=>f(t,v,!1)),Object.entries(h).forEach(([t,v])=>f(t,v,!0))}const a=()=>{throw new Error("not implemented")};e.notImplemented=a;function p(o){const n=new WeakMap;return(h,...f)=>{const t=n.get(h);if(t!==void 0)return t;const v=o(h,...f);return n.set(h,v),v}}})(qt)),qt}var xe={},ts;function Ue(){if(ts)return xe;ts=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.isNegativeLE=void 0,xe.mod=D,xe.pow=w,xe.pow2=P,xe.invert=_,xe.tonelliShanks=L,xe.FpSqrt=F,xe.validateField=H,xe.FpPow=k,xe.FpInvertBatch=N,xe.FpDiv=V,xe.FpLegendre=B,xe.FpIsSquare=j,xe.nLength=K,xe.Field=C,xe.FpSqrtOdd=a,xe.FpSqrtEven=p,xe.hashToPrivateScalar=o,xe.getFieldBytesLength=n,xe.getMinHashLength=h,xe.mapHashToField=f;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=BigInt(0),y=BigInt(1),i=BigInt(2),u=BigInt(3),c=BigInt(4),s=BigInt(5),d=BigInt(7),b=BigInt(8),I=BigInt(9),A=BigInt(16);function D(t,v){const g=t%v;return g>=r?g:v+g}function w(t,v,g){return k(C(g),t,v)}function P(t,v,g){let l=t;for(;v-- >r;)l*=l,l%=g;return l}function _(t,v){if(t===r)throw new Error("invert: expected non-zero number");if(v<=r)throw new Error("invert: expected positive modulus, got "+v);let g=D(t,v),l=v,m=r,Q=y;for(;g!==r;){const q=l/g,G=l%g,X=m-Q*q;l=g,g=G,m=Q,Q=X}if(l!==y)throw new Error("invert: does not exist");return D(m,v)}function x(t,v,g){if(!t.eql(t.sqr(v),g))throw new Error("Cannot find square root")}function S(t,v){const g=(t.ORDER+y)/c,l=t.pow(v,g);return x(t,l,v),l}function O(t,v){const g=(t.ORDER-s)/b,l=t.mul(v,i),m=t.pow(l,g),Q=t.mul(v,m),$=t.mul(t.mul(Q,i),m),q=t.mul(Q,t.sub($,t.ONE));return x(t,q,v),q}function M(t){const v=C(t),g=L(t),l=g(v,v.neg(v.ONE)),m=g(v,l),Q=g(v,v.neg(l)),$=(t+d)/A;return(q,G)=>{let X=q.pow(G,$),z=q.mul(X,l);const ee=q.mul(X,m),U=q.mul(X,Q),Z=q.eql(q.sqr(z),G),te=q.eql(q.sqr(ee),G);X=q.cmov(X,z,Z),z=q.cmov(U,ee,te);const ce=q.eql(q.sqr(z),G),le=q.cmov(X,z,ce);return x(q,le,G),le}}function L(t){if(t<u)throw new Error("sqrt is not defined for small field");let v=t-y,g=0;for(;v%i===r;)v/=i,g++;let l=i;const m=C(t);for(;B(m,l)===1;)if(l++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(g===1)return S;let Q=m.pow(l,v);const $=(v+y)/i;return function(G,X){if(G.is0(X))return X;if(B(G,X)!==1)throw new Error("Cannot find square root");let z=g,ee=G.mul(G.ONE,Q),U=G.pow(X,v),Z=G.pow(X,$);for(;!G.eql(U,G.ONE);){if(G.is0(U))return G.ZERO;let te=1,ce=G.sqr(U);for(;!G.eql(ce,G.ONE);)if(te++,ce=G.sqr(ce),te===z)throw new Error("Cannot find square root");const le=y<<BigInt(z-te-1),ne=G.pow(ee,le);z=te,ee=G.sqr(ne),U=G.mul(U,ee),Z=G.mul(Z,ne)}return Z}}function F(t){return t%c===u?S:t%b===s?O:t%A===I?M(t):L(t)}const E=(t,v)=>(D(t,v)&y)===y;xe.isNegativeLE=E;const R=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function H(t){const v={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},g=R.reduce((l,m)=>(l[m]="function",l),v);return(0,e._validateObject)(t,g),t}function k(t,v,g){if(g<r)throw new Error("invalid exponent, negatives unsupported");if(g===r)return t.ONE;if(g===y)return v;let l=t.ONE,m=v;for(;g>r;)g&y&&(l=t.mul(l,m)),m=t.sqr(m),g>>=y;return l}function N(t,v,g=!1){const l=new Array(v.length).fill(g?t.ZERO:void 0),m=v.reduce(($,q,G)=>t.is0(q)?$:(l[G]=$,t.mul($,q)),t.ONE),Q=t.inv(m);return v.reduceRight(($,q,G)=>t.is0(q)?$:(l[G]=t.mul($,l[G]),t.mul($,q)),Q),l}function V(t,v,g){return t.mul(v,typeof g=="bigint"?_(g,t.ORDER):t.inv(g))}function B(t,v){const g=(t.ORDER-y)/i,l=t.pow(v,g),m=t.eql(l,t.ONE),Q=t.eql(l,t.ZERO),$=t.eql(l,t.neg(t.ONE));if(!m&&!Q&&!$)throw new Error("invalid Legendre symbol result");return m?1:Q?0:-1}function j(t,v){return B(t,v)===1}function K(t,v){v!==void 0&&(0,e.anumber)(v);const g=v!==void 0?v:t.toString(2).length,l=Math.ceil(g/8);return{nBitLength:g,nByteLength:l}}function C(t,v,g=!1,l={}){if(t<=r)throw new Error("invalid field: expected ORDER > 0, got "+t);let m,Q,$=!1,q;if(typeof v=="object"&&v!=null){if(l.sqrt||g)throw new Error("cannot specify opts in two arguments");const U=v;U.BITS&&(m=U.BITS),U.sqrt&&(Q=U.sqrt),typeof U.isLE=="boolean"&&(g=U.isLE),typeof U.modFromBytes=="boolean"&&($=U.modFromBytes),q=U.allowedLengths}else typeof v=="number"&&(m=v),l.sqrt&&(Q=l.sqrt);const{nBitLength:G,nByteLength:X}=K(t,m);if(X>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let z;const ee=Object.freeze({ORDER:t,isLE:g,BITS:G,BYTES:X,MASK:(0,e.bitMask)(G),ZERO:r,ONE:y,allowedLengths:q,create:U=>D(U,t),isValid:U=>{if(typeof U!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof U);return r<=U&&U<t},is0:U=>U===r,isValidNot0:U=>!ee.is0(U)&&ee.isValid(U),isOdd:U=>(U&y)===y,neg:U=>D(-U,t),eql:(U,Z)=>U===Z,sqr:U=>D(U*U,t),add:(U,Z)=>D(U+Z,t),sub:(U,Z)=>D(U-Z,t),mul:(U,Z)=>D(U*Z,t),pow:(U,Z)=>k(ee,U,Z),div:(U,Z)=>D(U*_(Z,t),t),sqrN:U=>U*U,addN:(U,Z)=>U+Z,subN:(U,Z)=>U-Z,mulN:(U,Z)=>U*Z,inv:U=>_(U,t),sqrt:Q||(U=>(z||(z=F(t)),z(ee,U))),toBytes:U=>g?(0,e.numberToBytesLE)(U,X):(0,e.numberToBytesBE)(U,X),fromBytes:(U,Z=!0)=>{if(q){if(!q.includes(U.length)||U.length>X)throw new Error("Field.fromBytes: expected "+q+" bytes, got "+U.length);const ce=new Uint8Array(X);ce.set(U,g?0:ce.length-U.length),U=ce}if(U.length!==X)throw new Error("Field.fromBytes: expected "+X+" bytes, got "+U.length);let te=g?(0,e.bytesToNumberLE)(U):(0,e.bytesToNumberBE)(U);if($&&(te=D(te,t)),!Z&&!ee.isValid(te))throw new Error("invalid field element: outside of range 0..ORDER");return te},invertBatch:U=>N(ee,U),cmov:(U,Z,te)=>te?Z:U});return Object.freeze(ee)}function a(t,v){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const g=t.sqrt(v);return t.isOdd(g)?g:t.neg(g)}function p(t,v){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const g=t.sqrt(v);return t.isOdd(g)?t.neg(g):g}function o(t,v,g=!1){t=(0,e.ensureBytes)("privateHash",t);const l=t.length,m=K(v).nByteLength+8;if(m<24||l<m||l>1024)throw new Error("hashToPrivateScalar: expected "+m+"-1024 bytes of input, got "+l);const Q=g?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t);return D(Q,v-y)+y}function n(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const v=t.toString(2).length;return Math.ceil(v/8)}function h(t){const v=n(t);return v+Math.ceil(v/2)}function f(t,v,g=!1){const l=t.length,m=n(v),Q=h(v);if(l<16||l<Q||l>1024)throw new Error("expected "+Q+"-1024 bytes of input, got "+l);const $=g?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t),q=D($,v-y)+y;return g?(0,e.numberToBytesLE)(q,m):(0,e.numberToBytesBE)(q,m)}return xe}var ns;function Vt(){if(ns)return Te;ns=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.wNAF=void 0,Te.negateCt=u,Te.normalizeZ=c,Te.mulEndoUnsafe=S,Te.pippenger=O,Te.precomputeMSMUnsafe=M,Te.validateBasic=L,Te._createCurveFields=E;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ue(),y=BigInt(0),i=BigInt(1);function u(R,H){const k=H.negate();return R?k:H}function c(R,H){const k=(0,r.FpInvertBatch)(R.Fp,H.map(N=>N.Z));return H.map((N,V)=>R.fromAffine(N.toAffine(k[V])))}function s(R,H){if(!Number.isSafeInteger(R)||R<=0||R>H)throw new Error("invalid window size, expected [1.."+H+"], got W="+R)}function d(R,H){s(R,H);const k=Math.ceil(H/R)+1,N=2**(R-1),V=2**R,B=(0,e.bitMask)(R),j=BigInt(R);return{windows:k,windowSize:N,mask:B,maxNumber:V,shiftBy:j}}function b(R,H,k){const{windowSize:N,mask:V,maxNumber:B,shiftBy:j}=k;let K=Number(R&V),C=R>>j;K>N&&(K-=B,C+=i);const a=H*N,p=a+Math.abs(K)-1,o=K===0,n=K<0,h=H%2!==0;return{nextN:C,offset:p,isZero:o,isNeg:n,isNegF:h,offsetF:a}}function I(R,H){if(!Array.isArray(R))throw new Error("array expected");R.forEach((k,N)=>{if(!(k instanceof H))throw new Error("invalid point at index "+N)})}function A(R,H){if(!Array.isArray(R))throw new Error("array of scalars expected");R.forEach((k,N)=>{if(!H.isValid(k))throw new Error("invalid scalar at index "+N)})}const D=new WeakMap,w=new WeakMap;function P(R){return w.get(R)||1}function _(R){if(R!==y)throw new Error("invalid wNAF")}class x{constructor(H,k){this.BASE=H.BASE,this.ZERO=H.ZERO,this.Fn=H.Fn,this.bits=k}_unsafeLadder(H,k,N=this.ZERO){let V=H;for(;k>y;)k&i&&(N=N.add(V)),V=V.double(),k>>=i;return N}precomputeWindow(H,k){const{windows:N,windowSize:V}=d(k,this.bits),B=[];let j=H,K=j;for(let C=0;C<N;C++){K=j,B.push(K);for(let a=1;a<V;a++)K=K.add(j),B.push(K);j=K.double()}return B}wNAF(H,k,N){if(!this.Fn.isValid(N))throw new Error("invalid scalar");let V=this.ZERO,B=this.BASE;const j=d(H,this.bits);for(let K=0;K<j.windows;K++){const{nextN:C,offset:a,isZero:p,isNeg:o,isNegF:n,offsetF:h}=b(N,K,j);N=C,p?B=B.add(u(n,k[h])):V=V.add(u(o,k[a]))}return _(N),{p:V,f:B}}wNAFUnsafe(H,k,N,V=this.ZERO){const B=d(H,this.bits);for(let j=0;j<B.windows&&N!==y;j++){const{nextN:K,offset:C,isZero:a,isNeg:p}=b(N,j,B);if(N=K,!a){const o=k[C];V=V.add(p?o.negate():o)}}return _(N),V}getPrecomputes(H,k,N){let V=D.get(k);return V||(V=this.precomputeWindow(k,H),H!==1&&(typeof N=="function"&&(V=N(V)),D.set(k,V))),V}cached(H,k,N){const V=P(H);return this.wNAF(V,this.getPrecomputes(V,H,N),k)}unsafe(H,k,N,V){const B=P(H);return B===1?this._unsafeLadder(H,k,V):this.wNAFUnsafe(B,this.getPrecomputes(B,H,N),k,V)}createCache(H,k){s(k,this.bits),w.set(H,k),D.delete(H)}hasCache(H){return P(H)!==1}}Te.wNAF=x;function S(R,H,k,N){let V=H,B=R.ZERO,j=R.ZERO;for(;k>y||N>y;)k&i&&(B=B.add(V)),N&i&&(j=j.add(V)),V=V.double(),k>>=i,N>>=i;return{p1:B,p2:j}}function O(R,H,k,N){I(k,R),A(N,H);const V=k.length,B=N.length;if(V!==B)throw new Error("arrays of points and scalars must have equal length");const j=R.ZERO,K=(0,e.bitLen)(BigInt(V));let C=1;K>12?C=K-3:K>4?C=K-2:K>0&&(C=2);const a=(0,e.bitMask)(C),p=new Array(Number(a)+1).fill(j),o=Math.floor((H.BITS-1)/C)*C;let n=j;for(let h=o;h>=0;h-=C){p.fill(j);for(let t=0;t<B;t++){const v=N[t],g=Number(v>>BigInt(h)&a);p[g]=p[g].add(k[t])}let f=j;for(let t=p.length-1,v=j;t>0;t--)v=v.add(p[t]),f=f.add(v);if(n=n.add(f),h!==0)for(let t=0;t<C;t++)n=n.double()}return n}function M(R,H,k,N){s(N,H.BITS),I(k,R);const V=R.ZERO,B=2**N-1,j=Math.ceil(H.BITS/N),K=(0,e.bitMask)(N),C=k.map(a=>{const p=[];for(let o=0,n=a;o<B;o++)p.push(n),n=n.add(a);return p});return a=>{if(A(a,H),a.length>k.length)throw new Error("array of scalars must be smaller than array of points");let p=V;for(let o=0;o<j;o++){if(p!==V)for(let h=0;h<N;h++)p=p.double();const n=BigInt(j*N-(o+1)*N);for(let h=0;h<a.length;h++){const f=a[h],t=Number(f>>n&K);t&&(p=p.add(C[h][t-1]))}}return p}}function L(R){return(0,r.validateField)(R.Fp),(0,e.validateObject)(R,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,r.nLength)(R.n,R.nBitLength),...R,p:R.Fp.ORDER})}function F(R,H,k){if(H){if(H.ORDER!==R)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,r.validateField)(H),H}else return(0,r.Field)(R,{isLE:k})}function E(R,H,k={},N){if(N===void 0&&(N=R==="edwards"),!H||typeof H!="object")throw new Error(`expected valid ${R} CURVE object`);for(const C of["p","n","h"]){const a=H[C];if(!(typeof a=="bigint"&&a>y))throw new Error(`CURVE.${C} must be positive bigint`)}const V=F(H.p,k.Fp,N),B=F(H.n,k.Fn,N),K=["Gx","Gy","a",R==="weierstrass"?"b":"d"];for(const C of K)if(!V.isValid(H[C]))throw new Error(`CURVE.${C} must be valid field element of CURVE.Fp`);return H=Object.freeze(Object.assign({},H)),{CURVE:H,Fp:V,Fn:B}}return Te}var Fe={},rs;function pi(){if(rs)return Fe;rs=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.PrimeEdwardsPoint=void 0,Fe.edwards=b,Fe.eddsa=A,Fe.twistedEdwards=P;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Vt(),y=Ue(),i=BigInt(0),u=BigInt(1),c=BigInt(2),s=BigInt(8);function d(_,x,S,O){const M=_.sqr(S),L=_.sqr(O),F=_.add(_.mul(x.a,M),L),E=_.add(_.ONE,_.mul(x.d,_.mul(M,L)));return _.eql(F,E)}function b(_,x={}){const S=(0,r._createCurveFields)("edwards",_,x,x.FpFnLE),{Fp:O,Fn:M}=S;let L=S.CURVE;const{h:F}=L;(0,e._validateObject)(x,{},{uvRatio:"function"});const E=c<<BigInt(M.BYTES*8)-u,R=C=>O.create(C),H=x.uvRatio||((C,a)=>{try{return{isValid:!0,value:O.sqrt(O.div(C,a))}}catch{return{isValid:!1,value:i}}});if(!d(O,L,L.Gx,L.Gy))throw new Error("bad curve params: generator point");function k(C,a,p=!1){const o=p?u:i;return(0,e.aInRange)("coordinate "+C,a,o,E),a}function N(C){if(!(C instanceof j))throw new Error("ExtendedPoint expected")}const V=(0,e.memoized)((C,a)=>{const{X:p,Y:o,Z:n}=C,h=C.is0();a==null&&(a=h?s:O.inv(n));const f=R(p*a),t=R(o*a),v=O.mul(n,a);if(h)return{x:i,y:u};if(v!==u)throw new Error("invZ was invalid");return{x:f,y:t}}),B=(0,e.memoized)(C=>{const{a,d:p}=L;if(C.is0())throw new Error("bad point: ZERO");const{X:o,Y:n,Z:h,T:f}=C,t=R(o*o),v=R(n*n),g=R(h*h),l=R(g*g),m=R(t*a),Q=R(g*R(m+v)),$=R(l+R(p*R(t*v)));if(Q!==$)throw new Error("bad point: equation left != right (1)");const q=R(o*n),G=R(h*f);if(q!==G)throw new Error("bad point: equation left != right (2)");return!0});class j{constructor(a,p,o,n){this.X=k("x",a),this.Y=k("y",p),this.Z=k("z",o,!0),this.T=k("t",n),Object.freeze(this)}static CURVE(){return L}static fromAffine(a){if(a instanceof j)throw new Error("extended point not allowed");const{x:p,y:o}=a||{};return k("x",p),k("y",o),new j(p,o,u,R(p*o))}static fromBytes(a,p=!1){const o=O.BYTES,{a:n,d:h}=L;a=(0,e.copyBytes)((0,e._abytes2)(a,o,"point")),(0,e._abool2)(p,"zip215");const f=(0,e.copyBytes)(a),t=a[o-1];f[o-1]=t&-129;const v=(0,e.bytesToNumberLE)(f),g=p?E:O.ORDER;(0,e.aInRange)("point.y",v,i,g);const l=R(v*v),m=R(l-u),Q=R(h*l-n);let{isValid:$,value:q}=H(m,Q);if(!$)throw new Error("bad point: invalid y coordinate");const G=(q&u)===u,X=(t&128)!==0;if(!p&&q===i&&X)throw new Error("bad point: x=0 and x_0=1");return X!==G&&(q=R(-q)),j.fromAffine({x:q,y:v})}static fromHex(a,p=!1){return j.fromBytes((0,e.ensureBytes)("point",a),p)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(a=8,p=!0){return K.createCache(this,a),p||this.multiply(c),this}assertValidity(){B(this)}equals(a){N(a);const{X:p,Y:o,Z:n}=this,{X:h,Y:f,Z:t}=a,v=R(p*t),g=R(h*n),l=R(o*t),m=R(f*n);return v===g&&l===m}is0(){return this.equals(j.ZERO)}negate(){return new j(R(-this.X),this.Y,this.Z,R(-this.T))}double(){const{a}=L,{X:p,Y:o,Z:n}=this,h=R(p*p),f=R(o*o),t=R(c*R(n*n)),v=R(a*h),g=p+o,l=R(R(g*g)-h-f),m=v+f,Q=m-t,$=v-f,q=R(l*Q),G=R(m*$),X=R(l*$),z=R(Q*m);return new j(q,G,z,X)}add(a){N(a);const{a:p,d:o}=L,{X:n,Y:h,Z:f,T:t}=this,{X:v,Y:g,Z:l,T:m}=a,Q=R(n*v),$=R(h*g),q=R(t*o*m),G=R(f*l),X=R((n+h)*(v+g)-Q-$),z=G-q,ee=G+q,U=R($-p*Q),Z=R(X*z),te=R(ee*U),ce=R(X*U),le=R(z*ee);return new j(Z,te,le,ce)}subtract(a){return this.add(a.negate())}multiply(a){if(!M.isValidNot0(a))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p,f:o}=K.cached(this,a,n=>(0,r.normalizeZ)(j,n));return(0,r.normalizeZ)(j,[p,o])[0]}multiplyUnsafe(a,p=j.ZERO){if(!M.isValid(a))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return a===i?j.ZERO:this.is0()||a===u?this:K.unsafe(this,a,o=>(0,r.normalizeZ)(j,o),p)}isSmallOrder(){return this.multiplyUnsafe(F).is0()}isTorsionFree(){return K.unsafe(this,L.n).is0()}toAffine(a){return V(this,a)}clearCofactor(){return F===u?this:this.multiplyUnsafe(F)}toBytes(){const{x:a,y:p}=this.toAffine(),o=O.toBytes(p);return o[o.length-1]|=a&u?128:0,o}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(a){return(0,r.normalizeZ)(j,a)}static msm(a,p){return(0,r.pippenger)(j,M,a,p)}_setWindowSize(a){this.precompute(a)}toRawBytes(){return this.toBytes()}}j.BASE=new j(L.Gx,L.Gy,u,R(L.Gx*L.Gy)),j.ZERO=new j(i,u,u,i),j.Fp=O,j.Fn=M;const K=new r.wNAF(j,M.BITS);return j.BASE.precompute(8),j}class I{constructor(x){this.ep=x}static fromBytes(x){(0,e.notImplemented)()}static fromHex(x){(0,e.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(x){return this.ep.toAffine(x)}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(x){return this.assertSame(x),this.init(this.ep.add(x.ep))}subtract(x){return this.assertSame(x),this.init(this.ep.subtract(x.ep))}multiply(x){return this.init(this.ep.multiply(x))}multiplyUnsafe(x){return this.init(this.ep.multiplyUnsafe(x))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(x,S){return this.init(this.ep.precompute(x,S))}toRawBytes(){return this.toBytes()}}Fe.PrimeEdwardsPoint=I;function A(_,x,S={}){if(typeof x!="function")throw new Error('"hash" function param is required');(0,e._validateObject)(S,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:O}=S,{BASE:M,Fp:L,Fn:F}=_,E=S.randomBytes||e.randomBytes,R=S.adjustScalarBytes||(g=>g),H=S.domain||((g,l,m)=>{if((0,e._abool2)(m,"phflag"),l.length||m)throw new Error("Contexts/pre-hash are not supported");return g});function k(g){return F.create((0,e.bytesToNumberLE)(g))}function N(g){const l=o.secretKey;g=(0,e.ensureBytes)("private key",g,l);const m=(0,e.ensureBytes)("hashed private key",x(g),2*l),Q=R(m.slice(0,l)),$=m.slice(l,2*l),q=k(Q);return{head:Q,prefix:$,scalar:q}}function V(g){const{head:l,prefix:m,scalar:Q}=N(g),$=M.multiply(Q),q=$.toBytes();return{head:l,prefix:m,scalar:Q,point:$,pointBytes:q}}function B(g){return V(g).pointBytes}function j(g=Uint8Array.of(),...l){const m=(0,e.concatBytes)(...l);return k(x(H(m,(0,e.ensureBytes)("context",g),!!O)))}function K(g,l,m={}){g=(0,e.ensureBytes)("message",g),O&&(g=O(g));const{prefix:Q,scalar:$,pointBytes:q}=V(l),G=j(m.context,Q,g),X=M.multiply(G).toBytes(),z=j(m.context,X,q,g),ee=F.create(G+z*$);if(!F.isValid(ee))throw new Error("sign failed: invalid s");const U=(0,e.concatBytes)(X,F.toBytes(ee));return(0,e._abytes2)(U,o.signature,"result")}const C={zip215:!0};function a(g,l,m,Q=C){const{context:$,zip215:q}=Q,G=o.signature;g=(0,e.ensureBytes)("signature",g,G),l=(0,e.ensureBytes)("message",l),m=(0,e.ensureBytes)("publicKey",m,o.publicKey),q!==void 0&&(0,e._abool2)(q,"zip215"),O&&(l=O(l));const X=G/2,z=g.subarray(0,X),ee=(0,e.bytesToNumberLE)(g.subarray(X,G));let U,Z,te;try{U=_.fromBytes(m,q),Z=_.fromBytes(z,q),te=M.multiplyUnsafe(ee)}catch{return!1}if(!q&&U.isSmallOrder())return!1;const ce=j($,Z.toBytes(),U.toBytes(),l);return Z.add(U.multiplyUnsafe(ce)).subtract(te).clearCofactor().is0()}const p=L.BYTES,o={secretKey:p,publicKey:p,signature:2*p,seed:p};function n(g=E(o.seed)){return(0,e._abytes2)(g,o.seed,"seed")}function h(g){const l=v.randomSecretKey(g);return{secretKey:l,publicKey:B(l)}}function f(g){return(0,e.isBytes)(g)&&g.length===F.BYTES}function t(g,l){try{return!!_.fromBytes(g,l)}catch{return!1}}const v={getExtendedPublicKey:V,randomSecretKey:n,isValidSecretKey:f,isValidPublicKey:t,toMontgomery(g){const{y:l}=_.fromBytes(g),m=o.publicKey,Q=m===32;if(!Q&&m!==57)throw new Error("only defined for 25519 and 448");const $=Q?L.div(u+l,u-l):L.div(l-u,l+u);return L.toBytes($)},toMontgomerySecret(g){const l=o.secretKey;(0,e._abytes2)(g,l);const m=x(g.subarray(0,l));return R(m).subarray(0,l)},randomPrivateKey:n,precompute(g=8,l=_.BASE){return l.precompute(g,!1)}};return Object.freeze({keygen:h,getPublicKey:B,sign:K,verify:a,utils:v,Point:_,lengths:o})}function D(_){const x={a:_.a,d:_.d,p:_.Fp.ORDER,n:_.n,h:_.h,Gx:_.Gx,Gy:_.Gy},S=_.Fp,O=(0,y.Field)(x.n,_.nBitLength,!0),M={Fp:S,Fn:O,uvRatio:_.uvRatio},L={randomBytes:_.randomBytes,adjustScalarBytes:_.adjustScalarBytes,domain:_.domain,prehash:_.prehash,mapToCurve:_.mapToCurve};return{CURVE:x,curveOpts:M,hash:_.hash,eddsaOpts:L}}function w(_,x){const S=x.Point;return Object.assign({},x,{ExtendedPoint:S,CURVE:_,nBitLength:S.Fn.BITS,nByteLength:S.Fn.BYTES})}function P(_){const{CURVE:x,curveOpts:S,hash:O,eddsaOpts:M}=D(_),L=b(x,S),F=A(L,O,M);return w(_,F)}return Fe}var kt={},ss;function os(){return ss||(ss=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=b,e.expand_message_xof=I,e.hash_to_field=A,e.isogenyMap=D,e.createHasher=w;const r=ke(),y=Ue(),i=r.bytesToNumberBE;function u(P,_){if(s(P),s(_),P<0||P>=1<<8*_)throw new Error("invalid I2OSP input: "+P);const x=Array.from({length:_}).fill(0);for(let S=_-1;S>=0;S--)x[S]=P&255,P>>>=8;return new Uint8Array(x)}function c(P,_){const x=new Uint8Array(P.length);for(let S=0;S<P.length;S++)x[S]=P[S]^_[S];return x}function s(P){if(!Number.isSafeInteger(P))throw new Error("number expected")}function d(P){if(!(0,r.isBytes)(P)&&typeof P!="string")throw new Error("DST must be Uint8Array or string");return typeof P=="string"?(0,r.utf8ToBytes)(P):P}function b(P,_,x,S){(0,r.abytes)(P),s(x),_=d(_),_.length>255&&(_=S((0,r.concatBytes)((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-"),_)));const{outputLen:O,blockLen:M}=S,L=Math.ceil(x/O);if(x>65535||L>255)throw new Error("expand_message_xmd: invalid lenInBytes");const F=(0,r.concatBytes)(_,u(_.length,1)),E=u(0,M),R=u(x,2),H=new Array(L),k=S((0,r.concatBytes)(E,P,R,u(0,1),F));H[0]=S((0,r.concatBytes)(k,u(1,1),F));for(let V=1;V<=L;V++){const B=[c(k,H[V-1]),u(V+1,1),F];H[V]=S((0,r.concatBytes)(...B))}return(0,r.concatBytes)(...H).slice(0,x)}function I(P,_,x,S,O){if((0,r.abytes)(P),s(x),_=d(_),_.length>255){const M=Math.ceil(2*S/8);_=O.create({dkLen:M}).update((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(_).digest()}if(x>65535||_.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return O.create({dkLen:x}).update(P).update(u(x,2)).update(_).update(u(_.length,1)).digest()}function A(P,_,x){(0,r._validateObject)(x,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:S,k:O,m:M,hash:L,expand:F,DST:E}=x;if(!(0,r.isHash)(x.hash))throw new Error("expected valid hash");(0,r.abytes)(P),s(_);const R=S.toString(2).length,H=Math.ceil((R+O)/8),k=_*M*H;let N;if(F==="xmd")N=b(P,E,k,L);else if(F==="xof")N=I(P,E,k,O,L);else if(F==="_internal_pass")N=P;else throw new Error('expand must be "xmd" or "xof"');const V=new Array(_);for(let B=0;B<_;B++){const j=new Array(M);for(let K=0;K<M;K++){const C=H*(K+B*M),a=N.subarray(C,C+H);j[K]=(0,y.mod)(i(a),S)}V[B]=j}return V}function D(P,_){const x=_.map(S=>Array.from(S).reverse());return(S,O)=>{const[M,L,F,E]=x.map(k=>k.reduce((N,V)=>P.add(P.mul(N,S),V))),[R,H]=(0,y.FpInvertBatch)(P,[L,E],!0);return S=P.mul(M,R),O=P.mul(O,P.mul(F,H)),{x:S,y:O}}}e._DST_scalar=(0,r.utf8ToBytes)("HashToScalar-");function w(P,_,x){if(typeof _!="function")throw new Error("mapToCurve() must be defined");function S(M){return P.fromAffine(_(M))}function O(M){const L=M.clearCofactor();return L.equals(P.ZERO)?P.ZERO:(L.assertValidity(),L)}return{defaults:x,hashToCurve(M,L){const F=Object.assign({},x,L),E=A(M,2,F),R=S(E[0]),H=S(E[1]);return O(R.add(H))},encodeToCurve(M,L){const F=x.encodeDST?{DST:x.encodeDST}:{},E=Object.assign({},x,F,L),R=A(M,1,E),H=S(R[0]);return O(H)},mapToCurve(M){if(!Array.isArray(M))throw new Error("expected array of bigints");for(const L of M)if(typeof L!="bigint")throw new Error("expected array of bigints");return O(S(M))},hashToScalar(M,L){const F=P.Fn.ORDER,E=Object.assign({},x,{p:F,m:1,DST:e._DST_scalar},L);return A(M,1,E)[0][0]}}}})(kt)),kt}var lt={},is;function yi(){if(is)return lt;is=1,Object.defineProperty(lt,"__esModule",{value:!0}),lt.montgomery=s;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ue(),y=BigInt(0),i=BigInt(1),u=BigInt(2);function c(d){return(0,e._validateObject)(d,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...d})}function s(d){const b=c(d),{P:I,type:A,adjustScalarBytes:D,powPminus2:w,randomBytes:P}=b,_=A==="x25519";if(!_&&A!=="x448")throw new Error("invalid type");const x=P||e.randomBytes,S=_?255:448,O=_?32:56,M=BigInt(_?9:5),L=BigInt(_?121665:39081),F=_?u**BigInt(254):u**BigInt(447),E=_?BigInt(8)*u**BigInt(251)-i:BigInt(4)*u**BigInt(445)-i,R=F+E+i,H=f=>(0,r.mod)(f,I),k=N(M);function N(f){return(0,e.numberToBytesLE)(H(f),O)}function V(f){const t=(0,e.ensureBytes)("u coordinate",f,O);return _&&(t[31]&=127),H((0,e.bytesToNumberLE)(t))}function B(f){return(0,e.bytesToNumberLE)(D((0,e.ensureBytes)("scalar",f,O)))}function j(f,t){const v=a(V(t),B(f));if(v===y)throw new Error("invalid private or public key received");return N(v)}function K(f){return j(f,k)}function C(f,t,v){const g=H(f*(t-v));return t=H(t-g),v=H(v+g),{x_2:t,x_3:v}}function a(f,t){(0,e.aInRange)("u",f,y,I),(0,e.aInRange)("scalar",t,F,R);const v=t,g=f;let l=i,m=y,Q=f,$=i,q=y;for(let X=BigInt(S-1);X>=y;X--){const z=v>>X&i;q^=z,{x_2:l,x_3:Q}=C(q,l,Q),{x_2:m,x_3:$}=C(q,m,$),q=z;const ee=l+m,U=H(ee*ee),Z=l-m,te=H(Z*Z),ce=U-te,le=Q+$,ne=Q-$,de=H(ne*ee),W=H(le*Z),pe=de+W,me=de-W;Q=H(pe*pe),$=H(g*H(me*me)),l=H(U*te),m=H(ce*(U+H(L*ce)))}({x_2:l,x_3:Q}=C(q,l,Q)),{x_2:m,x_3:$}=C(q,m,$);const G=w(m);return H(l*G)}const p={secretKey:O,publicKey:O,seed:O},o=(f=x(O))=>((0,e.abytes)(f,p.seed),f);function n(f){const t=o(f);return{secretKey:t,publicKey:K(t)}}return{keygen:n,getSharedSecret:(f,t)=>j(f,t),getPublicKey:f=>K(f),scalarMult:j,scalarMultBase:K,utils:{randomSecretKey:o,randomPrivateKey:o},GuBytes:k.slice(),lengths:p}}return lt}var cs;function vi(){return cs||(cs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.encodeToCurve=e.hashToCurve=e.RistrettoPoint=e.edwardsToMontgomery=e.ED25519_TORSION_SUBGROUP=e.ristretto255_hasher=e.ristretto255=e.ed25519_hasher=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=void 0,e.edwardsToMontgomeryPub=Q,e.edwardsToMontgomeryPriv=$;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=Kt(),y=De(),i=Vt(),u=pi(),c=os(),s=Ue(),d=yi(),b=ke(),I=BigInt(0),A=BigInt(1),D=BigInt(2),w=BigInt(3),P=BigInt(5),_=BigInt(8),x=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),S={p:x,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:_,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function O(q){const G=BigInt(10),X=BigInt(20),z=BigInt(40),ee=BigInt(80),U=x,te=q*q%U*q%U,ce=(0,s.pow2)(te,D,U)*te%U,le=(0,s.pow2)(ce,A,U)*q%U,ne=(0,s.pow2)(le,P,U)*le%U,de=(0,s.pow2)(ne,G,U)*ne%U,W=(0,s.pow2)(de,X,U)*de%U,pe=(0,s.pow2)(W,z,U)*W%U,me=(0,s.pow2)(pe,ee,U)*pe%U,fe=(0,s.pow2)(me,ee,U)*pe%U,J=(0,s.pow2)(fe,G,U)*ne%U;return{pow_p_5_8:(0,s.pow2)(J,D,U)*q%U,b2:te}}function M(q){return q[0]&=248,q[31]&=127,q[31]|=64,q}const L=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function F(q,G){const X=x,z=(0,s.mod)(G*G*G,X),ee=(0,s.mod)(z*z*G,X),U=O(q*ee).pow_p_5_8;let Z=(0,s.mod)(q*z*U,X);const te=(0,s.mod)(G*Z*Z,X),ce=Z,le=(0,s.mod)(Z*L,X),ne=te===q,de=te===(0,s.mod)(-q,X),W=te===(0,s.mod)(-q*L,X);return ne&&(Z=ce),(de||W)&&(Z=le),(0,s.isNegativeLE)(Z,X)&&(Z=(0,s.mod)(-Z,X)),{isValid:ne||de,value:Z}}const E=(0,s.Field)(S.p,{isLE:!0}),R=(0,s.Field)(S.n,{isLE:!0}),H={...S,Fp:E,hash:r.sha512,adjustScalarBytes:M,uvRatio:F};e.ed25519=(0,u.twistedEdwards)(H);function k(q,G,X){if(G.length>255)throw new Error("Context is too big");return(0,y.concatBytes)((0,y.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([X?1:0,G.length]),G,q)}e.ed25519ctx=(0,u.twistedEdwards)({...H,domain:k}),e.ed25519ph=(0,u.twistedEdwards)(Object.assign({},H,{domain:k,prehash:r.sha512})),e.x25519=(()=>{const q=E.ORDER;return(0,d.montgomery)({P:q,type:"x25519",powPminus2:G=>{const{pow_p_5_8:X,b2:z}=O(G);return(0,s.mod)((0,s.pow2)(X,w,q)*z,q)},adjustScalarBytes:M})})();const N=(x+w)/_,V=E.pow(D,N),B=E.sqrt(E.neg(E.ONE));function j(q){const G=(x-P)/_,X=BigInt(486662);let z=E.sqr(q);z=E.mul(z,D);let ee=E.add(z,E.ONE),U=E.neg(X),Z=E.sqr(ee),te=E.mul(Z,ee),ce=E.mul(z,X);ce=E.mul(ce,U),ce=E.add(ce,Z),ce=E.mul(ce,U);let le=E.sqr(te);Z=E.sqr(le),le=E.mul(le,te),le=E.mul(le,ce),Z=E.mul(Z,le);let ne=E.pow(Z,G);ne=E.mul(ne,le);let de=E.mul(ne,B);Z=E.sqr(ne),Z=E.mul(Z,te);let W=E.eql(Z,ce),pe=E.cmov(de,ne,W),me=E.mul(U,z),fe=E.mul(ne,q);fe=E.mul(fe,V);let J=E.mul(fe,B),se=E.mul(ce,z);Z=E.sqr(fe),Z=E.mul(Z,te);let re=E.eql(Z,se),ue=E.cmov(J,fe,re);Z=E.sqr(pe),Z=E.mul(Z,te);let he=E.eql(Z,ce),ge=E.cmov(me,U,he),ye=E.cmov(ue,pe,he),ve=E.isOdd(ye);return ye=E.cmov(ye,E.neg(ye),he!==ve),{xMn:ge,xMd:ee,yMn:ye,yMd:A}}const K=(0,s.FpSqrtEven)(E,E.neg(BigInt(486664)));function C(q){const{xMn:G,xMd:X,yMn:z,yMd:ee}=j(q);let U=E.mul(G,ee);U=E.mul(U,K);let Z=E.mul(X,z),te=E.sub(G,X),ce=E.add(G,X),le=E.mul(Z,ce),ne=E.eql(le,E.ZERO);U=E.cmov(U,E.ZERO,ne),Z=E.cmov(Z,E.ONE,ne),te=E.cmov(te,E.ONE,ne),ce=E.cmov(ce,E.ONE,ne);const[de,W]=(0,s.FpInvertBatch)(E,[Z,ce],!0);return{x:E.mul(U,de),y:E.mul(te,W)}}e.ed25519_hasher=(0,c.createHasher)(e.ed25519.Point,q=>C(q[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:x,m:1,k:128,expand:"xmd",hash:r.sha512});const a=L,p=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),o=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),n=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),h=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),f=q=>F(A,q),t=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),v=q=>e.ed25519.Point.Fp.create((0,b.bytesToNumberLE)(q)&t);function g(q){const{d:G}=S,X=x,z=se=>E.create(se),ee=z(a*q*q),U=z((ee+A)*n);let Z=BigInt(-1);const te=z((Z-G*ee)*z(ee+G));let{isValid:ce,value:le}=F(U,te),ne=z(le*q);(0,s.isNegativeLE)(ne,X)||(ne=z(-ne)),ce||(le=ne),ce||(Z=ee);const de=z(Z*(ee-A)*h-te),W=le*le,pe=z((le+le)*te),me=z(de*p),fe=z(A-W),J=z(A+W);return new e.ed25519.Point(z(pe*J),z(fe*me),z(me*J),z(pe*fe))}function l(q){(0,y.abytes)(q,64);const G=v(q.subarray(0,32)),X=g(G),z=v(q.subarray(32,64)),ee=g(z);return new m(X.add(ee))}class m extends u.PrimeEdwardsPoint{constructor(G){super(G)}static fromAffine(G){return new m(e.ed25519.Point.fromAffine(G))}assertSame(G){if(!(G instanceof m))throw new Error("RistrettoPoint expected")}init(G){return new m(G)}static hashToCurve(G){return l((0,b.ensureBytes)("ristrettoHash",G,64))}static fromBytes(G){(0,y.abytes)(G,32);const{a:X,d:z}=S,ee=x,U=he=>E.create(he),Z=v(G);if(!(0,b.equalBytes)(E.toBytes(Z),G)||(0,s.isNegativeLE)(Z,ee))throw new Error("invalid ristretto255 encoding 1");const te=U(Z*Z),ce=U(A+X*te),le=U(A-X*te),ne=U(ce*ce),de=U(le*le),W=U(X*z*ne-de),{isValid:pe,value:me}=f(U(W*de)),fe=U(me*le),J=U(me*fe*W);let se=U((Z+Z)*fe);(0,s.isNegativeLE)(se,ee)&&(se=U(-se));const re=U(ce*J),ue=U(se*re);if(!pe||(0,s.isNegativeLE)(ue,ee)||re===I)throw new Error("invalid ristretto255 encoding 2");return new m(new e.ed25519.Point(se,re,A,ue))}static fromHex(G){return m.fromBytes((0,b.ensureBytes)("ristrettoHex",G,32))}static msm(G,X){return(0,i.pippenger)(m,e.ed25519.Point.Fn,G,X)}toBytes(){let{X:G,Y:X,Z:z,T:ee}=this.ep;const U=x,Z=J=>E.create(J),te=Z(Z(z+X)*Z(z-X)),ce=Z(G*X),le=Z(ce*ce),{value:ne}=f(Z(te*le)),de=Z(ne*te),W=Z(ne*ce),pe=Z(de*W*ee);let me;if((0,s.isNegativeLE)(ee*pe,U)){let J=Z(X*a),se=Z(G*a);G=J,X=se,me=Z(de*o)}else me=W;(0,s.isNegativeLE)(G*pe,U)&&(X=Z(-X));let fe=Z((z-X)*me);return(0,s.isNegativeLE)(fe,U)&&(fe=Z(-fe)),E.toBytes(fe)}equals(G){this.assertSame(G);const{X,Y:z}=this.ep,{X:ee,Y:U}=G.ep,Z=le=>E.create(le),te=Z(X*U)===Z(z*ee),ce=Z(z*U)===Z(X*ee);return te||ce}is0(){return this.equals(m.ZERO)}}m.BASE=new m(e.ed25519.Point.BASE),m.ZERO=new m(e.ed25519.Point.ZERO),m.Fp=E,m.Fn=R,e.ristretto255={Point:m},e.ristretto255_hasher={hashToCurve(q,G){const X=G?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",z=(0,c.expand_message_xmd)(q,X,64,r.sha512);return l(z)},hashToScalar(q,G={DST:c._DST_scalar}){const X=(0,c.expand_message_xmd)(q,G.DST,64,r.sha512);return R.create((0,b.bytesToNumberLE)(X))}},e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function Q(q){return e.ed25519.utils.toMontgomery((0,b.ensureBytes)("pub",q))}e.edwardsToMontgomery=Q;function $(q){return e.ed25519.utils.toMontgomerySecret((0,b.ensureBytes)("pub",q))}e.RistrettoPoint=m,e.hashToCurve=e.ed25519_hasher.hashToCurve,e.encodeToCurve=e.ed25519_hasher.encodeToCurve,e.hashToRistretto255=e.ristretto255_hasher.hashToCurve,e.hash_to_ristretto255=e.ristretto255_hasher.hashToCurve})(Lt)),Lt}var Ft={},tt={},jt={},Ut={},as;function us(){return as||(as=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const r=De();class y extends r.Hash{constructor(c,s){super(),this.finished=!1,this.destroyed=!1,(0,r.ahash)(c);const d=(0,r.toBytes)(s);if(this.iHash=c.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const b=this.blockLen,I=new Uint8Array(b);I.set(d.length>b?c.create().update(d).digest():d);for(let A=0;A<I.length;A++)I[A]^=54;this.iHash.update(I),this.oHash=c.create();for(let A=0;A<I.length;A++)I[A]^=106;this.oHash.update(I),(0,r.clean)(I)}update(c){return(0,r.aexists)(this),this.iHash.update(c),this}digestInto(c){(0,r.aexists)(this),(0,r.abytes)(c,this.outputLen),this.finished=!0,this.iHash.digestInto(c),this.oHash.update(c),this.oHash.digestInto(c),this.destroy()}digest(){const c=new Uint8Array(this.oHash.outputLen);return this.digestInto(c),c}_cloneInto(c){c||(c=Object.create(Object.getPrototypeOf(this),{}));const{oHash:s,iHash:d,finished:b,destroyed:I,blockLen:A,outputLen:D}=this;return c=c,c.finished=b,c.destroyed=I,c.blockLen=A,c.outputLen=D,c.oHash=s._cloneInto(c.oHash),c.iHash=d._cloneInto(c.iHash),c}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=y;const i=(u,c,s)=>new y(u,c).update(s).digest();e.hmac=i,e.hmac.create=(u,c)=>new y(u,c)})(Ut)),Ut}var ls;function fs(){return ls||(ls=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=d,e._normFnElement=S,e.weierstrassN=O,e.SWUFpSqrtRatio=L,e.mapToCurveSimpleSWU=F,e.ecdh=R,e.ecdsa=H,e.weierstrassPoints=k,e._legacyHelperEquat=B,e.weierstrass=C;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=us(),y=De(),i=ke(),u=Vt(),c=Ue(),s=(a,p)=>(a+(a>=0?p:-p)/P)/p;function d(a,p,o){const[[n,h],[f,t]]=p,v=s(t*a,o),g=s(-h*a,o);let l=a-v*n-g*f,m=-v*h-g*t;const Q=l<D,$=m<D;Q&&(l=-l),$&&(m=-m);const q=(0,i.bitMask)(Math.ceil((0,i.bitLen)(o)/2))+w;if(l<D||l>=q||m<D||m>=q)throw new Error("splitScalar (endomorphism): failed, k="+a);return{k1neg:Q,k1:l,k2neg:$,k2:m}}function b(a){if(!["compact","recovered","der"].includes(a))throw new Error('Signature format must be "compact", "recovered", or "der"');return a}function I(a,p){const o={};for(let n of Object.keys(p))o[n]=a[n]===void 0?p[n]:a[n];return(0,i._abool2)(o.lowS,"lowS"),(0,i._abool2)(o.prehash,"prehash"),o.format!==void 0&&b(o.format),o}class A extends Error{constructor(p=""){super(p)}}e.DERErr=A,e.DER={Err:A,_tlv:{encode:(a,p)=>{const{Err:o}=e.DER;if(a<0||a>256)throw new o("tlv.encode: wrong tag");if(p.length&1)throw new o("tlv.encode: unpadded data");const n=p.length/2,h=(0,i.numberToHexUnpadded)(n);if(h.length/2&128)throw new o("tlv.encode: long form length too big");const f=n>127?(0,i.numberToHexUnpadded)(h.length/2|128):"";return(0,i.numberToHexUnpadded)(a)+f+h+p},decode(a,p){const{Err:o}=e.DER;let n=0;if(a<0||a>256)throw new o("tlv.encode: wrong tag");if(p.length<2||p[n++]!==a)throw new o("tlv.decode: wrong tlv");const h=p[n++],f=!!(h&128);let t=0;if(!f)t=h;else{const g=h&127;if(!g)throw new o("tlv.decode(long): indefinite length not supported");if(g>4)throw new o("tlv.decode(long): byte length is too big");const l=p.subarray(n,n+g);if(l.length!==g)throw new o("tlv.decode: length bytes not complete");if(l[0]===0)throw new o("tlv.decode(long): zero leftmost byte");for(const m of l)t=t<<8|m;if(n+=g,t<128)throw new o("tlv.decode(long): not minimal encoding")}const v=p.subarray(n,n+t);if(v.length!==t)throw new o("tlv.decode: wrong value length");return{v,l:p.subarray(n+t)}}},_int:{encode(a){const{Err:p}=e.DER;if(a<D)throw new p("integer: negative integers are not allowed");let o=(0,i.numberToHexUnpadded)(a);if(Number.parseInt(o[0],16)&8&&(o="00"+o),o.length&1)throw new p("unexpected DER parsing assertion: unpadded hex");return o},decode(a){const{Err:p}=e.DER;if(a[0]&128)throw new p("invalid signature integer: negative");if(a[0]===0&&!(a[1]&128))throw new p("invalid signature integer: unnecessary leading zero");return(0,i.bytesToNumberBE)(a)}},toSig(a){const{Err:p,_int:o,_tlv:n}=e.DER,h=(0,i.ensureBytes)("signature",a),{v:f,l:t}=n.decode(48,h);if(t.length)throw new p("invalid signature: left bytes after parsing");const{v,l:g}=n.decode(2,f),{v:l,l:m}=n.decode(2,g);if(m.length)throw new p("invalid signature: left bytes after parsing");return{r:o.decode(v),s:o.decode(l)}},hexFromSig(a){const{_tlv:p,_int:o}=e.DER,n=p.encode(2,o.encode(a.r)),h=p.encode(2,o.encode(a.s)),f=n+h;return p.encode(48,f)}};const D=BigInt(0),w=BigInt(1),P=BigInt(2),_=BigInt(3),x=BigInt(4);function S(a,p){const{BYTES:o}=a;let n;if(typeof p=="bigint")n=p;else{let h=(0,i.ensureBytes)("private key",p);try{n=a.fromBytes(h)}catch{throw new Error(`invalid private key: expected ui8a of size ${o}, got ${typeof p}`)}}if(!a.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function O(a,p={}){const o=(0,u._createCurveFields)("weierstrass",a,p),{Fp:n,Fn:h}=o;let f=o.CURVE;const{h:t,n:v}=f;(0,i._validateObject)(p,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:g}=p;if(g&&(!n.is0(f.a)||typeof g.beta!="bigint"||!Array.isArray(g.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=E(n,h);function m(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function Q(fe,J,se){const{x:re,y:ue}=J.toAffine(),he=n.toBytes(re);if((0,i._abool2)(se,"isCompressed"),se){m();const ge=!n.isOdd(ue);return(0,i.concatBytes)(M(ge),he)}else return(0,i.concatBytes)(Uint8Array.of(4),he,n.toBytes(ue))}function $(fe){(0,i._abytes2)(fe,void 0,"Point");const{publicKey:J,publicKeyUncompressed:se}=l,re=fe.length,ue=fe[0],he=fe.subarray(1);if(re===J&&(ue===2||ue===3)){const ge=n.fromBytes(he);if(!n.isValid(ge))throw new Error("bad point: is not on curve, wrong x");const ye=X(ge);let ve;try{ve=n.sqrt(ye)}catch(oe){const ie=oe instanceof Error?": "+oe.message:"";throw new Error("bad point: is not on curve, sqrt error"+ie)}m();const T=n.isOdd(ve);return(ue&1)===1!==T&&(ve=n.neg(ve)),{x:ge,y:ve}}else if(re===se&&ue===4){const ge=n.BYTES,ye=n.fromBytes(he.subarray(0,ge)),ve=n.fromBytes(he.subarray(ge,ge*2));if(!z(ye,ve))throw new Error("bad point: is not on curve");return{x:ye,y:ve}}else throw new Error(`bad point: got length ${re}, expected compressed=${J} or uncompressed=${se}`)}const q=p.toBytes||Q,G=p.fromBytes||$;function X(fe){const J=n.sqr(fe),se=n.mul(J,fe);return n.add(n.add(se,n.mul(fe,f.a)),f.b)}function z(fe,J){const se=n.sqr(J),re=X(fe);return n.eql(se,re)}if(!z(f.Gx,f.Gy))throw new Error("bad curve params: generator point");const ee=n.mul(n.pow(f.a,_),x),U=n.mul(n.sqr(f.b),BigInt(27));if(n.is0(n.add(ee,U)))throw new Error("bad curve params: a or b");function Z(fe,J,se=!1){if(!n.isValid(J)||se&&n.is0(J))throw new Error(`bad point coordinate ${fe}`);return J}function te(fe){if(!(fe instanceof W))throw new Error("ProjectivePoint expected")}function ce(fe){if(!g||!g.basises)throw new Error("no endo");return d(fe,g.basises,h.ORDER)}const le=(0,i.memoized)((fe,J)=>{const{X:se,Y:re,Z:ue}=fe;if(n.eql(ue,n.ONE))return{x:se,y:re};const he=fe.is0();J==null&&(J=he?n.ONE:n.inv(ue));const ge=n.mul(se,J),ye=n.mul(re,J),ve=n.mul(ue,J);if(he)return{x:n.ZERO,y:n.ZERO};if(!n.eql(ve,n.ONE))throw new Error("invZ was invalid");return{x:ge,y:ye}}),ne=(0,i.memoized)(fe=>{if(fe.is0()){if(p.allowInfinityPoint&&!n.is0(fe.Y))return;throw new Error("bad point: ZERO")}const{x:J,y:se}=fe.toAffine();if(!n.isValid(J)||!n.isValid(se))throw new Error("bad point: x or y not field elements");if(!z(J,se))throw new Error("bad point: equation left != right");if(!fe.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function de(fe,J,se,re,ue){return se=new W(n.mul(se.X,fe),se.Y,se.Z),J=(0,u.negateCt)(re,J),se=(0,u.negateCt)(ue,se),J.add(se)}class W{constructor(J,se,re){this.X=Z("x",J),this.Y=Z("y",se,!0),this.Z=Z("z",re),Object.freeze(this)}static CURVE(){return f}static fromAffine(J){const{x:se,y:re}=J||{};if(!J||!n.isValid(se)||!n.isValid(re))throw new Error("invalid affine point");if(J instanceof W)throw new Error("projective point not allowed");return n.is0(se)&&n.is0(re)?W.ZERO:new W(se,re,n.ONE)}static fromBytes(J){const se=W.fromAffine(G((0,i._abytes2)(J,void 0,"point")));return se.assertValidity(),se}static fromHex(J){return W.fromBytes((0,i.ensureBytes)("pointHex",J))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(J=8,se=!0){return me.createCache(this,J),se||this.multiply(_),this}assertValidity(){ne(this)}hasEvenY(){const{y:J}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(J)}equals(J){te(J);const{X:se,Y:re,Z:ue}=this,{X:he,Y:ge,Z:ye}=J,ve=n.eql(n.mul(se,ye),n.mul(he,ue)),T=n.eql(n.mul(re,ye),n.mul(ge,ue));return ve&&T}negate(){return new W(this.X,n.neg(this.Y),this.Z)}double(){const{a:J,b:se}=f,re=n.mul(se,_),{X:ue,Y:he,Z:ge}=this;let ye=n.ZERO,ve=n.ZERO,T=n.ZERO,Y=n.mul(ue,ue),oe=n.mul(he,he),ie=n.mul(ge,ge),ae=n.mul(ue,he);return ae=n.add(ae,ae),T=n.mul(ue,ge),T=n.add(T,T),ye=n.mul(J,T),ve=n.mul(re,ie),ve=n.add(ye,ve),ye=n.sub(oe,ve),ve=n.add(oe,ve),ve=n.mul(ye,ve),ye=n.mul(ae,ye),T=n.mul(re,T),ie=n.mul(J,ie),ae=n.sub(Y,ie),ae=n.mul(J,ae),ae=n.add(ae,T),T=n.add(Y,Y),Y=n.add(T,Y),Y=n.add(Y,ie),Y=n.mul(Y,ae),ve=n.add(ve,Y),ie=n.mul(he,ge),ie=n.add(ie,ie),Y=n.mul(ie,ae),ye=n.sub(ye,Y),T=n.mul(ie,oe),T=n.add(T,T),T=n.add(T,T),new W(ye,ve,T)}add(J){te(J);const{X:se,Y:re,Z:ue}=this,{X:he,Y:ge,Z:ye}=J;let ve=n.ZERO,T=n.ZERO,Y=n.ZERO;const oe=f.a,ie=n.mul(f.b,_);let ae=n.mul(se,he),be=n.mul(re,ge),_e=n.mul(ue,ye),we=n.add(se,re),Se=n.add(he,ge);we=n.mul(we,Se),Se=n.add(ae,be),we=n.sub(we,Se),Se=n.add(se,ue);let Be=n.add(he,ye);return Se=n.mul(Se,Be),Be=n.add(ae,_e),Se=n.sub(Se,Be),Be=n.add(re,ue),ve=n.add(ge,ye),Be=n.mul(Be,ve),ve=n.add(be,_e),Be=n.sub(Be,ve),Y=n.mul(oe,Se),ve=n.mul(ie,_e),Y=n.add(ve,Y),ve=n.sub(be,Y),Y=n.add(be,Y),T=n.mul(ve,Y),be=n.add(ae,ae),be=n.add(be,ae),_e=n.mul(oe,_e),Se=n.mul(ie,Se),be=n.add(be,_e),_e=n.sub(ae,_e),_e=n.mul(oe,_e),Se=n.add(Se,_e),ae=n.mul(be,Se),T=n.add(T,ae),ae=n.mul(Be,Se),ve=n.mul(we,ve),ve=n.sub(ve,ae),ae=n.mul(we,be),Y=n.mul(Be,Y),Y=n.add(Y,ae),new W(ve,T,Y)}subtract(J){return this.add(J.negate())}is0(){return this.equals(W.ZERO)}multiply(J){const{endo:se}=p;if(!h.isValidNot0(J))throw new Error("invalid scalar: out of range");let re,ue;const he=ge=>me.cached(this,ge,ye=>(0,u.normalizeZ)(W,ye));if(se){const{k1neg:ge,k1:ye,k2neg:ve,k2:T}=ce(J),{p:Y,f:oe}=he(ye),{p:ie,f:ae}=he(T);ue=oe.add(ae),re=de(se.beta,Y,ie,ge,ve)}else{const{p:ge,f:ye}=he(J);re=ge,ue=ye}return(0,u.normalizeZ)(W,[re,ue])[0]}multiplyUnsafe(J){const{endo:se}=p,re=this;if(!h.isValid(J))throw new Error("invalid scalar: out of range");if(J===D||re.is0())return W.ZERO;if(J===w)return re;if(me.hasCache(this))return this.multiply(J);if(se){const{k1neg:ue,k1:he,k2neg:ge,k2:ye}=ce(J),{p1:ve,p2:T}=(0,u.mulEndoUnsafe)(W,re,he,ye);return de(se.beta,ve,T,ue,ge)}else return me.unsafe(re,J)}multiplyAndAddUnsafe(J,se,re){const ue=this.multiplyUnsafe(se).add(J.multiplyUnsafe(re));return ue.is0()?void 0:ue}toAffine(J){return le(this,J)}isTorsionFree(){const{isTorsionFree:J}=p;return t===w?!0:J?J(W,this):me.unsafe(this,v).is0()}clearCofactor(){const{clearCofactor:J}=p;return t===w?this:J?J(W,this):this.multiplyUnsafe(t)}isSmallOrder(){return this.multiplyUnsafe(t).is0()}toBytes(J=!0){return(0,i._abool2)(J,"isCompressed"),this.assertValidity(),q(W,this,J)}toHex(J=!0){return(0,i.bytesToHex)(this.toBytes(J))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(J=!0){return this.toBytes(J)}_setWindowSize(J){this.precompute(J)}static normalizeZ(J){return(0,u.normalizeZ)(W,J)}static msm(J,se){return(0,u.pippenger)(W,h,J,se)}static fromPrivateKey(J){return W.BASE.multiply(S(h,J))}}W.BASE=new W(f.Gx,f.Gy,n.ONE),W.ZERO=new W(n.ZERO,n.ONE,n.ZERO),W.Fp=n,W.Fn=h;const pe=h.BITS,me=new u.wNAF(W,p.endo?Math.ceil(pe/2):pe);return W.BASE.precompute(8),W}function M(a){return Uint8Array.of(a?2:3)}function L(a,p){const o=a.ORDER;let n=D;for(let G=o-w;G%P===D;G/=P)n+=w;const h=n,f=P<<h-w-w,t=f*P,v=(o-w)/t,g=(v-w)/P,l=t-w,m=f,Q=a.pow(p,v),$=a.pow(p,(v+w)/P);let q=(G,X)=>{let z=Q,ee=a.pow(X,l),U=a.sqr(ee);U=a.mul(U,X);let Z=a.mul(G,U);Z=a.pow(Z,g),Z=a.mul(Z,ee),ee=a.mul(Z,X),U=a.mul(Z,G);let te=a.mul(U,ee);Z=a.pow(te,m);let ce=a.eql(Z,a.ONE);ee=a.mul(U,$),Z=a.mul(te,z),U=a.cmov(ee,U,ce),te=a.cmov(Z,te,ce);for(let le=h;le>w;le--){let ne=le-P;ne=P<<ne-w;let de=a.pow(te,ne);const W=a.eql(de,a.ONE);ee=a.mul(U,z),z=a.mul(z,z),de=a.mul(te,z),U=a.cmov(ee,U,W),te=a.cmov(de,te,W)}return{isValid:ce,value:U}};if(a.ORDER%x===_){const G=(a.ORDER-_)/x,X=a.sqrt(a.neg(p));q=(z,ee)=>{let U=a.sqr(ee);const Z=a.mul(z,ee);U=a.mul(U,Z);let te=a.pow(U,G);te=a.mul(te,Z);const ce=a.mul(te,X),le=a.mul(a.sqr(te),ee),ne=a.eql(le,z);let de=a.cmov(ce,te,ne);return{isValid:ne,value:de}}}return q}function F(a,p){(0,c.validateField)(a);const{A:o,B:n,Z:h}=p;if(!a.isValid(o)||!a.isValid(n)||!a.isValid(h))throw new Error("mapToCurveSimpleSWU: invalid opts");const f=L(a,h);if(!a.isOdd)throw new Error("Field does not have .isOdd()");return t=>{let v,g,l,m,Q,$,q,G;v=a.sqr(t),v=a.mul(v,h),g=a.sqr(v),g=a.add(g,v),l=a.add(g,a.ONE),l=a.mul(l,n),m=a.cmov(h,a.neg(g),!a.eql(g,a.ZERO)),m=a.mul(m,o),g=a.sqr(l),$=a.sqr(m),Q=a.mul($,o),g=a.add(g,Q),g=a.mul(g,l),$=a.mul($,m),Q=a.mul($,n),g=a.add(g,Q),q=a.mul(v,l);const{isValid:X,value:z}=f(g,$);G=a.mul(v,t),G=a.mul(G,z),q=a.cmov(q,l,X),G=a.cmov(G,z,X);const ee=a.isOdd(t)===a.isOdd(G);G=a.cmov(a.neg(G),G,ee);const U=(0,c.FpInvertBatch)(a,[m],!0)[0];return q=a.mul(q,U),{x:q,y:G}}}function E(a,p){return{secretKey:p.BYTES,publicKey:1+a.BYTES,publicKeyUncompressed:1+2*a.BYTES,publicKeyHasPrefix:!0,signature:2*p.BYTES}}function R(a,p={}){const{Fn:o}=a,n=p.randomBytes||i.randomBytes,h=Object.assign(E(a.Fp,o),{seed:(0,c.getMinHashLength)(o.ORDER)});function f(q){try{return!!S(o,q)}catch{return!1}}function t(q,G){const{publicKey:X,publicKeyUncompressed:z}=h;try{const ee=q.length;return G===!0&&ee!==X||G===!1&&ee!==z?!1:!!a.fromBytes(q)}catch{return!1}}function v(q=n(h.seed)){return(0,c.mapHashToField)((0,i._abytes2)(q,h.seed,"seed"),o.ORDER)}function g(q,G=!0){return a.BASE.multiply(S(o,q)).toBytes(G)}function l(q){const G=v(q);return{secretKey:G,publicKey:g(G)}}function m(q){if(typeof q=="bigint")return!1;if(q instanceof a)return!0;const{secretKey:G,publicKey:X,publicKeyUncompressed:z}=h;if(o.allowedLengths||G===X)return;const ee=(0,i.ensureBytes)("key",q).length;return ee===X||ee===z}function Q(q,G,X=!0){if(m(q)===!0)throw new Error("first arg must be private key");if(m(G)===!1)throw new Error("second arg must be public key");const z=S(o,q);return a.fromHex(G).multiply(z).toBytes(X)}return Object.freeze({getPublicKey:g,getSharedSecret:Q,keygen:l,Point:a,utils:{isValidSecretKey:f,isValidPublicKey:t,randomSecretKey:v,isValidPrivateKey:f,randomPrivateKey:v,normPrivateKeyToScalar:q=>S(o,q),precompute(q=8,G=a.BASE){return G.precompute(q,!1)}},lengths:h})}function H(a,p,o={}){(0,y.ahash)(p),(0,i._validateObject)(o,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=o.randomBytes||i.randomBytes,h=o.hmac||((se,...re)=>(0,r.hmac)(p,se,(0,i.concatBytes)(...re))),{Fp:f,Fn:t}=a,{ORDER:v,BITS:g}=t,{keygen:l,getPublicKey:m,getSharedSecret:Q,utils:$,lengths:q}=R(a,o),G={prehash:!1,lowS:typeof o.lowS=="boolean"?o.lowS:!1,format:void 0,extraEntropy:!1},X="compact";function z(se){const re=v>>w;return se>re}function ee(se,re){if(!t.isValidNot0(re))throw new Error(`invalid signature ${se}: out of range 1..Point.Fn.ORDER`);return re}function U(se,re){b(re);const ue=q.signature,he=re==="compact"?ue:re==="recovered"?ue+1:void 0;return(0,i._abytes2)(se,he,`${re} signature`)}class Z{constructor(re,ue,he){this.r=ee("r",re),this.s=ee("s",ue),he!=null&&(this.recovery=he),Object.freeze(this)}static fromBytes(re,ue=X){U(re,ue);let he;if(ue==="der"){const{r:T,s:Y}=e.DER.toSig((0,i._abytes2)(re));return new Z(T,Y)}ue==="recovered"&&(he=re[0],ue="compact",re=re.subarray(1));const ge=t.BYTES,ye=re.subarray(0,ge),ve=re.subarray(ge,ge*2);return new Z(t.fromBytes(ye),t.fromBytes(ve),he)}static fromHex(re,ue){return this.fromBytes((0,i.hexToBytes)(re),ue)}addRecoveryBit(re){return new Z(this.r,this.s,re)}recoverPublicKey(re){const ue=f.ORDER,{r:he,s:ge,recovery:ye}=this;if(ye==null||![0,1,2,3].includes(ye))throw new Error("recovery id invalid");if(v*P<ue&&ye>1)throw new Error("recovery id is ambiguous for h>1 curve");const T=ye===2||ye===3?he+v:he;if(!f.isValid(T))throw new Error("recovery id 2 or 3 invalid");const Y=f.toBytes(T),oe=a.fromBytes((0,i.concatBytes)(M((ye&1)===0),Y)),ie=t.inv(T),ae=ce((0,i.ensureBytes)("msgHash",re)),be=t.create(-ae*ie),_e=t.create(ge*ie),we=a.BASE.multiplyUnsafe(be).add(oe.multiplyUnsafe(_e));if(we.is0())throw new Error("point at infinify");return we.assertValidity(),we}hasHighS(){return z(this.s)}toBytes(re=X){if(b(re),re==="der")return(0,i.hexToBytes)(e.DER.hexFromSig(this));const ue=t.toBytes(this.r),he=t.toBytes(this.s);if(re==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,i.concatBytes)(Uint8Array.of(this.recovery),ue,he)}return(0,i.concatBytes)(ue,he)}toHex(re){return(0,i.bytesToHex)(this.toBytes(re))}assertValidity(){}static fromCompact(re){return Z.fromBytes((0,i.ensureBytes)("sig",re),"compact")}static fromDER(re){return Z.fromBytes((0,i.ensureBytes)("sig",re),"der")}normalizeS(){return this.hasHighS()?new Z(this.r,t.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,i.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,i.bytesToHex)(this.toBytes("compact"))}}const te=o.bits2int||function(re){if(re.length>8192)throw new Error("input is too large");const ue=(0,i.bytesToNumberBE)(re),he=re.length*8-g;return he>0?ue>>BigInt(he):ue},ce=o.bits2int_modN||function(re){return t.create(te(re))},le=(0,i.bitMask)(g);function ne(se){return(0,i.aInRange)("num < 2^"+g,se,D,le),t.toBytes(se)}function de(se,re){return(0,i._abytes2)(se,void 0,"message"),re?(0,i._abytes2)(p(se),void 0,"prehashed message"):se}function W(se,re,ue){if(["recovered","canonical"].some(be=>be in ue))throw new Error("sign() legacy options not supported");const{lowS:he,prehash:ge,extraEntropy:ye}=I(ue,G);se=de(se,ge);const ve=ce(se),T=S(t,re),Y=[ne(T),ne(ve)];if(ye!=null&&ye!==!1){const be=ye===!0?n(q.secretKey):ye;Y.push((0,i.ensureBytes)("extraEntropy",be))}const oe=(0,i.concatBytes)(...Y),ie=ve;function ae(be){const _e=te(be);if(!t.isValidNot0(_e))return;const we=t.inv(_e),Se=a.BASE.multiply(_e).toAffine(),Be=t.create(Se.x);if(Be===D)return;const Ke=t.create(we*t.create(ie+Be*T));if(Ke===D)return;let ze=(Se.x===Be?0:2)|Number(Se.y&w),it=Ke;return he&&z(Ke)&&(it=t.neg(Ke),ze^=1),new Z(Be,it,ze)}return{seed:oe,k2sig:ae}}function pe(se,re,ue={}){se=(0,i.ensureBytes)("message",se);const{seed:he,k2sig:ge}=W(se,re,ue);return(0,i.createHmacDrbg)(p.outputLen,t.BYTES,h)(he,ge)}function me(se){let re;const ue=typeof se=="string"||(0,i.isBytes)(se),he=!ue&&se!==null&&typeof se=="object"&&typeof se.r=="bigint"&&typeof se.s=="bigint";if(!ue&&!he)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(he)re=new Z(se.r,se.s);else if(ue){try{re=Z.fromBytes((0,i.ensureBytes)("sig",se),"der")}catch(ge){if(!(ge instanceof e.DER.Err))throw ge}if(!re)try{re=Z.fromBytes((0,i.ensureBytes)("sig",se),"compact")}catch{return!1}}return re||!1}function fe(se,re,ue,he={}){const{lowS:ge,prehash:ye,format:ve}=I(he,G);if(ue=(0,i.ensureBytes)("publicKey",ue),re=de((0,i.ensureBytes)("message",re),ye),"strict"in he)throw new Error("options.strict was renamed to lowS");const T=ve===void 0?me(se):Z.fromBytes((0,i.ensureBytes)("sig",se),ve);if(T===!1)return!1;try{const Y=a.fromBytes(ue);if(ge&&T.hasHighS())return!1;const{r:oe,s:ie}=T,ae=ce(re),be=t.inv(ie),_e=t.create(ae*be),we=t.create(oe*be),Se=a.BASE.multiplyUnsafe(_e).add(Y.multiplyUnsafe(we));return Se.is0()?!1:t.create(Se.x)===oe}catch{return!1}}function J(se,re,ue={}){const{prehash:he}=I(ue,G);return re=de(re,he),Z.fromBytes(se,"recovered").recoverPublicKey(re).toBytes()}return Object.freeze({keygen:l,getPublicKey:m,getSharedSecret:Q,utils:$,lengths:q,Point:a,sign:pe,verify:fe,recoverPublicKey:J,Signature:Z,hash:p})}function k(a){const{CURVE:p,curveOpts:o}=N(a),n=O(p,o);return j(a,n)}function N(a){const p={a:a.a,b:a.b,p:a.Fp.ORDER,n:a.n,h:a.h,Gx:a.Gx,Gy:a.Gy},o=a.Fp;let n=a.allowedPrivateKeyLengths?Array.from(new Set(a.allowedPrivateKeyLengths.map(t=>Math.ceil(t/2)))):void 0;const h=(0,c.Field)(p.n,{BITS:a.nBitLength,allowedLengths:n,modFromBytes:a.wrapPrivateKey}),f={Fp:o,Fn:h,allowInfinityPoint:a.allowInfinityPoint,endo:a.endo,isTorsionFree:a.isTorsionFree,clearCofactor:a.clearCofactor,fromBytes:a.fromBytes,toBytes:a.toBytes};return{CURVE:p,curveOpts:f}}function V(a){const{CURVE:p,curveOpts:o}=N(a),n={hmac:a.hmac,randomBytes:a.randomBytes,lowS:a.lowS,bits2int:a.bits2int,bits2int_modN:a.bits2int_modN};return{CURVE:p,curveOpts:o,hash:a.hash,ecdsaOpts:n}}function B(a,p,o){function n(h){const f=a.sqr(h),t=a.mul(f,h);return a.add(a.add(t,a.mul(h,p)),o)}return n}function j(a,p){const{Fp:o,Fn:n}=p;function h(t){return(0,i.inRange)(t,w,n.ORDER)}const f=B(o,a.a,a.b);return Object.assign({},{CURVE:a,Point:p,ProjectivePoint:p,normPrivateKeyToScalar:t=>S(n,t),weierstrassEquation:f,isWithinCurveOrder:h})}function K(a,p){const o=p.Point;return Object.assign({},p,{ProjectivePoint:o,CURVE:Object.assign({},a,(0,c.nLength)(o.Fn.ORDER,o.Fn.BITS))})}function C(a){const{CURVE:p,curveOpts:o,hash:n,ecdsaOpts:h}=V(a),f=O(p,o),t=H(f,n,h);return K(a,t)}})(jt)),jt}var ds;function gi(){if(ds)return tt;ds=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt.getHash=r,tt.createCurve=y;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=fs();function r(i){return{hash:i}}function y(i,u){const c=s=>(0,e.weierstrass)({...i,hash:s});return{...c(u),create:c}}return tt}var hs;function mi(){return hs||(hs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.secp256k1_hasher=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=Kt(),y=De(),i=gi(),u=os(),c=Ue(),s=fs(),d=ke(),b={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},I={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},A=BigInt(0),D=BigInt(1),w=BigInt(2);function P(K){const C=b.p,a=BigInt(3),p=BigInt(6),o=BigInt(11),n=BigInt(22),h=BigInt(23),f=BigInt(44),t=BigInt(88),v=K*K*K%C,g=v*v*K%C,l=(0,c.pow2)(g,a,C)*g%C,m=(0,c.pow2)(l,a,C)*g%C,Q=(0,c.pow2)(m,w,C)*v%C,$=(0,c.pow2)(Q,o,C)*Q%C,q=(0,c.pow2)($,n,C)*$%C,G=(0,c.pow2)(q,f,C)*q%C,X=(0,c.pow2)(G,t,C)*G%C,z=(0,c.pow2)(X,f,C)*q%C,ee=(0,c.pow2)(z,a,C)*g%C,U=(0,c.pow2)(ee,h,C)*$%C,Z=(0,c.pow2)(U,p,C)*v%C,te=(0,c.pow2)(Z,w,C);if(!_.eql(_.sqr(te),K))throw new Error("Cannot find square root");return te}const _=(0,c.Field)(b.p,{sqrt:P});e.secp256k1=(0,i.createCurve)({...b,Fp:_,lowS:!0,endo:I},r.sha256);const x={};function S(K,...C){let a=x[K];if(a===void 0){const p=(0,r.sha256)((0,d.utf8ToBytes)(K));a=(0,d.concatBytes)(p,p),x[K]=a}return(0,r.sha256)((0,d.concatBytes)(a,...C))}const O=K=>K.toBytes(!0).slice(1),M=e.secp256k1.Point,L=K=>K%w===A;function F(K){const{Fn:C,BASE:a}=M,p=(0,s._normFnElement)(C,K),o=a.multiply(p);return{scalar:L(o.y)?p:C.neg(p),bytes:O(o)}}function E(K){const C=_;if(!C.isValidNot0(K))throw new Error("invalid x: Fail if x \u2265 p");const a=C.create(K*K),p=C.create(a*K+BigInt(7));let o=C.sqrt(p);L(o)||(o=C.neg(o));const n=M.fromAffine({x:K,y:o});return n.assertValidity(),n}const R=d.bytesToNumberBE;function H(...K){return M.Fn.create(R(S("BIP0340/challenge",...K)))}function k(K){return F(K).bytes}function N(K,C,a=(0,y.randomBytes)(32)){const{Fn:p}=M,o=(0,d.ensureBytes)("message",K),{bytes:n,scalar:h}=F(C),f=(0,d.ensureBytes)("auxRand",a,32),t=p.toBytes(h^R(S("BIP0340/aux",f))),v=S("BIP0340/nonce",t,n,o),{bytes:g,scalar:l}=F(v),m=H(g,n,o),Q=new Uint8Array(64);if(Q.set(g,0),Q.set(p.toBytes(p.create(l+m*h)),32),!V(Q,o,n))throw new Error("sign: Invalid signature produced");return Q}function V(K,C,a){const{Fn:p,BASE:o}=M,n=(0,d.ensureBytes)("signature",K,64),h=(0,d.ensureBytes)("message",C),f=(0,d.ensureBytes)("publicKey",a,32);try{const t=E(R(f)),v=R(n.subarray(0,32));if(!(0,d.inRange)(v,D,b.p))return!1;const g=R(n.subarray(32,64));if(!(0,d.inRange)(g,D,b.n))return!1;const l=H(p.toBytes(v),O(t),h),m=o.multiplyUnsafe(g).add(t.multiplyUnsafe(p.neg(l))),{x:Q,y:$}=m.toAffine();return!(m.is0()||!L($)||Q!==v)}catch{return!1}}e.schnorr=(()=>{const a=(o=(0,y.randomBytes)(48))=>(0,c.mapHashToField)(o,b.n);e.secp256k1.utils.randomSecretKey;function p(o){const n=a(o);return{secretKey:n,publicKey:k(n)}}return{keygen:p,getPublicKey:k,sign:N,verify:V,Point:M,utils:{randomSecretKey:a,randomPrivateKey:a,taggedHash:S,lift_x:E,pointToBytes:O,numberToBytesBE:d.numberToBytesBE,bytesToNumberBE:d.bytesToNumberBE,mod:c.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();const B=(0,u.isogenyMap)(_,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(K=>K.map(C=>BigInt(C)))),j=(0,s.mapToCurveSimpleSWU)(_,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:_.create(BigInt("-11"))});e.secp256k1_hasher=(0,u.createHasher)(e.secp256k1.Point,K=>{const{x:C,y:a}=j(_.create(K[0]));return B(C,a)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:_.ORDER,m:1,k:128,expand:"xmd",hash:r.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})(Ft)),Ft}var Mt={},ps;function ys(){return ps||(ps=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var r=Le(),y=function(u){return u.startsWith("0x")||u.startsWith("0X")?u.slice(2):u};e.remove0x=y;var i=function(u){return(0,r.hexToBytes)((0,e.remove0x)(u))};e.decodeHex=i})(Mt)),Mt}var vs;function bi(){return vs||(vs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var r=Zr(),y=vi(),i=mi(),u=ut(),c=Nt(),s=ys(),d=function(S){var O;do O=(0,r.randomBytes)(c.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(O,S));return O};e.getValidSecret=d;var b=function(S,O){return P(O,function(M){return M.utils.isValidSecretKey(S)},function(){return!0},function(){return!0})};e.isValidPrivateKey=b;var I=function(S,O){return P(O,function(M){return M.getPublicKey(S)},function(M){return M.getPublicKey(S)},function(M){return M.getPublicKey(S)})};e.getPublicKey=I;var A=function(S,O,M,L){return P(L,function(F){return F.getSharedSecret(S,O,M)},function(F){return F.getSharedSecret(S,O)},function(F){return x(F,S,O)})};e.getSharedPoint=A;var D=function(S,O,M){return P(M,function(L){return L.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),S,O)},function(){return S},function(){return S})};e.convertPublicKeyFormat=D;var w=function(S,O){var M=(0,s.decodeHex)(S);return P(O,function(){return _(M)},function(){return M},function(){return M})};e.hexToPublicKey=w;function P(S,O,M,L){var F=S||(0,u.ellipticCurve)();if(F==="secp256k1")return O(i.secp256k1);if(F==="x25519")return M(y.x25519);if(F==="ed25519")return L(y.ed25519);throw new Error("Not implemented")}var _=function(S){if(S.length===c.ETH_PUBLIC_KEY_SIZE){var O=new Uint8Array(1+S.length);return O.set([4]),O.set(S,1),O}return S},x=function(S,O,M){var L=S.utils.getExtendedPublicKey(O).scalar,F=S.Point.fromBytes(M).multiply(L);return F.toBytes()}})(Pt)),Pt}var Gt={},Me={},gs;function Ei(){if(gs)return Me;gs=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.hkdf=void 0,Me.extract=y,Me.expand=c;const e=us(),r=De();function y(d,b,I){return(0,r.ahash)(d),I===void 0&&(I=new Uint8Array(d.outputLen)),(0,e.hmac)(d,(0,r.toBytes)(I),(0,r.toBytes)(b))}const i=Uint8Array.from([0]),u=Uint8Array.of();function c(d,b,I,A=32){(0,r.ahash)(d),(0,r.anumber)(A);const D=d.outputLen;if(A>255*D)throw new Error("Length should be <= 255*HashLen");const w=Math.ceil(A/D);I===void 0&&(I=u);const P=new Uint8Array(w*D),_=e.hmac.create(d,b),x=_._cloneInto(),S=new Uint8Array(_.outputLen);for(let O=0;O<w;O++)i[0]=O+1,x.update(O===0?u:S).update(I).update(i).digestInto(S),P.set(S,D*O),_._cloneInto(x);return _.destroy(),x.destroy(),(0,r.clean)(S,i),P.slice(0,A)}const s=(d,b,I,A,D)=>c(d,y(d,b,I),A,D);return Me.hkdf=s,Me}var ms;function _i(){return ms||(ms=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var r=Le(),y=Ei(),i=Kt(),u=function(s,d,b){return(0,y.hkdf)(i.sha256,s,d,b,32)};e.deriveKey=u;var c=function(){for(var s=[],d=0;d<arguments.length;d++)s[d]=arguments[d];return(0,e.deriveKey)(r.concatBytes.apply(void 0,s))};e.getSharedKey=c})(Gt)),Gt}var Yt={},Ge={},nt={};const wi=Fo(import.meta.url);function Si(){return wi("node:crypto")}var bs;function Es(){if(bs)return nt;bs=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt._compat=void 0;var e=Le(),r=Si(),y=16,i=globalThis.Deno!==void 0,u=function(c,s,d,b){var I=c==="aes-256-gcm"||c==="chacha20-poly1305",A=I?y:0,D=I?{authTagLength:A}:void 0,w=function(_){var x=(0,r.createCipheriv)(c,s,d,D);I&&b!==void 0&&x.setAAD(b);var S=x.update(_),O=x.final(),M=I?x.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(S,O,M)},P=function(_){var x=_.subarray(0,_.length-A),S=_.subarray(_.length-A),O=(0,r.createDecipheriv)(c,s,d,D);I&&(b!==void 0&&O.setAAD(b),O.setAuthTag(S)),!I&&i&&O.setAutoPadding(!1);var M=O.update(x),L=O.final();return(0,e.concatBytes)(M,L)};return{encrypt:w,decrypt:P}};return nt._compat=u,nt}var _s;function Ai(){if(_s)return Ge;_s=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.aes256cbc=Ge.aes256gcm=void 0;var e=Es(),r=function(i,u,c){return(0,e._compat)("aes-256-gcm",i,u,c)};Ge.aes256gcm=r;var y=function(i,u,c){return(0,e._compat)("aes-256-cbc",i,u)};return Ge.aes256cbc=y,Ge}var Ye={},rt={},ws;function xi(){if(ws)return rt;ws=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt._hchacha20=void 0;var e=function(y,i,u,c){for(var s=y[0],d=y[1],b=y[2],I=y[3],A=i[0],D=i[1],w=i[2],P=i[3],_=i[4],x=i[5],S=i[6],O=i[7],M=u[0],L=u[1],F=u[2],E=u[3],R=0;R<20;R+=2)s=s+A|0,M=r(M^s,16),_=_+M|0,A=r(A^_,12),s=s+A|0,M=r(M^s,8),_=_+M|0,A=r(A^_,7),d=d+D|0,L=r(L^d,16),x=x+L|0,D=r(D^x,12),d=d+D|0,L=r(L^d,8),x=x+L|0,D=r(D^x,7),b=b+w|0,F=r(F^b,16),S=S+F|0,w=r(w^S,12),b=b+w|0,F=r(F^b,8),S=S+F|0,w=r(w^S,7),I=I+P|0,E=r(E^I,16),O=O+E|0,P=r(P^O,12),I=I+P|0,E=r(E^I,8),O=O+E|0,P=r(P^O,7),s=s+D|0,E=r(E^s,16),S=S+E|0,D=r(D^S,12),s=s+D|0,E=r(E^s,8),S=S+E|0,D=r(D^S,7),d=d+w|0,M=r(M^d,16),O=O+M|0,w=r(w^O,12),d=d+w|0,M=r(M^d,8),O=O+M|0,w=r(w^O,7),b=b+P|0,L=r(L^b,16),_=_+L|0,P=r(P^_,12),b=b+P|0,L=r(L^b,8),_=_+L|0,P=r(P^_,7),I=I+A|0,F=r(F^I,16),x=x+F|0,A=r(A^x,12),I=I+A|0,F=r(F^I,8),x=x+F|0,A=r(A^x,7);var H=0;c[H++]=s,c[H++]=d,c[H++]=b,c[H++]=I,c[H++]=M,c[H++]=L,c[H++]=F,c[H++]=E};rt._hchacha20=e;var r=function(y,i){return y<<i|y>>>32-i};return rt}var Ss;function Bi(){if(Ss)return Ye;Ss=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.chacha20=Ye.xchacha20=void 0;var e=Le(),r=Es(),y=xi(),i=function(c,s,d){if(s.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var b=new Uint32Array([1634760805,857760878,2036477234,1797285236]),I=new Uint32Array(8);(0,y._hchacha20)(b,(0,e.u32)(c),(0,e.u32)(s.subarray(0,16)),I);var A=new Uint8Array(12);return A.set([0,0,0,0]),A.set(s.subarray(16),4),(0,r._compat)("chacha20-poly1305",(0,e.u8)(I),A,d)};Ye.xchacha20=i;var u=function(c,s,d){if(s.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,r._compat)("chacha20-poly1305",c,s,d)};return Ye.chacha20=u,Ye}var As;function Ri(){return As||(As=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var r=Ai(),y=Bi(),i=Le(),u=Zr(),c=ut(),s=Nt(),d=function(w,P,_){return I(A,w,P,_)};e.symEncrypt=d;var b=function(w,P,_){return I(D,w,P,_)};e.symDecrypt=b,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function I(w,P,_,x){var S=(0,c.symmetricAlgorithm)();if(S==="aes-256-gcm")return w(r.aes256gcm,P,_,(0,c.symmetricNonceLength)(),s.AEAD_TAG_LENGTH,x);if(S==="xchacha20")return w(y.xchacha20,P,_,s.XCHACHA20_NONCE_LENGTH,s.AEAD_TAG_LENGTH,x);if(S==="aes-256-cbc")return w(r.aes256cbc,P,_,16,0);throw new Error("Not implemented")}function A(w,P,_,x,S,O){var M=(0,u.randomBytes)(x),L=w(P,M,O),F=L.encrypt(_);if(S===0)return(0,i.concatBytes)(M,F);var E=F.length-S,R=F.subarray(0,E),H=F.subarray(E);return(0,i.concatBytes)(M,H,R)}function D(w,P,_,x,S,O){var M=_.subarray(0,x),L=w(P,Uint8Array.from(M),O),F=_.subarray(x);if(S===0)return L.decrypt(F);var E=F.subarray(0,S),R=F.subarray(S);return L.decrypt((0,i.concatBytes)(R,E))}})(Yt)),Yt}var xs;function $t(){return xs||(xs=1,(function(e){var r=je&&je.__createBinding||(Object.create?(function(i,u,c,s){s===void 0&&(s=c);var d=Object.getOwnPropertyDescriptor(u,c);(!d||("get"in d?!u.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return u[c]}}),Object.defineProperty(i,s,d)}):(function(i,u,c,s){s===void 0&&(s=c),i[s]=u[c]})),y=je&&je.__exportStar||function(i,u){for(var c in i)c!=="default"&&!Object.prototype.hasOwnProperty.call(u,c)&&r(u,i,c)};Object.defineProperty(e,"__esModule",{value:!0}),y(bi(),e),y(_i(),e),y(ys(),e),y(Ri(),e)})(je)),je}var st={},Bs;function Rs(){if(Bs)return st;Bs=1,Object.defineProperty(st,"__esModule",{value:!0}),st.PublicKey=void 0;var e=Le(),r=$t(),y=(function(){function i(u,c){var s=(0,r.convertPublicKeyFormat)(u,!0,c),d=(0,r.convertPublicKeyFormat)(u,!1,c);this.data=s,this.dataUncompressed=s.length!==d.length?d:null}return i.fromHex=function(u,c){return new i((0,r.hexToPublicKey)(u,c),c)},Object.defineProperty(i.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),i.prototype.toBytes=function(u){return u===void 0&&(u=!0),u?this.data:this._uncompressed},i.prototype.toHex=function(u){return u===void 0&&(u=!0),(0,e.bytesToHex)(this.toBytes(u))},i.prototype.decapsulate=function(u,c){c===void 0&&(c=!1);var s=this.toBytes(c),d=u.multiply(this,c);return(0,r.getSharedKey)(s,d)},i.prototype.equals=function(u){return(0,e.equalBytes)(this.data,u.data)},i})();return st.PublicKey=y,st}var Is;function Ii(){if(Is)return Qe;Is=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.PrivateKey=void 0;var e=Le(),r=$t(),y=Rs(),i=(function(){function u(c,s){if(this.curve=s,c===void 0)this.data=(0,r.getValidSecret)(s);else if((0,r.isValidPrivateKey)(c,s))this.data=c;else throw new Error("Invalid private key");this.publicKey=new y.PublicKey((0,r.getPublicKey)(this.data,s),s)}return u.fromHex=function(c,s){return new u((0,r.decodeHex)(c),s)},Object.defineProperty(u.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),u.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},u.prototype.encapsulate=function(c,s){s===void 0&&(s=!1);var d=this.publicKey.toBytes(s),b=this.multiply(c,s);return(0,r.getSharedKey)(d,b)},u.prototype.multiply=function(c,s){return s===void 0&&(s=!1),(0,r.getSharedPoint)(this.data,c.toBytes(!0),s,this.curve)},u.prototype.equals=function(c){return(0,e.equalBytes)(this.data,c.data)},u})();return Qe.PrivateKey=i,Qe}var Os;function Ts(){return Os||(Os=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var r=Ii();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return r.PrivateKey}});var y=Rs();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return y.PublicKey}})})(Ct)),Ct}var Ns;function Zt(){return Ns||(Ns=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=c,e.decrypt=d;var r=Le(),y=ut(),i=Ts(),u=$t();function c(D,w){return Buffer.from(s(D,w))}function s(D,w){var P=(0,y.ellipticCurve)(),_=new i.PrivateKey(void 0,P),x=D instanceof Uint8Array?new i.PublicKey(D,P):i.PublicKey.fromHex(D,P),S=_.encapsulate(x,(0,y.isHkdfKeyCompressed)()),O=_.publicKey.toBytes((0,y.isEphemeralKeyCompressed)()),M=(0,u.symEncrypt)(S,w);return(0,r.concatBytes)(O,M)}function d(D,w){return Buffer.from(b(D,w))}function b(D,w){var P=(0,y.ellipticCurve)(),_=D instanceof Uint8Array?new i.PrivateKey(D,P):i.PrivateKey.fromHex(D,P),x=(0,y.ephemeralKeySize)(),S=new i.PublicKey(w.subarray(0,x),P),O=w.subarray(x),M=S.decapsulate(_,(0,y.isHkdfKeyCompressed)());return(0,u.symDecrypt)(M,O)}var I=ut();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return I.ECIES_CONFIG}});var A=Ts();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return A.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return A.PublicKey}}),e.utils={aesEncrypt:u.aesEncrypt,aesDecrypt:u.aesDecrypt,symEncrypt:u.symEncrypt,symDecrypt:u.symDecrypt,decodeHex:u.decodeHex,getValidSecret:u.getValidSecret,remove0x:u.remove0x}})(It)),It}var Xt,Cs;function Ps(){if(Cs)return Xt;Cs=1;function e(r,y=7){return r&&r.length>0?r.slice(0,y)+"\u2026":""}return Xt=e,Xt}var Wt,Hs;function Ze(){if(Hs)return Wt;Hs=1;const e=Ps();class r{constructor(i={}){this.filepath=i.filepath,this.envFilepath=i.envFilepath,this.key=i.key,this.privateKey=i.privateKey,this.privateKeyName=i.privateKeyName,this.command=i.command,this.message=i.message}missingEnvFile(){const i="MISSING_ENV_FILE",u=`[${i}] missing ${this.envFilepath} file (${this.filepath})`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/484`,s=new Error(u);return s.code=i,s.help=c,s}missingKey(){const i="MISSING_KEY",u=`[${i}] missing ${this.key} key`,c=new Error(u);return c.code=i,c}missingPrivateKey(){const i="MISSING_PRIVATE_KEY",u=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/464`,s=new Error(u);return s.code=i,s.help=c,s}invalidPrivateKey(){const i="INVALID_PRIVATE_KEY",u=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/465`,s=new Error(u);return s.code=i,s.help=c,s}looksWrongPrivateKey(){const i="WRONG_PRIVATE_KEY",u=`[${i}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/466`,s=new Error(u);return s.code=i,s.help=c,s}malformedEncryptedData(){const i="MALFORMED_ENCRYPTED_DATA",u=`[${i}] could not decrypt ${this.key} because encrypted data appears malformed`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/467`,s=new Error(u);return s.code=i,s.help=c,s}decryptionFailed(){const i="DECRYPTION_FAILED",u=this.message,c=new Error(u);return c.code=i,c}commandSubstitutionFailed(){const i="COMMAND_SUBSTITUTION_FAILED",u=`[${i}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/532`,s=new Error(u);return s.code=i,s.help=c,s}dangerousDependencyHoist(){const i="DANGEROUS_DEPENDENCY_HOIST",u=`[${i}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`,c=`[${i}] https://github.com/dotenvx/dotenvx/issues/622`,s=new Error(u);return s.code=i,s.help=c,s}}return Wt=r,Wt}var zt,Ls;function Ds(){if(Ls)return zt;Ls=1;const{decrypt:e}=Zt(),r=Ze(),y="encrypted:";function i(u,c,s,d){let b,I;if(!c.startsWith(y))return c;if(d=d||"",d.length<=0)I=new r({key:u,privateKeyName:s,privateKey:d}).missingPrivateKey();else{const A=d.split(",");for(const D of A){const w=Buffer.from(D,"hex"),P=c.substring(y.length),_=Buffer.from(P,"base64");try{b=e(w,_).toString(),I=null;break}catch(x){x.message==="Invalid private key"?I=new r({key:u,privateKeyName:s,privateKey:d}).invalidPrivateKey():x.message==="Unsupported state or unable to authenticate data"?I=new r({key:u,privateKeyName:s,privateKey:d}).looksWrongPrivateKey():x.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?I=new r({key:u,privateKeyName:s,privateKey:d}).malformedEncryptedData():I=new r({key:u,privateKeyName:s,privateKey:d,message:x.message}).decryptionFailed()}}}if(I)throw I;return b}return zt=i,zt}var Qt,Ks;function Oi(){if(Ks)return Qt;Ks=1;function e(r){return r.replace(/[\r\n]+$/,"")}return Qt=e,Qt}var Jt,qs;function Ti(){if(qs)return Jt;qs=1;const{execSync:e}=Fn,r=Oi(),y=Ze();function i(u,c,s,d){return(c.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((I,A)=>{const D=A.slice(2,-1);let w;try{w=e(D,{env:{...s,...d}}).toString()}catch(P){throw new y({key:u,command:D,message:P.message.trim()}).commandSubstitutionFailed()}return w=r(w),I.replace(A,w)},c)}return Jt=i,Jt}var en,Vs;function Ni(){if(Vs)return en;Vs=1;function e(r){return r.replace(/\\\$/g,"$")}return en=e,en}var tn,ks;function Fs(){if(ks)return tn;ks=1;const e=Ds(),r=Ti(),y=Ni();class i{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(c,s=null,d=process.env,b=!1,I=null){this.src=c,this.privateKey=s,this.privateKeyName=I,this.processEnv=d,this.overload=b,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const c=this.getLines();let s;for(;(s=i.LINE.exec(c))!==null;){const d=s[1],b=s[2],I=this.quote(b);this.parsed[d]=this.clean(b,I),!this.overload&&this.inProcessEnv(d)&&(this.parsed[d]=this.processEnv[d]);try{this.parsed[d]=this.decrypt(d,this.parsed[d])}catch(D){this.errors.push(D)}let A=!1;if(I!=="'"&&(!this.inProcessEnv(d)||this.processEnv[d]===this.parsed[d])){const D=this.parsed[d];try{this.parsed[d]=this.eval(d,D)}catch(w){this.errors.push(w)}D!==this.parsed[d]&&(A=!0)}!A&&I!=="'"&&(!this.processEnv[d]||this.overload)&&(this.parsed[d]=y(this.expand(this.parsed[d]))),I==="'"&&(this.literals[d]=this.parsed[d]),this.runningParsed[d]=this.parsed[d],Object.prototype.hasOwnProperty.call(this.processEnv,d)&&!this.overload?this.preExisted[d]=this.processEnv[d]:this.injected[d]=this.parsed[d]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(c){return(c||"").trim()}quote(c){const d=this.trimmer(c)[0];let b="";switch(d){case"'":b="'";break;case'"':b='"';break;case"`":b="`";break;default:b=""}return b}clean(c,s){let d=this.trimmer(c);return d=d.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(d=d.replace(/\\n/g,`
|
|
5
|
-
`)
|
|
6
|
-
`)}}return tn=i,tn}var nn,js;function Xe(){if(js)return nn;js=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(y,i=!1,u=!1,c=!1){const s={};let d=y.toString();u||(d=d.replace(/\r\n?/mg,`
|
|
7
|
-
`));
|
|
8
|
-
`)
|
|
9
|
-
|
|
2
|
+
import{defineCommand as to,runMain as no}from"citty";import Fe from"fs";import Re from"path";import ro from"tty";import{createRequire as so}from"node:module";import nr from"child_process";import io from"util";import oo from"os";import{isEqual as co}from"es-toolkit";import{algoliasearch as ao}from"algoliasearch";const uo="algolia-uploader",lo="0.0.14",fo="command-line util to upload Algolia source";function ho(e){return Fe.readdirSync(e).filter(r=>r.endsWith(".json")).map(r=>{const f=Fe.readFileSync(Re.join(e,r),"utf8");return JSON.parse(f)})}function yo(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var f=function c(){var s=!1;try{s=this instanceof c}catch{}return s?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};f.prototype=r.prototype}else f={};return Object.defineProperty(f,"__esModule",{value:!0}),Object.keys(e).forEach(function(c){var s=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(f,c,s.get?s:{enumerable:!0,get:function(){return e[c]}})}),f}var rr={};const sr="1.61.1",ir="@dotenvx/dotenvx",or="secrets for agents\u2013from the creator of `dotenv`",cr="@motdotla",ar=["dotenv","env"],ur="https://github.com/dotenvx/dotenvx",lr={type:"git",url:"git+https://github.com/dotenvx/dotenvx.git"},fr="BSD-3-Clause",dr=["src/**/*","CHANGELOG.md"],hr="src/lib/main.js",yr="src/lib/main.d.ts",pr={".":{types:"./src/lib/main.d.ts",require:"./src/lib/main.js",default:"./src/lib/main.js"},"./config":"./src/lib/config.js","./config.js":"./src/lib/config.js","./package.json":"./package.json"},vr={dotenvx:"./src/cli/dotenvx.js"},mr={standard:"standard","standard:fix":"standard --fix",test:"tap run --test-env=DOTENVX_NO_OPS=true --allow-empty-coverage --disable-coverage --timeout=60000","test-coverage":"tap run --test-env=DOTENVX_NO_OPS=true --show-full-coverage --timeout=60000",testshell:"bash shellspec",prerelease:"npm test && npm run testshell",release:"standard-version"},gr="https://dotenvx.com",br={commander:"^11.1.0",dotenv:"^17.2.1",eciesjs:"^0.4.10",execa:"^5.1.1",fdir:"^6.2.0",ignore:"^5.3.0","object-treeify":"1.1.33",picomatch:"^4.0.4",which:"^4.0.0","yocto-spinner":"^1.1.0"},Er={"@yao-pkg/pkg":"^6.14.2","capture-console":"^1.0.2",esbuild:"^0.25.8",proxyquire:"^2.1.3",sinon:"^14.0.1",standard:"^17.1.0","standard-version":"^9.5.0",tap:"^21.0.1"},_r={access:"public",provenance:!0},po={version:sr,name:ir,description:or,author:cr,keywords:ar,homepage:ur,repository:lr,license:fr,files:dr,main:hr,types:yr,exports:pr,bin:vr,scripts:mr,funding:gr,dependencies:br,devDependencies:Er,publishConfig:_r},vo={__proto__:null,author:cr,bin:vr,default:po,dependencies:br,description:or,devDependencies:Er,exports:pr,files:dr,funding:gr,homepage:ur,keywords:ar,license:fr,main:hr,name:ir,publishConfig:_r,repository:lr,scripts:mr,types:yr,version:sr},mo=yo(vo);var ht,wr;function go(){if(wr)return ht;wr=1;const{name:e,version:r,description:f}=mo;return ht={name:e,version:r,description:f},ht}var yt,Sr;function bo(){if(Sr)return yt;Sr=1;function e(r,f=7){return r&&r.length>0?r.slice(0,f)+"\u2026":""}return yt=e,yt}var pt,xr;function Pe(){if(xr)return pt;xr=1;const e=bo(),r={COMMAND_EXITED_WITH_CODE:"https://github.com/dotenvx/dotenvx/issues/new",COMMAND_SUBSTITUTION_FAILED:"https://github.com/dotenvx/dotenvx/issues/532",DECRYPTION_FAILED:"https://github.com/dotenvx/dotenvx/issues/757",DANGEROUS_DEPENDENCY_HOIST:"https://github.com/dotenvx/dotenvx/issues/622",INVALID_COLOR:"must be 256 colors",INVALID_CONVENTION:"https://github.com/dotenvx/dotenvx/issues/761",INVALID_PRIVATE_KEY:"https://github.com/dotenvx/dotenvx/issues/465",INVALID_PUBLIC_KEY:"https://github.com/dotenvx/dotenvx/issues/756",MALFORMED_ENCRYPTED_DATA:"https://github.com/dotenvx/dotenvx/issues/467",MISPAIRED_PRIVATE_KEY:"https://github.com/dotenvx/dotenvx/issues/752",MISSING_DIRECTORY:"https://github.com/dotenvx/dotenvx/issues/758",MISSING_ENV_FILE:"https://github.com/dotenvx/dotenvx/issues/484",MISSING_ENV_KEYS_FILE:"https://github.com/dotenvx/dotenvx/issues/775",MISSING_ENV_FILES:"https://github.com/dotenvx/dotenvx/issues/760",MISSING_KEY:"https://github.com/dotenvx/dotenvx/issues/759",MISSING_LOG_LEVEL:"must be valid log level",MISSING_PRIVATE_KEY:"https://github.com/dotenvx/dotenvx/issues/464",PRECOMMIT_HOOK_MODIFY_FAILED:"try again or report error",WRONG_PRIVATE_KEY:"https://github.com/dotenvx/dotenvx/issues/466"};class f{constructor(s={}){this.filepath=s.filepath,this.envFilepath=s.envFilepath,this.envKeysFilepath=s.envKeysFilepath,this.key=s.key,this.privateKey=s.privateKey,this.privateKeyName=s.privateKeyName,this.publicKeyName=s.publicKeyName,this.publicKey=s.publicKey,this.publicKeyExisting=s.publicKeyExisting,this.command=s.command,this.message=s.message,this.code=s.code,this.help=s.help,this.debug=s.debug,this.convention=s.convention,this.directory=s.directory,this.exitCode=s.exitCode,this.level=s.level,this.color=s.color,this.error=s.error}custom(){const s=new Error(this.message);return this.code&&(s.code=this.code),this.help&&(s.help=this.help),this.code&&!s.help&&(s.help=`fix: [${r[this.code]}]`),s.messageWithHelp=`${s.message}. ${s.help}`,this.debug&&(s.debug=this.debug),s}commandExitedWithCode(){const s="COMMAND_EXITED_WITH_CODE",i=`[${s}] Command exited with exit code ${this.exitCode}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}commandSubstitutionFailed(){const s="COMMAND_SUBSTITUTION_FAILED",i=`[${s}] could not eval ${this.key} containing command '${this.command}': ${this.message}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}decryptionFailed(){const s="DECRYPTION_FAILED",i=`[${s}] ${this.message}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}dangerousDependencyHoist(){const s="DANGEROUS_DEPENDENCY_HOIST",i=`[${s}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}invalidColor(){const s="INVALID_COLOR",i=`[${s}] Invalid color ${this.color}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}invalidConvention(){const s="INVALID_CONVENTION",i=`[${s}] invalid convention (${this.convention})`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}invalidPrivateKey(){const s="INVALID_PRIVATE_KEY",i=`[${s}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}invalidPublicKey(){const s="INVALID_PUBLIC_KEY",i=`[${s}] could not encrypt using public key '${this.publicKeyName}=${e(this.publicKey)}'`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}malformedEncryptedData(){const s="MALFORMED_ENCRYPTED_DATA",i=`[${s}] could not decrypt ${this.key} because encrypted data appears malformed`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}mispairedPrivateKey(){const s="MISPAIRED_PRIVATE_KEY",i=`[${s}] private key's derived public key (${e(this.publicKey)}) does not match the existing public key (${e(this.publicKeyExisting)})`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingDirectory(){const s="MISSING_DIRECTORY",i=`[${s}] missing directory (${this.directory})`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingEnvFile(){const s="MISSING_ENV_FILE",i=this.envFilepath||".env",n=`[${s}] missing file (${i})`,o=`fix: [${r[s]}]`,m=new Error(n);return m.code=s,m.help=o,m.messageWithHelp=`${n}. ${o}`,m}missingEnvKeysFile(){const s="MISSING_ENV_KEYS_FILE",i=this.envKeysFilepath||".env.keys",n=`[${s}] missing file (${i})`,o=`fix: [${r[s]}]`,m=new Error(n);return m.code=s,m.help=o,m.messageWithHelp=`${n}. ${o}`,m}missingEnvFiles(){const s="MISSING_ENV_FILES",i=`[${s}] no .env* files found`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingKey(){const s="MISSING_KEY",i=`[${s}] missing key (${this.key})`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingLogLevel(){const s="MISSING_LOG_LEVEL",i=`[${s}] missing log level '${this.level}'. implement in logger`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}missingPrivateKey(){const s="MISSING_PRIVATE_KEY",i=`[${s}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}precommitHookModifyFailed(){const s="PRECOMMIT_HOOK_MODIFY_FAILED",i=`[${s}] failed to modify pre-commit hook: ${this.error.message}`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}wrongPrivateKey(){const s="WRONG_PRIVATE_KEY",i=`[${s}] could not decrypt ${this.key} using private key '${this.privateKeyName}=${e(this.privateKey)}'`,n=`fix: [${r[s]}]`,o=new Error(i);return o.code=s,o.help=n,o.messageWithHelp=`${i}. ${n}`,o}}return f.ISSUE_BY_CODE=r,pt=f,pt}var vt,Ar;function Eo(){if(Ar)return vt;Ar=1;const{WriteStream:e}=ro;return vt={getColorDepth:()=>{try{return e.prototype.getColorDepth()}catch{const c=process.env.TERM;return c&&(c.includes("256color")||c.includes("xterm"))?8:4}}},vt}var mt,Br;function Rr(){if(Br)return mt;Br=1;const e=Eo(),r=Pe(),f=new Map([["amber",33],["blue",34],["gray",37],["green",32],["olive",33],["orangered",33],["plum",35],["red",31],["electricblue",36],["dodgerblue",36]]),c=new Map([["amber",136],["blue",21],["gray",244],["green",34],["olive",142],["orangered",130],["plum",182],["red",124],["electricblue",45],["dodgerblue",33]]),s=new Map([["amber",[236,213,63]],["orangered",[138,90,43]],["red",[140,35,50]]]);function i(o){const m=e.getColorDepth();if(!c.has(o))throw new r({color:o}).invalidColor();if(m>=24&&s.has(o)){const[w,O,N]=s.get(o);return F=>`\x1B[38;2;${w};${O};${N}m${F}\x1B[39m`}if(m>=8){const w=c.get(o);return O=>`\x1B[38;5;${w}m${O}\x1B[39m`}if(m>=4){const w=f.get(o);return O=>`\x1B[${w}m${O}\x1B[39m`}return w=>w}function n(o){return e.getColorDepth()>=4?`\x1B[1m${o}\x1B[22m`:o}return mt={getColor:i,bold:n},mt}var gt,Ir;function Or(){if(Ir)return gt;Ir=1;const e=go(),r=Pe(),{getColor:f,bold:c}=Rr(),s={error:0,warn:1,success:2,successv:2,info:2,help:2,verbose:4,debug:5,silly:6},i=E=>c(f("red")(`\u2620 ${E}`)),n=E=>f("orangered")(`\u26A0 ${E}`),o=f("amber"),m=E=>f("amber")(`\u27D0 ${E}`),w=f("gray"),O=f("dodgerblue"),N=E=>f("plum")(`\u2506 ${E}`),F=E=>f("plum")(`\u2506 ${E}`);let L=s.info,y="dotenvx",g=e.version;function A(E,V){const R=T(E,V);console.error(R)}function q(E,V){if(s[E]===void 0)throw new r({level:E}).missingLogLevel();if(s[E]<=L){const R=T(E,V);console.log(R)}}function T(E,V){const R=typeof V=="object"?JSON.stringify(V):V;switch(E.toLowerCase()){case"error":return i(R);case"warn":return n(R);case"success":return o(R);case"successv":return m(`${R} \xB7 ${y}@${g}`);case"info":return w(R);case"help":return O(R);case"verbose":return N(R);case"debug":return F(R)}}const C={level:"info",error:E=>A("error",E),warn:E=>q("warn",E),success:E=>q("success",E),successv:E=>q("successv",E),info:E=>q("info",E),help:E=>q("help",E),verbose:E=>q("verbose",E),debug:E=>q("debug",E),setLevel:E=>{s[E]!==void 0&&(L=s[E],C.level=E)},setName:E=>{y=E,C.name=E},setVersion:E=>{g=E,C.version=E}};function _(E){const V=E.debug?"debug":E.verbose?"verbose":E.quiet?"error":E.logLevel;V&&(C.setLevel(V),(!E.quiet||E.quiet&&V!=="error")&&C.debug(`setting log level to: ${V}`))}function h(E){const V=E.logName;V&&C.setName(V)}function B(E){const V=E.logVersion;V&&C.setVersion(V)}return gt={logger:C,getColor:f,setLogLevel:_,setLogName:h,setLogVersion:B,levels:s},gt}var bt={},Et={},_t,Kr;function it(){if(Kr)return _t;Kr=1;const e="\\\\/",r=`[^${e}]`,f=0,c="\\.",s="\\+",i="\\?",n="\\/",o="(?=.)",m="[^/]",w=`(?:${n}|$)`,O=`(?:^|${n})`,N=`${c}{1,2}${w}`,F=`(?!${c})`,L=`(?!${O}${N})`,y=`(?!${c}{0,1}${w})`,g=`(?!${N})`,A=`[^.${n}]`,q=`${m}*?`,C={DOT_LITERAL:c,PLUS_LITERAL:s,QMARK_LITERAL:i,SLASH_LITERAL:n,ONE_CHAR:o,QMARK:m,END_ANCHOR:w,DOTS_SLASH:N,NO_DOT:F,NO_DOTS:L,NO_DOT_SLASH:y,NO_DOTS_SLASH:g,QMARK_NO_DOT:A,STAR:q,START_ANCHOR:O,SEP:"/"},_={...C,SLASH_LITERAL:`[${e}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${c}{1,2}(?:[${e}]|$)`,NO_DOT:`(?!${c})`,NO_DOTS:`(?!(?:^|[${e}])${c}{1,2}(?:[${e}]|$))`,NO_DOT_SLASH:`(?!${c}{0,1}(?:[${e}]|$))`,NO_DOTS_SLASH:`(?!${c}{1,2}(?:[${e}]|$))`,QMARK_NO_DOT:`[^.${e}]`,START_ANCHOR:`(?:^|[${e}])`,END_ANCHOR:`(?:[${e}]|$)`,SEP:"\\"},h={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return _t={DEFAULT_MAX_EXTGLOB_RECURSION:f,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:h,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(B){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${B.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(B){return B===!0?_:C}},_t}var Cr;function ot(){return Cr||(Cr=1,(function(e){const{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:f,REGEX_SPECIAL_CHARS:c,REGEX_SPECIAL_CHARS_GLOBAL:s}=it();e.isObject=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),e.hasRegexChars=i=>c.test(i),e.isRegexChar=i=>i.length===1&&e.hasRegexChars(i),e.escapeRegex=i=>i.replace(s,"\\$1"),e.toPosixSlashes=i=>i.replace(r,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const i=navigator.platform.toLowerCase();return i==="win32"||i==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1},e.removeBackslashes=i=>i.replace(f,n=>n==="\\"?"":n),e.escapeLast=(i,n,o)=>{const m=i.lastIndexOf(n,o);return m===-1?i:i[m-1]==="\\"?e.escapeLast(i,n,m-1):`${i.slice(0,m)}\\${i.slice(m)}`},e.removePrefix=(i,n={})=>{let o=i;return o.startsWith("./")&&(o=o.slice(2),n.prefix="./"),o},e.wrapOutput=(i,n={},o={})=>{const m=o.contains?"":"^",w=o.contains?"":"$";let O=`${m}(?:${i})${w}`;return n.negated===!0&&(O=`(?:^(?!${O}).*$)`),O},e.basename=(i,{windows:n}={})=>{const o=i.split(n?/[\\/]/:"/"),m=o[o.length-1];return m===""?o[o.length-2]:m}})(Et)),Et}var wt,Hr;function _o(){if(Hr)return wt;Hr=1;const e=ot(),{CHAR_ASTERISK:r,CHAR_AT:f,CHAR_BACKWARD_SLASH:c,CHAR_COMMA:s,CHAR_DOT:i,CHAR_EXCLAMATION_MARK:n,CHAR_FORWARD_SLASH:o,CHAR_LEFT_CURLY_BRACE:m,CHAR_LEFT_PARENTHESES:w,CHAR_LEFT_SQUARE_BRACKET:O,CHAR_PLUS:N,CHAR_QUESTION_MARK:F,CHAR_RIGHT_CURLY_BRACE:L,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:g}=it(),A=C=>C===o||C===c,q=C=>{C.isPrefix!==!0&&(C.depth=C.isGlobstar?1/0:1)};return wt=(C,_)=>{const h=_||{},B=C.length-1,E=h.parts===!0||h.scanToEnd===!0,V=[],R=[],k=[];let U=C,Z=-1,G=0,$=0,a=!1,H=!1,l=!1,u=!1,p=!1,K=!1,t=!1,v=!1,S=!1,x=!1,D=0,J,W,d={value:"",depth:0,isGlob:!1};const M=()=>Z>=B,z=()=>U.charCodeAt(Z+1),ee=()=>(J=W,U.charCodeAt(++Z));for(;Z<B;){W=ee();let ue;if(W===c){t=d.backslashes=!0,W=ee(),W===m&&(K=!0);continue}if(K===!0||W===m){for(D++;M()!==!0&&(W=ee());){if(W===c){t=d.backslashes=!0,ee();continue}if(W===m){D++;continue}if(K!==!0&&W===i&&(W=ee())===i){if(a=d.isBrace=!0,l=d.isGlob=!0,x=!0,E===!0)continue;break}if(K!==!0&&W===s){if(a=d.isBrace=!0,l=d.isGlob=!0,x=!0,E===!0)continue;break}if(W===L&&(D--,D===0)){K=!1,a=d.isBrace=!0,x=!0;break}}if(E===!0)continue;break}if(W===o){if(V.push(Z),R.push(d),d={value:"",depth:0,isGlob:!1},x===!0)continue;if(J===i&&Z===G+1){G+=2;continue}$=Z+1;continue}if(h.noext!==!0&&(W===N||W===f||W===r||W===F||W===n)===!0&&z()===w){if(l=d.isGlob=!0,u=d.isExtglob=!0,x=!0,W===n&&Z===G&&(S=!0),E===!0){for(;M()!==!0&&(W=ee());){if(W===c){t=d.backslashes=!0,W=ee();continue}if(W===y){l=d.isGlob=!0,x=!0;break}}continue}break}if(W===r){if(J===r&&(p=d.isGlobstar=!0),l=d.isGlob=!0,x=!0,E===!0)continue;break}if(W===F){if(l=d.isGlob=!0,x=!0,E===!0)continue;break}if(W===O){for(;M()!==!0&&(ue=ee());){if(ue===c){t=d.backslashes=!0,ee();continue}if(ue===g){H=d.isBracket=!0,l=d.isGlob=!0,x=!0;break}}if(E===!0)continue;break}if(h.nonegate!==!0&&W===n&&Z===G){v=d.negated=!0,G++;continue}if(h.noparen!==!0&&W===w){if(l=d.isGlob=!0,E===!0){for(;M()!==!0&&(W=ee());){if(W===w){t=d.backslashes=!0,W=ee();continue}if(W===y){x=!0;break}}continue}break}if(l===!0){if(x=!0,E===!0)continue;break}}h.noext===!0&&(u=!1,l=!1);let P=U,b="",X="";G>0&&(b=U.slice(0,G),U=U.slice(G),$-=G),P&&l===!0&&$>0?(P=U.slice(0,$),X=U.slice($)):l===!0?(P="",X=U):P=U,P&&P!==""&&P!=="/"&&P!==U&&A(P.charCodeAt(P.length-1))&&(P=P.slice(0,-1)),h.unescape===!0&&(X&&(X=e.removeBackslashes(X)),P&&t===!0&&(P=e.removeBackslashes(P)));const se={prefix:b,input:C,start:G,base:P,glob:X,isBrace:a,isBracket:H,isGlob:l,isExtglob:u,isGlobstar:p,negated:v,negatedExtglob:S};if(h.tokens===!0&&(se.maxDepth=0,A(W)||R.push(d),se.tokens=R),h.parts===!0||h.tokens===!0){let ue;for(let he=0;he<V.length;he++){const pe=ue?ue+1:G,ge=V[he],ye=C.slice(pe,ge);h.tokens&&(he===0&&G!==0?(R[he].isPrefix=!0,R[he].value=b):R[he].value=ye,q(R[he]),se.maxDepth+=R[he].depth),(he!==0||ye!=="")&&k.push(ye),ue=ge}if(ue&&ue+1<C.length){const he=C.slice(ue+1);k.push(he),h.tokens&&(R[R.length-1].value=he,q(R[R.length-1]),se.maxDepth+=R[R.length-1].depth)}se.slashes=V,se.parts=k}return se},wt}var St,Pr;function wo(){if(Pr)return St;Pr=1;const e=it(),r=ot(),{MAX_LENGTH:f,POSIX_REGEX_SOURCE:c,REGEX_NON_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_BACKREF:i,REPLACEMENTS:n}=e,o=(T,C)=>{if(typeof C.expandRange=="function")return C.expandRange(...T,C);T.sort();const _=`[${T.join("-")}]`;try{new RegExp(_)}catch{return T.map(B=>r.escapeRegex(B)).join("..")}return _},m=(T,C)=>`Missing ${T}: "${C}" - use "\\\\${C}" to match literal characters`,w=T=>{const C=[];let _=0,h=0,B=0,E="",V=!1;for(const R of T){if(V===!0){E+=R,V=!1;continue}if(R==="\\"){E+=R,V=!0;continue}if(R==='"'){B=B===1?0:1,E+=R;continue}if(B===0){if(R==="[")_++;else if(R==="]"&&_>0)_--;else if(_===0){if(R==="(")h++;else if(R===")"&&h>0)h--;else if(R==="|"&&h===0){C.push(E),E="";continue}}}E+=R}return C.push(E),C},O=T=>{let C=!1;for(const _ of T){if(C===!0){C=!1;continue}if(_==="\\"){C=!0;continue}if(/[?*+@!()[\]{}]/.test(_))return!1}return!0},N=T=>{let C=T.trim(),_=!0;for(;_===!0;)_=!1,/^@\([^\\()[\]{}|]+\)$/.test(C)&&(C=C.slice(2,-1),_=!0);if(O(C))return C.replace(/\\(.)/g,"$1")},F=T=>{const C=T.map(N).filter(Boolean);for(let _=0;_<C.length;_++)for(let h=_+1;h<C.length;h++){const B=C[_],E=C[h],V=B[0];if(!(!V||B!==V.repeat(B.length)||E!==V.repeat(E.length))&&(B===E||B.startsWith(E)||E.startsWith(B)))return!0}return!1},L=(T,C=!0)=>{if(T[0]!=="+"&&T[0]!=="*"||T[1]!=="(")return;let _=0,h=0,B=0,E=!1;for(let V=1;V<T.length;V++){const R=T[V];if(E===!0){E=!1;continue}if(R==="\\"){E=!0;continue}if(R==='"'){B=B===1?0:1;continue}if(B!==1){if(R==="["){_++;continue}if(R==="]"&&_>0){_--;continue}if(!(_>0)){if(R==="("){h++;continue}if(R===")"&&(h--,h===0))return C===!0&&V!==T.length-1?void 0:{type:T[0],body:T.slice(2,V),end:V}}}}},y=T=>{let C=0;const _=[];for(;C<T.length;){const B=L(T.slice(C),!1);if(!B||B.type!=="*")return;const E=w(B.body).map(R=>R.trim());if(E.length!==1)return;const V=N(E[0]);if(!V||V.length!==1)return;_.push(V),C+=B.end+1}return _.length<1?void 0:`${_.length===1?r.escapeRegex(_[0]):`[${_.map(B=>r.escapeRegex(B)).join("")}]`}*`},g=T=>{let C=0,_=T.trim(),h=L(_);for(;h;)C++,_=h.body.trim(),h=L(_);return C},A=(T,C)=>{if(C.maxExtglobRecursion===!1)return{risky:!1};const _=typeof C.maxExtglobRecursion=="number"?C.maxExtglobRecursion:e.DEFAULT_MAX_EXTGLOB_RECURSION,h=w(T).map(B=>B.trim());if(h.length>1&&(h.some(B=>B==="")||h.some(B=>/^[*?]+$/.test(B))||F(h)))return{risky:!0};for(const B of h){const E=y(B);if(E)return{risky:!0,safeOutput:E};if(g(B)>_)return{risky:!0}}return{risky:!1}},q=(T,C)=>{if(typeof T!="string")throw new TypeError("Expected a string");T=n[T]||T;const _={...C},h=typeof _.maxLength=="number"?Math.min(f,_.maxLength):f;let B=T.length;if(B>h)throw new SyntaxError(`Input length: ${B}, exceeds maximum allowed length: ${h}`);const E={type:"bos",value:"",output:_.prepend||""},V=[E],R=_.capture?"":"?:",k=e.globChars(_.windows),U=e.extglobChars(k),{DOT_LITERAL:Z,PLUS_LITERAL:G,SLASH_LITERAL:$,ONE_CHAR:a,DOTS_SLASH:H,NO_DOT:l,NO_DOT_SLASH:u,NO_DOTS_SLASH:p,QMARK:K,QMARK_NO_DOT:t,STAR:v,START_ANCHOR:S}=k,x=j=>`(${R}(?:(?!${S}${j.dot?H:Z}).)*?)`,D=_.dot?"":l,J=_.dot?K:t;let W=_.bash===!0?x(_):v;_.capture&&(W=`(${W})`),typeof _.noext=="boolean"&&(_.noextglob=_.noext);const d={input:T,index:-1,start:0,dot:_.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};T=r.removePrefix(T,d),B=T.length;const M=[],z=[],ee=[];let P=E,b;const X=()=>d.index===B-1,se=d.peek=(j=1)=>T[d.index+j],ue=d.advance=()=>T[++d.index]||"",he=()=>T.slice(d.index+1),pe=(j="",ie=0)=>{d.consumed+=j,d.index+=ie},ge=j=>{d.output+=j.output!=null?j.output:j.value,pe(j.value)},ye=()=>{let j=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)ue(),d.start++,j++;return j%2===0?!1:(d.negated=!0,d.start++,!0)},Se=j=>{d[j]++,ee.push(j)},_e=j=>{d[j]--,ee.pop()},ae=j=>{if(P.type==="globstar"){const ie=d.braces>0&&(j.type==="comma"||j.type==="brace"),Q=j.extglob===!0||M.length&&(j.type==="pipe"||j.type==="paren");j.type!=="slash"&&j.type!=="paren"&&!ie&&!Q&&(d.output=d.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=W,d.output+=P.output)}if(M.length&&j.type!=="paren"&&(M[M.length-1].inner+=j.value),(j.value||j.output)&&ge(j),P&&P.type==="text"&&j.type==="text"){P.output=(P.output||P.value)+j.value,P.value+=j.value;return}j.prev=P,V.push(j),P=j},ne=(j,ie)=>{const Q={...U[ie],conditions:1,inner:""};Q.prev=P,Q.parens=d.parens,Q.output=d.output,Q.startIndex=d.index,Q.tokensIndex=V.length;const ce=(_.capture?"(":"")+Q.open;Se("parens"),ae({type:j,value:ie,output:d.output?"":a}),ae({type:"paren",extglob:!0,value:ue(),output:ce}),M.push(Q)},te=j=>{const ie=T.slice(j.startIndex,d.index+1),Q=T.slice(j.startIndex+2,d.index),ce=A(Q,_);if((j.type==="plus"||j.type==="star")&&ce.risky){const I=ce.safeOutput?(j.output?"":a)+(_.capture?`(${ce.safeOutput})`:ce.safeOutput):void 0,Y=V[j.tokensIndex];Y.type="text",Y.value=ie,Y.output=I||r.escapeRegex(ie);for(let re=j.tokensIndex+1;re<V.length;re++)V[re].value="",V[re].output="",delete V[re].suffix;d.output=j.output+Y.output,d.backtrack=!0,ae({type:"paren",extglob:!0,value:b,output:""}),_e("parens");return}let le=j.close+(_.capture?")":""),de;if(j.type==="negate"){let I=W;if(j.inner&&j.inner.length>1&&j.inner.includes("/")&&(I=x(_)),(I!==W||X()||/^\)+$/.test(he()))&&(le=j.close=`)$))${I}`),j.inner.includes("*")&&(de=he())&&/^\.[^\\/.]+$/.test(de)){const Y=q(de,{...C,fastpaths:!1}).output;le=j.close=`)${Y})${I})`}j.prev.type==="bos"&&(d.negatedExtglob=!0)}ae({type:"paren",extglob:!0,value:b,output:le}),_e("parens")};if(_.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(T)){let j=!1,ie=T.replace(i,(Q,ce,le,de,I,Y)=>de==="\\"?(j=!0,Q):de==="?"?ce?ce+de+(I?K.repeat(I.length):""):Y===0?J+(I?K.repeat(I.length):""):K.repeat(le.length):de==="."?Z.repeat(le.length):de==="*"?ce?ce+de+(I?W:""):W:ce?Q:`\\${Q}`);return j===!0&&(_.unescape===!0?ie=ie.replace(/\\/g,""):ie=ie.replace(/\\+/g,Q=>Q.length%2===0?"\\\\":Q?"\\":"")),ie===T&&_.contains===!0?(d.output=T,d):(d.output=r.wrapOutput(ie,d,C),d)}for(;!X();){if(b=ue(),b==="\0")continue;if(b==="\\"){const Q=se();if(Q==="/"&&_.bash!==!0||Q==="."||Q===";")continue;if(!Q){b+="\\",ae({type:"text",value:b});continue}const ce=/^\\+/.exec(he());let le=0;if(ce&&ce[0].length>2&&(le=ce[0].length,d.index+=le,le%2!==0&&(b+="\\")),_.unescape===!0?b=ue():b+=ue(),d.brackets===0){ae({type:"text",value:b});continue}}if(d.brackets>0&&(b!=="]"||P.value==="["||P.value==="[^")){if(_.posix!==!1&&b===":"){const Q=P.value.slice(1);if(Q.includes("[")&&(P.posix=!0,Q.includes(":"))){const ce=P.value.lastIndexOf("["),le=P.value.slice(0,ce),de=P.value.slice(ce+2),I=c[de];if(I){P.value=le+I,d.backtrack=!0,ue(),!E.output&&V.indexOf(P)===1&&(E.output=a);continue}}}(b==="["&&se()!==":"||b==="-"&&se()==="]")&&(b=`\\${b}`),b==="]"&&(P.value==="["||P.value==="[^")&&(b=`\\${b}`),_.posix===!0&&b==="!"&&P.value==="["&&(b="^"),P.value+=b,ge({value:b});continue}if(d.quotes===1&&b!=='"'){b=r.escapeRegex(b),P.value+=b,ge({value:b});continue}if(b==='"'){d.quotes=d.quotes===1?0:1,_.keepQuotes===!0&&ae({type:"text",value:b});continue}if(b==="("){Se("parens"),ae({type:"paren",value:b});continue}if(b===")"){if(d.parens===0&&_.strictBrackets===!0)throw new SyntaxError(m("opening","("));const Q=M[M.length-1];if(Q&&d.parens===Q.parens+1){te(M.pop());continue}ae({type:"paren",value:b,output:d.parens?")":"\\)"}),_e("parens");continue}if(b==="["){if(_.nobracket===!0||!he().includes("]")){if(_.nobracket!==!0&&_.strictBrackets===!0)throw new SyntaxError(m("closing","]"));b=`\\${b}`}else Se("brackets");ae({type:"bracket",value:b});continue}if(b==="]"){if(_.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){ae({type:"text",value:b,output:`\\${b}`});continue}if(d.brackets===0){if(_.strictBrackets===!0)throw new SyntaxError(m("opening","["));ae({type:"text",value:b,output:`\\${b}`});continue}_e("brackets");const Q=P.value.slice(1);if(P.posix!==!0&&Q[0]==="^"&&!Q.includes("/")&&(b=`/${b}`),P.value+=b,ge({value:b}),_.literalBrackets===!1||r.hasRegexChars(Q))continue;const ce=r.escapeRegex(P.value);if(d.output=d.output.slice(0,-P.value.length),_.literalBrackets===!0){d.output+=ce,P.value=ce;continue}P.value=`(${R}${ce}|${P.value})`,d.output+=P.value;continue}if(b==="{"&&_.nobrace!==!0){Se("braces");const Q={type:"brace",value:b,output:"(",outputIndex:d.output.length,tokensIndex:d.tokens.length};z.push(Q),ae(Q);continue}if(b==="}"){const Q=z[z.length-1];if(_.nobrace===!0||!Q){ae({type:"text",value:b,output:b});continue}let ce=")";if(Q.dots===!0){const le=V.slice(),de=[];for(let I=le.length-1;I>=0&&(V.pop(),le[I].type!=="brace");I--)le[I].type!=="dots"&&de.unshift(le[I].value);ce=o(de,_),d.backtrack=!0}if(Q.comma!==!0&&Q.dots!==!0){const le=d.output.slice(0,Q.outputIndex),de=d.tokens.slice(Q.tokensIndex);Q.value=Q.output="\\{",b=ce="\\}",d.output=le;for(const I of de)d.output+=I.output||I.value}ae({type:"brace",value:b,output:ce}),_e("braces"),z.pop();continue}if(b==="|"){M.length>0&&M[M.length-1].conditions++,ae({type:"text",value:b});continue}if(b===","){let Q=b;const ce=z[z.length-1];ce&&ee[ee.length-1]==="braces"&&(ce.comma=!0,Q="|"),ae({type:"comma",value:b,output:Q});continue}if(b==="/"){if(P.type==="dot"&&d.index===d.start+1){d.start=d.index+1,d.consumed="",d.output="",V.pop(),P=E;continue}ae({type:"slash",value:b,output:$});continue}if(b==="."){if(d.braces>0&&P.type==="dot"){P.value==="."&&(P.output=Z);const Q=z[z.length-1];P.type="dots",P.output+=b,P.value+=b,Q.dots=!0;continue}if(d.braces+d.parens===0&&P.type!=="bos"&&P.type!=="slash"){ae({type:"text",value:b,output:Z});continue}ae({type:"dot",value:b,output:Z});continue}if(b==="?"){if(!(P&&P.value==="(")&&_.noextglob!==!0&&se()==="("&&se(2)!=="?"){ne("qmark",b);continue}if(P&&P.type==="paren"){const ce=se();let le=b;(P.value==="("&&!/[!=<:]/.test(ce)||ce==="<"&&!/<([!=]|\w+>)/.test(he()))&&(le=`\\${b}`),ae({type:"text",value:b,output:le});continue}if(_.dot!==!0&&(P.type==="slash"||P.type==="bos")){ae({type:"qmark",value:b,output:t});continue}ae({type:"qmark",value:b,output:K});continue}if(b==="!"){if(_.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){ne("negate",b);continue}if(_.nonegate!==!0&&d.index===0){ye();continue}}if(b==="+"){if(_.noextglob!==!0&&se()==="("&&se(2)!=="?"){ne("plus",b);continue}if(P&&P.value==="("||_.regex===!1){ae({type:"plus",value:b,output:G});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||d.parens>0){ae({type:"plus",value:b});continue}ae({type:"plus",value:G});continue}if(b==="@"){if(_.noextglob!==!0&&se()==="("&&se(2)!=="?"){ae({type:"at",extglob:!0,value:b,output:""});continue}ae({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);const Q=s.exec(he());Q&&(b+=Q[0],d.index+=Q[0].length),ae({type:"text",value:b});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=b,P.output=W,d.backtrack=!0,d.globstar=!0,pe(b);continue}let j=he();if(_.noextglob!==!0&&/^\([^?]/.test(j)){ne("star",b);continue}if(P.type==="star"){if(_.noglobstar===!0){pe(b);continue}const Q=P.prev,ce=Q.prev,le=Q.type==="slash"||Q.type==="bos",de=ce&&(ce.type==="star"||ce.type==="globstar");if(_.bash===!0&&(!le||j[0]&&j[0]!=="/")){ae({type:"star",value:b,output:""});continue}const I=d.braces>0&&(Q.type==="comma"||Q.type==="brace"),Y=M.length&&(Q.type==="pipe"||Q.type==="paren");if(!le&&Q.type!=="paren"&&!I&&!Y){ae({type:"star",value:b,output:""});continue}for(;j.slice(0,3)==="/**";){const re=T[d.index+4];if(re&&re!=="/")break;j=j.slice(3),pe("/**",3)}if(Q.type==="bos"&&X()){P.type="globstar",P.value+=b,P.output=x(_),d.output=P.output,d.globstar=!0,pe(b);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&!de&&X()){d.output=d.output.slice(0,-(Q.output+P.output).length),Q.output=`(?:${Q.output}`,P.type="globstar",P.output=x(_)+(_.strictSlashes?")":"|$)"),P.value+=b,d.globstar=!0,d.output+=Q.output+P.output,pe(b);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&j[0]==="/"){const re=j[1]!==void 0?"|$":"";d.output=d.output.slice(0,-(Q.output+P.output).length),Q.output=`(?:${Q.output}`,P.type="globstar",P.output=`${x(_)}${$}|${$}${re})`,P.value+=b,d.output+=Q.output+P.output,d.globstar=!0,pe(b+ue()),ae({type:"slash",value:"/",output:""});continue}if(Q.type==="bos"&&j[0]==="/"){P.type="globstar",P.value+=b,P.output=`(?:^|${$}|${x(_)}${$})`,d.output=P.output,d.globstar=!0,pe(b+ue()),ae({type:"slash",value:"/",output:""});continue}d.output=d.output.slice(0,-P.output.length),P.type="globstar",P.output=x(_),P.value+=b,d.output+=P.output,d.globstar=!0,pe(b);continue}const ie={type:"star",value:b,output:W};if(_.bash===!0){ie.output=".*?",(P.type==="bos"||P.type==="slash")&&(ie.output=D+ie.output),ae(ie);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&_.regex===!0){ie.output=b,ae(ie);continue}(d.index===d.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(d.output+=u,P.output+=u):_.dot===!0?(d.output+=p,P.output+=p):(d.output+=D,P.output+=D),se()!=="*"&&(d.output+=a,P.output+=a)),ae(ie)}for(;d.brackets>0;){if(_.strictBrackets===!0)throw new SyntaxError(m("closing","]"));d.output=r.escapeLast(d.output,"["),_e("brackets")}for(;d.parens>0;){if(_.strictBrackets===!0)throw new SyntaxError(m("closing",")"));d.output=r.escapeLast(d.output,"("),_e("parens")}for(;d.braces>0;){if(_.strictBrackets===!0)throw new SyntaxError(m("closing","}"));d.output=r.escapeLast(d.output,"{"),_e("braces")}if(_.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&ae({type:"maybe_slash",value:"",output:`${$}?`}),d.backtrack===!0){d.output="";for(const j of d.tokens)d.output+=j.output!=null?j.output:j.value,j.suffix&&(d.output+=j.suffix)}return d};return q.fastpaths=(T,C)=>{const _={...C},h=typeof _.maxLength=="number"?Math.min(f,_.maxLength):f,B=T.length;if(B>h)throw new SyntaxError(`Input length: ${B}, exceeds maximum allowed length: ${h}`);T=n[T]||T;const{DOT_LITERAL:E,SLASH_LITERAL:V,ONE_CHAR:R,DOTS_SLASH:k,NO_DOT:U,NO_DOTS:Z,NO_DOTS_SLASH:G,STAR:$,START_ANCHOR:a}=e.globChars(_.windows),H=_.dot?Z:U,l=_.dot?G:U,u=_.capture?"":"?:",p={negated:!1,prefix:""};let K=_.bash===!0?".*?":$;_.capture&&(K=`(${K})`);const t=D=>D.noglobstar===!0?K:`(${u}(?:(?!${a}${D.dot?k:E}).)*?)`,v=D=>{switch(D){case"*":return`${H}${R}${K}`;case".*":return`${E}${R}${K}`;case"*.*":return`${H}${K}${E}${R}${K}`;case"*/*":return`${H}${K}${V}${R}${l}${K}`;case"**":return H+t(_);case"**/*":return`(?:${H}${t(_)}${V})?${l}${R}${K}`;case"**/*.*":return`(?:${H}${t(_)}${V})?${l}${K}${E}${R}${K}`;case"**/.*":return`(?:${H}${t(_)}${V})?${E}${R}${K}`;default:{const J=/^(.*?)\.(\w+)$/.exec(D);if(!J)return;const W=v(J[1]);return W?W+E+J[2]:void 0}}},S=r.removePrefix(T,p);let x=v(S);return x&&_.strictSlashes!==!0&&(x+=`${V}?`),x},St=q,St}var xt,Tr;function So(){if(Tr)return xt;Tr=1;const e=_o(),r=wo(),f=ot(),c=it(),s=n=>n&&typeof n=="object"&&!Array.isArray(n),i=(n,o,m=!1)=>{if(Array.isArray(n)){const A=n.map(T=>i(T,o,m));return T=>{for(const C of A){const _=C(T);if(_)return _}return!1}}const w=s(n)&&n.tokens&&n.input;if(n===""||typeof n!="string"&&!w)throw new TypeError("Expected pattern to be a non-empty string");const O=o||{},N=O.windows,F=w?i.compileRe(n,o):i.makeRe(n,o,!1,!0),L=F.state;delete F.state;let y=()=>!1;if(O.ignore){const A={...o,ignore:null,onMatch:null,onResult:null};y=i(O.ignore,A,m)}const g=(A,q=!1)=>{const{isMatch:T,match:C,output:_}=i.test(A,F,o,{glob:n,posix:N}),h={glob:n,state:L,regex:F,posix:N,input:A,output:_,match:C,isMatch:T};return typeof O.onResult=="function"&&O.onResult(h),T===!1?(h.isMatch=!1,q?h:!1):y(A)?(typeof O.onIgnore=="function"&&O.onIgnore(h),h.isMatch=!1,q?h:!1):(typeof O.onMatch=="function"&&O.onMatch(h),q?h:!0)};return m&&(g.state=L),g};return i.test=(n,o,m,{glob:w,posix:O}={})=>{if(typeof n!="string")throw new TypeError("Expected input to be a string");if(n==="")return{isMatch:!1,output:""};const N=m||{},F=N.format||(O?f.toPosixSlashes:null);let L=n===w,y=L&&F?F(n):n;return L===!1&&(y=F?F(n):n,L=y===w),(L===!1||N.capture===!0)&&(N.matchBase===!0||N.basename===!0?L=i.matchBase(n,o,m,O):L=o.exec(y)),{isMatch:!!L,match:L,output:y}},i.matchBase=(n,o,m)=>(o instanceof RegExp?o:i.makeRe(o,m)).test(f.basename(n)),i.isMatch=(n,o,m)=>i(o,m)(n),i.parse=(n,o)=>Array.isArray(n)?n.map(m=>i.parse(m,o)):r(n,{...o,fastpaths:!1}),i.scan=(n,o)=>e(n,o),i.compileRe=(n,o,m=!1,w=!1)=>{if(m===!0)return n.output;const O=o||{},N=O.contains?"":"^",F=O.contains?"":"$";let L=`${N}(?:${n.output})${F}`;n&&n.negated===!0&&(L=`^(?!${L}).*$`);const y=i.toRegex(L,o);return w===!0&&(y.state=n),y},i.makeRe=(n,o={},m=!1,w=!1)=>{if(!n||typeof n!="string")throw new TypeError("Expected a non-empty string");let O={negated:!1,fastpaths:!0};return o.fastpaths!==!1&&(n[0]==="."||n[0]==="*")&&(O.output=r.fastpaths(n,o)),O.output||(O=r(n,o)),i.compileRe(O,o,m,w)},i.toRegex=(n,o)=>{try{const m=o||{};return new RegExp(n,m.flags||(m.nocase?"i":""))}catch(m){if(o&&o.debug===!0)throw m;return/$^/}},i.constants=c,xt=i,xt}var At,Nr;function Lr(){if(Nr)return At;Nr=1;const e=So(),r=ot();function f(c,s,i=!1){return s&&(s.windows===null||s.windows===void 0)&&(s={...s,windows:r.isWindows()}),e(c,s,i)}return Object.assign(f,e),At=f,At}var qr;function xo(){if(qr)return bt;qr=1;var e=Object.create,r=Object.defineProperty,f=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,s=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,n=(I,Y,re,oe)=>{if(Y&&typeof Y=="object"||typeof Y=="function")for(var fe=c(Y),ve=0,be=fe.length,Ee;ve<be;ve++)Ee=fe[ve],!i.call(I,Ee)&&Ee!==re&&r(I,Ee,{get:(we=>Y[we]).bind(null,Ee),enumerable:!(oe=f(Y,Ee))||oe.enumerable});return I},o=(I,Y,re)=>(re=I!=null?e(s(I)):{},n(!I||!I.__esModule?r(re,"default",{value:I,enumerable:!0}):re,I));const m=o(Re),w=o(Fe);function O(I){let Y=(0,m.normalize)(I);return Y.length>1&&Y[Y.length-1]===m.sep&&(Y=Y.substring(0,Y.length-1)),Y}const N=/[\\/]/g;function F(I,Y){return I.replace(N,Y)}const L=/^[a-z]:[\\/]$/i;function y(I){return I==="/"||L.test(I)}function g(I,Y){const{resolvePaths:re,normalizePath:oe,pathSeparator:fe}=Y,ve=process.platform==="win32"&&I.includes("/")||I.startsWith(".");if(re&&(I=(0,m.resolve)(I)),(oe||ve)&&(I=O(I)),I===".")return"";const be=I[I.length-1]!==fe;return F(be?I+fe:I,fe)}function A(I,Y){return Y+I}function q(I,Y){return function(re,oe){return oe.startsWith(I)?oe.slice(I.length)+re:F((0,m.relative)(I,oe),Y.pathSeparator)+Y.pathSeparator+re}}function T(I){return I}function C(I,Y,re){return Y+I+re}function _(I,Y){const{relativePaths:re,includeBasePath:oe}=Y;return re&&I?q(I,Y):oe?A:T}function h(I){return function(Y,re){re.push(Y.substring(I.length)||".")}}function B(I){return function(Y,re,oe){const fe=Y.substring(I.length)||".";oe.every(ve=>ve(fe,!0))&&re.push(fe)}}const E=(I,Y)=>{Y.push(I||".")},V=(I,Y,re)=>{const oe=I||".";re.every(fe=>fe(oe,!0))&&Y.push(oe)},R=()=>{};function k(I,Y){const{includeDirs:re,filters:oe,relativePaths:fe}=Y;return re?fe?oe&&oe.length?B(I):h(I):oe&&oe.length?V:E:R}const U=(I,Y,re,oe)=>{oe.every(fe=>fe(I,!1))&&re.files++},Z=(I,Y,re,oe)=>{oe.every(fe=>fe(I,!1))&&Y.push(I)},G=(I,Y,re,oe)=>{re.files++},$=(I,Y)=>{Y.push(I)},a=()=>{};function H(I){const{excludeFiles:Y,filters:re,onlyCounts:oe}=I;return Y?a:re&&re.length?oe?U:Z:oe?G:$}const l=I=>I,u=()=>[""].slice(0,0);function p(I){return I.group?u:l}const K=(I,Y,re)=>{I.push({directory:Y,files:re,dir:Y})},t=()=>{};function v(I){return I.group?K:t}const S=function(I,Y,re){const{queue:oe,fs:fe,options:{suppressErrors:ve}}=Y;oe.enqueue(),fe.realpath(I,(be,Ee)=>{if(be)return oe.dequeue(ve?null:be,Y);fe.stat(Ee,(we,Be)=>{if(we)return oe.dequeue(ve?null:we,Y);if(Be.isDirectory()&&J(I,Ee,Y))return oe.dequeue(null,Y);re(Be,Ee),oe.dequeue(null,Y)})})},x=function(I,Y,re){const{queue:oe,fs:fe,options:{suppressErrors:ve}}=Y;oe.enqueue();try{const be=fe.realpathSync(I),Ee=fe.statSync(be);if(Ee.isDirectory()&&J(I,be,Y))return;re(Ee,be)}catch(be){if(!ve)throw be}};function D(I,Y){return!I.resolveSymlinks||I.excludeSymlinks?null:Y?x:S}function J(I,Y,re){if(re.options.useRealPaths)return W(Y,re);let oe=(0,m.dirname)(I),fe=1;for(;oe!==re.root&&fe<2;){const ve=re.symlinks.get(oe);!!ve&&(ve===Y||ve.startsWith(Y)||Y.startsWith(ve))?fe++:oe=(0,m.dirname)(oe)}return re.symlinks.set(I,Y),fe>1}function W(I,Y){return Y.visited.includes(I+Y.options.pathSeparator)}const d=I=>I.counts,M=I=>I.groups,z=I=>I.paths,ee=I=>I.paths.slice(0,I.options.maxFiles),P=(I,Y,re)=>(ue(Y,re,I.counts,I.options.suppressErrors),null),b=(I,Y,re)=>(ue(Y,re,I.paths,I.options.suppressErrors),null),X=(I,Y,re)=>(ue(Y,re,I.paths.slice(0,I.options.maxFiles),I.options.suppressErrors),null),se=(I,Y,re)=>(ue(Y,re,I.groups,I.options.suppressErrors),null);function ue(I,Y,re,oe){Y(I&&!oe?I:null,re)}function he(I,Y){const{onlyCounts:re,group:oe,maxFiles:fe}=I;return re?Y?d:P:oe?Y?M:se:fe?Y?ee:X:Y?z:b}const pe={withFileTypes:!0},ge=(I,Y,re,oe,fe)=>{if(I.queue.enqueue(),oe<0)return I.queue.dequeue(null,I);const{fs:ve}=I;I.visited.push(Y),I.counts.directories++,ve.readdir(Y||".",pe,(be,Ee=[])=>{fe(Ee,re,oe),I.queue.dequeue(I.options.suppressErrors?null:be,I)})},ye=(I,Y,re,oe,fe)=>{const{fs:ve}=I;if(oe<0)return;I.visited.push(Y),I.counts.directories++;let be=[];try{be=ve.readdirSync(Y||".",pe)}catch(Ee){if(!I.options.suppressErrors)throw Ee}fe(be,re,oe)};function Se(I){return I?ye:ge}var _e=class{count=0;constructor(I){this.onQueueEmpty=I}enqueue(){return this.count++,this.count}dequeue(I,Y){this.onQueueEmpty&&(--this.count<=0||I)&&(this.onQueueEmpty(I,Y),I&&(Y.controller.abort(),this.onQueueEmpty=void 0))}},ae=class{_files=0;_directories=0;set files(I){this._files=I}get files(){return this._files}set directories(I){this._directories=I}get directories(){return this._directories}get dirs(){return this._directories}},ne=class{aborted=!1;abort(){this.aborted=!0}},te=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(I,Y,re){this.isSynchronous=!re,this.callbackInvoker=he(Y,this.isSynchronous),this.root=g(I,Y),this.state={root:y(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new ae,options:Y,queue:new _e((oe,fe)=>this.callbackInvoker(fe,oe,re)),symlinks:new Map,visited:[""].slice(0,0),controller:new ne,fs:Y.fs||w},this.joinPath=_(this.root,Y),this.pushDirectory=k(this.root,Y),this.pushFile=H(Y),this.getArray=p(Y),this.groupFiles=v(Y),this.resolveSymlink=D(Y,this.isSynchronous),this.walkDirectory=Se(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(I,Y,re)=>{const{paths:oe,options:{filters:fe,resolveSymlinks:ve,excludeSymlinks:be,exclude:Ee,maxFiles:we,signal:Be,useRealPaths:De,pathSeparator:Xe},controller:st}=this.state;if(st.aborted||Be&&Be.aborted||we&&oe.length>we)return;const ft=this.getArray(this.state.paths);for(let dt=0;dt<I.length;++dt){const Ne=I[dt];if(Ne.isFile()||Ne.isSymbolicLink()&&!ve&&!be){const Ce=this.joinPath(Ne.name,Y);this.pushFile(Ce,ft,this.state.counts,fe)}else if(Ne.isDirectory()){let Ce=C(Ne.name,Y,this.state.options.pathSeparator);if(Ee&&Ee(Ne.name,Ce))continue;this.pushDirectory(Ce,oe,fe),this.walkDirectory(this.state,Ce,Ce,re-1,this.walk)}else if(this.resolveSymlink&&Ne.isSymbolicLink()){let Ce=A(Ne.name,Y);this.resolveSymlink(Ce,this.state,(Qi,He)=>{if(Qi.isDirectory()){if(He=g(He,this.state.options),Ee&&Ee(Ne.name,De?He:Ce+Xe))return;this.walkDirectory(this.state,He,De?He:Ce+Xe,re-1,this.walk)}else{He=De?He:Ce;const Ji=(0,m.basename)(He),eo=g((0,m.dirname)(He),this.state.options);He=this.joinPath(Ji,eo),this.pushFile(He,ft,this.state.counts,fe)}})}}this.groupFiles(this.state.groups,Y,ft)}};function j(I,Y){return new Promise((re,oe)=>{ie(I,Y,(fe,ve)=>{if(fe)return oe(fe);re(ve)})})}function ie(I,Y,re){new te(I,Y,re).start()}function Q(I,Y){return new te(I,Y).start()}var ce=class{constructor(I,Y){this.root=I,this.options=Y}withPromise(){return j(this.root,this.options)}withCallback(I){ie(this.root,this.options,I)}sync(){return Q(this.root,this.options)}};let le=null;try{require.resolve("picomatch"),le=Lr()}catch{}var de=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:m.sep,filters:[]};globFunction;constructor(I){this.options={...this.options,...I},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(I){return this.options.pathSeparator=I,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(I){return this.options.maxDepth=I,this}withMaxFiles(I){return this.options.maxFiles=I,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:I=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=I,this.withFullPaths()}withAbortSignal(I){return this.options.signal=I,this}normalize(){return this.options.normalizePath=!0,this}filter(I){return this.options.filters.push(I),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(I){return this.options.exclude=I,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(I){return new ce(I||".",this.options)}withGlobFunction(I){return this.globFunction=I,this}crawlWithOptions(I,Y){return this.options={...this.options,...Y},new ce(I||".",this.options)}glob(...I){return this.globFunction?this.globWithOptions(I):this.globWithOptions(I,{dot:!0})}globWithOptions(I,...Y){const re=this.globFunction||le;if(!re)throw new Error("Please specify a glob function to use glob matching.");var oe=this.globCache[I.join("\0")];return oe||(oe=re(I,...Y),this.globCache[I.join("\0")]=oe),this.options.filters.push(fe=>oe(fe)),this}};return bt.fdir=de,bt}var Bt,Dr;function Ao(){if(Dr)return Bt;Dr=1;const{fdir:e}=xo(),r=Re,f=Lr();class c{constructor(i="./",n=[".env*"],o=[]){this.ignore=["node_modules/**",".git/**"],this.cwd=r.resolve(i),this.envFile=n,this.excludeEnvFile=o}run(){return this._filepaths()}_filepaths(){const i=f(this._exclude()),n=f(this._patterns(),{ignore:this._exclude()});return new e().withRelativePaths().exclude((o,m)=>i(m)).filter(o=>n(o)).crawl(this.cwd).sync()}_patterns(){return Array.isArray(this.envFile)?this.envFile.map(i=>`**/${i}`):[`**/${this.envFile}`]}_excludePatterns(){return Array.isArray(this.excludeEnvFile)?this.excludeEnvFile.map(i=>`**/${i}`):[`**/${this.excludeEnvFile}`]}_exclude(){return this._excludePatterns().length>0?this.ignore.concat(this._excludePatterns()):this.ignore}}return Bt=c,Bt}var Rt,Fr;function Te(){if(Fr)return Rt;Fr=1;const e=Fe,r="utf8";async function f(m,w=null){return w||(w=r),e.promises.readFile(m,w)}function c(m,w=null){return w||(w=r),e.readFileSync(m,w)}function s(m,w){return e.writeFileSync(m,w,r)}async function i(m,w){return e.promises.writeFile(m,w,r)}async function n(m){try{return await e.promises.access(m),!0}catch{return!1}}return Rt={chmodSync:e.chmodSync,exists:n,existsSync:e.existsSync,readdirSync:e.readdirSync,readFileSync:e.readFileSync,writeFileSync:e.writeFileSync,appendFileSync:e.appendFileSync,readFileX:f,readFileXSync:c,writeFileX:i,writeFileXSync:s},Rt}var It={},Ot={},kr;function Le(){return kr||(kr=1,(function(e){/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=void 0,e.isBytes=r,e.abool=f,e.anumber=c,e.abytes=s,e.ahash=i,e.aexists=n,e.aoutput=o,e.u8=m,e.u32=w,e.clean=O,e.createView=N,e.bytesToHex=y,e.hexToBytes=q,e.hexToNumber=T,e.bytesToNumberBE=C,e.numberToBytesBE=_,e.utf8ToBytes=B,e.bytesToUtf8=E,e.toBytes=V,e.overlapBytes=R,e.complexOverlapBytes=k,e.concatBytes=U,e.checkOpts=Z,e.equalBytes=G,e.getOutput=H,e.setBigUint64=l,e.u64Lengths=u,e.isAligned32=p,e.copyBytes=K;function r(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function f(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function c(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function s(t,...v){if(!r(t))throw new Error("Uint8Array expected");if(v.length>0&&!v.includes(t.length))throw new Error("Uint8Array expected of length "+v+", got length="+t.length)}function i(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");c(t.outputLen),c(t.blockLen)}function n(t,v=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(v&&t.finished)throw new Error("Hash#digest() has already been called")}function o(t,v){s(t);const S=v.outputLen;if(t.length<S)throw new Error("digestInto() expects output buffer of length at least "+S)}function m(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function w(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function O(...t){for(let v=0;v<t.length;v++)t[v].fill(0)}function N(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const F=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",L=Array.from({length:256},(t,v)=>v.toString(16).padStart(2,"0"));function y(t){if(s(t),F)return t.toHex();let v="";for(let S=0;S<t.length;S++)v+=L[t[S]];return v}const g={_0:48,_9:57,A:65,F:70,a:97,f:102};function A(t){if(t>=g._0&&t<=g._9)return t-g._0;if(t>=g.A&&t<=g.F)return t-(g.A-10);if(t>=g.a&&t<=g.f)return t-(g.a-10)}function q(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(F)return Uint8Array.fromHex(t);const v=t.length,S=v/2;if(v%2)throw new Error("hex string expected, got unpadded hex of length "+v);const x=new Uint8Array(S);for(let D=0,J=0;D<S;D++,J+=2){const W=A(t.charCodeAt(J)),d=A(t.charCodeAt(J+1));if(W===void 0||d===void 0){const M=t[J]+t[J+1];throw new Error('hex string expected, got non-hex character "'+M+'" at index '+J)}x[D]=W*16+d}return x}function T(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":"0x"+t)}function C(t){return T(y(t))}function _(t,v){return q(t.toString(16).padStart(v*2,"0"))}const h=async()=>{};e.nextTick=h;function B(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function E(t){return new TextDecoder().decode(t)}function V(t){if(typeof t=="string")t=B(t);else if(r(t))t=K(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function R(t,v){return t.buffer===v.buffer&&t.byteOffset<v.byteOffset+v.byteLength&&v.byteOffset<t.byteOffset+t.byteLength}function k(t,v){if(R(t,v)&&t.byteOffset<v.byteOffset)throw new Error("complex overlap of input and output is not supported")}function U(...t){let v=0;for(let x=0;x<t.length;x++){const D=t[x];s(D),v+=D.length}const S=new Uint8Array(v);for(let x=0,D=0;x<t.length;x++){const J=t[x];S.set(J,D),D+=J.length}return S}function Z(t,v){if(v==null||typeof v!="object")throw new Error("options must be defined");return Object.assign(t,v)}function G(t,v){if(t.length!==v.length)return!1;let S=0;for(let x=0;x<t.length;x++)S|=t[x]^v[x];return S===0}class ${}e.Hash=$;const a=(t,v)=>{function S(x,...D){if(s(x),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const ee=D[0];if(!ee)throw new Error("nonce / iv required");t.varSizeNonce?s(ee):s(ee,t.nonceLength)}const J=t.tagLength;J&&D[1]!==void 0&&s(D[1]);const W=v(x,...D),d=(ee,P)=>{if(P!==void 0){if(ee!==2)throw new Error("cipher output not supported");s(P)}};let M=!1;return{encrypt(ee,P){if(M)throw new Error("cannot encrypt() twice with same key + nonce");return M=!0,s(ee),d(W.encrypt.length,P),W.encrypt(ee,P)},decrypt(ee,P){if(s(ee),J&&ee.length<J)throw new Error("invalid ciphertext length: smaller than tagLength="+J);return d(W.decrypt.length,P),W.decrypt(ee,P)}}}return Object.assign(S,t),S};e.wrapCipher=a;function H(t,v,S=!0){if(v===void 0)return new Uint8Array(t);if(v.length!==t)throw new Error("invalid output length, expected "+t+", got: "+v.length);if(S&&!p(v))throw new Error("invalid output, must be aligned");return v}function l(t,v,S,x){if(typeof t.setBigUint64=="function")return t.setBigUint64(v,S,x);const D=BigInt(32),J=BigInt(4294967295),W=Number(S>>D&J),d=Number(S&J),M=x?4:0,z=x?0:4;t.setUint32(v+M,W,x),t.setUint32(v+z,d,x)}function u(t,v,S){f(S);const x=new Uint8Array(16),D=N(x);return l(D,0,BigInt(v),S),l(D,8,BigInt(t),S),x}function p(t){return t.byteOffset%4===0}function K(t){return Uint8Array.from(t)}})(Ot)),Ot}var Kt={},Ie={},Vr;function Ct(){return Vr||(Vr=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.AEAD_TAG_LENGTH=Ie.XCHACHA20_NONCE_LENGTH=Ie.CURVE25519_PUBLIC_KEY_SIZE=Ie.ETH_PUBLIC_KEY_SIZE=Ie.UNCOMPRESSED_PUBLIC_KEY_SIZE=Ie.COMPRESSED_PUBLIC_KEY_SIZE=Ie.SECRET_KEY_LENGTH=void 0,Ie.SECRET_KEY_LENGTH=32,Ie.COMPRESSED_PUBLIC_KEY_SIZE=33,Ie.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,Ie.ETH_PUBLIC_KEY_SIZE=64,Ie.CURVE25519_PUBLIC_KEY_SIZE=32,Ie.XCHACHA20_NONCE_LENGTH=24,Ie.AEAD_TAG_LENGTH=16),Ie}var jr;function ct(){return jr||(jr=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0;var r=Ct(),f=(function(){function w(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return w})();e.ECIES_CONFIG=new f;var c=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=c;var s=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=s;var i=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=i;var n=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=n;var o=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=o;var m=function(){var w={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?r.COMPRESSED_PUBLIC_KEY_SIZE:r.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:r.CURVE25519_PUBLIC_KEY_SIZE,ed25519:r.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in w)return w[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")};e.ephemeralKeySize=m})(Kt)),Kt}var Ht={},We={},Me={},Pt={},Tt={},ze={},Mr;function Bo(){return Mr||(Mr=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.crypto=void 0,ze.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),ze}var Ur;function Gr(){return Ur||(Ur=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=c,e.getWebcryptoSubtle=s,e.managedNonce=i;const r=Bo(),f=Le();function c(w=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(w));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(w));throw new Error("crypto.getRandomValues must be defined")}function s(){if(r.crypto&&typeof r.crypto.subtle=="object"&&r.crypto.subtle!=null)return r.crypto.subtle;throw new Error("crypto.subtle must be defined")}function i(w){const{nonceLength:O}=w;return(0,f.anumber)(O),((N,...F)=>({encrypt(L,...y){const g=c(O),A=w(N,g,...F).encrypt(L,...y),q=(0,f.concatBytes)(g,A);return A.fill(0),q},decrypt(L,...y){const g=L.subarray(0,O),A=L.subarray(O);return w(N,g,...F).decrypt(A,...y)}}))}e.utils={async encrypt(w,O,N,F){const L=s(),y=await L.importKey("raw",w,O,!0,["encrypt"]),g=await L.encrypt(N,y,F);return new Uint8Array(g)},async decrypt(w,O,N,F){const L=s(),y=await L.importKey("raw",w,O,!0,["decrypt"]),g=await L.decrypt(N,y,F);return new Uint8Array(g)}};const n={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function o(w,O,N){if(w===n.CBC)return{name:n.CBC,iv:O};if(w===n.CTR)return{name:n.CTR,counter:O,length:64};if(w===n.GCM)return N?{name:n.GCM,iv:O,additionalData:N}:{name:n.GCM,iv:O};throw new Error("unknown aes block mode")}function m(w){return(O,N,F)=>{(0,f.abytes)(O),(0,f.abytes)(N);const L={name:w,length:O.length*8},y=o(w,N,F);let g=!1;return{encrypt(A){if((0,f.abytes)(A),g)throw new Error("Cannot encrypt() twice with same key / nonce");return g=!0,e.utils.encrypt(O,L,y,A)},decrypt(A){return(0,f.abytes)(A),e.utils.decrypt(O,L,y,A)}}}}e.cbc=m(n.CBC),e.ctr=m(n.CTR),e.gcm=m(n.GCM)})(Tt)),Tt}var Nt={},xe={},Oe={},Lt={},Qe={},$r;function Ro(){return $r||($r=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.crypto=void 0,Qe.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),Qe}var Yr;function qe(){return Yr||(Yr=1,(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=f,e.anumber=c,e.abytes=s,e.ahash=i,e.aexists=n,e.aoutput=o,e.u8=m,e.u32=w,e.clean=O,e.createView=N,e.rotr=F,e.rotl=L,e.byteSwap=y,e.byteSwap32=g,e.bytesToHex=T,e.hexToBytes=h,e.asyncLoop=E,e.utf8ToBytes=V,e.bytesToUtf8=R,e.toBytes=k,e.kdfInputToBytes=U,e.concatBytes=Z,e.checkOpts=G,e.createHasher=a,e.createOptHasher=H,e.createXOFer=l,e.randomBytes=u;const r=Ro();function f(p){return p instanceof Uint8Array||ArrayBuffer.isView(p)&&p.constructor.name==="Uint8Array"}function c(p){if(!Number.isSafeInteger(p)||p<0)throw new Error("positive integer expected, got "+p)}function s(p,...K){if(!f(p))throw new Error("Uint8Array expected");if(K.length>0&&!K.includes(p.length))throw new Error("Uint8Array expected of length "+K+", got length="+p.length)}function i(p){if(typeof p!="function"||typeof p.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");c(p.outputLen),c(p.blockLen)}function n(p,K=!0){if(p.destroyed)throw new Error("Hash instance has been destroyed");if(K&&p.finished)throw new Error("Hash#digest() has already been called")}function o(p,K){s(p);const t=K.outputLen;if(p.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function m(p){return new Uint8Array(p.buffer,p.byteOffset,p.byteLength)}function w(p){return new Uint32Array(p.buffer,p.byteOffset,Math.floor(p.byteLength/4))}function O(...p){for(let K=0;K<p.length;K++)p[K].fill(0)}function N(p){return new DataView(p.buffer,p.byteOffset,p.byteLength)}function F(p,K){return p<<32-K|p>>>K}function L(p,K){return p<<K|p>>>32-K>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function y(p){return p<<24&4278190080|p<<8&16711680|p>>>8&65280|p>>>24&255}e.swap8IfBE=e.isLE?p=>p:p=>y(p),e.byteSwapIfBE=e.swap8IfBE;function g(p){for(let K=0;K<p.length;K++)p[K]=y(p[K]);return p}e.swap32IfBE=e.isLE?p=>p:g;const A=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",q=Array.from({length:256},(p,K)=>K.toString(16).padStart(2,"0"));function T(p){if(s(p),A)return p.toHex();let K="";for(let t=0;t<p.length;t++)K+=q[p[t]];return K}const C={_0:48,_9:57,A:65,F:70,a:97,f:102};function _(p){if(p>=C._0&&p<=C._9)return p-C._0;if(p>=C.A&&p<=C.F)return p-(C.A-10);if(p>=C.a&&p<=C.f)return p-(C.a-10)}function h(p){if(typeof p!="string")throw new Error("hex string expected, got "+typeof p);if(A)return Uint8Array.fromHex(p);const K=p.length,t=K/2;if(K%2)throw new Error("hex string expected, got unpadded hex of length "+K);const v=new Uint8Array(t);for(let S=0,x=0;S<t;S++,x+=2){const D=_(p.charCodeAt(x)),J=_(p.charCodeAt(x+1));if(D===void 0||J===void 0){const W=p[x]+p[x+1];throw new Error('hex string expected, got non-hex character "'+W+'" at index '+x)}v[S]=D*16+J}return v}const B=async()=>{};e.nextTick=B;async function E(p,K,t){let v=Date.now();for(let S=0;S<p;S++){t(S);const x=Date.now()-v;x>=0&&x<K||(await(0,e.nextTick)(),v+=x)}}function V(p){if(typeof p!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(p))}function R(p){return new TextDecoder().decode(p)}function k(p){return typeof p=="string"&&(p=V(p)),s(p),p}function U(p){return typeof p=="string"&&(p=V(p)),s(p),p}function Z(...p){let K=0;for(let v=0;v<p.length;v++){const S=p[v];s(S),K+=S.length}const t=new Uint8Array(K);for(let v=0,S=0;v<p.length;v++){const x=p[v];t.set(x,S),S+=x.length}return t}function G(p,K){if(K!==void 0&&{}.toString.call(K)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(p,K)}class ${}e.Hash=$;function a(p){const K=v=>p().update(k(v)).digest(),t=p();return K.outputLen=t.outputLen,K.blockLen=t.blockLen,K.create=()=>p(),K}function H(p){const K=(v,S)=>p(S).update(k(v)).digest(),t=p({});return K.outputLen=t.outputLen,K.blockLen=t.blockLen,K.create=v=>p(v),K}function l(p){const K=(v,S)=>p(S).update(k(v)).digest(),t=p({});return K.outputLen=t.outputLen,K.blockLen=t.blockLen,K.create=v=>p(v),K}e.wrapConstructor=a,e.wrapConstructorWithOpts=H,e.wrapXOFConstructorWithOpts=l;function u(p=32){if(r.crypto&&typeof r.crypto.getRandomValues=="function")return r.crypto.getRandomValues(new Uint8Array(p));if(r.crypto&&typeof r.crypto.randomBytes=="function")return Uint8Array.from(r.crypto.randomBytes(p));throw new Error("crypto.getRandomValues must be defined")}})(Lt)),Lt}var Zr;function Io(){if(Zr)return Oe;Zr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.SHA512_IV=Oe.SHA384_IV=Oe.SHA224_IV=Oe.SHA256_IV=Oe.HashMD=void 0,Oe.setBigUint64=r,Oe.Chi=f,Oe.Maj=c;const e=qe();function r(i,n,o,m){if(typeof i.setBigUint64=="function")return i.setBigUint64(n,o,m);const w=BigInt(32),O=BigInt(4294967295),N=Number(o>>w&O),F=Number(o&O),L=m?4:0,y=m?0:4;i.setUint32(n+L,N,m),i.setUint32(n+y,F,m)}function f(i,n,o){return i&n^~i&o}function c(i,n,o){return i&n^i&o^n&o}class s extends e.Hash{constructor(n,o,m,w){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=n,this.outputLen=o,this.padOffset=m,this.isLE=w,this.buffer=new Uint8Array(n),this.view=(0,e.createView)(this.buffer)}update(n){(0,e.aexists)(this),n=(0,e.toBytes)(n),(0,e.abytes)(n);const{view:o,buffer:m,blockLen:w}=this,O=n.length;for(let N=0;N<O;){const F=Math.min(w-this.pos,O-N);if(F===w){const L=(0,e.createView)(n);for(;w<=O-N;N+=w)this.process(L,N);continue}m.set(n.subarray(N,N+F),this.pos),this.pos+=F,N+=F,this.pos===w&&(this.process(o,0),this.pos=0)}return this.length+=n.length,this.roundClean(),this}digestInto(n){(0,e.aexists)(this),(0,e.aoutput)(n,this),this.finished=!0;const{buffer:o,view:m,blockLen:w,isLE:O}=this;let{pos:N}=this;o[N++]=128,(0,e.clean)(this.buffer.subarray(N)),this.padOffset>w-N&&(this.process(m,0),N=0);for(let A=N;A<w;A++)o[A]=0;r(m,w-8,BigInt(this.length*8),O),this.process(m,0);const F=(0,e.createView)(n),L=this.outputLen;if(L%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const y=L/4,g=this.get();if(y>g.length)throw new Error("_sha2: outputLen bigger than state");for(let A=0;A<y;A++)F.setUint32(4*A,g[A],O)}digest(){const{buffer:n,outputLen:o}=this;this.digestInto(n);const m=n.slice(0,o);return this.destroy(),m}_cloneInto(n){n||(n=new this.constructor),n.set(...this.get());const{blockLen:o,buffer:m,length:w,finished:O,destroyed:N,pos:F}=this;return n.destroyed=N,n.finished=O,n.length=w,n.pos=F,w%o&&n.buffer.set(m),n}clone(){return this._cloneInto()}}return Oe.HashMD=s,Oe.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oe.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),Oe.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Oe.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Oe}var me={},Xr;function Oo(){if(Xr)return me;Xr=1,Object.defineProperty(me,"__esModule",{value:!0}),me.toBig=me.shrSL=me.shrSH=me.rotrSL=me.rotrSH=me.rotrBL=me.rotrBH=me.rotr32L=me.rotr32H=me.rotlSL=me.rotlSH=me.rotlBL=me.rotlBH=me.add5L=me.add5H=me.add4L=me.add4H=me.add3L=me.add3H=void 0,me.add=q,me.fromBig=f,me.split=c;const e=BigInt(2**32-1),r=BigInt(32);function f(R,k=!1){return k?{h:Number(R&e),l:Number(R>>r&e)}:{h:Number(R>>r&e)|0,l:Number(R&e)|0}}function c(R,k=!1){const U=R.length;let Z=new Uint32Array(U),G=new Uint32Array(U);for(let $=0;$<U;$++){const{h:a,l:H}=f(R[$],k);[Z[$],G[$]]=[a,H]}return[Z,G]}const s=(R,k)=>BigInt(R>>>0)<<r|BigInt(k>>>0);me.toBig=s;const i=(R,k,U)=>R>>>U;me.shrSH=i;const n=(R,k,U)=>R<<32-U|k>>>U;me.shrSL=n;const o=(R,k,U)=>R>>>U|k<<32-U;me.rotrSH=o;const m=(R,k,U)=>R<<32-U|k>>>U;me.rotrSL=m;const w=(R,k,U)=>R<<64-U|k>>>U-32;me.rotrBH=w;const O=(R,k,U)=>R>>>U-32|k<<64-U;me.rotrBL=O;const N=(R,k)=>k;me.rotr32H=N;const F=(R,k)=>R;me.rotr32L=F;const L=(R,k,U)=>R<<U|k>>>32-U;me.rotlSH=L;const y=(R,k,U)=>k<<U|R>>>32-U;me.rotlSL=y;const g=(R,k,U)=>k<<U-32|R>>>64-U;me.rotlBH=g;const A=(R,k,U)=>R<<U-32|k>>>64-U;me.rotlBL=A;function q(R,k,U,Z){const G=(k>>>0)+(Z>>>0);return{h:R+U+(G/2**32|0)|0,l:G|0}}const T=(R,k,U)=>(R>>>0)+(k>>>0)+(U>>>0);me.add3L=T;const C=(R,k,U,Z)=>k+U+Z+(R/2**32|0)|0;me.add3H=C;const _=(R,k,U,Z)=>(R>>>0)+(k>>>0)+(U>>>0)+(Z>>>0);me.add4L=_;const h=(R,k,U,Z,G)=>k+U+Z+G+(R/2**32|0)|0;me.add4H=h;const B=(R,k,U,Z,G)=>(R>>>0)+(k>>>0)+(U>>>0)+(Z>>>0)+(G>>>0);me.add5L=B;const E=(R,k,U,Z,G,$)=>k+U+Z+G+$+(R/2**32|0)|0;me.add5H=E;const V={fromBig:f,split:c,toBig:s,shrSH:i,shrSL:n,rotrSH:o,rotrSL:m,rotrBH:w,rotrBL:O,rotr32H:N,rotr32L:F,rotlSH:L,rotlSL:y,rotlBH:g,rotlBL:A,add:q,add3L:T,add3H:C,add4L:_,add4H:h,add5H:E,add5L:B};return me.default=V,me}var Wr;function qt(){if(Wr)return xe;Wr=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.sha512_224=xe.sha512_256=xe.sha384=xe.sha512=xe.sha224=xe.sha256=xe.SHA512_256=xe.SHA512_224=xe.SHA384=xe.SHA512=xe.SHA224=xe.SHA256=void 0;const e=Io(),r=Oo(),f=qe(),c=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=new Uint32Array(64);class i extends e.HashMD{constructor(C=32){super(64,C,8,!1),this.A=e.SHA256_IV[0]|0,this.B=e.SHA256_IV[1]|0,this.C=e.SHA256_IV[2]|0,this.D=e.SHA256_IV[3]|0,this.E=e.SHA256_IV[4]|0,this.F=e.SHA256_IV[5]|0,this.G=e.SHA256_IV[6]|0,this.H=e.SHA256_IV[7]|0}get(){const{A:C,B:_,C:h,D:B,E,F:V,G:R,H:k}=this;return[C,_,h,B,E,V,R,k]}set(C,_,h,B,E,V,R,k){this.A=C|0,this.B=_|0,this.C=h|0,this.D=B|0,this.E=E|0,this.F=V|0,this.G=R|0,this.H=k|0}process(C,_){for(let G=0;G<16;G++,_+=4)s[G]=C.getUint32(_,!1);for(let G=16;G<64;G++){const $=s[G-15],a=s[G-2],H=(0,f.rotr)($,7)^(0,f.rotr)($,18)^$>>>3,l=(0,f.rotr)(a,17)^(0,f.rotr)(a,19)^a>>>10;s[G]=l+s[G-7]+H+s[G-16]|0}let{A:h,B,C:E,D:V,E:R,F:k,G:U,H:Z}=this;for(let G=0;G<64;G++){const $=(0,f.rotr)(R,6)^(0,f.rotr)(R,11)^(0,f.rotr)(R,25),a=Z+$+(0,e.Chi)(R,k,U)+c[G]+s[G]|0,l=((0,f.rotr)(h,2)^(0,f.rotr)(h,13)^(0,f.rotr)(h,22))+(0,e.Maj)(h,B,E)|0;Z=U,U=k,k=R,R=V+a|0,V=E,E=B,B=h,h=a+l|0}h=h+this.A|0,B=B+this.B|0,E=E+this.C|0,V=V+this.D|0,R=R+this.E|0,k=k+this.F|0,U=U+this.G|0,Z=Z+this.H|0,this.set(h,B,E,V,R,k,U,Z)}roundClean(){(0,f.clean)(s)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,f.clean)(this.buffer)}}xe.SHA256=i;class n extends i{constructor(){super(28),this.A=e.SHA224_IV[0]|0,this.B=e.SHA224_IV[1]|0,this.C=e.SHA224_IV[2]|0,this.D=e.SHA224_IV[3]|0,this.E=e.SHA224_IV[4]|0,this.F=e.SHA224_IV[5]|0,this.G=e.SHA224_IV[6]|0,this.H=e.SHA224_IV[7]|0}}xe.SHA224=n;const o=r.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(T=>BigInt(T))),m=o[0],w=o[1],O=new Uint32Array(80),N=new Uint32Array(80);class F extends e.HashMD{constructor(C=64){super(128,C,16,!1),this.Ah=e.SHA512_IV[0]|0,this.Al=e.SHA512_IV[1]|0,this.Bh=e.SHA512_IV[2]|0,this.Bl=e.SHA512_IV[3]|0,this.Ch=e.SHA512_IV[4]|0,this.Cl=e.SHA512_IV[5]|0,this.Dh=e.SHA512_IV[6]|0,this.Dl=e.SHA512_IV[7]|0,this.Eh=e.SHA512_IV[8]|0,this.El=e.SHA512_IV[9]|0,this.Fh=e.SHA512_IV[10]|0,this.Fl=e.SHA512_IV[11]|0,this.Gh=e.SHA512_IV[12]|0,this.Gl=e.SHA512_IV[13]|0,this.Hh=e.SHA512_IV[14]|0,this.Hl=e.SHA512_IV[15]|0}get(){const{Ah:C,Al:_,Bh:h,Bl:B,Ch:E,Cl:V,Dh:R,Dl:k,Eh:U,El:Z,Fh:G,Fl:$,Gh:a,Gl:H,Hh:l,Hl:u}=this;return[C,_,h,B,E,V,R,k,U,Z,G,$,a,H,l,u]}set(C,_,h,B,E,V,R,k,U,Z,G,$,a,H,l,u){this.Ah=C|0,this.Al=_|0,this.Bh=h|0,this.Bl=B|0,this.Ch=E|0,this.Cl=V|0,this.Dh=R|0,this.Dl=k|0,this.Eh=U|0,this.El=Z|0,this.Fh=G|0,this.Fl=$|0,this.Gh=a|0,this.Gl=H|0,this.Hh=l|0,this.Hl=u|0}process(C,_){for(let t=0;t<16;t++,_+=4)O[t]=C.getUint32(_),N[t]=C.getUint32(_+=4);for(let t=16;t<80;t++){const v=O[t-15]|0,S=N[t-15]|0,x=r.rotrSH(v,S,1)^r.rotrSH(v,S,8)^r.shrSH(v,S,7),D=r.rotrSL(v,S,1)^r.rotrSL(v,S,8)^r.shrSL(v,S,7),J=O[t-2]|0,W=N[t-2]|0,d=r.rotrSH(J,W,19)^r.rotrBH(J,W,61)^r.shrSH(J,W,6),M=r.rotrSL(J,W,19)^r.rotrBL(J,W,61)^r.shrSL(J,W,6),z=r.add4L(D,M,N[t-7],N[t-16]),ee=r.add4H(z,x,d,O[t-7],O[t-16]);O[t]=ee|0,N[t]=z|0}let{Ah:h,Al:B,Bh:E,Bl:V,Ch:R,Cl:k,Dh:U,Dl:Z,Eh:G,El:$,Fh:a,Fl:H,Gh:l,Gl:u,Hh:p,Hl:K}=this;for(let t=0;t<80;t++){const v=r.rotrSH(G,$,14)^r.rotrSH(G,$,18)^r.rotrBH(G,$,41),S=r.rotrSL(G,$,14)^r.rotrSL(G,$,18)^r.rotrBL(G,$,41),x=G&a^~G&l,D=$&H^~$&u,J=r.add5L(K,S,D,w[t],N[t]),W=r.add5H(J,p,v,x,m[t],O[t]),d=J|0,M=r.rotrSH(h,B,28)^r.rotrBH(h,B,34)^r.rotrBH(h,B,39),z=r.rotrSL(h,B,28)^r.rotrBL(h,B,34)^r.rotrBL(h,B,39),ee=h&E^h&R^E&R,P=B&V^B&k^V&k;p=l|0,K=u|0,l=a|0,u=H|0,a=G|0,H=$|0,{h:G,l:$}=r.add(U|0,Z|0,W|0,d|0),U=R|0,Z=k|0,R=E|0,k=V|0,E=h|0,V=B|0;const b=r.add3L(d,z,P);h=r.add3H(b,W,M,ee),B=b|0}({h,l:B}=r.add(this.Ah|0,this.Al|0,h|0,B|0)),{h:E,l:V}=r.add(this.Bh|0,this.Bl|0,E|0,V|0),{h:R,l:k}=r.add(this.Ch|0,this.Cl|0,R|0,k|0),{h:U,l:Z}=r.add(this.Dh|0,this.Dl|0,U|0,Z|0),{h:G,l:$}=r.add(this.Eh|0,this.El|0,G|0,$|0),{h:a,l:H}=r.add(this.Fh|0,this.Fl|0,a|0,H|0),{h:l,l:u}=r.add(this.Gh|0,this.Gl|0,l|0,u|0),{h:p,l:K}=r.add(this.Hh|0,this.Hl|0,p|0,K|0),this.set(h,B,E,V,R,k,U,Z,G,$,a,H,l,u,p,K)}roundClean(){(0,f.clean)(O,N)}destroy(){(0,f.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}xe.SHA512=F;class L extends F{constructor(){super(48),this.Ah=e.SHA384_IV[0]|0,this.Al=e.SHA384_IV[1]|0,this.Bh=e.SHA384_IV[2]|0,this.Bl=e.SHA384_IV[3]|0,this.Ch=e.SHA384_IV[4]|0,this.Cl=e.SHA384_IV[5]|0,this.Dh=e.SHA384_IV[6]|0,this.Dl=e.SHA384_IV[7]|0,this.Eh=e.SHA384_IV[8]|0,this.El=e.SHA384_IV[9]|0,this.Fh=e.SHA384_IV[10]|0,this.Fl=e.SHA384_IV[11]|0,this.Gh=e.SHA384_IV[12]|0,this.Gl=e.SHA384_IV[13]|0,this.Hh=e.SHA384_IV[14]|0,this.Hl=e.SHA384_IV[15]|0}}xe.SHA384=L;const y=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),g=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class A extends F{constructor(){super(28),this.Ah=y[0]|0,this.Al=y[1]|0,this.Bh=y[2]|0,this.Bl=y[3]|0,this.Ch=y[4]|0,this.Cl=y[5]|0,this.Dh=y[6]|0,this.Dl=y[7]|0,this.Eh=y[8]|0,this.El=y[9]|0,this.Fh=y[10]|0,this.Fl=y[11]|0,this.Gh=y[12]|0,this.Gl=y[13]|0,this.Hh=y[14]|0,this.Hl=y[15]|0}}xe.SHA512_224=A;class q extends F{constructor(){super(32),this.Ah=g[0]|0,this.Al=g[1]|0,this.Bh=g[2]|0,this.Bl=g[3]|0,this.Ch=g[4]|0,this.Cl=g[5]|0,this.Dh=g[6]|0,this.Dl=g[7]|0,this.Eh=g[8]|0,this.El=g[9]|0,this.Fh=g[10]|0,this.Fl=g[11]|0,this.Gh=g[12]|0,this.Gl=g[13]|0,this.Hh=g[14]|0,this.Hl=g[15]|0}}return xe.SHA512_256=q,xe.sha256=(0,f.createHasher)(()=>new i),xe.sha224=(0,f.createHasher)(()=>new n),xe.sha512=(0,f.createHasher)(()=>new F),xe.sha384=(0,f.createHasher)(()=>new L),xe.sha512_256=(0,f.createHasher)(()=>new q),xe.sha512_224=(0,f.createHasher)(()=>new A),xe}var Ke={},Dt={},zr;function ke(){return zr||(zr=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.notImplemented=e.bitMask=e.utf8ToBytes=e.randomBytes=e.isBytes=e.hexToBytes=e.concatBytes=e.bytesToUtf8=e.bytesToHex=e.anumber=e.abytes=void 0,e.abool=i,e._abool2=n,e._abytes2=o,e.numberToHexUnpadded=m,e.hexToNumber=w,e.bytesToNumberBE=O,e.bytesToNumberLE=N,e.numberToBytesBE=F,e.numberToBytesLE=L,e.numberToVarBytesBE=y,e.ensureBytes=g,e.equalBytes=A,e.copyBytes=q,e.asciiToBytes=T,e.inRange=_,e.aInRange=h,e.bitLen=B,e.bitGet=E,e.bitSet=V,e.createHmacDrbg=k,e.validateObject=Z,e.isHash=G,e._validateObject=$,e.memoized=H;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=qe();var f=qe();Object.defineProperty(e,"abytes",{enumerable:!0,get:function(){return f.abytes}}),Object.defineProperty(e,"anumber",{enumerable:!0,get:function(){return f.anumber}}),Object.defineProperty(e,"bytesToHex",{enumerable:!0,get:function(){return f.bytesToHex}}),Object.defineProperty(e,"bytesToUtf8",{enumerable:!0,get:function(){return f.bytesToUtf8}}),Object.defineProperty(e,"concatBytes",{enumerable:!0,get:function(){return f.concatBytes}}),Object.defineProperty(e,"hexToBytes",{enumerable:!0,get:function(){return f.hexToBytes}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return f.isBytes}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return f.randomBytes}}),Object.defineProperty(e,"utf8ToBytes",{enumerable:!0,get:function(){return f.utf8ToBytes}});const c=BigInt(0),s=BigInt(1);function i(l,u){if(typeof u!="boolean")throw new Error(l+" boolean expected, got "+u)}function n(l,u=""){if(typeof l!="boolean"){const p=u&&`"${u}"`;throw new Error(p+"expected boolean, got type="+typeof l)}return l}function o(l,u,p=""){const K=(0,r.isBytes)(l),t=l?.length,v=u!==void 0;if(!K||v&&t!==u){const S=p&&`"${p}" `,x=v?` of length ${u}`:"",D=K?`length=${t}`:`type=${typeof l}`;throw new Error(S+"expected Uint8Array"+x+", got "+D)}return l}function m(l){const u=l.toString(16);return u.length&1?"0"+u:u}function w(l){if(typeof l!="string")throw new Error("hex string expected, got "+typeof l);return l===""?c:BigInt("0x"+l)}function O(l){return w((0,r.bytesToHex)(l))}function N(l){return(0,r.abytes)(l),w((0,r.bytesToHex)(Uint8Array.from(l).reverse()))}function F(l,u){return(0,r.hexToBytes)(l.toString(16).padStart(u*2,"0"))}function L(l,u){return F(l,u).reverse()}function y(l){return(0,r.hexToBytes)(m(l))}function g(l,u,p){let K;if(typeof u=="string")try{K=(0,r.hexToBytes)(u)}catch(v){throw new Error(l+" must be hex string or Uint8Array, cause: "+v)}else if((0,r.isBytes)(u))K=Uint8Array.from(u);else throw new Error(l+" must be hex string or Uint8Array");const t=K.length;if(typeof p=="number"&&t!==p)throw new Error(l+" of length "+p+" expected, got "+t);return K}function A(l,u){if(l.length!==u.length)return!1;let p=0;for(let K=0;K<l.length;K++)p|=l[K]^u[K];return p===0}function q(l){return Uint8Array.from(l)}function T(l){return Uint8Array.from(l,(u,p)=>{const K=u.charCodeAt(0);if(u.length!==1||K>127)throw new Error(`string contains non-ASCII character "${l[p]}" with code ${K} at position ${p}`);return K})}const C=l=>typeof l=="bigint"&&c<=l;function _(l,u,p){return C(l)&&C(u)&&C(p)&&u<=l&&l<p}function h(l,u,p,K){if(!_(u,p,K))throw new Error("expected valid "+l+": "+p+" <= n < "+K+", got "+u)}function B(l){let u;for(u=0;l>c;l>>=s,u+=1);return u}function E(l,u){return l>>BigInt(u)&s}function V(l,u,p){return l|(p?s:c)<<BigInt(u)}const R=l=>(s<<BigInt(l))-s;e.bitMask=R;function k(l,u,p){if(typeof l!="number"||l<2)throw new Error("hashLen must be a number");if(typeof u!="number"||u<2)throw new Error("qByteLen must be a number");if(typeof p!="function")throw new Error("hmacFn must be a function");const K=z=>new Uint8Array(z),t=z=>Uint8Array.of(z);let v=K(l),S=K(l),x=0;const D=()=>{v.fill(1),S.fill(0),x=0},J=(...z)=>p(S,v,...z),W=(z=K(0))=>{S=J(t(0),z),v=J(),z.length!==0&&(S=J(t(1),z),v=J())},d=()=>{if(x++>=1e3)throw new Error("drbg: tried 1000 values");let z=0;const ee=[];for(;z<u;){v=J();const P=v.slice();ee.push(P),z+=v.length}return(0,r.concatBytes)(...ee)};return(z,ee)=>{D(),W(z);let P;for(;!(P=ee(d()));)W();return D(),P}}const U={bigint:l=>typeof l=="bigint",function:l=>typeof l=="function",boolean:l=>typeof l=="boolean",string:l=>typeof l=="string",stringOrUint8Array:l=>typeof l=="string"||(0,r.isBytes)(l),isSafeInteger:l=>Number.isSafeInteger(l),array:l=>Array.isArray(l),field:(l,u)=>u.Fp.isValid(l),hash:l=>typeof l=="function"&&Number.isSafeInteger(l.outputLen)};function Z(l,u,p={}){const K=(t,v,S)=>{const x=U[v];if(typeof x!="function")throw new Error("invalid validator function");const D=l[t];if(!(S&&D===void 0)&&!x(D,l))throw new Error("param "+String(t)+" is invalid. Expected "+v+", got "+D)};for(const[t,v]of Object.entries(u))K(t,v,!1);for(const[t,v]of Object.entries(p))K(t,v,!0);return l}function G(l){return typeof l=="function"&&Number.isSafeInteger(l.outputLen)}function $(l,u,p={}){if(!l||typeof l!="object")throw new Error("expected valid options object");function K(t,v,S){const x=l[t];if(S&&x===void 0)return;const D=typeof x;if(D!==v||x===null)throw new Error(`param "${t}" is invalid: expected ${v}, got ${D}`)}Object.entries(u).forEach(([t,v])=>K(t,v,!1)),Object.entries(p).forEach(([t,v])=>K(t,v,!0))}const a=()=>{throw new Error("not implemented")};e.notImplemented=a;function H(l){const u=new WeakMap;return(p,...K)=>{const t=u.get(p);if(t!==void 0)return t;const v=l(p,...K);return u.set(p,v),v}}})(Dt)),Dt}var Ae={},Qr;function Ue(){if(Qr)return Ae;Qr=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.isNegativeLE=void 0,Ae.mod=N,Ae.pow=F,Ae.pow2=L,Ae.invert=y,Ae.tonelliShanks=C,Ae.FpSqrt=_,Ae.validateField=E,Ae.FpPow=V,Ae.FpInvertBatch=R,Ae.FpDiv=k,Ae.FpLegendre=U,Ae.FpIsSquare=Z,Ae.nLength=G,Ae.Field=$,Ae.FpSqrtOdd=a,Ae.FpSqrtEven=H,Ae.hashToPrivateScalar=l,Ae.getFieldBytesLength=u,Ae.getMinHashLength=p,Ae.mapHashToField=K;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=BigInt(0),f=BigInt(1),c=BigInt(2),s=BigInt(3),i=BigInt(4),n=BigInt(5),o=BigInt(7),m=BigInt(8),w=BigInt(9),O=BigInt(16);function N(t,v){const S=t%v;return S>=r?S:v+S}function F(t,v,S){return V($(S),t,v)}function L(t,v,S){let x=t;for(;v-- >r;)x*=x,x%=S;return x}function y(t,v){if(t===r)throw new Error("invert: expected non-zero number");if(v<=r)throw new Error("invert: expected positive modulus, got "+v);let S=N(t,v),x=v,D=r,J=f;for(;S!==r;){const d=x/S,M=x%S,z=D-J*d;x=S,S=M,D=J,J=z}if(x!==f)throw new Error("invert: does not exist");return N(D,v)}function g(t,v,S){if(!t.eql(t.sqr(v),S))throw new Error("Cannot find square root")}function A(t,v){const S=(t.ORDER+f)/i,x=t.pow(v,S);return g(t,x,v),x}function q(t,v){const S=(t.ORDER-n)/m,x=t.mul(v,c),D=t.pow(x,S),J=t.mul(v,D),W=t.mul(t.mul(J,c),D),d=t.mul(J,t.sub(W,t.ONE));return g(t,d,v),d}function T(t){const v=$(t),S=C(t),x=S(v,v.neg(v.ONE)),D=S(v,x),J=S(v,v.neg(x)),W=(t+o)/O;return(d,M)=>{let z=d.pow(M,W),ee=d.mul(z,x);const P=d.mul(z,D),b=d.mul(z,J),X=d.eql(d.sqr(ee),M),se=d.eql(d.sqr(P),M);z=d.cmov(z,ee,X),ee=d.cmov(b,P,se);const ue=d.eql(d.sqr(ee),M),he=d.cmov(z,ee,ue);return g(d,he,M),he}}function C(t){if(t<s)throw new Error("sqrt is not defined for small field");let v=t-f,S=0;for(;v%c===r;)v/=c,S++;let x=c;const D=$(t);for(;U(D,x)===1;)if(x++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(S===1)return A;let J=D.pow(x,v);const W=(v+f)/c;return function(M,z){if(M.is0(z))return z;if(U(M,z)!==1)throw new Error("Cannot find square root");let ee=S,P=M.mul(M.ONE,J),b=M.pow(z,v),X=M.pow(z,W);for(;!M.eql(b,M.ONE);){if(M.is0(b))return M.ZERO;let se=1,ue=M.sqr(b);for(;!M.eql(ue,M.ONE);)if(se++,ue=M.sqr(ue),se===ee)throw new Error("Cannot find square root");const he=f<<BigInt(ee-se-1),pe=M.pow(P,he);ee=se,P=M.sqr(pe),b=M.mul(b,P),X=M.mul(X,pe)}return X}}function _(t){return t%i===s?A:t%m===n?q:t%O===w?T(t):C(t)}const h=(t,v)=>(N(t,v)&f)===f;Ae.isNegativeLE=h;const B=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function E(t){const v={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},S=B.reduce((x,D)=>(x[D]="function",x),v);return(0,e._validateObject)(t,S),t}function V(t,v,S){if(S<r)throw new Error("invalid exponent, negatives unsupported");if(S===r)return t.ONE;if(S===f)return v;let x=t.ONE,D=v;for(;S>r;)S&f&&(x=t.mul(x,D)),D=t.sqr(D),S>>=f;return x}function R(t,v,S=!1){const x=new Array(v.length).fill(S?t.ZERO:void 0),D=v.reduce((W,d,M)=>t.is0(d)?W:(x[M]=W,t.mul(W,d)),t.ONE),J=t.inv(D);return v.reduceRight((W,d,M)=>t.is0(d)?W:(x[M]=t.mul(W,x[M]),t.mul(W,d)),J),x}function k(t,v,S){return t.mul(v,typeof S=="bigint"?y(S,t.ORDER):t.inv(S))}function U(t,v){const S=(t.ORDER-f)/c,x=t.pow(v,S),D=t.eql(x,t.ONE),J=t.eql(x,t.ZERO),W=t.eql(x,t.neg(t.ONE));if(!D&&!J&&!W)throw new Error("invalid Legendre symbol result");return D?1:J?0:-1}function Z(t,v){return U(t,v)===1}function G(t,v){v!==void 0&&(0,e.anumber)(v);const S=v!==void 0?v:t.toString(2).length,x=Math.ceil(S/8);return{nBitLength:S,nByteLength:x}}function $(t,v,S=!1,x={}){if(t<=r)throw new Error("invalid field: expected ORDER > 0, got "+t);let D,J,W=!1,d;if(typeof v=="object"&&v!=null){if(x.sqrt||S)throw new Error("cannot specify opts in two arguments");const b=v;b.BITS&&(D=b.BITS),b.sqrt&&(J=b.sqrt),typeof b.isLE=="boolean"&&(S=b.isLE),typeof b.modFromBytes=="boolean"&&(W=b.modFromBytes),d=b.allowedLengths}else typeof v=="number"&&(D=v),x.sqrt&&(J=x.sqrt);const{nBitLength:M,nByteLength:z}=G(t,D);if(z>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let ee;const P=Object.freeze({ORDER:t,isLE:S,BITS:M,BYTES:z,MASK:(0,e.bitMask)(M),ZERO:r,ONE:f,allowedLengths:d,create:b=>N(b,t),isValid:b=>{if(typeof b!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof b);return r<=b&&b<t},is0:b=>b===r,isValidNot0:b=>!P.is0(b)&&P.isValid(b),isOdd:b=>(b&f)===f,neg:b=>N(-b,t),eql:(b,X)=>b===X,sqr:b=>N(b*b,t),add:(b,X)=>N(b+X,t),sub:(b,X)=>N(b-X,t),mul:(b,X)=>N(b*X,t),pow:(b,X)=>V(P,b,X),div:(b,X)=>N(b*y(X,t),t),sqrN:b=>b*b,addN:(b,X)=>b+X,subN:(b,X)=>b-X,mulN:(b,X)=>b*X,inv:b=>y(b,t),sqrt:J||(b=>(ee||(ee=_(t)),ee(P,b))),toBytes:b=>S?(0,e.numberToBytesLE)(b,z):(0,e.numberToBytesBE)(b,z),fromBytes:(b,X=!0)=>{if(d){if(!d.includes(b.length)||b.length>z)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+b.length);const ue=new Uint8Array(z);ue.set(b,S?0:ue.length-b.length),b=ue}if(b.length!==z)throw new Error("Field.fromBytes: expected "+z+" bytes, got "+b.length);let se=S?(0,e.bytesToNumberLE)(b):(0,e.bytesToNumberBE)(b);if(W&&(se=N(se,t)),!X&&!P.isValid(se))throw new Error("invalid field element: outside of range 0..ORDER");return se},invertBatch:b=>R(P,b),cmov:(b,X,se)=>se?X:b});return Object.freeze(P)}function a(t,v){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const S=t.sqrt(v);return t.isOdd(S)?S:t.neg(S)}function H(t,v){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const S=t.sqrt(v);return t.isOdd(S)?t.neg(S):S}function l(t,v,S=!1){t=(0,e.ensureBytes)("privateHash",t);const x=t.length,D=G(v).nByteLength+8;if(D<24||x<D||x>1024)throw new Error("hashToPrivateScalar: expected "+D+"-1024 bytes of input, got "+x);const J=S?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t);return N(J,v-f)+f}function u(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const v=t.toString(2).length;return Math.ceil(v/8)}function p(t){const v=u(t);return v+Math.ceil(v/2)}function K(t,v,S=!1){const x=t.length,D=u(v),J=p(v);if(x<16||x<J||x>1024)throw new Error("expected "+J+"-1024 bytes of input, got "+x);const W=S?(0,e.bytesToNumberLE)(t):(0,e.bytesToNumberBE)(t),d=N(W,v-f)+f;return S?(0,e.numberToBytesLE)(d,D):(0,e.numberToBytesBE)(d,D)}return Ae}var Jr;function Ft(){if(Jr)return Ke;Jr=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.wNAF=void 0,Ke.negateCt=s,Ke.normalizeZ=i,Ke.mulEndoUnsafe=A,Ke.pippenger=q,Ke.precomputeMSMUnsafe=T,Ke.validateBasic=C,Ke._createCurveFields=h;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ue(),f=BigInt(0),c=BigInt(1);function s(B,E){const V=E.negate();return B?V:E}function i(B,E){const V=(0,r.FpInvertBatch)(B.Fp,E.map(R=>R.Z));return E.map((R,k)=>B.fromAffine(R.toAffine(V[k])))}function n(B,E){if(!Number.isSafeInteger(B)||B<=0||B>E)throw new Error("invalid window size, expected [1.."+E+"], got W="+B)}function o(B,E){n(B,E);const V=Math.ceil(E/B)+1,R=2**(B-1),k=2**B,U=(0,e.bitMask)(B),Z=BigInt(B);return{windows:V,windowSize:R,mask:U,maxNumber:k,shiftBy:Z}}function m(B,E,V){const{windowSize:R,mask:k,maxNumber:U,shiftBy:Z}=V;let G=Number(B&k),$=B>>Z;G>R&&(G-=U,$+=c);const a=E*R,H=a+Math.abs(G)-1,l=G===0,u=G<0,p=E%2!==0;return{nextN:$,offset:H,isZero:l,isNeg:u,isNegF:p,offsetF:a}}function w(B,E){if(!Array.isArray(B))throw new Error("array expected");B.forEach((V,R)=>{if(!(V instanceof E))throw new Error("invalid point at index "+R)})}function O(B,E){if(!Array.isArray(B))throw new Error("array of scalars expected");B.forEach((V,R)=>{if(!E.isValid(V))throw new Error("invalid scalar at index "+R)})}const N=new WeakMap,F=new WeakMap;function L(B){return F.get(B)||1}function y(B){if(B!==f)throw new Error("invalid wNAF")}class g{constructor(E,V){this.BASE=E.BASE,this.ZERO=E.ZERO,this.Fn=E.Fn,this.bits=V}_unsafeLadder(E,V,R=this.ZERO){let k=E;for(;V>f;)V&c&&(R=R.add(k)),k=k.double(),V>>=c;return R}precomputeWindow(E,V){const{windows:R,windowSize:k}=o(V,this.bits),U=[];let Z=E,G=Z;for(let $=0;$<R;$++){G=Z,U.push(G);for(let a=1;a<k;a++)G=G.add(Z),U.push(G);Z=G.double()}return U}wNAF(E,V,R){if(!this.Fn.isValid(R))throw new Error("invalid scalar");let k=this.ZERO,U=this.BASE;const Z=o(E,this.bits);for(let G=0;G<Z.windows;G++){const{nextN:$,offset:a,isZero:H,isNeg:l,isNegF:u,offsetF:p}=m(R,G,Z);R=$,H?U=U.add(s(u,V[p])):k=k.add(s(l,V[a]))}return y(R),{p:k,f:U}}wNAFUnsafe(E,V,R,k=this.ZERO){const U=o(E,this.bits);for(let Z=0;Z<U.windows&&R!==f;Z++){const{nextN:G,offset:$,isZero:a,isNeg:H}=m(R,Z,U);if(R=G,!a){const l=V[$];k=k.add(H?l.negate():l)}}return y(R),k}getPrecomputes(E,V,R){let k=N.get(V);return k||(k=this.precomputeWindow(V,E),E!==1&&(typeof R=="function"&&(k=R(k)),N.set(V,k))),k}cached(E,V,R){const k=L(E);return this.wNAF(k,this.getPrecomputes(k,E,R),V)}unsafe(E,V,R,k){const U=L(E);return U===1?this._unsafeLadder(E,V,k):this.wNAFUnsafe(U,this.getPrecomputes(U,E,R),V,k)}createCache(E,V){n(V,this.bits),F.set(E,V),N.delete(E)}hasCache(E){return L(E)!==1}}Ke.wNAF=g;function A(B,E,V,R){let k=E,U=B.ZERO,Z=B.ZERO;for(;V>f||R>f;)V&c&&(U=U.add(k)),R&c&&(Z=Z.add(k)),k=k.double(),V>>=c,R>>=c;return{p1:U,p2:Z}}function q(B,E,V,R){w(V,B),O(R,E);const k=V.length,U=R.length;if(k!==U)throw new Error("arrays of points and scalars must have equal length");const Z=B.ZERO,G=(0,e.bitLen)(BigInt(k));let $=1;G>12?$=G-3:G>4?$=G-2:G>0&&($=2);const a=(0,e.bitMask)($),H=new Array(Number(a)+1).fill(Z),l=Math.floor((E.BITS-1)/$)*$;let u=Z;for(let p=l;p>=0;p-=$){H.fill(Z);for(let t=0;t<U;t++){const v=R[t],S=Number(v>>BigInt(p)&a);H[S]=H[S].add(V[t])}let K=Z;for(let t=H.length-1,v=Z;t>0;t--)v=v.add(H[t]),K=K.add(v);if(u=u.add(K),p!==0)for(let t=0;t<$;t++)u=u.double()}return u}function T(B,E,V,R){n(R,E.BITS),w(V,B);const k=B.ZERO,U=2**R-1,Z=Math.ceil(E.BITS/R),G=(0,e.bitMask)(R),$=V.map(a=>{const H=[];for(let l=0,u=a;l<U;l++)H.push(u),u=u.add(a);return H});return a=>{if(O(a,E),a.length>V.length)throw new Error("array of scalars must be smaller than array of points");let H=k;for(let l=0;l<Z;l++){if(H!==k)for(let p=0;p<R;p++)H=H.double();const u=BigInt(Z*R-(l+1)*R);for(let p=0;p<a.length;p++){const K=a[p],t=Number(K>>u&G);t&&(H=H.add($[p][t-1]))}}return H}}function C(B){return(0,r.validateField)(B.Fp),(0,e.validateObject)(B,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,r.nLength)(B.n,B.nBitLength),...B,p:B.Fp.ORDER})}function _(B,E,V){if(E){if(E.ORDER!==B)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,r.validateField)(E),E}else return(0,r.Field)(B,{isLE:V})}function h(B,E,V={},R){if(R===void 0&&(R=B==="edwards"),!E||typeof E!="object")throw new Error(`expected valid ${B} CURVE object`);for(const $ of["p","n","h"]){const a=E[$];if(!(typeof a=="bigint"&&a>f))throw new Error(`CURVE.${$} must be positive bigint`)}const k=_(E.p,V.Fp,R),U=_(E.n,V.Fn,R),G=["Gx","Gy","a",B==="weierstrass"?"b":"d"];for(const $ of G)if(!k.isValid(E[$]))throw new Error(`CURVE.${$} must be valid field element of CURVE.Fp`);return E=Object.freeze(Object.assign({},E)),{CURVE:E,Fp:k,Fn:U}}return Ke}var Ve={},es;function Ko(){if(es)return Ve;es=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.PrimeEdwardsPoint=void 0,Ve.edwards=m,Ve.eddsa=O,Ve.twistedEdwards=L;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ft(),f=Ue(),c=BigInt(0),s=BigInt(1),i=BigInt(2),n=BigInt(8);function o(y,g,A,q){const T=y.sqr(A),C=y.sqr(q),_=y.add(y.mul(g.a,T),C),h=y.add(y.ONE,y.mul(g.d,y.mul(T,C)));return y.eql(_,h)}function m(y,g={}){const A=(0,r._createCurveFields)("edwards",y,g,g.FpFnLE),{Fp:q,Fn:T}=A;let C=A.CURVE;const{h:_}=C;(0,e._validateObject)(g,{},{uvRatio:"function"});const h=i<<BigInt(T.BYTES*8)-s,B=$=>q.create($),E=g.uvRatio||(($,a)=>{try{return{isValid:!0,value:q.sqrt(q.div($,a))}}catch{return{isValid:!1,value:c}}});if(!o(q,C,C.Gx,C.Gy))throw new Error("bad curve params: generator point");function V($,a,H=!1){const l=H?s:c;return(0,e.aInRange)("coordinate "+$,a,l,h),a}function R($){if(!($ instanceof Z))throw new Error("ExtendedPoint expected")}const k=(0,e.memoized)(($,a)=>{const{X:H,Y:l,Z:u}=$,p=$.is0();a==null&&(a=p?n:q.inv(u));const K=B(H*a),t=B(l*a),v=q.mul(u,a);if(p)return{x:c,y:s};if(v!==s)throw new Error("invZ was invalid");return{x:K,y:t}}),U=(0,e.memoized)($=>{const{a,d:H}=C;if($.is0())throw new Error("bad point: ZERO");const{X:l,Y:u,Z:p,T:K}=$,t=B(l*l),v=B(u*u),S=B(p*p),x=B(S*S),D=B(t*a),J=B(S*B(D+v)),W=B(x+B(H*B(t*v)));if(J!==W)throw new Error("bad point: equation left != right (1)");const d=B(l*u),M=B(p*K);if(d!==M)throw new Error("bad point: equation left != right (2)");return!0});class Z{constructor(a,H,l,u){this.X=V("x",a),this.Y=V("y",H),this.Z=V("z",l,!0),this.T=V("t",u),Object.freeze(this)}static CURVE(){return C}static fromAffine(a){if(a instanceof Z)throw new Error("extended point not allowed");const{x:H,y:l}=a||{};return V("x",H),V("y",l),new Z(H,l,s,B(H*l))}static fromBytes(a,H=!1){const l=q.BYTES,{a:u,d:p}=C;a=(0,e.copyBytes)((0,e._abytes2)(a,l,"point")),(0,e._abool2)(H,"zip215");const K=(0,e.copyBytes)(a),t=a[l-1];K[l-1]=t&-129;const v=(0,e.bytesToNumberLE)(K),S=H?h:q.ORDER;(0,e.aInRange)("point.y",v,c,S);const x=B(v*v),D=B(x-s),J=B(p*x-u);let{isValid:W,value:d}=E(D,J);if(!W)throw new Error("bad point: invalid y coordinate");const M=(d&s)===s,z=(t&128)!==0;if(!H&&d===c&&z)throw new Error("bad point: x=0 and x_0=1");return z!==M&&(d=B(-d)),Z.fromAffine({x:d,y:v})}static fromHex(a,H=!1){return Z.fromBytes((0,e.ensureBytes)("point",a),H)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(a=8,H=!0){return G.createCache(this,a),H||this.multiply(i),this}assertValidity(){U(this)}equals(a){R(a);const{X:H,Y:l,Z:u}=this,{X:p,Y:K,Z:t}=a,v=B(H*t),S=B(p*u),x=B(l*t),D=B(K*u);return v===S&&x===D}is0(){return this.equals(Z.ZERO)}negate(){return new Z(B(-this.X),this.Y,this.Z,B(-this.T))}double(){const{a}=C,{X:H,Y:l,Z:u}=this,p=B(H*H),K=B(l*l),t=B(i*B(u*u)),v=B(a*p),S=H+l,x=B(B(S*S)-p-K),D=v+K,J=D-t,W=v-K,d=B(x*J),M=B(D*W),z=B(x*W),ee=B(J*D);return new Z(d,M,ee,z)}add(a){R(a);const{a:H,d:l}=C,{X:u,Y:p,Z:K,T:t}=this,{X:v,Y:S,Z:x,T:D}=a,J=B(u*v),W=B(p*S),d=B(t*l*D),M=B(K*x),z=B((u+p)*(v+S)-J-W),ee=M-d,P=M+d,b=B(W-H*J),X=B(z*ee),se=B(P*b),ue=B(z*b),he=B(ee*P);return new Z(X,se,he,ue)}subtract(a){return this.add(a.negate())}multiply(a){if(!T.isValidNot0(a))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:H,f:l}=G.cached(this,a,u=>(0,r.normalizeZ)(Z,u));return(0,r.normalizeZ)(Z,[H,l])[0]}multiplyUnsafe(a,H=Z.ZERO){if(!T.isValid(a))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return a===c?Z.ZERO:this.is0()||a===s?this:G.unsafe(this,a,l=>(0,r.normalizeZ)(Z,l),H)}isSmallOrder(){return this.multiplyUnsafe(_).is0()}isTorsionFree(){return G.unsafe(this,C.n).is0()}toAffine(a){return k(this,a)}clearCofactor(){return _===s?this:this.multiplyUnsafe(_)}toBytes(){const{x:a,y:H}=this.toAffine(),l=q.toBytes(H);return l[l.length-1]|=a&s?128:0,l}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(a){return(0,r.normalizeZ)(Z,a)}static msm(a,H){return(0,r.pippenger)(Z,T,a,H)}_setWindowSize(a){this.precompute(a)}toRawBytes(){return this.toBytes()}}Z.BASE=new Z(C.Gx,C.Gy,s,B(C.Gx*C.Gy)),Z.ZERO=new Z(c,s,s,c),Z.Fp=q,Z.Fn=T;const G=new r.wNAF(Z,T.BITS);return Z.BASE.precompute(8),Z}class w{constructor(g){this.ep=g}static fromBytes(g){(0,e.notImplemented)()}static fromHex(g){(0,e.notImplemented)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(g){return this.ep.toAffine(g)}toHex(){return(0,e.bytesToHex)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(g){return this.assertSame(g),this.init(this.ep.add(g.ep))}subtract(g){return this.assertSame(g),this.init(this.ep.subtract(g.ep))}multiply(g){return this.init(this.ep.multiply(g))}multiplyUnsafe(g){return this.init(this.ep.multiplyUnsafe(g))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(g,A){return this.init(this.ep.precompute(g,A))}toRawBytes(){return this.toBytes()}}Ve.PrimeEdwardsPoint=w;function O(y,g,A={}){if(typeof g!="function")throw new Error('"hash" function param is required');(0,e._validateObject)(A,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:q}=A,{BASE:T,Fp:C,Fn:_}=y,h=A.randomBytes||e.randomBytes,B=A.adjustScalarBytes||(S=>S),E=A.domain||((S,x,D)=>{if((0,e._abool2)(D,"phflag"),x.length||D)throw new Error("Contexts/pre-hash are not supported");return S});function V(S){return _.create((0,e.bytesToNumberLE)(S))}function R(S){const x=l.secretKey;S=(0,e.ensureBytes)("private key",S,x);const D=(0,e.ensureBytes)("hashed private key",g(S),2*x),J=B(D.slice(0,x)),W=D.slice(x,2*x),d=V(J);return{head:J,prefix:W,scalar:d}}function k(S){const{head:x,prefix:D,scalar:J}=R(S),W=T.multiply(J),d=W.toBytes();return{head:x,prefix:D,scalar:J,point:W,pointBytes:d}}function U(S){return k(S).pointBytes}function Z(S=Uint8Array.of(),...x){const D=(0,e.concatBytes)(...x);return V(g(E(D,(0,e.ensureBytes)("context",S),!!q)))}function G(S,x,D={}){S=(0,e.ensureBytes)("message",S),q&&(S=q(S));const{prefix:J,scalar:W,pointBytes:d}=k(x),M=Z(D.context,J,S),z=T.multiply(M).toBytes(),ee=Z(D.context,z,d,S),P=_.create(M+ee*W);if(!_.isValid(P))throw new Error("sign failed: invalid s");const b=(0,e.concatBytes)(z,_.toBytes(P));return(0,e._abytes2)(b,l.signature,"result")}const $={zip215:!0};function a(S,x,D,J=$){const{context:W,zip215:d}=J,M=l.signature;S=(0,e.ensureBytes)("signature",S,M),x=(0,e.ensureBytes)("message",x),D=(0,e.ensureBytes)("publicKey",D,l.publicKey),d!==void 0&&(0,e._abool2)(d,"zip215"),q&&(x=q(x));const z=M/2,ee=S.subarray(0,z),P=(0,e.bytesToNumberLE)(S.subarray(z,M));let b,X,se;try{b=y.fromBytes(D,d),X=y.fromBytes(ee,d),se=T.multiplyUnsafe(P)}catch{return!1}if(!d&&b.isSmallOrder())return!1;const ue=Z(W,X.toBytes(),b.toBytes(),x);return X.add(b.multiplyUnsafe(ue)).subtract(se).clearCofactor().is0()}const H=C.BYTES,l={secretKey:H,publicKey:H,signature:2*H,seed:H};function u(S=h(l.seed)){return(0,e._abytes2)(S,l.seed,"seed")}function p(S){const x=v.randomSecretKey(S);return{secretKey:x,publicKey:U(x)}}function K(S){return(0,e.isBytes)(S)&&S.length===_.BYTES}function t(S,x){try{return!!y.fromBytes(S,x)}catch{return!1}}const v={getExtendedPublicKey:k,randomSecretKey:u,isValidSecretKey:K,isValidPublicKey:t,toMontgomery(S){const{y:x}=y.fromBytes(S),D=l.publicKey,J=D===32;if(!J&&D!==57)throw new Error("only defined for 25519 and 448");const W=J?C.div(s+x,s-x):C.div(x-s,x+s);return C.toBytes(W)},toMontgomerySecret(S){const x=l.secretKey;(0,e._abytes2)(S,x);const D=g(S.subarray(0,x));return B(D).subarray(0,x)},randomPrivateKey:u,precompute(S=8,x=y.BASE){return x.precompute(S,!1)}};return Object.freeze({keygen:p,getPublicKey:U,sign:G,verify:a,utils:v,Point:y,lengths:l})}function N(y){const g={a:y.a,d:y.d,p:y.Fp.ORDER,n:y.n,h:y.h,Gx:y.Gx,Gy:y.Gy},A=y.Fp,q=(0,f.Field)(g.n,y.nBitLength,!0),T={Fp:A,Fn:q,uvRatio:y.uvRatio},C={randomBytes:y.randomBytes,adjustScalarBytes:y.adjustScalarBytes,domain:y.domain,prehash:y.prehash,mapToCurve:y.mapToCurve};return{CURVE:g,curveOpts:T,hash:y.hash,eddsaOpts:C}}function F(y,g){const A=g.Point;return Object.assign({},g,{ExtendedPoint:A,CURVE:y,nBitLength:A.Fn.BITS,nByteLength:A.Fn.BYTES})}function L(y){const{CURVE:g,curveOpts:A,hash:q,eddsaOpts:T}=N(y),C=m(g,A),_=O(C,q,T);return F(y,_)}return Ve}var kt={},ts;function ns(){return ts||(ts=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=m,e.expand_message_xof=w,e.hash_to_field=O,e.isogenyMap=N,e.createHasher=F;const r=ke(),f=Ue(),c=r.bytesToNumberBE;function s(L,y){if(n(L),n(y),L<0||L>=1<<8*y)throw new Error("invalid I2OSP input: "+L);const g=Array.from({length:y}).fill(0);for(let A=y-1;A>=0;A--)g[A]=L&255,L>>>=8;return new Uint8Array(g)}function i(L,y){const g=new Uint8Array(L.length);for(let A=0;A<L.length;A++)g[A]=L[A]^y[A];return g}function n(L){if(!Number.isSafeInteger(L))throw new Error("number expected")}function o(L){if(!(0,r.isBytes)(L)&&typeof L!="string")throw new Error("DST must be Uint8Array or string");return typeof L=="string"?(0,r.utf8ToBytes)(L):L}function m(L,y,g,A){(0,r.abytes)(L),n(g),y=o(y),y.length>255&&(y=A((0,r.concatBytes)((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-"),y)));const{outputLen:q,blockLen:T}=A,C=Math.ceil(g/q);if(g>65535||C>255)throw new Error("expand_message_xmd: invalid lenInBytes");const _=(0,r.concatBytes)(y,s(y.length,1)),h=s(0,T),B=s(g,2),E=new Array(C),V=A((0,r.concatBytes)(h,L,B,s(0,1),_));E[0]=A((0,r.concatBytes)(V,s(1,1),_));for(let k=1;k<=C;k++){const U=[i(V,E[k-1]),s(k+1,1),_];E[k]=A((0,r.concatBytes)(...U))}return(0,r.concatBytes)(...E).slice(0,g)}function w(L,y,g,A,q){if((0,r.abytes)(L),n(g),y=o(y),y.length>255){const T=Math.ceil(2*A/8);y=q.create({dkLen:T}).update((0,r.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(y).digest()}if(g>65535||y.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return q.create({dkLen:g}).update(L).update(s(g,2)).update(y).update(s(y.length,1)).digest()}function O(L,y,g){(0,r._validateObject)(g,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:A,k:q,m:T,hash:C,expand:_,DST:h}=g;if(!(0,r.isHash)(g.hash))throw new Error("expected valid hash");(0,r.abytes)(L),n(y);const B=A.toString(2).length,E=Math.ceil((B+q)/8),V=y*T*E;let R;if(_==="xmd")R=m(L,h,V,C);else if(_==="xof")R=w(L,h,V,q,C);else if(_==="_internal_pass")R=L;else throw new Error('expand must be "xmd" or "xof"');const k=new Array(y);for(let U=0;U<y;U++){const Z=new Array(T);for(let G=0;G<T;G++){const $=E*(G+U*T),a=R.subarray($,$+E);Z[G]=(0,f.mod)(c(a),A)}k[U]=Z}return k}function N(L,y){const g=y.map(A=>Array.from(A).reverse());return(A,q)=>{const[T,C,_,h]=g.map(V=>V.reduce((R,k)=>L.add(L.mul(R,A),k))),[B,E]=(0,f.FpInvertBatch)(L,[C,h],!0);return A=L.mul(T,B),q=L.mul(q,L.mul(_,E)),{x:A,y:q}}}e._DST_scalar=(0,r.utf8ToBytes)("HashToScalar-");function F(L,y,g){if(typeof y!="function")throw new Error("mapToCurve() must be defined");function A(T){return L.fromAffine(y(T))}function q(T){const C=T.clearCofactor();return C.equals(L.ZERO)?L.ZERO:(C.assertValidity(),C)}return{defaults:g,hashToCurve(T,C){const _=Object.assign({},g,C),h=O(T,2,_),B=A(h[0]),E=A(h[1]);return q(B.add(E))},encodeToCurve(T,C){const _=g.encodeDST?{DST:g.encodeDST}:{},h=Object.assign({},g,_,C),B=O(T,1,h),E=A(B[0]);return q(E)},mapToCurve(T){if(!Array.isArray(T))throw new Error("expected array of bigints");for(const C of T)if(typeof C!="bigint")throw new Error("expected array of bigints");return q(A(T))},hashToScalar(T,C){const _=L.Fn.ORDER,h=Object.assign({},g,{p:_,m:1,DST:e._DST_scalar},C);return O(T,1,h)[0][0]}}}})(kt)),kt}var at={},rs;function Co(){if(rs)return at;rs=1,Object.defineProperty(at,"__esModule",{value:!0}),at.montgomery=n;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=ke(),r=Ue(),f=BigInt(0),c=BigInt(1),s=BigInt(2);function i(o){return(0,e._validateObject)(o,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...o})}function n(o){const m=i(o),{P:w,type:O,adjustScalarBytes:N,powPminus2:F,randomBytes:L}=m,y=O==="x25519";if(!y&&O!=="x448")throw new Error("invalid type");const g=L||e.randomBytes,A=y?255:448,q=y?32:56,T=BigInt(y?9:5),C=BigInt(y?121665:39081),_=y?s**BigInt(254):s**BigInt(447),h=y?BigInt(8)*s**BigInt(251)-c:BigInt(4)*s**BigInt(445)-c,B=_+h+c,E=K=>(0,r.mod)(K,w),V=R(T);function R(K){return(0,e.numberToBytesLE)(E(K),q)}function k(K){const t=(0,e.ensureBytes)("u coordinate",K,q);return y&&(t[31]&=127),E((0,e.bytesToNumberLE)(t))}function U(K){return(0,e.bytesToNumberLE)(N((0,e.ensureBytes)("scalar",K,q)))}function Z(K,t){const v=a(k(t),U(K));if(v===f)throw new Error("invalid private or public key received");return R(v)}function G(K){return Z(K,V)}function $(K,t,v){const S=E(K*(t-v));return t=E(t-S),v=E(v+S),{x_2:t,x_3:v}}function a(K,t){(0,e.aInRange)("u",K,f,w),(0,e.aInRange)("scalar",t,_,B);const v=t,S=K;let x=c,D=f,J=K,W=c,d=f;for(let z=BigInt(A-1);z>=f;z--){const ee=v>>z&c;d^=ee,{x_2:x,x_3:J}=$(d,x,J),{x_2:D,x_3:W}=$(d,D,W),d=ee;const P=x+D,b=E(P*P),X=x-D,se=E(X*X),ue=b-se,he=J+W,pe=J-W,ge=E(pe*P),ye=E(he*X),Se=ge+ye,_e=ge-ye;J=E(Se*Se),W=E(S*E(_e*_e)),x=E(b*se),D=E(ue*(b+E(C*ue)))}({x_2:x,x_3:J}=$(d,x,J)),{x_2:D,x_3:W}=$(d,D,W);const M=F(D);return E(x*M)}const H={secretKey:q,publicKey:q,seed:q},l=(K=g(q))=>((0,e.abytes)(K,H.seed),K);function u(K){const t=l(K);return{secretKey:t,publicKey:G(t)}}return{keygen:u,getSharedSecret:(K,t)=>Z(K,t),getPublicKey:K=>G(K),scalarMult:Z,scalarMultBase:G,utils:{randomSecretKey:l,randomPrivateKey:l},GuBytes:V.slice(),lengths:H}}return at}var ss;function Ho(){return ss||(ss=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.encodeToCurve=e.hashToCurve=e.RistrettoPoint=e.edwardsToMontgomery=e.ED25519_TORSION_SUBGROUP=e.ristretto255_hasher=e.ristretto255=e.ed25519_hasher=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=void 0,e.edwardsToMontgomeryPub=J,e.edwardsToMontgomeryPriv=W;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=qt(),f=qe(),c=Ft(),s=Ko(),i=ns(),n=Ue(),o=Co(),m=ke(),w=BigInt(0),O=BigInt(1),N=BigInt(2),F=BigInt(3),L=BigInt(5),y=BigInt(8),g=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),A={p:g,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:y,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function q(d){const M=BigInt(10),z=BigInt(20),ee=BigInt(40),P=BigInt(80),b=g,se=d*d%b*d%b,ue=(0,n.pow2)(se,N,b)*se%b,he=(0,n.pow2)(ue,O,b)*d%b,pe=(0,n.pow2)(he,L,b)*he%b,ge=(0,n.pow2)(pe,M,b)*pe%b,ye=(0,n.pow2)(ge,z,b)*ge%b,Se=(0,n.pow2)(ye,ee,b)*ye%b,_e=(0,n.pow2)(Se,P,b)*Se%b,ae=(0,n.pow2)(_e,P,b)*Se%b,ne=(0,n.pow2)(ae,M,b)*pe%b;return{pow_p_5_8:(0,n.pow2)(ne,N,b)*d%b,b2:se}}function T(d){return d[0]&=248,d[31]&=127,d[31]|=64,d}const C=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function _(d,M){const z=g,ee=(0,n.mod)(M*M*M,z),P=(0,n.mod)(ee*ee*M,z),b=q(d*P).pow_p_5_8;let X=(0,n.mod)(d*ee*b,z);const se=(0,n.mod)(M*X*X,z),ue=X,he=(0,n.mod)(X*C,z),pe=se===d,ge=se===(0,n.mod)(-d,z),ye=se===(0,n.mod)(-d*C,z);return pe&&(X=ue),(ge||ye)&&(X=he),(0,n.isNegativeLE)(X,z)&&(X=(0,n.mod)(-X,z)),{isValid:pe||ge,value:X}}const h=(0,n.Field)(A.p,{isLE:!0}),B=(0,n.Field)(A.n,{isLE:!0}),E={...A,Fp:h,hash:r.sha512,adjustScalarBytes:T,uvRatio:_};e.ed25519=(0,s.twistedEdwards)(E);function V(d,M,z){if(M.length>255)throw new Error("Context is too big");return(0,f.concatBytes)((0,f.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([z?1:0,M.length]),M,d)}e.ed25519ctx=(0,s.twistedEdwards)({...E,domain:V}),e.ed25519ph=(0,s.twistedEdwards)(Object.assign({},E,{domain:V,prehash:r.sha512})),e.x25519=(()=>{const d=h.ORDER;return(0,o.montgomery)({P:d,type:"x25519",powPminus2:M=>{const{pow_p_5_8:z,b2:ee}=q(M);return(0,n.mod)((0,n.pow2)(z,F,d)*ee,d)},adjustScalarBytes:T})})();const R=(g+F)/y,k=h.pow(N,R),U=h.sqrt(h.neg(h.ONE));function Z(d){const M=(g-L)/y,z=BigInt(486662);let ee=h.sqr(d);ee=h.mul(ee,N);let P=h.add(ee,h.ONE),b=h.neg(z),X=h.sqr(P),se=h.mul(X,P),ue=h.mul(ee,z);ue=h.mul(ue,b),ue=h.add(ue,X),ue=h.mul(ue,b);let he=h.sqr(se);X=h.sqr(he),he=h.mul(he,se),he=h.mul(he,ue),X=h.mul(X,he);let pe=h.pow(X,M);pe=h.mul(pe,he);let ge=h.mul(pe,U);X=h.sqr(pe),X=h.mul(X,se);let ye=h.eql(X,ue),Se=h.cmov(ge,pe,ye),_e=h.mul(b,ee),ae=h.mul(pe,d);ae=h.mul(ae,k);let ne=h.mul(ae,U),te=h.mul(ue,ee);X=h.sqr(ae),X=h.mul(X,se);let j=h.eql(X,te),ie=h.cmov(ne,ae,j);X=h.sqr(Se),X=h.mul(X,se);let Q=h.eql(X,ue),ce=h.cmov(_e,b,Q),le=h.cmov(ie,Se,Q),de=h.isOdd(le);return le=h.cmov(le,h.neg(le),Q!==de),{xMn:ce,xMd:P,yMn:le,yMd:O}}const G=(0,n.FpSqrtEven)(h,h.neg(BigInt(486664)));function $(d){const{xMn:M,xMd:z,yMn:ee,yMd:P}=Z(d);let b=h.mul(M,P);b=h.mul(b,G);let X=h.mul(z,ee),se=h.sub(M,z),ue=h.add(M,z),he=h.mul(X,ue),pe=h.eql(he,h.ZERO);b=h.cmov(b,h.ZERO,pe),X=h.cmov(X,h.ONE,pe),se=h.cmov(se,h.ONE,pe),ue=h.cmov(ue,h.ONE,pe);const[ge,ye]=(0,n.FpInvertBatch)(h,[X,ue],!0);return{x:h.mul(b,ge),y:h.mul(se,ye)}}e.ed25519_hasher=(0,i.createHasher)(e.ed25519.Point,d=>$(d[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:g,m:1,k:128,expand:"xmd",hash:r.sha512});const a=C,H=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),l=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),u=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),p=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),K=d=>_(O,d),t=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),v=d=>e.ed25519.Point.Fp.create((0,m.bytesToNumberLE)(d)&t);function S(d){const{d:M}=A,z=g,ee=te=>h.create(te),P=ee(a*d*d),b=ee((P+O)*u);let X=BigInt(-1);const se=ee((X-M*P)*ee(P+M));let{isValid:ue,value:he}=_(b,se),pe=ee(he*d);(0,n.isNegativeLE)(pe,z)||(pe=ee(-pe)),ue||(he=pe),ue||(X=P);const ge=ee(X*(P-O)*p-se),ye=he*he,Se=ee((he+he)*se),_e=ee(ge*H),ae=ee(O-ye),ne=ee(O+ye);return new e.ed25519.Point(ee(Se*ne),ee(ae*_e),ee(_e*ne),ee(Se*ae))}function x(d){(0,f.abytes)(d,64);const M=v(d.subarray(0,32)),z=S(M),ee=v(d.subarray(32,64)),P=S(ee);return new D(z.add(P))}class D extends s.PrimeEdwardsPoint{constructor(M){super(M)}static fromAffine(M){return new D(e.ed25519.Point.fromAffine(M))}assertSame(M){if(!(M instanceof D))throw new Error("RistrettoPoint expected")}init(M){return new D(M)}static hashToCurve(M){return x((0,m.ensureBytes)("ristrettoHash",M,64))}static fromBytes(M){(0,f.abytes)(M,32);const{a:z,d:ee}=A,P=g,b=Q=>h.create(Q),X=v(M);if(!(0,m.equalBytes)(h.toBytes(X),M)||(0,n.isNegativeLE)(X,P))throw new Error("invalid ristretto255 encoding 1");const se=b(X*X),ue=b(O+z*se),he=b(O-z*se),pe=b(ue*ue),ge=b(he*he),ye=b(z*ee*pe-ge),{isValid:Se,value:_e}=K(b(ye*ge)),ae=b(_e*he),ne=b(_e*ae*ye);let te=b((X+X)*ae);(0,n.isNegativeLE)(te,P)&&(te=b(-te));const j=b(ue*ne),ie=b(te*j);if(!Se||(0,n.isNegativeLE)(ie,P)||j===w)throw new Error("invalid ristretto255 encoding 2");return new D(new e.ed25519.Point(te,j,O,ie))}static fromHex(M){return D.fromBytes((0,m.ensureBytes)("ristrettoHex",M,32))}static msm(M,z){return(0,c.pippenger)(D,e.ed25519.Point.Fn,M,z)}toBytes(){let{X:M,Y:z,Z:ee,T:P}=this.ep;const b=g,X=ne=>h.create(ne),se=X(X(ee+z)*X(ee-z)),ue=X(M*z),he=X(ue*ue),{value:pe}=K(X(se*he)),ge=X(pe*se),ye=X(pe*ue),Se=X(ge*ye*P);let _e;if((0,n.isNegativeLE)(P*Se,b)){let ne=X(z*a),te=X(M*a);M=ne,z=te,_e=X(ge*l)}else _e=ye;(0,n.isNegativeLE)(M*Se,b)&&(z=X(-z));let ae=X((ee-z)*_e);return(0,n.isNegativeLE)(ae,b)&&(ae=X(-ae)),h.toBytes(ae)}equals(M){this.assertSame(M);const{X:z,Y:ee}=this.ep,{X:P,Y:b}=M.ep,X=he=>h.create(he),se=X(z*b)===X(ee*P),ue=X(ee*b)===X(z*P);return se||ue}is0(){return this.equals(D.ZERO)}}D.BASE=new D(e.ed25519.Point.BASE),D.ZERO=new D(e.ed25519.Point.ZERO),D.Fp=h,D.Fn=B,e.ristretto255={Point:D},e.ristretto255_hasher={hashToCurve(d,M){const z=M?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_",ee=(0,i.expand_message_xmd)(d,z,64,r.sha512);return x(ee)},hashToScalar(d,M={DST:i._DST_scalar}){const z=(0,i.expand_message_xmd)(d,M.DST,64,r.sha512);return B.create((0,m.bytesToNumberLE)(z))}},e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function J(d){return e.ed25519.utils.toMontgomery((0,m.ensureBytes)("pub",d))}e.edwardsToMontgomery=J;function W(d){return e.ed25519.utils.toMontgomerySecret((0,m.ensureBytes)("pub",d))}e.RistrettoPoint=D,e.hashToCurve=e.ed25519_hasher.hashToCurve,e.encodeToCurve=e.ed25519_hasher.encodeToCurve,e.hashToRistretto255=e.ristretto255_hasher.hashToCurve,e.hash_to_ristretto255=e.ristretto255_hasher.hashToCurve})(Nt)),Nt}var Vt={},Je={},jt={},Mt={},is;function os(){return is||(is=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const r=qe();class f extends r.Hash{constructor(i,n){super(),this.finished=!1,this.destroyed=!1,(0,r.ahash)(i);const o=(0,r.toBytes)(n);if(this.iHash=i.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const m=this.blockLen,w=new Uint8Array(m);w.set(o.length>m?i.create().update(o).digest():o);for(let O=0;O<w.length;O++)w[O]^=54;this.iHash.update(w),this.oHash=i.create();for(let O=0;O<w.length;O++)w[O]^=106;this.oHash.update(w),(0,r.clean)(w)}update(i){return(0,r.aexists)(this),this.iHash.update(i),this}digestInto(i){(0,r.aexists)(this),(0,r.abytes)(i,this.outputLen),this.finished=!0,this.iHash.digestInto(i),this.oHash.update(i),this.oHash.digestInto(i),this.destroy()}digest(){const i=new Uint8Array(this.oHash.outputLen);return this.digestInto(i),i}_cloneInto(i){i||(i=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:o,finished:m,destroyed:w,blockLen:O,outputLen:N}=this;return i=i,i.finished=m,i.destroyed=w,i.blockLen=O,i.outputLen=N,i.oHash=n._cloneInto(i.oHash),i.iHash=o._cloneInto(i.iHash),i}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=f;const c=(s,i,n)=>new f(s,i).update(n).digest();e.hmac=c,e.hmac.create=(s,i)=>new f(s,i)})(Mt)),Mt}var cs;function as(){return cs||(cs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=o,e._normFnElement=A,e.weierstrassN=q,e.SWUFpSqrtRatio=C,e.mapToCurveSimpleSWU=_,e.ecdh=B,e.ecdsa=E,e.weierstrassPoints=V,e._legacyHelperEquat=U,e.weierstrass=$;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=os(),f=qe(),c=ke(),s=Ft(),i=Ue(),n=(a,H)=>(a+(a>=0?H:-H)/L)/H;function o(a,H,l){const[[u,p],[K,t]]=H,v=n(t*a,l),S=n(-p*a,l);let x=a-v*u-S*K,D=-v*p-S*t;const J=x<N,W=D<N;J&&(x=-x),W&&(D=-D);const d=(0,c.bitMask)(Math.ceil((0,c.bitLen)(l)/2))+F;if(x<N||x>=d||D<N||D>=d)throw new Error("splitScalar (endomorphism): failed, k="+a);return{k1neg:J,k1:x,k2neg:W,k2:D}}function m(a){if(!["compact","recovered","der"].includes(a))throw new Error('Signature format must be "compact", "recovered", or "der"');return a}function w(a,H){const l={};for(let u of Object.keys(H))l[u]=a[u]===void 0?H[u]:a[u];return(0,c._abool2)(l.lowS,"lowS"),(0,c._abool2)(l.prehash,"prehash"),l.format!==void 0&&m(l.format),l}class O extends Error{constructor(H=""){super(H)}}e.DERErr=O,e.DER={Err:O,_tlv:{encode:(a,H)=>{const{Err:l}=e.DER;if(a<0||a>256)throw new l("tlv.encode: wrong tag");if(H.length&1)throw new l("tlv.encode: unpadded data");const u=H.length/2,p=(0,c.numberToHexUnpadded)(u);if(p.length/2&128)throw new l("tlv.encode: long form length too big");const K=u>127?(0,c.numberToHexUnpadded)(p.length/2|128):"";return(0,c.numberToHexUnpadded)(a)+K+p+H},decode(a,H){const{Err:l}=e.DER;let u=0;if(a<0||a>256)throw new l("tlv.encode: wrong tag");if(H.length<2||H[u++]!==a)throw new l("tlv.decode: wrong tlv");const p=H[u++],K=!!(p&128);let t=0;if(!K)t=p;else{const S=p&127;if(!S)throw new l("tlv.decode(long): indefinite length not supported");if(S>4)throw new l("tlv.decode(long): byte length is too big");const x=H.subarray(u,u+S);if(x.length!==S)throw new l("tlv.decode: length bytes not complete");if(x[0]===0)throw new l("tlv.decode(long): zero leftmost byte");for(const D of x)t=t<<8|D;if(u+=S,t<128)throw new l("tlv.decode(long): not minimal encoding")}const v=H.subarray(u,u+t);if(v.length!==t)throw new l("tlv.decode: wrong value length");return{v,l:H.subarray(u+t)}}},_int:{encode(a){const{Err:H}=e.DER;if(a<N)throw new H("integer: negative integers are not allowed");let l=(0,c.numberToHexUnpadded)(a);if(Number.parseInt(l[0],16)&8&&(l="00"+l),l.length&1)throw new H("unexpected DER parsing assertion: unpadded hex");return l},decode(a){const{Err:H}=e.DER;if(a[0]&128)throw new H("invalid signature integer: negative");if(a[0]===0&&!(a[1]&128))throw new H("invalid signature integer: unnecessary leading zero");return(0,c.bytesToNumberBE)(a)}},toSig(a){const{Err:H,_int:l,_tlv:u}=e.DER,p=(0,c.ensureBytes)("signature",a),{v:K,l:t}=u.decode(48,p);if(t.length)throw new H("invalid signature: left bytes after parsing");const{v,l:S}=u.decode(2,K),{v:x,l:D}=u.decode(2,S);if(D.length)throw new H("invalid signature: left bytes after parsing");return{r:l.decode(v),s:l.decode(x)}},hexFromSig(a){const{_tlv:H,_int:l}=e.DER,u=H.encode(2,l.encode(a.r)),p=H.encode(2,l.encode(a.s)),K=u+p;return H.encode(48,K)}};const N=BigInt(0),F=BigInt(1),L=BigInt(2),y=BigInt(3),g=BigInt(4);function A(a,H){const{BYTES:l}=a;let u;if(typeof H=="bigint")u=H;else{let p=(0,c.ensureBytes)("private key",H);try{u=a.fromBytes(p)}catch{throw new Error(`invalid private key: expected ui8a of size ${l}, got ${typeof H}`)}}if(!a.isValidNot0(u))throw new Error("invalid private key: out of range [1..N-1]");return u}function q(a,H={}){const l=(0,s._createCurveFields)("weierstrass",a,H),{Fp:u,Fn:p}=l;let K=l.CURVE;const{h:t,n:v}=K;(0,c._validateObject)(H,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:S}=H;if(S&&(!u.is0(K.a)||typeof S.beta!="bigint"||!Array.isArray(S.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const x=h(u,p);function D(){if(!u.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function J(ae,ne,te){const{x:j,y:ie}=ne.toAffine(),Q=u.toBytes(j);if((0,c._abool2)(te,"isCompressed"),te){D();const ce=!u.isOdd(ie);return(0,c.concatBytes)(T(ce),Q)}else return(0,c.concatBytes)(Uint8Array.of(4),Q,u.toBytes(ie))}function W(ae){(0,c._abytes2)(ae,void 0,"Point");const{publicKey:ne,publicKeyUncompressed:te}=x,j=ae.length,ie=ae[0],Q=ae.subarray(1);if(j===ne&&(ie===2||ie===3)){const ce=u.fromBytes(Q);if(!u.isValid(ce))throw new Error("bad point: is not on curve, wrong x");const le=z(ce);let de;try{de=u.sqrt(le)}catch(re){const oe=re instanceof Error?": "+re.message:"";throw new Error("bad point: is not on curve, sqrt error"+oe)}D();const I=u.isOdd(de);return(ie&1)===1!==I&&(de=u.neg(de)),{x:ce,y:de}}else if(j===te&&ie===4){const ce=u.BYTES,le=u.fromBytes(Q.subarray(0,ce)),de=u.fromBytes(Q.subarray(ce,ce*2));if(!ee(le,de))throw new Error("bad point: is not on curve");return{x:le,y:de}}else throw new Error(`bad point: got length ${j}, expected compressed=${ne} or uncompressed=${te}`)}const d=H.toBytes||J,M=H.fromBytes||W;function z(ae){const ne=u.sqr(ae),te=u.mul(ne,ae);return u.add(u.add(te,u.mul(ae,K.a)),K.b)}function ee(ae,ne){const te=u.sqr(ne),j=z(ae);return u.eql(te,j)}if(!ee(K.Gx,K.Gy))throw new Error("bad curve params: generator point");const P=u.mul(u.pow(K.a,y),g),b=u.mul(u.sqr(K.b),BigInt(27));if(u.is0(u.add(P,b)))throw new Error("bad curve params: a or b");function X(ae,ne,te=!1){if(!u.isValid(ne)||te&&u.is0(ne))throw new Error(`bad point coordinate ${ae}`);return ne}function se(ae){if(!(ae instanceof ye))throw new Error("ProjectivePoint expected")}function ue(ae){if(!S||!S.basises)throw new Error("no endo");return o(ae,S.basises,p.ORDER)}const he=(0,c.memoized)((ae,ne)=>{const{X:te,Y:j,Z:ie}=ae;if(u.eql(ie,u.ONE))return{x:te,y:j};const Q=ae.is0();ne==null&&(ne=Q?u.ONE:u.inv(ie));const ce=u.mul(te,ne),le=u.mul(j,ne),de=u.mul(ie,ne);if(Q)return{x:u.ZERO,y:u.ZERO};if(!u.eql(de,u.ONE))throw new Error("invZ was invalid");return{x:ce,y:le}}),pe=(0,c.memoized)(ae=>{if(ae.is0()){if(H.allowInfinityPoint&&!u.is0(ae.Y))return;throw new Error("bad point: ZERO")}const{x:ne,y:te}=ae.toAffine();if(!u.isValid(ne)||!u.isValid(te))throw new Error("bad point: x or y not field elements");if(!ee(ne,te))throw new Error("bad point: equation left != right");if(!ae.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function ge(ae,ne,te,j,ie){return te=new ye(u.mul(te.X,ae),te.Y,te.Z),ne=(0,s.negateCt)(j,ne),te=(0,s.negateCt)(ie,te),ne.add(te)}class ye{constructor(ne,te,j){this.X=X("x",ne),this.Y=X("y",te,!0),this.Z=X("z",j),Object.freeze(this)}static CURVE(){return K}static fromAffine(ne){const{x:te,y:j}=ne||{};if(!ne||!u.isValid(te)||!u.isValid(j))throw new Error("invalid affine point");if(ne instanceof ye)throw new Error("projective point not allowed");return u.is0(te)&&u.is0(j)?ye.ZERO:new ye(te,j,u.ONE)}static fromBytes(ne){const te=ye.fromAffine(M((0,c._abytes2)(ne,void 0,"point")));return te.assertValidity(),te}static fromHex(ne){return ye.fromBytes((0,c.ensureBytes)("pointHex",ne))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(ne=8,te=!0){return _e.createCache(this,ne),te||this.multiply(y),this}assertValidity(){pe(this)}hasEvenY(){const{y:ne}=this.toAffine();if(!u.isOdd)throw new Error("Field doesn't support isOdd");return!u.isOdd(ne)}equals(ne){se(ne);const{X:te,Y:j,Z:ie}=this,{X:Q,Y:ce,Z:le}=ne,de=u.eql(u.mul(te,le),u.mul(Q,ie)),I=u.eql(u.mul(j,le),u.mul(ce,ie));return de&&I}negate(){return new ye(this.X,u.neg(this.Y),this.Z)}double(){const{a:ne,b:te}=K,j=u.mul(te,y),{X:ie,Y:Q,Z:ce}=this;let le=u.ZERO,de=u.ZERO,I=u.ZERO,Y=u.mul(ie,ie),re=u.mul(Q,Q),oe=u.mul(ce,ce),fe=u.mul(ie,Q);return fe=u.add(fe,fe),I=u.mul(ie,ce),I=u.add(I,I),le=u.mul(ne,I),de=u.mul(j,oe),de=u.add(le,de),le=u.sub(re,de),de=u.add(re,de),de=u.mul(le,de),le=u.mul(fe,le),I=u.mul(j,I),oe=u.mul(ne,oe),fe=u.sub(Y,oe),fe=u.mul(ne,fe),fe=u.add(fe,I),I=u.add(Y,Y),Y=u.add(I,Y),Y=u.add(Y,oe),Y=u.mul(Y,fe),de=u.add(de,Y),oe=u.mul(Q,ce),oe=u.add(oe,oe),Y=u.mul(oe,fe),le=u.sub(le,Y),I=u.mul(oe,re),I=u.add(I,I),I=u.add(I,I),new ye(le,de,I)}add(ne){se(ne);const{X:te,Y:j,Z:ie}=this,{X:Q,Y:ce,Z:le}=ne;let de=u.ZERO,I=u.ZERO,Y=u.ZERO;const re=K.a,oe=u.mul(K.b,y);let fe=u.mul(te,Q),ve=u.mul(j,ce),be=u.mul(ie,le),Ee=u.add(te,j),we=u.add(Q,ce);Ee=u.mul(Ee,we),we=u.add(fe,ve),Ee=u.sub(Ee,we),we=u.add(te,ie);let Be=u.add(Q,le);return we=u.mul(we,Be),Be=u.add(fe,be),we=u.sub(we,Be),Be=u.add(j,ie),de=u.add(ce,le),Be=u.mul(Be,de),de=u.add(ve,be),Be=u.sub(Be,de),Y=u.mul(re,we),de=u.mul(oe,be),Y=u.add(de,Y),de=u.sub(ve,Y),Y=u.add(ve,Y),I=u.mul(de,Y),ve=u.add(fe,fe),ve=u.add(ve,fe),be=u.mul(re,be),we=u.mul(oe,we),ve=u.add(ve,be),be=u.sub(fe,be),be=u.mul(re,be),we=u.add(we,be),fe=u.mul(ve,we),I=u.add(I,fe),fe=u.mul(Be,we),de=u.mul(Ee,de),de=u.sub(de,fe),fe=u.mul(Ee,ve),Y=u.mul(Be,Y),Y=u.add(Y,fe),new ye(de,I,Y)}subtract(ne){return this.add(ne.negate())}is0(){return this.equals(ye.ZERO)}multiply(ne){const{endo:te}=H;if(!p.isValidNot0(ne))throw new Error("invalid scalar: out of range");let j,ie;const Q=ce=>_e.cached(this,ce,le=>(0,s.normalizeZ)(ye,le));if(te){const{k1neg:ce,k1:le,k2neg:de,k2:I}=ue(ne),{p:Y,f:re}=Q(le),{p:oe,f:fe}=Q(I);ie=re.add(fe),j=ge(te.beta,Y,oe,ce,de)}else{const{p:ce,f:le}=Q(ne);j=ce,ie=le}return(0,s.normalizeZ)(ye,[j,ie])[0]}multiplyUnsafe(ne){const{endo:te}=H,j=this;if(!p.isValid(ne))throw new Error("invalid scalar: out of range");if(ne===N||j.is0())return ye.ZERO;if(ne===F)return j;if(_e.hasCache(this))return this.multiply(ne);if(te){const{k1neg:ie,k1:Q,k2neg:ce,k2:le}=ue(ne),{p1:de,p2:I}=(0,s.mulEndoUnsafe)(ye,j,Q,le);return ge(te.beta,de,I,ie,ce)}else return _e.unsafe(j,ne)}multiplyAndAddUnsafe(ne,te,j){const ie=this.multiplyUnsafe(te).add(ne.multiplyUnsafe(j));return ie.is0()?void 0:ie}toAffine(ne){return he(this,ne)}isTorsionFree(){const{isTorsionFree:ne}=H;return t===F?!0:ne?ne(ye,this):_e.unsafe(this,v).is0()}clearCofactor(){const{clearCofactor:ne}=H;return t===F?this:ne?ne(ye,this):this.multiplyUnsafe(t)}isSmallOrder(){return this.multiplyUnsafe(t).is0()}toBytes(ne=!0){return(0,c._abool2)(ne,"isCompressed"),this.assertValidity(),d(ye,this,ne)}toHex(ne=!0){return(0,c.bytesToHex)(this.toBytes(ne))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(ne=!0){return this.toBytes(ne)}_setWindowSize(ne){this.precompute(ne)}static normalizeZ(ne){return(0,s.normalizeZ)(ye,ne)}static msm(ne,te){return(0,s.pippenger)(ye,p,ne,te)}static fromPrivateKey(ne){return ye.BASE.multiply(A(p,ne))}}ye.BASE=new ye(K.Gx,K.Gy,u.ONE),ye.ZERO=new ye(u.ZERO,u.ONE,u.ZERO),ye.Fp=u,ye.Fn=p;const Se=p.BITS,_e=new s.wNAF(ye,H.endo?Math.ceil(Se/2):Se);return ye.BASE.precompute(8),ye}function T(a){return Uint8Array.of(a?2:3)}function C(a,H){const l=a.ORDER;let u=N;for(let M=l-F;M%L===N;M/=L)u+=F;const p=u,K=L<<p-F-F,t=K*L,v=(l-F)/t,S=(v-F)/L,x=t-F,D=K,J=a.pow(H,v),W=a.pow(H,(v+F)/L);let d=(M,z)=>{let ee=J,P=a.pow(z,x),b=a.sqr(P);b=a.mul(b,z);let X=a.mul(M,b);X=a.pow(X,S),X=a.mul(X,P),P=a.mul(X,z),b=a.mul(X,M);let se=a.mul(b,P);X=a.pow(se,D);let ue=a.eql(X,a.ONE);P=a.mul(b,W),X=a.mul(se,ee),b=a.cmov(P,b,ue),se=a.cmov(X,se,ue);for(let he=p;he>F;he--){let pe=he-L;pe=L<<pe-F;let ge=a.pow(se,pe);const ye=a.eql(ge,a.ONE);P=a.mul(b,ee),ee=a.mul(ee,ee),ge=a.mul(se,ee),b=a.cmov(P,b,ye),se=a.cmov(ge,se,ye)}return{isValid:ue,value:b}};if(a.ORDER%g===y){const M=(a.ORDER-y)/g,z=a.sqrt(a.neg(H));d=(ee,P)=>{let b=a.sqr(P);const X=a.mul(ee,P);b=a.mul(b,X);let se=a.pow(b,M);se=a.mul(se,X);const ue=a.mul(se,z),he=a.mul(a.sqr(se),P),pe=a.eql(he,ee);let ge=a.cmov(ue,se,pe);return{isValid:pe,value:ge}}}return d}function _(a,H){(0,i.validateField)(a);const{A:l,B:u,Z:p}=H;if(!a.isValid(l)||!a.isValid(u)||!a.isValid(p))throw new Error("mapToCurveSimpleSWU: invalid opts");const K=C(a,p);if(!a.isOdd)throw new Error("Field does not have .isOdd()");return t=>{let v,S,x,D,J,W,d,M;v=a.sqr(t),v=a.mul(v,p),S=a.sqr(v),S=a.add(S,v),x=a.add(S,a.ONE),x=a.mul(x,u),D=a.cmov(p,a.neg(S),!a.eql(S,a.ZERO)),D=a.mul(D,l),S=a.sqr(x),W=a.sqr(D),J=a.mul(W,l),S=a.add(S,J),S=a.mul(S,x),W=a.mul(W,D),J=a.mul(W,u),S=a.add(S,J),d=a.mul(v,x);const{isValid:z,value:ee}=K(S,W);M=a.mul(v,t),M=a.mul(M,ee),d=a.cmov(d,x,z),M=a.cmov(M,ee,z);const P=a.isOdd(t)===a.isOdd(M);M=a.cmov(a.neg(M),M,P);const b=(0,i.FpInvertBatch)(a,[D],!0)[0];return d=a.mul(d,b),{x:d,y:M}}}function h(a,H){return{secretKey:H.BYTES,publicKey:1+a.BYTES,publicKeyUncompressed:1+2*a.BYTES,publicKeyHasPrefix:!0,signature:2*H.BYTES}}function B(a,H={}){const{Fn:l}=a,u=H.randomBytes||c.randomBytes,p=Object.assign(h(a.Fp,l),{seed:(0,i.getMinHashLength)(l.ORDER)});function K(d){try{return!!A(l,d)}catch{return!1}}function t(d,M){const{publicKey:z,publicKeyUncompressed:ee}=p;try{const P=d.length;return M===!0&&P!==z||M===!1&&P!==ee?!1:!!a.fromBytes(d)}catch{return!1}}function v(d=u(p.seed)){return(0,i.mapHashToField)((0,c._abytes2)(d,p.seed,"seed"),l.ORDER)}function S(d,M=!0){return a.BASE.multiply(A(l,d)).toBytes(M)}function x(d){const M=v(d);return{secretKey:M,publicKey:S(M)}}function D(d){if(typeof d=="bigint")return!1;if(d instanceof a)return!0;const{secretKey:M,publicKey:z,publicKeyUncompressed:ee}=p;if(l.allowedLengths||M===z)return;const P=(0,c.ensureBytes)("key",d).length;return P===z||P===ee}function J(d,M,z=!0){if(D(d)===!0)throw new Error("first arg must be private key");if(D(M)===!1)throw new Error("second arg must be public key");const ee=A(l,d);return a.fromHex(M).multiply(ee).toBytes(z)}return Object.freeze({getPublicKey:S,getSharedSecret:J,keygen:x,Point:a,utils:{isValidSecretKey:K,isValidPublicKey:t,randomSecretKey:v,isValidPrivateKey:K,randomPrivateKey:v,normPrivateKeyToScalar:d=>A(l,d),precompute(d=8,M=a.BASE){return M.precompute(d,!1)}},lengths:p})}function E(a,H,l={}){(0,f.ahash)(H),(0,c._validateObject)(l,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const u=l.randomBytes||c.randomBytes,p=l.hmac||((te,...j)=>(0,r.hmac)(H,te,(0,c.concatBytes)(...j))),{Fp:K,Fn:t}=a,{ORDER:v,BITS:S}=t,{keygen:x,getPublicKey:D,getSharedSecret:J,utils:W,lengths:d}=B(a,l),M={prehash:!1,lowS:typeof l.lowS=="boolean"?l.lowS:!1,format:void 0,extraEntropy:!1},z="compact";function ee(te){const j=v>>F;return te>j}function P(te,j){if(!t.isValidNot0(j))throw new Error(`invalid signature ${te}: out of range 1..Point.Fn.ORDER`);return j}function b(te,j){m(j);const ie=d.signature,Q=j==="compact"?ie:j==="recovered"?ie+1:void 0;return(0,c._abytes2)(te,Q,`${j} signature`)}class X{constructor(j,ie,Q){this.r=P("r",j),this.s=P("s",ie),Q!=null&&(this.recovery=Q),Object.freeze(this)}static fromBytes(j,ie=z){b(j,ie);let Q;if(ie==="der"){const{r:I,s:Y}=e.DER.toSig((0,c._abytes2)(j));return new X(I,Y)}ie==="recovered"&&(Q=j[0],ie="compact",j=j.subarray(1));const ce=t.BYTES,le=j.subarray(0,ce),de=j.subarray(ce,ce*2);return new X(t.fromBytes(le),t.fromBytes(de),Q)}static fromHex(j,ie){return this.fromBytes((0,c.hexToBytes)(j),ie)}addRecoveryBit(j){return new X(this.r,this.s,j)}recoverPublicKey(j){const ie=K.ORDER,{r:Q,s:ce,recovery:le}=this;if(le==null||![0,1,2,3].includes(le))throw new Error("recovery id invalid");if(v*L<ie&&le>1)throw new Error("recovery id is ambiguous for h>1 curve");const I=le===2||le===3?Q+v:Q;if(!K.isValid(I))throw new Error("recovery id 2 or 3 invalid");const Y=K.toBytes(I),re=a.fromBytes((0,c.concatBytes)(T((le&1)===0),Y)),oe=t.inv(I),fe=ue((0,c.ensureBytes)("msgHash",j)),ve=t.create(-fe*oe),be=t.create(ce*oe),Ee=a.BASE.multiplyUnsafe(ve).add(re.multiplyUnsafe(be));if(Ee.is0())throw new Error("point at infinify");return Ee.assertValidity(),Ee}hasHighS(){return ee(this.s)}toBytes(j=z){if(m(j),j==="der")return(0,c.hexToBytes)(e.DER.hexFromSig(this));const ie=t.toBytes(this.r),Q=t.toBytes(this.s);if(j==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,c.concatBytes)(Uint8Array.of(this.recovery),ie,Q)}return(0,c.concatBytes)(ie,Q)}toHex(j){return(0,c.bytesToHex)(this.toBytes(j))}assertValidity(){}static fromCompact(j){return X.fromBytes((0,c.ensureBytes)("sig",j),"compact")}static fromDER(j){return X.fromBytes((0,c.ensureBytes)("sig",j),"der")}normalizeS(){return this.hasHighS()?new X(this.r,t.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,c.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,c.bytesToHex)(this.toBytes("compact"))}}const se=l.bits2int||function(j){if(j.length>8192)throw new Error("input is too large");const ie=(0,c.bytesToNumberBE)(j),Q=j.length*8-S;return Q>0?ie>>BigInt(Q):ie},ue=l.bits2int_modN||function(j){return t.create(se(j))},he=(0,c.bitMask)(S);function pe(te){return(0,c.aInRange)("num < 2^"+S,te,N,he),t.toBytes(te)}function ge(te,j){return(0,c._abytes2)(te,void 0,"message"),j?(0,c._abytes2)(H(te),void 0,"prehashed message"):te}function ye(te,j,ie){if(["recovered","canonical"].some(ve=>ve in ie))throw new Error("sign() legacy options not supported");const{lowS:Q,prehash:ce,extraEntropy:le}=w(ie,M);te=ge(te,ce);const de=ue(te),I=A(t,j),Y=[pe(I),pe(de)];if(le!=null&&le!==!1){const ve=le===!0?u(d.secretKey):le;Y.push((0,c.ensureBytes)("extraEntropy",ve))}const re=(0,c.concatBytes)(...Y),oe=de;function fe(ve){const be=se(ve);if(!t.isValidNot0(be))return;const Ee=t.inv(be),we=a.BASE.multiply(be).toAffine(),Be=t.create(we.x);if(Be===N)return;const De=t.create(Ee*t.create(oe+Be*I));if(De===N)return;let Xe=(we.x===Be?0:2)|Number(we.y&F),st=De;return Q&&ee(De)&&(st=t.neg(De),Xe^=1),new X(Be,st,Xe)}return{seed:re,k2sig:fe}}function Se(te,j,ie={}){te=(0,c.ensureBytes)("message",te);const{seed:Q,k2sig:ce}=ye(te,j,ie);return(0,c.createHmacDrbg)(H.outputLen,t.BYTES,p)(Q,ce)}function _e(te){let j;const ie=typeof te=="string"||(0,c.isBytes)(te),Q=!ie&&te!==null&&typeof te=="object"&&typeof te.r=="bigint"&&typeof te.s=="bigint";if(!ie&&!Q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(Q)j=new X(te.r,te.s);else if(ie){try{j=X.fromBytes((0,c.ensureBytes)("sig",te),"der")}catch(ce){if(!(ce instanceof e.DER.Err))throw ce}if(!j)try{j=X.fromBytes((0,c.ensureBytes)("sig",te),"compact")}catch{return!1}}return j||!1}function ae(te,j,ie,Q={}){const{lowS:ce,prehash:le,format:de}=w(Q,M);if(ie=(0,c.ensureBytes)("publicKey",ie),j=ge((0,c.ensureBytes)("message",j),le),"strict"in Q)throw new Error("options.strict was renamed to lowS");const I=de===void 0?_e(te):X.fromBytes((0,c.ensureBytes)("sig",te),de);if(I===!1)return!1;try{const Y=a.fromBytes(ie);if(ce&&I.hasHighS())return!1;const{r:re,s:oe}=I,fe=ue(j),ve=t.inv(oe),be=t.create(fe*ve),Ee=t.create(re*ve),we=a.BASE.multiplyUnsafe(be).add(Y.multiplyUnsafe(Ee));return we.is0()?!1:t.create(we.x)===re}catch{return!1}}function ne(te,j,ie={}){const{prehash:Q}=w(ie,M);return j=ge(j,Q),X.fromBytes(te,"recovered").recoverPublicKey(j).toBytes()}return Object.freeze({keygen:x,getPublicKey:D,getSharedSecret:J,utils:W,lengths:d,Point:a,sign:Se,verify:ae,recoverPublicKey:ne,Signature:X,hash:H})}function V(a){const{CURVE:H,curveOpts:l}=R(a),u=q(H,l);return Z(a,u)}function R(a){const H={a:a.a,b:a.b,p:a.Fp.ORDER,n:a.n,h:a.h,Gx:a.Gx,Gy:a.Gy},l=a.Fp;let u=a.allowedPrivateKeyLengths?Array.from(new Set(a.allowedPrivateKeyLengths.map(t=>Math.ceil(t/2)))):void 0;const p=(0,i.Field)(H.n,{BITS:a.nBitLength,allowedLengths:u,modFromBytes:a.wrapPrivateKey}),K={Fp:l,Fn:p,allowInfinityPoint:a.allowInfinityPoint,endo:a.endo,isTorsionFree:a.isTorsionFree,clearCofactor:a.clearCofactor,fromBytes:a.fromBytes,toBytes:a.toBytes};return{CURVE:H,curveOpts:K}}function k(a){const{CURVE:H,curveOpts:l}=R(a),u={hmac:a.hmac,randomBytes:a.randomBytes,lowS:a.lowS,bits2int:a.bits2int,bits2int_modN:a.bits2int_modN};return{CURVE:H,curveOpts:l,hash:a.hash,ecdsaOpts:u}}function U(a,H,l){function u(p){const K=a.sqr(p),t=a.mul(K,p);return a.add(a.add(t,a.mul(p,H)),l)}return u}function Z(a,H){const{Fp:l,Fn:u}=H;function p(t){return(0,c.inRange)(t,F,u.ORDER)}const K=U(l,a.a,a.b);return Object.assign({},{CURVE:a,Point:H,ProjectivePoint:H,normPrivateKeyToScalar:t=>A(u,t),weierstrassEquation:K,isWithinCurveOrder:p})}function G(a,H){const l=H.Point;return Object.assign({},H,{ProjectivePoint:l,CURVE:Object.assign({},a,(0,i.nLength)(l.Fn.ORDER,l.Fn.BITS))})}function $(a){const{CURVE:H,curveOpts:l,hash:u,ecdsaOpts:p}=k(a),K=q(H,l),t=E(K,u,p);return G(a,t)}})(jt)),jt}var us;function Po(){if(us)return Je;us=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.getHash=r,Je.createCurve=f;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const e=as();function r(c){return{hash:c}}function f(c,s){const i=n=>(0,e.weierstrass)({...c,hash:n});return{...i(s),create:i}}return Je}var ls;function To(){return ls||(ls=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.secp256k1_hasher=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const r=qt(),f=qe(),c=Po(),s=ns(),i=Ue(),n=as(),o=ke(),m={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},w={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},O=BigInt(0),N=BigInt(1),F=BigInt(2);function L(G){const $=m.p,a=BigInt(3),H=BigInt(6),l=BigInt(11),u=BigInt(22),p=BigInt(23),K=BigInt(44),t=BigInt(88),v=G*G*G%$,S=v*v*G%$,x=(0,i.pow2)(S,a,$)*S%$,D=(0,i.pow2)(x,a,$)*S%$,J=(0,i.pow2)(D,F,$)*v%$,W=(0,i.pow2)(J,l,$)*J%$,d=(0,i.pow2)(W,u,$)*W%$,M=(0,i.pow2)(d,K,$)*d%$,z=(0,i.pow2)(M,t,$)*M%$,ee=(0,i.pow2)(z,K,$)*d%$,P=(0,i.pow2)(ee,a,$)*S%$,b=(0,i.pow2)(P,p,$)*W%$,X=(0,i.pow2)(b,H,$)*v%$,se=(0,i.pow2)(X,F,$);if(!y.eql(y.sqr(se),G))throw new Error("Cannot find square root");return se}const y=(0,i.Field)(m.p,{sqrt:L});e.secp256k1=(0,c.createCurve)({...m,Fp:y,lowS:!0,endo:w},r.sha256);const g={};function A(G,...$){let a=g[G];if(a===void 0){const H=(0,r.sha256)((0,o.utf8ToBytes)(G));a=(0,o.concatBytes)(H,H),g[G]=a}return(0,r.sha256)((0,o.concatBytes)(a,...$))}const q=G=>G.toBytes(!0).slice(1),T=e.secp256k1.Point,C=G=>G%F===O;function _(G){const{Fn:$,BASE:a}=T,H=(0,n._normFnElement)($,G),l=a.multiply(H);return{scalar:C(l.y)?H:$.neg(H),bytes:q(l)}}function h(G){const $=y;if(!$.isValidNot0(G))throw new Error("invalid x: Fail if x \u2265 p");const a=$.create(G*G),H=$.create(a*G+BigInt(7));let l=$.sqrt(H);C(l)||(l=$.neg(l));const u=T.fromAffine({x:G,y:l});return u.assertValidity(),u}const B=o.bytesToNumberBE;function E(...G){return T.Fn.create(B(A("BIP0340/challenge",...G)))}function V(G){return _(G).bytes}function R(G,$,a=(0,f.randomBytes)(32)){const{Fn:H}=T,l=(0,o.ensureBytes)("message",G),{bytes:u,scalar:p}=_($),K=(0,o.ensureBytes)("auxRand",a,32),t=H.toBytes(p^B(A("BIP0340/aux",K))),v=A("BIP0340/nonce",t,u,l),{bytes:S,scalar:x}=_(v),D=E(S,u,l),J=new Uint8Array(64);if(J.set(S,0),J.set(H.toBytes(H.create(x+D*p)),32),!k(J,l,u))throw new Error("sign: Invalid signature produced");return J}function k(G,$,a){const{Fn:H,BASE:l}=T,u=(0,o.ensureBytes)("signature",G,64),p=(0,o.ensureBytes)("message",$),K=(0,o.ensureBytes)("publicKey",a,32);try{const t=h(B(K)),v=B(u.subarray(0,32));if(!(0,o.inRange)(v,N,m.p))return!1;const S=B(u.subarray(32,64));if(!(0,o.inRange)(S,N,m.n))return!1;const x=E(H.toBytes(v),q(t),p),D=l.multiplyUnsafe(S).add(t.multiplyUnsafe(H.neg(x))),{x:J,y:W}=D.toAffine();return!(D.is0()||!C(W)||J!==v)}catch{return!1}}e.schnorr=(()=>{const a=(l=(0,f.randomBytes)(48))=>(0,i.mapHashToField)(l,m.n);e.secp256k1.utils.randomSecretKey;function H(l){const u=a(l);return{secretKey:u,publicKey:V(u)}}return{keygen:H,getPublicKey:V,sign:R,verify:k,Point:T,utils:{randomSecretKey:a,randomPrivateKey:a,taggedHash:A,lift_x:h,pointToBytes:q,numberToBytesBE:o.numberToBytesBE,bytesToNumberBE:o.bytesToNumberBE,mod:i.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48}}})();const U=(0,s.isogenyMap)(y,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(G=>G.map($=>BigInt($)))),Z=(0,n.mapToCurveSimpleSWU)(y,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:y.create(BigInt("-11"))});e.secp256k1_hasher=(0,s.createHasher)(e.secp256k1.Point,G=>{const{x:$,y:a}=Z(y.create(G[0]));return U($,a)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:y.ORDER,m:1,k:128,expand:"xmd",hash:r.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})(Vt)),Vt}var Ut={},fs;function ds(){return fs||(fs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var r=Le(),f=function(s){return s.startsWith("0x")||s.startsWith("0X")?s.slice(2):s};e.remove0x=f;var c=function(s){return(0,r.hexToBytes)((0,e.remove0x)(s))};e.decodeHex=c})(Ut)),Ut}var hs;function No(){return hs||(hs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var r=Gr(),f=Ho(),c=To(),s=ct(),i=Ct(),n=ds(),o=function(A){var q;do q=(0,r.randomBytes)(i.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(q,A));return q};e.getValidSecret=o;var m=function(A,q){return L(q,function(T){return T.utils.isValidSecretKey(A)},function(){return!0},function(){return!0})};e.isValidPrivateKey=m;var w=function(A,q){return L(q,function(T){return T.getPublicKey(A)},function(T){return T.getPublicKey(A)},function(T){return T.getPublicKey(A)})};e.getPublicKey=w;var O=function(A,q,T,C){return L(C,function(_){return _.getSharedSecret(A,q,T)},function(_){return _.getSharedSecret(A,q)},function(_){return g(_,A,q)})};e.getSharedPoint=O;var N=function(A,q,T){return L(T,function(C){return C.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),A,q)},function(){return A},function(){return A})};e.convertPublicKeyFormat=N;var F=function(A,q){var T=(0,n.decodeHex)(A);return L(q,function(){return y(T)},function(){return T},function(){return T})};e.hexToPublicKey=F;function L(A,q,T,C){var _=A||(0,s.ellipticCurve)();if(_==="secp256k1")return q(c.secp256k1);if(_==="x25519")return T(f.x25519);if(_==="ed25519")return C(f.ed25519);throw new Error("Not implemented")}var y=function(A){if(A.length===i.ETH_PUBLIC_KEY_SIZE){var q=new Uint8Array(1+A.length);return q.set([4]),q.set(A,1),q}return A},g=function(A,q,T){var C=A.utils.getExtendedPublicKey(q).scalar,_=A.Point.fromBytes(T).multiply(C);return _.toBytes()}})(Pt)),Pt}var Gt={},Ge={},ys;function Lo(){if(ys)return Ge;ys=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.hkdf=void 0,Ge.extract=f,Ge.expand=i;const e=os(),r=qe();function f(o,m,w){return(0,r.ahash)(o),w===void 0&&(w=new Uint8Array(o.outputLen)),(0,e.hmac)(o,(0,r.toBytes)(w),(0,r.toBytes)(m))}const c=Uint8Array.from([0]),s=Uint8Array.of();function i(o,m,w,O=32){(0,r.ahash)(o),(0,r.anumber)(O);const N=o.outputLen;if(O>255*N)throw new Error("Length should be <= 255*HashLen");const F=Math.ceil(O/N);w===void 0&&(w=s);const L=new Uint8Array(F*N),y=e.hmac.create(o,m),g=y._cloneInto(),A=new Uint8Array(y.outputLen);for(let q=0;q<F;q++)c[0]=q+1,g.update(q===0?s:A).update(w).update(c).digestInto(A),L.set(A,N*q),y._cloneInto(g);return y.destroy(),g.destroy(),(0,r.clean)(A,c),L.slice(0,O)}const n=(o,m,w,O,N)=>i(o,f(o,m,w),O,N);return Ge.hkdf=n,Ge}var ps;function qo(){return ps||(ps=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var r=Le(),f=Lo(),c=qt(),s=function(n,o,m){return(0,f.hkdf)(c.sha256,n,o,m,32)};e.deriveKey=s;var i=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return(0,e.deriveKey)(r.concatBytes.apply(void 0,n))};e.getSharedKey=i})(Gt)),Gt}var $t={},$e={},et={};const Do=so(import.meta.url);function Fo(){return Do("node:crypto")}var vs;function ms(){if(vs)return et;vs=1,Object.defineProperty(et,"__esModule",{value:!0}),et._compat=void 0;var e=Le(),r=Fo(),f=16,c=globalThis.Deno!==void 0,s=function(i,n,o,m){var w=i==="aes-256-gcm"||i==="chacha20-poly1305",O=w?f:0,N=w?{authTagLength:O}:void 0,F=function(y){var g=(0,r.createCipheriv)(i,n,o,N);w&&m!==void 0&&g.setAAD(m);var A=g.update(y),q=g.final(),T=w?g.getAuthTag():new Uint8Array(0);return(0,e.concatBytes)(A,q,T)},L=function(y){var g=y.subarray(0,y.length-O),A=y.subarray(y.length-O),q=(0,r.createDecipheriv)(i,n,o,N);w&&(m!==void 0&&q.setAAD(m),q.setAuthTag(A)),!w&&c&&q.setAutoPadding(!1);var T=q.update(g),C=q.final();return(0,e.concatBytes)(T,C)};return{encrypt:F,decrypt:L}};return et._compat=s,et}var gs;function ko(){if(gs)return $e;gs=1,Object.defineProperty($e,"__esModule",{value:!0}),$e.aes256cbc=$e.aes256gcm=void 0;var e=ms(),r=function(c,s,i){return(0,e._compat)("aes-256-gcm",c,s,i)};$e.aes256gcm=r;var f=function(c,s,i){return(0,e._compat)("aes-256-cbc",c,s)};return $e.aes256cbc=f,$e}var Ye={},tt={},bs;function Vo(){if(bs)return tt;bs=1,Object.defineProperty(tt,"__esModule",{value:!0}),tt._hchacha20=void 0;var e=function(f,c,s,i){for(var n=f[0],o=f[1],m=f[2],w=f[3],O=c[0],N=c[1],F=c[2],L=c[3],y=c[4],g=c[5],A=c[6],q=c[7],T=s[0],C=s[1],_=s[2],h=s[3],B=0;B<20;B+=2)n=n+O|0,T=r(T^n,16),y=y+T|0,O=r(O^y,12),n=n+O|0,T=r(T^n,8),y=y+T|0,O=r(O^y,7),o=o+N|0,C=r(C^o,16),g=g+C|0,N=r(N^g,12),o=o+N|0,C=r(C^o,8),g=g+C|0,N=r(N^g,7),m=m+F|0,_=r(_^m,16),A=A+_|0,F=r(F^A,12),m=m+F|0,_=r(_^m,8),A=A+_|0,F=r(F^A,7),w=w+L|0,h=r(h^w,16),q=q+h|0,L=r(L^q,12),w=w+L|0,h=r(h^w,8),q=q+h|0,L=r(L^q,7),n=n+N|0,h=r(h^n,16),A=A+h|0,N=r(N^A,12),n=n+N|0,h=r(h^n,8),A=A+h|0,N=r(N^A,7),o=o+F|0,T=r(T^o,16),q=q+T|0,F=r(F^q,12),o=o+F|0,T=r(T^o,8),q=q+T|0,F=r(F^q,7),m=m+L|0,C=r(C^m,16),y=y+C|0,L=r(L^y,12),m=m+L|0,C=r(C^m,8),y=y+C|0,L=r(L^y,7),w=w+O|0,_=r(_^w,16),g=g+_|0,O=r(O^g,12),w=w+O|0,_=r(_^w,8),g=g+_|0,O=r(O^g,7);var E=0;i[E++]=n,i[E++]=o,i[E++]=m,i[E++]=w,i[E++]=T,i[E++]=C,i[E++]=_,i[E++]=h};tt._hchacha20=e;var r=function(f,c){return f<<c|f>>>32-c};return tt}var Es;function jo(){if(Es)return Ye;Es=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.chacha20=Ye.xchacha20=void 0;var e=Le(),r=ms(),f=Vo(),c=function(i,n,o){if(n.length!==24)throw new Error("xchacha20's nonce must be 24 bytes");var m=new Uint32Array([1634760805,857760878,2036477234,1797285236]),w=new Uint32Array(8);(0,f._hchacha20)(m,(0,e.u32)(i),(0,e.u32)(n.subarray(0,16)),w);var O=new Uint8Array(12);return O.set([0,0,0,0]),O.set(n.subarray(16),4),(0,r._compat)("chacha20-poly1305",(0,e.u8)(w),O,o)};Ye.xchacha20=c;var s=function(i,n,o){if(n.length!==12)throw new Error("chacha20's nonce must be 12 bytes");return(0,r._compat)("chacha20-poly1305",i,n,o)};return Ye.chacha20=s,Ye}var _s;function Mo(){return _s||(_s=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var r=ko(),f=jo(),c=Le(),s=Gr(),i=ct(),n=Ct(),o=function(F,L,y){return w(O,F,L,y)};e.symEncrypt=o;var m=function(F,L,y){return w(N,F,L,y)};e.symDecrypt=m,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function w(F,L,y,g){var A=(0,i.symmetricAlgorithm)();if(A==="aes-256-gcm")return F(r.aes256gcm,L,y,(0,i.symmetricNonceLength)(),n.AEAD_TAG_LENGTH,g);if(A==="xchacha20")return F(f.xchacha20,L,y,n.XCHACHA20_NONCE_LENGTH,n.AEAD_TAG_LENGTH,g);if(A==="aes-256-cbc")return F(r.aes256cbc,L,y,16,0);throw new Error("Not implemented")}function O(F,L,y,g,A,q){var T=(0,s.randomBytes)(g),C=F(L,T,q),_=C.encrypt(y);if(A===0)return(0,c.concatBytes)(T,_);var h=_.length-A,B=_.subarray(0,h),E=_.subarray(h);return(0,c.concatBytes)(T,E,B)}function N(F,L,y,g,A,q){var T=y.subarray(0,g),C=F(L,Uint8Array.from(T),q),_=y.subarray(g);if(A===0)return C.decrypt(_);var h=_.subarray(0,A),B=_.subarray(A);return C.decrypt((0,c.concatBytes)(B,h))}})($t)),$t}var ws;function Yt(){return ws||(ws=1,(function(e){var r=Me&&Me.__createBinding||(Object.create?(function(c,s,i,n){n===void 0&&(n=i);var o=Object.getOwnPropertyDescriptor(s,i);(!o||("get"in o?!s.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(c,n,o)}):(function(c,s,i,n){n===void 0&&(n=i),c[n]=s[i]})),f=Me&&Me.__exportStar||function(c,s){for(var i in c)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&r(s,c,i)};Object.defineProperty(e,"__esModule",{value:!0}),f(No(),e),f(qo(),e),f(ds(),e),f(Mo(),e)})(Me)),Me}var nt={},Ss;function xs(){if(Ss)return nt;Ss=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.PublicKey=void 0;var e=Le(),r=Yt(),f=(function(){function c(s,i){var n=(0,r.convertPublicKeyFormat)(s,!0,i),o=(0,r.convertPublicKeyFormat)(s,!1,i);this.data=n,this.dataUncompressed=n.length!==o.length?o:null}return c.fromHex=function(s,i){return new c((0,r.hexToPublicKey)(s,i),i)},Object.defineProperty(c.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),c.prototype.toBytes=function(s){return s===void 0&&(s=!0),s?this.data:this._uncompressed},c.prototype.toHex=function(s){return s===void 0&&(s=!0),(0,e.bytesToHex)(this.toBytes(s))},c.prototype.decapsulate=function(s,i){i===void 0&&(i=!1);var n=this.toBytes(i),o=s.multiply(this,i);return(0,r.getSharedKey)(n,o)},c.prototype.equals=function(s){return(0,e.equalBytes)(this.data,s.data)},c})();return nt.PublicKey=f,nt}var As;function Uo(){if(As)return We;As=1,Object.defineProperty(We,"__esModule",{value:!0}),We.PrivateKey=void 0;var e=Le(),r=Yt(),f=xs(),c=(function(){function s(i,n){if(this.curve=n,i===void 0)this.data=(0,r.getValidSecret)(n);else if((0,r.isValidPrivateKey)(i,n))this.data=i;else throw new Error("Invalid private key");this.publicKey=new f.PublicKey((0,r.getPublicKey)(this.data,n),n)}return s.fromHex=function(i,n){return new s((0,r.decodeHex)(i),n)},Object.defineProperty(s.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),s.prototype.toHex=function(){return(0,e.bytesToHex)(this.data)},s.prototype.encapsulate=function(i,n){n===void 0&&(n=!1);var o=this.publicKey.toBytes(n),m=this.multiply(i,n);return(0,r.getSharedKey)(o,m)},s.prototype.multiply=function(i,n){return n===void 0&&(n=!1),(0,r.getSharedPoint)(this.data,i.toBytes(!0),n,this.curve)},s.prototype.equals=function(i){return(0,e.equalBytes)(this.data,i.data)},s})();return We.PrivateKey=c,We}var Bs;function Rs(){return Bs||(Bs=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var r=Uo();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return r.PrivateKey}});var f=xs();Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return f.PublicKey}})})(Ht)),Ht}var Is;function Zt(){return Is||(Is=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=i,e.decrypt=o;var r=Le(),f=ct(),c=Rs(),s=Yt();function i(N,F){return Buffer.from(n(N,F))}function n(N,F){var L=(0,f.ellipticCurve)(),y=new c.PrivateKey(void 0,L),g=N instanceof Uint8Array?new c.PublicKey(N,L):c.PublicKey.fromHex(N,L),A=y.encapsulate(g,(0,f.isHkdfKeyCompressed)()),q=y.publicKey.toBytes((0,f.isEphemeralKeyCompressed)()),T=(0,s.symEncrypt)(A,F);return(0,r.concatBytes)(q,T)}function o(N,F){return Buffer.from(m(N,F))}function m(N,F){var L=(0,f.ellipticCurve)(),y=N instanceof Uint8Array?new c.PrivateKey(N,L):c.PrivateKey.fromHex(N,L),g=(0,f.ephemeralKeySize)(),A=new c.PublicKey(F.subarray(0,g),L),q=F.subarray(g),T=A.decapsulate(y,(0,f.isHkdfKeyCompressed)());return(0,s.symDecrypt)(T,q)}var w=ct();Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return w.ECIES_CONFIG}});var O=Rs();Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return O.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return O.PublicKey}}),e.utils={aesEncrypt:s.aesEncrypt,aesDecrypt:s.aesDecrypt,symEncrypt:s.symEncrypt,symDecrypt:s.symDecrypt,decodeHex:s.decodeHex,getValidSecret:s.getValidSecret,remove0x:s.remove0x}})(It)),It}var Xt,Os;function Ks(){if(Os)return Xt;Os=1;const{decrypt:e}=Zt(),r=Pe(),f="encrypted:";function c(s,i,n,o){let m,w;if(!i.startsWith(f))return i;if(o=o||"",o.length<=0)w=new r({key:s,privateKeyName:n,privateKey:o}).missingPrivateKey();else{const O=o.split(",");for(const N of O){const F=Buffer.from(N,"hex"),L=i.substring(f.length),y=Buffer.from(L,"base64");try{m=e(F,y).toString(),w=null;break}catch(g){g.message==="Invalid private key"?w=new r({key:s,privateKeyName:n,privateKey:o}).invalidPrivateKey():g.message==="Unsupported state or unable to authenticate data"?w=new r({key:s,privateKeyName:n,privateKey:o}).wrongPrivateKey():g.message==="Point of length 65 was invalid. Expected 33 compressed bytes or 65 uncompressed bytes"?w=new r({key:s,privateKeyName:n,privateKey:o}).malformedEncryptedData():w=new r({key:s,privateKeyName:n,privateKey:o,message:g.message}).decryptionFailed()}}}if(w)throw w;return m}return Xt=c,Xt}var Wt,Cs;function Go(){if(Cs)return Wt;Cs=1;function e(r){return r.replace(/[\r\n]+$/,"")}return Wt=e,Wt}var zt,Hs;function $o(){if(Hs)return zt;Hs=1;const{execSync:e}=nr,r=Go(),f=Pe();function c(s,i,n,o){return(i.match(/\$\(([^)]+(?:\)[^(]*)*)\)/g)||[]).reduce((w,O)=>{const N=O.slice(2,-1);let F;try{F=e(N,{env:{...n,...o}}).toString()}catch(L){throw new f({key:s,command:N,message:L.message.trim()}).commandSubstitutionFailed()}return F=r(F),w.replace(O,F)},i)}return zt=c,zt}var Qt,Ps;function Yo(){if(Ps)return Qt;Ps=1;function e(r){return r.replace(/\\\$/g,"$")}return Qt=e,Qt}var Jt,Ts;function Ns(){if(Ts)return Jt;Ts=1;const e=Ks(),r=$o(),f=Yo();class c{static LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;constructor(i,n=null,o=process.env,m=!1,w=null){this.src=i,this.privateKey=n,this.privateKeyName=w,this.processEnv=o,this.overload=m,this.parsed={},this.preExisted={},this.injected={},this.errors=[],this.runningParsed={},this.literals={}}run(){const i=this.getLines();let n;for(;(n=c.LINE.exec(i))!==null;){const o=n[1],m=n[2],w=this.quote(m);this.parsed[o]=this.clean(m,w),!this.overload&&this.inProcessEnv(o)&&(this.parsed[o]=this.processEnv[o]);try{this.parsed[o]=this.decrypt(o,this.parsed[o])}catch(N){this.errors.push(N)}let O=!1;if(w!=="'"&&(!this.inProcessEnv(o)||this.processEnv[o]===this.parsed[o])){const N=this.parsed[o];try{this.parsed[o]=this.eval(o,N)}catch(F){this.errors.push(F)}N!==this.parsed[o]&&(O=!0)}!O&&w!=="'"&&(!this.processEnv[o]||this.overload)&&(this.parsed[o]=f(this.expand(this.parsed[o]))),w==="'"&&(this.literals[o]=this.parsed[o]),this.runningParsed[o]=this.parsed[o],Object.prototype.hasOwnProperty.call(this.processEnv,o)&&!this.overload?this.preExisted[o]=this.processEnv[o]:this.injected[o]=this.parsed[o]}return{parsed:this.parsed,processEnv:this.processEnv,injected:this.injected,preExisted:this.preExisted,errors:this.errors}}trimmer(i){return(i||"").trim()}quote(i){const o=this.trimmer(i)[0];let m="";switch(o){case"'":m="'";break;case'"':m='"';break;case"`":m="`";break;default:m=""}return m}clean(i,n){let o=this.trimmer(i);return o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),n==='"'&&(o=o.replace(/\\n/g,`
|
|
3
|
+
`),o=o.replace(/\\r/g,"\r"),o=o.replace(/\\t/g," ")),o}decrypt(i,n){return e(i,n,this.privateKeyName,this.privateKey)}eval(i,n){return r(i,n,this.processEnv,this.runningParsed)}expand(i){let n={...this.runningParsed,...this.processEnv};this.overload&&(n={...this.processEnv,...this.runningParsed});const o=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;let m=i,w;for(;(w=o.exec(m))!==null;){const[O,N,F]=w,L=N||F,y=/(:\+|\+|:-|-)/,g=L.match(y),A=g?g[0]:null,q=L.split(A);let T,C;const _=q.shift();if([":+","+"].includes(A)?(T=n[_]?q.join(A):"",C=null):(T=q.join(A),C=n[_]),C?m=m.replace(O,C):m=m.replace(O,T),m===n[_]||this.literals[_]&&/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/.test(this.literals[_]))break;o.lastIndex=0}return m}inProcessEnv(i){return Object.prototype.hasOwnProperty.call(this.processEnv,i)}getLines(){return(this.src||"").toString().replace(/\r\n?/mg,`
|
|
4
|
+
`)}}return Jt=c,Jt}var en,Ls;function qs(){if(Ls)return en;Ls=1;const e=Fe;async function r(f){const c=await e.promises.readFile(f);return c.length>=2&&c[0]===255&&c[1]===254?"utf16le":(c.length>=3&&c[0]===239&&c[1]===187&&c[2]===191,"utf8")}return en=r,en}var tn,Ds;function Fs(){if(Ds)return tn;Ds=1;const e=Fe;function r(f){const c=e.readFileSync(f);return c.length>=2&&c[0]===255&&c[1]===254?"utf16le":(c.length>=3&&c[0]===239&&c[1]===187&&c[2]===191,"utf8")}return tn=r,tn}var nn,ks;function Vs(){if(ks)return nn;ks=1;const e=Re;function r(f){const c=e.basename(f).toLowerCase(),i=[...c.split(".").slice(2)];return i.length===0?c.replace(".env","development"):i.length===1?i[0]:i.length===2?i.join("_"):i.slice(0,2).join("_")}return nn=r,nn}var rn,js;function sn(){if(js)return rn;js=1;const e=Re,r=Vs();function f(c){const s=e.basename(c).toLowerCase();if(s===".env")return{publicKeyName:"DOTENV_PUBLIC_KEY",privateKeyName:"DOTENV_PRIVATE_KEY"};const i=r(s).toUpperCase();return{publicKeyName:`DOTENV_PUBLIC_KEY_${i}`,privateKeyName:`DOTENV_PRIVATE_KEY_${i}`}}return rn=f,rn}var on,Ms;function je(){if(Ms)return on;Ms=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(f,c=!1,s=!1,i=!1){const n={};let o=f.toString();s||(o=o.replace(/\r\n?/mg,`
|
|
5
|
+
`));let m;for(;(m=e.exec(o))!=null;){const w=m[1];let O=m[2]||"";O=O.trim();const N=O[0];O=O.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),N==='"'&&!c&&(O=O.replace(/\\n/g,`
|
|
6
|
+
`),O=O.replace(/\\r/g,"\r"),O=O.replace(/\\t/g," ")),i?(n[w]=n[w]||[],n[w].push(O)):n[w]=O}return n}return on=r,on}var cn,Us;function an(){if(Us)return cn;Us=1;function e(r){if(process.env[r]&&process.env[r].length>0)return process.env[r]}return cn=e,cn}var un,Gs;function $s(){if(Gs)return un;Gs=1;const e=Te(),r=je();async function f(c,s){if(!await e.exists(s))return;const i=await e.readFileX(s),n=r(i);if(n[c]&&n[c].length>0)return n[c]}return un=f,un}var ln,Ys;function fn(){if(Ys)return ln;Ys=1;const e=Re,r=nr,c=io.promisify(r.execFile);class s{async status(){if(this._isForcedOff())return"off";const n=await this._resolveBinary();if(!n)return"off";try{return await this._exec(n,["status"])}catch{return"off"}}statusSync(){if(this._isForcedOff())return"off";const n=this._resolveBinarySync();if(!n)return"off";try{return this._execSync(n,["status"])}catch{return"off"}}async keypair(n){if(this._isForcedOff())return{};const o=await this._resolveBinary();if(!o)return{};const m=["keypair"];n&&m.push(n);try{return JSON.parse(await this._exec(o,m))}catch{return{}}}keypairSync(n){if(this._isForcedOff())return{};const o=this._resolveBinarySync();if(!o)return{};const m=["keypair"];n&&m.push(n);try{return JSON.parse(this._execSync(o,m))}catch{return{}}}observe(n){if(this._isForcedOff())return;const o=this._resolveBinarySync();if(!o)return;let m="off";try{m=this._execSync(o,["status"])}catch{return}if(m==="off")return;const w=Buffer.from(JSON.stringify(n)).toString("base64");try{r.spawn(o,["observe",w],{stdio:"ignore",detached:!0}).unref()}catch{}}async _exec(n,o){const{stdout:m}=await c(n,o);return m.toString().trim()}_execSync(n,o){return r.execFileSync(n,o).toString().trim()}async _resolveBinary(){return this._binaryPromise?this._binaryPromise:(this._binaryPromise=(async()=>{const n=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-ops");try{return await this._exec(n,["--version"]),n}catch{}try{return await this._exec("dotenvx-ops",["--version"]),"dotenvx-ops"}catch{}return null})(),this._binaryPromise)}_resolveBinarySync(){if(this._binarySync!==void 0)return this._binarySync;const n=e.resolve(process.cwd(),"node_modules/.bin/dotenvx-ops");try{return this._execSync(n,["--version"]),this._binarySync=n,this._binarySync}catch{}try{return this._execSync("dotenvx-ops",["--version"]),this._binarySync="dotenvx-ops",this._binarySync}catch{}return this._binarySync=null,null}_isForcedOff(){return process.env.DOTENVX_NO_OPS==="true"}}return ln=s,ln}var dn,Zs;function hn(){if(Zs)return dn;Zs=1;const e=fn();async function r(f){const c=await new e().keypair(f),s=c.public_key,i=c.private_key;return{publicKey:s,privateKey:i}}return dn=r,dn}var yn,Xs;function Zo(){if(Xs)return yn;Xs=1;const e=Re,r=Te(),f=je(),c=sn(),s=an(),i=$s(),n=hn();async function o(w){const O="DOTENV_PUBLIC_KEY",N="DOTENV_PRIVATE_KEY";if(!await r.exists(w))return null;const F=await r.readFileX(w),L=f(F);let y;for(const g of Object.keys(L))(g===O||g.startsWith(O))&&(y=g);return y?y.replace(O,N):null}async function m(w,O={}){let N=O.keysFilepath||null;const F=O.noOps===!0,L=c(w),y=L.publicKeyName;let g=L.privateKeyName,A=null,q=null;return A=s(y),A||(A=await i(y,w)||null),q=s(g),q||(N?N=e.resolve(N):N=e.resolve(e.dirname(w),".env.keys"),q=await i(g,N)),q||(g=await o(w),g&&(q=s(g),q||(q=await i(g,N)))),!F&&!q&&A&&A.length>0&&(q=(await n(A)).privateKey),{publicKeyValue:A||null,privateKeyValue:q||null}}return yn=m,yn}var pn,Ws;function zs(){if(Ws)return pn;Ws=1;const e=Te(),r=je();function f(c,s){if(e.existsSync(s)){const i=e.readFileXSync(s),n=r(i);if(n[c]&&n[c].length>0)return n[c]}}return pn=f,pn}var vn,Qs;function mn(){if(Qs)return vn;Qs=1;const e=fn();function r(f){const c=new e().keypairSync(f),s=c.public_key,i=c.private_key;return{publicKey:s,privateKey:i}}return vn=r,vn}var gn,Js;function Xo(){if(Js)return gn;Js=1;const e=Re,r=Te(),f=je(),c=sn(),s=an(),i=zs(),n=mn();function o(w){const O="DOTENV_PUBLIC_KEY",N="DOTENV_PRIVATE_KEY";if(!r.existsSync(w))return null;const F=r.readFileXSync(w),L=f(F);let y;for(const g of Object.keys(L))(g===O||g.startsWith(O))&&(y=g);return y?y.replace(O,N):null}function m(w,O={}){let N=O.keysFilepath||null;const F=O.noOps===!0,L=c(w),y=L.publicKeyName;let g=L.privateKeyName,A=null,q=null;return A=s(y),A||(A=i(y,w)||null),q=s(g),q||(N?N=e.resolve(N):N=e.resolve(e.dirname(w),".env.keys"),q=i(g,N)),q||(g=o(w),g&&(q=s(g),q||(q=i(g,N)))),!F&&!q&&A&&A.length>0&&(q=n(A).privateKey),{publicKeyValue:A||null,privateKeyValue:q||null}}return gn=m,gn}var bn,ei;function ti(){if(ei)return bn;ei=1;const e="DOTENV_PRIVATE_KEY";function r(f){return f===e?".env":`.env.${f.substring(`${e}_`.length).split("_").join(".").toLowerCase()}`}return bn=r,bn}var En,ni;function ri(){if(ni)return En;ni=1;const e="DOTENV_PRIVATE_KEY";function r(f){return Object.keys(f).filter(c=>c.startsWith(e))}return En=r,En}var _n,si;function rt(){return si||(si=1,_n={keyNames:sn(),keyValues:Zo(),keyValuesSync:Xo(),readProcessKey:an(),readFileKey:$s(),readFileKeySync:zs(),guessPrivateKeyFilename:ti(),dotenvPrivateKeyNames:ri()}),_n}var wn,ii;function oi(){if(ii)return wn;ii=1;const e=Pe();function r(f){const c=process.env.DOTENV_ENV||process.env.NODE_ENV||"development";if(f==="nextjs"){const s=["development","test","production"].includes(c)&&c;return[s&&{type:"envFile",value:`.env.${s}.local`},s!=="test"&&{type:"envFile",value:".env.local"},s&&{type:"envFile",value:`.env.${s}`},{type:"envFile",value:".env"}].filter(Boolean)}else{if(f==="flow")return[{type:"envFile",value:`.env.${c}.local`},{type:"envFile",value:`.env.${c}`},{type:"envFile",value:".env.local"},{type:"envFile",value:".env"},{type:"envFile",value:".env.defaults"}];throw new e({convention:f}).invalidConvention()}}return wn=r,wn}var Sn,ci;function Wo(){if(ci)return Sn;ci=1;const e=oo,r=Re;function f(c){return c[0]==="~"?r.join(e.homedir(),c.slice(1)):c}return Sn=f,Sn}var xn,ai;function ui(){if(ai)return xn;ai=1;const e=Wo();function r(f){let c=[];if(f&&f.path)if(!Array.isArray(f.path))c=[e(f.path)];else{c=[];for(const s of f.path)c.push(e(s))}return c}return xn=r,xn}var An,li;function fi(){if(li)return An;li=1;const e=oi(),r=ui();function f(c){const s=r(c);let i=[];c.convention&&(i=e(c.convention).concat(i));for(const n of s)i.push({type:"envFile",value:n});return i}return An=f,An}var Bn,di;function zo(){if(di)return Bn;di=1;const e=ri(),r=ti(),f="envFile",c=[{type:f,value:".env"}];function s(n){const o=[];for(const m of n){const w=r(m);o.push({type:f,value:w})}return o}function i(n=[],o){const m=e(o);if(!n||n.length<=0)return m.length>0?s(m):c;{let w=!1;for(const O of n)O.type===f&&(w=!0);return w?n:[...c,...n]}}return Bn=i,Bn}var Rn,hi;function yi(){if(hi)return Rn;hi=1;const e=Te(),r=Pe(),f=[".env.project",".env.keys",".env.me",".env.x",".env.example"];function c(s){try{return e.readdirSync(s).filter(o=>o.startsWith(".env")&&!o.endsWith(".previous")&&!f.includes(o))}catch(i){throw i.code==="ENOENT"?new r({directory:s}).missingDirectory():i}}return Rn=c,Rn}var In,pi;function vi(){return pi||(pi=1,In={buildEnvs:fi(),determine:zo(),findEnvFiles:yi(),dotenvOptionPaths:ui(),environment:Vs(),conventions:oi()}),In}var On,mi;function gi(){if(mi)return On;mi=1;const e=Te(),r=Re,f="env",c="envFile",s=Ns(),i=Pe(),n=qs(),o=Fs(),{keyNames:m,keyValues:w,keyValuesSync:O}=rt(),{determine:N}=vi();class F{constructor(y=[],g=!1,A=process.env,q=null,T=!1){this.envs=N(y,A),this.overload=g,this.processEnv=A,this.envKeysFilepath=q,this.noOps=T,this.processedEnvs=[],this.readableFilepaths=new Set,this.readableStrings=new Set,this.uniqueInjectedKeys=new Set,this.beforeEnv={...this.processEnv}}runSync(){for(const y of this.envs)y.type===c?this._injectEnvFileSync(y.value):y.type===f&&this._injectEnv(y.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}async run(){for(const y of this.envs)y.type===c?await this._injectEnvFile(y.value):y.type===f&&this._injectEnv(y.value);return{processedEnvs:this.processedEnvs,readableStrings:[...this.readableStrings],readableFilepaths:[...this.readableFilepaths],uniqueInjectedKeys:[...this.uniqueInjectedKeys],beforeEnv:this.beforeEnv,afterEnv:{...this.processEnv}}}_injectEnv(y){const g={};g.type=f,g.string=y;try{const{parsed:A,errors:q,injected:T,preExisted:C}=new s(y,null,this.processEnv,this.overload).run();g.parsed=A,g.errors=q,g.injected=T,g.preExisted=C,this.inject(g.parsed),this.readableStrings.add(y);for(const _ of Object.keys(T))this.uniqueInjectedKeys.add(_)}catch(A){g.errors=[A]}this.processedEnvs.push(g)}_injectEnvFileSync(y){const g={};g.type=c,g.filepath=y;const A=r.resolve(y);try{const q=o(A),T=e.readFileXSync(A,{encoding:q});this.readableFilepaths.add(y);const{privateKeyName:C}=m(A),{privateKeyValue:_}=O(A,{keysFilepath:this.envKeysFilepath,noOps:this.noOps}),{parsed:h,errors:B,injected:E,preExisted:V}=new s(T,_,this.processEnv,this.overload,C).run();g.privateKeyName=C,g.privateKey=_,g.src=T,g.parsed=h,g.errors=B,g.injected=E,g.preExisted=V,this.inject(g.parsed);for(const R of Object.keys(E))this.uniqueInjectedKeys.add(R)}catch(q){q.code==="ENOENT"||q.code==="EISDIR"?g.errors=[new i({envFilepath:y,filepath:A}).missingEnvFile()]:g.errors=[q]}this.processedEnvs.push(g)}async _injectEnvFile(y){const g={};g.type=c,g.filepath=y;const A=r.resolve(y);try{const q=await n(A),T=await e.readFileX(A,{encoding:q});this.readableFilepaths.add(y);const{privateKeyName:C}=m(A),{privateKeyValue:_}=await w(A,{keysFilepath:this.envKeysFilepath,noOps:this.noOps}),{parsed:h,errors:B,injected:E,preExisted:V}=new s(T,_,this.processEnv,this.overload,C).run();g.privateKeyName=C,g.privateKey=_,g.src=T,g.parsed=h,g.errors=B,g.injected=E,g.preExisted=V,this.inject(g.parsed);for(const R of Object.keys(E))this.uniqueInjectedKeys.add(R)}catch(q){q.code==="ENOENT"||q.code==="EISDIR"?g.errors=[new i({envFilepath:y,filepath:A}).missingEnvFile()]:g.errors=[q]}this.processedEnvs.push(g)}inject(y){for(const g of Object.keys(y))this.processEnv[g]=y[g]}}return On=F,On}var Kn,bi;function ut(){if(bi)return Kn;bi=1;const{PrivateKey:e}=Zt();function r(f){let c;f?c=new e(Buffer.from(f,"hex")):c=new e;const s=c.publicKey.toHex(),i=c.secret.toString("hex");return{publicKey:s,privateKey:i}}return Kn=r,Kn}var Cn,Ei;function Qo(){if(Ei)return Cn;Ei=1;const{encrypt:e}=Zt(),r="encrypted:";function f(c,s){const i=e(s,Buffer.from(c)),n=Buffer.from(i,"hex").toString("base64");return`${r}${n}`}return Cn=f,Cn}var Hn,_i;function wi(){if(_i)return Hn;_i=1;const e=/^encrypted:.+/;function r(f){return e.test(f)}return Hn=r,Hn}var Pn,Si;function xi(){if(Si)return Pn;Si=1;const e=/^DOTENV_PUBLIC_KEY/;function r(f){return e.test(f)}return Pn=r,Pn}var Tn,Ai;function Bi(){if(Ai)return Tn;Ai=1;const e=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
|
|
7
|
+
`),r=Re,f=Te();async function c({envFilepath:s,keysFilepath:i,privateKeyName:n,privateKeyValue:o}){const m=r.basename(s),w=r.resolve(s);let O=r.join(r.dirname(w),".env.keys");i&&(O=r.resolve(i));const N=[`# ${m}`,`${n}=${o}`,""].join(`
|
|
8
|
+
`);let F="";await f.exists(O)&&(F=await f.readFileX(O)),F=F.length>1?F:`${e}
|
|
9
|
+
`,F=`${F}
|
|
10
|
+
${N}`,await f.writeFileX(O,F);const L=i||r.join(r.dirname(s),r.basename(O));return{keysSrc:F,envKeysFilepath:L}}return Tn=c,Tn}var Nn,Ri;function Ii(){if(Ri)return Nn;Ri=1;const e=["#/------------------!DOTENV_PRIVATE_KEYS!-------------------/","#/ private decryption keys. DO NOT commit to source control /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/"].join(`
|
|
11
|
+
`),r=Re,f=Te();function c({envFilepath:s,keysFilepath:i,privateKeyName:n,privateKeyValue:o}){const m=r.basename(s),w=r.resolve(s);let O=r.join(r.dirname(w),".env.keys");i&&(O=r.resolve(i));const N=[`# ${m}`,`${n}=${o}`,""].join(`
|
|
12
|
+
`);let F="";f.existsSync(O)&&(F=f.readFileXSync(O)),F=F.length>1?F:`${e}
|
|
13
|
+
`,F=`${F}
|
|
14
|
+
${N}`,f.writeFileXSync(O,F);const L=i||r.join(r.dirname(s),r.basename(O));return{keysSrc:F,envKeysFilepath:L}}return Nn=c,Nn}var Ln,Oi;function Jo(){if(Oi)return Ln;Oi=1;function e(r){const[f,...c]=r.split(`
|
|
15
|
+
`);let s="";return f.startsWith("#!")&&(s=f+`
|
|
16
|
+
`,r=c.join(`
|
|
17
|
+
`)),{firstLinePreserved:s,envSrc:r}}return Ln=e,Ln}var qn,Ki;function ec(){if(Ki)return qn;Ki=1;function e(r,f,c,s=".env.keys"){const i=s===".env.keys"?"":` # -fk ${s}`;return["#/-------------------[DOTENV_PUBLIC_KEY]--------------------/","#/ public-key encryption for .env files /","#/ [how it works](https://dotenvx.com/encryption) /","#/----------------------------------------------------------/",`${r}="${f}"${i}`,"",`# ${c}`].join(`
|
|
18
|
+
`)}return qn=e,qn}var Dn,Ci;function lt(){if(Ci)return Dn;Ci=1;const e=Re,r=Jo(),f=ec();function c({envSrc:s,envFilepath:i,keysFilepath:n,publicKeyName:o,publicKeyValue:m}){const w=e.basename(i),O=e.resolve(i);let N=e.join(e.dirname(O),".env.keys");n&&(N=e.resolve(n));const F=e.relative(e.dirname(O),N),L=r(s),y=f(o,m,w,F);return s=`${L.firstLinePreserved}${y}
|
|
19
|
+
${L.envSrc}`,{envSrc:s}}return Dn=c,Dn}var Fn,Hi;function tc(){if(Hi)return Fn;Hi=1;const e=lt(),r=Bi(),f=hn(),c=ut(),{keyNames:s}=rt();async function i({envSrc:n,envFilepath:o,keysFilepath:m,noOps:w}){w=w!==!1;const{publicKeyName:O,privateKeyName:N}=s(o);let F,L,y,g,A=!1,q=!1;if(w){const C=c();F=C.publicKey,L=C.privateKey}else{const C=await f();F=C.publicKey,L=C.privateKey}if(n=e({envSrc:n,envFilepath:o,keysFilepath:m,publicKeyName:O,publicKeyValue:F}).envSrc,w){const C=await r({envFilepath:o,keysFilepath:m,privateKeyName:N,privateKeyValue:L});y=C.keysSrc,g=C.envKeysFilepath,A=!0}else q=!0;return{envSrc:n,keysSrc:y,publicKey:F,privateKey:L,envKeysFilepath:g,localPrivateKeyAdded:A,remotePrivateKeyAdded:q}}return Fn=i,Fn}var kn,Pi;function nc(){if(Pi)return kn;Pi=1;const e=lt(),r=Ii(),f=mn(),c=ut(),{keyNames:s}=rt();function i({envSrc:n,envFilepath:o,keysFilepath:m,noOps:w}){w=w!==!1;const{publicKeyName:O,privateKeyName:N}=s(o);let F,L,y,g,A=!1,q=!1;if(w){const C=c();F=C.publicKey,L=C.privateKey}else{const C=f();F=C.publicKey,L=C.privateKey}if(n=e({envSrc:n,envFilepath:o,keysFilepath:m,publicKeyName:O,publicKeyValue:F}).envSrc,w){const C=r({envFilepath:o,keysFilepath:m,privateKeyName:N,privateKeyValue:L});y=C.keysSrc,g=C.envKeysFilepath,A=!0}else q=!0;return{envSrc:n,keysSrc:y,publicKey:F,privateKey:L,envKeysFilepath:g,localPrivateKeyAdded:A,remotePrivateKeyAdded:q}}return kn=i,kn}var Vn,Ti;function rc(){if(Ti)return Vn;Ti=1;const e=Pe(),r=lt(),f=ut();function c({envSrc:s,envFilepath:i,keysFilepath:n,privateKeyValue:o,publicKeyValue:m,publicKeyName:w}){const{publicKey:O,privateKey:N}=f(o);if(m&&m!==O)throw new e({publicKey:O,publicKeyExisting:m}).mispairedPrivateKey();return m||(s=r({envSrc:s,envFilepath:i,keysFilepath:n,publicKeyName:w,publicKeyValue:O}).envSrc),{envSrc:s,publicKey:O,privateKey:N}}return Vn=c,Vn}var jn,Ni;function sc(){if(Ni)return jn;Ni=1;const e=je(),r=wi(),f=xi();function c(s){const i=e(s,!1,!1,!0);for(const[n,o]of Object.entries(i))for(const m of o)if(!(r(m)||f(n)))return!1;return!0}return jn=c,jn}var Mn,Li;function ic(){return Li||(Li=1,Mn={opsKeypair:hn(),opsKeypairSync:mn(),localKeypair:ut(),encryptValue:Qo(),decryptKeyValue:Ks(),isEncrypted:wi(),isPublicKey:xi(),mutateKeysSrc:Bi(),mutateKeysSrcSync:Ii(),provision:tc(),provisionSync:nc(),provisionWithPrivateKey:rc(),mutateSrc:lt(),isFullyEncrypted:sc()}),Mn}var Un,qi;function oc(){if(qi)return Un;qi=1;const e=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function r(f){const c={};let s=f.toString();s=s.replace(/\r\n?/mg,`
|
|
20
|
+
`);let i;for(;(i=e.exec(s))!=null;){const n=i[1];let o=i[2]||"";o=o.trim();const m=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),m===o[0]?c[n]="":c[n]=m}return c}return Un=r,Un}var Gn,Di;function cc(){if(Di)return Gn;Di=1;function e(r){return r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}return Gn=e,Gn}var $n,Fi;function ac(){if(Fi)return $n;Fi=1;function e(r){return r.replace(/\$/g,"$$$$")}return $n=e,$n}var Yn,ki;function Vi(){if(ki)return Yn;ki=1;const e=oc(),r=je(),f=cc(),c=ac();function s(i,n,o){let m,w="";const O=r(i,!0,!0),N=e(i);if(Object.prototype.hasOwnProperty.call(O,n)){const F=N[n];w+=`${n}=${F}${o}${F}`;const L=O[n],y=f(L);let g="";if(y===""){g="$";const T=i.match(new RegExp(`${n}\\s*=\\s*
|
|
10
21
|
|
|
11
|
-
`,"m"));if(
|
|
12
|
-
`}}const
|
|
13
|
-
`)?
|
|
14
|
-
`:
|
|
15
|
-
`+
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
${
|
|
20
|
-
`,t
|
|
21
|
-
|
|
22
|
-
`)}_preserveShebang(L){const[F,...E]=L.split(`
|
|
23
|
-
`);let R="";return F.startsWith("#!")&&(R=F+`
|
|
24
|
-
`,L=E.join(`
|
|
25
|
-
`)),{firstLinePreserved:R,envSrc:L}}}return Rn=O,Rn}var In,Eo;function Gi(){if(Eo)return In;Eo=1;const e=ao(),r=Ze();class y{constructor(u,c=[],s=!1,d="",b=!1,I=null){this.key=u,this.envs=c,this.overload=s,this.DOTENV_KEY=d,this.all=b,this.envKeysFilepath=I}run(){const u={...process.env},{processedEnvs:c}=new e(this.envs,this.overload,this.DOTENV_KEY,u,this.envKeysFilepath).run(),s=[];for(const d of c)for(const b of d.errors)s.push(b);if(this.key){const d={},b=u[this.key];return d[this.key]=b,b===void 0&&s.push(new r({key:this.key}).missingKey()),{parsed:d,errors:s}}else{if(this.all)return{parsed:u,errors:s};const d={};for(const b of c)if(b.parsed)for(const I of Object.keys(b.parsed))d[I]=u[I];return{parsed:d,errors:s}}}}return In=y,In}var On,_o;function Yi(){if(_o)return On;_o=1;const e=Ve(),r=[".env.vault",".env.project",".env.keys",".env.me",".env.x",".env.example"];function y(i){try{return e.readdirSync(i).filter(s=>s.startsWith(".env")&&!s.endsWith(".previous")&&!r.includes(s))}catch(u){if(u.code==="ENOENT"){const c=new Error(`missing directory (${i})`);throw c.code="MISSING_DIRECTORY",c}else throw u}}return On=y,On}var Tn,wo;function $i(){if(wo)return Tn;wo=1;const e=Ve(),r=Ie,y=Ze(),i=Yi(),u=yo(),c=Xe();class s{constructor(b=".",I){this.directory=b,this.envFile=I||i(b),this.exampleFilename=".env.example",this.exampleFilepath=r.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1){const _="MISSING_ENV_FILES",x="no .env* files found",S='? add one with [echo "HELLO=World" > .env] and then run [dotenvx genexample]',O=new Error(x);throw O.code=_,O.help=S,O}const b=new Set,I=new Set,A=this._envFilepaths(),D={},w={};let P=`# ${this.exampleFilename} - generated with dotenvx
|
|
26
|
-
`;for(const _ of A){const x=r.resolve(this.directory,_);if(!e.existsSync(x)){const M=new y({envFilepath:_,filepath:x}).missingEnvFile();throw M.help=`? add it with [echo "HELLO=World" > ${_}] and then run [dotenvx genexample]`,M}let S=e.readFileX(x);const O=c(S);for(const M in O)b.add(M),S=u(S,M,"");P+=`
|
|
27
|
-
${S}`}if(e.existsSync(this.exampleFilepath)){P=e.readFileX(this.exampleFilepath);const _=c(P);for(const x of[...b])x in _?w[x]=_[x]:(P+=`${x}=''
|
|
28
|
-
`,I.add(x),D[x]="")}else for(const _ of[...b])I.add(_),D[_]="";return{envExampleFile:P,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...I],injected:D,preExisted:w}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return Tn=s,Tn}var Nn,So;function Zi(){if(So)return Nn;So=1;function e(r){const y=process.env.DOTENV_ENV||process.env.NODE_ENV||"development";if(r==="nextjs"){const i=["development","test","production"].includes(y)&&y;return[i&&{type:"envFile",value:`.env.${i}.local`},i!=="test"&&{type:"envFile",value:".env.local"},i&&{type:"envFile",value:`.env.${i}`},{type:"envFile",value:".env"}].filter(Boolean)}else{if(r==="flow")return[{type:"envFile",value:`.env.${y}.local`},{type:"envFile",value:`.env.${y}`},{type:"envFile",value:".env.local"},{type:"envFile",value:".env"},{type:"envFile",value:".env.defaults"}];throw new Error(`INVALID_CONVENTION: '${r}'. permitted conventions: ['nextjs', 'flow']`)}}return Nn=e,Nn}var Cn,Ao;function Xi(){if(Ao)return Cn;Ao=1;const e=kn,r=Ie;function y(i){return i[0]==="~"?r.join(e.homedir(),i.slice(1)):i}return Cn=y,Cn}var Pn,xo;function Wi(){if(xo)return Pn;xo=1;const e=Xi();function r(y){let i=[];if(y&&y.path)if(!Array.isArray(y.path))i=[e(y.path)];else{i=[];for(const u of y.path)i.push(e(u))}return i}return Pn=r,Pn}var Hn,Bo;function zi(){if(Bo)return Hn;Bo=1;const{logger:e}=hr();class r{constructor(i={}){this.DOTENV_KEY=i.DOTENV_KEY||process.env.DOTENV_KEY}dotenvKey(){this.DOTENV_KEY&&(e.warn("[DEPRECATION NOTICE] Setting DOTENV_KEY with .env.vault is deprecated."),e.warn("[DEPRECATION NOTICE] Run [dotenvx ext vault migrate] for instructions on converting your .env.vault file to encrypted .env files (using public key encryption algorithm secp256k1)"),e.warn("[DEPRECATION NOTICE] Read more at [https://github.com/dotenvx/dotenvx/blob/main/CHANGELOG.md#0380]"))}}return Hn=r,Hn}var Ln,Ro;function Qi(){if(Ro)return Ln;Ro=1;const e=Ie,r=Zi(),y=Wi(),i=zi();function u(c,s=void 0){const d=y(c);let b=[];c.convention&&(b=r(c.convention).concat(b)),new i({DOTENV_KEY:s}).dotenvKey();for(const I of d)s?b.push({type:"envVaultFile",value:e.join(e.dirname(I),".env.vault")}):b.push({type:"envFile",value:I});return b}return Ln=u,Ln}var Dn,Io;function Ji(){if(Io)return Dn;Io=1;function e(p){return Array.isArray(p)?p:[p]}const r="",y=" ",i="\\",u=/^\s+$/,c=/(?:[^\\]|^)\\$/,s=/^\\!/,d=/^\\#/,b=/\r?\n/g,I=/^\.*\/|^\.+$/,A="/";let D="node-ignore";typeof Symbol<"u"&&(D=Symbol.for("node-ignore"));const w=D,P=(p,o,n)=>Object.defineProperty(p,o,{value:n}),_=/([0-z])-([0-z])/g,x=()=>!1,S=p=>p.replace(_,(o,n,h)=>n.charCodeAt(0)<=h.charCodeAt(0)?o:r),O=p=>{const{length:o}=p;return p.slice(0,o-o%2)},M=[[/^\uFEFF/,()=>r],[/((?:\\\\)*?)(\\?\s+)$/,(p,o,n)=>o+(n.indexOf("\\")===0?y:r)],[/(\\+?)\s/g,(p,o)=>{const{length:n}=o;return o.slice(0,n-n%2)+y}],[/[\\$.|*+(){^]/g,p=>`\\${p}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(p,o,n)=>o+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(p,o,n)=>{const h=n.replace(/\\\*/g,"[^\\/]*");return o+h}],[/\\\\\\(?=[$.|*+(){^])/g,()=>i],[/\\\\/g,()=>i],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(p,o,n,h,f)=>o===i?`\\[${n}${O(h)}${f}`:f==="]"&&h.length%2===0?`[${S(n)}${h}]`:"[]"],[/(?:[^*])$/,p=>/\/$/.test(p)?`${p}$`:`${p}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(p,o)=>`${o?`${o}[^/]+`:"[^/]*"}(?=$|\\/$)`]],L=Object.create(null),F=(p,o)=>{let n=L[p];return n||(n=M.reduce((h,[f,t])=>h.replace(f,t.bind(p)),p),L[p]=n),o?new RegExp(n,"i"):new RegExp(n)},E=p=>typeof p=="string",R=p=>p&&E(p)&&!u.test(p)&&!c.test(p)&&p.indexOf("#")!==0,H=p=>p.split(b);class k{constructor(o,n,h,f){this.origin=o,this.pattern=n,this.negative=h,this.regex=f}}const N=(p,o)=>{const n=p;let h=!1;p.indexOf("!")===0&&(h=!0,p=p.substr(1)),p=p.replace(s,"!").replace(d,"#");const f=F(p,o);return new k(n,p,h,f)},V=(p,o)=>{throw new o(p)},B=(p,o,n)=>E(p)?p?B.isNotRelative(p)?n(`path should be a \`path.relative()\`d string, but got "${o}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${o}\``,TypeError),j=p=>I.test(p);B.isNotRelative=j,B.convert=p=>p;class K{constructor({ignorecase:o=!0,ignoreCase:n=o,allowRelativePaths:h=!1}={}){P(this,w,!0),this._rules=[],this._ignoreCase=n,this._allowRelativePaths=h,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(o){if(o&&o[w]){this._rules=this._rules.concat(o._rules),this._added=!0;return}if(R(o)){const n=N(o,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(o){return this._added=!1,e(E(o)?H(o):o).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(o){return this.add(o)}_testOne(o,n){let h=!1,f=!1;return this._rules.forEach(t=>{const{negative:v}=t;if(f===v&&h!==f||v&&!h&&!f&&!n)return;t.regex.test(o)&&(h=!v,f=v)}),{ignored:h,unignored:f}}_test(o,n,h,f){const t=o&&B.convert(o);return B(t,o,this._allowRelativePaths?x:V),this._t(t,n,h,f)}_t(o,n,h,f){if(o in n)return n[o];if(f||(f=o.split(A)),f.pop(),!f.length)return n[o]=this._testOne(o,h);const t=this._t(f.join(A)+A,n,h,f);return n[o]=t.ignored?t:this._testOne(o,h)}ignores(o){return this._test(o,this._ignoreCache,!1).ignored}createFilter(){return o=>!this.ignores(o)}filter(o){return e(o).filter(this.createFilter())}test(o){return this._test(o,this._testCache,!0)}}const C=p=>new K(p),a=p=>B(p&&B.convert(p),p,x);if(C.isPathValid=a,C.default=C,Dn=C,typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){const p=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");B.convert=p;const o=/^[a-z]:\//i;B.isNotRelative=n=>o.test(n)||j(n)}return Dn}var Kn,Oo;function ec(){if(Oo)return Kn;Oo=1;const e=Ve(),r=Ji();function y(){if(!e.existsSync(".gitignore"))return!1;const i=e.readFileX(".gitignore");return!!r(i).add(i).ignores(".env.keys")}return Kn=y,Kn}var qn,To;function tc(){if(To)return qn;To=1;const e=Ie,{setLogLevel:r,setLogName:y,setLogVersion:i,logger:u}=hr(),{getColor:c,bold:s}=fr(),d=ri(),b=ao(),I=Mi(),A=Gi(),D=hn(),w=$i(),P=Qi(),_=Fs(),x=Ve(),S=ec();return qn={config:function(k={}){let N=process.env;k&&k.processEnv!=null&&(N=k.processEnv);const V=k.overload||k.override,B=k.ignore||[],j=k.strict,K=k.envKeysFile;let C=process.env.DOTENV_KEY;k&&k.DOTENV_KEY&&(C=k.DOTENV_KEY);const a=k.opsOff!==!0;k&&(r(k),y(k),i(k));try{const p=P(k,C),{processedEnvs:o,readableFilepaths:n,uniqueInjectedKeys:h}=new b(p,V,C,N,K,a).run();let f;const t={};for(const g of o){g.type==="envVaultFile"&&(u.verbose(`loading env from encrypted ${g.filepath} (${e.resolve(g.filepath)})`),u.debug(`decrypting encrypted env from ${g.filepath} (${e.resolve(g.filepath)})`)),g.type==="envFile"&&u.verbose(`loading env from ${g.filepath} (${e.resolve(g.filepath)})`);for(const l of g.errors||[]){if(B.includes(l.code)){u.verbose(`ignored: ${l.message}`);continue}if(j)throw l;f=l,l.code==="MISSING_ENV_FILE"&&k.convention||(u.error(l.message),l.help&&u.error(l.help))}Object.assign(t,g.injected||{}),Object.assign(t,g.preExisted||{}),u.debug(g.parsed);for(const[l,m]of Object.entries(g.injected||{}))u.verbose(`${l} set`),u.debug(`${l} set to ${m}`);for(const[l,m]of Object.entries(g.preExisted||{}))u.verbose(`${l} pre-exists (protip: use --overload to override)`),u.debug(`${l} pre-exists as ${m} (protip: use --overload to override)`)}let v=`injecting env (${h.length})`;return n.length>0&&(v+=` from ${n.join(", ")}`),u.successv(v),f?{parsed:t,error:f}:{parsed:t}}catch(p){if(j)throw p;return u.error(p.message),p.help&&u.help(p.help),{parsed:{},error:p}}},parse:function(k,N={}){let V=process.env;N&&N.processEnv!=null&&(V=N.processEnv);const B=N.privateKey||null,j=N.overload||N.override,{parsed:K,errors:C}=new _(k,B,V,j).run();for(const a of C)u.error(a.message),a.help&&u.error(a.help);return K},set:function(k,N,V={}){let B=!0;(V.plain||V.encrypt===!1)&&(B=!1),V&&(r(V),y(V),i(V));const j=P(V),K=V.envKeysFile,{processedEnvs:C,changedFilepaths:a,unchangedFilepaths:p}=new I(k,N,j,B,K).run();let o="";B&&(o=" with encryption");for(const n of C)u.verbose(`setting for ${n.envFilepath}`),n.error?n.error.code==="MISSING_ENV_FILE"?(u.warn(n.error.message),u.help(`? add one with [echo "HELLO=World" > ${n.envFilepath}] and re-run [dotenvx set]`)):(u.warn(n.error.message),n.error.help&&u.help(n.error.help)):(x.writeFileX(n.filepath,n.envSrc),u.verbose(`${n.key} set${o} (${n.envFilepath})`),u.debug(`${n.key} set${o} to ${n.value} (${n.envFilepath})`));a.length>0?u.success(`\u2714 set ${k}${o} (${a.join(",")})`):p.length>0&&u.info(`no changes (${p})`);for(const n of C)n.privateKeyAdded&&(u.success(`\u2714 key added to ${n.envKeysFilepath} (${n.privateKeyName})`),u.help("\u2B95 optional: [dotenvx ops backup] to securely backup private key"),S()||u.help("\u2B95 next run: [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys"),u.help(`\u2B95 next run: [${n.privateKeyName}='${n.privateKey}' dotenvx get ${k}] to test decryption locally`));return{processedEnvs:C,changedFilepaths:a,unchangedFilepaths:p}},get:function(k,N={}){const V=P(N),B=N.ignore||[],{parsed:j,errors:K}=new A(k,V,N.overload,process.env.DOTENV_KEY,N.all,N.envKeysFile).run();for(const C of K||[])if(!B.includes(C.code)){if(N.strict)throw C;u.error(C.message),C.help&&u.error(C.help)}if(k){const C=j[k];return C===void 0?void 0:C}else if(N.format==="eval"){let C="";for(const[a,p]of Object.entries(j))C+=`${a}=${escape(p)}
|
|
29
|
-
`;return C=C.trim(),C}else if(N.format==="shell"){let C="";for(const[a,p]of Object.entries(j))C+=`${a}=${p} `;return C=C.trim(),C}else return j},ls:function(k,N,V){return new d(k,N,V).run()},keypair:function(k,N,V=null){const B=new D(k,V).run();return N?B[N]:B},genexample:function(k,N){return new w(k,N).run()},setLogLevel:r,logger:u,getColor:c,bold:s},qn}var No;function nc(){return No||(No=1,tc().config()),Un}nc();const rc={ALGOLIA_APP_ID:"ALGOLIA_APP_ID",ALGOLIA_ADMIN_API_KEY:"ALGOLIA_ADMIN_API_KEY",ALGOLIA_INDEX_NAME:"ALGOLIA_INDEX_NAME",DATA_DIR:"DATA_DIR"};class $e{static instance;envVars;constructor(){this.envVars={},Object.values(rc).forEach(r=>{const y=process.env[r];if(y==null)throw new Error(`Missing required environment variable: ${r}`);this.envVars[r]=y})}static getInstance(){return $e.instance||($e.instance=new $e),$e.instance}getConfig(r){return this.envVars[r]}}function Co(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function sc(e){const r=Object.keys(e).sort(),y={objectID:e.objectID};for(const i of r)i!=="objectID"&&(y[i]=e[i]);return y}function Po(e){return e.map(sc).sort((r,y)=>r.objectID.localeCompare(y.objectID))}class oc{client;indexName;constructor(r){this.client=r.getClient(),this.indexName=r.getIndexName()}async uploadObjects(r){if(r.length===0){console.error("No items are included in the target JSON file. More than 1 item is necessary.");return}let y=await this.getAllObjects();y=Po(y);const i=Po(r),u=this.determineOperations(y,i);if(u.update.length===0&&u.add.length===0&&u.delete.length===0){console.log("No updates needed. All objects are up to date.");return}if(u.update.length>0){const c=await this.client.partialUpdateObjects({indexName:this.indexName,objects:u.update,createIfNotExists:!0});console.log(`Updated ${c[0].objectIDs.length} objects`)}if(u.add.length>0){const c=await this.client.saveObjects({indexName:this.indexName,objects:u.add});console.log(`Added ${c[0].objectIDs.length} objects`)}if(u.delete.length>0){const c=u.delete.map(d=>d.objectID),s=await this.client.deleteObjects({indexName:this.indexName,objectIDs:c});console.log(`Deleted ${s[0].objectIDs.length} objects`)}}async getAllObjects(){const r=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:y=>{Array.isArray(y.hits)&&y.hits.forEach(i=>{Co(i)&&r.push(i)})}}),r}determineOperations(r,y){const i=new Map(r.map(s=>[s.objectID,s])),u=new Map(y.map(s=>[s.objectID,s])),c={update:[],add:[],delete:[]};for(const s of y){const d=i.get(s.objectID);d==null?c.add.push(s):jo(d,s)||c.update.push(s)}for(const s of r)u.has(s.objectID)||c.delete.push(s);return c}}class Vn{static instance;client;indexName;constructor(r,y){this.client=y(r.getConfig("ALGOLIA_APP_ID"),r.getConfig("ALGOLIA_ADMIN_API_KEY")),this.indexName=r.getConfig("ALGOLIA_INDEX_NAME")}static getInstance(){if(!this.instance){const r=$e.getInstance();this.instance=new Vn(r,Uo)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}}const ic=Ko({meta:{name:Mo,version:Go,description:Yo},args:{},async run({args:e}){try{let r=$e.getInstance().getConfig("DATA_DIR");r=Ie.join(process.cwd(),r),qe.existsSync(r)&&qe.statSync(r).isDirectory()||(console.error(`Error: provided directory does not exist - ${r}`),process.exit(1));const y=$o(r)[0];y.every(u=>Co(u))||(console.error(`The content of the provided json file is incompatible. Check the file: ${r}`),process.exit(1));const i=Vn.getInstance();await new oc(i).uploadObjects(y)}catch(r){console.error("Some errors occured: ",r),process.exit(1)}}});qo(ic);
|
|
22
|
+
`,"m"));if(F===""&&T){const C=T[0].match(/\n/g).length-1;for(let _=0;_<C;_++)w+=`
|
|
23
|
+
`}}const A=new RegExp("^(\\s*)?(export\\s+)?"+n+"\\s*=\\s*[\"'`]?"+y+"[\"'`]?"+g,"gm"),q=c(w);m=i.replace(A,`$1$2${q}`)}else w+=`${n}="${o}"`,i.endsWith(`
|
|
24
|
+
`)?w=w+`
|
|
25
|
+
`:w=`
|
|
26
|
+
`+w,m=i+w;return m}return Yn=s,Yn}var Zn,ji;function uc(){if(ji)return Zn;ji=1;const e=Te(),r=Re,f="envFile",c=Pe(),{determine:s}=vi(),{keyNames:i,keyValues:n,keyValuesSync:o}=rt(),{encryptValue:m,decryptKeyValue:w,isEncrypted:O,provision:N,provisionSync:F,provisionWithPrivateKey:L}=ic(),y=Vi(),g=je(),A=qs(),q=Fs();class T{constructor(_,h,B=[],E=!0,V=null,R=!1,k=!1){this.envs=s(B,process.env),this.key=_,this.value=h,this.encrypt=E,this.envKeysFilepath=V,this.noOps=R,this.noCreate=k,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}runSync(){for(const _ of this.envs)_.type===f&&this._setEnvFileSync(_.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}async run(){for(const _ of this.envs)_.type===f&&await this._setEnvFile(_.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFileSync(_){const h={};h.key=this.key||null,h.value=this.value||null,h.type=f;const B=r.resolve(_);h.filepath=B,h.envFilepath=_,h.changed=!1;try{let E=!1;e.existsSync(B)||(this.noCreate?q(B):e.writeFileXSync(B,""));const V=q(B);let R=e.readFileXSync(B,{encoding:V});h.key&&R.trim().length===0&&(R=`${h.key}="${this.value}"
|
|
27
|
+
`,E=!0);const k=g(R);h.originalValue=k[h.key]||null,E&&(h.originalValue=null);const U=!O(h.originalValue);if(this.readableFilepaths.add(_),this.encrypt){let a,H;const{publicKeyName:l,privateKeyName:u}=i(B),{publicKeyValue:p,privateKeyValue:K}=o(B,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!K&&!p){const t=F({envSrc:R,envFilepath:_,keysFilepath:this.envKeysFilepath,noOps:this.noOps});R=t.envSrc,a=t.publicKey,H=t.privateKey,h.envKeysFilepath=t.envKeysFilepath,h.localPrivateKeyAdded=t.localPrivateKeyAdded,h.remotePrivateKeyAdded=t.remotePrivateKeyAdded}else if(K){const t=L({envSrc:R,envFilepath:_,keysFilepath:this.envKeysFilepath,privateKeyValue:K,publicKeyValue:p,publicKeyName:l});a=t.publicKey,H=t.privateKey,R=t.envSrc,h.originalValue&&(h.originalValue=w(h.key,h.originalValue,u,H))}else p&&(a=p);h.publicKey=a,h.privateKey=H;try{h.encryptedValue=m(this.value,a)}catch{throw new c({publicKeyName:l,publicKey:a}).invalidPublicKey()}h.privateKeyName=u}const Z=U&&this.encrypt,G=this.value!==h.originalValue;E&&!this.encrypt?(h.envSrc=R,this.changedFilepaths.add(_),h.changed=!0):Z||G?(h.envSrc=y(R,this.key,h.encryptedValue||this.value),this.changedFilepaths.add(_),h.changed=!0):(h.envSrc=R,this.unchangedFilepaths.add(_),h.changed=!1)}catch(E){E.code==="ENOENT"?h.error=new c({envFilepath:_,filepath:B}).missingEnvFile():h.error=E}this.processedEnvs.push(h)}async _setEnvFile(_){const h={};h.key=this.key||null,h.value=this.value||null,h.type=f;const B=r.resolve(_);h.filepath=B,h.envFilepath=_,h.changed=!1;try{let E=!1;await e.exists(B)||(this.noCreate?await A(B):await e.writeFileX(B,""));const V=await A(B);let R=await e.readFileX(B,{encoding:V});h.key&&R.trim().length===0&&(R=`${h.key}="${this.value}"
|
|
28
|
+
`,E=!0);const k=g(R);h.originalValue=k[h.key]||null,E&&(h.originalValue=null);const U=!O(h.originalValue);if(this.readableFilepaths.add(_),this.encrypt){let a,H;const{publicKeyName:l,privateKeyName:u}=i(B),{publicKeyValue:p,privateKeyValue:K}=await n(B,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!K&&!p){const t=await N({envSrc:R,envFilepath:_,keysFilepath:this.envKeysFilepath,noOps:this.noOps});R=t.envSrc,a=t.publicKey,H=t.privateKey,h.envKeysFilepath=t.envKeysFilepath,h.localPrivateKeyAdded=t.localPrivateKeyAdded,h.remotePrivateKeyAdded=t.remotePrivateKeyAdded}else if(K){const t=L({envSrc:R,envFilepath:_,keysFilepath:this.envKeysFilepath,privateKeyValue:K,publicKeyValue:p,publicKeyName:l});a=t.publicKey,H=t.privateKey,R=t.envSrc,h.originalValue&&(h.originalValue=w(h.key,h.originalValue,u,H))}else p&&(a=p);h.publicKey=a,h.privateKey=H;try{h.encryptedValue=m(this.value,a)}catch{throw new c({publicKeyName:l,publicKey:a}).invalidPublicKey()}h.privateKeyName=u}const Z=U&&this.encrypt,G=this.value!==h.originalValue;E&&!this.encrypt?(h.envSrc=R,this.changedFilepaths.add(_),h.changed=!0):Z||G?(h.envSrc=y(R,this.key,h.encryptedValue||this.value),this.changedFilepaths.add(_),h.changed=!0):(h.envSrc=R,this.unchangedFilepaths.add(_),h.changed=!1)}catch(E){E.code==="ENOENT"?h.error=new c({envFilepath:_,filepath:B}).missingEnvFile():h.error=E}this.processedEnvs.push(h)}}return Zn=T,Zn}var Xn,Mi;function lc(){if(Mi)return Xn;Mi=1;const e=gi(),r=Pe();class f{constructor(s,i=[],n=!1,o=!1,m=null,w=!1){this.key=s,this.envs=i,this.overload=n,this.all=o,this.envKeysFilepath=m,this.noOps=w}runSync(){const s={...process.env},{processedEnvs:i}=new e(this.envs,this.overload,s,this.envKeysFilepath,this.noOps).runSync();return this._result(i,s)}async run(){const s={...process.env},{processedEnvs:i}=await new e(this.envs,this.overload,s,this.envKeysFilepath,this.noOps).run();return this._result(i,s)}_result(s,i){const n=[];for(const m of s)for(const w of m.errors)n.push(w);if(this.key){const m={},w=i[this.key];return m[this.key]=w,w===void 0&&n.push(new r({key:this.key}).missingKey()),{parsed:m,errors:n}}if(this.all)return{parsed:i,errors:n};const o={};for(const m of s)if(m.parsed)for(const w of Object.keys(m.parsed))o[w]=i[w];return{parsed:o,errors:n}}}return Xn=f,Xn}var Wn,Ui;function fc(){if(Ui)return Wn;Ui=1;const{keyNames:e,keyValues:r,keyValuesSync:f}=rt();class c{constructor(i=".env",n=null,o=!1){this.envFile=i,this.envKeysFilepath=n,this.noOps=o}runSync(){const i={},n=this._filepaths();for(const o of n){const{publicKeyName:m,privateKeyName:w}=e(o),{publicKeyValue:O,privateKeyValue:N}=f(o,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});i[m]=O,i[w]=N}return i}async run(){const i={},n=this._filepaths();for(const o of n){const{publicKeyName:m,privateKeyName:w}=e(o),{publicKeyValue:O,privateKeyValue:N}=await r(o,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});i[m]=O,i[w]=N}return i}_filepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return Wn=c,Wn}var zn,Gi;function dc(){if(Gi)return zn;Gi=1;const e=Te(),r=Re,f=Pe(),c=yi(),s=Vi(),i=je();class n{constructor(m=".",w){this.directory=m,this.envFile=w||c(m),this.exampleFilename=".env.example",this.exampleFilepath=r.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1)throw new f().missingEnvFiles();const m=new Set,w=new Set,O=this._envFilepaths(),N={},F={};let L=`# ${this.exampleFilename} - generated with dotenvx
|
|
29
|
+
`;for(const y of O){const g=r.resolve(this.directory,y);if(!e.existsSync(g)){const T=new f({envFilepath:y,filepath:g}).missingEnvFile();throw T.help=`? add it with [echo "HELLO=World" > ${y}] and then run [dotenvx genexample]`,T}let A=e.readFileXSync(g);const q=i(A);for(const T in q)m.add(T),A=s(A,T,"");L+=`
|
|
30
|
+
${A}`}if(e.existsSync(this.exampleFilepath)){L=e.readFileXSync(this.exampleFilepath);const y=i(L);for(const g of[...m])g in y?F[g]=y[g]:(L+=`${g}=''
|
|
31
|
+
`,w.add(g),N[g]="")}else for(const y of[...m])w.add(y),N[y]="";return{envExampleFile:L,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...w],injected:N,preExisted:F}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}return zn=n,zn}var Qn,$i;function hc(){if($i)return Qn;$i=1;const e=fn(),{logger:r}=Or();class f{constructor(){this.ops=new e}async noOps(){const s=await this.ops.status();return r.debug(`ops: ${s}`),s==="off"}noOpsSync(){const s=this.ops.statusSync();return r.debug(`ops: ${s}`),s==="off"}}return Qn=f,Qn}var Jn,Yi;function yc(){if(Yi)return Jn;Yi=1;const e=Re;function r(f){return f?e.isAbsolute(f)?e.relative(process.cwd(),f)||e.basename(f):f:".env.keys"}return Jn=r,Jn}var er,Zi;function pc(){if(Zi)return er;Zi=1;const e=Re,{setLogLevel:r,setLogName:f,setLogVersion:c,logger:s}=Or(),{getColor:i,bold:n}=Rr(),o=Ao(),m=gi(),w=uc(),O=lc(),N=fc(),F=dc(),L=hc(),y=fi(),g=Ns(),A=Te(),q=yc(),T=function(k={}){let U=process.env;k&&k.processEnv!=null&&(U=k.processEnv);const Z=k.overload||k.override,G=k.ignore||[],$=k.strict,a=k.envKeysFile;k&&(r(k),f(k),c(k));const H=R(k);try{const l=y(k),{processedEnvs:u,readableFilepaths:p,uniqueInjectedKeys:K}=new m(l,Z,U,a,H).runSync();let t;const v={};for(const x of u){x.type==="envFile"&&s.verbose(`loading env from ${x.filepath} (${e.resolve(x.filepath)})`);for(const D of x.errors||[]){if(G.includes(D.code)){s.verbose(`ignored: ${D.message}`);continue}if($)throw D;t=D,D.code==="MISSING_ENV_FILE"&&k.convention||s.error(D.messageWithHelp)}Object.assign(v,x.injected||{}),Object.assign(v,x.preExisted||{}),s.debug(x.parsed);for(const[D,J]of Object.entries(x.injected||{}))s.verbose(`${D} set`),s.debug(`${D} set to ${J}`);for(const[D,J]of Object.entries(x.preExisted||{}))s.verbose(`${D} pre-exists (protip: use --overload to override)`),s.debug(`${D} pre-exists as ${J} (protip: use --overload to override)`)}let S=`injecting env (${K.length})`;return p.length>0&&(S+=` from ${p.join(", ")}`),s.successv(S),t?{parsed:v,error:t}:{parsed:v}}catch(l){if($)throw l;return s.error(l.messageWithHelp),{parsed:{},error:l}}},C=function(k,U={}){let Z=process.env;U&&U.processEnv!=null&&(Z=U.processEnv);const G=U.privateKey||null,$=U.overload||U.override,{parsed:a,errors:H}=new g(k,G,Z,$).run();for(const l of H)s.error(l.messageWithHelp);return a},_=function(k,U,Z={}){let G=!0;(Z.plain||Z.encrypt===!1)&&(G=!1),Z&&(r(Z),f(Z),c(Z));const $=y(Z),a=Z.envKeysFile,H=R(Z),{processedEnvs:l,changedFilepaths:u,unchangedFilepaths:p}=new w(k,U,$,G,a,H).runSync();let K="";G&&(K=" with encryption");for(const x of l)if(s.verbose(`setting for ${x.envFilepath}`),x.error){const D=x.error,J=D.messageWithHelp||(D.help?`${D.message}. ${D.help}`:D.message);s.warn(J)}else A.writeFileXSync(x.filepath,x.envSrc),s.verbose(`${x.key} set${K} (${x.envFilepath})`),s.debug(`${x.key} set${K} to ${x.value} (${x.envFilepath})`);let t="";const v=l.find(x=>x.localPrivateKeyAdded),S=l.find(x=>x.remotePrivateKeyAdded);if(v&&(t=` + local key (${q(v.envKeysFilepath)})`),S&&(t=" + armored key \u26E8"),u.length>0)G?s.success(`\u25C8 encrypted ${k} (${u.join(",")})${t}`):s.success(`\u25C7 set ${k} (${u.join(",")})`);else if(G&&v){const x=v.envFilepath||u[0]||".env";s.success(`\u25C8 encrypted ${k} (${x})${t}`)}else p.length>0&&s.info(`\u25CB no change (${p})`);return{processedEnvs:l,changedFilepaths:u,unchangedFilepaths:p}},h=function(k,U={}){const Z=y(U),G=R(U),$=U.ignore||[],{parsed:a,errors:H}=new O(k,Z,U.overload,U.all,U.envKeysFile,G).runSync();for(const l of H||[])if(!$.includes(l.code)){if(U.strict)throw l;s.error(l.messageWithHelp)}if(k){const l=a[k];return l===void 0?void 0:l}else if(U.format==="eval"){let l="";for(const[u,p]of Object.entries(a))l+=`${u}=${escape(p)}
|
|
32
|
+
`;return l=l.trim(),l}else if(U.format==="shell"){let l="";for(const[u,p]of Object.entries(a))l+=`${u}=${p} `;return l=l.trim(),l}else return a},B=function(k,U,Z){return new o(k,U,Z).run()},E=function(k,U){return new F(k,U).run()},V=function(k,U,Z=null,G=!1){const $=new N(k,Z,G).runSync();return U?$[U]:$};function R(k={}){const U=new L;return k.noOps===!0||k.opsOff===!0||U.noOpsSync()}return er={config:T,parse:C,set:_,get:h,ls:B,keypair:V,genexample:E,setLogLevel:r,logger:s,getColor:i,bold:n},er}var Xi;function vc(){return Xi||(Xi=1,pc().config()),rr}vc();const mc={ALGOLIA_APP_ID:"ALGOLIA_APP_ID",ALGOLIA_ADMIN_API_KEY:"ALGOLIA_ADMIN_API_KEY",ALGOLIA_INDEX_NAME:"ALGOLIA_INDEX_NAME",DATA_DIR:"DATA_DIR"};class Ze{static instance;envVars;constructor(){this.envVars={},Object.values(mc).forEach(r=>{const f=process.env[r];if(f==null)throw new Error(`Missing required environment variable: ${r}`);this.envVars[r]=f})}static getInstance(){return Ze.instance||(Ze.instance=new Ze),Ze.instance}getConfig(r){return this.envVars[r]}}function Wi(e){return typeof e=="object"&&e!==null&&"objectID"in e&&typeof e.objectID=="string"}function gc(e){const r=Object.keys(e).sort(),f={objectID:e.objectID};for(const c of r)c!=="objectID"&&(f[c]=e[c]);return f}function zi(e){return e.map(gc).sort((r,f)=>r.objectID.localeCompare(f.objectID))}class bc{client;indexName;constructor(r){this.client=r.getClient(),this.indexName=r.getIndexName()}async uploadObjects(r){if(r.length===0){console.error("No items are included in the target JSON file. More than 1 item is necessary.");return}let f=await this.getAllObjects();f=zi(f);const c=zi(r),s=this.determineOperations(f,c);if(s.update.length===0&&s.add.length===0&&s.delete.length===0){console.log("No updates needed. All objects are up to date.");return}if(s.update.length>0){const i=await this.client.partialUpdateObjects({indexName:this.indexName,objects:s.update,createIfNotExists:!0});console.log(`Updated ${i[0].objectIDs.length} objects`)}if(s.add.length>0){const i=await this.client.saveObjects({indexName:this.indexName,objects:s.add});console.log(`Added ${i[0].objectIDs.length} objects`)}if(s.delete.length>0){const i=s.delete.map(o=>o.objectID),n=await this.client.deleteObjects({indexName:this.indexName,objectIDs:i});console.log(`Deleted ${n[0].objectIDs.length} objects`)}}async getAllObjects(){const r=[];return await this.client.browseObjects({indexName:this.indexName,aggregator:f=>{Array.isArray(f.hits)&&f.hits.forEach(c=>{Wi(c)&&r.push(c)})}}),r}determineOperations(r,f){const c=new Map(r.map(n=>[n.objectID,n])),s=new Map(f.map(n=>[n.objectID,n])),i={update:[],add:[],delete:[]};for(const n of f){const o=c.get(n.objectID);o==null?i.add.push(n):co(o,n)||i.update.push(n)}for(const n of r)s.has(n.objectID)||i.delete.push(n);return i}}class tr{static instance;client;indexName;constructor(r,f){this.client=f(r.getConfig("ALGOLIA_APP_ID"),r.getConfig("ALGOLIA_ADMIN_API_KEY")),this.indexName=r.getConfig("ALGOLIA_INDEX_NAME")}static getInstance(){if(!this.instance){const r=Ze.getInstance();this.instance=new tr(r,ao)}return this.instance}getClient(){return this.client}getIndexName(){return this.indexName}}const Ec=to({meta:{name:uo,version:lo,description:fo},args:{},async run({args:e}){try{let r=Ze.getInstance().getConfig("DATA_DIR");r=Re.join(process.cwd(),r),Fe.existsSync(r)&&Fe.statSync(r).isDirectory()||(console.error(`Error: provided directory does not exist - ${r}`),process.exit(1));const f=ho(r)[0];f.every(s=>Wi(s))||(console.error(`The content of the provided json file is incompatible. Check the file: ${r}`),process.exit(1));const c=tr.getInstance();await new bc(c).uploadObjects(f)}catch(r){console.error("Some errors occured: ",r),process.exit(1)}}});no(Ec);
|